amotify 0.3.51 → 0.3.52

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.
@@ -67,7 +67,7 @@ $$.scope( () => {
67
67
  let useLocation = ReactRouterDOM.useLocation()
68
68
  let useNavigate = ReactRouterDOM.useNavigate()
69
69
  useEffect( () => {
70
- pageRouter.setPushEffect( url => {
70
+ pageRouter.setOnPush( url => {
71
71
  if ( url.match( /^#/ ) ) {
72
72
  console.log( url )
73
73
  console.log( window.location.pathname )
@@ -76,7 +76,7 @@ $$.scope( () => {
76
76
  }
77
77
  useNavigate( url )
78
78
  } )
79
- pageRouter.setBackEffect( () => {
79
+ pageRouter.setOnBack( () => {
80
80
  useNavigate( -1 )
81
81
  } )
82
82
  },[] )
@@ -1,14 +1,21 @@
1
1
  declare namespace pageRouter {
2
+ type EventType = 'open' | 'push' | 'back';
3
+ type onEventInput = {
4
+ type: EventType;
5
+ async?: boolean;
6
+ uri: string;
7
+ };
2
8
  type Methods = {
3
9
  open(url: string): void;
4
10
  pushSync(url: string): void;
5
11
  pushAsync(url: string): void;
6
12
  push(url: string, newTab?: boolean): void;
13
+ onEvent?: (input: onEventInput) => string | false | void;
7
14
  back(): void;
8
- __push(url: string): void;
9
- __back(): void;
10
- setPushEffect(effect: (url: string) => void): void;
11
- setBackEffect(effect: () => void): void;
15
+ onPush(url: string): void;
16
+ onBack(): void;
17
+ setOnPush(effect: (url: string) => void): void;
18
+ setOnBack(effect: () => void): void;
12
19
  };
13
20
  }
14
21
  declare const pageRouter: pageRouter.Methods;
@@ -1 +1 @@
1
- import"../chunk-C5N2D3ZX.js";const s={open:e=>{window.open(e)},pushSync:e=>{window.location.href=e},push:(e,t)=>{if(t){s.open(e);return}s.pushAsync(e)},pushAsync:e=>{if(e.match(/https?:\/\//)){s.pushSync(e);return}s.__push(e)},back:()=>{s.__back()},__push:e=>{},__back:()=>{},setPushEffect:e=>{s.__push=e},setBackEffect:e=>{s.__back=e}};export{s as default,s as pageRouter};
1
+ import"../chunk-C5N2D3ZX.js";import o from"jmini";const n={open:e=>{let i=e;if(n.onEvent){let t=n.onEvent({type:"open",uri:e});if(t===!1)return;o.isString(t)&&(i=t)}window.open(i)},pushSync:e=>{let i=e;if(n.onEvent){let t=n.onEvent({type:"push",uri:e});if(t===!1)return;o.isString(t)&&(i=t)}window.location.href=i},push:(e,i)=>{let t=e;if(n.onEvent){let r=n.onEvent({type:"push",uri:e});if(r===!1)return;o.isString(r)&&(t=r)}if(i){n.open(t);return}n.pushAsync(t)},pushAsync:e=>{let i=e;if(n.onEvent){let t=n.onEvent({type:"push",async:!0,uri:e});if(t===!1)return;o.isString(t)&&(i=t)}if(i.match(/https?:\/\//)){n.pushSync(i);return}n.onPush(i)},onEvent:void 0,back:()=>{n.onBack()},onPush:e=>{},onBack:()=>{},setOnPush:e=>{n.onPush=e},setOnBack:e=>{n.onBack=e}};export{n as default,n as pageRouter};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "amotify",
3
- "version": "0.3.51",
3
+ "version": "0.3.52",
4
4
  "description": "UI Component for React,NextJS,esbuild",
5
5
  "scripts": {
6
6
  "start": "run-p clean build:*",