@popcraft/cli 0.53.2 → 0.53.3

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 +74 -19
  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.2"}`, ...opts.headers };
1199
+ const headers = { "user-agent": `popcraft-cli/${"0.53.3"}`, ...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 {
@@ -94509,7 +94509,6 @@ function hasMessage(key5) {
94509
94509
  var current2, loading, listeners, formats, asts;
94510
94510
  var init_runtime = __esm({
94511
94511
  "lib/i18n/runtime.ts"() {
94512
- "use strict";
94513
94512
  init_intl_messageformat();
94514
94513
  init_icu_messageformat_parser();
94515
94514
  init_catalogs();
@@ -96869,7 +96868,6 @@ function releaseMediaMemory(hash3) {
96869
96868
  var key2, peaksKey, objectUrls, sourceKey, remoteResolver, MEDIA_FETCH_TIMEOUT_MS, SHIPPED_MEDIA_PATH, notShipped, MEDIA_SCHEME, isImageDataUrl, memory, pendingLoads, sourceAliases, PAINT_KEYS, URL_KEYS;
96870
96869
  var init_media_store = __esm({
96871
96870
  "lib/storage/media-store.ts"() {
96872
- "use strict";
96873
96871
  init_media_types();
96874
96872
  init_idb();
96875
96873
  init_media_hash();
@@ -97386,6 +97384,7 @@ function selectionWorldBounds(nodes, ids2, scrollState) {
97386
97384
  }
97387
97385
  var init_selection_bounds = __esm({
97388
97386
  "lib/editor/selection-bounds.ts"() {
97387
+ "use strict";
97389
97388
  init_scene_graph();
97390
97389
  init_transform();
97391
97390
  }
@@ -97577,6 +97576,7 @@ function relinkCopies(doc2, copies) {
97577
97576
  var TEXT_PATH_SOURCE_TYPES, isPathSource;
97578
97577
  var init_text_links = __esm({
97579
97578
  "lib/document/text-links.ts"() {
97579
+ "use strict";
97580
97580
  init_transform();
97581
97581
  TEXT_PATH_SOURCE_TYPES = ["VECTOR", "ELLIPSE", "RECTANGLE", "POLYGON", "STAR", "LINE", "ARROW", "FRAME"];
97582
97582
  isPathSource = (n) => !!n && TEXT_PATH_SOURCE_TYPES.includes(n.type);
@@ -248025,6 +248025,7 @@ function repairCompositions(comps, nodes) {
248025
248025
  var isObj5, finite6, optFinite, isVec2, TIMELINE_COLOR_IDS, TIMELINE_COLORS, UNITS, ORDERS, PROP_KEYS, ANIMATOR_ID, MOTION_TYPES, TRANSITIONS, isFraction, MEDIA_HASH;
248026
248026
  var init_invariants = __esm({
248027
248027
  "lib/motion/invariants.ts"() {
248028
+ "use strict";
248028
248029
  init_easing();
248029
248030
  init_properties();
248030
248031
  init_markers();
@@ -248121,6 +248122,7 @@ function resyncText(doc2, ids2) {
248121
248122
  var isVirtualId;
248122
248123
  var init_invariants2 = __esm({
248123
248124
  "lib/document/invariants.ts"() {
248125
+ "use strict";
248124
248126
  init_auto_layout();
248125
248127
  init_scene_graph();
248126
248128
  init_text_bounds();
@@ -256191,6 +256193,7 @@ fn shade(uv: vec2<f32>, res: vec2<f32>, tm: f32) -> vec4<f32> {
256191
256193
  var SHADER_PRESETS, shaderPreset, legacyPresetOf, DEFAULT_SHADER_PRESET, DEFAULT_TEXTURE_PARAMS, f, vec4, NOISE_LIB;
256192
256194
  var init_shader_presets = __esm({
256193
256195
  "lib/engine/shader-presets.ts"() {
256196
+ "use strict";
256194
256197
  init_shader_graph();
256195
256198
  init_shader_graph_presets();
256196
256199
  init_shader_presets_legacy();
@@ -256741,7 +256744,6 @@ function mergeFonts(fonts, incoming) {
256741
256744
  var fontWeightOf, fontStyleOf, sameSlot, hashOf, documentFontHashes;
256742
256745
  var init_document_fonts = __esm({
256743
256746
  "lib/fonts/document-fonts.ts"() {
256744
- "use strict";
256745
256747
  init_media_store();
256746
256748
  init_media_hash();
256747
256749
  fontWeightOf = (f2) => f2.weight ?? 400;
@@ -256887,7 +256889,6 @@ var init_apply2 = __esm({
256887
256889
  var HYPERY_CLIENT_ID, HYPERY_GATEWAY_URL, HYPERY_AI_SCOPES, plansEnabled, HYPERY_BILLING_SCOPES, HYPERY_AUDIO_SCOPES, HYPERY_SCOPES, cloudEnabled;
256888
256890
  var init_config2 = __esm({
256889
256891
  "lib/client/cloud/config.ts"() {
256890
- "use strict";
256891
256892
  HYPERY_CLIENT_ID = process.env.NEXT_PUBLIC_HYPERY_CLIENT_ID ?? "";
256892
256893
  HYPERY_GATEWAY_URL = process.env.NEXT_PUBLIC_HYPERY_GATEWAY_URL ?? "https://hypery.ai";
256893
256894
  HYPERY_AI_SCOPES = ["ai:chat", "ai:completions", "ai:models", "ai:images"];
@@ -258066,6 +258067,7 @@ function onTabMessage(fn) {
258066
258067
  var EDITOR_HOME, localDocPath, cloudFilePath, CHANNEL2, channel2;
258067
258068
  var init_tab_mode = __esm({
258068
258069
  "lib/desktop/tab-mode.ts"() {
258070
+ "use strict";
258069
258071
  EDITOR_HOME = "/home";
258070
258072
  localDocPath = (docId) => `${EDITOR_HOME}?doc=${encodeURIComponent(docId)}`;
258071
258073
  cloudFilePath = (key5) => `/pop/${encodeURIComponent(key5)}`;
@@ -262779,6 +262781,7 @@ function formatLimit(key5, max3) {
262779
262781
  var formatBytes;
262780
262782
  var init_limits2 = __esm({
262781
262783
  "lib/billing/limits.ts"() {
262784
+ "use strict";
262782
262785
  init_format();
262783
262786
  init_plans();
262784
262787
  formatBytes = formatFileSize;
@@ -306995,6 +306998,7 @@ function decodeSource(key5, label3) {
306995
306998
  var DECODE_CACHE_BYTES, cache7, pending4, held, sizeOf, lengths, decodedLengths, DECODE_TIMEOUT_MS, decodedAudio, decodedSource, pcmOf;
306996
306999
  var init_audio_decode = __esm({
306997
307000
  "lib/motion/audio-decode.ts"() {
307001
+ "use strict";
306998
307002
  init_media_store();
306999
307003
  init_audio_plan();
307000
307004
  init_time_stretch();
@@ -317507,7 +317511,6 @@ async function exportSettingFile(renderer, node2, setting, doc2, styles) {
317507
317511
  var MIME, DEFAULT_EXPORT, exportSettingsOf;
317508
317512
  var init_export = __esm({
317509
317513
  "lib/io/export.ts"() {
317510
- "use strict";
317511
317514
  init_download();
317512
317515
  init_scene_graph();
317513
317516
  init_codecs();
@@ -317599,6 +317602,7 @@ async function selectionReferenceImages(doc2, selection, opts = {}) {
317599
317602
  var FIT_QUALITIES, FIT_SCALES, blobToDataUrl;
317600
317603
  var init_reference_images = __esm({
317601
317604
  "lib/ai/reference-images.ts"() {
317605
+ "use strict";
317602
317606
  init_export();
317603
317607
  init_selection_bounds();
317604
317608
  init_renderer_registry();
@@ -318441,7 +318445,6 @@ function agentToolList() {
318441
318445
  var AGENT_CAPABILITIES, legacyCommandId, legacyTools, blobToDataUrl3, provided, legacyTool, legacyToolList;
318442
318446
  var init_agent = __esm({
318443
318447
  "lib/commands/agent.ts"() {
318444
- "use strict";
318445
318448
  init_types5();
318446
318449
  init_registry();
318447
318450
  init_errors();
@@ -319063,7 +319066,10 @@ var init_doc_helpers = __esm({
319063
319066
  init_invariants2();
319064
319067
  MAX_NODES = 200;
319065
319068
  plural2 = (n, one, many = `${one}s`) => `${n} ${n === 1 ? one : many}`;
319066
- hexOf = (c2) => c2 ? "#" + [c2.r, c2.g, c2.b].map((v) => Math.round(Math.max(0, Math.min(1, v)) * 255).toString(16).padStart(2, "0")).join("") : "";
319069
+ hexOf = (c2) => c2 ? "#" + [c2.r, c2.g, c2.b].map((v) => {
319070
+ const n = Number.isFinite(v) ? Math.max(0, Math.min(1, v)) : 0;
319071
+ return Math.round(n * 255).toString(16).padStart(2, "0");
319072
+ }).join("") : "";
319067
319073
  isVirtualId2 = (id3) => id3.includes("::");
319068
319074
  near3 = (a, b, tol) => !!a && Math.abs(a.r - b.r) <= tol && Math.abs(a.g - b.g) <= tol && Math.abs(a.b - b.b) <= tol;
319069
319075
  localBox = (doc2, ids2) => {
@@ -319305,6 +319311,15 @@ function descendants(doc2, rootId, skipRoot = true) {
319305
319311
  }
319306
319312
  return out;
319307
319313
  }
319314
+ function geometryMismatch(doc2, id3) {
319315
+ const n = doc2.nodes[id3];
319316
+ if (!n || n.type !== "VECTOR" || !n.paths?.length) return void 0;
319317
+ const pb = pathBounds(n.paths);
319318
+ if (!pb) return void 0;
319319
+ const gw = pb.maxX - pb.minX, gh = pb.maxY - pb.minY;
319320
+ if (Math.abs(gw - n.width) <= 1 && Math.abs(gh - n.height) <= 1) return void 0;
319321
+ return `box is ${Math.round(n.width)}\xD7${Math.round(n.height)} but the artwork is ${Math.round(gw)}\xD7${Math.round(gh)} \u2014 resize_nodes to reconcile them`;
319322
+ }
319308
319323
  function normalizeColor(c2, key5) {
319309
319324
  if (typeof c2 === "string") return parseHex(c2);
319310
319325
  const o = c2;
@@ -319317,6 +319332,15 @@ function normalizeColor(c2, key5) {
319317
319332
  const a = typeof o.a === "number" && Number.isFinite(o.a) ? o.a > 1 ? o.a / 255 : o.a : 1;
319318
319333
  return createColor(nums2[0] / scale, nums2[1] / scale, nums2[2] / scale, a);
319319
319334
  }
319335
+ function normalizeSegments(v) {
319336
+ if (!Array.isArray(v)) return v;
319337
+ return v.map((seg) => {
319338
+ if (!seg || typeof seg !== "object") return seg;
319339
+ const s = { ...seg };
319340
+ for (const k2 of ["fills", "strokes", "textDecorationColor"]) if (k2 in s) s[k2] = normalizePaints(s[k2], k2);
319341
+ return s;
319342
+ });
319343
+ }
319320
319344
  function normalizePaints(v, key5) {
319321
319345
  if (!Array.isArray(v)) throw new ToolError(`${key5} must be an array of paints.`);
319322
319346
  return v.map((p2) => {
@@ -319341,6 +319365,7 @@ var init_node = __esm({
319341
319365
  init_selection_bounds();
319342
319366
  init_scene_graph();
319343
319367
  init_types();
319368
+ init_svg_import();
319344
319369
  init_errors();
319345
319370
  init_scale_geometry();
319346
319371
  init_plugin_shim();
@@ -319406,10 +319431,12 @@ var init_node = __esm({
319406
319431
  hits.push(n);
319407
319432
  if (hits.length >= limit) break;
319408
319433
  }
319434
+ const truncated = hits.length >= limit;
319409
319435
  return {
319410
- summary: `${plural2(hits.length, "match", "matches")} for ${q || type || args2.name || "everything here"}`,
319436
+ summary: `${plural2(hits.length, "match", "matches")}${truncated ? "+ (capped)" : ""} for ${q || type || args2.name || "everything here"}`,
319411
319437
  data: {
319412
319438
  count: hits.length,
319439
+ truncated,
319413
319440
  nodes: args2.detail === "full" ? plain(hits) : hits.map((n) => ({ ...brief(n), page: pageOf2(doc2, n.id) }))
319414
319441
  }
319415
319442
  };
@@ -319451,7 +319478,10 @@ var init_node = __esm({
319451
319478
  return n2 ? plain(n2) : null;
319452
319479
  }
319453
319480
  const n = resolvedNodeOrThrow(doc2, id3);
319454
- return args2.detail === "full" ? plain(n) : describeProps(doc2, n);
319481
+ if (args2.detail === "full") return plain(n);
319482
+ const props = describeProps(doc2, n);
319483
+ const warning = geometryMismatch(doc2, n.id);
319484
+ return warning ? { ...props, warning } : props;
319455
319485
  });
319456
319486
  return { summary: `Read ${plural2(nodes.length, "layer")}`, data: { nodes } };
319457
319487
  }
@@ -319484,7 +319514,8 @@ var init_node = __esm({
319484
319514
  });
319485
319515
  const each = ids2.map((id3) => {
319486
319516
  const rb = getWorldRenderBounds(doc2, id3);
319487
- return { id: id3, name: doc2.nodes[id3].name, bounds: rb ? round5(rb) : null };
319517
+ const warning = geometryMismatch(doc2, id3);
319518
+ return { id: id3, name: doc2.nodes[id3].name, bounds: rb ? round5(rb) : null, ...warning ? { warning } : {} };
319488
319519
  });
319489
319520
  const combined = round5(box2);
319490
319521
  return { summary: `Bounds: ${combined.width}\xD7${combined.height} at ${combined.x},${combined.y}`, data: { combined, nodes: each } };
@@ -319677,13 +319708,34 @@ var init_node = __esm({
319677
319708
  for (const [k2, v] of Object.entries(u.props)) {
319678
319709
  if (args2.strict && FORBIDDEN_PROPS.has(k2)) throw new ToolError(`update_nodes cannot change "${k2}". Use reparent, delete_nodes or create_node instead.`);
319679
319710
  if (FORBIDDEN_PROPS.has(k2) || v === void 0) continue;
319680
- patch2[k2] = k2 === "fills" || k2 === "strokes" ? normalizePaints(v, k2) : v;
319711
+ patch2[k2] = k2 === "fills" || k2 === "strokes" ? normalizePaints(v, k2) : k2 === "styledSegments" ? normalizeSegments(v) : v;
319681
319712
  changedKeys.add(k2);
319682
319713
  }
319714
+ if ("fills" in patch2) patch2.fillStyleId = void 0;
319715
+ if ("strokes" in patch2) patch2.strokeStyleId = void 0;
319683
319716
  if (args2.strict && !Object.keys(patch2).length) throw new ToolError(`No properties given for "${u.id}".`);
319684
319717
  patches.set(u.id, patch2);
319685
319718
  }
319686
- commitUpdates(ctx2, doc2, patches);
319719
+ for (const [id3, patch2] of patches) {
319720
+ const p2 = patch2;
319721
+ if (!("width" in p2) && !("height" in p2)) continue;
319722
+ const n = doc2.nodes[id3];
319723
+ if (n.width <= 0 || n.height <= 0) continue;
319724
+ const w = p2.width ?? n.width, h = p2.height ?? n.height;
319725
+ if (n.type === "FRAME" || n.type === "COMPONENT" || n.type === "SECTION") continue;
319726
+ for (const [pid, sub2] of scaleSubtreePatches(doc2.nodes, id3, w / n.width, h / n.height)) {
319727
+ patches.set(pid, { ...patches.get(pid), ...sub2 });
319728
+ }
319729
+ }
319730
+ let committed = doc2;
319731
+ for (const [id3, patch2] of patches) {
319732
+ const p2 = patch2;
319733
+ const n = doc2.nodes[id3];
319734
+ if (("width" in p2 || "height" in p2) && (n.type === "FRAME" || n.type === "COMPONENT" || n.type === "SECTION")) {
319735
+ committed = applyConstraints(committed, id3, n.width, n.height, p2.width ?? n.width, p2.height ?? n.height);
319736
+ }
319737
+ }
319738
+ commitUpdates(ctx2, committed, patches);
319687
319739
  return { summary: `Updated ${plural2(patches.size, "layer")} (${[...changedKeys].slice(0, 6).join(", ")})`, data: { ids: [...patches.keys()] } };
319688
319740
  }
319689
319741
  });
@@ -319826,7 +319878,7 @@ var init_node = __esm({
319826
319878
  plugin: { method: "reparentNodes" },
319827
319879
  agent: {
319828
319880
  name: "reparent",
319829
- description: "Move layers into another parent (frame, group or page), optionally at a child index. Positions stay in the new parent's coordinates, so move_nodes afterwards if they land off-screen."
319881
+ description: "Move layers into another parent (frame, group or page), optionally at a child index. Each layer keeps its position on screen (its coordinates are rebased into the new parent)."
319830
319882
  }
319831
319883
  },
319832
319884
  run: (args2, ctx2) => {
@@ -319837,6 +319889,8 @@ var init_node = __esm({
319837
319889
  for (const id3 of args2.ids) {
319838
319890
  nodeOrThrow(doc2, id3);
319839
319891
  if (id3 === args2.parentId) throw new ToolError("A layer cannot be its own parent.");
319892
+ const placed2 = placementUnder(next2, id3, args2.parentId);
319893
+ if (placed2) next2 = updateNode(next2, id3, placed2);
319840
319894
  next2 = reparentNode(next2, id3, args2.parentId, args2.index);
319841
319895
  }
319842
319896
  ctx2.commit(applyInvariants(next2, [...args2.ids, args2.parentId]));
@@ -320989,7 +321043,7 @@ var init_paint = __esm({
320989
321043
  else if (mode2 === "replace" || !existing.length) fills = [paint];
320990
321044
  else if (mode2 === "add") fills = [...existing, paint];
320991
321045
  else fills = [paint, ...existing.slice(1)];
320992
- patches.set(id3, { fills });
321046
+ patches.set(id3, { fills, ...args2.remove ? {} : { fillStyleId: void 0 } });
320993
321047
  }
320994
321048
  const what = args2.gradient ? `a ${args2.gradient.type.toLowerCase()} gradient` : args2.image ? "an image" : args2.color;
320995
321049
  commitUpdates(ctx2, doc2, patches);
@@ -321056,7 +321110,7 @@ var init_paint = __esm({
321056
321110
  ...args2.join !== void 0 ? { join: args2.join } : {},
321057
321111
  ...args2.dashPattern !== void 0 ? { dashPattern: args2.dashPattern } : {}
321058
321112
  };
321059
- patches.set(id3, { strokes: [merged, ...existing.slice(1)], ...order2 });
321113
+ patches.set(id3, { strokes: [merged, ...existing.slice(1)], strokeStyleId: void 0, ...order2 });
321060
321114
  }
321061
321115
  commitUpdates(ctx2, doc2, patches);
321062
321116
  return {
@@ -328696,7 +328750,7 @@ var init_package = __esm({
328696
328750
  "packages/runtime/package.json"() {
328697
328751
  package_default = {
328698
328752
  name: "@popcraft/runtime",
328699
- version: "0.53.2",
328753
+ version: "0.53.3",
328700
328754
  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.",
328701
328755
  license: "MIT",
328702
328756
  homepage: "https://popcraft.app/docs/exporting/nextjs",
@@ -353404,7 +353458,6 @@ function compileModule(module2) {
353404
353458
  var import_sucrase, BUILT_IN, memo4;
353405
353459
  var init_compile2 = __esm({
353406
353460
  "lib/code/compile.ts"() {
353407
- "use strict";
353408
353461
  import_sucrase = __toESM(require_dist2());
353409
353462
  init_source2();
353410
353463
  init_source2();
@@ -401509,6 +401562,7 @@ function placeDesign(doc2, built, source3, size6, name2, at4) {
401509
401562
  var DESIGN_NAMESPACES, DERIVED2, templateOfBuild;
401510
401563
  var init_build3 = __esm({
401511
401564
  "lib/agent/design-script/build.ts"() {
401565
+ "use strict";
401512
401566
  init_hash();
401513
401567
  init_scene_graph();
401514
401568
  init_libraries();
@@ -401538,6 +401592,7 @@ function designFrameOf(doc2, id3) {
401538
401592
  }
401539
401593
  var init_locate = __esm({
401540
401594
  "lib/agent/design-script/locate.ts"() {
401595
+ "use strict";
401541
401596
  }
401542
401597
  });
401543
401598
 
@@ -414284,7 +414339,7 @@ init_resources();
414284
414339
  init_desktop();
414285
414340
  init_hypery();
414286
414341
  import { createInterface } from "node:readline";
414287
- var VERSION2 = "0.53.2";
414342
+ var VERSION2 = "0.53.3";
414288
414343
  var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
414289
414344
 
414290
414345
  Files (headless, on .popcraft files):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcraft/cli",
3
- "version": "0.53.2",
3
+ "version": "0.53.3",
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.2"
37
+ "@popcraft/kit": "0.53.3"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node build.mjs",