@popcraft/cli 0.31.0 → 0.32.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 +42 -13
- package/package.json +2 -2
package/dist/popcraft.mjs
CHANGED
|
@@ -1188,7 +1188,7 @@ function operations(spec = openapi) {
|
|
|
1188
1188
|
}
|
|
1189
1189
|
async function call(target2, method, path, opts = {}) {
|
|
1190
1190
|
const qs = new URLSearchParams(opts.query ?? {}).toString();
|
|
1191
|
-
const headers = { "user-agent": `popcraft-cli/${"0.
|
|
1191
|
+
const headers = { "user-agent": `popcraft-cli/${"0.32.1"}`, ...opts.headers };
|
|
1192
1192
|
if (target2.token) headers.authorization = `Bearer ${target2.token}`;
|
|
1193
1193
|
if (opts.contentType) headers["content-type"] = opts.contentType;
|
|
1194
1194
|
try {
|
|
@@ -6736,6 +6736,7 @@ __export(print_pages_exports, {
|
|
|
6736
6736
|
listMasterPages: () => listMasterPages,
|
|
6737
6737
|
listPrintPages: () => listPrintPages,
|
|
6738
6738
|
pagePosition: () => pagePosition,
|
|
6739
|
+
pagePositions: () => pagePositions,
|
|
6739
6740
|
placePrintPages: () => placePrintPages,
|
|
6740
6741
|
printPageOf: () => printPageOf,
|
|
6741
6742
|
reorderPrintPages: () => reorderPrintPages,
|
|
@@ -6813,6 +6814,36 @@ function pagePosition(index2, size6, facing) {
|
|
|
6813
6814
|
const right = index2 % 2 === 0;
|
|
6814
6815
|
return { x: right ? size6.width : 0, y: spread2 * (size6.height + gutter(size6.width)) };
|
|
6815
6816
|
}
|
|
6817
|
+
function pagePositions(sizes, page, facing) {
|
|
6818
|
+
if (!facing) {
|
|
6819
|
+
let x2 = 0;
|
|
6820
|
+
return sizes.map((s) => {
|
|
6821
|
+
const at4 = { x: x2, y: 0 };
|
|
6822
|
+
x2 += s.width + gutter(page.width);
|
|
6823
|
+
return at4;
|
|
6824
|
+
});
|
|
6825
|
+
}
|
|
6826
|
+
const row2 = page.height + gutter(page.width);
|
|
6827
|
+
let slot2 = 0;
|
|
6828
|
+
return sizes.map((s) => {
|
|
6829
|
+
if (isSpreadSheet(s.width, page)) {
|
|
6830
|
+
if (slot2 % 2 === 0) slot2++;
|
|
6831
|
+
const at5 = { x: 0, y: Math.ceil(slot2 / 2) * row2 };
|
|
6832
|
+
slot2 += 2;
|
|
6833
|
+
return at5;
|
|
6834
|
+
}
|
|
6835
|
+
const at4 = { x: slot2 % 2 === 0 ? page.width : 0, y: Math.ceil(slot2 / 2) * row2 };
|
|
6836
|
+
slot2++;
|
|
6837
|
+
return at4;
|
|
6838
|
+
});
|
|
6839
|
+
}
|
|
6840
|
+
function basePageSize(doc2, frames) {
|
|
6841
|
+
const preset = presetById(doc2.settings?.pageSize?.presetId);
|
|
6842
|
+
if (preset) return presetPx(preset);
|
|
6843
|
+
if (doc2.settings?.pageSize?.width && doc2.settings.pageSize.height) return { width: doc2.settings.pageSize.width, height: doc2.settings.pageSize.height };
|
|
6844
|
+
const first2 = frames[0];
|
|
6845
|
+
return first2 ? { width: first2.width, height: first2.height } : { width: 816, height: 1056 };
|
|
6846
|
+
}
|
|
6816
6847
|
function placePrintPages(doc2, pageId2) {
|
|
6817
6848
|
const patches = {};
|
|
6818
6849
|
const facing = doc2.settings?.facingPages;
|
|
@@ -6820,7 +6851,9 @@ function placePrintPages(doc2, pageId2) {
|
|
|
6820
6851
|
const p2 = at4(i2, f2);
|
|
6821
6852
|
if (f2.x !== p2.x || f2.y !== p2.y) patches[f2.id] = { ...patches[f2.id] ?? {}, ...p2 };
|
|
6822
6853
|
});
|
|
6823
|
-
|
|
6854
|
+
const pages2 = listPrintPages(doc2, pageId2);
|
|
6855
|
+
const positions = pagePositions(pages2, basePageSize(doc2, pages2), facing);
|
|
6856
|
+
place4(pages2, (i2) => positions[i2]);
|
|
6824
6857
|
place4(listMasterPages(doc2, pageId2), (i2, f2) => masterPosition(i2, f2));
|
|
6825
6858
|
return patches;
|
|
6826
6859
|
}
|
|
@@ -6841,7 +6874,7 @@ function createPrintPage(doc2, pageId2, opts = {}) {
|
|
|
6841
6874
|
const last3 = existing[existing.length - 1];
|
|
6842
6875
|
const frame2 = createFrame({
|
|
6843
6876
|
name: opts.name ?? `Page ${index2 + 1}`,
|
|
6844
|
-
...
|
|
6877
|
+
...pagePositions([...existing, size6], basePageSize(doc2, existing.length ? existing : [size6]), doc2.settings?.facingPages)[index2],
|
|
6845
6878
|
width: size6.width,
|
|
6846
6879
|
height: size6.height,
|
|
6847
6880
|
fills: [{ type: "SOLID", color: createColor(1, 1, 1), opacity: 1, visible: true }],
|
|
@@ -6949,7 +6982,7 @@ function documentFromPreset(name2, preset) {
|
|
|
6949
6982
|
if (guides.length) doc2.nodes[pageId2].guides = guides;
|
|
6950
6983
|
return doc2;
|
|
6951
6984
|
}
|
|
6952
|
-
var isFixedPageKind, isPrintPage, isMasterPage, ordered, edges, gutter, masterPosition, foldsOn, MASTER_NAMES;
|
|
6985
|
+
var isFixedPageKind, isPrintPage, isMasterPage, ordered, edges, gutter, isSpreadSheet, masterPosition, foldsOn, MASTER_NAMES;
|
|
6953
6986
|
var init_print_pages = __esm({
|
|
6954
6987
|
"lib/document/print-pages.ts"() {
|
|
6955
6988
|
"use strict";
|
|
@@ -6963,6 +6996,7 @@ var init_print_pages = __esm({
|
|
|
6963
6996
|
ordered = (frames) => frames.map((f2, i2) => ({ f: f2, i: i2 })).sort((a, b) => (a.f.print.index ?? Infinity) - (b.f.print.index ?? Infinity) || a.f.y - b.f.y || a.f.x - b.f.x || a.i - b.i).map((x2) => x2.f);
|
|
6964
6997
|
edges = (v) => ({ top: v, right: v, bottom: v, left: v });
|
|
6965
6998
|
gutter = (w) => Math.round(w * 0.15);
|
|
6999
|
+
isSpreadSheet = (w, page) => w > page.width * 1.5;
|
|
6966
7000
|
masterPosition = (index2, size6) => ({
|
|
6967
7001
|
x: index2 * (size6.width + gutter(size6.width)),
|
|
6968
7002
|
y: -(size6.height + 2 * gutter(size6.width))
|
|
@@ -261592,6 +261626,7 @@ function planEntryAction({ home }) {
|
|
|
261592
261626
|
var STORAGE_KEY2, useHyperyTeam, TEAM_PROMPT_ENABLED, TEAM_PROMPTED_KEY, PROMPTED_KEY, useTeamPrompt, started;
|
|
261593
261627
|
var init_team = __esm({
|
|
261594
261628
|
"lib/client/cloud/team.ts"() {
|
|
261629
|
+
"use strict";
|
|
261595
261630
|
init_esm();
|
|
261596
261631
|
init_api4();
|
|
261597
261632
|
init_session();
|
|
@@ -310497,7 +310532,6 @@ function creditLine(c2) {
|
|
|
310497
310532
|
var MAX_PHOTO_PAGE, MAX_PHOTO_QUERY, UUID, isPhotoId, photoImagePath;
|
|
310498
310533
|
var init_stock = __esm({
|
|
310499
310534
|
"lib/photos/stock.ts"() {
|
|
310500
|
-
"use strict";
|
|
310501
310535
|
MAX_PHOTO_PAGE = 12;
|
|
310502
310536
|
MAX_PHOTO_QUERY = 200;
|
|
310503
310537
|
UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
@@ -315622,7 +315656,6 @@ async function exportSettingFile(renderer, node2, setting, doc2, styles) {
|
|
|
315622
315656
|
var MIME, DEFAULT_EXPORT, exportSettingsOf;
|
|
315623
315657
|
var init_export = __esm({
|
|
315624
315658
|
"lib/io/export.ts"() {
|
|
315625
|
-
"use strict";
|
|
315626
315659
|
init_download();
|
|
315627
315660
|
init_scene_graph();
|
|
315628
315661
|
init_codecs();
|
|
@@ -326409,7 +326442,7 @@ var init_package = __esm({
|
|
|
326409
326442
|
"packages/runtime/package.json"() {
|
|
326410
326443
|
package_default = {
|
|
326411
326444
|
name: "@popcraft/runtime",
|
|
326412
|
-
version: "0.
|
|
326445
|
+
version: "0.32.1",
|
|
326413
326446
|
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.",
|
|
326414
326447
|
license: "MIT",
|
|
326415
326448
|
homepage: "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -351075,7 +351108,6 @@ function exportsOf(source3) {
|
|
|
351075
351108
|
var CODE_LIMITS, packageOf;
|
|
351076
351109
|
var init_source2 = __esm({
|
|
351077
351110
|
"lib/code/source.ts"() {
|
|
351078
|
-
"use strict";
|
|
351079
351111
|
CODE_LIMITS = { modules: 100, sourceLength: 2e5, packages: 12 };
|
|
351080
351112
|
packageOf = (spec) => spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
|
|
351081
351113
|
}
|
|
@@ -351118,7 +351150,6 @@ function compileModule(module2) {
|
|
|
351118
351150
|
var import_sucrase, BUILT_IN, memo4;
|
|
351119
351151
|
var init_compile2 = __esm({
|
|
351120
351152
|
"lib/code/compile.ts"() {
|
|
351121
|
-
"use strict";
|
|
351122
351153
|
import_sucrase = __toESM(require_dist2());
|
|
351123
351154
|
init_source2();
|
|
351124
351155
|
init_source2();
|
|
@@ -351196,6 +351227,7 @@ function hashOf2(text) {
|
|
|
351196
351227
|
}
|
|
351197
351228
|
var init_hash = __esm({
|
|
351198
351229
|
"lib/code/hash.ts"() {
|
|
351230
|
+
"use strict";
|
|
351199
351231
|
}
|
|
351200
351232
|
});
|
|
351201
351233
|
|
|
@@ -397058,7 +397090,6 @@ function record(source, namespaces, globals, limits) {
|
|
|
397058
397090
|
var HELPER_NAMES;
|
|
397059
397091
|
var init_helper_names = __esm({
|
|
397060
397092
|
"lib/agent/design-script/helper-names.ts"() {
|
|
397061
|
-
"use strict";
|
|
397062
397093
|
HELPER_NAMES = ["draw", "marks", "fit", "motion", "captions", "overlays", "texture", "pointer", "windows", "devices", "type", "beat", "web", "social", "video", "site", "effects"];
|
|
397063
397094
|
}
|
|
397064
397095
|
});
|
|
@@ -397161,7 +397192,6 @@ async function replay(rec, namespaces2) {
|
|
|
397161
397192
|
var BLOCKED, isRef2, isFn;
|
|
397162
397193
|
var init_replay = __esm({
|
|
397163
397194
|
"lib/agent/design-script/replay.ts"() {
|
|
397164
|
-
"use strict";
|
|
397165
397195
|
BLOCKED = /* @__PURE__ */ new Set(["constructor", "prototype", "__proto__", "caller", "callee", "arguments", "call", "apply", "bind"]);
|
|
397166
397196
|
isRef2 = (v) => !!v && typeof v === "object" && "$ref" in v && Array.isArray(v.path);
|
|
397167
397197
|
isFn = (v) => !!v && typeof v === "object" && "$fn" in v && Array.isArray(v.ops);
|
|
@@ -397442,7 +397472,6 @@ function designRecorder() {
|
|
|
397442
397472
|
var installed;
|
|
397443
397473
|
var init_recorders = __esm({
|
|
397444
397474
|
"lib/agent/design-script/recorders.ts"() {
|
|
397445
|
-
"use strict";
|
|
397446
397475
|
installed = null;
|
|
397447
397476
|
}
|
|
397448
397477
|
});
|
|
@@ -409763,7 +409792,7 @@ init_resources();
|
|
|
409763
409792
|
init_desktop();
|
|
409764
409793
|
init_hypery();
|
|
409765
409794
|
import { createInterface } from "node:readline";
|
|
409766
|
-
var VERSION2 = "0.
|
|
409795
|
+
var VERSION2 = "0.32.1";
|
|
409767
409796
|
var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
|
|
409768
409797
|
|
|
409769
409798
|
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.32.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.32.1"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "node build.mjs",
|