@dxos/plugin-status-bar 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29

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 (116) hide show
  1. package/dist/lib/neutral/StatusBarActions-GYLT4QVU.mjs +8 -0
  2. package/dist/lib/neutral/StatusBarActions-GYLT4QVU.mjs.map +7 -0
  3. package/dist/lib/neutral/StatusBarPanel-UTQAZ7VT.mjs +20 -0
  4. package/dist/lib/neutral/StatusBarPanel-UTQAZ7VT.mjs.map +7 -0
  5. package/dist/lib/neutral/StatusBarPlugin.mjs +17 -0
  6. package/dist/lib/neutral/StatusBarPlugin.mjs.map +7 -0
  7. package/dist/lib/neutral/VersionNumber-E7DDIVTB.mjs +7 -0
  8. package/dist/lib/neutral/VersionNumber-E7DDIVTB.mjs.map +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-BHLVVHW4.mjs +19 -0
  12. package/dist/lib/neutral/chunk-BHLVVHW4.mjs.map +7 -0
  13. package/dist/lib/neutral/chunk-DV7SD4RL.mjs +71 -0
  14. package/dist/lib/neutral/chunk-DV7SD4RL.mjs.map +7 -0
  15. package/dist/lib/neutral/chunk-PQSD2QVZ.mjs +70 -0
  16. package/dist/lib/neutral/chunk-PQSD2QVZ.mjs.map +7 -0
  17. package/dist/lib/neutral/components/index.mjs +48 -0
  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/index.mjs.map +7 -0
  23. package/dist/lib/neutral/meta.json +1 -0
  24. package/dist/lib/neutral/meta.mjs +7 -0
  25. package/dist/lib/neutral/meta.mjs.map +7 -0
  26. package/dist/lib/neutral/plugin.mjs +11 -0
  27. package/dist/lib/neutral/plugin.mjs.map +7 -0
  28. package/dist/lib/neutral/react-surface-LRBTL7UM.mjs +27 -0
  29. package/dist/lib/neutral/react-surface-LRBTL7UM.mjs.map +7 -0
  30. package/dist/lib/neutral/translations.mjs +24 -0
  31. package/dist/lib/neutral/translations.mjs.map +7 -0
  32. package/dist/types/src/StatusBarPlugin.d.ts +3 -1
  33. package/dist/types/src/StatusBarPlugin.d.ts.map +1 -1
  34. package/dist/types/src/StatusBarPlugin.test.d.ts +2 -0
  35. package/dist/types/src/StatusBarPlugin.test.d.ts.map +1 -0
  36. package/dist/types/src/capabilities/index.d.ts +2 -1
  37. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  38. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  39. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  40. package/dist/types/src/components/{StatusBar.d.ts → StatusBar/StatusBar.d.ts} +9 -7
  41. package/dist/types/src/components/StatusBar/StatusBar.d.ts.map +1 -0
  42. package/dist/types/src/components/{StatusBar.stories.d.ts → StatusBar/StatusBar.stories.d.ts} +1 -5
  43. package/dist/types/src/components/StatusBar/StatusBar.stories.d.ts.map +1 -0
  44. package/dist/types/src/components/StatusBar/index.d.ts +2 -0
  45. package/dist/types/src/components/StatusBar/index.d.ts.map +1 -0
  46. package/dist/types/src/components/index.d.ts +0 -2
  47. package/dist/types/src/components/index.d.ts.map +1 -1
  48. package/dist/types/src/containers/StatusBarActions/StatusBarActions.d.ts +4 -0
  49. package/dist/types/src/containers/StatusBarActions/StatusBarActions.d.ts.map +1 -0
  50. package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts +7 -0
  51. package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts.map +1 -0
  52. package/dist/types/src/containers/StatusBarActions/index.d.ts +2 -0
  53. package/dist/types/src/containers/StatusBarActions/index.d.ts.map +1 -0
  54. package/dist/types/src/containers/StatusBarPanel/StatusBarPanel.d.ts +4 -0
  55. package/dist/types/src/containers/StatusBarPanel/StatusBarPanel.d.ts.map +1 -0
  56. package/dist/types/src/containers/StatusBarPanel/index.d.ts +2 -0
  57. package/dist/types/src/containers/StatusBarPanel/index.d.ts.map +1 -0
  58. package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts +4 -0
  59. package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts.map +1 -0
  60. package/dist/types/src/containers/VersionNumber/index.d.ts +2 -0
  61. package/dist/types/src/containers/VersionNumber/index.d.ts.map +1 -0
  62. package/dist/types/src/containers/index.d.ts +5 -0
  63. package/dist/types/src/containers/index.d.ts.map +1 -0
  64. package/dist/types/src/index.d.ts +0 -2
  65. package/dist/types/src/index.d.ts.map +1 -1
  66. package/dist/types/src/meta.d.ts +2 -3
  67. package/dist/types/src/meta.d.ts.map +1 -1
  68. package/dist/types/src/plugin.d.ts +3 -0
  69. package/dist/types/src/plugin.d.ts.map +1 -0
  70. package/dist/types/src/translations.d.ts +11 -12
  71. package/dist/types/src/translations.d.ts.map +1 -1
  72. package/dist/types/tsconfig.tsbuildinfo +1 -1
  73. package/package.json +80 -32
  74. package/src/StatusBarPlugin.test.ts +23 -0
  75. package/src/StatusBarPlugin.ts +12 -17
  76. package/src/capabilities/index.ts +2 -2
  77. package/src/capabilities/react-surface.tsx +25 -26
  78. package/src/components/StatusBar/StatusBar.stories.tsx +45 -0
  79. package/src/components/{StatusBar.tsx → StatusBar/StatusBar.tsx} +44 -22
  80. package/src/components/StatusBar/index.ts +5 -0
  81. package/src/components/index.ts +0 -2
  82. package/src/containers/StatusBarActions/StatusBarActions.stories.tsx +62 -0
  83. package/src/containers/StatusBarActions/StatusBarActions.tsx +70 -0
  84. package/src/containers/StatusBarActions/index.ts +5 -0
  85. package/src/containers/StatusBarPanel/StatusBarPanel.tsx +21 -0
  86. package/src/containers/StatusBarPanel/index.ts +5 -0
  87. package/src/containers/VersionNumber/VersionNumber.tsx +97 -0
  88. package/src/containers/VersionNumber/index.ts +5 -0
  89. package/src/containers/index.ts +9 -0
  90. package/src/index.ts +1 -2
  91. package/src/meta.ts +9 -6
  92. package/src/plugin.ts +9 -0
  93. package/src/translations.ts +11 -11
  94. package/dist/lib/browser/chunk-26XJZ3A4.mjs +0 -249
  95. package/dist/lib/browser/chunk-26XJZ3A4.mjs.map +0 -7
  96. package/dist/lib/browser/index.mjs +0 -59
  97. package/dist/lib/browser/index.mjs.map +0 -7
  98. package/dist/lib/browser/meta.json +0 -1
  99. package/dist/lib/browser/react-surface-JXHQF4JY.mjs +0 -38
  100. package/dist/lib/browser/react-surface-JXHQF4JY.mjs.map +0 -7
  101. package/dist/lib/node-esm/chunk-GH4EGFJM.mjs +0 -251
  102. package/dist/lib/node-esm/chunk-GH4EGFJM.mjs.map +0 -7
  103. package/dist/lib/node-esm/index.mjs +0 -60
  104. package/dist/lib/node-esm/index.mjs.map +0 -7
  105. package/dist/lib/node-esm/meta.json +0 -1
  106. package/dist/lib/node-esm/react-surface-N5JM5C3Z.mjs +0 -39
  107. package/dist/lib/node-esm/react-surface-N5JM5C3Z.mjs.map +0 -7
  108. package/dist/types/src/components/StatusBar.d.ts.map +0 -1
  109. package/dist/types/src/components/StatusBar.stories.d.ts.map +0 -1
  110. package/dist/types/src/components/StatusBarPanel.d.ts +0 -4
  111. package/dist/types/src/components/StatusBarPanel.d.ts.map +0 -1
  112. package/dist/types/src/components/VersionNumber.d.ts +0 -3
  113. package/dist/types/src/components/VersionNumber.d.ts.map +0 -1
  114. package/src/components/StatusBar.stories.tsx +0 -50
  115. package/src/components/StatusBarPanel.tsx +0 -76
  116. package/src/components/VersionNumber.tsx +0 -85
