@deepraxis/cli 0.3.0-dev.bc829d1 → 0.3.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/praxis.js +12 -101
  2. package/package.json +1 -1
package/dist/praxis.js CHANGED
@@ -47449,7 +47449,7 @@ function workflowHelp(workflow, options) {
47449
47449
  }
47450
47450
 
47451
47451
  // src/config/env.ts
47452
- var DEFAULT_ENV = "develop";
47452
+ var DEFAULT_ENV = "production";
47453
47453
  function validateApiUrl(value) {
47454
47454
  const fail = () => {
47455
47455
  throw new UsageError("PRAXIS_API_URL must be an https URL on deepraxis.com", "Use https://api.deepraxis.com or https://api-develop.deepraxis.com; credentials are never sent to other hosts.");
@@ -49895,8 +49895,7 @@ var KNOWN_PROPS = {
49895
49895
  context: keys(`${SIZE} ${TEXT} content`),
49896
49896
  icon: keys(`${SIZE} ${EFFECTS} library icon weight fill`),
49897
49897
  script: keys(`${SIZE} clip scriptUri inputs`),
49898
- browser: keys(`${SIZE} ${GRAPHICS} url deviceId zoom scrollX scrollY cornerRadius`),
49899
- html: keys(`${SIZE} ${GRAPHICS} html cornerRadius`),
49898
+ browser: keys(`${SIZE} ${EFFECTS} ${STROKE} url deviceId zoom scrollX scrollY cornerRadius`),
49900
49899
  ref: keys("ref descendants")
49901
49900
  };
49902
49901
  function unknownProperties(node2, type) {
@@ -49997,64 +49996,9 @@ function pathLineBounds(geometry) {
49997
49996
  return { x: minX, y: minY, w: maxX - minX, h: maxY - minY };
49998
49997
  }
49999
49998
 
50000
- // ../../packages/canvas/document/src/live-node.ts
50001
- var HTML_MAX_BYTES = 256 * 1024;
50002
- var drawsNothing = (value) => value === undefined || value === null || typeof value === "number" && !(value > 0);
50003
- function checkLiveNode(node2) {
50004
- const warnings = [];
50005
- if (!node2 || typeof node2 !== "object" || node2.type !== "html")
50006
- return { warnings };
50007
- const html = node2.html;
50008
- if (typeof html !== "string")
50009
- return { reject: { property: "html", reason: "html must be a string" }, warnings };
50010
- const bytes = new TextEncoder().encode(html).length;
50011
- if (bytes > HTML_MAX_BYTES)
50012
- return {
50013
- reject: { property: "html", reason: `html is ${bytes} bytes of UTF-8; the limit is ${HTML_MAX_BYTES}` },
50014
- warnings
50015
- };
50016
- if (drawsNothing(node2.width) || drawsNothing(node2.height))
50017
- warnings.push({ code: "HTML_NODE_NO_SIZE", message: "html node has no width and height: set both, or it paints at zero size" });
50018
- return { warnings };
50019
- }
50020
-
50021
49999
  // ../../packages/canvas/document/src/execute-api.ts
50022
50000
  var LIMITS = { ops: 5000, printBytes: 64 * 1024, screenshots: 4 };
50023
50001
  var ID_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
50024
- function undeclared(node2, key) {
50025
- return node2[key] === undefined || node2[key] === null;
50026
- }
50027
- var TEXT_DEFAULT_KEYS = ["fontFamily", "fontSize", "fontWeight", "lineHeight", "letterSpacing", "fill"];
50028
- var TEXT_DEFAULTS_BYTES = 4 * 1024;
50029
- function normalizeDefaults(value) {
50030
- const raw = value ?? {};
50031
- const text = raw.text;
50032
- if (!text || typeof text !== "object" || Array.isArray(text))
50033
- return {};
50034
- const out = {};
50035
- for (const k of TEXT_DEFAULT_KEYS)
50036
- if (!undeclared(text, k))
50037
- out[k] = text[k];
50038
- if (!Object.keys(out).length)
50039
- return {};
50040
- if (new TextEncoder().encode(JSON.stringify(out)).byteLength > TEXT_DEFAULTS_BYTES)
50041
- return {};
50042
- return { text: out };
50043
- }
50044
- function applyTextDefaults(node2, defaults) {
50045
- const keys2 = defaults ? TEXT_DEFAULT_KEYS.filter((k) => !undeclared(defaults, k)) : [];
50046
- let out = node2;
50047
- if (keys2.length && node2.type === "text") {
50048
- const filled = { ...node2 };
50049
- for (const k of keys2)
50050
- if (undeclared(filled, k))
50051
- filled[k] = defaults[k];
50052
- out = filled;
50053
- }
50054
- if (Array.isArray(out.children))
50055
- out = { ...out, children: out.children.map((c) => applyTextDefaults(c, defaults)) };
50056
- return out;
50057
- }
50058
50002
  class ExecuteApi {
50059
50003
  store;
50060
50004
  rec;
@@ -50063,7 +50007,6 @@ class ExecuteApi {
50063
50007
  random;
50064
50008
  document = "document";
50065
50009
  layoutCache = new Map;
50066
- defaults = {};
50067
50010
  constructor(store, rec, bounds, rev, random = Math.random) {
50068
50011
  this.store = store;
50069
50012
  this.rec = rec;
@@ -50071,28 +50014,6 @@ class ExecuteApi {
50071
50014
  this.rev = rev;
50072
50015
  this.random = random;
50073
50016
  }
50074
- setDefaults(value) {
50075
- const raw = value;
50076
- if (raw === null || typeof raw !== "object" || Array.isArray(raw))
50077
- throw new OpRejectedError({ code: "INVALID_VALUE", property: "SetDefaults", reason: "expected { text: { … } } or { text: null }" });
50078
- for (const key of Object.keys(raw))
50079
- if (key !== "text")
50080
- throw new OpRejectedError({ code: "INVALID_VALUE", property: key, reason: "SetDefaults only accepts text" });
50081
- const text = raw.text;
50082
- if (text !== null && text !== undefined) {
50083
- if (typeof text !== "object" || Array.isArray(text))
50084
- throw new OpRejectedError({ code: "INVALID_VALUE", property: "text", reason: "expected an object of text properties" });
50085
- for (const key of Object.keys(text))
50086
- if (!TEXT_DEFAULT_KEYS.includes(key))
50087
- throw new OpRejectedError({ code: "INVALID_VALUE", property: `text.${key}`, reason: `not a default text property; use ${TEXT_DEFAULT_KEYS.join(", ")}` });
50088
- if (new TextEncoder().encode(JSON.stringify(text)).byteLength > TEXT_DEFAULTS_BYTES)
50089
- throw new OpRejectedError({ code: "INVALID_VALUE", property: "text", reason: `defaults over ${TEXT_DEFAULTS_BYTES} bytes` });
50090
- }
50091
- return this.defaults = normalizeDefaults(value);
50092
- }
50093
- getDefaults() {
50094
- return this.defaults;
50095
- }
50096
50017
  mint() {
50097
50018
  for (;; ) {
50098
50019
  let id = "";
@@ -50148,9 +50069,6 @@ class ExecuteApi {
50148
50069
  if (typeof v === "string" && /%|vh|vw|calc/.test(v))
50149
50070
  throw new OpRejectedError({ code: "INVALID_VALUE", property: k, reason: "percentage and viewport sizes are not supported" });
50150
50071
  }
50151
- const live = checkLiveNode(node2);
50152
- if (live.reject)
50153
- throw new OpRejectedError({ code: "INVALID_VALUE", property: live.reject.property, reason: live.reject.reason });
50154
50072
  const id = this.mint();
50155
50073
  const out = { ...node2, id };
50156
50074
  if (typeof node2.name === "string") {
@@ -50164,18 +50082,11 @@ class ExecuteApi {
50164
50082
  }
50165
50083
  return out;
50166
50084
  }
50167
- warnProps(data, type, nodeId, declared = false) {
50085
+ warnProps(data, type, nodeId) {
50168
50086
  if (hasUnsupportedImageUrl(data) && this.rec.warnings.length < 20 && !this.rec.warnings.some((w) => w.code === "UNSUPPORTED_IMAGE_URL" && w.nodeId === nodeId))
50169
50087
  this.rec.warnings.push({ code: "UNSUPPORTED_IMAGE_URL", nodeId, message: "image fill url must be a file id (file-…)" });
50170
- if (declared && data.type === "text" && undeclared(data, "fill") && !this.defaults.text?.fill && this.rec.warnings.length < 20 && !this.rec.warnings.some((w) => w.code === "TEXT_NO_FILL" && w.nodeId === nodeId))
50171
- this.rec.warnings.push({ code: "TEXT_NO_FILL", nodeId, message: `text node has no fill and paints nothing — or call SetDefaults({ text: { fill: "#111827" } }) once to give every text node this session a default fill` });
50172
50088
  if (data.type === "icon" && !iconNameOf(data) && this.rec.warnings.length < 20 && !this.rec.warnings.some((w) => w.code === "ICON_NAME_MISSING" && w.nodeId === nodeId))
50173
50089
  this.rec.warnings.push({ code: "ICON_NAME_MISSING", nodeId, message: "icon node has no icon: set icon to a lucide name (name is the node's name, not the icon)" });
50174
- if (data.type === "html") {
50175
- for (const w of checkLiveNode(data).warnings)
50176
- if (this.rec.warnings.length < 20 && !this.rec.warnings.some((x) => x.code === w.code && x.nodeId === nodeId))
50177
- this.rec.warnings.push({ code: w.code, nodeId, message: w.message });
50178
- }
50179
50090
  for (const prop of unknownProperties(data, type)) {
50180
50091
  const message = `${prop} is not a .pen property`;
50181
50092
  if (this.rec.warnings.length >= 20)
@@ -50186,7 +50097,7 @@ class ExecuteApi {
50186
50097
  if (type === "path")
50187
50098
  this.warnPathBox(data, nodeId);
50188
50099
  for (const child of Array.isArray(data.children) ? data.children : [])
50189
- this.warnProps(child, child.type, child.id ?? nodeId, declared);
50100
+ this.warnProps(child, child.type, child.id ?? nodeId);
50190
50101
  if (data.descendants && typeof data.descendants === "object") {
50191
50102
  const descendants = typeof data.ref === "string" ? this.resolveDescendantKeys(data.ref, data.descendants) : data.descendants;
50192
50103
  for (const [key, value] of Object.entries(descendants)) {
@@ -50254,10 +50165,10 @@ class ExecuteApi {
50254
50165
  }
50255
50166
  Insert(parent, nodeData) {
50256
50167
  const p = this.parentId(parent);
50257
- let node2 = this.withIds(applyTextDefaults(migrateLegacyProps(nodeData), this.defaults.text));
50168
+ let node2 = this.withIds(migrateLegacyProps(nodeData));
50258
50169
  if (node2.type === "ref" && node2.descendants && typeof node2.descendants === "object")
50259
50170
  node2 = { ...node2, descendants: this.resolveDescendantKeys(node2.ref, node2.descendants) };
50260
- this.warnProps(node2, node2.type, node2.id, true);
50171
+ this.warnProps(node2, node2.type, node2.id);
50261
50172
  this.commit({ op: "insert", parent: p, ord: between(this.lastOrd(p), null), node: node2 });
50262
50173
  return node2.id;
50263
50174
  }
@@ -50287,7 +50198,7 @@ class ExecuteApi {
50287
50198
  };
50288
50199
  node2 = this.withIds({ ...apply(tree), ...over });
50289
50200
  }
50290
- this.warnProps(node2, node2.type, node2.id, true);
50201
+ this.warnProps(node2, node2.type, node2.id);
50291
50202
  this.commit({ op: "insert", parent: p, ord: between(this.lastOrd(p), null), node: node2 });
50292
50203
  return node2.id;
50293
50204
  }
@@ -50324,8 +50235,8 @@ class ExecuteApi {
50324
50235
  const owner = this.store.get(inst.owner);
50325
50236
  if (!owner || owner.props.type !== "ref")
50326
50237
  throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
50327
- const node3 = this.withIds(applyTextDefaults(migrateLegacyProps(nodeData), this.defaults.text));
50328
- this.warnProps(node3, node3.type, node3.id, true);
50238
+ const node3 = this.withIds(migrateLegacyProps(nodeData));
50239
+ this.warnProps(node3, node3.type, node3.id);
50329
50240
  const desc = { ...owner.props.descendants ?? {}, [inst.rest]: node3 };
50330
50241
  this.commit({ op: "update", id: owner.id, patch: { descendants: desc } });
50331
50242
  return node3.id;
@@ -50333,8 +50244,8 @@ class ExecuteApi {
50333
50244
  const row = this.store.get(path);
50334
50245
  if (!row)
50335
50246
  throw new OpRejectedError({ code: "NODE_NOT_FOUND", path });
50336
- const node2 = this.withIds(applyTextDefaults(migrateLegacyProps(nodeData), this.defaults.text));
50337
- this.warnProps(node2, node2.type, node2.id, true);
50247
+ const node2 = this.withIds(migrateLegacyProps(nodeData));
50248
+ this.warnProps(node2, node2.type, node2.id);
50338
50249
  this.commit({ op: "delete", id: row.id });
50339
50250
  this.commit({ op: "insert", parent: row.parent, ord: row.ord, node: node2 });
50340
50251
  return node2.id;
@@ -51585,7 +51496,7 @@ function startProgress(ctx, write = (text) => writeOutput({ stderr: text })) {
51585
51496
  }
51586
51497
 
51587
51498
  // src/main.ts
51588
- var version = "0.3.0-dev.bc829d1";
51499
+ var version = "0.3.0";
51589
51500
  var commands = commandTree(operations);
51590
51501
  var manual = [...workflows.map((w) => w.words), [API_WORD]];
51591
51502
  function route(argv) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepraxis/cli",
3
- "version": "0.3.0-dev.bc829d1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "praxis": "dist/praxis.js"