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