@flemo/core 1.3.0 → 1.5.0
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/core/engine/__tests__/barRiding.test.d.ts +1 -0
- package/dist/core/engine/__tests__/createSwipeController.test.d.ts +1 -0
- package/dist/core/engine/__tests__/createTransitionEngine.test.d.ts +1 -0
- package/dist/core/engine/barRiding.d.ts +18 -0
- package/dist/core/engine/createSwipeController.d.ts +32 -0
- package/dist/core/engine/createTransitionEngine.d.ts +2 -0
- package/dist/core/engine/types.d.ts +22 -0
- package/dist/history/__tests__/createHistorySync.test.d.ts +1 -0
- package/dist/history/__tests__/seedInitialHistory.test.d.ts +1 -0
- package/dist/history/createHistorySync.d.ts +9 -0
- package/dist/history/ensureWindowHistoryState.d.ts +2 -0
- package/dist/history/seedInitialHistory.d.ts +4 -0
- package/dist/history/store.d.ts +4 -3
- package/dist/index.d.ts +21 -3
- package/dist/index.mjs +1442 -1046
- package/dist/navigate/__tests__/createNavigationController.test.d.ts +1 -0
- package/dist/navigate/createNavigationController.d.ts +31 -0
- package/dist/navigate/store.d.ts +4 -3
- package/dist/screen/__tests__/computeScreenFreeze.test.d.ts +1 -0
- package/dist/screen/__tests__/createScreenSelector.test.d.ts +1 -0
- package/dist/screen/__tests__/store.test.d.ts +1 -0
- package/dist/screen/computeScreenFreeze.d.ts +11 -0
- package/dist/screen/createScreenSelector.d.ts +10 -0
- package/dist/screen/store.d.ts +16 -0
- package/dist/transition/__tests__/animateInline.test.d.ts +1 -0
- package/dist/transition/__tests__/applyTransitionStyles.test.d.ts +1 -0
- package/dist/transition/__tests__/compileTransitionStyles.test.d.ts +5 -0
- package/dist/transition/animateInline.d.ts +4 -0
- package/dist/transition/applyTransitionStyles.d.ts +1 -0
- package/dist/transition/compileTransitionStyles.d.ts +3 -2
- package/dist/transition/partTransition/__tests__/createPartTransition.test.d.ts +1 -0
- package/dist/transition/partTransition/__tests__/createRawPartTransition.test.d.ts +1 -0
- package/dist/transition/partTransition/createPartTransition.d.ts +13 -0
- package/dist/transition/partTransition/createRawPartTransition.d.ts +19 -0
- package/dist/transition/partTransition/partTransition.d.ts +2 -0
- package/dist/transition/partTransition/typing.d.ts +24 -0
- package/dist/transition/store.d.ts +4 -3
- package/dist/utils/findScrollable.d.ts +1 -1
- package/package.json +11 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { HistoryStoreApi } from '../history/store';
|
|
2
|
+
import { NavigateStoreApi } from './store';
|
|
3
|
+
import { TransitionStoreApi } from '../transition/store';
|
|
4
|
+
import { TransitionName } from '../transition/typing';
|
|
5
|
+
export interface DistanceOptions {
|
|
6
|
+
skip?: number;
|
|
7
|
+
until?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface NavigateOptions extends DistanceOptions {
|
|
10
|
+
layoutId?: string | number;
|
|
11
|
+
transitionName?: TransitionName;
|
|
12
|
+
}
|
|
13
|
+
export interface PopOptions extends DistanceOptions {
|
|
14
|
+
transitionName?: TransitionName;
|
|
15
|
+
}
|
|
16
|
+
export interface NavigationControllerDeps {
|
|
17
|
+
stores: {
|
|
18
|
+
history: HistoryStoreApi;
|
|
19
|
+
navigate: NavigateStoreApi;
|
|
20
|
+
transition: TransitionStoreApi;
|
|
21
|
+
};
|
|
22
|
+
buildPathname: (path: string, params: object) => {
|
|
23
|
+
pathname: string;
|
|
24
|
+
toPathname: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export default function createNavigationController(deps: NavigationControllerDeps): {
|
|
28
|
+
push: (path: string, params?: object, options?: NavigateOptions) => Promise<void>;
|
|
29
|
+
replace: (path: string, params?: object, options?: NavigateOptions) => Promise<void>;
|
|
30
|
+
pop: (options?: PopOptions) => Promise<void>;
|
|
31
|
+
};
|
package/dist/navigate/store.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { StoreApi } from 'zustand/vanilla';
|
|
1
2
|
export type NavigateStatus = "IDLE" | "PUSHING" | "REPLACING" | "POPPING" | "COMPLETED";
|
|
2
|
-
interface NavigateStore {
|
|
3
|
+
export interface NavigateStore {
|
|
3
4
|
status: NavigateStatus;
|
|
4
5
|
transitionTaskId: string | null;
|
|
5
6
|
setStatus: (status: NavigateStatus) => void;
|
|
6
7
|
setTransitionTaskId: (transitionTaskId: string | null) => void;
|
|
7
8
|
}
|
|
8
|
-
|
|
9
|
-
export default
|
|
9
|
+
export type NavigateStoreApi = StoreApi<NavigateStore>;
|
|
10
|
+
export default function createNavigateStore(): NavigateStoreApi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NavigateStatus } from '../navigate/store';
|
|
2
|
+
export interface ScreenFreezeInput {
|
|
3
|
+
isActive: boolean;
|
|
4
|
+
isPrev: boolean;
|
|
5
|
+
zIndex: number;
|
|
6
|
+
index: number;
|
|
7
|
+
status: NavigateStatus;
|
|
8
|
+
dragStatus: "IDLE" | "PENDING";
|
|
9
|
+
replaceTransitionStatus: "IDLE" | "PENDING";
|
|
10
|
+
}
|
|
11
|
+
export default function computeScreenFreeze(input: ScreenFreezeInput): boolean;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { History } from '../history/store';
|
|
2
|
+
import { TransitionName } from '../transition/typing';
|
|
3
|
+
export interface ScreenSelection extends History {
|
|
4
|
+
isActive: boolean;
|
|
5
|
+
isRoot: boolean;
|
|
6
|
+
isPrev: boolean;
|
|
7
|
+
zIndex: number;
|
|
8
|
+
prevTransitionName: TransitionName;
|
|
9
|
+
}
|
|
10
|
+
export default function createScreenSelector(histories: History[], index: number): ScreenSelection[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StoreApi } from 'zustand/vanilla';
|
|
2
|
+
export interface SharedBarPresence {
|
|
3
|
+
appBar: boolean;
|
|
4
|
+
navigationBar: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface ScreenStore {
|
|
7
|
+
dragStatus: "IDLE" | "PENDING";
|
|
8
|
+
replaceTransitionStatus: "IDLE" | "PENDING";
|
|
9
|
+
sharedBars: Record<string, SharedBarPresence>;
|
|
10
|
+
setDragStatus: (dragStatus: "IDLE" | "PENDING") => void;
|
|
11
|
+
setReplaceTransitionStatus: (replaceTransitionStatus: "IDLE" | "PENDING") => void;
|
|
12
|
+
registerSharedBars: (id: string, presence: SharedBarPresence) => void;
|
|
13
|
+
unregisterSharedBars: (id: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export type ScreenStoreApi = StoreApi<ScreenStore>;
|
|
16
|
+
export default function createScreenStore(): ScreenStoreApi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function applyTransitionStyles(): void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AnimationOptions, InitialTarget } from './cssTypes';
|
|
2
2
|
import { Transition, TransitionVariant, TransitionVariantValue } from './typing';
|
|
3
3
|
import { Decorator } from './decorator/typing';
|
|
4
|
+
import { PartTransition } from './partTransition/typing';
|
|
4
5
|
export type CssDecl = {
|
|
5
6
|
property: string;
|
|
6
7
|
value: string;
|
|
@@ -8,6 +9,6 @@ export type CssDecl = {
|
|
|
8
9
|
export declare const collectAnimatedProperties: (transition: Transition) => string[];
|
|
9
10
|
export declare const targetToDecls: (target: TransitionVariantValue["value"] | InitialTarget) => CssDecl[];
|
|
10
11
|
export declare const easingToCss: (ease: AnimationOptions["ease"] | undefined) => string;
|
|
11
|
-
export declare const animationName: (scope: "screen" | "decorator", name: string, variant: TransitionVariant) => string;
|
|
12
|
-
export declare const compileTransitionStyles: (transitions: Iterable<Transition>, decorators: Iterable<Decorator>) => string;
|
|
12
|
+
export declare const animationName: (scope: "screen" | "decorator" | "part", name: string, variant: TransitionVariant) => string;
|
|
13
|
+
export declare const compileTransitionStyles: (transitions: Iterable<Transition>, decorators: Iterable<Decorator>, partTransitions?: Iterable<PartTransition>) => string;
|
|
13
14
|
export declare const variantHasAnimation: (transitionLike: Pick<Transition, "initial" | "variants">, variant: TransitionVariant) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { InitialTarget } from '../cssTypes';
|
|
2
|
+
import { TransitionVariantValue } from '../typing';
|
|
3
|
+
import { PartTransition, PartTransitionName, PartTransitionOptions } from './typing';
|
|
4
|
+
interface CreatePartProps {
|
|
5
|
+
name: PartTransitionName;
|
|
6
|
+
initial: InitialTarget;
|
|
7
|
+
idle: TransitionVariantValue;
|
|
8
|
+
enter: TransitionVariantValue;
|
|
9
|
+
exit: TransitionVariantValue;
|
|
10
|
+
options?: PartTransitionOptions;
|
|
11
|
+
}
|
|
12
|
+
export default function createPartTransition({ name, initial, idle, enter, exit, options }: CreatePartProps): PartTransition;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InitialTarget } from '../cssTypes';
|
|
2
|
+
import { TransitionVariantValue } from '../typing';
|
|
3
|
+
import { PartTransition, PartTransitionName, PartTransitionOptions } from './typing';
|
|
4
|
+
interface CreateRawPartProps {
|
|
5
|
+
name: PartTransitionName;
|
|
6
|
+
initial: InitialTarget;
|
|
7
|
+
idle: TransitionVariantValue;
|
|
8
|
+
pushOnEnter: TransitionVariantValue;
|
|
9
|
+
pushOnExit: TransitionVariantValue;
|
|
10
|
+
replaceOnEnter: TransitionVariantValue;
|
|
11
|
+
replaceOnExit: TransitionVariantValue;
|
|
12
|
+
popOnEnter: TransitionVariantValue;
|
|
13
|
+
popOnExit: TransitionVariantValue;
|
|
14
|
+
completedOnEnter: TransitionVariantValue;
|
|
15
|
+
completedOnExit: TransitionVariantValue;
|
|
16
|
+
options?: PartTransitionOptions;
|
|
17
|
+
}
|
|
18
|
+
export default function createRawPartTransition({ name, initial, idle, pushOnEnter, pushOnExit, replaceOnEnter, replaceOnExit, popOnEnter, popOnExit, completedOnEnter, completedOnExit, options }: CreateRawPartProps): PartTransition;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { BaseTransition, SwipeAnimate } from '../typing';
|
|
2
|
+
export interface RegisterPartTransition {
|
|
3
|
+
}
|
|
4
|
+
export type PartTransitionName = RegisterPartTransition[keyof RegisterPartTransition] | (string & {});
|
|
5
|
+
export type PartTransitionOptions = {
|
|
6
|
+
onSwipeStart?: (triggered: boolean, options: {
|
|
7
|
+
animate: SwipeAnimate;
|
|
8
|
+
element: HTMLElement;
|
|
9
|
+
active: boolean;
|
|
10
|
+
}) => void;
|
|
11
|
+
onSwipe?: (triggered: boolean, progress: number, options: {
|
|
12
|
+
animate: SwipeAnimate;
|
|
13
|
+
element: HTMLElement;
|
|
14
|
+
active: boolean;
|
|
15
|
+
}) => void;
|
|
16
|
+
onSwipeEnd?: (triggered: boolean, options: {
|
|
17
|
+
animate: SwipeAnimate;
|
|
18
|
+
element: HTMLElement;
|
|
19
|
+
active: boolean;
|
|
20
|
+
}) => void;
|
|
21
|
+
};
|
|
22
|
+
export interface PartTransition extends Omit<BaseTransition, "name">, PartTransitionOptions {
|
|
23
|
+
name: PartTransitionName;
|
|
24
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { StoreApi } from 'zustand/vanilla';
|
|
1
2
|
import { TransitionName } from './typing';
|
|
2
|
-
interface TransitionStore {
|
|
3
|
+
export interface TransitionStore {
|
|
3
4
|
defaultTransitionName: TransitionName;
|
|
4
5
|
setDefaultTransitionName: (defaultTransitionName: TransitionName) => void;
|
|
5
6
|
}
|
|
6
|
-
|
|
7
|
-
export default
|
|
7
|
+
export type TransitionStoreApi = StoreApi<TransitionStore>;
|
|
8
|
+
export default function createTransitionStore(defaultTransitionName?: TransitionName): TransitionStoreApi;
|
|
@@ -12,7 +12,7 @@ export declare function overflowsAxis(element: HTMLElement, direction: "y" | "x"
|
|
|
12
12
|
/**
|
|
13
13
|
* Whether the element actually scrolls on the given axis.
|
|
14
14
|
*
|
|
15
|
-
* Reads `overflowX` / `overflowY` from computed style
|
|
15
|
+
* Reads `overflowX` / `overflowY` from computed style: fast, read-only,
|
|
16
16
|
* and free of side effects. The previous implementation probed by writing
|
|
17
17
|
* to `scrollTop` / `scrollLeft` and reverting, which fired scroll events
|
|
18
18
|
* and interfered with `scroll-snap` / `scroll-behavior: smooth` consumers
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flemo/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Framework-agnostic primitives for flemo: history, navigation, transitions, task manager.",
|
|
5
5
|
"main": "./dist/index.mjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -32,19 +32,19 @@
|
|
|
32
32
|
"homepage": "https://flemo.dev",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"path-to-regexp": "^8.2
|
|
36
|
-
"zustand": "^5.0.
|
|
35
|
+
"path-to-regexp": "^8.4.2",
|
|
36
|
+
"zustand": "^5.0.14"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^24.
|
|
40
|
-
"@vitest/coverage-v8": "^
|
|
39
|
+
"@types/node": "^24.13.1",
|
|
40
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
41
41
|
"csstype": "^3.2.3",
|
|
42
|
-
"eslint": "^9.
|
|
43
|
-
"jsdom": "^
|
|
44
|
-
"typescript": "^
|
|
45
|
-
"vite": "^
|
|
46
|
-
"vite-plugin-dts": "^
|
|
47
|
-
"vitest": "^
|
|
42
|
+
"eslint": "^9.39.4",
|
|
43
|
+
"jsdom": "^29.1.1",
|
|
44
|
+
"typescript": "^6.0.3",
|
|
45
|
+
"vite": "^8.0.16",
|
|
46
|
+
"vite-plugin-dts": "^5.0.2",
|
|
47
|
+
"vitest": "^4.1.9",
|
|
48
48
|
"@flemo/eslint-config": "0.0.0",
|
|
49
49
|
"@flemo/tsconfig": "0.0.0"
|
|
50
50
|
},
|