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