@animus-ui/vite-plugin 0.1.0-next.1 → 0.1.0-next.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +34 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +203 -168
- package/dist/theme-evaluator.d.ts +3 -2
- package/dist/theme-evaluator.d.ts.map +1 -1
- package/package.json +4 -3
- package/dist/config-serializer.d.ts +0 -25
- package/dist/config-serializer.d.ts.map +0 -1
- package/dist/resolve-transforms.d.ts +0 -14
- package/dist/resolve-transforms.d.ts.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,48 +1,12 @@
|
|
|
1
1
|
import type { Plugin } from 'vite';
|
|
2
2
|
export interface AnimusExtractOptions {
|
|
3
|
-
/**
|
|
4
|
-
* Theme data for the extraction pipeline.
|
|
5
|
-
*
|
|
6
|
-
* Two forms are accepted:
|
|
7
|
-
* - `string` — pre-serialized flat JSON (legacy; no CSS variable emission)
|
|
8
|
-
* - `{ scales: string; variables: string }` — pre-evaluated scales JSON
|
|
9
|
-
* plus fully-formed CSS variable declarations to prepend to the virtual
|
|
10
|
-
* stylesheet. The caller is responsible for evaluating the theme module
|
|
11
|
-
* (e.g. via `evaluateTheme` or a Bun subprocess) before passing it here.
|
|
12
|
-
*
|
|
13
|
-
* When omitted, the plugin auto-detects `src/theme.ts`, `src/theme.js`,
|
|
14
|
-
* `theme.ts`, or `theme.js` relative to the project root.
|
|
15
|
-
*/
|
|
16
|
-
theme?: string | {
|
|
17
|
-
scales: string;
|
|
18
|
-
variables: string;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Explicit path to the theme module (relative to project root or absolute).
|
|
22
|
-
* Takes precedence over auto-detection, but lower priority than `theme`.
|
|
23
|
-
*/
|
|
24
|
-
themePath?: string;
|
|
25
3
|
/**
|
|
26
4
|
* Path to a module exporting a SystemInstance from `@animus-ui/system`.
|
|
27
5
|
* The module is loaded via a single bun subprocess at build start.
|
|
28
|
-
*
|
|
29
|
-
|
|
30
|
-
system?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Path to a module exporting `getExtractConfig()`. The module is loaded via
|
|
33
|
-
* bun subprocess at build start. Use this for custom Animus instances created
|
|
34
|
-
* with `createAnimus().addGroup(...).build()`.
|
|
35
|
-
*
|
|
36
|
-
* When omitted, automatically imported from `@animus-ui/core`.
|
|
37
|
-
*/
|
|
38
|
-
configPath?: string;
|
|
39
|
-
/**
|
|
40
|
-
* Pre-serialized prop config JSON. When omitted, automatically imported from
|
|
41
|
-
* `@animus-ui/core` via `getExtractConfig()`.
|
|
6
|
+
* It provides prop config, group registry, theme tokens, transforms,
|
|
7
|
+
* and global styles — everything the extraction pipeline needs.
|
|
42
8
|
*/
|
|
43
|
-
|
|
44
|
-
/** Pre-serialized group registry JSON. Maps group names to prop name arrays. */
|
|
45
|
-
groupRegistry?: string;
|
|
9
|
+
system: string;
|
|
46
10
|
/** Glob patterns to include. Defaults to .ts/.tsx/.js/.jsx files. */
|
|
47
11
|
include?: string[];
|
|
48
12
|
/** Glob patterns to exclude. */
|
|
@@ -53,8 +17,38 @@ export interface AnimusExtractOptions {
|
|
|
53
17
|
strict?: boolean;
|
|
54
18
|
/** Enable verbose logging. Also activatable via ANIMUS_DEBUG=1 env var. */
|
|
55
19
|
verbose?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Browser targets for CSS autoprefixing and syntax lowering.
|
|
22
|
+
* Accepts a browserslist query string or array of queries.
|
|
23
|
+
* Falls back to project's browserslist config, then to `defaults`.
|
|
24
|
+
*/
|
|
25
|
+
targets?: string | string[];
|
|
26
|
+
/**
|
|
27
|
+
* Control CSS minification.
|
|
28
|
+
* - `true`: always minify (dev + prod)
|
|
29
|
+
* - `false`: never minify (autoprefixing still applies)
|
|
30
|
+
* - `undefined` (default): minify in prod only
|
|
31
|
+
*/
|
|
32
|
+
minify?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Namespace prefix for CSS variables and class names.
|
|
35
|
+
* When set, all generated CSS variables become `--{prefix}-{name}`
|
|
36
|
+
* and class names become `{prefix}-{Component}-{hash}`.
|
|
37
|
+
* Defaults to no prefix.
|
|
38
|
+
*/
|
|
39
|
+
prefix?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Full `@layer` declaration order. Must include all 7 Animus layers
|
|
42
|
+
* (global, base, variants, states, system, custom) as a subsequence
|
|
43
|
+
* in their required order. Consumer layers may be interleaved around them.
|
|
44
|
+
*
|
|
45
|
+
* Example: `['reset', 'global', 'base', 'variants', 'states', 'system', 'custom', 'overrides']`
|
|
46
|
+
*
|
|
47
|
+
* When omitted, defaults to the 7 Animus layers.
|
|
48
|
+
*/
|
|
49
|
+
layers?: string[];
|
|
56
50
|
}
|
|
57
|
-
export declare function animusExtract(options
|
|
51
|
+
export declare function animusExtract(options: AnimusExtractOptions): Plugin;
|
|
58
52
|
export { evaluateTheme, evaluateThemeObject } from './theme-evaluator';
|
|
59
53
|
export default animusExtract;
|
|
60
54
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAU,MAAM,EAAE,MAAM,MAAM,CAAC;AAM3C,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,MAAM,EAAE,MAAM,CAAC;IACf,qEAAqE;IACrE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,gCAAgC;IAChC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,8FAA8F;IAC9F,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,qGAAqG;IACrG,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAwUD,wBAAgB,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,CA45BnE;AAED,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACvE,eAAe,aAAa,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,8 @@ import { existsSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileS
|
|
|
5
5
|
import { tmpdir } from "os";
|
|
6
6
|
import { dirname, extname, join, relative, resolve } from "path";
|
|
7
7
|
import { fileURLToPath } from "url";
|
|
8
|
+
import browserslist from "browserslist";
|
|
9
|
+
import { browserslistToTargets, transform } from "lightningcss";
|
|
8
10
|
//#region \0rolldown/runtime.js
|
|
9
11
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
10
12
|
//#endregion
|
|
@@ -12,10 +14,24 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
12
14
|
/**
|
|
13
15
|
* Evaluate a theme object that has already been loaded/imported.
|
|
14
16
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* If the theme has a `.manifest` property (from ThemeBuilder.build()),
|
|
18
|
+
* reads structured data directly — no re-flattening or var() pattern-matching.
|
|
19
|
+
* Falls back to legacy path for themes without manifests.
|
|
17
20
|
*/
|
|
18
21
|
function evaluateThemeObject(theme) {
|
|
22
|
+
if (theme.manifest && typeof theme.manifest === "object") {
|
|
23
|
+
const manifest = theme.manifest;
|
|
24
|
+
return {
|
|
25
|
+
scalesJson: JSON.stringify(manifest.tokenMap),
|
|
26
|
+
variableMapJson: JSON.stringify(manifest.variableMap),
|
|
27
|
+
variableCss: manifest.variableCss
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
console.warn("[animus] Theme has no .manifest property — using legacy evaluation. Update to @animus-ui/system >=0.2.0 for structured manifest support.");
|
|
31
|
+
return evaluateThemeObjectLegacy(theme);
|
|
32
|
+
}
|
|
33
|
+
/** Legacy theme evaluation — flattens theme and pattern-matches var() strings. */
|
|
34
|
+
function evaluateThemeObjectLegacy(theme) {
|
|
19
35
|
const flat = {};
|
|
20
36
|
for (const [scaleName, scaleValue] of Object.entries(theme)) {
|
|
21
37
|
if (scaleName.startsWith("_")) continue;
|
|
@@ -65,15 +81,11 @@ function buildVariableCss(theme) {
|
|
|
65
81
|
}
|
|
66
82
|
if (rootLines.length > 0) parts.push(`:root {\n${rootLines.join("\n")}\n}`);
|
|
67
83
|
}
|
|
68
|
-
if (theme._tokens?.modes != null && typeof theme._tokens.modes === "object") {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const modeLines = [];
|
|
74
|
-
flattenModeTokens(modeLines, modeTokens, "");
|
|
75
|
-
if (modeLines.length > 0) parts.push(`[data-color-mode="${modeName}"] {\n${modeLines.join("\n")}\n}`);
|
|
76
|
-
}
|
|
84
|
+
if (theme._tokens?.modes != null && typeof theme._tokens.modes === "object") for (const [modeName, modeTokens] of Object.entries(theme._tokens.modes)) {
|
|
85
|
+
if (modeTokens == null || typeof modeTokens !== "object") continue;
|
|
86
|
+
const modeLines = [];
|
|
87
|
+
flattenModeTokens(modeLines, modeTokens, "");
|
|
88
|
+
if (modeLines.length > 0) parts.push(`[data-color-mode="${modeName}"] {\n${modeLines.join("\n")}\n}`);
|
|
77
89
|
}
|
|
78
90
|
return parts.join("\n\n");
|
|
79
91
|
}
|
|
@@ -118,6 +130,8 @@ const VIRTUAL_COMPONENTS_ID = "virtual:animus/components.js";
|
|
|
118
130
|
const RESOLVED_COMPONENTS_ID = "\0virtual:animus/components.js";
|
|
119
131
|
const VIRTUAL_BRIDGE_ID = "virtual:animus/hmr-bridge.js";
|
|
120
132
|
const RESOLVED_BRIDGE_ID = "\0virtual:animus/hmr-bridge.js";
|
|
133
|
+
const VIRTUAL_SYSTEM_PROPS_ID = "virtual:animus/system-props";
|
|
134
|
+
const RESOLVED_SYSTEM_PROPS_ID = "\0virtual:animus/system-props";
|
|
121
135
|
const DEFAULT_EXTENSIONS = new Set([
|
|
122
136
|
".ts",
|
|
123
137
|
".tsx",
|
|
@@ -154,24 +168,6 @@ function discoverFiles(dir, rootDir, excludePatterns) {
|
|
|
154
168
|
return results;
|
|
155
169
|
}
|
|
156
170
|
/**
|
|
157
|
-
* Apply transform placeholders emitted by the Rust pipeline.
|
|
158
|
-
*
|
|
159
|
-
* Rust emits `__TRANSFORM__name__rawValue__` for props with transforms.
|
|
160
|
-
* This function resolves each placeholder using the actual JS transform
|
|
161
|
-
* functions from the config.
|
|
162
|
-
*/
|
|
163
|
-
function applyTransformPlaceholders(css, transformRegistry) {
|
|
164
|
-
return css.replace(/__TRANSFORM__(\w+)__(.+?)__/g, (_match, name, rawValue) => {
|
|
165
|
-
const fn = transformRegistry.get(name);
|
|
166
|
-
if (!fn) {
|
|
167
|
-
console.warn(`[animus-extract] Unknown transform: "${name}" — using raw value`);
|
|
168
|
-
return rawValue;
|
|
169
|
-
}
|
|
170
|
-
const result = fn(rawValue !== "" && !isNaN(Number(rawValue)) ? Number(rawValue) : rawValue);
|
|
171
|
-
return typeof result === "object" ? JSON.stringify(result) : String(result);
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
171
|
* CSS properties that accept unitless numeric values.
|
|
176
172
|
* Matches @emotion/unitless and React DOM's style handling.
|
|
177
173
|
* Bare numerics on properties NOT in this set receive `px`.
|
|
@@ -226,7 +222,7 @@ const UNITLESS_PROPERTIES = new Set([
|
|
|
226
222
|
* Numbers inside CSS function calls (cubic-bezier, rgb, calc, etc.) are skipped.
|
|
227
223
|
*/
|
|
228
224
|
function applyUnitFallback(css) {
|
|
229
|
-
return css.replace(/([a-z-]+)\s*:\s*([^;]+);/g, (match, prop, value) => {
|
|
225
|
+
return css.replace(/([a-z-]+)\s*:\s*([^;{}]+);/g, (match, prop, value) => {
|
|
230
226
|
if (UNITLESS_PROPERTIES.has(prop)) return match;
|
|
231
227
|
let depth = 0;
|
|
232
228
|
let fixed = "";
|
|
@@ -258,6 +254,38 @@ function applyUnitFallback(css) {
|
|
|
258
254
|
return fixed !== value ? `${prop}:${fixed};` : match;
|
|
259
255
|
});
|
|
260
256
|
}
|
|
257
|
+
/**
|
|
258
|
+
* Resolve browser targets for Lightning CSS.
|
|
259
|
+
* Priority: explicit config → project browserslist → 'defaults' fallback.
|
|
260
|
+
*/
|
|
261
|
+
function resolveLightningTargets(explicitTargets, rootDir) {
|
|
262
|
+
let queries;
|
|
263
|
+
if (explicitTargets) queries = Array.isArray(explicitTargets) ? explicitTargets : [explicitTargets];
|
|
264
|
+
else {
|
|
265
|
+
const detected = browserslist(void 0, { path: rootDir });
|
|
266
|
+
queries = detected.length > 0 ? detected : browserslist("defaults");
|
|
267
|
+
}
|
|
268
|
+
return browserslistToTargets(Array.isArray(queries) && typeof queries[0] === "string" && queries[0].includes(" ") ? browserslist(queries) : queries);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Post-process CSS with Lightning CSS: autoprefixing + optional minification.
|
|
272
|
+
* On failure, returns the original CSS and logs a warning.
|
|
273
|
+
*/
|
|
274
|
+
function postProcessCss(css, opts) {
|
|
275
|
+
if (!css) return css;
|
|
276
|
+
try {
|
|
277
|
+
return transform({
|
|
278
|
+
filename: "animus-extracted.css",
|
|
279
|
+
code: Buffer.from(css),
|
|
280
|
+
minify: opts.minify,
|
|
281
|
+
targets: opts.targets
|
|
282
|
+
}).code.toString();
|
|
283
|
+
} catch (e) {
|
|
284
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
285
|
+
(opts.warnFn ?? console.warn)(`[animus] Lightning CSS post-processing failed: ${msg}`);
|
|
286
|
+
return css;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
261
289
|
/** Compute MD5 content hash for a string. */
|
|
262
290
|
function contentHash(source) {
|
|
263
291
|
return createHash("md5").update(source).digest("hex");
|
|
@@ -278,39 +306,61 @@ function buildFileEntriesFromCache(cache, changedPath) {
|
|
|
278
306
|
return entries;
|
|
279
307
|
}
|
|
280
308
|
/**
|
|
281
|
-
*
|
|
282
|
-
*
|
|
309
|
+
* Apply namespace prefix to a variable map and CSS variable declarations.
|
|
310
|
+
*
|
|
311
|
+
* Variable map: `{ "colors.ember": "--color-ember" }` → `{ "colors.ember": "--prefix-color-ember" }`
|
|
312
|
+
* Variable CSS: `--color-ember: #FF2800` → `--prefix-color-ember: #FF2800`
|
|
313
|
+
* `var(--color-ember)` → `var(--prefix-color-ember)`
|
|
283
314
|
*/
|
|
284
|
-
function
|
|
285
|
-
if (!
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
315
|
+
function applyPrefix(prefix, variableMapJson, variableCss) {
|
|
316
|
+
if (!prefix) return {
|
|
317
|
+
variableMapJson,
|
|
318
|
+
variableCss
|
|
319
|
+
};
|
|
320
|
+
const map = JSON.parse(variableMapJson);
|
|
321
|
+
const prefixed = {};
|
|
322
|
+
for (const [key, varName] of Object.entries(map)) prefixed[key] = varName.startsWith("--") ? `--${prefix}-${varName.slice(2)}` : varName;
|
|
323
|
+
let css = variableCss;
|
|
324
|
+
css = css.replace(/--([a-zA-Z][\w-]*)\s*:/g, `--${prefix}-$1:`);
|
|
325
|
+
css = css.replace(/var\(--([a-zA-Z][\w-]*)\)/g, `var(--${prefix}-$1)`);
|
|
326
|
+
return {
|
|
327
|
+
variableMapJson: JSON.stringify(prefixed),
|
|
328
|
+
variableCss: css
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* The 7 Animus cascade layers in required order.
|
|
333
|
+
* Consumer-provided `layers` must contain these as a subsequence.
|
|
334
|
+
*/
|
|
335
|
+
const ANIMUS_LAYERS = [
|
|
336
|
+
"global",
|
|
337
|
+
"base",
|
|
338
|
+
"variants",
|
|
339
|
+
"compounds",
|
|
340
|
+
"states",
|
|
341
|
+
"system",
|
|
342
|
+
"custom"
|
|
343
|
+
];
|
|
344
|
+
/**
|
|
345
|
+
* Validate that a consumer `layers` array contains all 7 Animus layers
|
|
346
|
+
* in the correct relative order. Consumer layers may be interleaved.
|
|
347
|
+
*
|
|
348
|
+
* @throws Error with descriptive message on violation
|
|
349
|
+
*/
|
|
350
|
+
function validateLayerOrder(layers) {
|
|
351
|
+
let cursor = 0;
|
|
352
|
+
for (const layer of layers) if (cursor < ANIMUS_LAYERS.length && layer === ANIMUS_LAYERS[cursor]) cursor++;
|
|
353
|
+
if (cursor < ANIMUS_LAYERS.length) {
|
|
354
|
+
const missing = ANIMUS_LAYERS.slice(cursor);
|
|
355
|
+
const found = ANIMUS_LAYERS.slice(0, cursor);
|
|
356
|
+
if (!ANIMUS_LAYERS.every((l) => layers.includes(l))) {
|
|
357
|
+
const absent = ANIMUS_LAYERS.filter((l) => !layers.includes(l));
|
|
358
|
+
throw new Error(`[animus] Invalid layers config: missing required layers: ${absent.join(", ")}. All 7 Animus layers must be present: ${ANIMUS_LAYERS.join(", ")}`);
|
|
359
|
+
}
|
|
360
|
+
throw new Error(`[animus] Invalid layers config: Animus layers must appear in order (${ANIMUS_LAYERS.join(" < ")}). Found ${found.join(", ")} in order, but ${missing.join(", ")} appeared out of sequence. Received: [${layers.join(", ")}]`);
|
|
311
361
|
}
|
|
312
362
|
}
|
|
313
|
-
function animusExtract(options
|
|
363
|
+
function animusExtract(options) {
|
|
314
364
|
let themeJson = "{}";
|
|
315
365
|
let variableMapJson = "{}";
|
|
316
366
|
let configJson = "{}";
|
|
@@ -325,106 +375,33 @@ function animusExtract(options = {}) {
|
|
|
325
375
|
function warn(msg) {
|
|
326
376
|
(logger ?? console).warn(`[animus] ${msg}`);
|
|
327
377
|
}
|
|
378
|
+
let lcssTargets = {};
|
|
328
379
|
let variableCss = "";
|
|
329
380
|
let globalCss = "";
|
|
330
|
-
let transformRegistry = /* @__PURE__ */ new Map();
|
|
331
381
|
let storedManifest = null;
|
|
332
382
|
let storedManifestJson = "";
|
|
333
383
|
let resolvedComponentCss = "";
|
|
334
384
|
let storedSheets = null;
|
|
385
|
+
let storedSystemPropMapJson = "{}";
|
|
386
|
+
let storedDynamicPropsJson = "{}";
|
|
387
|
+
let storedTransformsSource = "";
|
|
388
|
+
let layerDeclaration = "";
|
|
335
389
|
const fileCache = /* @__PURE__ */ new Map();
|
|
336
390
|
let packageMap = {};
|
|
337
391
|
let bridgeInjected = false;
|
|
338
|
-
let resolvedConfigPath = null;
|
|
339
|
-
let resolvedThemePath = null;
|
|
340
392
|
let resolvedSystemPath = null;
|
|
341
|
-
/** Resolve config via bun subprocess. Updates configJson + groupRegistryJson. */
|
|
342
|
-
function loadConfig() {
|
|
343
|
-
if (options.config) {
|
|
344
|
-
configJson = options.config;
|
|
345
|
-
groupRegistryJson = options.groupRegistry ?? groupRegistryJson;
|
|
346
|
-
return;
|
|
347
|
-
}
|
|
348
|
-
const configSource = options.configPath ? resolve(rootDir, options.configPath) : "@animus-ui/core";
|
|
349
|
-
const requireExpr = options.configPath ? `require('${configSource.replace(/\\/g, "/")}')` : `require('@animus-ui/core')`;
|
|
350
|
-
if (options.configPath) resolvedConfigPath = resolve(rootDir, options.configPath);
|
|
351
|
-
try {
|
|
352
|
-
const result = execSync(`bun -e "const m = ${requireExpr}; const r = m.getExtractConfig(); process.stdout.write(JSON.stringify(r))"`, {
|
|
353
|
-
cwd: rootDir,
|
|
354
|
-
encoding: "utf-8"
|
|
355
|
-
});
|
|
356
|
-
const { propConfig, groupRegistry } = JSON.parse(result);
|
|
357
|
-
configJson = propConfig;
|
|
358
|
-
groupRegistryJson = groupRegistry;
|
|
359
|
-
} catch (e) {
|
|
360
|
-
if (options.strict) throw new Error(`[animus-extract] Failed to auto-import config from ${configSource}: ${e}`);
|
|
361
|
-
console.warn(`[animus-extract] Failed to auto-import config from ${configSource}:`, e);
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
/** Resolve theme via bun subprocess. Updates themeJson + variableCss. */
|
|
365
|
-
function loadTheme() {
|
|
366
|
-
if (options.theme) {
|
|
367
|
-
if (typeof options.theme === "string") {
|
|
368
|
-
themeJson = options.theme;
|
|
369
|
-
variableCss = "";
|
|
370
|
-
} else {
|
|
371
|
-
themeJson = options.theme.scales;
|
|
372
|
-
variableCss = options.theme.variables;
|
|
373
|
-
}
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
resolvedThemePath = null;
|
|
377
|
-
if (options.themePath) {
|
|
378
|
-
const p = resolve(rootDir, options.themePath);
|
|
379
|
-
if (existsSync(p)) resolvedThemePath = p;
|
|
380
|
-
else if (options.strict) throw new Error(`[animus-extract] Theme file not found: ${p}`);
|
|
381
|
-
else console.warn(`[animus-extract] Theme file not found: ${p}`);
|
|
382
|
-
} else {
|
|
383
|
-
const candidates = [
|
|
384
|
-
join(rootDir, "src", "theme.ts"),
|
|
385
|
-
join(rootDir, "src", "theme.js"),
|
|
386
|
-
join(rootDir, "theme.ts"),
|
|
387
|
-
join(rootDir, "theme.js")
|
|
388
|
-
];
|
|
389
|
-
for (const candidate of candidates) if (existsSync(candidate)) {
|
|
390
|
-
resolvedThemePath = candidate;
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
if (resolvedThemePath) try {
|
|
395
|
-
const themeJson_ = execSync(`bun -e "${[
|
|
396
|
-
`const m = require(${JSON.stringify(resolvedThemePath)});`,
|
|
397
|
-
`const theme = m.theme || m.default;`,
|
|
398
|
-
`process.stdout.write(JSON.stringify(theme || {}));`
|
|
399
|
-
].join(" ").replace(/"/g, "\\\"")}"`, {
|
|
400
|
-
cwd: rootDir,
|
|
401
|
-
encoding: "utf-8"
|
|
402
|
-
});
|
|
403
|
-
const theme = JSON.parse(themeJson_);
|
|
404
|
-
if (theme && Object.keys(theme).length > 0) {
|
|
405
|
-
const result = evaluateThemeObject(theme);
|
|
406
|
-
themeJson = result.scalesJson;
|
|
407
|
-
variableMapJson = result.variableMapJson;
|
|
408
|
-
variableCss = result.variableCss;
|
|
409
|
-
}
|
|
410
|
-
} catch (e) {
|
|
411
|
-
if (options.strict) throw new Error(`[animus-extract] Failed to load theme from ${resolvedThemePath}: ${e}`);
|
|
412
|
-
console.warn(`[animus-extract] Failed to load theme from ${resolvedThemePath}:`, e);
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
393
|
/**
|
|
416
394
|
* Load a SystemInstance via single bun subprocess.
|
|
417
|
-
*
|
|
418
|
-
*
|
|
395
|
+
* The subprocess imports the module and calls .serialize() to provide
|
|
396
|
+
* prop config, group registry, tokens, transforms, and global styles.
|
|
419
397
|
*/
|
|
420
398
|
function loadSystem() {
|
|
421
|
-
if (!options.system) return;
|
|
422
399
|
resolvedSystemPath = resolve(rootDir, options.system);
|
|
423
400
|
try {
|
|
424
401
|
const ts = Date.now();
|
|
425
402
|
const tmpScript = join(tmpdir(), `animus-system-${ts}.js`);
|
|
426
403
|
const tmpOut = join(tmpdir(), `animus-system-${ts}.json`);
|
|
427
|
-
writeFileSync(tmpScript, `const m = require(${JSON.stringify(resolvedSystemPath)});\nconst ds = m.ds || m.default || m.system;\nif (!ds || !ds.serialize) { throw new Error('Module does not export a SystemInstance with .serialize()'); }\nconst cfg = ds.serialize();\nrequire('fs').writeFileSync(${JSON.stringify(tmpOut)}, JSON.stringify({\n propConfig: cfg.propConfig,\n groupRegistry: cfg.groupRegistry,\n tokens:
|
|
404
|
+
writeFileSync(tmpScript, `const m = require(${JSON.stringify(resolvedSystemPath)});\nconst ds = m.ds || m.default || m.system;\nif (!ds || !ds.serialize) { throw new Error('Module does not export a SystemInstance with .serialize()'); }\nconst cfg = ds.serialize();\nconst tokens = m.tokens || m.theme || null;\nrequire('fs').writeFileSync(${JSON.stringify(tmpOut)}, JSON.stringify({\n propConfig: cfg.propConfig,\n groupRegistry: cfg.groupRegistry,\n tokens: tokens,\n transformNames: Object.keys(cfg.transforms || {}),\n globalStyles: cfg.globalStyles || null\n}));\n`);
|
|
428
405
|
execSync(`bun run "${tmpScript}"`, {
|
|
429
406
|
cwd: rootDir,
|
|
430
407
|
encoding: "utf-8"
|
|
@@ -442,7 +419,12 @@ function animusExtract(options = {}) {
|
|
|
442
419
|
themeJson = result.scalesJson;
|
|
443
420
|
variableMapJson = result.variableMapJson;
|
|
444
421
|
variableCss = result.variableCss;
|
|
445
|
-
|
|
422
|
+
if (options.prefix) {
|
|
423
|
+
const prefixed = applyPrefix(options.prefix, variableMapJson, variableCss);
|
|
424
|
+
variableMapJson = prefixed.variableMapJson;
|
|
425
|
+
variableCss = prefixed.variableCss;
|
|
426
|
+
}
|
|
427
|
+
} else if (logger) logger.warn("[animus] No tokens export found in system module — CSS variables will not be generated. Export your theme as `tokens` or `theme`.");
|
|
446
428
|
if (parsed.globalStyles) {
|
|
447
429
|
const hasReset = parsed.globalStyles.reset && Object.keys(parsed.globalStyles.reset).length > 0;
|
|
448
430
|
const hasGlobal = parsed.globalStyles.global && Object.keys(parsed.globalStyles.global).length > 0;
|
|
@@ -491,14 +473,29 @@ function animusExtract(options = {}) {
|
|
|
491
473
|
function runAnalysis(fileEntries) {
|
|
492
474
|
try {
|
|
493
475
|
const { analyzeProject } = __require("@animus-ui/extract");
|
|
494
|
-
const manifestJson = analyzeProject(JSON.stringify(fileEntries), themeJson, variableMapJson, configJson, groupRegistryJson, JSON.stringify(packageMap), !isProd);
|
|
476
|
+
const manifestJson = analyzeProject(JSON.stringify(fileEntries), themeJson, variableMapJson, configJson, groupRegistryJson, JSON.stringify(packageMap), !isProd, options.prefix || null);
|
|
495
477
|
storedManifest = JSON.parse(manifestJson);
|
|
496
478
|
storedManifestJson = manifestJson;
|
|
479
|
+
storedSystemPropMapJson = JSON.stringify(storedManifest?.system_prop_map ?? {});
|
|
480
|
+
const dynamicProps = storedManifest?.dynamic_props ?? {};
|
|
481
|
+
const newDynamicPropsJson = JSON.stringify(dynamicProps);
|
|
482
|
+
if (newDynamicPropsJson !== storedDynamicPropsJson) {
|
|
483
|
+
storedDynamicPropsJson = newDynamicPropsJson;
|
|
484
|
+
const usedTransformNames = /* @__PURE__ */ new Set();
|
|
485
|
+
for (const meta of Object.values(dynamicProps)) if (meta.transform_name) usedTransformNames.add(meta.transform_name);
|
|
486
|
+
if (storedManifest?.components) {
|
|
487
|
+
for (const comp of Object.values(storedManifest.components)) if (comp.replacement) {
|
|
488
|
+
const matches = comp.replacement.matchAll(/transforms\.(\w+)/g);
|
|
489
|
+
for (const match of matches) usedTransformNames.add(match[1]);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
storedTransformsSource = "{}";
|
|
493
|
+
}
|
|
497
494
|
bridgeInjected = false;
|
|
498
495
|
storedSheets = storedManifest?.sheets ?? null;
|
|
499
496
|
const rawCss = storedManifest?.css || "";
|
|
500
497
|
const systemResolveScript = globalThis.__animus_system_resolve_script;
|
|
501
|
-
if (systemResolveScript && rawCss.includes("__TRANSFORM__")
|
|
498
|
+
if (systemResolveScript && rawCss.includes("__TRANSFORM__")) try {
|
|
502
499
|
const tsTmp = Date.now();
|
|
503
500
|
const tmpIn = join(tmpdir(), `animus-css-${tsTmp}.css`);
|
|
504
501
|
const tmpOut = join(tmpdir(), `animus-css-${tsTmp}.out.css`);
|
|
@@ -513,10 +510,10 @@ function animusExtract(options = {}) {
|
|
|
513
510
|
unlinkSync(tmpOut);
|
|
514
511
|
} catch {}
|
|
515
512
|
} catch (e) {
|
|
516
|
-
console.warn("[animus-extract]
|
|
517
|
-
resolvedComponentCss =
|
|
513
|
+
console.warn("[animus-extract] Transform resolution failed:", e?.message);
|
|
514
|
+
resolvedComponentCss = rawCss;
|
|
518
515
|
}
|
|
519
|
-
else resolvedComponentCss =
|
|
516
|
+
else resolvedComponentCss = rawCss;
|
|
520
517
|
resolvedComponentCss = applyUnitFallback(resolvedComponentCss);
|
|
521
518
|
} catch (e) {
|
|
522
519
|
if (options.strict) throw new Error(`[animus-extract] analyzeProject failed: ${e}`);
|
|
@@ -530,14 +527,17 @@ function animusExtract(options = {}) {
|
|
|
530
527
|
isProd = config.command === "build";
|
|
531
528
|
rootDir = config.root;
|
|
532
529
|
logger = config.logger;
|
|
530
|
+
lcssTargets = resolveLightningTargets(options.targets, rootDir);
|
|
531
|
+
log(`Lightning CSS targets resolved (${Object.keys(lcssTargets).length} browsers)`);
|
|
532
|
+
if (options.layers) {
|
|
533
|
+
validateLayerOrder(options.layers);
|
|
534
|
+
log(`Custom layers: [${options.layers.join(", ")}]`);
|
|
535
|
+
}
|
|
536
|
+
if (options.prefix) log(`Namespace prefix: "${options.prefix}"`);
|
|
533
537
|
},
|
|
534
538
|
async buildStart() {
|
|
535
539
|
let t0 = performance.now();
|
|
536
|
-
|
|
537
|
-
else {
|
|
538
|
-
loadConfig();
|
|
539
|
-
loadTheme();
|
|
540
|
-
}
|
|
540
|
+
loadSystem();
|
|
541
541
|
if (verbose) {
|
|
542
542
|
const propCount = Object.keys(JSON.parse(configJson)).length;
|
|
543
543
|
const groupCount = Object.keys(JSON.parse(groupRegistryJson)).length;
|
|
@@ -632,8 +632,11 @@ function animusExtract(options = {}) {
|
|
|
632
632
|
for (const d of diagnostics) if (d.kind === "bail") warn(`⚠ ${d.component} not extracted: ${d.message}`);
|
|
633
633
|
else if (d.kind === "skip") warn(`⚠ ${d.component}: skipped ${d.message}`);
|
|
634
634
|
log(`CSS: ${resolvedComponentCss.length} bytes (${Object.keys(storedManifest.components || {}).length} components)`);
|
|
635
|
+
if (options.layers) layerDeclaration = `@layer ${options.layers.join(", ")};\n`;
|
|
636
|
+
else if (storedSheets) layerDeclaration = storedSheets.declaration;
|
|
637
|
+
else layerDeclaration = `@layer ${ANIMUS_LAYERS.join(", ")};\n`;
|
|
635
638
|
if (!isProd && storedSheets) {
|
|
636
|
-
const staticSize = (
|
|
639
|
+
const staticSize = (layerDeclaration + variableCss + globalCss).length;
|
|
637
640
|
const componentSize = resolvedComponentCss.length;
|
|
638
641
|
log(`Delivery: split mode — static ${staticSize} bytes, components ${componentSize} bytes (adopted stylesheet)`);
|
|
639
642
|
} else log("Delivery: single file mode (production)");
|
|
@@ -643,22 +646,35 @@ function animusExtract(options = {}) {
|
|
|
643
646
|
if (id === VIRTUAL_CSS_ID) return RESOLVED_CSS_ID;
|
|
644
647
|
if (id === VIRTUAL_COMPONENTS_ID) return RESOLVED_COMPONENTS_ID;
|
|
645
648
|
if (id === VIRTUAL_BRIDGE_ID) return RESOLVED_BRIDGE_ID;
|
|
649
|
+
if (id === VIRTUAL_SYSTEM_PROPS_ID) return RESOLVED_SYSTEM_PROPS_ID;
|
|
646
650
|
return null;
|
|
647
651
|
},
|
|
648
652
|
load(id) {
|
|
653
|
+
const lcssOpts = {
|
|
654
|
+
minify: options.minify ?? isProd,
|
|
655
|
+
targets: lcssTargets,
|
|
656
|
+
warnFn: warn
|
|
657
|
+
};
|
|
649
658
|
if (id === RESOLVED_CSS_ID) {
|
|
650
|
-
if (!isProd && storedSheets) return [
|
|
651
|
-
|
|
659
|
+
if (!isProd && storedSheets) return postProcessCss([
|
|
660
|
+
layerDeclaration,
|
|
652
661
|
variableCss,
|
|
653
662
|
globalCss
|
|
654
|
-
].filter(Boolean).join("\n")
|
|
655
|
-
|
|
663
|
+
].filter(Boolean).join("\n"), {
|
|
664
|
+
...lcssOpts,
|
|
665
|
+
minify: false
|
|
666
|
+
});
|
|
667
|
+
return postProcessCss([
|
|
668
|
+
layerDeclaration,
|
|
656
669
|
variableCss,
|
|
657
670
|
globalCss,
|
|
658
671
|
resolvedComponentCss
|
|
659
|
-
].filter(Boolean).join("\n");
|
|
672
|
+
].filter(Boolean).join("\n"), lcssOpts);
|
|
660
673
|
}
|
|
661
|
-
if (id === RESOLVED_COMPONENTS_ID) return `export default \`${(resolvedComponentCss || ""
|
|
674
|
+
if (id === RESOLVED_COMPONENTS_ID) return `export default \`${postProcessCss(resolvedComponentCss || "", {
|
|
675
|
+
...lcssOpts,
|
|
676
|
+
minify: false
|
|
677
|
+
}).replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$/g, "\\$")}\`;`;
|
|
662
678
|
if (id === RESOLVED_BRIDGE_ID) return `
|
|
663
679
|
import css from '${VIRTUAL_COMPONENTS_ID}';
|
|
664
680
|
|
|
@@ -694,6 +710,22 @@ if (import.meta.hot) {
|
|
|
694
710
|
});
|
|
695
711
|
}
|
|
696
712
|
`;
|
|
713
|
+
if (id === RESOLVED_SYSTEM_PROPS_ID) {
|
|
714
|
+
let moduleSource = `export const systemPropMap = ${storedSystemPropMapJson};\nexport const systemPropGroups = ${groupRegistryJson};`;
|
|
715
|
+
if (storedDynamicPropsJson !== "{}") {
|
|
716
|
+
const dynamicProps = JSON.parse(storedDynamicPropsJson);
|
|
717
|
+
const configEntries = {};
|
|
718
|
+
for (const [propName, meta] of Object.entries(dynamicProps)) configEntries[propName] = {
|
|
719
|
+
varName: meta.var_name,
|
|
720
|
+
slotClass: meta.slot_class,
|
|
721
|
+
...meta.transform_name ? { transformName: meta.transform_name } : {},
|
|
722
|
+
...meta.scale_values && Object.keys(meta.scale_values).length > 0 ? { scaleValues: meta.scale_values } : {}
|
|
723
|
+
};
|
|
724
|
+
moduleSource += `\nexport const dynamicPropConfig = ${JSON.stringify(configEntries)};`;
|
|
725
|
+
moduleSource += `\nexport const transforms = ${storedTransformsSource};`;
|
|
726
|
+
}
|
|
727
|
+
return moduleSource;
|
|
728
|
+
}
|
|
697
729
|
return null;
|
|
698
730
|
},
|
|
699
731
|
transform(code, id) {
|
|
@@ -730,17 +762,10 @@ if (import.meta.hot) {
|
|
|
730
762
|
if ((options.exclude ?? DEFAULT_EXCLUDE).some((pattern) => file.includes(pattern) || relative(rootDir, file).includes(pattern))) return;
|
|
731
763
|
const absFile = resolve(file);
|
|
732
764
|
const relPath = relative(rootDir, absFile);
|
|
733
|
-
|
|
734
|
-
const isThemeChange = resolvedThemePath && absFile === resolve(resolvedThemePath);
|
|
735
|
-
const isSystemChange = resolvedSystemPath && absFile === resolve(resolvedSystemPath);
|
|
736
|
-
if (isConfigChange || isThemeChange || isSystemChange) {
|
|
765
|
+
if (resolvedSystemPath && absFile === resolve(resolvedSystemPath)) {
|
|
737
766
|
const resetStart = performance.now();
|
|
738
767
|
log(`HMR geological reset: ${relPath}`);
|
|
739
|
-
|
|
740
|
-
else {
|
|
741
|
-
if (isConfigChange) loadConfig();
|
|
742
|
-
if (isThemeChange) loadTheme();
|
|
743
|
-
}
|
|
768
|
+
loadSystem();
|
|
744
769
|
try {
|
|
745
770
|
const { clearAnalysisCache } = __require("@animus-ui/extract");
|
|
746
771
|
clearAnalysisCache();
|
|
@@ -764,6 +789,11 @@ if (import.meta.hot) {
|
|
|
764
789
|
hmrServer.moduleGraph.invalidateModule(compModule);
|
|
765
790
|
geologicalModules.push(compModule);
|
|
766
791
|
}
|
|
792
|
+
const sysPropModule = hmrServer.moduleGraph.getModuleById(RESOLVED_SYSTEM_PROPS_ID);
|
|
793
|
+
if (sysPropModule) {
|
|
794
|
+
hmrServer.moduleGraph.invalidateModule(sysPropModule);
|
|
795
|
+
geologicalModules.push(sysPropModule);
|
|
796
|
+
}
|
|
767
797
|
return geologicalModules;
|
|
768
798
|
}
|
|
769
799
|
let source;
|
|
@@ -794,6 +824,11 @@ if (import.meta.hot) {
|
|
|
794
824
|
hmrServer.moduleGraph.invalidateModule(compModule);
|
|
795
825
|
modulesToUpdate.push(compModule);
|
|
796
826
|
}
|
|
827
|
+
const sysPropModule = hmrServer.moduleGraph.getModuleById(RESOLVED_SYSTEM_PROPS_ID);
|
|
828
|
+
if (sysPropModule) {
|
|
829
|
+
hmrServer.moduleGraph.invalidateModule(sysPropModule);
|
|
830
|
+
modulesToUpdate.push(sysPropModule);
|
|
831
|
+
}
|
|
797
832
|
if (storedManifest?.components) {
|
|
798
833
|
const staleFiles = /* @__PURE__ */ new Set();
|
|
799
834
|
for (const [id, desc] of Object.entries(storedManifest.components)) if ((desc.replacement ?? "") !== (prevReplacements.get(id) ?? "")) staleFiles.add(desc.file);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Evaluate a theme object that has already been loaded/imported.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* If the theme has a `.manifest` property (from ThemeBuilder.build()),
|
|
5
|
+
* reads structured data directly — no re-flattening or var() pattern-matching.
|
|
6
|
+
* Falls back to legacy path for themes without manifests.
|
|
6
7
|
*/
|
|
7
8
|
export declare function evaluateThemeObject(theme: Record<string, any>): {
|
|
8
9
|
scalesJson: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-evaluator.d.ts","sourceRoot":"","sources":["../src/theme-evaluator.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"theme-evaluator.d.ts","sourceRoot":"","sources":["../src/theme-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG;IAC/D,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAiBA;AA0CD;;;;;;;GAOG;AACH,wBAAsB,aAAa,CACjC,aAAa,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAC5D,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IACT,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC,CAWD;AAuKD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EACjD,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,GAAG,CAAC,GAC1C,MAAM,CAiCR"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/vite-plugin",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.16",
|
|
4
4
|
"description": "Animus static CSS extraction Vite plugin",
|
|
5
5
|
"author": "codecaaron <airrobb@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"vite": ">=5.0.0"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@animus-ui/
|
|
29
|
-
"
|
|
28
|
+
"@animus-ui/extract": "0.1.0-next.16",
|
|
29
|
+
"browserslist": "^4.24.0",
|
|
30
|
+
"lightningcss": "^1.29.0"
|
|
30
31
|
}
|
|
31
32
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Serialize the prop config from @animus-ui/core for the Rust extraction pipeline.
|
|
3
|
-
*
|
|
4
|
-
* Maps JS transform functions to string identifiers that the Rust crate
|
|
5
|
-
* can dispatch to its native implementations.
|
|
6
|
-
*/
|
|
7
|
-
interface PropConfig {
|
|
8
|
-
property: string;
|
|
9
|
-
properties?: string[];
|
|
10
|
-
scale?: string | Record<string, any> | any[];
|
|
11
|
-
transform?: Function;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Serialize all prop groups from the animus config into a JSON map.
|
|
15
|
-
* Prop config entries with inline scales (object/array) are skipped
|
|
16
|
-
* since the Rust crate only handles named theme scales.
|
|
17
|
-
*/
|
|
18
|
-
export declare function serializeConfig(propRegistry: Record<string, PropConfig>): string;
|
|
19
|
-
/**
|
|
20
|
-
* Serialize the group registry from the Animus config.
|
|
21
|
-
* Maps each group name to its array of constituent prop names.
|
|
22
|
-
*/
|
|
23
|
-
export declare function serializeGroupRegistry(groupRegistry: Record<string, string[]>): string;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=config-serializer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config-serializer.d.ts","sourceRoot":"","sources":["../src/config-serializer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC;IAC7C,SAAS,CAAC,EAAE,QAAQ,CAAC;CACtB;AASD;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GACvC,MAAM,CA8BR;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GACtC,MAAM,CAER"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Standalone script executed via `bun run` to apply transform placeholders.
|
|
3
|
-
*
|
|
4
|
-
* Usage: bun run resolve-transforms.ts <input-file> <output-file> [config-path]
|
|
5
|
-
*
|
|
6
|
-
* Reads CSS from input file containing __TRANSFORM__name__rawValue__ placeholders,
|
|
7
|
-
* loads transform functions from @animus-ui/core (and optionally a custom config),
|
|
8
|
-
* applies them, and writes the resolved CSS to the output file.
|
|
9
|
-
*
|
|
10
|
-
* When config-path is provided, transforms from that module are loaded IN ADDITION
|
|
11
|
-
* to core transforms. Custom transforms take precedence on name collisions.
|
|
12
|
-
*/
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=resolve-transforms.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-transforms.d.ts","sourceRoot":"","sources":["../src/resolve-transforms.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG"}
|