@razorwind/design-md 0.0.48 → 0.0.49
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/extract.d.cts +1 -1
- package/dist/extract.d.mts +1 -1
- package/dist/{generate-DYuHhQcQ.d.cts → generate-Cc5TpO46.d.cts} +2 -2
- package/dist/generate-Cc5TpO46.d.cts.map +1 -0
- package/dist/{generate-DHLrMD5g.d.mts → generate-DXmXS53P.d.mts} +2 -2
- package/dist/generate-DXmXS53P.d.mts.map +1 -0
- package/dist/{generate-NaC6MBGt.cjs → generate-P_Pz4ABf.cjs} +2 -2
- package/dist/{generate-CW_Snubi.mjs → generate-XnAk-wWP.mjs} +3 -3
- package/dist/generate-XnAk-wWP.mjs.map +1 -0
- package/dist/generate.cjs +1 -1
- package/dist/generate.d.cts +1 -1
- package/dist/generate.d.mts +1 -1
- package/dist/generate.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{types-B8UoL9-h.d.mts → types-Dytdpn6d.d.mts} +2 -2
- package/dist/types-Dytdpn6d.d.mts.map +1 -0
- package/dist/{types-DBJXb23_.d.cts → types-I1sC5VJa.d.cts} +2 -2
- package/dist/{types-DBJXb23_.d.cts.map → types-I1sC5VJa.d.cts.map} +1 -1
- package/package.json +3 -3
- package/dist/generate-CW_Snubi.mjs.map +0 -1
- package/dist/generate-DHLrMD5g.d.mts.map +0 -1
- package/dist/generate-DYuHhQcQ.d.cts.map +0 -1
- package/dist/types-B8UoL9-h.d.mts.map +0 -1
package/dist/extract.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __exportAll, n as DesignMdExtractPluginOptions } from "./types-
|
|
1
|
+
import { a as __exportAll, n as DesignMdExtractPluginOptions } from "./types-I1sC5VJa.cjs";
|
|
2
2
|
import { DesignTokens } from "style-dictionary/types";
|
|
3
3
|
declare namespace extract_d_exports {
|
|
4
4
|
export { DESIGN_MD_FILE_PATTERN, DESIGN_MD_PATH_CANDIDATES, _default as default, designMdToTokens, extractDesignMdFrontMatter, isDesignMdFile, loadDesignMdTokens, parseDesignMdTokens, resolveDesignMdPath };
|
package/dist/extract.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as DesignMdExtractPluginOptions } from "./types-
|
|
1
|
+
import { n as DesignMdExtractPluginOptions } from "./types-Dytdpn6d.mjs";
|
|
2
2
|
import { DesignTokens } from "style-dictionary/types";
|
|
3
3
|
declare namespace extract_d_exports {
|
|
4
4
|
export { DESIGN_MD_FILE_PATTERN, DESIGN_MD_PATH_CANDIDATES, _default as default, designMdToTokens, extractDesignMdFrontMatter, isDesignMdFile, loadDesignMdTokens, parseDesignMdTokens, resolveDesignMdPath };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __exportAll, i as FlatToken, r as DesignMdGeneratePluginOptions, t as DesignMdDocument } from "./types-
|
|
1
|
+
import { a as __exportAll, i as FlatToken, r as DesignMdGeneratePluginOptions, t as DesignMdDocument } from "./types-I1sC5VJa.cjs";
|
|
2
2
|
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
3
3
|
import { Schema } from "@razorwind/core/schema";
|
|
4
4
|
//#region src/install.d.ts
|
|
@@ -61,4 +61,4 @@ declare function generateDesignMd(spec: Schema, options?: DesignMdGeneratePlugin
|
|
|
61
61
|
declare const _default: (options?: DesignMdGeneratePluginOptions | undefined) => import("@razorwind/core").Plugin;
|
|
62
62
|
//#endregion
|
|
63
63
|
export { renderDesignMd as a, generate_d_exports as i, extractDesignMd as n, selectPrimaryTheme as o, generateDesignMd as r, renderInstallMd as s, _default as t };
|
|
64
|
-
//# sourceMappingURL=generate-
|
|
64
|
+
//# sourceMappingURL=generate-Cc5TpO46.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-Cc5TpO46.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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as FlatToken, r as DesignMdGeneratePluginOptions, t as DesignMdDocument } from "./types-
|
|
1
|
+
import { i as FlatToken, r as DesignMdGeneratePluginOptions, t as DesignMdDocument } from "./types-Dytdpn6d.mjs";
|
|
2
2
|
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
3
3
|
import { Schema } from "@razorwind/core/schema";
|
|
4
4
|
//#region src/install.d.ts
|
|
@@ -61,4 +61,4 @@ declare function generateDesignMd(spec: Schema, options?: DesignMdGeneratePlugin
|
|
|
61
61
|
declare const _default: (options?: DesignMdGeneratePluginOptions | undefined) => import("@razorwind/core").Plugin;
|
|
62
62
|
//#endregion
|
|
63
63
|
export { renderDesignMd as a, generate_d_exports as i, extractDesignMd as n, selectPrimaryTheme as o, generateDesignMd as r, renderInstallMd as s, _default as t };
|
|
64
|
-
//# sourceMappingURL=generate-
|
|
64
|
+
//# sourceMappingURL=generate-DXmXS53P.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-DXmXS53P.d.mts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":""}
|
|
@@ -17,7 +17,7 @@ Generated by \`@razorwind/design-md\`.
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
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`&&!e.
|
|
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.filter(e=>!e.primitive)){let t=e.path.split(`.`);if(t[0]&&_.test(t[0])){l.push(e);continue}if(e.type===`color`&&!e.primitive){let t=s(e.path,p),r=S(e,n);r.primitive||(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
21
|
`)}\n`}function A(e,...t){return`## ${e}\n\n${t.filter(Boolean).join(`
|
|
22
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
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(`
|
|
@@ -25,4 +25,4 @@ Reference token names, component rules, and layout guidance from \`${e.outputPat
|
|
|
25
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
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
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}});
|
|
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`,themeGeneration:`combined`,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}});
|
|
@@ -17,7 +17,7 @@ Generated by \`@razorwind/design-md\`.
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
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`&&!e.
|
|
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.filter(e=>!e.primitive)){let t=e.path.split(`.`);if(t[0]&&b.test(t[0])){s.push(e);continue}if(e.type===`color`&&!e.primitive){let t=u(e.path,g),r=T(e,n);r.primitive||(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
21
|
`)}\n`}function N(e,...t){return`## ${e}\n\n${t.filter(Boolean).join(`
|
|
22
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
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(`
|
|
@@ -25,5 +25,5 @@ Reference token names, component rules, and layout guidance from \`${e.outputPat
|
|
|
25
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
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
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-
|
|
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`,themeGeneration:`combined`,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-XnAk-wWP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-XnAk-wWP.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/generate.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./generate-
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("./generate-P_Pz4ABf.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.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as renderDesignMd, n as extractDesignMd, o as selectPrimaryTheme, r as generateDesignMd, s as renderInstallMd, t as _default } from "./generate-
|
|
1
|
+
import { a as renderDesignMd, n as extractDesignMd, o as selectPrimaryTheme, r as generateDesignMd, s as renderInstallMd, t as _default } from "./generate-Cc5TpO46.cjs";
|
|
2
2
|
export { _default as default, extractDesignMd, generateDesignMd, renderDesignMd, renderInstallMd, selectPrimaryTheme };
|
package/dist/generate.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as renderDesignMd, n as extractDesignMd, o as selectPrimaryTheme, r as generateDesignMd, s as renderInstallMd, t as _default } from "./generate-
|
|
1
|
+
import { a as renderDesignMd, n as extractDesignMd, o as selectPrimaryTheme, r as generateDesignMd, s as renderInstallMd, t as _default } from "./generate-DXmXS53P.mjs";
|
|
2
2
|
export { _default as default, extractDesignMd, generateDesignMd, renderDesignMd, renderInstallMd, selectPrimaryTheme };
|
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-
|
|
1
|
+
import{a as e,n as t,o as n,r,s as i,t as a}from"./generate-XnAk-wWP.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-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./extract.cjs"),t=require("./generate-P_Pz4ABf.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.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./extract.mjs";import{i as t}from"./generate-
|
|
1
|
+
import{t as e}from"./extract.mjs";import{i as t}from"./generate-XnAk-wWP.mjs";export{e as extract,t as generate};
|
|
@@ -59,7 +59,7 @@ interface FlatToken {
|
|
|
59
59
|
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
60
60
|
theme?: string;
|
|
61
61
|
/** Whether the token is part of a palette primitive. */
|
|
62
|
-
|
|
62
|
+
primitive?: boolean;
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
65
65
|
* A DESIGN.md typography token
|
|
@@ -96,4 +96,4 @@ interface DesignMdDocument {
|
|
|
96
96
|
}
|
|
97
97
|
//#endregion
|
|
98
98
|
export { FlatToken as i, DesignMdExtractPluginOptions as n, DesignMdGeneratePluginOptions as r, DesignMdDocument as t };
|
|
99
|
-
//# sourceMappingURL=types-
|
|
99
|
+
//# sourceMappingURL=types-Dytdpn6d.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-Dytdpn6d.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
|
|
@@ -60,7 +60,7 @@ interface FlatToken {
|
|
|
60
60
|
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
61
61
|
theme?: string;
|
|
62
62
|
/** Whether the token is part of a palette primitive. */
|
|
63
|
-
|
|
63
|
+
primitive?: boolean;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* A DESIGN.md typography token
|
|
@@ -97,4 +97,4 @@ interface DesignMdDocument {
|
|
|
97
97
|
}
|
|
98
98
|
//#endregion
|
|
99
99
|
export { __exportAll as a, FlatToken as i, DesignMdExtractPluginOptions as n, DesignMdGeneratePluginOptions as r, DesignMdDocument as t };
|
|
100
|
-
//# sourceMappingURL=types-
|
|
100
|
+
//# sourceMappingURL=types-I1sC5VJa.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types-
|
|
1
|
+
{"version":3,"file":"types-I1sC5VJa.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;UAoBiB;;;;;;EAMf;;UAGe;;;;;;EAMf;;;;;;EAOA;;;;EAKA;;;;;;EAOA;;;;;EAMA;;;;;EAMA;;;;;UAMe;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;UAOe;EACf;EACA;EACA;EACA;EACA;;;;;;;KAQU,iBAAiB;;;;;UAMZ;EACf;EACA;EACA;EACA,QAAQ;;EAER,mBAAmB;EACnB,YAAY,eAAe;EAC3B,SAAS;EACT,SAAS;EACT,YAAY,eAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorwind/design-md",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.49",
|
|
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.
|
|
83
|
+
"@razorwind/core": "^0.0.53",
|
|
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": "
|
|
96
|
+
"gitHead": "715b431b64aad787ba61ad7ed70c8633869460f0"
|
|
97
97
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-CW_Snubi.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-DHLrMD5g.d.mts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-DYuHhQcQ.d.cts","names":[],"sources":["../src/install.ts","../src/generate.ts"],"mappings":";;;;;;;;;iBAuBgB,gBAAgB;EAC9B;EACA;;;;;;;;;;iBC8Dc,mBAAmB,MAAM,cAAc;;;;;;;;;iBA+HvC,gBAAgB,MAAM,SAAS;;;;;;;iBA2R/B,eACd,UAAU,kBACV,UAAS;;;;;;;iBAaK,iBACd,MAAM,QACN,UAAS,gCACR,wBAAwB,QAAQ"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types-B8UoL9-h.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
|