@popcraft/cli 0.29.0 → 0.30.0

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 +23 -10
  2. 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.29.0"}`, ...opts.headers };
1191
+ const headers = { "user-agent": `popcraft-cli/${"0.30.0"}`, ...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 {
@@ -246748,7 +246748,6 @@ function resyncText(doc2, ids2) {
246748
246748
  var isVirtualId;
246749
246749
  var init_invariants2 = __esm({
246750
246750
  "lib/document/invariants.ts"() {
246751
- "use strict";
246752
246751
  init_auto_layout();
246753
246752
  init_scene_graph();
246754
246753
  init_text_bounds();
@@ -308953,12 +308952,18 @@ function flattenOnWhite(px5) {
308953
308952
  }
308954
308953
  return px5;
308955
308954
  }
308956
- function thumbnailWebp(img) {
308955
+ function thumbnailWebp(img, maxBytes = Infinity) {
308957
308956
  flattenOnWhite(img.data);
308958
- return encodeWebpLossless(img.width, img.height, img.data);
308957
+ let out = encodeWebpLossless(img.width, img.height, img.data);
308958
+ for (let drop = 1; out.length > maxBytes && drop <= 4; drop++) {
308959
+ const px5 = img.data.slice(), mask = 255 << drop & 255, half = 1 << drop - 1;
308960
+ for (let i2 = 0; i2 < px5.length; i2 += 4) for (let c2 = 0; c2 < 3; c2++) px5[i2 + c2] = Math.min(255, (px5[i2 + c2] & mask) + half);
308961
+ out = encodeWebpLossless(img.width, img.height, px5);
308962
+ }
308963
+ return out;
308959
308964
  }
308960
308965
  function thumbnailDataUrl(img) {
308961
- return `data:image/webp;base64,${base643(thumbnailWebp(img))}`;
308966
+ return `data:image/webp;base64,${base643(thumbnailWebp(img, Math.floor((MAX_THUMBNAIL_CHARS - 32) * 3 / 4)))}`;
308962
308967
  }
308963
308968
  function previewSize(width, height) {
308964
308969
  const k2 = thumbnailScale(width, height, PREVIEW_MAX);
@@ -310102,6 +310107,7 @@ async function dispatchShaped(key5, options) {
310102
310107
  var onViolation;
310103
310108
  var init_dispatch = __esm({
310104
310109
  "lib/commands/dispatch.ts"() {
310110
+ "use strict";
310105
310111
  init_errors();
310106
310112
  init_registry();
310107
310113
  init_confirm();
@@ -310272,6 +310278,7 @@ function downloadBlob(blob, filename) {
310272
310278
  }
310273
310279
  var init_download = __esm({
310274
310280
  "lib/io/download.ts"() {
310281
+ "use strict";
310275
310282
  }
310276
310283
  });
310277
310284
 
@@ -310491,6 +310498,7 @@ function creditLine(c2) {
310491
310498
  var MAX_PHOTO_PAGE, MAX_PHOTO_QUERY, UUID, isPhotoId, photoImagePath;
310492
310499
  var init_stock = __esm({
310493
310500
  "lib/photos/stock.ts"() {
310501
+ "use strict";
310494
310502
  MAX_PHOTO_PAGE = 12;
310495
310503
  MAX_PHOTO_QUERY = 200;
310496
310504
  UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -316050,6 +316058,7 @@ function videoPixelSize(resolution, aspect) {
316050
316058
  var VIDEO_ASPECTS, VIDEO_RESOLUTIONS, SEEDANCE_ASPECTS, range, VIDEO_MODELS, DEFAULT_VIDEO_MODEL, videoModel, VIDEO_LIMITS;
316051
316059
  var init_video_models = __esm({
316052
316060
  "lib/ai/video-models.ts"() {
316061
+ "use strict";
316053
316062
  VIDEO_ASPECTS = ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9"];
316054
316063
  VIDEO_RESOLUTIONS = ["480p", "720p", "1080p"];
316055
316064
  SEEDANCE_ASPECTS = ["16:9", "9:16", "1:1", "4:3", "3:4", "21:9"];
@@ -326401,7 +326410,7 @@ var init_package = __esm({
326401
326410
  "packages/runtime/package.json"() {
326402
326411
  package_default = {
326403
326412
  name: "@popcraft/runtime",
326404
- version: "0.29.0",
326413
+ version: "0.30.0",
326405
326414
  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.",
326406
326415
  license: "MIT",
326407
326416
  homepage: "https://popcraft.app/docs/exporting/nextjs",
@@ -351067,6 +351076,7 @@ function exportsOf(source3) {
351067
351076
  var CODE_LIMITS, packageOf;
351068
351077
  var init_source2 = __esm({
351069
351078
  "lib/code/source.ts"() {
351079
+ "use strict";
351070
351080
  CODE_LIMITS = { modules: 100, sourceLength: 2e5, packages: 12 };
351071
351081
  packageOf = (spec) => spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
351072
351082
  }
@@ -351109,6 +351119,7 @@ function compileModule(module2) {
351109
351119
  var import_sucrase, BUILT_IN, memo4;
351110
351120
  var init_compile2 = __esm({
351111
351121
  "lib/code/compile.ts"() {
351122
+ "use strict";
351112
351123
  import_sucrase = __toESM(require_dist2());
351113
351124
  init_source2();
351114
351125
  init_source2();
@@ -360083,6 +360094,7 @@ var init_publish = __esm({
360083
360094
  var storeOpsSeam;
360084
360095
  var init_seams = __esm({
360085
360096
  "lib/commands/seams.ts"() {
360097
+ "use strict";
360086
360098
  storeOpsSeam = (st) => ({
360087
360099
  booleanOperation: (op4) => st().booleanOperation(op4),
360088
360100
  flatten: () => st().flattenSelection(),
@@ -397432,7 +397444,6 @@ function designRecorder() {
397432
397444
  var installed;
397433
397445
  var init_recorders = __esm({
397434
397446
  "lib/agent/design-script/recorders.ts"() {
397435
- "use strict";
397436
397447
  installed = null;
397437
397448
  }
397438
397449
  });
@@ -402239,6 +402250,7 @@ function registerBuiltinCommands() {
402239
402250
  var builtinCommands, uiOnlyCommands;
402240
402251
  var init_builtin4 = __esm({
402241
402252
  "lib/commands/builtin.ts"() {
402253
+ "use strict";
402242
402254
  init_registry();
402243
402255
  init_node();
402244
402256
  init_node();
@@ -409036,7 +409048,7 @@ async function drawThumbnail(editor2, t3, sizeId) {
409036
409048
  async function drawDetailStill(editor2, t3, sizeId) {
409037
409049
  const region = thumbnailRegion(t3, sizeId);
409038
409050
  const img = await renderRegion(editor2.page, region, thumbnailScale(region.maxX - region.minX, region.maxY - region.minY, DETAIL_MAX));
409039
- return { bytes: thumbnailWebp(img), width: img.width, height: img.height };
409051
+ return { bytes: thumbnailWebp(img, DETAIL_MAX_BYTES), width: img.width, height: img.height };
409040
409052
  }
409041
409053
  function previewRoot(t3, sizeId) {
409042
409054
  const v = variantOf(t3, sizeId);
@@ -409063,7 +409075,7 @@ async function drawPreview(editor2, t3, reopen = true) {
409063
409075
  }, want);
409064
409076
  return out ? { bytes: new Uint8Array(Buffer.from(out.b64, "base64")), width: out.width, height: out.height, durationMs: out.durationMs } : null;
409065
409077
  }
409066
- var fitScale;
409078
+ var fitScale, DETAIL_MAX_BYTES;
409067
409079
  var init_pictures_node = __esm({
409068
409080
  "lib/templates/pictures.node.ts"() {
409069
409081
  init_thumbnail();
@@ -409071,6 +409083,7 @@ var init_pictures_node = __esm({
409071
409083
  init_scene_graph();
409072
409084
  init_editor_open();
409073
409085
  fitScale = (r) => thumbnailScale(r.maxX - r.minX, r.maxY - r.minY);
409086
+ DETAIL_MAX_BYTES = 6e5;
409074
409087
  }
409075
409088
  });
409076
409089
 
@@ -409752,7 +409765,7 @@ init_resources();
409752
409765
  init_desktop();
409753
409766
  init_hypery();
409754
409767
  import { createInterface } from "node:readline";
409755
- var VERSION2 = "0.29.0";
409768
+ var VERSION2 = "0.30.0";
409756
409769
  var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
409757
409770
 
409758
409771
  Files (headless, on .popcraft files):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcraft/cli",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
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.29.0"
37
+ "@popcraft/kit": "0.30.0"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node build.mjs",