@dxos/plugin-deck 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
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-JTFSDT2I.mjs → app-graph-builder-D74NTOMK.mjs} +19 -43
- package/dist/lib/browser/app-graph-builder-D74NTOMK.mjs.map +7 -0
- package/dist/lib/browser/{check-app-scheme-57U62A3A.mjs → check-app-scheme-HIEVFAAX.mjs} +6 -6
- package/dist/lib/browser/check-app-scheme-HIEVFAAX.mjs.map +7 -0
- package/dist/lib/browser/chunk-5KMJPIQC.mjs +16 -0
- package/dist/lib/browser/chunk-5KMJPIQC.mjs.map +7 -0
- package/dist/lib/browser/{chunk-XL7EWOGI.mjs → chunk-F3VCCHVL.mjs} +13 -13
- package/dist/lib/browser/chunk-F3VCCHVL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7LJDT5OH.mjs → chunk-QKCGZ45E.mjs} +19 -18
- package/dist/lib/browser/chunk-QKCGZ45E.mjs.map +7 -0
- package/dist/lib/browser/chunk-UXLU6CMW.mjs +16 -0
- package/dist/lib/browser/chunk-UXLU6CMW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QO3VIMKQ.mjs → chunk-VBYJ664A.mjs} +13 -9
- package/dist/lib/browser/chunk-VBYJ664A.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QBKDUEDV.mjs → chunk-VUJ6UNIJ.mjs} +579 -520
- package/dist/lib/browser/chunk-VUJ6UNIJ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-6YMAE4SF.mjs → intent-resolver-UA4YQGAC.mjs} +21 -18
- package/dist/lib/browser/intent-resolver-UA4YQGAC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-UVN2LMU3.mjs → react-root-JAMHKYWN.mjs} +13 -12
- package/dist/lib/browser/react-root-JAMHKYWN.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-WOLHGHMN.mjs → react-surface-6LW337ZT.mjs} +13 -13
- package/dist/lib/browser/react-surface-6LW337ZT.mjs.map +7 -0
- package/dist/lib/browser/{settings-L5CR5GTJ.mjs → settings-SDPTOCCM.mjs} +7 -6
- package/dist/lib/browser/{settings-L5CR5GTJ.mjs.map → settings-SDPTOCCM.mjs.map} +3 -3
- package/dist/lib/browser/state-7IFAGZQO.mjs +12 -0
- package/dist/lib/browser/toolkit-L5CFXJCF.mjs +52 -0
- package/dist/lib/browser/toolkit-L5CFXJCF.mjs.map +7 -0
- package/dist/lib/browser/{types.mjs → types/index.mjs} +3 -5
- package/dist/lib/browser/{url-handler-KZW7GBA2.mjs → url-handler-QEYGYE2H.mjs} +7 -7
- package/dist/lib/browser/url-handler-QEYGYE2H.mjs.map +7 -0
- package/dist/types/src/DeckPlugin.d.ts +1 -1
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts +1 -1
- package/dist/types/src/capabilities/check-app-scheme.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +9 -9
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-root.d.ts +2 -2
- package/dist/types/src/capabilities/react-root.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/settings.d.ts +1 -1
- package/dist/types/src/capabilities/settings.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/toolkit.d.ts +25 -0
- package/dist/types/src/capabilities/toolkit.d.ts.map +1 -0
- package/dist/types/src/capabilities/tools.d.ts +1 -1
- package/dist/types/src/capabilities/tools.d.ts.map +1 -1
- package/dist/types/src/capabilities/url-handler.d.ts +1 -1
- package/dist/types/src/capabilities/url-handler.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Banner.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts +74 -0
- package/dist/types/src/components/DeckLayout/DeckLayout.stories.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts +3 -0
- package/dist/types/src/components/DeckLayout/DeckMain.d.ts.map +1 -0
- package/dist/types/src/components/DeckLayout/Popover.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Toast.d.ts +5 -0
- package/dist/types/src/components/DeckLayout/Toast.d.ts.map +1 -1
- package/dist/types/src/components/DeckSettings/DeckSettings.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts +1 -1
- package/dist/types/src/components/Plank/Plank.d.ts.map +1 -1
- package/dist/types/src/components/Plank/Plank.stories.d.ts +86 -5
- package/dist/types/src/components/Plank/Plank.stories.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankControls.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankError.d.ts.map +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts +1 -1
- package/dist/types/src/components/Plank/PlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/Sidebar/SidebarButton.d.ts.map +1 -1
- package/dist/types/src/events.d.ts.map +1 -1
- package/dist/types/src/hooks/useDeckCompanions.d.ts.map +1 -1
- package/dist/types/src/hooks/useHoistStatusbar.d.ts.map +1 -1
- package/dist/types/src/hooks/useNodeActionExpander.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +2 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/src/{types.d.ts → types/schema.d.ts} +11 -11
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +49 -45
- package/src/DeckPlugin.ts +64 -59
- package/src/capabilities/app-graph-builder.ts +33 -31
- package/src/capabilities/capabilities.ts +3 -3
- package/src/capabilities/check-app-scheme.ts +3 -3
- package/src/capabilities/index.ts +2 -1
- package/src/capabilities/intent-resolver.ts +22 -19
- package/src/capabilities/react-root.tsx +6 -4
- package/src/capabilities/react-surface.tsx +5 -5
- package/src/capabilities/settings.ts +2 -1
- package/src/capabilities/state.ts +15 -6
- package/src/capabilities/toolkit.ts +66 -0
- package/src/capabilities/tools.ts +10 -7
- package/src/capabilities/url-handler.ts +3 -2
- package/src/components/DeckLayout/ActiveNode.tsx +1 -1
- package/src/components/DeckLayout/Banner.tsx +4 -4
- package/src/components/DeckLayout/ContentEmpty.tsx +2 -2
- package/src/components/DeckLayout/DeckLayout.stories.tsx +63 -0
- package/src/components/DeckLayout/DeckLayout.tsx +10 -279
- package/src/components/DeckLayout/DeckMain.tsx +281 -0
- package/src/components/DeckLayout/Dialog.tsx +1 -1
- package/src/components/DeckLayout/Fallback.tsx +3 -3
- package/src/components/DeckLayout/Popover.tsx +5 -14
- package/src/components/DeckLayout/StatusBar.tsx +1 -1
- package/src/components/DeckLayout/Toast.tsx +28 -3
- package/src/components/DeckSettings/DeckSettings.tsx +80 -65
- package/src/components/Plank/Plank.stories.tsx +10 -11
- package/src/components/Plank/Plank.tsx +75 -42
- package/src/components/Plank/PlankControls.tsx +6 -5
- package/src/components/Plank/PlankError.tsx +5 -7
- package/src/components/Plank/PlankHeading.tsx +14 -12
- package/src/components/Sidebar/ComplementarySidebar.tsx +40 -19
- package/src/components/Sidebar/Sidebar.tsx +3 -3
- package/src/components/Sidebar/SidebarButton.tsx +15 -14
- package/src/events.ts +2 -2
- package/src/hooks/useCompanions.ts +1 -1
- package/src/hooks/useDeckCompanions.ts +4 -3
- package/src/hooks/useHoistStatusbar.ts +6 -4
- package/src/hooks/useNodeActionExpander.ts +1 -1
- package/src/meta.ts +6 -3
- package/src/translations.ts +2 -0
- package/src/types/index.ts +5 -0
- package/src/{types.ts → types/schema.ts} +9 -9
- package/dist/lib/browser/app-graph-builder-JTFSDT2I.mjs.map +0 -7
- package/dist/lib/browser/check-app-scheme-57U62A3A.mjs.map +0 -7
- package/dist/lib/browser/chunk-7LJDT5OH.mjs.map +0 -7
- package/dist/lib/browser/chunk-M57WD3V6.mjs +0 -16
- package/dist/lib/browser/chunk-M57WD3V6.mjs.map +0 -7
- package/dist/lib/browser/chunk-QBKDUEDV.mjs.map +0 -7
- package/dist/lib/browser/chunk-QO3VIMKQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-XL7EWOGI.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z5KITAZW.mjs +0 -13
- package/dist/lib/browser/chunk-Z5KITAZW.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-6YMAE4SF.mjs.map +0 -7
- package/dist/lib/browser/react-root-UVN2LMU3.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WOLHGHMN.mjs.map +0 -7
- package/dist/lib/browser/state-ZTYWMORZ.mjs +0 -10
- package/dist/lib/browser/tools-2YYFHQAS.mjs +0 -88
- package/dist/lib/browser/tools-2YYFHQAS.mjs.map +0 -7
- package/dist/lib/browser/url-handler-KZW7GBA2.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-YCSX45KJ.mjs +0 -153
- package/dist/lib/node-esm/app-graph-builder-YCSX45KJ.mjs.map +0 -7
- package/dist/lib/node-esm/check-app-scheme-3YZIA73T.mjs +0 -33
- package/dist/lib/node-esm/check-app-scheme-3YZIA73T.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ANLUUC3J.mjs +0 -129
- package/dist/lib/node-esm/chunk-ANLUUC3J.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F4YIQ5GG.mjs +0 -128
- package/dist/lib/node-esm/chunk-F4YIQ5GG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HHG6H2BX.mjs +0 -15
- package/dist/lib/node-esm/chunk-HHG6H2BX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KTPDAVNM.mjs +0 -17
- package/dist/lib/node-esm/chunk-KTPDAVNM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NMSUKHE3.mjs +0 -1495
- package/dist/lib/node-esm/chunk-NMSUKHE3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QFKYT4JK.mjs +0 -163
- package/dist/lib/node-esm/chunk-QFKYT4JK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UJGQAMF7.mjs +0 -147
- package/dist/lib/node-esm/chunk-UJGQAMF7.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -169
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-URTWBGD7.mjs +0 -522
- package/dist/lib/node-esm/intent-resolver-URTWBGD7.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-root-GFX4GOJT.mjs +0 -44
- package/dist/lib/node-esm/react-root-GFX4GOJT.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-F6L5PLWK.mjs +0 -41
- package/dist/lib/node-esm/react-surface-F6L5PLWK.mjs.map +0 -7
- package/dist/lib/node-esm/settings-WE3TBMOC.mjs +0 -30
- package/dist/lib/node-esm/settings-WE3TBMOC.mjs.map +0 -7
- package/dist/lib/node-esm/state-DUK6WFDX.mjs +0 -11
- package/dist/lib/node-esm/state-DUK6WFDX.mjs.map +0 -7
- package/dist/lib/node-esm/tools-HH6NN7HB.mjs +0 -89
- package/dist/lib/node-esm/tools-HH6NN7HB.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -35
- package/dist/lib/node-esm/types.mjs.map +0 -7
- package/dist/lib/node-esm/url-handler-774BWWKI.mjs +0 -71
- package/dist/lib/node-esm/url-handler-774BWWKI.mjs.map +0 -7
- package/dist/types/src/types.d.ts.map +0 -1
- /package/dist/lib/browser/{state-ZTYWMORZ.mjs.map → state-7IFAGZQO.mjs.map} +0 -0
- /package/dist/lib/browser/{types.mjs.map → types/index.mjs.map} +0 -0
|
@@ -1,1495 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
getCompanionId,
|
|
4
|
-
useBreakpoints,
|
|
5
|
-
useCompanions,
|
|
6
|
-
useDeckCompanions,
|
|
7
|
-
useHoistStatusbar,
|
|
8
|
-
useMainSize,
|
|
9
|
-
useNodeActionExpander
|
|
10
|
-
} from "./chunk-F4YIQ5GG.mjs";
|
|
11
|
-
import {
|
|
12
|
-
calculateOverscroll,
|
|
13
|
-
layoutAppliesTopbar,
|
|
14
|
-
parseEntryId
|
|
15
|
-
} from "./chunk-UJGQAMF7.mjs";
|
|
16
|
-
import {
|
|
17
|
-
DeckCapabilities
|
|
18
|
-
} from "./chunk-KTPDAVNM.mjs";
|
|
19
|
-
import {
|
|
20
|
-
DeckAction,
|
|
21
|
-
NewPlankPositions,
|
|
22
|
-
OverscrollOptions,
|
|
23
|
-
PLANK_COMPANION_TYPE,
|
|
24
|
-
getMode
|
|
25
|
-
} from "./chunk-QFKYT4JK.mjs";
|
|
26
|
-
import {
|
|
27
|
-
DECK_PLUGIN
|
|
28
|
-
} from "./chunk-HHG6H2BX.mjs";
|
|
29
|
-
|
|
30
|
-
// src/components/DeckLayout/Banner.tsx
|
|
31
|
-
import { useSignals as _useSignals9 } from "@preact-signals/safe-react/tracking";
|
|
32
|
-
import React9 from "react";
|
|
33
|
-
import { Surface as Surface5 } from "@dxos/app-framework";
|
|
34
|
-
import { useTranslation as useTranslation6 } from "@dxos/react-ui";
|
|
35
|
-
import { mx as mx4 } from "@dxos/react-ui-theme";
|
|
36
|
-
|
|
37
|
-
// src/components/Sidebar/ComplementarySidebar.tsx
|
|
38
|
-
import { useSignals as _useSignals7 } from "@preact-signals/safe-react/tracking";
|
|
39
|
-
import React7, { Fragment as Fragment2, useCallback as useCallback5, useEffect as useEffect3, useMemo as useMemo3, useState as useState2 } from "react";
|
|
40
|
-
import { LayoutAction as LayoutAction4, Surface as Surface3, createIntent as createIntent5, useCapability as useCapability3, useIntentDispatcher as useIntentDispatcher5 } from "@dxos/app-framework";
|
|
41
|
-
import { Main, useTranslation as useTranslation5, toLocalizedString as toLocalizedString2, IconButton as IconButton4 } from "@dxos/react-ui";
|
|
42
|
-
import { Tabs } from "@dxos/react-ui-tabs";
|
|
43
|
-
|
|
44
|
-
// src/components/Sidebar/SidebarButton.tsx
|
|
45
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
46
|
-
import React, { useCallback } from "react";
|
|
47
|
-
import { createIntent, LayoutAction, useCapability, useIntentDispatcher } from "@dxos/app-framework";
|
|
48
|
-
import { IconButton, useTranslation } from "@dxos/react-ui";
|
|
49
|
-
var ToggleSidebarButton = ({ classNames, variant = "ghost" }) => {
|
|
50
|
-
var _effect = _useSignals();
|
|
51
|
-
try {
|
|
52
|
-
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
53
|
-
const { t } = useTranslation(DECK_PLUGIN);
|
|
54
|
-
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
55
|
-
variant,
|
|
56
|
-
iconOnly: true,
|
|
57
|
-
icon: "ph--sidebar--regular",
|
|
58
|
-
size: 4,
|
|
59
|
-
label: t("open navigation sidebar label"),
|
|
60
|
-
onClick: () => layoutContext.sidebarState = layoutContext.sidebarState === "expanded" ? "collapsed" : "expanded",
|
|
61
|
-
classNames
|
|
62
|
-
});
|
|
63
|
-
} finally {
|
|
64
|
-
_effect.f();
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
var CloseSidebarButton = () => {
|
|
68
|
-
var _effect = _useSignals();
|
|
69
|
-
try {
|
|
70
|
-
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
71
|
-
const { t } = useTranslation(DECK_PLUGIN);
|
|
72
|
-
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
73
|
-
variant: "ghost",
|
|
74
|
-
iconOnly: true,
|
|
75
|
-
icon: "ph--caret-line-left--regular",
|
|
76
|
-
size: 4,
|
|
77
|
-
label: t("close navigation sidebar label"),
|
|
78
|
-
onClick: () => layoutContext.sidebarState = "collapsed",
|
|
79
|
-
classNames: "rounded-none pli-1 dx-focus-ring-inset pie-[max(.5rem,env(safe-area-inset-left))]"
|
|
80
|
-
});
|
|
81
|
-
} finally {
|
|
82
|
-
_effect.f();
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
var ToggleComplementarySidebarButton = ({ inR0, classNames, current }) => {
|
|
86
|
-
var _effect = _useSignals();
|
|
87
|
-
try {
|
|
88
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
89
|
-
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
90
|
-
const { t } = useTranslation(DECK_PLUGIN);
|
|
91
|
-
const companions = useDeckCompanions();
|
|
92
|
-
const handleClick = useCallback(async () => {
|
|
93
|
-
layoutContext.complementarySidebarState = layoutContext.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
|
|
94
|
-
const firstCompanion = companions[0];
|
|
95
|
-
if (layoutContext.complementarySidebarState === "expanded" && !current && firstCompanion) {
|
|
96
|
-
await dispatch(createIntent(LayoutAction.UpdateComplementary, {
|
|
97
|
-
part: "complementary",
|
|
98
|
-
subject: getCompanionId(firstCompanion.id)
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
}, [
|
|
102
|
-
layoutContext,
|
|
103
|
-
current,
|
|
104
|
-
companions,
|
|
105
|
-
dispatch
|
|
106
|
-
]);
|
|
107
|
-
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
108
|
-
iconOnly: true,
|
|
109
|
-
onClick: handleClick,
|
|
110
|
-
variant: "ghost",
|
|
111
|
-
label: t("open complementary sidebar label"),
|
|
112
|
-
classNames: [
|
|
113
|
-
"[&>svg]:-scale-x-100",
|
|
114
|
-
classNames
|
|
115
|
-
],
|
|
116
|
-
icon: "ph--sidebar-simple--regular",
|
|
117
|
-
size: inR0 ? 5 : 4,
|
|
118
|
-
tooltipSide: inR0 ? "left" : void 0
|
|
119
|
-
});
|
|
120
|
-
} finally {
|
|
121
|
-
_effect.f();
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
// src/components/Plank/Plank.tsx
|
|
126
|
-
import { useSignals as _useSignals6 } from "@preact-signals/safe-react/tracking";
|
|
127
|
-
import React6, { memo as memo2, useCallback as useCallback4, useLayoutEffect, useMemo as useMemo2, useRef } from "react";
|
|
128
|
-
import { LayoutAction as LayoutAction3, Surface as Surface2, createIntent as createIntent4, useCapability as useCapability2, useAppGraph as useAppGraph2, useIntentDispatcher as useIntentDispatcher4 } from "@dxos/app-framework";
|
|
129
|
-
import { debounce } from "@dxos/async";
|
|
130
|
-
import { useNode } from "@dxos/plugin-graph";
|
|
131
|
-
import { ATTENDABLE_PATH_SEPARATOR, useAttentionAttributes } from "@dxos/react-ui-attention";
|
|
132
|
-
import { StackItem as StackItem2, railGridHorizontal } from "@dxos/react-ui-stack";
|
|
133
|
-
import { mainIntrinsicSize, mx as mx3 } from "@dxos/react-ui-theme";
|
|
134
|
-
|
|
135
|
-
// src/components/Plank/PlankError.tsx
|
|
136
|
-
import { useSignals as _useSignals5 } from "@preact-signals/safe-react/tracking";
|
|
137
|
-
import React5, { useEffect as useEffect2, useState } from "react";
|
|
138
|
-
import { useTranslation as useTranslation4 } from "@dxos/react-ui";
|
|
139
|
-
import { descriptionMessage, mx as mx2 } from "@dxos/react-ui-theme";
|
|
140
|
-
|
|
141
|
-
// src/components/Plank/PlankHeading.tsx
|
|
142
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
143
|
-
import React3, { Fragment, memo, useCallback as useCallback3, useEffect, useMemo } from "react";
|
|
144
|
-
import { createIntent as createIntent3, LayoutAction as LayoutAction2, Surface, useAppGraph, useIntentDispatcher as useIntentDispatcher3 } from "@dxos/app-framework";
|
|
145
|
-
import { Icon, IconButton as IconButton3, Popover, toLocalizedString, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
146
|
-
import { StackItem } from "@dxos/react-ui-stack";
|
|
147
|
-
import { TextTooltip } from "@dxos/react-ui-text-tooltip";
|
|
148
|
-
import { hoverableControls, hoverableFocusedWithinControls } from "@dxos/react-ui-theme";
|
|
149
|
-
|
|
150
|
-
// src/components/Plank/PlankControls.tsx
|
|
151
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
152
|
-
import React2, { forwardRef, useCallback as useCallback2 } from "react";
|
|
153
|
-
import { createIntent as createIntent2, useIntentDispatcher as useIntentDispatcher2 } from "@dxos/app-framework";
|
|
154
|
-
import { invariant } from "@dxos/invariant";
|
|
155
|
-
import { ButtonGroup, IconButton as IconButton2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
156
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-deck/src/components/Plank/PlankControls.tsx";
|
|
157
|
-
var PlankControl = ({ icon, label: label3, ...props }) => {
|
|
158
|
-
var _effect = _useSignals2();
|
|
159
|
-
try {
|
|
160
|
-
return /* @__PURE__ */ React2.createElement(IconButton2, {
|
|
161
|
-
iconOnly: true,
|
|
162
|
-
label: label3,
|
|
163
|
-
icon,
|
|
164
|
-
size: 5,
|
|
165
|
-
variant: "ghost",
|
|
166
|
-
tooltipSide: "bottom",
|
|
167
|
-
...props
|
|
168
|
-
});
|
|
169
|
-
} finally {
|
|
170
|
-
_effect.f();
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
var plankControlSpacing = "pli-2";
|
|
174
|
-
var PlankCompanionControls = /* @__PURE__ */ forwardRef(({ primary }, forwardedRef) => {
|
|
175
|
-
var _effect = _useSignals2();
|
|
176
|
-
try {
|
|
177
|
-
const { t } = useTranslation2(DECK_PLUGIN);
|
|
178
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher2();
|
|
179
|
-
const handleCloseCompanion = useCallback2(() => {
|
|
180
|
-
invariant(primary, void 0, {
|
|
181
|
-
F: __dxlog_file,
|
|
182
|
-
L: 49,
|
|
183
|
-
S: void 0,
|
|
184
|
-
A: [
|
|
185
|
-
"primary",
|
|
186
|
-
""
|
|
187
|
-
]
|
|
188
|
-
});
|
|
189
|
-
return dispatch(createIntent2(DeckAction.ChangeCompanion, {
|
|
190
|
-
primary,
|
|
191
|
-
companion: null
|
|
192
|
-
}));
|
|
193
|
-
}, []);
|
|
194
|
-
return /* @__PURE__ */ React2.createElement("div", {
|
|
195
|
-
ref: forwardedRef,
|
|
196
|
-
className: "contents app-no-drag"
|
|
197
|
-
}, /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
198
|
-
label: t("close companion label"),
|
|
199
|
-
variant: "ghost",
|
|
200
|
-
icon: "ph--x--regular",
|
|
201
|
-
onClick: handleCloseCompanion,
|
|
202
|
-
classNames: plankControlSpacing
|
|
203
|
-
}));
|
|
204
|
-
} finally {
|
|
205
|
-
_effect.f();
|
|
206
|
-
}
|
|
207
|
-
});
|
|
208
|
-
var PlankControls = /* @__PURE__ */ forwardRef(({ children, classNames, variant = "default", capabilities, layoutMode, pin, close = false, onClick, ...props }, forwardedRef) => {
|
|
209
|
-
var _effect = _useSignals2();
|
|
210
|
-
try {
|
|
211
|
-
const { t } = useTranslation2(DECK_PLUGIN);
|
|
212
|
-
const buttonClassNames = variant === "hide-disabled" ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
|
|
213
|
-
const layoutIsAnySolo = !!layoutMode?.startsWith("solo");
|
|
214
|
-
return /* @__PURE__ */ React2.createElement(ButtonGroup, {
|
|
215
|
-
...props,
|
|
216
|
-
classNames: [
|
|
217
|
-
"app-no-drag !opacity-100",
|
|
218
|
-
classNames
|
|
219
|
-
],
|
|
220
|
-
ref: forwardedRef
|
|
221
|
-
}, capabilities.deck ? /* @__PURE__ */ React2.createElement(React2.Fragment, null, capabilities.solo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, layoutMode === "solo" && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
222
|
-
label: t("show fullscreen plank label"),
|
|
223
|
-
classNames: buttonClassNames,
|
|
224
|
-
icon: "ph--corners-out--regular",
|
|
225
|
-
onClick: () => onClick?.("solo--fullscreen")
|
|
226
|
-
}), /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
227
|
-
label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : layoutIsAnySolo ? "show deck plank label" : "show solo plank label"),
|
|
228
|
-
classNames: buttonClassNames,
|
|
229
|
-
icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : layoutIsAnySolo ? "ph--arrows-in-line-horizontal--regular" : "ph--arrows-out-line-horizontal--regular",
|
|
230
|
-
onClick: () => onClick?.(layoutMode === "solo--fullscreen" ? "solo--fullscreen" : "solo")
|
|
231
|
-
})), !layoutIsAnySolo && /* @__PURE__ */ React2.createElement(React2.Fragment, null, /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
232
|
-
label: t("increment start label"),
|
|
233
|
-
disabled: !capabilities.incrementStart,
|
|
234
|
-
classNames: buttonClassNames,
|
|
235
|
-
icon: "ph--caret-left--regular",
|
|
236
|
-
onClick: () => onClick?.("increment-start")
|
|
237
|
-
}), /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
238
|
-
label: t("increment end label"),
|
|
239
|
-
disabled: !capabilities.incrementEnd,
|
|
240
|
-
classNames: buttonClassNames,
|
|
241
|
-
icon: "ph--caret-right--regular",
|
|
242
|
-
onClick: () => onClick?.("increment-end")
|
|
243
|
-
}))) : capabilities.fullscreen && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
244
|
-
label: t(layoutMode === "solo--fullscreen" ? "exit fullscreen label" : "show fullscreen plank label"),
|
|
245
|
-
classNames: buttonClassNames,
|
|
246
|
-
icon: layoutMode === "solo--fullscreen" ? "ph--corners-in--regular" : "ph--corners-out--regular",
|
|
247
|
-
onClick: () => onClick?.("solo--fullscreen")
|
|
248
|
-
}), close && !layoutIsAnySolo && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
249
|
-
label: t(`${typeof close === "string" ? "minify" : "close"} label`),
|
|
250
|
-
classNames: buttonClassNames,
|
|
251
|
-
"data-testid": "plankHeading.close",
|
|
252
|
-
icon: close === "minify-start" ? "ph--caret-line-left--regular" : close === "minify-end" ? "ph--caret-line-right--regular" : "ph--x--regular",
|
|
253
|
-
onClick: () => onClick?.("close")
|
|
254
|
-
}), capabilities.companion && /* @__PURE__ */ React2.createElement(PlankControl, {
|
|
255
|
-
label: t("open companion label"),
|
|
256
|
-
classNames: buttonClassNames,
|
|
257
|
-
"data-testid": "plankHeading.companion",
|
|
258
|
-
icon: "ph--square-split-horizontal--regular",
|
|
259
|
-
onClick: () => onClick?.("companion")
|
|
260
|
-
}), children);
|
|
261
|
-
} finally {
|
|
262
|
-
_effect.f();
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
// src/components/fragments.ts
|
|
267
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
268
|
-
var soloInlinePadding = "pis-[calc(env(safe-area-inset-left)+.25rem)] pie-[calc(env(safe-area-inset-left)+.25rem)]";
|
|
269
|
-
var sidebarToggleStyles = "bs-[--rail-item] is-[--rail-item] absolute block-end-2 z-[1] !bg-deckSurface lg:hidden";
|
|
270
|
-
var fixedSidebarToggleStyles = mx(sidebarToggleStyles, "inline-start-2");
|
|
271
|
-
var fixedComplementarySidebarToggleStyles = mx(sidebarToggleStyles, "inline-end-2");
|
|
272
|
-
|
|
273
|
-
// src/components/Plank/PlankHeading.tsx
|
|
274
|
-
var MAX_COMPANIONS = 5;
|
|
275
|
-
var PlankHeading = /* @__PURE__ */ memo(({ id, part, node, deckEnabled, canIncrementStart, canIncrementEnd, popoverAnchorId, primaryId, pending, companioned, companions, layoutMode, actions = [] }) => {
|
|
276
|
-
var _effect = _useSignals3();
|
|
277
|
-
try {
|
|
278
|
-
const { t } = useTranslation3(DECK_PLUGIN);
|
|
279
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher3();
|
|
280
|
-
const { graph } = useAppGraph();
|
|
281
|
-
const breakpoint = useBreakpoints();
|
|
282
|
-
const icon = node?.properties?.icon ?? "ph--placeholder--regular";
|
|
283
|
-
const label3 = pending ? t("pending heading") : toLocalizedString(node?.properties?.label ?? [
|
|
284
|
-
"plank heading fallback label",
|
|
285
|
-
{
|
|
286
|
-
ns: DECK_PLUGIN
|
|
287
|
-
}
|
|
288
|
-
], t);
|
|
289
|
-
const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
|
|
290
|
-
useEffect(() => {
|
|
291
|
-
const frame = requestAnimationFrame(() => {
|
|
292
|
-
if (node) {
|
|
293
|
-
void graph.expand(node.id);
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
return () => cancelAnimationFrame(frame);
|
|
297
|
-
}, [
|
|
298
|
-
node
|
|
299
|
-
]);
|
|
300
|
-
const attendableId = primaryId ?? id;
|
|
301
|
-
const capabilities = useMemo(() => ({
|
|
302
|
-
deck: deckEnabled ?? true,
|
|
303
|
-
solo: breakpoint !== "mobile" && (part === "solo" || part === "deck"),
|
|
304
|
-
incrementStart: canIncrementStart,
|
|
305
|
-
incrementEnd: canIncrementEnd,
|
|
306
|
-
fullscreen: !isCompanionNode,
|
|
307
|
-
companion: !isCompanionNode && companions && companions.length > 0
|
|
308
|
-
}), [
|
|
309
|
-
breakpoint,
|
|
310
|
-
part,
|
|
311
|
-
companions,
|
|
312
|
-
canIncrementStart,
|
|
313
|
-
canIncrementEnd,
|
|
314
|
-
isCompanionNode,
|
|
315
|
-
deckEnabled
|
|
316
|
-
]);
|
|
317
|
-
const { variant } = parseEntryId(id);
|
|
318
|
-
const sigilActions = useMemo(() => {
|
|
319
|
-
if (!node) {
|
|
320
|
-
return void 0;
|
|
321
|
-
} else if (variant) {
|
|
322
|
-
return [];
|
|
323
|
-
} else {
|
|
324
|
-
return [
|
|
325
|
-
actions,
|
|
326
|
-
graph.getActions(node.id).filter((a) => [
|
|
327
|
-
"list-item",
|
|
328
|
-
"list-item-primary",
|
|
329
|
-
"heading-list-item"
|
|
330
|
-
].includes(a.properties.disposition))
|
|
331
|
-
].filter((a) => a.length > 0);
|
|
332
|
-
}
|
|
333
|
-
}, [
|
|
334
|
-
actions,
|
|
335
|
-
node,
|
|
336
|
-
variant,
|
|
337
|
-
graph
|
|
338
|
-
]);
|
|
339
|
-
const handleAction = useCallback3((action) => {
|
|
340
|
-
typeof action.data === "function" && action.data?.({
|
|
341
|
-
parent: node,
|
|
342
|
-
caller: DECK_PLUGIN
|
|
343
|
-
});
|
|
344
|
-
}, [
|
|
345
|
-
node
|
|
346
|
-
]);
|
|
347
|
-
const handlePlankAction = useCallback3((eventType) => {
|
|
348
|
-
if (eventType.startsWith("solo")) {
|
|
349
|
-
return dispatch(createIntent3(DeckAction.Adjust, {
|
|
350
|
-
type: eventType,
|
|
351
|
-
id
|
|
352
|
-
}));
|
|
353
|
-
} else if (eventType === "close") {
|
|
354
|
-
if (part === "complementary") {
|
|
355
|
-
return dispatch(createIntent3(LayoutAction2.UpdateComplementary, {
|
|
356
|
-
part: "complementary",
|
|
357
|
-
options: {
|
|
358
|
-
state: "collapsed"
|
|
359
|
-
}
|
|
360
|
-
}));
|
|
361
|
-
} else {
|
|
362
|
-
return dispatch(createIntent3(LayoutAction2.Close, {
|
|
363
|
-
part: "main",
|
|
364
|
-
subject: [
|
|
365
|
-
id
|
|
366
|
-
],
|
|
367
|
-
options: {
|
|
368
|
-
state: false
|
|
369
|
-
}
|
|
370
|
-
}));
|
|
371
|
-
}
|
|
372
|
-
} else {
|
|
373
|
-
return dispatch(createIntent3(DeckAction.Adjust, {
|
|
374
|
-
type: eventType,
|
|
375
|
-
id
|
|
376
|
-
}));
|
|
377
|
-
}
|
|
378
|
-
}, [
|
|
379
|
-
dispatch,
|
|
380
|
-
id,
|
|
381
|
-
part
|
|
382
|
-
]);
|
|
383
|
-
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${DECK_PLUGIN}/${node.id}` ? Popover.Anchor : Fragment;
|
|
384
|
-
const handleTabClick = useCallback3((event) => {
|
|
385
|
-
const target = event.target.closest("[data-id]");
|
|
386
|
-
const tabId = target?.dataset?.id;
|
|
387
|
-
if (primaryId && tabId) {
|
|
388
|
-
void dispatch(createIntent3(DeckAction.ChangeCompanion, {
|
|
389
|
-
primary: primaryId,
|
|
390
|
-
companion: tabId
|
|
391
|
-
}));
|
|
392
|
-
}
|
|
393
|
-
}, [
|
|
394
|
-
primaryId
|
|
395
|
-
]);
|
|
396
|
-
return /* @__PURE__ */ React3.createElement(StackItem.Heading, {
|
|
397
|
-
classNames: [
|
|
398
|
-
"plb-1 items-stretch gap-1 sticky inline-start-12 app-drag min-is-0 contain-layout density-coarse",
|
|
399
|
-
part === "solo" ? soloInlinePadding : "pli-1",
|
|
400
|
-
...layoutMode === "solo--fullscreen" ? [
|
|
401
|
-
hoverableControls,
|
|
402
|
-
hoverableFocusedWithinControls,
|
|
403
|
-
"*:transition-opacity *:opacity-[--controls-opacity] bg-transparent border-transparent transition-[background-color,border-color] hover-hover:hover:bg-headerSurface focus-within:bg-headerSurface hover-hover:hover:border-subduedSeparator focus-within:border-subduedSeparator"
|
|
404
|
-
] : []
|
|
405
|
-
],
|
|
406
|
-
"data-plank-heading": true
|
|
407
|
-
}, companions && isCompanionNode ? (
|
|
408
|
-
/* TODO(thure): IMPORTANT: This is a tablist; it should be implemented as such. */
|
|
409
|
-
/* @__PURE__ */ React3.createElement("div", {
|
|
410
|
-
role: "none",
|
|
411
|
-
className: "flex-1 min-is-0 overflow-x-auto scrollbar-none flex gap-1"
|
|
412
|
-
}, companions.map(({ id: id2, properties: { icon: icon2, label: label4 } }) => /* @__PURE__ */ React3.createElement(IconButton3, {
|
|
413
|
-
key: id2,
|
|
414
|
-
"data-id": id2,
|
|
415
|
-
icon: icon2,
|
|
416
|
-
iconOnly: companions.length > MAX_COMPANIONS && node?.id !== id2,
|
|
417
|
-
label: toLocalizedString(label4, t),
|
|
418
|
-
size: 5,
|
|
419
|
-
variant: node?.id === id2 ? "primary" : "ghost",
|
|
420
|
-
onClick: handleTabClick
|
|
421
|
-
})))
|
|
422
|
-
) : /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(ActionRoot, null, node && sigilActions ? /* @__PURE__ */ React3.createElement(StackItem.Sigil, {
|
|
423
|
-
icon,
|
|
424
|
-
related: part === "complementary",
|
|
425
|
-
attendableId,
|
|
426
|
-
triggerLabel: t("actions menu label"),
|
|
427
|
-
actions: sigilActions,
|
|
428
|
-
onAction: handleAction
|
|
429
|
-
}, /* @__PURE__ */ React3.createElement(Surface, {
|
|
430
|
-
role: "menu-footer",
|
|
431
|
-
data: {
|
|
432
|
-
subject: node.data
|
|
433
|
-
}
|
|
434
|
-
})) : /* @__PURE__ */ React3.createElement(StackItem.SigilButton, null, /* @__PURE__ */ React3.createElement("span", {
|
|
435
|
-
className: "sr-only"
|
|
436
|
-
}, label3), /* @__PURE__ */ React3.createElement(Icon, {
|
|
437
|
-
icon,
|
|
438
|
-
size: 5
|
|
439
|
-
}))), /* @__PURE__ */ React3.createElement(TextTooltip, {
|
|
440
|
-
text: label3,
|
|
441
|
-
onlyWhenTruncating: true
|
|
442
|
-
}, /* @__PURE__ */ React3.createElement(StackItem.HeadingLabel, {
|
|
443
|
-
attendableId,
|
|
444
|
-
related: part === "complementary",
|
|
445
|
-
...pending && {
|
|
446
|
-
classNames: "text-description"
|
|
447
|
-
}
|
|
448
|
-
}, label3))), node && part !== "complementary" && /* @__PURE__ */ React3.createElement(Surface, {
|
|
449
|
-
role: "navbar-end",
|
|
450
|
-
data: {
|
|
451
|
-
subject: node.data
|
|
452
|
-
}
|
|
453
|
-
}), companioned === "companion" ? /* @__PURE__ */ React3.createElement(PlankCompanionControls, {
|
|
454
|
-
primary: primaryId
|
|
455
|
-
}) : /* @__PURE__ */ React3.createElement(PlankControls, {
|
|
456
|
-
capabilities,
|
|
457
|
-
layoutMode,
|
|
458
|
-
close: part === "complementary" ? "minify-end" : true,
|
|
459
|
-
onClick: handlePlankAction
|
|
460
|
-
}));
|
|
461
|
-
} finally {
|
|
462
|
-
_effect.f();
|
|
463
|
-
}
|
|
464
|
-
});
|
|
465
|
-
|
|
466
|
-
// src/components/Plank/PlankLoading.tsx
|
|
467
|
-
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
468
|
-
import React4 from "react";
|
|
469
|
-
var PlankLoading = () => {
|
|
470
|
-
var _effect = _useSignals4();
|
|
471
|
-
try {
|
|
472
|
-
return /* @__PURE__ */ React4.createElement("div", {
|
|
473
|
-
role: "none",
|
|
474
|
-
className: "grid place-items-center attention-surface"
|
|
475
|
-
});
|
|
476
|
-
} finally {
|
|
477
|
-
_effect.f();
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
// src/components/Plank/PlankError.tsx
|
|
482
|
-
var PlankContentError = ({ error }) => {
|
|
483
|
-
var _effect = _useSignals5();
|
|
484
|
-
try {
|
|
485
|
-
const { t } = useTranslation4(DECK_PLUGIN);
|
|
486
|
-
const errorString = error?.toString() ?? "";
|
|
487
|
-
return /* @__PURE__ */ React5.createElement("div", {
|
|
488
|
-
role: "none",
|
|
489
|
-
className: "overflow-auto p-8 attention-surface grid place-items-center"
|
|
490
|
-
}, /* @__PURE__ */ React5.createElement("p", {
|
|
491
|
-
role: "alert",
|
|
492
|
-
className: mx2(descriptionMessage, "break-words rounded-md p-8", errorString.length < 256 && "text-lg")
|
|
493
|
-
}, error ? errorString : t("error fallback message")));
|
|
494
|
-
} finally {
|
|
495
|
-
_effect.f();
|
|
496
|
-
}
|
|
497
|
-
};
|
|
498
|
-
var PlankError = ({ id, part, node, error }) => {
|
|
499
|
-
var _effect = _useSignals5();
|
|
500
|
-
try {
|
|
501
|
-
const [timedOut, setTimedOut] = useState(false);
|
|
502
|
-
useEffect2(() => {
|
|
503
|
-
setTimeout(() => setTimedOut(true), 5e3);
|
|
504
|
-
}, []);
|
|
505
|
-
return /* @__PURE__ */ React5.createElement(React5.Fragment, null, /* @__PURE__ */ React5.createElement(PlankHeading, {
|
|
506
|
-
id,
|
|
507
|
-
part,
|
|
508
|
-
node,
|
|
509
|
-
pending: !timedOut
|
|
510
|
-
}), timedOut ? /* @__PURE__ */ React5.createElement(PlankContentError, {
|
|
511
|
-
error
|
|
512
|
-
}) : /* @__PURE__ */ React5.createElement(PlankLoading, null));
|
|
513
|
-
} finally {
|
|
514
|
-
_effect.f();
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
|
|
518
|
-
// src/components/Plank/Plank.tsx
|
|
519
|
-
var UNKNOWN_ID = "unknown_id";
|
|
520
|
-
var Plank = /* @__PURE__ */ memo2(({ id = UNKNOWN_ID, companionId, ...props }) => {
|
|
521
|
-
var _effect = _useSignals6();
|
|
522
|
-
try {
|
|
523
|
-
const { graph } = useAppGraph2();
|
|
524
|
-
const node = useNode(graph, id);
|
|
525
|
-
const companions = useCompanions(id);
|
|
526
|
-
const currentCompanion = companions.find(({ id: id2 }) => id2 === companionId);
|
|
527
|
-
const hasCompanion = !!(companionId && currentCompanion);
|
|
528
|
-
return /* @__PURE__ */ React6.createElement(PlankContainer, {
|
|
529
|
-
solo: props.part === "solo",
|
|
530
|
-
companion: hasCompanion
|
|
531
|
-
}, /* @__PURE__ */ React6.createElement(PlankComponent, {
|
|
532
|
-
id,
|
|
533
|
-
node,
|
|
534
|
-
companioned: hasCompanion ? "primary" : void 0,
|
|
535
|
-
companions: hasCompanion ? [] : companions,
|
|
536
|
-
...props,
|
|
537
|
-
...props.part === "solo" ? {
|
|
538
|
-
part: "solo-primary"
|
|
539
|
-
} : {}
|
|
540
|
-
}), hasCompanion && /* @__PURE__ */ React6.createElement(PlankComponent, {
|
|
541
|
-
id: companionId,
|
|
542
|
-
node: currentCompanion,
|
|
543
|
-
primary: node,
|
|
544
|
-
companions,
|
|
545
|
-
companioned: "companion",
|
|
546
|
-
...props,
|
|
547
|
-
...props.part === "solo" ? {
|
|
548
|
-
part: "solo-companion"
|
|
549
|
-
} : {
|
|
550
|
-
order: (props.order ?? 0) + 1
|
|
551
|
-
}
|
|
552
|
-
}));
|
|
553
|
-
} finally {
|
|
554
|
-
_effect.f();
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
var PlankContainer = ({ children, solo, companion }) => {
|
|
558
|
-
var _effect = _useSignals6();
|
|
559
|
-
try {
|
|
560
|
-
const sizeAttrs = useMainSize();
|
|
561
|
-
if (!solo) {
|
|
562
|
-
return children;
|
|
563
|
-
}
|
|
564
|
-
return /* @__PURE__ */ React6.createElement("div", {
|
|
565
|
-
role: "none",
|
|
566
|
-
className: mx3("absolute inset-0 grid", companion && "grid-cols-[1fr_1fr]", railGridHorizontal, mainIntrinsicSize),
|
|
567
|
-
...sizeAttrs
|
|
568
|
-
}, children);
|
|
569
|
-
} finally {
|
|
570
|
-
_effect.f();
|
|
571
|
-
}
|
|
572
|
-
};
|
|
573
|
-
var PlankComponent = /* @__PURE__ */ memo2(({ layoutMode, id, part, path, order, active, companioned, node, primary, companions, settings }) => {
|
|
574
|
-
var _effect = _useSignals6();
|
|
575
|
-
try {
|
|
576
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher4();
|
|
577
|
-
const { deck, popoverAnchorId, scrollIntoView } = useCapability2(DeckCapabilities.DeckState);
|
|
578
|
-
const canResize = layoutMode === "deck";
|
|
579
|
-
const attentionAttrs = useAttentionAttributes(primary?.id ?? id);
|
|
580
|
-
const index = active ? active.findIndex((entryId) => entryId === id) : 0;
|
|
581
|
-
const length = active?.length ?? 1;
|
|
582
|
-
const canIncrementStart = active && index !== void 0 && index > 0 && length !== void 0 && length > 1;
|
|
583
|
-
const canIncrementEnd = active && index !== void 0 && index < length - 1 && length !== void 0;
|
|
584
|
-
const rootElement = useRef(null);
|
|
585
|
-
const { variant } = parseEntryId(id);
|
|
586
|
-
const sizeKey = `${id.split("+")[0]}${variant ? `${ATTENDABLE_PATH_SEPARATOR}${variant}` : ""}`;
|
|
587
|
-
const size = deck.plankSizing[sizeKey];
|
|
588
|
-
const handleSizeChange = useCallback4(debounce((nextSize) => {
|
|
589
|
-
return dispatch(createIntent4(DeckAction.UpdatePlankSize, {
|
|
590
|
-
id: sizeKey,
|
|
591
|
-
size: nextSize
|
|
592
|
-
}));
|
|
593
|
-
}, 200), [
|
|
594
|
-
dispatch,
|
|
595
|
-
sizeKey
|
|
596
|
-
]);
|
|
597
|
-
const handleKeyDown = useCallback4((event) => {
|
|
598
|
-
if (event.target === event.currentTarget && event.key === "Escape") {
|
|
599
|
-
rootElement.current?.closest("main")?.focus();
|
|
600
|
-
}
|
|
601
|
-
}, []);
|
|
602
|
-
useLayoutEffect(() => {
|
|
603
|
-
if (scrollIntoView === id) {
|
|
604
|
-
const focusable = rootElement.current?.querySelector("button") || rootElement.current;
|
|
605
|
-
focusable?.focus({
|
|
606
|
-
preventScroll: true
|
|
607
|
-
});
|
|
608
|
-
layoutMode === "deck" && focusable?.scrollIntoView({
|
|
609
|
-
behavior: "smooth",
|
|
610
|
-
inline: "center"
|
|
611
|
-
});
|
|
612
|
-
void dispatch(createIntent4(LayoutAction3.ScrollIntoView, {
|
|
613
|
-
part: "current",
|
|
614
|
-
subject: void 0
|
|
615
|
-
}));
|
|
616
|
-
}
|
|
617
|
-
}, [
|
|
618
|
-
id,
|
|
619
|
-
scrollIntoView,
|
|
620
|
-
layoutMode
|
|
621
|
-
]);
|
|
622
|
-
const isSolo = layoutMode.startsWith("solo") && part === "solo";
|
|
623
|
-
const isAttendable = layoutMode.startsWith("solo") && part.startsWith("solo") || layoutMode === "deck" && part === "deck";
|
|
624
|
-
const sizeAttrs = useMainSize();
|
|
625
|
-
const data = useMemo2(() => node && {
|
|
626
|
-
subject: node.data,
|
|
627
|
-
companionTo: primary?.data,
|
|
628
|
-
variant,
|
|
629
|
-
path,
|
|
630
|
-
popoverAnchorId
|
|
631
|
-
}, [
|
|
632
|
-
node,
|
|
633
|
-
node?.data,
|
|
634
|
-
path,
|
|
635
|
-
popoverAnchorId,
|
|
636
|
-
primary?.data,
|
|
637
|
-
variant
|
|
638
|
-
]);
|
|
639
|
-
const placeholder = useMemo2(() => /* @__PURE__ */ React6.createElement(PlankLoading, null), []);
|
|
640
|
-
const Root = part.startsWith("solo") ? "article" : StackItem2.Root;
|
|
641
|
-
const className = mx3("attention-surface relative dx-focus-ring-inset-over-all density-coarse", isSolo && mainIntrinsicSize, isSolo && railGridHorizontal, isSolo && "absolute inset-0", part.startsWith("solo") && "grid", part === "deck" && (companioned === "companion" ? "!border-separator border-ie" : "!border-separator border-li"), part.startsWith("solo-") && "row-span-2 grid-rows-subgrid min-is-0", part === "solo-companion" && "!border-separator border-is");
|
|
642
|
-
return /* @__PURE__ */ React6.createElement(Root, {
|
|
643
|
-
ref: rootElement,
|
|
644
|
-
"data-testid": "deck.plank",
|
|
645
|
-
tabIndex: 0,
|
|
646
|
-
...part.startsWith("solo") ? {
|
|
647
|
-
...sizeAttrs,
|
|
648
|
-
className
|
|
649
|
-
} : {
|
|
650
|
-
item: {
|
|
651
|
-
id
|
|
652
|
-
},
|
|
653
|
-
size,
|
|
654
|
-
onSizeChange: handleSizeChange,
|
|
655
|
-
classNames: className,
|
|
656
|
-
order,
|
|
657
|
-
role: "article"
|
|
658
|
-
},
|
|
659
|
-
...isAttendable ? attentionAttrs : {},
|
|
660
|
-
onKeyDown: handleKeyDown
|
|
661
|
-
}, node ? /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(PlankHeading, {
|
|
662
|
-
id,
|
|
663
|
-
part: part.startsWith("solo-") ? "solo" : part,
|
|
664
|
-
node,
|
|
665
|
-
layoutMode,
|
|
666
|
-
deckEnabled: settings?.enableDeck,
|
|
667
|
-
canIncrementStart,
|
|
668
|
-
canIncrementEnd,
|
|
669
|
-
popoverAnchorId,
|
|
670
|
-
primaryId: primary?.id,
|
|
671
|
-
companioned,
|
|
672
|
-
companions
|
|
673
|
-
}), /* @__PURE__ */ React6.createElement(Surface2, {
|
|
674
|
-
key: node.id,
|
|
675
|
-
role: "article",
|
|
676
|
-
data,
|
|
677
|
-
limit: 1,
|
|
678
|
-
fallback: PlankContentError,
|
|
679
|
-
placeholder
|
|
680
|
-
})) : /* @__PURE__ */ React6.createElement(PlankError, {
|
|
681
|
-
id,
|
|
682
|
-
part
|
|
683
|
-
}), canResize && /* @__PURE__ */ React6.createElement(StackItem2.ResizeHandle, null));
|
|
684
|
-
} finally {
|
|
685
|
-
_effect.f();
|
|
686
|
-
}
|
|
687
|
-
});
|
|
688
|
-
|
|
689
|
-
// src/components/Sidebar/ComplementarySidebar.tsx
|
|
690
|
-
var label = [
|
|
691
|
-
"complementary sidebar title",
|
|
692
|
-
{
|
|
693
|
-
ns: DECK_PLUGIN
|
|
694
|
-
}
|
|
695
|
-
];
|
|
696
|
-
var ComplementarySidebar = ({ current }) => {
|
|
697
|
-
var _effect = _useSignals7();
|
|
698
|
-
try {
|
|
699
|
-
const { t } = useTranslation5(DECK_PLUGIN);
|
|
700
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher5();
|
|
701
|
-
const layout = useCapability3(DeckCapabilities.MutableDeckState);
|
|
702
|
-
const layoutMode = getMode(layout.deck);
|
|
703
|
-
const breakpoint = useBreakpoints();
|
|
704
|
-
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
705
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
706
|
-
const companions = useDeckCompanions();
|
|
707
|
-
const activeCompanion = companions.find((companion) => getCompanionId(companion.id) === current);
|
|
708
|
-
const activeId = activeCompanion && getCompanionId(activeCompanion.id);
|
|
709
|
-
const [internalValue, setInternalValue] = useState2(activeId);
|
|
710
|
-
useEffect3(() => {
|
|
711
|
-
setInternalValue(activeId);
|
|
712
|
-
}, [
|
|
713
|
-
activeId
|
|
714
|
-
]);
|
|
715
|
-
const handleTabClick = useCallback5((event) => {
|
|
716
|
-
const nextValue = event.currentTarget.getAttribute("data-value");
|
|
717
|
-
if (nextValue === activeId) {
|
|
718
|
-
layout.complementarySidebarState = layout.complementarySidebarState === "expanded" ? "collapsed" : "expanded";
|
|
719
|
-
} else {
|
|
720
|
-
setInternalValue(nextValue);
|
|
721
|
-
layout.complementarySidebarState = "expanded";
|
|
722
|
-
void dispatch(createIntent5(LayoutAction4.UpdateComplementary, {
|
|
723
|
-
part: "complementary",
|
|
724
|
-
subject: nextValue
|
|
725
|
-
}));
|
|
726
|
-
}
|
|
727
|
-
}, [
|
|
728
|
-
layout,
|
|
729
|
-
activeId,
|
|
730
|
-
dispatch
|
|
731
|
-
]);
|
|
732
|
-
const data = useMemo3(() => activeCompanion && {
|
|
733
|
-
id: activeCompanion.id,
|
|
734
|
-
subject: activeCompanion.data
|
|
735
|
-
}, [
|
|
736
|
-
activeCompanion?.id,
|
|
737
|
-
activeCompanion?.data
|
|
738
|
-
]);
|
|
739
|
-
useEffect3(() => {
|
|
740
|
-
if (!activeId) {
|
|
741
|
-
void dispatch(createIntent5(LayoutAction4.UpdateComplementary, {
|
|
742
|
-
part: "complementary",
|
|
743
|
-
options: {
|
|
744
|
-
state: "collapsed"
|
|
745
|
-
}
|
|
746
|
-
}));
|
|
747
|
-
}
|
|
748
|
-
}, [
|
|
749
|
-
activeId,
|
|
750
|
-
dispatch
|
|
751
|
-
]);
|
|
752
|
-
return /* @__PURE__ */ React7.createElement(Main.ComplementarySidebar, {
|
|
753
|
-
label,
|
|
754
|
-
classNames: [
|
|
755
|
-
topbar && "block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
756
|
-
hoistStatusbar && "block-end-[--statusbar-size]"
|
|
757
|
-
]
|
|
758
|
-
}, /* @__PURE__ */ React7.createElement(Tabs.Root, {
|
|
759
|
-
orientation: "vertical",
|
|
760
|
-
verticalVariant: "stateless",
|
|
761
|
-
value: internalValue,
|
|
762
|
-
classNames: "contents"
|
|
763
|
-
}, /* @__PURE__ */ React7.createElement("div", {
|
|
764
|
-
role: "none",
|
|
765
|
-
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-subduedSeparator grid grid-cols-1 grid-rows-[1fr_min-content] bg-baseSurface contain-layout app-drag"
|
|
766
|
-
}, /* @__PURE__ */ React7.createElement(Tabs.Tablist, {
|
|
767
|
-
classNames: "grid grid-cols-1 auto-rows-[--rail-action] p-1 gap-1 !overflow-y-auto"
|
|
768
|
-
}, companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tab, {
|
|
769
|
-
key: getCompanionId(companion.id),
|
|
770
|
-
value: getCompanionId(companion.id),
|
|
771
|
-
asChild: true
|
|
772
|
-
}, /* @__PURE__ */ React7.createElement(IconButton4, {
|
|
773
|
-
label: toLocalizedString2(companion.properties.label, t),
|
|
774
|
-
icon: companion.properties.icon,
|
|
775
|
-
size: 5,
|
|
776
|
-
iconOnly: true,
|
|
777
|
-
tooltipSide: "left",
|
|
778
|
-
"data-value": getCompanionId(companion.id),
|
|
779
|
-
variant: activeId === getCompanionId(companion.id) ? layout.complementarySidebarState === "expanded" ? "primary" : "default" : "ghost",
|
|
780
|
-
onClick: handleTabClick
|
|
781
|
-
})))), !hoistStatusbar && /* @__PURE__ */ React7.createElement("div", {
|
|
782
|
-
role: "none",
|
|
783
|
-
className: "grid grid-cols-1 auto-rows-[--rail-item] p-1 overflow-y-auto"
|
|
784
|
-
}, /* @__PURE__ */ React7.createElement(Surface3, {
|
|
785
|
-
role: "status-bar--r0-footer",
|
|
786
|
-
limit: 1
|
|
787
|
-
})), /* @__PURE__ */ React7.createElement("div", {
|
|
788
|
-
role: "none",
|
|
789
|
-
className: "hidden lg:grid grid-cols-1 auto-rows-[--rail-action] p-1"
|
|
790
|
-
}, /* @__PURE__ */ React7.createElement(ToggleComplementarySidebarButton, null))), activeId && companions.map((companion) => /* @__PURE__ */ React7.createElement(Tabs.Tabpanel, {
|
|
791
|
-
key: getCompanionId(companion.id),
|
|
792
|
-
value: getCompanionId(companion.id),
|
|
793
|
-
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)]',
|
|
794
|
-
...layout.complementarySidebarState !== "expanded" && {
|
|
795
|
-
inert: "true"
|
|
796
|
-
}
|
|
797
|
-
}, /* @__PURE__ */ React7.createElement(ComplementarySidebarPanel, {
|
|
798
|
-
companion,
|
|
799
|
-
activeId,
|
|
800
|
-
data,
|
|
801
|
-
hoistStatusbar
|
|
802
|
-
})))));
|
|
803
|
-
} finally {
|
|
804
|
-
_effect.f();
|
|
805
|
-
}
|
|
806
|
-
};
|
|
807
|
-
var ScrollArea = ({ children }) => {
|
|
808
|
-
var _effect = _useSignals7();
|
|
809
|
-
try {
|
|
810
|
-
return /* @__PURE__ */ React7.createElement("div", {
|
|
811
|
-
className: "flex flex-col grow overflow-x-hidden overflow-y-auto scrollbar-thin"
|
|
812
|
-
}, children);
|
|
813
|
-
} finally {
|
|
814
|
-
_effect.f();
|
|
815
|
-
}
|
|
816
|
-
};
|
|
817
|
-
var ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }) => {
|
|
818
|
-
var _effect = _useSignals7();
|
|
819
|
-
try {
|
|
820
|
-
const { t } = useTranslation5(DECK_PLUGIN);
|
|
821
|
-
if (getCompanionId(companion.id) !== activeId && !data) {
|
|
822
|
-
return null;
|
|
823
|
-
}
|
|
824
|
-
const Wrapper = companion.properties.fixed ? Fragment2 : ScrollArea;
|
|
825
|
-
return /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement("h2", {
|
|
826
|
-
className: "flex items-center pli-2 border-subduedSeparator border-be font-medium"
|
|
827
|
-
}, toLocalizedString2(companion.properties.label, t)), /* @__PURE__ */ React7.createElement(Wrapper, null, /* @__PURE__ */ React7.createElement(Surface3, {
|
|
828
|
-
role: `deck-companion--${getCompanionId(companion.id)}`,
|
|
829
|
-
data,
|
|
830
|
-
fallback: PlankContentError,
|
|
831
|
-
placeholder: /* @__PURE__ */ React7.createElement(PlankLoading, null)
|
|
832
|
-
})), !hoistStatusbar && /* @__PURE__ */ React7.createElement("div", {
|
|
833
|
-
role: "contentinfo",
|
|
834
|
-
className: "flex flex-wrap justify-center items-center border-bs border-subduedSeparator pbs-1 pbe-[max(env(safe-area-inset-bottom),0.25rem)]"
|
|
835
|
-
}, /* @__PURE__ */ React7.createElement(Surface3, {
|
|
836
|
-
role: "status-bar--r1-footer",
|
|
837
|
-
limit: 1
|
|
838
|
-
})));
|
|
839
|
-
} finally {
|
|
840
|
-
_effect.f();
|
|
841
|
-
}
|
|
842
|
-
};
|
|
843
|
-
|
|
844
|
-
// src/components/Sidebar/Sidebar.tsx
|
|
845
|
-
import { useSignals as _useSignals8 } from "@preact-signals/safe-react/tracking";
|
|
846
|
-
import React8, { useMemo as useMemo4 } from "react";
|
|
847
|
-
import { Surface as Surface4, useCapability as useCapability4 } from "@dxos/app-framework";
|
|
848
|
-
import { Main as Main2 } from "@dxos/react-ui";
|
|
849
|
-
var label2 = [
|
|
850
|
-
"sidebar title",
|
|
851
|
-
{
|
|
852
|
-
ns: DECK_PLUGIN
|
|
853
|
-
}
|
|
854
|
-
];
|
|
855
|
-
var Sidebar = () => {
|
|
856
|
-
var _effect = _useSignals8();
|
|
857
|
-
try {
|
|
858
|
-
const { popoverAnchorId, activeDeck: current, deck } = useCapability4(DeckCapabilities.DeckState);
|
|
859
|
-
const breakpoint = useBreakpoints();
|
|
860
|
-
const layoutMode = getMode(deck);
|
|
861
|
-
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
862
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
863
|
-
const navigationData = useMemo4(() => ({
|
|
864
|
-
popoverAnchorId,
|
|
865
|
-
topbar,
|
|
866
|
-
hoistStatusbar,
|
|
867
|
-
current
|
|
868
|
-
}), [
|
|
869
|
-
popoverAnchorId,
|
|
870
|
-
topbar,
|
|
871
|
-
hoistStatusbar,
|
|
872
|
-
current
|
|
873
|
-
]);
|
|
874
|
-
return /* @__PURE__ */ React8.createElement(Main2.NavigationSidebar, {
|
|
875
|
-
label: label2,
|
|
876
|
-
classNames: [
|
|
877
|
-
"grid",
|
|
878
|
-
topbar && "block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
879
|
-
hoistStatusbar && "block-end-[--statusbar-size]"
|
|
880
|
-
]
|
|
881
|
-
}, /* @__PURE__ */ React8.createElement(Surface4, {
|
|
882
|
-
role: "navigation",
|
|
883
|
-
data: navigationData,
|
|
884
|
-
limit: 1
|
|
885
|
-
}));
|
|
886
|
-
} finally {
|
|
887
|
-
_effect.f();
|
|
888
|
-
}
|
|
889
|
-
};
|
|
890
|
-
|
|
891
|
-
// src/components/DeckLayout/Banner.tsx
|
|
892
|
-
var Banner = ({ variant, classNames }) => {
|
|
893
|
-
var _effect = _useSignals9();
|
|
894
|
-
try {
|
|
895
|
-
const { t } = useTranslation6(DECK_PLUGIN);
|
|
896
|
-
return /* @__PURE__ */ React9.createElement("header", {
|
|
897
|
-
className: mx4("flex items-stretch relative plb-1 pis-1 pie-2", variant === "topbar" && "fixed inset-inline-0 block-start-[env(safe-area-inset-top)] bs-[--rail-size] border-be border-separator", classNames)
|
|
898
|
-
}, variant === "sidebar" ? /* @__PURE__ */ React9.createElement(CloseSidebarButton, null) : /* @__PURE__ */ React9.createElement(ToggleSidebarButton, null), /* @__PURE__ */ React9.createElement("span", {
|
|
899
|
-
className: "self-center grow mis-1"
|
|
900
|
-
}, t("current app name", {
|
|
901
|
-
ns: "appkit"
|
|
902
|
-
})), variant === "topbar" && /* @__PURE__ */ React9.createElement("div", {
|
|
903
|
-
role: "none",
|
|
904
|
-
className: "absolute inset-0 pointer-events-none"
|
|
905
|
-
}, /* @__PURE__ */ React9.createElement("div", {
|
|
906
|
-
role: "none",
|
|
907
|
-
className: "grid bs-full pointer-fine:p-1 max-is-md mli-auto pointer-events-auto"
|
|
908
|
-
}, /* @__PURE__ */ React9.createElement(Surface5, {
|
|
909
|
-
role: "search-input",
|
|
910
|
-
limit: 1
|
|
911
|
-
}))), /* @__PURE__ */ React9.createElement("span", {
|
|
912
|
-
role: "none",
|
|
913
|
-
className: "grow"
|
|
914
|
-
}), /* @__PURE__ */ React9.createElement(Surface5, {
|
|
915
|
-
role: "header-end",
|
|
916
|
-
limit: 1
|
|
917
|
-
}), /* @__PURE__ */ React9.createElement(Surface5, {
|
|
918
|
-
role: "notch-start",
|
|
919
|
-
limit: 1
|
|
920
|
-
}));
|
|
921
|
-
} finally {
|
|
922
|
-
_effect.f();
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
|
|
926
|
-
// src/components/DeckLayout/DeckLayout.tsx
|
|
927
|
-
import { useSignals as _useSignals17 } from "@preact-signals/safe-react/tracking";
|
|
928
|
-
import { untracked } from "@preact/signals-core";
|
|
929
|
-
import React17, { useCallback as useCallback7, useEffect as useEffect5, useMemo as useMemo6, useRef as useRef3, Fragment as Fragment3 } from "react";
|
|
930
|
-
import { Capabilities, LayoutAction as LayoutAction5, createIntent as createIntent6, useCapability as useCapability8, useIntentDispatcher as useIntentDispatcher6, usePluginManager } from "@dxos/app-framework";
|
|
931
|
-
import { AttentionCapabilities } from "@dxos/plugin-attention";
|
|
932
|
-
import { Main as Main3, useMediaQuery, useOnTransition } from "@dxos/react-ui";
|
|
933
|
-
import { Stack, StackContext, DEFAULT_HORIZONTAL_SIZE } from "@dxos/react-ui-stack";
|
|
934
|
-
import { mainPaddingTransitions } from "@dxos/react-ui-theme";
|
|
935
|
-
|
|
936
|
-
// src/components/DeckLayout/ActiveNode.tsx
|
|
937
|
-
import { useSignals as _useSignals10 } from "@preact-signals/safe-react/tracking";
|
|
938
|
-
import React10 from "react";
|
|
939
|
-
import { Surface as Surface6, useAppGraph as useAppGraph3 } from "@dxos/app-framework";
|
|
940
|
-
import { useNode as useNode2 } from "@dxos/plugin-graph";
|
|
941
|
-
import { useAttended } from "@dxos/react-ui-attention";
|
|
942
|
-
var ActiveNode = () => {
|
|
943
|
-
var _effect = _useSignals10();
|
|
944
|
-
try {
|
|
945
|
-
const [id] = useAttended();
|
|
946
|
-
const { graph } = useAppGraph3();
|
|
947
|
-
const activeNode = useNode2(graph, id);
|
|
948
|
-
useNodeActionExpander(activeNode);
|
|
949
|
-
return /* @__PURE__ */ React10.createElement("div", {
|
|
950
|
-
role: "none",
|
|
951
|
-
className: "sr-only"
|
|
952
|
-
}, /* @__PURE__ */ React10.createElement(Surface6, {
|
|
953
|
-
role: "document-title",
|
|
954
|
-
data: {
|
|
955
|
-
subject: activeNode
|
|
956
|
-
},
|
|
957
|
-
limit: 1
|
|
958
|
-
}));
|
|
959
|
-
} finally {
|
|
960
|
-
_effect.f();
|
|
961
|
-
}
|
|
962
|
-
};
|
|
963
|
-
|
|
964
|
-
// src/components/DeckLayout/ContentEmpty.tsx
|
|
965
|
-
import { useSignals as _useSignals11 } from "@preact-signals/safe-react/tracking";
|
|
966
|
-
import React11 from "react";
|
|
967
|
-
import { Surface as Surface7, useCapability as useCapability5 } from "@dxos/app-framework";
|
|
968
|
-
var ContentEmpty = () => {
|
|
969
|
-
var _effect = _useSignals11();
|
|
970
|
-
try {
|
|
971
|
-
const breakpoint = useBreakpoints();
|
|
972
|
-
const { deck } = useCapability5(DeckCapabilities.MutableDeckState);
|
|
973
|
-
const layoutMode = getMode(deck);
|
|
974
|
-
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
975
|
-
return /* @__PURE__ */ React11.createElement("div", {
|
|
976
|
-
role: "none",
|
|
977
|
-
className: "grid place-items-center p-8 relative bg-deckSurface",
|
|
978
|
-
"data-testid": "layoutPlugin.firstRunMessage"
|
|
979
|
-
}, /* @__PURE__ */ React11.createElement(Surface7, {
|
|
980
|
-
role: "keyshortcuts"
|
|
981
|
-
}), !topbar && /* @__PURE__ */ React11.createElement(ToggleSidebarButton, {
|
|
982
|
-
variant: "default",
|
|
983
|
-
classNames: fixedSidebarToggleStyles
|
|
984
|
-
}));
|
|
985
|
-
} finally {
|
|
986
|
-
_effect.f();
|
|
987
|
-
}
|
|
988
|
-
};
|
|
989
|
-
|
|
990
|
-
// src/components/DeckLayout/Dialog.tsx
|
|
991
|
-
import { useSignals as _useSignals12 } from "@preact-signals/safe-react/tracking";
|
|
992
|
-
import React12 from "react";
|
|
993
|
-
import { Surface as Surface8, useCapability as useCapability6 } from "@dxos/app-framework";
|
|
994
|
-
import { AlertDialog, Dialog as NaturalDialog } from "@dxos/react-ui";
|
|
995
|
-
var Dialog = () => {
|
|
996
|
-
var _effect = _useSignals12();
|
|
997
|
-
try {
|
|
998
|
-
const context = useCapability6(DeckCapabilities.MutableDeckState);
|
|
999
|
-
const { dialogOpen, dialogType, dialogBlockAlign, dialogOverlayClasses, dialogOverlayStyle, dialogContent } = context;
|
|
1000
|
-
const Root = dialogType === "alert" ? AlertDialog.Root : NaturalDialog.Root;
|
|
1001
|
-
const Overlay = dialogType === "alert" ? AlertDialog.Overlay : NaturalDialog.Overlay;
|
|
1002
|
-
return /* @__PURE__ */ React12.createElement(Root, {
|
|
1003
|
-
modal: dialogBlockAlign !== "end",
|
|
1004
|
-
open: dialogOpen,
|
|
1005
|
-
onOpenChange: (nextOpen) => context.dialogOpen = nextOpen
|
|
1006
|
-
}, dialogBlockAlign === "end" ? (
|
|
1007
|
-
// TODO(burdon): Placeholder creates a suspense boundary; replace with defaults.
|
|
1008
|
-
/* @__PURE__ */ React12.createElement(Surface8, {
|
|
1009
|
-
role: "dialog",
|
|
1010
|
-
data: dialogContent,
|
|
1011
|
-
limit: 1,
|
|
1012
|
-
fallback: PlankContentError,
|
|
1013
|
-
placeholder: /* @__PURE__ */ React12.createElement("div", null)
|
|
1014
|
-
})
|
|
1015
|
-
) : /* @__PURE__ */ React12.createElement(Overlay, {
|
|
1016
|
-
blockAlign: dialogBlockAlign,
|
|
1017
|
-
classNames: dialogOverlayClasses,
|
|
1018
|
-
style: dialogOverlayStyle
|
|
1019
|
-
}, /* @__PURE__ */ React12.createElement(Surface8, {
|
|
1020
|
-
role: "dialog",
|
|
1021
|
-
data: dialogContent,
|
|
1022
|
-
limit: 1,
|
|
1023
|
-
fallback: PlankContentError
|
|
1024
|
-
})));
|
|
1025
|
-
} finally {
|
|
1026
|
-
_effect.f();
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
|
|
1030
|
-
// src/components/DeckLayout/Popover.tsx
|
|
1031
|
-
import { useSignals as _useSignals13 } from "@preact-signals/safe-react/tracking";
|
|
1032
|
-
import { createContext } from "@radix-ui/react-context";
|
|
1033
|
-
import React13, { useCallback as useCallback6, useEffect as useEffect4, useMemo as useMemo5, useRef as useRef2, useState as useState3 } from "react";
|
|
1034
|
-
import { Surface as Surface9, useCapability as useCapability7 } from "@dxos/app-framework";
|
|
1035
|
-
import { Popover as Popover2 } from "@dxos/react-ui";
|
|
1036
|
-
var DEBOUNCE_DELAY = 40;
|
|
1037
|
-
var [DeckPopoverProvider, useDeckPopoverContext] = createContext("DeckPopover");
|
|
1038
|
-
var PopoverRoot = ({ children }) => {
|
|
1039
|
-
var _effect = _useSignals13();
|
|
1040
|
-
try {
|
|
1041
|
-
const layout = useCapability7(DeckCapabilities.MutableDeckState);
|
|
1042
|
-
const virtualRef = useRef2(null);
|
|
1043
|
-
const [virtualIter, setVirtualIter] = useState3(0);
|
|
1044
|
-
const [open, setOpen] = useState3(false);
|
|
1045
|
-
const debounceRef = useRef2(null);
|
|
1046
|
-
useEffect4(() => {
|
|
1047
|
-
setOpen(false);
|
|
1048
|
-
if (layout.popoverOpen) {
|
|
1049
|
-
if (debounceRef.current) {
|
|
1050
|
-
clearTimeout(debounceRef.current);
|
|
1051
|
-
}
|
|
1052
|
-
if (layout.popoverAnchor && virtualRef.current !== layout.popoverAnchor) {
|
|
1053
|
-
virtualRef.current = layout.popoverAnchor ?? null;
|
|
1054
|
-
setVirtualIter((iter) => iter + 1);
|
|
1055
|
-
}
|
|
1056
|
-
debounceRef.current = setTimeout(() => setOpen(true), DEBOUNCE_DELAY);
|
|
1057
|
-
}
|
|
1058
|
-
}, [
|
|
1059
|
-
layout.popoverOpen,
|
|
1060
|
-
layout.popoverAnchorId,
|
|
1061
|
-
layout.popoverAnchor,
|
|
1062
|
-
layout.popoverContent
|
|
1063
|
-
]);
|
|
1064
|
-
return /* @__PURE__ */ React13.createElement(DeckPopoverProvider, {
|
|
1065
|
-
setOpen
|
|
1066
|
-
}, /* @__PURE__ */ React13.createElement(Popover2.Root, {
|
|
1067
|
-
modal: false,
|
|
1068
|
-
open
|
|
1069
|
-
}, layout.popoverAnchor && /* @__PURE__ */ React13.createElement(Popover2.VirtualTrigger, {
|
|
1070
|
-
key: virtualIter,
|
|
1071
|
-
virtualRef
|
|
1072
|
-
}), children));
|
|
1073
|
-
} finally {
|
|
1074
|
-
_effect.f();
|
|
1075
|
-
}
|
|
1076
|
-
};
|
|
1077
|
-
var PopoverContent = () => {
|
|
1078
|
-
var _effect = _useSignals13();
|
|
1079
|
-
try {
|
|
1080
|
-
const layout = useCapability7(DeckCapabilities.MutableDeckState);
|
|
1081
|
-
const { setOpen } = useDeckPopoverContext("PopoverContent");
|
|
1082
|
-
const handleClose = useCallback6((event) => {
|
|
1083
|
-
if (
|
|
1084
|
-
// TODO(thure): CodeMirror should not focus itself when it updates.
|
|
1085
|
-
event.type === "dismissableLayer.focusOutside" && event.currentTarget?.classList.contains("cm-content")
|
|
1086
|
-
) {
|
|
1087
|
-
event.preventDefault();
|
|
1088
|
-
} else {
|
|
1089
|
-
setOpen(false);
|
|
1090
|
-
layout.popoverOpen = false;
|
|
1091
|
-
layout.popoverAnchor = void 0;
|
|
1092
|
-
layout.popoverAnchorId = void 0;
|
|
1093
|
-
layout.popoverSide = void 0;
|
|
1094
|
-
}
|
|
1095
|
-
}, [
|
|
1096
|
-
setOpen
|
|
1097
|
-
]);
|
|
1098
|
-
const collisionBoundaries = useMemo5(() => {
|
|
1099
|
-
const closest = layout.popoverAnchor?.closest("[data-popover-collision-boundary]");
|
|
1100
|
-
return closest ? [
|
|
1101
|
-
closest
|
|
1102
|
-
] : [];
|
|
1103
|
-
}, [
|
|
1104
|
-
layout.popoverAnchor
|
|
1105
|
-
]);
|
|
1106
|
-
return /* @__PURE__ */ React13.createElement(Popover2.Portal, null, /* @__PURE__ */ React13.createElement(Popover2.Content, {
|
|
1107
|
-
side: layout.popoverSide,
|
|
1108
|
-
onInteractOutside: handleClose,
|
|
1109
|
-
onEscapeKeyDown: handleClose,
|
|
1110
|
-
collisionBoundary: collisionBoundaries,
|
|
1111
|
-
sticky: "always",
|
|
1112
|
-
hideWhenDetached: true
|
|
1113
|
-
}, /* @__PURE__ */ React13.createElement(Popover2.Viewport, null, /* @__PURE__ */ React13.createElement(Surface9, {
|
|
1114
|
-
role: "popover",
|
|
1115
|
-
data: layout.popoverContent,
|
|
1116
|
-
limit: 1
|
|
1117
|
-
})), /* @__PURE__ */ React13.createElement(Popover2.Arrow, null)));
|
|
1118
|
-
} finally {
|
|
1119
|
-
_effect.f();
|
|
1120
|
-
}
|
|
1121
|
-
};
|
|
1122
|
-
|
|
1123
|
-
// src/components/DeckLayout/StatusBar.tsx
|
|
1124
|
-
import { useSignals as _useSignals14 } from "@preact-signals/safe-react/tracking";
|
|
1125
|
-
import React14 from "react";
|
|
1126
|
-
import { Surface as Surface10 } from "@dxos/app-framework";
|
|
1127
|
-
import { useLandmarkMover } from "@dxos/react-ui";
|
|
1128
|
-
var StatusBar = ({ showHints }) => {
|
|
1129
|
-
var _effect = _useSignals14();
|
|
1130
|
-
try {
|
|
1131
|
-
const mover = useLandmarkMover(void 0, "3");
|
|
1132
|
-
return /* @__PURE__ */ React14.createElement("div", {
|
|
1133
|
-
role: "contentinfo",
|
|
1134
|
-
className: "fixed block-end-0 inset-inline-0 bs-[--statusbar-size] border-bs border-separator z-[2] flex text-description",
|
|
1135
|
-
...mover
|
|
1136
|
-
}, showHints && /* @__PURE__ */ React14.createElement(Surface10, {
|
|
1137
|
-
role: "hints",
|
|
1138
|
-
limit: 1
|
|
1139
|
-
}), /* @__PURE__ */ React14.createElement(Surface10, {
|
|
1140
|
-
role: "status-bar",
|
|
1141
|
-
limit: 1
|
|
1142
|
-
}));
|
|
1143
|
-
} finally {
|
|
1144
|
-
_effect.f();
|
|
1145
|
-
}
|
|
1146
|
-
};
|
|
1147
|
-
|
|
1148
|
-
// src/components/DeckLayout/Toast.tsx
|
|
1149
|
-
import { useSignals as _useSignals15 } from "@preact-signals/safe-react/tracking";
|
|
1150
|
-
import React15 from "react";
|
|
1151
|
-
import { Button, Icon as Icon2, Toast as NaturalToast, toLocalizedString as toLocalizedString3, useTranslation as useTranslation7 } from "@dxos/react-ui";
|
|
1152
|
-
var Toast = ({ id, title, description, icon, duration, actionLabel, actionAlt, closeLabel, onAction, onOpenChange }) => {
|
|
1153
|
-
var _effect = _useSignals15();
|
|
1154
|
-
try {
|
|
1155
|
-
const { t } = useTranslation7(DECK_PLUGIN);
|
|
1156
|
-
return /* @__PURE__ */ React15.createElement(NaturalToast.Root, {
|
|
1157
|
-
"data-testid": id,
|
|
1158
|
-
defaultOpen: true,
|
|
1159
|
-
duration,
|
|
1160
|
-
onOpenChange
|
|
1161
|
-
}, /* @__PURE__ */ React15.createElement(NaturalToast.Body, null, /* @__PURE__ */ React15.createElement(NaturalToast.Title, {
|
|
1162
|
-
classNames: "items-center"
|
|
1163
|
-
}, icon && /* @__PURE__ */ React15.createElement(Icon2, {
|
|
1164
|
-
icon,
|
|
1165
|
-
size: 5,
|
|
1166
|
-
classNames: "inline mr-1"
|
|
1167
|
-
}), title && /* @__PURE__ */ React15.createElement("span", null, toLocalizedString3(title, t))), description && /* @__PURE__ */ React15.createElement(NaturalToast.Description, null, description && toLocalizedString3(description, t))), /* @__PURE__ */ React15.createElement(NaturalToast.Actions, null, onAction && actionAlt && actionLabel && /* @__PURE__ */ React15.createElement(NaturalToast.Action, {
|
|
1168
|
-
altText: toLocalizedString3(actionAlt, t),
|
|
1169
|
-
asChild: true
|
|
1170
|
-
}, /* @__PURE__ */ React15.createElement(Button, {
|
|
1171
|
-
"data-testid": "toast.action",
|
|
1172
|
-
variant: "primary",
|
|
1173
|
-
onClick: () => onAction?.()
|
|
1174
|
-
}, toLocalizedString3(actionLabel, t))), closeLabel && /* @__PURE__ */ React15.createElement(NaturalToast.Close, {
|
|
1175
|
-
asChild: true
|
|
1176
|
-
}, /* @__PURE__ */ React15.createElement(Button, {
|
|
1177
|
-
"data-testid": "toast.close"
|
|
1178
|
-
}, toLocalizedString3(closeLabel, t)))));
|
|
1179
|
-
} finally {
|
|
1180
|
-
_effect.f();
|
|
1181
|
-
}
|
|
1182
|
-
};
|
|
1183
|
-
|
|
1184
|
-
// src/components/DeckLayout/Topbar.tsx
|
|
1185
|
-
import { useSignals as _useSignals16 } from "@preact-signals/safe-react/tracking";
|
|
1186
|
-
import React16 from "react";
|
|
1187
|
-
var Topbar = () => {
|
|
1188
|
-
var _effect = _useSignals16();
|
|
1189
|
-
try {
|
|
1190
|
-
return /* @__PURE__ */ React16.createElement(Banner, {
|
|
1191
|
-
variant: "topbar"
|
|
1192
|
-
});
|
|
1193
|
-
} finally {
|
|
1194
|
-
_effect.f();
|
|
1195
|
-
}
|
|
1196
|
-
};
|
|
1197
|
-
|
|
1198
|
-
// src/components/DeckLayout/DeckLayout.tsx
|
|
1199
|
-
var PlankSeparator = ({ order }) => {
|
|
1200
|
-
var _effect = _useSignals17();
|
|
1201
|
-
try {
|
|
1202
|
-
return order > 0 ? /* @__PURE__ */ React17.createElement("span", {
|
|
1203
|
-
role: "separator",
|
|
1204
|
-
className: "row-span-2 bg-deckSurface is-4",
|
|
1205
|
-
style: {
|
|
1206
|
-
gridColumn: order
|
|
1207
|
-
}
|
|
1208
|
-
}) : null;
|
|
1209
|
-
} finally {
|
|
1210
|
-
_effect.f();
|
|
1211
|
-
}
|
|
1212
|
-
};
|
|
1213
|
-
var DeckLayout = ({ onDismissToast }) => {
|
|
1214
|
-
var _effect = _useSignals17();
|
|
1215
|
-
try {
|
|
1216
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher6();
|
|
1217
|
-
const settings = useCapability8(Capabilities.SettingsStore).getStore(DECK_PLUGIN).value;
|
|
1218
|
-
const context = useCapability8(DeckCapabilities.MutableDeckState);
|
|
1219
|
-
const { sidebarState, complementarySidebarState, complementarySidebarPanel, deck, toasts } = context;
|
|
1220
|
-
const { active, activeCompanions, fullscreen, solo, plankSizing } = deck;
|
|
1221
|
-
const breakpoint = useBreakpoints();
|
|
1222
|
-
const layoutMode = getMode(deck);
|
|
1223
|
-
const topbar = layoutAppliesTopbar(breakpoint, layoutMode);
|
|
1224
|
-
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
1225
|
-
const pluginManager = usePluginManager();
|
|
1226
|
-
const scrollLeftRef = useRef3();
|
|
1227
|
-
const deckRef = useRef3(null);
|
|
1228
|
-
useEffect5(() => {
|
|
1229
|
-
const attended = untracked(() => {
|
|
1230
|
-
const attention = pluginManager.context.getCapability(AttentionCapabilities.Attention);
|
|
1231
|
-
return attention.current;
|
|
1232
|
-
});
|
|
1233
|
-
const firstId = solo ?? active[0];
|
|
1234
|
-
if (attended.length === 0 && firstId) {
|
|
1235
|
-
document.querySelector(`article[data-attendable-id="${firstId}"] button`)?.focus();
|
|
1236
|
-
}
|
|
1237
|
-
}, []);
|
|
1238
|
-
const [isNotMobile] = useMediaQuery("md", {
|
|
1239
|
-
ssr: false
|
|
1240
|
-
});
|
|
1241
|
-
const shouldRevert = useRef3(false);
|
|
1242
|
-
useEffect5(() => {
|
|
1243
|
-
if (!isNotMobile && getMode(deck) === "deck") {
|
|
1244
|
-
const attended = untracked(() => {
|
|
1245
|
-
const attention = pluginManager.context.getCapability(AttentionCapabilities.Attention);
|
|
1246
|
-
return attention.current;
|
|
1247
|
-
});
|
|
1248
|
-
shouldRevert.current = true;
|
|
1249
|
-
void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
|
|
1250
|
-
part: "mode",
|
|
1251
|
-
subject: attended[0],
|
|
1252
|
-
options: {
|
|
1253
|
-
mode: "solo"
|
|
1254
|
-
}
|
|
1255
|
-
}));
|
|
1256
|
-
} else if (isNotMobile && getMode(deck) === "solo" && shouldRevert.current) {
|
|
1257
|
-
void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
|
|
1258
|
-
part: "mode",
|
|
1259
|
-
options: {
|
|
1260
|
-
revert: true
|
|
1261
|
-
}
|
|
1262
|
-
}));
|
|
1263
|
-
}
|
|
1264
|
-
}, [
|
|
1265
|
-
isNotMobile,
|
|
1266
|
-
deck,
|
|
1267
|
-
dispatch
|
|
1268
|
-
]);
|
|
1269
|
-
useEffect5(() => {
|
|
1270
|
-
if (!settings.enableDeck && layoutMode === "deck") {
|
|
1271
|
-
void dispatch(createIntent6(LayoutAction5.SetLayoutMode, {
|
|
1272
|
-
part: "mode",
|
|
1273
|
-
subject: active[0],
|
|
1274
|
-
options: {
|
|
1275
|
-
mode: "solo"
|
|
1276
|
-
}
|
|
1277
|
-
}));
|
|
1278
|
-
}
|
|
1279
|
-
}, [
|
|
1280
|
-
settings.enableDeck,
|
|
1281
|
-
dispatch,
|
|
1282
|
-
active,
|
|
1283
|
-
layoutMode
|
|
1284
|
-
]);
|
|
1285
|
-
const handleResize = useCallback7(() => {
|
|
1286
|
-
scrollLeftRef.current = null;
|
|
1287
|
-
}, []);
|
|
1288
|
-
useEffect5(() => {
|
|
1289
|
-
window.addEventListener("resize", handleResize);
|
|
1290
|
-
return () => window.removeEventListener("resize", handleResize);
|
|
1291
|
-
}, [
|
|
1292
|
-
handleResize
|
|
1293
|
-
]);
|
|
1294
|
-
const restoreScroll = useCallback7(() => {
|
|
1295
|
-
if (deckRef.current && scrollLeftRef.current != null) {
|
|
1296
|
-
deckRef.current.scrollLeft = scrollLeftRef.current;
|
|
1297
|
-
}
|
|
1298
|
-
}, []);
|
|
1299
|
-
useOnTransition(layoutMode, (mode) => mode !== "deck", "deck", restoreScroll);
|
|
1300
|
-
const handleScroll = useCallback7((event) => {
|
|
1301
|
-
if (!solo && event.currentTarget === event.target) {
|
|
1302
|
-
scrollLeftRef.current = event.target.scrollLeft;
|
|
1303
|
-
}
|
|
1304
|
-
}, [
|
|
1305
|
-
solo
|
|
1306
|
-
]);
|
|
1307
|
-
const isEmpty = !solo && active.length === 0;
|
|
1308
|
-
const padding = useMemo6(() => {
|
|
1309
|
-
if (!solo && settings.overscroll === "centering") {
|
|
1310
|
-
return calculateOverscroll(active.length);
|
|
1311
|
-
}
|
|
1312
|
-
return {};
|
|
1313
|
-
}, [
|
|
1314
|
-
solo,
|
|
1315
|
-
settings.overscroll,
|
|
1316
|
-
deck
|
|
1317
|
-
]);
|
|
1318
|
-
const mainPosition = useMemo6(() => [
|
|
1319
|
-
"grid !block-start-[env(safe-area-inset-top)]",
|
|
1320
|
-
topbar && "!block-start-[calc(env(safe-area-inset-top)+var(--rail-size))]",
|
|
1321
|
-
hoistStatusbar && "lg:block-end-[--statusbar-size]"
|
|
1322
|
-
], [
|
|
1323
|
-
topbar,
|
|
1324
|
-
hoistStatusbar
|
|
1325
|
-
]);
|
|
1326
|
-
const { order, itemsCount } = useMemo6(() => {
|
|
1327
|
-
return active.reduce((acc, entryId) => {
|
|
1328
|
-
acc.order[entryId] = acc.itemsCount + 1;
|
|
1329
|
-
acc.itemsCount += activeCompanions?.[entryId] ? 3 : 2;
|
|
1330
|
-
return acc;
|
|
1331
|
-
}, {
|
|
1332
|
-
order: {},
|
|
1333
|
-
itemsCount: 0
|
|
1334
|
-
});
|
|
1335
|
-
}, [
|
|
1336
|
-
active,
|
|
1337
|
-
activeCompanions
|
|
1338
|
-
]);
|
|
1339
|
-
return /* @__PURE__ */ React17.createElement(PopoverRoot, null, /* @__PURE__ */ React17.createElement(ActiveNode, null), /* @__PURE__ */ React17.createElement(Main3.Root, {
|
|
1340
|
-
navigationSidebarState: fullscreen ? "closed" : context.sidebarState,
|
|
1341
|
-
onNavigationSidebarStateChange: (next) => context.sidebarState = next,
|
|
1342
|
-
complementarySidebarState: fullscreen ? "closed" : context.complementarySidebarState,
|
|
1343
|
-
onComplementarySidebarStateChange: (next) => context.complementarySidebarState = next
|
|
1344
|
-
}, /* @__PURE__ */ React17.createElement(Sidebar, null), /* @__PURE__ */ React17.createElement(ComplementarySidebar, {
|
|
1345
|
-
current: complementarySidebarPanel
|
|
1346
|
-
}), /* @__PURE__ */ React17.createElement(Main3.Overlay, null), isEmpty && /* @__PURE__ */ React17.createElement(Main3.Content, {
|
|
1347
|
-
bounce: true,
|
|
1348
|
-
handlesFocus: true,
|
|
1349
|
-
classNames: mainPosition
|
|
1350
|
-
}, /* @__PURE__ */ React17.createElement(ContentEmpty, null)), !isEmpty && /* @__PURE__ */ React17.createElement(Main3.Content, {
|
|
1351
|
-
bounce: true,
|
|
1352
|
-
handlesFocus: true,
|
|
1353
|
-
classNames: mainPosition,
|
|
1354
|
-
style: {
|
|
1355
|
-
"--dx-main-sidebarWidth": sidebarState === "expanded" ? "var(--nav-sidebar-size)" : sidebarState === "collapsed" ? "var(--l0-size)" : "0",
|
|
1356
|
-
"--dx-main-complementaryWidth": complementarySidebarState === "expanded" ? "var(--complementary-sidebar-size)" : complementarySidebarState === "collapsed" ? "var(--rail-size)" : "0",
|
|
1357
|
-
"--dx-main-contentFirstWidth": `${plankSizing[active[0] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`,
|
|
1358
|
-
"--dx-main-contentLastWidth": `${plankSizing[active[(active.length ?? 1) - 1] ?? "never"] ?? DEFAULT_HORIZONTAL_SIZE}rem`
|
|
1359
|
-
}
|
|
1360
|
-
}, /* @__PURE__ */ React17.createElement("div", {
|
|
1361
|
-
role: "none",
|
|
1362
|
-
className: !solo ? "relative bg-deckSurface overflow-hidden" : "sr-only",
|
|
1363
|
-
...solo && {
|
|
1364
|
-
inert: ""
|
|
1365
|
-
}
|
|
1366
|
-
}, !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
1367
|
-
classNames: fixedSidebarToggleStyles
|
|
1368
|
-
}), !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
1369
|
-
classNames: fixedComplementarySidebarToggleStyles
|
|
1370
|
-
}), /* @__PURE__ */ React17.createElement(Stack, {
|
|
1371
|
-
ref: deckRef,
|
|
1372
|
-
orientation: "horizontal",
|
|
1373
|
-
size: "contain",
|
|
1374
|
-
classNames: [
|
|
1375
|
-
"absolute inset-block-0 -inset-inline-px",
|
|
1376
|
-
mainPaddingTransitions
|
|
1377
|
-
],
|
|
1378
|
-
itemsCount: itemsCount - 1,
|
|
1379
|
-
style: padding,
|
|
1380
|
-
onScroll: handleScroll
|
|
1381
|
-
}, active.map((entryId) => /* @__PURE__ */ React17.createElement(Fragment3, {
|
|
1382
|
-
key: entryId
|
|
1383
|
-
}, /* @__PURE__ */ React17.createElement(PlankSeparator, {
|
|
1384
|
-
order: order[entryId] - 1
|
|
1385
|
-
}), /* @__PURE__ */ React17.createElement(Plank, {
|
|
1386
|
-
id: entryId,
|
|
1387
|
-
companionId: activeCompanions?.[entryId],
|
|
1388
|
-
part: "deck",
|
|
1389
|
-
order: order[entryId],
|
|
1390
|
-
active,
|
|
1391
|
-
layoutMode,
|
|
1392
|
-
settings
|
|
1393
|
-
}))))), /* @__PURE__ */ React17.createElement("div", {
|
|
1394
|
-
role: "none",
|
|
1395
|
-
className: solo ? "relative bg-deckSurface overflow-hidden" : "sr-only",
|
|
1396
|
-
...!solo && {
|
|
1397
|
-
inert: ""
|
|
1398
|
-
}
|
|
1399
|
-
}, !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleSidebarButton, {
|
|
1400
|
-
classNames: fixedSidebarToggleStyles
|
|
1401
|
-
}), !topbar && !fullscreen && /* @__PURE__ */ React17.createElement(ToggleComplementarySidebarButton, {
|
|
1402
|
-
classNames: fixedComplementarySidebarToggleStyles
|
|
1403
|
-
}), /* @__PURE__ */ React17.createElement(StackContext.Provider, {
|
|
1404
|
-
value: {
|
|
1405
|
-
size: "contain",
|
|
1406
|
-
orientation: "horizontal",
|
|
1407
|
-
rail: true
|
|
1408
|
-
}
|
|
1409
|
-
}, /* @__PURE__ */ React17.createElement(Plank, {
|
|
1410
|
-
id: solo,
|
|
1411
|
-
companionId: solo ? activeCompanions?.[solo] : void 0,
|
|
1412
|
-
part: "solo",
|
|
1413
|
-
layoutMode,
|
|
1414
|
-
settings
|
|
1415
|
-
})))), topbar && /* @__PURE__ */ React17.createElement(Topbar, null), hoistStatusbar && /* @__PURE__ */ React17.createElement(StatusBar, {
|
|
1416
|
-
showHints: settings.showHints
|
|
1417
|
-
})), /* @__PURE__ */ React17.createElement(PopoverContent, null), /* @__PURE__ */ React17.createElement(Dialog, null), toasts?.map((toast) => /* @__PURE__ */ React17.createElement(Toast, {
|
|
1418
|
-
...toast,
|
|
1419
|
-
key: toast.id,
|
|
1420
|
-
onOpenChange: (open) => {
|
|
1421
|
-
if (!open) {
|
|
1422
|
-
onDismissToast(toast.id);
|
|
1423
|
-
}
|
|
1424
|
-
return open;
|
|
1425
|
-
}
|
|
1426
|
-
})));
|
|
1427
|
-
} finally {
|
|
1428
|
-
_effect.f();
|
|
1429
|
-
}
|
|
1430
|
-
};
|
|
1431
|
-
|
|
1432
|
-
// src/components/DeckSettings/DeckSettings.tsx
|
|
1433
|
-
import { useSignals as _useSignals18 } from "@preact-signals/safe-react/tracking";
|
|
1434
|
-
import React18 from "react";
|
|
1435
|
-
import { Input, Select, useTranslation as useTranslation8 } from "@dxos/react-ui";
|
|
1436
|
-
import { DeprecatedFormContainer, DeprecatedFormInput } from "@dxos/react-ui-form";
|
|
1437
|
-
var isSocket = !!globalThis.__args;
|
|
1438
|
-
var DeckSettings = ({ settings }) => {
|
|
1439
|
-
var _effect = _useSignals18();
|
|
1440
|
-
try {
|
|
1441
|
-
const { t } = useTranslation8(DECK_PLUGIN);
|
|
1442
|
-
return /* @__PURE__ */ React18.createElement(DeprecatedFormContainer, null, /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1443
|
-
label: t("settings enable deck label")
|
|
1444
|
-
}, /* @__PURE__ */ React18.createElement(Input.Switch, {
|
|
1445
|
-
checked: settings.enableDeck,
|
|
1446
|
-
onCheckedChange: (checked) => settings.enableDeck = checked
|
|
1447
|
-
})), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1448
|
-
label: t("select new plank positioning label")
|
|
1449
|
-
}, /* @__PURE__ */ React18.createElement(Select.Root, {
|
|
1450
|
-
disabled: !settings.enableDeck,
|
|
1451
|
-
value: settings.newPlankPositioning ?? "start",
|
|
1452
|
-
onValueChange: (value) => settings.newPlankPositioning = value
|
|
1453
|
-
}, /* @__PURE__ */ React18.createElement(Select.TriggerButton, {
|
|
1454
|
-
placeholder: t("select new plank positioning placeholder")
|
|
1455
|
-
}), /* @__PURE__ */ React18.createElement(Select.Portal, null, /* @__PURE__ */ React18.createElement(Select.Content, null, /* @__PURE__ */ React18.createElement(Select.Viewport, null, NewPlankPositions.map((position) => /* @__PURE__ */ React18.createElement(Select.Option, {
|
|
1456
|
-
key: position,
|
|
1457
|
-
value: position
|
|
1458
|
-
}, t(`settings new plank position ${position} label`)))))))), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1459
|
-
label: t("settings overscroll label")
|
|
1460
|
-
}, /* @__PURE__ */ React18.createElement(Select.Root, {
|
|
1461
|
-
disabled: !settings.enableDeck,
|
|
1462
|
-
value: settings.overscroll ?? "none",
|
|
1463
|
-
onValueChange: (value) => settings.overscroll = value
|
|
1464
|
-
}, /* @__PURE__ */ React18.createElement(Select.TriggerButton, {
|
|
1465
|
-
placeholder: t("select overscroll placeholder")
|
|
1466
|
-
}), /* @__PURE__ */ React18.createElement(Select.Portal, null, /* @__PURE__ */ React18.createElement(Select.Content, null, /* @__PURE__ */ React18.createElement(Select.Viewport, null, OverscrollOptions.map((option) => /* @__PURE__ */ React18.createElement(Select.Option, {
|
|
1467
|
-
key: option,
|
|
1468
|
-
value: option
|
|
1469
|
-
}, t(`settings overscroll ${option} label`)))))))), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1470
|
-
label: t("settings enable statusbar label")
|
|
1471
|
-
}, /* @__PURE__ */ React18.createElement(Input.Switch, {
|
|
1472
|
-
checked: settings.enableStatusbar,
|
|
1473
|
-
onCheckedChange: (checked) => settings.enableStatusbar = checked
|
|
1474
|
-
})), /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1475
|
-
label: t("settings show hints label")
|
|
1476
|
-
}, /* @__PURE__ */ React18.createElement(Input.Switch, {
|
|
1477
|
-
checked: settings.showHints,
|
|
1478
|
-
onCheckedChange: (checked) => settings.showHints = checked
|
|
1479
|
-
})), !isSocket && /* @__PURE__ */ React18.createElement(DeprecatedFormInput, {
|
|
1480
|
-
label: t("settings native redirect label")
|
|
1481
|
-
}, /* @__PURE__ */ React18.createElement(Input.Switch, {
|
|
1482
|
-
checked: settings.enableNativeRedirect,
|
|
1483
|
-
onCheckedChange: (checked) => settings.enableNativeRedirect = checked
|
|
1484
|
-
})));
|
|
1485
|
-
} finally {
|
|
1486
|
-
_effect.f();
|
|
1487
|
-
}
|
|
1488
|
-
};
|
|
1489
|
-
|
|
1490
|
-
export {
|
|
1491
|
-
Banner,
|
|
1492
|
-
DeckLayout,
|
|
1493
|
-
DeckSettings
|
|
1494
|
-
};
|
|
1495
|
-
//# sourceMappingURL=chunk-NMSUKHE3.mjs.map
|