mnfst 0.5.39 → 0.5.40
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/manifest.icons.js +6 -0
- package/dist/manifest.router.js +32 -1
- package/dist/manifest.utilities.js +19 -0
- package/package.json +1 -1
package/dist/manifest.icons.js
CHANGED
|
@@ -91,6 +91,12 @@ function initializeIconPlugin() {
|
|
|
91
91
|
const iconValue = expression;
|
|
92
92
|
if (!iconValue) return;
|
|
93
93
|
|
|
94
|
+
// Prerender (or static HTML) already inlined an Iconify SVG; leave it alone. Otherwise Alpine
|
|
95
|
+
// evaluates stale expressions like `module.icon` from templating and throws ReferenceError.
|
|
96
|
+
if (el.querySelector('svg[data-icon]')) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
94
100
|
// Check if it's a raw icon name (should contain a colon for icon format like 'lucide:house')
|
|
95
101
|
const isRawIconName = iconValue.includes(':') &&
|
|
96
102
|
!iconValue.includes("'") &&
|
package/dist/manifest.router.js
CHANGED
|
@@ -394,8 +394,20 @@ window.ManifestRoutingNavigation = {
|
|
|
394
394
|
|
|
395
395
|
// Router visibility
|
|
396
396
|
|
|
397
|
+
function isPrerenderedStaticMPA() {
|
|
398
|
+
try {
|
|
399
|
+
return document.querySelector('meta[name="manifest:prerendered"][content="1"]') !== null;
|
|
400
|
+
} catch (e) {
|
|
401
|
+
return false;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
397
405
|
// Process visibility for all elements with x-route
|
|
398
406
|
function processRouteVisibility(normalizedPath) {
|
|
407
|
+
// Static prerender output already contains only this route's sections; x-cloak + toggling here
|
|
408
|
+
// causes a visible flash (content → hidden via x-cloak → shown when Alpine boots).
|
|
409
|
+
if (isPrerenderedStaticMPA()) return;
|
|
410
|
+
|
|
399
411
|
const routeElements = document.querySelectorAll('[x-route]');
|
|
400
412
|
|
|
401
413
|
// First pass: collect all defined routes (excluding !* and other negative conditions)
|
|
@@ -511,6 +523,7 @@ function processRouteVisibility(normalizedPath) {
|
|
|
511
523
|
|
|
512
524
|
// Add x-cloak to route elements that don't have it
|
|
513
525
|
function addXCloakToRouteElements() {
|
|
526
|
+
if (isPrerenderedStaticMPA()) return;
|
|
514
527
|
const routeElements = document.querySelectorAll('[x-route]:not([x-cloak])');
|
|
515
528
|
routeElements.forEach(element => {
|
|
516
529
|
element.setAttribute('x-cloak', '');
|
|
@@ -529,11 +542,13 @@ function initializeVisibility() {
|
|
|
529
542
|
|
|
530
543
|
// Listen for route changes
|
|
531
544
|
window.addEventListener('manifest:route-change', (event) => {
|
|
545
|
+
if (isPrerenderedStaticMPA()) return;
|
|
532
546
|
processRouteVisibility(event.detail.normalizedPath);
|
|
533
547
|
});
|
|
534
548
|
|
|
535
549
|
// Listen for component processing to ensure visibility is applied after components load
|
|
536
550
|
window.addEventListener('manifest:components-processed', () => {
|
|
551
|
+
if (isPrerenderedStaticMPA()) return;
|
|
537
552
|
// Add x-cloak to any new route elements
|
|
538
553
|
addXCloakToRouteElements();
|
|
539
554
|
|
|
@@ -559,11 +574,23 @@ if (document.readyState === 'loading') {
|
|
|
559
574
|
// Export visibility interface
|
|
560
575
|
window.ManifestRoutingVisibility = {
|
|
561
576
|
initialize: initializeVisibility,
|
|
562
|
-
processRouteVisibility
|
|
577
|
+
processRouteVisibility,
|
|
578
|
+
isPrerenderedStaticMPA
|
|
563
579
|
};
|
|
564
580
|
|
|
565
581
|
// Router head
|
|
566
582
|
|
|
583
|
+
function isPrerenderedStaticMPA() {
|
|
584
|
+
try {
|
|
585
|
+
if (window.ManifestRoutingVisibility && typeof window.ManifestRoutingVisibility.isPrerenderedStaticMPA === 'function') {
|
|
586
|
+
return window.ManifestRoutingVisibility.isPrerenderedStaticMPA();
|
|
587
|
+
}
|
|
588
|
+
return document.querySelector('meta[name="manifest:prerendered"][content="1"]') !== null;
|
|
589
|
+
} catch (e) {
|
|
590
|
+
return false;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
|
|
567
594
|
// Track injected head content to prevent duplicates
|
|
568
595
|
const injectedHeadContent = new Set();
|
|
569
596
|
|
|
@@ -713,6 +740,7 @@ function processElementHeadContent(element, normalizedPath) {
|
|
|
713
740
|
|
|
714
741
|
// Process all head content in the DOM
|
|
715
742
|
function processAllHeadContent(normalizedPath) {
|
|
743
|
+
if (isPrerenderedStaticMPA()) return;
|
|
716
744
|
|
|
717
745
|
// Find all elements with head templates
|
|
718
746
|
const elementsWithHead = document.querySelectorAll('template[data-head]');
|
|
@@ -791,6 +819,7 @@ function initializeHeadContent() {
|
|
|
791
819
|
function processHeadContentAfterComponentsReady() {
|
|
792
820
|
// Process initial head content after a longer delay to let components settle
|
|
793
821
|
setTimeout(() => {
|
|
822
|
+
if (isPrerenderedStaticMPA()) return;
|
|
794
823
|
const currentPath = window.ManifestRoutingNavigation?.getCurrentRoute() ?? window.location.pathname;
|
|
795
824
|
const normalizedPath = currentPath === '/' ? '/' : currentPath.replace(/^\/|\/$/g, '');
|
|
796
825
|
|
|
@@ -810,6 +839,7 @@ function initializeHeadContent() {
|
|
|
810
839
|
|
|
811
840
|
// Function to process head content immediately (for projects without components)
|
|
812
841
|
function processHeadContentImmediately() {
|
|
842
|
+
if (isPrerenderedStaticMPA()) return;
|
|
813
843
|
const currentPath = window.ManifestRoutingNavigation?.getCurrentRoute() ?? window.location.pathname;
|
|
814
844
|
const normalizedPath = currentPath === '/' ? '/' : currentPath.replace(/^\/|\/$/g, '');
|
|
815
845
|
processAllHeadContent(normalizedPath);
|
|
@@ -843,6 +873,7 @@ function initializeHeadContent() {
|
|
|
843
873
|
|
|
844
874
|
// Wait a bit for components to settle after route change
|
|
845
875
|
setTimeout(() => {
|
|
876
|
+
if (isPrerenderedStaticMPA()) return;
|
|
846
877
|
// Process head content immediately to catch components before they're reverted
|
|
847
878
|
const currentPath = window.ManifestRoutingNavigation?.getCurrentRoute() ?? window.location.pathname;
|
|
848
879
|
const normalizedPath = currentPath === '/' ? '/' : currentPath.replace(/^\/|\/$/g, '');
|
|
@@ -452,6 +452,16 @@ class TailwindCompiler {
|
|
|
452
452
|
this.compileTimeout = null;
|
|
453
453
|
this.cache = new Map();
|
|
454
454
|
this.hasInitialized = true;
|
|
455
|
+
// manifest.code.js (and others) may still register ignore rules; mirror full constructor defaults.
|
|
456
|
+
this.ignoredClassPatterns = [
|
|
457
|
+
/^hljs/, /^language-/, /^copy$/, /^copied$/, /^lines$/, /^selected$/
|
|
458
|
+
];
|
|
459
|
+
this.ignoredElementSelectors = [
|
|
460
|
+
'pre', 'code', 'x-code', 'x-code-group'
|
|
461
|
+
];
|
|
462
|
+
this.significantChangeSelectors = [
|
|
463
|
+
'[data-component]', '[x-data]'
|
|
464
|
+
];
|
|
455
465
|
return;
|
|
456
466
|
}
|
|
457
467
|
|
|
@@ -600,6 +610,9 @@ class TailwindCompiler {
|
|
|
600
610
|
|
|
601
611
|
// Public API for other plugins to configure behavior
|
|
602
612
|
addIgnoredClassPattern(pattern) {
|
|
613
|
+
if (!Array.isArray(this.ignoredClassPatterns)) {
|
|
614
|
+
this.ignoredClassPatterns = [];
|
|
615
|
+
}
|
|
603
616
|
if (pattern instanceof RegExp) {
|
|
604
617
|
this.ignoredClassPatterns.push(pattern);
|
|
605
618
|
} else if (typeof pattern === 'string') {
|
|
@@ -608,12 +621,18 @@ class TailwindCompiler {
|
|
|
608
621
|
}
|
|
609
622
|
|
|
610
623
|
addIgnoredElementSelector(selector) {
|
|
624
|
+
if (!Array.isArray(this.ignoredElementSelectors)) {
|
|
625
|
+
this.ignoredElementSelectors = [];
|
|
626
|
+
}
|
|
611
627
|
if (typeof selector === 'string') {
|
|
612
628
|
this.ignoredElementSelectors.push(selector);
|
|
613
629
|
}
|
|
614
630
|
}
|
|
615
631
|
|
|
616
632
|
addSignificantChangeSelector(selector) {
|
|
633
|
+
if (!Array.isArray(this.significantChangeSelectors)) {
|
|
634
|
+
this.significantChangeSelectors = [];
|
|
635
|
+
}
|
|
617
636
|
if (typeof selector === 'string') {
|
|
618
637
|
this.significantChangeSelectors.push(selector);
|
|
619
638
|
}
|