@dxos/plugin-deck 0.6.11 → 0.6.12-main.2d19bf1
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/{chunk-YVHGFQQR.mjs → chunk-GVOGPULO.mjs} +1 -1
- package/dist/lib/browser/chunk-GVOGPULO.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +220 -148
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/meta.mjs +1 -1
- package/dist/types/src/DeckPlugin.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts +2 -2
- package/dist/types/src/components/DeckLayout/ComplementarySidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts +3 -4
- package/dist/types/src/components/DeckLayout/DeckLayout.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts +4 -3
- package/dist/types/src/components/DeckLayout/NodePlankHeading.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts +2 -3
- package/dist/types/src/components/DeckLayout/Sidebar.d.ts.map +1 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts +3 -1
- package/dist/types/src/components/DeckLayout/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/LayoutSettings.d.ts.map +1 -1
- package/dist/types/src/hooks/useNode.d.ts.map +1 -1
- package/dist/types/src/layout.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types.d.ts +1 -1
- package/dist/types/src/types.d.ts.map +1 -1
- package/package.json +29 -29
- package/src/DeckPlugin.tsx +81 -53
- package/src/components/DeckLayout/ComplementarySidebar.tsx +73 -22
- package/src/components/DeckLayout/DeckLayout.tsx +42 -60
- package/src/components/DeckLayout/NodePlankHeading.tsx +15 -15
- package/src/components/DeckLayout/Plank.tsx +2 -2
- package/src/components/DeckLayout/Sidebar.tsx +6 -5
- package/src/components/DeckLayout/StatusBar.tsx +10 -2
- package/src/components/LayoutSettings.tsx +5 -8
- package/src/hooks/useNode.ts +5 -1
- package/src/layout.ts +1 -0
- package/src/meta.ts +3 -1
- package/src/translations.ts +3 -1
- package/src/types.ts +1 -1
- package/dist/lib/browser/chunk-YVHGFQQR.mjs.map +0 -7
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Placeholder } from '@phosphor-icons/react';
|
|
6
5
|
import React, { Fragment, useEffect } from 'react';
|
|
7
6
|
|
|
8
7
|
import {
|
|
9
8
|
LayoutAction,
|
|
10
9
|
NavigationAction,
|
|
11
|
-
SLUG_COLLECTION_INDICATOR,
|
|
12
10
|
SLUG_PATH_SEPARATOR,
|
|
13
11
|
Surface,
|
|
14
12
|
useIntentDispatcher,
|
|
@@ -16,11 +14,10 @@ import {
|
|
|
16
14
|
partLength,
|
|
17
15
|
type LayoutParts,
|
|
18
16
|
type LayoutPart,
|
|
19
|
-
type LayoutEntry,
|
|
20
17
|
} from '@dxos/app-framework';
|
|
21
18
|
import { type Node, useGraph } from '@dxos/plugin-graph';
|
|
22
|
-
import { Popover, toLocalizedString, useMediaQuery, useTranslation } from '@dxos/react-ui';
|
|
23
|
-
import { PlankHeading,
|
|
19
|
+
import { Icon, Popover, toLocalizedString, useMediaQuery, useTranslation } from '@dxos/react-ui';
|
|
20
|
+
import { PlankHeading, type PlankHeadingAction } from '@dxos/react-ui-deck';
|
|
24
21
|
import { TextTooltip } from '@dxos/react-ui-text-tooltip';
|
|
25
22
|
|
|
26
23
|
import { DECK_PLUGIN } from '../../meta';
|
|
@@ -30,24 +27,23 @@ export const NodePlankHeading = ({
|
|
|
30
27
|
id,
|
|
31
28
|
layoutParts,
|
|
32
29
|
layoutPart,
|
|
33
|
-
// TODO(wittjosiah): Unused?
|
|
34
|
-
layoutEntry,
|
|
35
30
|
popoverAnchorId,
|
|
36
31
|
pending,
|
|
37
32
|
flatDeck,
|
|
33
|
+
actions = [],
|
|
38
34
|
}: {
|
|
39
35
|
node?: Node;
|
|
40
36
|
id?: string;
|
|
41
37
|
layoutParts?: LayoutParts;
|
|
42
38
|
layoutPart?: LayoutPart;
|
|
43
|
-
layoutEntry?: LayoutEntry;
|
|
44
39
|
popoverAnchorId?: string;
|
|
45
40
|
pending?: boolean;
|
|
46
41
|
flatDeck?: boolean;
|
|
42
|
+
actions?: PlankHeadingAction[];
|
|
47
43
|
}) => {
|
|
48
44
|
const { t } = useTranslation(DECK_PLUGIN);
|
|
49
45
|
const { graph } = useGraph();
|
|
50
|
-
const
|
|
46
|
+
const icon = node?.properties?.icon ?? 'ph--placeholder--regular';
|
|
51
47
|
const label = pending
|
|
52
48
|
? t('pending heading')
|
|
53
49
|
: toLocalizedString(node?.properties?.label ?? ['plank heading fallback label', { ns: DECK_PLUGIN }], t);
|
|
@@ -80,10 +76,11 @@ export const NodePlankHeading = ({
|
|
|
80
76
|
<ActionRoot>
|
|
81
77
|
{node ? (
|
|
82
78
|
<PlankHeading.ActionsMenu
|
|
83
|
-
|
|
79
|
+
icon={icon}
|
|
80
|
+
related={layoutPart === 'complementary'}
|
|
84
81
|
attendableId={attendableId}
|
|
85
82
|
triggerLabel={t('actions menu label')}
|
|
86
|
-
actions={graph.actions(node)}
|
|
83
|
+
actions={[actions, graph.actions(node)].filter((a) => a.length > 0)}
|
|
87
84
|
onAction={(action) =>
|
|
88
85
|
typeof action.data === 'function' && action.data?.({ node: action as Node, caller: DECK_PLUGIN })
|
|
89
86
|
}
|
|
@@ -93,12 +90,16 @@ export const NodePlankHeading = ({
|
|
|
93
90
|
) : (
|
|
94
91
|
<PlankHeading.Button>
|
|
95
92
|
<span className='sr-only'>{label}</span>
|
|
96
|
-
<Icon {
|
|
93
|
+
<Icon icon={icon} size={5} />
|
|
97
94
|
</PlankHeading.Button>
|
|
98
95
|
)}
|
|
99
96
|
</ActionRoot>
|
|
100
97
|
<TextTooltip text={label} onlyWhenTruncating>
|
|
101
|
-
<PlankHeading.Label
|
|
98
|
+
<PlankHeading.Label
|
|
99
|
+
attendableId={attendableId}
|
|
100
|
+
related={layoutPart === 'complementary'}
|
|
101
|
+
{...(pending && { classNames: 'text-description' })}
|
|
102
|
+
>
|
|
102
103
|
{label}
|
|
103
104
|
</PlankHeading.Label>
|
|
104
105
|
</TextTooltip>
|
|
@@ -143,7 +144,6 @@ export const NodePlankHeading = ({
|
|
|
143
144
|
action: NavigationAction.CLOSE,
|
|
144
145
|
data: {
|
|
145
146
|
activeParts: {
|
|
146
|
-
complementary: [`${id}${SLUG_PATH_SEPARATOR}comments${SLUG_COLLECTION_INDICATOR}`],
|
|
147
147
|
[layoutPart]: [id],
|
|
148
148
|
},
|
|
149
149
|
},
|
|
@@ -151,7 +151,7 @@ export const NodePlankHeading = ({
|
|
|
151
151
|
: { action: NavigationAction.ADJUST, data: { type: eventType, layoutCoordinate } },
|
|
152
152
|
);
|
|
153
153
|
}}
|
|
154
|
-
close={
|
|
154
|
+
close={layoutPart === 'complementary' ? 'minify-end' : true}
|
|
155
155
|
/>
|
|
156
156
|
</PlankHeading.Root>
|
|
157
157
|
);
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import { debounce } from '@dxos/async';
|
|
20
20
|
import { useGraph } from '@dxos/plugin-graph';
|
|
21
21
|
import { Button, Tooltip, useTranslation } from '@dxos/react-ui';
|
|
22
|
-
import {
|
|
22
|
+
import { useAttendableAttributes } from '@dxos/react-ui-attention';
|
|
23
23
|
import { Plank as NaturalPlank } from '@dxos/react-ui-deck';
|
|
24
24
|
import { mainIntrinsicSize } from '@dxos/react-ui-theme';
|
|
25
25
|
|
|
@@ -52,7 +52,7 @@ export const Plank = ({ entry, layoutParts, part, flatDeck, searchEnabled, layou
|
|
|
52
52
|
const rootElement = useRef<HTMLDivElement | null>(null);
|
|
53
53
|
const resizeable = layoutMode === 'deck';
|
|
54
54
|
|
|
55
|
-
const attendableAttrs =
|
|
55
|
+
const attendableAttrs = useAttendableAttributes(entry.id);
|
|
56
56
|
const coordinate: LayoutCoordinate = { part, entryId: entry.id };
|
|
57
57
|
|
|
58
58
|
const size = plankSizing?.[entry.id] as number | undefined;
|
|
@@ -4,18 +4,19 @@
|
|
|
4
4
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { type
|
|
7
|
+
import { type LayoutParts, openIds, Surface } from '@dxos/app-framework';
|
|
8
8
|
import { Main } from '@dxos/react-ui';
|
|
9
|
+
import { useAttended } from '@dxos/react-ui-attention';
|
|
9
10
|
|
|
10
11
|
import { useLayout } from '../LayoutContext';
|
|
11
12
|
|
|
12
13
|
export type SidebarProps = {
|
|
13
|
-
attention: Attention;
|
|
14
14
|
layoutParts: LayoutParts;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
export const Sidebar = ({
|
|
17
|
+
export const Sidebar = ({ layoutParts }: SidebarProps) => {
|
|
18
18
|
const { layoutMode, popoverAnchorId } = useLayout();
|
|
19
|
+
const attended = useAttended();
|
|
19
20
|
|
|
20
21
|
const activeIds = useMemo(() => {
|
|
21
22
|
if (layoutMode === 'solo') {
|
|
@@ -31,9 +32,9 @@ export const Sidebar = ({ attention, layoutParts }: SidebarProps) => {
|
|
|
31
32
|
() => ({
|
|
32
33
|
popoverAnchorId,
|
|
33
34
|
activeIds,
|
|
34
|
-
attended
|
|
35
|
+
attended,
|
|
35
36
|
}),
|
|
36
|
-
[popoverAnchorId, activeIds,
|
|
37
|
+
[popoverAnchorId, activeIds, attended],
|
|
37
38
|
);
|
|
38
39
|
return (
|
|
39
40
|
<Main.NavigationSidebar>
|
|
@@ -9,10 +9,18 @@ import { mainPadding, mx } from '@dxos/react-ui-theme';
|
|
|
9
9
|
|
|
10
10
|
import { useMainSize } from '../../hooks';
|
|
11
11
|
|
|
12
|
-
export const StatusBar = () => {
|
|
12
|
+
export const StatusBar = ({ showHints }: { showHints?: boolean }) => {
|
|
13
13
|
const sizeAttrs = useMainSize();
|
|
14
14
|
return (
|
|
15
|
-
<div
|
|
15
|
+
<div
|
|
16
|
+
role='none'
|
|
17
|
+
{...sizeAttrs}
|
|
18
|
+
className={mx(
|
|
19
|
+
'fixed flex justify-between block-end-0 inset-inline-0 items-center border-bs border-separator z-[2]',
|
|
20
|
+
mainPadding,
|
|
21
|
+
)}
|
|
22
|
+
>
|
|
23
|
+
<div role='none'>{showHints && <Surface role='hints' limit={1} />}</div>
|
|
16
24
|
<Surface role='status-bar' limit={1} />
|
|
17
25
|
</div>
|
|
18
26
|
);
|
|
@@ -61,25 +61,22 @@ export const LayoutSettings = ({ settings }: { settings: DeckSettingsProps }) =>
|
|
|
61
61
|
</Select.Portal>
|
|
62
62
|
</Select.Root>
|
|
63
63
|
</SettingsValue>
|
|
64
|
-
<SettingsValue label={t('settings show
|
|
65
|
-
<Input.Switch checked={settings.
|
|
64
|
+
<SettingsValue label={t('settings show hints label')}>
|
|
65
|
+
<Input.Switch checked={settings.showHints} onCheckedChange={(checked) => (settings.showHints = checked)} />
|
|
66
66
|
</SettingsValue>
|
|
67
67
|
{!isSocket && (
|
|
68
68
|
<SettingsValue label={t('settings native redirect label')}>
|
|
69
69
|
<Input.Switch
|
|
70
70
|
checked={settings.enableNativeRedirect}
|
|
71
|
-
onCheckedChange={(checked) => (settings.enableNativeRedirect =
|
|
71
|
+
onCheckedChange={(checked) => (settings.enableNativeRedirect = checked)}
|
|
72
72
|
/>
|
|
73
73
|
</SettingsValue>
|
|
74
74
|
)}
|
|
75
75
|
<SettingsValue label={t('settings custom slots')}>
|
|
76
|
-
<Input.Switch
|
|
77
|
-
checked={settings.customSlots}
|
|
78
|
-
onCheckedChange={(checked) => (settings.customSlots = !!checked)}
|
|
79
|
-
/>
|
|
76
|
+
<Input.Switch checked={settings.customSlots} onCheckedChange={(checked) => (settings.customSlots = checked)} />
|
|
80
77
|
</SettingsValue>
|
|
81
78
|
<SettingsValue label={t('settings flat deck')}>
|
|
82
|
-
<Input.Switch checked={settings.flatDeck} onCheckedChange={(checked) => (settings.flatDeck =
|
|
79
|
+
<Input.Switch checked={settings.flatDeck} onCheckedChange={(checked) => (settings.flatDeck = checked)} />
|
|
83
80
|
</SettingsValue>
|
|
84
81
|
</>
|
|
85
82
|
);
|
package/src/hooks/useNode.ts
CHANGED
|
@@ -16,9 +16,13 @@ import { type Graph, type Node } from '@dxos/plugin-graph';
|
|
|
16
16
|
*/
|
|
17
17
|
// TODO(wittjosiah): Factor out.
|
|
18
18
|
export const useNode = <T = any>(graph: Graph, id?: string, timeout?: number): Node<T> | undefined => {
|
|
19
|
-
const [nodeState, setNodeState] = useState<Node<T> | undefined>(id ? graph.findNode(id) : undefined);
|
|
19
|
+
const [nodeState, setNodeState] = useState<Node<T> | undefined>(id ? graph.findNode(id, false) : undefined);
|
|
20
20
|
|
|
21
21
|
useEffect(() => {
|
|
22
|
+
if (!id && nodeState) {
|
|
23
|
+
setNodeState(undefined);
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
if (nodeState?.id === id || !id) {
|
|
23
27
|
return;
|
|
24
28
|
}
|
package/src/layout.ts
CHANGED
package/src/meta.ts
CHANGED
package/src/translations.ts
CHANGED
|
@@ -16,7 +16,7 @@ export default [
|
|
|
16
16
|
'content fallback description':
|
|
17
17
|
'No plugin had a response for the address you navigated to. Double-check the URL, and ensure you’ve enabled a plugin that supports the object.',
|
|
18
18
|
'toggle fullscreen label': 'Toggle fullscreen',
|
|
19
|
-
'settings show
|
|
19
|
+
'settings show hints label': 'Show hints',
|
|
20
20
|
'settings native redirect label': 'Enable native url redirect (experimental)',
|
|
21
21
|
'settings custom slots': 'Theme option (experimental)',
|
|
22
22
|
'settings new plank position start label': 'Start',
|
|
@@ -41,6 +41,8 @@ export default [
|
|
|
41
41
|
'settings overscroll centering label': 'Centering',
|
|
42
42
|
'settings overscroll none label': 'None',
|
|
43
43
|
'settings flat deck': 'Flatten deck appearance',
|
|
44
|
+
'comments label': 'Show Comments',
|
|
45
|
+
'settings label': 'Show Settings',
|
|
44
46
|
},
|
|
45
47
|
},
|
|
46
48
|
},
|
package/src/types.ts
CHANGED
|
@@ -20,7 +20,7 @@ export const OverscrollOptions = ['none', 'centering'] as const;
|
|
|
20
20
|
export type Overscroll = (typeof OverscrollOptions)[number];
|
|
21
21
|
|
|
22
22
|
export type DeckSettingsProps = {
|
|
23
|
-
|
|
23
|
+
showHints: boolean;
|
|
24
24
|
customSlots: boolean;
|
|
25
25
|
flatDeck: boolean;
|
|
26
26
|
enableNativeRedirect: boolean;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/meta.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport const DECK_PLUGIN = 'dxos.org/plugin/deck';\n\nexport default {\n id: DECK_PLUGIN,\n name: 'Deck',\n};\n"],
|
|
5
|
-
"mappings": ";AAIO,IAAMA,cAAc;AAE3B,IAAA,eAAe;EACbC,IAAID;EACJE,MAAM;AACR;",
|
|
6
|
-
"names": ["DECK_PLUGIN", "id", "name"]
|
|
7
|
-
}
|