@dxos/plugin-status-bar 0.8.4-main.72ec0f3 → 0.8.4-main.765dc60934
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/StatusBarActions-4BKTPZD2.mjs +8 -0
- package/dist/lib/neutral/StatusBarActions-4BKTPZD2.mjs.map +7 -0
- package/dist/lib/neutral/StatusBarPanel-7MSGZVNG.mjs +20 -0
- package/dist/lib/neutral/StatusBarPanel-7MSGZVNG.mjs.map +7 -0
- package/dist/lib/neutral/StatusBarPlugin.mjs +17 -0
- package/dist/lib/neutral/StatusBarPlugin.mjs.map +7 -0
- package/dist/lib/neutral/VersionNumber-I6NWZVLO.mjs +7 -0
- package/dist/lib/neutral/VersionNumber-I6NWZVLO.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +7 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-BHLVVHW4.mjs +19 -0
- package/dist/lib/neutral/chunk-BHLVVHW4.mjs.map +7 -0
- package/dist/lib/neutral/chunk-H63AWCK5.mjs +71 -0
- package/dist/lib/neutral/chunk-H63AWCK5.mjs.map +7 -0
- package/dist/lib/neutral/chunk-KSMKTIOP.mjs +70 -0
- package/dist/lib/neutral/chunk-KSMKTIOP.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +48 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +11 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +7 -0
- package/dist/lib/neutral/index.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +7 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +11 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-LRBTL7UM.mjs +27 -0
- package/dist/lib/neutral/react-surface-LRBTL7UM.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +24 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/types/src/StatusBarPlugin.d.ts +3 -1
- package/dist/types/src/StatusBarPlugin.d.ts.map +1 -1
- package/dist/types/src/StatusBarPlugin.test.d.ts +2 -0
- package/dist/types/src/StatusBarPlugin.test.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +2 -1
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/components/{StatusBar.d.ts → StatusBar/StatusBar.d.ts} +9 -7
- package/dist/types/src/components/StatusBar/StatusBar.d.ts.map +1 -0
- package/dist/types/src/components/{StatusBar.stories.d.ts → StatusBar/StatusBar.stories.d.ts} +3 -1
- package/dist/types/src/components/StatusBar/StatusBar.stories.d.ts.map +1 -0
- package/dist/types/src/components/StatusBar/index.d.ts +2 -0
- package/dist/types/src/components/StatusBar/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/StatusBarActions/StatusBarActions.d.ts +4 -0
- package/dist/types/src/containers/StatusBarActions/StatusBarActions.d.ts.map +1 -0
- package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts +7 -0
- package/dist/types/src/containers/StatusBarActions/StatusBarActions.stories.d.ts.map +1 -0
- package/dist/types/src/containers/StatusBarActions/index.d.ts +2 -0
- package/dist/types/src/containers/StatusBarActions/index.d.ts.map +1 -0
- package/dist/types/src/containers/StatusBarPanel/StatusBarPanel.d.ts +4 -0
- package/dist/types/src/containers/StatusBarPanel/StatusBarPanel.d.ts.map +1 -0
- package/dist/types/src/containers/StatusBarPanel/index.d.ts +2 -0
- package/dist/types/src/containers/StatusBarPanel/index.d.ts.map +1 -0
- package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts +4 -0
- package/dist/types/src/containers/VersionNumber/VersionNumber.d.ts.map +1 -0
- package/dist/types/src/containers/VersionNumber/index.d.ts +2 -0
- package/dist/types/src/containers/VersionNumber/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +5 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +0 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/plugin.d.ts +3 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +11 -12
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +81 -33
- package/src/StatusBarPlugin.test.ts +23 -0
- package/src/StatusBarPlugin.ts +12 -16
- package/src/capabilities/index.ts +2 -2
- package/src/capabilities/react-surface.tsx +25 -27
- package/src/components/StatusBar/StatusBar.stories.tsx +45 -0
- package/src/components/{StatusBar.tsx → StatusBar/StatusBar.tsx} +44 -22
- package/src/components/StatusBar/index.ts +5 -0
- package/src/components/index.ts +0 -2
- package/src/containers/StatusBarActions/StatusBarActions.stories.tsx +62 -0
- package/src/containers/StatusBarActions/StatusBarActions.tsx +70 -0
- package/src/containers/StatusBarActions/index.ts +5 -0
- package/src/containers/StatusBarPanel/StatusBarPanel.tsx +21 -0
- package/src/containers/StatusBarPanel/index.ts +5 -0
- package/src/containers/VersionNumber/VersionNumber.tsx +97 -0
- package/src/containers/VersionNumber/index.ts +5 -0
- package/src/containers/index.ts +9 -0
- package/src/index.ts +1 -2
- package/src/meta.ts +4 -3
- package/src/plugin.ts +9 -0
- package/src/translations.ts +11 -11
- package/dist/lib/browser/chunk-EY5IFRNW.mjs +0 -251
- package/dist/lib/browser/chunk-EY5IFRNW.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -57
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-JLUMVT7Q.mjs +0 -39
- package/dist/lib/browser/react-surface-JLUMVT7Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X4F44ADI.mjs +0 -253
- package/dist/lib/node-esm/chunk-X4F44ADI.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -58
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-O34EDFRO.mjs +0 -40
- package/dist/lib/node-esm/react-surface-O34EDFRO.mjs.map +0 -7
- package/dist/types/src/components/StatusBar.d.ts.map +0 -1
- package/dist/types/src/components/StatusBar.stories.d.ts.map +0 -1
- package/dist/types/src/components/StatusBarPanel.d.ts +0 -4
- package/dist/types/src/components/StatusBarPanel.d.ts.map +0 -1
- package/dist/types/src/components/VersionNumber.d.ts +0 -3
- package/dist/types/src/components/VersionNumber.d.ts.map +0 -1
- package/src/components/StatusBar.stories.tsx +0 -45
- package/src/components/StatusBarPanel.tsx +0 -76
- 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.
|
|
3
|
+
"version": "0.8.4-main.765dc60934",
|
|
4
4
|
"description": "Status bar plugin",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
7
|
-
"
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/dxos/dxos"
|
|
10
|
+
},
|
|
11
|
+
"license": "FSL-1.1-Apache-2.0",
|
|
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
|
-
"
|
|
16
|
-
|
|
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": "
|
|
29
|
-
"@preact-signals/safe-react": "^0.9.0",
|
|
30
|
-
"@preact/signals-core": "^1.12.1",
|
|
75
|
+
"@fluentui/react-tabster": "9.26.11",
|
|
31
76
|
"@radix-ui/react-slot": "1.1.2",
|
|
32
|
-
"date-fns": "^3.
|
|
33
|
-
"effect": "3.
|
|
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.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/
|
|
39
|
-
"@dxos/
|
|
40
|
-
"@dxos/react-
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
80
|
+
"@dxos/app-framework": "0.8.4-main.765dc60934",
|
|
81
|
+
"@dxos/app-toolkit": "0.8.4-main.765dc60934",
|
|
82
|
+
"@dxos/async": "0.8.4-main.765dc60934",
|
|
83
|
+
"@dxos/operation": "0.8.4-main.765dc60934",
|
|
84
|
+
"@dxos/plugin-observability": "0.8.4-main.765dc60934",
|
|
85
|
+
"@dxos/react-ui-form": "0.8.4-main.765dc60934",
|
|
86
|
+
"@dxos/react-client": "0.8.4-main.765dc60934",
|
|
87
|
+
"@dxos/echo": "0.8.4-main.765dc60934",
|
|
88
|
+
"@dxos/util": "0.8.4-main.765dc60934",
|
|
89
|
+
"@dxos/schema": "0.8.4-main.765dc60934"
|
|
43
90
|
},
|
|
44
91
|
"devDependencies": {
|
|
45
|
-
"@types/react": "~19.2.
|
|
46
|
-
"@types/react-dom": "~19.2.
|
|
47
|
-
"react": "~19.2.
|
|
48
|
-
"react-dom": "~19.2.
|
|
49
|
-
"vite": "
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
52
|
-
"@dxos/storybook-utils": "0.8.4-main.
|
|
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.13",
|
|
97
|
+
"@dxos/plugin-testing": "0.8.4-main.765dc60934",
|
|
98
|
+
"@dxos/react-ui": "0.8.4-main.765dc60934",
|
|
99
|
+
"@dxos/storybook-utils": "0.8.4-main.765dc60934",
|
|
100
|
+
"@dxos/ui-theme": "0.8.4-main.765dc60934"
|
|
53
101
|
},
|
|
54
102
|
"peerDependencies": {
|
|
55
|
-
"effect": "
|
|
56
|
-
"react": "
|
|
57
|
-
"react-dom": "
|
|
58
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
59
|
-
"@dxos/
|
|
103
|
+
"effect": "3.20.0",
|
|
104
|
+
"react": "~19.2.3",
|
|
105
|
+
"react-dom": "~19.2.3",
|
|
106
|
+
"@dxos/react-ui": "0.8.4-main.765dc60934",
|
|
107
|
+
"@dxos/ui-theme": "0.8.4-main.765dc60934"
|
|
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
|
+
});
|
package/src/StatusBarPlugin.ts
CHANGED
|
@@ -2,21 +2,17 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
6
7
|
|
|
7
|
-
import { ReactSurface } from '
|
|
8
|
-
import { meta } from '
|
|
9
|
-
import { translations } from '
|
|
8
|
+
import { ReactSurface } from '#capabilities';
|
|
9
|
+
import { meta } from '#meta';
|
|
10
|
+
import { translations } from '#translations';
|
|
10
11
|
|
|
11
|
-
export const StatusBarPlugin =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
id: `${meta.id}/module/react-surface`,
|
|
19
|
-
activatesOn: Events.SetupReactSurface,
|
|
20
|
-
activate: ReactSurface,
|
|
21
|
-
}),
|
|
22
|
-
]);
|
|
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 {
|
|
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,34 +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,
|
|
8
|
-
import { Surface } from '@dxos/app-framework/
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface } from '@dxos/app-framework/ui';
|
|
9
10
|
|
|
10
|
-
import { StatusBarActions, StatusBarPanel, VersionNumber } from '
|
|
11
|
-
import { meta } from '../meta';
|
|
11
|
+
import { StatusBarActions, StatusBarPanel, VersionNumber } from '#containers';
|
|
12
12
|
|
|
13
|
-
export default () =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}),
|
|
35
|
-
]);
|
|
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/
|
|
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
|
|
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-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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 pli-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
|
|
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
|
|
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,
|
package/src/components/index.ts
CHANGED
|
@@ -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,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
|
+
};
|