@dxos/plugin-deck 0.7.5-labs.e27f9b9 → 0.7.5-main.2567c87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/lib/browser/{app-graph-builder-CI6ZFMNL.mjs → app-graph-builder-67VRUD5K.mjs} +31 -57
  2. package/dist/lib/browser/app-graph-builder-67VRUD5K.mjs.map +7 -0
  3. package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs → check-app-scheme-GEX6W2R5.mjs} +3 -3
  4. package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs.map → check-app-scheme-GEX6W2R5.mjs.map} +2 -2
  5. package/dist/lib/browser/chunk-2M4PXYNB.mjs +1052 -0
  6. package/dist/lib/browser/chunk-2M4PXYNB.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-2PJNBVCY.mjs +39 -0
  8. package/dist/lib/browser/chunk-2PJNBVCY.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-4C2AFTET.mjs +186 -0
  10. package/dist/lib/browser/chunk-4C2AFTET.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-YQ2GWTDU.mjs → chunk-5VFDMW5M.mjs} +2 -2
  12. package/dist/lib/browser/chunk-5VFDMW5M.mjs.map +7 -0
  13. package/dist/lib/browser/{chunk-N7TEPFVR.mjs → chunk-JQJ5UWVB.mjs} +2 -3
  14. package/dist/lib/browser/{chunk-N7TEPFVR.mjs.map → chunk-JQJ5UWVB.mjs.map} +3 -3
  15. package/dist/lib/browser/chunk-KY5WXIXY.mjs +44 -0
  16. package/dist/lib/browser/chunk-KY5WXIXY.mjs.map +7 -0
  17. package/dist/lib/browser/deck-PLCSKPGL.mjs +26 -0
  18. package/dist/lib/browser/deck-PLCSKPGL.mjs.map +7 -0
  19. package/dist/lib/browser/index.mjs +76 -36
  20. package/dist/lib/browser/index.mjs.map +4 -4
  21. package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs +152 -0
  22. package/dist/lib/browser/intent-resolver-FVOQSTBX.mjs.map +7 -0
  23. package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs +249 -0
  24. package/dist/lib/browser/intent-resolver-K7GW4A2I.mjs.map +7 -0
  25. package/dist/lib/browser/location-QHRBQBQN.mjs +35 -0
  26. package/dist/lib/browser/location-QHRBQBQN.mjs.map +7 -0
  27. package/dist/lib/browser/meta.json +1 -1
  28. package/dist/lib/browser/react-context-3BDW7W2N.mjs +32 -0
  29. package/dist/lib/browser/react-context-3BDW7W2N.mjs.map +7 -0
  30. package/dist/lib/browser/{react-root-HIHLRMCW.mjs → react-root-UL7ZDRVZ.mjs} +14 -10
  31. package/dist/lib/browser/react-root-UL7ZDRVZ.mjs.map +7 -0
  32. package/dist/lib/browser/react-surface-VPNOGGNN.mjs +28 -0
  33. package/dist/lib/browser/react-surface-VPNOGGNN.mjs.map +7 -0
  34. package/dist/lib/browser/{settings-WACNLCPB.mjs → settings-FNWW6WIJ.mjs} +7 -6
  35. package/dist/lib/browser/settings-FNWW6WIJ.mjs.map +7 -0
  36. package/dist/lib/browser/state-7I5BD7SE.mjs +34 -0
  37. package/dist/lib/browser/state-7I5BD7SE.mjs.map +7 -0
  38. package/dist/lib/browser/types.mjs +4 -16
  39. package/dist/lib/browser/url-handler-Z5B7LD3N.mjs +76 -0
  40. package/dist/lib/browser/url-handler-Z5B7LD3N.mjs.map +7 -0
  41. package/dist/types/src/DeckPlugin.d.ts.map +1 -1
  42. package/dist/types/src/capabilities/capabilities.d.ts +3 -132
  43. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  44. package/dist/types/src/capabilities/index.d.ts +3 -188
  45. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  46. package/dist/types/src/capabilities/{app-graph-builder.d.ts → layout/app-graph-builder.d.ts} +22 -22
  47. package/dist/types/src/capabilities/layout/app-graph-builder.d.ts.map +1 -0
  48. package/dist/types/src/capabilities/layout/deck.d.ts +4 -0
  49. package/dist/types/src/capabilities/layout/deck.d.ts.map +1 -0
  50. package/dist/types/src/capabilities/layout/index.d.ts +229 -0
  51. package/dist/types/src/capabilities/layout/index.d.ts.map +1 -0
  52. package/dist/types/src/capabilities/layout/intent-resolver.d.ts.map +1 -0
  53. package/dist/types/src/capabilities/layout/react-context.d.ts +8 -0
  54. package/dist/types/src/capabilities/layout/react-context.d.ts.map +1 -0
  55. package/dist/types/src/capabilities/layout/react-root.d.ts.map +1 -0
  56. package/dist/types/src/capabilities/layout/state.d.ts +42 -0
  57. package/dist/types/src/capabilities/layout/state.d.ts.map +1 -0
  58. package/dist/types/src/capabilities/navigation/check-app-scheme.d.ts.map +1 -0
  59. package/dist/types/src/capabilities/navigation/index.d.ts +5 -0
  60. package/dist/types/src/capabilities/navigation/index.d.ts.map +1 -0
  61. package/dist/types/src/capabilities/navigation/intent-resolver.d.ts +4 -0
  62. package/dist/types/src/capabilities/navigation/intent-resolver.d.ts.map +1 -0
  63. package/dist/types/src/capabilities/navigation/location.d.ts +4 -0
  64. package/dist/types/src/capabilities/navigation/location.d.ts.map +1 -0
  65. package/dist/types/src/capabilities/navigation/set-location.d.ts +10 -0
  66. package/dist/types/src/capabilities/navigation/set-location.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/navigation/url-handler.d.ts.map +1 -0
  68. package/dist/types/src/capabilities/settings/index.d.ts +3 -0
  69. package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
  70. package/dist/types/src/capabilities/settings/react-surface.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
  72. package/dist/types/src/components/DeckContext.d.ts +11 -0
  73. package/dist/types/src/components/DeckContext.d.ts.map +1 -0
  74. package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
  75. package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
  76. package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
  77. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +4 -1
  78. package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
  79. package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +1 -1
  80. package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +3 -3
  81. package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
  82. package/dist/types/src/components/DeckLayout/Plank.d.ts +6 -8
  83. package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
  84. package/dist/types/src/components/DeckLayout/PlankControls.d.ts +2 -2
  85. package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
  86. package/dist/types/src/components/DeckLayout/PlankError.d.ts +3 -4
  87. package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
  88. package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
  89. package/dist/types/src/components/DeckLayout/SidebarButton.d.ts +3 -5
  90. package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +1 -1
  91. package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
  92. package/dist/types/src/components/DeckLayout/Toast.d.ts +2 -2
  93. package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
  94. package/dist/types/src/components/LayoutContext.d.ts +5 -0
  95. package/dist/types/src/components/LayoutContext.d.ts.map +1 -0
  96. package/dist/types/src/components/fragments.d.ts +0 -2
  97. package/dist/types/src/components/fragments.d.ts.map +1 -1
  98. package/dist/types/src/components/index.d.ts +2 -0
  99. package/dist/types/src/components/index.d.ts.map +1 -1
  100. package/dist/types/src/hooks/useMainSize.d.ts +2 -2
  101. package/dist/types/src/layout.d.ts +19 -5
  102. package/dist/types/src/layout.d.ts.map +1 -1
  103. package/dist/types/src/layout.test.d.ts +2 -0
  104. package/dist/types/src/layout.test.d.ts.map +1 -0
  105. package/dist/types/src/meta.d.ts +0 -1
  106. package/dist/types/src/meta.d.ts.map +1 -1
  107. package/dist/types/src/translations.d.ts +3 -3
  108. package/dist/types/src/types.d.ts +2 -107
  109. package/dist/types/src/types.d.ts.map +1 -1
  110. package/dist/types/src/util/index.d.ts +1 -2
  111. package/dist/types/src/util/index.d.ts.map +1 -1
  112. package/dist/types/src/util/layout-parts.d.ts +7 -0
  113. package/dist/types/src/util/layout-parts.d.ts.map +1 -0
  114. package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
  115. package/package.json +31 -32
  116. package/src/DeckPlugin.ts +57 -17
  117. package/src/capabilities/capabilities.ts +3 -4
  118. package/src/capabilities/index.ts +3 -12
  119. package/src/capabilities/{app-graph-builder.ts → layout/app-graph-builder.ts} +28 -36
  120. package/src/capabilities/layout/deck.ts +25 -0
  121. package/src/capabilities/layout/index.ts +12 -0
  122. package/src/capabilities/layout/intent-resolver.ts +128 -0
  123. package/src/capabilities/layout/react-context.tsx +26 -0
  124. package/src/capabilities/{react-root.tsx → layout/react-root.tsx} +11 -7
  125. package/src/capabilities/layout/state.ts +32 -0
  126. package/src/capabilities/{check-app-scheme.ts → navigation/check-app-scheme.ts} +2 -2
  127. package/src/capabilities/navigation/index.ts +10 -0
  128. package/src/capabilities/navigation/intent-resolver.ts +216 -0
  129. package/src/capabilities/navigation/location.ts +28 -0
  130. package/src/capabilities/navigation/set-location.ts +38 -0
  131. package/src/capabilities/navigation/url-handler.ts +67 -0
  132. package/src/capabilities/settings/index.ts +8 -0
  133. package/src/capabilities/settings/react-surface.tsx +23 -0
  134. package/src/capabilities/{settings.ts → settings/settings.ts} +5 -4
  135. package/src/components/DeckContext.ts +19 -0
  136. package/src/components/DeckLayout/ActiveNode.tsx +3 -2
  137. package/src/components/DeckLayout/ComplementarySidebar.tsx +69 -120
  138. package/src/components/DeckLayout/ContentEmpty.tsx +10 -7
  139. package/src/components/DeckLayout/DeckLayout.tsx +61 -103
  140. package/src/components/DeckLayout/Fullscreen.tsx +3 -2
  141. package/src/components/DeckLayout/NodePlankHeading.tsx +65 -57
  142. package/src/components/DeckLayout/Plank.tsx +41 -32
  143. package/src/components/DeckLayout/PlankControls.tsx +10 -11
  144. package/src/components/DeckLayout/PlankError.tsx +5 -6
  145. package/src/components/DeckLayout/Sidebar.tsx +20 -17
  146. package/src/components/DeckLayout/SidebarButton.tsx +31 -25
  147. package/src/components/DeckLayout/StatusBar.tsx +11 -5
  148. package/src/components/DeckLayout/Toast.tsx +2 -2
  149. package/src/components/LayoutContext.ts +12 -0
  150. package/src/components/LayoutSettings.tsx +8 -8
  151. package/src/components/fragments.ts +0 -8
  152. package/src/components/index.ts +2 -0
  153. package/src/hooks/useMainSize.ts +3 -3
  154. package/src/layout.test.ts +380 -0
  155. package/src/layout.ts +212 -43
  156. package/src/meta.ts +0 -1
  157. package/src/translations.ts +8 -8
  158. package/src/types.ts +2 -88
  159. package/src/util/index.ts +1 -2
  160. package/src/util/layout-parts.ts +12 -0
  161. package/src/util/useHoistStatusbar.ts +8 -17
  162. package/dist/lib/browser/app-graph-builder-CI6ZFMNL.mjs.map +0 -7
  163. package/dist/lib/browser/chunk-BTDY6SES.mjs +0 -1119
  164. package/dist/lib/browser/chunk-BTDY6SES.mjs.map +0 -7
  165. package/dist/lib/browser/chunk-FZOBKOA2.mjs +0 -24
  166. package/dist/lib/browser/chunk-FZOBKOA2.mjs.map +0 -7
  167. package/dist/lib/browser/chunk-M2L53AIH.mjs +0 -126
  168. package/dist/lib/browser/chunk-M2L53AIH.mjs.map +0 -7
  169. package/dist/lib/browser/chunk-YQ2GWTDU.mjs.map +0 -7
  170. package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs +0 -494
  171. package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs.map +0 -7
  172. package/dist/lib/browser/react-root-HIHLRMCW.mjs.map +0 -7
  173. package/dist/lib/browser/react-surface-4QVWKQYY.mjs +0 -38
  174. package/dist/lib/browser/react-surface-4QVWKQYY.mjs.map +0 -7
  175. package/dist/lib/browser/settings-WACNLCPB.mjs.map +0 -7
  176. package/dist/lib/browser/state-VPOYUKK6.mjs +0 -117
  177. package/dist/lib/browser/state-VPOYUKK6.mjs.map +0 -7
  178. package/dist/lib/browser/tools-5LDJNU56.mjs +0 -51
  179. package/dist/lib/browser/tools-5LDJNU56.mjs.map +0 -7
  180. package/dist/lib/browser/url-handler-HLF42IHP.mjs +0 -70
  181. package/dist/lib/browser/url-handler-HLF42IHP.mjs.map +0 -7
  182. package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
  183. package/dist/types/src/capabilities/check-app-scheme.d.ts.map +0 -1
  184. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  185. package/dist/types/src/capabilities/react-root.d.ts.map +0 -1
  186. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  187. package/dist/types/src/capabilities/set-active.d.ts +0 -9
  188. package/dist/types/src/capabilities/set-active.d.ts.map +0 -1
  189. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  190. package/dist/types/src/capabilities/state.d.ts +0 -76
  191. package/dist/types/src/capabilities/state.d.ts.map +0 -1
  192. package/dist/types/src/capabilities/tools.d.ts +0 -10
  193. package/dist/types/src/capabilities/tools.d.ts.map +0 -1
  194. package/dist/types/src/capabilities/url-handler.d.ts.map +0 -1
  195. package/dist/types/src/util/layoutAppliesTopbar.d.ts +0 -2
  196. package/dist/types/src/util/layoutAppliesTopbar.d.ts.map +0 -1
  197. package/src/capabilities/intent-resolver.ts +0 -350
  198. package/src/capabilities/react-surface.tsx +0 -31
  199. package/src/capabilities/set-active.ts +0 -43
  200. package/src/capabilities/state.ts +0 -102
  201. package/src/capabilities/tools.ts +0 -61
  202. package/src/capabilities/url-handler.ts +0 -63
  203. package/src/util/layoutAppliesTopbar.ts +0 -7
  204. /package/dist/types/src/capabilities/{intent-resolver.d.ts → layout/intent-resolver.d.ts} +0 -0
  205. /package/dist/types/src/capabilities/{react-root.d.ts → layout/react-root.d.ts} +0 -0
  206. /package/dist/types/src/capabilities/{check-app-scheme.d.ts → navigation/check-app-scheme.d.ts} +0 -0
  207. /package/dist/types/src/capabilities/{url-handler.d.ts → navigation/url-handler.d.ts} +0 -0
  208. /package/dist/types/src/capabilities/{react-surface.d.ts → settings/react-surface.d.ts} +0 -0
  209. /package/dist/types/src/capabilities/{settings.d.ts → settings/settings.d.ts} +0 -0
