@dxos/plugin-status-bar 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731

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.
Files changed (118) hide show
  1. package/LICENSE +102 -5
  2. package/README.md +1 -1
  3. package/dist/lib/neutral/StatusBarActions-ZW4NBUYE.mjs +8 -0
  4. package/dist/lib/neutral/StatusBarPanel-4VTSCYUZ.mjs +20 -0
  5. package/dist/lib/{browser/StatusBarPanel-XZVJPCWU.mjs.map → neutral/StatusBarPanel-4VTSCYUZ.mjs.map} +4 -4
  6. package/dist/lib/neutral/StatusBarPlugin.mjs +17 -0
  7. package/dist/lib/neutral/StatusBarPlugin.mjs.map +7 -0
  8. package/dist/lib/neutral/VersionNumber-KFAOZTYT.mjs +7 -0
  9. package/dist/lib/neutral/capabilities/index.mjs +7 -0
  10. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  11. package/dist/lib/neutral/chunk-JK45L5QY.mjs +42 -0
  12. package/dist/lib/neutral/chunk-JK45L5QY.mjs.map +7 -0
  13. package/dist/lib/{browser/chunk-ZLQTB7JW.mjs → neutral/chunk-ME6QGIWK.mjs} +11 -5
  14. package/dist/lib/neutral/chunk-ME6QGIWK.mjs.map +7 -0
  15. package/dist/lib/neutral/chunk-R4HDO3RK.mjs +18 -0
  16. package/dist/lib/neutral/chunk-R4HDO3RK.mjs.map +7 -0
  17. package/dist/lib/{browser/chunk-CBR3FWPA.mjs → neutral/components/index.mjs} +10 -11
  18. package/dist/lib/neutral/components/index.mjs.map +7 -0
  19. package/dist/lib/neutral/containers/index.mjs +11 -0
  20. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  21. package/dist/lib/neutral/index.mjs +7 -0
  22. package/dist/lib/neutral/meta.json +1 -0
  23. package/dist/lib/neutral/meta.mjs +7 -0
  24. package/dist/lib/neutral/plugin.mjs +11 -0
  25. package/dist/lib/neutral/plugin.mjs.map +7 -0
  26. package/dist/lib/neutral/react-surface-QZCA6YHG.mjs +27 -0
  27. package/dist/lib/neutral/react-surface-QZCA6YHG.mjs.map +7 -0
  28. package/dist/lib/neutral/translations.mjs +16 -0
  29. package/dist/lib/neutral/translations.mjs.map +7 -0
  30. package/dist/types/src/StatusBarPlugin.d.ts +1 -0
  31. package/dist/types/src/StatusBarPlugin.d.ts.map +1 -1
  32. package/dist/types/src/StatusBarPlugin.test.d.ts +2 -0
  33. package/dist/types/src/StatusBarPlugin.test.d.ts.map +1 -0
  34. package/dist/types/src/capabilities/index.d.ts +2 -1
  35. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  36. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  37. package/dist/types/src/components/StatusBar/StatusBar.d.ts +6 -4
  38. package/dist/types/src/components/StatusBar/StatusBar.d.ts.map +1 -1
  39. package/dist/types/src/components/StatusBar/StatusBar.stories.d.ts +3 -1
  40. package/dist/types/src/components/StatusBar/StatusBar.stories.d.ts.map +1 -1
  41. package/dist/types/src/containers/StatusBarActions/StatusBarActions.d.ts.map +1 -1
  42. package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts +7 -0
  43. package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts.map +1 -0
  44. package/dist/types/src/containers/StatusBarActions/index.d.ts +1 -2
  45. package/dist/types/src/containers/StatusBarActions/index.d.ts.map +1 -1
  46. package/dist/types/src/containers/StatusBarPanel/StatusBarPanel.d.ts.map +1 -1
  47. package/dist/types/src/containers/StatusBarPanel/index.d.ts +1 -2
  48. package/dist/types/src/containers/StatusBarPanel/index.d.ts.map +1 -1
  49. package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts +1 -1
  50. package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts.map +1 -1
  51. package/dist/types/src/containers/VersionNumber/index.d.ts +1 -2
  52. package/dist/types/src/containers/VersionNumber/index.d.ts.map +1 -1
  53. package/dist/types/src/index.d.ts +0 -2
  54. package/dist/types/src/index.d.ts.map +1 -1
  55. package/dist/types/src/meta.d.ts +1 -1
  56. package/dist/types/src/meta.d.ts.map +1 -1
  57. package/dist/types/src/plugin.d.ts +3 -0
  58. package/dist/types/src/plugin.d.ts.map +1 -0
  59. package/dist/types/src/translations.d.ts +3 -12
  60. package/dist/types/src/translations.d.ts.map +1 -1
  61. package/dist/types/tsconfig.tsbuildinfo +1 -1
  62. package/package.json +69 -28
  63. package/src/StatusBarPlugin.test.ts +23 -0
  64. package/src/StatusBarPlugin.ts +5 -3
  65. package/src/capabilities/index.ts +3 -1
  66. package/src/capabilities/{react-surface/react-surface.tsx → react-surface.tsx} +5 -11
  67. package/src/components/StatusBar/StatusBar.stories.tsx +18 -18
  68. package/src/components/StatusBar/StatusBar.tsx +41 -19
  69. package/src/containers/StatusBarActions/StatusBarActions.stories.tsx +62 -0
  70. package/src/containers/StatusBarActions/StatusBarActions.tsx +5 -52
  71. package/src/containers/StatusBarActions/index.ts +1 -3
  72. package/src/containers/StatusBarPanel/index.ts +1 -3
  73. package/src/containers/VersionNumber/VersionNumber.tsx +26 -66
  74. package/src/containers/VersionNumber/index.ts +1 -3
  75. package/src/index.ts +1 -2
  76. package/src/meta.ts +7 -4
  77. package/src/plugin.ts +9 -0
  78. package/src/translations.ts +3 -11
  79. package/dist/lib/browser/StatusBarActions-BRVVPEEG.mjs +0 -10
  80. package/dist/lib/browser/StatusBarPanel-XZVJPCWU.mjs +0 -25
  81. package/dist/lib/browser/VersionNumber-ZGCPBPIS.mjs +0 -9
  82. package/dist/lib/browser/chunk-CBR3FWPA.mjs.map +0 -7
  83. package/dist/lib/browser/chunk-WGX4Y2HL.mjs +0 -77
  84. package/dist/lib/browser/chunk-WGX4Y2HL.mjs.map +0 -7
  85. package/dist/lib/browser/chunk-Z6FIFYEN.mjs +0 -75
  86. package/dist/lib/browser/chunk-Z6FIFYEN.mjs.map +0 -7
  87. package/dist/lib/browser/chunk-ZLQTB7JW.mjs.map +0 -7
  88. package/dist/lib/browser/index.mjs +0 -47
  89. package/dist/lib/browser/index.mjs.map +0 -7
  90. package/dist/lib/browser/meta.json +0 -1
  91. package/dist/lib/browser/react-surface-DXEY2TXA.mjs +0 -45
  92. package/dist/lib/browser/react-surface-DXEY2TXA.mjs.map +0 -7
  93. package/dist/lib/node-esm/StatusBarActions-IOUACULG.mjs +0 -11
  94. package/dist/lib/node-esm/StatusBarPanel-QXPK2H6L.mjs +0 -26
  95. package/dist/lib/node-esm/StatusBarPanel-QXPK2H6L.mjs.map +0 -7
  96. package/dist/lib/node-esm/VersionNumber-I3UEXYOZ.mjs +0 -10
  97. package/dist/lib/node-esm/chunk-26OCEWVE.mjs +0 -18
  98. package/dist/lib/node-esm/chunk-26OCEWVE.mjs.map +0 -7
  99. package/dist/lib/node-esm/chunk-5W6CY5X3.mjs +0 -78
  100. package/dist/lib/node-esm/chunk-5W6CY5X3.mjs.map +0 -7
  101. package/dist/lib/node-esm/chunk-6H3PSUS5.mjs +0 -76
  102. package/dist/lib/node-esm/chunk-6H3PSUS5.mjs.map +0 -7
  103. package/dist/lib/node-esm/chunk-B4UMHTV6.mjs +0 -51
  104. package/dist/lib/node-esm/chunk-B4UMHTV6.mjs.map +0 -7
  105. package/dist/lib/node-esm/index.mjs +0 -48
  106. package/dist/lib/node-esm/index.mjs.map +0 -7
  107. package/dist/lib/node-esm/meta.json +0 -1
  108. package/dist/lib/node-esm/react-surface-LAOVAKPZ.mjs +0 -46
  109. package/dist/lib/node-esm/react-surface-LAOVAKPZ.mjs.map +0 -7
  110. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  111. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  112. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  113. package/src/capabilities/react-surface/index.ts +0 -7
  114. /package/dist/lib/{browser/StatusBarActions-BRVVPEEG.mjs.map → neutral/StatusBarActions-ZW4NBUYE.mjs.map} +0 -0
  115. /package/dist/lib/{browser/VersionNumber-ZGCPBPIS.mjs.map → neutral/VersionNumber-KFAOZTYT.mjs.map} +0 -0
  116. /package/dist/lib/{node-esm/StatusBarActions-IOUACULG.mjs.map → neutral/index.mjs.map} +0 -0
  117. /package/dist/lib/{node-esm/VersionNumber-I3UEXYOZ.mjs.map → neutral/meta.mjs.map} +0 -0
  118. /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dxos/plugin-status-bar",
