@popcraft/kit 0.53.16 → 0.53.18
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-CMHX6TIO.js → agent-QSCYOPEH.js} +1 -1
- package/dist/chunks/{builtin-RTTBLUAL.js → builtin-5P5A2IMY.js} +4 -4
- package/dist/chunks/{buy-credits-DD453AXQ.js → buy-credits-LK6QXRXO.js} +2 -2
- package/dist/chunks/{check-template-JUZALH4J.js → check-template-SWWOPCV6.js} +3 -3
- package/dist/chunks/{chunk-GZZNTUHF.js → chunk-2O3AJLC7.js} +5 -5
- package/dist/chunks/{chunk-MUOTQRR5.js → chunk-35ZHGX7R.js} +3 -3
- package/dist/chunks/{chunk-ESP2XWO3.js → chunk-56ZMLITS.js} +4 -4
- package/dist/chunks/{chunk-WNCUXXQ3.js → chunk-735IMMB6.js} +4 -4
- package/dist/chunks/{chunk-ZIOF5AO6.js → chunk-7G7UOKM4.js} +1 -1
- package/dist/chunks/{chunk-YPSNEHNF.js → chunk-7HICNIH2.js} +54 -54
- package/dist/chunks/{chunk-KU4HCWYC.js → chunk-7PRWYB7R.js} +4 -4
- package/dist/chunks/{chunk-JQNEQDKU.js → chunk-7R77JLIP.js} +1 -1
- package/dist/chunks/{chunk-AGOLJ27G.js → chunk-AN22TGNL.js} +3 -1
- package/dist/chunks/{chunk-FUS7Y4SS.js → chunk-ASMDKFSL.js} +1 -1
- package/dist/chunks/{chunk-W2PQ27E2.js → chunk-C4JKLCPX.js} +10 -10
- package/dist/chunks/{chunk-IFDOQEHS.js → chunk-E6LFTCYF.js} +4 -4
- package/dist/chunks/{chunk-XI7YE4K3.js → chunk-ETC4DTCD.js} +2 -2
- package/dist/chunks/{chunk-2FFA6464.js → chunk-F4AFFSFA.js} +4 -4
- package/dist/chunks/{chunk-KMGJ55U3.js → chunk-GZWJRQRF.js} +1 -1
- package/dist/chunks/{chunk-LVENLTN6.js → chunk-HC2BCDFS.js} +4 -4
- package/dist/chunks/{chunk-ZEERADTI.js → chunk-I5VBP754.js} +12 -12
- package/dist/chunks/{chunk-IIPH3CZZ.js → chunk-IY5UZMTO.js} +251 -2
- package/dist/chunks/{chunk-EIPEDGHA.js → chunk-L5MSOOYG.js} +2 -2
- package/dist/chunks/{chunk-S2QORHQB.js → chunk-LC62KWV5.js} +2 -2
- package/dist/chunks/{chunk-KWJBP75Z.js → chunk-LPGPKUME.js} +1 -1
- package/dist/chunks/{chunk-D5EG45LZ.js → chunk-MGLGBL5N.js} +12 -12
- package/dist/chunks/{chunk-2KPU4QCV.js → chunk-NK4G5HDO.js} +28 -7
- package/dist/chunks/{chunk-XSYCOMIX.js → chunk-OK3DQPII.js} +280 -54
- package/dist/chunks/{chunk-QS4AT3DM.js → chunk-RPZJC2IG.js} +2 -4
- package/dist/chunks/{chunk-LV2DMDTD.js → chunk-VWL5XI7L.js} +11 -11
- package/dist/chunks/{chunk-XKUI2K2V.js → chunk-X4JKF2JG.js} +214 -1
- package/dist/chunks/{chunk-K63NQAOB.js → chunk-XE6NJFI2.js} +89 -89
- package/dist/chunks/{client-XKJT4H2P.js → client-3JR3D6HI.js} +3 -3
- package/dist/chunks/{client-RMWHGLS4.js → client-7ABQN2CO.js} +1 -1
- package/dist/chunks/{client-MCO72XP4.js → client-LHZIJH23.js} +2 -2
- package/dist/chunks/{client-actions-IRIVVQJJ.js → client-actions-VNMC4A7Z.js} +13 -14
- package/dist/chunks/{dangerous-IGR27D2F.js → dangerous-VGWX2YEI.js} +4 -4
- package/dist/chunks/{delete-current-file-OHKLBKKQ.js → delete-current-file-5IZOBWY2.js} +9 -10
- package/dist/chunks/{editor-seams-WVHFVQHE.js → editor-seams-4M7R4HNW.js} +18 -20
- package/dist/chunks/{editor-store-A2SNJTLI.js → editor-store-L4V3QA4A.js} +5 -5
- package/dist/chunks/{export-FWVSW5AN.js → export-FZA6A6I6.js} +1 -1
- package/dist/chunks/{export-watermark-KGGTO4O4.js → export-watermark-3FQ7QOYR.js} +9 -10
- package/dist/chunks/{eyedropper-4FPMVPMA.js → eyedropper-P3ZONVHS.js} +7 -11
- package/dist/chunks/{generate-media-XVYKOX6Q.js → generate-media-SSWL4Y2L.js} +4 -4
- package/dist/chunks/{host-YTWNKTAD.js → host-VSSIPMLW.js} +14 -17
- package/dist/chunks/{integrations-V57Q7LUC.js → integrations-OQV4PCCS.js} +1 -1
- package/dist/chunks/{libraries-T6HTLURU.js → libraries-CWODJKJI.js} +9 -10
- package/dist/chunks/{live-EA3LBJFA.js → live-DQITX7DB.js} +5 -5
- package/dist/chunks/{lottie-AGAHYTZE.js → lottie-ZKR6H64U.js} +3 -4
- package/dist/chunks/{media-tool-RYUZKR7X.js → media-tool-3IFICUR3.js} +12 -126
- package/dist/chunks/{new-file-UQQMA2GY.js → new-file-GYD6TJYO.js} +7 -7
- package/dist/chunks/{pdf-X3ZB6QKO.js → pdf-RPD6QHMP.js} +5 -7
- package/dist/chunks/{player-check-ZGWLAHXY.js → player-check-CZVWUJXW.js} +3 -4
- package/dist/chunks/{plugin-E3ILJQPJ.js → plugin-V2XZNMZE.js} +3 -3
- package/dist/chunks/{plugin-import-TI46GQFN.js → plugin-import-UFRJVWX3.js} +23 -26
- package/dist/chunks/{pptx-OI7DTHPN.js → pptx-QZMA6SRM.js} +3 -4
- package/dist/chunks/{presence-FTKMD5F3.js → presence-GGLTIRS2.js} +6 -6
- package/dist/chunks/{project-JGVNQ5OU.js → project-XENIE5UL.js} +3 -3
- package/dist/chunks/{publish-site-TEZEZGDT.js → publish-site-HBMHT6ZH.js} +10 -11
- package/dist/chunks/{publish-store-WUY2P2RZ.js → publish-store-PFXW7OCQ.js} +5 -5
- package/dist/chunks/{raster-actions-DI55TXCE.js → raster-actions-ZGFZYTAH.js} +7 -11
- package/dist/chunks/{reference-images-36D6WIRI.js → reference-images-RAJE3NRE.js} +2 -2
- package/dist/chunks/{resolvers-V6SR7XRN.js → resolvers-J3DRJJ7P.js} +5 -6
- package/dist/chunks/{runner-OYGJ7BEH.js → runner-KSX7DGFW.js} +25 -27
- package/dist/chunks/{store-EUIN7C5G.js → store-4GUNFV7U.js} +14 -15
- package/dist/chunks/{storefront-prepare-6WYLPH6E.js → storefront-prepare-S6A5FZXC.js} +1 -1
- package/dist/chunks/{svg-export-QTVHP7B2.js → svg-export-J23NHZWC.js} +4 -5
- package/dist/chunks/{sync-THYAERCF.js → sync-K2VRUB23.js} +9 -10
- package/dist/chunks/{tabs-IURSKOB4.js → tabs-A6SMBMFX.js} +12 -12
- package/dist/chunks/{team-WYTKJA5K.js → team-T3SVBBAO.js} +1 -1
- package/dist/chunks/{team-client-QABPVGKN.js → team-client-S3GCAISX.js} +1 -1
- package/dist/chunks/{theme-store-FAYEXX7K.js → theme-store-CBS2LI4H.js} +2 -3
- package/dist/chunks/{tools-676MQY7D.js → tools-JRQSLBJK.js} +2 -2
- package/dist/chunks/{ui-commands-TRN7NNDS.js → ui-commands-ECGJ3AYH.js} +20 -22
- package/dist/chunks/{versions-6I33EUEK.js → versions-MP3FT4IV.js} +9 -10
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-C3QJHVOH.js +0 -269
- package/dist/chunks/chunk-I5REOOP7.js +0 -225
- package/dist/chunks/chunk-P4LE4WLR.js +0 -25
- package/dist/chunks/chunk-ZBANBY2Q.js +0 -27
|
@@ -20,14 +20,14 @@ import {
|
|
|
20
20
|
} from "./chunk-D6YVHRBL.js";
|
|
21
21
|
import {
|
|
22
22
|
notice
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-56ZMLITS.js";
|
|
24
24
|
import {
|
|
25
25
|
agentContext
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-735IMMB6.js";
|
|
27
27
|
import {
|
|
28
28
|
collabSession,
|
|
29
29
|
syncStatus
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-NK4G5HDO.js";
|
|
31
31
|
import {
|
|
32
32
|
loadEntitlements
|
|
33
33
|
} from "./chunk-6TMH7HCQ.js";
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
} from "./chunk-7OJZZPU4.js";
|
|
37
37
|
import {
|
|
38
38
|
useEditorStore
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-OK3DQPII.js";
|
|
40
40
|
import {
|
|
41
41
|
getActiveRenderer
|
|
42
42
|
} from "./chunk-A2DCJZGE.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-K2VRUB23.js").then(({ onSyncStatus, syncStatus }) => {
|
|
154
154
|
linkedKey = syncStatus().link?.key ?? null;
|
|
155
155
|
void followFileTeam(linkedKey);
|
|
156
156
|
onSyncStatus((_s, link) => {
|
|
@@ -6,7 +6,7 @@ const __filename = __popcraftPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __popcraftDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
hyperyRequestHeaders
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ASMDKFSL.js";
|
|
10
10
|
import {
|
|
11
11
|
aiAvailability,
|
|
12
12
|
effectiveChatModel,
|
|
@@ -75,6 +75,8 @@ var AiClientError = class extends Error {
|
|
|
75
75
|
this.code = code;
|
|
76
76
|
this.status = status;
|
|
77
77
|
}
|
|
78
|
+
code;
|
|
79
|
+
status;
|
|
78
80
|
};
|
|
79
81
|
var needsReauth = (e) => e instanceof AiClientError && (e.code === "ai_reauth" || e.code === "ai_scope" || e.code === "unauthenticated");
|
|
80
82
|
function ensureAvailable() {
|
|
@@ -6,7 +6,7 @@ const __filename = __popcraftPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __popcraftDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
useThemeStore
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RPZJC2IG.js";
|
|
10
10
|
import {
|
|
11
11
|
external_exports
|
|
12
12
|
} from "./chunk-UDDWBCFE.js";
|
|
@@ -15,27 +15,27 @@ import {
|
|
|
15
15
|
} from "./chunk-T2U7UWFL.js";
|
|
16
16
|
import {
|
|
17
17
|
syncStatus
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-NK4G5HDO.js";
|
|
19
19
|
import {
|
|
20
20
|
exportNodeToSVG
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-I5VBP754.js";
|
|
22
22
|
import {
|
|
23
23
|
exportNodeToBlob
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-35ZHGX7R.js";
|
|
25
25
|
import {
|
|
26
26
|
usePluginStore
|
|
27
27
|
} from "./chunk-N72PY6HV.js";
|
|
28
28
|
import {
|
|
29
29
|
setPluginTabs,
|
|
30
30
|
useEditorStore
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-OK3DQPII.js";
|
|
32
32
|
import {
|
|
33
33
|
openBeside
|
|
34
34
|
} from "./chunk-HU75T2CC.js";
|
|
35
35
|
import {
|
|
36
36
|
TOKEN_IDS,
|
|
37
37
|
tokenVar
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-X4JKF2JG.js";
|
|
39
39
|
import {
|
|
40
40
|
getActiveRenderer
|
|
41
41
|
} from "./chunk-A2DCJZGE.js";
|
|
@@ -69,7 +69,7 @@ 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-V2XZNMZE.js");
|
|
73
73
|
return dispatchPluginCall(env, method, params);
|
|
74
74
|
}
|
|
75
75
|
|
|
@@ -579,7 +579,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
579
579
|
if (!openBeside(url)) throw new Error("The browser blocked the new tab");
|
|
580
580
|
},
|
|
581
581
|
createDocument: async (opts2) => {
|
|
582
|
-
const { createFreshFileOrExplain } = await import("./new-file-
|
|
582
|
+
const { createFreshFileOrExplain } = await import("./new-file-GYD6TJYO.js");
|
|
583
583
|
const created = await createFreshFileOrExplain({}, { name: opts2?.name });
|
|
584
584
|
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
585
|
await useEditorStore.getState().openDocument(created.docId);
|
|
@@ -600,7 +600,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
600
600
|
const st = useEditorStore.getState();
|
|
601
601
|
const node = nodes[0];
|
|
602
602
|
if (format === "PDF") {
|
|
603
|
-
const { exportNodesToPDF } = await import("./pdf-
|
|
603
|
+
const { exportNodesToPDF } = await import("./pdf-RPD6QHMP.js");
|
|
604
604
|
const { jobPageSize } = await import("../lib/document/print-pages.js");
|
|
605
605
|
const { loadFullBleed } = await import("./print-prefs-VVROSDT2.js");
|
|
606
606
|
const blob2 = await exportNodesToPDF(renderer, nodes, { dpi: 300, bleed: bleed ?? !loadFullBleed(), marks: false, splitSpreads: true, pageSize: jobPageSize(st.document) }, st.document, st.document.styles);
|
|
@@ -769,7 +769,7 @@ if (typeof window !== "undefined") {
|
|
|
769
769
|
const name = d.name || "Imported";
|
|
770
770
|
void (async () => {
|
|
771
771
|
try {
|
|
772
|
-
const { importViaPlugin, applyPluginLayoutIr } = await import("./plugin-import-
|
|
772
|
+
const { importViaPlugin, applyPluginLayoutIr } = await import("./plugin-import-UFRJVWX3.js");
|
|
773
773
|
if (d.ir && typeof d.ir === "object") {
|
|
774
774
|
await applyPluginLayoutIr(d.ir, { mode, name });
|
|
775
775
|
return;
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-6YGUTIAY.js";
|
|
10
10
|
import {
|
|
11
11
|
notice
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-56ZMLITS.js";
|
|
13
13
|
import {
|
|
14
14
|
effectiveChatModel,
|
|
15
15
|
setModelPref,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-L47DGY5Z.js";
|
|
18
18
|
import {
|
|
19
19
|
useEditorStore
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-OK3DQPII.js";
|
|
21
21
|
import {
|
|
22
22
|
create
|
|
23
23
|
} from "./chunk-RVNIEOXA.js";
|
|
@@ -1797,7 +1797,7 @@ async function sendMessage(text) {
|
|
|
1797
1797
|
if (!useAgentStore.getState().activeThreadId) newThread();
|
|
1798
1798
|
const mentions = pruneMentions(body, useAgentStore.getState().draftMentions);
|
|
1799
1799
|
useAgentStore.setState({ draft: "", draftMentions: [], error: null });
|
|
1800
|
-
const { runTurn } = await import("./runner-
|
|
1800
|
+
const { runTurn } = await import("./runner-KSX7DGFW.js");
|
|
1801
1801
|
await runTurn(body, mentions);
|
|
1802
1802
|
}
|
|
1803
1803
|
function stop() {
|
|
@@ -1900,7 +1900,7 @@ var clearTaskChildren = () => useAgentStore.setState({ taskChildren: {} });
|
|
|
1900
1900
|
function subscribeChildTools() {
|
|
1901
1901
|
let dispose;
|
|
1902
1902
|
let cancelled = false;
|
|
1903
|
-
void import("./runner-
|
|
1903
|
+
void import("./runner-KSX7DGFW.js").then(({ onChildTool }) => {
|
|
1904
1904
|
const off = onChildTool((report) => {
|
|
1905
1905
|
if (report?.status !== "running" || report.jobId) return;
|
|
1906
1906
|
recordChildTool(report.toolCallId ?? "", report.name);
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-6TMH7HCQ.js";
|
|
10
10
|
import {
|
|
11
11
|
activeTeamWorkspaceId
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7R77JLIP.js";
|
|
13
13
|
import {
|
|
14
14
|
ApiError,
|
|
15
15
|
GUEST_FILE_LIMIT,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
} from "./chunk-LCLQWQO2.js";
|
|
24
24
|
import {
|
|
25
25
|
markLibraryDocument
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-OK3DQPII.js";
|
|
27
27
|
import {
|
|
28
28
|
create
|
|
29
29
|
} from "./chunk-RVNIEOXA.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
hostEnv,
|
|
10
10
|
plain,
|
|
11
11
|
registerBuiltinCommands
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7HICNIH2.js";
|
|
13
13
|
import {
|
|
14
14
|
storeOpsSeam
|
|
15
15
|
} from "./chunk-GUR467P4.js";
|
|
@@ -616,9 +616,9 @@ var commands = [
|
|
|
616
616
|
// saves (the Ecommerce plugin's Shopify theme), so a target is written once, here, and never again in a plugin.
|
|
617
617
|
run: async (p, ctx) => {
|
|
618
618
|
const [{ storefrontInputs }, { STOREFRONT_TARGETS }, { bytesOf }, { zipFiles }, { EXPORT_NODE_CAP }] = await Promise.all([
|
|
619
|
-
import("./storefront-prepare-
|
|
619
|
+
import("./storefront-prepare-S6A5FZXC.js"),
|
|
620
620
|
import("./storefront-N34CMI4B.js"),
|
|
621
|
-
import("./project-
|
|
621
|
+
import("./project-XENIE5UL.js"),
|
|
622
622
|
import("./zip-export-ITATIAQ3.js"),
|
|
623
623
|
import("./tree-SQJHUZW2.js")
|
|
624
624
|
]);
|
|
@@ -815,7 +815,7 @@ var pluginRun = defineCommand({
|
|
|
815
815
|
}
|
|
816
816
|
},
|
|
817
817
|
run: async (p, ctx) => {
|
|
818
|
-
const { runPlugin } = await import("./host-
|
|
818
|
+
const { runPlugin } = await import("./host-VSSIPMLW.js");
|
|
819
819
|
await runPlugin(p.pluginId, p.commandId);
|
|
820
820
|
ctx.notice(`Started ${p.pluginId}.`);
|
|
821
821
|
return {
|
|
@@ -12,16 +12,16 @@ import {
|
|
|
12
12
|
ownsPath,
|
|
13
13
|
polylineFor
|
|
14
14
|
} from "./chunk-AFRAXU4Y.js";
|
|
15
|
+
import {
|
|
16
|
+
strokeBehindFill
|
|
17
|
+
} from "./chunk-FJL3DZQB.js";
|
|
15
18
|
import {
|
|
16
19
|
cornerRadii,
|
|
17
20
|
glyphCmds,
|
|
18
21
|
ringsCmds,
|
|
19
22
|
shapeCmds,
|
|
20
23
|
vectorCmds
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import {
|
|
23
|
-
strokeBehindFill
|
|
24
|
-
} from "./chunk-FJL3DZQB.js";
|
|
24
|
+
} from "./chunk-IY5UZMTO.js";
|
|
25
25
|
import {
|
|
26
26
|
childrenOf
|
|
27
27
|
} from "./chunk-H6JYMGPO.js";
|
|
@@ -15,29 +15,19 @@ import {
|
|
|
15
15
|
layoutText,
|
|
16
16
|
resolveThreadNode,
|
|
17
17
|
rootMatrix
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-HC2BCDFS.js";
|
|
19
19
|
import {
|
|
20
20
|
attachTextPath,
|
|
21
21
|
polylineOf,
|
|
22
22
|
reseamAt
|
|
23
23
|
} from "./chunk-AFRAXU4Y.js";
|
|
24
|
-
import {
|
|
25
|
-
cornerRadii,
|
|
26
|
-
fmt,
|
|
27
|
-
ringsCmds,
|
|
28
|
-
roundedRectCmds,
|
|
29
|
-
shapeCmds,
|
|
30
|
-
toSvgD,
|
|
31
|
-
trimCmds,
|
|
32
|
-
vectorCmds
|
|
33
|
-
} from "./chunk-C3QJHVOH.js";
|
|
34
24
|
import {
|
|
35
25
|
strokeBehindFill
|
|
36
26
|
} from "./chunk-FJL3DZQB.js";
|
|
37
27
|
import {
|
|
38
28
|
encodeImageData,
|
|
39
29
|
sliceRegion
|
|
40
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-35ZHGX7R.js";
|
|
41
31
|
import {
|
|
42
32
|
documentForExport
|
|
43
33
|
} from "./chunk-FFIZKGS2.js";
|
|
@@ -46,6 +36,16 @@ import {
|
|
|
46
36
|
stockPatternSvg,
|
|
47
37
|
stockPatternUrl
|
|
48
38
|
} from "./chunk-4VF6RACM.js";
|
|
39
|
+
import {
|
|
40
|
+
cornerRadii,
|
|
41
|
+
fmt,
|
|
42
|
+
ringsCmds,
|
|
43
|
+
roundedRectCmds,
|
|
44
|
+
shapeCmds,
|
|
45
|
+
toSvgD,
|
|
46
|
+
trimCmds,
|
|
47
|
+
vectorCmds
|
|
48
|
+
} from "./chunk-IY5UZMTO.js";
|
|
49
49
|
import {
|
|
50
50
|
bytesToBase64,
|
|
51
51
|
encodePng
|
|
@@ -5,12 +5,20 @@ const require = __popcraftRequire(import.meta.url);
|
|
|
5
5
|
const __filename = __popcraftPath(import.meta.url);
|
|
6
6
|
const __dirname = __popcraftDirname(__filename);
|
|
7
7
|
import {
|
|
8
|
+
glyphOutline,
|
|
8
9
|
init_flatten,
|
|
9
10
|
init_shape_outline,
|
|
11
|
+
init_text_rings,
|
|
10
12
|
shapeToRings
|
|
11
13
|
} from "./chunk-XK54ZTFX.js";
|
|
12
14
|
import {
|
|
13
|
-
|
|
15
|
+
fitCornersToBox,
|
|
16
|
+
init_shape_to_path,
|
|
17
|
+
init_trim,
|
|
18
|
+
isFullTrim,
|
|
19
|
+
polygonCorners,
|
|
20
|
+
starCorners,
|
|
21
|
+
trimPolylines
|
|
14
22
|
} from "./chunk-HOQFG5J7.js";
|
|
15
23
|
import {
|
|
16
24
|
init_define_POPCRAFT_COMPONENT_IDS
|
|
@@ -1845,8 +1853,249 @@ function computeBooleanMultiPoly(node, allNodes) {
|
|
|
1845
1853
|
return result;
|
|
1846
1854
|
}
|
|
1847
1855
|
|
|
1856
|
+
// lib/io/export-ir/paths.ts
|
|
1857
|
+
init_define_POPCRAFT_COMPONENT_IDS();
|
|
1858
|
+
init_trim();
|
|
1859
|
+
init_shape_to_path();
|
|
1860
|
+
init_text_rings();
|
|
1861
|
+
function fmt(n) {
|
|
1862
|
+
const r = Math.round(n * 100) / 100;
|
|
1863
|
+
return Object.is(r, -0) ? "0" : String(r);
|
|
1864
|
+
}
|
|
1865
|
+
function cornerRadii(node) {
|
|
1866
|
+
const cr = node.cornerRadius;
|
|
1867
|
+
if (typeof cr === "number") return [cr, cr, cr, cr];
|
|
1868
|
+
if (Array.isArray(cr)) return cr;
|
|
1869
|
+
return [0, 0, 0, 0];
|
|
1870
|
+
}
|
|
1871
|
+
var K = 0.5522847498;
|
|
1872
|
+
function arcTo(cmds, fromX, fromY, toX, toY, cx, cy) {
|
|
1873
|
+
cmds.push({ op: "C", x1: fromX + (cx - fromX) * K, y1: fromY + (cy - fromY) * K, x2: toX + (cx - toX) * K, y2: toY + (cy - toY) * K, x: toX, y: toY });
|
|
1874
|
+
}
|
|
1875
|
+
function fittedRadii(w, h, radii) {
|
|
1876
|
+
const maxR = Math.min(w, h) / 2;
|
|
1877
|
+
const fit = (r) => Math.max(0, Math.min(r || 0, maxR));
|
|
1878
|
+
return [fit(radii[0]), fit(radii[1]), fit(radii[2]), fit(radii[3])];
|
|
1879
|
+
}
|
|
1880
|
+
function roundedRectCmds(w, h, radii) {
|
|
1881
|
+
const [tl, tr, br, bl] = fittedRadii(w, h, radii);
|
|
1882
|
+
if (!tl && !tr && !br && !bl) return [{ op: "M", x: 0, y: 0 }, { op: "L", x: w, y: 0 }, { op: "L", x: w, y: h }, { op: "L", x: 0, y: h }, { op: "Z" }];
|
|
1883
|
+
const c = [{ op: "M", x: tl, y: 0 }, { op: "L", x: w - tr, y: 0 }];
|
|
1884
|
+
if (tr) arcTo(c, w - tr, 0, w, tr, w, 0);
|
|
1885
|
+
c.push({ op: "L", x: w, y: h - br });
|
|
1886
|
+
if (br) arcTo(c, w, h - br, w - br, h, w, h);
|
|
1887
|
+
c.push({ op: "L", x: bl, y: h });
|
|
1888
|
+
if (bl) arcTo(c, bl, h, 0, h - bl, 0, h);
|
|
1889
|
+
c.push({ op: "L", x: 0, y: tl });
|
|
1890
|
+
if (tl) arcTo(c, 0, tl, tl, 0, 0, 0);
|
|
1891
|
+
c.push({ op: "Z" });
|
|
1892
|
+
return c;
|
|
1893
|
+
}
|
|
1894
|
+
function ellipseCmds(w, h) {
|
|
1895
|
+
const rx = w / 2, ry = h / 2, cx = rx, cy = ry;
|
|
1896
|
+
return [
|
|
1897
|
+
{ op: "M", x: cx + rx, y: cy },
|
|
1898
|
+
{ op: "C", x1: cx + rx, y1: cy + ry * K, x2: cx + rx * K, y2: cy + ry, x: cx, y: cy + ry },
|
|
1899
|
+
{ op: "C", x1: cx - rx * K, y1: cy + ry, x2: cx - rx, y2: cy + ry * K, x: cx - rx, y: cy },
|
|
1900
|
+
{ op: "C", x1: cx - rx, y1: cy - ry * K, x2: cx - rx * K, y2: cy - ry, x: cx, y: cy - ry },
|
|
1901
|
+
{ op: "C", x1: cx + rx * K, y1: cy - ry, x2: cx + rx, y2: cy - ry * K, x: cx + rx, y: cy },
|
|
1902
|
+
{ op: "Z" }
|
|
1903
|
+
];
|
|
1904
|
+
}
|
|
1905
|
+
function cornerCmds(pts) {
|
|
1906
|
+
return [...pts.map(([x, y], i) => ({ op: i ? "L" : "M", x, y })), { op: "Z" }];
|
|
1907
|
+
}
|
|
1908
|
+
function polygonCmds(node) {
|
|
1909
|
+
return cornerCmds(fitCornersToBox(polygonCorners(node.pointCount || 3), node.width, node.height));
|
|
1910
|
+
}
|
|
1911
|
+
function starCmds(node) {
|
|
1912
|
+
const n = node;
|
|
1913
|
+
return cornerCmds(fitCornersToBox(starCorners(n.pointCount || 5, n.innerRadius ?? 0.4), node.width, node.height));
|
|
1914
|
+
}
|
|
1915
|
+
function vectorCmds(node) {
|
|
1916
|
+
const paths = node.paths || [];
|
|
1917
|
+
const out = [];
|
|
1918
|
+
const segment = (prev, curr) => {
|
|
1919
|
+
if (prev.handleOut && curr.handleIn) return { op: "C", x1: prev.handleOut.x, y1: prev.handleOut.y, x2: curr.handleIn.x, y2: curr.handleIn.y, x: curr.x, y: curr.y };
|
|
1920
|
+
if (prev.handleOut) return { op: "Q", x1: prev.handleOut.x, y1: prev.handleOut.y, x: curr.x, y: curr.y };
|
|
1921
|
+
if (curr.handleIn) return { op: "Q", x1: curr.handleIn.x, y1: curr.handleIn.y, x: curr.x, y: curr.y };
|
|
1922
|
+
return { op: "L", x: curr.x, y: curr.y };
|
|
1923
|
+
};
|
|
1924
|
+
for (const path of paths) {
|
|
1925
|
+
const pts = path.points;
|
|
1926
|
+
if (!pts?.length) continue;
|
|
1927
|
+
out.push({ op: "M", x: pts[0].x, y: pts[0].y });
|
|
1928
|
+
for (let i = 1; i < pts.length; i++) out.push(segment(pts[i - 1], pts[i]));
|
|
1929
|
+
if (path.closed && pts.length > 1) out.push(segment(pts[pts.length - 1], pts[0]));
|
|
1930
|
+
if (path.closed) out.push({ op: "Z" });
|
|
1931
|
+
}
|
|
1932
|
+
return out;
|
|
1933
|
+
}
|
|
1934
|
+
function multiPolyCmds(mp) {
|
|
1935
|
+
const out = [];
|
|
1936
|
+
for (const poly of mp) for (const ring of poly) {
|
|
1937
|
+
if (!ring.length) continue;
|
|
1938
|
+
ring.forEach((p, i) => out.push({ op: i ? "L" : "M", x: p[0], y: p[1] }));
|
|
1939
|
+
out.push({ op: "Z" });
|
|
1940
|
+
}
|
|
1941
|
+
return out;
|
|
1942
|
+
}
|
|
1943
|
+
function ringsCmds(rings) {
|
|
1944
|
+
const out = [];
|
|
1945
|
+
for (const ring of rings) {
|
|
1946
|
+
if (ring.length < 3) continue;
|
|
1947
|
+
ring.forEach((p, i) => out.push({ op: i ? "L" : "M", x: p[0], y: p[1] }));
|
|
1948
|
+
out.push({ op: "Z" });
|
|
1949
|
+
}
|
|
1950
|
+
return out;
|
|
1951
|
+
}
|
|
1952
|
+
function glyphCmds(instances) {
|
|
1953
|
+
const out = [];
|
|
1954
|
+
for (const g of instances) {
|
|
1955
|
+
const o = glyphOutline(g);
|
|
1956
|
+
if (!o) continue;
|
|
1957
|
+
let open = false;
|
|
1958
|
+
for (const c of o.commands) {
|
|
1959
|
+
const a = c.args;
|
|
1960
|
+
switch (c.command) {
|
|
1961
|
+
case "moveTo": {
|
|
1962
|
+
if (open) out.push({ op: "Z" });
|
|
1963
|
+
const [x, y] = o.place(a[0], a[1]);
|
|
1964
|
+
out.push({ op: "M", x, y });
|
|
1965
|
+
open = true;
|
|
1966
|
+
break;
|
|
1967
|
+
}
|
|
1968
|
+
case "lineTo": {
|
|
1969
|
+
const [x, y] = o.place(a[0], a[1]);
|
|
1970
|
+
out.push({ op: "L", x, y });
|
|
1971
|
+
break;
|
|
1972
|
+
}
|
|
1973
|
+
case "quadraticCurveTo": {
|
|
1974
|
+
const [x1, y1] = o.place(a[0], a[1]), [x, y] = o.place(a[2], a[3]);
|
|
1975
|
+
out.push({ op: "Q", x1, y1, x, y });
|
|
1976
|
+
break;
|
|
1977
|
+
}
|
|
1978
|
+
case "bezierCurveTo": {
|
|
1979
|
+
const [x1, y1] = o.place(a[0], a[1]), [x2, y2] = o.place(a[2], a[3]), [x, y] = o.place(a[4], a[5]);
|
|
1980
|
+
out.push({ op: "C", x1, y1, x2, y2, x, y });
|
|
1981
|
+
break;
|
|
1982
|
+
}
|
|
1983
|
+
case "closePath":
|
|
1984
|
+
if (open) {
|
|
1985
|
+
out.push({ op: "Z" });
|
|
1986
|
+
open = false;
|
|
1987
|
+
}
|
|
1988
|
+
break;
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
if (open) out.push({ op: "Z" });
|
|
1992
|
+
}
|
|
1993
|
+
return out;
|
|
1994
|
+
}
|
|
1995
|
+
function shapeCmds(node, nodes) {
|
|
1996
|
+
switch (node.type) {
|
|
1997
|
+
case "RECTANGLE":
|
|
1998
|
+
case "FRAME":
|
|
1999
|
+
case "COMPONENT":
|
|
2000
|
+
case "COMPONENT_SET":
|
|
2001
|
+
case "INSTANCE":
|
|
2002
|
+
case "IMAGE":
|
|
2003
|
+
return roundedRectCmds(node.width, node.height, cornerRadii(node));
|
|
2004
|
+
case "SECTION":
|
|
2005
|
+
return roundedRectCmds(node.width, node.height, [0, 0, 0, 0]);
|
|
2006
|
+
case "ELLIPSE":
|
|
2007
|
+
return ellipseCmds(node.width, node.height);
|
|
2008
|
+
case "POLYGON":
|
|
2009
|
+
return polygonCmds(node);
|
|
2010
|
+
case "STAR":
|
|
2011
|
+
return starCmds(node);
|
|
2012
|
+
case "VECTOR":
|
|
2013
|
+
return vectorCmds(node);
|
|
2014
|
+
case "BOOLEAN":
|
|
2015
|
+
return multiPolyCmds(computeBooleanMultiPoly(node, nodes));
|
|
2016
|
+
default:
|
|
2017
|
+
return null;
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
function cmdsToPolylines(cmds, steps = 24) {
|
|
2021
|
+
const out = [];
|
|
2022
|
+
let cur = null;
|
|
2023
|
+
let x = 0, y = 0, sx = 0, sy = 0;
|
|
2024
|
+
for (const c of cmds) {
|
|
2025
|
+
if (c.op === "M") {
|
|
2026
|
+
if (cur && cur.length > 2) out.push(cur);
|
|
2027
|
+
cur = [c.x, c.y];
|
|
2028
|
+
x = sx = c.x;
|
|
2029
|
+
y = sy = c.y;
|
|
2030
|
+
continue;
|
|
2031
|
+
}
|
|
2032
|
+
if (c.op === "Z") {
|
|
2033
|
+
if (cur) {
|
|
2034
|
+
if (x !== sx || y !== sy) cur.push(sx, sy);
|
|
2035
|
+
out.push(cur);
|
|
2036
|
+
}
|
|
2037
|
+
cur = null;
|
|
2038
|
+
x = sx;
|
|
2039
|
+
y = sy;
|
|
2040
|
+
continue;
|
|
2041
|
+
}
|
|
2042
|
+
cur ??= [x, y];
|
|
2043
|
+
if (c.op === "L") cur.push(c.x, c.y);
|
|
2044
|
+
else for (let i = 1; i <= steps; i++) {
|
|
2045
|
+
const t = i / steps, u = 1 - t;
|
|
2046
|
+
if (c.op === "Q") cur.push(u * u * x + 2 * u * t * c.x1 + t * t * c.x, u * u * y + 2 * u * t * c.y1 + t * t * c.y);
|
|
2047
|
+
else cur.push(u * u * u * x + 3 * u * u * t * c.x1 + 3 * u * t * t * c.x2 + t * t * t * c.x, u * u * u * y + 3 * u * u * t * c.y1 + 3 * u * t * t * c.y2 + t * t * t * c.y);
|
|
2048
|
+
}
|
|
2049
|
+
x = c.x;
|
|
2050
|
+
y = c.y;
|
|
2051
|
+
}
|
|
2052
|
+
if (cur && cur.length > 2) out.push(cur);
|
|
2053
|
+
return out;
|
|
2054
|
+
}
|
|
2055
|
+
function trimCmds(cmds, trim) {
|
|
2056
|
+
if (isFullTrim(trim)) return cmds;
|
|
2057
|
+
const out = [];
|
|
2058
|
+
for (const p of trimPolylines(cmdsToPolylines(cmds), trim)) {
|
|
2059
|
+
for (let i = 0; i < p.length; i += 2) out.push({ op: i ? "L" : "M", x: p[i], y: p[i + 1] });
|
|
2060
|
+
}
|
|
2061
|
+
return out;
|
|
2062
|
+
}
|
|
2063
|
+
function toSvgD(cmds) {
|
|
2064
|
+
let d = "";
|
|
2065
|
+
for (const c of cmds) {
|
|
2066
|
+
switch (c.op) {
|
|
2067
|
+
case "M":
|
|
2068
|
+
d += `M${fmt(c.x)} ${fmt(c.y)}`;
|
|
2069
|
+
break;
|
|
2070
|
+
case "L":
|
|
2071
|
+
d += `L${fmt(c.x)} ${fmt(c.y)}`;
|
|
2072
|
+
break;
|
|
2073
|
+
case "Q":
|
|
2074
|
+
d += `Q${fmt(c.x1)} ${fmt(c.y1)} ${fmt(c.x)} ${fmt(c.y)}`;
|
|
2075
|
+
break;
|
|
2076
|
+
case "C":
|
|
2077
|
+
d += `C${fmt(c.x1)} ${fmt(c.y1)} ${fmt(c.x2)} ${fmt(c.y2)} ${fmt(c.x)} ${fmt(c.y)}`;
|
|
2078
|
+
break;
|
|
2079
|
+
case "Z":
|
|
2080
|
+
d += "Z";
|
|
2081
|
+
break;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
return d;
|
|
2085
|
+
}
|
|
2086
|
+
|
|
1848
2087
|
export {
|
|
1849
2088
|
require_polygon_clipping_cjs,
|
|
1850
2089
|
nonzeroMultiPoly,
|
|
1851
|
-
computeBooleanMultiPoly
|
|
2090
|
+
computeBooleanMultiPoly,
|
|
2091
|
+
fmt,
|
|
2092
|
+
cornerRadii,
|
|
2093
|
+
fittedRadii,
|
|
2094
|
+
roundedRectCmds,
|
|
2095
|
+
vectorCmds,
|
|
2096
|
+
ringsCmds,
|
|
2097
|
+
glyphCmds,
|
|
2098
|
+
shapeCmds,
|
|
2099
|
+
trimCmds,
|
|
2100
|
+
toSvgD
|
|
1852
2101
|
};
|
|
@@ -7,10 +7,10 @@ const __dirname = __popcraftDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
builtinCommands,
|
|
9
9
|
registerBuiltinCommands
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-7HICNIH2.js";
|
|
11
11
|
import {
|
|
12
12
|
toolView
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-735IMMB6.js";
|
|
14
14
|
import {
|
|
15
15
|
init_define_POPCRAFT_COMPONENT_IDS
|
|
16
16
|
} from "./chunk-63KP74KB.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-L4V3QA4A.js"),
|
|
95
95
|
import("../lib/document/photo-frames.js"),
|
|
96
|
-
import("./media-tool-
|
|
96
|
+
import("./media-tool-3IFICUR3.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);
|