@flemo/core 1.6.1 → 1.7.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/index.d.ts +2 -1
- package/dist/index.mjs +125 -116
- package/dist/screen/__tests__/computeBarRiding.test.d.ts +1 -0
- package/dist/screen/animStartAnchor.d.ts +9 -0
- package/dist/screen/computeBarRiding.d.ts +13 -0
- package/package.json +1 -1
- package/dist/core/engine/barRiding.d.ts +0 -18
- /package/dist/{core/engine/__tests__/barRiding.test.d.ts → screen/__tests__/animStartAnchor.test.d.ts} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -33,7 +33,8 @@ export { default as createTransitionEngine } from './core/engine/createTransitio
|
|
|
33
33
|
export { SKIP_ANIMATION_ATTR, type TransitionEngine, type TransitionEngineDeps, type ScreenLifecycleInput } from './core/engine/types';
|
|
34
34
|
export { default as createSwipeController } from './core/engine/createSwipeController';
|
|
35
35
|
export { type SwipeController, type SwipeControllerConfig, type SwipeControllerElements, type SharedBarPresenceLike } from './core/engine/createSwipeController';
|
|
36
|
-
export { default as
|
|
36
|
+
export { default as computeBarRiding, type BarRidingInput } from './screen/computeBarRiding';
|
|
37
|
+
export { animHoldKey, scheduleAnimHoldRelease, ANIM_HOLD_RELEASE_BACKSTOP_MS, type AnimHoldInput } from './screen/animStartAnchor';
|
|
37
38
|
export type { RegisterTransition, TransitionName, TransitionVariant, TransitionVariantValue, TransitionOptions, BaseTransition, Transition, SwipeInfo, SwipeAnimate } from './transition/typing';
|
|
38
39
|
export type { RegisterDecorator, DecoratorName, DecoratorOptions, Decorator } from './transition/decorator/typing';
|
|
39
40
|
export type { RegisterPartTransition, PartTransitionName, PartTransitionOptions, PartTransition } from './transition/partTransition/typing';
|
package/dist/index.mjs
CHANGED
|
@@ -654,7 +654,7 @@ function te({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
654
654
|
var ne = (e, t, n) => {
|
|
655
655
|
let [r, i] = t, [a, o] = n;
|
|
656
656
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
657
|
-
},
|
|
657
|
+
}, re = T({
|
|
658
658
|
name: "cupertino",
|
|
659
659
|
initial: { x: "100%" },
|
|
660
660
|
idle: {
|
|
@@ -738,10 +738,10 @@ var ne = (e, t, n) => {
|
|
|
738
738
|
})]), c;
|
|
739
739
|
}
|
|
740
740
|
}
|
|
741
|
-
}),
|
|
741
|
+
}), ie = (e, t, n) => {
|
|
742
742
|
let [r, i] = t, [a, o] = n;
|
|
743
743
|
return i === r ? a : a + (e - r) / (i - r) * (o - a);
|
|
744
|
-
},
|
|
744
|
+
}, E = T({
|
|
745
745
|
name: "layout",
|
|
746
746
|
initial: { opacity: .97 },
|
|
747
747
|
idle: {
|
|
@@ -769,7 +769,7 @@ var ne = (e, t, n) => {
|
|
|
769
769
|
swipeDirection: "y",
|
|
770
770
|
onSwipeStart: async () => !0,
|
|
771
771
|
onSwipe: (e, t, { animate: n, currentScreen: r, onProgress: i }) => {
|
|
772
|
-
let { offset: a } = t, o = a.y, s = Math.max(0, Math.min(56, o)), c =
|
|
772
|
+
let { offset: a } = t, o = a.y, s = Math.max(0, Math.min(56, o)), c = ie(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);
|
|
773
773
|
return i?.(!0, 100), n(r, {
|
|
774
774
|
y: f,
|
|
775
775
|
opacity: c
|
|
@@ -786,7 +786,7 @@ var ne = (e, t, n) => {
|
|
|
786
786
|
}, { duration: .3 })]), c;
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
}),
|
|
789
|
+
}), D = T({
|
|
790
790
|
name: "material",
|
|
791
791
|
initial: { y: "100%" },
|
|
792
792
|
idle: {
|
|
@@ -894,7 +894,7 @@ var ne = (e, t, n) => {
|
|
|
894
894
|
})]), c;
|
|
895
895
|
}
|
|
896
896
|
}
|
|
897
|
-
}),
|
|
897
|
+
}), O = T({
|
|
898
898
|
name: "none",
|
|
899
899
|
initial: {},
|
|
900
900
|
idle: {
|
|
@@ -917,15 +917,15 @@ var ne = (e, t, n) => {
|
|
|
917
917
|
value: {},
|
|
918
918
|
options: { duration: 0 }
|
|
919
919
|
}
|
|
920
|
-
}),
|
|
921
|
-
["none",
|
|
922
|
-
["cupertino",
|
|
923
|
-
["material",
|
|
924
|
-
["layout",
|
|
920
|
+
}), k = new Map([
|
|
921
|
+
["none", O],
|
|
922
|
+
["cupertino", re],
|
|
923
|
+
["material", D],
|
|
924
|
+
["layout", E]
|
|
925
925
|
]);
|
|
926
926
|
//#endregion
|
|
927
927
|
//#region src/transition/store.ts
|
|
928
|
-
function
|
|
928
|
+
function ae(t = "cupertino") {
|
|
929
929
|
return e((e) => ({
|
|
930
930
|
defaultTransitionName: t,
|
|
931
931
|
setDefaultTransitionName: (t) => e({ defaultTransitionName: t })
|
|
@@ -933,7 +933,7 @@ function se(t = "cupertino") {
|
|
|
933
933
|
}
|
|
934
934
|
//#endregion
|
|
935
935
|
//#region src/transition/decorator/createDecorator.ts
|
|
936
|
-
function
|
|
936
|
+
function oe({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
937
937
|
return {
|
|
938
938
|
name: e,
|
|
939
939
|
initial: t,
|
|
@@ -954,7 +954,7 @@ function O({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
|
954
954
|
}
|
|
955
955
|
//#endregion
|
|
956
956
|
//#region src/transition/decorator/createRawDecorator.ts
|
|
957
|
-
function
|
|
957
|
+
function se({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, replaceOnEnter: a, replaceOnExit: o, popOnEnter: s, popOnExit: c, completedOnEnter: l, completedOnExit: u, options: d }) {
|
|
958
958
|
return {
|
|
959
959
|
name: e,
|
|
960
960
|
initial: t,
|
|
@@ -975,30 +975,30 @@ function ce({ name: e, initial: t, idle: n, pushOnEnter: r, pushOnExit: i, repla
|
|
|
975
975
|
}
|
|
976
976
|
//#endregion
|
|
977
977
|
//#region src/transition/decorator/overlay.ts
|
|
978
|
-
var
|
|
978
|
+
var A = "rgba(0, 0, 0, 0.3)", ce = oe({
|
|
979
979
|
name: "overlay",
|
|
980
980
|
initial: {
|
|
981
981
|
opacity: 0,
|
|
982
|
-
backgroundColor:
|
|
982
|
+
backgroundColor: A
|
|
983
983
|
},
|
|
984
984
|
idle: {
|
|
985
985
|
value: {
|
|
986
986
|
opacity: 0,
|
|
987
|
-
backgroundColor:
|
|
987
|
+
backgroundColor: A
|
|
988
988
|
},
|
|
989
989
|
options: { duration: 0 }
|
|
990
990
|
},
|
|
991
991
|
enter: {
|
|
992
992
|
value: {
|
|
993
993
|
opacity: 1,
|
|
994
|
-
backgroundColor:
|
|
994
|
+
backgroundColor: A
|
|
995
995
|
},
|
|
996
996
|
options: { duration: .7 }
|
|
997
997
|
},
|
|
998
998
|
exit: {
|
|
999
999
|
value: {
|
|
1000
1000
|
opacity: 0,
|
|
1001
|
-
backgroundColor:
|
|
1001
|
+
backgroundColor: A
|
|
1002
1002
|
},
|
|
1003
1003
|
options: { duration: .6 }
|
|
1004
1004
|
},
|
|
@@ -1007,7 +1007,7 @@ var k = "rgba(0, 0, 0, 0.3)", le = O({
|
|
|
1007
1007
|
onSwipe: (e, t, { animate: n, prevDecorator: r }) => n(r, { opacity: Math.max(0, 1 - t / 100) }, { duration: 0 }),
|
|
1008
1008
|
onSwipeEnd: (e, { animate: t, prevDecorator: n }) => t(n, { opacity: +!e }, { duration: .3 })
|
|
1009
1009
|
}
|
|
1010
|
-
}),
|
|
1010
|
+
}), le = new Map([["overlay", ce]]);
|
|
1011
1011
|
//#endregion
|
|
1012
1012
|
//#region src/transition/partTransition/createPartTransition.ts
|
|
1013
1013
|
function ue({ name: e, initial: t, idle: n, enter: r, exit: i, options: a }) {
|
|
@@ -1063,7 +1063,7 @@ var j = /* @__PURE__ */ new Map(), M = {
|
|
|
1063
1063
|
"POPPING-false": "PUSHING-false",
|
|
1064
1064
|
"COMPLETED-true": "self",
|
|
1065
1065
|
"COMPLETED-false": "self"
|
|
1066
|
-
}, fe = Object.keys(M),
|
|
1066
|
+
}, fe = Object.keys(M), N = fe, pe = (e) => e.replace(/[^a-zA-Z0-9_-]/g, "_"), P = (e) => typeof e == "object" && !!e && !Array.isArray(e), me = 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(".")), he = (e, t) => t.startsWith("--") || me.has(t) ? `${e}` : t === "rotate" || t === "rotateX" || t === "rotateY" || t === "rotateZ" ? `${e}deg` : `${e}px`, F = (e, t) => typeof t == "number" ? he(t, e) : typeof t == "string" ? t : "", I = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`), L = new Set([
|
|
1067
1067
|
"x",
|
|
1068
1068
|
"y",
|
|
1069
1069
|
"z",
|
|
@@ -1074,7 +1074,7 @@ var j = /* @__PURE__ */ new Map(), M = {
|
|
|
1074
1074
|
"rotateX",
|
|
1075
1075
|
"rotateY",
|
|
1076
1076
|
"rotateZ"
|
|
1077
|
-
]),
|
|
1077
|
+
]), ge = /^-?0(\.0+)?(px|%|em|rem|vh|vw|vmin|vmax)?$/, _e = /^-?0(\.0+)?(deg|rad|grad|turn)?$/, ve = /^1(\.0+)?$/, ye = (e, t) => e === "scale" || e === "scaleX" || e === "scaleY" ? t === 1 ? !0 : typeof t == "string" ? ve.test(t.trim()) : !1 : e === "rotate" || e === "rotateX" || e === "rotateY" || e === "rotateZ" ? t === 0 ? !0 : typeof t == "string" ? _e.test(t.trim()) : !1 : t === 0 ? !0 : typeof t == "string" ? ge.test(t.trim()) : !1, be = (e, t) => {
|
|
1078
1078
|
switch (e) {
|
|
1079
1079
|
case "x": return `translateX(${t})`;
|
|
1080
1080
|
case "y": return `translateY(${t})`;
|
|
@@ -1088,23 +1088,23 @@ var j = /* @__PURE__ */ new Map(), M = {
|
|
|
1088
1088
|
case "rotateY": return `rotateY(${t})`;
|
|
1089
1089
|
default: return "";
|
|
1090
1090
|
}
|
|
1091
|
-
},
|
|
1091
|
+
}, R = (e) => {
|
|
1092
1092
|
let t = /* @__PURE__ */ new Set(), n = !1, r = (e) => {
|
|
1093
|
-
if (
|
|
1093
|
+
if (P(e)) for (let r of Object.keys(e)) {
|
|
1094
1094
|
let i = e[r];
|
|
1095
|
-
|
|
1095
|
+
F(r, i) !== "" && (L.has(r) ? n = !0 : t.add(I(r)));
|
|
1096
1096
|
}
|
|
1097
1097
|
};
|
|
1098
1098
|
r(e.initial);
|
|
1099
1099
|
for (let t of Object.values(e.variants)) r(t.value);
|
|
1100
1100
|
return n && t.add("transform"), Array.from(t);
|
|
1101
|
-
},
|
|
1102
|
-
if (!
|
|
1101
|
+
}, z = (e) => {
|
|
1102
|
+
if (!P(e)) return [];
|
|
1103
1103
|
let t = [], n = !0, r = [];
|
|
1104
1104
|
for (let i of Object.keys(e)) {
|
|
1105
|
-
let a = e[i], o =
|
|
1106
|
-
o !== "" && (
|
|
1107
|
-
property:
|
|
1105
|
+
let a = e[i], o = F(i, a);
|
|
1106
|
+
o !== "" && (L.has(i) ? (t.push(be(i, o)), ye(i, a) || (n = !1)) : r.push({
|
|
1107
|
+
property: I(i),
|
|
1108
1108
|
value: o
|
|
1109
1109
|
}));
|
|
1110
1110
|
}
|
|
@@ -1112,7 +1112,7 @@ var j = /* @__PURE__ */ new Map(), M = {
|
|
|
1112
1112
|
property: "transform",
|
|
1113
1113
|
value: n ? "none" : t.join(" ")
|
|
1114
1114
|
}), r;
|
|
1115
|
-
},
|
|
1115
|
+
}, B = (e) => e.map((e) => ` ${e.property}: ${e.value};`).join("\n"), V = (e) => Array.isArray(e) ? e.length === 4 && e.every((e) => typeof e == "number") ? `cubic-bezier(${e.join(", ")})` : "linear" : typeof e == "string" ? {
|
|
1116
1116
|
linear: "linear",
|
|
1117
1117
|
easeIn: "ease-in",
|
|
1118
1118
|
easeOut: "ease-out",
|
|
@@ -1122,33 +1122,33 @@ var j = /* @__PURE__ */ new Map(), M = {
|
|
|
1122
1122
|
backIn: "cubic-bezier(0.31, 0.01, 0.66, -0.59)",
|
|
1123
1123
|
backOut: "cubic-bezier(0.33, 1.53, 0.69, 0.99)",
|
|
1124
1124
|
anticipate: "cubic-bezier(0.36, 0, 0.66, -0.56)"
|
|
1125
|
-
}[e] ?? "ease" : "ease",
|
|
1125
|
+
}[e] ?? "ease" : "ease", H = (e) => {
|
|
1126
1126
|
if (!e) return 0;
|
|
1127
1127
|
let t = e.duration;
|
|
1128
1128
|
return typeof t == "number" && t >= 0 ? t : 0;
|
|
1129
|
-
},
|
|
1129
|
+
}, xe = (e) => e && typeof e.delay == "number" && e.delay > 0 ? e.delay : 0, Se = (e, t) => {
|
|
1130
1130
|
let [n, r] = t.split("-");
|
|
1131
1131
|
return `[data-flemo-screen][data-flemo-transition="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1132
|
-
},
|
|
1132
|
+
}, Ce = (e, t) => {
|
|
1133
1133
|
let [n, r] = t.split("-");
|
|
1134
1134
|
return `[data-flemo-decorator][data-flemo-decorator-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1135
|
-
},
|
|
1135
|
+
}, we = (e, t) => {
|
|
1136
1136
|
let [n, r] = t.split("-");
|
|
1137
1137
|
return `[data-flemo-bar][data-flemo-bar-transition="${e}"][data-flemo-bar-status="${n}"][data-flemo-bar-active="${r}"][data-flemo-bar-riding="true"]`;
|
|
1138
|
-
},
|
|
1138
|
+
}, Te = (e, t) => {
|
|
1139
1139
|
let [n, r] = t.split("-");
|
|
1140
1140
|
return `[data-flemo-part-name="${e}"][data-flemo-status="${n}"][data-flemo-active="${r}"]`;
|
|
1141
|
-
},
|
|
1142
|
-
let o =
|
|
1141
|
+
}, U = (e, t, n) => `flemo-${e}-${pe(t)}-${n}`, W = (e, t, n, r, i, a) => {
|
|
1142
|
+
let o = z(r), s = z(i.value), c = H(i.options), l = xe(i.options), u = V(i.options?.ease), d = a(t, n), f = e === "screen" ? `${d},\n${we(t, n)}` : d;
|
|
1143
1143
|
if (s.length === 0 && o.length === 0) return "";
|
|
1144
|
-
if (c <= 0 && l <= 0) return s.length === 0 ? "" : `${f} {\n${
|
|
1145
|
-
let p =
|
|
1144
|
+
if (c <= 0 && l <= 0) return s.length === 0 ? "" : `${f} {\n${B(s)}\n animation: none;\n}`;
|
|
1145
|
+
let p = U(e, t, n), m = [
|
|
1146
1146
|
`@keyframes ${p} {`,
|
|
1147
1147
|
" from {",
|
|
1148
|
-
|
|
1148
|
+
B(o).replace(/^/gm, " "),
|
|
1149
1149
|
" }",
|
|
1150
1150
|
" to {",
|
|
1151
|
-
|
|
1151
|
+
B(s).replace(/^/gm, " "),
|
|
1152
1152
|
" }",
|
|
1153
1153
|
"}"
|
|
1154
1154
|
].join("\n"), h = [
|
|
@@ -1159,84 +1159,89 @@ var j = /* @__PURE__ */ new Map(), M = {
|
|
|
1159
1159
|
"both"
|
|
1160
1160
|
].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];
|
|
1161
1161
|
return `${m}\n${`${f} {\n animation: ${h};\n${_}${v === "PUSHING" || v === "REPLACING" ? " contain: layout;\n pointer-events: none;\n" : ""}}`}`;
|
|
1162
|
-
},
|
|
1163
|
-
let i =
|
|
1164
|
-
return i.length === 0 ? "" : `${e(t, n)} {\n${
|
|
1165
|
-
},
|
|
1162
|
+
}, G = (e, t, n, r) => {
|
|
1163
|
+
let i = z(r.value);
|
|
1164
|
+
return i.length === 0 ? "" : `${e(t, n)} {\n${B(i)}\n}`;
|
|
1165
|
+
}, Ee = (e, t, n = []) => {
|
|
1166
1166
|
let r = [];
|
|
1167
1167
|
for (let t of e) {
|
|
1168
1168
|
let e = t.name;
|
|
1169
1169
|
for (let n of fe) {
|
|
1170
1170
|
let i = t.variants[n], a = M[n];
|
|
1171
1171
|
if (a === "self") {
|
|
1172
|
-
r.push(
|
|
1172
|
+
r.push(G(Se, e, n, i));
|
|
1173
1173
|
continue;
|
|
1174
1174
|
}
|
|
1175
1175
|
let o = a === "initial" ? t.initial : t.variants[a].value;
|
|
1176
|
-
r.push(
|
|
1176
|
+
r.push(W("screen", e, n, o, i, Se));
|
|
1177
1177
|
}
|
|
1178
1178
|
}
|
|
1179
1179
|
for (let e of t) {
|
|
1180
1180
|
let t = e.name;
|
|
1181
|
-
for (let n of
|
|
1181
|
+
for (let n of N) {
|
|
1182
1182
|
let i = e.variants[n], a = M[n];
|
|
1183
1183
|
if (a === "self") {
|
|
1184
|
-
r.push(
|
|
1184
|
+
r.push(G(Ce, t, n, i));
|
|
1185
1185
|
continue;
|
|
1186
1186
|
}
|
|
1187
1187
|
let o = a === "initial" ? e.initial : e.variants[a].value;
|
|
1188
|
-
r.push(
|
|
1188
|
+
r.push(W("decorator", t, n, o, i, Ce));
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
1191
|
for (let e of n) {
|
|
1192
1192
|
let t = e.name;
|
|
1193
|
-
for (let n of
|
|
1193
|
+
for (let n of N) {
|
|
1194
1194
|
let i = e.variants[n], a = M[n];
|
|
1195
1195
|
if (a === "self") {
|
|
1196
|
-
r.push(
|
|
1196
|
+
r.push(G(Te, t, n, i));
|
|
1197
1197
|
continue;
|
|
1198
1198
|
}
|
|
1199
1199
|
let o = a === "initial" ? e.initial : e.variants[a].value;
|
|
1200
|
-
r.push(
|
|
1200
|
+
r.push(W("part", t, n, o, i, Te));
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
1203
|
-
return r.filter((e) => e.length > 0).join("\n\n");
|
|
1204
|
-
},
|
|
1203
|
+
return [...r.filter((e) => e.length > 0), De].join("\n\n");
|
|
1204
|
+
}, De = [
|
|
1205
|
+
"[data-flemo-anim-hold=\"true\"],",
|
|
1206
|
+
"[data-flemo-anim-hold=\"true\"] [data-flemo-part-name] {",
|
|
1207
|
+
" animation-play-state: paused !important;",
|
|
1208
|
+
"}"
|
|
1209
|
+
].join("\n"), Oe = (e, t) => {
|
|
1205
1210
|
let n = M[t];
|
|
1206
1211
|
if (n === "self") return !1;
|
|
1207
|
-
let r = e.variants[t], i =
|
|
1212
|
+
let r = e.variants[t], i = H(r.options), a = xe(r.options);
|
|
1208
1213
|
if (i <= 0 && a <= 0) return !1;
|
|
1209
|
-
let o =
|
|
1214
|
+
let o = z(n === "initial" ? e.initial : e.variants[n].value), s = z(r.value);
|
|
1210
1215
|
return o.length > 0 || s.length > 0;
|
|
1211
1216
|
}, ke = "data-flemo";
|
|
1212
1217
|
function Ae() {
|
|
1213
1218
|
if (c()) return;
|
|
1214
|
-
let e =
|
|
1219
|
+
let e = Ee(k.values(), le.values(), j.values()), t = document.head.querySelector(`style[${ke}]`);
|
|
1215
1220
|
t || (t = document.createElement("style"), t.setAttribute(ke, ""), document.head.appendChild(t)), t.textContent !== e && (t.textContent = e);
|
|
1216
1221
|
}
|
|
1217
1222
|
//#endregion
|
|
1218
1223
|
//#region src/transition/animateInline.ts
|
|
1219
|
-
var je = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement,
|
|
1220
|
-
let n =
|
|
1221
|
-
n || (n = /* @__PURE__ */ new Set(),
|
|
1222
|
-
},
|
|
1224
|
+
var je = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, K = /* @__PURE__ */ new WeakMap(), Me = (e, t) => {
|
|
1225
|
+
let n = K.get(e);
|
|
1226
|
+
n || (n = /* @__PURE__ */ new Set(), K.set(e, n)), n.add(t);
|
|
1227
|
+
}, q = (e, t) => {
|
|
1223
1228
|
if (e.style.transition = "", t) {
|
|
1224
|
-
let n =
|
|
1229
|
+
let n = K.get(e);
|
|
1225
1230
|
for (let r of t) e.style.removeProperty(r), n?.delete(r);
|
|
1226
1231
|
return;
|
|
1227
1232
|
}
|
|
1228
|
-
let n =
|
|
1233
|
+
let n = K.get(e);
|
|
1229
1234
|
if (n && n.size > 0) {
|
|
1230
1235
|
for (let t of n) e.style.removeProperty(t);
|
|
1231
1236
|
n.clear();
|
|
1232
1237
|
return;
|
|
1233
1238
|
}
|
|
1234
1239
|
e.style.removeProperty("transform"), e.style.removeProperty("opacity");
|
|
1235
|
-
},
|
|
1240
|
+
}, J = (e, t, n = {}) => {
|
|
1236
1241
|
if (!je(e)) return Promise.resolve();
|
|
1237
|
-
let r = e, i =
|
|
1242
|
+
let r = e, i = z(t);
|
|
1238
1243
|
if (i.length === 0) return Promise.resolve();
|
|
1239
|
-
let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s =
|
|
1244
|
+
let a = typeof n.duration == "number" ? n.duration : 0, o = typeof n.delay == "number" && n.delay > 0 ? n.delay : 0, s = V(n.ease);
|
|
1240
1245
|
if (a <= 0 && o <= 0) {
|
|
1241
1246
|
r.style.transition = "none";
|
|
1242
1247
|
for (let e of i) r.style.setProperty(e.property, e.value), Me(r, e.property);
|
|
@@ -1253,27 +1258,27 @@ var je = (e) => typeof HTMLElement < "u" && e instanceof HTMLElement, G = /* @__
|
|
|
1253
1258
|
};
|
|
1254
1259
|
r.addEventListener("transitionend", i), setTimeout(n, (a + o) * 1e3 + 60);
|
|
1255
1260
|
});
|
|
1256
|
-
},
|
|
1261
|
+
}, Y = "data-flemo-skip-animation", X = () => {};
|
|
1257
1262
|
function Ne(e) {
|
|
1258
1263
|
return { driveScreenLifecycle: (t) => {
|
|
1259
1264
|
let { getElements: n, transitionName: i, prevTransitionName: a, status: o, isActive: s } = t;
|
|
1260
|
-
if (!s) return o === "REPLACING" && a !== i && e.setReplaceTransitionStatus("PENDING"),
|
|
1265
|
+
if (!s) return o === "REPLACING" && a !== i && e.setReplaceTransitionStatus("PENDING"), X;
|
|
1261
1266
|
if (o === "COMPLETED") {
|
|
1262
1267
|
e.setDragStatus("IDLE"), e.setReplaceTransitionStatus("IDLE");
|
|
1263
1268
|
let { scope: t, decorator: r, bars: i } = n();
|
|
1264
|
-
t && (
|
|
1265
|
-
for (let e of i ?? []) e && (
|
|
1266
|
-
return
|
|
1269
|
+
t && (q(t), t.removeAttribute(Y)), r && (q(r), r.removeAttribute(Y));
|
|
1270
|
+
for (let e of i ?? []) e && (q(e), e.style.removeProperty("will-change"));
|
|
1271
|
+
return X;
|
|
1267
1272
|
}
|
|
1268
|
-
if (o === "IDLE") return
|
|
1273
|
+
if (o === "IDLE") return X;
|
|
1269
1274
|
let { scope: c } = n();
|
|
1270
|
-
if (!c) return
|
|
1275
|
+
if (!c) return X;
|
|
1271
1276
|
let l = () => {
|
|
1272
1277
|
let t = e.getTransitionTaskId();
|
|
1273
1278
|
t && r.resolveTask(t);
|
|
1274
|
-
}, u =
|
|
1275
|
-
if (!(c.getAttribute("data-flemo-skip-animation") !== "true" && Oe(u, d))) return queueMicrotask(l),
|
|
1276
|
-
let f =
|
|
1279
|
+
}, u = k.get(i) ?? k.get("none"), d = `${o}-true`;
|
|
1280
|
+
if (!(c.getAttribute("data-flemo-skip-animation") !== "true" && Oe(u, d))) return queueMicrotask(l), X;
|
|
1281
|
+
let f = U("screen", i, d), p = (e) => {
|
|
1277
1282
|
e.target === c && e.animationName === f && (c.removeEventListener("animationend", p), l());
|
|
1278
1283
|
};
|
|
1279
1284
|
return c.addEventListener("animationend", p), () => {
|
|
@@ -1283,20 +1288,20 @@ function Ne(e) {
|
|
|
1283
1288
|
}
|
|
1284
1289
|
//#endregion
|
|
1285
1290
|
//#region src/utils/findScrollable.ts
|
|
1286
|
-
function
|
|
1291
|
+
function Z(e, t) {
|
|
1287
1292
|
let { direction: n = "x", markerSelector: r = "[data-swipe-at-edge]", depthLimit: i = 24, verifyByScroll: a = !1 } = t ?? {}, o = Pe(e);
|
|
1288
1293
|
if (!o) return {
|
|
1289
1294
|
element: null,
|
|
1290
1295
|
hasMarker: !1
|
|
1291
1296
|
};
|
|
1292
1297
|
let s = o.closest?.(r);
|
|
1293
|
-
if (s instanceof HTMLElement &&
|
|
1298
|
+
if (s instanceof HTMLElement && Q(s, n) && (!a || $(s, n))) return {
|
|
1294
1299
|
element: s,
|
|
1295
1300
|
hasMarker: !0
|
|
1296
1301
|
};
|
|
1297
1302
|
let c = o, l = 0;
|
|
1298
1303
|
for (; c && l < i;) {
|
|
1299
|
-
if (
|
|
1304
|
+
if (Q(c, n) && (!a || $(c, n))) return {
|
|
1300
1305
|
element: c,
|
|
1301
1306
|
hasMarker: !1
|
|
1302
1307
|
};
|
|
@@ -1315,11 +1320,11 @@ function Pe(e) {
|
|
|
1315
1320
|
}
|
|
1316
1321
|
return e instanceof HTMLElement ? e : null;
|
|
1317
1322
|
}
|
|
1318
|
-
function
|
|
1323
|
+
function Q(e, t) {
|
|
1319
1324
|
return t === "y" ? e.scrollHeight - e.clientHeight > 1 : e.scrollWidth - e.clientWidth > 1;
|
|
1320
1325
|
}
|
|
1321
|
-
function
|
|
1322
|
-
if (!
|
|
1326
|
+
function $(e, t) {
|
|
1327
|
+
if (!Q(e, t) || typeof window > "u") return !1;
|
|
1323
1328
|
let n = window.getComputedStyle(e), r = t === "y" ? n.overflowY : n.overflowX;
|
|
1324
1329
|
return r === "auto" || r === "scroll" || r === "overlay";
|
|
1325
1330
|
}
|
|
@@ -1372,9 +1377,9 @@ function Ie(e) {
|
|
|
1372
1377
|
y: e.clientY
|
|
1373
1378
|
}, u = t;
|
|
1374
1379
|
}, v = (n, i, a) => {
|
|
1375
|
-
let o =
|
|
1376
|
-
if (n === e.getElements().scope) for (let e of r.current)
|
|
1377
|
-
else if (n === t) for (let e of r.prev)
|
|
1380
|
+
let o = J(n, i, a);
|
|
1381
|
+
if (n === e.getElements().scope) for (let e of r.current) J(e, i, a);
|
|
1382
|
+
else if (n === t) for (let e of r.prev) J(e, i, a);
|
|
1378
1383
|
return o;
|
|
1379
1384
|
}, y = (t) => {
|
|
1380
1385
|
let n = e.getPartnerBars(), i = [], { sharedTopBar: a, sharedBottomBar: o } = e.getElements();
|
|
@@ -1388,12 +1393,12 @@ function Ie(e) {
|
|
|
1388
1393
|
current: i,
|
|
1389
1394
|
prev: s
|
|
1390
1395
|
};
|
|
1391
|
-
let c =
|
|
1396
|
+
let c = R(e.getTransition()).join(", ");
|
|
1392
1397
|
for (let e of i) e.style.willChange = c;
|
|
1393
1398
|
for (let e of s) e.style.willChange = c;
|
|
1394
1399
|
}, b = () => {
|
|
1395
|
-
for (let e of r.current)
|
|
1396
|
-
for (let e of r.prev)
|
|
1400
|
+
for (let e of r.current) q(e), e.style.removeProperty("will-change");
|
|
1401
|
+
for (let e of r.prev) q(e), e.style.removeProperty("will-change");
|
|
1397
1402
|
r = {
|
|
1398
1403
|
current: [],
|
|
1399
1404
|
prev: []
|
|
@@ -1409,7 +1414,7 @@ function Ie(e) {
|
|
|
1409
1414
|
let a = j.get(r.getAttribute("data-flemo-part-name"));
|
|
1410
1415
|
if (!a) return;
|
|
1411
1416
|
let o = {
|
|
1412
|
-
animate:
|
|
1417
|
+
animate: J,
|
|
1413
1418
|
element: r,
|
|
1414
1419
|
active: i
|
|
1415
1420
|
};
|
|
@@ -1418,7 +1423,7 @@ function Ie(e) {
|
|
|
1418
1423
|
for (let e of i.current) r(e, !0);
|
|
1419
1424
|
for (let e of i.prev) r(e, !1);
|
|
1420
1425
|
}, C = () => {
|
|
1421
|
-
for (let e of [...i.current, ...i.prev])
|
|
1426
|
+
for (let e of [...i.current, ...i.prev]) q(e);
|
|
1422
1427
|
i = {
|
|
1423
1428
|
current: [],
|
|
1424
1429
|
prev: []
|
|
@@ -1447,7 +1452,7 @@ function Ie(e) {
|
|
|
1447
1452
|
prevScreen: t,
|
|
1448
1453
|
onStart: (e) => {
|
|
1449
1454
|
m?.onSwipeStart?.(e, {
|
|
1450
|
-
animate:
|
|
1455
|
+
animate: J,
|
|
1451
1456
|
currentDecorator: f,
|
|
1452
1457
|
prevDecorator: n
|
|
1453
1458
|
}), S("start", e, 0);
|
|
@@ -1464,7 +1469,7 @@ function Ie(e) {
|
|
|
1464
1469
|
prevScreen: t,
|
|
1465
1470
|
onProgress: (e, t) => {
|
|
1466
1471
|
c?.onSwipe?.(e, t, {
|
|
1467
|
-
animate:
|
|
1472
|
+
animate: J,
|
|
1468
1473
|
currentDecorator: o,
|
|
1469
1474
|
prevDecorator: n
|
|
1470
1475
|
}), S("swipe", e, t);
|
|
@@ -1483,7 +1488,7 @@ function Ie(e) {
|
|
|
1483
1488
|
prevScreen: t,
|
|
1484
1489
|
onStart: (e) => {
|
|
1485
1490
|
u?.onSwipeEnd?.(e, {
|
|
1486
|
-
animate:
|
|
1491
|
+
animate: J,
|
|
1487
1492
|
currentDecorator: l,
|
|
1488
1493
|
prevDecorator: n
|
|
1489
1494
|
}), S("end", e, 0);
|
|
@@ -1491,24 +1496,24 @@ function Ie(e) {
|
|
|
1491
1496
|
})) {
|
|
1492
1497
|
c?.setAttribute(Fe, "true"), l?.setAttribute(Fe, "true");
|
|
1493
1498
|
for (let e of r.current) e.style.removeProperty("will-change");
|
|
1494
|
-
for (let e of r.prev)
|
|
1499
|
+
for (let e of r.prev) q(e), e.style.removeProperty("will-change");
|
|
1495
1500
|
r = {
|
|
1496
1501
|
current: [],
|
|
1497
1502
|
prev: []
|
|
1498
1503
|
};
|
|
1499
|
-
for (let e of i.prev)
|
|
1504
|
+
for (let e of i.prev) q(e);
|
|
1500
1505
|
i = {
|
|
1501
1506
|
current: [],
|
|
1502
1507
|
prev: []
|
|
1503
1508
|
}, e.back();
|
|
1504
|
-
} else c &&
|
|
1509
|
+
} else c && q(c), t && q(t), l && q(l), n && q(n), b(), C(), e.setDragStatus("IDLE");
|
|
1505
1510
|
};
|
|
1506
1511
|
return {
|
|
1507
1512
|
pointerDown: (t) => {
|
|
1508
|
-
e.isReadyForDrag() && (f =
|
|
1513
|
+
e.isReadyForDrag() && (f = Z(t.target, {
|
|
1509
1514
|
direction: "x",
|
|
1510
1515
|
verifyByScroll: !0
|
|
1511
|
-
}), p =
|
|
1516
|
+
}), p = Z(t.target, {
|
|
1512
1517
|
direction: "y",
|
|
1513
1518
|
verifyByScroll: !0
|
|
1514
1519
|
}), m = t.clientX, h = t.clientY, (!f.element && !p.element || f.element || p.element) && (a = !0));
|
|
@@ -1536,25 +1541,29 @@ function Ie(e) {
|
|
|
1536
1541
|
};
|
|
1537
1542
|
}
|
|
1538
1543
|
//#endregion
|
|
1539
|
-
//#region src/
|
|
1540
|
-
var $ = "data-flemo-bar-riding";
|
|
1544
|
+
//#region src/screen/computeBarRiding.ts
|
|
1541
1545
|
function Le(e) {
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
return;
|
|
1549
|
-
}
|
|
1550
|
-
let i = e.getHistories(), a = e.isActive ? i[e.index - 1]?.id : i[e.index]?.id, o = a ? e.getSharedBars()[a] : void 0, s = e.hasTopBar && !o?.topBar, c = e.hasNavBar && !o?.bottomBar;
|
|
1551
|
-
t && t.setAttribute($, s ? "true" : "false"), n && n.setAttribute($, c ? "true" : "false");
|
|
1546
|
+
return !(e.status === "PUSHING" || e.status === "POPPING" || e.status === "REPLACING") || !e.isTopOrTopPrev ? {
|
|
1547
|
+
app: !1,
|
|
1548
|
+
nav: !1
|
|
1549
|
+
} : {
|
|
1550
|
+
app: e.hasTopBar && !e.partnerBars?.topBar,
|
|
1551
|
+
nav: e.hasNavBar && !e.partnerBars?.bottomBar
|
|
1552
1552
|
};
|
|
1553
|
-
|
|
1554
|
-
|
|
1553
|
+
}
|
|
1554
|
+
//#endregion
|
|
1555
|
+
//#region src/screen/animStartAnchor.ts
|
|
1556
|
+
function Re(e) {
|
|
1557
|
+
return !(e.status === "PUSHING" || e.status === "POPPING" || e.status === "REPLACING") || !e.isTopOrTopPrev ? null : `${e.status}:${e.transitionName}`;
|
|
1558
|
+
}
|
|
1559
|
+
var ze = 300;
|
|
1560
|
+
function Be(e) {
|
|
1561
|
+
let t = 0, n = requestAnimationFrame(() => {
|
|
1562
|
+
t = requestAnimationFrame(e);
|
|
1563
|
+
}), r = setTimeout(e, 300);
|
|
1555
1564
|
return () => {
|
|
1556
|
-
|
|
1565
|
+
cancelAnimationFrame(n), t && cancelAnimationFrame(t), clearTimeout(r);
|
|
1557
1566
|
};
|
|
1558
1567
|
}
|
|
1559
1568
|
//#endregion
|
|
1560
|
-
export {
|
|
1569
|
+
export { ze as ANIM_HOLD_RELEASE_BACKSTOP_MS, Y as SKIP_ANIMATION_ATTR, r as TaskManger, Re as animHoldKey, J as animateInline, U as animationName, Ae as applyTransitionStyles, $ as canProgrammaticallyScroll, q as clearInlineAnimation, R as collectAnimatedProperties, Ee as compileTransitionStyles, Le as computeBarRiding, ee as computeScreenFreeze, h as consumeSelfInducedPop, d as createBrowserHistoryDriver, oe as createDecorator, i as createHistoryStore, g as createHistorySync, _ as createMemoryHistoryDriver, v as createNavigateStore, S as createNavigationController, ue as createPartTransition, se as createRawDecorator, de as createRawPartTransition, te as createRawTransition, w as createScreenSelector, C as createScreenStore, f as createSelfPopGuard, Ie as createSwipeController, T as createTransition, Ne as createTransitionEngine, ae as createTransitionStore, re as cupertino, le as decoratorMap, V as easingToCss, l as ensureWindowHistoryState, Z as findScrollable, a as getMatchedPathPattern, o as getParams, c as isServer, E as layout, m as markSelfInducedPop, D as material, O as none, Q as overflowsAxis, ce as overlay, j as partTransitionMap, Be as scheduleAnimHoldRelease, s as seedInitialHistory, z as targetToDecls, k as transitionMap, Oe as variantHasAnimation };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NavigateStatus } from '../navigate/store';
|
|
2
|
+
export interface AnimHoldInput {
|
|
3
|
+
status: NavigateStatus;
|
|
4
|
+
isTopOrTopPrev: boolean;
|
|
5
|
+
transitionName: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function animHoldKey(input: AnimHoldInput): string | null;
|
|
8
|
+
export declare const ANIM_HOLD_RELEASE_BACKSTOP_MS = 300;
|
|
9
|
+
export declare function scheduleAnimHoldRelease(release: () => void): () => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { NavigateStatus } from '../navigate/store';
|
|
2
|
+
import { SharedBarPresenceLike } from '../core/engine/createSwipeController';
|
|
3
|
+
export interface BarRidingInput {
|
|
4
|
+
status: NavigateStatus;
|
|
5
|
+
isTopOrTopPrev: boolean;
|
|
6
|
+
hasTopBar: boolean;
|
|
7
|
+
hasNavBar: boolean;
|
|
8
|
+
partnerBars: SharedBarPresenceLike | undefined;
|
|
9
|
+
}
|
|
10
|
+
export default function computeBarRiding(input: BarRidingInput): {
|
|
11
|
+
app: boolean;
|
|
12
|
+
nav: boolean;
|
|
13
|
+
};
|
package/package.json
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { History } from '../../history/store';
|
|
2
|
-
import { NavigateStatus } from '../../navigate/store';
|
|
3
|
-
import { SharedBarPresenceLike } from './createSwipeController';
|
|
4
|
-
export interface BarRidingInput {
|
|
5
|
-
topBar: HTMLElement | null;
|
|
6
|
-
navBar: HTMLElement | null;
|
|
7
|
-
isTopOrTopPrev: boolean;
|
|
8
|
-
isActive: boolean;
|
|
9
|
-
index: number;
|
|
10
|
-
hasTopBar: boolean;
|
|
11
|
-
hasNavBar: boolean;
|
|
12
|
-
getStatus: () => NavigateStatus;
|
|
13
|
-
getHistories: () => History[];
|
|
14
|
-
getSharedBars: () => Record<string, SharedBarPresenceLike | undefined>;
|
|
15
|
-
subscribeStatus: (listener: () => void) => () => void;
|
|
16
|
-
subscribeSharedBars: (listener: () => void) => () => void;
|
|
17
|
-
}
|
|
18
|
-
export default function driveBarRiding(input: BarRidingInput): () => void;
|
|
File without changes
|