react-native-gtkx 0.1.0-alpha.4 → 0.2.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -9
- package/dist/adw/index.d.ts +3 -0
- package/dist/adw/index.js +41 -0
- package/dist/adw/index.js.map +1 -0
- package/dist/adw/widgets.generated.d.ts +63 -0
- package/dist/adw/widgets.generated.js +125 -0
- package/dist/adw/widgets.generated.js.map +1 -0
- package/dist/animated/create-animated.d.ts +2 -0
- package/dist/animated/create-animated.js +2 -0
- package/dist/animated/create-animated.js.map +1 -1
- package/dist/animated/index.d.ts +2 -0
- package/dist/animated/index.js +1 -0
- package/dist/animated/index.js.map +1 -1
- package/dist/animated/value-xy.d.ts +41 -0
- package/dist/animated/value-xy.js +90 -0
- package/dist/animated/value-xy.js.map +1 -0
- package/dist/animated/value.d.ts +9 -0
- package/dist/animated/value.js +30 -2
- package/dist/animated/value.js.map +1 -1
- package/dist/common/content.d.ts +69 -0
- package/dist/common/content.js +84 -0
- package/dist/common/content.js.map +1 -0
- package/dist/common/icon.d.ts +23 -0
- package/dist/common/icon.js +14 -0
- package/dist/common/icon.js.map +1 -0
- package/dist/common/index.d.ts +5 -0
- package/dist/common/index.js +21 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/list.d.ts +82 -0
- package/dist/common/list.js +166 -0
- package/dist/common/list.js.map +1 -0
- package/dist/common/navigation-stack.d.ts +84 -0
- package/dist/common/navigation-stack.js +313 -0
- package/dist/common/navigation-stack.js.map +1 -0
- package/dist/common/widget.d.ts +62 -0
- package/dist/common/widget.js +209 -0
- package/dist/common/widget.js.map +1 -0
- package/dist/components/animated.d.ts +7 -4
- package/dist/components/animated.js +88 -67
- package/dist/components/animated.js.map +1 -1
- package/dist/components/app-registry.d.ts +36 -1
- package/dist/components/app-registry.js +8 -3
- package/dist/components/app-registry.js.map +1 -1
- package/dist/components/host-node.d.ts +7 -0
- package/dist/components/host-node.js +26 -1
- package/dist/components/host-node.js.map +1 -1
- package/dist/components/index.d.ts +6 -2
- package/dist/components/index.js +2 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/measure.d.ts +13 -0
- package/dist/components/measure.js +51 -0
- package/dist/components/measure.js.map +1 -0
- package/dist/components/modal.d.ts +1 -1
- package/dist/components/press-event.d.ts +28 -0
- package/dist/components/press-event.js +46 -0
- package/dist/components/press-event.js.map +1 -0
- package/dist/components/pressable.d.ts +2 -6
- package/dist/components/pressable.js +119 -20
- package/dist/components/pressable.js.map +1 -1
- package/dist/components/rect-store.d.ts +11 -1
- package/dist/components/rect-store.js +27 -3
- package/dist/components/rect-store.js.map +1 -1
- package/dist/components/scroll-view.d.ts +4 -0
- package/dist/components/scroll-view.js +8 -2
- package/dist/components/scroll-view.js.map +1 -1
- package/dist/components/svg/animated-support.d.ts +19 -0
- package/dist/components/svg/animated-support.js +64 -0
- package/dist/components/svg/animated-support.js.map +1 -0
- package/dist/components/svg/context.d.ts +8 -0
- package/dist/components/svg/context.js +15 -0
- package/dist/components/svg/context.js.map +1 -0
- package/dist/components/svg/gradients.d.ts +31 -0
- package/dist/components/svg/gradients.js +93 -0
- package/dist/components/svg/gradients.js.map +1 -0
- package/dist/components/svg/group.d.ts +8 -0
- package/dist/components/svg/group.js +30 -0
- package/dist/components/svg/group.js.map +1 -0
- package/dist/components/svg/index.d.ts +6 -0
- package/dist/components/svg/index.js +5 -0
- package/dist/components/svg/index.js.map +1 -0
- package/dist/components/svg/node.d.ts +7 -0
- package/dist/components/svg/node.js +7 -0
- package/dist/components/svg/node.js.map +1 -0
- package/dist/components/svg/paint.d.ts +24 -0
- package/dist/components/svg/paint.js +57 -0
- package/dist/components/svg/paint.js.map +1 -0
- package/dist/components/svg/shapes.d.ts +47 -0
- package/dist/components/svg/shapes.js +51 -0
- package/dist/components/svg/shapes.js.map +1 -0
- package/dist/components/svg/svg.d.ts +14 -0
- package/dist/components/svg/svg.js +48 -0
- package/dist/components/svg/svg.js.map +1 -0
- package/dist/components/svg/use-shape-node.d.ts +12 -0
- package/dist/components/svg/use-shape-node.js +52 -0
- package/dist/components/svg/use-shape-node.js.map +1 -0
- package/dist/components/text-input.js +1 -1
- package/dist/components/text-input.js.map +1 -1
- package/dist/components/text.js +36 -3
- package/dist/components/text.js.map +1 -1
- package/dist/components/use-layout-child.js +50 -4
- package/dist/components/use-layout-child.js.map +1 -1
- package/dist/components/view.d.ts +9 -4
- package/dist/components/view.js +8 -2
- package/dist/components/view.js.map +1 -1
- package/dist/contracts.d.ts +31 -4
- package/dist/contracts.js.map +1 -1
- package/dist/gtk/index.d.ts +7 -0
- package/dist/gtk/index.js +46 -0
- package/dist/gtk/index.js.map +1 -0
- package/dist/gtk/widgets.generated.d.ts +103 -0
- package/dist/gtk/widgets.generated.js +205 -0
- package/dist/gtk/widgets.generated.js.map +1 -0
- package/dist/gtk/window-actions.d.ts +77 -0
- package/dist/gtk/window-actions.js +193 -0
- package/dist/gtk/window-actions.js.map +1 -0
- package/dist/gtkx/bridge/geometry.d.ts +15 -0
- package/dist/gtkx/bridge/geometry.js +38 -0
- package/dist/gtkx/bridge/geometry.js.map +1 -0
- package/dist/gtkx/bridge/index.d.ts +11 -4
- package/dist/gtkx/bridge/index.js +47 -6
- package/dist/gtkx/bridge/index.js.map +1 -1
- package/dist/gtkx/bridge/layout-manager.d.ts +2 -1
- package/dist/gtkx/bridge/layout-manager.js +31 -9
- package/dist/gtkx/bridge/layout-manager.js.map +1 -1
- package/dist/gtkx/bridge/slot-portal.d.ts +12 -0
- package/dist/gtkx/bridge/slot-portal.js +17 -0
- package/dist/gtkx/bridge/slot-portal.js.map +1 -0
- package/dist/gtkx/bridge/svg-node.d.ts +79 -0
- package/dist/gtkx/bridge/svg-node.js +323 -0
- package/dist/gtkx/bridge/svg-node.js.map +1 -0
- package/dist/gtkx/bridge/use-signal.js +19 -9
- package/dist/gtkx/bridge/use-signal.js.map +1 -1
- package/dist/gtkx/bridge/widgets.generated.d.ts +2 -0
- package/dist/gtkx/bridge/widgets.generated.js +14 -0
- package/dist/gtkx/bridge/widgets.generated.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/bin.d.ts +2 -0
- package/dist/mcp/bin.js +17 -0
- package/dist/mcp/bin.js.map +1 -0
- package/dist/mcp/data/generated.d.ts +1304 -0
- package/dist/mcp/data/generated.js +1179 -0
- package/dist/mcp/data/generated.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.js +9 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/list.d.ts +4 -0
- package/dist/mcp/list.js +56 -0
- package/dist/mcp/list.js.map +1 -0
- package/dist/mcp/resolve.d.ts +55 -0
- package/dist/mcp/resolve.js +151 -0
- package/dist/mcp/resolve.js.map +1 -0
- package/dist/mcp/search.d.ts +13 -0
- package/dist/mcp/search.js +48 -0
- package/dist/mcp/search.js.map +1 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.js +135 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool.d.ts +21 -0
- package/dist/mcp/tool.js +36 -0
- package/dist/mcp/tool.js.map +1 -0
- package/dist/metro/index.js +10 -0
- package/dist/metro/index.js.map +1 -1
- package/dist/navigation/index.d.ts +50 -13
- package/dist/navigation/index.js +183 -148
- package/dist/navigation/index.js.map +1 -1
- package/dist/navigation/option-warnings.js +9 -1
- package/dist/navigation/option-warnings.js.map +1 -1
- package/dist/navigation/sidebar.d.ts +207 -9
- package/dist/navigation/sidebar.js +294 -10
- package/dist/navigation/sidebar.js.map +1 -1
- package/dist/responder/system.d.ts +27 -0
- package/dist/responder/system.js +184 -0
- package/dist/responder/system.js.map +1 -0
- package/dist/responder/touch-history.d.ts +10 -0
- package/dist/responder/touch-history.js +78 -0
- package/dist/responder/touch-history.js.map +1 -0
- package/dist/responder/types.d.ts +63 -0
- package/dist/responder/types.js +29 -0
- package/dist/responder/types.js.map +1 -0
- package/dist/responder/use-responder.d.ts +12 -0
- package/dist/responder/use-responder.js +98 -0
- package/dist/responder/use-responder.js.map +1 -0
- package/dist/runner/host-dev.js +3 -1
- package/dist/runner/host-dev.js.map +1 -1
- package/dist/runner/host.js +5 -1
- package/dist/runner/host.js.map +1 -1
- package/dist/runner/index.d.ts +22 -2
- package/dist/runner/index.js +163 -13
- package/dist/runner/index.js.map +1 -1
- package/dist/sea/assemble.d.ts +29 -0
- package/dist/sea/assemble.js +129 -0
- package/dist/sea/assemble.js.map +1 -0
- package/dist/sea/bundle.d.ts +61 -0
- package/dist/sea/bundle.js +202 -0
- package/dist/sea/bundle.js.map +1 -0
- package/dist/sea/gtkx-config-module.d.ts +18 -0
- package/dist/sea/gtkx-config-module.js +67 -0
- package/dist/sea/gtkx-config-module.js.map +1 -0
- package/dist/sea/native-shim.d.ts +40 -0
- package/dist/sea/native-shim.js +121 -0
- package/dist/sea/native-shim.js.map +1 -0
- package/dist/sea/react-anchor-plugin.d.ts +2 -0
- package/dist/sea/react-anchor-plugin.js +30 -0
- package/dist/sea/react-anchor-plugin.js.map +1 -0
- package/dist/style/box-shadow.d.ts +7 -0
- package/dist/style/box-shadow.js +197 -0
- package/dist/style/box-shadow.js.map +1 -0
- package/dist/style/index.d.ts +3 -0
- package/dist/style/index.js +3 -0
- package/dist/style/index.js.map +1 -1
- package/dist/style/split-style.d.ts +5 -2
- package/dist/style/split-style.js +33 -5
- package/dist/style/split-style.js.map +1 -1
- package/dist/style/text-decoration.d.ts +15 -0
- package/dist/style/text-decoration.js +26 -0
- package/dist/style/text-decoration.js.map +1 -0
- package/dist/style/transform.d.ts +22 -0
- package/dist/style/transform.js +137 -0
- package/dist/style/transform.js.map +1 -0
- package/dist/style/visual-css.js +40 -3
- package/dist/style/visual-css.js.map +1 -1
- package/dist/svg/geometry.d.ts +19 -0
- package/dist/svg/geometry.js +80 -0
- package/dist/svg/geometry.js.map +1 -0
- package/dist/svg/gradient-geometry.d.ts +15 -0
- package/dist/svg/gradient-geometry.js +15 -0
- package/dist/svg/gradient-geometry.js.map +1 -0
- package/dist/svg/transform.d.ts +22 -0
- package/dist/svg/transform.js +74 -0
- package/dist/svg/transform.js.map +1 -0
- package/dist/svg/view-box.d.ts +34 -0
- package/dist/svg/view-box.js +108 -0
- package/dist/svg/view-box.js.map +1 -0
- package/dist/svg-compat/index.d.ts +1 -0
- package/dist/svg-compat/index.js +16 -0
- package/dist/svg-compat/index.js.map +1 -0
- package/dist/testing/index.d.ts +14 -0
- package/dist/testing/index.js +14 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/vendor/react-native/pan-responder.d.ts +102 -0
- package/dist/vendor/react-native/pan-responder.js +196 -0
- package/dist/vendor/react-native/pan-responder.js.map +1 -0
- package/dist/vendor/react-native/touch-history-math.d.ts +18 -0
- package/dist/vendor/react-native/touch-history-math.js +102 -0
- package/dist/vendor/react-native/touch-history-math.js.map +1 -0
- package/dist/vite/index.d.ts +7 -3
- package/dist/vite/index.js +16 -4
- package/dist/vite/index.js.map +1 -1
- package/dist/vitest/index.d.ts +52 -0
- package/dist/vitest/index.js +58 -0
- package/dist/vitest/index.js.map +1 -0
- package/dist/vitest/setup.d.ts +4 -0
- package/dist/vitest/setup.js +22 -0
- package/dist/vitest/setup.js.map +1 -0
- package/package.json +52 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/navigation/index.tsx"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,2EAA2E;AAC3E,uBAAuB;AACvB,EAAE;AACF,+DAA+D;AAC/D,+DAA+D;AAC/D,0EAA0E;AAC1E,sEAAsE;AACtE,4BAA4B;AAC5B,qEAAqE;AACrE,0EAA0E;AAC1E,sEAAsE;AACtE,qEAAqE;AACrE,OAAO,EACL,sBAAsB,EACtB,YAAY,EACZ,WAAW,EACX,oBAAoB,EACpB,uBAAuB,GAKx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ACH,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CACnB,KAAC,aAAa,cAAE,OAAO,CAAC,UAAU,EAAE,GAAiB,CACtD,CAAC,CAAC,CAAC,SAAS,EAEf,GAAG,EAAE;4BACH,GAAG,CAAC,OAAO,CAAC,WAAW;gCACrB,CAAC,CAAC;oCACE,KAAC,aAAa,cACX,OAAO,CAAC,WAAW,EAAE,IADL,cAAc,CAEjB;iCACjB;gCACH,CAAC,CAAC,EAAE,CAAC;4BACP,GAAG,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACzC,KAAC,SAAS,IAER,QAAQ,EAAE,MAAM,CAAC,IAAI,EACrB,WAAW,EAAE,MAAM,CAAC,OAAO,EAC3B,SAAS,EAAE,MAAM,CAAC,OAAO,IAHpB,MAAM,CAAC,EAAE,CAId,CACH,CAAC,IAAI,EAAE,CAAC;yBACV,GACD,YAGH,OAAO,GACO,CAClB,CAAC,CAAC,CAAC,CACF,OAAO,CACR,IA3CI,GAAG,CA4CU,CACrB,CAAA;QACH,CAAC,CAAC,GACgB,CACrB,CAAA;AACH,CAAC,CAAA;AA+CD,MAAM,YAAY,GAAG,sBAAsB,CAAC,cAAc,CAAC,CAAA;AAE3D,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAEA,EAAE,CACpC,YAAY,EAAoC,CAAA;AAElD,OAAO,EACL,sBAAsB,GAMvB,MAAM,WAAW,CAAA;AAElB,yEAAyE;AACzE,oCAAoC;AACpC,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,QAAQ,GACT,MAAM,0BAA0B,CAAA","sourcesContent":["// react-native-gtkx/navigation — a react-navigation stack navigator backed\n// by Adw.NavigationView. The model mirrors @react-navigation/native-stack\n// on iOS (UINavigationController): react-navigation state is the source of\n// truth, the native view is imperatively synced to it, and NATIVE pops (the\n// Adwaita back button, Escape, the back gesture) are reported back through\n// the \"popped\" signal.\n//\n// Sync protocol (the two directions must not echo each other):\n// - state → view: an effect diffs the synced tag stack against\n// state.routes and drives pushByTag / popToTag / replaceWithTags. Pages\n// are declarative children keyed by route.key, so the widgets exist\n// before the effect runs.\n// - view → state: \"popped\" fires for EVERY popped page, ours and the\n// user's. The discriminator is the state itself: a tag that is still in\n// state.routes means the user popped the view (dispatch POP); a tag\n// already gone from state means the pop was state-driven — ignore.\nimport {\n createNavigatorFactory,\n StackActions,\n StackRouter,\n useNavigationBuilder,\n usePreventRemoveContext,\n type NavigationProp,\n type ParamListBase,\n type RouteProp,\n type StackNavigationState,\n} from \"@react-navigation/native\"\nimport {\n useCallback,\n useEffect,\n useRef,\n useState,\n type ComponentType,\n type ReactNode,\n type RefObject,\n} from \"react\"\nimport { InteractionManager } from \"../apis/interaction-manager\"\nimport { getActiveChrome } from \"../components/app-registry\"\nimport { IntrinsicRoot, NestedRoot } from \"../components/root\"\nimport {\n AdwHeaderBar,\n AdwNavigationPage,\n AdwNavigationView,\n AdwToolbarView,\n GtkButton,\n type Adw,\n} from \"../gtkx/bridge/index\"\nimport { warnIgnoredOptions } from \"./option-warnings\"\nimport type { HeaderButton } from \"./sidebar\"\n\nconst STACK_OPTION_KEYS: ReadonlySet<string> = new Set([\n \"title\",\n \"headerShown\",\n \"headerButtons\",\n \"headerLeft\",\n \"headerRight\",\n \"gestureEnabled\",\n])\n\nexport type StackNavigationOptions = {\n /** HeaderBar title; defaults to the route name. */\n title?: string\n /** Render the Adwaita HeaderBar for this screen (default true). */\n headerShown?: boolean\n /** Buttons packed at the end of this screen's HeaderBar (see\n * HeaderButton); screens usually set them via navigation.setOptions. */\n headerButtons?: HeaderButton[]\n /** RN content packed at the start of the HeaderBar (an intrinsic-size\n * layout root: the content's Yoga size IS the slot size). */\n headerLeft?: () => ReactNode\n /** RN content packed at the end of the HeaderBar, before headerButtons. */\n headerRight?: () => ReactNode\n /** false disables the native back button, Escape and the back gesture\n * for this screen (the page's Adwaita can-pop). Programmatic goBack\n * still works. Also the mechanism behind usePreventRemove. */\n gestureEnabled?: boolean\n}\n\ntype StackDescriptor = {\n options: StackNavigationOptions\n render: () => ReactNode\n // react-navigation hands every descriptor its own route.\n route: { key: string; name: string }\n}\n\ntype StackNavigatorProps = {\n initialRouteName?: string\n screenOptions?: StackNavigationOptions\n children: ReactNode\n}\n\nconst StackNavigator = ({\n initialRouteName,\n screenOptions,\n children,\n}: StackNavigatorProps) => {\n const { state, descriptors, navigation, NavigationContent } =\n useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n Record<string, unknown>,\n Record<string, () => void>,\n StackNavigationOptions,\n Record<string, unknown>\n >(StackRouter, {\n initialRouteName,\n screenOptions,\n children,\n })\n\n const viewRef = useRef<Adw.NavigationView | null>(null)\n\n useEffect(() => {\n for (const route of state.routes) {\n const descriptor = descriptors[route.key] as StackDescriptor | undefined\n if (descriptor) {\n warnIgnoredOptions(\n \"createStackNavigator\",\n descriptor.options,\n STACK_OPTION_KEYS,\n )\n }\n }\n }, [state, descriptors])\n\n useEffect(() => {\n if (\n process.env.NODE_ENV !== \"production\" &&\n getActiveChrome() === \"system\"\n ) {\n console.warn(\n '[react-native-gtkx/navigation] the app runs with the default window chrome — pages bring their own HeaderBars, so you will see a doubled titlebar. Pass chrome: \"content\" to AppRegistry.runApplication.',\n )\n }\n }, [])\n // Mirror of the view's visible stack (route keys), maintained by the sync\n // effect and by the popped handler — the two never race: GTK signals run\n // synchronously inside the very push/pop calls the effect makes.\n const syncedRef = useRef<string[]>([])\n\n // Pop ANIMATION support: react-navigation drops a popped route from state\n // immediately, but Adwaita still animates the page out (~200 ms). Pages\n // therefore render from renderedKeys — live routes plus closing pages —\n // and a closing page leaves only on its \"hidden\" signal (the end of the\n // transition). Its content renders from a snapshot cached while live.\n const [renderedKeys, setRenderedKeys] = useState<string[]>(() =>\n state.routes.map((route) => route.key),\n )\n const liveKeys = state.routes.map((route) => route.key)\n const missingKeys = liveKeys.filter((key) => !renderedKeys.includes(key))\n if (missingKeys.length > 0) {\n // The sanctioned derive-state-during-render pattern: a new route must be\n // in renderedKeys within the same commit its page is pushed.\n setRenderedKeys([...renderedKeys, ...missingKeys])\n }\n // A state-held stable Map (not a ref): the render path reads it for\n // closing pages, and the react-hooks/refs rule rightly bans render-time\n // ref reads.\n const [snapshots] = useState(\n () =>\n new Map<\n string,\n { name: string; options: StackNavigationOptions; element: ReactNode }\n >(),\n )\n useEffect(() => {\n for (const route of state.routes) {\n const descriptor = descriptors[route.key] as StackDescriptor | undefined\n if (descriptor) {\n snapshots.set(route.key, {\n name: route.name,\n options: descriptor.options,\n element: <NestedRoot>{descriptor.render()}</NestedRoot>,\n })\n }\n }\n })\n\n const handleHidden = useCallback(\n (key: string): void => {\n // \"hidden\" also fires for a live page covered by a push — only pages\n // gone from state are actually closing.\n if (navigation.getState().routes.some((route) => route.key === key)) {\n return\n }\n snapshots.delete(key)\n setRenderedKeys((keys) => keys.filter((rendered) => rendered !== key))\n },\n [navigation, snapshots],\n )\n\n // \"hidden\" delivery is not guaranteed in every environment (headless\n // compositors with animations disabled never emit it) — a timer slightly\n // longer than the Adwaita transition is the fallback; handleHidden is\n // idempotent, whichever fires first wins.\n const scheduleRetainedRemoval = useCallback(\n (key: string): void => {\n setTimeout(() => handleHidden(key), 400)\n },\n [handleHidden],\n )\n\n // Bracket every view transition with an InteractionManager handle so\n // runAfterInteractions-scheduled work (a screen's own data load / heavy\n // render) waits for the slide to finish instead of stealing its frames.\n // The handle is opened when the sync effect mutates the view and cleared\n // one transition-length later; overlapping transitions reference-count.\n const beginTransition = useCallback((): void => {\n const handle = InteractionManager.createInteractionHandle()\n setTimeout(() => InteractionManager.clearInteractionHandle(handle), 400)\n }, [])\n\n useEffect(() => {\n const view = viewRef.current\n if (!view) {\n return\n }\n const target = state.routes.map((route) => route.key)\n if (syncedRef.current.length === 0 && target.length > 0) {\n // First mount: NavigationView shows the first added page by itself.\n syncedRef.current = target.slice(0, 1)\n }\n let common = 0\n while (\n common < syncedRef.current.length &&\n common < target.length &&\n syncedRef.current[common] === target[common]\n ) {\n common += 1\n }\n if (common === 0 && syncedRef.current[0] !== target[0]) {\n // The stack root changed (reset): swap the whole visible stack.\n const leaving = syncedRef.current.filter((key) => !target.includes(key))\n syncedRef.current = [...target]\n beginTransition()\n view.replaceWithTags(target)\n for (const key of leaving) {\n scheduleRetainedRemoval(key)\n }\n return\n }\n if (syncedRef.current.length > common) {\n const anchor = target[common - 1]\n const leaving = syncedRef.current.slice(common)\n syncedRef.current = syncedRef.current.slice(0, common)\n if (anchor !== undefined) {\n beginTransition()\n view.popToTag(anchor)\n }\n for (const key of leaving) {\n scheduleRetainedRemoval(key)\n }\n }\n for (\n let index = syncedRef.current.length;\n index < target.length;\n index += 1\n ) {\n const key = target[index]!\n syncedRef.current.push(key)\n beginTransition()\n view.pushByTag(key)\n }\n }, [state, scheduleRetainedRemoval, beginTransition])\n\n // `navigation` is identity-stable across renders (react-navigation\n // builder contract) and getState() always reads the live state — the\n // closure needs no ref indirection.\n const handlePopped = (page: Adw.NavigationPage | null): void => {\n const tag = page?.getTag()\n if (!tag) {\n return\n }\n syncedRef.current = syncedRef.current.filter((key) => key !== tag)\n const current = navigation.getState()\n if (current.routes.some((route) => route.key === tag)) {\n // The view popped on its own (back button / gesture): follow in state.\n navigation.dispatch(StackActions.pop())\n }\n scheduleRetainedRemoval(tag)\n }\n\n return (\n <NavigationContent>\n <StackView\n viewRef={viewRef}\n renderedKeys={renderedKeys}\n routeKeys={state.routes.map((route) => route.key)}\n descriptors={descriptors}\n snapshots={snapshots}\n onPopped={handlePopped}\n onHidden={handleHidden}\n />\n </NavigationContent>\n )\n}\n\ntype StackViewProps = {\n viewRef: RefObject<Adw.NavigationView | null>\n renderedKeys: string[]\n routeKeys: string[]\n descriptors: Record<string, unknown>\n snapshots: Map<\n string,\n { name: string; options: StackNavigationOptions; element: ReactNode }\n >\n onPopped: (page: Adw.NavigationPage | null) => void\n onHidden: (key: string) => void\n}\n\n// The page list lives inside NavigationContent so it can read the\n// prevent-remove context (which useNavigationBuilder only provides to\n// NavigationContent's children). A page whose route is prevented — or whose\n// screen set gestureEnabled: false — reports canPop: false, so Adwaita\n// disables the back button, Escape and the back gesture for it; a\n// programmatic goBack still pops (once the app lifts the prevention, e.g.\n// after its own confirmation dialog). This is why a native pop can never\n// race react-navigation state for these routes.\nconst StackView = ({\n viewRef,\n renderedKeys,\n routeKeys,\n descriptors,\n snapshots,\n onPopped,\n onHidden,\n}: StackViewProps) => {\n const { preventedRoutes } = usePreventRemoveContext()\n return (\n <AdwNavigationView\n ref={viewRef}\n onPopped={(page) => onPopped(page)}\n >\n {renderedKeys.map((key) => {\n const isLive = routeKeys.includes(key)\n const descriptor = isLive\n ? (descriptors[key] as StackDescriptor | undefined)\n : undefined\n const snapshot = snapshots.get(key)\n const options = descriptor?.options ?? snapshot?.options ?? {}\n const headerShown = options.headerShown ?? true\n const canPop =\n options.gestureEnabled !== false &&\n !preventedRoutes[key]?.preventRemove\n const content = descriptor ? (\n <NestedRoot>{descriptor.render()}</NestedRoot>\n ) : (\n (snapshot?.element ?? null)\n )\n return (\n <AdwNavigationPage\n key={key}\n tag={key}\n // Never the route key — that is an internal identifier, and\n // it would end up in the window title under content chrome.\n title={\n options.title ?? descriptor?.route.name ?? snapshot?.name ?? key\n }\n canPop={canPop}\n onHidden={() => onHidden(key)}\n >\n {headerShown ? (\n <AdwToolbarView\n topBar={\n <AdwHeaderBar\n start={\n options.headerLeft ? (\n <IntrinsicRoot>{options.headerLeft()}</IntrinsicRoot>\n ) : undefined\n }\n end={[\n ...(options.headerRight\n ? [\n <IntrinsicRoot key=\"header-right\">\n {options.headerRight()}\n </IntrinsicRoot>,\n ]\n : []),\n ...(options.headerButtons?.map((button) => (\n <GtkButton\n key={button.id}\n iconName={button.icon}\n tooltipText={button.tooltip}\n onClicked={button.onPress}\n />\n )) ?? []),\n ]}\n />\n }\n >\n {content}\n </AdwToolbarView>\n ) : (\n content\n )}\n </AdwNavigationPage>\n )\n })}\n </AdwNavigationView>\n )\n}\n\n// ---- typed factory --------------------------------------------------------\n// The upstream createNavigatorFactory returns `any` — mirroring the typed\n// wrapper pattern of native-stack gives Screen configs, options and screen\n// props real types without changing runtime behavior.\n\nexport type StackNavigationHelpers<\n ParamList extends ParamListBase = ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n> = NavigationProp<\n ParamList,\n RouteName,\n undefined,\n StackNavigationState<ParamList>,\n StackNavigationOptions\n>\n\nexport type StackScreenProps<\n ParamList extends ParamListBase = ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n> = {\n route: RouteProp<ParamList, RouteName>\n navigation: StackNavigationHelpers<ParamList, RouteName>\n}\n\nexport type StackScreenConfig<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList,\n> = {\n name: RouteName\n component: ComponentType<StackScreenProps<ParamList, RouteName>>\n options?:\n | StackNavigationOptions\n | ((\n props: StackScreenProps<ParamList, RouteName>,\n ) => StackNavigationOptions)\n initialParams?: Partial<ParamList[RouteName]>\n}\n\nexport type TypedStackNavigator<ParamList extends ParamListBase> = {\n Navigator: ComponentType<StackNavigatorProps>\n Screen: <RouteName extends keyof ParamList>(\n props: StackScreenConfig<ParamList, RouteName>,\n ) => null\n}\n\nconst stackFactory = createNavigatorFactory(StackNavigator)\n\nexport const createStackNavigator = <\n ParamList extends ParamListBase = ParamListBase,\n>(): TypedStackNavigator<ParamList> =>\n stackFactory() as TypedStackNavigator<ParamList>\n\nexport {\n createSidebarNavigator,\n type HeaderButton,\n type SidebarNavigationOptions,\n type SidebarScreenConfig,\n type SidebarScreenProps,\n type TypedSidebarNavigator,\n} from \"./sidebar\"\n\n// The rest of the react-navigation surface apps need, so a linux app can\n// import everything from one place.\nexport {\n CommonActions,\n NavigationContainer,\n StackActions,\n useFocusEffect,\n useIsFocused,\n useNavigation,\n useNavigationContainerRef,\n usePreventRemove,\n useRoute,\n} from \"@react-navigation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CAAC,CAAA;AAoBzE,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAEA,EAAE,CAAC,YAAY,EAAa,CAAA","sourcesContent":["// react-native-gtkx/navigation — a react-navigation stack navigator backed\n// by the Adw.NavigationView primitive from react-native-gtkx/adwaita.\n//\n// This file is an ADAPTER and nothing else. Every widget concern — diffing\n// the tag stack into pushes and pops, holding a popped page alive until its\n// exit animation ends, bracketing transitions — lives in the primitive. What\n// stays here is exactly the react-navigation half:\n//\n// - state → the ordered tags handed to NavigationStack (route keys);\n// - a native pop (back button, Escape, back gesture) → StackActions.pop,\n// but only when the tag is still in state, otherwise the pop was one WE\n// caused and echoing it would double-pop;\n// - descriptors → page titles, header content and canPop;\n// - unknown-option warnings.\n//\n// The same split as @react-navigation/native-stack over react-native-screens.\n// If you do not want a router, use the primitive directly.\nimport {\n createNavigatorFactory,\n StackActions,\n StackRouter,\n useNavigationBuilder,\n usePreventRemoveContext,\n type NavigationProp,\n type NavigatorTypeBagBase,\n type NavigatorTypeBagFor,\n type ParamListBase,\n type RouteProp,\n type StackNavigationState,\n type TypedNavigator,\n} from \"@react-navigation/native\"\nimport { useEffect, useRef, type ComponentType, type ReactNode } from \"react\"\nimport { getActiveChrome } from \"../components/app-registry\"\nimport { AdwHeaderBar, AdwToolbarView } from \"../adw\"\nimport {\n HeaderSlotContent,\n NavigationStack,\n NavigationStackPage,\n SlotContent,\n} from \"../common\"\nimport { GtkButton } from \"../gtkx/bridge/index\"\nimport { warnIgnoredOptions } from \"./option-warnings\"\nimport type { HeaderButton } from \"./sidebar\"\n\nconst STACK_OPTION_KEYS: ReadonlySet<string> = new Set([\n \"title\",\n \"headerShown\",\n \"headerButtons\",\n \"headerLeft\",\n \"headerRight\",\n \"gestureEnabled\",\n \"animation\",\n])\n\nexport type StackNavigationOptions = {\n /** AdwHeaderBar title; defaults to the route name. */\n title?: string\n /** Render the Adwaitan AdwHeaderBar for this screen (default true). */\n headerShown?: boolean\n /** Buttons packed at the end of this screen's AdwHeaderBar (see\n * HeaderButton); screens usually set them via navigation.setOptions. */\n headerButtons?: HeaderButton[]\n /** RN content packed at the start of the AdwHeaderBar (an intrinsic-size\n * layout root: the content's Yoga size IS the slot size). */\n headerLeft?: () => ReactNode\n /** RN content packed at the end of the AdwHeaderBar, before headerButtons. */\n headerRight?: () => ReactNode\n /** false disables the native back button, Escape and the back gesture\n * for this screen (the page's Adwaita can-pop). Programmatic goBack\n * still works. Also the mechanism behind usePreventRemove. */\n gestureEnabled?: boolean\n /**\n * `\"none\"` turns transitions off; any other value (including the\n * `@react-navigation/native-stack` style names like `\"slide_from_bottom\"`\n * or `\"fade\"`) turns them on. GTK has exactly one transition style, so a\n * specific requested type cannot be honored — only whether to animate at\n * all can be. Requesting a specific (non-`\"default\"`) type still animates,\n * with the standard Adwaita transition, and warns once in development.\n * Read from whichever screen is currently on top of the visible stack, so\n * setting it uniformly via `screenOptions` is the reliable way to use it —\n * see docs/api.md.\n */\n animation?: string\n}\n\n// Matches @react-navigation/stack's and @react-navigation/native-stack's\n// own NativeStackNavigationEventMap/StackNavigationEventMap exactly (both\n// verified against their v8 source — this package is not a dependency, so\n// docs cannot be trusted here, see docs/api.md and 007.md). `closing` is\n// false for a route becoming visible (pushed) and true for a route leaving\n// the visible stack (popped); a route whose visibility does not change\n// (e.g. the screen covered by a push) never receives either event — an app\n// that listens for `transitionEnd` gets the identical event name and\n// payload shape it would get on iOS or Android.\nexport type StackNavigationEventMap = {\n /** Fires when a push/pop/replace transition starts, once per involved\n * route (not once per gesture or user tap). */\n transitionStart: { data: { closing: boolean } }\n /** Fires when the transition settles, driven by the page's own real\n * `shown`/`hidden` AdwNavigationPage signal (see docs/api.md and the\n * primitive's beginTransition) — not a timer, except as a fallback for\n * the rare cases where neither signal arrives. Native pops (back\n * button, Escape, back gesture) do not fire this at all today — see\n * docs/api.md. */\n transitionEnd: { data: { closing: boolean } }\n}\n\ntype StackDescriptor = {\n options: StackNavigationOptions\n render: () => ReactNode\n // react-navigation hands every descriptor its own route.\n route: { key: string; name: string }\n}\n\ntype StackNavigatorProps = {\n initialRouteName?: string\n screenOptions?: StackNavigationOptions\n children: ReactNode\n}\n\nconst StackNavigator = ({\n initialRouteName,\n screenOptions,\n children,\n}: StackNavigatorProps) => {\n const { state, descriptors, navigation, NavigationContent } =\n useNavigationBuilder<\n StackNavigationState<ParamListBase>,\n Record<string, unknown>,\n Record<string, () => void>,\n StackNavigationOptions,\n StackNavigationEventMap\n >(StackRouter, {\n initialRouteName,\n screenOptions,\n children,\n })\n\n // React Navigation 8: `state.routes` is no longer just the visible stack —\n // it is active routes followed by retained routes (closing, kept mounted\n // for `inactiveBehavior`) and preloaded routes (`navigation.preload()`,\n // not yet navigated to), all concatenated, with the focused/visible tail\n // ending at `state.index` (see StackRouter's `getStateWithRoutes`: `routes:\n // activeRoutes.concat(retainedRoutes, preloadedRoutes)`, `index:\n // activeRoutes.length - 1`). Handing the whole array to NavigationStack\n // would push a preloaded screen onto the widget as if it were a real page\n // the user navigated to. Only the active slice is the visible stack.\n const visibleRoutes = state.routes.slice(0, state.index + 1)\n const visibleKeys = visibleRoutes.map((route) => route.key)\n\n // GTK has exactly one transition style and one animate-transitions switch\n // for the whole view — there is no per-route knob to hand it. The screen\n // actually being navigated TO is the natural read of \"the currently\n // relevant animation option\": for a push, that is the new top of stack;\n // for a pop, the screen the pop reveals. An app that sets `animation`\n // uniformly through `screenOptions` (the common case for \"turn animation\n // off entirely\") gets the same value everywhere, so this only matters\n // when different screens genuinely disagree.\n const activeRouteKey = visibleKeys[visibleKeys.length - 1]\n const activeDescriptor = activeRouteKey\n ? (descriptors[activeRouteKey] as StackDescriptor | undefined)\n : undefined\n const animateTransitions = activeDescriptor?.options.animation !== \"none\"\n\n useEffect(() => {\n for (const route of state.routes) {\n const descriptor = descriptors[route.key] as StackDescriptor | undefined\n if (descriptor) {\n warnIgnoredOptions(\n \"createStackNavigator\",\n descriptor.options,\n STACK_OPTION_KEYS,\n )\n const { animation } = descriptor.options\n // \"animation\" itself is in STACK_OPTION_KEYS above (it IS honored,\n // collapsed to a boolean), so the call above never flags it. A\n // specific requested type — anything but \"none\" (handled) or\n // \"default\" (not a specific request) — is a separate, narrower\n // complaint, forced through the same verdict lookup and the same\n // once-per-navigator-per-key dedupe with an empty supported set.\n if (\n animation !== undefined &&\n animation !== \"none\" &&\n animation !== \"default\"\n ) {\n warnIgnoredOptions(\"createStackNavigator\", { animation }, new Set())\n }\n }\n }\n }, [state, descriptors])\n\n useEffect(() => {\n if (\n process.env.NODE_ENV !== \"production\" &&\n getActiveChrome() === \"system\"\n ) {\n console.warn(\n '[react-native-gtkx/navigation] the app runs with the default window chrome — pages bring their own HeaderBars, so you will see a doubled titlebar. Pass chrome: \"content\" to AppRegistry.runApplication.',\n )\n }\n }, [])\n\n // `navigation` is identity-stable across renders (react-navigation builder\n // contract) and getState() always reads the live state — no ref needed.\n const handlePopped = (tag: string): void => {\n if (navigation.getState().routes.some((route) => route.key === tag)) {\n // Still in state, so the WIDGET popped on its own: follow in state.\n navigation.dispatch(StackActions.pop())\n }\n // Otherwise state dropped the route first and the primitive is merely\n // reporting the animation we asked for. Nothing to do.\n }\n\n // transitionStart/transitionEnd: translates NavigationStack's primitive\n // callbacks into react-navigation's own per-route events, matching\n // @react-navigation/stack and @react-navigation/native-stack's v8\n // behavior byte for byte (verified against their source, not docs — see\n // 007.md): a route that just became visible fires `closing: false`, a\n // route that just left the visible stack fires `closing: true`, and a\n // route whose visibility did not change (e.g. covered by a push) gets\n // neither event.\n //\n // The start and end sides deliberately use TWO DIFFERENT primitive\n // signals, not the same onTransitionStart/onTransitionEnd pair for both:\n //\n // - transitionStart (both directions) rides onTransitionStart, a\n // view-level \"a transition just began\" signal with no per-route\n // identity — the adapter supplies that identity itself by diffing\n // visibleKeys against the previous render's visible keys.\n // - transitionEnd for an OPENING route also rides the view-level\n // onTransitionEnd, itself driven by the pushed page's own real \"shown\"\n // signal (transitionDuration only as a fallback — see docs/api.md and\n // the primitive's beginTransition): the pushed screen stays mounted\n // indefinitely once it is the active page, so nothing about that is\n // unsafe here either way.\n // - transitionEnd for a CLOSING route rides onPageClosed instead, fired\n // PER TAG when that page's exit actually finishes (a real GTK\n // \"hidden\" signal when available, the primitive's own timer as\n // fallback). This was not a style choice: routing the closing side\n // through the generic view-level timer was tried first and is wrong\n // whenever the real close finishes before the fixed transitionDuration\n // default (guaranteed in headless test environments with animations\n // disabled, and possible on a real desktop too) — the closing screen's\n // React component has already unmounted (and unsubscribed its\n // listeners) by the time the generic, one-size-fits-all timer gets\n // around to firing, so the event never reaches anyone. onPageClosed\n // fires synchronously before React commits that unmount, so the\n // listener is still there to receive it.\n //\n // previousVisibleKeysRef is compared by CONTENT, not a call-count flag:\n // NavigationStack's sync effect can call beginTransition() (hence\n // onTransitionStart) more than once for one state update — e.g. popping\n // back past two routes and pushing two new ones in the same dispatch\n // calls it three times — and every one of those calls closes over the\n // SAME visibleKeys for this render. Diffing against the ref and only\n // then updating it makes every call after the first a no-op (the ref\n // already equals visibleKeys), without a manual \"already handling a\n // transition\" flag that would also incorrectly swallow a second,\n // genuinely separate transition starting before the first one settles.\n const previousVisibleKeysRef = useRef<string[]>(visibleKeys)\n const pendingOpeningEndRef = useRef<string[]>([])\n // Tags this adapter itself put in flight via transitionStart(closing:\n // true) — NOT every tag onPageClosed ever reports. A native pop (back\n // button, Escape, back gesture) also eventually drops its tag through\n // the exact same primitive mechanism, but never called beginTransition()\n // (see the primitive: a native pop's own handlePopped reconciles\n // syncedRef directly, so the sync effect finds nothing left to push or\n // pop once react-navigation's state catches up) — so it never got a\n // transitionStart either. Without this guard, handlePageClosed would\n // emit a transitionEnd with no matching transitionStart for every native\n // pop, which is worse than emitting neither: a listener would see an\n // end event out of nowhere. Documented as Known limitation #2 in 007.md\n // — native pops fire neither event today.\n const pendingClosingRef = useRef<Set<string>>(new Set())\n\n const emitTransitionEvent = (\n type: \"transitionStart\" | \"transitionEnd\",\n keys: readonly string[],\n closing: boolean,\n ): void => {\n for (const key of keys) {\n navigation.emit({ type, data: { closing }, target: key })\n }\n }\n\n const handleTransitionStart = (): void => {\n const previous = previousVisibleKeysRef.current\n if (\n previous.length === visibleKeys.length &&\n previous.every((key, index) => key === visibleKeys[index])\n ) {\n // A duplicate beginTransition() call for the same commit (see\n // above) — already diffed by an earlier call this render.\n return\n }\n const opening = visibleKeys.filter((key) => !previous.includes(key))\n const closing = previous.filter((key) => !visibleKeys.includes(key))\n previousVisibleKeysRef.current = visibleKeys\n pendingOpeningEndRef.current.push(...opening)\n for (const key of closing) {\n pendingClosingRef.current.add(key)\n }\n emitTransitionEvent(\"transitionStart\", opening, false)\n emitTransitionEvent(\"transitionStart\", closing, true)\n }\n\n // Drains whatever opening keys are pending rather than trusting call\n // count, for the same reason handleTransitionStart diffs by content: a\n // compound update's several onTransitionEnd calls (one per\n // beginTransition() above) all land at essentially the same moment, so\n // the first one emits everything queued and the rest find nothing left\n // to drain. Closing keys are NOT handled here — see handlePageClosed.\n const handleTransitionEnd = (): void => {\n const opening = pendingOpeningEndRef.current\n if (opening.length === 0) {\n return\n }\n pendingOpeningEndRef.current = []\n emitTransitionEvent(\"transitionEnd\", opening, false)\n }\n\n const handlePageClosed = (tag: string): void => {\n if (!pendingClosingRef.current.has(tag)) {\n // Not a tag this adapter put in flight (a native pop, or a stray\n // call) — no transitionStart was ever emitted for it, so no\n // transitionEnd either.\n return\n }\n pendingClosingRef.current.delete(tag)\n navigation.emit({\n type: \"transitionEnd\",\n data: { closing: true },\n target: tag,\n })\n }\n\n return (\n <NavigationContent>\n <StackView\n routeKeys={visibleKeys}\n descriptors={descriptors}\n animateTransitions={animateTransitions}\n onPopped={handlePopped}\n onTransitionStart={handleTransitionStart}\n onTransitionEnd={handleTransitionEnd}\n onPageClosed={handlePageClosed}\n />\n </NavigationContent>\n )\n}\n\ntype StackViewProps = {\n routeKeys: string[]\n descriptors: Record<string, unknown>\n animateTransitions: boolean\n onPopped: (tag: string) => void\n onTransitionStart: () => void\n onTransitionEnd: () => void\n onPageClosed: (tag: string) => void\n}\n\n// The page list lives inside NavigationContent so it can read the\n// prevent-remove context (which useNavigationBuilder only provides to\n// NavigationContent's children). A page whose route is prevented — or whose\n// screen set gestureEnabled: false — reports canPop: false, so Adwaita\n// disables the back button, Escape and the back gesture for it; a\n// programmatic goBack still pops (once the app lifts the prevention, e.g.\n// after its own confirmation dialog). This is why a native pop can never\n// race react-navigation state for these routes.\nconst StackView = ({\n routeKeys,\n descriptors,\n animateTransitions,\n onPopped,\n onTransitionStart,\n onTransitionEnd,\n onPageClosed,\n}: StackViewProps) => {\n const { preventedRoutes } = usePreventRemoveContext()\n return (\n <NavigationStack\n stack={routeKeys}\n animateTransitions={animateTransitions}\n onPopped={onPopped}\n onTransitionStart={onTransitionStart}\n onTransitionEnd={onTransitionEnd}\n onPageClosed={onPageClosed}\n >\n {routeKeys.map((key) => {\n const descriptor = descriptors[key] as StackDescriptor | undefined\n if (!descriptor) {\n return null\n }\n const options = descriptor.options\n const headerShown = options.headerShown ?? true\n const canPop =\n options.gestureEnabled !== false &&\n !preventedRoutes[key]?.preventRemove\n const content = <SlotContent>{descriptor.render()}</SlotContent>\n return (\n <NavigationStackPage\n key={key}\n tag={key}\n // Never the route key — that is an internal identifier, and it\n // would end up in the window title under content chrome.\n title={options.title ?? descriptor.route.name}\n canPop={canPop}\n >\n {headerShown ? (\n <AdwToolbarView\n topBar={\n <AdwHeaderBar\n start={\n options.headerLeft ? (\n <HeaderSlotContent>\n {options.headerLeft()}\n </HeaderSlotContent>\n ) : undefined\n }\n end={[\n ...(options.headerRight\n ? [\n <HeaderSlotContent key=\"header-right\">\n {options.headerRight()}\n </HeaderSlotContent>,\n ]\n : []),\n ...(options.headerButtons?.map((button) => (\n <GtkButton\n key={button.id}\n iconName={button.icon}\n tooltipText={button.tooltip}\n onClicked={button.onPress}\n />\n )) ?? []),\n ]}\n />\n }\n >\n {content}\n </AdwToolbarView>\n ) : (\n content\n )}\n </NavigationStackPage>\n )\n })}\n </NavigationStack>\n )\n}\n\nexport {\n createSidebarNavigator,\n type HeaderButton,\n type SidebarNavigationEventMap,\n type SidebarNavigationHelpers,\n type SidebarNavigationOptions,\n type SidebarScreenConfig,\n type SidebarScreenProps,\n type TypedSidebarNavigator,\n} from \"./sidebar\"\n\n// BREAKING CHANGE: this file used to re-export CommonActions,\n// NavigationContainer, StackActions, useFocusEffect, useIsFocused,\n// useNavigation, useNavigationContainerRef, usePreventRemove and useRoute\n// from @react-navigation/native, so an app could import the whole surface\n// from one place. Removed: the set was never complete (apps still had to\n// go to @react-navigation/native directly for anything else — dispatch\n// helpers, linking types, the rest of the hooks), so re-exporting a subset\n// was only a second place to look, not a convenience. Import these names\n// from @react-navigation/native directly; this package exports only what\n// is genuinely its own (createStackNavigator, createSidebarNavigator, and\n// the option/prop types around them).\n\n// ---- typed factory --------------------------------------------------------\n// React Navigation 8 ships a genuinely generic createNavigatorFactory\n// (NavigatorTypeBagBase + createNavigatorFactory<TypeBag>) — the manual\n// `stackFactory() as TypedStackNavigator<ParamList>` cast this file used to\n// need (upstream's factory returned `any`) is gone. The type bag below\n// wires our own state/options/navigator shape into their factory, so\n// Stack.Navigator and Stack.Screen come out correctly typed — including\n// catching a typo'd screen name or a mismatched param type at the JSX call\n// site, which the old cast could not. Runtime is unchanged either way:\n// createNavigatorFactory(Navigator) has always just returned\n// `{ Navigator, Screen, Group }` (Screen/Group are no-op marker\n// components); only the TYPES improved.\n\nexport type StackNavigationHelpers<\n ParamList extends ParamListBase = ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n> = NavigationProp<\n ParamList,\n RouteName,\n StackNavigationState<ParamList>,\n StackNavigationOptions,\n StackNavigationEventMap\n>\n\nexport type StackScreenProps<\n ParamList extends ParamListBase = ParamListBase,\n RouteName extends keyof ParamList = keyof ParamList,\n> = {\n route: RouteProp<ParamList, RouteName>\n navigation: StackNavigationHelpers<ParamList, RouteName>\n}\n\nexport type StackScreenConfig<\n ParamList extends ParamListBase,\n RouteName extends keyof ParamList,\n> = {\n name: RouteName\n component: ComponentType<StackScreenProps<ParamList, RouteName>>\n options?:\n | StackNavigationOptions\n | ((\n props: StackScreenProps<ParamList, RouteName>,\n ) => StackNavigationOptions)\n initialParams?: Partial<ParamList[RouteName]>\n}\n\ninterface StackTypeBag extends NavigatorTypeBagBase {\n ParamList: ParamListBase\n State: StackNavigationState<ParamListBase>\n ScreenOptions: StackNavigationOptions\n EventMap: StackNavigationEventMap\n ActionHelpers: Record<string, () => void>\n Navigator: typeof StackNavigator\n}\n\nconst stackFactory = createNavigatorFactory<StackTypeBag>(StackNavigator)\n\n// The explicit return type is built from TypedNavigator + NavigatorTypeBagFor\n// (both public exports) rather than `ReturnType<typeof stackFactory<ParamList>>`\n// for two reasons found empirically:\n// - `TypedNavigatorFactory` has two overloaded call signatures (dynamic\n// Navigator/Screen vs. static config). Resolving\n// `typeof stackFactory<ParamList>` as a bare instantiation expression\n// (as opposed to an actual call) picks the wrong one — the static-config\n// overload — even though calling `stackFactory<ParamList>()` for real\n// resolves correctly.\n// - Declaration emit (`tsc -p tsconfig.build.json`, i.e. `build:dist`)\n// additionally rejects an inferred-only return type here with\n// TS2742 (\"cannot be named without a reference to .../utilities\"),\n// because it transitively touches a type `@react-navigation/core`\n// does not export from its public entry point. Naming the return type\n// through the two types this package DOES export sidesteps both.\nexport type TypedStackNavigator<ParamList extends ParamListBase> =\n TypedNavigator<NavigatorTypeBagFor<StackTypeBag, ParamList>, undefined>\n\nexport const createStackNavigator = <\n ParamList extends ParamListBase = ParamListBase,\n>(): TypedStackNavigator<ParamList> => stackFactory<ParamList>()\n"]}
|
|
@@ -20,7 +20,9 @@ const VERDICTS = {
|
|
|
20
20
|
headerLargeTitle: "no large-title idiom on this desktop",
|
|
21
21
|
headerBlurEffect: "no blur idiom on this desktop",
|
|
22
22
|
presentation: 'only "card" exists today; "modal" is planned on Adw.Dialog',
|
|
23
|
-
animation:
|
|
23
|
+
animation: "GTK has a single transition style — the requested type is ignored " +
|
|
24
|
+
'and the standard Adwaita transition plays regardless; "none" does ' +
|
|
25
|
+
"disable it entirely, if that is what you want",
|
|
24
26
|
animationDuration: "transitions are Adwaita's own",
|
|
25
27
|
animationTypeForReplace: "transitions are Adwaita's own",
|
|
26
28
|
gestureDirection: "the platform defines gesture directions",
|
|
@@ -32,7 +34,13 @@ const VERDICTS = {
|
|
|
32
34
|
navigationBarHidden: "no Android navigation bar on desktop",
|
|
33
35
|
orientation: "window orientation is the compositor's business",
|
|
34
36
|
autoHideHomeIndicator: "no home indicator on desktop",
|
|
37
|
+
// detachInactiveScreens/freezeOnBlur (native-stack v7) collapsed into
|
|
38
|
+
// inactiveBehavior (v8, 'pause' | 'unmount' | 'none'). All three are
|
|
39
|
+
// flagged the same way: our stack always keeps pushed pages mounted —
|
|
40
|
+
// there is no unmount/freeze knob to offer.
|
|
41
|
+
detachInactiveScreens: "screens below the stack top already stay mounted",
|
|
35
42
|
freezeOnBlur: "screens below the stack top already stay mounted",
|
|
43
|
+
inactiveBehavior: "screens below the stack top already stay mounted; there is no unmount/freeze knob",
|
|
36
44
|
contentStyle: "style a wrapper View inside the screen instead",
|
|
37
45
|
};
|
|
38
46
|
const warned = new Set();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"option-warnings.js","sourceRoot":"","sources":["../../src/navigation/option-warnings.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,wEAAwE;AACxE,yEAAyE;AACzE,2DAA2D;AAC3D,MAAM,QAAQ,GAA2B;IACvC,MAAM,EAAE,8CAA8C;IACtD,WAAW,EACT,gEAAgE;QAChE,aAAa;IACf,WAAW,EAAE,0DAA0D;IACvE,eAAe,EAAE,0DAA0D;IAC3E,gBAAgB,EAAE,0DAA0D;IAC5E,iBAAiB,EAAE,2CAA2C;IAC9D,mBAAmB,EAAE,2CAA2C;IAChE,sBAAsB,EAAE,0BAA0B;IAClD,iBAAiB,EAAE,wCAAwC;IAC3D,eAAe,EAAE,2CAA2C;IAC5D,2BAA2B,EAAE,2CAA2C;IACxE,2BAA2B,EACzB,+DAA+D;IACjE,gBAAgB,EAAE,sCAAsC;IACxD,gBAAgB,EAAE,+BAA+B;IACjD,YAAY,EAAE,4DAA4D;IAC1E,SAAS,
|
|
1
|
+
{"version":3,"file":"option-warnings.js","sourceRoot":"","sources":["../../src/navigation/option-warnings.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,6EAA6E;AAC7E,wEAAwE;AACxE,yEAAyE;AACzE,2DAA2D;AAC3D,MAAM,QAAQ,GAA2B;IACvC,MAAM,EAAE,8CAA8C;IACtD,WAAW,EACT,gEAAgE;QAChE,aAAa;IACf,WAAW,EAAE,0DAA0D;IACvE,eAAe,EAAE,0DAA0D;IAC3E,gBAAgB,EAAE,0DAA0D;IAC5E,iBAAiB,EAAE,2CAA2C;IAC9D,mBAAmB,EAAE,2CAA2C;IAChE,sBAAsB,EAAE,0BAA0B;IAClD,iBAAiB,EAAE,wCAAwC;IAC3D,eAAe,EAAE,2CAA2C;IAC5D,2BAA2B,EAAE,2CAA2C;IACxE,2BAA2B,EACzB,+DAA+D;IACjE,gBAAgB,EAAE,sCAAsC;IACxD,gBAAgB,EAAE,+BAA+B;IACjD,YAAY,EAAE,4DAA4D;IAC1E,SAAS,EACP,oEAAoE;QACpE,oEAAoE;QACpE,+CAA+C;IACjD,iBAAiB,EAAE,+BAA+B;IAClD,uBAAuB,EAAE,+BAA+B;IACxD,gBAAgB,EAAE,yCAAyC;IAC3D,wBAAwB,EAAE,+BAA+B;IACzD,cAAc,EAAE,0BAA0B;IAC1C,eAAe,EAAE,0BAA0B;IAC3C,kBAAkB,EAAE,0BAA0B;IAC9C,kBAAkB,EAAE,sCAAsC;IAC1D,mBAAmB,EAAE,sCAAsC;IAC3D,WAAW,EAAE,iDAAiD;IAC9D,qBAAqB,EAAE,8BAA8B;IACrD,sEAAsE;IACtE,qEAAqE;IACrE,sEAAsE;IACtE,4CAA4C;IAC5C,qBAAqB,EAAE,kDAAkD;IACzE,YAAY,EAAE,kDAAkD;IAChE,gBAAgB,EACd,mFAAmF;IACrF,YAAY,EAAE,gDAAgD;CAC/D,CAAA;AAED,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAA;AAEhC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,SAAiB,EACjB,OAAgC,EAChC,SAA8B,EACxB,EAAE;IACR,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC1C,OAAM;IACR,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,SAAQ;QACV,CAAC;QACD,MAAM,MAAM,GAAG,GAAG,SAAS,IAAI,GAAG,EAAE,CAAA;QACpC,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,SAAQ;QACV,CAAC;QACD,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAClB,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,iCAAiC,CAAA;QAClE,OAAO,CAAC,IAAI,CACV,kCAAkC,SAAS,sBAAsB;YAC/D,WAAW,GAAG,OAAO,OAAO,GAAG,CAClC,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAED,sDAAsD;AACtD,MAAM,CAAC,MAAM,0BAA0B,GAAG,GAAS,EAAE;IACnD,MAAM,CAAC,KAAK,EAAE,CAAA;AAChB,CAAC,CAAA","sourcesContent":["// Dev-mode guidance for silently ignored screen options: react-navigation's\n// factory is untyped upstream, so neither TS nor the runtime would otherwise\n// say a word when a ported app sets `presentation: \"modal\"` and nothing\n// happens. Each unknown key warns ONCE per navigator kind with an honest\n// verdict (see docs/research/navigation-extensibility.md).\nconst VERDICTS: Record<string, string> = {\n header: \"full header replacement is not supported yet\",\n headerTitle:\n \"string titles map to `title`; a component title-widget is not \" +\n \"exposed yet\",\n headerStyle: \"Adwaita's theme owns the chrome styling on this platform\",\n headerTintColor: \"Adwaita's theme owns the chrome styling on this platform\",\n headerTitleStyle: \"Adwaita's theme owns the chrome styling on this platform\",\n headerTransparent: \"planned on AdwToolbarView's top-bar-style\",\n headerShadowVisible: \"planned on AdwToolbarView's top-bar-style\",\n headerSearchBarOptions: \"planned on Gtk.SearchBar\",\n headerBackVisible: \"planned on AdwNavigationPage's can-pop\",\n headerBackTitle: \"the GNOME back button is icon-only by HIG\",\n headerBackButtonDisplayMode: \"the GNOME back button is icon-only by HIG\",\n headerBackButtonMenuEnabled:\n \"the Adwaita back button already shows a history menu natively\",\n headerLargeTitle: \"no large-title idiom on this desktop\",\n headerBlurEffect: \"no blur idiom on this desktop\",\n presentation: 'only \"card\" exists today; \"modal\" is planned on Adw.Dialog',\n animation:\n \"GTK has a single transition style — the requested type is ignored \" +\n 'and the standard Adwaita transition plays regardless; \"none\" does ' +\n \"disable it entirely, if that is what you want\",\n animationDuration: \"transitions are Adwaita's own\",\n animationTypeForReplace: \"transitions are Adwaita's own\",\n gestureDirection: \"the platform defines gesture directions\",\n fullScreenGestureEnabled: \"the platform defines gestures\",\n statusBarStyle: \"no status bar on desktop\",\n statusBarHidden: \"no status bar on desktop\",\n statusBarAnimation: \"no status bar on desktop\",\n navigationBarColor: \"no Android navigation bar on desktop\",\n navigationBarHidden: \"no Android navigation bar on desktop\",\n orientation: \"window orientation is the compositor's business\",\n autoHideHomeIndicator: \"no home indicator on desktop\",\n // detachInactiveScreens/freezeOnBlur (native-stack v7) collapsed into\n // inactiveBehavior (v8, 'pause' | 'unmount' | 'none'). All three are\n // flagged the same way: our stack always keeps pushed pages mounted —\n // there is no unmount/freeze knob to offer.\n detachInactiveScreens: \"screens below the stack top already stay mounted\",\n freezeOnBlur: \"screens below the stack top already stay mounted\",\n inactiveBehavior:\n \"screens below the stack top already stay mounted; there is no unmount/freeze knob\",\n contentStyle: \"style a wrapper View inside the screen instead\",\n}\n\nconst warned = new Set<string>()\n\nexport const warnIgnoredOptions = (\n navigator: string,\n options: Record<string, unknown>,\n supported: ReadonlySet<string>,\n): void => {\n if (process.env.NODE_ENV === \"production\") {\n return\n }\n for (const key of Object.keys(options)) {\n if (supported.has(key)) {\n continue\n }\n const dedupe = `${navigator}:${key}`\n if (warned.has(dedupe)) {\n continue\n }\n warned.add(dedupe)\n const verdict = VERDICTS[key] ?? \"not supported by this navigator\"\n console.warn(\n `[react-native-gtkx/navigation] ${navigator} ignores the screen ` +\n `option \"${key}\" — ${verdict}.`,\n )\n }\n}\n\n// Test hook: warnings are once-per-process by design.\nexport const resetIgnoredOptionWarnings = (): void => {\n warned.clear()\n}\n"]}
|
|
@@ -1,8 +1,73 @@
|
|
|
1
|
-
import { type NavigationProp, type ParamListBase, type RouteProp, type TabNavigationState } from "@react-navigation/native";
|
|
1
|
+
import { type NavigationProp, type NavigatorTypeBagBase, type NavigatorTypeBagFor, type ParamListBase, type RouteProp, type TabNavigationState, type TypedNavigator } from "@react-navigation/native";
|
|
2
2
|
import { type ComponentType, type ReactNode } from "react";
|
|
3
3
|
export type SidebarNavigationOptions = {
|
|
4
|
-
/** Sidebar row and content
|
|
4
|
+
/** Sidebar row and content AdwHeaderBar title; defaults to the route name. */
|
|
5
5
|
title?: string;
|
|
6
|
+
/** Adwaita symbolic icon name for the sidebar row's prefix (e.g.
|
|
7
|
+
* "view-list-symbolic"). Ignored when `color` is also set — a row shows
|
|
8
|
+
* a colored dot OR an icon, never both (the same rule tasks-app's own
|
|
9
|
+
* hand-rolled sidebar followed). */
|
|
10
|
+
icon?: string;
|
|
11
|
+
/** A CSS color for a colored dot prefix, replacing `icon` on this row —
|
|
12
|
+
* the way a user-created list is told apart from a smart view. */
|
|
13
|
+
color?: string;
|
|
14
|
+
/** Badge shown as the row's suffix. Hidden when 0 or undefined — an
|
|
15
|
+
* empty view shows no badge, not a "0". */
|
|
16
|
+
count?: number;
|
|
17
|
+
/** RN content packed at the start of the CONTENT AdwHeaderBar (an
|
|
18
|
+
* intrinsic-size root, same contract as the stack navigator's
|
|
19
|
+
* `headerLeft`) — a back button for an in-place "item open" state, a
|
|
20
|
+
* "New" action, anything that changes with THIS screen's selection.
|
|
21
|
+
* Call `navigation.setOptions({ headerLeft: … })` from the screen to
|
|
22
|
+
* change it as its own internal state changes — no stack involved. */
|
|
23
|
+
headerLeft?: () => ReactNode;
|
|
24
|
+
/** RN content packed at the end of the content AdwHeaderBar, before
|
|
25
|
+
* `headerButtons`. Same contract as `headerLeft`. */
|
|
26
|
+
headerRight?: () => ReactNode;
|
|
27
|
+
/** Replaces the content AdwHeaderBar's title widget for this screen —
|
|
28
|
+
* a filter toggle group, an editable title plus a star toggle,
|
|
29
|
+
* anything a plain string `title` cannot express. Left unset, the
|
|
30
|
+
* HeaderBar shows the page's own title automatically (unchanged
|
|
31
|
+
* default behavior). */
|
|
32
|
+
headerTitle?: () => ReactNode;
|
|
33
|
+
/** How this screen's body is mounted into the content page.
|
|
34
|
+
*
|
|
35
|
+
* - `"react-native"` (default): the body is a React Native tree, so it
|
|
36
|
+
* gets a Yoga layout root that fills the pane — `<View style={{ flex: 1 }}>`
|
|
37
|
+
* and friends behave exactly as they do anywhere else.
|
|
38
|
+
* - `"widget"`: the body IS a GTK widget tree (a `GtkScrolledWindow`
|
|
39
|
+
* around a `.boxed-list` `GtkListBox`, say) and is packed into the page
|
|
40
|
+
* directly, with no layout root in between. GTK's own sizing —
|
|
41
|
+
* `vexpand`, `AdwClamp`, a list's natural height — then works normally.
|
|
42
|
+
* Under the default a widget tree collapses instead: every widget
|
|
43
|
+
* becomes a single Yoga LEAF measured for its own natural size, so a
|
|
44
|
+
* scrolled window reports the ~1px it can shrink to and the pane comes
|
|
45
|
+
* up empty. `examples/tasks-nav` is built this way.
|
|
46
|
+
*
|
|
47
|
+
* Mixing is per SCREEN, not per subtree: a `"widget"` screen that wants
|
|
48
|
+
* React Native content somewhere inside it wraps that part in
|
|
49
|
+
* `SlotContent` (or `IntrinsicContent`) itself. */
|
|
50
|
+
contentLayout?: "react-native" | "widget";
|
|
51
|
+
/** Renders this screen's sidebar row yourself, instead of letting
|
|
52
|
+
* `title`/`icon`/`color`/`count` compose one.
|
|
53
|
+
*
|
|
54
|
+
* Those four are a convenience, not the ceiling. They compose an
|
|
55
|
+
* `AdwActionRow`, which brings Adwaita's own row metrics with it — so
|
|
56
|
+
* an app wanting a different shape, a different density, or simply a
|
|
57
|
+
* row height of its own had nothing to reach for, and every app paid
|
|
58
|
+
* for the richest case whether it used it or not. This is that reach:
|
|
59
|
+
* return anything a `GtkListBoxRow` can hold — React Native content,
|
|
60
|
+
* GTK widgets, a differently-configured Adwaita row.
|
|
61
|
+
*
|
|
62
|
+
* The navigator still owns row BEHAVIOUR — selection, click →
|
|
63
|
+
* `jumpTo`, keeping the list in step with navigation state, the
|
|
64
|
+
* collapsed reveal — so a custom row cannot fall out of sync with the
|
|
65
|
+
* router. Only what is drawn changes. */
|
|
66
|
+
sidebarRow?: () => ReactNode;
|
|
67
|
+
/** Overrides the navigator-level `headerButtons` prop for this screen
|
|
68
|
+
* specifically (replaces it entirely when set, same as the stack
|
|
69
|
+
* navigator's per-screen option override). */
|
|
70
|
+
headerButtons?: HeaderButton[];
|
|
6
71
|
};
|
|
7
72
|
export type HeaderButton = {
|
|
8
73
|
id: string;
|
|
@@ -10,18 +75,146 @@ export type HeaderButton = {
|
|
|
10
75
|
tooltip?: string;
|
|
11
76
|
onPress: () => void;
|
|
12
77
|
};
|
|
78
|
+
export type SidebarNavigationEventMap = {
|
|
79
|
+
/**
|
|
80
|
+
* The split view's own back affordance (back button, Escape, the back
|
|
81
|
+
* gesture) hid the content pane while collapsed, returning to the
|
|
82
|
+
* sidebar — `AdwNavigationSplitView`'s `showContent` going false, the
|
|
83
|
+
* counterpart to the stack navigator's native pop. Unlike a stack pop,
|
|
84
|
+
* TabRouter's state does NOT change: nothing was removed, the same route
|
|
85
|
+
* stays focused, only the pane did. Fired on the currently active route,
|
|
86
|
+
* so an app that wants to react — e.g. resetting an in-screen "item
|
|
87
|
+
* open" state that only makes sense while content is visible, the way
|
|
88
|
+
* `examples/tasks-nav`'s `ContentScreen` does — can listen without
|
|
89
|
+
* polling the split view itself.
|
|
90
|
+
*
|
|
91
|
+
* Never fired when `collapseWidth` is unset (uncollapsed behavior is
|
|
92
|
+
* unchanged), and never fired for content being REVEALED — that
|
|
93
|
+
* direction already shows up as an ordinary state change (the newly
|
|
94
|
+
* focused route re-rendering), so it needs no event of its own. See
|
|
95
|
+
* docs/research/navigation-extensibility.md for why no event exists for
|
|
96
|
+
* the forward direction.
|
|
97
|
+
*/
|
|
98
|
+
sidebarShown: {
|
|
99
|
+
data: undefined;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
/** What a custom sidebar needs to be able to navigate — the routing
|
|
103
|
+
* surface the composed list uses internally, handed over so a replacement
|
|
104
|
+
* is a real sidebar and not a decoration that cannot select anything. */
|
|
105
|
+
export type SidebarContentProps = {
|
|
106
|
+
/** Every screen, in declaration order, with its resolved options. */
|
|
107
|
+
routes: {
|
|
108
|
+
key: string;
|
|
109
|
+
name: string;
|
|
110
|
+
options: SidebarNavigationOptions;
|
|
111
|
+
/** Resolved title: `options.title`, falling back to the route name. */
|
|
112
|
+
title: string;
|
|
113
|
+
/** Whether this route is the one currently showing in the content pane. */
|
|
114
|
+
focused: boolean;
|
|
115
|
+
}[];
|
|
116
|
+
/** Index of the focused route in `routes`. */
|
|
117
|
+
focusedIndex: number;
|
|
118
|
+
/** Focus a route by name — the same dispatch a sidebar row click makes,
|
|
119
|
+
* including revealing the content pane when collapsed. */
|
|
120
|
+
jumpTo: (name: string) => void;
|
|
121
|
+
};
|
|
13
122
|
type SidebarNavigatorProps = {
|
|
14
123
|
initialRouteName?: string;
|
|
15
124
|
screenOptions?: SidebarNavigationOptions;
|
|
16
|
-
/** Title of the sidebar pane's
|
|
125
|
+
/** Title of the sidebar pane's AdwHeaderBar. */
|
|
17
126
|
sidebarTitle?: string;
|
|
18
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Content packed at the START of the SIDEBAR pane's AdwHeaderBar — the
|
|
129
|
+
* "new item" action a GNOME sidebar puts next to its title, a search
|
|
130
|
+
* toggle, anything the pane's chrome needs.
|
|
131
|
+
*
|
|
132
|
+
* The content header's `headerLeft`/`headerRight`/`headerTitle` are
|
|
133
|
+
* screen OPTIONS because that header changes with the focused screen.
|
|
134
|
+
* The sidebar's does not: one pane, shared by every screen, so its
|
|
135
|
+
* chrome belongs to the navigator — the same level `sidebarTitle` and
|
|
136
|
+
* `sidebarContent` already sit at. Hence the `sidebar` prefix on
|
|
137
|
+
* otherwise identical names.
|
|
138
|
+
*
|
|
139
|
+
* Mounted through the same `HeaderSlotContent` root the content header
|
|
140
|
+
* uses, so a slot of React Native content lays out as a horizontal,
|
|
141
|
+
* content-hugging cluster flush with natively packed buttons.
|
|
142
|
+
*/
|
|
143
|
+
sidebarHeaderLeft?: () => ReactNode;
|
|
144
|
+
/** Content packed at the END of the sidebar AdwHeaderBar — a primary
|
|
145
|
+
* menu, say. Same contract as {@link sidebarHeaderLeft}. */
|
|
146
|
+
sidebarHeaderRight?: () => ReactNode;
|
|
147
|
+
/**
|
|
148
|
+
* Replaces the sidebar AdwHeaderBar's title WIDGET — a search entry, a
|
|
149
|
+
* switcher, anything the plain `sidebarTitle` string cannot express.
|
|
150
|
+
*
|
|
151
|
+
* `sidebarTitle` sets the pane's `AdwNavigationPage` title, which the
|
|
152
|
+
* HeaderBar renders by default; this overrides what is drawn there,
|
|
153
|
+
* exactly as a screen's `headerTitle` overrides its page `title`. Left
|
|
154
|
+
* unset, `sidebarTitle` shows as before.
|
|
155
|
+
*/
|
|
156
|
+
sidebarHeaderTitle?: () => ReactNode;
|
|
157
|
+
/** Buttons packed at the end of the content AdwHeaderBar. */
|
|
19
158
|
headerButtons?: HeaderButton[];
|
|
159
|
+
/**
|
|
160
|
+
* Width (sp) below which the split view collapses to the sidebar or the
|
|
161
|
+
* content pane alone, driven by a native `Adw.Breakpoint` — NOT a
|
|
162
|
+
* `useWindowDimensions` check (see docs/platform-layer.md, "Two ways to
|
|
163
|
+
* react to size"). The property flip happens inside GTK's own allocation
|
|
164
|
+
* pass, with no React render for the resize itself. Unset by default: no
|
|
165
|
+
* `AdwBreakpointBin` is mounted at all, so existing consumers
|
|
166
|
+
* (`examples/gallery`) see no behavior change.
|
|
167
|
+
*/
|
|
168
|
+
collapseWidth?: number;
|
|
169
|
+
/**
|
|
170
|
+
* The narrowest width (px) this navigator's UI supports, applied to the
|
|
171
|
+
* `AdwBreakpointBin` `collapseWidth` mounts. Ignored when `collapseWidth`
|
|
172
|
+
* is unset, since no bin exists then.
|
|
173
|
+
*
|
|
174
|
+
* Adwaita cannot measure a breakpoint bin: what it contains changes with
|
|
175
|
+
* the breakpoints, so the bin reports a minimum of ZERO and warns
|
|
176
|
+
* ("AdwBreakpointBin does not have a minimum size, set the
|
|
177
|
+
* 'width-request' and 'height-request' properties to specify it"). With
|
|
178
|
+
* no minimum the window can be dragged narrower than the pane inside it
|
|
179
|
+
* can render, and Adwaita then over-allocates and CLIPS the pane rather
|
|
180
|
+
* than adapting it — visible as a task list running off the right edge
|
|
181
|
+
* and, in the journal, as "AdwNavigationSplitView exceeds
|
|
182
|
+
* AdwBreakpointBin width: requested 469 px, 360 px available".
|
|
183
|
+
*
|
|
184
|
+
* The default is GNOME's own adaptive floor. An app whose content
|
|
185
|
+
* HeaderBar needs more than that (a segmented control as `headerTitle`
|
|
186
|
+
* costs ~110px on its own) must say so — measure the pane, don't guess:
|
|
187
|
+
* the number is the width below which its own chrome stops fitting.
|
|
188
|
+
*/
|
|
189
|
+
minWidth?: number;
|
|
190
|
+
/** Height counterpart of {@link minWidth}, same reasoning. */
|
|
191
|
+
minHeight?: number;
|
|
192
|
+
/**
|
|
193
|
+
* Replaces the ENTIRE sidebar pane's body — for a sidebar that needs
|
|
194
|
+
* sections, a search field, a footer, or anything a flat list of rows
|
|
195
|
+
* cannot express.
|
|
196
|
+
*
|
|
197
|
+
* The rung below this is `sidebarRow` (a screen option), which keeps the
|
|
198
|
+
* navigator's list and replaces one row; reach for that first. This one
|
|
199
|
+
* hands over the whole pane, so it also hands over the routing: use the
|
|
200
|
+
* {@link SidebarContentProps} passed in rather than trying to dispatch
|
|
201
|
+
* yourself, and selection stays consistent with navigation state.
|
|
202
|
+
*
|
|
203
|
+
* The pane's AdwHeaderBar (and `sidebarTitle`) still belong to the
|
|
204
|
+
* navigator — this is the body under it, not the chrome.
|
|
205
|
+
*
|
|
206
|
+
* Mounted as React Native content (a layout root filling the pane). A
|
|
207
|
+
* sidebar built from GTK widgets wraps its own tree in `WidgetContent`,
|
|
208
|
+
* the same escape hatch `contentLayout: "widget"` is for a screen body.
|
|
209
|
+
*/
|
|
210
|
+
sidebarContent?: (props: SidebarContentProps) => ReactNode;
|
|
20
211
|
children: ReactNode;
|
|
21
212
|
};
|
|
213
|
+
declare const SidebarNavigator: ({ initialRouteName, screenOptions, sidebarTitle, sidebarHeaderLeft, sidebarHeaderRight, sidebarHeaderTitle, headerButtons, collapseWidth, minWidth, minHeight, sidebarContent, children, }: SidebarNavigatorProps) => React.JSX.Element;
|
|
214
|
+
export type SidebarNavigationHelpers<ParamList extends ParamListBase = ParamListBase, RouteName extends keyof ParamList = keyof ParamList> = NavigationProp<ParamList, RouteName, TabNavigationState<ParamList>, SidebarNavigationOptions, SidebarNavigationEventMap>;
|
|
22
215
|
export type SidebarScreenProps<ParamList extends ParamListBase = ParamListBase, RouteName extends keyof ParamList = keyof ParamList> = {
|
|
23
216
|
route: RouteProp<ParamList, RouteName>;
|
|
24
|
-
navigation:
|
|
217
|
+
navigation: SidebarNavigationHelpers<ParamList, RouteName>;
|
|
25
218
|
};
|
|
26
219
|
export type SidebarScreenConfig<ParamList extends ParamListBase, RouteName extends keyof ParamList> = {
|
|
27
220
|
name: RouteName;
|
|
@@ -29,9 +222,14 @@ export type SidebarScreenConfig<ParamList extends ParamListBase, RouteName exten
|
|
|
29
222
|
options?: SidebarNavigationOptions;
|
|
30
223
|
initialParams?: Partial<ParamList[RouteName]>;
|
|
31
224
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
225
|
+
interface SidebarTypeBag extends NavigatorTypeBagBase {
|
|
226
|
+
ParamList: ParamListBase;
|
|
227
|
+
State: TabNavigationState<ParamListBase>;
|
|
228
|
+
ScreenOptions: SidebarNavigationOptions;
|
|
229
|
+
EventMap: SidebarNavigationEventMap;
|
|
230
|
+
ActionHelpers: Record<string, () => void>;
|
|
231
|
+
Navigator: typeof SidebarNavigator;
|
|
232
|
+
}
|
|
233
|
+
export type TypedSidebarNavigator<ParamList extends ParamListBase> = TypedNavigator<NavigatorTypeBagFor<SidebarTypeBag, ParamList>, undefined>;
|
|
36
234
|
export declare const createSidebarNavigator: <ParamList extends ParamListBase = ParamListBase>() => TypedSidebarNavigator<ParamList>;
|
|
37
235
|
export {};
|