package/package.json CHANGED
@@ -1,62 +1,110 @@
1
1
  {
2
2
  "name": "@dxos/plugin-status-bar",
3
- "version": "0.8.4-main.dedc0f3",
3
+ "version": "0.8.4-main.dfabb4ec29",
4
4
  "description": "Status bar plugin",
5
5
  "homepage": "https://dxos.org",
6
6
  "bugs": "https://github.com/dxos/dxos/issues",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/dxos/dxos"
10
+ },
7
11
  "license": "MIT",
8
12
  "author": "DXOS.org",
9
13
  "sideEffects": true,
10
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
+ },
11
47
  "exports": {
12
48
  ".": {
13
49
  "source": "./src/index.ts",
14
50
  "types": "./dist/types/src/index.d.ts",
15
- "browser": "./dist/lib/browser/index.mjs",
16
- "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"
17
67
  }
18
68
  },
19
69
  "types": "dist/types/src/index.d.ts",
20
- "typesVersions": {
21
- "*": {}
22
- },
23
70
  "files": [
24
71
  "dist",
25
72
  "src"
26
73
  ],
27
74
  "dependencies": {
28
- "@fluentui/react-tabster": "^9.24.2",
29
- "@preact-signals/safe-react": "^0.9.0",
30
- "@preact/signals-core": "^1.9.0",
75
+ "@fluentui/react-tabster": "9.26.11",
31
76
  "@radix-ui/react-slot": "1.1.2",
32
- "date-fns": "^3.3.1",
33
- "effect": "3.17.7",
77
+ "date-fns": "^3.6.0",
78
+ "effect": "3.20.0",
34
79
  "react-resize-detector": "^11.0.1",
35
- "@dxos/app-framework": "0.8.4-main.dedc0f3",
36
- "@dxos/async": "0.8.4-main.dedc0f3",
37
- "@dxos/echo-schema": "0.8.4-main.dedc0f3",
38
- "@dxos/echo": "0.8.4-main.dedc0f3",
39
- "@dxos/plugin-observability": "0.8.4-main.dedc0f3",
40
- "@dxos/react-client": "0.8.4-main.dedc0f3",
41
- "@dxos/react-ui-form": "0.8.4-main.dedc0f3",
42
- "@dxos/schema": "0.8.4-main.dedc0f3"
80
+ "@dxos/app-toolkit": "0.8.4-main.dfabb4ec29",
81
+ "@dxos/async": "0.8.4-main.dfabb4ec29",
82
+ "@dxos/app-framework": "0.8.4-main.dfabb4ec29",
83
+ "@dxos/operation": "0.8.4-main.dfabb4ec29",
84
+ "@dxos/echo": "0.8.4-main.dfabb4ec29",
85
+ "@dxos/plugin-observability": "0.8.4-main.dfabb4ec29",
86
+ "@dxos/react-client": "0.8.4-main.dfabb4ec29",
87
+ "@dxos/react-ui-form": "0.8.4-main.dfabb4ec29",
88
+ "@dxos/util": "0.8.4-main.dfabb4ec29",
89
+ "@dxos/schema": "0.8.4-main.dfabb4ec29"
43
90
  },
