solid-navigator 0.3.4 → 0.3.5

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 CHANGED
@@ -1,8 +1,8 @@
1
+ import { createContext, children, createMemo, createSignal, onCleanup, batch, mergeProps, createEffect, on, useContext } from 'solid-js';
1
2
  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
- // src/Router.tsx
5
+ // src/navigator.ts
6
6
 
7
7
  // src/utils/matcher.ts
8
8
  function createMatcher(path, partial, matchFilters) {
@@ -152,8 +152,10 @@ function Router(props) {
152
152
  });
153
153
  const navigate = createNavigate(routes, pathname, setPathname, setHashAndSearch);
154
154
  const onPopState = (_event) => {
155
- setPathname(location.pathname);
156
- setHashAndSearch(getHashAndSearch());
155
+ batch(() => {
156
+ setPathname(location.pathname);
157
+ setHashAndSearch(getHashAndSearch());
158
+ });
157
159
  };
158
160
  const onClick = (event) => {
159
161
  if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)
@@ -286,8 +288,10 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
286
288
  if (!isValidPath(routes, location.pathname)) {
287
289
  console.warn("Invalid path: " + path);
288
290
  }
289
- setPathname(location.pathname);
290
- setHashAndSearch(getHashAndSearch());
291
+ batch(() => {
292
+ setPathname(location.pathname);
293
+ setHashAndSearch(getHashAndSearch());
294
+ });
291
295
  };
292
296
  };
293
297
  var useNavigate = () => {
package/dist/dev.jsx CHANGED
@@ -1,5 +1,9 @@
1
+ // src/navigator.ts
2
+ import { batch as batch2 } from "solid-js";
3
+
1
4
  // src/Router.tsx
2
5
  import {
6
+ batch,
3
7
  children,
4
8
  createContext,
5
9
  createMemo as createMemo2,
@@ -159,8 +163,10 @@ function Router(props) {
159
163
  });
160
164
  const navigate = createNavigate(routes, pathname, setPathname, setHashAndSearch);
161
165
  const onPopState = (_event) => {
162
- setPathname(location.pathname);
163
- setHashAndSearch(getHashAndSearch());
166
+ batch(() => {
167
+ setPathname(location.pathname);
168
+ setHashAndSearch(getHashAndSearch());
169
+ });
164
170
  };
165
171
  const onClick = (event) => {
166
172
  if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)
@@ -288,8 +294,10 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
288
294
  if (!isValidPath(routes, location.pathname)) {
289
295
  console.warn("Invalid path: " + path);
290
296
  }
291
- setPathname(location.pathname);
292
- setHashAndSearch(getHashAndSearch());
297
+ batch2(() => {
298
+ setPathname(location.pathname);
299
+ setHashAndSearch(getHashAndSearch());
300
+ });
293
301
  };
294
302
  };
295
303
  var useNavigate = () => {
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
+ import { createContext, children, createMemo, createSignal, onCleanup, batch, mergeProps, createEffect, on, useContext } from 'solid-js';
1
2
  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
- // src/Router.tsx
5
+ // src/navigator.ts
6
6
 
7
7
  // src/utils/matcher.ts
8
8
  function createMatcher(path, partial, matchFilters) {
@@ -152,8 +152,10 @@ function Router(props) {
152
152
  });
153
153
  const navigate = createNavigate(routes, pathname, setPathname, setHashAndSearch);
154
154
  const onPopState = (_event) => {
155
- setPathname(location.pathname);
156
- setHashAndSearch(getHashAndSearch());
155
+ batch(() => {
156
+ setPathname(location.pathname);
157
+ setHashAndSearch(getHashAndSearch());
158
+ });
157
159
  };
158
160
  const onClick = (event) => {
159
161
  if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)
@@ -284,8 +286,10 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
284
286
  history.pushState({}, "", newPath);
285
287
  }
286
288
  if (!isValidPath(routes, location.pathname)) ;
287
- setPathname(location.pathname);
288
- setHashAndSearch(getHashAndSearch());
289
+ batch(() => {
290
+ setPathname(location.pathname);
291
+ setHashAndSearch(getHashAndSearch());
292
+ });
289
293
  };
290
294
  };
291
295
  var useNavigate = () => {
package/dist/index.jsx CHANGED
@@ -1,5 +1,9 @@
1
+ // src/navigator.ts
2
+ import { batch as batch2 } from "solid-js";
3
+
1
4
  // src/Router.tsx
2
5
  import {
6
+ batch,
3
7
  children,
4
8
  createContext,
5
9
  createMemo as createMemo2,
@@ -159,8 +163,10 @@ function Router(props) {
159
163
  });
160
164
  const navigate = createNavigate(routes, pathname, setPathname, setHashAndSearch);
161
165
  const onPopState = (_event) => {
162
- setPathname(location.pathname);
163
- setHashAndSearch(getHashAndSearch());
166
+ batch(() => {
167
+ setPathname(location.pathname);
168
+ setHashAndSearch(getHashAndSearch());
169
+ });
164
170
  };
165
171
  const onClick = (event) => {
166
172
  if (event.defaultPrevented || event.button !== 0 || event.metaKey || event.altKey || event.ctrlKey || event.shiftKey)
@@ -287,8 +293,10 @@ var createNavigate = (routes, pathname, setPathname, setHashAndSearch) => {
287
293
  }
288
294
  if (!isValidPath(routes, location.pathname)) {
289
295
  }
290
- setPathname(location.pathname);
291
- setHashAndSearch(getHashAndSearch());
296
+ batch2(() => {
297
+ setPathname(location.pathname);
298
+ setHashAndSearch(getHashAndSearch());
299
+ });
292
300
  };
293
301
  };
294
302
  var useNavigate = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-navigator",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "description": "Solid Navigator is a library that is inspired by vue router and solid router.",
5
5
  "license": "MIT",
6
6
  "author": "SupertigerDev",