@gtkx/navigation 2.0.0-beta.11 → 2.0.0-beta.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/drawer/drawer-item-list.d.ts.map +1 -1
- package/dist/drawer/drawer-item-list.js +3 -2
- package/dist/drawer/drawer-item-list.js.map +1 -1
- package/dist/drawer/drawer-router.d.ts.map +1 -1
- package/dist/drawer/drawer-router.js.map +1 -1
- package/dist/drawer/drawer-status.d.ts.map +1 -1
- package/dist/drawer/drawer-view.d.ts.map +1 -1
- package/dist/drawer/drawer-view.js +5 -5
- package/dist/drawer/drawer-view.js.map +1 -1
- package/dist/drawer/types.d.ts +2 -0
- package/dist/drawer/types.d.ts.map +1 -1
- package/dist/drawer/types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/shared/header-bar.d.ts.map +1 -1
- package/dist/shared/header-bar.js +2 -2
- package/dist/shared/header-bar.js.map +1 -1
- package/dist/shared/routes.d.ts.map +1 -1
- package/dist/shared/scene-page.d.ts +3 -1
- package/dist/shared/scene-page.d.ts.map +1 -1
- package/dist/shared/scene-page.js +2 -2
- package/dist/shared/scene-page.js.map +1 -1
- package/dist/shared/use-pop-to-top-on-blur.d.ts.map +1 -1
- package/dist/split-view/split-view.d.ts.map +1 -1
- package/dist/split-view/split-view.js +3 -7
- package/dist/split-view/split-view.js.map +1 -1
- package/dist/split-view/types.d.ts.map +1 -1
- package/dist/split-view/types.js.map +1 -1
- package/dist/stack/stack-pages.d.ts.map +1 -1
- package/dist/stack/stack-pages.js +3 -5
- package/dist/stack/stack-pages.js.map +1 -1
- package/dist/stack/stack-view.d.ts.map +1 -1
- package/dist/stack/stack-view.js +5 -13
- package/dist/stack/stack-view.js.map +1 -1
- package/dist/stack/sync-navigation-stack.d.ts.map +1 -1
- package/dist/stack/types.d.ts.map +1 -1
- package/dist/stack/types.js.map +1 -1
- package/dist/tabs/tab-view.d.ts.map +1 -1
- package/dist/tabs/tab-view.js +5 -7
- package/dist/tabs/tab-view.js.map +1 -1
- package/dist/tabs/types.d.ts +2 -0
- package/dist/tabs/types.d.ts.map +1 -1
- package/dist/tabs/types.js.map +1 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js.map +1 -1
- package/package.json +9 -19
- package/src/drawer/drawer-item-list.tsx +16 -12
- package/src/drawer/drawer-router.ts +4 -2
- package/src/drawer/drawer-view.tsx +16 -16
- package/src/drawer/types.ts +6 -3
- package/src/index.ts +1 -5
- package/src/shared/header-bar.tsx +2 -2
- package/src/shared/scene-page.tsx +5 -2
- package/src/split-view/split-view.tsx +32 -26
- package/src/split-view/types.ts +4 -3
- package/src/stack/stack-pages.ts +14 -12
- package/src/stack/stack-view.tsx +9 -15
- package/src/stack/types.ts +4 -3
- package/src/tabs/tab-view.tsx +27 -21
- package/src/tabs/types.ts +6 -3
- package/src/theme.ts +0 -1
package/README.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
React Navigation navigators for GTKX.
|
|
4
4
|
|
|
5
|
-
Build stack, tab, drawer, and split-view navigation with native Adwaita containers.
|
|
5
|
+
Build stack, tab, drawer, and split-view navigation with native Adwaita containers. Define typed routes, nest navigators, and adapt sidebar and content layouts to the available space.
|
|
6
6
|
|
|
7
|
-
In an existing GTKX
|
|
7
|
+
In an existing GTKX app:
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
10
|
npm install @gtkx/navigation@beta
|
|
@@ -12,6 +12,6 @@ npm install @gtkx/navigation@beta
|
|
|
12
12
|
|
|
13
13
|
[Guide](https://gtkx.dev/v2/guide/navigation) · [API reference](https://gtkx.dev/v2/reference/@gtkx/navigation/) · [GTKX](https://gtkx.dev)
|
|
14
14
|
|
|
15
|
-
GTKX
|
|
15
|
+
GTKX requires Linux, Node.js, and the [native prerequisites](https://gtkx.dev/v2/guide/getting-started).
|
|
16
16
|
|
|
17
17
|
[MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
|
|
@@ -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;
|
|
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;AAuDhG,kGAAkG;AAClG,QAAA,MAAM,cAAc,uCAAwC,kBAAkB,KAAG,SAgBhF,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
3
|
import { GtkBox, GtkImage, GtkLabel, GtkListBox, GtkListBoxRow } from "@gtkx/jsx/gtk";
|
|
4
4
|
import { CommonActions, DrawerActions } from "@react-navigation/core";
|
|
5
|
-
import { useCallback, useContext } from "react";
|
|
5
|
+
import { useCallback, useContext, useState } from "react";
|
|
6
6
|
import { requireDescriptor } from "../shared/routes.js";
|
|
7
7
|
import { DrawerCollapsedContext } from "./drawer-collapsed-context.js";
|
|
8
8
|
const didNavigateToRow = (navigation, state, rowIndex) => {
|
|
@@ -29,7 +29,8 @@ const useDrawerItemPress = (navigation, isCollapsed) => useCallback((row) => {
|
|
|
29
29
|
const DrawerItem = ({ descriptor }) => {
|
|
30
30
|
const { route, options } = descriptor;
|
|
31
31
|
const label = options.drawerLabel ?? options.title ?? route.name;
|
|
32
|
-
|
|
32
|
+
const [labelWidget, setLabelWidget] = useState(null);
|
|
33
|
+
return (_jsx(GtkListBoxRow, { accessibleLabelledBy: labelWidget === null ? undefined : [labelWidget], children: _jsxs(GtkBox, { spacing: 12, children: [options.drawerIcon === undefined ? null : _jsx(GtkImage, { iconName: options.drawerIcon }), _jsx(GtkLabel, { ref: setLabelWidget, label: label, useUnderline: options.useUnderline ?? false, xalign: 0 })] }) }));
|
|
33
34
|
};
|
|
34
35
|
/** Lists the drawer routes as rows of a `GtkListBox`; activating a row navigates to its route. */
|
|
35
36
|
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,aAAa,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;
|
|
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,aAAa,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+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AC,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, useState } 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(\n (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 },\n [navigation, isCollapsed],\n );\n\nconst DrawerItem = ({ descriptor }: { descriptor: DrawerDescriptor }): ReactNode => {\n const { route, options } = descriptor;\n const label = options.drawerLabel ?? options.title ?? route.name;\n const [labelWidget, setLabelWidget] = useState<Gtk.Label | null>(null);\n\n return (\n <GtkListBoxRow accessibleLabelledBy={labelWidget === null ? undefined : [labelWidget]}>\n <GtkBox spacing={12}>\n {options.drawerIcon === undefined ? null : <GtkImage iconName={options.drawerIcon} />}\n <GtkLabel ref={setLabelWidget} label={label} useUnderline={options.useUnderline ?? false} 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-router.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer-router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIzD,KAAK,mBAAmB,GAAG,OAAO,YAAY,CAAC;AAiF/C,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"drawer-router.d.ts","sourceRoot":"","sources":["../../src/drawer/drawer-router.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAIzD,KAAK,mBAAmB,GAAG,OAAO,YAAY,CAAC;AAiF/C,QAAA,MAAM,kBAAkB,gBACN,MAAM,OAAO,KAAG,mBAE0B,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer-router.js","sourceRoot":"","sources":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,EAAE,MAAM,EAAE,MAAM,CAAC;QACtD,WAAW,EAAE,WAAW,EAAE;QAC1B,KAAK,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC;KACxE,CAAC;IACN,qBAAqB,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE,CAClC,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC;CACvF,CAAC,CAAC;AAEH,MAAM,kBAAkB,GACpB,CAAC,WAA0B,EAAuB,EAAE,CACpD,CAAC,OAAO,EAAE,EAAE,CACR,gBAAgB,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAA4B,CAAC","sourcesContent":["import type { DrawerNavigationState, NavigationAction, ParamListBase, PartialState } from \"@react-navigation/core\";\nimport { DrawerRouter } from \"@react-navigation/routers\";\nimport { getDrawerStatus } from \"./drawer-status.js\";\n\ntype DrawerState = DrawerNavigationState<ParamListBase>;\ntype DrawerRouterFactory = typeof DrawerRouter;\ntype DrawerRouterInstance = ReturnType<DrawerRouterFactory>;\ntype StateResult = DrawerState | PartialState<DrawerState> | null;\ntype Retry = (state: DrawerState) => StateResult;\n\ntype ResolvedAction = {\n state: DrawerState;\n action: NavigationAction;\n after: StateResult;\n isCollapsed: boolean;\n retry: Retry;\n};\n\nconst NAVIGATING_ACTIONS = new Set([\"JUMP_TO\", \"NAVIGATE\", \"NAVIGATE_DEPRECATED\"]);\n\nconst isSameRoutes = (left: DrawerState, right: DrawerState): boolean =>\n left.index === right.index &&\n left.routes.length === right.routes.length &&\n left.routes.every((route, index) => right.routes[index]?.key === route.key);\n\nconst reopenSidebar = (state: DrawerState): DrawerState => {\n if (state.default === \"open\") {\n return { ...state, history: state.history.filter((entry) => entry.type !== \"drawer\") };\n }\n\n return { ...state, history: [...state.history, { type: \"drawer\", status: \"open\" }] };\n};\n\nconst wasSidebarHidden = (before: DrawerState, after: DrawerState): boolean =>\n getDrawerStatus(before) === \"open\" && getDrawerStatus(after) === \"closed\";\n\nconst wasSidebarShown = (before: DrawerState, after: DrawerState): boolean =>\n getDrawerStatus(before) === \"closed\" && getDrawerStatus(after) === \"open\";\n\nconst keepSidebarShown = (before: DrawerState, after: DrawerState, isCollapsed: boolean): DrawerState =>\n !isCollapsed && wasSidebarHidden(before, after) ? reopenSidebar(after) : after;\n\nconst keepSidebarShownInResult = (before: DrawerState, after: StateResult, isCollapsed: boolean): StateResult =>\n after?.stale === false ? keepSidebarShown(before, after, isCollapsed) : after;\n\nconst shouldPassBackThrough = (state: DrawerState, after: StateResult, isCollapsed: boolean): boolean =>\n !isCollapsed && after?.stale === false && isSameRoutes(state, after) && wasSidebarShown(state, after);\n\nconst withoutDrawerEntry = (state: DrawerState): DrawerState => ({\n ...state,\n history: state.history.filter((entry) => entry.type !== \"drawer\"),\n});\n\nconst closedAgain = (state: DrawerState): DrawerState => ({\n ...state,\n history: [...state.history, { type: \"drawer\", status: \"closed\" }],\n});\n\nconst backPastDrawer = (state: DrawerState, retry: Retry): StateResult => {\n const after = retry(withoutDrawerEntry(state));\n\n return after?.stale === false ? closedAgain(after) : after;\n};\n\nconst resolveAction = ({ state, action, after, isCollapsed, retry }: ResolvedAction): StateResult => {\n if (action.type === \"GO_BACK\") {\n return shouldPassBackThrough(state, after, isCollapsed) ? backPastDrawer(state, retry) : after;\n }\n\n return NAVIGATING_ACTIONS.has(action.type) ? keepSidebarShownInResult(state, after, isCollapsed) : after;\n};\n\nconst withShownSidebar = (router: DrawerRouterInstance, isCollapsed: () => boolean): DrawerRouterInstance => ({\n ...router,\n getStateForAction: (state, action, config) =>\n resolveAction({\n state,\n action,\n after: router.getStateForAction(state, action, config),\n isCollapsed: isCollapsed(),\n retry: (retried) => router.getStateForAction(retried, action, config),\n }),\n getStateForRouteFocus: (state, key) =>\n keepSidebarShown(state, router.getStateForRouteFocus(state, key), isCollapsed()),\n});\n\nconst createDrawerRouter =\n (isCollapsed: () => boolean): DrawerRouterFactory =>\n (options) =>\n withShownSidebar(DrawerRouter(options), isCollapsed);\n\nexport { createDrawerRouter, type DrawerRouterFactory };\n"]}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,UAAW,qBAAqB,CAAC,aAAa,CAAC,KAAG,YACgB,CAAC;AAExF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -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;
|
|
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;AAMvC,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;AAmGF,QAAA,MAAM,UAAU,iEAAkE,eAAe,KAAG,SAsCnG,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
3
|
-
import { AdwHeaderBar, AdwOverlaySplitView, AdwToolbarView, AdwViewStack, AdwWindowTitle
|
|
3
|
+
import { AdwHeaderBar, AdwOverlaySplitView, AdwToolbarView, AdwViewStack, AdwWindowTitle } from "@gtkx/jsx/adw";
|
|
4
4
|
import { GtkButton, GtkScrolledWindow } from "@gtkx/jsx/gtk";
|
|
5
5
|
import { DrawerActions } from "@react-navigation/core";
|
|
6
6
|
import { useCallback, useEffect, useRef } from "react";
|
|
@@ -44,9 +44,9 @@ const DrawerHeader = ({ descriptor, navigation }) => {
|
|
|
44
44
|
}
|
|
45
45
|
return (_jsx(HeaderBar, { options: options, start: _jsx(DrawerToggle, { navigation: navigation }), titleWidget: _jsx(AdwWindowTitle, { title: options.title ?? route.name }) }));
|
|
46
46
|
};
|
|
47
|
-
const DrawerPage = ({ descriptor, isLoaded }) => {
|
|
47
|
+
const DrawerPage = ({ descriptor, isFocused, isLoaded }) => {
|
|
48
48
|
const { route, options } = descriptor;
|
|
49
|
-
return (_jsx(ScenePage, { name: route.key, title: options.title ?? route.name, isLoaded: isLoaded || options.lazy === false, render: () => descriptor.render() }));
|
|
49
|
+
return (_jsx(ScenePage, { name: route.key, title: options.title ?? route.name, isFocused: isFocused, isLoaded: isLoaded || options.lazy === false, render: () => descriptor.render() }));
|
|
50
50
|
};
|
|
51
51
|
const DrawerView = ({ state, navigation, descriptors, drawerContent, ...config }) => {
|
|
52
52
|
const { collapsed = false, sidebarPosition = "start", pinSidebar, minSidebarWidth, maxSidebarWidth } = config;
|
|
@@ -57,7 +57,7 @@ const DrawerView = ({ state, navigation, descriptors, drawerContent, ...config }
|
|
|
57
57
|
const sidebar = drawerContent === undefined ? _jsx(DrawerContent, { ...contentProps }) : drawerContent(contentProps);
|
|
58
58
|
usePopToTopOnBlur(state, descriptors, navigation);
|
|
59
59
|
useCloseOnNavigate(state, navigation, collapsed);
|
|
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))) }) }) }) }));
|
|
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), isFocused: route.key === focused.key, isLoaded: route.key === focused.key || state.preloadedRouteKeys.includes(route.key) }, route.key))) }) }) }) }));
|
|
61
61
|
};
|
|
62
62
|
export { DrawerView };
|
|
63
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;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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E,oBAAoB,EACzC,OAAO,EAAE,4BAAG,OAAO,GAAI,YAEvB,KAAC,cAAc,IAAC,MAAM,EAAE,KAAC,YAAY,IAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAI,YACpF,KAAC,YAAY,IAAC,gBAAgB,EAAE,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,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
|
+
{"version":3,"file":"drawer-view.js","sourceRoot":"","sources":["../../src/drawer/drawer-view.tsx"],"names":[],"mappings":";AAEA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChH,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;AAmBrD,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,CACP,CAAC,OAAuB,EAAE,EAAE;IACxB,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;QACnB,OAAO;IACX,CA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,GAAI,YAEvB,KAAC,cAAc,IAAC,MAAM,EAAE,KAAC,YAAY,IAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,GAAI,YACpF,KAAC,YAAY,IAAC,gBAAgB,EAAE,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,SAAS,EAAE,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,GAAG,EACpC,QAAQ,EAAE,KAAK,CAAC,GAAG,KAAK,OAAO,CAAC,GAAG,IAAI,KAAK,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,IAH9E,KAAK,CAAC,GAAG,CAIhB,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 { AdwHeaderBar, AdwOverlaySplitView, AdwToolbarView, AdwViewStack, AdwWindowTitle } 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 isFocused: boolean;\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(\n (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 },\n [navigation],\n );\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, isFocused, isLoaded }: DrawerPageProps): ReactNode => {\n const { route, options } = descriptor;\n\n return (\n <ScenePage\n name={route.key}\n title={options.title ?? route.name}\n isFocused={isFocused}\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 isFocused={route.key === focused.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"]}
|
package/dist/drawer/types.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ type DrawerNavigationOptions = HeaderOptions & {
|
|
|
17
17
|
header?: (props: DrawerHeaderProps) => ReactNode;
|
|
18
18
|
/** Label shown in the sidebar; defaults to `title`, then to the route name. */
|
|
19
19
|
drawerLabel?: string;
|
|
20
|
+
/** Whether underscores in the sidebar label indicate mnemonics; defaults to `false`. */
|
|
21
|
+
useUnderline?: boolean;
|
|
20
22
|
/** Icon name shown next to the sidebar label. */
|
|
21
23
|
drawerIcon?: string;
|
|
22
24
|
/** Whether the screen mounts on first focus instead of at startup; defaults to `true`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/drawer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,uBAAuB,EACvB,UAAU,EACV,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACZ,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,kFAAkF;AAClF,KAAK,wBAAwB,GAAG;IAC5B,iDAAiD;IACjD,eAAe,EAAE;QACb,kBAAkB;QAClB,IAAI,EAAE,SAAS,CAAC;QAChB,yDAAyD;QACzD,iBAAiB,EAAE,IAAI,CAAC;KAC3B,CAAC;CACL,CAAC;AAEF,kDAAkD;AAClD,KAAK,uBAAuB,GAAG,aAAa,GAAG;IAC3C,sEAAsE;IAC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EACtB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GACpB,CAAC"}
|
package/dist/drawer/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/drawer/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DefaultNavigatorOptions,\n Descriptor,\n DrawerActionHelpers,\n DrawerNavigationState,\n DrawerRouterOptions,\n NavigationHelpers,\n NavigationProp,\n ParamListBase,\n RouteProp,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport type { HeaderOptions } from \"../shared/types.js\";\n\n/** Events the drawer navigator emits on top of React Navigation's core events. */\ntype DrawerNavigationEventMap = {\n /** The user activated an item in the sidebar. */\n drawerItemPress: {\n /** No payload. */\n data: undefined;\n /** Calling `preventDefault` keeps the current screen. */\n canPreventDefault: true;\n };\n};\n\n/** Per-screen options of the drawer navigator. */\ntype DrawerNavigationOptions = HeaderOptions & {\n /** Renders a custom top bar instead of the default `AdwHeaderBar`. */\n header?: (props: DrawerHeaderProps) => ReactNode;\n /** Label shown in the sidebar; defaults to `title`, then to the route name. */\n drawerLabel?: string;\n /** Icon name shown next to the sidebar label. */\n drawerIcon?: string;\n /** Whether the screen mounts on first focus instead of at startup; defaults to `true`. */\n lazy?: boolean;\n /** Whether a nested stack pops to its first screen when this screen loses focus; defaults to `false`. */\n popToTopOnBlur?: boolean;\n};\n\n/** Navigation object of a drawer screen. */\ntype DrawerNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined,\n> = NavigationProp<\n ParamList,\n RouteName,\n NavigatorID,\n DrawerNavigationState<ParamList>,\n DrawerNavigationOptions,\n DrawerNavigationEventMap\n>
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/drawer/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DefaultNavigatorOptions,\n Descriptor,\n DrawerActionHelpers,\n DrawerNavigationState,\n DrawerRouterOptions,\n NavigationHelpers,\n NavigationProp,\n ParamListBase,\n RouteProp,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport type { HeaderOptions } from \"../shared/types.js\";\n\n/** Events the drawer navigator emits on top of React Navigation's core events. */\ntype DrawerNavigationEventMap = {\n /** The user activated an item in the sidebar. */\n drawerItemPress: {\n /** No payload. */\n data: undefined;\n /** Calling `preventDefault` keeps the current screen. */\n canPreventDefault: true;\n };\n};\n\n/** Per-screen options of the drawer navigator. */\ntype DrawerNavigationOptions = HeaderOptions & {\n /** Renders a custom top bar instead of the default `AdwHeaderBar`. */\n header?: (props: DrawerHeaderProps) => ReactNode;\n /** Label shown in the sidebar; defaults to `title`, then to the route name. */\n drawerLabel?: string;\n /** Whether underscores in the sidebar label indicate mnemonics; defaults to `false`. */\n useUnderline?: boolean;\n /** Icon name shown next to the sidebar label. */\n drawerIcon?: string;\n /** Whether the screen mounts on first focus instead of at startup; defaults to `true`. */\n lazy?: boolean;\n /** Whether a nested stack pops to its first screen when this screen loses focus; defaults to `false`. */\n popToTopOnBlur?: boolean;\n};\n\n/** Navigation object of a drawer screen. */\ntype DrawerNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined,\n> = NavigationProp<\n ParamList,\n RouteName,\n NavigatorID,\n DrawerNavigationState<ParamList>,\n DrawerNavigationOptions,\n DrawerNavigationEventMap\n> &\n DrawerActionHelpers<ParamList>;\n\n/** Props a drawer screen component receives. */\ntype DrawerScreenProps<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined,\n> = {\n /** Navigation object of the screen. */\n navigation: DrawerNavigationProp<ParamList, RouteName, NavigatorID>;\n /** The route the screen renders. */\n route: RouteProp<ParamList, RouteName>;\n};\n\n/** Arguments of a custom drawer `header` renderer. */\ntype DrawerHeaderProps = {\n /** The focused route. */\n route: RouteProp<ParamListBase>;\n /** Navigation object of the focused route. */\n navigation: DrawerNavigationProp<ParamListBase>;\n /** Resolved options of the focused route. */\n options: DrawerNavigationOptions;\n};\n\n/** Navigation helpers of the drawer navigator itself. */\ntype DrawerNavigationHelpers = NavigationHelpers<ParamListBase, DrawerNavigationEventMap> &\n DrawerActionHelpers<ParamListBase>;\n\n/** Descriptor of one drawer route. */\ntype DrawerDescriptor = Descriptor<\n DrawerNavigationOptions,\n DrawerNavigationProp<ParamListBase>,\n RouteProp<ParamListBase>\n>;\n\n/** Descriptors of the drawer routes, keyed by route key. */\ntype DrawerDescriptorMap = Record<string, DrawerDescriptor>;\n\n/** Arguments of a custom `drawerContent` renderer and props of {@link DrawerItemList}. */\ntype DrawerContentProps = {\n /** State of the drawer navigator. */\n state: DrawerNavigationState<ParamListBase>;\n /** Navigation helpers of the drawer navigator. */\n navigation: DrawerNavigationHelpers;\n /** Descriptors of the drawer routes. */\n descriptors: DrawerDescriptorMap;\n};\n\n/** Props of the drawer navigator beyond the options every navigator shares. */\ntype DrawerNavigationConfig = {\n /** Renders the sidebar; defaults to a header bar above a {@link DrawerItemList}. */\n drawerContent?: (props: DrawerContentProps) => ReactNode;\n /** Whether the sidebar overlays the content instead of sitting beside it; defaults to `false`. */\n collapsed?: boolean;\n /** Which side the sidebar sits on; defaults to `\"start\"`. */\n sidebarPosition?: \"start\" | \"end\";\n /** Whether collapsing and uncollapsing leave the sidebar's visibility alone; defaults to `false`. */\n pinSidebar?: boolean;\n /** Minimum sidebar width, in the unit libadwaita uses for the split view. */\n minSidebarWidth?: number;\n /** Maximum sidebar width, in the unit libadwaita uses for the split view. */\n maxSidebarWidth?: number;\n /** Preferred sidebar width as a fraction of the total width. */\n sidebarWidthFraction?: number;\n};\n\n/** Props of the drawer `Navigator` component. */\ntype DrawerNavigatorProps = DefaultNavigatorOptions<\n ParamListBase,\n string | undefined,\n DrawerNavigationState<ParamListBase>,\n DrawerNavigationOptions,\n DrawerNavigationEventMap,\n DrawerNavigationProp<ParamListBase>\n> &\n DrawerRouterOptions &\n DrawerNavigationConfig;\n\nexport type {\n DrawerContentProps,\n DrawerDescriptor,\n DrawerDescriptorMap,\n DrawerHeaderProps,\n DrawerNavigationConfig,\n DrawerNavigationEventMap,\n DrawerNavigationHelpers,\n DrawerNavigationOptions,\n DrawerNavigationProp,\n DrawerNavigatorProps,\n DrawerScreenProps,\n};\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export { createSplitViewNavigator, createSplitViewScreen, SplitViewNavigator, ty
|
|
|
7
7
|
export type { SplitViewDescriptor, SplitViewDescriptorMap, SplitViewNavigationConfig, SplitViewNavigationEventMap, SplitViewNavigationHelpers, SplitViewNavigationOptions, SplitViewNavigationProp, SplitViewNavigatorProps, SplitViewScreenProps, } from "./split-view/types.js";
|
|
8
8
|
export { createStackNavigator, createStackScreen, StackNavigator, type StackTypeBag, } from "./stack/create-stack-navigator.js";
|
|
9
9
|
export type { StackDescriptor, StackDescriptorMap, StackHeaderBack, StackHeaderProps, StackNavigationConfig, StackNavigationEventMap, StackNavigationHelpers, StackNavigationOptions, StackNavigationProp, StackNavigatorProps, StackScreenProps, StackTransitionData, } from "./stack/types.js";
|
|
10
|
-
export { createStaticNavigation, type StaticNavigationProps, type StaticNavigationTree
|
|
10
|
+
export { createStaticNavigation, type StaticNavigationProps, type StaticNavigationTree } from "./static-navigation.js";
|
|
11
11
|
export { createTabNavigator, createTabScreen, TabNavigator, type TabTypeBag } from "./tabs/create-tab-navigator.js";
|
|
12
12
|
export type { TabDescriptor, TabDescriptorMap, TabHeaderProps, TabNavigationConfig, TabNavigationEventMap, TabNavigationHelpers, TabNavigationOptions, TabNavigationProp, TabNavigatorProps, TabScreenProps, } from "./tabs/types.js";
|
|
13
13
|
export { DarkTheme, DefaultTheme, type Theme } from "./theme.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,EACf,KAAK,aAAa,GACrB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,YAAY,EACR,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,mBAAmB,EACnB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,GAChC,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EACH,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,EAClB,KAAK,gBAAgB,GACxB,MAAM,6CAA6C,CAAC;AACrD,YAAY,EACR,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,2BAA2B,EAC3B,0BAA0B,EAC1B,0BAA0B,EAC1B,uBAAuB,EACvB,uBAAuB,EACvB,oBAAoB,GACvB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACH,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,KAAK,YAAY,GACpB,MAAM,mCAAmC,CAAC;AAC3C,YAAY,EACR,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qB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AACpH,YAAY,EACR,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AACjE,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export { DrawerItemList } from "./drawer/drawer-item-list.js";
|
|
|
3
3
|
export { NavigationContainer, } from "./navigation-container.js";
|
|
4
4
|
export { createSplitViewNavigator, createSplitViewScreen, SplitViewNavigator, } from "./split-view/create-split-view-navigator.js";
|
|
5
5
|
export { createStackNavigator, createStackScreen, StackNavigator, } from "./stack/create-stack-navigator.js";
|
|
6
|
-
export { createStaticNavigation
|
|
6
|
+
export { createStaticNavigation } from "./static-navigation.js";
|
|
7
7
|
export { createTabNavigator, createTabScreen, TabNavigator } from "./tabs/create-tab-navigator.js";
|
|
8
8
|
export { DarkTheme, DefaultTheme } from "./theme.js";
|
|
9
9
|
export * from "@react-navigation/core";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAElB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAc9D,OAAO,EACH,mBAAmB,GAGtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACH,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,GAErB,MAAM,6CAA6C,CAAC;AAYrD,OAAO,EACH,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,GAEjB,MAAM,mCAAmC,CAAC;AAe3C,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,kBAAkB,EAClB,eAAe,GAElB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAc9D,OAAO,EACH,mBAAmB,GAGtB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACH,wBAAwB,EACxB,qBAAqB,EACrB,kBAAkB,GAErB,MAAM,6CAA6C,CAAC;AAYrD,OAAO,EACH,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,GAEjB,MAAM,mCAAmC,CAAC;AAe3C,OAAO,EAAE,sBAAsB,EAAyD,MAAM,wBAAwB,CAAC;AACvH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAmB,MAAM,gCAAgC,CAAC;AAapH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AACjE,cAAc,wBAAwB,CAAC","sourcesContent":["export {\n createDrawerNavigator,\n createDrawerScreen,\n DrawerNavigator,\n type DrawerTypeBag,\n} from \"./drawer/create-drawer-navigator.js\";\nexport { DrawerItemList } from \"./drawer/drawer-item-list.js\";\nexport type {\n DrawerContentProps,\n DrawerDescriptor,\n DrawerDescriptorMap,\n DrawerHeaderProps,\n DrawerNavigationConfig,\n DrawerNavigationEventMap,\n DrawerNavigationHelpers,\n DrawerNavigationOptions,\n DrawerNavigationProp,\n DrawerNavigatorProps,\n DrawerScreenProps,\n} from \"./drawer/types.js\";\nexport {\n NavigationContainer,\n type NavigationContainerComponent,\n type NavigationContainerProps,\n} from \"./navigation-container.js\";\nexport type { HeaderOptions } from \"./shared/types.js\";\nexport {\n createSplitViewNavigator,\n createSplitViewScreen,\n SplitViewNavigator,\n type SplitViewTypeBag,\n} from \"./split-view/create-split-view-navigator.js\";\nexport type {\n SplitViewDescriptor,\n SplitViewDescriptorMap,\n SplitViewNavigationConfig,\n SplitViewNavigationEventMap,\n SplitViewNavigationHelpers,\n SplitViewNavigationOptions,\n SplitViewNavigationProp,\n SplitViewNavigatorProps,\n SplitViewScreenProps,\n} from \"./split-view/types.js\";\nexport {\n createStackNavigator,\n createStackScreen,\n StackNavigator,\n type StackTypeBag,\n} from \"./stack/create-stack-navigator.js\";\nexport type {\n StackDescriptor,\n StackDescriptorMap,\n StackHeaderBack,\n StackHeaderProps,\n StackNavigationConfig,\n StackNavigationEventMap,\n StackNavigationHelpers,\n StackNavigationOptions,\n StackNavigationProp,\n StackNavigatorProps,\n StackScreenProps,\n StackTransitionData,\n} from \"./stack/types.js\";\nexport { createStaticNavigation, type StaticNavigationProps, type StaticNavigationTree } from \"./static-navigation.js\";\nexport { createTabNavigator, createTabScreen, TabNavigator, type TabTypeBag } from \"./tabs/create-tab-navigator.js\";\nexport type {\n TabDescriptor,\n TabDescriptorMap,\n TabHeaderProps,\n TabNavigationConfig,\n TabNavigationEventMap,\n TabNavigationHelpers,\n TabNavigationOptions,\n TabNavigationProp,\n TabNavigatorProps,\n TabScreenProps,\n} from \"./tabs/types.js\";\nexport { DarkTheme, DefaultTheme, type Theme } from \"./theme.js\";\nexport * from \"@react-navigation/core\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-bar.d.ts","sourceRoot":"","sources":["../../src/shared/header-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,KAAK,cAAc,GAAG;IAClB,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAUF,QAAA,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"header-bar.d.ts","sourceRoot":"","sources":["../../src/shared/header-bar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,KAAK,cAAc,GAAG;IAClB,OAAO,EAAE,aAAa,CAAC;IACvB,WAAW,CAAC,EAAE,YAAY,CAAC;IAC3B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAUF,QAAA,MAAM,SAAS,oDAAqD,cAAc,KAAG,SAYpF,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { AdwHeaderBar, AdwWindowTitle } from "@gtkx/jsx/adw";
|
|
3
3
|
const resolveTitleWidget = (options, fallback) => {
|
|
4
4
|
if (typeof options.headerTitle === "string") {
|
|
@@ -6,6 +6,6 @@ const resolveTitleWidget = (options, fallback) => {
|
|
|
6
6
|
}
|
|
7
7
|
return options.headerTitle ?? fallback;
|
|
8
8
|
};
|
|
9
|
-
const HeaderBar = ({ options, titleWidget, start, showBackButton }) => (_jsx(AdwHeaderBar, { showBackButton: showBackButton ?? true, titleWidget: resolveTitleWidget(options, titleWidget), start:
|
|
9
|
+
const HeaderBar = ({ options, titleWidget, start, showBackButton }) => (_jsx(AdwHeaderBar, { showBackButton: showBackButton ?? true, titleWidget: resolveTitleWidget(options, titleWidget), start: _jsxs(_Fragment, { children: [start, options.headerStart] }), end: options.headerEnd }));
|
|
10
10
|
export { HeaderBar };
|
|
11
11
|
//# sourceMappingURL=header-bar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"header-bar.js","sourceRoot":"","sources":["../../src/shared/header-bar.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YA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,WAAW,IACrB,EAEP,GAAG,EAAE,OAAO,CAAC,SAAS,GACxB,CACL,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import type { ReactElement, ReactNode } from \"react\";\nimport { AdwHeaderBar, AdwWindowTitle } from \"@gtkx/jsx/adw\";\nimport type { HeaderOptions } from \"./types.js\";\n\ntype HeaderBarProps = {\n options: HeaderOptions;\n titleWidget?: ReactElement;\n start?: ReactNode;\n showBackButton?: boolean;\n};\n\nconst resolveTitleWidget = (options: HeaderOptions, fallback: ReactElement | undefined): ReactElement | undefined => {\n if (typeof options.headerTitle === \"string\") {\n return <AdwWindowTitle title={options.headerTitle} />;\n }\n\n return options.headerTitle ?? fallback;\n};\n\nconst HeaderBar = ({ options, titleWidget, start, showBackButton }: HeaderBarProps): ReactNode => (\n <AdwHeaderBar\n showBackButton={showBackButton ?? true}\n titleWidget={resolveTitleWidget(options, titleWidget)}\n start={\n <>\n {start}\n {options.headerStart}\n </>\n }\n end={options.headerEnd}\n />\n);\n\nexport { HeaderBar };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/shared/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,KAAK,YAAY,CAAC,KAAK,SAAS,eAAe,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3E,QAAA,MAAM,eAAe,GAAI,KAAK,SAAS,eAAe,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/shared/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAE9D,KAAK,YAAY,CAAC,KAAK,SAAS,eAAe,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3E,QAAA,MAAM,eAAe,GAAI,KAAK,SAAS,eAAe,SAAS,KAAK,KAAG,YAAY,CAAC,KAAK,CAQxF,CAAC;AAEF,QAAA,MAAM,iBAAiB,GAAI,UAAU,eAAe,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,MAAM,KAAG,UAQ7F,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -5,9 +5,11 @@ type ScenePageProps = {
|
|
|
5
5
|
iconName?: string;
|
|
6
6
|
badgeNumber?: number;
|
|
7
7
|
needsAttention?: boolean;
|
|
8
|
+
useUnderline?: boolean;
|
|
9
|
+
isFocused: boolean;
|
|
8
10
|
isLoaded: boolean;
|
|
9
11
|
render: () => ReactElement;
|
|
10
12
|
};
|
|
11
|
-
declare const ScenePage: ({ name, title, isLoaded, render, ...page }: ScenePageProps) => ReactNode;
|
|
13
|
+
declare const ScenePage: ({ name, title, isFocused, isLoaded, render, ...page }: ScenePageProps) => ReactNode;
|
|
12
14
|
export { ScenePage };
|
|
13
15
|
//# sourceMappingURL=scene-page.d.ts.map
|
|
@@ -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;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,
|
|
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,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,YAAY,CAAC;CAC9B,CAAC;AAEF,QAAA,MAAM,SAAS,0DAA2D,cAAc,KAAG,SAoB1F,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { AdwBin, AdwViewStackPage } from "@gtkx/jsx/adw";
|
|
3
3
|
import { useState } from "react";
|
|
4
|
-
const ScenePage = ({ name, title, isLoaded, render, ...page }) => {
|
|
4
|
+
const ScenePage = ({ name, title, isFocused, isLoaded, render, ...page }) => {
|
|
5
5
|
const [hasLoaded, setHasLoaded] = useState(isLoaded);
|
|
6
6
|
if (isLoaded && !hasLoaded) {
|
|
7
7
|
setHasLoaded(true);
|
|
8
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 }) }));
|
|
9
|
+
return (_jsx(AdwViewStackPage, { name: name, title: title, iconName: page.iconName, badgeNumber: page.badgeNumber, needsAttention: page.needsAttention, accessibleHidden: !isFocused, useUnderline: page.useUnderline ?? false, children: _jsx(AdwBin, { children: hasLoaded ? render() : null }) }));
|
|
10
10
|
};
|
|
11
11
|
export { ScenePage };
|
|
12
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;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
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;AAcjC,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,EAAkB,EAAa,EAAE;IACnG,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,gBAAgB,EAAE,CAAC,SAAS,EAC5B,YAAY,EAAE,IAAI,CAAC,YAAY,IAAI,KAAK,YAExC,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 useUnderline?: boolean;\n isFocused: boolean;\n isLoaded: boolean;\n render: () => ReactElement;\n};\n\nconst ScenePage = ({ name, title, isFocused, 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 accessibleHidden={!isFocused}\n useUnderline={page.useUnderline ?? false}\n >\n <AdwBin>{hasLoaded ? render() : null}</AdwBin>\n </AdwViewStackPage>\n );\n};\n\nexport { ScenePage };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-pop-to-top-on-blur.d.ts","sourceRoot":"","sources":["../../src/shared/use-pop-to-top-on-blur.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIhG,KAAK,WAAW,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAChD,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC;AAehE,QAAA,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"use-pop-to-top-on-blur.d.ts","sourceRoot":"","sources":["../../src/shared/use-pop-to-top-on-blur.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAIhG,KAAK,WAAW,GAAG;IAAE,cAAc,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAChD,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC;AAehE,QAAA,MAAM,iBAAiB,UACZ,eAAe,eACT,eAAe,cAChB,iBAAiB,CAAC,aAAa,CAAC,KAC7C,IAkBF,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-view.d.ts","sourceRoot":"","sources":["../../src/split-view/split-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,OAAO,KAAK,EACR,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC7B,MAAM,YAAY,CAAC;AAOpB,KAAK,cAAc,GAAG,yBAAyB,GAAG;IAC9C,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,UAAU,EAAE,0BAA0B,CAAC;IACvC,WAAW,EAAE,sBAAsB,CAAC;IACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,EAAE,aAAa,EAAE,OAAO,KAAK,mBAAmB,CAAC;CAC9F,CAAC;
|
|
1
|
+
{"version":3,"file":"split-view.d.ts","sourceRoot":"","sources":["../../src/split-view/split-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAOvC,OAAO,KAAK,EACR,mBAAmB,EACnB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC7B,MAAM,YAAY,CAAC;AAOpB,KAAK,cAAc,GAAG,yBAAyB,GAAG;IAC9C,KAAK,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAC3C,UAAU,EAAE,0BAA0B,CAAC;IACvC,WAAW,EAAE,sBAAsB,CAAC;IACpC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,aAAa,CAAC,EAAE,aAAa,EAAE,OAAO,KAAK,mBAAmB,CAAC;CAC9F,CAAC;AA4EF,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,SAsC1C,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as Gdk from "@gtkx/gi/gdk";
|
|
3
3
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
4
4
|
import { AdwNavigationPage, AdwNavigationSplitView, AdwToolbarView } from "@gtkx/jsx/adw";
|
|
@@ -43,9 +43,7 @@ const SidebarPage = ({ descriptor }) => {
|
|
|
43
43
|
if (options.headerShown === false) {
|
|
44
44
|
return _jsx(AdwNavigationPage, { title: options.title ?? route.name, children: descriptor.render() });
|
|
45
45
|
}
|
|
46
|
-
const topBar = options.header === undefined
|
|
47
|
-
? _jsx(HeaderBar, { options: options, showBackButton: false })
|
|
48
|
-
: _jsx(_Fragment, { children: options.header({ route, navigation, options, back: undefined }) });
|
|
46
|
+
const topBar = options.header === undefined ? (_jsx(HeaderBar, { options: options, showBackButton: false })) : (_jsx(_Fragment, { children: options.header({ route, navigation, options, back: undefined }) }));
|
|
49
47
|
return (_jsx(AdwNavigationPage, { title: options.title ?? route.name, children: _jsx(AdwToolbarView, { topBar: topBar, children: descriptor.render() }) }));
|
|
50
48
|
};
|
|
51
49
|
const SplitView = (props) => {
|
|
@@ -54,9 +52,7 @@ const SplitView = (props) => {
|
|
|
54
52
|
const viewRef = useRef(null);
|
|
55
53
|
const onShowContentChanged = useContentSync(viewRef, navigation);
|
|
56
54
|
const sidebar = requireDescriptor(descriptors, state.routes[0]?.key ?? "");
|
|
57
|
-
return (_jsx(AdwNavigationSplitView, { ref: viewRef, collapsed: collapsed, showContent: hasContent(state), sidebarPosition: PACK_TYPES[sidebarPosition], minSidebarWidth: minSidebarWidth, maxSidebarWidth: maxSidebarWidth, sidebarWidthFraction: props.sidebarWidthFraction, onNotifyShowContent: onShowContentChanged, sidebar: _jsx(SidebarPage, { descriptor: sidebar }), children: _jsx(AdwNavigationPage, { title: contentTitle(state, descriptors), controllers: collapsed && props.popOnEscape === false ? _jsx(EscapeGuard, {}) : null, children: hasContent(state)
|
|
58
|
-
? (_jsx(StackView, { offset: 1, popOnEscape: props.popOnEscape, state: state, navigation: navigation, descriptors: descriptors, describe: describe }))
|
|
59
|
-
: _jsx(_Fragment, { children: contentPlaceholder }) }) }));
|
|
55
|
+
return (_jsx(AdwNavigationSplitView, { ref: viewRef, collapsed: collapsed, showContent: hasContent(state), sidebarPosition: PACK_TYPES[sidebarPosition], minSidebarWidth: minSidebarWidth, maxSidebarWidth: maxSidebarWidth, sidebarWidthFraction: props.sidebarWidthFraction, onNotifyShowContent: onShowContentChanged, sidebar: _jsx(SidebarPage, { descriptor: sidebar }), children: _jsx(AdwNavigationPage, { title: contentTitle(state, descriptors), controllers: collapsed && props.popOnEscape === false ? _jsx(EscapeGuard, {}) : null, children: hasContent(state) ? (_jsx(StackView, { offset: 1, popOnEscape: props.popOnEscape, state: state, navigation: navigation, descriptors: descriptors, describe: describe })) : (_jsx(_Fragment, { children: contentPlaceholder })) }) }));
|
|
60
56
|
};
|
|
61
57
|
export { SplitView };
|
|
62
58
|
//# sourceMappingURL=split-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"split-view.js","sourceRoot":"","sources":["../../src/split-view/split-view.tsx"],"names":[],"mappings":";AAGA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,eAAe,CA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E,CAAC,EACT,WAAW,EAAE,KAAK,CAAC,WAAW,EAC9B,KAAK,EAAE,KAAK,EACZ,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GACpB,CACL,CAAC,CAAC,CAAC,CACA,4BAAG,kBAAkB,GAAI,CAC5B,GACe,GACC,CAC5B,CAAC;AACN,CAAC,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC","sourcesContent":["import type * as Adw from \"@gtkx/gi/adw\";\nimport type { ParamListBase, RouteProp, StackNavigationState } from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport * as Gdk from \"@gtkx/gi/gdk\";\nimport * as Gtk from \"@gtkx/gi/gtk\";\nimport { AdwNavigationPage, AdwNavigationSplitView, AdwToolbarView } from \"@gtkx/jsx/adw\";\nimport { GtkEventControllerKey } from \"@gtkx/jsx/gtk\";\nimport { StackActions } from \"@react-navigation/core\";\nimport { useCallback, useRef } from \"react\";\nimport type {\n SplitViewDescriptor,\n SplitViewDescriptorMap,\n SplitViewNavigationConfig,\n SplitViewNavigationHelpers,\n} from \"./types.js\";\nimport { HeaderBar } from \"../shared/header-bar.js\";\nimport { requireDescriptor } from \"../shared/routes.js\";\nimport { StackView } from \"../stack/stack-view.js\";\n\ntype ViewRef = { current: Adw.NavigationSplitView | null };\n\ntype SplitViewProps = SplitViewNavigationConfig & {\n state: StackNavigationState<ParamListBase>;\n navigation: SplitViewNavigationHelpers;\n descriptors: SplitViewDescriptorMap;\n describe: (route: RouteProp<ParamListBase>, isPlaceholder: boolean) => SplitViewDescriptor;\n};\n\nconst PACK_TYPES = { start: Gtk.PackType.START, end: Gtk.PackType.END } as const;\nconst CONTENT_TITLE = \"Content\";\nconst ESCAPE_KEYVAL = Gdk.KEY_Escape;\n\nconst hasContent = (state: { routes: readonly unknown[] }): boolean => state.routes.length > 1;\n\nconst contentTitle = (state: StackNavigationState<ParamListBase>, descriptors: SplitViewDescriptorMap): string => {\n const route = state.routes[state.index];\n\n if (route === undefined || state.index === 0) {\n return state.routeNames[1] ?? CONTENT_TITLE;\n }\n\n return descriptors[route.key]?.options.title ?? route.name;\n};\n\nconst popContent = (navigation: SplitViewNavigationHelpers): void => {\n const state = navigation.getState();\n navigation.dispatch({ ...StackActions.pop(state.routes.length - 1), target: state.key });\n};\n\nconst settleShowContent = (viewRef: ViewRef, isShown: boolean, isSettled: boolean): void => {\n if (isSettled !== isShown && viewRef.current !== null) {\n viewRef.current.setShowContent(isSettled);\n }\n};\n\nconst useContentSync = (\n viewRef: ViewRef,\n navigation: SplitViewNavigationHelpers,\n): ((isShown: boolean | null) => void) =>\n useCallback(\n (isShown: boolean | null) => {\n if (isShown === null || isShown === hasContent(navigation.getState())) {\n return;\n }\n\n if (!isShown) {\n popContent(navigation);\n }\n\n settleShowContent(viewRef, isShown, hasContent(navigation.getState()));\n },\n [viewRef, navigation],\n );\n\nconst EscapeGuard = (): ReactNode => (\n <GtkEventControllerKey\n propagationPhase={Gtk.PropagationPhase.BUBBLE}\n onKeyPressed={(keyval) => keyval === ESCAPE_KEYVAL}\n />\n);\n\nconst SidebarPage = ({ descriptor }: { descriptor: SplitViewDescriptor }): ReactNode => {\n const { route, options, navigation } = descriptor;\n\n if (options.headerShown === false) {\n return <AdwNavigationPage title={options.title ?? route.name}>{descriptor.render()}</AdwNavigationPage>;\n }\n\n const topBar =\n options.header === undefined ? (\n <HeaderBar options={options} showBackButton={false} />\n ) : (\n <>{options.header({ route, navigation, options, back: undefined })}</>\n );\n\n return (\n <AdwNavigationPage title={options.title ?? route.name}>\n <AdwToolbarView topBar={topBar}>{descriptor.render()}</AdwToolbarView>\n </AdwNavigationPage>\n );\n};\n\nconst SplitView = (props: SplitViewProps): ReactNode => {\n const { state, navigation, descriptors, describe, contentPlaceholder } = props;\n const { collapsed = false, sidebarPosition = \"start\", minSidebarWidth, maxSidebarWidth } = props;\n const viewRef = useRef<Adw.NavigationSplitView | null>(null);\n const onShowContentChanged = useContentSync(viewRef, navigation);\n const sidebar = requireDescriptor(descriptors, state.routes[0]?.key ?? \"\");\n\n return (\n <AdwNavigationSplitView\n ref={viewRef}\n collapsed={collapsed}\n showContent={hasContent(state)}\n sidebarPosition={PACK_TYPES[sidebarPosition]}\n minSidebarWidth={minSidebarWidth}\n maxSidebarWidth={maxSidebarWidth}\n sidebarWidthFraction={props.sidebarWidthFraction}\n onNotifyShowContent={onShowContentChanged}\n sidebar={<SidebarPage descriptor={sidebar} />}\n >\n <AdwNavigationPage\n title={contentTitle(state, descriptors)}\n controllers={collapsed && props.popOnEscape === false ? <EscapeGuard /> : null}\n >\n {hasContent(state) ? (\n <StackView\n offset={1}\n popOnEscape={props.popOnEscape}\n state={state}\n navigation={navigation}\n descriptors={descriptors}\n describe={describe}\n />\n ) : (\n <>{contentPlaceholder}</>\n )}\n </AdwNavigationPage>\n </AdwNavigationSplitView>\n );\n};\n\nexport { SplitView };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/split-view/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,uBAAuB,EACvB,UAAU,EACV,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACT,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EACrB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAEzF,mGAAmG;AACnG,KAAK,2BAA2B,GAAG,uBAAuB,CAAC;AAC3D,0FAA0F;AAC1F,KAAK,0BAA0B,GAAG,sBAAsB,CAAC;AAEzD,gDAAgD;AAChD,KAAK,uBAAuB,CACxB,SAAS,SAAS,aAAa,EAC/B,SAAS,SAAS,MAAM,SAAS,GAAG,MAAM,SAAS,EACnD,WAAW,SAAS,MAAM,GAAG,SAAS,GAAG,SAA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"","sources":["../../src/split-view/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DefaultNavigatorOptions,\n Descriptor,\n NavigationHelpers,\n NavigationProp,\n ParamListBase,\n RouteProp,\n StackActionHelpers,\n StackNavigationState,\n StackRouterOptions,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport type { StackNavigationEventMap, StackNavigationOptions } from \"../stack/types.js\";\n\n/** Events the split view navigator emits: the stack's transition events, from the content pane. */\ntype SplitViewNavigationEventMap = StackNavigationEventMap;\n/** Per-screen options of the split view navigator, the same ones a stack screen takes. */\ntype SplitViewNavigationOptions = StackNavigationOptions;\n\n/** Navigation object of a split view screen. */\ntype SplitViewNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined,\n> = NavigationProp<\n ParamList,\n RouteName,\n NavigatorID,\n StackNavigationState<ParamList>,\n SplitViewNavigationOptions,\n SplitViewNavigationEventMap\n>
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/split-view/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DefaultNavigatorOptions,\n Descriptor,\n NavigationHelpers,\n NavigationProp,\n ParamListBase,\n RouteProp,\n StackActionHelpers,\n StackNavigationState,\n StackRouterOptions,\n} from \"@react-navigation/core\";\nimport type { ReactNode } from \"react\";\nimport type { StackNavigationEventMap, StackNavigationOptions } from \"../stack/types.js\";\n\n/** Events the split view navigator emits: the stack's transition events, from the content pane. */\ntype SplitViewNavigationEventMap = StackNavigationEventMap;\n/** Per-screen options of the split view navigator, the same ones a stack screen takes. */\ntype SplitViewNavigationOptions = StackNavigationOptions;\n\n/** Navigation object of a split view screen. */\ntype SplitViewNavigationProp<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined,\n> = NavigationProp<\n ParamList,\n RouteName,\n NavigatorID,\n StackNavigationState<ParamList>,\n SplitViewNavigationOptions,\n SplitViewNavigationEventMap\n> &\n StackActionHelpers<ParamList>;\n\n/** Props a split view screen component receives. */\ntype SplitViewScreenProps<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n NavigatorID extends string | undefined = undefined,\n> = {\n /** Navigation object of the screen. */\n navigation: SplitViewNavigationProp<ParamList, RouteName, NavigatorID>;\n /** The route the screen renders. */\n route: RouteProp<ParamList, RouteName>;\n};\n\n/** Navigation helpers of the split view navigator itself. */\ntype SplitViewNavigationHelpers = NavigationHelpers<ParamListBase, SplitViewNavigationEventMap> &\n StackActionHelpers<ParamListBase>;\n\n/** Descriptor of one split view route. */\ntype SplitViewDescriptor = Descriptor<\n SplitViewNavigationOptions,\n SplitViewNavigationProp<ParamListBase>,\n RouteProp<ParamListBase>\n>;\n\n/** Descriptors of the split view routes, keyed by route key. */\ntype SplitViewDescriptorMap = Record<string, SplitViewDescriptor>;\n\n/** Props of the split view navigator beyond the options every navigator shares. */\ntype SplitViewNavigationConfig = {\n /** Whether the panes stack into one instead of sitting side by side; defaults to `false`. */\n collapsed?: boolean;\n /** Fills the content pane while no content route is open; defaults to nothing. */\n contentPlaceholder?: ReactNode;\n /** Which side the sidebar sits on; defaults to `\"start\"`. */\n sidebarPosition?: \"start\" | \"end\";\n /** Minimum sidebar width, in the unit libadwaita uses for the split view. */\n minSidebarWidth?: number;\n /** Maximum sidebar width, in the unit libadwaita uses for the split view. */\n maxSidebarWidth?: number;\n /** Preferred sidebar width as a fraction of the total width. */\n sidebarWidthFraction?: number;\n /** Whether pressing Escape pops the visible content page; defaults to `true`. */\n popOnEscape?: boolean;\n};\n\n/** Props of the split view `Navigator` component. */\ntype SplitViewNavigatorProps = DefaultNavigatorOptions<\n ParamListBase,\n string | undefined,\n StackNavigationState<ParamListBase>,\n SplitViewNavigationOptions,\n SplitViewNavigationEventMap,\n SplitViewNavigationProp<ParamListBase>\n> &\n StackRouterOptions &\n SplitViewNavigationConfig;\n\nexport type {\n SplitViewDescriptor,\n SplitViewDescriptorMap,\n SplitViewNavigationConfig,\n SplitViewNavigationEventMap,\n SplitViewNavigationHelpers,\n SplitViewNavigationOptions,\n SplitViewNavigationProp,\n SplitViewNavigatorProps,\n SplitViewScreenProps,\n};\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;AAS7F,KAAK,UAAU,GAAG;IACd,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAClC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC;AA6EF,QAAA,MAAM,aAAa,
|
|
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;AAS7F,KAAK,UAAU,GAAG;IACd,KAAK,EAAE,SAAS,eAAe,EAAE,CAAC;IAClC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC,CAAC;AA6EF,QAAA,MAAM,aAAa,UACR,UAAU,eACJ,kBAAkB,YACrB,QAAQ,UACV,MAAM,KACf,UA4BF,CAAC;AAEF,OAAO,EAAE,KAAK,QAAQ,EAAE,aAAa,EAAE,CAAC"}
|