@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 @@
|
|
|
1
|
+
{"version":3,"file":"collector.d.ts","sourceRoot":"","sources":["../../src/designSystemPlugin/collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA4E3D;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gCAAgC;IAChC,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAClC,6DAA6D;IAC7D,oBAAoB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,2CAA2C;IAC3C,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3D,kCAAkC;IAClC,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC;IAC1C,uDAAuD;IACvD,eAAe,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,wCAAwC;IACxC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC5D,wBAAwB;IACxB,QAAQ,IAAI,cAAc,CAAC;IAC3B,8CAA8C;IAC9C,OAAO,IAAI,MAAM,CAAC;IAClB,sDAAsD;IACtD,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;IAC1C,oCAAoC;IACpC,KAAK,IAAI,IAAI,CAAC;CACf;AAED;;;;;;;;;;;;;GAaG;AACH,6KAA6K;AAC7K,wBAAgB,eAAe,CAAC,OAAO,GAAE,gBAAqB,GAAG,SAAS,CAqGzE"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-design-system.collector",
|
|
4
|
+
"title": "Utility Collector",
|
|
5
|
+
"category": "plugin",
|
|
6
|
+
"description": "Tracks utility class usage across source files and manages safelist expansion and cache invalidation.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "stable",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": true, "covered": true, "file": "collector.test.ts" },
|
|
11
|
+
"integration": { "required": true, "covered": true, "file": "integration.test.ts" },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
import { extractUtilities, getAllUniqueUtilities } from './extractor';
|
|
17
|
+
/**
|
|
18
|
+
* Create a hash from a set of utilities for cache invalidation
|
|
19
|
+
*/
|
|
20
|
+
function createHash(utilities) {
|
|
21
|
+
const sorted = [...utilities].sort();
|
|
22
|
+
// Simple hash - in production could use crypto
|
|
23
|
+
let hash = 0;
|
|
24
|
+
const str = sorted.join(',');
|
|
25
|
+
for (let i = 0; i < str.length; i++) {
|
|
26
|
+
const char = str.charCodeAt(i);
|
|
27
|
+
hash = (hash << 5) - hash + char;
|
|
28
|
+
hash = hash & hash; // Convert to 32bit integer
|
|
29
|
+
}
|
|
30
|
+
return hash.toString(16);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Expand safelist patterns to match utilities
|
|
34
|
+
*/
|
|
35
|
+
function expandSafelist(safelist, allPossibleUtilities) {
|
|
36
|
+
const result = new Set();
|
|
37
|
+
for (const item of safelist) {
|
|
38
|
+
if (typeof item === 'string') {
|
|
39
|
+
// Direct string - add as-is
|
|
40
|
+
result.add(item);
|
|
41
|
+
}
|
|
42
|
+
else if (item instanceof RegExp && allPossibleUtilities) {
|
|
43
|
+
// RegExp - match against known utilities
|
|
44
|
+
for (const utility of allPossibleUtilities) {
|
|
45
|
+
if (item.test(utility)) {
|
|
46
|
+
result.add(utility);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Compute the difference between two sets of utilities
|
|
55
|
+
*/
|
|
56
|
+
function computeDiff(oldUtilities, newUtilities) {
|
|
57
|
+
const added = new Set();
|
|
58
|
+
const removed = new Set();
|
|
59
|
+
// Find added utilities
|
|
60
|
+
for (const utility of newUtilities) {
|
|
61
|
+
if (!oldUtilities.has(utility)) {
|
|
62
|
+
added.add(utility);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Find removed utilities
|
|
66
|
+
for (const utility of oldUtilities) {
|
|
67
|
+
if (!newUtilities.has(utility)) {
|
|
68
|
+
removed.add(utility);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
added,
|
|
73
|
+
removed,
|
|
74
|
+
hasChanges: added.size > 0 || removed.size > 0,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Create a utility collector for tracking utility classes across files
|
|
79
|
+
*
|
|
80
|
+
* @param options - Collector options
|
|
81
|
+
* @returns Collector instance
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* const collector = createCollector({
|
|
85
|
+
* safelist: ['u-bg-success', /^u-text-(primary|secondary)$/]
|
|
86
|
+
* });
|
|
87
|
+
*
|
|
88
|
+
* collector.updateFile('src/App.ts', fileContent);
|
|
89
|
+
* const allUtilities = collector.getAllUtilities();
|
|
90
|
+
*/
|
|
91
|
+
/** @codexApi {"parent":"pithy.vite-plugin-design-system.collector","name":"createCollector","stability":"stable","signature":"(options?: CollectorOptions) => Collector"} */
|
|
92
|
+
export function createCollector(options = {}) {
|
|
93
|
+
const { safelist = [], allPossibleUtilities } = options;
|
|
94
|
+
// State
|
|
95
|
+
const fileUtilities = new Map();
|
|
96
|
+
let cachedAllUtilities = null;
|
|
97
|
+
let cachedHash = null;
|
|
98
|
+
// Expand safelist once
|
|
99
|
+
const safelistedUtilities = expandSafelist(safelist, allPossibleUtilities);
|
|
100
|
+
/**
|
|
101
|
+
* Invalidate caches when utilities change
|
|
102
|
+
*/
|
|
103
|
+
function invalidateCache() {
|
|
104
|
+
cachedAllUtilities = null;
|
|
105
|
+
cachedHash = null;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Recompute all utilities from file map + safelist
|
|
109
|
+
*/
|
|
110
|
+
function recomputeAllUtilities() {
|
|
111
|
+
const all = getAllUniqueUtilities(fileUtilities);
|
|
112
|
+
// Add safelisted utilities
|
|
113
|
+
for (const utility of safelistedUtilities) {
|
|
114
|
+
all.add(utility);
|
|
115
|
+
}
|
|
116
|
+
return all;
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
updateFile(filePath, content) {
|
|
120
|
+
const oldUtilities = fileUtilities.get(filePath) || new Set();
|
|
121
|
+
const newUtilities = extractUtilities(content);
|
|
122
|
+
// Check if there are any changes
|
|
123
|
+
const diff = computeDiff(oldUtilities, newUtilities);
|
|
124
|
+
if (diff.hasChanges) {
|
|
125
|
+
fileUtilities.set(filePath, newUtilities);
|
|
126
|
+
invalidateCache();
|
|
127
|
+
}
|
|
128
|
+
return diff;
|
|
129
|
+
},
|
|
130
|
+
removeFile(filePath) {
|
|
131
|
+
const oldUtilities = fileUtilities.get(filePath) || new Set();
|
|
132
|
+
if (fileUtilities.has(filePath)) {
|
|
133
|
+
fileUtilities.delete(filePath);
|
|
134
|
+
invalidateCache();
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
added: new Set(),
|
|
138
|
+
removed: oldUtilities,
|
|
139
|
+
hasChanges: oldUtilities.size > 0,
|
|
140
|
+
};
|
|
141
|
+
},
|
|
142
|
+
getAllUtilities() {
|
|
143
|
+
if (!cachedAllUtilities) {
|
|
144
|
+
cachedAllUtilities = recomputeAllUtilities();
|
|
145
|
+
}
|
|
146
|
+
return cachedAllUtilities;
|
|
147
|
+
},
|
|
148
|
+
getFileUtilities(filePath) {
|
|
149
|
+
return fileUtilities.get(filePath);
|
|
150
|
+
},
|
|
151
|
+
getState() {
|
|
152
|
+
const all = this.getAllUtilities();
|
|
153
|
+
return {
|
|
154
|
+
fileUtilities: new Map(fileUtilities),
|
|
155
|
+
allUtilities: new Set(all),
|
|
156
|
+
safelistedUtilities: new Set(safelistedUtilities),
|
|
157
|
+
hash: this.getHash(),
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
getHash() {
|
|
161
|
+
if (!cachedHash) {
|
|
162
|
+
cachedHash = createHash(this.getAllUtilities());
|
|
163
|
+
}
|
|
164
|
+
return cachedHash;
|
|
165
|
+
},
|
|
166
|
+
hasChanged(previousHash) {
|
|
167
|
+
return this.getHash() !== previousHash;
|
|
168
|
+
},
|
|
169
|
+
clear() {
|
|
170
|
+
fileUtilities.clear();
|
|
171
|
+
invalidateCache();
|
|
172
|
+
},
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collector.js","sourceRoot":"","sources":["../../src/designSystemPlugin/collector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAGF,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEtE;;GAEG;AACH,SAAS,UAAU,CAAC,SAAsB;IACxC,MAAM,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,IAAI,EAAE,CAAC;IACrC,+CAA+C;IAC/C,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;QACjC,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,2BAA2B;IACjD,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH,SAAS,cAAc,CACrB,QAAgC,EAChC,oBAAkC;IAElC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC;IAEjC,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC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
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-design-system.css-tokens",
|
|
4
|
+
"title": "Design System CSS Token Definitions",
|
|
5
|
+
"category": "types",
|
|
6
|
+
"description": "Static CSS token maps and design system value definitions used by the CSS generator.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "experimental",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": false, "covered": false },
|
|
11
|
+
"integration": { "required": true, "covered": true, "file": "integration.test.ts" },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* CSS custom property tokens for categories that are CSS-only
|
|
18
|
+
* (no runtime manager in initDesignSystem).
|
|
19
|
+
*
|
|
20
|
+
* When the JIT generator detects utilities from these categories,
|
|
21
|
+
* it emits the corresponding :root block so the CSS variables
|
|
22
|
+
* referenced by the utility classes are actually defined.
|
|
23
|
+
*
|
|
24
|
+
* Categories with runtime managers (colors, shadows, radius, borders,
|
|
25
|
+
* spacing, motion, a11y, iconography) inject their tokens via JS
|
|
26
|
+
* and do NOT need entries here.
|
|
27
|
+
*/
|
|
28
|
+
import type { UtilityCategory } from './types';
|
|
29
|
+
/**
|
|
30
|
+
* Map of category → token CSS to emit when utilities from that category are used.
|
|
31
|
+
* Only CSS-only categories (no runtime manager) need entries here.
|
|
32
|
+
*/
|
|
33
|
+
export declare const cssTokens: Partial<Record<UtilityCategory, string>>;
|
|
34
|
+
//# sourceMappingURL=cssTokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cssTokens.d.ts","sourceRoot":"","sources":["../../src/designSystemPlugin/cssTokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAEF;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAyC/C;;;GAGG;AACH,eAAO,MAAM,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAE9D,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/** @codex
|
|
2
|
+
{
|
|
3
|
+
"id": "pithy.vite-plugin-design-system.css-tokens",
|
|
4
|
+
"title": "Design System CSS Token Definitions",
|
|
5
|
+
"category": "types",
|
|
6
|
+
"description": "Static CSS token maps and design system value definitions used by the CSS generator.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "experimental",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": false, "covered": false },
|
|
11
|
+
"integration": { "required": true, "covered": true, "file": "integration.test.ts" },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
import { Z_LAYERS, Z_OFFSETS, BLUR_LEVELS } from './patterns/layout';
|
|
17
|
+
function generateLayoutTokens() {
|
|
18
|
+
const lines = [':root {'];
|
|
19
|
+
// Z-index tokens
|
|
20
|
+
for (const [name, value] of Object.entries(Z_LAYERS)) {
|
|
21
|
+
lines.push(` --z-${name}: ${value};`);
|
|
22
|
+
}
|
|
23
|
+
for (const [name, value] of Object.entries(Z_OFFSETS)) {
|
|
24
|
+
lines.push(` --z-${name}: ${value};`);
|
|
25
|
+
}
|
|
26
|
+
// Blur tokens
|
|
27
|
+
for (const [name, value] of Object.entries(BLUR_LEVELS)) {
|
|
28
|
+
lines.push(` --blur-${name}: ${value};`);
|
|
29
|
+
}
|
|
30
|
+
// Semantic blur aliases
|
|
31
|
+
lines.push(` --blur-content: 4px;`);
|
|
32
|
+
lines.push(` --blur-backdrop: var(--blur-md);`);
|
|
33
|
+
lines.push(` --blur-glass: var(--blur-lg);`);
|
|
34
|
+
lines.push('}');
|
|
35
|
+
// Reduced motion override for blur
|
|
36
|
+
lines.push('');
|
|
37
|
+
lines.push('@media (prefers-reduced-motion: reduce) {');
|
|
38
|
+
lines.push(' :root {');
|
|
39
|
+
for (const name of Object.keys(BLUR_LEVELS)) {
|
|
40
|
+
lines.push(` --blur-${name}: 0px;`);
|
|
41
|
+
}
|
|
42
|
+
lines.push(' --blur-content: 0px;');
|
|
43
|
+
lines.push(' --blur-backdrop: 0px;');
|
|
44
|
+
lines.push(' --blur-glass: 0px;');
|
|
45
|
+
lines.push(' }');
|
|
46
|
+
lines.push('}');
|
|
47
|
+
return lines.join('\n');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Map of category → token CSS to emit when utilities from that category are used.
|
|
51
|
+
* Only CSS-only categories (no runtime manager) need entries here.
|
|
52
|
+
*/
|
|
53
|
+
export const cssTokens = {
|
|
54
|
+
layout: generateLayoutTokens(),
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=cssTokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cssTokens.js","sourceRoot":"","sources":["../../src/designSystemPlugin/cssTokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAgBF,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErE,SAAS,oBAAoB;IAC3B,MAAM,KAAK,GAAa,CAAC,SAAS,CAAC,CAAC;IAEpC,iBAAiB;IACjB,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrD,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC;IACzC,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACtD,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC;IACzC,CAAC;IAED,cAAc;IACd,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC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ugin",
|
|
6
|
+
"description": "Enumerates all possible utility class names from the design system token definitions.",
|
|
7
|
+
"since": "0.0.1",
|
|
8
|
+
"stability": "experimental",
|
|
9
|
+
"testing": {
|
|
10
|
+
"unit": { "required": false, "covered": false },
|
|
11
|
+
"integration": { "required": true, "covered": true, "file": "integration.test.ts" },
|
|
12
|
+
"e2e": { "required": false, "covered": false }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Enumerate all possible utility class names from the design system tokens.
|
|
18
|
+
*
|
|
19
|
+
* Used to generate "full" CSS for bundle size comparison against tree-shaken output.
|
|
20
|
+
* This is computed once and cached.
|
|
21
|
+
*/
|
|
22
|
+
/** @codexApi {"parent":"pithy.vite-plugin-design-system.enumerate","name":"enumerateAllUtilities","stability":"experimental","signature":"() => Set<string>"} */
|
|
23
|
+
export declare function enumerateAllUtilities(): Set<string>;
|
|
24
|
+
//# sourceMappingURL=enumerate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enumerate.d.ts","sourceRoot":"","sources":["../../src/designSystemPlugin/enumerate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;EAcE;AAoEF;;;;;GAKG;AACH,iKAAiK;AACjK,wBAAgB,qBAAqB,IAAI,GAAG,CAAC,MAAM,CAAC,CAuZnD"}
|