@parity-app/cli 0.3.1 → 0.4.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 +5 -5
- package/dist/{src-BGF7szJh.mjs → src-CJUvccJO.mjs} +1 -1
- package/dist/{src-lVLSuOgh.mjs → src-CYEKdXm_.mjs} +34 -12
- package/dist/{src-Aoey5Uq0.mjs → src-DaCYZuwb.mjs} +2 -2
- package/dist/src-DgI96EpD.mjs +3 -0
- package/dist/{src-eso2QXtH.mjs → src-y3hdgbK2.mjs} +1 -1
- package/package.json +1 -1
- package/skills/document.md +9 -3
- package/skills/execute.md +21 -5
- package/dist/src-DZKi9702.mjs +0 -3
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-
|
|
291
|
-
const { registryDir, registryEntries } = await import("./src-
|
|
290
|
+
const { applyLibraryEdits, componentNode, generateId, librarySource, parseLibraryEdits, withLibraryContext } = await import("./src-DgI96EpD.mjs");
|
|
291
|
+
const { registryDir, registryEntries } = await import("./src-CJUvccJO.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-
|
|
420
|
-
const { covers, registryDir, registryEntries } = await import("./src-
|
|
419
|
+
const { appManifestPath, generateLibrary, manifestText, mergeManifest, reviseLibrary } = await import("./src-DaCYZuwb.mjs");
|
|
420
|
+
const { covers, registryDir, registryEntries } = await import("./src-CJUvccJO.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-
|
|
431
|
+
const { parseLibraryEdits } = await import("./src-DaCYZuwb.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 +1 @@
|
|
|
1
|
-
export { t as covers, n as registryDir, r as registryEntries } from "./src-
|
|
1
|
+
export { t as covers, n as registryDir, r as registryEntries } from "./src-y3hdgbK2.mjs";
|
|
@@ -254,6 +254,11 @@ function generateId(taken, length = 5) {
|
|
|
254
254
|
}
|
|
255
255
|
}
|
|
256
256
|
// ../core/src/document.ts
|
|
257
|
+
const containerKinds = [
|
|
258
|
+
"screen",
|
|
259
|
+
"component",
|
|
260
|
+
"frame"
|
|
261
|
+
];
|
|
257
262
|
const textTags = [
|
|
258
263
|
"p",
|
|
259
264
|
"span",
|
|
@@ -399,7 +404,8 @@ function parseContainer(value, path) {
|
|
|
399
404
|
"view",
|
|
400
405
|
"params",
|
|
401
406
|
"context",
|
|
402
|
-
"frames"
|
|
407
|
+
"frames",
|
|
408
|
+
"size"
|
|
403
409
|
], path);
|
|
404
410
|
const position = expectObject(container.position, `${path}/position`);
|
|
405
411
|
const view = optional(container.view, (v) => {
|
|
@@ -440,10 +446,13 @@ function parseContainer(value, path) {
|
|
|
440
446
|
};
|
|
441
447
|
});
|
|
442
448
|
if (states.length === 0) throw new TypeError(`${path}/states: expected at least one state`);
|
|
449
|
+
const kind = optional(container.kind, (v) => expectOneOf(v, containerKinds, `${path}/kind`));
|
|
450
|
+
if (kind === "frame") checkFrame(container, root, states, path);
|
|
451
|
+
else if (container.size !== void 0) throw new TypeError(`${path}/size: only a frame has a size of its own; size a ${kind ?? "screen"} in frames`);
|
|
443
452
|
return compact({
|
|
444
453
|
id: expectString(container.id, `${path}/id`),
|
|
445
454
|
name: expectString(container.name, `${path}/name`),
|
|
446
|
-
kind
|
|
455
|
+
kind,
|
|
447
456
|
context: optional(container.context, (v) => expectArray(v, `${path}/context`).map((item, index) => {
|
|
448
457
|
const at = `${path}/context/${index}`;
|
|
449
458
|
const wrapper = expectObject(item, at);
|
|
@@ -498,17 +507,10 @@ function parseContainer(value, path) {
|
|
|
498
507
|
}),
|
|
499
508
|
frames: optional(container.frames, (v) => {
|
|
500
509
|
const frames = {};
|
|
501
|
-
for (const [viewport, entry] of Object.entries(expectObject(v, `${path}/frames`))) {
|
|
502
|
-
const at = `${path}/frames/${viewport}`;
|
|
503
|
-
const size = expectObject(entry, at);
|
|
504
|
-
expectKnownKeys(size, ["width", "height"], at);
|
|
505
|
-
frames[viewport] = compact({
|
|
506
|
-
width: optional(size.width, (w) => expectNumber(w, `${at}/width`)),
|
|
507
|
-
height: optional(size.height, (h) => expectNumber(h, `${at}/height`))
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
+
for (const [viewport, entry] of Object.entries(expectObject(v, `${path}/frames`))) frames[viewport] = parseFrameSize(entry, `${path}/frames/${viewport}`);
|
|
510
511
|
return frames;
|
|
511
512
|
}),
|
|
513
|
+
size: optional(container.size, (v) => parseFrameSize(v, `${path}/size`)),
|
|
512
514
|
position: {
|
|
513
515
|
x: expectNumber(position.x, `${path}/position/x`),
|
|
514
516
|
y: expectNumber(position.y, `${path}/position/y`)
|
|
@@ -518,6 +520,26 @@ function parseContainer(value, path) {
|
|
|
518
520
|
view
|
|
519
521
|
});
|
|
520
522
|
}
|
|
523
|
+
function parseFrameSize(value, path) {
|
|
524
|
+
const size = expectObject(value, path);
|
|
525
|
+
expectKnownKeys(size, ["width", "height"], path);
|
|
526
|
+
return compact({
|
|
527
|
+
width: optional(size.width, (w) => expectNumber(w, `${path}/width`)),
|
|
528
|
+
height: optional(size.height, (h) => expectNumber(h, `${path}/height`))
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* What a frame may hold: a layout at its root and one state, drawn as its layers are, with no params, no view (it
|
|
533
|
+
* shows only the primary mode and that state) and no sizes per viewport, since it has one of its own.
|
|
534
|
+
*/
|
|
535
|
+
function checkFrame(container, root, states, path) {
|
|
536
|
+
if (root.type !== "layout") throw new TypeError(`${path}/root: a frame's root is a layout`);
|
|
537
|
+
if (states.length > 1) throw new TypeError(`${path}/states: a frame has one state`);
|
|
538
|
+
if (Object.keys(states[0].overrides ?? {}).length > 0) throw new TypeError(`${path}/states/0/overrides: a frame is drawn as its layers are`);
|
|
539
|
+
if (container.params !== void 0) throw new TypeError(`${path}/params: a frame has no params`);
|
|
540
|
+
if (container.view !== void 0) throw new TypeError(`${path}/view: a frame shows only the primary mode and its one state`);
|
|
541
|
+
if (container.frames !== void 0) throw new TypeError(`${path}/frames: a frame's size is in size, not per viewport`);
|
|
542
|
+
}
|
|
521
543
|
function parseNode(value, path, ids) {
|
|
522
544
|
const node = expectObject(value, path);
|
|
523
545
|
const type = expectOneOf(node.type, [
|
|
@@ -1403,4 +1425,4 @@ function sampleIds(sample, library) {
|
|
|
1403
1425
|
...sample.children ? { children: sample.children.map(child) } : {}
|
|
1404
1426
|
};
|
|
1405
1427
|
}
|
|
1406
|
-
export {
|
|
1428
|
+
export { viewportHeightProperty as C, lengthToPixels as E, collectCustomProperties as S, deviceKinds as T, paramTypes as _, applyLibraryEdits as a, generateId as b, isSampleElement as c, parentSignals as d, parseLibraryEdits as f, imageFits as g, containerKinds as h, withLibraryContext as i, isSampleRender as l, renderSlotOf as m, librarySource as n, componentEvidence as o, parseLibraryManifest as p, sampleIds as r, isMadeValue as s, componentNode as t, libraryManifestExtension as u, parseCanvasDocument as v, viewportWidthProperty as w, parseModeSettings as x, styleKeys as y };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./src-
|
|
1
|
+
import { E as lengthToPixels, S as collectCustomProperties, a as applyLibraryEdits, c as isSampleElement, f as parseLibraryEdits, l as isSampleRender, m as renderSlotOf, p as parseLibraryManifest, s as isMadeValue, u as libraryManifestExtension } from "./src-CYEKdXm_.mjs";
|
|
2
|
+
import "./src-y3hdgbK2.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,4 +1,4 @@
|
|
|
1
|
-
import { p as parseLibraryManifest, u as libraryManifestExtension } from "./src-
|
|
1
|
+
import { p as parseLibraryManifest, u as libraryManifestExtension } from "./src-CYEKdXm_.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";
|
package/package.json
CHANGED
package/skills/document.md
CHANGED
|
@@ -5,20 +5,26 @@ change, so you never edit the files by hand. This is the shape `GetDesign` and `
|
|
|
5
5
|
|
|
6
6
|
## Designs
|
|
7
7
|
|
|
8
|
-
A design is a screen or a
|
|
8
|
+
A design is a screen, a component or a frame, drawn on the canvas as a board of frames: one frame per state and mode it
|
|
9
|
+
shows.
|
|
9
10
|
|
|
10
11
|
| Field | What it is |
|
|
11
12
|
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
12
13
|
| `id` | Made from the name when the design is created. Stable; use it in paths. |
|
|
13
14
|
| `name` | What people see. |
|
|
14
|
-
| `kind` | `screen` (a page or view)
|
|
15
|
+
| `kind` | `screen` (a page or view), `component` (a reusable part that screens place as instances) or `frame` (a sketch; see below). |
|
|
15
16
|
| `root` | The design itself: one node, usually a layout. |
|
|
16
17
|
| `states` | Situations the whole design can be in, like loading or empty. The first is the base; the others store only what they change. |
|
|
17
18
|
| `params` | A component design's inputs, each with a `type` (`text`, `boolean`, `number`, `value`, `variant`) and a `default`. See Params and bindings. |
|
|
18
|
-
| `frames` | A fixed size per viewport, when
|
|
19
|
+
| `frames` | A screen's or component's fixed size per viewport, when it isn't as wide as the viewport or as tall as its content. |
|
|
20
|
+
| `size` | A frame's own `width` and `height` in pixels. Without a width it's as wide as the primary mode; without a height, as tall as its content. |
|
|
19
21
|
| `view` | How the canvas shows it: the main mode, the modes beside it, the state and the variant options shown. Not part of the design. |
|
|
20
22
|
| `context` | Components a component design is drawn inside on its own board, such as a table around a table row. |
|
|
21
23
|
|
|
24
|
+
A frame is the light kind, for sketching: a layout at its root, drawn once in the project's primary mode at its own
|
|
25
|
+
`size`, with one state and no `params`, `view` or `frames`. No code is written from it. Make it a screen or a component
|
|
26
|
+
to give it more.
|
|
27
|
+
|
|
22
28
|
## Nodes
|
|
23
29
|
|
|
24
30
|
Every node has an `id` (given when it's inserted), and can have a `name`, `hidden`, `style` and `responsive`. Name the
|
package/skills/execute.md
CHANGED
|
@@ -47,8 +47,8 @@ GetModes(design?): { settings, variables, viewports, modes, designs } // modes
|
|
|
47
47
|
Selection(): { design?, node?, mode? } // what the person has selected
|
|
48
48
|
|
|
49
49
|
// Designs
|
|
50
|
-
CreateDesign({ name, kind?, root?, x?, y?, file?, baseState? }): string //
|
|
51
|
-
UpdateDesign(design, { name?, kind?, x?, y?, mode?, showModes?, state?, allStates? }): void
|
|
50
|
+
CreateDesign({ name, kind?, root?, x?, y?, width?, height?, file?, baseState? }): string // the new design's id
|
|
51
|
+
UpdateDesign(design, { name?, kind?, x?, y?, width?, height?, mode?, showModes?, state?, allStates? }): void
|
|
52
52
|
DeleteDesign(design): void
|
|
53
53
|
|
|
54
54
|
// Nodes
|
|
@@ -95,8 +95,8 @@ by its id alone when only one design has that id. Names aren't unique, so prefer
|
|
|
95
95
|
|
|
96
96
|
### Designs
|
|
97
97
|
|
|
98
|
-
Lists every design with its `id`, `name`, `kind` (`screen` or `
|
|
99
|
-
canvas, the main mode and the modes beside it. Start here to find ids.
|
|
98
|
+
Lists every design with its `id`, `name`, `kind` (`screen`, `component` or `frame`), `states`, and `showing`: the state
|
|
99
|
+
on the canvas, the main mode and the modes beside it. Start here to find ids.
|
|
100
100
|
|
|
101
101
|
### Get
|
|
102
102
|
|
|
@@ -175,11 +175,27 @@ foreground colours. Without `x` and `y` it goes into empty space. `kind: "compon
|
|
|
175
175
|
screens place as instances; most component designs come from `ExtractComponent` instead, because that also gives them
|
|
176
176
|
params.
|
|
177
177
|
|
|
178
|
+
`kind: "frame"` makes a frame, the light kind for sketching an idea before it's a screen or a component: an empty padded
|
|
179
|
+
layout, drawn once at its own `width` and `height` in the project's primary mode. A frame has one state, no params and
|
|
180
|
+
no modes beside it, and no code is written from it, so `AddState`, `showModes` or another `mode` on one fail with
|
|
181
|
+
`invalid_input`. Turn it into a screen or a component when it needs them.
|
|
182
|
+
|
|
183
|
+
```js
|
|
184
|
+
const sketch = CreateDesign({ name: "Sketch", kind: "frame", width: 480, height: 320 })
|
|
185
|
+
Insert(sketch, { type: "text", tag: "h2", text: "Pricing ideas" })
|
|
186
|
+
await Screenshot(sketch)
|
|
187
|
+
UpdateDesign(sketch, { kind: "screen" }) // keeps its layers, and its size in the primary viewport
|
|
188
|
+
```
|
|
189
|
+
|
|
178
190
|
### UpdateDesign
|
|
179
191
|
|
|
180
192
|
Renames or moves a design, or changes how it's shown: `mode` sets the main frame's mode, `showModes` the modes beside
|
|
181
193
|
it, `state` the state on the canvas, and `allStates: true` shows every state in its own row. None of these change the
|
|
182
|
-
design itself.
|
|
194
|
+
design itself. `width` and `height` resize a frame.
|
|
195
|
+
|
|
196
|
+
`kind` turns a design into another kind. Turned into a frame, a design keeps its layers as its board drew them in the
|
|
197
|
+
base state, with its params' values filled in, and drops its other states, the modes beside it, its params and its
|
|
198
|
+
variants; the call's warnings say what went.
|
|
183
199
|
|
|
184
200
|
## Nodes
|
|
185
201
|
|
package/dist/src-DZKi9702.mjs
DELETED