stx-router 0.2.288 → 0.2.290
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/client.js +19 -0
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1190,6 +1190,13 @@ else {
|
|
|
1190
1190
|
log('[router] full body swap for layout change');
|
|
1191
1191
|
// Replace entire body content \u2014 layout chrome and all
|
|
1192
1192
|
var bodyHTML=newBody.innerHTML;
|
|
1193
|
+
// The outgoing chrome's components are destroyed with it (#1958).
|
|
1194
|
+
// They are no longer re-run on every navigation, so they live as long
|
|
1195
|
+
// as their layout does, and _cleanupContainer above only covered the
|
|
1196
|
+
// container: their onDestroy and their scopes waited for the next
|
|
1197
|
+
// navigation's orphan sweep, and their effects were never disposed.
|
|
1198
|
+
// Before the swap, while the old markup is still here to walk.
|
|
1199
|
+
if(window.stx&&window.stx._cleanupContainer)window.stx._cleanupContainer(document.body);
|
|
1193
1200
|
document.body.innerHTML=bodyHTML;
|
|
1194
1201
|
// Copy body attributes (class, data-stx, etc.)
|
|
1195
1202
|
Array.from(newBody.attributes).forEach(function(attr){document.body.setAttribute(attr.name,attr.value)});
|
|
@@ -1275,6 +1282,18 @@ else {
|
|
|
1275
1282
|
if(isSignalsRuntimeScript(s,text))return;
|
|
1276
1283
|
if(text.indexOf('__stxRouter')!==-1)return;
|
|
1277
1284
|
if(newContent.contains(s))return;
|
|
1285
|
+
// Code only, as prepareRoutedBodyScripts takes it. A layout island's
|
|
1286
|
+
// type="stx/island" script is hydrated by its own trigger, and one
|
|
1287
|
+
// collected here was set up on every navigation, the trigger or not.
|
|
1288
|
+
var scriptType=(s.getAttribute('type')||'').trim().toLowerCase();
|
|
1289
|
+
if(scriptType&&scriptType!=='text/javascript'&&scriptType!=='application/javascript'&&scriptType!=='module')return;
|
|
1290
|
+
// A component with no scope root has no root for the owner check,
|
|
1291
|
+
// so its script is marked data-stx-instance instead. Out here it
|
|
1292
|
+
// belongs to the layout chrome, which this swap leaves in place with
|
|
1293
|
+
// its instance running; running it again set up a second one, and a
|
|
1294
|
+
// stx.mount wrapper re-run from here mounted onto the container, the
|
|
1295
|
+
// incoming page's content (#1958). Fragments leave these out.
|
|
1296
|
+
if(s.hasAttribute('data-stx-instance'))return;
|
|
1278
1297
|
if(text.indexOf('__stx_setup_')===-1&&!s.hasAttribute('data-stx-scoped')&&!s.hasAttribute('data-stx-page')&&!s.hasAttribute('data-stx-route-params'))return;
|
|
1279
1298
|
var key=text.substring(0,80);
|
|
1280
1299
|
if(seenSetups[key])return;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stx-router",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.290",
|
|
5
5
|
"description": "File-based router for STX — .stx template discovery, nested layouts, typed route params, middleware, and client-side SPA navigation.",
|
|
6
6
|
"author": "Chris Breuer <chris@stacksjs.org>",
|
|
7
7
|
"license": "MIT",
|