@popcraft/cli 0.10.0 → 0.11.1
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 +74 -18
- 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.
|
|
1189
|
+
const headers = { "user-agent": `popcraft-cli/${"0.11.1"}`, ...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();
|
|
@@ -305143,7 +305158,6 @@ function applyTextPath(layout2, path, tp, rebase = true) {
|
|
|
305143
305158
|
var defaultCircleRadius, ownsPath, mapPoint;
|
|
305144
305159
|
var init_text_path = __esm({
|
|
305145
305160
|
"lib/engine/text/text-path.ts"() {
|
|
305146
|
-
"use strict";
|
|
305147
305161
|
init_scene_graph();
|
|
305148
305162
|
init_transform();
|
|
305149
305163
|
init_shape_to_path();
|
|
@@ -305261,7 +305275,6 @@ function areaBounds(rings) {
|
|
|
305261
305275
|
}
|
|
305262
305276
|
var init_text_area = __esm({
|
|
305263
305277
|
"lib/engine/text/text-area.ts"() {
|
|
305264
|
-
"use strict";
|
|
305265
305278
|
}
|
|
305266
305279
|
});
|
|
305267
305280
|
|
|
@@ -306690,6 +306703,7 @@ var init_targets = __esm({
|
|
|
306690
306703
|
// lib/io/capability/live.ts
|
|
306691
306704
|
function movesItself(node2) {
|
|
306692
306705
|
if (isAnimated(node2)) return true;
|
|
306706
|
+
if (node2.type === "PIXEL_GRID" && (node2.frames?.length ?? 0) > 1) return true;
|
|
306693
306707
|
for (const f2 of node2.fills ?? []) {
|
|
306694
306708
|
if (f2.visible === false) continue;
|
|
306695
306709
|
if (f2.type === "VIDEO") return true;
|
|
@@ -306703,7 +306717,7 @@ function isLive(nodes, nodeId2) {
|
|
|
306703
306717
|
if (seen.has(id3)) return false;
|
|
306704
306718
|
seen.add(id3);
|
|
306705
306719
|
const n = nodes[id3.includes("::") ? id3.split("::").pop() : id3];
|
|
306706
|
-
if (!n || n.visible === false) return false;
|
|
306720
|
+
if (!n || n.visible === false && n.physics?.role !== "pose") return false;
|
|
306707
306721
|
if (movesItself(n)) return true;
|
|
306708
306722
|
const main2 = n.mainComponentId;
|
|
306709
306723
|
return (n.childIds ?? []).some(visit2) || n.type === "INSTANCE" && !!main2 && visit2(main2);
|
|
@@ -310416,6 +310430,7 @@ function agentToolList() {
|
|
|
310416
310430
|
var AGENT_CAPABILITIES, legacyCommandId, legacyTools, blobToDataUrl3, provided, legacyTool, legacyToolList;
|
|
310417
310431
|
var init_agent = __esm({
|
|
310418
310432
|
"lib/commands/agent.ts"() {
|
|
310433
|
+
"use strict";
|
|
310419
310434
|
init_types5();
|
|
310420
310435
|
init_registry();
|
|
310421
310436
|
init_errors();
|
|
@@ -318960,7 +318975,7 @@ var init_package = __esm({
|
|
|
318960
318975
|
"packages/runtime/package.json"() {
|
|
318961
318976
|
package_default = {
|
|
318962
318977
|
name: "@popcraft/runtime",
|
|
318963
|
-
version: "0.
|
|
318978
|
+
version: "0.11.1",
|
|
318964
318979
|
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
318980
|
license: "MIT",
|
|
318966
318981
|
homepage: "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -319586,7 +319601,6 @@ function routesOf(screens) {
|
|
|
319586
319601
|
var slug2;
|
|
319587
319602
|
var init_routes = __esm({
|
|
319588
319603
|
"lib/document/routes.ts"() {
|
|
319589
|
-
"use strict";
|
|
319590
319604
|
slug2 = (s) => s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
319591
319605
|
}
|
|
319592
319606
|
});
|
|
@@ -319608,6 +319622,8 @@ function sliceDocument(doc2, nodeId2, opts = {}) {
|
|
|
319608
319622
|
};
|
|
319609
319623
|
if (opts.self && doc2.nodes[nodeId2]) nodes[nodeId2] = { ...doc2.nodes[nodeId2], childIds: [] };
|
|
319610
319624
|
else take(nodeId2);
|
|
319625
|
+
const own2 = nodes[nodeId2];
|
|
319626
|
+
if (own2?.visible === false && own2.physics?.role === "pose") nodes[nodeId2] = { ...own2, visible: true };
|
|
319611
319627
|
let frameId = null;
|
|
319612
319628
|
let pageId2 = null;
|
|
319613
319629
|
let rootId = nodeId2;
|
|
@@ -319672,6 +319688,15 @@ function screenPhysics(doc2, screenId) {
|
|
|
319672
319688
|
const layers2 = [];
|
|
319673
319689
|
const controls = [];
|
|
319674
319690
|
const wins = [];
|
|
319691
|
+
const poses = [];
|
|
319692
|
+
const parallax = [];
|
|
319693
|
+
const posesIn = (id3) => {
|
|
319694
|
+
for (const c2 of doc2.nodes[id3]?.childIds ?? []) {
|
|
319695
|
+
const p2 = doc2.nodes[c2]?.physics;
|
|
319696
|
+
if (p2?.role === "pose" && p2.pose) poses.push([c2, p2.pose]);
|
|
319697
|
+
posesIn(c2);
|
|
319698
|
+
}
|
|
319699
|
+
};
|
|
319675
319700
|
let settings;
|
|
319676
319701
|
const walk4 = (id3) => {
|
|
319677
319702
|
const n = doc2.nodes[id3];
|
|
@@ -319683,9 +319708,22 @@ function screenPhysics(doc2, screenId) {
|
|
|
319683
319708
|
if (p2.role === "control") {
|
|
319684
319709
|
if (p2.control) controls.push([id3, p2.control]);
|
|
319685
319710
|
} else if (p2.role === "win") wins.push(id3);
|
|
319686
|
-
else {
|
|
319687
|
-
|
|
319711
|
+
else if (p2.role === "parallax") {
|
|
319712
|
+
if (p2.parallax) parallax.push([id3, p2.parallax]);
|
|
319713
|
+
} else if (p2.role !== "pose" && p2.role !== "reveal") {
|
|
319714
|
+
layers2.push({
|
|
319715
|
+
id: id3,
|
|
319716
|
+
role: p2.role,
|
|
319717
|
+
x: b.minX - origin.minX,
|
|
319718
|
+
y: b.minY - origin.minY,
|
|
319719
|
+
w: b.maxX - b.minX,
|
|
319720
|
+
h: b.maxY - b.minY,
|
|
319721
|
+
...p2.role === "hazard" && p2.patrol ? { patrol: p2.patrol } : {},
|
|
319722
|
+
...p2.role === "hazard" && p2.stomp ? { stomp: true } : {},
|
|
319723
|
+
...p2.role === "solid" && p2.bump ? { bump: p2.bump } : {}
|
|
319724
|
+
});
|
|
319688
319725
|
if (p2.role === "player" && p2.settings && !settings) settings = p2.settings;
|
|
319726
|
+
if (p2.role === "player" && !poses.length) posesIn(id3);
|
|
319689
319727
|
}
|
|
319690
319728
|
return;
|
|
319691
319729
|
}
|
|
@@ -319695,7 +319733,7 @@ function screenPhysics(doc2, screenId) {
|
|
|
319695
319733
|
const player = layers2.find((l) => l.role === "player");
|
|
319696
319734
|
if (!player) return null;
|
|
319697
319735
|
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 };
|
|
319736
|
+
return { layers: layers2, ...grid ? { grid } : {}, ...controls.length ? { controls } : {}, ...wins.length ? { wins } : {}, ...poses.length ? { poses } : {}, ...parallax.length ? { parallax } : {}, ...settings ? { settings } : {}, height: screen.height };
|
|
319699
319737
|
}
|
|
319700
319738
|
var init_physics = __esm({
|
|
319701
319739
|
"lib/document/physics.ts"() {
|
|
@@ -319757,7 +319795,6 @@ function fieldPart(nodes, id3) {
|
|
|
319757
319795
|
var cleanName2;
|
|
319758
319796
|
var init_controls = __esm({
|
|
319759
319797
|
"lib/document/controls.ts"() {
|
|
319760
|
-
"use strict";
|
|
319761
319798
|
cleanName2 = (raw) => raw.trim().replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
319762
319799
|
}
|
|
319763
319800
|
});
|
|
@@ -320002,6 +320039,22 @@ function anchorTargets(doc2) {
|
|
|
320002
320039
|
anchorMemo.set(doc2.nodes, out);
|
|
320003
320040
|
return out;
|
|
320004
320041
|
}
|
|
320042
|
+
function spriteOnly(nodes, id3) {
|
|
320043
|
+
let leaves = 0;
|
|
320044
|
+
const visit2 = (nid, depth2) => {
|
|
320045
|
+
const n = nodes[nid];
|
|
320046
|
+
if (!n || n.visible === false) return true;
|
|
320047
|
+
if (n.type === "PIXEL_GRID") {
|
|
320048
|
+
leaves++;
|
|
320049
|
+
return true;
|
|
320050
|
+
}
|
|
320051
|
+
if (depth2 > 8 || n.type !== "INSTANCE" && n.type !== "COMPONENT" && n.type !== "FRAME" && n.type !== "GROUP") return false;
|
|
320052
|
+
const main2 = n.mainComponentId;
|
|
320053
|
+
const kids = n.childIds?.length ? n.childIds : main2 ? [main2] : [];
|
|
320054
|
+
return kids.every((k2) => visit2(k2, depth2 + 1));
|
|
320055
|
+
};
|
|
320056
|
+
return visit2(id3, 0) && leaves > 0;
|
|
320057
|
+
}
|
|
320005
320058
|
function prepared(node2, doc2) {
|
|
320006
320059
|
let n = node2;
|
|
320007
320060
|
if (n.id.includes("::")) n = withInstanceBox(n, doc2.nodes);
|
|
@@ -320210,11 +320263,12 @@ function buildPlainTree(doc2, nodeId2, opts = {}, start2, hooks = {}) {
|
|
|
320210
320263
|
hooks.built?.(web, node2, { parent, in3D: in3D2, fold });
|
|
320211
320264
|
return web;
|
|
320212
320265
|
}
|
|
320213
|
-
|
|
320266
|
+
const sprite = opts.target === "site" && raw.type === "INSTANCE" && !raw.id.includes("::") && spriteOnly(doc2.nodes, raw.id) && isLive(doc2.nodes, raw.id);
|
|
320267
|
+
if (!exp.css || sprite) {
|
|
320214
320268
|
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 } : {} };
|
|
320269
|
+
web.asset = { kind: opts.assetKind ?? (exp.needsRaster ? "png" : "svg"), reason: exp.reason || (sprite ? "an animated sprite" : ""), ...item?.suffix ? { of: node2.id } : {} };
|
|
320216
320270
|
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;
|
|
320271
|
+
if (sprite || opts.target === "site" && renderMode(node2, { styles: doc2.styles, live: isLive(doc2.nodes, raw.id) }) === "island") web.island = true;
|
|
320218
320272
|
hooks.built?.(web, node2, { parent, in3D: in3D2, fold });
|
|
320219
320273
|
return web;
|
|
320220
320274
|
}
|
|
@@ -320341,8 +320395,9 @@ var init_tree = __esm({
|
|
|
320341
320395
|
PAINTED = ["background", "border", "border-style", "border-color", "border-width", "outline", "border-radius", "box-shadow", "box-sizing", "filter", "backdrop-filter"];
|
|
320342
320396
|
anchorMemo = /* @__PURE__ */ new WeakMap();
|
|
320343
320397
|
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
|
|
320345
|
-
|
|
320398
|
+
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
|
|
320399
|
+
// the platformer on winning or as the player moves.
|
|
320400
|
+
n.physics?.role === "win" || n.physics?.role === "pose" || n.physics?.role === "reveal";
|
|
320346
320401
|
isFlex = (f2) => f2?.layoutMode === "HORIZONTAL" || f2?.layoutMode === "VERTICAL";
|
|
320347
320402
|
round3 = (v) => Math.round(v * 1e3) / 1e3;
|
|
320348
320403
|
foldVar = (depth2) => `--pc-f${depth2}`;
|
|
@@ -344608,6 +344663,7 @@ function hashOf(text) {
|
|
|
344608
344663
|
}
|
|
344609
344664
|
var init_hash = __esm({
|
|
344610
344665
|
"lib/code/hash.ts"() {
|
|
344666
|
+
"use strict";
|
|
344611
344667
|
}
|
|
344612
344668
|
});
|
|
344613
344669
|
|
|
@@ -388492,7 +388548,6 @@ function record(source, namespaces, globals, limits) {
|
|
|
388492
388548
|
var HELPER_NAMES;
|
|
388493
388549
|
var init_helper_names = __esm({
|
|
388494
388550
|
"lib/agent/design-script/helper-names.ts"() {
|
|
388495
|
-
"use strict";
|
|
388496
388551
|
HELPER_NAMES = ["draw", "marks", "fit", "motion", "captions", "overlays", "texture", "pointer", "windows", "devices", "type", "beat", "web", "social", "video", "site", "effects"];
|
|
388497
388552
|
}
|
|
388498
388553
|
});
|
|
@@ -393468,6 +393523,7 @@ function registerBuiltinCommands() {
|
|
|
393468
393523
|
var builtinCommands, uiOnlyCommands;
|
|
393469
393524
|
var init_builtin4 = __esm({
|
|
393470
393525
|
"lib/commands/builtin.ts"() {
|
|
393526
|
+
"use strict";
|
|
393471
393527
|
init_registry();
|
|
393472
393528
|
init_node();
|
|
393473
393529
|
init_node();
|
|
@@ -400890,7 +400946,7 @@ init_resources();
|
|
|
400890
400946
|
init_desktop();
|
|
400891
400947
|
init_hypery();
|
|
400892
400948
|
import { createInterface } from "node:readline";
|
|
400893
|
-
var VERSION2 = "0.
|
|
400949
|
+
var VERSION2 = "0.11.1";
|
|
400894
400950
|
var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
|
|
400895
400951
|
|
|
400896
400952
|
Files (headless, on .popcraft files):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popcraft/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
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.
|
|
37
|
+
"@popcraft/kit": "0.11.1"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "node build.mjs",
|