@dxos/plugin-deck 0.7.5-labs.e27f9b9 → 0.7.5-labs.f400bbc
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-CI6ZFMNL.mjs → app-graph-builder-IYHAGFA3.mjs} +6 -2
- package/dist/lib/browser/{app-graph-builder-CI6ZFMNL.mjs.map → app-graph-builder-IYHAGFA3.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-YQ2GWTDU.mjs → chunk-22AQ5IVX.mjs} +1 -1
- package/dist/lib/browser/{chunk-YQ2GWTDU.mjs.map → chunk-22AQ5IVX.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-M2L53AIH.mjs → chunk-FT33W5CI.mjs} +4 -2
- package/dist/lib/browser/chunk-FT33W5CI.mjs.map +7 -0
- package/dist/lib/browser/chunk-G2X3ZDCE.mjs +24 -0
- package/dist/lib/browser/chunk-KANJBSIX.mjs +97 -0
- package/dist/lib/browser/chunk-KANJBSIX.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BTDY6SES.mjs → chunk-O4RFYYQ6.mjs} +120 -125
- package/dist/lib/browser/chunk-O4RFYYQ6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +13 -6
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-CSXFDKTC.mjs → intent-resolver-ZD67BRUI.mjs} +42 -48
- package/dist/lib/browser/intent-resolver-ZD67BRUI.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-HIHLRMCW.mjs → react-root-6ILKHD5J.mjs} +7 -8
- package/dist/lib/browser/react-root-6ILKHD5J.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-4QVWKQYY.mjs → react-surface-O75FKXAI.mjs} +6 -5
- package/dist/lib/browser/{react-surface-4QVWKQYY.mjs.map → react-surface-O75FKXAI.mjs.map} +1 -1
- package/dist/lib/browser/{settings-WACNLCPB.mjs → settings-H35U6NHE.mjs} +2 -2
- package/dist/lib/browser/{state-VPOYUKK6.mjs → state-U4SHOPJW.mjs} +16 -4
- package/dist/lib/browser/state-U4SHOPJW.mjs.map +7 -0
- package/dist/lib/browser/{tools-5LDJNU56.mjs → tools-64LXGLYR.mjs} +12 -4
- package/dist/lib/browser/tools-64LXGLYR.mjs.map +7 -0
- package/dist/lib/browser/types.mjs +1 -1
- package/dist/lib/browser/{url-handler-HLF42IHP.mjs → url-handler-MVHTKUYA.mjs} +8 -6
- package/dist/lib/browser/{url-handler-HLF42IHP.mjs.map → url-handler-MVHTKUYA.mjs.map} +3 -3
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +110 -110
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +8 -8
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +111 -111
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +5 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- 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/ActiveNode.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/ActiveNode.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Banner.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts +1 -4
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/ContentEmpty.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -4
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fallback.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Fallback.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Fullscreen.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts +1 -1
- package/dist/types/src/components/DeckLayout/Plank.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankError.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/PlankLoading.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/PlankLoading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts +3 -4
- package/dist/types/src/components/DeckLayout/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Topbar.d.ts +1 -2
- package/dist/types/src/components/DeckLayout/Topbar.d.ts.map +1 -1
- package/dist/types/src/components/LayoutSettings.d.ts +1 -2
- package/dist/types/src/components/LayoutSettings.d.ts.map +1 -1
- package/dist/types/src/events.d.ts +1 -0
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/useNode.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +11 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/set-active.d.ts.map +1 -0
- package/dist/types/src/util/useHoistStatusbar.d.ts.map +1 -1
- package/package.json +30 -30
- package/src/DeckPlugin.ts +8 -4
- package/src/capabilities/app-graph-builder.ts +4 -0
- package/src/capabilities/capabilities.ts +3 -6
- package/src/capabilities/intent-resolver.ts +26 -8
- package/src/capabilities/react-root.tsx +1 -3
- package/src/capabilities/state.ts +7 -1
- package/src/capabilities/tools.ts +8 -3
- package/src/capabilities/url-handler.ts +7 -5
- package/src/components/DeckLayout/ComplementarySidebar.tsx +107 -50
- package/src/components/DeckLayout/DeckLayout.tsx +41 -26
- package/src/components/DeckLayout/Plank.tsx +4 -3
- package/src/components/DeckLayout/PlankControls.tsx +1 -1
- package/src/events.ts +1 -0
- package/src/hooks/useNode.ts +3 -1
- package/src/layout.ts +1 -1
- package/src/types.ts +16 -3
- package/src/util/index.ts +1 -0
- package/src/{capabilities → util}/set-active.ts +4 -0
- package/src/util/useHoistStatusbar.ts +4 -8
- package/dist/lib/browser/chunk-BTDY6SES.mjs.map +0 -7
- package/dist/lib/browser/chunk-FZOBKOA2.mjs +0 -24
- package/dist/lib/browser/chunk-M2L53AIH.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-CSXFDKTC.mjs.map +0 -7
- package/dist/lib/browser/react-root-HIHLRMCW.mjs.map +0 -7
- package/dist/lib/browser/state-VPOYUKK6.mjs.map +0 -7
- package/dist/lib/browser/tools-5LDJNU56.mjs.map +0 -7
- package/dist/types/src/capabilities/set-active.d.ts.map +0 -1
- /package/dist/lib/browser/{chunk-FZOBKOA2.mjs.map → chunk-G2X3ZDCE.mjs.map} +0 -0
- /package/dist/lib/browser/{settings-WACNLCPB.mjs.map → settings-H35U6NHE.mjs.map} +0 -0
- /package/dist/types/src/{capabilities → util}/set-active.d.ts +0 -0
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
calculateOverscroll,
|
|
3
|
+
layoutAppliesTopbar,
|
|
4
|
+
useBreakpoints,
|
|
5
|
+
useHoistStatusbar
|
|
6
|
+
} from "./chunk-KANJBSIX.mjs";
|
|
1
7
|
import {
|
|
2
8
|
DeckCapabilities
|
|
3
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-22AQ5IVX.mjs";
|
|
4
10
|
import {
|
|
5
11
|
DeckAction,
|
|
6
12
|
NewPlankPositions,
|
|
7
13
|
OverscrollOptions,
|
|
8
14
|
SLUG_PATH_SEPARATOR,
|
|
9
15
|
getMode
|
|
10
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-FT33W5CI.mjs";
|
|
11
17
|
import {
|
|
12
18
|
DECK_PLUGIN
|
|
13
19
|
} from "./chunk-N7TEPFVR.mjs";
|
|
@@ -94,10 +100,10 @@ var Banner = ({ variant, classNames }) => {
|
|
|
94
100
|
|
|
95
101
|
// packages/plugins/plugin-deck/src/components/DeckLayout/DeckLayout.tsx
|
|
96
102
|
import { untracked } from "@preact/signals-core";
|
|
97
|
-
import React17, { useCallback as useCallback4, useEffect as useEffect6, useMemo as
|
|
98
|
-
import { LayoutAction as LayoutAction4, createIntent as createIntent4, Surface as Surface10, useCapability as
|
|
103
|
+
import React17, { useCallback as useCallback4, useEffect as useEffect6, useMemo as useMemo5, useRef as useRef2, Fragment as Fragment3, useState as useState4 } from "react";
|
|
104
|
+
import { LayoutAction as LayoutAction4, createIntent as createIntent4, Surface as Surface10, useCapability as useCapability5, useIntentDispatcher as useIntentDispatcher4, usePluginManager } from "@dxos/app-framework";
|
|
99
105
|
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
100
|
-
import { AlertDialog, Dialog as NaturalDialog, Main as Main3, Popover as Popover2, useOnTransition, useMediaQuery
|
|
106
|
+
import { AlertDialog, Dialog as NaturalDialog, Main as Main3, Popover as Popover2, useOnTransition, useMediaQuery } from "@dxos/react-ui";
|
|
101
107
|
import { Stack, StackContext, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
|
|
102
108
|
import { mainPaddingTransitions } from "@dxos/react-ui-theme";
|
|
103
109
|
|
|
@@ -186,11 +192,12 @@ var ActiveNode = () => {
|
|
|
186
192
|
};
|
|
187
193
|
|
|
188
194
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
189
|
-
import React8, { useCallback as useCallback2, useEffect as useEffect5, useMemo as
|
|
190
|
-
import { createIntent as createIntent2, LayoutAction as LayoutAction2, Surface as Surface4, useAppGraph as useAppGraph3, useCapability as
|
|
191
|
-
import { Main, useTranslation as useTranslation5, toLocalizedString as toLocalizedString2, IconButton as IconButton2, ScrollArea } from "@dxos/react-ui";
|
|
195
|
+
import React8, { useCallback as useCallback2, useEffect as useEffect5, useMemo as useMemo2, useState as useState3, Fragment as Fragment2 } from "react";
|
|
196
|
+
import { createIntent as createIntent2, LayoutAction as LayoutAction2, Surface as Surface4, useAppGraph as useAppGraph3, useCapabilities, useCapability as useCapability2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
197
|
+
import { Main, useTranslation as useTranslation5, toLocalizedString as toLocalizedString2, IconButton as IconButton2, ScrollArea as NaturalScrollArea } from "@dxos/react-ui";
|
|
192
198
|
import { useAttended as useAttended2 } from "@dxos/react-ui-attention";
|
|
193
199
|
import { Tabs } from "@dxos/react-ui-tabs";
|
|
200
|
+
import { byPosition } from "@dxos/util";
|
|
194
201
|
|
|
195
202
|
// packages/plugins/plugin-deck/src/components/DeckLayout/PlankError.tsx
|
|
196
203
|
import React7, { useEffect as useEffect4, useState as useState2 } from "react";
|
|
@@ -198,7 +205,7 @@ import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
|
198
205
|
import { descriptionText, mx as mx3 } from "@dxos/react-ui-theme";
|
|
199
206
|
|
|
200
207
|
// packages/plugins/plugin-deck/src/components/DeckLayout/NodePlankHeading.tsx
|
|
201
|
-
import React5, { Fragment, memo, useCallback, useEffect as useEffect3, useMemo
|
|
208
|
+
import React5, { Fragment, memo, useCallback, useEffect as useEffect3, useMemo } from "react";
|
|
202
209
|
import { createIntent, LayoutAction, Surface as Surface3, useAppGraph as useAppGraph2, useIntentDispatcher } from "@dxos/app-framework";
|
|
203
210
|
import { Icon as Icon2, Popover, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
204
211
|
import { StackItem } from "@dxos/react-ui-stack";
|
|
@@ -217,7 +224,7 @@ var PlankControl = ({ icon, label, ...props }) => {
|
|
|
217
224
|
className: "sr-only"
|
|
218
225
|
}, label), /* @__PURE__ */ React4.createElement(Icon, {
|
|
219
226
|
icon,
|
|
220
|
-
size:
|
|
227
|
+
size: 5
|
|
221
228
|
}))), /* @__PURE__ */ React4.createElement(Tooltip.Portal, null, /* @__PURE__ */ React4.createElement(Tooltip.Content, {
|
|
222
229
|
side: "bottom"
|
|
223
230
|
}, label)));
|
|
@@ -258,56 +265,6 @@ var PlankControls = /* @__PURE__ */ forwardRef(({ onClick, variant = "default",
|
|
|
258
265
|
}), children);
|
|
259
266
|
});
|
|
260
267
|
|
|
261
|
-
// packages/plugins/plugin-deck/src/util/overscroll.ts
|
|
262
|
-
var calculateOverscroll = (planksCount) => {
|
|
263
|
-
if (!planksCount) {
|
|
264
|
-
return {
|
|
265
|
-
paddingInlineStart: 0,
|
|
266
|
-
paddingInlineEnd: 0
|
|
267
|
-
};
|
|
268
|
-
}
|
|
269
|
-
if (planksCount === 1) {
|
|
270
|
-
const overscrollPadding = "max(0px, calc(((100dvw - var(--dx-main-sidebarWidth) - var(--dx-main-complementaryWidth) - (var(--dx-main-contentFirstWidth) + 1px)) / 2)))";
|
|
271
|
-
return {
|
|
272
|
-
paddingInlineStart: overscrollPadding,
|
|
273
|
-
paddingInlineEnd: overscrollPadding
|
|
274
|
-
};
|
|
275
|
-
} else {
|
|
276
|
-
return {
|
|
277
|
-
paddingInlineStart: "max(0px, calc(((100dvw - (var(--dx-main-contentFirstWidth) + 1px)) / 2) - var(--dx-main-sidebarWidth)))",
|
|
278
|
-
paddingInlineEnd: "max(0px, calc(((100dvw - (var(--dx-main-contentLastWidth) + 1px)) / 2) - var(--dx-main-complementaryWidth)))"
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
|
|
283
|
-
// packages/plugins/plugin-deck/src/util/useBreakpoints.ts
|
|
284
|
-
import { useMediaQuery } from "@dxos/react-ui";
|
|
285
|
-
var useBreakpoints = () => {
|
|
286
|
-
const [isNotMobile] = useMediaQuery("md");
|
|
287
|
-
const [isDesktop] = useMediaQuery("lg");
|
|
288
|
-
return isDesktop ? "desktop" : isNotMobile ? "tablet" : "mobile";
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
// packages/plugins/plugin-deck/src/util/layoutAppliesTopbar.ts
|
|
292
|
-
var layoutAppliesTopbar = (breakpoint) => {
|
|
293
|
-
return document.body.getAttribute("data-platform") === "win" && breakpoint === "desktop";
|
|
294
|
-
};
|
|
295
|
-
|
|
296
|
-
// packages/plugins/plugin-deck/src/util/useHoistStatusbar.ts
|
|
297
|
-
import { useMemo } from "react";
|
|
298
|
-
import { Capabilities, useCapability as useCapability2 } from "@dxos/app-framework";
|
|
299
|
-
var useHoistStatusbar = (breakpoint) => {
|
|
300
|
-
const enableIdeStyleStatusbar = useCapability2(Capabilities.SettingsStore).getStore(DECK_PLUGIN).value.enableIdeStyleStatusbar;
|
|
301
|
-
return useMemo(() => {
|
|
302
|
-
return breakpoint === "desktop" && enableIdeStyleStatusbar && // NOTE(thure): this last predicate depends on a head script that measures `env(safe-area-bottom)` on resize;
|
|
303
|
-
// see that of composer-app for an example.
|
|
304
|
-
document.body.getAttribute("data-safe-area-bottom") === "0";
|
|
305
|
-
}, [
|
|
306
|
-
enableIdeStyleStatusbar,
|
|
307
|
-
breakpoint
|
|
308
|
-
]);
|
|
309
|
-
};
|
|
310
|
-
|
|
311
268
|
// packages/plugins/plugin-deck/src/components/fragments.ts
|
|
312
269
|
import { mx as mx2 } from "@dxos/react-ui-theme";
|
|
313
270
|
var soloInlinePadding = "pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]";
|
|
@@ -338,7 +295,7 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ id, part, node, canIncrementStart
|
|
|
338
295
|
node
|
|
339
296
|
]);
|
|
340
297
|
const attendableId = id.split(SLUG_PATH_SEPARATOR).at(0);
|
|
341
|
-
const capabilities =
|
|
298
|
+
const capabilities = useMemo(() => ({
|
|
342
299
|
solo: breakpoint !== "mobile" && (part === "solo" || part === "deck"),
|
|
343
300
|
incrementStart: canIncrementStart,
|
|
344
301
|
incrementEnd: canIncrementEnd
|
|
@@ -348,7 +305,7 @@ var NodePlankHeading = /* @__PURE__ */ memo(({ id, part, node, canIncrementStart
|
|
|
348
305
|
canIncrementStart,
|
|
349
306
|
canIncrementEnd
|
|
350
307
|
]);
|
|
351
|
-
const sigilActions =
|
|
308
|
+
const sigilActions = useMemo(() => node && [
|
|
352
309
|
actions,
|
|
353
310
|
graph.actions(node)
|
|
354
311
|
].filter((a) => a.length > 0), [
|
|
@@ -479,22 +436,24 @@ var PlankError = ({ id, part, node, error }) => {
|
|
|
479
436
|
};
|
|
480
437
|
|
|
481
438
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ComplementarySidebar.tsx
|
|
482
|
-
var ComplementarySidebar = ({
|
|
483
|
-
const layout = useCapability3(DeckCapabilities.MutableDeckState);
|
|
484
|
-
const attended = useAttended2();
|
|
485
|
-
const panelIds = useMemo3(() => panels.map((panel) => panel.id), [
|
|
486
|
-
panels
|
|
487
|
-
]);
|
|
488
|
-
const activePanelId = panelIds.find((panelId) => panelId === current) ?? panels[0].id;
|
|
489
|
-
const activeEntryId = attended[0] ? `${attended[0]}${SLUG_PATH_SEPARATOR}${activePanelId}` : void 0;
|
|
490
|
-
const { graph } = useAppGraph3();
|
|
491
|
-
const node = useNode(graph, activeEntryId);
|
|
439
|
+
var ComplementarySidebar = ({ current }) => {
|
|
492
440
|
const { t } = useTranslation5(DECK_PLUGIN);
|
|
493
441
|
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
494
|
-
|
|
442
|
+
const layout = useCapability2(DeckCapabilities.MutableDeckState);
|
|
443
|
+
const attended = useAttended2();
|
|
444
|
+
const { graph } = useAppGraph3();
|
|
445
|
+
const node = useNode(graph, attended[0]);
|
|
495
446
|
const breakpoint = useBreakpoints();
|
|
496
447
|
const topbar = layoutAppliesTopbar(breakpoint);
|
|
497
448
|
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
449
|
+
const panels = useCapabilities(DeckCapabilities.ComplementaryPanel);
|
|
450
|
+
const availablePanels = panels.filter((panel) => {
|
|
451
|
+
if (!node || !panel.filter) {
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
return panel.filter(node);
|
|
455
|
+
}).toSorted(byPosition);
|
|
456
|
+
const activePanelId = availablePanels.find((panel) => panel.id === current)?.id ?? availablePanels[0]?.id;
|
|
498
457
|
const [internalValue, setInternalValue] = useState3(activePanelId);
|
|
499
458
|
useEffect5(() => {
|
|
500
459
|
setInternalValue(activePanelId);
|
|
@@ -518,6 +477,15 @@ var ComplementarySidebar = ({ panels, current }) => {
|
|
|
518
477
|
activePanelId,
|
|
519
478
|
dispatch
|
|
520
479
|
]);
|
|
480
|
+
const data = useMemo2(() => node && {
|
|
481
|
+
id: node.id,
|
|
482
|
+
subject: node.data,
|
|
483
|
+
workspace: layout.activeDeck,
|
|
484
|
+
popoverAnchorId: layout.popoverAnchorId
|
|
485
|
+
}, [
|
|
486
|
+
node,
|
|
487
|
+
layout.popoverAnchorId
|
|
488
|
+
]);
|
|
521
489
|
return /* @__PURE__ */ React8.createElement(Main.ComplementarySidebar, {
|
|
522
490
|
classNames: [
|
|
523
491
|
topbar && "block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
@@ -531,10 +499,10 @@ var ComplementarySidebar = ({ panels, current }) => {
|
|
|
531
499
|
classNames: "contents"
|
|
532
500
|
}, /* @__PURE__ */ React8.createElement("div", {
|
|
533
501
|
role: "none",
|
|
534
|
-
className: "absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size] border-is border-separator grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag"
|
|
502
|
+
className: "absolute z-[1] inset-block-0 inline-end-0 !is-[--r0-size] pbs-[env(safe-area-inset-top)] pbe-[env(safe-area-inset-bottom)] border-is border-separator grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag"
|
|
535
503
|
}, /* @__PURE__ */ React8.createElement(Tabs.Tablist, {
|
|
536
504
|
classNames: "grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto"
|
|
537
|
-
},
|
|
505
|
+
}, availablePanels.map((panel) => /* @__PURE__ */ React8.createElement(Tabs.Tab, {
|
|
538
506
|
key: panel.id,
|
|
539
507
|
value: panel.id,
|
|
540
508
|
asChild: true
|
|
@@ -556,34 +524,45 @@ var ComplementarySidebar = ({ panels, current }) => {
|
|
|
556
524
|
})), /* @__PURE__ */ React8.createElement("div", {
|
|
557
525
|
role: "none",
|
|
558
526
|
className: "hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1"
|
|
559
|
-
}, /* @__PURE__ */ React8.createElement(ToggleComplementarySidebarButton, null))),
|
|
527
|
+
}, /* @__PURE__ */ React8.createElement(ToggleComplementarySidebarButton, null))), availablePanels.map((panel) => /* @__PURE__ */ React8.createElement(Tabs.Tabpanel, {
|
|
560
528
|
key: panel.id,
|
|
561
529
|
value: panel.id,
|
|
562
|
-
classNames: 'absolute data-[state="inactive"]:-z-[1] inset-block-0 inline-start-0 is-[calc(100%-var(--r0-size))] lg:is-[--r1-size] grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content]',
|
|
530
|
+
classNames: 'absolute data-[state="inactive"]:-z-[1] inset-block-0 inline-start-0 is-[calc(100%-var(--r0-size))] lg:is-[--r1-size] grid grid-cols-1 grid-rows-[var(--rail-size)_1fr_min-content] pbs-[env(safe-area-inset-top)]',
|
|
563
531
|
...layout.complementarySidebarState !== "expanded" && {
|
|
564
532
|
inert: "true"
|
|
565
533
|
}
|
|
566
|
-
},
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
534
|
+
}, /* @__PURE__ */ React8.createElement(ComplementarySidebarPanel, {
|
|
535
|
+
panel,
|
|
536
|
+
activePanelId,
|
|
537
|
+
data,
|
|
538
|
+
hoistStatusbar
|
|
539
|
+
})))));
|
|
540
|
+
};
|
|
541
|
+
var ScrollArea = ({ children }) => {
|
|
542
|
+
return /* @__PURE__ */ React8.createElement(NaturalScrollArea.Root, null, /* @__PURE__ */ React8.createElement(NaturalScrollArea.Viewport, null, children), /* @__PURE__ */ React8.createElement(NaturalScrollArea.Scrollbar, {
|
|
543
|
+
orientation: "vertical"
|
|
544
|
+
}, /* @__PURE__ */ React8.createElement(NaturalScrollArea.Thumb, null)));
|
|
545
|
+
};
|
|
546
|
+
var ComplementarySidebarPanel = ({ panel, activePanelId, data, hoistStatusbar }) => {
|
|
547
|
+
const { t } = useTranslation5(DECK_PLUGIN);
|
|
548
|
+
if (panel.id !== activePanelId || !data) {
|
|
549
|
+
return null;
|
|
550
|
+
}
|
|
551
|
+
const Wrapper = panel.fixed ? Fragment2 : ScrollArea;
|
|
552
|
+
return /* @__PURE__ */ React8.createElement(React8.Fragment, null, /* @__PURE__ */ React8.createElement("h2", {
|
|
553
|
+
className: "flex items-center pli-2 border-separator border-be font-medium"
|
|
554
|
+
}, toLocalizedString2(panel.label, t)), /* @__PURE__ */ React8.createElement(Wrapper, null, /* @__PURE__ */ React8.createElement(Surface4, {
|
|
570
555
|
role: `complementary--${activePanelId}`,
|
|
571
|
-
data
|
|
572
|
-
id: activeEntryId,
|
|
573
|
-
subject: node.properties.object ?? node.properties.space,
|
|
574
|
-
popoverAnchorId: layout.popoverAnchorId
|
|
575
|
-
},
|
|
556
|
+
data,
|
|
576
557
|
fallback: PlankContentError,
|
|
577
558
|
placeholder: /* @__PURE__ */ React8.createElement(PlankLoading, null)
|
|
578
|
-
})), /* @__PURE__ */ React8.createElement(
|
|
579
|
-
orientation: "vertical"
|
|
580
|
-
}, /* @__PURE__ */ React8.createElement(ScrollArea.Thumb, null))), !hoistStatusbar && /* @__PURE__ */ React8.createElement("div", {
|
|
559
|
+
})), !hoistStatusbar && /* @__PURE__ */ React8.createElement("div", {
|
|
581
560
|
role: "contentinfo",
|
|
582
|
-
className: "flex flex-wrap justify-center items-center border-bs border-separator
|
|
561
|
+
className: "flex flex-wrap justify-center items-center border-bs border-separator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]"
|
|
583
562
|
}, /* @__PURE__ */ React8.createElement(Surface4, {
|
|
584
563
|
role: "status-bar--r1-footer",
|
|
585
564
|
limit: 1
|
|
586
|
-
})))
|
|
565
|
+
})));
|
|
587
566
|
};
|
|
588
567
|
|
|
589
568
|
// packages/plugins/plugin-deck/src/components/DeckLayout/ContentEmpty.tsx
|
|
@@ -646,8 +625,8 @@ var Fullscreen = ({ id }) => {
|
|
|
646
625
|
};
|
|
647
626
|
|
|
648
627
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Plank.tsx
|
|
649
|
-
import React12, { memo as memo2, useCallback as useCallback3, useLayoutEffect, useMemo as
|
|
650
|
-
import { createIntent as createIntent3, LayoutAction as LayoutAction3, Surface as Surface7, useCapability as
|
|
628
|
+
import React12, { memo as memo2, useCallback as useCallback3, useLayoutEffect, useMemo as useMemo3, useRef } from "react";
|
|
629
|
+
import { createIntent as createIntent3, LayoutAction as LayoutAction3, Surface as Surface7, useCapability as useCapability3, useAppGraph as useAppGraph5, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
651
630
|
import { debounce } from "@dxos/async";
|
|
652
631
|
import { useAttendableAttributes } from "@dxos/react-ui-attention";
|
|
653
632
|
import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
|
|
@@ -655,7 +634,7 @@ import { mainIntrinsicSize, mx as mx5 } from "@dxos/react-ui-theme";
|
|
|
655
634
|
var UNKNOWN_ID = "unknown_id";
|
|
656
635
|
var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active, layoutMode }) => {
|
|
657
636
|
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
658
|
-
const { deck, popoverAnchorId, scrollIntoView } =
|
|
637
|
+
const { deck, popoverAnchorId, scrollIntoView } = useCapability3(DeckCapabilities.DeckState);
|
|
659
638
|
const { graph } = useAppGraph5();
|
|
660
639
|
const node = useNode(graph, id);
|
|
661
640
|
const rootElement = useRef(null);
|
|
@@ -666,15 +645,16 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active,
|
|
|
666
645
|
const length = active?.length ?? 1;
|
|
667
646
|
const canIncrementStart = active && index !== void 0 && index > 0 && length !== void 0 && length > 1;
|
|
668
647
|
const canIncrementEnd = active && index !== void 0 && index < length - 1 && length !== void 0;
|
|
669
|
-
const
|
|
648
|
+
const key = id.split("+")[0];
|
|
649
|
+
const size = deck.plankSizing[key];
|
|
670
650
|
const setSize = useCallback3(debounce((nextSize) => {
|
|
671
651
|
return dispatch(createIntent3(DeckAction.UpdatePlankSize, {
|
|
672
|
-
id,
|
|
652
|
+
id: key,
|
|
673
653
|
size: nextSize
|
|
674
654
|
}));
|
|
675
655
|
}, 200), [
|
|
676
656
|
dispatch,
|
|
677
|
-
|
|
657
|
+
key
|
|
678
658
|
]);
|
|
679
659
|
const handleKeyDown = useCallback3((event) => {
|
|
680
660
|
if (event.target === event.currentTarget && event.key === "Escape") {
|
|
@@ -704,7 +684,7 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active,
|
|
|
704
684
|
const isSolo = layoutMode === "solo" && part === "solo";
|
|
705
685
|
const isAttendable = isSolo || layoutMode === "deck" && part === "deck";
|
|
706
686
|
const sizeAttrs = useMainSize();
|
|
707
|
-
const data =
|
|
687
|
+
const data = useMemo3(() => node && {
|
|
708
688
|
subject: node.data,
|
|
709
689
|
path,
|
|
710
690
|
popoverAnchorId
|
|
@@ -714,7 +694,7 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active,
|
|
|
714
694
|
path,
|
|
715
695
|
popoverAnchorId
|
|
716
696
|
]);
|
|
717
|
-
const placeholder =
|
|
697
|
+
const placeholder = useMemo3(() => /* @__PURE__ */ React12.createElement(PlankLoading, null), []);
|
|
718
698
|
const className = mx5("attention-surface relative", isSolo && mainIntrinsicSize, isSolo && railGridHorizontal, isSolo ? "grid absolute inset-0" : "!border-separator border-li");
|
|
719
699
|
return /* @__PURE__ */ React12.createElement(Root, {
|
|
720
700
|
ref: rootElement,
|
|
@@ -756,15 +736,15 @@ var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, part, path, order, active,
|
|
|
756
736
|
});
|
|
757
737
|
|
|
758
738
|
// packages/plugins/plugin-deck/src/components/DeckLayout/Sidebar.tsx
|
|
759
|
-
import React13, { useMemo as
|
|
760
|
-
import { Surface as Surface8, useCapability as
|
|
739
|
+
import React13, { useMemo as useMemo4 } from "react";
|
|
740
|
+
import { Surface as Surface8, useCapability as useCapability4 } from "@dxos/app-framework";
|
|
761
741
|
import { Main as Main2 } from "@dxos/react-ui";
|
|
762
742
|
var Sidebar = () => {
|
|
763
|
-
const { popoverAnchorId, activeDeck: current } =
|
|
743
|
+
const { popoverAnchorId, activeDeck: current } = useCapability4(DeckCapabilities.DeckState);
|
|
764
744
|
const breakpoint = useBreakpoints();
|
|
765
745
|
const topbar = layoutAppliesTopbar(breakpoint);
|
|
766
746
|
const hoistStatusbar = useHoistStatusbar(breakpoint);
|
|
767
|
-
const navigationData =
|
|
747
|
+
const navigationData = useMemo4(() => ({
|
|
768
748
|
popoverAnchorId,
|
|
769
749
|
topbar,
|
|
770
750
|
hoistStatusbar,
|
|
@@ -853,9 +833,9 @@ var PlankSeparator = ({ index }) => index > 0 ? /* @__PURE__ */ React17.createEl
|
|
|
853
833
|
gridColumn: index * 2
|
|
854
834
|
}
|
|
855
835
|
}) : null;
|
|
856
|
-
var DeckLayout = ({ overscroll, showHints,
|
|
836
|
+
var DeckLayout = ({ overscroll, showHints, onDismissToast }) => {
|
|
857
837
|
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
858
|
-
const context =
|
|
838
|
+
const context = useCapability5(DeckCapabilities.MutableDeckState);
|
|
859
839
|
const { sidebarState, complementarySidebarState, complementarySidebarPanel, dialogOpen, dialogContent, dialogBlockAlign, dialogType, popoverOpen, popoverContent, popoverAnchorId, deck, toasts } = context;
|
|
860
840
|
const { active, fullscreen, solo, plankSizing } = deck;
|
|
861
841
|
const breakpoint = useBreakpoints();
|
|
@@ -864,6 +844,12 @@ var DeckLayout = ({ overscroll, showHints, panels, onDismissToast }) => {
|
|
|
864
844
|
const pluginManager = usePluginManager();
|
|
865
845
|
const scrollLeftRef = useRef2();
|
|
866
846
|
const deckRef = useRef2(null);
|
|
847
|
+
const [delayedPopoverVisibility, setDelayedPopoverVisibility] = useState4(false);
|
|
848
|
+
useEffect6(() => {
|
|
849
|
+
popoverOpen ? setTimeout(() => setDelayedPopoverVisibility(true), 40) : setDelayedPopoverVisibility(false);
|
|
850
|
+
}, [
|
|
851
|
+
popoverOpen
|
|
852
|
+
]);
|
|
867
853
|
useEffect6(() => {
|
|
868
854
|
const attended = untracked(() => {
|
|
869
855
|
const attention = pluginManager.context.requestCapability(AttentionCapabilities.Attention);
|
|
@@ -874,7 +860,7 @@ var DeckLayout = ({ overscroll, showHints, panels, onDismissToast }) => {
|
|
|
874
860
|
document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
|
|
875
861
|
}
|
|
876
862
|
}, []);
|
|
877
|
-
const [isNotMobile] =
|
|
863
|
+
const [isNotMobile] = useMediaQuery("md", {
|
|
878
864
|
ssr: false
|
|
879
865
|
});
|
|
880
866
|
const shouldRevert = useRef2(false);
|
|
@@ -929,7 +915,7 @@ var DeckLayout = ({ overscroll, showHints, panels, onDismissToast }) => {
|
|
|
929
915
|
solo
|
|
930
916
|
]);
|
|
931
917
|
const isEmpty = !solo && active.length === 0;
|
|
932
|
-
const padding =
|
|
918
|
+
const padding = useMemo5(() => {
|
|
933
919
|
if (!solo && overscroll === "centering") {
|
|
934
920
|
return calculateOverscroll(active.length);
|
|
935
921
|
}
|
|
@@ -939,7 +925,7 @@ var DeckLayout = ({ overscroll, showHints, panels, onDismissToast }) => {
|
|
|
939
925
|
overscroll,
|
|
940
926
|
deck
|
|
941
927
|
]);
|
|
942
|
-
const mainPosition =
|
|
928
|
+
const mainPosition = useMemo5(() => [
|
|
943
929
|
"grid !block-start-[env(safe-area-inset-top)]",
|
|
944
930
|
topbar && "!block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
945
931
|
hoistStatusbar && "lg:block-end-[--statusbar-size]"
|
|
@@ -948,17 +934,24 @@ var DeckLayout = ({ overscroll, showHints, panels, onDismissToast }) => {
|
|
|
948
934
|
hoistStatusbar
|
|
949
935
|
]);
|
|
950
936
|
const Dialog = dialogType === "alert" ? AlertDialog : NaturalDialog;
|
|
937
|
+
const handlePopoverOpenChange = useCallback4((nextOpen) => {
|
|
938
|
+
if (nextOpen && popoverAnchorId) {
|
|
939
|
+
context.popoverOpen = true;
|
|
940
|
+
} else {
|
|
941
|
+
context.popoverOpen = false;
|
|
942
|
+
context.popoverAnchorId = void 0;
|
|
943
|
+
context.popoverSide = void 0;
|
|
944
|
+
}
|
|
945
|
+
}, [
|
|
946
|
+
context
|
|
947
|
+
]);
|
|
948
|
+
const handlePopoverClose = useCallback4(() => handlePopoverOpenChange(false), [
|
|
949
|
+
handlePopoverOpenChange
|
|
950
|
+
]);
|
|
951
951
|
return /* @__PURE__ */ React17.createElement(Popover2.Root, {
|
|
952
952
|
modal: true,
|
|
953
|
-
open: !!(popoverAnchorId &&
|
|
954
|
-
onOpenChange:
|
|
955
|
-
if (nextOpen && popoverAnchorId) {
|
|
956
|
-
context.popoverOpen = true;
|
|
957
|
-
} else {
|
|
958
|
-
context.popoverOpen = false;
|
|
959
|
-
context.popoverAnchorId = void 0;
|
|
960
|
-
}
|
|
961
|
-
}
|
|
953
|
+
open: !!(popoverAnchorId && delayedPopoverVisibility),
|
|
954
|
+
onOpenChange: handlePopoverOpenChange
|
|
962
955
|
}, /* @__PURE__ */ React17.createElement(ActiveNode, null), fullscreen && /* @__PURE__ */ React17.createElement(Fullscreen, {
|
|
963
956
|
id: solo
|
|
964
957
|
}), !fullscreen && /* @__PURE__ */ React17.createElement(Main3.Root, {
|
|
@@ -967,7 +960,6 @@ var DeckLayout = ({ overscroll, showHints, panels, onDismissToast }) => {
|
|
|
967
960
|
complementarySidebarState: context.complementarySidebarState,
|
|
968
961
|
onComplementarySidebarStateChange: (next) => context.complementarySidebarState = next
|
|
969
962
|
}, /* @__PURE__ */ React17.createElement(Sidebar, null), /* @__PURE__ */ React17.createElement(ComplementarySidebar, {
|
|
970
|
-
panels,
|
|
971
963
|
current: complementarySidebarPanel
|
|
972
964
|
}), /* @__PURE__ */ React17.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React17.createElement(Main3.Content, {
|
|
973
965
|
bounce: true,
|
|
@@ -1004,7 +996,7 @@ var DeckLayout = ({ overscroll, showHints, panels, onDismissToast }) => {
|
|
|
1004
996
|
itemsCount: 2 * (active.length ?? 0) - 1,
|
|
1005
997
|
style: padding,
|
|
1006
998
|
ref: deckRef
|
|
1007
|
-
}, active.map((entryId, index) => /* @__PURE__ */ React17.createElement(
|
|
999
|
+
}, active.map((entryId, index) => /* @__PURE__ */ React17.createElement(Fragment3, {
|
|
1008
1000
|
key: entryId
|
|
1009
1001
|
}, /* @__PURE__ */ React17.createElement(PlankSeparator, {
|
|
1010
1002
|
index
|
|
@@ -1037,18 +1029,21 @@ var DeckLayout = ({ overscroll, showHints, panels, onDismissToast }) => {
|
|
|
1037
1029
|
})))), topbar && /* @__PURE__ */ React17.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React17.createElement(StatusBar, {
|
|
1038
1030
|
showHints
|
|
1039
1031
|
})), /* @__PURE__ */ React17.createElement(Popover2.Portal, null, /* @__PURE__ */ React17.createElement(Popover2.Content, {
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
context.popoverAnchorId = void 0;
|
|
1043
|
-
}
|
|
1032
|
+
side: context.popoverSide,
|
|
1033
|
+
onEscapeKeyDown: handlePopoverClose
|
|
1044
1034
|
}, /* @__PURE__ */ React17.createElement(Popover2.Viewport, null, /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1045
1035
|
role: "popover",
|
|
1046
1036
|
data: popoverContent,
|
|
1047
1037
|
limit: 1
|
|
1048
1038
|
})), /* @__PURE__ */ React17.createElement(Popover2.Arrow, null))), /* @__PURE__ */ React17.createElement(Dialog.Root, {
|
|
1039
|
+
modal: dialogBlockAlign !== "end",
|
|
1049
1040
|
open: dialogOpen,
|
|
1050
1041
|
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
1051
|
-
}, /* @__PURE__ */ React17.createElement(
|
|
1042
|
+
}, dialogBlockAlign === "end" ? /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1043
|
+
role: "dialog",
|
|
1044
|
+
data: dialogContent,
|
|
1045
|
+
limit: 1
|
|
1046
|
+
}) : /* @__PURE__ */ React17.createElement(Dialog.Overlay, {
|
|
1052
1047
|
blockAlign: dialogBlockAlign
|
|
1053
1048
|
}, /* @__PURE__ */ React17.createElement(Surface10, {
|
|
1054
1049
|
role: "dialog",
|
|
@@ -1116,4 +1111,4 @@ export {
|
|
|
1116
1111
|
DeckLayout,
|
|
1117
1112
|
LayoutSettings
|
|
1118
1113
|
};
|
|
1119
|
-
//# sourceMappingURL=chunk-
|
|
1114
|
+
//# sourceMappingURL=chunk-O4RFYYQ6.mjs.map
|