@gtkx/navigation 2.0.0-beta.1 → 2.0.0-beta.11

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.
Files changed (52) hide show
  1. package/README.md +8 -165
  2. package/dist/drawer/create-drawer-navigator.d.ts.map +1 -1
  3. package/dist/drawer/create-drawer-navigator.js +2 -2
  4. package/dist/drawer/create-drawer-navigator.js.map +1 -1
  5. package/dist/drawer/drawer-item-list.d.ts.map +1 -1
  6. package/dist/drawer/drawer-item-list.js +3 -2
  7. package/dist/drawer/drawer-item-list.js.map +1 -1
  8. package/dist/drawer/drawer-status.d.ts +2 -2
  9. package/dist/drawer/drawer-status.d.ts.map +1 -1
  10. package/dist/drawer/drawer-status.js +1 -9
  11. package/dist/drawer/drawer-status.js.map +1 -1
  12. package/dist/drawer/drawer-view.d.ts.map +1 -1
  13. package/dist/drawer/drawer-view.js +4 -8
  14. package/dist/drawer/drawer-view.js.map +1 -1
  15. package/dist/shared/scene-page.d.ts.map +1 -1
  16. package/dist/shared/scene-page.js +8 -1
  17. package/dist/shared/scene-page.js.map +1 -1
  18. package/dist/split-view/create-split-view-navigator.d.ts.map +1 -1
  19. package/dist/split-view/create-split-view-navigator.js +2 -2
  20. package/dist/split-view/create-split-view-navigator.js.map +1 -1
  21. package/dist/stack/create-stack-navigator.d.ts.map +1 -1
  22. package/dist/stack/create-stack-navigator.js +2 -2
  23. package/dist/stack/create-stack-navigator.js.map +1 -1
  24. package/dist/stack/stack-pages.d.ts.map +1 -1
  25. package/dist/stack/stack-pages.js +1 -9
  26. package/dist/stack/stack-pages.js.map +1 -1
  27. package/dist/stack/stack-view.d.ts.map +1 -1
  28. package/dist/stack/stack-view.js +1 -10
  29. package/dist/stack/stack-view.js.map +1 -1
  30. package/dist/tabs/create-tab-navigator.d.ts.map +1 -1
  31. package/dist/tabs/create-tab-navigator.js +2 -2
  32. package/dist/tabs/create-tab-navigator.js.map +1 -1
  33. package/dist/tabs/tab-view.d.ts.map +1 -1
  34. package/dist/tabs/tab-view.js +1 -3
  35. package/dist/tabs/tab-view.js.map +1 -1
  36. package/package.json +12 -9
  37. package/src/drawer/create-drawer-navigator.tsx +14 -16
  38. package/src/drawer/drawer-item-list.tsx +8 -5
  39. package/src/drawer/drawer-status.ts +3 -16
  40. package/src/drawer/drawer-view.tsx +4 -9
  41. package/src/shared/scene-page.tsx +21 -12
  42. package/src/split-view/create-split-view-navigator.tsx +15 -17
  43. package/src/stack/create-stack-navigator.tsx +9 -11
  44. package/src/stack/stack-pages.ts +1 -13
  45. package/src/stack/stack-view.tsx +1 -15
  46. package/src/tabs/create-tab-navigator.tsx +3 -5
  47. package/src/tabs/tab-view.tsx +1 -3
  48. package/dist/shared/use-loaded-routes.d.ts +0 -3
  49. package/dist/shared/use-loaded-routes.d.ts.map +0 -1
  50. package/dist/shared/use-loaded-routes.js +0 -11
  51. package/dist/shared/use-loaded-routes.js.map +0 -1
  52. package/src/shared/use-loaded-routes.ts +0 -14
package/README.md CHANGED
@@ -1,174 +1,17 @@
1
- <p align="center">
2
- <img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/logo.svg" alt="GTKX" width="100" />
3
- </p>
1
+ # @gtkx/navigation
4
2
 
5
- <h1 align="center">GTKX</h1>
3
+ React Navigation navigators for GTKX.
6
4
 
7
- <p align="center">
8
- The React framework for Linux, built on GTK.<br />
9
- Write native GTK4 desktop applications with React and TypeScript.
10
- Real GTK widgets, the GNOME stack, and standard web tooling.
11
- </p>
5
+ Build stack, tab, drawer, and split-view navigation with native Adwaita containers. The guide covers typed routes, nested navigators, Back behavior, and adaptive master/detail layouts.
12
6
 
