@sigx/lynx-navigation 0.2.0 → 0.4.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/README.md +128 -8
- package/dist/components/EntryScope.d.ts.map +1 -1
- package/dist/components/EntryScope.js +8 -2
- package/dist/components/EntryScope.js.map +1 -1
- package/dist/components/Layer.d.ts +34 -0
- package/dist/components/Layer.d.ts.map +1 -0
- package/dist/components/Layer.js +66 -0
- package/dist/components/Layer.js.map +1 -0
- package/dist/components/Screen.d.ts +6 -6
- package/dist/components/Screen.d.ts.map +1 -1
- package/dist/components/Screen.js +13 -9
- package/dist/components/Screen.js.map +1 -1
- package/dist/components/Stack.d.ts +41 -16
- package/dist/components/Stack.d.ts.map +1 -1
- package/dist/components/Stack.js +90 -54
- package/dist/components/Stack.js.map +1 -1
- package/dist/components/TabBar.d.ts +18 -19
- package/dist/components/TabBar.d.ts.map +1 -1
- package/dist/components/TabBar.js +21 -21
- package/dist/components/TabBar.js.map +1 -1
- package/dist/components/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs.js +15 -1
- package/dist/components/Tabs.js.map +1 -1
- package/dist/hooks/use-linking-nav.js.map +1 -1
- package/dist/hooks/use-nav-internal.d.ts +19 -1
- package/dist/hooks/use-nav-internal.d.ts.map +1 -1
- package/dist/hooks/use-nav-internal.js +11 -0
- package/dist/hooks/use-nav-internal.js.map +1 -1
- package/dist/hooks/use-screen-chrome.d.ts +19 -0
- package/dist/hooks/use-screen-chrome.d.ts.map +1 -0
- package/dist/hooks/use-screen-chrome.js +102 -0
- package/dist/hooks/use-screen-chrome.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/layer-plan.d.ts +69 -0
- package/dist/internal/layer-plan.d.ts.map +1 -0
- package/dist/internal/layer-plan.js +102 -0
- package/dist/internal/layer-plan.js.map +1 -0
- package/dist/internal/screen-width.d.ts +9 -7
- package/dist/internal/screen-width.d.ts.map +1 -1
- package/dist/internal/screen-width.js +15 -13
- package/dist/internal/screen-width.js.map +1 -1
- package/dist/navigator/core.d.ts +2 -1
- package/dist/navigator/core.d.ts.map +1 -1
- package/dist/navigator/core.js +13 -2
- package/dist/navigator/core.js.map +1 -1
- package/dist/url/format.js.map +1 -1
- package/package.json +13 -11
- package/src/components/EntryScope.tsx +13 -2
- package/src/components/Layer.tsx +96 -0
- package/src/components/Screen.tsx +11 -9
- package/src/components/Stack.tsx +136 -92
- package/src/components/TabBar.tsx +21 -21
- package/src/components/Tabs.tsx +15 -1
- package/src/hooks/use-nav-internal.ts +22 -1
- package/src/hooks/use-screen-chrome.ts +122 -0
- package/src/index.ts +2 -0
- package/src/internal/layer-plan.ts +187 -0
- package/src/internal/screen-width.ts +22 -14
- package/src/navigator/core.ts +14 -3
- package/dist/components/ScreenContainer.d.ts +0 -18
- package/dist/components/ScreenContainer.d.ts.map +0 -1
- package/dist/components/ScreenContainer.js +0 -77
- package/dist/components/ScreenContainer.js.map +0 -1
- package/src/components/ScreenContainer.tsx +0 -114
package/dist/components/Stack.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@sigx/lynx/jsx-runtime";
|
|
2
2
|
import { component, defineProvide, effect, onUnmounted, untrack, useSharedValue, } from '@sigx/lynx';
|
|
3
|
-
import { Suspense, isLazyComponent } from '@sigx/lynx';
|
|
4
3
|
import { createNavigatorState } from '../navigator/core.js';
|
|
5
4
|
import { useNav } from '../hooks/use-nav.js';
|
|
6
5
|
import { useCurrentEntry, useNavInternals, useNavRoutes, } from '../hooks/use-nav-internal.js';
|
|
7
|
-
import {
|
|
6
|
+
import { animationVariant, computeLayers, isOverlayPresentation } from '../internal/layer-plan.js';
|
|
8
7
|
import { EdgeBackHandle } from './EdgeBackHandle.js';
|
|
9
|
-
import {
|
|
8
|
+
import { Layer } from './Layer.js';
|
|
10
9
|
import { useTabScreenName, useTabs } from './Tabs.js';
|
|
11
10
|
let _nestedKeyCounter = 0;
|
|
12
11
|
/**
|
|
@@ -37,22 +36,33 @@ let _nestedKeyCounter = 0;
|
|
|
37
36
|
* walks to root and overlays the whole UI. `replace` stays strictly local
|
|
38
37
|
* (asymmetric with `push`) so a modal `replace` never wipes the root stack.
|
|
39
38
|
*
|
|
40
|
-
* **Render strategy
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* absolutely, each with an MT-driven `translateX` that reads from the
|
|
46
|
-
* navigator's progress `SharedValue`. The host's BG thread doesn't tick
|
|
47
|
-
* per frame — `useAnimatedStyle` runs the interpolation entirely on MT.
|
|
39
|
+
* **Render strategy.** Stack always emits the same JSX shape — a
|
|
40
|
+
* relative wrapper containing one `<Layer>` per entry returned by
|
|
41
|
+
* `computeLayers(stack, transition, progress)`. Each Layer is an
|
|
42
|
+
* absolutely-positioned host view with optional MT-bound translate
|
|
43
|
+
* animation. The pure layer-plan function decides:
|
|
48
44
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
45
|
+
* - **Idle.** Topmost non-overlay base + any overlays above it. All
|
|
46
|
+
* static (no transform). Overlays (`modal` / `fullScreen` /
|
|
47
|
+
* `transparent-modal`) keep their underneath mounted; cards
|
|
48
|
+
* replace their underneath in the base layer.
|
|
49
|
+
* - **Card transition.** Both top and underneath animate (slide-in
|
|
50
|
+
* + parallax). After settle, idle rules apply — the underneath
|
|
51
|
+
* unmounts because the new top is the sole base.
|
|
52
|
+
* - **Overlay transition.** The full idle layer stack up through
|
|
53
|
+
* the underneath stays static; only the animated top has a
|
|
54
|
+
* transform. After settle, the overlay either joins the static
|
|
55
|
+
* idle stack (push) or unmounts (pop).
|
|
56
|
+
*
|
|
57
|
+
* Layer keys are `layer-${entry.key}-${animationVariant}`. The variant
|
|
58
|
+
* suffix forces a remount when an entry transitions from animated to
|
|
59
|
+
* static (or vice versa) — `useAnimatedStyle` binds once at setup and
|
|
60
|
+
* can't switch its mapper at runtime. Modal underneath layers never
|
|
61
|
+
* animate, so their key is stable across the modal lifecycle and the
|
|
62
|
+
* subtree's state (per-tab Stack navigators, scroll positions,
|
|
63
|
+
* in-flight inputs) survives.
|
|
54
64
|
*/
|
|
55
|
-
export const Stack = component(({ props }) => {
|
|
65
|
+
export const Stack = component(({ props, slots }) => {
|
|
56
66
|
// Capture enclosing scope's nav + routes + internals BEFORE any of the
|
|
57
67
|
// defineProvide calls below override them for descendants. These are
|
|
58
68
|
// always the "outer" values regardless of whether this Stack is bound
|
|
@@ -174,48 +184,74 @@ export const Stack = component(({ props }) => {
|
|
|
174
184
|
nav = parentNav;
|
|
175
185
|
internals = parentInternals;
|
|
176
186
|
}
|
|
187
|
+
// Per-stack chrome (slots.default) renders *inside* this Stack's
|
|
188
|
+
// nav scope so a `<Header />` placed there resolves `useNav()` to
|
|
189
|
+
// the per-stack nav. Wrapping the active body in a flex-column
|
|
190
|
+
// with the slot above does that without disturbing layer-fill
|
|
191
|
+
// semantics — the slot takes natural height, the body keeps
|
|
192
|
+
// flex-fill.
|
|
193
|
+
const flexColumnFill = {
|
|
194
|
+
flexGrow: 1,
|
|
195
|
+
flexShrink: 1,
|
|
196
|
+
flexBasis: 0,
|
|
197
|
+
minHeight: 0,
|
|
198
|
+
display: 'flex',
|
|
199
|
+
flexDirection: 'column',
|
|
200
|
+
};
|
|
177
201
|
return () => {
|
|
178
|
-
const
|
|
202
|
+
const chrome = slots.default?.();
|
|
203
|
+
const layers = computeLayers(nav.stack, nav.transition, internals.progress);
|
|
204
|
+
const renderLayerNode = (layer) => layer ? (_jsx(Layer, { entry: layer.entry, routes: routes, animation: layer.animation }, `layer-${layer.entry.key}-${animationVariant(layer.animation)}`)) : null;
|
|
205
|
+
// sigx's reconciler treats a single array-valued JSX child as
|
|
206
|
+
// one "slot": when the array's *length* changes between
|
|
207
|
+
// renders, keyed children inside can be remounted even if
|
|
208
|
+
// their keys are stable. To make stacked-overlay state
|
|
209
|
+
// preservation work (modal A still mounted after modal B
|
|
210
|
+
// pushes on top), each layer is emitted as its own separate
|
|
211
|
+
// JSX child slot rather than as an array. The slots are
|
|
212
|
+
// position-stable across renders — the only thing that
|
|
213
|
+
// changes is a slot turning from `null` to a Layer (mount) or
|
|
214
|
+
// vice versa (unmount). MAX_LAYERS caps the supported stack
|
|
215
|
+
// depth; in practice apps rarely stack more than 2-3 overlays.
|
|
216
|
+
// If you hit the cap, increase the constant — the unrolled
|
|
217
|
+
// shape is just verbose, not algorithmically limited.
|
|
218
|
+
// Edge-swipe handle on top, gated on:
|
|
219
|
+
// - `internals.edgeSwipeEnabled` — opt-out flag (also off
|
|
220
|
+
// when the navigator has no progress SharedValue, i.e.
|
|
221
|
+
// animations disabled — no in-flight gesture to animate).
|
|
222
|
+
// - `nav.canGoBack` — something to pop back to.
|
|
223
|
+
// - `!nav.transition` — no animation already running.
|
|
224
|
+
// - The current top is a card (not an overlay). Edge-swipe
|
|
225
|
+
// is the iOS-style horizontal pop gesture for card stacks;
|
|
226
|
+
// using it to dismiss a modal would be the wrong axis +
|
|
227
|
+
// the wrong dismissal semantic.
|
|
228
|
+
//
|
|
229
|
+
// The handle only intercepts touches in the leftmost 20px and
|
|
230
|
+
// ignores small drags, so placing it last (highest z) doesn't
|
|
231
|
+
// disturb screen touches.
|
|
179
232
|
const top = nav.current;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
const params = top.params;
|
|
188
|
-
// Wrap lazy routes that declare a `fallback` in <Suspense> so the
|
|
189
|
-
// chunk-load shows the user-provided spinner instead of throwing
|
|
190
|
-
// up to the nearest outer boundary (which may be wrong layer or
|
|
191
|
-
// missing entirely).
|
|
192
|
-
const body = isLazyComponent(Comp) && route.fallback
|
|
193
|
-
? (_jsx(Suspense, { fallback: route.fallback, children: _jsx(Comp, { ...params }) }))
|
|
194
|
-
: _jsx(Comp, { ...params });
|
|
195
|
-
// When canGoBack and edge-swipe is enabled, overlay the gesture
|
|
196
|
-
// handle so the user can pan from the left edge to start a back
|
|
197
|
-
// transition. `position: absolute` doesn't disturb the screen's
|
|
198
|
-
// own layout — the handle only intercepts touches in the leftmost
|
|
199
|
-
// 20px, and only when they pan rightward past `MIN_DISTANCE`.
|
|
200
|
-
if (nav.canGoBack && internals.edgeSwipeEnabled) {
|
|
201
|
-
return (_jsxs("view", { style: {
|
|
202
|
-
position: 'relative',
|
|
203
|
-
width: '100%',
|
|
204
|
-
height: '100%',
|
|
205
|
-
}, children: [_jsx(EntryScope, { entry: top, children: body }, top.key), _jsx(EdgeBackHandle, {}, "edge-back")] }));
|
|
206
|
-
}
|
|
207
|
-
return (_jsx(EntryScope, { entry: top, children: body }, top.key));
|
|
208
|
-
}
|
|
209
|
-
// Cast progress: TransitionState carries it as `unknown` to avoid
|
|
210
|
-
// pinning the contract to `@sigx/lynx`'s SharedValue at the type
|
|
211
|
-
// level; here at the runtime boundary we know it's a SharedValue<number>.
|
|
212
|
-
const progress = transition.progress;
|
|
213
|
-
return (_jsxs("view", { style: {
|
|
233
|
+
const edgeHandle = (internals.edgeSwipeEnabled
|
|
234
|
+
&& nav.canGoBack
|
|
235
|
+
&& !nav.transition
|
|
236
|
+
&& !isOverlayPresentation(top.presentation))
|
|
237
|
+
? _jsx(EdgeBackHandle, {}, "edge-back")
|
|
238
|
+
: null;
|
|
239
|
+
const body = (_jsxs("view", { style: {
|
|
214
240
|
position: 'relative',
|
|
215
241
|
width: '100%',
|
|
216
|
-
|
|
242
|
+
// Flex-fill so the layer container has a real
|
|
243
|
+
// height — `<Layer>`s anchor via `position:
|
|
244
|
+
// absolute; top/right/bottom/left: 0`, which
|
|
245
|
+
// needs a sized relative parent.
|
|
246
|
+
...flexColumnFill,
|
|
247
|
+
// Clip any animated layer that translates off-
|
|
248
|
+
// screen so the slide doesn't bleed past the
|
|
249
|
+
// Stack's bounds.
|
|
217
250
|
overflow: 'hidden',
|
|
218
|
-
}, children: [
|
|
251
|
+
}, children: [renderLayerNode(layers[0]), renderLayerNode(layers[1]), renderLayerNode(layers[2]), renderLayerNode(layers[3]), renderLayerNode(layers[4]), renderLayerNode(layers[5]), renderLayerNode(layers[6]), renderLayerNode(layers[7]), renderLayerNode(layers[8]), renderLayerNode(layers[9]), renderLayerNode(layers[10]), renderLayerNode(layers[11]), renderLayerNode(layers[12]), renderLayerNode(layers[13]), renderLayerNode(layers[14]), renderLayerNode(layers[15]), edgeHandle] }));
|
|
252
|
+
if (chrome == null)
|
|
253
|
+
return body;
|
|
254
|
+
return (_jsxs("view", { style: flexColumnFill, children: [chrome, _jsx("view", { style: flexColumnFill, children: body })] }));
|
|
219
255
|
};
|
|
220
256
|
});
|
|
221
257
|
//# sourceMappingURL=Stack.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../src/components/Stack.tsx"],"names":[],"mappings":";AAAA,OAAO,EACH,SAAS,EACT,aAAa,EACb,MAAM,EACN,WAAW,EACX,OAAO,EACP,cAAc,
|
|
1
|
+
{"version":3,"file":"Stack.js","sourceRoot":"","sources":["../../src/components/Stack.tsx"],"names":[],"mappings":";AAAA,OAAO,EACH,SAAS,EACT,aAAa,EACb,MAAM,EACN,WAAW,EACX,OAAO,EACP,cAAc,GAEjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAY,MAAM,qBAAqB,CAAC;AACvD,OAAO,EACH,eAAe,EACf,eAAe,EACf,YAAY,GAEf,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACnG,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE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AAM,CAAC,CAAC,CAAC,CAAC,EAC1B,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAC1B,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAC3B,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAC3B,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAC3B,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAC3B,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAC3B,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAC3B,UAAU,IACR,CACV,CAAC;QAEF,IAAI,MAAM,IAAI,IAAI;YAAE,OAAO,IAAa,CAAC;QACzC,OAAO,CACH,gBAAM,KAAK,EAAE,cAAc,aACtB,MAAM,EACP,eAAM,KAAK,EAAE,cAAc,YAAG,IAAI,GAAQ,IACvC,CACV,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `<TabBar>` — default chrome for `<Tabs>`.
|
|
2
|
+
* `<TabBar>` — headless default chrome for `<Tabs>`.
|
|
3
3
|
*
|
|
4
|
-
* Renders
|
|
5
|
-
* navigator.
|
|
6
|
-
*
|
|
4
|
+
* Renders the active-tab buttons reading from the enclosing `useTabs()`
|
|
5
|
+
* navigator. Intentionally **unstyled** — this lives in the (theme-less)
|
|
6
|
+
* navigation package, so it ships pure structure + accessibility wiring.
|
|
7
|
+
* Themed chrome belongs in a UI-kit package: see `<NavTabBar />` in
|
|
8
|
+
* `@sigx/lynx-daisyui` for the daisy-themed equivalent.
|
|
7
9
|
*
|
|
8
|
-
*
|
|
10
|
+
* Use this directly only if you want to handle styling yourself via the
|
|
11
|
+
* `renderTab` prop. For a "looks like a tab bar out of the box" component,
|
|
12
|
+
* pull `<NavTabBar />` from `@sigx/lynx-daisyui` (or your own UI kit).
|
|
13
|
+
*
|
|
14
|
+
* Customization:
|
|
9
15
|
* - `renderTab`: a function `(info, ctx) => JSX` that fully replaces the
|
|
10
16
|
* default button rendering for each tab. `ctx.active` tells the
|
|
11
17
|
* consumer whether this tab is currently focused; `ctx.onPress`
|
|
12
|
-
* activates the tab.
|
|
13
|
-
*
|
|
14
|
-
* Accessibility:
|
|
15
|
-
* - Each default button gets `accessibility-label` from
|
|
16
|
-
* `info.accessibilityLabel ?? info.label ?? info.name`.
|
|
17
|
-
* - Each default button gets `accessibility-element="true"` so screen
|
|
18
|
-
* readers see the whole pill, not just the inner `<text>`.
|
|
19
|
-
* - Each default button gets `accessibility-trait="button"` and a
|
|
20
|
-
* `selected` flag on the active one so VoiceOver/TalkBack announces
|
|
21
|
-
* focus state on tab switch.
|
|
18
|
+
* activates the tab. **Recommended** for any visual treatment.
|
|
22
19
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
20
|
+
* Accessibility (baked into the default button — the one structural
|
|
21
|
+
* concern this component keeps):
|
|
22
|
+
* - `accessibility-label` from `info.accessibilityLabel ?? info.label ?? info.name`.
|
|
23
|
+
* - `accessibility-element="true"` so screen readers see the whole pill.
|
|
24
|
+
* - `accessibility-trait="button"` and a `selected` flag on the active
|
|
25
|
+
* one so VoiceOver/TalkBack announces focus state on tab switch.
|
|
27
26
|
*/
|
|
28
27
|
import { type JSXElement } from '@sigx/lynx';
|
|
29
28
|
import { type TabInfo } from './Tabs.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/components/TabBar.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TabBar.d.ts","sourceRoot":"","sources":["../../src/components/TabBar.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAGH,KAAK,UAAU,EAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAW,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;AAElD,0DAA0D;AAC1D,MAAM,WAAW,gBAAgB;IAC7B,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,2EAA2E;IAC3E,OAAO,IAAI,IAAI,CAAC;CACnB;AAoCD,eAAO,MAAM,MAAM;wBAjCmB,OAAO,OAAO,gBAAgB,KAAK,UAAU;YA6DjF,CAAC"}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "@sigx/lynx/jsx-runtime";
|
|
2
2
|
/**
|
|
3
|
-
* `<TabBar>` — default chrome for `<Tabs>`.
|
|
3
|
+
* `<TabBar>` — headless default chrome for `<Tabs>`.
|
|
4
4
|
*
|
|
5
|
-
* Renders
|
|
6
|
-
* navigator.
|
|
7
|
-
*
|
|
5
|
+
* Renders the active-tab buttons reading from the enclosing `useTabs()`
|
|
6
|
+
* navigator. Intentionally **unstyled** — this lives in the (theme-less)
|
|
7
|
+
* navigation package, so it ships pure structure + accessibility wiring.
|
|
8
|
+
* Themed chrome belongs in a UI-kit package: see `<NavTabBar />` in
|
|
9
|
+
* `@sigx/lynx-daisyui` for the daisy-themed equivalent.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
11
|
+
* Use this directly only if you want to handle styling yourself via the
|
|
12
|
+
* `renderTab` prop. For a "looks like a tab bar out of the box" component,
|
|
13
|
+
* pull `<NavTabBar />` from `@sigx/lynx-daisyui` (or your own UI kit).
|
|
14
|
+
*
|
|
15
|
+
* Customization:
|
|
10
16
|
* - `renderTab`: a function `(info, ctx) => JSX` that fully replaces the
|
|
11
17
|
* default button rendering for each tab. `ctx.active` tells the
|
|
12
18
|
* consumer whether this tab is currently focused; `ctx.onPress`
|
|
13
|
-
* activates the tab.
|
|
14
|
-
*
|
|
15
|
-
* Accessibility:
|
|
16
|
-
* - Each default button gets `accessibility-label` from
|
|
17
|
-
* `info.accessibilityLabel ?? info.label ?? info.name`.
|
|
18
|
-
* - Each default button gets `accessibility-element="true"` so screen
|
|
19
|
-
* readers see the whole pill, not just the inner `<text>`.
|
|
20
|
-
* - Each default button gets `accessibility-trait="button"` and a
|
|
21
|
-
* `selected` flag on the active one so VoiceOver/TalkBack announces
|
|
22
|
-
* focus state on tab switch.
|
|
19
|
+
* activates the tab. **Recommended** for any visual treatment.
|
|
23
20
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
21
|
+
* Accessibility (baked into the default button — the one structural
|
|
22
|
+
* concern this component keeps):
|
|
23
|
+
* - `accessibility-label` from `info.accessibilityLabel ?? info.label ?? info.name`.
|
|
24
|
+
* - `accessibility-element="true"` so screen readers see the whole pill.
|
|
25
|
+
* - `accessibility-trait="button"` and a `selected` flag on the active
|
|
26
|
+
* one so VoiceOver/TalkBack announces focus state on tab switch.
|
|
28
27
|
*/
|
|
29
28
|
import { component, } from '@sigx/lynx';
|
|
30
29
|
import { useTabs } from './Tabs.js';
|
|
31
30
|
/**
|
|
32
31
|
* Default per-tab button. Plain `<view>` with a `<text>` inside, an
|
|
33
32
|
* `accessibility-*` cluster for screen readers, and a tap handler. No
|
|
34
|
-
* styling beyond a minimal active-state
|
|
35
|
-
* branded chrome pass `renderTab
|
|
33
|
+
* styling beyond a minimal active-state opacity hint — consumers that
|
|
34
|
+
* want branded chrome pass `renderTab` or use a UI-kit-provided tab bar
|
|
35
|
+
* (e.g. `<NavTabBar />` from `@sigx/lynx-daisyui`).
|
|
36
36
|
*/
|
|
37
37
|
const DefaultTabButton = component(({ props }) => {
|
|
38
38
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../src/components/TabBar.tsx"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"TabBar.js","sourceRoot":"","sources":["../../src/components/TabBar.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyB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AAC;IAC9B,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,0DAIlB,CAAC;AAsBH;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,yDAI3B,CAAC;AAEH,KAAK,SAAS,GACR,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,GACjC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAgE7B,KAAK,eAAe,GACd,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,GACjC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,GAC/B,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,GAC5B,MAAM,CAAC,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,GACzC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;AAsD7B;;;;;GAKG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEf,CAAC"}
|
package/dist/components/Tabs.js
CHANGED
|
@@ -134,11 +134,25 @@ const TabsScreen = component(({ props, slots }) => {
|
|
|
134
134
|
// `display: none` keeps the body mounted so per-tab state survives
|
|
135
135
|
// tab switches. Read activeSignal here so re-activating triggers a
|
|
136
136
|
// re-render with display restored.
|
|
137
|
+
//
|
|
138
|
+
// Flex-fill long-form (`flex-grow/shrink/basis`) instead of
|
|
139
|
+
// `height: '100%'`. The percentage form only resolves against an
|
|
140
|
+
// explicit parent height, which means consumers had to wrap us
|
|
141
|
+
// in a `flexFill + height: '100%'` view to make us visible — and
|
|
142
|
+
// every Lynx app got that wrong (myself included) until we hit
|
|
143
|
+
// it on the showcase. With flex-fill we just take whatever space
|
|
144
|
+
// our parent flex container gives us; the parent only needs to
|
|
145
|
+
// be a flex column with a known height (e.g. SafeAreaView, which
|
|
146
|
+
// now defaults to that).
|
|
137
147
|
const active = registrar.activeSignal.value === name;
|
|
138
148
|
return (_jsx("view", { style: {
|
|
139
149
|
display: active ? 'flex' : 'none',
|
|
150
|
+
flexDirection: 'column',
|
|
140
151
|
width: '100%',
|
|
141
|
-
|
|
152
|
+
flexGrow: 1,
|
|
153
|
+
flexShrink: 1,
|
|
154
|
+
flexBasis: 0,
|
|
155
|
+
minHeight: 0,
|
|
142
156
|
}, children: slots.default?.() }));
|
|
143
157
|
};
|
|
144
158
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","sourceRoot":"","sources":["../../src/components/Tabs.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EACH,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,MAAM,EACN,OAAO,GAIV,MAAM,YAAY,CAAC;AA4BpB;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAU,GAAG,EAAE;IAClD,MAAM,IAAI,KAAK,CACX,mEAAmE,CACtE,CAAC;AACN,CAAC,CAAC,CAAC;AAgBH,MAAM,gBAAgB,GAAG,gBAAgB,CAAgB,GAAG,EAAE;IAC1D,MAAM,IAAI,KAAK,CACX,sEAAsE,CACzE,CAAC;AACN,CAAC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,gBAAgB,CAAS,GAAG,EAAE;IAC1D,MAAM,IAAI,KAAK,CACX,2EAA2E,CAC9E,CAAC;AACN,CAAC,CAAC,CAAC;AAMH,MAAM,KAAK,GAAG,SAAS,CAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IACpD,wEAAwE;IACxE,uEAAuE;IACvE,kEAAkE;IAClE,gDAAgD;IAChD,MAAM,IAAI,GAAG,MAAM,CAAY,EAAE,CAAC,CAAC;IACnC,MAAM,YAAY,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ACjE,+DAA+D;QAC/D,iEAAiE;QACjE,yBAAyB;QACzB,MAAM,MAAM,GAAG,SAAS,CAAC,YAAY,CAAC,KAAK,KAAK,IAAI,CAAC;QACrD,OAAO,CACH,eACI,KAAK,EAAE;gBACH,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;gBACjC,aAAa,EAAE,QAAQ;gBACvB,KAAK,EAAE,MAAM;gBACb,QAAQ,EAAE,CAAC;gBACX,UAAU,EAAE,CAAC;gBACb,SAAS,EAAE,CAAC;gBACZ,SAAS,EAAE,CAAC;aACf,YAEA,KAAK,CAAC,OAAO,EAAE,EAAE,GACf,CACV,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE;IAChC,MAAM,EAAE,UAAU;CACrB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-linking-nav.js","sourceRoot":"","sources":["../../src/hooks/use-linking-nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,MAAM,EAAY,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA0CrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"use-linking-nav.js","sourceRoot":"","sources":["../../src/hooks/use-linking-nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,E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KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1E,CAAC;AACL,CAAC"}
|
|
@@ -13,6 +13,17 @@ import type { RouteMap, StackEntry } from '../types.js';
|
|
|
13
13
|
* navigator surfaces a clear error rather than silently returning `false`.
|
|
14
14
|
*/
|
|
15
15
|
export declare const useCurrentEntry: import("@sigx/runtime-core").InjectableFunction<StackEntry<string, unknown, unknown>>;
|
|
16
|
+
/**
|
|
17
|
+
* Soft companion to {@link useCurrentEntry} — returns the current scope's
|
|
18
|
+
* entry if any, `null` when called outside an `<EntryScope>` instead of
|
|
19
|
+
* throwing. Provided alongside the strict version by `<EntryScope>`.
|
|
20
|
+
*
|
|
21
|
+
* Used by chrome consumers (`useScreenChrome`) where "no scoped entry"
|
|
22
|
+
* is a legitimate state (a Stack chrome slot lives outside the screen's
|
|
23
|
+
* EntryScope) and the caller wants to soft-fallback to the navigator's
|
|
24
|
+
* destination entry rather than crash.
|
|
25
|
+
*/
|
|
26
|
+
export declare const useCurrentEntryOptional: import("@sigx/runtime-core").InjectableFunction<StackEntry<string, unknown, unknown> | null>;
|
|
16
27
|
/**
|
|
17
28
|
* Internal injectable: the route registry passed into `<NavigationRoot>`.
|
|
18
29
|
* Components (Stack, Screen) read this to look up route definitions by name.
|
|
@@ -53,7 +64,14 @@ export interface NavInternals {
|
|
|
53
64
|
*/
|
|
54
65
|
readonly screens: {
|
|
55
66
|
register(registry: ScreenRegistry): void;
|
|
56
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Identity-checked: only removes the entry if `registry` is the
|
|
69
|
+
* one currently registered under its `entry.key`. A no-op when
|
|
70
|
+
* a newer registry has already taken that slot (which happens
|
|
71
|
+
* at the transition→idle handoff, where a fresh `<EntryScope>`
|
|
72
|
+
* for the same entry mounts before the old one's unmount fires).
|
|
73
|
+
*/
|
|
74
|
+
unregister(registry: ScreenRegistry): void;
|
|
57
75
|
get(entryKey: string): ScreenRegistry | undefined;
|
|
58
76
|
};
|
|
59
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav-internal.d.ts","sourceRoot":"","sources":["../../src/hooks/use-nav-internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,uFAI1B,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,2DAIvB,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IACzB,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC9C;;;;OAIG;IACH,gBAAgB,IAAI,IAAI,CAAC;IACzB,iEAAiE;IACjE,iBAAiB,IAAI,IAAI,CAAC;IAC1B,iEAAiE;IACjE,iBAAiB,IAAI,IAAI,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE;QACd,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;QACzC,UAAU,CAAC,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"use-nav-internal.d.ts","sourceRoot":"","sources":["../../src/hooks/use-nav-internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAExD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,uFAI1B,CAAC;AAEH;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,8FAEnC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,2DAIvB,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IACzB,wEAAwE;IACxE,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;IAC9C;;;;OAIG;IACH,gBAAgB,IAAI,IAAI,CAAC;IACzB,iEAAiE;IACjE,iBAAiB,IAAI,IAAI,CAAC;IAC1B,iEAAiE;IACjE,iBAAiB,IAAI,IAAI,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IACnC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,EAAE;QACd,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;QACzC;;;;;;WAMG;QACH,UAAU,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;QAC3C,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;KACrD,CAAC;CACL;AAED,eAAO,MAAM,eAAe,+DAI1B,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,iEAI5B,CAAC"}
|
|
@@ -13,6 +13,17 @@ import { defineInjectable } from '@sigx/lynx';
|
|
|
13
13
|
export const useCurrentEntry = defineInjectable(() => {
|
|
14
14
|
throw new Error('[lynx-navigation] No screen entry in scope. `useIsFocused` / `useFocusEffect` must be called from a component rendered as a route by <Stack>.');
|
|
15
15
|
});
|
|
16
|
+
/**
|
|
17
|
+
* Soft companion to {@link useCurrentEntry} — returns the current scope's
|
|
18
|
+
* entry if any, `null` when called outside an `<EntryScope>` instead of
|
|
19
|
+
* throwing. Provided alongside the strict version by `<EntryScope>`.
|
|
20
|
+
*
|
|
21
|
+
* Used by chrome consumers (`useScreenChrome`) where "no scoped entry"
|
|
22
|
+
* is a legitimate state (a Stack chrome slot lives outside the screen's
|
|
23
|
+
* EntryScope) and the caller wants to soft-fallback to the navigator's
|
|
24
|
+
* destination entry rather than crash.
|
|
25
|
+
*/
|
|
26
|
+
export const useCurrentEntryOptional = defineInjectable(() => null);
|
|
16
27
|
/**
|
|
17
28
|
* Internal injectable: the route registry passed into `<NavigationRoot>`.
|
|
18
29
|
* Components (Stack, Screen) read this to look up route definitions by name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav-internal.js","sourceRoot":"","sources":["../../src/hooks/use-nav-internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,YAAY,CAAC;AAIhE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAa,GAAG,EAAE;IAC7D,MAAM,IAAI,KAAK,CACX,+IAA+I,CAClJ,CAAC;AACN,CAAC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAW,GAAG,EAAE;IACxD,MAAM,IAAI,KAAK,CACX,oEAAoE,CACvE,CAAC;AACN,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"use-nav-internal.js","sourceRoot":"","sources":["../../src/hooks/use-nav-internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,YAAY,CAAC;AAIhE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAa,GAAG,EAAE;IAC7D,MAAM,IAAI,KAAK,CACX,+IAA+I,CAClJ,CAAC;AACN,CAAC,CAAC,CAAC;AAEH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,gBAAgB,CACnD,GAAG,EAAE,CAAC,IAAI,CACb,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAW,GAAG,EAAE;IACxD,MAAM,IAAI,KAAK,CACX,oEAAoE,CACvE,CAAC;AACN,CAAC,CAAC,CAAC;AA8CH,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAe,GAAG,EAAE;IAC/D,MAAM,IAAI,KAAK,CACX,oEAAoE,CACvE,CAAC;AACN,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAiB,GAAG,EAAE;IACnE,MAAM,IAAI,KAAK,CACX,sJAAsJ,CACzJ,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ScreenSlotFills } from '../types.js';
|
|
2
|
+
export interface ScreenChrome {
|
|
3
|
+
/** Resolved screen title — `options.title` (string or getter) or the route name as fallback. Reactive. */
|
|
4
|
+
readonly title: string;
|
|
5
|
+
/** Whether the header should render. Defaults to true unless the screen set `headerShown: false`. Reactive. */
|
|
6
|
+
readonly headerShown: boolean;
|
|
7
|
+
/** True when the current stack has more than one entry — i.e. there's something to pop back to. Reactive. */
|
|
8
|
+
readonly canGoBack: boolean;
|
|
9
|
+
/** Pop the top entry. No-op when `!canGoBack`. */
|
|
10
|
+
pop(): void;
|
|
11
|
+
/** Full header override slot, if `<Screen.Header>` was set. Render its return value in place of the default layout. */
|
|
12
|
+
readonly header: ScreenSlotFills['header'] | undefined;
|
|
13
|
+
/** Left-aligned slot (typically a back button). Reactive. */
|
|
14
|
+
readonly headerLeft: ScreenSlotFills['headerLeft'] | undefined;
|
|
15
|
+
/** Right-aligned slot (typically actions). Reactive. */
|
|
16
|
+
readonly headerRight: ScreenSlotFills['headerRight'] | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare function useScreenChrome(): ScreenChrome;
|
|
19
|
+
//# sourceMappingURL=use-screen-chrome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-screen-chrome.d.ts","sourceRoot":"","sources":["../../src/hooks/use-screen-chrome.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,eAAe,EAAc,MAAM,aAAa,CAAC;AAE/D,MAAM,WAAW,YAAY;IACzB,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+GAA+G;IAC/G,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,6GAA6G;IAC7G,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,GAAG,IAAI,IAAI,CAAC;IACZ,uHAAuH;IACvH,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACvD,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IAC/D,wDAAwD;IACxD,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;CACpE;AAED,wBAAgB,eAAe,IAAI,YAAY,CAuE9C"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useScreenChrome` — reactive read of the currently-focused screen's
|
|
3
|
+
* options + slot fills, plus navigation helpers a header would need
|
|
4
|
+
* (canGoBack, pop).
|
|
5
|
+
*
|
|
6
|
+
* The built-in `<Header />` reads this same data via internal hooks.
|
|
7
|
+
* `useScreenChrome` exposes it as a public API so theme packages
|
|
8
|
+
* (`@sigx/lynx-daisyui`, custom designs) can build their own header
|
|
9
|
+
* components without depending on internal modules.
|
|
10
|
+
*
|
|
11
|
+
* Resolution rules:
|
|
12
|
+
*
|
|
13
|
+
* - **Inside a screen body** (i.e. inside an EntryScope whose entry is
|
|
14
|
+
* on the nearest `useNav()`'s stack), bind to **this entry's**
|
|
15
|
+
* registry. Useful for modal screens that render their own
|
|
16
|
+
* NavHeader inside — the chrome slides with the sheet.
|
|
17
|
+
* - **Outside any matching EntryScope** (slot of `<Stack>`, persistent
|
|
18
|
+
* root-level Header, etc.), bind to the *destination* entry of the
|
|
19
|
+
* current nav state — what the navigator is settling on once the
|
|
20
|
+
* in-flight transition completes. Push: the new top (already at
|
|
21
|
+
* nav.current). Pop: the entry being revealed
|
|
22
|
+
* (`transition.underneathEntry`), *not* the one being animated off.
|
|
23
|
+
* Using the destination means the bar reflects what the user is
|
|
24
|
+
* navigating *to*, immediately, with no end-of-animation snap.
|
|
25
|
+
*
|
|
26
|
+
* Every property is a getter — reading inside a render / `computed`
|
|
27
|
+
* subscribes to the underlying signal, so consumers re-render when
|
|
28
|
+
* title / slots change.
|
|
29
|
+
*/
|
|
30
|
+
import { useNav } from './use-nav.js';
|
|
31
|
+
import { useCurrentEntryOptional, useNavInternals } from './use-nav-internal.js';
|
|
32
|
+
export function useScreenChrome() {
|
|
33
|
+
const nav = useNav();
|
|
34
|
+
const internals = useNavInternals();
|
|
35
|
+
// The candidate "scoped" entry, if we happen to be rendered inside
|
|
36
|
+
// an EntryScope. May belong to a DIFFERENT nav than `nav` — e.g.
|
|
37
|
+
// when NavHeader is placed in a per-tab `<Stack>`'s chrome slot,
|
|
38
|
+
// it sees the outer (root) EntryScope's entry but its `useNav()`
|
|
39
|
+
// returns the inner per-tab nav. We only honor the pin when the
|
|
40
|
+
// entry is actually on this nav's stack; otherwise we're crossing
|
|
41
|
+
// scopes and the destination-entry path is correct.
|
|
42
|
+
//
|
|
43
|
+
// `useCurrentEntryOptional` is the soft companion to
|
|
44
|
+
// `useCurrentEntry` — it returns `null` outside any EntryScope
|
|
45
|
+
// rather than throwing, which is the right semantic for a chrome
|
|
46
|
+
// consumer that *might* be a Stack slot.
|
|
47
|
+
const candidate = useCurrentEntryOptional();
|
|
48
|
+
const getDestinationEntry = () => {
|
|
49
|
+
const t = nav.transition;
|
|
50
|
+
if (t) {
|
|
51
|
+
return t.kind === 'pop' ? t.underneathEntry : t.topEntry;
|
|
52
|
+
}
|
|
53
|
+
return nav.current;
|
|
54
|
+
};
|
|
55
|
+
const getEntry = () => {
|
|
56
|
+
if (candidate) {
|
|
57
|
+
const stack = nav.stack;
|
|
58
|
+
if (stack.some((e) => e.key === candidate.key)) {
|
|
59
|
+
return candidate;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return getDestinationEntry();
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
get title() {
|
|
66
|
+
const entry = getEntry();
|
|
67
|
+
const reg = internals.screens.get(entry.key);
|
|
68
|
+
const t = reg?.options.title;
|
|
69
|
+
if (typeof t === 'function')
|
|
70
|
+
return t();
|
|
71
|
+
if (typeof t === 'string')
|
|
72
|
+
return t;
|
|
73
|
+
return entry.route;
|
|
74
|
+
},
|
|
75
|
+
get headerShown() {
|
|
76
|
+
const reg = internals.screens.get(getEntry().key);
|
|
77
|
+
return reg?.options.headerShown !== false;
|
|
78
|
+
},
|
|
79
|
+
get canGoBack() {
|
|
80
|
+
const entry = getEntry();
|
|
81
|
+
const stack = nav.stack;
|
|
82
|
+
const idx = stack.findIndex((e) => e.key === entry.key);
|
|
83
|
+
return idx > 0;
|
|
84
|
+
},
|
|
85
|
+
pop() {
|
|
86
|
+
nav.pop();
|
|
87
|
+
},
|
|
88
|
+
get header() {
|
|
89
|
+
const reg = internals.screens.get(getEntry().key);
|
|
90
|
+
return reg?.slots.header;
|
|
91
|
+
},
|
|
92
|
+
get headerLeft() {
|
|
93
|
+
const reg = internals.screens.get(getEntry().key);
|
|
94
|
+
return reg?.slots.headerLeft;
|
|
95
|
+
},
|
|
96
|
+
get headerRight() {
|
|
97
|
+
const reg = internals.screens.get(getEntry().key);
|
|
98
|
+
return reg?.slots.headerRight;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=use-screen-chrome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-screen-chrome.js","sourceRoot":"","sources":["../../src/hooks/use-screen-chrome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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