@@ -0,0 +1,216 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { batch } from '@preact/signals-core';
6
+ import { pipe } from 'effect';
7
+
8
+ import {
9
+ Capabilities,
10
+ chain,
11
+ contributes,
12
+ createIntent,
13
+ createResolver,
14
+ LayoutAction,
15
+ NavigationAction,
16
+ openIds,
17
+ SLUG_PATH_SEPARATOR,
18
+ type LayoutEntry,
19
+ type LayoutPart,
20
+ type PluginsContext,
21
+ } from '@dxos/app-framework';
22
+ import { isReactiveObject, getTypename } from '@dxos/live-object';
23
+ import { AttentionCapabilities } from '@dxos/plugin-attention';
24
+ import { ObservabilityAction } from '@dxos/plugin-observability/types';
25
+
26
+ import { setLocation } from './set-location';
27
+ import { closeEntry, incrementPlank, openEntry } from '../../layout';
28
+ import { DECK_PLUGIN } from '../../meta';
29
+ import { type DeckSettingsProps } from '../../types';
30
+ import { getEffectivePart } from '../../util';
31
+
32
+ // TODO(wittjosiah): Factor out navgiation from deck plugin.
33
+ export default (context: PluginsContext) =>
34
+ contributes(Capabilities.IntentResolver, [
35
+ createResolver(NavigationAction.Open, (data) => {
36
+ const { graph } = context.requestCapability(Capabilities.AppGraph);
37
+ const location = context.requestCapability(Capabilities.MutableLocation);
38
+ const layout = context.requestCapability(Capabilities.MutableLayout);
39
+ const attention = context.requestCapability(AttentionCapabilities.Attention);
40
+ const settings = context
41
+ .requestCapabilities(Capabilities.SettingsStore)[0]
42
+ ?.getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;
43
+
44
+ const previouslyOpenIds = new Set<string>(openIds(location.active));
45
+ const layoutMode = layout.layoutMode;
46
+ const toAttend = batch(() => {
47
+ const processLayoutEntry = (partName: string, entryString: string, currentLayout: any) => {
48
+ // TODO(burdon): Option to toggle?
49
+ const toggle = false;
50
+ const [id, path] = entryString.split(SLUG_PATH_SEPARATOR);
51
+ const layoutEntry: LayoutEntry = { id, ...(path ? { path } : {}) };
52
+ const effectivePart = getEffectivePart(partName as LayoutPart, layoutMode);
53
+ if (
54
+ toggle &&
55
+ layoutMode === 'deck' &&
56
+ effectivePart === 'main' &&
57
+ currentLayout[effectivePart]?.some((entry: LayoutEntry) => entry.id === id) &&
58
+ !data?.noToggle
59
+ ) {
60
+ // If we're in deck mode and the main part is already open, toggle it closed.
61
+ return closeEntry(currentLayout, { part: effectivePart as LayoutPart, entryId: id });
62
+ } else {
63
+ return openEntry(currentLayout, effectivePart, layoutEntry, {
64
+ positioning: settings?.newPlankPositioning,
65
+ });
66
+ }
67
+ };
68
+
69
+ let newLayout = location.active;
70
+ Object.entries(data.activeParts).forEach(([partName, layoutEntries]) => {
71
+ if (Array.isArray(layoutEntries)) {
72
+ layoutEntries.forEach((activePartEntry: string) => {
73
+ newLayout = processLayoutEntry(partName, activePartEntry, newLayout);
74
+ });
75
+ } else if (typeof layoutEntries === 'string') {
76
+ // Legacy single string entry.
77
+ newLayout = processLayoutEntry(partName, layoutEntries, newLayout);
78
+ }
79
+ });
80
+
81
+ return setLocation({ next: newLayout, layout, location, attention });
82
+ });
83
+
84
+ const ids = openIds(location.active);
85
+ const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
86
+
87
+ return {
88
+ data: { open: ids },
89
+ intents: [
90
+ createIntent(LayoutAction.ScrollIntoView, { id: newlyOpen[0] ?? toAttend }),
91
+ ...(toAttend ? [createIntent(NavigationAction.Expose, { id: toAttend })] : []),
92
+ ...newlyOpen.map((id) => {
93
+ const active = graph?.findNode(id)?.data;
94
+ const typename = isReactiveObject(active) ? getTypename(active) : undefined;
95
+ return createIntent(ObservabilityAction.SendEvent, {
96
+ name: 'navigation.activate',
97
+ properties: {
98
+ id,
99
+ typename,
100
+ },
101
+ });
102
+ }),
103
+ ],
104
+ };
105
+ }),
106
+ createResolver(NavigationAction.AddToActive, (data) => {
107
+ const location = context.requestCapability(Capabilities.MutableLocation);
108
+ const layout = context.requestCapability(Capabilities.MutableLayout);
109
+ const attention = context.requestCapability(AttentionCapabilities.Attention);
110
+ const settings = context
111
+ .requestCapabilities(Capabilities.SettingsStore)[0]
112
+ ?.getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;
113
+
114
+ const layoutEntry = { id: data.id };
115
+ const effectivePart = getEffectivePart(data.part, layout.layoutMode);
116
+
117
+ setLocation({
118
+ next: openEntry(location.active, effectivePart, layoutEntry, {
119
+ positioning: data.positioning ?? settings?.newPlankPositioning,
120
+ pivotId: data.pivotId,
121
+ }),
122
+ layout,
123
+ location,
124
+ attention,
125
+ });
126
+
127
+ const intents = [];
128
+ if (data.scrollIntoView && layout.layoutMode === 'deck') {
129
+ intents.push(createIntent(LayoutAction.ScrollIntoView, { id: data.id }));
130
+ }
131
+
132
+ return { intents };
133
+ }),
134
+ createResolver(NavigationAction.Close, (data) => {
135
+ const location = context.requestCapability(Capabilities.MutableLocation);
136
+ const layout = context.requestCapability(Capabilities.MutableLayout);
137
+ const attention = context.requestCapability(AttentionCapabilities.Attention);
138
+
139
+ let newLayout = location.active;
140
+ const layoutMode = layout.layoutMode;
141
+ const intentParts = data.activeParts;
142
+ Object.keys(intentParts).forEach((partName: string) => {
143
+ const effectivePart = getEffectivePart(partName as LayoutPart, layoutMode);
144
+ const ids = intentParts[partName];
145
+ if (Array.isArray(ids)) {
146
+ ids.forEach((id: string) => {
147
+ newLayout = closeEntry(newLayout, { part: effectivePart, entryId: id });
148
+ });
149
+ } else {
150
+ // Legacy single string entry
151
+ newLayout = closeEntry(newLayout, { part: effectivePart, entryId: ids });
152
+ }
153
+ });
154
+
155
+ const toAttend = setLocation({ next: newLayout, layout, location, attention });
156
+ return { intents: [createIntent(LayoutAction.ScrollIntoView, { id: toAttend })] };
157
+ }),
158
+ createResolver(NavigationAction.Set, (data) => {
159
+ const layout = context.requestCapability(Capabilities.MutableLayout);
160
+ const location = context.requestCapability(Capabilities.MutableLocation);
161
+ const attention = context.requestCapability(AttentionCapabilities.Attention);
162
+
163
+ return batch(() => {
164
+ const toAttend = setLocation({ next: data.activeParts, layout, location, attention });
165
+ return { intents: [createIntent(LayoutAction.ScrollIntoView, { id: toAttend })] };
166
+ });
167
+ }),
168
+ createResolver(NavigationAction.Adjust, (adjustment) => {
169
+ const location = context.requestCapability(Capabilities.MutableLocation);
170
+ const layout = context.requestCapability(Capabilities.MutableLayout);
171
+ const attention = context.requestCapability(AttentionCapabilities.Attention);
172
+
173
+ return batch(() => {
174
+ if (adjustment.type === 'increment-end' || adjustment.type === 'increment-start') {
175
+ setLocation({
176
+ next: incrementPlank(location.active, {
177
+ type: adjustment.type,
178
+ layoutCoordinate: adjustment.layoutCoordinate,
179
+ }),
180
+ layout,
181
+ location,
182
+ attention,
183
+ });
184
+ }
185
+
186
+ if (adjustment.type === 'solo') {
187
+ const entryId = adjustment.layoutCoordinate.entryId;
188
+ if (layout.layoutMode !== 'solo') {
189
+ // Solo the entry.
190
+ return {
191
+ intents: [
192
+ // NOTE: The order of these is important.
193
+ pipe(
194
+ createIntent(NavigationAction.Open, { activeParts: { solo: [entryId] } }),
195
+ chain(LayoutAction.SetLayoutMode, { layoutMode: 'solo' }),
196
+ ),
197
+ ],
198
+ };
199
+ } else {
200
+ // Un-solo the current entry.
201
+ return {
202
+ intents: [
203
+ // NOTE: The order of these is important.
204
+ pipe(
205
+ createIntent(LayoutAction.SetLayoutMode, { layoutMode: 'deck' }),
206
+ chain(NavigationAction.Close, { activeParts: { solo: [entryId] } }),
207
+ chain(NavigationAction.Open, { activeParts: { main: [entryId] }, noToggle: true }),
208
+ chain(LayoutAction.ScrollIntoView, { id: entryId }),
209
+ ),
210
+ ],
211
+ };
212
+ }
213
+ }
214
+ });
215
+ }),
216
+ ]);
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Capabilities, contributes, type LayoutParts } from '@dxos/app-framework';
6
+ import { LocalStorageStore } from '@dxos/local-storage';
7
+
8
+ import { NAV_ID } from '../../components';
9
+
10
+ // NOTE: The key is this currently for backwards compatibility of storage.
11
+ const LOCATION_KEY = 'dxos.org/settings/layout';
12
+
13
+ export default () => {
14
+ // TODO(wittjosiah): This active state is not a generic navigation state but quite deck specific.
15
+ // It is also closely tied to the layout mode state (which also seems quite deck specific).
16
+ // The layout and navigation interfaces need to be revisited and cleaned up.
17
+ // Doing this cleanup should also help simplify some of the convoluted logic for managing it.
18
+ const location = new LocalStorageStore<Capabilities.MutableLocation>(LOCATION_KEY, {
19
+ active: { sidebar: [{ id: NAV_ID }] },
20
+ closed: [],
21
+ });
22
+
23
+ location
24
+ .prop({ key: 'active', type: LocalStorageStore.json<LayoutParts>() })
25
+ .prop({ key: 'closed', type: LocalStorageStore.json<string[]>() });
26
+
27
+ return contributes(Capabilities.Location, location.values, () => location.close());
28
+ };
@@ -0,0 +1,38 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { openIds, type Layout, type LayoutParts, type Capabilities } from '@dxos/app-framework';
6
+ import { type AttentionManager } from '@dxos/plugin-attention';
7
+
8
+ export type SetLocationOptions = {
9
+ next: LayoutParts;
10
+ location: Capabilities.MutableLocation;
11
+ layout: Layout;
12
+ attention?: AttentionManager;
13
+ };
14
+
15
+ export const setLocation = ({ next, location, layout, attention }: SetLocationOptions) => {
16
+ const part = layout.layoutMode === 'solo' ? 'solo' : 'main';
17
+ const ids = openIds(next, [part]);
18
+
19
+ const current = openIds(location.active, [part]);
20
+ const removed = current.filter((id) => !ids.includes(id));
21
+ const closed = Array.from(new Set([...location.closed.filter((id) => !ids.includes(id)), ...removed]));
22
+
23
+ location.closed = closed;
24
+ location.active = next;
25
+
26
+ if (attention) {
27
+ const attended = attention.current;
28
+ const [attendedId] = Array.from(attended);
29
+ const isAttendedAvailable = !!attendedId && ids.includes(attendedId);
30
+ if (!isAttendedAvailable) {
31
+ const currentIds = location.active[part]?.map(({ id }) => id) ?? [];
32
+ const attendedIndex = currentIds.indexOf(attendedId);
33
+ // If outside of bounds, focus on the first/last plank, otherwise focus on the new plank in the same position.
34
+ const index = attendedIndex === -1 ? 0 : attendedIndex >= ids.length ? ids.length - 1 : attendedIndex;
35
+ return next[part]?.[index].id;
36
+ }
37
+ }
38
+ };
@@ -0,0 +1,67 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import {
6
+ Capabilities,
7
+ contributes,
8
+ createIntent,
9
+ LayoutAction,
10
+ type LayoutParts,
11
+ type PluginsContext,
12
+ } from '@dxos/app-framework';
13
+ import { scheduledEffect } from '@dxos/echo-signals/core';
14
+ import { AttentionCapabilities } from '@dxos/plugin-attention';
15
+
16
+ import { setLocation as naturalSetLocation } from './set-location';
17
+ import { NAV_ID } from '../../components';
18
+ import { mergeLayoutParts, removePart, soloPartToUri, uriToSoloPart } from '../../layout';
19
+
20
+ export default async (context: PluginsContext) => {
21
+ const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher) ?? {};
22
+ const location = context.requestCapability(Capabilities.MutableLocation);
23
+ const layout = context.requestCapability(Capabilities.MutableLayout);
24
+ const attention = context.requestCapability(AttentionCapabilities.Attention);
25
+
26
+ const handleNavigation = async () => {
27
+ const setLocation = (next: LayoutParts) => naturalSetLocation({ next, layout, location, attention });
28
+
29
+ const pathname = window.location.pathname;
30
+ if (pathname === '/reset') {
31
+ setLocation({ sidebar: [{ id: NAV_ID }] });
32
+ location.closed = [];
33
+ layout.layoutMode = 'solo';
34
+ window.location.pathname = '/';
35
+ return;
36
+ }
37
+
38
+ const startingLayout = removePart(location.active, 'solo');
39
+ const layoutFromUri = uriToSoloPart(pathname);
40
+ if (!layoutFromUri) {
41
+ const toAttend = setLocation(startingLayout);
42
+ layout.layoutMode = 'deck';
43
+ await dispatch?.(createIntent(LayoutAction.ScrollIntoView, { id: toAttend }));
44
+ return;
45
+ }
46
+
47
+ const toAttend = setLocation(mergeLayoutParts(layoutFromUri, startingLayout));
48
+ layout.layoutMode = 'solo';
49
+ await dispatch?.(createIntent(LayoutAction.ScrollIntoView, { id: toAttend }));
50
+ };
51
+
52
+ await handleNavigation();
53
+ window.addEventListener('popstate', handleNavigation);
54
+
55
+ const unsubscribe = scheduledEffect(
56
+ () => ({ selectedPath: soloPartToUri(location.active) }),
57
+ ({ selectedPath }) => {
58
+ // TODO(thure): In some browsers, this only preserves the most recent state change, even though this is not `history.replace`…
59
+ history.pushState(null, '', `/${selectedPath}${window.location.search}`);
60
+ },
61
+ );
62
+
63
+ return contributes(Capabilities.Null, null, () => {
64
+ window.removeEventListener('popstate', handleNavigation);
65
+ unsubscribe();
66
+ });
67
+ };
@@ -0,0 +1,8 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { lazy } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = lazy(() => import('./react-surface'));
8
+ export const DeckSettings = lazy(() => import('./settings'));
@@ -0,0 +1,23 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Capabilities, contributes, useCapability } from '@dxos/app-framework';
8
+
9
+ import { LayoutSettings } from '../../components';
10
+ import { DECK_PLUGIN } from '../../meta';
11
+ import { type DeckSettingsProps } from '../../types';
12
+
13
+ export default () =>
14
+ contributes(Capabilities.ReactSurface, {
15
+ id: DECK_PLUGIN,
16
+ role: 'settings',
17
+ filter: (data): data is any => data.subject === DECK_PLUGIN,
18
+ component: () => {
19
+ const store = useCapability(Capabilities.SettingsStore);
20
+ const settings = store.getStore<DeckSettingsProps>(DECK_PLUGIN)!.value;
21
+ return <LayoutSettings settings={settings} />;
22
+ },
23
+ });
@@ -5,16 +5,17 @@
5
5
  import { Capabilities, contributes } from '@dxos/app-framework';