13
- <p align="center">
14
- <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/v/create-gtkx?color=cb3837&logo=npm&label=create-gtkx" alt="npm version" /></a>
15
- <a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/dm/create-gtkx?color=cb3837&logo=npm&label=downloads" alt="npm downloads" /></a>
16
- <img src="https://img.shields.io/badge/node-%E2%89%A526.7-339933?logo=node.js&logoColor=white" alt="Node >= 26.7" />
17
- <a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License: MPL-2.0" /></a>
18
- <a href="https://github.com/gtkx-org/gtkx/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gtkx-org/gtkx/ci.yml?branch=main&logo=github&label=CI" alt="CI status" /></a>
19
- <img src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white" alt="TypeScript" />
20
- </p>
21
-
22
- <p align="center">
23
- <a href="https://gtkx.dev">Homepage</a> &middot;
24
- <a href="https://gtkx.dev/guide/getting-started">Documentation</a> &middot;
25
- <a href="https://github.com/gtkx-org/gtkx/tree/main/examples">Examples</a> &middot;
26
- <a href="https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md">Contributing</a>
27
- </p>
28
-
29
- ---
30
-
31
- <p align="center">
32
- <img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/examples/tutorial/assets/screenshot.png" alt="The Tasks app: an Adwaita window with a sidebar of smart views and colored lists on the left, and a boxed task list on the right." />
33
- </p>
34
-
35
- <p align="center">
36
- <em>The Tasks app you build in the <a href="https://gtkx.dev/tutorial/">tutorial</a>.</em>
37
- </p>
38
-
39
- ## Demo
40
-
41
- The intrinsic elements in this snippet render GTK4 widgets, and ordinary React hooks and events drive them:
42
-
43
- ```tsx
44
- import * as Gtk from "@gtkx/gi/gtk";
45
- import { GtkApplication, GtkApplicationWindow, GtkBox, GtkButton, GtkLabel } from "@gtkx/jsx/gtk";
46
- import { createRoot, quit } from "@gtkx/react";
47
- import { useState } from "react";
48
-
49
- const Counter = () => {
50
- const [count, setCount] = useState(0);
51
-
52
- return (
53
- <GtkApplicationWindow
54
- title="Hello GTKX"
55
- defaultWidth={400}
56
- defaultHeight={300}
57
- onCloseRequest={quit}
58
- >
59
- <GtkBox
60
- orientation={Gtk.Orientation.VERTICAL}
61
- spacing={20}
62
- marginTop={40}
63
- marginBottom={40}
64
- marginStart={40}
65
- marginEnd={40}
66
- valign={Gtk.Align.CENTER}
67
- halign={Gtk.Align.CENTER}
68
- >
69
- <GtkLabel cssClasses={["title-1"]}>Welcome to GTKX!</GtkLabel>
70
- <GtkLabel cssClasses={["title-2"]}>{`Count: ${count}`}</GtkLabel>
71
- <GtkButton
72
- label="Increment"
73
- onClicked={() => setCount((c) => c + 1)}
74
- cssClasses={["suggested-action", "pill"]}
75
- />
76
- </GtkBox>
77
- </GtkApplicationWindow>
78
- );
79
- };
80
-
81
- const App = () => (
82
- <GtkApplication>
83
- <Counter />
84
- </GtkApplication>
85
- );
86
-
87
- createRoot().render(<App />);
88
- ```
89
-
90
- This is the [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world) example, with `app.tsx` and `index.tsx` combined into a single snippet. `@gtkx/gi` and `@gtkx/jsx` are per-project bindings generated by the CLI, not packages you install from npm.
91
-
92
- ## Why GTKX
93
-
94
- ### A declarative layer for the GNOME stack
95
-
96
- GTK4 is mature, and GtkBuilder XML can lay out a static interface, but nothing re-renders that interface when your application state changes, and nothing hot-reloads it as you work. GTKX adds that missing layer, and the tooling around it, on top of the stack you already know:
97
-
98
- - a React reconciler that exposes every GObject as a JSX element,
99
- - a CLI for scaffolding, development, and production builds,
100
- - a dev server with Fast Refresh that patches your running UI in place,
101
- - CSS-in-JS styling, React Hook Form-powered Adwaita controls, gettext-backed react-i18next localization, React Spring animations, React Navigation stack, tab, drawer, and split view navigators, and high-level list, grid, and dialog components,
102
- - a Testing Library-style API for querying and driving your widgets in tests,
103
- - and a Model Context Protocol (MCP) server that exposes your live app to AI agents.
104
-
105
- ### The full GNOME API surface
106
-
107
- React Native and similar frameworks hide the native toolkit so one API can run everywhere. GTKX exposes it: GTK4, Adwaita, and any other GObject-Introspection library on your system. Linux-only by design.
108
-
109
- ### Why Node.js, and why generated bindings
110
-
111
- GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers what running on Node.js means day to day.
112
-
113
- GTKX generates the TypeScript types and the native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. Codegen covers the whole GTK4 and Adwaita surface.
114
-
115
- At runtime, the native Rust core calls straight into the system GTK4, Adwaita, and GLib libraries through libffi, without loading libgirepository at all.
116
-
117
- ## Quick start
118
-
119
- GTKX is Linux-only and needs Node.js 26.7 or later. See [Requirements](#requirements).
120
-
121
- Scaffold a new app with the `create-gtkx` initializer:
7
+ In an existing GTKX 2.0 beta app:
122
8
 
123
9
  ```sh
124
- npm create gtkx
10
+ npm install @gtkx/navigation@beta
125
11
  ```
126
12
 
127
- The same command works with other package managers: `pnpm create gtkx` or `yarn create gtkx`.
128
-
129
- Then run your new app:
130
-
131
- ```sh
132
- cd my-app
133
- npm run dev
134
- ```
135
-
136
- To go further, follow the [tutorial](https://gtkx.dev/tutorial/).
137
-
138
- ## Documentation
139
-
140
- The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tutorial that builds a complete GNOME app, from scaffolding to packaging and shipping, plus guides and a full API reference.
141
-
142
- **[Read the docs &rarr;](https://gtkx.dev/guide/why-gtkx)**
143
-
144
- ## Requirements
145
-
146
- GTKX is Linux-only. You need:
147
-
148
- - Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later), and GLib development libraries
149
- - Node.js 26.7 or later
150
-
151
- The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
152
-
153
- ## Examples
154
-
155
- Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
156
-
157
- - [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the counter above.
158
- - [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo): a React port of the official GTK4 widget showcase, covering lists, dialogs, gestures, CSS, and OpenGL.
159
- - [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser): a WebKitWebView-based web browser.
160
- - [`animations`](https://github.com/gtkx-org/gtkx/tree/main/examples/animations): a tour of `@gtkx/animated`, React Spring animations driven by the GTK frame clock.
161
- - [`navigation`](https://github.com/gtkx-org/gtkx/tree/main/examples/navigation): a tour of `@gtkx/navigation`, React Navigation's stack, tab, and drawer navigators rendered with libadwaita.
162
- - [`tutorial`](https://github.com/gtkx-org/gtkx/tree/main/examples/tutorial): the Tasks app the documentation builds.
163
-
164
- ## Status
165
-
166
- GTKX is stable and ready for production use.
167
-
168
- ## Contributing
169
-
170
- Contributions are welcome. See [CONTRIBUTING.md](https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md), the [Code of Conduct](https://github.com/gtkx-org/gtkx/blob/main/CODE_OF_CONDUCT.md), and the [security policy](https://github.com/gtkx-org/gtkx/blob/main/SECURITY.md). Building the repo needs Node.js 26.7 or later, pnpm, and a Rust toolchain.
13
+ [Guide](https://gtkx.dev/v2/guide/navigation) · [API reference](https://gtkx.dev/v2/reference/@gtkx/navigation/) · [GTKX](https://gtkx.dev)
171
14
 
172
- ## License
15
+ GTKX runs on Linux with Node.js and system native libraries. See [Getting Started](https://gtkx.dev/v2/guide/getting-started) for supported versions and installation. This README describes the 2.0 beta.
173
16
 
174
- GTKX is licensed under [MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
17
+ [MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
@@ -1 +1 @@
1
- {"version":3,"file":"create-drawer-navigator.d.ts","sourceRoot":"","sources":["../../src/drawer/create-drawer-navigator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,qBAAqB,EAErB,oBAAoB,EACpB,aAAa,EACb,YAAY,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S,oBAAoB,GAAG,aAAa,CAAC,SAAS,EAAE,WAAW,CAAC,EAClF,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,SAAS,EACpE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD;AAED,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"create-drawer-navigator.d.ts","sourceRoot":"","sources":["../../src/drawer/create-drawer-navigator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAER,qBAAqB,EAErB,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,KAAK,EACR,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACvB,MAAM,YAAY,CAAC;AAIpB,iFAAiF;AACjF,KAAK,aAAa,CACd,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3D;IACA,oCAAoC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,6BAA6B;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,oCAAoC;IACpC,KAAK,EAAE,qBAAqB,CAAC,SAAS,CAAC,CAAC;IACxC,0BAA0B;IAC1B,aAAa,EAAE,uBAAuB,CAAC;IACvC,kCAAkC;IAClC,QAAQ,EAAE,wBAAwB,CAAC;IACnC,mCAAmC;IACnC,cAAc,EAAE;SACX,SAAS,IAAI,MAAM,SAAS,GAAG,oBAAoB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;KAC1F,CAAC;IACF,+BAA+B;IAC/B,SAAS,EAAE,OAAO,eAAe,CAAC;CACrC,CAAC;AAEF,sFAAsF;AACtF,QAAA,MAAM,kBAAkB,EAAE,mBAAmB,CAAC,aAAa,CAAwC,CAAC;AAuBpG,2GAA2G;AAC3G,iBAAS,eAAe,CAAC,EACrB,aAAa,EACb,SAAS,EACT,eAAe,EACf,UAAU,EACV,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,GAAG,OAAO,EACb,EAAE,oBAAoB,GAAG,SAAS,CAyBlC;AAED,wHAAwH;AACxH,iBAAS,qBAAqB,CAC1B,KAAK,CAAC,SAAS,SAAS,aAAa,EACrC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,EACjE,KAAK,CAAC,OAAO,SAAS,oBAAoB,GAAG,aAAa,CAAC,SAAS,EAAE,WAAW,CAAC,EAClF,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,SAAS,EACpE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD;AAED,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE,CAAC"}
@@ -24,8 +24,8 @@ const useDrawerRouter = (isCollapsed) => {
24
24
  /** Renders the screens of a {@link createDrawerNavigator} beside a sidebar in an `AdwOverlaySplitView`. */
25
25
  function DrawerNavigator({ drawerContent, collapsed, sidebarPosition, pinSidebar, minSidebarWidth, maxSidebarWidth, sidebarWidthFraction, defaultStatus, ...options }) {
26
26
  const createRouter = useDrawerRouter(collapsed === true);
27
- const { state, descriptors, navigation, NavigationContent } = useNavigationBuilder(createRouter, { ...options, defaultStatus: defaultStatus ?? (collapsed === true ? "closed" : "open") });
28
- return (_jsx(NavigationContent, { children: _jsx(DrawerView, { state: state, navigation: navigation, descriptors: descriptors, drawerContent: drawerContent, collapsed: collapsed, sidebarPosition: sidebarPosition, pinSidebar: pinSidebar, minSidebarWidth: minSidebarWidth, maxSidebarWidth: maxSidebarWidth, sidebarWidthFraction: sidebarWidthFraction }) }));
27
+ const { state, descriptors, navigation, render } = useNavigationBuilder(createRouter, { ...options, defaultStatus: defaultStatus ?? (collapsed === true ? "closed" : "open") });
28
+ return render(_jsx(DrawerView, { state: state, navigation: navigation, descriptors: descriptors, drawerContent: drawerContent, collapsed: collapsed, sidebarPosition: sidebarPosition, pinSidebar: pinSidebar, minSidebarWidth: minSidebarWidth, maxSidebarWidth: maxSidebarWidth, sidebarWidthFraction: sidebarWidthFraction }));
29
29
  }
30
30
  /** Creates a drawer navigator rendered with `AdwOverlaySplitView`: a sidebar listing the screens beside the content. */
31
31
  function createDrawerNavigator(config) {
@@ -1 +1 @@
1
- {"version":3,"file":"create-drawer-navigator.js","sourceRoot":"","sources":["../../src/drawer/create-drawer-navigator.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQ5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAyB9C,sFAAsF;AACtF,MAAM,kBAAkB,GAAuC,mBAAmB,EAAiB,CAAC;AAEpG,MAAM,eAAe,GAAG,CAAC,WAAoB,EAAuB,EAAE;IAClE,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE;QACzB,IAAI,SAAS,GAAG,WAAW,CAAC;QAE5B,OAAO;YACH,IAAI,EAAE,GAAG,EAAE,CAAC,SAAS;YACrB,MAAM,EAAE,CAAC,MAAe,EAAE,EAAE;gBACxB,SAAS,GAAG,MAAM,CAAC;YACvB,CAAC;SACJ,CAAC;IACN,CAAC,CAAC,CAAC;IAEH,MAAM,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC,GAAG,EAA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":["import type {\n DrawerActionHelpers,\n DrawerNavigationState,\n DrawerRouterOptions,\n NavigatorTypeBagBase,\n ParamListBase,\n StaticConfig,\n StaticScreenFactory,\n TypedNavigator,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport { createNavigatorFactory, createScreenFactory, useNavigationBuilder } from \"@react-navigation/core\";\nimport { useEffect, useState } from \"react\";\nimport type { DrawerRouterFactory } from \"./drawer-router.js\";\nimport type {\n DrawerNavigationEventMap,\n DrawerNavigationOptions,\n DrawerNavigationProp,\n DrawerNavigatorProps,\n} from \"./types.js\";\nimport { createDrawerRouter } from \"./drawer-router.js\";\nimport { DrawerView } from \"./drawer-view.js\";\n\n/** Type bag describing the drawer navigator to React Navigation's typed APIs. */\ntype DrawerTypeBag<\n ParamList extends ParamListBase = ParamListBase,\n NavigatorID extends string | undefined = string | undefined,\n> = {\n /** Route names and their params. */\n ParamList: ParamList;\n /** Optional navigator id. */\n NavigatorID: NavigatorID;\n /** Shape of the navigator state. */\n State: DrawerNavigationState<ParamList>;\n /** Per-screen options. */\n ScreenOptions: DrawerNavigationOptions;\n /** Events the navigator emits. */\n EventMap: DrawerNavigationEventMap;\n /** Navigation object per route. */\n NavigationList: {\n [RouteName in keyof ParamList]: DrawerNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n /** The navigator component. */\n Navigator: typeof DrawerNavigator;\n};\n\n/** Declares a typed screen of a drawer navigator for the static configuration API. */\nconst createDrawerScreen: StaticScreenFactory<DrawerTypeBag> = createScreenFactory<DrawerTypeBag>();\n\nconst useDrawerRouter = (isCollapsed: boolean): DrawerRouterFactory => {\n const [flag] = useState(() => {\n let isCurrent = isCollapsed;\n\n return {\n read: () => isCurrent,\n update: (isNext: boolean) => {\n isCurrent = isNext;\n },\n };\n });\n\n const [createRouter] = useState(() => createDrawerRouter(flag.read));\n\n useEffect(() => {\n flag.update(isCollapsed);\n }, [flag, isCollapsed]);\n\n return createRouter;\n};\n\n/** Renders the screens of a {@link createDrawerNavigator} beside a sidebar in an `AdwOverlaySplitView`. */\nfunction DrawerNavigator({\n drawerContent,\n collapsed,\n sidebarPosition,\n pinSidebar,\n minSidebarWidth,\n maxSidebarWidth,\n sidebarWidthFraction,\n defaultStatus,\n ...options\n}: DrawerNavigatorProps): ReactNode {\n const createRouter = useDrawerRouter(collapsed === true);\n\n const { state, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n DrawerNavigationState<ParamListBase>,\n DrawerRouterOptions,\n DrawerActionHelpers<ParamListBase>,\n DrawerNavigationOptions,\n DrawerNavigationEventMap\n >(createRouter, { ...options, defaultStatus: defaultStatus ?? (collapsed === true ? \"closed\" : \"open\") });\n\n return (\n <NavigationContent>\n <DrawerView\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n drawerContent={drawerContent}\n collapsed={collapsed}\n sidebarPosition={sidebarPosition}\n pinSidebar={pinSidebar}\n minSidebarWidth={minSidebarWidth}\n maxSidebarWidth={maxSidebarWidth}\n sidebarWidthFraction={sidebarWidthFraction}\n />\n </NavigationContent>\n );\n}\n\n/** Creates a drawer navigator rendered with `AdwOverlaySplitView`: a sidebar listing the screens beside the content. */\nfunction createDrawerNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = string | undefined,\n const TypeBag extends NavigatorTypeBagBase = DrawerTypeBag<ParamList, NavigatorID>,\n const Config extends StaticConfig<TypeBag> | undefined = undefined,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(DrawerNavigator)(config) as TypedNavigator<TypeBag, Config>;\n}\n\nexport { createDrawerNavigator, createDrawerScreen, DrawerNavigator, type DrawerTypeBag };\n"]}
1
+ {"version":3,"file":"create-drawer-navigator.js","sourceRoot":"","sources":["../../src/drawer/create-drawer-navigator.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC3G,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MA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,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAE1G,OAAO,MAAM,CACT,KAAC,UAAU,IACP,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,UAAU,EAAE,UAAU,EACtB,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,GAC5C,CACL,CAAC;AACN,CAAC;AAED,wHAAwH;AACxH,SAAS,qBAAqB,CAK5B,MAAe;IACb,OAAO,sBAAsB,CAAC,eAAe,CAAC,CAAC,MAAM,CAAoC,CAAC;AAC9F,CAAC;AAED,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,eAAe,EAAsB,CAAC","sourcesContent":["import type {\n DrawerActionHelpers,\n DrawerNavigationState,\n DrawerRouterOptions,\n NavigatorTypeBagBase,\n ParamListBase,\n StaticConfig,\n StaticScreenFactory,\n TypedNavigator,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport { createNavigatorFactory, createScreenFactory, useNavigationBuilder } from \"@react-navigation/core\";\nimport { useEffect, useState } from \"react\";\nimport type { DrawerRouterFactory } from \"./drawer-router.js\";\nimport type {\n DrawerNavigationEventMap,\n DrawerNavigationOptions,\n DrawerNavigationProp,\n DrawerNavigatorProps,\n} from \"./types.js\";\nimport { createDrawerRouter } from \"./drawer-router.js\";\nimport { DrawerView } from \"./drawer-view.js\";\n\n/** Type bag describing the drawer navigator to React Navigation's typed APIs. */\ntype DrawerTypeBag<\n ParamList extends ParamListBase = ParamListBase,\n NavigatorID extends string | undefined = string | undefined,\n> = {\n /** Route names and their params. */\n ParamList: ParamList;\n /** Optional navigator id. */\n NavigatorID: NavigatorID;\n /** Shape of the navigator state. */\n State: DrawerNavigationState<ParamList>;\n /** Per-screen options. */\n ScreenOptions: DrawerNavigationOptions;\n /** Events the navigator emits. */\n EventMap: DrawerNavigationEventMap;\n /** Navigation object per route. */\n NavigationList: {\n [RouteName in keyof ParamList]: DrawerNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n /** The navigator component. */\n Navigator: typeof DrawerNavigator;\n};\n\n/** Declares a typed screen of a drawer navigator for the static configuration API. */\nconst createDrawerScreen: StaticScreenFactory<DrawerTypeBag> = createScreenFactory<DrawerTypeBag>();\n\nconst useDrawerRouter = (isCollapsed: boolean): DrawerRouterFactory => {\n const [flag] = useState(() => {\n let isCurrent = isCollapsed;\n\n return {\n read: () => isCurrent,\n update: (isNext: boolean) => {\n isCurrent = isNext;\n },\n };\n });\n\n const [createRouter] = useState(() => createDrawerRouter(flag.read));\n\n useEffect(() => {\n flag.update(isCollapsed);\n }, [flag, isCollapsed]);\n\n return createRouter;\n};\n\n/** Renders the screens of a {@link createDrawerNavigator} beside a sidebar in an `AdwOverlaySplitView`. */\nfunction DrawerNavigator({\n drawerContent,\n collapsed,\n sidebarPosition,\n pinSidebar,\n minSidebarWidth,\n maxSidebarWidth,\n sidebarWidthFraction,\n defaultStatus,\n ...options\n}: DrawerNavigatorProps): ReactNode {\n const createRouter = useDrawerRouter(collapsed === true);\n\n const { state, descriptors, navigation, render } = useNavigationBuilder<\n DrawerNavigationState<ParamListBase>,\n DrawerRouterOptions,\n DrawerActionHelpers<ParamListBase>,\n DrawerNavigationOptions,\n DrawerNavigationEventMap\n >(createRouter, { ...options, defaultStatus: defaultStatus ?? (collapsed === true ? \"closed\" : \"open\") });\n\n return render(\n <DrawerView\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n drawerContent={drawerContent}\n collapsed={collapsed}\n sidebarPosition={sidebarPosition}\n pinSidebar={pinSidebar}\n minSidebarWidth={minSidebarWidth}\n maxSidebarWidth={maxSidebarWidth}\n sidebarWidthFraction={sidebarWidthFraction}\n />,\n );\n}\n\n/** Creates a drawer navigator rendered with `AdwOverlaySplitView`: a sidebar listing the screens beside the content. */\nfunction createDrawerNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = string | undefined,\n const TypeBag extends NavigatorTypeBagBase = DrawerTypeBag<ParamList, NavigatorID>,\n const Config extends StaticConfig<TypeBag> | undefined = undefined,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(DrawerNavigator)(config) as TypedNavigator<TypeBag, Config>;\n}\n\nexport { createDrawerNavigator, createDrawerScreen, DrawerNavigator, type DrawerTypeBag };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"drawer-item-list.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer-item-list.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,kBAAkB,EAA6C,MAAM,YAAY,CAAC;AAgDhG,kGAAkG;AAClG,QAAA,MAAM,cAAc,GAAI,oCAAoC,kBAAkB,KAAG,SAgBhF,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"drawer-item-list.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer-item-list.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,kBAAkB,EAA6C,MAAM,YAAY,CAAC;AAmDhG,kGAAkG;AAClG,QAAA,MAAM,cAAc,GAAI,oCAAoC,kBAAkB,KAAG,SAgBhF,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as Gtk from "@gtkx/gi/gtk";
3
- import { GtkBox, GtkImage, GtkLabel, GtkListBox } from "@gtkx/jsx/gtk";
3
+ import { GtkBox, GtkImage, GtkLabel, GtkListBox, GtkListBoxRow } from "@gtkx/jsx/gtk";
4
4
  import { CommonActions, DrawerActions } from "@react-navigation/core";
5
5
  import { useCallback, useContext } from "react";
6
6
  import { requireDescriptor } from "../shared/routes.js";
@@ -28,7 +28,8 @@ const useDrawerItemPress = (navigation, isCollapsed) => useCallback((row) => {
28
28
  }, [navigation, isCollapsed]);
29
29
  const DrawerItem = ({ descriptor }) => {
30
30
  const { route, options } = descriptor;
31
- return (_jsxs(GtkBox, { spacing: 12, children: [options.drawerIcon === undefined ? null : _jsx(GtkImage, { iconName: options.drawerIcon }), _jsx(GtkLabel, { label: options.drawerLabel ?? options.title ?? route.name, xalign: 0 })] }));
31
+ const label = options.drawerLabel ?? options.title ?? route.name;
32
+ return (_jsx(GtkListBoxRow, { accessibleLabel: label, children: _jsxs(GtkBox, { spacing: 12, children: [options.drawerIcon === undefined ? null : _jsx(GtkImage, { iconName: options.drawerIcon }), _jsx(GtkLabel, { label: label, xalign: 0 })] }) }));
32
33
  };
33
34
  /** Lists the drawer routes as rows of a `GtkListBox`; activating a row navigates to its route. */
34
35
  const DrawerItemList = ({ state, navigation, descriptors }) => {
@@ -1 +1 @@
1
- {"version":3,"file":"drawer-item-list.js","sourceRoot":"","sources":["../../src/drawer/drawer-item-list.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAIvE,MAAM,gBAAgB,GAAG,CAAC,UAAmC,EAAE,KAAsB,EAAE,QAAgB,EAAW,EAAE;IAChH,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAErC,I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AK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAC,QAAQ,IAAC,QAAQ,EAAE,OAAO,CAAC,UAAU,GAAI,EACrF,KAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,GAAI,IAC7E,CACZ,CAAC;AACN,CAAC,CAAC;AAEF,kGAAkG;AAClG,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAsB,EAAa,EAAE;IACzF,MAAM,WAAW,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;IACvD,MAAM,cAAc,GAAG,kBAAkB,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;IAEnE,OAAO,CACH,KAAC,UAAU,IACP,UAAU,EAAE,CAAC,oBAAoB,CAAC,EAClC,aAAa,EAAE,KAAK,CAAC,KAAK,EAC1B,aAAa,EAAE,GAAG,CAAC,aAAa,CAAC,MAAM,EACvC,cAAc,EAAE,cAAc,YAE7B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACzB,KAAC,UAAU,IAAiB,UAAU,EAAE,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,IAAhE,KAAK,CAAC,GAAG,CAA2D,CACxF,CAAC,GACO,CAChB,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { NavigationState } from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { GtkBox, GtkImage, GtkLabel, GtkListBox } from \"@gtkx/jsx/gtk\";\nimport { CommonActions, DrawerActions } from \"@react-navigation/core\";\nimport { useCallback, useContext } from \"react\";\nimport type { DrawerContentProps, DrawerDescriptor, DrawerNavigationHelpers } from \"./types.js\";\nimport { requireDescriptor } from \"../shared/routes.js\";\nimport { DrawerCollapsedContext } from \"./drawer-collapsed-context.js\";\n\ntype RowActivated = (row: Gtk.ListBoxRow) => void;\n\nconst didNavigateToRow = (navigation: DrawerNavigationHelpers, state: NavigationState, rowIndex: number): boolean => {\n const route = state.routes[rowIndex];\n\n if (route === undefined) {\n return false;\n }\n\n const event = navigation.emit({ type: \"drawerItemPress\", target: route.key, canPreventDefault: true });\n\n if (event.defaultPrevented) {\n return false;\n }\n\n navigation.dispatch({ ...CommonActions.navigate(route.name, route.params), target: state.key });\n\n return true;\n};\n\nconst useDrawerItemPress = (navigation: DrawerNavigationHelpers, isCollapsed: boolean): RowActivated =>\n useCallback((row: Gtk.ListBoxRow) => {\n const state = navigation.getState();\n\n if (!didNavigateToRow(navigation, state, row.getIndex())) {\n return;\n }\n\n if (isCollapsed) {\n navigation.dispatch({ ...DrawerActions.closeDrawer(), target: state.key });\n }\n }, [navigation, isCollapsed]);\n\nconst DrawerItem = ({ descriptor }: { descriptor: DrawerDescriptor }): ReactNode => {\n const { route, options } = descriptor;\n\n return (\n <GtkBox spacing={12}>\n {options.drawerIcon === undefined ? null : <GtkImage iconName={options.drawerIcon} />}\n <GtkLabel label={options.drawerLabel ?? options.title ?? route.name} xalign={0} />\n </GtkBox>\n );\n};\n\n/** Lists the drawer routes as rows of a `GtkListBox`; activating a row navigates to its route. */\nconst DrawerItemList = ({ state, navigation, descriptors }: DrawerContentProps): ReactNode => {\n const isCollapsed = useContext(DrawerCollapsedContext);\n const onRowActivated = useDrawerItemPress(navigation, isCollapsed);\n\n return (\n <GtkListBox\n cssClasses={[\"navigation-sidebar\"]}\n selectedIndex={state.index}\n selectionMode={Gtk.SelectionMode.SINGLE}\n onRowActivated={onRowActivated}\n >\n {state.routes.map((route) => (\n <DrawerItem key={route.key} descriptor={requireDescriptor(descriptors, route.key)} />\n ))}\n </GtkListBox>\n );\n};\n\nexport { DrawerItemList };\n"]}
1
+ {"version":3,"file":"drawer-item-list.js","sourceR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aAAa,EAAE,KAAK,CAAC,KAAK,EAC1B,aAAa,EAAE,GAAG,CAAC,aAAa,CAAC,MAAM,EACvC,cAAc,EAAE,cAAc,YAE7B,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACzB,KAAC,UAAU,IAAiB,UAAU,EAAE,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,IAAhE,KAAK,CAAC,GAAG,CAA2D,CACxF,CAAC,GACO,CAChB,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import type { NavigationState } from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { GtkBox, GtkImage, GtkLabel, GtkListBox, GtkListBoxRow } from \"@gtkx/jsx/gtk\";\nimport { CommonActions, DrawerActions } from \"@react-navigation/core\";\nimport { useCallback, useContext } from \"react\";\nimport type { DrawerContentProps, DrawerDescriptor, DrawerNavigationHelpers } from \"./types.js\";\nimport { requireDescriptor } from \"../shared/routes.js\";\nimport { DrawerCollapsedContext } from \"./drawer-collapsed-context.js\";\n\ntype RowActivated = (row: Gtk.ListBoxRow) => void;\n\nconst didNavigateToRow = (navigation: DrawerNavigationHelpers, state: NavigationState, rowIndex: number): boolean => {\n const route = state.routes[rowIndex];\n\n if (route === undefined) {\n return false;\n }\n\n const event = navigation.emit({ type: \"drawerItemPress\", target: route.key, canPreventDefault: true });\n\n if (event.defaultPrevented) {\n return false;\n }\n\n navigation.dispatch({ ...CommonActions.navigate(route.name, route.params), target: state.key });\n\n return true;\n};\n\nconst useDrawerItemPress = (navigation: DrawerNavigationHelpers, isCollapsed: boolean): RowActivated =>\n useCallback((row: Gtk.ListBoxRow) => {\n const state = navigation.getState();\n\n if (!didNavigateToRow(navigation, state, row.getIndex())) {\n return;\n }\n\n if (isCollapsed) {\n navigation.dispatch({ ...DrawerActions.closeDrawer(), target: state.key });\n }\n }, [navigation, isCollapsed]);\n\nconst DrawerItem = ({ descriptor }: { descriptor: DrawerDescriptor }): ReactNode => {\n const { route, options } = descriptor;\n const label = options.drawerLabel ?? options.title ?? route.name;\n\n return (\n <GtkListBoxRow accessibleLabel={label}>\n <GtkBox spacing={12}>\n {options.drawerIcon === undefined ? null : <GtkImage iconName={options.drawerIcon} />}\n <GtkLabel label={label} xalign={0} />\n </GtkBox>\n </GtkListBoxRow>\n );\n};\n\n/** Lists the drawer routes as rows of a `GtkListBox`; activating a row navigates to its route. */\nconst DrawerItemList = ({ state, navigation, descriptors }: DrawerContentProps): ReactNode => {\n const isCollapsed = useContext(DrawerCollapsedContext);\n const onRowActivated = useDrawerItemPress(navigation, isCollapsed);\n\n return (\n <GtkListBox\n cssClasses={[\"navigation-sidebar\"]}\n selectedIndex={state.index}\n selectionMode={Gtk.SelectionMode.SINGLE}\n onRowActivated={onRowActivated}\n >\n {state.routes.map((route) => (\n <DrawerItem key={route.key} descriptor={requireDescriptor(descriptors, route.key)} />\n ))}\n </GtkListBox>\n );\n};\n\nexport { DrawerItemList };\n"]}
@@ -1,4 +1,4 @@
1
- import type { DrawerStatus, NavigationState } from "@react-navigation/core";
2
- declare const getDrawerStatus: (state: NavigationState) => DrawerStatus;
1
+ import type { DrawerNavigationState, DrawerStatus, ParamListBase } from "@react-navigation/core";
2
+ declare const getDrawerStatus: (state: DrawerNavigationState<ParamListBase>) => DrawerStatus;
3
3
  export { getDrawerStatus };
4
4
  //# sourceMappingURL=drawer-status.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawer-status.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAO5E,QAAA,MAAM,eAAe,GAAI,OAAO,eAAe,KAAG,YASjD,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"drawer-status.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEjG,QAAA,MAAM,eAAe,GAAI,OAAO,qBAAqB,CAAC,aAAa,CAAC,KAAG,YACgB,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,11 +1,3 @@
1
- const isDrawerEntry = (entry) => typeof entry === "object" && entry !== null && "type" in entry && entry.type === "drawer";
2
- const getDrawerStatus = (state) => {
3
- const history = state.history ?? [];
4
- const entry = history.findLast(isDrawerEntry);
5
- if (entry !== undefined) {
6
- return entry.status;
7
- }
8
- return "default" in state && state.default === "open" ? "open" : "closed";
9
- };
1
+ const getDrawerStatus = (state) => state.history.findLast((entry) => entry.type === "drawer")?.status ?? state.default;
10
2
  export { getDrawerStatus };
11
3
  //# sourceMappingURL=drawer-status.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawer-status.js","sourceRoot":"","sources":["../../src/drawer/drawer-status.ts"],"names":[],"mappings":"AAIA,MAAM,aAAa,GAAG,CAAC,KAAc,EAA+B,EAAE,CAClE,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;AAE9F,MAAM,eAAe,GAAG,CAAC,KAAsB,EAAgB,EAAE;IAC7D,MAAM,OAAO,GAAuB,KAAK,CAAC,OAAO,IAAI,EAAE,CAAC;IACxD,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAE9C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,KAAK,CAAC,MAAM,CAAC;IACxB,CAAC;IAED,OAAO,SAAS,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9E,CAAC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import type { DrawerStatus, NavigationState } from \"@react-navigation/core\";\n\ntype DrawerHistoryEntry = { type: \"drawer\"; status: DrawerStatus };\n\nconst isDrawerEntry = (entry: unknown): entry is DrawerHistoryEntry =>\n typeof entry === \"object\" && entry !== null && \"type\" in entry && entry.type === \"drawer\";\n\nconst getDrawerStatus = (state: NavigationState): DrawerStatus => {\n const history: readonly unknown[] = state.history ?? [];\n const entry = history.findLast(isDrawerEntry);\n\n if (entry !== undefined) {\n return entry.status;\n }\n\n return \"default\" in state && state.default === \"open\" ? \"open\" : \"closed\";\n};\n\nexport { getDrawerStatus };\n"]}
1
+ {"version":3,"file":"drawer-status.js","sourceRoot":"","sources":["../../src/drawer/drawer-status.ts"],"names":[],"mappings":"AAEA,MAAM,eAAe,GAAG,CAAC,KAA2C,EAAgB,EAAE,CAClF,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,EAAE,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import type { DrawerNavigationState, DrawerStatus, ParamListBase } from \"@react-navigation/core\";\n\nconst getDrawerStatus = (state: DrawerNavigationState<ParamListBase>): DrawerStatus =>\n state.history.findLast((entry) => entry.type === \"drawer\")?.status ?? state.default;\n\nexport { getDrawerStatus };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"drawer-view.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,OAAO,KAAK,EAGR,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EAC1B,MAAM,YAAY,CAAC;AAUpB,KAAK,eAAe,GAAG,sBAAsB,GAAG;IAC5C,KAAK,EAAE,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAC5C,UAAU,EAAE,uBAAuB,CAAC;IACpC,WAAW,EAAE,mBAAmB,CAAC;CACpC,CAAC;AAiGF,QAAA,MAAM,UAAU,GAAI,8DAA8D,eAAe,KAAG,SAsCnG,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"drawer-view.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer-view.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACnF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,OAAO,KAAK,EAGR,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,EAC1B,MAAM,YAAY,CAAC;AASpB,KAAK,eAAe,GAAG,sBAAsB,GAAG;IAC5C,KAAK,EAAE,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAC5C,UAAU,EAAE,uBAAuB,CAAC;IACpC,WAAW,EAAE,mBAAmB,CAAC;CACpC,CAAC;AA8FF,QAAA,MAAM,UAAU,GAAI,8DAA8D,eAAe,KAAG,SAqCnG,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -7,20 +7,17 @@ import { useCallback, useEffect, useRef } from "react";
7
7
  import { HeaderBar } from "../shared/header-bar.js";
8
8
  import { getFocusedRoute, requireDescriptor } from "../shared/routes.js";
9
9
  import { ScenePage } from "../shared/scene-page.js";
10
- import { useLoadedRoutes } from "../shared/use-loaded-routes.js";
11
10
  import { usePopToTopOnBlur } from "../shared/use-pop-to-top-on-blur.js";
12
11
  import { DrawerCollapsedContext } from "./drawer-collapsed-context.js";
13
12
  import { DrawerItemList } from "./drawer-item-list.js";
14
13
  import { getDrawerStatus } from "./drawer-status.js";
15
14
  const PACK_TYPES = { start: Gtk.PackType.START, end: Gtk.PackType.END };
16
15
  const useSidebarSync = (navigation) => useCallback((isShown) => {
17
- const current = navigation.getState();
18
- const isOpen = getDrawerStatus(current) === "open";
19
- if (isShown === null || isShown === isOpen) {
16
+ if (isShown === null) {
20
17
  return;
21
18
  }
22
19
  const action = isShown ? DrawerActions.openDrawer() : DrawerActions.closeDrawer();
23
- navigation.dispatch({ ...action, target: current.key });
20
+ navigation.dispatch({ ...action, target: navigation.getState().key });
24
21
  }, [navigation]);
25
22
  const useCloseOnNavigate = (state, navigation, isCollapsed) => {
26
23
  const focusedKey = getFocusedRoute(state).key;
@@ -28,7 +25,7 @@ const useCloseOnNavigate = (state, navigation, isCollapsed) => {
28
25
  useEffect(() => {
29
26
  const hasChanged = previousKeyRef.current !== focusedKey;
30
27
  previousKeyRef.current = focusedKey;
31
- if (hasChanged && isCollapsed && getDrawerStatus(navigation.getState()) === "open") {
28
+ if (hasChanged && isCollapsed) {
32
29
  navigation.dispatch({ ...DrawerActions.closeDrawer(), target: navigation.getState().key });
33
30
  }
34
31
  }, [focusedKey, isCollapsed, navigation]);
@@ -55,13 +52,12 @@ const DrawerView = ({ state, navigation, descriptors, drawerContent, ...config }
55
52
  const { collapsed = false, sidebarPosition = "start", pinSidebar, minSidebarWidth, maxSidebarWidth } = config;
56
53
  const focused = getFocusedRoute(state);
57
54
  const descriptor = requireDescriptor(descriptors, focused.key);
58
- const loaded = useLoadedRoutes(focused.key, state.preloadedRouteKeys);
59
55
  const onShowSidebarChanged = useSidebarSync(navigation);
60
56
  const contentProps = { state, navigation, descriptors };
61
57
  const sidebar = drawerContent === undefined ? _jsx(DrawerContent, { ...contentProps }) : drawerContent(contentProps);
62
58
  usePopToTopOnBlur(state, descriptors, navigation);
63
59
  useCloseOnNavigate(state, navigation, collapsed);
64
- return (_jsx(DrawerCollapsedContext, { value: collapsed, children: _jsx(AdwOverlaySplitView, { collapsed: collapsed, showSidebar: getDrawerStatus(state) === "open", sidebarPosition: PACK_TYPES[sidebarPosition], pinSidebar: pinSidebar, minSidebarWidth: minSidebarWidth, maxSidebarWidth: maxSidebarWidth, sidebarWidthFraction: config.sidebarWidthFraction, onNotifyShowSidebar: onShowSidebarChanged, sidebar: _jsx(_Fragment, { children: sidebar }), children: _jsx(AdwToolbarView, { topBar: _jsx(DrawerHeader, { descriptor: descriptor, navigation: navigation }), children: _jsx(AdwViewStack, { visibleChildName: focused.key, children: state.routes.map((route) => (_jsx(DrawerPage, { descriptor: requireDescriptor(descriptors, route.key), isLoaded: loaded.has(route.key) }, route.key))) }) }) }) }));
60
+ return (_jsx(DrawerCollapsedContext, { value: collapsed, children: _jsx(AdwOverlaySplitView, { collapsed: collapsed, showSidebar: getDrawerStatus(state) === "open", sidebarPosition: PACK_TYPES[sidebarPosition], pinSidebar: pinSidebar, minSidebarWidth: minSidebarWidth, maxSidebarWidth: maxSidebarWidth, sidebarWidthFraction: config.sidebarWidthFraction, onNotifyShowSidebar: onShowSidebarChanged, sidebar: _jsx(_Fragment, { children: sidebar }), children: _jsx(AdwToolbarView, { topBar: _jsx(DrawerHeader, { descriptor: descriptor, navigation: navigation }), children: _jsx(AdwViewStack, { visibleChildName: focused.key, children: state.routes.map((route) => (_jsx(DrawerPage, { descriptor: requireDescriptor(descriptors, route.key), isLoaded: route.key === focused.key || state.preloadedRouteKeys.includes(route.key) }, route.key))) }) }) }) }));
65
61
  };
66
62
  export { DrawerView };
67
63
  //# sourceMappingURL=drawer-view.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawer-view.js","sourceRoot":"","sources":["../../src/drawer/drawer-view.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,cAAc,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC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E,OAAO,CAAC,GAAG,YACtC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACzB,KAAC,UAAU,IAEP,UAAU,EAAE,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,EACrD,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAF1B,KAAK,CAAC,GAAG,CAGhB,CACL,CAAC,GACS,GACF,GACC,GACD,CAC5B,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type { DrawerNavigationState, ParamListBase } from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport {\n AdwHeaderBar,\n AdwOverlaySplitView,\n AdwToolbarView,\n AdwViewStack,\n AdwWindowTitle,\n} from \"@gtkx/jsx/adw\";\nimport { GtkButton, GtkScrolledWindow } from \"@gtkx/jsx/gtk\";\nimport { DrawerActions } from \"@react-navigation/core\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport type {\n DrawerContentProps,\n DrawerDescriptor,\n DrawerDescriptorMap,\n DrawerNavigationConfig,\n DrawerNavigationHelpers,\n} from \"./types.js\";\nimport { HeaderBar } from \"../shared/header-bar.js\";\nimport { getFocusedRoute, requireDescriptor } from \"../shared/routes.js\";\nimport { ScenePage } from \"../shared/scene-page.js\";\nimport { useLoadedRoutes } from \"../shared/use-loaded-routes.js\";\nimport { usePopToTopOnBlur } from \"../shared/use-pop-to-top-on-blur.js\";\nimport { DrawerCollapsedContext } from \"./drawer-collapsed-context.js\";\nimport { DrawerItemList } from \"./drawer-item-list.js\";\nimport { getDrawerStatus } from \"./drawer-status.js\";\n\ntype DrawerViewProps = DrawerNavigationConfig & {\n state: DrawerNavigationState<ParamListBase>;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\ntype DrawerHeaderProps = {\n descriptor: DrawerDescriptor;\n navigation: DrawerNavigationHelpers;\n};\n\ntype DrawerPageProps = {\n descriptor: DrawerDescriptor;\n isLoaded: boolean;\n};\n\nconst PACK_TYPES = { start: Gtk.PackType.START, end: Gtk.PackType.END } as const;\n\nconst useSidebarSync = (navigation: DrawerNavigationHelpers): ((isShown: boolean | null) => void) =>\n useCallback((isShown: boolean | null) => {\n const current = navigation.getState();\n const isOpen = getDrawerStatus(current) === \"open\";\n\n if (isShown === null || isShown === isOpen) {\n return;\n }\n\n const action = isShown ? DrawerActions.openDrawer() : DrawerActions.closeDrawer();\n navigation.dispatch({ ...action, target: current.key });\n }, [navigation]);\n\nconst useCloseOnNavigate = (\n state: DrawerNavigationState<ParamListBase>,\n navigation: DrawerNavigationHelpers,\n isCollapsed: boolean,\n): void => {\n const focusedKey = getFocusedRoute(state).key;\n const previousKeyRef = useRef(focusedKey);\n\n useEffect(() => {\n const hasChanged = previousKeyRef.current !== focusedKey;\n previousKeyRef.current = focusedKey;\n\n if (hasChanged && isCollapsed && getDrawerStatus(navigation.getState()) === \"open\") {\n navigation.dispatch({ ...DrawerActions.closeDrawer(), target: navigation.getState().key });\n }\n }, [focusedKey, isCollapsed, navigation]);\n};\n\nconst DrawerContent = (props: DrawerContentProps): ReactNode => (\n <AdwToolbarView topBar={<AdwHeaderBar />}>\n <GtkScrolledWindow hscrollbarPolicy={Gtk.PolicyType.NEVER}>\n <DrawerItemList {...props} />\n </GtkScrolledWindow>\n </AdwToolbarView>\n);\n\nconst DrawerToggle = ({ navigation }: { navigation: DrawerNavigationHelpers }): ReactNode => (\n <GtkButton\n iconName=\"sidebar-show-symbolic\"\n tooltipText=\"Toggle Sidebar\"\n accessibleLabel=\"Toggle Sidebar\"\n onClicked={() => {\n navigation.dispatch(DrawerActions.toggleDrawer());\n }}\n />\n);\n\nconst DrawerHeader = ({ descriptor, navigation }: DrawerHeaderProps): ReactNode => {\n const { route, options } = descriptor;\n\n if (options.headerShown === false) {\n return null;\n }\n\n if (options.header !== undefined) {\n return <>{options.header({ route, navigation: descriptor.navigation, options })}</>;\n }\n\n return (\n <HeaderBar\n options={options}\n start={<DrawerToggle navigation={navigation} />}\n titleWidget={<AdwWindowTitle title={options.title ?? route.name} />}\n />\n );\n};\n\nconst DrawerPage = ({ descriptor, isLoaded }: DrawerPageProps): ReactNode => {\n const { route, options } = descriptor;\n\n return (\n <ScenePage\n name={route.key}\n title={options.title ?? route.name}\n isLoaded={isLoaded || options.lazy === false}\n render={() => descriptor.render()}\n />\n );\n};\n\nconst DrawerView = ({ state, navigation, descriptors, drawerContent, ...config }: DrawerViewProps): ReactNode => {\n const { collapsed = false, sidebarPosition = \"start\", pinSidebar, minSidebarWidth, maxSidebarWidth } = config;\n const focused = getFocusedRoute(state);\n const descriptor = requireDescriptor(descriptors, focused.key);\n const loaded = useLoadedRoutes(focused.key, state.preloadedRouteKeys);\n const onShowSidebarChanged = useSidebarSync(navigation);\n const contentProps = { state, navigation, descriptors };\n const sidebar = drawerContent === undefined ? <DrawerContent {...contentProps} /> : drawerContent(contentProps);\n usePopToTopOnBlur(state, descriptors, navigation);\n useCloseOnNavigate(state, navigation, collapsed);\n\n return (\n <DrawerCollapsedContext value={collapsed}>\n <AdwOverlaySplitView\n collapsed={collapsed}\n showSidebar={getDrawerStatus(state) === \"open\"}\n sidebarPosition={PACK_TYPES[sidebarPosition]}\n pinSidebar={pinSidebar}\n minSidebarWidth={minSidebarWidth}\n maxSidebarWidth={maxSidebarWidth}\n sidebarWidthFraction={config.sidebarWidthFraction}\n onNotifyShowSidebar={onShowSidebarChanged}\n sidebar={<>{sidebar}</>}\n >\n <AdwToolbarView topBar={<DrawerHeader descriptor={descriptor} navigation={navigation} />}>\n <AdwViewStack visibleChildName={focused.key}>\n {state.routes.map((route) => (\n <DrawerPage\n key={route.key}\n descriptor={requireDescriptor(descriptors, route.key)}\n isLoaded={loaded.has(route.key)}\n />\n ))}\n </AdwViewStack>\n </AdwToolbarView>\n </AdwOverlaySplitView>\n </DrawerCollapsedContext>\n );\n};\n\nexport { DrawerView };\n"]}
1
+ {"version":3,"file":"drawer-view.js","sourceRoot":"","sources":["../../src/drawer/drawer-view.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,cAAc,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAQvD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAkBrD,MAAM,UAAU,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAW,CAAC;AAEjF,MAAM,cAAc,GAAG,CAAC,UAAmC,EAAuC,EAAE,CAChG,WAAW,CAAC,CAAC,OAAuB,EAAE,EAAE;IACpC,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO;IACX,CAAC;IAED,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,WAAW,EAAE,CAA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,CAAC,GAAG,YACtC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CACzB,KAAC,UAAU,IAEP,UAAU,EAAE,iBAAiB,CAAC,WAAW,EAAE,KAAK,CAAC,GAAG,CAAC,EACrD,QAAQ,EAAE,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAF9E,KAAK,CAAC,GAAG,CAGhB,CACL,CAAC,GACS,GACF,GACC,GACD,CAC5B,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC","sourcesContent":["import type { DrawerNavigationState, ParamListBase } from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport {\n AdwHeaderBar,\n AdwOverlaySplitView,\n AdwToolbarView,\n AdwViewStack,\n AdwWindowTitle,\n} from \"@gtkx/jsx/adw\";\nimport { GtkButton, GtkScrolledWindow } from \"@gtkx/jsx/gtk\";\nimport { DrawerActions } from \"@react-navigation/core\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport type {\n DrawerContentProps,\n DrawerDescriptor,\n DrawerDescriptorMap,\n DrawerNavigationConfig,\n DrawerNavigationHelpers,\n} from \"./types.js\";\nimport { HeaderBar } from \"../shared/header-bar.js\";\nimport { getFocusedRoute, requireDescriptor } from \"../shared/routes.js\";\nimport { ScenePage } from \"../shared/scene-page.js\";\nimport { usePopToTopOnBlur } from \"../shared/use-pop-to-top-on-blur.js\";\nimport { DrawerCollapsedContext } from \"./drawer-collapsed-context.js\";\nimport { DrawerItemList } from \"./drawer-item-list.js\";\nimport { getDrawerStatus } from \"./drawer-status.js\";\n\ntype DrawerViewProps = DrawerNavigationConfig & {\n state: DrawerNavigationState<ParamListBase>;\n navigation: DrawerNavigationHelpers;\n descriptors: DrawerDescriptorMap;\n};\n\ntype DrawerHeaderProps = {\n descriptor: DrawerDescriptor;\n navigation: DrawerNavigationHelpers;\n};\n\ntype DrawerPageProps = {\n descriptor: DrawerDescriptor;\n isLoaded: boolean;\n};\n\nconst PACK_TYPES = { start: Gtk.PackType.START, end: Gtk.PackType.END } as const;\n\nconst useSidebarSync = (navigation: DrawerNavigationHelpers): ((isShown: boolean | null) => void) =>\n useCallback((isShown: boolean | null) => {\n if (isShown === null) {\n return;\n }\n\n const action = isShown ? DrawerActions.openDrawer() : DrawerActions.closeDrawer();\n navigation.dispatch({ ...action, target: navigation.getState().key });\n }, [navigation]);\n\nconst useCloseOnNavigate = (\n state: DrawerNavigationState<ParamListBase>,\n navigation: DrawerNavigationHelpers,\n isCollapsed: boolean,\n): void => {\n const focusedKey = getFocusedRoute(state).key;\n const previousKeyRef = useRef(focusedKey);\n\n useEffect(() => {\n const hasChanged = previousKeyRef.current !== focusedKey;\n previousKeyRef.current = focusedKey;\n\n if (hasChanged && isCollapsed) {\n navigation.dispatch({ ...DrawerActions.closeDrawer(), target: navigation.getState().key });\n }\n }, [focusedKey, isCollapsed, navigation]);\n};\n\nconst DrawerContent = (props: DrawerContentProps): ReactNode => (\n <AdwToolbarView topBar={<AdwHeaderBar />}>\n <GtkScrolledWindow hscrollbarPolicy={Gtk.PolicyType.NEVER}>\n <DrawerItemList {...props} />\n </GtkScrolledWindow>\n </AdwToolbarView>\n);\n\nconst DrawerToggle = ({ navigation }: { navigation: DrawerNavigationHelpers }): ReactNode => (\n <GtkButton\n iconName=\"sidebar-show-symbolic\"\n tooltipText=\"Toggle Sidebar\"\n accessibleLabel=\"Toggle Sidebar\"\n onClicked={() => {\n navigation.dispatch(DrawerActions.toggleDrawer());\n }}\n />\n);\n\nconst DrawerHeader = ({ descriptor, navigation }: DrawerHeaderProps): ReactNode => {\n const { route, options } = descriptor;\n\n if (options.headerShown === false) {\n return null;\n }\n\n if (options.header !== undefined) {\n return <>{options.header({ route, navigation: descriptor.navigation, options })}</>;\n }\n\n return (\n <HeaderBar\n options={options}\n start={<DrawerToggle navigation={navigation} />}\n titleWidget={<AdwWindowTitle title={options.title ?? route.name} />}\n />\n );\n};\n\nconst DrawerPage = ({ descriptor, isLoaded }: DrawerPageProps): ReactNode => {\n const { route, options } = descriptor;\n\n return (\n <ScenePage\n name={route.key}\n title={options.title ?? route.name}\n isLoaded={isLoaded || options.lazy === false}\n render={() => descriptor.render()}\n />\n );\n};\n\nconst DrawerView = ({ state, navigation, descriptors, drawerContent, ...config }: DrawerViewProps): ReactNode => {\n const { collapsed = false, sidebarPosition = \"start\", pinSidebar, minSidebarWidth, maxSidebarWidth } = config;\n const focused = getFocusedRoute(state);\n const descriptor = requireDescriptor(descriptors, focused.key);\n const onShowSidebarChanged = useSidebarSync(navigation);\n const contentProps = { state, navigation, descriptors };\n const sidebar = drawerContent === undefined ? <DrawerContent {...contentProps} /> : drawerContent(contentProps);\n usePopToTopOnBlur(state, descriptors, navigation);\n useCloseOnNavigate(state, navigation, collapsed);\n\n return (\n <DrawerCollapsedContext value={collapsed}>\n <AdwOverlaySplitView\n collapsed={collapsed}\n showSidebar={getDrawerStatus(state) === \"open\"}\n sidebarPosition={PACK_TYPES[sidebarPosition]}\n pinSidebar={pinSidebar}\n minSidebarWidth={minSidebarWidth}\n maxSidebarWidth={maxSidebarWidth}\n sidebarWidthFraction={config.sidebarWidthFraction}\n onNotifyShowSidebar={onShowSidebarChanged}\n sidebar={<>{sidebar}</>}\n >\n <AdwToolbarView topBar={<DrawerHeader descriptor={descriptor} navigation={navigation} />}>\n <AdwViewStack visibleChildName={focused.key}>\n {state.routes.map((route) => (\n <DrawerPage\n key={route.key}\n descriptor={requireDescriptor(descriptors, route.key)}\n isLoaded={route.key === focused.key || state.preloadedRouteKeys.includes(route.key)}\n />\n ))}\n </AdwViewStack>\n </AdwToolbarView>\n </AdwOverlaySplitView>\n </DrawerCollapsedContext>\n );\n};\n\nexport { DrawerView };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"scene-page.d.ts","sourceRoot":"","sources":["../../src/shared/scene-page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,YAAY,CAAC;CAC9B,CAAC;AAEF,QAAA,MAAM,SAAS,GAAI,4CAA4C,cAAc,KAAG,SAW/E,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"scene-page.d.ts","sourceRoot":"","sources":["../../src/shared/scene-page.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIrD,KAAK,cAAc,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,YAAY,CAAC;CAC9B,CAAC;AAEF,QAAA,MAAM,SAAS,GAAI,4CAA4C,cAAc,KAAG,SAmB/E,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,5 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { AdwBin, AdwViewStackPage } from "@gtkx/jsx/adw";
3
- const ScenePage = ({ name, title, isLoaded, render, ...page }) => (_jsx(AdwViewStackPage, { name: name, title: title, iconName: page.iconName, badgeNumber: page.badgeNumber, needsAttention: page.needsAttention, useUnderline: false, children: _jsx(AdwBin, { children: isLoaded ? render() : null }) }));
3
+ import { useState } from "react";
4
+ const ScenePage = ({ name, title, isLoaded, render, ...page }) => {
5
+ const [hasLoaded, setHasLoaded] = useState(isLoaded);
6
+ if (isLoaded && !hasLoaded) {
7
+ setHasLoaded(true);
8
+ }
9
+ return (_jsx(AdwViewStackPage, { name: name, title: title, iconName: page.iconName, badgeNumber: page.badgeNumber, needsAttention: page.needsAttention, useUnderline: false, children: _jsx(AdwBin, { children: hasLoaded ? render() : null }) }));
10
+ };
4
11
  export { ScenePage };
5
12
  //# sourceMappingURL=scene-page.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scene-page.js","sourceRoot":"","sources":["../../src/shared/scene-page.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAYzD,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAkB,EAAa,EAAE,CAAC,CACzF,KAAC,gBAAgB,IACb,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,YAAY,EAAE,KAAK,YAEnB,KAAC,MAAM,cAAE,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,GAAU,GAC9B,CACtB,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import type { ReactElement, ReactNode } from \"react\";\nimport { AdwBin, AdwViewStackPage } from \"@gtkx/jsx/adw\";\n\ntype ScenePageProps = {\n name: string;\n title: string;\n iconName?: string;\n badgeNumber?: number;\n needsAttention?: boolean;\n isLoaded: boolean;\n render: () => ReactElement;\n};\n\nconst ScenePage = ({ name, title, isLoaded, render, ...page }: ScenePageProps): ReactNode => (\n <AdwViewStackPage\n name={name}\n title={title}\n iconName={page.iconName}\n badgeNumber={page.badgeNumber}\n needsAttention={page.needsAttention}\n useUnderline={false}\n >\n <AdwBin>{isLoaded ? render() : null}</AdwBin>\n </AdwViewStackPage>\n);\n\nexport { ScenePage };\n"]}
1
+ {"version":3,"file":"scene-page.js","sourceRoot":"","sources":["../../src/shared/scene-page.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAYjC,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAkB,EAAa,EAAE;IACxF,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAErD,IAAI,QAAQ,IAAI,CAAC,SAAS,EAAE,CAAC;QACzB,YAAY,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,CACH,KAAC,gBAAgB,IACb,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,cAAc,EAAE,IAAI,CAAC,cAAc,EACnC,YAAY,EAAE,KAAK,YAEnB,KAAC,MAAM,cAAE,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,GAAU,GAC/B,CACtB,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import type { ReactElement, ReactNode } from \"react\";\nimport { AdwBin, AdwViewStackPage } from \"@gtkx/jsx/adw\";\nimport { useState } from \"react\";\n\ntype ScenePageProps = {\n name: string;\n title: string;\n iconName?: string;\n badgeNumber?: number;\n needsAttention?: boolean;\n isLoaded: boolean;\n render: () => ReactElement;\n};\n\nconst ScenePage = ({ name, title, isLoaded, render, ...page }: ScenePageProps): ReactNode => {\n const [hasLoaded, setHasLoaded] = useState(isLoaded);\n\n if (isLoaded && !hasLoaded) {\n setHasLoaded(true);\n }\n\n return (\n <AdwViewStackPage\n name={name}\n title={title}\n iconName={page.iconName}\n badgeNumber={page.badgeNumber}\n needsAttention={page.needsAttention}\n useUnderline={false}\n >\n <AdwBin>{hasLoaded ? render() : null}</AdwBin>\n </AdwViewStackPage>\n );\n};\n\nexport { ScenePage };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"create-split-view-navigator.d.ts","sourceRoot":"","sources":["../../src/split-view/create-split-view-navigator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,oBAAoB,EACpB,aAAa,EAEb,oBAAoB,EAEpB,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACR,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EAC1B,MAAM,YAAY,CAAC;AAIpB,qFAAqF;AACrF,KAAK,gBAAgB,CACjB,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3D;IACA,oCAAoC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,6BAA6B;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,oCAAoC;IACpC,KAAK,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACvC,0BAA0B;IAC1B,aAAa,EAAE,0BAA0B,CAAC;IAC1C,kCAAkC;IAClC,QAAQ,EAAE,2BAA2B,CAAC;IACtC,mCAAmC;IACnC,cAAc,EAAE;SACX,SAAS,IAAI,MAAM,SAAS,GAAG,uBAAuB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;KAC7F,CAAC;IACF,+BAA+B;IAC/B,SAAS,EAAE,OAAO,kBAAkB,CAAC;CACxC,CAAC;AAEF,0FAA0F;AAC1F,QAAA,MAAM,qBAAqB,EAAE,mBAAmB,CAAC,gBAAgB,CAA2C,CAAC;AAE7G,gGAAgG;AAChG,iBAAS,kBAAkB,CAAC,EACxB,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,GAAG,OAAO,EACb,EAAE,uBAAuB,GAAG,SAAS,CA0BrC;AAED;;;GAGG;AACH,iBAAS,wBAAwB,CAC7B,KAAK,CAAC,SAAS,SAAS,aAAa,EACrC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,EACjE,KAAK,CAAC,OAAO,SAAS,oBAAoB,GAAG,gBAAgB,CAAC,SAAS,EAAE,WAAW,CAAC,EACrF,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,SAAS,EACpE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD;AAED,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"create-split-view-navigator.d.ts","sourceRoot":"","sources":["../../src/split-view/create-split-view-navigator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,oBAAoB,EACpB,aAAa,EAEb,oBAAoB,EAEpB,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACR,2BAA2B,EAC3B,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EAC1B,MAAM,YAAY,CAAC;AAIpB,qFAAqF;AACrF,KAAK,gBAAg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AAE,qBAAqB,EAAE,kBAAkB,EAAE,KAAK,gBAAgB,EAAE,CAAC"}
@@ -6,8 +6,8 @@ import { SplitView } from "./split-view.js";
6
6
  const createSplitViewScreen = createScreenFactory();
7
7
  /** Renders the screens of a {@link createSplitViewNavigator} in an `AdwNavigationSplitView`. */
8
8
  function SplitViewNavigator({ collapsed, contentPlaceholder, sidebarPosition, minSidebarWidth, maxSidebarWidth, sidebarWidthFraction, popOnEscape, ...options }) {
9
- const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder(splitViewRouter, options);
10
- return (_jsx(NavigationContent, { children: _jsx(SplitView, { state: state, navigation: navigation, descriptors: descriptors, describe: describe, collapsed: collapsed, contentPlaceholder: contentPlaceholder, sidebarPosition: sidebarPosition, minSidebarWidth: minSidebarWidth, maxSidebarWidth: maxSidebarWidth, sidebarWidthFraction: sidebarWidthFraction, popOnEscape: popOnEscape }) }));
9
+ const { state, describe, descriptors, navigation, render } = useNavigationBuilder(splitViewRouter, options);
10
+ return render(_jsx(SplitView, { state: state, navigation: navigation, descriptors: descriptors, describe: describe, collapsed: collapsed, contentPlaceholder: contentPlaceholder, sidebarPosition: sidebarPosition, minSidebarWidth: minSidebarWidth, maxSidebarWidth: maxSidebarWidth, sidebarWidthFraction: sidebarWidthFraction, popOnEscape: popOnEscape }));
11
11
  }
12
12
  /**
13
13
  * Creates a master/detail navigator rendered with `AdwNavigationSplitView`: the first screen fills the sidebar
@@ -1 +1 @@
1
- {"version":3,"file":"create-split-view-navigator.js","sourceRoot":"","sources":["../../src/split-view/create-split-view-navigator.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAO3G,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAyB5C,0FAA0F;AAC1F,MAAM,qBAAqB,GAA0C,mBAAmB,EAAoB,CAAC;AAE7G,gGAAgG;AAChG,SAAS,kBAAkB,CAAC,EACxB,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,GAAG,OAAO,EACY;IACtB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,oBAAoB,CAM1F,eAAe,EAAE,OAAO,CAAC,CAAC;IAE5B,OAAO,CACH,KAAC,iBAAiB,cACd,KAAC,SAAS,IACN,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,EAC1C,WAAW,EAAE,WAAW,GAC1B,GACc,CACvB,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,SAAS,wBAAwB,CAK/B,MAAe;IACb,OAAO,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAoC,CAAC;AACjG,CAAC;AAED,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,kBAAkB,EAAyB,CAAC","sourcesContent":["import type {\n NavigatorTypeBagBase,\n ParamListBase,\n StackActionHelpers,\n StackNavigationState,\n StackRouterOptions,\n StaticConfig,\n StaticScreenFactory,\n TypedNavigator,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport { createNavigatorFactory, createScreenFactory, useNavigationBuilder } from \"@react-navigation/core\";\nimport type {\n SplitViewNavigationEventMap,\n SplitViewNavigationOptions,\n SplitViewNavigationProp,\n SplitViewNavigatorProps,\n} from \"./types.js\";\nimport { splitViewRouter } from \"./split-view-router.js\";\nimport { SplitView } from \"./split-view.js\";\n\n/** Type bag describing the split view navigator to React Navigation's typed APIs. */\ntype SplitViewTypeBag<\n ParamList extends ParamListBase = ParamListBase,\n NavigatorID extends string | undefined = string | undefined,\n> = {\n /** Route names and their params. */\n ParamList: ParamList;\n /** Optional navigator id. */\n NavigatorID: NavigatorID;\n /** Shape of the navigator state. */\n State: StackNavigationState<ParamList>;\n /** Per-screen options. */\n ScreenOptions: SplitViewNavigationOptions;\n /** Events the navigator emits. */\n EventMap: SplitViewNavigationEventMap;\n /** Navigation object per route. */\n NavigationList: {\n [RouteName in keyof ParamList]: SplitViewNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n /** The navigator component. */\n Navigator: typeof SplitViewNavigator;\n};\n\n/** Declares a typed screen of a split view navigator for the static configuration API. */\nconst createSplitViewScreen: StaticScreenFactory<SplitViewTypeBag> = createScreenFactory<SplitViewTypeBag>();\n\n/** Renders the screens of a {@link createSplitViewNavigator} in an `AdwNavigationSplitView`. */\nfunction SplitViewNavigator({\n collapsed,\n contentPlaceholder,\n sidebarPosition,\n minSidebarWidth,\n maxSidebarWidth,\n sidebarWidthFraction,\n popOnEscape,\n ...options\n}: SplitViewNavigatorProps): ReactNode {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n SplitViewNavigationOptions,\n SplitViewNavigationEventMap\n >(splitViewRouter, options);\n\n return (\n <NavigationContent>\n <SplitView\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n collapsed={collapsed}\n contentPlaceholder={contentPlaceholder}\n sidebarPosition={sidebarPosition}\n minSidebarWidth={minSidebarWidth}\n maxSidebarWidth={maxSidebarWidth}\n sidebarWidthFraction={sidebarWidthFraction}\n popOnEscape={popOnEscape}\n />\n </NavigationContent>\n );\n}\n\n/**\n * Creates a master/detail navigator rendered with `AdwNavigationSplitView`: the first screen fills the sidebar\n * pane, the rest are a stack in the content pane, and a narrow window collapses the two into one.\n */\nfunction createSplitViewNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = string | undefined,\n const TypeBag extends NavigatorTypeBagBase = SplitViewTypeBag<ParamList, NavigatorID>,\n const Config extends StaticConfig<TypeBag> | undefined = undefined,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(SplitViewNavigator)(config) as TypedNavigator<TypeBag, Config>;\n}\n\nexport { createSplitViewNavigator, createSplitViewScreen, SplitViewNavigator, type SplitViewTypeBag };\n"]}
1
+ {"version":3,"file":"create-split-view-navigator.js","sourceRoot":"","sources":["../../src/split-view/create-split-view-navigator.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAO3G,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAyB5C,0FAA0F;AAC1F,MAAM,qBAAqB,GAA0C,mBAAmB,EAAoB,CAAC;AAE7G,gGAAgG;AAChG,SAAS,kBAAkB,CAAC,EACxB,SAAS,EACT,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,GAAG,OAAO,EACY;IACtB,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAM/E,eAAe,EAAE,OAAO,CAAC,CAAC;IAE5B,OAAO,MAAM,CACT,KAAC,SAAS,IACN,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,EAC1C,WAAW,EAAE,WAAW,GAC1B,CACL,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,SAAS,wBAAwB,CAK/B,MAAe;IACb,OAAO,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAoC,CAAC;AACjG,CAAC;AAED,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,kBAAkB,EAAyB,CAAC","sourcesContent":["import type {\n NavigatorTypeBagBase,\n ParamListBase,\n StackActionHelpers,\n StackNavigationState,\n StackRouterOptions,\n StaticConfig,\n StaticScreenFactory,\n TypedNavigator,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport { createNavigatorFactory, createScreenFactory, useNavigationBuilder } from \"@react-navigation/core\";\nimport type {\n SplitViewNavigationEventMap,\n SplitViewNavigationOptions,\n SplitViewNavigationProp,\n SplitViewNavigatorProps,\n} from \"./types.js\";\nimport { splitViewRouter } from \"./split-view-router.js\";\nimport { SplitView } from \"./split-view.js\";\n\n/** Type bag describing the split view navigator to React Navigation's typed APIs. */\ntype SplitViewTypeBag<\n ParamList extends ParamListBase = ParamListBase,\n NavigatorID extends string | undefined = string | undefined,\n> = {\n /** Route names and their params. */\n ParamList: ParamList;\n /** Optional navigator id. */\n NavigatorID: NavigatorID;\n /** Shape of the navigator state. */\n State: StackNavigationState<ParamList>;\n /** Per-screen options. */\n ScreenOptions: SplitViewNavigationOptions;\n /** Events the navigator emits. */\n EventMap: SplitViewNavigationEventMap;\n /** Navigation object per route. */\n NavigationList: {\n [RouteName in keyof ParamList]: SplitViewNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n /** The navigator component. */\n Navigator: typeof SplitViewNavigator;\n};\n\n/** Declares a typed screen of a split view navigator for the static configuration API. */\nconst createSplitViewScreen: StaticScreenFactory<SplitViewTypeBag> = createScreenFactory<SplitViewTypeBag>();\n\n/** Renders the screens of a {@link createSplitViewNavigator} in an `AdwNavigationSplitView`. */\nfunction SplitViewNavigator({\n collapsed,\n contentPlaceholder,\n sidebarPosition,\n minSidebarWidth,\n maxSidebarWidth,\n sidebarWidthFraction,\n popOnEscape,\n ...options\n}: SplitViewNavigatorProps): ReactNode {\n const { state, describe, descriptors, navigation, render } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n SplitViewNavigationOptions,\n SplitViewNavigationEventMap\n >(splitViewRouter, options);\n\n return render(\n <SplitView\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n collapsed={collapsed}\n contentPlaceholder={contentPlaceholder}\n sidebarPosition={sidebarPosition}\n minSidebarWidth={minSidebarWidth}\n maxSidebarWidth={maxSidebarWidth}\n sidebarWidthFraction={sidebarWidthFraction}\n popOnEscape={popOnEscape}\n />,\n );\n}\n\n/**\n * Creates a master/detail navigator rendered with `AdwNavigationSplitView`: the first screen fills the sidebar\n * pane, the rest are a stack in the content pane, and a narrow window collapses the two into one.\n */\nfunction createSplitViewNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = string | undefined,\n const TypeBag extends NavigatorTypeBagBase = SplitViewTypeBag<ParamList, NavigatorID>,\n const Config extends StaticConfig<TypeBag> | undefined = undefined,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(SplitViewNavigator)(config) as TypedNavigator<TypeBag, Config>;\n}\n\nexport { createSplitViewNavigator, createSplitViewScreen, SplitViewNavigator, type SplitViewTypeBag };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"create-stack-navigator.d.ts","sourceRoot":"","sources":["../../src/stack/create-stack-navigator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,oBAAoB,EACpB,aAAa,EAEb,oBAAoB,EAEpB,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACR,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EAC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KAAK,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"create-stack-navigator.d.ts","sourceRoot":"","sources":["../../src/stack/create-stack-navigator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,oBAAoB,EACpB,aAAa,EAEb,oBAAoB,EAEpB,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EACR,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,YAAY,CAAC;AAGpB,gFAAgF;AAChF,KAAK,YAAY,CACb,SAAS,SAAS,aAAa,GAAG,aAAa,EAC/C,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3D;IACA,oCAAoC;IACpC,SAAS,EAAE,SAAS,CAAC;IACrB,6BAA6B;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,oCAAoC;IACpC,KAAK,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACvC,0BAA0B;IAC1B,aAAa,EAAE,sBAAsB,CAAC;IACtC,kCAAkC;IAClC,QAAQ,EAAE,uBAAuB,CAAC;IAClC,mCAAmC;IACnC,cAAc,EAAE;SACX,SAAS,IAAI,MAAM,SAAS,GAAG,mBAAmB,CAAC,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC;KACzF,CAAC;IACF,+BAA+B;IAC/B,SAAS,EAAE,OAAO,cAAc,CAAC;CACpC,CAAC;AAEF,qFAAqF;AACrF,QAAA,MAAM,iBAAiB,EAAE,mBAAmB,CAAC,YAAY,CAAuC,CAAC;AAEjG,gGAAgG;AAChG,iBAAS,cAAc,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAkBnF;AAED,sHAAsH;AACtH,iBAAS,oBAAoB,CACzB,KAAK,CAAC,SAAS,SAAS,aAAa,EACrC,KAAK,CAAC,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,EACjE,KAAK,CAAC,OAAO,SAAS,oBAAoB,GAAG,YAAY,CAAC,SAAS,EAAE,WAAW,CAAC,EACjF,KAAK,CAAC,MAAM,SAAS,YAAY,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,SAAS,EACpE,MAAM,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAElD;AAED,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAE,KAAK,YAAY,EAAE,CAAC"}
@@ -5,8 +5,8 @@ import { StackView } from "./stack-view.js";
5
5
  const createStackScreen = createScreenFactory();
6
6
  /** Renders the screens of a {@link createStackNavigator} as pages of an `AdwNavigationView`. */
7
7
  function StackNavigator({ popOnEscape, ...options }) {
8
- const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder(StackRouter, options);
9
- return (_jsx(NavigationContent, { children: _jsx(StackView, { popOnEscape: popOnEscape, state: state, navigation: navigation, descriptors: descriptors, describe: describe }) }));
8
+ const { state, describe, descriptors, navigation, render } = useNavigationBuilder(StackRouter, options);
9
+ return render(_jsx(StackView, { popOnEscape: popOnEscape, state: state, navigation: navigation, descriptors: descriptors, describe: describe }));
10
10
  }
11
11
  /** Creates a stack navigator rendered with `AdwNavigationView`: pushes and pops animate like native Adwaita pages. */
12
12
  function createStackNavigator(config) {
@@ -1 +1 @@
1
- {"version":3,"file":"create-stack-navigator.js","sourceRoot":"","sources":["../../src/stack/create-stack-navigator.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAOxH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAyB5C,qFAAqF;AACrF,MAAM,iBAAiB,GAAsC,mBAAmB,EAAgB,CAAC;AAEjG,gGAAgG;AAChG,SAAS,cAAc,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,EAAuB;IACpE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,oBAAoB,CAM1F,WAAW,EAAE,OAAO,CAAC,CAAC;IAExB,OAAO,CACH,KAAC,iBAAiB,cACd,KAAC,SAAS,IACN,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GACpB,GACc,CACvB,CAAC;AACN,CAAC;AAED,sHAAsH;AACtH,SAAS,oBAAoB,CAK3B,MAAe;IACb,OAAO,sBAAsB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAoC,CAAC;AAC7F,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAqB,CAAC","sourcesContent":["import type {\n NavigatorTypeBagBase,\n ParamListBase,\n StackActionHelpers,\n StackNavigationState,\n StackRouterOptions,\n StaticConfig,\n StaticScreenFactory,\n TypedNavigator,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport { createNavigatorFactory, createScreenFactory, StackRouter, useNavigationBuilder } from \"@react-navigation/core\";\nimport type {\n StackNavigationEventMap,\n StackNavigationOptions,\n StackNavigationProp,\n StackNavigatorProps,\n} from \"./types.js\";\nimport { StackView } from \"./stack-view.js\";\n\n/** Type bag describing the stack navigator to React Navigation's typed APIs. */\ntype StackTypeBag<\n ParamList extends ParamListBase = ParamListBase,\n NavigatorID extends string | undefined = string | undefined,\n> = {\n /** Route names and their params. */\n ParamList: ParamList;\n /** Optional navigator id. */\n NavigatorID: NavigatorID;\n /** Shape of the navigator state. */\n State: StackNavigationState<ParamList>;\n /** Per-screen options. */\n ScreenOptions: StackNavigationOptions;\n /** Events the navigator emits. */\n EventMap: StackNavigationEventMap;\n /** Navigation object per route. */\n NavigationList: {\n [RouteName in keyof ParamList]: StackNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n /** The navigator component. */\n Navigator: typeof StackNavigator;\n};\n\n/** Declares a typed screen of a stack navigator for the static configuration API. */\nconst createStackScreen: StaticScreenFactory<StackTypeBag> = createScreenFactory<StackTypeBag>();\n\n/** Renders the screens of a {@link createStackNavigator} as pages of an `AdwNavigationView`. */\nfunction StackNavigator({ popOnEscape, ...options }: StackNavigatorProps): ReactNode {\n const { state, describe, descriptors, navigation, NavigationContent } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n StackNavigationOptions,\n StackNavigationEventMap\n >(StackRouter, options);\n\n return (\n <NavigationContent>\n <StackView\n popOnEscape={popOnEscape}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />\n </NavigationContent>\n );\n}\n\n/** Creates a stack navigator rendered with `AdwNavigationView`: pushes and pops animate like native Adwaita pages. */\nfunction createStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = string | undefined,\n const TypeBag extends NavigatorTypeBagBase = StackTypeBag<ParamList, NavigatorID>,\n const Config extends StaticConfig<TypeBag> | undefined = undefined,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(StackNavigator)(config) as TypedNavigator<TypeBag, Config>;\n}\n\nexport { createStackNavigator, createStackScreen, StackNavigator, type StackTypeBag };\n"]}
1
+ {"version":3,"file":"create-stack-navigator.js","sourceRoot":"","sources":["../../src/stack/create-stack-navigator.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAOxH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAyB5C,qFAAqF;AACrF,MAAM,iBAAiB,GAAsC,mBAAmB,EAAgB,CAAC;AAEjG,gGAAgG;AAChG,SAAS,cAAc,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,EAAuB;IACpE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,oBAAoB,CAM/E,WAAW,EAAE,OAAO,CAAC,CAAC;IAExB,OAAO,MAAM,CACT,KAAC,SAAS,IACN,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GACpB,CACL,CAAC;AACN,CAAC;AAED,sHAAsH;AACtH,SAAS,oBAAoB,CAK3B,MAAe;IACb,OAAO,sBAAsB,CAAC,cAAc,CAAC,CAAC,MAAM,CAAoC,CAAC;AAC7F,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAqB,CAAC","sourcesContent":["import type {\n NavigatorTypeBagBase,\n ParamListBase,\n StackActionHelpers,\n StackNavigationState,\n StackRouterOptions,\n StaticConfig,\n StaticScreenFactory,\n TypedNavigator,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport { createNavigatorFactory, createScreenFactory, StackRouter, useNavigationBuilder } from \"@react-navigation/core\";\nimport type {\n StackNavigationEventMap,\n StackNavigationOptions,\n StackNavigationProp,\n StackNavigatorProps,\n} from \"./types.js\";\nimport { StackView } from \"./stack-view.js\";\n\n/** Type bag describing the stack navigator to React Navigation's typed APIs. */\ntype StackTypeBag<\n ParamList extends ParamListBase = ParamListBase,\n NavigatorID extends string | undefined = string | undefined,\n> = {\n /** Route names and their params. */\n ParamList: ParamList;\n /** Optional navigator id. */\n NavigatorID: NavigatorID;\n /** Shape of the navigator state. */\n State: StackNavigationState<ParamList>;\n /** Per-screen options. */\n ScreenOptions: StackNavigationOptions;\n /** Events the navigator emits. */\n EventMap: StackNavigationEventMap;\n /** Navigation object per route. */\n NavigationList: {\n [RouteName in keyof ParamList]: StackNavigationProp<ParamList, RouteName, NavigatorID>;\n };\n /** The navigator component. */\n Navigator: typeof StackNavigator;\n};\n\n/** Declares a typed screen of a stack navigator for the static configuration API. */\nconst createStackScreen: StaticScreenFactory<StackTypeBag> = createScreenFactory<StackTypeBag>();\n\n/** Renders the screens of a {@link createStackNavigator} as pages of an `AdwNavigationView`. */\nfunction StackNavigator({ popOnEscape, ...options }: StackNavigatorProps): ReactNode {\n const { state, describe, descriptors, navigation, render } = useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n StackRouterOptions,\n StackActionHelpers<ParamListBase>,\n StackNavigationOptions,\n StackNavigationEventMap\n >(StackRouter, options);\n\n return render(\n <StackView\n popOnEscape={popOnEscape}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />,\n );\n}\n\n/** Creates a stack navigator rendered with `AdwNavigationView`: pushes and pops animate like native Adwaita pages. */\nfunction createStackNavigator<\n const ParamList extends ParamListBase,\n const NavigatorID extends string | undefined = string | undefined,\n const TypeBag extends NavigatorTypeBagBase = StackTypeBag<ParamList, NavigatorID>,\n const Config extends StaticConfig<TypeBag> | undefined = undefined,\n>(config?: Config): TypedNavigator<TypeBag, Config> {\n return createNavigatorFactory(StackNavigator)(config) as TypedNavigator<TypeBag, Config>;\n}\n\nexport { createStackNavigator, createStackScreen, StackNavigator, type StackTypeBag };\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stack-pages.d.ts","sourceRoot":"","sources":["../../src/stack/stack-pages.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE7F,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEtE,KAAK,UAAU,GAAG,oBAAoB,CAAC,aAAa,CAAC,CAAC;AACtD,KAAK,QAAQ,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,EAAE,aAAa,EAAE,OAAO,KAAK,eAAe,CAAC;A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