@penpair/marwes-ui 0.1.3 → 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/build-kit.d.ts +3 -0
- package/dist/build-kit.js +93 -0
- package/dist/commands.d.ts +4 -0
- package/dist/commands.js +633 -92
- package/dist/components.d.ts +95 -0
- package/dist/components.js +497 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +80 -7
- package/dist/index.d.ts +13 -0
- package/dist/index.js +30 -1
- package/dist/marwes.js +45 -12
- package/dist/mode-trial.d.ts +95 -0
- package/dist/mode-trial.js +479 -0
- package/dist/ownership.d.ts +26 -0
- package/dist/ownership.js +222 -0
- package/dist/penpot.d.ts +21 -3
- package/dist/penpot.js +519 -87
- package/dist/reconciliation.d.ts +6 -0
- package/dist/reconciliation.js +179 -0
- package/dist/resolved-values.d.ts +11 -0
- package/dist/resolved-values.js +124 -0
- package/dist/snapshot-file.d.ts +45 -0
- package/dist/snapshot-file.js +282 -40
- package/dist/theme-input.js +18 -7
- package/dist/theme-lint.d.ts +31 -0
- package/dist/theme-lint.js +145 -0
- package/dist/tokens.d.ts +6 -2
- package/dist/tokens.js +221 -45
- package/package.json +2 -2
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/** Recipes refer to library token names, while project-derived constants remain explicit parameters. */
|
|
2
|
+
export const marwesKit = {
|
|
3
|
+
include: "@marwes-kit",
|
|
4
|
+
requires: [
|
|
5
|
+
"@kit",
|
|
6
|
+
],
|
|
7
|
+
recipes: [
|
|
8
|
+
{
|
|
9
|
+
name: "card",
|
|
10
|
+
description: "Surface/border card; project radius token is explicit",
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
name: "segmented",
|
|
14
|
+
description: "Token-styled segments with an explicit selected label",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "progress",
|
|
18
|
+
description: "Labeled bounded progress; explicit pill-radius token",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: "icon-tile",
|
|
22
|
+
description: "Square token-styled icon tile with explicit dimensions",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "stat-tile",
|
|
26
|
+
description: "Card with project content and library typography",
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
source: String.raw `// penpair: read
|
|
30
|
+
const mw = (() => {
|
|
31
|
+
const requireRadius = props => { if (!props || typeof props.radius !== "string" || !props.radius)
|
|
32
|
+
throw new Error("A measured or project-declared radius token is required"); pp.tok(props.radius); };
|
|
33
|
+
const card = (parent, props = {}) => { requireRadius(props); return pp.box(parent, { name: props.name || "Card", dir: "column", gap: props.gap ?? "mw-spacing-sp-16", pad: props.pad ?? ["mw-spacing-sp-24", "mw-spacing-sp-24", "mw-spacing-sp-24", "mw-spacing-sp-24"], bg: props.surface || "mw-color-surface", stroke: props.border || "mw-color-border-low", radius: props.radius, ...props }); };
|
|
34
|
+
const label = (parent, value, props = {}) => pp.text(parent, value, { typo: "mw-typography-text-label", color: "mw-color-text", ...props });
|
|
35
|
+
const segmented = (parent, props = {}) => {
|
|
36
|
+
if (!Array.isArray(props.labels) || !props.labels.length || props.labels.length > 20 || new Set(props.labels).size !== props.labels.length || !props.labels.includes(props.selected) || props.labels.some(value => typeof value !== "string" || !value))
|
|
37
|
+
throw new Error("Segments need 1-20 distinct labels and a selected label");
|
|
38
|
+
const radius = props.radius || "mw-ui-radius";
|
|
39
|
+
pp.tok(radius);
|
|
40
|
+
const group = pp.box(parent, { name: props.name || "Segmented control", dir: "row", gap: props.gap ?? "mw-spacing-sp-2", pad: props.pad ?? ["mw-spacing-sp-2", "mw-spacing-sp-2", "mw-spacing-sp-2", "mw-spacing-sp-2"], align: "center", bg: props.surface || "mw-color-surface-subtle", stroke: props.border || "mw-color-border-low", radius });
|
|
41
|
+
for (const value of props.labels) {
|
|
42
|
+
const selected = value === props.selected;
|
|
43
|
+
const segment = pp.box(group, { name: "Segment " + value, dir: "row", pad: props.segmentPad || ["mw-spacing-sp-8", "mw-spacing-sp-12", "mw-spacing-sp-8", "mw-spacing-sp-12"], align: "center", justify: "center", bg: selected ? props.selectedSurface || "mw-color-surface-primary" : undefined, stroke: selected ? props.selectedBorder || "mw-color-border-medium" : undefined, radius });
|
|
44
|
+
label(segment, value, { typo: props.typo || "mw-typography-text-label", color: selected ? props.color || "mw-color-text" : props.mutedColor || "mw-color-text-muted", ...props.text });
|
|
45
|
+
}
|
|
46
|
+
return group;
|
|
47
|
+
};
|
|
48
|
+
const progress = (parent, props = {}) => {
|
|
49
|
+
requireRadius(props);
|
|
50
|
+
if (typeof props.value !== "number" || !Number.isFinite(props.value) || props.value < 0 || props.value > 100 || typeof props.width !== "number" || !Number.isFinite(props.width) || props.width <= 0)
|
|
51
|
+
throw new Error("Progress needs value 0-100 and positive width");
|
|
52
|
+
if (typeof props.label !== "string" || !props.label)
|
|
53
|
+
throw new Error("Progress label required");
|
|
54
|
+
if (typeof props.height !== "string")
|
|
55
|
+
throw new Error("Progress needs an explicit sizing height token");
|
|
56
|
+
const heightToken = pp.tok(props.height);
|
|
57
|
+
if (heightToken.type !== "sizing")
|
|
58
|
+
throw new Error("Progress height must be a sizing token");
|
|
59
|
+
const height = Number(heightToken.resolvedValue === undefined ? heightToken.value : heightToken.resolvedValue);
|
|
60
|
+
if (!Number.isFinite(height) || height <= 0)
|
|
61
|
+
throw new Error("Progress height token did not resolve");
|
|
62
|
+
const column = pp.box(parent, { name: props.name || "Progress", dir: "column", gap: props.gap ?? "mw-spacing-sp-8" });
|
|
63
|
+
const head = pp.fill(pp.box(column, { name: "Label row", dir: "row", gap: props.gap ?? "mw-spacing-sp-8", align: "center", justify: "space-between" }));
|
|
64
|
+
label(head, props.label, props.text);
|
|
65
|
+
label(head, String(props.value) + "%", { color: props.mutedColor || "mw-color-text-muted", ...props.text });
|
|
66
|
+
const track = pp.box(column, { name: "Track", w: props.width, h: height, clip: true, bg: props.track || "mw-color-border-low", radius: props.radius });
|
|
67
|
+
pp.bind(track, heightToken.name, ["height"]);
|
|
68
|
+
if (props.value > 0) {
|
|
69
|
+
const fill = pp.box(track, { name: "Fill", w: props.width * props.value / 100, h: height, bg: props.color || "mw-color-primary-base", radius: props.radius });
|
|
70
|
+
pp.bind(fill, heightToken.name, ["height"]);
|
|
71
|
+
}
|
|
72
|
+
return column;
|
|
73
|
+
};
|
|
74
|
+
const iconTile = (parent, props = {}) => {
|
|
75
|
+
requireRadius(props);
|
|
76
|
+
if (!Number.isFinite(props.size) || props.size <= 0 || !Number.isFinite(props.iconSize) || props.iconSize <= 0 || props.iconSize > props.size)
|
|
77
|
+
throw new Error("Icon tile needs explicit positive square/icon dimensions");
|
|
78
|
+
const tile = pp.box(parent, { name: props.name || "Icon tile", dir: "row", align: "center", justify: "center", w: props.size, h: props.size, bg: props.surface || "mw-color-surface-subtle", radius: props.radius });
|
|
79
|
+
pp.icon(tile, props.kind, props.color || "mw-color-text", props.iconSize);
|
|
80
|
+
return tile;
|
|
81
|
+
};
|
|
82
|
+
const statTile = (parent, props = {}) => { if (typeof props.title !== "string" || !props.title || typeof props.value !== "string" || !props.value)
|
|
83
|
+
throw new Error("Stat tile title/value required"); const tile = card(parent, props); label(tile, props.title, { typo: props.labelTypo || "mw-typography-text-label", color: props.mutedColor || "mw-color-text-muted", ...props.text }); label(tile, props.value, { typo: props.valueTypo || "mw-typography-h2", color: props.color || "mw-color-text", ...props.text }); if (props.caption)
|
|
84
|
+
label(tile, props.caption, { typo: props.captionTypo || "mw-typography-text-caption", color: props.mutedColor || "mw-color-text-muted", ...props.text }); return tile; };
|
|
85
|
+
pp.defineRecipe("card", card, "Surface/border card; project radius token is explicit");
|
|
86
|
+
pp.defineRecipe("segmented", segmented, "Token-styled segments with an explicit selected label");
|
|
87
|
+
pp.defineRecipe("progress", progress, "Labeled bounded progress; explicit pill-radius token");
|
|
88
|
+
pp.defineRecipe("icon-tile", iconTile, "Square token-styled icon tile with explicit dimensions");
|
|
89
|
+
pp.defineRecipe("stat-tile", statTile, "Card with project content and library typography");
|
|
90
|
+
return { card, segmented, progress, iconTile, statTile };
|
|
91
|
+
})();
|
|
92
|
+
`,
|
|
93
|
+
};
|
package/dist/commands.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export declare function computeExpectation(root: string, rawConfig: Record<strin
|
|
|
14
14
|
export interface SnapshotCheck {
|
|
15
15
|
/** The committed snapshot equals what the installed Marwes and the themes give now. */
|
|
16
16
|
current: boolean;
|
|
17
|
+
reasons: {
|
|
18
|
+
code: "missing-snapshot" | "schema-migration" | "missing-ownership" | "content-drift" | "metadata-mismatch" | "package-mismatch";
|
|
19
|
+
message: string;
|
|
20
|
+
}[];
|
|
17
21
|
committed?: TokenSnapshot;
|
|
18
22
|
diff: SnapshotDiff;
|
|
19
23
|
problems: string[];
|