@jxsuite/studio 2.4.3 → 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/dist/chunks/{cf-settings-g5fbf2zp.js → cf-settings-zj2cj1ar.js} +6 -3
- package/dist/chunks/{content-source-k9724vcv.js → content-source-7fy9qrm0.js} +10 -9
- package/dist/chunks/{convert-to-repeater-k10dvcc7.js → convert-to-repeater-6vvx96n2.js} +9 -8
- package/dist/chunks/{extension-sections-0ada0xcw.js → extension-sections-kwzvpemr.js} +13 -12
- package/dist/chunks/{files-yew27sn9.js → files-xcybanxe.js} +14 -13
- package/dist/chunks/{format-host-wewba4nq.js → format-host-8fr3545e.js} +2 -2
- package/dist/chunks/{git-panel-2dh1aw50.js → git-panel-g01d93vc.js} +9 -8
- package/dist/chunks/{layers-panel-qnsghwwd.js → layers-panel-27essgkc.js} +12 -11
- package/dist/chunks/{publish-panel-a0pdft5w.js → publish-panel-09sy2bab.js} +8 -7
- package/dist/chunks/{quick-search-9avyc4pc.js → quick-search-sefb61v8.js} +15 -14
- package/dist/chunks/{right-panel-kcnhtc5j.js → right-panel-9r32jd5j.js} +11 -10
- package/dist/chunks/{studio-aweyr4v1.js → studio-2x9zbxmx.js} +2 -2
- package/dist/chunks/{studio-ef8t53vc.js → studio-3dkcd4c5.js} +3 -3
- package/dist/chunks/{studio-hb7c46jy.js → studio-5efrtn1m.js} +9 -7
- package/dist/chunks/{studio-v1va0vhd.js → studio-6z5eyjwn.js} +24 -25
- package/dist/chunks/{studio-ke244pam.js → studio-7p35254k.js} +33 -11
- package/dist/chunks/{studio-f5yyvqxv.js → studio-8ezdegcx.js} +13 -11
- package/dist/chunks/{studio-cz2j1c0g.js → studio-a0yp7syn.js} +55 -18
- package/dist/chunks/{studio-26sv44br.js → studio-dc8s8heb.js} +34 -23
- package/dist/chunks/{studio-jnakhg87.js → studio-g5gdqnyd.js} +4 -4
- package/dist/chunks/{studio-rqemfhz6.js → studio-hcxzyk3x.js} +2 -2
- package/dist/chunks/{studio-ws6ef6js.js → studio-hj2se583.js} +12 -10
- package/dist/chunks/{studio-pyrw8h0w.js → studio-j595e748.js} +407 -167
- package/dist/chunks/{studio-dgj7gq44.js → studio-k4jvjcfx.js} +4 -4
- package/dist/chunks/studio-kfpek536.js +28 -0
- package/dist/chunks/{studio-sccge2wf.js → studio-p5dja96s.js} +2 -2
- package/dist/chunks/{studio-0b6fs05q.js → studio-pkp61mh8.js} +5 -5
- package/dist/chunks/studio-qpfq7xhm.js +1802 -0
- package/dist/chunks/{studio-ra7ar50f.js → studio-r5xbtctf.js} +51 -1565
- package/dist/chunks/{studio-v2c5pmjj.js → studio-rh1cnamv.js} +17 -15
- package/dist/chunks/{studio-28xc8ws4.js → studio-ry1vz5sv.js} +10 -8
- package/dist/chunks/{studio-hyn3vhwr.js → studio-xntfdy1x.js} +5 -5
- package/dist/iframe-entry.js +344 -26
- package/dist/studio.js +274 -247
- package/package.json +9 -9
- package/src/browse/library-layouts.ts +3 -3
- package/src/browse/library-pane.ts +2 -2
- package/src/browse/library-preview.ts +19 -3
- package/src/canvas/asset-refs.ts +119 -0
- package/src/canvas/asset-resolve.ts +256 -0
- package/src/canvas/canvas-live-render.ts +23 -15
- package/src/canvas/iframe-entry.ts +1 -0
- package/src/canvas/iframe-host.ts +4 -0
- package/src/canvas/iframe-protocol.ts +9 -0
- package/src/canvas/iframe-render.ts +28 -10
- package/src/canvas/site-style-css.ts +2 -6
- package/src/editor/file-drop-action.ts +2 -1
- package/src/files/files.ts +2 -2
- package/src/files/media-paths.ts +37 -14
- package/src/files/media-upload.ts +47 -6
- package/src/grid/grid-idle.ts +45 -0
- package/src/grid/grid-view.ts +21 -0
- package/src/grid/schema-columns.ts +2 -1
- package/src/grid/sources/content-source.ts +24 -3
- package/src/new-project/import-tab.ts +3 -2
- package/src/panels/ai-chat/composer.ts +30 -13
- package/src/panels/frontmatter-fields.ts +6 -2
- package/src/panels/properties-panel.ts +8 -2
- package/src/panels/seo-modal.ts +5 -6
- package/src/panels/signals-panel.ts +2 -1
- package/src/platforms/cloud.ts +14 -3
- package/src/platforms/devserver.ts +5 -1
- package/src/services/ai-models.ts +101 -11
- package/src/services/ai-settings.ts +69 -71
- package/src/services/cf-settings.ts +19 -37
- package/src/services/document-assistant.ts +4 -3
- package/src/services/idle.ts +6 -1
- package/src/services/settings/definitions.ts +164 -0
- package/src/services/settings/kernel.ts +335 -0
- package/src/services/settings/write-queue.ts +116 -0
- package/src/settings/preferences-accounts.ts +6 -19
- package/src/settings/preferences-keymap.ts +8 -18
- package/src/settings/schema-field-ui.ts +2 -2
- package/src/shell.ts +6 -14
- package/src/studio.ts +32 -1
- package/src/types.ts +61 -3
- package/src/ui/ai-credentials-form.ts +52 -27
- package/src/ui/media-picker.ts +6 -11
- package/src/utils/studio-utils.ts +45 -3
- package/dist/chunks/studio-a7pzveq1.js +0 -110
- package/src/canvas/content-assets.ts +0 -263
- package/src/services/settings-store.ts +0 -99
|
@@ -8,10 +8,7 @@ import {
|
|
|
8
8
|
boundedNumberArg,
|
|
9
9
|
cloneSelection,
|
|
10
10
|
collabState,
|
|
11
|
-
computed,
|
|
12
11
|
distributePageIntoLayout,
|
|
13
|
-
effect,
|
|
14
|
-
effectScope,
|
|
15
12
|
emptyContext,
|
|
16
13
|
enumArg,
|
|
17
14
|
enumProperty,
|
|
@@ -22,7 +19,6 @@ import {
|
|
|
22
19
|
getEffectiveLayoutPath,
|
|
23
20
|
getEffectiveLocales,
|
|
24
21
|
getEffectiveMedia,
|
|
25
|
-
isRef as isRef2,
|
|
26
22
|
isTabActive,
|
|
27
23
|
localeDirection,
|
|
28
24
|
mutateInsertNode,
|
|
@@ -30,13 +26,9 @@ import {
|
|
|
30
26
|
mutateRemoveNode,
|
|
31
27
|
mutateUpdateProp,
|
|
32
28
|
mutateUpdateProperty,
|
|
33
|
-
notify,
|
|
34
29
|
numberProperty,
|
|
35
|
-
onEffectCleanup,
|
|
36
30
|
paneById,
|
|
37
31
|
primarySelection,
|
|
38
|
-
reactive,
|
|
39
|
-
ref,
|
|
40
32
|
resolveI18n,
|
|
41
33
|
resolveLayoutDoc,
|
|
42
34
|
setLayoutSelection,
|
|
@@ -45,13 +37,12 @@ import {
|
|
|
45
37
|
stringArg,
|
|
46
38
|
stringProperty,
|
|
47
39
|
surfaceForPane,
|
|
48
|
-
toRaw,
|
|
49
40
|
toggleSelected,
|
|
50
41
|
transact,
|
|
51
42
|
transactDoc,
|
|
52
43
|
view,
|
|
53
44
|
workspace
|
|
54
|
-
} from "./studio-
|
|
45
|
+
} from "./studio-r5xbtctf.js";
|
|
55
46
|
import {
|
|
56
47
|
classMap,
|
|
57
48
|
ifDefined,
|
|
@@ -103,10 +94,21 @@ import {
|
|
|
103
94
|
renderOnly,
|
|
104
95
|
stripEventHandlers
|
|
105
96
|
} from "./studio-cjm7fdjf.js";
|
|
97
|
+
import {
|
|
98
|
+
computed,
|
|
99
|
+
effect,
|
|
100
|
+
effectScope,
|
|
101
|
+
isRef as isRef2,
|
|
102
|
+
notify,
|
|
103
|
+
onEffectCleanup,
|
|
104
|
+
reactive,
|
|
105
|
+
ref,
|
|
106
|
+
toRaw
|
|
107
|
+
} from "./studio-qpfq7xhm.js";
|
|
106
108
|
import {
|
|
107
109
|
formatByName,
|
|
108
110
|
loadExtensions
|
|
109
|
-
} from "./studio-
|
|
111
|
+
} from "./studio-hcxzyk3x.js";
|
|
110
112
|
import {
|
|
111
113
|
getPlatform,
|
|
112
114
|
hasPlatform
|
|
@@ -2632,6 +2634,194 @@ function evaluateOperand(operand, state, event, iterCtx) {
|
|
|
2632
2634
|
return resolveOperand(operand, state, event, iterCtx);
|
|
2633
2635
|
}
|
|
2634
2636
|
|
|
2637
|
+
// ../schema/src/asset-paths.ts
|
|
2638
|
+
function normalizeDir(value) {
|
|
2639
|
+
const forward = value.replaceAll("\\", "/");
|
|
2640
|
+
return forward.length > 1 && forward.endsWith("/") ? forward.slice(0, -1) : forward;
|
|
2641
|
+
}
|
|
2642
|
+
function normalizeAssetPrefix(prefix) {
|
|
2643
|
+
const forward = normalizeDir(prefix);
|
|
2644
|
+
return forward.startsWith("/") ? forward : `/${forward}`;
|
|
2645
|
+
}
|
|
2646
|
+
function bySpecificity(mounts, key) {
|
|
2647
|
+
return [...mounts].toSorted((a, b) => b[key].length - a[key].length);
|
|
2648
|
+
}
|
|
2649
|
+
function isUnder(path, dir) {
|
|
2650
|
+
return path === dir || path.startsWith(`${dir}/`);
|
|
2651
|
+
}
|
|
2652
|
+
function assetUrlFor(mounts, absolutePath) {
|
|
2653
|
+
const path = normalizeDir(absolutePath);
|
|
2654
|
+
for (const mount of bySpecificity(mounts, "dir")) {
|
|
2655
|
+
const dir = normalizeDir(mount.dir);
|
|
2656
|
+
if (!isUnder(path, dir) || path === dir) {
|
|
2657
|
+
continue;
|
|
2658
|
+
}
|
|
2659
|
+
const rest = path.slice(dir.length + 1);
|
|
2660
|
+
const encoded = rest.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
2661
|
+
return `${normalizeAssetPrefix(mount.urlPrefix)}/${encoded}`;
|
|
2662
|
+
}
|
|
2663
|
+
return null;
|
|
2664
|
+
}
|
|
2665
|
+
function resolveAssetUrl(mounts, url) {
|
|
2666
|
+
const pathname = url.split("#")[0].split("?")[0];
|
|
2667
|
+
if (!pathname.startsWith("/")) {
|
|
2668
|
+
return null;
|
|
2669
|
+
}
|
|
2670
|
+
let decoded;
|
|
2671
|
+
try {
|
|
2672
|
+
decoded = decodeURIComponent(pathname);
|
|
2673
|
+
} catch {
|
|
2674
|
+
return null;
|
|
2675
|
+
}
|
|
2676
|
+
if (/%2e|%2f/i.test(decoded)) {
|
|
2677
|
+
return null;
|
|
2678
|
+
}
|
|
2679
|
+
for (const mount of bySpecificity(mounts, "urlPrefix")) {
|
|
2680
|
+
const prefix = normalizeAssetPrefix(mount.urlPrefix);
|
|
2681
|
+
if (!decoded.startsWith(`${prefix}/`)) {
|
|
2682
|
+
continue;
|
|
2683
|
+
}
|
|
2684
|
+
const rest = decoded.slice(prefix.length + 1);
|
|
2685
|
+
const segments = rest.split("/");
|
|
2686
|
+
if (segments.some((s) => s === "" || s === "." || s === "..")) {
|
|
2687
|
+
return null;
|
|
2688
|
+
}
|
|
2689
|
+
return `${normalizeDir(mount.dir)}/${segments.join("/")}`;
|
|
2690
|
+
}
|
|
2691
|
+
return null;
|
|
2692
|
+
}
|
|
2693
|
+
var URL_TERMINATOR = String.raw`"'\s<>()\\`;
|
|
2694
|
+
var PUBLIC_DIR = "public";
|
|
2695
|
+
var BUILD_LANES = ["mounts", "public"];
|
|
2696
|
+
function splitRefSuffix(value) {
|
|
2697
|
+
const cut = value.search(/[#?]/);
|
|
2698
|
+
return cut === -1 ? { path: value, suffix: "" } : { path: value.slice(0, cut), suffix: value.slice(cut) };
|
|
2699
|
+
}
|
|
2700
|
+
function isNonRelativeRef(value) {
|
|
2701
|
+
return value === "" || value.startsWith("/") || value.startsWith("#") || value.includes("${") || /^[a-z][\w+.-]*:/i.test(value);
|
|
2702
|
+
}
|
|
2703
|
+
function normalizeProjectPath(path) {
|
|
2704
|
+
return path.replaceAll("\\", "/").replace(/^\.\//, "").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
2705
|
+
}
|
|
2706
|
+
function dirOfPath(path) {
|
|
2707
|
+
const normalized = normalizeProjectPath(path);
|
|
2708
|
+
const slash = normalized.lastIndexOf("/");
|
|
2709
|
+
return slash === -1 ? "" : normalized.slice(0, slash);
|
|
2710
|
+
}
|
|
2711
|
+
function joinProjectPath(dir, ref3) {
|
|
2712
|
+
const base = dir === "" || dir === "." ? [] : normalizeProjectPath(dir).split("/");
|
|
2713
|
+
const out = base.filter((segment) => segment !== "" && segment !== ".");
|
|
2714
|
+
for (const segment of ref3.replaceAll("\\", "/").split("/")) {
|
|
2715
|
+
if (segment === "" || segment === ".") {
|
|
2716
|
+
continue;
|
|
2717
|
+
}
|
|
2718
|
+
if (segment === "..") {
|
|
2719
|
+
if (out.length === 0) {
|
|
2720
|
+
return null;
|
|
2721
|
+
}
|
|
2722
|
+
out.pop();
|
|
2723
|
+
continue;
|
|
2724
|
+
}
|
|
2725
|
+
out.push(segment);
|
|
2726
|
+
}
|
|
2727
|
+
return out.join("/");
|
|
2728
|
+
}
|
|
2729
|
+
function projectPathsForSiteUrl(url, mounts, lanes) {
|
|
2730
|
+
const { path } = splitRefSuffix(url);
|
|
2731
|
+
if (!path.startsWith("/")) {
|
|
2732
|
+
return [];
|
|
2733
|
+
}
|
|
2734
|
+
let decoded;
|
|
2735
|
+
try {
|
|
2736
|
+
decoded = decodeURIComponent(path);
|
|
2737
|
+
} catch {
|
|
2738
|
+
return [];
|
|
2739
|
+
}
|
|
2740
|
+
if (/%2e|%2f/i.test(decoded)) {
|
|
2741
|
+
return [];
|
|
2742
|
+
}
|
|
2743
|
+
const rest = decoded.replace(/^\/+/, "");
|
|
2744
|
+
if (rest === "" || rest.split("/").some((segment) => segment === "." || segment === "..")) {
|
|
2745
|
+
return [];
|
|
2746
|
+
}
|
|
2747
|
+
const out = [];
|
|
2748
|
+
for (const lane of lanes) {
|
|
2749
|
+
if (lane === "mounts") {
|
|
2750
|
+
const mounted = resolveAssetUrl(mounts, path);
|
|
2751
|
+
if (mounted !== null && !mounted.startsWith("/") && !/^[A-Za-z]:/.test(mounted)) {
|
|
2752
|
+
out.push(normalizeProjectPath(mounted));
|
|
2753
|
+
}
|
|
2754
|
+
continue;
|
|
2755
|
+
}
|
|
2756
|
+
out.push(lane === "root" ? rest : `${PUBLIC_DIR}/${rest}`);
|
|
2757
|
+
}
|
|
2758
|
+
return [...new Set(out)];
|
|
2759
|
+
}
|
|
2760
|
+
function projectPathForRef(value, documentDir, mounts, lanes) {
|
|
2761
|
+
const { path } = splitRefSuffix(value);
|
|
2762
|
+
if (path === "") {
|
|
2763
|
+
return null;
|
|
2764
|
+
}
|
|
2765
|
+
if (isNonRelativeRef(value)) {
|
|
2766
|
+
return path.startsWith("/") ? projectPathsForSiteUrl(path, mounts, lanes)[0] ?? null : null;
|
|
2767
|
+
}
|
|
2768
|
+
if (path.endsWith("/")) {
|
|
2769
|
+
return null;
|
|
2770
|
+
}
|
|
2771
|
+
let decoded;
|
|
2772
|
+
try {
|
|
2773
|
+
decoded = decodeURIComponent(path);
|
|
2774
|
+
} catch {
|
|
2775
|
+
return null;
|
|
2776
|
+
}
|
|
2777
|
+
const joined = joinProjectPath(documentDir, decoded);
|
|
2778
|
+
if (joined === null || joined === "" || joined === normalizeProjectPath(documentDir)) {
|
|
2779
|
+
return null;
|
|
2780
|
+
}
|
|
2781
|
+
return joined;
|
|
2782
|
+
}
|
|
2783
|
+
function encodeProjectPath(path) {
|
|
2784
|
+
return path.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
2785
|
+
}
|
|
2786
|
+
function parseSrcset(value) {
|
|
2787
|
+
const out = [];
|
|
2788
|
+
let i = 0;
|
|
2789
|
+
while (i < value.length) {
|
|
2790
|
+
while (i < value.length && (/\s/.test(value[i]) || value[i] === ",")) {
|
|
2791
|
+
i += 1;
|
|
2792
|
+
}
|
|
2793
|
+
if (i >= value.length) {
|
|
2794
|
+
break;
|
|
2795
|
+
}
|
|
2796
|
+
const start = i;
|
|
2797
|
+
while (i < value.length && !/\s/.test(value[i])) {
|
|
2798
|
+
i += 1;
|
|
2799
|
+
}
|
|
2800
|
+
let url = value.slice(start, i);
|
|
2801
|
+
if (url.endsWith(",")) {
|
|
2802
|
+
out.push({ descriptor: "", url: url.replace(/,+$/, "") });
|
|
2803
|
+
continue;
|
|
2804
|
+
}
|
|
2805
|
+
while (i < value.length && /\s/.test(value[i])) {
|
|
2806
|
+
i += 1;
|
|
2807
|
+
}
|
|
2808
|
+
const descStart = i;
|
|
2809
|
+
while (i < value.length && value[i] !== ",") {
|
|
2810
|
+
i += 1;
|
|
2811
|
+
}
|
|
2812
|
+
const descriptor = value.slice(descStart, i).trim();
|
|
2813
|
+
i += 1;
|
|
2814
|
+
url = url.replace(/,+$/, "");
|
|
2815
|
+
if (url !== "") {
|
|
2816
|
+
out.push({ descriptor, url });
|
|
2817
|
+
}
|
|
2818
|
+
}
|
|
2819
|
+
return out;
|
|
2820
|
+
}
|
|
2821
|
+
function formatSrcset(candidates) {
|
|
2822
|
+
return candidates.map(({ url, descriptor }) => descriptor ? `${url} ${descriptor}` : url).join(", ");
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2635
2825
|
// ../runtime/src/statements.ts
|
|
2636
2826
|
function statementKind(statement) {
|
|
2637
2827
|
if ("operator" in statement) {
|
|
@@ -2816,6 +3006,52 @@ function canvasAttrName(el, key) {
|
|
|
2816
3006
|
}
|
|
2817
3007
|
return key;
|
|
2818
3008
|
}
|
|
3009
|
+
var _canvasAssetResolver = null;
|
|
3010
|
+
function setCanvasAssetResolver(fn) {
|
|
3011
|
+
_canvasAssetResolver = fn;
|
|
3012
|
+
}
|
|
3013
|
+
var ASSET_KEYS = new Set(["src", "poster", "data"]);
|
|
3014
|
+
var SRCSET_KEYS = new Set(["srcset", "imagesrcset"]);
|
|
3015
|
+
var HREF_ASSET_TAGS = new Set(["LINK"]);
|
|
3016
|
+
function isAssetKey(tagName, key) {
|
|
3017
|
+
return ASSET_KEYS.has(key) || key === "href" && HREF_ASSET_TAGS.has(tagName);
|
|
3018
|
+
}
|
|
3019
|
+
function canvasAssetValue(tagName, key, value) {
|
|
3020
|
+
if (!_canvasAssetResolver || value === "") {
|
|
3021
|
+
return value;
|
|
3022
|
+
}
|
|
3023
|
+
const name = key.toLowerCase();
|
|
3024
|
+
if (SRCSET_KEYS.has(name)) {
|
|
3025
|
+
const candidates = parseSrcset(value);
|
|
3026
|
+
let changed = false;
|
|
3027
|
+
const next = candidates.map((candidate) => {
|
|
3028
|
+
const resolved = _canvasAssetResolver?.(candidate.url, name) ?? null;
|
|
3029
|
+
if (resolved === null || resolved === candidate.url) {
|
|
3030
|
+
return candidate;
|
|
3031
|
+
}
|
|
3032
|
+
changed = true;
|
|
3033
|
+
return { descriptor: candidate.descriptor, url: resolved };
|
|
3034
|
+
});
|
|
3035
|
+
return changed ? formatSrcset(next) : value;
|
|
3036
|
+
}
|
|
3037
|
+
if (!isAssetKey(tagName, name)) {
|
|
3038
|
+
return value;
|
|
3039
|
+
}
|
|
3040
|
+
return _canvasAssetResolver(value, name) ?? value;
|
|
3041
|
+
}
|
|
3042
|
+
var CSS_URL_RE = /\burl\(\s*(?<q>["']?)(?<u>[^"')]*)\k<q>\s*\)/g;
|
|
3043
|
+
function canvasStyleUrls(value) {
|
|
3044
|
+
if (!_canvasAssetResolver || !value.includes("url(")) {
|
|
3045
|
+
return value;
|
|
3046
|
+
}
|
|
3047
|
+
return value.replaceAll(CSS_URL_RE, (whole, quote, url) => {
|
|
3048
|
+
const resolved = url === "" ? null : _canvasAssetResolver?.(url, "url()") ?? null;
|
|
3049
|
+
return resolved === null ? whole : `url(${quote}${resolved}${quote})`;
|
|
3050
|
+
});
|
|
3051
|
+
}
|
|
3052
|
+
function canvasStyleValue(value) {
|
|
3053
|
+
return transposeCanvasUnits(canvasStyleUrls(value));
|
|
3054
|
+
}
|
|
2819
3055
|
var _stampPropBindings = false;
|
|
2820
3056
|
var PURE_STATE_TEMPLATE = /^\s*\$\{\s*state\.(\w+)\s*\}\s*$/;
|
|
2821
3057
|
function boundPropKey(key, val, state) {
|
|
@@ -3089,6 +3325,17 @@ var RESERVED_KEYS = new Set([
|
|
|
3089
3325
|
"observedAttributes"
|
|
3090
3326
|
]);
|
|
3091
3327
|
var warnedRefChildren = new Set;
|
|
3328
|
+
var SVG_NS = "http://www.w3.org/2000/svg";
|
|
3329
|
+
var MATHML_NS = "http://www.w3.org/1998/Math/MathML";
|
|
3330
|
+
function elementNamespace(tagName, inherited) {
|
|
3331
|
+
if (tagName === "svg") {
|
|
3332
|
+
return SVG_NS;
|
|
3333
|
+
}
|
|
3334
|
+
if (tagName === "math") {
|
|
3335
|
+
return MATHML_NS;
|
|
3336
|
+
}
|
|
3337
|
+
return inherited ?? null;
|
|
3338
|
+
}
|
|
3092
3339
|
function renderNode(def, state, options) {
|
|
3093
3340
|
const path = options?._path ?? [];
|
|
3094
3341
|
if (typeof def === "string" || typeof def === "number" || typeof def === "boolean") {
|
|
@@ -3131,7 +3378,9 @@ function renderNode(def, state, options) {
|
|
|
3131
3378
|
if (def.$switch) {
|
|
3132
3379
|
return renderSwitch(def, localState, options);
|
|
3133
3380
|
}
|
|
3134
|
-
const
|
|
3381
|
+
const ns = elementNamespace(tagName, options?._ns);
|
|
3382
|
+
const childNs = tagName === "foreignObject" ? null : ns;
|
|
3383
|
+
const el = ns ? document.createElementNS(ns, tagName) : document.createElement(tagName);
|
|
3135
3384
|
if (options?.onNodeCreated) {
|
|
3136
3385
|
options.onNodeCreated(el, path, def, localState);
|
|
3137
3386
|
}
|
|
@@ -3140,12 +3389,12 @@ function renderNode(def, state, options) {
|
|
|
3140
3389
|
applyAttributes(el, def.attributes ?? {}, localState);
|
|
3141
3390
|
const kids = def.children;
|
|
3142
3391
|
if (isMappedArray(kids)) {
|
|
3143
|
-
const arrOpts = options ? { ...options, _path: [...path, "children"] } : undefined;
|
|
3392
|
+
const arrOpts = options || childNs ? { ...options, _ns: childNs, _path: [...path, "children"] } : undefined;
|
|
3144
3393
|
renderMappedArrayInto(el, kids, localState, arrOpts);
|
|
3145
3394
|
} else if (Array.isArray(kids)) {
|
|
3146
3395
|
for (let i = 0;i < kids.length; i++) {
|
|
3147
3396
|
const child = kids[i];
|
|
3148
|
-
const childOpts = options ? { ...options, _path: [...path, "children", i] } : undefined;
|
|
3397
|
+
const childOpts = options || childNs ? { ...options, _ns: childNs, _path: [...path, "children", i] } : undefined;
|
|
3149
3398
|
if (isMappedArray(child)) {
|
|
3150
3399
|
renderMappedArrayInto(el, child, localState, childOpts);
|
|
3151
3400
|
} else {
|
|
@@ -3204,6 +3453,15 @@ function bindProperty(el, key, val, state) {
|
|
|
3204
3453
|
if (boundProp) {
|
|
3205
3454
|
el.dataset.jxBoundProp = boundProp;
|
|
3206
3455
|
}
|
|
3456
|
+
const asAsset = (resolved) => typeof resolved === "string" ? canvasAssetValue(el.tagName, key, resolved) : resolved;
|
|
3457
|
+
const write = (resolved) => {
|
|
3458
|
+
const node = el;
|
|
3459
|
+
if (key === "className" && !(node instanceof HTMLElement)) {
|
|
3460
|
+
node.setAttribute("class", resolved == null ? "" : String(resolved));
|
|
3461
|
+
return;
|
|
3462
|
+
}
|
|
3463
|
+
target[key] = resolved;
|
|
3464
|
+
};
|
|
3207
3465
|
if (isRefObj(val)) {
|
|
3208
3466
|
const refVal = val;
|
|
3209
3467
|
if (key === "id") {
|
|
@@ -3211,17 +3469,17 @@ function bindProperty(el, key, val, state) {
|
|
|
3211
3469
|
return;
|
|
3212
3470
|
}
|
|
3213
3471
|
effect(() => {
|
|
3214
|
-
|
|
3472
|
+
write(asAsset(resolveRef(refVal.$ref, state)));
|
|
3215
3473
|
});
|
|
3216
3474
|
return;
|
|
3217
3475
|
}
|
|
3218
3476
|
if (isTemplateString(val)) {
|
|
3219
3477
|
effect(() => {
|
|
3220
|
-
|
|
3478
|
+
write(asAsset(evaluateTemplate(val, state)));
|
|
3221
3479
|
});
|
|
3222
3480
|
return;
|
|
3223
3481
|
}
|
|
3224
|
-
|
|
3482
|
+
write(asAsset(val));
|
|
3225
3483
|
}
|
|
3226
3484
|
function applyStyle(el, styleDef, mediaQueries = {}, state = {}) {
|
|
3227
3485
|
const nested = {};
|
|
@@ -3256,19 +3514,19 @@ function applyStyle(el, styleDef, mediaQueries = {}, state = {}) {
|
|
|
3256
3514
|
if (prop.startsWith("--")) {
|
|
3257
3515
|
if (isTemplateString(val)) {
|
|
3258
3516
|
effect(() => {
|
|
3259
|
-
el.style.setProperty(prop,
|
|
3517
|
+
el.style.setProperty(prop, canvasStyleValue(evaluateTemplate(val, state)));
|
|
3260
3518
|
});
|
|
3261
3519
|
} else {
|
|
3262
|
-
el.style.setProperty(prop,
|
|
3520
|
+
el.style.setProperty(prop, canvasStyleValue(scalar));
|
|
3263
3521
|
}
|
|
3264
3522
|
} else if (isTemplateString(val)) {
|
|
3265
3523
|
effect(() => {
|
|
3266
|
-
el.style[prop] =
|
|
3524
|
+
el.style[prop] = canvasStyleValue(evaluateTemplate(val, state));
|
|
3267
3525
|
});
|
|
3268
3526
|
} else if (mediaOverriddenProps.has(prop)) {
|
|
3269
3527
|
baseDecls[prop] = scalar;
|
|
3270
3528
|
} else {
|
|
3271
|
-
el.style[prop] =
|
|
3529
|
+
el.style[prop] = canvasStyleValue(scalar);
|
|
3272
3530
|
}
|
|
3273
3531
|
}
|
|
3274
3532
|
const hasNested = Object.keys(nested).length > 0;
|
|
@@ -3327,7 +3585,7 @@ function applyStyle(el, styleDef, mediaQueries = {}, state = {}) {
|
|
|
3327
3585
|
if (key === "@--") {
|
|
3328
3586
|
continue;
|
|
3329
3587
|
}
|
|
3330
|
-
const query = key
|
|
3588
|
+
const query = resolveAtQuery(key, mediaQueries);
|
|
3331
3589
|
const atRule = query === null ? key : `@media ${query}`;
|
|
3332
3590
|
const scope = `[data-jx="${uid}"]`;
|
|
3333
3591
|
const scheme = query === null ? null : pureSchemeOf(query);
|
|
@@ -3353,12 +3611,15 @@ var elementStyleTags = new WeakMap;
|
|
|
3353
3611
|
function applyAttributes(el, attrs, state) {
|
|
3354
3612
|
for (const [k, v] of Object.entries(attrs)) {
|
|
3355
3613
|
const attr = canvasAttrName(el, k);
|
|
3614
|
+
const write = (resolved) => {
|
|
3615
|
+
el.setAttribute(attr, canvasAssetValue(el.tagName, k, String(resolved ?? "")));
|
|
3616
|
+
};
|
|
3356
3617
|
if (isRefObj(v)) {
|
|
3357
|
-
effect(() =>
|
|
3618
|
+
effect(() => write(resolveRef(v.$ref, state)));
|
|
3358
3619
|
} else if (isTemplateString(v)) {
|
|
3359
|
-
effect(() =>
|
|
3620
|
+
effect(() => write(evaluateTemplate(v, state)));
|
|
3360
3621
|
} else {
|
|
3361
|
-
|
|
3622
|
+
write(v);
|
|
3362
3623
|
}
|
|
3363
3624
|
}
|
|
3364
3625
|
}
|
|
@@ -4031,7 +4292,18 @@ function camelToKebab(s) {
|
|
|
4031
4292
|
return s.replaceAll(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
4032
4293
|
}
|
|
4033
4294
|
function toCSSText(rules) {
|
|
4034
|
-
return Object.entries(rules).filter(([k, v]) => !isNestedSelector(k) && (v === null || typeof v !== "object")).map(([p, v]) => `${camelToKebab(p)}: ${
|
|
4295
|
+
return Object.entries(rules).filter(([k, v]) => !isNestedSelector(k) && (v === null || typeof v !== "object")).map(([p, v]) => `${camelToKebab(p)}: ${canvasStyleValue(String(v))}`).join("; ");
|
|
4296
|
+
}
|
|
4297
|
+
var MEDIA_TYPES = new Set(["all", "print", "screen", "speech"]);
|
|
4298
|
+
function resolveAtQuery(atKey, mediaQueries) {
|
|
4299
|
+
if (atKey.startsWith("@--")) {
|
|
4300
|
+
return mediaQueries[atKey.slice(1)] ?? atKey.slice(1);
|
|
4301
|
+
}
|
|
4302
|
+
if (atKey.startsWith("@(")) {
|
|
4303
|
+
const inner = atKey.slice(2, -1).trim();
|
|
4304
|
+
return MEDIA_TYPES.has(inner.toLowerCase()) ? inner : atKey.slice(1);
|
|
4305
|
+
}
|
|
4306
|
+
return null;
|
|
4035
4307
|
}
|
|
4036
4308
|
var COLOR_SCHEME_ATTR = "data-color-scheme";
|
|
4037
4309
|
function pureSchemeOf(query) {
|
|
@@ -4179,6 +4451,9 @@ async function defineElement(source, baseUrl) {
|
|
|
4179
4451
|
}
|
|
4180
4452
|
applyStyle(this, def.style ?? {}, state["$media"] ?? {}, state);
|
|
4181
4453
|
applyAttributes(this, def.attributes ?? {}, state);
|
|
4454
|
+
if (!Array.isArray(def.children) && def.textContent !== undefined) {
|
|
4455
|
+
bindProperty(this, "textContent", def.textContent, state);
|
|
4456
|
+
}
|
|
4182
4457
|
const children = Array.isArray(def.children) ? def.children : [];
|
|
4183
4458
|
for (const childDef of children) {
|
|
4184
4459
|
this.append(renderNode(childDef, state));
|
|
@@ -4225,19 +4500,21 @@ function renderCustomElementWithProps(def, state, options, path) {
|
|
|
4225
4500
|
if (refusePrivateProp(key, "$props")) {
|
|
4226
4501
|
continue;
|
|
4227
4502
|
}
|
|
4503
|
+
const write = (resolved) => {
|
|
4504
|
+
el[key] = typeof resolved === "string" ? canvasAssetValue(el.tagName, key, resolved) : resolved;
|
|
4505
|
+
};
|
|
4228
4506
|
if (isRefObj(val)) {
|
|
4229
4507
|
const refVal = val;
|
|
4230
|
-
|
|
4231
|
-
el[key] = resolved;
|
|
4508
|
+
write(resolveRef(refVal.$ref, state));
|
|
4232
4509
|
effect(() => {
|
|
4233
|
-
|
|
4510
|
+
write(resolveRef(refVal.$ref, state));
|
|
4234
4511
|
});
|
|
4235
4512
|
} else if (isTemplateString(val)) {
|
|
4236
4513
|
effect(() => {
|
|
4237
|
-
|
|
4514
|
+
write(evaluateTemplate(val, state));
|
|
4238
4515
|
});
|
|
4239
4516
|
} else {
|
|
4240
|
-
|
|
4517
|
+
write(val);
|
|
4241
4518
|
}
|
|
4242
4519
|
}
|
|
4243
4520
|
applyStyle(el, def.style ?? {}, state["$media"] ?? {}, state);
|
|
@@ -4980,101 +5257,94 @@ function substitutePreviewProps(renderDoc, props) {
|
|
|
4980
5257
|
return { ...renderDoc, state };
|
|
4981
5258
|
}
|
|
4982
5259
|
|
|
4983
|
-
//
|
|
4984
|
-
function normalizeDir(value) {
|
|
4985
|
-
const forward = value.replaceAll("\\", "/");
|
|
4986
|
-
return forward.length > 1 && forward.endsWith("/") ? forward.slice(0, -1) : forward;
|
|
4987
|
-
}
|
|
4988
|
-
function normalizeAssetPrefix(prefix) {
|
|
4989
|
-
const forward = normalizeDir(prefix);
|
|
4990
|
-
return forward.startsWith("/") ? forward : `/${forward}`;
|
|
4991
|
-
}
|
|
4992
|
-
function bySpecificity(mounts, key) {
|
|
4993
|
-
return [...mounts].toSorted((a, b) => b[key].length - a[key].length);
|
|
4994
|
-
}
|
|
4995
|
-
function isUnder(path, dir) {
|
|
4996
|
-
return path === dir || path.startsWith(`${dir}/`);
|
|
4997
|
-
}
|
|
4998
|
-
function assetUrlFor(mounts, absolutePath) {
|
|
4999
|
-
const path = normalizeDir(absolutePath);
|
|
5000
|
-
for (const mount of bySpecificity(mounts, "dir")) {
|
|
5001
|
-
const dir = normalizeDir(mount.dir);
|
|
5002
|
-
if (!isUnder(path, dir) || path === dir) {
|
|
5003
|
-
continue;
|
|
5004
|
-
}
|
|
5005
|
-
const rest = path.slice(dir.length + 1);
|
|
5006
|
-
const encoded = rest.split("/").map((segment) => encodeURIComponent(segment)).join("/");
|
|
5007
|
-
return `${normalizeAssetPrefix(mount.urlPrefix)}/${encoded}`;
|
|
5008
|
-
}
|
|
5009
|
-
return null;
|
|
5010
|
-
}
|
|
5011
|
-
var URL_TERMINATOR = String.raw`"'\s<>()\\`;
|
|
5012
|
-
|
|
5013
|
-
// src/canvas/content-assets.ts
|
|
5014
|
-
var ASSET_KEYS = ["src", "poster"];
|
|
5260
|
+
// src/canvas/asset-resolve.ts
|
|
5015
5261
|
var SAFE_TYPE_NAME = /^[\w.~-]+$/;
|
|
5016
5262
|
var SECTION_KEY = "content";
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
}
|
|
5020
|
-
function normalizeSource(source) {
|
|
5021
|
-
return source.replaceAll("\\", "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
5022
|
-
}
|
|
5023
|
-
function resolveRelativePath(dir, ref3) {
|
|
5024
|
-
const segments = dir === "" || dir === "." ? [] : dir.replaceAll("\\", "/").split("/");
|
|
5025
|
-
const out = segments.filter((s) => s !== "" && s !== ".");
|
|
5026
|
-
for (const segment of ref3.replaceAll("\\", "/").split("/")) {
|
|
5027
|
-
if (segment === "" || segment === ".") {
|
|
5028
|
-
continue;
|
|
5029
|
-
}
|
|
5030
|
-
if (segment === "..") {
|
|
5031
|
-
if (out.length === 0) {
|
|
5032
|
-
return null;
|
|
5033
|
-
}
|
|
5034
|
-
out.pop();
|
|
5035
|
-
continue;
|
|
5036
|
-
}
|
|
5037
|
-
out.push(segment);
|
|
5038
|
-
}
|
|
5039
|
-
return out.join("/");
|
|
5040
|
-
}
|
|
5041
|
-
function dirOf(path) {
|
|
5042
|
-
const normalized = path.replaceAll("\\", "/");
|
|
5043
|
-
const slash = normalized.lastIndexOf("/");
|
|
5044
|
-
return slash === -1 ? "" : normalized.slice(0, slash);
|
|
5045
|
-
}
|
|
5046
|
-
function contentMountFor(documentPath, content) {
|
|
5263
|
+
var LOCALE_PLACEHOLDER = "{locale}";
|
|
5264
|
+
function contentMountFor(documentPath, content, locales = []) {
|
|
5047
5265
|
if (!documentPath || !content) {
|
|
5048
5266
|
return null;
|
|
5049
5267
|
}
|
|
5050
5268
|
const path = documentPath.replaceAll("\\", "/").replace(/^\.\//, "");
|
|
5051
5269
|
let best = null;
|
|
5270
|
+
const consider = (dir, urlPrefix) => {
|
|
5271
|
+
if (path.startsWith(`${dir}/`) && (!best || dir.length > best.dir.length)) {
|
|
5272
|
+
best = { dir, urlPrefix };
|
|
5273
|
+
}
|
|
5274
|
+
};
|
|
5052
5275
|
for (const [name, def] of Object.entries(content)) {
|
|
5053
5276
|
if (!def?.source || !SAFE_TYPE_NAME.test(name)) {
|
|
5054
5277
|
continue;
|
|
5055
5278
|
}
|
|
5056
5279
|
const dir = normalizeSource(def.source);
|
|
5057
|
-
if (dir === "" || dir.startsWith("..")
|
|
5280
|
+
if (dir === "" || dir.startsWith("..")) {
|
|
5058
5281
|
continue;
|
|
5059
5282
|
}
|
|
5060
|
-
if (
|
|
5061
|
-
|
|
5283
|
+
if (dir.includes(LOCALE_PLACEHOLDER)) {
|
|
5284
|
+
const mount = localeMountFor(path, dir, name, locales);
|
|
5285
|
+
if (mount) {
|
|
5286
|
+
consider(mount.dir, mount.urlPrefix);
|
|
5287
|
+
}
|
|
5288
|
+
continue;
|
|
5062
5289
|
}
|
|
5290
|
+
if (/\.[a-z0-9]+$/i.test(dir)) {
|
|
5291
|
+
continue;
|
|
5292
|
+
}
|
|
5293
|
+
consider(dir, `/${SECTION_KEY}/${name}`);
|
|
5063
5294
|
}
|
|
5064
5295
|
return best;
|
|
5065
5296
|
}
|
|
5297
|
+
function localeMountFor(path, source, name, locales) {
|
|
5298
|
+
const cut = source.indexOf(LOCALE_PLACEHOLDER);
|
|
5299
|
+
const head = source.slice(0, cut);
|
|
5300
|
+
const tail = source.slice(cut + LOCALE_PLACEHOLDER.length);
|
|
5301
|
+
if (!path.startsWith(head)) {
|
|
5302
|
+
return null;
|
|
5303
|
+
}
|
|
5304
|
+
const segment = path.slice(head.length).split("/")[0] ?? "";
|
|
5305
|
+
if (segment === "" || !SAFE_TYPE_NAME.test(segment)) {
|
|
5306
|
+
return null;
|
|
5307
|
+
}
|
|
5308
|
+
const canonical = locales.find((tag) => tag.toLowerCase() === segment.toLowerCase());
|
|
5309
|
+
if (canonical === undefined || !SAFE_TYPE_NAME.test(canonical)) {
|
|
5310
|
+
return null;
|
|
5311
|
+
}
|
|
5312
|
+
const dir = `${head}${segment}${tail}`.replace(/\/+$/, "");
|
|
5313
|
+
return { dir, urlPrefix: `/${SECTION_KEY}/${name}/${canonical}` };
|
|
5314
|
+
}
|
|
5315
|
+
function normalizeSource(source) {
|
|
5316
|
+
return source.replaceAll("\\", "/").replace(/^\.\//, "").replace(/\/+$/, "");
|
|
5317
|
+
}
|
|
5318
|
+
function resolveAssetRef(value, ctx) {
|
|
5319
|
+
if (!ctx || value === "") {
|
|
5320
|
+
return null;
|
|
5321
|
+
}
|
|
5322
|
+
if (ctx.space === "repo") {
|
|
5323
|
+
if (!ctx.fileBaseUrl) {
|
|
5324
|
+
return null;
|
|
5325
|
+
}
|
|
5326
|
+
const path = projectPathForRef(value, ctx.documentDir, ctx.mounts, ctx.lanes);
|
|
5327
|
+
if (path === null) {
|
|
5328
|
+
return null;
|
|
5329
|
+
}
|
|
5330
|
+
const { suffix } = splitRefSuffix(value);
|
|
5331
|
+
return `${ctx.fileBaseUrl}${encodeProjectPath(path)}${suffix}`;
|
|
5332
|
+
}
|
|
5333
|
+
const [mount] = ctx.mounts;
|
|
5334
|
+
return mount ? mountedRefFor(value, ctx.documentDir, mount) : null;
|
|
5335
|
+
}
|
|
5066
5336
|
function mountedRefFor(value, entryDir, mount) {
|
|
5067
5337
|
if (isNonRelativeRef(value)) {
|
|
5068
5338
|
return null;
|
|
5069
5339
|
}
|
|
5070
|
-
const bare = value
|
|
5340
|
+
const { path: bare, suffix } = splitRefSuffix(value);
|
|
5071
5341
|
let decoded;
|
|
5072
5342
|
try {
|
|
5073
5343
|
decoded = decodeURIComponent(bare);
|
|
5074
5344
|
} catch {
|
|
5075
5345
|
return null;
|
|
5076
5346
|
}
|
|
5077
|
-
const target =
|
|
5347
|
+
const target = joinProjectPath(entryDir, decoded);
|
|
5078
5348
|
if (target === null) {
|
|
5079
5349
|
return null;
|
|
5080
5350
|
}
|
|
@@ -5082,76 +5352,39 @@ function mountedRefFor(value, entryDir, mount) {
|
|
|
5082
5352
|
if (!url) {
|
|
5083
5353
|
return null;
|
|
5084
5354
|
}
|
|
5085
|
-
return `${url}${
|
|
5086
|
-
}
|
|
5087
|
-
function rewriteNode(node, entryDir, mount) {
|
|
5088
|
-
const record = node;
|
|
5089
|
-
let patch = null;
|
|
5090
|
-
for (const key of ASSET_KEYS) {
|
|
5091
|
-
const value = record[key];
|
|
5092
|
-
if (typeof value === "string") {
|
|
5093
|
-
const rewritten = mountedRefFor(value, entryDir, mount);
|
|
5094
|
-
if (rewritten) {
|
|
5095
|
-
patch ??= {};
|
|
5096
|
-
patch[key] = rewritten;
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
|
-
}
|
|
5100
|
-
const attributes = record.attributes;
|
|
5101
|
-
if (attributes) {
|
|
5102
|
-
let nextAttrs = null;
|
|
5103
|
-
for (const key of ASSET_KEYS) {
|
|
5104
|
-
const value = attributes[key];
|
|
5105
|
-
if (typeof value === "string") {
|
|
5106
|
-
const rewritten = mountedRefFor(value, entryDir, mount);
|
|
5107
|
-
if (rewritten) {
|
|
5108
|
-
nextAttrs ??= { ...attributes };
|
|
5109
|
-
nextAttrs[key] = rewritten;
|
|
5110
|
-
}
|
|
5111
|
-
}
|
|
5112
|
-
}
|
|
5113
|
-
if (nextAttrs) {
|
|
5114
|
-
patch ??= {};
|
|
5115
|
-
patch.attributes = nextAttrs;
|
|
5116
|
-
}
|
|
5117
|
-
}
|
|
5118
|
-
const children = record.children;
|
|
5119
|
-
if (Array.isArray(children)) {
|
|
5120
|
-
let nextChildren = null;
|
|
5121
|
-
for (const [i, child] of children.entries()) {
|
|
5122
|
-
if (!child || typeof child !== "object") {
|
|
5123
|
-
continue;
|
|
5124
|
-
}
|
|
5125
|
-
const rewrittenChild = rewriteNode(child, entryDir, mount);
|
|
5126
|
-
if (rewrittenChild !== child) {
|
|
5127
|
-
nextChildren ??= [...children];
|
|
5128
|
-
nextChildren[i] = rewrittenChild;
|
|
5129
|
-
}
|
|
5130
|
-
}
|
|
5131
|
-
if (nextChildren) {
|
|
5132
|
-
patch ??= {};
|
|
5133
|
-
patch.children = nextChildren;
|
|
5134
|
-
}
|
|
5135
|
-
}
|
|
5136
|
-
return patch ? { ...node, ...patch } : node;
|
|
5355
|
+
return `${url}${suffix}`;
|
|
5137
5356
|
}
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5357
|
+
|
|
5358
|
+
// src/canvas/asset-refs.ts
|
|
5359
|
+
function projectLocales() {
|
|
5360
|
+
return resolveI18n(projectState?.projectConfig ?? {}).i18n?.locales ?? [];
|
|
5361
|
+
}
|
|
5362
|
+
function assetContextFor(documentPath, over) {
|
|
5363
|
+
const space = over?.space ?? "site";
|
|
5364
|
+
const mount = contentMountFor(documentPath, projectState?.projectConfig?.content, projectLocales());
|
|
5365
|
+
if (space === "site" && !mount) {
|
|
5366
|
+
return null;
|
|
5142
5367
|
}
|
|
5143
|
-
return
|
|
5368
|
+
return {
|
|
5369
|
+
documentDir: dirOfPath(documentPath ?? ""),
|
|
5370
|
+
...over?.fileBaseUrl === undefined ? {} : { fileBaseUrl: over.fileBaseUrl },
|
|
5371
|
+
lanes: BUILD_LANES,
|
|
5372
|
+
mounts: mount ? [mount] : [],
|
|
5373
|
+
space
|
|
5374
|
+
};
|
|
5144
5375
|
}
|
|
5145
5376
|
function previewAssetSrc(value) {
|
|
5146
5377
|
if (!value) {
|
|
5147
5378
|
return value;
|
|
5148
5379
|
}
|
|
5149
|
-
const
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5380
|
+
const ctx = assetContextFor(activeTab.value?.documentPath, hostAssetDeclarations());
|
|
5381
|
+
return loopbackAssetSrc(resolveAssetRef(value, ctx) ?? value);
|
|
5382
|
+
}
|
|
5383
|
+
function hostAssetDeclarations() {
|
|
5384
|
+
return {
|
|
5385
|
+
fileBaseUrl: documentBase(projectState?.projectRoot),
|
|
5386
|
+
...hasPlatform() ? { space: getPlatform().assetSpace } : {}
|
|
5387
|
+
};
|
|
5155
5388
|
}
|
|
5156
5389
|
|
|
5157
5390
|
// src/canvas/canvas-live-render.ts
|
|
@@ -5221,7 +5454,12 @@ async function resolveCanvasDocument(doc, tab) {
|
|
|
5221
5454
|
}
|
|
5222
5455
|
}
|
|
5223
5456
|
}
|
|
5224
|
-
const
|
|
5457
|
+
const fileBase = documentBase(projectState?.projectRoot);
|
|
5458
|
+
const docBase = S.documentPath ? new URL(S.documentPath, fileBase).href : undefined;
|
|
5459
|
+
const assets = assetContextFor(S.documentPath, {
|
|
5460
|
+
fileBaseUrl: fileBase,
|
|
5461
|
+
...hasPlatform() ? { space: getPlatform().assetSpace } : {}
|
|
5462
|
+
});
|
|
5225
5463
|
if (isPage && tab) {
|
|
5226
5464
|
const { previewParams } = tab.session.ui;
|
|
5227
5465
|
if (previewParams && Object.keys(previewParams).length > 0) {
|
|
@@ -5236,7 +5474,6 @@ async function resolveCanvasDocument(doc, tab) {
|
|
|
5236
5474
|
renderDoc = substitutePreviewProps(renderDoc, previewProps);
|
|
5237
5475
|
}
|
|
5238
5476
|
}
|
|
5239
|
-
renderDoc = rewriteContentAssets(renderDoc, S.documentPath, projectState?.projectConfig?.content);
|
|
5240
5477
|
const arrayPaths = new Set;
|
|
5241
5478
|
if (canvasMode === "design" || canvasMode === "edit") {
|
|
5242
5479
|
(function findArrayPaths(node, path) {
|
|
@@ -5320,6 +5557,7 @@ async function resolveCanvasDocument(doc, tab) {
|
|
|
5320
5557
|
renderDoc.$head = head;
|
|
5321
5558
|
}
|
|
5322
5559
|
return {
|
|
5560
|
+
assets,
|
|
5323
5561
|
docBase,
|
|
5324
5562
|
mapperCtx: {
|
|
5325
5563
|
arrayPaths: [...arrayPaths],
|
|
@@ -7375,6 +7613,7 @@ function preparePassRender(gen, doc, tabId, viewTab, paneId) {
|
|
|
7375
7613
|
const formatElements = formatByName(renderTab?.doc.sourceFormat)?.studio?.elements;
|
|
7376
7614
|
const editableTags = formatElements ? formatEditableVerdicts(formatElements) : undefined;
|
|
7377
7615
|
return {
|
|
7616
|
+
assets: resolved.assets,
|
|
7378
7617
|
doc: cloneableDoc,
|
|
7379
7618
|
docBase: resolved.docBase ?? `${canvasBaseOrigin()}/`,
|
|
7380
7619
|
mapperCtx: resolved.mapperCtx,
|
|
@@ -7421,6 +7660,7 @@ function mountStylebookCanvas(gen, generated, canvasEl, widthPx) {
|
|
|
7421
7660
|
const cloneableDoc = JSON.parse(JSON.stringify(generated.doc));
|
|
7422
7661
|
const cloneableShadow = JSON.parse(JSON.stringify(generated.doc));
|
|
7423
7662
|
const message = {
|
|
7663
|
+
assets: null,
|
|
7424
7664
|
colorScheme: schemeWireFor(tabOfContainer(canvasEl)),
|
|
7425
7665
|
doc: cloneableDoc,
|
|
7426
7666
|
docBase: `${canvasBaseOrigin()}/`,
|
|
@@ -7613,7 +7853,7 @@ function openPageAction(label = "Open a page…") {
|
|
|
7613
7853
|
return {
|
|
7614
7854
|
label,
|
|
7615
7855
|
run: () => {
|
|
7616
|
-
import("./quick-search-
|
|
7856
|
+
import("./quick-search-sefb61v8.js").then((m) => {
|
|
7617
7857
|
m.openQuickSearch();
|
|
7618
7858
|
});
|
|
7619
7859
|
}
|
|
@@ -7883,7 +8123,7 @@ function railPanelSet() {
|
|
|
7883
8123
|
return RAIL_GROUP_LEVELS.flatMap(({ level }) => railable.filter((panel) => panel.level === level));
|
|
7884
8124
|
}
|
|
7885
8125
|
|
|
7886
|
-
export { KEY_SCOPES, CATEGORIES, checkRecordPlacements, intlHelpersClause, PURE_METHOD_OPS, BLESSED_OPERATORS, BLESSED_GLOBALS, isMutating, evaluateExpression, rectOf, loopbackAssetSrc, getPreviewNavigateHandler, activeCanvasSurface, tabOfPane, derivationOfPane, surfacesShowingTab, canvasModeOfTab, canvasModeOfPane, activeMediaOfPane, paneOfContainer, tabOfContainer, dynamicRouteParams, documentUrlPattern, pagePathsDef, invalidateParamValues, loadParamValues, isComponentDoc, componentPropEntries, contentMountFor, previewAssetSrc, SPAN_FULL_RENDER, SPAN_MOUNT_CANVAS, SPAN_PATCH_BATCH, canvasPerf, recordEscalation, timeSpan, timeSpanAsync, mediaDisplayName, defaultDef, parentCursorToIframe, serializeJxPath, elements_meta_default, getInlineActions, isInlineElement, isEditing, bubbleInlinePath, stageZoom, canvasPanelTemplate, observeCenterUntilStable, applyTransform, applyEditZoom, setEditZoom, requestEditZoom, fitToScreen, getFit, setFit, markExplicitZoom, setUserZoom, fitOnCanvasEntry, resetZoom, panToElement, canvasBaseViewsFor, canvasBaseViewOf, previewStateOf, setCanvasView, registerCanvasViewCommands, updateActivePanelHeaders, setDragGhost, moveDragGhost, clearDragGhost, disableNativeDragPreview, attachInstruction, extractInstruction, hasElement, enableElement, disableElement, removePackageElements, removeElementRef, setSkipServerFunctions, runScoped, buildScope, renderNode, pureSchemeOf, renderComponentPreview, registerLayersDnD, registerComponentsDnD, registerElementsDnD, applyDropInstruction, sawIframeDragOver, allowAutoRequestsOnNextRender, requestCanvasEval, flushCanvasEdits, liveDragHostAt, beginDragSession, currentDragSession, hostDragGeometry, canvasIdleBlockers, canvasPointAt, revealCanvasPath, adoptCanvasPreviewMode, postDragMessage, endDragSession, clearDropIndicator, setNativeDragEnterHandler, setInsertZoneClickHandler, setFileDropHandler, setCanvasSlashHandler, setCanvasContextMenuHandler, setStylebookHitHandler, isCaretActive, setToolbarRefresh, setCanvasPointerDownHandler, setIframePatchEscalation, postPatchToHosts, dragHostTab, releaseCanvasHosts, mountIframeCanvas, mountStylebookCanvas, postColorSchemeToLiveHosts, postLocaleToLiveHosts, postSiteStyleToLiveHosts, postStyleUpdateToStylebookHosts, panToStylebookTag, getEditSnapshot, setKeymapSource, postApplyFormat, postOpenSlash, commitActiveEditSession, getEditBarAnchorRect, clickAnythingTo, staleSelectionMessage, openPageAction, renderEmptyState, panelContext, registerPanel, getPanel, listPanels, isPanelVisible, railGroups, railPanelSet };
|
|
8126
|
+
export { KEY_SCOPES, CATEGORIES, checkRecordPlacements, intlHelpersClause, PURE_METHOD_OPS, BLESSED_OPERATORS, BLESSED_GLOBALS, isMutating, evaluateExpression, rectOf, loopbackAssetSrc, getPreviewNavigateHandler, activeCanvasSurface, tabOfPane, derivationOfPane, surfacesShowingTab, canvasModeOfTab, canvasModeOfPane, activeMediaOfPane, paneOfContainer, tabOfContainer, dynamicRouteParams, documentUrlPattern, pagePathsDef, invalidateParamValues, loadParamValues, isComponentDoc, componentPropEntries, PUBLIC_DIR, normalizeProjectPath, encodeProjectPath, contentMountFor, resolveAssetRef, projectLocales, assetContextFor, previewAssetSrc, hostAssetDeclarations, SPAN_FULL_RENDER, SPAN_MOUNT_CANVAS, SPAN_PATCH_BATCH, canvasPerf, recordEscalation, timeSpan, timeSpanAsync, mediaDisplayName, defaultDef, parentCursorToIframe, serializeJxPath, elements_meta_default, getInlineActions, isInlineElement, isEditing, bubbleInlinePath, stageZoom, canvasPanelTemplate, observeCenterUntilStable, applyTransform, applyEditZoom, setEditZoom, requestEditZoom, fitToScreen, getFit, setFit, markExplicitZoom, setUserZoom, fitOnCanvasEntry, resetZoom, panToElement, canvasBaseViewsFor, canvasBaseViewOf, previewStateOf, setCanvasView, registerCanvasViewCommands, updateActivePanelHeaders, setDragGhost, moveDragGhost, clearDragGhost, disableNativeDragPreview, attachInstruction, extractInstruction, hasElement, enableElement, disableElement, removePackageElements, removeElementRef, setSkipServerFunctions, runScoped, setCanvasAssetResolver, buildScope, renderNode, pureSchemeOf, renderComponentPreview, registerLayersDnD, registerComponentsDnD, registerElementsDnD, applyDropInstruction, sawIframeDragOver, allowAutoRequestsOnNextRender, requestCanvasEval, flushCanvasEdits, liveDragHostAt, beginDragSession, currentDragSession, hostDragGeometry, canvasIdleBlockers, canvasPointAt, revealCanvasPath, adoptCanvasPreviewMode, postDragMessage, endDragSession, clearDropIndicator, setNativeDragEnterHandler, setInsertZoneClickHandler, setFileDropHandler, setCanvasSlashHandler, setCanvasContextMenuHandler, setStylebookHitHandler, isCaretActive, setToolbarRefresh, setCanvasPointerDownHandler, setIframePatchEscalation, postPatchToHosts, dragHostTab, releaseCanvasHosts, mountIframeCanvas, mountStylebookCanvas, postColorSchemeToLiveHosts, postLocaleToLiveHosts, postSiteStyleToLiveHosts, postStyleUpdateToStylebookHosts, panToStylebookTag, getEditSnapshot, setKeymapSource, postApplyFormat, postOpenSlash, commitActiveEditSession, getEditBarAnchorRect, clickAnythingTo, staleSelectionMessage, openPageAction, renderEmptyState, panelContext, registerPanel, getPanel, listPanels, isPanelVisible, railGroups, railPanelSet };
|
|
7887
8127
|
|
|
7888
|
-
//# debugId=
|
|
7889
|
-
//# sourceMappingURL=studio-
|
|
8128
|
+
//# debugId=A13D4D75476DBAED64756E2164756E21
|
|
8129
|
+
//# sourceMappingURL=studio-j595e748.js.map
|