@dxos/plugin-status-bar 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5
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 +79 -40
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +80 -40
- 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 +2 -1
- package/dist/types/src/StatusBarPlugin.d.ts.map +1 -1
- 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/StatusBar.stories.d.ts +15 -0
- 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/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +11 -11
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +38 -27
- package/src/StatusBarPlugin.ts +10 -16
- package/src/capabilities/index.ts +2 -2
- package/src/capabilities/react-surface.tsx +25 -26
- package/src/components/StatusBar/StatusBar.stories.tsx +45 -0
- package/src/components/{StatusBar.tsx → StatusBar/StatusBar.tsx} +43 -21
- package/src/components/StatusBar/index.ts +5 -0
- package/src/components/index.ts +0 -2
- package/src/containers/StatusBarActions/StatusBarActions.stories.tsx +61 -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/meta.ts +8 -6
- package/src/translations.ts +11 -11
- package/dist/lib/browser/chunk-32FBOE6I.mjs +0 -249
- package/dist/lib/browser/chunk-32FBOE6I.mjs.map +0 -7
- package/dist/lib/browser/react-surface-P7CEMQU3.mjs +0 -38
- package/dist/lib/browser/react-surface-P7CEMQU3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IQXGCBGU.mjs +0 -251
- package/dist/lib/node-esm/chunk-IQXGCBGU.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-U7DLJKU6.mjs +0 -39
- package/dist/lib/node-esm/react-surface-U7DLJKU6.mjs.map +0 -7
- package/dist/types/src/components/StatusBar.d.ts.map +0 -1
- package/dist/types/src/components/StatusBar.stories.d.ts +0 -9
- 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 -48
- package/src/components/StatusBarPanel.tsx +0 -75
- package/src/components/VersionNumber.tsx +0 -84
package/src/translations.ts
CHANGED
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'warning
|
|
15
|
-
'technology
|
|
16
|
-
'learn
|
|
17
|
-
'released
|
|
18
|
-
'see
|
|
19
|
-
'powered
|
|
20
|
-
'discord
|
|
21
|
-
'github
|
|
22
|
-
'feedback
|
|
13
|
+
'plugin.name': 'Status Bar',
|
|
14
|
+
'warning.title': 'WARNING',
|
|
15
|
+
'technology-preview.message': 'Composer is currently in beta.',
|
|
16
|
+
'learn-more.label': 'Learn more',
|
|
17
|
+
'released.message': 'This version was released {{released}}.',
|
|
18
|
+
'see-release.label': 'See release on GitHub',
|
|
19
|
+
'powered-by-dxos.message': 'Powered by <dxos>DXOS</dxos>',
|
|
20
|
+
'discord.label': 'Discord',
|
|
21
|
+
'github.label': 'GitHub',
|
|
22
|
+
'feedback.label': 'Feedback',
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
},
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
// src/components/StatusBar.tsx
|
|
2
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
3
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
4
|
-
import React, { forwardRef } from "react";
|
|
5
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
6
|
-
var StatusBarText = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
|
|
7
|
-
var _effect = _useSignals();
|
|
8
|
-
try {
|
|
9
|
-
return /* @__PURE__ */ React.createElement("span", {
|
|
10
|
-
className: mx(classNames),
|
|
11
|
-
ref: forwardedRef
|
|
12
|
-
}, children);
|
|
13
|
-
} finally {
|
|
14
|
-
_effect.f();
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
var StatusBarButton = /* @__PURE__ */ forwardRef(({ classNames, children, asChild, ...props }, forwardedRef) => {
|
|
18
|
-
var _effect = _useSignals();
|
|
19
|
-
try {
|
|
20
|
-
const classes = mx("flex items-center justify-center gap-2 p-1 px-2 rounded-sm", "select-none cursor-pointer dx-focus-ring text-description text-xs", "hover:bg-neutral-75 active:bg-neutral-150 dark:hover:bg-neutral-750 dark:active:bg-neutral-700", classNames);
|
|
21
|
-
return asChild ? /* @__PURE__ */ React.createElement(Slot, {
|
|
22
|
-
role: "button",
|
|
23
|
-
ref: forwardedRef,
|
|
24
|
-
className: classes,
|
|
25
|
-
...props
|
|
26
|
-
}, children) : /* @__PURE__ */ React.createElement("button", {
|
|
27
|
-
className: classes,
|
|
28
|
-
ref: forwardedRef,
|
|
29
|
-
...props
|
|
30
|
-
}, children);
|
|
31
|
-
} finally {
|
|
32
|
-
_effect.f();
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
var StatusBarItem = /* @__PURE__ */ forwardRef(({ classNames, children, ...props }, forwardedRef) => {
|
|
36
|
-
var _effect = _useSignals();
|
|
37
|
-
try {
|
|
38
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
39
|
-
role: "menuitem",
|
|
40
|
-
className: mx("flex items-center justify-center gap-2 p-1 px-2 rounded-sm select-none", classNames),
|
|
41
|
-
ref: forwardedRef,
|
|
42
|
-
...props
|
|
43
|
-
}, children);
|
|
44
|
-
} finally {
|
|
45
|
-
_effect.f();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
var StartContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
|
|
49
|
-
var _effect = _useSignals();
|
|
50
|
-
try {
|
|
51
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
52
|
-
role: "none",
|
|
53
|
-
className: mx("flex-grow flex items-center space-x-2", classNames),
|
|
54
|
-
ref: forwardedRef
|
|
55
|
-
}, children);
|
|
56
|
-
} finally {
|
|
57
|
-
_effect.f();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
var EndContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
|
|
61
|
-
var _effect = _useSignals();
|
|
62
|
-
try {
|
|
63
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
64
|
-
role: "none",
|
|
65
|
-
className: mx("flex-grow flex items-center justify-end", classNames),
|
|
66
|
-
ref: forwardedRef
|
|
67
|
-
}, children);
|
|
68
|
-
} finally {
|
|
69
|
-
_effect.f();
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
var StatusBar = {
|
|
73
|
-
Text: StatusBarText,
|
|
74
|
-
Item: StatusBarItem,
|
|
75
|
-
Button: StatusBarButton,
|
|
76
|
-
StartContent,
|
|
77
|
-
EndContent
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// src/meta.ts
|
|
81
|
-
var STATUS_BAR_PLUGIN = "dxos.org/plugin/status-bar";
|
|
82
|
-
var meta = {
|
|
83
|
-
id: STATUS_BAR_PLUGIN,
|
|
84
|
-
name: "Status Bar",
|
|
85
|
-
description: "Display a bar with status and actions.",
|
|
86
|
-
icon: "ph--info--regular"
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
// src/components/VersionNumber.tsx
|
|
90
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
91
|
-
import { formatDistance } from "date-fns/formatDistance";
|
|
92
|
-
import React2 from "react";
|
|
93
|
-
import { useConfig } from "@dxos/react-client";
|
|
94
|
-
import { Link, Message, Popover, Trans, useTranslation, Icon } from "@dxos/react-ui";
|
|
95
|
-
var repo = "https://github.com/dxos/dxos";
|
|
96
|
-
var VERSION_REGEX = /([\d.]+)/;
|
|
97
|
-
var VersionNumber = () => {
|
|
98
|
-
var _effect = _useSignals2();
|
|
99
|
-
try {
|
|
100
|
-
const { t } = useTranslation(meta.id);
|
|
101
|
-
const config = useConfig();
|
|
102
|
-
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
103
|
-
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
104
|
-
const isLabs = config.values.runtime?.app?.env?.DX_LABS;
|
|
105
|
-
const releaseUrl = config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production" ? `${repo}/releases/tag/v${version}` : `${repo}/commit/${commitHash}`;
|
|
106
|
-
const previewUrl = "https://docs.dxos.org/composer#technology-preview";
|
|
107
|
-
return /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
108
|
-
asChild: true
|
|
109
|
-
}, /* @__PURE__ */ React2.createElement(StatusBar.Button, {
|
|
110
|
-
classNames: "text-xs"
|
|
111
|
-
}, isLabs ? version : v)), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
112
|
-
side: "top",
|
|
113
|
-
role: "message",
|
|
114
|
-
classNames: "z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]"
|
|
115
|
-
}, /* @__PURE__ */ React2.createElement(Message.Root, {
|
|
116
|
-
valence: "warning",
|
|
117
|
-
classNames: "rounded-be-none p-5"
|
|
118
|
-
}, /* @__PURE__ */ React2.createElement(Message.Title, null, t("warning title")), /* @__PURE__ */ React2.createElement(Message.Content, null, t("technology preview message"), /* @__PURE__ */ React2.createElement("br", null), /* @__PURE__ */ React2.createElement(Link, {
|
|
119
|
-
href: previewUrl,
|
|
120
|
-
target: "_blank",
|
|
121
|
-
rel: "noreferrer",
|
|
122
|
-
variant: "neutral"
|
|
123
|
-
}, t("learn more label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
124
|
-
icon: "ph--arrow-square-out--bold",
|
|
125
|
-
classNames: "inline mis-1"
|
|
126
|
-
})))), /* @__PURE__ */ React2.createElement("div", {
|
|
127
|
-
role: "none",
|
|
128
|
-
className: "plb-4 pli-5 space-b-2 text-baseText"
|
|
129
|
-
}, timestamp && /* @__PURE__ */ React2.createElement("p", null, t("released message", {
|
|
130
|
-
released: formatDistance(new Date(timestamp), /* @__PURE__ */ new Date(), {
|
|
131
|
-
addSuffix: true
|
|
132
|
-
})
|
|
133
|
-
}), /* @__PURE__ */ React2.createElement("br", null), /* @__PURE__ */ React2.createElement(Link, {
|
|
134
|
-
href: releaseUrl,
|
|
135
|
-
target: "_blank",
|
|
136
|
-
rel: "noreferrer",
|
|
137
|
-
variant: "neutral"
|
|
138
|
-
}, t("see release label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
139
|
-
icon: "ph--arrow-square-out--bold",
|
|
140
|
-
classNames: "inline mis-1"
|
|
141
|
-
}))), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement(Trans, {
|
|
142
|
-
t,
|
|
143
|
-
i18nKey: "powered by dxos message",
|
|
144
|
-
components: {
|
|
145
|
-
dxos: /* @__PURE__ */ React2.createElement(Link, {
|
|
146
|
-
href: "https://dxos.org",
|
|
147
|
-
target: "_blank",
|
|
148
|
-
rel: "noreferrer",
|
|
149
|
-
variant: "neutral"
|
|
150
|
-
})
|
|
151
|
-
}
|
|
152
|
-
}))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null))));
|
|
153
|
-
} finally {
|
|
154
|
-
_effect.f();
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
// src/components/StatusBarPanel.tsx
|
|
159
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
160
|
-
import React3, { useState } from "react";
|
|
161
|
-
import { Surface } from "@dxos/app-framework";
|
|
162
|
-
import { useConfig as useConfig2 } from "@dxos/react-client";
|
|
163
|
-
import { Icon as Icon2, Popover as Popover2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
164
|
-
var StatusBarActions = () => {
|
|
165
|
-
var _effect = _useSignals3();
|
|
166
|
-
try {
|
|
167
|
-
const { t } = useTranslation2(meta.id);
|
|
168
|
-
const [open, setOpen] = useState(false);
|
|
169
|
-
return /* @__PURE__ */ React3.createElement(Popover2.Root, {
|
|
170
|
-
open,
|
|
171
|
-
onOpenChange: setOpen
|
|
172
|
-
}, /* @__PURE__ */ React3.createElement(EnvironmentLabel, null), /* @__PURE__ */ React3.createElement(VersionNumber, null), /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
173
|
-
asChild: true
|
|
174
|
-
}, /* @__PURE__ */ React3.createElement("a", {
|
|
175
|
-
href: "https://dxos.org/discord",
|
|
176
|
-
target: "_blank",
|
|
177
|
-
rel: "noopener noreferrer"
|
|
178
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
179
|
-
icon: "ph--discord-logo--regular",
|
|
180
|
-
size: 4
|
|
181
|
-
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
182
|
-
classNames: "hidden sm:block"
|
|
183
|
-
}, t("discord label2")))), /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
184
|
-
asChild: true
|
|
185
|
-
}, /* @__PURE__ */ React3.createElement("a", {
|
|
186
|
-
href: "https://github.com/dxos/dxos",
|
|
187
|
-
target: "_blank",
|
|
188
|
-
rel: "noopener noreferrer"
|
|
189
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
190
|
-
icon: "ph--github-logo--regular",
|
|
191
|
-
size: 4
|
|
192
|
-
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
193
|
-
classNames: "hidden sm:block"
|
|
194
|
-
}, t("github label")))));
|
|
195
|
-
} finally {
|
|
196
|
-
_effect.f();
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
var StatusBarPanel = () => {
|
|
200
|
-
var _effect = _useSignals3();
|
|
201
|
-
try {
|
|
202
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(StatusBarActions, null), /* @__PURE__ */ React3.createElement("span", {
|
|
203
|
-
role: "separator",
|
|
204
|
-
className: "grow"
|
|
205
|
-
}), /* @__PURE__ */ React3.createElement(Surface, {
|
|
206
|
-
role: "status"
|
|
207
|
-
}));
|
|
208
|
-
} finally {
|
|
209
|
-
_effect.f();
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
var ENV_LABELS = {
|
|
213
|
-
"edge-dev": "Dev",
|
|
214
|
-
"edge-main": "Main",
|
|
215
|
-
"edge-labs": "Labs",
|
|
216
|
-
"edge-production": "Production"
|
|
217
|
-
};
|
|
218
|
-
var EnvironmentLabel = () => {
|
|
219
|
-
var _effect = _useSignals3();
|
|
220
|
-
try {
|
|
221
|
-
const config = useConfig2();
|
|
222
|
-
const edgeUrl = config.values.runtime?.services?.edge?.url;
|
|
223
|
-
if (!edgeUrl) {
|
|
224
|
-
return null;
|
|
225
|
-
}
|
|
226
|
-
const part = new URL(edgeUrl).host.split(".")[0];
|
|
227
|
-
const edgeEnv = ENV_LABELS[part];
|
|
228
|
-
if (!edgeEnv) {
|
|
229
|
-
return null;
|
|
230
|
-
}
|
|
231
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, null, /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
232
|
-
classNames: "text-xs text-subdued border border-separator rounded-full px-1"
|
|
233
|
-
}, /* @__PURE__ */ React3.createElement("span", {
|
|
234
|
-
title: edgeEnv
|
|
235
|
-
}, edgeEnv[0])));
|
|
236
|
-
} finally {
|
|
237
|
-
_effect.f();
|
|
238
|
-
}
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
export {
|
|
242
|
-
StatusBar,
|
|
243
|
-
STATUS_BAR_PLUGIN,
|
|
244
|
-
meta,
|
|
245
|
-
VersionNumber,
|
|
246
|
-
StatusBarActions,
|
|
247
|
-
StatusBarPanel
|
|
248
|
-
};
|
|
249
|
-
//# sourceMappingURL=chunk-32FBOE6I.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/StatusBar.tsx", "../../../src/meta.ts", "../../../src/components/VersionNumber.tsx", "../../../src/components/StatusBarPanel.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Slot } from '@radix-ui/react-slot';\nimport React, { type ComponentPropsWithRef, forwardRef, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { type ThemedClassName } from '@dxos/react-ui';\nimport { mx } from '@dxos/react-ui-theme';\n\ntype StatusBarTextProps = ThemedClassName<{ children: ReactNode }>;\n\nconst StatusBarText = forwardRef<HTMLSpanElement, StatusBarTextProps>(({ classNames, children }, forwardedRef) => (\n <span className={mx(classNames)} ref={forwardedRef}>\n {children}\n </span>\n));\n\ntype StatusBarButtonProps = ThemedClassName<ComponentPropsWithRef<'button'> & { asChild?: boolean }>;\n\nconst StatusBarButton = forwardRef<HTMLButtonElement, StatusBarButtonProps>(\n ({ classNames, children, asChild, ...props }, forwardedRef) => {\n const classes = mx(\n 'flex items-center justify-center gap-2 p-1 px-2 rounded-sm',\n 'select-none cursor-pointer dx-focus-ring text-description text-xs',\n 'hover:bg-neutral-75 active:bg-neutral-150 dark:hover:bg-neutral-750 dark:active:bg-neutral-700',\n classNames,\n );\n\n return asChild ? (\n <Slot role='button' ref={forwardedRef} className={classes} {...props}>\n {children}\n </Slot>\n ) : (\n <button className={classes} ref={forwardedRef} {...props}>\n {children}\n </button>\n );\n },\n);\n\nexport default StatusBarButton;\n\ntype StatusBarItemProps = ThemedClassName<ComponentPropsWithRef<'div'>>;\n\nconst StatusBarItem = forwardRef<HTMLDivElement, StatusBarItemProps>(\n ({ classNames, children, ...props }, forwardedRef) => (\n <div\n role='menuitem'\n className={mx('flex items-center justify-center gap-2 p-1 px-2 rounded-sm select-none', classNames)}\n ref={forwardedRef}\n {...props}\n >\n {children}\n </div>\n ),\n);\n\ntype StartContentProps = ThemedClassName<PropsWithChildren<{}>>;\n\nconst StartContent = forwardRef<HTMLDivElement, StartContentProps>(({ classNames, children }, forwardedRef) => (\n <div role='none' className={mx('flex-grow flex items-center space-x-2', classNames)} ref={forwardedRef}>\n {children}\n </div>\n));\n\ntype EndContentProps = ThemedClassName<PropsWithChildren<{}>>;\n\nconst EndContent = forwardRef<HTMLDivElement, EndContentProps>(({ classNames, children }, forwardedRef) => (\n <div role='none' className={mx('flex-grow flex items-center justify-end', classNames)} ref={forwardedRef}>\n {children}\n </div>\n));\n\nexport const StatusBar = {\n Text: StatusBarText,\n Item: StatusBarItem,\n Button: StatusBarButton,\n StartContent,\n EndContent,\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const STATUS_BAR_PLUGIN = 'dxos.org/plugin/status-bar';\n\nexport const meta: PluginMeta = {\n id: STATUS_BAR_PLUGIN,\n name: 'Status Bar',\n description: 'Display a bar with status and actions.',\n icon: 'ph--info--regular',\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { formatDistance } from 'date-fns/formatDistance';\nimport React from 'react';\n\nimport { useConfig } from '@dxos/react-client';\nimport { Link, Message, Popover, Trans, useTranslation, Icon } from '@dxos/react-ui';\n\nimport { StatusBar } from './StatusBar';\nimport { meta } from '../meta';\n\nconst repo = 'https://github.com/dxos/dxos';\n\nconst VERSION_REGEX = /([\\d.]+)/;\n\nexport const VersionNumber = () => {\n const { t } = useTranslation(meta.id);\n const config = useConfig();\n const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};\n const [_, v] = version?.match(VERSION_REGEX) ?? [];\n const isLabs = config.values.runtime?.app?.env?.DX_LABS;\n\n const releaseUrl =\n config.values.runtime?.app?.env?.DX_ENVIRONMENT === 'production'\n ? `${repo}/releases/tag/v${version}`\n : `${repo}/commit/${commitHash}`;\n\n const previewUrl = 'https://docs.dxos.org/composer#technology-preview';\n\n return (\n <Popover.Root>\n <Popover.Trigger asChild>\n <StatusBar.Button classNames='text-xs'>{isLabs ? version : v}</StatusBar.Button>\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Content\n side='top'\n role='message'\n classNames='z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]'\n >\n <Message.Root valence='warning' classNames='rounded-be-none p-5'>\n <Message.Title>{t('warning title')}</Message.Title>\n <Message.Content>\n {t('technology preview message')}\n <br />\n <Link href={previewUrl} target='_blank' rel='noreferrer' variant='neutral'>\n {t('learn more label')}\n <Icon icon='ph--arrow-square-out--bold' classNames='inline mis-1' />\n </Link>\n </Message.Content>\n </Message.Root>\n <div role='none' className='plb-4 pli-5 space-b-2 text-baseText'>\n {timestamp && (\n <p>\n {t('released message', {\n released: formatDistance(new Date(timestamp), new Date(), { addSuffix: true }),\n })}\n <br />\n <Link href={releaseUrl} target='_blank' rel='noreferrer' variant='neutral'>\n {t('see release label')}\n <Icon icon='ph--arrow-square-out--bold' classNames='inline mis-1' />\n </Link>\n </p>\n )}\n <p>\n <Trans\n {...{\n t,\n i18nKey: 'powered by dxos message',\n components: {\n dxos: <Link href='https://dxos.org' target='_blank' rel='noreferrer' variant='neutral' />,\n },\n }}\n />\n </p>\n </div>\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport React, { useState } from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { useConfig } from '@dxos/react-client';\nimport { Icon, Popover, useTranslation } from '@dxos/react-ui';\n\nimport { StatusBar } from './StatusBar';\nimport { VersionNumber } from './VersionNumber';\nimport { meta } from '../meta';\n\nexport const StatusBarActions = () => {\n const { t } = useTranslation(meta.id);\n const [open, setOpen] = useState(false);\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <EnvironmentLabel />\n <VersionNumber />\n <StatusBar.Button asChild>\n <a href='https://dxos.org/discord' target='_blank' rel='noopener noreferrer'>\n <Icon icon='ph--discord-logo--regular' size={4} />\n <StatusBar.Text classNames='hidden sm:block'>{t('discord label2')}</StatusBar.Text>\n </a>\n </StatusBar.Button>\n <StatusBar.Button asChild>\n <a href='https://github.com/dxos/dxos' target='_blank' rel='noopener noreferrer'>\n <Icon icon='ph--github-logo--regular' size={4} />\n <StatusBar.Text classNames='hidden sm:block'>{t('github label')}</StatusBar.Text>\n </a>\n </StatusBar.Button>\n </Popover.Root>\n );\n};\n\nexport const StatusBarPanel = () => {\n return (\n <>\n <StatusBarActions />\n <span role='separator' className='grow' />\n <Surface role='status' />\n </>\n );\n};\n\nconst ENV_LABELS: Record<string, string> = {\n 'edge-dev': 'Dev',\n 'edge-main': 'Main',\n 'edge-labs': 'Labs',\n 'edge-production': 'Production',\n};\n\nconst EnvironmentLabel = () => {\n const config = useConfig();\n const edgeUrl = config.values.runtime?.services?.edge?.url;\n if (!edgeUrl) {\n return null;\n }\n const part = new URL(edgeUrl).host.split('.')[0];\n const edgeEnv = ENV_LABELS[part];\n if (!edgeEnv) {\n return null;\n }\n\n return (\n <StatusBar.Item>\n <StatusBar.Text classNames='text-xs text-subdued border border-separator rounded-full px-1'>\n <span title={edgeEnv}>{edgeEnv[0]}</span>\n </StatusBar.Text>\n </StatusBar.Item>\n );\n};\n"],
|
|
5
|
-
"mappings": ";;AAIA,SAASA,YAAY;AACrB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,aAAO;IACT;AACA,UAAMM,OAAO,IAAIC,IAAIP,OAAAA,EAASQ,KAAKC,MAAM,GAAA,EAAK,CAAA;AAC9C,UAAMC,UAAUb,WAAWS,IAAAA;AAC3B,QAAI,CAACI,SAAS;AACZ,aAAO;IACT;AAEA,WACE,gBAAApC,OAAA,cAACM,UAAU+B,MAAI,MACb,gBAAArC,OAAA,cAACM,UAAUU,MAAI;MAACC,YAAW;OACzB,gBAAAjB,OAAA,cAACmB,QAAAA;MAAKmB,OAAOF;OAAUA,QAAQ,CAAA,CAAE,CAAA,CAAA;;;;AAIzC;",
|
|
6
|
-
"names": ["Slot", "React", "forwardRef", "mx", "StatusBarText", "forwardRef", "classNames", "children", "forwardedRef", "span", "className", "mx", "ref", "StatusBarButton", "asChild", "props", "classes", "Slot", "role", "button", "StatusBarItem", "forwardRef", "classNames", "children", "props", "forwardedRef", "div", "role", "className", "mx", "ref", "StartContent", "EndContent", "StatusBar", "Text", "StatusBarText", "Item", "Button", "StatusBarButton", "STATUS_BAR_PLUGIN", "meta", "id", "name", "description", "icon", "formatDistance", "React", "useConfig", "Link", "Message", "Popover", "Trans", "useTranslation", "Icon", "repo", "VERSION_REGEX", "VersionNumber", "t", "useTranslation", "meta", "id", "config", "useConfig", "version", "timestamp", "commitHash", "values", "runtime", "app", "build", "_", "v", "match", "isLabs", "env", "DX_LABS", "releaseUrl", "DX_ENVIRONMENT", "previewUrl", "React", "Popover", "Root", "Trigger", "asChild", "StatusBar", "Button", "classNames", "Portal", "Content", "side", "role", "Message", "valence", "Title", "br", "Link", "href", "target", "rel", "variant", "Icon", "icon", "div", "className", "p", "released", "formatDistance", "Date", "addSuffix", "Trans", "i18nKey", "components", "dxos", "Arrow", "React", "useState", "Surface", "useConfig", "Icon", "Popover", "useTranslation", "StatusBarActions", "t", "useTranslation", "meta", "id", "open", "setOpen", "useState", "React", "Popover", "Root", "onOpenChange", "EnvironmentLabel", "VersionNumber", "StatusBar", "Button", "asChild", "a", "href", "target", "rel", "Icon", "icon", "size", "Text", "classNames", "StatusBarPanel", "span", "role", "className", "Surface", "ENV_LABELS", "config", "useConfig", "edgeUrl", "values", "runtime", "services", "edge", "url", "part", "URL", "host", "split", "edgeEnv", "Item", "title"]
|
|
7
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
StatusBarActions,
|
|
3
|
-
StatusBarPanel,
|
|
4
|
-
VersionNumber,
|
|
5
|
-
meta
|
|
6
|
-
} from "./chunk-32FBOE6I.mjs";
|
|
7
|
-
|
|
8
|
-
// src/capabilities/react-surface.tsx
|
|
9
|
-
import React from "react";
|
|
10
|
-
import { Capabilities, contributes, createSurface, Surface } from "@dxos/app-framework";
|
|
11
|
-
var react_surface_default = () => contributes(Capabilities.ReactSurface, [
|
|
12
|
-
createSurface({
|
|
13
|
-
id: `${meta.id}/status-bar`,
|
|
14
|
-
role: "status-bar",
|
|
15
|
-
component: () => /* @__PURE__ */ React.createElement(StatusBarPanel, null)
|
|
16
|
-
}),
|
|
17
|
-
createSurface({
|
|
18
|
-
id: `${meta.id}/status-bar--r0-footer`,
|
|
19
|
-
role: "status-bar--r0-footer",
|
|
20
|
-
component: () => /* @__PURE__ */ React.createElement(Surface, {
|
|
21
|
-
role: "status"
|
|
22
|
-
})
|
|
23
|
-
}),
|
|
24
|
-
createSurface({
|
|
25
|
-
id: `${meta.id}/status-bar--r1-footer`,
|
|
26
|
-
role: "status-bar--r1-footer",
|
|
27
|
-
component: () => /* @__PURE__ */ React.createElement(StatusBarActions, null)
|
|
28
|
-
}),
|
|
29
|
-
createSurface({
|
|
30
|
-
id: `${meta.id}/header-end`,
|
|
31
|
-
role: "header-end",
|
|
32
|
-
component: () => /* @__PURE__ */ React.createElement(VersionNumber, null)
|
|
33
|
-
})
|
|
34
|
-
]);
|
|
35
|
-
export {
|
|
36
|
-
react_surface_default as default
|
|
37
|
-
};
|
|
38
|
-
//# sourceMappingURL=react-surface-P7CEMQU3.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface, Surface } from '@dxos/app-framework';\n\nimport { StatusBarActions, StatusBarPanel, VersionNumber } from '../components';\nimport { meta } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${meta.id}/status-bar`,\n role: 'status-bar',\n component: () => <StatusBarPanel />,\n }),\n createSurface({\n id: `${meta.id}/status-bar--r0-footer`,\n role: 'status-bar--r0-footer',\n component: () => <Surface role='status' />,\n }),\n createSurface({\n id: `${meta.id}/status-bar--r1-footer`,\n role: 'status-bar--r1-footer',\n component: () => <StatusBarActions />,\n }),\n createSurface({\n id: `${meta.id}/header-end`,\n role: 'header-end',\n component: () => <VersionNumber />,\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,eAAeC,eAAe;AAKlE,IAAA,wBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,WAAW,MAAM,sBAAA,cAACC,gBAAAA,IAAAA;EACpB,CAAA;EACAL,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,WAAW,MAAM,sBAAA,cAACE,SAAAA;MAAQH,MAAK;;EACjC,CAAA;EACAH,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,WAAW,MAAM,sBAAA,cAACG,kBAAAA,IAAAA;EACpB,CAAA;EACAP,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;IACNC,WAAW,MAAM,sBAAA,cAACI,eAAAA,IAAAA;EACpB,CAAA;CACD;",
|
|
6
|
-
"names": ["React", "Capabilities", "contributes", "createSurface", "Surface", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "component", "StatusBarPanel", "Surface", "StatusBarActions", "VersionNumber"]
|
|
7
|
-
}
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
-
|
|
3
|
-
// src/components/StatusBar.tsx
|
|
4
|
-
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
5
|
-
import { Slot } from "@radix-ui/react-slot";
|
|
6
|
-
import React, { forwardRef } from "react";
|
|
7
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
8
|
-
var StatusBarText = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
|
|
9
|
-
var _effect = _useSignals();
|
|
10
|
-
try {
|
|
11
|
-
return /* @__PURE__ */ React.createElement("span", {
|
|
12
|
-
className: mx(classNames),
|
|
13
|
-
ref: forwardedRef
|
|
14
|
-
}, children);
|
|
15
|
-
} finally {
|
|
16
|
-
_effect.f();
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
var StatusBarButton = /* @__PURE__ */ forwardRef(({ classNames, children, asChild, ...props }, forwardedRef) => {
|
|
20
|
-
var _effect = _useSignals();
|
|
21
|
-
try {
|
|
22
|
-
const classes = mx("flex items-center justify-center gap-2 p-1 px-2 rounded-sm", "select-none cursor-pointer dx-focus-ring text-description text-xs", "hover:bg-neutral-75 active:bg-neutral-150 dark:hover:bg-neutral-750 dark:active:bg-neutral-700", classNames);
|
|
23
|
-
return asChild ? /* @__PURE__ */ React.createElement(Slot, {
|
|
24
|
-
role: "button",
|
|
25
|
-
ref: forwardedRef,
|
|
26
|
-
className: classes,
|
|
27
|
-
...props
|
|
28
|
-
}, children) : /* @__PURE__ */ React.createElement("button", {
|
|
29
|
-
className: classes,
|
|
30
|
-
ref: forwardedRef,
|
|
31
|
-
...props
|
|
32
|
-
}, children);
|
|
33
|
-
} finally {
|
|
34
|
-
_effect.f();
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
var StatusBarItem = /* @__PURE__ */ forwardRef(({ classNames, children, ...props }, forwardedRef) => {
|
|
38
|
-
var _effect = _useSignals();
|
|
39
|
-
try {
|
|
40
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
41
|
-
role: "menuitem",
|
|
42
|
-
className: mx("flex items-center justify-center gap-2 p-1 px-2 rounded-sm select-none", classNames),
|
|
43
|
-
ref: forwardedRef,
|
|
44
|
-
...props
|
|
45
|
-
}, children);
|
|
46
|
-
} finally {
|
|
47
|
-
_effect.f();
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
var StartContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
|
|
51
|
-
var _effect = _useSignals();
|
|
52
|
-
try {
|
|
53
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
54
|
-
role: "none",
|
|
55
|
-
className: mx("flex-grow flex items-center space-x-2", classNames),
|
|
56
|
-
ref: forwardedRef
|
|
57
|
-
}, children);
|
|
58
|
-
} finally {
|
|
59
|
-
_effect.f();
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
var EndContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => {
|
|
63
|
-
var _effect = _useSignals();
|
|
64
|
-
try {
|
|
65
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
66
|
-
role: "none",
|
|
67
|
-
className: mx("flex-grow flex items-center justify-end", classNames),
|
|
68
|
-
ref: forwardedRef
|
|
69
|
-
}, children);
|
|
70
|
-
} finally {
|
|
71
|
-
_effect.f();
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
var StatusBar = {
|
|
75
|
-
Text: StatusBarText,
|
|
76
|
-
Item: StatusBarItem,
|
|
77
|
-
Button: StatusBarButton,
|
|
78
|
-
StartContent,
|
|
79
|
-
EndContent
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// src/meta.ts
|
|
83
|
-
var STATUS_BAR_PLUGIN = "dxos.org/plugin/status-bar";
|
|
84
|
-
var meta = {
|
|
85
|
-
id: STATUS_BAR_PLUGIN,
|
|
86
|
-
name: "Status Bar",
|
|
87
|
-
description: "Display a bar with status and actions.",
|
|
88
|
-
icon: "ph--info--regular"
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
// src/components/VersionNumber.tsx
|
|
92
|
-
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
93
|
-
import { formatDistance } from "date-fns/formatDistance";
|
|
94
|
-
import React2 from "react";
|
|
95
|
-
import { useConfig } from "@dxos/react-client";
|
|
96
|
-
import { Link, Message, Popover, Trans, useTranslation, Icon } from "@dxos/react-ui";
|
|
97
|
-
var repo = "https://github.com/dxos/dxos";
|
|
98
|
-
var VERSION_REGEX = /([\d.]+)/;
|
|
99
|
-
var VersionNumber = () => {
|
|
100
|
-
var _effect = _useSignals2();
|
|
101
|
-
try {
|
|
102
|
-
const { t } = useTranslation(meta.id);
|
|
103
|
-
const config = useConfig();
|
|
104
|
-
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
105
|
-
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
106
|
-
const isLabs = config.values.runtime?.app?.env?.DX_LABS;
|
|
107
|
-
const releaseUrl = config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production" ? `${repo}/releases/tag/v${version}` : `${repo}/commit/${commitHash}`;
|
|
108
|
-
const previewUrl = "https://docs.dxos.org/composer#technology-preview";
|
|
109
|
-
return /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
110
|
-
asChild: true
|
|
111
|
-
}, /* @__PURE__ */ React2.createElement(StatusBar.Button, {
|
|
112
|
-
classNames: "text-xs"
|
|
113
|
-
}, isLabs ? version : v)), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
114
|
-
side: "top",
|
|
115
|
-
role: "message",
|
|
116
|
-
classNames: "z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]"
|
|
117
|
-
}, /* @__PURE__ */ React2.createElement(Message.Root, {
|
|
118
|
-
valence: "warning",
|
|
119
|
-
classNames: "rounded-be-none p-5"
|
|
120
|
-
}, /* @__PURE__ */ React2.createElement(Message.Title, null, t("warning title")), /* @__PURE__ */ React2.createElement(Message.Content, null, t("technology preview message"), /* @__PURE__ */ React2.createElement("br", null), /* @__PURE__ */ React2.createElement(Link, {
|
|
121
|
-
href: previewUrl,
|
|
122
|
-
target: "_blank",
|
|
123
|
-
rel: "noreferrer",
|
|
124
|
-
variant: "neutral"
|
|
125
|
-
}, t("learn more label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
126
|
-
icon: "ph--arrow-square-out--bold",
|
|
127
|
-
classNames: "inline mis-1"
|
|
128
|
-
})))), /* @__PURE__ */ React2.createElement("div", {
|
|
129
|
-
role: "none",
|
|
130
|
-
className: "plb-4 pli-5 space-b-2 text-baseText"
|
|
131
|
-
}, timestamp && /* @__PURE__ */ React2.createElement("p", null, t("released message", {
|
|
132
|
-
released: formatDistance(new Date(timestamp), /* @__PURE__ */ new Date(), {
|
|
133
|
-
addSuffix: true
|
|
134
|
-
})
|
|
135
|
-
}), /* @__PURE__ */ React2.createElement("br", null), /* @__PURE__ */ React2.createElement(Link, {
|
|
136
|
-
href: releaseUrl,
|
|
137
|
-
target: "_blank",
|
|
138
|
-
rel: "noreferrer",
|
|
139
|
-
variant: "neutral"
|
|
140
|
-
}, t("see release label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
141
|
-
icon: "ph--arrow-square-out--bold",
|
|
142
|
-
classNames: "inline mis-1"
|
|
143
|
-
}))), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement(Trans, {
|
|
144
|
-
t,
|
|
145
|
-
i18nKey: "powered by dxos message",
|
|
146
|
-
components: {
|
|
147
|
-
dxos: /* @__PURE__ */ React2.createElement(Link, {
|
|
148
|
-
href: "https://dxos.org",
|
|
149
|
-
target: "_blank",
|
|
150
|
-
rel: "noreferrer",
|
|
151
|
-
variant: "neutral"
|
|
152
|
-
})
|
|
153
|
-
}
|
|
154
|
-
}))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null))));
|
|
155
|
-
} finally {
|
|
156
|
-
_effect.f();
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
// src/components/StatusBarPanel.tsx
|
|
161
|
-
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
162
|
-
import React3, { useState } from "react";
|
|
163
|
-
import { Surface } from "@dxos/app-framework";
|
|
164
|
-
import { useConfig as useConfig2 } from "@dxos/react-client";
|
|
165
|
-
import { Icon as Icon2, Popover as Popover2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
166
|
-
var StatusBarActions = () => {
|
|
167
|
-
var _effect = _useSignals3();
|
|
168
|
-
try {
|
|
169
|
-
const { t } = useTranslation2(meta.id);
|
|
170
|
-
const [open, setOpen] = useState(false);
|
|
171
|
-
return /* @__PURE__ */ React3.createElement(Popover2.Root, {
|
|
172
|
-
open,
|
|
173
|
-
onOpenChange: setOpen
|
|
174
|
-
}, /* @__PURE__ */ React3.createElement(EnvironmentLabel, null), /* @__PURE__ */ React3.createElement(VersionNumber, null), /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
175
|
-
asChild: true
|
|
176
|
-
}, /* @__PURE__ */ React3.createElement("a", {
|
|
177
|
-
href: "https://dxos.org/discord",
|
|
178
|
-
target: "_blank",
|
|
179
|
-
rel: "noopener noreferrer"
|
|
180
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
181
|
-
icon: "ph--discord-logo--regular",
|
|
182
|
-
size: 4
|
|
183
|
-
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
184
|
-
classNames: "hidden sm:block"
|
|
185
|
-
}, t("discord label2")))), /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
186
|
-
asChild: true
|
|
187
|
-
}, /* @__PURE__ */ React3.createElement("a", {
|
|
188
|
-
href: "https://github.com/dxos/dxos",
|
|
189
|
-
target: "_blank",
|
|
190
|
-
rel: "noopener noreferrer"
|
|
191
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
192
|
-
icon: "ph--github-logo--regular",
|
|
193
|
-
size: 4
|
|
194
|
-
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
195
|
-
classNames: "hidden sm:block"
|
|
196
|
-
}, t("github label")))));
|
|
197
|
-
} finally {
|
|
198
|
-
_effect.f();
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
var StatusBarPanel = () => {
|
|
202
|
-
var _effect = _useSignals3();
|
|
203
|
-
try {
|
|
204
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(StatusBarActions, null), /* @__PURE__ */ React3.createElement("span", {
|
|
205
|
-
role: "separator",
|
|
206
|
-
className: "grow"
|
|
207
|
-
}), /* @__PURE__ */ React3.createElement(Surface, {
|
|
208
|
-
role: "status"
|
|
209
|
-
}));
|
|
210
|
-
} finally {
|
|
211
|
-
_effect.f();
|
|
212
|
-
}
|
|
213
|
-
};
|
|
214
|
-
var ENV_LABELS = {
|
|
215
|
-
"edge-dev": "Dev",
|
|
216
|
-
"edge-main": "Main",
|
|
217
|
-
"edge-labs": "Labs",
|
|
218
|
-
"edge-production": "Production"
|
|
219
|
-
};
|
|
220
|
-
var EnvironmentLabel = () => {
|
|
221
|
-
var _effect = _useSignals3();
|
|
222
|
-
try {
|
|
223
|
-
const config = useConfig2();
|
|
224
|
-
const edgeUrl = config.values.runtime?.services?.edge?.url;
|
|
225
|
-
if (!edgeUrl) {
|
|
226
|
-
return null;
|
|
227
|
-
}
|
|
228
|
-
const part = new URL(edgeUrl).host.split(".")[0];
|
|
229
|
-
const edgeEnv = ENV_LABELS[part];
|
|
230
|
-
if (!edgeEnv) {
|
|
231
|
-
return null;
|
|
232
|
-
}
|
|
233
|
-
return /* @__PURE__ */ React3.createElement(StatusBar.Item, null, /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
234
|
-
classNames: "text-xs text-subdued border border-separator rounded-full px-1"
|
|
235
|
-
}, /* @__PURE__ */ React3.createElement("span", {
|
|
236
|
-
title: edgeEnv
|
|
237
|
-
}, edgeEnv[0])));
|
|
238
|
-
} finally {
|
|
239
|
-
_effect.f();
|
|
240
|
-
}
|
|
241
|
-
};
|
|
242
|
-
|
|
243
|
-
export {
|
|
244
|
-
StatusBar,
|
|
245
|
-
STATUS_BAR_PLUGIN,
|
|
246
|
-
meta,
|
|
247
|
-
VersionNumber,
|
|
248
|
-
StatusBarActions,
|
|
249
|
-
StatusBarPanel
|
|
250
|
-
};
|
|
251
|
-
//# sourceMappingURL=chunk-IQXGCBGU.mjs.map
|