@dxos/plugin-simple-layout 0.8.4-main.bc674ce → 0.8.4-main.c351d160a8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/chunk-2YSUM2L4.mjs +1153 -0
- package/dist/lib/browser/chunk-2YSUM2L4.mjs.map +7 -0
- package/dist/lib/browser/{chunk-P77G4YTR.mjs → chunk-MRR7PXSM.mjs} +5 -5
- package/dist/lib/browser/chunk-MRR7PXSM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -19
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-775UYAC2.mjs → operation-resolver-LV5FK6MN.mjs} +39 -47
- package/dist/lib/browser/operation-resolver-LV5FK6MN.mjs.map +7 -0
- package/dist/lib/browser/{react-root-KM55OMGJ.mjs → react-root-JR6OENXV.mjs} +5 -5
- package/dist/lib/browser/react-root-JR6OENXV.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-BABGAWGY.mjs → react-surface-5JOPIP5Z.mjs} +18 -13
- package/dist/lib/browser/react-surface-5JOPIP5Z.mjs.map +7 -0
- package/dist/lib/browser/{spotlight-dismiss-VSNOPETH.mjs → spotlight-dismiss-67PHYS5B.mjs} +3 -3
- package/dist/lib/browser/spotlight-dismiss-67PHYS5B.mjs.map +7 -0
- package/dist/lib/browser/{state-OUFTC2KV.mjs → state-TXSMUWYI.mjs} +5 -4
- package/dist/lib/browser/state-TXSMUWYI.mjs.map +7 -0
- package/dist/lib/browser/url-handler-RBRONH7S.mjs +151 -0
- package/dist/lib/browser/url-handler-RBRONH7S.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RCQE6FR2.mjs +1154 -0
- package/dist/lib/node-esm/chunk-RCQE6FR2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-F5TEKVJG.mjs → chunk-WMNTJ2MK.mjs} +5 -5
- package/dist/lib/node-esm/chunk-WMNTJ2MK.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +20 -19
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-LDNYS3DI.mjs → operation-resolver-FD3EF2LX.mjs} +39 -47
- package/dist/lib/node-esm/operation-resolver-FD3EF2LX.mjs.map +7 -0
- package/dist/lib/node-esm/{react-root-36UYFEEB.mjs → react-root-CRTCNH3F.mjs} +5 -5
- package/dist/lib/node-esm/react-root-CRTCNH3F.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-CGHFVWU3.mjs → react-surface-NRTDSGFB.mjs} +18 -13
- package/dist/lib/node-esm/react-surface-NRTDSGFB.mjs.map +7 -0
- package/dist/lib/node-esm/{spotlight-dismiss-L5PCWIJG.mjs → spotlight-dismiss-RMLRZUVY.mjs} +3 -3
- package/dist/lib/node-esm/spotlight-dismiss-RMLRZUVY.mjs.map +7 -0
- package/dist/lib/node-esm/{state-Q2ZA26W5.mjs → state-JMX6FAG4.mjs} +5 -4
- package/dist/lib/node-esm/state-JMX6FAG4.mjs.map +7 -0
- package/dist/lib/node-esm/url-handler-QSMCH3JB.mjs +152 -0
- package/dist/lib/node-esm/url-handler-QSMCH3JB.mjs.map +7 -0
- package/dist/types/src/SimpleLayoutPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root/react-root.d.ts +1 -1
- package/dist/types/src/capabilities/react-root/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts +1 -1
- package/dist/types/src/capabilities/spotlight-dismiss/spotlight-dismiss.d.ts.map +1 -1
- package/dist/types/src/capabilities/state/index.d.ts +1 -1
- package/dist/types/src/capabilities/state/state.d.ts +1 -1
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts +5 -3
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/ContentError.stories.d.ts +1 -3
- package/dist/types/src/components/ContentError.stories.d.ts.map +1 -1
- package/dist/types/src/components/ContentLoading/ContentLoading.d.ts.map +1 -0
- package/dist/types/src/components/ContentLoading/ContentLoading.stories.d.ts.map +1 -0
- package/dist/types/src/components/ContentLoading/index.d.ts +2 -0
- package/dist/types/src/components/ContentLoading/index.d.ts.map +1 -0
- package/dist/types/src/components/Home/Home.d.ts.map +1 -1
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts +35 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts +7 -0
- package/dist/types/src/components/MobileLayout/MobileLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/MobileLayout/index.d.ts +2 -0
- package/dist/types/src/components/MobileLayout/index.d.ts.map +1 -0
- package/dist/types/src/components/NavBranch/NavBranch.d.ts +11 -0
- package/dist/types/src/components/NavBranch/NavBranch.d.ts.map +1 -0
- package/dist/types/src/components/NavBranch/index.d.ts +2 -0
- package/dist/types/src/components/NavBranch/index.d.ts.map +1 -0
- package/dist/types/src/components/Popover/Popover.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts +26 -0
- package/dist/types/src/components/SimpleLayout/AppBar.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts +47 -0
- package/dist/types/src/components/SimpleLayout/AppBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts +1 -1
- package/dist/types/src/components/SimpleLayout/Drawer.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/Main.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts +10 -3
- package/dist/types/src/components/SimpleLayout/NavBar.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts +4 -4
- package/dist/types/src/components/SimpleLayout/NavBar.stories.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/SimpleLayout.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/SimpleLayout.stories.d.ts.map +1 -1
- package/dist/types/src/components/SimpleLayout/index.d.ts +3 -0
- package/dist/types/src/components/SimpleLayout/index.d.ts.map +1 -1
- package/dist/types/src/components/hooks.d.ts +4 -2
- package/dist/types/src/components/hooks.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +2 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/actions.d.ts +19 -0
- package/dist/types/src/hooks/actions.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +4 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useAppBarProps.d.ts +7 -0
- package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -0
- package/dist/types/src/hooks/useCompanions.d.ts +5 -1
- package/dist/types/src/hooks/useCompanions.d.ts.map +1 -1
- package/dist/types/src/hooks/useDrawerActions.d.ts +13 -0
- package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useNavbarActions.d.ts +14 -0
- package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -0
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts +3 -3
- package/dist/types/src/hooks/useSimpleLayoutState.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +7 -6
- package/dist/types/src/types/capabilities.d.ts.map +1 -1
- package/dist/types/src/types/events.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +36 -30
- package/src/SimpleLayoutPlugin.ts +10 -9
- package/src/capabilities/operation-resolver/operation-resolver.ts +34 -46
- package/src/capabilities/react-root/react-root.tsx +2 -2
- package/src/capabilities/react-surface/react-surface.tsx +14 -11
- package/src/capabilities/spotlight-dismiss/spotlight-dismiss.ts +2 -2
- package/src/capabilities/state/state.tsx +4 -3
- package/src/capabilities/url-handler/url-handler.ts +98 -45
- package/src/components/ContentError.stories.tsx +8 -7
- package/src/components/{ContentLoading.stories.tsx → ContentLoading/ContentLoading.stories.tsx} +2 -2
- package/src/components/{ContentLoading.tsx → ContentLoading/ContentLoading.tsx} +1 -1
- package/src/components/ContentLoading/index.ts +5 -0
- package/src/components/Dialog/Dialog.tsx +5 -5
- package/src/components/Home/Home.tsx +44 -36
- package/src/components/MobileLayout/MobileLayout.stories.tsx +129 -0
- package/src/components/MobileLayout/MobileLayout.tsx +305 -0
- package/src/components/MobileLayout/index.ts +5 -0
- package/src/components/NavBranch/NavBranch.tsx +133 -0
- package/src/components/{Workspace → NavBranch}/index.ts +1 -1
- package/src/components/Popover/Popover.tsx +7 -7
- package/src/components/SimpleLayout/AppBar.stories.tsx +144 -0
- package/src/components/SimpleLayout/AppBar.tsx +94 -0
- package/src/components/SimpleLayout/Drawer.tsx +25 -80
- package/src/components/SimpleLayout/Main.tsx +40 -30
- package/src/components/SimpleLayout/NavBar.stories.tsx +131 -23
- package/src/components/SimpleLayout/NavBar.tsx +15 -48
- package/src/components/SimpleLayout/SimpleLayout.stories.tsx +20 -11
- package/src/components/SimpleLayout/SimpleLayout.tsx +38 -19
- package/src/components/SimpleLayout/index.ts +3 -0
- package/src/components/hooks.ts +9 -9
- package/src/components/index.ts +2 -1
- package/src/hooks/actions.ts +83 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useAppBarProps.ts +115 -0
- package/src/hooks/useCompanions.ts +8 -5
- package/src/hooks/useDrawerActions.ts +100 -0
- package/src/hooks/useNavbarActions.ts +87 -0
- package/src/hooks/useSimpleLayoutState.ts +5 -5
- package/src/meta.ts +1 -1
- package/src/types/capabilities.ts +11 -7
- package/src/types/events.ts +3 -2
- package/dist/lib/browser/chunk-LR3EE3VB.mjs +0 -789
- package/dist/lib/browser/chunk-LR3EE3VB.mjs.map +0 -7
- package/dist/lib/browser/chunk-P77G4YTR.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-775UYAC2.mjs.map +0 -7
- package/dist/lib/browser/react-root-KM55OMGJ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-BABGAWGY.mjs.map +0 -7
- package/dist/lib/browser/spotlight-dismiss-VSNOPETH.mjs.map +0 -7
- package/dist/lib/browser/state-OUFTC2KV.mjs.map +0 -7
- package/dist/lib/browser/url-handler-DOUFQIAC.mjs +0 -54
- package/dist/lib/browser/url-handler-DOUFQIAC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F5TEKVJG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HB2B3LLG.mjs +0 -790
- package/dist/lib/node-esm/chunk-HB2B3LLG.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-LDNYS3DI.mjs.map +0 -7
- package/dist/lib/node-esm/react-root-36UYFEEB.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-CGHFVWU3.mjs.map +0 -7
- package/dist/lib/node-esm/spotlight-dismiss-L5PCWIJG.mjs.map +0 -7
- package/dist/lib/node-esm/state-Q2ZA26W5.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-DVAZZEUO.mjs +0 -55
- package/dist/lib/node-esm/url-handler-DVAZZEUO.mjs.map +0 -7
- package/dist/types/src/components/ContentError.d.ts +0 -5
- package/dist/types/src/components/ContentError.d.ts.map +0 -1
- package/dist/types/src/components/ContentLoading.d.ts.map +0 -1
- package/dist/types/src/components/ContentLoading.stories.d.ts.map +0 -1
- package/dist/types/src/components/SimpleLayout/Banner.d.ts +0 -8
- package/dist/types/src/components/SimpleLayout/Banner.d.ts.map +0 -1
- package/dist/types/src/components/Workspace/Workspace.d.ts +0 -9
- package/dist/types/src/components/Workspace/Workspace.d.ts.map +0 -1
- package/dist/types/src/components/Workspace/index.d.ts +0 -2
- package/dist/types/src/components/Workspace/index.d.ts.map +0 -1
- package/src/components/ContentError.tsx +0 -23
- package/src/components/SimpleLayout/Banner.tsx +0 -113
- package/src/components/Workspace/Workspace.tsx +0 -115
- /package/dist/types/src/components/{ContentLoading.d.ts → ContentLoading/ContentLoading.d.ts} +0 -0
- /package/dist/types/src/components/{ContentLoading.stories.d.ts → ContentLoading/ContentLoading.stories.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-simple-layout",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.c351d160a8",
|
|
4
4
|
"description": "Simple layout plugin for minimal UI contexts like popover windows.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
"exports": {
|
|
16
16
|
".": {
|
|
17
17
|
"source": "./src/index.ts",
|
|
18
|
-
"types": "./dist/types/src/index.d.ts",
|
|
19
18
|
"browser": "./dist/lib/browser/index.mjs",
|
|
20
|
-
"node": "./dist/lib/node-esm/index.mjs"
|
|
19
|
+
"node": "./dist/lib/node-esm/index.mjs",
|
|
20
|
+
"types": "./dist/types/src/index.d.ts"
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"types": "dist/types/src/index.d.ts",
|
|
@@ -26,44 +26,50 @@
|
|
|
26
26
|
"src"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@effect-atom/atom": "^0.
|
|
30
|
-
"@effect-atom/atom-react": "^0.
|
|
29
|
+
"@effect-atom/atom": "^0.5.1",
|
|
30
|
+
"@effect-atom/atom-react": "^0.5.0",
|
|
31
31
|
"@radix-ui/react-context": "1.1.1",
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/react-ui-
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
32
|
+
"@tauri-apps/plugin-deep-link": "^2.2.0",
|
|
33
|
+
"@tauri-apps/plugin-haptics": "^2.3.2",
|
|
34
|
+
"@dxos/app-framework": "0.8.4-main.c351d160a8",
|
|
35
|
+
"@dxos/app-toolkit": "0.8.4-main.c351d160a8",
|
|
36
|
+
"@dxos/log": "0.8.4-main.c351d160a8",
|
|
37
|
+
"@dxos/operation": "0.8.4-main.c351d160a8",
|
|
38
|
+
"@dxos/plugin-graph": "0.8.4-main.c351d160a8",
|
|
39
|
+
"@dxos/echo": "0.8.4-main.c351d160a8",
|
|
40
|
+
"@dxos/react-ui-menu": "0.8.4-main.c351d160a8",
|
|
41
|
+
"@dxos/react-ui-attention": "0.8.4-main.c351d160a8",
|
|
42
|
+
"@dxos/react-ui-mosaic": "0.8.4-main.c351d160a8",
|
|
43
|
+
"@dxos/react-ui-stack": "0.8.4-main.c351d160a8",
|
|
44
|
+
"@dxos/react-ui-searchlist": "0.8.4-main.c351d160a8",
|
|
45
|
+
"@dxos/async": "0.8.4-main.c351d160a8",
|
|
46
|
+
"@dxos/util": "0.8.4-main.c351d160a8",
|
|
47
|
+
"@dxos/schema": "0.8.4-main.c351d160a8"
|
|
43
48
|
},
|
|
44
49
|
"devDependencies": {
|
|
45
50
|
"@types/react": "~19.2.7",
|
|
46
51
|
"@types/react-dom": "~19.2.3",
|
|
47
|
-
"effect": "3.19.
|
|
52
|
+
"effect": "3.19.16",
|
|
48
53
|
"react": "~19.2.3",
|
|
49
54
|
"react-dom": "~19.2.3",
|
|
50
|
-
"vite": "7.1.
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/plugin-
|
|
53
|
-
"@dxos/plugin-
|
|
54
|
-
"@dxos/plugin-
|
|
55
|
-
"@dxos/plugin-
|
|
56
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
57
|
-
"@dxos/
|
|
58
|
-
"@dxos/
|
|
59
|
-
"@dxos/
|
|
55
|
+
"vite": "^7.1.11",
|
|
56
|
+
"@dxos/app-graph": "0.8.4-main.c351d160a8",
|
|
57
|
+
"@dxos/plugin-client": "0.8.4-main.c351d160a8",
|
|
58
|
+
"@dxos/plugin-space": "0.8.4-main.c351d160a8",
|
|
59
|
+
"@dxos/plugin-testing": "0.8.4-main.c351d160a8",
|
|
60
|
+
"@dxos/plugin-search": "0.8.4-main.c351d160a8",
|
|
61
|
+
"@dxos/react-ui": "0.8.4-main.c351d160a8",
|
|
62
|
+
"@dxos/schema": "0.8.4-main.c351d160a8",
|
|
63
|
+
"@dxos/storybook-utils": "0.8.4-main.c351d160a8",
|
|
64
|
+
"@dxos/ui-theme": "0.8.4-main.c351d160a8",
|
|
65
|
+
"@dxos/plugin-preview": "0.8.4-main.c351d160a8"
|
|
60
66
|
},
|
|
61
67
|
"peerDependencies": {
|
|
62
|
-
"effect": "3.19.
|
|
68
|
+
"effect": "3.19.16",
|
|
63
69
|
"react": "~19.2.3",
|
|
64
70
|
"react-dom": "~19.2.3",
|
|
65
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
66
|
-
"@dxos/ui-theme": "0.8.4-main.
|
|
71
|
+
"@dxos/react-ui": "0.8.4-main.c351d160a8",
|
|
72
|
+
"@dxos/ui-theme": "0.8.4-main.c351d160a8"
|
|
67
73
|
},
|
|
68
74
|
"publishConfig": {
|
|
69
75
|
"access": "public"
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { ActivationEvent,
|
|
5
|
+
import { ActivationEvent, ActivationEvents, Capability, Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
8
|
import { OperationResolver, ReactRoot, ReactSurface, SpotlightDismiss, State, UrlHandler } from './capabilities';
|
|
8
9
|
import { meta } from './meta';
|
|
@@ -15,33 +16,33 @@ export type SimpleLayoutPluginOptions = {
|
|
|
15
16
|
};
|
|
16
17
|
|
|
17
18
|
export const SimpleLayoutPlugin = Plugin.define<SimpleLayoutPluginOptions>(meta).pipe(
|
|
19
|
+
AppPlugin.addOperationResolverModule({ activate: OperationResolver }),
|
|
20
|
+
AppPlugin.addTranslationsModule({ translations }),
|
|
18
21
|
Plugin.addModule(({ isPopover = false }) => ({
|
|
19
22
|
id: Capability.getModuleTag(State),
|
|
20
|
-
activatesOn:
|
|
21
|
-
activatesAfter: [SimpleLayoutEvents.StateReady,
|
|
23
|
+
activatesOn: ActivationEvents.Startup,
|
|
24
|
+
activatesAfter: [SimpleLayoutEvents.StateReady, AppActivationEvents.LayoutReady],
|
|
22
25
|
activate: () => State({ initialState: { isPopover } }),
|
|
23
26
|
})),
|
|
24
27
|
Plugin.addModule(({ isPopover = false }) => ({
|
|
25
28
|
id: Capability.getModuleTag(SpotlightDismiss),
|
|
26
|
-
activatesOn:
|
|
29
|
+
activatesOn: ActivationEvents.Startup,
|
|
27
30
|
activate: () => SpotlightDismiss({ isPopover }),
|
|
28
31
|
})),
|
|
29
32
|
Plugin.addModule({
|
|
30
33
|
id: Capability.getModuleTag(ReactRoot),
|
|
31
|
-
activatesOn:
|
|
34
|
+
activatesOn: ActivationEvents.Startup,
|
|
32
35
|
activate: ReactRoot,
|
|
33
36
|
}),
|
|
34
37
|
Plugin.addModule({
|
|
35
38
|
id: Capability.getModuleTag(ReactSurface),
|
|
36
|
-
activatesOn:
|
|
39
|
+
activatesOn: ActivationEvents.Startup,
|
|
37
40
|
activate: ReactSurface,
|
|
38
41
|
}),
|
|
39
42
|
Plugin.addModule({
|
|
40
43
|
id: Capability.getModuleTag(UrlHandler),
|
|
41
|
-
activatesOn: ActivationEvent.allOf(
|
|
44
|
+
activatesOn: ActivationEvent.allOf(ActivationEvents.OperationInvokerReady, SimpleLayoutEvents.StateReady),
|
|
42
45
|
activate: UrlHandler,
|
|
43
46
|
}),
|
|
44
|
-
Common.Plugin.addOperationResolverModule({ activate: OperationResolver }),
|
|
45
|
-
Common.Plugin.addTranslationsModule({ translations }),
|
|
46
47
|
Plugin.make,
|
|
47
48
|
);
|
|
@@ -4,24 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { getCompanionVariant, LayoutOperation, isPinnedWorkspace } from '@dxos/app-toolkit';
|
|
8
9
|
import { Operation, OperationResolver } from '@dxos/operation';
|
|
9
|
-
import { ATTENDABLE_PATH_SEPARATOR } from '@dxos/react-ui-attention';
|
|
10
10
|
|
|
11
11
|
import { type SimpleLayoutState, SimpleLayoutState as SimpleLayoutStateCapability } from '../../types';
|
|
12
12
|
|
|
13
13
|
/** Maximum number of items to keep in navigation history. */
|
|
14
14
|
const MAX_HISTORY_LENGTH = 50;
|
|
15
15
|
|
|
16
|
-
/** Parse entry ID to extract primary ID and variant. */
|
|
17
|
-
const parseEntryId = (entryId: string) => {
|
|
18
|
-
const [id, variant] = entryId.split(ATTENDABLE_PATH_SEPARATOR);
|
|
19
|
-
return { id, variant };
|
|
20
|
-
};
|
|
21
|
-
|
|
22
16
|
export default Capability.makeModule(
|
|
23
17
|
Effect.fnUntraced(function* () {
|
|
24
|
-
const registry = yield* Capability.get(
|
|
18
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
25
19
|
const stateAtom = yield* Capability.get(SimpleLayoutStateCapability);
|
|
26
20
|
|
|
27
21
|
const getState = () => registry.get(stateAtom);
|
|
@@ -29,13 +23,13 @@ export default Capability.makeModule(
|
|
|
29
23
|
registry.set(stateAtom, fn(getState()));
|
|
30
24
|
};
|
|
31
25
|
|
|
32
|
-
return Capability.contributes(
|
|
26
|
+
return Capability.contributes(Capabilities.OperationResolver, [
|
|
33
27
|
//
|
|
34
28
|
// SetLayoutMode
|
|
35
29
|
//
|
|
36
30
|
// TODO(burdon): No-op for to fix startup bug?
|
|
37
31
|
OperationResolver.make({
|
|
38
|
-
operation:
|
|
32
|
+
operation: LayoutOperation.SetLayoutMode,
|
|
39
33
|
handler: Effect.fnUntraced(function* () {}),
|
|
40
34
|
}),
|
|
41
35
|
|
|
@@ -43,20 +37,29 @@ export default Capability.makeModule(
|
|
|
43
37
|
// UpdateSidebar - No-op for simple layout.
|
|
44
38
|
//
|
|
45
39
|
OperationResolver.make({
|
|
46
|
-
operation:
|
|
40
|
+
operation: LayoutOperation.UpdateSidebar,
|
|
47
41
|
handler: () => Effect.void,
|
|
48
42
|
}),
|
|
49
43
|
|
|
50
44
|
//
|
|
51
45
|
// UpdateComplementary - Controls companion drawer.
|
|
52
46
|
//
|
|
47
|
+
// TODO(wittjosiah): Not sure if we should be using this for the drawer.
|
|
53
48
|
OperationResolver.make({
|
|
54
|
-
operation:
|
|
49
|
+
operation: LayoutOperation.UpdateComplementary,
|
|
55
50
|
handler: Effect.fnUntraced(function* (input) {
|
|
56
51
|
if (input.state === 'closed') {
|
|
57
52
|
updateState((state) => ({
|
|
58
53
|
...state,
|
|
59
54
|
drawerState: 'closed',
|
|
55
|
+
companionVariant: undefined,
|
|
56
|
+
}));
|
|
57
|
+
} else if (input.subject) {
|
|
58
|
+
const variant = getCompanionVariant(input.subject);
|
|
59
|
+
updateState((state) => ({
|
|
60
|
+
...state,
|
|
61
|
+
companionVariant: variant,
|
|
62
|
+
drawerState: input.state === 'expanded' ? 'expanded' : 'open',
|
|
60
63
|
}));
|
|
61
64
|
}
|
|
62
65
|
}),
|
|
@@ -66,7 +69,7 @@ export default Capability.makeModule(
|
|
|
66
69
|
// UpdateDialog
|
|
67
70
|
//
|
|
68
71
|
OperationResolver.make({
|
|
69
|
-
operation:
|
|
72
|
+
operation: LayoutOperation.UpdateDialog,
|
|
70
73
|
handler: Effect.fnUntraced(function* (input) {
|
|
71
74
|
updateState((state) => ({
|
|
72
75
|
...state,
|
|
@@ -84,7 +87,7 @@ export default Capability.makeModule(
|
|
|
84
87
|
// UpdatePopover
|
|
85
88
|
//
|
|
86
89
|
OperationResolver.make({
|
|
87
|
-
operation:
|
|
90
|
+
operation: LayoutOperation.UpdatePopover,
|
|
88
91
|
handler: Effect.fnUntraced(function* (input) {
|
|
89
92
|
updateState((state) => ({
|
|
90
93
|
...state,
|
|
@@ -109,13 +112,13 @@ export default Capability.makeModule(
|
|
|
109
112
|
// SwitchWorkspace
|
|
110
113
|
//
|
|
111
114
|
OperationResolver.make({
|
|
112
|
-
operation:
|
|
115
|
+
operation: LayoutOperation.SwitchWorkspace,
|
|
113
116
|
handler: Effect.fnUntraced(function* (input) {
|
|
114
117
|
updateState((state) => ({
|
|
115
118
|
...state,
|
|
116
119
|
// TODO(wittjosiah): This is a hack to prevent the previous deck from being set for pinned items.
|
|
117
120
|
// Ideally this should be worked into the data model in a generic way.
|
|
118
|
-
previousWorkspace: !state.workspace
|
|
121
|
+
previousWorkspace: !isPinnedWorkspace(state.workspace) ? state.workspace : state.previousWorkspace,
|
|
119
122
|
workspace: input.subject,
|
|
120
123
|
active: undefined,
|
|
121
124
|
// Clear history when switching workspaces.
|
|
@@ -128,10 +131,10 @@ export default Capability.makeModule(
|
|
|
128
131
|
// RevertWorkspace
|
|
129
132
|
//
|
|
130
133
|
OperationResolver.make({
|
|
131
|
-
operation:
|
|
134
|
+
operation: LayoutOperation.RevertWorkspace,
|
|
132
135
|
handler: Effect.fnUntraced(function* () {
|
|
133
136
|
const state = getState();
|
|
134
|
-
yield* Operation.invoke(
|
|
137
|
+
yield* Operation.invoke(LayoutOperation.SwitchWorkspace, {
|
|
135
138
|
subject: state.previousWorkspace,
|
|
136
139
|
});
|
|
137
140
|
}),
|
|
@@ -141,34 +144,19 @@ export default Capability.makeModule(
|
|
|
141
144
|
// Open
|
|
142
145
|
//
|
|
143
146
|
OperationResolver.make({
|
|
144
|
-
operation:
|
|
147
|
+
operation: LayoutOperation.Open,
|
|
145
148
|
handler: Effect.fnUntraced(function* (input) {
|
|
146
149
|
const id = input.subject[0];
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
updateState((state) => {
|
|
151
|
+
const newHistory = state.active ? [...state.history, state.active] : state.history;
|
|
152
|
+
const trimmedHistory =
|
|
153
|
+
newHistory.length > MAX_HISTORY_LENGTH ? newHistory.slice(-MAX_HISTORY_LENGTH) : newHistory;
|
|
154
|
+
return {
|
|
152
155
|
...state,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
} else {
|
|
158
|
-
// Regular navigation - update active and history.
|
|
159
|
-
updateState((state) => {
|
|
160
|
-
// Push current active to history if it exists.
|
|
161
|
-
const newHistory = state.active ? [...state.history, state.active] : state.history;
|
|
162
|
-
// Limit history length to prevent memory issues.
|
|
163
|
-
const trimmedHistory =
|
|
164
|
-
newHistory.length > MAX_HISTORY_LENGTH ? newHistory.slice(-MAX_HISTORY_LENGTH) : newHistory;
|
|
165
|
-
return {
|
|
166
|
-
...state,
|
|
167
|
-
active: id,
|
|
168
|
-
history: trimmedHistory,
|
|
169
|
-
};
|
|
170
|
-
});
|
|
171
|
-
}
|
|
156
|
+
active: id,
|
|
157
|
+
history: trimmedHistory,
|
|
158
|
+
};
|
|
159
|
+
});
|
|
172
160
|
}),
|
|
173
161
|
}),
|
|
174
162
|
|
|
@@ -176,7 +164,7 @@ export default Capability.makeModule(
|
|
|
176
164
|
// Close
|
|
177
165
|
//
|
|
178
166
|
OperationResolver.make({
|
|
179
|
-
operation:
|
|
167
|
+
operation: LayoutOperation.Close,
|
|
180
168
|
handler: Effect.fnUntraced(function* () {
|
|
181
169
|
updateState((state) => {
|
|
182
170
|
// Pop from history if available.
|
|
@@ -202,7 +190,7 @@ export default Capability.makeModule(
|
|
|
202
190
|
// Set
|
|
203
191
|
//
|
|
204
192
|
OperationResolver.make({
|
|
205
|
-
operation:
|
|
193
|
+
operation: LayoutOperation.Set,
|
|
206
194
|
handler: Effect.fnUntraced(function* (input) {
|
|
207
195
|
updateState((state) => ({
|
|
208
196
|
...state,
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
9
|
|
|
10
10
|
import { SimpleLayout } from '../../components';
|
|
11
11
|
import { meta } from '../../meta';
|
|
12
12
|
|
|
13
13
|
export default Capability.makeModule(() =>
|
|
14
14
|
Effect.succeed(
|
|
15
|
-
Capability.contributes(
|
|
15
|
+
Capability.contributes(Capabilities.ReactRoot, {
|
|
16
16
|
id: meta.id,
|
|
17
17
|
root: () => {
|
|
18
18
|
return <SimpleLayout />;
|
|
@@ -5,10 +5,11 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
9
10
|
import { Node } from '@dxos/plugin-graph';
|
|
10
11
|
|
|
11
|
-
import { Home,
|
|
12
|
+
import { Home, NavBranch } from '../../components';
|
|
12
13
|
import { meta } from '../../meta';
|
|
13
14
|
|
|
14
15
|
type SurfaceData = {
|
|
@@ -16,24 +17,26 @@ type SurfaceData = {
|
|
|
16
17
|
properties: Record<string, any>;
|
|
17
18
|
};
|
|
18
19
|
|
|
19
|
-
const ALLOWED_DISPOSITIONS = ['workspace', 'user-account', 'pin-end'];
|
|
20
|
+
const ALLOWED_DISPOSITIONS = ['workspace', 'user-account', 'pin-end', 'alternate-tree'];
|
|
20
21
|
|
|
21
22
|
export default Capability.makeModule(() =>
|
|
22
23
|
Effect.succeed(
|
|
23
|
-
Capability.contributes(
|
|
24
|
-
|
|
25
|
-
id: `${meta.id}
|
|
24
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
25
|
+
Surface.create({
|
|
26
|
+
id: `${meta.id}.home`,
|
|
26
27
|
role: 'article',
|
|
27
28
|
filter: (data): data is SurfaceData => data.attendableId === Node.RootId,
|
|
28
29
|
component: () => <Home />,
|
|
29
30
|
}),
|
|
30
|
-
|
|
31
|
-
id: `${meta.id}
|
|
31
|
+
Surface.create({
|
|
32
|
+
id: `${meta.id}.nav-branch`,
|
|
32
33
|
role: 'article',
|
|
33
34
|
position: 'fallback',
|
|
34
|
-
filter: (data): data is SurfaceData =>
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
filter: (data): data is SurfaceData => {
|
|
36
|
+
const props = data.properties as Record<string, any>;
|
|
37
|
+
return ALLOWED_DISPOSITIONS.includes(props?.disposition) || props?.role === 'branch';
|
|
38
|
+
},
|
|
39
|
+
component: ({ data }) => <NavBranch id={data.attendableId} />,
|
|
37
40
|
}),
|
|
38
41
|
]),
|
|
39
42
|
),
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import * as Effect from 'effect/Effect';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
12
|
import { isTauri } from '@dxos/util';
|
|
13
13
|
|
|
@@ -76,7 +76,7 @@ export default Capability.makeModule(({ isPopover = false }: SpotlightDismissOpt
|
|
|
76
76
|
};
|
|
77
77
|
window.addEventListener('keydown', handleKeyDown);
|
|
78
78
|
|
|
79
|
-
return Capability.contributes(
|
|
79
|
+
return Capability.contributes(Capabilities.Null, null, () =>
|
|
80
80
|
Effect.sync(() => {
|
|
81
81
|
focusCleanup?.();
|
|
82
82
|
window.removeEventListener('keydown', handleKeyDown);
|
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
import { Atom } from '@effect-atom/atom-react';
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
|
-
import { Capability
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
10
|
import { Node } from '@dxos/plugin-graph';
|
|
10
11
|
|
|
11
12
|
import { type SimpleLayoutState } from '../../types';
|
|
@@ -29,7 +30,7 @@ export default Capability.makeModule(({ initialState }: SimpleLayoutStateOptions
|
|
|
29
30
|
Effect.sync(() => {
|
|
30
31
|
const stateAtom = Atom.make<SimpleLayoutState>({ ...defaultState, ...initialState });
|
|
31
32
|
|
|
32
|
-
const layoutAtom = Atom.make((get):
|
|
33
|
+
const layoutAtom = Atom.make((get): AppCapabilities.Layout => {
|
|
33
34
|
const state = get(stateAtom);
|
|
34
35
|
return {
|
|
35
36
|
mode: 'simple',
|
|
@@ -45,7 +46,7 @@ export default Capability.makeModule(({ initialState }: SimpleLayoutStateOptions
|
|
|
45
46
|
|
|
46
47
|
return [
|
|
47
48
|
Capability.contributes(SimpleLayoutStateCapability, stateAtom),
|
|
48
|
-
Capability.contributes(
|
|
49
|
+
Capability.contributes(AppCapabilities.Layout, layoutAtom),
|
|
49
50
|
];
|
|
50
51
|
}),
|
|
51
52
|
);
|
|
@@ -4,77 +4,130 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { LayoutOperation, fromUrlPath, getWorkspaceFromPath, toUrlPath } from '@dxos/app-toolkit';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
import { isTauri } from '@dxos/util';
|
|
9
11
|
|
|
10
12
|
import { type SimpleLayoutState, SimpleLayoutState as SimpleLayoutStateCapability } from '../../types';
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* URL handler for simple layout that syncs browser URL with layout state.
|
|
14
|
-
* URL
|
|
15
|
-
* Root is represented as
|
|
16
|
+
* URL paths map directly to qualified graph IDs with the leading `root` segment stripped.
|
|
17
|
+
* Root is represented as `/`.
|
|
18
|
+
*
|
|
19
|
+
* On mobile Tauri, also listens for deep links via the deep-link plugin.
|
|
16
20
|
*/
|
|
17
21
|
export default Capability.makeModule(
|
|
18
22
|
Effect.fnUntraced(function* () {
|
|
19
|
-
const { invokeSync } = yield* Capability.get(
|
|
23
|
+
const { invokeSync } = yield* Capability.get(Capabilities.OperationInvoker);
|
|
20
24
|
|
|
21
25
|
/**
|
|
22
|
-
* Handle navigation
|
|
23
|
-
*
|
|
26
|
+
* Handle navigation from a pathname.
|
|
27
|
+
* Restores the qualified graph ID and dispatches layout operations.
|
|
24
28
|
*/
|
|
25
|
-
const
|
|
26
|
-
|
|
29
|
+
const handlePathNavigation = (pathname: string) => {
|
|
30
|
+
log.info('[UrlHandler] Navigating to path', { pathname });
|
|
27
31
|
|
|
28
|
-
|
|
29
|
-
const
|
|
32
|
+
const qualifiedId = fromUrlPath(pathname);
|
|
33
|
+
const workspace = getWorkspaceFromPath(qualifiedId);
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
const targetWorkspace = !nextWorkspace || nextWorkspace === 'root' ? Node.RootId : nextWorkspace;
|
|
35
|
+
invokeSync(LayoutOperation.SwitchWorkspace, { subject: workspace });
|
|
33
36
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
invokeSync(Common.LayoutOperation.Open, { subject: [nextActive] });
|
|
37
|
+
const activeId = qualifiedId !== workspace ? qualifiedId : undefined;
|
|
38
|
+
if (activeId) {
|
|
39
|
+
invokeSync(LayoutOperation.Open, { subject: [activeId] });
|
|
38
40
|
}
|
|
39
41
|
};
|
|
40
42
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
const onNavigation = handleNavigation(handlePathNavigation);
|
|
44
|
+
|
|
45
|
+
yield* Effect.sync(() => onNavigation());
|
|
46
|
+
window.addEventListener('popstate', onNavigation);
|
|
47
|
+
|
|
48
|
+
let unlistenDeepLink: (() => void) | undefined;
|
|
49
|
+
if (isTauri()) {
|
|
50
|
+
yield* Effect.tryPromise({
|
|
51
|
+
try: async () => {
|
|
52
|
+
const { getCurrent, onOpenUrl } = await import('@tauri-apps/plugin-deep-link');
|
|
53
|
+
|
|
54
|
+
const launchUrls = await getCurrent();
|
|
55
|
+
if (launchUrls && launchUrls.length > 0) {
|
|
56
|
+
log.info('[UrlHandler] App launched with deep links', { urls: launchUrls });
|
|
57
|
+
for (const url of launchUrls) {
|
|
58
|
+
handleDeepLink(url, handlePathNavigation);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
unlistenDeepLink = await onOpenUrl((urls) => {
|
|
63
|
+
log.info('[UrlHandler] Deep links received', { urls });
|
|
64
|
+
for (const url of urls) {
|
|
65
|
+
handleDeepLink(url, handlePathNavigation);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
log.info('[UrlHandler] Deep link listener initialized');
|
|
70
|
+
},
|
|
71
|
+
catch: (error) => {
|
|
72
|
+
log.warn('[UrlHandler] Failed to initialize deep link listener', { error });
|
|
73
|
+
return error;
|
|
74
|
+
},
|
|
75
|
+
}).pipe(Effect.catchAll(() => Effect.void));
|
|
76
|
+
}
|
|
44
77
|
|
|
45
|
-
// Subscribe to state changes to update the URL.
|
|
46
78
|
let lastWorkspace: string | undefined;
|
|
47
79
|
let lastActive: string | undefined;
|
|
48
|
-
const unsubscribe = yield*
|
|
49
|
-
|
|
50
|
-
(state: SimpleLayoutState) => {
|
|
51
|
-
const { workspace, active } = state;
|
|
52
|
-
|
|
53
|
-
// Only update URL if relevant state changed.
|
|
54
|
-
if (workspace !== lastWorkspace || active !== lastActive) {
|
|
55
|
-
lastWorkspace = workspace;
|
|
56
|
-
lastActive = active;
|
|
57
|
-
|
|
58
|
-
// Build path: root is represented as /, other workspaces as /{workspace}.
|
|
59
|
-
let path: string;
|
|
60
|
-
if (workspace === Node.RootId) {
|
|
61
|
-
path = active ? `/${Node.RootId}/${active}` : '/';
|
|
62
|
-
} else {
|
|
63
|
-
path = active ? `/${workspace}/${active}` : `/${workspace}`;
|
|
64
|
-
}
|
|
80
|
+
const unsubscribe = yield* Capabilities.subscribeAtom(SimpleLayoutStateCapability, (state: SimpleLayoutState) => {
|
|
81
|
+
const { workspace, active } = state;
|
|
65
82
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
83
|
+
if (workspace !== lastWorkspace || active !== lastActive) {
|
|
84
|
+
lastWorkspace = workspace;
|
|
85
|
+
lastActive = active;
|
|
86
|
+
|
|
87
|
+
const path = active ? toUrlPath(active) : toUrlPath(workspace);
|
|
88
|
+
if (window.location.pathname !== path) {
|
|
89
|
+
history.pushState(null, '', `${path}${window.location.search}`);
|
|
69
90
|
}
|
|
70
|
-
}
|
|
71
|
-
);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
72
93
|
|
|
73
|
-
return Capability.contributes(
|
|
94
|
+
return Capability.contributes(Capabilities.Null, null, () =>
|
|
74
95
|
Effect.sync(() => {
|
|
75
|
-
window.removeEventListener('popstate',
|
|
96
|
+
window.removeEventListener('popstate', onNavigation);
|
|
76
97
|
unsubscribe();
|
|
98
|
+
unlistenDeepLink?.();
|
|
77
99
|
}),
|
|
78
100
|
);
|
|
79
101
|
}),
|
|
80
102
|
);
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Check if a path is a special redirect path that shouldn't be navigated to.
|
|
106
|
+
* These paths are handled by other systems (e.g., OAuth).
|
|
107
|
+
*/
|
|
108
|
+
const isRedirectPath = (pathname: string): boolean => pathname.startsWith('/redirect/');
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Returns a handler for navigation events (initial load and popstate) that navigates to current pathname.
|
|
112
|
+
*/
|
|
113
|
+
const handleNavigation =
|
|
114
|
+
(navigate: (pathname: string) => void): (() => void) =>
|
|
115
|
+
() =>
|
|
116
|
+
navigate(window.location.pathname);
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Handle deep link URL from Tauri. Parses the URL and calls navigate unless it's a redirect path.
|
|
120
|
+
*/
|
|
121
|
+
const handleDeepLink = (urlString: string, navigate: (pathname: string) => void): void => {
|
|
122
|
+
log.info('[UrlHandler] Deep link received', { url: urlString });
|
|
123
|
+
try {
|
|
124
|
+
const url = new URL(urlString);
|
|
125
|
+
if (isRedirectPath(url.pathname)) {
|
|
126
|
+
log.info('[UrlHandler] Skipping redirect path (handled elsewhere)', { pathname: url.pathname });
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
navigate(url.pathname);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
log.warn('[UrlHandler] Failed to parse deep link URL', { urlString, error });
|
|
132
|
+
}
|
|
133
|
+
};
|