x-runtime-lib 0.8.195 → 0.8.196
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/index.js +35 -52
- package/dist/types/data.d.ts +1 -1
- package/dist/types/kind.d.ts +1 -0
- package/dist/utils/unifiedId.d.ts +6 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10150,29 +10150,6 @@ function provideNode(e) {
|
|
|
10150
10150
|
function injectNode() {
|
|
10151
10151
|
return inject(nodeKey);
|
|
10152
10152
|
}
|
|
10153
|
-
async function triggerReactivity(e, p, m, g, _) {
|
|
10154
|
-
await triggerWatchEffect(e, p, m), await triggerBind(e, p, m, g, _);
|
|
10155
|
-
}
|
|
10156
|
-
async function triggerWatchEffect(e, p, m) {
|
|
10157
|
-
let { watchEffect: g } = p;
|
|
10158
|
-
if (g[m]) for (let p of g[m]) {
|
|
10159
|
-
let m = encodeString(p);
|
|
10160
|
-
await e.callFunctionAsync(`__watchEffect$${m}__`);
|
|
10161
|
-
}
|
|
10162
|
-
}
|
|
10163
|
-
async function triggerBind(e, p, m, _, v) {
|
|
10164
|
-
let { bind: y } = p;
|
|
10165
|
-
if (isEqual_default(_, v)) return;
|
|
10166
|
-
let b = y.triggers[m];
|
|
10167
|
-
if (b) for (let p of b) {
|
|
10168
|
-
let m = y.sets[p];
|
|
10169
|
-
if (m) for (let p of m) p.type === "property" ? await e.setProperty(p.propertyId, _) : p.type === "state" ? await e.setState(p.stateId, _) : console.assert(!1, "not implemented trigger type");
|
|
10170
|
-
}
|
|
10171
|
-
}
|
|
10172
|
-
function getImplementMethodName(e, p, m) {
|
|
10173
|
-
let g = [e, p], _ = m.split(".");
|
|
10174
|
-
return _.length > 1 ? g.push(..._.slice(1)) : g.push(m), `__implementMethod$${g.join("$")}__`;
|
|
10175
|
-
}
|
|
10176
10153
|
function makePropertyId(e, p, m) {
|
|
10177
10154
|
return `${e}/${p}/${m}`;
|
|
10178
10155
|
}
|
|
@@ -10293,30 +10270,42 @@ function unwrapSlotId(e) {
|
|
|
10293
10270
|
slotKey: p[2]
|
|
10294
10271
|
};
|
|
10295
10272
|
}
|
|
10296
|
-
function makeTriggerId(e) {
|
|
10297
|
-
|
|
10298
|
-
if (e.type === "property") p.push(e.propertyId);
|
|
10299
|
-
else if (e.type === "state") p.push(e.stateId);
|
|
10300
|
-
else throw Error("not implemented trigger type");
|
|
10301
|
-
return p.join("@");
|
|
10273
|
+
function makeTriggerId(e, p) {
|
|
10274
|
+
return `${e}@${p}`;
|
|
10302
10275
|
}
|
|
10303
10276
|
function unwrapTriggerId(e) {
|
|
10304
10277
|
let p = e.split("@");
|
|
10305
|
-
if (p.length
|
|
10306
|
-
|
|
10307
|
-
|
|
10308
|
-
|
|
10309
|
-
|
|
10310
|
-
|
|
10311
|
-
|
|
10312
|
-
|
|
10313
|
-
|
|
10314
|
-
|
|
10315
|
-
|
|
10316
|
-
|
|
10317
|
-
|
|
10318
|
-
};
|
|
10319
|
-
}
|
|
10278
|
+
if (p.length !== 2) throw Error("unwrap trigger id failed");
|
|
10279
|
+
return {
|
|
10280
|
+
kind: p[0],
|
|
10281
|
+
triggerKey: p[1]
|
|
10282
|
+
};
|
|
10283
|
+
}
|
|
10284
|
+
async function triggerReactivity(e, p, m, g, _) {
|
|
10285
|
+
await triggerWatchEffect(e, p, m), await triggerBind(e, p, m, g, _);
|
|
10286
|
+
}
|
|
10287
|
+
async function triggerWatchEffect(e, p, m) {
|
|
10288
|
+
let { watchEffect: g } = p;
|
|
10289
|
+
if (g[m]) for (let p of g[m]) {
|
|
10290
|
+
let m = encodeString(p);
|
|
10291
|
+
await e.callFunctionAsync(`__watchEffect$${m}__`);
|
|
10292
|
+
}
|
|
10293
|
+
}
|
|
10294
|
+
async function triggerBind(e, p, m, _, v) {
|
|
10295
|
+
let { bind: y } = p;
|
|
10296
|
+
if (isEqual_default(_, v)) return;
|
|
10297
|
+
let b = y.triggers[m];
|
|
10298
|
+
if (b) for (let p of b) {
|
|
10299
|
+
let m = y.sets[p];
|
|
10300
|
+
if (m) for (let p of m) {
|
|
10301
|
+
let { kind: m, triggerKey: g } = unwrapTriggerId(p);
|
|
10302
|
+
m === "propertyTrigger" ? await e.setProperty(g, _) : m === "stateTrigger" ? await e.setState(g, _) : console.assert(!1);
|
|
10303
|
+
}
|
|
10304
|
+
}
|
|
10305
|
+
}
|
|
10306
|
+
function getImplementMethodName(e, p, m) {
|
|
10307
|
+
let g = [e, p], _ = m.split(".");
|
|
10308
|
+
return _.length > 1 ? g.push(..._.slice(1)) : g.push(m), `__implementMethod$${g.join("$")}__`;
|
|
10320
10309
|
}
|
|
10321
10310
|
function useDepend(e, p, m) {
|
|
10322
10311
|
let g = injectDepends(), v = ref(-1), y = ref(-1);
|
|
@@ -11055,10 +11044,7 @@ function useSandbox(e, p, m, _, v, y, b, x) {
|
|
|
11055
11044
|
async function N(e, p, m, _) {
|
|
11056
11045
|
if (!k.vm) return;
|
|
11057
11046
|
let { kind: v, nodeId: y, propertyKey: x } = unwrapPropertyId(e);
|
|
11058
|
-
if (await k.triggerEvent(makeEventId(`${v}ChangeEvent`, y, x), _ ?? "", p, m), b.value?.code.reactivity && triggerReactivity(k, b.value.code.reactivity, makeTriggerId({
|
|
11059
|
-
type: "property",
|
|
11060
|
-
propertyId: e
|
|
11061
|
-
}), p, m), v === "elementProperty") {
|
|
11047
|
+
if (await k.triggerEvent(makeEventId(`${v}ChangeEvent`, y, x), _ ?? "", p, m), b.value?.code.reactivity && triggerReactivity(k, b.value.code.reactivity, makeTriggerId("propertyTrigger", e), p, m), v === "elementProperty") {
|
|
11062
11048
|
if (isEqual_default(x, toDotString(["settings", "slot"]))) {
|
|
11063
11049
|
let e = b.value?.view.nodeLites.find((e) => e.id === y);
|
|
11064
11050
|
e ? e.slotId = p : console.assert(!1);
|
|
@@ -11070,10 +11056,7 @@ function useSandbox(e, p, m, _, v, y, b, x) {
|
|
|
11070
11056
|
}
|
|
11071
11057
|
}
|
|
11072
11058
|
async function P(e, p, m) {
|
|
11073
|
-
k.vm && (await k.triggerEvent(makeEventId("stateChangeEvent", "globality", e), "", p, m), b.value?.code.reactivity && triggerReactivity(k, b.value.code.reactivity, makeTriggerId(
|
|
11074
|
-
type: "state",
|
|
11075
|
-
stateId: e
|
|
11076
|
-
}), p, m));
|
|
11059
|
+
k.vm && (await k.triggerEvent(makeEventId("stateChangeEvent", "globality", e), "", p, m), b.value?.code.reactivity && triggerReactivity(k, b.value.code.reactivity, makeTriggerId("stateTrigger", e), p, m));
|
|
11077
11060
|
}
|
|
11078
11061
|
watch(E, async (e, p) => {
|
|
11079
11062
|
if (!k.vm) return;
|
package/dist/types/data.d.ts
CHANGED
package/dist/types/kind.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export type SlotKind = 'elementSlot' | 'multipleElementSlot' | 'customSlot' | 'm
|
|
|
3
3
|
export type PropertyKind = 'elementProperty' | 'elementSlotProperty' | 'multipleElementSlotProperty' | 'refProperty' | 'multipleRefProperty' | 'customSlotProperty' | 'multipleCustomSlotProperty' | 'customProperty' | 'elementAdaptSlotProperty' | 'customAdaptSlotProperty';
|
|
4
4
|
export type MethodKind = 'elementMethod' | 'elementSlotMethod' | 'multipeElementSlotMethod' | 'refMethod' | 'multipleRefMethod' | 'customSlotMethod' | 'multipleCustomSlotMethod' | 'customMethod' | 'elementAdaptSlotMethod' | 'customAdaptSlotMethod';
|
|
5
5
|
export type EventKind = 'elementEvent' | 'elementPropertyChangeEvent' | 'elementSlotEvent' | 'elementSlotPropertyChangeEvent' | 'multipleElementSlotEvent' | 'multipleElementSlotPropertyChangeEvent' | 'refEvent' | 'refPropertyChangeEvent' | 'multipleRefEvent' | 'multipleRefPropertyChangeEvent' | 'customSlotEvent' | 'customSlotPropertyChangeEvent' | 'multipleCustomSlotEvent' | 'multipleCustomSlotPropertyChangeEvent' | 'customEvent' | 'customPropertyChangeEvent' | 'elementAdaptSlotEvent' | 'elementAdaptSlotPropertyChangeEvent' | 'customAdaptSlotEvent' | 'customAdaptSlotPropertyChangeEvent' | 'stateChangeEvent';
|
|
6
|
+
export type TriggerKind = 'propertyTrigger' | 'stateTrigger';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EventKind, MethodKind, PropertyKind, SlotKind,
|
|
1
|
+
import { EventKind, MethodKind, PropertyKind, SlotKind, TriggerKind } from '@/types';
|
|
2
2
|
export declare function makePropertyId(kind: PropertyKind, nodeId: string, propertyKey: string): string;
|
|
3
3
|
export declare function unwrapPropertyId(id: string): {
|
|
4
4
|
kind: PropertyKind;
|
|
@@ -59,5 +59,8 @@ export declare function unwrapSlotId(id: string): {
|
|
|
59
59
|
mainKey: string;
|
|
60
60
|
slotKey: string;
|
|
61
61
|
};
|
|
62
|
-
export declare function makeTriggerId(
|
|
63
|
-
export declare function unwrapTriggerId(id: string):
|
|
62
|
+
export declare function makeTriggerId(kind: TriggerKind, triggerKey: string): string;
|
|
63
|
+
export declare function unwrapTriggerId(id: string): {
|
|
64
|
+
kind: TriggerKind;
|
|
65
|
+
triggerKey: string;
|
|
66
|
+
};
|