solid-navigator 0.2.2 → 0.2.4
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/dev.js +10 -9
- package/dist/dev.jsx +9 -8
- package/dist/index.js +10 -9
- package/dist/index.jsx +9 -8
- package/package.json +1 -1
package/dist/dev.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createComponent, spread, template } from 'solid-js/web';
|
|
2
|
-
import { createContext, children, createMemo, createSignal,
|
|
1
|
+
import { delegateEvents, createComponent, spread, template } from 'solid-js/web';
|
|
2
|
+
import { createContext, children, createMemo, createSignal, onCleanup, mergeProps, createEffect, on, useContext } from 'solid-js';
|
|
3
3
|
import { createStore, reconcile } from 'solid-js/store';
|
|
4
4
|
|
|
5
5
|
// src/Router.tsx
|
|
@@ -140,6 +140,8 @@ function Router(props) {
|
|
|
140
140
|
setHashAndSearch(getHashAndSearch());
|
|
141
141
|
};
|
|
142
142
|
const onClick = (event) => {
|
|
143
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)
|
|
144
|
+
return;
|
|
143
145
|
const target = event.composedPath().find((el) => el instanceof Node && el.nodeName.toUpperCase() === "A");
|
|
144
146
|
if (target?.tagName !== "A")
|
|
145
147
|
return;
|
|
@@ -151,13 +153,12 @@ function Router(props) {
|
|
|
151
153
|
replace: target.hasAttribute("replace")
|
|
152
154
|
});
|
|
153
155
|
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
156
|
+
delegateEvents(["click"]);
|
|
157
|
+
window.addEventListener("popstate", onPopState);
|
|
158
|
+
document.addEventListener("click", onClick);
|
|
159
|
+
onCleanup(() => {
|
|
160
|
+
window.removeEventListener("popstate", onPopState);
|
|
161
|
+
document.removeEventListener("click", onClick);
|
|
161
162
|
});
|
|
162
163
|
return createComponent(RouterContext.Provider, {
|
|
163
164
|
value: {
|
package/dist/dev.jsx
CHANGED
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
createMemo as createMemo2,
|
|
6
6
|
createSignal,
|
|
7
7
|
onCleanup,
|
|
8
|
-
onMount,
|
|
9
8
|
useContext
|
|
10
9
|
} from "solid-js";
|
|
10
|
+
import { delegateEvents } from "solid-js/web";
|
|
11
11
|
import { createStore as createStore2, reconcile as reconcile2 } from "solid-js/store";
|
|
12
12
|
|
|
13
13
|
// src/utils/matcher.ts
|
|
@@ -147,6 +147,8 @@ function Router(props) {
|
|
|
147
147
|
setHashAndSearch(getHashAndSearch());
|
|
148
148
|
};
|
|
149
149
|
const onClick = (event) => {
|
|
150
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)
|
|
151
|
+
return;
|
|
150
152
|
const target = event.composedPath().find((el) => el instanceof Node && el.nodeName.toUpperCase() === "A");
|
|
151
153
|
if (target?.tagName !== "A")
|
|
152
154
|
return;
|
|
@@ -158,13 +160,12 @@ function Router(props) {
|
|
|
158
160
|
replace: target.hasAttribute("replace")
|
|
159
161
|
});
|
|
160
162
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
});
|
|
163
|
+
delegateEvents(["click"]);
|
|
164
|
+
window.addEventListener("popstate", onPopState);
|
|
165
|
+
document.addEventListener("click", onClick);
|
|
166
|
+
onCleanup(() => {
|
|
167
|
+
window.removeEventListener("popstate", onPopState);
|
|
168
|
+
document.removeEventListener("click", onClick);
|
|
168
169
|
});
|
|
169
170
|
return <RouterContext.Provider
|
|
170
171
|
value={{
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createComponent, spread, template } from 'solid-js/web';
|
|
2
|
-
import { createContext, children, createMemo, createSignal,
|
|
1
|
+
import { delegateEvents, createComponent, spread, template } from 'solid-js/web';
|
|
2
|
+
import { createContext, children, createMemo, createSignal, onCleanup, mergeProps, createEffect, on, useContext } from 'solid-js';
|
|
3
3
|
import { createStore, reconcile } from 'solid-js/store';
|
|
4
4
|
|
|
5
5
|
// src/Router.tsx
|
|
@@ -140,6 +140,8 @@ function Router(props) {
|
|
|
140
140
|
setHashAndSearch(getHashAndSearch());
|
|
141
141
|
};
|
|
142
142
|
const onClick = (event) => {
|
|
143
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)
|
|
144
|
+
return;
|
|
143
145
|
const target = event.composedPath().find((el) => el instanceof Node && el.nodeName.toUpperCase() === "A");
|
|
144
146
|
if (target?.tagName !== "A")
|
|
145
147
|
return;
|
|
@@ -151,13 +153,12 @@ function Router(props) {
|
|
|
151
153
|
replace: target.hasAttribute("replace")
|
|
152
154
|
});
|
|
153
155
|
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
});
|
|
156
|
+
delegateEvents(["click"]);
|
|
157
|
+
window.addEventListener("popstate", onPopState);
|
|
158
|
+
document.addEventListener("click", onClick);
|
|
159
|
+
onCleanup(() => {
|
|
160
|
+
window.removeEventListener("popstate", onPopState);
|
|
161
|
+
document.removeEventListener("click", onClick);
|
|
161
162
|
});
|
|
162
163
|
return createComponent(RouterContext.Provider, {
|
|
163
164
|
value: {
|
package/dist/index.jsx
CHANGED
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
createMemo as createMemo2,
|
|
6
6
|
createSignal,
|
|
7
7
|
onCleanup,
|
|
8
|
-
onMount,
|
|
9
8
|
useContext
|
|
10
9
|
} from "solid-js";
|
|
10
|
+
import { delegateEvents } from "solid-js/web";
|
|
11
11
|
import { createStore as createStore2, reconcile as reconcile2 } from "solid-js/store";
|
|
12
12
|
|
|
13
13
|
// src/utils/matcher.ts
|
|
@@ -147,6 +147,8 @@ function Router(props) {
|
|
|
147
147
|
setHashAndSearch(getHashAndSearch());
|
|
148
148
|
};
|
|
149
149
|
const onClick = (event) => {
|
|
150
|
+
if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)
|
|
151
|
+
return;
|
|
150
152
|
const target = event.composedPath().find((el) => el instanceof Node && el.nodeName.toUpperCase() === "A");
|
|
151
153
|
if (target?.tagName !== "A")
|
|
152
154
|
return;
|
|
@@ -158,13 +160,12 @@ function Router(props) {
|
|
|
158
160
|
replace: target.hasAttribute("replace")
|
|
159
161
|
});
|
|
160
162
|
};
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
});
|
|
163
|
+
delegateEvents(["click"]);
|
|
164
|
+
window.addEventListener("popstate", onPopState);
|
|
165
|
+
document.addEventListener("click", onClick);
|
|
166
|
+
onCleanup(() => {
|
|
167
|
+
window.removeEventListener("popstate", onPopState);
|
|
168
|
+
document.removeEventListener("click", onClick);
|
|
168
169
|
});
|
|
169
170
|
return <RouterContext.Provider
|
|
170
171
|
value={{
|