@akanjs/next 0.0.40 → 0.0.42

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.
Files changed (46) hide show
  1. package/index.d.ts +1 -33
  2. package/index.js +2723 -20
  3. package/package.json +35 -2
  4. package/src/bootCsr.d.ts +1 -3
  5. package/src/createNextMiddleware.d.ts +2 -5
  6. package/src/createRobotPage.d.ts +2 -5
  7. package/src/createSitemapPage.d.ts +2 -5
  8. package/src/index.d.ts +20 -33
  9. package/src/lazy.d.ts +3 -6
  10. package/src/makePageProto.d.ts +3 -15
  11. package/src/types.d.ts +2 -4
  12. package/src/useCamera.d.ts +4 -8
  13. package/src/useCodepush.d.ts +2 -36
  14. package/src/useContact.d.ts +3 -7
  15. package/src/useCsrValues.d.ts +22 -36
  16. package/src/useDebounce.d.ts +1 -3
  17. package/src/useFetch.d.ts +1 -3
  18. package/src/useGeoLocation.d.ts +4 -9
  19. package/src/useHistory.d.ts +4 -8
  20. package/src/useInterval.d.ts +1 -5
  21. package/src/useLocation.d.ts +3 -7
  22. package/src/usePurchase.d.ts +5 -6
  23. package/src/usePushNoti.d.ts +1 -3
  24. package/src/useThrottle.d.ts +1 -3
  25. package/csrTypes-B6ATv9-y.d.ts +0 -88
  26. package/src/bootCsr.js +0 -206
  27. package/src/createNextMiddleware.js +0 -88
  28. package/src/createRobotPage.js +0 -39
  29. package/src/createSitemapPage.js +0 -34
  30. package/src/index.js +0 -82
  31. package/src/lazy.js +0 -40
  32. package/src/makePageProto.js +0 -147
  33. package/src/types.js +0 -15
  34. package/src/useCamera.js +0 -114
  35. package/src/useCodepush.js +0 -115
  36. package/src/useContact.js +0 -73
  37. package/src/useCsrValues.js +0 -924
  38. package/src/useDebounce.js +0 -42
  39. package/src/useFetch.js +0 -54
  40. package/src/useGeoLocation.js +0 -51
  41. package/src/useHistory.js +0 -88
  42. package/src/useInterval.js +0 -49
  43. package/src/useLocation.js +0 -92
  44. package/src/usePurchase.js +0 -139
  45. package/src/usePushNoti.js +0 -68
  46. package/src/useThrottle.js +0 -44
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/next",
3
- "version": "0.0.40",
3
+ "version": "0.0.42",
4
4
  "type": "commonjs",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,5 +14,38 @@
14
14
  "engines": {
15
15
  "node": ">=22"
16
16
  },
17
- "dependencies": {}
17
+ "dependencies": {
18
+ "@capacitor-community/contacts": "^6.1.1",
19
+ "@capacitor-community/fcm": "^7.1.1",
20
+ "@capacitor/app": "^7.0.1",
21
+ "@capacitor/camera": "^7.0.1",
22
+ "@capacitor/core": "^7.2.0",
23
+ "@capacitor/device": "^7.0.1",
24
+ "@capacitor/geolocation": "^7.1.2",
25
+ "@capacitor/haptics": "^7.0.1",
26
+ "@capacitor/keyboard": "^7.0.1",
27
+ "@capacitor/preferences": "^7.0.1",
28
+ "@capacitor/push-notifications": "^7.0.1",
29
+ "@capgo/capacitor-updater": "^7.0.50",
30
+ "@formatjs/intl-localematcher": "^0.5.10",
31
+ "@react-spring/web": "^9.7.5",
32
+ "@urql/core": "^5.1.0",
33
+ "@use-gesture/react": "^10.3.1",
34
+ "axios": "^1.7.9",
35
+ "capacitor-plugin-safe-area": "^3.0.4",
36
+ "clsx": "^2.1.1",
37
+ "cordova-plugin-purchase": "^13.12.1",
38
+ "dayjs": "^1.11.13",
39
+ "immer": "^10.1.1",
40
+ "js-cookie": "^3.0.5",
41
+ "jwt-decode": "^4.0.0",
42
+ "negotiator": "^1.0.0",
43
+ "next": "^15.3.2",
44
+ "pluralize": "^8.0.0",
45
+ "react": "^18.3.1",
46
+ "react-device-detect": "^2.2.3",
47
+ "react-dom": "^18.3.1",
48
+ "reflect-metadata": "^0.2.2",
49
+ "socket.io-client": "^4.8.1"
50
+ }
18
51
  }