3
- "version": "0.8.4-main.c85a9c8dae",
3
+ "version": "0.8.4-main.d9fc60f731",
4
4
  "description": "Status bar plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
@@ -8,59 +8,100 @@
8
8
  "type": "git",
9
9
  "url": "https://github.com/dxos/dxos"
10
10
  },
11
- "license": "MIT",
11
+ "license": "FSL-1.1-Apache-2.0",
12
12
  "author": "DXOS.org",
13
13
  "sideEffects": true,
14
14
  "type": "module",
15
+ "imports": {
16
+ "#capabilities": {
17
+ "source": "./src/capabilities/index.ts",
18
+ "types": "./dist/types/src/capabilities/index.d.ts",
19
+ "default": "./dist/lib/neutral/capabilities/index.mjs"
20
+ },
21
+ "#components": {
22
+ "source": "./src/components/index.ts",
23
+ "types": "./dist/types/src/components/index.d.ts",
24
+ "default": "./dist/lib/neutral/components/index.mjs"
25
+ },
26
+ "#containers": {
27
+ "source": "./src/containers/index.ts",
28
+ "types": "./dist/types/src/containers/index.d.ts",
29
+ "default": "./dist/lib/neutral/containers/index.mjs"
30
+ },
31
+ "#meta": {
32
+ "source": "./src/meta.ts",
33
+ "types": "./dist/types/src/meta.d.ts",
34
+ "default": "./dist/lib/neutral/meta.mjs"
35
+ },
36
+ "#plugin": {
37
+ "source": "./src/StatusBarPlugin.ts",
38
+ "types": "./dist/types/src/StatusBarPlugin.d.ts",
39
+ "default": "./dist/lib/neutral/StatusBarPlugin.mjs"
40
+ },
41
+ "#translations": {
42
+ "source": "./src/translations.ts",
43
+ "types": "./dist/types/src/translations.d.ts",
44
+ "default": "./dist/lib/neutral/translations.mjs"
45
+ }
46
+ },
15
47
  "exports": {
16
48
  ".": {
17
49
  "source": "./src/index.ts",
18
50
  "types": "./dist/types/src/index.d.ts",
19
- "browser": "./dist/lib/browser/index.mjs",
20
- "node": "./dist/lib/node-esm/index.mjs"
51
+ "default": "./dist/lib/neutral/index.mjs"
52
+ },
53
+ "./components": {
54
+ "source": "./src/components/index.ts",
55
+ "types": "./dist/types/src/components/index.d.ts",
56
+ "default": "./dist/lib/neutral/components/index.mjs"
57
+ },
58
+ "./plugin": {
59
+ "source": "./src/plugin.ts",
60
+ "types": "./dist/types/src/plugin.d.ts",
61
+ "default": "./dist/lib/neutral/plugin.mjs"
62
+ },
63
+ "./translations": {
64
+ "source": "./src/translations.ts",
65
+ "types": "./dist/types/src/translations.d.ts",
66
+ "default": "./dist/lib/neutral/translations.mjs"
21
67
  }
22
68
  },
