x-runtime-lib 0.8.205 → 0.8.207
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/dist/{emscripten-module.browser.cliij9uf.js → emscripten-module.browser.h7zp435u.js} +1 -1
- package/dist/ffi.ji1z6n81.js +2 -0
- package/dist/index.js +88 -86
- package/dist/module-6F3E5H7Y.moj63f9l.js +2 -0
- package/dist/{utils/reactivity.d.ts → sandbox/reactivity/index.d.ts} +1 -1
- package/dist/sandbox/sandbox/hooks.d.ts +3 -3
- package/dist/sandbox/sandbox/index.d.ts +2 -1
- package/dist/utils/index.d.ts +0 -1
- package/dist/{vendor.pfrgnj2n.js → vendor.lq3l5zkx.js} +73 -73
- package/package.json +1 -1
- package/dist/ffi.cu3sfyus.js +0 -2
- package/dist/module-6F3E5H7Y.padkzems.js +0 -2
package/dist/{emscripten-module.browser.cliij9uf.js → emscripten-module.browser.h7zp435u.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as emscripten_module_browser_default } from "./vendor.
|
|
1
|
+
import { n as emscripten_module_browser_default } from "./vendor.lq3l5zkx.js";
|
|
2
2
|
export { emscripten_module_browser_default as default };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __export } from "./rolldown-runtime.ofrncwta.js";
|
|
2
|
-
import { C as MapControls_default, D as isEmpty_default, E as isEqual_default, O as cloneDeep_default, S as KeyboardControls_default, T as component_default$8, _ as install, b as registerTheme, d as install$5, f as install$4, g as install$3, h as install$1, i as
|
|
2
|
+
import { C as MapControls_default, D as isEmpty_default, E as isEqual_default, O as cloneDeep_default, S as KeyboardControls_default, T as component_default$8, _ as install, a as getQuickJS, b as registerTheme, d as install$5, f as install$4, g as install$3, h as install$1, i as mitt_default, k as capitalize_default, m as install$2, p as install$6, r as encodeString, u as install$7, v as core_exports, w as OrbitControls_default, x as HTML_default, y as use } from "./vendor.lq3l5zkx.js";
|
|
3
3
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, h, inject, isRef, mergeModels, nextTick, normalizeClass, normalizeStyle, onBeforeMount, onMounted, onUnmounted, openBlock, provide, readonly, ref, renderList, renderSlot, resolveComponent, shallowRef, toDisplayString, unref, useAttrs, useId, useModel, useTemplateRef, watch, watchEffect, withCtx, withModifiers } from "vue";
|
|
4
4
|
import { createAxios, eventBus, getTypeDefault, globalObjects, messageError, messageInfo, messageSuccess, messageWarning, openConfirmDlg, openPromptDlg, useViewStack, waitUtil } from "x-essential-lib";
|
|
5
5
|
import { CameraHelper, DirectionalLightHelper, PointLightHelper, SpotLightHelper } from "three";
|
|
@@ -224,7 +224,7 @@ function toEventName(e, p) {
|
|
|
224
224
|
m = makePrefix("adaptSlot", "propertyChange"), g = !1;
|
|
225
225
|
break;
|
|
226
226
|
case "stateChangeEvent":
|
|
227
|
-
m = makePrefix("
|
|
227
|
+
m = makePrefix("stateChange"), g = !1;
|
|
228
228
|
break;
|
|
229
229
|
default: console.assert(!1, `not implemented kind=${e}`);
|
|
230
230
|
}
|
|
@@ -1499,8 +1499,8 @@ function useElementSlotProperty(e, p, m, g) {
|
|
|
1499
1499
|
e.eventBus.on(`property/${m}/get`, _), e.eventBus.on(`property/${m}/set`, v);
|
|
1500
1500
|
}), onUnmounted(() => {
|
|
1501
1501
|
e.eventBus.off(`property/${m}/get`, _), e.eventBus.off(`property/${m}/set`, v);
|
|
1502
|
-
}), watch(g, (g, _) => {
|
|
1503
|
-
e.hooks.onPropertyChange(makePropertyId("elementAdaptSlotProperty", "globality", makePropertyKeyOfElementSlot(p.value.basic.key, e.slotId, m)), g, _, e.instance);
|
|
1502
|
+
}), watch(g, async (g, _) => {
|
|
1503
|
+
await e.hooks.onPropertyChange(makePropertyId("elementAdaptSlotProperty", "globality", makePropertyKeyOfElementSlot(p.value.basic.key, e.slotId, m)), g, _, e.instance);
|
|
1504
1504
|
}, { immediate: !0 });
|
|
1505
1505
|
}
|
|
1506
1506
|
function useElementSlotRender(e, p, m) {
|
|
@@ -10182,6 +10182,10 @@ function provideNode(e) {
|
|
|
10182
10182
|
function injectNode() {
|
|
10183
10183
|
return inject(nodeKey);
|
|
10184
10184
|
}
|
|
10185
|
+
function getImplementMethodName(e, p, m) {
|
|
10186
|
+
let g = [e, p], _ = m.split(".");
|
|
10187
|
+
return _.length > 1 ? g.push(..._.slice(1)) : g.push(m), `__implementMethod$${g.join("$")}__`;
|
|
10188
|
+
}
|
|
10185
10189
|
function makePropertyId(e, p, m) {
|
|
10186
10190
|
return `${e}/${p}/${m}`;
|
|
10187
10191
|
}
|
|
@@ -10313,55 +10317,6 @@ function unwrapTriggerId(e) {
|
|
|
10313
10317
|
triggerKey: p[1]
|
|
10314
10318
|
};
|
|
10315
10319
|
}
|
|
10316
|
-
async function initReactivity(e, p) {
|
|
10317
|
-
await initWatchEffect(e, p), await initBind(e, p);
|
|
10318
|
-
}
|
|
10319
|
-
async function initWatchEffect(e, p) {
|
|
10320
|
-
let { watchEffect: m } = p;
|
|
10321
|
-
for (let p of m.ids) {
|
|
10322
|
-
let m = encodeString(p);
|
|
10323
|
-
await e.callFunctionAsync(`__watchEffect$${m}__`);
|
|
10324
|
-
}
|
|
10325
|
-
}
|
|
10326
|
-
async function initBind(e, p) {
|
|
10327
|
-
let { bind: m } = p;
|
|
10328
|
-
for (let p in m.sets) {
|
|
10329
|
-
let g = m.sets[p];
|
|
10330
|
-
if (g.length < 2) continue;
|
|
10331
|
-
let _, { kind: v, triggerKey: y } = unwrapTriggerId(g[0]);
|
|
10332
|
-
v === "propertyTrigger" ? _ = await e.getProperty(y) : v === "stateTrigger" ? _ = await e.getState(y) : console.assert(!1);
|
|
10333
|
-
for (let p of g) {
|
|
10334
|
-
let { kind: m, triggerKey: g } = unwrapTriggerId(p);
|
|
10335
|
-
m === "propertyTrigger" ? await e.setProperty(g, _) : m === "stateTrigger" ? await e.setState(g, _) : console.assert(!1);
|
|
10336
|
-
}
|
|
10337
|
-
}
|
|
10338
|
-
}
|
|
10339
|
-
async function triggerReactivity(e, p, m, g, _) {
|
|
10340
|
-
await triggerWatchEffect(e, p, m), await triggerBind(e, p, m, g, _);
|
|
10341
|
-
}
|
|
10342
|
-
async function triggerWatchEffect(e, p, m) {
|
|
10343
|
-
let { watchEffect: g } = p;
|
|
10344
|
-
if (g.triggers[m]) for (let p of g.triggers[m]) {
|
|
10345
|
-
let m = encodeString(p);
|
|
10346
|
-
await e.callFunctionAsync(`__watchEffect$${m}__`);
|
|
10347
|
-
}
|
|
10348
|
-
}
|
|
10349
|
-
async function triggerBind(e, p, m, _, v) {
|
|
10350
|
-
let { bind: y } = p;
|
|
10351
|
-
if (isEqual_default(_, v)) return;
|
|
10352
|
-
let b = y.triggers[m];
|
|
10353
|
-
if (b) for (let p of b) {
|
|
10354
|
-
let m = y.sets[p];
|
|
10355
|
-
if (m) for (let p of m) {
|
|
10356
|
-
let { kind: m, triggerKey: g } = unwrapTriggerId(p);
|
|
10357
|
-
m === "propertyTrigger" ? await e.setProperty(g, _) : m === "stateTrigger" ? await e.setState(g, _) : console.assert(!1);
|
|
10358
|
-
}
|
|
10359
|
-
}
|
|
10360
|
-
}
|
|
10361
|
-
function getImplementMethodName(e, p, m) {
|
|
10362
|
-
let g = [e, p], _ = m.split(".");
|
|
10363
|
-
return _.length > 1 ? g.push(..._.slice(1)) : g.push(m), `__implementMethod$${g.join("$")}__`;
|
|
10364
|
-
}
|
|
10365
10320
|
function useDepend(e, p, m) {
|
|
10366
10321
|
let g = injectDepends(), v = ref(-1), y = ref(-1);
|
|
10367
10322
|
watchEffect(() => {
|
|
@@ -10702,10 +10657,10 @@ var PromiseManager = class {
|
|
|
10702
10657
|
data = ref();
|
|
10703
10658
|
depends = shallowRef();
|
|
10704
10659
|
prepare(e, p, m, g) {
|
|
10705
|
-
this.meta.value = e.value, this.data.value = p.value, this.depends.value = m.value, this.
|
|
10660
|
+
this.meta.value = e.value, this.data.value = p.value, this.depends.value = m.value, this.resetCustomProperties(g), this.resetCustomSlotProperties(g), this.resetStates();
|
|
10706
10661
|
}
|
|
10707
10662
|
async createVm(e, p) {
|
|
10708
|
-
this.vm = e.newContext(), this.promiseManager = new PromiseManager(this.vm), bind(this), this.vm.evalCode("\nlet __events__ = {}\n\nfunction __onEventV1__(id, callback) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (typeof(callback) !== 'function') {\n return\n }\n if (!__events__[id]) {\n __events__[id] = []\n }\n const callbacks = __events__[id]\n for (let i = 0; i < callbacks.length; i++) {\n if (callbacks[i] === callback) {\n return\n }\n }\n callbacks.push(callback)\n}\n\nasync function __triggerEventInner__(id, params, instance) {\n if (!__events__[id]) {\n return\n }\n const callbacks = __events__[id]\n if (!callbacks) {\n return\n }\n for (let i = 0; i < callbacks.length; i++) {\n await callbacks[i](params, instance)\n }\n}\n\nlet __timers__ = {}\nlet __currTimerId__ = 0\n\nfunction __createTimerV1__(interval, loop, count, immediate, callback) {\n if (!loop && count <= 0) {\n return\n }\n const timer = {}\n timer.id = __currTimerId__++\n timer.interval = interval\n timer.loop = loop\n timer.count = count\n timer.immediate = immediate\n timer.callback = callback\n __timers__[timer.id] = timer\n if (timer.immediate) {\n __timeoutCallbackV1__(timer.id)\n } else {\n __timeoutV1__(timer.id, timer.interval)\n }\n}\n\nasync function __timeoutCallback__(timerId) {\n const timer = __timers__[timerId]\n if (timer) {\n timer.callback()\n // 修改计数\n if (!timer.loop) {\n timer.count = timer.count - 1\n }\n // 触发超时\n if (timer.loop || timer.count > 0) {\n await __timeoutV1__(timer.id, timer.interval)\n }\n // 回收\n if (!timer.loop && timer.count <= 0) {\n delete __timers__[timer.id]\n }\n }\n}\n\nfunction __destroy__() {\n __events__ = {}\n __timers__ = {}\n}\n"), this.setGlobalVariable("__env__", this.env), this.vm.evalCode(p),
|
|
10663
|
+
this.vm = e.newContext(), this.promiseManager = new PromiseManager(this.vm), bind(this), this.vm.evalCode("\nlet __events__ = {}\n\nfunction __onEventV1__(id, callback) {\n if (typeof(id) !== 'string' || !id) {\n return\n }\n if (typeof(callback) !== 'function') {\n return\n }\n if (!__events__[id]) {\n __events__[id] = []\n }\n const callbacks = __events__[id]\n for (let i = 0; i < callbacks.length; i++) {\n if (callbacks[i] === callback) {\n return\n }\n }\n callbacks.push(callback)\n}\n\nasync function __triggerEventInner__(id, params, instance) {\n if (!__events__[id]) {\n return\n }\n const callbacks = __events__[id]\n if (!callbacks) {\n return\n }\n for (let i = 0; i < callbacks.length; i++) {\n await callbacks[i](params, instance)\n }\n}\n\nlet __timers__ = {}\nlet __currTimerId__ = 0\n\nfunction __createTimerV1__(interval, loop, count, immediate, callback) {\n if (!loop && count <= 0) {\n return\n }\n const timer = {}\n timer.id = __currTimerId__++\n timer.interval = interval\n timer.loop = loop\n timer.count = count\n timer.immediate = immediate\n timer.callback = callback\n __timers__[timer.id] = timer\n if (timer.immediate) {\n __timeoutCallbackV1__(timer.id)\n } else {\n __timeoutV1__(timer.id, timer.interval)\n }\n}\n\nasync function __timeoutCallback__(timerId) {\n const timer = __timers__[timerId]\n if (timer) {\n timer.callback()\n // 修改计数\n if (!timer.loop) {\n timer.count = timer.count - 1\n }\n // 触发超时\n if (timer.loop || timer.count > 0) {\n await __timeoutV1__(timer.id, timer.interval)\n }\n // 回收\n if (!timer.loop && timer.count <= 0) {\n delete __timers__[timer.id]\n }\n }\n}\n\nfunction __destroy__() {\n __events__ = {}\n __timers__ = {}\n}\n"), this.setGlobalVariable("__env__", this.env), this.vm.evalCode(p), await nextTick(), await this.hooks.onReady();
|
|
10709
10664
|
}
|
|
10710
10665
|
destroyVm() {
|
|
10711
10666
|
this.vm && this.hooks.onDestroy(), this.promiseManager &&= (this.promiseManager.dispose(), void 0), this.vm &&= (this.vm.dispose(), void 0);
|
|
@@ -10773,12 +10728,13 @@ var PromiseManager = class {
|
|
|
10773
10728
|
}
|
|
10774
10729
|
customProperties = {};
|
|
10775
10730
|
customSlotProperties = {};
|
|
10776
|
-
|
|
10777
|
-
if (this.customProperties = {}, this.meta.value?.properties) for (let { id: p, type: m } of this.meta.value.properties) this.customProperties[p] = getTypeDefault(m), !(
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10731
|
+
resetCustomProperties(e) {
|
|
10732
|
+
if (this.customProperties = {}, !(this.kind !== "ref" && this.kind !== "multipleRef") && this.meta.value?.properties) for (let { id: p, type: m } of this.meta.value.properties) this.customProperties[p] = getTypeDefault(m), !(!e || e[p] === void 0) && typeof this.customProperties[p] == typeof e[p] && (this.customProperties[p] = e[p]);
|
|
10733
|
+
}
|
|
10734
|
+
resetCustomSlotProperties(e) {
|
|
10735
|
+
if (this.customSlotProperties = {}, this.kind !== "customSlot" && this.kind !== "multipleCustomSlot" || !this.parent?.meta.value?.slots) return;
|
|
10736
|
+
let p = this.parent.meta.value.slots.find((e) => e.id === this.slotId);
|
|
10737
|
+
if (!(!p || !p.properties)) for (let { id: m, type: g } of p.properties) this.customSlotProperties[m] = getTypeDefault(g), !(!e || e[m] === void 0) && typeof this.customSlotProperties[m] == typeof e[m] && (this.customSlotProperties[m] = e[m]);
|
|
10782
10738
|
}
|
|
10783
10739
|
isValidOfElementProperty(e, p) {
|
|
10784
10740
|
if (!this.data.value) return !1;
|
|
@@ -10872,14 +10828,14 @@ var PromiseManager = class {
|
|
|
10872
10828
|
async setElementProperty(e, p, m, _) {
|
|
10873
10829
|
if (!this.isValidOfElementProperty(_.basic.key, m)) throw console.warn(`Sandbox/setElementProperty invalid element property id=${e}`), errors.invalidElementProperty;
|
|
10874
10830
|
let v = getField(_, m);
|
|
10875
|
-
isEqual_default(p, v) || (setField(_, m, p), this.hooks.onPropertyChange(e, p, v));
|
|
10831
|
+
isEqual_default(p, v) || (setField(_, m, p), await this.hooks.onPropertyChange(e, p, v));
|
|
10876
10832
|
}
|
|
10877
10833
|
async setRefProperty(e, p, m, _) {
|
|
10878
10834
|
let v = this.children[m];
|
|
10879
10835
|
if (!v) throw errors.sandboxNotFound;
|
|
10880
10836
|
if (!v.isValidOfCustomProperty(_)) throw console.warn(`Sandbox/setRefProperty invalid custom property id=${e}`), errors.invalidCustomProperty;
|
|
10881
10837
|
let y = v.customProperties[_];
|
|
10882
|
-
isEqual_default(p, y) || (v.customProperties[_] = p, v.hooks.onPropertyChange(makePropertyId("customProperty", "globality", _), p, y), this.hooks.onPropertyChange(e, p, y));
|
|
10838
|
+
isEqual_default(p, y) || (v.customProperties[_] = p, await v.hooks.onPropertyChange(makePropertyId("customProperty", "globality", _), p, y), await this.hooks.onPropertyChange(e, p, y));
|
|
10883
10839
|
}
|
|
10884
10840
|
async setMultipleRefProperty(e, p, m, _, v) {
|
|
10885
10841
|
if (!v) throw errors.instanceNotAvailable;
|
|
@@ -10887,7 +10843,7 @@ var PromiseManager = class {
|
|
|
10887
10843
|
if (!y) throw errors.sandboxNotFound;
|
|
10888
10844
|
if (!y.isValidOfCustomProperty(_)) throw console.warn(`Sandbox/setMultipleRefProperty invalid custom property id=${e}`), errors.invalidCustomProperty;
|
|
10889
10845
|
let b = y.customProperties[_];
|
|
10890
|
-
isEqual_default(p, b) || (y.customProperties[_] = p, y.hooks.onPropertyChange(makePropertyId("customProperty", "globality", _), p, b, v), this.hooks.onPropertyChange(e, p, b, v));
|
|
10846
|
+
isEqual_default(p, b) || (y.customProperties[_] = p, await y.hooks.onPropertyChange(makePropertyId("customProperty", "globality", _), p, b, v), await this.hooks.onPropertyChange(e, p, b, v));
|
|
10891
10847
|
}
|
|
10892
10848
|
async setCustomSlotProperty(e, p, m, _) {
|
|
10893
10849
|
let { compId: v, slotId: y, propertyId: b } = unwrapPropertyKeyOfCustomSlot(_);
|
|
@@ -10895,7 +10851,7 @@ var PromiseManager = class {
|
|
|
10895
10851
|
let x = this.children[m];
|
|
10896
10852
|
if (!x) throw errors.sandboxNotFound;
|
|
10897
10853
|
let S = x.customSlotProperties[b];
|
|
10898
|
-
isEqual_default(p, S) || (x.customSlotProperties[b] = p, x.hooks.onPropertyChange(makePropertyId("customAdaptSlotProperty", "globality", _), p, S), this.hooks.onPropertyChange(e, p, S));
|
|
10854
|
+
isEqual_default(p, S) || (x.customSlotProperties[b] = p, await x.hooks.onPropertyChange(makePropertyId("customAdaptSlotProperty", "globality", _), p, S), await this.hooks.onPropertyChange(e, p, S));
|
|
10899
10855
|
}
|
|
10900
10856
|
async setMultipleCustomSlotProperty(e, p, m, _, v) {
|
|
10901
10857
|
if (!v) throw errors.instanceNotAvailable;
|
|
@@ -10904,12 +10860,12 @@ var PromiseManager = class {
|
|
|
10904
10860
|
let S = this.children[`${m}/${v}`];
|
|
10905
10861
|
if (!S) throw errors.sandboxNotFound;
|
|
10906
10862
|
let C = S.customSlotProperties[x];
|
|
10907
|
-
isEqual_default(p, C) || (S.customSlotProperties[x] = p, S.hooks.onPropertyChange(makePropertyId("customAdaptSlotProperty", "globality", _), p, C, v), this.hooks.onPropertyChange(e, p, C, v));
|
|
10863
|
+
isEqual_default(p, C) || (S.customSlotProperties[x] = p, await S.hooks.onPropertyChange(makePropertyId("customAdaptSlotProperty", "globality", _), p, C, v), await this.hooks.onPropertyChange(e, p, C, v));
|
|
10908
10864
|
}
|
|
10909
10865
|
async setCustomProperty(e, p, m) {
|
|
10910
10866
|
if (!this.isValidOfCustomProperty(m)) throw console.warn(`Sandbox/setCustomProperty invalid custom property id=${e}`), errors.invalidCustomProperty;
|
|
10911
10867
|
let _ = this.customProperties[m];
|
|
10912
|
-
isEqual_default(p, _) || (this.customProperties[m] = p, this.hooks.onPropertyChange(e, p, _), this.parent && (this.instance ? this.parent.hooks.onPropertyChange(makePropertyId("multipleRefProperty", this.nodeId, m), p, _, this.instance) : this.parent.hooks.onPropertyChange(makePropertyId("refProperty", this.nodeId, m), p, _)));
|
|
10868
|
+
isEqual_default(p, _) || (this.customProperties[m] = p, await this.hooks.onPropertyChange(e, p, _), this.parent && (this.instance ? await this.parent.hooks.onPropertyChange(makePropertyId("multipleRefProperty", this.nodeId, m), p, _, this.instance) : await this.parent.hooks.onPropertyChange(makePropertyId("refProperty", this.nodeId, m), p, _)));
|
|
10913
10869
|
}
|
|
10914
10870
|
async setElementAdaptSlotProperty(e, p, m) {
|
|
10915
10871
|
if (!this.parent) throw errors.notInSlot;
|
|
@@ -10919,7 +10875,7 @@ var PromiseManager = class {
|
|
|
10919
10875
|
let b = { value: void 0 };
|
|
10920
10876
|
this.eventBus.emit(`property/${y}/get`, { result: b });
|
|
10921
10877
|
let x = b.value;
|
|
10922
|
-
isEqual_default(p, x) || (this.eventBus.emit(`property/${y}/set`, p), this.hooks.onPropertyChange(e, p, x), this.kind === "elementSlot" ? this.parent.hooks.onPropertyChange(makePropertyId("elementSlotProperty", this.nodeId, m), p, x) : this.kind === "multipleElementSlot" && this.parent.hooks.onPropertyChange(makePropertyId("multipleElementSlotProperty", this.nodeId, m), p, x, this.instance));
|
|
10878
|
+
isEqual_default(p, x) || (this.eventBus.emit(`property/${y}/set`, p), await this.hooks.onPropertyChange(e, p, x), this.kind === "elementSlot" ? await this.parent.hooks.onPropertyChange(makePropertyId("elementSlotProperty", this.nodeId, m), p, x) : this.kind === "multipleElementSlot" && await this.parent.hooks.onPropertyChange(makePropertyId("multipleElementSlotProperty", this.nodeId, m), p, x, this.instance));
|
|
10923
10879
|
}
|
|
10924
10880
|
async setCustomAdaptSlotProperty(e, p, m) {
|
|
10925
10881
|
if (!this.parent) throw errors.notInSlot;
|
|
@@ -10927,7 +10883,7 @@ var PromiseManager = class {
|
|
|
10927
10883
|
if (!this.isEqualOfCustomSlot(_, v)) throw errors.slotIncompatible;
|
|
10928
10884
|
if (!this.isValidOfCustomSlotProperty(_, v, y)) throw console.warn(`Sandbox/setCustomAdaptSlotProperty invalid custom slot property id=${e}`), errors.invalidCustomSlotProperty;
|
|
10929
10885
|
let b = this.customSlotProperties[y];
|
|
10930
|
-
isEqual_default(p, b) || (this.customSlotProperties[y] = p, this.hooks.onPropertyChange(e, p, b), this.kind === "customSlot" ? this.parent.hooks.onPropertyChange(makePropertyId("customSlotProperty", this.nodeId, m), p, b) : this.kind === "multipleCustomSlot" && this.parent.hooks.onPropertyChange(makePropertyId("multipleCustomSlotProperty", this.nodeId, m), p, b, this.instance));
|
|
10886
|
+
isEqual_default(p, b) || (this.customSlotProperties[y] = p, await this.hooks.onPropertyChange(e, p, b), this.kind === "customSlot" ? await this.parent.hooks.onPropertyChange(makePropertyId("customSlotProperty", this.nodeId, m), p, b) : this.kind === "multipleCustomSlot" && await this.parent.hooks.onPropertyChange(makePropertyId("multipleCustomSlotProperty", this.nodeId, m), p, b, this.instance));
|
|
10931
10887
|
}
|
|
10932
10888
|
isValidOfElementMethod(e, p) {
|
|
10933
10889
|
let m = getElement(e);
|
|
@@ -11165,39 +11121,85 @@ var PromiseManager = class {
|
|
|
11165
11121
|
async setState(e, p) {
|
|
11166
11122
|
if (this.debugTrace("setState", e, p), !this.isValidOfState(e)) throw console.warn(`Sandbox/setState invalid state id=${e}`), errors.invalidState;
|
|
11167
11123
|
let m = this.states[e];
|
|
11168
|
-
isEqual_default(p, m) || (this.states[e] = cloneDeep_default(p), this.hooks.onStateChange(e, p, m), await nextTick());
|
|
11124
|
+
isEqual_default(p, m) || (this.states[e] = cloneDeep_default(p), await this.hooks.onStateChange(e, p, m), await nextTick());
|
|
11169
11125
|
}
|
|
11170
11126
|
};
|
|
11127
|
+
async function initReactivity(e, p) {
|
|
11128
|
+
await initWatchEffect(e, p), await initBind(e, p);
|
|
11129
|
+
}
|
|
11130
|
+
async function initWatchEffect(e, p) {
|
|
11131
|
+
let { watchEffect: m } = p;
|
|
11132
|
+
for (let p of m.ids) {
|
|
11133
|
+
let m = encodeString(p);
|
|
11134
|
+
await e.callFunctionAsync(`__watchEffect$${m}__`);
|
|
11135
|
+
}
|
|
11136
|
+
}
|
|
11137
|
+
async function initBind(e, p) {
|
|
11138
|
+
let { bind: m } = p;
|
|
11139
|
+
for (let p in m.sets) {
|
|
11140
|
+
let g = m.sets[p];
|
|
11141
|
+
if (g.length < 2) continue;
|
|
11142
|
+
let _, { kind: v, triggerKey: y } = unwrapTriggerId(g[0]);
|
|
11143
|
+
v === "propertyTrigger" ? _ = await e.getProperty(y) : v === "stateTrigger" ? _ = await e.getState(y) : console.assert(!1);
|
|
11144
|
+
for (let p of g) {
|
|
11145
|
+
let { kind: m, triggerKey: g } = unwrapTriggerId(p);
|
|
11146
|
+
m === "propertyTrigger" ? await e.setProperty(g, _) : m === "stateTrigger" ? await e.setState(g, _) : console.assert(!1);
|
|
11147
|
+
}
|
|
11148
|
+
}
|
|
11149
|
+
}
|
|
11150
|
+
async function triggerReactivity(e, p, m) {
|
|
11151
|
+
await triggerWatchEffect(e, p, m), await triggerBind(e, p, m);
|
|
11152
|
+
}
|
|
11153
|
+
async function triggerWatchEffect(e, p, m) {
|
|
11154
|
+
let { watchEffect: g } = p;
|
|
11155
|
+
if (g.triggers[m]) for (let p of g.triggers[m]) {
|
|
11156
|
+
let m = encodeString(p);
|
|
11157
|
+
await e.callFunctionAsync(`__watchEffect$${m}__`);
|
|
11158
|
+
}
|
|
11159
|
+
}
|
|
11160
|
+
async function triggerBind(e, p, m) {
|
|
11161
|
+
let { bind: g } = p, _ = g.triggers[m];
|
|
11162
|
+
if (!_) return;
|
|
11163
|
+
let v, { kind: y, triggerKey: b } = unwrapTriggerId(m);
|
|
11164
|
+
y === "propertyTrigger" ? v = await e.getProperty(b) : y === "stateTrigger" ? v = await e.getState(b) : console.assert(!1);
|
|
11165
|
+
for (let p of _) {
|
|
11166
|
+
let m = g.sets[p];
|
|
11167
|
+
if (m) for (let p of m) {
|
|
11168
|
+
let { kind: m, triggerKey: g } = unwrapTriggerId(p);
|
|
11169
|
+
m === "propertyTrigger" ? await e.setProperty(g, v) : m === "stateTrigger" ? await e.setState(g, v) : console.assert(!1);
|
|
11170
|
+
}
|
|
11171
|
+
}
|
|
11172
|
+
}
|
|
11171
11173
|
function useSandbox(e, p, m, _, v, y, b, x) {
|
|
11172
11174
|
let S = injectOrg(), C = injectEnv(), w = injectMode(), T = injectType(), E = injectDevice(), D = injectDark(), O = injectDepends();
|
|
11173
11175
|
if (!isExecutableMode(w)) return { sandbox: void 0 };
|
|
11174
11176
|
let k = injectRuntime(), A = new Sandbox(e, p, m, _, v, S, C, w, T, {
|
|
11175
|
-
onReady:
|
|
11176
|
-
onDestroy:
|
|
11177
|
-
onPropertyChange:
|
|
11178
|
-
onStateChange:
|
|
11177
|
+
onReady: N,
|
|
11178
|
+
onDestroy: P,
|
|
11179
|
+
onPropertyChange: F,
|
|
11180
|
+
onStateChange: I
|
|
11179
11181
|
});
|
|
11180
11182
|
provideSandbox(A), onUnmounted(() => {
|
|
11181
11183
|
A.dispose();
|
|
11182
11184
|
});
|
|
11183
|
-
let j = async () => {
|
|
11184
|
-
A.destroyVm(), !(!y.value || !b.value) && (A.prepare(y, b, O, x), await A.createVm(k, b.value.code.script));
|
|
11185
|
+
let j = !1, M = async () => {
|
|
11186
|
+
j = !1, A.destroyVm(), !(!y.value || !b.value) && (A.prepare(y, b, O, x), await A.createVm(k, b.value.code.script));
|
|
11185
11187
|
};
|
|
11186
|
-
|
|
11187
|
-
|
|
11188
|
+
M(), watch([y, b], () => {
|
|
11189
|
+
M();
|
|
11188
11190
|
});
|
|
11189
|
-
async function
|
|
11191
|
+
async function N() {
|
|
11190
11192
|
await A.triggerEvent(makeEventId("elementEvent", "globality", "startup"), []);
|
|
11191
11193
|
let e = calcBreakpoint(E.value.width), p = calcBreakpoint(E.value.width);
|
|
11192
|
-
await A.triggerEvent(makeEventId("elementEvent", "globality", "screenSizeChange"), [e, p]), await A.triggerEvent(makeEventId("elementEvent", "globality", "darkModeChange"), [D.value]);
|
|
11194
|
+
await A.triggerEvent(makeEventId("elementEvent", "globality", "screenSizeChange"), [e, p]), await A.triggerEvent(makeEventId("elementEvent", "globality", "darkModeChange"), [D.value]), b.value?.code.reactivity && await initReactivity(A, b.value.code.reactivity), j = !0;
|
|
11193
11195
|
}
|
|
11194
|
-
async function
|
|
11196
|
+
async function P() {
|
|
11195
11197
|
A.callFunctionSync("__destroy__");
|
|
11196
11198
|
}
|
|
11197
|
-
async function
|
|
11199
|
+
async function F(e, p, m, _) {
|
|
11198
11200
|
if (!A.vm) return;
|
|
11199
11201
|
let { kind: v, nodeId: y, propertyKey: x } = unwrapPropertyId(e);
|
|
11200
|
-
if (await A.triggerEvent(makeEventId(`${v}ChangeEvent`, y, x), [p, m], _), b.value?.code.reactivity && triggerReactivity(A, b.value.code.reactivity, makeTriggerId("propertyTrigger", e)
|
|
11202
|
+
if (await A.triggerEvent(makeEventId(`${v}ChangeEvent`, y, x), [p, m], _), j && b.value?.code.reactivity && triggerReactivity(A, b.value.code.reactivity, makeTriggerId("propertyTrigger", e)), v === "elementProperty") {
|
|
11201
11203
|
if (isEqual_default(x, toDotString(["settings", "slot"]))) {
|
|
11202
11204
|
let e = b.value?.view.nodeLites.find((e) => e.id === y);
|
|
11203
11205
|
e ? e.slotId = p : console.assert(!1);
|
|
@@ -11208,8 +11210,8 @@ function useSandbox(e, p, m, _, v, y, b, x) {
|
|
|
11208
11210
|
}
|
|
11209
11211
|
}
|
|
11210
11212
|
}
|
|
11211
|
-
async function
|
|
11212
|
-
A.vm && (await A.triggerEvent(makeEventId("stateChangeEvent", "globality", e), [p, m]), b.value?.code.reactivity && triggerReactivity(A, b.value.code.reactivity, makeTriggerId("stateTrigger", e)
|
|
11213
|
+
async function I(e, p, m) {
|
|
11214
|
+
A.vm && (await A.triggerEvent(makeEventId("stateChangeEvent", "globality", e), [p, m]), j && b.value?.code.reactivity && triggerReactivity(A, b.value.code.reactivity, makeTriggerId("stateTrigger", e)));
|
|
11213
11215
|
}
|
|
11214
11216
|
return watch(E, async (e, p) => {
|
|
11215
11217
|
if (!A.vm) return;
|
|
@@ -11235,4 +11237,4 @@ async function loadLocaleMessageRuntime(e) {
|
|
|
11235
11237
|
"./locales/zhHans/index.ts": () => import("./zhHans.gwvwcjmv.js")
|
|
11236
11238
|
}, `./locales/${e}/index.ts`, 4)).default;
|
|
11237
11239
|
}
|
|
11238
|
-
export { addIndent, ambientLightV1, badgeV1, barChartV1, boxGeometryV1, breakpoints, btnGroupV1, btnToggleV1, btnV1, calcBreakpoint, cardV1, checkboxV1, chipGroupV1, chipV1, colorPickerV1, comboboxV1, compTypes, containerV1, dataStringify, dataTableV1, datePickerV1, dialogV1, directionalLightV1, duplicateNodePair, duplicateNodePairs, elementKeys, fileInputV1, finalProperties, flexLayoutEntryV1, flexLayoutV1, formV1, fromDotString, genId, getAllElements, getBreakpointProp, getElement, getElementMust, getField, getImplementMethodName, getIndexOfBreakpoint, getNodeLite, getProperties, getPropertyDefault, getTag, globalityV1, groupV1, hasComp, hasSlot, iconV1, initNode, initProperties,
|
|
11240
|
+
export { addIndent, ambientLightV1, badgeV1, barChartV1, boxGeometryV1, breakpoints, btnGroupV1, btnToggleV1, btnV1, calcBreakpoint, cardV1, checkboxV1, chipGroupV1, chipV1, colorPickerV1, comboboxV1, compTypes, containerV1, dataStringify, dataTableV1, datePickerV1, dialogV1, directionalLightV1, duplicateNodePair, duplicateNodePairs, elementKeys, fileInputV1, finalProperties, flexLayoutEntryV1, flexLayoutV1, formV1, fromDotString, genId, getAllElements, getBreakpointProp, getElement, getElementMust, getField, getImplementMethodName, getIndexOfBreakpoint, getNodeLite, getProperties, getPropertyDefault, getTag, globalityV1, groupV1, hasComp, hasSlot, iconV1, initNode, initProperties, injectDark, injectData, injectDepends, injectDevice, injectEnv, injectId, injectMeta, injectMode, injectNode, injectOrg, injectRuntime, injectSandbox, injectType, isCircularReference, isExecutableMode, isPercentStr, isPixelStr, keyboardControlsV1, lineChartV1, loadLocaleMessageRuntime, makeEventId, makeEventKeyOfCustomSlot, makeEventKeyOfElementSlot, makeMethodId, makeMethodKeyOfCustomSlot, makeMethodKeyOfElementSlot, makePropertyId, makePropertyKeyOfCustomSlot, makePropertyKeyOfElementSlot, makeSlotId, makeTriggerId, mapControlsV1, menuV1, meshBasicMaterialV1, meshV1, metaStringify, multipleRefV1, multipleSlotV1, numberInputV1, orbitControlsV1, orthographicCameraV1, pageTypes, paginationV1, parseData, parseMeta, parsePercentStr, parsePixelStr, perspectiveCameraV1, pkgs, pointLightV1, provideDark, provideData, provideDepends, provideDevice, provideEnv, provideId, provideMeta, provideMode, provideNode, provideOrg, provideRuntime, provideSandbox, provideType, radioGroupV1, radioV1, rangeSliderV1, ratingV1, referenceV1, regElement, renderSwitchV1, reverseBreakpoints, selectV1, setField, sliderV1, slotV1, spawnNode, sphereGeometryV1, spotLightV1, stepperHeaderV1, stepperItemV1, stepperV1, stepperWindowItemV1, stepperWindowV1, switchV1, tabV1, tabsV1, textFieldV1, textV1, textareaV1, timelineItemV1, timelineV1, toDotString, toEventName, toMethodName, toNodeLite, toPropertyName, unwrapEventId, unwrapEventKeyOfCustomSlot, unwrapEventKeyOfElementSlot, unwrapMethodId, unwrapMethodKeyOfCustomSlot, unwrapMethodKeyOfElementSlot, unwrapPropertyId, unwrapPropertyKeyOfCustomSlot, unwrapPropertyKeyOfElementSlot, unwrapSlotId, unwrapTriggerId, useDepend, useRuntime, useSandbox, useTheme, windowItemV1, windowV1 };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Sandbox } from '@/sandbox';
|
|
2
2
|
import { Reactivity } from '@/types';
|
|
3
3
|
export declare function initReactivity(sandbox: Sandbox, reactivity: Reactivity): Promise<void>;
|
|
4
|
-
export declare function triggerReactivity(sandbox: Sandbox, reactivity: Reactivity, triggerId: string
|
|
4
|
+
export declare function triggerReactivity(sandbox: Sandbox, reactivity: Reactivity, triggerId: string): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export interface Hooks {
|
|
2
|
-
onReady: () => void
|
|
2
|
+
onReady: () => Promise<void>;
|
|
3
3
|
onDestroy: () => void;
|
|
4
|
-
onPropertyChange: (id: string, newValue: any, oldValue: any, instance?: string) => void
|
|
5
|
-
onStateChange: (id: string, newValue: any, oldValue: any) => void
|
|
4
|
+
onPropertyChange: (id: string, newValue: any, oldValue: any, instance?: string) => Promise<void>;
|
|
5
|
+
onStateChange: (id: string, newValue: any, oldValue: any) => Promise<void>;
|
|
6
6
|
}
|
|
@@ -45,7 +45,8 @@ export declare class Sandbox {
|
|
|
45
45
|
customSlotProperties: {
|
|
46
46
|
[key: string]: any;
|
|
47
47
|
};
|
|
48
|
-
private
|
|
48
|
+
private resetCustomProperties;
|
|
49
|
+
private resetCustomSlotProperties;
|
|
49
50
|
isValidOfElementProperty(elementKey: string, propertyKey: string): boolean;
|
|
50
51
|
isValidOfElementSlotProperty(elementKey: string, slotKey: string, propertyKey: string): boolean;
|
|
51
52
|
isValidOfCustomProperty(propertyId: string): boolean;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -28389,75 +28389,6 @@ var Painter_default = function() {
|
|
|
28389
28389
|
function install(t) {
|
|
28390
28390
|
t.registerPainter("canvas", Painter_default);
|
|
28391
28391
|
}
|
|
28392
|
-
var BASE = 62, BASE_BIGINT = 62n, DEFAULT_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", cachedEncoder = new globalThis.TextEncoder(), cachedDecoder = new globalThis.TextDecoder();
|
|
28393
|
-
function assertString(t, n) {
|
|
28394
|
-
if (typeof t != "string") throw TypeError(`The \`${n}\` parameter must be a string, got \`${t}\` (${typeof t}).`);
|
|
28395
|
-
}
|
|
28396
|
-
function validateAlphabet(t) {
|
|
28397
|
-
if (typeof t != "string") throw TypeError(`The alphabet must be a string, got \`${t}\` (${typeof t}).`);
|
|
28398
|
-
if (t.length !== BASE) throw TypeError(`The alphabet must be exactly ${BASE} characters long, got ${t.length}.`);
|
|
28399
|
-
let n = new Set(t);
|
|
28400
|
-
if (n.size !== BASE) throw TypeError(`The alphabet must contain ${BASE} unique characters, got ${n.size}.`);
|
|
28401
|
-
}
|
|
28402
|
-
var defaultBase62 = new class {
|
|
28403
|
-
constructor(t = {}) {
|
|
28404
|
-
let n = t.alphabet ?? DEFAULT_ALPHABET;
|
|
28405
|
-
validateAlphabet(n), this.alphabet = [...n], this.indices = new Map(this.alphabet.map((t, n) => [t, n]));
|
|
28406
|
-
}
|
|
28407
|
-
#e(t) {
|
|
28408
|
-
let n = this.indices.get(t);
|
|
28409
|
-
if (n === void 0) throw TypeError(`Unexpected character for Base62 encoding: \`${t}\`.`);
|
|
28410
|
-
return n;
|
|
28411
|
-
}
|
|
28412
|
-
encodeString(t) {
|
|
28413
|
-
return assertString(t, "string"), this.encodeBytes(cachedEncoder.encode(t));
|
|
28414
|
-
}
|
|
28415
|
-
decodeString(t) {
|
|
28416
|
-
return assertString(t, "encodedString"), cachedDecoder.decode(this.decodeBytes(t));
|
|
28417
|
-
}
|
|
28418
|
-
encodeBytes(t) {
|
|
28419
|
-
if (!(t instanceof Uint8Array)) throw TypeError("The `bytes` parameter must be an instance of Uint8Array.");
|
|
28420
|
-
if (t.length === 0) return "";
|
|
28421
|
-
let n = 1n;
|
|
28422
|
-
for (let r of t) n = n << 8n | BigInt(r);
|
|
28423
|
-
return this.encodeBigInt(n);
|
|
28424
|
-
}
|
|
28425
|
-
decodeBytes(t) {
|
|
28426
|
-
if (assertString(t, "encodedString"), t.length === 0) return new Uint8Array();
|
|
28427
|
-
let n = this.decodeBigInt(t), r = [];
|
|
28428
|
-
for (; n > 0n;) r.push(Number(n & 255n)), n >>= 8n;
|
|
28429
|
-
return Uint8Array.from(r.reverse().slice(1));
|
|
28430
|
-
}
|
|
28431
|
-
encodeInteger(t) {
|
|
28432
|
-
if (!Number.isInteger(t)) throw TypeError(`Expected an integer, got \`${t}\` (${typeof t}).`);
|
|
28433
|
-
if (t < 0) throw TypeError("The integer must be non-negative.");
|
|
28434
|
-
if (t === 0) return this.alphabet[0];
|
|
28435
|
-
let n = "";
|
|
28436
|
-
for (; t > 0;) n = this.alphabet[t % BASE] + n, t = Math.floor(t / BASE);
|
|
28437
|
-
return n;
|
|
28438
|
-
}
|
|
28439
|
-
decodeInteger(t) {
|
|
28440
|
-
assertString(t, "encodedString");
|
|
28441
|
-
let n = 0;
|
|
28442
|
-
for (let r of t) n = n * BASE + this.#e(r);
|
|
28443
|
-
return n;
|
|
28444
|
-
}
|
|
28445
|
-
encodeBigInt(t) {
|
|
28446
|
-
if (typeof t != "bigint") throw TypeError(`Expected a bigint, got \`${t}\` (${typeof t}).`);
|
|
28447
|
-
if (t < 0) throw TypeError("The bigint must be non-negative.");
|
|
28448
|
-
if (t === 0n) return this.alphabet[0];
|
|
28449
|
-
let n = "";
|
|
28450
|
-
for (; t > 0n;) n = this.alphabet[Number(t % BASE_BIGINT)] + n, t /= BASE_BIGINT;
|
|
28451
|
-
return n;
|
|
28452
|
-
}
|
|
28453
|
-
decodeBigInt(t) {
|
|
28454
|
-
assertString(t, "encodedString");
|
|
28455
|
-
let n = 0n;
|
|
28456
|
-
for (let r of t) n = n * BASE_BIGINT + BigInt(this.#e(r));
|
|
28457
|
-
return n;
|
|
28458
|
-
}
|
|
28459
|
-
}();
|
|
28460
|
-
const encodeString = (t) => defaultBase62.encodeString(t);
|
|
28461
28392
|
var EvalFlags = {
|
|
28462
28393
|
JS_EVAL_TYPE_GLOBAL: 0,
|
|
28463
28394
|
JS_EVAL_TYPE_MODULE: 1,
|
|
@@ -29536,7 +29467,7 @@ async function newQuickJSWASMModuleFromVariant(t) {
|
|
|
29536
29467
|
let n = smartUnwrap(await t), [r, i, { QuickJSWASMModule: a }] = await Promise.all([
|
|
29537
29468
|
n.importModuleLoader().then(smartUnwrap),
|
|
29538
29469
|
n.importFFI(),
|
|
29539
|
-
import("./module-6F3E5H7Y.
|
|
29470
|
+
import("./module-6F3E5H7Y.moj63f9l.js").then(smartUnwrap)
|
|
29540
29471
|
]), o = await r();
|
|
29541
29472
|
return o.type = "sync", new a(o, new i(o));
|
|
29542
29473
|
}
|
|
@@ -29545,8 +29476,8 @@ function smartUnwrap(t) {
|
|
|
29545
29476
|
}
|
|
29546
29477
|
var src_default$3 = {
|
|
29547
29478
|
type: "sync",
|
|
29548
|
-
importFFI: () => import("./ffi.
|
|
29549
|
-
importModuleLoader: () => import("./emscripten-module.browser.
|
|
29479
|
+
importFFI: () => import("./ffi.ji1z6n81.js").then((t) => t.QuickJSFFI),
|
|
29480
|
+
importModuleLoader: () => import("./emscripten-module.browser.h7zp435u.js").then((t) => t.default)
|
|
29550
29481
|
};
|
|
29551
29482
|
async function newQuickJSWASMModule(t = src_default$3) {
|
|
29552
29483
|
return newQuickJSWASMModuleFromVariant(t);
|
|
@@ -29576,6 +29507,75 @@ function mitt_default(t) {
|
|
|
29576
29507
|
}
|
|
29577
29508
|
};
|
|
29578
29509
|
}
|
|
29510
|
+
var BASE = 62, BASE_BIGINT = 62n, DEFAULT_ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", cachedEncoder = new globalThis.TextEncoder(), cachedDecoder = new globalThis.TextDecoder();
|
|
29511
|
+
function assertString(t, n) {
|
|
29512
|
+
if (typeof t != "string") throw TypeError(`The \`${n}\` parameter must be a string, got \`${t}\` (${typeof t}).`);
|
|
29513
|
+
}
|
|
29514
|
+
function validateAlphabet(t) {
|
|
29515
|
+
if (typeof t != "string") throw TypeError(`The alphabet must be a string, got \`${t}\` (${typeof t}).`);
|
|
29516
|
+
if (t.length !== BASE) throw TypeError(`The alphabet must be exactly ${BASE} characters long, got ${t.length}.`);
|
|
29517
|
+
let n = new Set(t);
|
|
29518
|
+
if (n.size !== BASE) throw TypeError(`The alphabet must contain ${BASE} unique characters, got ${n.size}.`);
|
|
29519
|
+
}
|
|
29520
|
+
var defaultBase62 = new class {
|
|
29521
|
+
constructor(t = {}) {
|
|
29522
|
+
let n = t.alphabet ?? DEFAULT_ALPHABET;
|
|
29523
|
+
validateAlphabet(n), this.alphabet = [...n], this.indices = new Map(this.alphabet.map((t, n) => [t, n]));
|
|
29524
|
+
}
|
|
29525
|
+
#e(t) {
|
|
29526
|
+
let n = this.indices.get(t);
|
|
29527
|
+
if (n === void 0) throw TypeError(`Unexpected character for Base62 encoding: \`${t}\`.`);
|
|
29528
|
+
return n;
|
|
29529
|
+
}
|
|
29530
|
+
encodeString(t) {
|
|
29531
|
+
return assertString(t, "string"), this.encodeBytes(cachedEncoder.encode(t));
|
|
29532
|
+
}
|
|
29533
|
+
decodeString(t) {
|
|
29534
|
+
return assertString(t, "encodedString"), cachedDecoder.decode(this.decodeBytes(t));
|
|
29535
|
+
}
|
|
29536
|
+
encodeBytes(t) {
|
|
29537
|
+
if (!(t instanceof Uint8Array)) throw TypeError("The `bytes` parameter must be an instance of Uint8Array.");
|
|
29538
|
+
if (t.length === 0) return "";
|
|
29539
|
+
let n = 1n;
|
|
29540
|
+
for (let r of t) n = n << 8n | BigInt(r);
|
|
29541
|
+
return this.encodeBigInt(n);
|
|
29542
|
+
}
|
|
29543
|
+
decodeBytes(t) {
|
|
29544
|
+
if (assertString(t, "encodedString"), t.length === 0) return new Uint8Array();
|
|
29545
|
+
let n = this.decodeBigInt(t), r = [];
|
|
29546
|
+
for (; n > 0n;) r.push(Number(n & 255n)), n >>= 8n;
|
|
29547
|
+
return Uint8Array.from(r.reverse().slice(1));
|
|
29548
|
+
}
|
|
29549
|
+
encodeInteger(t) {
|
|
29550
|
+
if (!Number.isInteger(t)) throw TypeError(`Expected an integer, got \`${t}\` (${typeof t}).`);
|
|
29551
|
+
if (t < 0) throw TypeError("The integer must be non-negative.");
|
|
29552
|
+
if (t === 0) return this.alphabet[0];
|
|
29553
|
+
let n = "";
|
|
29554
|
+
for (; t > 0;) n = this.alphabet[t % BASE] + n, t = Math.floor(t / BASE);
|
|
29555
|
+
return n;
|
|
29556
|
+
}
|
|
29557
|
+
decodeInteger(t) {
|
|
29558
|
+
assertString(t, "encodedString");
|
|
29559
|
+
let n = 0;
|
|
29560
|
+
for (let r of t) n = n * BASE + this.#e(r);
|
|
29561
|
+
return n;
|
|
29562
|
+
}
|
|
29563
|
+
encodeBigInt(t) {
|
|
29564
|
+
if (typeof t != "bigint") throw TypeError(`Expected a bigint, got \`${t}\` (${typeof t}).`);
|
|
29565
|
+
if (t < 0) throw TypeError("The bigint must be non-negative.");
|
|
29566
|
+
if (t === 0n) return this.alphabet[0];
|
|
29567
|
+
let n = "";
|
|
29568
|
+
for (; t > 0n;) n = this.alphabet[Number(t % BASE_BIGINT)] + n, t /= BASE_BIGINT;
|
|
29569
|
+
return n;
|
|
29570
|
+
}
|
|
29571
|
+
decodeBigInt(t) {
|
|
29572
|
+
assertString(t, "encodedString");
|
|
29573
|
+
let n = 0n;
|
|
29574
|
+
for (let r of t) n = n * BASE_BIGINT + BigInt(this.#e(r));
|
|
29575
|
+
return n;
|
|
29576
|
+
}
|
|
29577
|
+
}();
|
|
29578
|
+
const encodeString = (t) => defaultBase62.encodeString(t);
|
|
29579
29579
|
var emscripten_module_browser_default = (() => {
|
|
29580
29580
|
var t = import.meta.url;
|
|
29581
29581
|
return (function(n = {}) {
|
|
@@ -29996,4 +29996,4 @@ var emscripten_module_browser_default = (() => {
|
|
|
29996
29996
|
]), this.QTS_ArgvGetJSValueConstPointer = this.module.cwrap("QTS_ArgvGetJSValueConstPointer", "number", ["number", "number"]), this.QTS_RuntimeEnableInterruptHandler = this.module.cwrap("QTS_RuntimeEnableInterruptHandler", null, ["number"]), this.QTS_RuntimeDisableInterruptHandler = this.module.cwrap("QTS_RuntimeDisableInterruptHandler", null, ["number"]), this.QTS_RuntimeEnableModuleLoader = this.module.cwrap("QTS_RuntimeEnableModuleLoader", null, ["number", "number"]), this.QTS_RuntimeDisableModuleLoader = this.module.cwrap("QTS_RuntimeDisableModuleLoader", null, ["number"]), this.QTS_bjson_encode = this.module.cwrap("QTS_bjson_encode", "number", ["number", "number"]), this.QTS_bjson_decode = this.module.cwrap("QTS_bjson_decode", "number", ["number", "number"]);
|
|
29997
29997
|
}
|
|
29998
29998
|
};
|
|
29999
|
-
export { MapControls_default as C, isEmpty_default as D, isEqual_default as E, cloneDeep_default as O, KeyboardControls_default as S, component_default$8 as T, install$11 as _,
|
|
29999
|
+
export { MapControls_default as C, isEmpty_default as D, isEqual_default as E, cloneDeep_default as O, KeyboardControls_default as S, component_default$8 as T, install$11 as _, getQuickJS as a, registerTheme as b, applyBaseRuntimeOptions as c, install$1 as d, install$2 as f, install$9 as g, install$7 as h, mitt_default as i, capitalize_default as k, applyModuleEvalRuntimeOptions as l, install$6 as m, emscripten_module_browser_default as n, QuickJSModuleCallbacks as o, install$3 as p, encodeString as r, QuickJSWASMModule as s, QuickJSFFI as t, install as u, core_exports as v, OrbitControls_default as w, HTML_default as x, use as y };
|
package/package.json
CHANGED
package/dist/ffi.cu3sfyus.js
DELETED