mnfst 0.5.312 → 0.5.313
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/lib/manifest.appwrite.data.js +1 -1
- package/lib/manifest.data.js +1 -1
- package/lib/manifest.data.min.js +1 -1
- package/lib/manifest.integrity.json +10 -10
- package/lib/manifest.js +2 -2
- package/lib/manifest.min.js +1 -1
- package/lib/manifest.modules.integrity.json +7 -7
- package/lib/manifest.sw.js +1 -1
- package/lib/manifest.sw.min.js +1 -1
- package/lib/manifest.utilities.js +88 -67
- package/lib/manifest.utilities.min.js +1 -1
- package/lib/manifest.utilities.min.js.map +1 -1
- package/lib/manifest.utilities.node.mjs +89 -72
- package/package.json +2 -1
|
@@ -1915,14 +1915,14 @@ TailwindCompiler.prototype.parseClassName = function (className) {
|
|
|
1915
1915
|
// Generate utilities from CSS variables
|
|
1916
1916
|
TailwindCompiler.prototype.generateUtilitiesFromVars = function (cssText, usedData) {
|
|
1917
1917
|
try {
|
|
1918
|
-
const
|
|
1918
|
+
const out = [];
|
|
1919
1919
|
const generatedRules = new Set(); // Track generated rules to prevent duplicates
|
|
1920
1920
|
const variables = this.extractThemeVariables(cssText);
|
|
1921
1921
|
const { classes: usedClasses, variableSuffixes } = usedData;
|
|
1922
1922
|
// Optional: raw rules + their full-regen order keys (incremental apply places deltas by them)
|
|
1923
1923
|
const rulesOut = usedData.rulesOut, keysOut = usedData.keysOut;
|
|
1924
1924
|
let slot = null;
|
|
1925
|
-
const emit = (rule, sub) => {
|
|
1925
|
+
const emit = (rule, sub, order) => { out.push({ rule, key: ruleKey(rule, order, slot.concat(slot[3] ? 2 : sub)) }); }; // opacity rules order by discovery
|
|
1926
1926
|
|
|
1927
1927
|
if (variables.size === 0) {
|
|
1928
1928
|
return '';
|
|
@@ -2028,7 +2028,7 @@ TailwindCompiler.prototype.generateUtilitiesFromVars = function (cssText, usedDa
|
|
|
2028
2028
|
const finalRule = hasMediaQuery ? wrapAtRules(atRules, rule) : rule;
|
|
2029
2029
|
|
|
2030
2030
|
if (!generatedRules.has(finalRule)) {
|
|
2031
|
-
emit(finalRule, 2);
|
|
2031
|
+
emit(finalRule, 2, mediaOrder(parsed.variants));
|
|
2032
2032
|
generatedRules.add(finalRule);
|
|
2033
2033
|
}
|
|
2034
2034
|
}
|
|
@@ -2106,7 +2106,7 @@ TailwindCompiler.prototype.generateUtilitiesFromVars = function (cssText, usedDa
|
|
|
2106
2106
|
}
|
|
2107
2107
|
}
|
|
2108
2108
|
|
|
2109
|
-
return
|
|
2109
|
+
return flushEntries(out, rulesOut, keysOut);
|
|
2110
2110
|
} catch (error) {
|
|
2111
2111
|
console.error('Error generating utilities:', error);
|
|
2112
2112
|
return '';
|
|
@@ -2143,6 +2143,60 @@ function breakpointRank(name) {
|
|
|
2143
2143
|
return bp.max ? -bp.px : bp.px;
|
|
2144
2144
|
}
|
|
2145
2145
|
|
|
2146
|
+
// ---- @media rule order (Tailwind v4): early media, then breakpoints by rank, then other media ----
|
|
2147
|
+
const NO_RANK = -1e6;
|
|
2148
|
+
const EARLY_MEDIA_VARIANTS = new Set([
|
|
2149
|
+
'motion-safe', 'motion-reduce', 'contrast-more', 'contrast-less',
|
|
2150
|
+
'prefers-reduced-motion', 'prefers-reduced-motion-no-preference',
|
|
2151
|
+
'prefers-contrast', 'prefers-contrast-less', 'prefers-contrast-no-preference'
|
|
2152
|
+
]);
|
|
2153
|
+
|
|
2154
|
+
// Named or arbitrary range variant → rank (max-* negative, min-width positive); null if not a range
|
|
2155
|
+
function rangeRank(name) {
|
|
2156
|
+
if (!name) return null;
|
|
2157
|
+
if (breakpointOf(name)) return breakpointRank(name);
|
|
2158
|
+
const m = /^(min|max)-\[(.+)\]$/.exec(name);
|
|
2159
|
+
if (!m) return null;
|
|
2160
|
+
const u = /^(-?\d*\.?\d+)(px|rem|em)$/.exec(m[2].trim());
|
|
2161
|
+
const px = u ? parseFloat(u[1]) * (u[2] === 'px' ? 1 : 16) : null;
|
|
2162
|
+
if (m[1] === 'max') return px === null ? -1e5 : -px;
|
|
2163
|
+
return px === null ? 1e5 : px;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
// [band, r1, r2, extra] for an @media rule built from these variants; the highest-order variant decides,
|
|
2167
|
+
// extra lower-order media variants sort after (md: before motion-safe:md:)
|
|
2168
|
+
function mediaOrder(variants) {
|
|
2169
|
+
let band = -1, extra = 0;
|
|
2170
|
+
const ranks = [];
|
|
2171
|
+
for (const v of variants || []) {
|
|
2172
|
+
if (!v || typeof v.selector !== 'string' || !v.selector.startsWith('@media')) continue;
|
|
2173
|
+
const r = rangeRank(v.name);
|
|
2174
|
+
if (r !== null) { ranks.push(r); band = Math.max(band, 1); }
|
|
2175
|
+
else { band = Math.max(band, EARLY_MEDIA_VARIANTS.has(v.name) ? 0 : 2); extra++; }
|
|
2176
|
+
}
|
|
2177
|
+
ranks.sort((a, b) => b - a);
|
|
2178
|
+
if (band === 1) extra = Math.min(extra, 1);
|
|
2179
|
+
else extra = 0;
|
|
2180
|
+
return [band < 0 ? 2 : band, ranks.length ? ranks[0] : NO_RANK, ranks.length > 1 ? ranks[1] : NO_RANK, extra];
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
// Full order key: [media, band, r1, r2, extra, section, var/entry, pair/array, opacity, sub]
|
|
2184
|
+
function ruleKey(rule, order, slotKey) {
|
|
2185
|
+
const head = isMediaRule(rule) ? [1].concat(order || [2, NO_RANK, NO_RANK, 0]) : [0, 0, 0, 0, 0];
|
|
2186
|
+
return head.concat(slotKey);
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
function sortEntries(entries) {
|
|
2190
|
+
return entries.slice().sort((a, b) => compareKeys(a.key, b.key));
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
// Sorted text; raw rules + keys go to rulesOut/keysOut when the caller asked for them
|
|
2194
|
+
function flushEntries(out, rulesOut, keysOut) {
|
|
2195
|
+
const sorted = sortEntries(out);
|
|
2196
|
+
if (rulesOut) for (const e of sorted) { rulesOut.push(e.rule); keysOut.push(e.key); }
|
|
2197
|
+
return sorted.map(e => e.rule).join('\n');
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2146
2200
|
// Top-level display declarations only (nested blocks ignored)
|
|
2147
2201
|
function topLevelDisplay(css) {
|
|
2148
2202
|
let flat = '', depth = 0;
|
|
@@ -2188,12 +2242,12 @@ function tailwindResponsiveDisplay(usedClasses) {
|
|
|
2188
2242
|
// Generate custom utilities from discovered custom utility classes
|
|
2189
2243
|
TailwindCompiler.prototype.generateCustomUtilities = function (usedData) {
|
|
2190
2244
|
try {
|
|
2191
|
-
const
|
|
2245
|
+
const out = [];
|
|
2192
2246
|
const generatedRules = new Set();
|
|
2193
2247
|
const { classes: usedClasses } = usedData;
|
|
2194
2248
|
const rulesOut = usedData.rulesOut, keysOut = usedData.keysOut;
|
|
2195
2249
|
let slot = null;
|
|
2196
|
-
const emit = (rule, sub) => {
|
|
2250
|
+
const emit = (rule, sub, order) => { out.push({ rule, key: ruleKey(rule, order, slot.concat(sub)) }); };
|
|
2197
2251
|
const responsiveDisplay = [];
|
|
2198
2252
|
|
|
2199
2253
|
// Helper to clean up [object Object] from CSS strings
|
|
@@ -2537,7 +2591,7 @@ TailwindCompiler.prototype.generateCustomUtilities = function (usedData) {
|
|
|
2537
2591
|
}
|
|
2538
2592
|
|
|
2539
2593
|
if (!generatedRules.has(finalRule)) {
|
|
2540
|
-
emit(finalRule, 2);
|
|
2594
|
+
emit(finalRule, 2, mediaOrder(parsed.variants));
|
|
2541
2595
|
generatedRules.add(finalRule);
|
|
2542
2596
|
}
|
|
2543
2597
|
}
|
|
@@ -2630,51 +2684,34 @@ TailwindCompiler.prototype.generateCustomUtilities = function (usedData) {
|
|
|
2630
2684
|
const rule = `${e.media} { ${own}${own} { display: ${e.css} } }`;
|
|
2631
2685
|
if (generatedRules.has(rule)) continue;
|
|
2632
2686
|
generatedRules.add(rule);
|
|
2633
|
-
slot = [2,
|
|
2634
|
-
emit(rule, 2);
|
|
2687
|
+
slot = [2, 0, 0, 0];
|
|
2688
|
+
emit(rule, 2, [1, e.rank, NO_RANK, 0]);
|
|
2635
2689
|
}
|
|
2636
2690
|
}
|
|
2637
2691
|
|
|
2638
|
-
return
|
|
2692
|
+
return flushEntries(out, rulesOut, keysOut);
|
|
2639
2693
|
} catch (error) {
|
|
2640
2694
|
console.error('Error generating custom utilities:', error);
|
|
2641
2695
|
return '';
|
|
2642
2696
|
}
|
|
2643
2697
|
};
|
|
2644
2698
|
|
|
2645
|
-
//
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
currentRule = line;
|
|
2653
|
-
} else {
|
|
2654
|
-
currentRule += '\n' + line;
|
|
2655
|
-
}
|
|
2656
|
-
}
|
|
2657
|
-
if (currentRule.trim()) rules.push(currentRule.trim());
|
|
2658
|
-
return rules;
|
|
2699
|
+
// Rules + order keys for theme and custom utilities, in sheet order (base, then @media by breakpoint).
|
|
2700
|
+
// Full compile, incremental apply, cache text and the node bake all write this order.
|
|
2701
|
+
TailwindCompiler.prototype.generateOrderedUtilities = function (themeCss, usedData) {
|
|
2702
|
+
const data = Object.assign({}, usedData, { rulesOut: [], keysOut: [] });
|
|
2703
|
+
this.generateUtilitiesFromVars(themeCss, data);
|
|
2704
|
+
this.generateCustomUtilities(data);
|
|
2705
|
+
return sortEntries(data.rulesOut.map((rule, i) => ({ rule, key: data.keysOut[i] })));
|
|
2659
2706
|
};
|
|
2660
2707
|
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
if (!utilitiesText) return '';
|
|
2664
|
-
const rules = this.splitUtilityRules(utilitiesText);
|
|
2665
|
-
rules.sort((a, b) => {
|
|
2666
|
-
const aHasMedia = a.startsWith('@media');
|
|
2667
|
-
const bHasMedia = b.startsWith('@media');
|
|
2668
|
-
if (!aHasMedia && bHasMedia) return -1;
|
|
2669
|
-
if (aHasMedia && !bHasMedia) return 1;
|
|
2670
|
-
return 0;
|
|
2671
|
-
});
|
|
2672
|
-
return rules.join('\n\n');
|
|
2708
|
+
TailwindCompiler.prototype.orderedUtilitiesCss = function (entries) {
|
|
2709
|
+
return entries.map(e => e.rule).join('\n\n');
|
|
2673
2710
|
};
|
|
2674
2711
|
|
|
2675
2712
|
// ---- Incremental apply: new rules go in through CSSOM, never a whole-sheet rewrite ----
|
|
2676
2713
|
// Entries mirror the layer's cssRules 1:1, each keyed by where a full regen would emit it
|
|
2677
|
-
// (
|
|
2714
|
+
// (see ruleKey); deltas are inserted at that index.
|
|
2678
2715
|
|
|
2679
2716
|
const utilitiesCssFrom = (applied) => `@layer utilities {\n${applied.entries.map(e => e.rule).join('\n\n')}\n}`;
|
|
2680
2717
|
const isMediaRule = (rule) => rule.trim().startsWith('@media');
|
|
@@ -2684,16 +2721,9 @@ function compareKeys(a, b) {
|
|
|
2684
2721
|
return 0;
|
|
2685
2722
|
}
|
|
2686
2723
|
|
|
2687
|
-
// Raw rules + order keys for a class set, as a full regen would emit them
|
|
2724
|
+
// Raw rules + order keys for a class set, as a full regen would emit them
|
|
2688
2725
|
TailwindCompiler.prototype.generateKeyedUtilities = function (themeCss, classes) {
|
|
2689
|
-
|
|
2690
|
-
this.generateUtilitiesFromVars(themeCss, usedData);
|
|
2691
|
-
this.generateCustomUtilities(usedData);
|
|
2692
|
-
const out = usedData.rulesOut.map((rule, i) => {
|
|
2693
|
-
const media = isMediaRule(rule) ? 1 : 0;
|
|
2694
|
-
return { rule, key: [media].concat(usedData.keysOut[i]) };
|
|
2695
|
-
});
|
|
2696
|
-
return out.filter(e => !e.key[0]).concat(out.filter(e => e.key[0]));
|
|
2726
|
+
return this.generateOrderedUtilities(themeCss, { classes, variableSuffixes: [] });
|
|
2697
2727
|
};
|
|
2698
2728
|
|
|
2699
2729
|
TailwindCompiler.prototype.utilitiesLayerRule = function () {
|
|
@@ -2752,7 +2782,11 @@ TailwindCompiler.prototype.compileDelta = function (themeCss) {
|
|
|
2752
2782
|
const candidates = [];
|
|
2753
2783
|
for (const cls of this.dynamicClassCache) if (!applied.classes.has(cls)) candidates.push(cls);
|
|
2754
2784
|
const classes = this.filterStaticallyCoveredClasses(candidates);
|
|
2785
|
+
// Tailwind display classes at a breakpoint join the display block, which only a full regen emits
|
|
2786
|
+
if (tailwindResponsiveDisplay(classes).length) return false;
|
|
2755
2787
|
const fresh = classes.length ? this.generateKeyedUtilities(themeCss, classes).filter(e => !applied.rules.has(e.rule)) : [];
|
|
2788
|
+
// The display block's contents depend on every used class: a new block rule means a full regen
|
|
2789
|
+
if (fresh.some(e => e.key[5] === 2)) return false;
|
|
2756
2790
|
const entries = applied.entries;
|
|
2757
2791
|
|
|
2758
2792
|
// Place every rule first; bail before touching the sheet if any is ambiguous
|
|
@@ -2760,9 +2794,10 @@ TailwindCompiler.prototype.compileDelta = function (themeCss) {
|
|
|
2760
2794
|
for (const e of fresh) {
|
|
2761
2795
|
let lo = 0, hi = entries.length;
|
|
2762
2796
|
while (lo < hi) { const mid = (lo + hi) >> 1; if (compareKeys(entries[mid].key, e.key) <= 0) lo = mid + 1; else hi = mid; }
|
|
2763
|
-
// Same utility, same
|
|
2764
|
-
|
|
2765
|
-
|
|
2797
|
+
// Same utility, same media rank, both variants: full regen orders them by discovery
|
|
2798
|
+
const last = e.key.length - 1;
|
|
2799
|
+
if (e.key[last] === 2) {
|
|
2800
|
+
const sameSlot = (x) => x && compareKeys(x.key.slice(0, last), e.key.slice(0, last)) === 0 && x.key[last] === 2;
|
|
2766
2801
|
if (sameSlot(entries[lo - 1]) || sameSlot(entries[lo]) || plan.some(q => sameSlot(q.e))) return false;
|
|
2767
2802
|
}
|
|
2768
2803
|
plan.push({ e, at: lo });
|
|
@@ -2966,14 +3001,8 @@ TailwindCompiler.prototype.compile = async function () {
|
|
|
2966
3001
|
}
|
|
2967
3002
|
}
|
|
2968
3003
|
|
|
2969
|
-
|
|
2970
|
-
const varUtilities = this.generateUtilitiesFromVars(themeCss, staticUsedData);
|
|
2971
|
-
const customUtilitiesGenerated = this.generateCustomUtilities(staticUsedData);
|
|
3004
|
+
const allUtilities = this.orderedUtilitiesCss(this.generateOrderedUtilities(themeCss, staticUsedData));
|
|
2972
3005
|
|
|
2973
|
-
let allUtilities = [varUtilities, customUtilitiesGenerated].filter(Boolean).join('\n\n');
|
|
2974
|
-
// Sort utilities so base classes come before variants
|
|
2975
|
-
allUtilities = this.sortUtilities(allUtilities);
|
|
2976
|
-
|
|
2977
3006
|
if (allUtilities) {
|
|
2978
3007
|
const finalCss = `@layer utilities {\n${allUtilities}\n}`;
|
|
2979
3008
|
|
|
@@ -3057,16 +3086,9 @@ TailwindCompiler.prototype.compile = async function () {
|
|
|
3057
3086
|
// Generate utilities for all classes (static + dynamic) if needed
|
|
3058
3087
|
if (hasVariableChanges || dynamicClassesHash !== this.lastClassesHash) {
|
|
3059
3088
|
|
|
3060
|
-
|
|
3061
|
-
const
|
|
3062
|
-
const keyedData = Object.assign({}, usedData, { rulesOut, keysOut });
|
|
3063
|
-
const varUtilities = this.generateUtilitiesFromVars(themeCss, keyedData);
|
|
3064
|
-
const customUtilitiesGenerated = this.generateCustomUtilities(keyedData);
|
|
3089
|
+
const entries = this.generateOrderedUtilities(themeCss, usedData);
|
|
3090
|
+
const allUtilities = this.orderedUtilitiesCss(entries);
|
|
3065
3091
|
|
|
3066
|
-
let allUtilities = [varUtilities, customUtilitiesGenerated].filter(Boolean).join('\n\n');
|
|
3067
|
-
// Sort utilities so base classes come before variants
|
|
3068
|
-
allUtilities = this.sortUtilities(allUtilities);
|
|
3069
|
-
|
|
3070
3092
|
if (allUtilities) {
|
|
3071
3093
|
const finalCss = `@layer utilities {\n${allUtilities}\n}`;
|
|
3072
3094
|
|
|
@@ -3087,8 +3109,7 @@ TailwindCompiler.prototype.compile = async function () {
|
|
|
3087
3109
|
});
|
|
3088
3110
|
});
|
|
3089
3111
|
this.lastClassesHash = dynamicClassesHash;
|
|
3090
|
-
|
|
3091
|
-
this.recordAppliedUtilities(entries.filter(e => !e.key[0]).concat(entries.filter(e => e.key[0])), themeCss, dynamicClasses);
|
|
3112
|
+
this.recordAppliedUtilities(entries, themeCss, dynamicClasses);
|
|
3092
3113
|
// Classes that arrived during the await above still need a pass
|
|
3093
3114
|
if (this.dynamicClassCache.size > dynamicClasses.length) this.compile();
|
|
3094
3115
|
|
|
@@ -3359,11 +3380,7 @@ export async function compileUtilities({ classes = [], themeCss = '', baseCss =
|
|
|
3359
3380
|
|
|
3360
3381
|
const usedData = { classes: uniqueClasses, variableSuffixes: [] };
|
|
3361
3382
|
|
|
3362
|
-
const
|
|
3363
|
-
const customUtilities = compiler.generateCustomUtilities(usedData);
|
|
3364
|
-
|
|
3365
|
-
let allUtilities = [varUtilities, customUtilities].filter(Boolean).join('\n\n');
|
|
3366
|
-
allUtilities = compiler.sortUtilities(allUtilities);
|
|
3383
|
+
const allUtilities = compiler.orderedUtilitiesCss(compiler.generateOrderedUtilities(cssText, usedData));
|
|
3367
3384
|
|
|
3368
3385
|
const manifestLayer = allUtilities ? `@layer utilities {\n${allUtilities}\n}` : '';
|
|
3369
3386
|
const tailwindLayer = await compileTailwindPass(uniqueClasses, tailwind);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mnfst",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.313",
|
|
4
4
|
"private": false,
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"templates/starter",
|
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"test:e2e:prerender-patch": "node tests/e2e/utilities-prerender-patch.e2e.mjs",
|
|
64
64
|
"test:e2e:hidden-responsive": "node tests/e2e/utilities-hidden-responsive.e2e.mjs",
|
|
65
65
|
"test:e2e:breakpoint-range": "node tests/e2e/utilities-breakpoint-range.e2e.mjs",
|
|
66
|
+
"test:e2e:responsive-order": "node tests/e2e/utilities-responsive-order.e2e.mjs",
|
|
66
67
|
"test:e2e:tailwind-dark": "node tests/e2e/tailwind-dark-variant.e2e.mjs",
|
|
67
68
|
"test:e2e:inline-style-variants": "node tests/e2e/utilities-inline-style-variants.e2e.mjs",
|
|
68
69
|
"test:e2e:presence-tabs": "node tests/e2e/presence-tabs.e2e.mjs",
|