23
69
  "types": "dist/types/src/index.d.ts",
24
- "typesVersions": {
25
- "*": {}
26
- },
27
70
  "files": [
28
71
  "dist",
29
72
  "src"
30
73
  ],
31
74
  "dependencies": {
32
- "@fluentui/react-tabster": "9.26.11",
33
75
  "@radix-ui/react-slot": "1.1.2",
34
- "date-fns": "^3.3.1",
35
- "effect": "3.19.16",
36
- "react-resize-detector": "^11.0.1",
37
- "@dxos/app-framework": "0.8.4-main.c85a9c8dae",
38
- "@dxos/app-toolkit": "0.8.4-main.c85a9c8dae",
39
- "@dxos/async": "0.8.4-main.c85a9c8dae",
40
- "@dxos/echo": "0.8.4-main.c85a9c8dae",
41
- "@dxos/operation": "0.8.4-main.c85a9c8dae",
42
- "@dxos/react-client": "0.8.4-main.c85a9c8dae",
43
- "@dxos/plugin-observability": "0.8.4-main.c85a9c8dae",
44
- "@dxos/util": "0.8.4-main.c85a9c8dae",
45
- "@dxos/react-ui-form": "0.8.4-main.c85a9c8dae",
46
- "@dxos/schema": "0.8.4-main.c85a9c8dae"
76
+ "date-fns": "^3.6.0",
77
+ "effect": "3.21.2",
78
+ "@dxos/app-framework": "0.8.4-main.d9fc60f731",
79
+ "@dxos/async": "0.8.4-main.d9fc60f731",
80
+ "@dxos/echo": "0.8.4-main.d9fc60f731",
81
+ "@dxos/app-toolkit": "0.8.4-main.d9fc60f731",
82
+ "@dxos/operation": "0.8.4-main.d9fc60f731",
83
+ "@dxos/keys": "0.8.4-main.d9fc60f731",
84
+ "@dxos/react-client": "0.8.4-main.d9fc60f731",
85
+ "@dxos/util": "0.8.4-main.d9fc60f731",
86
+ "@dxos/plugin-observability": "0.8.4-main.d9fc60f731"
47
87
  },
