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