6
6
  import { create } from '@dxos/live-object';
7
7
 
8
- import { DECK_PLUGIN } from '../meta';
9
- import { DeckSettingsSchema, type DeckSettingsProps } from '../types';
8
+ import { DECK_PLUGIN } from '../../meta';
9
+ import { DeckSettingsSchema, type DeckSettingsProps } from '../../types';
10
10
 
11
11
  export default () => {
12
12
  const settings = create<DeckSettingsProps>({
13
13
  showHints: false,
14
+ customSlots: false,
15
+ flatDeck: false,
14
16
  enableNativeRedirect: false,
15
- enableIdeStyleStatusbar: true,
16
17
  newPlankPositioning: 'start',
17
- overscroll: 'none',
18
+ overscroll: 'centering',
18
19
  });
19
20
 
20
21
  return contributes(Capabilities.Settings, { schema: DeckSettingsSchema, prefix: DECK_PLUGIN, value: settings });
@@ -0,0 +1,19 @@
1
+ //
2
+ // Copyright 2023 DXOS.org
3
+ //
4
+
5
+ import { type Context, createContext, useContext } from 'react';
6
+
7
+ import { type LayoutMode } from '@dxos/app-framework';
8
+ import { raise } from '@dxos/debug';
9
+
10
+ export type PlankSizing = Record<string, number>;
11
+ export type DeckContextType = {
12
+ plankSizing: PlankSizing;
13
+ currentUndoId: string | undefined;
14
+ layoutModeHistory: LayoutMode[];
15
+ };
16
+
17
+ export const DeckContext: Context<DeckContextType | null> = createContext<DeckContextType | null>(null);
18
+
19
+ export const useDeckContext = (): DeckContextType => useContext(DeckContext) ?? raise(new Error('Missing DeckContext'));
@@ -4,7 +4,8 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { Surface, useAppGraph } from '@dxos/app-framework';
7
+ import { Surface } from '@dxos/app-framework';
8
+ import { useGraph } from '@dxos/plugin-graph';
8
9
  import { useAttended } from '@dxos/react-ui-attention';
9
10
 
10
11
  import { useNode, useNodeActionExpander } from '../../hooks';
@@ -12,7 +13,7 @@ import { useNode, useNodeActionExpander } from '../../hooks';
12
13
  // TODO(burdon): Factor out to effect in plugin set document title.
13
14
  export const ActiveNode = () => {
14
15
  const [id] = useAttended();
15
- const { graph } = useAppGraph();
16
+ const { graph } = useGraph();
16
17
  const activeNode = useNode(graph, id);
17
18
  useNodeActionExpander(activeNode);
18
19