@ng-native/tailwind 0.7.0 → 0.9.0
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/flatten.cjs +20 -4
- package/package.json +3 -3
package/flatten.cjs
CHANGED
|
@@ -260,6 +260,12 @@ const RUNTIME_SUPPLIED =
|
|
|
260
260
|
* per node: a transform, a shadow or a filter, or a part of a shadow slot, as `ring-blue-500` sets
|
|
261
261
|
* the colour of `ring-2`'s. Anything else stays settled here.
|
|
262
262
|
*/
|
|
263
|
+
/** Whether a property of the rule with this selector has its `var()` resolved per node. */
|
|
264
|
+
function perNodeIn(selector) {
|
|
265
|
+
const framed = KEYFRAME.test(selector);
|
|
266
|
+
return (property) => framed || RESOLVED_PER_NODE.test(property) || SHADOW_SLOT.test(property);
|
|
267
|
+
}
|
|
268
|
+
|
|
263
269
|
function crossRuleVariables(css) {
|
|
264
270
|
const set = new Set();
|
|
265
271
|
const setWithoutReading = new Set();
|
|
@@ -269,8 +275,9 @@ function crossRuleVariables(css) {
|
|
|
269
275
|
if (selectorList(selector).some((one) => one.trim() === '*')) continue;
|
|
270
276
|
const declared = new Set([...body.matchAll(/(--tw-[\w-]+)\s*:/g)].map((match) => match[1]));
|
|
271
277
|
const read = new Set();
|
|
278
|
+
const settles = perNodeIn(selector);
|
|
272
279
|
for (const [, property, value] of body.matchAll(/(-?-?[\w-]+)\s*:\s*([^;]+)/g)) {
|
|
273
|
-
const perNode =
|
|
280
|
+
const perNode = settles(property);
|
|
274
281
|
for (const [, name] of value.matchAll(/var\(\s*(--tw-[\w-]+)/g)) {
|
|
275
282
|
if (perNode || REVERSE_SLOT.test(name)) read.add(name);
|
|
276
283
|
}
|
|
@@ -310,8 +317,13 @@ function markUnitlessReverse(css) {
|
|
|
310
317
|
}
|
|
311
318
|
|
|
312
319
|
/** Properties whose `var()` the engine resolves per node, from the tokens in scope there. */
|
|
320
|
+
// An animation's times among them, and every property of a keyframe, which is settled against
|
|
321
|
+
// the element that plays it: `duration-300` times `animate-in`, and `fade-in-0` says where from.
|
|
313
322
|
const RESOLVED_PER_NODE =
|
|
314
|
-
/^(translate|scale|rotate|transform|box-shadow|text-shadow|filter|font-variant-numeric|touch-action)$/;
|
|
323
|
+
/^(translate|scale|rotate|transform|box-shadow|text-shadow|filter|font-variant-numeric|touch-action|animation)$/;
|
|
324
|
+
|
|
325
|
+
/** The selector of a keyframe: `from`, `to`, or the percentages it is at. */
|
|
326
|
+
const KEYFRAME = /^\s*(from|to|[\d.]+%)(\s*,\s*(from|to|[\d.]+%))*\s*$/;
|
|
315
327
|
|
|
316
328
|
/**
|
|
317
329
|
* A shadow slot, whose own parts another class may set: `ring-blue-500` its colour,
|
|
@@ -352,6 +364,9 @@ function substituteInRules(css, values, runtime) {
|
|
|
352
364
|
});
|
|
353
365
|
}
|
|
354
366
|
|
|
367
|
+
/** A value put in a token's place, apart from what is written straight after it: `var(--a)var(--b)` is two values. */
|
|
368
|
+
const apartFrom = (value, next) => (/[\w.#(%-]/.test(next ?? '') ? `${value} ` : value);
|
|
369
|
+
|
|
355
370
|
function substituteVariables(css, values, runtime) {
|
|
356
371
|
let out = css;
|
|
357
372
|
for (let pass = 0; pass < 5; pass++) {
|
|
@@ -378,8 +393,9 @@ function substituteVariables(css, values, runtime) {
|
|
|
378
393
|
from = found.end;
|
|
379
394
|
continue;
|
|
380
395
|
}
|
|
381
|
-
|
|
382
|
-
|
|
396
|
+
const apart = apartFrom(value, out[found.end]);
|
|
397
|
+
out = out.slice(0, found.at) + apart + out.slice(found.end);
|
|
398
|
+
from = found.at + apart.length;
|
|
383
399
|
changed = true;
|
|
384
400
|
}
|
|
385
401
|
if (!changed) break;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ng-native/tailwind",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Tailwind CSS preset for Angular Native: Tailwind 4 and Tailwind 3, on native and on the web.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"angular",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"type": "commonjs",
|
|
18
18
|
"main": "flatten.cjs",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ng-native/metro": "0.
|
|
20
|
+
"@ng-native/metro": "0.9.0",
|
|
21
21
|
"lightningcss": "^1.30.2"
|
|
22
22
|
},
|
|
23
23
|
"nx": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"url": "https://github.com/ng-native/ng-native/issues"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@ng-native/metro": "0.
|
|
35
|
+
"@ng-native/metro": "0.9.0",
|
|
36
36
|
"@tailwindcss/cli": "^4.3.3",
|
|
37
37
|
"tailwindcss": "^3.4.1 || ^4.3.3"
|
|
38
38
|
},
|