@flemo/core 1.9.0 → 1.10.1
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/history/store.d.ts +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +222 -155
- package/dist/screen/__tests__/screenSurfaces.test.d.ts +1 -0
- package/dist/screen/animStartAnchor.d.ts +7 -1
- package/dist/screen/store.d.ts +6 -0
- package/dist/utils/__tests__/isOpaqueColor.test.d.ts +1 -0
- package/dist/utils/isOpaqueColor.d.ts +1 -0
- package/package.json +1 -1
package/dist/history/store.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export interface HistoryStore {
|
|
|
16
16
|
popHistory: (index: number) => void;
|
|
17
17
|
popHistories: (count: number) => void;
|
|
18
18
|
setPendingIndex: (index: number) => void;
|
|
19
|
+
adoptHistory: (history: History) => void;
|
|
19
20
|
setTransitionName: (index: number, transitionName: TransitionName) => void;
|
|
20
21
|
}
|
|
21
22
|
export type HistoryStoreApi = StoreApi<HistoryStore>;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { markSelfInducedPop, consumeSelfInducedPop, createSelfPopGuard, type Sel
|
|
|
10
10
|
export { default as createNavigationController, type NavigationControllerDeps, type DistanceOptions, type NavigateOptions, type PopOptions } from './navigate/createNavigationController';
|
|
11
11
|
export { default as createStepController, readStepParams, appendParamsQuery, subscribeStepParamsRestore, type StepControllerDeps } from './navigate/createStepController';
|
|
12
12
|
export { default as createRouterScope, type FlemoStores, type CreateRouterScopeInput } from './core/createRouterScope';
|
|
13
|
-
export { default as createScreenStore, type ScreenStore, type ScreenStoreApi, type SharedBarPresence } from './screen/store';
|
|
13
|
+
export { default as createScreenStore, type ScreenStore, type ScreenStoreApi, type SharedBarPresence, type ScreenSurface } from './screen/store';
|
|
14
14
|
export { default as createScreenSelector, type ScreenSelection } from './screen/createScreenSelector';
|
|
15
15
|
export { default as computeScreenFreeze, type ScreenFreezeInput } from './screen/computeScreenFreeze';
|
|
16
16
|
export { default as createTransition } from './transition/createTransition';
|
|
@@ -39,7 +39,7 @@ export { SKIP_ANIMATION_ATTR, type TransitionEngine, type TransitionEngineDeps,
|
|
|
39
39
|
export { default as createSwipeController } from './core/engine/createSwipeController';
|
|
40
40
|
export { type SwipeController, type SwipeControllerConfig, type SwipeControllerElements, type SharedBarPresenceLike } from './core/engine/createSwipeController';
|
|
41
41
|
export { default as computeBarRiding, type BarRidingInput } from './screen/computeBarRiding';
|
|
42
|
-
export { animHoldKey, scheduleAnimHoldRelease, ANIM_HOLD_RELEASE_BACKSTOP_MS, type AnimHoldInput } from './screen/animStartAnchor';
|
|
42
|
+
export { animHoldKey, scheduleAnimHoldRelease, eagerlyDecodeImages, ANIM_HOLD_RELEASE_BACKSTOP_MS, type AnimHoldInput } from './screen/animStartAnchor';
|
|
43
43
|
export { default as observeBarHeight } from './screen/observeBarHeight';
|
|
44
44
|
export { default as observeViewportScrollHeight } from './screen/observeViewportScrollHeight';
|
|
45
45
|
export type { RegisterTransition, TransitionName, TransitionVariant, TransitionVariantValue, TransitionOptions, BaseTransition, Transition, SwipeInfo, SwipeAnimate } from './transition/typing';
|
|
@@ -49,5 +49,6 @@ export { default as isServer } from './utils/isServer';
|
|
|
49
49
|
export { default as getParams } from './utils/getParams';
|
|
50
50
|
export { default as getMatchedPathPattern } from './utils/getMatchedPathPattern';
|
|
51
51
|
export { default as matchesPathname } from './utils/matchesPathname';
|
|
52
|
+
export { default as isOpaqueColor } from './utils/isOpaqueColor';
|
|
52
53
|
export { default as buildRoutePath } from './utils/buildRoutePath';
|
|
53
54
|
export { default as findScrollable, overflowsAxis, canProgrammaticallyScroll } from './utils/findScrollable';
|
package/dist/index.mjs
CHANGED
|
@@ -206,6 +206,7 @@ function o(t = [], n = -1) {
|
|
|
206
206
|
});
|
|
207
207
|
},
|
|
208
208
|
setPendingIndex: (t) => e({ pendingIndex: t }),
|
|
209
|
+
adoptHistory: (t) => e((e) => ({ histories: e.histories.slice(0, e.index).concat(t) })),
|
|
209
210
|
setTransitionName: (t, n) => e((e) => {
|
|
210
211
|
let r = e.histories[t];
|
|
211
212
|
if (!r || r.transitionName === n) return {};
|
|
@@ -330,20 +331,30 @@ function _() {
|
|
|
330
331
|
//#endregion
|
|
331
332
|
//#region src/history/createHistorySync.ts
|
|
332
333
|
function v(e) {
|
|
333
|
-
let { stores: t, driver: n = p(), consume: r = _ } = e
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
let n = e.state, i = a.generateTaskId();
|
|
334
|
+
let { stores: t, driver: n = p(), consume: r = _ } = e, i = !1, o = n.subscribe(async (e) => {
|
|
335
|
+
if (i || r()) return;
|
|
336
|
+
let n = e.state, o = a.generateTaskId();
|
|
337
337
|
(await a.addTask(async (r) => {
|
|
338
|
-
|
|
339
|
-
if (!f && !p && !m) {
|
|
338
|
+
if (i) {
|
|
340
339
|
r.abort();
|
|
341
340
|
return;
|
|
342
341
|
}
|
|
343
|
-
|
|
342
|
+
let { setStatus: a, setTransitionTaskId: s } = t.navigate.getState(), { index: c, addHistory: l, popHistory: u, setPendingIndex: d } = t.history.getState(), f = n?.index, p = f !== void 0 && f < c, m = n?.status === "PUSHING" && f !== void 0 && f > c, h = n?.status === "REPLACING" && f !== void 0 && f > c;
|
|
343
|
+
if (!p && !m && !h) {
|
|
344
|
+
let i = t.history.getState().histories[c];
|
|
345
|
+
n?.id && i && n.id !== i.id && t.history.getState().adoptHistory({
|
|
346
|
+
id: n.id,
|
|
347
|
+
pathname: e.pathname,
|
|
348
|
+
params: n.params,
|
|
349
|
+
transitionName: n.transitionName,
|
|
350
|
+
layoutId: n.layoutId
|
|
351
|
+
}), r.abort();
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
if (s(o), p) d(f), a("POPPING");
|
|
344
355
|
else {
|
|
345
356
|
let t = n;
|
|
346
|
-
a(
|
|
357
|
+
a(m ? "PUSHING" : "REPLACING"), l({
|
|
347
358
|
id: t.id,
|
|
348
359
|
pathname: e.pathname,
|
|
349
360
|
params: t.params,
|
|
@@ -352,13 +363,16 @@ function v(e) {
|
|
|
352
363
|
});
|
|
353
364
|
}
|
|
354
365
|
return async () => {
|
|
355
|
-
|
|
366
|
+
p && f !== void 0 && u(f + 1), a("COMPLETED");
|
|
356
367
|
};
|
|
357
368
|
}, {
|
|
358
|
-
id:
|
|
369
|
+
id: o,
|
|
359
370
|
control: { manual: !0 }
|
|
360
371
|
})).result?.();
|
|
361
372
|
});
|
|
373
|
+
return () => {
|
|
374
|
+
i = !0, o();
|
|
375
|
+
};
|
|
362
376
|
}
|
|
363
377
|
//#endregion
|
|
364
378
|
//#region src/history/memoryHistoryDriver.ts
|
|
@@ -643,7 +657,7 @@ function re(e, t) {
|
|
|
643
657
|
}
|
|
644
658
|
//#endregion
|
|
645
659
|
//#region src/transition/store.ts
|
|
646
|
-
function
|
|
660
|
+
function T(t = "cupertino") {
|
|
647
661
|
return e((e) => ({
|
|
648
662
|
defaultTransitionName: t,
|
|
649
663
|
setDefaultTransitionName: (t) => e({ defaultTransitionName: t })
|
|
@@ -651,11 +665,12 @@ function ie(t = "cupertino") {
|
|
|
651
665
|
}
|
|
652
666
|
//#endregion
|
|
653
667
|
//#region src/screen/store.ts
|
|
654
|
-
function
|
|
668
|
+
function E() {
|
|
655
669
|
return e((e) => ({
|
|
656
670
|
dragStatus: "IDLE",
|
|
657
671
|
replaceTransitionStatus: "IDLE",
|
|
658
672
|
sharedBars: {},
|
|
673
|
+
screenSurfaces: {},
|
|
659
674
|
setDragStatus: (t) => e({ dragStatus: t }),
|
|
660
675
|
setReplaceTransitionStatus: (t) => e({ replaceTransitionStatus: t }),
|
|
661
676
|
registerSharedBars: (t, n) => e((e) => ({ sharedBars: {
|
|
@@ -665,16 +680,27 @@ function ae() {
|
|
|
665
680
|
unregisterSharedBars: (t) => e((e) => {
|
|
666
681
|
let n = { ...e.sharedBars };
|
|
667
682
|
return delete n[t], { sharedBars: n };
|
|
683
|
+
}),
|
|
684
|
+
registerScreenSurface: (t, n) => e((e) => {
|
|
685
|
+
let r = e.screenSurfaces[t];
|
|
686
|
+
return r && r.opaqueBackground === n.opaqueBackground ? e : { screenSurfaces: {
|
|
687
|
+
...e.screenSurfaces,
|
|
688
|
+
[t]: n
|
|
689
|
+
} };
|
|
690
|
+
}),
|
|
691
|
+
unregisterScreenSurface: (t) => e((e) => {
|
|
692
|
+
let n = { ...e.screenSurfaces };
|
|
693
|
+
return delete n[t], { screenSurfaces: n };
|
|
668
694
|
})
|
|
669
695
|
}));
|
|
670
696
|
}
|
|
671
697
|
//#endregion
|
|
672
698
|
//#region src/core/createRouterScope.ts
|
|
673
|
-
var
|
|
699
|
+
var ie = {
|
|
674
700
|
mark: () => {},
|
|
675
701
|
consume: () => !1
|
|
676
702
|
};
|
|
677
|
-
function
|
|
703
|
+
function ae(e) {
|
|
678
704
|
let { routePaths: t, pathname: n, search: r, defaultTransitionName: i, memory: a, browserDriver: s } = e, c = l(t, n, r, i);
|
|
679
705
|
if (e.hostedScope) return e.hostedScope.history.getState().index === -1 && e.hostedScope.history.setState({
|
|
680
706
|
index: 0,
|
|
@@ -690,12 +716,12 @@ function se(e) {
|
|
|
690
716
|
layoutId: c.layoutId
|
|
691
717
|
},
|
|
692
718
|
url: c.pathname
|
|
693
|
-
}) : s, d = a ?
|
|
719
|
+
}) : s, d = a ? ie : m();
|
|
694
720
|
return {
|
|
695
721
|
history: o([c], 0),
|
|
696
722
|
navigate: b(),
|
|
697
|
-
transition:
|
|
698
|
-
screen:
|
|
723
|
+
transition: T(i),
|
|
724
|
+
screen: E(),
|
|
699
725
|
driver: u,
|
|
700
726
|
markSelfInduced: d.mark,
|
|
701
727
|
consume: d.consume
|
|
@@ -703,7 +729,7 @@ function se(e) {
|
|
|
703
729
|
}
|
|
704
730
|
//#endregion
|
|
705
731
|
//#region src/screen/createScreenSelector.ts
|
|
706
|
-
function
|
|
732
|
+
function oe(e, t) {
|
|
707
733
|
return e.map((n, r) => ({
|
|
708
734
|
...n,
|
|
709
735
|
isActive: r === t,
|
|
@@ -716,13 +742,13 @@ function ce(e, t) {
|
|
|
716
742
|
}
|
|
717
743
|
//#endregion
|
|
718
744
|
//#region src/screen/computeScreenFreeze.ts
|
|
719
|
-
function
|
|
745
|
+
function se(e) {
|
|
720
746
|
let t = e.status === "COMPLETED" && e.dragStatus === "IDLE";
|
|
721
747
|
return !e.isActive && t || e.isPrev && e.index - 2 <= e.zIndex && e.replaceTransitionStatus === "IDLE" || e.isPrev && e.index - 2 > e.zIndex;
|
|
722
748
|
}
|
|
723
749
|
//#endregion
|
|
724
750
|
//#region src/transition/createTransition.ts
|
|
725
|
-
function
|
|
751
|
+
function D({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exitBack: o, options: s }) {
|
|
726
752
|
return {
|
|
727
753
|
name: e,
|
|
728
754
|
initial: t,
|
|
@@ -743,7 +769,7 @@ function T({ name: e, initial: t, idle: n, enter: r, enterBack: i, exit: a, exit
|
|
|
743
769
|
}
|
|
744
770
|
//#endregion
|
|
745
771
|
//#region src/transition/createRawTransition.ts
|
|
746
|
-
function
|
|
772
|
+
function ce({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnExit: l, completedOnEnter: u, options: d }) {
|
|
747
773
|
return {
|
|
748
774
|
name: e,
|
|
749
775
|
initial: t,
|
|
@@ -764,10 +790,10 @@ function ue({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
764
790
|
}
|
|
765
791
|
//#endregion
|
|
766
792
|
//#region src/transition/cupertino.ts
|
|
767
|
-
var
|
|
793
|
+
var le = (e, t, n) => {
|
|
768
794
|
let [r, i] = t, [a, o] = n;
|
|
769
795
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
770
|
-
},
|
|
796
|
+
}, ue = D({
|
|
771
797
|
name: "cupertino",
|
|
772
798
|
initial: { x: "100%" },
|
|
773
799
|
idle: {
|
|
@@ -827,7 +853,7 @@ var de = (e, t, n) => {
|
|
|
827
853
|
swipeDirection: "x",
|
|
828
854
|
onSwipeStart: async () => !0,
|
|
829
855
|
onSwipe: (e, t, { animate: n, currentScreen: r, prevScreen: i, onProgress: a }) => {
|
|
830
|
-
let { offset: o } = t, s = o.x, c =
|
|
856
|
+
let { offset: o } = t, s = o.x, c = le(s, [0, window.innerWidth], [0, 100]);
|
|
831
857
|
return a?.(!0, c), n(r, { x: Math.max(0, s) }, { duration: 0 }), n(i, { x: `${-30 + c * .3}%` }, { duration: 0 }), c;
|
|
832
858
|
},
|
|
833
859
|
onSwipeEnd: async (e, t, { animate: n, currentScreen: r, prevScreen: i, onStart: a }) => {
|
|
@@ -851,10 +877,10 @@ var de = (e, t, n) => {
|
|
|
851
877
|
})]), c;
|
|
852
878
|
}
|
|
853
879
|
}
|
|
854
|
-
}),
|
|
880
|
+
}), de = (e, t, n) => {
|
|
855
881
|
let [r, i] = t, [a, o] = n;
|
|
856
882
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
857
|
-
},
|
|
883
|
+
}, fe = D({
|
|
858
884
|
name: "layout",
|
|
859
885
|
initial: { opacity: .97 },
|
|
860
886
|
idle: {
|
|
@@ -882,7 +908,7 @@ var de = (e, t, n) => {
|
|
|
882
908
|
swipeDirection: "y",
|
|
883
909
|
onSwipeStart: async () => !0,
|
|
884
910
|
onSwipe: (e, t, { animate: n, currentScreen: r, onProgress: i }) => {
|
|
885
|
-
let { offset: a } = t, o = a.y, s = Math.max(0, Math.min(56, o)), c =
|
|
911
|
+
let { offset: a } = t, o = a.y, s = Math.max(0, Math.min(56, o)), c = de(s, [0, 56], [1, .96]), l = Math.max(0, o - 56), u = Math.min(1, l / 160), d = Math.sqrt(u) * 12, f = Math.max(0, s + d), p = Math.min(56, f);
|
|
886
912
|
return i?.(!0, 100), n(r, {
|
|
887
913
|
y: f,
|
|
888
914
|
opacity: c
|
|
@@ -899,7 +925,7 @@ var de = (e, t, n) => {
|
|
|
899
925
|
}, { duration: .3 })]), c;
|
|
900
926
|
}
|
|
901
927
|
}
|
|
902
|
-
}),
|
|
928
|
+
}), O = D({
|
|
903
929
|
name: "material",
|
|
904
930
|
initial: { y: "100%" },
|
|
905
931
|
idle: {
|
|
@@ -1007,7 +1033,7 @@ var de = (e, t, n) => {
|
|
|
1007
1033
|
})]), c;
|
|
1008
1034
|
}
|
|
1009
1035
|
}
|
|
1010
|
-
}),
|
|
1036
|
+
}), pe = D({
|
|
1011
1037
|
name: "none",
|
|
1012
1038
|
initial: {},
|
|
1013
1039
|
idle: {
|
|
@@ -1030,20 +1056,20 @@ var de = (e, t, n) => {
|
|
|
1030
1056
|
value: {},
|
|
1031
1057
|
options: { duration: 0 }
|
|
1032
1058
|
}
|
|
1033
|
-
}),
|
|
1034
|
-
["none",
|
|
1035
|
-
["cupertino",
|
|
1036
|
-
["material",
|
|
1037
|
-
["layout",
|
|
1059
|
+
}), k = new Map([
|
|
1060
|
+
["none", pe],
|
|
1061
|
+
["cupertino", ue],
|
|
1062
|
+
["material", O],
|
|
1063
|
+
["layout", fe]
|
|
1038
1064
|
]);
|
|
1039
1065
|
//#endregion
|
|
1040
1066
|
//#region src/transition/resolveTransition.ts
|
|
1041
|
-
function
|
|
1042
|
-
return
|
|
1067
|
+
function A(e) {
|
|
1068
|
+
return k.get(e) ?? k.get("none");
|
|
1043
1069
|
}
|
|
1044
1070
|
//#endregion
|
|
1045
1071
|
//#region src/transition/decorator/createDecorator.ts
|
|
1046
|
-
function
|
|
1072
|
+
function me({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
1047
1073
|
return {
|
|
1048
1074
|
name: e,
|
|
1049
1075
|
initial: t,
|
|
@@ -1064,7 +1090,7 @@ function _e({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
|
1064
1090
|
}
|
|
1065
1091
|
//#endregion
|
|
1066
1092
|
//#region src/transition/decorator/createRawDecorator.ts
|
|
1067
|
-
function
|
|
1093
|
+
function he({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnEnter: l, completedOnExit: u, options: d }) {
|
|
1068
1094
|
return {
|
|
1069
1095
|
name: e,
|
|
1070
1096
|
initial: t,
|
|
@@ -1085,30 +1111,30 @@ function ve({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
1085
1111
|
}
|
|
1086
1112
|
//#endregion
|
|
1087
1113
|
//#region src/transition/decorator/overlay.ts
|
|
1088
|
-
var
|
|
1114
|
+
var j = "rgba(0, 0, 0, 0.3)", M = me({
|
|
1089
1115
|
name: "overlay",
|
|
1090
1116
|
initial: {
|
|
1091
1117
|
opacity: 0,
|
|
1092
|
-
backgroundColor:
|
|
1118
|
+
backgroundColor: j
|
|
1093
1119
|
},
|
|
1094
1120
|
idle: {
|
|
1095
1121
|
value: {
|
|
1096
1122
|
opacity: 0,
|
|
1097
|
-
backgroundColor:
|
|
1123
|
+
backgroundColor: j
|
|
1098
1124
|
},
|
|
1099
1125
|
options: { duration: 0 }
|
|
1100
1126
|
},
|
|
1101
1127
|
enter: {
|
|
1102
1128
|
value: {
|
|
1103
1129
|
opacity: 1,
|
|
1104
|
-
backgroundColor:
|
|
1130
|
+
backgroundColor: j
|
|
1105
1131
|
},
|
|
1106
1132
|
options: { duration: .7 }
|
|
1107
1133
|
},
|
|
1108
1134
|
exit: {
|
|
1109
1135
|
value: {
|
|
1110
1136
|
opacity: 0,
|
|
1111
|
-
backgroundColor:
|
|
1137
|
+
backgroundColor: j
|
|
1112
1138
|
},
|
|
1113
1139
|
options: { duration: .6 }
|
|
1114
1140
|
},
|
|
@@ -1117,10 +1143,10 @@ var O = "rgba(0, 0, 0, 0.3)", ye = _e({
|
|
|
1117
1143
|
onSwipe: (e, t, { animate: n, prevDecorator: r }) => n(r, { opacity: Math.max(0, 1 - t / 100) }, { duration: 0 }),
|
|
1118
1144
|
onSwipeEnd: (e, { animate: t, prevDecorator: n }) => t(n, { opacity: +!e }, { duration: .3 })
|
|
1119
1145
|
}
|
|
1120
|
-
}),
|
|
1146
|
+
}), N = new Map([["overlay", M]]);
|
|
1121
1147
|
//#endregion
|
|
1122
1148
|
//#region src/transition/partTransition/createPartTransition.ts
|
|
1123
|
-
function
|
|
1149
|
+
function ge({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
1124
1150
|
return {
|
|
1125
1151
|
name: e,
|
|
1126
1152
|
initial: t,
|
|
@@ -1141,7 +1167,7 @@ function be({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
|
1141
1167
|
}
|
|
1142
1168
|
//#endregion
|
|
1143
1169
|
//#region src/transition/partTransition/createRawPartTransition.ts
|
|
1144
|
-
function
|
|
1170
|
+
function _e({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnEnter: l, completedOnExit: u, options: d }) {
|
|
1145
1171
|
return {
|
|
1146
1172
|
name: e,
|
|
1147
1173
|
initial: t,
|
|
@@ -1162,7 +1188,7 @@ function xe({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
1162
1188
|
}
|
|
1163
1189
|
//#endregion
|
|
1164
1190
|
//#region src/transition/partTransition/partTransition.ts
|
|
1165
|
-
var
|
|
1191
|
+
var P = /* @__PURE__ */ new Map(), F = {
|
|
1166
1192
|
"IDLE-true": "self",
|
|
1167
1193
|
"IDLE-false": "self",
|
|
1168
1194
|
"PUSHING-true": "initial",
|
|
@@ -1173,7 +1199,7 @@ var A = /* @__PURE__ */ new Map(), j = {
|
|
|
1173
1199
|
"POPPING-false": "PUSHING-false",
|
|
1174
1200
|
"COMPLETED-true": "self",
|
|
1175
1201
|
"COMPLETED-false": "self"
|
|
1176
|
-
},
|
|
1202
|
+
}, ve = Object.keys(F), ye = ve, be = (e) => e.replace(/[^a-zA-Z0-9_-]/g, "_"), xe = (e) => typeof e == "object" && !!e && !Array.isArray(e), Se = new Set(/* @__PURE__ */ "opacity.scale.scaleX.scaleY.scaleZ.aspectRatio.columnCount.columns.flex.flexGrow.flexShrink.fontWeight.gridArea.gridColumn.gridColumnEnd.gridColumnStart.gridRow.gridRowEnd.gridRowStart.lineHeight.lineClamp.order.orphans.tabSize.widows.zIndex.zoom.fillOpacity.floodOpacity.stopOpacity.strokeOpacity.strokeDasharray.strokeDashoffset.strokeMiterlimit.strokeWidth".split(".")), Ce = (e, t) => t.startsWith("--") || Se.has(t) ? `${e}` : t === "rotate" || t === "rotateX" || t === "rotateY" || t === "rotateZ" ? `${e}deg` : `${e}px`, we = (e, t) => typeof t == "number" ? Ce(t, e) : typeof t == "string" ? t : "", Te = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), Ee = new Set([
|
|
1177
1203
|
"x",
|
|
1178
1204
|
"y",
|
|
1179
1205
|
"z",
|
|
@@ -1184,7 +1210,7 @@ var A = /* @__PURE__ */ new Map(), j = {
|
|
|
1184
1210
|
"rotateX",
|
|
1185
1211
|
"rotateY",
|
|
1186
1212
|
"rotateZ"
|
|
1187
|
-
]),
|
|
1213
|
+
]), De = /^-?0(\.0+)?(px|%|em|rem|vh|vw|vmin|vmax)?$/, Oe = /^-?0(\.0+)?(deg|rad|grad|turn)?$/, ke = /^1(\.0+)?$/, Ae = (e, t) => e === "scale" || e === "scaleX" || e === "scaleY" ? t === 1 ? !0 : typeof t == "string" ? ke.test(t.trim()) : !1 : e === "rotate" || e === "rotateX" || e === "rotateY" || e === "rotateZ" ? t === 0 ? !0 : typeof t == "string" ? Oe.test(t.trim()) : !1 : t === 0 ? !0 : typeof t == "string" ? De.test(t.trim()) : !1, je = (e, t) => {
|
|
1188
1214
|
switch (e) {
|
|
1189
1215
|
case "x": return `translateX(${t})`;
|
|
1190
1216
|
case "y": return `translateY(${t})`;
|
|
@@ -1198,23 +1224,23 @@ var A = /* @__PURE__ */ new Map(), j = {
|
|
|
1198
1224
|
case "rotateY": return `rotateY(${t})`;
|
|
1199
1225
|
default: return "";
|
|
1200
1226
|
}
|
|
1201
|
-
},
|
|
1227
|
+
}, Me = (e) => {
|
|
1202
1228
|
let t = /* @__PURE__ */ new Set(), n = !1, r = (e) => {
|
|
1203
|
-
if (
|
|
1229
|
+
if (xe(e)) for (let r of Object.keys(e)) {
|
|
1204
1230
|
let i = e[r];
|
|
1205
|
-
|
|
1231
|
+
we(r, i) !== "" && (Ee.has(r) ? n = !0 : t.add(Te(r)));
|
|
1206
1232
|
}
|
|
1207
1233
|
};
|
|
1208
1234
|
r(e.initial);
|
|
1209
1235
|
for (let t of Object.values(e.variants)) r(t.value);
|
|
1210
1236
|
return n && t.add("transform"), Array.from(t);
|
|
1211
|
-
},
|
|
1212
|
-
if (!
|
|
1237
|
+
}, I = (e) => {
|
|
1238
|
+
if (!xe(e)) return [];
|
|
1213
1239
|
let t = [], n = !0, r = [];
|
|
1214
1240
|
for (let i of Object.keys(e)) {
|
|
1215
|
-
let a = e[i], o =
|
|
1216
|
-
o !== "" && (
|
|
1217
|
-
property:
|
|
1241
|
+
let a = e[i], o = we(i, a);
|
|
1242
|
+
o !== "" && (Ee.has(i) ? (t.push(je(i, o)), Ae(i, a) || (n = !1)) : r.push({
|
|
1243
|
+
property: Te(i),
|
|
1218
1244
|
value: o
|
|
1219
1245
|
}));
|
|
1220
1246
|
}
|
|
@@ -1222,7 +1248,7 @@ var A = /* @__PURE__ */ new Map(), j = {
|
|
|
1222
1248
|
property: "transform",
|
|
1223
1249
|
value: n ? "none" : t.join(" ")
|
|
1224
1250
|
}), r;
|
|
1225
|
-
},
|
|
1251
|
+
}, L = (e) => e.map((e) => ` ${e.property}: ${e.value};`).join("\n"), R = (e) => Array.isArray(e) ? e.length === 4 && e.every((e) => typeof e == "number") ? `cubic-bezier(${e.join(", ")})` : "linear" : typeof e == "string" ? {
|
|
1226
1252
|
linear: "linear",
|
|
1227
1253
|
easeIn: "ease-in",
|
|
1228
1254
|
easeOut: "ease-out",
|
|
@@ -1232,33 +1258,33 @@ var A = /* @__PURE__ */ new Map(), j = {
|
|
|
1232
1258
|
backIn: "cubic-bezier(0.31, 0.01, 0.66, -0.59)",
|
|
1233
1259
|
backOut: "cubic-bezier(0.33, 1.53, 0.69, 0.99)",
|
|
1234
1260
|
anticipate: "cubic-bezier(0.36, 0, 0.66, -0.56)"
|
|
1235
|
-
}[e] ?? "ease" : "ease",
|
|
1261
|
+
}[e] ?? "ease" : "ease", z = (e) => {
|
|
1236
1262
|
if (!e) return 0;
|
|
1237
1263
|
let t = e.duration;
|
|
1238
1264
|
return typeof t == "number" && t >= 0 ? t : 0;
|
|
1239
|
-
},
|
|
1265
|
+
}, B = (e) => e && typeof e.delay == "number" && e.delay > 0 ? e.delay : 0, V = (e, t) => {
|
|
1240
1266
|
let [n, r] = t.split("-");
|
|
1241
1267
|
return `[data-flemo-screen][data-flemo-transition="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1242
|
-
},
|
|
1268
|
+
}, Ne = (e, t) => {
|
|
1243
1269
|
let [n, r] = t.split("-");
|
|
1244
1270
|
return `[data-flemo-decorator][data-flemo-decorator-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1245
|
-
},
|
|
1271
|
+
}, Pe = (e, t) => {
|
|
1246
1272
|
let [n, r] = t.split("-");
|
|
1247
1273
|
return `[data-flemo-bar][data-flemo-bar-transition="${e}"][data-flemo-bar-status="${n}"][data-flemo-bar-active="${r}"][data-flemo-bar-riding="true"]`;
|
|
1248
|
-
},
|
|
1274
|
+
}, Fe = (e, t) => {
|
|
1249
1275
|
let [n, r] = t.split("-");
|
|
1250
1276
|
return `[data-flemo-part-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1251
|
-
},
|
|
1252
|
-
let o =
|
|
1277
|
+
}, H = (e, t, n) => `flemo-${e}-${be(t)}-${n}`, U = (e, t, n, r, i, a) => {
|
|
1278
|
+
let o = I(r), s = I(i.value), c = z(i.options), l = B(i.options), u = R(i.options?.ease), d = a(t, n), f = e === "screen" ? `${d},\n${Pe(t, n)}` : d;
|
|
1253
1279
|
if (s.length === 0 && o.length === 0) return "";
|
|
1254
|
-
if (c <= 0 && l <= 0) return s.length === 0 ? "" : `${f} {\n${
|
|
1255
|
-
let p =
|
|
1280
|
+
if (c <= 0 && l <= 0) return s.length === 0 ? "" : `${f} {\n${L(s)}\n animation: none;\n}`;
|
|
1281
|
+
let p = H(e, t, n), m = [
|
|
1256
1282
|
`@keyframes ${p} {`,
|
|
1257
1283
|
" from {",
|
|
1258
|
-
|
|
1284
|
+
L(o).replace(/^/gm, " "),
|
|
1259
1285
|
" }",
|
|
1260
1286
|
" to {",
|
|
1261
|
-
|
|
1287
|
+
L(s).replace(/^/gm, " "),
|
|
1262
1288
|
" }",
|
|
1263
1289
|
"}"
|
|
1264
1290
|
].join("\n"), h = [
|
|
@@ -1268,78 +1294,85 @@ var A = /* @__PURE__ */ new Map(), j = {
|
|
|
1268
1294
|
l > 0 ? `${l}s` : null,
|
|
1269
1295
|
"both"
|
|
1270
1296
|
].filter(Boolean).join(" "), g = Array.from(new Set([...o.map((e) => e.property), ...s.map((e) => e.property)])), _ = g.length > 0 ? ` will-change: ${g.join(", ")};\n` : "", v = n.split("-")[0];
|
|
1271
|
-
return `${m}\n${`${f} {\n animation: ${h};\n${_}${v === "PUSHING" || v === "REPLACING" ? " contain: layout;\n pointer-events: none;\n" : ""}}`}`;
|
|
1272
|
-
},
|
|
1273
|
-
|
|
1274
|
-
|
|
1297
|
+
return `${m}\n${`${f} {\n animation: ${h};\n${_}${v === "PUSHING" || v === "REPLACING" ? " contain: layout;\n pointer-events: none;\n" : ""}}`}${e === "screen" && n.endsWith("-false") && Ie(r) && s.length > 0 ? `\n${d}[data-flemo-anim-hold="park"] {\n animation: none;\n${L(s)}\n}` : ""}`;
|
|
1298
|
+
}, Ie = (e) => {
|
|
1299
|
+
if (!e) return !1;
|
|
1300
|
+
if (e.opacity === 0) return !0;
|
|
1301
|
+
let t = (e) => typeof e == "string" && e.trim().endsWith("%") && Math.abs(parseFloat(e)) >= 100;
|
|
1302
|
+
return t(e.x) || t(e.y);
|
|
1303
|
+
}, W = (e, t, n, r) => {
|
|
1304
|
+
let i = I(r.value);
|
|
1305
|
+
return i.length === 0 ? "" : `${e(t, n)} {\n${L(i)}\n}`;
|
|
1275
1306
|
}, Le = (e, t, n = []) => {
|
|
1276
1307
|
let r = [];
|
|
1277
1308
|
for (let t of e) {
|
|
1278
1309
|
let e = t.name;
|
|
1279
|
-
for (let n of
|
|
1280
|
-
let i = t.variants[n], a =
|
|
1310
|
+
for (let n of ve) {
|
|
1311
|
+
let i = t.variants[n], a = F[n];
|
|
1281
1312
|
if (a === "self") {
|
|
1282
|
-
r.push(
|
|
1313
|
+
r.push(W(V, e, n, i));
|
|
1283
1314
|
continue;
|
|
1284
1315
|
}
|
|
1285
1316
|
let o = a === "initial" ? t.initial : t.variants[a].value;
|
|
1286
|
-
r.push(
|
|
1317
|
+
r.push(U("screen", e, n, o, i, V));
|
|
1287
1318
|
}
|
|
1288
1319
|
}
|
|
1289
1320
|
for (let e of t) {
|
|
1290
1321
|
let t = e.name;
|
|
1291
|
-
for (let n of
|
|
1292
|
-
let i = e.variants[n], a =
|
|
1322
|
+
for (let n of ye) {
|
|
1323
|
+
let i = e.variants[n], a = F[n];
|
|
1293
1324
|
if (a === "self") {
|
|
1294
|
-
r.push(
|
|
1325
|
+
r.push(W(Ne, t, n, i));
|
|
1295
1326
|
continue;
|
|
1296
1327
|
}
|
|
1297
1328
|
let o = a === "initial" ? e.initial : e.variants[a].value;
|
|
1298
|
-
r.push(
|
|
1329
|
+
r.push(U("decorator", t, n, o, i, Ne));
|
|
1299
1330
|
}
|
|
1300
1331
|
}
|
|
1301
1332
|
for (let e of n) {
|
|
1302
1333
|
let t = e.name;
|
|
1303
|
-
for (let n of
|
|
1304
|
-
let i = e.variants[n], a =
|
|
1334
|
+
for (let n of ye) {
|
|
1335
|
+
let i = e.variants[n], a = F[n];
|
|
1305
1336
|
if (a === "self") {
|
|
1306
|
-
r.push(
|
|
1337
|
+
r.push(W(Fe, t, n, i));
|
|
1307
1338
|
continue;
|
|
1308
1339
|
}
|
|
1309
1340
|
let o = a === "initial" ? e.initial : e.variants[a].value;
|
|
1310
|
-
r.push(
|
|
1341
|
+
r.push(U("part", t, n, o, i, Fe));
|
|
1311
1342
|
}
|
|
1312
1343
|
}
|
|
1313
1344
|
return [...r.filter((e) => e.length > 0), Re].join("\n\n");
|
|
1314
1345
|
}, Re = [
|
|
1315
1346
|
"[data-flemo-anim-hold=\"true\"],",
|
|
1316
|
-
"[data-flemo-anim-hold=\"
|
|
1347
|
+
"[data-flemo-anim-hold=\"park\"],",
|
|
1348
|
+
"[data-flemo-anim-hold=\"true\"] [data-flemo-part-name],",
|
|
1349
|
+
"[data-flemo-anim-hold=\"park\"] [data-flemo-part-name] {",
|
|
1317
1350
|
" animation-play-state: paused !important;",
|
|
1318
1351
|
"}"
|
|
1319
1352
|
].join("\n"), ze = (e, t) => {
|
|
1320
|
-
let n =
|
|
1353
|
+
let n = F[t];
|
|
1321
1354
|
if (n === "self") return !1;
|
|
1322
|
-
let r = e.variants[t], i =
|
|
1355
|
+
let r = e.variants[t], i = z(r.options), a = B(r.options);
|
|
1323
1356
|
if (i <= 0 && a <= 0) return !1;
|
|
1324
|
-
let o =
|
|
1357
|
+
let o = I(n === "initial" ? e.initial : e.variants[n].value), s = I(r.value);
|
|
1325
1358
|
return o.length > 0 || s.length > 0;
|
|
1326
1359
|
}, Be = "data-flemo";
|
|
1327
|
-
function
|
|
1360
|
+
function G() {
|
|
1328
1361
|
if (u()) return;
|
|
1329
|
-
let e = Le(
|
|
1362
|
+
let e = Le(k.values(), N.values(), P.values()), t = document.head.querySelector(`style[${Be}]`);
|
|
1330
1363
|
t || (t = document.createElement("style"), t.setAttribute(Be, ""), document.head.appendChild(t)), t.textContent !== e && (t.textContent = e);
|
|
1331
1364
|
}
|
|
1332
1365
|
//#endregion
|
|
1333
1366
|
//#region src/transition/registerTransitionDefinitions.ts
|
|
1334
1367
|
function Ve(e, t, n = []) {
|
|
1335
|
-
for (let t of e)
|
|
1336
|
-
for (let e of t)
|
|
1337
|
-
for (let e of n)
|
|
1338
|
-
return
|
|
1339
|
-
for (let t of e)
|
|
1340
|
-
for (let e of t)
|
|
1341
|
-
for (let e of n)
|
|
1342
|
-
|
|
1368
|
+
for (let t of e) k.set(t.name, t);
|
|
1369
|
+
for (let e of t) N.set(e.name, e);
|
|
1370
|
+
for (let e of n) P.set(e.name, e);
|
|
1371
|
+
return G(), () => {
|
|
1372
|
+
for (let t of e) k.delete(t.name);
|
|
1373
|
+
for (let e of t) N.delete(e.name);
|
|
1374
|
+
for (let e of n) P.delete(e.name);
|
|
1375
|
+
G();
|
|
1343
1376
|
};
|
|
1344
1377
|
}
|
|
1345
1378
|
//#endregion
|
|
@@ -1352,27 +1385,27 @@ function He(e) {
|
|
|
1352
1385
|
}
|
|
1353
1386
|
//#endregion
|
|
1354
1387
|
//#region src/transition/animateInline.ts
|
|
1355
|
-
var Ue = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement,
|
|
1356
|
-
let n =
|
|
1357
|
-
n || (n = /* @__PURE__ */ new Set(),
|
|
1358
|
-
},
|
|
1388
|
+
var Ue = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, K = /* @__PURE__ */ new WeakMap(), We = (e, t) => {
|
|
1389
|
+
let n = K.get(e);
|
|
1390
|
+
n || (n = /* @__PURE__ */ new Set(), K.set(e, n)), n.add(t);
|
|
1391
|
+
}, q = (e, t) => {
|
|
1359
1392
|
if (e.style.transition = "", t) {
|
|
1360
|
-
let n =
|
|
1393
|
+
let n = K.get(e);
|
|
1361
1394
|
for (let r of t) e.style.removeProperty(r), n?.delete(r);
|
|
1362
1395
|
return;
|
|
1363
1396
|
}
|
|
1364
|
-
let n =
|
|
1397
|
+
let n = K.get(e);
|
|
1365
1398
|
if (n && n.size > 0) {
|
|
1366
1399
|
for (let t of n) e.style.removeProperty(t);
|
|
1367
1400
|
n.clear();
|
|
1368
1401
|
return;
|
|
1369
1402
|
}
|
|
1370
1403
|
e.style.removeProperty("transform"), e.style.removeProperty("opacity");
|
|
1371
|
-
},
|
|
1404
|
+
}, J = (e, t, n = {}) => {
|
|
1372
1405
|
if (!Ue(e)) return Promise.resolve();
|
|
1373
|
-
let r = e, i =
|
|
1406
|
+
let r = e, i = I(t);
|
|
1374
1407
|
if (i.length === 0) return Promise.resolve();
|
|
1375
|
-
let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s =
|
|
1408
|
+
let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s = R(n.ease);
|
|
1376
1409
|
if (a <= 0 && o <= 0) {
|
|
1377
1410
|
r.style.transition = "none";
|
|
1378
1411
|
for (let e of i) r.style.setProperty(e.property, e.value), We(r, e.property);
|
|
@@ -1389,27 +1422,27 @@ var Ue = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, G = /* @__
|
|
|
1389
1422
|
};
|
|
1390
1423
|
r.addEventListener("transitionend", i), setTimeout(n, (a + o) * 1e3 + 60);
|
|
1391
1424
|
});
|
|
1392
|
-
},
|
|
1425
|
+
}, Y = "data-flemo-skip-animation", X = () => {};
|
|
1393
1426
|
function Ge(e) {
|
|
1394
1427
|
return { driveScreenLifecycle: (t) => {
|
|
1395
1428
|
let { getElements: n, transitionName: r, prevTransitionName: i, status: o, isActive: s } = t;
|
|
1396
|
-
if (!s) return o === "REPLACING" && i !== r && e.setReplaceTransitionStatus("PENDING"),
|
|
1429
|
+
if (!s) return o === "REPLACING" && i !== r && e.setReplaceTransitionStatus("PENDING"), X;
|
|
1397
1430
|
if (o === "COMPLETED") {
|
|
1398
1431
|
e.setDragStatus("IDLE"), e.setReplaceTransitionStatus("IDLE");
|
|
1399
1432
|
let { scope: t, decorator: r, bars: i } = n();
|
|
1400
|
-
t && (
|
|
1401
|
-
for (let e of i ?? []) e && (
|
|
1402
|
-
return
|
|
1433
|
+
t && (q(t), t.removeAttribute(Y)), r && (q(r), r.removeAttribute(Y));
|
|
1434
|
+
for (let e of i ?? []) e && (q(e), e.style.removeProperty("will-change"));
|
|
1435
|
+
return X;
|
|
1403
1436
|
}
|
|
1404
|
-
if (o === "IDLE") return
|
|
1437
|
+
if (o === "IDLE") return X;
|
|
1405
1438
|
let { scope: c } = n();
|
|
1406
|
-
if (!c) return
|
|
1439
|
+
if (!c) return X;
|
|
1407
1440
|
let l = () => {
|
|
1408
1441
|
let t = e.getTransitionTaskId();
|
|
1409
1442
|
t && a.resolveTask(t);
|
|
1410
|
-
}, u =
|
|
1411
|
-
if (!(c.getAttribute("data-flemo-skip-animation") !== "true" && ze(u, d))) return queueMicrotask(l),
|
|
1412
|
-
let f =
|
|
1443
|
+
}, u = A(r), d = `${o}-true`;
|
|
1444
|
+
if (!(c.getAttribute("data-flemo-skip-animation") !== "true" && ze(u, d))) return queueMicrotask(l), X;
|
|
1445
|
+
let f = H("screen", r, d), p = (e) => {
|
|
1413
1446
|
e.target === c && e.animationName === f && (c.removeEventListener("animationend", p), l());
|
|
1414
1447
|
};
|
|
1415
1448
|
return c.addEventListener("animationend", p), () => {
|
|
@@ -1419,20 +1452,20 @@ function Ge(e) {
|
|
|
1419
1452
|
}
|
|
1420
1453
|
//#endregion
|
|
1421
1454
|
//#region src/utils/findScrollable.ts
|
|
1422
|
-
function
|
|
1455
|
+
function Z(e, t) {
|
|
1423
1456
|
let { direction: n = "x", markerSelector: r = "[data-swipe-at-edge]", depthLimit: i = 24, verifyByScroll: a = !1 } = t ?? {}, o = Ke(e);
|
|
1424
1457
|
if (!o) return {
|
|
1425
1458
|
element: null,
|
|
1426
1459
|
hasMarker: !1
|
|
1427
1460
|
};
|
|
1428
1461
|
let s = o.closest?.(r);
|
|
1429
|
-
if (s instanceof HTMLElement &&
|
|
1462
|
+
if (s instanceof HTMLElement && Q(s, n) && (!a || $(s, n))) return {
|
|
1430
1463
|
element: s,
|
|
1431
1464
|
hasMarker: !0
|
|
1432
1465
|
};
|
|
1433
1466
|
let c = o, l = 0;
|
|
1434
1467
|
for (; c && l < i;) {
|
|
1435
|
-
if (
|
|
1468
|
+
if (Q(c, n) && (!a || $(c, n))) return {
|
|
1436
1469
|
element: c,
|
|
1437
1470
|
hasMarker: !1
|
|
1438
1471
|
};
|
|
@@ -1451,11 +1484,11 @@ function Ke(e) {
|
|
|
1451
1484
|
}
|
|
1452
1485
|
return e instanceof HTMLElement ? e : null;
|
|
1453
1486
|
}
|
|
1454
|
-
function
|
|
1487
|
+
function Q(e, t) {
|
|
1455
1488
|
return t === "y" ? e.scrollHeight - e.clientHeight > 1 : e.scrollWidth - e.clientWidth > 1;
|
|
1456
1489
|
}
|
|
1457
|
-
function
|
|
1458
|
-
if (!
|
|
1490
|
+
function $(e, t) {
|
|
1491
|
+
if (!Q(e, t) || typeof window > "u") return !1;
|
|
1459
1492
|
let n = window.getComputedStyle(e), r = t === "y" ? n.overflowY : n.overflowX;
|
|
1460
1493
|
return r === "auto" || r === "scroll" || r === "overlay";
|
|
1461
1494
|
}
|
|
@@ -1508,9 +1541,9 @@ function Je(e) {
|
|
|
1508
1541
|
y: e.clientY
|
|
1509
1542
|
}, u = t;
|
|
1510
1543
|
}, v = (n, i, a) => {
|
|
1511
|
-
let o =
|
|
1512
|
-
if (n === e.getElements().scope) for (let e of r.current)
|
|
1513
|
-
else if (n === t) for (let e of r.prev)
|
|
1544
|
+
let o = J(n, i, a);
|
|
1545
|
+
if (n === e.getElements().scope) for (let e of r.current) J(e, i, a);
|
|
1546
|
+
else if (n === t) for (let e of r.prev) J(e, i, a);
|
|
1514
1547
|
return o;
|
|
1515
1548
|
}, y = (t) => {
|
|
1516
1549
|
let n = e.getPartnerBars(), i = [], { sharedTopBar: a, sharedBottomBar: o } = e.getElements();
|
|
@@ -1524,12 +1557,12 @@ function Je(e) {
|
|
|
1524
1557
|
current: i,
|
|
1525
1558
|
prev: s
|
|
1526
1559
|
};
|
|
1527
|
-
let c =
|
|
1560
|
+
let c = Me(e.getTransition()).join(", ");
|
|
1528
1561
|
for (let e of i) e.style.willChange = c;
|
|
1529
1562
|
for (let e of s) e.style.willChange = c;
|
|
1530
1563
|
}, b = () => {
|
|
1531
|
-
for (let e of r.current)
|
|
1532
|
-
for (let e of r.prev)
|
|
1564
|
+
for (let e of r.current) q(e), e.style.removeProperty("will-change");
|
|
1565
|
+
for (let e of r.prev) q(e), e.style.removeProperty("will-change");
|
|
1533
1566
|
r = {
|
|
1534
1567
|
current: [],
|
|
1535
1568
|
prev: []
|
|
@@ -1542,10 +1575,10 @@ function Je(e) {
|
|
|
1542
1575
|
};
|
|
1543
1576
|
}, S = (e, t, n) => {
|
|
1544
1577
|
let r = (r, i) => {
|
|
1545
|
-
let a =
|
|
1578
|
+
let a = P.get(r.getAttribute("data-flemo-part-name"));
|
|
1546
1579
|
if (!a) return;
|
|
1547
1580
|
let o = {
|
|
1548
|
-
animate:
|
|
1581
|
+
animate: J,
|
|
1549
1582
|
element: r,
|
|
1550
1583
|
active: i
|
|
1551
1584
|
};
|
|
@@ -1554,7 +1587,7 @@ function Je(e) {
|
|
|
1554
1587
|
for (let e of i.current) r(e, !0);
|
|
1555
1588
|
for (let e of i.prev) r(e, !1);
|
|
1556
1589
|
}, C = () => {
|
|
1557
|
-
for (let e of [...i.current, ...i.prev])
|
|
1590
|
+
for (let e of [...i.current, ...i.prev]) q(e);
|
|
1558
1591
|
i = {
|
|
1559
1592
|
current: [],
|
|
1560
1593
|
prev: []
|
|
@@ -1583,7 +1616,7 @@ function Je(e) {
|
|
|
1583
1616
|
prevScreen: t,
|
|
1584
1617
|
onStart: (e) => {
|
|
1585
1618
|
m?.onSwipeStart?.(e, {
|
|
1586
|
-
animate:
|
|
1619
|
+
animate: J,
|
|
1587
1620
|
currentDecorator: f,
|
|
1588
1621
|
prevDecorator: n
|
|
1589
1622
|
}), S("start", e, 0);
|
|
@@ -1600,7 +1633,7 @@ function Je(e) {
|
|
|
1600
1633
|
prevScreen: t,
|
|
1601
1634
|
onProgress: (e, t) => {
|
|
1602
1635
|
c?.onSwipe?.(e, t, {
|
|
1603
|
-
animate:
|
|
1636
|
+
animate: J,
|
|
1604
1637
|
currentDecorator: o,
|
|
1605
1638
|
prevDecorator: n
|
|
1606
1639
|
}), S("swipe", e, t);
|
|
@@ -1619,7 +1652,7 @@ function Je(e) {
|
|
|
1619
1652
|
prevScreen: t,
|
|
1620
1653
|
onStart: (e) => {
|
|
1621
1654
|
u?.onSwipeEnd?.(e, {
|
|
1622
|
-
animate:
|
|
1655
|
+
animate: J,
|
|
1623
1656
|
currentDecorator: l,
|
|
1624
1657
|
prevDecorator: n
|
|
1625
1658
|
}), S("end", e, 0);
|
|
@@ -1627,24 +1660,24 @@ function Je(e) {
|
|
|
1627
1660
|
})) {
|
|
1628
1661
|
c?.setAttribute(qe, "true"), l?.setAttribute(qe, "true");
|
|
1629
1662
|
for (let e of r.current) e.style.removeProperty("will-change");
|
|
1630
|
-
for (let e of r.prev)
|
|
1663
|
+
for (let e of r.prev) q(e), e.style.removeProperty("will-change");
|
|
1631
1664
|
r = {
|
|
1632
1665
|
current: [],
|
|
1633
1666
|
prev: []
|
|
1634
1667
|
};
|
|
1635
|
-
for (let e of i.prev)
|
|
1668
|
+
for (let e of i.prev) q(e);
|
|
1636
1669
|
i = {
|
|
1637
1670
|
current: [],
|
|
1638
1671
|
prev: []
|
|
1639
1672
|
}, e.back();
|
|
1640
|
-
} else c &&
|
|
1673
|
+
} else c && q(c), t && q(t), l && q(l), n && q(n), b(), C(), e.setDragStatus("IDLE");
|
|
1641
1674
|
};
|
|
1642
1675
|
return {
|
|
1643
1676
|
pointerDown: (t) => {
|
|
1644
|
-
e.isReadyForDrag() && (f =
|
|
1677
|
+
e.isReadyForDrag() && (f = Z(t.target, {
|
|
1645
1678
|
direction: "x",
|
|
1646
1679
|
verifyByScroll: !0
|
|
1647
|
-
}), p =
|
|
1680
|
+
}), p = Z(t.target, {
|
|
1648
1681
|
direction: "y",
|
|
1649
1682
|
verifyByScroll: !0
|
|
1650
1683
|
}), m = t.clientX, h = t.clientY, (!f.element && !p.element || f.element || p.element) && (a = !0));
|
|
@@ -1687,18 +1720,41 @@ function Ye(e) {
|
|
|
1687
1720
|
function Xe(e) {
|
|
1688
1721
|
return !(e.status === "PUSHING" || e.status === "POPPING" || e.status === "REPLACING") || !e.isTopOrTopPrev ? null : `${e.status}:${e.transitionName}`;
|
|
1689
1722
|
}
|
|
1690
|
-
var Ze = 300;
|
|
1691
|
-
function
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1723
|
+
var Ze = 300, Qe = 20;
|
|
1724
|
+
function $e(e) {
|
|
1725
|
+
return Array.from(e.querySelectorAll("img")).filter((e) => e.complete && typeof e.decode == "function").slice(0, Qe);
|
|
1726
|
+
}
|
|
1727
|
+
function et(e) {
|
|
1728
|
+
if (!(!e || typeof e.querySelectorAll != "function")) for (let t of $e(e)) t.decode().catch(() => {});
|
|
1729
|
+
}
|
|
1730
|
+
function tt(e, t = {}) {
|
|
1731
|
+
let n = !1, r = 0, i = () => {
|
|
1732
|
+
let r = t.scope;
|
|
1733
|
+
if (!r || typeof r.querySelectorAll != "function") {
|
|
1734
|
+
e();
|
|
1735
|
+
return;
|
|
1736
|
+
}
|
|
1737
|
+
let i = $e(r);
|
|
1738
|
+
if (i.length === 0) {
|
|
1739
|
+
e();
|
|
1740
|
+
return;
|
|
1741
|
+
}
|
|
1742
|
+
let a = Promise.allSettled(i.map((e) => e.decode())), o = new Promise((e) => {
|
|
1743
|
+
setTimeout(e, 150);
|
|
1744
|
+
});
|
|
1745
|
+
Promise.race([a, o]).then(() => {
|
|
1746
|
+
n || e();
|
|
1747
|
+
});
|
|
1748
|
+
}, a = requestAnimationFrame(() => {
|
|
1749
|
+
r = requestAnimationFrame(i);
|
|
1750
|
+
}), o = setTimeout(e, 300);
|
|
1695
1751
|
return () => {
|
|
1696
|
-
cancelAnimationFrame(
|
|
1752
|
+
n = !0, cancelAnimationFrame(a), r && cancelAnimationFrame(r), clearTimeout(o);
|
|
1697
1753
|
};
|
|
1698
1754
|
}
|
|
1699
1755
|
//#endregion
|
|
1700
1756
|
//#region src/screen/observeBarHeight.ts
|
|
1701
|
-
function
|
|
1757
|
+
function nt(e, t) {
|
|
1702
1758
|
e.offsetHeight > 0 && t(e.offsetHeight);
|
|
1703
1759
|
let n = new ResizeObserver(([e]) => {
|
|
1704
1760
|
e.contentRect.height > 0 && t(e.contentRect.height);
|
|
@@ -1709,14 +1765,14 @@ function $e(e, t) {
|
|
|
1709
1765
|
}
|
|
1710
1766
|
//#endregion
|
|
1711
1767
|
//#region src/screen/observeViewportScrollHeight.ts
|
|
1712
|
-
var
|
|
1713
|
-
function
|
|
1768
|
+
var rt = 0;
|
|
1769
|
+
function it(e) {
|
|
1714
1770
|
let t = 0, n = () => {
|
|
1715
1771
|
cancelAnimationFrame(t), t = requestAnimationFrame(() => {
|
|
1716
1772
|
let t = document.documentElement.scrollHeight - (window.visualViewport?.height || 0);
|
|
1717
1773
|
t = t < 0 ? 0 : t;
|
|
1718
|
-
let n = t -
|
|
1719
|
-
n = n < 0 ? 0 : n,
|
|
1774
|
+
let n = t - rt;
|
|
1775
|
+
n = n < 0 ? 0 : n, rt ||= t, e(t, n);
|
|
1720
1776
|
});
|
|
1721
1777
|
};
|
|
1722
1778
|
return window.visualViewport?.addEventListener("resize", n), window.visualViewport?.addEventListener("scroll", n), () => {
|
|
@@ -1725,12 +1781,23 @@ function et(e) {
|
|
|
1725
1781
|
}
|
|
1726
1782
|
//#endregion
|
|
1727
1783
|
//#region src/utils/matchesPathname.ts
|
|
1728
|
-
function
|
|
1784
|
+
function at(e, t) {
|
|
1729
1785
|
return i(e).regexp.test(t);
|
|
1730
1786
|
}
|
|
1731
1787
|
//#endregion
|
|
1788
|
+
//#region src/utils/isOpaqueColor.ts
|
|
1789
|
+
function ot(e) {
|
|
1790
|
+
let t = e.trim().toLowerCase();
|
|
1791
|
+
if (t === "transparent" || t === "") return !1;
|
|
1792
|
+
if (t.match(/^rgb\(\s*\d+[\s,]+\d+[\s,]+\d+\s*\)$/)) return !0;
|
|
1793
|
+
let n = t.match(/^rgba\(\s*\d+[\s,]+\d+[\s,]+\d+[\s,/]+([\d.]+)\s*\)$/);
|
|
1794
|
+
if (n) return parseFloat(n[1]) >= 1;
|
|
1795
|
+
let r = t.match(/\/\s*([\d.]+%?)\s*\)$/);
|
|
1796
|
+
return r ? (r[1].endsWith("%") ? parseFloat(r[1]) / 100 : parseFloat(r[1])) >= 1 : !!(t.startsWith("rgb(") || t.startsWith("color("));
|
|
1797
|
+
}
|
|
1798
|
+
//#endregion
|
|
1732
1799
|
//#region src/utils/buildRoutePath.ts
|
|
1733
|
-
function
|
|
1800
|
+
function st(e, n) {
|
|
1734
1801
|
let i = n ?? {}, a = t(e)(Object.fromEntries(Object.entries(i).map(([e, t]) => [e, String(t)]))), o = (typeof e == "string" ? r(e) : e).tokens.filter((e) => e.type === "param").map((e) => e.name), s = Object.fromEntries(Object.entries(i).filter(([e]) => !o.includes(e))), c = new URLSearchParams(s).toString();
|
|
1735
1802
|
return {
|
|
1736
1803
|
pathname: `${a}${c ? `?${c}` : ""}`,
|
|
@@ -1738,4 +1805,4 @@ function nt(e, n) {
|
|
|
1738
1805
|
};
|
|
1739
1806
|
}
|
|
1740
1807
|
//#endregion
|
|
1741
|
-
export { Ze as ANIM_HOLD_RELEASE_BACKSTOP_MS,
|
|
1808
|
+
export { Ze as ANIM_HOLD_RELEASE_BACKSTOP_MS, Y as SKIP_ANIMATION_ATTR, a as TaskManger, Xe as animHoldKey, J as animateInline, H as animationName, te as appendParamsQuery, G as applyTransitionStyles, st as buildRoutePath, $ as canProgrammaticallyScroll, q as clearInlineAnimation, Me as collectAnimatedProperties, Le as compileTransitionStyles, Ye as computeBarRiding, se as computeScreenFreeze, _ as consumeSelfInducedPop, p as createBrowserHistoryDriver, me as createDecorator, o as createHistoryStore, v as createHistorySync, y as createMemoryHistoryDriver, b as createNavigateStore, w as createNavigationController, ge as createPartTransition, he as createRawDecorator, _e as createRawPartTransition, ce as createRawTransition, ae as createRouterScope, oe as createScreenSelector, E as createScreenStore, m as createSelfPopGuard, ne as createStepController, Je as createSwipeController, D as createTransition, Ge as createTransitionEngine, T as createTransitionStore, ue as cupertino, N as decoratorMap, et as eagerlyDecodeImages, R as easingToCss, d as ensureWindowHistoryState, He as enteringInitialStyle, Z as findScrollable, s as getMatchedPathPattern, c as getParams, ot as isOpaqueColor, u as isServer, fe as layout, g as markSelfInducedPop, at as matchesPathname, O as material, pe as none, nt as observeBarHeight, it as observeViewportScrollHeight, Q as overflowsAxis, M as overlay, P as partTransitionMap, ee as readStepParams, Ve as registerTransitionDefinitions, A as resolveTransition, tt as scheduleAnimHoldRelease, l as seedInitialHistory, re as subscribeStepParamsRestore, I as targetToDecls, k as transitionMap, ze as variantHasAnimation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -6,4 +6,10 @@ export interface AnimHoldInput {
|
|
|
6
6
|
}
|
|
7
7
|
export declare function animHoldKey(input: AnimHoldInput): string | null;
|
|
8
8
|
export declare const ANIM_HOLD_RELEASE_BACKSTOP_MS = 300;
|
|
9
|
-
export declare
|
|
9
|
+
export declare const ANIM_HOLD_DECODE_CAP_MS = 150;
|
|
10
|
+
export declare function collectDecodableImages(scope: HTMLElement): HTMLImageElement[];
|
|
11
|
+
export declare function eagerlyDecodeImages(scope: HTMLElement | null): void;
|
|
12
|
+
export interface AnimHoldReleaseOptions {
|
|
13
|
+
scope?: HTMLElement | null;
|
|
14
|
+
}
|
|
15
|
+
export declare function scheduleAnimHoldRelease(release: () => void, options?: AnimHoldReleaseOptions): () => void;
|
package/dist/screen/store.d.ts
CHANGED
|
@@ -3,14 +3,20 @@ export interface SharedBarPresence {
|
|
|
3
3
|
topBar: boolean;
|
|
4
4
|
bottomBar: boolean;
|
|
5
5
|
}
|
|
6
|
+
export interface ScreenSurface {
|
|
7
|
+
opaqueBackground: boolean;
|
|
8
|
+
}
|
|
6
9
|
export interface ScreenStore {
|
|
7
10
|
dragStatus: "IDLE" | "PENDING";
|
|
8
11
|
replaceTransitionStatus: "IDLE" | "PENDING";
|
|
9
12
|
sharedBars: Record<string, SharedBarPresence>;
|
|
13
|
+
screenSurfaces: Record<string, ScreenSurface>;
|
|
10
14
|
setDragStatus: (dragStatus: "IDLE" | "PENDING") => void;
|
|
11
15
|
setReplaceTransitionStatus: (replaceTransitionStatus: "IDLE" | "PENDING") => void;
|
|
12
16
|
registerSharedBars: (id: string, presence: SharedBarPresence) => void;
|
|
13
17
|
unregisterSharedBars: (id: string) => void;
|
|
18
|
+
registerScreenSurface: (id: string, surface: ScreenSurface) => void;
|
|
19
|
+
unregisterScreenSurface: (id: string) => void;
|
|
14
20
|
}
|
|
15
21
|
export type ScreenStoreApi = StoreApi<ScreenStore>;
|
|
16
22
|
export default function createScreenStore(): ScreenStoreApi;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function isOpaqueColor(cssColor: string): boolean;
|
package/package.json
CHANGED