@sigx/lynx-navigation 0.4.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/dist/components/Drawer.js +74 -0
- package/dist/components/Drawer.js.map +1 -0
- package/dist/components/EdgeBackHandle.js +144 -0
- package/dist/components/EdgeBackHandle.js.map +1 -0
- package/dist/components/EntryScope.d.ts +1 -1
- package/dist/components/EntryScope.d.ts.map +1 -1
- package/dist/components/EntryScope.js +39 -0
- package/dist/components/EntryScope.js.map +1 -0
- package/dist/components/Header.js +103 -0
- package/dist/components/Header.js.map +1 -0
- package/dist/components/Layer.d.ts +2 -2
- package/dist/components/Layer.d.ts.map +1 -1
- package/dist/components/Layer.js +66 -0
- package/dist/components/Layer.js.map +1 -0
- package/dist/components/Link.d.ts +2 -2
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +51 -0
- package/dist/components/Link.js.map +1 -0
- package/dist/components/NavigationRoot.d.ts +2 -2
- package/dist/components/NavigationRoot.d.ts.map +1 -1
- package/dist/components/NavigationRoot.js +67 -0
- package/dist/components/NavigationRoot.js.map +1 -0
- package/dist/components/Screen.js +98 -0
- package/dist/components/Screen.js.map +1 -0
- package/dist/components/Stack.js +257 -0
- package/dist/components/Stack.js.map +1 -0
- package/dist/components/TabBar.d.ts +1 -1
- package/dist/components/TabBar.d.ts.map +1 -1
- package/dist/components/TabBar.js +63 -0
- package/dist/components/TabBar.js.map +1 -0
- package/dist/components/Tabs.js +168 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/define-routes.d.ts +1 -1
- package/dist/define-routes.d.ts.map +1 -1
- package/{src/define-routes.d.ts → dist/define-routes.js} +4 -2
- package/dist/define-routes.js.map +1 -0
- package/dist/hooks/use-focus.js +87 -0
- package/dist/hooks/use-focus.js.map +1 -0
- package/dist/hooks/use-hardware-back.js +84 -0
- package/dist/hooks/use-hardware-back.js.map +1 -0
- package/dist/hooks/use-linking-nav.d.ts +3 -3
- package/dist/hooks/use-linking-nav.d.ts.map +1 -1
- package/dist/hooks/use-linking-nav.js +109 -0
- package/dist/hooks/use-linking-nav.js.map +1 -0
- package/dist/hooks/use-nav-internal.d.ts +2 -2
- package/dist/hooks/use-nav-internal.d.ts.map +1 -1
- package/dist/hooks/use-nav-internal.js +55 -0
- package/dist/hooks/use-nav-internal.js.map +1 -0
- package/dist/hooks/use-nav-serializer.d.ts +1 -1
- package/dist/hooks/use-nav-serializer.d.ts.map +1 -1
- package/dist/hooks/use-nav-serializer.js +181 -0
- package/dist/hooks/use-nav-serializer.js.map +1 -0
- package/dist/hooks/use-nav.d.ts +2 -2
- package/dist/hooks/use-nav.d.ts.map +1 -1
- package/dist/hooks/use-nav.js +11 -0
- package/dist/hooks/use-nav.js.map +1 -0
- package/dist/hooks/use-params.d.ts +1 -1
- package/dist/hooks/use-params.d.ts.map +1 -1
- package/{src/hooks/use-params.d.ts → dist/hooks/use-params.js} +6 -2
- package/dist/hooks/use-params.js.map +1 -0
- package/dist/hooks/use-screen-chrome.d.ts +1 -1
- package/dist/hooks/use-screen-chrome.d.ts.map +1 -1
- package/dist/hooks/use-screen-chrome.js +102 -0
- package/dist/hooks/use-screen-chrome.js.map +1 -0
- package/dist/hooks/use-screen-options.d.ts +1 -1
- package/dist/hooks/use-screen-options.d.ts.map +1 -1
- package/dist/hooks/use-screen-options.js +43 -0
- package/dist/hooks/use-screen-options.js.map +1 -0
- package/dist/hooks/use-search.d.ts +1 -1
- package/dist/hooks/use-search.d.ts.map +1 -1
- package/{src/hooks/use-search.d.ts → dist/hooks/use-search.js} +6 -2
- package/dist/hooks/use-search.js.map +1 -0
- package/dist/href.d.ts +2 -2
- package/dist/href.d.ts.map +1 -1
- package/dist/href.js +57 -0
- package/dist/href.js.map +1 -0
- package/dist/index.d.ts +33 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -1160
- package/dist/index.js.map +1 -1
- package/dist/internal/layer-plan.d.ts +1 -1
- package/dist/internal/layer-plan.d.ts.map +1 -1
- package/dist/internal/layer-plan.js +102 -0
- package/dist/internal/layer-plan.js.map +1 -0
- package/dist/internal/screen-registry.d.ts +1 -1
- package/dist/internal/screen-registry.d.ts.map +1 -1
- package/{src/internal/screen-registry.d.ts → dist/internal/screen-registry.js} +32 -21
- package/dist/internal/screen-registry.js.map +1 -0
- package/{src/internal/screen-width.d.ts → dist/internal/screen-width.js} +17 -2
- package/dist/internal/screen-width.js.map +1 -0
- package/dist/navigator/core.d.ts +3 -3
- package/dist/navigator/core.d.ts.map +1 -1
- package/dist/navigator/core.js +394 -0
- package/dist/navigator/core.js.map +1 -0
- package/dist/register.d.ts +1 -1
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +2 -0
- package/dist/register.js.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/url/build.js +30 -0
- package/dist/url/build.js.map +1 -0
- package/dist/url/compile.js +83 -0
- package/dist/url/compile.js.map +1 -0
- package/dist/url/format.js +102 -0
- package/dist/url/format.js.map +1 -0
- package/dist/url/index.d.ts +6 -6
- package/dist/url/index.d.ts.map +1 -1
- package/dist/url/index.js +13 -0
- package/dist/url/index.js.map +1 -0
- package/dist/url/parse.d.ts +1 -1
- package/dist/url/parse.d.ts.map +1 -1
- package/dist/url/parse.js +94 -0
- package/dist/url/parse.js.map +1 -0
- package/dist/url/registry.d.ts +2 -2
- package/dist/url/registry.d.ts.map +1 -1
- package/{src/url/registry.d.ts → dist/url/registry.js} +28 -12
- package/dist/url/registry.js.map +1 -0
- package/dist/url/validate.d.ts +1 -1
- package/dist/url/validate.d.ts.map +1 -1
- package/dist/url/validate.js +37 -0
- package/dist/url/validate.js.map +1 -0
- package/package.json +13 -12
- package/src/components/EdgeBackHandle.tsx +2 -2
- package/src/components/EntryScope.tsx +3 -3
- package/src/components/Header.tsx +3 -3
- package/src/components/Layer.tsx +3 -3
- package/src/components/Link.tsx +4 -4
- package/src/components/NavigationRoot.tsx +6 -6
- package/src/components/Screen.tsx +3 -3
- package/src/components/Stack.tsx +8 -8
- package/src/components/TabBar.tsx +1 -1
- package/src/define-routes.ts +1 -1
- package/src/hooks/use-focus.ts +2 -2
- package/src/hooks/use-hardware-back.ts +1 -1
- package/src/hooks/use-linking-nav.ts +4 -4
- package/src/hooks/use-nav-internal.ts +2 -2
- package/src/hooks/use-nav-serializer.ts +3 -3
- package/src/hooks/use-nav.ts +2 -2
- package/src/hooks/use-params.ts +2 -2
- package/src/hooks/use-screen-chrome.ts +3 -3
- package/src/hooks/use-screen-options.ts +3 -3
- package/src/hooks/use-search.ts +2 -2
- package/src/href.ts +6 -6
- package/src/index.ts +33 -33
- package/src/internal/layer-plan.ts +2 -2
- package/src/internal/screen-registry.ts +1 -1
- package/src/navigator/core.ts +3 -3
- package/src/register.ts +1 -1
- package/src/url/build.ts +2 -2
- package/src/url/index.ts +6 -6
- package/src/url/parse.ts +6 -6
- package/src/url/registry.ts +3 -3
- package/src/url/validate.ts +1 -1
- package/src/components/Drawer.d.ts +0 -55
- package/src/components/EdgeBackHandle.d.ts +0 -1
- package/src/components/EntryScope.d.ts +0 -25
- package/src/components/Header.d.ts +0 -6
- package/src/components/Layer.d.ts +0 -33
- package/src/components/Link.d.ts +0 -60
- package/src/components/NavigationRoot.d.ts +0 -36
- package/src/components/Screen.d.ts +0 -97
- package/src/components/Stack.d.ts +0 -90
- package/src/components/TabBar.d.ts +0 -38
- package/src/components/Tabs.d.ts +0 -109
- package/src/hooks/use-focus.d.ts +0 -45
- package/src/hooks/use-hardware-back.d.ts +0 -37
- package/src/hooks/use-linking-nav.d.ts +0 -91
- package/src/hooks/use-nav-internal.d.ts +0 -91
- package/src/hooks/use-nav-serializer.d.ts +0 -82
- package/src/hooks/use-nav.d.ts +0 -111
- package/src/hooks/use-screen-chrome.d.ts +0 -18
- package/src/hooks/use-screen-options.d.ts +0 -2
- package/src/href.d.ts +0 -54
- package/src/index.d.ts +0 -39
- package/src/internal/layer-plan.d.ts +0 -68
- package/src/navigator/core.d.ts +0 -96
- package/src/register.d.ts +0 -37
- package/src/types.d.ts +0 -217
- package/src/url/build.d.ts +0 -15
- package/src/url/compile.d.ts +0 -34
- package/src/url/format.d.ts +0 -28
- package/src/url/parse.d.ts +0 -20
- package/src/url/validate.d.ts +0 -23
|
@@ -4,9 +4,9 @@ import {
|
|
|
4
4
|
useCurrentEntryOptional,
|
|
5
5
|
useNavInternals,
|
|
6
6
|
useScreenRegistry,
|
|
7
|
-
} from '../hooks/use-nav-internal';
|
|
8
|
-
import { createScreenRegistry } from '../internal/screen-registry';
|
|
9
|
-
import type { StackEntry } from '../types';
|
|
7
|
+
} from '../hooks/use-nav-internal.js';
|
|
8
|
+
import { createScreenRegistry } from '../internal/screen-registry.js';
|
|
9
|
+
import type { StackEntry } from '../types.js';
|
|
10
10
|
|
|
11
11
|
type EntryScopeProps =
|
|
12
12
|
& Define.Prop<'entry', StackEntry, true>
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
* - making it opt-in keeps `<Stack>`'s contract narrow.
|
|
21
21
|
*/
|
|
22
22
|
import { component, computed } from '@sigx/lynx';
|
|
23
|
-
import { useNav } from '../hooks/use-nav';
|
|
24
|
-
import { useNavInternals } from '../hooks/use-nav-internal';
|
|
25
|
-
import type { ScreenOptions, ScreenSlotFills, StackEntry } from '../types';
|
|
23
|
+
import { useNav } from '../hooks/use-nav.js';
|
|
24
|
+
import { useNavInternals } from '../hooks/use-nav-internal.js';
|
|
25
|
+
import type { ScreenOptions, ScreenSlotFills, StackEntry } from '../types.js';
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Resolve a title (string or getter) to a plain string.
|
package/src/components/Layer.tsx
CHANGED
|
@@ -33,9 +33,9 @@ import {
|
|
|
33
33
|
type MainThread,
|
|
34
34
|
} from '@sigx/lynx';
|
|
35
35
|
import { Suspense, isLazyComponent } from '@sigx/lynx';
|
|
36
|
-
import type { LayerAnimation } from '../internal/layer-plan';
|
|
37
|
-
import type { RouteMap, StackEntry } from '../types';
|
|
38
|
-
import { EntryScope } from './EntryScope';
|
|
36
|
+
import type { LayerAnimation } from '../internal/layer-plan.js';
|
|
37
|
+
import type { RouteMap, StackEntry } from '../types.js';
|
|
38
|
+
import { EntryScope } from './EntryScope.js';
|
|
39
39
|
|
|
40
40
|
export type LayerProps =
|
|
41
41
|
& Define.Prop<'entry', StackEntry, true>
|
package/src/components/Link.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { component, type Define } from '@sigx/lynx';
|
|
2
|
-
import { useNav } from '../hooks/use-nav';
|
|
3
|
-
import { useNavRoutes } from '../hooks/use-nav-internal';
|
|
4
|
-
import type { RouteId, RouteParams, RouteSearch } from '../register';
|
|
5
|
-
import type { RoutesWithParams } from '../hooks/use-nav';
|
|
2
|
+
import { useNav } from '../hooks/use-nav.js';
|
|
3
|
+
import { useNavRoutes } from '../hooks/use-nav-internal.js';
|
|
4
|
+
import type { RouteId, RouteParams, RouteSearch } from '../register.js';
|
|
5
|
+
import type { RoutesWithParams } from '../hooks/use-nav.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Per-route conditional props for `<Link>`.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { component, defineProvide, useSharedValue, type Define } from '@sigx/lynx';
|
|
2
|
-
import { createNavigatorState } from '../navigator/core';
|
|
3
|
-
import { useNav } from '../hooks/use-nav';
|
|
4
|
-
import { useNavInternals, useNavRoutes } from '../hooks/use-nav-internal';
|
|
5
|
-
import type { RouteId } from '../register';
|
|
6
|
-
import type { Presentation, RouteMap, StackEntry } from '../types';
|
|
7
|
-
import { _setRouteRegistry } from '../url/registry';
|
|
2
|
+
import { createNavigatorState } from '../navigator/core.js';
|
|
3
|
+
import { useNav } from '../hooks/use-nav.js';
|
|
4
|
+
import { useNavInternals, useNavRoutes } from '../hooks/use-nav-internal.js';
|
|
5
|
+
import type { RouteId } from '../register.js';
|
|
6
|
+
import type { Presentation, RouteMap, StackEntry } from '../types.js';
|
|
7
|
+
import { _setRouteRegistry } from '../url/registry.js';
|
|
8
8
|
|
|
9
9
|
type NavigationRootProps =
|
|
10
10
|
& Define.Prop<'routes', RouteMap, true>
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
* declarative and grep-friendly.
|
|
32
32
|
*/
|
|
33
33
|
import { component, onUnmounted, type Define } from '@sigx/lynx';
|
|
34
|
-
import { useScreenRegistry } from '../hooks/use-nav-internal';
|
|
35
|
-
import { mergeOptions, setSlot } from '../internal/screen-registry';
|
|
36
|
-
import type { ScreenOptions } from '../types';
|
|
34
|
+
import { useScreenRegistry } from '../hooks/use-nav-internal.js';
|
|
35
|
+
import { mergeOptions, setSlot } from '../internal/screen-registry.js';
|
|
36
|
+
import type { ScreenOptions } from '../types.js';
|
|
37
37
|
|
|
38
38
|
type ScreenProps =
|
|
39
39
|
& Define.Prop<'title', string | (() => string)>
|
package/src/components/Stack.tsx
CHANGED
|
@@ -7,19 +7,19 @@ import {
|
|
|
7
7
|
useSharedValue,
|
|
8
8
|
type Define,
|
|
9
9
|
} from '@sigx/lynx';
|
|
10
|
-
import { createNavigatorState } from '../navigator/core';
|
|
11
|
-
import { useNav, type Nav } from '../hooks/use-nav';
|
|
10
|
+
import { createNavigatorState } from '../navigator/core.js';
|
|
11
|
+
import { useNav, type Nav } from '../hooks/use-nav.js';
|
|
12
12
|
import {
|
|
13
13
|
useCurrentEntry,
|
|
14
14
|
useNavInternals,
|
|
15
15
|
useNavRoutes,
|
|
16
16
|
type NavInternals,
|
|
17
|
-
} from '../hooks/use-nav-internal';
|
|
18
|
-
import type { Presentation, StackEntry } from '../types';
|
|
19
|
-
import { animationVariant, computeLayers, isOverlayPresentation } from '../internal/layer-plan';
|
|
20
|
-
import { EdgeBackHandle } from './EdgeBackHandle';
|
|
21
|
-
import { Layer } from './Layer';
|
|
22
|
-
import { useTabScreenName, useTabs } from './Tabs';
|
|
17
|
+
} from '../hooks/use-nav-internal.js';
|
|
18
|
+
import type { Presentation, StackEntry } from '../types.js';
|
|
19
|
+
import { animationVariant, computeLayers, isOverlayPresentation } from '../internal/layer-plan.js';
|
|
20
|
+
import { EdgeBackHandle } from './EdgeBackHandle.js';
|
|
21
|
+
import { Layer } from './Layer.js';
|
|
22
|
+
import { useTabScreenName, useTabs } from './Tabs.js';
|
|
23
23
|
|
|
24
24
|
type StackProps =
|
|
25
25
|
/**
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
type Define,
|
|
30
30
|
type JSXElement,
|
|
31
31
|
} from '@sigx/lynx';
|
|
32
|
-
import { useTabs, type TabInfo } from './Tabs';
|
|
32
|
+
import { useTabs, type TabInfo } from './Tabs.js';
|
|
33
33
|
|
|
34
34
|
/** Rendering context passed to a `renderTab` consumer. */
|
|
35
35
|
export interface TabRenderContext {
|
package/src/define-routes.ts
CHANGED
package/src/hooks/use-focus.ts
CHANGED
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
untrack,
|
|
6
6
|
type Computed,
|
|
7
7
|
} from '@sigx/lynx';
|
|
8
|
-
import { useNav } from './use-nav';
|
|
9
|
-
import { useCurrentEntry } from './use-nav-internal';
|
|
8
|
+
import { useNav } from './use-nav.js';
|
|
9
|
+
import { useCurrentEntry } from './use-nav-internal.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Reactive "is this screen the focused entry?" signal.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { onMounted } from '@sigx/lynx';
|
|
2
2
|
import { Linking } from '@sigx/lynx-linking';
|
|
3
|
-
import { parseHref, type Href } from '../href';
|
|
4
|
-
import { useNav, type Nav } from './use-nav';
|
|
5
|
-
import { useNavRoutes } from './use-nav-internal';
|
|
6
|
-
import type { RouteMap } from '../types';
|
|
3
|
+
import { parseHref, type Href } from '../href.js';
|
|
4
|
+
import { useNav, type Nav } from './use-nav.js';
|
|
5
|
+
import { useNavRoutes } from './use-nav-internal.js';
|
|
6
|
+
import type { RouteMap } from '../types.js';
|
|
7
7
|
|
|
8
8
|
export interface UseLinkingNavOptions {
|
|
9
9
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineInjectable, type SharedValue } from '@sigx/lynx';
|
|
2
|
-
import type { ScreenRegistry } from '../internal/screen-registry';
|
|
3
|
-
import type { RouteMap, StackEntry } from '../types';
|
|
2
|
+
import type { ScreenRegistry } from '../internal/screen-registry.js';
|
|
3
|
+
import type { RouteMap, StackEntry } from '../types.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Internal injectable: the `StackEntry` the calling screen was rendered for.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { effect, onMounted, onUnmounted } from '@sigx/lynx';
|
|
2
|
-
import { useNav } from './use-nav';
|
|
3
|
-
import { useNavRoutes } from './use-nav-internal';
|
|
4
|
-
import type { StackEntry } from '../types';
|
|
2
|
+
import { useNav } from './use-nav.js';
|
|
3
|
+
import { useNavRoutes } from './use-nav-internal.js';
|
|
4
|
+
import type { StackEntry } from '../types.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Plain JSON snapshot of a navigator. The whole point of holding navigation
|
package/src/hooks/use-nav.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineInjectable } from '@sigx/lynx';
|
|
2
|
-
import type { RegisteredRoutes, RouteId, RouteParams, RouteSearch } from '../register';
|
|
2
|
+
import type { RegisteredRoutes, RouteId, RouteParams, RouteSearch } from '../register.js';
|
|
3
3
|
import type {
|
|
4
4
|
PopOptions,
|
|
5
5
|
PushOptions,
|
|
6
6
|
RouteRequiresParams,
|
|
7
7
|
StackEntry,
|
|
8
8
|
TransitionState,
|
|
9
|
-
} from '../types';
|
|
9
|
+
} from '../types.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Subset of registered route names that declare a `params` schema (and so
|
package/src/hooks/use-params.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RouteId, RouteParams } from '../register';
|
|
2
|
-
import { useNav } from './use-nav';
|
|
1
|
+
import type { RouteId, RouteParams } from '../register.js';
|
|
2
|
+
import { useNav } from './use-nav.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Read the typed params for the current screen, asserted against the named
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
* subscribes to the underlying signal, so consumers re-render when
|
|
28
28
|
* title / slots change.
|
|
29
29
|
*/
|
|
30
|
-
import { useNav } from './use-nav';
|
|
31
|
-
import { useCurrentEntryOptional, useNavInternals } from './use-nav-internal';
|
|
32
|
-
import type { ScreenSlotFills, StackEntry } from '../types';
|
|
30
|
+
import { useNav } from './use-nav.js';
|
|
31
|
+
import { useCurrentEntryOptional, useNavInternals } from './use-nav-internal.js';
|
|
32
|
+
import type { ScreenSlotFills, StackEntry } from '../types.js';
|
|
33
33
|
|
|
34
34
|
export interface ScreenChrome {
|
|
35
35
|
/** Resolved screen title — `options.title` (string or getter) or the route name as fallback. Reactive. */
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
* pass a getter pay for the subscription; hosts that pass an object don't.
|
|
23
23
|
*/
|
|
24
24
|
import { effect, onUnmounted } from '@sigx/lynx';
|
|
25
|
-
import { useScreenRegistry } from './use-nav-internal';
|
|
26
|
-
import { mergeOptions } from '../internal/screen-registry';
|
|
27
|
-
import type { ScreenOptions } from '../types';
|
|
25
|
+
import { useScreenRegistry } from './use-nav-internal.js';
|
|
26
|
+
import { mergeOptions } from '../internal/screen-registry.js';
|
|
27
|
+
import type { ScreenOptions } from '../types.js';
|
|
28
28
|
|
|
29
29
|
export function useScreenOptions(
|
|
30
30
|
optionsOrFn: ScreenOptions | (() => ScreenOptions),
|
package/src/hooks/use-search.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RouteId, RouteSearch } from '../register';
|
|
2
|
-
import { useNav } from './use-nav';
|
|
1
|
+
import type { RouteId, RouteSearch } from '../register.js';
|
|
2
|
+
import { useNav } from './use-nav.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Read the typed search/query params for the current screen, asserted against
|
package/src/href.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { RouteId, RouteParams, RouteSearch } from './register';
|
|
2
|
-
import type { RoutesWithoutParams, RoutesWithParams } from './hooks/use-nav';
|
|
3
|
-
import { buildUrl } from './url/build';
|
|
4
|
-
import { parseHrefImpl } from './url/parse';
|
|
5
|
-
import { getRouteRegistry } from './url/registry';
|
|
6
|
-
import { validateSync } from './url/validate';
|
|
1
|
+
import type { RouteId, RouteParams, RouteSearch } from './register.js';
|
|
2
|
+
import type { RoutesWithoutParams, RoutesWithParams } from './hooks/use-nav.js';
|
|
3
|
+
import { buildUrl } from './url/build.js';
|
|
4
|
+
import { parseHrefImpl } from './url/parse.js';
|
|
5
|
+
import { getRouteRegistry } from './url/registry.js';
|
|
6
|
+
import { validateSync } from './url/validate.js';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* A typed reference to a navigation target — what `<Link to={...}>` consumes
|
package/src/index.ts
CHANGED
|
@@ -5,48 +5,48 @@
|
|
|
5
5
|
* Coming next: Screen with slot-based header API, MTS transitions, Tabs.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export { defineRoutes } from './define-routes';
|
|
9
|
-
export type { Register, RegisteredRoutes, RouteId, RouteParams, RouteSearch } from './register';
|
|
10
|
-
export { useNav } from './hooks/use-nav';
|
|
11
|
-
export type { Nav, RoutesWithoutParams, RoutesWithParams } from './hooks/use-nav';
|
|
12
|
-
export { useParams } from './hooks/use-params';
|
|
13
|
-
export { useSearch } from './hooks/use-search';
|
|
14
|
-
export { useHardwareBack } from './hooks/use-hardware-back';
|
|
15
|
-
export { useLinkingNav } from './hooks/use-linking-nav';
|
|
16
|
-
export type { UseLinkingNavOptions } from './hooks/use-linking-nav';
|
|
17
|
-
export { useIsFocused, useFocusEffect } from './hooks/use-focus';
|
|
18
|
-
export { useScreenOptions } from './hooks/use-screen-options';
|
|
19
|
-
export { useScreenChrome } from './hooks/use-screen-chrome';
|
|
20
|
-
export type { ScreenChrome } from './hooks/use-screen-chrome';
|
|
8
|
+
export { defineRoutes } from './define-routes.js';
|
|
9
|
+
export type { Register, RegisteredRoutes, RouteId, RouteParams, RouteSearch } from './register.js';
|
|
10
|
+
export { useNav } from './hooks/use-nav.js';
|
|
11
|
+
export type { Nav, RoutesWithoutParams, RoutesWithParams } from './hooks/use-nav.js';
|
|
12
|
+
export { useParams } from './hooks/use-params.js';
|
|
13
|
+
export { useSearch } from './hooks/use-search.js';
|
|
14
|
+
export { useHardwareBack } from './hooks/use-hardware-back.js';
|
|
15
|
+
export { useLinkingNav } from './hooks/use-linking-nav.js';
|
|
16
|
+
export type { UseLinkingNavOptions } from './hooks/use-linking-nav.js';
|
|
17
|
+
export { useIsFocused, useFocusEffect } from './hooks/use-focus.js';
|
|
18
|
+
export { useScreenOptions } from './hooks/use-screen-options.js';
|
|
19
|
+
export { useScreenChrome } from './hooks/use-screen-chrome.js';
|
|
20
|
+
export type { ScreenChrome } from './hooks/use-screen-chrome.js';
|
|
21
21
|
export {
|
|
22
22
|
useNavSerializer,
|
|
23
23
|
NAV_SNAPSHOT_VERSION,
|
|
24
|
-
} from './hooks/use-nav-serializer';
|
|
24
|
+
} from './hooks/use-nav-serializer.js';
|
|
25
25
|
export type {
|
|
26
26
|
NavSnapshot,
|
|
27
27
|
NavStorageAdapter,
|
|
28
28
|
UseNavSerializerOptions,
|
|
29
|
-
} from './hooks/use-nav-serializer';
|
|
30
|
-
export { hrefFor, parseHref } from './href';
|
|
31
|
-
export type { Href } from './href';
|
|
29
|
+
} from './hooks/use-nav-serializer.js';
|
|
30
|
+
export { hrefFor, parseHref } from './href.js';
|
|
31
|
+
export type { Href } from './href.js';
|
|
32
32
|
// URL bridge internals: `_setRouteRegistry` is a leading-underscore export —
|
|
33
33
|
// intended for tests, deep-link bootstrap before a NavigationRoot mounts, and
|
|
34
34
|
// any other integration that needs to seed the registry imperatively.
|
|
35
|
-
export { _setRouteRegistry, _clearRouteRegistry } from './url/registry';
|
|
36
|
-
export { compilePath } from './url/compile';
|
|
37
|
-
export type { CompiledPath } from './url/compile';
|
|
38
|
-
export { NavigationRoot } from './components/NavigationRoot';
|
|
39
|
-
export { Stack } from './components/Stack';
|
|
40
|
-
export { Screen } from './components/Screen';
|
|
41
|
-
export { Header } from './components/Header';
|
|
42
|
-
export { Tabs, useTabs } from './components/Tabs';
|
|
43
|
-
export type { TabInfo, TabsNav } from './components/Tabs';
|
|
44
|
-
export { TabBar } from './components/TabBar';
|
|
45
|
-
export type { TabRenderContext } from './components/TabBar';
|
|
46
|
-
export { Drawer, useDrawer } from './components/Drawer';
|
|
47
|
-
export type { DrawerNav } from './components/Drawer';
|
|
48
|
-
export { Link } from './components/Link';
|
|
49
|
-
export type { LinkProps } from './components/Link';
|
|
35
|
+
export { _setRouteRegistry, _clearRouteRegistry } from './url/registry.js';
|
|
36
|
+
export { compilePath } from './url/compile.js';
|
|
37
|
+
export type { CompiledPath } from './url/compile.js';
|
|
38
|
+
export { NavigationRoot } from './components/NavigationRoot.js';
|
|
39
|
+
export { Stack } from './components/Stack.js';
|
|
40
|
+
export { Screen } from './components/Screen.js';
|
|
41
|
+
export { Header } from './components/Header.js';
|
|
42
|
+
export { Tabs, useTabs } from './components/Tabs.js';
|
|
43
|
+
export type { TabInfo, TabsNav } from './components/Tabs.js';
|
|
44
|
+
export { TabBar } from './components/TabBar.js';
|
|
45
|
+
export type { TabRenderContext } from './components/TabBar.js';
|
|
46
|
+
export { Drawer, useDrawer } from './components/Drawer.js';
|
|
47
|
+
export type { DrawerNav } from './components/Drawer.js';
|
|
48
|
+
export { Link } from './components/Link.js';
|
|
49
|
+
export type { LinkProps } from './components/Link.js';
|
|
50
50
|
export type {
|
|
51
51
|
ComponentLike,
|
|
52
52
|
EmptyParams,
|
|
@@ -66,4 +66,4 @@ export type {
|
|
|
66
66
|
TransitionKind,
|
|
67
67
|
TransitionRole,
|
|
68
68
|
TransitionState,
|
|
69
|
-
} from './types';
|
|
69
|
+
} from './types.js';
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
* scroll, in-flight inputs) survives.
|
|
42
42
|
*/
|
|
43
43
|
import type { SharedValue } from '@sigx/lynx';
|
|
44
|
-
import { SCREEN_HEIGHT, SCREEN_WIDTH } from './screen-width';
|
|
44
|
+
import { SCREEN_HEIGHT, SCREEN_WIDTH } from './screen-width.js';
|
|
45
45
|
import type {
|
|
46
46
|
Presentation,
|
|
47
47
|
StackEntry,
|
|
48
48
|
TransitionKind,
|
|
49
49
|
TransitionState,
|
|
50
|
-
} from '../types';
|
|
50
|
+
} from '../types.js';
|
|
51
51
|
|
|
52
52
|
const PARALLAX_FACTOR = 0.3;
|
|
53
53
|
|
package/src/navigator/core.ts
CHANGED
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
} from '@sigx/lynx';
|
|
8
8
|
import { isLazyComponent } from '@sigx/lynx';
|
|
9
9
|
import { withTiming } from '@sigx/lynx-motion';
|
|
10
|
-
import type { Nav } from '../hooks/use-nav';
|
|
11
|
-
import type { ScreenRegistry } from '../internal/screen-registry';
|
|
10
|
+
import type { Nav } from '../hooks/use-nav.js';
|
|
11
|
+
import type { ScreenRegistry } from '../internal/screen-registry.js';
|
|
12
12
|
import type {
|
|
13
13
|
PopOptions,
|
|
14
14
|
Presentation,
|
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
RouteMap,
|
|
17
17
|
StackEntry,
|
|
18
18
|
TransitionState,
|
|
19
|
-
} from '../types';
|
|
19
|
+
} from '../types.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* The reactive backing state for one navigator instance.
|
package/src/register.ts
CHANGED
package/src/url/build.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Mirror of parse.ts. Used by `hrefFor()` after schema validation succeeds.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { formatSearch } from './format';
|
|
8
|
-
import { getCompiledPath, getRouteRegistry } from './registry';
|
|
7
|
+
import { formatSearch } from './format.js';
|
|
8
|
+
import { getCompiledPath, getRouteRegistry } from './registry.js';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Build the URL form of a route + params + search, or `null` if the route
|
package/src/url/index.ts
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* `parseHref` in ../href.ts plus `_setRouteRegistry` for tests/bootstrap.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
export { compilePath, type CompiledPath } from './compile';
|
|
9
|
-
export { buildUrl } from './build';
|
|
10
|
-
export { parseHrefImpl } from './parse';
|
|
11
|
-
export { formatSearch, parseSearch } from './format';
|
|
8
|
+
export { compilePath, type CompiledPath } from './compile.js';
|
|
9
|
+
export { buildUrl } from './build.js';
|
|
10
|
+
export { parseHrefImpl } from './parse.js';
|
|
11
|
+
export { formatSearch, parseSearch } from './format.js';
|
|
12
12
|
export {
|
|
13
13
|
_setRouteRegistry,
|
|
14
14
|
_clearRouteRegistry,
|
|
15
15
|
getRouteRegistry,
|
|
16
16
|
getCompiledPath,
|
|
17
|
-
} from './registry';
|
|
18
|
-
export { validateSync, type ValidateOutcome } from './validate';
|
|
17
|
+
} from './registry.js';
|
|
18
|
+
export { validateSync, type ValidateOutcome } from './validate.js';
|
package/src/url/parse.ts
CHANGED
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
* fall back to the initial route on a bad URL instead of crashing the app.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import type { Href } from '../href';
|
|
14
|
-
import type { RouteId } from '../register';
|
|
13
|
+
import type { Href } from '../href.js';
|
|
14
|
+
import type { RouteId } from '../register.js';
|
|
15
15
|
import { parse as parseUrl } from '@sigx/lynx-linking';
|
|
16
|
-
import type { CompiledPath } from './compile';
|
|
17
|
-
import { parseSearch } from './format';
|
|
18
|
-
import { getCompiledPath, getRouteRegistry } from './registry';
|
|
19
|
-
import { validateSync } from './validate';
|
|
16
|
+
import type { CompiledPath } from './compile.js';
|
|
17
|
+
import { parseSearch } from './format.js';
|
|
18
|
+
import { getCompiledPath, getRouteRegistry } from './registry.js';
|
|
19
|
+
import { validateSync } from './validate.js';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Parse a URL string against the active route registry.
|
package/src/url/registry.ts
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
* public API (test/integration use only).
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
import type { CompiledPath } from './compile';
|
|
16
|
-
import { compilePath } from './compile';
|
|
17
|
-
import type { RouteMap } from '../types';
|
|
15
|
+
import type { CompiledPath } from './compile.js';
|
|
16
|
+
import { compilePath } from './compile.js';
|
|
17
|
+
import type { RouteMap } from '../types.js';
|
|
18
18
|
|
|
19
19
|
interface RegistryState {
|
|
20
20
|
readonly routes: RouteMap;
|
package/src/url/validate.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* sync, which covers the common case. Async validators throw a clear error.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type { StandardSchemaV1 } from '../types';
|
|
9
|
+
import type { StandardSchemaV1 } from '../types.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Extended runtime view of a Standard Schema — adds the `validate` function
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `<Drawer>` — minimal off-canvas drawer navigator.
|
|
3
|
-
*
|
|
4
|
-
* Usage:
|
|
5
|
-
*
|
|
6
|
-
* ```tsx
|
|
7
|
-
* <NavigationRoot routes={routes}>
|
|
8
|
-
* <Drawer slots={{ sidebar: () => <view><text>Menu</text></view> }}>
|
|
9
|
-
* <Stack />
|
|
10
|
-
* </Drawer>
|
|
11
|
-
* </NavigationRoot>
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* `useDrawer()` from inside any descendant gives `{ isOpen, open(), close(),
|
|
15
|
-
* toggle() }`. The sidebar is laid out absolutely on the left and is
|
|
16
|
-
* visible whenever `isOpen` is true.
|
|
17
|
-
*
|
|
18
|
-
* Scope: this slice ships the state primitive + the bare-bones layout.
|
|
19
|
-
* Gesture-driven open (edge swipe from the left) and MTS slide-in are out
|
|
20
|
-
* of scope — the app shell can wrap its sidebar JSX in its own transition.
|
|
21
|
-
*
|
|
22
|
-
* Design note: the sidebar lives in a named slot (`sidebar`) rather than
|
|
23
|
-
* a render-prop or a `<Drawer.Sidebar>` child. Mixing
|
|
24
|
-
* "register-yourself-as-a-fill" children with the parent's own visible
|
|
25
|
-
* layout creates a feedback loop in sigx's reactive scope (the parent's
|
|
26
|
-
* render reads the fill, child's setup writes it, parent re-renders,
|
|
27
|
-
* child re-mounts, …). A scoped slot avoids that entirely and keeps the
|
|
28
|
-
* call site declarative.
|
|
29
|
-
*
|
|
30
|
-
* `default` slot is the main content (almost always a `<Stack>`).
|
|
31
|
-
*/
|
|
32
|
-
import { type Define } from '@sigx/lynx';
|
|
33
|
-
/** Reactive controller returned by `useDrawer()`. */
|
|
34
|
-
export interface DrawerNav {
|
|
35
|
-
/** True when the drawer is currently visible. Reactive. */
|
|
36
|
-
readonly isOpen: boolean;
|
|
37
|
-
/** Opens the drawer. */
|
|
38
|
-
open(): void;
|
|
39
|
-
/** Closes the drawer. */
|
|
40
|
-
close(): void;
|
|
41
|
-
/** Toggles between open and closed. */
|
|
42
|
-
toggle(): void;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Access the enclosing Drawer navigator. Throws when called outside
|
|
46
|
-
* `<Drawer>`.
|
|
47
|
-
*/
|
|
48
|
-
export declare const useDrawer: import("@sigx/runtime-core").InjectableFunction<DrawerNav>;
|
|
49
|
-
type DrawerProps = Define.Prop<'initialOpen', boolean> & Define.Slot<'sidebar'> & Define.Slot<'default'>;
|
|
50
|
-
export declare const Drawer: import("@sigx/runtime-core").ComponentFactory<DrawerProps, void, {
|
|
51
|
-
sidebar: () => import("@sigx/runtime-core").JSXElement | import("@sigx/runtime-core").JSXElement[] | null;
|
|
52
|
-
} & {
|
|
53
|
-
default: () => import("@sigx/runtime-core").JSXElement | import("@sigx/runtime-core").JSXElement[] | null;
|
|
54
|
-
}>;
|
|
55
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const EdgeBackHandle: import("@sigx/runtime-core").ComponentFactory<{}, void, unknown>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { type Define } from '@sigx/lynx';
|
|
2
|
-
import type { StackEntry } from '../types';
|
|
3
|
-
type EntryScopeProps = Define.Prop<'entry', StackEntry, true> & Define.Slot<'default'>;
|
|
4
|
-
/**
|
|
5
|
-
* Provider wrapper for a single screen mount.
|
|
6
|
-
*
|
|
7
|
-
* `<Stack>` and `<ScreenContainer>` instantiate this around each route
|
|
8
|
-
* component so calls to `useIsFocused()` / `useFocusEffect()` /
|
|
9
|
-
* `<Screen>` inside that screen resolve through `useCurrentEntry()` and
|
|
10
|
-
* `useScreenRegistry()` to the entry it was rendered for. Without this
|
|
11
|
-
* wrapper there'd be no per-screen way to know "which stack entry am I?"
|
|
12
|
-
* — the navigator only knows what's currently on top.
|
|
13
|
-
*
|
|
14
|
-
* Also allocates a fresh `ScreenRegistry` per entry and publishes it to
|
|
15
|
-
* the navigator's cross-entry registry map, so persistent chrome (HeaderBar
|
|
16
|
-
* / TabBar — later slices) can read the focused entry's options + slot
|
|
17
|
-
* fills without remounting itself.
|
|
18
|
-
*
|
|
19
|
-
* Renders the default slot directly; no extra layout element is inserted,
|
|
20
|
-
* so this is layout-neutral for the screen it wraps.
|
|
21
|
-
*/
|
|
22
|
-
export declare const EntryScope: import("@sigx/runtime-core").ComponentFactory<EntryScopeProps, void, {
|
|
23
|
-
default: () => import("@sigx/runtime-core").JSXElement | import("@sigx/runtime-core").JSXElement[] | null;
|
|
24
|
-
}>;
|
|
25
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Persistent header chrome. Mount once above `<Stack>`; reactively follows
|
|
3
|
-
* the focused entry. No props in v1 — styling is a host-app concern,
|
|
4
|
-
* arrived at through the slot fills.
|
|
5
|
-
*/
|
|
6
|
-
export declare const Header: import("@sigx/runtime-core").ComponentFactory<{}, void, unknown>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `<Layer>` — one row in `<Stack>`'s layered render. Absolutely-
|
|
3
|
-
* positioned host view that fills the Stack's relative wrapper, with
|
|
4
|
-
* an optional MT-bound `translateX` / `translateY` animation driven
|
|
5
|
-
* by a `SharedValue<number>` from the navigator's transition state.
|
|
6
|
-
*
|
|
7
|
-
* `<Stack>` emits one `<Layer>` per entry returned by
|
|
8
|
-
* `computeLayers(...)`. Layer.key in the parent is
|
|
9
|
-
* `layer-${entry.key}-${animationVariant(animation)}` so that:
|
|
10
|
-
*
|
|
11
|
-
* - The same entry under the same animation state is preserved across
|
|
12
|
-
* renders (modal underneath stays mounted through the modal
|
|
13
|
-
* lifecycle; per-tab Stack state survives).
|
|
14
|
-
* - An entry transitioning between animated and static (e.g. a card
|
|
15
|
-
* top after its push transition completes) remounts so the
|
|
16
|
-
* `useAnimatedStyle` binding can be rebound — the underlying
|
|
17
|
-
* `useAnimatedStyle` is set-once at setup and can't switch its
|
|
18
|
-
* mapper at runtime.
|
|
19
|
-
*
|
|
20
|
-
* Layouts:
|
|
21
|
-
* - Host view is `position: absolute; top/right/bottom/left: 0;
|
|
22
|
-
* display: flex; flexDirection: column` so descendants that
|
|
23
|
-
* flex-fill (SafeAreaView, daisyui screens) get a sized parent.
|
|
24
|
-
* - No background. Screens own their own surface colour (typically
|
|
25
|
-
* via a daisy `bg-base-*` class on the screen body).
|
|
26
|
-
*/
|
|
27
|
-
import { type ComponentFactory, type Define } from '@sigx/lynx';
|
|
28
|
-
import type { LayerAnimation } from '../internal/layer-plan';
|
|
29
|
-
import type { RouteMap, StackEntry } from '../types';
|
|
30
|
-
export type LayerProps = Define.Prop<'entry', StackEntry, true> & Define.Prop<'routes', RouteMap, true>
|
|
31
|
-
/** When set, the host view animates per the transform spec. */
|
|
32
|
-
& Define.Prop<'animation', LayerAnimation | null, false>;
|
|
33
|
-
export declare const Layer: ComponentFactory<LayerProps, void, {}>;
|