@razorwind/design-md 0.0.42 → 0.0.44

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/README.md CHANGED
@@ -94,7 +94,7 @@ export default defineConfig({
94
94
 
95
95
  | Option | Default | Description |
96
96
  | ------------- | --------------------------- | -------------------------------------------------------- |
97
- | `outFile` | `"DESIGN.md"` | Output file path (relative to the execution cwd) |
97
+ | `outputPath` | `"DESIGN.md"` | Output file path (relative to the execution cwd) |
98
98
  | `name` | `"Razorwind Design System"` | Design system name written to the YAML front matter |
99
99
  | `description` | — | Short description written to the YAML front matter |
100
100
  | `version` | `"alpha"` | DESIGN.md spec version written to the YAML front matter |
@@ -0,0 +1,28 @@
1
+ const e=require("./rolldown-runtime-BIInC43l.cjs");let t=require("@razorwind/core/plugin"),n=require("@stryke/type-checks/is-object"),r=require("@razorwind/core/utils"),i=require("node:path");function a(e){return`# Installing ${e.name??`Razorwind Design System`} (DESIGN.md)
2
+
3
+ Generated by \`@razorwind/design-md\`.
4
+
5
+ ## Files
6
+
7
+ - \`${e.outputPath}\` — DESIGN.md design-system specification
8
+
9
+ ## Setup
10
+
11
+ 1. Place \`${e.outputPath}\` at your repo root (or the path your tooling expects).
12
+
13
+ 2. Point DESIGN.md-aware tools (agents, linters, generators) at this file as the canonical design spec.
14
+
15
+ 3. Keep \`${e.outputPath}\` in sync by re-running Razorwind generate when tokens or components change.
16
+
17
+ ## Usage
18
+
19
+ Reference token names, component rules, and layout guidance from \`${e.outputPath}\` when implementing UI. Regenerate rather than hand-editing generated sections.
20
+ `}function o(e,t){return(0,r.flattenTokens)(e,{includeTypes:t})}function s(e,t){let n=e.split(`.`).filter(Boolean);for(;n.length>1&&t.includes(n[0].toLowerCase());)n.shift();return n.join(`-`).replaceAll(/[^\w-]+/g,`-`).toLowerCase()}function c(e){if(typeof e==`number`||typeof e==`boolean`)return String(e);let t=String(e);return/^[a-z][\w-]*$/i.test(t)?t:JSON.stringify(t)}function l(e){return e.split(/[-_.]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var u=e.t({default:()=>F,extractDesignMd:()=>D,generateDesignMd:()=>P,renderDesignMd:()=>N,renderInstallMd:()=>a,selectPrimaryTheme:()=>b});const d=new Set([`backgroundColor`,`textColor`,`typography`,`rounded`,`padding`,`size`,`height`,`width`]),f={background:`backgroundColor`,backgroundcolor:`backgroundColor`,bg:`backgroundColor`,fill:`backgroundColor`,color:`textColor`,foreground:`textColor`,text:`textColor`,textcolor:`textColor`,font:`typography`,radius:`rounded`,borderradius:`rounded`,corner:`rounded`},p=[`color`,`colors`,`palette`],m=[`typography`,`type`,`text`,`font`,`fonts`],h=/(?:^|\.)(?:radius|radii|rounded|corner)(?:\.|$)/i,g=/(?:^|\.)(?:spacing|space|gap)(?:\.|$)/i,_=/^components?$/i,v=/^\{([^}]+)\}$/,y=[`fontFamily`,`fontSize`,`fontWeight`,`lineHeight`,`letterSpacing`];function b(e){let t=[...new Set(e.map(e=>e.theme))],n=t.find(e=>e===void 0)??t.find(e=>/^light/i.test(e??``))??t.find(e=>/^(?:default|base)/i.test(e??``))??t[0];return e.filter(e=>e.theme===n)}function x(e){if(typeof e==`string`)return v.exec(e.trim())?.[1]}function S(e,t){let n=e;for(let e=0;e<8;e++){let e=x(n.value);if(!e)return n;let r=t.get(e);if(!r)return n;n=r}return n}function C(e){return e.split(/[-_.\s]+/).filter(Boolean).map((e,t)=>t===0?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``)}function w(e){let t=C(e);return d.has(t)?t:f[t.toLowerCase()]}function T(e,t){let i={};if(!(0,n.isObject)(e))return i;for(let n of y){let a=e[n];if(a==null)continue;let o=x(a),s=o?t.get(o):void 0,c=s?S(s,t).cssValue:void 0;if(typeof a==`number`){i[n]=n===`fontWeight`||n===`lineHeight`?a:(0,r.formatTokenValue)(a);continue}i[n]=c??(0,r.formatTokenValue)(a)}return i}function E(e,t){return{...e,...t.name!==void 0&&{name:t.name},...t.description!==void 0&&{description:t.description},...t.version!==void 0&&{version:t.version}}}function D(e){let t=b(o(e.tokens)),n=new Map(t.map(e=>[e.path,e])),i=(0,r.resolveSchemaIdentity)(e),a={...i.title||i.name?{name:i.title??i.name}:{},...i.description?{description:i.description}:{},colors:{},colorDescriptions:{},typography:{},rounded:{},spacing:{},components:{}},c=new Map,l=[];for(let e of t){let t=e.path.split(`.`);if(t[0]&&_.test(t[0])){l.push(e);continue}if(e.type===`color`){let t=s(e.path,p),r=S(e,n);a.colors[t]=r.cssValue,e.description&&(a.colorDescriptions[t]=e.description),c.set(e.path,`colors.${t}`);continue}if(e.type===`typography`){let t=s(e.path,m);a.typography[t]=T(e.value,n),c.set(e.path,`typography.${t}`);continue}if(e.type===`fontFamily`){let t=s(e.path,m);a.typography[t]??={},a.typography[t].fontFamily=e.cssValue,c.set(e.path,`typography.${t}`);continue}let r=e.type===`dimension`||e.type===`number`||typeof e.value==`number`;if(r&&h.test(e.path)){let r=t.at(-1);a.rounded[r]=S(e,n).cssValue,c.set(e.path,`rounded.${r}`);continue}if(r&&g.test(e.path)){let r=t.at(-1);a.spacing[r]=S(e,n).cssValue,c.set(e.path,`spacing.${r}`)}}for(let e of l){let t=e.path.split(`.`).slice(1);if(t.length<2)continue;let r=w(t.at(-1));if(!r)continue;let i=t.slice(0,-1).join(`-`).replaceAll(/[^\w-]+/g,`-`).toLowerCase(),o=x(e.value),s=o?c.get(o):void 0,l=s?`{${s}}`:S(e,n).cssValue;a.components[i]??={},a.components[i][r]=l}return a}function O(e,t,n){let r=Object.entries(t);if(r.length!==0){n.push(`${e}:`);for(let[e,t]of r){if(typeof t==`object`&&t){n.push(` ${e}:`);for(let[e,r]of Object.entries(t))n.push(` ${e}: ${c(r)}`);continue}n.push(` ${e}: ${c(t)}`)}}}function k(e){let t=[`---`];return e.version?t.push(`version: ${c(e.version)}`):t.push(`version: alpha`),t.push(`name: ${c(e.name)}`),e.description&&t.push(`description: ${c(e.description)}`),O(`colors`,e.colors,t),O(`typography`,e.typography,t),O(`rounded`,e.rounded,t),O(`spacing`,e.spacing,t),O(`components`,e.components,t),t.push(`---`),`${t.join(`
21
+ `)}\n`}function A(e,...t){return`## ${e}\n\n${t.filter(Boolean).join(`
22
+ `)}\n`}function j(e){let t=[[Object.keys(e.colors).length,`color`],[Object.keys(e.typography).length,`typography`],[Object.keys(e.rounded).length,`shape`],[Object.keys(e.spacing).length,`spacing`],[Object.keys(e.components).length,`component`]].filter(([e])=>e>0).map(([e,t])=>`${e} ${t} token${e===1?``:`s`}`).join(`, `);return`${e.name} design tokens${t?` — ${t}`:``}. The YAML front matter above is the normative source; the prose below explains how to apply it.`}function M(e,t={}){let n=[A(`Overview`,t.overview??j(e))],r=Object.entries(e.colors);r.length>0&&n.push(A(`Colors`,r.map(([t,n])=>{let r=e.colorDescriptions[t];return`- **${l(t)} (${n}):**${r?` ${r}`:``}`}).join(`
23
+ `)));let i=Object.entries(e.typography);i.length>0&&n.push(A(`Typography`,i.map(([e,t])=>`- **${e}:** ${Object.entries(t).map(([e,t])=>`${e}: ${t}`).join(`, `)}`).join(`
24
+ `)));let a=Object.entries(e.spacing);a.length>0&&n.push(A(`Layout`,`Spacing scale:`,``,a.map(([e,t])=>`- **${e}:** ${t}`).join(`
25
+ `)));let o=Object.entries(e.rounded);o.length>0&&n.push(A(`Shapes`,`Corner radius scale:`,``,o.map(([e,t])=>`- **${e}:** ${t}`).join(`
26
+ `)));let s=Object.entries(e.components);return s.length>0&&n.push(A(`Components`,s.map(([e,t])=>`- **${e}:** ${Object.entries(t).map(([e,t])=>`${e}: \`${t}\``).join(`, `)}`).join(`
27
+ `))),n.join(`
28
+ `)}function N(e,t={}){return`${k(e)}\n${M(e,t)}`}function P(e,t={}){let n=E(D(e),t),r=t.outputPath??`DESIGN.md`,o=N(n,t),s=t.installGuide??a({outputPath:r,name:t.name??n.name}),c=(0,i.join)((0,i.dirname)(r),`INSTALL.md`);return{[r]:{path:r,language:`markdown`,chunks:[{content:o,meta:{name:`razorwind-design-md`}}]},[c]:{path:c,language:`markdown`,chunks:[{content:s,meta:{name:`razorwind-design-md`}}]}}}var F=(0,t.definePlugin)(e=>({name:`design-md:generate`,generate:async t=>P(t,e??{})}));Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
@@ -0,0 +1,29 @@
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{definePlugin as t}from"@razorwind/core/plugin";import{isObject as n}from"@stryke/type-checks/is-object";import{flattenTokens as r,formatTokenValue as i,resolveSchemaIdentity as a}from"@razorwind/core/utils";import{dirname as o,join as s}from"node:path";function c(e){return`# Installing ${e.name??`Razorwind Design System`} (DESIGN.md)
2
+
3
+ Generated by \`@razorwind/design-md\`.
4
+
5
+ ## Files
6
+
7
+ - \`${e.outputPath}\` — DESIGN.md design-system specification
8
+
9
+ ## Setup
10
+
11
+ 1. Place \`${e.outputPath}\` at your repo root (or the path your tooling expects).
12
+
13
+ 2. Point DESIGN.md-aware tools (agents, linters, generators) at this file as the canonical design spec.
14
+
15
+ 3. Keep \`${e.outputPath}\` in sync by re-running Razorwind generate when tokens or components change.
16
+
17
+ ## Usage
18
+
19
+ Reference token names, component rules, and layout guidance from \`${e.outputPath}\` when implementing UI. Regenerate rather than hand-editing generated sections.
20
+ `}function l(e,t){return r(e,{includeTypes:t})}function u(e,t){let n=e.split(`.`).filter(Boolean);for(;n.length>1&&t.includes(n[0].toLowerCase());)n.shift();return n.join(`-`).replaceAll(/[^\w-]+/g,`-`).toLowerCase()}function d(e){if(typeof e==`number`||typeof e==`boolean`)return String(e);let t=String(e);return/^[a-z][\w-]*$/i.test(t)?t:JSON.stringify(t)}function f(e){return e.split(/[-_.]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var p=e({default:()=>R,extractDesignMd:()=>A,generateDesignMd:()=>L,renderDesignMd:()=>I,renderInstallMd:()=>c,selectPrimaryTheme:()=>C});const m=new Set([`backgroundColor`,`textColor`,`typography`,`rounded`,`padding`,`size`,`height`,`width`]),h={background:`backgroundColor`,backgroundcolor:`backgroundColor`,bg:`backgroundColor`,fill:`backgroundColor`,color:`textColor`,foreground:`textColor`,text:`textColor`,textcolor:`textColor`,font:`typography`,radius:`rounded`,borderradius:`rounded`,corner:`rounded`},g=[`color`,`colors`,`palette`],_=[`typography`,`type`,`text`,`font`,`fonts`],v=/(?:^|\.)(?:radius|radii|rounded|corner)(?:\.|$)/i,y=/(?:^|\.)(?:spacing|space|gap)(?:\.|$)/i,b=/^components?$/i,x=/^\{([^}]+)\}$/,S=[`fontFamily`,`fontSize`,`fontWeight`,`lineHeight`,`letterSpacing`];function C(e){let t=[...new Set(e.map(e=>e.theme))],n=t.find(e=>e===void 0)??t.find(e=>/^light/i.test(e??``))??t.find(e=>/^(?:default|base)/i.test(e??``))??t[0];return e.filter(e=>e.theme===n)}function w(e){if(typeof e==`string`)return x.exec(e.trim())?.[1]}function T(e,t){let n=e;for(let e=0;e<8;e++){let e=w(n.value);if(!e)return n;let r=t.get(e);if(!r)return n;n=r}return n}function E(e){return e.split(/[-_.\s]+/).filter(Boolean).map((e,t)=>t===0?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``)}function D(e){let t=E(e);return m.has(t)?t:h[t.toLowerCase()]}function O(e,t){let r={};if(!n(e))return r;for(let n of S){let a=e[n];if(a==null)continue;let o=w(a),s=o?t.get(o):void 0,c=s?T(s,t).cssValue:void 0;if(typeof a==`number`){r[n]=n===`fontWeight`||n===`lineHeight`?a:i(a);continue}r[n]=c??i(a)}return r}function k(e,t){return{...e,...t.name!==void 0&&{name:t.name},...t.description!==void 0&&{description:t.description},...t.version!==void 0&&{version:t.version}}}function A(e){let t=C(l(e.tokens)),n=new Map(t.map(e=>[e.path,e])),r=a(e),i={...r.title||r.name?{name:r.title??r.name}:{},...r.description?{description:r.description}:{},colors:{},colorDescriptions:{},typography:{},rounded:{},spacing:{},components:{}},o=new Map,s=[];for(let e of t){let t=e.path.split(`.`);if(t[0]&&b.test(t[0])){s.push(e);continue}if(e.type===`color`){let t=u(e.path,g),r=T(e,n);i.colors[t]=r.cssValue,e.description&&(i.colorDescriptions[t]=e.description),o.set(e.path,`colors.${t}`);continue}if(e.type===`typography`){let t=u(e.path,_);i.typography[t]=O(e.value,n),o.set(e.path,`typography.${t}`);continue}if(e.type===`fontFamily`){let t=u(e.path,_);i.typography[t]??={},i.typography[t].fontFamily=e.cssValue,o.set(e.path,`typography.${t}`);continue}let r=e.type===`dimension`||e.type===`number`||typeof e.value==`number`;if(r&&v.test(e.path)){let r=t.at(-1);i.rounded[r]=T(e,n).cssValue,o.set(e.path,`rounded.${r}`);continue}if(r&&y.test(e.path)){let r=t.at(-1);i.spacing[r]=T(e,n).cssValue,o.set(e.path,`spacing.${r}`)}}for(let e of s){let t=e.path.split(`.`).slice(1);if(t.length<2)continue;let r=D(t.at(-1));if(!r)continue;let a=t.slice(0,-1).join(`-`).replaceAll(/[^\w-]+/g,`-`).toLowerCase(),s=w(e.value),c=s?o.get(s):void 0,l=c?`{${c}}`:T(e,n).cssValue;i.components[a]??={},i.components[a][r]=l}return i}function j(e,t,n){let r=Object.entries(t);if(r.length!==0){n.push(`${e}:`);for(let[e,t]of r){if(typeof t==`object`&&t){n.push(` ${e}:`);for(let[e,r]of Object.entries(t))n.push(` ${e}: ${d(r)}`);continue}n.push(` ${e}: ${d(t)}`)}}}function M(e){let t=[`---`];return e.version?t.push(`version: ${d(e.version)}`):t.push(`version: alpha`),t.push(`name: ${d(e.name)}`),e.description&&t.push(`description: ${d(e.description)}`),j(`colors`,e.colors,t),j(`typography`,e.typography,t),j(`rounded`,e.rounded,t),j(`spacing`,e.spacing,t),j(`components`,e.components,t),t.push(`---`),`${t.join(`
21
+ `)}\n`}function N(e,...t){return`## ${e}\n\n${t.filter(Boolean).join(`
22
+ `)}\n`}function P(e){let t=[[Object.keys(e.colors).length,`color`],[Object.keys(e.typography).length,`typography`],[Object.keys(e.rounded).length,`shape`],[Object.keys(e.spacing).length,`spacing`],[Object.keys(e.components).length,`component`]].filter(([e])=>e>0).map(([e,t])=>`${e} ${t} token${e===1?``:`s`}`).join(`, `);return`${e.name} design tokens${t?` — ${t}`:``}. The YAML front matter above is the normative source; the prose below explains how to apply it.`}function F(e,t={}){let n=[N(`Overview`,t.overview??P(e))],r=Object.entries(e.colors);r.length>0&&n.push(N(`Colors`,r.map(([t,n])=>{let r=e.colorDescriptions[t];return`- **${f(t)} (${n}):**${r?` ${r}`:``}`}).join(`
23
+ `)));let i=Object.entries(e.typography);i.length>0&&n.push(N(`Typography`,i.map(([e,t])=>`- **${e}:** ${Object.entries(t).map(([e,t])=>`${e}: ${t}`).join(`, `)}`).join(`
24
+ `)));let a=Object.entries(e.spacing);a.length>0&&n.push(N(`Layout`,`Spacing scale:`,``,a.map(([e,t])=>`- **${e}:** ${t}`).join(`
25
+ `)));let o=Object.entries(e.rounded);o.length>0&&n.push(N(`Shapes`,`Corner radius scale:`,``,o.map(([e,t])=>`- **${e}:** ${t}`).join(`
26
+ `)));let s=Object.entries(e.components);return s.length>0&&n.push(N(`Components`,s.map(([e,t])=>`- **${e}:** ${Object.entries(t).map(([e,t])=>`${e}: \`${t}\``).join(`, `)}`).join(`
27
+ `))),n.join(`
28
+ `)}function I(e,t={}){return`${M(e)}\n${F(e,t)}`}function L(e,t={}){let n=k(A(e),t),r=t.outputPath??`DESIGN.md`,i=I(n,t),a=t.installGuide??c({outputPath:r,name:t.name??n.name}),l=s(o(r),`INSTALL.md`);return{[r]:{path:r,language:`markdown`,chunks:[{content:i,meta:{name:`razorwind-design-md`}}]},[l]:{path:l,language:`markdown`,chunks:[{content:a,meta:{name:`razorwind-design-md`}}]}}}var R=t(e=>({name:`design-md:generate`,generate:async t=>L(t,e??{})}));export{I as a,p as i,L as n,C as o,R as r,c as s,A as t};
29
+ //# sourceMappingURL=generate-BI0Qt52j.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-BI0Qt52j.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-D-aW7d_O.d.cts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":";;;;;;;;;iBAuBgB,gBAAgB;EAC9B;EACA;;;;;;;;;;iBC8Dc,mBAAmB,MAAM,cAAc;;;;;;;;;iBA+HvC,gBAAgB,MAAM,SAAS;;;;;;;iBAuR/B,eACd,UAAU,kBACV,UAAS;;;;;;;iBAaK,iBACd,MAAM,QACN,UAAS,gCACR,wBAAwB,QAAQ"}
1
+ {"version":3,"file":"generate-D-aW7d_O.d.cts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":";;;;;;;;;iBAuBgB,gBAAgB;EAC9B;EACA;;;;;;;;;;iBC8Dc,mBAAmB,MAAM,cAAc;;;;;;;;;iBA+HvC,gBAAgB,MAAM,SAAS;;;;;;;iBA0R/B,eACd,UAAU,kBACV,UAAS;;;;;;;iBAaK,iBACd,MAAM,QACN,UAAS,gCACR,wBAAwB,QAAQ"}
package/dist/generate.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./generate-LuomgmOY.cjs");exports.default=e.r,exports.extractDesignMd=e.t,exports.generateDesignMd=e.n,exports.renderDesignMd=e.a,exports.renderInstallMd=e.s,exports.selectPrimaryTheme=e.o;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./generate-BH8u-RdP.cjs");exports.default=e.r,exports.extractDesignMd=e.t,exports.generateDesignMd=e.n,exports.renderDesignMd=e.a,exports.renderInstallMd=e.s,exports.selectPrimaryTheme=e.o;
package/dist/generate.mjs CHANGED
@@ -1 +1 @@
1
- import{a as e,n as t,o as n,r,s as i,t as a}from"./generate-q-vbYaCP.mjs";export{r as default,a as extractDesignMd,t as generateDesignMd,e as renderDesignMd,i as renderInstallMd,n as selectPrimaryTheme};
1
+ import{a as e,n as t,o as n,r,s as i,t as a}from"./generate-BI0Qt52j.mjs";export{r as default,a as extractDesignMd,t as generateDesignMd,e as renderDesignMd,i as renderInstallMd,n as selectPrimaryTheme};
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./extract.cjs"),t=require("./generate-LuomgmOY.cjs");Object.defineProperty(exports,"extract",{enumerable:!0,get:function(){return e.t}}),Object.defineProperty(exports,"generate",{enumerable:!0,get:function(){return t.i}});
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./extract.cjs"),t=require("./generate-BH8u-RdP.cjs");Object.defineProperty(exports,"extract",{enumerable:!0,get:function(){return e.t}}),Object.defineProperty(exports,"generate",{enumerable:!0,get:function(){return t.i}});
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{t as e}from"./extract.mjs";import{i as t}from"./generate-q-vbYaCP.mjs";export{e as extract,t as generate};
1
+ import{t as e}from"./extract.mjs";import{i as t}from"./generate-BI0Qt52j.mjs";export{e as extract,t as generate};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@razorwind/design-md",
3
- "version": "0.0.42",
3
+ "version": "0.0.44",
4
4
  "type": "module",
5
5
  "description": "Razorwind DESIGN.md plugin that can create a DESIGN.md design-system specification file from design tokens or read a DESIGN.md file and return the design-system specification.",
6
6
  "repository": {
@@ -80,7 +80,7 @@
80
80
  "dependencies": {
81
81
  "@power-plant/core": "^0.0.90",
82
82
  "@power-plant/dtcg-schema": "^0.0.1",
83
- "@razorwind/core": "^0.0.46",
83
+ "@razorwind/core": "^0.0.48",
84
84
  "@stryke/fs": "^0.33.110",
85
85
  "@stryke/path": "^0.29.35",
86
86
  "@stryke/type-checks": "^0.6.41",
@@ -93,5 +93,5 @@
93
93
  "typescript": "^6.0.3"
94
94
  },
95
95
  "publishConfig": { "access": "public" },
96
- "gitHead": "0bfdb728cdb6c241eae5072dab7984fe48146c22"
96
+ "gitHead": "c53ec72420850efd1c4f8339b264c33ca6b9870b"
97
97
  }
@@ -1,28 +0,0 @@
1
- const e=require("./rolldown-runtime-BIInC43l.cjs");let t=require("@razorwind/core/plugin"),n=require("@stryke/type-checks/is-object"),r=require("@razorwind/core/utils"),i=require("node:path");function a(e,t){return(0,r.flattenTokens)(e,{includeTypes:t})}function o(e){return`# Installing ${e.name??`Razorwind Design System`} (DESIGN.md)
2
-
3
- Generated by \`@razorwind/design-md\`.
4
-
5
- ## Files
6
-
7
- - \`${e.outputPath}\` — DESIGN.md design-system specification
8
-
9
- ## Setup
10
-
11
- 1. Place \`${e.outputPath}\` at your repo root (or the path your tooling expects).
12
-
13
- 2. Point DESIGN.md-aware tools (agents, linters, generators) at this file as the canonical design spec.
14
-
15
- 3. Keep \`${e.outputPath}\` in sync by re-running Razorwind generate when tokens or components change.
16
-
17
- ## Usage
18
-
19
- Reference token names, component rules, and layout guidance from \`${e.outputPath}\` when implementing UI. Regenerate rather than hand-editing generated sections.
20
- `}function s(e,t){let n=e.split(`.`).filter(Boolean);for(;n.length>1&&t.includes(n[0].toLowerCase());)n.shift();return n.join(`-`).replaceAll(/[^\w-]+/g,`-`).toLowerCase()}function c(e){if(typeof e==`number`||typeof e==`boolean`)return String(e);let t=String(e);return/^[a-z][\w-]*$/i.test(t)?t:JSON.stringify(t)}function l(e){return e.split(/[-_.]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var u=e.t({default:()=>F,extractDesignMd:()=>D,generateDesignMd:()=>P,renderDesignMd:()=>N,renderInstallMd:()=>o,selectPrimaryTheme:()=>b});const d=new Set([`backgroundColor`,`textColor`,`typography`,`rounded`,`padding`,`size`,`height`,`width`]),f={background:`backgroundColor`,backgroundcolor:`backgroundColor`,bg:`backgroundColor`,fill:`backgroundColor`,color:`textColor`,foreground:`textColor`,text:`textColor`,textcolor:`textColor`,font:`typography`,radius:`rounded`,borderradius:`rounded`,corner:`rounded`},p=[`color`,`colors`,`palette`],m=[`typography`,`type`,`text`,`font`,`fonts`],h=/(?:^|\.)(?:radius|radii|rounded|corner)(?:\.|$)/i,g=/(?:^|\.)(?:spacing|space|gap)(?:\.|$)/i,_=/^components?$/i,v=/^\{([^}]+)\}$/,y=[`fontFamily`,`fontSize`,`fontWeight`,`lineHeight`,`letterSpacing`];function b(e){let t=[...new Set(e.map(e=>e.theme))],n=t.find(e=>e===void 0)??t.find(e=>/^light/i.test(e??``))??t.find(e=>/^(?:default|base)/i.test(e??``))??t[0];return e.filter(e=>e.theme===n)}function x(e){if(typeof e==`string`)return v.exec(e.trim())?.[1]}function S(e,t){let n=e;for(let e=0;e<8;e++){let e=x(n.value);if(!e)return n;let r=t.get(e);if(!r)return n;n=r}return n}function C(e){return e.split(/[-_.\s]+/).filter(Boolean).map((e,t)=>t===0?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``)}function w(e){let t=C(e);return d.has(t)?t:f[t.toLowerCase()]}function T(e,t){let i={};if(!(0,n.isObject)(e))return i;for(let n of y){let a=e[n];if(a==null)continue;let o=x(a),s=o?t.get(o):void 0,c=s?S(s,t).cssValue:void 0;if(typeof a==`number`){i[n]=n===`fontWeight`||n===`lineHeight`?a:(0,r.formatTokenValue)(a);continue}i[n]=c??(0,r.formatTokenValue)(a)}return i}function E(e,t){return{...e,...t.name!==void 0&&{name:t.name},...t.description!==void 0&&{description:t.description},...t.version!==void 0&&{version:t.version}}}function D(e){let t=b(a(e.tokens)),n=new Map(t.map(e=>[e.path,e])),i=(0,r.resolveSchemaIdentity)(e),o={...i.title||i.name?{name:i.title??i.name}:{},...i.description?{description:i.description}:{},colors:{},colorDescriptions:{},typography:{},rounded:{},spacing:{},components:{}},c=new Map,l=[];for(let e of t){let t=e.path.split(`.`);if(t[0]&&_.test(t[0])){l.push(e);continue}if(e.type===`color`){let t=s(e.path,p),r=S(e,n);o.colors[t]=r.cssValue,e.description&&(o.colorDescriptions[t]=e.description),c.set(e.path,`colors.${t}`);continue}if(e.type===`typography`){let t=s(e.path,m);o.typography[t]=T(e.value,n),c.set(e.path,`typography.${t}`);continue}if(e.type===`fontFamily`){let t=s(e.path,m);o.typography[t]??={},o.typography[t].fontFamily=e.cssValue,c.set(e.path,`typography.${t}`);continue}let r=e.type===`dimension`||e.type===`number`||typeof e.value==`number`;if(r&&h.test(e.path)){let r=t.at(-1);o.rounded[r]=S(e,n).cssValue,c.set(e.path,`rounded.${r}`);continue}if(r&&g.test(e.path)){let r=t.at(-1);o.spacing[r]=S(e,n).cssValue,c.set(e.path,`spacing.${r}`)}}for(let e of l){let t=e.path.split(`.`).slice(1);if(t.length<2)continue;let r=w(t.at(-1));if(!r)continue;let i=t.slice(0,-1).join(`-`).replaceAll(/[^\w-]+/g,`-`).toLowerCase(),a=x(e.value),s=a?c.get(a):void 0,l=s?`{${s}}`:S(e,n).cssValue;o.components[i]??={},o.components[i][r]=l}return o}function O(e,t,n){let r=Object.entries(t);if(r.length!==0){n.push(`${e}:`);for(let[e,t]of r){if(typeof t==`object`&&t){n.push(` ${e}:`);for(let[e,r]of Object.entries(t))n.push(` ${e}: ${c(r)}`);continue}n.push(` ${e}: ${c(t)}`)}}}function k(e){let t=[`---`];return e.version&&t.push(`version: ${c(e.version)}`),t.push(`name: ${c(e.name)}`),e.description&&t.push(`description: ${c(e.description)}`),O(`colors`,e.colors,t),O(`typography`,e.typography,t),O(`rounded`,e.rounded,t),O(`spacing`,e.spacing,t),O(`components`,e.components,t),t.push(`---`),`${t.join(`
21
- `)}\n`}function A(e,...t){return`## ${e}\n\n${t.filter(Boolean).join(`
22
- `)}\n`}function j(e){let t=[[Object.keys(e.colors).length,`color`],[Object.keys(e.typography).length,`typography`],[Object.keys(e.rounded).length,`shape`],[Object.keys(e.spacing).length,`spacing`],[Object.keys(e.components).length,`component`]].filter(([e])=>e>0).map(([e,t])=>`${e} ${t} token${e===1?``:`s`}`).join(`, `);return`${e.name} design tokens${t?` — ${t}`:``}. The YAML front matter above is the normative source; the prose below explains how to apply it.`}function M(e,t={}){let n=[A(`Overview`,t.overview??j(e))],r=Object.entries(e.colors);r.length>0&&n.push(A(`Colors`,r.map(([t,n])=>{let r=e.colorDescriptions[t];return`- **${l(t)} (${n}):**${r?` ${r}`:``}`}).join(`
23
- `)));let i=Object.entries(e.typography);i.length>0&&n.push(A(`Typography`,i.map(([e,t])=>`- **${e}:** ${Object.entries(t).map(([e,t])=>`${e}: ${t}`).join(`, `)}`).join(`
24
- `)));let a=Object.entries(e.spacing);a.length>0&&n.push(A(`Layout`,`Spacing scale:`,``,a.map(([e,t])=>`- **${e}:** ${t}`).join(`
25
- `)));let o=Object.entries(e.rounded);o.length>0&&n.push(A(`Shapes`,`Corner radius scale:`,``,o.map(([e,t])=>`- **${e}:** ${t}`).join(`
26
- `)));let s=Object.entries(e.components);return s.length>0&&n.push(A(`Components`,s.map(([e,t])=>`- **${e}:** ${Object.entries(t).map(([e,t])=>`${e}: \`${t}\``).join(`, `)}`).join(`
27
- `))),n.join(`
28
- `)}function N(e,t={}){return`${k(e)}\n${M(e,t)}`}function P(e,t={}){let n=E(D(e),t),r=t.outputPath??`DESIGN.md`,a=N(n,t),s=t.installGuide??o({outputPath:r,name:t.name??n.name}),c=(0,i.join)((0,i.dirname)(r),`INSTALL.md`);return{[r]:{path:r,language:`markdown`,chunks:[{content:a,meta:{name:`razorwind-design-md`}}]},[c]:{path:c,language:`markdown`,chunks:[{content:s,meta:{name:`razorwind-design-md`}}]}}}var F=(0,t.definePlugin)(e=>({name:`design-md:generate`,generate:async t=>P(t,e??{})}));Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return D}});
@@ -1,29 +0,0 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.mjs";import{definePlugin as t}from"@razorwind/core/plugin";import{isObject as n}from"@stryke/type-checks/is-object";import{flattenTokens as r,formatTokenValue as i,resolveSchemaIdentity as a}from"@razorwind/core/utils";import{dirname as o,join as s}from"node:path";function c(e,t){return r(e,{includeTypes:t})}function l(e){return`# Installing ${e.name??`Razorwind Design System`} (DESIGN.md)
2
-
3
- Generated by \`@razorwind/design-md\`.
4
-
5
- ## Files
6
-
7
- - \`${e.outputPath}\` — DESIGN.md design-system specification
8
-
9
- ## Setup
10
-
11
- 1. Place \`${e.outputPath}\` at your repo root (or the path your tooling expects).
12
-
13
- 2. Point DESIGN.md-aware tools (agents, linters, generators) at this file as the canonical design spec.
14
-
15
- 3. Keep \`${e.outputPath}\` in sync by re-running Razorwind generate when tokens or components change.
16
-
17
- ## Usage
18
-
19
- Reference token names, component rules, and layout guidance from \`${e.outputPath}\` when implementing UI. Regenerate rather than hand-editing generated sections.
20
- `}function u(e,t){let n=e.split(`.`).filter(Boolean);for(;n.length>1&&t.includes(n[0].toLowerCase());)n.shift();return n.join(`-`).replaceAll(/[^\w-]+/g,`-`).toLowerCase()}function d(e){if(typeof e==`number`||typeof e==`boolean`)return String(e);let t=String(e);return/^[a-z][\w-]*$/i.test(t)?t:JSON.stringify(t)}function f(e){return e.split(/[-_.]+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}var p=e({default:()=>R,extractDesignMd:()=>A,generateDesignMd:()=>L,renderDesignMd:()=>I,renderInstallMd:()=>l,selectPrimaryTheme:()=>C});const m=new Set([`backgroundColor`,`textColor`,`typography`,`rounded`,`padding`,`size`,`height`,`width`]),h={background:`backgroundColor`,backgroundcolor:`backgroundColor`,bg:`backgroundColor`,fill:`backgroundColor`,color:`textColor`,foreground:`textColor`,text:`textColor`,textcolor:`textColor`,font:`typography`,radius:`rounded`,borderradius:`rounded`,corner:`rounded`},g=[`color`,`colors`,`palette`],_=[`typography`,`type`,`text`,`font`,`fonts`],v=/(?:^|\.)(?:radius|radii|rounded|corner)(?:\.|$)/i,y=/(?:^|\.)(?:spacing|space|gap)(?:\.|$)/i,b=/^components?$/i,x=/^\{([^}]+)\}$/,S=[`fontFamily`,`fontSize`,`fontWeight`,`lineHeight`,`letterSpacing`];function C(e){let t=[...new Set(e.map(e=>e.theme))],n=t.find(e=>e===void 0)??t.find(e=>/^light/i.test(e??``))??t.find(e=>/^(?:default|base)/i.test(e??``))??t[0];return e.filter(e=>e.theme===n)}function w(e){if(typeof e==`string`)return x.exec(e.trim())?.[1]}function T(e,t){let n=e;for(let e=0;e<8;e++){let e=w(n.value);if(!e)return n;let r=t.get(e);if(!r)return n;n=r}return n}function E(e){return e.split(/[-_.\s]+/).filter(Boolean).map((e,t)=>t===0?e.toLowerCase():e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(``)}function D(e){let t=E(e);return m.has(t)?t:h[t.toLowerCase()]}function O(e,t){let r={};if(!n(e))return r;for(let n of S){let a=e[n];if(a==null)continue;let o=w(a),s=o?t.get(o):void 0,c=s?T(s,t).cssValue:void 0;if(typeof a==`number`){r[n]=n===`fontWeight`||n===`lineHeight`?a:i(a);continue}r[n]=c??i(a)}return r}function k(e,t){return{...e,...t.name!==void 0&&{name:t.name},...t.description!==void 0&&{description:t.description},...t.version!==void 0&&{version:t.version}}}function A(e){let t=C(c(e.tokens)),n=new Map(t.map(e=>[e.path,e])),r=a(e),i={...r.title||r.name?{name:r.title??r.name}:{},...r.description?{description:r.description}:{},colors:{},colorDescriptions:{},typography:{},rounded:{},spacing:{},components:{}},o=new Map,s=[];for(let e of t){let t=e.path.split(`.`);if(t[0]&&b.test(t[0])){s.push(e);continue}if(e.type===`color`){let t=u(e.path,g),r=T(e,n);i.colors[t]=r.cssValue,e.description&&(i.colorDescriptions[t]=e.description),o.set(e.path,`colors.${t}`);continue}if(e.type===`typography`){let t=u(e.path,_);i.typography[t]=O(e.value,n),o.set(e.path,`typography.${t}`);continue}if(e.type===`fontFamily`){let t=u(e.path,_);i.typography[t]??={},i.typography[t].fontFamily=e.cssValue,o.set(e.path,`typography.${t}`);continue}let r=e.type===`dimension`||e.type===`number`||typeof e.value==`number`;if(r&&v.test(e.path)){let r=t.at(-1);i.rounded[r]=T(e,n).cssValue,o.set(e.path,`rounded.${r}`);continue}if(r&&y.test(e.path)){let r=t.at(-1);i.spacing[r]=T(e,n).cssValue,o.set(e.path,`spacing.${r}`)}}for(let e of s){let t=e.path.split(`.`).slice(1);if(t.length<2)continue;let r=D(t.at(-1));if(!r)continue;let a=t.slice(0,-1).join(`-`).replaceAll(/[^\w-]+/g,`-`).toLowerCase(),s=w(e.value),c=s?o.get(s):void 0,l=c?`{${c}}`:T(e,n).cssValue;i.components[a]??={},i.components[a][r]=l}return i}function j(e,t,n){let r=Object.entries(t);if(r.length!==0){n.push(`${e}:`);for(let[e,t]of r){if(typeof t==`object`&&t){n.push(` ${e}:`);for(let[e,r]of Object.entries(t))n.push(` ${e}: ${d(r)}`);continue}n.push(` ${e}: ${d(t)}`)}}}function M(e){let t=[`---`];return e.version&&t.push(`version: ${d(e.version)}`),t.push(`name: ${d(e.name)}`),e.description&&t.push(`description: ${d(e.description)}`),j(`colors`,e.colors,t),j(`typography`,e.typography,t),j(`rounded`,e.rounded,t),j(`spacing`,e.spacing,t),j(`components`,e.components,t),t.push(`---`),`${t.join(`
21
- `)}\n`}function N(e,...t){return`## ${e}\n\n${t.filter(Boolean).join(`
22
- `)}\n`}function P(e){let t=[[Object.keys(e.colors).length,`color`],[Object.keys(e.typography).length,`typography`],[Object.keys(e.rounded).length,`shape`],[Object.keys(e.spacing).length,`spacing`],[Object.keys(e.components).length,`component`]].filter(([e])=>e>0).map(([e,t])=>`${e} ${t} token${e===1?``:`s`}`).join(`, `);return`${e.name} design tokens${t?` — ${t}`:``}. The YAML front matter above is the normative source; the prose below explains how to apply it.`}function F(e,t={}){let n=[N(`Overview`,t.overview??P(e))],r=Object.entries(e.colors);r.length>0&&n.push(N(`Colors`,r.map(([t,n])=>{let r=e.colorDescriptions[t];return`- **${f(t)} (${n}):**${r?` ${r}`:``}`}).join(`
23
- `)));let i=Object.entries(e.typography);i.length>0&&n.push(N(`Typography`,i.map(([e,t])=>`- **${e}:** ${Object.entries(t).map(([e,t])=>`${e}: ${t}`).join(`, `)}`).join(`
24
- `)));let a=Object.entries(e.spacing);a.length>0&&n.push(N(`Layout`,`Spacing scale:`,``,a.map(([e,t])=>`- **${e}:** ${t}`).join(`
25
- `)));let o=Object.entries(e.rounded);o.length>0&&n.push(N(`Shapes`,`Corner radius scale:`,``,o.map(([e,t])=>`- **${e}:** ${t}`).join(`
26
- `)));let s=Object.entries(e.components);return s.length>0&&n.push(N(`Components`,s.map(([e,t])=>`- **${e}:** ${Object.entries(t).map(([e,t])=>`${e}: \`${t}\``).join(`, `)}`).join(`
27
- `))),n.join(`
28
- `)}function I(e,t={}){return`${M(e)}\n${F(e,t)}`}function L(e,t={}){let n=k(A(e),t),r=t.outputPath??`DESIGN.md`,i=I(n,t),a=t.installGuide??l({outputPath:r,name:t.name??n.name}),c=s(o(r),`INSTALL.md`);return{[r]:{path:r,language:`markdown`,chunks:[{content:i,meta:{name:`razorwind-design-md`}}]},[c]:{path:c,language:`markdown`,chunks:[{content:a,meta:{name:`razorwind-design-md`}}]}}}var R=t(e=>({name:`design-md:generate`,generate:async t=>L(t,e??{})}));export{I as a,p as i,L as n,C as o,R as r,l as s,A as t};
29
- //# sourceMappingURL=generate-q-vbYaCP.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate-q-vbYaCP.mjs","names":[],"sources":[],"mappings":""}