@parity-app/cli 0.2.0 → 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.
package/dist/bin.mjs CHANGED
@@ -287,8 +287,8 @@ const executeOperation = {
287
287
  */
288
288
  async function runCheck(library, options) {
289
289
  if (!library) throw new Error("parity lib check <library> [--tab t] [--mode m]");
290
- const { applyLibraryEdits, componentNode, generateId, librarySource, parseLibraryEdits, withLibraryContext } = await import("./src-BRgxMRtE.mjs");
291
- const { registryDir, registryEntries } = await import("./src-BOUQtcWB.mjs");
290
+ const { applyLibraryEdits, componentNode, generateId, librarySource, parseLibraryEdits, withLibraryContext } = await import("./src-DZKi9702.mjs");
291
+ const { registryDir, registryEntries } = await import("./src-BGF7szJh.mjs");
292
292
  const entry = (await registryEntries()).find((item) => item.manifest.id === library);
293
293
  if (!entry) throw new Error(`The registry has no library "${library}"`);
294
294
  let manifest = entry.manifest;
@@ -416,8 +416,8 @@ function describeCheck(report) {
416
416
  * because it reads the project's files and its own copy of TypeScript.
417
417
  */
418
418
  async function runLib(packageName, options) {
419
- const { appManifestPath, generateLibrary, manifestText, mergeManifest, reviseLibrary } = await import("./src-CcWc-KsX.mjs");
420
- const { covers, registryDir, registryEntries } = await import("./src-BOUQtcWB.mjs");
419
+ const { appManifestPath, generateLibrary, manifestText, mergeManifest, reviseLibrary } = await import("./src-Aoey5Uq0.mjs");
420
+ const { covers, registryDir, registryEntries } = await import("./src-BGF7szJh.mjs");
421
421
  const spec = packageName === void 0 ? void 0 : packageSpec(packageName);
422
422
  let root = resolve(options.root ?? ".");
423
423
  if (spec && (spec.version !== void 0 || options.registry && !options.root)) {
@@ -428,7 +428,7 @@ async function runLib(packageName, options) {
428
428
  console.error(`Installing ${spec.name} ${version} on its own…`);
429
429
  root = await installedVersion(spec.name, version);
430
430
  }
431
- const { parseLibraryEdits } = await import("./src-CcWc-KsX.mjs");
431
+ const { parseLibraryEdits } = await import("./src-Aoey5Uq0.mjs");
432
432
  const trialEdits = options.edits ? parseLibraryEdits(JSON.parse(await readFile(resolve(options.edits), "utf8"))) : void 0;
433
433
  const recordedId = options.registry && spec ? options.id ?? (await registryEntries()).find((entry) => entry.manifest.package?.name === spec.name)?.manifest.id : void 0;
434
434
  const appErrors = recordedId ? await readAppErrors(registryDir(), recordedId) : void 0;
@@ -1,5 +1,5 @@
1
- import { T as lengthToPixels, a as applyLibraryEdits, c as isSampleElement, f as parseLibraryEdits, l as isSampleRender, m as renderSlotOf, p as parseLibraryManifest, s as isMadeValue, u as libraryManifestExtension, x as collectCustomProperties } from "./src-BZ1p_ip_.mjs";
2
- import "./src-CAm6EBIK.mjs";
1
+ import { T as lengthToPixels, a as applyLibraryEdits, c as isSampleElement, f as parseLibraryEdits, l as isSampleRender, m as renderSlotOf, p as parseLibraryManifest, s as isMadeValue, u as libraryManifestExtension, x as collectCustomProperties } from "./src-lVLSuOgh.mjs";
2
+ import "./src-eso2QXtH.mjs";
3
3
  import { a as publishedVersions, n as packageFile, o as repositoryFiles, r as publishedSource } from "./published-CdXoUgfD.mjs";
4
4
  import { createRequire } from "node:module";
5
5
  import { mkdir, readFile, readdir, realpath, rm, stat, writeFile } from "node:fs/promises";
@@ -1 +1 @@
1
- export { t as covers, n as registryDir, r as registryEntries } from "./src-CAm6EBIK.mjs";
1
+ export { t as covers, n as registryDir, r as registryEntries } from "./src-eso2QXtH.mjs";
@@ -1,3 +1,3 @@
1
1
  import "./client-Cf66-n3R.mjs";
2
- export { a as applyLibraryEdits, t as componentNode, y as generateId, n as librarySource, f as parseLibraryEdits, i as withLibraryContext } from "./src-BZ1p_ip_.mjs";
3
- import "./src-CcWc-KsX.mjs";
2
+ export { a as applyLibraryEdits, t as componentNode, y as generateId, n as librarySource, f as parseLibraryEdits, i as withLibraryContext } from "./src-lVLSuOgh.mjs";
3
+ import "./src-Aoey5Uq0.mjs";
@@ -1,4 +1,4 @@
1
- import { p as parseLibraryManifest, u as libraryManifestExtension } from "./src-BZ1p_ip_.mjs";
1
+ import { p as parseLibraryManifest, u as libraryManifestExtension } from "./src-lVLSuOgh.mjs";
2
2
  import { createRequire } from "node:module";
3
3
  import { readFile, readdir } from "node:fs/promises";
4
4
  import { dirname, join } from "node:path";
@@ -668,13 +668,24 @@ function parsePatch(value, path) {
668
668
  "hidden",
669
669
  "text",
670
670
  "props",
671
- "style"
671
+ "style",
672
+ "unset"
672
673
  ], path);
673
674
  return compact({
674
675
  hidden: optional(patch.hidden, (v) => expectBoolean(v, `${path}/hidden`)),
675
676
  text: optional(patch.text, (v) => expectString(v, `${path}/text`)),
676
677
  props: optional(patch.props, (v) => expectObject(v, `${path}/props`)),
677
- style: optional(patch.style, (v) => parseStyle(v, `${path}/style`))
678
+ style: optional(patch.style, (v) => parseStyle(v, `${path}/style`)),
679
+ unset: optional(patch.unset, (v) => parseUnset(v, `${path}/unset`))
680
+ });
681
+ }
682
+ function parseUnset(value, path) {
683
+ const unset = expectObject(value, path);
684
+ expectKnownKeys(unset, ["props", "style"], path);
685
+ const keys = (key, item) => optional(unset[key], (v) => expectArray(v, `${path}/${key}`).map((entry, index) => item(entry, `${path}/${key}/${index}`)));
686
+ return compact({
687
+ props: keys("props", expectString),
688
+ style: keys("style", (v, where) => expectOneOf(v, styleKeys, where))
678
689
  });
679
690
  }
680
691
  function parseStyle(value, path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parity-app/cli",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Drive the Parity app from a terminal or an agent: read state, run edits, take screenshots, serve MCP.",
@@ -132,6 +132,15 @@ Type set on a layout applies to the text inside it. A component's own look comes
132
132
  A state's `overrides` map node ids to patches of `hidden`, `text`, `props` and `style`. A node a state doesn't mention
133
133
  looks as it does in the base. States win over responsive patches.
134
134
 
135
+ A patch can also take values away with `unset`, which lists prop names and style keys to drop from what's under it, so a
136
+ state can turn off a prop the base sets or leave a layout without the base's gap:
137
+
138
+ ```json
139
+ { "fields": { "style": { "padding": 4 }, "unset": { "style": ["gap"], "props": ["disabled"] } } }
140
+ ```
141
+
142
+ A key a patch sets isn't also in its `unset`. Taking away an instance's param value gives the param its default.
143
+
135
144
  ## Responsive
136
145
 
137
146
  A node's `responsive` maps a viewport option's id (such as `tablet` or `mobile`) to a patch of the same four things,
package/skills/execute.md CHANGED
@@ -53,7 +53,7 @@ DeleteDesign(design): void
53
53
 
54
54
  // Nodes
55
55
  Insert(parent, node, { index?, slot? }?): string // returns the new node's id
56
- Update(path, change, { state? }?): void // change: name, text, tag, hidden, props, args, style, component
56
+ Update(path, change, { state? }?): void // change: name, text, tag, hidden, props, args, style, unset, component
57
57
  Replace(path, node): string
58
58
  Move(path, parent, { index?, slot? }?): void // within one design
59
59
  Copy(path, parent, { index?, slot?, name? }?): string
@@ -204,11 +204,14 @@ const form = Insert("settings/Content", {
204
204
 
205
205
  ### Update
206
206
 
207
- Changes a node. `change` takes `name`, `text`, `tag`, `hidden`, `props`, `args` (an instance's values), `style` and
208
- `component`. `props`, `args` and `style` merge with what's there; set a key to `null` to remove it.
207
+ Changes a node. `change` takes `name`, `text`, `tag`, `hidden`, `props`, `args` (an instance's values), `style`, `unset`
208
+ and `component`. `props`, `args` and `style` merge with what's there; set a key to `null` to remove it.
209
209
 
210
- With `{ state: "loading" }` the change belongs to that state instead of the base design. A state can change only
211
- `hidden`, `text`, `props` and `style`.
210
+ With `{ state: "loading" }` the change belongs to that state instead of the base design, and `null` takes back the
211
+ state's change to that key. A state can change only `hidden`, `text`, `props`, `style` and `unset`. To turn off in one
212
+ state what the base sets, list it in `unset`:
213
+ `Update(button, { unset: { props: ["disabled"], style: ["gap"] } }, { state: "ready" })`. In the base design, `unset`
214
+ removes the keys as `null` does.
212
215
 
213
216
  ### Replace, Move, Copy and Delete
214
217