react-native-screen-transitions 3.4.0-beta.0 → 3.4.0-beta.2
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/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js +6 -5
- package/lib/commonjs/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +4 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +28 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/commonjs/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.js → use-pre-transition-measurement.js} +7 -5
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
- package/lib/commonjs/shared/constants.js +1 -2
- package/lib/commonjs/shared/constants.js.map +1 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js +9 -1
- package/lib/commonjs/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/clear.js +23 -167
- package/lib/commonjs/shared/stores/bounds/internals/clear.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/presence.js +0 -3
- package/lib/commonjs/shared/stores/bounds/internals/presence.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/registry.js +0 -5
- package/lib/commonjs/shared/stores/bounds/internals/registry.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js +0 -3
- package/lib/commonjs/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/commonjs/shared/stores/bounds/internals/state.js +1 -83
- package/lib/commonjs/shared/stores/bounds/internals/state.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/constants.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +5 -5
- package/lib/commonjs/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +6 -6
- package/lib/commonjs/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
- package/lib/commonjs/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js +70 -0
- package/lib/commonjs/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
- package/lib/commonjs/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +9 -9
- package/lib/commonjs/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
- package/lib/commonjs/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
- package/lib/commonjs/shared/utils/bounds/index.js +16 -44
- package/lib/commonjs/shared/utils/bounds/index.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/build.js +135 -31
- package/lib/commonjs/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.js +8 -1
- package/lib/commonjs/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/commonjs/shared/utils/bounds/zoom/math.js +34 -1
- package/lib/commonjs/shared/utils/bounds/zoom/math.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/create-boundary-component.js +6 -5
- package/lib/module/shared/components/create-boundary-component/create-boundary-component.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js +4 -1
- package/lib/module/shared/components/create-boundary-component/hooks/helpers/measurement-rules.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js +29 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.js.map +1 -1
- package/lib/module/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.js → use-pre-transition-measurement.js} +5 -3
- package/lib/module/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.js.map +1 -0
- package/lib/module/shared/constants.js +1 -2
- package/lib/module/shared/constants.js.map +1 -1
- package/lib/module/shared/providers/register-bounds.provider.js +9 -1
- package/lib/module/shared/providers/register-bounds.provider.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/clear.js +24 -168
- package/lib/module/shared/stores/bounds/internals/clear.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/presence.js +1 -4
- package/lib/module/shared/stores/bounds/internals/presence.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/registry.js +1 -6
- package/lib/module/shared/stores/bounds/internals/registry.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/resolver.js +1 -4
- package/lib/module/shared/stores/bounds/internals/resolver.js.map +1 -1
- package/lib/module/shared/stores/bounds/internals/state.js +0 -78
- package/lib/module/shared/stores/bounds/internals/state.js.map +1 -1
- package/lib/module/shared/utils/bounds/constants.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{resolve-bound-tag.js → create-bound-tag.js} +3 -3
- package/lib/module/shared/utils/bounds/helpers/create-bound-tag.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{interpolators.js → create-interpolators.js} +5 -5
- package/lib/module/shared/utils/bounds/helpers/create-interpolators.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{link-accessor.js → create-link-accessor.js} +1 -1
- package/lib/module/shared/utils/bounds/helpers/create-link-accessor.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js +64 -0
- package/lib/module/shared/utils/bounds/helpers/prepare-bound-styles.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{style-composers.js → styles/composers.js} +22 -22
- package/lib/module/shared/utils/bounds/helpers/styles/composers.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{compute-bounds-styles.js → styles/compute.js} +7 -7
- package/lib/module/shared/utils/bounds/helpers/styles/compute.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/{interpolate-style.js → styles/interpolate-link-style.js} +4 -4
- package/lib/module/shared/utils/bounds/helpers/styles/interpolate-link-style.js.map +1 -0
- package/lib/module/shared/utils/bounds/helpers/styles/styles.js.map +1 -0
- package/lib/module/shared/utils/bounds/index.js +14 -42
- package/lib/module/shared/utils/bounds/index.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/build.js +138 -34
- package/lib/module/shared/utils/bounds/zoom/build.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/config.js +7 -0
- package/lib/module/shared/utils/bounds/zoom/config.js.map +1 -1
- package/lib/module/shared/utils/bounds/zoom/math.js +31 -0
- package/lib/module/shared/utils/bounds/zoom/math.js.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/create-boundary-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts +1 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/helpers/measurement-rules.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts +14 -0
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.d.ts.map +1 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.d.ts → use-pre-transition-measurement.d.ts} +2 -2
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-pre-transition-measurement.d.ts.map +1 -0
- package/lib/typescript/shared/constants.d.ts +0 -1
- package/lib/typescript/shared/constants.d.ts.map +1 -1
- package/lib/typescript/shared/index.d.ts +1 -1
- package/lib/typescript/shared/index.d.ts.map +1 -1
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts +7 -0
- package/lib/typescript/shared/providers/register-bounds.provider.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/clear.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/presence.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/registry.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/resolver.d.ts.map +1 -1
- package/lib/typescript/shared/stores/bounds/internals/state.d.ts +0 -3
- package/lib/typescript/shared/stores/bounds/internals/state.d.ts.map +1 -1
- package/lib/typescript/shared/types/bounds.types.d.ts +72 -0
- package/lib/typescript/shared/types/bounds.types.d.ts.map +1 -1
- package/lib/typescript/shared/types/index.d.ts +1 -1
- package/lib/typescript/shared/types/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/constants.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts +7 -0
- package/lib/typescript/shared/utils/bounds/helpers/create-bound-tag.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{interpolators.d.ts → create-interpolators.d.ts} +3 -3
- package/lib/typescript/shared/utils/bounds/helpers/create-interpolators.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{link-accessor.d.ts → create-link-accessor.d.ts} +1 -1
- package/lib/typescript/shared/utils/bounds/helpers/create-link-accessor.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts +20 -0
- package/lib/typescript/shared/utils/bounds/helpers/prepare-bound-styles.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{style-composers.d.ts → styles/composers.d.ts} +4 -4
- package/lib/typescript/shared/utils/bounds/helpers/styles/composers.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{compute-bounds-styles.d.ts → styles/compute.d.ts} +3 -3
- package/lib/typescript/shared/utils/bounds/helpers/styles/compute.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/{interpolate-style.d.ts → styles/interpolate-link-style.d.ts} +2 -2
- package/lib/typescript/shared/utils/bounds/helpers/styles/interpolate-link-style.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/helpers/styles/styles.d.ts.map +1 -0
- package/lib/typescript/shared/utils/bounds/index.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/types/options.d.ts +3 -2
- package/lib/typescript/shared/utils/bounds/types/options.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/build.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts +7 -0
- package/lib/typescript/shared/utils/bounds/zoom/config.d.ts.map +1 -1
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts +17 -0
- package/lib/typescript/shared/utils/bounds/zoom/math.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/components/create-boundary-component/create-boundary-component.tsx +6 -5
- package/src/shared/components/create-boundary-component/hooks/helpers/measurement-rules.ts +6 -1
- package/src/shared/components/create-boundary-component/hooks/use-pending-destination-measurement.ts +28 -13
- package/src/shared/components/create-boundary-component/hooks/{use-prepare-transition-measurement.ts → use-pre-transition-measurement.ts} +8 -5
- package/src/shared/constants.ts +0 -1
- package/src/shared/index.ts +2 -0
- package/src/shared/providers/register-bounds.provider.tsx +8 -1
- package/src/shared/stores/bounds/internals/clear.ts +47 -220
- package/src/shared/stores/bounds/internals/presence.ts +1 -4
- package/src/shared/stores/bounds/internals/registry.ts +1 -11
- package/src/shared/stores/bounds/internals/resolver.ts +1 -9
- package/src/shared/stores/bounds/internals/state.ts +0 -98
- package/src/shared/types/bounds.types.ts +74 -0
- package/src/shared/types/index.ts +2 -0
- package/src/shared/utils/bounds/{helpers/constants.ts → constants.ts} +1 -1
- package/src/shared/utils/bounds/helpers/{resolve-bound-tag.ts → create-bound-tag.ts} +2 -2
- package/src/shared/utils/bounds/helpers/{interpolators.ts → create-interpolators.ts} +19 -12
- package/src/shared/utils/bounds/helpers/prepare-bound-styles.ts +100 -0
- package/src/shared/utils/bounds/helpers/{style-composers.ts → styles/composers.ts} +119 -53
- package/src/shared/utils/bounds/helpers/{compute-bounds-styles.ts → styles/compute.ts} +9 -9
- package/src/shared/utils/bounds/helpers/{interpolate-style.ts → styles/interpolate-link-style.ts} +9 -4
- package/src/shared/utils/bounds/index.ts +13 -53
- package/src/shared/utils/bounds/types/options.ts +3 -2
- package/src/shared/utils/bounds/zoom/build.ts +169 -61
- package/src/shared/utils/bounds/zoom/config.ts +9 -0
- package/src/shared/utils/bounds/zoom/math.ts +57 -0
- package/lib/commonjs/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js +0 -41
- package/lib/commonjs/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/constants.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js +0 -20
- package/lib/commonjs/shared/utils/bounds/helpers/interpolate.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/interpolators.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/style-composers.js.map +0 -1
- package/lib/commonjs/shared/utils/bounds/helpers/styles.js.map +0 -1
- package/lib/module/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js +0 -36
- package/lib/module/shared/utils/bounds/helpers/build-bounds-options.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/compute-bounds-styles.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/constants.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/interpolate-style.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/interpolate.js +0 -16
- package/lib/module/shared/utils/bounds/helpers/interpolate.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/interpolators.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/link-accessor.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/resolve-bound-tag.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/style-composers.js.map +0 -1
- package/lib/module/shared/utils/bounds/helpers/styles.js.map +0 -1
- package/lib/typescript/shared/components/create-boundary-component/hooks/use-prepare-transition-measurement.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts +0 -14
- package/lib/typescript/shared/utils/bounds/helpers/build-bounds-options.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/compute-bounds-styles.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/constants.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolate-style.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts +0 -2
- package/lib/typescript/shared/utils/bounds/helpers/interpolate.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/interpolators.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/link-accessor.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts +0 -7
- package/lib/typescript/shared/utils/bounds/helpers/resolve-bound-tag.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/style-composers.d.ts.map +0 -1
- package/lib/typescript/shared/utils/bounds/helpers/styles.d.ts.map +0 -1
- package/src/shared/utils/bounds/helpers/build-bounds-options.ts +0 -48
- package/src/shared/utils/bounds/helpers/interpolate.ts +0 -19
- /package/lib/commonjs/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
- /package/lib/commonjs/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
- /package/lib/module/shared/utils/bounds/{helpers/constants.js → constants.js} +0 -0
- /package/lib/module/shared/utils/bounds/helpers/{styles.js → styles/styles.js} +0 -0
- /package/lib/typescript/shared/utils/bounds/{helpers/constants.d.ts → constants.d.ts} +0 -0
- /package/lib/typescript/shared/utils/bounds/helpers/{styles.d.ts → styles/styles.d.ts} +0 -0
- /package/src/shared/utils/bounds/helpers/{link-accessor.ts → create-link-accessor.ts} +0 -0
- /package/src/shared/utils/bounds/helpers/{styles.ts → styles/styles.ts} +0 -0
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { matchesNavigatorKey, matchesScreenKey } from "../helpers/matching";
|
|
2
2
|
import type {
|
|
3
3
|
NavigatorKey,
|
|
4
|
+
PresenceEntry,
|
|
4
5
|
PresenceState,
|
|
5
6
|
ScreenKey,
|
|
6
7
|
SnapshotEntry,
|
|
7
8
|
TagLink,
|
|
8
9
|
} from "../types";
|
|
9
|
-
import {
|
|
10
|
-
debugClearLog,
|
|
11
|
-
debugStoreSizeLog,
|
|
12
|
-
presence,
|
|
13
|
-
type RegistryState,
|
|
14
|
-
registry,
|
|
15
|
-
} from "./state";
|
|
10
|
+
import { presence, type RegistryState, registry } from "./state";
|
|
16
11
|
|
|
17
12
|
const hasAnyKeys = (record: Record<string, unknown>) => {
|
|
18
13
|
"worklet";
|
|
@@ -22,128 +17,23 @@ const hasAnyKeys = (record: Record<string, unknown>) => {
|
|
|
22
17
|
return false;
|
|
23
18
|
};
|
|
24
19
|
|
|
25
|
-
|
|
20
|
+
type SnapshotPredicate = (
|
|
26
21
|
screenKey: ScreenKey,
|
|
27
|
-
|
|
28
|
-
)
|
|
29
|
-
"worklet";
|
|
30
|
-
const currentRegistry = registry.value;
|
|
31
|
-
let snapshots = 0;
|
|
32
|
-
let links = 0;
|
|
33
|
-
|
|
34
|
-
for (const tag in currentRegistry) {
|
|
35
|
-
const tagState = currentRegistry[tag];
|
|
36
|
-
|
|
37
|
-
for (const snapshotKey in tagState.snapshots) {
|
|
38
|
-
const snapshot = tagState.snapshots[snapshotKey];
|
|
39
|
-
const matched = matchByAncestor
|
|
40
|
-
? snapshotKey === screenKey ||
|
|
41
|
-
(snapshot.ancestorKeys?.includes(screenKey) ?? false)
|
|
42
|
-
: snapshotKey === screenKey;
|
|
43
|
-
if (matched) snapshots++;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
for (let i = 0; i < tagState.linkStack.length; i++) {
|
|
47
|
-
const link = tagState.linkStack[i];
|
|
48
|
-
if (
|
|
49
|
-
matchesScreenKey(link.source, screenKey) ||
|
|
50
|
-
matchesScreenKey(link.destination, screenKey)
|
|
51
|
-
) {
|
|
52
|
-
links++;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return { snapshots, links };
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const countRegistryMatchesByBranch = (
|
|
61
|
-
branchNavigatorKey: NavigatorKey,
|
|
62
|
-
): { snapshots: number; links: number } => {
|
|
63
|
-
"worklet";
|
|
64
|
-
const currentRegistry = registry.value;
|
|
65
|
-
let snapshots = 0;
|
|
66
|
-
let links = 0;
|
|
67
|
-
|
|
68
|
-
for (const tag in currentRegistry) {
|
|
69
|
-
const tagState = currentRegistry[tag];
|
|
70
|
-
|
|
71
|
-
for (const snapshotKey in tagState.snapshots) {
|
|
72
|
-
const snapshot = tagState.snapshots[snapshotKey];
|
|
73
|
-
const matched =
|
|
74
|
-
snapshot.navigatorKey === branchNavigatorKey ||
|
|
75
|
-
(snapshot.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false);
|
|
76
|
-
if (matched) snapshots++;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
for (let i = 0; i < tagState.linkStack.length; i++) {
|
|
80
|
-
const link = tagState.linkStack[i];
|
|
81
|
-
if (
|
|
82
|
-
matchesNavigatorKey(link.source, branchNavigatorKey) ||
|
|
83
|
-
matchesNavigatorKey(link.destination, branchNavigatorKey)
|
|
84
|
-
) {
|
|
85
|
-
links++;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
22
|
+
snapshot: SnapshotEntry,
|
|
23
|
+
) => boolean;
|
|
89
24
|
|
|
90
|
-
|
|
91
|
-
};
|
|
25
|
+
type LinkPredicate = (link: TagLink) => boolean;
|
|
92
26
|
|
|
93
|
-
|
|
27
|
+
type PresencePredicate = (
|
|
94
28
|
screenKey: ScreenKey,
|
|
95
|
-
|
|
96
|
-
)
|
|
97
|
-
"worklet";
|
|
98
|
-
const currentPresence = presence.value;
|
|
99
|
-
let matches = 0;
|
|
100
|
-
|
|
101
|
-
for (const tag in currentPresence) {
|
|
102
|
-
const tagEntries = currentPresence[tag];
|
|
103
|
-
for (const entryScreenKey in tagEntries) {
|
|
104
|
-
const entry = tagEntries[entryScreenKey];
|
|
105
|
-
const matched = matchByAncestor
|
|
106
|
-
? entryScreenKey === screenKey ||
|
|
107
|
-
(entry.ancestorKeys?.includes(screenKey) ?? false)
|
|
108
|
-
: entryScreenKey === screenKey;
|
|
109
|
-
if (matched) matches++;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return matches;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const countPresenceMatchesByBranch = (
|
|
117
|
-
branchNavigatorKey: NavigatorKey,
|
|
118
|
-
): number => {
|
|
119
|
-
"worklet";
|
|
120
|
-
const currentPresence = presence.value;
|
|
121
|
-
let matches = 0;
|
|
122
|
-
|
|
123
|
-
for (const tag in currentPresence) {
|
|
124
|
-
const tagEntries = currentPresence[tag];
|
|
125
|
-
for (const entryScreenKey in tagEntries) {
|
|
126
|
-
const entry = tagEntries[entryScreenKey];
|
|
127
|
-
const matched =
|
|
128
|
-
entry.navigatorKey === branchNavigatorKey ||
|
|
129
|
-
(entry.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false);
|
|
130
|
-
if (matched) matches++;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return matches;
|
|
135
|
-
};
|
|
29
|
+
entry: PresenceEntry,
|
|
30
|
+
) => boolean;
|
|
136
31
|
|
|
137
|
-
const clearRegistry = (
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
) => boolean;
|
|
142
|
-
shouldRemoveLink: (link: TagLink) => boolean;
|
|
143
|
-
}) => {
|
|
32
|
+
const clearRegistry = (
|
|
33
|
+
shouldClearSnapshot: SnapshotPredicate,
|
|
34
|
+
shouldClearLink: LinkPredicate,
|
|
35
|
+
) => {
|
|
144
36
|
"worklet";
|
|
145
|
-
const { shouldRemoveSnapshot, shouldRemoveLink } = params;
|
|
146
|
-
|
|
147
37
|
registry.modify(<T extends RegistryState>(state: T): T => {
|
|
148
38
|
"worklet";
|
|
149
39
|
for (const tag in state) {
|
|
@@ -151,14 +41,14 @@ const clearRegistry = (params: {
|
|
|
151
41
|
|
|
152
42
|
for (const snapshotKey in tagState.snapshots) {
|
|
153
43
|
const snapshot = tagState.snapshots[snapshotKey];
|
|
154
|
-
if (
|
|
44
|
+
if (shouldClearSnapshot(snapshotKey, snapshot)) {
|
|
155
45
|
delete tagState.snapshots[snapshotKey];
|
|
156
46
|
}
|
|
157
47
|
}
|
|
158
48
|
|
|
159
49
|
for (let i = tagState.linkStack.length - 1; i >= 0; i--) {
|
|
160
50
|
const link = tagState.linkStack[i];
|
|
161
|
-
if (
|
|
51
|
+
if (shouldClearLink(link)) {
|
|
162
52
|
tagState.linkStack.splice(i, 1);
|
|
163
53
|
}
|
|
164
54
|
}
|
|
@@ -172,25 +62,7 @@ const clearRegistry = (params: {
|
|
|
172
62
|
});
|
|
173
63
|
};
|
|
174
64
|
|
|
175
|
-
const
|
|
176
|
-
"worklet";
|
|
177
|
-
presence.modify(<T extends PresenceState>(state: T): T => {
|
|
178
|
-
"worklet";
|
|
179
|
-
for (const tag in state) {
|
|
180
|
-
const tagEntries = state[tag];
|
|
181
|
-
if (!tagEntries[screenKey]) continue;
|
|
182
|
-
|
|
183
|
-
delete tagEntries[screenKey];
|
|
184
|
-
|
|
185
|
-
if (!hasAnyKeys(tagEntries)) {
|
|
186
|
-
delete state[tag];
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return state;
|
|
190
|
-
});
|
|
191
|
-
};
|
|
192
|
-
|
|
193
|
-
const clearPresenceByAncestor = (ancestorKey: ScreenKey) => {
|
|
65
|
+
const clearPresence = (shouldClearPresence: PresencePredicate) => {
|
|
194
66
|
"worklet";
|
|
195
67
|
presence.modify(<T extends PresenceState>(state: T): T => {
|
|
196
68
|
"worklet";
|
|
@@ -199,10 +71,7 @@ const clearPresenceByAncestor = (ancestorKey: ScreenKey) => {
|
|
|
199
71
|
|
|
200
72
|
for (const entryScreenKey in tagEntries) {
|
|
201
73
|
const entry = tagEntries[entryScreenKey];
|
|
202
|
-
|
|
203
|
-
entryScreenKey === ancestorKey ||
|
|
204
|
-
(entry.ancestorKeys?.includes(ancestorKey) ?? false);
|
|
205
|
-
if (shouldRemove) {
|
|
74
|
+
if (shouldClearPresence(entryScreenKey, entry)) {
|
|
206
75
|
delete tagEntries[entryScreenKey];
|
|
207
76
|
}
|
|
208
77
|
}
|
|
@@ -211,125 +80,83 @@ const clearPresenceByAncestor = (ancestorKey: ScreenKey) => {
|
|
|
211
80
|
delete state[tag];
|
|
212
81
|
}
|
|
213
82
|
}
|
|
83
|
+
|
|
214
84
|
return state;
|
|
215
85
|
});
|
|
216
86
|
};
|
|
217
87
|
|
|
218
|
-
const
|
|
88
|
+
const performClear = (
|
|
89
|
+
shouldClearSnapshot: SnapshotPredicate,
|
|
90
|
+
shouldClearLink: LinkPredicate,
|
|
91
|
+
shouldClearPresence: PresencePredicate,
|
|
92
|
+
) => {
|
|
219
93
|
"worklet";
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
for (const tag in state) {
|
|
223
|
-
const tagEntries = state[tag];
|
|
224
|
-
|
|
225
|
-
for (const entryScreenKey in tagEntries) {
|
|
226
|
-
const entry = tagEntries[entryScreenKey];
|
|
227
|
-
const shouldRemove =
|
|
228
|
-
entry.navigatorKey === branchNavigatorKey ||
|
|
229
|
-
(entry.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false);
|
|
230
|
-
|
|
231
|
-
if (shouldRemove) {
|
|
232
|
-
delete tagEntries[entryScreenKey];
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
if (!hasAnyKeys(tagEntries)) {
|
|
237
|
-
delete state[tag];
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return state;
|
|
241
|
-
});
|
|
94
|
+
clearRegistry(shouldClearSnapshot, shouldClearLink);
|
|
95
|
+
clearPresence(shouldClearPresence);
|
|
242
96
|
};
|
|
243
97
|
|
|
244
98
|
function clear(screenKey: ScreenKey) {
|
|
245
99
|
"worklet";
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
clearRegistry({
|
|
250
|
-
shouldRemoveSnapshot: (snapshotKey) => snapshotKey === screenKey,
|
|
251
|
-
shouldRemoveLink: (link) => {
|
|
100
|
+
performClear(
|
|
101
|
+
(snapshotKey) => snapshotKey === screenKey,
|
|
102
|
+
(link) => {
|
|
252
103
|
return (
|
|
253
104
|
matchesScreenKey(link.source, screenKey) ||
|
|
254
105
|
matchesScreenKey(link.destination, screenKey)
|
|
255
106
|
);
|
|
256
107
|
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
clearPresenceDirect(screenKey);
|
|
260
|
-
|
|
261
|
-
const afterMatches = countRegistryMatches(screenKey, false);
|
|
262
|
-
const afterPresenceMatches = countPresenceMatches(screenKey, false);
|
|
263
|
-
|
|
264
|
-
debugClearLog(
|
|
265
|
-
`clear(${screenKey}) snapshots=${beforeMatches.snapshots}->${afterMatches.snapshots} links=${beforeMatches.links}->${afterMatches.links} presence=${beforePresenceMatches}->${afterPresenceMatches}`,
|
|
108
|
+
(entryScreenKey) => entryScreenKey === screenKey,
|
|
266
109
|
);
|
|
267
|
-
debugStoreSizeLog(`clear(${screenKey})`);
|
|
268
110
|
}
|
|
269
111
|
|
|
270
112
|
function clearByAncestor(ancestorKey: ScreenKey) {
|
|
271
113
|
"worklet";
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
clearRegistry({
|
|
276
|
-
shouldRemoveSnapshot: (snapshotKey, snapshot) => {
|
|
114
|
+
performClear(
|
|
115
|
+
(snapshotKey, snapshot) => {
|
|
277
116
|
return (
|
|
278
117
|
snapshotKey === ancestorKey ||
|
|
279
118
|
(snapshot.ancestorKeys?.includes(ancestorKey) ?? false)
|
|
280
119
|
);
|
|
281
120
|
},
|
|
282
|
-
|
|
121
|
+
(link) => {
|
|
283
122
|
return (
|
|
284
123
|
matchesScreenKey(link.source, ancestorKey) ||
|
|
285
124
|
matchesScreenKey(link.destination, ancestorKey)
|
|
286
125
|
);
|
|
287
126
|
},
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
debugClearLog(
|
|
296
|
-
`clearByAncestor(${ancestorKey}) snapshots=${beforeMatches.snapshots}->${afterMatches.snapshots} links=${beforeMatches.links}->${afterMatches.links} presence=${beforePresenceMatches}->${afterPresenceMatches}`,
|
|
127
|
+
(entryScreenKey, entry) => {
|
|
128
|
+
return (
|
|
129
|
+
entryScreenKey === ancestorKey ||
|
|
130
|
+
(entry.ancestorKeys?.includes(ancestorKey) ?? false)
|
|
131
|
+
);
|
|
132
|
+
},
|
|
297
133
|
);
|
|
298
|
-
debugStoreSizeLog(`clearByAncestor(${ancestorKey})`);
|
|
299
134
|
}
|
|
300
135
|
|
|
301
136
|
function clearByBranch(branchNavigatorKey: NavigatorKey) {
|
|
302
137
|
"worklet";
|
|
303
138
|
if (!branchNavigatorKey) return;
|
|
304
139
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
countPresenceMatchesByBranch(branchNavigatorKey);
|
|
308
|
-
|
|
309
|
-
clearRegistry({
|
|
310
|
-
shouldRemoveSnapshot: (_snapshotKey, snapshot) => {
|
|
140
|
+
performClear(
|
|
141
|
+
(_snapshotKey, snapshot) => {
|
|
311
142
|
return (
|
|
312
143
|
snapshot.navigatorKey === branchNavigatorKey ||
|
|
313
144
|
(snapshot.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false)
|
|
314
145
|
);
|
|
315
146
|
},
|
|
316
|
-
|
|
147
|
+
(link) => {
|
|
317
148
|
return (
|
|
318
149
|
matchesNavigatorKey(link.source, branchNavigatorKey) ||
|
|
319
150
|
matchesNavigatorKey(link.destination, branchNavigatorKey)
|
|
320
151
|
);
|
|
321
152
|
},
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
debugClearLog(
|
|
330
|
-
`clearByBranch(${branchNavigatorKey}) snapshots=${beforeMatches.snapshots}->${afterMatches.snapshots} links=${beforeMatches.links}->${afterMatches.links} presence=${beforePresenceMatches}->${afterPresenceMatches}`,
|
|
153
|
+
(_entryScreenKey, entry) => {
|
|
154
|
+
return (
|
|
155
|
+
entry.navigatorKey === branchNavigatorKey ||
|
|
156
|
+
(entry.ancestorNavigatorKeys?.includes(branchNavigatorKey) ?? false)
|
|
157
|
+
);
|
|
158
|
+
},
|
|
331
159
|
);
|
|
332
|
-
debugStoreSizeLog(`clearByBranch(${branchNavigatorKey})`);
|
|
333
160
|
}
|
|
334
161
|
|
|
335
162
|
export { clear, clearByAncestor, clearByBranch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BoundaryConfig, PresenceState, ScreenKey, TagID } from "../types";
|
|
2
|
-
import {
|
|
2
|
+
import { type GroupsState, groups, presence } from "./state";
|
|
3
3
|
|
|
4
4
|
function registerBoundaryPresence(
|
|
5
5
|
tag: TagID,
|
|
@@ -31,7 +31,6 @@ function registerBoundaryPresence(
|
|
|
31
31
|
|
|
32
32
|
return state;
|
|
33
33
|
});
|
|
34
|
-
debugStoreSizeLog(`registerBoundaryPresence(${tag},${screenKey})`);
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
function unregisterBoundaryPresence(tag: TagID, screenKey: ScreenKey) {
|
|
@@ -63,7 +62,6 @@ function unregisterBoundaryPresence(tag: TagID, screenKey: ScreenKey) {
|
|
|
63
62
|
delete state[tag];
|
|
64
63
|
return state;
|
|
65
64
|
});
|
|
66
|
-
debugStoreSizeLog(`unregisterBoundaryPresence(${tag},${screenKey})`);
|
|
67
65
|
}
|
|
68
66
|
|
|
69
67
|
function hasBoundaryPresence(tag: TagID, screenKey: ScreenKey): boolean {
|
|
@@ -123,7 +121,6 @@ function setGroupActiveId(group: string, id: string) {
|
|
|
123
121
|
};
|
|
124
122
|
return state;
|
|
125
123
|
});
|
|
126
|
-
debugStoreSizeLog(`setGroupActiveId(${group},${id})`);
|
|
127
124
|
}
|
|
128
125
|
|
|
129
126
|
function getGroupActiveId(group: string): string | null {
|
|
@@ -8,12 +8,7 @@ import type {
|
|
|
8
8
|
TagLink,
|
|
9
9
|
TagState,
|
|
10
10
|
} from "../types";
|
|
11
|
-
import {
|
|
12
|
-
createEmptyTagState,
|
|
13
|
-
debugStoreSizeLog,
|
|
14
|
-
type RegistryState,
|
|
15
|
-
registry,
|
|
16
|
-
} from "./state";
|
|
11
|
+
import { createEmptyTagState, type RegistryState, registry } from "./state";
|
|
17
12
|
|
|
18
13
|
const LINK_HISTORY_LIMIT = 3;
|
|
19
14
|
|
|
@@ -86,7 +81,6 @@ function registerSnapshot(
|
|
|
86
81
|
};
|
|
87
82
|
return state;
|
|
88
83
|
});
|
|
89
|
-
debugStoreSizeLog(`registerSnapshot(${tag},${screenKey})`);
|
|
90
84
|
}
|
|
91
85
|
|
|
92
86
|
function setLinkSource(
|
|
@@ -129,7 +123,6 @@ function setLinkSource(
|
|
|
129
123
|
|
|
130
124
|
return state;
|
|
131
125
|
});
|
|
132
|
-
debugStoreSizeLog(`setLinkSource(${tag},${screenKey})`);
|
|
133
126
|
}
|
|
134
127
|
|
|
135
128
|
function updateLinkSource(
|
|
@@ -182,7 +175,6 @@ function updateLinkSource(
|
|
|
182
175
|
|
|
183
176
|
return state;
|
|
184
177
|
});
|
|
185
|
-
debugStoreSizeLog(`updateLinkSource(${tag},${screenKey})`);
|
|
186
178
|
}
|
|
187
179
|
|
|
188
180
|
const findLatestPendingIndex = (
|
|
@@ -255,7 +247,6 @@ function setLinkDestination(
|
|
|
255
247
|
|
|
256
248
|
return state;
|
|
257
249
|
});
|
|
258
|
-
debugStoreSizeLog(`setLinkDestination(${tag},${screenKey})`);
|
|
259
250
|
}
|
|
260
251
|
|
|
261
252
|
function updateLinkDestination(
|
|
@@ -308,7 +299,6 @@ function updateLinkDestination(
|
|
|
308
299
|
|
|
309
300
|
return state;
|
|
310
301
|
});
|
|
311
|
-
debugStoreSizeLog(`updateLinkDestination(${tag},${screenKey})`);
|
|
312
302
|
}
|
|
313
303
|
|
|
314
304
|
function getActiveLink(tag: TagID, screenKey?: ScreenKey): TagLink | null {
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
TagLink,
|
|
8
8
|
TagState,
|
|
9
9
|
} from "../types";
|
|
10
|
-
import {
|
|
10
|
+
import { registry } from "./state";
|
|
11
11
|
|
|
12
12
|
const findLatestLink = (
|
|
13
13
|
tagState: TagState,
|
|
@@ -134,14 +134,6 @@ function resolveTransitionPair(
|
|
|
134
134
|
const sourceScreenKey = matchedLink?.source?.screenKey ?? null;
|
|
135
135
|
const destinationScreenKey = matchedLink?.destination?.screenKey ?? null;
|
|
136
136
|
|
|
137
|
-
if (!sourceBounds || !destinationBounds) {
|
|
138
|
-
debugResolverLog(
|
|
139
|
-
`unresolved tag=${tag} entering=${context.entering ? 1 : 0} source=${
|
|
140
|
-
sourceBounds ? 1 : 0
|
|
141
|
-
} destination=${destinationBounds ? 1 : 0} pending=${usedPending ? 1 : 0}`,
|
|
142
|
-
);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
137
|
return {
|
|
146
138
|
sourceBounds,
|
|
147
139
|
destinationBounds,
|
|
@@ -15,101 +15,3 @@ export type GroupsState = Record<string, GroupState>;
|
|
|
15
15
|
export const registry = makeMutable<RegistryState>({});
|
|
16
16
|
export const presence = makeMutable<PresenceState>({});
|
|
17
17
|
export const groups = makeMutable<GroupsState>({});
|
|
18
|
-
|
|
19
|
-
const RESOLVER_LOG_PREFIX = "[bounds:resolver]";
|
|
20
|
-
const ENABLE_RESOLVER_DEBUG_LOGS = false;
|
|
21
|
-
const CLEAR_LOG_PREFIX = "[bounds:clear]";
|
|
22
|
-
const ENABLE_CLEAR_DEBUG_LOGS = false;
|
|
23
|
-
const SIZE_LOG_PREFIX = "[bounds:size]";
|
|
24
|
-
const ENABLE_SIZE_DEBUG_LOGS = false;
|
|
25
|
-
|
|
26
|
-
type BoundStoreSize = {
|
|
27
|
-
tags: number;
|
|
28
|
-
snapshots: number;
|
|
29
|
-
links: number;
|
|
30
|
-
pendingLinks: number;
|
|
31
|
-
completedLinks: number;
|
|
32
|
-
presenceTags: number;
|
|
33
|
-
presenceEntries: number;
|
|
34
|
-
presenceCount: number;
|
|
35
|
-
groups: number;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export function debugResolverLog(message: string) {
|
|
39
|
-
"worklet";
|
|
40
|
-
if (!ENABLE_RESOLVER_DEBUG_LOGS) return;
|
|
41
|
-
console.warn(`${RESOLVER_LOG_PREFIX} ${message}`);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export function debugClearLog(message: string) {
|
|
45
|
-
"worklet";
|
|
46
|
-
if (!ENABLE_CLEAR_DEBUG_LOGS) return;
|
|
47
|
-
console.warn(`${CLEAR_LOG_PREFIX} ${message}`);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const collectBoundStoreSize = (): BoundStoreSize => {
|
|
51
|
-
"worklet";
|
|
52
|
-
const currentRegistry = registry.value;
|
|
53
|
-
const currentPresence = presence.value;
|
|
54
|
-
const currentGroups = groups.value;
|
|
55
|
-
|
|
56
|
-
let tags = 0;
|
|
57
|
-
let snapshots = 0;
|
|
58
|
-
let links = 0;
|
|
59
|
-
let pendingLinks = 0;
|
|
60
|
-
let completedLinks = 0;
|
|
61
|
-
|
|
62
|
-
for (const tag in currentRegistry) {
|
|
63
|
-
tags++;
|
|
64
|
-
const tagState = currentRegistry[tag];
|
|
65
|
-
for (const _snapshotKey in tagState.snapshots) {
|
|
66
|
-
snapshots++;
|
|
67
|
-
}
|
|
68
|
-
for (let i = 0; i < tagState.linkStack.length; i++) {
|
|
69
|
-
links++;
|
|
70
|
-
if (tagState.linkStack[i].destination === null) {
|
|
71
|
-
pendingLinks++;
|
|
72
|
-
} else {
|
|
73
|
-
completedLinks++;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
let presenceTags = 0;
|
|
79
|
-
let presenceEntries = 0;
|
|
80
|
-
let presenceCount = 0;
|
|
81
|
-
for (const tag in currentPresence) {
|
|
82
|
-
presenceTags++;
|
|
83
|
-
const entries = currentPresence[tag];
|
|
84
|
-
for (const screenKey in entries) {
|
|
85
|
-
presenceEntries++;
|
|
86
|
-
presenceCount += entries[screenKey].count ?? 0;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
let groupsCount = 0;
|
|
91
|
-
for (const _group in currentGroups) {
|
|
92
|
-
groupsCount++;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return {
|
|
96
|
-
tags,
|
|
97
|
-
snapshots,
|
|
98
|
-
links,
|
|
99
|
-
pendingLinks,
|
|
100
|
-
completedLinks,
|
|
101
|
-
presenceTags,
|
|
102
|
-
presenceEntries,
|
|
103
|
-
presenceCount,
|
|
104
|
-
groups: groupsCount,
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
export function debugStoreSizeLog(action: string) {
|
|
109
|
-
"worklet";
|
|
110
|
-
if (!ENABLE_SIZE_DEBUG_LOGS) return;
|
|
111
|
-
const size = collectBoundStoreSize();
|
|
112
|
-
console.warn(
|
|
113
|
-
`${SIZE_LOG_PREFIX} ${action} tags=${size.tags} snapshots=${size.snapshots} links=${size.links} pending=${size.pendingLinks} completed=${size.completedLinks} presenceTags=${size.presenceTags} presenceEntries=${size.presenceEntries} presenceCount=${size.presenceCount} groups=${size.groups}`,
|
|
114
|
-
);
|
|
115
|
-
}
|
|
@@ -38,6 +38,32 @@ export type BoundsNavigationZoomOptions = {
|
|
|
38
38
|
target?: "bound" | "fullscreen" | MeasuredDimensions;
|
|
39
39
|
debug?: boolean;
|
|
40
40
|
borderRadius?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Focused-screen element opacity curve.
|
|
43
|
+
*
|
|
44
|
+
* `open` is used while presenting the destination screen.
|
|
45
|
+
* `close` is used while returning to the source screen.
|
|
46
|
+
*
|
|
47
|
+
* Tuple order:
|
|
48
|
+
* - `inputStart`: transition progress start
|
|
49
|
+
* - `inputEnd`: transition progress end
|
|
50
|
+
* - `outputStart`: opacity at `inputStart` (defaults to built-in preset)
|
|
51
|
+
* - `outputEnd`: opacity at `inputEnd` (defaults to built-in preset)
|
|
52
|
+
*/
|
|
53
|
+
focusedElementOpacity?: BoundsNavigationZoomOpacityRanges;
|
|
54
|
+
/**
|
|
55
|
+
* Unfocused-screen matched element opacity curve.
|
|
56
|
+
*
|
|
57
|
+
* `open` is used while the previous screen animates out during present.
|
|
58
|
+
* `close` is used while the previous screen animates back in during dismiss.
|
|
59
|
+
*
|
|
60
|
+
* Tuple order:
|
|
61
|
+
* - `inputStart`: transition progress start
|
|
62
|
+
* - `inputEnd`: transition progress end
|
|
63
|
+
* - `outputStart`: opacity at `inputStart` (defaults to built-in preset)
|
|
64
|
+
* - `outputEnd`: opacity at `inputEnd` (defaults to built-in preset)
|
|
65
|
+
*/
|
|
66
|
+
unfocusedElementOpacity?: BoundsNavigationZoomOpacityRanges;
|
|
41
67
|
/**
|
|
42
68
|
* Scale applied to the unfocused background content while the focused bound
|
|
43
69
|
* animates above it.
|
|
@@ -71,6 +97,54 @@ export type BoundsNavigationZoomOptions = {
|
|
|
71
97
|
growMax: number,
|
|
72
98
|
exponent?: number,
|
|
73
99
|
];
|
|
100
|
+
/**
|
|
101
|
+
* Horizontal gesture drag translation curve.
|
|
102
|
+
*
|
|
103
|
+
* Tuple order:
|
|
104
|
+
* - `negativeMax`: multiplier when dragging left / negative
|
|
105
|
+
* - `positiveMax`: multiplier when dragging right / positive
|
|
106
|
+
* - `exponent`: curve exponent controlling how quickly translation ramps
|
|
107
|
+
*
|
|
108
|
+
* Examples:
|
|
109
|
+
* - `[0, 0]` disables horizontal drag translation
|
|
110
|
+
* - `[0.5, 0.5]` halves horizontal drag travel
|
|
111
|
+
* - `[1.2, 1.2]` amplifies horizontal drag travel
|
|
112
|
+
*/
|
|
113
|
+
horizontalDragTranslation?: readonly [
|
|
114
|
+
negativeMax: number,
|
|
115
|
+
positiveMax: number,
|
|
116
|
+
exponent?: number,
|
|
117
|
+
];
|
|
118
|
+
/**
|
|
119
|
+
* Vertical gesture drag translation curve.
|
|
120
|
+
*
|
|
121
|
+
* Tuple order:
|
|
122
|
+
* - `negativeMax`: multiplier when dragging up / negative
|
|
123
|
+
* - `positiveMax`: multiplier when dragging down / positive
|
|
124
|
+
* - `exponent`: curve exponent controlling how quickly translation ramps
|
|
125
|
+
*
|
|
126
|
+
* Examples:
|
|
127
|
+
* - `[0, 0]` disables vertical drag translation
|
|
128
|
+
* - `[0.5, 0.5]` halves vertical drag travel
|
|
129
|
+
* - `[1.2, 1.2]` amplifies vertical drag travel
|
|
130
|
+
*/
|
|
131
|
+
verticalDragTranslation?: readonly [
|
|
132
|
+
negativeMax: number,
|
|
133
|
+
positiveMax: number,
|
|
134
|
+
exponent?: number,
|
|
135
|
+
];
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export type BoundsNavigationZoomOpacityRange = readonly [
|
|
139
|
+
inputStart: number,
|
|
140
|
+
inputEnd: number,
|
|
141
|
+
outputStart?: number,
|
|
142
|
+
outputEnd?: number,
|
|
143
|
+
];
|
|
144
|
+
|
|
145
|
+
export type BoundsNavigationZoomOpacityRanges = {
|
|
146
|
+
open?: BoundsNavigationZoomOpacityRange;
|
|
147
|
+
close?: BoundsNavigationZoomOpacityRange;
|
|
74
148
|
};
|
|
75
149
|
|
|
76
150
|
export type BoundsNavigationZoomStyle = TransitionInterpolatedStyle & {
|
|
@@ -5,13 +5,13 @@ export type ResolveBoundTagParams = {
|
|
|
5
5
|
group?: string;
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const createBoundTag = ({
|
|
9
9
|
id,
|
|
10
10
|
group,
|
|
11
11
|
}: ResolveBoundTagParams): string | undefined => {
|
|
12
12
|
"worklet";
|
|
13
13
|
|
|
14
|
-
if (id
|
|
14
|
+
if (id == null || id === "") return undefined;
|
|
15
15
|
|
|
16
16
|
const normalizedId = String(id);
|
|
17
17
|
|