@dxos/plugin-deck 0.8.4-main.3f58842 → 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
|
@@ -8,7 +8,7 @@ import { createIntent, useIntentDispatcher } from '@dxos/app-framework';
|
|
|
8
8
|
import { invariant } from '@dxos/invariant';
|
|
9
9
|
import { ButtonGroup, type ButtonGroupProps, type ButtonProps, IconButton, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
12
|
import { DeckAction, type LayoutMode } from '../../types';
|
|
13
13
|
|
|
14
14
|
export type PlankControlHandler = (event: DeckAction.PartAdjustment) => void;
|
|
@@ -43,7 +43,7 @@ type PlankComplimentControlsProps = {
|
|
|
43
43
|
|
|
44
44
|
export const PlankCompanionControls = forwardRef<HTMLDivElement, PlankComplimentControlsProps>(
|
|
45
45
|
({ primary }, forwardedRef) => {
|
|
46
|
-
const { t } = useTranslation(
|
|
46
|
+
const { t } = useTranslation(meta.id);
|
|
47
47
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
48
48
|
const handleCloseCompanion = useCallback(() => {
|
|
49
49
|
invariant(primary);
|
|
@@ -71,7 +71,7 @@ export const PlankControls = forwardRef<HTMLDivElement, PlankControlsProps>(
|
|
|
71
71
|
{ children, classNames, variant = 'default', capabilities, layoutMode, pin, close = false, onClick, ...props },
|
|
72
72
|
forwardedRef,
|
|
73
73
|
) => {
|
|
74
|
-
const { t } = useTranslation(
|
|
74
|
+
const { t } = useTranslation(meta.id);
|
|
75
75
|
const buttonClassNames =
|
|
76
76
|
variant === 'hide-disabled' ? `disabled:hidden ${plankControlSpacing}` : plankControlSpacing;
|
|
77
77
|
|
|
@@ -8,12 +8,13 @@ import { type Node } from '@dxos/plugin-graph';
|
|
|
8
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { descriptionMessage, mx } from '@dxos/react-ui-theme';
|
|
10
10
|
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
|
+
|
|
11
13
|
import { PlankHeading, type PlankHeadingProps } from './PlankHeading';
|
|
12
14
|
import { PlankLoading } from './PlankLoading';
|
|
13
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
14
15
|
|
|
15
16
|
export const PlankContentError = ({ error }: { error?: Error }) => {
|
|
16
|
-
const { t } = useTranslation(
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
17
18
|
const errorString = error?.toString() ?? '';
|
|
18
19
|
return (
|
|
19
20
|
<div role='none' className='overflow-y-auto p-8 attention-surface grid place-items-center'>
|
|
@@ -2,22 +2,23 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { Fragment, memo, useCallback, useEffect, useMemo
|
|
5
|
+
import React, { Fragment, type MouseEvent, memo, useCallback, useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, Surface, createIntent, useAppGraph, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { type Node } from '@dxos/plugin-graph';
|
|
9
9
|
import { Icon, IconButton, Popover, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
10
10
|
import { StackItem, type StackItemSigilAction } from '@dxos/react-ui-stack';
|
|
11
11
|
import { TextTooltip } from '@dxos/react-ui-text-tooltip';
|
|
12
12
|
import { hoverableControls, hoverableFocusedWithinControls } from '@dxos/react-ui-theme';
|
|
13
13
|
|
|
14
|
-
import { PlankCompanionControls, PlankControls } from './PlankControls';
|
|
15
14
|
import { useBreakpoints } from '../../hooks';
|
|
16
15
|
import { parseEntryId } from '../../layout';
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
16
|
+
import { meta } from '../../meta';
|
|
17
|
+
import { DeckAction, type LayoutMode, PLANK_COMPANION_TYPE, type ResolvedPart } from '../../types';
|
|
19
18
|
import { soloInlinePadding } from '../fragments';
|
|
20
19
|
|
|
20
|
+
import { PlankCompanionControls, PlankControls } from './PlankControls';
|
|
21
|
+
|
|
21
22
|
const MAX_COMPANIONS = 5;
|
|
22
23
|
|
|
23
24
|
export type PlankHeadingProps = {
|
|
@@ -52,14 +53,14 @@ export const PlankHeading = memo(
|
|
|
52
53
|
layoutMode,
|
|
53
54
|
actions = [],
|
|
54
55
|
}: PlankHeadingProps) => {
|
|
55
|
-
const { t } = useTranslation(
|
|
56
|
+
const { t } = useTranslation(meta.id);
|
|
56
57
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
57
58
|
const { graph } = useAppGraph();
|
|
58
59
|
const breakpoint = useBreakpoints();
|
|
59
60
|
const icon = node?.properties?.icon ?? 'ph--placeholder--regular';
|
|
60
61
|
const label = pending
|
|
61
62
|
? t('pending heading')
|
|
62
|
-
: toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns:
|
|
63
|
+
: toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns: meta.id }], t);
|
|
63
64
|
|
|
64
65
|
const isCompanionNode = node?.type === PLANK_COMPANION_TYPE;
|
|
65
66
|
|
|
@@ -105,7 +106,7 @@ export const PlankHeading = memo(
|
|
|
105
106
|
|
|
106
107
|
const handleAction = useCallback(
|
|
107
108
|
(action: StackItemSigilAction) => {
|
|
108
|
-
typeof action.data === 'function' && void action.data?.({ parent: node, caller:
|
|
109
|
+
typeof action.data === 'function' && void action.data?.({ parent: node, caller: meta.id });
|
|
109
110
|
},
|
|
110
111
|
[node],
|
|
111
112
|
);
|
|
@@ -134,7 +135,7 @@ export const PlankHeading = memo(
|
|
|
134
135
|
[dispatch, id, part],
|
|
135
136
|
);
|
|
136
137
|
|
|
137
|
-
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${
|
|
138
|
+
const ActionRoot = node && popoverAnchorId === `dxos.org/ui/${meta.id}/${node.id}` ? Popover.Anchor : Fragment;
|
|
138
139
|
|
|
139
140
|
const handleTabClick = useCallback(
|
|
140
141
|
(event: MouseEvent) => {
|
|
@@ -13,25 +13,26 @@ import React, {
|
|
|
13
13
|
} from 'react';
|
|
14
14
|
|
|
15
15
|
import { LayoutAction, Surface, createIntent, useCapability, useIntentDispatcher } from '@dxos/app-framework';
|
|
16
|
-
import {
|
|
16
|
+
import { IconButton, type Label, Main, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
17
17
|
import { Tabs } from '@dxos/react-ui-tabs';
|
|
18
18
|
|
|
19
|
-
import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
20
19
|
import { DeckCapabilities } from '../../capabilities';
|
|
21
|
-
import { type DeckCompanion, getCompanionId,
|
|
22
|
-
import {
|
|
20
|
+
import { type DeckCompanion, getCompanionId, useBreakpoints, useDeckCompanions, useHoistStatusbar } from '../../hooks';
|
|
21
|
+
import { meta } from '../../meta';
|
|
23
22
|
import { getMode } from '../../types';
|
|
24
23
|
import { layoutAppliesTopbar } from '../../util';
|
|
25
24
|
import { PlankContentError, PlankLoading } from '../Plank';
|
|
26
25
|
|
|
27
|
-
|
|
26
|
+
import { ToggleComplementarySidebarButton } from './SidebarButton';
|
|
27
|
+
|
|
28
|
+
const label = ['complementary sidebar title', { ns: meta.id }] satisfies Label;
|
|
28
29
|
|
|
29
30
|
export type ComplementarySidebarProps = {
|
|
30
31
|
current?: string;
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) => {
|
|
34
|
-
const { t } = useTranslation(
|
|
35
|
+
const { t } = useTranslation(meta.id);
|
|
35
36
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
36
37
|
const layout = useCapability(DeckCapabilities.MutableDeckState);
|
|
37
38
|
const layoutMode = getMode(layout.deck);
|
|
@@ -129,7 +130,7 @@ export const ComplementarySidebar = ({ current }: ComplementarySidebarProps) =>
|
|
|
129
130
|
key={getCompanionId(companion.id)}
|
|
130
131
|
value={getCompanionId(companion.id)}
|
|
131
132
|
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)]'
|
|
132
|
-
{...(layout.complementarySidebarState !== 'expanded' && { inert:
|
|
133
|
+
{...(layout.complementarySidebarState !== 'expanded' && { inert: true })}
|
|
133
134
|
>
|
|
134
135
|
<ComplementarySidebarPanel
|
|
135
136
|
companion={companion}
|
|
@@ -159,7 +160,7 @@ const ScrollArea = ({ children }: PropsWithChildren) => {
|
|
|
159
160
|
};
|
|
160
161
|
|
|
161
162
|
const ComplementarySidebarPanel = ({ companion, activeId, data, hoistStatusbar }: ComplementarySidebarPanelProps) => {
|
|
162
|
-
const { t } = useTranslation(
|
|
163
|
+
const { t } = useTranslation(meta.id);
|
|
163
164
|
|
|
164
165
|
if (getCompanionId(companion.id) !== activeId && !data) {
|
|
165
166
|
return null;
|
|
@@ -9,11 +9,11 @@ import { type Label, Main } from '@dxos/react-ui';
|
|
|
9
9
|
|
|
10
10
|
import { DeckCapabilities } from '../../capabilities';
|
|
11
11
|
import { useBreakpoints, useHoistStatusbar } from '../../hooks';
|
|
12
|
-
import {
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
13
|
import { getMode } from '../../types';
|
|
14
14
|
import { layoutAppliesTopbar } from '../../util';
|
|
15
15
|
|
|
16
|
-
const label = ['sidebar title', { ns:
|
|
16
|
+
const label = ['sidebar title', { ns: meta.id }] satisfies Label;
|
|
17
17
|
|
|
18
18
|
export const Sidebar = () => {
|
|
19
19
|
const { popoverAnchorId, activeDeck: current, deck } = useCapability(DeckCapabilities.DeckState);
|
|
@@ -4,19 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useCallback } from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { LayoutAction, createIntent, useCapability, useIntentDispatcher } from '@dxos/app-framework';
|
|
8
8
|
import { IconButton, type IconButtonProps, type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { DeckCapabilities } from '../../capabilities';
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { getCompanionId, useDeckCompanions } from '../../hooks';
|
|
12
|
+
import { meta } from '../../meta';
|
|
13
13
|
|
|
14
14
|
export const ToggleSidebarButton = ({
|
|
15
15
|
classNames,
|
|
16
16
|
variant = 'ghost',
|
|
17
17
|
}: ThemedClassName<Pick<IconButtonProps, 'variant'>>) => {
|
|
18
18
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
19
|
-
const { t } = useTranslation(
|
|
19
|
+
const { t } = useTranslation(meta.id);
|
|
20
20
|
return (
|
|
21
21
|
<IconButton
|
|
22
22
|
variant={variant}
|
|
@@ -34,7 +34,7 @@ export const ToggleSidebarButton = ({
|
|
|
34
34
|
|
|
35
35
|
export const CloseSidebarButton = () => {
|
|
36
36
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
37
|
-
const { t } = useTranslation(
|
|
37
|
+
const { t } = useTranslation(meta.id);
|
|
38
38
|
return (
|
|
39
39
|
<IconButton
|
|
40
40
|
variant='ghost'
|
|
@@ -55,7 +55,7 @@ export const ToggleComplementarySidebarButton = ({
|
|
|
55
55
|
}: ThemedClassName<{ inR0?: boolean; current?: string }>) => {
|
|
56
56
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
57
57
|
const layoutContext = useCapability(DeckCapabilities.MutableDeckState);
|
|
58
|
-
const { t } = useTranslation(
|
|
58
|
+
const { t } = useTranslation(meta.id);
|
|
59
59
|
|
|
60
60
|
const companions = useDeckCompanions();
|
|
61
61
|
const handleClick = useCallback(async () => {
|
package/src/events.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { Events } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { meta } from './meta';
|
|
8
8
|
|
|
9
9
|
export namespace DeckEvents {
|
|
10
|
-
export const StateReady = Events.createStateEvent(`${
|
|
10
|
+
export const StateReady = Events.createStateEvent(`${meta.id}/state-ready`);
|
|
11
11
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Label, useAppGraph } from '@dxos/app-framework';
|
|
6
|
-
import { ROOT_ID, useConnections
|
|
7
|
-
import {
|
|
6
|
+
import { type Node, ROOT_ID, useConnections } from '@dxos/plugin-graph';
|
|
7
|
+
import { type Position, byPosition } from '@dxos/util';
|
|
8
8
|
|
|
9
9
|
import { ATTENDABLE_PATH_SEPARATOR, DECK_COMPANION_TYPE } from '../types';
|
|
10
10
|
|
|
@@ -7,13 +7,14 @@ import { useMemo } from 'react';
|
|
|
7
7
|
import { Capabilities, useCapability } from '@dxos/app-framework';
|
|
8
8
|
import { useThemeContext } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { meta } from '../meta';
|
|
11
11
|
import type { DeckSettingsProps, LayoutMode } from '../types';
|
|
12
12
|
|
|
13
13
|
export const useHoistStatusbar = (breakpoint: string, layoutMode?: LayoutMode): boolean => {
|
|
14
|
-
const enableStatusbar = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)!.value
|
|
15
|
-
.enableStatusbar;
|
|
16
14
|
const { safeAreaPadding } = useThemeContext();
|
|
15
|
+
const enableStatusbar = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(meta.id)?.value
|
|
16
|
+
.enableStatusbar;
|
|
17
|
+
|
|
17
18
|
return useMemo(() => {
|
|
18
19
|
return (
|
|
19
20
|
breakpoint === 'desktop' &&
|
package/src/meta.ts
CHANGED
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
|
-
export const DECK_PLUGIN = 'dxos.org/plugin/deck' as const;
|
|
8
|
-
|
|
9
7
|
export const meta: PluginMeta = {
|
|
10
|
-
id:
|
|
8
|
+
id: 'dxos.org/plugin/deck',
|
|
11
9
|
name: 'Layout',
|
|
12
10
|
icon: 'ph--layout--regular',
|
|
13
11
|
};
|
package/src/translations.ts
CHANGED
|
@@ -11,6 +11,7 @@ export const translations = [
|
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
13
|
'plugin name': 'Deck',
|
|
14
|
+
'settings title': 'Deck settings',
|
|
14
15
|
'main header label': 'Main header',
|
|
15
16
|
'open navigation sidebar label': 'Open sidebar',
|
|
16
17
|
'collapse navigation sidebar label': 'Minimize sidebar',
|
|
@@ -58,6 +59,7 @@ export const translations = [
|
|
|
58
59
|
'settings overscroll none label': 'None',
|
|
59
60
|
'settings enable statusbar label': 'Show status bar',
|
|
60
61
|
'settings enable deck label': 'Enable Deck',
|
|
62
|
+
'settings encapsulated planks label': 'Encapsulated planks',
|
|
61
63
|
'close current label': 'Close current plank',
|
|
62
64
|
'close others label': 'Close other planks',
|
|
63
65
|
'close all label': 'Close all planks',
|
package/src/types/schema.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { LayoutAction } from '@dxos/app-framework';
|
|
8
8
|
import { type DeepReadonly } from '@dxos/util';
|
|
@@ -11,8 +11,8 @@ import { meta } from '../meta';
|
|
|
11
11
|
|
|
12
12
|
export { ATTENDABLE_PATH_SEPARATOR } from '@dxos/react-ui-attention';
|
|
13
13
|
|
|
14
|
-
export const PLANK_COMPANION_TYPE =
|
|
15
|
-
export const DECK_COMPANION_TYPE =
|
|
14
|
+
export const PLANK_COMPANION_TYPE = `${meta.id}/plank-companion`;
|
|
15
|
+
export const DECK_COMPANION_TYPE = `${meta.id}/deck-companion`;
|
|
16
16
|
|
|
17
17
|
// TODO(Zan): In the future we should consider adding new planks adjacent to the attended plank.
|
|
18
18
|
export const NewPlankPositions = ['start', 'end'] as const;
|
|
@@ -31,6 +31,8 @@ export const DeckSettingsSchema = Schema.Struct({
|
|
|
31
31
|
enableNativeRedirect: Schema.optional(Schema.Boolean),
|
|
32
32
|
newPlankPositioning: Schema.optional(Schema.Literal(...NewPlankPositions)),
|
|
33
33
|
overscroll: Schema.optional(Schema.Literal(...OverscrollOptions)),
|
|
34
|
+
// TODO(burdon): Rename layoutMode? (e.g., bento | encapsulated?)
|
|
35
|
+
encapsulatedPlanks: Schema.optional(Schema.Boolean),
|
|
34
36
|
}).pipe(Schema.mutable);
|
|
35
37
|
export type DeckSettingsProps = Schema.Schema.Type<typeof DeckSettingsSchema>;
|
|
36
38
|
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Rx } from '@effect-rx/rx-react';\nimport { Option, pipe } from 'effect';\n\nimport { Capabilities, contributes, createIntent, LayoutAction, type PluginContext } from '@dxos/app-framework';\nimport { AttentionCapabilities } from '@dxos/plugin-attention';\nimport { createExtension, ROOT_ID, rxFromSignal } from '@dxos/plugin-graph';\n\nimport { DeckCapabilities } from './capabilities';\nimport { DECK_PLUGIN } from '../meta';\n\nexport default (context: PluginContext) =>\n contributes(\n Capabilities.AppGraphBuilder,\n createExtension({\n id: DECK_PLUGIN,\n actions: (node) =>\n Rx.make((get) =>\n pipe(\n get(node),\n Option.flatMap((node) => (node.id === ROOT_ID ? Option.some(node) : Option.none())),\n Option.map(() => {\n const state = context.getCapability(DeckCapabilities.MutableDeckState);\n\n // NOTE(Zan): This is currently disabled.\n // TODO(Zan): Fullscreen needs to know the active node and provide that to the layout part.\n const _fullscreen = {\n id: `${LayoutAction.UpdateLayout._tag}/fullscreen`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.SetLayoutMode, { part: 'mode', options: { mode: 'fullscreen' } }),\n );\n },\n properties: {\n label: ['toggle fullscreen label', { ns: DECK_PLUGIN }],\n icon: 'ph--arrows-out--regular',\n keyBinding: {\n macos: 'ctrl+meta+f',\n windows: 'shift+ctrl+f',\n },\n },\n };\n\n const closeCurrent = {\n id: `${LayoutAction.Close._tag}/current`,\n data: async () => {\n const attention = context.getCapability(AttentionCapabilities.Attention);\n const attended = attention.current.at(-1);\n if (attended) {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.Close, {\n part: 'main',\n subject: [attended],\n options: { state: false },\n }),\n );\n }\n },\n properties: {\n label: ['close current label', { ns: DECK_PLUGIN }],\n icon: 'ph--x--regular',\n },\n };\n\n const closeOthers = {\n id: `${LayoutAction.Close._tag}/others`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n const attention = context.getCapability(AttentionCapabilities.Attention);\n const attended = attention.current.at(-1);\n const ids = state.deck.active.filter((id) => id !== attended) ?? [];\n await dispatch(\n createIntent(LayoutAction.Close, { part: 'main', subject: ids, options: { state: false } }),\n );\n },\n properties: {\n label: ['close others label', { ns: DECK_PLUGIN }],\n icon: 'ph--x-square--regular',\n },\n };\n\n const closeAll = {\n id: `${LayoutAction.Close._tag}/all`,\n data: async () => {\n const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);\n await dispatch(\n createIntent(LayoutAction.Close, {\n part: 'main',\n subject: state.deck.active,\n options: { state: false },\n }),\n );\n },\n properties: {\n label: ['close all label', { ns: DECK_PLUGIN }],\n icon: 'ph--x-circle--regular',\n },\n };\n\n const toggleSidebar = {\n id: `${LayoutAction.UpdateSidebar._tag}/nav`,\n data: async () => {\n state.sidebarState = state.sidebarState === 'expanded' ? 'collapsed' : 'expanded';\n },\n properties: {\n label: [\n get(\n rxFromSignal(() =>\n state.sidebarState === 'expanded'\n ? 'collapse navigation sidebar label'\n : 'open navigation sidebar label',\n ),\n ),\n { ns: DECK_PLUGIN },\n ],\n icon: 'ph--sidebar--regular',\n keyBinding: {\n macos: \"meta+'\",\n },\n disposition: 'pin-end',\n position: 'hoist',\n l0Breakpoint: 'lg',\n },\n };\n\n return get(\n rxFromSignal(() =>\n !state.deck.solo ? [closeCurrent, closeOthers, closeAll, toggleSidebar] : [toggleSidebar],\n ),\n );\n }),\n Option.getOrElse(() => []),\n ),\n ),\n }),\n );\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,SAASA,UAAU;AACnB,SAASC,QAAQC,YAAY;AAE7B,SAASC,cAAcC,aAAaC,cAAcC,oBAAwC;AAC1F,SAASC,6BAA6B;AACtC,SAASC,iBAAiBC,SAASC,oBAAoB;AAKvD,IAAA,4BAAe,CAACC,YACdC,YACEC,aAAaC,iBACbC,gBAAgB;EACdC,IAAIC;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U;QACVC,cAAc;MAChB;IACF;AAEA,WAAOrD,IACLkD,aAAa,MACX,CAAC1C,MAAMmC,KAAKW,OAAO;MAACtB;MAAcS;MAAaK;MAAUC;QAAiB;MAACA;KAAc,CAAA;EAG/F,CAAA,GACA7C,OAAOqD,UAAU,MAAM,CAAA,CAAE,CAAA,CAAA;AAGjC,CAAA,CAAA;",
|
|
6
|
-
"names": ["Rx", "Option", "pipe", "Capabilities", "contributes", "createIntent", "LayoutAction", "AttentionCapabilities", "createExtension", "ROOT_ID", "rxFromSignal", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "DECK_PLUGIN", "actions", "node", "Rx", "make", "get", "pipe", "Option", "flatMap", "ROOT_ID", "some", "none", "map", "state", "getCapability", "DeckCapabilities", "MutableDeckState", "_fullscreen", "LayoutAction", "UpdateLayout", "_tag", "data", "dispatchPromise", "dispatch", "IntentDispatcher", "createIntent", "SetLayoutMode", "part", "options", "mode", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "closeCurrent", "Close", "attention", "AttentionCapabilities", "Attention", "attended", "current", "at", "subject", "closeOthers", "ids", "deck", "active", "filter", "closeAll", "toggleSidebar", "UpdateSidebar", "sidebarState", "rxFromSignal", "disposition", "position", "l0Breakpoint", "solo", "getOrElse"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/check-app-scheme.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, type PluginContext } from '@dxos/app-framework';\n\nimport { DECK_PLUGIN } from '../meta';\nimport { type DeckSettingsProps } from '../types';\n\nconst isSocket = !!(globalThis as any).__args;\n\n// TODO(mjamesderocher): Can we get this directly from Socket?\nconst appScheme = 'composer://';\n\n// TODO(mjamesderocher): Factor out as part of NavigationPlugin.\nconst checkAppScheme = (url: string) => {\n const iframe = document.createElement('iframe');\n iframe.style.display = 'none';\n document.body.appendChild(iframe);\n\n iframe.src = url + window.location.pathname.replace(/^\\/+/, '') + window.location.search;\n\n const timer = setTimeout(() => {\n document.body.removeChild(iframe);\n }, 3000);\n\n window.addEventListener('pagehide', (event) => {\n clearTimeout(timer);\n document.body.removeChild(iframe);\n });\n};\n\nexport default async (context: PluginContext) => {\n const settings = context.getCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(DECK_PLUGIN)?.value;\n if (!isSocket && settings?.enableNativeRedirect) {\n checkAppScheme(appScheme);\n }\n\n return contributes(Capabilities.Null, null);\n};\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,cAAcC,mBAAuC;AAK9D,IAAMC,WAAW,CAAC,CAAEC,WAAmBC;AAGvC,IAAMC,YAAY;AAGlB,IAAMC,iBAAiB,CAACC,QAAAA;AACtB,QAAMC,SAASC,SAASC,cAAc,QAAA;AACtCF,SAAOG,MAAMC,UAAU;AACvBH,WAASI,KAAKC,YAAYN,MAAAA;AAE1BA,SAAOO,MAAMR,MAAMS,OAAOC,SAASC,SAASC,QAAQ,QAAQ,EAAA,IAAMH,OAAOC,SAASG;AAElF,QAAMC,QAAQC,WAAW,MAAA;AACvBb,aAASI,KAAKU,YAAYf,MAAAA;EAC5B,GAAG,GAAA;AAEHQ,SAAOQ,iBAAiB,YAAY,CAACC,UAAAA;AACnCC,iBAAaL,KAAAA;AACbZ,aAASI,KAAKU,YAAYf,MAAAA;EAC5B,CAAA;AACF;AAEA,IAAA,2BAAe,OAAOmB,YAAAA;AACpB,QAAMC,WAAWD,QAAQE,cAAcC,aAAaC,aAAa,EAAEC,SAA4BC,WAAAA,GAAcC;AAC7G,MAAI,CAAChC,YAAY0B,UAAUO,sBAAsB;AAC/C7B,mBAAeD,SAAAA;EACjB;AAEA,SAAO+B,YAAYN,aAAaO,MAAM,IAAA;AACxC;",
|
|
6
|
-
"names": ["Capabilities", "contributes", "isSocket", "globalThis", "__args", "appScheme", "checkAppScheme", "url", "iframe", "document", "createElement", "style", "display", "body", "appendChild", "src", "window", "location", "pathname", "replace", "search", "timer", "setTimeout", "removeChild", "addEventListener", "event", "clearTimeout", "context", "settings", "getCapability", "Capabilities", "SettingsStore", "getStore", "DECK_PLUGIN", "value", "enableNativeRedirect", "contributes", "Null"]
|
|
7
|
-
}
|