@animus-ui/extract 0.1.0-next.45 → 0.1.0-next.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/animus-extract.darwin-arm64.node +0 -0
- package/animus-extract.linux-arm64-gnu.node +0 -0
- package/animus-extract.linux-x64-gnu.node +0 -0
- package/dist/assemble-stylesheet.d.ts +9 -20
- package/dist/assemble-stylesheet.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +20 -33
- package/index.d.ts +1 -1
- package/package.json +5 -5
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,36 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The 7 Animus cascade layers
|
|
2
|
+
* The 7 Animus cascade layers. Always prefixed with `anm-` to avoid
|
|
3
|
+
* collision with other frameworks' layer names (e.g., Tailwind's `base`).
|
|
3
4
|
*/
|
|
4
|
-
export declare const ANIMUS_LAYERS: readonly ["global", "base", "variants", "compounds", "states", "system", "custom"];
|
|
5
|
-
/**
|
|
6
|
-
* Prefix a layer name with dot-notation sublayer syntax.
|
|
7
|
-
* Only Animus layer names are prefixed; consumer layer names pass through.
|
|
8
|
-
*/
|
|
9
|
-
export declare function prefixLayerName(name: string, prefix?: string): string;
|
|
5
|
+
export declare const ANIMUS_LAYERS: readonly ["anm-global", "anm-base", "anm-variants", "anm-compounds", "anm-states", "anm-system", "anm-custom"];
|
|
10
6
|
/**
|
|
11
7
|
* Validate that a consumer `layers` array contains all 7 Animus layers
|
|
12
8
|
* in the correct relative order. Consumer layers may be interleaved.
|
|
13
9
|
*
|
|
14
|
-
* When `prefix` is set, the expected Animus layer names are `{prefix}.{name}`
|
|
15
|
-
* (e.g. `acme.base`). This lets consumers write the actual CSS layer names
|
|
16
|
-
* in their config — important when composing with other frameworks that have
|
|
17
|
-
* their own `@layer base` etc.
|
|
18
|
-
*
|
|
19
10
|
* @throws Error with descriptive message on violation
|
|
20
11
|
*/
|
|
21
|
-
export declare function validateLayerOrder(layers: string[]
|
|
12
|
+
export declare function validateLayerOrder(layers: string[]): void;
|
|
22
13
|
export interface AssembleStylesheetOptions {
|
|
23
14
|
/**
|
|
24
|
-
* Custom layer order. Must contain all 7 Animus layers as a subsequence.
|
|
25
|
-
*
|
|
15
|
+
* Custom layer order. Must contain all 7 Animus `anm-*` layers as a subsequence.
|
|
16
|
+
* Example: `['reset', 'anm-global', 'anm-base', ..., 'anm-custom', 'overrides']`
|
|
26
17
|
* Names are emitted as-is — this is the actual `@layer` declaration.
|
|
27
18
|
*/
|
|
28
19
|
layers?: string[];
|
|
29
|
-
/** Namespace prefix — Animus layer names become `{prefix}.{name}` sublayers. */
|
|
30
|
-
prefix?: string;
|
|
31
20
|
/** Variable CSS: `:root { --color-*: ... }` + color mode selectors */
|
|
32
21
|
variableCss?: string;
|
|
33
|
-
/** Global CSS: `@layer global { reset + global styles }` */
|
|
22
|
+
/** Global CSS: `@layer anm-global { reset + global styles }` */
|
|
34
23
|
globalCss?: string;
|
|
35
24
|
/** Component CSS from the Rust crate (may contain embedded @layer declaration) */
|
|
36
25
|
componentCss?: string;
|
|
@@ -40,8 +29,8 @@ export interface AssembleStylesheetOptions {
|
|
|
40
29
|
*
|
|
41
30
|
* 1. `@layer` declaration (cascade ordering)
|
|
42
31
|
* 2. Emitted variables (`:root`, color mode selectors)
|
|
43
|
-
* 3. `@layer global { ... }` (reset + global styles)
|
|
44
|
-
* 4. `@layer base/variants/compounds/states/system/custom { ... }` (components)
|
|
32
|
+
* 3. `@layer anm-global { ... }` (reset + global styles)
|
|
33
|
+
* 4. `@layer anm-base/variants/compounds/states/system/custom { ... }` (components)
|
|
45
34
|
*
|
|
46
35
|
* This is the single source of truth for stylesheet assembly.
|
|
47
36
|
* Both Vite and Next.js plugins must use this function.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assemble-stylesheet.d.ts","sourceRoot":"","sources":["../pipeline/assemble-stylesheet.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"assemble-stylesheet.d.ts","sourceRoot":"","sources":["../pipeline/assemble-stylesheet.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,aAAa,gHAQhB,CAAC;AAiBX;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,CA2BzD;AAYD,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,sEAAsE;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,MAAM,CAqB7E"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { AssembleStylesheetOptions } from './assemble-stylesheet';
|
|
2
|
-
export { ANIMUS_LAYERS, assembleStylesheet,
|
|
2
|
+
export { ANIMUS_LAYERS, assembleStylesheet, validateLayerOrder, } from './assemble-stylesheet';
|
|
3
3
|
export { extractSystemFilePackages } from './discover-packages';
|
|
4
4
|
export { applyPrefix } from './prefix';
|
|
5
5
|
export { resolveGlobalStyles, resolveTokenAliases, resolveValue, } from './resolve-global-styles';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../pipeline/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../pipeline/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,GACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -7,49 +7,36 @@ var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region pipeline/assemble-stylesheet.ts
|
|
9
9
|
/**
|
|
10
|
-
* The 7 Animus cascade layers
|
|
10
|
+
* The 7 Animus cascade layers. Always prefixed with `anm-` to avoid
|
|
11
|
+
* collision with other frameworks' layer names (e.g., Tailwind's `base`).
|
|
11
12
|
*/
|
|
12
13
|
const ANIMUS_LAYERS = [
|
|
13
|
-
"global",
|
|
14
|
-
"base",
|
|
15
|
-
"variants",
|
|
16
|
-
"compounds",
|
|
17
|
-
"states",
|
|
18
|
-
"system",
|
|
19
|
-
"custom"
|
|
14
|
+
"anm-global",
|
|
15
|
+
"anm-base",
|
|
16
|
+
"anm-variants",
|
|
17
|
+
"anm-compounds",
|
|
18
|
+
"anm-states",
|
|
19
|
+
"anm-system",
|
|
20
|
+
"anm-custom"
|
|
20
21
|
];
|
|
21
|
-
const ANIMUS_LAYER_SET = new Set(ANIMUS_LAYERS);
|
|
22
|
-
/**
|
|
23
|
-
* Prefix a layer name with dot-notation sublayer syntax.
|
|
24
|
-
* Only Animus layer names are prefixed; consumer layer names pass through.
|
|
25
|
-
*/
|
|
26
|
-
function prefixLayerName(name, prefix) {
|
|
27
|
-
if (!prefix || !ANIMUS_LAYER_SET.has(name)) return name;
|
|
28
|
-
return `${prefix}.${name}`;
|
|
29
|
-
}
|
|
30
22
|
/**
|
|
31
23
|
* Build the `@layer` declaration line.
|
|
32
24
|
*
|
|
33
|
-
* When `isCustom` is false (default layers),
|
|
25
|
+
* When `isCustom` is false (default layers), uses ANIMUS_LAYERS directly.
|
|
34
26
|
* When `isCustom` is true, passes names through as-is — the consumer already
|
|
35
|
-
* wrote the final names including
|
|
27
|
+
* wrote the final names including the `anm-` prefixed entries.
|
|
36
28
|
*/
|
|
37
|
-
function buildLayerDeclaration(layers,
|
|
38
|
-
return `@layer ${(isCustom ? layers :
|
|
29
|
+
function buildLayerDeclaration(layers, isCustom) {
|
|
30
|
+
return `@layer ${(isCustom ? layers : [...ANIMUS_LAYERS]).join(", ")};\n`;
|
|
39
31
|
}
|
|
40
32
|
/**
|
|
41
33
|
* Validate that a consumer `layers` array contains all 7 Animus layers
|
|
42
34
|
* in the correct relative order. Consumer layers may be interleaved.
|
|
43
35
|
*
|
|
44
|
-
* When `prefix` is set, the expected Animus layer names are `{prefix}.{name}`
|
|
45
|
-
* (e.g. `acme.base`). This lets consumers write the actual CSS layer names
|
|
46
|
-
* in their config — important when composing with other frameworks that have
|
|
47
|
-
* their own `@layer base` etc.
|
|
48
|
-
*
|
|
49
36
|
* @throws Error with descriptive message on violation
|
|
50
37
|
*/
|
|
51
|
-
function validateLayerOrder(layers
|
|
52
|
-
const expected = ANIMUS_LAYERS
|
|
38
|
+
function validateLayerOrder(layers) {
|
|
39
|
+
const expected = [...ANIMUS_LAYERS];
|
|
53
40
|
let cursor = 0;
|
|
54
41
|
for (const layer of layers) if (cursor < expected.length && layer === expected[cursor]) cursor++;
|
|
55
42
|
if (cursor < expected.length) {
|
|
@@ -75,8 +62,8 @@ function stripLeadingLayerDeclaration(css) {
|
|
|
75
62
|
*
|
|
76
63
|
* 1. `@layer` declaration (cascade ordering)
|
|
77
64
|
* 2. Emitted variables (`:root`, color mode selectors)
|
|
78
|
-
* 3. `@layer global { ... }` (reset + global styles)
|
|
79
|
-
* 4. `@layer base/variants/compounds/states/system/custom { ... }` (components)
|
|
65
|
+
* 3. `@layer anm-global { ... }` (reset + global styles)
|
|
66
|
+
* 4. `@layer anm-base/variants/compounds/states/system/custom { ... }` (components)
|
|
80
67
|
*
|
|
81
68
|
* This is the single source of truth for stylesheet assembly.
|
|
82
69
|
* Both Vite and Next.js plugins must use this function.
|
|
@@ -84,8 +71,8 @@ function stripLeadingLayerDeclaration(css) {
|
|
|
84
71
|
function assembleStylesheet(options) {
|
|
85
72
|
const hasCustomLayers = !!options.layers;
|
|
86
73
|
const layers = options.layers ?? ANIMUS_LAYERS;
|
|
87
|
-
if (options.layers) validateLayerOrder(options.layers
|
|
88
|
-
const layerDeclaration = buildLayerDeclaration(layers,
|
|
74
|
+
if (options.layers) validateLayerOrder(options.layers);
|
|
75
|
+
const layerDeclaration = buildLayerDeclaration(layers, hasCustomLayers);
|
|
89
76
|
const componentCss = options.componentCss ? stripLeadingLayerDeclaration(options.componentCss) : "";
|
|
90
77
|
return [
|
|
91
78
|
layerDeclaration,
|
|
@@ -381,4 +368,4 @@ function applyUnitFallback(css) {
|
|
|
381
368
|
});
|
|
382
369
|
}
|
|
383
370
|
//#endregion
|
|
384
|
-
export { ANIMUS_LAYERS, applyPrefix, applyUnitFallback, assembleStylesheet, camelToKebab, detectRuntime, execSubprocess, extractSystemFilePackages,
|
|
371
|
+
export { ANIMUS_LAYERS, applyPrefix, applyUnitFallback, assembleStylesheet, camelToKebab, detectRuntime, execSubprocess, extractSystemFilePackages, resolveGlobalStyles, resolveTokenAliases, resolveTransformPlaceholders, resolveValue, validateLayerOrder };
|
package/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* Overrides hardcoded import paths in generated source. When `None`, defaults to
|
|
17
17
|
* `@animus-ui/system` and `virtual:animus/styles.css`.
|
|
18
18
|
*/
|
|
19
|
-
export declare function analyzeProject(fileEntriesJson: string, themeJson: string, variableMapJson: string, contextualVarsJson: string | undefined | null, configJson: string, groupRegistryJson: string, packageResolutionJson: string, devMode?: boolean | undefined | null,
|
|
19
|
+
export declare function analyzeProject(fileEntriesJson: string, themeJson: string, variableMapJson: string, contextualVarsJson: string | undefined | null, configJson: string, groupRegistryJson: string, packageResolutionJson: string, devMode?: boolean | undefined | null, emitterConfigJson?: string | undefined | null, selectorAliasesJson?: string | undefined | null, selectorOrderJson?: string | undefined | null): string
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Clear the per-file extraction cache used by `analyze_project()`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/extract",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.49",
|
|
4
4
|
"description": "Animus static CSS extraction pipeline (Rust/NAPI)",
|
|
5
5
|
"author": "codecaaron <airrobb@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"compile": "tsc -p tsconfig.build.json --noEmit"
|
|
59
59
|
},
|
|
60
60
|
"optionalDependencies": {
|
|
61
|
-
"@animus-ui/extract-darwin-arm64": "0.1.0-next.
|
|
62
|
-
"@animus-ui/extract-linux-x64-gnu": "0.1.0-next.
|
|
63
|
-
"@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.
|
|
61
|
+
"@animus-ui/extract-darwin-arm64": "0.1.0-next.49",
|
|
62
|
+
"@animus-ui/extract-linux-x64-gnu": "0.1.0-next.49",
|
|
63
|
+
"@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.49"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@animus-ui/properties": "0.1.0-next.
|
|
66
|
+
"@animus-ui/properties": "0.1.0-next.49"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@animus-ui/system": "workspace:*",
|