48
88
  "devDependencies": {
49
89
  "@types/react": "~19.2.7",
50
90
  "@types/react-dom": "~19.2.3",
51
91
  "react": "~19.2.3",
52
92
  "react-dom": "~19.2.3",
53
- "vite": "^7.1.11",
54
- "@dxos/react-ui": "0.8.4-main.c85a9c8dae",
55
- "@dxos/storybook-utils": "0.8.4-main.c85a9c8dae",
56
- "@dxos/ui-theme": "0.8.4-main.c85a9c8dae"
93
+ "vite": "^8.0.14",
94
+ "@dxos/react-ui": "0.8.4-main.d9fc60f731",
95
+ "@dxos/ui-theme": "0.8.4-main.d9fc60f731",
96
+ "@dxos/storybook-utils": "0.8.4-main.d9fc60f731",
97
+ "@dxos/plugin-testing": "0.8.4-main.d9fc60f731"
57
98
  },
58
99
  "peerDependencies": {
59
- "effect": "3.19.16",
100
+ "effect": "3.21.2",
60
101
  "react": "~19.2.3",
61
102
  "react-dom": "~19.2.3",
62
- "@dxos/ui-theme": "0.8.4-main.c85a9c8dae",
63
- "@dxos/react-ui": "0.8.4-main.c85a9c8dae"
103
+ "@dxos/react-ui": "0.8.4-main.d9fc60f731",
104
+ "@dxos/ui-theme": "0.8.4-main.d9fc60f731"
64
105
  },
