@synap-core/workspace-templates 0.57.0 → 0.58.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/package.json
CHANGED
|
@@ -123,11 +123,9 @@ page becomes one frame) and every save writes 3.
|
|
|
123
123
|
"y": 0, "w": 390, "h": 844, "pageOf": "f1", "page": { "root": { "props": {} }, "content": [] } }` shows
|
|
124
124
|
f1's page at 390. Never copy a page into a second frame for another width.
|
|
125
125
|
- `Grid` has no `columns` prop (dropped and named on read).
|
|
126
|
-
- Layout blocks take exact values, never pixels: `gap`, `padding`, `paddingX`, `paddingY`
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
`space-1200`); a `Box` `background` takes `none`, `background`, `background-surface` or `paper`;
|
|
130
|
-
`radius` takes `none`, `radius-container` or `radius-floating`; `border` takes `none` or `hairline`.
|
|
126
|
+
- Layout blocks take exact values, never pixels: their spacing (`gap`, `padding`, `paddingX`, `paddingY`),
|
|
127
|
+
`background`, `radius` and `border` props are `select`s whose options are token steps. Read the options
|
|
128
|
+
from `design.catalog` (its `layout` half: block → prop → `{ kind: "select", options }`), never from memory.
|
|
131
129
|
- A label slot (a button's `children`) holds only inline blocks: `Text` or a component whose name ends in
|
|
132
130
|
`Icon` or `Glyph`. Never another button or a layout block.
|
|
133
131
|
- The canvas drops and names, at any depth: an unknown `type`, an undeclared or wrong prop, and a block
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `design` capability (plan 0fc746f4 §2.6, wave W5): the package that
|
|
3
|
+
* makes the pod's design door runnable. Its verbs are BUILTINS of the pod
|
|
4
|
+
* (backend `services/capabilities/builtin-verbs.ts`, `services/designs`); this
|
|
5
|
+
* package carries their declarations and Synap's catalog snapshot.
|
|
6
|
+
*
|
|
7
|
+
* Pinned here, where the package is authored:
|
|
8
|
+
* - its key is the one the pod reads the snapshot from (`DESIGN_CAPABILITY_KEY`);
|
|
9
|
+
* - it declares exactly the three verbs, each `kind: "builtin"`, and each
|
|
10
|
+
* verb's `parameters` IS `DESIGN_VERB_PARAMETERS` (the ONE param contract;
|
|
11
|
+
* the backend's catalog-coherence tripwire reads that constant as the
|
|
12
|
+
* catalog advertising these verbs, so the two halves cannot drift);
|
|
13
|
+
* - the read verbs declare `readOnly`, `design.apply` does not (it gates
|
|
14
|
+
* itself through the entity door);
|
|
15
|
+
* - the snapshot sits at `spec.metadata.designCatalog` and reads clean the way
|
|
16
|
+
* the pod reads it (`readDesignCatalog`).
|
|
17
|
+
*
|
|
18
|
+
* NOT covered here: that the snapshot is current (ui-gallery
|
|
19
|
+
* `designCatalog.freshness.test.ts`), and the verbs' behaviour (backend
|
|
20
|
+
* `design-door.test.ts`).
|
|
21
|
+
*/
|
|
22
|
+
import { readFileSync } from "node:fs";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
import { describe, expect, it } from "vitest";
|
|
25
|
+
import {
|
|
26
|
+
DESIGN_CAPABILITY_KEY,
|
|
27
|
+
DESIGN_CATALOG_METADATA_KEY,
|
|
28
|
+
DESIGN_VERBS,
|
|
29
|
+
DESIGN_VERB_PARAMETERS,
|
|
30
|
+
readDesignCatalog,
|
|
31
|
+
} from "@synap-core/types/design-board";
|
|
32
|
+
|
|
33
|
+
const manifest = JSON.parse(
|
|
34
|
+
readFileSync(join(__dirname, "..", "capabilities", "design.capability.json"), "utf8"),
|
|
35
|
+
) as {
|
|
36
|
+
meta: { slug: string };
|
|
37
|
+
spec: {
|
|
38
|
+
key: string;
|
|
39
|
+
skills: Array<{ name: string; kind: string; parameters: unknown; metadata?: { readOnly?: boolean } }>;
|
|
40
|
+
metadata?: Record<string, unknown>;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
const skill = (name: string) => manifest.spec.skills.find((s) => s.name === name);
|
|
44
|
+
|
|
45
|
+
describe("the design capability", () => {
|
|
46
|
+
it("is the package the pod reads the catalog from", () => {
|
|
47
|
+
expect(manifest.spec.key).toBe(DESIGN_CAPABILITY_KEY);
|
|
48
|
+
expect(manifest.meta.slug).toBe(DESIGN_CAPABILITY_KEY);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("declares exactly the three builtin verbs, with the one param contract", () => {
|
|
52
|
+
expect(manifest.spec.skills.map((s) => s.name).sort()).toEqual([...DESIGN_VERBS].sort());
|
|
53
|
+
for (const verb of DESIGN_VERBS) {
|
|
54
|
+
expect(skill(verb)?.kind, verb).toBe("builtin");
|
|
55
|
+
expect(skill(verb)?.parameters, verb).toEqual(DESIGN_VERB_PARAMETERS[verb]);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("marks the two reads read-only, never the write", () => {
|
|
60
|
+
expect(skill("design.read")?.metadata?.readOnly).toBe(true);
|
|
61
|
+
expect(skill("design.catalog")?.metadata?.readOnly).toBe(true);
|
|
62
|
+
expect(skill("design.apply")?.metadata?.readOnly).toBeUndefined();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("carries a catalog snapshot the pod can read", () => {
|
|
66
|
+
const read = readDesignCatalog(manifest.spec.metadata?.[DESIGN_CATALOG_METADATA_KEY]);
|
|
67
|
+
expect(read.ok ? null : read.error).toBeNull();
|
|
68
|
+
});
|
|
69
|
+
});
|