@jxsuite/studio 2.4.3 → 4.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/README.md +5 -5
- package/dist/chunks/Overlay.dev-723bv0df.js +23 -0
- package/dist/chunks/cf-settings-45fgyx8y.js +21 -0
- package/dist/chunks/{components-z6cnkyy1.js → components-zmx10t62.js} +6 -5
- package/dist/chunks/content-source-t88vb2dr.js +49 -0
- package/dist/chunks/{convert-to-repeater-k10dvcc7.js → convert-to-repeater-dhw1nrz9.js} +27 -18
- package/dist/chunks/entry-commands-6z6bhxg0.js +46 -0
- package/dist/chunks/{extension-sections-0ada0xcw.js → extension-sections-3ydgjbdy.js} +32 -23
- package/dist/chunks/file-ops-rskmhxyq.js +48 -0
- package/dist/chunks/files-0cratsr0.js +92 -0
- package/dist/chunks/{format-host-wewba4nq.js → format-host-tgcmfs4p.js} +3 -3
- package/dist/chunks/fs-events-hrrg328g.js +21 -0
- package/dist/chunks/{git-panel-2dh1aw50.js → git-panel-0yywyk76.js} +21 -15
- package/dist/chunks/{jx-validate-jj9rnt4n.js → jx-validate-8q2g05x1.js} +6 -4
- package/dist/chunks/layers-panel-z3tqe5cd.js +67 -0
- package/dist/chunks/layers-q75tj2mf.js +45 -0
- package/dist/chunks/lit-html-j055mkh8.js +22 -0
- package/dist/chunks/monaco-buffer-dqw0xxpx.js +25 -0
- package/dist/chunks/{monaco-setup-a5wkmbgh.js → monaco-setup-rws7k4br.js} +4 -4
- package/dist/chunks/notify-yjm79n4s.js +30 -0
- package/dist/chunks/parse-24d0gay3.js +19 -0
- package/dist/chunks/platform-ba1j1gbh.js +16 -0
- package/dist/chunks/publish-panel-54jvhskq.js +28 -0
- package/dist/chunks/quick-search-cgfmjwq5.js +65 -0
- package/dist/chunks/references-3qx8fkyp.js +29 -0
- package/dist/chunks/right-panel-cqp8bc4v.js +46 -0
- package/dist/chunks/sp-overlay.dev-yztmtrs1.js +18 -0
- package/dist/chunks/sp-popover.dev-n2etmqdp.js +9 -0
- package/dist/chunks/sp-progress-circle.dev-hryhj0es.js +15 -0
- package/dist/chunks/sp-tooltip.dev-xcvpnqr0.js +15 -0
- package/dist/chunks/{sp-tray.dev-64v4pxw8.js → sp-tray.dev-tkbscm06.js} +5 -5
- package/dist/chunks/{studio-f5yyvqxv.js → studio-1hbqnt19.js} +37 -31
- package/dist/chunks/studio-2zkz8evn.js +3163 -0
- package/dist/chunks/{studio-0b6fs05q.js → studio-4pqqxbrt.js} +23 -15
- package/dist/chunks/{studio-kvfx9z2c.js → studio-4rzyrtjz.js} +70 -31
- package/dist/chunks/{studio-ef8t53vc.js → studio-5q69gfag.js} +60 -56
- package/dist/chunks/{studio-v2c5pmjj.js → studio-5rywrkxz.js} +565 -133
- package/dist/chunks/{studio-6kv3apa9.js → studio-68n67094.js} +25 -9
- package/dist/chunks/{studio-0rqqhrdy.js → studio-7nte2hj4.js} +2 -2
- package/dist/chunks/{studio-hyn3vhwr.js → studio-8swrjbny.js} +31 -18
- package/dist/chunks/studio-92ab2jqe.js +282 -0
- package/dist/chunks/{studio-sas7mt3k.js → studio-9ab8gqsm.js} +2 -2
- package/dist/chunks/{studio-28xc8ws4.js → studio-9c4k4vhv.js} +14 -10
- package/dist/chunks/studio-9n4mrmnb.js +184 -0
- package/dist/chunks/{studio-tr20m8g8.js → studio-9r6j5ev1.js} +37 -2
- package/dist/chunks/{studio-aweyr4v1.js → studio-ahjfdy6e.js} +9 -7
- package/dist/chunks/{studio-s519zc99.js → studio-bgxt93ga.js} +3 -3
- package/dist/chunks/{studio-26sv44br.js → studio-cb12yz9w.js} +8543 -8784
- package/dist/chunks/studio-cft9r4r7.js +119 -0
- package/dist/chunks/{studio-rqemfhz6.js → studio-eenfkt4e.js} +6 -6
- package/dist/chunks/studio-eesa1myv.js +498 -0
- package/dist/chunks/{studio-ay8wcr2b.js → studio-eqq1w638.js} +7 -9
- package/dist/chunks/{studio-ke244pam.js → studio-ex8zyp98.js} +51 -25
- package/dist/chunks/studio-gv8vvshc.js +118 -0
- package/dist/chunks/studio-hbtp0eh1.js +1315 -0
- package/dist/chunks/{studio-cz2j1c0g.js → studio-htsf0w6m.js} +75 -123
- package/dist/chunks/{studio-pyrw8h0w.js → studio-kjjsjak4.js} +528 -212
- package/dist/chunks/{studio-5x5774ak.js → studio-kryvsw6j.js} +3 -3
- package/dist/chunks/studio-kyh9avvv.js +28 -0
- package/dist/chunks/{studio-jnakhg87.js → studio-kyk2v92a.js} +14 -14
- package/dist/chunks/{studio-twsafr1e.js → studio-m3hwn7y1.js} +3 -3
- package/dist/chunks/{studio-tzx3xmvx.js → studio-mmv72a27.js} +8 -8
- package/dist/chunks/{studio-vhk5fmfv.js → studio-n8b9wqwy.js} +5 -5
- package/dist/chunks/{studio-cjm7fdjf.js → studio-p4ngc046.js} +8 -104
- package/dist/chunks/{studio-sccge2wf.js → studio-p8j86wag.js} +2 -2
- package/dist/chunks/{studio-v1va0vhd.js → studio-pdfjntbk.js} +75 -139
- package/dist/chunks/studio-q43a5y9h.js +394 -0
- package/dist/chunks/studio-q7v10cg2.js +106 -0
- package/dist/chunks/{studio-2w11grav.js → studio-qq6jym04.js} +3 -3
- package/dist/chunks/studio-r1r7afxx.js +1066 -0
- package/dist/chunks/{studio-3fk1ac9z.js → studio-rdx8jcxy.js} +4 -4
- package/dist/chunks/{studio-4mqb9a0j.js → studio-rn9ta2mz.js} +4 -4
- package/dist/chunks/studio-sf7zjgv1.js +91 -0
- package/dist/chunks/studio-t7qb9db8.js +665 -0
- package/dist/chunks/studio-tmc5emrw.js +8 -0
- package/dist/chunks/{studio-wdt9y92a.js → studio-txwkm6p9.js} +2 -2
- package/dist/chunks/{studio-dgj7gq44.js → studio-v38hmvx1.js} +7 -7
- package/dist/chunks/{studio-7ejemhej.js → studio-vadzgkrz.js} +6 -6
- package/dist/chunks/studio-wcy8trfx.js +263 -0
- package/dist/chunks/{studio-hb7c46jy.js → studio-wx5609xd.js} +21 -15
- package/dist/chunks/studio-xrapxwwc.js +1539 -0
- package/dist/chunks/{studio-ws6ef6js.js → studio-yxrkyv8a.js} +41 -29
- package/dist/chunks/{studio-xm3dbxvn.js → studio-zczps70q.js} +2 -2
- package/dist/chunks/workspace-xpres40v.js +89 -0
- package/dist/iframe-entry.js +450 -48
- package/dist/studio.js +2455 -1761
- package/package.json +16 -15
- package/src/browse/library-layouts.ts +3 -3
- package/src/browse/library-pane.ts +59 -5
- 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/canvas-render.ts +23 -1
- package/src/canvas/iframe-entry.ts +1 -0
- package/src/canvas/iframe-host.ts +4 -0
- package/src/canvas/iframe-patch.ts +47 -21
- package/src/canvas/iframe-protocol.ts +9 -0
- package/src/canvas/iframe-render.ts +50 -16
- package/src/commands/app-commands.ts +4 -0
- package/src/commands/command-args.ts +29 -0
- package/src/commands/context.ts +15 -1
- package/src/commands/defaults.ts +29 -1
- package/src/commands/levels.ts +16 -0
- package/src/commands/live-context.ts +3 -0
- package/src/content/collection-match.ts +267 -0
- package/src/content/entry-commands.ts +38 -29
- package/src/content/entry-fields.ts +6 -0
- package/src/editor/file-drop-action.ts +2 -1
- package/src/editor/shortcuts.ts +5 -0
- package/src/files/file-ops.ts +10 -42
- package/src/files/files.ts +487 -61
- package/src/files/fs-events.ts +9 -0
- package/src/files/gitignore.ts +432 -0
- package/src/files/media-paths.ts +37 -14
- package/src/files/media-upload.ts +47 -6
- package/src/files/serialize-document.ts +60 -0
- package/src/format/convert-file.ts +511 -0
- package/src/format/format-choices.ts +199 -0
- package/src/grid/grid-idle.ts +45 -0
- package/src/grid/grid-view.ts +35 -0
- package/src/grid/schema-columns.ts +2 -1
- package/src/grid/sources/content-source.ts +24 -3
- package/src/media/media-open.ts +58 -0
- package/src/media/media-pane.ts +310 -0
- package/src/new-project/import-tab.ts +333 -160
- package/src/new-project/new-project-modal.ts +27 -34
- package/src/packages/ensure-deps.ts +14 -7
- package/src/packages/jxsuite-update.ts +11 -11
- package/src/page-params.ts +10 -46
- package/src/panels/activity-bar.ts +45 -16
- package/src/panels/ai-chat/attached-context.ts +6 -1
- package/src/panels/ai-chat/chat-view.ts +255 -13
- package/src/panels/ai-chat/composer.ts +21 -80
- package/src/panels/ai-panel.ts +116 -2
- package/src/panels/frontmatter-fields.ts +6 -2
- package/src/panels/navigator-panels.ts +7 -6
- package/src/panels/properties-panel.ts +8 -2
- package/src/panels/seo-modal.ts +5 -6
- package/src/panels/settings-menu.ts +799 -0
- package/src/panels/signals-panel.ts +2 -1
- package/src/panels/toolbar.ts +135 -15
- package/src/platforms/cloud.ts +34 -3
- package/src/platforms/devserver.ts +72 -34
- package/src/preview/preview-overlay.ts +226 -0
- package/src/services/ai-ask.ts +247 -0
- package/src/services/ai-import-tools.ts +494 -0
- package/src/services/ai-models.ts +101 -11
- package/src/services/ai-project-tools.ts +20 -26
- package/src/services/ai-settings.ts +69 -71
- package/src/services/ai-system-prompt.ts +88 -2
- package/src/services/ai-turn-signal.ts +70 -0
- package/src/services/cf-settings.ts +19 -37
- package/src/services/connection.ts +74 -0
- package/src/services/context-manager.ts +89 -0
- package/src/services/document-assistant.ts +49 -7
- package/src/services/idle.ts +6 -1
- package/src/services/import-client.ts +33 -6
- package/src/services/import-run.ts +158 -0
- package/src/services/import-seed.ts +120 -0
- package/src/services/jx-validate.ts +58 -6
- package/src/services/project-adoption.ts +71 -0
- package/src/services/references.ts +0 -0
- package/src/services/settings/definitions.ts +181 -0
- package/src/services/settings/kernel.ts +335 -0
- package/src/services/settings/write-queue.ts +116 -0
- package/src/services/tool-executor.ts +34 -2
- package/src/settings/contexts-section.ts +45 -3
- package/src/settings/dependencies-editor.ts +43 -23
- package/src/settings/general-settings.ts +30 -12
- package/src/settings/preferences-accounts.ts +6 -19
- package/src/settings/preferences-dialog.ts +18 -41
- package/src/settings/preferences-keymap.ts +8 -18
- package/src/settings/preferences-sections.ts +57 -0
- package/src/settings/schema-field-ui.ts +2 -2
- package/src/settings/settings-document.ts +65 -9
- package/src/shell.ts +6 -14
- package/src/studio.ts +65 -7
- package/src/tabs/transact.ts +42 -19
- package/src/types.ts +164 -8
- package/src/ui/ai-credentials-form.ts +52 -27
- package/src/ui/ai-model-picker.ts +162 -0
- package/src/ui/choice-field.ts +72 -0
- package/src/ui/layers.ts +83 -5
- package/src/ui/media-picker.ts +6 -11
- package/src/utils/studio-utils.ts +43 -31
- package/styles/forced-colors.css +7 -0
- package/styles/overlays.css +256 -0
- package/styles/panels.css +13 -1
- package/styles/shell.css +111 -0
- package/dist/chunks/Overlay.dev-d2ajy6sj.js +0 -23
- package/dist/chunks/cf-settings-g5fbf2zp.js +0 -17
- package/dist/chunks/content-source-k9724vcv.js +0 -39
- package/dist/chunks/files-yew27sn9.js +0 -69
- package/dist/chunks/layers-panel-qnsghwwd.js +0 -59
- package/dist/chunks/publish-panel-a0pdft5w.js +0 -21
- package/dist/chunks/quick-search-9avyc4pc.js +0 -54
- package/dist/chunks/right-panel-kcnhtc5j.js +0 -38
- package/dist/chunks/sp-overlay.dev-s18hymn9.js +0 -18
- package/dist/chunks/sp-popover.dev-dj9x7e7a.js +0 -9
- package/dist/chunks/sp-progress-circle.dev-0zxcyz3r.js +0 -15
- package/dist/chunks/sp-tooltip.dev-5c6d1kjz.js +0 -15
- package/dist/chunks/studio-a7pzveq1.js +0 -110
- package/dist/chunks/studio-c31yb4t6.js +0 -55
- package/dist/chunks/studio-ra7ar50f.js +0 -6682
- package/src/canvas/content-assets.ts +0 -263
- package/src/canvas/site-style-css.ts +0 -121
- package/src/services/settings-store.ts +0 -99
|
@@ -1,125 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
PUBLIC_DIR,
|
|
3
|
+
contentMountFor,
|
|
4
|
+
encodeProjectPath,
|
|
5
|
+
hostAssetDeclarations,
|
|
6
|
+
loopbackAssetSrc,
|
|
7
|
+
normalizeProjectPath,
|
|
8
|
+
projectLocales
|
|
9
|
+
} from "./studio-kjjsjak4.js";
|
|
10
|
+
import {
|
|
11
|
+
errorMessage
|
|
12
|
+
} from "./studio-9n4mrmnb.js";
|
|
13
|
+
import {
|
|
14
|
+
activeTab
|
|
15
|
+
} from "./studio-2zkz8evn.js";
|
|
4
16
|
import {
|
|
5
|
-
activeTab,
|
|
6
|
-
errorMessage,
|
|
7
17
|
notify
|
|
8
|
-
} from "./studio-
|
|
18
|
+
} from "./studio-xrapxwwc.js";
|
|
9
19
|
import {
|
|
10
20
|
getNodeAtPath,
|
|
11
|
-
isJsonObject,
|
|
12
|
-
paramNames,
|
|
13
21
|
projectState
|
|
14
|
-
} from "./studio-
|
|
22
|
+
} from "./studio-p4ngc046.js";
|
|
23
|
+
import {
|
|
24
|
+
isJsonObject,
|
|
25
|
+
paramNames
|
|
26
|
+
} from "./studio-q7v10cg2.js";
|
|
15
27
|
import {
|
|
16
28
|
loadedMonaco
|
|
17
|
-
} from "./studio-
|
|
29
|
+
} from "./studio-eenfkt4e.js";
|
|
18
30
|
import {
|
|
19
31
|
getPlatform,
|
|
20
32
|
hasPlatform
|
|
21
|
-
} from "./studio-
|
|
22
|
-
|
|
23
|
-
// src/services/references.ts
|
|
24
|
-
function usagesSupported() {
|
|
25
|
-
return hasPlatform() && typeof getPlatform().findReferences === "function";
|
|
26
|
-
}
|
|
27
|
-
function keyOf(query) {
|
|
28
|
-
return `${query.path ?? ""}\x00${query.tagName ?? ""}`;
|
|
29
|
-
}
|
|
30
|
-
var settled = new Map;
|
|
31
|
-
var inFlight = new Map;
|
|
32
|
-
function peekUsages(query) {
|
|
33
|
-
if (!usagesSupported()) {
|
|
34
|
-
return { status: "unsupported" };
|
|
35
|
-
}
|
|
36
|
-
return settled.get(keyOf(query)) ?? (inFlight.has(keyOf(query)) ? { status: "pending" } : null);
|
|
37
|
-
}
|
|
38
|
-
async function loadUsages(query) {
|
|
39
|
-
if (!usagesSupported()) {
|
|
40
|
-
return { status: "unsupported" };
|
|
41
|
-
}
|
|
42
|
-
if (!query.path && !query.tagName) {
|
|
43
|
-
return { status: "failed", message: "no target to look for" };
|
|
44
|
-
}
|
|
45
|
-
const key = keyOf(query);
|
|
46
|
-
const done = settled.get(key);
|
|
47
|
-
if (done) {
|
|
48
|
-
return done;
|
|
49
|
-
}
|
|
50
|
-
const running = inFlight.get(key);
|
|
51
|
-
if (running) {
|
|
52
|
-
return running;
|
|
53
|
-
}
|
|
54
|
-
const pending = (async () => {
|
|
55
|
-
try {
|
|
56
|
-
const result = await getPlatform().findReferences({
|
|
57
|
-
...query.path === undefined ? {} : { path: query.path },
|
|
58
|
-
...query.tagName === undefined ? {} : { tagName: query.tagName }
|
|
59
|
-
});
|
|
60
|
-
return { result, status: "ready" };
|
|
61
|
-
} catch (error) {
|
|
62
|
-
return { message: errorMessage(error), status: "failed" };
|
|
63
|
-
} finally {
|
|
64
|
-
inFlight.delete(key);
|
|
65
|
-
}
|
|
66
|
-
})();
|
|
67
|
-
inFlight.set(key, pending);
|
|
68
|
-
const state = await pending;
|
|
69
|
-
settled.set(key, state);
|
|
70
|
-
return state;
|
|
71
|
-
}
|
|
72
|
-
function retryUsages(query) {
|
|
73
|
-
settled.delete(keyOf(query));
|
|
74
|
-
return loadUsages(query);
|
|
75
|
-
}
|
|
76
|
-
function invalidateUsages() {
|
|
77
|
-
settled.clear();
|
|
78
|
-
}
|
|
79
|
-
function splitUsages(result) {
|
|
80
|
-
let pages = 0;
|
|
81
|
-
for (const file of result.files) {
|
|
82
|
-
if (file.path.startsWith("pages/")) {
|
|
83
|
-
pages += 1;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return { others: result.files.length - pages, pages };
|
|
87
|
-
}
|
|
88
|
-
function usageHeadline(result) {
|
|
89
|
-
const { others, pages } = splitUsages(result);
|
|
90
|
-
if (pages === 0 && others === 0) {
|
|
91
|
-
return "Not used yet";
|
|
92
|
-
}
|
|
93
|
-
const parts = [];
|
|
94
|
-
if (pages > 0) {
|
|
95
|
-
parts.push(`${pages} page${pages === 1 ? "" : "s"}`);
|
|
96
|
-
}
|
|
97
|
-
if (others > 0) {
|
|
98
|
-
parts.push(`${others} other file${others === 1 ? "" : "s"}`);
|
|
99
|
-
}
|
|
100
|
-
return `Used on ${parts.join(" and ")}`;
|
|
101
|
-
}
|
|
102
|
-
function usageWarning(state, verb) {
|
|
103
|
-
if (state.status === "unsupported") {
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
if (state.status === "pending") {
|
|
107
|
-
return "Counting references…";
|
|
108
|
-
}
|
|
109
|
-
if (state.status === "failed") {
|
|
110
|
-
return `References could not be counted (${state.message}) — this may break more than it appears to.`;
|
|
111
|
-
}
|
|
112
|
-
const { files, refsTotal } = state.result;
|
|
113
|
-
if (files.length === 0) {
|
|
114
|
-
return verb === "delete" ? "Nothing else in this project refers to it." : "Nothing else in this project refers to it, so nothing needs updating.";
|
|
115
|
-
}
|
|
116
|
-
const where = `${refsTotal} reference${refsTotal === 1 ? "" : "s"} in ${files.length} file${files.length === 1 ? "" : "s"}`;
|
|
117
|
-
const floor = state.result.errors.length > 0 ? " (at least — some documents could not be read)" : "";
|
|
118
|
-
return verb === "delete" ? `${where}${floor} will break. Those files stay on disk; the references in them stop resolving.` : `${where}${floor} will be updated automatically. Nothing else changes.`;
|
|
119
|
-
}
|
|
120
|
-
function usageFiles(result) {
|
|
121
|
-
return result.files.toSorted((a, b) => b.count - a.count || a.path.localeCompare(b.path));
|
|
122
|
-
}
|
|
33
|
+
} from "./studio-9ab8gqsm.js";
|
|
123
34
|
|
|
124
35
|
// src/files/media-upload.ts
|
|
125
36
|
var IMAGE_EXTENSIONS = new Set([
|
|
@@ -145,7 +56,17 @@ var MEDIA_EXTENSIONS = new Set([
|
|
|
145
56
|
".ttf",
|
|
146
57
|
".otf"
|
|
147
58
|
]);
|
|
148
|
-
|
|
59
|
+
function formatBytes(bytes) {
|
|
60
|
+
const units = ["B", "KB", "MB", "GB"];
|
|
61
|
+
let value = bytes;
|
|
62
|
+
let unit = 0;
|
|
63
|
+
while (value >= 1024 && unit < units.length - 1) {
|
|
64
|
+
value /= 1024;
|
|
65
|
+
unit += 1;
|
|
66
|
+
}
|
|
67
|
+
return `${unit === 0 ? value : Number(value.toFixed(1))} ${units[unit]}`;
|
|
68
|
+
}
|
|
69
|
+
var DEFAULT_ACCEPT = [
|
|
149
70
|
"image/*",
|
|
150
71
|
"video/*",
|
|
151
72
|
"audio/*",
|
|
@@ -156,6 +77,10 @@ var UPLOAD_ACCEPT = [
|
|
|
156
77
|
".ttf",
|
|
157
78
|
".otf"
|
|
158
79
|
].join(",");
|
|
80
|
+
function uploadAccept() {
|
|
81
|
+
const declared = hasPlatform() ? getPlatform().assetCapabilities?.accept : undefined;
|
|
82
|
+
return declared ?? DEFAULT_ACCEPT;
|
|
83
|
+
}
|
|
159
84
|
function extensionOf(name) {
|
|
160
85
|
const dot = name.lastIndexOf(".");
|
|
161
86
|
return dot > 0 ? name.slice(dot).toLowerCase() : "";
|
|
@@ -242,18 +167,26 @@ async function uploadAssets(files, opts = {}) {
|
|
|
242
167
|
} catch {
|
|
243
168
|
taken = new Set;
|
|
244
169
|
}
|
|
170
|
+
const maxBytes = hasPlatform() ? getPlatform().assetCapabilities?.maxUploadBytes : undefined;
|
|
245
171
|
const uploaded = [];
|
|
246
172
|
for (const file of list) {
|
|
173
|
+
if (maxBytes !== undefined && file.size > maxBytes) {
|
|
174
|
+
notify.error(`${file.name} is too large.`, {
|
|
175
|
+
detail: `This backend accepts at most ${formatBytes(maxBytes)}; that file is ${formatBytes(file.size)}.`,
|
|
176
|
+
source: "Media"
|
|
177
|
+
});
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
247
180
|
const name = uniqueName(file.name, taken);
|
|
248
181
|
taken.add(name);
|
|
249
|
-
const
|
|
182
|
+
const requested = joinDir(dir, name);
|
|
250
183
|
try {
|
|
251
|
-
await platform.uploadFile(
|
|
184
|
+
const { path } = await platform.uploadFile(requested, file);
|
|
252
185
|
uploaded.push({ kind: mediaKind(file), name, path, ref: assetRef(path) });
|
|
253
186
|
} catch (error) {
|
|
254
187
|
notify.error(`Could not upload ${file.name}.`, {
|
|
255
188
|
detail: errorMessage(error),
|
|
256
|
-
path,
|
|
189
|
+
path: requested,
|
|
257
190
|
source: "Media"
|
|
258
191
|
});
|
|
259
192
|
}
|
|
@@ -273,6 +206,13 @@ async function codeService(action, payload) {
|
|
|
273
206
|
}
|
|
274
207
|
return platform.codeService(action, payload);
|
|
275
208
|
}
|
|
209
|
+
async function locateDocument(name) {
|
|
210
|
+
const platform = getPlatform();
|
|
211
|
+
if (!platform.locateFile) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
return platform.locateFile(name);
|
|
215
|
+
}
|
|
276
216
|
var pluginSchemaCache = new Map;
|
|
277
217
|
async function fetchPluginSchema(def, state) {
|
|
278
218
|
const importedPath = def.$prototype ? projectState?.projectConfig?.imports?.[def.$prototype] : null;
|
|
@@ -358,21 +298,22 @@ function getFunctionArgs(editing, document) {
|
|
|
358
298
|
}
|
|
359
299
|
|
|
360
300
|
// src/files/media-paths.ts
|
|
361
|
-
var PUBLIC_DIR = "public";
|
|
362
|
-
function normalizeProjectPath(path) {
|
|
363
|
-
return path.replaceAll("\\", "/").replace(/^\.\//, "").replace(/^\/+/, "").replace(/\/+$/, "");
|
|
364
|
-
}
|
|
365
301
|
function baseName(path) {
|
|
366
302
|
const normalized = normalizeProjectPath(path);
|
|
367
303
|
const slash = normalized.lastIndexOf("/");
|
|
368
304
|
return slash === -1 ? normalized : normalized.slice(slash + 1);
|
|
369
305
|
}
|
|
306
|
+
function dirName(path) {
|
|
307
|
+
const normalized = normalizeProjectPath(path);
|
|
308
|
+
const slash = normalized.lastIndexOf("/");
|
|
309
|
+
return slash === -1 ? "." : normalized.slice(0, slash);
|
|
310
|
+
}
|
|
370
311
|
function contentSections() {
|
|
371
312
|
const content = projectState?.projectConfig?.content;
|
|
372
313
|
return content ?? null;
|
|
373
314
|
}
|
|
374
315
|
function mountOf(path) {
|
|
375
|
-
return contentMountFor(path, contentSections());
|
|
316
|
+
return contentMountFor(path, contentSections(), projectLocales());
|
|
376
317
|
}
|
|
377
318
|
function mountedPath(path, mount) {
|
|
378
319
|
const prefix = normalizeProjectPath(mount.urlPrefix);
|
|
@@ -404,8 +345,19 @@ function authoredRefTargets(path) {
|
|
|
404
345
|
}
|
|
405
346
|
return targets;
|
|
406
347
|
}
|
|
348
|
+
function previewFileSrc(path) {
|
|
349
|
+
const normalized = normalizeProjectPath(path);
|
|
350
|
+
if (normalized === "") {
|
|
351
|
+
return path;
|
|
352
|
+
}
|
|
353
|
+
const { space, fileBaseUrl } = hostAssetDeclarations();
|
|
354
|
+
if (space === "repo") {
|
|
355
|
+
return `${fileBaseUrl}${encodeProjectPath(normalized)}`;
|
|
356
|
+
}
|
|
357
|
+
return loopbackAssetSrc(mediaSiteUrl(normalized));
|
|
358
|
+
}
|
|
407
359
|
|
|
408
|
-
export {
|
|
360
|
+
export { IMAGE_EXTENSIONS, MEDIA_EXTENSIONS, uploadAccept, extensionOf, isImage, isMediaFile, mediaKind, setMediaChangedHandler, uploadAssets, baseName, dirName, mediaSiteUrl, authoredRefTargets, previewFileSrc, codeService, locateDocument, pluginSchemaCache, fetchPluginSchema, setLintMarkers, getFunctionArgs };
|
|
409
361
|
|
|
410
|
-
//# debugId=
|
|
411
|
-
//# sourceMappingURL=studio-
|
|
362
|
+
//# debugId=380CBD6692440DE664756E2164756E21
|
|
363
|
+
//# sourceMappingURL=studio-htsf0w6m.js.map
|