@dxos/plugin-deck 0.6.14-main.8b352a0 → 0.6.14-staging.4b6f9cf
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-NIRHDTX4.mjs +17 -0
- package/dist/lib/browser/chunk-NIRHDTX4.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +387 -379
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/types.mjs +11 -0
- package/dist/lib/browser/types.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts +4 -3
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +3 -8
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +3 -4
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +4 -4
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts +19 -0
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/PlankError.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -4
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +13 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/overscroll.d.ts +1 -2
- package/dist/types/src/util/overscroll.d.ts.map +1 -1
- package/package.json +34 -27
- package/src/DeckPlugin.tsx +18 -32
- package/src/components/DeckLayout/ComplementarySidebar.tsx +27 -45
- package/src/components/DeckLayout/DeckLayout.tsx +141 -137
- package/src/components/DeckLayout/NodePlankHeading.tsx +30 -17
- package/src/components/DeckLayout/Plank.tsx +62 -96
- package/src/components/DeckLayout/PlankControls.tsx +133 -0
- package/src/components/DeckLayout/PlankError.tsx +6 -8
- package/src/components/DeckLayout/PlankLoading.tsx +1 -1
- package/src/components/DeckLayout/Toast.tsx +1 -1
- package/src/components/LayoutSettings.tsx +13 -13
- package/src/translations.ts +11 -9
- package/src/types.ts +15 -0
- package/src/util/overscroll.ts +9 -30
|
@@ -2,22 +2,26 @@ import {
|
|
|
2
2
|
DECK_PLUGIN,
|
|
3
3
|
meta_default
|
|
4
4
|
} from "./chunk-GVOGPULO.mjs";
|
|
5
|
+
import {
|
|
6
|
+
NewPlankPositions,
|
|
7
|
+
OverscrollOptions,
|
|
8
|
+
parsePanelPlugin
|
|
9
|
+
} from "./chunk-NIRHDTX4.mjs";
|
|
5
10
|
|
|
6
11
|
// packages/plugins/plugin-deck/src/DeckPlugin.tsx
|
|
7
12
|
import { batch } from "@preact/signals-core";
|
|
8
13
|
import { setAutoFreeze } from "immer";
|
|
9
|
-
import
|
|
10
|
-
import { IntentAction, LayoutAction as
|
|
14
|
+
import React16 from "react";
|
|
15
|
+
import { IntentAction, LayoutAction as LayoutAction2, NavigationAction as NavigationAction3, parseGraphPlugin, parseIntentPlugin, resolvePlugin, Toast as ToastSchema, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR4, isLayoutParts, isLayoutAdjustment, isLayoutMode, openIds as openIds2, filterPlugins } from "@dxos/app-framework";
|
|
11
16
|
import { create, getTypename, isReactiveObject } from "@dxos/echo-schema";
|
|
12
17
|
import { scheduledEffect } from "@dxos/echo-signals/core";
|
|
13
18
|
import { LocalStorageStore } from "@dxos/local-storage";
|
|
14
19
|
import { log } from "@dxos/log";
|
|
15
20
|
import { parseAttentionPlugin } from "@dxos/plugin-attention";
|
|
16
|
-
import { parseClientPlugin } from "@dxos/plugin-client";
|
|
17
21
|
import { createExtension } from "@dxos/plugin-graph";
|
|
18
22
|
import { ObservabilityAction } from "@dxos/plugin-observability/meta";
|
|
19
23
|
import { fullyQualifiedId } from "@dxos/react-client/echo";
|
|
20
|
-
import { translations as
|
|
24
|
+
import { translations as stackTranslations } from "@dxos/react-ui-stack";
|
|
21
25
|
|
|
22
26
|
// packages/plugins/plugin-deck/src/components/DeckLayout/constants.ts
|
|
23
27
|
var NAV_ID = "NavTree";
|
|
@@ -26,10 +30,10 @@ var SURFACE_PREFIX = "surface:";
|
|
|
26
30
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
27
31
|
import { Sidebar as MenuIcon } from "@phosphor-icons/react";
|
|
28
32
|
import { untracked } from "@preact/signals-core";
|
|
29
|
-
import
|
|
33
|
+
import React14, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo5, useRef as useRef2, Fragment as Fragment2 } from "react";
|
|
30
34
|
import { Surface as Surface9, firstIdInPart, usePlugin } from "@dxos/app-framework";
|
|
31
35
|
import { Button as Button3, Dialog, Main as Main3, Popover as Popover2, useOnTransition, useTranslation as useTranslation5 } from "@dxos/react-ui";
|
|
32
|
-
import {
|
|
36
|
+
import { Stack, StackContext as StackContext2, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
|
|
33
37
|
import { getSize, mainPaddingTransitions as mainPaddingTransitions2 } from "@dxos/react-ui-theme";
|
|
34
38
|
|
|
35
39
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ActiveNode.tsx
|
|
@@ -118,23 +122,99 @@ var ActiveNode = () => {
|
|
|
118
122
|
};
|
|
119
123
|
|
|
120
124
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
121
|
-
import
|
|
125
|
+
import React6, { useMemo as useMemo2 } from "react";
|
|
122
126
|
import { NavigationAction as NavigationAction2, SLUG_PATH_SEPARATOR as SLUG_PATH_SEPARATOR2, Surface as Surface3, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
123
127
|
import { useGraph as useGraph3 } from "@dxos/plugin-graph";
|
|
124
128
|
import { Main } from "@dxos/react-ui";
|
|
125
129
|
import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
|
|
126
|
-
import {
|
|
130
|
+
import { railGridHorizontal, StackContext } from "@dxos/react-ui-stack";
|
|
127
131
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
128
132
|
|
|
129
133
|
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
130
|
-
import
|
|
134
|
+
import React3, { Fragment, memo, useEffect as useEffect3, useMemo } from "react";
|
|
131
135
|
import { LayoutAction, NavigationAction, SLUG_PATH_SEPARATOR, Surface as Surface2, useIntentDispatcher } from "@dxos/app-framework";
|
|
132
136
|
import { useGraph as useGraph2 } from "@dxos/plugin-graph";
|
|
133
|
-
import { Icon, Popover, toLocalizedString, useMediaQuery, useTranslation } from "@dxos/react-ui";
|
|
134
|
-
import {
|
|
137
|
+
import { Icon as Icon2, Popover, toLocalizedString, useMediaQuery, useTranslation as useTranslation2, IconButton } from "@dxos/react-ui";
|
|
138
|
+
import { StackItem } from "@dxos/react-ui-stack";
|
|
135
139
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
136
|
-
|
|
140
|
+
|
|
141
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankControls.tsx
|
|
142
|
+
import React2, { forwardRef } from "react";
|
|
143
|
+
import { Button, ButtonGroup, Icon, Tooltip, useTranslation } from "@dxos/react-ui";
|
|
144
|
+
var PlankControl = ({ icon, label, ...props }) => {
|
|
145
|
+
return /* @__PURE__ */ React2.createElement(Tooltip.Root, null, /* @__PURE__ */ React2.createElement(Tooltip.Trigger, {
|
|
146
|
+
asChild: true
|
|
147
|
+
}, /* @__PURE__ */ React2.createElement(Button, {
|
|
148
|
+
variant: "ghost",
|
|
149
|
+
...props
|
|
150
|
+
}, /* @__PURE__ */ React2.createElement("span", {
|
|
151
|
+
className: "sr-only"
|
|
152
|
+
}, label), /* @__PURE__ */ React2.createElement(Icon, {
|
|
153
|
+
icon
|
|
154
|
+
}))), /* @__PURE__ */ React2.createElement(Tooltip.Portal, null, /* @__PURE__ */ React2.createElement(Tooltip.Content, {
|
|
155
|
+
side: "bottom",
|
|
156
|
+
classNames: "z-[70]"
|
|
157
|
+
}, label)));
|
|
158
|
+
};
|
|
159
|
+
var PlankControls = /* @__PURE__ */ forwardRef(({ onClick, variant = "default", capabilities: can, isSolo, pin, close = false, children, ...props }, forwardedRef) => {
|
|
137
160
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
161
|
+
const buttonClassNames = variant === "hide-disabled" ? "disabled:hidden !p-1" : "!p-1";
|
|
162
|
+
return /* @__PURE__ */ React2.createElement(ButtonGroup, {
|
|
163
|
+
...props,
|
|
164
|
+
ref: forwardedRef
|
|
165
|
+
}, pin && !isSolo && [
|
|
166
|
+
"both",
|
|
167
|
+
"start"
|
|
168
|
+
].includes(pin) && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
169
|
+
label: t("pin start label"),
|
|
170
|
+
variant: "ghost",
|
|
171
|
+
classNames: buttonClassNames,
|
|
172
|
+
onClick: () => onClick?.("pin-start"),
|
|
173
|
+
icon: "ph--caret-line-left--regular"
|
|
174
|
+
}), can.solo && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
175
|
+
label: t("solo plank label"),
|
|
176
|
+
classNames: buttonClassNames,
|
|
177
|
+
onClick: () => onClick?.("solo"),
|
|
178
|
+
icon: isSolo ? "ph--arrows-in--regular" : "ph--arrows-out--regular"
|
|
179
|
+
}), !isSolo && can.solo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
180
|
+
label: t("increment start label"),
|
|
181
|
+
disabled: !can.incrementStart,
|
|
182
|
+
classNames: buttonClassNames,
|
|
183
|
+
onClick: () => onClick?.("increment-start"),
|
|
184
|
+
icon: "ph--caret-left--regular"
|
|
185
|
+
}), /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
186
|
+
label: t("increment end label"),
|
|
187
|
+
disabled: !can.incrementEnd,
|
|
188
|
+
classNames: buttonClassNames,
|
|
189
|
+
onClick: () => onClick?.("increment-end"),
|
|
190
|
+
icon: "ph--caret-right--regular"
|
|
191
|
+
})), pin && !isSolo && [
|
|
192
|
+
"both",
|
|
193
|
+
"end"
|
|
194
|
+
].includes(pin) && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
195
|
+
label: t("pin end label"),
|
|
196
|
+
classNames: buttonClassNames,
|
|
197
|
+
onClick: () => onClick?.("pin-end"),
|
|
198
|
+
icon: "ph--caret-line-right--regular"
|
|
199
|
+
}), close && !isSolo && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
200
|
+
label: t(`${typeof close === "string" ? "minify" : "close"} label`),
|
|
201
|
+
classNames: buttonClassNames,
|
|
202
|
+
onClick: () => onClick?.("close"),
|
|
203
|
+
"data-testid": "plankHeading.close",
|
|
204
|
+
icon: close === "minify-start" ? "ph--caret-line-left--regular" : close === "minify-end" ? "ph--caret-line-right--regular" : "ph--minus--regular"
|
|
205
|
+
}), children);
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
// packages/plugins/plugin-deck/src/components/LayoutContext.ts
|
|
209
|
+
import { createContext, useContext } from "react";
|
|
210
|
+
import { raise } from "@dxos/debug";
|
|
211
|
+
var LayoutContext = createContext(null);
|
|
212
|
+
var useLayout = () => useContext(LayoutContext) ?? raise(new Error("Missing LayoutContext"));
|
|
213
|
+
|
|
214
|
+
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
215
|
+
var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementStart, canIncrementEnd, popoverAnchorId, pending, actions = [] }) => {
|
|
216
|
+
const layoutContext = useLayout();
|
|
217
|
+
const { t } = useTranslation2(DECK_PLUGIN);
|
|
138
218
|
const { graph } = useGraph2();
|
|
139
219
|
const icon = node?.properties?.icon ?? "ph--placeholder--regular";
|
|
140
220
|
const label = pending ? t("pending heading") : toLocalizedString(node?.properties?.label ?? [
|
|
@@ -166,9 +246,9 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementSta
|
|
|
166
246
|
canIncrementStart,
|
|
167
247
|
canIncrementEnd
|
|
168
248
|
]);
|
|
169
|
-
return /* @__PURE__ */
|
|
170
|
-
classNames: "pie-1
|
|
171
|
-
}, /* @__PURE__ */
|
|
249
|
+
return /* @__PURE__ */ React3.createElement(StackItem.Heading, {
|
|
250
|
+
classNames: "pie-1"
|
|
251
|
+
}, /* @__PURE__ */ React3.createElement(ActionRoot, null, node ? /* @__PURE__ */ React3.createElement(StackItem.Sigil, {
|
|
172
252
|
icon,
|
|
173
253
|
related: layoutPart === "complementary",
|
|
174
254
|
attendableId,
|
|
@@ -181,35 +261,36 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementSta
|
|
|
181
261
|
node: action,
|
|
182
262
|
caller: DECK_PLUGIN
|
|
183
263
|
})
|
|
184
|
-
}, /* @__PURE__ */
|
|
264
|
+
}, /* @__PURE__ */ React3.createElement(Surface2, {
|
|
185
265
|
role: "menu-footer",
|
|
186
266
|
data: {
|
|
187
267
|
object: node.data
|
|
188
268
|
}
|
|
189
|
-
})) : /* @__PURE__ */
|
|
269
|
+
})) : /* @__PURE__ */ React3.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React3.createElement("span", {
|
|
190
270
|
className: "sr-only"
|
|
191
|
-
}, label), /* @__PURE__ */
|
|
271
|
+
}, label), /* @__PURE__ */ React3.createElement(Icon2, {
|
|
192
272
|
icon,
|
|
193
273
|
size: 5
|
|
194
|
-
}))), /* @__PURE__ */
|
|
274
|
+
}))), /* @__PURE__ */ React3.createElement(TextTooltip, {
|
|
195
275
|
text: label,
|
|
196
276
|
onlyWhenTruncating: true
|
|
197
|
-
}, /* @__PURE__ */
|
|
277
|
+
}, /* @__PURE__ */ React3.createElement(StackItem.HeadingLabel, {
|
|
198
278
|
attendableId,
|
|
199
279
|
related: layoutPart === "complementary",
|
|
200
280
|
...pending && {
|
|
201
281
|
classNames: "text-description"
|
|
202
282
|
}
|
|
203
283
|
}, label)), node && layoutPart !== "complementary" && // TODO(Zan): What are we doing with layout coordinate here?
|
|
204
|
-
/* @__PURE__ */
|
|
284
|
+
/* @__PURE__ */ React3.createElement(Surface2, {
|
|
205
285
|
role: "navbar-end",
|
|
206
286
|
direction: "inline-reverse",
|
|
207
287
|
data: {
|
|
208
288
|
object: node.data
|
|
209
289
|
}
|
|
210
|
-
}), /* @__PURE__ */
|
|
290
|
+
}), /* @__PURE__ */ React3.createElement(PlankControls, {
|
|
211
291
|
capabilities,
|
|
212
292
|
isSolo: layoutPart === "solo",
|
|
293
|
+
classNames: "mx-1",
|
|
213
294
|
onClick: (eventType) => {
|
|
214
295
|
if (!layoutPart) {
|
|
215
296
|
return;
|
|
@@ -259,22 +340,30 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ coordinate, node, canIncrementSta
|
|
|
259
340
|
}
|
|
260
341
|
},
|
|
261
342
|
close: layoutPart === "complementary" ? "minify-end" : true
|
|
262
|
-
}
|
|
343
|
+
}, layoutPart !== "complementary" && /* @__PURE__ */ React3.createElement(IconButton, {
|
|
344
|
+
iconOnly: true,
|
|
345
|
+
onClick: () => layoutContext.complementarySidebarOpen = !layoutContext.complementarySidebarOpen,
|
|
346
|
+
variant: "ghost",
|
|
347
|
+
label: t("open complementary sidebar label"),
|
|
348
|
+
classNames: "!p-1 -scale-x-100",
|
|
349
|
+
icon: "ph--sidebar--regular",
|
|
350
|
+
tooltipZIndex: "70"
|
|
351
|
+
})));
|
|
263
352
|
});
|
|
264
353
|
|
|
265
354
|
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankError.tsx
|
|
266
|
-
import
|
|
267
|
-
import { useTranslation as
|
|
355
|
+
import React5, { useEffect as useEffect4, useState as useState2 } from "react";
|
|
356
|
+
import { useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
268
357
|
import { descriptionText, mx } from "@dxos/react-ui-theme";
|
|
269
358
|
|
|
270
359
|
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankLoading.tsx
|
|
271
|
-
import
|
|
360
|
+
import React4 from "react";
|
|
272
361
|
import { Status } from "@dxos/react-ui";
|
|
273
362
|
var PlankLoading = () => {
|
|
274
|
-
return /* @__PURE__ */
|
|
363
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
275
364
|
role: "none",
|
|
276
|
-
className: "grid
|
|
277
|
-
}, /* @__PURE__ */
|
|
365
|
+
className: "grid place-items-center attention-surface"
|
|
366
|
+
}, /* @__PURE__ */ React4.createElement(Status, {
|
|
278
367
|
indeterminate: true,
|
|
279
368
|
"aria-label": "Initializing"
|
|
280
369
|
}));
|
|
@@ -282,74 +371,41 @@ var PlankLoading = () => {
|
|
|
282
371
|
|
|
283
372
|
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankError.tsx
|
|
284
373
|
var PlankContentError = ({ error }) => {
|
|
285
|
-
const { t } =
|
|
286
|
-
|
|
374
|
+
const { t } = useTranslation3(DECK_PLUGIN);
|
|
375
|
+
const errorString = error?.toString() ?? "";
|
|
376
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
287
377
|
role: "none",
|
|
288
|
-
className: "grid place-items-center
|
|
289
|
-
}, /* @__PURE__ */
|
|
378
|
+
className: "overflow-auto p-8 attention-surface grid place-items-center"
|
|
379
|
+
}, /* @__PURE__ */ React5.createElement("p", {
|
|
290
380
|
role: "alert",
|
|
291
|
-
className: mx(
|
|
292
|
-
|
|
293
|
-
// TODO(burdon): Factor out common styles for all dialogs.
|
|
294
|
-
"overflow-hidden break-words",
|
|
295
|
-
"place-self-center border border-dashed border-neutral-400/50 rounded-lg text-center p-8 font-normal text-lg"
|
|
296
|
-
)
|
|
297
|
-
}, error ? error.toString() : t("error fallback message")));
|
|
381
|
+
className: mx(descriptionText, "break-words border border-dashed border-separator rounded-lg p-8", errorString.length < 256 && "text-lg")
|
|
382
|
+
}, error ? errorString : t("error fallback message")));
|
|
298
383
|
};
|
|
299
|
-
var PlankError = ({ layoutCoordinate, node, error
|
|
384
|
+
var PlankError = ({ layoutCoordinate, node, error }) => {
|
|
300
385
|
const [timedOut, setTimedOut] = useState2(false);
|
|
301
386
|
useEffect4(() => {
|
|
302
387
|
setTimeout(() => setTimedOut(true), 5e3);
|
|
303
388
|
}, []);
|
|
304
|
-
return /* @__PURE__ */
|
|
389
|
+
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(NodePlankHeading, {
|
|
305
390
|
coordinate: layoutCoordinate,
|
|
306
391
|
node,
|
|
307
|
-
pending: !timedOut
|
|
308
|
-
|
|
309
|
-
}), timedOut ? /* @__PURE__ */ React4.createElement(PlankContentError, {
|
|
392
|
+
pending: !timedOut
|
|
393
|
+
}), timedOut ? /* @__PURE__ */ React5.createElement(PlankContentError, {
|
|
310
394
|
error
|
|
311
|
-
}) : /* @__PURE__ */
|
|
395
|
+
}) : /* @__PURE__ */ React5.createElement(PlankLoading, null));
|
|
312
396
|
};
|
|
313
397
|
|
|
314
|
-
// packages/plugins/plugin-deck/src/components/LayoutContext.ts
|
|
315
|
-
import { createContext, useContext } from "react";
|
|
316
|
-
import { raise } from "@dxos/debug";
|
|
317
|
-
var LayoutContext = createContext(null);
|
|
318
|
-
var useLayout = () => useContext(LayoutContext) ?? raise(new Error("Missing LayoutContext"));
|
|
319
|
-
|
|
320
398
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
321
|
-
var
|
|
322
|
-
{
|
|
323
|
-
id: "settings",
|
|
324
|
-
icon: "ph--gear--regular"
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
id: "comments",
|
|
328
|
-
icon: "ph--chat-text--regular"
|
|
329
|
-
},
|
|
330
|
-
{
|
|
331
|
-
id: "automation",
|
|
332
|
-
icon: "ph--atom--regular"
|
|
333
|
-
},
|
|
334
|
-
{
|
|
335
|
-
id: "debug",
|
|
336
|
-
icon: "ph--bug--regular"
|
|
337
|
-
}
|
|
338
|
-
];
|
|
339
|
-
var getPanel = (id) => {
|
|
340
|
-
const panel = panels.find((p) => p.id === id) ?? panels[0];
|
|
341
|
-
return panel.id;
|
|
342
|
-
};
|
|
343
|
-
var ComplementarySidebar = ({ panel, flatDeck }) => {
|
|
399
|
+
var ComplementarySidebar = ({ panels, current }) => {
|
|
344
400
|
const { popoverAnchorId } = useLayout();
|
|
345
401
|
const attended = useAttended2();
|
|
346
|
-
const
|
|
347
|
-
const id = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR2}${
|
|
402
|
+
const panel = (panels.find((p) => p.id === current) ?? panels[0])?.id;
|
|
403
|
+
const id = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR2}${panel}` : void 0;
|
|
348
404
|
const { graph } = useGraph3();
|
|
349
405
|
const node = useNode(graph, id);
|
|
350
406
|
const dispatch = useIntentDispatcher2();
|
|
351
407
|
useNodeActionExpander(node);
|
|
352
|
-
const actions = useMemo2(() => panels.map(({ id: id2, icon }) => ({
|
|
408
|
+
const actions = useMemo2(() => panels.map(({ id: id2, label, icon }) => ({
|
|
353
409
|
id: `complementary-${id2}`,
|
|
354
410
|
data: () => {
|
|
355
411
|
void dispatch({
|
|
@@ -362,18 +418,13 @@ var ComplementarySidebar = ({ panel, flatDeck }) => {
|
|
|
362
418
|
});
|
|
363
419
|
},
|
|
364
420
|
properties: {
|
|
365
|
-
label
|
|
366
|
-
`open ${id2} label`,
|
|
367
|
-
{
|
|
368
|
-
ns: DECK_PLUGIN
|
|
369
|
-
}
|
|
370
|
-
],
|
|
421
|
+
label,
|
|
371
422
|
icon,
|
|
372
423
|
menuItemType: "toggle",
|
|
373
|
-
isChecked:
|
|
424
|
+
isChecked: panel === id2
|
|
374
425
|
}
|
|
375
426
|
})), [
|
|
376
|
-
|
|
427
|
+
panel
|
|
377
428
|
]);
|
|
378
429
|
const coordinate = useMemo2(() => ({
|
|
379
430
|
entryId: id ?? "unknown",
|
|
@@ -381,62 +432,69 @@ var ComplementarySidebar = ({ panel, flatDeck }) => {
|
|
|
381
432
|
}), [
|
|
382
433
|
id
|
|
383
434
|
]);
|
|
384
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ React6.createElement(Main.ComplementarySidebar, null, /* @__PURE__ */ React6.createElement(StackContext.Provider, {
|
|
436
|
+
value: {
|
|
437
|
+
size: "contain",
|
|
438
|
+
orientation: "horizontal",
|
|
439
|
+
separators: true,
|
|
440
|
+
rail: true
|
|
441
|
+
}
|
|
442
|
+
}, /* @__PURE__ */ React6.createElement("div", {
|
|
385
443
|
role: "none",
|
|
386
|
-
className: mx2(
|
|
387
|
-
}, /* @__PURE__ */
|
|
444
|
+
className: mx2(railGridHorizontal, "grid-cols-1 bs-full divide-y divide-separator")
|
|
445
|
+
}, /* @__PURE__ */ React6.createElement(NodePlankHeading, {
|
|
388
446
|
coordinate,
|
|
389
447
|
node,
|
|
390
448
|
popoverAnchorId,
|
|
391
|
-
flatDeck,
|
|
392
449
|
actions
|
|
393
|
-
}), /* @__PURE__ */
|
|
394
|
-
className: "
|
|
395
|
-
}, node && /* @__PURE__ */
|
|
450
|
+
}), /* @__PURE__ */ React6.createElement("div", {
|
|
451
|
+
className: "divide-y divide-separator overflow-x-hidden overflow-y-scroll"
|
|
452
|
+
}, node && /* @__PURE__ */ React6.createElement(Surface3, {
|
|
396
453
|
key: id,
|
|
397
|
-
role: `complementary--${
|
|
454
|
+
role: `complementary--${panel}`,
|
|
455
|
+
limit: 1,
|
|
398
456
|
data: {
|
|
399
457
|
id,
|
|
400
458
|
subject: node.properties.object ?? node.properties.space,
|
|
401
459
|
popoverAnchorId
|
|
402
460
|
},
|
|
403
461
|
fallback: PlankContentError,
|
|
404
|
-
placeholder: /* @__PURE__ */
|
|
405
|
-
}))));
|
|
462
|
+
placeholder: /* @__PURE__ */ React6.createElement(PlankLoading, null)
|
|
463
|
+
})))));
|
|
406
464
|
};
|
|
407
465
|
|
|
408
466
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ContentEmpty.tsx
|
|
409
|
-
import
|
|
467
|
+
import React7 from "react";
|
|
410
468
|
import { Surface as Surface4 } from "@dxos/app-framework";
|
|
411
469
|
var ContentEmpty = () => {
|
|
412
|
-
return /* @__PURE__ */
|
|
470
|
+
return /* @__PURE__ */ React7.createElement("div", {
|
|
413
471
|
role: "none",
|
|
414
472
|
className: "min-bs-screen is-dvw sm:is-full flex items-center justify-center p-8",
|
|
415
473
|
"data-testid": "layoutPlugin.firstRunMessage"
|
|
416
|
-
}, /* @__PURE__ */
|
|
474
|
+
}, /* @__PURE__ */ React7.createElement("div", {
|
|
417
475
|
role: "none",
|
|
418
476
|
className: "grid place-items-center grid-rows-[min-content_min-content]"
|
|
419
|
-
}, /* @__PURE__ */
|
|
477
|
+
}, /* @__PURE__ */ React7.createElement(Surface4, {
|
|
420
478
|
role: "keyshortcuts"
|
|
421
479
|
})));
|
|
422
480
|
};
|
|
423
481
|
|
|
424
482
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Fullscreen.tsx
|
|
425
|
-
import
|
|
483
|
+
import React9 from "react";
|
|
426
484
|
import { Surface as Surface5 } from "@dxos/app-framework";
|
|
427
485
|
import { useGraph as useGraph4 } from "@dxos/plugin-graph";
|
|
428
486
|
import { fixedInsetFlexLayout } from "@dxos/react-ui-theme";
|
|
429
487
|
|
|
430
488
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Fallback.tsx
|
|
431
|
-
import
|
|
432
|
-
import { useTranslation as
|
|
489
|
+
import React8 from "react";
|
|
490
|
+
import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
433
491
|
import { errorText, mx as mx3 } from "@dxos/react-ui-theme";
|
|
434
492
|
var Fallback = () => {
|
|
435
|
-
const { t } =
|
|
436
|
-
return /* @__PURE__ */
|
|
493
|
+
const { t } = useTranslation4(DECK_PLUGIN);
|
|
494
|
+
return /* @__PURE__ */ React8.createElement("div", {
|
|
437
495
|
role: "none",
|
|
438
496
|
className: "min-bs-screen is-full flex items-center justify-center p-8"
|
|
439
|
-
}, /* @__PURE__ */
|
|
497
|
+
}, /* @__PURE__ */ React8.createElement("p", {
|
|
440
498
|
role: "alert",
|
|
441
499
|
className: mx3(errorText, "border border-error-400/50 rounded-lg flex items-center justify-center p-8 font-normal text-lg")
|
|
442
500
|
}, t("plugin error message")));
|
|
@@ -446,10 +504,10 @@ var Fallback = () => {
|
|
|
446
504
|
var Fullscreen = ({ id }) => {
|
|
447
505
|
const { graph } = useGraph4();
|
|
448
506
|
const fullScreenNode = useNode(graph, id);
|
|
449
|
-
return /* @__PURE__ */
|
|
507
|
+
return /* @__PURE__ */ React9.createElement("div", {
|
|
450
508
|
role: "none",
|
|
451
509
|
className: fixedInsetFlexLayout
|
|
452
|
-
}, /* @__PURE__ */
|
|
510
|
+
}, /* @__PURE__ */ React9.createElement(Surface5, {
|
|
453
511
|
role: "main",
|
|
454
512
|
limit: 1,
|
|
455
513
|
fallback: Fallback,
|
|
@@ -461,15 +519,13 @@ var Fullscreen = ({ id }) => {
|
|
|
461
519
|
};
|
|
462
520
|
|
|
463
521
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
464
|
-
import {
|
|
465
|
-
import
|
|
466
|
-
import { LayoutAction as LayoutAction2, NavigationAction as NavigationAction3, Surface as Surface6, useIntentDispatcher as useIntentDispatcher3, indexInPart, partLength } from "@dxos/app-framework";
|
|
522
|
+
import React10, { memo as memo2, useCallback, useLayoutEffect, useMemo as useMemo3, useRef } from "react";
|
|
523
|
+
import { Surface as Surface6, useIntentDispatcher as useIntentDispatcher3, indexInPart, partLength } from "@dxos/app-framework";
|
|
467
524
|
import { debounce } from "@dxos/async";
|
|
468
525
|
import { useGraph as useGraph5 } from "@dxos/plugin-graph";
|
|
469
|
-
import { Button, Tooltip, useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
470
526
|
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
471
|
-
import {
|
|
472
|
-
import { mainIntrinsicSize } from "@dxos/react-ui-theme";
|
|
527
|
+
import { StackItem as StackItem2, railGridHorizontal as railGridHorizontal2 } from "@dxos/react-ui-stack";
|
|
528
|
+
import { mainIntrinsicSize, mx as mx4 } from "@dxos/react-ui-theme";
|
|
473
529
|
|
|
474
530
|
// packages/plugins/plugin-deck/src/components/DeckContext.ts
|
|
475
531
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
@@ -478,39 +534,40 @@ var DeckContext = createContext2(null);
|
|
|
478
534
|
var useDeckContext = () => useContext2(DeckContext) ?? raise2(new Error("Missing DeckContext"));
|
|
479
535
|
|
|
480
536
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
481
|
-
var
|
|
482
|
-
|
|
537
|
+
var UNKNOWN_ID = "unknown_id";
|
|
538
|
+
var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, layoutMode, order, last }) => {
|
|
483
539
|
const dispatch = useIntentDispatcher3();
|
|
484
|
-
const { popoverAnchorId, scrollIntoView } = useLayout();
|
|
485
|
-
const { plankSizing } = useDeckContext();
|
|
486
|
-
const { graph } = useGraph5();
|
|
487
|
-
const node = useNode(graph, entry.id);
|
|
488
|
-
const rootElement = useRef(null);
|
|
489
|
-
const resizeable = layoutMode === "deck";
|
|
490
|
-
const attendableAttrs = useAttendableAttributes(entry.id);
|
|
491
540
|
const coordinate = useMemo3(() => ({
|
|
492
541
|
part,
|
|
493
|
-
entryId: entry
|
|
542
|
+
entryId: entry?.id ?? UNKNOWN_ID
|
|
494
543
|
}), [
|
|
495
|
-
entry
|
|
544
|
+
entry?.id,
|
|
496
545
|
part
|
|
497
546
|
]);
|
|
547
|
+
const { popoverAnchorId, scrollIntoView } = useLayout();
|
|
548
|
+
const { plankSizing } = useDeckContext();
|
|
549
|
+
const { graph } = useGraph5();
|
|
550
|
+
const node = useNode(graph, entry?.id);
|
|
551
|
+
const rootElement = useRef(null);
|
|
552
|
+
const canResize = layoutMode === "deck";
|
|
553
|
+
const Root = part === "solo" ? "article" : StackItem2.Root;
|
|
554
|
+
const attendableAttrs = useAttendableAttributes(coordinate.entryId);
|
|
498
555
|
const index = indexInPart(layoutParts, coordinate);
|
|
499
556
|
const length = partLength(layoutParts, part);
|
|
500
557
|
const canIncrementStart = part === "main" && index !== void 0 && index > 0 && length !== void 0 && length > 1;
|
|
501
558
|
const canIncrementEnd = part === "main" && index !== void 0 && index < length - 1 && length !== void 0;
|
|
502
|
-
const size = plankSizing?.[
|
|
503
|
-
const setSize = useCallback(debounce((
|
|
504
|
-
|
|
559
|
+
const size = plankSizing?.[coordinate.entryId];
|
|
560
|
+
const setSize = useCallback(debounce((nextSize) => {
|
|
561
|
+
return dispatch({
|
|
505
562
|
action: DeckAction.UPDATE_PLANK_SIZE,
|
|
506
563
|
data: {
|
|
507
|
-
id:
|
|
508
|
-
size:
|
|
564
|
+
id: coordinate.entryId,
|
|
565
|
+
size: nextSize
|
|
509
566
|
}
|
|
510
567
|
});
|
|
511
568
|
}, 200), [
|
|
512
569
|
dispatch,
|
|
513
|
-
|
|
570
|
+
coordinate.entryId
|
|
514
571
|
]);
|
|
515
572
|
const handleKeyDown = useCallback((event) => {
|
|
516
573
|
if (event.target === event.currentTarget && event.key === "Escape") {
|
|
@@ -518,7 +575,7 @@ var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, flatDeck, searchE
|
|
|
518
575
|
}
|
|
519
576
|
}, []);
|
|
520
577
|
useLayoutEffect(() => {
|
|
521
|
-
if (scrollIntoView ===
|
|
578
|
+
if (scrollIntoView === coordinate.entryId) {
|
|
522
579
|
rootElement.current?.focus({
|
|
523
580
|
preventScroll: true
|
|
524
581
|
});
|
|
@@ -528,14 +585,15 @@ var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, flatDeck, searchE
|
|
|
528
585
|
});
|
|
529
586
|
}
|
|
530
587
|
}, [
|
|
588
|
+
coordinate.entryId,
|
|
531
589
|
scrollIntoView,
|
|
532
590
|
layoutMode
|
|
533
591
|
]);
|
|
534
592
|
const isSolo = layoutMode === "solo" && part === "solo";
|
|
535
|
-
const
|
|
593
|
+
const isAttendable = isSolo || layoutMode === "deck" && part === "main";
|
|
536
594
|
const sizeAttrs = useMainSize();
|
|
537
595
|
const data = useMemo3(() => node && {
|
|
538
|
-
...entry
|
|
596
|
+
...entry?.path ? {
|
|
539
597
|
subject: node.data,
|
|
540
598
|
path: entry.path
|
|
541
599
|
} : {
|
|
@@ -544,84 +602,52 @@ var Plank = /* @__PURE__ */ memo2(({ entry, layoutParts, part, flatDeck, searchE
|
|
|
544
602
|
coordinate,
|
|
545
603
|
popoverAnchorId
|
|
546
604
|
}, [
|
|
547
|
-
node
|
|
605
|
+
node,
|
|
606
|
+
node?.data,
|
|
607
|
+
entry?.path,
|
|
608
|
+
coordinate,
|
|
609
|
+
popoverAnchorId
|
|
548
610
|
]);
|
|
549
|
-
const placeholder = useMemo3(() => /* @__PURE__ */
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
611
|
+
const placeholder = useMemo3(() => /* @__PURE__ */ React10.createElement(PlankLoading, null), []);
|
|
612
|
+
const className = mx4("attention-surface relative", isSolo && mainIntrinsicSize, isSolo && railGridHorizontal2, isSolo && "grid absolute inset-0 divide-separator divide-y", last && "!border-li border-separator");
|
|
613
|
+
return /* @__PURE__ */ React10.createElement(Root, {
|
|
614
|
+
ref: rootElement,
|
|
615
|
+
"data-testid": "deck.plank",
|
|
616
|
+
tabIndex: 0,
|
|
617
|
+
...part === "solo" ? {
|
|
618
|
+
...sizeAttrs,
|
|
619
|
+
className
|
|
620
|
+
} : {
|
|
621
|
+
item: {
|
|
622
|
+
id: entry?.id ?? "never"
|
|
623
|
+
},
|
|
624
|
+
size,
|
|
625
|
+
onSizeChange: setSize,
|
|
626
|
+
classNames: className,
|
|
627
|
+
order,
|
|
628
|
+
role: "article"
|
|
559
629
|
},
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
}, /* @__PURE__ */
|
|
563
|
-
...isSolo && sizeAttrs,
|
|
564
|
-
classNames: [
|
|
565
|
-
isSolo && mainIntrinsicSize,
|
|
566
|
-
!flatDeck && "bg-base"
|
|
567
|
-
],
|
|
568
|
-
style: isSolo ? {
|
|
569
|
-
inlineSize: ""
|
|
570
|
-
} : {}
|
|
571
|
-
}, node ? /* @__PURE__ */ React9.createElement(React9.Fragment, null, /* @__PURE__ */ React9.createElement(NodePlankHeading, {
|
|
630
|
+
...isAttendable ? attendableAttrs : {},
|
|
631
|
+
onKeyDown: handleKeyDown
|
|
632
|
+
}, node ? /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement(NodePlankHeading, {
|
|
572
633
|
coordinate,
|
|
573
634
|
node,
|
|
574
635
|
canIncrementStart,
|
|
575
636
|
canIncrementEnd,
|
|
576
|
-
popoverAnchorId
|
|
577
|
-
|
|
578
|
-
}), /* @__PURE__ */ React9.createElement(Surface6, {
|
|
637
|
+
popoverAnchorId
|
|
638
|
+
}), /* @__PURE__ */ React10.createElement(Surface6, {
|
|
579
639
|
role: "article",
|
|
580
640
|
data,
|
|
581
641
|
limit: 1,
|
|
582
642
|
fallback: PlankContentError,
|
|
583
643
|
placeholder
|
|
584
|
-
})) : /* @__PURE__ */
|
|
585
|
-
layoutCoordinate: coordinate
|
|
586
|
-
|
|
587
|
-
})), searchEnabled && resizeable ? /* @__PURE__ */ React9.createElement("div", {
|
|
588
|
-
role: "none",
|
|
589
|
-
className: "grid grid-rows-subgrid row-span-3"
|
|
590
|
-
}, /* @__PURE__ */ React9.createElement(Tooltip.Root, null, /* @__PURE__ */ React9.createElement(Tooltip.Trigger, {
|
|
591
|
-
asChild: true
|
|
592
|
-
}, /* @__PURE__ */ React9.createElement(Button, {
|
|
593
|
-
"data-testid": "plankHeading.open",
|
|
594
|
-
variant: "ghost",
|
|
595
|
-
classNames: "p-1 w-fit",
|
|
596
|
-
onClick: () => dispatch([
|
|
597
|
-
{
|
|
598
|
-
action: LayoutAction2.SET_LAYOUT,
|
|
599
|
-
data: {
|
|
600
|
-
element: "dialog",
|
|
601
|
-
component: "dxos.org/plugin/search/Dialog",
|
|
602
|
-
dialogBlockAlign: "start",
|
|
603
|
-
subject: {
|
|
604
|
-
action: NavigationAction3.SET,
|
|
605
|
-
position: "add-after",
|
|
606
|
-
coordinate
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
])
|
|
611
|
-
}, /* @__PURE__ */ React9.createElement("span", {
|
|
612
|
-
className: "sr-only"
|
|
613
|
-
}, t("insert plank label")), /* @__PURE__ */ React9.createElement(Plus, null))), /* @__PURE__ */ React9.createElement(Tooltip.Portal, null, /* @__PURE__ */ React9.createElement(Tooltip.Content, {
|
|
614
|
-
side: "bottom",
|
|
615
|
-
classNames: "z-[70]"
|
|
616
|
-
}, t("insert plank label")))), /* @__PURE__ */ React9.createElement(NaturalPlank.ResizeHandle, {
|
|
617
|
-
classNames: "row-start-[toolbar-start] row-end-[content-end]"
|
|
618
|
-
})) : resizeable ? /* @__PURE__ */ React9.createElement(NaturalPlank.ResizeHandle, {
|
|
619
|
-
classNames: "row-span-3"
|
|
620
|
-
}) : null);
|
|
644
|
+
})) : /* @__PURE__ */ React10.createElement(PlankError, {
|
|
645
|
+
layoutCoordinate: coordinate
|
|
646
|
+
}), canResize && /* @__PURE__ */ React10.createElement(StackItem2.ResizeHandle, null));
|
|
621
647
|
});
|
|
622
648
|
|
|
623
649
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Sidebar.tsx
|
|
624
|
-
import
|
|
650
|
+
import React11, { useMemo as useMemo4 } from "react";
|
|
625
651
|
import { openIds, Surface as Surface7 } from "@dxos/app-framework";
|
|
626
652
|
import { Main as Main2 } from "@dxos/react-ui";
|
|
627
653
|
var Sidebar = ({ layoutParts }) => {
|
|
@@ -644,7 +670,7 @@ var Sidebar = ({ layoutParts }) => {
|
|
|
644
670
|
popoverAnchorId,
|
|
645
671
|
activeIds
|
|
646
672
|
]);
|
|
647
|
-
return /* @__PURE__ */
|
|
673
|
+
return /* @__PURE__ */ React11.createElement(Main2.NavigationSidebar, null, /* @__PURE__ */ React11.createElement(Surface7, {
|
|
648
674
|
role: "navigation",
|
|
649
675
|
data: {
|
|
650
676
|
...navigationData
|
|
@@ -654,51 +680,51 @@ var Sidebar = ({ layoutParts }) => {
|
|
|
654
680
|
};
|
|
655
681
|
|
|
656
682
|
// packages/plugins/plugin-deck/src/components/DeckLayout/StatusBar.tsx
|
|
657
|
-
import
|
|
683
|
+
import React12 from "react";
|
|
658
684
|
import { Surface as Surface8 } from "@dxos/app-framework";
|
|
659
|
-
import { mainPadding, mainPaddingTransitions, mx as
|
|
685
|
+
import { mainPadding, mainPaddingTransitions, mx as mx5 } from "@dxos/react-ui-theme";
|
|
660
686
|
var StatusBar = ({ showHints }) => {
|
|
661
687
|
const sizeAttrs = useMainSize();
|
|
662
|
-
return /* @__PURE__ */
|
|
688
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
663
689
|
role: "none",
|
|
664
690
|
...sizeAttrs,
|
|
665
|
-
className:
|
|
666
|
-
}, /* @__PURE__ */
|
|
691
|
+
className: mx5("fixed flex justify-between block-end-0 inset-inline-0 items-center border-bs border-separator z-[2]", mainPadding, mainPaddingTransitions)
|
|
692
|
+
}, /* @__PURE__ */ React12.createElement("div", {
|
|
667
693
|
role: "none"
|
|
668
|
-
}, showHints && /* @__PURE__ */
|
|
694
|
+
}, showHints && /* @__PURE__ */ React12.createElement(Surface8, {
|
|
669
695
|
role: "hints",
|
|
670
696
|
limit: 1
|
|
671
|
-
})), /* @__PURE__ */
|
|
697
|
+
})), /* @__PURE__ */ React12.createElement(Surface8, {
|
|
672
698
|
role: "status-bar",
|
|
673
699
|
limit: 1
|
|
674
700
|
}));
|
|
675
701
|
};
|
|
676
702
|
|
|
677
703
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Toast.tsx
|
|
678
|
-
import
|
|
679
|
-
import { Button as Button2, Icon as
|
|
704
|
+
import React13 from "react";
|
|
705
|
+
import { Button as Button2, Icon as Icon3, Toast as NaturalToast } from "@dxos/react-ui";
|
|
680
706
|
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
681
|
-
return /* @__PURE__ */
|
|
707
|
+
return /* @__PURE__ */ React13.createElement(NaturalToast.Root, {
|
|
682
708
|
"data-testid": id,
|
|
683
709
|
defaultOpen: true,
|
|
684
710
|
duration,
|
|
685
711
|
onOpenChange
|
|
686
|
-
}, /* @__PURE__ */
|
|
712
|
+
}, /* @__PURE__ */ React13.createElement(NaturalToast.Body, null, /* @__PURE__ */ React13.createElement(NaturalToast.Title, {
|
|
687
713
|
classNames: "items-center"
|
|
688
|
-
}, /* @__PURE__ */
|
|
714
|
+
}, icon && /* @__PURE__ */ React13.createElement(Icon3, {
|
|
689
715
|
icon,
|
|
690
716
|
size: 5,
|
|
691
717
|
classNames: "inline mr-1"
|
|
692
|
-
}), /* @__PURE__ */
|
|
718
|
+
}), /* @__PURE__ */ React13.createElement("span", null, title)), description && /* @__PURE__ */ React13.createElement(NaturalToast.Description, null, description)), /* @__PURE__ */ React13.createElement(NaturalToast.Actions, null, onAction && actionAlt && actionLabel && /* @__PURE__ */ React13.createElement(NaturalToast.Action, {
|
|
693
719
|
altText: actionAlt,
|
|
694
720
|
asChild: true
|
|
695
|
-
}, /* @__PURE__ */
|
|
721
|
+
}, /* @__PURE__ */ React13.createElement(Button2, {
|
|
696
722
|
"data-testid": "toast.action",
|
|
697
723
|
variant: "primary",
|
|
698
724
|
onClick: () => onAction?.()
|
|
699
|
-
}, actionLabel)), closeLabel && /* @__PURE__ */
|
|
725
|
+
}, actionLabel)), closeLabel && /* @__PURE__ */ React13.createElement(NaturalToast.Close, {
|
|
700
726
|
asChild: true
|
|
701
|
-
}, /* @__PURE__ */
|
|
727
|
+
}, /* @__PURE__ */ React13.createElement(Button2, {
|
|
702
728
|
"data-testid": "toast.close"
|
|
703
729
|
}, closeLabel))));
|
|
704
730
|
};
|
|
@@ -722,53 +748,50 @@ var checkAppScheme = (url) => {
|
|
|
722
748
|
var getEffectivePart = (partName, layoutMode) => layoutMode === "solo" && partName === "main" ? "solo" : partName;
|
|
723
749
|
|
|
724
750
|
// packages/plugins/plugin-deck/src/util/overscroll.ts
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
if (!planks?.length) {
|
|
751
|
+
var calculateOverscroll = (planksCount) => {
|
|
752
|
+
if (!planksCount) {
|
|
728
753
|
return {
|
|
729
754
|
paddingInlineStart: 0,
|
|
730
755
|
paddingInlineEnd: 0
|
|
731
756
|
};
|
|
732
757
|
}
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
const getPlankSize = (id) => (plankSizing[id] ?? PLANK_DEFAULTS.size).toFixed(2) + "rem";
|
|
736
|
-
if (planks.length === 1) {
|
|
737
|
-
const plank = planks[0];
|
|
738
|
-
const plankSize = getPlankSize(plank.id);
|
|
739
|
-
const overscrollPadding = `max(0px, calc(((100dvw - ${sidebarWidth} - ${complementarySidebarWidth} - (${plankSize} + 20px)) / 2)))`;
|
|
758
|
+
if (planksCount === 1) {
|
|
759
|
+
const overscrollPadding = "max(0px, calc(((100dvw - var(--dx-main-sidebarWidth) - var(--dx-main-complementaryWidth) - (var(--dx-main-contentFirstWidth) + 1px)) / 2)))";
|
|
740
760
|
return {
|
|
741
761
|
paddingInlineStart: overscrollPadding,
|
|
742
762
|
paddingInlineEnd: overscrollPadding
|
|
743
763
|
};
|
|
744
764
|
} else {
|
|
745
|
-
const first = planks[0];
|
|
746
|
-
const firstSize = getPlankSize(first.id);
|
|
747
|
-
const last = planks[planks.length - 1];
|
|
748
|
-
const lastSize = getPlankSize(last.id);
|
|
749
765
|
return {
|
|
750
|
-
paddingInlineStart:
|
|
751
|
-
paddingInlineEnd:
|
|
766
|
+
paddingInlineStart: "max(0px, calc(((100dvw - (var(--dx-main-contentFirstWidth) + 1px)) / 2) - var(--dx-main-sidebarWidth)))",
|
|
767
|
+
paddingInlineEnd: "max(0px, calc(((100dvw - (var(--dx-main-contentLastWidth) + 1px)) / 2) - var(--dx-main-complementaryWidth)))"
|
|
752
768
|
};
|
|
753
769
|
}
|
|
754
770
|
};
|
|
755
771
|
|
|
756
772
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
757
|
-
var
|
|
773
|
+
var PlankSeparator = ({ index }) => index > 0 ? /* @__PURE__ */ React14.createElement("span", {
|
|
774
|
+
role: "separator",
|
|
775
|
+
className: "row-span-2 bg-deck is-4",
|
|
776
|
+
style: {
|
|
777
|
+
gridColumn: index * 2
|
|
778
|
+
}
|
|
779
|
+
}) : null;
|
|
780
|
+
var DeckLayout = ({ layoutParts, toasts, overscroll, showHints, panels, onDismissToast }) => {
|
|
758
781
|
const context = useLayout();
|
|
759
782
|
const { layoutMode, sidebarOpen, complementarySidebarOpen, dialogOpen, dialogContent, dialogBlockAlign, popoverOpen, popoverContent, popoverAnchorId } = context;
|
|
760
783
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
761
784
|
const { plankSizing } = useDeckContext();
|
|
762
785
|
const attentionPlugin = usePlugin("dxos.org/plugin/attention");
|
|
763
|
-
const searchPlugin = usePlugin("dxos.org/plugin/search");
|
|
764
786
|
const fullScreenSlug = useMemo5(() => firstIdInPart(layoutParts, "fullScreen"), [
|
|
765
787
|
layoutParts
|
|
766
788
|
]);
|
|
767
789
|
const scrollLeftRef = useRef2();
|
|
768
790
|
const deckRef = useRef2(null);
|
|
791
|
+
const isSoloModeLoaded = layoutMode === "solo" && Boolean(layoutParts.solo?.[0]);
|
|
769
792
|
useEffect5(() => {
|
|
770
793
|
const attended = untracked(() => attentionPlugin?.provides.attention.attended ?? []);
|
|
771
|
-
const firstId =
|
|
794
|
+
const firstId = isSoloModeLoaded ? firstIdInPart(layoutParts, "solo") : firstIdInPart(layoutParts, "main");
|
|
772
795
|
if (attended.length === 0 && firstId) {
|
|
773
796
|
document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
|
|
774
797
|
}
|
|
@@ -795,26 +818,18 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
795
818
|
}, [
|
|
796
819
|
layoutMode
|
|
797
820
|
]);
|
|
798
|
-
const isEmpty = layoutParts.main?.length === 0 && layoutParts.solo?.length === 0;
|
|
821
|
+
const isEmpty = (layoutParts.main?.length ?? 0) === 0 && (layoutParts.solo?.length ?? 0) === 0;
|
|
799
822
|
const padding = useMemo5(() => {
|
|
800
823
|
if (layoutMode === "deck" && overscroll === "centering") {
|
|
801
|
-
return calculateOverscroll(layoutParts.main
|
|
824
|
+
return calculateOverscroll(layoutParts.main?.length ?? 0);
|
|
802
825
|
}
|
|
803
826
|
return {};
|
|
804
827
|
}, [
|
|
805
828
|
layoutMode,
|
|
806
829
|
overscroll,
|
|
807
|
-
layoutParts.main
|
|
808
|
-
plankSizing,
|
|
809
|
-
sidebarOpen,
|
|
810
|
-
complementarySidebarOpen
|
|
830
|
+
layoutParts.main
|
|
811
831
|
]);
|
|
812
|
-
|
|
813
|
-
return /* @__PURE__ */ React13.createElement(Fullscreen, {
|
|
814
|
-
id: fullScreenSlug
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
return /* @__PURE__ */ React13.createElement(Popover2.Root, {
|
|
832
|
+
return /* @__PURE__ */ React14.createElement(Popover2.Root, {
|
|
818
833
|
modal: true,
|
|
819
834
|
open: !!(popoverAnchorId && popoverOpen),
|
|
820
835
|
onOpenChange: (nextOpen) => {
|
|
@@ -825,98 +840,111 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
825
840
|
context.popoverAnchorId = void 0;
|
|
826
841
|
}
|
|
827
842
|
}
|
|
828
|
-
}, /* @__PURE__ */
|
|
843
|
+
}, /* @__PURE__ */ React14.createElement(ActiveNode, null), layoutMode === "fullscreen" && /* @__PURE__ */ React14.createElement(Fullscreen, {
|
|
844
|
+
id: fullScreenSlug
|
|
845
|
+
}), layoutMode !== "fullscreen" && /* @__PURE__ */ React14.createElement(Main3.Root, {
|
|
829
846
|
navigationSidebarOpen: context.sidebarOpen,
|
|
830
847
|
onNavigationSidebarOpenChange: (next) => context.sidebarOpen = next,
|
|
831
848
|
complementarySidebarOpen: context.complementarySidebarOpen,
|
|
832
849
|
onComplementarySidebarOpenChange: (next) => context.complementarySidebarOpen = next
|
|
833
|
-
}, /* @__PURE__ */
|
|
850
|
+
}, /* @__PURE__ */ React14.createElement(Main3.Notch, {
|
|
834
851
|
classNames: "z-[21]"
|
|
835
|
-
}, /* @__PURE__ */
|
|
852
|
+
}, /* @__PURE__ */ React14.createElement(Surface9, {
|
|
836
853
|
role: "notch-start"
|
|
837
|
-
}), /* @__PURE__ */
|
|
854
|
+
}), /* @__PURE__ */ React14.createElement(Button3, {
|
|
838
855
|
onClick: () => context.sidebarOpen = !context.sidebarOpen,
|
|
839
856
|
variant: "ghost",
|
|
840
857
|
classNames: "p-1"
|
|
841
|
-
}, /* @__PURE__ */
|
|
842
|
-
className: "sr-only"
|
|
843
|
-
}, t("open navigation sidebar label")), /* @__PURE__ */ React13.createElement(MenuIcon, {
|
|
844
|
-
weight: "light",
|
|
845
|
-
className: getSize(5)
|
|
846
|
-
})), /* @__PURE__ */ React13.createElement(Button3, {
|
|
847
|
-
onClick: () => context.complementarySidebarOpen = !context.complementarySidebarOpen,
|
|
848
|
-
variant: "ghost",
|
|
849
|
-
classNames: "p-1"
|
|
850
|
-
}, /* @__PURE__ */ React13.createElement("span", {
|
|
858
|
+
}, /* @__PURE__ */ React14.createElement("span", {
|
|
851
859
|
className: "sr-only"
|
|
852
|
-
}, t("open
|
|
853
|
-
mirrored: true,
|
|
860
|
+
}, t("open navigation sidebar label")), /* @__PURE__ */ React14.createElement(MenuIcon, {
|
|
854
861
|
weight: "light",
|
|
855
862
|
className: getSize(5)
|
|
856
|
-
})), /* @__PURE__ */
|
|
863
|
+
})), /* @__PURE__ */ React14.createElement(Surface9, {
|
|
857
864
|
role: "notch-end"
|
|
858
|
-
})), /* @__PURE__ */
|
|
865
|
+
})), /* @__PURE__ */ React14.createElement(Sidebar, {
|
|
859
866
|
layoutParts
|
|
860
|
-
}), /* @__PURE__ */
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
}), /* @__PURE__ */
|
|
867
|
+
}), /* @__PURE__ */ React14.createElement(ComplementarySidebar, {
|
|
868
|
+
panels,
|
|
869
|
+
current: layoutParts.complementary?.[0].id
|
|
870
|
+
}), /* @__PURE__ */ React14.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React14.createElement(Main3.Content, {
|
|
864
871
|
handlesFocus: true
|
|
865
|
-
}, /* @__PURE__ */
|
|
872
|
+
}, /* @__PURE__ */ React14.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React14.createElement(Main3.Content, {
|
|
866
873
|
bounce: true,
|
|
867
874
|
classNames: "grid block-end-[--statusbar-size]",
|
|
868
|
-
handlesFocus: true
|
|
869
|
-
|
|
875
|
+
handlesFocus: true,
|
|
876
|
+
style: {
|
|
877
|
+
"--dx-main-sidebarWidth": sidebarOpen ? "var(--nav-sidebar-size)" : "0px",
|
|
878
|
+
"--dx-main-complementaryWidth": complementarySidebarOpen ? "var(--complementary-sidebar-size)" : "0px",
|
|
879
|
+
"--dx-main-contentFirstWidth": `${plankSizing[layoutParts.main?.[0]?.id ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
|
|
880
|
+
"--dx-main-contentLastWidth": `${plankSizing[layoutParts.main?.[(layoutParts.main?.length ?? 1) - 1]?.id ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`
|
|
881
|
+
}
|
|
882
|
+
}, /* @__PURE__ */ React14.createElement("div", {
|
|
870
883
|
role: "none",
|
|
871
|
-
className: "relative"
|
|
872
|
-
|
|
873
|
-
|
|
884
|
+
className: !isSoloModeLoaded ? "relative bg-deck overflow-hidden" : "sr-only",
|
|
885
|
+
...isSoloModeLoaded && {
|
|
886
|
+
inert: ""
|
|
887
|
+
}
|
|
888
|
+
}, /* @__PURE__ */ React14.createElement(Stack, {
|
|
889
|
+
orientation: "horizontal",
|
|
890
|
+
size: "contain",
|
|
874
891
|
classNames: [
|
|
875
|
-
|
|
876
|
-
mainPaddingTransitions2
|
|
877
|
-
"absolute inset-0",
|
|
878
|
-
slots?.wallpaper?.classNames
|
|
892
|
+
"absolute inset-block-0 -inset-inline-px",
|
|
893
|
+
mainPaddingTransitions2
|
|
879
894
|
],
|
|
880
|
-
solo: layoutMode === "solo",
|
|
881
895
|
onScroll: handleScroll,
|
|
896
|
+
itemsCount: 2 * (layoutParts.main?.length ?? 0) - 1,
|
|
897
|
+
style: padding,
|
|
882
898
|
ref: deckRef
|
|
883
|
-
}, /* @__PURE__ */
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
part: "solo",
|
|
889
|
-
layoutMode,
|
|
890
|
-
flatDeck,
|
|
891
|
-
searchEnabled: !!searchPlugin
|
|
892
|
-
}), layoutParts.main?.map((layoutEntry) => /* @__PURE__ */ React13.createElement(Plank, {
|
|
893
|
-
key: layoutEntry.id,
|
|
899
|
+
}, layoutParts.main?.map((layoutEntry, index) => /* @__PURE__ */ React14.createElement(Fragment2, {
|
|
900
|
+
key: layoutEntry.id
|
|
901
|
+
}, /* @__PURE__ */ React14.createElement(PlankSeparator, {
|
|
902
|
+
index
|
|
903
|
+
}), /* @__PURE__ */ React14.createElement(Plank, {
|
|
894
904
|
entry: layoutEntry,
|
|
895
905
|
layoutParts,
|
|
896
906
|
part: "main",
|
|
897
907
|
layoutMode,
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
}))))), /* @__PURE__ */
|
|
908
|
+
order: index * 2 + 1,
|
|
909
|
+
last: index === layoutParts.main.length - 1
|
|
910
|
+
}))))), /* @__PURE__ */ React14.createElement("div", {
|
|
911
|
+
role: "none",
|
|
912
|
+
className: isSoloModeLoaded ? "relative bg-deck overflow-hidden" : "sr-only",
|
|
913
|
+
...!isSoloModeLoaded && {
|
|
914
|
+
inert: ""
|
|
915
|
+
}
|
|
916
|
+
}, /* @__PURE__ */ React14.createElement(StackContext2.Provider, {
|
|
917
|
+
value: {
|
|
918
|
+
size: "contain",
|
|
919
|
+
orientation: "horizontal",
|
|
920
|
+
separators: true,
|
|
921
|
+
rail: true
|
|
922
|
+
}
|
|
923
|
+
}, /* @__PURE__ */ React14.createElement(Plank, {
|
|
924
|
+
entry: layoutParts.solo?.[0],
|
|
925
|
+
layoutParts,
|
|
926
|
+
part: "solo",
|
|
927
|
+
layoutMode
|
|
928
|
+
})))), /* @__PURE__ */ React14.createElement(StatusBar, {
|
|
901
929
|
showHints
|
|
902
|
-
}), /* @__PURE__ */
|
|
930
|
+
})), /* @__PURE__ */ React14.createElement(Popover2.Portal, null, /* @__PURE__ */ React14.createElement(Popover2.Content, {
|
|
903
931
|
classNames: "z-[60]",
|
|
904
932
|
onEscapeKeyDown: () => {
|
|
905
933
|
context.popoverOpen = false;
|
|
906
934
|
context.popoverAnchorId = void 0;
|
|
907
935
|
}
|
|
908
|
-
}, /* @__PURE__ */
|
|
936
|
+
}, /* @__PURE__ */ React14.createElement(Popover2.Viewport, null, /* @__PURE__ */ React14.createElement(Surface9, {
|
|
909
937
|
role: "popover",
|
|
910
938
|
data: popoverContent
|
|
911
|
-
})), /* @__PURE__ */
|
|
939
|
+
})), /* @__PURE__ */ React14.createElement(Popover2.Arrow, null))), /* @__PURE__ */ React14.createElement(Dialog.Root, {
|
|
912
940
|
open: dialogOpen,
|
|
913
941
|
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
914
|
-
}, /* @__PURE__ */
|
|
942
|
+
}, /* @__PURE__ */ React14.createElement(Dialog.Overlay, {
|
|
915
943
|
blockAlign: dialogBlockAlign
|
|
916
|
-
}, /* @__PURE__ */
|
|
944
|
+
}, /* @__PURE__ */ React14.createElement(Surface9, {
|
|
917
945
|
role: "dialog",
|
|
918
946
|
data: dialogContent
|
|
919
|
-
}))), toasts?.map((toast) => /* @__PURE__ */
|
|
947
|
+
}))), toasts?.map((toast) => /* @__PURE__ */ React14.createElement(Toast, {
|
|
920
948
|
...toast,
|
|
921
949
|
key: toast.id,
|
|
922
950
|
onOpenChange: (open) => {
|
|
@@ -925,66 +953,54 @@ var DeckLayout = ({ layoutParts, toasts, flatDeck, overscroll, showHints, slots,
|
|
|
925
953
|
}
|
|
926
954
|
return open;
|
|
927
955
|
}
|
|
928
|
-
})))
|
|
956
|
+
})));
|
|
929
957
|
};
|
|
930
958
|
|
|
931
959
|
// packages/plugins/plugin-deck/src/components/LayoutSettings.tsx
|
|
932
|
-
import
|
|
960
|
+
import React15 from "react";
|
|
933
961
|
import { Input, Select, useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
934
|
-
import {
|
|
935
|
-
|
|
936
|
-
// packages/plugins/plugin-deck/src/types.ts
|
|
937
|
-
var NewPlankPositions = [
|
|
938
|
-
"start",
|
|
939
|
-
"end"
|
|
940
|
-
];
|
|
941
|
-
var OverscrollOptions = [
|
|
942
|
-
"none",
|
|
943
|
-
"centering"
|
|
944
|
-
];
|
|
945
|
-
|
|
946
|
-
// packages/plugins/plugin-deck/src/components/LayoutSettings.tsx
|
|
962
|
+
import { DeprecatedFormInput } from "@dxos/react-ui-data";
|
|
947
963
|
var isSocket = !!globalThis.__args;
|
|
948
964
|
var LayoutSettings = ({ settings }) => {
|
|
949
965
|
const { t } = useTranslation6(DECK_PLUGIN);
|
|
950
|
-
return /* @__PURE__ */
|
|
966
|
+
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(DeprecatedFormInput, {
|
|
951
967
|
label: t("select new plank positioning label")
|
|
952
|
-
}, /* @__PURE__ */
|
|
968
|
+
}, /* @__PURE__ */ React15.createElement(Select.Root, {
|
|
953
969
|
value: settings.newPlankPositioning ?? "start",
|
|
954
970
|
onValueChange: (value) => settings.newPlankPositioning = value
|
|
955
|
-
}, /* @__PURE__ */
|
|
971
|
+
}, /* @__PURE__ */ React15.createElement(Select.TriggerButton, {
|
|
956
972
|
placeholder: t("select new plank positioning placeholder")
|
|
957
|
-
}), /* @__PURE__ */
|
|
973
|
+
}), /* @__PURE__ */ React15.createElement(Select.Portal, null, /* @__PURE__ */ React15.createElement(Select.Content, null, /* @__PURE__ */ React15.createElement(Select.Viewport, null, NewPlankPositions.map((position) => /* @__PURE__ */ React15.createElement(Select.Option, {
|
|
958
974
|
key: position,
|
|
959
975
|
value: position
|
|
960
|
-
}, t(`settings new plank position ${position} label`)))))))), /* @__PURE__ */
|
|
976
|
+
}, t(`settings new plank position ${position} label`)))))))), /* @__PURE__ */ React15.createElement(DeprecatedFormInput, {
|
|
961
977
|
label: t("settings overscroll label")
|
|
962
|
-
}, /* @__PURE__ */
|
|
978
|
+
}, /* @__PURE__ */ React15.createElement(Select.Root, {
|
|
963
979
|
value: settings.overscroll ?? "none",
|
|
964
980
|
onValueChange: (value) => settings.overscroll = value
|
|
965
|
-
}, /* @__PURE__ */
|
|
981
|
+
}, /* @__PURE__ */ React15.createElement(Select.TriggerButton, {
|
|
966
982
|
placeholder: t("select overscroll placeholder")
|
|
967
|
-
}), /* @__PURE__ */
|
|
983
|
+
}), /* @__PURE__ */ React15.createElement(Select.Portal, null, /* @__PURE__ */ React15.createElement(Select.Content, null, /* @__PURE__ */ React15.createElement(Select.Viewport, null, OverscrollOptions.map((option) => /* @__PURE__ */ React15.createElement(Select.Option, {
|
|
968
984
|
key: option,
|
|
969
985
|
value: option
|
|
970
|
-
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */
|
|
986
|
+
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React15.createElement(DeprecatedFormInput, {
|
|
971
987
|
label: t("settings show hints label")
|
|
972
|
-
}, /* @__PURE__ */
|
|
988
|
+
}, /* @__PURE__ */ React15.createElement(Input.Switch, {
|
|
973
989
|
checked: settings.showHints,
|
|
974
990
|
onCheckedChange: (checked) => settings.showHints = checked
|
|
975
|
-
})), !isSocket && /* @__PURE__ */
|
|
991
|
+
})), !isSocket && /* @__PURE__ */ React15.createElement(DeprecatedFormInput, {
|
|
976
992
|
label: t("settings native redirect label")
|
|
977
|
-
}, /* @__PURE__ */
|
|
993
|
+
}, /* @__PURE__ */ React15.createElement(Input.Switch, {
|
|
978
994
|
checked: settings.enableNativeRedirect,
|
|
979
995
|
onCheckedChange: (checked) => settings.enableNativeRedirect = checked
|
|
980
|
-
})), /* @__PURE__ */
|
|
996
|
+
})), /* @__PURE__ */ React15.createElement(DeprecatedFormInput, {
|
|
981
997
|
label: t("settings custom slots")
|
|
982
|
-
}, /* @__PURE__ */
|
|
998
|
+
}, /* @__PURE__ */ React15.createElement(Input.Switch, {
|
|
983
999
|
checked: settings.customSlots,
|
|
984
1000
|
onCheckedChange: (checked) => settings.customSlots = checked
|
|
985
|
-
})), /* @__PURE__ */
|
|
1001
|
+
})), /* @__PURE__ */ React15.createElement(DeprecatedFormInput, {
|
|
986
1002
|
label: t("settings flat deck")
|
|
987
|
-
}, /* @__PURE__ */
|
|
1003
|
+
}, /* @__PURE__ */ React15.createElement(Input.Switch, {
|
|
988
1004
|
checked: settings.flatDeck,
|
|
989
1005
|
onCheckedChange: (checked) => settings.flatDeck = checked
|
|
990
1006
|
})));
|
|
@@ -1141,8 +1157,8 @@ var translations_default = [
|
|
|
1141
1157
|
"en-US": {
|
|
1142
1158
|
[DECK_PLUGIN]: {
|
|
1143
1159
|
"main header label": "Main header",
|
|
1144
|
-
"open navigation sidebar label": "Open navigation sidebar
|
|
1145
|
-
"open complementary sidebar label": "Open complementary sidebar
|
|
1160
|
+
"open navigation sidebar label": "Open navigation sidebar",
|
|
1161
|
+
"open complementary sidebar label": "Open complementary sidebar",
|
|
1146
1162
|
"plugin error message": "Content failed to render.",
|
|
1147
1163
|
"content fallback message": "Unsupported",
|
|
1148
1164
|
"content fallback description": "No plugin had a response for the address you navigated\xA0to. Double-check the URL, and ensure you\u2019ve enabled a plugin that supports the\xA0object.",
|
|
@@ -1165,17 +1181,19 @@ var translations_default = [
|
|
|
1165
1181
|
"reload required message": "Reload required.",
|
|
1166
1182
|
"pending heading": "Loading\u2026",
|
|
1167
1183
|
"insert plank label": "Open",
|
|
1168
|
-
"
|
|
1184
|
+
"resize label": "Drag to resize",
|
|
1185
|
+
"pin start label": "Pin to the left sidebar",
|
|
1186
|
+
"pin end label": "Pin to the right sidebar",
|
|
1187
|
+
"increment start label": "Move to the left",
|
|
1188
|
+
"increment end label": "Move to the right",
|
|
1189
|
+
"solo plank label": "Toggle solo mode",
|
|
1190
|
+
"close label": "Close",
|
|
1191
|
+
"minify label": "Minify",
|
|
1169
1192
|
"settings overscroll label": "Plank Overscrolling",
|
|
1170
1193
|
"select overscroll placeholder": "Select plank overscrolling behavior",
|
|
1171
1194
|
"settings overscroll centering label": "Centering",
|
|
1172
1195
|
"settings overscroll none label": "None",
|
|
1173
|
-
"settings flat deck": "Flatten deck appearance"
|
|
1174
|
-
// ComplementarySidebar
|
|
1175
|
-
"open settings label": "Show settings",
|
|
1176
|
-
"open comments label": "Show Comments",
|
|
1177
|
-
"open automation label": "Show Automation",
|
|
1178
|
-
"open debug label": "Show Debug"
|
|
1196
|
+
"settings flat deck": "Flatten deck appearance"
|
|
1179
1197
|
}
|
|
1180
1198
|
}
|
|
1181
1199
|
}
|
|
@@ -1185,11 +1203,6 @@ var translations_default = [
|
|
|
1185
1203
|
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-deck/src/DeckPlugin.tsx";
|
|
1186
1204
|
var isSocket2 = !!globalThis.__args;
|
|
1187
1205
|
var appScheme = "composer://";
|
|
1188
|
-
var customSlots = {
|
|
1189
|
-
wallpaper: {
|
|
1190
|
-
classNames: "bg-cover bg-no-repeat dark:bg-[url(https://cdn.midjourney.com/3865ba61-f98a-4d94-b91a-1763ead01f4f/0_0.jpeg)]"
|
|
1191
|
-
}
|
|
1192
|
-
};
|
|
1193
1206
|
setAutoFreeze(false);
|
|
1194
1207
|
var DECK_ACTION = "dxos.org/plugin/deck";
|
|
1195
1208
|
var DeckAction;
|
|
@@ -1200,10 +1213,10 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1200
1213
|
let graphPlugin;
|
|
1201
1214
|
let intentPlugin;
|
|
1202
1215
|
let attentionPlugin;
|
|
1203
|
-
let clientPlugin;
|
|
1204
1216
|
const unsubscriptionCallbacks = [];
|
|
1205
1217
|
let currentUndoId;
|
|
1206
1218
|
let handleNavigation;
|
|
1219
|
+
const panels = [];
|
|
1207
1220
|
const settings = new LocalStorageStore("dxos.org/settings/layout", {
|
|
1208
1221
|
showHints: false,
|
|
1209
1222
|
customSlots: false,
|
|
@@ -1312,7 +1325,6 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1312
1325
|
intentPlugin = resolvePlugin(plugins, parseIntentPlugin);
|
|
1313
1326
|
graphPlugin = resolvePlugin(plugins, parseGraphPlugin);
|
|
1314
1327
|
attentionPlugin = resolvePlugin(plugins, parseAttentionPlugin);
|
|
1315
|
-
clientPlugin = resolvePlugin(plugins, parseClientPlugin);
|
|
1316
1328
|
layout.prop({
|
|
1317
1329
|
key: "layoutMode",
|
|
1318
1330
|
type: LocalStorageStore.enum()
|
|
@@ -1334,11 +1346,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1334
1346
|
key: "closed",
|
|
1335
1347
|
type: LocalStorageStore.json()
|
|
1336
1348
|
});
|
|
1337
|
-
|
|
1338
|
-
layout.expunge();
|
|
1339
|
-
location.expunge();
|
|
1340
|
-
deck.expunge();
|
|
1341
|
-
}));
|
|
1349
|
+
panels.push(...filterPlugins(plugins, parsePanelPlugin).flatMap((plugin) => plugin.provides.complementary.panels));
|
|
1342
1350
|
settings.prop({
|
|
1343
1351
|
key: "showHints",
|
|
1344
1352
|
type: LocalStorageStore.bool()
|
|
@@ -1379,11 +1387,12 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1379
1387
|
window.location.pathname = "/";
|
|
1380
1388
|
return;
|
|
1381
1389
|
}
|
|
1390
|
+
const startingLayout = removePart(location.values.active, "solo");
|
|
1382
1391
|
const layoutFromUri = uriToSoloPart(pathname);
|
|
1383
1392
|
if (!layoutFromUri) {
|
|
1393
|
+
handleSetLocation(startingLayout);
|
|
1384
1394
|
return;
|
|
1385
1395
|
}
|
|
1386
|
-
const startingLayout = removePart(location.values.active, "solo");
|
|
1387
1396
|
handleSetLocation(mergeLayoutParts(layoutFromUri, startingLayout));
|
|
1388
1397
|
layout.values.layoutMode = "solo";
|
|
1389
1398
|
};
|
|
@@ -1408,7 +1417,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1408
1417
|
location: location.values,
|
|
1409
1418
|
translations: [
|
|
1410
1419
|
...translations_default,
|
|
1411
|
-
...
|
|
1420
|
+
...stackTranslations
|
|
1412
1421
|
],
|
|
1413
1422
|
graph: {
|
|
1414
1423
|
builder: () => {
|
|
@@ -1419,11 +1428,11 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1419
1428
|
filter: (node) => false,
|
|
1420
1429
|
actions: () => [
|
|
1421
1430
|
{
|
|
1422
|
-
id: `${
|
|
1431
|
+
id: `${LayoutAction2.SET_LAYOUT_MODE}/fullscreen`,
|
|
1423
1432
|
data: async () => {
|
|
1424
1433
|
await intentPlugin?.provides.intent.dispatch({
|
|
1425
1434
|
plugin: DECK_PLUGIN,
|
|
1426
|
-
action:
|
|
1435
|
+
action: LayoutAction2.SET_LAYOUT_MODE,
|
|
1427
1436
|
data: {
|
|
1428
1437
|
layoutMode: "fullscreen"
|
|
1429
1438
|
}
|
|
@@ -1447,19 +1456,18 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1447
1456
|
});
|
|
1448
1457
|
}
|
|
1449
1458
|
},
|
|
1450
|
-
context: (props) => /* @__PURE__ */
|
|
1459
|
+
context: (props) => /* @__PURE__ */ React16.createElement(LayoutContext.Provider, {
|
|
1451
1460
|
value: layout.values
|
|
1452
|
-
}, /* @__PURE__ */
|
|
1461
|
+
}, /* @__PURE__ */ React16.createElement(DeckContext.Provider, {
|
|
1453
1462
|
value: deck.values
|
|
1454
1463
|
}, props.children)),
|
|
1455
1464
|
root: () => {
|
|
1456
|
-
return /* @__PURE__ */
|
|
1465
|
+
return /* @__PURE__ */ React16.createElement(DeckLayout, {
|
|
1457
1466
|
layoutParts: location.values.active,
|
|
1458
1467
|
showHints: settings.values.showHints,
|
|
1459
1468
|
overscroll: settings.values.overscroll,
|
|
1460
|
-
flatDeck: settings.values.flatDeck,
|
|
1461
|
-
slots: settings.values.customSlots ? customSlots : void 0,
|
|
1462
1469
|
toasts: layout.values.toasts,
|
|
1470
|
+
panels,
|
|
1463
1471
|
onDismissToast: (id) => {
|
|
1464
1472
|
const index = layout.values.toasts.findIndex((toast) => toast.id === id);
|
|
1465
1473
|
if (index !== -1) {
|
|
@@ -1477,7 +1485,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1477
1485
|
component: ({ data, role }) => {
|
|
1478
1486
|
switch (role) {
|
|
1479
1487
|
case "settings":
|
|
1480
|
-
return data.plugin === meta_default.id ? /* @__PURE__ */
|
|
1488
|
+
return data.plugin === meta_default.id ? /* @__PURE__ */ React16.createElement(LayoutSettings, {
|
|
1481
1489
|
settings: settings.values
|
|
1482
1490
|
}) : null;
|
|
1483
1491
|
}
|
|
@@ -1487,10 +1495,10 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1487
1495
|
intent: {
|
|
1488
1496
|
resolver: (intent) => {
|
|
1489
1497
|
switch (intent.action) {
|
|
1490
|
-
case
|
|
1498
|
+
case LayoutAction2.SET_LAYOUT: {
|
|
1491
1499
|
return intent.data && handleSetLayout(intent.data);
|
|
1492
1500
|
}
|
|
1493
|
-
case
|
|
1501
|
+
case LayoutAction2.SET_LAYOUT_MODE: {
|
|
1494
1502
|
return batch(() => {
|
|
1495
1503
|
if (!intent.data) {
|
|
1496
1504
|
return;
|
|
@@ -1507,7 +1515,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1507
1515
|
} else {
|
|
1508
1516
|
log.warn("Invalid layout mode", intent?.data?.layoutMode, {
|
|
1509
1517
|
F: __dxlog_file,
|
|
1510
|
-
L:
|
|
1518
|
+
L: 378,
|
|
1511
1519
|
S: void 0,
|
|
1512
1520
|
C: (f, a) => f(...a)
|
|
1513
1521
|
});
|
|
@@ -1517,7 +1525,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1517
1525
|
};
|
|
1518
1526
|
});
|
|
1519
1527
|
}
|
|
1520
|
-
case
|
|
1528
|
+
case LayoutAction2.SCROLL_INTO_VIEW: {
|
|
1521
1529
|
layout.values.scrollIntoView = intent.data?.id ?? void 0;
|
|
1522
1530
|
return void 0;
|
|
1523
1531
|
}
|
|
@@ -1553,7 +1561,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1553
1561
|
data: true
|
|
1554
1562
|
};
|
|
1555
1563
|
}
|
|
1556
|
-
case
|
|
1564
|
+
case NavigationAction3.OPEN: {
|
|
1557
1565
|
const previouslyOpenIds = new Set(openIds2(location.values.active));
|
|
1558
1566
|
const layoutMode = layout.values.layoutMode;
|
|
1559
1567
|
batch(() => {
|
|
@@ -1602,7 +1610,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1602
1610
|
intents: [
|
|
1603
1611
|
newlyOpen.length > 0 ? [
|
|
1604
1612
|
{
|
|
1605
|
-
action:
|
|
1613
|
+
action: LayoutAction2.SCROLL_INTO_VIEW,
|
|
1606
1614
|
data: {
|
|
1607
1615
|
id: newlyOpen[0]
|
|
1608
1616
|
}
|
|
@@ -1610,7 +1618,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1610
1618
|
] : [],
|
|
1611
1619
|
intent.data?.object ? [
|
|
1612
1620
|
{
|
|
1613
|
-
action:
|
|
1621
|
+
action: NavigationAction3.EXPOSE,
|
|
1614
1622
|
data: {
|
|
1615
1623
|
id: fullyQualifiedId(intent.data.object)
|
|
1616
1624
|
}
|
|
@@ -1633,7 +1641,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1633
1641
|
]
|
|
1634
1642
|
};
|
|
1635
1643
|
}
|
|
1636
|
-
case
|
|
1644
|
+
case NavigationAction3.ADD_TO_ACTIVE: {
|
|
1637
1645
|
const data = intent.data;
|
|
1638
1646
|
const layoutEntry = {
|
|
1639
1647
|
id: data.id
|
|
@@ -1647,7 +1655,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1647
1655
|
if (data.scrollIntoView && layout.values.layoutMode === "deck") {
|
|
1648
1656
|
intents.push([
|
|
1649
1657
|
{
|
|
1650
|
-
action:
|
|
1658
|
+
action: LayoutAction2.SCROLL_INTO_VIEW,
|
|
1651
1659
|
data: {
|
|
1652
1660
|
id: data.id
|
|
1653
1661
|
}
|
|
@@ -1659,7 +1667,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1659
1667
|
intents
|
|
1660
1668
|
};
|
|
1661
1669
|
}
|
|
1662
|
-
case
|
|
1670
|
+
case NavigationAction3.CLOSE: {
|
|
1663
1671
|
return batch(() => {
|
|
1664
1672
|
if (!intent.data) {
|
|
1665
1673
|
return;
|
|
@@ -1691,7 +1699,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1691
1699
|
});
|
|
1692
1700
|
}
|
|
1693
1701
|
// TODO(wittjosiah): Factor out.
|
|
1694
|
-
case
|
|
1702
|
+
case NavigationAction3.SET: {
|
|
1695
1703
|
return batch(() => {
|
|
1696
1704
|
if (isLayoutParts(intent.data?.activeParts)) {
|
|
1697
1705
|
handleSetLocation(intent.data.activeParts);
|
|
@@ -1701,7 +1709,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1701
1709
|
};
|
|
1702
1710
|
});
|
|
1703
1711
|
}
|
|
1704
|
-
case
|
|
1712
|
+
case NavigationAction3.ADJUST: {
|
|
1705
1713
|
return batch(() => {
|
|
1706
1714
|
if (isLayoutAdjustment(intent.data)) {
|
|
1707
1715
|
const adjustment = intent.data;
|
|
@@ -1719,13 +1727,13 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1719
1727
|
intents: [
|
|
1720
1728
|
[
|
|
1721
1729
|
{
|
|
1722
|
-
action:
|
|
1730
|
+
action: LayoutAction2.SET_LAYOUT_MODE,
|
|
1723
1731
|
data: {
|
|
1724
1732
|
layoutMode: "solo"
|
|
1725
1733
|
}
|
|
1726
1734
|
},
|
|
1727
1735
|
{
|
|
1728
|
-
action:
|
|
1736
|
+
action: NavigationAction3.OPEN,
|
|
1729
1737
|
data: {
|
|
1730
1738
|
activeParts: {
|
|
1731
1739
|
solo: [
|
|
@@ -1743,13 +1751,13 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1743
1751
|
intents: [
|
|
1744
1752
|
[
|
|
1745
1753
|
{
|
|
1746
|
-
action:
|
|
1754
|
+
action: LayoutAction2.SET_LAYOUT_MODE,
|
|
1747
1755
|
data: {
|
|
1748
1756
|
layoutMode: "deck"
|
|
1749
1757
|
}
|
|
1750
1758
|
},
|
|
1751
1759
|
{
|
|
1752
|
-
action:
|
|
1760
|
+
action: NavigationAction3.CLOSE,
|
|
1753
1761
|
data: {
|
|
1754
1762
|
activeParts: {
|
|
1755
1763
|
solo: [
|
|
@@ -1759,7 +1767,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1759
1767
|
}
|
|
1760
1768
|
},
|
|
1761
1769
|
{
|
|
1762
|
-
action:
|
|
1770
|
+
action: NavigationAction3.OPEN,
|
|
1763
1771
|
data: {
|
|
1764
1772
|
noToggle: true,
|
|
1765
1773
|
activeParts: {
|
|
@@ -1770,7 +1778,7 @@ var DeckPlugin = ({ observability } = {}) => {
|
|
|
1770
1778
|
}
|
|
1771
1779
|
},
|
|
1772
1780
|
{
|
|
1773
|
-
action:
|
|
1781
|
+
action: LayoutAction2.SCROLL_INTO_VIEW,
|
|
1774
1782
|
data: {
|
|
1775
1783
|
id: entryId
|
|
1776
1784
|
}
|