@razorwind/stylelint 0.0.2
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/LICENSE +201 -0
- package/README.md +372 -0
- package/dist/index.cjs +75 -0
- package/dist/index.d.cts +54 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +54 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +76 -0
- package/dist/index.mjs.map +1 -0
- package/dist/runtime-CZCP4myF.mjs +2 -0
- package/dist/runtime-CZCP4myF.mjs.map +1 -0
- package/dist/runtime-D4YzdLS9.cjs +1 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.d.cts +89 -0
- package/dist/runtime.d.cts.map +1 -0
- package/dist/runtime.d.mts +89 -0
- package/dist/runtime.d.mts.map +1 -0
- package/dist/runtime.mjs +1 -0
- package/dist/types-DdjS21Bx.d.cts +136 -0
- package/dist/types-DdjS21Bx.d.cts.map +1 -0
- package/dist/types-DdjS21Bx.d.mts +136 -0
- package/dist/types-DdjS21Bx.d.mts.map +1 -0
- package/package.json +97 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { a as DesignSystemRuleId, c as ManifestComponent, d as StylelintPluginOptions, f as TokenCategory, i as DesignSystemOptions, l as ManifestFont, n as CoreRuleId, o as DesignSystemSeverity, p as TokenUsageDomains, r as DesignSystemManifest, s as FallbackUsage, t as ComponentRole, u as ManifestToken } from "./types-DdjS21Bx.cjs";
|
|
2
|
+
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
3
|
+
import { Schema } from "@razorwind/core/schema";
|
|
4
|
+
import { DEFAULT_PREFIX } from "@razorwind/eslint";
|
|
5
|
+
//#region src/manifest.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Build the design-system manifest the generated Stylelint module
|
|
8
|
+
* serializes: the schema's tokens, components and fonts, plus the Tailwind
|
|
9
|
+
* guardrail theme when that integration is enabled. Tokens are collected
|
|
10
|
+
* exactly as `\@razorwind/eslint` collects them, so both linters agree on
|
|
11
|
+
* CSS variable names, categories and deprecations.
|
|
12
|
+
*/
|
|
13
|
+
declare function buildManifest(spec: Schema, options?: StylelintPluginOptions): DesignSystemManifest;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/index.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* Render the Stylelint plugin module that binds the design-system runtime to
|
|
18
|
+
* the schema-derived manifest.
|
|
19
|
+
*/
|
|
20
|
+
declare function renderStylelintPlugin(manifest: DesignSystemManifest, options?: Pick<StylelintPluginOptions, "runtimeImport">): string;
|
|
21
|
+
/**
|
|
22
|
+
* Build the Stylelint INSTALL.md for the generated plugin module, listing
|
|
23
|
+
* every rule with the default severity the schema gives it.
|
|
24
|
+
*/
|
|
25
|
+
declare function renderStylelintInstallMd(options: {
|
|
26
|
+
stylelintPath: string;
|
|
27
|
+
manifest: DesignSystemManifest;
|
|
28
|
+
}): string;
|
|
29
|
+
/**
|
|
30
|
+
* Generate a Stylelint plugin whose rules are derived from the schema's
|
|
31
|
+
* design tokens, components and fonts.
|
|
32
|
+
*/
|
|
33
|
+
declare function generateStylelintPlugin(spec: Schema, options?: StylelintPluginOptions): Promise<GeneratorFunctionResult<Schema, StylelintPluginOptions>>;
|
|
34
|
+
/**
|
|
35
|
+
* Razorwind plugin: generate a Stylelint plugin that keeps stylesheets
|
|
36
|
+
* aligned with the design system. It ports the
|
|
37
|
+
* `\@atlaskit/stylelint-design-system` rules onto the schema's own tokens,
|
|
38
|
+
* adds the `\@razorwind/eslint` rules that apply to stylesheets, and bundles
|
|
39
|
+
* the `\@razorwind/tailwindcss` guardrails.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { defineConfig } from "@razorwind/core";
|
|
44
|
+
* import stylelint from "@razorwind/stylelint";
|
|
45
|
+
*
|
|
46
|
+
* export default defineConfig({
|
|
47
|
+
* plugins: [stylelint({ prefix: "acme" })]
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare const _default: (options?: StylelintPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { type ComponentRole, type CoreRuleId, DEFAULT_PREFIX, type DesignSystemManifest, type DesignSystemOptions, type DesignSystemRuleId, type DesignSystemSeverity, type FallbackUsage, type ManifestComponent, type ManifestFont, type ManifestToken, type StylelintPluginOptions, type TokenCategory, type TokenUsageDomains, buildManifest, _default as default, generateStylelintPlugin, renderStylelintInstallMd, renderStylelintPlugin };
|
|
54
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/manifest.ts","../src/index.ts"],"mappings":";;;;;;;;;;;;iBAsDgB,cACd,MAAM,QACN,UAAS,yBACR;;;;;;;iBCFa,sBACd,UAAU,sBACV,UAAS,KAAK;;;;;iBA6BA,yBAAyB;EACvC;EACA,UAAU;;;;;;iBA+EU,wBACpB,MAAM,QACN,UAAS,yBACR,QAAQ,wBAAwB,QAAQ"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { a as DesignSystemRuleId, c as ManifestComponent, d as StylelintPluginOptions, f as TokenCategory, i as DesignSystemOptions, l as ManifestFont, n as CoreRuleId, o as DesignSystemSeverity, p as TokenUsageDomains, r as DesignSystemManifest, s as FallbackUsage, t as ComponentRole, u as ManifestToken } from "./types-DdjS21Bx.mjs";
|
|
2
|
+
import { DEFAULT_PREFIX } from "@razorwind/eslint";
|
|
3
|
+
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
4
|
+
import { Schema } from "@razorwind/core/schema";
|
|
5
|
+
//#region src/manifest.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Build the design-system manifest the generated Stylelint module
|
|
8
|
+
* serializes: the schema's tokens, components and fonts, plus the Tailwind
|
|
9
|
+
* guardrail theme when that integration is enabled. Tokens are collected
|
|
10
|
+
* exactly as `\@razorwind/eslint` collects them, so both linters agree on
|
|
11
|
+
* CSS variable names, categories and deprecations.
|
|
12
|
+
*/
|
|
13
|
+
declare function buildManifest(spec: Schema, options?: StylelintPluginOptions): DesignSystemManifest;
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/index.d.ts
|
|
16
|
+
/**
|
|
17
|
+
* Render the Stylelint plugin module that binds the design-system runtime to
|
|
18
|
+
* the schema-derived manifest.
|
|
19
|
+
*/
|
|
20
|
+
declare function renderStylelintPlugin(manifest: DesignSystemManifest, options?: Pick<StylelintPluginOptions, "runtimeImport">): string;
|
|
21
|
+
/**
|
|
22
|
+
* Build the Stylelint INSTALL.md for the generated plugin module, listing
|
|
23
|
+
* every rule with the default severity the schema gives it.
|
|
24
|
+
*/
|
|
25
|
+
declare function renderStylelintInstallMd(options: {
|
|
26
|
+
stylelintPath: string;
|
|
27
|
+
manifest: DesignSystemManifest;
|
|
28
|
+
}): string;
|
|
29
|
+
/**
|
|
30
|
+
* Generate a Stylelint plugin whose rules are derived from the schema's
|
|
31
|
+
* design tokens, components and fonts.
|
|
32
|
+
*/
|
|
33
|
+
declare function generateStylelintPlugin(spec: Schema, options?: StylelintPluginOptions): Promise<GeneratorFunctionResult<Schema, StylelintPluginOptions>>;
|
|
34
|
+
/**
|
|
35
|
+
* Razorwind plugin: generate a Stylelint plugin that keeps stylesheets
|
|
36
|
+
* aligned with the design system. It ports the
|
|
37
|
+
* `\@atlaskit/stylelint-design-system` rules onto the schema's own tokens,
|
|
38
|
+
* adds the `\@razorwind/eslint` rules that apply to stylesheets, and bundles
|
|
39
|
+
* the `\@razorwind/tailwindcss` guardrails.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* import { defineConfig } from "@razorwind/core";
|
|
44
|
+
* import stylelint from "@razorwind/stylelint";
|
|
45
|
+
*
|
|
46
|
+
* export default defineConfig({
|
|
47
|
+
* plugins: [stylelint({ prefix: "acme" })]
|
|
48
|
+
* });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare const _default: (options?: StylelintPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { type ComponentRole, type CoreRuleId, DEFAULT_PREFIX, type DesignSystemManifest, type DesignSystemOptions, type DesignSystemRuleId, type DesignSystemSeverity, type FallbackUsage, type ManifestComponent, type ManifestFont, type ManifestToken, type StylelintPluginOptions, type TokenCategory, type TokenUsageDomains, buildManifest, _default as default, generateStylelintPlugin, renderStylelintInstallMd, renderStylelintPlugin };
|
|
54
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/manifest.ts","../src/index.ts"],"mappings":""}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import{t as e}from"./runtime-CZCP4myF.mjs";import{definePlugin as t}from"@razorwind/core/plugin";import{createDocument as n,cssVarPrefixFromName as r,resolveTokenSets as i}from"@razorwind/core/utils";import{dirname as a,join as o}from"node:path";import{DEFAULT_PREFIX as s,collectManifestComponents as c,collectManifestTokens as l}from"@razorwind/eslint";import{flattenThemeTokens as u}from"@razorwind/tailwindcss/generate";import{buildGuardrailTheme as d}from"@razorwind/tailwindcss/stylelint";function f(e){return Object.values(e??{}).map(e=>({family:e.family??e.title??e.name,...e.role?{role:e.role}:{}}))}function p(e){return!!e&&i(e).length>0}function m(e,t={}){let n=t.prefix??s,a=t.cssVarPrefix===!1?void 0:t.cssVarPrefix??r(e.name),o={name:e.name??s,version:`0.0.0`,prefix:n,...a?{cssVarPrefix:a}:{},themes:p(e.tokens)?i(e.tokens).map(e=>e.id).filter(e=>e!=="default"):[],tokens:p(e.tokens)?l(e.tokens,a):[],components:c(e.components),fonts:f(e.fonts)},u=t.tailwind===!1?void 0:h(e,n);return u&&(o.tailwind=u),o}function h(e,t){let n=d(p(e.tokens)?u(e.tokens):[],{fonts:e.fonts,name:e.name,prefix:t});return Object.keys(n.namespaces).length>0?n:void 0}function g(e,t={}){let n=t.runtimeImport??`@razorwind/stylelint/runtime`;return`// Generated by @razorwind/stylelint. Do not edit by hand: re-run
|
|
2
|
+
// Razorwind generate when design tokens change.
|
|
3
|
+
//
|
|
4
|
+
// import designSystem from "./<path-to-this-file>";
|
|
5
|
+
// const { plugins, rules } = designSystem();
|
|
6
|
+
// export default { plugins: [...plugins], rules: { ...rules } };
|
|
7
|
+
|
|
8
|
+
import { createDesignSystemPlugin } from ${JSON.stringify(n)};
|
|
9
|
+
|
|
10
|
+
export const manifest = ${JSON.stringify(e,null,2)};
|
|
11
|
+
|
|
12
|
+
const designSystem = createDesignSystemPlugin(manifest);
|
|
13
|
+
|
|
14
|
+
export const plugins = designSystem.plugins;
|
|
15
|
+
export const rules = designSystem.rules;
|
|
16
|
+
export const defaultSeverity = designSystem.defaultSeverity;
|
|
17
|
+
|
|
18
|
+
export default designSystem.config;
|
|
19
|
+
`}function _(t){let{stylelintPath:n,manifest:r}=t,{rules:i,defaultSeverity:a}=e(r),o=Object.keys(i).map(e=>{let t=i[e];return`| \`${t.ruleName}\` | ${a[e]??`off`} | ${t.meta.description} |`}).join(`
|
|
20
|
+
`);return`# Installing the Stylelint Design-System Plugin
|
|
21
|
+
|
|
22
|
+
Generated by \`@razorwind/stylelint\` from ${[`${r.tokens.length} tokens`,`${r.components.length} components`,`${r.fonts.length} fonts`].join(`, `)}.
|
|
23
|
+
|
|
24
|
+
## Files
|
|
25
|
+
|
|
26
|
+
- \`${n}\` — Stylelint plugins whose rules are derived from the design system
|
|
27
|
+
|
|
28
|
+
## Setup
|
|
29
|
+
|
|
30
|
+
1. Install the runtime the generated module imports:
|
|
31
|
+
|
|
32
|
+
\`\`\`bash
|
|
33
|
+
pnpm add -D @razorwind/stylelint stylelint
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
2. Add the plugins and rules to \`stylelint.config.mjs\`:
|
|
37
|
+
|
|
38
|
+
\`\`\`js
|
|
39
|
+
import designSystem from "./${n}";
|
|
40
|
+
|
|
41
|
+
const { plugins, rules } = designSystem({
|
|
42
|
+
// Domains ensure-design-token-usage checks (colors and shadows by default).
|
|
43
|
+
tokenUsage: { color: true, spacing: true },
|
|
44
|
+
// "forced" requires var(--token, fallback), "none" forbids fallbacks.
|
|
45
|
+
fallbackUsage: "optional",
|
|
46
|
+
severity: { "no-physical-properties": "error" }
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export default {
|
|
50
|
+
plugins: [...plugins],
|
|
51
|
+
rules: { ...rules }
|
|
52
|
+
};
|
|
53
|
+
\`\`\`
|
|
54
|
+
|
|
55
|
+
Passing \`files\` moves the rules into an \`overrides\` entry for those globs.
|
|
56
|
+
|
|
57
|
+
3. Deliberate one-offs carry an inline, reviewable exception:
|
|
58
|
+
|
|
59
|
+
\`\`\`css
|
|
60
|
+
/* stylelint-disable-next-line ${r.prefix}/ensure-design-token-usage -- <reason> */
|
|
61
|
+
\`\`\`
|
|
62
|
+
|
|
63
|
+
## Rules
|
|
64
|
+
|
|
65
|
+
Token rules are enabled when the design system defines that token category.
|
|
66
|
+
Literals that match exactly one token's value are fixed by \`stylelint --fix\`.
|
|
67
|
+
|
|
68
|
+
| Rule | Default | Description |
|
|
69
|
+
| ---- | ------- | ----------- |
|
|
70
|
+
${o}
|
|
71
|
+
|
|
72
|
+
## Regenerate
|
|
73
|
+
|
|
74
|
+
Re-run Razorwind generate when the design system changes so \`${n}\` stays in sync.
|
|
75
|
+
`}async function v(e,t={}){let r=m(e,t);if(r.tokens.length===0&&r.components.length===0)return{};let i=t.stylelintPath??`stylelint/design-system/index.mjs`,s=o(a(i),`INSTALL.md`),c={name:`razorwind-stylelint`};return{[i]:n(i,g(r,t),c,void 0,`javascript`),[s]:n(s,t.installGuide??_({stylelintPath:i,manifest:r}),c,void 0,`markdown`)}}var y=t(e=>({name:`stylelint`,generate:async t=>v(t,e??{})}));export{s as DEFAULT_PREFIX,m as buildManifest,y as default,v as generateStylelintPlugin,_ as renderStylelintInstallMd,g as renderStylelintPlugin};
|
|
76
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["buildTailwindTheme","createDesignSystemPlugin","collectManifestFonts","fonts","font","hasTokens","tokens","resolveTokenSets","buildManifest","prefix","options","DEFAULT_PREFIX","cssVarPrefix","cssVarPrefixFromName","spec","manifest","set","id","collectManifestTokens","collectManifestComponents","tailwind","buildTailwind","theme","buildGuardrailTheme","flattenThemeTokens","renderStylelintPlugin","runtimeImport","renderStylelintInstallMd","rows","rules","rule","defaultSeverity","stylelintPath","generateStylelintPlugin","installPath","join","dirname","meta","createDocument","src_default","definePlugin"],"sources":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createGuardrails as e}from"@razorwind/tailwindcss/stylelint-runtime";let t;function n(){return t??=import(`stylelint`).then(e=>{let t=e;return(t.default??t).utils}),t}function r(e,t={}){return e.replaceAll(/\{\{(\w+)\}\}/g,(e,n)=>t[n]??``)}function i(e){let{ruleName:t,messages:i,run:a}=e,o=Object.fromEntries(Object.entries(i).map(([e,n])=>[e,`${n} (${t})`]));return Object.assign((i,s)=>async(c,l)=>{let u=await n();u.validateOptions(l,t,{actual:i,possible:e.primary??[!0]},...e.secondary?[{actual:s,possible:e.secondary,optional:!0}]:[])&&a(i,s??{})(c,e=>{u.report({ruleName:t,result:l,node:e.node,message:r(o[e.messageId],e.data),...e.index===void 0||e.endIndex===void 0?{}:{index:e.index,endIndex:e.endIndex},...e.fix?{fix:e.fix}:{}})})},{ruleName:t,messages:o,meta:{url:`https://github.com/storm-software/razorwind/tree/main/packages/stylelint#rules`,fixable:e.fixable??!1,description:e.description}})}function a(e){return e.prop.startsWith(`--`)}function o(e){if(!(e.raws.value&&e.raws.value.raw!==e.value))return e.prop.length+(e.raws.between??`:`).length}const s=/* @__PURE__ */ new WeakMap;function c(e,t){return e.reduce((e,t)=>e>=t.end?e+t.length-(t.end-t.start):e>t.start?t.start+Math.min(e-t.start,t.length):e,t)}function l(e,t){return e.reduceRight((e,t)=>e>=t.start+t.length?e-t.length+(t.end-t.start):Math.min(e,t.start),t)}function u(){let e=/* @__PURE__ */ new WeakMap,t=e=>s.get(e)??[];return{read(n){return e.set(n,t(n).length),n.value},replace(n,r,i,a){let o=t(n).slice(e.get(n)??0),l=c(o,r),u=c(o,i);n.value=n.value.slice(0,l)+a+n.value.slice(u),s.set(n,[...t(n),{start:l,end:u,length:a.length}])},range(n,r,i){let a=o(n),s=t(n).slice(0,e.get(n)??0);return a===void 0?void 0:{index:a+l(s,r),endIndex:a+l(s,i)}}}}const ee=/* @__PURE__ */ new Set([`inherit`,`initial`,`unset`,`revert`,`revert-layer`,`auto`,`none`,`normal`,`transparent`,`currentcolor`]),d={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`},te={"border-bottom":`border-block-end`,"border-bottom-color":`border-block-end-color`,"border-bottom-style":`border-block-end-style`,"border-bottom-width":`border-block-end-width`,"border-top":`border-block-start`,"border-top-color":`border-block-start-color`,"border-top-style":`border-block-start-style`,"border-top-width":`border-block-start-width`,"border-right":`border-inline-end`,"border-right-color":`border-inline-end-color`,"border-right-style":`border-inline-end-style`,"border-right-width":`border-inline-end-width`,"border-left":`border-inline-start`,"border-left-color":`border-inline-start-color`,"border-left-style":`border-inline-start-style`,"border-left-width":`border-inline-start-width`,"border-top-left-radius":`border-start-start-radius`,"border-bottom-left-radius":`border-end-start-radius`,"border-top-right-radius":`border-start-end-radius`,"border-bottom-right-radius":`border-end-end-radius`,"margin-bottom":`margin-block-end`,"margin-top":`margin-block-start`,"margin-right":`margin-inline-end`,"margin-left":`margin-inline-start`,"padding-bottom":`padding-block-end`,"padding-top":`padding-block-start`,"padding-right":`padding-inline-end`,"padding-left":`padding-inline-start`,left:`inset-inline-start`,right:`inset-inline-end`,top:`inset-block-start`,bottom:`inset-block-end`},ne={"text-align":{left:`start`,right:`end`},float:{left:`inline-start`,right:`inline-end`},clear:{left:`inline-start`,right:`inline-end`}};function f(e){let t=[],n=0,r,i=-1,a=n=>{i>=0&&(t.push({text:e.slice(i,n),start:i}),i=-1)};for(let t=0;t<e.length;t++){let o=e[t];if(r)o===r&&(r=void 0);else if(o===`"`||o===`'`)r=o;else if(o===`(`)n++;else if(o===`)`)n=Math.max(n-1,0);else if(n===0&&(/\s/.test(o)||o===`,`)){a(t);continue}i<0&&(i=t)}return a(e.length),t}function re(e){let t=[],n=0,r=``;for(let i of e)i===`(`?n++:i===`)`&&(n=Math.max(n-1,0)),i===`,`&&n===0?(t.push(r.trim()),r=``):r+=i;return t.push(r.trim()),t.filter(Boolean)}function ie(e){return/^-?[a-z][\w-]*\(/i.test(e)}function p(e){return ee.has(e.toLowerCase())}function m(e){return/^(?:(?:var|env)\(|[$@]|#\{)/i.test(e)}const ae=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/i;function h(e){let t=ae.exec(e.trim());if(t)return{value:Number(t[1]),unit:t[2].toLowerCase()}}const oe=/* @__PURE__ */ new Set([`px`,`rem`,`em`,`pt`,`ch`,`ex`,`vh`,`vw`,`vmin`,`vmax`,`dvh`,`dvw`,`svh`,`svw`,`lvh`,`lvw`]);function se(e){let t=h(e);return!!t&&t.value!==0&&oe.has(t.unit)}function g(e){return String(Number(e.toFixed(4)))}function _(e){let t=h(e);if(t){if(t.value===0)return`0px`;switch(t.unit){case``:case`px`:return`${g(t.value)}px`;case`rem`:case`em`:return`${g(t.value*16)}px`;default:return`${g(t.value)}${t.unit}`}}}function v(e){let t=Number(e);return Number.isFinite(t)&&e.trim()!==``?g(t):void 0}function y(e){let t=h(e);if(t){if(t.unit===`ms`)return t.value;if(t.unit===`s`)return t.value*1e3}}function b(e){let t=y(e);return t===void 0?void 0:`${g(t)}ms`}const ce=/* @__PURE__ */ new Set([`ease`,`ease-in`,`ease-out`,`ease-in-out`,`linear`,`step-start`,`step-end`]);function x(e){return ce.has(e.toLowerCase())||/^(?:cubic-bezier|steps|linear)\(/i.test(e)}function le(e){return e.toLowerCase().replaceAll(/\s+/g,``).replaceAll(`,`,`, `)}const ue={normal:`400`,bold:`700`};function de(e){let t=e.trim().toLowerCase();return ue[t]??v(t)}function S(e){let[t=``]=e.split(`,`);return t.trim().replaceAll(/^["']|["']$/g,``).toLowerCase()}function fe(e){return e.trim().toLowerCase().replaceAll(/\s+/g,` `)}function pe(e){return Math.min(255,Math.max(0,Math.round(e)))}function C(e,t){return`#${[...e,t*255].map(e=>pe(e).toString(16).padStart(2,`0`)).join(``)}`}function me(e,t){return e.endsWith(`%`)?Number.parseFloat(e)/100*t:Number.parseFloat(e)}function w(e){return e===void 0?1:e.endsWith(`%`)?Number.parseFloat(e)/100:Number.parseFloat(e)}function he(e,t,n){let r=(e%360+360)%360/360,i=t/100,a=n/100;if(i===0)return[a*255,a*255,a*255];let o=a<.5?a*(1+i):a+i-a*i,s=2*a-o,c=e=>{let t=e<0?e+1:e>1?e-1:e;return t<1/6?s+(o-s)*6*t:t<1/2?o:t<2/3?s+(o-s)*(2/3-t)*6:s};return[c(r+1/3)*255,c(r)*255,c(r-1/3)*255]}function T(e){let t=e.trim().toLowerCase();if(!t)return;let n=d[t];if(n)return`${n}ff`;let r=/^#([0-9a-f]{3,8})$/.exec(t)?.[1];if(r)return r.length===3||r.length===4?`#${[...r].map(e=>e+e).join(``).padEnd(8,`f`)}`:r.length===6||r.length===8?`#${r.padEnd(8,`f`)}`:void 0;let i=/^(rgba?|hsla?)\((.*)\)$/.exec(t);if(i){let[e=``,t]=i[2].split(`/`).map(e=>e.trim()),n=e.split(/[\s,]+/).filter(Boolean),r=t??n[3];return n.length<3?void 0:i[1].startsWith(`rgb`)?C(n.slice(0,3).map(e=>me(e,255)),w(r)):C(he(Number.parseFloat(n[0]),Number.parseFloat(n[1]),Number.parseFloat(n[2])),w(r))}return t.replaceAll(/\s+/g,` `).replaceAll(/\s*,\s*/g,`, `)}const ge=new RegExp([String.raw`#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3,4})\b`,String.raw`\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\((?:[^()]|\([^()]*\))*\)`,String.raw`(?<![\w$@-])(?:${Object.keys(d).join(`|`)})(?![\w-])`].join(`|`),`gi`);function E(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]===`(`)n++;else if(e[r]===`)`&&--n===0)return r+1}function _e(e){return[...e.matchAll(/\b(?:var|env|url)\(/gi)].flatMap(t=>{let n=E(e,t.index+t[0].length-1);return n===void 0?[]:[[t.index,n]]})}function D(e){let t=[..._e(e),...[...e.matchAll(/(["'])(?:(?!\1).)*\1/g)].map(e=>[e.index,e.index+e[0].length])];return[...e.matchAll(ge)].filter(e=>!t.some(([t,n])=>e.index>=t&&e.index<n)).map(e=>({text:e[0],start:e.index,end:e.index+e[0].length}))}function O(e){return[...e.matchAll(/\bvar\(\s*(--[\w-]+)/gi)].flatMap(t=>{let n=E(e,t.index+t[0].indexOf(`(`));if(n===void 0)return[];let r=t[1],i=t.index+t[0].length-r.length,a=i+r.length,o=e.slice(a,n-1),s=/^\s*,/.test(o)?o.replace(/^\s*,/,``).trim():``;return[{start:t.index,end:n,name:r,nameStart:i,nameEnd:a,...s?{fallback:s}:{}}]})}const k={property:`all`,duration:`0s`,"timing-function":`ease`,delay:`0s`},A={name:`none`,duration:`0s`,"timing-function":`ease`,delay:`0s`,"iteration-count":`1`,direction:`normal`,"fill-mode":`none`,"play-state":`running`},j=/* @__PURE__ */ new Set([`normal`,`reverse`,`alternate`,`alternate-reverse`]),M=/* @__PURE__ */ new Set([`none`,`forwards`,`backwards`,`both`]),N=/* @__PURE__ */ new Set([`running`,`paused`]);function P(e,t){let n={},r=(e,t)=>e in n?!1:(n[e]=t,!0);for(let{text:i}of f(e))y(i)===void 0?x(i)?r(`timing-function`,i):t===`transition`?r(`property`,i):/^(?:\d+(?:\.\d+)?|infinite)$/.test(i)?r(`iteration-count`,i):j.has(i)&&!(`direction`in n)?r(`direction`,i):M.has(i)&&!(`fill-mode`in n)?r(`fill-mode`,i):N.has(i)?r(`play-state`,i):r(`name`,i):r(`duration`,i)||r(`delay`,i);return n}function F(e,t){if(f(t).some(e=>m(e.text)))return;let n=e===`transition`?k:A,r=re(t).map(t=>P(t,e));if(r.length===0)return;let i=e===`transition`?`property`:`name`;return Object.keys(n).filter(e=>e===i||r.some(t=>e in t)).map(t=>[`${e}-${t}`,r.map(e=>e[t]??n[t]).join(`, `)])}const I={width:`1px`,height:`1px`,padding:`0`,position:`absolute`,border:`0`,clip:`rect(1px, 1px, 1px, 1px)`,overflow:`hidden`,"white-space":`nowrap`};function ve(e){return e.length<5?0:e.filter(e=>e.key in I).reduce((e,t)=>e+(I[t.key]===t.value?1.5:.75),0)/e.length}function L(e,t){let n=e.components.filter(e=>e.roles.includes(t)).map(e=>e.jsx[0]);return n.length<=1?n[0]??``:`${n.slice(0,-1).join(`, `)} or ${n.at(-1)}`}function R(e){return{index:0,endIndex:e.prop.length}}function ye(e){let t=t=>`${e.prefix}/${t}`,n=L(e,`primitive`),r=L(e,`visually-hidden`);return{"no-margin":i({ruleName:t(`no-margin`),description:`Disallow using the margin CSS property`,messages:{noMargin:`margin breaks the component model. Control layout from the parent with ${n?`${n} or `:``}gap in a flex or grid container`},run:()=>(e,t)=>{e.walkDecls(e=>{e.prop.toLowerCase().startsWith(`margin`)&&t({node:e,messageId:`noMargin`,...R(e)})})}}),"no-physical-properties":i({ruleName:t(`no-physical-properties`),description:`Disallow physical properties and values; use logical properties that follow the reading direction`,messages:{noPhysicalProperties:`Physical property {{physical}} does not follow the reading direction. Use {{logical}}`,noPhysicalValues:`{{property}}: "{{physical}}" does not follow the reading direction. Use "{{logical}}"`},fixable:!0,run:()=>(e,t)=>{e.walkDecls(e=>{let n=e.prop.toLowerCase(),r=te[n];r&&t({node:e,messageId:`noPhysicalProperties`,data:{physical:e.prop,logical:r},...R(e),fix:()=>{e.prop=r}});let i=e.value.trim().toLowerCase(),a=ne[n]?.[i],s=o(e);if(a){let n=e.value.length-e.value.trimStart().length;t({node:e,messageId:`noPhysicalValues`,data:{property:e.prop,physical:i,logical:a},...s===void 0?{}:{index:s+n,endIndex:s+n+i.length},fix:()=>{e.value=a}})}})}}),"expand-motion-shorthand":i({ruleName:t(`expand-motion-shorthand`),description:`Expands transition and animation shorthands so each value can use a motion token`,messages:{expandShorthand:`Expand the {{property}} shorthand into longhand properties so durations and easings can use motion tokens`},fixable:!0,run:()=>(e,t)=>{e.walkDecls(e=>{let n=e.prop.toLowerCase();if(n!==`transition`&&n!==`animation`||p(e.value.trim()))return;let r=F(n,e.value);r&&t({node:e,messageId:`expandShorthand`,data:{property:n},...R(e),fix:()=>{for(let[t,n]of r)e.cloneBefore({prop:t,value:n});e.remove()}})})}}),"use-visually-hidden":i({ruleName:t(`use-visually-hidden`),description:`Enforce usage of the design system's visually hidden component over hand-rolled styles`,messages:{useVisuallyHidden:`Use ${r||`the visually hidden component`} instead of hand-rolled visually hidden styles`},run:()=>(e,t)=>{e.walkRules(e=>{ve(e.nodes.filter(e=>e.type===`decl`).map(e=>({key:e.prop.toLowerCase(),value:e.value.trim()})))>.8&&t({node:e,messageId:`useVisuallyHidden`,index:0,endIndex:e.selector.length})})}})}}const be={hardCodedColor:`Hard-coded color "{{value}}". Use a color token{{hint}}; a missing value is a token to add, not a literal to inline`,hardCodedShadow:`Hard-coded shadow "{{value}}". Use a shadow token{{hint}}`,noRawSpacingValues:`Hard-coded spacing "{{value}}" in {{property}}. Use a space token{{hint}}`,noRawRadiusValues:`Hard-coded radius "{{value}}" in {{property}}. Use a radius token{{hint}}; a new radius becomes a token first`,noRawBorderWidthValues:`Hard-coded border width "{{value}}" in {{property}}. Use a border width token{{hint}}`,noRawTypographyValues:`Hard-coded {{property}} "{{value}}". Use a typography token{{hint}}`,unknownFontFamily:`Font family "{{value}}" is not part of the design system. Use one of: {{fonts}}`,noRawDuration:`Hard-coded duration "{{value}}" in {{property}}. Use a duration token{{hint}}`,noRawEasing:`Hard-coded easing "{{value}}" in {{property}}. Use an easing token{{hint}}`,nonTokenCssVariable:`The custom property {{name}} is not a design token. Reference a design token, or add the value to the schema as one`};function z(...e){return Object.fromEntries(e.map(e=>[e,be[e]]))}function B(e,t=se){return f(e).filter(({text:e})=>!m(e)&&!ie(e)&&!p(e)&&t(e)).map(({text:e,start:t})=>({start:t,end:t+e.length,text:e}))}function V(e){let t=e.length-e.trimStart().length;return{start:t,end:t+e.trim().length,text:e.trim()}}const xe=/^(?:color|fill|stroke|background(?:-[a-z]+)*|border(?:-[a-z]+)*|outline(?:-[a-z]+)*|column-rule(?:-[a-z]+)*|text-decoration(?:-[a-z]+)*|[a-z-]+-color)$/,Se=/* @__PURE__ */ new Set([`box-shadow`,`text-shadow`]),H=[``,`-block`,`-block-start`,`-block-end`,`-inline`,`-inline-start`,`-inline-end`],Ce=/* @__PURE__ */ new Set([...[`padding`,`margin`,`scroll-padding`,`scroll-margin`].flatMap(e=>[...H,`-top`,`-right`,`-bottom`,`-left`].map(t=>`${e}${t}`)),...H.map(e=>`inset${e}`),`gap`,`row-gap`,`column-gap`,`grid-gap`,`grid-row-gap`,`grid-column-gap`,`top`,`right`,`bottom`,`left`]),U=`(?:-(?:top|right|bottom|left|block|block-start|block-end|inline|inline-start|inline-end))?`,we=/^border(?:-(?:top|bottom)-(?:left|right)|-(?:start|end)-(?:start|end))?-radius$/,Te=RegExp(`^(?:border${U}-width|outline-width)$`),Ee=RegExp(`^(?:border${U}|outline)$`),De=/* @__PURE__ */ new Set([`transition-duration`,`transition-delay`,`animation-duration`,`animation-delay`]),Oe=/* @__PURE__ */ new Set([`transition-timing-function`,`animation-timing-function`]),ke={"font-size":`fontSize`,"letter-spacing":`letterSpacing`,"line-height":`lineHeight`,"font-weight":`fontWeight`,"font-family":`fontFamily`};function Ae(e){return D(e).length>0||B(e).length>0}function je(e){return/^(?:\d+|bold|bolder|lighter)$/i.test(e)}function Me(e){let t=y(e);return t!==void 0&&t!==0}function Ne(e,t,n){return t.length>0?` (matching: ${t.map(e.reference).join(`, `)})`:e.examples(n)}function W(e,t,n,r,i={}){let a=e.find(r,t.text);return{start:t.start,end:t.end,messageId:n,data:{value:t.text,...i,hint:Ne(e,a,r)},tokens:a}}function Pe(e){return(t,n)=>Se.has(t)?e.has(`shadow`)&&Ae(n)?[W(e,V(n),`hardCodedShadow`,[`shadow`])]:[]:!e.has(`color`)||!xe.test(t)?[]:D(n).map(t=>W(e,t,`hardCodedColor`,[`color`]))}function G(e){return(t,n)=>e.has(`space`)&&Ce.has(t)?B(n).map(n=>W(e,n,`noRawSpacingValues`,[`space`],{property:t})):[]}function Fe(e){return(t,n)=>{let r=we.test(t),i=r?`radius`:Te.test(t)||Ee.test(t)?`borderWidth`:void 0;return!i||!e.has(i)?[]:B(n).map(n=>W(e,n,r?`noRawRadiusValues`:`noRawBorderWidthValues`,[i],{property:t}))}}function K(e,t){let n=new Set(t.fonts.map(e=>S(e.family))),r=t.fonts.map(e=>e.family).join(`, `),i=(t,n,r)=>{let i=W(e,t,`noRawTypographyValues`,r,{property:n});return i.tokens.length>0?i:{...i,data:{...i.data,hint:e.examples([...r,`typography`])}}};return(t,a)=>{let o=ke[t];switch(o){case`fontSize`:case`letterSpacing`:return e.has(o)?B(a).map(e=>i(e,t,[o])):[];case`lineHeight`:return e.has(o)?B(a,e=>/^\d|^\./.test(e)).map(e=>i(e,t,[o])):[];case`fontWeight`:return e.has(o)?B(a,je).map(e=>i(e,t,[o])):[];case`fontFamily`:{let o=a.trim();if(!o||p(o)||m(o))return[];let s=V(a);return e.has(`fontFamily`)?[i(s,t,[`fontFamily`])]:n.size>0&&!n.has(S(a))?[{...s,messageId:`unknownFontFamily`,data:{value:s.text,fonts:r},tokens:[]}]:[]}default:return t===`font`&&e.has(`typography`,`fontSize`,`fontFamily`)&&B(a).length>0?[i(V(a),t,[])]:[]}}}function Ie(e){return(t,n)=>{let r=t===`transition`||t===`animation`,i=[];return e.has(`duration`)&&(r||De.has(t))&&i.push(...B(n,Me).map(n=>W(e,n,`noRawDuration`,[`duration`],{property:t}))),e.has(`easing`)&&(r||Oe.has(t))&&i.push(...f(n).filter(({text:e})=>x(e)).map(({text:n,start:r})=>W(e,{start:r,end:r+n.length,text:n},`noRawEasing`,[`easing`],{property:t}))),i}}function Le(e){return(t,n)=>O(n).filter(t=>!e.byCssVar.has(t.name)&&!e.isDesignSystemVar(t.name)).map(e=>({start:e.start,end:e.end,messageId:`nonTokenCssVariable`,data:{name:e.name},tokens:[]}))}function q(e,t){return i({ruleName:t.ruleName,description:t.description,messages:t.messages,fixable:!0,primary:t.primary,run:n=>{let r=t.analyzers(n);return(t,n)=>{let i=u();t.walkDecls(t=>{if(a(t))return;let o=t.prop.toLowerCase(),s=i.read(t),c=r.flatMap(e=>e(o,s)).sort((e,t)=>e.start-t.start);for(let r of c){let[a,...o]=r.tokens;n({node:t,messageId:r.messageId,data:r.data,...i.range(t,r.start,r.end),fix:a&&o.length===0?()=>i.replace(t,r.start,r.end,e.reference(a)):void 0})}})}}})}const J={color:!0,spacing:!1,typography:!1,nonTokenCssVariables:!1},Re=Object.keys(J);function Y(e){return e===!0||typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.entries(e).every(([e,t])=>Re.includes(e)&&typeof t==`boolean`)}const ze=[`forced`,`optional`,`none`];function Be(e,t){let n=t=>`${e.prefix}/${t}`,r=e=>e.length>0?` Did you mean ${e.join(`, `)}?`:``;return{"ensure-design-token-usage":q(t,{ruleName:n(`ensure-design-token-usage`),description:`Enforces usage of design tokens rather than hard-coded colors and shadows (and, when enabled, spacing, typography and non-token custom properties)`,messages:z(`hardCodedColor`,`hardCodedShadow`,`noRawSpacingValues`,`noRawTypographyValues`,`unknownFontFamily`,`nonTokenCssVariable`),primary:Y,analyzers:n=>{let r={...J,...n===!0?{}:n};return[...r.color?[Pe(t)]:[],...r.spacing?[G(t)]:[],...r.typography?[K(t,e)]:[],...r.nonTokenCssVariables?[Le(t)]:[]]}}),"use-tokens-space":q(t,{ruleName:n(`use-tokens-space`),description:`Enforces usage of space design tokens rather than hard-coded values`,messages:z(`noRawSpacingValues`),analyzers:()=>[G(t)]}),"use-tokens-shape":q(t,{ruleName:n(`use-tokens-shape`),description:`Enforces usage of shape (radius and border width) design tokens rather than hard-coded values`,messages:z(`noRawRadiusValues`,`noRawBorderWidthValues`),analyzers:()=>[Fe(t)]}),"use-tokens-typography":q(t,{ruleName:n(`use-tokens-typography`),description:`Enforces usage of typography design tokens rather than hard-coded font values`,messages:z(`noRawTypographyValues`,`unknownFontFamily`),analyzers:()=>[K(t,e)]}),"use-tokens-motion":q(t,{ruleName:n(`use-tokens-motion`),description:`Enforces usage of motion design tokens rather than hard-coded durations and easings`,messages:z(`noRawDuration`,`noRawEasing`),analyzers:()=>[Ie(t)]}),"no-unsafe-design-token-usage":i({ruleName:n(`no-unsafe-design-token-usage`),description:`Enforces that token references exist in the design system and follow the fallback strategy`,messages:{invalidToken:`The token {{name}} does not exist in the design system.{{suggestion}}`,missingFallback:`Token {{name}} is missing a fallback. Add one so the style survives without the token stylesheet`,hasFallback:`Token {{name}} has a fallback. Reference the token alone so the design system stays the single source of the value`},fixable:!0,secondary:{fallbackUsage:ze,shouldEnsureFallbackUsage:[!0,!1]},run:(e,n)=>{let i=n.shouldEnsureFallbackUsage===!0?`forced`:n.shouldEnsureFallbackUsage===!1?`none`:n.fallbackUsage??`optional`;return(e,n)=>{let a=u();e.walkDecls(e=>{let o=[];for(let s of O(a.read(e))){if(!t.isDesignSystemVar(s.name)||o.some(([e,t])=>s.start>=e&&s.start<t))continue;let c=a.range(e,s.nameStart,s.nameEnd),l=t.byCssVar.get(s.name);if(!l){n({node:e,messageId:`invalidToken`,data:{name:s.name,suggestion:r(t.similar(s.name))},...c});continue}if(i===`forced`&&!s.fallback){let t=l.value;n({node:e,messageId:`missingFallback`,data:{name:s.name},...c,fix:t?()=>a.replace(e,s.nameEnd,s.end-1,`, ${t}`):void 0})}else i===`none`&&s.fallback&&(o.push([s.nameEnd,s.end-1]),n({node:e,messageId:`hasFallback`,data:{name:s.name},...c,fix:()=>a.replace(e,s.nameEnd,s.end-1,``)}))}})}}}),"no-deprecated-design-token-usage":i({ruleName:n(`no-deprecated-design-token-usage`),description:`Disallow using deprecated design tokens`,messages:{tokenDeprecated:`The token {{name}} is deprecated{{note}}`,tokenRenamed:`The token {{name}} is deprecated in favour of {{replacement}}`},fixable:!0,run:()=>(e,n)=>{let r=u();e.walkDecls(e=>{for(let i of O(r.read(e))){let a=t.byCssVar.get(i.name);if(!a?.deprecated)continue;let o=r.range(e,i.nameStart,i.nameEnd),s=a.replacement?t.byPath.get(a.replacement):void 0;if(!s){n({node:e,messageId:`tokenDeprecated`,data:{name:i.name,note:typeof a.deprecated==`string`?`: ${a.deprecated}`:``},...o});continue}n({node:e,messageId:`tokenRenamed`,data:{name:i.name,replacement:s.cssVar},...o,fix:()=>r.replace(e,i.nameStart,i.nameEnd,s.cssVar)})}})}})}}function X(e,t){switch(e){case`color`:return T(t);case`space`:case`size`:case`radius`:case`borderWidth`:case`fontSize`:case`letterSpacing`:return _(t);case`lineHeight`:return v(t)??_(t);case`fontWeight`:return de(t);case`fontFamily`:return S(t);case`duration`:return b(t);case`easing`:return le(t);case`zIndex`:case`opacity`:return v(t);case`shadow`:case`typography`:return fe(t)}}function Ve(e,t){let n=Array.from({length:t.length+1},(e,t)=>t);for(let r=1;r<=e.length;r++){let i=[r];for(let a=1;a<=t.length;a++)i[a]=Math.min(n[a]+1,i[a-1]+1,n[a-1]+(e[r-1]===t[a-1]?0:1));n=i}return n[t.length]}function Z(e,t){return Number(!!t.alias)-Number(!!e.alias)||e.path.split(`.`).length-t.path.split(`.`).length||e.path.localeCompare(t.path,void 0,{numeric:!0})}function He(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Set;for(let o of e.tokens){if(t.set(o.path,o),n.set(o.cssVar,o),e.cssVarPrefix||a.add(o.cssVar.replace(/^--/,``).split(`-`)[0]),!o.category)continue;r.set(o.category,[...r.get(o.category)??[],o]);let s=o.value===void 0?void 0:X(o.category,o.value);if(s!==void 0&&!o.deprecated){let e=`${o.category}:${s}`;i.set(e,[...i.get(e)??[],o])}}for(let e of i.values())e.sort(Z);let o=e=>`var(${e.cssVar})`;return{byCssVar:n,byPath:t,has:(...e)=>e.some(e=>(r.get(e)?.length??0)>0),find(e,t){return e.flatMap(e=>{let n=X(e,t);return n===void 0?[]:i.get(`${e}:${n}`)??[]}).slice(0,3)},isDesignSystemVar(t){let n=t.replace(/^--/,``);return e.cssVarPrefix?n.startsWith(`${e.cssVarPrefix}-`):a.has(n.split(`-`)[0])},similar(e){let t=Math.max(2,Math.floor(e.length/5));return[...n.keys()].map(t=>({candidate:t,distance:Ve(e,t)})).filter(({distance:e})=>e<=t).sort((e,t)=>e.distance-t.distance).slice(0,3).map(({candidate:e})=>e)},reference:o,examples(e){let t=e.flatMap(e=>r.get(e)??[]).filter(e=>!e.deprecated).toSorted(Z);if(t.length===0)return``;let n=t.slice(0,4).map(o);return` (e.g. ${n.join(`, `)}${t.length>n.length?`, …`:``})`}}}function Q(e,t){return Object.fromEntries(Object.entries(t??{}).map(([t,n])=>[`${e}-${t}`,n]))}function Ue(e,t){let n=(e,t)=>e?t:`off`;return{"ensure-design-token-usage":n(t.has(`color`,`shadow`),`error`),"no-unsafe-design-token-usage":n(e.tokens.length>0,`error`),"no-deprecated-design-token-usage":n(e.tokens.some(e=>e.deprecated),`warn`),"use-tokens-space":n(t.has(`space`),`warn`),"use-tokens-shape":n(t.has(`radius`,`borderWidth`),`warn`),"use-tokens-typography":n(t.has(`fontSize`,`fontWeight`,`fontFamily`,`lineHeight`,`letterSpacing`,`typography`)||e.fonts.length>0,`warn`),"use-tokens-motion":n(t.has(`duration`,`easing`),`warn`),"expand-motion-shorthand":`off`,"no-physical-properties":`off`,"no-margin":`off`,"use-visually-hidden":n(e.components.some(e=>e.roles.includes(`visually-hidden`)),`warn`)}}function $(e,t=!0,n={}){return e===`off`?null:[t,{...n,severity:e===`warn`?`warning`:`error`}]}function We(t){let n=He(t),r=t.tailwind?e(t.tailwind,{rulePrefix:`tailwind-`}):void 0,i={...Be(t,n),...ye(t),...Q(`tailwind`,r?.rules)},a={...Ue(t,n),...Q(`tailwind`,r?.defaultSeverity)},o=Object.keys(i),s=o.map(e=>({ruleName:i[e].ruleName,rule:i[e]}));return{plugins:s,rules:i,defaultSeverity:a,config:(e={})=>{let{files:t,ignoreFiles:n,severity:r={}}=e,c={};for(let t of o){let n=r[t]??a[t]??`off`;c[i[t].ruleName]=t===`ensure-design-token-usage`?$(n,e.tokenUsage??!0):t===`no-unsafe-design-token-usage`&&e.fallbackUsage?$(n,!0,{fallbackUsage:e.fallbackUsage}):$(n)}return{plugins:s,...n?{ignoreFiles:n}:{},...t?{overrides:[{files:t,rules:c}]}:{rules:c}}}}}export{T as n,We as t};
|
|
2
|
+
//# sourceMappingURL=runtime-CZCP4myF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-CZCP4myF.mjs","names":["createTailwindGuardrails","utils","loadStylelint","api","module","format","template","data","key","createRule","options","suffixed","messages","id","text","ruleName","stylelint","result","primary","secondary","run","root","descriptor","isCustomProperty","decl","valueOffset","history","forward","edits","position","edit","offset","backward","createValueEdits","read","later","from","start","to","end","earlier","VALUE_KEYWORDS","NAMED_COLORS","PHYSICAL_PROPERTIES","PHYSICAL_VALUES","splitParts","parts","depth","quote","flush","value","index","char","splitLayers","layers","current","isFunctionCall","part","isKeyword","isReference","DIMENSION","parseDimension","match","LENGTH_UNITS","isLengthLiteral","dimension","formatNumber","normalizeLength","input","normalizeNumber","parseDuration","normalizeDuration","ms","EASING_KEYWORDS","isEasingLiteral","normalizeEasing","FONT_WEIGHT_KEYWORDS","normalizeFontWeight","normalizeFontFamily","first","normalizeWhitespace","clampByte","toHex","channels","alpha","channel","parseChannel","scale","parseAlpha","hslToRgb","hue","h","sat","s","light","l","q","p","n","t","normalizeColor","named","hex","fn","values","alphaText","COLOR_PATTERN","closingParen","open","referenceRanges","findColorLiterals","skip","findVarCalls","name","nameStart","nameEnd","rest","fallback","TRANSITION_DEFAULTS","ANIMATION_DEFAULTS","ANIMATION_DIRECTIONS","ANIMATION_FILL_MODES","ANIMATION_PLAY_STATES","classifyLayer","set","layer","property","expandMotionShorthand","defaults","VISUALLY_HIDDEN","visuallyHiddenLikeness","entries","entry","score","componentNames","names","manifest","component","role","propertyRange","createStyleRules","primitives","visuallyHidden","report","logical","physical","logicalValue","longhands","prop","rule","node","MESSAGES","pick","ids","literalSpans","accept","wholeSpan","COLOR_PROPERTY","SHADOW_PROPERTIES","LOGICAL_SIDES","SPACE_PROPERTIES","base","side","BORDER_SIDES","RADIUS_PROPERTY","BORDER_WIDTH_PROPERTY","BORDER_SHORTHAND","DURATION_PROPERTIES","EASING_PROPERTIES","TYPOGRAPHY_CATEGORIES","hasShadowLiteral","isWeightLiteral","isDurationLiteral","hint","tokens","categories","issue","span","colorAnalyzer","spaceAnalyzer","shapeAnalyzer","radius","category","typographyAnalyzer","fontFamilies","font","fontList","typographyIssue","found","trimmed","motionAnalyzer","shorthand","issues","nonTokenVariableAnalyzer","call","valueRule","analyzers","analyze","a","b","token","others","DEFAULT_DOMAINS","DOMAIN_KEYS","isTokenUsageDomains","enabled","FALLBACK_USAGES","createTokenRules","didYouMean","domains","strategy","removed","range","replacement","normalizeTokenValue","levenshtein","previous","i","j","compareTokens","createTokenIndex","byPath","byCssVar","byCategory","byValue","namespaces","normalized","reference","bare","limit","candidate","distance","shown","prefixed","record","prefix","coreSeverity","on","severity","ruleSetting","createDesignSystemPlugin","tailwind","createGuardrails","rules","defaultSeverity","plugins","ruleConfig","level","ignoreFiles","files"],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e=require("@razorwind/tailwindcss/stylelint-runtime"),t;function n(){return t??=import(`stylelint`).then(e=>{let t=e;return(t.default??t).utils}),t}function r(e,t={}){return e.replaceAll(/\{\{(\w+)\}\}/g,(e,n)=>t[n]??``)}function i(e){let{ruleName:t,messages:i,run:a}=e,o=Object.fromEntries(Object.entries(i).map(([e,n])=>[e,`${n} (${t})`]));return Object.assign((i,s)=>async(c,l)=>{let u=await n();u.validateOptions(l,t,{actual:i,possible:e.primary??[!0]},...e.secondary?[{actual:s,possible:e.secondary,optional:!0}]:[])&&a(i,s??{})(c,e=>{u.report({ruleName:t,result:l,node:e.node,message:r(o[e.messageId],e.data),...e.index===void 0||e.endIndex===void 0?{}:{index:e.index,endIndex:e.endIndex},...e.fix?{fix:e.fix}:{}})})},{ruleName:t,messages:o,meta:{url:`https://github.com/storm-software/razorwind/tree/main/packages/stylelint#rules`,fixable:e.fixable??!1,description:e.description}})}function a(e){return e.prop.startsWith(`--`)}function o(e){if(!(e.raws.value&&e.raws.value.raw!==e.value))return e.prop.length+(e.raws.between??`:`).length}const s=/* @__PURE__ */ new WeakMap;function c(e,t){return e.reduce((e,t)=>e>=t.end?e+t.length-(t.end-t.start):e>t.start?t.start+Math.min(e-t.start,t.length):e,t)}function l(e,t){return e.reduceRight((e,t)=>e>=t.start+t.length?e-t.length+(t.end-t.start):Math.min(e,t.start),t)}function u(){let e=/* @__PURE__ */ new WeakMap,t=e=>s.get(e)??[];return{read(n){return e.set(n,t(n).length),n.value},replace(n,r,i,a){let o=t(n).slice(e.get(n)??0),l=c(o,r),u=c(o,i);n.value=n.value.slice(0,l)+a+n.value.slice(u),s.set(n,[...t(n),{start:l,end:u,length:a.length}])},range(n,r,i){let a=o(n),s=t(n).slice(0,e.get(n)??0);return a===void 0?void 0:{index:a+l(s,r),endIndex:a+l(s,i)}}}}const ee=/* @__PURE__ */ new Set([`inherit`,`initial`,`unset`,`revert`,`revert-layer`,`auto`,`none`,`normal`,`transparent`,`currentcolor`]),d={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,gold:`#ffd700`,goldenrod:`#daa520`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavender:`#e6e6fa`,lavenderblush:`#fff0f5`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`},te={"border-bottom":`border-block-end`,"border-bottom-color":`border-block-end-color`,"border-bottom-style":`border-block-end-style`,"border-bottom-width":`border-block-end-width`,"border-top":`border-block-start`,"border-top-color":`border-block-start-color`,"border-top-style":`border-block-start-style`,"border-top-width":`border-block-start-width`,"border-right":`border-inline-end`,"border-right-color":`border-inline-end-color`,"border-right-style":`border-inline-end-style`,"border-right-width":`border-inline-end-width`,"border-left":`border-inline-start`,"border-left-color":`border-inline-start-color`,"border-left-style":`border-inline-start-style`,"border-left-width":`border-inline-start-width`,"border-top-left-radius":`border-start-start-radius`,"border-bottom-left-radius":`border-end-start-radius`,"border-top-right-radius":`border-start-end-radius`,"border-bottom-right-radius":`border-end-end-radius`,"margin-bottom":`margin-block-end`,"margin-top":`margin-block-start`,"margin-right":`margin-inline-end`,"margin-left":`margin-inline-start`,"padding-bottom":`padding-block-end`,"padding-top":`padding-block-start`,"padding-right":`padding-inline-end`,"padding-left":`padding-inline-start`,left:`inset-inline-start`,right:`inset-inline-end`,top:`inset-block-start`,bottom:`inset-block-end`},ne={"text-align":{left:`start`,right:`end`},float:{left:`inline-start`,right:`inline-end`},clear:{left:`inline-start`,right:`inline-end`}};function f(e){let t=[],n=0,r,i=-1,a=n=>{i>=0&&(t.push({text:e.slice(i,n),start:i}),i=-1)};for(let t=0;t<e.length;t++){let o=e[t];if(r)o===r&&(r=void 0);else if(o===`"`||o===`'`)r=o;else if(o===`(`)n++;else if(o===`)`)n=Math.max(n-1,0);else if(n===0&&(/\s/.test(o)||o===`,`)){a(t);continue}i<0&&(i=t)}return a(e.length),t}function re(e){let t=[],n=0,r=``;for(let i of e)i===`(`?n++:i===`)`&&(n=Math.max(n-1,0)),i===`,`&&n===0?(t.push(r.trim()),r=``):r+=i;return t.push(r.trim()),t.filter(Boolean)}function ie(e){return/^-?[a-z][\w-]*\(/i.test(e)}function p(e){return ee.has(e.toLowerCase())}function m(e){return/^(?:(?:var|env)\(|[$@]|#\{)/i.test(e)}const ae=/^(-?(?:\d+(?:\.\d*)?|\.\d+))([a-z%]*)$/i;function h(e){let t=ae.exec(e.trim());if(t)return{value:Number(t[1]),unit:t[2].toLowerCase()}}const oe=/* @__PURE__ */ new Set([`px`,`rem`,`em`,`pt`,`ch`,`ex`,`vh`,`vw`,`vmin`,`vmax`,`dvh`,`dvw`,`svh`,`svw`,`lvh`,`lvw`]);function se(e){let t=h(e);return!!t&&t.value!==0&&oe.has(t.unit)}function g(e){return String(Number(e.toFixed(4)))}function _(e){let t=h(e);if(t){if(t.value===0)return`0px`;switch(t.unit){case``:case`px`:return`${g(t.value)}px`;case`rem`:case`em`:return`${g(t.value*16)}px`;default:return`${g(t.value)}${t.unit}`}}}function v(e){let t=Number(e);return Number.isFinite(t)&&e.trim()!==``?g(t):void 0}function y(e){let t=h(e);if(t){if(t.unit===`ms`)return t.value;if(t.unit===`s`)return t.value*1e3}}function b(e){let t=y(e);return t===void 0?void 0:`${g(t)}ms`}const ce=/* @__PURE__ */ new Set([`ease`,`ease-in`,`ease-out`,`ease-in-out`,`linear`,`step-start`,`step-end`]);function x(e){return ce.has(e.toLowerCase())||/^(?:cubic-bezier|steps|linear)\(/i.test(e)}function le(e){return e.toLowerCase().replaceAll(/\s+/g,``).replaceAll(`,`,`, `)}const ue={normal:`400`,bold:`700`};function de(e){let t=e.trim().toLowerCase();return ue[t]??v(t)}function S(e){let[t=``]=e.split(`,`);return t.trim().replaceAll(/^["']|["']$/g,``).toLowerCase()}function fe(e){return e.trim().toLowerCase().replaceAll(/\s+/g,` `)}function pe(e){return Math.min(255,Math.max(0,Math.round(e)))}function C(e,t){return`#${[...e,t*255].map(e=>pe(e).toString(16).padStart(2,`0`)).join(``)}`}function me(e,t){return e.endsWith(`%`)?Number.parseFloat(e)/100*t:Number.parseFloat(e)}function w(e){return e===void 0?1:e.endsWith(`%`)?Number.parseFloat(e)/100:Number.parseFloat(e)}function he(e,t,n){let r=(e%360+360)%360/360,i=t/100,a=n/100;if(i===0)return[a*255,a*255,a*255];let o=a<.5?a*(1+i):a+i-a*i,s=2*a-o,c=e=>{let t=e<0?e+1:e>1?e-1:e;return t<1/6?s+(o-s)*6*t:t<1/2?o:t<2/3?s+(o-s)*(2/3-t)*6:s};return[c(r+1/3)*255,c(r)*255,c(r-1/3)*255]}function T(e){let t=e.trim().toLowerCase();if(!t)return;let n=d[t];if(n)return`${n}ff`;let r=/^#([0-9a-f]{3,8})$/.exec(t)?.[1];if(r)return r.length===3||r.length===4?`#${[...r].map(e=>e+e).join(``).padEnd(8,`f`)}`:r.length===6||r.length===8?`#${r.padEnd(8,`f`)}`:void 0;let i=/^(rgba?|hsla?)\((.*)\)$/.exec(t);if(i){let[e=``,t]=i[2].split(`/`).map(e=>e.trim()),n=e.split(/[\s,]+/).filter(Boolean),r=t??n[3];return n.length<3?void 0:i[1].startsWith(`rgb`)?C(n.slice(0,3).map(e=>me(e,255)),w(r)):C(he(Number.parseFloat(n[0]),Number.parseFloat(n[1]),Number.parseFloat(n[2])),w(r))}return t.replaceAll(/\s+/g,` `).replaceAll(/\s*,\s*/g,`, `)}const ge=new RegExp([String.raw`#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3,4})\b`,String.raw`\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\((?:[^()]|\([^()]*\))*\)`,String.raw`(?<![\w$@-])(?:${Object.keys(d).join(`|`)})(?![\w-])`].join(`|`),`gi`);function E(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]===`(`)n++;else if(e[r]===`)`&&--n===0)return r+1}function _e(e){return[...e.matchAll(/\b(?:var|env|url)\(/gi)].flatMap(t=>{let n=E(e,t.index+t[0].length-1);return n===void 0?[]:[[t.index,n]]})}function D(e){let t=[..._e(e),...[...e.matchAll(/(["'])(?:(?!\1).)*\1/g)].map(e=>[e.index,e.index+e[0].length])];return[...e.matchAll(ge)].filter(e=>!t.some(([t,n])=>e.index>=t&&e.index<n)).map(e=>({text:e[0],start:e.index,end:e.index+e[0].length}))}function O(e){return[...e.matchAll(/\bvar\(\s*(--[\w-]+)/gi)].flatMap(t=>{let n=E(e,t.index+t[0].indexOf(`(`));if(n===void 0)return[];let r=t[1],i=t.index+t[0].length-r.length,a=i+r.length,o=e.slice(a,n-1),s=/^\s*,/.test(o)?o.replace(/^\s*,/,``).trim():``;return[{start:t.index,end:n,name:r,nameStart:i,nameEnd:a,...s?{fallback:s}:{}}]})}const k={property:`all`,duration:`0s`,"timing-function":`ease`,delay:`0s`},A={name:`none`,duration:`0s`,"timing-function":`ease`,delay:`0s`,"iteration-count":`1`,direction:`normal`,"fill-mode":`none`,"play-state":`running`},j=/* @__PURE__ */ new Set([`normal`,`reverse`,`alternate`,`alternate-reverse`]),M=/* @__PURE__ */ new Set([`none`,`forwards`,`backwards`,`both`]),N=/* @__PURE__ */ new Set([`running`,`paused`]);function P(e,t){let n={},r=(e,t)=>e in n?!1:(n[e]=t,!0);for(let{text:i}of f(e))y(i)===void 0?x(i)?r(`timing-function`,i):t===`transition`?r(`property`,i):/^(?:\d+(?:\.\d+)?|infinite)$/.test(i)?r(`iteration-count`,i):j.has(i)&&!(`direction`in n)?r(`direction`,i):M.has(i)&&!(`fill-mode`in n)?r(`fill-mode`,i):N.has(i)?r(`play-state`,i):r(`name`,i):r(`duration`,i)||r(`delay`,i);return n}function F(e,t){if(f(t).some(e=>m(e.text)))return;let n=e===`transition`?k:A,r=re(t).map(t=>P(t,e));if(r.length===0)return;let i=e===`transition`?`property`:`name`;return Object.keys(n).filter(e=>e===i||r.some(t=>e in t)).map(t=>[`${e}-${t}`,r.map(e=>e[t]??n[t]).join(`, `)])}const I={width:`1px`,height:`1px`,padding:`0`,position:`absolute`,border:`0`,clip:`rect(1px, 1px, 1px, 1px)`,overflow:`hidden`,"white-space":`nowrap`};function ve(e){return e.length<5?0:e.filter(e=>e.key in I).reduce((e,t)=>e+(I[t.key]===t.value?1.5:.75),0)/e.length}function L(e,t){let n=e.components.filter(e=>e.roles.includes(t)).map(e=>e.jsx[0]);return n.length<=1?n[0]??``:`${n.slice(0,-1).join(`, `)} or ${n.at(-1)}`}function R(e){return{index:0,endIndex:e.prop.length}}function ye(e){let t=t=>`${e.prefix}/${t}`,n=L(e,`primitive`),r=L(e,`visually-hidden`);return{"no-margin":i({ruleName:t(`no-margin`),description:`Disallow using the margin CSS property`,messages:{noMargin:`margin breaks the component model. Control layout from the parent with ${n?`${n} or `:``}gap in a flex or grid container`},run:()=>(e,t)=>{e.walkDecls(e=>{e.prop.toLowerCase().startsWith(`margin`)&&t({node:e,messageId:`noMargin`,...R(e)})})}}),"no-physical-properties":i({ruleName:t(`no-physical-properties`),description:`Disallow physical properties and values; use logical properties that follow the reading direction`,messages:{noPhysicalProperties:`Physical property {{physical}} does not follow the reading direction. Use {{logical}}`,noPhysicalValues:`{{property}}: "{{physical}}" does not follow the reading direction. Use "{{logical}}"`},fixable:!0,run:()=>(e,t)=>{e.walkDecls(e=>{let n=e.prop.toLowerCase(),r=te[n];r&&t({node:e,messageId:`noPhysicalProperties`,data:{physical:e.prop,logical:r},...R(e),fix:()=>{e.prop=r}});let i=e.value.trim().toLowerCase(),a=ne[n]?.[i],s=o(e);if(a){let n=e.value.length-e.value.trimStart().length;t({node:e,messageId:`noPhysicalValues`,data:{property:e.prop,physical:i,logical:a},...s===void 0?{}:{index:s+n,endIndex:s+n+i.length},fix:()=>{e.value=a}})}})}}),"expand-motion-shorthand":i({ruleName:t(`expand-motion-shorthand`),description:`Expands transition and animation shorthands so each value can use a motion token`,messages:{expandShorthand:`Expand the {{property}} shorthand into longhand properties so durations and easings can use motion tokens`},fixable:!0,run:()=>(e,t)=>{e.walkDecls(e=>{let n=e.prop.toLowerCase();if(n!==`transition`&&n!==`animation`||p(e.value.trim()))return;let r=F(n,e.value);r&&t({node:e,messageId:`expandShorthand`,data:{property:n},...R(e),fix:()=>{for(let[t,n]of r)e.cloneBefore({prop:t,value:n});e.remove()}})})}}),"use-visually-hidden":i({ruleName:t(`use-visually-hidden`),description:`Enforce usage of the design system's visually hidden component over hand-rolled styles`,messages:{useVisuallyHidden:`Use ${r||`the visually hidden component`} instead of hand-rolled visually hidden styles`},run:()=>(e,t)=>{e.walkRules(e=>{ve(e.nodes.filter(e=>e.type===`decl`).map(e=>({key:e.prop.toLowerCase(),value:e.value.trim()})))>.8&&t({node:e,messageId:`useVisuallyHidden`,index:0,endIndex:e.selector.length})})}})}}const be={hardCodedColor:`Hard-coded color "{{value}}". Use a color token{{hint}}; a missing value is a token to add, not a literal to inline`,hardCodedShadow:`Hard-coded shadow "{{value}}". Use a shadow token{{hint}}`,noRawSpacingValues:`Hard-coded spacing "{{value}}" in {{property}}. Use a space token{{hint}}`,noRawRadiusValues:`Hard-coded radius "{{value}}" in {{property}}. Use a radius token{{hint}}; a new radius becomes a token first`,noRawBorderWidthValues:`Hard-coded border width "{{value}}" in {{property}}. Use a border width token{{hint}}`,noRawTypographyValues:`Hard-coded {{property}} "{{value}}". Use a typography token{{hint}}`,unknownFontFamily:`Font family "{{value}}" is not part of the design system. Use one of: {{fonts}}`,noRawDuration:`Hard-coded duration "{{value}}" in {{property}}. Use a duration token{{hint}}`,noRawEasing:`Hard-coded easing "{{value}}" in {{property}}. Use an easing token{{hint}}`,nonTokenCssVariable:`The custom property {{name}} is not a design token. Reference a design token, or add the value to the schema as one`};function z(...e){return Object.fromEntries(e.map(e=>[e,be[e]]))}function B(e,t=se){return f(e).filter(({text:e})=>!m(e)&&!ie(e)&&!p(e)&&t(e)).map(({text:e,start:t})=>({start:t,end:t+e.length,text:e}))}function V(e){let t=e.length-e.trimStart().length;return{start:t,end:t+e.trim().length,text:e.trim()}}const xe=/^(?:color|fill|stroke|background(?:-[a-z]+)*|border(?:-[a-z]+)*|outline(?:-[a-z]+)*|column-rule(?:-[a-z]+)*|text-decoration(?:-[a-z]+)*|[a-z-]+-color)$/,Se=/* @__PURE__ */ new Set([`box-shadow`,`text-shadow`]),H=[``,`-block`,`-block-start`,`-block-end`,`-inline`,`-inline-start`,`-inline-end`],Ce=/* @__PURE__ */ new Set([...[`padding`,`margin`,`scroll-padding`,`scroll-margin`].flatMap(e=>[...H,`-top`,`-right`,`-bottom`,`-left`].map(t=>`${e}${t}`)),...H.map(e=>`inset${e}`),`gap`,`row-gap`,`column-gap`,`grid-gap`,`grid-row-gap`,`grid-column-gap`,`top`,`right`,`bottom`,`left`]),U=`(?:-(?:top|right|bottom|left|block|block-start|block-end|inline|inline-start|inline-end))?`,we=/^border(?:-(?:top|bottom)-(?:left|right)|-(?:start|end)-(?:start|end))?-radius$/,Te=RegExp(`^(?:border${U}-width|outline-width)$`),Ee=RegExp(`^(?:border${U}|outline)$`),De=/* @__PURE__ */ new Set([`transition-duration`,`transition-delay`,`animation-duration`,`animation-delay`]),Oe=/* @__PURE__ */ new Set([`transition-timing-function`,`animation-timing-function`]),ke={"font-size":`fontSize`,"letter-spacing":`letterSpacing`,"line-height":`lineHeight`,"font-weight":`fontWeight`,"font-family":`fontFamily`};function Ae(e){return D(e).length>0||B(e).length>0}function je(e){return/^(?:\d+|bold|bolder|lighter)$/i.test(e)}function Me(e){let t=y(e);return t!==void 0&&t!==0}function Ne(e,t,n){return t.length>0?` (matching: ${t.map(e.reference).join(`, `)})`:e.examples(n)}function W(e,t,n,r,i={}){let a=e.find(r,t.text);return{start:t.start,end:t.end,messageId:n,data:{value:t.text,...i,hint:Ne(e,a,r)},tokens:a}}function Pe(e){return(t,n)=>Se.has(t)?e.has(`shadow`)&&Ae(n)?[W(e,V(n),`hardCodedShadow`,[`shadow`])]:[]:!e.has(`color`)||!xe.test(t)?[]:D(n).map(t=>W(e,t,`hardCodedColor`,[`color`]))}function G(e){return(t,n)=>e.has(`space`)&&Ce.has(t)?B(n).map(n=>W(e,n,`noRawSpacingValues`,[`space`],{property:t})):[]}function Fe(e){return(t,n)=>{let r=we.test(t),i=r?`radius`:Te.test(t)||Ee.test(t)?`borderWidth`:void 0;return!i||!e.has(i)?[]:B(n).map(n=>W(e,n,r?`noRawRadiusValues`:`noRawBorderWidthValues`,[i],{property:t}))}}function K(e,t){let n=new Set(t.fonts.map(e=>S(e.family))),r=t.fonts.map(e=>e.family).join(`, `),i=(t,n,r)=>{let i=W(e,t,`noRawTypographyValues`,r,{property:n});return i.tokens.length>0?i:{...i,data:{...i.data,hint:e.examples([...r,`typography`])}}};return(t,a)=>{let o=ke[t];switch(o){case`fontSize`:case`letterSpacing`:return e.has(o)?B(a).map(e=>i(e,t,[o])):[];case`lineHeight`:return e.has(o)?B(a,e=>/^\d|^\./.test(e)).map(e=>i(e,t,[o])):[];case`fontWeight`:return e.has(o)?B(a,je).map(e=>i(e,t,[o])):[];case`fontFamily`:{let o=a.trim();if(!o||p(o)||m(o))return[];let s=V(a);return e.has(`fontFamily`)?[i(s,t,[`fontFamily`])]:n.size>0&&!n.has(S(a))?[{...s,messageId:`unknownFontFamily`,data:{value:s.text,fonts:r},tokens:[]}]:[]}default:return t===`font`&&e.has(`typography`,`fontSize`,`fontFamily`)&&B(a).length>0?[i(V(a),t,[])]:[]}}}function Ie(e){return(t,n)=>{let r=t===`transition`||t===`animation`,i=[];return e.has(`duration`)&&(r||De.has(t))&&i.push(...B(n,Me).map(n=>W(e,n,`noRawDuration`,[`duration`],{property:t}))),e.has(`easing`)&&(r||Oe.has(t))&&i.push(...f(n).filter(({text:e})=>x(e)).map(({text:n,start:r})=>W(e,{start:r,end:r+n.length,text:n},`noRawEasing`,[`easing`],{property:t}))),i}}function Le(e){return(t,n)=>O(n).filter(t=>!e.byCssVar.has(t.name)&&!e.isDesignSystemVar(t.name)).map(e=>({start:e.start,end:e.end,messageId:`nonTokenCssVariable`,data:{name:e.name},tokens:[]}))}function q(e,t){return i({ruleName:t.ruleName,description:t.description,messages:t.messages,fixable:!0,primary:t.primary,run:n=>{let r=t.analyzers(n);return(t,n)=>{let i=u();t.walkDecls(t=>{if(a(t))return;let o=t.prop.toLowerCase(),s=i.read(t),c=r.flatMap(e=>e(o,s)).sort((e,t)=>e.start-t.start);for(let r of c){let[a,...o]=r.tokens;n({node:t,messageId:r.messageId,data:r.data,...i.range(t,r.start,r.end),fix:a&&o.length===0?()=>i.replace(t,r.start,r.end,e.reference(a)):void 0})}})}}})}const J={color:!0,spacing:!1,typography:!1,nonTokenCssVariables:!1},Re=Object.keys(J);function Y(e){return e===!0||typeof e==`object`&&!!e&&!Array.isArray(e)&&Object.entries(e).every(([e,t])=>Re.includes(e)&&typeof t==`boolean`)}const ze=[`forced`,`optional`,`none`];function Be(e,t){let n=t=>`${e.prefix}/${t}`,r=e=>e.length>0?` Did you mean ${e.join(`, `)}?`:``;return{"ensure-design-token-usage":q(t,{ruleName:n(`ensure-design-token-usage`),description:`Enforces usage of design tokens rather than hard-coded colors and shadows (and, when enabled, spacing, typography and non-token custom properties)`,messages:z(`hardCodedColor`,`hardCodedShadow`,`noRawSpacingValues`,`noRawTypographyValues`,`unknownFontFamily`,`nonTokenCssVariable`),primary:Y,analyzers:n=>{let r={...J,...n===!0?{}:n};return[...r.color?[Pe(t)]:[],...r.spacing?[G(t)]:[],...r.typography?[K(t,e)]:[],...r.nonTokenCssVariables?[Le(t)]:[]]}}),"use-tokens-space":q(t,{ruleName:n(`use-tokens-space`),description:`Enforces usage of space design tokens rather than hard-coded values`,messages:z(`noRawSpacingValues`),analyzers:()=>[G(t)]}),"use-tokens-shape":q(t,{ruleName:n(`use-tokens-shape`),description:`Enforces usage of shape (radius and border width) design tokens rather than hard-coded values`,messages:z(`noRawRadiusValues`,`noRawBorderWidthValues`),analyzers:()=>[Fe(t)]}),"use-tokens-typography":q(t,{ruleName:n(`use-tokens-typography`),description:`Enforces usage of typography design tokens rather than hard-coded font values`,messages:z(`noRawTypographyValues`,`unknownFontFamily`),analyzers:()=>[K(t,e)]}),"use-tokens-motion":q(t,{ruleName:n(`use-tokens-motion`),description:`Enforces usage of motion design tokens rather than hard-coded durations and easings`,messages:z(`noRawDuration`,`noRawEasing`),analyzers:()=>[Ie(t)]}),"no-unsafe-design-token-usage":i({ruleName:n(`no-unsafe-design-token-usage`),description:`Enforces that token references exist in the design system and follow the fallback strategy`,messages:{invalidToken:`The token {{name}} does not exist in the design system.{{suggestion}}`,missingFallback:`Token {{name}} is missing a fallback. Add one so the style survives without the token stylesheet`,hasFallback:`Token {{name}} has a fallback. Reference the token alone so the design system stays the single source of the value`},fixable:!0,secondary:{fallbackUsage:ze,shouldEnsureFallbackUsage:[!0,!1]},run:(e,n)=>{let i=n.shouldEnsureFallbackUsage===!0?`forced`:n.shouldEnsureFallbackUsage===!1?`none`:n.fallbackUsage??`optional`;return(e,n)=>{let a=u();e.walkDecls(e=>{let o=[];for(let s of O(a.read(e))){if(!t.isDesignSystemVar(s.name)||o.some(([e,t])=>s.start>=e&&s.start<t))continue;let c=a.range(e,s.nameStart,s.nameEnd),l=t.byCssVar.get(s.name);if(!l){n({node:e,messageId:`invalidToken`,data:{name:s.name,suggestion:r(t.similar(s.name))},...c});continue}if(i===`forced`&&!s.fallback){let t=l.value;n({node:e,messageId:`missingFallback`,data:{name:s.name},...c,fix:t?()=>a.replace(e,s.nameEnd,s.end-1,`, ${t}`):void 0})}else i===`none`&&s.fallback&&(o.push([s.nameEnd,s.end-1]),n({node:e,messageId:`hasFallback`,data:{name:s.name},...c,fix:()=>a.replace(e,s.nameEnd,s.end-1,``)}))}})}}}),"no-deprecated-design-token-usage":i({ruleName:n(`no-deprecated-design-token-usage`),description:`Disallow using deprecated design tokens`,messages:{tokenDeprecated:`The token {{name}} is deprecated{{note}}`,tokenRenamed:`The token {{name}} is deprecated in favour of {{replacement}}`},fixable:!0,run:()=>(e,n)=>{let r=u();e.walkDecls(e=>{for(let i of O(r.read(e))){let a=t.byCssVar.get(i.name);if(!a?.deprecated)continue;let o=r.range(e,i.nameStart,i.nameEnd),s=a.replacement?t.byPath.get(a.replacement):void 0;if(!s){n({node:e,messageId:`tokenDeprecated`,data:{name:i.name,note:typeof a.deprecated==`string`?`: ${a.deprecated}`:``},...o});continue}n({node:e,messageId:`tokenRenamed`,data:{name:i.name,replacement:s.cssVar},...o,fix:()=>r.replace(e,i.nameStart,i.nameEnd,s.cssVar)})}})}})}}function X(e,t){switch(e){case`color`:return T(t);case`space`:case`size`:case`radius`:case`borderWidth`:case`fontSize`:case`letterSpacing`:return _(t);case`lineHeight`:return v(t)??_(t);case`fontWeight`:return de(t);case`fontFamily`:return S(t);case`duration`:return b(t);case`easing`:return le(t);case`zIndex`:case`opacity`:return v(t);case`shadow`:case`typography`:return fe(t)}}function Ve(e,t){let n=Array.from({length:t.length+1},(e,t)=>t);for(let r=1;r<=e.length;r++){let i=[r];for(let a=1;a<=t.length;a++)i[a]=Math.min(n[a]+1,i[a-1]+1,n[a-1]+(e[r-1]===t[a-1]?0:1));n=i}return n[t.length]}function Z(e,t){return Number(!!t.alias)-Number(!!e.alias)||e.path.split(`.`).length-t.path.split(`.`).length||e.path.localeCompare(t.path,void 0,{numeric:!0})}function He(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ new Map,r=/* @__PURE__ */ new Map,i=/* @__PURE__ */ new Map,a=/* @__PURE__ */ new Set;for(let o of e.tokens){if(t.set(o.path,o),n.set(o.cssVar,o),e.cssVarPrefix||a.add(o.cssVar.replace(/^--/,``).split(`-`)[0]),!o.category)continue;r.set(o.category,[...r.get(o.category)??[],o]);let s=o.value===void 0?void 0:X(o.category,o.value);if(s!==void 0&&!o.deprecated){let e=`${o.category}:${s}`;i.set(e,[...i.get(e)??[],o])}}for(let e of i.values())e.sort(Z);let o=e=>`var(${e.cssVar})`;return{byCssVar:n,byPath:t,has:(...e)=>e.some(e=>(r.get(e)?.length??0)>0),find(e,t){return e.flatMap(e=>{let n=X(e,t);return n===void 0?[]:i.get(`${e}:${n}`)??[]}).slice(0,3)},isDesignSystemVar(t){let n=t.replace(/^--/,``);return e.cssVarPrefix?n.startsWith(`${e.cssVarPrefix}-`):a.has(n.split(`-`)[0])},similar(e){let t=Math.max(2,Math.floor(e.length/5));return[...n.keys()].map(t=>({candidate:t,distance:Ve(e,t)})).filter(({distance:e})=>e<=t).sort((e,t)=>e.distance-t.distance).slice(0,3).map(({candidate:e})=>e)},reference:o,examples(e){let t=e.flatMap(e=>r.get(e)??[]).filter(e=>!e.deprecated).toSorted(Z);if(t.length===0)return``;let n=t.slice(0,4).map(o);return` (e.g. ${n.join(`, `)}${t.length>n.length?`, …`:``})`}}}function Q(e,t){return Object.fromEntries(Object.entries(t??{}).map(([t,n])=>[`${e}-${t}`,n]))}function Ue(e,t){let n=(e,t)=>e?t:`off`;return{"ensure-design-token-usage":n(t.has(`color`,`shadow`),`error`),"no-unsafe-design-token-usage":n(e.tokens.length>0,`error`),"no-deprecated-design-token-usage":n(e.tokens.some(e=>e.deprecated),`warn`),"use-tokens-space":n(t.has(`space`),`warn`),"use-tokens-shape":n(t.has(`radius`,`borderWidth`),`warn`),"use-tokens-typography":n(t.has(`fontSize`,`fontWeight`,`fontFamily`,`lineHeight`,`letterSpacing`,`typography`)||e.fonts.length>0,`warn`),"use-tokens-motion":n(t.has(`duration`,`easing`),`warn`),"expand-motion-shorthand":`off`,"no-physical-properties":`off`,"no-margin":`off`,"use-visually-hidden":n(e.components.some(e=>e.roles.includes(`visually-hidden`)),`warn`)}}function $(e,t=!0,n={}){return e===`off`?null:[t,{...n,severity:e===`warn`?`warning`:`error`}]}function We(t){let n=He(t),r=t.tailwind?(0,e.createGuardrails)(t.tailwind,{rulePrefix:`tailwind-`}):void 0,i={...Be(t,n),...ye(t),...Q(`tailwind`,r?.rules)},a={...Ue(t,n),...Q(`tailwind`,r?.defaultSeverity)},o=Object.keys(i),s=o.map(e=>({ruleName:i[e].ruleName,rule:i[e]}));return{plugins:s,rules:i,defaultSeverity:a,config:(e={})=>{let{files:t,ignoreFiles:n,severity:r={}}=e,c={};for(let t of o){let n=r[t]??a[t]??`off`;c[i[t].ruleName]=t===`ensure-design-token-usage`?$(n,e.tokenUsage??!0):t===`no-unsafe-design-token-usage`&&e.fallbackUsage?$(n,!0,{fallbackUsage:e.fallbackUsage}):$(n)}return{plugins:s,...n?{ignoreFiles:n}:{},...t?{overrides:[{files:t,rules:c}]}:{rules:c}}}}}Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return We}});
|
package/dist/runtime.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./runtime-D4YzdLS9.cjs");exports.createDesignSystemPlugin=e.t,exports.normalizeColor=e.n;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { a as DesignSystemRuleId, c as ManifestComponent, f as TokenCategory, i as DesignSystemOptions, l as ManifestFont, n as CoreRuleId, o as DesignSystemSeverity, p as TokenUsageDomains, r as DesignSystemManifest, s as FallbackUsage, t as ComponentRole, u as ManifestToken } from "./types-DdjS21Bx.cjs";
|
|
2
|
+
import { StylelintGuardrailRule } from "@razorwind/tailwindcss/stylelint-runtime";
|
|
3
|
+
//#region src/runtime/postcss.d.ts
|
|
4
|
+
interface Node {
|
|
5
|
+
type: string;
|
|
6
|
+
toString: () => string;
|
|
7
|
+
}
|
|
8
|
+
interface Declaration extends Node {
|
|
9
|
+
type: "decl";
|
|
10
|
+
prop: string;
|
|
11
|
+
value: string;
|
|
12
|
+
raws: {
|
|
13
|
+
between?: string;
|
|
14
|
+
value?: {
|
|
15
|
+
raw: string;
|
|
16
|
+
value: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
cloneBefore: (overrides: {
|
|
20
|
+
prop: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}) => Declaration;
|
|
23
|
+
remove: () => void;
|
|
24
|
+
}
|
|
25
|
+
interface CssRule extends Node {
|
|
26
|
+
type: "rule";
|
|
27
|
+
selector: string;
|
|
28
|
+
nodes: Node[];
|
|
29
|
+
}
|
|
30
|
+
interface Root extends Node {
|
|
31
|
+
walkDecls: (callback: (decl: Declaration) => void) => void;
|
|
32
|
+
walkRules: (callback: (rule: CssRule) => void) => void;
|
|
33
|
+
}
|
|
34
|
+
/** A Stylelint rule function with the metadata Stylelint reads from it. */
|
|
35
|
+
type StylelintRule = ((primary: unknown, secondary: unknown) => (root: Root, result: unknown) => Promise<void>) & {
|
|
36
|
+
ruleName: string;
|
|
37
|
+
messages: Record<string, string>;
|
|
38
|
+
meta: {
|
|
39
|
+
url: string;
|
|
40
|
+
fixable: boolean;
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/runtime/values.d.ts
|
|
46
|
+
/**
|
|
47
|
+
* Normalize a CSS color to `#rrggbbaa` (hex, `rgb()`, `hsl()`, named colors);
|
|
48
|
+
* other color spaces are compared as lowercased, whitespace-collapsed text.
|
|
49
|
+
*/
|
|
50
|
+
declare function normalizeColor(input: string): string | undefined;
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/runtime.d.ts
|
|
53
|
+
type AnyRule = StylelintRule | StylelintGuardrailRule;
|
|
54
|
+
/** A Stylelint plugin: one namespaced rule. */
|
|
55
|
+
interface DesignSystemStylelintPlugin {
|
|
56
|
+
ruleName: string;
|
|
57
|
+
rule: AnyRule;
|
|
58
|
+
}
|
|
59
|
+
/** Stylelint rule setting: off, or the primary option with severity. */
|
|
60
|
+
type RuleSetting = null | [unknown, {
|
|
61
|
+
severity: "error" | "warning";
|
|
62
|
+
[option: string]: unknown;
|
|
63
|
+
}];
|
|
64
|
+
/** The `plugins` / `rules` to spread into `stylelint.config.*`. */
|
|
65
|
+
interface DesignSystemConfig {
|
|
66
|
+
plugins: DesignSystemStylelintPlugin[];
|
|
67
|
+
ignoreFiles?: string[];
|
|
68
|
+
rules?: Record<string, RuleSetting>;
|
|
69
|
+
overrides?: {
|
|
70
|
+
files: string[];
|
|
71
|
+
rules: Record<string, RuleSetting>;
|
|
72
|
+
}[];
|
|
73
|
+
}
|
|
74
|
+
interface DesignSystemPlugin {
|
|
75
|
+
/** One Stylelint plugin per rule, to list in `plugins`. */
|
|
76
|
+
plugins: DesignSystemStylelintPlugin[];
|
|
77
|
+
rules: Partial<Record<DesignSystemRuleId, AnyRule>>;
|
|
78
|
+
defaultSeverity: Partial<Record<DesignSystemRuleId, DesignSystemSeverity>>;
|
|
79
|
+
/** Build the `plugins` / `rules` to spread into `stylelint.config.*`. */
|
|
80
|
+
config: (options?: DesignSystemOptions) => DesignSystemConfig;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Build the design-system rules, default severities and Stylelint config
|
|
84
|
+
* factory for a schema-derived manifest.
|
|
85
|
+
*/
|
|
86
|
+
declare function createDesignSystemPlugin(manifest: DesignSystemManifest): DesignSystemPlugin;
|
|
87
|
+
//#endregion
|
|
88
|
+
export { AnyRule, type ComponentRole, type CoreRuleId, DesignSystemConfig, type DesignSystemManifest, type DesignSystemOptions, DesignSystemPlugin, type DesignSystemRuleId, type DesignSystemSeverity, DesignSystemStylelintPlugin, type FallbackUsage, type ManifestComponent, type ManifestFont, type ManifestToken, RuleSetting, type TokenCategory, type TokenUsageDomains, createDesignSystemPlugin, normalizeColor };
|
|
89
|
+
//# sourceMappingURL=runtime.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.cts","names":["TailwindRule"],"sources":["../src/runtime/postcss.ts","../src/runtime/values.ts","../src/runtime.ts"],"mappings":";;;UAyBiB;EACf;EACA;;UAGe,oBAAoB;EACnC;EACA;EACA;EACA;IAAQ;IAAkB;MAAU;MAAa;;;EACjD,cAAc;IAAa;IAAc;QAAoB;EAC7D;;UAGe,gBAAgB;EAC/B;EACA;EACA,OAAO;;UAGQ,aAAa;EAC5B,YAAY,WAAW,MAAM;EAC7B,YAAY,WAAW,MAAM;;;KAuCnB,kBACV,kBACA,wBACI,MAAM,MAAM,oBAAoB;EACpC;EACA,UAAU;EACV;IAAQ;IAAa;IAAkB;;;;;;;;;iBC2bzB,eAAe;;;KCzdnB,UAAU,gBAAgBA;;UAGrB;EACf;EACA,MAAM;;;KAII;EAEI;GAAgC;;;UAG/B;EACf,SAAS;EACT;EACA,QAAQ,eAAe;EACvB;IAAc;IAAiB,OAAO,eAAe;;;UAGtC;;EAEf,SAAS;EACT,OAAO,QAAQ,OAAO,oBAAoB;EAC1C,iBAAiB,QAAQ,OAAO,oBAAoB;;EAEpD,SAAS,UAAU,wBAAwB;;;;;;iBA+E7B,yBACd,UAAU,uBACT"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { a as DesignSystemRuleId, c as ManifestComponent, f as TokenCategory, i as DesignSystemOptions, l as ManifestFont, n as CoreRuleId, o as DesignSystemSeverity, p as TokenUsageDomains, r as DesignSystemManifest, s as FallbackUsage, t as ComponentRole, u as ManifestToken } from "./types-DdjS21Bx.mjs";
|
|
2
|
+
import { StylelintGuardrailRule } from "@razorwind/tailwindcss/stylelint-runtime";
|
|
3
|
+
//#region src/runtime/postcss.d.ts
|
|
4
|
+
interface Node {
|
|
5
|
+
type: string;
|
|
6
|
+
toString: () => string;
|
|
7
|
+
}
|
|
8
|
+
interface Declaration extends Node {
|
|
9
|
+
type: "decl";
|
|
10
|
+
prop: string;
|
|
11
|
+
value: string;
|
|
12
|
+
raws: {
|
|
13
|
+
between?: string;
|
|
14
|
+
value?: {
|
|
15
|
+
raw: string;
|
|
16
|
+
value: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
cloneBefore: (overrides: {
|
|
20
|
+
prop: string;
|
|
21
|
+
value: string;
|
|
22
|
+
}) => Declaration;
|
|
23
|
+
remove: () => void;
|
|
24
|
+
}
|
|
25
|
+
interface CssRule extends Node {
|
|
26
|
+
type: "rule";
|
|
27
|
+
selector: string;
|
|
28
|
+
nodes: Node[];
|
|
29
|
+
}
|
|
30
|
+
interface Root extends Node {
|
|
31
|
+
walkDecls: (callback: (decl: Declaration) => void) => void;
|
|
32
|
+
walkRules: (callback: (rule: CssRule) => void) => void;
|
|
33
|
+
}
|
|
34
|
+
/** A Stylelint rule function with the metadata Stylelint reads from it. */
|
|
35
|
+
type StylelintRule = ((primary: unknown, secondary: unknown) => (root: Root, result: unknown) => Promise<void>) & {
|
|
36
|
+
ruleName: string;
|
|
37
|
+
messages: Record<string, string>;
|
|
38
|
+
meta: {
|
|
39
|
+
url: string;
|
|
40
|
+
fixable: boolean;
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/runtime/values.d.ts
|
|
46
|
+
/**
|
|
47
|
+
* Normalize a CSS color to `#rrggbbaa` (hex, `rgb()`, `hsl()`, named colors);
|
|
48
|
+
* other color spaces are compared as lowercased, whitespace-collapsed text.
|
|
49
|
+
*/
|
|
50
|
+
declare function normalizeColor(input: string): string | undefined;
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/runtime.d.ts
|
|
53
|
+
type AnyRule = StylelintRule | StylelintGuardrailRule;
|
|
54
|
+
/** A Stylelint plugin: one namespaced rule. */
|
|
55
|
+
interface DesignSystemStylelintPlugin {
|
|
56
|
+
ruleName: string;
|
|
57
|
+
rule: AnyRule;
|
|
58
|
+
}
|
|
59
|
+
/** Stylelint rule setting: off, or the primary option with severity. */
|
|
60
|
+
type RuleSetting = null | [unknown, {
|
|
61
|
+
severity: "error" | "warning";
|
|
62
|
+
[option: string]: unknown;
|
|
63
|
+
}];
|
|
64
|
+
/** The `plugins` / `rules` to spread into `stylelint.config.*`. */
|
|
65
|
+
interface DesignSystemConfig {
|
|
66
|
+
plugins: DesignSystemStylelintPlugin[];
|
|
67
|
+
ignoreFiles?: string[];
|
|
68
|
+
rules?: Record<string, RuleSetting>;
|
|
69
|
+
overrides?: {
|
|
70
|
+
files: string[];
|
|
71
|
+
rules: Record<string, RuleSetting>;
|
|
72
|
+
}[];
|
|
73
|
+
}
|
|
74
|
+
interface DesignSystemPlugin {
|
|
75
|
+
/** One Stylelint plugin per rule, to list in `plugins`. */
|
|
76
|
+
plugins: DesignSystemStylelintPlugin[];
|
|
77
|
+
rules: Partial<Record<DesignSystemRuleId, AnyRule>>;
|
|
78
|
+
defaultSeverity: Partial<Record<DesignSystemRuleId, DesignSystemSeverity>>;
|
|
79
|
+
/** Build the `plugins` / `rules` to spread into `stylelint.config.*`. */
|
|
80
|
+
config: (options?: DesignSystemOptions) => DesignSystemConfig;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Build the design-system rules, default severities and Stylelint config
|
|
84
|
+
* factory for a schema-derived manifest.
|
|
85
|
+
*/
|
|
86
|
+
declare function createDesignSystemPlugin(manifest: DesignSystemManifest): DesignSystemPlugin;
|
|
87
|
+
//#endregion
|
|
88
|
+
export { AnyRule, type ComponentRole, type CoreRuleId, DesignSystemConfig, type DesignSystemManifest, type DesignSystemOptions, DesignSystemPlugin, type DesignSystemRuleId, type DesignSystemSeverity, DesignSystemStylelintPlugin, type FallbackUsage, type ManifestComponent, type ManifestFont, type ManifestToken, RuleSetting, type TokenCategory, type TokenUsageDomains, createDesignSystemPlugin, normalizeColor };
|
|
89
|
+
//# sourceMappingURL=runtime.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.mts","names":["TailwindRule"],"sources":["../src/runtime/postcss.ts","../src/runtime/values.ts","../src/runtime.ts"],"mappings":""}
|
package/dist/runtime.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./runtime-CZCP4myF.mjs";export{t as createDesignSystemPlugin,e as normalizeColor};
|