package/src/bootCsr.d.ts CHANGED
@@ -1,3 +1 @@
1
- declare const bootCsr: (context: Record<string, () => Promise<unknown>>, rootPath: string, entryPath?: string) => Promise<void>;
2
-
3
- export { bootCsr };
1
+ export declare const bootCsr: (context: Record<string, () => Promise<unknown>>, rootPath: string, entryPath?: string) => Promise<void>;
@@ -1,5 +1,2 @@
1
- import { NextRequest, NextResponse } from 'next/server';
2
-
3
- declare const createNextMiddleware: () => (request: NextRequest) => NextResponse<unknown>;
4
-
5
- export { createNextMiddleware };
1
+ import { NextRequest, NextResponse } from "next/server";
2
+ export declare const createNextMiddleware: () => (request: NextRequest) => NextResponse<unknown>;
@@ -1,5 +1,2 @@
1
- import { MetadataRoute } from 'next';
2
-
3
- declare const createRobotPage: (clientHttpUri: string, config?: MetadataRoute.Robots) => MetadataRoute.Robots;
4
-
5
- export { createRobotPage };
1
+ import { MetadataRoute } from "next";
2
+ export declare const createRobotPage: (clientHttpUri: string, config?: MetadataRoute.Robots) => MetadataRoute.Robots;
@@ -1,5 +1,2 @@
1
- import { MetadataRoute } from 'next';
2
-
3
- declare const createSitemapPage: (clientHttpUri: string, paths: string[]) => MetadataRoute.Sitemap;
4
-
5
- export { createSitemapPage };
1
+ import { MetadataRoute } from "next";
2
+ export declare const createSitemapPage: (clientHttpUri: string, paths: string[]) => MetadataRoute.Sitemap;
package/src/index.d.ts CHANGED
@@ -1,33 +1,20 @@
1
- export { LoginAuth, LoginForm } from './types.js';
2
- export { useFetch } from './useFetch.js';
3
- export { lazy } from './lazy.js';
4
- export { makePageProto } from './makePageProto.js';
5
- export { useDebounce } from './useDebounce.js';
6
- export { useInterval } from './useInterval.js';
7
- export { bootCsr } from './bootCsr.js';
8
- export { useCamera } from './useCamera.js';
9
- export { useContact } from './useContact.js';
10
- export { usePushNoti } from './usePushNoti.js';
11
- export { useGeoLocation } from './useGeoLocation.js';
12
- export { useCodepush } from './useCodepush.js';
13
- export { CdvProductType, PlatformType, ProductType, usePurchase } from './usePurchase.js';
14
- export { useCsrValues } from './useCsrValues.js';
15
- export { createRobotPage } from './createRobotPage.js';
16
- export { createSitemapPage } from './createSitemapPage.js';
17
- export { createNextMiddleware } from './createNextMiddleware.js';
18
- export { useThrottle } from './useThrottle.js';
19
- export { useHistory } from './useHistory.js';
20
- export { useLocation } from './useLocation.js';
21
- import 'next/dynamic';
22
- import 'react';
23
- import '@capacitor/camera';
24
- import '@capacitor-community/contacts';
25
- import '@capacitor/geolocation';
26
- import '@capacitor/core';
27
- import 'dayjs';
28
- import '@react-spring/web';
29
- import '@use-gesture/react/dist/declarations/src/types';
30
- import '../csrTypes-B6ATv9-y.js';
31
- import 'react-spring';
32
- import 'next';
33
- import 'next/server';
1
+ export type * from "./types";
2
+ export { useFetch } from "./useFetch";
3
+ export { lazy } from "./lazy";
4
+ export { makePageProto } from "./makePageProto";
5
+ export { useDebounce } from "./useDebounce";
6
+ export { useInterval } from "./useInterval";
7
+ export { bootCsr } from "./bootCsr";
8
+ export { useCamera } from "./useCamera";
9
+ export { useContact } from "./useContact";
10
+ export { usePushNoti } from "./usePushNoti";
11
+ export { useGeoLocation } from "./useGeoLocation";
12
+ export { useCodepush } from "./useCodepush";
13
+ export { usePurchase, type PlatformType, type ProductType, type CdvProductType } from "./usePurchase";
14
+ export { useCsrValues } from "./useCsrValues";
15
+ export { createRobotPage } from "./createRobotPage";
16
+ export { createSitemapPage } from "./createSitemapPage";
17
+ export { createNextMiddleware } from "./createNextMiddleware";
18
+ export { useThrottle } from "./useThrottle";
19
+ export { useHistory } from "./useHistory";
20
+ export { useLocation } from "./useLocation";
package/src/lazy.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- import { DynamicOptions } from 'next/dynamic';
2
- import { ComponentType } from 'react';
3
-
4
- declare const lazy: <T extends ComponentType<any>>(loader: (x?: string) => Promise<{
1
+ import { DynamicOptions } from "next/dynamic";
2
+ import { ComponentType } from "react";
3
+ export declare const lazy: <T extends ComponentType<any>>(loader: (x?: string) => Promise<{
5
4
  default: T;
6
5
  } | T>, option?: DynamicOptions<T>) => T;
7
-
8
- export { lazy };
@@ -1,16 +1,6 @@
1
- import { ReactNode } from 'react';
2
-
3
- type TranslationSingle = readonly [string, string] | readonly [string, string, string, string];
4
- type TranslationWithParam = readonly [string, string, {
5
- [key: string]: string | number;
6
- }];
7
- type Translation = TranslationSingle | TranslationWithParam;
8
- type GetKeys<O> = O extends infer U ? (U extends object ? keyof U : never) : never;
9
- type TransMessage<Locale extends Record<string, any>> = Locale extends infer U ? U extends object ? {
10
- [K in keyof U]-?: `${K & string}${U[K] extends Record<string, any> ? `.${GetKeys<U[K]>}` : never}`;
11
- }[keyof U] : never : never;
12
-
13
- declare const makePageProto: <Locale extends {
1
+ import { type Translation, type TransMessage } from "@akanjs/dictionary";
2
+ import type { ReactNode } from "react";
3
+ export declare const makePageProto: <Locale extends {
14
4
  [key: string]: {
15
5
  [key: string]: Translation;
16
6
  };
@@ -38,5 +28,3 @@ declare const makePageProto: <Locale extends {
38
28
  };
39
29
  lang: string;
40
30
  };
41
-
42
- export { makePageProto };
package/src/types.d.ts CHANGED
@@ -1,9 +1,7 @@
1
- type LoginAuth = "user" | "admin" | "public";
2
- interface LoginForm {
1
+ export type LoginAuth = "user" | "admin" | "public";
2
+ export interface LoginForm {
3
3
  auth: LoginAuth;
4
4
  redirect?: string;
5
5
  unauthorize?: string;
6
6
  jwt?: string | null;
7
7
  }
8
-
9
- export type { LoginAuth, LoginForm };
@@ -1,11 +1,7 @@
1
- import * as _capacitor_camera from '@capacitor/camera';
2
- import { PermissionStatus } from '@capacitor/camera';
3
-
4
- declare const useCamera: () => {
1
+ import { PermissionStatus } from "@capacitor/camera";
2
+ export declare const useCamera: () => {
5
3
  permissions: PermissionStatus;
6
- getPhoto: (src?: "prompt" | "camera" | "photos") => Promise<_capacitor_camera.Photo | undefined>;
7
- pickImage: () => Promise<_capacitor_camera.GalleryPhotos>;
4
+ getPhoto: (src?: "prompt" | "camera" | "photos") => Promise<import("@capacitor/camera").Photo | undefined>;
5
+ pickImage: () => Promise<import("@capacitor/camera").GalleryPhotos>;
8
6
  checkPermission: (type: "photos" | "camera" | "all") => Promise<void>;
9
7
  };
10
-
11
- export { useCamera };
@@ -1,37 +1,5 @@
1
- import { Dayjs } from 'dayjs';
2
-
3
- interface ProtoFile {
4
- id: string;
5
- filename: string;
6
- abstractData: string | null;
7
- imageSize: [number, number];
8
- progress: number | null;
9
- url: string;
10
- size: number;
11
- status: string;
12
- createdAt: Dayjs;
13
- updatedAt: Dayjs;
14
- removedAt: Dayjs | null;
15
- mimetype: string;
16
- encoding: string;
17
- origin: string | null;
18
- lastModifiedAt: Dayjs;
19
- }
20
- interface ProtoAppInfo {
21
- appId: string | null;
22
- appName: string;
23
- deviceId: string | null;
24
- platform: "ios" | "android" | null;
25
- major: number;
26
- minor: number;
27
- patch: number;
28
- branch: string;
29
- buildNum: string | null;
30
- versionOs: string | null;
31
- isEmulator: boolean | null;
32
- }
33
-
34
- declare const useCodepush: ({ serverUrl, branch }: {
1
+ import type { ProtoAppInfo, ProtoFile } from "@akanjs/constant";
2
+ export declare const useCodepush: ({ serverUrl, branch }: {
35
3
  serverUrl: string;
36
4
  branch: "debug" | "develop" | "main";
37
5
  }) => {
@@ -47,5 +15,3 @@ declare const useCodepush: ({ serverUrl, branch }: {
47
15
  codepush: () => Promise<void>;
48
16
  statManager: () => Promise<void>;
49
17
  };
50
-
51
- export { useCodepush };
@@ -1,10 +1,6 @@
1
- import * as _capacitor_community_contacts from '@capacitor-community/contacts';
2
- import { PermissionStatus } from '@capacitor-community/contacts';
3
-
4
- declare const useContact: () => {
1
+ import { PermissionStatus } from "@capacitor-community/contacts";
2
+ export declare const useContact: () => {
5
3
  permissions: PermissionStatus;
6
- getContacts: () => Promise<_capacitor_community_contacts.ContactPayload[]>;
4
+ getContacts: () => Promise<import("@capacitor-community/contacts").ContactPayload[]>;
7
5
  checkPermission: () => Promise<void>;
8
6
  };
9
-
10
- export { useContact };
@@ -1,44 +1,30 @@
1
- import * as react from 'react';
2
- import * as _react_spring_web from '@react-spring/web';
3
- import * as _use_gesture_react_dist_declarations_src_types from '@use-gesture/react/dist/declarations/src/types';
4
- import { R as RouteGuide, P as PathRoute, S as SafeAreaTransition, a as PageTransition, C as ContainerTransition, L as Location, H as History, T as TransitionType } from '../csrTypes-B6ATv9-y.js';
5
- import 'react-spring';
6
-
7
- interface RouterInstance {
8
- push: (href: string) => void;
9
- replace: (href: string) => void;
10
- back: () => void;
11
- refresh: () => void;
12
- }
13
-
14
- declare const useCsrValues: (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]) => {
15
- topSafeArea: SafeAreaTransition | null;
16
- page: PageTransition | null;
17
- prevPage: PageTransition | null;
18
- topInset: ContainerTransition | null;
19
- bottomInset: ContainerTransition | null;
20
- topLeftAction: ContainerTransition | null;
21
- bottomSafeArea: SafeAreaTransition | null;
22
- pageBind: (...args: any[]) => _use_gesture_react_dist_declarations_src_types.ReactDOMAttributes;
1
+ import { PathRoute, type RouteGuide, type RouterInstance, type TransitionType } from "@akanjs/client";
2
+ export declare const useCsrValues: (rootRouteGuide: RouteGuide, pathRoutes: PathRoute[]) => {
3
+ topSafeArea: import("@akanjs/client").SafeAreaTransition | null;
4
+ page: import("@akanjs/client").PageTransition | null;
5
+ prevPage: import("@akanjs/client").PageTransition | null;
6
+ topInset: import("@akanjs/client").ContainerTransition | null;
7
+ bottomInset: import("@akanjs/client").ContainerTransition | null;
8
+ topLeftAction: import("@akanjs/client").ContainerTransition | null;
9
+ bottomSafeArea: import("@akanjs/client").SafeAreaTransition | null;
10
+ pageBind: (...args: any[]) => import("@use-gesture/react/dist/declarations/src/types").ReactDOMAttributes;
23
11
  pageClassName: string;
24
12
  transDirection: "vertical" | "horizontal" | "none";
25
13
  transUnitRange: number[];
26
- transUnit: _react_spring_web.SpringValue<number>;
27
- transPercent: _react_spring_web.Interpolation<number>;
28
- transProgress: _react_spring_web.Interpolation<number>;
14
+ transUnit: import("@react-spring/web").SpringValue<number>;
15
+ transPercent: import("@react-spring/web").Interpolation<number>;
16
+ transProgress: import("@react-spring/web").Interpolation<number>;
29
17
  clientWidth: number;
30
18
  clientHeight: number;
31
- location: Location;
32
- prevLocation: Location | null;
33
- history: react.MutableRefObject<History>;
34
- topSafeAreaRef: react.MutableRefObject<HTMLDivElement | null>;
35
- bottomSafeAreaRef: react.MutableRefObject<HTMLDivElement | null>;
36
- prevPageContentRef: react.MutableRefObject<HTMLDivElement | null>;
37
- pageContentRef: react.MutableRefObject<HTMLDivElement | null>;
38
- frameRootRef: react.MutableRefObject<HTMLDivElement | null>;
39
- onBack: react.MutableRefObject<{ [K in TransitionType]?: () => Promise<void>; }>;
19
+ location: import("@akanjs/client").Location;
20
+ prevLocation: import("@akanjs/client").Location | null;
21
+ history: import("react").MutableRefObject<import("@akanjs/client").History>;
22
+ topSafeAreaRef: import("react").MutableRefObject<HTMLDivElement | null>;
23
+ bottomSafeAreaRef: import("react").MutableRefObject<HTMLDivElement | null>;
24
+ prevPageContentRef: import("react").MutableRefObject<HTMLDivElement | null>;
25
+ pageContentRef: import("react").MutableRefObject<HTMLDivElement | null>;
26
+ frameRootRef: import("react").MutableRefObject<HTMLDivElement | null>;
27
+ onBack: import("react").MutableRefObject<{ [K in TransitionType]?: () => Promise<void>; }>;
40
28
  router: RouterInstance;
41
29
  pathRoutes: PathRoute[];
42
30
  };
43
-
44
- export { useCsrValues };
@@ -1,3 +1 @@
1
- declare const useDebounce: <Callback extends (...args: any) => any>(callback: Callback, states?: any[], wait?: number) => Callback;
2
-
3
- export { useDebounce };
1
+ export declare const useDebounce: <Callback extends (...args: any) => any>(callback: Callback, states?: any[], wait?: number) => Callback;
package/src/useFetch.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- declare const useFetch: <Return>(fnOrPromise: Promise<Return> | Return, { onError }?: {
1
+ export declare const useFetch: <Return>(fnOrPromise: Promise<Return> | Return, { onError }?: {
2
2
  onError?: (err: string) => void;
3
3
  }) => {
4
4
  fulfilled: boolean;
5
5
  value: Return | null;
6
6
  };
7
-
8
- export { useFetch };
@@ -1,12 +1,7 @@
1
- import * as _capacitor_geolocation from '@capacitor/geolocation';
2
- import * as _capacitor_core from '@capacitor/core';
3
-
4
- declare const useGeoLocation: () => {
1
+ export declare const useGeoLocation: () => {
5
2
  checkPermission: () => Promise<{
6
- geolocation: _capacitor_core.PermissionState;
7
- coarseLocation: _capacitor_core.PermissionState;
3
+ geolocation: import("@capacitor/core").PermissionState;
4
+ coarseLocation: import("@capacitor/core").PermissionState;
8
5
  }>;
9
- getPosition: () => Promise<_capacitor_geolocation.Position | undefined>;
6
+ getPosition: () => Promise<import("@capacitor/geolocation").Position | undefined>;
10
7
  };
11
-
12
- export { useGeoLocation };
@@ -1,7 +1,4 @@
1
- import * as react from 'react';
2
- import { L as Location, H as History } from '../csrTypes-B6ATv9-y.js';
3
- import 'react-spring';
4
-
1
+ import type { History, Location } from "@akanjs/client";
5
2
  interface setForwardOptions {
6
3
  type: "push" | "replace" | "popForward";
7
4
  location: Location;
@@ -12,13 +9,12 @@ interface setBackOptions {
12
9
  location: Location;
13
10
  scrollTop?: number;
14
11
  }
15
- declare const useHistory: (locations?: Location[]) => {
16
- history: react.MutableRefObject<History>;
12
+ export declare const useHistory: (locations?: Location[]) => {
13
+ history: import("react").MutableRefObject<History>;
17
14
  setHistoryForward: ({ type, location, scrollTop }: setForwardOptions) => void;
18
15
  setHistoryBack: ({ location, scrollTop }: setBackOptions) => void;
19
16
  getCurrentLocation: () => Location;
20
17
  getPrevLocation: () => Location | null;
21
18
  getScrollTop: (pathname?: string) => number;
22
19
  };
23
-
24
- export { useHistory };
20
+ export {};
@@ -1,5 +1 @@
1
- import * as react from 'react';
2
-
3
- declare const useInterval: (callback: (() => void) | (() => Promise<void>), delay: number) => react.MutableRefObject<(() => void) | (() => Promise<void>) | null>;
4
-
5
- export { useInterval };
1
+ export declare const useInterval: (callback: (() => void) | (() => Promise<void>), delay: number) => import("react").MutableRefObject<(() => void) | (() => Promise<void>) | null>;
@@ -1,12 +1,8 @@
1
- import { R as RouteGuide, L as Location } from '../csrTypes-B6ATv9-y.js';
2
- import 'react';
3
- import 'react-spring';
4
-
1
+ import { type Location, type RouteGuide } from "@akanjs/client";
5
2
  interface UseLocationOptions {
6
3
  rootRouteGuide: RouteGuide;
7
4
  }
8
- declare const useLocation: ({ rootRouteGuide }: UseLocationOptions) => {
5
+ export declare const useLocation: ({ rootRouteGuide }: UseLocationOptions) => {
9
6
  getLocation: (href: string) => Location;
10
7
  };
11
-
12
- export { useLocation };
8
+ export {};
@@ -1,10 +1,11 @@
1
- type PlatformType = "android" | "ios" | "all";
2
- interface ProductType {
1
+ import "cordova-plugin-purchase/www/store";
2
+ export type PlatformType = "android" | "ios" | "all";
3
+ export interface ProductType {
3
4
  id: string;
4
5
  type: keyof typeof CdvPurchase.ProductType;
5
6
  }
6
- type CdvProductType = CdvPurchase.ProductType;
7
- declare const usePurchase: ({ platform, productInfo, url, onPay, onSubscribe, }: {
7
+ export type CdvProductType = CdvPurchase.ProductType;
8
+ export declare const usePurchase: ({ platform, productInfo, url, onPay, onSubscribe, }: {
8
9
  platform: PlatformType;
9
10
  productInfo: ProductType[];
10
11
  url: string;
@@ -16,5 +17,3 @@ declare const usePurchase: ({ platform, productInfo, url, onPay, onSubscribe, }:
16
17
  purchaseProduct: (product: CdvPurchase.Product) => Promise<void>;
17
18
  restorePurchases: () => Promise<void>;
18
19
  };
19
-
20
- export { type CdvProductType, type PlatformType, type ProductType, usePurchase };
@@ -1,8 +1,6 @@
1
- declare const usePushNoti: () => {
1
+ export declare const usePushNoti: () => {
2
2
  init: () => Promise<void>;
3
3
  checkPermission: () => Promise<boolean>;
4
4
  register: () => Promise<void>;
5
5
  getToken: () => Promise<string | undefined>;
6
6
  };
7
-
8
- export { usePushNoti };
@@ -1,3 +1 @@
1
- declare const useThrottle: (func: (...args: any) => any, delay?: number, deps?: any[]) => (...args: any[]) => void;
2
-
3
- export { useThrottle };
1
+ export declare const useThrottle: (func: (...args: any) => any, delay?: number, deps?: any[]) => (...args: any[]) => void;
@@ -1,88 +0,0 @@
1
- import { ReactNode, ExoticComponent } from 'react';
2
- import { AnimatedComponent } from 'react-spring';
3
-
4
- type TransitionType = "none" | "fade" | "bottomUp" | "stack" | "scaleOut";
5
- interface CsrState {
6
- transition: TransitionType;
7
- topSafeArea: number;
8
- bottomSafeArea: number;
9
- topInset: number;
10
- bottomInset: number;
11
- gesture: boolean;
12
- cache: boolean;
13
- }
14
- type TransitionStyle = NonNullable<AnimatedComponent<ExoticComponent>["defaultProps"]>["style"];
15
- interface SafeAreaTransition {
16
- containerStyle: TransitionStyle;
17
- }
18
- interface ContainerTransition {
19
- containerStyle: TransitionStyle;
20
- contentStyle: TransitionStyle;
21
- prevContentStyle: TransitionStyle;
22
- }
23
- interface PageTransition {
24
- containerStyle: TransitionStyle;
25
- contentStyle: TransitionStyle;
26
- }
27
- type PageState = CsrState & {
28
- topInset: number;
29
- bottomInset: number;
30
- };
31
- interface Location {
32
- pathname: string;
33
- search: string;
34
- params: {
35
- [key: string]: string;
36
- };
37
- searchParams: {
38
- [key: string]: string | string[];
39
- };
40
- pathRoute: PathRoute;
41
- }
42
- interface History {
43
- type: "initial" | "forward" | "back";
44
- locations: Location[];
45
- scrollMap: Map<string, number>;
46
- idxMap: Map<string, number>;
47
- cachedLocationMap: Map<string, Location>;
48
- idx: number;
49
- }
50
- interface PathRoute {
51
- path: string;
52
- pathSegments: string[];
53
- Page: (({ params, searchParams }: {
54
- params: any;
55
- searchParams: any;
56
- }) => ReactNode) | (({ params, searchParams }: {
57
- params: any;
58
- searchParams: any;
59
- }) => Promise<ReactNode>);
60
- pageState: PageState;
61
- RootLayouts: ((({ children, params, searchParams }: {
62
- children: any;
63
- params: any;
64
- searchParams: any;
65
- }) => ReactNode) | (({ children, params, searchParams }: {
66
- children: any;
67
- params: any;
68
- searchParams: any;
69
- }) => Promise<ReactNode>))[];
70
- Layouts: ((({ children, params, searchParams }: {
71
- children: any;
72
- params: any;
73
- searchParams: any;
74
- }) => ReactNode) | (({ children, params, searchParams }: {
75
- children: any;
76
- params: any;
77
- searchParams: any;
78
- }) => Promise<ReactNode>))[];
79
- }
80
- interface RouteGuide {
81
- pathSegment: string;
82
- pathRoute?: PathRoute;
83
- children: {
84
- [key: string]: RouteGuide;
85
- };
86
- }
87
-
88
- export type { ContainerTransition as C, History as H, Location as L, PathRoute as P, RouteGuide as R, SafeAreaTransition as S, TransitionType as T, PageTransition as a };