Skip to content

Commit

Permalink
⚙️ Yeni compileri (kdc) kullanmaya başla
Browse files Browse the repository at this point in the history
  • Loading branch information
KimlikDAO-bot committed Jun 15, 2024
1 parent 3f940a2 commit 1155af9
Show file tree
Hide file tree
Showing 30 changed files with 125 additions and 374 deletions.
19 changes: 4 additions & 15 deletions al/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,11 @@ build/al/sayfa-%.js: al/sayfa.js \
lib/node/ipfs.js lib/node/network.js \
lib/util/dom.js lib/util/çevir.js lib/util/base58.js \
build/al/tanışma/birim.keymap
mkdir -p $(dir $@)
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--define "TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
--define "KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(al-tr)" \
--define "KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(al-en)" \
--emit_use_strict \
--module_resolution NODE \
--assume_function_wrapper \
--dependency_mode PRUNE \
--entry_point $< \
--js $(filter %.js,$^) \
--js_output_file $@
bun lib/kdc/kdc.js $^ -o $@ --loose --define \
"TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
"KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(al-tr)" \
"KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(al-en)"
bun lib/birimler/değiştirici.js $@ $(filter %.keymap,$^)
bun uglifyjs $@ -m -c toplevel,unsafe -o $@
bun lib/birimler/bigintCompressor.js $@
wc $@

build/al/sayfa.css: al/sayfa.css al/*/*.css birim/kutu.css
mkdir -p $(dir $@)
Expand Down
31 changes: 16 additions & 15 deletions al/imeceİptal/birim.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import dom from "/lib/util/dom";

/** @const {!Element} */
const Kök = dom.adla("im");
/** @const {!Element} */
const EşikGirdisi = dom.adla("imt");
/** @const {!HTMLInputElement} */
const EşikGirdisi = /** @type {!HTMLInputElement} */(dom.adla("imt"));
/** @const {!Element} */
const GösterButonu = dom.adla("imbe");
/** @const {!Element} */
const İptalButonu = dom.adla("imbh");
/** @const {!HTMLAnchorElement} */
const İptalButonu = /** @type {!HTMLAnchorElement} */(dom.adla("imbh"));
/** @const {!Element} */
const İptalciler = dom.adla("imf");
/** @const {!Element} */
const Kutu = dom.adla("imc");
/** @const {!Element} */
const ToplamAğırlık = dom.adla("ims");
/** @const {!HTMLInputElement} */
const ToplamAğırlık = /** @type {!HTMLInputElement} */(dom.adla("ims"));

