mnfst 0.5.323 → 0.5.325
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.components.js +69 -4
- package/lib/manifest.components.min.js +1 -1
- package/lib/manifest.components.min.js.map +1 -1
- package/lib/manifest.data.js +1 -1
- package/lib/manifest.data.min.js +1 -1
- package/lib/manifest.integrity.json +12 -12
- package/lib/manifest.js +57 -6
- package/lib/manifest.min.js +1 -1
- package/lib/manifest.min.js.map +1 -1
- package/lib/manifest.modules.integrity.json +9 -9
- package/lib/manifest.sw.js +1 -1
- package/lib/manifest.sw.min.js +1 -1
- package/lib/manifest.utilities.js +110 -56
- package/lib/manifest.utilities.min.js +1 -1
- package/lib/manifest.utilities.min.js.map +1 -1
- package/lib/manifest.utilities.node.mjs +85 -16
- package/package.json +3 -1
|
@@ -740,12 +740,20 @@ class TailwindCompiler {
|
|
|
740
740
|
|
|
741
741
|
// Ensure #manifest-styles is last in head so our responsive/variant rules win over Tailwind and any later-injected styles
|
|
742
742
|
TailwindCompiler.prototype.ensureUtilityStylesLast = function () {
|
|
743
|
-
if (this.styleElement
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
743
|
+
if (!this.styleElement || !this.styleElement.parentNode) return;
|
|
744
|
+
// Only a stylesheet after ours can out-order it (scripts and meta tags cannot)
|
|
745
|
+
let later = this.styleElement.nextElementSibling;
|
|
746
|
+
while (later && !isStylesheetNode(later)) later = later.nextElementSibling;
|
|
747
|
+
if (!later && this.styleElement.parentNode === document.head) return;
|
|
748
|
+
document.head.appendChild(this.styleElement);
|
|
749
|
+
if (this.resyncUtilitiesText) this.resyncUtilitiesText();
|
|
747
750
|
};
|
|
748
751
|
|
|
752
|
+
// Any <link> counts: a preload can become a stylesheet after insertion
|
|
753
|
+
function isStylesheetNode(node) {
|
|
754
|
+
return node.localName === 'style' || node.localName === 'link';
|
|
755
|
+
}
|
|
756
|
+
|
|
749
757
|
// When any element is added to head after ours, move #manifest-styles to end. Handles CDN load order (e.g. Tailwind injecting after we run).
|
|
750
758
|
TailwindCompiler.prototype.setupUtilityStylesOrderObserver = function () {
|
|
751
759
|
if (!document.head || !this.styleElement) return;
|
|
@@ -755,6 +763,7 @@ TailwindCompiler.prototype.setupUtilityStylesOrderObserver = function () {
|
|
|
755
763
|
if (mutation.type !== 'childList' || !mutation.addedNodes.length) continue;
|
|
756
764
|
for (const node of mutation.addedNodes) {
|
|
757
765
|
if (node.nodeType !== Node.ELEMENT_NODE || node === self.styleElement) continue;
|
|
766
|
+
if (!isStylesheetNode(node)) continue;
|
|
758
767
|
self.ensureUtilityStylesLast();
|
|
759
768
|
break;
|
|
760
769
|
}
|
|
@@ -859,7 +868,10 @@ TailwindCompiler.prototype.scanStaticClasses = async function () {
|
|
|
859
868
|
|
|
860
869
|
const componentUrls = [];
|
|
861
870
|
|
|
862
|
-
|
|
871
|
+
// A complete shipped sheet was baked from these same files: nothing to learn by fetching them
|
|
872
|
+
const baked = !!document.querySelector('[data-mnfst-utilities][data-mnfst-utilities-complete]');
|
|
873
|
+
|
|
874
|
+
if (!baked && registry && registry.manifest) {
|
|
863
875
|
// Get all component paths from manifest
|
|
864
876
|
const allComponents = [
|
|
865
877
|
...(registry.manifest.preloadedComponents || []),
|
|
@@ -870,6 +882,14 @@ TailwindCompiler.prototype.scanStaticClasses = async function () {
|
|
|
870
882
|
|
|
871
883
|
const componentPromises = componentUrls.map(async (url) => {
|
|
872
884
|
try {
|
|
885
|
+
// The components loader already holds or is fetching this file: share it
|
|
886
|
+
const loader = window.ManifestComponentsLoader;
|
|
887
|
+
const name = url.split('/').pop().replace('.html', '');
|
|
888
|
+
const held = loader && (loader.cache?.[name] || loader._raw?.[name]);
|
|
889
|
+
if (held) {
|
|
890
|
+
const html = await held;
|
|
891
|
+
if (html) { this.extractClassesFromHTML(html, staticClasses); return; }
|
|
892
|
+
}
|
|
873
893
|
// Use root-relative URL first to avoid 404s on doc routes (e.g. /getting-started/...)
|
|
874
894
|
const rootRelative = url.startsWith('/') ? url : '/' + url;
|
|
875
895
|
const pathsToTry = [rootRelative, url];
|
|
@@ -1073,6 +1093,12 @@ TailwindCompiler.prototype.getUsedClasses = function () {
|
|
|
1073
1093
|
}
|
|
1074
1094
|
};
|
|
1075
1095
|
|
|
1096
|
+
function isDevHostname(host) {
|
|
1097
|
+
const h = String(host || '').toLowerCase();
|
|
1098
|
+
return !h || h === 'localhost' || h === '127.0.0.1' || h === '[::1]' || h === '::1' || h === '0.0.0.0' ||
|
|
1099
|
+
h.endsWith('.localhost') || h.endsWith('.local') || h.endsWith('.test');
|
|
1100
|
+
}
|
|
1101
|
+
|
|
1076
1102
|
// Fetch theme content from CSS files
|
|
1077
1103
|
TailwindCompiler.prototype.fetchThemeContent = async function () {
|
|
1078
1104
|
const themeContents = new Set();
|
|
@@ -1116,25 +1142,33 @@ TailwindCompiler.prototype.fetchThemeContent = async function () {
|
|
|
1116
1142
|
cacheTime = this.hasScannedStatic ? 5000 : 30000;
|
|
1117
1143
|
}
|
|
1118
1144
|
|
|
1119
|
-
|
|
1145
|
+
// Off a dev host a stylesheet never changes under a loaded page: fetch once, from the HTTP cache
|
|
1146
|
+
const dev = isDevHostname(location.hostname);
|
|
1147
|
+
if (cached && (!dev || (now - cached.timestamp) < cacheTime)) {
|
|
1120
1148
|
content = cached.content;
|
|
1121
1149
|
needsFetch = false;
|
|
1122
1150
|
}
|
|
1123
1151
|
|
|
1124
1152
|
if (needsFetch) {
|
|
1125
|
-
//
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1153
|
+
// Dev: cache-bust so an edited stylesheet is re-read
|
|
1154
|
+
const url = dev ? `${source}${source.includes('?') ? '&' : '?'}t=${Math.floor(now / 1000)}` : source;
|
|
1155
|
+
|
|
1156
|
+
// Overlapping compiles share one request
|
|
1157
|
+
const inflight = this._cssInflight || (this._cssInflight = new Map());
|
|
1158
|
+
let pending = inflight.get(url);
|
|
1159
|
+
if (!pending) {
|
|
1160
|
+
pending = fetch(url).then(response => (response.ok ? response.text() : null));
|
|
1161
|
+
inflight.set(url, pending);
|
|
1162
|
+
const done = () => inflight.delete(url);
|
|
1163
|
+
pending.then(done, done);
|
|
1164
|
+
}
|
|
1165
|
+
content = await pending;
|
|
1130
1166
|
|
|
1131
|
-
if (
|
|
1167
|
+
if (content === null) {
|
|
1132
1168
|
console.warn('Failed to fetch stylesheet:', url);
|
|
1133
1169
|
return;
|
|
1134
1170
|
}
|
|
1135
1171
|
|
|
1136
|
-
content = await response.text();
|
|
1137
|
-
|
|
1138
1172
|
// Cache the content with timestamp
|
|
1139
1173
|
this.cssContentCache.set(cacheKey, {
|
|
1140
1174
|
content: content,
|
|
@@ -2794,6 +2828,9 @@ TailwindCompiler.prototype.compileDelta = function (themeCss) {
|
|
|
2794
2828
|
const applied = this._applied;
|
|
2795
2829
|
const candidates = [];
|
|
2796
2830
|
for (const cls of this.dynamicClassCache) if (!applied.classes.has(cls)) candidates.push(cls);
|
|
2831
|
+
// A shipped at-rule variant arriving beside our own rules may need re-emitting after a bare partner: full regen decides
|
|
2832
|
+
if (this.staticUtilitiesCoveredClasses && applied.entries.length &&
|
|
2833
|
+
candidates.some(c => this.isAtRuleVariantClass(c) && this.isClassCovered(c))) return false;
|
|
2797
2834
|
const classes = this.filterStaticallyCoveredClasses(candidates);
|
|
2798
2835
|
// Tailwind display classes at a breakpoint join the display block, which only a full regen emits
|
|
2799
2836
|
if (tailwindResponsiveDisplay(classes).length) return false;
|
|
@@ -2936,6 +2973,28 @@ TailwindCompiler.prototype.clearStaleUtilityPatches = function () {
|
|
|
2936
2973
|
}
|
|
2937
2974
|
};
|
|
2938
2975
|
|
|
2976
|
+
// Boot-time guesses are unlayered and beat every layered variant: drop them once real rules cover the page
|
|
2977
|
+
TailwindCompiler.prototype.dropCriticalStyles = function () {
|
|
2978
|
+
if (!this.criticalStyleElement) return;
|
|
2979
|
+
requestAnimationFrame(() => requestAnimationFrame(() => {
|
|
2980
|
+
if (this.criticalStyleElement && this.criticalStyleElement.parentNode) {
|
|
2981
|
+
this.criticalStyleElement.parentNode.removeChild(this.criticalStyleElement);
|
|
2982
|
+
this.criticalStyleElement = null;
|
|
2983
|
+
}
|
|
2984
|
+
this.ensureUtilityStylesLast();
|
|
2985
|
+
}));
|
|
2986
|
+
};
|
|
2987
|
+
|
|
2988
|
+
// Nothing to generate yet: arm delta on an empty layer so later classes insert, not regenerate
|
|
2989
|
+
TailwindCompiler.prototype.armEmptyDelta = function (themeCss, classes) {
|
|
2990
|
+
if (!this.styleElement) return;
|
|
2991
|
+
// A replayed cache sheet stays until the next full write replaces it
|
|
2992
|
+
if (!this.staticUtilitiesCoveredClasses && this.styleElement.textContent.trim()) return;
|
|
2993
|
+
this._applied = null;
|
|
2994
|
+
this.styleElement.textContent = '@layer utilities {\n}';
|
|
2995
|
+
this.recordAppliedUtilities([], themeCss, classes);
|
|
2996
|
+
};
|
|
2997
|
+
|
|
2939
2998
|
// Main compilation method
|
|
2940
2999
|
TailwindCompiler.prototype.compile = async function () {
|
|
2941
3000
|
if (this.usesStaticPrerenderUtilities) {
|
|
@@ -3014,11 +3073,13 @@ TailwindCompiler.prototype.compile = async function () {
|
|
|
3014
3073
|
}
|
|
3015
3074
|
}
|
|
3016
3075
|
|
|
3017
|
-
const
|
|
3076
|
+
const staticEntries = this.generateOrderedUtilities(themeCss, staticUsedData);
|
|
3077
|
+
const allUtilities = this.orderedUtilitiesCss(staticEntries);
|
|
3018
3078
|
|
|
3019
3079
|
if (allUtilities) {
|
|
3020
3080
|
const finalCss = `@layer utilities {\n${allUtilities}\n}`;
|
|
3021
3081
|
|
|
3082
|
+
this._applied = null; // a move below must not write the previous delta state back
|
|
3022
3083
|
this.styleElement.textContent = finalCss;
|
|
3023
3084
|
this.ensureUtilityStylesLast();
|
|
3024
3085
|
this.scheduleEnsureUtilityStylesLast();
|
|
@@ -3036,6 +3097,7 @@ TailwindCompiler.prototype.compile = async function () {
|
|
|
3036
3097
|
});
|
|
3037
3098
|
});
|
|
3038
3099
|
this.lastClassesHash = staticUsedData.classes.sort().join(',');
|
|
3100
|
+
this.recordAppliedUtilities(staticEntries, themeCss, []);
|
|
3039
3101
|
|
|
3040
3102
|
// Save to cache for next page load
|
|
3041
3103
|
const themeHash = this.generateThemeHash(themeCss);
|
|
@@ -3048,6 +3110,7 @@ TailwindCompiler.prototype.compile = async function () {
|
|
|
3048
3110
|
this.savePersistentCache();
|
|
3049
3111
|
} else {
|
|
3050
3112
|
this.clearStaleUtilityPatches();
|
|
3113
|
+
this.armEmptyDelta(themeCss, []);
|
|
3051
3114
|
}
|
|
3052
3115
|
}
|
|
3053
3116
|
|
|
@@ -3060,7 +3123,10 @@ TailwindCompiler.prototype.compile = async function () {
|
|
|
3060
3123
|
let prefetchedTheme = null;
|
|
3061
3124
|
if (this.canCompileDelta()) {
|
|
3062
3125
|
prefetchedTheme = await this.fetchThemeContent();
|
|
3063
|
-
if (prefetchedTheme && this.lastThemeKey === this._applied.themeKey && this.compileDelta(this._applied.themeCss))
|
|
3126
|
+
if (prefetchedTheme && this.lastThemeKey === this._applied.themeKey && this.compileDelta(this._applied.themeCss)) {
|
|
3127
|
+
this.dropCriticalStyles();
|
|
3128
|
+
return;
|
|
3129
|
+
}
|
|
3064
3130
|
}
|
|
3065
3131
|
|
|
3066
3132
|
// For subsequent compilations, check for new dynamic classes
|
|
@@ -3105,6 +3171,7 @@ TailwindCompiler.prototype.compile = async function () {
|
|
|
3105
3171
|
if (allUtilities) {
|
|
3106
3172
|
const finalCss = `@layer utilities {\n${allUtilities}\n}`;
|
|
3107
3173
|
|
|
3174
|
+
this._applied = null; // a move below must not write the previous delta state back
|
|
3108
3175
|
this.styleElement.textContent = finalCss;
|
|
3109
3176
|
this.ensureUtilityStylesLast();
|
|
3110
3177
|
this.scheduleEnsureUtilityStylesLast();
|
|
@@ -3137,6 +3204,8 @@ TailwindCompiler.prototype.compile = async function () {
|
|
|
3137
3204
|
this.savePersistentCache();
|
|
3138
3205
|
} else {
|
|
3139
3206
|
this.clearStaleUtilityPatches();
|
|
3207
|
+
this.lastClassesHash = dynamicClassesHash;
|
|
3208
|
+
this.armEmptyDelta(themeCss, dynamicClasses);
|
|
3140
3209
|
}
|
|
3141
3210
|
} else {
|
|
3142
3211
|
this._applied = null; // theme text moved: order keys are stale until the next full write
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mnfst",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.325",
|
|
4
4
|
"private": false,
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"templates/starter",
|
|
@@ -65,6 +65,8 @@
|
|
|
65
65
|
"test:e2e:hidden-responsive": "node tests/e2e/utilities-hidden-responsive.e2e.mjs",
|
|
66
66
|
"test:e2e:breakpoint-range": "node tests/e2e/utilities-breakpoint-range.e2e.mjs",
|
|
67
67
|
"test:e2e:responsive-order": "node tests/e2e/utilities-responsive-order.e2e.mjs",
|
|
68
|
+
"test:e2e:delta-arming": "node tests/e2e/utilities-delta-arming.e2e.mjs",
|
|
69
|
+
"test:e2e:boot-waterfall": "node tests/e2e/boot-waterfall.e2e.mjs",
|
|
68
70
|
"test:e2e:tailwind-dark": "node tests/e2e/tailwind-dark-variant.e2e.mjs",
|
|
69
71
|
"test:e2e:inline-style-variants": "node tests/e2e/utilities-inline-style-variants.e2e.mjs",
|
|
70
72
|
"test:e2e:presence-tabs": "node tests/e2e/presence-tabs.e2e.mjs",
|