@animus-ui/extract 0.1.0-next.34 → 0.1.0-next.36
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.mjs +10 -51
- package/dist/prefix.d.ts +2 -1
- package/dist/prefix.d.ts.map +1 -1
- package/dist/unit-fallback.d.ts.map +1 -1
- package/package.json +10 -6
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { readFileSync } from "fs";
|
|
3
3
|
import { execSync } from "child_process";
|
|
4
|
+
import { UNITLESS_PROPERTIES } from "@animus-ui/properties";
|
|
4
5
|
//#region \0rolldown/runtime.js
|
|
5
6
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
6
7
|
//#endregion
|
|
@@ -133,11 +134,12 @@ function extractSystemFilePackages(systemFilePath) {
|
|
|
133
134
|
* `var(--color-ember)` -> `var(--prefix-color-ember)`
|
|
134
135
|
* Theme JSON: `{ "colors.ember": "var(--color-ember)" }` -> `{ "colors.ember": "var(--prefix-color-ember)" }`
|
|
135
136
|
*/
|
|
136
|
-
function applyPrefix(prefix, variableMapJson, variableCss, themeJson) {
|
|
137
|
+
function applyPrefix(prefix, variableMapJson, variableCss, themeJson, contextualVarsJson) {
|
|
137
138
|
if (!prefix) return {
|
|
138
139
|
variableMapJson,
|
|
139
140
|
variableCss,
|
|
140
|
-
themeJson
|
|
141
|
+
themeJson,
|
|
142
|
+
contextualVarsJson
|
|
141
143
|
};
|
|
142
144
|
const varRefRe = /var\(--([a-zA-Z][\w-]*)\)/g;
|
|
143
145
|
const map = JSON.parse(variableMapJson);
|
|
@@ -151,6 +153,12 @@ function applyPrefix(prefix, variableMapJson, variableCss, themeJson) {
|
|
|
151
153
|
variableCss: css
|
|
152
154
|
};
|
|
153
155
|
if (themeJson) result.themeJson = themeJson.replace(varRefRe, `var(--${prefix}-$1)`);
|
|
156
|
+
if (contextualVarsJson) {
|
|
157
|
+
const ctxVars = JSON.parse(contextualVarsJson);
|
|
158
|
+
const prefixedCtx = {};
|
|
159
|
+
for (const [scale, names] of Object.entries(ctxVars)) prefixedCtx[scale] = names.map((name) => `${prefix}-${name}`);
|
|
160
|
+
result.contextualVarsJson = JSON.stringify(prefixedCtx);
|
|
161
|
+
}
|
|
154
162
|
return result;
|
|
155
163
|
}
|
|
156
164
|
//#endregion
|
|
@@ -312,55 +320,6 @@ function execSubprocess(script, cwd, args = []) {
|
|
|
312
320
|
//#endregion
|
|
313
321
|
//#region pipeline/unit-fallback.ts
|
|
314
322
|
/**
|
|
315
|
-
* CSS properties that accept unitless numeric values.
|
|
316
|
-
* Matches @emotion/unitless and React DOM's style handling.
|
|
317
|
-
* Bare numerics on properties NOT in this set receive `px`.
|
|
318
|
-
*/
|
|
319
|
-
const UNITLESS_PROPERTIES = new Set([
|
|
320
|
-
"animation-iteration-count",
|
|
321
|
-
"border-image-outset",
|
|
322
|
-
"border-image-slice",
|
|
323
|
-
"border-image-width",
|
|
324
|
-
"box-flex",
|
|
325
|
-
"box-flex-group",
|
|
326
|
-
"box-ordinal-group",
|
|
327
|
-
"column-count",
|
|
328
|
-
"columns",
|
|
329
|
-
"flex",
|
|
330
|
-
"flex-grow",
|
|
331
|
-
"flex-positive",
|
|
332
|
-
"flex-shrink",
|
|
333
|
-
"flex-negative",
|
|
334
|
-
"flex-order",
|
|
335
|
-
"grid-area",
|
|
336
|
-
"grid-row",
|
|
337
|
-
"grid-row-end",
|
|
338
|
-
"grid-row-span",
|
|
339
|
-
"grid-row-start",
|
|
340
|
-
"grid-column",
|
|
341
|
-
"grid-column-end",
|
|
342
|
-
"grid-column-span",
|
|
343
|
-
"grid-column-start",
|
|
344
|
-
"font-weight",
|
|
345
|
-
"line-clamp",
|
|
346
|
-
"line-height",
|
|
347
|
-
"opacity",
|
|
348
|
-
"order",
|
|
349
|
-
"orphans",
|
|
350
|
-
"tab-size",
|
|
351
|
-
"widows",
|
|
352
|
-
"z-index",
|
|
353
|
-
"zoom",
|
|
354
|
-
"fill-opacity",
|
|
355
|
-
"flood-opacity",
|
|
356
|
-
"stop-opacity",
|
|
357
|
-
"stroke-dasharray",
|
|
358
|
-
"stroke-dashoffset",
|
|
359
|
-
"stroke-miterlimit",
|
|
360
|
-
"stroke-opacity",
|
|
361
|
-
"stroke-width"
|
|
362
|
-
]);
|
|
363
|
-
/**
|
|
364
323
|
* Append `px` to bare numeric values in CSS declarations for properties
|
|
365
324
|
* that expect length units. Unitless properties are preserved as-is.
|
|
366
325
|
* Numbers inside CSS function calls (cubic-bezier, rgb, calc, etc.) are skipped.
|
package/dist/prefix.d.ts
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
* `var(--color-ember)` -> `var(--prefix-color-ember)`
|
|
7
7
|
* Theme JSON: `{ "colors.ember": "var(--color-ember)" }` -> `{ "colors.ember": "var(--prefix-color-ember)" }`
|
|
8
8
|
*/
|
|
9
|
-
export declare function applyPrefix(prefix: string, variableMapJson: string, variableCss: string, themeJson?: string): {
|
|
9
|
+
export declare function applyPrefix(prefix: string, variableMapJson: string, variableCss: string, themeJson?: string, contextualVarsJson?: string): {
|
|
10
10
|
variableMapJson: string;
|
|
11
11
|
variableCss: string;
|
|
12
12
|
themeJson?: string;
|
|
13
|
+
contextualVarsJson?: string;
|
|
13
14
|
};
|
|
14
15
|
//# sourceMappingURL=prefix.d.ts.map
|
package/dist/prefix.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefix.d.ts","sourceRoot":"","sources":["../pipeline/prefix.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"prefix.d.ts","sourceRoot":"","sources":["../pipeline/prefix.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,SAAS,CAAC,EAAE,MAAM,EAClB,kBAAkB,CAAC,EAAE,MAAM,GAC1B;IACD,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CA0CA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unit-fallback.d.ts","sourceRoot":"","sources":["../pipeline/unit-fallback.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unit-fallback.d.ts","sourceRoot":"","sources":["../pipeline/unit-fallback.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA2CrD"}
|
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.36",
|
|
4
4
|
"description": "Animus static CSS extraction pipeline (Rust/NAPI)",
|
|
5
5
|
"author": "codecaaron <airrobb@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,14 +40,18 @@
|
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
|
-
"build": "napi build --platform --release &&
|
|
43
|
+
"build": "napi build --platform --release && bun run build:ts",
|
|
44
|
+
"build:ts": "tsdown && tsc -p tsconfig.build.json",
|
|
44
45
|
"build:debug": "napi build --platform",
|
|
45
|
-
"
|
|
46
|
+
"compile": "tsc -p tsconfig.build.json --noEmit"
|
|
46
47
|
},
|
|
47
48
|
"optionalDependencies": {
|
|
48
|
-
"@animus-ui/extract-darwin-arm64": "0.1.0-next.
|
|
49
|
-
"@animus-ui/extract-linux-x64-gnu": "0.1.0-next.
|
|
50
|
-
"@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.
|
|
49
|
+
"@animus-ui/extract-darwin-arm64": "0.1.0-next.36",
|
|
50
|
+
"@animus-ui/extract-linux-x64-gnu": "0.1.0-next.36",
|
|
51
|
+
"@animus-ui/extract-linux-arm64-gnu": "0.1.0-next.36"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"@animus-ui/properties": "0.1.0-next.36"
|
|
51
55
|
},
|
|
52
56
|
"devDependencies": {
|
|
53
57
|
"@animus-ui/system": "workspace:*",
|