@popcraft/cli 0.38.6 → 0.38.7
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 +98 -89
- 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.38.
|
|
1199
|
+
const headers = { "user-agent": `popcraft-cli/${"0.38.7"}`, ...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 {
|
|
@@ -96128,6 +96128,7 @@ async function sha256Prefix(bytes2) {
|
|
|
96128
96128
|
}
|
|
96129
96129
|
var init_media_hash = __esm({
|
|
96130
96130
|
"lib/storage/media-hash.ts"() {
|
|
96131
|
+
"use strict";
|
|
96131
96132
|
}
|
|
96132
96133
|
});
|
|
96133
96134
|
|
|
@@ -247572,7 +247573,6 @@ function repairCompositions(comps, nodes) {
|
|
|
247572
247573
|
var isObj5, finite6, optFinite, isVec2, TIMELINE_COLOR_IDS, TIMELINE_COLORS, UNITS, ORDERS, PROP_KEYS, ANIMATOR_ID, MOTION_TYPES, TRANSITIONS, isFraction, MEDIA_HASH;
|
|
247573
247574
|
var init_invariants = __esm({
|
|
247574
247575
|
"lib/motion/invariants.ts"() {
|
|
247575
|
-
"use strict";
|
|
247576
247576
|
init_easing();
|
|
247577
247577
|
init_properties();
|
|
247578
247578
|
init_markers();
|
|
@@ -261894,6 +261894,87 @@ var init_runtime3 = __esm({
|
|
|
261894
261894
|
}
|
|
261895
261895
|
});
|
|
261896
261896
|
|
|
261897
|
+
// lib/desktop/tauri.ts
|
|
261898
|
+
function tauri() {
|
|
261899
|
+
if (typeof window === "undefined") return null;
|
|
261900
|
+
return window.__TAURI__ ?? null;
|
|
261901
|
+
}
|
|
261902
|
+
function storePlatform() {
|
|
261903
|
+
if (typeof window === "undefined") return null;
|
|
261904
|
+
const flag = window.__POPCRAFT_PLATFORM__;
|
|
261905
|
+
if (flag === "ios" || flag === "android" || flag === "macos") return flag;
|
|
261906
|
+
if (!tauri() || typeof navigator === "undefined") return null;
|
|
261907
|
+
if (/iPhone|iPad|iPod/.test(navigator.userAgent)) return "ios";
|
|
261908
|
+
if (/Macintosh/.test(navigator.userAgent) && navigator.maxTouchPoints > 1) return "ios";
|
|
261909
|
+
if (/Android/.test(navigator.userAgent)) return "android";
|
|
261910
|
+
return null;
|
|
261911
|
+
}
|
|
261912
|
+
async function shareFileNatively(blob, name2, print2 = false) {
|
|
261913
|
+
const t3 = tauri();
|
|
261914
|
+
if (!t3 || storePlatform() !== "ios") return false;
|
|
261915
|
+
await t3.core.invoke("share_file", { name: name2, print: print2, data: await blobToBase64(blob) });
|
|
261916
|
+
return true;
|
|
261917
|
+
}
|
|
261918
|
+
function blobToBase64(blob) {
|
|
261919
|
+
return new Promise((resolve6, reject) => {
|
|
261920
|
+
const reader = new FileReader();
|
|
261921
|
+
reader.onload = () => resolve6(String(reader.result).slice(String(reader.result).indexOf(",") + 1));
|
|
261922
|
+
reader.onerror = () => reject(reader.error ?? new Error("Could not read the file"));
|
|
261923
|
+
reader.readAsDataURL(blob);
|
|
261924
|
+
});
|
|
261925
|
+
}
|
|
261926
|
+
function invoke(cmd, args2) {
|
|
261927
|
+
const t3 = tauri();
|
|
261928
|
+
return t3 ? t3.core.invoke(cmd, args2) : Promise.reject(new Error("Not running in the desktop app"));
|
|
261929
|
+
}
|
|
261930
|
+
function listenDesktop(event, handler) {
|
|
261931
|
+
const t3 = tauri();
|
|
261932
|
+
if (!t3) return () => {
|
|
261933
|
+
};
|
|
261934
|
+
let off = null;
|
|
261935
|
+
let cancelled = false;
|
|
261936
|
+
void t3.event.listen(event, (e) => handler(e.payload)).then((fn) => {
|
|
261937
|
+
if (cancelled) fn();
|
|
261938
|
+
else off = fn;
|
|
261939
|
+
});
|
|
261940
|
+
return () => {
|
|
261941
|
+
cancelled = true;
|
|
261942
|
+
off?.();
|
|
261943
|
+
};
|
|
261944
|
+
}
|
|
261945
|
+
var isDesktop;
|
|
261946
|
+
var init_tauri = __esm({
|
|
261947
|
+
"lib/desktop/tauri.ts"() {
|
|
261948
|
+
isDesktop = () => !!tauri();
|
|
261949
|
+
}
|
|
261950
|
+
});
|
|
261951
|
+
|
|
261952
|
+
// lib/desktop/open-link.ts
|
|
261953
|
+
function openLink(href) {
|
|
261954
|
+
if (isDesktop()) window.location.assign(href);
|
|
261955
|
+
else window.open(href, "_blank", "noopener");
|
|
261956
|
+
}
|
|
261957
|
+
function openSitePage(path) {
|
|
261958
|
+
if (!isDesktop()) {
|
|
261959
|
+
window.open(path, "_blank", "noopener");
|
|
261960
|
+
return;
|
|
261961
|
+
}
|
|
261962
|
+
const url4 = new URL(path, window.location.origin).href;
|
|
261963
|
+
invoke("open_external", { url: url4 }).catch(() => window.location.assign(path));
|
|
261964
|
+
}
|
|
261965
|
+
function openBeside(href) {
|
|
261966
|
+
if (!isDesktop()) return !!window.open(href, "_blank", "noopener,noreferrer");
|
|
261967
|
+
const url4 = new URL(href, window.location.href);
|
|
261968
|
+
if (url4.origin === window.location.origin) openSitePage(url4.pathname + url4.search + url4.hash);
|
|
261969
|
+
else window.location.assign(url4.href);
|
|
261970
|
+
return true;
|
|
261971
|
+
}
|
|
261972
|
+
var init_open_link = __esm({
|
|
261973
|
+
"lib/desktop/open-link.ts"() {
|
|
261974
|
+
init_tauri();
|
|
261975
|
+
}
|
|
261976
|
+
});
|
|
261977
|
+
|
|
261897
261978
|
// lib/plugins/plugin-store.ts
|
|
261898
261979
|
var plugin_store_exports = {};
|
|
261899
261980
|
__export(plugin_store_exports, {
|
|
@@ -261967,61 +262048,6 @@ var init_plan_limit = __esm({
|
|
|
261967
262048
|
}
|
|
261968
262049
|
});
|
|
261969
262050
|
|
|
261970
|
-
// lib/desktop/tauri.ts
|
|
261971
|
-
function tauri() {
|
|
261972
|
-
if (typeof window === "undefined") return null;
|
|
261973
|
-
return window.__TAURI__ ?? null;
|
|
261974
|
-
}
|
|
261975
|
-
function storePlatform() {
|
|
261976
|
-
if (typeof window === "undefined") return null;
|
|
261977
|
-
const flag = window.__POPCRAFT_PLATFORM__;
|
|
261978
|
-
if (flag === "ios" || flag === "android" || flag === "macos") return flag;
|
|
261979
|
-
if (!tauri() || typeof navigator === "undefined") return null;
|
|
261980
|
-
if (/iPhone|iPad|iPod/.test(navigator.userAgent)) return "ios";
|
|
261981
|
-
if (/Macintosh/.test(navigator.userAgent) && navigator.maxTouchPoints > 1) return "ios";
|
|
261982
|
-
if (/Android/.test(navigator.userAgent)) return "android";
|
|
261983
|
-
return null;
|
|
261984
|
-
}
|
|
261985
|
-
async function shareFileNatively(blob, name2, print2 = false) {
|
|
261986
|
-
const t3 = tauri();
|
|
261987
|
-
if (!t3 || storePlatform() !== "ios") return false;
|
|
261988
|
-
await t3.core.invoke("share_file", { name: name2, print: print2, data: await blobToBase64(blob) });
|
|
261989
|
-
return true;
|
|
261990
|
-
}
|
|
261991
|
-
function blobToBase64(blob) {
|
|
261992
|
-
return new Promise((resolve6, reject) => {
|
|
261993
|
-
const reader = new FileReader();
|
|
261994
|
-
reader.onload = () => resolve6(String(reader.result).slice(String(reader.result).indexOf(",") + 1));
|
|
261995
|
-
reader.onerror = () => reject(reader.error ?? new Error("Could not read the file"));
|
|
261996
|
-
reader.readAsDataURL(blob);
|
|
261997
|
-
});
|
|
261998
|
-
}
|
|
261999
|
-
function invoke(cmd, args2) {
|
|
262000
|
-
const t3 = tauri();
|
|
262001
|
-
return t3 ? t3.core.invoke(cmd, args2) : Promise.reject(new Error("Not running in the desktop app"));
|
|
262002
|
-
}
|
|
262003
|
-
function listenDesktop(event, handler) {
|
|
262004
|
-
const t3 = tauri();
|
|
262005
|
-
if (!t3) return () => {
|
|
262006
|
-
};
|
|
262007
|
-
let off = null;
|
|
262008
|
-
let cancelled = false;
|
|
262009
|
-
void t3.event.listen(event, (e) => handler(e.payload)).then((fn) => {
|
|
262010
|
-
if (cancelled) fn();
|
|
262011
|
-
else off = fn;
|
|
262012
|
-
});
|
|
262013
|
-
return () => {
|
|
262014
|
-
cancelled = true;
|
|
262015
|
-
off?.();
|
|
262016
|
-
};
|
|
262017
|
-
}
|
|
262018
|
-
var isDesktop;
|
|
262019
|
-
var init_tauri = __esm({
|
|
262020
|
-
"lib/desktop/tauri.ts"() {
|
|
262021
|
-
isDesktop = () => !!tauri();
|
|
262022
|
-
}
|
|
262023
|
-
});
|
|
262024
|
-
|
|
262025
262051
|
// lib/i18n/format.ts
|
|
262026
262052
|
function cached2(kind, opts, make) {
|
|
262027
262053
|
const locale = intlLocale(getLocale());
|
|
@@ -311077,6 +311103,7 @@ async function dispatchShaped(key5, options) {
|
|
|
311077
311103
|
var onViolation;
|
|
311078
311104
|
var init_dispatch = __esm({
|
|
311079
311105
|
"lib/commands/dispatch.ts"() {
|
|
311106
|
+
"use strict";
|
|
311080
311107
|
init_errors();
|
|
311081
311108
|
init_registry();
|
|
311082
311109
|
init_confirm();
|
|
@@ -311255,7 +311282,6 @@ function browserDownload(blob, filename) {
|
|
|
311255
311282
|
}
|
|
311256
311283
|
var init_download = __esm({
|
|
311257
311284
|
"lib/io/download.ts"() {
|
|
311258
|
-
"use strict";
|
|
311259
311285
|
init_tauri();
|
|
311260
311286
|
}
|
|
311261
311287
|
});
|
|
@@ -317042,7 +317068,6 @@ function videoPixelSize(resolution, aspect) {
|
|
|
317042
317068
|
var VIDEO_ASPECTS, VIDEO_RESOLUTIONS, SEEDANCE_ASPECTS, range, VIDEO_MODELS, DEFAULT_VIDEO_MODEL, videoModel, VIDEO_LIMITS;
|
|
317043
317069
|
var init_video_models = __esm({
|
|
317044
317070
|
"lib/ai/video-models.ts"() {
|
|
317045
|
-
"use strict";
|
|
317046
317071
|
VIDEO_ASPECTS = ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9"];
|
|
317047
317072
|
VIDEO_RESOLUTIONS = ["480p", "720p", "1080p"];
|
|
317048
317073
|
SEEDANCE_ASPECTS = ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9"];
|
|
@@ -327394,7 +327419,7 @@ var init_package = __esm({
|
|
|
327394
327419
|
"packages/runtime/package.json"() {
|
|
327395
327420
|
package_default = {
|
|
327396
327421
|
name: "@popcraft/runtime",
|
|
327397
|
-
version: "0.38.
|
|
327422
|
+
version: "0.38.7",
|
|
327398
327423
|
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.",
|
|
327399
327424
|
license: "MIT",
|
|
327400
327425
|
homepage: "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -352060,6 +352085,7 @@ function exportsOf(source3) {
|
|
|
352060
352085
|
var CODE_LIMITS, packageOf;
|
|
352061
352086
|
var init_source2 = __esm({
|
|
352062
352087
|
"lib/code/source.ts"() {
|
|
352088
|
+
"use strict";
|
|
352063
352089
|
CODE_LIMITS = { modules: 100, sourceLength: 2e5, packages: 12 };
|
|
352064
352090
|
packageOf = (spec) => spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
|
|
352065
352091
|
}
|
|
@@ -361126,6 +361152,7 @@ var init_delete_current_file = __esm({
|
|
|
361126
361152
|
var storeOpsSeam;
|
|
361127
361153
|
var init_seams = __esm({
|
|
361128
361154
|
"lib/commands/seams.ts"() {
|
|
361155
|
+
"use strict";
|
|
361129
361156
|
storeOpsSeam = (st) => ({
|
|
361130
361157
|
booleanOperation: (op4) => st().booleanOperation(op4),
|
|
361131
361158
|
flatten: () => st().flattenSelection(),
|
|
@@ -362268,17 +362295,6 @@ var init_billing = __esm({
|
|
|
362268
362295
|
}
|
|
362269
362296
|
});
|
|
362270
362297
|
|
|
362271
|
-
// lib/desktop/open-link.ts
|
|
362272
|
-
function openLink(href) {
|
|
362273
|
-
if (isDesktop()) window.location.assign(href);
|
|
362274
|
-
else window.open(href, "_blank", "noopener");
|
|
362275
|
-
}
|
|
362276
|
-
var init_open_link = __esm({
|
|
362277
|
-
"lib/desktop/open-link.ts"() {
|
|
362278
|
-
init_tauri();
|
|
362279
|
-
}
|
|
362280
|
-
});
|
|
362281
|
-
|
|
362282
362298
|
// lib/client/cloud/buy-credits.ts
|
|
362283
362299
|
var buy_credits_exports = {};
|
|
362284
362300
|
__export(buy_credits_exports, {
|
|
@@ -365204,14 +365220,7 @@ function exportToJSON(document2) {
|
|
|
365204
365220
|
async function downloadJSON(document2, filename = "document.json") {
|
|
365205
365221
|
const json3 = exportToJSON(await portableDocument(document2));
|
|
365206
365222
|
const blob = new Blob([json3], { type: "application/json" });
|
|
365207
|
-
|
|
365208
|
-
const link2 = window.document.createElement("a");
|
|
365209
|
-
link2.href = url4;
|
|
365210
|
-
link2.download = filename;
|
|
365211
|
-
window.document.body.appendChild(link2);
|
|
365212
|
-
link2.click();
|
|
365213
|
-
window.document.body.removeChild(link2);
|
|
365214
|
-
URL.revokeObjectURL(url4);
|
|
365223
|
+
downloadBlob(blob, filename);
|
|
365215
365224
|
}
|
|
365216
365225
|
function importFromJSON(jsonString) {
|
|
365217
365226
|
try {
|
|
@@ -365242,6 +365251,7 @@ var init_json_export = __esm({
|
|
|
365242
365251
|
"lib/io/json-export.ts"() {
|
|
365243
365252
|
init_media_store();
|
|
365244
365253
|
init_document_fonts();
|
|
365254
|
+
init_download();
|
|
365245
365255
|
}
|
|
365246
365256
|
});
|
|
365247
365257
|
|
|
@@ -396128,8 +396138,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
396128
396138
|
storageGet: (key5) => pluginStorageGet(pluginId, key5),
|
|
396129
396139
|
storageSet: (key5, value3) => pluginStorageSet(pluginId, key5, value3),
|
|
396130
396140
|
openExternal: (url4) => {
|
|
396131
|
-
|
|
396132
|
-
if (!opened) throw new Error("The browser blocked the new tab");
|
|
396141
|
+
if (!openBeside(url4)) throw new Error("The browser blocked the new tab");
|
|
396133
396142
|
},
|
|
396134
396143
|
createDocument: async (opts2) => {
|
|
396135
396144
|
const { createFreshFileOrExplain: createFreshFileOrExplain2 } = await Promise.resolve().then(() => (init_new_file(), new_file_exports));
|
|
@@ -396297,6 +396306,7 @@ var init_host3 = __esm({
|
|
|
396297
396306
|
init_sync2();
|
|
396298
396307
|
init_theme_store();
|
|
396299
396308
|
init_panels();
|
|
396309
|
+
init_open_link();
|
|
396300
396310
|
running3 = /* @__PURE__ */ new Map();
|
|
396301
396311
|
if (typeof window !== "undefined" && false) {
|
|
396302
396312
|
window.__vpPlugins = { installPluginPayload, runPlugin, dispatchWidgetClick, closeSession, removePlugin, setEnabled, running: running3 };
|
|
@@ -398583,6 +398593,7 @@ function designRecorder() {
|
|
|
398583
398593
|
var installed;
|
|
398584
398594
|
var init_recorders = __esm({
|
|
398585
398595
|
"lib/agent/design-script/recorders.ts"() {
|
|
398596
|
+
"use strict";
|
|
398586
398597
|
installed = null;
|
|
398587
398598
|
}
|
|
398588
398599
|
});
|
|
@@ -399582,12 +399593,7 @@ async function exportLayerPng(id3) {
|
|
|
399582
399593
|
const px5 = await l.readPixels(id3);
|
|
399583
399594
|
if (!px5) return;
|
|
399584
399595
|
const png = await encodePng(px5.width, px5.height, px5.data);
|
|
399585
|
-
|
|
399586
|
-
const a = document.createElement("a");
|
|
399587
|
-
a.href = url4;
|
|
399588
|
-
a.download = `${node2.name || "paint-layer"}.png`;
|
|
399589
|
-
a.click();
|
|
399590
|
-
setTimeout(() => URL.revokeObjectURL(url4), 5e3);
|
|
399596
|
+
downloadBlob(new Blob([png], { type: "image/png" }), `${node2.name || "paint-layer"}.png`);
|
|
399591
399597
|
}
|
|
399592
399598
|
function clearPaintLayer(id3) {
|
|
399593
399599
|
useEditorStore.getState().commitRasterTiles(id3, {}, "Clear paint layer");
|
|
@@ -399635,6 +399641,7 @@ var init_raster_actions = __esm({
|
|
|
399635
399641
|
init_png();
|
|
399636
399642
|
init_raster_tiles();
|
|
399637
399643
|
init_canvas_dpr();
|
|
399644
|
+
init_download();
|
|
399638
399645
|
notice4 = (text) => window.dispatchEvent(new CustomEvent("popcraft-notice", { detail: { text } }));
|
|
399639
399646
|
}
|
|
399640
399647
|
});
|
|
@@ -403416,6 +403423,7 @@ function registerBuiltinCommands() {
|
|
|
403416
403423
|
var builtinCommands, uiOnlyCommands;
|
|
403417
403424
|
var init_builtin4 = __esm({
|
|
403418
403425
|
"lib/commands/builtin.ts"() {
|
|
403426
|
+
"use strict";
|
|
403419
403427
|
init_registry();
|
|
403420
403428
|
init_node();
|
|
403421
403429
|
init_node();
|
|
@@ -404755,6 +404763,7 @@ var init_editor_store = __esm({
|
|
|
404755
404763
|
init_library_link();
|
|
404756
404764
|
init_fonts();
|
|
404757
404765
|
init_runtime3();
|
|
404766
|
+
init_open_link();
|
|
404758
404767
|
STICKY_PROP_KEYS = [
|
|
404759
404768
|
"strokes",
|
|
404760
404769
|
"fills",
|
|
@@ -405320,7 +405329,7 @@ var init_editor_store = __esm({
|
|
|
405320
405329
|
if (e.settle) setTimeout(() => get4().focusOnNode(e.screen), 10);
|
|
405321
405330
|
else get4().focusOnNode(e.screen);
|
|
405322
405331
|
} else if (e.kind === "open") {
|
|
405323
|
-
|
|
405332
|
+
openBeside(e.href);
|
|
405324
405333
|
} else {
|
|
405325
405334
|
setTimeout(() => {
|
|
405326
405335
|
const at4 = runtimeOf(get4());
|
|
@@ -410993,7 +411002,7 @@ init_resources();
|
|
|
410993
411002
|
init_desktop();
|
|
410994
411003
|
init_hypery();
|
|
410995
411004
|
import { createInterface } from "node:readline";
|
|
410996
|
-
var VERSION2 = "0.38.
|
|
411005
|
+
var VERSION2 = "0.38.7";
|
|
410997
411006
|
var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
|
|
410998
411007
|
|
|
410999
411008
|
Files (headless, on .popcraft files):
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@popcraft/cli",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.7",
|
|
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.38.
|
|
37
|
+
"@popcraft/kit": "0.38.7"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "node build.mjs",
|