44
91
  "devDependencies": {
45
- "@types/react": "~18.2.0",
46
- "@types/react-dom": "~18.2.0",
47
- "react": "~18.2.0",
48
- "react-dom": "~18.2.0",
49
- "vite": "7.1.1",
50
- "@dxos/react-ui": "0.8.4-main.dedc0f3",
51
- "@dxos/react-ui-theme": "0.8.4-main.dedc0f3",
52
- "@dxos/storybook-utils": "0.8.4-main.dedc0f3"
92
+ "@types/react": "~19.2.7",
93
+ "@types/react-dom": "~19.2.3",
94
+ "react": "~19.2.3",
95
+ "react-dom": "~19.2.3",
96
+ "vite": "^8.0.10",
97
+ "@dxos/plugin-testing": "0.8.4-main.dfabb4ec29",
98
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29",
99
+ "@dxos/ui-theme": "0.8.4-main.dfabb4ec29",
100
+ "@dxos/storybook-utils": "0.8.4-main.dfabb4ec29"
53
101
  },
54
102
  "peerDependencies": {
55
- "effect": "^3.13.3",
56
- "react": "~18.2.0",
57
- "react-dom": "~18.2.0",
58
- "@dxos/react-ui": "0.8.4-main.dedc0f3",
59
- "@dxos/react-ui-theme": "0.8.4-main.dedc0f3"
103
+ "effect": "3.20.0",
104
+ "react": "~19.2.3",
105
+ "react-dom": "~19.2.3",
106
+ "@dxos/ui-theme": "0.8.4-main.dfabb4ec29",
107
+ "@dxos/react-ui": "0.8.4-main.dfabb4ec29"
60
108
  },
