mnfst 0.5.116 → 0.5.118
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.integrity.json +2 -2
- package/lib/manifest.js +10 -0
- package/lib/manifest.router.js +0 -40
- package/package.json +1 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"manifest.localization.js": "sha384-M40EWrbWs2MoJvUiYVQaPxPiOzMYBn/ywuMR02rvoSXG77eIHT/aRoYub9r6+jC+",
|
|
14
14
|
"manifest.markdown.js": "sha384-jJFVCg46bYcP/xglX6QguG2qsGi2I/0o9kXLpM2RMq7edbTYpgx6WQ9iNB7kKHmN",
|
|
15
15
|
"manifest.resize.js": "sha384-Ak5gf44ERfh9pOSAD1qZzJSysslpwBCkevIlz7R3dszTUyzUKGKGF4pn5arOtgG0",
|
|
16
|
-
"manifest.router.js": "sha384
|
|
16
|
+
"manifest.router.js": "sha384-Kpl5k/pWOrMJhkgFZ9UAtGXuH7FDEv24WGMACpNqV8DW5ZjcbC67SnVY42qUSn3X",
|
|
17
17
|
"manifest.slides.js": "sha384-3uRTkyK9XPLmnxI2+igZlpi4EyPlU/7IHj5j3BZJJ2KN455vXyk99fiXV3feO/XY",
|
|
18
18
|
"manifest.svg.js": "sha384-nc+3spSGNS2l+82maL/OFz2iOGUhLZ0kqeooj28CEcdElM4OZa34e0tbnokZHVI6",
|
|
19
19
|
"manifest.tabs.js": "sha384-v6Ti0zHfdLhkFHbTMg0FH6uMrThuBvZrL2PQgVBeeXhDjuN7x4MtoNWogPbAQTaD",
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
"manifest.tooltips.js": "sha384-Hhip5ZN66xhDw3m0XBrKLKLpcVRz3Z9RszPKqo6xvFF0mrUgQBVZ+mZjZsXgOOjS",
|
|
23
23
|
"manifest.url.parameters.js": "sha384-FIufiClqDx1rJpU/QUc9z/D43qClQ6Qm8rBahipbJl9BDHUvhrOsUDegmTWW7Tuf",
|
|
24
24
|
"manifest.utilities.js": "sha384-x07Pfi4UxK9tbdcOZgZ5jkveseT1xBUTFtO08ORcokCH64FHsUceoiAICAsRJMle",
|
|
25
|
-
"manifest.js": "sha384-
|
|
25
|
+
"manifest.js": "sha384-S63QjTNS3dG0doW+o2PByZ7ZYY2i1rPGoXQZ5O6k1lViYW+UCn9dSXRhRkguivpg"
|
|
26
26
|
}
|
package/lib/manifest.js
CHANGED
|
@@ -37,6 +37,16 @@
|
|
|
37
37
|
// Only run on pages the prerender marked as static MPA output.
|
|
38
38
|
const prerenderMeta = document.querySelector('meta[name="manifest:prerendered"]');
|
|
39
39
|
if (!prerenderMeta || prerenderMeta.getAttribute('content') === '0') return;
|
|
40
|
+
|
|
41
|
+
// Remove baked x-for/x-if clones the prerender kept for crawlers. Their
|
|
42
|
+
// <template> is still live, so Alpine re-renders the list/conditional on
|
|
43
|
+
// boot; dropping the baked copies first (before Alpine runs) avoids a
|
|
44
|
+
// duplicate render. data-hydrate islands keep their baked DOM.
|
|
45
|
+
document.querySelectorAll('[data-mnfst-prerender-clone]').forEach((el) => {
|
|
46
|
+
if (el.closest && el.closest('[data-hydrate]')) return;
|
|
47
|
+
el.remove();
|
|
48
|
+
});
|
|
49
|
+
|
|
40
50
|
const blob = document.getElementById('__manifest_hydrate__');
|
|
41
51
|
if (!blob) return;
|
|
42
52
|
let entries;
|
package/lib/manifest.router.js
CHANGED
|
@@ -88,41 +88,6 @@ window.ManifestRouting = {
|
|
|
88
88
|
|
|
89
89
|
// Router position
|
|
90
90
|
|
|
91
|
-
// Capture initial body order from index.html
|
|
92
|
-
function captureBodyOrder() {
|
|
93
|
-
if (window.__manifestBodyOrder) return; // Already captured
|
|
94
|
-
|
|
95
|
-
try {
|
|
96
|
-
const req = new XMLHttpRequest();
|
|
97
|
-
req.open('GET', '/index.html', false);
|
|
98
|
-
req.send(null);
|
|
99
|
-
if (req.status === 200) {
|
|
100
|
-
let html = req.responseText;
|
|
101
|
-
|
|
102
|
-
// Handle self-closing tags if components plugin isn't available
|
|
103
|
-
if (!window.ManifestComponents) {
|
|
104
|
-
html = html.replace(/<x-([a-z0-9-]+)([^>]*)\s*\/?>/gi, (match, tag, attrs) => `<x-${tag}${attrs}></x-${tag}>`);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const parser = new DOMParser();
|
|
108
|
-
const doc = parser.parseFromString(html, 'text/html');
|
|
109
|
-
const bodyChildren = Array.from(doc.body.children);
|
|
110
|
-
|
|
111
|
-
window.__manifestBodyOrder = bodyChildren.map((el, index) => ({
|
|
112
|
-
index,
|
|
113
|
-
tag: el.tagName.toLowerCase().trim(),
|
|
114
|
-
isComponent: el.tagName.toLowerCase().startsWith('x-'),
|
|
115
|
-
attrs: Array.from(el.attributes).map(attr => [attr.name, attr.value]),
|
|
116
|
-
key: el.getAttribute('data-component-id') || (el.tagName.toLowerCase().startsWith('x-') ? el.tagName.toLowerCase().replace('x-', '').trim() : null),
|
|
117
|
-
position: index,
|
|
118
|
-
content: el.tagName.toLowerCase().startsWith('x-') ? null : el.innerHTML
|
|
119
|
-
}));
|
|
120
|
-
}
|
|
121
|
-
} catch (e) {
|
|
122
|
-
// Failed to load index.html for body order snapshot
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
91
|
// Assign data-order attributes to all top-level elements
|
|
127
92
|
function assignDataPositions() {
|
|
128
93
|
if (!document.body) return;
|
|
@@ -136,10 +101,6 @@ function assignDataPositions() {
|
|
|
136
101
|
|
|
137
102
|
// Initialize position management
|
|
138
103
|
function initializePositionManagement() {
|
|
139
|
-
// Capture body order first
|
|
140
|
-
captureBodyOrder();
|
|
141
|
-
|
|
142
|
-
// Assign data-order attributes
|
|
143
104
|
assignDataPositions();
|
|
144
105
|
}
|
|
145
106
|
|
|
@@ -153,7 +114,6 @@ if (document.readyState === 'loading') {
|
|
|
153
114
|
// Export position management interface
|
|
154
115
|
window.ManifestRoutingPosition = {
|
|
155
116
|
initialize: initializePositionManagement,
|
|
156
|
-
captureBodyOrder,
|
|
157
117
|
assignDataPositions
|
|
158
118
|
};
|
|
159
119
|
|