@dxos/plugin-deck 0.8.4-main.67995b8 → 0.8.4-main.a4bbb77
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-7SR53CCK.mjs} +14 -14
- package/dist/lib/browser/app-graph-builder-7SR53CCK.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-QDZO4AJ4.mjs → chunk-7CL25AYA.mjs} +15 -15
- package/dist/lib/browser/chunk-7CL25AYA.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-MHP4GPX5.mjs +11 -0
- package/dist/lib/browser/chunk-MHP4GPX5.mjs.map +7 -0
- package/dist/lib/browser/{chunk-D7KTFCUV.mjs → chunk-QHJ7N7BF.mjs} +217 -213
- package/dist/lib/browser/chunk-QHJ7N7BF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-F5BQOOEG.mjs → chunk-VSJ7FFQS.mjs} +4 -4
- package/dist/lib/browser/chunk-VSJ7FFQS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JFTXENFN.mjs → chunk-WOCUNO27.mjs} +9 -9
- package/dist/lib/browser/chunk-WOCUNO27.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +19 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-P2OBK5HK.mjs → intent-resolver-Y5YOA4NR.mjs} +16 -16
- package/dist/lib/browser/intent-resolver-Y5YOA4NR.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-root-PO64J7ML.mjs → react-root-A537NMT6.mjs} +11 -11
- package/dist/lib/browser/react-root-A537NMT6.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-E45YOVF5.mjs → react-surface-DAS4HS3Y.mjs} +13 -13
- package/dist/lib/browser/react-surface-DAS4HS3Y.mjs.map +7 -0
- package/dist/lib/browser/{settings-6AJZPZPM.mjs → settings-3642GPOR.mjs} +5 -5
- package/dist/lib/browser/{settings-6AJZPZPM.mjs.map → settings-3642GPOR.mjs.map} +2 -2
- package/dist/lib/browser/state-MKKK3WGD.mjs +12 -0
- package/dist/lib/browser/toolkit-UPUBQIYU.mjs +61 -0
- package/dist/lib/browser/toolkit-UPUBQIYU.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +2 -2
- package/dist/lib/browser/{url-handler-7L7M6IKH.mjs → url-handler-354LL74P.mjs} +7 -7
- package/dist/lib/browser/url-handler-354LL74P.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/state.d.ts +2 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/capabilities/toolkit.d.ts +5 -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.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 +85 -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/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 +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +2 -2
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -45
- package/src/DeckPlugin.ts +64 -59
- package/src/capabilities/app-graph-builder.ts +10 -9
- 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 +16 -15
- package/src/capabilities/react-root.tsx +4 -3
- package/src/capabilities/react-surface.tsx +5 -5
- package/src/capabilities/settings.ts +1 -1
- package/src/capabilities/state.ts +6 -5
- package/src/capabilities/toolkit.ts +55 -0
- package/src/capabilities/tools.ts +9 -6
- 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.tsx +15 -14
- package/src/components/DeckLayout/Fallback.tsx +2 -2
- package/src/components/DeckLayout/Toast.tsx +2 -2
- package/src/components/DeckSettings/DeckSettings.tsx +74 -65
- package/src/components/Plank/Plank.stories.tsx +9 -10
- package/src/components/Plank/Plank.tsx +7 -6
- 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 +2 -2
- package/src/hooks/useNodeActionExpander.ts +1 -1
- package/src/meta.ts +1 -3
- package/src/translations.ts +1 -0
- package/src/types/schema.ts +2 -2
- 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-MKKK3WGD.mjs.map} +0 -0
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities,
|
|
5
|
+
import { Capabilities, LayoutAction, type PluginContext, contributes, createIntent } from '@dxos/app-framework';
|
|
6
6
|
import { scheduledEffect } from '@dxos/echo-signals/core';
|
|
7
7
|
|
|
8
|
-
import { DeckCapabilities } from './capabilities';
|
|
9
8
|
import { defaultDeck } from '../types';
|
|
10
9
|
|
|
10
|
+
import { DeckCapabilities } from './capabilities';
|
|
11
|
+
|
|
11
12
|
// TODO(wittjosiah): Cleanup the url handling. May justify introducing routing capabilities.
|
|
12
13
|
export default async (context: PluginContext) => {
|
|
13
14
|
const { dispatchPromise: dispatch } = context.getCapability(Capabilities.IntentDispatcher);
|
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Surface } from '@dxos/app-framework';
|
|
8
|
-
import {
|
|
8
|
+
import { type ThemedClassName, useTranslation } from '@dxos/react-ui';
|
|
9
9
|
import { mx } from '@dxos/react-ui-theme';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from '../../meta';
|
|
12
12
|
import { CloseSidebarButton, ToggleSidebarButton } from '../Sidebar';
|
|
13
13
|
|
|
14
14
|
export const Banner = ({ variant, classNames }: ThemedClassName<{ variant?: 'topbar' | 'sidebar' }>) => {
|
|
15
|
-
const { t } = useTranslation(
|
|
15
|
+
const { t } = useTranslation(meta.id);
|
|
16
16
|
return (
|
|
17
17
|
<header
|
|
18
18
|
className={mx(
|
|
@@ -10,8 +10,8 @@ import { DeckCapabilities } from '../../capabilities';
|
|
|
10
10
|
import { useBreakpoints } from '../../hooks';
|
|
11
11
|
import { getMode } from '../../types';
|
|
12
12
|
import { layoutAppliesTopbar } from '../../util';
|
|
13
|
-
import { ToggleSidebarButton } from '../Sidebar';
|
|
14
13
|
import { fixedSidebarToggleStyles } from '../fragments';
|
|
14
|
+
import { ToggleSidebarButton } from '../Sidebar';
|
|
15
15
|
|
|
16
16
|
export const ContentEmpty = () => {
|
|
17
17
|
const breakpoint = useBreakpoints();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { untracked } from '@preact/signals-core';
|
|
6
|
-
import React, { useCallback, useEffect, useMemo, useRef
|
|
6
|
+
import React, { Fragment, type UIEvent, useCallback, useEffect, useMemo, useRef } from 'react';
|
|
7
7
|
|
|
8
8
|
import {
|
|
9
9
|
Capabilities,
|
|
@@ -15,9 +15,18 @@ import {
|
|
|
15
15
|
} from '@dxos/app-framework';
|
|
16
16
|
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
17
17
|
import { Main, type MainProps, useMediaQuery, useOnTransition } from '@dxos/react-ui';
|
|
18
|
-
import { Stack, StackContext
|
|
18
|
+
import { DEFAULT_HORIZONTAL_SIZE, Stack, StackContext } from '@dxos/react-ui-stack';
|
|
19
19
|
import { mainPaddingTransitions } from '@dxos/react-ui-theme';
|
|
20
20
|
|
|
21
|
+
import { DeckCapabilities } from '../../capabilities';
|
|
22
|
+
import { useBreakpoints, useHoistStatusbar } from '../../hooks';
|
|
23
|
+
import { meta } from '../../meta';
|
|
24
|
+
import { type DeckSettingsProps, getMode } from '../../types';
|
|
25
|
+
import { calculateOverscroll, layoutAppliesTopbar } from '../../util';
|
|
26
|
+
import { fixedComplementarySidebarToggleStyles, fixedSidebarToggleStyles } from '../fragments';
|
|
27
|
+
import { Plank } from '../Plank';
|
|
28
|
+
import { ComplementarySidebar, Sidebar, ToggleComplementarySidebarButton, ToggleSidebarButton } from '../Sidebar';
|
|
29
|
+
|
|
21
30
|
import { ActiveNode } from './ActiveNode';
|
|
22
31
|
import { ContentEmpty } from './ContentEmpty';
|
|
23
32
|
import { Dialog } from './Dialog';
|
|
@@ -25,14 +34,6 @@ import { PopoverContent, PopoverRoot } from './Popover';
|
|
|
25
34
|
import { StatusBar } from './StatusBar';
|
|
26
35
|
import { Toast } from './Toast';
|
|
27
36
|
import { Topbar } from './Topbar';
|
|
28
|
-
import { DeckCapabilities } from '../../capabilities';
|
|
29
|
-
import { useBreakpoints, useHoistStatusbar } from '../../hooks';
|
|
30
|
-
import { DECK_PLUGIN } from '../../meta';
|
|
31
|
-
import { type DeckSettingsProps, getMode } from '../../types';
|
|
32
|
-
import { calculateOverscroll, layoutAppliesTopbar } from '../../util';
|
|
33
|
-
import { Plank } from '../Plank';
|
|
34
|
-
import { ComplementarySidebar, Sidebar, ToggleComplementarySidebarButton, ToggleSidebarButton } from '../Sidebar';
|
|
35
|
-
import { fixedComplementarySidebarToggleStyles, fixedSidebarToggleStyles } from '../fragments';
|
|
36
37
|
|
|
37
38
|
export type DeckLayoutProps = {
|
|
38
39
|
onDismissToast: (id: string) => void;
|
|
@@ -43,7 +44,7 @@ const PlankSeparator = ({ order }: { order: number }) =>
|
|
|
43
44
|
|
|
44
45
|
export const DeckLayout = ({ onDismissToast }: DeckLayoutProps) => {
|
|
45
46
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
46
|
-
const settings = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(
|
|
47
|
+
const settings = useCapability(Capabilities.SettingsStore).getStore<DeckSettingsProps>(meta.id)!.value;
|
|
47
48
|
const context = useCapability(DeckCapabilities.MutableDeckState);
|
|
48
49
|
const { sidebarState, complementarySidebarState, complementarySidebarPanel, deck, toasts } = context;
|
|
49
50
|
const { active, activeCompanions, fullscreen, solo, plankSizing } = deck;
|
|
@@ -53,7 +54,7 @@ export const DeckLayout = ({ onDismissToast }: DeckLayoutProps) => {
|
|
|
53
54
|
const hoistStatusbar = useHoistStatusbar(breakpoint, layoutMode);
|
|
54
55
|
const pluginManager = usePluginManager();
|
|
55
56
|
|
|
56
|
-
const scrollLeftRef = useRef<number
|
|
57
|
+
const scrollLeftRef = useRef<number>(null);
|
|
57
58
|
const deckRef = useRef<HTMLDivElement>(null);
|
|
58
59
|
|
|
59
60
|
// Ensure the first plank is attended when the deck is first rendered.
|
|
@@ -216,7 +217,7 @@ export const DeckLayout = ({ onDismissToast }: DeckLayoutProps) => {
|
|
|
216
217
|
<div
|
|
217
218
|
role='none'
|
|
218
219
|
className={!solo ? 'relative bg-deckSurface overflow-hidden' : 'sr-only'}
|
|
219
|
-
{...(solo && { inert:
|
|
220
|
+
{...(solo && { inert: true })}
|
|
220
221
|
>
|
|
221
222
|
{!topbar && !fullscreen && <ToggleSidebarButton classNames={fixedSidebarToggleStyles} />}
|
|
222
223
|
{!topbar && !fullscreen && (
|
|
@@ -250,7 +251,7 @@ export const DeckLayout = ({ onDismissToast }: DeckLayoutProps) => {
|
|
|
250
251
|
<div
|
|
251
252
|
role='none'
|
|
252
253
|
className={solo ? 'relative bg-deckSurface overflow-hidden' : 'sr-only'}
|
|
253
|
-
{...(!solo && { inert:
|
|
254
|
+
{...(!solo && { inert: true })}
|
|
254
255
|
>
|
|
255
256
|
{!topbar && !fullscreen && <ToggleSidebarButton classNames={fixedSidebarToggleStyles} />}
|
|
256
257
|
{!topbar && !fullscreen && (
|
|
@@ -7,10 +7,10 @@ import React from 'react';
|
|
|
7
7
|
import { useTranslation } from '@dxos/react-ui';
|
|
8
8
|
import { errorText, mx } from '@dxos/react-ui-theme';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
11
|
|
|
12
12
|
export const Fallback = () => {
|
|
13
|
-
const { t } = useTranslation(
|
|
13
|
+
const { t } = useTranslation(meta.id);
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<div role='none' className='min-bs-screen is-full flex items-center justify-center p-8'>
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
useTranslation,
|
|
15
15
|
} from '@dxos/react-ui';
|
|
16
16
|
|
|
17
|
-
import {
|
|
17
|
+
import { meta } from '../../meta';
|
|
18
18
|
|
|
19
19
|
// TODO(wittjosiah): Render remaining duration as a progress bar within the toast.
|
|
20
20
|
export const Toast = ({
|
|
@@ -29,7 +29,7 @@ export const Toast = ({
|
|
|
29
29
|
onAction,
|
|
30
30
|
onOpenChange,
|
|
31
31
|
}: LayoutAction.Toast & Pick<ToastRootProps, 'onOpenChange'>) => {
|
|
32
|
-
const { t } = useTranslation(
|
|
32
|
+
const { t } = useTranslation(meta.id);
|
|
33
33
|
|
|
34
34
|
return (
|
|
35
35
|
<NaturalToast.Root data-testid={id} defaultOpen duration={duration} onOpenChange={onOpenChange}>
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
8
|
+
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { meta } from '../../meta';
|
|
11
11
|
import {
|
|
12
12
|
type DeckSettingsProps,
|
|
13
13
|
type NewPlankPositioning,
|
|
@@ -19,70 +19,79 @@ import {
|
|
|
19
19
|
const isSocket = !!(globalThis as any).__args;
|
|
20
20
|
|
|
21
21
|
export const DeckSettings = ({ settings }: { settings: DeckSettingsProps }) => {
|
|
22
|
-
const { t } = useTranslation(
|
|
22
|
+
const { t } = useTranslation(meta.id);
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<
|
|
26
|
-
<
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
25
|
+
<ControlPage>
|
|
26
|
+
<ControlSection title={t('settings title', { ns: meta.id })}>
|
|
27
|
+
<ControlGroup>
|
|
28
|
+
<ControlItemInput title={t('settings enable deck label')}>
|
|
29
|
+
<Input.Switch
|
|
30
|
+
checked={settings.enableDeck}
|
|
31
|
+
onCheckedChange={(checked) => (settings.enableDeck = checked)}
|
|
32
|
+
/>
|
|
33
|
+
</ControlItemInput>
|
|
34
|
+
<ControlItemInput title={t('select new plank positioning label')}>
|
|
35
|
+
<Select.Root
|
|
36
|
+
disabled={!settings.enableDeck}
|
|
37
|
+
value={settings.newPlankPositioning ?? 'start'}
|
|
38
|
+
onValueChange={(value) => (settings.newPlankPositioning = value as NewPlankPositioning)}
|
|
39
|
+
>
|
|
40
|
+
<Select.TriggerButton placeholder={t('select new plank positioning placeholder')} />
|
|
41
|
+
<Select.Portal>
|
|
42
|
+
<Select.Content>
|
|
43
|
+
<Select.Viewport>
|
|
44
|
+
{NewPlankPositions.map((position) => (
|
|
45
|
+
<Select.Option key={position} value={position}>
|
|
46
|
+
{t(`settings new plank position ${position} label`)}
|
|
47
|
+
</Select.Option>
|
|
48
|
+
))}
|
|
49
|
+
</Select.Viewport>
|
|
50
|
+
<Select.Arrow />
|
|
51
|
+
</Select.Content>
|
|
52
|
+
</Select.Portal>
|
|
53
|
+
</Select.Root>
|
|
54
|
+
</ControlItemInput>
|
|
55
|
+
<ControlItemInput title={t('settings overscroll label')}>
|
|
56
|
+
<Select.Root
|
|
57
|
+
disabled={!settings.enableDeck}
|
|
58
|
+
value={settings.overscroll ?? 'none'}
|
|
59
|
+
onValueChange={(value) => (settings.overscroll = value as Overscroll)}
|
|
60
|
+
>
|
|
61
|
+
<Select.TriggerButton placeholder={t('select overscroll placeholder')} />
|
|
62
|
+
<Select.Portal>
|
|
63
|
+
<Select.Content>
|
|
64
|
+
<Select.Viewport>
|
|
65
|
+
{OverscrollOptions.map((option) => (
|
|
66
|
+
<Select.Option key={option} value={option}>
|
|
67
|
+
{t(`settings overscroll ${option} label`)}
|
|
68
|
+
</Select.Option>
|
|
69
|
+
))}
|
|
70
|
+
</Select.Viewport>
|
|
71
|
+
<Select.Arrow />
|
|
72
|
+
</Select.Content>
|
|
73
|
+
</Select.Portal>
|
|
74
|
+
</Select.Root>
|
|
75
|
+
</ControlItemInput>
|
|
76
|
+
<ControlItemInput title={t('settings enable statusbar label')}>
|
|
77
|
+
<Input.Switch
|
|
78
|
+
checked={settings.enableStatusbar}
|
|
79
|
+
onCheckedChange={(checked) => (settings.enableStatusbar = checked)}
|
|
80
|
+
/>
|
|
81
|
+
</ControlItemInput>
|
|
82
|
+
<ControlItemInput title={t('settings show hints label')}>
|
|
83
|
+
<Input.Switch checked={settings.showHints} onCheckedChange={(checked) => (settings.showHints = checked)} />
|
|
84
|
+
</ControlItemInput>
|
|
85
|
+
{!isSocket && (
|
|
86
|
+
<ControlItemInput title={t('settings native redirect label')}>
|
|
87
|
+
<Input.Switch
|
|
88
|
+
checked={settings.enableNativeRedirect}
|
|
89
|
+
onCheckedChange={(checked) => (settings.enableNativeRedirect = checked)}
|
|
90
|
+
/>
|
|
91
|
+
</ControlItemInput>
|
|
92
|
+
)}
|
|
93
|
+
</ControlGroup>
|
|
94
|
+
</ControlSection>
|
|
95
|
+
</ControlPage>
|
|
87
96
|
);
|
|
88
97
|
};
|
|
@@ -2,23 +2,22 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@
|
|
6
|
-
|
|
7
|
-
import { type StoryObj, type Meta } from '@storybook/react-vite';
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
8
6
|
import React from 'react';
|
|
9
7
|
|
|
10
8
|
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
10
|
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
13
11
|
import { GraphPlugin } from '@dxos/plugin-graph';
|
|
12
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
14
13
|
import { Stack } from '@dxos/react-ui-stack';
|
|
15
|
-
import { withTheme, withLayout } from '@dxos/storybook-utils';
|
|
16
14
|
|
|
17
|
-
import { Plank, type PlankProps } from './Plank';
|
|
18
15
|
import { DeckStateFactory } from '../../capabilities';
|
|
19
16
|
import { translations } from '../../translations';
|
|
20
17
|
|
|
21
|
-
|
|
18
|
+
import { Plank } from './Plank';
|
|
19
|
+
|
|
20
|
+
const meta = {
|
|
22
21
|
title: 'plugins/plugin-deck/Plank',
|
|
23
22
|
component: Plank,
|
|
24
23
|
render: (args) => {
|
|
@@ -29,21 +28,21 @@ const meta: Meta<PlankProps> = {
|
|
|
29
28
|
);
|
|
30
29
|
},
|
|
31
30
|
decorators: [
|
|
31
|
+
withTheme,
|
|
32
32
|
withPluginManager({
|
|
33
33
|
plugins: [AttentionPlugin(), SettingsPlugin(), IntentPlugin(), GraphPlugin()],
|
|
34
34
|
capabilities: () => DeckStateFactory(),
|
|
35
35
|
}),
|
|
36
|
-
withTheme,
|
|
37
|
-
withLayout({ fullscreen: true }),
|
|
38
36
|
],
|
|
39
37
|
parameters: {
|
|
38
|
+
layout: 'fullscreen',
|
|
40
39
|
translations,
|
|
41
40
|
},
|
|
42
|
-
}
|
|
41
|
+
} satisfies Meta<typeof Plank>;
|
|
43
42
|
|
|
44
43
|
export default meta;
|
|
45
44
|
|
|
46
|
-
type Story = StoryObj<
|
|
45
|
+
type Story = StoryObj<typeof meta>;
|
|
47
46
|
|
|
48
47
|
// TODO(burdon): Need to define surface provider?
|
|
49
48
|
export const Default: Story = {
|
|
@@ -16,23 +16,24 @@ import {
|
|
|
16
16
|
LayoutAction,
|
|
17
17
|
Surface,
|
|
18
18
|
createIntent,
|
|
19
|
-
useCapability,
|
|
20
19
|
useAppGraph,
|
|
20
|
+
useCapability,
|
|
21
21
|
useIntentDispatcher,
|
|
22
22
|
} from '@dxos/app-framework';
|
|
23
23
|
import { debounce } from '@dxos/async';
|
|
24
|
-
import {
|
|
24
|
+
import { type Node, useNode } from '@dxos/plugin-graph';
|
|
25
25
|
import { ATTENDABLE_PATH_SEPARATOR, useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
26
26
|
import { StackItem, railGridHorizontal } from '@dxos/react-ui-stack';
|
|
27
27
|
import { mainIntrinsicSize, mx } from '@dxos/react-ui-theme';
|
|
28
28
|
|
|
29
|
+
import { DeckCapabilities } from '../../capabilities';
|
|
30
|
+
import { useCompanions, useMainSize } from '../../hooks';
|
|
31
|
+
import { parseEntryId } from '../../layout';
|
|
32
|
+
import { DeckAction, type DeckSettingsProps, type LayoutMode, type ResolvedPart } from '../../types';
|
|
33
|
+
|
|
29
34
|
import { PlankContentError, PlankError } from './PlankError';
|
|
30
35
|
import { PlankHeading } from './PlankHeading';
|
|
31
36
|
import { PlankLoading } from './PlankLoading';
|
|
32
|
-
import { DeckCapabilities } from '../../capabilities';
|
|
33
|
-
import { useMainSize, useCompanions } from '../../hooks';
|
|
34
|
-
import { parseEntryId } from '../../layout';
|
|
35
|
-
import { DeckAction, type LayoutMode, type ResolvedPart, type DeckSettingsProps } from '../../types';
|
|
36
37
|
|
|
37
38
|
const UNKNOWN_ID = 'unknown_id';
|
|
38
39
|
|
|
@@ -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
|
|