@jxsuite/studio 5.0.0 → 5.1.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/dist/chunks/{cf-account-picker-fyf63pmy.js → cf-account-picker-qwkm9zrf.js} +5 -5
- package/dist/chunks/{components-2w1f35qs.js → components-vj72gqtq.js} +6 -4
- package/dist/chunks/{content-source-3wqeas45.js → content-source-5mex4x1h.js} +20 -20
- package/dist/chunks/{convert-to-repeater-d0cgnb6d.js → convert-to-repeater-n64h8znc.js} +20 -20
- package/dist/chunks/entry-commands-234hjnqw.js +42 -0
- package/dist/chunks/{extension-sections-fy7q4fe9.js → extension-sections-3hpcambp.js} +22 -22
- package/dist/chunks/{file-ops-3btj6st0.js → file-ops-8yhd83xr.js} +19 -19
- package/dist/chunks/{files-ef8fgs3w.js → files-hnxqxtsg.js} +26 -26
- package/dist/chunks/{format-host-3c33nwr8.js → format-host-779sfp2n.js} +2 -2
- package/dist/chunks/{fs-events-13tj6sex.js → fs-events-b88z7g4h.js} +4 -4
- package/dist/chunks/{git-panel-4wp2rn9b.js → git-panel-xwj8fpab.js} +18 -18
- package/dist/chunks/{iframe-host-jgesd924.js → iframe-host-syr0f9sb.js} +9 -9
- package/dist/chunks/{layers-1nq5evsh.js → layers-ff81wthn.js} +5 -4
- package/dist/chunks/layers-panel-pnnghw12.js +40 -0
- package/dist/chunks/{media-picker-2qbetq73.js → media-picker-cqhhxhhe.js} +10 -10
- package/dist/chunks/menu-9p2w46gj.js +15 -0
- package/dist/chunks/{publish-panel-98f7sr3g.js → publish-panel-5zt840sy.js} +9 -9
- package/dist/chunks/quick-search-3748564r.js +45 -0
- package/dist/chunks/{references-n553f0e1.js → references-qvvxej7h.js} +3 -3
- package/dist/chunks/right-panel-eccz92qt.js +45 -0
- package/dist/chunks/{studio-x3rty6tr.js → studio-1knfqgy7.js} +6 -6
- package/dist/chunks/{studio-rkstz940.js → studio-1z1kcjv4.js} +17 -8
- package/dist/chunks/{studio-qahxvnan.js → studio-3773086z.js} +2 -2
- package/dist/chunks/{studio-arfpe389.js → studio-3rz5md06.js} +4 -4
- package/dist/chunks/{studio-pm6hgy7r.js → studio-5wt9nvhd.js} +16 -16
- package/dist/chunks/{studio-akbww0j5.js → studio-7xnmgv66.js} +19 -19
- package/dist/chunks/{studio-26d7myd1.js → studio-8scdew0e.js} +3 -3
- package/dist/chunks/{studio-3hxkd92t.js → studio-93zafjcm.js} +8 -8
- package/dist/chunks/{studio-5rt7sqa0.js → studio-a79k90n9.js} +11 -17
- package/dist/chunks/{studio-3gxv60tn.js → studio-aj37eer3.js} +3 -3
- package/dist/chunks/{studio-18avnhjp.js → studio-b0k5tqgp.js} +23 -21
- package/dist/chunks/{studio-fabxk6r9.js → studio-b4s9eykd.js} +13 -13
- package/dist/chunks/{studio-8qtrpzr3.js → studio-e1pgga3k.js} +5 -5
- package/dist/chunks/{studio-8jn5yhyn.js → studio-g3jevyjt.js} +2 -2
- package/dist/chunks/{studio-rpyah2ew.js → studio-gb13095a.js} +18 -17
- package/dist/chunks/{studio-57mf66w2.js → studio-js8nv53n.js} +5 -5
- package/dist/chunks/{studio-vz68yn9e.js → studio-jxp12rnj.js} +4 -4
- package/dist/chunks/{studio-az3zd49t.js → studio-k75n7vhp.js} +56 -4
- package/dist/chunks/{studio-5jy81t3s.js → studio-kkqkcp3d.js} +221 -16
- package/dist/chunks/{studio-tb3ev01j.js → studio-mhhyamxf.js} +4 -4
- package/dist/chunks/{studio-81390n6f.js → studio-nq5yf5mp.js} +1 -1
- package/dist/chunks/{studio-4m0haseg.js → studio-nzzpvzx9.js} +3 -3
- package/dist/chunks/{studio-em9nw8eh.js → studio-pxbgypmg.js} +12 -12
- package/dist/chunks/{studio-sgdc5pfc.js → studio-qhhm6hbt.js} +3 -3
- package/dist/chunks/{studio-d1ja2x9r.js → studio-qk4bfsq2.js} +3 -3
- package/dist/chunks/{studio-25hkdrkw.js → studio-qk90fgqm.js} +9 -9
- package/dist/chunks/{studio-s6z853aq.js → studio-r6nvacqs.js} +18 -17
- package/dist/chunks/{studio-7xptrg0j.js → studio-sbjyc8bt.js} +6 -6
- package/dist/chunks/{studio-5523bpzt.js → studio-syg2tadj.js} +3 -3
- package/dist/chunks/{studio-cpvb2ed1.js → studio-tqgryxwg.js} +7 -7
- package/dist/chunks/{studio-xsykpvsh.js → studio-try13h8c.js} +11 -11
- package/dist/chunks/{studio-erdatzvp.js → studio-vfq8qpjt.js} +34 -5
- package/dist/chunks/{studio-79y5sz51.js → studio-vw7mzp6z.js} +2 -2
- package/dist/chunks/{studio-9xxz1q69.js → studio-wqz6dggm.js} +5 -5
- package/dist/chunks/studio-zdn2g6dt.js +148 -0
- package/dist/chunks/{workspace-wrew8zk4.js → workspace-t55jdjbx.js} +3 -3
- package/dist/iframe-entry.js +97 -10
- package/dist/studio.js +127 -244
- package/package.json +6 -6
- package/src/canvas/canvas-utils.ts +29 -2
- package/src/commands/command-args.ts +37 -2
- package/src/commands/registry.ts +18 -8
- package/src/commands/run-reported.ts +120 -0
- package/src/editor/shortcuts.ts +11 -23
- package/src/files/components.ts +39 -0
- package/src/files/files.ts +3 -2
- package/src/i18n/i18n-commands.ts +10 -0
- package/src/packages/pull-package-sync.ts +5 -1
- package/src/panels/ai-panel.ts +5 -2
- package/src/panels/block-action-bar.ts +7 -2
- package/src/panels/i18n-panel.ts +8 -15
- package/src/panels/jump-bar.ts +3 -2
- package/src/panels/problems-panel.ts +6 -2
- package/src/panels/quick-search.ts +6 -12
- package/src/panels/settings-menu.ts +5 -15
- package/src/panels/tab-strip.ts +3 -3
- package/src/services/ai-command-tools.ts +78 -8
- package/src/services/ai-project-tools.ts +8 -2
- package/src/services/ai-system-prompt.ts +4 -8
- package/src/services/ai-tools.ts +8 -69
- package/src/services/document-assistant.ts +9 -6
- package/src/studio.ts +14 -2
- package/src/surfaces/commandbar.json +13 -12
- package/src/surfaces/commandbar.ts +6 -5
- package/src/surfaces/statusbar.ts +2 -1
- package/src/tabs/project-config.ts +45 -11
- package/src/ui/layers.ts +4 -1
- package/src/workspace/workspace.ts +60 -0
- package/dist/chunks/entry-commands-d6g50j7s.js +0 -42
- package/dist/chunks/layers-panel-ar2gh90g.js +0 -40
- package/dist/chunks/menu-rf7n72mf.js +0 -14
- package/dist/chunks/quick-search-srzz83k2.js +0 -45
- package/dist/chunks/right-panel-rrgx2dn3.js +0 -45
- package/dist/chunks/studio-d055c37e.js +0 -62
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getPlatform2
|
|
3
|
+
} from "./studio-6nzaktvy.js";
|
|
4
|
+
import {
|
|
5
|
+
projectState
|
|
6
|
+
} from "./studio-6ewqv390.js";
|
|
7
|
+
|
|
8
|
+
// ../schema/src/component-meta.ts
|
|
9
|
+
function collectSlotDefs(node, out = []) {
|
|
10
|
+
if (!node || typeof node !== "object" || Array.isArray(node)) {
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
const el = node;
|
|
14
|
+
if (el.tagName === "slot") {
|
|
15
|
+
const attrs = el.attributes;
|
|
16
|
+
const rawName = attrs?.name;
|
|
17
|
+
const name = typeof rawName === "string" ? rawName.trim() : "";
|
|
18
|
+
const { children } = el;
|
|
19
|
+
out.push({
|
|
20
|
+
name,
|
|
21
|
+
...Array.isArray(children) && children.length > 0 ? { fallback: children } : {}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (Array.isArray(el.children)) {
|
|
25
|
+
for (const c of el.children) {
|
|
26
|
+
collectSlotDefs(c, out);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
function isPropEntry(def) {
|
|
32
|
+
if (def == null) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
if (typeof def !== "object") {
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
const obj = def;
|
|
39
|
+
return !obj.$prototype && !obj.$handler && !obj.$compute;
|
|
40
|
+
}
|
|
41
|
+
function componentMetaFrom(doc, path) {
|
|
42
|
+
if (!doc || typeof doc !== "object" || Array.isArray(doc)) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
const content = doc;
|
|
46
|
+
const { tagName } = content;
|
|
47
|
+
if (typeof tagName !== "string" || !tagName.includes("-")) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
const slots = collectSlotDefs(content);
|
|
51
|
+
const state = content.state ?? {};
|
|
52
|
+
return {
|
|
53
|
+
$id: typeof content.$id === "string" && content.$id ? content.$id : null,
|
|
54
|
+
hasElements: Array.isArray(content.$elements) && content.$elements.length > 0,
|
|
55
|
+
path,
|
|
56
|
+
props: Object.entries(state).filter(([, def]) => isPropEntry(def)).map(([name, def]) => {
|
|
57
|
+
if (typeof def !== "object" || def === null) {
|
|
58
|
+
return { default: def, name, type: typeof def };
|
|
59
|
+
}
|
|
60
|
+
const obj = def;
|
|
61
|
+
return {
|
|
62
|
+
default: obj.default,
|
|
63
|
+
format: obj.format,
|
|
64
|
+
name,
|
|
65
|
+
type: obj.type
|
|
66
|
+
};
|
|
67
|
+
}),
|
|
68
|
+
...slots.length > 0 ? { slots } : {},
|
|
69
|
+
tagName
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/files/components.ts
|
|
74
|
+
var componentRegistry2 = [];
|
|
75
|
+
var _componentRegistryLoaded = false;
|
|
76
|
+
async function loadComponentRegistry2() {
|
|
77
|
+
try {
|
|
78
|
+
const platform = getPlatform2();
|
|
79
|
+
componentRegistry2 = await platform.discoverComponents(projectState?.projectRoot || undefined);
|
|
80
|
+
_componentRegistryLoaded = true;
|
|
81
|
+
} catch {
|
|
82
|
+
_componentRegistryLoaded = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function noteComponentSaved2(path, doc) {
|
|
86
|
+
if (!path) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const index = componentRegistry2.findIndex((c) => c.path === path);
|
|
90
|
+
const meta = componentMetaFrom(doc, path);
|
|
91
|
+
if (!meta) {
|
|
92
|
+
if (index === -1) {
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
componentRegistry2.splice(index, 1);
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
const entry = meta;
|
|
99
|
+
if (index === -1) {
|
|
100
|
+
componentRegistry2.push(entry);
|
|
101
|
+
} else {
|
|
102
|
+
componentRegistry2[index] = entry;
|
|
103
|
+
}
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
function buildComponentInstance2(comp) {
|
|
107
|
+
const $props = Object.fromEntries((comp.props ?? []).map((p) => [p.name, p.default !== undefined ? p.default : ""]));
|
|
108
|
+
const children = [];
|
|
109
|
+
for (const slot of comp.slots ?? []) {
|
|
110
|
+
for (const child of structuredClone(slot.fallback ?? [])) {
|
|
111
|
+
if (!slot.name) {
|
|
112
|
+
children.push(child);
|
|
113
|
+
} else if (typeof child === "object" && child !== null && typeof child.tagName === "string") {
|
|
114
|
+
child.attributes = { slot: slot.name, ...child.attributes };
|
|
115
|
+
children.push(child);
|
|
116
|
+
} else {
|
|
117
|
+
children.push({ attributes: { slot: slot.name }, children: [child], tagName: "span" });
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
$props,
|
|
123
|
+
tagName: comp.tagName,
|
|
124
|
+
...children.length > 0 ? { children } : {}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function computeRelativePath2(fromDocPath, toCompPath) {
|
|
128
|
+
if (!fromDocPath) {
|
|
129
|
+
return `./${toCompPath}`;
|
|
130
|
+
}
|
|
131
|
+
const from = fromDocPath.replaceAll("\\", "/");
|
|
132
|
+
const to = toCompPath.replaceAll("\\", "/");
|
|
133
|
+
const fromDir = from.includes("/") ? from.slice(0, from.lastIndexOf("/")) : "";
|
|
134
|
+
const fromParts = fromDir.split("/").filter(Boolean);
|
|
135
|
+
const toParts = to.split("/").filter(Boolean);
|
|
136
|
+
let common = 0;
|
|
137
|
+
while (common < fromParts.length && common < toParts.length && fromParts[common] === toParts[common]) {
|
|
138
|
+
common += 1;
|
|
139
|
+
}
|
|
140
|
+
const ups = fromParts.length - common;
|
|
141
|
+
const remaining = toParts.slice(common);
|
|
142
|
+
return (ups > 0 ? "../".repeat(ups) : "./") + remaining.join("/");
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export { componentMetaFrom, componentRegistry2, loadComponentRegistry2, noteComponentSaved2, buildComponentInstance2, computeRelativePath2 };
|
|
146
|
+
|
|
147
|
+
//# debugId=466165F8ABAECB0564756E2164756E21
|
|
148
|
+
//# sourceMappingURL=studio-zdn2g6dt.js.map
|
|
@@ -27,10 +27,10 @@ import {
|
|
|
27
27
|
moveTabToPane2,
|
|
28
28
|
renameTab2,
|
|
29
29
|
registerTabCommands2
|
|
30
|
-
} from "./studio-
|
|
30
|
+
} from "./studio-k75n7vhp.js";
|
|
31
31
|
import"./studio-q3x06vmj.js";
|
|
32
32
|
import"./studio-6ewqv390.js";
|
|
33
|
-
import"./studio-
|
|
33
|
+
import"./studio-vw7mzp6z.js";
|
|
34
34
|
import"./studio-6nzaktvy.js";
|
|
35
35
|
import"./studio-p1dw8wfw.js";
|
|
36
36
|
import"./studio-7r42c6ca.js";
|
|
@@ -66,4 +66,4 @@ export {
|
|
|
66
66
|
};
|
|
67
67
|
|
|
68
68
|
//# debugId=38ABE52702AF922364756E2164756E21
|
|
69
|
-
//# sourceMappingURL=workspace-
|
|
69
|
+
//# sourceMappingURL=workspace-t55jdjbx.js.map
|
package/dist/iframe-entry.js
CHANGED
|
@@ -28,7 +28,7 @@ var __chunks = (base, ids, nodes, entry) => {
|
|
|
28
28
|
__chunkSeen ||= {};
|
|
29
29
|
__preload(ids[entry], 1);
|
|
30
30
|
};
|
|
31
|
-
__chunks(import.meta.url,["
|
|
31
|
+
__chunks(import.meta.url,["1zk4r753","a73p0pqm","eptb614w","abk6qyee","780pvfbv","3sqv46sn","xgg3kfw7","yy10wk9r","5cndyft8","sp6tna8v","47z3ytva","2r16ez41","g7nm1rgb","t0n6h2rn","wbp1cdws","xbh5bhtr","v17df7b8","anwybnkn","44ez96fc","5e7jev23","s890b918","6v2ac08j","q99sy9rf","nbyxee1y","15g3n6xv","b27vq81n"],[["./iframe-entry.js"],["./chunks/tree-a73p0pqm.js"],["./chunks/tooltip-eptb614w.js",23],["./chunks/textfield-abk6qyee.js"],["./chunks/toast-780pvfbv.js",24],["./chunks/toast-host-3sqv46sn.js",24],["./chunks/color-xgg3kfw7.js",25],["./chunks/icons-yy10wk9r.js"],["./chunks/number-field-5cndyft8.js"],["./chunks/action-group-sp6tna8v.js"],["./chunks/popover-47z3ytva.js",23],["./chunks/select-2r16ez41.js"],["./chunks/split-g7nm1rgb.js"],["./chunks/swatch-group-t0n6h2rn.js"],["./chunks/tabs-wbp1cdws.js"],["./chunks/toolbar-xbh5bhtr.js"],["./chunks/color-area-v17df7b8.js",25],["./chunks/color-field-anwybnkn.js",25,23],["./chunks/color-slider-44ez96fc.js",25],["./chunks/combobox-5e7jev23.js",23],["./chunks/dialog-s890b918.js"],["./chunks/listbox-6v2ac08j.js"],["./chunks/menu-q99sy9rf.js",23],["./chunks/iframe-entry-nbyxee1y.js"],["./chunks/iframe-entry-15g3n6xv.js"],["./chunks/iframe-entry-b27vq81n.js"]],0);
|
|
32
32
|
|
|
33
33
|
// src/canvas/iframe-channel.ts
|
|
34
34
|
var ENVELOPE = "jx:canvas";
|
|
@@ -3795,6 +3795,7 @@ function renderMappedArrayInto(parentEl, arrayDef, state, options) {
|
|
|
3795
3795
|
parentEl.append(anchor);
|
|
3796
3796
|
const { items: itemsSrc, map: mapDef, filter: filterRef, sort: sortRef, key: keyRef } = arrayDef;
|
|
3797
3797
|
const keyPointer = isRefObj(keyRef) ? keyRef.$ref : null;
|
|
3798
|
+
const instancePath = _instancePath;
|
|
3798
3799
|
let warned = false;
|
|
3799
3800
|
const warnOnce = (message) => {
|
|
3800
3801
|
if (!warned) {
|
|
@@ -3882,7 +3883,7 @@ function renderMappedArrayInto(parentEl, arrayDef, state, options) {
|
|
|
3882
3883
|
}
|
|
3883
3884
|
pauseTracking();
|
|
3884
3885
|
try {
|
|
3885
|
-
reconcile(list, keys);
|
|
3886
|
+
underInstancePath(reexpand(instancePath), () => reconcile(list, keys));
|
|
3886
3887
|
} finally {
|
|
3887
3888
|
resetTracking();
|
|
3888
3889
|
}
|
|
@@ -3946,6 +3947,7 @@ function resolveTagName(tagName, scope) {
|
|
|
3946
3947
|
function renderSwitch(def, state, options) {
|
|
3947
3948
|
const path = options?._path ?? [];
|
|
3948
3949
|
const container = document.createElement(resolveTagName(def.tagName, state));
|
|
3950
|
+
const instancePath = _instancePath;
|
|
3949
3951
|
if (options?.onNodeCreated) {
|
|
3950
3952
|
options.onNodeCreated(container, path, def, state);
|
|
3951
3953
|
}
|
|
@@ -3993,13 +3995,13 @@ function renderSwitch(def, state, options) {
|
|
|
3993
3995
|
return;
|
|
3994
3996
|
}
|
|
3995
3997
|
container.replaceChildren();
|
|
3996
|
-
scope.run(() => container.append(renderNode(doc, childScope, childOpts)));
|
|
3998
|
+
underInstancePath(reexpand(instancePath), () => scope.run(() => container.append(renderNode(doc, childScope, childOpts))));
|
|
3997
3999
|
}).catch((error) => console.error("Jx $switch: failed to load external case", caseDef.$ref, error));
|
|
3998
4000
|
return;
|
|
3999
4001
|
}
|
|
4000
4002
|
pauseTracking();
|
|
4001
4003
|
try {
|
|
4002
|
-
scope.run(() => container.append(renderNode(caseDef, state, childOpts)));
|
|
4004
|
+
underInstancePath(reexpand(instancePath), () => scope.run(() => container.append(renderNode(caseDef, state, childOpts))));
|
|
4003
4005
|
} finally {
|
|
4004
4006
|
resetTracking();
|
|
4005
4007
|
}
|
|
@@ -4659,6 +4661,65 @@ async function registerElements(elements, base, ctx) {
|
|
|
4659
4661
|
await defineElement(doc, href);
|
|
4660
4662
|
}
|
|
4661
4663
|
}
|
|
4664
|
+
var MAX_COMPONENT_NESTING = 32;
|
|
4665
|
+
var ROOT_INSTANCE_PATH = { expansion: 0, frames: [] };
|
|
4666
|
+
var _instancePath = ROOT_INSTANCE_PATH;
|
|
4667
|
+
function underInstancePath(path, fn) {
|
|
4668
|
+
const was = _instancePath;
|
|
4669
|
+
_instancePath = path;
|
|
4670
|
+
try {
|
|
4671
|
+
return fn();
|
|
4672
|
+
} finally {
|
|
4673
|
+
_instancePath = was;
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4676
|
+
function reexpand(path) {
|
|
4677
|
+
return { expansion: path.frames.length, frames: path.frames };
|
|
4678
|
+
}
|
|
4679
|
+
function samePropValue(a, b) {
|
|
4680
|
+
if (Object.is(a, b)) {
|
|
4681
|
+
return true;
|
|
4682
|
+
}
|
|
4683
|
+
if (!isPlainData(a) || !isPlainData(b)) {
|
|
4684
|
+
return false;
|
|
4685
|
+
}
|
|
4686
|
+
try {
|
|
4687
|
+
return JSON.stringify(a) === JSON.stringify(b);
|
|
4688
|
+
} catch {
|
|
4689
|
+
return false;
|
|
4690
|
+
}
|
|
4691
|
+
}
|
|
4692
|
+
function isPlainData(value) {
|
|
4693
|
+
if (typeof value !== "object" || value === null) {
|
|
4694
|
+
return false;
|
|
4695
|
+
}
|
|
4696
|
+
const raw = toRaw(value);
|
|
4697
|
+
if (Array.isArray(raw)) {
|
|
4698
|
+
return true;
|
|
4699
|
+
}
|
|
4700
|
+
const proto = Object.getPrototypeOf(raw);
|
|
4701
|
+
return proto === Object.prototype || proto === null;
|
|
4702
|
+
}
|
|
4703
|
+
function sameFrame(a, b) {
|
|
4704
|
+
if (a.tag !== b.tag) {
|
|
4705
|
+
return false;
|
|
4706
|
+
}
|
|
4707
|
+
const keys = Object.keys(a.props);
|
|
4708
|
+
if (keys.length !== Object.keys(b.props).length) {
|
|
4709
|
+
return false;
|
|
4710
|
+
}
|
|
4711
|
+
return keys.every((key) => Object.hasOwn(b.props, key) && samePropValue(a.props[key], b.props[key]));
|
|
4712
|
+
}
|
|
4713
|
+
function extendInstancePath(path, frame) {
|
|
4714
|
+
const chain = [...path.frames.map((f) => f.tag), frame.tag].join(" → ");
|
|
4715
|
+
if (path.frames.slice(path.expansion).some((f) => sameFrame(f, frame))) {
|
|
4716
|
+
throw new Error(`Component <${frame.tag}> renders itself: ${chain}. A component cannot appear inside its own ` + `definition with the same props — the expansion would never end.`);
|
|
4717
|
+
}
|
|
4718
|
+
if (path.frames.length >= MAX_COMPONENT_NESTING) {
|
|
4719
|
+
throw new Error(`Component nesting exceeds ${MAX_COMPONENT_NESTING} levels: ${chain}. A component that renders itself with changing props needs a case that stops.`);
|
|
4720
|
+
}
|
|
4721
|
+
return { expansion: path.expansion, frames: [...path.frames, frame] };
|
|
4722
|
+
}
|
|
4662
4723
|
var _definedSources = new Set;
|
|
4663
4724
|
async function defineElement(source, baseUrl) {
|
|
4664
4725
|
let base = baseUrl;
|
|
@@ -4701,6 +4762,8 @@ async function defineElement(source, baseUrl) {
|
|
|
4701
4762
|
return;
|
|
4702
4763
|
}
|
|
4703
4764
|
this._jxInitialized = true;
|
|
4765
|
+
const enclosingPath = _instancePath;
|
|
4766
|
+
const supplied = {};
|
|
4704
4767
|
const live = _elementDefs.get(tagName) ?? { base: initialBase, doc: initialDef };
|
|
4705
4768
|
const def = live.doc;
|
|
4706
4769
|
const defBase = live.base;
|
|
@@ -4708,6 +4771,7 @@ async function defineElement(source, baseUrl) {
|
|
|
4708
4771
|
for (const attr of observedAttrs) {
|
|
4709
4772
|
if (this.hasAttribute(attr)) {
|
|
4710
4773
|
absorbAttribute(state, attr, this.getAttribute(attr));
|
|
4774
|
+
supplied[attr] = this.getAttribute(attr);
|
|
4711
4775
|
}
|
|
4712
4776
|
}
|
|
4713
4777
|
const propsAttr = this.dataset.jxProps;
|
|
@@ -4720,6 +4784,7 @@ async function defineElement(source, baseUrl) {
|
|
|
4720
4784
|
}
|
|
4721
4785
|
if (key in (def.state ?? {})) {
|
|
4722
4786
|
state[key] = val;
|
|
4787
|
+
supplied[key] = val;
|
|
4723
4788
|
}
|
|
4724
4789
|
}
|
|
4725
4790
|
} catch {}
|
|
@@ -4734,6 +4799,7 @@ async function defineElement(source, baseUrl) {
|
|
|
4734
4799
|
}
|
|
4735
4800
|
if (key in (def.state ?? {})) {
|
|
4736
4801
|
state[key] = this.getAttribute(name);
|
|
4802
|
+
supplied[key] = this.getAttribute(name);
|
|
4737
4803
|
this.removeAttribute(name);
|
|
4738
4804
|
}
|
|
4739
4805
|
}
|
|
@@ -4743,8 +4809,26 @@ async function defineElement(source, baseUrl) {
|
|
|
4743
4809
|
}
|
|
4744
4810
|
if (key in this && this[key] !== undefined && instanceSupplies(this, key)) {
|
|
4745
4811
|
state[key] = this[key];
|
|
4812
|
+
supplied[key] = this[key];
|
|
4746
4813
|
}
|
|
4747
4814
|
}
|
|
4815
|
+
let ownPath;
|
|
4816
|
+
try {
|
|
4817
|
+
ownPath = extendInstancePath(enclosingPath, { props: supplied, tag: tagName });
|
|
4818
|
+
} catch (error) {
|
|
4819
|
+
this.replaceChildren();
|
|
4820
|
+
if (!this.isConnected) {
|
|
4821
|
+
return;
|
|
4822
|
+
}
|
|
4823
|
+
console.error(`Jx: <${tagName}> was not rendered:`, error);
|
|
4824
|
+
this.dispatchEvent(new ErrorEvent("jx-error", {
|
|
4825
|
+
bubbles: true,
|
|
4826
|
+
composed: true,
|
|
4827
|
+
error,
|
|
4828
|
+
message: error instanceof Error ? error.message : String(error)
|
|
4829
|
+
}));
|
|
4830
|
+
return;
|
|
4831
|
+
}
|
|
4748
4832
|
for (const key of Object.keys(def.state ?? {})) {
|
|
4749
4833
|
if (isPrivateStateKey(key)) {
|
|
4750
4834
|
continue;
|
|
@@ -4774,9 +4858,11 @@ async function defineElement(source, baseUrl) {
|
|
|
4774
4858
|
const wasInside = _canvasInsideStampedHost;
|
|
4775
4859
|
_canvasInsideStampedHost ||= this.dataset.jxPath !== undefined;
|
|
4776
4860
|
try {
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4861
|
+
underInstancePath(ownPath, () => {
|
|
4862
|
+
for (const childDef of children) {
|
|
4863
|
+
this.append(renderNode(childDef, state));
|
|
4864
|
+
}
|
|
4865
|
+
});
|
|
4780
4866
|
} finally {
|
|
4781
4867
|
_canvasInsideStampedHost = wasInside;
|
|
4782
4868
|
}
|
|
@@ -5074,13 +5160,14 @@ function adjacentBlock(container, path, direction, isEditable) {
|
|
|
5074
5160
|
|
|
5075
5161
|
// ../site/src/site-style.ts
|
|
5076
5162
|
var SITE_STYLE_ID = "jx-site-style";
|
|
5077
|
-
function buildSiteStyleCSS(siteStyle, mediaQueries, transpose) {
|
|
5163
|
+
function buildSiteStyleCSS(siteStyle, mediaQueries, transpose, resolveValue) {
|
|
5078
5164
|
const rules = [];
|
|
5079
5165
|
const push = (style, selector) => {
|
|
5080
5166
|
for (const rule of buildStyleRules(style, {
|
|
5081
5167
|
mediaQueries,
|
|
5082
5168
|
scope: selector,
|
|
5083
|
-
transposeValue: transpose
|
|
5169
|
+
transposeValue: transpose,
|
|
5170
|
+
...resolveValue ? { resolveValue: (property, value) => resolveValue(property, value, selector) } : {}
|
|
5084
5171
|
})) {
|
|
5085
5172
|
rules.push(rule.text);
|
|
5086
5173
|
}
|
|
@@ -9778,5 +9865,5 @@ export {
|
|
|
9778
9865
|
startCanvasIframe
|
|
9779
9866
|
};
|
|
9780
9867
|
|
|
9781
|
-
//# debugId=
|
|
9868
|
+
//# debugId=2FA5492A7FC7235764756E2164756E21
|
|
9782
9869
|
//# sourceMappingURL=iframe-entry.js.map
|