@cocoar/vue-page-builder 2.19.0 → 3.0.0
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/IDP_INTEGRATION.md +350 -0
- package/README.md +498 -169
- package/dist/BuilderElementCodeDialog-DXGNzleE.js +64 -0
- package/dist/BuilderExpressionDialog-yIfwYgXD.js +61 -0
- package/dist/BuilderLogicPanel-C9urz5Cd.js +68 -0
- package/dist/BuilderPageRootCodeDialog-CQsg_ozW.js +61 -0
- package/dist/CoarPageBuilder.vue.d.ts +71 -1
- package/dist/CoarPageBuilder.vue.d.ts.map +1 -1
- package/dist/CoarPageRenderer.vue.d.ts +36 -1
- package/dist/CoarPageRenderer.vue.d.ts.map +1 -1
- package/dist/PageNode.vue.d.ts +9 -1
- package/dist/PageNode.vue.d.ts.map +1 -1
- package/dist/VisualMarkupInspector-CmAOc-CH.js +54 -0
- package/dist/_plugin-vue_export-helper-BTgDAbhb.js +8 -0
- package/dist/actionValues.d.ts +21 -0
- package/dist/actionValues.d.ts.map +1 -0
- package/dist/assets/pageScriptRuntime.worker-Cll8Lm_I.js +25 -0
- package/dist/builder/BuilderCanvas.vue.d.ts +31 -1
- package/dist/builder/BuilderCanvas.vue.d.ts.map +1 -1
- package/dist/builder/BuilderCanvasNode.vue.d.ts.map +1 -1
- package/dist/builder/BuilderCompositionsPanel.vue.d.ts +3 -0
- package/dist/builder/BuilderCompositionsPanel.vue.d.ts.map +1 -0
- package/dist/builder/BuilderElementCodeDialog.vue.d.ts +14 -0
- package/dist/builder/BuilderElementCodeDialog.vue.d.ts.map +1 -0
- package/dist/builder/BuilderExpressionDialog.vue.d.ts +11 -0
- package/dist/builder/BuilderExpressionDialog.vue.d.ts.map +1 -0
- package/dist/builder/BuilderFxButton.vue.d.ts +28 -0
- package/dist/builder/BuilderFxButton.vue.d.ts.map +1 -0
- package/dist/builder/BuilderLogicPanel.vue.d.ts +3 -0
- package/dist/builder/BuilderLogicPanel.vue.d.ts.map +1 -0
- package/dist/builder/BuilderOutline.vue.d.ts.map +1 -1
- package/dist/builder/BuilderOutlineNode.vue.d.ts.map +1 -1
- package/dist/builder/BuilderPageRootCodeDialog.vue.d.ts +13 -0
- package/dist/builder/BuilderPageRootCodeDialog.vue.d.ts.map +1 -0
- package/dist/builder/BuilderPalette.vue.d.ts +3 -0
- package/dist/builder/BuilderPalette.vue.d.ts.map +1 -0
- package/dist/builder/BuilderPropsPanel.vue.d.ts.map +1 -1
- package/dist/builder/BuilderTranslationsPanel.vue.d.ts +6 -0
- package/dist/builder/BuilderTranslationsPanel.vue.d.ts.map +1 -0
- package/dist/builder/boxSides.d.ts +30 -0
- package/dist/builder/boxSides.d.ts.map +1 -0
- package/dist/builder/builderContext.d.ts +46 -4
- package/dist/builder/builderContext.d.ts.map +1 -1
- package/dist/builder/expressionAuthoring.d.ts +7 -0
- package/dist/builder/expressionAuthoring.d.ts.map +1 -0
- package/dist/builder/nodeDefaults.d.ts +10 -5
- package/dist/builder/nodeDefaults.d.ts.map +1 -1
- package/dist/builder/pageCodeAuthoring.d.ts +11 -0
- package/dist/builder/pageCodeAuthoring.d.ts.map +1 -0
- package/dist/builder/props/ActionPropsEditor.vue.d.ts +9 -0
- package/dist/builder/props/ActionPropsEditor.vue.d.ts.map +1 -0
- package/dist/builder/props/BuilderViewportControl.vue.d.ts +23 -0
- package/dist/builder/props/BuilderViewportControl.vue.d.ts.map +1 -0
- package/dist/builder/props/BuilderZoomControl.vue.d.ts +24 -0
- package/dist/builder/props/BuilderZoomControl.vue.d.ts.map +1 -0
- package/dist/builder/props/CompoundLengthProperty.vue.d.ts +20 -0
- package/dist/builder/props/CompoundLengthProperty.vue.d.ts.map +1 -0
- package/dist/builder/props/StyleProps.vue.d.ts +1 -0
- package/dist/builder/props/StyleProps.vue.d.ts.map +1 -1
- package/dist/builder/schemaMigrateV1.d.ts +7 -0
- package/dist/builder/schemaMigrateV1.d.ts.map +1 -1
- package/dist/builder/schemaNormalize.d.ts.map +1 -1
- package/dist/builder/{useSchemaValidation.d.ts → useAuthoringFindings.d.ts} +8 -8
- package/dist/builder/useAuthoringFindings.d.ts.map +1 -0
- package/dist/builder/useBuilderDnd.d.ts +8 -1
- package/dist/builder/useBuilderDnd.d.ts.map +1 -1
- package/dist/builder/useCanvasZoom.d.ts +50 -0
- package/dist/builder/useCanvasZoom.d.ts.map +1 -0
- package/dist/builder/usePageBuilder.d.ts +2 -0
- package/dist/builder/usePageBuilder.d.ts.map +1 -1
- package/dist/builder/usePageCompositions.d.ts +71 -0
- package/dist/builder/usePageCompositions.d.ts.map +1 -0
- package/dist/builderContext-B3rX2dxZ.js +4 -0
- package/dist/compositions.d.ts +79 -0
- package/dist/compositions.d.ts.map +1 -0
- package/dist/conditions.d.ts +8 -0
- package/dist/conditions.d.ts.map +1 -0
- package/dist/context.d.ts +17 -3
- package/dist/context.d.ts.map +1 -1
- package/dist/documentValidation.d.ts +12 -0
- package/dist/documentValidation.d.ts.map +1 -0
- package/dist/elements/builtins.d.ts.map +1 -1
- package/dist/elements/button/ButtonInspector.vue.d.ts.map +1 -1
- package/dist/elements/button/ButtonRenderer.vue.d.ts.map +1 -1
- package/dist/elements/button/index.d.ts +2 -2
- package/dist/elements/button/index.d.ts.map +1 -1
- package/dist/elements/card/CardInspector.vue.d.ts.map +1 -1
- package/dist/elements/card/index.d.ts.map +1 -1
- package/dist/elements/checkbox/CheckboxDefaultInput.vue.d.ts.map +1 -1
- package/dist/elements/checkbox/CheckboxInspector.vue.d.ts.map +1 -1
- package/dist/elements/checkbox/CheckboxRenderer.vue.d.ts.map +1 -1
- package/dist/elements/checkbox/index.d.ts.map +1 -1
- package/dist/elements/date-input/DateInputDefaultInput.vue.d.ts.map +1 -1
- package/dist/elements/date-input/DateInputInspector.vue.d.ts.map +1 -1
- package/dist/elements/date-input/index.d.ts.map +1 -1
- package/dist/elements/datetime-input/DateTimeInputDefaultInput.vue.d.ts.map +1 -1
- package/dist/elements/datetime-input/DateTimeInputInspector.vue.d.ts.map +1 -1
- package/dist/elements/datetime-input/index.d.ts.map +1 -1
- package/dist/elements/feedback/FeedbackInspector.vue.d.ts +8 -0
- package/dist/elements/feedback/FeedbackInspector.vue.d.ts.map +1 -0
- package/dist/elements/feedback/FeedbackPreview.vue.d.ts +7 -0
- package/dist/elements/feedback/FeedbackPreview.vue.d.ts.map +1 -0
- package/dist/elements/{stack/StackInspector.vue.d.ts → feedback/FeedbackRenderer.vue.d.ts} +3 -4
- package/dist/elements/feedback/FeedbackRenderer.vue.d.ts.map +1 -0
- package/dist/elements/feedback/index.d.ts +6 -0
- package/dist/elements/feedback/index.d.ts.map +1 -0
- package/dist/elements/heading/HeadingInspector.vue.d.ts.map +1 -1
- package/dist/elements/heading/index.d.ts.map +1 -1
- package/dist/elements/image/ImageInspector.vue.d.ts.map +1 -1
- package/dist/elements/image/index.d.ts.map +1 -1
- package/dist/elements/link/LinkInspector.vue.d.ts +1 -1
- package/dist/elements/link/LinkInspector.vue.d.ts.map +1 -1
- package/dist/elements/link/index.d.ts +1 -2
- package/dist/elements/link/index.d.ts.map +1 -1
- package/dist/elements/multi-select/MultiSelectDefaultInput.vue.d.ts.map +1 -1
- package/dist/elements/multi-select/MultiSelectInspector.vue.d.ts.map +1 -1
- package/dist/elements/multi-select/index.d.ts.map +1 -1
- package/dist/elements/note/NoteInspector.vue.d.ts.map +1 -1
- package/dist/elements/number-input/NumberInputDefaultInput.vue.d.ts.map +1 -1
- package/dist/elements/number-input/NumberInputInspector.vue.d.ts.map +1 -1
- package/dist/elements/number-input/index.d.ts.map +1 -1
- package/dist/elements/otp-input/OtpInputInspector.vue.d.ts.map +1 -1
- package/dist/elements/otp-input/index.d.ts.map +1 -1
- package/dist/elements/paragraph/index.d.ts.map +1 -1
- package/dist/elements/password-input/PasswordInputInspector.vue.d.ts.map +1 -1
- package/dist/elements/password-input/index.d.ts.map +1 -1
- package/dist/elements/previewUtils.d.ts.map +1 -1
- package/dist/elements/radio-group/RadioGroupDefaultInput.vue.d.ts.map +1 -1
- package/dist/elements/radio-group/RadioGroupInspector.vue.d.ts.map +1 -1
- package/dist/elements/radio-group/index.d.ts.map +1 -1
- package/dist/elements/registry.d.ts +265 -2
- package/dist/elements/registry.d.ts.map +1 -1
- package/dist/elements/repeat/RepeatInspector.vue.d.ts +8 -0
- package/dist/elements/repeat/RepeatInspector.vue.d.ts.map +1 -0
- package/dist/elements/repeat/RepeatRenderer.vue.d.ts +29 -0
- package/dist/elements/repeat/RepeatRenderer.vue.d.ts.map +1 -0
- package/dist/elements/repeat/index.d.ts +10 -0
- package/dist/elements/repeat/index.d.ts.map +1 -0
- package/dist/elements/section/SectionInspector.vue.d.ts.map +1 -1
- package/dist/elements/section/index.d.ts.map +1 -1
- package/dist/elements/select/SelectDefaultInput.vue.d.ts.map +1 -1
- package/dist/elements/select/SelectInspector.vue.d.ts.map +1 -1
- package/dist/elements/select/index.d.ts.map +1 -1
- package/dist/elements/spacer/SpacerInspector.vue.d.ts.map +1 -1
- package/dist/elements/stack/StackRenderer.vue.d.ts.map +1 -1
- package/dist/elements/stack/index.d.ts.map +1 -1
- package/dist/elements/switch/SwitchDefaultInput.vue.d.ts.map +1 -1
- package/dist/elements/switch/SwitchInspector.vue.d.ts.map +1 -1
- package/dist/elements/switch/index.d.ts.map +1 -1
- package/dist/elements/text-input/TextInputInspector.vue.d.ts.map +1 -1
- package/dist/elements/text-input/index.d.ts.map +1 -1
- package/dist/elements/usePageElement.d.ts +6 -2
- package/dist/elements/usePageElement.d.ts.map +1 -1
- package/dist/elements/visual-markup/VisualMarkupInspector.vue.d.ts +10 -0
- package/dist/elements/visual-markup/VisualMarkupInspector.vue.d.ts.map +1 -0
- package/dist/elements/visual-markup/VisualMarkupPreview.vue.d.ts +7 -0
- package/dist/elements/visual-markup/VisualMarkupPreview.vue.d.ts.map +1 -0
- package/dist/elements/visual-markup/VisualMarkupRenderer.vue.d.ts +7 -0
- package/dist/elements/visual-markup/VisualMarkupRenderer.vue.d.ts.map +1 -0
- package/dist/elements/visual-markup/index.d.ts +6 -0
- package/dist/elements/visual-markup/index.d.ts.map +1 -0
- package/dist/elements/visual-markup/visualDocument.d.ts +13 -0
- package/dist/elements/visual-markup/visualDocument.d.ts.map +1 -0
- package/dist/expressionAuthoring-7iAyadA3.js +74 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +32 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8571 -3448
- package/dist/pageCode-echPQdna.js +455 -0
- package/dist/pageCode.d.ts +101 -0
- package/dist/pageCode.d.ts.map +1 -0
- package/dist/pageCodeAuthoring-C8grEAUf.js +123 -0
- package/dist/responsive.d.ts +7 -0
- package/dist/responsive.d.ts.map +1 -0
- package/dist/runtime/PageRuntimeHost.d.ts +57 -0
- package/dist/runtime/PageRuntimeHost.d.ts.map +1 -0
- package/dist/runtime/PageScriptRuntime.d.ts +62 -0
- package/dist/runtime/PageScriptRuntime.d.ts.map +1 -0
- package/dist/runtime/pageScriptRuntime.worker.d.ts +1 -0
- package/dist/runtime/pageScriptRuntime.worker.d.ts.map +1 -0
- package/dist/runtime/runtimeProtocol.d.ts +150 -0
- package/dist/runtime/runtimeProtocol.d.ts.map +1 -0
- package/dist/runtime/usePageCodeRuntime.d.ts +32 -0
- package/dist/runtime/usePageCodeRuntime.d.ts.map +1 -0
- package/dist/runtime-worker.js +240 -0
- package/dist/runtimeBindings.d.ts +32 -0
- package/dist/runtimeBindings.d.ts.map +1 -0
- package/dist/runtimeExpressions.d.ts +16 -0
- package/dist/runtimeExpressions.d.ts.map +1 -0
- package/dist/runtimeProtocol-Bg1C-O0c.js +36 -0
- package/dist/runtimeWorkerEntry.d.ts +2 -0
- package/dist/runtimeWorkerEntry.d.ts.map +1 -0
- package/dist/schema.d.ts +298 -31
- package/dist/schema.d.ts.map +1 -1
- package/dist/styleMapping.d.ts +7 -0
- package/dist/styleMapping.d.ts.map +1 -1
- package/dist/translations.d.ts +8 -0
- package/dist/translations.d.ts.map +1 -0
- package/dist/visualDocument-DKjWBfpW.js +139 -0
- package/package.json +24 -6
- package/dist/builder/useSchemaValidation.d.ts.map +0 -1
- package/dist/elements/stack/StackInspector.vue.d.ts.map +0 -1
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { t as e } from "./runtimeProtocol-Bg1C-O0c.js";
|
|
2
|
+
//#region src/runtime/PageScriptRuntime.ts
|
|
3
|
+
var t = Symbol("page-runtime-contextual-endowment-method");
|
|
4
|
+
function n(e) {
|
|
5
|
+
return Object.freeze({
|
|
6
|
+
[t]: !0,
|
|
7
|
+
invoke: e
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
var r = new Set([
|
|
11
|
+
"__proto__",
|
|
12
|
+
"prototype",
|
|
13
|
+
"constructor"
|
|
14
|
+
]);
|
|
15
|
+
function i(e) {
|
|
16
|
+
return !!e && typeof e == "object" && e[t] === !0;
|
|
17
|
+
}
|
|
18
|
+
function a(t, n) {
|
|
19
|
+
if (!t || r.has(t) || Array.isArray(n)) throw Error(`Host endowment "${t}" is invalid.`);
|
|
20
|
+
let a = /* @__PURE__ */ new Set(), o = Object.create(null), s = Object.getPrototypeOf(n), c = s === Object.prototype || s === null;
|
|
21
|
+
for (let t of Object.keys(n)) {
|
|
22
|
+
if (r.has(t)) continue;
|
|
23
|
+
let s = Reflect.get(n, t, n);
|
|
24
|
+
typeof s == "function" || i(s) ? a.add(t) : c && (o[t] = e(s));
|
|
25
|
+
}
|
|
26
|
+
let l = s;
|
|
27
|
+
for (; l && l !== Object.prototype;) {
|
|
28
|
+
for (let e of Object.getOwnPropertyNames(l)) r.has(e) || typeof Object.getOwnPropertyDescriptor(l, e)?.value == "function" && a.add(e);
|
|
29
|
+
l = Object.getPrototypeOf(l);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
name: t,
|
|
33
|
+
methods: [...a],
|
|
34
|
+
values: o
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
var o = class {
|
|
38
|
+
worker;
|
|
39
|
+
endowments;
|
|
40
|
+
context;
|
|
41
|
+
pending = /* @__PURE__ */ new Map();
|
|
42
|
+
endowmentCalls = /* @__PURE__ */ new Map();
|
|
43
|
+
listeners = /* @__PURE__ */ new Set();
|
|
44
|
+
resourceTimeouts = /* @__PURE__ */ new Map();
|
|
45
|
+
resourceTimeoutHandles = /* @__PURE__ */ new Map();
|
|
46
|
+
workerStarted = performance.now();
|
|
47
|
+
nextRequestId = 1;
|
|
48
|
+
stopped = !1;
|
|
49
|
+
resolveBootstrap;
|
|
50
|
+
rejectBootstrap;
|
|
51
|
+
bootstrap;
|
|
52
|
+
get isAvailable() {
|
|
53
|
+
return !this.stopped;
|
|
54
|
+
}
|
|
55
|
+
constructor(e = {}, t = {
|
|
56
|
+
sessionId: "standalone",
|
|
57
|
+
pageId: "standalone"
|
|
58
|
+
}) {
|
|
59
|
+
this.endowments = e, this.context = t, this.bootstrap = new Promise((e, t) => {
|
|
60
|
+
this.resolveBootstrap = e, this.rejectBootstrap = t;
|
|
61
|
+
}), this.worker = new Worker(new URL("./assets/pageScriptRuntime.worker-Cll8Lm_I.js", import.meta.url), {
|
|
62
|
+
name: "page-script-runtime",
|
|
63
|
+
type: "module"
|
|
64
|
+
}), this.worker.addEventListener("message", (e) => {
|
|
65
|
+
this.onMessage(e.data);
|
|
66
|
+
}), this.worker.addEventListener("error", (e) => {
|
|
67
|
+
this.terminate(e.message || "The script worker failed.");
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async initialize(e, t = {}) {
|
|
71
|
+
await this.bootstrap, this.resourceTimeouts.clear();
|
|
72
|
+
for (let t of e) t.kind === "resource" && this.resourceTimeouts.set(t.id, Math.max(1, t.timeoutMs ?? 1e4));
|
|
73
|
+
let n = Object.entries(this.endowments).map(([e, t]) => a(e, t));
|
|
74
|
+
return this.request((r) => ({
|
|
75
|
+
type: "initialize",
|
|
76
|
+
requestId: r,
|
|
77
|
+
definitions: e,
|
|
78
|
+
endowments: n,
|
|
79
|
+
endowmentGrants: Object.fromEntries(Object.entries(t).map(([e, t]) => [e, [...t]]))
|
|
80
|
+
}), 2e3);
|
|
81
|
+
}
|
|
82
|
+
invoke(t, n, r = 1e3) {
|
|
83
|
+
return this.request((r) => ({
|
|
84
|
+
type: "invoke",
|
|
85
|
+
requestId: r,
|
|
86
|
+
scriptId: t,
|
|
87
|
+
input: e(n)
|
|
88
|
+
}), r);
|
|
89
|
+
}
|
|
90
|
+
setState(t, n = 1e3) {
|
|
91
|
+
return this.request((n) => ({
|
|
92
|
+
type: "set-state",
|
|
93
|
+
requestId: n,
|
|
94
|
+
state: e(t)
|
|
95
|
+
}), n);
|
|
96
|
+
}
|
|
97
|
+
patchState(t, n = 1e3) {
|
|
98
|
+
let r = t.map((t) => ({
|
|
99
|
+
op: t.op,
|
|
100
|
+
path: [...t.path],
|
|
101
|
+
...t.op === "set" ? { value: e(t.value) } : {}
|
|
102
|
+
}));
|
|
103
|
+
return this.request((e) => ({
|
|
104
|
+
type: "patch-state",
|
|
105
|
+
requestId: e,
|
|
106
|
+
patches: r
|
|
107
|
+
}), n);
|
|
108
|
+
}
|
|
109
|
+
subscribe(e) {
|
|
110
|
+
return this.listeners.add(e), () => this.listeners.delete(e);
|
|
111
|
+
}
|
|
112
|
+
cancelResource(e) {
|
|
113
|
+
this.clearResourceTimeout(e), this.stopped || this.worker.postMessage({
|
|
114
|
+
type: "cancel-resource",
|
|
115
|
+
resourceId: e
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
terminate(e = "Script runtime terminated.") {
|
|
119
|
+
if (!this.stopped) {
|
|
120
|
+
this.stopped = !0, this.worker.terminate();
|
|
121
|
+
for (let t of this.endowmentCalls.values()) t.abort(e);
|
|
122
|
+
this.endowmentCalls.clear();
|
|
123
|
+
for (let e of this.resourceTimeoutHandles.values()) clearTimeout(e);
|
|
124
|
+
this.resourceTimeoutHandles.clear(), this.failAll(Error(e));
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
request(e, t) {
|
|
128
|
+
if (this.stopped) return Promise.reject(/* @__PURE__ */ Error("Script runtime is not available."));
|
|
129
|
+
let n = this.nextRequestId++;
|
|
130
|
+
return new Promise((r, i) => {
|
|
131
|
+
let a = setTimeout(() => {
|
|
132
|
+
this.pending.delete(n), this.terminate(`Script runtime exceeded its ${t} ms limit.`), i(/* @__PURE__ */ Error(`Script runtime exceeded its ${t} ms limit.`));
|
|
133
|
+
}, t);
|
|
134
|
+
this.pending.set(n, {
|
|
135
|
+
resolve: r,
|
|
136
|
+
reject: i,
|
|
137
|
+
timeout: a
|
|
138
|
+
}), this.worker.postMessage(e(n));
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
settle(e, t, n) {
|
|
142
|
+
let r = this.pending.get(e);
|
|
143
|
+
r && (this.pending.delete(e), clearTimeout(r.timeout), n ? r.reject(Error(n)) : r.resolve(t));
|
|
144
|
+
}
|
|
145
|
+
startResourceTimeout(e) {
|
|
146
|
+
this.clearResourceTimeout(e);
|
|
147
|
+
let t = this.resourceTimeouts.get(e);
|
|
148
|
+
t && this.resourceTimeoutHandles.set(e, setTimeout(() => {
|
|
149
|
+
this.resourceTimeoutHandles.delete(e), this.terminate(`Async resource "${e}" exceeded its ${t} ms limit.`);
|
|
150
|
+
}, t));
|
|
151
|
+
}
|
|
152
|
+
clearResourceTimeout(e) {
|
|
153
|
+
let t = this.resourceTimeoutHandles.get(e);
|
|
154
|
+
t && clearTimeout(t), this.resourceTimeoutHandles.delete(e);
|
|
155
|
+
}
|
|
156
|
+
publishReactiveUpdate(e) {
|
|
157
|
+
e.kind === "resource" && (e.state.status === "pending" ? this.startResourceTimeout(e.id) : this.clearResourceTimeout(e.id));
|
|
158
|
+
for (let t of this.listeners) t(e);
|
|
159
|
+
}
|
|
160
|
+
async onMessage(t) {
|
|
161
|
+
if (t.type === "worker-ready") {
|
|
162
|
+
this.resolveBootstrap({
|
|
163
|
+
workerBootstrapMs: performance.now() - this.workerStarted,
|
|
164
|
+
lockdownMs: t.lockdownMs
|
|
165
|
+
});
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
if (t.type === "initialized") {
|
|
169
|
+
this.settle(t.requestId, t.metrics);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
if (t.type === "state-updated") {
|
|
173
|
+
this.settle(t.requestId, t.metrics);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
if (t.type === "result") {
|
|
177
|
+
this.settle(t.requestId, {
|
|
178
|
+
value: t.value,
|
|
179
|
+
durationMs: t.durationMs
|
|
180
|
+
});
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
if (t.type === "failure") {
|
|
184
|
+
this.settle(t.requestId, void 0, t.error);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (t.type === "reactive-update") {
|
|
188
|
+
this.publishReactiveUpdate(t.update);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (t.type === "endowment-cancel") {
|
|
192
|
+
let e = this.endowmentCalls.get(t.callId);
|
|
193
|
+
e && e.abort("Host endowment call was superseded."), this.endowmentCalls.delete(t.callId);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
let n = this.endowments[t.endowment], r = n && Reflect.get(n, t.method, n);
|
|
197
|
+
if (typeof r != "function" && !i(r)) {
|
|
198
|
+
this.worker.postMessage({
|
|
199
|
+
type: "endowment-result",
|
|
200
|
+
callId: t.callId,
|
|
201
|
+
ok: !1,
|
|
202
|
+
error: `Host endowment method "${t.endowment}.${t.method}" is not available.`
|
|
203
|
+
});
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
let a = new AbortController();
|
|
207
|
+
this.endowmentCalls.set(t.callId, a);
|
|
208
|
+
try {
|
|
209
|
+
let o = {
|
|
210
|
+
signal: a.signal,
|
|
211
|
+
definitionId: t.definitionId,
|
|
212
|
+
sessionId: this.context.sessionId,
|
|
213
|
+
pageId: this.context.pageId,
|
|
214
|
+
tenantId: this.context.tenantId
|
|
215
|
+
}, s = i(r) ? await r.invoke(o, ...t.args) : await Reflect.apply(r, n, t.args);
|
|
216
|
+
if (this.endowmentCalls.get(t.callId) !== a) return;
|
|
217
|
+
this.endowmentCalls.delete(t.callId), this.worker.postMessage({
|
|
218
|
+
type: "endowment-result",
|
|
219
|
+
callId: t.callId,
|
|
220
|
+
ok: !0,
|
|
221
|
+
value: e(s)
|
|
222
|
+
});
|
|
223
|
+
} catch (e) {
|
|
224
|
+
if (this.endowmentCalls.get(t.callId) !== a) return;
|
|
225
|
+
this.endowmentCalls.delete(t.callId), this.worker.postMessage({
|
|
226
|
+
type: "endowment-result",
|
|
227
|
+
callId: t.callId,
|
|
228
|
+
ok: !1,
|
|
229
|
+
error: e instanceof Error ? e.message : String(e)
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
failAll(e) {
|
|
234
|
+
this.rejectBootstrap(e);
|
|
235
|
+
for (let t of this.pending.values()) clearTimeout(t.timeout), t.reject(e);
|
|
236
|
+
this.pending.clear();
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
//#endregion
|
|
240
|
+
export { o as PageScriptRuntime, n as withRuntimeEndowmentContext };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { PageConfig, PageContextValueType, PageNode, PropertyBinding, RuntimeBinding, RuntimeExpressionBinding, RuntimeExpressionValues, PageTranslations } from './schema';
|
|
2
|
+
export declare function safeReadPath(value: unknown, path: string): unknown;
|
|
3
|
+
export declare function matchesContextType(value: unknown, type: PageContextValueType): boolean;
|
|
4
|
+
export declare function readAllowedContext(context: Record<string, unknown> | undefined, config: PageConfig | undefined, path: string): unknown;
|
|
5
|
+
export declare function resolveLocalizedValue(value: unknown, locale: string | undefined, defaultLocale: string | undefined): unknown;
|
|
6
|
+
export declare function isExpressionBinding(binding: PropertyBinding): binding is RuntimeExpressionBinding;
|
|
7
|
+
/** Missing means enabled for backwards compatibility with existing documents. */
|
|
8
|
+
export declare function isExpressionBindingEnabled(binding: RuntimeExpressionBinding): boolean;
|
|
9
|
+
/** Stable transport key shared by authoring, host runtime and renderer. */
|
|
10
|
+
export declare function runtimeExpressionKey(nodeId: string, target: string): string;
|
|
11
|
+
export interface RuntimeResolutionContext {
|
|
12
|
+
config?: PageConfig;
|
|
13
|
+
context?: Record<string, unknown>;
|
|
14
|
+
/** Customer-authored `definePageState` value. */
|
|
15
|
+
pageState?: Readonly<Record<string, unknown>>;
|
|
16
|
+
/** Host-controlled view-state ID; used by conditions/scripts, not `source: state`. */
|
|
17
|
+
locale?: string;
|
|
18
|
+
item?: unknown;
|
|
19
|
+
itemIndex?: number;
|
|
20
|
+
allowedItemPaths?: ReadonlySet<string>;
|
|
21
|
+
fields?: Readonly<Record<string, unknown>>;
|
|
22
|
+
selectionNames?: ReadonlySet<string>;
|
|
23
|
+
expressionValues?: RuntimeExpressionValues;
|
|
24
|
+
translations?: PageTranslations;
|
|
25
|
+
hostTranslation?: (locale: string, key: string) => string | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare function resolveRuntimeBinding(binding: RuntimeBinding, runtime: RuntimeResolutionContext): unknown;
|
|
28
|
+
export declare function resolvePropertyBinding(binding: PropertyBinding, runtime: RuntimeResolutionContext): unknown;
|
|
29
|
+
export declare function resolveNodeRuntime(node: PageNode, runtime: RuntimeResolutionContext): PageNode;
|
|
30
|
+
/** Applies only allowlisted `style.*` expression results over responsive/static style. */
|
|
31
|
+
export declare function resolveExpressionStyle(node: PageNode, staticStyle: PageNode['style'], expressionValues?: RuntimeExpressionValues): PageNode['style'];
|
|
32
|
+
//# sourceMappingURL=runtimeBindings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeBindings.d.ts","sourceRoot":"","sources":["../src/runtimeBindings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,UAAU,EACV,oBAAoB,EACpB,QAAQ,EACR,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,uBAAuB,EAEvB,gBAAgB,EACjB,MAAM,UAAU,CAAA;AAMjB,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CASlE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAMtF;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC5C,MAAM,EAAE,UAAU,GAAG,SAAS,EAC9B,IAAI,EAAE,MAAM,GACX,OAAO,CAKT;AAOD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,OAAO,EACd,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,OAAO,CAOT;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,IAAI,wBAAwB,CAEjG;AAED,iFAAiF;AACjF,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAErF;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,MAAM,WAAW,wBAAwB;IACvC,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACjC,iDAAiD;IACjD,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAC7C,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACtC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IAC1C,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACpC,gBAAgB,CAAC,EAAE,uBAAuB,CAAA;IAC1C,YAAY,CAAC,EAAE,gBAAgB,CAAA;IAC/B,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;CACtE;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAsBzG;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,wBAAwB,GAAG,OAAO,CA4B3G;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,wBAAwB,GAAG,QAAQ,CA4C9F;AAUD,0FAA0F;AAC1F,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,QAAQ,CAAC,OAAO,CAAC,EAC9B,gBAAgB,CAAC,EAAE,uBAAuB,GACzC,QAAQ,CAAC,OAAO,CAAC,CAYnB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { PageNode, RuntimeExpressionBinding } from './schema';
|
|
2
|
+
export interface PageRuntimeExpressionDefinition {
|
|
3
|
+
id: string;
|
|
4
|
+
nodeId: string;
|
|
5
|
+
target: string;
|
|
6
|
+
expression: string;
|
|
7
|
+
}
|
|
8
|
+
/** Collects persisted expressions without compiling or evaluating tenant code. */
|
|
9
|
+
export declare function collectPageRuntimeExpressions(schema: PageNode): PageRuntimeExpressionDefinition[];
|
|
10
|
+
/**
|
|
11
|
+
* Wraps one authored JavaScript expression in the pure binding function shape
|
|
12
|
+
* consumed by the SES runtime. The newline prevents a trailing line comment
|
|
13
|
+
* in user source from swallowing the closing parenthesis.
|
|
14
|
+
*/
|
|
15
|
+
export declare function pageRuntimeExpressionSource(binding: Pick<RuntimeExpressionBinding, 'expression'>): string;
|
|
16
|
+
//# sourceMappingURL=runtimeExpressions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeExpressions.d.ts","sourceRoot":"","sources":["../src/runtimeExpressions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,QAAQ,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAA;AAG/E,MAAM,WAAW,+BAA+B;IAC9C,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,kFAAkF;AAClF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,QAAQ,GAAG,+BAA+B,EAAE,CAkBjG;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,IAAI,CAAC,wBAAwB,EAAE,YAAY,CAAC,GAAG,MAAM,CAEzG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
//#region src/runtime/runtimeProtocol.ts
|
|
2
|
+
var e = new Set([
|
|
3
|
+
"__proto__",
|
|
4
|
+
"prototype",
|
|
5
|
+
"constructor"
|
|
6
|
+
]), t = 1e4, n = 32, r = 2e6;
|
|
7
|
+
function i(i) {
|
|
8
|
+
let a = /* @__PURE__ */ new WeakSet(), o = 0, s = 0, c = (e) => {
|
|
9
|
+
if (s += e.length * 2, s > r) throw Error("Runtime value exceeds the byte limit.");
|
|
10
|
+
}, l = (r, i) => {
|
|
11
|
+
if (o += 1, o > t) throw Error("Runtime value exceeds the node limit.");
|
|
12
|
+
if (i > n) throw Error("Runtime value exceeds the depth limit.");
|
|
13
|
+
if (r == null || typeof r == "boolean" || typeof r == "string") return typeof r == "string" && c(r), r;
|
|
14
|
+
if (typeof r == "number") {
|
|
15
|
+
if (!Number.isFinite(r)) throw Error("Runtime value contains a non-finite number.");
|
|
16
|
+
return r;
|
|
17
|
+
}
|
|
18
|
+
if (typeof r != "object") throw Error(`Runtime value contains unsupported type "${typeof r}".`);
|
|
19
|
+
if (a.has(r)) throw Error("Runtime value contains a cycle.");
|
|
20
|
+
if (a.add(r), Array.isArray(r)) {
|
|
21
|
+
let e = r.map((e) => l(e, i + 1));
|
|
22
|
+
return a.delete(r), e;
|
|
23
|
+
}
|
|
24
|
+
let s = Object.getPrototypeOf(r);
|
|
25
|
+
if (s !== Object.prototype && s !== null) throw Error("Runtime value must contain plain objects only.");
|
|
26
|
+
let u = Object.create(null);
|
|
27
|
+
for (let [t, n] of Object.entries(r)) {
|
|
28
|
+
if (e.has(t)) throw Error(`Runtime value contains forbidden key "${t}".`);
|
|
29
|
+
c(t), u[t] = l(n, i + 1);
|
|
30
|
+
}
|
|
31
|
+
return a.delete(r), u;
|
|
32
|
+
};
|
|
33
|
+
return l(i, 0);
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as t };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { PageScriptRuntime, withRuntimeEndowmentContext, type ContextualRuntimeEndowmentMethod, type ContextualRuntimeEndowmentMethodHandler, type PageScriptRuntimeContext, type RuntimeEndowmentContext, type RuntimeEndowmentObject, type RuntimeEndowments, type RuntimeInvocation, } from './runtime/PageScriptRuntime';
|
|
2
|
+
//# sourceMappingURL=runtimeWorkerEntry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtimeWorkerEntry.d.ts","sourceRoot":"","sources":["../src/runtimeWorkerEntry.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,2BAA2B,EAC3B,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,EAC5C,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,6BAA6B,CAAA"}
|