@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
@@ -1,494 +0,0 @@
1
- import {
2
- DeckCapabilities
3
- } from "./chunk-YQ2GWTDU.mjs";
4
- import {
5
- DeckAction,
6
- getMode,
7
- isLayoutMode
8
- } from "./chunk-M2L53AIH.mjs";
9
- import {
10
- DECK_PLUGIN
11
- } from "./chunk-N7TEPFVR.mjs";
12
-
13
- // packages/plugins/plugin-deck/src/capabilities/intent-resolver.ts
14
- import { batch as batch2 } from "@preact/signals-core";
15
- import { pipe } from "effect";
16
- import { Capabilities, createResolver, contributes, IntentAction, LayoutAction, createIntent, chain } from "@dxos/app-framework";
17
- import { getTypename, S } from "@dxos/echo-schema";
18
- import { isReactiveObject } from "@dxos/live-object";
19
- import { log } from "@dxos/log";
20
- import { AttentionCapabilities } from "@dxos/plugin-attention";
21
- import { ObservabilityAction } from "@dxos/plugin-observability/types";
22
- import { nonNullable } from "@dxos/util";
23
-
24
- // packages/plugins/plugin-deck/src/capabilities/set-active.ts
25
- import { batch } from "@preact/signals-core";
26
- var setActive = ({ next, state, attention }) => {
27
- return batch(() => {
28
- const active = state.deck.solo ? [
29
- state.deck.solo
30
- ] : state.deck.active;
31
- const removed = active.filter((id) => !next.includes(id));
32
- const closed = Array.from(/* @__PURE__ */ new Set([
33
- ...state.deck.inactive.filter((id) => !next.includes(id)),
34
- ...removed
35
- ]));
36
- state.deck.inactive = closed;
37
- if (state.deck.solo || !state.deck.initialized) {
38
- state.deck.solo = next[0];
39
- } else {
40
- state.deck.active = next;
41
- }
42
- if (attention) {
43
- const attended = attention.current;
44
- const [attendedId] = Array.from(attended);
45
- const isAttendedAvailable = !!attendedId && next.includes(attendedId);
46
- if (!isAttendedAvailable) {
47
- const attendedIndex = active.indexOf(attendedId);
48
- const index = attendedIndex === -1 ? 0 : attendedIndex >= next.length ? next.length - 1 : attendedIndex;
49
- return next[index];
50
- }
51
- }
52
- });
53
- };
54
-
55
- // packages/plugins/plugin-deck/src/layout.ts
56
- import { produce } from "immer";
57
- var openEntry = (deck, entryId, options) => {
58
- return produce(deck, (draft) => {
59
- if (draft.find((id) => id === entryId)) {
60
- return;
61
- }
62
- const key = options?.key;
63
- const plankPositioning = options?.positioning ?? "start";
64
- const pivotId = options?.pivotId;
65
- if (key) {
66
- const index = draft.findIndex((id) => id.startsWith(key));
67
- if (index !== -1) {
68
- draft.splice(index, 1, entryId);
69
- return;
70
- }
71
- }
72
- if (pivotId) {
73
- const pivotIndex = draft.findIndex((id) => id === pivotId);
74
- if (pivotIndex !== -1) {
75
- if (plankPositioning === "start") {
76
- draft.splice(pivotIndex, 0, entryId);
77
- } else {
78
- draft.splice(pivotIndex + 1, 0, entryId);
79
- }
80
- return;
81
- }
82
- }
83
- if (plankPositioning === "start") {
84
- draft.unshift(entryId);
85
- } else {
86
- draft.push(entryId);
87
- }
88
- });
89
- };
90
- var closeEntry = (deck, entryId) => {
91
- return produce(deck, (draft) => {
92
- const index = draft.findIndex((id) => id === entryId);
93
- if (index !== -1) {
94
- draft.splice(index, 1);
95
- }
96
- });
97
- };
98
- var incrementPlank = (deck, adjustment) => {
99
- return produce(deck, (draft) => {
100
- const index = draft.findIndex((id) => id === adjustment.id);
101
- if (index === -1 || adjustment.type === "increment-start" && index === 0 || adjustment.type === "increment-end" && index === draft.length - 1) {
102
- return;
103
- }
104
- if (adjustment.type === "increment-start") {
105
- [draft[index - 1], draft[index]] = [
106
- draft[index],
107
- draft[index - 1]
108
- ];
109
- } else if (adjustment.type === "increment-end") {
110
- [draft[index], draft[index + 1]] = [
111
- draft[index + 1],
112
- draft[index]
113
- ];
114
- }
115
- });
116
- };
117
-
118
- // packages/plugins/plugin-deck/src/capabilities/intent-resolver.ts
119
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-deck/src/capabilities/intent-resolver.ts";
120
- var intent_resolver_default = (context) => contributes(Capabilities.IntentResolver, [
121
- createResolver({
122
- intent: IntentAction.ShowUndo,
123
- resolve: (data) => {
124
- const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
125
- const { undoPromise: undo } = context.requestCapability(Capabilities.IntentDispatcher);
126
- if (layout.currentUndoId) {
127
- layout.toasts = layout.toasts.filter((toast) => toast.id !== layout.currentUndoId);
128
- }
129
- layout.currentUndoId = `${IntentAction.ShowUndo._tag}-${Date.now()}`;
130
- layout.toasts = [
131
- ...layout.toasts,
132
- {
133
- id: layout.currentUndoId,
134
- title: data.message ?? [
135
- "undo available label",
136
- {
137
- ns: DECK_PLUGIN
138
- }
139
- ],
140
- duration: 1e4,
141
- actionLabel: [
142
- "undo action label",
143
- {
144
- ns: DECK_PLUGIN
145
- }
146
- ],
147
- actionAlt: [
148
- "undo action alt",
149
- {
150
- ns: DECK_PLUGIN
151
- }
152
- ],
153
- closeLabel: [
154
- "undo close label",
155
- {
156
- ns: DECK_PLUGIN
157
- }
158
- ],
159
- onAction: () => undo()
160
- }
161
- ];
162
- }
163
- }),
164
- createResolver({
165
- intent: LayoutAction.UpdateLayout,
166
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdateSidebar.fields.input)`
167
- // but the filter is not being applied correctly.
168
- filter: (data) => S.is(LayoutAction.UpdateSidebar.fields.input)(data),
169
- resolve: ({ options }) => {
170
- const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
171
- const next = options?.state ?? layout.sidebarState;
172
- if (next !== layout.sidebarState) {
173
- layout.sidebarState = next;
174
- }
175
- }
176
- }),
177
- createResolver({
178
- intent: LayoutAction.UpdateLayout,
179
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdateComplementary.fields.input)`
180
- // but the filter is not being applied correctly.
181
- filter: (data) => S.is(LayoutAction.UpdateComplementary.fields.input)(data),
182
- resolve: ({ subject, options }) => {
183
- const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
184
- if (layout.complementarySidebarPanel !== subject) {
185
- layout.complementarySidebarPanel = subject;
186
- }
187
- const next = subject ? "expanded" : options?.state ?? layout.complementarySidebarState;
188
- if (next !== layout.complementarySidebarState) {
189
- layout.complementarySidebarState = next;
190
- }
191
- }
192
- }),
193
- createResolver({
194
- intent: LayoutAction.UpdateLayout,
195
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdateDialog.fields.input)`
196
- // but the filter is not being applied correctly.
197
- filter: (data) => S.is(LayoutAction.UpdateDialog.fields.input)(data),
198
- resolve: ({ subject, options }) => {
199
- const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
200
- layout.dialogOpen = options.state ?? Boolean(subject);
201
- layout.dialogContent = subject ? {
202
- component: subject,
203
- props: options.props
204
- } : null;
205
- layout.dialogBlockAlign = options.blockAlign ?? "center";
206
- layout.dialogType = options.type ?? "default";
207
- }
208
- }),
209
- createResolver({
210
- intent: LayoutAction.UpdateLayout,
211
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdatePopover.fields.input)`
212
- // but the filter is not being applied correctly.
213
- filter: (data) => S.is(LayoutAction.UpdatePopover.fields.input)(data),
214
- resolve: ({ subject, options }) => {
215
- const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
216
- layout.popoverOpen = options.state ?? Boolean(subject);
217
- layout.popoverContent = subject ? {
218
- component: subject,
219
- props: options.props
220
- } : null;
221
- layout.popoverAnchorId = options.anchorId;
222
- }
223
- }),
224
- createResolver({
225
- intent: LayoutAction.UpdateLayout,
226
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.AddToast.fields.input)`
227
- // but the filter is not being applied correctly.
228
- filter: (data) => S.is(LayoutAction.AddToast.fields.input)(data),
229
- resolve: ({ subject }) => {
230
- const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
231
- layout.toasts.push(subject);
232
- }
233
- }),
234
- createResolver({
235
- intent: LayoutAction.UpdateLayout,
236
- // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.SetLayoutMode.fields.input)`
237
- // but the filter is not being applied correctly.
238
- filter: (data) => {
239
- if (!S.is(LayoutAction.SetLayoutMode.fields.input)(data)) {
240
- return false;
241
- }
242
- if ("mode" in data.options) {
243
- return isLayoutMode(data.options.mode);
244
- }
245
- return true;
246
- },
247
- resolve: ({ subject, options }) => {
248
- const state = context.requestCapability(DeckCapabilities.MutableDeckState);
249
- const setMode = (mode) => {
250
- const deck = state.deck;
251
- const current = deck.solo ? [
252
- deck.solo
253
- ] : deck.active;
254
- const next = (mode === "solo" ? [
255
- subject ?? deck.solo ?? deck.active[0]
256
- ] : [
257
- ...deck.active,
258
- deck.solo
259
- ]).filter(nonNullable);
260
- const removed = current.filter((id) => !next.includes(id));
261
- const closed = Array.from(/* @__PURE__ */ new Set([
262
- ...deck.inactive.filter((id) => !next.includes(id)),
263
- ...removed
264
- ]));
265
- deck.inactive = closed;
266
- if (mode === "solo" && next[0]) {
267
- deck.solo = next[0];
268
- } else if (mode !== "solo" && deck.solo) {
269
- deck.solo = void 0;
270
- deck.initialized = true;
271
- }
272
- if (mode === "fullscreen" && !deck.fullscreen) {
273
- deck.fullscreen = true;
274
- } else if (mode !== "fullscreen" && deck.fullscreen) {
275
- deck.fullscreen = false;
276
- }
277
- };
278
- return batch2(() => {
279
- if ("mode" in options) {
280
- const current = getMode(state.deck);
281
- if (current !== options.mode) {
282
- state.previousMode[state.activeDeck] = current;
283
- }
284
- setMode(options.mode);
285
- } else if ("revert" in options) {
286
- const last = state.previousMode[state.activeDeck];
287
- setMode(last ?? "solo");
288
- } else {
289
- log.warn("Invalid layout mode", options, {
290
- F: __dxlog_file,
291
- L: 184,
292
- S: void 0,
293
- C: (f, a) => f(...a)
294
- });
295
- }
296
- });
297
- }
298
- }),
299
- createResolver({
300
- intent: LayoutAction.UpdateLayout,
301
- filter: (data) => S.is(LayoutAction.SwitchWorkspace.fields.input)(data),
302
- resolve: ({ subject }) => {
303
- const state = context.requestCapability(DeckCapabilities.MutableDeckState);
304
- batch2(() => {
305
- state.activeDeck = subject;
306
- if (!state.decks[subject]) {
307
- state.decks[subject] = {
308
- initialized: false,
309
- active: [],
310
- inactive: [],
311
- fullscreen: false,
312
- plankSizing: {}
313
- };
314
- }
315
- });
316
- const first = state.decks[state.activeDeck].active[0];
317
- if (first) {
318
- return {
319
- intents: [
320
- createIntent(LayoutAction.ScrollIntoView, {
321
- part: "current",
322
- subject: first
323
- })
324
- ]
325
- };
326
- }
327
- }
328
- }),
329
- createResolver({
330
- intent: LayoutAction.UpdateLayout,
331
- filter: (data) => S.is(LayoutAction.Open.fields.input)(data),
332
- resolve: ({ subject, options }) => {
333
- const { graph } = context.requestCapability(Capabilities.AppGraph);
334
- const state = context.requestCapability(DeckCapabilities.MutableDeckState);
335
- const attention = context.requestCapability(AttentionCapabilities.Attention);
336
- const settings = context.requestCapabilities(Capabilities.SettingsStore)[0]?.getStore(DECK_PLUGIN)?.value;
337
- const previouslyOpenIds = new Set(state.deck.solo ? [
338
- state.deck.solo
339
- ] : state.deck.active);
340
- batch2(() => {
341
- const next = state.deck.solo ? subject : subject.reduce((acc, entryId) => openEntry(acc, entryId, {
342
- key: options?.key,
343
- positioning: options?.positioning ?? settings?.newPlankPositioning,
344
- pivotId: options?.pivotId
345
- }), state.deck.active);
346
- return setActive({
347
- next,
348
- state,
349
- attention
350
- });
351
- });
352
- const ids = state.deck.solo ? [
353
- state.deck.solo
354
- ] : state.deck.active;
355
- const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));
356
- return {
357
- intents: [
358
- ...options?.scrollIntoView !== false ? [
359
- createIntent(LayoutAction.ScrollIntoView, {
360
- part: "current",
361
- subject: newlyOpen[0] ?? subject[0]
362
- })
363
- ] : [],
364
- createIntent(LayoutAction.Expose, {
365
- part: "navigation",
366
- subject: newlyOpen[0] ?? subject[0]
367
- }),
368
- ...newlyOpen.map((id) => {
369
- const active = graph?.findNode(id)?.data;
370
- const typename = isReactiveObject(active) ? getTypename(active) : void 0;
371
- return createIntent(ObservabilityAction.SendEvent, {
372
- name: "navigation.activate",
373
- properties: {
374
- id,
375
- typename
376
- }
377
- });
378
- })
379
- ]
380
- };
381
- }
382
- }),
383
- createResolver({
384
- intent: LayoutAction.UpdateLayout,
385
- filter: (data) => S.is(LayoutAction.Close.fields.input)(data),
386
- resolve: ({ subject }) => {
387
- const state = context.requestCapability(DeckCapabilities.MutableDeckState);
388
- const attention = context.requestCapability(AttentionCapabilities.Attention);
389
- const next = subject.reduce((acc, id) => closeEntry(acc, id), state.deck.active);
390
- const toAttend = setActive({
391
- next,
392
- state,
393
- attention
394
- });
395
- return {
396
- intents: toAttend ? [
397
- createIntent(LayoutAction.ScrollIntoView, {
398
- part: "current",
399
- subject: toAttend
400
- })
401
- ] : []
402
- };
403
- }
404
- }),
405
- createResolver({
406
- intent: LayoutAction.UpdateLayout,
407
- filter: (data) => S.is(LayoutAction.Set.fields.input)(data),
408
- resolve: ({ subject }) => {
409
- const state = context.requestCapability(DeckCapabilities.MutableDeckState);
410
- const attention = context.requestCapability(AttentionCapabilities.Attention);
411
- const toAttend = setActive({
412
- next: subject,
413
- state,
414
- attention
415
- });
416
- return {
417
- intents: toAttend ? [
418
- createIntent(LayoutAction.ScrollIntoView, {
419
- part: "current",
420
- subject: toAttend
421
- })
422
- ] : []
423
- };
424
- }
425
- }),
426
- createResolver({
427
- intent: LayoutAction.UpdateLayout,
428
- filter: (data) => S.is(LayoutAction.ScrollIntoView.fields.input)(data),
429
- resolve: ({ subject }) => {
430
- const layout = context.requestCapability(DeckCapabilities.MutableDeckState);
431
- layout.scrollIntoView = subject;
432
- }
433
- }),
434
- createResolver({
435
- intent: DeckAction.UpdatePlankSize,
436
- resolve: (data) => {
437
- const state = context.requestCapability(DeckCapabilities.MutableDeckState);
438
- state.deck.plankSizing[data.id] = data.size;
439
- }
440
- }),
441
- createResolver({
442
- intent: DeckAction.Adjust,
443
- resolve: (adjustment) => {
444
- const state = context.requestCapability(DeckCapabilities.MutableDeckState);
445
- const attention = context.requestCapability(AttentionCapabilities.Attention);
446
- return batch2(() => {
447
- if (adjustment.type === "increment-end" || adjustment.type === "increment-start") {
448
- setActive({
449
- next: incrementPlank(state.deck.active, adjustment),
450
- state,
451
- attention
452
- });
453
- }
454
- if (adjustment.type === "solo") {
455
- const entryId = adjustment.id;
456
- if (!state.deck.solo) {
457
- return {
458
- intents: [
459
- createIntent(LayoutAction.SetLayoutMode, {
460
- part: "mode",
461
- subject: entryId,
462
- options: {
463
- mode: "solo"
464
- }
465
- })
466
- ]
467
- };
468
- } else {
469
- return {
470
- intents: [
471
- // NOTE: The order of these is important.
472
- pipe(createIntent(LayoutAction.SetLayoutMode, {
473
- part: "mode",
474
- options: {
475
- mode: "deck"
476
- }
477
- }), chain(LayoutAction.Open, {
478
- part: "main",
479
- subject: [
480
- entryId
481
- ]
482
- }))
483
- ]
484
- };
485
- }
486
- }
487
- });
488
- }
489
- })
490
- ]);
491
- export {
492
- intent_resolver_default as default
493
- };
494
- //# sourceMappingURL=intent-resolver-CSXFDKTC.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/intent-resolver.ts", "../../../src/capabilities/set-active.ts", "../../../src/layout.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { batch } from '@preact/signals-core';\nimport { pipe } from 'effect';\n\nimport {\n Capabilities,\n createResolver,\n contributes,\n IntentAction,\n LayoutAction,\n type PluginsContext,\n createIntent,\n chain,\n} from '@dxos/app-framework';\nimport { getTypename, S } from '@dxos/echo-schema';\nimport { isReactiveObject } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { AttentionCapabilities } from '@dxos/plugin-attention';\nimport { ObservabilityAction } from '@dxos/plugin-observability/types';\nimport { nonNullable } from '@dxos/util';\n\nimport { DeckCapabilities } from './capabilities';\nimport { setActive } from './set-active';\nimport { closeEntry, incrementPlank, openEntry } from '../layout';\nimport { DECK_PLUGIN } from '../meta';\nimport { DeckAction, type LayoutMode, type DeckSettingsProps, isLayoutMode, getMode } from '../types';\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: IntentAction.ShowUndo,\n resolve: (data) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n const { undoPromise: undo } = context.requestCapability(Capabilities.IntentDispatcher);\n\n // TODO(wittjosiah): Support undoing further back than the last action.\n if (layout.currentUndoId) {\n layout.toasts = layout.toasts.filter((toast) => toast.id !== layout.currentUndoId);\n }\n layout.currentUndoId = `${IntentAction.ShowUndo._tag}-${Date.now()}`;\n layout.toasts = [\n ...layout.toasts,\n {\n id: layout.currentUndoId,\n title: data.message ?? ['undo available label', { ns: DECK_PLUGIN }],\n duration: 10_000,\n actionLabel: ['undo action label', { ns: DECK_PLUGIN }],\n actionAlt: ['undo action alt', { ns: DECK_PLUGIN }],\n closeLabel: ['undo close label', { ns: DECK_PLUGIN }],\n onAction: () => undo(),\n },\n ];\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdateSidebar.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is S.Schema.Type<typeof LayoutAction.UpdateSidebar.fields.input> =>\n S.is(LayoutAction.UpdateSidebar.fields.input)(data),\n resolve: ({ options }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n const next = options?.state ?? layout.sidebarState;\n if (next !== layout.sidebarState) {\n layout.sidebarState = next;\n }\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdateComplementary.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is S.Schema.Type<typeof LayoutAction.UpdateComplementary.fields.input> =>\n S.is(LayoutAction.UpdateComplementary.fields.input)(data),\n resolve: ({ subject, options }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n\n if (layout.complementarySidebarPanel !== subject) {\n layout.complementarySidebarPanel = subject;\n }\n\n const next = subject ? 'expanded' : options?.state ?? layout.complementarySidebarState;\n if (next !== layout.complementarySidebarState) {\n layout.complementarySidebarState = next;\n }\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdateDialog.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is S.Schema.Type<typeof LayoutAction.UpdateDialog.fields.input> =>\n S.is(LayoutAction.UpdateDialog.fields.input)(data),\n resolve: ({ subject, options }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n layout.dialogOpen = options.state ?? Boolean(subject);\n layout.dialogContent = subject ? { component: subject, props: options.props } : null;\n layout.dialogBlockAlign = options.blockAlign ?? 'center';\n layout.dialogType = options.type ?? 'default';\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.UpdatePopover.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is S.Schema.Type<typeof LayoutAction.UpdatePopover.fields.input> =>\n S.is(LayoutAction.UpdatePopover.fields.input)(data),\n resolve: ({ subject, options }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n layout.popoverOpen = options.state ?? Boolean(subject);\n layout.popoverContent = subject ? { component: subject, props: options.props } : null;\n layout.popoverAnchorId = options.anchorId;\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.AddToast.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is S.Schema.Type<typeof LayoutAction.AddToast.fields.input> =>\n S.is(LayoutAction.AddToast.fields.input)(data),\n resolve: ({ subject }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n layout.toasts.push(subject);\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n // TODO(wittjosiah): This should be able to just be `S.is(LayoutAction.SetLayoutMode.fields.input)`\n // but the filter is not being applied correctly.\n filter: (data): data is S.Schema.Type<typeof LayoutAction.SetLayoutMode.fields.input> => {\n if (!S.is(LayoutAction.SetLayoutMode.fields.input)(data)) {\n return false;\n }\n\n if ('mode' in data.options) {\n return isLayoutMode(data.options.mode);\n }\n\n return true;\n },\n resolve: ({ subject, options }) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n\n const setMode = (mode: LayoutMode) => {\n const deck = state.deck;\n const current = deck.solo ? [deck.solo] : deck.active;\n // When un-soloing, the solo entry is added to the deck.\n const next = (\n mode === 'solo' ? [subject ?? deck.solo ?? deck.active[0]] : [...deck.active, deck.solo]\n ).filter(nonNullable);\n\n const removed = current.filter((id) => !next.includes(id));\n const closed = Array.from(new Set([...deck.inactive.filter((id) => !next.includes(id)), ...removed]));\n deck.inactive = closed;\n\n if (mode === 'solo' && next[0]) {\n deck.solo = next[0];\n } else if (mode !== 'solo' && deck.solo) {\n deck.solo = undefined;\n deck.initialized = true;\n }\n\n if (mode === 'fullscreen' && !deck.fullscreen) {\n deck.fullscreen = true;\n } else if (mode !== 'fullscreen' && deck.fullscreen) {\n deck.fullscreen = false;\n }\n };\n\n return batch(() => {\n if ('mode' in options) {\n const current = getMode(state.deck);\n if (current !== options.mode) {\n state.previousMode[state.activeDeck] = current;\n }\n setMode(options.mode as LayoutMode);\n } else if ('revert' in options) {\n const last = state.previousMode[state.activeDeck];\n setMode(last ?? 'solo');\n } else {\n log.warn('Invalid layout mode', options);\n }\n });\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is S.Schema.Type<typeof LayoutAction.SwitchWorkspace.fields.input> =>\n S.is(LayoutAction.SwitchWorkspace.fields.input)(data),\n resolve: ({ subject }) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n batch(() => {\n state.activeDeck = subject;\n if (!state.decks[subject]) {\n state.decks[subject] = { initialized: false, active: [], inactive: [], fullscreen: false, plankSizing: {} };\n }\n });\n\n const first = state.decks[state.activeDeck].active[0];\n if (first) {\n return {\n intents: [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: first })],\n };\n }\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is S.Schema.Type<typeof LayoutAction.Open.fields.input> =>\n S.is(LayoutAction.Open.fields.input)(data),\n resolve: ({ subject, options }) => {\n const { graph } = context.requestCapability(Capabilities.AppGraph);\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const settings = context\n .requestCapabilities(Capabilities.SettingsStore)[0]\n ?.getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;\n\n const previouslyOpenIds = new Set<string>(state.deck.solo ? [state.deck.solo] : state.deck.active);\n batch(() => {\n const next = state.deck.solo\n ? (subject as string[])\n : subject.reduce(\n (acc, entryId) =>\n openEntry(acc, entryId, {\n key: options?.key,\n positioning: options?.positioning ?? settings?.newPlankPositioning,\n pivotId: options?.pivotId,\n }),\n state.deck.active,\n );\n\n return setActive({ next, state, attention });\n });\n\n const ids = state.deck.solo ? [state.deck.solo] : state.deck.active;\n const newlyOpen = ids.filter((i) => !previouslyOpenIds.has(i));\n\n return {\n intents: [\n ...(options?.scrollIntoView !== false\n ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: newlyOpen[0] ?? subject[0] })]\n : []),\n createIntent(LayoutAction.Expose, { part: 'navigation', subject: newlyOpen[0] ?? subject[0] }),\n ...newlyOpen.map((id) => {\n const active = graph?.findNode(id)?.data;\n const typename = isReactiveObject(active) ? getTypename(active) : undefined;\n return createIntent(ObservabilityAction.SendEvent, {\n name: 'navigation.activate',\n properties: {\n id,\n typename,\n },\n });\n }),\n ],\n };\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is S.Schema.Type<typeof LayoutAction.Close.fields.input> =>\n S.is(LayoutAction.Close.fields.input)(data),\n resolve: ({ subject }) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const next = subject.reduce((acc, id) => closeEntry(acc, id), state.deck.active);\n const toAttend = setActive({ next, state, attention });\n return {\n intents: toAttend ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: toAttend })] : [],\n };\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is S.Schema.Type<typeof LayoutAction.Set.fields.input> =>\n S.is(LayoutAction.Set.fields.input)(data),\n resolve: ({ subject }) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n const toAttend = setActive({ next: subject as string[], state, attention });\n return {\n intents: toAttend ? [createIntent(LayoutAction.ScrollIntoView, { part: 'current', subject: toAttend })] : [],\n };\n },\n }),\n createResolver({\n intent: LayoutAction.UpdateLayout,\n filter: (data): data is S.Schema.Type<typeof LayoutAction.ScrollIntoView.fields.input> =>\n S.is(LayoutAction.ScrollIntoView.fields.input)(data),\n resolve: ({ subject }) => {\n const layout = context.requestCapability(DeckCapabilities.MutableDeckState);\n layout.scrollIntoView = subject;\n },\n }),\n createResolver({\n intent: DeckAction.UpdatePlankSize,\n resolve: (data) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n state.deck.plankSizing[data.id] = data.size;\n },\n }),\n createResolver({\n intent: DeckAction.Adjust,\n resolve: (adjustment) => {\n const state = context.requestCapability(DeckCapabilities.MutableDeckState);\n const attention = context.requestCapability(AttentionCapabilities.Attention);\n\n return batch(() => {\n if (adjustment.type === 'increment-end' || adjustment.type === 'increment-start') {\n setActive({\n next: incrementPlank(state.deck.active, adjustment),\n state,\n attention,\n });\n }\n\n if (adjustment.type === 'solo') {\n const entryId = adjustment.id;\n if (!state.deck.solo) {\n // Solo the entry.\n return {\n intents: [\n createIntent(LayoutAction.SetLayoutMode, {\n part: 'mode',\n subject: entryId,\n options: { mode: 'solo' },\n }),\n ],\n };\n } else {\n // Un-solo the current entry.\n return {\n intents: [\n // NOTE: The order of these is important.\n pipe(\n createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { mode: 'deck' } }),\n chain(LayoutAction.Open, { part: 'main', subject: [entryId] }),\n ),\n ],\n };\n }\n }\n });\n },\n }),\n ]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { batch } from '@preact/signals-core';\n\nimport { type AttentionManager } from '@dxos/plugin-attention';\n\nimport { type DeckState } from '../types';\n\nexport type SetActiveOptions = {\n next: string[];\n state: DeckState;\n attention?: AttentionManager;\n};\n\nexport const setActive = ({ next, state, attention }: SetActiveOptions) => {\n return batch(() => {\n const active = state.deck.solo ? [state.deck.solo] : state.deck.active;\n const removed = active.filter((id) => !next.includes(id));\n const closed = Array.from(new Set([...state.deck.inactive.filter((id) => !next.includes(id)), ...removed]));\n\n state.deck.inactive = closed;\n\n if (state.deck.solo || !state.deck.initialized) {\n state.deck.solo = next[0];\n } else {\n state.deck.active = next;\n }\n\n if (attention) {\n const attended = attention.current;\n const [attendedId] = Array.from(attended);\n const isAttendedAvailable = !!attendedId && next.includes(attendedId);\n if (!isAttendedAvailable) {\n const attendedIndex = active.indexOf(attendedId);\n // If outside of bounds, focus on the first/last plank, otherwise focus on the new plank in the same position.\n const index = attendedIndex === -1 ? 0 : attendedIndex >= next.length ? next.length - 1 : attendedIndex;\n return next[index];\n }\n }\n });\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { produce } from 'immer';\n\nimport { type DeckAction, type NewPlankPositioning } from './types';\n\ntype OpenLayoutEntryOptions = { key?: string; positioning?: NewPlankPositioning; pivotId?: string };\n\nexport const openEntry = (deck: string[], entryId: string, options?: OpenLayoutEntryOptions): string[] => {\n return produce(deck, (draft) => {\n // Check that the entry is not already in the part\n if (draft.find((id) => id === entryId)) {\n return;\n }\n\n const key = options?.key;\n const plankPositioning = options?.positioning ?? 'start';\n const pivotId = options?.pivotId;\n\n if (key) {\n const index = draft.findIndex((id) => id.startsWith(key));\n if (index !== -1) {\n draft.splice(index, 1, entryId);\n return;\n }\n }\n\n if (pivotId) {\n const pivotIndex = draft.findIndex((id) => id === pivotId);\n if (pivotIndex !== -1) {\n if (plankPositioning === 'start') {\n draft.splice(pivotIndex, 0, entryId);\n } else {\n draft.splice(pivotIndex + 1, 0, entryId);\n }\n return;\n }\n }\n\n // If no pivot found or provided, fall back to original behavior\n if (plankPositioning === 'start') {\n draft.unshift(entryId);\n } else {\n draft.push(entryId);\n }\n });\n};\n\nexport const closeEntry = (deck: string[], entryId: string): string[] => {\n return produce(deck, (draft) => {\n const index = draft.findIndex((id) => id === entryId);\n if (index !== -1) {\n draft.splice(index, 1);\n }\n });\n};\n\nexport const incrementPlank = (deck: string[], adjustment: DeckAction.Adjustment): string[] => {\n return produce(deck, (draft) => {\n const index = draft.findIndex((id) => id === adjustment.id);\n if (\n index === -1 ||\n (adjustment.type === 'increment-start' && index === 0) ||\n (adjustment.type === 'increment-end' && index === draft.length - 1)\n ) {\n return;\n }\n\n if (adjustment.type === 'increment-start') {\n // Swap the current item with the previous item.\n [draft[index - 1], draft[index]] = [draft[index], draft[index - 1]];\n } else if (adjustment.type === 'increment-end') {\n // Swap the current item with the next item.\n [draft[index], draft[index + 1]] = [draft[index + 1], draft[index]];\n }\n });\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;AAIA,SAASA,SAAAA,cAAa;AACtB,SAASC,YAAY;AAErB,SACEC,cACAC,gBACAC,aACAC,cACAC,cAEAC,cACAC,aACK;AACP,SAASC,aAAaC,SAAS;AAC/B,SAASC,wBAAwB;AACjC,SAASC,WAAW;AACpB,SAASC,6BAA6B;AACtC,SAASC,2BAA2B;AACpC,SAASC,mBAAmB;;;AClB5B,SAASC,aAAa;AAYf,IAAMC,YAAY,CAAC,EAAEC,MAAMC,OAAOC,UAAS,MAAoB;AACpE,SAAOC,MAAM,MAAA;AACX,UAAMC,SAASH,MAAMI,KAAKC,OAAO;MAACL,MAAMI,KAAKC;QAAQL,MAAMI,KAAKD;AAChE,UAAMG,UAAUH,OAAOI,OAAO,CAACC,OAAO,CAACT,KA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9B,gBAAMwD,UAAU6B,WAAW1H;AAC3B,cAAI,CAACsB,MAAM2B,KAAKE,MAAM;AAEpB,mBAAO;cACLwB,SAAS;gBACPC,aAAa/D,aAAagC,eAAe;kBACvCiC,MAAM;kBACNrD,SAASoE;kBACTzE,SAAS;oBAAE2B,MAAM;kBAAO;gBAC1B,CAAA;;YAEJ;UACF,OAAO;AAEL,mBAAO;cACL4B,SAAS;;gBAEPiD,KACEhD,aAAa/D,aAAagC,eAAe;kBAAEiC,MAAM;kBAAQ1D,SAAS;oBAAE2B,MAAM;kBAAO;gBAAE,CAAA,GACnF8E,MAAMhH,aAAakE,MAAM;kBAAED,MAAM;kBAAQrD,SAAS;oBAACoE;;gBAAS,CAAA,CAAA;;YAGlE;UACF;QACF;MACF,CAAA;IACF;EACF,CAAA;CACD;",
6
- "names": ["batch", "pipe", "Capabilities", "createResolver", "contributes", "IntentAction", "LayoutAction", "createIntent", "chain", "getTypename", "S", "isReactiveObject", "log", "AttentionCapabilities", "ObservabilityAction", "nonNullable", "batch", "setActive", "next", "state", "attention", "batch", "active", "deck", "solo", "removed", "filter", "id", "includes", "closed", "Array", "from", "Set", "inactive", "initialized", "attended", "current", "attendedId", "isAttendedAvailable", "attendedIndex", "indexOf", "index", "length", "produce", "openEntry", "deck", "entryId", "options", "produce", "draft", "find", "id", "key", "plankPositioning", "positioning", "pivotId", "index", "findIndex", "startsWith", "splice", "pivotIndex", "unshift", "push", "closeEntry", "incrementPlank", "adjustment", "type", "length", "context", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "IntentAction", "ShowUndo", "resolve", "data", "layout", "requestCapability", "DeckCapabilities", "MutableDeckState", "undoPromise", "undo", "IntentDispatcher", "currentUndoId", "toasts", "filter", "toast", "id", "_tag", "Date", "now", "title", "message", "ns", "DECK_PLUGIN", "duration", "actionLabel", "actionAlt", "closeLabel", "onAction", "LayoutAction", "UpdateLayout", "S", "is", "UpdateSidebar", "fields", "input", "options", "next", "state", "sidebarState", "UpdateComplementary", "subject", "complementarySidebarPanel", "complementarySidebarState", "UpdateDialog", "dialogOpen", "Boolean", "dialogContent", "component", "props", "dialogBlockAlign", "blockAlign", "dialogType", "type", "UpdatePopover", "popoverOpen", "popoverContent", "popoverAnchorId", "anchorId", "AddToast", "push", "SetLayoutMode", "isLayoutMode", "mode", "setMode", "deck", "current", "solo", "active", "nonNullable", "removed", "includes", "closed", "Array", "from", "Set", "inactive", "undefined", "initialized", "fullscreen", "batch", "getMode", "previousMode", "activeDeck", "last", "log", "warn", "SwitchWorkspace", "decks", "plankSizing", "first", "intents", "createIntent", "ScrollIntoView", "part", "Open", "graph", "AppGraph", "attention", "AttentionCapabilities", "Attention", "settings", "requestCapabilities", "SettingsStore", "getStore", "value", "previouslyOpenIds", "reduce", "acc", "entryId", "openEntry", "key", "positioning", "newPlankPositioning", "pivotId", "setActive", "ids", "newlyOpen", "i", "has", "scrollIntoView", "Expose", "map", "findNode", "typename", "isReactiveObject", "getTypename", "ObservabilityAction", "SendEvent", "name", "properties", "Close", "closeEntry", "toAttend", "DeckAction", "UpdatePlankSize", "size", "Adjust", "adjustment", "incrementPlank", "pipe", "chain"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-root.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { useCallback } from 'react';\n\nimport { Capabilities, contributes, useCapabilities, useCapability } from '@dxos/app-framework';\n\nimport { DeckCapabilities } from './capabilities';\nimport { DeckLayout } from '../components';\nimport { DECK_PLUGIN } from '../meta';\nimport { type DeckSettingsProps } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactRoot, {\n id: DECK_PLUGIN,\n root: () => {\n const layout = useCapability(DeckCapabilities.MutableDeckState);\n const settings = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)!.value;\n const panels = useCapabilities(DeckCapabilities.ComplementaryPanel);\n\n const handleDismissToast = useCallback(\n (id: string) => {\n const index = layout.toasts.findIndex((toast) => toast.id === id);\n if (index !== -1) {\n // Allow time for the toast to animate out.\n // TODO(burdon): Factor out and unregister timeout.\n setTimeout(() => {\n if (layout.toasts[index].id === layout.currentUndoId) {\n layout.currentUndoId = undefined;\n }\n layout.toasts.splice(index, 1);\n }, 1_000);\n }\n },\n [layout.toasts],\n );\n\n return (\n <DeckLayout\n showHints={settings.showHints}\n overscroll={settings.overscroll}\n panels={panels}\n onDismissToast={handleDismissToast}\n />\n );\n },\n });\n"],
5
- "mappings": ";;;;;;;;;;;;;AAIA,OAAOA,SAASC,mBAAmB;AAEnC,SAASC,cAAcC,aAAaC,iBAAiBC,qBAAqB;AAO1E,IAAA,qBAAe,MACbC,YAAYC,aAAaC,WAAW;EAClCC,IAAIC;EACJC,MAAM,MAAA;AACJ,UAAMC,SAASC,cAAcC,iBAAiBC,gBAAgB;AAC9D,UAAMC,WAAWH,cAAcN,aAAaU,aAAa,EAAEC,SAA4BR,WAAAA,EAAcS;AACrG,UAAMC,SAASC,gBAAgBP,iBAAiBQ,kBAAkB;AAElE,UAAMC,qBAAqBC,YACzB,CAACf,OAAAA;AACC,YAAMgB,QAAQb,OAAOc,OAAOC,UAAU,CAACC,UAAUA,MAAMnB,OAAOA,EAAAA;AAC9D,UAAIgB,UAAU,IAAI;AAGhBI,mBAAW,MAAA;AACT,cAAIjB,OAAOc,OAAOD,KAAAA,EAAOhB,OAAOG,OAAOkB,eAAe;AACpDlB,mBAAOkB,gBAAgBC;UACzB;AACAnB,iBAAOc,OAAOM,OAAOP,OAAO,CAAA;QAC9B,GAAG,GAAA;MACL;IACF,GACA;MAACb,OAAOc;KAAO;AAGjB,WACE,sBAAA,cAACO,YAAAA;MACCC,WAAWlB,SAASkB;MACpBC,YAAYnB,SAASmB;MACrBf;MACAgB,gBAAgBb;;EAGtB;AACF,CAAA;",
6
- "names": ["React", "useCallback", "Capabilities", "contributes", "useCapabilities", "useCapability", "contributes", "Capabilities", "ReactRoot", "id", "DECK_PLUGIN", "root", "layout", "useCapability", "DeckCapabilities", "MutableDeckState", "settings", "SettingsStore", "getStore", "value", "panels", "useCapabilities", "ComplementaryPanel", "handleDismissToast", "useCallback", "index", "toasts", "findIndex", "toast", "setTimeout", "currentUndoId", "undefined", "splice", "DeckLayout", "showHints", "overscroll", "onDismissToast"]
7
- }
@@ -1,38 +0,0 @@
1
- import {
2
- Banner,
3
- LayoutSettings
4
- } from "./chunk-BTDY6SES.mjs";
5
- import "./chunk-FZOBKOA2.mjs";
6
- import "./chunk-YQ2GWTDU.mjs";
7
- import "./chunk-M2L53AIH.mjs";
8
- import {
9
- DECK_PLUGIN
10
- } from "./chunk-N7TEPFVR.mjs";
11
-
12
- // packages/plugins/plugin-deck/src/capabilities/react-surface.tsx
13
- import React from "react";
14
- import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
15
- import { SettingsStore } from "@dxos/local-storage";
16
- var react_surface_default = () => contributes(Capabilities.ReactSurface, [
17
- createSurface({
18
- id: `${DECK_PLUGIN}/settings`,
19
- role: "article",
20
- filter: (data) => data.subject instanceof SettingsStore && data.subject.prefix === DECK_PLUGIN,
21
- component: ({ data: { subject } }) => /* @__PURE__ */ React.createElement(LayoutSettings, {
22
- settings: subject.value
23
- })
24
- }),
25
- createSurface({
26
- id: `${DECK_PLUGIN}/banner`,
27
- role: "banner",
28
- component: ({ data }) => {
29
- return /* @__PURE__ */ React.createElement(Banner, {
30
- variant: data.variant
31
- });
32
- }
33
- })
34
- ]);
35
- export {
36
- react_surface_default as default
37
- };
38
- //# sourceMappingURL=react-surface-4QVWKQYY.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/react-surface.tsx"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { SettingsStore } from '@dxos/local-storage';\n\nimport { LayoutSettings } from '../components';\nimport { Banner } from '../components/DeckLayout/Banner';\nimport { DECK_PLUGIN } from '../meta';\nimport { type DeckSettingsProps } from '../types';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${DECK_PLUGIN}/settings`,\n role: 'article',\n filter: (data): data is { subject: SettingsStore<DeckSettingsProps> } =>\n data.subject instanceof SettingsStore && data.subject.prefix === DECK_PLUGIN,\n component: ({ data: { subject } }) => <LayoutSettings settings={subject.value} />,\n }),\n createSurface({\n id: `${DECK_PLUGIN}/banner`,\n role: 'banner',\n component: ({ data }) => {\n return <Banner variant={data.variant} />;\n },\n }),\n ]);\n"],
5
- "mappings": ";;;;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,qBAAqB;AAO9B,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,WAAAA;IACPC,MAAM;IACNC,QAAQ,CAACC,SACPA,KAAKC,mBAAmBC,iBAAiBF,KAAKC,QAAQE,WAAWN;IACnEO,WAAW,CAAC,EAAEJ,MAAM,EAAEC,QAAO,EAAE,MAAO,sBAAA,cAACI,gBAAAA;MAAeC,UAAUL,QAAQM;;EAC1E,CAAA;EACAZ,cAAc;IACZC,IAAI,GAAGC,WAAAA;IACPC,MAAM;IACNM,WAAW,CAAC,EAAEJ,KAAI,MAAE;AAClB,aAAO,sBAAA,cAACQ,QAAAA;QAAOC,SAAST,KAAKS;;IAC/B;EACF,CAAA;CACD;",
6
- "names": ["React", "Capabilities", "contributes", "createSurface", "SettingsStore", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "DECK_PLUGIN", "role", "filter", "data", "subject", "SettingsStore", "prefix", "component", "LayoutSettings", "settings", "value", "Banner", "variant"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/capabilities/settings.ts"],
4
- "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes } from '@dxos/app-framework';\nimport { create } from '@dxos/live-object';\n\nimport { DECK_PLUGIN } from '../meta';\nimport { DeckSettingsSchema, type DeckSettingsProps } from '../types';\n\nexport default () => {\n const settings = create<DeckSettingsProps>({\n showHints: false,\n enableNativeRedirect: false,\n enableIdeStyleStatusbar: true,\n newPlankPositioning: 'start',\n overscroll: 'none',\n });\n\n return contributes(Capabilities.Settings, { schema: DeckSettingsSchema, prefix: DECK_PLUGIN, value: settings });\n};\n"],
5
- "mappings": ";;;;;;;;AAIA,SAASA,cAAcC,mBAAmB;AAC1C,SAASC,cAAc;AAKvB,IAAA,mBAAe,MAAA;AACb,QAAMC,WAAWC,OAA0B;IACzCC,WAAW;IACXC,sBAAsB;IACtBC,yBAAyB;IACzBC,qBAAqB;IACrBC,YAAY;EACd,CAAA;AAEA,SAAOC,YAAYC,aAAaC,UAAU;IAAEC,QAAQC;IAAoBC,QAAQC;IAAaC,OAAOd;EAAS,CAAA;AAC/G;",
6
- "names": ["Capabilities", "contributes", "create", "settings", "create", "showHints", "enableNativeRedirect", "enableIdeStyleStatusbar", "newPlankPositioning", "overscroll", "contributes", "Capabilities", "Settings", "schema", "DeckSettingsSchema", "prefix", "DECK_PLUGIN", "value"]
7
- }