@popcraft/cli 0.48.2 → 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 +712 -389
- 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();
|
|
@@ -249088,7 +249151,6 @@ function beforeWrite() {
|
|
|
249088
249151
|
var leave;
|
|
249089
249152
|
var init_read_only = __esm({
|
|
249090
249153
|
"lib/editor/modes/read-only.ts"() {
|
|
249091
|
-
"use strict";
|
|
249092
249154
|
leave = null;
|
|
249093
249155
|
}
|
|
249094
249156
|
});
|
|
@@ -252160,11 +252222,11 @@ function bufferPolylines(lines2, width) {
|
|
|
252160
252222
|
return pieces.map((p2) => [p2[0]]);
|
|
252161
252223
|
}
|
|
252162
252224
|
}
|
|
252163
|
-
function combineRings(rings,
|
|
252225
|
+
function combineRings(rings, mode2) {
|
|
252164
252226
|
const polys = rings.filter((r) => r.length >= 3).map((r) => [r]);
|
|
252165
252227
|
if (polys.length === 0) return [];
|
|
252166
252228
|
try {
|
|
252167
|
-
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]];
|
|
252168
252230
|
} catch {
|
|
252169
252231
|
return polys.map((p2) => [p2[0]]);
|
|
252170
252232
|
}
|
|
@@ -252178,8 +252240,8 @@ function nodeWorldMultiPoly(doc2, id3) {
|
|
|
252178
252240
|
return mp.map((poly) => poly.map((ring) => ring.map(([x2, y]) => place4(x2, y))));
|
|
252179
252241
|
}
|
|
252180
252242
|
const rings = nodeWorldRings(doc2, id3);
|
|
252181
|
-
const
|
|
252182
|
-
return combineRings(rings,
|
|
252243
|
+
const mode2 = node2.type === "VECTOR" && node2.fillRule === "EVENODD" ? "xor" : "union";
|
|
252244
|
+
return combineRings(rings, mode2);
|
|
252183
252245
|
}
|
|
252184
252246
|
function nodeAreaMultiPoly(doc2, id3) {
|
|
252185
252247
|
if (!doc2.nodes[id3]) return [];
|
|
@@ -253360,17 +253422,17 @@ function packDabs(dabs, frame3, paint, prev) {
|
|
|
253360
253422
|
const p2 = worldToLayer(frame3, d.cx, d.cy);
|
|
253361
253423
|
const round5 = Math.max(0.1, d.roundness ?? 1);
|
|
253362
253424
|
let rx = d.r * k2, ry = d.r * round5 * k2;
|
|
253363
|
-
let
|
|
253364
|
-
if (paint.stamp)
|
|
253425
|
+
let mode2 = 0;
|
|
253426
|
+
if (paint.stamp) mode2 = 2;
|
|
253365
253427
|
else if (paint.tip === "SQUARE") {
|
|
253366
|
-
|
|
253428
|
+
mode2 = 1;
|
|
253367
253429
|
rx *= 0.85;
|
|
253368
253430
|
ry *= 0.85;
|
|
253369
253431
|
} else if (paint.tip === "NIB") {
|
|
253370
|
-
|
|
253432
|
+
mode2 = 1;
|
|
253371
253433
|
ry *= 0.45;
|
|
253372
253434
|
} else if (paint.tip === "CHISEL") {
|
|
253373
|
-
|
|
253435
|
+
mode2 = 1;
|
|
253374
253436
|
ry *= 0.5;
|
|
253375
253437
|
}
|
|
253376
253438
|
const angle2 = d.angle - frame3.rotationRad;
|
|
@@ -253382,8 +253444,8 @@ function packDabs(dabs, frame3, paint, prev) {
|
|
|
253382
253444
|
data[o + 12] = d.charge ?? 1;
|
|
253383
253445
|
data[o + 13] = (d.travel ?? 0) - frame3.rotationRad;
|
|
253384
253446
|
data[o + 4] = angle2;
|
|
253385
|
-
data[o + 5] = (paint.smudgeStrength !== void 0 || paint.liquify) &&
|
|
253386
|
-
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;
|
|
253387
253449
|
if (paint.cloneOffset) {
|
|
253388
253450
|
data[o + 8] = paint.cloneOffset.x;
|
|
253389
253451
|
data[o + 9] = paint.cloneOffset.y;
|
|
@@ -253664,12 +253726,12 @@ function selectAll(g) {
|
|
|
253664
253726
|
s.fill(1);
|
|
253665
253727
|
return s;
|
|
253666
253728
|
}
|
|
253667
|
-
function combineSelection(base, next2,
|
|
253668
|
-
if (!base ||
|
|
253729
|
+
function combineSelection(base, next2, mode2) {
|
|
253730
|
+
if (!base || mode2 === "REPLACE") return next2;
|
|
253669
253731
|
const out = new Uint8Array(next2.length);
|
|
253670
253732
|
for (let i2 = 0; i2 < next2.length; i2++) {
|
|
253671
253733
|
const a = base[i2] ? 1 : 0, b = next2[i2] ? 1 : 0;
|
|
253672
|
-
out[i2] =
|
|
253734
|
+
out[i2] = mode2 === "ADD" ? a | b : mode2 === "SUBTRACT" ? a & ~b : a & b;
|
|
253673
253735
|
}
|
|
253674
253736
|
return out;
|
|
253675
253737
|
}
|
|
@@ -253840,10 +253902,10 @@ function createImageEditSlice(set4, get4) {
|
|
|
253840
253902
|
if (!edit) return;
|
|
253841
253903
|
set4({ imageEdit: { ...edit, ...combine ? { combine } : {}, ...tolerance !== void 0 ? { tolerance } : {} } });
|
|
253842
253904
|
},
|
|
253843
|
-
applySelection: (next2,
|
|
253905
|
+
applySelection: (next2, mode2) => {
|
|
253844
253906
|
const edit = get4().imageEdit;
|
|
253845
253907
|
if (!edit) return;
|
|
253846
|
-
set4({ imageEdit: { ...edit, selection: combineSelection(edit.selection, next2,
|
|
253908
|
+
set4({ imageEdit: { ...edit, selection: combineSelection(edit.selection, next2, mode2 ?? edit.combine) } });
|
|
253847
253909
|
},
|
|
253848
253910
|
selectAllImage: () => {
|
|
253849
253911
|
const edit = get4().imageEdit;
|
|
@@ -254370,15 +254432,15 @@ function createModeSlice(set4, get4) {
|
|
|
254370
254432
|
tabOrder: loadTabOrder(),
|
|
254371
254433
|
stageView: {},
|
|
254372
254434
|
stageFrameId: null,
|
|
254373
|
-
setMode: (
|
|
254435
|
+
setMode: (mode2) => {
|
|
254374
254436
|
const state = get4();
|
|
254375
|
-
if (state.mode ===
|
|
254437
|
+
if (state.mode === mode2) return;
|
|
254376
254438
|
const st = get4();
|
|
254377
254439
|
if (st.vectorEditMode) st.exitVectorEditMode?.();
|
|
254378
254440
|
if (st.pixelEdit) st.exitPixelEdit?.();
|
|
254379
254441
|
const motion = get4();
|
|
254380
254442
|
motion.setMotionTarget?.(null);
|
|
254381
|
-
const profile = MODE_PROFILES[
|
|
254443
|
+
const profile = MODE_PROFILES[mode2];
|
|
254382
254444
|
const sides = state.tabSides ?? {};
|
|
254383
254445
|
const tabs = {};
|
|
254384
254446
|
const keyOf3 = (tab) => sideOf(sides, tab) === "left" ? "leftTab" : "rightTab";
|
|
@@ -254391,7 +254453,7 @@ function createModeSlice(set4, get4) {
|
|
|
254391
254453
|
tabs[keyOf3(previous)] = side === sideOf(sides, "composition") ? "composition" : tabsOn(sides, side, state.tabOrder)[0] ?? previous;
|
|
254392
254454
|
}
|
|
254393
254455
|
set4({
|
|
254394
|
-
mode,
|
|
254456
|
+
mode: mode2,
|
|
254395
254457
|
...tabs,
|
|
254396
254458
|
// Tools do not survive a mode switch: PopCorn's washi used to stay armed in Design, where nothing
|
|
254397
254459
|
// could draw it. The toolset that owns the tool is the only place it is reachable. The mode says
|
|
@@ -254435,9 +254497,9 @@ function createModeSlice(set4, get4) {
|
|
|
254435
254497
|
}
|
|
254436
254498
|
set4(patch2);
|
|
254437
254499
|
},
|
|
254438
|
-
setStageView: (on,
|
|
254500
|
+
setStageView: (on, mode2) => {
|
|
254439
254501
|
const state = get4();
|
|
254440
|
-
const m =
|
|
254502
|
+
const m = mode2 ?? state.mode;
|
|
254441
254503
|
if (!!state.stageView[m] === on) return;
|
|
254442
254504
|
set4({ stageView: { ...state.stageView, [m]: on } });
|
|
254443
254505
|
},
|
|
@@ -254931,25 +254993,25 @@ function createPixelSlice(set4, get4) {
|
|
|
254931
254993
|
commit(id3, { palette: clean3 }, "Edit palette");
|
|
254932
254994
|
},
|
|
254933
254995
|
/** Switch color mode, converting every frame (and tile): quantize to palette / luminance. */
|
|
254934
|
-
pixelSetColorMode: (id3,
|
|
254996
|
+
pixelSetColorMode: (id3, mode2) => {
|
|
254935
254997
|
const n = node2(id3);
|
|
254936
|
-
if (!n || n.colorMode ===
|
|
254998
|
+
if (!n || n.colorMode === mode2) return;
|
|
254937
254999
|
const count2 = n.pixelWidth * n.pixelHeight;
|
|
254938
255000
|
let palette2 = n.palette;
|
|
254939
|
-
if (
|
|
255001
|
+
if (mode2 === "INDEXED" && palette2.length < 2) {
|
|
254940
255002
|
const all4 = new Uint32Array(count2 * n.frames.length);
|
|
254941
255003
|
n.frames.forEach((_, i2) => all4.set(frameRGBA(n, i2), i2 * count2));
|
|
254942
255004
|
palette2 = extractPalette(all4, 256).map(packedToHex);
|
|
254943
255005
|
}
|
|
254944
|
-
const conv = (b64, cellCount) => encodeCels(convertCels(decodeCels(b64, cellCount), n.colorMode,
|
|
254945
|
-
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 };
|
|
254946
255008
|
if (n.tileset) {
|
|
254947
255009
|
const tc = n.tileset.tileW * n.tileset.tileH;
|
|
254948
255010
|
patch2.tileset = { ...n.tileset, tiles: n.tileset.tiles.map((t3) => conv(t3, tc)) };
|
|
254949
255011
|
} else {
|
|
254950
255012
|
patch2.frames = n.frames.map((f2) => ({ ...f2, cels: conv(f2.cels, count2) }));
|
|
254951
255013
|
}
|
|
254952
|
-
commit(id3, patch2, `Color mode: ${
|
|
255014
|
+
commit(id3, patch2, `Color mode: ${mode2.toLowerCase()}`);
|
|
254953
255015
|
},
|
|
254954
255016
|
/** Dedupe the canvas into a tileset + per-frame tile maps (Aseprite "convert to tilemap"). */
|
|
254955
255017
|
pixelConvertToTilemap: (id3, tileW, tileH) => {
|
|
@@ -256884,9 +256946,9 @@ function presenceChanges(prev, next2) {
|
|
|
256884
256946
|
for (const [id3, name2] of before) if (!after.has(id3)) out.push(t2("a11y.personLeft", { name: name2 }));
|
|
256885
256947
|
return out;
|
|
256886
256948
|
}
|
|
256887
|
-
function announcePresence(
|
|
256949
|
+
function announcePresence(subscribe2) {
|
|
256888
256950
|
let last3 = null;
|
|
256889
|
-
return
|
|
256951
|
+
return subscribe2((people) => {
|
|
256890
256952
|
if (last3) for (const m of presenceChanges(last3, people)) announce(m);
|
|
256891
256953
|
last3 = people;
|
|
256892
256954
|
});
|
|
@@ -257027,7 +257089,6 @@ function followPeers(peers) {
|
|
|
257027
257089
|
var PALETTE, usePresence, awareness, CURSOR_SEND_MS, VIEWPORT_SEND_MS, cursorTimer, pendingCursor, sentCursor, EMOTE_MS, lastFollowCamera;
|
|
257028
257090
|
var init_presence = __esm({
|
|
257029
257091
|
"lib/collab/presence.ts"() {
|
|
257030
|
-
"use strict";
|
|
257031
257092
|
init_esm();
|
|
257032
257093
|
init_editor_store();
|
|
257033
257094
|
init_status_announcements();
|
|
@@ -257924,7 +257985,7 @@ function documentPath(opts) {
|
|
|
257924
257985
|
}
|
|
257925
257986
|
function tabChannel() {
|
|
257926
257987
|
if (!isDesktopTabs() || typeof BroadcastChannel === "undefined") return null;
|
|
257927
|
-
return
|
|
257988
|
+
return channel2 ??= new BroadcastChannel(CHANNEL2);
|
|
257928
257989
|
}
|
|
257929
257990
|
function postTabMessage(msg) {
|
|
257930
257991
|
tabChannel()?.postMessage(msg);
|
|
@@ -257937,15 +257998,15 @@ function onTabMessage(fn) {
|
|
|
257937
257998
|
ch.addEventListener("message", handler);
|
|
257938
257999
|
return () => ch.removeEventListener("message", handler);
|
|
257939
258000
|
}
|
|
257940
|
-
var EDITOR_HOME, localDocPath, cloudFilePath,
|
|
258001
|
+
var EDITOR_HOME, localDocPath, cloudFilePath, CHANNEL2, channel2;
|
|
257941
258002
|
var init_tab_mode = __esm({
|
|
257942
258003
|
"lib/desktop/tab-mode.ts"() {
|
|
257943
258004
|
"use strict";
|
|
257944
258005
|
EDITOR_HOME = "/home";
|
|
257945
258006
|
localDocPath = (docId) => `${EDITOR_HOME}?doc=${encodeURIComponent(docId)}`;
|
|
257946
258007
|
cloudFilePath = (key5) => `/pop/${encodeURIComponent(key5)}`;
|
|
257947
|
-
|
|
257948
|
-
|
|
258008
|
+
CHANNEL2 = "popcraft-desktop-tabs";
|
|
258009
|
+
channel2 = null;
|
|
257949
258010
|
}
|
|
257950
258011
|
});
|
|
257951
258012
|
|
|
@@ -258882,17 +258943,17 @@ function setModifierParam(track2, id3, name2, value3) {
|
|
|
258882
258943
|
return next2;
|
|
258883
258944
|
});
|
|
258884
258945
|
}
|
|
258885
|
-
function setLoopMode(track2, id3,
|
|
258886
|
-
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);
|
|
258887
258948
|
}
|
|
258888
258949
|
function setAudioSignal(track2, id3, signal) {
|
|
258889
258950
|
return change(track2, id3, (m) => m.kind === "audio" && m.signal !== signal ? { ...m, signal, ...signal === "spectrum" && m.bin === void 0 ? { bin: 0.25 } : {} } : m);
|
|
258890
258951
|
}
|
|
258891
|
-
function setAudioMode(track2, id3,
|
|
258952
|
+
function setAudioMode(track2, id3, mode2) {
|
|
258892
258953
|
return change(track2, id3, (m) => {
|
|
258893
|
-
if (m.kind !== "audio" || (m.mode ?? "add") ===
|
|
258894
|
-
const next2 = { ...m, mode };
|
|
258895
|
-
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;
|
|
258896
258957
|
return next2;
|
|
258897
258958
|
});
|
|
258898
258959
|
}
|
|
@@ -260243,10 +260304,10 @@ var init_autokey = __esm({
|
|
|
260243
260304
|
});
|
|
260244
260305
|
|
|
260245
260306
|
// lib/motion/key-selection.ts
|
|
260246
|
-
function selectKeys(sel, refs,
|
|
260247
|
-
if (
|
|
260307
|
+
function selectKeys(sel, refs, mode2) {
|
|
260308
|
+
if (mode2 === "replace") return dedupe2(refs);
|
|
260248
260309
|
const have = new Set(sel.map(keyRefId));
|
|
260249
|
-
if (
|
|
260310
|
+
if (mode2 === "toggle" && refs.length && refs.every((r) => have.has(keyRefId(r)))) {
|
|
260250
260311
|
const drop = new Set(refs.map(keyRefId));
|
|
260251
260312
|
return sel.filter((r) => !drop.has(keyRefId(r)));
|
|
260252
260313
|
}
|
|
@@ -260865,8 +260926,8 @@ function createMotionSlice(set4, get4) {
|
|
|
260865
260926
|
const tr = get4().transport;
|
|
260866
260927
|
if (tr.playing && !tr.loop && tr.end > 0 && transportTime(tr, now2) >= tr.end) put3({ playing: false, playAnchor: null, time: tr.end });
|
|
260867
260928
|
},
|
|
260868
|
-
selectKeys: (refs,
|
|
260869
|
-
const next2 = selectKeys(liveKeys(), refs,
|
|
260929
|
+
selectKeys: (refs, mode2 = "replace") => {
|
|
260930
|
+
const next2 = selectKeys(liveKeys(), refs, mode2);
|
|
260870
260931
|
const cur = get4().keySelection;
|
|
260871
260932
|
if (next2.length || cur.length) set4({ keySelection: next2 });
|
|
260872
260933
|
},
|
|
@@ -261713,8 +261774,8 @@ function scopeOf(doc2, key5, record2) {
|
|
|
261713
261774
|
const c2 = r && doc2.collections?.[r.collectionId];
|
|
261714
261775
|
return withKey(r && c2 ? itemScope(c2, r, vars) : vars, key5);
|
|
261715
261776
|
}
|
|
261716
|
-
function setVariableValue(action3, variable,
|
|
261717
|
-
if (action3.variableToggle) return !
|
|
261777
|
+
function setVariableValue(action3, variable, current5, doc2, key5, record2) {
|
|
261778
|
+
if (action3.variableToggle) return !current5;
|
|
261718
261779
|
if (action3.variableExpression !== void 0 && action3.variableExpression.trim()) {
|
|
261719
261780
|
const v = tryEvaluate(action3.variableExpression, scopeOf(doc2, key5, record2));
|
|
261720
261781
|
return v === void 0 ? void 0 : coerceToVariable(variable.type, v);
|
|
@@ -261739,14 +261800,14 @@ function glideValue(g, now2) {
|
|
|
261739
261800
|
const k2 = g.duration > 0 ? Math.min(1, Math.max(0, (now2 - g.at) / g.duration)) : 1;
|
|
261740
261801
|
return g.from + (g.to - g.from) * ease(k2, g.easing, g.duration, g.spring);
|
|
261741
261802
|
}
|
|
261742
|
-
function startGlide(glides, id3,
|
|
261803
|
+
function startGlide(glides, id3, mode2, from2, to, transition2, now2) {
|
|
261743
261804
|
const rest = { ...glides ?? {} };
|
|
261744
261805
|
delete rest[id3];
|
|
261745
261806
|
const duration3 = transition2?.duration ?? 0;
|
|
261746
261807
|
const prev = glides?.[id3];
|
|
261747
|
-
const start2 = prev && prev.mode ===
|
|
261808
|
+
const start2 = prev && prev.mode === mode2 ? glideValue(prev, now2) : from2;
|
|
261748
261809
|
if (!(duration3 > 0) || typeof start2 !== "number" || typeof to !== "number" || start2 === to) return Object.keys(rest).length ? rest : null;
|
|
261749
|
-
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 } : {} } };
|
|
261750
261811
|
}
|
|
261751
261812
|
var init_variable_glides = __esm({
|
|
261752
261813
|
"lib/motion/variable-glides.ts"() {
|
|
@@ -261761,7 +261822,7 @@ function scrollerOf(nodes, id3) {
|
|
|
261761
261822
|
for (let cur = nodes[id3]?.parentId; cur; cur = nodes[cur]?.parentId) if (scrolls(nodes[cur])) return cur;
|
|
261762
261823
|
return null;
|
|
261763
261824
|
}
|
|
261764
|
-
function placed(doc2, frameId,
|
|
261825
|
+
function placed(doc2, frameId, current5, x2, y) {
|
|
261765
261826
|
const node2 = doc2.nodes[frameId];
|
|
261766
261827
|
if (!scrolls(node2)) return null;
|
|
261767
261828
|
const bounds2 = getNodeBounds(doc2, frameId);
|
|
@@ -261769,8 +261830,8 @@ function placed(doc2, frameId, current4, x2, y) {
|
|
|
261769
261830
|
const maxX = Math.max(0, bounds2.width - node2.width);
|
|
261770
261831
|
const maxY = Math.max(0, bounds2.height - node2.height);
|
|
261771
261832
|
return {
|
|
261772
|
-
x: node2.overflowScrolling === "HORIZONTAL" || node2.overflowScrolling === "BOTH" ? Math.max(0, Math.min(maxX, x2)) :
|
|
261773
|
-
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
|
|
261774
261835
|
};
|
|
261775
261836
|
}
|
|
261776
261837
|
function scrollBy(state, frameId, dx, dy) {
|
|
@@ -262473,7 +262534,7 @@ var init_plugin_store = __esm({
|
|
|
262473
262534
|
toasts: [],
|
|
262474
262535
|
permissionPrompt: null,
|
|
262475
262536
|
managerOpen: false,
|
|
262476
|
-
setInstalled: (
|
|
262537
|
+
setInstalled: (installed4) => set4({ installed: installed4 }),
|
|
262477
262538
|
setManagerOpen: (managerOpen) => set4({ managerOpen }),
|
|
262478
262539
|
upsertSession: (s) => set4((st) => ({ sessions: [...st.sessions.filter((x2) => x2.sessionId !== s.sessionId), s] })),
|
|
262479
262540
|
patchSession: (sessionId, patch2) => set4((st) => ({ sessions: st.sessions.map((x2) => x2.sessionId === sessionId ? { ...x2, ...patch2 } : x2) })),
|
|
@@ -262502,7 +262563,6 @@ function networkSignal(signal, timeoutMs = NETWORK_TIMEOUT_MS) {
|
|
|
262502
262563
|
var import_react3, NETWORK_TIMEOUT_MS, OfflineError;
|
|
262503
262564
|
var init_network = __esm({
|
|
262504
262565
|
"lib/client/network.ts"() {
|
|
262505
|
-
"use strict";
|
|
262506
262566
|
import_react3 = __toESM(require_react());
|
|
262507
262567
|
NETWORK_TIMEOUT_MS = 8e3;
|
|
262508
262568
|
OfflineError = class extends Error {
|
|
@@ -263131,6 +263191,7 @@ function planEntryAction({ home }) {
|
|
|
263131
263191
|
var STORAGE_KEY2, useHyperyTeam, TEAM_PROMPT_ENABLED, TEAM_PROMPTED_KEY, PROMPTED_KEY, useTeamPrompt, started;
|
|
263132
263192
|
var init_team = __esm({
|
|
263133
263193
|
"lib/client/cloud/team.ts"() {
|
|
263194
|
+
"use strict";
|
|
263134
263195
|
init_esm();
|
|
263135
263196
|
init_api4();
|
|
263136
263197
|
init_session();
|
|
@@ -271634,11 +271695,11 @@ function repairTree(nodes, pages2) {
|
|
|
271634
271695
|
});
|
|
271635
271696
|
if (keep.length !== kids.length) put3({ ...node2, childIds: keep });
|
|
271636
271697
|
}
|
|
271637
|
-
const
|
|
271638
|
-
for (const id3 in
|
|
271639
|
-
const node2 =
|
|
271698
|
+
const current5 = out ?? nodes;
|
|
271699
|
+
for (const id3 in current5) {
|
|
271700
|
+
const node2 = current5[id3];
|
|
271640
271701
|
if (pages2.includes(id3)) continue;
|
|
271641
|
-
const parents = (listedBy.get(id3) ?? []).filter((p2) => (
|
|
271702
|
+
const parents = (listedBy.get(id3) ?? []).filter((p2) => (current5[p2].childIds ?? []).includes(id3));
|
|
271642
271703
|
const parent = parents[0] ?? null;
|
|
271643
271704
|
if (parent && node2.parentId !== parent) put3({ ...node2, parentId: parent });
|
|
271644
271705
|
}
|
|
@@ -271684,7 +271745,7 @@ function finishDocument(ydoc, base, nodes) {
|
|
|
271684
271745
|
}
|
|
271685
271746
|
return doc2;
|
|
271686
271747
|
}
|
|
271687
|
-
function applyYEventsToDocument(ydoc,
|
|
271748
|
+
function applyYEventsToDocument(ydoc, current5, events) {
|
|
271688
271749
|
const ynodes = yNodes(ydoc);
|
|
271689
271750
|
const touched = /* @__PURE__ */ new Set();
|
|
271690
271751
|
let structure = false;
|
|
@@ -271702,9 +271763,9 @@ function applyYEventsToDocument(ydoc, current4, events) {
|
|
|
271702
271763
|
structure = true;
|
|
271703
271764
|
}
|
|
271704
271765
|
}
|
|
271705
|
-
let nodes =
|
|
271766
|
+
let nodes = current5.nodes;
|
|
271706
271767
|
if (touched.size) {
|
|
271707
|
-
nodes = { ...
|
|
271768
|
+
nodes = { ...current5.nodes };
|
|
271708
271769
|
for (const id3 of touched) {
|
|
271709
271770
|
if (!isSafeKey(id3)) continue;
|
|
271710
271771
|
const ynode = ynodes.get(id3);
|
|
@@ -271712,9 +271773,9 @@ function applyYEventsToDocument(ydoc, current4, events) {
|
|
|
271712
271773
|
else delete nodes[id3];
|
|
271713
271774
|
}
|
|
271714
271775
|
}
|
|
271715
|
-
if (!touched.size && !structure) return
|
|
271716
|
-
if (!structure && !tree) return { ...
|
|
271717
|
-
return finishDocument(ydoc,
|
|
271776
|
+
if (!touched.size && !structure) return current5;
|
|
271777
|
+
if (!structure && !tree) return { ...current5, nodes };
|
|
271778
|
+
return finishDocument(ydoc, current5, nodes);
|
|
271718
271779
|
}
|
|
271719
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;
|
|
271720
271781
|
var init_ydoc = __esm({
|
|
@@ -272897,12 +272958,12 @@ function startCollabSession(docId, opts) {
|
|
|
272897
272958
|
if (!bound || tr.origin === LOCAL_ORIGIN || !isActive()) return;
|
|
272898
272959
|
if (useEditorStore.getState().isVersionHistoryMode) return;
|
|
272899
272960
|
if (sendTimer) flush();
|
|
272900
|
-
const
|
|
272901
|
-
const sharedCurrent = withoutPrivate(
|
|
272961
|
+
const current5 = useEditorStore.getState().document;
|
|
272962
|
+
const sharedCurrent = withoutPrivate(current5);
|
|
272902
272963
|
const shared = applyYEventsToDocument(ydoc, sharedCurrent, events);
|
|
272903
272964
|
if (shared === sharedCurrent) return;
|
|
272904
|
-
const next2 = repairDocumentPaints(migrateDocumentMotion(restorePrivate(shared,
|
|
272905
|
-
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));
|
|
272906
272967
|
if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent("popcraft-media-retry"));
|
|
272907
272968
|
applyingRemote = true;
|
|
272908
272969
|
synced = shared;
|
|
@@ -273040,9 +273101,9 @@ function withDeadline(p2, ms2) {
|
|
|
273040
273101
|
return Promise.race([p2, deadline]).finally(() => clearTimeout(timer));
|
|
273041
273102
|
}
|
|
273042
273103
|
async function trackOpen(run4, opts = {}) {
|
|
273043
|
-
const
|
|
273044
|
-
if (
|
|
273045
|
-
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 }) };
|
|
273046
273107
|
return run4(joined);
|
|
273047
273108
|
}
|
|
273048
273109
|
const id3 = nextId++;
|
|
@@ -274313,9 +274374,9 @@ function changedBox(a, b, width) {
|
|
|
274313
274374
|
}
|
|
274314
274375
|
function createGifEncoder(width, height, opts, shared) {
|
|
274315
274376
|
const gif = (0, import_gifenc.GIFEncoder)();
|
|
274316
|
-
const
|
|
274377
|
+
const mode2 = opts.palette ?? "global";
|
|
274317
274378
|
const dither = opts.dither ?? "none";
|
|
274318
|
-
const incremental =
|
|
274379
|
+
const incremental = mode2 === "global" && !!shared;
|
|
274319
274380
|
let n = 0;
|
|
274320
274381
|
let pending8 = null;
|
|
274321
274382
|
let canvas = null;
|
|
@@ -274328,7 +274389,7 @@ function createGifEncoder(width, height, opts, shared) {
|
|
|
274328
274389
|
const flush = (keep) => {
|
|
274329
274390
|
const p2 = pending8;
|
|
274330
274391
|
if (!p2) return new Uint8Array(0);
|
|
274331
|
-
const own2 =
|
|
274392
|
+
const own2 = mode2 === "per-frame" || n === 0;
|
|
274332
274393
|
gif.writeFrame(p2.idx, p2.w, p2.h, {
|
|
274333
274394
|
palette: own2 ? p2.palette.colors : void 0,
|
|
274334
274395
|
delay: p2.delay,
|
|
@@ -274350,7 +274411,7 @@ function createGifEncoder(width, height, opts, shared) {
|
|
|
274350
274411
|
return {
|
|
274351
274412
|
frame(rgba, delay3) {
|
|
274352
274413
|
let palette2 = shared;
|
|
274353
|
-
if (
|
|
274414
|
+
if (mode2 === "per-frame" || !palette2) {
|
|
274354
274415
|
const c2 = new PaletteCounter();
|
|
274355
274416
|
c2.add(rgba);
|
|
274356
274417
|
palette2 = c2.palette();
|
|
@@ -275382,18 +275443,18 @@ var init_misc = __esm({
|
|
|
275382
275443
|
/** @internal */
|
|
275383
275444
|
_emit(...args2) {
|
|
275384
275445
|
const [event, data] = args2;
|
|
275385
|
-
const
|
|
275386
|
-
if (!
|
|
275446
|
+
const listeners9 = this._listeners.get(event);
|
|
275447
|
+
if (!listeners9) {
|
|
275387
275448
|
return;
|
|
275388
275449
|
}
|
|
275389
|
-
for (const entry of
|
|
275450
|
+
for (const entry of listeners9) {
|
|
275390
275451
|
try {
|
|
275391
275452
|
entry.fn(data);
|
|
275392
275453
|
} catch (error62) {
|
|
275393
275454
|
console.error(error62);
|
|
275394
275455
|
}
|
|
275395
275456
|
if (entry.once) {
|
|
275396
|
-
|
|
275457
|
+
listeners9.delete(entry);
|
|
275397
275458
|
}
|
|
275398
275459
|
}
|
|
275399
275460
|
}
|
|
@@ -279556,8 +279617,8 @@ var init_mp3_misc = __esm({
|
|
|
279556
279617
|
return 12 * bitrate / sampleRate * 4;
|
|
279557
279618
|
}
|
|
279558
279619
|
};
|
|
279559
|
-
getXingOffset = (mpegVersionId,
|
|
279560
|
-
return mpegVersionId === 3 ?
|
|
279620
|
+
getXingOffset = (mpegVersionId, channel4) => {
|
|
279621
|
+
return mpegVersionId === 3 ? channel4 === 3 ? 21 : 36 : channel4 === 3 ? 13 : 21;
|
|
279561
279622
|
};
|
|
279562
279623
|
readMp3FrameHeader = (word, remainingBytes) => {
|
|
279563
279624
|
const firstByte = word >>> 24;
|
|
@@ -279589,7 +279650,7 @@ var init_mp3_misc = __esm({
|
|
|
279589
279650
|
const bitrateIndex = thirdByte >> 4 & 15;
|
|
279590
279651
|
const frequencyIndex = (thirdByte >> 2 & 3) % 3;
|
|
279591
279652
|
const padding3 = thirdByte >> 1 & 1;
|
|
279592
|
-
const
|
|
279653
|
+
const channel4 = fourthByte >> 6 & 3;
|
|
279593
279654
|
const modeExtension = fourthByte >> 4 & 3;
|
|
279594
279655
|
const copyright = fourthByte >> 3 & 1;
|
|
279595
279656
|
const original = fourthByte >> 2 & 1;
|
|
@@ -279625,7 +279686,7 @@ var init_mp3_misc = __esm({
|
|
|
279625
279686
|
bitrate,
|
|
279626
279687
|
frequencyIndex,
|
|
279627
279688
|
sampleRate,
|
|
279628
|
-
channel:
|
|
279689
|
+
channel: channel4,
|
|
279629
279690
|
modeExtension,
|
|
279630
279691
|
copyright,
|
|
279631
279692
|
original,
|
|
@@ -279650,8 +279711,8 @@ var init_mp3_misc = __esm({
|
|
|
279650
279711
|
XingFlags2[XingFlags2["FileSize"] = 2] = "FileSize";
|
|
279651
279712
|
XingFlags2[XingFlags2["Toc"] = 4] = "Toc";
|
|
279652
279713
|
})(XingFlags || (XingFlags = {}));
|
|
279653
|
-
getMp3ChannelCount = (
|
|
279654
|
-
return
|
|
279714
|
+
getMp3ChannelCount = (channel4) => {
|
|
279715
|
+
return channel4 === 3 ? 1 : 2;
|
|
279655
279716
|
};
|
|
279656
279717
|
}
|
|
279657
279718
|
});
|
|
@@ -290408,10 +290469,10 @@ var init_mpeg_ts_demuxer = __esm({
|
|
|
290408
290469
|
return true;
|
|
290409
290470
|
}
|
|
290410
290471
|
async ensureCurrentPacketHasNext() {
|
|
290411
|
-
const
|
|
290412
|
-
assert2(
|
|
290472
|
+
const current5 = this.decodeOrderPackets[0];
|
|
290473
|
+
assert2(current5);
|
|
290413
290474
|
while (true) {
|
|
290414
|
-
const presentationIndex = this.presentationOrderPackets.indexOf(
|
|
290475
|
+
const presentationIndex = this.presentationOrderPackets.indexOf(current5);
|
|
290415
290476
|
if (presentationIndex !== -1 && presentationIndex <= this.presentationOrderPackets.length - 2) {
|
|
290416
290477
|
break;
|
|
290417
290478
|
}
|
|
@@ -295727,8 +295788,8 @@ var init_sample2 = __esm({
|
|
|
295727
295788
|
while (remainingFrames > 0) {
|
|
295728
295789
|
const framesToCopy = Math.min(maxFramesPerChunk, remainingFrames);
|
|
295729
295790
|
const chunkData = new Float32Array(numberOfChannels * framesToCopy);
|
|
295730
|
-
for (let
|
|
295731
|
-
audioBuffer.copyFromChannel(chunkData.subarray(
|
|
295791
|
+
for (let channel4 = 0; channel4 < numberOfChannels; channel4++) {
|
|
295792
|
+
audioBuffer.copyFromChannel(chunkData.subarray(channel4 * framesToCopy, (channel4 + 1) * framesToCopy), channel4, currentRelativeFrame);
|
|
295732
295793
|
}
|
|
295733
295794
|
yield new _AudioSample({
|
|
295734
295795
|
format: "f32-planar",
|
|
@@ -295761,8 +295822,8 @@ var init_sample2 = __esm({
|
|
|
295761
295822
|
while (remainingFrames > 0) {
|
|
295762
295823
|
const framesToCopy = Math.min(maxFramesPerChunk, remainingFrames);
|
|
295763
295824
|
const chunkData = new Float32Array(numberOfChannels * framesToCopy);
|
|
295764
|
-
for (let
|
|
295765
|
-
audioBuffer.copyFromChannel(chunkData.subarray(
|
|
295825
|
+
for (let channel4 = 0; channel4 < numberOfChannels; channel4++) {
|
|
295826
|
+
audioBuffer.copyFromChannel(chunkData.subarray(channel4 * framesToCopy, (channel4 + 1) * framesToCopy), channel4, currentRelativeFrame);
|
|
295766
295827
|
}
|
|
295767
295828
|
const audioSample = new _AudioSample({
|
|
295768
295829
|
format: "f32-planar",
|
|
@@ -309670,11 +309731,11 @@ function pathBounds(paths) {
|
|
|
309670
309731
|
}
|
|
309671
309732
|
return minX === Infinity ? null : { minX, minY, maxX, maxY };
|
|
309672
309733
|
}
|
|
309673
|
-
function parseColor2(input2,
|
|
309734
|
+
function parseColor2(input2, current5) {
|
|
309674
309735
|
if (!input2) return null;
|
|
309675
309736
|
const s = input2.trim().toLowerCase();
|
|
309676
309737
|
if (!s || s === "none" || s === "transparent") return null;
|
|
309677
|
-
if (s === "currentcolor") return
|
|
309738
|
+
if (s === "currentcolor") return current5 ?? { r: 0, g: 0, b: 0, a: 1 };
|
|
309678
309739
|
const hex10 = s.startsWith("#") ? s.slice(1) : NAMED[s];
|
|
309679
309740
|
if (hex10 && /^[0-9a-f]+$/.test(hex10)) {
|
|
309680
309741
|
const full = hex10.length <= 4 ? hex10.split("").map((c2) => c2 + c2).join("") : hex10;
|
|
@@ -311147,8 +311208,8 @@ function reflectUrl() {
|
|
|
311147
311208
|
const base = documentPath({ linkKey: activeLink?.key, localDocId });
|
|
311148
311209
|
const atSameAddress = window.location.pathname === base.split("?")[0];
|
|
311149
311210
|
const path = atSameAddress ? withDeepLink(base, parseDeepLink(window.location.search)) : base;
|
|
311150
|
-
const
|
|
311151
|
-
if (
|
|
311211
|
+
const current5 = window.location.pathname + (isDesktopTabs() || localDocId || path.includes("?") ? window.location.search : "");
|
|
311212
|
+
if (current5 !== path) window.history.replaceState(null, "", path);
|
|
311152
311213
|
}
|
|
311153
311214
|
function onSyncStatus(fn) {
|
|
311154
311215
|
statusListeners.add(fn);
|
|
@@ -311803,7 +311864,6 @@ async function dispatchShaped(key5, options) {
|
|
|
311803
311864
|
var onViolation;
|
|
311804
311865
|
var init_dispatch = __esm({
|
|
311805
311866
|
"lib/commands/dispatch.ts"() {
|
|
311806
|
-
"use strict";
|
|
311807
311867
|
init_errors();
|
|
311808
311868
|
init_registry();
|
|
311809
311869
|
init_confirm();
|
|
@@ -313017,7 +313077,7 @@ function fitsContainer(result, node2) {
|
|
|
313017
313077
|
if (node2.textAutoResize === "HEIGHT") return result.lines.length <= (node2.characters ?? "").split("\n").length;
|
|
313018
313078
|
return result.contentHeight <= node2.height + 0.5;
|
|
313019
313079
|
}
|
|
313020
|
-
function fitLayout(node2,
|
|
313080
|
+
function fitLayout(node2, mode2, run4) {
|
|
313021
313081
|
const cache11 = /* @__PURE__ */ new Map();
|
|
313022
313082
|
const at4 = (s) => {
|
|
313023
313083
|
let r = cache11.get(s);
|
|
@@ -313030,7 +313090,7 @@ function fitLayout(node2, mode, run4) {
|
|
|
313030
313090
|
const ok2 = (s) => fitsContainer(at4(s), node2);
|
|
313031
313091
|
let lo, hi;
|
|
313032
313092
|
if (ok2(1)) {
|
|
313033
|
-
if (
|
|
313093
|
+
if (mode2 === "SHRINK") return { ...at4(1), fitScale: 1 };
|
|
313034
313094
|
lo = 1;
|
|
313035
313095
|
hi = 2;
|
|
313036
313096
|
while (hi < MAX_SCALE && ok2(hi)) {
|
|
@@ -313247,10 +313307,10 @@ function layoutTextUncached(node2, atlas, cameraZoom = 1) {
|
|
|
313247
313307
|
return bestResult || layoutTextUncached({ ...node2, __isAutosizing: true, fontSize: 2 }, atlas, cameraZoom);
|
|
313248
313308
|
}
|
|
313249
313309
|
if (!isSticky && node2.__fitScale === void 0) {
|
|
313250
|
-
const
|
|
313251
|
-
if (
|
|
313310
|
+
const mode2 = fitModeOf(node2);
|
|
313311
|
+
if (mode2) {
|
|
313252
313312
|
const area4 = !node2.textPath && node2.textAreaRings?.length;
|
|
313253
|
-
const best = fitLayout(node2,
|
|
313313
|
+
const best = fitLayout(node2, mode2, (n, s) => layoutTextUncached({ ...n, __fitScale: s, ...area4 ? { __areaShift: 0 } : {} }, atlas, cameraZoom));
|
|
313254
313314
|
if (!area4 || (node2.textVerticalAlign || node2.verticalAlign || "TOP") === "TOP") return best;
|
|
313255
313315
|
return { ...layoutAreaAligned({ ...scaleTypography(node2, best.fitScale), __fitScale: best.fitScale }, atlas, cameraZoom), fitScale: best.fitScale };
|
|
313256
313316
|
}
|
|
@@ -315471,25 +315531,25 @@ function effectFilter(node2, ctx2, totalMat) {
|
|
|
315471
315531
|
const sigma = (blur) => Math.max(0.5, blur / 3);
|
|
315472
315532
|
const id3 = uid(ctx2, "fx");
|
|
315473
315533
|
let parts = "";
|
|
315474
|
-
let
|
|
315534
|
+
let current5 = "SourceGraphic";
|
|
315475
315535
|
if (drop) {
|
|
315476
315536
|
const [dx, dy] = localOffset(drop.offset.x, drop.offset.y);
|
|
315477
315537
|
const spread2 = drop.spread || 0;
|
|
315478
315538
|
const knock = drop.showBehindTransparent === false;
|
|
315479
315539
|
if (!spread2 && !knock) {
|
|
315480
|
-
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"/>`;
|
|
315481
315541
|
} else {
|
|
315482
|
-
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>`;
|
|
315483
315543
|
}
|
|
315484
|
-
|
|
315544
|
+
current5 = "withdrop";
|
|
315485
315545
|
}
|
|
315486
315546
|
if (inner) {
|
|
315487
315547
|
const [dx, dy] = localOffset(inner.offset.x, inner.offset.y);
|
|
315488
315548
|
const spread2 = inner.spread || 0;
|
|
315489
|
-
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="${
|
|
315490
|
-
|
|
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";
|
|
315491
315551
|
}
|
|
315492
|
-
if (layerBlur) parts += `<feGaussianBlur in="${
|
|
315552
|
+
if (layerBlur) parts += `<feGaussianBlur in="${current5}" stdDeviation="${fmt2(sigma(layerBlur.radius))}"/>`;
|
|
315493
315553
|
ctx2.defs.push(`<filter id="${id3}" ${region}>${parts}</filter>`);
|
|
315494
315554
|
return ` filter="url(#${id3})"`;
|
|
315495
315555
|
}
|
|
@@ -316413,13 +316473,13 @@ ${num7(c2[0])} ${num7(c2[1])} ${num7(c2[2])} ${num7(c2[3])} ${num7(c2[4])} ${num
|
|
|
316413
316473
|
for (const run4 of item.runs) {
|
|
316414
316474
|
this.w(`q /${this.gs(opacity * run4.alpha, 1, blend2)} gs ${this.res.color.fill(run4.color)} BT
|
|
316415
316475
|
`);
|
|
316416
|
-
let
|
|
316476
|
+
let current5 = "";
|
|
316417
316477
|
for (const g of run4.glyphs) {
|
|
316418
316478
|
const { resource, gid } = this.res.fonts.use(g.font, g.gid, g.codePoints);
|
|
316419
|
-
if (resource !==
|
|
316479
|
+
if (resource !== current5) {
|
|
316420
316480
|
this.w(`/${resource} ${num7(run4.size)} Tf
|
|
316421
316481
|
`);
|
|
316422
|
-
|
|
316482
|
+
current5 = resource;
|
|
316423
316483
|
}
|
|
316424
316484
|
this.w(`1 0 0 -1 ${num7(g.x)} ${num7(g.y)} Tm <${gid.toString(16).padStart(4, "0")}> Tj
|
|
316425
316485
|
`);
|
|
@@ -316899,8 +316959,8 @@ var init_color2 = __esm({
|
|
|
316899
316959
|
"use strict";
|
|
316900
316960
|
init_writer2();
|
|
316901
316961
|
ColorOut = class {
|
|
316902
|
-
constructor(
|
|
316903
|
-
this.mode =
|
|
316962
|
+
constructor(mode2) {
|
|
316963
|
+
this.mode = mode2;
|
|
316904
316964
|
}
|
|
316905
316965
|
get colorSpace() {
|
|
316906
316966
|
return this.mode === "CMYK" ? "/DeviceCMYK" : "/DeviceRGB";
|
|
@@ -317209,13 +317269,13 @@ async function encodeImageData(imageData, format, quality = 0.9, dpi) {
|
|
|
317209
317269
|
}
|
|
317210
317270
|
function sliceRegion(node2, doc2) {
|
|
317211
317271
|
let pageId2 = null;
|
|
317212
|
-
let
|
|
317213
|
-
while (
|
|
317214
|
-
if (
|
|
317215
|
-
pageId2 =
|
|
317272
|
+
let current5 = node2;
|
|
317273
|
+
while (current5) {
|
|
317274
|
+
if (current5.type === "PAGE") {
|
|
317275
|
+
pageId2 = current5.id;
|
|
317216
317276
|
break;
|
|
317217
317277
|
}
|
|
317218
|
-
|
|
317278
|
+
current5 = current5.parentId ? doc2.nodes[current5.parentId] : void 0;
|
|
317219
317279
|
}
|
|
317220
317280
|
if (!pageId2) return null;
|
|
317221
317281
|
const page = doc2.nodes[pageId2];
|
|
@@ -318175,8 +318235,8 @@ function provideAgentCapability(name2, impl) {
|
|
|
318175
318235
|
else provided.set(name2, impl);
|
|
318176
318236
|
}
|
|
318177
318237
|
function agentCapability(name2, ctx2) {
|
|
318178
|
-
const
|
|
318179
|
-
if (
|
|
318238
|
+
const installed4 = provided.get(name2);
|
|
318239
|
+
if (installed4) return installed4;
|
|
318180
318240
|
switch (name2) {
|
|
318181
318241
|
case "render":
|
|
318182
318242
|
return renderCapability(ctx2);
|
|
@@ -320111,8 +320171,8 @@ var init_node = __esm({
|
|
|
320111
320171
|
const patches = /* @__PURE__ */ new Map();
|
|
320112
320172
|
for (const id3 of ids2) {
|
|
320113
320173
|
const n = resolvedNodeOrThrow(doc2, id3);
|
|
320114
|
-
const
|
|
320115
|
-
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);
|
|
320116
320176
|
patches.set(id3, { rotation: (next2 % 360 + 360) % 360 });
|
|
320117
320177
|
}
|
|
320118
320178
|
commitUpdates(ctx2, doc2, patches);
|
|
@@ -320125,6 +320185,7 @@ var init_node = __esm({
|
|
|
320125
320185
|
// lib/commands/text.ts
|
|
320126
320186
|
function applyTypeStyle(node2, styles) {
|
|
320127
320187
|
const patch2 = { ...styles };
|
|
320188
|
+
if (node2.textStyleId && Object.keys(styles).some((k2) => TYPOGRAPHY_OVERRIDE_KEYS.has(k2))) patch2.textStyleId = void 0;
|
|
320128
320189
|
const segments = node2.styledSegments;
|
|
320129
320190
|
if (segments?.length) {
|
|
320130
320191
|
const keys4 = Object.keys(styles);
|
|
@@ -320137,7 +320198,7 @@ function applyTypeStyle(node2, styles) {
|
|
|
320137
320198
|
}
|
|
320138
320199
|
return patch2;
|
|
320139
320200
|
}
|
|
320140
|
-
var textSet, TYPE_FIELDS, textSetTypography, textSearchFonts, textSetEffect;
|
|
320201
|
+
var textSet, TYPE_FIELDS, TYPOGRAPHY_OVERRIDE_KEYS, textSetTypography, textSearchFonts, textSetEffect;
|
|
320141
320202
|
var init_text = __esm({
|
|
320142
320203
|
"lib/commands/text.ts"() {
|
|
320143
320204
|
"use strict";
|
|
@@ -320224,6 +320285,20 @@ var init_text = __esm({
|
|
|
320224
320285
|
"textDecoration",
|
|
320225
320286
|
"textAutoResize"
|
|
320226
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
|
+
]);
|
|
320227
320302
|
textSetTypography = defineCommand({
|
|
320228
320303
|
id: "text.setTypography",
|
|
320229
320304
|
title: "Set typography",
|
|
@@ -320247,6 +320322,8 @@ var init_text = __esm({
|
|
|
320247
320322
|
textAutoResize: external_exports.enum(["NONE", "WIDTH_AND_HEIGHT", "HEIGHT"]).optional()
|
|
320248
320323
|
}),
|
|
320249
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 },
|
|
320250
320327
|
plugin: { method: "setTypography" },
|
|
320251
320328
|
agent: {
|
|
320252
320329
|
name: "set_typography",
|
|
@@ -320448,18 +320525,18 @@ var init_text_path2 = __esm({
|
|
|
320448
320525
|
patches.set(t3.id, { textPath: void 0 });
|
|
320449
320526
|
continue;
|
|
320450
320527
|
}
|
|
320451
|
-
const
|
|
320452
|
-
const pathId =
|
|
320453
|
-
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") {
|
|
320454
320531
|
if (!pathId) throw new ToolError("set_text_path with mode PATH needs pathId (or a text and one shape selected).");
|
|
320455
320532
|
const src = nodeOrThrow(doc2, pathId);
|
|
320456
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.`);
|
|
320457
320534
|
}
|
|
320458
|
-
const keep = t3.textPath && t3.textPath.mode ===
|
|
320459
|
-
const closed =
|
|
320460
|
-
const fresh = keep ? {} : closed ? { align: "CENTER", offset: 0.5 } :
|
|
320461
|
-
const tp = { ...keep ?? {}, ...fresh, ...given, mode, ...
|
|
320462
|
-
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;
|
|
320463
320540
|
patches.set(t3.id, { textPath: tp, textArea: void 0 });
|
|
320464
320541
|
}
|
|
320465
320542
|
commitUpdates(ctx2, doc2, patches);
|
|
@@ -320676,6 +320753,8 @@ var init_paint = __esm({
|
|
|
320676
320753
|
remove: external_exports.boolean().optional().describe("Clear all fills.")
|
|
320677
320754
|
}),
|
|
320678
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 },
|
|
320679
320758
|
plugin: { method: "setFills" },
|
|
320680
320759
|
agent: {
|
|
320681
320760
|
name: "set_fills",
|
|
@@ -320688,22 +320767,22 @@ var init_paint = __esm({
|
|
|
320688
320767
|
if (given > 1) throw new ToolError('set_fills takes one of "color", "gradient" or "image", not several.');
|
|
320689
320768
|
if (!given && !args2.remove) throw new ToolError('set_fills needs a "color", a "gradient", an "image" or remove:true.');
|
|
320690
320769
|
const paint = buildPaint(args2);
|
|
320691
|
-
const
|
|
320770
|
+
const mode2 = args2.mode ?? "merge";
|
|
320692
320771
|
const patches = /* @__PURE__ */ new Map();
|
|
320693
320772
|
for (const id3 of ids2) {
|
|
320694
320773
|
const existing = doc2.nodes[id3].fills ?? [];
|
|
320695
320774
|
let fills;
|
|
320696
320775
|
if (args2.remove) fills = [];
|
|
320697
|
-
else if (
|
|
320698
|
-
else if (
|
|
320776
|
+
else if (mode2 === "replace" || !existing.length) fills = [paint];
|
|
320777
|
+
else if (mode2 === "add") fills = [...existing, paint];
|
|
320699
320778
|
else fills = [paint, ...existing.slice(1)];
|
|
320700
320779
|
patches.set(id3, { fills });
|
|
320701
320780
|
}
|
|
320702
320781
|
const what = args2.gradient ? `a ${args2.gradient.type.toLowerCase()} gradient` : args2.image ? "an image" : args2.color;
|
|
320703
320782
|
commitUpdates(ctx2, doc2, patches);
|
|
320704
320783
|
return {
|
|
320705
|
-
summary: args2.remove ? `Cleared fills on ${plural2(ids2.length, "layer")}` : `Filled ${plural2(ids2.length, "layer")} with ${what} (${
|
|
320706
|
-
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 }
|
|
320707
320786
|
};
|
|
320708
320787
|
}
|
|
320709
320788
|
});
|
|
@@ -320729,6 +320808,8 @@ var init_paint = __esm({
|
|
|
320729
320808
|
remove: external_exports.boolean().optional()
|
|
320730
320809
|
}),
|
|
320731
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 },
|
|
320732
320813
|
plugin: { method: "setStrokes" },
|
|
320733
320814
|
agent: {
|
|
320734
320815
|
name: "set_strokes",
|
|
@@ -321320,7 +321401,6 @@ function outerSizeFor(want, inner, outer) {
|
|
|
321320
321401
|
var AUDIENCE_PRESETS, DEFAULT_AUDIENCE_RESOLUTION, MIN_SIDE, MAX_SIDE, FIT_OPEN_SIZE, clampSide, formatResolution, sameResolution, captureSize;
|
|
321321
321402
|
var init_resolution = __esm({
|
|
321322
321403
|
"lib/slides/audience/resolution.ts"() {
|
|
321323
|
-
"use strict";
|
|
321324
321404
|
init_stage_view();
|
|
321325
321405
|
AUDIENCE_PRESETS = [
|
|
321326
321406
|
{ id: "720p", label: "1280 \xD7 720 (720p)", resolution: { kind: "fixed", width: 1280, height: 720 } },
|
|
@@ -321340,6 +321420,222 @@ var init_resolution = __esm({
|
|
|
321340
321420
|
}
|
|
321341
321421
|
});
|
|
321342
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
|
+
|
|
321343
321639
|
// lib/commands/view.ts
|
|
321344
321640
|
async function copyToClipboard(url4) {
|
|
321345
321641
|
try {
|
|
@@ -321348,7 +321644,7 @@ async function copyToClipboard(url4) {
|
|
|
321348
321644
|
if (typeof window !== "undefined") window.prompt("Copy this link:", url4);
|
|
321349
321645
|
}
|
|
321350
321646
|
}
|
|
321351
|
-
var viewGetSelection, viewSelect, viewZoomTo, viewStage, viewPresent, viewZoom, viewCopyLink;
|
|
321647
|
+
var viewGetSelection, viewSelect, viewZoomTo, viewStage, viewScreenLayout, viewPresent, viewZoom, viewCopyLink;
|
|
321352
321648
|
var init_view2 = __esm({
|
|
321353
321649
|
"lib/commands/view.ts"() {
|
|
321354
321650
|
"use strict";
|
|
@@ -321504,6 +321800,36 @@ var init_view2 = __esm({
|
|
|
321504
321800
|
return { summary: on ? "Stage view on: showing only the active frame" : "Stage view off: showing the whole page", data: { on } };
|
|
321505
321801
|
}
|
|
321506
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
|
+
});
|
|
321507
321833
|
viewPresent = defineCommand({
|
|
321508
321834
|
id: "view.present",
|
|
321509
321835
|
title: "Present",
|
|
@@ -323667,9 +323993,9 @@ function siteTokens(doc2) {
|
|
|
323667
323993
|
const vars = [];
|
|
323668
323994
|
for (const v of Object.values(doc2.variables ?? {}).sort((a, b) => a.name.localeCompare(b.name) || a.id.localeCompare(b.id))) {
|
|
323669
323995
|
const values3 = {};
|
|
323670
|
-
for (const [
|
|
323996
|
+
for (const [mode2, value3] of Object.entries(v.valuesByMode ?? {})) {
|
|
323671
323997
|
const css = cssValue(v, value3);
|
|
323672
|
-
if (css !== null) values3[
|
|
323998
|
+
if (css !== null) values3[mode2] = css;
|
|
323673
323999
|
}
|
|
323674
324000
|
if (!Object.keys(values3).length) continue;
|
|
323675
324001
|
let name2 = codeSyntaxFor(v, "WEB");
|
|
@@ -323738,7 +324064,7 @@ var init_tokens2 = __esm({
|
|
|
323738
324064
|
init_dev_mode();
|
|
323739
324065
|
init_paint2();
|
|
323740
324066
|
slug = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "x";
|
|
323741
|
-
modeClass = (collection,
|
|
324067
|
+
modeClass = (collection, mode2) => `pc-${slug(collection.name)}-${slug(mode2.name)}`;
|
|
323742
324068
|
isColor3 = (v) => !!v && typeof v === "object" && "r" in v && "g" in v && "b" in v;
|
|
323743
324069
|
px3 = (name2) => `calc(var(${name2}) * 1px)`;
|
|
323744
324070
|
NUMBER_PROPS = {
|
|
@@ -325555,7 +325881,7 @@ function stateMachineFromDotLottie(input2, id3 = "sm1", name2 = "State machine")
|
|
|
325555
325881
|
transitions[tid] = { id: tid, from: from2, to, ...guards.length ? { guards } : {} };
|
|
325556
325882
|
}
|
|
325557
325883
|
}
|
|
325558
|
-
const
|
|
325884
|
+
const listeners9 = {};
|
|
325559
325885
|
let completeSeen = false;
|
|
325560
325886
|
for (const it of list2(raw.interactions)) {
|
|
325561
325887
|
const type = DOT_INTERACTIONS[String(it.type)];
|
|
@@ -325570,12 +325896,12 @@ function stateMachineFromDotLottie(input2, id3 = "sm1", name2 = "State machine")
|
|
|
325570
325896
|
}
|
|
325571
325897
|
const layer2 = typeof it.layerName === "string" ? input2.nodeByName(it.layerName) : void 0;
|
|
325572
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.`);
|
|
325573
|
-
const lid = freshId3(
|
|
325574
|
-
|
|
325899
|
+
const lid = freshId3(listeners9, "l");
|
|
325900
|
+
listeners9[lid] = { id: lid, type, ...layer2 ? { layer: layer2 } : {}, actions: actions(it.actions) };
|
|
325575
325901
|
}
|
|
325576
325902
|
const initial = typeof raw.initial === "string" ? stateByName.get(raw.initial) : void 0;
|
|
325577
325903
|
return {
|
|
325578
|
-
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 },
|
|
325579
325905
|
notes: [...notes]
|
|
325580
325906
|
};
|
|
325581
325907
|
}
|
|
@@ -328150,7 +328476,7 @@ var init_package = __esm({
|
|
|
328150
328476
|
"packages/runtime/package.json"() {
|
|
328151
328477
|
package_default = {
|
|
328152
328478
|
name: "@popcraft/runtime",
|
|
328153
|
-
version: "0.
|
|
328479
|
+
version: "0.49.0",
|
|
328154
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.",
|
|
328155
328481
|
license: "MIT",
|
|
328156
328482
|
homepage: "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -343360,8 +343686,8 @@ var require_gen_mapping_umd = __commonJS({
|
|
|
343360
343686
|
function getColumnIndex(line, genColumn) {
|
|
343361
343687
|
let index2 = line.length;
|
|
343362
343688
|
for (let i2 = index2 - 1; i2 >= 0; index2 = i2--) {
|
|
343363
|
-
const
|
|
343364
|
-
if (genColumn >=
|
|
343689
|
+
const current5 = line[i2];
|
|
343690
|
+
if (genColumn >= current5[COLUMN]) break;
|
|
343365
343691
|
}
|
|
343366
343692
|
return index2;
|
|
343367
343693
|
}
|
|
@@ -353592,23 +353918,23 @@ async function previewSite(doc2, pageId2, resolvers, media2 = mediaToDataUrl) {
|
|
|
353592
353918
|
return withSiteCode(site, doc2);
|
|
353593
353919
|
}
|
|
353594
353920
|
function startPreview(iframe, player, onMessage2, opts = {}) {
|
|
353595
|
-
const
|
|
353921
|
+
const channel4 = new MessageChannel();
|
|
353596
353922
|
let ready3 = false;
|
|
353597
353923
|
let queue2 = [];
|
|
353598
|
-
|
|
353924
|
+
channel4.port1.onmessage = (e) => {
|
|
353599
353925
|
const m = parseFromFrame(e.data);
|
|
353600
353926
|
if (!m) return;
|
|
353601
353927
|
if (m.type === "ready") {
|
|
353602
353928
|
ready3 = true;
|
|
353603
|
-
for (const q of queue2)
|
|
353929
|
+
for (const q of queue2) channel4.port1.postMessage(q);
|
|
353604
353930
|
queue2 = [];
|
|
353605
353931
|
}
|
|
353606
353932
|
if (m.type === "needCode") {
|
|
353607
|
-
void codeScript().then((js) =>
|
|
353933
|
+
void codeScript().then((js) => channel4.port1.postMessage({ type: "code", js }));
|
|
353608
353934
|
return;
|
|
353609
353935
|
}
|
|
353610
353936
|
if (m.type === "needIsland") {
|
|
353611
|
-
void islandScript().then((js) =>
|
|
353937
|
+
void islandScript().then((js) => channel4.port1.postMessage({ type: "island", js }));
|
|
353612
353938
|
return;
|
|
353613
353939
|
}
|
|
353614
353940
|
onMessage2(m);
|
|
@@ -353616,19 +353942,19 @@ function startPreview(iframe, player, onMessage2, opts = {}) {
|
|
|
353616
353942
|
const onHello = (e) => {
|
|
353617
353943
|
if (e.data !== HELLO_MESSAGE || e.source !== iframe.contentWindow) return;
|
|
353618
353944
|
window.removeEventListener("message", onHello);
|
|
353619
|
-
iframe.contentWindow?.postMessage(PORT_MESSAGE, "*", [
|
|
353945
|
+
iframe.contentWindow?.postMessage(PORT_MESSAGE, "*", [channel4.port2]);
|
|
353620
353946
|
};
|
|
353621
353947
|
window.addEventListener("message", onHello);
|
|
353622
353948
|
iframe.setAttribute("sandbox", "allow-scripts");
|
|
353623
353949
|
iframe.srcdoc = previewDocument(player, opts.cdn);
|
|
353624
353950
|
return {
|
|
353625
353951
|
send(message) {
|
|
353626
|
-
if (ready3)
|
|
353952
|
+
if (ready3) channel4.port1.postMessage(message);
|
|
353627
353953
|
else queue2.push(message);
|
|
353628
353954
|
},
|
|
353629
353955
|
destroy() {
|
|
353630
353956
|
window.removeEventListener("message", onHello);
|
|
353631
|
-
|
|
353957
|
+
channel4.port1.close();
|
|
353632
353958
|
iframe.removeAttribute("srcdoc");
|
|
353633
353959
|
}
|
|
353634
353960
|
};
|
|
@@ -353907,7 +354233,7 @@ function base644(bytes2) {
|
|
|
353907
354233
|
for (let i2 = 0; i2 < bytes2.length; i2 += 32768) bin += String.fromCharCode(...bytes2.subarray(i2, i2 + 32768));
|
|
353908
354234
|
return btoa(bin);
|
|
353909
354235
|
}
|
|
353910
|
-
async function webFontFaces(doc2, trees,
|
|
354236
|
+
async function webFontFaces(doc2, trees, mode2, dir = "fonts") {
|
|
353911
354237
|
const used = new Set(trees.flatMap((t3) => [...fontFamilies(t3).keys()]));
|
|
353912
354238
|
const faces2 = [];
|
|
353913
354239
|
const files = [];
|
|
@@ -353922,7 +354248,7 @@ async function webFontFaces(doc2, trees, mode, dir = "fonts") {
|
|
|
353922
354248
|
const own2 = fontFormat(bytes2) ?? format;
|
|
353923
354249
|
const weight = fontWeightOf(f2), style = fontStyleOf(f2);
|
|
353924
354250
|
let url4;
|
|
353925
|
-
if (
|
|
354251
|
+
if (mode2 === "files") {
|
|
353926
354252
|
const name2 = `${dir}/${slug3(f2.family)}-${weight}${style === "italic" ? "-italic" : ""}.${EXT2[own2]}`;
|
|
353927
354253
|
if (!files.some((x2) => x2.name === name2)) files.push({ name: name2, bytes: bytes2 });
|
|
353928
354254
|
url4 = name2;
|
|
@@ -355682,9 +356008,9 @@ var init_meta = __esm({
|
|
|
355682
356008
|
throw new ToolError("Only one todo may be in_progress at a time.");
|
|
355683
356009
|
}
|
|
355684
356010
|
const done = todos.filter((t3) => t3.status === "done").length;
|
|
355685
|
-
const
|
|
356011
|
+
const current5 = todos.find((t3) => t3.status === "in_progress");
|
|
355686
356012
|
return {
|
|
355687
|
-
summary: todos.length ? `${done}/${todos.length} done${
|
|
356013
|
+
summary: todos.length ? `${done}/${todos.length} done${current5 ? ` \u2014 ${current5.title}` : ""}` : "Cleared the plan",
|
|
355688
356014
|
data: { todos }
|
|
355689
356015
|
};
|
|
355690
356016
|
}
|
|
@@ -355814,14 +356140,14 @@ var init_meta = __esm({
|
|
|
355814
356140
|
});
|
|
355815
356141
|
|
|
355816
356142
|
// lib/ai/schemas.ts
|
|
355817
|
-
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;
|
|
355818
356144
|
var init_schemas3 = __esm({
|
|
355819
356145
|
"lib/ai/schemas.ts"() {
|
|
355820
356146
|
"use strict";
|
|
355821
356147
|
init_zod();
|
|
355822
356148
|
DESIGN_NODE_TYPES = ["FRAME", "TEXT", "RECTANGLE", "ELLIPSE", "LINE"];
|
|
355823
356149
|
DESIGN_FONTS = ["Inter", "Source Serif 4", "JetBrains Mono"];
|
|
355824
|
-
|
|
356150
|
+
layoutMode2 = external_exports.enum(["NONE", "HORIZONTAL", "VERTICAL"]);
|
|
355825
356151
|
align2 = external_exports.enum(["MIN", "CENTER", "MAX", "SPACE_BETWEEN"]);
|
|
355826
356152
|
counterAlign = external_exports.enum(["MIN", "CENTER", "MAX"]);
|
|
355827
356153
|
sizing = external_exports.enum(["FIXED", "HUG", "FILL"]);
|
|
@@ -355840,7 +356166,7 @@ var init_schemas3 = __esm({
|
|
|
355840
356166
|
heightSizing: sizing.nullable()
|
|
355841
356167
|
};
|
|
355842
356168
|
frameLayoutProps = {
|
|
355843
|
-
layout:
|
|
356169
|
+
layout: layoutMode2.nullable().describe("Auto layout direction; prefer VERTICAL/HORIZONTAL for real UI"),
|
|
355844
356170
|
gap: external_exports.number().nullable().describe("Spacing between children in px"),
|
|
355845
356171
|
padding: external_exports.array(external_exports.number()).nullable().describe("[top, right, bottom, left] px"),
|
|
355846
356172
|
primaryAlign: align2.nullable(),
|
|
@@ -356295,14 +356621,14 @@ async function generateDesignIntoPage(opts, signal) {
|
|
|
356295
356621
|
st.zoomToSelection();
|
|
356296
356622
|
return rootIds.length;
|
|
356297
356623
|
}
|
|
356298
|
-
function openSearchItem(item,
|
|
356624
|
+
function openSearchItem(item, mode2 = item.kind === "component" ? "insert" : "select") {
|
|
356299
356625
|
const st = editor();
|
|
356300
356626
|
const node2 = st.document.nodes[item.id];
|
|
356301
356627
|
if (item.kind === "style" || item.kind === "variable" || !node2) {
|
|
356302
356628
|
notice2(`${item.detail}: ${item.name}`);
|
|
356303
356629
|
return;
|
|
356304
356630
|
}
|
|
356305
|
-
if (
|
|
356631
|
+
if (mode2 === "insert" && (node2.type === "COMPONENT" || node2.type === "COMPONENT_SET")) {
|
|
356306
356632
|
guardEditable();
|
|
356307
356633
|
const main2 = node2.type === "COMPONENT_SET" ? st.document.nodes[node2.childIds.find((c2) => st.document.nodes[c2]?.type === "COMPONENT") ?? ""] : node2;
|
|
356308
356634
|
if (!main2) return;
|
|
@@ -359093,9 +359419,9 @@ function applyOp(frame3, sm, op4) {
|
|
|
359093
359419
|
}
|
|
359094
359420
|
case "removeListener": {
|
|
359095
359421
|
if (!sm.listeners[op4.listener]) throw new ToolError(`The machine has no listener "${op4.listener}".`);
|
|
359096
|
-
const { [op4.listener]: _gone, ...
|
|
359422
|
+
const { [op4.listener]: _gone, ...listeners9 } = sm.listeners;
|
|
359097
359423
|
void _gone;
|
|
359098
|
-
return { next: { ...sm, listeners:
|
|
359424
|
+
return { next: { ...sm, listeners: listeners9 } };
|
|
359099
359425
|
}
|
|
359100
359426
|
}
|
|
359101
359427
|
}
|
|
@@ -361902,7 +362228,6 @@ var init_delete_current_file = __esm({
|
|
|
361902
362228
|
var storeOpsSeam;
|
|
361903
362229
|
var init_seams = __esm({
|
|
361904
362230
|
"lib/commands/seams.ts"() {
|
|
361905
|
-
"use strict";
|
|
361906
362231
|
storeOpsSeam = (st) => ({
|
|
361907
362232
|
booleanOperation: (op4) => st().booleanOperation(op4),
|
|
361908
362233
|
flatten: () => st().flattenSelection(),
|
|
@@ -362216,7 +362541,7 @@ function closeAudienceWindow() {
|
|
|
362216
362541
|
} catch {
|
|
362217
362542
|
}
|
|
362218
362543
|
}
|
|
362219
|
-
var CLOSED, status2,
|
|
362544
|
+
var CLOSED, status2, listeners7, emit3, audienceStatus, AUDIENCE_MESSAGES, audienceAvailable, session, NAME2, CANVAS_USAGE;
|
|
362220
362545
|
var init_audience_window = __esm({
|
|
362221
362546
|
"lib/slides/audience/audience-window.ts"() {
|
|
362222
362547
|
init_renderer_registry();
|
|
@@ -362226,10 +362551,10 @@ var init_audience_window = __esm({
|
|
|
362226
362551
|
init_resolution();
|
|
362227
362552
|
CLOSED = { open: false, resolution: null, surface: { width: 0, height: 0 }, capture: { width: 0, height: 0 }, atResolution: true };
|
|
362228
362553
|
status2 = CLOSED;
|
|
362229
|
-
|
|
362554
|
+
listeners7 = /* @__PURE__ */ new Set();
|
|
362230
362555
|
emit3 = (next2) => {
|
|
362231
362556
|
status2 = next2;
|
|
362232
|
-
for (const l of
|
|
362557
|
+
for (const l of listeners7) l();
|
|
362233
362558
|
};
|
|
362234
362559
|
audienceStatus = () => status2;
|
|
362235
362560
|
AUDIENCE_MESSAGES = {
|
|
@@ -362706,7 +363031,7 @@ var init_schema = __esm({
|
|
|
362706
363031
|
// lib/theme/sync.ts
|
|
362707
363032
|
function themeChannel() {
|
|
362708
363033
|
if (typeof BroadcastChannel === "undefined") return null;
|
|
362709
|
-
return
|
|
363034
|
+
return channel3 ??= new BroadcastChannel(CHANNEL3);
|
|
362710
363035
|
}
|
|
362711
363036
|
function announceThemeChange() {
|
|
362712
363037
|
if (typeof window === "undefined") return;
|
|
@@ -362719,13 +363044,13 @@ function announceThemeChange() {
|
|
|
362719
363044
|
} catch {
|
|
362720
363045
|
}
|
|
362721
363046
|
}
|
|
362722
|
-
var
|
|
363047
|
+
var CHANNEL3, THEME_REV_KEY, channel3;
|
|
362723
363048
|
var init_sync3 = __esm({
|
|
362724
363049
|
"lib/theme/sync.ts"() {
|
|
362725
363050
|
"use strict";
|
|
362726
|
-
|
|
363051
|
+
CHANNEL3 = "popcraft-theme";
|
|
362727
363052
|
THEME_REV_KEY = "popcraft-theme-rev";
|
|
362728
|
-
|
|
363053
|
+
channel3 = null;
|
|
362729
363054
|
}
|
|
362730
363055
|
});
|
|
362731
363056
|
|
|
@@ -362886,15 +363211,15 @@ function usePickableThemes() {
|
|
|
362886
363211
|
const userThemes = useThemeStore((s) => s.userThemes);
|
|
362887
363212
|
const pluginThemes = useThemeStore((s) => s.pluginThemes);
|
|
362888
363213
|
const localThemes = useThemeStore((s) => s.localThemes);
|
|
362889
|
-
return (0,
|
|
363214
|
+
return (0, import_react11.useMemo)(() => pickableThemes({ userThemes, pluginThemes, localThemes }), [userThemes, pluginThemes, localThemes]);
|
|
362890
363215
|
}
|
|
362891
|
-
var
|
|
363216
|
+
var import_react11, IDB_KEY, useThemeStore, cssString2, defaultAccent, effectiveAccent;
|
|
362892
363217
|
var init_theme_store = __esm({
|
|
362893
363218
|
"lib/theme/theme-store.ts"() {
|
|
362894
363219
|
init_contrast();
|
|
362895
363220
|
init_idb();
|
|
362896
363221
|
init_esm();
|
|
362897
|
-
|
|
363222
|
+
import_react11 = __toESM(require_react());
|
|
362898
363223
|
init_boot2();
|
|
362899
363224
|
init_builtin();
|
|
362900
363225
|
init_resolve();
|
|
@@ -365879,7 +366204,7 @@ function createAgentRuntime(host) {
|
|
|
365879
366204
|
let loading3 = null;
|
|
365880
366205
|
let active3 = 0;
|
|
365881
366206
|
let waiting3 = [];
|
|
365882
|
-
let
|
|
366207
|
+
let listeners9 = [];
|
|
365883
366208
|
let pendingSaves = 0;
|
|
365884
366209
|
let maxConcurrent = ((__v) => __v == null ? "null" : typeof __v)(host.maxConcurrent) === "number" ? host.maxConcurrent : 4;
|
|
365885
366210
|
let now2 = () => {
|
|
@@ -365892,7 +366217,7 @@ function createAgentRuntime(host) {
|
|
|
365892
366217
|
if (((__v) => __v == null ? "null" : typeof __v)(host.onChange) === "function") {
|
|
365893
366218
|
host.onChange() ?? null;
|
|
365894
366219
|
}
|
|
365895
|
-
for (const l of
|
|
366220
|
+
for (const l of listeners9.slice() ?? null) {
|
|
365896
366221
|
l() ?? null;
|
|
365897
366222
|
}
|
|
365898
366223
|
}
|
|
@@ -366167,12 +366492,12 @@ function createAgentRuntime(host) {
|
|
|
366167
366492
|
}
|
|
366168
366493
|
}, subscribe: (l) => {
|
|
366169
366494
|
{
|
|
366170
|
-
|
|
366495
|
+
listeners9.push(l) ?? null;
|
|
366171
366496
|
return () => {
|
|
366172
366497
|
{
|
|
366173
|
-
let i2 =
|
|
366498
|
+
let i2 = listeners9.indexOf(l) ?? null;
|
|
366174
366499
|
if (i2 >= 0) {
|
|
366175
|
-
|
|
366500
|
+
listeners9.splice(i2, 1) ?? null;
|
|
366176
366501
|
}
|
|
366177
366502
|
}
|
|
366178
366503
|
};
|
|
@@ -366518,8 +366843,8 @@ function indexedDbStore(name2 = "hypery-agents") {
|
|
|
366518
366843
|
req.onsuccess = () => res(req.result);
|
|
366519
366844
|
req.onerror = () => rej(req.error);
|
|
366520
366845
|
}));
|
|
366521
|
-
const tx2 = async (
|
|
366522
|
-
const store6 = (await open4()).transaction("kv",
|
|
366846
|
+
const tx2 = async (mode2, fn) => {
|
|
366847
|
+
const store6 = (await open4()).transaction("kv", mode2).objectStore("kv");
|
|
366523
366848
|
return new Promise((res, rej) => {
|
|
366524
366849
|
const r = fn(store6);
|
|
366525
366850
|
r.onsuccess = () => res(r.result);
|
|
@@ -367720,8 +368045,8 @@ async function reviewUpdate(update3) {
|
|
|
367720
368045
|
}
|
|
367721
368046
|
function acceptUpdate(update3, payload, accept) {
|
|
367722
368047
|
const lib = useLibraries.getState().available.find((l) => l.id === update3.libraryId);
|
|
367723
|
-
const
|
|
367724
|
-
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);
|
|
367725
368050
|
useEditorStore.getState().commitDocument(doc2, `Update library: ${update3.name}`);
|
|
367726
368051
|
computeUpdates();
|
|
367727
368052
|
}
|
|
@@ -368805,8 +369130,8 @@ var init_registry3 = __esm({
|
|
|
368805
369130
|
});
|
|
368806
369131
|
|
|
368807
369132
|
// lib/plugins/panels.ts
|
|
368808
|
-
function pluginPanels(
|
|
368809
|
-
return
|
|
369133
|
+
function pluginPanels(installed4) {
|
|
369134
|
+
return installed4.filter((p2) => p2.enabled).flatMap((p2) => (p2.manifest.contributes?.panels ?? []).map((panel) => ({
|
|
368810
369135
|
tab: pluginPanelTab(p2.manifest.id, panel.id),
|
|
368811
369136
|
pluginId: p2.manifest.id,
|
|
368812
369137
|
pluginName: p2.manifest.name,
|
|
@@ -368814,8 +369139,8 @@ function pluginPanels(installed3) {
|
|
|
368814
369139
|
icon: panel.icon ?? (p2.manifest.icon?.startsWith("data:image/") ? p2.manifest.icon : null)
|
|
368815
369140
|
})));
|
|
368816
369141
|
}
|
|
368817
|
-
function syncPluginTabs(
|
|
368818
|
-
setPluginTabs(new Map(pluginPanels(
|
|
369142
|
+
function syncPluginTabs(installed4) {
|
|
369143
|
+
setPluginTabs(new Map(pluginPanels(installed4).map((p2) => [p2.tab, p2.panel.side ?? "right"])));
|
|
368819
369144
|
}
|
|
368820
369145
|
var pluginPanelTab;
|
|
368821
369146
|
var init_panels = __esm({
|
|
@@ -368873,10 +369198,10 @@ function pluginToolCommand(plugin, tool2) {
|
|
|
368873
369198
|
}
|
|
368874
369199
|
});
|
|
368875
369200
|
}
|
|
368876
|
-
function syncPluginAgentTools(
|
|
369201
|
+
function syncPluginAgentTools(installed4) {
|
|
368877
369202
|
const want = /* @__PURE__ */ new Map();
|
|
368878
369203
|
const nextSources = /* @__PURE__ */ new Map();
|
|
368879
|
-
for (const plugin of
|
|
369204
|
+
for (const plugin of installed4) {
|
|
368880
369205
|
if (!pluginToolsActive(plugin)) continue;
|
|
368881
369206
|
for (const tool2 of plugin.manifest.contributes.agentTools) {
|
|
368882
369207
|
try {
|
|
@@ -373752,7 +374077,7 @@ var init_pdf2 = __esm({
|
|
|
373752
374077
|
get signatureManager() {
|
|
373753
374078
|
return this.#signatureManager;
|
|
373754
374079
|
}
|
|
373755
|
-
switchToMode(
|
|
374080
|
+
switchToMode(mode2, callback) {
|
|
373756
374081
|
this._eventBus.on("annotationeditormodechanged", callback, {
|
|
373757
374082
|
once: true,
|
|
373758
374083
|
signal: this._signal,
|
|
@@ -373760,7 +374085,7 @@ var init_pdf2 = __esm({
|
|
|
373760
374085
|
});
|
|
373761
374086
|
this._eventBus.dispatch("showannotationeditorui", {
|
|
373762
374087
|
source: this,
|
|
373763
|
-
mode
|
|
374088
|
+
mode: mode2
|
|
373764
374089
|
});
|
|
373765
374090
|
}
|
|
373766
374091
|
setPreference(name2, value3) {
|
|
@@ -374412,8 +374737,8 @@ var init_pdf2 = __esm({
|
|
|
374412
374737
|
removeLayer(layer2) {
|
|
374413
374738
|
this.#allLayers.delete(layer2.pageIndex);
|
|
374414
374739
|
}
|
|
374415
|
-
async updateMode(
|
|
374416
|
-
if (this.#mode ===
|
|
374740
|
+
async updateMode(mode2, editId = null, isFromUser = false, isFromKeyboard = false, mustEnterInEditMode = false, editComment = false) {
|
|
374741
|
+
if (this.#mode === mode2) {
|
|
374417
374742
|
return;
|
|
374418
374743
|
}
|
|
374419
374744
|
if (this.#updateModeCapability) {
|
|
@@ -374428,8 +374753,8 @@ var init_pdf2 = __esm({
|
|
|
374428
374753
|
this.#commentManager?.hideSidebar();
|
|
374429
374754
|
}
|
|
374430
374755
|
this.#commentManager?.destroyPopup();
|
|
374431
|
-
this.#mode =
|
|
374432
|
-
if (
|
|
374756
|
+
this.#mode = mode2;
|
|
374757
|
+
if (mode2 === AnnotationEditorType.NONE) {
|
|
374433
374758
|
this.setEditingState(false);
|
|
374434
374759
|
this.#disableAll();
|
|
374435
374760
|
for (const editor2 of this.#allEditors.values()) {
|
|
@@ -374443,7 +374768,7 @@ var init_pdf2 = __esm({
|
|
|
374443
374768
|
for (const editor2 of this.#allEditors.values()) {
|
|
374444
374769
|
editor2.addStandaloneCommentButton();
|
|
374445
374770
|
}
|
|
374446
|
-
if (
|
|
374771
|
+
if (mode2 === AnnotationEditorType.SIGNATURE) {
|
|
374447
374772
|
await this.#signatureManager?.loadSignatures();
|
|
374448
374773
|
}
|
|
374449
374774
|
if (isFromUser) {
|
|
@@ -374453,9 +374778,9 @@ var init_pdf2 = __esm({
|
|
|
374453
374778
|
await this.#enableAll();
|
|
374454
374779
|
this.unselectAll();
|
|
374455
374780
|
for (const layer2 of this.#allLayers.values()) {
|
|
374456
|
-
layer2.updateMode(
|
|
374781
|
+
layer2.updateMode(mode2);
|
|
374457
374782
|
}
|
|
374458
|
-
if (
|
|
374783
|
+
if (mode2 === AnnotationEditorType.POPUP) {
|
|
374459
374784
|
this.#allEditableAnnotations ||= await this.#pdfDocument.getAnnotationsByType(new Set(this.#editorTypes.map((editorClass) => editorClass._editorType)));
|
|
374460
374785
|
const elementIds = /* @__PURE__ */ new Set();
|
|
374461
374786
|
const allComments = [];
|
|
@@ -380949,20 +381274,20 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
380949
381274
|
graphics.current.updateClipFromPath();
|
|
380950
381275
|
}
|
|
380951
381276
|
setFillAndStrokeStyleToContext(graphics, paintType, color4) {
|
|
380952
|
-
const context = graphics.ctx,
|
|
380953
|
-
|
|
381277
|
+
const context = graphics.ctx, current5 = graphics.current;
|
|
381278
|
+
current5.patternFill = current5.patternStroke = false;
|
|
380954
381279
|
switch (paintType) {
|
|
380955
381280
|
case PaintType.COLORED:
|
|
380956
381281
|
const {
|
|
380957
381282
|
fillStyle,
|
|
380958
381283
|
strokeStyle
|
|
380959
381284
|
} = this.ctx;
|
|
380960
|
-
context.fillStyle =
|
|
380961
|
-
context.strokeStyle =
|
|
381285
|
+
context.fillStyle = current5.fillColor = fillStyle;
|
|
381286
|
+
context.strokeStyle = current5.strokeColor = strokeStyle;
|
|
380962
381287
|
break;
|
|
380963
381288
|
case PaintType.UNCOLORED:
|
|
380964
381289
|
context.fillStyle = context.strokeStyle = color4;
|
|
380965
|
-
|
|
381290
|
+
current5.fillColor = current5.strokeColor = color4;
|
|
380966
381291
|
break;
|
|
380967
381292
|
default:
|
|
380968
381293
|
throw new FormatError2(`Unsupported paint type: ${paintType}`);
|
|
@@ -382199,19 +382524,19 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382199
382524
|
setFont(opIdx, fontRefName, size6) {
|
|
382200
382525
|
this.dependencyTracker?.recordSimpleData("font", opIdx).recordSimpleDataFromNamed("fontObj", fontRefName, opIdx);
|
|
382201
382526
|
const fontObj = this.commonObjs.get(fontRefName);
|
|
382202
|
-
const
|
|
382527
|
+
const current5 = this.current;
|
|
382203
382528
|
if (!fontObj) {
|
|
382204
382529
|
throw new Error(`Can't find font for ${fontRefName}`);
|
|
382205
382530
|
}
|
|
382206
|
-
|
|
382207
|
-
if (
|
|
382531
|
+
current5.fontMatrix = fontObj.fontMatrix || FONT_IDENTITY_MATRIX;
|
|
382532
|
+
if (current5.fontMatrix[0] === 0 || current5.fontMatrix[3] === 0) {
|
|
382208
382533
|
warn3("Invalid font matrix for font " + fontRefName);
|
|
382209
382534
|
}
|
|
382210
382535
|
if (size6 < 0) {
|
|
382211
382536
|
size6 = -size6;
|
|
382212
|
-
|
|
382537
|
+
current5.fontDirection = -1;
|
|
382213
382538
|
} else {
|
|
382214
|
-
|
|
382539
|
+
current5.fontDirection = 1;
|
|
382215
382540
|
}
|
|
382216
382541
|
this.current.font = fontObj;
|
|
382217
382542
|
this.current.fontSize = size6;
|
|
@@ -382231,9 +382556,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382231
382556
|
this.current.fontSizeScale = size6 / browserFontSize;
|
|
382232
382557
|
this.ctx.font = `${italic} ${bold} ${browserFontSize}px ${typeface}`;
|
|
382233
382558
|
}
|
|
382234
|
-
setTextRenderingMode(opIdx,
|
|
382559
|
+
setTextRenderingMode(opIdx, mode2) {
|
|
382235
382560
|
this.dependencyTracker?.recordSimpleData("textRenderingMode", opIdx);
|
|
382236
|
-
this.current.textRenderingMode =
|
|
382561
|
+
this.current.textRenderingMode = mode2;
|
|
382237
382562
|
}
|
|
382238
382563
|
setTextRise(opIdx, rise) {
|
|
382239
382564
|
this.dependencyTracker?.recordSimpleData("textRise", opIdx);
|
|
@@ -382251,12 +382576,12 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382251
382576
|
setTextMatrix(opIdx, matrix) {
|
|
382252
382577
|
this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix", opIdx);
|
|
382253
382578
|
const {
|
|
382254
|
-
current:
|
|
382579
|
+
current: current5
|
|
382255
382580
|
} = this;
|
|
382256
|
-
|
|
382257
|
-
|
|
382258
|
-
|
|
382259
|
-
|
|
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;
|
|
382260
382585
|
}
|
|
382261
382586
|
nextLine(opIdx) {
|
|
382262
382587
|
this.moveText(opIdx, 0, this.current.leading);
|
|
@@ -382269,14 +382594,14 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382269
382594
|
}
|
|
382270
382595
|
paintChar(opIdx, character, x2, y, patternFillTransform, patternStrokeTransform) {
|
|
382271
382596
|
const ctx2 = this.ctx;
|
|
382272
|
-
const
|
|
382273
|
-
const font =
|
|
382274
|
-
const textRenderingMode =
|
|
382275
|
-
const fontSize =
|
|
382597
|
+
const current5 = this.current;
|
|
382598
|
+
const font = current5.font;
|
|
382599
|
+
const textRenderingMode = current5.textRenderingMode;
|
|
382600
|
+
const fontSize = current5.fontSize / current5.fontSizeScale;
|
|
382276
382601
|
const fillStrokeMode = textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
382277
382602
|
const isAddToPathSet = !!(textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
|
|
382278
|
-
const patternFill =
|
|
382279
|
-
const patternStroke =
|
|
382603
|
+
const patternFill = current5.patternFill && !font.missingFile;
|
|
382604
|
+
const patternStroke = current5.patternStroke && !font.missingFile;
|
|
382280
382605
|
let path;
|
|
382281
382606
|
if ((font.disableFontFace || isAddToPathSet || patternFill || patternStroke) && !font.missingFile) {
|
|
382282
382607
|
path = font.getPathGenerator(this.commonObjs, character);
|
|
@@ -382365,49 +382690,49 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382365
382690
|
this.dependencyTracker.recordFutureForcedDependency("textClip", opIdx).inheritPendingDependenciesAsFutureForcedDependencies();
|
|
382366
382691
|
}
|
|
382367
382692
|
}
|
|
382368
|
-
const
|
|
382369
|
-
const font =
|
|
382693
|
+
const current5 = this.current;
|
|
382694
|
+
const font = current5.font;
|
|
382370
382695
|
if (font.isType3Font) {
|
|
382371
|
-
const started9 = this.#beginKnockoutElement(
|
|
382696
|
+
const started9 = this.#beginKnockoutElement(current5.fillAlpha);
|
|
382372
382697
|
this.showType3Text(opIdx, glyphs);
|
|
382373
382698
|
this.dependencyTracker?.recordShowTextOperation(opIdx);
|
|
382374
382699
|
this.#endKnockoutElement(started9);
|
|
382375
382700
|
return;
|
|
382376
382701
|
}
|
|
382377
|
-
const fontSize =
|
|
382702
|
+
const fontSize = current5.fontSize;
|
|
382378
382703
|
if (fontSize === 0) {
|
|
382379
382704
|
this.dependencyTracker?.recordOperation(opIdx);
|
|
382380
382705
|
return;
|
|
382381
382706
|
}
|
|
382382
|
-
const started8 = this.#beginKnockoutElement(
|
|
382707
|
+
const started8 = this.#beginKnockoutElement(current5.fillAlpha);
|
|
382383
382708
|
const ctx2 = this.ctx;
|
|
382384
|
-
const fontSizeScale =
|
|
382385
|
-
const charSpacing =
|
|
382386
|
-
const wordSpacing =
|
|
382387
|
-
const fontDirection =
|
|
382388
|
-
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;
|
|
382389
382714
|
const glyphsLength = glyphs.length;
|
|
382390
382715
|
const vertical = font.vertical;
|
|
382391
382716
|
const spacingDir = vertical ? 1 : -1;
|
|
382392
382717
|
const defaultVMetrics = font.defaultVMetrics;
|
|
382393
|
-
const widthAdvanceScale = fontSize *
|
|
382394
|
-
const simpleFillText =
|
|
382718
|
+
const widthAdvanceScale = fontSize * current5.fontMatrix[0];
|
|
382719
|
+
const simpleFillText = current5.textRenderingMode === TextRenderingMode.FILL && !font.disableFontFace && !current5.patternFill;
|
|
382395
382720
|
ctx2.save();
|
|
382396
|
-
if (
|
|
382397
|
-
ctx2.transform(...
|
|
382721
|
+
if (current5.textMatrix) {
|
|
382722
|
+
ctx2.transform(...current5.textMatrix);
|
|
382398
382723
|
}
|
|
382399
|
-
ctx2.translate(
|
|
382724
|
+
ctx2.translate(current5.x, current5.y + current5.textRise);
|
|
382400
382725
|
if (fontDirection > 0) {
|
|
382401
382726
|
ctx2.scale(textHScale, -1);
|
|
382402
382727
|
} else {
|
|
382403
382728
|
ctx2.scale(textHScale, 1);
|
|
382404
382729
|
}
|
|
382405
382730
|
let patternFillTransform, patternStrokeTransform;
|
|
382406
|
-
const fillStrokeMode =
|
|
382731
|
+
const fillStrokeMode = current5.textRenderingMode & TextRenderingMode.FILL_STROKE_MASK;
|
|
382407
382732
|
const needsFill = fillStrokeMode === TextRenderingMode.FILL || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
382408
382733
|
const needsStroke = fillStrokeMode === TextRenderingMode.STROKE || fillStrokeMode === TextRenderingMode.FILL_STROKE;
|
|
382409
|
-
let lineWidth2 =
|
|
382410
|
-
const scale =
|
|
382734
|
+
let lineWidth2 = current5.lineWidth;
|
|
382735
|
+
const scale = current5.textMatrixScale;
|
|
382411
382736
|
if (scale === 0 || lineWidth2 === 0) {
|
|
382412
382737
|
if (needsStroke) {
|
|
382413
382738
|
lineWidth2 = this.getSinglePixelWidth();
|
|
@@ -382420,16 +382745,16 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382420
382745
|
lineWidth2 /= fontSizeScale;
|
|
382421
382746
|
}
|
|
382422
382747
|
ctx2.lineWidth = lineWidth2;
|
|
382423
|
-
if (needsFill &&
|
|
382748
|
+
if (needsFill && current5.patternFill) {
|
|
382424
382749
|
ctx2.save();
|
|
382425
|
-
const pattern =
|
|
382750
|
+
const pattern = current5.fillColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.FILL, opIdx);
|
|
382426
382751
|
patternFillTransform = getCurrentTransform(ctx2);
|
|
382427
382752
|
ctx2.restore();
|
|
382428
382753
|
ctx2.fillStyle = pattern;
|
|
382429
382754
|
}
|
|
382430
|
-
if (needsStroke &&
|
|
382755
|
+
if (needsStroke && current5.patternStroke) {
|
|
382431
382756
|
ctx2.save();
|
|
382432
|
-
const pattern =
|
|
382757
|
+
const pattern = current5.strokeColor.getPattern(ctx2, this, getCurrentTransformInverse(ctx2), PathType.STROKE, opIdx);
|
|
382433
382758
|
patternStrokeTransform = getCurrentTransform(ctx2);
|
|
382434
382759
|
ctx2.restore();
|
|
382435
382760
|
ctx2.strokeStyle = pattern;
|
|
@@ -382447,7 +382772,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382447
382772
|
const measure4 = ctx2.measureText(joinedChars);
|
|
382448
382773
|
this.dependencyTracker.recordBBox(opIdx, this.ctx, -measure4.actualBoundingBoxLeft, measure4.actualBoundingBoxRight, -measure4.actualBoundingBoxAscent, measure4.actualBoundingBoxDescent).recordShowTextOperation(opIdx);
|
|
382449
382774
|
}
|
|
382450
|
-
|
|
382775
|
+
current5.x += width * widthAdvanceScale * textHScale;
|
|
382451
382776
|
ctx2.restore();
|
|
382452
382777
|
this.compose();
|
|
382453
382778
|
this.#endKnockoutElement(started8);
|
|
@@ -382513,9 +382838,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382513
382838
|
}
|
|
382514
382839
|
}
|
|
382515
382840
|
if (vertical) {
|
|
382516
|
-
|
|
382841
|
+
current5.y -= x2;
|
|
382517
382842
|
} else {
|
|
382518
|
-
|
|
382843
|
+
current5.x += x2 * textHScale;
|
|
382519
382844
|
}
|
|
382520
382845
|
ctx2.restore();
|
|
382521
382846
|
this.compose();
|
|
@@ -382524,17 +382849,17 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382524
382849
|
}
|
|
382525
382850
|
showType3Text(opIdx, glyphs) {
|
|
382526
382851
|
const ctx2 = this.ctx;
|
|
382527
|
-
const
|
|
382528
|
-
const font =
|
|
382529
|
-
const fontSize =
|
|
382530
|
-
const fontDirection =
|
|
382852
|
+
const current5 = this.current;
|
|
382853
|
+
const font = current5.font;
|
|
382854
|
+
const fontSize = current5.fontSize;
|
|
382855
|
+
const fontDirection = current5.fontDirection;
|
|
382531
382856
|
const spacingDir = font.vertical ? 1 : -1;
|
|
382532
|
-
const charSpacing =
|
|
382533
|
-
const wordSpacing =
|
|
382534
|
-
const textHScale =
|
|
382535
|
-
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;
|
|
382536
382861
|
const glyphsLength = glyphs.length;
|
|
382537
|
-
const isTextInvisible =
|
|
382862
|
+
const isTextInvisible = current5.textRenderingMode === TextRenderingMode.INVISIBLE;
|
|
382538
382863
|
let i2, glyph2, width, spacingLength;
|
|
382539
382864
|
if (isTextInvisible || fontSize === 0) {
|
|
382540
382865
|
return;
|
|
@@ -382542,10 +382867,10 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382542
382867
|
this._cachedScaleForStroking[0] = -1;
|
|
382543
382868
|
this._cachedGetSinglePixelWidth = null;
|
|
382544
382869
|
ctx2.save();
|
|
382545
|
-
if (
|
|
382546
|
-
ctx2.transform(...
|
|
382870
|
+
if (current5.textMatrix) {
|
|
382871
|
+
ctx2.transform(...current5.textMatrix);
|
|
382547
382872
|
}
|
|
382548
|
-
ctx2.translate(
|
|
382873
|
+
ctx2.translate(current5.x, current5.y + current5.textRise);
|
|
382549
382874
|
ctx2.scale(textHScale, fontDirection);
|
|
382550
382875
|
const dependencyTracker = this.dependencyTracker;
|
|
382551
382876
|
this.dependencyTracker = dependencyTracker ? new CanvasNestedDependencyTracker(dependencyTracker, opIdx) : null;
|
|
@@ -382554,7 +382879,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382554
382879
|
if (typeof glyph2 === "number") {
|
|
382555
382880
|
spacingLength = spacingDir * glyph2 * fontSize / 1e3;
|
|
382556
382881
|
this.ctx.translate(spacingLength, 0);
|
|
382557
|
-
|
|
382882
|
+
current5.x += spacingLength * textHScale;
|
|
382558
382883
|
continue;
|
|
382559
382884
|
}
|
|
382560
382885
|
const spacing = (glyph2.isSpace ? wordSpacing : 0) + charSpacing;
|
|
@@ -382564,7 +382889,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382564
382889
|
} else if (this.contentVisible) {
|
|
382565
382890
|
this.save();
|
|
382566
382891
|
if (operatorList.fnArray[0] === OPS2.setCharWidth) {
|
|
382567
|
-
|
|
382892
|
+
current5.fillAlpha = current5.strokeAlpha = 1;
|
|
382568
382893
|
ctx2.globalAlpha = 1;
|
|
382569
382894
|
}
|
|
382570
382895
|
ctx2.scale(fontSize, fontSize);
|
|
@@ -382576,7 +382901,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
382576
382901
|
Util.applyTransform(p2, fontMatrix);
|
|
382577
382902
|
width = p2[0] * fontSize + spacing;
|
|
382578
382903
|
ctx2.translate(width, 0);
|
|
382579
|
-
|
|
382904
|
+
current5.x += width * textHScale;
|
|
382580
382905
|
}
|
|
382581
382906
|
ctx2.restore();
|
|
382582
382907
|
if (dependencyTracker) {
|
|
@@ -387988,7 +388313,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
387988
388313
|
return;
|
|
387989
388314
|
}
|
|
387990
388315
|
const {
|
|
387991
|
-
annotationEditorType:
|
|
388316
|
+
annotationEditorType: mode2,
|
|
387992
388317
|
data: {
|
|
387993
388318
|
id: editId
|
|
387994
388319
|
}
|
|
@@ -387996,7 +388321,7 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
387996
388321
|
this.container.addEventListener("dblclick", () => {
|
|
387997
388322
|
this.linkService.eventBus?.dispatch("switchannotationeditormode", {
|
|
387998
388323
|
source: this,
|
|
387999
|
-
mode,
|
|
388324
|
+
mode: mode2,
|
|
388000
388325
|
editId,
|
|
388001
388326
|
mustEnterInEditMode: true
|
|
388002
388327
|
});
|
|
@@ -396353,9 +396678,9 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
396353
396678
|
updateToolbar(options) {
|
|
396354
396679
|
this.#uiManager.updateToolbar(options);
|
|
396355
396680
|
}
|
|
396356
|
-
updateMode(
|
|
396681
|
+
updateMode(mode2 = this.#uiManager.getMode()) {
|
|
396357
396682
|
this.#cleanup();
|
|
396358
|
-
switch (
|
|
396683
|
+
switch (mode2) {
|
|
396359
396684
|
case AnnotationEditorType.NONE:
|
|
396360
396685
|
this.div.classList.toggle("nonEditing", true);
|
|
396361
396686
|
this.disableTextSelection();
|
|
@@ -396383,12 +396708,12 @@ fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
|
|
|
396383
396708
|
classList
|
|
396384
396709
|
} = this.div;
|
|
396385
396710
|
classList.toggle("nonEditing", false);
|
|
396386
|
-
if (
|
|
396711
|
+
if (mode2 === AnnotationEditorType.POPUP) {
|
|
396387
396712
|
classList.toggle("commentEditing", true);
|
|
396388
396713
|
} else {
|
|
396389
396714
|
classList.toggle("commentEditing", false);
|
|
396390
396715
|
for (const editorType of _AnnotationEditorLayer.#editorTypes.values()) {
|
|
396391
|
-
classList.toggle(`${editorType._type}Editing`,
|
|
396716
|
+
classList.toggle(`${editorType._type}Editing`, mode2 === editorType._editorType);
|
|
396392
396717
|
}
|
|
396393
396718
|
}
|
|
396394
396719
|
this.div.hidden = false;
|
|
@@ -398447,17 +398772,17 @@ function runningSessionFor(pluginId) {
|
|
|
398447
398772
|
return [...running3.values()].find((s) => s.plugin.manifest.id === pluginId);
|
|
398448
398773
|
}
|
|
398449
398774
|
async function refreshInstalledPlugins() {
|
|
398450
|
-
const
|
|
398451
|
-
syncPluginTabs(
|
|
398452
|
-
usePluginStore.getState().setInstalled(
|
|
398453
|
-
syncPluginThemes(
|
|
398454
|
-
syncPluginAgentTools(
|
|
398775
|
+
const installed4 = await listPlugins();
|
|
398776
|
+
syncPluginTabs(installed4);
|
|
398777
|
+
usePluginStore.getState().setInstalled(installed4);
|
|
398778
|
+
syncPluginThemes(installed4);
|
|
398779
|
+
syncPluginAgentTools(installed4);
|
|
398455
398780
|
}
|
|
398456
|
-
function syncPluginThemes(
|
|
398781
|
+
function syncPluginThemes(installed4) {
|
|
398457
398782
|
const themes = useThemeStore.getState();
|
|
398458
|
-
const live = new Set(
|
|
398783
|
+
const live = new Set(installed4.map((p2) => p2.manifest.id));
|
|
398459
398784
|
for (const id3 of Object.keys(themes.pluginThemes)) if (!live.has(id3)) themes.setPluginThemes(id3, []);
|
|
398460
|
-
for (const p2 of
|
|
398785
|
+
for (const p2 of installed4) themes.setPluginThemes(p2.manifest.id, p2.enabled ? p2.themes ?? [] : []);
|
|
398461
398786
|
}
|
|
398462
398787
|
async function installPluginPayload(payload, opts = {}) {
|
|
398463
398788
|
const rec = await installPlugin(payload);
|
|
@@ -398507,13 +398832,13 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
398507
398832
|
iframe.style.display = "none";
|
|
398508
398833
|
iframe.dataset.popcraftPlugin = pluginId;
|
|
398509
398834
|
iframe.srcdoc = withAgentToolsShim(withWasmEvalCsp(buildMainDocument(plugin.mainCode, granted.includes("network"))));
|
|
398510
|
-
const
|
|
398835
|
+
const channel4 = new MessageChannel();
|
|
398511
398836
|
const session3 = {
|
|
398512
398837
|
sessionId,
|
|
398513
398838
|
plugin,
|
|
398514
398839
|
granted,
|
|
398515
398840
|
iframe,
|
|
398516
|
-
port:
|
|
398841
|
+
port: channel4.port1,
|
|
398517
398842
|
uiPort: null,
|
|
398518
398843
|
pendingToUI: [],
|
|
398519
398844
|
unsubscribers: [],
|
|
@@ -398524,7 +398849,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
398524
398849
|
exportRequest: opts.exportRequest ?? null,
|
|
398525
398850
|
env: null,
|
|
398526
398851
|
tools: createToolChannel((event, data) => {
|
|
398527
|
-
if (running3.has(sessionId))
|
|
398852
|
+
if (running3.has(sessionId)) channel4.port1.postMessage({ kind: "event", event, data });
|
|
398528
398853
|
}, plugin.manifest.name)
|
|
398529
398854
|
};
|
|
398530
398855
|
running3.set(sessionId, session3);
|
|
@@ -398607,15 +398932,15 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
398607
398932
|
}
|
|
398608
398933
|
};
|
|
398609
398934
|
session3.env = env;
|
|
398610
|
-
|
|
398935
|
+
channel4.port1.onmessage = async (ev) => {
|
|
398611
398936
|
const m = ev.data;
|
|
398612
398937
|
if (!running3.has(sessionId)) return;
|
|
398613
398938
|
if (m.kind === "rpc" && typeof m.id === "number" && typeof m.method === "string") {
|
|
398614
398939
|
try {
|
|
398615
398940
|
const result = await handlePluginCall(env, m.method, m.params ?? {});
|
|
398616
|
-
if (running3.has(sessionId))
|
|
398941
|
+
if (running3.has(sessionId)) channel4.port1.postMessage({ kind: "result", id: m.id, result });
|
|
398617
398942
|
} catch (err2) {
|
|
398618
|
-
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) });
|
|
398619
398944
|
}
|
|
398620
398945
|
} else if (m.kind === "toUI") {
|
|
398621
398946
|
if (session3.uiPort) session3.uiPort.postMessage({ kind: "event", event: "message", data: m.data });
|
|
@@ -398627,7 +398952,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
398627
398952
|
}
|
|
398628
398953
|
};
|
|
398629
398954
|
iframe.addEventListener("load", () => {
|
|
398630
|
-
iframe.contentWindow?.postMessage({ type: "popcraft-plugin-port" }, "*", [
|
|
398955
|
+
iframe.contentWindow?.postMessage({ type: "popcraft-plugin-port" }, "*", [channel4.port2]);
|
|
398631
398956
|
post(session3, "init", {
|
|
398632
398957
|
command,
|
|
398633
398958
|
importMode: session3.importMode,
|
|
@@ -398662,15 +398987,15 @@ function attachPluginUI(sessionId, iframe) {
|
|
|
398662
398987
|
const session3 = running3.get(sessionId);
|
|
398663
398988
|
if (!session3 || !iframe.contentWindow) return;
|
|
398664
398989
|
session3.uiPort?.close();
|
|
398665
|
-
const
|
|
398666
|
-
session3.uiPort =
|
|
398667
|
-
|
|
398990
|
+
const channel4 = new MessageChannel();
|
|
398991
|
+
session3.uiPort = channel4.port1;
|
|
398992
|
+
channel4.port1.onmessage = (ev) => {
|
|
398668
398993
|
const m = ev.data;
|
|
398669
398994
|
if (m.kind === "fromUI") post(session3, "uimessage", m.data);
|
|
398670
398995
|
else if (m.kind === "closeUI") usePluginStore.getState().patchSession(sessionId, { ui: null });
|
|
398671
398996
|
};
|
|
398672
|
-
iframe.contentWindow.postMessage({ type: "popcraft-plugin-port" }, "*", [
|
|
398673
|
-
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 });
|
|
398674
398999
|
}
|
|
398675
399000
|
function pluginUIDocument(sessionId) {
|
|
398676
399001
|
const s = running3.get(sessionId);
|
|
@@ -398702,8 +399027,8 @@ async function ensureBackgroundSession(pluginId, command) {
|
|
|
398702
399027
|
}
|
|
398703
399028
|
async function callPluginTool(plugin, tool2, args2, options) {
|
|
398704
399029
|
const id3 = plugin.manifest.id;
|
|
398705
|
-
const
|
|
398706
|
-
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`);
|
|
398707
399032
|
const session3 = await ensureBackgroundSession(id3, "agent");
|
|
398708
399033
|
if (!session3?.env) throw new Error(`${plugin.manifest.name} could not start`);
|
|
398709
399034
|
const env = session3.env;
|
|
@@ -398773,13 +399098,13 @@ var init_host3 = __esm({
|
|
|
398773
399098
|
const d = e.data;
|
|
398774
399099
|
if (!d) return;
|
|
398775
399100
|
if (d.type !== "popcraft-import-as-new" && d.type !== "popcraft-import-into-current") return;
|
|
398776
|
-
const
|
|
399101
|
+
const mode2 = d.type === "popcraft-import-as-new" ? "new" : "into-current";
|
|
398777
399102
|
const name2 = d.name || "Imported";
|
|
398778
399103
|
void (async () => {
|
|
398779
399104
|
try {
|
|
398780
399105
|
const { importViaPlugin: importViaPlugin2, applyPluginLayoutIr: applyPluginLayoutIr2 } = await Promise.resolve().then(() => (init_plugin_import(), plugin_import_exports));
|
|
398781
399106
|
if (d.ir && typeof d.ir === "object") {
|
|
398782
|
-
await applyPluginLayoutIr2(d.ir, { mode, name: name2 });
|
|
399107
|
+
await applyPluginLayoutIr2(d.ir, { mode: mode2, name: name2 });
|
|
398783
399108
|
return;
|
|
398784
399109
|
}
|
|
398785
399110
|
if (typeof d.dataUrl !== "string") return;
|
|
@@ -398788,7 +399113,7 @@ var init_host3 = __esm({
|
|
|
398788
399113
|
const bytes2 = new Uint8Array(bin.length);
|
|
398789
399114
|
for (let i2 = 0; i2 < bin.length; i2++) bytes2[i2] = bin.charCodeAt(i2);
|
|
398790
399115
|
const file2 = new File([bytes2], name2);
|
|
398791
|
-
await importViaPlugin2(file2, { mode });
|
|
399116
|
+
await importViaPlugin2(file2, { mode: mode2 });
|
|
398792
399117
|
} catch (err2) {
|
|
398793
399118
|
usePluginStore.getState().toast(String(err2 instanceof Error ? err2.message : err2), { error: true });
|
|
398794
399119
|
}
|
|
@@ -400677,7 +401002,6 @@ function record(source, namespaces, globals, limits) {
|
|
|
400677
401002
|
var HELPER_NAMES;
|
|
400678
401003
|
var init_helper_names = __esm({
|
|
400679
401004
|
"lib/agent/design-script/helper-names.ts"() {
|
|
400680
|
-
"use strict";
|
|
400681
401005
|
HELPER_NAMES = ["draw", "marks", "fit", "motion", "captions", "overlays", "texture", "pointer", "windows", "devices", "type", "beat", "web", "social", "video", "site", "effects"];
|
|
400682
401006
|
}
|
|
400683
401007
|
});
|
|
@@ -400780,7 +401104,6 @@ async function replay(rec, namespaces2) {
|
|
|
400780
401104
|
var BLOCKED, isRef2, isFn;
|
|
400781
401105
|
var init_replay = __esm({
|
|
400782
401106
|
"lib/agent/design-script/replay.ts"() {
|
|
400783
|
-
"use strict";
|
|
400784
401107
|
BLOCKED = /* @__PURE__ */ new Set(["constructor", "prototype", "__proto__", "caller", "callee", "arguments", "call", "apply", "bind"]);
|
|
400785
401108
|
isRef2 = (v) => !!v && typeof v === "object" && "$ref" in v && Array.isArray(v.path);
|
|
400786
401109
|
isFn = (v) => !!v && typeof v === "object" && "$fn" in v && Array.isArray(v.ops);
|
|
@@ -401051,17 +401374,17 @@ __export(recorders_exports, {
|
|
|
401051
401374
|
setDesignRecorder: () => setDesignRecorder
|
|
401052
401375
|
});
|
|
401053
401376
|
function setDesignRecorder(r) {
|
|
401054
|
-
|
|
401377
|
+
installed2 = r;
|
|
401055
401378
|
}
|
|
401056
401379
|
function designRecorder() {
|
|
401057
|
-
if (
|
|
401380
|
+
if (installed2) return installed2;
|
|
401058
401381
|
if (typeof window !== "undefined") return async (source3, namespaces2, globals) => (await Promise.resolve().then(() => (init_sandbox(), sandbox_exports))).recordInSandbox(source3, namespaces2, globals);
|
|
401059
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).");
|
|
401060
401383
|
}
|
|
401061
|
-
var
|
|
401384
|
+
var installed2;
|
|
401062
401385
|
var init_recorders = __esm({
|
|
401063
401386
|
"lib/agent/design-script/recorders.ts"() {
|
|
401064
|
-
|
|
401387
|
+
installed2 = null;
|
|
401065
401388
|
}
|
|
401066
401389
|
});
|
|
401067
401390
|
|
|
@@ -402425,8 +402748,8 @@ var init_app = __esm({
|
|
|
402425
402748
|
permission: null,
|
|
402426
402749
|
params: external_exports.object({ mode: external_exports.enum([...MODE_IDS, ...Object.keys(MODE_ALIASES)]) }),
|
|
402427
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 } })) } },
|
|
402428
|
-
run: async ({ mode }) => {
|
|
402429
|
-
const id3 = MODE_ALIASES[
|
|
402751
|
+
run: async ({ mode: mode2 }) => {
|
|
402752
|
+
const id3 = MODE_ALIASES[mode2] ?? mode2;
|
|
402430
402753
|
(await store5()).setMode(id3);
|
|
402431
402754
|
return { summary: `${MODE_LIST.find((m) => m.id === id3)?.label} mode` };
|
|
402432
402755
|
}
|
|
@@ -405333,13 +405656,13 @@ function settleRequest(outcome) {
|
|
|
405333
405656
|
emit5();
|
|
405334
405657
|
p2.resolve(outcome);
|
|
405335
405658
|
}
|
|
405336
|
-
var pending7,
|
|
405659
|
+
var pending7, listeners8, emit5, opener;
|
|
405337
405660
|
var init_requests = __esm({
|
|
405338
405661
|
"lib/audio/presentation/requests.ts"() {
|
|
405339
405662
|
pending7 = null;
|
|
405340
|
-
|
|
405663
|
+
listeners8 = /* @__PURE__ */ new Set();
|
|
405341
405664
|
emit5 = () => {
|
|
405342
|
-
for (const l of
|
|
405665
|
+
for (const l of listeners8) l();
|
|
405343
405666
|
};
|
|
405344
405667
|
opener = null;
|
|
405345
405668
|
}
|
|
@@ -406130,7 +406453,6 @@ function registerBuiltinCommands() {
|
|
|
406130
406453
|
var builtinCommands, uiOnlyCommands;
|
|
406131
406454
|
var init_builtin4 = __esm({
|
|
406132
406455
|
"lib/commands/builtin.ts"() {
|
|
406133
|
-
"use strict";
|
|
406134
406456
|
init_registry();
|
|
406135
406457
|
init_node();
|
|
406136
406458
|
init_node();
|
|
@@ -406209,6 +406531,7 @@ var init_builtin4 = __esm({
|
|
|
406209
406531
|
viewSelect,
|
|
406210
406532
|
viewZoomTo,
|
|
406211
406533
|
viewStage,
|
|
406534
|
+
viewScreenLayout,
|
|
406212
406535
|
viewPresent,
|
|
406213
406536
|
showSetAdvance,
|
|
406214
406537
|
// was document.ts
|
|
@@ -408394,11 +408717,11 @@ var init_editor_store = __esm({
|
|
|
408394
408717
|
return newNode;
|
|
408395
408718
|
};
|
|
408396
408719
|
const traverse = (currentId, sx, sy) => {
|
|
408397
|
-
const
|
|
408398
|
-
if (!
|
|
408399
|
-
newNodes[currentId] = scaleProps(
|
|
408400
|
-
if ("childIds" in
|
|
408401
|
-
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) {
|
|
408402
408725
|
traverse(childId, sx, sy);
|
|
408403
408726
|
}
|
|
408404
408727
|
}
|
|
@@ -408761,10 +409084,10 @@ var init_editor_store = __esm({
|
|
|
408761
409084
|
const state = get4();
|
|
408762
409085
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
408763
409086
|
ids2.forEach((id3) => {
|
|
408764
|
-
let
|
|
408765
|
-
for (let guard2 = 0;
|
|
408766
|
-
newExpanded.add(
|
|
408767
|
-
|
|
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);
|
|
408768
409091
|
}
|
|
408769
409092
|
});
|
|
408770
409093
|
const cellSel = state.tableCellSelection;
|
|
@@ -408776,10 +409099,10 @@ var init_editor_store = __esm({
|
|
|
408776
409099
|
addToSelection: (id3) => {
|
|
408777
409100
|
const state = get4();
|
|
408778
409101
|
const newExpanded = new Set(state.expandedLayerNodes);
|
|
408779
|
-
let
|
|
408780
|
-
while (
|
|
408781
|
-
newExpanded.add(
|
|
408782
|
-
|
|
409102
|
+
let current5 = state.document.nodes[id3];
|
|
409103
|
+
while (current5 && current5.parentId) {
|
|
409104
|
+
newExpanded.add(current5.parentId);
|
|
409105
|
+
current5 = state.document.nodes[current5.parentId];
|
|
408783
409106
|
}
|
|
408784
409107
|
set4({
|
|
408785
409108
|
selection: [...state.selection, id3],
|
|
@@ -409321,11 +409644,11 @@ var init_editor_store = __esm({
|
|
|
409321
409644
|
if (!pages2.length) return;
|
|
409322
409645
|
const cam = state.camera;
|
|
409323
409646
|
const selected = pages2.findIndex((pg) => state.selection.includes(pg.id));
|
|
409324
|
-
const
|
|
409647
|
+
const current5 = selected >= 0 ? selected : pages2.reduce((best, pg, i2) => {
|
|
409325
409648
|
const d = Math.hypot(pg.x + pg.width / 2 - cam.x, pg.y + pg.height / 2 - cam.y);
|
|
409326
409649
|
return d < best.d ? { i: i2, d } : best;
|
|
409327
409650
|
}, { i: 0, d: Infinity }).i;
|
|
409328
|
-
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);
|
|
409329
409652
|
const page = pages2[Math.max(0, Math.min(pages2.length - 1, target2))];
|
|
409330
409653
|
set4({ selection: [page.id] });
|
|
409331
409654
|
get4().zoomToNodes([page.id], 0.1);
|
|
@@ -410104,14 +410427,14 @@ var init_editor_store = __esm({
|
|
|
410104
410427
|
for (const p2 of points) get4().pickShapeBuilderFace(p2.x, p2.y, "add");
|
|
410105
410428
|
get4().commitShapeBuilder();
|
|
410106
410429
|
},
|
|
410107
|
-
pickShapeBuilderFace: (worldX, worldY,
|
|
410430
|
+
pickShapeBuilderFace: (worldX, worldY, mode2) => {
|
|
410108
410431
|
const state = get4();
|
|
410109
410432
|
const sb = state.shapeBuilder;
|
|
410110
410433
|
if (!sb) return;
|
|
410111
410434
|
const i2 = faceAt(shapeBuilderFaces(state.document, sb.nodeIds), worldX, worldY);
|
|
410112
410435
|
if (i2 < 0) return;
|
|
410113
410436
|
const has = sb.picked.includes(i2);
|
|
410114
|
-
const wanted =
|
|
410437
|
+
const wanted = mode2 === "toggle" ? !has : mode2 === "add";
|
|
410115
410438
|
if (wanted === has) return;
|
|
410116
410439
|
set4({ shapeBuilder: { ...sb, picked: wanted ? [...sb.picked, i2] : sb.picked.filter((x2) => x2 !== i2) } });
|
|
410117
410440
|
},
|
|
@@ -410728,7 +411051,7 @@ var init_editor_store = __esm({
|
|
|
410728
411051
|
const collection = state.document.variableCollections?.[collectionId];
|
|
410729
411052
|
if (!collection) return;
|
|
410730
411053
|
const modeId = v4_default();
|
|
410731
|
-
const
|
|
411054
|
+
const mode2 = { id: modeId, name: name2 || `Mode ${collection.modes.length + 1}` };
|
|
410732
411055
|
const newVariables = { ...state.document.variables || {} };
|
|
410733
411056
|
for (const [vid, v] of Object.entries(newVariables)) {
|
|
410734
411057
|
if (v.variableCollectionId !== collectionId) continue;
|
|
@@ -410741,7 +411064,7 @@ var init_editor_store = __esm({
|
|
|
410741
411064
|
variables: newVariables,
|
|
410742
411065
|
variableCollections: {
|
|
410743
411066
|
...state.document.variableCollections,
|
|
410744
|
-
[collectionId]: { ...collection, modes: [...collection.modes,
|
|
411067
|
+
[collectionId]: { ...collection, modes: [...collection.modes, mode2] }
|
|
410745
411068
|
}
|
|
410746
411069
|
};
|
|
410747
411070
|
const command = createCommand("ADD_VARIABLE_MODE", "Add variable mode", documentBefore, documentAfter);
|
|
@@ -411490,10 +411813,10 @@ async function installHyperySession(url4) {
|
|
|
411490
411813
|
getToken: async () => (session3 = await freshSession(url4, session3)).accessToken
|
|
411491
411814
|
});
|
|
411492
411815
|
useAiStore2.setState({ signedIn: true, online: true });
|
|
411493
|
-
|
|
411816
|
+
installed3 = session3;
|
|
411494
411817
|
return session3;
|
|
411495
411818
|
}
|
|
411496
|
-
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;
|
|
411497
411820
|
var init_hypery = __esm({
|
|
411498
411821
|
"packages/cli/src/hypery.ts"() {
|
|
411499
411822
|
"use strict";
|
|
@@ -411504,8 +411827,8 @@ var init_hypery = __esm({
|
|
|
411504
411827
|
SIGN_IN_TIMEOUT_MS = 10 * 6e4;
|
|
411505
411828
|
b64url = (buf) => buf.toString("base64url");
|
|
411506
411829
|
forgetSession = (url4) => forgetToken(account(url4));
|
|
411507
|
-
|
|
411508
|
-
hyperySignedIn = () =>
|
|
411830
|
+
installed3 = null;
|
|
411831
|
+
hyperySignedIn = () => installed3 !== null;
|
|
411509
411832
|
}
|
|
411510
411833
|
});
|
|
411511
411834
|
|
|
@@ -413474,9 +413797,9 @@ import { dirname as dirname5, extname as extname3, join as join12, resolve as re
|
|
|
413474
413797
|
function loadPlugin(ref3, root2 = desktopDataDir()) {
|
|
413475
413798
|
let path = ref3;
|
|
413476
413799
|
if (!existsSync13(path)) {
|
|
413477
|
-
const
|
|
413478
|
-
if (!
|
|
413479
|
-
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);
|
|
413480
413803
|
}
|
|
413481
413804
|
if (statSync6(path).isDirectory()) {
|
|
413482
413805
|
const dir = resolve6(path);
|
|
@@ -413734,7 +414057,7 @@ init_resources();
|
|
|
413734
414057
|
init_desktop();
|
|
413735
414058
|
init_hypery();
|
|
413736
414059
|
import { createInterface } from "node:readline";
|
|
413737
|
-
var VERSION2 = "0.
|
|
414060
|
+
var VERSION2 = "0.49.0";
|
|
413738
414061
|
var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
|
|
413739
414062
|
|
|
413740
414063
|
Files (headless, on .popcraft files):
|