@popcraft/kit 0.58.0 → 0.59.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/{agent-ZWJW7TXN.js → agent-S2XBIQEK.js} +1 -1
- package/dist/chunks/{builtin-3NZAFM36.js → builtin-YMJZTZMA.js} +3 -3
- package/dist/chunks/{buy-credits-ACWRLFRI.js → buy-credits-AK2XYG6U.js} +2 -2
- package/dist/chunks/{check-template-FU6VYPGY.js → check-template-7SY3WP7Y.js} +2 -2
- package/dist/chunks/{chunk-7GOK5Z4S.js → chunk-2RJMUSOT.js} +10 -0
- package/dist/chunks/{chunk-IVERC4O2.js → chunk-2YHYGCTT.js} +1 -1
- package/dist/chunks/{chunk-M74KRF34.js → chunk-5NTVUBIU.js} +13 -13
- package/dist/chunks/{chunk-UR7Z2GZ4.js → chunk-662GNCQQ.js} +9 -9
- package/dist/chunks/{chunk-3V7GW2AL.js → chunk-6ZFNAY5O.js} +46 -42
- package/dist/chunks/{chunk-DC575FGN.js → chunk-7EBRN34K.js} +1 -1
- package/dist/chunks/{chunk-4BKCAVPJ.js → chunk-7OVPRHIN.js} +6 -6
- package/dist/chunks/{chunk-S4FHLZ2G.js → chunk-CB73AZHN.js} +4 -4
- package/dist/chunks/{chunk-3XTGOQ7S.js → chunk-GG3BYS2R.js} +33 -16
- package/dist/chunks/{chunk-HQRWCPSI.js → chunk-GRAWCIB4.js} +2 -2
- package/dist/chunks/{chunk-4UFE5XBV.js → chunk-IPGN7XPW.js} +32 -4
- package/dist/chunks/{chunk-HW5KZSD4.js → chunk-J4KNHRIR.js} +4 -4
- package/dist/chunks/{chunk-PEDCI4UR.js → chunk-L4ZLPYBN.js} +2 -2
- package/dist/chunks/{chunk-U4ULK5ZA.js → chunk-NEZIWVGN.js} +3 -3
- package/dist/chunks/{chunk-L3AWOZ76.js → chunk-OSY3TQB4.js} +11 -11
- package/dist/chunks/{chunk-342URIJ5.js → chunk-PERS6A4I.js} +2 -2
- package/dist/chunks/{chunk-3Y4QTHXA.js → chunk-PSAU4QN4.js} +1 -1
- package/dist/chunks/{chunk-MM763GZI.js → chunk-QL5BYW63.js} +1 -1
- package/dist/chunks/{chunk-BJ7KPURH.js → chunk-QPHW6JE2.js} +1 -1
- package/dist/chunks/{chunk-JO75CAHQ.js → chunk-YTSYQYRT.js} +2 -2
- package/dist/chunks/{client-LHJ5UBDF.js → client-3CGSYZJE.js} +1 -1
- package/dist/chunks/{client-S6UABYMV.js → client-ALL6CZAL.js} +2 -2
- package/dist/chunks/{client-QUILHCEZ.js → client-FO26KEPK.js} +3 -3
- package/dist/chunks/{client-actions-JJWK7S4J.js → client-actions-ZAUXFL2O.js} +5 -5
- package/dist/chunks/{dangerous-MF4KE7C6.js → dangerous-JO67OXBS.js} +3 -3
- package/dist/chunks/{delete-current-file-GFYV7CTR.js → delete-current-file-GT6HXPD3.js} +5 -5
- package/dist/chunks/{editor-seams-SNYIRUOT.js → editor-seams-YN6UTX6E.js} +12 -12
- package/dist/chunks/{editor-store-7I27MTKY.js → editor-store-YFW4DJ5W.js} +1 -1
- package/dist/chunks/{export-watermark-O4DFWCEO.js → export-watermark-23GQYHS7.js} +5 -5
- package/dist/chunks/{eyedropper-L6YSV5NK.js → eyedropper-5C5PC47G.js} +1 -1
- package/dist/chunks/{generate-media-RE2LYL4M.js → generate-media-5PJDPAWR.js} +3 -3
- package/dist/chunks/{host-4M5I5LWH.js → host-AQJ33HVQ.js} +9 -7
- package/dist/chunks/{integrations-5J3XUQ7G.js → integrations-I5KCGRBE.js} +1 -1
- package/dist/chunks/{libraries-PXRS7LXK.js → libraries-IXCZAWIM.js} +5 -5
- package/dist/chunks/{live-NHWDYFS3.js → live-PVTZNZ5E.js} +1 -1
- package/dist/chunks/{media-tool-4XWSLS7P.js → media-tool-GN3HGXTE.js} +1 -1
- package/dist/chunks/{new-file-BUXHR7TI.js → new-file-N5JRPB7A.js} +3 -3
- package/dist/chunks/{plugin-V3CVHRTE.js → plugin-DAORGN7V.js} +2 -2
- package/dist/chunks/{plugin-import-WM5MAWWQ.js → plugin-import-S2EP2X6N.js} +17 -17
- package/dist/chunks/{plugin-store-VJH7PHS2.js → plugin-store-OCQRBXWK.js} +1 -1
- package/dist/chunks/{presence-GVQYFIQ7.js → presence-KXQY3TQT.js} +2 -2
- package/dist/chunks/{project-I75XQREF.js → project-F7WQIMI5.js} +1 -1
- package/dist/chunks/{publish-site-I76FTFQJ.js → publish-site-FSCSPPME.js} +6 -6
- package/dist/chunks/{publish-store-3MNPWCYO.js → publish-store-H4RKL5YB.js} +4 -4
- package/dist/chunks/{raster-actions-E5XZGUXQ.js → raster-actions-2LIUE6YM.js} +1 -1
- package/dist/chunks/{runner-HWRFN7BC.js → runner-ZACBUVCU.js} +18 -18
- package/dist/chunks/{store-UFVP5QGB.js → store-XL6IPKHJ.js} +6 -6
- package/dist/chunks/{sync-2OHSVLRW.js → sync-HIAMQQYN.js} +5 -5
- package/dist/chunks/{tabs-FQCSFPCS.js → tabs-PPSFWHAE.js} +8 -8
- package/dist/chunks/{team-WZRULJXI.js → team-DECPX6VV.js} +1 -1
- package/dist/chunks/{team-client-WQSSCI2U.js → team-client-Y5JB3YGB.js} +1 -1
- package/dist/chunks/{tools-UYEMZSDS.js → tools-TO3SOVT2.js} +2 -2
- package/dist/chunks/{ui-commands-EBEH7WMH.js → ui-commands-TEOBCXX5.js} +12 -12
- package/dist/chunks/{versions-TPIAQUCT.js → versions-RHYSSG3I.js} +5 -5
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ const __filename = __popcraftPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __popcraftDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
registerAppCommands
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5NTVUBIU.js";
|
|
10
10
|
import {
|
|
11
11
|
storeOpsSeam
|
|
12
12
|
} from "./chunk-CK4GNJX4.js";
|
|
@@ -23,17 +23,17 @@ import {
|
|
|
23
23
|
sameResolution,
|
|
24
24
|
surfaceSize,
|
|
25
25
|
windowCssSize
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-6ZFNAY5O.js";
|
|
27
27
|
import {
|
|
28
28
|
notice
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-GRAWCIB4.js";
|
|
30
30
|
import {
|
|
31
31
|
agentContext
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-NEZIWVGN.js";
|
|
33
33
|
import {
|
|
34
34
|
collabSession,
|
|
35
35
|
syncStatus
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-J4KNHRIR.js";
|
|
37
37
|
import {
|
|
38
38
|
loadEntitlements
|
|
39
39
|
} from "./chunk-5Z3PWMIP.js";
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
import {
|
|
45
45
|
persist,
|
|
46
46
|
useEditorStore
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-662GNCQQ.js";
|
|
48
48
|
import {
|
|
49
49
|
cloudApi
|
|
50
50
|
} from "./chunk-A7LGUF3X.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-54X56MY3.js";
|
|
10
10
|
import {
|
|
11
11
|
notice
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-GRAWCIB4.js";
|
|
13
13
|
import {
|
|
14
14
|
effectiveChatModel,
|
|
15
15
|
setModelPref,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-MZMTIEPS.js";
|
|
18
18
|
import {
|
|
19
19
|
useEditorStore
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-662GNCQQ.js";
|
|
21
21
|
import {
|
|
22
22
|
create
|
|
23
23
|
} from "./chunk-IG6CWLJZ.js";
|
|
@@ -1892,7 +1892,7 @@ async function sendMessage(text) {
|
|
|
1892
1892
|
if (!useAgentStore.getState().activeThreadId) newThread();
|
|
1893
1893
|
const mentions = pruneMentions(body, useAgentStore.getState().draftMentions);
|
|
1894
1894
|
useAgentStore.setState({ draft: "", draftMentions: [], error: null });
|
|
1895
|
-
const { runTurn } = await import("./runner-
|
|
1895
|
+
const { runTurn } = await import("./runner-ZACBUVCU.js");
|
|
1896
1896
|
await runTurn(body, mentions);
|
|
1897
1897
|
}
|
|
1898
1898
|
function stop() {
|
|
@@ -1995,7 +1995,7 @@ var clearTaskChildren = () => useAgentStore.setState({ taskChildren: {} });
|
|
|
1995
1995
|
function subscribeChildTools() {
|
|
1996
1996
|
let dispose;
|
|
1997
1997
|
let cancelled = false;
|
|
1998
|
-
void import("./runner-
|
|
1998
|
+
void import("./runner-ZACBUVCU.js").then(({ onChildTool }) => {
|
|
1999
1999
|
const off = onChildTool((report) => {
|
|
2000
2000
|
if (report?.status !== "running" || report.jobId) return;
|
|
2001
2001
|
recordChildTool(report.toolCallId ?? "", report.name);
|
|
@@ -21,11 +21,11 @@ import {
|
|
|
21
21
|
} from "./chunk-XYGKEDBH.js";
|
|
22
22
|
import {
|
|
23
23
|
syncStatus
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-J4KNHRIR.js";
|
|
25
25
|
import {
|
|
26
26
|
setPluginTabs,
|
|
27
27
|
useEditorStore
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-662GNCQQ.js";
|
|
29
29
|
import {
|
|
30
30
|
openBeside
|
|
31
31
|
} from "./chunk-P4EC4ZZR.js";
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
} from "./chunk-I5KPI7DM.js";
|
|
36
36
|
import {
|
|
37
37
|
usePluginStore
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-2RJMUSOT.js";
|
|
39
39
|
import {
|
|
40
40
|
ToolError,
|
|
41
41
|
listCommands,
|
|
@@ -69,22 +69,22 @@ init_define_POPCRAFT_COMPONENT_IDS();
|
|
|
69
69
|
// lib/plugins/api.ts
|
|
70
70
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
71
71
|
async function handlePluginCall(env, method, params = {}) {
|
|
72
|
-
const { dispatchPluginCall } = await import("./plugin-
|
|
72
|
+
const { dispatchPluginCall } = await import("./plugin-DAORGN7V.js");
|
|
73
73
|
return dispatchPluginCall(env, method, params);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
// node_modules/.pnpm/@popcraft+plugins@1.
|
|
76
|
+
// node_modules/.pnpm/@popcraft+plugins@1.6.1/node_modules/@popcraft/plugins/dist/index.js
|
|
77
77
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
78
78
|
|
|
79
|
-
// node_modules/.pnpm/@popcraft+plugins@1.
|
|
79
|
+
// node_modules/.pnpm/@popcraft+plugins@1.6.1/node_modules/@popcraft/plugins/dist/host.js
|
|
80
80
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
81
81
|
|
|
82
|
-
// node_modules/.pnpm/@popcraft+plugins@1.
|
|
82
|
+
// node_modules/.pnpm/@popcraft+plugins@1.6.1/node_modules/@popcraft/plugins/dist/generated/runtime.js
|
|
83
83
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
84
|
-
var MAIN_RUNTIME = '"use strict";\n(() => {\n // src/runtime/rpc.ts\n function createRpcClient() {\n let port = null;\n const queue = [];\n const pending = {};\n const listeners = {};\n let nextId = 1;\n function send(msg) {\n if (port) port.postMessage(msg);\n else queue.push(msg);\n }\n function call(method, params) {\n return new Promise((resolve, reject) => {\n const id = nextId++;\n pending[id] = { resolve, reject };\n send({ kind: "rpc", id, method, params });\n });\n }\n function emit(event, data) {\n for (const cb of (listeners[event] || []).slice()) {\n try {\n cb(data);\n } catch (e) {\n console.error(e);\n }\n }\n }\n window.addEventListener("message", (e) => {\n const data = e.data;\n if (e.source !== window.parent || !data || data.type !== "popcraft-plugin-port" || port) return;\n port = e.ports[0];\n port.onmessage = (ev) => {\n const m = ev.data || {};\n if (m.kind === "result" && m.id !== void 0 && pending[m.id]) {\n const p = pending[m.id];\n delete pending[m.id];\n if (m.error) p.reject(new Error(m.error));\n else p.resolve(m.result);\n } else if (m.kind === "event" && m.event) {\n emit(m.event, m.data);\n }\n };\n for (const msg of queue.splice(0)) port.postMessage(msg);\n });\n return {\n call,\n send,\n on(event, cb) {\n (listeners[event] = listeners[event] || []).push(cb);\n },\n off(event, cb) {\n listeners[event] = (listeners[event] || []).filter((x) => x !== cb);\n }\n };\n }\n\n // src/runtime/main.ts\n function clone(v) {\n return v === void 0 ? {} : JSON.parse(JSON.stringify(v));\n }\n function createMainApi(rpc = createRpcClient()) {\n const uiHandlers = [];\n let uiOnMessage = null;\n const uiQueue = [];\n function deliverUI(msg) {\n for (const cb of uiHandlers) {\n try {\n cb(msg);\n } catch (e) {\n console.error(e);\n }\n }\n if (typeof uiOnMessage === "function") {\n try {\n uiOnMessage(msg);\n } catch (e) {\n console.error(e);\n }\n }\n }\n function flushUI() {\n if (uiHandlers.length || typeof uiOnMessage === "function") uiQueue.splice(0).forEach(deliverUI);\n }\n rpc.on("uimessage", (msg) => {\n if (!uiHandlers.length && typeof uiOnMessage !== "function") uiQueue.push(msg);\n else deliverUI(msg);\n });\n let widgetDef = null;\n const widgetQueue = [];\n function renderWidget(state) {\n const handlers = {};\n function walk(el, path) {\n if (!el || typeof el !== "object") return el;\n const out = {};\n for (const k of Object.keys(el)) {\n const v = el[k];\n if (k === "children") {\n out.children = (Array.isArray(v) ? v : [v]).filter((c) => c !== null && c !== void 0 && c !== false).map((c, i) => walk(c, path + "." + i));\n } else if (k === "onClick" && typeof v === "function") {\n handlers[path] = v;\n out.onClick = path;\n } else {\n out[k] = v;\n }\n }\n return out;\n }\n return { tree: walk(widgetDef.render(state), "root"), handlers };\n }\n function initialWidgetState() {\n const s = widgetDef && widgetDef.initialState;\n return clone(typeof s === "function" ? s() : s);\n }\n function commitWidget(nodeId, state) {\n return rpc.call("widgetUpdate", { id: nodeId, state, tree: renderWidget(clone(state)).tree });\n }\n function handleWidgetClick(e) {\n Promise.resolve().then(() => {\n const state = clone(e.state);\n const rendered = renderWidget(state);\n const h = rendered.handlers[e.handler] || widgetDef.handlers && widgetDef.handlers[e.handler];\n if (typeof h !== "function") return;\n return Promise.resolve(h(state, { nodeId: e.nodeId })).then((ret) => commitWidget(e.nodeId, ret === void 0 ? state : ret));\n }).catch((err) => rpc.send({ kind: "error", message: String((err == null ? void 0 : err.message) || err) }));\n }\n rpc.on("widgetclick", (e) => {\n if (widgetDef) handleWidgetClick(e);\n else widgetQueue.push(e);\n });\n const popcraft = {\n /** Which menu command the user picked, or null when the plugin ran some other way. */\n command: null,\n /** Host import mode when launched as an importer, else null. */\n importMode: null,\n /** Pending import file when the host handed one over, else null. */\n importFile: null,\n /** Pending export request (File \u2192 Export \u2192 this plugin\'s format), else null. */\n exportRequest: null,\n getSelection: () => rpc.call("getSelection"),\n setSelection: (ids) => rpc.call("setSelection", { ids }),\n getNode: (id) => rpc.call("getNode", { id }),\n findNodes: (query) => rpc.call("findNodes", query || {}),\n getCurrentPage: () => rpc.call("getCurrentPage"),\n createNode: (type, props) => rpc.call("createNode", { type, props: props || {} }),\n updateNode: (id, props) => rpc.call("updateNode", { id, props }),\n deleteNode: (id) => rpc.call("deleteNode", { id }),\n setText: (id, characters) => rpc.call("setText", { id, characters }),\n /** Put TEXT layers on a path (another layer\'s outline, or their own arc, circle or wave), or tune one: brackets, alignment, placement, effect, overflow. */\n setTextPath: (opts) => rpc.call("setTextPath", opts || {}),\n /** Area type: flow a TEXT layer inside a closed shape, kept `inset` px in. */\n flowTextIntoShape: (opts) => rpc.call("flowTextIntoShape", opts || {}),\n /** Take TEXT layers off their path or out of their shape (or free every text linked to a path / shape). */\n detachText: (opts) => rpc.call("detachText", opts || {}),\n /** Auto-size TEXT layers\' type to their box, shape or path. */\n setTextFit: (opts) => rpc.call("setTextFit", opts || {}),\n createPage: (name) => rpc.call("createPage", name != null ? { name: String(name) } : {}),\n setCurrentPage: (pageId) => rpc.call("setCurrentPage", { pageId }),\n createImage: (opts) => rpc.call("createImage", opts || {}),\n createDocument: (opts) => rpc.call("createDocument", opts || {}),\n getImportMode: () => rpc.call("getImportMode"),\n getImportFile: () => rpc.call("getImportFile"),\n /**\n * The open page as a storefront design in a neutral form, for an exporter that writes its own store\'s templates:\n * each page\'s HTML with the store\'s data marked (`{{page.title}}`, `{{item.price}}`, `<!-- pc:each \u2026 -->` lists,\n * `data-pc-action` forms), and its collections with their commerce schema and sample records.\n */\n getStorefront: () => rpc.call("getStorefront"),\n /**\n * A design\'s data (docs: Collections): a collection and its fields (`schema`: what it stands for, e.g.\n * `commerce.product`, whose fields are made for it), its records, and reading them.\n */\n editCollection: (opts) => rpc.call("editCollection", opts || {}),\n editRecords: (opts) => rpc.call("editRecords", opts || {}),\n getRecords: (opts) => rpc.call("getRecords", opts || {}),\n /** A layer as a web page\'s form control (a FORM\'s `formAction`, an INPUT\'s name and value), repeated per record, a page\'s address, its semantics. */\n setControl: (opts) => rpc.call("setControl", opts || {}),\n setRepeat: (opts) => rpc.call("setRepeat", opts || {}),\n setRoute: (opts) => rpc.call("setRoute", opts || {}),\n setSemantics: (opts) => rpc.call("setSemantics", opts || {}),\n /** Which record layers are about (one product, picked from a collection), and which of its fields a layer\'s words, picture or an instance\'s properties follow. */\n setRecord: (opts) => rpc.call("setRecord", opts || {}),\n bindField: (opts) => rpc.call("bindField", opts || {}),\n /** The site\'s environment: public settings its host reads by name when it is deployed (never a secret: the file keeps them). */\n getSiteEnvironment: () => rpc.call("getSiteEnvironment"),\n setSiteEnvironment: (set) => rpc.call("setSiteEnvironment", { set }),\n /** What this plugin keeps with the open file (its settings for this design), under its own id; JSON only. */\n getFileData: (key) => rpc.call("getFileData", { key }),\n setFileData: (key, value) => rpc.call("setFileData", { key, value }),\n /** A store\'s project built from the open page, zipped (needs `export`): what an exporter saves with `saveExport`. */\n getStorefrontFiles: (target) => rpc.call("getStorefrontFiles", { target }),\n getExportRequest: () => rpc.call("getExportRequest"),\n /** Save the exporter\'s file (once per export request); the host enforces the contributed extension. */\n saveExport: (file) => rpc.call("saveExport", file || {}),\n /**\n * Presentation audio (docs/plugins/presentation-audio.md): the deck\'s slides, notes, narration and timing; the\n * soundtrack\'s settings, bed and stinger.\n */\n getPresentationAudio: (opts) => rpc.call("getPresentationAudio", opts || {}),\n /** Change the soundtrack\'s settings (voice, style, mood, loudness, beat alignment, levels) and re-time it. */\n setPresentationAudioSettings: (opts) => rpc.call("setPresentationAudioSettings", opts || {}),\n /** Put a sound in (a slide\'s narration, the bed or the stinger): bytes are normalised to the soundtrack\'s target and stored. */\n setPresentationAudioClip: (opts) => rpc.call("setPresentationAudioClip", opts || {}),\n removePresentationAudioClip: (opts) => rpc.call("removePresentationAudioClip", opts || {}),\n /** Re-time: fixed slide lengths (ms, null clears) and beat-aligned changes. */\n setPresentationTiming: (opts) => rpc.call("setPresentationTiming", opts || {}),\n /** The mix as the export carries it: loudness, true peak, and (wav: true) the 48 kHz stereo WAV. */\n getPresentationMix: (opts) => rpc.call("getPresentationMix", opts || {}),\n /** Ask the user to generate with AI (the panel opens with the request filled in; the user decides). */\n requestPresentationAudio: (opts) => rpc.call("requestPresentationAudio", opts || {}),\n /** Editor commands: each takes the arguments documented in docs/plugins/methods.md (the agent tool of the same purpose). */\n moveNodes: (opts) => rpc.call("moveNodes", opts || {}),\n resizeNodes: (opts) => rpc.call("resizeNodes", opts || {}),\n renameNodes: (opts) => rpc.call("renameNodes", opts || {}),\n reparentNodes: (opts) => rpc.call("reparentNodes", opts || {}),\n duplicateNodes: (opts) => rpc.call("duplicateNodes", opts || {}),\n groupNodes: (opts) => rpc.call("groupNodes", opts || {}),\n ungroupNodes: (opts) => rpc.call("ungroupNodes", opts || {}),\n alignNodes: (opts) => rpc.call("alignNodes", opts || {}),\n distributeNodes: (opts) => rpc.call("distributeNodes", opts || {}),\n flipNodes: (opts) => rpc.call("flipNodes", opts || {}),\n rotateNodes: (opts) => rpc.call("rotateNodes", opts || {}),\n reorderNodes: (opts) => rpc.call("reorderNodes", opts || {}),\n setLocked: (opts) => rpc.call("setLocked", opts || {}),\n setVisible: (opts) => rpc.call("setVisible", opts || {}),\n setAutoLayout: (opts) => rpc.call("setAutoLayout", opts || {}),\n importSvg: (opts) => rpc.call("importSvg", opts || {}),\n measureNodes: (opts) => rpc.call("measureNodes", opts || {}),\n setFills: (opts) => rpc.call("setFills", opts || {}),\n setStrokes: (opts) => rpc.call("setStrokes", opts || {}),\n setEffects: (opts) => rpc.call("setEffects", opts || {}),\n replaceColor: (opts) => rpc.call("replaceColor", opts || {}),\n setTypography: (opts) => rpc.call("setTypography", opts || {}),\n applyStyle: (opts) => rpc.call("applyStyle", opts || {}),\n createComponent: (opts) => rpc.call("createComponent", opts || {}),\n createInstance: (opts) => rpc.call("createInstance", opts || {}),\n renamePage: (opts) => rpc.call("renamePage", opts || {}),\n getDocumentOutline: (opts) => rpc.call("getDocumentOutline", opts || {}),\n setPageSetup: (opts) => rpc.call("setPageSetup", opts || {}),\n setShowAdvance: (opts) => rpc.call("setShowAdvance", opts || {}),\n booleanOperation: (opts) => rpc.call("booleanOperation", opts || {}),\n flattenNodes: (opts) => rpc.call("flattenNodes", opts || {}),\n outlineStroke: (opts) => rpc.call("outlineStroke", opts || {}),\n setMask: (opts) => rpc.call("setMask", opts || {}),\n setMaskType: (opts) => rpc.call("setMaskType", opts || {}),\n shapeBuilder: (opts) => rpc.call("shapeBuilder", opts || {}),\n setKeyframes: (opts) => rpc.call("setKeyframes", opts || {}),\n getAnimation: (opts) => rpc.call("getAnimation", opts || {}),\n getCompositions: (opts) => rpc.call("getCompositions", opts || {}),\n editBehaviours: (opts) => rpc.call("editBehaviours", opts || {}),\n setTimeline: (opts) => rpc.call("setTimeline", opts || {}),\n setLayerTiming: (opts) => rpc.call("setLayerTiming", opts || {}),\n editTextAnimation: (opts) => rpc.call("editTextAnimation", opts || {}),\n edit3DScene: (opts) => rpc.call("edit3DScene", opts || {}),\n setInstancePlayback: (opts) => rpc.call("setInstancePlayback", opts || {}),\n editComponentProperty: (opts) => rpc.call("editComponentProperty", opts || {}),\n setShaderFill: (opts) => rpc.call("setShaderFill", opts || {}),\n createComposition: (opts) => rpc.call("createComposition", opts || {}),\n editComposition: (opts) => rpc.call("editComposition", opts || {}),\n /**\n * Sequences (Edit mode): a composition as a multi-track timeline \u2014 V1 main scenes, V2\u2026 layered scenes / videos / stills,\n * A1\u2026 audio. `editSequence({ id, op })` cuts, trims, slips, rolls, slides, places, stretches, blends, mixes and ducks\n * (docs/plugins/methods.md); `getSequence({ id? })` reads it by track.\n */\n editSequence: (opts) => rpc.call("editSequence", opts || {}),\n getSequence: (opts) => rpc.call("getSequence", opts || {}),\n editStateMachine: (opts) => rpc.call("editStateMachine", opts || {}),\n getStateMachine: (opts) => rpc.call("getStateMachine", opts || {}),\n applyMotionPreset: (opts) => rpc.call("applyMotionPreset", opts || {}),\n staggerMotion: (opts) => rpc.call("staggerMotion", opts || {}),\n createMotionComponent: (opts) => rpc.call("createMotionComponent", opts || {}),\n addAudio: (opts) => rpc.call("addAudio", opts || {}),\n editFrameAudio: (opts) => rpc.call("editFrameAudio", opts || {}),\n editVideoClip: (opts) => rpc.call("editVideoClip", opts || {}),\n detectAudioOnsets: (opts) => rpc.call("detectAudioOnsets", opts || {}),\n cutToBeat: (opts) => rpc.call("cutToBeat", opts || {}),\n editPrototype: (opts) => rpc.call("editPrototype", opts || {}),\n usePresentationFallbackAudio: (opts) => rpc.call("usePresentationFallbackAudio", opts || {}),\n /** Bring a Lottie, PDF or PopCraft file into the open document (the `importFile` field is the file an importer was handed). */\n importDocumentFile: (opts) => rpc.call("importDocumentFile", opts || {}),\n getStyles: () => rpc.call("getStyles"),\n createPaintStyle: (name, paints) => rpc.call("createPaintStyle", { name, paints }),\n getVariables: () => rpc.call("getVariables"),\n setVariableValue: (variableId, modeId, value) => rpc.call("setVariableValue", { variableId, modeId, value }),\n exportNode: (id, options) => rpc.call("exportNode", { id, options: options || {} }),\n openExternal: (url) => rpc.call("openExternal", { url }),\n /**\n * Send a file to an https URL. PopCraft makes the request, not the sandbox, so it works for files of\n * any size the server accepts, including straight to a presigned storage URL. Needs `network`.\n */\n upload: (url, options) => {\n const body = options.body instanceof ArrayBuffer ? new Uint8Array(options.body) : options.body;\n return rpc.call("upload", {\n url,\n body,\n method: options.method,\n contentType: options.contentType,\n headers: options.headers\n });\n },\n notify: (message, options) => rpc.call("notify", { message: String(message), error: !!(options && options.error) }),\n showUI: (options) => rpc.call("showUI", options || {}),\n hideUI: () => rpc.call("hideUI"),\n /** Ends the run. The optional message is shown as a notification. */\n closePlugin: (message) => rpc.call("closePlugin", { message }),\n storage: {\n get: (key) => rpc.call("storageGet", { key }),\n set: (key, value) => rpc.call("storageSet", { key, value })\n },\n ui: {\n get onmessage() {\n return uiOnMessage;\n },\n set onmessage(cb) {\n uiOnMessage = cb;\n flushUI();\n },\n postMessage: (msg) => rpc.send({ kind: "toUI", data: msg }),\n on: (cb) => {\n uiHandlers.push(cb);\n flushUI();\n }\n },\n widget: {\n register(def) {\n if (!def || typeof def.render !== "function") throw new Error("popcraft.widget.register needs a render(state) function");\n widgetDef = def;\n widgetQueue.splice(0).forEach(handleWidgetClick);\n },\n insert(options) {\n if (!widgetDef) return Promise.reject(new Error("Call popcraft.widget.register first"));\n const o = options || {};\n const state = o.state !== void 0 ? clone(o.state) : initialWidgetState();\n return rpc.call("widgetInsert", { state, tree: renderWidget(state).tree, x: o.x, y: o.y });\n },\n getState: (nodeId) => rpc.call("widgetGet", { id: nodeId }),\n setState(nodeId, state) {\n if (!widgetDef) return Promise.reject(new Error("Call popcraft.widget.register first"));\n return commitWidget(nodeId, clone(state));\n }\n },\n on: (event, cb) => rpc.on(event, cb),\n off: (event, cb) => rpc.off(event, cb)\n };\n rpc.on("init", (data) => {\n var _a, _b, _c;\n popcraft.command = data.command;\n popcraft.importMode = (_a = data.importMode) != null ? _a : null;\n popcraft.importFile = (_b = data.importFile) != null ? _b : null;\n popcraft.exportRequest = (_c = data.exportRequest) != null ? _c : null;\n });\n return popcraft;\n }\n function installMainApi() {\n const rpc = createRpcClient();\n const api = createMainApi(rpc);\n const w = window;\n w.__popcraftRpc = rpc;\n w.popcraft = api;\n w.vizpops = api;\n window.addEventListener("error", (e) => rpc.send({ kind: "error", message: String(e.message || e) }));\n window.addEventListener("unhandledrejection", (e) => rpc.send({ kind: "error", message: String(e.reason && e.reason.message || e.reason) }));\n return api;\n }\n\n // src/runtime/main.entry.ts\n installMainApi();\n})();';
|
|
84
|
+
var MAIN_RUNTIME = '"use strict";\n(() => {\n // src/runtime/rpc.ts\n function createRpcClient() {\n let port = null;\n const queue = [];\n const pending = {};\n const listeners = {};\n let nextId = 1;\n function send(msg) {\n if (port) port.postMessage(msg);\n else queue.push(msg);\n }\n function call(method, params) {\n return new Promise((resolve, reject) => {\n const id = nextId++;\n pending[id] = { resolve, reject };\n send({ kind: "rpc", id, method, params });\n });\n }\n function emit(event, data) {\n for (const cb of (listeners[event] || []).slice()) {\n try {\n cb(data);\n } catch (e) {\n console.error(e);\n }\n }\n }\n window.addEventListener("message", (e) => {\n const data = e.data;\n if (e.source !== window.parent || !data || data.type !== "popcraft-plugin-port" || port) return;\n port = e.ports[0];\n port.onmessage = (ev) => {\n const m = ev.data || {};\n if (m.kind === "result" && m.id !== void 0 && pending[m.id]) {\n const p = pending[m.id];\n delete pending[m.id];\n if (m.error) p.reject(new Error(m.error));\n else p.resolve(m.result);\n } else if (m.kind === "event" && m.event) {\n emit(m.event, m.data);\n }\n };\n for (const msg of queue.splice(0)) port.postMessage(msg);\n });\n return {\n call,\n send,\n on(event, cb) {\n (listeners[event] = listeners[event] || []).push(cb);\n },\n off(event, cb) {\n listeners[event] = (listeners[event] || []).filter((x) => x !== cb);\n }\n };\n }\n\n // src/runtime/main.ts\n function clone(v) {\n return v === void 0 ? {} : JSON.parse(JSON.stringify(v));\n }\n function createMainApi(rpc = createRpcClient()) {\n const uiHandlers = [];\n let uiOnMessage = null;\n const uiQueue = [];\n function deliverUI(msg) {\n for (const cb of uiHandlers) {\n try {\n cb(msg);\n } catch (e) {\n console.error(e);\n }\n }\n if (typeof uiOnMessage === "function") {\n try {\n uiOnMessage(msg);\n } catch (e) {\n console.error(e);\n }\n }\n }\n function flushUI() {\n if (uiHandlers.length || typeof uiOnMessage === "function") uiQueue.splice(0).forEach(deliverUI);\n }\n rpc.on("uimessage", (msg) => {\n if (!uiHandlers.length && typeof uiOnMessage !== "function") uiQueue.push(msg);\n else deliverUI(msg);\n });\n let widgetDef = null;\n const widgetQueue = [];\n function renderWidget(state) {\n const handlers = {};\n function walk(el, path) {\n if (!el || typeof el !== "object") return el;\n const out = {};\n for (const k of Object.keys(el)) {\n const v = el[k];\n if (k === "children") {\n out.children = (Array.isArray(v) ? v : [v]).filter((c) => c !== null && c !== void 0 && c !== false).map((c, i) => walk(c, path + "." + i));\n } else if (k === "onClick" && typeof v === "function") {\n handlers[path] = v;\n out.onClick = path;\n } else {\n out[k] = v;\n }\n }\n return out;\n }\n return { tree: walk(widgetDef.render(state), "root"), handlers };\n }\n function initialWidgetState() {\n const s = widgetDef && widgetDef.initialState;\n return clone(typeof s === "function" ? s() : s);\n }\n function commitWidget(nodeId, state) {\n return rpc.call("widgetUpdate", { id: nodeId, state, tree: renderWidget(clone(state)).tree });\n }\n function handleWidgetClick(e) {\n Promise.resolve().then(() => {\n const state = clone(e.state);\n const rendered = renderWidget(state);\n const h = rendered.handlers[e.handler] || widgetDef.handlers && widgetDef.handlers[e.handler];\n if (typeof h !== "function") return;\n return Promise.resolve(h(state, { nodeId: e.nodeId })).then((ret) => commitWidget(e.nodeId, ret === void 0 ? state : ret));\n }).catch((err) => rpc.send({ kind: "error", message: String((err == null ? void 0 : err.message) || err) }));\n }\n rpc.on("widgetclick", (e) => {\n if (widgetDef) handleWidgetClick(e);\n else widgetQueue.push(e);\n });\n const popcraft = {\n /** Which menu command the user picked, or null when the plugin ran some other way. */\n command: null,\n /** Host import mode when launched as an importer, else null. */\n importMode: null,\n /** Pending import file when the host handed one over, else null. */\n importFile: null,\n /** Pending export request (File \u2192 Export \u2192 this plugin\'s format), else null. */\n exportRequest: null,\n getSelection: () => rpc.call("getSelection"),\n setSelection: (ids) => rpc.call("setSelection", { ids }),\n getNode: (id) => rpc.call("getNode", { id }),\n findNodes: (query) => rpc.call("findNodes", query || {}),\n getCurrentPage: () => rpc.call("getCurrentPage"),\n createNode: (type, props) => rpc.call("createNode", { type, props: props || {} }),\n updateNode: (id, props) => rpc.call("updateNode", { id, props }),\n deleteNode: (id) => rpc.call("deleteNode", { id }),\n setText: (id, characters) => rpc.call("setText", { id, characters }),\n /** Put TEXT layers on a path (another layer\'s outline, or their own arc, circle or wave), or tune one: brackets, alignment, placement, effect, overflow. */\n setTextPath: (opts) => rpc.call("setTextPath", opts || {}),\n /** Area type: flow a TEXT layer inside a closed shape, kept `inset` px in. */\n flowTextIntoShape: (opts) => rpc.call("flowTextIntoShape", opts || {}),\n /** Take TEXT layers off their path or out of their shape (or free every text linked to a path / shape). */\n detachText: (opts) => rpc.call("detachText", opts || {}),\n /** Auto-size TEXT layers\' type to their box, shape or path. */\n setTextFit: (opts) => rpc.call("setTextFit", opts || {}),\n createPage: (name) => rpc.call("createPage", name != null ? { name: String(name) } : {}),\n setCurrentPage: (pageId) => rpc.call("setCurrentPage", { pageId }),\n createImage: (opts) => rpc.call("createImage", opts || {}),\n createDocument: (opts) => rpc.call("createDocument", opts || {}),\n getImportMode: () => rpc.call("getImportMode"),\n getImportFile: () => rpc.call("getImportFile"),\n /**\n * The open page as a storefront design in a neutral form, for an exporter that writes its own store\'s templates:\n * each page\'s HTML with the store\'s data marked (`{{page.title}}`, `{{item.price}}`, `<!-- pc:each \u2026 -->` lists,\n * `data-pc-action` forms), and its collections with their commerce schema and sample records.\n */\n getStorefront: () => rpc.call("getStorefront"),\n /**\n * A design\'s data (docs: Collections): a collection and its fields (`schema`: what it stands for, e.g.\n * `commerce.product`, whose fields are made for it), its records, and reading them.\n */\n editCollection: (opts) => rpc.call("editCollection", opts || {}),\n editRecords: (opts) => rpc.call("editRecords", opts || {}),\n getRecords: (opts) => rpc.call("getRecords", opts || {}),\n /** A layer as a web page\'s form control (a FORM\'s `formAction`, an INPUT\'s name and value), repeated per record, a page\'s address, its semantics. */\n setControl: (opts) => rpc.call("setControl", opts || {}),\n setRepeat: (opts) => rpc.call("setRepeat", opts || {}),\n setRoute: (opts) => rpc.call("setRoute", opts || {}),\n setSemantics: (opts) => rpc.call("setSemantics", opts || {}),\n /** Which record layers are about (one product, picked from a collection), and which of its fields a layer\'s words, picture or an instance\'s properties follow. */\n setRecord: (opts) => rpc.call("setRecord", opts || {}),\n bindField: (opts) => rpc.call("bindField", opts || {}),\n /** The site\'s environment: public settings its host reads by name when it is deployed (never a secret: the file keeps them). */\n getSiteEnvironment: () => rpc.call("getSiteEnvironment"),\n setSiteEnvironment: (set) => rpc.call("setSiteEnvironment", { set }),\n /** What this plugin keeps with the open file (its settings for this design), under its own id; JSON only. */\n getFileData: (key) => rpc.call("getFileData", { key }),\n setFileData: (key, value) => rpc.call("setFileData", { key, value }),\n /** A store\'s project built from the open page, zipped (needs `export`): what an exporter saves with `saveExport`. */\n getStorefrontFiles: (target) => rpc.call("getStorefrontFiles", { target }),\n getExportRequest: () => rpc.call("getExportRequest"),\n /** Save the exporter\'s file (once per export request); the host enforces the contributed extension. */\n saveExport: (file) => rpc.call("saveExport", file || {}),\n /**\n * Presentation audio (docs/plugins/presentation-audio.md): the deck\'s slides, notes, narration and timing; the\n * soundtrack\'s settings, bed and stinger.\n */\n getPresentationAudio: (opts) => rpc.call("getPresentationAudio", opts || {}),\n /** Change the soundtrack\'s settings (voice, style, mood, loudness, beat alignment, levels) and re-time it. */\n setPresentationAudioSettings: (opts) => rpc.call("setPresentationAudioSettings", opts || {}),\n /** Put a sound in (a slide\'s narration, the bed or the stinger): bytes are normalised to the soundtrack\'s target and stored. */\n setPresentationAudioClip: (opts) => rpc.call("setPresentationAudioClip", opts || {}),\n removePresentationAudioClip: (opts) => rpc.call("removePresentationAudioClip", opts || {}),\n /** Re-time: fixed slide lengths (ms, null clears) and beat-aligned changes. */\n setPresentationTiming: (opts) => rpc.call("setPresentationTiming", opts || {}),\n /** The mix as the export carries it: loudness, true peak, and (wav: true) the 48 kHz stereo WAV. */\n getPresentationMix: (opts) => rpc.call("getPresentationMix", opts || {}),\n /** Ask the user to generate with AI (the panel opens with the request filled in; the user decides). */\n requestPresentationAudio: (opts) => rpc.call("requestPresentationAudio", opts || {}),\n /** Editor commands: each takes the arguments documented in docs/plugins/methods.md (the agent tool of the same purpose). */\n moveNodes: (opts) => rpc.call("moveNodes", opts || {}),\n resizeNodes: (opts) => rpc.call("resizeNodes", opts || {}),\n renameNodes: (opts) => rpc.call("renameNodes", opts || {}),\n reparentNodes: (opts) => rpc.call("reparentNodes", opts || {}),\n duplicateNodes: (opts) => rpc.call("duplicateNodes", opts || {}),\n groupNodes: (opts) => rpc.call("groupNodes", opts || {}),\n ungroupNodes: (opts) => rpc.call("ungroupNodes", opts || {}),\n alignNodes: (opts) => rpc.call("alignNodes", opts || {}),\n distributeNodes: (opts) => rpc.call("distributeNodes", opts || {}),\n flipNodes: (opts) => rpc.call("flipNodes", opts || {}),\n rotateNodes: (opts) => rpc.call("rotateNodes", opts || {}),\n reorderNodes: (opts) => rpc.call("reorderNodes", opts || {}),\n setLocked: (opts) => rpc.call("setLocked", opts || {}),\n setVisible: (opts) => rpc.call("setVisible", opts || {}),\n setAutoLayout: (opts) => rpc.call("setAutoLayout", opts || {}),\n importSvg: (opts) => rpc.call("importSvg", opts || {}),\n measureNodes: (opts) => rpc.call("measureNodes", opts || {}),\n setFills: (opts) => rpc.call("setFills", opts || {}),\n setStrokes: (opts) => rpc.call("setStrokes", opts || {}),\n setEffects: (opts) => rpc.call("setEffects", opts || {}),\n replaceColor: (opts) => rpc.call("replaceColor", opts || {}),\n setTypography: (opts) => rpc.call("setTypography", opts || {}),\n applyStyle: (opts) => rpc.call("applyStyle", opts || {}),\n createComponent: (opts) => rpc.call("createComponent", opts || {}),\n createInstance: (opts) => rpc.call("createInstance", opts || {}),\n renamePage: (opts) => rpc.call("renamePage", opts || {}),\n getDocumentOutline: (opts) => rpc.call("getDocumentOutline", opts || {}),\n setPageSetup: (opts) => rpc.call("setPageSetup", opts || {}),\n setShowAdvance: (opts) => rpc.call("setShowAdvance", opts || {}),\n booleanOperation: (opts) => rpc.call("booleanOperation", opts || {}),\n flattenNodes: (opts) => rpc.call("flattenNodes", opts || {}),\n outlineStroke: (opts) => rpc.call("outlineStroke", opts || {}),\n setMask: (opts) => rpc.call("setMask", opts || {}),\n setMaskType: (opts) => rpc.call("setMaskType", opts || {}),\n shapeBuilder: (opts) => rpc.call("shapeBuilder", opts || {}),\n setKeyframes: (opts) => rpc.call("setKeyframes", opts || {}),\n getAnimation: (opts) => rpc.call("getAnimation", opts || {}),\n getCompositions: (opts) => rpc.call("getCompositions", opts || {}),\n editBehaviours: (opts) => rpc.call("editBehaviours", opts || {}),\n setTimeline: (opts) => rpc.call("setTimeline", opts || {}),\n setLayerTiming: (opts) => rpc.call("setLayerTiming", opts || {}),\n editTextAnimation: (opts) => rpc.call("editTextAnimation", opts || {}),\n edit3DScene: (opts) => rpc.call("edit3DScene", opts || {}),\n setInstancePlayback: (opts) => rpc.call("setInstancePlayback", opts || {}),\n editComponentProperty: (opts) => rpc.call("editComponentProperty", opts || {}),\n setShaderFill: (opts) => rpc.call("setShaderFill", opts || {}),\n createComposition: (opts) => rpc.call("createComposition", opts || {}),\n editComposition: (opts) => rpc.call("editComposition", opts || {}),\n /**\n * Sequences (Edit mode): a composition as a multi-track timeline \u2014 V1 main scenes, V2\u2026 layered scenes / videos / stills,\n * A1\u2026 audio. `editSequence({ id, op })` cuts, trims, slips, rolls, slides, places, stretches, blends, mixes and ducks\n * (docs/plugins/methods.md); `getSequence({ id? })` reads it by track.\n */\n editSequence: (opts) => rpc.call("editSequence", opts || {}),\n getSequence: (opts) => rpc.call("getSequence", opts || {}),\n /** A title, lower third or subtitle as a clip on a track above V1 (`{ id?, text, style?, track?, start?, length? }`). */\n addTitle: (opts) => rpc.call("addTitle", opts || {}),\n /** Clips on V2 and up nested into a new sequence; `multicam: true` makes them camera angles (`{ id?, clips, multicam? }`). */\n nestClips: (opts) => rpc.call("nestClips", opts || {}),\n /** A multicam clip\'s angles lined up by their sound (`{ id?, clip }`). */\n syncAngles: (opts) => rpc.call("syncAngles", opts || {}),\n /** Audio clips brought to one peak level (`{ id?, clips?, to? }`, dBFS, default \u22121). */\n normalizeAudio: (opts) => rpc.call("normalizeAudio", opts || {}),\n editStateMachine: (opts) => rpc.call("editStateMachine", opts || {}),\n getStateMachine: (opts) => rpc.call("getStateMachine", opts || {}),\n applyMotionPreset: (opts) => rpc.call("applyMotionPreset", opts || {}),\n staggerMotion: (opts) => rpc.call("staggerMotion", opts || {}),\n createMotionComponent: (opts) => rpc.call("createMotionComponent", opts || {}),\n addAudio: (opts) => rpc.call("addAudio", opts || {}),\n editFrameAudio: (opts) => rpc.call("editFrameAudio", opts || {}),\n editVideoClip: (opts) => rpc.call("editVideoClip", opts || {}),\n detectAudioOnsets: (opts) => rpc.call("detectAudioOnsets", opts || {}),\n cutToBeat: (opts) => rpc.call("cutToBeat", opts || {}),\n editPrototype: (opts) => rpc.call("editPrototype", opts || {}),\n usePresentationFallbackAudio: (opts) => rpc.call("usePresentationFallbackAudio", opts || {}),\n /** Bring a Lottie, PDF or PopCraft file into the open document (the `importFile` field is the file an importer was handed). */\n importDocumentFile: (opts) => rpc.call("importDocumentFile", opts || {}),\n getStyles: () => rpc.call("getStyles"),\n createPaintStyle: (name, paints) => rpc.call("createPaintStyle", { name, paints }),\n getVariables: () => rpc.call("getVariables"),\n setVariableValue: (variableId, modeId, value) => rpc.call("setVariableValue", { variableId, modeId, value }),\n exportNode: (id, options) => rpc.call("exportNode", { id, options: options || {} }),\n openExternal: (url) => rpc.call("openExternal", { url }),\n /**\n * Send a file to an https URL. PopCraft makes the request, not the sandbox, so it works for files of\n * any size the server accepts, including straight to a presigned storage URL. Needs `network`.\n */\n upload: (url, options) => {\n const body = options.body instanceof ArrayBuffer ? new Uint8Array(options.body) : options.body;\n return rpc.call("upload", {\n url,\n body,\n method: options.method,\n contentType: options.contentType,\n headers: options.headers\n });\n },\n notify: (message, options) => rpc.call("notify", { message: String(message), error: !!(options && options.error) }),\n showUI: (options) => rpc.call("showUI", options || {}),\n hideUI: () => rpc.call("hideUI"),\n /**\n * Change the rail icon of one of this plugin\'s panels while it runs, e.g. to show a connection\'s state. Reset when\n * the plugin stops.\n */\n setPanelIcon: (options) => rpc.call("setPanelIcon", options || {}),\n /** Ends the run. The optional message is shown as a notification. */\n closePlugin: (message) => rpc.call("closePlugin", { message }),\n storage: {\n get: (key) => rpc.call("storageGet", { key }),\n set: (key, value) => rpc.call("storageSet", { key, value })\n },\n ui: {\n get onmessage() {\n return uiOnMessage;\n },\n set onmessage(cb) {\n uiOnMessage = cb;\n flushUI();\n },\n postMessage: (msg) => rpc.send({ kind: "toUI", data: msg }),\n on: (cb) => {\n uiHandlers.push(cb);\n flushUI();\n }\n },\n widget: {\n register(def) {\n if (!def || typeof def.render !== "function") throw new Error("popcraft.widget.register needs a render(state) function");\n widgetDef = def;\n widgetQueue.splice(0).forEach(handleWidgetClick);\n },\n insert(options) {\n if (!widgetDef) return Promise.reject(new Error("Call popcraft.widget.register first"));\n const o = options || {};\n const state = o.state !== void 0 ? clone(o.state) : initialWidgetState();\n return rpc.call("widgetInsert", { state, tree: renderWidget(state).tree, x: o.x, y: o.y });\n },\n getState: (nodeId) => rpc.call("widgetGet", { id: nodeId }),\n setState(nodeId, state) {\n if (!widgetDef) return Promise.reject(new Error("Call popcraft.widget.register first"));\n return commitWidget(nodeId, clone(state));\n }\n },\n on: (event, cb) => rpc.on(event, cb),\n off: (event, cb) => rpc.off(event, cb)\n };\n rpc.on("init", (data) => {\n var _a, _b, _c;\n popcraft.command = data.command;\n popcraft.importMode = (_a = data.importMode) != null ? _a : null;\n popcraft.importFile = (_b = data.importFile) != null ? _b : null;\n popcraft.exportRequest = (_c = data.exportRequest) != null ? _c : null;\n });\n return popcraft;\n }\n function installMainApi() {\n const rpc = createRpcClient();\n const api = createMainApi(rpc);\n const w = window;\n w.__popcraftRpc = rpc;\n w.popcraft = api;\n w.vizpops = api;\n window.addEventListener("error", (e) => rpc.send({ kind: "error", message: String(e.message || e) }));\n window.addEventListener("unhandledrejection", (e) => rpc.send({ kind: "error", message: String(e.reason && e.reason.message || e.reason) }));\n return api;\n }\n\n // src/runtime/main.entry.ts\n installMainApi();\n})();';
|
|
85
85
|
var UI_RUNTIME = '"use strict";\n(() => {\n // src/runtime/rpc.ts\n function createRpcClient() {\n let port = null;\n const queue = [];\n const pending = {};\n const listeners = {};\n let nextId = 1;\n function send(msg) {\n if (port) port.postMessage(msg);\n else queue.push(msg);\n }\n function call(method, params) {\n return new Promise((resolve, reject) => {\n const id = nextId++;\n pending[id] = { resolve, reject };\n send({ kind: "rpc", id, method, params });\n });\n }\n function emit(event, data) {\n for (const cb of (listeners[event] || []).slice()) {\n try {\n cb(data);\n } catch (e) {\n console.error(e);\n }\n }\n }\n window.addEventListener("message", (e) => {\n const data = e.data;\n if (e.source !== window.parent || !data || data.type !== "popcraft-plugin-port" || port) return;\n port = e.ports[0];\n port.onmessage = (ev) => {\n const m = ev.data || {};\n if (m.kind === "result" && m.id !== void 0 && pending[m.id]) {\n const p = pending[m.id];\n delete pending[m.id];\n if (m.error) p.reject(new Error(m.error));\n else p.resolve(m.result);\n } else if (m.kind === "event" && m.event) {\n emit(m.event, m.data);\n }\n };\n for (const msg of queue.splice(0)) port.postMessage(msg);\n });\n return {\n call,\n send,\n on(event, cb) {\n (listeners[event] = listeners[event] || []).push(cb);\n },\n off(event, cb) {\n listeners[event] = (listeners[event] || []).filter((x) => x !== cb);\n }\n };\n }\n\n // src/runtime/ui.ts\n function createUiApi(rpc = createRpcClient()) {\n const popcraft = {\n onmessage: null,\n postMessage: (msg) => rpc.send({ kind: "fromUI", data: msg }),\n close: () => rpc.send({ kind: "closeUI" })\n };\n rpc.on("message", (msg) => {\n if (typeof popcraft.onmessage === "function") popcraft.onmessage(msg);\n window.dispatchEvent(new MessageEvent("message", { data: { pluginMessage: msg } }));\n });\n return popcraft;\n }\n function installUiApi() {\n const rpc = createRpcClient();\n const api = createUiApi(rpc);\n const w = window;\n w.__popcraftRpc = rpc;\n w.popcraft = api;\n w.vizpops = api;\n return api;\n }\n\n // src/runtime/ui.entry.ts\n installUiApi();\n})();';
|
|
86
86
|
|
|
87
|
-
// node_modules/.pnpm/@popcraft+plugins@1.
|
|
87
|
+
// node_modules/.pnpm/@popcraft+plugins@1.6.1/node_modules/@popcraft/plugins/dist/host.js
|
|
88
88
|
var escapeScript = (code) => code.replace(/<\/script/gi, "<\\/script");
|
|
89
89
|
function csp(network) {
|
|
90
90
|
const connect = network ? "connect-src * data: blob:;" : "connect-src 'none';";
|
|
@@ -112,16 +112,16 @@ function buildUIDocument(uiHtml, network) {
|
|
|
112
112
|
return `<!doctype html><html><head>${head}</head><body>${uiHtml}</body></html>`;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
// node_modules/.pnpm/@popcraft+plugins@1.
|
|
115
|
+
// node_modules/.pnpm/@popcraft+plugins@1.6.1/node_modules/@popcraft/plugins/dist/runtime/main.js
|
|
116
116
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
117
117
|
|
|
118
|
-
// node_modules/.pnpm/@popcraft+plugins@1.
|
|
118
|
+
// node_modules/.pnpm/@popcraft+plugins@1.6.1/node_modules/@popcraft/plugins/dist/runtime/rpc.js
|
|
119
119
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
120
120
|
|
|
121
|
-
// node_modules/.pnpm/@popcraft+plugins@1.
|
|
121
|
+
// node_modules/.pnpm/@popcraft+plugins@1.6.1/node_modules/@popcraft/plugins/dist/types.js
|
|
122
122
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
123
123
|
|
|
124
|
-
// node_modules/.pnpm/@popcraft+plugins@1.
|
|
124
|
+
// node_modules/.pnpm/@popcraft+plugins@1.6.1/node_modules/@popcraft/plugins/dist/widget.js
|
|
125
125
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
126
126
|
|
|
127
127
|
// lib/plugins/ui-theme.ts
|
|
@@ -567,6 +567,13 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
567
567
|
}
|
|
568
568
|
}),
|
|
569
569
|
hideUI: () => usePluginStore.getState().patchSession(sessionId, { ui: null }),
|
|
570
|
+
setPanelIcon: (o) => {
|
|
571
|
+
const panels = plugin.manifest.contributes?.panels ?? [];
|
|
572
|
+
const panel = o.panel ? panels.find((x) => x.id === o.panel) : panels[0];
|
|
573
|
+
if (!panel) throw new Error(o.panel ? `No panel "${o.panel}" in manifest.contributes.panels` : "This plugin has no panels in manifest.contributes.panels");
|
|
574
|
+
const tab = pluginPanelTab(pluginId, panel.id);
|
|
575
|
+
usePluginStore.getState().setPanelIcon(tab, o.icon ? { pluginId, icon: o.icon, color: !!o.color } : null);
|
|
576
|
+
},
|
|
570
577
|
close: (message) => {
|
|
571
578
|
const sel = message ? [...useEditorStore.getState().selection] : [];
|
|
572
579
|
closeSession(sessionId);
|
|
@@ -579,7 +586,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
579
586
|
if (!openBeside(url)) throw new Error("The browser blocked the new tab");
|
|
580
587
|
},
|
|
581
588
|
createDocument: async (opts2) => {
|
|
582
|
-
const { createFreshFileOrExplain } = await import("./new-file-
|
|
589
|
+
const { createFreshFileOrExplain } = await import("./new-file-N5JRPB7A.js");
|
|
583
590
|
const created = await createFreshFileOrExplain({}, { name: opts2?.name });
|
|
584
591
|
if (!created.ok) throw new Error(created.reason === "plan" ? "Plan limit reached" : created.reason === "guest-limit" ? "Sign in to create another file" : `Could not create file (${created.reason})`);
|
|
585
592
|
await useEditorStore.getState().openDocument(created.docId);
|
|
@@ -756,6 +763,15 @@ function closeSession(sessionId) {
|
|
|
756
763
|
s.uiPort?.close();
|
|
757
764
|
s.iframe.remove();
|
|
758
765
|
usePluginStore.getState().removeSession(sessionId);
|
|
766
|
+
usePluginStore.getState().clearPanelIcons(s.plugin.manifest.id);
|
|
767
|
+
}
|
|
768
|
+
function autostartPluginPanels(installed) {
|
|
769
|
+
for (const p of installed) {
|
|
770
|
+
if (!p.enabled || p.granted === null || !p.manifest.main) continue;
|
|
771
|
+
const panel = p.manifest.contributes?.panels?.find((x) => x.autostart);
|
|
772
|
+
if (!panel || runningSessionFor(p.manifest.id)) continue;
|
|
773
|
+
void runPlugin(p.manifest.id, panel.command ?? panel.id, { dock: pluginPanelTab(p.manifest.id, panel.id) });
|
|
774
|
+
}
|
|
759
775
|
}
|
|
760
776
|
if (typeof window !== "undefined" && false) {
|
|
761
777
|
window.__vpPlugins = { installPluginPayload, runPlugin, dispatchWidgetClick, closeSession, removePlugin, setEnabled, running };
|
|
@@ -769,7 +785,7 @@ if (typeof window !== "undefined") {
|
|
|
769
785
|
const name = d.name || "Imported";
|
|
770
786
|
void (async () => {
|
|
771
787
|
try {
|
|
772
|
-
const { importViaPlugin, applyPluginLayoutIr } = await import("./plugin-import-
|
|
788
|
+
const { importViaPlugin, applyPluginLayoutIr } = await import("./plugin-import-S2EP2X6N.js");
|
|
773
789
|
if (d.ir && typeof d.ir === "object") {
|
|
774
790
|
await applyPluginLayoutIr(d.ir, { mode, name });
|
|
775
791
|
return;
|
|
@@ -801,5 +817,6 @@ export {
|
|
|
801
817
|
attachPluginUI,
|
|
802
818
|
pluginUIDocument,
|
|
803
819
|
dispatchWidgetClick,
|
|
804
|
-
closeSession
|
|
820
|
+
closeSession,
|
|
821
|
+
autostartPluginPanels
|
|
805
822
|
};
|
|
@@ -28,10 +28,10 @@ import {
|
|
|
28
28
|
requestImageAction,
|
|
29
29
|
sizeForAspect,
|
|
30
30
|
vectorSupport
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-7EBRN34K.js";
|
|
32
32
|
import {
|
|
33
33
|
useEditorStore
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-662GNCQQ.js";
|
|
35
35
|
import {
|
|
36
36
|
withHistoryGroup
|
|
37
37
|
} from "./chunk-XK56NJG6.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
hostEnv,
|
|
13
13
|
plain,
|
|
14
14
|
registerBuiltinCommands
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-6ZFNAY5O.js";
|
|
16
16
|
import {
|
|
17
17
|
external_exports
|
|
18
18
|
} from "./chunk-3QZXQL3W.js";
|
|
@@ -391,6 +391,7 @@ function isOpenableUrl(v) {
|
|
|
391
391
|
return false;
|
|
392
392
|
}
|
|
393
393
|
}
|
|
394
|
+
var MAX_PANEL_ICON_CHARS = 64 * 1024;
|
|
394
395
|
var MAX_UPLOAD_BYTES = 500 * 1024 * 1024;
|
|
395
396
|
var MAX_UPLOAD_REPLY_CHARS = 1024 * 1024;
|
|
396
397
|
function pluginOf(ctx) {
|
|
@@ -539,6 +540,33 @@ var commands = [
|
|
|
539
540
|
return { summary: "UI shown" };
|
|
540
541
|
}
|
|
541
542
|
}),
|
|
543
|
+
defineCommand({
|
|
544
|
+
id: pluginCommandId("setPanelIcon"),
|
|
545
|
+
title: "Set panel icon",
|
|
546
|
+
domain: "ui",
|
|
547
|
+
params: external_exports.object({
|
|
548
|
+
panel: external_exports.string().optional(),
|
|
549
|
+
icon: external_exports.string().nullable().optional(),
|
|
550
|
+
color: external_exports.boolean().optional()
|
|
551
|
+
}),
|
|
552
|
+
effect: "none",
|
|
553
|
+
permission: null,
|
|
554
|
+
needs: ["panel"],
|
|
555
|
+
expose: { plugin: { method: "setPanelIcon" } },
|
|
556
|
+
run: (p, ctx) => {
|
|
557
|
+
const icon = p.icon ?? null;
|
|
558
|
+
if (icon !== null && !/^data:image\/(svg\+xml|png|webp)[;,]/.test(icon)) {
|
|
559
|
+
throw new PluginApiError("icon must be a data:image/svg+xml, png or webp URL", "invalid_params");
|
|
560
|
+
}
|
|
561
|
+
if (icon !== null && icon.length > MAX_PANEL_ICON_CHARS) {
|
|
562
|
+
throw new PluginApiError(`icon is limited to ${MAX_PANEL_ICON_CHARS} characters`, "invalid_params");
|
|
563
|
+
}
|
|
564
|
+
const set = ctx.use("panel").setPanelIcon;
|
|
565
|
+
if (!set) throw new PluginApiError("Panel icons are not available here");
|
|
566
|
+
set({ panel: p.panel, icon, color: p.color });
|
|
567
|
+
return { summary: icon ? "Panel icon set" : "Panel icon reset" };
|
|
568
|
+
}
|
|
569
|
+
}),
|
|
542
570
|
defineCommand({
|
|
543
571
|
id: pluginCommandId("hideUI"),
|
|
544
572
|
title: "Hide plugin UI",
|
|
@@ -618,7 +646,7 @@ var commands = [
|
|
|
618
646
|
const [{ storefrontInputs }, { STOREFRONT_TARGETS }, { bytesOf }, { zipFiles }, { EXPORT_NODE_CAP }] = await Promise.all([
|
|
619
647
|
import("./storefront-prepare-YW32JKQ5.js"),
|
|
620
648
|
import("./storefront-TQZ7UUBP.js"),
|
|
621
|
-
import("./project-
|
|
649
|
+
import("./project-F7WQIMI5.js"),
|
|
622
650
|
import("./zip-export-BOKYQ7BT.js"),
|
|
623
651
|
import("./tree-2DYDMOCC.js")
|
|
624
652
|
]);
|
|
@@ -815,7 +843,7 @@ var pluginRun = defineCommand({
|
|
|
815
843
|
}
|
|
816
844
|
},
|
|
817
845
|
run: async (p, ctx) => {
|
|
818
|
-
const { runPlugin } = await import("./host-
|
|
846
|
+
const { runPlugin } = await import("./host-AQJ33HVQ.js");
|
|
819
847
|
await runPlugin(p.pluginId, p.commandId);
|
|
820
848
|
ctx.notice(`Started ${p.pluginId}.`);
|
|
821
849
|
return {
|
|
@@ -881,7 +909,7 @@ function pluginContext(env) {
|
|
|
881
909
|
return out;
|
|
882
910
|
},
|
|
883
911
|
storage: { get: env.effects.storageGet, set: env.effects.storageSet },
|
|
884
|
-
panel: { showUI: env.effects.showUI, hideUI: env.effects.hideUI, close: env.effects.close }
|
|
912
|
+
panel: { showUI: env.effects.showUI, hideUI: env.effects.hideUI, close: env.effects.close, setPanelIcon: env.effects.setPanelIcon }
|
|
885
913
|
};
|
|
886
914
|
const st = () => env.getState();
|
|
887
915
|
return {
|
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
reportOpenStage,
|
|
14
14
|
setCloudLink,
|
|
15
15
|
trackOpen
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-YTSYQYRT.js";
|
|
17
17
|
import {
|
|
18
18
|
parseDeepLink,
|
|
19
19
|
withDeepLink
|
|
20
20
|
} from "./chunk-2FJESNGC.js";
|
|
21
21
|
import {
|
|
22
22
|
activeTeamWorkspaceId
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-QPHW6JE2.js";
|
|
24
24
|
import {
|
|
25
25
|
attachPresence
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-QL5BYW63.js";
|
|
27
27
|
import {
|
|
28
28
|
fileOpeningMode,
|
|
29
29
|
isAppleMobile,
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
setCollabHistory,
|
|
37
37
|
storedDocument,
|
|
38
38
|
useEditorStore
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-662GNCQQ.js";
|
|
40
40
|
import {
|
|
41
41
|
currentHistoryGroup
|
|
42
42
|
} from "./chunk-XK56NJG6.js";
|
|
@@ -91,9 +91,9 @@ async function placeStockPhoto(photo, opts = {}) {
|
|
|
91
91
|
}
|
|
92
92
|
async function placePicture(imported, opts = {}) {
|
|
93
93
|
const [{ useEditorStore }, { photoFrameOf }, { placeImage }] = await Promise.all([
|
|
94
|
-
import("./editor-store-
|
|
94
|
+
import("./editor-store-YFW4DJ5W.js"),
|
|
95
95
|
import("../lib/document/photo-frames.js"),
|
|
96
|
-
import("./media-tool-
|
|
96
|
+
import("./media-tool-GN3HGXTE.js")
|
|
97
97
|
]);
|
|
98
98
|
const st = useEditorStore.getState();
|
|
99
99
|
const frame = photoFrameOf(st.document.nodes, opts.targetId !== void 0 ? opts.targetId : st.selection[0] ?? null);
|
|
@@ -57,19 +57,19 @@ async function renderDocument(doc, nodeIds, options) {
|
|
|
57
57
|
function generateCapability(ctx) {
|
|
58
58
|
return async (prompt, options = {}) => {
|
|
59
59
|
if (options.format === "audio") {
|
|
60
|
-
const { requestAudio } = await import("./client-
|
|
60
|
+
const { requestAudio } = await import("./client-FO26KEPK.js");
|
|
61
61
|
const { signal: signal2, format: _f, ...rest2 } = options;
|
|
62
62
|
void _f;
|
|
63
63
|
return requestAudio({ prompt, ...rest2 }, signal2 ?? ctx.signal);
|
|
64
64
|
}
|
|
65
65
|
if (options.format === "video") {
|
|
66
|
-
const { generateVideoFile } = await import("./generate-media-
|
|
66
|
+
const { generateVideoFile } = await import("./generate-media-5PJDPAWR.js");
|
|
67
67
|
const { format: _f, signal: signal2, ...rest2 } = options;
|
|
68
68
|
void _f;
|
|
69
69
|
return generateVideoFile({ ...rest2, prompt, doc: ctx.doc() }, { signal: signal2 ?? ctx.signal });
|
|
70
70
|
}
|
|
71
71
|
const [{ requestImage }, { effectiveImageModel, useAiStore }] = await Promise.all([
|
|
72
|
-
import("./client-
|
|
72
|
+
import("./client-FO26KEPK.js"),
|
|
73
73
|
import("./client-store-DU6THDGV.js")
|
|
74
74
|
]);
|
|
75
75
|
const modelId = effectiveImageModel(useAiStore.getState());
|
|
@@ -6,14 +6,14 @@ const __filename = __popcraftPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __popcraftDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
pluginRun
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-IPGN7XPW.js";
|
|
10
10
|
import {
|
|
11
11
|
fileCommands,
|
|
12
12
|
fontTeamRemove,
|
|
13
13
|
integrationConfirmCommands,
|
|
14
14
|
mediaDelete,
|
|
15
15
|
publishCommands
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6ZFNAY5O.js";
|
|
17
17
|
import {
|
|
18
18
|
external_exports
|
|
19
19
|
} from "./chunk-3QZXQL3W.js";
|
|
@@ -53,7 +53,7 @@ var collabSetSpotlight = defineCommand({
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
run: async ({ on }, ctx) => {
|
|
56
|
-
const { setSpotlight } = await import("./presence-
|
|
56
|
+
const { setSpotlight } = await import("./presence-KXQY3TQT.js");
|
|
57
57
|
setSpotlight(on);
|
|
58
58
|
ctx.notice(on ? "Spotlight on \u2014 everyone is following this view." : "Spotlight off.");
|
|
59
59
|
return { summary: on ? "Spotlight on" : "Spotlight off", data: { spotlight: on } };
|
|
@@ -80,7 +80,7 @@ var collabRevealPrivate = defineCommand({
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
run: async (_p, ctx) => {
|
|
83
|
-
const { useEditorStore } = await import("./editor-store-
|
|
83
|
+
const { useEditorStore } = await import("./editor-store-YFW4DJ5W.js");
|
|
84
84
|
const before = Object.values(useEditorStore.getState().document.nodes).filter((n) => n.privateTo).length;
|
|
85
85
|
useEditorStore.getState().revealPrivate();
|
|
86
86
|
ctx.notice(before ? `Revealed ${before} private item${before === 1 ? "" : "s"}.` : "Nothing was private.");
|
|
@@ -144,7 +144,7 @@ var documentDelete = defineCommand({
|
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
146
|
run: async ({ id }, ctx) => {
|
|
147
|
-
const { useEditorStore } = await import("./editor-store-
|
|
147
|
+
const { useEditorStore } = await import("./editor-store-YFW4DJ5W.js");
|
|
148
148
|
const wasOpen = useEditorStore.getState().document.id === id;
|
|
149
149
|
await useEditorStore.getState().deleteDocument(id);
|
|
150
150
|
ctx.notice("Deleted the document.");
|
|
@@ -188,7 +188,7 @@ var libraryPublish = defineCommand({
|
|
|
188
188
|
}
|
|
189
189
|
},
|
|
190
190
|
run: async (p, ctx) => {
|
|
191
|
-
const { publishLibrary } = await import("./libraries-
|
|
191
|
+
const { publishLibrary } = await import("./libraries-IXCZAWIM.js");
|
|
192
192
|
const doc = ctx.doc();
|
|
193
193
|
const pick = {
|
|
194
194
|
componentIds: p.componentIds ?? Object.keys(doc.components ?? {}),
|
|
@@ -220,7 +220,7 @@ var libraryUnpublish = defineCommand({
|
|
|
220
220
|
},
|
|
221
221
|
run: async ({ libraryId }, ctx) => {
|
|
222
222
|
if (!libraryId.trim()) throw new CommandError("Which library? Pass its `libraryId`.", "invalid_params");
|
|
223
|
-
const { unpublishLibrary } = await import("./libraries-
|
|
223
|
+
const { unpublishLibrary } = await import("./libraries-IXCZAWIM.js");
|
|
224
224
|
await unpublishLibrary(libraryId);
|
|
225
225
|
ctx.notice(`Unpublished library ${libraryId}.`);
|
|
226
226
|
return { summary: `Unpublished library ${libraryId}`, data: { libraryId, unpublished: true } };
|
|
@@ -232,8 +232,8 @@ var libraryCommands = [libraryPublish, libraryUnpublish];
|
|
|
232
232
|
init_define_POPCRAFT_COMPONENT_IDS();
|
|
233
233
|
async function findVersion(id) {
|
|
234
234
|
const [{ useEditorStore }, { versionLabel }] = await Promise.all([
|
|
235
|
-
import("./editor-store-
|
|
236
|
-
import("./versions-
|
|
235
|
+
import("./editor-store-YFW4DJ5W.js"),
|
|
236
|
+
import("./versions-RHYSSG3I.js")
|
|
237
237
|
]);
|
|
238
238
|
const meta = useEditorStore.getState().versions.find((v) => v.id === id);
|
|
239
239
|
if (!meta) {
|
|
@@ -266,7 +266,7 @@ var versionRestore = defineCommand({
|
|
|
266
266
|
},
|
|
267
267
|
run: async ({ id }) => {
|
|
268
268
|
const found = await findVersion(id);
|
|
269
|
-
const { restoreVersion } = await import("./versions-
|
|
269
|
+
const { restoreVersion } = await import("./versions-RHYSSG3I.js");
|
|
270
270
|
await restoreVersion(found.meta);
|
|
271
271
|
return { summary: `Restored \u201C${found.label}\u201D`, data: { id, label: found.label, restored: true } };
|
|
272
272
|
}
|
|
@@ -291,7 +291,7 @@ var versionDelete = defineCommand({
|
|
|
291
291
|
},
|
|
292
292
|
run: async ({ id }, ctx) => {
|
|
293
293
|
const found = await findVersion(id);
|
|
294
|
-
const { deleteVersion } = await import("./versions-
|
|
294
|
+
const { deleteVersion } = await import("./versions-RHYSSG3I.js");
|
|
295
295
|
await deleteVersion(found.meta);
|
|
296
296
|
ctx.notice(`Deleted the version \u201C${found.label}\u201D.`);
|
|
297
297
|
return { summary: `Deleted the version \u201C${found.label}\u201D`, data: { id, label: found.label, deleted: true } };
|
|
@@ -7,10 +7,10 @@ const __dirname = __popcraftDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
builtinCommands,
|
|
9
9
|
registerBuiltinCommands
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6ZFNAY5O.js";
|
|
11
11
|
import {
|
|
12
12
|
toolView
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-NEZIWVGN.js";
|
|
14
14
|
import {
|
|
15
15
|
init_define_POPCRAFT_COMPONENT_IDS
|
|
16
16
|
} from "./chunk-34VP5O27.js";
|
|
@@ -150,7 +150,7 @@ function startHyperyTeams() {
|
|
|
150
150
|
maybePromptForTeam();
|
|
151
151
|
void followFileTeam(linkedKey);
|
|
152
152
|
});
|
|
153
|
-
void import("./sync-
|
|
153
|
+
void import("./sync-HIAMQQYN.js").then(({ onSyncStatus, syncStatus }) => {
|
|
154
154
|
linkedKey = syncStatus().link?.key ?? null;
|
|
155
155
|
void followFileTeam(linkedKey);
|
|
156
156
|
onSyncStatus((_s, link) => {
|
|
@@ -9,13 +9,13 @@ import {
|
|
|
9
9
|
} from "./chunk-5Z3PWMIP.js";
|
|
10
10
|
import {
|
|
11
11
|
activeTeamWorkspaceId
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-QPHW6JE2.js";
|
|
13
13
|
import {
|
|
14
14
|
prepareTemplate
|
|
15
15
|
} from "./chunk-NUVFMZV7.js";
|
|
16
16
|
import {
|
|
17
17
|
markLibraryDocument
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-662GNCQQ.js";
|
|
19
19
|
import {
|
|
20
20
|
listDocMetas,
|
|
21
21
|
saveDocSnapshot
|
|
@@ -7,7 +7,7 @@ const __dirname = __popcraftDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
defaultMeasure,
|
|
9
9
|
placePicture
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-L4ZLPYBN.js";
|
|
11
11
|
import "./chunk-YKLYCEHF.js";
|
|
12
12
|
import {
|
|
13
13
|
api
|
|
@@ -122,7 +122,7 @@ async function placeLibraryItem(item, opts = {}) {
|
|
|
122
122
|
}
|
|
123
123
|
if (item.contentType.startsWith("video/")) {
|
|
124
124
|
const file = await libraryFile(item, opts);
|
|
125
|
-
const [{ useEditorStore }, { placeMediaFile }] = await Promise.all([import("./editor-store-
|
|
125
|
+
const [{ useEditorStore }, { placeMediaFile }] = await Promise.all([import("./editor-store-YFW4DJ5W.js"), import("./media-tool-GN3HGXTE.js")]);
|
|
126
126
|
const cam = useEditorStore.getState().camera;
|
|
127
127
|
await placeMediaFile(file, { kind: "point", ...opts.at ?? { x: cam.x, y: cam.y } });
|
|
128
128
|
return useEditorStore.getState().selection[0] ?? null;
|