@popcraft/cli 0.48.3 → 0.49.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/popcraft.mjs +713 -385
- package/package.json +2 -2
package/dist/popcraft.mjs
CHANGED
|
@@ -1196,7 +1196,7 @@ function operations(spec = openapi) {
|
|
|
1196
1196
|
}
|
|
1197
1197
|
async function call(target2, method, path, opts = {}) {
|
|
1198
1198
|
const qs = new URLSearchParams(opts.query ?? {}).toString();
|
|
1199
|
-
const headers = { "user-agent": `popcraft-cli/${"0.
|
|
1199
|
+
const headers = { "user-agent": `popcraft-cli/${"0.49.0"}`, ...opts.headers };
|
|
1200
1200
|
if (target2.token) headers.authorization = `Bearer ${target2.token}`;
|
|
1201
1201
|
if (opts.contentType) headers["content-type"] = opts.contentType;
|
|
1202
1202
|
try {
|
|
@@ -3994,14 +3994,14 @@ function describeTextTarget(doc2, n) {
|
|
|
3994
3994
|
names.unshift(p2.name);
|
|
3995
3995
|
p2 = p2.parentId ? doc2.nodes[p2.parentId] : void 0;
|
|
3996
3996
|
}
|
|
3997
|
-
const
|
|
3998
|
-
const charsPerLine = n.textAutoResize === "WIDTH_AND_HEIGHT" ? Math.max(
|
|
3999
|
-
const lines2 = n.textAutoResize === "NONE" ? Math.max(1, Math.floor(n.height / Math.max(1, n.fontSize * 1.2))) : Math.max(1,
|
|
3997
|
+
const current5 = str2(n.characters ?? "", 400);
|
|
3998
|
+
const charsPerLine = n.textAutoResize === "WIDTH_AND_HEIGHT" ? Math.max(current5.length, 8) : Math.max(4, Math.floor(n.width / Math.max(1, n.fontSize * 0.52)));
|
|
3999
|
+
const lines2 = n.textAutoResize === "NONE" ? Math.max(1, Math.floor(n.height / Math.max(1, n.fontSize * 1.2))) : Math.max(1, current5.split("\n").length, Math.round(n.height / Math.max(1, n.fontSize * 1.2)));
|
|
4000
4000
|
return {
|
|
4001
4001
|
id: n.id,
|
|
4002
4002
|
name: str2(n.name, AI_LIMITS.maxNameChars),
|
|
4003
4003
|
role: inferTextRole(n, names),
|
|
4004
|
-
current:
|
|
4004
|
+
current: current5,
|
|
4005
4005
|
maxChars: Math.max(4, Math.min(AI_LIMITS.maxTextChars, charsPerLine * lines2)),
|
|
4006
4006
|
path: str2(names.join(" / "), 200)
|
|
4007
4007
|
};
|
|
@@ -5200,8 +5200,8 @@ var init_properties = __esm({
|
|
|
5200
5200
|
T = "Transform";
|
|
5201
5201
|
A = "Appearance";
|
|
5202
5202
|
inFlow = (n, parent) => {
|
|
5203
|
-
const
|
|
5204
|
-
return !!
|
|
5203
|
+
const mode2 = parent ? fieldOf(parent, "layoutMode") : void 0;
|
|
5204
|
+
return !!mode2 && mode2 !== "NONE" && fieldOf(n, "layoutPositioning") !== "ABSOLUTE";
|
|
5205
5205
|
};
|
|
5206
5206
|
num5 = (v) => typeof v === "number" && Number.isFinite(v) ? v : void 0;
|
|
5207
5207
|
effectType = (...types) => {
|
|
@@ -5807,8 +5807,8 @@ function packedToHex(v) {
|
|
|
5807
5807
|
const [r, g, b, a] = unpackRGBA(v);
|
|
5808
5808
|
return `#${[r, g, b, a].map((x2) => x2.toString(16).padStart(2, "0")).join("")}`;
|
|
5809
5809
|
}
|
|
5810
|
-
function celsToRGBA(cells,
|
|
5811
|
-
if (
|
|
5810
|
+
function celsToRGBA(cells, mode2, palette2, transparentIndex) {
|
|
5811
|
+
if (mode2 !== "INDEXED") return cells;
|
|
5812
5812
|
const lut = palette2.map(hexToPacked);
|
|
5813
5813
|
const out = new Uint32Array(cells.length);
|
|
5814
5814
|
for (let i2 = 0; i2 < cells.length; i2++) {
|
|
@@ -6500,21 +6500,21 @@ function glyphInstancesToRings(instances) {
|
|
|
6500
6500
|
}
|
|
6501
6501
|
const commands2 = glyph2?.path?.commands;
|
|
6502
6502
|
if (!commands2?.length) continue;
|
|
6503
|
-
let
|
|
6503
|
+
let current5 = [];
|
|
6504
6504
|
const push2 = () => {
|
|
6505
|
-
if (
|
|
6506
|
-
|
|
6505
|
+
if (current5.length >= 3) rings.push(closeRing(current5));
|
|
6506
|
+
current5 = [];
|
|
6507
6507
|
};
|
|
6508
6508
|
const t3 = glyphTransform(g);
|
|
6509
6509
|
const turn = glyphTurn(g);
|
|
6510
6510
|
flattenPath(commands2, t3, (x0, y0, x1, y1) => {
|
|
6511
6511
|
const [ax, ay] = turn(x0, y0), [bx, by] = turn(x1, y1);
|
|
6512
|
-
const last3 =
|
|
6512
|
+
const last3 = current5[current5.length - 1];
|
|
6513
6513
|
if (!last3 || last3[0] !== ax || last3[1] !== ay) {
|
|
6514
6514
|
push2();
|
|
6515
|
-
|
|
6515
|
+
current5.push([ax, ay]);
|
|
6516
6516
|
}
|
|
6517
|
-
|
|
6517
|
+
current5.push([bx, by]);
|
|
6518
6518
|
});
|
|
6519
6519
|
push2();
|
|
6520
6520
|
}
|
|
@@ -6974,8 +6974,8 @@ function addHeaderFooterToMaster(doc2, masterId, kind) {
|
|
|
6974
6974
|
return { doc: updated, textId: text.id };
|
|
6975
6975
|
}
|
|
6976
6976
|
function reorderPrintPages(doc2, pageId2, orderedIds) {
|
|
6977
|
-
const
|
|
6978
|
-
const rest =
|
|
6977
|
+
const current5 = listPrintPages(doc2, pageId2);
|
|
6978
|
+
const rest = current5.map((f2) => f2.id).filter((id3) => !orderedIds.includes(id3));
|
|
6979
6979
|
const patches = {};
|
|
6980
6980
|
[...orderedIds, ...rest].forEach((id3, index2) => {
|
|
6981
6981
|
const f2 = doc2.nodes[id3];
|
|
@@ -7779,12 +7779,12 @@ function getAncestors(document2, nodeId2) {
|
|
|
7779
7779
|
const ancestors = [];
|
|
7780
7780
|
const node2 = document2.nodes[nodeId2];
|
|
7781
7781
|
if (!node2) return ancestors;
|
|
7782
|
-
let
|
|
7783
|
-
while (
|
|
7784
|
-
const parent = document2.nodes[
|
|
7782
|
+
let current5 = node2;
|
|
7783
|
+
while (current5.parentId) {
|
|
7784
|
+
const parent = document2.nodes[current5.parentId];
|
|
7785
7785
|
if (parent) {
|
|
7786
7786
|
ancestors.push(parent);
|
|
7787
|
-
|
|
7787
|
+
current5 = parent;
|
|
7788
7788
|
} else {
|
|
7789
7789
|
break;
|
|
7790
7790
|
}
|
|
@@ -8578,15 +8578,15 @@ function resolveStepRefs(params2, results) {
|
|
|
8578
8578
|
return fill(params2);
|
|
8579
8579
|
}
|
|
8580
8580
|
function documentContext(doc2, opts) {
|
|
8581
|
-
let
|
|
8581
|
+
let current5 = doc2;
|
|
8582
8582
|
let pageId2 = opts.pageId && doc2.pages.includes(opts.pageId) ? opts.pageId : doc2.pages[0];
|
|
8583
8583
|
let selection = (opts.selection ?? []).filter((id3) => id3 in doc2.nodes);
|
|
8584
8584
|
const notices = [];
|
|
8585
8585
|
const caps = opts.capabilities ?? [];
|
|
8586
8586
|
const ctx2 = {
|
|
8587
|
-
doc: () =>
|
|
8587
|
+
doc: () => current5,
|
|
8588
8588
|
commit: (next2) => {
|
|
8589
|
-
|
|
8589
|
+
current5 = next2;
|
|
8590
8590
|
},
|
|
8591
8591
|
pageId: () => pageId2,
|
|
8592
8592
|
selection: () => [...selection],
|
|
@@ -8610,18 +8610,18 @@ function documentContext(doc2, opts) {
|
|
|
8610
8610
|
},
|
|
8611
8611
|
create: (name2) => {
|
|
8612
8612
|
const page = createPage(name2);
|
|
8613
|
-
|
|
8613
|
+
current5 = { ...current5, pages: [...current5.pages, page.id], nodes: { ...current5.nodes, [page.id]: page } };
|
|
8614
8614
|
pageId2 = page.id;
|
|
8615
8615
|
selection = [];
|
|
8616
8616
|
return page.id;
|
|
8617
8617
|
},
|
|
8618
8618
|
rename: (id3, name2) => {
|
|
8619
|
-
|
|
8619
|
+
current5 = updateNode(current5, id3, { name: name2 });
|
|
8620
8620
|
}
|
|
8621
8621
|
},
|
|
8622
8622
|
readOnlyReason: () => null
|
|
8623
8623
|
};
|
|
8624
|
-
return { ctx: ctx2, document: () =>
|
|
8624
|
+
return { ctx: ctx2, document: () => current5, pageId: () => pageId2, selection: () => [...selection], notices };
|
|
8625
8625
|
}
|
|
8626
8626
|
var BROWSER_NEEDS, SIGNIN_DOMAINS, APP_ONLY, UNAVAILABLE, STORE_BOUND, STEP_REF;
|
|
8627
8627
|
var init_headless = __esm({
|
|
@@ -8645,6 +8645,7 @@ var init_headless = __esm({
|
|
|
8645
8645
|
"view.zoom",
|
|
8646
8646
|
"view.zoomTo",
|
|
8647
8647
|
"view.stage",
|
|
8648
|
+
"view.screenLayout",
|
|
8648
8649
|
"view.present",
|
|
8649
8650
|
"view.copyLink",
|
|
8650
8651
|
"canvas.toggle",
|
|
@@ -32785,6 +32786,8 @@ var init_en2 = __esm({
|
|
|
32785
32786
|
"command:page.create": "New page",
|
|
32786
32787
|
"command:page.setCurrent": "Next page",
|
|
32787
32788
|
"command:paint.replaceColor": "Replace color",
|
|
32789
|
+
"command:paint.setFills": "Set fills",
|
|
32790
|
+
"command:paint.setStrokes": "Set strokes",
|
|
32788
32791
|
"command:presentation.configureAudio": "Presentation audio settings",
|
|
32789
32792
|
"command:presentation.fallbackAudio": "Use offline fallback audio",
|
|
32790
32793
|
"command:presentation.generateAudio": "Generate presentation audio",
|
|
@@ -32827,6 +32830,7 @@ var init_en2 = __esm({
|
|
|
32827
32830
|
"command:text.setPath#circle": "Text on a circle",
|
|
32828
32831
|
"command:text.setPath#path": "Attach text to path",
|
|
32829
32832
|
"command:text.setPath#wave": "Wave text",
|
|
32833
|
+
"command:text.setTypography": "Set typography",
|
|
32830
32834
|
"command:vector.boolean": "Boolean",
|
|
32831
32835
|
"command:vector.boolean#exclude": "Exclude",
|
|
32832
32836
|
"command:vector.boolean#intersect": "Intersect",
|
|
@@ -32849,6 +32853,7 @@ var init_en2 = __esm({
|
|
|
32849
32853
|
"command:view.present#fullscreen": "Present (fullscreen)",
|
|
32850
32854
|
"command:view.present#presenter": "Presenter view",
|
|
32851
32855
|
"command:view.present#window": "Present in a window for screen share\u2026",
|
|
32856
|
+
"command:view.screenLayout": "Flip canvas and panels",
|
|
32852
32857
|
"command:view.select": "Deselect all",
|
|
32853
32858
|
"command:view.stage": "Stage view",
|
|
32854
32859
|
"command:view.zoom": "Zoom",
|
|
@@ -33519,6 +33524,12 @@ var init_en2 = __esm({
|
|
|
33519
33524
|
"drawSettingsPanel.wetMix": "Wet mix",
|
|
33520
33525
|
"drawSettingsPanel.wetPaint": "Wet paint",
|
|
33521
33526
|
"drawSettingsPanel.whatTheTipRotatesWith": "What the tip rotates with",
|
|
33527
|
+
"duoHarness.closed": "Closed",
|
|
33528
|
+
"duoHarness.frameTitle": "PopCraft on an iPhone Duo",
|
|
33529
|
+
"duoHarness.halfOpen": "Half open",
|
|
33530
|
+
"duoHarness.open": "Open",
|
|
33531
|
+
"duoHarness.posture": "Fold posture",
|
|
33532
|
+
"duoHarness.rotate": "Rotate",
|
|
33522
33533
|
"editorStore.leftNothingThoseShapesProduce": "{toLowerCase} left nothing \u2014 those shapes produce an empty result.",
|
|
33523
33534
|
"editorStore.readOnlyPickAMode": "This file is read only. Pick Design, or another mode, to edit it.",
|
|
33524
33535
|
"editorStore.savingToBrowserStorageFailed": "Saving to browser storage failed \u2014 recent changes may not be saved.",
|
|
@@ -34805,6 +34816,10 @@ var init_en2 = __esm({
|
|
|
34805
34816
|
"panelRail.dragToTheOtherSide": "{title} \u2014 drag to the other side (or Alt+Shift+Arrow) to move it",
|
|
34806
34817
|
"panelRail.leftPanel": "Left panel",
|
|
34807
34818
|
"panelRail.rightPanel": "Right panel",
|
|
34819
|
+
"panelTab.agent": "Agent",
|
|
34820
|
+
"panelTab.comments": "Comments",
|
|
34821
|
+
"panelTab.inspect": "Inspect",
|
|
34822
|
+
"panelTab.layers": "Layers",
|
|
34808
34823
|
"pdfExportDialog.aTSFriendlyR\xE9sum\xE9sRealText": "ATS-friendly (r\xE9sum\xE9s): real text in reading order",
|
|
34809
34824
|
"pdfExportDialog.cancel": "Cancel",
|
|
34810
34825
|
"pdfExportDialog.cMYKUncalibrated": "CMYK (uncalibrated)",
|
|
@@ -34836,6 +34851,34 @@ var init_en2 = __esm({
|
|
|
34836
34851
|
"pendingInstallNotice.dismiss": "Dismiss",
|
|
34837
34852
|
"pendingInstallNotice.signIn": "Sign in",
|
|
34838
34853
|
"pendingInstallNotice.tryItInANew": "Try it in a new file",
|
|
34854
|
+
"phoneShell.allFiles": "All files",
|
|
34855
|
+
"phoneShell.backToMore": "Back to More",
|
|
34856
|
+
"phoneShell.canvas": "Canvas",
|
|
34857
|
+
"phoneShell.commands": "Commands",
|
|
34858
|
+
"phoneShell.design": "Design",
|
|
34859
|
+
"phoneShell.editorMode": "Editor mode",
|
|
34860
|
+
"phoneShell.editSelection": "Edit {name}",
|
|
34861
|
+
"phoneShell.flipCanvas": "Flip canvas and panels",
|
|
34862
|
+
"phoneShell.layers": "Layers",
|
|
34863
|
+
"phoneShell.layout": "Screen layout",
|
|
34864
|
+
"phoneShell.layoutAuto": "Automatic (fits the screen)",
|
|
34865
|
+
"phoneShell.layoutDesktop": "Desktop",
|
|
34866
|
+
"phoneShell.layoutPanes": "Two panes",
|
|
34867
|
+
"phoneShell.layoutPhone": "Phone",
|
|
34868
|
+
"phoneShell.modes": "Modes",
|
|
34869
|
+
"phoneShell.more": "More",
|
|
34870
|
+
"phoneShell.panels": "Panels",
|
|
34871
|
+
"phoneShell.pinToDock": "Pin {name} to the dock",
|
|
34872
|
+
"phoneShell.properties": "Properties",
|
|
34873
|
+
"phoneShell.recent": "Recent",
|
|
34874
|
+
"phoneShell.resizePanels": "Resize the two panels",
|
|
34875
|
+
"phoneShell.resizePanes": "Resize canvas and panels",
|
|
34876
|
+
"phoneShell.searchCommands": "Search commands",
|
|
34877
|
+
"phoneShell.selectedCount": "{count, plural, one {# layer} other {# layers}}",
|
|
34878
|
+
"phoneShell.settings": "Settings",
|
|
34879
|
+
"phoneShell.textSize": "Size",
|
|
34880
|
+
"phoneShell.unpinFromDock": "Unpin {name} from the dock",
|
|
34881
|
+
"phoneShell.untitled": "Untitled",
|
|
34839
34882
|
"photoBrowser.anyCreativeCommonsLicence": "Any Creative Commons licence",
|
|
34840
34883
|
"photoBrowser.freeToUseAndEdit": "Free to use and edit commercially",
|
|
34841
34884
|
"photoBrowser.licences": "Licences",
|
|
@@ -35859,6 +35902,7 @@ var init_en2 = __esm({
|
|
|
35859
35902
|
"shareImage.upload": "Upload",
|
|
35860
35903
|
"shareImage.uploadHint": "A PNG or JPEG under 1 MB. 1200\xD7630 fits link previews best.",
|
|
35861
35904
|
"shareImage.whichFrame": "Frame to share",
|
|
35905
|
+
"sheet.close": "Close",
|
|
35862
35906
|
"showAdvanceControl.advance": "Advance",
|
|
35863
35907
|
"showAdvanceControl.afterADelay": "After a delay",
|
|
35864
35908
|
"showAdvanceControl.loopTheShow": "Loop the show",
|
|
@@ -94264,20 +94308,20 @@ function accentText(s) {
|
|
|
94264
94308
|
function bidiText(s) {
|
|
94265
94309
|
return s.trim() ? `${RLO}${s}${PDF}` : s;
|
|
94266
94310
|
}
|
|
94267
|
-
function walk2(els,
|
|
94311
|
+
function walk2(els, mode2) {
|
|
94268
94312
|
return els.map((el) => {
|
|
94269
|
-
if (el.type === TYPE.literal) return { ...el, value:
|
|
94313
|
+
if (el.type === TYPE.literal) return { ...el, value: mode2 === "accented" ? accentText(el.value) : bidiText(el.value) };
|
|
94270
94314
|
if (el.type === TYPE.plural || el.type === TYPE.select) {
|
|
94271
|
-
const options = Object.fromEntries(Object.entries(el.options).map(([k2, o]) => [k2, { ...o, value: walk2(o.value,
|
|
94315
|
+
const options = Object.fromEntries(Object.entries(el.options).map(([k2, o]) => [k2, { ...o, value: walk2(o.value, mode2) }]));
|
|
94272
94316
|
return { ...el, options };
|
|
94273
94317
|
}
|
|
94274
|
-
if (el.type === TYPE.tag) return { ...el, children: walk2(el.children,
|
|
94318
|
+
if (el.type === TYPE.tag) return { ...el, children: walk2(el.children, mode2) };
|
|
94275
94319
|
return el;
|
|
94276
94320
|
});
|
|
94277
94321
|
}
|
|
94278
|
-
function pseudoAst(ast,
|
|
94279
|
-
const body = walk2(ast,
|
|
94280
|
-
if (
|
|
94322
|
+
function pseudoAst(ast, mode2) {
|
|
94323
|
+
const body = walk2(ast, mode2);
|
|
94324
|
+
if (mode2 !== "accented") return body;
|
|
94281
94325
|
return [{ type: TYPE.literal, value: PSEUDO_OPEN }, ...body, { type: TYPE.literal, value: PSEUDO_CLOSE }];
|
|
94282
94326
|
}
|
|
94283
94327
|
var ACCENTS, VOWELS, PSEUDO_OPEN, PSEUDO_CLOSE, RLO, PDF;
|
|
@@ -94920,9 +94964,9 @@ var require_react_production = __commonJS({
|
|
|
94920
94964
|
exports.useState = function(initialState) {
|
|
94921
94965
|
return ReactSharedInternals.H.useState(initialState);
|
|
94922
94966
|
};
|
|
94923
|
-
exports.useSyncExternalStore = function(
|
|
94967
|
+
exports.useSyncExternalStore = function(subscribe2, getSnapshot, getServerSnapshot) {
|
|
94924
94968
|
return ReactSharedInternals.H.useSyncExternalStore(
|
|
94925
|
-
|
|
94969
|
+
subscribe2,
|
|
94926
94970
|
getSnapshot,
|
|
94927
94971
|
getServerSnapshot
|
|
94928
94972
|
);
|
|
@@ -95802,8 +95846,8 @@ var init_shader_graph = __esm({
|
|
|
95802
95846
|
inputs: [col2("base", BLACK2), col2("layer", WHITE2), f322("amount", 1, [0, 2])],
|
|
95803
95847
|
options: [{ name: "mode", values: ["add", "screen", "multiply", "over", "max"], default: "add" }],
|
|
95804
95848
|
emit: (c2) => {
|
|
95805
|
-
const
|
|
95806
|
-
const mixed =
|
|
95849
|
+
const mode2 = c2.opt("mode");
|
|
95850
|
+
const mixed = mode2 === "screen" ? "vec3<f32>(1.0) - (vec3<f32>(1.0) - a.rgb) * (vec3<f32>(1.0) - b.rgb)" : mode2 === "multiply" ? "a.rgb * b.rgb" : mode2 === "over" ? "mix(a.rgb, b.rgb, b.a)" : mode2 === "max" ? "max(a.rgb, b.rgb)" : "a.rgb + b.rgb";
|
|
95807
95851
|
return `let a = ${c2.in("base")};
|
|
95808
95852
|
let b = ${c2.in("layer")};
|
|
95809
95853
|
let k = ${c2.in("amount")};
|
|
@@ -96328,11 +96372,29 @@ function holdsIndexedDB(close) {
|
|
|
96328
96372
|
closers.delete(close);
|
|
96329
96373
|
};
|
|
96330
96374
|
}
|
|
96331
|
-
|
|
96375
|
+
function closeAllIndexedDB() {
|
|
96376
|
+
for (const close of [...closers]) {
|
|
96377
|
+
try {
|
|
96378
|
+
close();
|
|
96379
|
+
} catch {
|
|
96380
|
+
}
|
|
96381
|
+
}
|
|
96382
|
+
}
|
|
96383
|
+
var closers, CHANNEL, channel;
|
|
96332
96384
|
var init_open_connections = __esm({
|
|
96333
96385
|
"lib/storage/open-connections.ts"() {
|
|
96334
96386
|
"use strict";
|
|
96335
96387
|
closers = /* @__PURE__ */ new Set();
|
|
96388
|
+
CHANNEL = "popcraft-close-indexeddb";
|
|
96389
|
+
channel = null;
|
|
96390
|
+
if (typeof BroadcastChannel !== "undefined") {
|
|
96391
|
+
try {
|
|
96392
|
+
channel = new BroadcastChannel(CHANNEL);
|
|
96393
|
+
channel.onmessage = () => closeAllIndexedDB();
|
|
96394
|
+
channel.unref?.();
|
|
96395
|
+
} catch {
|
|
96396
|
+
}
|
|
96397
|
+
}
|
|
96336
96398
|
}
|
|
96337
96399
|
});
|
|
96338
96400
|
|
|
@@ -96837,22 +96899,22 @@ var init_vanilla = __esm({
|
|
|
96837
96899
|
"node_modules/.pnpm/zustand@5.0.15_@types+react@19.3.0_immer@11.1.21_react@19.3.0_use-sync-external-store@1.6.0_react@19.3.0_/node_modules/zustand/esm/vanilla.mjs"() {
|
|
96838
96900
|
createStoreImpl = (createState) => {
|
|
96839
96901
|
let state;
|
|
96840
|
-
const
|
|
96902
|
+
const listeners9 = /* @__PURE__ */ new Set();
|
|
96841
96903
|
const setState = (partial2, replace) => {
|
|
96842
96904
|
const nextState = typeof partial2 === "function" ? partial2(state) : partial2;
|
|
96843
96905
|
if (!Object.is(nextState, state)) {
|
|
96844
96906
|
const previousState = state;
|
|
96845
96907
|
state = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state, nextState);
|
|
96846
|
-
|
|
96908
|
+
listeners9.forEach((listener) => listener(state, previousState));
|
|
96847
96909
|
}
|
|
96848
96910
|
};
|
|
96849
96911
|
const getState2 = () => state;
|
|
96850
96912
|
const getInitialState = () => initialState;
|
|
96851
|
-
const
|
|
96852
|
-
|
|
96853
|
-
return () =>
|
|
96913
|
+
const subscribe2 = (listener) => {
|
|
96914
|
+
listeners9.add(listener);
|
|
96915
|
+
return () => listeners9.delete(listener);
|
|
96854
96916
|
};
|
|
96855
|
-
const api3 = { setState, getState: getState2, getInitialState, subscribe };
|
|
96917
|
+
const api3 = { setState, getState: getState2, getInitialState, subscribe: subscribe2 };
|
|
96856
96918
|
const initialState = state = createState(setState, getState2, api3);
|
|
96857
96919
|
return api3;
|
|
96858
96920
|
};
|
|
@@ -99888,13 +99950,13 @@ function compositionAt(comp, t3) {
|
|
|
99888
99950
|
else return EMPTY_MOMENT;
|
|
99889
99951
|
}
|
|
99890
99952
|
const clip = clips2[index2];
|
|
99891
|
-
const
|
|
99953
|
+
const current5 = { clip, index: index2, local: clipLocalTime(clip, t3) };
|
|
99892
99954
|
const tr = clip.transitionIn;
|
|
99893
99955
|
const prev = index2 > 0 ? clips2[index2 - 1] : void 0;
|
|
99894
|
-
if (!tr || !prev || tr.duration <= 0 || t3 >= clip.start + tr.duration || t3 < clip.start) return { current:
|
|
99956
|
+
if (!tr || !prev || tr.duration <= 0 || t3 >= clip.start + tr.duration || t3 < clip.start) return { current: current5, previous: null, transition: null };
|
|
99895
99957
|
const progress2 = evalInterp(tr.interp, (t3 - clip.start) / tr.duration, tr.duration);
|
|
99896
99958
|
return {
|
|
99897
|
-
current:
|
|
99959
|
+
current: current5,
|
|
99898
99960
|
previous: { clip: prev, index: index2 - 1, local: clipLocalTime(prev, t3) },
|
|
99899
99961
|
transition: { type: tr.type, progress: progress2, params: tr.params }
|
|
99900
99962
|
};
|
|
@@ -101451,7 +101513,7 @@ function repairStateMachine(raw, markerIds, hasNode) {
|
|
|
101451
101513
|
else delete t3.guards;
|
|
101452
101514
|
return t3;
|
|
101453
101515
|
});
|
|
101454
|
-
const
|
|
101516
|
+
const listeners9 = entries4(raw.listeners, (e) => {
|
|
101455
101517
|
if (!STATE_MACHINE_LISTENER_TYPES.includes(e.type)) return null;
|
|
101456
101518
|
let l = e;
|
|
101457
101519
|
if (e.layer !== void 0 && !(typeof e.layer === "string" && hasNode(e.layer))) {
|
|
@@ -101471,7 +101533,7 @@ function repairStateMachine(raw, markerIds, hasNode) {
|
|
|
101471
101533
|
const initial = typeof raw.initial === "string" && states[raw.initial] ? raw.initial : sortedValues(states)[0].id;
|
|
101472
101534
|
if (id3 !== raw.id || name2 !== raw.name || initial !== raw.initial) changed = true;
|
|
101473
101535
|
if (!changed) return raw;
|
|
101474
|
-
return { id: id3, name: name2, initial, states, transitions, inputs, listeners:
|
|
101536
|
+
return { id: id3, name: name2, initial, states, transitions, inputs, listeners: listeners9 };
|
|
101475
101537
|
}
|
|
101476
101538
|
var STATE_MACHINE_INPUT_TYPES, STATE_MACHINE_GUARD_OPS, STATE_MACHINE_ACTION_TYPES, STATE_MACHINE_LISTENER_TYPES, isKeyListener, ANY_STATE, MAX_STEPS2, byId2, sortedValues, machineOf, startValue, isObj3, finite4, isValue, goodId;
|
|
101477
101539
|
var init_state_machine = __esm({
|
|
@@ -247966,6 +248028,7 @@ function repairCompositions(comps, nodes) {
|
|
|
247966
248028
|
var isObj5, finite6, optFinite, isVec2, TIMELINE_COLOR_IDS, TIMELINE_COLORS, UNITS, ORDERS, PROP_KEYS, ANIMATOR_ID, MOTION_TYPES, TRANSITIONS, isFraction, MEDIA_HASH;
|
|
247967
248029
|
var init_invariants = __esm({
|
|
247968
248030
|
"lib/motion/invariants.ts"() {
|
|
248031
|
+
"use strict";
|
|
247969
248032
|
init_easing();
|
|
247970
248033
|
init_properties();
|
|
247971
248034
|
init_markers();
|
|
@@ -252159,11 +252222,11 @@ function bufferPolylines(lines2, width) {
|
|
|
252159
252222
|
return pieces.map((p2) => [p2[0]]);
|
|
252160
252223
|
}
|
|
252161
252224
|
}
|
|
252162
|
-
function combineRings(rings,
|
|
252225
|
+
function combineRings(rings, mode2) {
|
|
252163
252226
|
const polys = rings.filter((r) => r.length >= 3).map((r) => [r]);
|
|
252164
252227
|
if (polys.length === 0) return [];
|
|
252165
252228
|
try {
|
|
252166
|
-
return polys.length > 1 ? import_polygon_clipping4.default[
|
|
252229
|
+
return polys.length > 1 ? import_polygon_clipping4.default[mode2](polys[0], ...polys.slice(1)) : [polys[0]];
|
|
252167
252230
|
} catch {
|
|
252168
252231
|
return polys.map((p2) => [p2[0]]);
|
|
252169
252232
|
}
|
|
@@ -252177,8 +252240,8 @@ function nodeWorldMultiPoly(doc2, id3) {
|
|
|
252177
252240
|
return mp.map((poly) => poly.map((ring) => ring.map(([x2, y]) => place4(x2, y))));
|
|
252178
252241
|
}
|
|
252179
252242
|
const rings = nodeWorldRings(doc2, id3);
|
|
252180
|
-
const
|
|
252181
|
-
return combineRings(rings,
|
|
252243
|
+
const mode2 = node2.type === "VECTOR" && node2.fillRule === "EVENODD" ? "xor" : "union";
|
|
252244
|
+
return combineRings(rings, mode2);
|
|
252182
252245
|
}
|
|
252183
252246
|
function nodeAreaMultiPoly(doc2, id3) {
|
|
252184
252247
|
if (!doc2.nodes[id3]) return [];
|
|
@@ -253359,17 +253422,17 @@ function packDabs(dabs, frame3, paint, prev) {
|
|
|
253359
253422
|
const p2 = worldToLayer(frame3, d.cx, d.cy);
|
|
253360
253423
|
const round5 = Math.max(0.1, d.roundness ?? 1);
|
|
253361
253424
|
let rx = d.r * k2, ry = d.r * round5 * k2;
|
|
253362
|
-
let
|
|
253363
|
-
if (paint.stamp)
|
|
253425
|
+
let mode2 = 0;
|
|
253426
|
+
if (paint.stamp) mode2 = 2;
|
|
253364
253427
|
else if (paint.tip === "SQUARE") {
|
|
253365
|
-
|
|
253428
|
+
mode2 = 1;
|
|
253366
253429
|
rx *= 0.85;
|
|
253367
253430
|
ry *= 0.85;
|
|
253368
253431
|
} else if (paint.tip === "NIB") {
|
|
253369
|
-
|
|
253432
|
+
mode2 = 1;
|
|
253370
253433
|
ry *= 0.45;
|
|
253371
253434
|
} else if (paint.tip === "CHISEL") {
|
|
253372
|
-
|
|
253435
|
+
mode2 = 1;
|
|
253373
253436
|
ry *= 0.5;
|
|
253374
253437
|
}
|
|
253375
253438
|
const angle2 = d.angle - frame3.rotationRad;
|
|
@@ -253381,8 +253444,8 @@ function packDabs(dabs, frame3, paint, prev) {
|
|
|
253381
253444
|
data[o + 12] = d.charge ?? 1;
|
|
253382
253445
|
data[o + 13] = (d.travel ?? 0) - frame3.rotationRad;
|
|
253383
253446
|
data[o + 4] = angle2;
|
|
253384
|
-
data[o + 5] = (paint.smudgeStrength !== void 0 || paint.liquify) &&
|
|
253385
|
-
data[o + 6] =
|
|
253447
|
+
data[o + 5] = (paint.smudgeStrength !== void 0 || paint.liquify) && mode2 === 0 ? 0.6 : d.hardness ?? paint.hardness;
|
|
253448
|
+
data[o + 6] = mode2;
|
|
253386
253449
|
if (paint.cloneOffset) {
|
|
253387
253450
|
data[o + 8] = paint.cloneOffset.x;
|
|
253388
253451
|
data[o + 9] = paint.cloneOffset.y;
|
|
@@ -253663,12 +253726,12 @@ function selectAll(g) {
|
|
|
253663
253726
|
s.fill(1);
|
|
253664
253727
|
return s;
|
|
253665
253728
|
}
|
|
253666
|
-
function combineSelection(base, next2,
|
|
253667
|
-
if (!base ||
|
|
253729
|
+
function combineSelection(base, next2, mode2) {
|
|
253730
|
+
if (!base || mode2 === "REPLACE") return next2;
|
|
253668
253731
|
const out = new Uint8Array(next2.length);
|
|
253669
253732
|
for (let i2 = 0; i2 < next2.length; i2++) {
|
|
253670
253733
|
const a = base[i2] ? 1 : 0, b = next2[i2] ? 1 : 0;
|
|
253671
|
-
out[i2] =
|
|
253734
|
+
out[i2] = mode2 === "ADD" ? a | b : mode2 === "SUBTRACT" ? a & ~b : a & b;
|
|
253672
253735
|
}
|
|
253673
253736
|
return out;
|
|
253674
253737
|
}
|
|
@@ -253839,10 +253902,10 @@ function createImageEditSlice(set4, get4) {
|
|
|
253839
253902
|
if (!edit) return;
|
|
253840
253903
|
set4({ imageEdit: { ...edit, ...combine ? { combine } : {}, ...tolerance !== void 0 ? { tolerance } : {} } });
|
|
253841
253904
|
},
|
|
253842
|
-
applySelection: (next2,
|
|
253905
|
+
applySelection: (next2, mode2) => {
|
|
253843
253906
|
const edit = get4().imageEdit;
|
|
253844
253907
|
if (!edit) return;
|
|
253845
|
-
set4({ imageEdit: { ...edit, selection: combineSelection(edit.selection, next2,
|
|
253908
|
+
set4({ imageEdit: { ...edit, selection: combineSelection(edit.selection, next2, mode2 ?? edit.combine) } });
|
|
253846
253909
|
},
|
|
253847
253910
|
selectAllImage: () => {
|
|
253848
253911
|
const edit = get4().imageEdit;
|
|
@@ -254369,15 +254432,15 @@ function createModeSlice(set4, get4) {
|
|
|
254369
254432
|
tabOrder: loadTabOrder(),
|
|
254370
254433
|
stageView: {},
|
|
254371
254434
|
stageFrameId: null,
|
|
254372
|
-
setMode: (
|
|
254435
|
+
setMode: (mode2) => {
|
|
254373
254436
|
const state = get4();
|
|
254374
|
-
if (state.mode ===
|
|
254437
|
+
if (state.mode === mode2) return;
|
|
254375
254438
|
const st = get4();
|
|
254376
254439
|
if (st.vectorEditMode) st.exitVectorEditMode?.();
|
|
254377
254440
|
if (st.pixelEdit) st.exitPixelEdit?.();
|
|
254378
254441
|
const motion = get4();
|
|
254379
254442
|
motion.setMotionTarget?.(null);
|
|
254380
|
-
const profile = MODE_PROFILES[
|
|
254443
|
+
const profile = MODE_PROFILES[mode2];
|
|
254381
254444
|
const sides = state.tabSides ?? {};
|
|
254382
254445
|
const tabs = {};
|
|
254383
254446
|
const keyOf3 = (tab) => sideOf(sides, tab) === "left" ? "leftTab" : "rightTab";
|
|
@@ -254390,7 +254453,7 @@ function createModeSlice(set4, get4) {
|
|
|
254390
254453
|
tabs[keyOf3(previous)] = side === sideOf(sides, "composition") ? "composition" : tabsOn(sides, side, state.tabOrder)[0] ?? previous;
|
|
254391
254454
|
}
|
|
254392
254455
|
set4({
|
|
254393
|
-
mode,
|
|
254456
|
+
mode: mode2,
|
|
254394
254457
|
...tabs,
|
|
254395
254458
|
// Tools do not survive a mode switch: PopCorn's washi used to stay armed in Design, where nothing
|
|
254396
254459
|
// could draw it. The toolset that owns the tool is the only place it is reachable. The mode says
|
|
@@ -254434,9 +254497,9 @@ function createModeSlice(set4, get4) {
|
|
|
254434
254497
|
}
|
|
254435
254498
|
set4(patch2);
|
|
254436
254499
|
},
|
|
254437
|
-
setStageView: (on,
|
|
254500
|
+
setStageView: (on, mode2) => {
|
|
254438
254501
|
const state = get4();
|
|
254439
|
-
const m =
|
|
254502
|
+
const m = mode2 ?? state.mode;
|
|
254440
254503
|
if (!!state.stageView[m] === on) return;
|
|
254441
254504
|
set4({ stageView: { ...state.stageView, [m]: on } });
|
|
254442
254505
|
},
|
|
@@ -254930,25 +254993,25 @@ function createPixelSlice(set4, get4) {
|
|
|
254930
254993
|
commit(id3, { palette: clean3 }, "Edit palette");
|
|
254931
254994
|
},
|
|
254932
254995
|
/** Switch color mode, converting every frame (and tile): quantize to palette / luminance. */
|
|
254933
|
-
pixelSetColorMode: (id3,
|
|
254996
|
+
pixelSetColorMode: (id3, mode2) => {
|
|
254934
254997
|
const n = node2(id3);
|
|
254935
|
-
if (!n || n.colorMode ===
|
|
254998
|
+
if (!n || n.colorMode === mode2) return;
|
|
254936
254999
|
const count2 = n.pixelWidth * n.pixelHeight;
|
|
254937
255000
|
let palette2 = n.palette;
|
|
254938
|
-
if (
|
|
255001
|
+
if (mode2 === "INDEXED" && palette2.length < 2) {
|
|
254939
255002
|
const all4 = new Uint32Array(count2 * n.frames.length);
|
|
254940
255003
|
n.frames.forEach((_, i2) => all4.set(frameRGBA(n, i2), i2 * count2));
|
|
254941
255004
|
palette2 = extractPalette(all4, 256).map(packedToHex);
|
|
254942
255005
|
}
|
|
254943
|
-
const conv = (b64, cellCount) => encodeCels(convertCels(decodeCels(b64, cellCount), n.colorMode,
|
|
254944
|
-
const patch2 = { colorMode:
|
|
255006
|
+
const conv = (b64, cellCount) => encodeCels(convertCels(decodeCels(b64, cellCount), n.colorMode, mode2, n.palette, palette2, n.transparentIndex));
|
|
255007
|
+
const patch2 = { colorMode: mode2, palette: palette2 };
|
|
254945
255008
|
if (n.tileset) {
|
|
254946
255009
|
const tc = n.tileset.tileW * n.tileset.tileH;
|
|
254947
255010
|
patch2.tileset = { ...n.tileset, tiles: n.tileset.tiles.map((t3) => conv(t3, tc)) };
|
|
254948
255011
|
} else {
|
|
254949
255012
|
patch2.frames = n.frames.map((f2) => ({ ...f2, cels: conv(f2.cels, count2) }));
|
|
254950
255013
|
}
|
|
254951
|
-
commit(id3, patch2, `Color mode: ${
|
|
255014
|
+
commit(id3, patch2, `Color mode: ${mode2.toLowerCase()}`);
|
|
254952
255015
|
},
|
|
254953
255016
|
/** Dedupe the canvas into a tileset + per-frame tile maps (Aseprite "convert to tilemap"). */
|
|
254954
255017
|
pixelConvertToTilemap: (id3, tileW, tileH) => {
|
|
@@ -256883,9 +256946,9 @@ function presenceChanges(prev, next2) {
|
|
|
256883
256946
|
for (const [id3, name2] of before) if (!after.has(id3)) out.push(t2("a11y.personLeft", { name: name2 }));
|
|
256884
256947
|
return out;
|
|
256885
256948
|
}
|
|
256886
|
-
function announcePresence(
|
|
256949
|
+
function announcePresence(subscribe2) {
|
|
256887
256950
|
let last3 = null;
|
|
256888
|
-
return
|
|
256951
|
+
return subscribe2((people) => {
|
|
256889
256952
|
if (last3) for (const m of presenceChanges(last3, people)) announce(m);
|
|
256890
256953
|
last3 = people;
|
|
256891
256954
|
});
|
|
@@ -257922,7 +257985,7 @@ function documentPath(opts) {
|
|
|
257922
257985
|
}
|
|
257923
257986
|
function tabChannel() {
|
|
257924
257987
|
if (!isDesktopTabs() || typeof BroadcastChannel === "undefined") return null;
|
|
257925
|
-
return
|
|
257988
|
+
return channel2 ??= new BroadcastChannel(CHANNEL2);
|
|
257926
257989
|
}
|
|
257927
257990
|
function postTabMessage(msg) {
|
|
257928
257991
|
tabChannel()?.postMessage(msg);
|
|
@@ -257935,15 +257998,15 @@ function onTabMessage(fn) {
|
|
|
257935
257998
|
ch.addEventListener("message", handler);
|
|
257936
257999
|
return () => ch.removeEventListener("message", handler);
|
|
257937
258000
|
}
|
|
257938
|
-
var EDITOR_HOME, localDocPath, cloudFilePath,
|
|
258001
|
+
var EDITOR_HOME, localDocPath, cloudFilePath, CHANNEL2, channel2;
|
|
257939
258002
|
var init_tab_mode = __esm({
|
|
257940
258003
|
"lib/desktop/tab-mode.ts"() {
|
|
257941
258004
|
"use strict";
|
|
257942
258005
|
EDITOR_HOME = "/home";
|
|
257943
258006
|
localDocPath = (docId) => `${EDITOR_HOME}?doc=${encodeURIComponent(docId)}`;
|
|
257944
258007
|
cloudFilePath = (key5) => `/pop/${encodeURIComponent(key5)}`;
|
|
257945
|
-
|
|
257946
|
-
|
|
258008
|
+
CHANNEL2 = "popcraft-desktop-tabs";
|
|
258009
|
+
channel2 = null;
|
|
257947
258010
|
}
|
|
257948
258011
|
});
|
|
257949
258012
|
|
|
@@ -258880,17 +258943,17 @@ function setModifierParam(track2, id3, name2, value3) {
|
|
|
258880
258943
|
return next2;
|
|
258881
258944
|
});
|
|
258882
258945
|
}
|
|
258883
|
-
function setLoopMode(track2, id3,
|
|
258884
|
-
return change(track2, id3, (m) => m.kind === "loop" && m.mode !==
|
|
258946
|
+
function setLoopMode(track2, id3, mode2) {
|
|
258947
|
+
return change(track2, id3, (m) => m.kind === "loop" && m.mode !== mode2 ? { ...m, mode: mode2 } : m);
|
|
258885
258948
|
}
|
|
258886
258949
|
function setAudioSignal(track2, id3, signal) {
|
|
258887
258950
|
return change(track2, id3, (m) => m.kind === "audio" && m.signal !== signal ? { ...m, signal, ...signal === "spectrum" && m.bin === void 0 ? { bin: 0.25 } : {} } : m);
|
|
258888
258951
|
}
|
|
258889
|
-
function setAudioMode(track2, id3,
|
|
258952
|
+
function setAudioMode(track2, id3, mode2) {
|
|
258890
258953
|
return change(track2, id3, (m) => {
|
|
258891
|
-
if (m.kind !== "audio" || (m.mode ?? "add") ===
|
|
258892
|
-
const next2 = { ...m, mode };
|
|
258893
|
-
if (
|
|
258954
|
+
if (m.kind !== "audio" || (m.mode ?? "add") === mode2) return m;
|
|
258955
|
+
const next2 = { ...m, mode: mode2 };
|
|
258956
|
+
if (mode2 === "add") delete next2.mode;
|
|
258894
258957
|
return next2;
|
|
258895
258958
|
});
|
|
258896
258959
|
}
|
|
@@ -260241,10 +260304,10 @@ var init_autokey = __esm({
|
|
|
260241
260304
|
});
|
|
260242
260305
|
|
|
260243
260306
|
// lib/motion/key-selection.ts
|
|
260244
|
-
function selectKeys(sel, refs,
|
|
260245
|
-
if (
|
|
260307
|
+
function selectKeys(sel, refs, mode2) {
|
|
260308
|
+
if (mode2 === "replace") return dedupe2(refs);
|
|
260246
260309
|
const have = new Set(sel.map(keyRefId));
|
|
260247
|
-
if (
|
|
260310
|
+
if (mode2 === "toggle" && refs.length && refs.every((r) => have.has(keyRefId(r)))) {
|
|
260248
260311
|
const drop = new Set(refs.map(keyRefId));
|
|
260249
260312
|
return sel.filter((r) => !drop.has(keyRefId(r)));
|
|
260250
260313
|
}
|
|
@@ -260863,8 +260926,8 @@ function createMotionSlice(set4, get4) {
|
|
|
260863
260926
|
const tr = get4().transport;
|
|
260864
260927
|
if (tr.playing && !tr.loop && tr.end > 0 && transportTime(tr, now2) >= tr.end) put3({ playing: false, playAnchor: null, time: tr.end });
|
|
260865
260928
|
},
|
|
260866
|
-
selectKeys: (refs,
|
|
260867
|
-
const next2 = selectKeys(liveKeys(), refs,
|
|
260929
|
+
selectKeys: (refs, mode2 = "replace") => {
|
|
260930
|
+
const next2 = selectKeys(liveKeys(), refs, mode2);
|
|
260868
260931
|
const cur = get4().keySelection;
|
|
260869
260932
|
if (next2.length || cur.length) set4({ keySelection: next2 });
|
|
260870
260933
|
},
|
|
@@ -261711,8 +261774,8 @@ function scopeOf(doc2, key5, record2) {
|
|
|
261711
261774
|
const c2 = r && doc2.collections?.[r.collectionId];
|
|
261712
261775
|
return withKey(r && c2 ? itemScope(c2, r, vars) : vars, key5);
|
|
261713
261776
|
}
|
|
261714
|
-
function setVariableValue(action3, variable,
|
|
261715
|
-
if (action3.variableToggle) return !
|
|
261777
|
+
function setVariableValue(action3, variable, current5, doc2, key5, record2) {
|
|
261778
|
+
if (action3.variableToggle) return !current5;
|
|
261716
261779
|
if (action3.variableExpression !== void 0 && action3.variableExpression.trim()) {
|
|
261717
261780
|
const v = tryEvaluate(action3.variableExpression, scopeOf(doc2, key5, record2));
|
|
261718
261781
|
return v === void 0 ? void 0 : coerceToVariable(variable.type, v);
|
|
@@ -261737,14 +261800,14 @@ function glideValue(g, now2) {
|
|
|
261737
261800
|
const k2 = g.duration > 0 ? Math.min(1, Math.max(0, (now2 - g.at) / g.duration)) : 1;
|
|
261738
261801
|
return g.from + (g.to - g.from) * ease(k2, g.easing, g.duration, g.spring);
|
|
261739
261802
|
}
|
|
261740
|
-
function startGlide(glides, id3,
|
|
261803
|
+
function startGlide(glides, id3, mode2, from2, to, transition2, now2) {
|
|
261741
261804
|
const rest = { ...glides ?? {} };
|
|
261742
261805
|
delete rest[id3];
|
|
261743
261806
|
const duration3 = transition2?.duration ?? 0;
|
|
261744
261807
|
const prev = glides?.[id3];
|
|
261745
|
-
const start2 = prev && prev.mode ===
|
|
261808
|
+
const start2 = prev && prev.mode === mode2 ? glideValue(prev, now2) : from2;
|
|
261746
261809
|
if (!(duration3 > 0) || typeof start2 !== "number" || typeof to !== "number" || start2 === to) return Object.keys(rest).length ? rest : null;
|
|
261747
|
-
return { ...rest, [id3]: { mode, from: start2, to, at: now2, duration: duration3, easing: transition2.easing, ...transition2.spring ? { spring: transition2.spring } : {} } };
|
|
261810
|
+
return { ...rest, [id3]: { mode: mode2, from: start2, to, at: now2, duration: duration3, easing: transition2.easing, ...transition2.spring ? { spring: transition2.spring } : {} } };
|
|
261748
261811
|
}
|
|
261749
261812
|
var init_variable_glides = __esm({
|
|
261750
261813
|
"lib/motion/variable-glides.ts"() {
|
|
@@ -261759,7 +261822,7 @@ function scrollerOf(nodes, id3) {
|
|
|
261759
261822
|
for (let cur = nodes[id3]?.parentId; cur; cur = nodes[cur]?.parentId) if (scrolls(nodes[cur])) return cur;
|
|
261760
261823
|
return null;
|
|
261761
261824
|
}
|
|
261762
|
-
function placed(doc2, frameId,
|
|
261825
|
+
function placed(doc2, frameId, current5, x2, y) {
|
|
261763
261826
|
const node2 = doc2.nodes[frameId];
|
|
261764
261827
|
if (!scrolls(node2)) return null;
|
|
261765
261828
|
const bounds2 = getNodeBounds(doc2, frameId);
|
|
@@ -261767,8 +261830,8 @@ function placed(doc2, frameId, current4, x2, y) {
|
|
|
261767
261830
|
const maxX = Math.max(0, bounds2.width - node2.width);
|
|
261768
261831
|
const maxY = Math.max(0, bounds2.height - node2.height);
|
|
261769
261832
|
return {
|
|
261770
|
-
x: node2.overflowScrolling === "HORIZONTAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxX, x2)) :
|
|
261771
|
-
y: node2.overflowScrolling === "VERTICAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxY, y)) :
|
|
261833
|
+
x: node2.overflowScrolling === "HORIZONTAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxX, x2)) : current5.x,
|
|
261834
|
+
y: node2.overflowScrolling === "VERTICAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxY, y)) : current5.y
|
|
261772
261835
|
};
|
|
261773
261836
|
}
|
|
261774
261837
|
function scrollBy(state, frameId, dx, dy) {
|
|
@@ -262471,7 +262534,7 @@ var init_plugin_store = __esm({
|
|
|
262471
262534
|
toasts: [],
|
|
262472
262535
|
permissionPrompt: null,
|
|
262473
262536
|
managerOpen: false,
|
|
262474
|
-
setInstalled: (
|
|
262537
|
+
setInstalled: (installed4) => set4({ installed: installed4 }),
|
|
262475
262538
|
setManagerOpen: (managerOpen) => set4({ managerOpen }),
|
|
262476
262539
|
upsertSession: (s) => set4((st) => ({ sessions: [...st.sessions.filter((x2) => x2.sessionId !== s.sessionId), s] })),
|
|
262477
262540
|
patchSession: (sessionId, patch2) => set4((st) => ({ sessions: st.sessions.map((x2) => x2.sessionId === sessionId ? { ...x2, ...patch2 } : x2) })),
|
|
@@ -262575,6 +262638,7 @@ function formatDate(date5, opts = { month: "short", day: "numeric", year: "numer
|
|
|
262575
262638
|
var cache5, nf;
|
|
262576
262639
|
var init_format = __esm({
|
|
262577
262640
|
"lib/i18n/format.ts"() {
|
|
262641
|
+
"use strict";
|
|
262578
262642
|
init_runtime();
|
|
262579
262643
|
cache5 = /* @__PURE__ */ new Map();
|
|
262580
262644
|
nf = (opts) => cached2("n", opts, (l) => new Intl.NumberFormat(l, opts));
|
|
@@ -262594,7 +262658,6 @@ function formatLimit(key5, max3) {
|
|
|
262594
262658
|
var formatBytes;
|
|
262595
262659
|
var init_limits2 = __esm({
|
|
262596
262660
|
"lib/billing/limits.ts"() {
|
|
262597
|
-
"use strict";
|
|
262598
262661
|
init_format();
|
|
262599
262662
|
init_plans();
|
|
262600
262663
|
formatBytes = formatFileSize;
|
|
@@ -271632,11 +271695,11 @@ function repairTree(nodes, pages2) {
|
|
|
271632
271695
|
});
|
|
271633
271696
|
if (keep.length !== kids.length) put3({ ...node2, childIds: keep });
|
|
271634
271697
|
}
|
|
271635
|
-
const
|
|
271636
|
-
for (const id3 in
|
|
271637
|
-
const node2 =
|
|
271698
|
+
const current5 = out ?? nodes;
|
|
271699
|
+
for (const id3 in current5) {
|
|
271700
|
+
const node2 = current5[id3];
|
|
271638
271701
|
if (pages2.includes(id3)) continue;
|
|
271639
|
-
const parents = (listedBy.get(id3) ?? []).filter((p2) => (
|
|
271702
|
+
const parents = (listedBy.get(id3) ?? []).filter((p2) => (current5[p2].childIds ?? []).includes(id3));
|
|
271640
271703
|
const parent = parents[0] ?? null;
|
|
271641
271704
|
if (parent && node2.parentId !== parent) put3({ ...node2, parentId: parent });
|
|
271642
271705
|
}
|
|
@@ -271682,7 +271745,7 @@ function finishDocument(ydoc, base, nodes) {
|
|
|
271682
271745
|
}
|
|
271683
271746
|
return doc2;
|
|
271684
271747
|
}
|
|
271685
|
-
function applyYEventsToDocument(ydoc,
|
|
271748
|
+
function applyYEventsToDocument(ydoc, current5, events) {
|
|
271686
271749
|
const ynodes = yNodes(ydoc);
|
|
271687
271750
|
const touched = /* @__PURE__ */ new Set();
|
|
271688
271751
|
let structure = false;
|
|
@@ -271700,9 +271763,9 @@ function applyYEventsToDocument(ydoc, current4, events) {
|
|
|
271700
271763
|
structure = true;
|
|
271701
271764
|
}
|
|
271702
271765
|
}
|
|
271703
|
-
let nodes =
|
|
271766
|
+
let nodes = current5.nodes;
|
|
271704
271767
|
if (touched.size) {
|
|
271705
|
-
nodes = { ...
|
|
271768
|
+
nodes = { ...current5.nodes };
|
|
271706
271769
|
for (const id3 of touched) {
|
|
271707
271770
|
if (!isSafeKey(id3)) continue;
|
|
271708
271771
|
const ynode = ynodes.get(id3);
|
|
@@ -271710,9 +271773,9 @@ function applyYEventsToDocument(ydoc, current4, events) {
|
|
|
271710
271773
|
else delete nodes[id3];
|
|
271711
271774
|
}
|
|
271712
271775
|
}
|
|
271713
|
-
if (!touched.size && !structure) return
|
|
271714
|
-
if (!structure && !tree) return { ...
|
|
271715
|
-
return finishDocument(ydoc,
|
|
271776
|
+
if (!touched.size && !structure) return current5;
|
|
271777
|
+
if (!structure && !tree) return { ...current5, nodes };
|
|
271778
|
+
return finishDocument(ydoc, current5, nodes);
|
|
271716
271779
|
}
|
|
271717
271780
|
var LOCAL_ORIGIN, RECORD_FIELDS, META_FIELDS, sameSyncedFields, yRecordMaps, TRACK_PREFIX, MACHINE_PARTS, MACHINE_PREFIX, MAX_DOC_NAME, UNSAFE_KEYS, isSafeKey, yNodes, yPages, yMeta;
|
|
271718
271781
|
var init_ydoc = __esm({
|
|
@@ -272895,12 +272958,12 @@ function startCollabSession(docId, opts) {
|
|
|
272895
272958
|
if (!bound || tr.origin === LOCAL_ORIGIN || !isActive()) return;
|
|
272896
272959
|
if (useEditorStore.getState().isVersionHistoryMode) return;
|
|
272897
272960
|
if (sendTimer) flush();
|
|
272898
|
-
const
|
|
272899
|
-
const sharedCurrent = withoutPrivate(
|
|
272961
|
+
const current5 = useEditorStore.getState().document;
|
|
272962
|
+
const sharedCurrent = withoutPrivate(current5);
|
|
272900
272963
|
const shared = applyYEventsToDocument(ydoc, sharedCurrent, events);
|
|
272901
272964
|
if (shared === sharedCurrent) return;
|
|
272902
|
-
const next2 = repairDocumentPaints(migrateDocumentMotion(restorePrivate(shared,
|
|
272903
|
-
if (!(tr.origin instanceof UndoManager)) noteRemoteChanges(
|
|
272965
|
+
const next2 = repairDocumentPaints(migrateDocumentMotion(restorePrivate(shared, current5)));
|
|
272966
|
+
if (!(tr.origin instanceof UndoManager)) noteRemoteChanges(current5, next2, changedIds(current5, next2, events));
|
|
272904
272967
|
if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent("popcraft-media-retry"));
|
|
272905
272968
|
applyingRemote = true;
|
|
272906
272969
|
synced = shared;
|
|
@@ -273038,9 +273101,9 @@ function withDeadline(p2, ms2) {
|
|
|
273038
273101
|
return Promise.race([p2, deadline]).finally(() => clearTimeout(timer));
|
|
273039
273102
|
}
|
|
273040
273103
|
async function trackOpen(run4, opts = {}) {
|
|
273041
|
-
const
|
|
273042
|
-
if (
|
|
273043
|
-
const joined = { stage: (s) => patch(
|
|
273104
|
+
const current5 = useOpenProgress.getState().open;
|
|
273105
|
+
if (current5 && !current5.error) {
|
|
273106
|
+
const joined = { stage: (s) => patch(current5.id, { stage: s }) };
|
|
273044
273107
|
return run4(joined);
|
|
273045
273108
|
}
|
|
273046
273109
|
const id3 = nextId++;
|
|
@@ -274311,9 +274374,9 @@ function changedBox(a, b, width) {
|
|
|
274311
274374
|
}
|
|
274312
274375
|
function createGifEncoder(width, height, opts, shared) {
|
|
274313
274376
|
const gif = (0, import_gifenc.GIFEncoder)();
|
|
274314
|
-
const
|
|
274377
|
+
const mode2 = opts.palette ?? "global";
|
|
274315
274378
|
const dither = opts.dither ?? "none";
|
|
274316
|
-
const incremental =
|
|
274379
|
+
const incremental = mode2 === "global" && !!shared;
|
|
274317
274380
|
let n = 0;
|
|
274318
274381
|
let pending8 = null;
|
|
274319
274382
|
let canvas = null;
|
|
@@ -274326,7 +274389,7 @@ function createGifEncoder(width, height, opts, shared) {
|
|
|
274326
274389
|
const flush = (keep) => {
|
|
274327
274390
|
const p2 = pending8;
|
|
274328
274391
|
if (!p2) return new Uint8Array(0);
|
|
274329
|
-
const own2 =
|
|
274392
|
+
const own2 = mode2 === "per-frame" || n === 0;
|
|
274330
274393
|
gif.writeFrame(p2.idx, p2.w, p2.h, {
|
|
274331
274394
|
palette: own2 ? p2.palette.colors : void 0,
|
|
274332
274395
|
delay: p2.delay,
|
|
@@ -274348,7 +274411,7 @@ function createGifEncoder(width, height, opts, shared) {
|
|
|
274348
274411
|
return {
|
|
274349
274412
|
frame(rgba, delay3) {
|
|
274350
274413
|
let palette2 = shared;
|
|
274351
|
-
if (
|
|
274414
|
+
if (mode2 === "per-frame" || !palette2) {
|
|
274352
274415
|
const c2 = new PaletteCounter();
|
|
274353
274416
|
c2.add(rgba);
|
|
274354
274417
|
palette2 = c2.palette();
|
|
@@ -275380,18 +275443,18 @@ var init_misc = __esm({
|
|
|
275380
275443
|
/** @internal */
|
|
275381
275444
|
_emit(...args2) {
|
|
275382
275445
|
const [event, data] = args2;
|
|
275383
|
-
const
|
|
275384
|
-
if (!
|
|
275446
|
+
const listeners9 = this._listeners.get(event);
|
|
275447
|
+
if (!listeners9) {
|
|
275385
275448
|
return;
|
|
275386
275449
|
}
|
|
275387
|
-
for (const entry of
|
|
275450
|
+
for (const entry of listeners9) {
|
|
275388
275451
|
try {
|
|
275389
275452
|
entry.fn(data);
|
|
275390
275453
|
} catch (error62) {
|
|
275391
275454
|
console.error(error62);
|
|
275392
275455
|
}
|
|
275393
275456
|
if (entry.once) {
|
|
275394
|
-
|
|
275457
|
+
listeners9.delete(entry);
|
|
275395
275458
|
}
|
|
275396
275459
|
}
|
|
275397
275460
|
}
|
|
@@ -279554,8 +279617,8 @@ var init_mp3_misc = __esm({
|
|
|
279554
279617
|
return 12 * bitrate / sampleRate * 4;
|
|
279555
279618
|
}
|
|
279556
279619
|
};
|
|
279557
|
-
getXingOffset = (mpegVersionId,
|
|
279558
|
-
return mpegVersionId === 3 ?
|
|
279620
|
+
getXingOffset = (mpegVersionId, channel4) => {
|
|
279621
|
+
return mpegVersionId === 3 ? channel4 === 3 ? 21 : 36 : channel4 === 3 ? 13 : 21;
|
|
279559
279622
|
};
|
|
279560
279623
|
readMp3FrameHeader = (word, remainingBytes) => {
|
|
279561
279624
|
const firstByte = word >>> 24;
|
|
@@ -279587,7 +279650,7 @@ var init_mp3_misc = __esm({
|
|
|
279587
279650
|
const bitrateIndex = thirdByte >> 4 & 15;
|
|
279588
279651
|
const frequencyIndex = (thirdByte >> 2 & 3) % 3;
|
|
279589
279652
|
const padding3 = thirdByte >> 1 & 1;
|
|
279590
|
-
const
|
|
279653
|
+
const channel4 = fourthByte >> 6 & 3;
|
|
279591
279654
|
const modeExtension = fourthByte >> 4 & 3;
|
|
279592
279655
|
const copyright = fourthByte >> 3 & 1;
|
|
279593
279656
|
const original = fourthByte >> 2 & 1;
|
|
@@ -279623,7 +279686,7 @@ var init_mp3_misc = __esm({
|
|
|
279623
279686
|
bitrate,
|
|
279624
279687
|
frequencyIndex,
|
|
279625
279688
|
sampleRate,
|
|
279626
|
-
channel:
|
|
279689
|
+
channel: channel4,
|
|
279627
279690
|
modeExtension,
|
|
279628
279691
|
copyright,
|
|
279629
279692
|
original,
|
|
@@ -279648,8 +279711,8 @@ var init_mp3_misc = __esm({
|
|
|
279648
279711
|
XingFlags2[XingFlags2["FileSize"] = 2] = "FileSize";
|
|
279649
279712
|
XingFlags2[XingFlags2["Toc"] = 4] = "Toc";
|
|
279650
279713
|
})(XingFlags || (XingFlags = {}));
|
|
279651
|
-
getMp3ChannelCount = (
|
|
279652
|
-
return
|
|
279714
|
+
getMp3ChannelCount = (channel4) => {
|
|
279715
|
+
return channel4 === 3 ? 1 : 2;
|
|
279653
279716
|
};
|
|
279654
279717
|
}
|
|
279655
279718
|
});
|
|
@@ -290406,10 +290469,10 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
290406
290469
|
return true;
|
|
290407
290470
|
}
|
|
290408
290471
|
async ensureCurrentPacketHasNext() {
|
|
290409
|
-
const
|
|
290410
|
-
assert2(
|
|
290472
|
+
const current5 = this.decodeOrderPackets[0];
|
|
290473
|
+
assert2(current5);
|
|
290411
290474
|
while (true) {
|
|
290412
|
-
const presentationIndex = this.presentationOrderPackets.indexOf(
|
|
290475
|
+
const presentationIndex = this.presentationOrderPackets.indexOf(current5);
|
|
290413
290476
|
if (presentationIndex !== -1 && presentationIndex <= this.presentationOrderPackets.length - 2) {
|
|
290414
290477
|
break;
|
|
290415
290478
|
}
|
|
@@ -295725,8 +295788,8 @@ var init_sample2 = __esm({
|
|
|
295725
295788
|
while (remainingFrames > 0) {
|
|
295726
295789
|
const framesToCopy = Math.min(maxFramesPerChunk, remainingFrames);
|
|
295727
295790
|
const chunkData = new Float32Array(numberOfChannels * framesToCopy);
|
|
295728
|
-
for (let
|
|
295729
|
-
audioBuffer.copyFromChannel(chunkData.subarray(
|
|
295791
|
+
for (let channel4 = 0; channel4 < numberOfChannels; channel4++) {
|
|
295792
|
+
audioBuffer.copyFromChannel(chunkData.subarray(channel4 * framesToCopy, (channel4 + 1) * framesToCopy), channel4, currentRelativeFrame);
|
|
295730
295793
|
}
|
|
295731
295794
|
yield new _AudioSample({
|
|
295732
295795
|
format: "f32-planar",
|
|
@@ -295759,8 +295822,8 @@ var init_sample2 = __esm({
|
|
|
295759
295822
|
while (remainingFrames > 0) {
|
|
295760
295823
|
const framesToCopy = Math.min(maxFramesPerChunk, remainingFrames);
|
|
295761
295824
|
const chunkData = new Float32Array(numberOfChannels * framesToCopy);
|
|
295762
|
-
for (let
|
|
295763
|
-
audioBuffer.copyFromChannel(chunkData.subarray(
|
|
295825
|
+
for (let channel4 = 0; channel4 < numberOfChannels; channel4++) {
|
|
295826
|
+
audioBuffer.copyFromChannel(chunkData.subarray(channel4 * framesToCopy, (channel4 + 1) * framesToCopy), channel4, currentRelativeFrame);
|
|
295764
295827
|
}
|
|
295765
295828
|
const audioSample = new _AudioSample({
|
|
295766
295829
|
format: "f32-planar",
|
|
@@ -309668,11 +309731,11 @@ function pathBounds(paths) {
|
|
|
309668
309731
|
}
|
|
309669
309732
|
return minX === Infinity ? null : { minX, minY, maxX, maxY };
|
|
309670
309733
|
}
|
|
309671
|
-
function parseColor2(input2,
|
|
309734
|
+
function parseColor2(input2, current5) {
|
|
309672
309735
|
if (!input2) return null;
|
|
309673
309736
|
const s = input2.trim().toLowerCase();
|
|
309674
309737
|
if (!s || s === "none" || s === "transparent") return null;
|
|
309675
|
-
if (s === "currentcolor") return
|
|
309738
|
+
if (s === "currentcolor") return current5 ?? { r: 0, g: 0, b: 0, a: 1 };
|
|
309676
309739
|
const hex10 = s.startsWith("#") ? s.slice(1) : NAMED[s];
|
|
309677
309740
|
if (hex10 && /^[0-9a-f]+$/.test(hex10)) {
|
|
309678
309741
|
const full = hex10.length <= 4 ? hex10.split("").map((c2) => c2 + c2).join("") : hex10;
|
|
@@ -311145,8 +311208,8 @@ function reflectUrl() {
|
|
|
311145
311208
|
const base = documentPath({ linkKey: activeLink?.key, localDocId });
|
|
311146
311209
|
const atSameAddress = window.location.pathname === base.split("?")[0];
|
|
311147
311210
|
const path = atSameAddress ? withDeepLink(base, parseDeepLink(window.location.search)) : base;
|
|
311148
|
-
const
|
|
311149
|
-
if (
|
|
311211
|
+
const current5 = window.location.pathname + (isDesktopTabs() || localDocId || path.includes("?") ? window.location.search : "");
|
|
311212
|
+
if (current5 !== path) window.history.replaceState(null, "", path);
|
|
311150
311213
|
}
|
|
311151
311214
|
function onSyncStatus(fn) {
|
|
311152
311215
|
statusListeners.add(fn);
|
|
@@ -311801,7 +311864,6 @@ async function dispatchShaped(key5, options) {
|
|
|
311801
311864
|
var onViolation;
|
|
311802
311865
|
var init_dispatch = __esm({
|
|
311803
311866
|
"lib/commands/dispatch.ts"() {
|
|
311804
|
-
"use strict";
|
|
311805
311867
|
init_errors();
|
|
311806
311868
|
init_registry();
|
|
311807
311869
|
init_confirm();
|
|
@@ -312981,6 +313043,7 @@ function areaBounds(rings) {
|
|
|
312981
313043
|
}
|
|
312982
313044
|
var init_text_area = __esm({
|
|
312983
313045
|
"lib/engine/text/text-area.ts"() {
|
|
313046
|
+
"use strict";
|
|
312984
313047
|
}
|
|
312985
313048
|
});
|
|
312986
313049
|
|
|
@@ -313014,7 +313077,7 @@ function fitsContainer(result, node2) {
|
|
|
313014
313077
|
if (node2.textAutoResize === "HEIGHT") return result.lines.length <= (node2.characters ?? "").split("\n").length;
|
|
313015
313078
|
return result.contentHeight <= node2.height + 0.5;
|
|
313016
313079
|
}
|
|
313017
|
-
function fitLayout(node2,
|
|
313080
|
+
function fitLayout(node2, mode2, run4) {
|
|
313018
313081
|
const cache11 = /* @__PURE__ */ new Map();
|
|
313019
313082
|
const at4 = (s) => {
|
|
313020
313083
|
let r = cache11.get(s);
|
|
@@ -313027,7 +313090,7 @@ function fitLayout(node2, mode, run4) {
|
|
|
313027
313090
|
const ok2 = (s) => fitsContainer(at4(s), node2);
|
|
313028
313091
|
let lo, hi;
|
|
313029
313092
|
if (ok2(1)) {
|
|
313030
|
-
if (
|
|
313093
|
+
if (mode2 === "SHRINK") return { ...at4(1), fitScale: 1 };
|
|
313031
313094
|
lo = 1;
|
|
313032
313095
|
hi = 2;
|
|
313033
313096
|
while (hi < MAX_SCALE && ok2(hi)) {
|
|
@@ -313244,10 +313307,10 @@ function layoutTextUncached(node2, atlas, cameraZoom = 1) {
|
|
|
313244
313307
|
return bestResult || layoutTextUncached({ ...node2, __isAutosizing: true, fontSize: 2 }, atlas, cameraZoom);
|
|
313245
313308
|
}
|
|
313246
313309
|
if (!isSticky && node2.__fitScale === void 0) {
|
|
313247
|
-
const
|
|
313248
|
-
if (
|
|
313310
|
+
const mode2 = fitModeOf(node2);
|
|
313311
|
+
if (mode2) {
|
|
313249
313312
|
const area4 = !node2.textPath && node2.textAreaRings?.length;
|
|
313250
|
-
const best = fitLayout(node2,
|
|
313313
|
+
const best = fitLayout(node2, mode2, (n, s) => layoutTextUncached({ ...n, __fitScale: s, ...area4 ? { __areaShift: 0 } : {} }, atlas, cameraZoom));
|
|
313251
313314
|
if (!area4 || (node2.textVerticalAlign || node2.verticalAlign || "TOP") === "TOP") return best;
|
|
313252
313315
|
return { ...layoutAreaAligned({ ...scaleTypography(node2, best.fitScale), __fitScale: best.fitScale }, atlas, cameraZoom), fitScale: best.fitScale };
|
|
313253
313316
|
}
|
|
@@ -315468,25 +315531,25 @@ function effectFilter(node2, ctx2, totalMat) {
|
|
|
315468
315531
|
const sigma = (blur) => Math.max(0.5, blur / 3);
|
|
315469
315532
|
const id3 = uid(ctx2, "fx");
|
|
315470
315533
|
let parts = "";
|
|
315471
|
-
let
|
|
315534
|
+
let current5 = "SourceGraphic";
|
|
315472
315535
|
if (drop) {
|
|
315473
315536
|
const [dx, dy] = localOffset(drop.offset.x, drop.offset.y);
|
|
315474
315537
|
const spread2 = drop.spread || 0;
|
|
315475
315538
|
const knock = drop.showBehindTransparent === false;
|
|
315476
315539
|
if (!spread2 && !knock) {
|
|
315477
|
-
parts += `<feDropShadow in="${
|
|
315540
|
+
parts += `<feDropShadow in="${current5}" dx="${fmt2(dx)}" dy="${fmt2(dy)}" stdDeviation="${fmt2(sigma(drop.blur))}" flood-color="${colorToSVG(drop.color)}" flood-opacity="${fmt2(drop.color.a ?? 1)}" result="withdrop"/>`;
|
|
315478
315541
|
} else {
|
|
315479
|
-
parts += (spread2 ? `<feMorphology in="SourceAlpha" operator="${spread2 > 0 ? "dilate" : "erode"}" radius="${fmt2(Math.abs(spread2))}" result="dropspread"/>` : "") + `<feGaussianBlur in="${spread2 ? "dropspread" : "SourceAlpha"}" stdDeviation="${fmt2(drop.blur > 0 ? sigma(drop.blur) : 0)}" result="dropblur"/><feOffset in="dropblur" dx="${fmt2(dx)}" dy="${fmt2(dy)}" result="dropoff"/><feFlood flood-color="${colorToSVG(drop.color)}" flood-opacity="${fmt2(drop.color.a ?? 1)}" result="dropcol"/><feComposite in="dropcol" in2="dropoff" operator="in" result="dropshadow"/>` + (knock ? `<feComposite in="dropshadow" in2="SourceAlpha" operator="out" result="dropshadow"/>` : "") + `<feMerge result="withdrop"><feMergeNode in="dropshadow"/><feMergeNode in="${
|
|
315542
|
+
parts += (spread2 ? `<feMorphology in="SourceAlpha" operator="${spread2 > 0 ? "dilate" : "erode"}" radius="${fmt2(Math.abs(spread2))}" result="dropspread"/>` : "") + `<feGaussianBlur in="${spread2 ? "dropspread" : "SourceAlpha"}" stdDeviation="${fmt2(drop.blur > 0 ? sigma(drop.blur) : 0)}" result="dropblur"/><feOffset in="dropblur" dx="${fmt2(dx)}" dy="${fmt2(dy)}" result="dropoff"/><feFlood flood-color="${colorToSVG(drop.color)}" flood-opacity="${fmt2(drop.color.a ?? 1)}" result="dropcol"/><feComposite in="dropcol" in2="dropoff" operator="in" result="dropshadow"/>` + (knock ? `<feComposite in="dropshadow" in2="SourceAlpha" operator="out" result="dropshadow"/>` : "") + `<feMerge result="withdrop"><feMergeNode in="dropshadow"/><feMergeNode in="${current5}"/></feMerge>`;
|
|
315480
315543
|
}
|
|
315481
|
-
|
|
315544
|
+
current5 = "withdrop";
|
|
315482
315545
|
}
|
|
315483
315546
|
if (inner) {
|
|
315484
315547
|
const [dx, dy] = localOffset(inner.offset.x, inner.offset.y);
|
|
315485
315548
|
const spread2 = inner.spread || 0;
|
|
315486
|
-
parts += `<feComponentTransfer in="SourceAlpha" result="inv"><feFuncA type="table" tableValues="1 0"/></feComponentTransfer>` + (spread2 > 0 ? `<feMorphology in="inv" operator="dilate" radius="${fmt2(spread2)}" result="inv"/>` : "") + `<feGaussianBlur in="inv" stdDeviation="${fmt2(sigma(inner.blur))}" result="innerblur"/><feOffset in="innerblur" dx="${fmt2(dx)}" dy="${fmt2(dy)}" result="inneroff"/><feComposite in="inneroff" in2="SourceAlpha" operator="in" result="innermask"/><feFlood flood-color="${colorToSVG(inner.color)}" flood-opacity="${fmt2(inner.color.a ?? 1)}" result="innercol"/><feComposite in="innercol" in2="innermask" operator="in" result="inner"/><feMerge result="withinner"><feMergeNode in="${
|
|
315487
|
-
|
|
315549
|
+
parts += `<feComponentTransfer in="SourceAlpha" result="inv"><feFuncA type="table" tableValues="1 0"/></feComponentTransfer>` + (spread2 > 0 ? `<feMorphology in="inv" operator="dilate" radius="${fmt2(spread2)}" result="inv"/>` : "") + `<feGaussianBlur in="inv" stdDeviation="${fmt2(sigma(inner.blur))}" result="innerblur"/><feOffset in="innerblur" dx="${fmt2(dx)}" dy="${fmt2(dy)}" result="inneroff"/><feComposite in="inneroff" in2="SourceAlpha" operator="in" result="innermask"/><feFlood flood-color="${colorToSVG(inner.color)}" flood-opacity="${fmt2(inner.color.a ?? 1)}" result="innercol"/><feComposite in="innercol" in2="innermask" operator="in" result="inner"/><feMerge result="withinner"><feMergeNode in="${current5}"/><feMergeNode in="inner"/></feMerge>`;
|
|
315550
|
+
current5 = "withinner";
|
|
315488
315551
|
}
|
|
315489
|
-
if (layerBlur) parts += `<feGaussianBlur in="${
|
|
315552
|
+
if (layerBlur) parts += `<feGaussianBlur in="${current5}" stdDeviation="${fmt2(sigma(layerBlur.radius))}"/>`;
|
|
315490
315553
|
ctx2.defs.push(`<filter id="${id3}" ${region}>${parts}</filter>`);
|
|
315491
315554
|
return ` filter="url(#${id3})"`;
|
|
315492
315555
|
}
|
|
@@ -316410,13 +316473,13 @@ ${num7(c2[0])} ${num7(c2[1])} ${num7(c2[2])} ${num7(c2[3])} ${num7(c2[4])} ${num
|
|
|
316410
316473
|
for (const run4 of item.runs) {
|
|
316411
316474
|
this.w(`q /${this.gs(opacity * run4.alpha, 1, blend2)} gs ${this.res.color.fill(run4.color)} BT
|
|
316412
316475
|
`);
|
|
316413
|
-
let
|
|
316476
|
+
let current5 = "";
|
|
316414
316477
|
for (const g of run4.glyphs) {
|
|
316415
316478
|
const { resource, gid } = this.res.fonts.use(g.font, g.gid, g.codePoints);
|
|
316416
|
-
if (resource !==
|
|
316479
|
+
if (resource !== current5) {
|
|
316417
316480
|
this.w(`/${resource} ${num7(run4.size)} Tf
|
|
316418
316481
|
`);
|
|
316419
|
-
|
|
316482
|
+
current5 = resource;
|
|
316420
316483
|
}
|
|
316421
316484
|
this.w(`1 0 0 -1 ${num7(g.x)} ${num7(g.y)} Tm <${gid.toString(16).padStart(4, "0")}> Tj
|
|
316422
316485
|
`);
|
|
@@ -316896,8 +316959,8 @@ var init_color2 = __esm({
|
|
|
316896
316959
|
"use strict";
|
|
316897
316960
|
init_writer2();
|
|
316898
316961
|
ColorOut = class {
|
|
316899
|
-
constructor(
|
|
316900
|
-
this.mode =
|
|
316962
|
+
constructor(mode2) {
|
|
316963
|
+
this.mode = mode2;
|
|
316901
316964
|
}
|
|
316902
316965
|
get colorSpace() {
|
|
316903
316966
|
return this.mode === "CMYK" ? "/DeviceCMYK" : "/DeviceRGB";
|
|
@@ -317206,13 +317269,13 @@ async function encodeImageData(imageData, format, quality = 0.9, dpi) {
|
|
|
317206
317269
|
}
|
|
317207
317270
|
function sliceRegion(node2, doc2) {
|
|
317208
317271
|
let pageId2 = null;
|
|
317209
|
-
let
|
|
317210
|
-
while (
|
|
317211
|
-
if (
|
|
317212
|
-
pageId2 =
|
|
317272
|
+
let current5 = node2;
|
|
317273
|
+
while (current5) {
|
|
317274
|
+
if (current5.type === "PAGE") {
|
|
317275
|
+
pageId2 = current5.id;
|
|
317213
317276
|
break;
|
|
317214
317277
|
}
|
|
317215
|
-
|
|
317278
|
+
current5 = current5.parentId ? doc2.nodes[current5.parentId] : void 0;
|
|
317216
317279
|
}
|
|
317217
317280
|
if (!pageId2) return null;
|
|
317218
317281
|
const page = doc2.nodes[pageId2];
|
|
@@ -318172,8 +318235,8 @@ function provideAgentCapability(name2, impl) {
|
|
|
318172
318235
|
else provided.set(name2, impl);
|
|
318173
318236
|
}
|
|
318174
318237
|
function agentCapability(name2, ctx2) {
|
|
318175
|
-
const
|
|
318176
|
-
if (
|
|
318238
|
+
const installed4 = provided.get(name2);
|
|
318239
|
+
if (installed4) return installed4;
|
|
318177
318240
|
switch (name2) {
|
|
318178
318241
|
case "render":
|
|
318179
318242
|
return renderCapability(ctx2);
|
|
@@ -318259,7 +318322,6 @@ function agentToolList() {
|
|
|
318259
318322
|
var AGENT_CAPABILITIES, legacyCommandId, legacyTools, blobToDataUrl3, provided, legacyTool, legacyToolList;
|
|
318260
318323
|
var init_agent = __esm({
|
|
318261
318324
|
"lib/commands/agent.ts"() {
|
|
318262
|
-
"use strict";
|
|
318263
318325
|
init_types5();
|
|
318264
318326
|
init_registry();
|
|
318265
318327
|
init_errors();
|
|
@@ -320109,8 +320171,8 @@ var init_node = __esm({
|
|
|
320109
320171
|
const patches = /* @__PURE__ */ new Map();
|
|
320110
320172
|
for (const id3 of ids2) {
|
|
320111
320173
|
const n = resolvedNodeOrThrow(doc2, id3);
|
|
320112
|
-
const
|
|
320113
|
-
const next2 = args2.degrees !== void 0 ? args2.degrees :
|
|
320174
|
+
const current5 = n.rotation ?? 0;
|
|
320175
|
+
const next2 = args2.degrees !== void 0 ? args2.degrees : current5 + (args2.by ?? 0);
|
|
320114
320176
|
patches.set(id3, { rotation: (next2 % 360 + 360) % 360 });
|
|
320115
320177
|
}
|
|
320116
320178
|
commitUpdates(ctx2, doc2, patches);
|
|
@@ -320123,6 +320185,7 @@ var init_node = __esm({
|
|
|
320123
320185
|
// lib/commands/text.ts
|
|
320124
320186
|
function applyTypeStyle(node2, styles) {
|
|
320125
320187
|
const patch2 = { ...styles };
|
|
320188
|
+
if (node2.textStyleId && Object.keys(styles).some((k2) => TYPOGRAPHY_OVERRIDE_KEYS.has(k2))) patch2.textStyleId = void 0;
|
|
320126
320189
|
const segments = node2.styledSegments;
|
|
320127
320190
|
if (segments?.length) {
|
|
320128
320191
|
const keys4 = Object.keys(styles);
|
|
@@ -320135,7 +320198,7 @@ function applyTypeStyle(node2, styles) {
|
|
|
320135
320198
|
}
|
|
320136
320199
|
return patch2;
|
|
320137
320200
|
}
|
|
320138
|
-
var textSet, TYPE_FIELDS, textSetTypography, textSearchFonts, textSetEffect;
|
|
320201
|
+
var textSet, TYPE_FIELDS, TYPOGRAPHY_OVERRIDE_KEYS, textSetTypography, textSearchFonts, textSetEffect;
|
|
320139
320202
|
var init_text = __esm({
|
|
320140
320203
|
"lib/commands/text.ts"() {
|
|
320141
320204
|
"use strict";
|
|
@@ -320222,6 +320285,20 @@ var init_text = __esm({
|
|
|
320222
320285
|
"textDecoration",
|
|
320223
320286
|
"textAutoResize"
|
|
320224
320287
|
];
|
|
320288
|
+
TYPOGRAPHY_OVERRIDE_KEYS = /* @__PURE__ */ new Set([
|
|
320289
|
+
"fontFamily",
|
|
320290
|
+
"fontWeight",
|
|
320291
|
+
"fontSize",
|
|
320292
|
+
"fontStyle",
|
|
320293
|
+
"letterSpacing",
|
|
320294
|
+
"lineHeight",
|
|
320295
|
+
"paragraphSpacing",
|
|
320296
|
+
"paragraphIndent",
|
|
320297
|
+
"textDecoration",
|
|
320298
|
+
"textCase",
|
|
320299
|
+
"fontFeatures",
|
|
320300
|
+
"fontVariations"
|
|
320301
|
+
]);
|
|
320225
320302
|
textSetTypography = defineCommand({
|
|
320226
320303
|
id: "text.setTypography",
|
|
320227
320304
|
title: "Set typography",
|
|
@@ -320245,6 +320322,8 @@ var init_text = __esm({
|
|
|
320245
320322
|
textAutoResize: external_exports.enum(["NONE", "WIDTH_AND_HEIGHT", "HEIGHT"]).optional()
|
|
320246
320323
|
}),
|
|
320247
320324
|
expose: {
|
|
320325
|
+
// Panels dispatch it (the phone's quick sheet setting a size); a palette row could not know the values.
|
|
320326
|
+
ui: { label: "Set typography", palette: false },
|
|
320248
320327
|
plugin: { method: "setTypography" },
|
|
320249
320328
|
agent: {
|
|
320250
320329
|
name: "set_typography",
|
|
@@ -320446,18 +320525,18 @@ var init_text_path2 = __esm({
|
|
|
320446
320525
|
patches.set(t3.id, { textPath: void 0 });
|
|
320447
320526
|
continue;
|
|
320448
320527
|
}
|
|
320449
|
-
const
|
|
320450
|
-
const pathId =
|
|
320451
|
-
if (
|
|
320528
|
+
const mode2 = args2.mode ?? (args2.pathId ? "PATH" : t3.textPath?.mode ?? (other ? "PATH" : "ARC"));
|
|
320529
|
+
const pathId = mode2 === "PATH" ? args2.pathId ?? (t3.textPath?.mode === "PATH" && !other ? t3.textPath.pathId : other ?? t3.textPath?.pathId) : void 0;
|
|
320530
|
+
if (mode2 === "PATH") {
|
|
320452
320531
|
if (!pathId) throw new ToolError("set_text_path with mode PATH needs pathId (or a text and one shape selected).");
|
|
320453
320532
|
const src = nodeOrThrow(doc2, pathId);
|
|
320454
320533
|
if (pathId === t3.id || !isPathSource(src)) throw new ToolError(`"${src.name}" (${pathId}) is a ${src.type}; a text can follow a vector, rectangle, ellipse, polygon, star, line, arrow or frame.`);
|
|
320455
320534
|
}
|
|
320456
|
-
const keep = t3.textPath && t3.textPath.mode ===
|
|
320457
|
-
const closed =
|
|
320458
|
-
const fresh = keep ? {} : closed ? { align: "CENTER", offset: 0.5 } :
|
|
320459
|
-
const tp = { ...keep ?? {}, ...fresh, ...given, mode, ...
|
|
320460
|
-
if (
|
|
320535
|
+
const keep = t3.textPath && t3.textPath.mode === mode2 ? t3.textPath : null;
|
|
320536
|
+
const closed = mode2 === "CIRCLE" || mode2 === "PATH" && isClosedOutline(doc2.nodes[pathId]);
|
|
320537
|
+
const fresh = keep ? {} : closed ? { align: "CENTER", offset: 0.5 } : mode2 === "ARC" ? { bend: 50 } : {};
|
|
320538
|
+
const tp = { ...keep ?? {}, ...fresh, ...given, mode: mode2, ...mode2 === "PATH" ? { pathId } : {} };
|
|
320539
|
+
if (mode2 !== "PATH") delete tp.pathId;
|
|
320461
320540
|
patches.set(t3.id, { textPath: tp, textArea: void 0 });
|
|
320462
320541
|
}
|
|
320463
320542
|
commitUpdates(ctx2, doc2, patches);
|
|
@@ -320674,6 +320753,8 @@ var init_paint = __esm({
|
|
|
320674
320753
|
remove: external_exports.boolean().optional().describe("Clear all fills.")
|
|
320675
320754
|
}),
|
|
320676
320755
|
expose: {
|
|
320756
|
+
// Panels dispatch it (the phone's quick sheet adding one); a palette row could not know the paint.
|
|
320757
|
+
ui: { label: "Set fills", palette: false },
|
|
320677
320758
|
plugin: { method: "setFills" },
|
|
320678
320759
|
agent: {
|
|
320679
320760
|
name: "set_fills",
|
|
@@ -320686,22 +320767,22 @@ var init_paint = __esm({
|
|
|
320686
320767
|
if (given > 1) throw new ToolError('set_fills takes one of "color", "gradient" or "image", not several.');
|
|
320687
320768
|
if (!given && !args2.remove) throw new ToolError('set_fills needs a "color", a "gradient", an "image" or remove:true.');
|
|
320688
320769
|
const paint = buildPaint(args2);
|
|
320689
|
-
const
|
|
320770
|
+
const mode2 = args2.mode ?? "merge";
|
|
320690
320771
|
const patches = /* @__PURE__ */ new Map();
|
|
320691
320772
|
for (const id3 of ids2) {
|
|
320692
320773
|
const existing = doc2.nodes[id3].fills ?? [];
|
|
320693
320774
|
let fills;
|
|
320694
320775
|
if (args2.remove) fills = [];
|
|
320695
|
-
else if (
|
|
320696
|
-
else if (
|
|
320776
|
+
else if (mode2 === "replace" || !existing.length) fills = [paint];
|
|
320777
|
+
else if (mode2 === "add") fills = [...existing, paint];
|
|
320697
320778
|
else fills = [paint, ...existing.slice(1)];
|
|
320698
320779
|
patches.set(id3, { fills });
|
|
320699
320780
|
}
|
|
320700
320781
|
const what = args2.gradient ? `a ${args2.gradient.type.toLowerCase()} gradient` : args2.image ? "an image" : args2.color;
|
|
320701
320782
|
commitUpdates(ctx2, doc2, patches);
|
|
320702
320783
|
return {
|
|
320703
|
-
summary: args2.remove ? `Cleared fills on ${plural2(ids2.length, "layer")}` : `Filled ${plural2(ids2.length, "layer")} with ${what} (${
|
|
320704
|
-
data: { ids: ids2, mode }
|
|
320784
|
+
summary: args2.remove ? `Cleared fills on ${plural2(ids2.length, "layer")}` : `Filled ${plural2(ids2.length, "layer")} with ${what} (${mode2})`,
|
|
320785
|
+
data: { ids: ids2, mode: mode2 }
|
|
320705
320786
|
};
|
|
320706
320787
|
}
|
|
320707
320788
|
});
|
|
@@ -320727,6 +320808,8 @@ var init_paint = __esm({
|
|
|
320727
320808
|
remove: external_exports.boolean().optional()
|
|
320728
320809
|
}),
|
|
320729
320810
|
expose: {
|
|
320811
|
+
// Panels dispatch it (the phone's quick sheet adding one); a palette row could not know the paint.
|
|
320812
|
+
ui: { label: "Set strokes", palette: false },
|
|
320730
320813
|
plugin: { method: "setStrokes" },
|
|
320731
320814
|
agent: {
|
|
320732
320815
|
name: "set_strokes",
|
|
@@ -321337,6 +321420,222 @@ var init_resolution = __esm({
|
|
|
321337
321420
|
}
|
|
321338
321421
|
});
|
|
321339
321422
|
|
|
321423
|
+
// lib/editor/form-factor.ts
|
|
321424
|
+
var form_factor_exports = {};
|
|
321425
|
+
__export(form_factor_exports, {
|
|
321426
|
+
COMPACT_TABLET_MAX_WIDTH: () => COMPACT_TABLET_MAX_WIDTH,
|
|
321427
|
+
PHONE_MAX_HEIGHT: () => PHONE_MAX_HEIGHT,
|
|
321428
|
+
PHONE_MAX_WIDTH: () => PHONE_MAX_WIDTH,
|
|
321429
|
+
PHONE_MEDIA_QUERY: () => PHONE_MEDIA_QUERY,
|
|
321430
|
+
TABLET_MAX_WIDTH: () => TABLET_MAX_WIDTH,
|
|
321431
|
+
classify: () => classify,
|
|
321432
|
+
currentShell: () => currentShell,
|
|
321433
|
+
getCanvasSide: () => getCanvasSide,
|
|
321434
|
+
layoutMode: () => layoutMode,
|
|
321435
|
+
setCanvasSide: () => setCanvasSide,
|
|
321436
|
+
setLayoutMode: () => setLayoutMode,
|
|
321437
|
+
useCanvasSide: () => useCanvasSide,
|
|
321438
|
+
useLayoutMode: () => useLayoutMode,
|
|
321439
|
+
usePhone: () => usePhone,
|
|
321440
|
+
useShell: () => useShell
|
|
321441
|
+
});
|
|
321442
|
+
function classify(f2) {
|
|
321443
|
+
const narrowPhone = f2.width <= PHONE_MAX_WIDTH || f2.height <= PHONE_MAX_HEIGHT;
|
|
321444
|
+
const touchCompact = f2.coarse && f2.width <= COMPACT_TABLET_MAX_WIDTH;
|
|
321445
|
+
const autoPhone = narrowPhone || touchCompact;
|
|
321446
|
+
const phone = f2.mode === "phone" || f2.mode === "panes" || f2.mode === "auto" && autoPhone;
|
|
321447
|
+
const halfOpen = f2.hinge === "partial" && f2.fold !== "none";
|
|
321448
|
+
let formFactor;
|
|
321449
|
+
if (f2.mode === "desktop") formFactor = f2.coarse && !f2.hover ? "tablet" : "desktop";
|
|
321450
|
+
else if (phone) formFactor = "phone";
|
|
321451
|
+
else if (f2.width <= COMPACT_TABLET_MAX_WIDTH) formFactor = "compact-tablet";
|
|
321452
|
+
else if (f2.coarse && !f2.hover || f2.coarse && f2.width <= TABLET_MAX_WIDTH) formFactor = "tablet";
|
|
321453
|
+
else formFactor = "desktop";
|
|
321454
|
+
const isPhone = formFactor === "phone";
|
|
321455
|
+
const phoneSize = isPhone && f2.width > PHONE_MAX_WIDTH && f2.height > PHONE_MAX_HEIGHT ? "tablet" : "";
|
|
321456
|
+
const orient = !isPhone ? "" : phoneSize === "" && f2.width > f2.height && f2.height <= PHONE_MAX_HEIGHT ? "landscape" : "portrait";
|
|
321457
|
+
const panes = isPhone && (f2.mode === "panes" || halfOpen || f2.mode === "auto" && phoneSize === "tablet");
|
|
321458
|
+
const split2 = !panes ? "" : halfOpen ? f2.fold === "horizontal" ? "stacked" : "side" : f2.width > f2.height ? "side" : "stacked";
|
|
321459
|
+
return { formFactor, orient, phoneSize, panes, split: split2, hinge: f2.hinge, fold: f2.fold };
|
|
321460
|
+
}
|
|
321461
|
+
function readMode() {
|
|
321462
|
+
try {
|
|
321463
|
+
const v = localStorage.getItem(MODE_KEY);
|
|
321464
|
+
return v === "desktop" || v === "phone" || v === "panes" ? v : "auto";
|
|
321465
|
+
} catch {
|
|
321466
|
+
return "auto";
|
|
321467
|
+
}
|
|
321468
|
+
}
|
|
321469
|
+
function hingeAttr() {
|
|
321470
|
+
const v = document.documentElement.getAttribute("data-pc-hinge");
|
|
321471
|
+
return v === "closed" || v === "partial" || v === "open" ? v : "unknown";
|
|
321472
|
+
}
|
|
321473
|
+
function foldAttr() {
|
|
321474
|
+
const v = document.documentElement.getAttribute("data-pc-fold");
|
|
321475
|
+
return v === "vertical" || v === "horizontal" ? v : "none";
|
|
321476
|
+
}
|
|
321477
|
+
function publishWebSegments() {
|
|
321478
|
+
const vs = window.viewport;
|
|
321479
|
+
const segs = vs?.segments;
|
|
321480
|
+
if (!segs || document.documentElement.hasAttribute("data-pc-native-fold")) return;
|
|
321481
|
+
const d = document.documentElement;
|
|
321482
|
+
if (segs.length < 2) {
|
|
321483
|
+
if (d.getAttribute("data-pc-hinge") === "partial") {
|
|
321484
|
+
d.setAttribute("data-pc-hinge", "open");
|
|
321485
|
+
d.setAttribute("data-pc-fold", "none");
|
|
321486
|
+
}
|
|
321487
|
+
return;
|
|
321488
|
+
}
|
|
321489
|
+
const [a, b] = segs;
|
|
321490
|
+
const vertical = Math.abs(a.y - b.y) < 1;
|
|
321491
|
+
const x2 = vertical ? a.x + a.width : 0;
|
|
321492
|
+
const y = vertical ? 0 : a.y + a.height;
|
|
321493
|
+
const w = vertical ? b.x - x2 : window.innerWidth;
|
|
321494
|
+
const h = vertical ? window.innerHeight : b.y - y;
|
|
321495
|
+
d.setAttribute("data-pc-hinge", "partial");
|
|
321496
|
+
d.setAttribute("data-pc-fold", vertical ? "vertical" : "horizontal");
|
|
321497
|
+
d.style.setProperty("--pc-fold-x", `${Math.round(x2)}px`);
|
|
321498
|
+
d.style.setProperty("--pc-fold-y", `${Math.round(y)}px`);
|
|
321499
|
+
d.style.setProperty("--pc-fold-w", `${Math.round(w)}px`);
|
|
321500
|
+
d.style.setProperty("--pc-fold-h", `${Math.round(h)}px`);
|
|
321501
|
+
}
|
|
321502
|
+
function setAttr(el, name2, value3) {
|
|
321503
|
+
if (!value3) {
|
|
321504
|
+
if (el.hasAttribute(name2)) el.removeAttribute(name2);
|
|
321505
|
+
} else if (el.getAttribute(name2) !== value3) el.setAttribute(name2, value3);
|
|
321506
|
+
}
|
|
321507
|
+
function recompute() {
|
|
321508
|
+
publishWebSegments();
|
|
321509
|
+
const mm = (q) => window.matchMedia?.(q).matches ?? false;
|
|
321510
|
+
const touch = document.documentElement.hasAttribute("data-pc-touch");
|
|
321511
|
+
const next2 = classify({
|
|
321512
|
+
width: window.innerWidth,
|
|
321513
|
+
height: window.innerHeight,
|
|
321514
|
+
coarse: touch || mm("(pointer: coarse)"),
|
|
321515
|
+
hover: !touch && mm("(hover: hover)"),
|
|
321516
|
+
hinge: hingeAttr(),
|
|
321517
|
+
fold: foldAttr(),
|
|
321518
|
+
mode
|
|
321519
|
+
});
|
|
321520
|
+
const b = document.body;
|
|
321521
|
+
setAttr(b, "data-form-factor", next2.formFactor === "desktop" ? "" : next2.formFactor);
|
|
321522
|
+
setAttr(b, "data-phone-orient", next2.orient);
|
|
321523
|
+
setAttr(b, "data-phone-size", next2.phoneSize);
|
|
321524
|
+
setAttr(b, "data-panes", next2.panes ? next2.split : "");
|
|
321525
|
+
setAttr(b, "data-canvas-side", next2.panes && canvasSide === "bottom" ? "bottom" : "");
|
|
321526
|
+
if (JSON.stringify(next2) === JSON.stringify(current4)) return;
|
|
321527
|
+
current4 = next2;
|
|
321528
|
+
for (const l of listeners6) l();
|
|
321529
|
+
}
|
|
321530
|
+
function install() {
|
|
321531
|
+
if (installed || typeof window === "undefined") return;
|
|
321532
|
+
installed = true;
|
|
321533
|
+
mode = readMode();
|
|
321534
|
+
let raf = 0;
|
|
321535
|
+
const again = () => {
|
|
321536
|
+
cancelAnimationFrame(raf);
|
|
321537
|
+
raf = requestAnimationFrame(recompute);
|
|
321538
|
+
};
|
|
321539
|
+
window.addEventListener("resize", again);
|
|
321540
|
+
window.addEventListener("orientationchange", () => setTimeout(recompute, 50));
|
|
321541
|
+
window.matchMedia?.("(pointer: coarse)").addEventListener?.("change", again);
|
|
321542
|
+
window.matchMedia?.("(hover: hover)").addEventListener?.("change", again);
|
|
321543
|
+
window.addEventListener("pc-fold", again);
|
|
321544
|
+
new MutationObserver(again).observe(document.documentElement, { attributes: true, attributeFilter: ["data-pc-hinge", "data-pc-fold", "data-pc-touch"] });
|
|
321545
|
+
recompute();
|
|
321546
|
+
}
|
|
321547
|
+
function subscribe(l) {
|
|
321548
|
+
install();
|
|
321549
|
+
listeners6.add(l);
|
|
321550
|
+
return () => {
|
|
321551
|
+
listeners6.delete(l);
|
|
321552
|
+
};
|
|
321553
|
+
}
|
|
321554
|
+
function currentShell() {
|
|
321555
|
+
install();
|
|
321556
|
+
return current4;
|
|
321557
|
+
}
|
|
321558
|
+
function useShell(select) {
|
|
321559
|
+
return (0, import_react6.useSyncExternalStore)(subscribe, () => select(current4), () => select(SERVER));
|
|
321560
|
+
}
|
|
321561
|
+
function layoutMode() {
|
|
321562
|
+
install();
|
|
321563
|
+
return mode;
|
|
321564
|
+
}
|
|
321565
|
+
function useLayoutMode() {
|
|
321566
|
+
return (0, import_react6.useSyncExternalStore)(
|
|
321567
|
+
(l) => {
|
|
321568
|
+
install();
|
|
321569
|
+
modeListeners.add(l);
|
|
321570
|
+
return () => {
|
|
321571
|
+
modeListeners.delete(l);
|
|
321572
|
+
};
|
|
321573
|
+
},
|
|
321574
|
+
() => mode,
|
|
321575
|
+
() => "auto"
|
|
321576
|
+
);
|
|
321577
|
+
}
|
|
321578
|
+
function setLayoutMode(next2) {
|
|
321579
|
+
install();
|
|
321580
|
+
mode = next2;
|
|
321581
|
+
try {
|
|
321582
|
+
localStorage.setItem(MODE_KEY, next2);
|
|
321583
|
+
} catch {
|
|
321584
|
+
}
|
|
321585
|
+
for (const l of modeListeners) l();
|
|
321586
|
+
recompute();
|
|
321587
|
+
}
|
|
321588
|
+
function useCanvasSide() {
|
|
321589
|
+
return (0, import_react6.useSyncExternalStore)((l) => {
|
|
321590
|
+
sideListeners.add(l);
|
|
321591
|
+
return () => {
|
|
321592
|
+
sideListeners.delete(l);
|
|
321593
|
+
};
|
|
321594
|
+
}, () => canvasSide, () => "top");
|
|
321595
|
+
}
|
|
321596
|
+
function getCanvasSide() {
|
|
321597
|
+
return canvasSide;
|
|
321598
|
+
}
|
|
321599
|
+
function setCanvasSide(next2) {
|
|
321600
|
+
canvasSide = next2;
|
|
321601
|
+
try {
|
|
321602
|
+
localStorage.setItem(SIDE_KEY, next2);
|
|
321603
|
+
} catch {
|
|
321604
|
+
}
|
|
321605
|
+
for (const l of sideListeners) l();
|
|
321606
|
+
if (installed) {
|
|
321607
|
+
const b = document.body;
|
|
321608
|
+
setAttr(b, "data-canvas-side", current4.panes && next2 === "bottom" ? "bottom" : "");
|
|
321609
|
+
}
|
|
321610
|
+
}
|
|
321611
|
+
var import_react6, PHONE_MAX_WIDTH, PHONE_MAX_HEIGHT, COMPACT_TABLET_MAX_WIDTH, TABLET_MAX_WIDTH, PHONE_MEDIA_QUERY, MODE_KEY, mode, current4, listeners6, installed, SERVER, usePhone, modeListeners, SIDE_KEY, canvasSide, sideListeners;
|
|
321612
|
+
var init_form_factor = __esm({
|
|
321613
|
+
"lib/editor/form-factor.ts"() {
|
|
321614
|
+
"use client";
|
|
321615
|
+
import_react6 = __toESM(require_react());
|
|
321616
|
+
PHONE_MAX_WIDTH = 599;
|
|
321617
|
+
PHONE_MAX_HEIGHT = 499;
|
|
321618
|
+
COMPACT_TABLET_MAX_WIDTH = 959;
|
|
321619
|
+
TABLET_MAX_WIDTH = 1180;
|
|
321620
|
+
PHONE_MEDIA_QUERY = `(max-width: ${PHONE_MAX_WIDTH}px), (max-height: ${PHONE_MAX_HEIGHT}px), (max-width: ${COMPACT_TABLET_MAX_WIDTH}px) and (pointer: coarse)`;
|
|
321621
|
+
MODE_KEY = "popcraft-layout-mode";
|
|
321622
|
+
mode = "auto";
|
|
321623
|
+
current4 = { formFactor: "desktop", orient: "", phoneSize: "", panes: false, split: "", hinge: "unknown", fold: "none" };
|
|
321624
|
+
listeners6 = /* @__PURE__ */ new Set();
|
|
321625
|
+
installed = false;
|
|
321626
|
+
SERVER = { formFactor: "desktop", orient: "", phoneSize: "", panes: false, split: "", hinge: "unknown", fold: "none" };
|
|
321627
|
+
usePhone = () => useShell((s) => s.formFactor === "phone");
|
|
321628
|
+
modeListeners = /* @__PURE__ */ new Set();
|
|
321629
|
+
SIDE_KEY = "popcraft-canvas-side";
|
|
321630
|
+
canvasSide = "top";
|
|
321631
|
+
try {
|
|
321632
|
+
if (typeof localStorage !== "undefined" && localStorage.getItem(SIDE_KEY) === "bottom") canvasSide = "bottom";
|
|
321633
|
+
} catch {
|
|
321634
|
+
}
|
|
321635
|
+
sideListeners = /* @__PURE__ */ new Set();
|
|
321636
|
+
}
|
|
321637
|
+
});
|
|
321638
|
+
|
|
321340
321639
|
// lib/commands/view.ts
|
|
321341
321640
|
async function copyToClipboard(url4) {
|
|
321342
321641
|
try {
|
|
@@ -321345,7 +321644,7 @@ async function copyToClipboard(url4) {
|
|
|
321345
321644
|
if (typeof window !== "undefined") window.prompt("Copy this link:", url4);
|
|
321346
321645
|
}
|
|
321347
321646
|
}
|
|
321348
|
-
var viewGetSelection, viewSelect, viewZoomTo, viewStage, viewPresent, viewZoom, viewCopyLink;
|
|
321647
|
+
var viewGetSelection, viewSelect, viewZoomTo, viewStage, viewScreenLayout, viewPresent, viewZoom, viewCopyLink;
|
|
321349
321648
|
var init_view2 = __esm({
|
|
321350
321649
|
"lib/commands/view.ts"() {
|
|
321351
321650
|
"use strict";
|
|
@@ -321501,6 +321800,36 @@ var init_view2 = __esm({
|
|
|
321501
321800
|
return { summary: on ? "Stage view on: showing only the active frame" : "Stage view off: showing the whole page", data: { on } };
|
|
321502
321801
|
}
|
|
321503
321802
|
});
|
|
321803
|
+
viewScreenLayout = defineCommand({
|
|
321804
|
+
id: "view.screenLayout",
|
|
321805
|
+
title: "Screen layout",
|
|
321806
|
+
domain: "view",
|
|
321807
|
+
effect: "view",
|
|
321808
|
+
permission: "read",
|
|
321809
|
+
params: external_exports.object({
|
|
321810
|
+
layout: external_exports.enum(["auto", "phone", "panes", "desktop"]).optional().describe('"auto" fits the screen; "phone" one page at a time; "panes" the canvas beside the panels; "desktop" the full workbench.'),
|
|
321811
|
+
canvas: external_exports.enum(["top", "bottom", "flip"]).optional().describe('In two panes, which pane holds the canvas; "flip" swaps it.')
|
|
321812
|
+
}),
|
|
321813
|
+
expose: {
|
|
321814
|
+
ui: {
|
|
321815
|
+
label: "Flip canvas and panels",
|
|
321816
|
+
keywords: ["flip", "swap", "canvas bottom", "canvas top", "fold", "foldable", "tabletop", "panes", "layout", "phone", "tablet"],
|
|
321817
|
+
defaults: { canvas: "flip" }
|
|
321818
|
+
},
|
|
321819
|
+
agent: {
|
|
321820
|
+
name: "set_screen_layout",
|
|
321821
|
+
description: 'Change how the editor lays itself out on this device: layout "auto" (fit the screen), "phone" (one page at a time with a dock), "panes" (canvas beside the panels) or "desktop"; and canvas "top", "bottom" or "flip" to choose which of the two panes holds the canvas. Changes nothing in the document.'
|
|
321822
|
+
}
|
|
321823
|
+
},
|
|
321824
|
+
run: async (args2) => {
|
|
321825
|
+
if (typeof window === "undefined") throw new ToolError("The screen layout is only available in the editor.");
|
|
321826
|
+
const ff = await Promise.resolve().then(() => (init_form_factor(), form_factor_exports));
|
|
321827
|
+
if (args2.layout) ff.setLayoutMode(args2.layout);
|
|
321828
|
+
if (args2.canvas) ff.setCanvasSide(args2.canvas === "flip" ? ff.getCanvasSide() === "top" ? "bottom" : "top" : args2.canvas);
|
|
321829
|
+
const side = ff.getCanvasSide();
|
|
321830
|
+
return { summary: `Screen layout ${ff.layoutMode()}, canvas on the ${side}`, data: { layout: ff.layoutMode(), canvas: side } };
|
|
321831
|
+
}
|
|
321832
|
+
});
|
|
321504
321833
|
viewPresent = defineCommand({
|
|
321505
321834
|
id: "view.present",
|
|
321506
321835
|
title: "Present",
|
|
@@ -323664,9 +323993,9 @@ function siteTokens(doc2) {
|
|
|
323664
323993
|
const vars = [];
|
|
323665
323994
|
for (const v of Object.values(doc2.variables ?? {}).sort((a, b) => a.name.localeCompare(b.name) || a.id.localeCompare(b.id))) {
|
|
323666
323995
|
const values3 = {};
|
|
323667
|
-
for (const [
|
|
323996
|
+
for (const [mode2, value3] of Object.entries(v.valuesByMode ?? {})) {
|
|
323668
323997
|
const css = cssValue(v, value3);
|
|
323669
|
-
if (css !== null) values3[
|
|
323998
|
+
if (css !== null) values3[mode2] = css;
|
|
323670
323999
|
}
|
|
323671
324000
|
if (!Object.keys(values3).length) continue;
|
|
323672
324001
|
let name2 = codeSyntaxFor(v, "WEB");
|
|
@@ -323735,7 +324064,7 @@ var init_tokens2 = __esm({
|
|
|
323735
324064
|
init_dev_mode();
|
|
323736
324065
|
init_paint2();
|
|
323737
324066
|
slug = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "x";
|
|
323738
|
-
modeClass = (collection,
|
|
324067
|
+
modeClass = (collection, mode2) => `pc-${slug(collection.name)}-${slug(mode2.name)}`;
|
|
323739
324068
|
isColor3 = (v) => !!v && typeof v === "object" && "r" in v && "g" in v && "b" in v;
|
|
323740
324069
|
px3 = (name2) => `calc(var(${name2}) * 1px)`;
|
|
323741
324070
|
NUMBER_PROPS = {
|
|
@@ -325552,7 +325881,7 @@ function stateMachineFromDotLottie(input2, id3 = "sm1", name2 = "State machine")
|
|
|
325552
325881
|
transitions[tid] = { id: tid, from: from2, to, ...guards.length ? { guards } : {} };
|
|
325553
325882
|
}
|
|
325554
325883
|
}
|
|
325555
|
-
const
|
|
325884
|
+
const listeners9 = {};
|
|
325556
325885
|
let completeSeen = false;
|
|
325557
325886
|
for (const it of list2(raw.interactions)) {
|
|
325558
325887
|
const type = DOT_INTERACTIONS[String(it.type)];
|
|
@@ -325567,12 +325896,12 @@ function stateMachineFromDotLottie(input2, id3 = "sm1", name2 = "State machine")
|
|
|
325567
325896
|
}
|
|
325568
325897
|
const layer2 = typeof it.layerName === "string" ? input2.nodeByName(it.layerName) : void 0;
|
|
325569
325898
|
if (typeof it.layerName === "string" && !layer2) notes.add(`The layer \u201C${it.layerName}\u201D an interaction listens on was not found: it listens on the whole frame.`);
|
|
325570
|
-
const lid = freshId3(
|
|
325571
|
-
|
|
325899
|
+
const lid = freshId3(listeners9, "l");
|
|
325900
|
+
listeners9[lid] = { id: lid, type, ...layer2 ? { layer: layer2 } : {}, actions: actions(it.actions) };
|
|
325572
325901
|
}
|
|
325573
325902
|
const initial = typeof raw.initial === "string" ? stateByName.get(raw.initial) : void 0;
|
|
325574
325903
|
return {
|
|
325575
|
-
machine: { id: id3, name: name2, initial: initial ?? Object.keys(states)[0], states, transitions, inputs, listeners:
|
|
325904
|
+
machine: { id: id3, name: name2, initial: initial ?? Object.keys(states)[0], states, transitions, inputs, listeners: listeners9 },
|
|
325576
325905
|
notes: [...notes]
|
|
325577
325906
|
};
|
|
325578
325907
|
}
|
|
@@ -328147,7 +328476,7 @@ var init_package = __esm({
|
|
|
328147
328476
|
"packages/runtime/package.json"() {
|
|
328148
328477
|
package_default = {
|
|
328149
328478
|
name: "@popcraft/runtime",
|
|
328150
|
-
version: "0.
|
|
328479
|
+
version: "0.49.0",
|
|
328151
328480
|
description: "What code exported from PopCraft shares: the meaning of expressions (operators and functions) and, as it grows, the parts of a design's behaviour that are common code rather than generated React.",
|
|
328152
328481
|
license: "MIT",
|
|
328153
328482
|
homepage: "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -343357,8 +343686,8 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
343357
343686
|
function getColumnIndex(line, genColumn) {
|
|
343358
343687
|
let index2 = line.length;
|
|
343359
343688
|
for (let i2 = index2 - 1; i2 >= 0; index2 = i2--) {
|
|
343360
|
-
const
|
|
343361
|
-
if (genColumn >=
|
|
343689
|
+
const current5 = line[i2];
|
|
343690
|
+
if (genColumn >= current5[COLUMN]) break;
|
|
343362
343691
|
}
|
|
343363
343692
|
return index2;
|
|
343364
343693
|
}
|
|
@@ -353589,23 +353918,23 @@ async function previewSite(doc2, pageId2, resolvers, media2 = mediaToDataUrl) {
|
|
|
353589
353918
|
return withSiteCode(site, doc2);
|
|
353590
353919
|
}
|
|
353591
353920
|
function startPreview(iframe, player, onMessage2, opts = {}) {
|
|
353592
|
-
const
|
|
353921
|
+
const channel4 = new MessageChannel();
|
|
353593
353922
|
let ready3 = false;
|
|
353594
353923
|
let queue2 = [];
|
|
353595
|
-
|
|
353924
|
+
channel4.port1.onmessage = (e) => {
|
|
353596
353925
|
const m = parseFromFrame(e.data);
|
|
353597
353926
|
if (!m) return;
|
|
353598
353927
|
if (m.type === "ready") {
|
|
353599
353928
|
ready3 = true;
|
|
353600
|
-
for (const q of queue2)
|
|
353929
|
+
for (const q of queue2) channel4.port1.postMessage(q);
|
|
353601
353930
|
queue2 = [];
|
|
353602
353931
|
}
|
|
353603
353932
|
if (m.type === "needCode") {
|
|
353604
|
-
void codeScript().then((js) =>
|
|
353933
|
+
void codeScript().then((js) => channel4.port1.postMessage({ type: "code", js }));
|
|
353605
353934
|
return;
|
|
353606
353935
|
}
|
|
353607
353936
|
if (m.type === "needIsland") {
|
|
353608
|
-
void islandScript().then((js) =>
|
|
353937
|
+
void islandScript().then((js) => channel4.port1.postMessage({ type: "island", js }));
|
|
353609
353938
|
return;
|
|
353610
353939
|
}
|
|
353611
353940
|
onMessage2(m);
|
|
@@ -353613,19 +353942,19 @@ function startPreview(iframe, player, onMessage2, opts = {}) {
|
|
|
353613
353942
|
const onHello = (e) => {
|
|
353614
353943
|
if (e.data !== HELLO_MESSAGE || e.source !== iframe.contentWindow) return;
|
|
353615
353944
|
window.removeEventListener("message", onHello);
|
|
353616
|
-
iframe.contentWindow?.postMessage(PORT_MESSAGE, "*", [
|
|
353945
|
+
iframe.contentWindow?.postMessage(PORT_MESSAGE, "*", [channel4.port2]);
|
|
353617
353946
|
};
|
|
353618
353947
|
window.addEventListener("message", onHello);
|
|
353619
353948
|
iframe.setAttribute("sandbox", "allow-scripts");
|
|
353620
353949
|
iframe.srcdoc = previewDocument(player, opts.cdn);
|
|
353621
353950
|
return {
|
|
353622
353951
|
send(message) {
|
|
353623
|
-
if (ready3)
|
|
353952
|
+
if (ready3) channel4.port1.postMessage(message);
|
|
353624
353953
|
else queue2.push(message);
|
|
353625
353954
|
},
|
|
353626
353955
|
destroy() {
|
|
353627
353956
|
window.removeEventListener("message", onHello);
|
|
353628
|
-
|
|
353957
|
+
channel4.port1.close();
|
|
353629
353958
|
iframe.removeAttribute("srcdoc");
|
|
353630
353959
|
}
|
|
353631
353960
|
};
|
|
@@ -353904,7 +354233,7 @@ function base644(bytes2) {
|
|
|
353904
354233
|
for (let i2 = 0; i2 < bytes2.length; i2 += 32768) bin += String.fromCharCode(...bytes2.subarray(i2, i2 + 32768));
|
|
353905
354234
|
return btoa(bin);
|
|
353906
354235
|
}
|
|
353907
|
-
async function webFontFaces(doc2, trees,
|
|
354236
|
+
async function webFontFaces(doc2, trees, mode2, dir = "fonts") {
|
|
353908
354237
|
const used = new Set(trees.flatMap((t3) => [...fontFamilies(t3).keys()]));
|
|
353909
354238
|
const faces2 = [];
|
|
353910
354239
|
const files = [];
|
|
@@ -353919,7 +354248,7 @@ async function webFontFaces(doc2, trees, mode, dir = "fonts") {
|
|
|
353919
354248
|
const own2 = fontFormat(bytes2) ?? format;
|
|
353920
354249
|
const weight = fontWeightOf(f2), style = fontStyleOf(f2);
|
|
353921
354250
|
let url4;
|
|
353922
|
-
if (
|
|
354251
|
+
if (mode2 === "files") {
|
|
353923
354252
|
const name2 = `${dir}/${slug3(f2.family)}-${weight}${style === "italic" ? "-italic" : ""}.${EXT2[own2]}`;
|
|
353924
354253
|
if (!files.some((x2) => x2.name === name2)) files.push({ name: name2, bytes: bytes2 });
|
|
353925
354254
|
url4 = name2;
|
|
@@ -355679,9 +356008,9 @@ var init_meta = __esm({
|
|
|
355679
356008
|
throw new ToolError("Only one todo may be in_progress at a time.");
|
|
355680
356009
|
}
|
|
355681
356010
|
const done = todos.filter((t3) => t3.status === "done").length;
|
|
355682
|
-
const
|
|
356011
|
+
const current5 = todos.find((t3) => t3.status === "in_progress");
|
|
355683
356012
|
return {
|
|
355684
|
-
summary: todos.length ? `${done}/${todos.length} done${
|
|
356013
|
+
summary: todos.length ? `${done}/${todos.length} done${current5 ? ` \u2014 ${current5.title}` : ""}` : "Cleared the plan",
|
|
355685
356014
|
data: { todos }
|
|
355686
356015
|
};
|
|
355687
356016
|
}
|
|
@@ -355811,14 +356140,14 @@ var init_meta = __esm({
|
|
|
355811
356140
|
});
|
|
355812
356141
|
|
|
355813
356142
|
// lib/ai/schemas.ts
|
|
355814
|
-
var DESIGN_NODE_TYPES, DESIGN_FONTS,
|
|
356143
|
+
var DESIGN_NODE_TYPES, DESIGN_FONTS, layoutMode2, align2, counterAlign, sizing, boxProps, frameLayoutProps, designNodeSchema, designScreenSchema, designSchema, contentSchema, layoutSuggestionSchema, generateRequestSchema, contentRequestSchema, layoutRequestSchema, embedRequestSchema;
|
|
355815
356144
|
var init_schemas3 = __esm({
|
|
355816
356145
|
"lib/ai/schemas.ts"() {
|
|
355817
356146
|
"use strict";
|
|
355818
356147
|
init_zod();
|
|
355819
356148
|
DESIGN_NODE_TYPES = ["FRAME", "TEXT", "RECTANGLE", "ELLIPSE", "LINE"];
|
|
355820
356149
|
DESIGN_FONTS = ["Inter", "Source Serif 4", "JetBrains Mono"];
|
|
355821
|
-
|
|
356150
|
+
layoutMode2 = external_exports.enum(["NONE", "HORIZONTAL", "VERTICAL"]);
|
|
355822
356151
|
align2 = external_exports.enum(["MIN", "CENTER", "MAX", "SPACE_BETWEEN"]);
|
|
355823
356152
|
counterAlign = external_exports.enum(["MIN", "CENTER", "MAX"]);
|
|
355824
356153
|
sizing = external_exports.enum(["FIXED", "HUG", "FILL"]);
|
|
@@ -355837,7 +356166,7 @@ var init_schemas3 = __esm({
|
|
|
355837
356166
|
heightSizing: sizing.nullable()
|
|
355838
356167
|
};
|
|
355839
356168
|
frameLayoutProps = {
|
|
355840
|
-
layout:
|
|
356169
|
+
layout: layoutMode2.nullable().describe("Auto layout direction; prefer VERTICAL/HORIZONTAL for real UI"),
|
|
355841
356170
|
gap: external_exports.number().nullable().describe("Spacing between children in px"),
|
|
355842
356171
|
padding: external_exports.array(external_exports.number()).nullable().describe("[top, right, bottom, left] px"),
|
|
355843
356172
|
primaryAlign: align2.nullable(),
|
|
@@ -356292,14 +356621,14 @@ async function generateDesignIntoPage(opts, signal) {
|
|
|
356292
356621
|
st.zoomToSelection();
|
|
356293
356622
|
return rootIds.length;
|
|
356294
356623
|
}
|
|
356295
|
-
function openSearchItem(item,
|
|
356624
|
+
function openSearchItem(item, mode2 = item.kind === "component" ? "insert" : "select") {
|
|
356296
356625
|
const st = editor();
|
|
356297
356626
|
const node2 = st.document.nodes[item.id];
|
|
356298
356627
|
if (item.kind === "style" || item.kind === "variable" || !node2) {
|
|
356299
356628
|
notice2(`${item.detail}: ${item.name}`);
|
|
356300
356629
|
return;
|
|
356301
356630
|
}
|
|
356302
|
-
if (
|
|
356631
|
+
if (mode2 === "insert" && (node2.type === "COMPONENT" || node2.type === "COMPONENT_SET")) {
|
|
356303
356632
|
guardEditable();
|
|
356304
356633
|
const main2 = node2.type === "COMPONENT_SET" ? st.document.nodes[node2.childIds.find((c2) => st.document.nodes[c2]?.type === "COMPONENT") ?? ""] : node2;
|
|
356305
356634
|
if (!main2) return;
|
|
@@ -359090,9 +359419,9 @@ function applyOp(frame3, sm, op4) {
|
|
|
359090
359419
|
}
|
|
359091
359420
|
case "removeListener": {
|
|
359092
359421
|
if (!sm.listeners[op4.listener]) throw new ToolError(`The machine has no listener "${op4.listener}".`);
|
|
359093
|
-
const { [op4.listener]: _gone, ...
|
|
359422
|
+
const { [op4.listener]: _gone, ...listeners9 } = sm.listeners;
|
|
359094
359423
|
void _gone;
|
|
359095
|
-
return { next: { ...sm, listeners:
|
|
359424
|
+
return { next: { ...sm, listeners: listeners9 } };
|
|
359096
359425
|
}
|
|
359097
359426
|
}
|
|
359098
359427
|
}
|
|
@@ -361899,7 +362228,6 @@ var init_delete_current_file = __esm({
|
|
|
361899
362228
|
var storeOpsSeam;
|
|
361900
362229
|
var init_seams = __esm({
|
|
361901
362230
|
"lib/commands/seams.ts"() {
|
|
361902
|
-
"use strict";
|
|
361903
362231
|
storeOpsSeam = (st) => ({
|
|
361904
362232
|
booleanOperation: (op4) => st().booleanOperation(op4),
|
|
361905
362233
|
flatten: () => st().flattenSelection(),
|
|
@@ -362213,7 +362541,7 @@ function closeAudienceWindow() {
|
|
|
362213
362541
|
} catch {
|
|
362214
362542
|
}
|
|
362215
362543
|
}
|
|
362216
|
-
var CLOSED, status2,
|
|
362544
|
+
var CLOSED, status2, listeners7, emit3, audienceStatus, AUDIENCE_MESSAGES, audienceAvailable, session, NAME2, CANVAS_USAGE;
|
|
362217
362545
|
var init_audience_window = __esm({
|
|
362218
362546
|
"lib/slides/audience/audience-window.ts"() {
|
|
362219
362547
|
init_renderer_registry();
|
|
@@ -362223,10 +362551,10 @@ var init_audience_window = __esm({
|
|
|
362223
362551
|
init_resolution();
|
|
362224
362552
|
CLOSED = { open: false, resolution: null, surface: { width: 0, height: 0 }, capture: { width: 0, height: 0 }, atResolution: true };
|
|
362225
362553
|
status2 = CLOSED;
|
|
362226
|
-
|
|
362554
|
+
listeners7 = /* @__PURE__ */ new Set();
|
|
362227
362555
|
emit3 = (next2) => {
|
|
362228
362556
|
status2 = next2;
|
|
362229
|
-
for (const l of
|
|
362557
|
+
for (const l of listeners7) l();
|
|
362230
362558
|
};
|
|
362231
362559
|
audienceStatus = () => status2;
|
|
362232
362560
|
AUDIENCE_MESSAGES = {
|
|
@@ -362703,7 +363031,7 @@ var init_schema = __esm({
|
|
|
362703
363031
|
// lib/theme/sync.ts
|
|
362704
363032
|
function themeChannel() {
|
|
362705
363033
|
if (typeof BroadcastChannel === "undefined") return null;
|
|
362706
|
-
return
|
|
363034
|
+
return channel3 ??= new BroadcastChannel(CHANNEL3);
|
|
362707
363035
|
}
|
|
362708
363036
|
function announceThemeChange() {
|
|
362709
363037
|
if (typeof window === "undefined") return;
|
|
@@ -362716,13 +363044,13 @@ function announceThemeChange() {
|
|
|
362716
363044
|
} catch {
|
|
362717
363045
|
}
|
|
362718
363046
|
}
|
|
362719
|
-
var
|
|
363047
|
+
var CHANNEL3, THEME_REV_KEY, channel3;
|
|
362720
363048
|
var init_sync3 = __esm({
|
|
362721
363049
|
"lib/theme/sync.ts"() {
|
|
362722
363050
|
"use strict";
|
|
362723
|
-
|
|
363051
|
+
CHANNEL3 = "popcraft-theme";
|
|
362724
363052
|
THEME_REV_KEY = "popcraft-theme-rev";
|
|
362725
|
-
|
|
363053
|
+
channel3 = null;
|
|
362726
363054
|
}
|
|
362727
363055
|
});
|
|
362728
363056
|
|
|
@@ -362883,15 +363211,15 @@ function usePickableThemes() {
|
|
|
362883
363211
|
const userThemes = useThemeStore((s) => s.userThemes);
|
|
362884
363212
|
const pluginThemes = useThemeStore((s) => s.pluginThemes);
|
|
362885
363213
|
const localThemes = useThemeStore((s) => s.localThemes);
|
|
362886
|
-
return (0,
|
|
363214
|
+
return (0, import_react11.useMemo)(() => pickableThemes({ userThemes, pluginThemes, localThemes }), [userThemes, pluginThemes, localThemes]);
|
|
362887
363215
|
}
|
|
362888
|
-
var
|
|
363216
|
+
var import_react11, IDB_KEY, useThemeStore, cssString2, defaultAccent, effectiveAccent;
|
|
362889
363217
|
var init_theme_store = __esm({
|
|
362890
363218
|
"lib/theme/theme-store.ts"() {
|
|
362891
363219
|
init_contrast();
|
|
362892
363220
|
init_idb();
|
|
362893
363221
|
init_esm();
|
|
362894
|
-
|
|
363222
|
+
import_react11 = __toESM(require_react());
|
|
362895
363223
|
init_boot2();
|
|
362896
363224
|
init_builtin();
|
|
362897
363225
|
init_resolve();
|
|
@@ -365876,7 +366204,7 @@ function createAgentRuntime(host) {
|
|
|
365876
366204
|
let loading3 = null;
|
|
365877
366205
|
let active3 = 0;
|
|
365878
366206
|
let waiting3 = [];
|
|
365879
|
-
let
|
|
366207
|
+
let listeners9 = [];
|
|
365880
366208
|
let pendingSaves = 0;
|
|
365881
366209
|
let maxConcurrent = ((__v) => __v == null ? "null" : typeof __v)(host.maxConcurrent) === "number" ? host.maxConcurrent : 4;
|
|
365882
366210
|
let now2 = () => {
|
|
@@ -365889,7 +366217,7 @@ function createAgentRuntime(host) {
|
|
|
365889
366217
|
if (((__v) => __v == null ? "null" : typeof __v)(host.onChange) === "function") {
|
|
365890
366218
|
host.onChange() ?? null;
|
|
365891
366219
|
}
|
|
365892
|
-
for (const l of
|
|
366220
|
+
for (const l of listeners9.slice() ?? null) {
|
|
365893
366221
|
l() ?? null;
|
|
365894
366222
|
}
|
|
365895
366223
|
}
|
|
@@ -366164,12 +366492,12 @@ function createAgentRuntime(host) {
|
|
|
366164
366492
|
}
|
|
366165
366493
|
}, subscribe: (l) => {
|
|
366166
366494
|
{
|
|
366167
|
-
|
|
366495
|
+
listeners9.push(l) ?? null;
|
|
366168
366496
|
return () => {
|
|
366169
366497
|
{
|
|
366170
|
-
let i2 =
|
|
366498
|
+
let i2 = listeners9.indexOf(l) ?? null;
|
|
366171
366499
|
if (i2 >= 0) {
|
|
366172
|
-
|
|
366500
|
+
listeners9.splice(i2, 1) ?? null;
|
|
366173
366501
|
}
|
|
366174
366502
|
}
|
|
366175
366503
|
};
|
|
@@ -366515,8 +366843,8 @@ function indexedDbStore(name2 = "hypery-agents") {
|
|
|
366515
366843
|
req.onsuccess = () => res(req.result);
|
|
366516
366844
|
req.onerror = () => rej(req.error);
|
|
366517
366845
|
}));
|
|
366518
|
-
const tx2 = async (
|
|
366519
|
-
const store6 = (await open4()).transaction("kv",
|
|
366846
|
+
const tx2 = async (mode2, fn) => {
|
|
366847
|
+
const store6 = (await open4()).transaction("kv", mode2).objectStore("kv");
|
|
366520
366848
|
return new Promise((res, rej) => {
|
|
366521
366849
|
const r = fn(store6);
|
|
366522
366850
|
r.onsuccess = () => res(r.result);
|
|
@@ -367717,8 +368045,8 @@ async function reviewUpdate(update3) {
|
|
|
367717
368045
|
}
|
|
367718
368046
|
function acceptUpdate(update3, payload, accept) {
|
|
367719
368047
|
const lib = useLibraries.getState().available.find((l) => l.id === update3.libraryId);
|
|
367720
|
-
const
|
|
367721
|
-
const doc2 = applyLibrary(liveDoc(), update3.libraryId, { name: update3.name, version: update3.to, fileKey: lib?.fileKey ??
|
|
368048
|
+
const current5 = liveDoc().libraries?.[update3.libraryId];
|
|
368049
|
+
const doc2 = applyLibrary(liveDoc(), update3.libraryId, { name: update3.name, version: update3.to, fileKey: lib?.fileKey ?? current5?.fileKey ?? void 0, importedAt: Date.now() }, payload, accept);
|
|
367722
368050
|
useEditorStore.getState().commitDocument(doc2, `Update library: ${update3.name}`);
|
|
367723
368051
|
computeUpdates();
|
|
367724
368052
|
}
|
|
@@ -368802,8 +369130,8 @@ var init_registry3 = __esm({
|
|
|
368802
369130
|
});
|
|
368803
369131
|
|
|
368804
369132
|
// lib/plugins/panels.ts
|
|
368805
|
-
function pluginPanels(
|
|
368806
|
-
return
|
|
369133
|
+
function pluginPanels(installed4) {
|
|
369134
|
+
return installed4.filter((p2) => p2.enabled).flatMap((p2) => (p2.manifest.contributes?.panels ?? []).map((panel) => ({
|
|
368807
369135
|
tab: pluginPanelTab(p2.manifest.id, panel.id),
|
|
368808
369136
|
pluginId: p2.manifest.id,
|
|
368809
369137
|
pluginName: p2.manifest.name,
|
|
@@ -368811,8 +369139,8 @@ function pluginPanels(installed3) {
|
|
|
368811
369139
|
icon: panel.icon ?? (p2.manifest.icon?.startsWith("data:image/") ? p2.manifest.icon : null)
|
|
368812
369140
|
})));
|
|
368813
369141
|
}
|
|
368814
|
-
function syncPluginTabs(
|
|
368815
|
-
setPluginTabs(new Map(pluginPanels(
|
|
369142
|
+
function syncPluginTabs(installed4) {
|
|
369143
|
+
setPluginTabs(new Map(pluginPanels(installed4).map((p2) => [p2.tab, p2.panel.side ?? "right"])));
|
|
368816
369144
|
}
|
|
368817
369145
|
var pluginPanelTab;
|
|
368818
369146
|
var init_panels = __esm({
|
|
@@ -368870,10 +369198,10 @@ function pluginToolCommand(plugin, tool2) {
|
|
|
368870
369198
|
}
|
|
368871
369199
|
});
|
|
368872
369200
|
}
|
|
368873
|
-
function syncPluginAgentTools(
|
|
369201
|
+
function syncPluginAgentTools(installed4) {
|
|
368874
369202
|
const want = /* @__PURE__ */ new Map();
|
|
368875
369203
|
const nextSources = /* @__PURE__ */ new Map();
|
|
368876
|
-
for (const plugin of
|
|
369204
|
+
for (const plugin of installed4) {
|
|
368877
369205
|
if (!pluginToolsActive(plugin)) continue;
|
|
368878
369206
|
for (const tool2 of plugin.manifest.contributes.agentTools) {
|
|
368879
369207
|
try {
|
|
@@ -373749,7 +374077,7 @@ var init_pdf2 = __esm({
|
|
|
373749
374077
|
get signatureManager() {
|
|
373750
374078
|
return this.#signatureManager;
|
|
373751
374079
|
}
|
|
373752
|
-
switchToMode(
|
|
374080
|
+
switchToMode(mode2, callback) {
|
|
373753
374081
|
this._eventBus.on("annotationeditormodechanged", callback, {
|
|
373754
374082
|
once: true,
|
|
373755
374083
|
signal: this._signal,
|
|
@@ -373757,7 +374085,7 @@ var init_pdf2 = __esm({
|
|
|
373757
374085
|
});
|
|
373758
374086
|
this._eventBus.dispatch("showannotationeditorui", {
|
|
373759
374087
|
source: this,
|
|
373760
|
-
mode
|
|
374088
|
+
mode: mode2
|
|
373761
374089
|
});
|
|
373762
374090
|
}
|
|
373763
374091
|
setPreference(name2, value3) {
|
|
@@ -374409,8 +374737,8 @@ var init_pdf2 = __esm({
|
|
|
374409
374737
|
removeLayer(layer2) {
|
|
374410
374738
|
this.#allLayers.delete(layer2.pageIndex);
|
|
374411
374739
|
}
|
|
374412
|
-
async updateMode(
|
|
374413
|
-
if (this.#mode ===
|
|
374740
|
+
async updateMode(mode2, editId = null, isFromUser = false, isFromKeyboard = false, mustEnterInEditMode = false, editComment = false) {
|
|
374741
|
+
if (this.#mode === mode2) {
|
|
374414
374742
|
return;
|
|
374415
374743
|
}
|
|
374416
374744
|
if (this.#updateModeCapability) {
|
|
@@ -374425,8 +374753,8 @@ var init_pdf2 = __esm({
|
|
|
374425
374753
|
this.#commentManager?.hideSidebar();
|
|
374426
374754
|
}
|
|
374427
374755
|
this.#commentManager?.destroyPopup();
|
|
374428
|
-
this.#mode =
|
|
374429
|
-
if (
|
|
374756
|
+
this.#mode = mode2;
|
|
374757
|
+
if (mode2 === AnnotationEditorType.NONE) {
|
|
374430
374758
|
this.setEditingState(false);
|
|
374431
374759
|
this.#disableAll();
|
|
374432
374760
|
for (const editor2 of this.#allEditors.values()) {
|
|
@@ -374440,7 +374768,7 @@ var init_pdf2 = __esm({
|
|
|
374440
374768
|
for (const editor2 of this.#allEditors.values()) {
|
|
374441
374769
|
editor2.addStandaloneCommentButton();
|
|
374442
374770
|
}
|
|
374443
|
-
if (
|
|
374771
|
+
if (mode2 === AnnotationEditorType.SIGNATURE) {
|
|
374444
374772
|
await this.#signatureManager?.loadSignatures();
|
|
374445
374773
|
}
|
|
374446
374774
|
if (isFromUser) {
|
|
@@ -374450,9 +374778,9 @@ var init_pdf2 = __esm({
|
|
|
374450
374778
|
await this.#enableAll();
|
|
374451
374779
|
this.unselectAll();
|
|
374452
374780
|
for (const layer2 of this.#allLayers.values()) {
|
|
374453
|
-
layer2.updateMode(
|
|
374781
|
+
layer2.updateMode(mode2);
|
|
374454
374782
|
}
|
|
374455
|
-
if (
|
|
374783
|
+
if (mode2 === AnnotationEditorType.POPUP) {
|
|
374456
374784
|
this.#allEditableAnnotations ||= await this.#pdfDocument.getAnnotationsByType(new Set(this.#editorTypes.map((editorClass) => editorClass._editorType)));
|
|
374457
374785
|
const elementIds = /* @__PURE__ */ new Set();
|
|
374458
374786
|
const allComments = [];
|
|
@@ -380946,20 +381274,20 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
380946
381274
|
graphics.current.updateClipFromPath();
|
|
380947
381275
|
}
|
|
380948
381276
|
setFillAndStrokeStyleToContext(graphics, paintType, color4) {
|
|
380949
|
-
const context = graphics.ctx,
|
|
380950
|
-
|
|
381277
|
+
const context = graphics.ctx, current5 = graphics.current;
|
|
381278
|
+
current5.patternFill = current5.patternStroke = false;
|
|
380951
381279
|
switch (paintType) {
|
|
380952
381280
|
case PaintType.COLORED:
|
|
380953
381281
|
const {
|
|
380954
381282
|
fillStyle,
|
|
380955
381283
|
strokeStyle
|
|
380956
381284
|
} = this.ctx;
|
|
380957
|
-
context.fillStyle =
|
|
380958
|
-
context.strokeStyle =
|
|
381285
|
+
context.fillStyle = current5.fillColor = fillStyle;
|
|
381286
|
+
context.strokeStyle = current5.strokeColor = strokeStyle;
|
|
380959
381287
|
break;
|
|
380960
381288
|
case PaintType.UNCOLORED:
|
|
380961
381289
|
context.fillStyle = context.strokeStyle = color4;
|
|
380962
|
-
|
|
381290
|
+
current5.fillColor = current5.strokeColor = color4;
|
|
380963
381291
|
break;
|
|
380964
381292
|
default:
|
|
380965
381293
|
throw new FormatError2(`Unsupported paint type: ${paintType}`);
|
|
@@ -382196,19 +382524,19 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382196
382524
|
setFont(opIdx, fontRefName, size6) {
|
|
382197
382525
|
this.dependencyTracker?.recordSimpleData("font", opIdx).recordSimpleDataFromNamed("fontObj", fontRefName, opIdx);
|
|
382198
382526
|
const fontObj = this.commonObjs.get(fontRefName);
|
|
382199
|
-
const
|
|
382527
|
+
const current5 = this.current;
|
|
382200
382528
|
if (!fontObj) {
|
|
382201
382529
|
throw new Error(`Can't find font for ${fontRefName}`);
|
|
382202
382530
|
}
|
|
382203
|
-
|
|
382204
|
-
if (
|
|
382531
|
+
current5.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;
|
|
382532
|
+
if (current5.fontMatrix[0] === 0 || current5.fontMatrix[3] === 0) {
|
|
382205
382533
|
warn3("Invalid font matrix for font " + fontRefName);
|
|
382206
382534
|
}
|
|
382207
382535
|
if (size6 < 0) {
|
|
382208
382536
|
size6 = -size6;
|
|
382209
|
-
|
|
382537
|
+
current5.fontDirection = -1;
|
|
382210
382538
|
} else {
|
|
382211
|
-
|
|
382539
|
+
current5.fontDirection = 1;
|
|
382212
382540
|
}
|
|
382213
382541
|
this.current.font = fontObj;
|
|
382214
382542
|
this.current.fontSize = size6;
|
|
@@ -382228,9 +382556,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382228
382556
|
this.current.fontSizeScale = size6 / browserFontSize;
|
|
382229
382557
|
this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
|
|
382230
382558
|
}
|
|
382231
|
-
setTextRenderingMode(opIdx,
|
|
382559
|
+
setTextRenderingMode(opIdx, mode2) {
|
|
382232
382560
|
this.dependencyTracker?.recordSimpleData("textRenderingMode", opIdx);
|
|
382233
|
-
this.current.textRenderingMode =
|
|
382561
|
+
this.current.textRenderingMode = mode2;
|
|
382234
382562
|
}
|
|
382235
382563
|
setTextRise(opIdx, rise) {
|
|
382236
382564
|
this.dependencyTracker?.recordSimpleData("textRise", opIdx);
|
|
@@ -382248,12 +382576,12 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382248
382576
|
setTextMatrix(opIdx, matrix) {
|
|
382249
382577
|
this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix", opIdx);
|
|
382250
382578
|
const {
|
|
382251
|
-
current:
|
|
382579
|
+
current: current5
|
|
382252
382580
|
} = this;
|
|
382253
|
-
|
|
382254
|
-
|
|
382255
|
-
|
|
382256
|
-
|
|
382581
|
+
current5.textMatrix = matrix;
|
|
382582
|
+
current5.textMatrixScale = Math.hypot(matrix[0], matrix[1]);
|
|
382583
|
+
current5.x = current5.lineX = 0;
|
|
382584
|
+
current5.y = current5.lineY = 0;
|
|
382257
382585
|
}
|
|
382258
382586
|
nextLine(opIdx) {
|
|
382259
382587
|
this.moveText(opIdx, 0, this.current.leading);
|
|
@@ -382266,14 +382594,14 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382266
382594
|
}
|
|
382267
382595
|
paintChar(opIdx, character, x2, y, patternFillTransform, patternStrokeTransform) {
|
|
382268
382596
|
const ctx2 = this.ctx;
|
|
382269
|
-
const
|
|
382270
|
-
const font =
|
|
382271
|
-
const textRenderingMode =
|
|
382272
|
-
const fontSize =
|
|
382597
|
+
const current5 = this.current;
|
|
382598
|
+
const font = current5.font;
|
|
382599
|
+
const textRenderingMode = current5.textRenderingMode;
|
|
382600
|
+
const fontSize = current5.fontSize / current5.fontSizeScale;
|
|
382273
382601
|
const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
382274
382602
|
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
|
|
382275
|
-
const patternFill =
|
|
382276
|
-
const patternStroke =
|
|
382603
|
+
const patternFill = current5.patternFill && !font.missingFile;
|
|
382604
|
+
const patternStroke = current5.patternStroke && !font.missingFile;
|
|
382277
382605
|
let path;
|
|
382278
382606
|
if ((font.disableFontFace || isAddToPathSet || patternFill || patternStroke) && !font.missingFile) {
|
|
382279
382607
|
path = font.getPathGenerator(this.commonObjs, character);
|
|
@@ -382362,49 +382690,49 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382362
382690
|
this.dependencyTracker.recordFutureForcedDependency("textClip", opIdx).inheritPendingDependenciesAsFutureForcedDependencies();
|
|
382363
382691
|
}
|
|
382364
382692
|
}
|
|
382365
|
-
const
|
|
382366
|
-
const font =
|
|
382693
|
+
const current5 = this.current;
|
|
382694
|
+
const font = current5.font;
|
|
382367
382695
|
if (font.isType3Font) {
|
|
382368
|
-
const started9 = this.#beginKnockoutElement(
|
|
382696
|
+
const started9 = this.#beginKnockoutElement(current5.fillAlpha);
|
|
382369
382697
|
this.showType3Text(opIdx, glyphs);
|
|
382370
382698
|
this.dependencyTracker?.recordShowTextOperation(opIdx);
|
|
382371
382699
|
this.#endKnockoutElement(started9);
|
|
382372
382700
|
return;
|
|
382373
382701
|
}
|
|
382374
|
-
const fontSize =
|
|
382702
|
+
const fontSize = current5.fontSize;
|
|
382375
382703
|
if (fontSize === 0) {
|
|
382376
382704
|
this.dependencyTracker?.recordOperation(opIdx);
|
|
382377
382705
|
return;
|
|
382378
382706
|
}
|
|
382379
|
-
const started8 = this.#beginKnockoutElement(
|
|
382707
|
+
const started8 = this.#beginKnockoutElement(current5.fillAlpha);
|
|
382380
382708
|
const ctx2 = this.ctx;
|
|
382381
|
-
const fontSizeScale =
|
|
382382
|
-
const charSpacing =
|
|
382383
|
-
const wordSpacing =
|
|
382384
|
-
const fontDirection =
|
|
382385
|
-
const textHScale =
|
|
382709
|
+
const fontSizeScale = current5.fontSizeScale;
|
|
382710
|
+
const charSpacing = current5.charSpacing;
|
|
382711
|
+
const wordSpacing = current5.wordSpacing;
|
|
382712
|
+
const fontDirection = current5.fontDirection;
|
|
382713
|
+
const textHScale = current5.textHScale * fontDirection;
|
|
382386
382714
|
const glyphsLength = glyphs.length;
|
|
382387
382715
|
const vertical = font.vertical;
|
|
382388
382716
|
const spacingDir = vertical ? 1 : -1;
|
|
382389
382717
|
const defaultVMetrics = font.defaultVMetrics;
|
|
382390
|
-
const widthAdvanceScale = fontSize *
|
|
382391
|
-
const simpleFillText =
|
|
382718
|
+
const widthAdvanceScale = fontSize * current5.fontMatrix[0];
|
|
382719
|
+
const simpleFillText = current5.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current5.patternFill;
|
|
382392
382720
|
ctx2.save();
|
|
382393
|
-
if (
|
|
382394
|
-
ctx2.transform(...
|
|
382721
|
+
if (current5.textMatrix) {
|
|
382722
|
+
ctx2.transform(...current5.textMatrix);
|
|
382395
382723
|
}
|
|
382396
|
-
ctx2.translate(
|
|
382724
|
+
ctx2.translate(current5.x, current5.y + current5.textRise);
|
|
382397
382725
|
if (fontDirection > 0) {
|
|
382398
382726
|
ctx2.scale(textHScale, -1);
|
|
382399
382727
|
} else {
|
|
382400
382728
|
ctx2.scale(textHScale, 1);
|
|
382401
382729
|
}
|
|
382402
382730
|
let patternFillTransform, patternStrokeTransform;
|
|
382403
|
-
const fillStrokeMode =
|
|
382731
|
+
const fillStrokeMode = current5.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
382404
382732
|
const needsFill = fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
382405
382733
|
const needsStroke = fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
382406
|
-
let lineWidth2 =
|
|
382407
|
-
const scale =
|
|
382734
|
+
let lineWidth2 = current5.lineWidth;
|
|
382735
|
+
const scale = current5.textMatrixScale;
|
|
382408
382736
|
if (scale === 0 || lineWidth2 === 0) {
|
|
382409
382737
|
if (needsStroke) {
|
|
382410
382738
|
lineWidth2 = this.getSinglePixelWidth();
|
|
@@ -382417,16 +382745,16 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382417
382745
|
lineWidth2 /= fontSizeScale;
|
|
382418
382746
|
}
|
|
382419
382747
|
ctx2.lineWidth = lineWidth2;
|
|
382420
|
-
if (needsFill &&
|
|
382748
|
+
if (needsFill && current5.patternFill) {
|
|
382421
382749
|
ctx2.save();
|
|
382422
|
-
const pattern =
|
|
382750
|
+
const pattern = current5.fillColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.FILL, opIdx);
|
|
382423
382751
|
patternFillTransform = getCurrentTransform(ctx2);
|
|
382424
382752
|
ctx2.restore();
|
|
382425
382753
|
ctx2.fillStyle = pattern;
|
|
382426
382754
|
}
|
|
382427
|
-
if (needsStroke &&
|
|
382755
|
+
if (needsStroke && current5.patternStroke) {
|
|
382428
382756
|
ctx2.save();
|
|
382429
|
-
const pattern =
|
|
382757
|
+
const pattern = current5.strokeColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.STROKE, opIdx);
|
|
382430
382758
|
patternStrokeTransform = getCurrentTransform(ctx2);
|
|
382431
382759
|
ctx2.restore();
|
|
382432
382760
|
ctx2.strokeStyle = pattern;
|
|
@@ -382444,7 +382772,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382444
382772
|
const measure4 = ctx2.measureText(joinedChars);
|
|
382445
382773
|
this.dependencyTracker.recordBBox(opIdx, this.ctx, -measure4.actualBoundingBoxLeft, measure4.actualBoundingBoxRight, -measure4.actualBoundingBoxAscent, measure4.actualBoundingBoxDescent).recordShowTextOperation(opIdx);
|
|
382446
382774
|
}
|
|
382447
|
-
|
|
382775
|
+
current5.x += width * widthAdvanceScale * textHScale;
|
|
382448
382776
|
ctx2.restore();
|
|
382449
382777
|
this.compose();
|
|
382450
382778
|
this.#endKnockoutElement(started8);
|
|
@@ -382510,9 +382838,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382510
382838
|
}
|
|
382511
382839
|
}
|
|
382512
382840
|
if (vertical) {
|
|
382513
|
-
|
|
382841
|
+
current5.y -= x2;
|
|
382514
382842
|
} else {
|
|
382515
|
-
|
|
382843
|
+
current5.x += x2 * textHScale;
|
|
382516
382844
|
}
|
|
382517
382845
|
ctx2.restore();
|
|
382518
382846
|
this.compose();
|
|
@@ -382521,17 +382849,17 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382521
382849
|
}
|
|
382522
382850
|
showType3Text(opIdx, glyphs) {
|
|
382523
382851
|
const ctx2 = this.ctx;
|
|
382524
|
-
const
|
|
382525
|
-
const font =
|
|
382526
|
-
const fontSize =
|
|
382527
|
-
const fontDirection =
|
|
382852
|
+
const current5 = this.current;
|
|
382853
|
+
const font = current5.font;
|
|
382854
|
+
const fontSize = current5.fontSize;
|
|
382855
|
+
const fontDirection = current5.fontDirection;
|
|
382528
382856
|
const spacingDir = font.vertical ? 1 : -1;
|
|
382529
|
-
const charSpacing =
|
|
382530
|
-
const wordSpacing =
|
|
382531
|
-
const textHScale =
|
|
382532
|
-
const fontMatrix =
|
|
382857
|
+
const charSpacing = current5.charSpacing;
|
|
382858
|
+
const wordSpacing = current5.wordSpacing;
|
|
382859
|
+
const textHScale = current5.textHScale * fontDirection;
|
|
382860
|
+
const fontMatrix = current5.fontMatrix || FONT_IDENTITY_MATRIX;
|
|
382533
382861
|
const glyphsLength = glyphs.length;
|
|
382534
|
-
const isTextInvisible =
|
|
382862
|
+
const isTextInvisible = current5.textRenderingMode === TextRenderingMode.INVISIBLE;
|
|
382535
382863
|
let i2, glyph2, width, spacingLength;
|
|
382536
382864
|
if (isTextInvisible || fontSize === 0) {
|
|
382537
382865
|
return;
|
|
@@ -382539,10 +382867,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382539
382867
|
this._cachedScaleForStroking[0] = -1;
|
|
382540
382868
|
this._cachedGetSinglePixelWidth = null;
|
|
382541
382869
|
ctx2.save();
|
|
382542
|
-
if (
|
|
382543
|
-
ctx2.transform(...
|
|
382870
|
+
if (current5.textMatrix) {
|
|
382871
|
+
ctx2.transform(...current5.textMatrix);
|
|
382544
382872
|
}
|
|
382545
|
-
ctx2.translate(
|
|
382873
|
+
ctx2.translate(current5.x, current5.y + current5.textRise);
|
|
382546
382874
|
ctx2.scale(textHScale, fontDirection);
|
|
382547
382875
|
const dependencyTracker = this.dependencyTracker;
|
|
382548
382876
|
this.dependencyTracker = dependencyTracker ? new CanvasNestedDependencyTracker(dependencyTracker, opIdx) : null;
|
|
@@ -382551,7 +382879,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382551
382879
|
if (typeof glyph2 === "number") {
|
|
382552
382880
|
spacingLength = spacingDir * glyph2 * fontSize / 1e3;
|
|
382553
382881
|
this.ctx.translate(spacingLength, 0);
|
|
382554
|
-
|
|
382882
|
+
current5.x += spacingLength * textHScale;
|
|
382555
382883
|
continue;
|
|
382556
382884
|
}
|
|
382557
382885
|
const spacing = (glyph2.isSpace ? wordSpacing : 0) + charSpacing;
|
|
@@ -382561,7 +382889,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382561
382889
|
} else if (this.contentVisible) {
|
|
382562
382890
|
this.save();
|
|
382563
382891
|
if (operatorList.fnArray[0] === OPS2.setCharWidth) {
|
|
382564
|
-
|
|
382892
|
+
current5.fillAlpha = current5.strokeAlpha = 1;
|
|
382565
382893
|
ctx2.globalAlpha = 1;
|
|
382566
382894
|
}
|
|
382567
382895
|
ctx2.scale(fontSize, fontSize);
|
|
@@ -382573,7 +382901,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382573
382901
|
Util.applyTransform(p2, fontMatrix);
|
|
382574
382902
|
width = p2[0] * fontSize + spacing;
|
|
382575
382903
|
ctx2.translate(width, 0);
|
|
382576
|
-
|
|
382904
|
+
current5.x += width * textHScale;
|
|
382577
382905
|
}
|
|
382578
382906
|
ctx2.restore();
|
|
382579
382907
|
if (dependencyTracker) {
|
|
@@ -387985,7 +388313,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
387985
388313
|
return;
|
|
387986
388314
|
}
|
|
387987
388315
|
const {
|
|
387988
|
-
annotationEditorType:
|
|
388316
|
+
annotationEditorType: mode2,
|
|
387989
388317
|
data: {
|
|
387990
388318
|
id: editId
|
|
387991
388319
|
}
|
|
@@ -387993,7 +388321,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
387993
388321
|
this.container.addEventListener("dblclick", () => {
|
|
387994
388322
|
this.linkService.eventBus?.dispatch("switchannotationeditormode", {
|
|
387995
388323
|
source: this,
|
|
387996
|
-
mode,
|
|
388324
|
+
mode: mode2,
|
|
387997
388325
|
editId,
|
|
387998
388326
|
mustEnterInEditMode: true
|
|
387999
388327
|
});
|
|
@@ -396350,9 +396678,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
396350
396678
|
updateToolbar(options) {
|
|
396351
396679
|
this.#uiManager.updateToolbar(options);
|
|
396352
396680
|
}
|
|
396353
|
-
updateMode(
|
|
396681
|
+
updateMode(mode2 = this.#uiManager.getMode()) {
|
|
396354
396682
|
this.#cleanup();
|
|
396355
|
-
switch (
|
|
396683
|
+
switch (mode2) {
|
|
396356
396684
|
case AnnotationEditorType.NONE:
|
|
396357
396685
|
this.div.classList.toggle("nonEditing", true);
|
|
396358
396686
|
this.disableTextSelection();
|
|
@@ -396380,12 +396708,12 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
396380
396708
|
classList
|
|
396381
396709
|
} = this.div;
|
|
396382
396710
|
classList.toggle("nonEditing", false);
|
|
396383
|
-
if (
|
|
396711
|
+
if (mode2 === AnnotationEditorType.POPUP) {
|
|
396384
396712
|
classList.toggle("commentEditing", true);
|
|
396385
396713
|
} else {
|
|
396386
396714
|
classList.toggle("commentEditing", false);
|
|
396387
396715
|
for (const editorType of _AnnotationEditorLayer.#editorTypes.values()) {
|
|
396388
|
-
classList.toggle(`${editorType._type}Editing`,
|
|
396716
|
+
classList.toggle(`${editorType._type}Editing`, mode2 === editorType._editorType);
|
|
396389
396717
|
}
|
|
396390
396718
|
}
|
|
396391
396719
|
this.div.hidden = false;
|
|
@@ -398444,17 +398772,17 @@ function runningSessionFor(pluginId) {
|
|
|
398444
398772
|
return [...running3.values()].find((s) => s.plugin.manifest.id === pluginId);
|
|
398445
398773
|
}
|
|
398446
398774
|
async function refreshInstalledPlugins() {
|
|
398447
|
-
const
|
|
398448
|
-
syncPluginTabs(
|
|
398449
|
-
usePluginStore.getState().setInstalled(
|
|
398450
|
-
syncPluginThemes(
|
|
398451
|
-
syncPluginAgentTools(
|
|
398775
|
+
const installed4 = await listPlugins();
|
|
398776
|
+
syncPluginTabs(installed4);
|
|
398777
|
+
usePluginStore.getState().setInstalled(installed4);
|
|
398778
|
+
syncPluginThemes(installed4);
|
|
398779
|
+
syncPluginAgentTools(installed4);
|
|
398452
398780
|
}
|
|
398453
|
-
function syncPluginThemes(
|
|
398781
|
+
function syncPluginThemes(installed4) {
|
|
398454
398782
|
const themes = useThemeStore.getState();
|
|
398455
|
-
const live = new Set(
|
|
398783
|
+
const live = new Set(installed4.map((p2) => p2.manifest.id));
|
|
398456
398784
|
for (const id3 of Object.keys(themes.pluginThemes)) if (!live.has(id3)) themes.setPluginThemes(id3, []);
|
|
398457
|
-
for (const p2 of
|
|
398785
|
+
for (const p2 of installed4) themes.setPluginThemes(p2.manifest.id, p2.enabled ? p2.themes ?? [] : []);
|
|
398458
398786
|
}
|
|
398459
398787
|
async function installPluginPayload(payload, opts = {}) {
|
|
398460
398788
|
const rec = await installPlugin(payload);
|
|
@@ -398504,13 +398832,13 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
398504
398832
|
iframe.style.display = "none";
|
|
398505
398833
|
iframe.dataset.popcraftPlugin = pluginId;
|
|
398506
398834
|
iframe.srcdoc = withAgentToolsShim(withWasmEvalCsp(buildMainDocument(plugin.mainCode, granted.includes("network"))));
|
|
398507
|
-
const
|
|
398835
|
+
const channel4 = new MessageChannel();
|
|
398508
398836
|
const session3 = {
|
|
398509
398837
|
sessionId,
|
|
398510
398838
|
plugin,
|
|
398511
398839
|
granted,
|
|
398512
398840
|
iframe,
|
|
398513
|
-
port:
|
|
398841
|
+
port: channel4.port1,
|
|
398514
398842
|
uiPort: null,
|
|
398515
398843
|
pendingToUI: [],
|
|
398516
398844
|
unsubscribers: [],
|
|
@@ -398521,7 +398849,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
398521
398849
|
exportRequest: opts.exportRequest ?? null,
|
|
398522
398850
|
env: null,
|
|
398523
398851
|
tools: createToolChannel((event, data) => {
|
|
398524
|
-
if (running3.has(sessionId))
|
|
398852
|
+
if (running3.has(sessionId)) channel4.port1.postMessage({ kind: "event", event, data });
|
|
398525
398853
|
}, plugin.manifest.name)
|
|
398526
398854
|
};
|
|
398527
398855
|
running3.set(sessionId, session3);
|
|
@@ -398604,15 +398932,15 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
398604
398932
|
}
|
|
398605
398933
|
};
|
|
398606
398934
|
session3.env = env;
|
|
398607
|
-
|
|
398935
|
+
channel4.port1.onmessage = async (ev) => {
|
|
398608
398936
|
const m = ev.data;
|
|
398609
398937
|
if (!running3.has(sessionId)) return;
|
|
398610
398938
|
if (m.kind === "rpc" && typeof m.id === "number" && typeof m.method === "string") {
|
|
398611
398939
|
try {
|
|
398612
398940
|
const result = await handlePluginCall(env, m.method, m.params ?? {});
|
|
398613
|
-
if (running3.has(sessionId))
|
|
398941
|
+
if (running3.has(sessionId)) channel4.port1.postMessage({ kind: "result", id: m.id, result });
|
|
398614
398942
|
} catch (err2) {
|
|
398615
|
-
if (running3.has(sessionId))
|
|
398943
|
+
if (running3.has(sessionId)) channel4.port1.postMessage({ kind: "result", id: m.id, error: err2 instanceof Error ? err2.message : String(err2) });
|
|
398616
398944
|
}
|
|
398617
398945
|
} else if (m.kind === "toUI") {
|
|
398618
398946
|
if (session3.uiPort) session3.uiPort.postMessage({ kind: "event", event: "message", data: m.data });
|
|
@@ -398624,7 +398952,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
398624
398952
|
}
|
|
398625
398953
|
};
|
|
398626
398954
|
iframe.addEventListener("load", () => {
|
|
398627
|
-
iframe.contentWindow?.postMessage({ type: "popcraft-plugin-port" }, "*", [
|
|
398955
|
+
iframe.contentWindow?.postMessage({ type: "popcraft-plugin-port" }, "*", [channel4.port2]);
|
|
398628
398956
|
post(session3, "init", {
|
|
398629
398957
|
command,
|
|
398630
398958
|
importMode: session3.importMode,
|
|
@@ -398659,15 +398987,15 @@ function attachPluginUI(sessionId, iframe) {
|
|
|
398659
398987
|
const session3 = running3.get(sessionId);
|
|
398660
398988
|
if (!session3 || !iframe.contentWindow) return;
|
|
398661
398989
|
session3.uiPort?.close();
|
|
398662
|
-
const
|
|
398663
|
-
session3.uiPort =
|
|
398664
|
-
|
|
398990
|
+
const channel4 = new MessageChannel();
|
|
398991
|
+
session3.uiPort = channel4.port1;
|
|
398992
|
+
channel4.port1.onmessage = (ev) => {
|
|
398665
398993
|
const m = ev.data;
|
|
398666
398994
|
if (m.kind === "fromUI") post(session3, "uimessage", m.data);
|
|
398667
398995
|
else if (m.kind === "closeUI") usePluginStore.getState().patchSession(sessionId, { ui: null });
|
|
398668
398996
|
};
|
|
398669
|
-
iframe.contentWindow.postMessage({ type: "popcraft-plugin-port" }, "*", [
|
|
398670
|
-
for (const data of session3.pendingToUI.splice(0))
|
|
398997
|
+
iframe.contentWindow.postMessage({ type: "popcraft-plugin-port" }, "*", [channel4.port2]);
|
|
398998
|
+
for (const data of session3.pendingToUI.splice(0)) channel4.port1.postMessage({ kind: "event", event: "message", data });
|
|
398671
398999
|
}
|
|
398672
399000
|
function pluginUIDocument(sessionId) {
|
|
398673
399001
|
const s = running3.get(sessionId);
|
|
@@ -398699,8 +399027,8 @@ async function ensureBackgroundSession(pluginId, command) {
|
|
|
398699
399027
|
}
|
|
398700
399028
|
async function callPluginTool(plugin, tool2, args2, options) {
|
|
398701
399029
|
const id3 = plugin.manifest.id;
|
|
398702
|
-
const
|
|
398703
|
-
if (!
|
|
399030
|
+
const current5 = await getPlugin(id3);
|
|
399031
|
+
if (!current5?.enabled || current5.granted === null) throw new Error(`${plugin.manifest.name} is disabled or has not been allowed to run`);
|
|
398704
399032
|
const session3 = await ensureBackgroundSession(id3, "agent");
|
|
398705
399033
|
if (!session3?.env) throw new Error(`${plugin.manifest.name} could not start`);
|
|
398706
399034
|
const env = session3.env;
|
|
@@ -398770,13 +399098,13 @@ var init_host3 = __esm({
|
|
|
398770
399098
|
const d = e.data;
|
|
398771
399099
|
if (!d) return;
|
|
398772
399100
|
if (d.type !== "popcraft-import-as-new" && d.type !== "popcraft-import-into-current") return;
|
|
398773
|
-
const
|
|
399101
|
+
const mode2 = d.type === "popcraft-import-as-new" ? "new" : "into-current";
|
|
398774
399102
|
const name2 = d.name || "Imported";
|
|
398775
399103
|
void (async () => {
|
|
398776
399104
|
try {
|
|
398777
399105
|
const { importViaPlugin: importViaPlugin2, applyPluginLayoutIr: applyPluginLayoutIr2 } = await Promise.resolve().then(() => (init_plugin_import(), plugin_import_exports));
|
|
398778
399106
|
if (d.ir && typeof d.ir === "object") {
|
|
398779
|
-
await applyPluginLayoutIr2(d.ir, { mode, name: name2 });
|
|
399107
|
+
await applyPluginLayoutIr2(d.ir, { mode: mode2, name: name2 });
|
|
398780
399108
|
return;
|
|
398781
399109
|
}
|
|
398782
399110
|
if (typeof d.dataUrl !== "string") return;
|
|
@@ -398785,7 +399113,7 @@ var init_host3 = __esm({
|
|
|
398785
399113
|
const bytes2 = new Uint8Array(bin.length);
|
|
398786
399114
|
for (let i2 = 0; i2 < bin.length; i2++) bytes2[i2] = bin.charCodeAt(i2);
|
|
398787
399115
|
const file2 = new File([bytes2], name2);
|
|
398788
|
-
await importViaPlugin2(file2, { mode });
|
|
399116
|
+
await importViaPlugin2(file2, { mode: mode2 });
|
|
398789
399117
|
} catch (err2) {
|
|
398790
399118
|
usePluginStore.getState().toast(String(err2 instanceof Error ? err2.message : err2), { error: true });
|
|
398791
399119
|
}
|
|
@@ -401046,17 +401374,17 @@ __export(recorders_exports, {
|
|
|
401046
401374
|
setDesignRecorder: () => setDesignRecorder
|
|
401047
401375
|
});
|
|
401048
401376
|
function setDesignRecorder(r) {
|
|
401049
|
-
|
|
401377
|
+
installed2 = r;
|
|
401050
401378
|
}
|
|
401051
401379
|
function designRecorder() {
|
|
401052
|
-
if (
|
|
401380
|
+
if (installed2) return installed2;
|
|
401053
401381
|
if (typeof window !== "undefined") return async (source3, namespaces2, globals) => (await Promise.resolve().then(() => (init_sandbox(), sandbox_exports))).recordInSandbox(source3, namespaces2, globals);
|
|
401054
401382
|
throw new Error("Design scripts are built in the editor, the desktop app or the popcraft CLI, not on the server: build the file with the CLI (popcraft run file.popcraft write_design \u2026) and push it, or run it in the app (popcraft run --ui \u2026).");
|
|
401055
401383
|
}
|
|
401056
|
-
var
|
|
401384
|
+
var installed2;
|
|
401057
401385
|
var init_recorders = __esm({
|
|
401058
401386
|
"lib/agent/design-script/recorders.ts"() {
|
|
401059
|
-
|
|
401387
|
+
installed2 = null;
|
|
401060
401388
|
}
|
|
401061
401389
|
});
|
|
401062
401390
|
|
|
@@ -402420,8 +402748,8 @@ var init_app = __esm({
|
|
|
402420
402748
|
permission: null,
|
|
402421
402749
|
params: external_exports.object({ mode: external_exports.enum([...MODE_IDS, ...Object.keys(MODE_ALIASES)]) }),
|
|
402422
402750
|
expose: { ui: { label: "Switch mode", keywords: ["mode", "view"], variants: MODE_LIST.map((m) => ({ id: m.id.toLowerCase(), label: `${m.label} mode`, shortcut: m.shortcut, params: { mode: m.id } })) } },
|
|
402423
|
-
run: async ({ mode }) => {
|
|
402424
|
-
const id3 = MODE_ALIASES[
|
|
402751
|
+
run: async ({ mode: mode2 }) => {
|
|
402752
|
+
const id3 = MODE_ALIASES[mode2] ?? mode2;
|
|
402425
402753
|
(await store5()).setMode(id3);
|
|
402426
402754
|
return { summary: `${MODE_LIST.find((m) => m.id === id3)?.label} mode` };
|
|
402427
402755
|
}
|
|
@@ -405328,13 +405656,13 @@ function settleRequest(outcome) {
|
|
|
405328
405656
|
emit5();
|
|
405329
405657
|
p2.resolve(outcome);
|
|
405330
405658
|
}
|
|
405331
|
-
var pending7,
|
|
405659
|
+
var pending7, listeners8, emit5, opener;
|
|
405332
405660
|
var init_requests = __esm({
|
|
405333
405661
|
"lib/audio/presentation/requests.ts"() {
|
|
405334
405662
|
pending7 = null;
|
|
405335
|
-
|
|
405663
|
+
listeners8 = /* @__PURE__ */ new Set();
|
|
405336
405664
|
emit5 = () => {
|
|
405337
|
-
for (const l of
|
|
405665
|
+
for (const l of listeners8) l();
|
|
405338
405666
|
};
|
|
405339
405667
|
opener = null;
|
|
405340
405668
|
}
|
|
@@ -406125,7 +406453,6 @@ function registerBuiltinCommands() {
|
|
|
406125
406453
|
var builtinCommands, uiOnlyCommands;
|
|
406126
406454
|
var init_builtin4 = __esm({
|
|
406127
406455
|
"lib/commands/builtin.ts"() {
|
|
406128
|
-
"use strict";
|
|
406129
406456
|
init_registry();
|
|
406130
406457
|
init_node();
|
|
406131
406458
|
init_node();
|
|
@@ -406204,6 +406531,7 @@ var init_builtin4 = __esm({
|
|
|
406204
406531
|
viewSelect,
|
|
406205
406532
|
viewZoomTo,
|
|
406206
406533
|
viewStage,
|
|
406534
|
+
viewScreenLayout,
|
|
406207
406535
|
viewPresent,
|
|
406208
406536
|
showSetAdvance,
|
|
406209
406537
|
// was document.ts
|
|
@@ -408389,11 +408717,11 @@ var init_editor_store = __esm({
|
|
|
408389
408717
|
return newNode;
|
|
408390
408718
|
};
|
|
408391
408719
|
const traverse = (currentId, sx, sy) => {
|
|
408392
|
-
const
|
|
408393
|
-
if (!
|
|
408394
|
-
newNodes[currentId] = scaleProps(
|
|
408395
|
-
if ("childIds" in
|
|
408396
|
-
for (const childId of
|
|
408720
|
+
const current5 = sourceNodes[currentId];
|
|
408721
|
+
if (!current5) return;
|
|
408722
|
+
newNodes[currentId] = scaleProps(current5, sx, sy);
|
|
408723
|
+
if ("childIds" in current5 && current5.childIds) {
|
|
408724
|
+
for (const childId of current5.childIds) {
|
|
408397
408725
|
traverse(childId, sx, sy);
|
|
408398
408726
|
}
|
|
408399
408727
|
}
|
|
@@ -408756,10 +409084,10 @@ var init_editor_store = __esm({
|
|
|
408756
409084
|
const state = get4();
|
|
408757
409085
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
408758
409086
|
ids2.forEach((id3) => {
|
|
408759
|
-
let
|
|
408760
|
-
for (let guard2 = 0;
|
|
408761
|
-
newExpanded.add(
|
|
408762
|
-
|
|
409087
|
+
let current5 = resolveVirtualNode2(state.document.nodes, id3);
|
|
409088
|
+
for (let guard2 = 0; current5?.parentId && guard2 < 64; guard2++) {
|
|
409089
|
+
newExpanded.add(current5.parentId);
|
|
409090
|
+
current5 = resolveVirtualNode2(state.document.nodes, current5.parentId);
|
|
408763
409091
|
}
|
|
408764
409092
|
});
|
|
408765
409093
|
const cellSel = state.tableCellSelection;
|
|
@@ -408771,10 +409099,10 @@ var init_editor_store = __esm({
|
|
|
408771
409099
|
addToSelection: (id3) => {
|
|
408772
409100
|
const state = get4();
|
|
408773
409101
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
408774
|
-
let
|
|
408775
|
-
while (
|
|
408776
|
-
newExpanded.add(
|
|
408777
|
-
|
|
409102
|
+
let current5 = state.document.nodes[id3];
|
|
409103
|
+
while (current5 && current5.parentId) {
|
|
409104
|
+
newExpanded.add(current5.parentId);
|
|
409105
|
+
current5 = state.document.nodes[current5.parentId];
|
|
408778
409106
|
}
|
|
408779
409107
|
set4({
|
|
408780
409108
|
selection: [...state.selection, id3],
|
|
@@ -409316,11 +409644,11 @@ var init_editor_store = __esm({
|
|
|
409316
409644
|
if (!pages2.length) return;
|
|
409317
409645
|
const cam = state.camera;
|
|
409318
409646
|
const selected = pages2.findIndex((pg) => state.selection.includes(pg.id));
|
|
409319
|
-
const
|
|
409647
|
+
const current5 = selected >= 0 ? selected : pages2.reduce((best, pg, i2) => {
|
|
409320
409648
|
const d = Math.hypot(pg.x + pg.width / 2 - cam.x, pg.y + pg.height / 2 - cam.y);
|
|
409321
409649
|
return d < best.d ? { i: i2, d } : best;
|
|
409322
409650
|
}, { i: 0, d: Infinity }).i;
|
|
409323
|
-
const target2 = typeof to === "number" ? to : to === "first" ? 0 : to === "last" ? pages2.length - 1 :
|
|
409651
|
+
const target2 = typeof to === "number" ? to : to === "first" ? 0 : to === "last" ? pages2.length - 1 : current5 + (to === "next" ? 1 : -1);
|
|
409324
409652
|
const page = pages2[Math.max(0, Math.min(pages2.length - 1, target2))];
|
|
409325
409653
|
set4({ selection: [page.id] });
|
|
409326
409654
|
get4().zoomToNodes([page.id], 0.1);
|
|
@@ -410099,14 +410427,14 @@ var init_editor_store = __esm({
|
|
|
410099
410427
|
for (const p2 of points) get4().pickShapeBuilderFace(p2.x, p2.y, "add");
|
|
410100
410428
|
get4().commitShapeBuilder();
|
|
410101
410429
|
},
|
|
410102
|
-
pickShapeBuilderFace: (worldX, worldY,
|
|
410430
|
+
pickShapeBuilderFace: (worldX, worldY, mode2) => {
|
|
410103
410431
|
const state = get4();
|
|
410104
410432
|
const sb = state.shapeBuilder;
|
|
410105
410433
|
if (!sb) return;
|
|
410106
410434
|
const i2 = faceAt(shapeBuilderFaces(state.document, sb.nodeIds), worldX, worldY);
|
|
410107
410435
|
if (i2 < 0) return;
|
|
410108
410436
|
const has = sb.picked.includes(i2);
|
|
410109
|
-
const wanted =
|
|
410437
|
+
const wanted = mode2 === "toggle" ? !has : mode2 === "add";
|
|
410110
410438
|
if (wanted === has) return;
|
|
410111
410439
|
set4({ shapeBuilder: { ...sb, picked: wanted ? [...sb.picked, i2] : sb.picked.filter((x2) => x2 !== i2) } });
|
|
410112
410440
|
},
|
|
@@ -410723,7 +411051,7 @@ var init_editor_store = __esm({
|
|
|
410723
411051
|
const collection = state.document.variableCollections?.[collectionId];
|
|
410724
411052
|
if (!collection) return;
|
|
410725
411053
|
const modeId = v4_default();
|
|
410726
|
-
const
|
|
411054
|
+
const mode2 = { id: modeId, name: name2 || `Mode ${collection.modes.length + 1}` };
|
|
410727
411055
|
const newVariables = { ...state.document.variables || {} };
|
|
410728
411056
|
for (const [vid, v] of Object.entries(newVariables)) {
|
|
410729
411057
|
if (v.variableCollectionId !== collectionId) continue;
|
|
@@ -410736,7 +411064,7 @@ var init_editor_store = __esm({
|
|
|
410736
411064
|
variables: newVariables,
|
|
410737
411065
|
variableCollections: {
|
|
410738
411066
|
...state.document.variableCollections,
|
|
410739
|
-
[collectionId]: { ...collection, modes: [...collection.modes,
|
|
411067
|
+
[collectionId]: { ...collection, modes: [...collection.modes, mode2] }
|
|
410740
411068
|
}
|
|
410741
411069
|
};
|
|
410742
411070
|
const command = createCommand("ADD_VARIABLE_MODE", "Add variable mode", documentBefore, documentAfter);
|
|
@@ -411485,10 +411813,10 @@ async function installHyperySession(url4) {
|
|
|
411485
411813
|
getToken: async () => (session3 = await freshSession(url4, session3)).accessToken
|
|
411486
411814
|
});
|
|
411487
411815
|
useAiStore2.setState({ signedIn: true, online: true });
|
|
411488
|
-
|
|
411816
|
+
installed3 = session3;
|
|
411489
411817
|
return session3;
|
|
411490
411818
|
}
|
|
411491
|
-
var account, REFRESH_MARGIN_MS, SIGN_IN_TIMEOUT_MS, b64url, forgetSession,
|
|
411819
|
+
var account, REFRESH_MARGIN_MS, SIGN_IN_TIMEOUT_MS, b64url, forgetSession, installed3, hyperySignedIn;
|
|
411492
411820
|
var init_hypery = __esm({
|
|
411493
411821
|
"packages/cli/src/hypery.ts"() {
|
|
411494
411822
|
"use strict";
|
|
@@ -411499,8 +411827,8 @@ var init_hypery = __esm({
|
|
|
411499
411827
|
SIGN_IN_TIMEOUT_MS = 10 * 6e4;
|
|
411500
411828
|
b64url = (buf) => buf.toString("base64url");
|
|
411501
411829
|
forgetSession = (url4) => forgetToken(account(url4));
|
|
411502
|
-
|
|
411503
|
-
hyperySignedIn = () =>
|
|
411830
|
+
installed3 = null;
|
|
411831
|
+
hyperySignedIn = () => installed3 !== null;
|
|
411504
411832
|
}
|
|
411505
411833
|
});
|
|
411506
411834
|
|
|
@@ -413469,9 +413797,9 @@ import { dirname as dirname5, extname as extname3, join as join12, resolve as re
|
|
|
413469
413797
|
function loadPlugin(ref3, root2 = desktopDataDir()) {
|
|
413470
413798
|
let path = ref3;
|
|
413471
413799
|
if (!existsSync13(path)) {
|
|
413472
|
-
const
|
|
413473
|
-
if (!
|
|
413474
|
-
path = join12(root2,
|
|
413800
|
+
const installed4 = listResources2("plugins", root2).find((r) => r.name === ref3);
|
|
413801
|
+
if (!installed4) throw usage(`No plugin "${ref3}": give its folder, .zip or .json, or the name of one in \`popcraft plugins list\`.`);
|
|
413802
|
+
path = join12(root2, installed4.path);
|
|
413475
413803
|
}
|
|
413476
413804
|
if (statSync6(path).isDirectory()) {
|
|
413477
413805
|
const dir = resolve6(path);
|
|
@@ -413729,7 +414057,7 @@ init_resources();
|
|
|
413729
414057
|
init_desktop();
|
|
413730
414058
|
init_hypery();
|
|
413731
414059
|
import { createInterface } from "node:readline";
|
|
413732
|
-
var VERSION2 = "0.
|
|
414060
|
+
var VERSION2 = "0.49.0";
|
|
413733
414061
|
var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
|
|
413734
414062
|
|
|
413735
414063
|
Files (headless, on .popcraft files):
|