65
106
  "publishConfig": {
66
107
  "access": "public"
@@ -0,0 +1,23 @@
1
+ //
2
+ // Copyright 2026 DXOS.org
3
+ //
4
+
5
+ import { describe, test } from 'vitest';
6
+
7
+ import { createComposerTestApp } from '@dxos/plugin-testing/harness';
8
+
9
+ import { StatusBarPlugin } from '#plugin';
10
+
11
+ import { meta } from './meta';
12
+
13
+ const moduleId = (name: string) => `${meta.id}.module.${name}`;
14
+
15
+ describe('StatusBarPlugin', () => {
16
+ test('modules activate on the expected events', async ({ expect }) => {
17
+ await using harness = await createComposerTestApp({
18
+ plugins: [StatusBarPlugin()],
19
+ });
20
+
21
+ expect(harness.manager.getActive()).toContain(moduleId('ReactSurface'));
22
+ });
23
+ });
@@ -5,12 +5,14 @@
5
5
  import { Plugin } from '@dxos/app-framework';
6
6
  import { AppPlugin } from '@dxos/app-toolkit';
7
7
 
8
- import { ReactSurface } from './capabilities';
9
- import { meta } from './meta';
10
- import { translations } from './translations';
8
+ import { ReactSurface } from '#capabilities';
9
+ import { meta } from '#meta';
10
+ import { translations } from '#translations';
11
11
 
12
12
  export const StatusBarPlugin = Plugin.define(meta).pipe(
13
13
  AppPlugin.addSurfaceModule({ activate: ReactSurface }),
14
14
  AppPlugin.addTranslationsModule({ translations }),
15
15
  Plugin.make,
16
16
  );
17
+
18
+ export default StatusBarPlugin;
@@ -2,4 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './react-surface';
5
+ import { Capability } from '@dxos/app-framework';
6
+
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -8,30 +8,24 @@ import React from 'react';
8
8
  import { Capabilities, Capability } from '@dxos/app-framework';
9
9
  import { Surface } from '@dxos/app-framework/ui';
10
10
 
11
- import { StatusBarActions, StatusBarPanel, VersionNumber } from '../../containers';
12
- import { meta } from '../../meta';
11
+ import { StatusBarActions, StatusBarPanel, VersionNumber } from '#containers';
13
12
 
14
13
  export default Capability.makeModule(() =>
15
14
  Effect.succeed(
16
15
  Capability.contributes(Capabilities.ReactSurface, [
17
16
  Surface.create({
18
- id: `${meta.id}/status-bar`,
17
+ id: 'statusBar',
19
18
  role: 'status-bar',
20
19
  component: () => <StatusBarPanel />,
21
20
  }),
22
21
  Surface.create({
23
- id: `${meta.id}/status-bar--r0-footer`,
24
- role: 'status-bar--r0-footer',
25
- component: () => <Surface.Surface role='status' />,
26
- }),
27
- Surface.create({
28
- id: `${meta.id}/status-bar--r1-footer`,
22
+ id: 'statusBarFooter',
29
23
  role: 'status-bar--r1-footer',
30
24
  component: () => <StatusBarActions />,
31
25
  }),
32
26
  Surface.create({
33
- id: `${meta.id}/header-end`,
34
- role: 'header-end',
27
+ id: 'versionInfo',
28
+ role: 'version-info',
35
29
  component: () => <VersionNumber />,
36
30
  }),
37
31
  ]),
@@ -5,30 +5,27 @@
5
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
6
  import React from 'react';
7
7
 
8
- import { Icon } from '@dxos/react-ui';
8
+ import { Icon, IconButton } from '@dxos/react-ui';
9
9
  import { withTheme } from '@dxos/react-ui/testing';
10
10
 
11
11
  import { StatusBar } from './index';
12
12
 
13
- export const DefaultStory = () => (
14
- <div>
15
- <StatusBar.EndContent>
13
+ const DefaultStory = () => (
14
+ <StatusBar.EndContent>
15
+ <StatusBar.Button>
16
+ <Icon icon='ph--mailbox--regular' />
17
+ <StatusBar.Text>Quick feedback</StatusBar.Text>
18
+ </StatusBar.Button>
19
+ <a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>
16
20
  <StatusBar.Button>
17
- <Icon icon='ph--mailbox--regular' size={4} />
18
- <StatusBar.Text>Quick feedback</StatusBar.Text>
21
+ <Icon icon='ph--discord-logo--regular' />
22
+ <StatusBar.Text>Join us on Discord</StatusBar.Text>
19
23
  </StatusBar.Button>
20
- <a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>
21
- <StatusBar.Button>
22
- <Icon icon='ph--discord-logo--regular' size={4} />
23
- <StatusBar.Text>Join us on Discord</StatusBar.Text>
24
- </StatusBar.Button>
25
- </a>
26
- <StatusBar.Item>
27
- <Icon icon='ph--lightning--regular' size={4} />
28
- <StatusBar.Text>Online</StatusBar.Text>
29
- </StatusBar.Item>
30
- </StatusBar.EndContent>
31
- </div>
24
+ </a>
25
+ <StatusBar.Item>
26
+ <IconButton variant='ghost' icon='ph--lightning--regular' iconOnly label='Online' />
27
+ </StatusBar.Item>
28
+ </StatusBar.EndContent>
32
29
  );
33
30
 
34
31
  const meta = {
@@ -36,6 +33,9 @@ const meta = {
36
33
  component: StatusBar as any,
37
34
  render: DefaultStory,
38
35
  decorators: [withTheme()],
36
+ parameters: {
37
+ layout: 'centered',
38
+ },
39
39
  } satisfies Meta<typeof StatusBar>;
40
40
 
41
41
  export default meta;
@@ -8,6 +8,26 @@ import React, { type ComponentPropsWithRef, type PropsWithChildren, type ReactNo
8
8
  import { type ThemedClassName } from '@dxos/react-ui';
9
9
  import { mx } from '@dxos/ui-theme';
10
10
 
11
+ //
12
+ // Item
13
+ //
14
+
15
+ type StatusBarItemProps = ThemedClassName<PropsWithChildren>;
16
+
17
+ const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
18
+ ({ classNames, children, ...props }, forwardedRef) => {
19
+ return (
20
+ <div {...props} role='status' className={mx('grid place-items-center', classNames)} ref={forwardedRef}>
21
+ {children}
22
+ </div>
23
+ );
24
+ },
25
+ );
26
+
27
+ //
28
+ // Text
29
+ //
30
+
11
31
  type StatusBarTextProps = ThemedClassName<{ children: ReactNode }>;
12
32
 
13
33
  const StatusBarText = forwardRef<HTMLSpanElement, StatusBarTextProps>(({ classNames, children }, forwardedRef) => (
@@ -16,8 +36,15 @@ const StatusBarText = forwardRef<HTMLSpanElement, StatusBarTextProps>(({ classNa
16
36
  </span>
17
37
  ));
18
38
 
39
+ //
40
+ // Button
41
+ //
42
+
19
43
  type StatusBarButtonProps = ThemedClassName<ComponentPropsWithRef<'button'> & { asChild?: boolean }>;
20
44
 
45
+ /**
46
+ * @deprecated
47
+ */
21
48
  const StatusBarButton = forwardRef<HTMLButtonElement, StatusBarButtonProps>(
22
49
  ({ classNames, children, asChild, ...props }, forwardedRef) => {
23
50
  const classes = mx(
@@ -39,42 +66,37 @@ const StatusBarButton = forwardRef<HTMLButtonElement, StatusBarButtonProps>(
39
66
  },
40
67
  );
41
68
 
42
- export default StatusBarButton;
43
-
44
- type StatusBarItemProps = ThemedClassName<ComponentPropsWithRef<'div'>>;
45
-
46
- const StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(
47
- ({ classNames, children, ...props }, forwardedRef) => (
48
- <div
49
- role='menuitem'
50
- className={mx('flex items-center justify-center gap-2 p-1 px-2 rounded-xs select-none', classNames)}
51
- ref={forwardedRef}
52
- {...props}
53
- >
54
- {children}
55
- </div>
56
- ),
57
- );
69
+ //
70
+ // Content
71
+ //
58
72
 
59
73
  type StartContentProps = ThemedClassName<PropsWithChildren<{}>>;
60
74
 
61
75
  const StartContent = forwardRef<HTMLDivElement, StartContentProps>(({ classNames, children }, forwardedRef) => (
62
- <div role='none' className={mx('flex-grow flex items-center space-x-2', classNames)} ref={forwardedRef}>
76
+ <div className={mx('flex-grow flex items-center space-x-2', classNames)} ref={forwardedRef}>
63
77
  {children}
64
78
  </div>
65
79
  ));
66
80
 
81
+ //
82
+ // EndContent
83
+ //
84
+
67
85
  type EndContentProps = ThemedClassName<PropsWithChildren<{}>>;
68
86
 
69
87
  const EndContent = forwardRef<HTMLDivElement, EndContentProps>(({ classNames, children }, forwardedRef) => (
70
- <div role='none' className={mx('flex-grow flex items-center justify-end', classNames)} ref={forwardedRef}>
88
+ <div className={mx('flex-grow flex items-center justify-end', classNames)} ref={forwardedRef}>
71
89
  {children}
72
90
  </div>
73
91
  ));
74
92
 
93
+ //
94
+ // StatusBar
95
+ //
96
+
75
97
  export const StatusBar = {
76
- Text: StatusBarText,
77
98
  Item: StatusBarItem,
99
+ Text: StatusBarText,
78
100
  Button: StatusBarButton,
79
101
  StartContent,
80
102
  EndContent,
@@ -0,0 +1,62 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+
7
+ import { Config } from '@dxos/react-client';
8
+ import { withClientProvider } from '@dxos/react-client/testing';
9
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
10
+
11
+ import { translations } from '#translations';
12
+
13
+ import { StatusBarActions } from './StatusBarActions';
14
+
15
+ const meta: Meta<typeof StatusBarActions> = {
16
+ title: 'plugins/plugin-status-bar/containers/StatusBarActions',
17
+ component: StatusBarActions,
18
+ decorators: [
19
+ withTheme(),
20
+ withLayout({
21
+ layout: 'centered',
22
+ classNames: 'w-[calc(var(--dx-complementary-sidebar-size)_-_var(--dx-rail-content))]',
23
+ }),
24
+ withClientProvider({
25
+ config: new Config({
26
+ version: 1,
27
+ runtime: {
28
+ client: {
29
+ storage: {
30
+ persistent: false,
31
+ },
32
+ },
33
+ app: {
34
+ build: {
35
+ version: '0.8.3-beta.b78990fdd5',
36
+ timestamp: '2024-06-01T12:00:00.000Z',
37
+ commitHash: 'b78990fdd5',
38
+ },
39
+ env: {
40
+ DX_ENVIRONMENT: 'development',
41
+ },
42
+ },
43
+ services: {
44
+ edge: {
45
+ url: 'https://edge-dev.dxos.org',
46
+ },
47
+ },
48
+ },
49
+ }),
50
+ }),
51
+ ],
52
+ parameters: {
53
+ layout: 'centered',
54
+ translations,
55
+ },
56
+ };
57
+
58
+ export default meta;
59
+
60
+ type Story = StoryObj<typeof meta>;
61
+
62
+ export const Default: Story = {};
@@ -2,65 +2,18 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import React, { useState } from 'react';
5
+ import React from 'react';
6
6
 
7
- import { useConfig } from '@dxos/react-client';
8
- import { Icon, Popover, useTranslation } from '@dxos/react-ui';
9
-
10
- import { StatusBar } from '../../components';
11
- import { meta } from '../../meta';
12
7
  import VersionNumber from '../VersionNumber';
13
8
 
14
9
  export type StatusBarActionsProps = {};
15
10
 
16
11
  export const StatusBarActions = (_props: StatusBarActionsProps) => {
17
- const { t } = useTranslation(meta.id);
18
- const [open, setOpen] = useState(false);
19
-
20
12
  return (
21
- <Popover.Root open={open} onOpenChange={setOpen}>
22
- <EnvironmentLabel />
13
+ <div className='h-full flex items-center px-2 gap-2'>
23
14
  <VersionNumber />
24
- <StatusBar.Button asChild>
25
- <a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>
26
- <Icon icon='ph--discord-logo--regular' size={4} />
27
- <StatusBar.Text classNames='hidden sm:block'>{t('discord label')}</StatusBar.Text>
28
- </a>
29
- </StatusBar.Button>
30
- <StatusBar.Button asChild>
31
- <a href='https://github.com/dxos/dxos' target='_blank' rel='noopener noreferrer'>
32
- <Icon icon='ph--github-logo--regular' size={4} />
33
- <StatusBar.Text classNames='hidden sm:block'>{t('github label')}</StatusBar.Text>
34
- </a>
35
- </StatusBar.Button>
36
- </Popover.Root>
37
- );
38
- };
39
-
40
- const ENV_LABELS: Record<string, string> = {
41
- 'edge-dev': 'Dev',
42
- 'edge-main': 'Main',
43
- 'edge-labs': 'Labs',
44
- 'edge-production': 'Production',
45
- };
46
-
47
- const EnvironmentLabel = () => {
48
- const config = useConfig();
49
- const edgeUrl = config.values.runtime?.services?.edge?.url;
50
- if (!edgeUrl) {
51
- return null;
52
- }
53
- const part = new URL(edgeUrl).host.split('.')[0];
54
- const edgeEnv = ENV_LABELS[part];
55
- if (!edgeEnv) {
56
- return null;
57
- }
58
-
59
- return (
60
- <StatusBar.Item>
61
- <StatusBar.Text classNames='text-xs text-subdued border border-separator rounded-full px-1'>
62
- <span title={edgeEnv}>{edgeEnv[0]}</span>
63
- </StatusBar.Text>
64
- </StatusBar.Item>
15
+ <div className='grow' />
16
+ {/* TODO(burdon): Show EDGE service status? */}
17
+ </div>
65
18
  );
66
19
  };
@@ -2,6 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { StatusBarActions } from './StatusBarActions';
6
-
7
- export default StatusBarActions;
5
+ export { StatusBarActions as default } from './StatusBarActions';
@@ -2,6 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { StatusBarPanel } from './StatusBarPanel';
6
-
7
- export default StatusBarPanel;
5
+ export { StatusBarPanel as default } from './StatusBarPanel';
@@ -2,85 +2,45 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { formatDistance } from 'date-fns/formatDistance';
5
+ import { formatDistance, isValid } from 'date-fns';
6
6
  import React from 'react';
7
7
 
8
8
  import { useConfig } from '@dxos/react-client';
9
- import { Icon, Link, Message, Popover, Trans, useTranslation } from '@dxos/react-ui';
9
+ import { Tooltip, useTranslation } from '@dxos/react-ui';
10
10
 
11
- import { StatusBar } from '../../components';
12
- import { meta } from '../../meta';
11
+ import { StatusBar } from '#components';
12
+ import { meta } from '#meta';
13
13
 
14
14
  export type VersionNumberProps = {};
15
15
 
16
- const repo = 'https://github.com/dxos/dxos';
17
-
18
16
  const VERSION_REGEX = /([\d.]+)/;
19
17
 
20
18
  export const VersionNumber = (_props: VersionNumberProps) => {
21
19
  const { t } = useTranslation(meta.id);
22
20
  const config = useConfig();
23
- const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
24
- const [_, v] = version?.match(VERSION_REGEX) ?? [];
25
- const isLabs = config.values.runtime?.app?.env?.DX_LABS;
26
-
27
- const releaseUrl =
28
- config.values.runtime?.app?.env?.DX_ENVIRONMENT === 'production'
29
- ? `${repo}/releases/tag/v${version}`
30
- : `${repo}/commit/${commitHash}`;
31
-
32
- const previewUrl = 'https://docs.dxos.org/composer#technology-preview';
21
+ const { version, timestamp } = config.values.runtime?.app?.build ?? {};
22
+ const [_, short] = version?.match(VERSION_REGEX) ?? [];
23
+
24
+ if (!short) {
25
+ return null;
26
+ }
27
+
28
+ const releasedAt = timestamp ? new Date(timestamp) : undefined;
29
+ const released =
30
+ releasedAt && isValid(releasedAt)
31
+ ? t('released.message', { released: formatDistance(releasedAt, new Date(), { addSuffix: true }) })
32
+ : undefined;
33
+
34
+ const content = (
35
+ <div className='flex flex-col items-start gap-0.5'>
36
+ <span className='font-mono'>{version}</span>
37
+ {released && <span className='text-xs'>{released}</span>}
38
+ </div>
39
+ );
33
40
 
34
41
  return (
35
- <Popover.Root>
36
- <Popover.Trigger asChild>
37
- <StatusBar.Button classNames='text-xs'>{isLabs ? version : v}</StatusBar.Button>
38
- </Popover.Trigger>
39
- <Popover.Portal>
40
- <Popover.Content
41
- side='top'
42
- role='message'
43
- classNames='z-[12] bg-warning-500 max-w-[min(calc(100vw-16px),40ch)]'
44
- >
45
- <Message.Root valence='warning' classNames='rounded-b-none p-5'>
46
- <Message.Title>{t('warning title')}</Message.Title>
47
- <Message.Content>
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='dx-icon-inline ms-1' />
53
- </Link>
54
- </Message.Content>
55
- </Message.Root>
56
- <div role='none' className='py-4 px-5 space-b-2 text-base-surface-text'>
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='dx-icon-inline ms-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>
42
+ <Tooltip.Trigger asChild content={content} side='top'>
43
+ <StatusBar.Button classNames='h-full text-xs'>{short}</StatusBar.Button>
44
+ </Tooltip.Trigger>
85
45
  );
86
46
  };
@@ -2,6 +2,4 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { VersionNumber } from './VersionNumber';
6
-
7
- export default VersionNumber;
5
+ export { VersionNumber as default } from './VersionNumber';
package/src/index.ts CHANGED
@@ -2,6 +2,5 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- export * from './components';
5
+ // TODO(wittjosiah): StatusBar should be factored out of plugin-status-bar into a shared UI package.
6
6
  export * from './meta';
7
- export * from './StatusBarPlugin';