revojs 0.0.73 → 0.0.74

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.
@@ -88,7 +88,7 @@ export declare function useEvent<T extends keyof ElementEventMap>(scope: Scope,
88
88
  export declare function useEvent<T extends keyof WindowEventMap>(scope: Scope, target: Window | undefined | null, event: T, input: EventListener<WindowEventMap[T]>, options?: AddEventListenerOptions): void;
89
89
  export declare function useEvent<T extends keyof HTMLElementEventMap>(scope: Scope, target: Document | HTMLElement | undefined | null, event: T, input: EventListener<HTMLElementEventMap[T]>, options?: AddEventListenerOptions): void;
90
90
  export declare function onMounted(scope: Scope, event: EventListener<MountedEvent>): void;
91
- export declare function startViewTransition(invoke: ViewTransitionUpdateCallback): Promise<void>;
91
+ export declare function startViewTransition(invoke: ViewTransitionUpdateCallback): void | Promise<void>;
92
92
  export declare function isClient(): boolean;
93
93
  export declare function isServer(): boolean;
94
94
  export declare function preventDefault(event: Event): void;
package/dist/index.js CHANGED
@@ -859,8 +859,9 @@ function useRouter(scope, context) {
859
859
  const navigate = (path) => {
860
860
  if (isClient()) {
861
861
  if (window.location.pathname != path) window.history.pushState(window.history.state, "", path);
862
+ return navigator.dispatchEvent(new NavigateEvent());
862
863
  }
863
- navigator.dispatchEvent(new NavigateEvent());
864
+ throw sendRedirect(scope, path);
864
865
  };
865
866
  const anchorNavigate = (event) => {
866
867
  event.preventDefault();
@@ -21,14 +21,14 @@ export declare function provideRouterContext(scope: Scope, options: RouterOption
21
21
  url: State<URL | undefined>;
22
22
  route: State<unknown>;
23
23
  navigator: EventTarget;
24
- navigate: (path: string) => void;
24
+ navigate: (path: string) => boolean;
25
25
  anchorNavigate: (event: Event) => void;
26
26
  };
27
27
  export declare function useRouter<T extends RouterContext>(scope: Scope, context?: Descriptor<T>): {
28
28
  url: State<URL | undefined>;
29
29
  route: State<unknown>;
30
30
  navigator: EventTarget;
31
- navigate: (path: string) => void;
31
+ navigate: (path: string) => boolean;
32
32
  anchorNavigate: (event: Event) => void;
33
33
  };
34
34
  export declare const Page: import("..").ComponentConstructor<import("..").Events, import("..").Attributes>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.0.73",
3
+ "version": "0.0.74",
4
4
  "type": "module",
5
5
  "repository": "coverbase/revojs",
6
6
  "license": "MIT",