/**
* @param {ChainId} ağ Native tokeninde KPass fiyatının gösterileceği ağ.
Expand Down Expand Up @@ -123,8 +123,8 @@ const kutularıAç = (sonra) => {
/** @const {NodeList<!Element>} */
const satır = İptalciler.children;
for (let /** number */ i = 0; i < satır.length; ++i) {
/** @const {!Element} */
const girdi = /** @type {!Element} */(satır[i].firstElementChild);
/** @const {!HTMLInputElement} */
const girdi = /** @type {!HTMLInputElement} */(satır[i].firstElementChild);
/** @const {string} */
const adres = girdi.value;
if (!evm.adresGeçerli(adres) || adres in adresAğırlığı ||
Expand All @@ -133,7 +133,7 @@ const kutularıAç = (sonra) => {
satır[i].firstElementChild.classList.add("imin");
} else {
/** @type {number} */
const ağırlık = +satır[i].children[3].value;
const ağırlık = +/** @type {!HTMLInputElement} */(satır[i].children[3]).value;
adresAğırlığı[adres] = ağırlık;
toplamAğırlık += ağırlık;
}
Expand Down Expand Up @@ -164,14 +164,14 @@ const kutularıAç = (sonra) => {
const işlevEkle = (satır) => {
/** @const {NodeList<!Element>} */
const elemanlar = satır.children;
elemanlar[0].value = "";
/** @type {!HTMLInputElement} */(elemanlar[0]).value = "";
elemanlar[0].onblur = (e) => girdiDüzelt(e.target);
elemanlar[0].classList.remove("imin");
elemanlar[1].onclick = yapıştır;
elemanlar[2].onclick = birAzalt;
elemanlar[3].onblur = ağırlıkBlurOlunca;
elemanlar[3].onclick = (e) => e.target.value = "";
elemanlar[3].value = 1;
/** @type {!HTMLInputElement} */(elemanlar[3]).value = 1;
elemanlar[4].onclick = birArttır;
elemanlar[5].onclick = iptalciGirdisiSil;
}
Expand Down Expand Up @@ -212,7 +212,7 @@ const eşikDeğeriBlurOlunca = (event) => {
}

/**
* @param {Element} girdi
* @param {!HTMLInputElement} girdi
*/
const girdiDüzelt = (girdi) => {
/** @const {string} */
Expand All @@ -234,7 +234,8 @@ const yapıştır = (event) => {
let a = /** @type {Element} */(event.target);
for (; a.nodeName !== 'A'; a = a.parentElement)
if (a.nodeName == 'DIV') return;
const girdi = a.previousElementSibling;
/** @const {HTMLInputElement} */
const girdi = /** @type {HTMLInputElement} */(a.previousElementSibling);
navigator.clipboard.readText().then(
(değer) => {
girdi.value = değer;
Expand Down Expand Up @@ -278,10 +279,10 @@ const ağırlıkHesapla = () => {
/** @const {NodeList<!Element>} */
const satır = İptalciler.children;
for (let /** number */ i = 0; i < satır.length; ++i) {
total += +satır[i].children[3].value;
total += +/** @type {HTMLInputElement} */(satır[i].children[3]).value;
}
ToplamAğırlık.value = total;
if (EşikGirdisi.value > total)
if (+EşikGirdisi.value > total)
EşikGirdisi.value = total;
}

Expand Down
2 changes: 1 addition & 1 deletion al/sayfa.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<link href="/birim/ortak.css" rel="stylesheet" type="text/css" />
<link href="/al/sayfa.css" rel="stylesheet" type="text/css" />
<birim:favicon />
<script type="module" src="/al/sayfa.js"></script>
</head>

<body>
Expand Down Expand Up @@ -42,7 +43,6 @@
<birim:telefon style="opacity:0" data-kpasssiz="true" />
</div>
</div>
<script async type="module" src="/al/sayfa.js" data-remove-type></script>
</body>

</html>
8 changes: 4 additions & 4 deletions al/sayfa.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { hex } from "/lib/util/çevir";
const kpassYarat = (adres, açıkKPass) => {
/** @const {!Element} */
const şifrele = dom.adla("al3");
/** @const {!Element} */
const şifreleDüğmesi = dom.adla("al3a");
/** @const {!HTMLAnchorElement} */
const şifreleDüğmesi = /** @type {!HTMLAnchorElement} */(dom.adla("al3a"));

dom.adla("te").style.opacity = 1;
şifrele.classList.remove("disabled");
Expand Down Expand Up @@ -78,8 +78,8 @@ const kpassYarat = (adres, açıkKPass) => {
const bağlaAdımı = () => {
/** @const {!Element} */
const kök = dom.adla("al1");
/** @const {!Element} */
const düğme = dom.adla("al1a");
/** @const {!HTMLAnchorElement} */
const düğme = /** @type {!HTMLAnchorElement} */(dom.adla("al1a"));
düğme.onclick = Cüzdan.;

Cüzdan.adresDeğişince((adres) => {
Expand Down
15 changes: 1 addition & 14 deletions al/tanışma/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,4 @@ build/al/tanışma/powWorker.js: al/tanışma/powWorker.js \
lib/crypto/sha3.js \
lib/util/worker.d.js \
lib/util/çevir.js
mkdir -p $(dir $@)
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--jscomp_error=unusedLocalVariables \
--jscomp_error=strictCheckTypes \
--rewrite_polyfills=false \
--emit_use_strict \
--module_resolution NODE \
--assume_function_wrapper \
--dependency_mode PRUNE \
--entry_point $< \
--js $^ \
--js_output_file $@
bun uglifyjs $@ -m -c toplevel,unsafe -o $@
wc $@
bun lib/kdc/kdc.js $^ -o $@
8 changes: 4 additions & 4 deletions al/tanışma/birim.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ const açıkKPassAlVe = (ağÇeşidi, adres, sonra) => {

/** @const {Element} */
const eDevletDüğmesi = dom.adla("taa");
/** @const {Element} */
const nkoDüğmesi = dom.adla("tab");
/** @const {HTMLAnchorElement} */
const nkoDüğmesi = /** @type {!HTMLAnchorElement} */(dom.adla("tab"));
/** @const {Element} */
const kutu = dom.adla("ta");
/** @const {string} */
Expand Down Expand Up @@ -183,8 +183,8 @@ const açıkKPassAlVe = (ağÇeşidi, adres, sonra) => {
dom.gizle(nkoDüğmesi);
/** @const {Element} */
const dosyaBırakmaBölgesi = dom.adla("tada");
/** @const {Element} */
const dosyaSeçici = dom.adla("tain");
/** @const {!HTMLInputElement} */
const dosyaSeçici = /** @type {!HTMLInputElement} */(dom.adla("tain"));
dom.adla("tadsbtn").onclick = () => dosyaSeçici.click();
/** @const {Element} */
const dosyaYüklemeBölümü = dom.adla("tadc");
Expand Down
26 changes: 14 additions & 12 deletions al/ödeme/birim.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import dom from "/lib/util/dom";
const Kök = dom.adla("od");

/**
* @param {Element} imge
* @param {Element} satır
* @param {!HTMLImageElement} imge
* @param {!Element} satır
*/
const imgeEkle = (imge, satır) => {
satır = satır.lastElementChild;
satır = /** @type {!Element} */(satır.lastElementChild);
imge = imge.cloneNode(true);
imge.width = 16;
imge.height = 16;
Expand Down Expand Up @@ -65,10 +65,10 @@ const paraVeMiktar = (para, miktar) => {
const öde = (cidSözü, adresAğırlığı, eşik) => {
/** @const {Element} */
const paraDüğmesi = dom.adla("odb");
/** @const {Element} */
const döküm = dom.adla("odi").firstElementChild;
/** @const {Element} */
const toplamKutusu = döküm.children[3].lastElementChild;
/** @const {!Element} */
const döküm = /** @type {!Element} */(dom.adla("odi").firstElementChild);
/** @const {!Element} */
const toplamKutusu = /** @type {!Element} */(döküm.children[3].lastElementChild);
/** @const {boolean} */
const iptalli = !!eşik;
/** @type {number} */
Expand Down Expand Up @@ -102,15 +102,17 @@ const öde = (cidSözü, adresAğırlığı, eşik) => {
// yeniAğ'da mevcut token yoksa 'native token'e geç
if (!KPass.isTokenAvailable(yeniAğ, para)) para = 0;

/** @const {!HTMLImageElement} */
const imge = /** @type {!HTMLImageElement} */(li.lastElementChild);
// Ağ ücreti imgesini ekle
imgeEkle(li.lastElementChild, döküm.children[2]);
imgeEkle(li.lastElementChild, toplamKutusu);
paraDeğişti(para, para == 0 ? li.lastElementChild : null);
imgeEkle(imge, döküm.children[2]);
imgeEkle(imge, toplamKutusu);
paraDeğişti(para, para == 0 ? imge : null);
}

/**
* @param {number} yeniPara
* @param {?Element} imgeAslı
* @param {?HTMLImageElement} imgeAslı
*/
const paraDeğişti = (yeniPara, imgeAslı) => {
para = yeniPara;
Expand Down Expand Up @@ -167,7 +169,7 @@ const öde = (cidSözü, adresAğırlığı, eşik) => {
const li = event.target.nodeName == "LI"
? event.target : event.target.parentElement;
if (!li.id.startsWith("odd")) return;
paraDeğişti(+li.id[3], li.lastElementChild);
paraDeğişti(+li.id[3], /** @type {!HTMLImageElement} */(li.lastElementChild));
};

ağDeğişti(Cüzdan.());
Expand Down
20 changes: 5 additions & 15 deletions ana/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,11 @@ build/ana/sayfa-%.js: ana/sayfa.js \
lib/mina/*.d.js \
lib/node/*.d.js lib/node/ipfs.js \
lib/util/dom.js lib/util/çevir.js lib/util/base58.js
mkdir -p $(dir $@)
bun google-closure-compiler -W VERBOSE -O ADVANCED --charset UTF-8 \
--define "TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
--define "KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(ana-tr)" \
--define "KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(ana-en)" \
--emit_use_strict \
--module_resolution NODE \
--assume_function_wrapper \
--dependency_mode PRUNE \
--entry_point $< \
--js $^ \
--js_output_file $@
bun uglifyjs $@ -m -c toplevel,unsafe -o $@
bun lib/birimler/bigintCompressor.js $@
wc $@
bun lib/kdc/kdc.js $^ --define \
"TR\$$\$$module\$$lib\$$util\$$dom=$(Lang-$*)" \
"KonumTR\$$\$$module\$$birim\$$dil\$$birim=$(ana-tr)" \
"KonumEN\$$\$$module\$$birim\$$dil\$$birim=$(ana-en)" \
-o $@

build/ana/sayfa-%.css: \
build/birim/lato/l400.css \
Expand Down
5 changes: 3 additions & 2 deletions ana/sayfa.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<link href="/ana/sayfa.css" rel="stylesheet" type="text/css" data-remove />
<link href="/birim/blog/birim.css" rel="stylesheet" type="text/css" data-remove />
<birim:favicon />
<script type="module" src="/ana/sayfa.js"></script>
</head>

<body id="an">
Expand All @@ -30,7 +31,8 @@
katıl</a>
<a class=bae href="//discord.gg/H2wg6pcWXG" target="_blank" rel="noreferrer">Discord</a>
<birim:dil />
<birim:cüzdan data-chains="0x1|0xa4b1,Ana ağ,Signal chain,default|0xa86a,Önerilir,Recommended|0x89|0x38|m:berkeley,Berkeley Testağı,Berkeley Testnet" />
<birim:cüzdan
data-chains="0x1|0xa4b1,Ana ağ,Signal chain,default|0xa86a,Önerilir,Recommended|0x89|0x38|m:berkeley,Berkeley Testağı,Berkeley Testnet" />
<a id="bal" data-en-href="/mint" href="/al" class="btn act"><span data-phantom data-en="Mint KPass">Hemen KPass
al</span><img src="/ana/ok.svg" data-inline>
</a>
Expand All @@ -43,7 +45,6 @@
<hr class="anhr">
<altbirim:raporlar />
<birim:altdizin />
<script async type="module" src="/ana/sayfa.js" data-remove-type></script>
</body>

</html>
6 changes: 3 additions & 3 deletions ana/sayfa.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import "/birim/dil/birim";
import dom from "/lib/util/dom";

Cüzdan.kpassDeğişince((_, dosyaSözü) => {
/** @const {!Element} */
const eylemDüğmesi = dom.adla("bal");
eylemDüğmesi.firstChild.data = dosyaSözü
/** @const {!HTMLAnchorElement} */
const eylemDüğmesi = /** @type {!HTMLAnchorElement} */(dom.adla("bal"));
/** @type {!Text} */(eylemDüğmesi.firstChild).data = dosyaSözü
? dom.TR ? "KPass’ini incele" : "View KPass"
: dom.TR ? "Hemen KPass al" : "Mint KPass"
eylemDüğmesi.href = dosyaSözü
Expand Down
14 changes: 14 additions & 0 deletions app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
kök: ""
dizin: "ana"
sayfalar:
- tr: "al"
en: "mint"

- tr: "kpassim"
en: "kpass"

- tr: "oyla"
en: "vote"

- tr: "iptal"
en: "revoke"
4 changes: 2 additions & 2 deletions birim/cüzdan/birim.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ const kpassDeğişti = () => {
if (!Adres) return;
/** @const {!Element} */
const kpassDüğmesi = dom.adla("cuin");
/** @const {!Element} */
const kpassResmi = dom.adla("cutc");
/** @const {!HTMLImageElement} */
const kpassResmi = /** @type {!HTMLImageElement} */(dom.adla("cutc"));

/** @const {ChainId} */
const = ;
Expand Down
2 changes: 1 addition & 1 deletion birim/cüzdan/evmBağlantısı.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ağSeç = (provider, ağ) => provider.request(/** @type {!eth.Request} */(
* @const
*/
const ağBilgisi = AğBilgileri[];
if (e.code == 4902)
if (/** @type {eth.ProviderRpcError} */(e).code == 4902)
return provider.request(/** @type {!eth.Request} */({
method: "wallet_addEthereumChain",
params: [/** @type {!eth.AddChainParam} */({
Expand Down
5 changes: 3 additions & 2 deletions birim/dil/birim.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ const DilButonu = dom.adla("dib");

dom.menüYarat(DilButonu, dom.adla("did"));
dom.adla("did").onclick = (/** @type {Event} */ event) => {
/** @const {!Element} */
const targetElem = /** @type {!Element} */(event.target);
/** @const {Element} */
const li = event.target.nodeName == "LI"
? event.target : event.target.parentElement;
const li = targetElem.nodeName == "LI" ? targetElem : targetElem.parentElement;

/** @const {string} */
const diğerDil = dom.TR ? "en" : "tr";
Expand Down
4 changes: 2 additions & 2 deletions birim/kaydol/birim.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const kur = (domAdı) => {
let KaydolMetni;
/** @const {!Element} */
const kök = dom.adla(domAdı);
/** @const {!Element} */
const girdi = /** @type {!Element} */(kök.firstElementChild);
/** @const {!HTMLInputElement} */
const girdi = /** @type {!HTMLInputElement} */(kök.firstElementChild);
/** @const {!Element} */
const düğme = /** @type {!Element} */(girdi.nextElementSibling);

Expand Down
Loading

0 comments on commit 1155af9

Please sign in to comment.