61
109
  "publishConfig": {
62
110
  "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
+ });
@@ -2,22 +2,17 @@
2
2
  // Copyright 2024 DXOS.org
3
3
  //
4
4
 
5
- import { Capabilities, Events, contributes, defineModule, definePlugin } from '@dxos/app-framework';
5
+ import { Plugin } from '@dxos/app-framework';
6
+ import { AppPlugin } from '@dxos/app-toolkit';
6
7
 
7
- import { ReactSurface } from './capabilities';
8
- import { meta } from './meta';
9
- import { translations } from './translations';
8
+ import { ReactSurface } from '#capabilities';
9
+ import { meta } from '#meta';
10
+ import { translations } from '#translations';
10
11
 
11
- export const StatusBarPlugin = () =>
12
- definePlugin(meta, [
13
- defineModule({
14
- id: `${meta.id}/module/translations`,
15
- activatesOn: Events.SetupTranslations,
16
- activate: () => contributes(Capabilities.Translations, translations),
17
- }),
18
- defineModule({
19
- id: `${meta.id}/module/react-surface`,
20
- activatesOn: Events.SetupReactSurface,
21
- activate: ReactSurface,
22
- }),
23
- ]);
12
+ export const StatusBarPlugin = Plugin.define(meta).pipe(
13
+ AppPlugin.addSurfaceModule({ activate: ReactSurface }),
14
+ AppPlugin.addTranslationsModule({ translations }),
15
+ Plugin.make,
16
+ );
17
+
18
+ export default StatusBarPlugin;
@@ -2,6 +2,6 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from '@dxos/app-framework';
5
+ import { Capability } from '@dxos/app-framework';
6
6
 
7
- export const ReactSurface = lazy(() => import('./react-surface'));
7
+ export const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));
@@ -2,33 +2,32 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
+ import * as Effect from 'effect/Effect';
5
6
  import React from 'react';
6
7
 
7
- import { Capabilities, Surface, contributes, createSurface } from '@dxos/app-framework';
8
+ import { Capabilities, Capability } from '@dxos/app-framework';
9
+ import { Surface } from '@dxos/app-framework/ui';
8
10
 
