@popcraft/cli 0.10.0 → 0.11.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.
Files changed (2) hide show
  1. package/dist/popcraft.mjs +74 -14
  2. package/package.json +2 -2
package/dist/popcraft.mjs CHANGED
@@ -1186,7 +1186,7 @@ function operations(spec = openapi) {
1186
1186
  }
1187
1187
  async function call(target2, method, path, opts = {}) {
1188
1188
  const qs = new URLSearchParams(opts.query ?? {}).toString();
1189
- const headers = { "user-agent": `popcraft-cli/${"0.10.0"}`, ...opts.headers };
1189
+ const headers = { "user-agent": `popcraft-cli/${"0.11.0"}`, ...opts.headers };
1190
1190
  if (target2.token) headers.authorization = `Bearer ${target2.token}`;
1191
1191
  if (opts.contentType) headers["content-type"] = opts.contentType;
1192
1192
  try {
@@ -34540,30 +34540,46 @@ var init_en2 = __esm({
34540
34540
  "photoCredit.creditRequiredWhereYouPublish": "Credit required where you publish it (SVG and PDF exports include it).",
34541
34541
  "photosSection.clickToAddFillsA": "Click to add (fills a selected photo frame), or drag onto the canvas",
34542
34542
  "photosSection.searchPhotos": "Search photos",
34543
+ "physicsSection.bump": "Bumps when hit from below",
34544
+ "physicsSection.bumpReward": "Coins",
34545
+ "physicsSection.bumpRewardHint": "Coins it gives the first time it is bumped",
34543
34546
  "physicsSection.control": "Button",
34544
34547
  "physicsSection.controlJump": "Jump",
34545
34548
  "physicsSection.controlLeft": "Run left",
34546
34549
  "physicsSection.controlRight": "Run right",
34550
+ "physicsSection.depth": "Depth",
34551
+ "physicsSection.depthHint": "How far it slides for each pixel the player runs: 0.1 is far away, 0.5 is near",
34547
34552
  "physicsSection.game": "Game",
34548
34553
  "physicsSection.gravity": "Grav",
34549
34554
  "physicsSection.gravityHint": "Gravity (px per second\xB2)",
34550
34555
  "physicsSection.hint": "A screen with a Player plays as a platformer in Present mode and on a published site: arrows or A/D to run, Space or W to jump.",
34551
34556
  "physicsSection.jump": "Jmp",
34552
34557
  "physicsSection.jumpHint": "Jump strength (px per second at take-off)",
34558
+ "physicsSection.patrol": "Patrol",
34559
+ "physicsSection.patrolHint": "Walks this far to the right and back, facing the way it goes (0 stands still)",
34560
+ "physicsSection.patrolSpeed": "Speed",
34553
34561
  "physicsSection.pixelPerfect": "Pixel-perfect",
34554
34562
  "physicsSection.pixelPerfectHint": "Present this screen so each pixel-art pixel is a whole number of screen pixels, and move game sprites on their pixel grid.",
34563
+ "physicsSection.pose": "Pose",
34564
+ "physicsSection.poseIdle": "Idle",
34565
+ "physicsSection.poseJump": "In the air",
34566
+ "physicsSection.poseRun": "Running",
34555
34567
  "physicsSection.role": "Role in the game",
34556
34568
  "physicsSection.roleCollectible": "Collectible",
34557
34569
  "physicsSection.roleControl": "On-screen button",
34558
34570
  "physicsSection.roleGoal": "Goal",
34559
34571
  "physicsSection.roleHazard": "Hazard (restarts)",
34560
34572
  "physicsSection.roleNone": "Not part of a game",
34573
+ "physicsSection.roleParallax": "Parallax scenery",
34561
34574
  "physicsSection.rolePlatform": "One-way platform",
34562
34575
  "physicsSection.rolePlayer": "Player",
34576
+ "physicsSection.rolePose": "Player pose",
34577
+ "physicsSection.roleReveal": "Shown when bumped",
34563
34578
  "physicsSection.roleSolid": "Solid (walls, ground)",
34564
34579
  "physicsSection.roleWin": "Shown on winning",
34565
34580
  "physicsSection.speed": "Spd",
34566
34581
  "physicsSection.speedHint": "Running speed (px per second)",
34582
+ "physicsSection.stomp": "Can be stomped from above",
34567
34583
  "pixelGridSection.addColor": "Add color",
34568
34584
  "pixelGridSection.addImage": "Add image",
34569
34585
  "pixelGridSection.bakeEveryFrameSLayers": "Bake every frame's layers into its pixels and remove all layers",
@@ -241304,7 +241320,6 @@ function resyncText(doc2, ids2) {
241304
241320
  var isVirtualId;
241305
241321
  var init_invariants2 = __esm({
241306
241322
  "lib/document/invariants.ts"() {
241307
- "use strict";
241308
241323
  init_auto_layout();
241309
241324
  init_scene_graph();
241310
241325
  init_text_bounds();
@@ -306690,6 +306705,7 @@ var init_targets = __esm({
306690
306705
  // lib/io/capability/live.ts
306691
306706
  function movesItself(node2) {
306692
306707
  if (isAnimated(node2)) return true;
306708
+ if (node2.type === "PIXEL_GRID" && (node2.frames?.length ?? 0) > 1) return true;
306693
306709
  for (const f2 of node2.fills ?? []) {
306694
306710
  if (f2.visible === false) continue;
306695
306711
  if (f2.type === "VIDEO") return true;
@@ -306703,7 +306719,7 @@ function isLive(nodes, nodeId2) {
306703
306719
  if (seen.has(id3)) return false;
306704
306720
  seen.add(id3);
306705
306721
  const n = nodes[id3.includes("::") ? id3.split("::").pop() : id3];
306706
- if (!n || n.visible === false) return false;
306722
+ if (!n || n.visible === false && n.physics?.role !== "pose") return false;
306707
306723
  if (movesItself(n)) return true;
306708
306724
  const main2 = n.mainComponentId;
306709
306725
  return (n.childIds ?? []).some(visit2) || n.type === "INSTANCE" && !!main2 && visit2(main2);
@@ -310416,6 +310432,7 @@ function agentToolList() {
310416
310432
  var AGENT_CAPABILITIES, legacyCommandId, legacyTools, blobToDataUrl3, provided, legacyTool, legacyToolList;
310417
310433
  var init_agent = __esm({
310418
310434
  "lib/commands/agent.ts"() {
310435
+ "use strict";
310419
310436
  init_types5();
310420
310437
  init_registry();
310421
310438
  init_errors();
@@ -318960,7 +318977,7 @@ var init_package = __esm({
318960
318977
  "packages/runtime/package.json"() {
318961
318978
  package_default = {
318962
318979
  name: "@popcraft/runtime",
318963
- version: "0.10.0",
318980
+ version: "0.11.0",
318964
318981
  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.",
318965
318982
  license: "MIT",
318966
318983
  homepage: "https://popcraft.app/docs/exporting/nextjs",
@@ -319608,6 +319625,8 @@ function sliceDocument(doc2, nodeId2, opts = {}) {
319608
319625
  };
319609
319626
  if (opts.self && doc2.nodes[nodeId2]) nodes[nodeId2] = { ...doc2.nodes[nodeId2], childIds: [] };
319610
319627
  else take(nodeId2);
319628
+ const own2 = nodes[nodeId2];
319629
+ if (own2?.visible === false && own2.physics?.role === "pose") nodes[nodeId2] = { ...own2, visible: true };
319611
319630
  let frameId = null;
319612
319631
  let pageId2 = null;
319613
319632
  let rootId = nodeId2;
@@ -319672,6 +319691,15 @@ function screenPhysics(doc2, screenId) {
319672
319691
  const layers2 = [];
319673
319692
  const controls = [];
319674
319693
  const wins = [];
319694
+ const poses = [];
319695
+ const parallax = [];
319696
+ const posesIn = (id3) => {
319697
+ for (const c2 of doc2.nodes[id3]?.childIds ?? []) {
319698
+ const p2 = doc2.nodes[c2]?.physics;
319699
+ if (p2?.role === "pose" && p2.pose) poses.push([c2, p2.pose]);
319700
+ posesIn(c2);
319701
+ }
319702
+ };
319675
319703
  let settings;
319676
319704
  const walk4 = (id3) => {
319677
319705
  const n = doc2.nodes[id3];
@@ -319683,9 +319711,22 @@ function screenPhysics(doc2, screenId) {
319683
319711
  if (p2.role === "control") {
319684
319712
  if (p2.control) controls.push([id3, p2.control]);
319685
319713
  } else if (p2.role === "win") wins.push(id3);
319686
- else {
319687
- layers2.push({ id: id3, role: p2.role, x: b.minX - origin.minX, y: b.minY - origin.minY, w: b.maxX - b.minX, h: b.maxY - b.minY });
319714
+ else if (p2.role === "parallax") {
319715
+ if (p2.parallax) parallax.push([id3, p2.parallax]);
319716
+ } else if (p2.role !== "pose" && p2.role !== "reveal") {
319717
+ layers2.push({
319718
+ id: id3,
319719
+ role: p2.role,
319720
+ x: b.minX - origin.minX,
319721
+ y: b.minY - origin.minY,
319722
+ w: b.maxX - b.minX,
319723
+ h: b.maxY - b.minY,
319724
+ ...p2.role === "hazard" && p2.patrol ? { patrol: p2.patrol } : {},
319725
+ ...p2.role === "hazard" && p2.stomp ? { stomp: true } : {},
319726
+ ...p2.role === "solid" && p2.bump ? { bump: p2.bump } : {}
319727
+ });
319688
319728
  if (p2.role === "player" && p2.settings && !settings) settings = p2.settings;
319729
+ if (p2.role === "player" && !poses.length) posesIn(id3);
319689
319730
  }
319690
319731
  return;
319691
319732
  }
@@ -319695,7 +319736,7 @@ function screenPhysics(doc2, screenId) {
319695
319736
  const player = layers2.find((l) => l.role === "player");
319696
319737
  if (!player) return null;
319697
319738
  const grid = screen.pixelPerfect ? pixelCell(doc2, player.id) : null;
319698
- return { layers: layers2, ...grid ? { grid } : {}, ...controls.length ? { controls } : {}, ...wins.length ? { wins } : {}, ...settings ? { settings } : {}, height: screen.height };
319739
+ return { layers: layers2, ...grid ? { grid } : {}, ...controls.length ? { controls } : {}, ...wins.length ? { wins } : {}, ...poses.length ? { poses } : {}, ...parallax.length ? { parallax } : {}, ...settings ? { settings } : {}, height: screen.height };
319699
319740
  }
319700
319741
  var init_physics = __esm({
319701
319742
  "lib/document/physics.ts"() {
@@ -320002,6 +320043,22 @@ function anchorTargets(doc2) {
320002
320043
  anchorMemo.set(doc2.nodes, out);
320003
320044
  return out;
320004
320045
  }
320046
+ function spriteOnly(nodes, id3) {
320047
+ let leaves = 0;
320048
+ const visit2 = (nid, depth2) => {
320049
+ const n = nodes[nid];
320050
+ if (!n || n.visible === false) return true;
320051
+ if (n.type === "PIXEL_GRID") {
320052
+ leaves++;
320053
+ return true;
320054
+ }
320055
+ if (depth2 > 8 || n.type !== "INSTANCE" && n.type !== "COMPONENT" && n.type !== "FRAME" && n.type !== "GROUP") return false;
320056
+ const main2 = n.mainComponentId;
320057
+ const kids = n.childIds?.length ? n.childIds : main2 ? [main2] : [];
320058
+ return kids.every((k2) => visit2(k2, depth2 + 1));
320059
+ };
320060
+ return visit2(id3, 0) && leaves > 0;
320061
+ }
320005
320062
  function prepared(node2, doc2) {
320006
320063
  let n = node2;
320007
320064
  if (n.id.includes("::")) n = withInstanceBox(n, doc2.nodes);
@@ -320210,11 +320267,12 @@ function buildPlainTree(doc2, nodeId2, opts = {}, start2, hooks = {}) {
320210
320267
  hooks.built?.(web, node2, { parent, in3D: in3D2, fold });
320211
320268
  return web;
320212
320269
  }
320213
- if (!exp.css) {
320270
+ const sprite = opts.target === "site" && raw.type === "INSTANCE" && !raw.id.includes("::") && spriteOnly(doc2.nodes, raw.id) && isLive(doc2.nodes, raw.id);
320271
+ if (!exp.css || sprite) {
320214
320272
  for (const k2 of PAINTED) delete style[k2];
320215
- web.asset = { kind: opts.assetKind ?? (exp.needsRaster ? "png" : "svg"), reason: exp.reason, ...item?.suffix ? { of: node2.id } : {} };
320273
+ web.asset = { kind: opts.assetKind ?? (exp.needsRaster ? "png" : "svg"), reason: exp.reason || (sprite ? "an animated sprite" : ""), ...item?.suffix ? { of: node2.id } : {} };
320216
320274
  if (isPixelArt(doc2, raw.id)) style["image-rendering"] = "pixelated";
320217
- if (opts.target === "site" && renderMode(node2, { styles: doc2.styles, live: isLive(doc2.nodes, raw.id) }) === "island") web.island = true;
320275
+ if (sprite || opts.target === "site" && renderMode(node2, { styles: doc2.styles, live: isLive(doc2.nodes, raw.id) }) === "island") web.island = true;
320218
320276
  hooks.built?.(web, node2, { parent, in3D: in3D2, fold });
320219
320277
  return web;
320220
320278
  }
@@ -320341,8 +320399,9 @@ var init_tree = __esm({
320341
320399
  PAINTED = ["background", "border", "border-style", "border-color", "border-width", "outline", "border-radius", "box-shadow", "box-sizing", "filter", "backdrop-filter"];
320342
320400
  anchorMemo = /* @__PURE__ */ new WeakMap();
320343
320401
  followsVisibility = (n) => !!n.boundVariables?.visible || !!n.boundExpressions?.visible || // Hidden in the design and shown at a breakpoint: on the page, for the media query that shows it.
320344
- Object.values(n.responsive ?? {}).some((o) => o.visible === true) || // A game's win banner (LayerPhysics role 'win'): hidden in the design, shown by the platformer on winning.
320345
- n.physics?.role === "win";
320402
+ Object.values(n.responsive ?? {}).some((o) => o.visible === true) || // A game's win banner (LayerPhysics role 'win') and a player's run and jump poses: hidden in the design, shown by
320403
+ // the platformer on winning or as the player moves.
320404
+ n.physics?.role === "win" || n.physics?.role === "pose" || n.physics?.role === "reveal";
320346
320405
  isFlex = (f2) => f2?.layoutMode === "HORIZONTAL" || f2?.layoutMode === "VERTICAL";
320347
320406
  round3 = (v) => Math.round(v * 1e3) / 1e3;
320348
320407
  foldVar = (depth2) => `--pc-f${depth2}`;
@@ -344608,6 +344667,7 @@ function hashOf(text) {
344608
344667
  }
344609
344668
  var init_hash = __esm({
344610
344669
  "lib/code/hash.ts"() {
344670
+ "use strict";
344611
344671
  }
344612
344672
  });
344613
344673
 
@@ -388492,7 +388552,6 @@ function record(source, namespaces, globals, limits) {
388492
388552
  var HELPER_NAMES;
388493
388553
  var init_helper_names = __esm({
388494
388554
  "lib/agent/design-script/helper-names.ts"() {
388495
- "use strict";
388496
388555
  HELPER_NAMES = ["draw", "marks", "fit", "motion", "captions", "overlays", "texture", "pointer", "windows", "devices", "type", "beat", "web", "social", "video", "site", "effects"];
388497
388556
  }
388498
388557
  });
@@ -393468,6 +393527,7 @@ function registerBuiltinCommands() {
393468
393527
  var builtinCommands, uiOnlyCommands;
393469
393528
  var init_builtin4 = __esm({
393470
393529
  "lib/commands/builtin.ts"() {
393530
+ "use strict";
393471
393531
  init_registry();
393472
393532
  init_node();
393473
393533
  init_node();
@@ -400890,7 +400950,7 @@ init_resources();
400890
400950
  init_desktop();
400891
400951
  init_hypery();
400892
400952
  import { createInterface } from "node:readline";
400893
- var VERSION2 = "0.10.0";
400953
+ var VERSION2 = "0.11.0";
400894
400954
  var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
400895
400955
 
400896
400956
  Files (headless, on .popcraft files):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcraft/cli",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
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.10.0"
37
+ "@popcraft/kit": "0.11.0"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node build.mjs",