@animus-ui/extract 0.1.0-next.61 → 0.1.0-next.62
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 +20 -1
- package/dist/assemble-stylesheet.d.ts.map +1 -1
- package/dist/discover-packages.d.ts +9 -6
- package/dist/discover-packages.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +34 -31
- package/index.d.ts +2 -1
- package/package.json +5 -5
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -10,6 +10,17 @@ export declare const ANIMUS_LAYERS: readonly ["anm-global", "anm-base", "anm-var
|
|
|
10
10
|
* @throws Error with descriptive message on violation
|
|
11
11
|
*/
|
|
12
12
|
export declare function validateLayerOrder(layers: string[]): void;
|
|
13
|
+
/**
|
|
14
|
+
* Strip a leading `@layer ...;` declaration line from CSS if present.
|
|
15
|
+
* The Rust crate embeds this in prod-mode output; we strip it so the
|
|
16
|
+
* shared assembler controls placement.
|
|
17
|
+
*/
|
|
18
|
+
export declare function stripLeadingLayerDeclaration(css: string): string;
|
|
19
|
+
export interface AssembleStylesheetParts {
|
|
20
|
+
declaration: string;
|
|
21
|
+
variables: string;
|
|
22
|
+
body: string;
|
|
23
|
+
}
|
|
13
24
|
export interface AssembleStylesheetOptions {
|
|
14
25
|
/**
|
|
15
26
|
* Custom layer order. Must contain all 7 Animus `anm-*` layers as a subsequence.
|
|
@@ -23,6 +34,8 @@ export interface AssembleStylesheetOptions {
|
|
|
23
34
|
globalCss?: string;
|
|
24
35
|
/** Component CSS from the Rust crate (may contain embedded @layer declaration) */
|
|
25
36
|
componentCss?: string;
|
|
37
|
+
/** When true, return structured `{ declaration, variables, body }` instead of a single string. */
|
|
38
|
+
split?: boolean;
|
|
26
39
|
}
|
|
27
40
|
/**
|
|
28
41
|
* Assemble the final stylesheet in canonical order:
|
|
@@ -35,5 +48,11 @@ export interface AssembleStylesheetOptions {
|
|
|
35
48
|
* This is the single source of truth for stylesheet assembly.
|
|
36
49
|
* Both Vite and Next.js plugins must use this function.
|
|
37
50
|
*/
|
|
38
|
-
export declare function assembleStylesheet(options: AssembleStylesheetOptions
|
|
51
|
+
export declare function assembleStylesheet(options: AssembleStylesheetOptions & {
|
|
52
|
+
split: true;
|
|
53
|
+
}): AssembleStylesheetParts;
|
|
54
|
+
export declare function assembleStylesheet(options: AssembleStylesheetOptions & {
|
|
55
|
+
split?: false;
|
|
56
|
+
}): string;
|
|
57
|
+
export declare function assembleStylesheet(options: AssembleStylesheetOptions): string | AssembleStylesheetParts;
|
|
39
58
|
//# sourceMappingURL=assemble-stylesheet.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,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;IACtB,kGAAkG;IAClG,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GAAG;IAAE,KAAK,EAAE,IAAI,CAAA;CAAE,GACnD,uBAAuB,CAAC;AAC3B,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GAAG;IAAE,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GACrD,MAAM,CAAC;AACV,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GACjC,MAAM,GAAG,uBAAuB,CAAC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Extract external DS package names from
|
|
2
|
+
* Extract external DS package names from `includes` declarations in the system file.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* declared via `.includes()` are treated as external DS dependencies.
|
|
4
|
+
* Supports two forms:
|
|
5
|
+
* - Primary (1.0+): `createSystem({ includes: [identifier, ...] })` constructor arg
|
|
6
|
+
* - Legacy: `.includes([identifier, ...])` chain method (RC migration fallback)
|
|
8
7
|
*
|
|
9
|
-
*
|
|
8
|
+
* For each identifier found, traces back to its import declaration and returns
|
|
9
|
+
* the import specifier. Only packages explicitly declared via `includes` are treated
|
|
10
|
+
* as external DS dependencies.
|
|
11
|
+
*
|
|
12
|
+
* Falls back to empty array if no `includes` declaration is found.
|
|
10
13
|
*/
|
|
11
14
|
export declare function extractSystemFilePackages(systemFilePath: string): string[];
|
|
12
15
|
//# sourceMappingURL=discover-packages.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover-packages.d.ts","sourceRoot":"","sources":["../pipeline/discover-packages.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"discover-packages.d.ts","sourceRoot":"","sources":["../pipeline/discover-packages.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,EAAE,CAmF1E"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export type { AssembleStylesheetOptions } from './assemble-stylesheet';
|
|
2
|
-
export { ANIMUS_LAYERS, assembleStylesheet, validateLayerOrder, } from './assemble-stylesheet';
|
|
1
|
+
export type { AssembleStylesheetOptions, AssembleStylesheetParts, } from './assemble-stylesheet';
|
|
2
|
+
export { ANIMUS_LAYERS, assembleStylesheet, stripLeadingLayerDeclaration, 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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../pipeline/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,4BAA4B,EAC5B,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,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.mjs
CHANGED
|
@@ -52,41 +52,39 @@ function validateLayerOrder(layers) {
|
|
|
52
52
|
function stripLeadingLayerDeclaration(css) {
|
|
53
53
|
return css.replace(/^@layer\s+[^;{]+;\s*\n?/, "");
|
|
54
54
|
}
|
|
55
|
-
/**
|
|
56
|
-
* Assemble the final stylesheet in canonical order:
|
|
57
|
-
*
|
|
58
|
-
* 1. `@layer` declaration (cascade ordering)
|
|
59
|
-
* 2. Emitted variables (`:root`, color mode selectors)
|
|
60
|
-
* 3. `@layer anm-global { ... }` (reset + global styles)
|
|
61
|
-
* 4. `@layer anm-base/variants/compounds/states/system/custom { ... }` (components)
|
|
62
|
-
*
|
|
63
|
-
* This is the single source of truth for stylesheet assembly.
|
|
64
|
-
* Both Vite and Next.js plugins must use this function.
|
|
65
|
-
*/
|
|
66
55
|
function assembleStylesheet(options) {
|
|
67
56
|
const hasCustomLayers = !!options.layers;
|
|
68
57
|
const layers = options.layers ?? ANIMUS_LAYERS;
|
|
69
58
|
if (options.layers) validateLayerOrder(options.layers);
|
|
70
|
-
const
|
|
59
|
+
const declaration = buildLayerDeclaration(layers, hasCustomLayers);
|
|
60
|
+
const variables = options.variableCss || "";
|
|
71
61
|
const componentCss = options.componentCss ? stripLeadingLayerDeclaration(options.componentCss) : "";
|
|
62
|
+
const body = [options.globalCss || "", componentCss].filter(Boolean).join("\n");
|
|
63
|
+
if (options.split) return {
|
|
64
|
+
declaration,
|
|
65
|
+
variables,
|
|
66
|
+
body
|
|
67
|
+
};
|
|
72
68
|
return [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
componentCss
|
|
69
|
+
declaration,
|
|
70
|
+
variables,
|
|
71
|
+
body
|
|
77
72
|
].filter(Boolean).join("\n");
|
|
78
73
|
}
|
|
79
74
|
//#endregion
|
|
80
75
|
//#region pipeline/discover-packages.ts
|
|
81
76
|
/**
|
|
82
|
-
* Extract external DS package names from
|
|
77
|
+
* Extract external DS package names from `includes` declarations in the system file.
|
|
83
78
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* declared via `.includes()` are treated as external DS dependencies.
|
|
79
|
+
* Supports two forms:
|
|
80
|
+
* - Primary (1.0+): `createSystem({ includes: [identifier, ...] })` constructor arg
|
|
81
|
+
* - Legacy: `.includes([identifier, ...])` chain method (RC migration fallback)
|
|
88
82
|
*
|
|
89
|
-
*
|
|
83
|
+
* For each identifier found, traces back to its import declaration and returns
|
|
84
|
+
* the import specifier. Only packages explicitly declared via `includes` are treated
|
|
85
|
+
* as external DS dependencies.
|
|
86
|
+
*
|
|
87
|
+
* Falls back to empty array if no `includes` declaration is found.
|
|
90
88
|
*/
|
|
91
89
|
function extractSystemFilePackages(systemFilePath) {
|
|
92
90
|
let source;
|
|
@@ -95,16 +93,21 @@ function extractSystemFilePackages(systemFilePath) {
|
|
|
95
93
|
} catch {
|
|
96
94
|
return [];
|
|
97
95
|
}
|
|
98
|
-
const includesRegex = /\.includes\(\s*\[([^\]]*)\]\s*\)/gs;
|
|
99
96
|
const identifiers = /* @__PURE__ */ new Set();
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
const constructorRegex = /createSystem\s*\(\s*\{[^}]*?\bincludes\s*:\s*\[([^\]]*)\]/gs;
|
|
98
|
+
const chainRegex = /\.includes\s*\(\s*\[([^\]]*)\]\s*\)/gs;
|
|
99
|
+
const collectIdentifiers = (regex) => {
|
|
100
|
+
let match;
|
|
101
|
+
while ((match = regex.exec(source)) !== null) {
|
|
102
|
+
const inner = match[1];
|
|
103
|
+
for (const token of inner.split(",")) {
|
|
104
|
+
const id = token.trim();
|
|
105
|
+
if (id && /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(id)) identifiers.add(id);
|
|
106
|
+
}
|
|
106
107
|
}
|
|
107
|
-
}
|
|
108
|
+
};
|
|
109
|
+
collectIdentifiers(constructorRegex);
|
|
110
|
+
collectIdentifiers(chainRegex);
|
|
108
111
|
if (identifiers.size === 0) return [];
|
|
109
112
|
const importMap = /* @__PURE__ */ new Map();
|
|
110
113
|
const importRegex = /^\s*import\s+(?:([a-zA-Z_$][a-zA-Z0-9_$]*)\s*,\s*)?(?:\{([^}]*)\}|([a-zA-Z_$][a-zA-Z0-9_$]*))\s+from\s+['"]([^'"]+)['"]/gm;
|
|
@@ -316,4 +319,4 @@ function applyUnitFallback(css) {
|
|
|
316
319
|
});
|
|
317
320
|
}
|
|
318
321
|
//#endregion
|
|
319
|
-
export { ANIMUS_LAYERS, applyPrefix, applyUnitFallback, assembleStylesheet, camelToKebab, extractSystemFilePackages, resolveGlobalStyles, resolveTokenAliases, resolveTransformPlaceholders, resolveValue, validateLayerOrder };
|
|
322
|
+
export { ANIMUS_LAYERS, applyPrefix, applyUnitFallback, assembleStylesheet, camelToKebab, extractSystemFilePackages, resolveGlobalStyles, resolveTokenAliases, resolveTransformPlaceholders, resolveValue, stripLeadingLayerDeclaration, 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, emitterConfigJson?: string | undefined | null, selectorAliasesJson?: string | undefined | null, selectorOrderJson?: string | undefined | null, globalStyleBlocksJson?: string | undefined | null, pathAliasesJson?: string | undefined | null): string
|
|
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, globalStyleBlocksJson?: string | undefined | null, pathAliasesJson?: string | undefined | null, keyframesBlocksJson?: string | undefined | null): string
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Clear the per-file extraction cache used by `analyze_project()`.
|
|
@@ -47,6 +47,7 @@ export interface NapiSystemConfig {
|
|
|
47
47
|
selectorAliases?: string
|
|
48
48
|
selectorOrder?: string
|
|
49
49
|
globalStyleBlocks?: string
|
|
50
|
+
keyframesBlocks?: string
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
/**
|
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.62",
|
|
4
4
|
"description": "Animus static CSS extraction pipeline (Rust/NAPI)",
|
|
5
5
|
"author": "codecaaron <airrobb@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,12 +59,12 @@
|
|
|
59
59
|
"compile": "tsc -p tsconfig.build.json --noEmit"
|
|
60
60
|
},
|
|
61
61
|
"optionalDependencies": {
|
|
62
|
-
"@animus-ui/extract-darwin-arm64": "0.1.0-next.
|
|
63
|
-
"@animus-ui/extract-linux-x64-gnu": "0.1.0-next.
|
|
64
|
-
"@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.
|
|
62
|
+
"@animus-ui/extract-darwin-arm64": "0.1.0-next.62",
|
|
63
|
+
"@animus-ui/extract-linux-x64-gnu": "0.1.0-next.62",
|
|
64
|
+
"@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.62"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@animus-ui/properties": "0.1.0-next.
|
|
67
|
+
"@animus-ui/properties": "0.1.0-next.62"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@animus-ui/system": "workspace:*",
|