@popcraft/cli 0.53.16 → 0.53.17

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 +49 -12
  2. package/package.json +2 -2
package/dist/popcraft.mjs CHANGED
@@ -1198,7 +1198,7 @@ function operations(spec = openapi) {
1198
1198
  }
1199
1199
  async function call(target2, method, path, opts = {}) {
1200
1200
  const qs = new URLSearchParams(opts.query ?? {}).toString();
1201
- const headers = { "user-agent": `popcraft-cli/${"0.53.16"}`, ...opts.headers };
1201
+ const headers = { "user-agent": `popcraft-cli/${"0.53.17"}`, ...opts.headers };
1202
1202
  if (target2.token) headers.authorization = `Bearer ${target2.token}`;
1203
1203
  if (opts.contentType) headers["content-type"] = opts.contentType;
1204
1204
  try {
@@ -94585,6 +94585,7 @@ function hasMessage(key5) {
94585
94585
  var current2, loading, listeners, formats, asts;
94586
94586
  var init_runtime = __esm({
94587
94587
  "lib/i18n/runtime.ts"() {
94588
+ "use strict";
94588
94589
  init_intl_messageformat();
94589
94590
  init_icu_messageformat_parser();
94590
94591
  init_catalogs();
@@ -96287,6 +96288,7 @@ function repairDocumentPaints(doc2) {
96287
96288
  var broken;
96288
96289
  var init_paint_repair = __esm({
96289
96290
  "lib/document/paint-repair.ts"() {
96291
+ "use strict";
96290
96292
  init_shader_graph();
96291
96293
  broken = (p2) => {
96292
96294
  if (!p2 || typeof p2 !== "object") return false;
@@ -96944,7 +96946,6 @@ function releaseMediaMemory(hash3) {
96944
96946
  var key2, peaksKey, objectUrls, sourceKey, remoteResolver, MEDIA_FETCH_TIMEOUT_MS, SHIPPED_MEDIA_PATH, notShipped, MEDIA_SCHEME, isImageDataUrl, memory, pendingLoads, sourceAliases, PAINT_KEYS, URL_KEYS;
96945
96947
  var init_media_store = __esm({
96946
96948
  "lib/storage/media-store.ts"() {
96947
- "use strict";
96948
96949
  init_media_types();
96949
96950
  init_idb();
96950
96951
  init_media_hash();
@@ -97461,7 +97462,6 @@ function selectionWorldBounds(nodes, ids2, scrollState) {
97461
97462
  }
97462
97463
  var init_selection_bounds = __esm({
97463
97464
  "lib/editor/selection-bounds.ts"() {
97464
- "use strict";
97465
97465
  init_scene_graph();
97466
97466
  init_transform();
97467
97467
  }
@@ -248102,7 +248102,6 @@ function repairCompositions(comps, nodes) {
248102
248102
  var isObj5, finite6, optFinite, isVec2, TIMELINE_COLOR_IDS, TIMELINE_COLORS, UNITS, ORDERS, PROP_KEYS, ANIMATOR_ID, MOTION_TYPES, TRANSITIONS, isFraction, MEDIA_HASH;
248103
248103
  var init_invariants = __esm({
248104
248104
  "lib/motion/invariants.ts"() {
248105
- "use strict";
248106
248105
  init_easing();
248107
248106
  init_properties();
248108
248107
  init_markers();
@@ -249174,6 +249173,11 @@ function openingMode(doc2) {
249174
249173
  };
249175
249174
  return moves3(first2.id) ? "ANIMATE" : "VIEW";
249176
249175
  }
249176
+ function fileOpeningMode(doc2, opts = {}) {
249177
+ const mode2 = openingMode(doc2);
249178
+ if (mode2 !== "VIEW") return mode2;
249179
+ return opts.shared && !opts.seenBefore ? "VIEW" : "DESIGN";
249180
+ }
249177
249181
  var KIND_PROFILES, kindProfile;
249178
249182
  var init_kinds = __esm({
249179
249183
  "lib/templates/kinds.ts"() {
@@ -252737,6 +252741,7 @@ function resizeWindow(doc2, target2, rect) {
252737
252741
  }
252738
252742
  var init_crop = __esm({
252739
252743
  "lib/editor/crop.ts"() {
252744
+ "use strict";
252740
252745
  init_dist_node();
252741
252746
  init_scene_graph();
252742
252747
  init_photo_frames();
@@ -254565,11 +254570,12 @@ function openTabPatch(s, tab) {
254565
254570
  }
254566
254571
  function createModeSlice(set4, get4) {
254567
254572
  return {
254568
- mode: "VIEW",
254573
+ // The editor starts ready to edit. Read only is for someone else's file on its first open (lib/client/cloud/sync.ts),
254574
+ // and a file of another kind picks its own mode when it opens (lib/templates/kinds.ts `fileOpeningMode`).
254575
+ mode: "DESIGN",
254569
254576
  viewFlags: { ...DEFAULT_VIEW_FLAGS },
254570
254577
  leftTab: "composition",
254571
- // Read only's own tab: the editor starts in it (the file it opens may then pick another mode).
254572
- rightTab: MODE_PROFILES.VIEW.rightTab,
254578
+ rightTab: MODE_PROFILES.DESIGN.rightTab,
254573
254579
  leftPanelOpen: true,
254574
254580
  rightPanelOpen: true,
254575
254581
  tabSides: loadTabSides(),
@@ -262840,6 +262846,7 @@ function formatDate(date5, opts = { month: "short", day: "numeric", year: "numer
262840
262846
  var cache5, nf;
262841
262847
  var init_format = __esm({
262842
262848
  "lib/i18n/format.ts"() {
262849
+ "use strict";
262843
262850
  init_runtime();
262844
262851
  cache5 = /* @__PURE__ */ new Map();
262845
262852
  nf = (opts) => cached2("n", opts, (l) => new Intl.NumberFormat(l, opts));
@@ -311745,10 +311752,31 @@ async function linkActive(link2) {
311745
311752
  activeLink = link2;
311746
311753
  await setCloudLink(link2);
311747
311754
  applyReadOnly(link2.role);
311755
+ firstOpenOfShared(link2);
311748
311756
  ensureCollab(link2);
311749
311757
  setStatus(liveStatus());
311750
311758
  void healMedia(link2);
311751
311759
  }
311760
+ function seenShared() {
311761
+ try {
311762
+ return new Set(JSON.parse(localStorage.getItem(SEEN_KEY) || "[]"));
311763
+ } catch {
311764
+ return /* @__PURE__ */ new Set();
311765
+ }
311766
+ }
311767
+ function firstOpenOfShared(link2) {
311768
+ if (link2.role === "owner" || link2.anonymous) return;
311769
+ const seen = seenShared();
311770
+ const first2 = !seen.has(link2.key);
311771
+ seen.add(link2.key);
311772
+ try {
311773
+ localStorage.setItem(SEEN_KEY, JSON.stringify([...seen].slice(-500)));
311774
+ } catch {
311775
+ }
311776
+ const st = useEditorStore.getState();
311777
+ if (st.document.id !== link2.docId || st.mode !== "DESIGN") return;
311778
+ if (fileOpeningMode(st.document, { shared: true, seenBefore: !first2 }) === "VIEW") st.setMode("VIEW");
311779
+ }
311752
311780
  function applyReadOnly(role) {
311753
311781
  readOnlyDoc = canEdit(role) ? null : useEditorStore.getState().document;
311754
311782
  }
@@ -311854,10 +311882,10 @@ function startCloudSync() {
311854
311882
  setStatus(liveStatus());
311855
311883
  });
311856
311884
  }
311857
- var status, readOnlyDoc, activeLink, statusListeners, notice, urlArmed, opening, syncStatus, canEdit, uploaded, MEDIA_UPLOAD_PARALLEL, pushTimer, pushing, dirty, pendingMedia, collab, collabSession, collabAnonymous, uploadedThumbs, thumbCheckedAt, THUMB_EVERY_MS, THUMB_MIN_GAP_MS, putThumbnail, openingFiles, mediaHealed, started2;
311885
+ var status, readOnlyDoc, activeLink, statusListeners, notice, urlArmed, opening, syncStatus, canEdit, uploaded, MEDIA_UPLOAD_PARALLEL, pushTimer, pushing, dirty, pendingMedia, collab, collabSession, collabAnonymous, uploadedThumbs, thumbCheckedAt, THUMB_EVERY_MS, THUMB_MIN_GAP_MS, putThumbnail, openingFiles, mediaHealed, SEEN_KEY, started2;
311858
311886
  var init_sync2 = __esm({
311859
311887
  "lib/client/cloud/sync.ts"() {
311860
- "use strict";
311888
+ init_kinds();
311861
311889
  init_paint_repair();
311862
311890
  init_migrate();
311863
311891
  init_view();
@@ -311907,6 +311935,7 @@ var init_sync2 = __esm({
311907
311935
  });
311908
311936
  openingFiles = /* @__PURE__ */ new Map();
311909
311937
  mediaHealed = /* @__PURE__ */ new Set();
311938
+ SEEN_KEY = "popcraft.sharedFilesOpened";
311910
311939
  started2 = false;
311911
311940
  if (typeof module !== "undefined") module.hot?.decline();
311912
311941
  }
@@ -312067,6 +312096,7 @@ async function dispatchShaped(key5, options) {
312067
312096
  var onViolation;
312068
312097
  var init_dispatch = __esm({
312069
312098
  "lib/commands/dispatch.ts"() {
312099
+ "use strict";
312070
312100
  init_errors();
312071
312101
  init_registry();
312072
312102
  init_confirm();
@@ -312466,6 +312496,7 @@ function creditLine(c2) {
312466
312496
  var MAX_PHOTO_PAGE, MAX_PHOTO_QUERY, UUID, isPhotoId, photoImagePath;
312467
312497
  var init_stock = __esm({
312468
312498
  "lib/photos/stock.ts"() {
312499
+ "use strict";
312469
312500
  MAX_PHOTO_PAGE = 12;
312470
312501
  MAX_PHOTO_QUERY = 200;
312471
312502
  UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
@@ -313127,6 +313158,7 @@ function applyTextPath(layout2, path, tp, rebase = true) {
313127
313158
  var defaultCircleRadius, ownsPath, mapPoint;
313128
313159
  var init_text_path = __esm({
313129
313160
  "lib/engine/text/text-path.ts"() {
313161
+ "use strict";
313130
313162
  init_scene_graph();
313131
313163
  init_transform();
313132
313164
  init_shape_to_path();
@@ -313244,6 +313276,7 @@ function areaBounds(rings) {
313244
313276
  }
313245
313277
  var init_text_area = __esm({
313246
313278
  "lib/engine/text/text-area.ts"() {
313279
+ "use strict";
313247
313280
  }
313248
313281
  });
313249
313282
 
@@ -328908,7 +328941,7 @@ var init_package = __esm({
328908
328941
  "packages/runtime/package.json"() {
328909
328942
  package_default = {
328910
328943
  name: "@popcraft/runtime",
328911
- version: "0.53.16",
328944
+ version: "0.53.17",
328912
328945
  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.",
328913
328946
  license: "MIT",
328914
328947
  homepage: "https://popcraft.app/docs/exporting/nextjs",
@@ -353574,6 +353607,7 @@ function exportsOf(source3) {
353574
353607
  var CODE_LIMITS, packageOf;
353575
353608
  var init_source2 = __esm({
353576
353609
  "lib/code/source.ts"() {
353610
+ "use strict";
353577
353611
  CODE_LIMITS = { modules: 100, sourceLength: 2e5, packages: 12 };
353578
353612
  packageOf = (spec) => spec.split("/").slice(0, spec.startsWith("@") ? 2 : 1).join("/");
353579
353613
  }
@@ -353616,6 +353650,7 @@ function compileModule(module2) {
353616
353650
  var import_sucrase, BUILT_IN, memo4;
353617
353651
  var init_compile2 = __esm({
353618
353652
  "lib/code/compile.ts"() {
353653
+ "use strict";
353619
353654
  import_sucrase = __toESM(require_dist2());
353620
353655
  init_source2();
353621
353656
  init_source2();
@@ -362673,6 +362708,7 @@ var init_delete_current_file = __esm({
362673
362708
  var storeOpsSeam;
362674
362709
  var init_seams = __esm({
362675
362710
  "lib/commands/seams.ts"() {
362711
+ "use strict";
362676
362712
  storeOpsSeam = (st) => ({
362677
362713
  booleanOperation: (op4) => st().booleanOperation(op4),
362678
362714
  flatten: () => st().flattenSelection(),
@@ -406948,6 +406984,7 @@ function registerBuiltinCommands() {
406948
406984
  var builtinCommands, uiOnlyCommands;
406949
406985
  var init_builtin4 = __esm({
406950
406986
  "lib/commands/builtin.ts"() {
406987
+ "use strict";
406951
406988
  init_registry();
406952
406989
  init_node();
406953
406990
  init_node();
@@ -408517,7 +408554,7 @@ var init_editor_store = __esm({
408517
408554
  cropEdit: null,
408518
408555
  imageEdit: null
408519
408556
  });
408520
- get4().setMode(openingMode(snap.document));
408557
+ get4().setMode(fileOpeningMode(snap.document));
408521
408558
  {
408522
408559
  const st = get4();
408523
408560
  const comp = st.mode === "ANIMATE" ? Object.values(openedDoc.compositions ?? {}).find((c2) => c2.clips?.length) : void 0;
@@ -414532,7 +414569,7 @@ init_resources();
414532
414569
  init_desktop();
414533
414570
  init_hypery();
414534
414571
  import { createInterface } from "node:readline";
414535
- var VERSION2 = "0.53.16";
414572
+ var VERSION2 = "0.53.17";
414536
414573
  var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
414537
414574
 
414538
414575
  Files (headless, on .popcraft files):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcraft/cli",
3
- "version": "0.53.16",
3
+ "version": "0.53.17",
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.53.16"
37
+ "@popcraft/kit": "0.53.17"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node build.mjs",