@popcraft/cli 0.3.0 → 0.4.1

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 +54 -33
  2. package/package.json +2 -2
package/dist/popcraft.mjs CHANGED
@@ -85218,7 +85218,6 @@ function repairDocumentPaints(doc2) {
85218
85218
  var broken;
85219
85219
  var init_paint_repair = __esm({
85220
85220
  "lib/document/paint-repair.ts"() {
85221
- "use strict";
85222
85221
  init_shader_graph();
85223
85222
  broken = (p2) => {
85224
85223
  if (!p2 || typeof p2 !== "object") return false;
@@ -87154,6 +87153,7 @@ function isAutoLayout(node2) {
87154
87153
  }
87155
87154
  var init_auto_layout = __esm({
87156
87155
  "lib/document/auto-layout.ts"() {
87156
+ "use strict";
87157
87157
  init_instance_layout();
87158
87158
  setLayoutEngine(applyAutoLayout);
87159
87159
  }
@@ -89958,6 +89958,7 @@ function layerInputPatch(node2, name2, path) {
89958
89958
  var NO_RUNTIME, MAX_DEPTH, freshIndex, indexOf, isComponentLike, selfStarting, startedAt, endMemo, HOST_OWNS, rootTracksMemo, layerMemo, idle;
89959
89959
  var init_instances2 = __esm({
89960
89960
  "lib/motion/instances.ts"() {
89961
+ "use strict";
89961
89962
  init_node_delta();
89962
89963
  init_instances();
89963
89964
  init_scene_graph();
@@ -234410,6 +234411,7 @@ function repairCompositions(comps, nodes) {
234410
234411
  var isObj5, finite6, optFinite, isVec2, TIMELINE_COLOR_IDS, TIMELINE_COLORS, UNITS, ORDERS, PROP_KEYS, ANIMATOR_ID, MOTION_TYPES, TRANSITIONS, isFraction, MEDIA_HASH;
234411
234412
  var init_invariants = __esm({
234412
234413
  "lib/motion/invariants.ts"() {
234414
+ "use strict";
234413
234415
  init_easing();
234414
234416
  init_properties();
234415
234417
  init_markers();
@@ -238934,6 +238936,7 @@ function resizeWindow(doc2, target2, rect) {
238934
238936
  }
238935
238937
  var init_crop = __esm({
238936
238938
  "lib/editor/crop.ts"() {
238939
+ "use strict";
238937
238940
  init_dist_node();
238938
238941
  init_scene_graph();
238939
238942
  init_photo_frames();
@@ -258922,6 +258925,7 @@ function facetsOf(meta3) {
258922
258925
  var TEMPLATE_CATEGORIES, FACET_KEYS;
258923
258926
  var init_vocabulary = __esm({
258924
258927
  "lib/templates/vocabulary.ts"() {
258928
+ "use strict";
258925
258929
  init_markers();
258926
258930
  init_groups();
258927
258931
  init_format();
@@ -258932,6 +258936,34 @@ var init_vocabulary = __esm({
258932
258936
  }
258933
258937
  });
258934
258938
 
258939
+ // lib/templates/upload.ts
258940
+ function templateUploadBody(t3, opts = {}) {
258941
+ const m = t3.meta;
258942
+ return {
258943
+ meta: {
258944
+ localId: m.id,
258945
+ name: m.name,
258946
+ description: m.description,
258947
+ kind: m.kind,
258948
+ category: m.category,
258949
+ tags: m.tags,
258950
+ sizes: t3.payload.variants.map((v) => v.sizeId),
258951
+ fonts: m.fonts,
258952
+ brandSlots: m.brandSlots,
258953
+ media: t3.payload.media,
258954
+ thumbnail: m.thumbnail,
258955
+ ...opts.workspaceId ? { workspaceId: opts.workspaceId } : {},
258956
+ ...facetsOf(m)
258957
+ },
258958
+ payload: t3.payload
258959
+ };
258960
+ }
258961
+ var init_upload = __esm({
258962
+ "lib/templates/upload.ts"() {
258963
+ init_vocabulary();
258964
+ }
258965
+ });
258966
+
258935
258967
  // lib/templates/card.ts
258936
258968
  var cardPayload, marketplaceTemplateCard;
258937
258969
  var init_card = __esm({
@@ -295215,25 +295247,7 @@ async function refreshCloudTemplates() {
295215
295247
  }
295216
295248
  }
295217
295249
  async function saveTemplateToCloud(t3, opts = {}) {
295218
- const m = t3.meta;
295219
- const body = {
295220
- meta: {
295221
- localId: m.id,
295222
- name: m.name,
295223
- description: m.description,
295224
- kind: m.kind,
295225
- category: m.category,
295226
- tags: m.tags,
295227
- sizes: t3.payload.variants.map((v) => v.sizeId),
295228
- fonts: m.fonts,
295229
- brandSlots: m.brandSlots,
295230
- media: t3.payload.media,
295231
- thumbnail: m.thumbnail,
295232
- workspaceId: opts.workspaceId,
295233
- ...facetsOf(m)
295234
- },
295235
- payload: t3.payload
295236
- };
295250
+ const body = templateUploadBody(t3, opts);
295237
295251
  const { template: template2 } = await api("/api/templates", { method: "POST", json: body });
295238
295252
  useCloudTemplates.setState((s) => ({ available: [template2, ...s.available.filter((x2) => x2.id !== template2.id)] }));
295239
295253
  return template2;
@@ -295297,7 +295311,7 @@ var init_templates = __esm({
295297
295311
  init_idb_keyval();
295298
295312
  init_api3();
295299
295313
  init_session();
295300
- init_vocabulary();
295314
+ init_upload();
295301
295315
  init_card();
295302
295316
  useCloudTemplates = create2(() => ({ available: [], loading: false, error: null, at: null }));
295303
295317
  CACHE_KEY = "popcraft-cloud-templates";
@@ -295418,6 +295432,7 @@ async function createFreshFileOrExplain(place3 = {}, seed2 = {}) {
295418
295432
  var online, goesLocal;
295419
295433
  var init_new_file = __esm({
295420
295434
  "lib/client/cloud/new-file.ts"() {
295435
+ "use strict";
295421
295436
  init_scene_graph();
295422
295437
  init_print_pages();
295423
295438
  init_page_presets();
@@ -295925,7 +295940,6 @@ function startCloudSync() {
295925
295940
  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, putThumbnail, openingFiles, mediaHealed, started;
295926
295941
  var init_sync2 = __esm({
295927
295942
  "lib/client/cloud/sync.ts"() {
295928
- "use strict";
295929
295943
  init_paint_repair();
295930
295944
  init_migrate();
295931
295945
  init_view();
@@ -313996,7 +314010,6 @@ popcraftMount(document.querySelector('[data-pc="0"]'), ${JSON.stringify(spec)});
313996
314010
  var routeFile, routeUp, bytesOf;
313997
314011
  var init_files = __esm({
313998
314012
  "lib/io/web/project/files.ts"() {
313999
- "use strict";
314000
314013
  routeFile = (route2) => route2 === "/" ? "index.html" : `${route2.replace(/^\//, "")}/index.html`;
314001
314014
  routeUp = (route2) => route2 === "/" ? "" : "../".repeat(route2.replace(/^\//, "").split("/").length);
314002
314015
  bytesOf = (f2) => typeof f2.content === "string" ? new TextEncoder().encode(f2.content) : f2.content;
@@ -315016,7 +315029,7 @@ var init_package = __esm({
315016
315029
  "packages/runtime/package.json"() {
315017
315030
  package_default = {
315018
315031
  name: "@popcraft/runtime",
315019
- version: "0.3.0",
315032
+ version: "0.4.1",
315020
315033
  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.",
315021
315034
  license: "MIT",
315022
315035
  homepage: "https://popcraft.app/docs/exporting/nextjs",
@@ -346732,7 +346745,7 @@ async function publishFiles(via, files, opts = {}) {
346732
346745
  }));
346733
346746
  return await via.manifest({ slug: opts.slug, files: manifest2, commit: true });
346734
346747
  }
346735
- var init_upload = __esm({
346748
+ var init_upload2 = __esm({
346736
346749
  "lib/sites/upload.ts"() {
346737
346750
  }
346738
346751
  });
@@ -346756,9 +346769,8 @@ function publishSite(key5, files, opts = {}) {
346756
346769
  var siteStatus, setSiteVersion, renameSite;
346757
346770
  var init_sites = __esm({
346758
346771
  "lib/client/cloud/sites.ts"() {
346759
- "use strict";
346760
346772
  init_files();
346761
- init_upload();
346773
+ init_upload2();
346762
346774
  init_api3();
346763
346775
  siteStatus = (key5) => api(`/api/sites${key5 ? `/${key5}` : ""}?t=${Date.now()}`);
346764
346776
  setSiteVersion = (key5, version6) => api(`/api/sites/${key5}`, { method: "PATCH", json: { currentVersion: version6 } });
@@ -348071,12 +348083,12 @@ const music = beat.bed('tension', 28)
348071
348083
  const b = music.beat
348072
348084
  k.brand({ paper: '#F4F1EA', ink: '#141414', hot: '#E8361E', muted: '#6B6760' }, { name: 'Tillwise', site: 'tillwise.example' })
348073
348085
  k.textStyle('Hook', { size: 132, fontWeight: 900, lineHeight: 120, letterSpacing: -4 })
348074
- k.textStyle('Price', { size: 220, fontWeight: 900, lineHeight: 200, letterSpacing: -8, fontFeatures: { tnum: 1 } })
348086
+ k.textStyle('Price', { size: 220, fontWeight: 900, lineHeight: 236, letterSpacing: -8, fontFeatures: { tnum: 1 } })
348075
348087
  k.textStyle('Line', { size: 34, fontWeight: 500, lineHeight: 44, fontFamily: 'JetBrains Mono' })
348076
348088
  k.textStyle('Caption', { size: 44, fontWeight: 700, lineHeight: 52 })
348077
348089
  k.textStyle('Hook small', { size: 96, fontWeight: 900, lineHeight: 90, letterSpacing: -3 })
348078
348090
  k.textStyle('Hook square', { size: 72, fontWeight: 900, lineHeight: 70, letterSpacing: -2 })
348079
- k.textStyle('Price small', { size: 120, fontWeight: 900, lineHeight: 112, letterSpacing: -5, fontFeatures: { tnum: 1 } })
348091
+ k.textStyle('Price small', { size: 120, fontWeight: 900, lineHeight: 128, letterSpacing: -5, fontFeatures: { tnum: 1 } })
348080
348092
  const sheet = k.sheet
348081
348093
  // The frame itself lays out its content: a vertical stack with margins clear of the apps' buttons (the safe area).
348082
348094
  k.flowSheet(sheet, 36, { top: 270, right: 150, bottom: 500, left: 80 }, 'paper')
@@ -348193,7 +348205,14 @@ web.webResponsive(k, sheet, {
348193
348205
  restyle: { 'Display 64': { laptop: 'Display 44', tablet: 'Display 44', mobile: 'Display 34' }, 'Lead 20': { mobile: 'Lead 17' }, 'Section 32': { mobile: 'Section 26' } },
348194
348206
  gap: { tablet: 56, mobile: 40 },
348195
348207
  // One function per size: a script's function is recorded before the kit runs, so it cannot test which size it is in.
348196
- tweaks: { tablet: (kit, id) => kit.patch(kit.named(id, 'Product')[0], { layoutSizingHorizontal: 'FILL' }), mobile: (kit, id) => kit.patch(kit.named(id, 'Product')[0], { layoutSizingHorizontal: 'FILL' }) },
348208
+ // On the phone the panel is narrower than the 464 px tide line: the line is scaled to fit it, not cut off.
348209
+ tweaks: {
348210
+ tablet: (kit, id) => kit.patch(kit.named(id, 'Product')[0], { layoutSizingHorizontal: 'FILL' }),
348211
+ mobile: (kit, id) => {
348212
+ kit.patch(kit.named(id, 'Product')[0], { layoutSizingHorizontal: 'FILL' })
348213
+ kit.patch(kit.named(id, 'Tide line')[0], { scaleX: 0.58, scaleY: 0.58, anchorX: 0, anchorY: 0 })
348214
+ },
348215
+ },
348197
348216
  })
348198
348217
  `;
348199
348218
  PRICING = `// A pricing page whose monthly/yearly switch really works: two variables, a variant set, and every price block bound.
@@ -348286,7 +348305,9 @@ const btn = k.stack(sheet, { direction: 'HORIZONTAL', width: 'HUG', fill: 'prima
348286
348305
  k.text(btn, 'Try Crumb free', { style: 'Button 22', color: 'onPrimary', autoWidth: true, name: 'Button label' })
348287
348306
  // The art: a loaf on a board with a price tag, drawn on the right.
348288
348307
  k.ellipse(sheet, 520, 'card', { name: 'Plate', absolute: { x: 650, y: 54 } })
348289
- k.rect(sheet, 380, 190, 'primary', { radius: 95, name: 'Loaf', absolute: { x: 720, y: 220 } })
348308
+ // The loaf is a stack so its score marks stay centred on it when the taller cuts resize it.
348309
+ const loaf = k.stack(sheet, { direction: 'HORIZONTAL', align: 'CENTER', justify: 'CENTER', gap: 44, width: 380, height: 190, fill: 'primary', radius: 95, name: 'Loaf', absolute: { x: 720, y: 220 } })
348310
+ for (let i = 0; i < 3; i++) k.patch(k.rect(loaf, 20, 110, 'card', { radius: 10, name: 'Score' }), { rotation: -24 })
348290
348311
  const tag = k.stack(sheet, { direction: 'HORIZONTAL', width: 'HUG', fill: 'text', radius: 10, padding: { top: 10, right: 16, bottom: 10, left: 16 }, name: 'Tag', absolute: { x: 940, y: 120 } })
348291
348312
  k.text(tag, '\xA39 a month', { style: 'Price 40', color: 'paper', autoWidth: true, name: 'Tag price' })
348292
348313
  // Each tall cut puts the art on top and the words under it, with type and the button scaled up for the bigger frame.
@@ -390813,7 +390834,7 @@ function operations(spec = openapi) {
390813
390834
  }
390814
390835
  async function call(target2, method, path, opts = {}) {
390815
390836
  const qs = new URLSearchParams(opts.query ?? {}).toString();
390816
- const headers = { "user-agent": `popcraft-cli/${"0.3.0"}`, ...opts.headers };
390837
+ const headers = { "user-agent": `popcraft-cli/${"0.4.1"}`, ...opts.headers };
390817
390838
  if (target2.token) headers.authorization = `Bearer ${target2.token}`;
390818
390839
  if (opts.contentType) headers["content-type"] = opts.contentType;
390819
390840
  try {
@@ -391773,7 +391794,7 @@ async function runPublish(root2, opts, target2, out) {
391773
391794
  // packages/cli/src/main.ts
391774
391795
  init_resources();
391775
391796
  init_hypery();
391776
- var VERSION2 = "0.3.0";
391797
+ var VERSION2 = "0.4.1";
391777
391798
  var HELP = `popcraft ${VERSION2} \u2014 the PopCraft command line
391778
391799
 
391779
391800
  Files (headless, on .popcraft files):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@popcraft/cli",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
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.3.0"
37
+ "@popcraft/kit": "0.4.1"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "node build.mjs",