@popcraft/cli 0.53.4 → 0.53.6

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.
Files changed (2) hide show
  1. package/dist/popcraft.mjs +64 -23
  2. 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.53.4"}`, ...opts.headers };
1199
+ const headers = { "user-agent": `popcraft-cli/${"0.53.6"}`, ...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 {
@@ -32761,6 +32761,7 @@ var init_en2 = __esm({
32761
32761
  "command:node.flip#vertical": "Flip vertical",
32762
32762
  "command:node.group": "Group selection",
32763
32763
  "command:node.importSvg": "Import SVG",
32764
+ "command:node.makePrintPage": "Make print page",
32764
32765
  "command:node.order": "Order",
32765
32766
  "command:node.order#bottom": "Send to back",
32766
32767
  "command:node.order#down": "Send backward",
@@ -96211,6 +96212,7 @@ function repairDocumentPaints(doc2) {
96211
96212
  var broken;
96212
96213
  var init_paint_repair = __esm({
96213
96214
  "lib/document/paint-repair.ts"() {
96215
+ "use strict";
96214
96216
  init_shader_graph();
96215
96217
  broken = (p2) => {
96216
96218
  if (!p2 || typeof p2 !== "object") return false;
@@ -97321,7 +97323,7 @@ function detachInstances(nodes, ids2) {
97321
97323
  if (!inst || inst.type !== "INSTANCE" || !inst.mainComponentId || !nodes[inst.mainComponentId]) continue;
97322
97324
  const into = out ??= { ...nodes };
97323
97325
  const copy2 = (vid, parentId) => {
97324
- const drawn = resolveVirtualNode2(nodes, vid);
97326
+ const drawn = resolveVirtualNode2(nodes, vid, { layout: false });
97325
97327
  if (!drawn) return null;
97326
97328
  const newId3 = copyId(id3, vid);
97327
97329
  const node2 = { ...drawn, id: newId3, parentId, childIds: [] };
@@ -97384,7 +97386,6 @@ function selectionWorldBounds(nodes, ids2, scrollState) {
97384
97386
  }
97385
97387
  var init_selection_bounds = __esm({
97386
97388
  "lib/editor/selection-bounds.ts"() {
97387
- "use strict";
97388
97389
  init_scene_graph();
97389
97390
  init_transform();
97390
97391
  }
@@ -247043,7 +247044,6 @@ function rescaleTextEffect(node2) {
247043
247044
  var DEFAULTS, BLACK5, WHITE5, fillPaint, fillColor, shadow, round, OUTLINED;
247044
247045
  var init_effect_presets = __esm({
247045
247046
  "lib/text/effect-presets.ts"() {
247046
- "use strict";
247047
247047
  init_effects();
247048
247048
  DEFAULTS = {
247049
247049
  SHADOW: { distance: 17.68, angle: 45, blur: 12.5, thickness: 0, intensity: 45 },
@@ -248024,7 +248024,6 @@ function repairCompositions(comps, nodes) {
248024
248024
  var isObj5, finite6, optFinite, isVec2, TIMELINE_COLOR_IDS, TIMELINE_COLORS, UNITS, ORDERS, PROP_KEYS, ANIMATOR_ID, MOTION_TYPES, TRANSITIONS, isFraction, MEDIA_HASH;
248025
248025
  var init_invariants = __esm({
248026
248026
  "lib/motion/invariants.ts"() {
248027
- "use strict";
248028
248027
  init_easing();
248029
248028
  init_properties();
248030
248029
  init_markers();
@@ -256740,6 +256739,7 @@ function mergeFonts(fonts, incoming) {
256740
256739
  var fontWeightOf, fontStyleOf, sameSlot, hashOf, documentFontHashes;
256741
256740
  var init_document_fonts = __esm({
256742
256741
  "lib/fonts/document-fonts.ts"() {
256742
+ "use strict";
256743
256743
  init_media_store();
256744
256744
  init_media_hash();
256745
256745
  fontWeightOf = (f2) => f2.weight ?? 400;
@@ -257992,7 +257992,6 @@ async function docExists(id3) {
257992
257992
  var INDEX_KEY, docKey, thumbKey, THUMB_MAX_BYTES, THUMB_TYPES, LEGACY_DATA_URL, migrating, SPLIT_LAYOUT, nodeKey, WRITER, persisted, saving, deletedHere, keyval, keyvalStore;
257993
257993
  var init_document_library = __esm({
257994
257994
  "lib/storage/document-library.ts"() {
257995
- "use strict";
257996
257995
  init_idb();
257997
257996
  init_media_types();
257998
257997
  init_collapse_duplicates();
@@ -258141,7 +258140,6 @@ function scaleSubtreePatches(nodes, id3, sx, sy, includeSelf = true) {
258141
258140
  var scalePoint;
258142
258141
  var init_scale_geometry = __esm({
258143
258142
  "lib/document/scale-geometry.ts"() {
258144
- "use strict";
258145
258143
  scalePoint = (p2, sx, sy) => ({
258146
258144
  ...p2,
258147
258145
  x: p2.x * sx,
@@ -259137,7 +259135,6 @@ function describeModifier(m) {
259137
259135
  var FLASH_WHITE, BEHAVIOUR_PRESETS, AUDIO_SIGNAL_OPTIONS, AUDIO_MODES, LOOP_MODES, UNKEYABLE, isKeyableParam, freshId4, listOf;
259138
259136
  var init_modifier_edit = __esm({
259139
259137
  "lib/motion/modifier-edit.ts"() {
259140
- "use strict";
259141
259138
  init_easing();
259142
259139
  init_sample_keys();
259143
259140
  FLASH_WHITE = { r: 1, g: 1, b: 1, a: 1 };
@@ -259582,7 +259579,6 @@ function staggerDocument(doc2, ids2, opts) {
259582
259579
  var PRESET_IDS, num6, restOpacity, overshoots, fadeCurve, span, enter2, leave2, fadeIn, fadeOut, along, scaleSpan, wave, BLUR_ID, SMEAR_ID, SHAKE_STEPS, SHAKE, clips, clipping, WIPE_MIN, wipeGroupId, wipeMaskId, any2, CONTAINERS2, isContainer, autoRise, CAM, zoomOf, camTravel, camArrive, dollyAxis, cameraOrGroup, isPlainText, TEXT_NEEDS, unitRise, cascade, cascadeKeys, cascadeAmount, slideDistance, LIBRARY, BY_ID2, MOTION_PRESETS, presetById2, lengthenedTo;
259583
259580
  var init_presets = __esm({
259584
259581
  "lib/motion/presets.ts"() {
259585
- "use strict";
259586
259582
  init_author();
259587
259583
  init_keys();
259588
259584
  init_markers();
@@ -261508,7 +261504,6 @@ function breakpointView(state, doc2 = state.document) {
261508
261504
  var storedDocument;
261509
261505
  var init_view = __esm({
261510
261506
  "lib/motion/view.ts"() {
261511
- "use strict";
261512
261507
  init_motion_slice();
261513
261508
  init_transport_clock();
261514
261509
  init_autokey();
@@ -262757,6 +262752,7 @@ function formatDate(date5, opts = { month: "short", day: "numeric", year: "numer
262757
262752
  var cache5, nf;
262758
262753
  var init_format = __esm({
262759
262754
  "lib/i18n/format.ts"() {
262755
+ "use strict";
262760
262756
  init_runtime();
262761
262757
  cache5 = /* @__PURE__ */ new Map();
262762
262758
  nf = (opts) => cached2("n", opts, (l) => new Intl.NumberFormat(l, opts));
@@ -273491,7 +273487,6 @@ async function prepareTemplate(t3) {
273491
273487
  var templateMediaSources, MEDIA_FETCH_TIMEOUT_MS2, PREPARE_BUDGET_MS, MEDIA_CONCURRENCY, timeoutOf;
273492
273488
  var init_use = __esm({
273493
273489
  "lib/templates/use.ts"() {
273494
- "use strict";
273495
273490
  init_capture();
273496
273491
  templateMediaSources = (t3, hash3) => [
273497
273492
  `/templates/media/${hash3}`,
@@ -317596,7 +317591,6 @@ async function selectionReferenceImages(doc2, selection, opts = {}) {
317596
317591
  var FIT_QUALITIES, FIT_SCALES, blobToDataUrl;
317597
317592
  var init_reference_images = __esm({
317598
317593
  "lib/ai/reference-images.ts"() {
317599
- "use strict";
317600
317594
  init_export();
317601
317595
  init_selection_bounds();
317602
317596
  init_renderer_registry();
@@ -319349,7 +319343,7 @@ function normalizePaints(v, key5) {
319349
319343
  return out;
319350
319344
  });
319351
319345
  }
319352
- var nodeFind, nodeGet, nodeMeasure, docOutline, CREATABLE, nodeCreate, FORBIDDEN_PROPS, nodeUpdate, nodeDelete, nodeMove, nodeResize, nodeReparent, nodeGroup, nodeUngroup, nodeOrder, nodeAlign, nodeDistribute, nodeRename, nodeDuplicate, nodeImportSvg, nodeApplyAutoLayout, nodeSetLock, nodeSetVisibility, nodeFlip, nodeRotate;
319346
+ var nodeFind, nodeGet, nodeMeasure, docOutline, CREATABLE, nodeCreate, FORBIDDEN_PROPS, nodeUpdate, nodeDelete, nodeMove, nodeResize, nodeReparent, nodeGroup, nodeUngroup, nodeOrder, nodeAlign, nodeDistribute, nodeRename, nodeDuplicate, nodeImportSvg, nodeApplyAutoLayout, nodeSetLock, nodeSetVisibility, nodeFlip, nodeRotate, nodeMakePrintPage;
319353
319347
  var init_node = __esm({
319354
319348
  "lib/commands/node.ts"() {
319355
319349
  "use strict";
@@ -319361,6 +319355,7 @@ var init_node = __esm({
319361
319355
  init_scene_graph();
319362
319356
  init_types();
319363
319357
  init_svg_import();
319358
+ init_print_pages();
319364
319359
  init_errors();
319365
319360
  init_scale_geometry();
319366
319361
  init_plugin_shim();
@@ -320441,6 +320436,52 @@ var init_node = __esm({
320441
320436
  return { summary: `Rotated ${plural2(ids2.length, "layer")}`, data: { ids: ids2 } };
320442
320437
  }
320443
320438
  });
320439
+ nodeMakePrintPage = defineCommand({
320440
+ id: "node.makePrintPage",
320441
+ title: "Make print page",
320442
+ domain: "node",
320443
+ effect: "document",
320444
+ permission: "write",
320445
+ undoLabel: "Make print page",
320446
+ params: external_exports.object({ ids: external_exports.array(external_exports.string()).max(MAX_NODES).optional() }),
320447
+ expose: {
320448
+ ui: { label: "Make print page", keywords: ["print", "page", "sheet", "make page", "add page", "colophon"], enabled: needsSelection(1) },
320449
+ agent: {
320450
+ name: "make_print_page",
320451
+ description: "Turn top-level layers into print pages, so they are part of the printed document \u2014 numbered in Print \xB7 pages and included in export/PDF. A FRAME becomes a print page in place; anything else (an instance of a shared colophon, a group, an image) is wrapped in a page-sized print frame. An instance stays linked to its library, so the page both prints AND keeps syncing. New pages are added at the end of the sequence; use reorder_pages or move_nodes to place them. Defaults to the selection."
320452
+ }
320453
+ },
320454
+ run: (args2, ctx2) => {
320455
+ const { doc: doc2, ids: ids2 } = resolveTargets(ctx2, args2.ids, "make_print_page");
320456
+ const pageId2 = ctx2.pageId();
320457
+ let next2 = doc2;
320458
+ const made = [];
320459
+ for (const id3 of ids2) {
320460
+ const n = next2.nodes[id3];
320461
+ if (!n) continue;
320462
+ if (n.parentId !== pageId2) throw new ToolError(`"${n.name}" is not a top-level layer on this page; only top-level layers can become print pages.`);
320463
+ if (isPrintPage(n)) continue;
320464
+ if (n.type === "FRAME" && !n.print?.isMaster) {
320465
+ next2 = updateNode(next2, id3, { print: { isPrintPage: true, index: listPrintPages(next2, pageId2).length } });
320466
+ made.push(id3);
320467
+ } else {
320468
+ const frame3 = createPrintPage(next2, pageId2, { name: n.name });
320469
+ frame3.width = n.width;
320470
+ frame3.height = n.height;
320471
+ next2 = addNode(next2, frame3, pageId2);
320472
+ next2 = reparentNode(next2, id3, frame3.id);
320473
+ next2 = updateNode(next2, id3, { x: 0, y: 0 });
320474
+ made.push(frame3.id);
320475
+ }
320476
+ }
320477
+ if (!made.length) throw new ToolError("Those layers are already print pages.");
320478
+ const patches = placePrintPages(next2, pageId2);
320479
+ for (const pid in patches) next2 = updateNode(next2, pid, patches[pid]);
320480
+ ctx2.commit(applyInvariants(next2, [...made, ...Object.keys(patches)]));
320481
+ ctx2.setSelection(made);
320482
+ return { summary: `Made ${plural2(made.length, "print page", "print pages")}`, data: { ids: made } };
320483
+ }
320484
+ });
320444
320485
  }
320445
320486
  });
320446
320487
 
@@ -328745,7 +328786,7 @@ var init_package = __esm({
328745
328786
  "packages/runtime/package.json"() {
328746
328787
  package_default = {
328747
328788
  name: "@popcraft/runtime",
328748
- version: "0.53.4",
328789
+ version: "0.53.6",
328749
328790
  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.",
328750
328791
  license: "MIT",
328751
328792
  homepage: "https://popcraft.app/docs/exporting/nextjs",
@@ -358915,7 +358956,6 @@ function diagnosticsText(diagnostics) {
358915
358956
  var HARNESS_NAMES, plainDiagnostics;
358916
358957
  var init_shader_diagnostics = __esm({
358917
358958
  "lib/engine/shader-diagnostics.ts"() {
358918
- "use strict";
358919
358959
  HARNESS_NAMES = ["ShaderUniforms", "VOut", "vs_main", "fs_main", "u", "p"];
358920
358960
  plainDiagnostics = (errors2) => errors2.map((message) => ({ line: null, column: null, message, severity: "error" }));
358921
358961
  }
@@ -361974,7 +362014,6 @@ function publishSite(key5, files, opts = {}) {
361974
362014
  var siteStatus, setSiteVersion, workspaceSites, deleteSite, renameSite;
361975
362015
  var init_sites = __esm({
361976
362016
  "lib/client/cloud/sites.ts"() {
361977
- "use strict";
361978
362017
  init_files();
361979
362018
  init_upload2();
361980
362019
  init_api4();
@@ -368112,7 +368151,6 @@ var init_doc2 = __esm({
368112
368151
  var POSTER_KEY, MAX_PREVIEW_BYTES2, PREVIEW_STILL_TYPE, previewPath;
368113
368152
  var init_motion3 = __esm({
368114
368153
  "lib/marketplace/motion.ts"() {
368115
- "use strict";
368116
368154
  init_instances2();
368117
368155
  POSTER_KEY = "poster";
368118
368156
  MAX_PREVIEW_BYTES2 = 4 * 1024 * 1024;
@@ -368228,7 +368266,6 @@ async function renderLibraryPreviews(renderer, doc2, listing, format = pickPrevi
368228
368266
  var PREVIEW_FORMATS, PREVIEW_FPS, PREVIEW_MAX_MS2, PREVIEW_HOLD_MS, PREVIEW_BOX, POSTER_CELL, PREVIEW_MAX_SCALE, POSTER_COLS, POSTER_MAX, previewScale, componentSchedule;
368229
368267
  var init_library_previews = __esm({
368230
368268
  "lib/motion/library-previews.ts"() {
368231
- "use strict";
368232
368269
  init_codecs();
368233
368270
  init_gpu_pixels();
368234
368271
  init_render_frames();
@@ -399181,7 +399218,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
399181
399218
  downloadBlob(new Blob([file2.bytes], { type: file2.mimeType || "application/octet-stream" }), name2);
399182
399219
  return { name: name2, byteLength: file2.bytes.byteLength };
399183
399220
  },
399184
- exportNode: async (nodes, format, scale) => {
399221
+ exportNode: async (nodes, format, scale, bleed) => {
399185
399222
  const renderer = getActiveRenderer();
399186
399223
  if (!renderer) throw new Error("Renderer is not ready");
399187
399224
  const st = useEditorStore.getState();
@@ -399190,7 +399227,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
399190
399227
  const { exportNodesToPDF: exportNodesToPDF2 } = await Promise.resolve().then(() => (init_pdf(), pdf_exports));
399191
399228
  const { jobPageSize: jobPageSize2 } = await Promise.resolve().then(() => (init_print_pages(), print_pages_exports));
399192
399229
  const { loadFullBleed: loadFullBleed2 } = await Promise.resolve().then(() => (init_print_prefs(), print_prefs_exports));
399193
- const blob2 = await exportNodesToPDF2(renderer, nodes, { dpi: 300, bleed: !loadFullBleed2(), marks: false, splitSpreads: true, pageSize: jobPageSize2(st.document) }, st.document, st.document.styles);
399230
+ const blob2 = await exportNodesToPDF2(renderer, nodes, { dpi: 300, bleed: bleed ?? !loadFullBleed2(), marks: false, splitSpreads: true, pageSize: jobPageSize2(st.document) }, st.document, st.document.styles);
399194
399231
  if (!blob2) throw new Error("PDF export failed");
399195
399232
  return new Uint8Array(await blob2.arrayBuffer());
399196
399233
  }
@@ -399577,7 +399614,10 @@ var init_plugin = __esm({
399577
399614
  format: external_exports.unknown().transform((v) => String(v ?? "PNG").toUpperCase()).refine((f2) => f2 in MIME2, { error: (iss) => `Unsupported format ${String(iss.input)}` }).optional(),
399578
399615
  // Clamped, not rejected: the legacy switch clamped, and a plugin asking for scale 20 should get
399579
399616
  // an 8× image rather than an exception it never handled.
399580
- scale: external_exports.unknown().transform((v) => Math.max(0.1, Math.min(8, Number(v) || 1))).optional()
399617
+ scale: external_exports.unknown().transform((v) => Math.max(0.1, Math.min(8, Number(v) || 1))).optional(),
399618
+ // PDF only. true: 0.125 in of bleed outside the trim, what a commercial printer needs. false: the
399619
+ // page is the trim. Left out, it follows the person's Print setting.
399620
+ bleed: external_exports.boolean().optional()
399581
399621
  }).optional()
399582
399622
  }),
399583
399623
  effect: "none",
@@ -399599,7 +399639,7 @@ var init_plugin = __esm({
399599
399639
  if (nodes.length > 1 && format !== "PDF") {
399600
399640
  throw new PluginApiError("Several nodes can only be exported as one PDF", "invalid_params");
399601
399641
  }
399602
- const data = await env.effects.exportNode(nodes, format, p2.options?.scale ?? 1);
399642
+ const data = await env.effects.exportNode(nodes, format, p2.options?.scale ?? 1, p2.options?.bleed);
399603
399643
  return { summary: nodes.length > 1 ? `Exported ${nodes.length} pages` : `Exported ${nodes[0].name ?? nodes[0].id}`, data };
399604
399644
  }
399605
399645
  }),
@@ -406842,6 +406882,7 @@ var init_builtin4 = __esm({
406842
406882
  nodeRename,
406843
406883
  nodeDuplicate,
406844
406884
  nodeImportSvg,
406885
+ nodeMakePrintPage,
406845
406886
  componentCreate,
406846
406887
  componentCreateInstance,
406847
406888
  styleCreate,
@@ -414332,7 +414373,7 @@ init_resources();
414332
414373
  init_desktop();
414333
414374
  init_hypery();
414334
414375
  import { createInterface } from "node:readline";
414335
- var VERSION2 = "0.53.4";
414376
+ var VERSION2 = "0.53.6";
414336
414377
  var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
414337
414378
 
414338
414379
  Files (headless, on .popcraft files):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcraft/cli",
3
- "version": "0.53.4",
3
+ "version": "0.53.6",
4
4
  "description": "The PopCraft command line: edit .popcraft files headlessly, call the REST API, publish to the marketplace and manage the desktop app's local plugins, themes, fonts, skills and agents.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://popcraft.app/docs/api/cli",
@@ -34,7 +34,7 @@
34
34
  "esbuild": "0.28.2"
35
35
  },
36
36
  "dependencies": {
37
- "@popcraft/kit": "0.53.4"
37
+ "@popcraft/kit": "0.53.6"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node build.mjs",