ziex 0.1.0-dev.1458 → 0.1.0-dev.1567
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -9
- package/app.d.ts +37 -22
- package/build.zig.zon +1 -1
- package/index.d.ts +1 -1
- package/index.js +252 -223
- package/package.json +2 -2
- package/platforms/aws-lambda/index.d.ts +1 -1
- package/platforms/cloudflare/app.d.ts +31 -1
- package/platforms/cloudflare/index.d.ts +5 -4
- package/platforms/cloudflare/index.js +1801 -1670
- package/platforms/cloudflare/kv.d.ts +4 -2
- package/platforms/cloudflare/stateful.d.ts +26 -0
- package/platforms/cloudflare/worker.d.ts +1 -2
- package/platforms/vercel/index.d.ts +1 -1
- package/runtime/index.d.ts +20 -10
- package/runtime/kv/indexdb.d.ts +11 -3
- package/runtime/kv/localstorage.d.ts +11 -3
- package/runtime/kv/memory.d.ts +13 -6
- package/runtime/kv.d.ts +17 -18
- package/runtime/kv.js +178 -240
- package/runtime/wasi.d.ts +2 -7
- package/wasm/constants.d.ts +33 -0
- package/wasm/core.d.ts +7 -19
- package/wasm/dom_cmd.d.ts +6 -0
- package/wasm/generated/event_bits.d.ts +2 -0
- package/wasm/generated/events.d.ts +1 -0
- package/wasm/generated/tag_indices.d.ts +2 -0
- package/wasm/generated/tags.d.ts +1 -0
- package/wasm/index.d.ts +3 -2
- package/wasm/index.js +635 -555
- package/wasm/init.dev.js +650 -562
- package/wasm/init.js +3 -3
- package/platforms/cloudflare/do.d.ts +0 -50
package/wasm/index.js
CHANGED
|
@@ -1,3 +1,28 @@
|
|
|
1
|
+
// src/wasm/constants.ts
|
|
2
|
+
var DOM_CMD_HEADER_SIZE = 8;
|
|
3
|
+
var DOM_CMD_RECORD_SIZE = 24;
|
|
4
|
+
var DomOp_CreateElement = 1;
|
|
5
|
+
var DomOp_CreateText = 2;
|
|
6
|
+
var DomOp_HydrateInsert = 3;
|
|
7
|
+
var DomOp_SetAttr = 4;
|
|
8
|
+
var DomOp_SetProp = 5;
|
|
9
|
+
var DomOp_RemoveAttr = 6;
|
|
10
|
+
var DomOp_SetNodeValue = 7;
|
|
11
|
+
var DomOp_SetInnerHtml = 8;
|
|
12
|
+
var DomOp_AppendChild = 9;
|
|
13
|
+
var DomOp_InsertBefore = 10;
|
|
14
|
+
var DomOp_RemoveChild = 11;
|
|
15
|
+
var DomOp_ReplaceChild = 12;
|
|
16
|
+
var CallbackType_Event = 0;
|
|
17
|
+
var CallbackType_FetchSuccess = 1;
|
|
18
|
+
var CallbackType_FetchError = 2;
|
|
19
|
+
var CallbackType_Timeout = 3;
|
|
20
|
+
var CallbackType_Interval = 4;
|
|
21
|
+
var CallbackType_WebSocketOpen = 5;
|
|
22
|
+
var CallbackType_WebSocketMessage = 6;
|
|
23
|
+
var CallbackType_WebSocketError = 7;
|
|
24
|
+
var CallbackType_WebSocketClose = 8;
|
|
25
|
+
|
|
1
26
|
// ../../vendor/jsz/js/src/zigjs.ts
|
|
2
27
|
var NAN_PREFIX = 2146959360;
|
|
3
28
|
var predefined = {
|
|
@@ -251,7 +276,7 @@ var ZigJS = class {
|
|
|
251
276
|
function createFetchImports(getMemory) {
|
|
252
277
|
const encoder2 = new TextEncoder();
|
|
253
278
|
const decoder2 = new TextDecoder();
|
|
254
|
-
function
|
|
279
|
+
function readStr2(ptr, len) {
|
|
255
280
|
return decoder2.decode(new Uint8Array(getMemory().buffer, ptr, len));
|
|
256
281
|
}
|
|
257
282
|
function writeBytes2(buf_ptr, buf_max, data) {
|
|
@@ -277,9 +302,9 @@ function createFetchImports(getMemory) {
|
|
|
277
302
|
return headers;
|
|
278
303
|
}
|
|
279
304
|
async function doFetch(url_ptr, url_len, method_ptr, method_len, headers_ptr, headers_len, body_ptr, body_len, timeout_ms, status_out, buf_ptr, buf_max) {
|
|
280
|
-
const url =
|
|
281
|
-
const method = method_len > 0 ?
|
|
282
|
-
const headersJson = headers_len > 0 ?
|
|
305
|
+
const url = readStr2(url_ptr, url_len);
|
|
306
|
+
const method = method_len > 0 ? readStr2(method_ptr, method_len) : "GET";
|
|
307
|
+
const headersJson = headers_len > 0 ? readStr2(headers_ptr, headers_len) : "{}";
|
|
283
308
|
const body = body_len > 0 ? readBytes(body_ptr, body_len) : void 0;
|
|
284
309
|
const headers = parseHeaders(headersJson);
|
|
285
310
|
const controller = new AbortController();
|
|
@@ -302,27 +327,18 @@ function createFetchImports(getMemory) {
|
|
|
302
327
|
return -1;
|
|
303
328
|
}
|
|
304
329
|
}
|
|
305
|
-
const
|
|
306
|
-
if (typeof
|
|
330
|
+
const Suspending2 = WebAssembly.Suspending;
|
|
331
|
+
if (typeof Suspending2 !== "function") {
|
|
307
332
|
return {
|
|
308
333
|
fetch: (_url_ptr, _url_len, _method_ptr, _method_len, _headers_ptr, _headers_len, _body_ptr, _body_len, _timeout_ms, _status_out, _buf_ptr, _buf_max) => -1
|
|
309
334
|
};
|
|
310
335
|
}
|
|
311
336
|
return {
|
|
312
|
-
fetch: new
|
|
337
|
+
fetch: new Suspending2(doFetch)
|
|
313
338
|
};
|
|
314
339
|
}
|
|
315
340
|
|
|
316
341
|
// src/wasm/core.ts
|
|
317
|
-
var CallbackType_Event = 0;
|
|
318
|
-
var CallbackType_FetchSuccess = 1;
|
|
319
|
-
var CallbackType_FetchError = 2;
|
|
320
|
-
var CallbackType_Timeout = 3;
|
|
321
|
-
var CallbackType_Interval = 4;
|
|
322
|
-
var CallbackType_WebSocketOpen = 5;
|
|
323
|
-
var CallbackType_WebSocketMessage = 6;
|
|
324
|
-
var CallbackType_WebSocketError = 7;
|
|
325
|
-
var CallbackType_WebSocketClose = 8;
|
|
326
342
|
var jsz = new ZigJS();
|
|
327
343
|
var tempRefBuffer = new ArrayBuffer(8);
|
|
328
344
|
var tempRefView = new DataView(tempRefBuffer);
|
|
@@ -391,30 +407,26 @@ function invokeWasmExport(fn, ...args) {
|
|
|
391
407
|
var ZxBridgeCore = class _ZxBridgeCore {
|
|
392
408
|
#intervals = /* @__PURE__ */ new Map();
|
|
393
409
|
#handler;
|
|
394
|
-
#fetchCompleteHandler;
|
|
395
410
|
constructor(exports) {
|
|
396
411
|
this._alloc = exports.__zx_alloc;
|
|
397
412
|
this.#handler = wrapPromisingExport(exports.__zx_cb);
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
throw new Error("__zx_fetch_complete not exported from WASM");
|
|
413
|
+
if (!this.#handler) {
|
|
414
|
+
console.warn("__zx_cb not exported from WASM");
|
|
401
415
|
}
|
|
402
|
-
this.#fetchCompleteHandler = fetchCompleteHandler;
|
|
403
416
|
if (exports.memory) jsz.memory = exports.memory;
|
|
404
417
|
}
|
|
405
418
|
/** Invoke the unified callback handler */
|
|
406
|
-
|
|
419
|
+
_invoke(type, id, a = 0n, b = 0n, c = 0n) {
|
|
407
420
|
const handler = this.#handler;
|
|
408
421
|
if (!handler) {
|
|
409
422
|
console.warn("__zx_cb not exported from WASM");
|
|
410
423
|
return;
|
|
411
424
|
}
|
|
412
|
-
|
|
413
|
-
invokeWasmExport(handler, type, id, dataRef);
|
|
425
|
+
invokeWasmExport(handler, type, id, a, b, c);
|
|
414
426
|
}
|
|
415
427
|
/**
|
|
416
428
|
* Async fetch with full options support.
|
|
417
|
-
*
|
|
429
|
+
* Completes via `__zx_cb(fetch_success|fetch_error, ...)`.
|
|
418
430
|
*/
|
|
419
431
|
fetchAsync(urlPtr, urlLen, methodPtr, methodLen, headersPtr, headersLen, bodyPtr, bodyLen, timeoutMs, fetchId) {
|
|
420
432
|
const url = readString(urlPtr, urlLen);
|
|
@@ -453,23 +465,23 @@ var ZxBridgeCore = class _ZxBridgeCore {
|
|
|
453
465
|
}
|
|
454
466
|
/** Notify WASM that a fetch completed. `body` is raw bytes on success, text on error. */
|
|
455
467
|
_notifyFetchComplete(fetchId, statusCode, body, isError) {
|
|
456
|
-
const handler = this.#fetchCompleteHandler;
|
|
457
468
|
const encoded = typeof body === "string" ? textEncoder.encode(body) : body;
|
|
458
469
|
const ptr = this._alloc(encoded.length) >>> 0;
|
|
459
470
|
if (!ptr && encoded.length > 0) return;
|
|
460
471
|
writeBytes(ptr, encoded);
|
|
461
|
-
|
|
472
|
+
const type = isError ? CallbackType_FetchError : CallbackType_FetchSuccess;
|
|
473
|
+
this._invoke(type, fetchId, BigInt(statusCode), BigInt(ptr), BigInt(encoded.length));
|
|
462
474
|
}
|
|
463
475
|
/** Set a timeout and callback when it fires */
|
|
464
476
|
setTimeout(callbackId, delayMs) {
|
|
465
477
|
setTimeout(() => {
|
|
466
|
-
this
|
|
478
|
+
this._invoke(CallbackType_Timeout, callbackId);
|
|
467
479
|
}, delayMs);
|
|
468
480
|
}
|
|
469
481
|
/** Set an interval and callback each time it fires */
|
|
470
482
|
setInterval(callbackId, intervalMs) {
|
|
471
483
|
const handle = setInterval(() => {
|
|
472
|
-
this
|
|
484
|
+
this._invoke(CallbackType_Interval, callbackId);
|
|
473
485
|
}, intervalMs);
|
|
474
486
|
this.#intervals.set(callbackId, handle);
|
|
475
487
|
}
|
|
@@ -584,240 +596,619 @@ function bindWasmAlloc(allocRef, exports) {
|
|
|
584
596
|
allocRef[0] = exports.__zx_alloc;
|
|
585
597
|
}
|
|
586
598
|
|
|
587
|
-
// src/
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
599
|
+
// src/wasm/generated/tags.ts
|
|
600
|
+
var TAG_NAMES = [
|
|
601
|
+
"aside",
|
|
602
|
+
"fragment",
|
|
603
|
+
"iframe",
|
|
604
|
+
"slot",
|
|
605
|
+
"img",
|
|
606
|
+
"html",
|
|
607
|
+
"base",
|
|
608
|
+
"head",
|
|
609
|
+
"link",
|
|
610
|
+
"meta",
|
|
611
|
+
"script",
|
|
612
|
+
"style",
|
|
613
|
+
"title",
|
|
614
|
+
"address",
|
|
615
|
+
"article",
|
|
616
|
+
"body",
|
|
617
|
+
"h1",
|
|
618
|
+
"h6",
|
|
619
|
+
"footer",
|
|
620
|
+
"header",
|
|
621
|
+
"h2",
|
|
622
|
+
"h3",
|
|
623
|
+
"h4",
|
|
624
|
+
"h5",
|
|
625
|
+
"hgroup",
|
|
626
|
+
"nav",
|
|
627
|
+
"section",
|
|
628
|
+
"dd",
|
|
629
|
+
"dl",
|
|
630
|
+
"dt",
|
|
631
|
+
"div",
|
|
632
|
+
"figcaption",
|
|
633
|
+
"figure",
|
|
634
|
+
"hr",
|
|
635
|
+
"li",
|
|
636
|
+
"ol",
|
|
637
|
+
"ul",
|
|
638
|
+
"menu",
|
|
639
|
+
"main",
|
|
640
|
+
"p",
|
|
641
|
+
"picture",
|
|
642
|
+
"pre",
|
|
643
|
+
"a",
|
|
644
|
+
"abbr",
|
|
645
|
+
"b",
|
|
646
|
+
"bdi",
|
|
647
|
+
"bdo",
|
|
648
|
+
"br",
|
|
649
|
+
"cite",
|
|
650
|
+
"code",
|
|
651
|
+
"data",
|
|
652
|
+
"time",
|
|
653
|
+
"dfn",
|
|
654
|
+
"em",
|
|
655
|
+
"i",
|
|
656
|
+
"kbd",
|
|
657
|
+
"mark",
|
|
658
|
+
"q",
|
|
659
|
+
"blockquote",
|
|
660
|
+
"rp",
|
|
661
|
+
"ruby",
|
|
662
|
+
"rt",
|
|
663
|
+
"rtc",
|
|
664
|
+
"rb",
|
|
665
|
+
"s",
|
|
666
|
+
"del",
|
|
667
|
+
"ins",
|
|
668
|
+
"samp",
|
|
669
|
+
"small",
|
|
670
|
+
"span",
|
|
671
|
+
"strong",
|
|
672
|
+
"sub",
|
|
673
|
+
"sup",
|
|
674
|
+
"u",
|
|
675
|
+
"var",
|
|
676
|
+
"wbr",
|
|
677
|
+
"area",
|
|
678
|
+
"map",
|
|
679
|
+
"audio",
|
|
680
|
+
"source",
|
|
681
|
+
"track",
|
|
682
|
+
"video",
|
|
683
|
+
"embed",
|
|
684
|
+
"object",
|
|
685
|
+
"param",
|
|
686
|
+
"canvas",
|
|
687
|
+
"noscript",
|
|
688
|
+
"caption",
|
|
689
|
+
"table",
|
|
690
|
+
"col",
|
|
691
|
+
"colgroup",
|
|
692
|
+
"tbody",
|
|
693
|
+
"tr",
|
|
694
|
+
"thead",
|
|
695
|
+
"tfoot",
|
|
696
|
+
"td",
|
|
697
|
+
"th",
|
|
698
|
+
"button",
|
|
699
|
+
"datalist",
|
|
700
|
+
"option",
|
|
701
|
+
"fieldset",
|
|
702
|
+
"label",
|
|
703
|
+
"form",
|
|
704
|
+
"input",
|
|
705
|
+
"keygen",
|
|
706
|
+
"legend",
|
|
707
|
+
"meter",
|
|
708
|
+
"optgroup",
|
|
709
|
+
"select",
|
|
710
|
+
"output",
|
|
711
|
+
"progress",
|
|
712
|
+
"textarea",
|
|
713
|
+
"details",
|
|
714
|
+
"dialog",
|
|
715
|
+
"menuitem",
|
|
716
|
+
"summary",
|
|
717
|
+
"content",
|
|
718
|
+
"element",
|
|
719
|
+
"shadow",
|
|
720
|
+
"template",
|
|
721
|
+
"acronym",
|
|
722
|
+
"applet",
|
|
723
|
+
"basefont",
|
|
724
|
+
"font",
|
|
725
|
+
"big",
|
|
726
|
+
"blink",
|
|
727
|
+
"center",
|
|
728
|
+
"command",
|
|
729
|
+
"dir",
|
|
730
|
+
"frame",
|
|
731
|
+
"frameset",
|
|
732
|
+
"isindex",
|
|
733
|
+
"listing",
|
|
734
|
+
"marquee",
|
|
735
|
+
"noembed",
|
|
736
|
+
"plaintext",
|
|
737
|
+
"spacer",
|
|
738
|
+
"strike",
|
|
739
|
+
"tt",
|
|
740
|
+
"xmp",
|
|
741
|
+
"animate",
|
|
742
|
+
"animateMotion",
|
|
743
|
+
"animateTransform",
|
|
744
|
+
"circle",
|
|
745
|
+
"clipPath",
|
|
746
|
+
"defs",
|
|
747
|
+
"desc",
|
|
748
|
+
"ellipse",
|
|
749
|
+
"feBlend",
|
|
750
|
+
"feColorMatrix",
|
|
751
|
+
"feComponentTransfer",
|
|
752
|
+
"feComposite",
|
|
753
|
+
"feConvolveMatrix",
|
|
754
|
+
"feDiffuseLighting",
|
|
755
|
+
"feDisplacementMap",
|
|
756
|
+
"feDistantLight",
|
|
757
|
+
"feDropShadow",
|
|
758
|
+
"feFlood",
|
|
759
|
+
"feFuncA",
|
|
760
|
+
"feFuncB",
|
|
761
|
+
"feFuncG",
|
|
762
|
+
"feFuncR",
|
|
763
|
+
"feGaussianBlur",
|
|
764
|
+
"feImage",
|
|
765
|
+
"feMerge",
|
|
766
|
+
"feMergeNode",
|
|
767
|
+
"feMorphology",
|
|
768
|
+
"feOffset",
|
|
769
|
+
"fePointLight",
|
|
770
|
+
"feSpecularLighting",
|
|
771
|
+
"feSpotLight",
|
|
772
|
+
"feTile",
|
|
773
|
+
"feTurbulence",
|
|
774
|
+
"filter",
|
|
775
|
+
"foreignObject",
|
|
776
|
+
"g",
|
|
777
|
+
"image",
|
|
778
|
+
"line",
|
|
779
|
+
"linearGradient",
|
|
780
|
+
"marker",
|
|
781
|
+
"mask",
|
|
782
|
+
"metadata",
|
|
783
|
+
"mpath",
|
|
784
|
+
"path",
|
|
785
|
+
"pattern",
|
|
786
|
+
"polygon",
|
|
787
|
+
"polyline",
|
|
788
|
+
"radialGradient",
|
|
789
|
+
"rect",
|
|
790
|
+
"set",
|
|
791
|
+
"stop",
|
|
792
|
+
"svg",
|
|
793
|
+
"switch",
|
|
794
|
+
"symbol",
|
|
795
|
+
"text",
|
|
796
|
+
"textPath",
|
|
797
|
+
"tspan",
|
|
798
|
+
"use",
|
|
799
|
+
"view",
|
|
800
|
+
"custom"
|
|
801
|
+
];
|
|
802
|
+
|
|
803
|
+
// src/wasm/generated/tag_indices.ts
|
|
804
|
+
var SVG_TAG_START_INDEX = 140;
|
|
805
|
+
var CUSTOM_TAG_INDEX = 199;
|
|
806
|
+
|
|
807
|
+
// src/wasm/dom_cmd.ts
|
|
808
|
+
var BOOL_PROPS = /* @__PURE__ */ new Set([
|
|
809
|
+
"checked",
|
|
810
|
+
"selected",
|
|
811
|
+
"muted",
|
|
812
|
+
"defaultChecked",
|
|
813
|
+
"indeterminate"
|
|
814
|
+
]);
|
|
815
|
+
function enqueueAfterConnect(queue, el, kind) {
|
|
816
|
+
for (let i = 0; i < queue.length; i++) {
|
|
817
|
+
const job = queue[i];
|
|
818
|
+
if (job.el === el && job.kind === kind) return;
|
|
819
|
+
}
|
|
820
|
+
queue.push({ el, kind });
|
|
595
821
|
}
|
|
596
|
-
function
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
822
|
+
function runAfterConnect(queue) {
|
|
823
|
+
for (let i = 0; i < queue.length; i++) {
|
|
824
|
+
const job = queue[i];
|
|
825
|
+
if (!job.el.isConnected) continue;
|
|
826
|
+
switch (job.kind) {
|
|
827
|
+
case "focus": {
|
|
828
|
+
if (typeof job.el.focus !== "function") break;
|
|
829
|
+
try {
|
|
830
|
+
job.el.focus({ preventScroll: true });
|
|
831
|
+
} catch {
|
|
832
|
+
job.el.focus();
|
|
833
|
+
}
|
|
834
|
+
break;
|
|
835
|
+
}
|
|
836
|
+
}
|
|
601
837
|
}
|
|
602
|
-
|
|
603
|
-
|
|
838
|
+
}
|
|
839
|
+
function assignProp(el, name, val) {
|
|
840
|
+
if (BOOL_PROPS.has(name)) {
|
|
841
|
+
const on = val !== "false";
|
|
842
|
+
el[name] = on;
|
|
843
|
+
if (name === "defaultChecked" && "checked" in el) {
|
|
844
|
+
el.checked = on;
|
|
845
|
+
}
|
|
846
|
+
return;
|
|
604
847
|
}
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
var syncBinding = syncBinding2;
|
|
612
|
-
return {
|
|
613
|
-
kv_get: (ns_ptr, ns_len, key_ptr, key_len, out_ptr) => {
|
|
614
|
-
const b = syncBinding2(readStr(ns_ptr, ns_len));
|
|
615
|
-
if (!b) return -1;
|
|
616
|
-
const value = b.getSync(readStr(key_ptr, key_len));
|
|
617
|
-
if (value === null) return -1;
|
|
618
|
-
return writeBytesOut(getMemory, allocRef, out_ptr, encoder2.encode(value));
|
|
619
|
-
},
|
|
620
|
-
kv_put: (ns_ptr, ns_len, key_ptr, key_len, val_ptr, val_len, ttl_seconds) => {
|
|
621
|
-
const b = syncBinding2(readStr(ns_ptr, ns_len));
|
|
622
|
-
if (!b) return 0;
|
|
623
|
-
b.putSync(readStr(key_ptr, key_len), readStr(val_ptr, val_len), putOptions(ttl_seconds));
|
|
624
|
-
return 0;
|
|
625
|
-
},
|
|
626
|
-
kv_delete: (ns_ptr, ns_len, key_ptr, key_len) => {
|
|
627
|
-
const b = syncBinding2(readStr(ns_ptr, ns_len));
|
|
628
|
-
if (!b) return 0;
|
|
629
|
-
b.deleteSync(readStr(key_ptr, key_len));
|
|
630
|
-
return 0;
|
|
631
|
-
},
|
|
632
|
-
kv_list: (ns_ptr, ns_len, pfx_ptr, pfx_len, out_ptr) => {
|
|
633
|
-
const b = syncBinding2(readStr(ns_ptr, ns_len));
|
|
634
|
-
if (!b) return writeJsonOut(getMemory, allocRef, out_ptr, []);
|
|
635
|
-
const prefix = readStr(pfx_ptr, pfx_len);
|
|
636
|
-
const result = b.listSync(prefix.length > 0 ? { prefix } : void 0);
|
|
637
|
-
return writeJsonOut(getMemory, allocRef, out_ptr, result.keys.map((k) => k.name));
|
|
638
|
-
}
|
|
639
|
-
};
|
|
848
|
+
if (name === "defaultValue") {
|
|
849
|
+
el.defaultValue = val;
|
|
850
|
+
if (typeof el.value === "string" && (el.value === "" || el.value === el.defaultValue)) {
|
|
851
|
+
el.value = val;
|
|
852
|
+
}
|
|
853
|
+
return;
|
|
640
854
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
855
|
+
el[name] = val;
|
|
856
|
+
}
|
|
857
|
+
function flushDomCmds(ptr, len, ctx) {
|
|
858
|
+
const start = ptr >>> 0;
|
|
859
|
+
const length = len >>> 0;
|
|
860
|
+
if (length < DOM_CMD_HEADER_SIZE) return;
|
|
861
|
+
const mem = getMemoryView();
|
|
862
|
+
if (start + length > mem.byteLength) return;
|
|
863
|
+
const view = new DataView(mem.buffer, mem.byteOffset + start, length);
|
|
864
|
+
const count = view.getUint32(0, true);
|
|
865
|
+
const recordsBytes = count * DOM_CMD_RECORD_SIZE;
|
|
866
|
+
if (DOM_CMD_HEADER_SIZE + recordsBytes > length) return;
|
|
867
|
+
const { domNodes: domNodes2, cleanupDomNodes: cleanupDomNodes2 } = ctx;
|
|
868
|
+
const afterConnect = [];
|
|
869
|
+
for (let i = 0; i < count; i++) {
|
|
870
|
+
const off = DOM_CMD_HEADER_SIZE + i * DOM_CMD_RECORD_SIZE;
|
|
871
|
+
const op = view.getUint8(off);
|
|
872
|
+
const p0 = view.getUint32(off + 4, true);
|
|
873
|
+
const p1 = view.getUint32(off + 8, true);
|
|
874
|
+
const p2 = view.getUint32(off + 12, true);
|
|
875
|
+
const p3 = view.getUint32(off + 16, true);
|
|
876
|
+
const p4 = view.getUint32(off + 20, true);
|
|
877
|
+
switch (op) {
|
|
878
|
+
case DomOp_CreateElement: {
|
|
879
|
+
const isCustom = p0 === CUSTOM_TAG_INDEX;
|
|
880
|
+
const tagName = isCustom ? readString(p2, p3) : TAG_NAMES[p0];
|
|
881
|
+
const el = !isCustom && p0 >= SVG_TAG_START_INDEX ? document.createElementNS("http://www.w3.org/2000/svg", tagName) : document.createElement(tagName);
|
|
882
|
+
el.__zx_ref = p1;
|
|
883
|
+
domNodes2.set(p1, el);
|
|
884
|
+
break;
|
|
885
|
+
}
|
|
886
|
+
case DomOp_CreateText: {
|
|
887
|
+
const node = document.createTextNode(readString(p0, p1));
|
|
888
|
+
node.__zx_ref = p2;
|
|
889
|
+
domNodes2.set(p2, node);
|
|
890
|
+
break;
|
|
891
|
+
}
|
|
892
|
+
case DomOp_HydrateInsert: {
|
|
893
|
+
const child = domNodes2.get(p0);
|
|
894
|
+
const ref = BigInt(p1) | BigInt(p2) << 32n;
|
|
895
|
+
const end = loadValueFromRef(ref);
|
|
896
|
+
if (!child || !end?.parentNode) break;
|
|
897
|
+
end.parentNode.insertBefore(child, end);
|
|
898
|
+
break;
|
|
899
|
+
}
|
|
900
|
+
case DomOp_SetAttr: {
|
|
901
|
+
const el = domNodes2.get(p0);
|
|
902
|
+
if (!el) break;
|
|
903
|
+
const name = readString(p1, p2);
|
|
904
|
+
const val = readString(p3, p4);
|
|
905
|
+
el.setAttribute(name, val);
|
|
906
|
+
if (name === "autofocus") {
|
|
907
|
+
enqueueAfterConnect(afterConnect, el, "focus");
|
|
908
|
+
}
|
|
909
|
+
break;
|
|
910
|
+
}
|
|
911
|
+
case DomOp_SetProp: {
|
|
912
|
+
const el = domNodes2.get(p0);
|
|
913
|
+
if (el) assignProp(el, readString(p1, p2), readString(p3, p4));
|
|
914
|
+
break;
|
|
915
|
+
}
|
|
916
|
+
case DomOp_RemoveAttr: {
|
|
917
|
+
domNodes2.get(p0)?.removeAttribute(readString(p1, p2));
|
|
918
|
+
break;
|
|
919
|
+
}
|
|
920
|
+
case DomOp_SetNodeValue: {
|
|
921
|
+
const node = domNodes2.get(p0);
|
|
922
|
+
if (node) node.nodeValue = readString(p1, p2);
|
|
923
|
+
break;
|
|
924
|
+
}
|
|
925
|
+
case DomOp_SetInnerHtml: {
|
|
926
|
+
const el = domNodes2.get(p0);
|
|
927
|
+
if (el) el.innerHTML = readString(p1, p2);
|
|
928
|
+
break;
|
|
929
|
+
}
|
|
930
|
+
case DomOp_AppendChild: {
|
|
931
|
+
const parent = domNodes2.get(p0);
|
|
932
|
+
const child = domNodes2.get(p1);
|
|
933
|
+
if (parent && child) parent.appendChild(child);
|
|
934
|
+
break;
|
|
935
|
+
}
|
|
936
|
+
case DomOp_InsertBefore: {
|
|
937
|
+
const parent = domNodes2.get(p0);
|
|
938
|
+
const child = domNodes2.get(p1);
|
|
939
|
+
const refNode = domNodes2.get(p2) ?? null;
|
|
940
|
+
if (parent && child) parent.insertBefore(child, refNode);
|
|
941
|
+
break;
|
|
942
|
+
}
|
|
943
|
+
case DomOp_RemoveChild: {
|
|
944
|
+
const parent = domNodes2.get(p0);
|
|
945
|
+
const child = domNodes2.get(p1);
|
|
946
|
+
if (parent && child) {
|
|
947
|
+
parent.removeChild(child);
|
|
948
|
+
cleanupDomNodes2(child);
|
|
949
|
+
}
|
|
950
|
+
break;
|
|
951
|
+
}
|
|
952
|
+
case DomOp_ReplaceChild: {
|
|
953
|
+
const parent = domNodes2.get(p0);
|
|
954
|
+
const newChild = domNodes2.get(p1);
|
|
955
|
+
const oldChild = domNodes2.get(p2);
|
|
956
|
+
if (parent && newChild && oldChild) {
|
|
957
|
+
parent.replaceChild(newChild, oldChild);
|
|
958
|
+
cleanupDomNodes2(oldChild);
|
|
959
|
+
}
|
|
960
|
+
break;
|
|
961
|
+
}
|
|
962
|
+
default:
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
runAfterConnect(afterConnect);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
// src/runtime/kv/extern.ts
|
|
970
|
+
var Suspending = WebAssembly.Suspending;
|
|
971
|
+
var jspi = typeof Suspending === "function";
|
|
972
|
+
var miss = jspi ? -1 : 0;
|
|
973
|
+
function putOptions(ttlSeconds) {
|
|
974
|
+
if (ttlSeconds < 60) return void 0;
|
|
975
|
+
return { expirationTtl: ttlSeconds };
|
|
976
|
+
}
|
|
977
|
+
function kvDel(binding, key) {
|
|
978
|
+
const b = binding;
|
|
979
|
+
return (b.del ?? b.delete).call(b, key);
|
|
980
|
+
}
|
|
981
|
+
function isSyncKVNamespace(binding) {
|
|
982
|
+
return typeof binding.get === "function" && binding.get.constructor.name !== "AsyncFunction";
|
|
983
|
+
}
|
|
984
|
+
function listOpts(prefix) {
|
|
985
|
+
return prefix.length > 0 ? { prefix } : void 0;
|
|
986
|
+
}
|
|
987
|
+
function maybeThen(r, f) {
|
|
988
|
+
return r instanceof Promise ? r.then(f) : f(r);
|
|
989
|
+
}
|
|
990
|
+
function readStr(getMemory, ptr, len) {
|
|
991
|
+
return textDecoder.decode(new Uint8Array(getMemory().buffer, ptr, len));
|
|
992
|
+
}
|
|
993
|
+
function resolve(bindings, ns) {
|
|
994
|
+
const b = bindings[ns] ?? bindings["default"] ?? null;
|
|
995
|
+
if (!b || jspi) return b;
|
|
996
|
+
return isSyncKVNamespace(b) ? b : null;
|
|
997
|
+
}
|
|
998
|
+
function encodeGet(getMemory, allocRef, value, out_ptr) {
|
|
999
|
+
if (value === null) return -1;
|
|
1000
|
+
return writeBytesOut(getMemory, allocRef, out_ptr, textEncoder.encode(value));
|
|
1001
|
+
}
|
|
1002
|
+
function encodeList(getMemory, allocRef, names, out_ptr) {
|
|
1003
|
+
if (names.length === 0) {
|
|
1004
|
+
new DataView(getMemory().buffer).setUint32(out_ptr, 0, true);
|
|
1005
|
+
return 0;
|
|
1006
|
+
}
|
|
1007
|
+
return writeJsonOut(getMemory, allocRef, out_ptr, names);
|
|
1008
|
+
}
|
|
1009
|
+
function get(b, key, out_ptr, getMemory, allocRef) {
|
|
1010
|
+
return maybeThen(b.get(key), (v) => encodeGet(getMemory, allocRef, v, out_ptr));
|
|
1011
|
+
}
|
|
1012
|
+
function put(b, key, val, ttl) {
|
|
1013
|
+
return maybeThen(b.put(key, val, putOptions(ttl)), () => 0);
|
|
1014
|
+
}
|
|
1015
|
+
function del(b, key) {
|
|
1016
|
+
return maybeThen(kvDel(b, key), () => 0);
|
|
1017
|
+
}
|
|
1018
|
+
function list(b, prefix, out_ptr, getMemory, allocRef) {
|
|
1019
|
+
return maybeThen(
|
|
1020
|
+
b.list(listOpts(prefix)),
|
|
1021
|
+
(result) => encodeList(getMemory, allocRef, result.keys.map((k) => k.name), out_ptr)
|
|
1022
|
+
);
|
|
1023
|
+
}
|
|
1024
|
+
function wrapImport(impl) {
|
|
1025
|
+
if (!jspi) {
|
|
1026
|
+
return ((...args) => {
|
|
1027
|
+
const r = impl(...args);
|
|
1028
|
+
if (r instanceof Promise) throw new Error("async kv binding requires JSPI");
|
|
1029
|
+
return r;
|
|
1030
|
+
});
|
|
1031
|
+
}
|
|
1032
|
+
return new Suspending(impl);
|
|
1033
|
+
}
|
|
1034
|
+
function createKVImports(bindings, getMemory, allocRef) {
|
|
1035
|
+
return {
|
|
1036
|
+
kv_get: wrapImport((ns_ptr, ns_len, key_ptr, key_len, out_ptr) => {
|
|
1037
|
+
const b = resolve(bindings, readStr(getMemory, ns_ptr, ns_len));
|
|
1038
|
+
if (!b) return -1;
|
|
1039
|
+
return get(b, readStr(getMemory, key_ptr, key_len), out_ptr, getMemory, allocRef);
|
|
1040
|
+
}),
|
|
1041
|
+
kv_put: wrapImport((ns_ptr, ns_len, key_ptr, key_len, val_ptr, val_len, ttl_seconds) => {
|
|
1042
|
+
const b = resolve(bindings, readStr(getMemory, ns_ptr, ns_len));
|
|
1043
|
+
if (!b) return miss;
|
|
1044
|
+
return put(
|
|
1045
|
+
b,
|
|
1046
|
+
readStr(getMemory, key_ptr, key_len),
|
|
1047
|
+
readStr(getMemory, val_ptr, val_len),
|
|
1048
|
+
ttl_seconds
|
|
1049
|
+
);
|
|
1050
|
+
}),
|
|
1051
|
+
kv_delete: wrapImport((ns_ptr, ns_len, key_ptr, key_len) => {
|
|
1052
|
+
const b = resolve(bindings, readStr(getMemory, ns_ptr, ns_len));
|
|
1053
|
+
if (!b) return miss;
|
|
1054
|
+
return del(b, readStr(getMemory, key_ptr, key_len));
|
|
1055
|
+
}),
|
|
1056
|
+
kv_list: wrapImport((ns_ptr, ns_len, pfx_ptr, pfx_len, out_ptr) => {
|
|
1057
|
+
const b = resolve(bindings, readStr(getMemory, ns_ptr, ns_len));
|
|
1058
|
+
if (!b) return writeJsonOut(getMemory, allocRef, out_ptr, []);
|
|
1059
|
+
return list(b, readStr(getMemory, pfx_ptr, pfx_len), out_ptr, getMemory, allocRef);
|
|
1060
|
+
})
|
|
1061
|
+
};
|
|
674
1062
|
}
|
|
675
1063
|
|
|
676
1064
|
// src/runtime/kv/localstorage.ts
|
|
677
|
-
|
|
1065
|
+
var namespace = "default";
|
|
1066
|
+
var storagePrefix = "ziex-kv";
|
|
1067
|
+
var namespacePrefix = `${storagePrefix}:${namespace}:`;
|
|
1068
|
+
function storage() {
|
|
678
1069
|
if (typeof localStorage === "undefined") {
|
|
679
1070
|
throw new Error("localStorage is not available in this environment");
|
|
680
1071
|
}
|
|
681
1072
|
return localStorage;
|
|
682
1073
|
}
|
|
683
|
-
function
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
deleteSync(key) {
|
|
703
|
-
storage.removeItem(scopedKey(key));
|
|
704
|
-
},
|
|
705
|
-
async delete(key) {
|
|
706
|
-
this.deleteSync(key);
|
|
707
|
-
},
|
|
708
|
-
listSync(options2) {
|
|
709
|
-
const prefix = namespacePrefix + (options2?.prefix ?? "");
|
|
710
|
-
const keys = [];
|
|
711
|
-
for (let i = 0; i < storage.length; i += 1) {
|
|
712
|
-
const key = storage.key(i);
|
|
713
|
-
if (!key || !key.startsWith(prefix)) continue;
|
|
714
|
-
keys.push({ name: key.slice(namespacePrefix.length) });
|
|
715
|
-
}
|
|
716
|
-
return { keys };
|
|
717
|
-
},
|
|
718
|
-
async list(options2) {
|
|
719
|
-
return this.listSync(options2);
|
|
720
|
-
}
|
|
721
|
-
};
|
|
1074
|
+
function get2(key) {
|
|
1075
|
+
return storage().getItem(`${storagePrefix}:${namespace}:${key}`);
|
|
1076
|
+
}
|
|
1077
|
+
function put2(key, value) {
|
|
1078
|
+
storage().setItem(`${storagePrefix}:${namespace}:${key}`, value);
|
|
1079
|
+
}
|
|
1080
|
+
function del2(key) {
|
|
1081
|
+
storage().removeItem(`${storagePrefix}:${namespace}:${key}`);
|
|
1082
|
+
}
|
|
1083
|
+
function list2(options) {
|
|
1084
|
+
const ls = storage();
|
|
1085
|
+
const prefix = namespacePrefix + (options?.prefix ?? "");
|
|
1086
|
+
const keys = [];
|
|
1087
|
+
for (let i = 0; i < ls.length; i += 1) {
|
|
1088
|
+
const key = ls.key(i);
|
|
1089
|
+
if (!key || !key.startsWith(prefix)) continue;
|
|
1090
|
+
keys.push({ name: key.slice(namespacePrefix.length) });
|
|
1091
|
+
}
|
|
1092
|
+
return { keys };
|
|
722
1093
|
}
|
|
723
1094
|
|
|
724
1095
|
// src/runtime/kv/indexdb.ts
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
1096
|
+
var databaseName = "ziex-kv";
|
|
1097
|
+
var storeName = "kv";
|
|
1098
|
+
var namespace2 = "default";
|
|
1099
|
+
var dbPromise;
|
|
1100
|
+
function openDb() {
|
|
1101
|
+
if (!dbPromise) {
|
|
1102
|
+
if (typeof indexedDB === "undefined") {
|
|
1103
|
+
return Promise.reject(new Error("IndexedDB is not available in this environment"));
|
|
1104
|
+
}
|
|
1105
|
+
dbPromise = new Promise((resolve2, reject) => {
|
|
1106
|
+
const request = indexedDB.open(databaseName, 1);
|
|
1107
|
+
request.onupgradeneeded = () => {
|
|
1108
|
+
const db = request.result;
|
|
1109
|
+
if (!db.objectStoreNames.contains(storeName)) {
|
|
1110
|
+
db.createObjectStore(storeName);
|
|
1111
|
+
}
|
|
1112
|
+
};
|
|
1113
|
+
request.onsuccess = () => resolve2(request.result);
|
|
1114
|
+
request.onerror = () => reject(request.error ?? new Error("Failed to open IndexedDB"));
|
|
1115
|
+
});
|
|
728
1116
|
}
|
|
729
|
-
return
|
|
1117
|
+
return dbPromise;
|
|
730
1118
|
}
|
|
731
1119
|
function requestToPromise(request) {
|
|
732
|
-
return new Promise((
|
|
733
|
-
request.onsuccess = () =>
|
|
1120
|
+
return new Promise((resolve2, reject) => {
|
|
1121
|
+
request.onsuccess = () => resolve2(request.result);
|
|
734
1122
|
request.onerror = () => reject(request.error ?? new Error("IndexedDB request failed"));
|
|
735
1123
|
});
|
|
736
1124
|
}
|
|
737
1125
|
function transactionToPromise(transaction) {
|
|
738
|
-
return new Promise((
|
|
739
|
-
transaction.oncomplete = () =>
|
|
1126
|
+
return new Promise((resolve2, reject) => {
|
|
1127
|
+
transaction.oncomplete = () => resolve2();
|
|
740
1128
|
transaction.onabort = () => reject(transaction.error ?? new Error("IndexedDB transaction aborted"));
|
|
741
1129
|
transaction.onerror = () => reject(transaction.error ?? new Error("IndexedDB transaction failed"));
|
|
742
1130
|
});
|
|
743
1131
|
}
|
|
744
|
-
function
|
|
745
|
-
const
|
|
746
|
-
const
|
|
747
|
-
const
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
const
|
|
1132
|
+
async function get3(key) {
|
|
1133
|
+
const db = await openDb();
|
|
1134
|
+
const tx = db.transaction(storeName, "readonly");
|
|
1135
|
+
const value = await requestToPromise(tx.objectStore(storeName).get(`${namespace2}:${key}`));
|
|
1136
|
+
await transactionToPromise(tx);
|
|
1137
|
+
return typeof value === "string" ? value : null;
|
|
1138
|
+
}
|
|
1139
|
+
async function put3(key, value) {
|
|
1140
|
+
const db = await openDb();
|
|
1141
|
+
const tx = db.transaction(storeName, "readwrite");
|
|
1142
|
+
tx.objectStore(storeName).put(value, `${namespace2}:${key}`);
|
|
1143
|
+
await transactionToPromise(tx);
|
|
1144
|
+
}
|
|
1145
|
+
async function del3(key) {
|
|
1146
|
+
const db = await openDb();
|
|
1147
|
+
const tx = db.transaction(storeName, "readwrite");
|
|
1148
|
+
tx.objectStore(storeName).delete(`${namespace2}:${key}`);
|
|
1149
|
+
await transactionToPromise(tx);
|
|
1150
|
+
}
|
|
1151
|
+
async function list3(options) {
|
|
1152
|
+
const db = await openDb();
|
|
1153
|
+
const tx = db.transaction(storeName, "readonly");
|
|
1154
|
+
const keys = await requestToPromise(tx.objectStore(storeName).getAllKeys());
|
|
1155
|
+
await transactionToPromise(tx);
|
|
1156
|
+
const prefix = `${namespace2}:${options?.prefix ?? ""}`;
|
|
760
1157
|
return {
|
|
761
|
-
|
|
762
|
-
const db = await dbPromise;
|
|
763
|
-
const tx = db.transaction(storeName, "readonly");
|
|
764
|
-
const store = tx.objectStore(storeName);
|
|
765
|
-
const value = await requestToPromise(store.get(scopedKey(key)));
|
|
766
|
-
await transactionToPromise(tx);
|
|
767
|
-
return typeof value === "string" ? value : null;
|
|
768
|
-
},
|
|
769
|
-
async put(key, value) {
|
|
770
|
-
const db = await dbPromise;
|
|
771
|
-
const tx = db.transaction(storeName, "readwrite");
|
|
772
|
-
tx.objectStore(storeName).put(value, scopedKey(key));
|
|
773
|
-
await transactionToPromise(tx);
|
|
774
|
-
},
|
|
775
|
-
async delete(key) {
|
|
776
|
-
const db = await dbPromise;
|
|
777
|
-
const tx = db.transaction(storeName, "readwrite");
|
|
778
|
-
tx.objectStore(storeName).delete(scopedKey(key));
|
|
779
|
-
await transactionToPromise(tx);
|
|
780
|
-
},
|
|
781
|
-
async list(options2) {
|
|
782
|
-
const db = await dbPromise;
|
|
783
|
-
const tx = db.transaction(storeName, "readonly");
|
|
784
|
-
const store = tx.objectStore(storeName);
|
|
785
|
-
const keys = await requestToPromise(store.getAllKeys());
|
|
786
|
-
await transactionToPromise(tx);
|
|
787
|
-
const prefix = scopedKey(options2?.prefix ?? "");
|
|
788
|
-
return {
|
|
789
|
-
keys: keys.filter((key) => typeof key === "string" && key.startsWith(prefix)).map((key) => ({ name: key.slice(namespace.length + 1) }))
|
|
790
|
-
};
|
|
791
|
-
}
|
|
1158
|
+
keys: keys.filter((key) => typeof key === "string" && key.startsWith(prefix)).map((key) => ({ name: key.slice(namespace2.length + 1) }))
|
|
792
1159
|
};
|
|
793
1160
|
}
|
|
794
1161
|
|
|
795
1162
|
// src/runtime/kv.ts
|
|
796
|
-
function
|
|
797
|
-
return typeof WebAssembly.Suspending === "function" && typeof WebAssembly.promising === "function";
|
|
798
|
-
}
|
|
1163
|
+
var hasJspi = typeof WebAssembly.Suspending === "function" && typeof WebAssembly.promising === "function";
|
|
799
1164
|
function createBrowserKVBindings(options = {}) {
|
|
800
|
-
const
|
|
1165
|
+
const namespace3 = options.namespace ?? "default";
|
|
801
1166
|
return {
|
|
802
|
-
[
|
|
1167
|
+
[namespace3]: hasJspi && !options.forceLocalStorage ? { get: get3, put: put3, del: del3, list: list3 } : { get: get2, put: put2, del: del2, list: list2 }
|
|
803
1168
|
};
|
|
804
1169
|
}
|
|
805
1170
|
|
|
1171
|
+
// src/wasm/generated/events.ts
|
|
1172
|
+
var DELEGATED_EVENTS = [
|
|
1173
|
+
"click",
|
|
1174
|
+
"dblclick",
|
|
1175
|
+
"input",
|
|
1176
|
+
"change",
|
|
1177
|
+
"submit",
|
|
1178
|
+
"focusin",
|
|
1179
|
+
"focusout",
|
|
1180
|
+
"keydown",
|
|
1181
|
+
"keyup",
|
|
1182
|
+
"keypress",
|
|
1183
|
+
"mouseenter",
|
|
1184
|
+
"mouseleave",
|
|
1185
|
+
"mousedown",
|
|
1186
|
+
"mouseup",
|
|
1187
|
+
"mousemove",
|
|
1188
|
+
"touchstart",
|
|
1189
|
+
"touchend",
|
|
1190
|
+
"touchmove",
|
|
1191
|
+
"scroll",
|
|
1192
|
+
"wheel",
|
|
1193
|
+
"pointerdown",
|
|
1194
|
+
"pointermove",
|
|
1195
|
+
"pointerup",
|
|
1196
|
+
"pointercancel",
|
|
1197
|
+
"pointerenter",
|
|
1198
|
+
"pointerleave",
|
|
1199
|
+
"lostpointercapture"
|
|
1200
|
+
];
|
|
1201
|
+
|
|
1202
|
+
// src/wasm/generated/event_bits.ts
|
|
1203
|
+
var HIGH_FREQ_EVENT_BITS = 3031040;
|
|
1204
|
+
|
|
806
1205
|
// src/wasm/index.ts
|
|
807
1206
|
var ZxBridge = class extends ZxBridgeCore {
|
|
808
1207
|
#websockets = /* @__PURE__ */ new Map();
|
|
809
|
-
#wsOnOpenHandler;
|
|
810
|
-
#wsOnMessageHandler;
|
|
811
|
-
#wsOnErrorHandler;
|
|
812
|
-
#wsOnCloseHandler;
|
|
813
1208
|
#eventbridge;
|
|
814
1209
|
#eventbridgeAsync;
|
|
815
1210
|
constructor(exports) {
|
|
816
1211
|
super(exports);
|
|
817
|
-
this.#wsOnOpenHandler = wrapPromisingExport(exports.__zx_ws_onopen);
|
|
818
|
-
this.#wsOnMessageHandler = wrapPromisingExport(exports.__zx_ws_onmessage);
|
|
819
|
-
this.#wsOnErrorHandler = wrapPromisingExport(exports.__zx_ws_onerror);
|
|
820
|
-
this.#wsOnCloseHandler = wrapPromisingExport(exports.__zx_ws_onclose);
|
|
821
1212
|
this.#eventbridge = exports.__zx_eventbridge;
|
|
822
1213
|
this.#eventbridgeAsync = wrapPromisingExport(
|
|
823
1214
|
exports.__zx_eventbridge_async ?? exports.__zx_eventbridge
|
|
@@ -843,8 +1234,8 @@ var ZxBridge = class extends ZxBridgeCore {
|
|
|
843
1234
|
const present = eventHandlersPresent.get(velementId) ?? 0;
|
|
844
1235
|
eventHandlersPresent.delete(velementId);
|
|
845
1236
|
eventHandlersSuspend.delete(velementId);
|
|
846
|
-
for (
|
|
847
|
-
|
|
1237
|
+
for (let bits = present & HIGH_FREQ_EVENT_BITS; bits !== 0; bits &= bits - 1) {
|
|
1238
|
+
maybeRemoveHighFreqListener(31 - Math.clz32(bits));
|
|
848
1239
|
}
|
|
849
1240
|
}
|
|
850
1241
|
/** Submit a form action with bound-state round-trip. */
|
|
@@ -866,7 +1257,7 @@ var ZxBridge = class extends ZxBridgeCore {
|
|
|
866
1257
|
}
|
|
867
1258
|
/**
|
|
868
1259
|
* Create and connect a WebSocket.
|
|
869
|
-
*
|
|
1260
|
+
* Completes via `__zx_cb(ws_open|ws_message|ws_error|ws_close, ...)`.
|
|
870
1261
|
*/
|
|
871
1262
|
wsConnect(wsId, urlPtr, urlLen, protocolsPtr, protocolsLen) {
|
|
872
1263
|
const url = readString(urlPtr, urlLen);
|
|
@@ -876,42 +1267,32 @@ var ZxBridge = class extends ZxBridgeCore {
|
|
|
876
1267
|
const ws = protocols && protocols.length > 0 ? new WebSocket(url, protocols) : new WebSocket(url);
|
|
877
1268
|
ws.binaryType = "arraybuffer";
|
|
878
1269
|
ws.onopen = () => {
|
|
879
|
-
const handler = this.#wsOnOpenHandler;
|
|
880
|
-
if (!handler) return;
|
|
881
1270
|
const protocol = ws.protocol || "";
|
|
882
1271
|
const [ptr, len] = this._writeStringToWasm(protocol);
|
|
883
|
-
|
|
1272
|
+
this._invoke(CallbackType_WebSocketOpen, wsId, BigInt(ptr), BigInt(len));
|
|
884
1273
|
};
|
|
885
1274
|
ws.onmessage = (event) => {
|
|
886
|
-
const handler = this.#wsOnMessageHandler;
|
|
887
|
-
if (!handler) return;
|
|
888
1275
|
const isBinary = event.data instanceof ArrayBuffer;
|
|
889
1276
|
const data = isBinary ? new Uint8Array(event.data) : textEncoder.encode(event.data);
|
|
890
1277
|
const [ptr, len] = this.writeBytesToWasm(data);
|
|
891
|
-
|
|
1278
|
+
this._invoke(CallbackType_WebSocketMessage, wsId, BigInt(ptr), BigInt(len), BigInt(isBinary ? 1 : 0));
|
|
892
1279
|
};
|
|
893
1280
|
ws.onerror = (_event) => {
|
|
894
|
-
const handler = this.#wsOnErrorHandler;
|
|
895
|
-
if (!handler) return;
|
|
896
1281
|
const [ptr, len] = this._writeStringToWasm("WebSocket error");
|
|
897
|
-
|
|
1282
|
+
this._invoke(CallbackType_WebSocketError, wsId, BigInt(ptr), BigInt(len));
|
|
898
1283
|
};
|
|
899
1284
|
ws.onclose = (event) => {
|
|
900
|
-
const handler = this.#wsOnCloseHandler;
|
|
901
|
-
if (!handler) return;
|
|
902
1285
|
const reason = event.reason || "";
|
|
903
1286
|
const [ptr, len] = this._writeStringToWasm(reason);
|
|
904
|
-
|
|
1287
|
+
const c = BigInt(len) | BigInt(event.wasClean ? 1 : 0) << 32n;
|
|
1288
|
+
this._invoke(CallbackType_WebSocketClose, wsId, BigInt(event.code), BigInt(ptr), c);
|
|
905
1289
|
this.#websockets.delete(wsId);
|
|
906
1290
|
};
|
|
907
1291
|
this.#websockets.set(wsId, ws);
|
|
908
1292
|
} catch (error) {
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
const [ptr, len] = this._writeStringToWasm(msg);
|
|
913
|
-
invokeWasmExport(handler, wsId, ptr, len);
|
|
914
|
-
}
|
|
1293
|
+
const msg = error instanceof Error ? error.message : "WebSocket connection failed";
|
|
1294
|
+
const [ptr, len] = this._writeStringToWasm(msg);
|
|
1295
|
+
this._invoke(CallbackType_WebSocketError, wsId, BigInt(ptr), BigInt(len));
|
|
915
1296
|
}
|
|
916
1297
|
}
|
|
917
1298
|
/** Send data over WebSocket */
|
|
@@ -1012,79 +1393,11 @@ var ZxBridge = class extends ZxBridgeCore {
|
|
|
1012
1393
|
_wsClose: (wsId, code, reasonPtr, reasonLen) => {
|
|
1013
1394
|
bridgeRef[0]?.wsClose(wsId, code, reasonPtr, reasonLen);
|
|
1014
1395
|
},
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
domNodes.set(nid, el);
|
|
1021
|
-
},
|
|
1022
|
-
_ct: (ptr, len, vnodeId) => {
|
|
1023
|
-
const nid = Number(vnodeId);
|
|
1024
|
-
const node = document.createTextNode(readString(ptr, len));
|
|
1025
|
-
node.__zx_ref = nid;
|
|
1026
|
-
domNodes.set(nid, node);
|
|
1027
|
-
},
|
|
1028
|
-
/** Insert vnode before a jsz-held end comment (hydration). */
|
|
1029
|
-
_ih: (vnodeId, endCommentRef) => {
|
|
1030
|
-
const child = domNodes.get(Number(vnodeId));
|
|
1031
|
-
const end = loadValueFromRef(endCommentRef);
|
|
1032
|
-
if (!child || !end?.parentNode) return;
|
|
1033
|
-
end.parentNode.insertBefore(child, end);
|
|
1034
|
-
},
|
|
1035
|
-
_sa: (vnodeId, namePtr, nameLen, valPtr, valLen) => {
|
|
1036
|
-
domNodes.get(Number(vnodeId))?.setAttribute(readString(namePtr, nameLen), readString(valPtr, valLen));
|
|
1037
|
-
},
|
|
1038
|
-
_sp: (vnodeId, namePtr, nameLen, valPtr, valLen) => {
|
|
1039
|
-
const el = domNodes.get(Number(vnodeId));
|
|
1040
|
-
if (el) {
|
|
1041
|
-
const name = readString(namePtr, nameLen);
|
|
1042
|
-
const val = readString(valPtr, valLen);
|
|
1043
|
-
if (name === "checked" || name === "selected" || name === "muted") {
|
|
1044
|
-
el[name] = val !== "false";
|
|
1045
|
-
} else {
|
|
1046
|
-
el[name] = val;
|
|
1047
|
-
}
|
|
1048
|
-
}
|
|
1049
|
-
},
|
|
1050
|
-
_ra: (vnodeId, namePtr, nameLen) => {
|
|
1051
|
-
domNodes.get(Number(vnodeId))?.removeAttribute(readString(namePtr, nameLen));
|
|
1052
|
-
},
|
|
1053
|
-
_snv: (vnodeId, ptr, len) => {
|
|
1054
|
-
const node = domNodes.get(Number(vnodeId));
|
|
1055
|
-
if (node) node.nodeValue = readString(ptr, len);
|
|
1056
|
-
},
|
|
1057
|
-
_srh: (vnodeId, ptr, len) => {
|
|
1058
|
-
const el = domNodes.get(Number(vnodeId));
|
|
1059
|
-
if (el) el.innerHTML = readString(ptr, len);
|
|
1060
|
-
},
|
|
1061
|
-
_ac: (parentId, childId) => {
|
|
1062
|
-
const parent = domNodes.get(Number(parentId));
|
|
1063
|
-
const child = domNodes.get(Number(childId));
|
|
1064
|
-
if (parent && child) parent.appendChild(child);
|
|
1065
|
-
},
|
|
1066
|
-
_ib: (parentId, childId, refId) => {
|
|
1067
|
-
const parent = domNodes.get(Number(parentId));
|
|
1068
|
-
const child = domNodes.get(Number(childId));
|
|
1069
|
-
const ref = domNodes.get(Number(refId)) ?? null;
|
|
1070
|
-
if (parent && child) parent.insertBefore(child, ref);
|
|
1071
|
-
},
|
|
1072
|
-
_rc: (parentId, childId) => {
|
|
1073
|
-
const parent = domNodes.get(Number(parentId));
|
|
1074
|
-
const child = domNodes.get(Number(childId));
|
|
1075
|
-
if (parent && child) {
|
|
1076
|
-
parent.removeChild(child);
|
|
1077
|
-
cleanupDomNodes(child);
|
|
1078
|
-
}
|
|
1079
|
-
},
|
|
1080
|
-
_rpc: (parentId, newId, oldId) => {
|
|
1081
|
-
const parent = domNodes.get(Number(parentId));
|
|
1082
|
-
const newChild = domNodes.get(Number(newId));
|
|
1083
|
-
const oldChild = domNodes.get(Number(oldId));
|
|
1084
|
-
if (parent && newChild && oldChild) {
|
|
1085
|
-
parent.replaceChild(newChild, oldChild);
|
|
1086
|
-
cleanupDomNodes(oldChild);
|
|
1087
|
-
}
|
|
1396
|
+
_flush: (ptr, len) => {
|
|
1397
|
+
flushDomCmds(ptr, len, {
|
|
1398
|
+
domNodes,
|
|
1399
|
+
cleanupDomNodes
|
|
1400
|
+
});
|
|
1088
1401
|
},
|
|
1089
1402
|
_getLocationHref: (bufPtr, bufLen) => {
|
|
1090
1403
|
const bytes = textEncoder.encode(window.location.href);
|
|
@@ -1123,6 +1436,10 @@ var ZxBridge = class extends ZxBridgeCore {
|
|
|
1123
1436
|
if (!form || !(form instanceof HTMLFormElement)) return;
|
|
1124
1437
|
const statesJson = statesLen > 0 ? readString(statesPtr, statesLen) : "[]";
|
|
1125
1438
|
bridgeRef[0]?.submitFormActionAsync(form, actionId, statesJson, fetchId);
|
|
1439
|
+
},
|
|
1440
|
+
_formReset: (vnodeId) => {
|
|
1441
|
+
const form = domNodes.get(Number(vnodeId));
|
|
1442
|
+
if (form instanceof HTMLFormElement) form.reset();
|
|
1126
1443
|
}
|
|
1127
1444
|
}
|
|
1128
1445
|
};
|
|
@@ -1149,247 +1466,10 @@ function cleanupDomNodes(node) {
|
|
|
1149
1466
|
const children = n.childNodes;
|
|
1150
1467
|
for (let i = 0; i < children.length; i++) stack.push(children[i]);
|
|
1151
1468
|
}
|
|
1152
|
-
for (
|
|
1153
|
-
|
|
1469
|
+
for (let bits = highFreqBits & HIGH_FREQ_EVENT_BITS; bits !== 0; bits &= bits - 1) {
|
|
1470
|
+
maybeRemoveHighFreqListener(31 - Math.clz32(bits));
|
|
1154
1471
|
}
|
|
1155
1472
|
}
|
|
1156
|
-
var SVG_TAG_START_INDEX = 140;
|
|
1157
|
-
var TAG_NAMES = [
|
|
1158
|
-
"aside",
|
|
1159
|
-
"fragment",
|
|
1160
|
-
"iframe",
|
|
1161
|
-
"slot",
|
|
1162
|
-
"img",
|
|
1163
|
-
"html",
|
|
1164
|
-
"base",
|
|
1165
|
-
"head",
|
|
1166
|
-
"link",
|
|
1167
|
-
"meta",
|
|
1168
|
-
"script",
|
|
1169
|
-
"style",
|
|
1170
|
-
"title",
|
|
1171
|
-
"address",
|
|
1172
|
-
"article",
|
|
1173
|
-
"body",
|
|
1174
|
-
"h1",
|
|
1175
|
-
"h6",
|
|
1176
|
-
"footer",
|
|
1177
|
-
"header",
|
|
1178
|
-
"h2",
|
|
1179
|
-
"h3",
|
|
1180
|
-
"h4",
|
|
1181
|
-
"h5",
|
|
1182
|
-
"hgroup",
|
|
1183
|
-
"nav",
|
|
1184
|
-
"section",
|
|
1185
|
-
"dd",
|
|
1186
|
-
"dl",
|
|
1187
|
-
"dt",
|
|
1188
|
-
"div",
|
|
1189
|
-
"figcaption",
|
|
1190
|
-
"figure",
|
|
1191
|
-
"hr",
|
|
1192
|
-
"li",
|
|
1193
|
-
"ol",
|
|
1194
|
-
"ul",
|
|
1195
|
-
"menu",
|
|
1196
|
-
"main",
|
|
1197
|
-
"p",
|
|
1198
|
-
"picture",
|
|
1199
|
-
"pre",
|
|
1200
|
-
"a",
|
|
1201
|
-
"abbr",
|
|
1202
|
-
"b",
|
|
1203
|
-
"bdi",
|
|
1204
|
-
"bdo",
|
|
1205
|
-
"br",
|
|
1206
|
-
"cite",
|
|
1207
|
-
"code",
|
|
1208
|
-
"data",
|
|
1209
|
-
"time",
|
|
1210
|
-
"dfn",
|
|
1211
|
-
"em",
|
|
1212
|
-
"i",
|
|
1213
|
-
"kbd",
|
|
1214
|
-
"mark",
|
|
1215
|
-
"q",
|
|
1216
|
-
"blockquote",
|
|
1217
|
-
"rp",
|
|
1218
|
-
"ruby",
|
|
1219
|
-
"rt",
|
|
1220
|
-
"rtc",
|
|
1221
|
-
"rb",
|
|
1222
|
-
"s",
|
|
1223
|
-
"del",
|
|
1224
|
-
"ins",
|
|
1225
|
-
"samp",
|
|
1226
|
-
"small",
|
|
1227
|
-
"span",
|
|
1228
|
-
"strong",
|
|
1229
|
-
"sub",
|
|
1230
|
-
"sup",
|
|
1231
|
-
"u",
|
|
1232
|
-
"var",
|
|
1233
|
-
"wbr",
|
|
1234
|
-
"area",
|
|
1235
|
-
"map",
|
|
1236
|
-
"audio",
|
|
1237
|
-
"source",
|
|
1238
|
-
"track",
|
|
1239
|
-
"video",
|
|
1240
|
-
"embed",
|
|
1241
|
-
"object",
|
|
1242
|
-
"param",
|
|
1243
|
-
"canvas",
|
|
1244
|
-
"noscript",
|
|
1245
|
-
"caption",
|
|
1246
|
-
"table",
|
|
1247
|
-
"col",
|
|
1248
|
-
"colgroup",
|
|
1249
|
-
"tbody",
|
|
1250
|
-
"tr",
|
|
1251
|
-
"thead",
|
|
1252
|
-
"tfoot",
|
|
1253
|
-
"td",
|
|
1254
|
-
"th",
|
|
1255
|
-
"button",
|
|
1256
|
-
"datalist",
|
|
1257
|
-
"option",
|
|
1258
|
-
"fieldset",
|
|
1259
|
-
"label",
|
|
1260
|
-
"form",
|
|
1261
|
-
"input",
|
|
1262
|
-
"keygen",
|
|
1263
|
-
"legend",
|
|
1264
|
-
"meter",
|
|
1265
|
-
"optgroup",
|
|
1266
|
-
"select",
|
|
1267
|
-
"output",
|
|
1268
|
-
"progress",
|
|
1269
|
-
"textarea",
|
|
1270
|
-
"details",
|
|
1271
|
-
"dialog",
|
|
1272
|
-
"menuitem",
|
|
1273
|
-
"summary",
|
|
1274
|
-
"content",
|
|
1275
|
-
"element",
|
|
1276
|
-
"shadow",
|
|
1277
|
-
"template",
|
|
1278
|
-
"acronym",
|
|
1279
|
-
"applet",
|
|
1280
|
-
"basefont",
|
|
1281
|
-
"font",
|
|
1282
|
-
"big",
|
|
1283
|
-
"blink",
|
|
1284
|
-
"center",
|
|
1285
|
-
"command",
|
|
1286
|
-
"dir",
|
|
1287
|
-
"frame",
|
|
1288
|
-
"frameset",
|
|
1289
|
-
"isindex",
|
|
1290
|
-
"listing",
|
|
1291
|
-
"marquee",
|
|
1292
|
-
"noembed",
|
|
1293
|
-
"plaintext",
|
|
1294
|
-
"spacer",
|
|
1295
|
-
"strike",
|
|
1296
|
-
"tt",
|
|
1297
|
-
"xmp",
|
|
1298
|
-
// SVG Tags
|
|
1299
|
-
"animate",
|
|
1300
|
-
"animateMotion",
|
|
1301
|
-
"animateTransform",
|
|
1302
|
-
"circle",
|
|
1303
|
-
"clipPath",
|
|
1304
|
-
"defs",
|
|
1305
|
-
"desc",
|
|
1306
|
-
"ellipse",
|
|
1307
|
-
"feBlend",
|
|
1308
|
-
"feColorMatrix",
|
|
1309
|
-
"feComponentTransfer",
|
|
1310
|
-
"feComposite",
|
|
1311
|
-
"feConvolveMatrix",
|
|
1312
|
-
"feDiffuseLighting",
|
|
1313
|
-
"feDisplacementMap",
|
|
1314
|
-
"feDistantLight",
|
|
1315
|
-
"feDropShadow",
|
|
1316
|
-
"feFlood",
|
|
1317
|
-
"feFuncA",
|
|
1318
|
-
"feFuncB",
|
|
1319
|
-
"feFuncG",
|
|
1320
|
-
"feFuncR",
|
|
1321
|
-
"feGaussianBlur",
|
|
1322
|
-
"feImage",
|
|
1323
|
-
"feMerge",
|
|
1324
|
-
"feMergeNode",
|
|
1325
|
-
"feMorphology",
|
|
1326
|
-
"feOffset",
|
|
1327
|
-
"fePointLight",
|
|
1328
|
-
"feSpecularLighting",
|
|
1329
|
-
"feSpotLight",
|
|
1330
|
-
"feTile",
|
|
1331
|
-
"feTurbulence",
|
|
1332
|
-
"filter",
|
|
1333
|
-
"foreignObject",
|
|
1334
|
-
"g",
|
|
1335
|
-
"image",
|
|
1336
|
-
"line",
|
|
1337
|
-
"linearGradient",
|
|
1338
|
-
"marker",
|
|
1339
|
-
"mask",
|
|
1340
|
-
"metadata",
|
|
1341
|
-
"mpath",
|
|
1342
|
-
"path",
|
|
1343
|
-
"pattern",
|
|
1344
|
-
"polygon",
|
|
1345
|
-
"polyline",
|
|
1346
|
-
"radialGradient",
|
|
1347
|
-
"rect",
|
|
1348
|
-
"set",
|
|
1349
|
-
"stop",
|
|
1350
|
-
"svg",
|
|
1351
|
-
"switch",
|
|
1352
|
-
"symbol",
|
|
1353
|
-
"text",
|
|
1354
|
-
"textPath",
|
|
1355
|
-
"tspan",
|
|
1356
|
-
"use",
|
|
1357
|
-
"view"
|
|
1358
|
-
];
|
|
1359
|
-
var DELEGATED_EVENTS = [
|
|
1360
|
-
"click",
|
|
1361
|
-
"dblclick",
|
|
1362
|
-
"input",
|
|
1363
|
-
"change",
|
|
1364
|
-
"submit",
|
|
1365
|
-
// focus/blur do not bubble - listen to focusin/focusout instead.
|
|
1366
|
-
"focusin",
|
|
1367
|
-
"focusout",
|
|
1368
|
-
"keydown",
|
|
1369
|
-
"keyup",
|
|
1370
|
-
"keypress",
|
|
1371
|
-
"mouseenter",
|
|
1372
|
-
"mouseleave",
|
|
1373
|
-
"mousedown",
|
|
1374
|
-
"mouseup",
|
|
1375
|
-
"mousemove",
|
|
1376
|
-
"touchstart",
|
|
1377
|
-
"touchend",
|
|
1378
|
-
"touchmove",
|
|
1379
|
-
"scroll",
|
|
1380
|
-
"wheel",
|
|
1381
|
-
"pointerdown",
|
|
1382
|
-
"pointermove",
|
|
1383
|
-
"pointerup",
|
|
1384
|
-
"pointercancel"
|
|
1385
|
-
];
|
|
1386
|
-
var HIGH_FREQ_EVENT_IDS = new Set([
|
|
1387
|
-
DELEGATED_EVENTS.indexOf("mousemove"),
|
|
1388
|
-
DELEGATED_EVENTS.indexOf("pointermove"),
|
|
1389
|
-
DELEGATED_EVENTS.indexOf("wheel"),
|
|
1390
|
-
DELEGATED_EVENTS.indexOf("scroll"),
|
|
1391
|
-
DELEGATED_EVENTS.indexOf("touchmove")
|
|
1392
|
-
].filter((id) => id >= 0));
|
|
1393
1473
|
var delegationState = null;
|
|
1394
1474
|
function makeDelegatedListener(bridge, eventTypeId) {
|
|
1395
1475
|
return (event) => {
|
|
@@ -1437,7 +1517,7 @@ function anyHandlerForType(eventTypeId) {
|
|
|
1437
1517
|
return false;
|
|
1438
1518
|
}
|
|
1439
1519
|
function maybeRemoveHighFreqListener(eventTypeId) {
|
|
1440
|
-
if (
|
|
1520
|
+
if ((HIGH_FREQ_EVENT_BITS & 1 << eventTypeId) === 0) return;
|
|
1441
1521
|
if (anyHandlerForType(eventTypeId)) return;
|
|
1442
1522
|
const state = delegationState;
|
|
1443
1523
|
if (!state) return;
|
|
@@ -1453,7 +1533,7 @@ function initEventDelegation(bridge, rootSelector = "body") {
|
|
|
1453
1533
|
};
|
|
1454
1534
|
delegationState = { root, bridge, attached: /* @__PURE__ */ new Map() };
|
|
1455
1535
|
for (let eventTypeId = 0; eventTypeId < DELEGATED_EVENTS.length; eventTypeId++) {
|
|
1456
|
-
if (
|
|
1536
|
+
if ((HIGH_FREQ_EVENT_BITS & 1 << eventTypeId) !== 0) continue;
|
|
1457
1537
|
ensureDelegatedListener(eventTypeId);
|
|
1458
1538
|
}
|
|
1459
1539
|
return () => {
|