@dxos/plugin-simple-layout 0.8.4-main.c85a9c8dae → 0.8.4-main.d05673bc65
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-TMZNLVT2.mjs → chunk-MDPEKLKR.mjs} +55 -62
- package/dist/lib/browser/chunk-MDPEKLKR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7VLT3S46.mjs → chunk-MRR7PXSM.mjs} +3 -3
- package/dist/lib/browser/{chunk-7VLT3S46.mjs.map → chunk-MRR7PXSM.mjs.map} +1 -1
- package/dist/lib/browser/index.mjs +6 -6
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-BYRIQOQT.mjs → operation-resolver-VTZ6HZ4B.mjs} +24 -35
- package/dist/lib/browser/operation-resolver-VTZ6HZ4B.mjs.map +7 -0
- package/dist/lib/browser/{react-root-MMB575WY.mjs → react-root-WVQYY2JA.mjs} +3 -3
- package/dist/lib/browser/{react-surface-M6CURANW.mjs → react-surface-VLBR37ED.mjs} +11 -8
- package/dist/lib/browser/{react-surface-M6CURANW.mjs.map → react-surface-VLBR37ED.mjs.map} +3 -3
- package/dist/lib/browser/{state-A3PGDWWZ.mjs → state-TXSMUWYI.mjs} +2 -2
- package/dist/lib/browser/{url-handler-HTIUY6WL.mjs → url-handler-RBRONH7S.mjs} +18 -19
- package/dist/lib/browser/url-handler-RBRONH7S.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FLOYBAHE.mjs → chunk-DCKASLMP.mjs} +55 -62
- package/dist/lib/node-esm/chunk-DCKASLMP.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VIDE5UMB.mjs → chunk-WMNTJ2MK.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-VIDE5UMB.mjs.map → chunk-WMNTJ2MK.mjs.map} +1 -1
- package/dist/lib/node-esm/index.mjs +6 -6
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-BDTFNCS2.mjs → operation-resolver-R7CQ6ERU.mjs} +24 -35
- package/dist/lib/node-esm/operation-resolver-R7CQ6ERU.mjs.map +7 -0
- package/dist/lib/node-esm/{react-root-ENZKVSY4.mjs → react-root-XBNDM7BE.mjs} +3 -3
- package/dist/lib/node-esm/{react-surface-ITVNQYLG.mjs → react-surface-U5NHA367.mjs} +11 -8
- package/dist/lib/node-esm/{react-surface-ITVNQYLG.mjs.map → react-surface-U5NHA367.mjs.map} +3 -3
- package/dist/lib/node-esm/{state-ZCFZTTPL.mjs → state-JMX6FAG4.mjs} +2 -2
- package/dist/lib/node-esm/{url-handler-WBVVKVPC.mjs → url-handler-QSMCH3JB.mjs} +18 -19
- package/dist/lib/node-esm/url-handler-QSMCH3JB.mjs.map +7 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler/url-handler.d.ts +2 -2
- package/dist/types/src/capabilities/url-handler/url-handler.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/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/SimpleLayout/Main.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 +1 -1
- package/dist/types/src/hooks/actions.d.ts +3 -4
- package/dist/types/src/hooks/actions.d.ts.map +1 -1
- package/dist/types/src/hooks/useAppBarProps.d.ts.map +1 -1
- package/dist/types/src/hooks/useDrawerActions.d.ts.map +1 -1
- package/dist/types/src/hooks/useNavbarActions.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +27 -27
- package/src/capabilities/operation-resolver/operation-resolver.ts +19 -34
- package/src/capabilities/react-surface/react-surface.tsx +8 -6
- package/src/capabilities/url-handler/url-handler.ts +11 -35
- package/src/components/ContentLoading/index.ts +5 -0
- package/src/components/Home/Home.tsx +3 -3
- package/src/components/{Workspace/Workspace.tsx → NavBranch/NavBranch.tsx} +18 -13
- package/src/components/{Workspace → NavBranch}/index.ts +1 -1
- package/src/components/SimpleLayout/Drawer.tsx +3 -12
- package/src/components/SimpleLayout/Main.tsx +3 -4
- package/src/components/hooks.ts +8 -8
- package/src/components/index.ts +1 -1
- package/src/hooks/actions.ts +13 -15
- package/src/hooks/useAppBarProps.ts +1 -2
- package/src/hooks/useDrawerActions.ts +7 -5
- package/src/hooks/useNavbarActions.ts +5 -4
- package/src/meta.ts +1 -1
- package/src/types/capabilities.ts +1 -1
- package/dist/lib/browser/chunk-TMZNLVT2.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-BYRIQOQT.mjs.map +0 -7
- package/dist/lib/browser/url-handler-HTIUY6WL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FLOYBAHE.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-BDTFNCS2.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-WBVVKVPC.mjs.map +0 -7
- 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/Workspace/Workspace.d.ts +0 -11
- 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/dist/lib/browser/{react-root-MMB575WY.mjs.map → react-root-WVQYY2JA.mjs.map} +0 -0
- /package/dist/lib/browser/{state-A3PGDWWZ.mjs.map → state-TXSMUWYI.mjs.map} +0 -0
- /package/dist/lib/node-esm/{react-root-ENZKVSY4.mjs.map → react-root-XBNDM7BE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{state-ZCFZTTPL.mjs.map → state-JMX6FAG4.mjs.map} +0 -0
- /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/src/components/{ContentLoading.stories.tsx → ContentLoading/ContentLoading.stories.tsx} +0 -0
- /package/src/components/{ContentLoading.tsx → ContentLoading/ContentLoading.tsx} +0 -0
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SimpleLayoutState
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MRR7PXSM.mjs";
|
|
4
4
|
|
|
5
5
|
// src/capabilities/url-handler/url-handler.ts
|
|
6
6
|
import * as Effect from "effect/Effect";
|
|
7
7
|
import { Capabilities, Capability } from "@dxos/app-framework";
|
|
8
|
-
import { LayoutOperation } from "@dxos/app-toolkit";
|
|
8
|
+
import { LayoutOperation, fromUrlPath, getWorkspaceFromPath, toUrlPath } from "@dxos/app-toolkit";
|
|
9
9
|
import { log } from "@dxos/log";
|
|
10
|
-
import { Node } from "@dxos/plugin-graph";
|
|
11
10
|
import { isTauri } from "@dxos/util";
|
|
12
11
|
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-simple-layout/src/capabilities/url-handler/url-handler.ts";
|
|
13
12
|
var url_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
@@ -17,19 +16,20 @@ var url_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
|
17
16
|
pathname
|
|
18
17
|
}, {
|
|
19
18
|
F: __dxlog_file,
|
|
20
|
-
L:
|
|
19
|
+
L: 30,
|
|
21
20
|
S: this,
|
|
22
21
|
C: (f, a) => f(...a)
|
|
23
22
|
});
|
|
24
|
-
const
|
|
25
|
-
const
|
|
23
|
+
const qualifiedId = fromUrlPath(pathname);
|
|
24
|
+
const workspace = getWorkspaceFromPath(qualifiedId);
|
|
26
25
|
invokeSync(LayoutOperation.SwitchWorkspace, {
|
|
27
|
-
subject:
|
|
26
|
+
subject: workspace
|
|
28
27
|
});
|
|
29
|
-
|
|
28
|
+
const activeId = qualifiedId !== workspace ? qualifiedId : void 0;
|
|
29
|
+
if (activeId) {
|
|
30
30
|
invokeSync(LayoutOperation.Open, {
|
|
31
31
|
subject: [
|
|
32
|
-
|
|
32
|
+
activeId
|
|
33
33
|
]
|
|
34
34
|
});
|
|
35
35
|
}
|
|
@@ -48,7 +48,7 @@ var url_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
|
48
48
|
urls: launchUrls
|
|
49
49
|
}, {
|
|
50
50
|
F: __dxlog_file,
|
|
51
|
-
L:
|
|
51
|
+
L: 56,
|
|
52
52
|
S: this,
|
|
53
53
|
C: (f, a) => f(...a)
|
|
54
54
|
});
|
|
@@ -61,7 +61,7 @@ var url_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
|
61
61
|
urls
|
|
62
62
|
}, {
|
|
63
63
|
F: __dxlog_file,
|
|
64
|
-
L:
|
|
64
|
+
L: 63,
|
|
65
65
|
S: this,
|
|
66
66
|
C: (f, a) => f(...a)
|
|
67
67
|
});
|
|
@@ -71,7 +71,7 @@ var url_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
|
71
71
|
});
|
|
72
72
|
log.info("[UrlHandler] Deep link listener initialized", void 0, {
|
|
73
73
|
F: __dxlog_file,
|
|
74
|
-
L:
|
|
74
|
+
L: 69,
|
|
75
75
|
S: this,
|
|
76
76
|
C: (f, a) => f(...a)
|
|
77
77
|
});
|
|
@@ -81,7 +81,7 @@ var url_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
|
81
81
|
error
|
|
82
82
|
}, {
|
|
83
83
|
F: __dxlog_file,
|
|
84
|
-
L:
|
|
84
|
+
L: 72,
|
|
85
85
|
S: this,
|
|
86
86
|
C: (f, a) => f(...a)
|
|
87
87
|
});
|
|
@@ -96,7 +96,7 @@ var url_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
|
96
96
|
if (workspace !== lastWorkspace || active !== lastActive) {
|
|
97
97
|
lastWorkspace = workspace;
|
|
98
98
|
lastActive = active;
|
|
99
|
-
const path =
|
|
99
|
+
const path = active ? toUrlPath(active) : toUrlPath(workspace);
|
|
100
100
|
if (window.location.pathname !== path) {
|
|
101
101
|
history.pushState(null, "", `${path}${window.location.search}`);
|
|
102
102
|
}
|
|
@@ -109,14 +109,13 @@ var url_handler_default = Capability.makeModule(Effect.fnUntraced(function* () {
|
|
|
109
109
|
}));
|
|
110
110
|
}));
|
|
111
111
|
var isRedirectPath = (pathname) => pathname.startsWith("/redirect/");
|
|
112
|
-
var pathFromState = (workspace, active) => workspace === Node.RootId ? active ? `/${Node.RootId}/${active}` : "/" : active ? `/${workspace}/${active}` : `/${workspace}`;
|
|
113
112
|
var handleNavigation = (navigate) => () => navigate(window.location.pathname);
|
|
114
113
|
var handleDeepLink = (urlString, navigate) => {
|
|
115
114
|
log.info("[UrlHandler] Deep link received", {
|
|
116
115
|
url: urlString
|
|
117
116
|
}, {
|
|
118
117
|
F: __dxlog_file,
|
|
119
|
-
L:
|
|
118
|
+
L: 122,
|
|
120
119
|
S: void 0,
|
|
121
120
|
C: (f, a) => f(...a)
|
|
122
121
|
});
|
|
@@ -127,7 +126,7 @@ var handleDeepLink = (urlString, navigate) => {
|
|
|
127
126
|
pathname: url.pathname
|
|
128
127
|
}, {
|
|
129
128
|
F: __dxlog_file,
|
|
130
|
-
L:
|
|
129
|
+
L: 126,
|
|
131
130
|
S: void 0,
|
|
132
131
|
C: (f, a) => f(...a)
|
|
133
132
|
});
|
|
@@ -140,7 +139,7 @@ var handleDeepLink = (urlString, navigate) => {
|
|
|
140
139
|
error
|
|
141
140
|
}, {
|
|
142
141
|
F: __dxlog_file,
|
|
143
|
-
L:
|
|
142
|
+
L: 131,
|
|
144
143
|
S: void 0,
|
|
145
144
|
C: (f, a) => f(...a)
|
|
146
145
|
});
|
|
@@ -149,4 +148,4 @@ var handleDeepLink = (urlString, navigate) => {
|
|
|
149
148
|
export {
|
|
150
149
|
url_handler_default as default
|
|
151
150
|
};
|
|
152
|
-
//# sourceMappingURL=url-handler-
|
|
151
|
+
//# sourceMappingURL=url-handler-RBRONH7S.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/url-handler/url-handler.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { LayoutOperation, fromUrlPath, getWorkspaceFromPath, toUrlPath } from '@dxos/app-toolkit';\nimport { log } from '@dxos/log';\nimport { isTauri } from '@dxos/util';\n\nimport { type SimpleLayoutState, SimpleLayoutState as SimpleLayoutStateCapability } from '../../types';\n\n/**\n * URL handler for simple layout that syncs browser URL with layout state.\n * URL paths map directly to qualified graph IDs with the leading `root` segment stripped.\n * Root is represented as `/`.\n *\n * On mobile Tauri, also listens for deep links via the deep-link plugin.\n */\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n const { invokeSync } = yield* Capability.get(Capabilities.OperationInvoker);\n\n /**\n * Handle navigation from a pathname.\n * Restores the qualified graph ID and dispatches layout operations.\n */\n const handlePathNavigation = (pathname: string) => {\n log.info('[UrlHandler] Navigating to path', { pathname });\n\n const qualifiedId = fromUrlPath(pathname);\n const workspace = getWorkspaceFromPath(qualifiedId);\n\n invokeSync(LayoutOperation.SwitchWorkspace, { subject: workspace });\n\n const activeId = qualifiedId !== workspace ? qualifiedId : undefined;\n if (activeId) {\n invokeSync(LayoutOperation.Open, { subject: [activeId] });\n }\n };\n\n const onNavigation = handleNavigation(handlePathNavigation);\n\n yield* Effect.sync(() => onNavigation());\n window.addEventListener('popstate', onNavigation);\n\n let unlistenDeepLink: (() => void) | undefined;\n if (isTauri()) {\n yield* Effect.tryPromise({\n try: async () => {\n const { getCurrent, onOpenUrl } = await import('@tauri-apps/plugin-deep-link');\n\n const launchUrls = await getCurrent();\n if (launchUrls && launchUrls.length > 0) {\n log.info('[UrlHandler] App launched with deep links', { urls: launchUrls });\n for (const url of launchUrls) {\n handleDeepLink(url, handlePathNavigation);\n }\n }\n\n unlistenDeepLink = await onOpenUrl((urls) => {\n log.info('[UrlHandler] Deep links received', { urls });\n for (const url of urls) {\n handleDeepLink(url, handlePathNavigation);\n }\n });\n\n log.info('[UrlHandler] Deep link listener initialized');\n },\n catch: (error) => {\n log.warn('[UrlHandler] Failed to initialize deep link listener', { error });\n return error;\n },\n }).pipe(Effect.catchAll(() => Effect.void));\n }\n\n let lastWorkspace: string | undefined;\n let lastActive: string | undefined;\n const unsubscribe = yield* Capabilities.subscribeAtom(SimpleLayoutStateCapability, (state: SimpleLayoutState) => {\n const { workspace, active } = state;\n\n if (workspace !== lastWorkspace || active !== lastActive) {\n lastWorkspace = workspace;\n lastActive = active;\n\n const path = active ? toUrlPath(active) : toUrlPath(workspace);\n if (window.location.pathname !== path) {\n history.pushState(null, '', `${path}${window.location.search}`);\n }\n }\n });\n\n return Capability.contributes(Capabilities.Null, null, () =>\n Effect.sync(() => {\n window.removeEventListener('popstate', onNavigation);\n unsubscribe();\n unlistenDeepLink?.();\n }),\n );\n }),\n);\n\n/**\n * Check if a path is a special redirect path that shouldn't be navigated to.\n * These paths are handled by other systems (e.g., OAuth).\n */\nconst isRedirectPath = (pathname: string): boolean => pathname.startsWith('/redirect/');\n\n/**\n * Returns a handler for navigation events (initial load and popstate) that navigates to current pathname.\n */\nconst handleNavigation =\n (navigate: (pathname: string) => void): (() => void) =>\n () =>\n navigate(window.location.pathname);\n\n/**\n * Handle deep link URL from Tauri. Parses the URL and calls navigate unless it's a redirect path.\n */\nconst handleDeepLink = (urlString: string, navigate: (pathname: string) => void): void => {\n log.info('[UrlHandler] Deep link received', { url: urlString });\n try {\n const url = new URL(urlString);\n if (isRedirectPath(url.pathname)) {\n log.info('[UrlHandler] Skipping redirect path (handled elsewhere)', { pathname: url.pathname });\n return;\n }\n navigate(url.pathname);\n } catch (error) {\n log.warn('[UrlHandler] Failed to parse deep link URL', { urlString, error });\n }\n};\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["Effect", "Capabilities", "Capability", "LayoutOperation", "fromUrlPath", "getWorkspaceFromPath", "toUrlPath", "log", "isTauri", "Capability", "makeModule", "fnUntraced", "invokeSync", "get", "Capabilities", "OperationInvoker", "handlePathNavigation", "pathname", "log", "info", "qualifiedId", "fromUrlPath", "workspace", "getWorkspaceFromPath", "LayoutOperation", "SwitchWorkspace", "subject", "activeId", "undefined", "Open", "onNavigation", "handleNavigation", "sync", "window", "addEventListener", "unlistenDeepLink", "isTauri", "tryPromise", "try", "getCurrent", "onOpenUrl", "launchUrls", "length", "urls", "url", "handleDeepLink", "catch", "error", "warn", "pipe", "catchAll", "void", "lastWorkspace", "lastActive", "unsubscribe", "subscribeAtom", "SimpleLayoutStateCapability", "state", "active", "path", "toUrlPath", "location", "history", "pushState", "search", "contributes", "Null", "removeEventListener", "isRedirectPath", "startsWith", "navigate", "urlString", "URL"]
|
|
7
|
+
}
|
|
@@ -2,7 +2,7 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
SimpleLayoutState,
|
|
4
4
|
meta
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-WMNTJ2MK.mjs";
|
|
6
6
|
|
|
7
7
|
// src/components/Home/Home.tsx
|
|
8
8
|
import React, { useCallback, useEffect as useEffect2, useMemo, useRef } from "react";
|
|
@@ -19,16 +19,16 @@ import { byPosition } from "@dxos/util";
|
|
|
19
19
|
|
|
20
20
|
// src/components/hooks.ts
|
|
21
21
|
import { useEffect } from "react";
|
|
22
|
+
import { expandAttendableId } from "@dxos/react-ui-attention";
|
|
22
23
|
import { useAppGraph } from "@dxos/app-toolkit/ui";
|
|
23
24
|
import { Graph } from "@dxos/plugin-graph";
|
|
24
|
-
var
|
|
25
|
+
var useExpandPath = (nodeId) => {
|
|
25
26
|
const { graph } = useAppGraph();
|
|
26
27
|
useEffect(() => {
|
|
27
28
|
if (nodeId) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
});
|
|
29
|
+
for (const prefix of expandAttendableId(nodeId)) {
|
|
30
|
+
Graph.expand(graph, prefix, "child");
|
|
31
|
+
}
|
|
32
32
|
}
|
|
33
33
|
}, [
|
|
34
34
|
nodeId,
|
|
@@ -42,7 +42,7 @@ var Home = (_) => {
|
|
|
42
42
|
const userAccountItem = useItemsByDisposition("user-account")[0];
|
|
43
43
|
const pinnedItems = useItemsByDisposition("pin-end", true);
|
|
44
44
|
const workspaceItems = useItemsByDisposition("workspace");
|
|
45
|
-
|
|
45
|
+
useExpandPath(Node.RootId);
|
|
46
46
|
const items = useMemo(() => [
|
|
47
47
|
...userAccountItem ? [
|
|
48
48
|
userAccountItem
|
|
@@ -87,7 +87,7 @@ var WorkspaceTile = (props) => {
|
|
|
87
87
|
const name = toLocalizedString(data.properties.label, t);
|
|
88
88
|
const isSelected = selectedValue === data.id;
|
|
89
89
|
const cardRef = useRef(null);
|
|
90
|
-
|
|
90
|
+
useExpandPath(data.id);
|
|
91
91
|
const handleSelect = useCallback(() => invokePromise(LayoutOperation.SwitchWorkspace, {
|
|
92
92
|
subject: data.id
|
|
93
93
|
}), [
|
|
@@ -243,7 +243,7 @@ var useAppBarProps = () => {
|
|
|
243
243
|
state.active,
|
|
244
244
|
state.history.length
|
|
245
245
|
]);
|
|
246
|
-
const popoverAnchorId = node && state.popoverAnchorId ===
|
|
246
|
+
const popoverAnchorId = node && state.popoverAnchorId === `${meta.id}:${node.id}` ? state.popoverAnchorId : void 0;
|
|
247
247
|
return {
|
|
248
248
|
title,
|
|
249
249
|
actions: actionsAtom,
|
|
@@ -262,13 +262,12 @@ import { byPosition as byPosition3 } from "@dxos/util";
|
|
|
262
262
|
|
|
263
263
|
// src/hooks/actions.ts
|
|
264
264
|
import * as Effect2 from "effect/Effect";
|
|
265
|
-
import {
|
|
265
|
+
import { getCompanionVariant } from "@dxos/app-toolkit";
|
|
266
266
|
import { Node as Node3 } from "@dxos/plugin-graph";
|
|
267
|
-
import { ATTENDABLE_PATH_SEPARATOR } from "@dxos/react-ui-attention";
|
|
268
267
|
import { byPosition as byPosition2 } from "@dxos/util";
|
|
269
|
-
var PLANK_COMPANION_TYPE = "dxos.
|
|
268
|
+
var PLANK_COMPANION_TYPE = "org.dxos.plugin.deck.plank-companion";
|
|
270
269
|
var createCompanionActions = (graph, stateAtom, get, config) => {
|
|
271
|
-
const { idPrefix, selectedVariant,
|
|
270
|
+
const { idPrefix, selectedVariant, updateState } = config;
|
|
272
271
|
const state = get(stateAtom);
|
|
273
272
|
const activeId = state.active ?? state.workspace;
|
|
274
273
|
const activeConnections = activeId ? get(graph.connections(activeId, "child")) : [];
|
|
@@ -276,7 +275,7 @@ var createCompanionActions = (graph, stateAtom, get, config) => {
|
|
|
276
275
|
const nodes = [];
|
|
277
276
|
const edges = [];
|
|
278
277
|
companions.forEach((companion) => {
|
|
279
|
-
const
|
|
278
|
+
const companionVariant = getCompanionVariant(companion.id);
|
|
280
279
|
const companionAction = {
|
|
281
280
|
id: `${idPrefix}-companion-${companion.id}`,
|
|
282
281
|
type: Node3.ActionType,
|
|
@@ -284,15 +283,17 @@ var createCompanionActions = (graph, stateAtom, get, config) => {
|
|
|
284
283
|
icon: companion.properties.icon ?? "ph--placeholder--regular",
|
|
285
284
|
label: companion.properties.label,
|
|
286
285
|
iconOnly: true,
|
|
287
|
-
// Conditionally add variant highlighting.
|
|
288
286
|
...selectedVariant !== void 0 && {
|
|
289
287
|
variant: selectedVariant === companionVariant ? "primary" : "ghost"
|
|
290
288
|
}
|
|
291
289
|
},
|
|
292
|
-
data: () => Effect2.sync(() =>
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
290
|
+
data: () => Effect2.sync(() => updateState((current) => {
|
|
291
|
+
const closing = current.companionVariant === companionVariant && current.drawerState !== "closed";
|
|
292
|
+
return {
|
|
293
|
+
...current,
|
|
294
|
+
companionVariant: closing ? void 0 : companionVariant,
|
|
295
|
+
drawerState: closing ? "closed" : "open"
|
|
296
|
+
};
|
|
296
297
|
}))
|
|
297
298
|
};
|
|
298
299
|
nodes.push(companionAction);
|
|
@@ -321,14 +322,14 @@ var useCompanions = (nodeId) => {
|
|
|
321
322
|
// src/hooks/useDrawerActions.ts
|
|
322
323
|
import { Atom as Atom2 } from "@effect-atom/atom-react";
|
|
323
324
|
import * as Effect3 from "effect/Effect";
|
|
324
|
-
import { useMemo as
|
|
325
|
-
import { useCapability as useCapability3
|
|
325
|
+
import { useMemo as useMemo7 } from "react";
|
|
326
|
+
import { useCapability as useCapability3 } from "@dxos/app-framework/ui";
|
|
326
327
|
import { useAppGraph as useAppGraph7 } from "@dxos/app-toolkit/ui";
|
|
327
328
|
import { Node as Node4, useActionRunner as useActionRunner2 } from "@dxos/plugin-graph";
|
|
328
329
|
import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
329
330
|
import { createGapSeparator } from "@dxos/react-ui-menu";
|
|
330
331
|
|
|
331
|
-
// src/components/ContentLoading.tsx
|
|
332
|
+
// src/components/ContentLoading/ContentLoading.tsx
|
|
332
333
|
import React2 from "react";
|
|
333
334
|
var ContentLoading = () => {
|
|
334
335
|
return /* @__PURE__ */ React2.createElement("div", {
|
|
@@ -722,7 +723,7 @@ var Main = () => {
|
|
|
722
723
|
node?.properties,
|
|
723
724
|
state.popoverAnchorId
|
|
724
725
|
]);
|
|
725
|
-
|
|
726
|
+
useExpandPath(id);
|
|
726
727
|
const showNavBar = !keyboardOpen && !state.isPopover && state.drawerState === "closed";
|
|
727
728
|
return /* @__PURE__ */ React7.createElement("div", {
|
|
728
729
|
role: "none",
|
|
@@ -745,10 +746,10 @@ var Main = () => {
|
|
|
745
746
|
};
|
|
746
747
|
Main.displayName = MAIN_NAME;
|
|
747
748
|
|
|
748
|
-
// src/components/
|
|
749
|
-
import React8, { useCallback as useCallback4, useEffect as useEffect5, useRef as useRef3 } from "react";
|
|
749
|
+
// src/components/NavBranch/NavBranch.tsx
|
|
750
|
+
import React8, { useCallback as useCallback4, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3 } from "react";
|
|
750
751
|
import { useOperationInvoker as useOperationInvoker3 } from "@dxos/app-framework/ui";
|
|
751
|
-
import { LayoutOperation as
|
|
752
|
+
import { LayoutOperation as LayoutOperation3 } from "@dxos/app-toolkit";
|
|
752
753
|
import { useAppGraph as useAppGraph6 } from "@dxos/app-toolkit/ui";
|
|
753
754
|
import { useConnections as useConnections3 } from "@dxos/plugin-graph";
|
|
754
755
|
import { Avatar as Avatar2, Icon as Icon2, Panel as Panel2, ScrollArea as ScrollArea2, Toolbar as Toolbar3, toLocalizedString as toLocalizedString4, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
@@ -756,13 +757,16 @@ import { Card as Card3 } from "@dxos/react-ui";
|
|
|
756
757
|
import { Mosaic as Mosaic2 } from "@dxos/react-ui-mosaic";
|
|
757
758
|
import { SearchList as SearchList2, useSearchListItem as useSearchListItem2, useSearchListResults as useSearchListResults2 } from "@dxos/react-ui-searchlist";
|
|
758
759
|
import { mx as mx6 } from "@dxos/ui-theme";
|
|
759
|
-
var
|
|
760
|
+
var NavBranch = ({ id }) => {
|
|
760
761
|
const { t } = useTranslation5(meta.id);
|
|
761
762
|
const { graph } = useAppGraph6();
|
|
762
|
-
|
|
763
|
+
useExpandPath(id);
|
|
763
764
|
const children = useConnections3(graph, id, "child");
|
|
765
|
+
const visibleChildren = useMemo6(() => children.filter((node) => node.properties.disposition !== "alternate-tree"), [
|
|
766
|
+
children
|
|
767
|
+
]);
|
|
764
768
|
const { results, handleSearch } = useSearchListResults2({
|
|
765
|
-
items:
|
|
769
|
+
items: visibleChildren,
|
|
766
770
|
extract: (child) => toLocalizedString4(child.properties.label, t)
|
|
767
771
|
});
|
|
768
772
|
return /* @__PURE__ */ React8.createElement(SearchList2.Root, {
|
|
@@ -783,10 +787,10 @@ var Workspace = ({ id }) => {
|
|
|
783
787
|
}, /* @__PURE__ */ React8.createElement(Mosaic2.Stack, {
|
|
784
788
|
items: results,
|
|
785
789
|
getId: (child) => child.id,
|
|
786
|
-
Tile:
|
|
790
|
+
Tile: NavBranchTile
|
|
787
791
|
}))))))));
|
|
788
792
|
};
|
|
789
|
-
var
|
|
793
|
+
var NavBranchTile = (props) => {
|
|
790
794
|
const data = props.data;
|
|
791
795
|
const { t } = useTranslation5(meta.id);
|
|
792
796
|
const { invokeSync } = useOperationInvoker3();
|
|
@@ -794,7 +798,7 @@ var WorkspaceChildTile = (props) => {
|
|
|
794
798
|
const { selectedValue, registerItem, unregisterItem } = useSearchListItem2();
|
|
795
799
|
const isSelected = selectedValue === data.id;
|
|
796
800
|
const name = toLocalizedString4(data.properties.label, t);
|
|
797
|
-
const handleSelect = useCallback4(() => invokeSync(
|
|
801
|
+
const handleSelect = useCallback4(() => invokeSync(LayoutOperation3.Open, {
|
|
798
802
|
subject: [
|
|
799
803
|
data.id
|
|
800
804
|
]
|
|
@@ -871,15 +875,14 @@ var useDrawerActions = (consumerName) => {
|
|
|
871
875
|
const stateAtom = useCapability3(SimpleLayoutState);
|
|
872
876
|
const { graph } = useAppGraph7();
|
|
873
877
|
const runAction = useActionRunner2();
|
|
874
|
-
const { invokeSync } = useOperationInvoker4();
|
|
875
878
|
const { updateState } = useSimpleLayoutState();
|
|
876
879
|
const { keyboardOpen } = useMobileLayout(consumerName);
|
|
877
|
-
const actionsAtom =
|
|
880
|
+
const actionsAtom = useMemo7(() => Atom2.make((get) => {
|
|
878
881
|
const state = get(stateAtom);
|
|
879
882
|
const { nodes, edges } = createCompanionActions(graph, stateAtom, get, {
|
|
880
883
|
idPrefix: "drawer",
|
|
881
884
|
selectedVariant: state.companionVariant,
|
|
882
|
-
|
|
885
|
+
updateState
|
|
883
886
|
});
|
|
884
887
|
const gapSeparator = createGapSeparator("drawer-gap");
|
|
885
888
|
nodes.push(...gapSeparator.nodes);
|
|
@@ -916,7 +919,8 @@ var useDrawerActions = (consumerName) => {
|
|
|
916
919
|
},
|
|
917
920
|
data: () => Effect3.sync(() => updateState((state2) => ({
|
|
918
921
|
...state2,
|
|
919
|
-
drawerState: "closed"
|
|
922
|
+
drawerState: "closed",
|
|
923
|
+
companionVariant: void 0
|
|
920
924
|
})))
|
|
921
925
|
};
|
|
922
926
|
nodes.push(closeAction);
|
|
@@ -932,7 +936,6 @@ var useDrawerActions = (consumerName) => {
|
|
|
932
936
|
}), [
|
|
933
937
|
graph,
|
|
934
938
|
stateAtom,
|
|
935
|
-
invokeSync,
|
|
936
939
|
updateState,
|
|
937
940
|
keyboardOpen,
|
|
938
941
|
t
|
|
@@ -945,8 +948,8 @@ var useDrawerActions = (consumerName) => {
|
|
|
945
948
|
|
|
946
949
|
// src/hooks/useNavbarActions.ts
|
|
947
950
|
import { Atom as Atom3 } from "@effect-atom/atom-react";
|
|
948
|
-
import { useMemo as
|
|
949
|
-
import { useCapability as useCapability4
|
|
951
|
+
import { useMemo as useMemo8 } from "react";
|
|
952
|
+
import { useCapability as useCapability4 } from "@dxos/app-framework/ui";
|
|
950
953
|
import { useAppGraph as useAppGraph8 } from "@dxos/app-toolkit/ui";
|
|
951
954
|
import { Node as Node5, useActionRunner as useActionRunner3 } from "@dxos/plugin-graph";
|
|
952
955
|
import { useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
@@ -956,12 +959,12 @@ var useNavbarActions = () => {
|
|
|
956
959
|
const { t } = useTranslation7(meta.id);
|
|
957
960
|
const { graph } = useAppGraph8();
|
|
958
961
|
const runAction = useActionRunner3();
|
|
959
|
-
const { invokeSync } = useOperationInvoker5();
|
|
960
962
|
const stateAtom = useCapability4(SimpleLayoutState);
|
|
961
|
-
const
|
|
963
|
+
const { updateState } = useSimpleLayoutState();
|
|
964
|
+
const actionsAtom = useMemo8(() => Atom3.make((get) => {
|
|
962
965
|
const { nodes, edges } = createCompanionActions(graph, stateAtom, get, {
|
|
963
966
|
idPrefix: "navbar",
|
|
964
|
-
|
|
967
|
+
updateState
|
|
965
968
|
});
|
|
966
969
|
const gapSeparator = createGapSeparator2("navbar-gap");
|
|
967
970
|
nodes.push(...gapSeparator.nodes);
|
|
@@ -996,7 +999,7 @@ var useNavbarActions = () => {
|
|
|
996
999
|
}), [
|
|
997
1000
|
graph,
|
|
998
1001
|
stateAtom,
|
|
999
|
-
|
|
1002
|
+
updateState,
|
|
1000
1003
|
t
|
|
1001
1004
|
]);
|
|
1002
1005
|
return {
|
|
@@ -1039,24 +1042,24 @@ var Dialog = () => {
|
|
|
1039
1042
|
};
|
|
1040
1043
|
|
|
1041
1044
|
// src/components/SimpleLayout/Drawer.tsx
|
|
1042
|
-
import React10, { useMemo as
|
|
1045
|
+
import React10, { useMemo as useMemo9 } from "react";
|
|
1043
1046
|
import { Surface as Surface4 } from "@dxos/app-framework/ui";
|
|
1047
|
+
import { getCompanionVariant as getCompanionVariant2 } from "@dxos/app-toolkit";
|
|
1044
1048
|
import { useAppGraph as useAppGraph9 } from "@dxos/app-toolkit/ui";
|
|
1045
1049
|
import { useNode as useNode3 } from "@dxos/plugin-graph";
|
|
1046
1050
|
import { ErrorFallback as ErrorFallback3, Panel as Panel3 } from "@dxos/react-ui";
|
|
1047
|
-
import { ATTENDABLE_PATH_SEPARATOR as ATTENDABLE_PATH_SEPARATOR2 } from "@dxos/react-ui-attention";
|
|
1048
1051
|
import { Menu as Menu3, useMenuActions as useMenuActions3 } from "@dxos/react-ui-menu";
|
|
1049
1052
|
var DRAWER_NAME = "SimpleLayout.Drawer";
|
|
1050
1053
|
var Drawer = () => {
|
|
1051
1054
|
const { graph } = useAppGraph9();
|
|
1052
1055
|
const { state: layoutState } = useSimpleLayoutState();
|
|
1053
|
-
const placeholder =
|
|
1056
|
+
const placeholder = useMemo9(() => /* @__PURE__ */ React10.createElement(ContentLoading, null), []);
|
|
1054
1057
|
const activeId = layoutState.active ?? layoutState.workspace;
|
|
1055
1058
|
const companions = useCompanions(activeId);
|
|
1056
1059
|
const { companionId, variant } = useSelectedCompanion(companions, layoutState.companionVariant);
|
|
1057
1060
|
const node = useNode3(graph, companionId);
|
|
1058
1061
|
const parentNode = useNode3(graph, activeId);
|
|
1059
|
-
const data =
|
|
1062
|
+
const data = useMemo9(() => {
|
|
1060
1063
|
return node && {
|
|
1061
1064
|
attendableId: companionId,
|
|
1062
1065
|
subject: node.data,
|
|
@@ -1089,23 +1092,13 @@ var Drawer = () => {
|
|
|
1089
1092
|
})));
|
|
1090
1093
|
};
|
|
1091
1094
|
Drawer.displayName = DRAWER_NAME;
|
|
1092
|
-
var parseEntryId = (entryId) => {
|
|
1093
|
-
const [id, variant] = entryId.split(ATTENDABLE_PATH_SEPARATOR2);
|
|
1094
|
-
return {
|
|
1095
|
-
id,
|
|
1096
|
-
variant
|
|
1097
|
-
};
|
|
1098
|
-
};
|
|
1099
1095
|
var useSelectedCompanion = (companions, preferredVariant) => {
|
|
1100
|
-
const selectedCompanion =
|
|
1096
|
+
const selectedCompanion = useMemo9(() => {
|
|
1101
1097
|
if (companions.length === 0) {
|
|
1102
1098
|
return void 0;
|
|
1103
1099
|
}
|
|
1104
1100
|
if (preferredVariant) {
|
|
1105
|
-
const preferred = companions.find((c) =>
|
|
1106
|
-
const { variant: variant2 } = parseEntryId(c.id);
|
|
1107
|
-
return variant2 === preferredVariant;
|
|
1108
|
-
});
|
|
1101
|
+
const preferred = companions.find((c) => getCompanionVariant2(c.id) === preferredVariant);
|
|
1109
1102
|
if (preferred) {
|
|
1110
1103
|
return preferred;
|
|
1111
1104
|
}
|
|
@@ -1116,7 +1109,7 @@ var useSelectedCompanion = (companions, preferredVariant) => {
|
|
|
1116
1109
|
preferredVariant
|
|
1117
1110
|
]);
|
|
1118
1111
|
const companionId = selectedCompanion?.id;
|
|
1119
|
-
const
|
|
1112
|
+
const variant = companionId ? getCompanionVariant2(companionId) : void 0;
|
|
1120
1113
|
return {
|
|
1121
1114
|
selectedCompanion,
|
|
1122
1115
|
companionId,
|
|
@@ -1166,6 +1159,6 @@ var SimpleLayout = () => {
|
|
|
1166
1159
|
export {
|
|
1167
1160
|
Home,
|
|
1168
1161
|
SimpleLayout,
|
|
1169
|
-
|
|
1162
|
+
NavBranch
|
|
1170
1163
|
};
|
|
1171
|
-
//# sourceMappingURL=chunk-
|
|
1164
|
+
//# sourceMappingURL=chunk-DCKASLMP.mjs.map
|