@animus-ui/extract 0.1.4 → 0.1.5
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/crates/extract-v2/animus-extract-v2.darwin-arm64.node +0 -0
- package/crates/extract-v2/animus-extract-v2.linux-arm64-gnu.node +0 -0
- package/crates/extract-v2/animus-extract-v2.linux-x64-gnu.node +0 -0
- package/dist/dynamic-prop-config.d.ts +21 -7
- package/dist/dynamic-prop-config.d.ts.map +1 -1
- package/dist/index.cjs +17 -7
- package/dist/index.mjs +18 -8
- package/dist/system-props-module.d.ts +4 -0
- package/dist/system-props-module.d.ts.map +1 -1
- package/package.json +3 -3
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Manifest `dynamic_props` → runtime `dynamicPropConfig` mapping.
|
|
3
3
|
*
|
|
4
4
|
* Single authoritative copy for both extraction plugins: the emitted
|
|
5
5
|
* `dynamicPropConfig` object in each plugin's system-props module is
|
|
6
6
|
* `JSON.stringify(buildDynamicPropConfig(...))`, so field order and the
|
|
7
|
-
* omission rules (no `
|
|
8
|
-
* empty) are part of the
|
|
7
|
+
* omission rules (no `property` when absent, no `properties` when empty, no
|
|
8
|
+
* `transformName` when absent, no `scaleValues` when empty) are part of the
|
|
9
|
+
* emitted-bundle contract. Field order matches the per-component
|
|
10
|
+
* `customDynamicConfig` the Rust assembler emits.
|
|
11
|
+
*
|
|
12
|
+
* The v2 manifest is the only producer, and it serializes `DynamicPropMeta`
|
|
13
|
+
* with `serde(rename_all = "camelCase")` — so camelCase is the only spelling
|
|
14
|
+
* this reader accepts, and the throw below is what a rename on the Rust side
|
|
15
|
+
* runs into.
|
|
9
16
|
*/
|
|
10
17
|
export interface DynamicPropMeta {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
18
|
+
varName: string;
|
|
19
|
+
slotClass: string;
|
|
20
|
+
property?: string | null;
|
|
21
|
+
properties?: readonly string[] | null;
|
|
22
|
+
transformName?: string | null;
|
|
23
|
+
/** Carried by the manifest for the per-component config; the shared module
|
|
24
|
+
* resolves transforms through the `transforms` registry, so it is dropped. */
|
|
25
|
+
transformFnSource?: string | null;
|
|
26
|
+
scaleValues?: Record<string, string> | null;
|
|
15
27
|
}
|
|
16
28
|
export interface DynamicPropConfigEntry {
|
|
17
29
|
varName: string;
|
|
18
30
|
slotClass: string;
|
|
31
|
+
property?: string;
|
|
32
|
+
properties?: readonly string[];
|
|
19
33
|
transformName?: string;
|
|
20
34
|
scaleValues?: Record<string, string>;
|
|
21
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dynamic-prop-config.d.ts","sourceRoot":"","sources":["../pipeline/dynamic-prop-config.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"dynamic-prop-config.d.ts","sourceRoot":"","sources":["../pipeline/dynamic-prop-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IACtC,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;mFAC+E;IAC/E,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC;AAED,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAC5C,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CA4BxC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1028,7 +1028,7 @@ function surfaceManifestDiagnostics(manifest, warn) {
|
|
|
1028
1028
|
*/
|
|
1029
1029
|
function applyUnitFallback(css) {
|
|
1030
1030
|
return css.replace(/([a-z-]+)\s*:\s*([^;{}]+);/g, (match, prop, value) => {
|
|
1031
|
-
if (_animus_ui_properties.
|
|
1031
|
+
if ((0, _animus_ui_properties.isUnitlessProperty)(prop)) return match;
|
|
1032
1032
|
let depth = 0;
|
|
1033
1033
|
let fixed = "";
|
|
1034
1034
|
let i = 0;
|
|
@@ -1236,12 +1236,18 @@ function loadSystemConfig(engineApi, opts) {
|
|
|
1236
1236
|
//#region pipeline/dynamic-prop-config.ts
|
|
1237
1237
|
function buildDynamicPropConfig(dynamicProps) {
|
|
1238
1238
|
const configEntries = {};
|
|
1239
|
-
for (const [propName, meta] of Object.entries(dynamicProps))
|
|
1240
|
-
varName: meta.
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1239
|
+
for (const [propName, meta] of Object.entries(dynamicProps)) {
|
|
1240
|
+
if (!meta.varName || !meta.slotClass) throw new Error(`buildDynamicPropConfig: dynamic prop '${propName}' carries no slot metadata — expected varName and slotClass, got keys [${Object.keys(meta).join(", ")}].`);
|
|
1241
|
+
const entry = {
|
|
1242
|
+
varName: meta.varName,
|
|
1243
|
+
slotClass: meta.slotClass
|
|
1244
|
+
};
|
|
1245
|
+
if (meta.property) entry.property = meta.property;
|
|
1246
|
+
if (meta.properties && meta.properties.length > 0) entry.properties = meta.properties;
|
|
1247
|
+
if (meta.transformName) entry.transformName = meta.transformName;
|
|
1248
|
+
if (meta.scaleValues && Object.keys(meta.scaleValues).length > 0) entry.scaleValues = meta.scaleValues;
|
|
1249
|
+
configEntries[propName] = entry;
|
|
1250
|
+
}
|
|
1245
1251
|
return configEntries;
|
|
1246
1252
|
}
|
|
1247
1253
|
//#endregion
|
|
@@ -1255,6 +1261,10 @@ function buildDynamicPropConfig(dynamicProps) {
|
|
|
1255
1261
|
* Runtime transform functions for dynamic props are not yet supported
|
|
1256
1262
|
* (transforms are resolved at extraction time via boa_engine in Rust), so
|
|
1257
1263
|
* `transforms` defaults to an empty object literal.
|
|
1264
|
+
*
|
|
1265
|
+
* `dynamicPropConfig` entries carry the CSS property the slot class declares
|
|
1266
|
+
* — the runtime's unit-fallback decision. Their field order and omission
|
|
1267
|
+
* rules belong to buildDynamicPropConfig.
|
|
1258
1268
|
*/
|
|
1259
1269
|
function buildSystemPropsModule(opts) {
|
|
1260
1270
|
const dynamicPropConfig = buildDynamicPropConfig(opts.dynamicProps);
|
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { dirname, extname, isAbsolute, join, relative, resolve, sep } from "path
|
|
|
5
5
|
import { createRequire as createRequire$1 } from "module";
|
|
6
6
|
import browserslist from "browserslist";
|
|
7
7
|
import { browserslistToTargets, transform } from "lightningcss";
|
|
8
|
-
import {
|
|
8
|
+
import { isUnitlessProperty } from "@animus-ui/properties";
|
|
9
9
|
import { realpathSync as realpathSync$1 } from "node:fs";
|
|
10
10
|
import { basename, dirname as dirname$1, join as join$1, normalize } from "node:path";
|
|
11
11
|
//#region \0rolldown/runtime.js
|
|
@@ -1008,7 +1008,7 @@ function surfaceManifestDiagnostics(manifest, warn) {
|
|
|
1008
1008
|
*/
|
|
1009
1009
|
function applyUnitFallback(css) {
|
|
1010
1010
|
return css.replace(/([a-z-]+)\s*:\s*([^;{}]+);/g, (match, prop, value) => {
|
|
1011
|
-
if (
|
|
1011
|
+
if (isUnitlessProperty(prop)) return match;
|
|
1012
1012
|
let depth = 0;
|
|
1013
1013
|
let fixed = "";
|
|
1014
1014
|
let i = 0;
|
|
@@ -1216,12 +1216,18 @@ function loadSystemConfig(engineApi, opts) {
|
|
|
1216
1216
|
//#region pipeline/dynamic-prop-config.ts
|
|
1217
1217
|
function buildDynamicPropConfig(dynamicProps) {
|
|
1218
1218
|
const configEntries = {};
|
|
1219
|
-
for (const [propName, meta] of Object.entries(dynamicProps))
|
|
1220
|
-
varName: meta.
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1219
|
+
for (const [propName, meta] of Object.entries(dynamicProps)) {
|
|
1220
|
+
if (!meta.varName || !meta.slotClass) throw new Error(`buildDynamicPropConfig: dynamic prop '${propName}' carries no slot metadata — expected varName and slotClass, got keys [${Object.keys(meta).join(", ")}].`);
|
|
1221
|
+
const entry = {
|
|
1222
|
+
varName: meta.varName,
|
|
1223
|
+
slotClass: meta.slotClass
|
|
1224
|
+
};
|
|
1225
|
+
if (meta.property) entry.property = meta.property;
|
|
1226
|
+
if (meta.properties && meta.properties.length > 0) entry.properties = meta.properties;
|
|
1227
|
+
if (meta.transformName) entry.transformName = meta.transformName;
|
|
1228
|
+
if (meta.scaleValues && Object.keys(meta.scaleValues).length > 0) entry.scaleValues = meta.scaleValues;
|
|
1229
|
+
configEntries[propName] = entry;
|
|
1230
|
+
}
|
|
1225
1231
|
return configEntries;
|
|
1226
1232
|
}
|
|
1227
1233
|
//#endregion
|
|
@@ -1235,6 +1241,10 @@ function buildDynamicPropConfig(dynamicProps) {
|
|
|
1235
1241
|
* Runtime transform functions for dynamic props are not yet supported
|
|
1236
1242
|
* (transforms are resolved at extraction time via boa_engine in Rust), so
|
|
1237
1243
|
* `transforms` defaults to an empty object literal.
|
|
1244
|
+
*
|
|
1245
|
+
* `dynamicPropConfig` entries carry the CSS property the slot class declares
|
|
1246
|
+
* — the runtime's unit-fallback decision. Their field order and omission
|
|
1247
|
+
* rules belong to buildDynamicPropConfig.
|
|
1238
1248
|
*/
|
|
1239
1249
|
function buildSystemPropsModule(opts) {
|
|
1240
1250
|
const dynamicPropConfig = buildDynamicPropConfig(opts.dynamicProps);
|
|
@@ -8,6 +8,10 @@ import type { DynamicPropMeta } from './dynamic-prop-config';
|
|
|
8
8
|
* Runtime transform functions for dynamic props are not yet supported
|
|
9
9
|
* (transforms are resolved at extraction time via boa_engine in Rust), so
|
|
10
10
|
* `transforms` defaults to an empty object literal.
|
|
11
|
+
*
|
|
12
|
+
* `dynamicPropConfig` entries carry the CSS property the slot class declares
|
|
13
|
+
* — the runtime's unit-fallback decision. Their field order and omission
|
|
14
|
+
* rules belong to buildDynamicPropConfig.
|
|
11
15
|
*/
|
|
12
16
|
export declare function buildSystemPropsModule(opts: {
|
|
13
17
|
systemPropMapJson: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"system-props-module.d.ts","sourceRoot":"","sources":["../pipeline/system-props-module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D
|
|
1
|
+
{"version":3,"file":"system-props-module.d.ts","sourceRoot":"","sources":["../pipeline/system-props-module.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,MAAM,CAQT"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@animus-ui/extract",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Animus static CSS extraction pipeline (Rust/NAPI)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"animus",
|
|
@@ -51,12 +51,12 @@
|
|
|
51
51
|
"build:v2:debug": "cd crates/extract-v2 && bunx napi build --platform"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@animus-ui/properties": "0.1.
|
|
54
|
+
"@animus-ui/properties": "0.1.5",
|
|
55
55
|
"browserslist": "^4.24.0",
|
|
56
56
|
"lightningcss": "^1.29.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@animus-ui/system": "0.1.
|
|
59
|
+
"@animus-ui/system": "0.1.5",
|
|
60
60
|
"@mdx-js/mdx": "3.1.1",
|
|
61
61
|
"@napi-rs/cli": "^3.7.3"
|
|
62
62
|
},
|