@pithyjs/vite-plugin 0.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +237 -0
- package/dist/aotCodegen/generateBindings.d.ts +184 -0
- package/dist/aotCodegen/generateBindings.d.ts.map +1 -0
- package/dist/aotCodegen/generateBindings.js +326 -0
- package/dist/aotCodegen/generateBindings.js.map +1 -0
- package/dist/aotCodegen/generateDomFactory.d.ts +59 -0
- package/dist/aotCodegen/generateDomFactory.d.ts.map +1 -0
- package/dist/aotCodegen/generateDomFactory.js +302 -0
- package/dist/aotCodegen/generateDomFactory.js.map +1 -0
- package/dist/aotCodegen/index.d.ts +18 -0
- package/dist/aotCodegen/index.d.ts.map +1 -0
- package/dist/aotCodegen/index.js +17 -0
- package/dist/aotCodegen/index.js.map +1 -0
- package/dist/aotCodegen/serializeNode.d.ts +74 -0
- package/dist/aotCodegen/serializeNode.d.ts.map +1 -0
- package/dist/aotCodegen/serializeNode.js +169 -0
- package/dist/aotCodegen/serializeNode.js.map +1 -0
- package/dist/aotCodegen/structuralCodegen.d.ts +38 -0
- package/dist/aotCodegen/structuralCodegen.d.ts.map +1 -0
- package/dist/aotCodegen/structuralCodegen.js +56 -0
- package/dist/aotCodegen/structuralCodegen.js.map +1 -0
- package/dist/aotCodegen/utils.d.ts +38 -0
- package/dist/aotCodegen/utils.d.ts.map +1 -0
- package/dist/aotCodegen/utils.js +48 -0
- package/dist/aotCodegen/utils.js.map +1 -0
- package/dist/babelPlugin/babelPlugin.d.ts +44 -0
- package/dist/babelPlugin/babelPlugin.d.ts.map +1 -0
- package/dist/babelPlugin/babelPlugin.js +392 -0
- package/dist/babelPlugin/babelPlugin.js.map +1 -0
- package/dist/babelPlugin/extractOriginalTagNames.d.ts +20 -0
- package/dist/babelPlugin/extractOriginalTagNames.d.ts.map +1 -0
- package/dist/babelPlugin/extractOriginalTagNames.js +44 -0
- package/dist/babelPlugin/extractOriginalTagNames.js.map +1 -0
- package/dist/babelPlugin/extractUsedIdentifiers.d.ts +26 -0
- package/dist/babelPlugin/extractUsedIdentifiers.d.ts.map +1 -0
- package/dist/babelPlugin/extractUsedIdentifiers.js +206 -0
- package/dist/babelPlugin/extractUsedIdentifiers.js.map +1 -0
- package/dist/buildPlugin/plugin.d.ts +79 -0
- package/dist/buildPlugin/plugin.d.ts.map +1 -0
- package/dist/buildPlugin/plugin.js +142 -0
- package/dist/buildPlugin/plugin.js.map +1 -0
- package/dist/designSystemPlugin/collector.d.ts +63 -0
- package/dist/designSystemPlugin/collector.d.ts.map +1 -0
- package/dist/designSystemPlugin/collector.js +175 -0
- package/dist/designSystemPlugin/collector.js.map +1 -0
- package/dist/designSystemPlugin/cssTokens.d.ts +34 -0
- package/dist/designSystemPlugin/cssTokens.d.ts.map +1 -0
- package/dist/designSystemPlugin/cssTokens.js +56 -0
- package/dist/designSystemPlugin/cssTokens.js.map +1 -0
- package/dist/designSystemPlugin/enumerate.d.ts +24 -0
- package/dist/designSystemPlugin/enumerate.d.ts.map +1 -0
- package/dist/designSystemPlugin/enumerate.js +430 -0
- package/dist/designSystemPlugin/enumerate.js.map +1 -0
- package/dist/designSystemPlugin/extractor.d.ts +95 -0
- package/dist/designSystemPlugin/extractor.d.ts.map +1 -0
- package/dist/designSystemPlugin/extractor.js +150 -0
- package/dist/designSystemPlugin/extractor.js.map +1 -0
- package/dist/designSystemPlugin/generator.d.ts +33 -0
- package/dist/designSystemPlugin/generator.d.ts.map +1 -0
- package/dist/designSystemPlugin/generator.js +256 -0
- package/dist/designSystemPlugin/generator.js.map +1 -0
- package/dist/designSystemPlugin/index.d.ts +18 -0
- package/dist/designSystemPlugin/index.d.ts.map +1 -0
- package/dist/designSystemPlugin/index.js +19 -0
- package/dist/designSystemPlugin/index.js.map +1 -0
- package/dist/designSystemPlugin/patterns/a11y.d.ts +19 -0
- package/dist/designSystemPlugin/patterns/a11y.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/a11y.js +230 -0
- package/dist/designSystemPlugin/patterns/a11y.js.map +1 -0
- package/dist/designSystemPlugin/patterns/borders.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/borders.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/borders.js +474 -0
- package/dist/designSystemPlugin/patterns/borders.js.map +1 -0
- package/dist/designSystemPlugin/patterns/colors.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/colors.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/colors.js +134 -0
- package/dist/designSystemPlugin/patterns/colors.js.map +1 -0
- package/dist/designSystemPlugin/patterns/iconography.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/iconography.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/iconography.js +61 -0
- package/dist/designSystemPlugin/patterns/iconography.js.map +1 -0
- package/dist/designSystemPlugin/patterns/index.d.ts +22 -0
- package/dist/designSystemPlugin/patterns/index.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/index.js +44 -0
- package/dist/designSystemPlugin/patterns/index.js.map +1 -0
- package/dist/designSystemPlugin/patterns/layout.d.ts +34 -0
- package/dist/designSystemPlugin/patterns/layout.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/layout.js +917 -0
- package/dist/designSystemPlugin/patterns/layout.js.map +1 -0
- package/dist/designSystemPlugin/patterns/motion.d.ts +19 -0
- package/dist/designSystemPlugin/patterns/motion.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/motion.js +162 -0
- package/dist/designSystemPlugin/patterns/motion.js.map +1 -0
- package/dist/designSystemPlugin/patterns/radius.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/radius.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/radius.js +107 -0
- package/dist/designSystemPlugin/patterns/radius.js.map +1 -0
- package/dist/designSystemPlugin/patterns/shadows.d.ts +19 -0
- package/dist/designSystemPlugin/patterns/shadows.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/shadows.js +161 -0
- package/dist/designSystemPlugin/patterns/shadows.js.map +1 -0
- package/dist/designSystemPlugin/patterns/smartContainer.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/smartContainer.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/smartContainer.js +96 -0
- package/dist/designSystemPlugin/patterns/smartContainer.js.map +1 -0
- package/dist/designSystemPlugin/patterns/spacing.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/spacing.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/spacing.js +333 -0
- package/dist/designSystemPlugin/patterns/spacing.js.map +1 -0
- package/dist/designSystemPlugin/patterns/typography.d.ts +18 -0
- package/dist/designSystemPlugin/patterns/typography.d.ts.map +1 -0
- package/dist/designSystemPlugin/patterns/typography.js +416 -0
- package/dist/designSystemPlugin/patterns/typography.js.map +1 -0
- package/dist/designSystemPlugin/plugin.d.ts +39 -0
- package/dist/designSystemPlugin/plugin.d.ts.map +1 -0
- package/dist/designSystemPlugin/plugin.js +351 -0
- package/dist/designSystemPlugin/plugin.js.map +1 -0
- package/dist/designSystemPlugin/types.d.ts +156 -0
- package/dist/designSystemPlugin/types.d.ts.map +1 -0
- package/dist/designSystemPlugin/types.js +49 -0
- package/dist/designSystemPlugin/types.js.map +1 -0
- package/dist/htmlTransform/htmlTransform.d.ts +47 -0
- package/dist/htmlTransform/htmlTransform.d.ts.map +1 -0
- package/dist/htmlTransform/htmlTransform.js +86 -0
- package/dist/htmlTransform/htmlTransform.js.map +1 -0
- package/dist/iconsPlugin/index.d.ts +18 -0
- package/dist/iconsPlugin/index.d.ts.map +1 -0
- package/dist/iconsPlugin/index.js +17 -0
- package/dist/iconsPlugin/index.js.map +1 -0
- package/dist/iconsPlugin/optimize.d.ts +54 -0
- package/dist/iconsPlugin/optimize.d.ts.map +1 -0
- package/dist/iconsPlugin/optimize.js +253 -0
- package/dist/iconsPlugin/optimize.js.map +1 -0
- package/dist/iconsPlugin/plugin.d.ts +49 -0
- package/dist/iconsPlugin/plugin.d.ts.map +1 -0
- package/dist/iconsPlugin/plugin.js +242 -0
- package/dist/iconsPlugin/plugin.js.map +1 -0
- package/dist/iconsPlugin/types.d.ts +49 -0
- package/dist/iconsPlugin/types.d.ts.map +1 -0
- package/dist/iconsPlugin/types.js +30 -0
- package/dist/iconsPlugin/types.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/pithyPlugin/plugin.d.ts +38 -0
- package/dist/pithyPlugin/plugin.d.ts.map +1 -0
- package/dist/pithyPlugin/plugin.js +119 -0
- package/dist/pithyPlugin/plugin.js.map +1 -0
- package/dist/routerPlugin/manifest.d.ts +33 -0
- package/dist/routerPlugin/manifest.d.ts.map +1 -0
- package/dist/routerPlugin/manifest.js +223 -0
- package/dist/routerPlugin/manifest.js.map +1 -0
- package/dist/routerPlugin/plugin.d.ts +51 -0
- package/dist/routerPlugin/plugin.d.ts.map +1 -0
- package/dist/routerPlugin/plugin.js +164 -0
- package/dist/routerPlugin/plugin.js.map +1 -0
- package/dist/routerPlugin/scanner.d.ts +69 -0
- package/dist/routerPlugin/scanner.d.ts.map +1 -0
- package/dist/routerPlugin/scanner.js +290 -0
- package/dist/routerPlugin/scanner.js.map +1 -0
- package/dist/ssrPlugin/plugin.d.ts +76 -0
- package/dist/ssrPlugin/plugin.d.ts.map +1 -0
- package/dist/ssrPlugin/plugin.js +439 -0
- package/dist/ssrPlugin/plugin.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-design-system.extractor",
|
|
4
|
+
"title": "Utility Class Extractor",
|
|
5
|
+
"category": "plugin",
|
|
6
|
+
"description": "Extracts and parses PithyJS utility class names from source file content using regex pattern matching.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "stable",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": true, "covered": true, "file": "extractor.test.ts" },
|
|
11
|
+
"integration": { "required": true, "covered": true, "file": "integration.test.ts" },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Regex to match utility classes with optional variant prefix
|
|
18
|
+
*
|
|
19
|
+
* Matches patterns like:
|
|
20
|
+
* - u-bg-primary (base utility)
|
|
21
|
+
* - u-text-muted (base utility)
|
|
22
|
+
* - hover:u-bg-secondary (prefix variant)
|
|
23
|
+
* - dark:u-text-inverse (prefix variant)
|
|
24
|
+
* - focus:u-ring (prefix variant)
|
|
25
|
+
* - u-hover:bg-secondary (embedded variant)
|
|
26
|
+
* - u-hover:text-surface (embedded variant)
|
|
27
|
+
*
|
|
28
|
+
* The pattern captures:
|
|
29
|
+
* - Optional variant prefix (word characters and hyphens, followed by colon)
|
|
30
|
+
* - u- prefix followed by word characters and hyphens
|
|
31
|
+
* - Optional colon-separated continuations for embedded variant convention
|
|
32
|
+
*/
|
|
33
|
+
const UTILITY_PATTERN = /\b(?:[\w-]+:)?u-[\w-]+(?::[\w-]+)*/g;
|
|
34
|
+
/**
|
|
35
|
+
* Regex to parse a utility class into variant and base utility
|
|
36
|
+
* Group 1: variant (optional)
|
|
37
|
+
* Group 2: base utility
|
|
38
|
+
*/
|
|
39
|
+
const PARSE_PATTERN = /^(?:([\w-]+):)?(.+)$/;
|
|
40
|
+
/**
|
|
41
|
+
* State variants that map to pseudo-classes
|
|
42
|
+
* Based on existing SCSS utilities in the design system
|
|
43
|
+
*/
|
|
44
|
+
const STATE_VARIANTS = [
|
|
45
|
+
'hover',
|
|
46
|
+
'focus',
|
|
47
|
+
'focus-visible',
|
|
48
|
+
'active',
|
|
49
|
+
'disabled',
|
|
50
|
+
'selected',
|
|
51
|
+
];
|
|
52
|
+
/**
|
|
53
|
+
* Mode variants for theme switching
|
|
54
|
+
* Maps to [data-theme="dark"] and [data-theme="light"]
|
|
55
|
+
*/
|
|
56
|
+
const MODE_VARIANTS = ['dark', 'light'];
|
|
57
|
+
/**
|
|
58
|
+
* All known variants combined
|
|
59
|
+
*/
|
|
60
|
+
const ALL_VARIANTS = [...STATE_VARIANTS, ...MODE_VARIANTS];
|
|
61
|
+
/**
|
|
62
|
+
* Extract all utility classes from file content
|
|
63
|
+
*
|
|
64
|
+
* @param content - File content to scan
|
|
65
|
+
* @returns Set of unique utility class names found
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* const content = `
|
|
69
|
+
* class="u-flex u-gap-md hover:u-bg-primary"
|
|
70
|
+
* className={clsx('u-p-lg', isActive && 'u-bg-surface')}
|
|
71
|
+
* `;
|
|
72
|
+
* const utilities = extractUtilities(content);
|
|
73
|
+
* // Set { 'u-flex', 'u-gap-md', 'hover:u-bg-primary', 'u-p-lg', 'u-bg-surface' }
|
|
74
|
+
*/
|
|
75
|
+
/** @codexApi {"parent":"pithy.vite-plugin-design-system.extractor","name":"extractUtilities","stability":"stable","signature":"(content: string) => Set<string>"} */
|
|
76
|
+
export function extractUtilities(content) {
|
|
77
|
+
const matches = content.match(UTILITY_PATTERN) || [];
|
|
78
|
+
// Discard incomplete fragments from dynamic template literals
|
|
79
|
+
// No valid utility ends with "-"
|
|
80
|
+
return new Set(matches.filter(m => !m.endsWith('-')));
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Parse a utility class into its variant and base utility components
|
|
84
|
+
*
|
|
85
|
+
* @param className - Full class name (e.g., 'hover:u-bg-primary')
|
|
86
|
+
* @returns Parsed utility object
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* parseUtility('hover:u-bg-primary')
|
|
90
|
+
* // { full: 'hover:u-bg-primary', variant: 'hover', utility: 'u-bg-primary' }
|
|
91
|
+
*
|
|
92
|
+
* parseUtility('u-flex')
|
|
93
|
+
* // { full: 'u-flex', variant: null, utility: 'u-flex' }
|
|
94
|
+
*/
|
|
95
|
+
/** @codexApi {"parent":"pithy.vite-plugin-design-system.extractor","name":"parseUtility","stability":"stable","signature":"(className: string) => ParsedUtility"} */
|
|
96
|
+
export function parseUtility(className) {
|
|
97
|
+
const match = className.match(PARSE_PATTERN);
|
|
98
|
+
return {
|
|
99
|
+
full: className,
|
|
100
|
+
variant: match?.[1] || null,
|
|
101
|
+
utility: match?.[2] || className,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Check if a variant is a state variant (pseudo-class)
|
|
106
|
+
*/
|
|
107
|
+
export function isStateVariant(variant) {
|
|
108
|
+
return STATE_VARIANTS.includes(variant);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Check if a variant is a mode variant (theme)
|
|
112
|
+
*/
|
|
113
|
+
export function isModeVariant(variant) {
|
|
114
|
+
return MODE_VARIANTS.includes(variant);
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if a variant is known to the system
|
|
118
|
+
*/
|
|
119
|
+
export function isKnownVariant(variant) {
|
|
120
|
+
return ALL_VARIANTS.includes(variant);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Escape a class name for use in CSS selector
|
|
124
|
+
* Handles special characters like colons in variant prefixes
|
|
125
|
+
*
|
|
126
|
+
* @param className - Raw class name
|
|
127
|
+
* @returns Escaped class name safe for CSS
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* escapeSelector('hover:u-bg-primary')
|
|
131
|
+
* // 'hover\\:u-bg-primary'
|
|
132
|
+
*/
|
|
133
|
+
/** @codexApi {"parent":"pithy.vite-plugin-design-system.extractor","name":"escapeSelector","stability":"stable","signature":"(className: string) => string"} */
|
|
134
|
+
export function escapeSelector(className) {
|
|
135
|
+
// Escape special CSS selector characters
|
|
136
|
+
return className.replace(/([:\\/@])/g, '\\$1');
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Get all unique utilities from a map of file utilities
|
|
140
|
+
*/
|
|
141
|
+
export function getAllUniqueUtilities(fileUtilities) {
|
|
142
|
+
const all = new Set();
|
|
143
|
+
for (const utilities of fileUtilities.values()) {
|
|
144
|
+
for (const utility of utilities) {
|
|
145
|
+
all.add(utility);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return all;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractor.js","sourceRoot":"","sources":["../../src/designSystemPlugin/extractor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAIF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,eAAe,GAAG,qCAAqC,CAAC;AAE9D;;;;GAIG;AACH,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAE7C;;;GAGG;AACH,MAAM,cAAc,GAAG;IACrB,OAAO;IACP,OAAO;IACP,eAAe;IACf,QAAQ;IACR,UAAU;IACV,UAAU;CACF,CAAC;AAEX;;;GAGG;AACH,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,OAAO,CAAU,CAAC;AAEjD;;GAEG;AACH,MAAM,YAAY,GAAG,CAAC,GAAG,cAAc,EAAE,GAAG,aAAa,CAAU,CAAC;AAMpE;;;;;;;;;;;;;GAaG;AACH,qKAAqK;AACrK,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC;IACrD,8DAA8D;IAC9D,iCAAiC;IACjC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,qKAAqK;AACrK,MAAM,UAAU,YAAY,CAAC,SAAiB;IAC5C,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7C,OAAO;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI;QAC3B,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS;KACjC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAQ,cAAoC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAQ,aAAmC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAChE,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAQ,YAAkC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;;;;;;GAUG;AACH,gKAAgK;AAChK,MAAM,UAAU,cAAc,CAAC,SAAiB;IAC9C,yCAAyC;IACzC,OAAO,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,aAAuC;IAEvC,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAE9B,KAAK,MAAM,SAAS,IAAI,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;QAC/C,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE,CAAC;YAChC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-design-system.generator",
|
|
4
|
+
"title": "CSS Generator",
|
|
5
|
+
"category": "plugin",
|
|
6
|
+
"description": "Generates CSS rules from collected utility classes, grouping output by category in deterministic order.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "experimental",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": true, "covered": true, "file": "generator.test.ts" },
|
|
11
|
+
"integration": { "required": true, "covered": true, "file": "integration.test.ts" },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
import type { GenerationResult, ResolvedPluginOptions } from './types';
|
|
17
|
+
/**
|
|
18
|
+
* Generate CSS for a set of utility class names
|
|
19
|
+
*
|
|
20
|
+
* Processes each utility by:
|
|
21
|
+
* 1. Attempting a direct pattern match on the full class name
|
|
22
|
+
* 2. If the class has a variant prefix (e.g., `hover:u-bg-primary`),
|
|
23
|
+
* matching the base utility and wrapping with the variant
|
|
24
|
+
*
|
|
25
|
+
* Output is grouped by category in a deterministic order.
|
|
26
|
+
*
|
|
27
|
+
* @param utilities - Set of utility class names to generate CSS for
|
|
28
|
+
* @param _options - Resolved plugin options (reserved for future use)
|
|
29
|
+
* @returns GenerationResult with CSS string, matched/unknown sets, and stats
|
|
30
|
+
*/
|
|
31
|
+
/** @codexApi {"parent":"pithy.vite-plugin-design-system.generator","name":"generateCSS","stability":"experimental","signature":"(utilities: Set<string>, options: ResolvedPluginOptions) => GenerationResult"} */
|
|
32
|
+
export declare function generateCSS(utilities: Set<string>, _options: ResolvedPluginOptions): GenerationResult;
|
|
33
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/designSystemPlugin/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,KAAK,EAGV,gBAAgB,EAEhB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAyJjB;;;;;;;;;;;;;GAaG;AACH,kNAAkN;AAClN,wBAAgB,WAAW,CACzB,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,EACtB,QAAQ,EAAE,qBAAqB,GAC9B,gBAAgB,CAwIlB"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-design-system.generator",
|
|
4
|
+
"title": "CSS Generator",
|
|
5
|
+
"category": "plugin",
|
|
6
|
+
"description": "Generates CSS rules from collected utility classes, grouping output by category in deterministic order.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "experimental",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": true, "covered": true, "file": "generator.test.ts" },
|
|
11
|
+
"integration": { "required": true, "covered": true, "file": "integration.test.ts" },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
import { parseUtility, escapeSelector, isStateVariant, isModeVariant, } from './extractor';
|
|
17
|
+
import { allPatterns } from './patterns';
|
|
18
|
+
import { cssTokens } from './cssTokens';
|
|
19
|
+
/**
|
|
20
|
+
* Category output order for deterministic CSS generation
|
|
21
|
+
*/
|
|
22
|
+
const CATEGORY_ORDER = [
|
|
23
|
+
'colors',
|
|
24
|
+
'spacing',
|
|
25
|
+
'borders',
|
|
26
|
+
'typography',
|
|
27
|
+
'layout',
|
|
28
|
+
'a11y',
|
|
29
|
+
'radius',
|
|
30
|
+
'shadows',
|
|
31
|
+
'motion',
|
|
32
|
+
'iconography',
|
|
33
|
+
];
|
|
34
|
+
/**
|
|
35
|
+
* Map state variant names to CSS pseudo-class selectors
|
|
36
|
+
*/
|
|
37
|
+
const STATE_PSEUDO_MAP = {
|
|
38
|
+
hover: ':hover',
|
|
39
|
+
focus: ':focus',
|
|
40
|
+
'focus-visible': ':focus-visible',
|
|
41
|
+
active: ':active',
|
|
42
|
+
disabled: ':disabled',
|
|
43
|
+
selected: "[aria-selected='true']",
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* Try to match a utility class name against all registered patterns
|
|
47
|
+
*
|
|
48
|
+
* @returns The first matching pattern and its regex match, or null
|
|
49
|
+
*/
|
|
50
|
+
function matchUtility(utility, patterns) {
|
|
51
|
+
for (const pattern of patterns) {
|
|
52
|
+
const match = utility.match(pattern.pattern);
|
|
53
|
+
if (match) {
|
|
54
|
+
return { pattern, match };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Regex that matches a base class selector token (`.u-foo`)
|
|
61
|
+
* plus any trailing pseudo-classes/attribute selectors.
|
|
62
|
+
*
|
|
63
|
+
* Captures:
|
|
64
|
+
* [0] full match (e.g. `.u-ring:focus-visible`)
|
|
65
|
+
* [1] pseudo/attr suffix (e.g. `:focus-visible`) or empty string
|
|
66
|
+
*/
|
|
67
|
+
function selectorTokenRegex(baseUtility) {
|
|
68
|
+
// Escape regex-special chars in the class name (hyphens are safe)
|
|
69
|
+
const escaped = baseUtility.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
70
|
+
// After the class name, optionally match pseudo-classes (`:foo`, `:foo-bar`)
|
|
71
|
+
// and attribute selectors (`[...]`). Stop at whitespace, comma, or `{`.
|
|
72
|
+
return new RegExp(`\\.${escaped}((?::[\\w-]+(?:\\([^)]*\\))?|\\[[^\\]]*\\])*)`, 'g');
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Rewrite selectors in generated CSS, replacing the base utility class token
|
|
76
|
+
* with the variant class and the variant's pseudo suffix.
|
|
77
|
+
*
|
|
78
|
+
* Any pseudo-classes already present on the base selector are stripped and
|
|
79
|
+
* replaced by the variant's pseudo, preventing doubled pseudo-classes like
|
|
80
|
+
* `.foo:focus-visible:not(:disabled):focus-visible`.
|
|
81
|
+
*/
|
|
82
|
+
function rewriteSelectors(baseCSS, baseUtility, escapedFull, selectorSuffix) {
|
|
83
|
+
const re = selectorTokenRegex(baseUtility);
|
|
84
|
+
return baseCSS.replace(re, `.${escapedFull}${selectorSuffix}`);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Wrap generated base CSS with a state variant pseudo-class
|
|
88
|
+
*
|
|
89
|
+
* Rewrites every selector that references the base utility, replacing the
|
|
90
|
+
* class name with the escaped variant class and appending the variant's
|
|
91
|
+
* pseudo-class. Any pseudo-classes already present on the base selector
|
|
92
|
+
* (e.g. `:focus`, `:focus-visible` from ring patterns) are stripped first
|
|
93
|
+
* to avoid doubled pseudo-classes.
|
|
94
|
+
*
|
|
95
|
+
* For `disabled`, no `:not(:disabled)` guard is needed.
|
|
96
|
+
* For `selected`, uses `[aria-selected='true']` attribute selector.
|
|
97
|
+
* For all others, appends `:pseudo:not(:disabled)`.
|
|
98
|
+
*
|
|
99
|
+
* Handles complex selectors like `.u-stack-md > * + *` by replacing
|
|
100
|
+
* only the base class portion of the selector.
|
|
101
|
+
*/
|
|
102
|
+
function wrapWithStateVariant(fullClassName, baseUtility, variant, baseCSS) {
|
|
103
|
+
const escapedFull = escapeSelector(fullClassName);
|
|
104
|
+
const pseudo = STATE_PSEUDO_MAP[variant];
|
|
105
|
+
if (!pseudo)
|
|
106
|
+
return baseCSS;
|
|
107
|
+
// Build the replacement selector suffix
|
|
108
|
+
let selectorSuffix;
|
|
109
|
+
if (variant === 'disabled') {
|
|
110
|
+
selectorSuffix = `${pseudo}`;
|
|
111
|
+
}
|
|
112
|
+
else if (variant === 'selected') {
|
|
113
|
+
selectorSuffix = `${pseudo}`;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
selectorSuffix = `${pseudo}:not(:disabled)`;
|
|
117
|
+
}
|
|
118
|
+
return rewriteSelectors(baseCSS, baseUtility, escapedFull, selectorSuffix);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Wrap generated base CSS with a mode variant (dark/light theme)
|
|
122
|
+
*
|
|
123
|
+
* Rewrites every selector that references the base utility, replacing the
|
|
124
|
+
* class name with the escaped variant class and prepending the theme scope.
|
|
125
|
+
* Any pseudo-classes already present on the base selector are preserved.
|
|
126
|
+
*/
|
|
127
|
+
function wrapWithModeVariant(fullClassName, baseUtility, variant, baseCSS) {
|
|
128
|
+
const escapedFull = escapeSelector(fullClassName);
|
|
129
|
+
const re = selectorTokenRegex(baseUtility);
|
|
130
|
+
return baseCSS.replace(re, (_match, pseudoSuffix) => {
|
|
131
|
+
return `[data-theme="${variant}"] .${escapedFull}${pseudoSuffix}`;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Generate CSS for a set of utility class names
|
|
136
|
+
*
|
|
137
|
+
* Processes each utility by:
|
|
138
|
+
* 1. Attempting a direct pattern match on the full class name
|
|
139
|
+
* 2. If the class has a variant prefix (e.g., `hover:u-bg-primary`),
|
|
140
|
+
* matching the base utility and wrapping with the variant
|
|
141
|
+
*
|
|
142
|
+
* Output is grouped by category in a deterministic order.
|
|
143
|
+
*
|
|
144
|
+
* @param utilities - Set of utility class names to generate CSS for
|
|
145
|
+
* @param _options - Resolved plugin options (reserved for future use)
|
|
146
|
+
* @returns GenerationResult with CSS string, matched/unknown sets, and stats
|
|
147
|
+
*/
|
|
148
|
+
/** @codexApi {"parent":"pithy.vite-plugin-design-system.generator","name":"generateCSS","stability":"experimental","signature":"(utilities: Set<string>, options: ResolvedPluginOptions) => GenerationResult"} */
|
|
149
|
+
export function generateCSS(utilities, _options) {
|
|
150
|
+
const matched = new Set();
|
|
151
|
+
const unknown = new Set();
|
|
152
|
+
const byCategory = {};
|
|
153
|
+
const cssBlocks = new Map();
|
|
154
|
+
const sortedUtilities = [...utilities].sort();
|
|
155
|
+
for (const className of sortedUtilities) {
|
|
156
|
+
// 1. Try direct match on the full class name
|
|
157
|
+
// This handles design-system conventions like `u-hover:bg-primary`
|
|
158
|
+
// where state is embedded in the utility name
|
|
159
|
+
const directResult = matchUtility(className, allPatterns);
|
|
160
|
+
if (directResult) {
|
|
161
|
+
// External patterns are recognized as valid but CSS is provided elsewhere (e.g. SCSS)
|
|
162
|
+
if (directResult.pattern.external) {
|
|
163
|
+
matched.add(className);
|
|
164
|
+
const cat = directResult.pattern.category;
|
|
165
|
+
byCategory[cat] = (byCategory[cat] || 0) + 1;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const css = directResult.pattern.generate(className, directResult.match);
|
|
169
|
+
if (css) {
|
|
170
|
+
matched.add(className);
|
|
171
|
+
const cat = directResult.pattern.category;
|
|
172
|
+
byCategory[cat] = (byCategory[cat] || 0) + 1;
|
|
173
|
+
if (!cssBlocks.has(cat))
|
|
174
|
+
cssBlocks.set(cat, []);
|
|
175
|
+
cssBlocks.get(cat).push(css);
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
// 2. If the class has a variant prefix, try matching the base utility
|
|
180
|
+
// This handles prefix variants like `hover:u-bg-primary`
|
|
181
|
+
const parsed = parseUtility(className);
|
|
182
|
+
if (parsed.variant) {
|
|
183
|
+
const baseResult = matchUtility(parsed.utility, allPatterns);
|
|
184
|
+
if (baseResult) {
|
|
185
|
+
// External patterns (SCSS-provided) don't support variant prefixes —
|
|
186
|
+
// the SCSS doesn't generate hover:/dark: scoped versions.
|
|
187
|
+
// Treat variant-prefixed externals as unknown so missing styles
|
|
188
|
+
// don't fail silently.
|
|
189
|
+
if (baseResult.pattern.external) {
|
|
190
|
+
unknown.add(className);
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
const baseCSS = baseResult.pattern.generate(parsed.utility, baseResult.match);
|
|
194
|
+
if (baseCSS) {
|
|
195
|
+
let wrappedCSS = null;
|
|
196
|
+
if (isStateVariant(parsed.variant)) {
|
|
197
|
+
wrappedCSS = wrapWithStateVariant(className, parsed.utility, parsed.variant, baseCSS);
|
|
198
|
+
}
|
|
199
|
+
else if (isModeVariant(parsed.variant)) {
|
|
200
|
+
wrappedCSS = wrapWithModeVariant(className, parsed.utility, parsed.variant, baseCSS);
|
|
201
|
+
}
|
|
202
|
+
if (wrappedCSS) {
|
|
203
|
+
matched.add(className);
|
|
204
|
+
const cat = baseResult.pattern.category;
|
|
205
|
+
byCategory[cat] = (byCategory[cat] || 0) + 1;
|
|
206
|
+
if (!cssBlocks.has(cat))
|
|
207
|
+
cssBlocks.set(cat, []);
|
|
208
|
+
cssBlocks.get(cat).push(wrappedCSS);
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
// 3. No match found
|
|
215
|
+
unknown.add(className);
|
|
216
|
+
}
|
|
217
|
+
// Build final CSS grouped by category
|
|
218
|
+
const parts = [];
|
|
219
|
+
parts.push(`/**
|
|
220
|
+
* Pithy Design System - Generated Utilities
|
|
221
|
+
*
|
|
222
|
+
* Auto-generated by @pithyjs/vite-plugin designSystemPlugin.
|
|
223
|
+
* Only utilities used in your source files are included.
|
|
224
|
+
*
|
|
225
|
+
* ${matched.size} matched, ${unknown.size} unknown out of ${utilities.size} total
|
|
226
|
+
*/`);
|
|
227
|
+
// Emit CSS custom property tokens for categories that need them.
|
|
228
|
+
// Categories like "layout" are CSS-only (no runtime manager) so their
|
|
229
|
+
// tokens (--blur-*, --z-*) must come from the generated stylesheet.
|
|
230
|
+
const emittedTokenCategories = new Set();
|
|
231
|
+
for (const category of CATEGORY_ORDER) {
|
|
232
|
+
if (cssBlocks.has(category) && cssTokens[category]) {
|
|
233
|
+
parts.push(`\n/* --- ${category} tokens --- */`);
|
|
234
|
+
parts.push(cssTokens[category]);
|
|
235
|
+
emittedTokenCategories.add(category);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
for (const category of CATEGORY_ORDER) {
|
|
239
|
+
const blocks = cssBlocks.get(category);
|
|
240
|
+
if (blocks && blocks.length > 0) {
|
|
241
|
+
parts.push(`\n/* --- ${category} --- */`);
|
|
242
|
+
parts.push(blocks.sort().join('\n\n'));
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
const css = parts.join('\n') + '\n';
|
|
246
|
+
const cssBytes = new TextEncoder().encode(css).length;
|
|
247
|
+
const stats = {
|
|
248
|
+
total: utilities.size,
|
|
249
|
+
matched: matched.size,
|
|
250
|
+
unknown: unknown.size,
|
|
251
|
+
byCategory,
|
|
252
|
+
cssBytes,
|
|
253
|
+
};
|
|
254
|
+
return { css, matched, unknown, stats };
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../src/designSystemPlugin/generator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AASF,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;GAEG;AACH,MAAM,cAAc,GAAsB;IACxC,QAAQ;IACR,SAAS;IACT,SAAS;IACT,YAAY;IACZ,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,SAAS;IACT,QAAQ;IACR,aAAa;CACd,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAA2B;IAC/C,KAAK,EAAE,QAAQ;IACf,KAAK,EAAE,QAAQ;IACf,eAAe,EAAE,gBAAgB;IACjC,MAAM,EAAE,SAAS;IACjB,QAAQ,EAAE,WAAW;IACrB,QAAQ,EAAE,wBAAwB;CACnC,CAAC;AAEF;;;;GAIG;AACH,SAAS,YAAY,CACnB,OAAe,EACf,QAA0B;IAE1B,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5B,CAAC;IACH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": "Public entry point re-exporting the design system Vite plugin and its types.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "experimental",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": false, "covered": false },
|
|
11
|
+
"integration": { "required": true, "covered": false },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
export { designSystemPlugin } from './plugin';
|
|
17
|
+
export type { DesignSystemPluginOptions, GenerationResult } from './types';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/designSystemPlugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAGF,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAG9C,YAAY,EAAE,yBAAyB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-design-system.exports",
|
|
4
|
+
"title": "Design System Plugin Exports",
|
|
5
|
+
"category": "plugin",
|
|
6
|
+
"description": "Public entry point re-exporting the design system Vite plugin and its types.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "experimental",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": false, "covered": false },
|
|
11
|
+
"integration": { "required": true, "covered": false },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
// Main plugin export
|
|
17
|
+
export { designSystemPlugin } from './plugin';
|
|
18
|
+
// Virtual module ID (for documentation)
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/designSystemPlugin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,qBAAqB;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAK9C,wCAAwC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-design-system.patterns.a11y",
|
|
4
|
+
"title": "Accessibility Utility Patterns",
|
|
5
|
+
"category": "plugin",
|
|
6
|
+
"description": "Accessibility utility pattern generator (focus-visible, sr-only, etc.).",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "experimental",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": true, "covered": true, "file": "patterns.test.ts" },
|
|
11
|
+
"integration": { "required": false, "covered": false },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
import type { UtilityPattern } from '../types';
|
|
17
|
+
export declare const CONTROL_SIZES: readonly ["sm", "md", "lg"];
|
|
18
|
+
export declare const a11yPatterns: UtilityPattern[];
|
|
19
|
+
//# sourceMappingURL=a11y.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"a11y.d.ts","sourceRoot":"","sources":["../../../src/designSystemPlugin/patterns/a11y.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAI/C,eAAO,MAAM,aAAa,6BAA8B,CAAC;AAIzD,eAAO,MAAM,YAAY,EAAE,cAAc,EA0NxC,CAAC"}
|