@react-motion-router/core 2.0.0-beta.sha-1c021e3 → 2.0.0-beta.sha-c601afb
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/build/MetaData.d.ts +2 -2
- package/build/NavigationBase.d.ts +2 -2
- package/build/RouterBase.d.ts +2 -2
- package/build/RouterContext.d.ts +1 -1
- package/build/ScreenBase.d.ts +14 -12
- package/build/ScreenTransitionLayer.d.ts +2 -0
- package/build/SharedElementTransitionLayer.d.ts +2 -1
- package/build/common/events.d.ts +4 -6
- package/build/common/types.d.ts +15 -0
- package/build/common/utils.d.ts +2 -1
- package/build/common/utils.js +7 -2
- package/build/common/utils.js.map +1 -1
- package/build/index.js +142 -147
- package/build/index.js.map +1 -1
- package/package.json +2 -2
package/build/MetaData.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export declare class MetaData {
|
|
|
8
8
|
has(key: string | MetaType): boolean;
|
|
9
9
|
delete(key: string | MetaType): void;
|
|
10
10
|
clear(): void;
|
|
11
|
-
entries(): IterableIterator<[`
|
|
12
|
-
[Symbol.iterator](): IterableIterator<[`
|
|
11
|
+
entries(): IterableIterator<[`name=${string}` | `http-equiv=${string}` | `itemprop=${string}` | `property=${string}` | `charset=${string}`, string | undefined]>;
|
|
12
|
+
[Symbol.iterator](): IterableIterator<[`name=${string}` | `http-equiv=${string}` | `itemprop=${string}` | `property=${string}` | `charset=${string}`, string | undefined]>;
|
|
13
13
|
get size(): number;
|
|
14
14
|
private observeMutations;
|
|
15
15
|
private metaDataFromNode;
|
|
@@ -2,10 +2,10 @@ import { RouterHTMLElement, RouterBaseEventMap } from "./common/types";
|
|
|
2
2
|
import { MetaData } from "./MetaData";
|
|
3
3
|
import { RouterBase } from "./RouterBase";
|
|
4
4
|
export declare abstract class NavigationBase<E extends RouterBaseEventMap = RouterBaseEventMap> {
|
|
5
|
-
protected readonly router: RouterBase;
|
|
5
|
+
protected abstract readonly router: RouterBase;
|
|
6
6
|
private static rootNavigatorRef;
|
|
7
7
|
readonly metaData: MetaData;
|
|
8
|
-
constructor(
|
|
8
|
+
constructor();
|
|
9
9
|
addEventListener<K extends keyof E>(type: K, listener: (this: RouterHTMLElement<E>, ev: E[K]) => any, options?: boolean | AddEventListenerOptions): () => void;
|
|
10
10
|
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): () => void;
|
|
11
11
|
removeEventListener<K extends keyof E>(type: K, listener: (this: RouterHTMLElement<E>, ev: E[K]) => any, options?: boolean | EventListenerOptions | undefined): void;
|
package/build/RouterBase.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NavigationBase } from './NavigationBase';
|
|
2
2
|
import { ScreenTransitionLayer } from './ScreenTransitionLayer';
|
|
3
|
-
import { ScreenChild, RouterBaseEventMap, RouterHTMLElement
|
|
3
|
+
import { ScreenChild, RouterBaseEventMap, RouterHTMLElement } from './common/types';
|
|
4
4
|
import { NestedRouterContext } from './RouterContext';
|
|
5
5
|
import { Component } from 'react';
|
|
6
6
|
import { ScreenBase, ScreenBaseConfig } from './ScreenBase';
|
|
@@ -20,9 +20,9 @@ export declare abstract class RouterBase<P extends RouterBaseProps = RouterBaseP
|
|
|
20
20
|
protected readonly ref: import("react").RefObject<RouterHTMLElement<E>>;
|
|
21
21
|
protected screenTransitionLayer: import("react").RefObject<ScreenTransitionLayer>;
|
|
22
22
|
abstract readonly navigation: NavigationBase;
|
|
23
|
-
readonly screenState: ScreenState;
|
|
24
23
|
readonly parent: RouterBase | null;
|
|
25
24
|
private loadDispatched;
|
|
25
|
+
private hasUAVisualTransition;
|
|
26
26
|
readonly parentScreen: ScreenBase | null;
|
|
27
27
|
private static rootRouterRef;
|
|
28
28
|
static readonly contextType: import("react").Context<{
|
package/build/RouterContext.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export declare const NestedRouterContext: import("react").Context<{
|
|
|
4
4
|
parentRouter: RouterBase;
|
|
5
5
|
parentScreen: ScreenBase;
|
|
6
6
|
} | null>;
|
|
7
|
-
export declare const RouterContext: import("react").Context<RouterBase<import("./RouterBase").RouterBaseProps<ScreenBase<import("./ScreenBase").ScreenBaseProps, import("./ScreenBase").ScreenBaseState, import(".").RoutePropBase<import("./ScreenBase").ScreenBaseConfig<import(".").RoutePropBase<{}, import(".").PlainObject<any>>, import("./NavigationBase").NavigationBase<import(".").RouterBaseEventMap>> | undefined, import(".").PlainObject<any>>>>, import("./RouterBase").RouterBaseState, import(".").RouterBaseEventMap>>;
|
|
7
|
+
export declare const RouterContext: import("react").Context<RouterBase<import("./RouterBase").RouterBaseProps<ScreenBase<import("./ScreenBase").ScreenBaseProps, import("./ScreenBase").ScreenBaseState<import("./ScreenBase").ScreenBaseConfig<import(".").RoutePropBase<{}, import(".").PlainObject<any>>, import("./NavigationBase").NavigationBase<import(".").RouterBaseEventMap>> | undefined, import(".").PlainObject>, import(".").RoutePropBase<import("./ScreenBase").ScreenBaseConfig<import(".").RoutePropBase<{}, import(".").PlainObject<any>>, import("./NavigationBase").NavigationBase<import(".").RouterBaseEventMap>> | undefined, import(".").PlainObject<any>>>>, import("./RouterBase").RouterBaseState, import(".").RouterBaseEventMap>>;
|
package/build/ScreenBase.d.ts
CHANGED
|
@@ -28,48 +28,50 @@ export interface ScreenBaseConfig<R extends RoutePropBase = RoutePropBase, N ext
|
|
|
28
28
|
onLoad?: (props: LifecycleProps<R, N>) => void | Promise<void>;
|
|
29
29
|
}
|
|
30
30
|
export interface ScreenBaseProps {
|
|
31
|
+
path: string;
|
|
31
32
|
component: React.JSXElementConstructor<any> | LazyExoticComponent<any>;
|
|
32
33
|
fallback?: React.ReactNode;
|
|
33
|
-
|
|
34
|
-
resolvedPathname?: string;
|
|
34
|
+
name?: string;
|
|
35
35
|
defaultParams?: PlainObject;
|
|
36
36
|
caseSensitive?: boolean;
|
|
37
|
-
id?: string;
|
|
38
37
|
config?: ScreenBaseConfig;
|
|
39
38
|
}
|
|
40
|
-
export interface ScreenBaseState {
|
|
39
|
+
export interface ScreenBaseState<C extends ScreenBaseProps["config"] = ScreenBaseProps["config"], P extends PlainObject = PlainObject> {
|
|
41
40
|
focused: boolean;
|
|
41
|
+
config: C;
|
|
42
|
+
params: P;
|
|
42
43
|
elementType: ElementType;
|
|
43
44
|
}
|
|
44
|
-
export declare abstract class ScreenBase<P extends ScreenBaseProps = ScreenBaseProps, S extends ScreenBaseState = ScreenBaseState
|
|
45
|
+
export declare abstract class ScreenBase<P extends ScreenBaseProps = ScreenBaseProps, S extends ScreenBaseState<P["config"]> = ScreenBaseState<P["config"]>, R extends RoutePropBase<P["config"]> = RoutePropBase<P["config"]>> extends Component<P, S> {
|
|
45
46
|
#private;
|
|
46
47
|
readonly sharedElementScene: SharedElementScene;
|
|
47
48
|
protected readonly ref: import("react").RefObject<HTMLDivElement>;
|
|
48
49
|
protected readonly nestedRouterData: {
|
|
49
50
|
parentScreen: ScreenBase;
|
|
50
|
-
parentRouter: import("./RouterBase").RouterBase<import("./RouterBase").RouterBaseProps<ScreenBase<ScreenBaseProps, ScreenBaseState, RoutePropBase<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase<import("./common/types").RouterBaseEventMap>> | undefined, PlainObject<any>>>>, import("./RouterBase").RouterBaseState, import("./common/types").RouterBaseEventMap>;
|
|
51
|
+
parentRouter: import("./RouterBase").RouterBase<import("./RouterBase").RouterBaseProps<ScreenBase<ScreenBaseProps, ScreenBaseState<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase<import("./common/types").RouterBaseEventMap>> | undefined, PlainObject>, RoutePropBase<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase<import("./common/types").RouterBaseEventMap>> | undefined, PlainObject<any>>>>, import("./RouterBase").RouterBaseState, import("./common/types").RouterBaseEventMap>;
|
|
51
52
|
};
|
|
52
|
-
static readonly contextType: import("react").Context<import("./RouterBase").RouterBase<import("./RouterBase").RouterBaseProps<ScreenBase<ScreenBaseProps, ScreenBaseState, RoutePropBase<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase<import("./common/types").RouterBaseEventMap>> | undefined, PlainObject<any>>>>, import("./RouterBase").RouterBaseState, import("./common/types").RouterBaseEventMap>>;
|
|
53
|
+
static readonly contextType: import("react").Context<import("./RouterBase").RouterBase<import("./RouterBase").RouterBaseProps<ScreenBase<ScreenBaseProps, ScreenBaseState<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase<import("./common/types").RouterBaseEventMap>> | undefined, PlainObject>, RoutePropBase<ScreenBaseConfig<RoutePropBase<{}, PlainObject<any>>, NavigationBase<import("./common/types").RouterBaseEventMap>> | undefined, PlainObject<any>>>>, import("./RouterBase").RouterBaseState, import("./common/types").RouterBaseEventMap>>;
|
|
53
54
|
context: React.ContextType<typeof RouterContext>;
|
|
54
55
|
state: S;
|
|
55
56
|
constructor(props: P, context: React.ContextType<typeof RouterContext>);
|
|
56
|
-
protected setParams(
|
|
57
|
-
protected setConfig(
|
|
58
|
-
get id(): string;
|
|
57
|
+
protected setParams(newParams: PlainObject): void;
|
|
58
|
+
protected setConfig(newConfig: R['config']): void;
|
|
59
59
|
get focused(): boolean;
|
|
60
|
+
get name(): any;
|
|
60
61
|
blur(): Promise<void>;
|
|
61
62
|
focus(): Promise<void>;
|
|
62
63
|
load(signal: AbortSignal): Promise<{
|
|
63
64
|
default: any;
|
|
64
65
|
}>;
|
|
65
|
-
abstract get routeProp(): R;
|
|
66
|
+
protected abstract get routeProp(): R;
|
|
66
67
|
abstract get config(): R["config"];
|
|
67
68
|
abstract get params(): R["params"];
|
|
69
|
+
abstract get resolvedPathname(): string;
|
|
70
|
+
abstract get id(): string;
|
|
68
71
|
onExited(signal: AbortSignal): Promise<void>;
|
|
69
72
|
onExit(signal: AbortSignal): Promise<void>;
|
|
70
73
|
onEnter(signal: AbortSignal): Promise<void>;
|
|
71
74
|
onEntered(signal: AbortSignal): Promise<void>;
|
|
72
|
-
get resolvedPathname(): P["resolvedPathname"] | undefined;
|
|
73
75
|
get path(): P["path"];
|
|
74
76
|
get transitionProvider(): import("react").RefObject<ScreenTransitionProvider>;
|
|
75
77
|
render(): JSX.Element;
|
|
@@ -7,6 +7,7 @@ import { ScreenBase } from './ScreenBase';
|
|
|
7
7
|
interface ScreenTransitionLayerProps {
|
|
8
8
|
children: ScreenChild | ScreenChild[];
|
|
9
9
|
navigation: NavigationBase;
|
|
10
|
+
hasUAVisualTransition: boolean;
|
|
10
11
|
}
|
|
11
12
|
interface ScreenTransitionLayerState {
|
|
12
13
|
gestureNavigating: boolean;
|
|
@@ -26,6 +27,7 @@ export declare class ScreenTransitionLayer extends Component<ScreenTransitionLay
|
|
|
26
27
|
set screens(screens: RefObject<ScreenBase>[]);
|
|
27
28
|
set direction(direction: PlaybackDirection);
|
|
28
29
|
get direction(): PlaybackDirection;
|
|
30
|
+
get hasUAVisualTransition(): boolean;
|
|
29
31
|
transition(): Animation;
|
|
30
32
|
render(): JSX.Element;
|
|
31
33
|
}
|
|
@@ -6,6 +6,7 @@ import { ParallelEffect } from 'web-animations-extension';
|
|
|
6
6
|
import { SharedElement } from './SharedElement';
|
|
7
7
|
interface SharedElementTransitionLayerProps {
|
|
8
8
|
navigation: NavigationBase;
|
|
9
|
+
direction: "forwards" | "backwards";
|
|
9
10
|
}
|
|
10
11
|
interface SharedElementTransitionLayerState {
|
|
11
12
|
}
|
|
@@ -18,7 +19,7 @@ export declare class SharedElementTransitionLayer extends Component<SharedElemen
|
|
|
18
19
|
get outgoingScreen(): RefObject<ScreenBase> | null;
|
|
19
20
|
get incomingScreen(): RefObject<ScreenBase> | null;
|
|
20
21
|
getKeyframeProperties(element: Element, styleList: StyleKeyList): Record<string, string>;
|
|
21
|
-
copyStyles(srcElement:
|
|
22
|
+
copyStyles(srcElement: Element | null | undefined, cloneElement: StylableElement, styleList: StyleKeyList): void;
|
|
22
23
|
getAnimationEffect<T extends {
|
|
23
24
|
instance: SharedElement;
|
|
24
25
|
clone: HTMLElement;
|
package/build/common/events.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LoadNavigationTransition } from "./types";
|
|
1
2
|
export declare class TransitionStartEvent extends Event {
|
|
2
3
|
constructor();
|
|
3
4
|
}
|
|
@@ -17,16 +18,13 @@ export declare class MotionProgressEvent extends Event {
|
|
|
17
18
|
export declare class MotionProgressEndEvent extends Event {
|
|
18
19
|
constructor();
|
|
19
20
|
}
|
|
20
|
-
export declare class LoadEvent extends Event implements Omit<NavigateEvent, 'navigationType'> {
|
|
21
|
+
export declare class LoadEvent extends Event implements Omit<NavigateEvent, 'navigationType' | 'commit'> {
|
|
21
22
|
#private;
|
|
23
|
+
readonly hasUAVisualTransition = false;
|
|
22
24
|
constructor();
|
|
23
25
|
intercept(options?: NavigationInterceptOptions | undefined): void;
|
|
24
26
|
scroll(): void;
|
|
25
|
-
get transition():
|
|
26
|
-
from: NavigationHistoryEntry | null;
|
|
27
|
-
finished: Promise<void>;
|
|
28
|
-
navigationType: "load";
|
|
29
|
-
} | null;
|
|
27
|
+
get transition(): LoadNavigationTransition | null;
|
|
30
28
|
get navigationType(): "load";
|
|
31
29
|
get userInitiated(): boolean;
|
|
32
30
|
get canIntercept(): boolean;
|
package/build/common/types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export interface AnimationEffectFactoryProps<R extends HTMLElement = HTMLElement
|
|
|
10
10
|
timeline: AnimationTimeline | null;
|
|
11
11
|
playbackRate: number;
|
|
12
12
|
direction: PlaybackDirection;
|
|
13
|
+
hasUAVisualTransition: boolean;
|
|
13
14
|
}
|
|
14
15
|
export type AnimationEffectFactory<R extends HTMLElement = HTMLElement> = (props: AnimationEffectFactoryProps<R>) => AnimationEffect;
|
|
15
16
|
export type MetaTypeKey = 'http-equiv' | 'name' | 'itemprop' | 'property' | 'charset';
|
|
@@ -79,4 +80,18 @@ export type StylableElement = Element & {
|
|
|
79
80
|
style: CSSStyleDeclaration;
|
|
80
81
|
};
|
|
81
82
|
export declare function isStylableElement(element: any): element is StylableElement;
|
|
83
|
+
export interface ScreenBaseFocusOptions {
|
|
84
|
+
signal?: AbortSignal;
|
|
85
|
+
}
|
|
86
|
+
export interface LoadNavigationTransition extends Omit<NavigationTransition, "navigationType"> {
|
|
87
|
+
navigationType: "load";
|
|
88
|
+
}
|
|
89
|
+
declare global {
|
|
90
|
+
interface NavigateEvent extends Event {
|
|
91
|
+
commit?(): void;
|
|
92
|
+
readonly hasUAVisualTransition: boolean;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export type ElementPropType<C> = C extends React.CElement<infer P, infer T> ? P & React.ClassAttributes<T> : never;
|
|
96
|
+
export type ClonedElementType<C, IP extends Partial<ElementPropType<C>>> = C extends React.CElement<infer P, infer T> ? React.CElement<P & Partial<IP>, T & React.Component<P & IP>> : never;
|
|
82
97
|
export {};
|
package/build/common/utils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LazyExoticComponent, MatchedRoute, PathPattern } from "./types";
|
|
1
|
+
import { ClonedElementType, ElementPropType, LazyExoticComponent, MatchedRoute, PathPattern } from "./types";
|
|
2
2
|
export declare function resolveBaseURLFromPattern(pattern: string, pathname: string): URL | null;
|
|
3
3
|
export declare function matchRoute(pathnamePattern: string, pathname: string, baseURLPattern?: string, caseSensitive?: boolean): MatchedRoute | null;
|
|
4
4
|
export declare function includesRoute(pathnamePatterns: PathPattern[], pathname: string, baseURL?: string): boolean;
|
|
@@ -12,3 +12,4 @@ export declare function polyfillURLPattern(): Promise<void>;
|
|
|
12
12
|
export declare function polyfillNavigation(): Promise<void>;
|
|
13
13
|
export declare function PromiseAllDynamic<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]>;
|
|
14
14
|
export declare function toCamelCase(value: string): string;
|
|
15
|
+
export declare function cloneAndInject<C extends React.CElement<any, any>, IP extends Partial<ElementPropType<C>>>(element: C, injectProps: IP): ClonedElementType<C, IP>;
|
package/build/common/utils.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as __WEBPACK_EXTERNAL_MODULE_react__ from "react";
|
|
|
6
6
|
|
|
7
7
|
var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }
|
|
8
8
|
var y = x => () => x
|
|
9
|
-
module.exports = x({ ["lazy"]: () => __WEBPACK_EXTERNAL_MODULE_react__.lazy });
|
|
9
|
+
module.exports = x({ ["cloneElement"]: () => __WEBPACK_EXTERNAL_MODULE_react__.cloneElement, ["lazy"]: () => __WEBPACK_EXTERNAL_MODULE_react__.lazy });
|
|
10
10
|
|
|
11
11
|
/***/ })
|
|
12
12
|
|
|
@@ -69,6 +69,7 @@ var __webpack_exports__ = {};
|
|
|
69
69
|
/* harmony export */ "gy": () => (/* binding */ polyfillURLPattern),
|
|
70
70
|
/* harmony export */ "n4": () => (/* binding */ resolveBaseURLFromPattern),
|
|
71
71
|
/* harmony export */ "vi": () => (/* binding */ isNavigationSupported),
|
|
72
|
+
/* harmony export */ "yb": () => (/* binding */ cloneAndInject),
|
|
72
73
|
/* harmony export */ "zW": () => (/* binding */ toCamelCase)
|
|
73
74
|
/* harmony export */ });
|
|
74
75
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(810);
|
|
@@ -149,10 +150,14 @@ async function PromiseAllDynamic(values) {
|
|
|
149
150
|
function toCamelCase(value) {
|
|
150
151
|
return value.replace(/-([a-z])/g, (g) => g[1].toUpperCase());
|
|
151
152
|
}
|
|
153
|
+
function cloneAndInject(element, injectProps) {
|
|
154
|
+
return (0,react__WEBPACK_IMPORTED_MODULE_0__.cloneElement)(element, injectProps);
|
|
155
|
+
}
|
|
152
156
|
|
|
153
157
|
})();
|
|
154
158
|
|
|
155
159
|
var __webpack_exports__PromiseAllDynamic = __webpack_exports__.DM;
|
|
160
|
+
var __webpack_exports__cloneAndInject = __webpack_exports__.yb;
|
|
156
161
|
var __webpack_exports__dispatchEvent = __webpack_exports__.Nu;
|
|
157
162
|
var __webpack_exports__includesRoute = __webpack_exports__.e1;
|
|
158
163
|
var __webpack_exports__isNavigationSupported = __webpack_exports__.vi;
|
|
@@ -163,6 +168,6 @@ var __webpack_exports__polyfillNavigation = __webpack_exports__.Sy;
|
|
|
163
168
|
var __webpack_exports__polyfillURLPattern = __webpack_exports__.gy;
|
|
164
169
|
var __webpack_exports__resolveBaseURLFromPattern = __webpack_exports__.n4;
|
|
165
170
|
var __webpack_exports__toCamelCase = __webpack_exports__.zW;
|
|
166
|
-
export { __webpack_exports__PromiseAllDynamic as PromiseAllDynamic, __webpack_exports__dispatchEvent as dispatchEvent, __webpack_exports__includesRoute as includesRoute, __webpack_exports__isNavigationSupported as isNavigationSupported, __webpack_exports__isURLPatternSupported as isURLPatternSupported, __webpack_exports__lazy as lazy, __webpack_exports__matchRoute as matchRoute, __webpack_exports__polyfillNavigation as polyfillNavigation, __webpack_exports__polyfillURLPattern as polyfillURLPattern, __webpack_exports__resolveBaseURLFromPattern as resolveBaseURLFromPattern, __webpack_exports__toCamelCase as toCamelCase };
|
|
171
|
+
export { __webpack_exports__PromiseAllDynamic as PromiseAllDynamic, __webpack_exports__cloneAndInject as cloneAndInject, __webpack_exports__dispatchEvent as dispatchEvent, __webpack_exports__includesRoute as includesRoute, __webpack_exports__isNavigationSupported as isNavigationSupported, __webpack_exports__isURLPatternSupported as isURLPatternSupported, __webpack_exports__lazy as lazy, __webpack_exports__matchRoute as matchRoute, __webpack_exports__polyfillNavigation as polyfillNavigation, __webpack_exports__polyfillURLPattern as polyfillURLPattern, __webpack_exports__resolveBaseURLFromPattern as resolveBaseURLFromPattern, __webpack_exports__toCamelCase as toCamelCase };
|
|
167
172
|
|
|
168
173
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common/utils.js","mappings":";;;;;;AAAA,eAAe,YAAY,6BAA6B;AACxD;AACA,qBAAqB,
|
|
1
|
+
{"version":3,"file":"common/utils.js","mappings":";;;;;;AAAA,eAAe,Y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AAM,CAAC,UAAU,CAAC,CAAC;AACtC,CAAC;AAEM,SAAS,qBAAqB;IACjC,oDAAoD;IACpD,OAAO,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;AAC1C,CAAC;AAEM,KAAK,UAAU,kBAAkB;IACpC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,qBAAqB,CAAC,CAAC;IACnF,oDAAoD;IACpD,UAAU,CAAC,UAAU,GAAG,UAAU,CAAC;AACvC,CAAC;AAEM,KAAK,UAAU,kBAAkB;IACpC,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,0BAA0B,CAAC,CAAC;IAC3F,aAAa,CAAC;QACV,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,IAAI;QACrB,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,IAAI;QACb,YAAY,EAAE,IAAI;KACrB,CAAC,CAAC;AACP,CAAC;AAEM,KAAK,UAAU,iBAAiB,CAAI,MAAoC;IAC3E,MAAM,OAAO,GAAG,EAAE,CAAC;IACnB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC;AAEM,SAAS,WAAW,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAChE,CAAC;AAEM,SAAS,cAAc,CAG5B,OAAU,EAAE,WAAe;IACzB,OAAO,mDAAY,CAAC,OAAO,EAAE,WAAW,CAA6B,CAAC;AAC1E,CAAC","sources":["webpack://@react-motion-router/core/external module \"react\"","webpack://@react-motion-router/core/webpack/bootstrap","webpack://@react-motion-router/core/webpack/runtime/define property getters","webpack://@react-motion-router/core/webpack/runtime/hasOwnProperty shorthand","webpack://@react-motion-router/core/./src/common/utils.ts"],"sourcesContent":["var x = y => { var x = {}; __webpack_require__.d(x, y); return x; }\nvar y = x => () => x\nmodule.exports = x({ [\"cloneElement\"]: () => __WEBPACK_EXTERNAL_MODULE_react__.cloneElement, [\"lazy\"]: () => __WEBPACK_EXTERNAL_MODULE_react__.lazy });","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","import { cloneElement, lazy as ReactLazy } from \"react\";\nimport { ClonedElementType, ElementPropType, LazyExoticComponent, MatchedRoute, PathPattern } from \"./types\";\n\nexport function resolveBaseURLFromPattern(pattern: string, pathname: string) {\n if (!pattern.endsWith(\"**\")) pattern += '**'; // allows us to match nested routes\n const origin = window.location.origin;\n const baseURLMatch = new URLPattern(pattern, origin).exec(pathname, origin);\n if (!baseURLMatch) return null;\n\n const nestedPathnameGroup = baseURLMatch.pathname.groups[1] ?? '';\n // derive concrete baseURL\n return new URL(pathname.replace(nestedPathnameGroup, ''), window.location.origin);\n}\n\nexport function matchRoute(\n pathnamePattern: string,\n pathname: string,\n baseURLPattern: string = `${window.location.origin}/`,\n caseSensitive: boolean = true\n): MatchedRoute | null {\n if (!caseSensitive) {\n pathnamePattern = pathnamePattern.toLowerCase();\n pathname = pathname.toLowerCase();\n }\n\n const baseURL = resolveBaseURLFromPattern(baseURLPattern, pathname)?.href;\n if (!baseURL) return null;\n\n const match = new URLPattern({ baseURL, pathname: pathnamePattern }).exec({ pathname, baseURL });\n const params = match?.pathname.groups ?? {};\n if (match) {\n return {\n params\n };\n }\n return null;\n}\n\nexport function includesRoute(pathnamePatterns: PathPattern[], pathname: string, baseURL: string = window.location.origin) {\n return pathnamePatterns.some(({ pattern, caseSensitive }) => matchRoute(pattern, pathname, baseURL, caseSensitive));\n}\n\nexport function dispatchEvent<T>(event: CustomEvent<T> | Event, target: HTMLElement | EventTarget = window) {\n return new Promise<boolean>((resolve) => {\n queueMicrotask(() => resolve(\n target.dispatchEvent(event)\n ));\n });\n}\n\nexport function lazy<T extends React.ComponentType<any>>(\n factory: () => Promise<{ default: T }>\n): LazyExoticComponent<T> {\n const Component = ReactLazy(factory) as LazyExoticComponent<T>;\n Component.load = async () => {\n Component.module ??= await factory();\n return Component.module;\n };\n return Component;\n}\n\nexport function isNavigationSupported() {\n return Boolean(window.navigation);\n}\n\nexport function isURLPatternSupported() {\n // @ts-ignore: Property 'UrlPattern' does not exist \n return Boolean(globalThis.URLPattern);\n}\n\nexport async function polyfillURLPattern() {\n const { URLPattern } = await import(/*webpackIgnore: true*/ \"urlpattern-polyfill\");\n // @ts-ignore: Property 'UrlPattern' does not exist \n globalThis.URLPattern = URLPattern;\n}\n\nexport async function polyfillNavigation() {\n const { applyPolyfill } = await import(/*webpackIgnore: true*/ \"@virtualstate/navigation\");\n applyPolyfill({\n history: true,\n interceptEvents: true,\n patch: true,\n persist: true,\n persistState: true\n });\n}\n\nexport async function PromiseAllDynamic<T>(values: Iterable<T | PromiseLike<T>>): Promise<Awaited<T>[]> {\n const awaited = [];\n for (const value of values) {\n awaited.push(await value);\n }\n\n return awaited;\n}\n\nexport function toCamelCase(value: string) {\n return value.replace(/-([a-z])/g, (g) => g[1].toUpperCase())\n}\n\nexport function cloneAndInject<\n C extends React.CElement<any, any>,\n IP extends Partial<ElementPropType<C>>\n>(element: C, injectProps: IP) {\n return cloneElement(element, injectProps) as ClonedElementType<C, IP>;\n}"],"names":[],"sourceRoot":""}
|