@popcraft/cli 0.38.4 → 0.38.6

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 +27 -9
  2. 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.4"}`, ...opts.headers };
1199
+ const headers = { "user-agent": `popcraft-cli/${"0.38.6"}`, ...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 {
@@ -96510,6 +96510,7 @@ function releaseMediaMemory(hash3) {
96510
96510
  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
96511
  var init_media_store = __esm({
96512
96512
  "lib/storage/media-store.ts"() {
96513
+ "use strict";
96513
96514
  init_media_types();
96514
96515
  init_idb();
96515
96516
  init_media_hash();
@@ -261981,6 +261982,20 @@ function storePlatform() {
261981
261982
  if (/Android/.test(navigator.userAgent)) return "android";
261982
261983
  return null;
261983
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
+ }
261984
261999
  function invoke(cmd, args2) {
261985
262000
  const t3 = tauri();
261986
262001
  return t3 ? t3.core.invoke(cmd, args2) : Promise.reject(new Error("Not running in the desktop app"));
@@ -311062,7 +311077,6 @@ async function dispatchShaped(key5, options) {
311062
311077
  var onViolation;
311063
311078
  var init_dispatch = __esm({
311064
311079
  "lib/commands/dispatch.ts"() {
311065
- "use strict";
311066
311080
  init_errors();
311067
311081
  init_registry();
311068
311082
  init_confirm();
@@ -311222,6 +311236,14 @@ __export(download_exports, {
311222
311236
  downloadBlob: () => downloadBlob
311223
311237
  });
311224
311238
  function downloadBlob(blob, filename) {
311239
+ shareFileNatively(blob, filename).then(
311240
+ (shared) => {
311241
+ if (!shared) browserDownload(blob, filename);
311242
+ },
311243
+ (e) => console.error("[share_file]", e)
311244
+ );
311245
+ }
311246
+ function browserDownload(blob, filename) {
311225
311247
  const url4 = URL.createObjectURL(blob);
311226
311248
  const a = window.document.createElement("a");
311227
311249
  a.href = url4;
@@ -311234,6 +311256,7 @@ function downloadBlob(blob, filename) {
311234
311256
  var init_download = __esm({
311235
311257
  "lib/io/download.ts"() {
311236
311258
  "use strict";
311259
+ init_tauri();
311237
311260
  }
311238
311261
  });
311239
311262
 
@@ -327371,7 +327394,7 @@ var init_package = __esm({
327371
327394
  "packages/runtime/package.json"() {
327372
327395
  package_default = {
327373
327396
  name: "@popcraft/runtime",
327374
- version: "0.38.4",
327397
+ version: "0.38.6",
327375
327398
  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.",
327376
327399
  license: "MIT",
327377
327400
  homepage: "https://popcraft.app/docs/exporting/nextjs",
@@ -352037,7 +352060,6 @@ function exportsOf(source3) {
352037
352060
  var CODE_LIMITS, packageOf;
352038
352061
  var init_source2 = __esm({
352039
352062
  "lib/code/source.ts"() {
352040
- "use strict";
352041
352063
  CODE_LIMITS = { modules: 100, sourceLength: 2e5, packages: 12 };
352042
352064
  packageOf = (spec) => spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
352043
352065
  }
@@ -361104,7 +361126,6 @@ var init_delete_current_file = __esm({
361104
361126
  var storeOpsSeam;
361105
361127
  var init_seams = __esm({
361106
361128
  "lib/commands/seams.ts"() {
361107
- "use strict";
361108
361129
  storeOpsSeam = (st) => ({
361109
361130
  booleanOperation: (op4) => st().booleanOperation(op4),
361110
361131
  flatten: () => st().flattenSelection(),
@@ -398180,7 +398201,6 @@ function record(source, namespaces, globals, limits) {
398180
398201
  var HELPER_NAMES;
398181
398202
  var init_helper_names = __esm({
398182
398203
  "lib/agent/design-script/helper-names.ts"() {
398183
- "use strict";
398184
398204
  HELPER_NAMES = ["draw", "marks", "fit", "motion", "captions", "overlays", "texture", "pointer", "windows", "devices", "type", "beat", "web", "social", "video", "site", "effects"];
398185
398205
  }
398186
398206
  });
@@ -398563,7 +398583,6 @@ function designRecorder() {
398563
398583
  var installed;
398564
398584
  var init_recorders = __esm({
398565
398585
  "lib/agent/design-script/recorders.ts"() {
398566
- "use strict";
398567
398586
  installed = null;
398568
398587
  }
398569
398588
  });
@@ -403397,7 +403416,6 @@ function registerBuiltinCommands() {
403397
403416
  var builtinCommands, uiOnlyCommands;
403398
403417
  var init_builtin4 = __esm({
403399
403418
  "lib/commands/builtin.ts"() {
403400
- "use strict";
403401
403419
  init_registry();
403402
403420
  init_node();
403403
403421
  init_node();
@@ -410975,7 +410993,7 @@ init_resources();
410975
410993
  init_desktop();
410976
410994
  init_hypery();
410977
410995
  import { createInterface } from "node:readline";
410978
- var VERSION2 = "0.38.4";
410996
+ var VERSION2 = "0.38.6";
410979
410997
  var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
410980
410998
 
410981
410999
  Files (headless, on .popcraft files):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcraft/cli",
3
- "version": "0.38.4",
3
+ "version": "0.38.6",
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.4"
37
+ "@popcraft/kit": "0.38.6"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node build.mjs",