@dxos/plugin-deck 0.8.1-main.303c73a → 0.8.1-main.81238a8
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/{app-graph-builder-IYHAGFA3.mjs → app-graph-builder-K4KVSHNT.mjs} +3 -3
- package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs → check-app-scheme-6SS6I3RN.mjs} +2 -2
- package/dist/lib/browser/{chunk-N7TEPFVR.mjs → chunk-2WTHB3TG.mjs} +1 -1
- package/dist/lib/browser/{chunk-N7TEPFVR.mjs.map → chunk-2WTHB3TG.mjs.map} +2 -2
- package/dist/lib/browser/chunk-7A5DLPQ3.mjs +24 -0
- package/dist/lib/browser/{chunk-FYKBOM3C.mjs → chunk-7X43JKZG.mjs} +33 -3
- package/dist/lib/browser/chunk-7X43JKZG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-63K74E3J.mjs → chunk-7YPIAXSW.mjs} +174 -69
- package/dist/lib/browser/chunk-7YPIAXSW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YCKJNTKG.mjs → chunk-RZLH5F56.mjs} +2 -2
- package/dist/lib/browser/{chunk-22AQ5IVX.mjs → chunk-WCNPMAR4.mjs} +2 -2
- package/dist/lib/browser/index.mjs +5 -4
- package/dist/lib/browser/index.mjs.map +2 -2
- package/dist/lib/browser/{intent-resolver-P5BVUQKU.mjs → intent-resolver-MEBOMCYI.mjs} +46 -17
- package/dist/lib/browser/intent-resolver-MEBOMCYI.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-ZQCTDM4Y.mjs → react-root-PPKFVPO7.mjs} +7 -7
- package/dist/lib/browser/{react-surface-RG3PVPY3.mjs → react-surface-7JBPPUHM.mjs} +7 -7
- package/dist/lib/browser/{settings-X3P2HKQJ.mjs → settings-DYS3FFMN.mjs} +3 -3
- package/dist/lib/browser/{state-2MOTLKVR.mjs → state-DRRCGMU2.mjs} +7 -11
- package/dist/lib/browser/state-DRRCGMU2.mjs.map +7 -0
- package/dist/lib/browser/tools-NDEUSO4R.mjs +78 -0
- package/dist/lib/browser/tools-NDEUSO4R.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +10 -4
- package/dist/lib/browser/{url-handler-MVHTKUYA.mjs → url-handler-4BCN7AYC.mjs} +7 -9
- package/dist/lib/browser/url-handler-4BCN7AYC.mjs.map +7 -0
- package/dist/types/src/capabilities/capabilities.d.ts +26 -2
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +13 -1
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/tools.d.ts +1 -0
- package/dist/types/src/capabilities/tools.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +6 -2
- 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 +6 -1
- package/dist/types/src/components/DeckLayout/PlankControls.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -5
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +41 -10
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +31 -31
- package/src/capabilities/intent-resolver.ts +29 -3
- package/src/capabilities/state.ts +2 -9
- package/src/capabilities/tools.ts +34 -22
- package/src/capabilities/url-handler.ts +2 -8
- package/src/components/DeckLayout/DeckLayout.tsx +34 -10
- package/src/components/DeckLayout/NodePlankHeading.tsx +49 -29
- package/src/components/DeckLayout/Plank.tsx +181 -111
- package/src/components/DeckLayout/PlankControls.tsx +34 -3
- package/src/meta.ts +2 -2
- package/src/translations.ts +1 -0
- package/src/types.ts +29 -0
- package/dist/lib/browser/chunk-63K74E3J.mjs.map +0 -7
- package/dist/lib/browser/chunk-ATPSUXXK.mjs +0 -24
- package/dist/lib/browser/chunk-FYKBOM3C.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-P5BVUQKU.mjs.map +0 -7
- package/dist/lib/browser/state-2MOTLKVR.mjs.map +0 -7
- package/dist/lib/browser/tools-64LXGLYR.mjs +0 -59
- package/dist/lib/browser/tools-64LXGLYR.mjs.map +0 -7
- package/dist/lib/browser/url-handler-MVHTKUYA.mjs.map +0 -7
- /package/dist/lib/browser/{app-graph-builder-IYHAGFA3.mjs.map → app-graph-builder-K4KVSHNT.mjs.map} +0 -0
- /package/dist/lib/browser/{check-app-scheme-S3EYUPMF.mjs.map → check-app-scheme-6SS6I3RN.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-ATPSUXXK.mjs.map → chunk-7A5DLPQ3.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-YCKJNTKG.mjs.map → chunk-RZLH5F56.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-22AQ5IVX.mjs.map → chunk-WCNPMAR4.mjs.map} +0 -0
- /package/dist/lib/browser/{react-root-ZQCTDM4Y.mjs.map → react-root-PPKFVPO7.mjs.map} +0 -0
- /package/dist/lib/browser/{react-surface-RG3PVPY3.mjs.map → react-surface-7JBPPUHM.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-X3P2HKQJ.mjs.map → settings-DYS3FFMN.mjs.map} +0 -0
|
@@ -3,20 +3,21 @@ import {
|
|
|
3
3
|
layoutAppliesTopbar,
|
|
4
4
|
useBreakpoints,
|
|
5
5
|
useHoistStatusbar
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RZLH5F56.mjs";
|
|
7
7
|
import {
|
|
8
8
|
DeckCapabilities
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WCNPMAR4.mjs";
|
|
10
10
|
import {
|
|
11
11
|
DeckAction,
|
|
12
12
|
NewPlankPositions,
|
|
13
13
|
OverscrollOptions,
|
|
14
14
|
SLUG_PATH_SEPARATOR,
|
|
15
|
-
getMode
|
|
16
|
-
|
|
15
|
+
getMode,
|
|
16
|
+
surfaceVariantSeparator
|
|
17
|
+
} from "./chunk-7X43JKZG.mjs";
|
|
17
18
|
import {
|
|
18
19
|
DECK_PLUGIN
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-2WTHB3TG.mjs";
|
|
20
21
|
|
|
21
22
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Banner.tsx
|
|
22
23
|
import React2 from "react";
|
|
@@ -100,10 +101,10 @@ var Banner = ({ variant, classNames }) => {
|
|
|
100
101
|
|
|
101
102
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
102
103
|
import { untracked } from "@preact/signals-core";
|
|
103
|
-
import React17, { useCallback as
|
|
104
|
-
import { LayoutAction as LayoutAction4, createIntent as
|
|
104
|
+
import React17, { useCallback as useCallback5, useEffect as useEffect6, useMemo as useMemo5, useRef as useRef2, Fragment as Fragment4, useState as useState4 } from "react";
|
|
105
|
+
import { LayoutAction as LayoutAction4, createIntent as createIntent5, Surface as Surface10, useCapability as useCapability5, useIntentDispatcher as useIntentDispatcher5, usePluginManager } from "@dxos/app-framework";
|
|
105
106
|
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
106
|
-
import { AlertDialog, Dialog as NaturalDialog, Main as Main3, Popover as Popover2,
|
|
107
|
+
import { AlertDialog, Dialog as NaturalDialog, Main as Main3, Popover as Popover2, useMediaQuery, useOnTransition } from "@dxos/react-ui";
|
|
107
108
|
import { Stack, StackContext, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
|
|
108
109
|
import { mainPaddingTransitions } from "@dxos/react-ui-theme";
|
|
109
110
|
|
|
@@ -192,8 +193,8 @@ var ActiveNode = () => {
|
|
|
192
193
|
};
|
|
193
194
|
|
|
194
195
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
195
|
-
import React8, { useCallback as
|
|
196
|
-
import { createIntent as
|
|
196
|
+
import React8, { useCallback as useCallback3, useEffect as useEffect5, useMemo as useMemo2, useState as useState3, Fragment as Fragment2 } from "react";
|
|
197
|
+
import { createIntent as createIntent3, LayoutAction as LayoutAction2, Surface as Surface4, useAppGraph as useAppGraph3, useCapabilities, useCapability as useCapability2, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
197
198
|
import { Main, useTranslation as useTranslation5, toLocalizedString as toLocalizedString2, IconButton as IconButton2, ScrollArea as NaturalScrollArea } from "@dxos/react-ui";
|
|
198
199
|
import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
|
|
199
200
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
@@ -205,15 +206,18 @@ import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
|
205
206
|
import { descriptionText, mx as mx3 } from "@dxos/react-ui-theme";
|
|
206
207
|
|
|
207
208
|
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
208
|
-
import React5, { Fragment, memo, useCallback, useEffect as useEffect3, useMemo } from "react";
|
|
209
|
-
import { createIntent, LayoutAction, Surface as Surface3, useAppGraph as useAppGraph2, useIntentDispatcher } from "@dxos/app-framework";
|
|
209
|
+
import React5, { Fragment, memo, useCallback as useCallback2, useEffect as useEffect3, useMemo } from "react";
|
|
210
|
+
import { createIntent as createIntent2, LayoutAction, Surface as Surface3, useAppGraph as useAppGraph2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
210
211
|
import { Icon as Icon2, Popover, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
211
212
|
import { StackItem } from "@dxos/react-ui-stack";
|
|
212
213
|
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
213
214
|
|
|
214
215
|
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankControls.tsx
|
|
215
|
-
import React4, { forwardRef } from "react";
|
|
216
|
+
import React4, { forwardRef, useCallback } from "react";
|
|
217
|
+
import { createIntent, useIntentDispatcher } from "@dxos/app-framework";
|
|
218
|
+
import { invariant } from "@dxos/invariant";
|
|
216
219
|
import { Button, ButtonGroup, Icon, Tooltip, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
220
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-deck/src/components/DeckLayout/PlankControls.tsx";
|
|
217
221
|
var PlankControl = ({ icon, label: label3, ...props }) => {
|
|
218
222
|
return /* @__PURE__ */ React4.createElement(Tooltip.Root, null, /* @__PURE__ */ React4.createElement(Tooltip.Trigger, {
|
|
219
223
|
asChild: true
|
|
@@ -229,9 +233,39 @@ var PlankControl = ({ icon, label: label3, ...props }) => {
|
|
|
229
233
|
side: "bottom"
|
|
230
234
|
}, label3)));
|
|
231
235
|
};
|
|
236
|
+
var plankControlSpacing = "pli-2 plb-3";
|
|
237
|
+
var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedRef) => {
|
|
238
|
+
const { t } = useTranslation2(DECK_PLUGIN);
|
|
239
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
240
|
+
const handleCloseCompanion = useCallback(() => {
|
|
241
|
+
invariant(primary, void 0, {
|
|
242
|
+
F: __dxlog_file,
|
|
243
|
+
L: 66,
|
|
244
|
+
S: void 0,
|
|
245
|
+
A: [
|
|
246
|
+
"primary",
|
|
247
|
+
""
|
|
248
|
+
]
|
|
249
|
+
});
|
|
250
|
+
return dispatch(createIntent(DeckAction.ChangeCompanion, {
|
|
251
|
+
primary,
|
|
252
|
+
companion: null
|
|
253
|
+
}));
|
|
254
|
+
}, []);
|
|
255
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
256
|
+
ref: forwardedRef,
|
|
257
|
+
className: "contents app-no-drag"
|
|
258
|
+
}, /* @__PURE__ */ React4.createElement(PlankControl, {
|
|
259
|
+
label: t("close companion label"),
|
|
260
|
+
variant: "ghost",
|
|
261
|
+
icon: "ph--minus--regular",
|
|
262
|
+
onClick: handleCloseCompanion,
|
|
263
|
+
classNames: plankControlSpacing
|
|
264
|
+
}));
|
|
265
|
+
});
|
|
232
266
|
var PlankControls = /* @__PURE__ */ forwardRef(({ onClick, variant = "default", capabilities: can, isSolo, pin, close = false, children, classNames, ...props }, forwardedRef) => {
|
|
233
267
|
const { t } = useTranslation2(DECK_PLUGIN);
|
|
234
|
-
const buttonClassNames = variant === "hide-disabled" ?
|
|
268
|
+
const buttonClassNames = variant === "hide-disabled" ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
|
|
235
269
|
return /* @__PURE__ */ React4.createElement(ButtonGroup, {
|
|
236
270
|
...props,
|
|
237
271
|
classNames: [
|
|
@@ -273,18 +307,26 @@ var fixedSidebarToggleStyles = mx2(sidebarToggleStyles, "inline-start-2");
|
|
|
273
307
|
var fixedComplementarySidebarToggleStyles = mx2(sidebarToggleStyles, "inline-end-2");
|
|
274
308
|
|
|
275
309
|
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
276
|
-
var NodePlankHeading = /* @__PURE__ */ memo(({ id, part, node, canIncrementStart, canIncrementEnd, popoverAnchorId, pending, actions = [] }) => {
|
|
310
|
+
var NodePlankHeading = /* @__PURE__ */ memo(({ id, part, node, canIncrementStart, canIncrementEnd, popoverAnchorId, pending, actions = [], companioned, primaryId, surfaceVariant }) => {
|
|
277
311
|
const { t } = useTranslation3(DECK_PLUGIN);
|
|
278
312
|
const { graph } = useAppGraph2();
|
|
279
313
|
const breakpoint = useBreakpoints();
|
|
280
314
|
const icon = node?.properties?.icon ?? "ph--placeholder--regular";
|
|
281
|
-
const label3 = pending ? t("pending heading") : toLocalizedString(node?.properties?.label
|
|
315
|
+
const label3 = pending ? t("pending heading") : toLocalizedString((surfaceVariant ? Array.isArray(node?.properties?.label) ? [
|
|
316
|
+
`${surfaceVariant} plank heading`,
|
|
317
|
+
node.properties.label[1]
|
|
318
|
+
] : [
|
|
319
|
+
"companion plank heading fallback label",
|
|
320
|
+
{
|
|
321
|
+
ns: DECK_PLUGIN
|
|
322
|
+
}
|
|
323
|
+
] : node?.properties?.label) ?? [
|
|
282
324
|
"plank heading fallback label",
|
|
283
325
|
{
|
|
284
326
|
ns: DECK_PLUGIN
|
|
285
327
|
}
|
|
286
328
|
], t);
|
|
287
|
-
const { dispatchPromise: dispatch } =
|
|
329
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
288
330
|
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
|
|
289
331
|
useEffect3(() => {
|
|
290
332
|
const frame = requestAnimationFrame(() => {
|
|
@@ -313,28 +355,28 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ id, part, node, canIncrementStart
|
|
|
313
355
|
node,
|
|
314
356
|
graph
|
|
315
357
|
]);
|
|
316
|
-
const handleAction =
|
|
358
|
+
const handleAction = useCallback2((action) => {
|
|
317
359
|
typeof action.data === "function" && action.data?.({
|
|
318
360
|
node: action,
|
|
319
361
|
caller: DECK_PLUGIN
|
|
320
362
|
});
|
|
321
363
|
}, []);
|
|
322
|
-
const handlePlankAction =
|
|
364
|
+
const handlePlankAction = useCallback2((eventType) => {
|
|
323
365
|
if (eventType === "solo") {
|
|
324
|
-
return dispatch(
|
|
366
|
+
return dispatch(createIntent2(DeckAction.Adjust, {
|
|
325
367
|
type: eventType,
|
|
326
368
|
id
|
|
327
369
|
}));
|
|
328
370
|
} else if (eventType === "close") {
|
|
329
371
|
if (part === "complementary") {
|
|
330
|
-
return dispatch(
|
|
372
|
+
return dispatch(createIntent2(LayoutAction.UpdateComplementary, {
|
|
331
373
|
part: "complementary",
|
|
332
374
|
options: {
|
|
333
375
|
state: "collapsed"
|
|
334
376
|
}
|
|
335
377
|
}));
|
|
336
378
|
} else {
|
|
337
|
-
return dispatch(
|
|
379
|
+
return dispatch(createIntent2(LayoutAction.Close, {
|
|
338
380
|
part: "main",
|
|
339
381
|
subject: [
|
|
340
382
|
id
|
|
@@ -345,7 +387,7 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ id, part, node, canIncrementStart
|
|
|
345
387
|
}));
|
|
346
388
|
}
|
|
347
389
|
} else {
|
|
348
|
-
return dispatch(
|
|
390
|
+
return dispatch(createIntent2(DeckAction.Adjust, {
|
|
349
391
|
type: eventType,
|
|
350
392
|
id
|
|
351
393
|
}));
|
|
@@ -358,9 +400,10 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ id, part, node, canIncrementStart
|
|
|
358
400
|
return /* @__PURE__ */ React5.createElement(StackItem.Heading, {
|
|
359
401
|
classNames: [
|
|
360
402
|
"plb-1 border-be border-separator items-stretch gap-1 sticky inline-start-12 app-drag",
|
|
361
|
-
part === "solo" ? soloInlinePadding : "pli-1"
|
|
403
|
+
part === "solo" ? soloInlinePadding : "pli-1",
|
|
404
|
+
surfaceVariant && "pis-3"
|
|
362
405
|
]
|
|
363
|
-
}, /* @__PURE__ */ React5.createElement(ActionRoot, null, node && sigilActions ? /* @__PURE__ */ React5.createElement(StackItem.Sigil, {
|
|
406
|
+
}, !surfaceVariant && /* @__PURE__ */ React5.createElement(ActionRoot, null, node && sigilActions ? /* @__PURE__ */ React5.createElement(StackItem.Sigil, {
|
|
364
407
|
icon,
|
|
365
408
|
related: part === "complementary",
|
|
366
409
|
attendableId,
|
|
@@ -391,7 +434,9 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ id, part, node, canIncrementStart
|
|
|
391
434
|
data: {
|
|
392
435
|
subject: node.data
|
|
393
436
|
}
|
|
394
|
-
}), /* @__PURE__ */ React5.createElement(
|
|
437
|
+
}), companioned === "companion" ? /* @__PURE__ */ React5.createElement(PlankCompanionControls, {
|
|
438
|
+
primary: surfaceVariant ? id : primaryId
|
|
439
|
+
}) : /* @__PURE__ */ React5.createElement(PlankControls, {
|
|
395
440
|
capabilities,
|
|
396
441
|
isSolo: part === "solo",
|
|
397
442
|
onClick: handlePlankAction,
|
|
@@ -444,7 +489,7 @@ var label = [
|
|
|
444
489
|
];
|
|
445
490
|
var ComplementarySidebar = ({ current }) => {
|
|
446
491
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
447
|
-
const { dispatchPromise: dispatch } =
|
|
492
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
448
493
|
const layout = useCapability2(DeckCapabilities.MutableDeckState);
|
|
449
494
|
const attended = useAttended2();
|
|
450
495
|
const { graph } = useAppGraph3();
|
|
@@ -466,14 +511,14 @@ var ComplementarySidebar = ({ current }) => {
|
|
|
466
511
|
}, [
|
|
467
512
|
activePanelId
|
|
468
513
|
]);
|
|
469
|
-
const handleTabClick =
|
|
514
|
+
const handleTabClick = useCallback3((event) => {
|
|
470
515
|
const nextValue = event.currentTarget.getAttribute("data-value");
|
|
471
516
|
if (nextValue === activePanelId) {
|
|
472
517
|
layout.complementarySidebarState = layout.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
|
|
473
518
|
} else {
|
|
474
519
|
setInternalValue(nextValue);
|
|
475
520
|
layout.complementarySidebarState = "expanded";
|
|
476
|
-
void dispatch(
|
|
521
|
+
void dispatch(createIntent3(LayoutAction2.UpdateComplementary, {
|
|
477
522
|
part: "complementary",
|
|
478
523
|
subject: nextValue
|
|
479
524
|
}));
|
|
@@ -632,38 +677,38 @@ var Fullscreen = ({ id }) => {
|
|
|
632
677
|
};
|
|
633
678
|
|
|
634
679
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
635
|
-
import React12, { memo as memo2, useCallback as
|
|
636
|
-
import { createIntent as
|
|
680
|
+
import React12, { Fragment as Fragment3, memo as memo2, useCallback as useCallback4, useLayoutEffect, useMemo as useMemo3, useRef } from "react";
|
|
681
|
+
import { createIntent as createIntent4, LayoutAction as LayoutAction3, Surface as Surface7, useCapability as useCapability3, useAppGraph as useAppGraph5, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework";
|
|
637
682
|
import { debounce } from "@dxos/async";
|
|
638
683
|
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
639
684
|
import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
|
|
640
685
|
import { mainIntrinsicSize, mx as mx5 } from "@dxos/react-ui-theme";
|
|
641
686
|
var UNKNOWN_ID = "unknown_id";
|
|
642
|
-
var
|
|
643
|
-
const { dispatchPromise: dispatch } =
|
|
687
|
+
var PlankImpl = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active, layoutMode, surfaceVariant, companioned, primaryId }) => {
|
|
688
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
644
689
|
const { deck, popoverAnchorId, scrollIntoView } = useCapability3(DeckCapabilities.DeckState);
|
|
645
690
|
const { graph } = useAppGraph5();
|
|
646
691
|
const node = useNode(graph, id);
|
|
647
692
|
const rootElement = useRef(null);
|
|
648
693
|
const canResize = layoutMode === "deck";
|
|
649
|
-
const Root = part
|
|
694
|
+
const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
|
|
650
695
|
const attendableAttrs = useAttendableAttributes(id);
|
|
651
696
|
const index = active ? active.findIndex((entryId) => entryId === id) : 0;
|
|
652
697
|
const length = active?.length ?? 1;
|
|
653
698
|
const canIncrementStart = active && index !== void 0 && index > 0 && length !== void 0 && length > 1;
|
|
654
699
|
const canIncrementEnd = active && index !== void 0 && index < length - 1 && length !== void 0;
|
|
655
|
-
const
|
|
656
|
-
const size = deck.plankSizing[
|
|
657
|
-
const setSize =
|
|
658
|
-
return dispatch(
|
|
659
|
-
id:
|
|
700
|
+
const sizeKey = `${id.split("+")[0]}${surfaceVariant ? `${surfaceVariantSeparator}${surfaceVariant}` : ""}`;
|
|
701
|
+
const size = deck.plankSizing[sizeKey];
|
|
702
|
+
const setSize = useCallback4(debounce((nextSize) => {
|
|
703
|
+
return dispatch(createIntent4(DeckAction.UpdatePlankSize, {
|
|
704
|
+
id: sizeKey,
|
|
660
705
|
size: nextSize
|
|
661
706
|
}));
|
|
662
707
|
}, 200), [
|
|
663
708
|
dispatch,
|
|
664
|
-
|
|
709
|
+
sizeKey
|
|
665
710
|
]);
|
|
666
|
-
const handleKeyDown =
|
|
711
|
+
const handleKeyDown = useCallback4((event) => {
|
|
667
712
|
if (event.target === event.currentTarget && event.key === "Escape") {
|
|
668
713
|
rootElement.current?.closest("main")?.focus();
|
|
669
714
|
}
|
|
@@ -678,7 +723,7 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active,
|
|
|
678
723
|
behavior: "smooth",
|
|
679
724
|
inline: "center"
|
|
680
725
|
});
|
|
681
|
-
void dispatch(
|
|
726
|
+
void dispatch(createIntent4(LayoutAction3.ScrollIntoView, {
|
|
682
727
|
part: "current",
|
|
683
728
|
subject: void 0
|
|
684
729
|
}));
|
|
@@ -693,21 +738,23 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active,
|
|
|
693
738
|
const sizeAttrs = useMainSize();
|
|
694
739
|
const data = useMemo3(() => node && {
|
|
695
740
|
subject: node.data,
|
|
741
|
+
variant: surfaceVariant,
|
|
696
742
|
path,
|
|
697
743
|
popoverAnchorId
|
|
698
744
|
}, [
|
|
699
745
|
node,
|
|
700
746
|
node?.data,
|
|
701
747
|
path,
|
|
702
|
-
popoverAnchorId
|
|
748
|
+
popoverAnchorId,
|
|
749
|
+
surfaceVariant
|
|
703
750
|
]);
|
|
704
751
|
const placeholder = useMemo3(() => /* @__PURE__ */ React12.createElement(PlankLoading, null), []);
|
|
705
|
-
const className = mx5("attention-surface relative", isSolo && mainIntrinsicSize, isSolo && railGridHorizontal, isSolo
|
|
752
|
+
const className = mx5("attention-surface relative", isSolo && mainIntrinsicSize, isSolo && railGridHorizontal, isSolo && "grid absolute inset-0", part === "deck" && (companioned === "companion" ? "!border-separator border-ie" : "!border-separator border-li"), part.startsWith("solo-") && "row-span-2 min-is-0", part === "solo-companion" && "!border-separator border-is");
|
|
706
753
|
return /* @__PURE__ */ React12.createElement(Root, {
|
|
707
754
|
ref: rootElement,
|
|
708
755
|
"data-testid": "deck.plank",
|
|
709
756
|
tabIndex: 0,
|
|
710
|
-
...part
|
|
757
|
+
...part.startsWith("solo") ? {
|
|
711
758
|
...sizeAttrs,
|
|
712
759
|
className
|
|
713
760
|
} : {
|
|
@@ -724,11 +771,14 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active,
|
|
|
724
771
|
onKeyDown: handleKeyDown
|
|
725
772
|
}, node ? /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(NodePlankHeading, {
|
|
726
773
|
id,
|
|
727
|
-
part,
|
|
774
|
+
part: part.startsWith("solo-") ? "solo" : part,
|
|
728
775
|
node,
|
|
729
776
|
canIncrementStart,
|
|
730
777
|
canIncrementEnd,
|
|
731
|
-
popoverAnchorId
|
|
778
|
+
popoverAnchorId,
|
|
779
|
+
companioned,
|
|
780
|
+
primaryId,
|
|
781
|
+
surfaceVariant
|
|
732
782
|
}), /* @__PURE__ */ React12.createElement(Surface7, {
|
|
733
783
|
key: node.id,
|
|
734
784
|
role: "article",
|
|
@@ -741,6 +791,42 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active,
|
|
|
741
791
|
part
|
|
742
792
|
}), canResize && /* @__PURE__ */ React12.createElement(StackItem2.ResizeHandle, null));
|
|
743
793
|
});
|
|
794
|
+
var SplitFrame = ({ children }) => {
|
|
795
|
+
const sizeAttrs = useMainSize();
|
|
796
|
+
return /* @__PURE__ */ React12.createElement("div", {
|
|
797
|
+
role: "none",
|
|
798
|
+
className: mx5("grid grid-cols-[1fr_1fr] absolute inset-0", railGridHorizontal, mainIntrinsicSize),
|
|
799
|
+
...sizeAttrs
|
|
800
|
+
}, children);
|
|
801
|
+
};
|
|
802
|
+
var Plank = (props) => {
|
|
803
|
+
if (props.companionId) {
|
|
804
|
+
const Root = props.part === "solo" ? SplitFrame : Fragment3;
|
|
805
|
+
return /* @__PURE__ */ React12.createElement(Root, null, /* @__PURE__ */ React12.createElement(PlankImpl, {
|
|
806
|
+
...props,
|
|
807
|
+
...props.part === "solo" ? {
|
|
808
|
+
part: "solo-primary"
|
|
809
|
+
} : {},
|
|
810
|
+
companioned: "primary"
|
|
811
|
+
}), /* @__PURE__ */ React12.createElement(PlankImpl, {
|
|
812
|
+
...props,
|
|
813
|
+
...props.companionId.startsWith(surfaceVariantSeparator) ? {
|
|
814
|
+
surfaceVariant: props.companionId.substring(2)
|
|
815
|
+
} : {
|
|
816
|
+
id: props.companionId,
|
|
817
|
+
primaryId: props.id
|
|
818
|
+
},
|
|
819
|
+
...props.part === "solo" ? {
|
|
820
|
+
part: "solo-companion"
|
|
821
|
+
} : {
|
|
822
|
+
order: props.order + 1
|
|
823
|
+
},
|
|
824
|
+
companioned: "companion"
|
|
825
|
+
}));
|
|
826
|
+
} else {
|
|
827
|
+
return /* @__PURE__ */ React12.createElement(PlankImpl, props);
|
|
828
|
+
}
|
|
829
|
+
};
|
|
744
830
|
|
|
745
831
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Sidebar.tsx
|
|
746
832
|
import React13, { useMemo as useMemo4 } from "react";
|
|
@@ -840,18 +926,18 @@ var Topbar = () => {
|
|
|
840
926
|
};
|
|
841
927
|
|
|
842
928
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
843
|
-
var PlankSeparator = ({
|
|
929
|
+
var PlankSeparator = ({ order }) => order > 0 ? /* @__PURE__ */ React17.createElement("span", {
|
|
844
930
|
role: "separator",
|
|
845
931
|
className: "row-span-2 bg-deck is-4",
|
|
846
932
|
style: {
|
|
847
|
-
gridColumn:
|
|
933
|
+
gridColumn: order
|
|
848
934
|
}
|
|
849
935
|
}) : null;
|
|
850
936
|
var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
851
|
-
const { dispatchPromise: dispatch } =
|
|
937
|
+
const { dispatchPromise: dispatch } = useIntentDispatcher5();
|
|
852
938
|
const context = useCapability5(DeckCapabilities.MutableDeckState);
|
|
853
939
|
const { sidebarState, complementarySidebarState, complementarySidebarPanel, dialogOpen, dialogContent, dialogBlockAlign, dialogType, popoverOpen, popoverContent, popoverAnchorId, deck, toasts } = context;
|
|
854
|
-
const { active, fullscreen, solo, plankSizing } = deck;
|
|
940
|
+
const { active, activeCompanions, fullscreen, solo, plankSizing } = deck;
|
|
855
941
|
const breakpoint = useBreakpoints();
|
|
856
942
|
const topbar = layoutAppliesTopbar(breakpoint);
|
|
857
943
|
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
@@ -885,7 +971,7 @@ var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
|
885
971
|
return attention.current;
|
|
886
972
|
});
|
|
887
973
|
shouldRevert.current = true;
|
|
888
|
-
void dispatch(
|
|
974
|
+
void dispatch(createIntent5(LayoutAction4.SetLayoutMode, {
|
|
889
975
|
part: "mode",
|
|
890
976
|
subject: attended[0],
|
|
891
977
|
options: {
|
|
@@ -893,7 +979,7 @@ var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
|
893
979
|
}
|
|
894
980
|
}));
|
|
895
981
|
} else if (isNotMobile && getMode(deck) === "solo" && shouldRevert.current) {
|
|
896
|
-
void dispatch(
|
|
982
|
+
void dispatch(createIntent5(LayoutAction4.SetLayoutMode, {
|
|
897
983
|
part: "mode",
|
|
898
984
|
options: {
|
|
899
985
|
revert: true
|
|
@@ -905,7 +991,7 @@ var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
|
905
991
|
deck,
|
|
906
992
|
dispatch
|
|
907
993
|
]);
|
|
908
|
-
const handleResize =
|
|
994
|
+
const handleResize = useCallback5(() => {
|
|
909
995
|
scrollLeftRef.current = null;
|
|
910
996
|
}, []);
|
|
911
997
|
useEffect6(() => {
|
|
@@ -914,14 +1000,14 @@ var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
|
914
1000
|
}, [
|
|
915
1001
|
handleResize
|
|
916
1002
|
]);
|
|
917
|
-
const restoreScroll =
|
|
1003
|
+
const restoreScroll = useCallback5(() => {
|
|
918
1004
|
if (deckRef.current && scrollLeftRef.current != null) {
|
|
919
1005
|
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
920
1006
|
}
|
|
921
1007
|
}, []);
|
|
922
1008
|
const layoutMode = getMode(deck);
|
|
923
1009
|
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
924
|
-
const handleScroll =
|
|
1010
|
+
const handleScroll = useCallback5((event) => {
|
|
925
1011
|
if (!solo && event.currentTarget === event.target) {
|
|
926
1012
|
scrollLeftRef.current = event.target.scrollLeft;
|
|
927
1013
|
}
|
|
@@ -948,7 +1034,7 @@ var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
|
948
1034
|
hoistStatusbar
|
|
949
1035
|
]);
|
|
950
1036
|
const Dialog = dialogType === "alert" ? AlertDialog : NaturalDialog;
|
|
951
|
-
const handlePopoverOpenChange =
|
|
1037
|
+
const handlePopoverOpenChange = useCallback5((nextOpen) => {
|
|
952
1038
|
if (nextOpen && popoverAnchorId) {
|
|
953
1039
|
context.popoverOpen = true;
|
|
954
1040
|
} else {
|
|
@@ -959,9 +1045,22 @@ var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
|
959
1045
|
}, [
|
|
960
1046
|
context
|
|
961
1047
|
]);
|
|
962
|
-
const handlePopoverClose =
|
|
1048
|
+
const handlePopoverClose = useCallback5(() => handlePopoverOpenChange(false), [
|
|
963
1049
|
handlePopoverOpenChange
|
|
964
1050
|
]);
|
|
1051
|
+
const { order, itemsCount } = useMemo5(() => {
|
|
1052
|
+
return active.reduce((acc, entryId) => {
|
|
1053
|
+
acc.order[entryId] = acc.itemsCount + 1;
|
|
1054
|
+
acc.itemsCount += activeCompanions?.[entryId] ? 3 : 2;
|
|
1055
|
+
return acc;
|
|
1056
|
+
}, {
|
|
1057
|
+
order: {},
|
|
1058
|
+
itemsCount: 0
|
|
1059
|
+
});
|
|
1060
|
+
}, [
|
|
1061
|
+
active,
|
|
1062
|
+
activeCompanions
|
|
1063
|
+
]);
|
|
965
1064
|
return /* @__PURE__ */ React17.createElement(Popover2.Root, {
|
|
966
1065
|
modal: true,
|
|
967
1066
|
open: !!(popoverAnchorId && delayedPopoverVisibility),
|
|
@@ -1007,17 +1106,18 @@ var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
|
1007
1106
|
mainPaddingTransitions
|
|
1008
1107
|
],
|
|
1009
1108
|
onScroll: handleScroll,
|
|
1010
|
-
itemsCount:
|
|
1109
|
+
itemsCount: itemsCount - 1,
|
|
1011
1110
|
style: padding,
|
|
1012
1111
|
ref: deckRef
|
|
1013
|
-
}, active.map((entryId
|
|
1112
|
+
}, active.map((entryId) => /* @__PURE__ */ React17.createElement(Fragment4, {
|
|
1014
1113
|
key: entryId
|
|
1015
1114
|
}, /* @__PURE__ */ React17.createElement(PlankSeparator, {
|
|
1016
|
-
|
|
1115
|
+
order: order[entryId] - 1
|
|
1017
1116
|
}), /* @__PURE__ */ React17.createElement(Plank, {
|
|
1018
1117
|
id: entryId,
|
|
1118
|
+
companionId: activeCompanions?.[entryId],
|
|
1019
1119
|
part: "deck",
|
|
1020
|
-
order:
|
|
1120
|
+
order: order[entryId],
|
|
1021
1121
|
active,
|
|
1022
1122
|
layoutMode
|
|
1023
1123
|
}))))), /* @__PURE__ */ React17.createElement("div", {
|
|
@@ -1038,6 +1138,7 @@ var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
|
1038
1138
|
}
|
|
1039
1139
|
}, /* @__PURE__ */ React17.createElement(Plank, {
|
|
1040
1140
|
id: solo,
|
|
1141
|
+
companionId: solo ? activeCompanions?.[solo] : void 0,
|
|
1041
1142
|
part: "solo",
|
|
1042
1143
|
layoutMode
|
|
1043
1144
|
})))), topbar && /* @__PURE__ */ React17.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React17.createElement(StatusBar, {
|
|
@@ -1053,12 +1154,16 @@ var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
|
1053
1154
|
modal: dialogBlockAlign !== "end",
|
|
1054
1155
|
open: dialogOpen,
|
|
1055
1156
|
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
1056
|
-
}, dialogBlockAlign === "end" ?
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1157
|
+
}, dialogBlockAlign === "end" ? (
|
|
1158
|
+
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
1159
|
+
/* @__PURE__ */ React17.createElement(Surface10, {
|
|
1160
|
+
role: "dialog",
|
|
1161
|
+
data: dialogContent,
|
|
1162
|
+
limit: 1,
|
|
1163
|
+
fallback: PlankContentError,
|
|
1164
|
+
placeholder: /* @__PURE__ */ React17.createElement("div", null)
|
|
1165
|
+
})
|
|
1166
|
+
) : /* @__PURE__ */ React17.createElement(Dialog.Overlay, {
|
|
1062
1167
|
blockAlign: dialogBlockAlign
|
|
1063
1168
|
}, /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1064
1169
|
role: "dialog",
|
|
@@ -1127,4 +1232,4 @@ export {
|
|
|
1127
1232
|
DeckLayout,
|
|
1128
1233
|
LayoutSettings
|
|
1129
1234
|
};
|
|
1130
|
-
//# sourceMappingURL=chunk-
|
|
1235
|
+
//# sourceMappingURL=chunk-7YPIAXSW.mjs.map
|