9
- import { StatusBarActions, StatusBarPanel, VersionNumber } from '../components';
10
- import { meta } from '../meta';
11
+ import { StatusBarActions, StatusBarPanel, VersionNumber } from '#containers';
11
12
 
12
- export default () =>
13
- contributes(Capabilities.ReactSurface, [
14
- createSurface({
15
- id: `${meta.id}/status-bar`,
16
- role: 'status-bar',
17
- component: () => <StatusBarPanel />,
18
- }),
19
- createSurface({
20
- id: `${meta.id}/status-bar--r0-footer`,
21
- role: 'status-bar--r0-footer',
22
- component: () => <Surface role='status' />,
23
- }),
24
- createSurface({
25
- id: `${meta.id}/status-bar--r1-footer`,
26
- role: 'status-bar--r1-footer',
27
- component: () => <StatusBarActions />,
28
- }),
29
- createSurface({
30
- id: `${meta.id}/header-end`,
31
- role: 'header-end',
32
- component: () => <VersionNumber />,
33
- }),
34
- ]);
13
+ export default Capability.makeModule(() =>
14
+ Effect.succeed(
15
+ Capability.contributes(Capabilities.ReactSurface, [
16
+ Surface.create({
17
+ id: 'status-bar',
18
+ role: 'status-bar',
19
+ component: () => <StatusBarPanel />,
20
+ }),
21
+ Surface.create({
22
+ id: 'status-bar--r1-footer',
23
+ role: 'status-bar--r1-footer',
24
+ component: () => <StatusBarActions />,
25
+ }),
26
+ Surface.create({
27
+ id: 'version-info',
28
+ role: 'version-info',
29
+ component: () => <VersionNumber />,
30
+ }),
31
+ ]),
32
+ ),
33
+ );
@@ -0,0 +1,45 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import React from 'react';
7
+
8
+ import { Icon, IconButton } from '@dxos/react-ui';
9
+ import { withTheme } from '@dxos/react-ui/testing';
10
+
11
+ import { StatusBar } from './index';
12
+
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'>
20
+ <StatusBar.Button>
21
+ <Icon icon='ph--discord-logo--regular' />
22
+ <StatusBar.Text>Join us on Discord</StatusBar.Text>
23
+ </StatusBar.Button>
24
+ </a>
25
+ <StatusBar.Item>
26
+ <IconButton variant='ghost' icon='ph--lightning--regular' iconOnly label='Online' />
27
+ </StatusBar.Item>
28
+ </StatusBar.EndContent>
29
+ );
30
+
31
+ const meta = {
32
+ title: 'plugins/plugin-status-bar/components/StatusBar',
33
+ component: StatusBar as any,
34
+ render: DefaultStory,
35
+ decorators: [withTheme()],
36
+ parameters: {
37
+ layout: 'centered',
38
+ },
39
+ } satisfies Meta<typeof StatusBar>;
40
+
41
+ export default meta;
42
+
43
+ type Story = StoryObj<typeof meta>;
44
+
45
+ export const Default: Story = {};
@@ -6,7 +6,27 @@ import { Slot } from '@radix-ui/react-slot';
6
6
  import React, { type ComponentPropsWithRef, type PropsWithChildren, type ReactNode, forwardRef } from 'react';
7
7
 
8
8
  import { type ThemedClassName } from '@dxos/react-ui';
9
- import { mx } from '@dxos/react-ui-theme';
9
+ import { mx } from '@dxos/ui-theme';
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
+ //
10
30
 
11
31
  type StatusBarTextProps = ThemedClassName<{ children: ReactNode }>;
12
32
 
