@hyperspan/framework 1.0.28 → 1.0.29
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/package.json
CHANGED
|
@@ -194,14 +194,14 @@ function formSubmitToRoute(e: Event, form: HTMLFormElement, opts: TFormSubmitOpt
|
|
|
194
194
|
form,
|
|
195
195
|
action: hsActionTag,
|
|
196
196
|
url,
|
|
197
|
-
|
|
197
|
+
hardNavigate: preferHard,
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
if (!dispatchActionEvent(eventTarget, HS_ACTION_BEFORE_NAVIGATE, navigateDetail, true)) {
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
if (navigateDetail.
|
|
204
|
+
if (navigateDetail.hardNavigate) {
|
|
205
205
|
window.location.assign(navigateDetail.url);
|
|
206
206
|
return;
|
|
207
207
|
}
|
|
@@ -229,7 +229,7 @@ function formSubmitToRoute(e: Event, form: HTMLFormElement, opts: TFormSubmitOpt
|
|
|
229
229
|
const resolved = new URL(newUrl, window.location.href);
|
|
230
230
|
|
|
231
231
|
// Default: same-origin + same path → soft morph; anything else → hard navigation.
|
|
232
|
-
// Listeners can flip detail.
|
|
232
|
+
// Listeners can flip detail.hardNavigate on hs:action:before-navigate to override.
|
|
233
233
|
const preferHard =
|
|
234
234
|
resolved.origin !== window.location.origin ||
|
|
235
235
|
resolved.pathname !== window.location.pathname;
|
package/src/types.ts
CHANGED
|
@@ -307,7 +307,7 @@ export namespace Hyperspan {
|
|
|
307
307
|
* - `hs:action:before-swap` — before HTML morph (cancelable). Close modals here.
|
|
308
308
|
* - `hs:action:after-swap` — after HTML morph.
|
|
309
309
|
* - `hs:action:before-navigate` — before redirect soft/hard navigation (cancelable).
|
|
310
|
-
* Set `detail.
|
|
310
|
+
* Set `detail.hardNavigate = true` for a full page load, or `false` to fetch+morph in place.
|
|
311
311
|
*/
|
|
312
312
|
export type ActionEventName =
|
|
313
313
|
| 'hs:action:before-fetch'
|
|
@@ -346,7 +346,7 @@ export namespace Hyperspan {
|
|
|
346
346
|
* Mutable. Default is soft (false) for same-origin+same-path redirects, hard (true) otherwise.
|
|
347
347
|
* Set to `true` for `window.location.assign`, or `false` to fetch + morph in place.
|
|
348
348
|
*/
|
|
349
|
-
|
|
349
|
+
hardNavigate: boolean;
|
|
350
350
|
};
|
|
351
351
|
|
|
352
352
|
/**
|