@hybridly/core 0.7.8 → 0.7.10
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/index.cjs +5 -3
- package/dist/index.d.cts +15 -5
- package/dist/index.d.mts +15 -5
- package/dist/index.d.ts +15 -5
- package/dist/index.mjs +5 -3
- package/package.json +17 -17
package/dist/index.cjs
CHANGED
|
@@ -289,11 +289,11 @@ async function registerEventListeners() {
|
|
|
289
289
|
updateHistoryState: false
|
|
290
290
|
});
|
|
291
291
|
});
|
|
292
|
-
window?.addEventListener("scroll", (event) => utils.debounce(() => {
|
|
292
|
+
window?.addEventListener("scroll", (event) => utils.debounce(100, () => {
|
|
293
293
|
if (event?.target?.hasAttribute?.(SCROLL_REGION_ATTRIBUTE)) {
|
|
294
294
|
saveScrollPositions();
|
|
295
295
|
}
|
|
296
|
-
}
|
|
296
|
+
}), true);
|
|
297
297
|
}
|
|
298
298
|
function isBackForwardNavigation() {
|
|
299
299
|
if (!window.history.state) {
|
|
@@ -839,7 +839,7 @@ async function performHybridNavigation(options) {
|
|
|
839
839
|
}
|
|
840
840
|
utils.debug.router("The response respects the Hybridly protocol.");
|
|
841
841
|
const payload = response.data;
|
|
842
|
-
if ((options.only?.length ?? options.except?.length) && payload.view.component === context.view.component) {
|
|
842
|
+
if (payload.view && (options.only?.length ?? options.except?.length) && payload.view.component === context.view.component) {
|
|
843
843
|
utils.debug.router(`Merging ${options.only ? '"only"' : '"except"'} properties.`, payload.view.properties);
|
|
844
844
|
payload.view.properties = utils.merge(context.view.properties, payload.view.properties);
|
|
845
845
|
utils.debug.router("Merged properties:", payload.view.properties);
|
|
@@ -928,11 +928,13 @@ function isHybridResponse(response) {
|
|
|
928
928
|
return !!response?.headers[HYBRIDLY_HEADER];
|
|
929
929
|
}
|
|
930
930
|
async function navigate(options) {
|
|
931
|
+
var _a;
|
|
931
932
|
const context = getRouterContext();
|
|
932
933
|
options.hasDialog ?? (options.hasDialog = !!options.payload?.dialog);
|
|
933
934
|
utils.debug.router("Making an internal navigation:", { context, options });
|
|
934
935
|
await runHooks("navigating", {}, options, context);
|
|
935
936
|
options.payload ?? (options.payload = payloadFromContext());
|
|
937
|
+
(_a = options.payload).view ?? (_a.view = payloadFromContext().view);
|
|
936
938
|
function evaluateConditionalOption(option) {
|
|
937
939
|
return typeof option === "function" ? option(options) : option;
|
|
938
940
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -5,8 +5,8 @@ type MaybePromise<T> = T | Promise<T>;
|
|
|
5
5
|
|
|
6
6
|
interface RequestHooks {
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* Called before a navigation request is going to happen.
|
|
9
|
+
*/
|
|
10
10
|
before: (options: HybridRequestOptions, context: InternalRouterContext) => MaybePromise<any | boolean>;
|
|
11
11
|
/**
|
|
12
12
|
* Called before the request of a navigation is going to happen.
|
|
@@ -51,8 +51,18 @@ interface RequestHooks {
|
|
|
51
51
|
}
|
|
52
52
|
interface Hooks extends RequestHooks {
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
/////////////////////// * Called when Hybridly's context is initialized.
|
|
55
|
+
///////////////////////
|
|
56
|
+
///////////////////////
|
|
57
|
+
///////////////////////
|
|
58
|
+
///////////////////////
|
|
59
|
+
///////////////////////
|
|
60
|
+
///////////////////////
|
|
61
|
+
///////////////////////
|
|
62
|
+
///////////////////////
|
|
63
|
+
///////////////////////
|
|
64
|
+
///////////////////////
|
|
65
|
+
*/
|
|
56
66
|
initialized: (context: InternalRouterContext) => MaybePromise<any>;
|
|
57
67
|
/**
|
|
58
68
|
* Called after Hybridly's initial load.
|
|
@@ -176,7 +186,7 @@ interface NavigationOptions {
|
|
|
176
186
|
transformUrl?: UrlTransformable;
|
|
177
187
|
/**
|
|
178
188
|
* Defines whether the history state should be updated.
|
|
179
|
-
* @internal
|
|
189
|
+
* @internal
|
|
180
190
|
*/
|
|
181
191
|
updateHistoryState?: boolean;
|
|
182
192
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -5,8 +5,8 @@ type MaybePromise<T> = T | Promise<T>;
|
|
|
5
5
|
|
|
6
6
|
interface RequestHooks {
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* Called before a navigation request is going to happen.
|
|
9
|
+
*/
|
|
10
10
|
before: (options: HybridRequestOptions, context: InternalRouterContext) => MaybePromise<any | boolean>;
|
|
11
11
|
/**
|
|
12
12
|
* Called before the request of a navigation is going to happen.
|
|
@@ -51,8 +51,18 @@ interface RequestHooks {
|
|
|
51
51
|
}
|
|
52
52
|
interface Hooks extends RequestHooks {
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
/////////////////////// * Called when Hybridly's context is initialized.
|
|
55
|
+
///////////////////////
|
|
56
|
+
///////////////////////
|
|
57
|
+
///////////////////////
|
|
58
|
+
///////////////////////
|
|
59
|
+
///////////////////////
|
|
60
|
+
///////////////////////
|
|
61
|
+
///////////////////////
|
|
62
|
+
///////////////////////
|
|
63
|
+
///////////////////////
|
|
64
|
+
///////////////////////
|
|
65
|
+
*/
|
|
56
66
|
initialized: (context: InternalRouterContext) => MaybePromise<any>;
|
|
57
67
|
/**
|
|
58
68
|
* Called after Hybridly's initial load.
|
|
@@ -176,7 +186,7 @@ interface NavigationOptions {
|
|
|
176
186
|
transformUrl?: UrlTransformable;
|
|
177
187
|
/**
|
|
178
188
|
* Defines whether the history state should be updated.
|
|
179
|
-
* @internal
|
|
189
|
+
* @internal
|
|
180
190
|
*/
|
|
181
191
|
updateHistoryState?: boolean;
|
|
182
192
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ type MaybePromise<T> = T | Promise<T>;
|
|
|
5
5
|
|
|
6
6
|
interface RequestHooks {
|
|
7
7
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
* Called before a navigation request is going to happen.
|
|
9
|
+
*/
|
|
10
10
|
before: (options: HybridRequestOptions, context: InternalRouterContext) => MaybePromise<any | boolean>;
|
|
11
11
|
/**
|
|
12
12
|
* Called before the request of a navigation is going to happen.
|
|
@@ -51,8 +51,18 @@ interface RequestHooks {
|
|
|
51
51
|
}
|
|
52
52
|
interface Hooks extends RequestHooks {
|
|
53
53
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
/////////////////////// * Called when Hybridly's context is initialized.
|
|
55
|
+
///////////////////////
|
|
56
|
+
///////////////////////
|
|
57
|
+
///////////////////////
|
|
58
|
+
///////////////////////
|
|
59
|
+
///////////////////////
|
|
60
|
+
///////////////////////
|
|
61
|
+
///////////////////////
|
|
62
|
+
///////////////////////
|
|
63
|
+
///////////////////////
|
|
64
|
+
///////////////////////
|
|
65
|
+
*/
|
|
56
66
|
initialized: (context: InternalRouterContext) => MaybePromise<any>;
|
|
57
67
|
/**
|
|
58
68
|
* Called after Hybridly's initial load.
|
|
@@ -176,7 +186,7 @@ interface NavigationOptions {
|
|
|
176
186
|
transformUrl?: UrlTransformable;
|
|
177
187
|
/**
|
|
178
188
|
* Defines whether the history state should be updated.
|
|
179
|
-
* @internal
|
|
189
|
+
* @internal
|
|
180
190
|
*/
|
|
181
191
|
updateHistoryState?: boolean;
|
|
182
192
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -282,11 +282,11 @@ async function registerEventListeners() {
|
|
|
282
282
|
updateHistoryState: false
|
|
283
283
|
});
|
|
284
284
|
});
|
|
285
|
-
window?.addEventListener("scroll", (event) => debounce(() => {
|
|
285
|
+
window?.addEventListener("scroll", (event) => debounce(100, () => {
|
|
286
286
|
if (event?.target?.hasAttribute?.(SCROLL_REGION_ATTRIBUTE)) {
|
|
287
287
|
saveScrollPositions();
|
|
288
288
|
}
|
|
289
|
-
}
|
|
289
|
+
}), true);
|
|
290
290
|
}
|
|
291
291
|
function isBackForwardNavigation() {
|
|
292
292
|
if (!window.history.state) {
|
|
@@ -832,7 +832,7 @@ async function performHybridNavigation(options) {
|
|
|
832
832
|
}
|
|
833
833
|
debug.router("The response respects the Hybridly protocol.");
|
|
834
834
|
const payload = response.data;
|
|
835
|
-
if ((options.only?.length ?? options.except?.length) && payload.view.component === context.view.component) {
|
|
835
|
+
if (payload.view && (options.only?.length ?? options.except?.length) && payload.view.component === context.view.component) {
|
|
836
836
|
debug.router(`Merging ${options.only ? '"only"' : '"except"'} properties.`, payload.view.properties);
|
|
837
837
|
payload.view.properties = merge(context.view.properties, payload.view.properties);
|
|
838
838
|
debug.router("Merged properties:", payload.view.properties);
|
|
@@ -921,11 +921,13 @@ function isHybridResponse(response) {
|
|
|
921
921
|
return !!response?.headers[HYBRIDLY_HEADER];
|
|
922
922
|
}
|
|
923
923
|
async function navigate(options) {
|
|
924
|
+
var _a;
|
|
924
925
|
const context = getRouterContext();
|
|
925
926
|
options.hasDialog ?? (options.hasDialog = !!options.payload?.dialog);
|
|
926
927
|
debug.router("Making an internal navigation:", { context, options });
|
|
927
928
|
await runHooks("navigating", {}, options, context);
|
|
928
929
|
options.payload ?? (options.payload = payloadFromContext());
|
|
930
|
+
(_a = options.payload).view ?? (_a.view = payloadFromContext().view);
|
|
929
931
|
function evaluateConditionalOption(option) {
|
|
930
932
|
return typeof option === "function" ? option(options) : option;
|
|
931
933
|
}
|
package/package.json
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybridly/core",
|
|
3
|
-
"
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.7.10",
|
|
4
5
|
"description": "Core functionality of Hybridly",
|
|
5
|
-
"
|
|
6
|
-
"hybridly",
|
|
7
|
-
"inertiajs"
|
|
8
|
-
],
|
|
6
|
+
"author": "Enzo Innocenzi <enzo@innocenzi.dev>",
|
|
9
7
|
"license": "MIT",
|
|
8
|
+
"funding": "https://github.com/sponsors/innocenzi",
|
|
9
|
+
"homepage": "https://github.com/hybridly/hybridly#readme",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
12
|
"url": "git+https://github.com/hybridly/hybridly.git"
|
|
13
13
|
},
|
|
14
|
-
"funding": "https://github.com/sponsors/innocenzi",
|
|
15
|
-
"author": "Enzo Innocenzi <enzo@innocenzi.dev>",
|
|
16
|
-
"type": "module",
|
|
17
|
-
"homepage": "https://github.com/hybridly/hybridly#readme",
|
|
18
14
|
"bugs": {
|
|
19
15
|
"url": "https://github.com/hybridly/hybridly/issues"
|
|
20
16
|
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"hybridly",
|
|
19
|
+
"inertiajs"
|
|
20
|
+
],
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"provenance": true,
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"sideEffects": false,
|
|
26
|
-
"files": [
|
|
27
|
-
"dist",
|
|
28
|
-
"*.d.ts"
|
|
29
|
-
],
|
|
30
26
|
"exports": {
|
|
31
27
|
".": {
|
|
32
|
-
"
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
33
29
|
"import": "./dist/index.mjs",
|
|
34
|
-
"
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
35
31
|
}
|
|
36
32
|
},
|
|
37
33
|
"main": "dist/index.cjs",
|
|
38
34
|
"module": "dist/index.mjs",
|
|
39
35
|
"types": "dist/index.d.ts",
|
|
36
|
+
"files": [
|
|
37
|
+
"*.d.ts",
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"axios": "^1.
|
|
41
|
+
"axios": "^1.7.2"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"qs": "^6.12.1",
|
|
45
45
|
"superjson": "^2.2.1",
|
|
46
|
-
"@hybridly/utils": "0.7.
|
|
46
|
+
"@hybridly/utils": "0.7.10"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"defu": "^6.1.4"
|