@@ -16,14 +36,21 @@ 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(
24
- 'flex items-center justify-center gap-2 p-1 px-2 rounded-sm',
51
+ 'flex items-center justify-center gap-2 p-1 px-2 rounded-xs',
25
52
  'select-none cursor-pointer dx-focus-ring text-description text-xs',
26
- 'hover:bg-neutral-75 active:bg-neutral-150 dark:hover:bg-neutral-750 dark:active:bg-neutral-700',
53
+ 'hover:bg-neutral-100 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-600',
27
54
  classNames,
28
55
  );
29
56
 
@@ -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-sm 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,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export * from './StatusBar';
@@ -3,5 +3,3 @@
3
3
  //
4
4
 
5
5
  export * from './StatusBar';
6
- export * from './StatusBarPanel';
7
- export * from './VersionNumber';
@@ -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 = {};
@@ -0,0 +1,70 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React, { useState } from 'react';
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
+
13
+ import VersionNumber from '../VersionNumber';
14
+
15
+ export type StatusBarActionsProps = {};
16
+
17
+ export const StatusBarActions = (_props: StatusBarActionsProps) => {
18
+ const { t } = useTranslation(meta.id);
19
+ const [open, setOpen] = useState(false);
20
+
21
+ return (
22
+ <Popover.Root open={open} onOpenChange={setOpen}>
23
+ <div className='h-full flex items-center px-2 gap-2'>
24
+ <EnvironmentLabel />
25
+ <VersionNumber />
26
+ <div className='grow' />
27
+ <StatusBar.Button asChild>
28
+ <a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>
29
+ <Icon icon='ph--discord-logo--regular' />
30
+ <StatusBar.Text classNames='hidden sm:block'>{t('discord.label')}</StatusBar.Text>
31
+ </a>
32
+ </StatusBar.Button>
33
+ <StatusBar.Button asChild>
34
+ <a href='https://github.com/dxos/dxos' target='_blank' rel='noopener noreferrer'>
35
+ <Icon icon='ph--github-logo--regular' />
36
+ <StatusBar.Text classNames='hidden sm:block'>{t('github.label')}</StatusBar.Text>
37
+ </a>
38
+ </StatusBar.Button>
39
+ </div>
40
+ </Popover.Root>
41
+ );
42
+ };
43
+
44
+ const ENV_LABELS: Record<string, string> = {
45
+ 'edge-dev': 'Dev',
46
+ 'edge-main': 'Main',
47
+ 'edge-labs': 'Labs',
48
+ 'edge-production': 'Production',
49
+ };
50
+
51
+ const EnvironmentLabel = () => {
52
+ const config = useConfig();
53
+ const edgeUrl = config.values.runtime?.services?.edge?.url;
54
+ if (!edgeUrl) {
55
+ return null;
56
+ }
57
+ const part = new URL(edgeUrl).host.split('.')[0];
58
+ const edgeEnv = ENV_LABELS[part];
59
+ if (!edgeEnv) {
60
+ return null;
61
+ }
62
+
63
+ return (
64
+ <StatusBar.Item>
65
+ <StatusBar.Text classNames='text-xs text-subdued border border-separator rounded-full px-1'>
66
+ <span title={edgeEnv}>{edgeEnv[0]}</span>
67
+ </StatusBar.Text>
68
+ </StatusBar.Item>
69
+ );
70
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export { StatusBarActions as default } from './StatusBarActions';
@@ -0,0 +1,21 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { Surface } from '@dxos/app-framework/ui';
8
+
9
+ import StatusBarActionsDefault from '../StatusBarActions';
10
+
11
+ export type StatusBarPanelProps = {};
12
+
13
+ export const StatusBarPanel = (_props: StatusBarPanelProps) => {
14
+ return (
15
+ <>
16
+ <StatusBarActionsDefault />
17
+ <span role='separator' className='grow' />
18
+ <Surface.Surface role='status' />
19
+ </>
20
+ );
21
+ };
@@ -0,0 +1,5 @@
1
+ //
2
+ // Copyright 2024 DXOS.org
3
+ //
4
+
5
+ export { StatusBarPanel as default } from './StatusBarPanel';