@nebutra/design-sync 0.1.2 → 2.0.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/serialize/to-design-md.d.ts +7 -1
- package/dist/serialize/to-design-md.d.ts.map +1 -1
- package/dist/serialize/to-design-md.js +1 -1
- package/dist/serialize/to-design-md.prose.d.ts +2 -2
- package/dist/serialize/to-design-md.prose.d.ts.map +1 -1
- package/dist/serialize/to-design-md.prose.js +23 -7
- package/dist/serialize/to-preview-html.d.ts +7 -1
- package/dist/serialize/to-preview-html.d.ts.map +1 -1
- package/dist/serialize/to-preview-html.js +1 -1
- package/package.json +4 -3
|
@@ -20,7 +20,13 @@
|
|
|
20
20
|
*/
|
|
21
21
|
import type { DesignTokenSet } from "../types";
|
|
22
22
|
export interface ToDesignMdOptions {
|
|
23
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* Design system name written into the exported artefact.
|
|
25
|
+
*
|
|
26
|
+
* Defaults to a generic label on purpose: this package is provider-agnostic
|
|
27
|
+
* and has no brand of its own, so naming one here would stamp it onto every
|
|
28
|
+
* downstream design system that did not pass this option.
|
|
29
|
+
*/
|
|
24
30
|
name?: string;
|
|
25
31
|
/** One-line brand description for the front matter and prose Overview. */
|
|
26
32
|
description?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-design-md.d.ts","sourceRoot":"","sources":["../../src/serialize/to-design-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAqB/C,MAAM,WAAW,iBAAiB;IAChC
|
|
1
|
+
{"version":3,"file":"to-design-md.d.ts","sourceRoot":"","sources":["../../src/serialize/to-design-md.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAqB/C,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM,CA2C/F"}
|
|
@@ -28,7 +28,7 @@ import { buildIndex, buildIndexForSet, buildRounded, buildSpacing, buildTypograp
|
|
|
28
28
|
* @returns A deterministic DESIGN.md string (YAML front matter + markdown prose).
|
|
29
29
|
*/
|
|
30
30
|
export function serializeToDesignMd(sets, options) {
|
|
31
|
-
const name = options?.name ?? "
|
|
31
|
+
const name = options?.name ?? "Design System";
|
|
32
32
|
const description = options?.description;
|
|
33
33
|
// 1. Build a flat path→leaf index across ALL sets
|
|
34
34
|
const index = buildIndex(sets);
|
|
@@ -38,7 +38,7 @@ export interface ContainerInfo {
|
|
|
38
38
|
}
|
|
39
39
|
export interface ProseArgs {
|
|
40
40
|
name: string;
|
|
41
|
-
/** Optional custom description.
|
|
41
|
+
/** Optional custom description. Replaces the generated Overview paragraph. */
|
|
42
42
|
description?: string;
|
|
43
43
|
colors: ColorRoles;
|
|
44
44
|
colorDescriptions: ColorDescriptions;
|
|
@@ -49,7 +49,7 @@ export interface ProseArgs {
|
|
|
49
49
|
export declare const COLOR_ORDER: Array<keyof ColorRoles>;
|
|
50
50
|
export declare const DESIGN_MD_GOVERNANCE: {
|
|
51
51
|
readonly dos: readonly ["Use semantic tokens / CSS variables (`bg-primary`, `text-foreground`, `border-border`) — never raw hex values.", "Use the brand gradient (135° blue→cyan) for primary CTAs and gradient text effects.", "Use `AnimateIn` presets for entrance animations; never use raw `motion.div` with hardcoded transition values.", "Constrain layouts to the container width tiers; use the wide (1400px) container for feature sections.", "Give icon-only buttons an `aria-label`; rely on the global `:focus-visible` ring — do not add component-level focus rings."];
|
|
52
|
-
readonly donts: readonly ["Don't hardcode brand or status hex values in components — use token aliases (`var(--brand-primary)`, etc.).", "Don't use `max-w-5xl` or `max-w-7xl` for feature sections — use the wide container (`max-w-
|
|
52
|
+
readonly donts: readonly ["Don't hardcode brand or status hex values in components — use token aliases (`var(--brand-primary)`, etc.).", "Don't use `max-w-5xl` or `max-w-7xl` for feature sections — use the wide container (`max-w-wide`).", "Don't reintroduce hardcoded focus rings (they double-render with the global `:focus-visible` rule).", "Don't use raw form controls (`<input>`, `<select>`, `<textarea>`) in app surfaces — use the primitives from `@nebutra/ui/primitives`."];
|
|
53
53
|
};
|
|
54
54
|
export declare function buildProse(args: ProseArgs): string;
|
|
55
55
|
//# sourceMappingURL=to-design-md.prose.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-design-md.prose.d.ts","sourceRoot":"","sources":["../../src/serialize/to-design-md.prose.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,yFAAyF;AACzF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,eAAe,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,
|
|
1
|
+
{"version":3,"file":"to-design-md.prose.d.ts","sourceRoot":"","sources":["../../src/serialize/to-design-md.prose.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,UAAU;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,yFAAyF;AACzF,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,eAAe,CAAC;IACpB,SAAS,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,eAAe,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,iBAAiB,EAAE,iBAAiB,CAAC;IACrC,UAAU,EAAE,aAAa,CAAC;IAC1B,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,aAAa,CAAC;CAC3B;AAID,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,MAAM,UAAU,CAS/C,CAAC;AAIF,eAAO,MAAM,oBAAoB;;;CAcvB,CAAC;AAIX,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAalD"}
|
|
@@ -26,7 +26,7 @@ export const DESIGN_MD_GOVERNANCE = {
|
|
|
26
26
|
],
|
|
27
27
|
donts: [
|
|
28
28
|
"Don't hardcode brand or status hex values in components — use token aliases (`var(--brand-primary)`, etc.).",
|
|
29
|
-
"Don't use `max-w-5xl` or `max-w-7xl` for feature sections — use the wide container (`max-w-
|
|
29
|
+
"Don't use `max-w-5xl` or `max-w-7xl` for feature sections — use the wide container (`max-w-wide`).",
|
|
30
30
|
"Don't reintroduce hardcoded focus rings (they double-render with the global `:focus-visible` rule).",
|
|
31
31
|
"Don't use raw form controls (`<input>`, `<select>`, `<textarea>`) in app surfaces — use the primitives from `@nebutra/ui/primitives`.",
|
|
32
32
|
],
|
|
@@ -34,7 +34,7 @@ export const DESIGN_MD_GOVERNANCE = {
|
|
|
34
34
|
// ─── Prose builder ────────────────────────────────────────────────────────────
|
|
35
35
|
export function buildProse(args) {
|
|
36
36
|
const sections = [];
|
|
37
|
-
sections.push(buildOverview(args.name, args.description));
|
|
37
|
+
sections.push(buildOverview(args.name, args.colors, args.description));
|
|
38
38
|
sections.push(buildColors(args.colors, args.colorDescriptions));
|
|
39
39
|
sections.push(buildTypographySection(args.typography));
|
|
40
40
|
sections.push(buildLayout(args.containers));
|
|
@@ -45,11 +45,27 @@ export function buildProse(args) {
|
|
|
45
45
|
return "\n" + sections.join("\n\n") + "\n";
|
|
46
46
|
}
|
|
47
47
|
// ─── Section helpers ──────────────────────────────────────────────────────────
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
48
|
+
/**
|
|
49
|
+
* The fallback paragraph is generated from the caller's own tokens.
|
|
50
|
+
*
|
|
51
|
+
* It used to be Nebutra's: it named 云毓蓝 #0033fe and 云毓青 #0bf1c3 as "the
|
|
52
|
+
* brand palette" and asserted Vercel/Geist parity, so every downstream design
|
|
53
|
+
* system exported a document describing someone else's colours as its own.
|
|
54
|
+
*/
|
|
55
|
+
function buildOverview(name, colors, description) {
|
|
56
|
+
if (description)
|
|
57
|
+
return `## Overview\n\n${description}`;
|
|
58
|
+
const palette = [
|
|
59
|
+
colors.primary ? `primary ${colors.primary}` : null,
|
|
60
|
+
colors.accent ? `accent ${colors.accent}` : null,
|
|
61
|
+
]
|
|
62
|
+
.filter(Boolean)
|
|
63
|
+
.join(" → ");
|
|
64
|
+
const paragraph = `${name} is a token-first design system` +
|
|
65
|
+
(palette ? ` built on a ${palette} palette` : "") +
|
|
66
|
+
". It favours semantic tokens over raw hex values and follows the DTCG " +
|
|
67
|
+
"(W3C draft) format, which drives CSS variables, Tailwind utilities and " +
|
|
68
|
+
"the Style Dictionary pipeline.";
|
|
53
69
|
return `## Overview\n\n${paragraph}`;
|
|
54
70
|
}
|
|
55
71
|
const COLOR_LABELS = {
|
|
@@ -16,7 +16,13 @@
|
|
|
16
16
|
*/
|
|
17
17
|
import type { DesignTokenSet } from "../types";
|
|
18
18
|
export interface ToPreviewHtmlOptions {
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Design system name written into the exported artefact.
|
|
21
|
+
*
|
|
22
|
+
* Defaults to a generic label on purpose: this package is provider-agnostic
|
|
23
|
+
* and has no brand of its own, so naming one here would stamp it onto every
|
|
24
|
+
* downstream design system that did not pass this option.
|
|
25
|
+
*/
|
|
20
26
|
name?: string;
|
|
21
27
|
/**
|
|
22
28
|
* Name of a theme token set (e.g. "themes/light") whose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-preview-html.d.ts","sourceRoot":"","sources":["../../src/serialize/to-preview-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAkB/C,MAAM,WAAW,oBAAoB;IACnC
|
|
1
|
+
{"version":3,"file":"to-preview-html.d.ts","sourceRoot":"","sources":["../../src/serialize/to-preview-html.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAkB/C,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,cAAc,EAAE,EACtB,OAAO,CAAC,EAAE,oBAAoB,GAC7B,MAAM,CA2CR"}
|
|
@@ -24,7 +24,7 @@ import { buildDocument, cssAttrValue, escapeHtml, } from "./to-preview-html.temp
|
|
|
24
24
|
* @returns A deterministic, self-contained HTML string.
|
|
25
25
|
*/
|
|
26
26
|
export function serializeToPreviewHtml(sets, options) {
|
|
27
|
-
const name = options?.name ?? "
|
|
27
|
+
const name = options?.name ?? "Design System";
|
|
28
28
|
const escapedName = escapeHtml(name);
|
|
29
29
|
// 1. Build flat indexes
|
|
30
30
|
const index = buildIndex(sets);
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nebutra/design-sync",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Provider-agnostic design-tool sync. Figma + Tokens Studio | Penpot | git-only | design-md | memory.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"nebutra": {
|
|
9
|
+
"graph": "core",
|
|
9
10
|
"status": "foundation",
|
|
10
11
|
"productionReady": false,
|
|
11
12
|
"requires": [
|
|
@@ -73,8 +74,8 @@
|
|
|
73
74
|
"dependencies": {
|
|
74
75
|
"@google/design.md": "0.2.0",
|
|
75
76
|
"zod": "^4.3.6",
|
|
76
|
-
"@nebutra/logger": "0.
|
|
77
|
-
"@nebutra/tokens": "0.
|
|
77
|
+
"@nebutra/logger": "2.0.0",
|
|
78
|
+
"@nebutra/tokens": "2.0.0"
|
|
78
79
|
},
|
|
79
80
|
"devDependencies": {
|
|
80
81
|
"@types/node": "^25.9.1",
|