@dxos/plugin-status-bar 0.7.5-labs.e27f9b9 → 0.7.5-main.2567c87
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/index.mjs +43 -121
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +31 -108
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +43 -121
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/StatusBarPlugin.d.ts.map +1 -1
- package/dist/types/src/components/StatusBar.d.ts +24 -10
- package/dist/types/src/components/StatusBar.d.ts.map +1 -1
- package/dist/types/src/components/StatusBarPanel.d.ts +0 -1
- package/dist/types/src/components/StatusBarPanel.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +15 -17
- package/src/StatusBarPlugin.tsx +6 -25
- package/src/components/StatusBar.stories.tsx +2 -2
- package/src/components/StatusBar.tsx +34 -8
- package/src/components/StatusBarPanel.tsx +26 -35
- package/src/translations.ts +2 -18
- package/dist/types/src/components/VersionNumber.d.ts +0 -3
- package/dist/types/src/components/VersionNumber.d.ts.map +0 -1
- package/src/components/VersionNumber.tsx +0 -86
package/src/StatusBarPlugin.tsx
CHANGED
|
@@ -4,19 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
Capabilities,
|
|
9
|
-
contributes,
|
|
10
|
-
createSurface,
|
|
11
|
-
defineModule,
|
|
12
|
-
definePlugin,
|
|
13
|
-
Events,
|
|
14
|
-
Surface,
|
|
15
|
-
} from '@dxos/app-framework';
|
|
7
|
+
import { Capabilities, contributes, createSurface, defineModule, definePlugin, Events } from '@dxos/app-framework';
|
|
16
8
|
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { meta, STATUS_BAR_PLUGIN } from './meta';
|
|
9
|
+
import { StatusBarPanel } from './components';
|
|
10
|
+
import { meta } from './meta';
|
|
20
11
|
import translations from './translations';
|
|
21
12
|
|
|
22
13
|
export const StatusBarPlugin = () =>
|
|
@@ -28,7 +19,7 @@ export const StatusBarPlugin = () =>
|
|
|
28
19
|
}),
|
|
29
20
|
defineModule({
|
|
30
21
|
id: `${meta.id}/module/react-surface`,
|
|
31
|
-
activatesOn: Events.
|
|
22
|
+
activatesOn: Events.Startup,
|
|
32
23
|
activate: () =>
|
|
33
24
|
contributes(Capabilities.ReactSurface, [
|
|
34
25
|
createSurface({
|
|
@@ -38,18 +29,8 @@ export const StatusBarPlugin = () =>
|
|
|
38
29
|
}),
|
|
39
30
|
createSurface({
|
|
40
31
|
id: meta.id,
|
|
41
|
-
role: 'status-bar--
|
|
42
|
-
component: () => <
|
|
43
|
-
}),
|
|
44
|
-
createSurface({
|
|
45
|
-
id: meta.id,
|
|
46
|
-
role: 'status-bar--r1-footer',
|
|
47
|
-
component: () => <StatusBarActions />,
|
|
48
|
-
}),
|
|
49
|
-
createSurface({
|
|
50
|
-
id: `${STATUS_BAR_PLUGIN}/header-end`,
|
|
51
|
-
role: 'header-end',
|
|
52
|
-
component: () => <VersionNumber />,
|
|
32
|
+
role: 'status-bar--sidebar-footer',
|
|
33
|
+
component: () => <StatusBarPanel />,
|
|
53
34
|
}),
|
|
54
35
|
]),
|
|
55
36
|
}),
|
|
@@ -13,7 +13,7 @@ import { withTheme } from '@dxos/storybook-utils';
|
|
|
13
13
|
import { StatusBar } from './StatusBar';
|
|
14
14
|
|
|
15
15
|
export const DefaultStory = () => (
|
|
16
|
-
<
|
|
16
|
+
<StatusBar.Container>
|
|
17
17
|
<StatusBar.EndContent>
|
|
18
18
|
<StatusBar.Button>
|
|
19
19
|
<Icon icon='ph--mailbox--regular' size={4} />
|
|
@@ -30,7 +30,7 @@ export const DefaultStory = () => (
|
|
|
30
30
|
<StatusBar.Text>Online</StatusBar.Text>
|
|
31
31
|
</StatusBar.Item>
|
|
32
32
|
</StatusBar.EndContent>
|
|
33
|
-
</
|
|
33
|
+
</StatusBar.Container>
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
export const Default = {};
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { useFocusableGroup } from '@fluentui/react-tabster';
|
|
5
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
6
|
-
import React, {
|
|
7
|
+
import React, { forwardRef, type HTMLAttributes, type ReactNode } from 'react';
|
|
7
8
|
|
|
8
9
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
9
10
|
import { mx } from '@dxos/react-ui-theme';
|
|
@@ -16,13 +17,14 @@ const StatusBarText = forwardRef<HTMLSpanElement, StatusBarTextProps>(({ classNa
|
|
|
16
17
|
</span>
|
|
17
18
|
));
|
|
18
19
|
|
|
19
|
-
type StatusBarButtonProps = ThemedClassName<
|
|
20
|
+
type StatusBarButtonProps = ThemedClassName<{ children: ReactNode; asChild?: boolean }> &
|
|
21
|
+
HTMLAttributes<HTMLButtonElement>;
|
|
20
22
|
|
|
21
23
|
const StatusBarButton = forwardRef<HTMLButtonElement, StatusBarButtonProps>(
|
|
22
24
|
({ classNames, children, asChild, ...props }, forwardedRef) => {
|
|
23
25
|
const classes = mx(
|
|
24
|
-
'flex items-center
|
|
25
|
-
'select-none cursor-pointer
|
|
26
|
+
'flex items-center gap-2 p-1 px-2 rounded-sm',
|
|
27
|
+
'select-none cursor-pointer ch-focus-ring',
|
|
26
28
|
'hover:bg-neutral-75 active:bg-neutral-150 dark:hover:bg-neutral-750 dark:active:bg-neutral-700',
|
|
27
29
|
classNames,
|
|
28
30
|
);
|
|
@@ -41,13 +43,13 @@ const StatusBarButton = forwardRef<HTMLButtonElement, StatusBarButtonProps>(
|
|
|
41
43
|
|
|
42
44
|
export default StatusBarButton;
|
|
43
45
|
|
|
44
|
-
type StatusBarItemProps = ThemedClassName<
|
|
46
|
+
type StatusBarItemProps = ThemedClassName<{ children: ReactNode }> & HTMLAttributes<HTMLDivElement>;
|
|
45
47
|
|
|
46
48
|
const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
|
|
47
49
|
({ classNames, children, ...props }, forwardedRef) => (
|
|
48
50
|
<div
|
|
49
51
|
role='menuitem'
|
|
50
|
-
className={mx('flex items-center
|
|
52
|
+
className={mx('flex items-center gap-2 p-1 px-2 rounded-sm select-none', classNames)}
|
|
51
53
|
ref={forwardedRef}
|
|
52
54
|
{...props}
|
|
53
55
|
>
|
|
@@ -56,7 +58,30 @@ const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
|
|
|
56
58
|
),
|
|
57
59
|
);
|
|
58
60
|
|
|
59
|
-
type
|
|
61
|
+
type StatusBarContainerProps = ThemedClassName<{ children: ReactNode }>;
|
|
62
|
+
|
|
63
|
+
// TODO(zan): tabable group with tabster.
|
|
64
|
+
const StatusBarContainer = forwardRef<HTMLDivElement, StatusBarContainerProps>(
|
|
65
|
+
({ classNames, children }, forwardedRef) => {
|
|
66
|
+
const groupAttrs = useFocusableGroup({ tabBehavior: 'limited' });
|
|
67
|
+
return (
|
|
68
|
+
<div
|
|
69
|
+
role='menubar'
|
|
70
|
+
tabIndex={0}
|
|
71
|
+
{...groupAttrs}
|
|
72
|
+
className={mx(
|
|
73
|
+
'bs-[--statusbar-size] flex justify-end items-center gap-2 bg-base text-description text-lg pointer-fine:text-xs ch-focus-ring-inset',
|
|
74
|
+
classNames,
|
|
75
|
+
)}
|
|
76
|
+
ref={forwardedRef}
|
|
77
|
+
>
|
|
78
|
+
{children}
|
|
79
|
+
</div>
|
|
80
|
+
);
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
type StartContentProps = ThemedClassName<{ children: ReactNode }>;
|
|
60
85
|
|
|
61
86
|
const StartContent = forwardRef<HTMLDivElement, StartContentProps>(({ classNames, children }, forwardedRef) => (
|
|
62
87
|
<div role='none' className={mx('flex-grow flex items-center space-x-2', classNames)} ref={forwardedRef}>
|
|
@@ -64,7 +89,7 @@ const StartContent = forwardRef<HTMLDivElement, StartContentProps>(({ classNames
|
|
|
64
89
|
</div>
|
|
65
90
|
));
|
|
66
91
|
|
|
67
|
-
type EndContentProps = ThemedClassName<
|
|
92
|
+
type EndContentProps = ThemedClassName<{ children: ReactNode }>;
|
|
68
93
|
|
|
69
94
|
const EndContent = forwardRef<HTMLDivElement, EndContentProps>(({ classNames, children }, forwardedRef) => (
|
|
70
95
|
<div role='none' className={mx('flex-grow flex items-center justify-end', classNames)} ref={forwardedRef}>
|
|
@@ -73,6 +98,7 @@ const EndContent = forwardRef<HTMLDivElement, EndContentProps>(({ classNames, ch
|
|
|
73
98
|
));
|
|
74
99
|
|
|
75
100
|
export const StatusBar = {
|
|
101
|
+
Container: StatusBarContainer,
|
|
76
102
|
Text: StatusBarText,
|
|
77
103
|
Item: StatusBarItem,
|
|
78
104
|
Button: StatusBarButton,
|
|
@@ -5,48 +5,39 @@
|
|
|
5
5
|
import React, { useState } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Surface } from '@dxos/app-framework';
|
|
8
|
-
import { Icon, Popover
|
|
8
|
+
import { Icon, Popover } from '@dxos/react-ui';
|
|
9
9
|
|
|
10
10
|
import { FeedbackForm } from './FeedbackForm';
|
|
11
11
|
import { StatusBar } from './StatusBar';
|
|
12
|
-
import { VersionNumber } from './VersionNumber';
|
|
13
|
-
import { STATUS_BAR_PLUGIN } from '../meta';
|
|
14
12
|
|
|
15
|
-
export const
|
|
16
|
-
const { t } = useTranslation(STATUS_BAR_PLUGIN);
|
|
13
|
+
export const StatusBarPanel = () => {
|
|
17
14
|
const [open, setOpen] = useState(false);
|
|
15
|
+
|
|
16
|
+
// TODO(wittjosiah): Factor out feedback and discord buttons.
|
|
18
17
|
return (
|
|
19
18
|
<Popover.Root open={open} onOpenChange={setOpen}>
|
|
20
|
-
<
|
|
21
|
-
<StatusBar.
|
|
22
|
-
<
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<StatusBar.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
19
|
+
<StatusBar.Container>
|
|
20
|
+
<StatusBar.EndContent>
|
|
21
|
+
<Surface role='status' />
|
|
22
|
+
<Popover.Trigger asChild>
|
|
23
|
+
<StatusBar.Button aria-label='Give feedback about composer' data-joyride='welcome/feedback'>
|
|
24
|
+
<Icon icon='ph--paper-plane-tilt--regular' size={4} />
|
|
25
|
+
<StatusBar.Text classNames='hidden sm:block'>Feedback</StatusBar.Text>
|
|
26
|
+
</StatusBar.Button>
|
|
27
|
+
</Popover.Trigger>
|
|
28
|
+
{/* TODO(zan): Configure this label? */}
|
|
29
|
+
<StatusBar.Button aria-label='Open DXOS Discord' asChild>
|
|
30
|
+
<a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>
|
|
31
|
+
<Icon icon='ph--discord-logo--regular' size={4} />
|
|
32
|
+
<StatusBar.Text classNames='hidden sm:block'>Discord</StatusBar.Text>
|
|
33
|
+
</a>
|
|
34
|
+
</StatusBar.Button>
|
|
35
|
+
</StatusBar.EndContent>
|
|
36
|
+
</StatusBar.Container>
|
|
37
|
+
<Popover.Content classNames='shadow-lg'>
|
|
38
|
+
<FeedbackForm onClose={() => setOpen(false)} />
|
|
39
|
+
<Popover.Arrow />
|
|
40
|
+
</Popover.Content>
|
|
40
41
|
</Popover.Root>
|
|
41
42
|
);
|
|
42
43
|
};
|
|
43
|
-
|
|
44
|
-
export const StatusBarPanel = () => {
|
|
45
|
-
return (
|
|
46
|
-
<>
|
|
47
|
-
<StatusBarActions />
|
|
48
|
-
<span role='separator' className='grow' />
|
|
49
|
-
<Surface role='status' />
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
};
|
package/src/translations.ts
CHANGED
|
@@ -14,15 +14,7 @@ type StatusBarTranslationKeys =
|
|
|
14
14
|
| 'feedback text area placeholder'
|
|
15
15
|
| 'send feedback label'
|
|
16
16
|
| 'name label'
|
|
17
|
-
| 'name placeholder'
|
|
18
|
-
| 'warning title'
|
|
19
|
-
| 'technology preview message'
|
|
20
|
-
| 'learn more label'
|
|
21
|
-
| 'released message'
|
|
22
|
-
| 'see release label'
|
|
23
|
-
| 'powered by dxos message'
|
|
24
|
-
| 'discord label'
|
|
25
|
-
| 'feedback label';
|
|
17
|
+
| 'name placeholder';
|
|
26
18
|
|
|
27
19
|
type RequiredTranslation = { [key in StatusBarTranslationKeys]: string };
|
|
28
20
|
type TranslationEntry = { [STATUS_BAR_PLUGIN]: RequiredTranslation };
|
|
@@ -40,16 +32,8 @@ const translations: Record<Language, TranslationEntry> = {
|
|
|
40
32
|
'email input label': 'Email',
|
|
41
33
|
'email input placeholder': 'hello@example.com',
|
|
42
34
|
'feedback text area label': 'Feedback',
|
|
43
|
-
'feedback text area placeholder': '
|
|
35
|
+
'feedback text area placeholder': 'Found a bug? Have a suggestion? Let us know!',
|
|
44
36
|
'send feedback label': 'Send Feedback',
|
|
45
|
-
'warning title': 'WARNING',
|
|
46
|
-
'technology preview message': 'Composer is still in technology preview.',
|
|
47
|
-
'learn more label': 'Learn more',
|
|
48
|
-
'released message': 'This version released {{released}}.',
|
|
49
|
-
'see release label': 'See release on GitHub',
|
|
50
|
-
'powered by dxos message': 'Powered by <dxos>DXOS</dxos>',
|
|
51
|
-
'discord label': 'Discord',
|
|
52
|
-
'feedback label': 'Feedback',
|
|
53
37
|
}),
|
|
54
38
|
};
|
|
55
39
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"VersionNumber.d.ts","sourceRoot":"","sources":["../../../../src/components/VersionNumber.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,eAAO,MAAM,aAAa,yBAoEzB,CAAC"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { formatDistance } from 'date-fns/formatDistance';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { useConfig } from '@dxos/react-client';
|
|
9
|
-
import { Link, Message, Popover, Trans, useTranslation, Icon } from '@dxos/react-ui';
|
|
10
|
-
|
|
11
|
-
import { StatusBar } from './StatusBar';
|
|
12
|
-
import { STATUS_BAR_PLUGIN } from '../meta';
|
|
13
|
-
|
|
14
|
-
const repo = 'https://github.com/dxos/dxos';
|
|
15
|
-
|
|
16
|
-
const VERSION_REGEX = /([\d.]+)/;
|
|
17
|
-
|
|
18
|
-
export const VersionNumber = () => {
|
|
19
|
-
const config = useConfig();
|
|
20
|
-
const { t } = useTranslation(STATUS_BAR_PLUGIN);
|
|
21
|
-
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
22
|
-
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
23
|
-
|
|
24
|
-
const releaseUrl =
|
|
25
|
-
config.values.runtime?.app?.env?.DX_ENVIRONMENT === 'production'
|
|
26
|
-
? `${repo}/releases/tag/v${version}`
|
|
27
|
-
: `${repo}/commit/${commitHash}`;
|
|
28
|
-
|
|
29
|
-
const previewUrl = 'https://docs.dxos.org/composer#technology-preview';
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
<Popover.Root>
|
|
33
|
-
<Popover.Trigger asChild>
|
|
34
|
-
<StatusBar.Button classNames='text-xs'>v{v}</StatusBar.Button>
|
|
35
|
-
</Popover.Trigger>
|
|
36
|
-
<Popover.Portal>
|
|
37
|
-
<Popover.Content
|
|
38
|
-
side='top'
|
|
39
|
-
role='message'
|
|
40
|
-
classNames='z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]'
|
|
41
|
-
>
|
|
42
|
-
<Message.Root valence='warning' className='rounded-be-none p-5'>
|
|
43
|
-
<Message.Title>
|
|
44
|
-
<Icon icon='ph--warning--duotone' size={6} classNames='inline mie-2' />
|
|
45
|
-
<span>{t('warning title')}</span>
|
|
46
|
-
</Message.Title>
|
|
47
|
-
<Message.Body>
|
|
48
|
-
{t('technology preview message')}
|
|
49
|
-
<br />
|
|
50
|
-
<Link href={previewUrl} target='_blank' rel='noreferrer' variant='neutral'>
|
|
51
|
-
{t('learn more label')}
|
|
52
|
-
<Icon icon='ph--arrow-square-out--bold' classNames='inline mis-1' />
|
|
53
|
-
</Link>
|
|
54
|
-
</Message.Body>
|
|
55
|
-
</Message.Root>
|
|
56
|
-
<div role='none' className='plb-4 pli-5 space-b-2 text-baseText'>
|
|
57
|
-
{timestamp && (
|
|
58
|
-
<p>
|
|
59
|
-
{t('released message', {
|
|
60
|
-
released: formatDistance(new Date(timestamp), new Date(), { addSuffix: true }),
|
|
61
|
-
})}
|
|
62
|
-
<br />
|
|
63
|
-
<Link href={releaseUrl} target='_blank' rel='noreferrer' variant='neutral'>
|
|
64
|
-
{t('see release label')}
|
|
65
|
-
<Icon icon='ph--arrow-square-out--bold' classNames='inline mis-1' />
|
|
66
|
-
</Link>
|
|
67
|
-
</p>
|
|
68
|
-
)}
|
|
69
|
-
<p>
|
|
70
|
-
<Trans
|
|
71
|
-
{...{
|
|
72
|
-
t,
|
|
73
|
-
i18nKey: 'powered by dxos message',
|
|
74
|
-
components: {
|
|
75
|
-
dxos: <Link href='https://dxos.org' target='_blank' rel='noreferrer' variant='neutral' />,
|
|
76
|
-
},
|
|
77
|
-
}}
|
|
78
|
-
/>
|
|
79
|
-
</p>
|
|
80
|
-
</div>
|
|
81
|
-
<Popover.Arrow />
|
|
82
|
-
</Popover.Content>
|
|
83
|
-
</Popover.Portal>
|
|
84
|
-
</Popover.Root>
|
|
85
|
-
);
|
|
86
|
-
};
|