@popcraft/cli 0.38.5 → 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 +105 -88
- 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
|
|
|
@@ -96510,6 +96511,7 @@ function releaseMediaMemory(hash3) {
|
|
|
96510
96511
|
var key2, peaksKey, objectUrls, sourceKey, remoteResolver, MEDIA_FETCH_TIMEOUT_MS, SHIPPED_MEDIA_PATH, notShipped, MEDIA_SCHEME, isImageDataUrl, memory, pendingLoads, sourceAliases, PAINT_KEYS, URL_KEYS;
|
|
96511
96512
|
var init_media_store = __esm({
|
|
96512
96513
|
"lib/storage/media-store.ts"() {
|
|
96514
|
+
"use strict";
|
|
96513
96515
|
init_media_types();
|
|
96514
96516
|
init_idb();
|
|
96515
96517
|
init_media_hash();
|
|
@@ -247571,7 +247573,6 @@ function repairCompositions(comps, nodes) {
|
|
|
247571
247573
|
var isObj5, finite6, optFinite, isVec2, TIMELINE_COLOR_IDS, TIMELINE_COLORS, UNITS, ORDERS, PROP_KEYS, ANIMATOR_ID, MOTION_TYPES, TRANSITIONS, isFraction, MEDIA_HASH;
|
|
247572
247574
|
var init_invariants = __esm({
|
|
247573
247575
|
"lib/motion/invariants.ts"() {
|
|
247574
|
-
"use strict";
|
|
247575
247576
|
init_easing();
|
|
247576
247577
|
init_properties();
|
|
247577
247578
|
init_markers();
|
|
@@ -261893,6 +261894,87 @@ var init_runtime3 = __esm({
|
|
|
261893
261894
|
}
|
|
261894
261895
|
});
|
|
261895
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
|
+
|
|
261896
261978
|
// lib/plugins/plugin-store.ts
|
|
261897
261979
|
var plugin_store_exports = {};
|
|
261898
261980
|
__export(plugin_store_exports, {
|
|
@@ -261966,58 +262048,6 @@ var init_plan_limit = __esm({
|
|
|
261966
262048
|
}
|
|
261967
262049
|
});
|
|
261968
262050
|
|
|
261969
|
-
// lib/desktop/tauri.ts
|
|
261970
|
-
function tauri() {
|
|
261971
|
-
if (typeof window === "undefined") return null;
|
|
261972
|
-
return window.__TAURI__ ?? null;
|
|
261973
|
-
}
|
|
261974
|
-
function storePlatform() {
|
|
261975
|
-
if (typeof window === "undefined") return null;
|
|
261976
|
-
const flag = window.__POPCRAFT_PLATFORM__;
|
|
261977
|
-
if (flag === "ios" || flag === "android" || flag === "macos") return flag;
|
|
261978
|
-
if (!tauri() || typeof navigator === "undefined") return null;
|
|
261979
|
-
if (/iPhone|iPad|iPod/.test(navigator.userAgent)) return "ios";
|
|
261980
|
-
if (/Macintosh/.test(navigator.userAgent) && navigator.maxTouchPoints > 1) return "ios";
|
|
261981
|
-
if (/Android/.test(navigator.userAgent)) return "android";
|
|
261982
|
-
return null;
|
|
261983
|
-
}
|
|
261984
|
-
async function shareFileNatively(blob, name2, print2 = false) {
|
|
261985
|
-
const t3 = tauri();
|
|
261986
|
-
if (!t3 || storePlatform() !== "ios") return false;
|
|
261987
|
-
try {
|
|
261988
|
-
await t3.core.invoke("share_file", new Uint8Array(await blob.arrayBuffer()), { headers: { "x-name": encodeURIComponent(name2), "x-print": print2 ? "1" : "0" } });
|
|
261989
|
-
return true;
|
|
261990
|
-
} catch (e) {
|
|
261991
|
-
console.warn("[share_file]", e);
|
|
261992
|
-
return false;
|
|
261993
|
-
}
|
|
261994
|
-
}
|
|
261995
|
-
function invoke(cmd, args2) {
|
|
261996
|
-
const t3 = tauri();
|
|
261997
|
-
return t3 ? t3.core.invoke(cmd, args2) : Promise.reject(new Error("Not running in the desktop app"));
|
|
261998
|
-
}
|
|
261999
|
-
function listenDesktop(event, handler) {
|
|
262000
|
-
const t3 = tauri();
|
|
262001
|
-
if (!t3) return () => {
|
|
262002
|
-
};
|
|
262003
|
-
let off = null;
|
|
262004
|
-
let cancelled = false;
|
|
262005
|
-
void t3.event.listen(event, (e) => handler(e.payload)).then((fn) => {
|
|
262006
|
-
if (cancelled) fn();
|
|
262007
|
-
else off = fn;
|
|
262008
|
-
});
|
|
262009
|
-
return () => {
|
|
262010
|
-
cancelled = true;
|
|
262011
|
-
off?.();
|
|
262012
|
-
};
|
|
262013
|
-
}
|
|
262014
|
-
var isDesktop;
|
|
262015
|
-
var init_tauri = __esm({
|
|
262016
|
-
"lib/desktop/tauri.ts"() {
|
|
262017
|
-
isDesktop = () => !!tauri();
|
|
262018
|
-
}
|
|
262019
|
-
});
|
|
262020
|
-
|
|
262021
262051
|
// lib/i18n/format.ts
|
|
262022
262052
|
function cached2(kind, opts, make) {
|
|
262023
262053
|
const locale = intlLocale(getLocale());
|
|
@@ -311233,9 +311263,12 @@ __export(download_exports, {
|
|
|
311233
311263
|
downloadBlob: () => downloadBlob
|
|
311234
311264
|
});
|
|
311235
311265
|
function downloadBlob(blob, filename) {
|
|
311236
|
-
|
|
311237
|
-
|
|
311238
|
-
|
|
311266
|
+
shareFileNatively(blob, filename).then(
|
|
311267
|
+
(shared) => {
|
|
311268
|
+
if (!shared) browserDownload(blob, filename);
|
|
311269
|
+
},
|
|
311270
|
+
(e) => console.error("[share_file]", e)
|
|
311271
|
+
);
|
|
311239
311272
|
}
|
|
311240
311273
|
function browserDownload(blob, filename) {
|
|
311241
311274
|
const url4 = URL.createObjectURL(blob);
|
|
@@ -312131,6 +312164,7 @@ function applyTextPath(layout2, path, tp, rebase = true) {
|
|
|
312131
312164
|
var defaultCircleRadius, ownsPath, mapPoint;
|
|
312132
312165
|
var init_text_path = __esm({
|
|
312133
312166
|
"lib/engine/text/text-path.ts"() {
|
|
312167
|
+
"use strict";
|
|
312134
312168
|
init_scene_graph();
|
|
312135
312169
|
init_transform();
|
|
312136
312170
|
init_shape_to_path();
|
|
@@ -312248,6 +312282,7 @@ function areaBounds(rings) {
|
|
|
312248
312282
|
}
|
|
312249
312283
|
var init_text_area = __esm({
|
|
312250
312284
|
"lib/engine/text/text-area.ts"() {
|
|
312285
|
+
"use strict";
|
|
312251
312286
|
}
|
|
312252
312287
|
});
|
|
312253
312288
|
|
|
@@ -327384,7 +327419,7 @@ var init_package = __esm({
|
|
|
327384
327419
|
"packages/runtime/package.json"() {
|
|
327385
327420
|
package_default = {
|
|
327386
327421
|
name: "@popcraft/runtime",
|
|
327387
|
-
version: "0.38.
|
|
327422
|
+
version: "0.38.7",
|
|
327388
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.",
|
|
327389
327424
|
license: "MIT",
|
|
327390
327425
|
homepage: "https://popcraft.app/docs/exporting/nextjs",
|
|
@@ -352050,6 +352085,7 @@ function exportsOf(source3) {
|
|
|
352050
352085
|
var CODE_LIMITS, packageOf;
|
|
352051
352086
|
var init_source2 = __esm({
|
|
352052
352087
|
"lib/code/source.ts"() {
|
|
352088
|
+
"use strict";
|
|
352053
352089
|
CODE_LIMITS = { modules: 100, sourceLength: 2e5, packages: 12 };
|
|
352054
352090
|
packageOf = (spec) => spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
|
|
352055
352091
|
}
|
|
@@ -352092,6 +352128,7 @@ function compileModule(module2) {
|
|
|
352092
352128
|
var import_sucrase, BUILT_IN, memo4;
|
|
352093
352129
|
var init_compile2 = __esm({
|
|
352094
352130
|
"lib/code/compile.ts"() {
|
|
352131
|
+
"use strict";
|
|
352095
352132
|
import_sucrase = __toESM(require_dist2());
|
|
352096
352133
|
init_source2();
|
|
352097
352134
|
init_source2();
|
|
@@ -352169,6 +352206,7 @@ function hashOf2(text) {
|
|
|
352169
352206
|
}
|
|
352170
352207
|
var init_hash = __esm({
|
|
352171
352208
|
"lib/code/hash.ts"() {
|
|
352209
|
+
"use strict";
|
|
352172
352210
|
}
|
|
352173
352211
|
});
|
|
352174
352212
|
|
|
@@ -362257,17 +362295,6 @@ var init_billing = __esm({
|
|
|
362257
362295
|
}
|
|
362258
362296
|
});
|
|
362259
362297
|
|
|
362260
|
-
// lib/desktop/open-link.ts
|
|
362261
|
-
function openLink(href) {
|
|
362262
|
-
if (isDesktop()) window.location.assign(href);
|
|
362263
|
-
else window.open(href, "_blank", "noopener");
|
|
362264
|
-
}
|
|
362265
|
-
var init_open_link = __esm({
|
|
362266
|
-
"lib/desktop/open-link.ts"() {
|
|
362267
|
-
init_tauri();
|
|
362268
|
-
}
|
|
362269
|
-
});
|
|
362270
|
-
|
|
362271
362298
|
// lib/client/cloud/buy-credits.ts
|
|
362272
362299
|
var buy_credits_exports = {};
|
|
362273
362300
|
__export(buy_credits_exports, {
|
|
@@ -365193,14 +365220,7 @@ function exportToJSON(document2) {
|
|
|
365193
365220
|
async function downloadJSON(document2, filename = "document.json") {
|
|
365194
365221
|
const json3 = exportToJSON(await portableDocument(document2));
|
|
365195
365222
|
const blob = new Blob([json3], { type: "application/json" });
|
|
365196
|
-
|
|
365197
|
-
const link2 = window.document.createElement("a");
|
|
365198
|
-
link2.href = url4;
|
|
365199
|
-
link2.download = filename;
|
|
365200
|
-
window.document.body.appendChild(link2);
|
|
365201
|
-
link2.click();
|
|
365202
|
-
window.document.body.removeChild(link2);
|
|
365203
|
-
URL.revokeObjectURL(url4);
|
|
365223
|
+
downloadBlob(blob, filename);
|
|
365204
365224
|
}
|
|
365205
365225
|
function importFromJSON(jsonString) {
|
|
365206
365226
|
try {
|
|
@@ -365231,6 +365251,7 @@ var init_json_export = __esm({
|
|
|
365231
365251
|
"lib/io/json-export.ts"() {
|
|
365232
365252
|
init_media_store();
|
|
365233
365253
|
init_document_fonts();
|
|
365254
|
+
init_download();
|
|
365234
365255
|
}
|
|
365235
365256
|
});
|
|
365236
365257
|
|
|
@@ -396117,8 +396138,7 @@ async function runPlugin(pluginId, commandId, opts = {}) {
|
|
|
396117
396138
|
storageGet: (key5) => pluginStorageGet(pluginId, key5),
|
|
396118
396139
|
storageSet: (key5, value3) => pluginStorageSet(pluginId, key5, value3),
|
|
396119
396140
|
openExternal: (url4) => {
|
|
396120
|
-
|
|
396121
|
-
if (!opened) throw new Error("The browser blocked the new tab");
|
|
396141
|
+
if (!openBeside(url4)) throw new Error("The browser blocked the new tab");
|
|
396122
396142
|
},
|
|
396123
396143
|
createDocument: async (opts2) => {
|
|
396124
396144
|
const { createFreshFileOrExplain: createFreshFileOrExplain2 } = await Promise.resolve().then(() => (init_new_file(), new_file_exports));
|
|
@@ -396286,6 +396306,7 @@ var init_host3 = __esm({
|
|
|
396286
396306
|
init_sync2();
|
|
396287
396307
|
init_theme_store();
|
|
396288
396308
|
init_panels();
|
|
396309
|
+
init_open_link();
|
|
396289
396310
|
running3 = /* @__PURE__ */ new Map();
|
|
396290
396311
|
if (typeof window !== "undefined" && false) {
|
|
396291
396312
|
window.__vpPlugins = { installPluginPayload, runPlugin, dispatchWidgetClick, closeSession, removePlugin, setEnabled, running: running3 };
|
|
@@ -398190,7 +398211,6 @@ function record(source, namespaces, globals, limits) {
|
|
|
398190
398211
|
var HELPER_NAMES;
|
|
398191
398212
|
var init_helper_names = __esm({
|
|
398192
398213
|
"lib/agent/design-script/helper-names.ts"() {
|
|
398193
|
-
"use strict";
|
|
398194
398214
|
HELPER_NAMES = ["draw", "marks", "fit", "motion", "captions", "overlays", "texture", "pointer", "windows", "devices", "type", "beat", "web", "social", "video", "site", "effects"];
|
|
398195
398215
|
}
|
|
398196
398216
|
});
|
|
@@ -399573,12 +399593,7 @@ async function exportLayerPng(id3) {
|
|
|
399573
399593
|
const px5 = await l.readPixels(id3);
|
|
399574
399594
|
if (!px5) return;
|
|
399575
399595
|
const png = await encodePng(px5.width, px5.height, px5.data);
|
|
399576
|
-
|
|
399577
|
-
const a = document.createElement("a");
|
|
399578
|
-
a.href = url4;
|
|
399579
|
-
a.download = `${node2.name || "paint-layer"}.png`;
|
|
399580
|
-
a.click();
|
|
399581
|
-
setTimeout(() => URL.revokeObjectURL(url4), 5e3);
|
|
399596
|
+
downloadBlob(new Blob([png], { type: "image/png" }), `${node2.name || "paint-layer"}.png`);
|
|
399582
399597
|
}
|
|
399583
399598
|
function clearPaintLayer(id3) {
|
|
399584
399599
|
useEditorStore.getState().commitRasterTiles(id3, {}, "Clear paint layer");
|
|
@@ -399626,6 +399641,7 @@ var init_raster_actions = __esm({
|
|
|
399626
399641
|
init_png();
|
|
399627
399642
|
init_raster_tiles();
|
|
399628
399643
|
init_canvas_dpr();
|
|
399644
|
+
init_download();
|
|
399629
399645
|
notice4 = (text) => window.dispatchEvent(new CustomEvent("popcraft-notice", { detail: { text } }));
|
|
399630
399646
|
}
|
|
399631
399647
|
});
|
|
@@ -404747,6 +404763,7 @@ var init_editor_store = __esm({
|
|
|
404747
404763
|
init_library_link();
|
|
404748
404764
|
init_fonts();
|
|
404749
404765
|
init_runtime3();
|
|
404766
|
+
init_open_link();
|
|
404750
404767
|
STICKY_PROP_KEYS = [
|
|
404751
404768
|
"strokes",
|
|
404752
404769
|
"fills",
|
|
@@ -405312,7 +405329,7 @@ var init_editor_store = __esm({
|
|
|
405312
405329
|
if (e.settle) setTimeout(() => get4().focusOnNode(e.screen), 10);
|
|
405313
405330
|
else get4().focusOnNode(e.screen);
|
|
405314
405331
|
} else if (e.kind === "open") {
|
|
405315
|
-
|
|
405332
|
+
openBeside(e.href);
|
|
405316
405333
|
} else {
|
|
405317
405334
|
setTimeout(() => {
|
|
405318
405335
|
const at4 = runtimeOf(get4());
|
|
@@ -410985,7 +411002,7 @@ init_resources();
|
|
|
410985
411002
|
init_desktop();
|
|
410986
411003
|
init_hypery();
|
|
410987
411004
|
import { createInterface } from "node:readline";
|
|
410988
|
-
var VERSION2 = "0.38.
|
|
411005
|
+
var VERSION2 = "0.38.7";
|
|
410989
411006
|
var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
|
|
410990
411007
|
|
|
410991
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",
|