@dxos/plugin-status-bar 0.8.1-staging.5be625a → 0.8.1-staging.97aedb1
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 +86 -205
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/node/index.cjs +85 -205
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node-esm/index.mjs +86 -205
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/types/src/components/StatusBarPanel.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +0 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/components/StatusBarPanel.tsx +8 -25
- package/src/components/index.ts +0 -1
- package/src/translations.ts +4 -14
- package/dist/types/src/components/FeedbackForm.d.ts +0 -6
- package/dist/types/src/components/FeedbackForm.d.ts.map +0 -1
- package/src/components/FeedbackForm.tsx +0 -117
|
@@ -1,179 +1,36 @@
|
|
|
1
|
-
// packages/plugins/plugin-status-bar/src/components/FeedbackForm.tsx
|
|
2
|
-
import { PaperPlaneTilt, X } from "@phosphor-icons/react";
|
|
3
|
-
import React, { useRef } from "react";
|
|
4
|
-
import { getSnapshot } from "@dxos/echo-schema";
|
|
5
|
-
import { UserFeedback } from "@dxos/plugin-observability/types";
|
|
6
|
-
import { Button, Input, Popover, useTranslation } from "@dxos/react-ui";
|
|
7
|
-
import { FormProvider, useFormContext, useInputProps } from "@dxos/react-ui-form";
|
|
8
|
-
import { getSize } from "@dxos/react-ui-theme";
|
|
9
|
-
|
|
10
|
-
// packages/plugins/plugin-status-bar/src/meta.ts
|
|
11
|
-
var STATUS_BAR_PLUGIN = "dxos.org/plugin/status-bar";
|
|
12
|
-
var meta = {
|
|
13
|
-
id: STATUS_BAR_PLUGIN,
|
|
14
|
-
name: "Status Bar",
|
|
15
|
-
description: "Display a bar with status and actions.",
|
|
16
|
-
icon: "ph--info--regular"
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
// packages/plugins/plugin-status-bar/src/translations.ts
|
|
20
|
-
var entry = (translation) => ({
|
|
21
|
-
[STATUS_BAR_PLUGIN]: translation
|
|
22
|
-
});
|
|
23
|
-
var mkTranslation = (t) => (key) => t(key);
|
|
24
|
-
var translations = {
|
|
25
|
-
"en-US": entry({
|
|
26
|
-
"plugin name": "Status Bar",
|
|
27
|
-
"name label": "Name",
|
|
28
|
-
"name placeholder": "Preferred name",
|
|
29
|
-
"email input label": "Email",
|
|
30
|
-
"email input placeholder": "hello@example.com",
|
|
31
|
-
"feedback text area label": "Feedback",
|
|
32
|
-
"feedback text area placeholder": "Please describe your issue or suggestion.",
|
|
33
|
-
"send feedback label": "Send Feedback",
|
|
34
|
-
"warning title": "WARNING",
|
|
35
|
-
"technology preview message": "Composer is currently in beta.",
|
|
36
|
-
"learn more label": "Learn more",
|
|
37
|
-
"released message": "This version released {{released}}.",
|
|
38
|
-
"see release label": "See release on GitHub",
|
|
39
|
-
"powered by dxos message": "Powered by <dxos>DXOS</dxos>",
|
|
40
|
-
"discord label": "Discord",
|
|
41
|
-
"feedback label": "Feedback"
|
|
42
|
-
})
|
|
43
|
-
};
|
|
44
|
-
var translations_default = [
|
|
45
|
-
translations
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
// packages/plugins/plugin-status-bar/src/components/FeedbackForm.tsx
|
|
49
|
-
var defaultValues = {
|
|
50
|
-
name: "",
|
|
51
|
-
email: "",
|
|
52
|
-
message: ""
|
|
53
|
-
};
|
|
54
|
-
var FormContent = () => {
|
|
55
|
-
const { t } = useTranslation(STATUS_BAR_PLUGIN);
|
|
56
|
-
const translation = mkTranslation(t);
|
|
57
|
-
const { handleSave, canSave } = useFormContext();
|
|
58
|
-
const nameProps = useInputProps([
|
|
59
|
-
"name"
|
|
60
|
-
]);
|
|
61
|
-
const emailProps = useInputProps([
|
|
62
|
-
"email"
|
|
63
|
-
]);
|
|
64
|
-
const messageProps = useInputProps([
|
|
65
|
-
"message"
|
|
66
|
-
]);
|
|
67
|
-
return /* @__PURE__ */ React.createElement("div", {
|
|
68
|
-
role: "form",
|
|
69
|
-
className: "p-3 flex flex-col gap-2"
|
|
70
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
71
|
-
role: "none",
|
|
72
|
-
className: "space-b-1"
|
|
73
|
-
}, /* @__PURE__ */ React.createElement(Input.Root, {
|
|
74
|
-
validationValence: nameProps.getStatus().status
|
|
75
|
-
}, /* @__PURE__ */ React.createElement(Input.Label, null, translation("name label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
76
|
-
classNames: "text-sm",
|
|
77
|
-
placeholder: translation("name placeholder"),
|
|
78
|
-
autoFocus: true,
|
|
79
|
-
value: nameProps.getValue() ?? "",
|
|
80
|
-
onChange: (e) => nameProps.onValueChange("string", e.target.value),
|
|
81
|
-
onBlur: nameProps.onBlur
|
|
82
|
-
}), /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, null, /* @__PURE__ */ React.createElement(Input.Validation, null, nameProps.getStatus().error)))), /* @__PURE__ */ React.createElement("div", {
|
|
83
|
-
role: "none",
|
|
84
|
-
className: "space-b-1"
|
|
85
|
-
}, /* @__PURE__ */ React.createElement(Input.Root, {
|
|
86
|
-
validationValence: emailProps.getStatus().status
|
|
87
|
-
}, /* @__PURE__ */ React.createElement(Input.Label, null, translation("email input label")), /* @__PURE__ */ React.createElement(Input.TextInput, {
|
|
88
|
-
classNames: "text-sm",
|
|
89
|
-
placeholder: translation("email input placeholder"),
|
|
90
|
-
value: emailProps.getValue() ?? "",
|
|
91
|
-
onChange: (e) => emailProps.onValueChange("string", e.target.value),
|
|
92
|
-
onBlur: emailProps.onBlur
|
|
93
|
-
}), /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, null, /* @__PURE__ */ React.createElement(Input.Validation, null, emailProps.getStatus().error)))), /* @__PURE__ */ React.createElement("div", {
|
|
94
|
-
role: "none",
|
|
95
|
-
className: "space-b-1"
|
|
96
|
-
}, /* @__PURE__ */ React.createElement(Input.Root, {
|
|
97
|
-
validationValence: messageProps.getStatus().status
|
|
98
|
-
}, /* @__PURE__ */ React.createElement(Input.Label, null, translation("feedback text area label")), /* @__PURE__ */ React.createElement(Input.TextArea, {
|
|
99
|
-
classNames: "text-sm",
|
|
100
|
-
rows: 5,
|
|
101
|
-
cols: 30,
|
|
102
|
-
placeholder: translation("feedback text area placeholder"),
|
|
103
|
-
value: messageProps.getValue() ?? "",
|
|
104
|
-
onChange: (e) => messageProps.onValueChange("string", e.target.value),
|
|
105
|
-
onBlur: messageProps.onBlur
|
|
106
|
-
}), /* @__PURE__ */ React.createElement(Input.DescriptionAndValidation, null, /* @__PURE__ */ React.createElement(Input.Validation, null, messageProps.getStatus().error)))), /* @__PURE__ */ React.createElement("div", {
|
|
107
|
-
role: "none",
|
|
108
|
-
className: "space-b-2"
|
|
109
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
110
|
-
type: "submit",
|
|
111
|
-
variant: "primary",
|
|
112
|
-
classNames: "is-full flex gap-2",
|
|
113
|
-
disabled: !canSave,
|
|
114
|
-
onClick: handleSave
|
|
115
|
-
}, /* @__PURE__ */ React.createElement("span", null, translation("send feedback label")), /* @__PURE__ */ React.createElement("div", {
|
|
116
|
-
className: "grow"
|
|
117
|
-
}), /* @__PURE__ */ React.createElement(PaperPlaneTilt, {
|
|
118
|
-
className: getSize(5)
|
|
119
|
-
})), /* @__PURE__ */ React.createElement(Popover.Close, {
|
|
120
|
-
asChild: true
|
|
121
|
-
}, /* @__PURE__ */ React.createElement(Button, {
|
|
122
|
-
classNames: "is-full flex gap-2"
|
|
123
|
-
}, /* @__PURE__ */ React.createElement("span", null, t("cancel label", {
|
|
124
|
-
ns: "os"
|
|
125
|
-
})), /* @__PURE__ */ React.createElement("div", {
|
|
126
|
-
className: "grow"
|
|
127
|
-
}), /* @__PURE__ */ React.createElement(X, {
|
|
128
|
-
className: getSize(5)
|
|
129
|
-
})))));
|
|
130
|
-
};
|
|
131
|
-
var FeedbackForm = ({ onSave }) => {
|
|
132
|
-
const formRef = useRef(null);
|
|
133
|
-
const initialValues = getSnapshot(defaultValues);
|
|
134
|
-
return /* @__PURE__ */ React.createElement(FormProvider, {
|
|
135
|
-
formRef,
|
|
136
|
-
schema: UserFeedback,
|
|
137
|
-
initialValues,
|
|
138
|
-
onSave
|
|
139
|
-
}, /* @__PURE__ */ React.createElement("div", {
|
|
140
|
-
ref: formRef
|
|
141
|
-
}, /* @__PURE__ */ React.createElement(FormContent, null)));
|
|
142
|
-
};
|
|
143
|
-
|
|
144
1
|
// packages/plugins/plugin-status-bar/src/components/StatusBar.tsx
|
|
145
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
146
|
-
import
|
|
3
|
+
import React, { forwardRef } from "react";
|
|
147
4
|
import { mx } from "@dxos/react-ui-theme";
|
|
148
|
-
var StatusBarText = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => /* @__PURE__ */
|
|
5
|
+
var StatusBarText = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => /* @__PURE__ */ React.createElement("span", {
|
|
149
6
|
className: mx(classNames),
|
|
150
7
|
ref: forwardedRef
|
|
151
8
|
}, children));
|
|
152
9
|
var StatusBarButton = /* @__PURE__ */ forwardRef(({ classNames, children, asChild, ...props }, forwardedRef) => {
|
|
153
10
|
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);
|
|
154
|
-
return asChild ? /* @__PURE__ */
|
|
11
|
+
return asChild ? /* @__PURE__ */ React.createElement(Slot, {
|
|
155
12
|
role: "button",
|
|
156
13
|
ref: forwardedRef,
|
|
157
14
|
className: classes,
|
|
158
15
|
...props
|
|
159
|
-
}, children) : /* @__PURE__ */
|
|
16
|
+
}, children) : /* @__PURE__ */ React.createElement("button", {
|
|
160
17
|
className: classes,
|
|
161
18
|
ref: forwardedRef,
|
|
162
19
|
...props
|
|
163
20
|
}, children);
|
|
164
21
|
});
|
|
165
|
-
var StatusBarItem = /* @__PURE__ */ forwardRef(({ classNames, children, ...props }, forwardedRef) => /* @__PURE__ */
|
|
22
|
+
var StatusBarItem = /* @__PURE__ */ forwardRef(({ classNames, children, ...props }, forwardedRef) => /* @__PURE__ */ React.createElement("div", {
|
|
166
23
|
role: "menuitem",
|
|
167
24
|
className: mx("flex items-center justify-center gap-2 p-1 px-2 rounded-sm select-none", classNames),
|
|
168
25
|
ref: forwardedRef,
|
|
169
26
|
...props
|
|
170
27
|
}, children));
|
|
171
|
-
var StartContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => /* @__PURE__ */
|
|
28
|
+
var StartContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => /* @__PURE__ */ React.createElement("div", {
|
|
172
29
|
role: "none",
|
|
173
30
|
className: mx("flex-grow flex items-center space-x-2", classNames),
|
|
174
31
|
ref: forwardedRef
|
|
175
32
|
}, children));
|
|
176
|
-
var EndContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => /* @__PURE__ */
|
|
33
|
+
var EndContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => /* @__PURE__ */ React.createElement("div", {
|
|
177
34
|
role: "none",
|
|
178
35
|
className: mx("flex-grow flex items-center justify-end", classNames),
|
|
179
36
|
ref: forwardedRef
|
|
@@ -187,130 +44,155 @@ var StatusBar = {
|
|
|
187
44
|
};
|
|
188
45
|
|
|
189
46
|
// packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx
|
|
190
|
-
import
|
|
191
|
-
import {
|
|
192
|
-
import {
|
|
193
|
-
import { Icon as Icon2, Popover as Popover3, useTranslation as useTranslation3 } from "@dxos/react-ui";
|
|
47
|
+
import React3, { useState } from "react";
|
|
48
|
+
import { Surface } from "@dxos/app-framework";
|
|
49
|
+
import { Icon as Icon2, Popover as Popover2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
194
50
|
|
|
195
51
|
// packages/plugins/plugin-status-bar/src/components/VersionNumber.tsx
|
|
196
52
|
import { formatDistance } from "date-fns/formatDistance";
|
|
197
|
-
import
|
|
53
|
+
import React2 from "react";
|
|
198
54
|
import { useConfig } from "@dxos/react-client";
|
|
199
|
-
import { Link, Message, Popover
|
|
55
|
+
import { Link, Message, Popover, Trans, useTranslation, Icon } from "@dxos/react-ui";
|
|
56
|
+
|
|
57
|
+
// packages/plugins/plugin-status-bar/src/meta.ts
|
|
58
|
+
var STATUS_BAR_PLUGIN = "dxos.org/plugin/status-bar";
|
|
59
|
+
var meta = {
|
|
60
|
+
id: STATUS_BAR_PLUGIN,
|
|
61
|
+
name: "Status Bar",
|
|
62
|
+
description: "Display a bar with status and actions.",
|
|
63
|
+
icon: "ph--info--regular"
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// packages/plugins/plugin-status-bar/src/components/VersionNumber.tsx
|
|
200
67
|
var repo = "https://github.com/dxos/dxos";
|
|
201
68
|
var VERSION_REGEX = /([\d.]+)/;
|
|
202
69
|
var VersionNumber = () => {
|
|
203
70
|
const config = useConfig();
|
|
204
|
-
const { t } =
|
|
71
|
+
const { t } = useTranslation(STATUS_BAR_PLUGIN);
|
|
205
72
|
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
206
73
|
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
207
74
|
const isLabs = config.values.runtime?.app?.env?.DX_LABS;
|
|
208
75
|
const releaseUrl = config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production" ? `${repo}/releases/tag/v${version}` : `${repo}/commit/${commitHash}`;
|
|
209
76
|
const previewUrl = "https://docs.dxos.org/composer#technology-preview";
|
|
210
|
-
return /* @__PURE__ */
|
|
77
|
+
return /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
211
78
|
asChild: true
|
|
212
|
-
}, /* @__PURE__ */
|
|
79
|
+
}, /* @__PURE__ */ React2.createElement(StatusBar.Button, {
|
|
213
80
|
classNames: "text-xs"
|
|
214
|
-
}, isLabs ? version : v)), /* @__PURE__ */
|
|
81
|
+
}, isLabs ? version : v)), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
215
82
|
side: "top",
|
|
216
83
|
role: "message",
|
|
217
84
|
classNames: "z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]"
|
|
218
|
-
}, /* @__PURE__ */
|
|
85
|
+
}, /* @__PURE__ */ React2.createElement(Message.Root, {
|
|
219
86
|
valence: "warning",
|
|
220
87
|
className: "rounded-be-none p-5"
|
|
221
|
-
}, /* @__PURE__ */
|
|
88
|
+
}, /* @__PURE__ */ React2.createElement(Message.Title, null, /* @__PURE__ */ React2.createElement(Icon, {
|
|
222
89
|
icon: "ph--warning--duotone",
|
|
223
90
|
size: 6,
|
|
224
91
|
classNames: "inline mie-2"
|
|
225
|
-
}), /* @__PURE__ */
|
|
92
|
+
}), /* @__PURE__ */ React2.createElement("span", null, t("warning title"))), /* @__PURE__ */ React2.createElement(Message.Body, null, t("technology preview message"), /* @__PURE__ */ React2.createElement("br", null), /* @__PURE__ */ React2.createElement(Link, {
|
|
226
93
|
href: previewUrl,
|
|
227
94
|
target: "_blank",
|
|
228
95
|
rel: "noreferrer",
|
|
229
96
|
variant: "neutral"
|
|
230
|
-
}, t("learn more label"), /* @__PURE__ */
|
|
97
|
+
}, t("learn more label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
231
98
|
icon: "ph--arrow-square-out--bold",
|
|
232
99
|
classNames: "inline mis-1"
|
|
233
|
-
})))), /* @__PURE__ */
|
|
100
|
+
})))), /* @__PURE__ */ React2.createElement("div", {
|
|
234
101
|
role: "none",
|
|
235
102
|
className: "plb-4 pli-5 space-b-2 text-baseText"
|
|
236
|
-
}, timestamp && /* @__PURE__ */
|
|
103
|
+
}, timestamp && /* @__PURE__ */ React2.createElement("p", null, t("released message", {
|
|
237
104
|
released: formatDistance(new Date(timestamp), /* @__PURE__ */ new Date(), {
|
|
238
105
|
addSuffix: true
|
|
239
106
|
})
|
|
240
|
-
}), /* @__PURE__ */
|
|
107
|
+
}), /* @__PURE__ */ React2.createElement("br", null), /* @__PURE__ */ React2.createElement(Link, {
|
|
241
108
|
href: releaseUrl,
|
|
242
109
|
target: "_blank",
|
|
243
110
|
rel: "noreferrer",
|
|
244
111
|
variant: "neutral"
|
|
245
|
-
}, t("see release label"), /* @__PURE__ */
|
|
112
|
+
}, t("see release label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
246
113
|
icon: "ph--arrow-square-out--bold",
|
|
247
114
|
classNames: "inline mis-1"
|
|
248
|
-
}))), /* @__PURE__ */
|
|
115
|
+
}))), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement(Trans, {
|
|
249
116
|
t,
|
|
250
117
|
i18nKey: "powered by dxos message",
|
|
251
118
|
components: {
|
|
252
|
-
dxos: /* @__PURE__ */
|
|
119
|
+
dxos: /* @__PURE__ */ React2.createElement(Link, {
|
|
253
120
|
href: "https://dxos.org",
|
|
254
121
|
target: "_blank",
|
|
255
122
|
rel: "noreferrer",
|
|
256
123
|
variant: "neutral"
|
|
257
124
|
})
|
|
258
125
|
}
|
|
259
|
-
}))), /* @__PURE__ */
|
|
126
|
+
}))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null))));
|
|
260
127
|
};
|
|
261
128
|
|
|
262
129
|
// packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx
|
|
263
130
|
var StatusBarActions = () => {
|
|
264
|
-
const { t } =
|
|
131
|
+
const { t } = useTranslation2(STATUS_BAR_PLUGIN);
|
|
265
132
|
const [open, setOpen] = useState(false);
|
|
266
|
-
|
|
267
|
-
const handleSave = useCallback((values) => {
|
|
268
|
-
void dispatch(createIntent(ObservabilityAction.CaptureUserFeedback, values));
|
|
269
|
-
setOpen(false);
|
|
270
|
-
}, [
|
|
271
|
-
dispatch
|
|
272
|
-
]);
|
|
273
|
-
return /* @__PURE__ */ React4.createElement(Popover3.Root, {
|
|
133
|
+
return /* @__PURE__ */ React3.createElement(Popover2.Root, {
|
|
274
134
|
open,
|
|
275
135
|
onOpenChange: setOpen
|
|
276
|
-
}, /* @__PURE__ */
|
|
136
|
+
}, /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
277
137
|
asChild: true
|
|
278
|
-
}, /* @__PURE__ */
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
138
|
+
}, /* @__PURE__ */ React3.createElement("a", {
|
|
139
|
+
href: "https://dxos.org/discord",
|
|
140
|
+
target: "_blank",
|
|
141
|
+
rel: "noopener noreferrer"
|
|
142
|
+
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
143
|
+
icon: "ph--discord-logo--regular",
|
|
282
144
|
size: 4
|
|
283
|
-
}), /* @__PURE__ */
|
|
145
|
+
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
284
146
|
classNames: "hidden sm:block"
|
|
285
|
-
}, t("
|
|
147
|
+
}, t("discord label")))), /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
286
148
|
asChild: true
|
|
287
|
-
}, /* @__PURE__ */
|
|
288
|
-
href: "https://
|
|
149
|
+
}, /* @__PURE__ */ React3.createElement("a", {
|
|
150
|
+
href: "https://github.com/dxos/dxos",
|
|
289
151
|
target: "_blank",
|
|
290
152
|
rel: "noopener noreferrer"
|
|
291
|
-
}, /* @__PURE__ */
|
|
292
|
-
icon: "ph--
|
|
153
|
+
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
154
|
+
icon: "ph--github-logo--regular",
|
|
293
155
|
size: 4
|
|
294
|
-
}), /* @__PURE__ */
|
|
156
|
+
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
295
157
|
classNames: "hidden sm:block"
|
|
296
|
-
}, t("
|
|
297
|
-
classNames: "shadow-lg"
|
|
298
|
-
}, /* @__PURE__ */ React4.createElement(FeedbackForm, {
|
|
299
|
-
onSave: handleSave
|
|
300
|
-
}), /* @__PURE__ */ React4.createElement(Popover3.Arrow, null))));
|
|
158
|
+
}, t("github label")))), /* @__PURE__ */ React3.createElement(VersionNumber, null));
|
|
301
159
|
};
|
|
302
160
|
var StatusBarPanel = () => {
|
|
303
|
-
return /* @__PURE__ */
|
|
161
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(StatusBarActions, null), /* @__PURE__ */ React3.createElement("span", {
|
|
304
162
|
role: "separator",
|
|
305
163
|
className: "grow"
|
|
306
|
-
}), /* @__PURE__ */
|
|
164
|
+
}), /* @__PURE__ */ React3.createElement(Surface, {
|
|
307
165
|
role: "status"
|
|
308
166
|
}));
|
|
309
167
|
};
|
|
310
168
|
|
|
311
169
|
// packages/plugins/plugin-status-bar/src/StatusBarPlugin.tsx
|
|
312
|
-
import
|
|
170
|
+
import React4 from "react";
|
|
313
171
|
import { Capabilities, contributes, createSurface, defineModule, definePlugin, Events, Surface as Surface2 } from "@dxos/app-framework";
|
|
172
|
+
|
|
173
|
+
// packages/plugins/plugin-status-bar/src/translations.ts
|
|
174
|
+
var entry = (translation) => ({
|
|
175
|
+
[STATUS_BAR_PLUGIN]: translation
|
|
176
|
+
});
|
|
177
|
+
var translations = {
|
|
178
|
+
"en-US": entry({
|
|
179
|
+
"plugin name": "Status Bar",
|
|
180
|
+
"warning title": "WARNING",
|
|
181
|
+
"technology preview message": "Composer is currently in beta.",
|
|
182
|
+
"learn more label": "Learn more",
|
|
183
|
+
"released message": "This version released {{released}}.",
|
|
184
|
+
"see release label": "See release on GitHub",
|
|
185
|
+
"powered by dxos message": "Powered by <dxos>DXOS</dxos>",
|
|
186
|
+
"discord label": "Discord",
|
|
187
|
+
"github label": "GitHub",
|
|
188
|
+
"feedback label": "Feedback"
|
|
189
|
+
})
|
|
190
|
+
};
|
|
191
|
+
var translations_default = [
|
|
192
|
+
translations
|
|
193
|
+
];
|
|
194
|
+
|
|
195
|
+
// packages/plugins/plugin-status-bar/src/StatusBarPlugin.tsx
|
|
314
196
|
var StatusBarPlugin = () => definePlugin(meta, [
|
|
315
197
|
defineModule({
|
|
316
198
|
id: `${meta.id}/module/translations`,
|
|
@@ -324,30 +206,29 @@ var StatusBarPlugin = () => definePlugin(meta, [
|
|
|
324
206
|
createSurface({
|
|
325
207
|
id: meta.id,
|
|
326
208
|
role: "status-bar",
|
|
327
|
-
component: () => /* @__PURE__ */
|
|
209
|
+
component: () => /* @__PURE__ */ React4.createElement(StatusBarPanel, null)
|
|
328
210
|
}),
|
|
329
211
|
createSurface({
|
|
330
212
|
id: meta.id,
|
|
331
213
|
role: "status-bar--r0-footer",
|
|
332
|
-
component: () => /* @__PURE__ */
|
|
214
|
+
component: () => /* @__PURE__ */ React4.createElement(Surface2, {
|
|
333
215
|
role: "status"
|
|
334
216
|
})
|
|
335
217
|
}),
|
|
336
218
|
createSurface({
|
|
337
219
|
id: meta.id,
|
|
338
220
|
role: "status-bar--r1-footer",
|
|
339
|
-
component: () => /* @__PURE__ */
|
|
221
|
+
component: () => /* @__PURE__ */ React4.createElement(StatusBarActions, null)
|
|
340
222
|
}),
|
|
341
223
|
createSurface({
|
|
342
224
|
id: `${STATUS_BAR_PLUGIN}/header-end`,
|
|
343
225
|
role: "header-end",
|
|
344
|
-
component: () => /* @__PURE__ */
|
|
226
|
+
component: () => /* @__PURE__ */ React4.createElement(VersionNumber, null)
|
|
345
227
|
})
|
|
346
228
|
])
|
|
347
229
|
})
|
|
348
230
|
]);
|
|
349
231
|
export {
|
|
350
|
-
FeedbackForm,
|
|
351
232
|
STATUS_BAR_PLUGIN,
|
|
352
233
|
StatusBar,
|
|
353
234
|
StatusBarActions,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/components/
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { PaperPlaneTilt, X } from '@phosphor-icons/react';\nimport React, { useRef } from 'react';\n\nimport { getSnapshot } from '@dxos/echo-schema';\nimport { UserFeedback } from '@dxos/plugin-observability/types';\nimport { Button, Input, Popover, useTranslation } from '@dxos/react-ui';\nimport { FormProvider, useFormContext, useInputProps } from '@dxos/react-ui-form';\nimport { getSize } from '@dxos/react-ui-theme';\n\nimport { STATUS_BAR_PLUGIN } from '../meta';\nimport { mkTranslation } from '../translations';\n\nconst defaultValues: UserFeedback = { name: '', email: '', message: '' };\n\nconst FormContent = () => {\n const { t } = useTranslation(STATUS_BAR_PLUGIN);\n const translation = mkTranslation(t);\n const { handleSave, canSave } = useFormContext<UserFeedback>();\n\n const nameProps = useInputProps(['name']);\n const emailProps = useInputProps(['email']);\n const messageProps = useInputProps(['message']);\n\n return (\n <div role='form' className='p-3 flex flex-col gap-2'>\n <div role='none' className='space-b-1'>\n <Input.Root validationValence={nameProps.getStatus().status}>\n <Input.Label>{translation('name label')}</Input.Label>\n <Input.TextInput\n classNames={'text-sm'}\n placeholder={translation('name placeholder')}\n autoFocus\n value={nameProps.getValue() ?? ''}\n onChange={(e) => nameProps.onValueChange('string', e.target.value)}\n onBlur={nameProps.onBlur}\n />\n <Input.DescriptionAndValidation>\n <Input.Validation>{nameProps.getStatus().error}</Input.Validation>\n </Input.DescriptionAndValidation>\n </Input.Root>\n </div>\n\n <div role='none' className='space-b-1'>\n <Input.Root validationValence={emailProps.getStatus().status}>\n <Input.Label>{translation('email input label')}</Input.Label>\n <Input.TextInput\n classNames={'text-sm'}\n placeholder={translation('email input placeholder')}\n value={emailProps.getValue() ?? ''}\n onChange={(e) => emailProps.onValueChange('string', e.target.value)}\n onBlur={emailProps.onBlur}\n />\n <Input.DescriptionAndValidation>\n <Input.Validation>{emailProps.getStatus().error}</Input.Validation>\n </Input.DescriptionAndValidation>\n </Input.Root>\n </div>\n\n <div role='none' className='space-b-1'>\n <Input.Root validationValence={messageProps.getStatus().status}>\n <Input.Label>{translation('feedback text area label')}</Input.Label>\n <Input.TextArea\n classNames={'text-sm'}\n rows={5}\n cols={30}\n placeholder={translation('feedback text area placeholder')}\n value={messageProps.getValue() ?? ''}\n onChange={(e) => messageProps.onValueChange('string', e.target.value)}\n onBlur={messageProps.onBlur}\n />\n <Input.DescriptionAndValidation>\n <Input.Validation>{messageProps.getStatus().error}</Input.Validation>\n </Input.DescriptionAndValidation>\n </Input.Root>\n </div>\n\n <div role='none' className='space-b-2'>\n <Button\n type='submit'\n variant='primary'\n classNames='is-full flex gap-2'\n disabled={!canSave}\n onClick={handleSave}\n >\n <span>{translation('send feedback label')}</span>\n <div className='grow' />\n <PaperPlaneTilt className={getSize(5)} />\n </Button>\n <Popover.Close asChild>\n <Button classNames='is-full flex gap-2'>\n <span>{t('cancel label', { ns: 'os' })}</span>\n <div className='grow' />\n <X className={getSize(5)} />\n </Button>\n </Popover.Close>\n </div>\n </div>\n );\n};\n\nexport const FeedbackForm = ({ onSave }: { onSave: (values: UserFeedback) => void }) => {\n const formRef = useRef<HTMLDivElement>(null);\n\n const initialValues = getSnapshot(defaultValues);\n\n return (\n <FormProvider formRef={formRef} schema={UserFeedback} initialValues={initialValues} onSave={onSave}>\n <div ref={formRef}>\n <FormContent />\n </div>\n </FormProvider>\n );\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 2023 DXOS.org\n//\n\nimport { type useTranslation } from '@dxos/react-ui';\n\nimport { STATUS_BAR_PLUGIN } from './meta';\n\ntype StatusBarTranslationKeys =\n | 'plugin name'\n | 'email input label'\n | 'email input placeholder'\n | 'feedback text area label'\n | 'feedback text area placeholder'\n | 'send feedback label'\n | 'name label'\n | 'name placeholder'\n | 'warning title'\n | 'technology preview message'\n | 'learn more label'\n | 'released message'\n | 'see release label'\n | 'powered by dxos message'\n | 'discord label'\n | 'feedback label';\n\ntype RequiredTranslation = { [key in StatusBarTranslationKeys]: string };\ntype TranslationEntry = { [STATUS_BAR_PLUGIN]: RequiredTranslation };\ntype Language = string;\n\n// -- helpers.\nconst entry = (translation: RequiredTranslation): TranslationEntry => ({ [STATUS_BAR_PLUGIN]: translation });\nexport const mkTranslation = (t: ReturnType<typeof useTranslation>['t']) => (key: StatusBarTranslationKeys) => t(key);\n\nconst translations: Record<Language, TranslationEntry> = {\n 'en-US': entry({\n 'plugin name': 'Status Bar',\n 'name label': 'Name',\n 'name placeholder': 'Preferred name',\n 'email input label': 'Email',\n 'email input placeholder': 'hello@example.com',\n 'feedback text area label': 'Feedback',\n 'feedback text area placeholder': 'Please describe your issue or suggestion.',\n 'send feedback label': 'Send Feedback',\n 'warning title': 'WARNING',\n 'technology preview message': 'Composer is currently in beta.',\n 'learn more label': 'Learn more',\n 'released message': 'This version released {{released}}.',\n 'see release label': 'See release on GitHub',\n 'powered by dxos message': 'Powered by <dxos>DXOS</dxos>',\n 'discord label': 'Discord',\n 'feedback label': 'Feedback',\n }),\n};\n\nexport default [translations];\n", "//\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 React, { useCallback, useState } from 'react';\n\nimport { createIntent, Surface, useIntentDispatcher } from '@dxos/app-framework';\nimport { ObservabilityAction, type UserFeedback } from '@dxos/plugin-observability/types';\nimport { Icon, Popover, useTranslation } from '@dxos/react-ui';\n\nimport { FeedbackForm } from './FeedbackForm';\nimport { StatusBar } from './StatusBar';\nimport { VersionNumber } from './VersionNumber';\nimport { STATUS_BAR_PLUGIN } from '../meta';\n\nexport const StatusBarActions = () => {\n const { t } = useTranslation(STATUS_BAR_PLUGIN);\n const [open, setOpen] = useState(false);\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n const handleSave = useCallback(\n (values: UserFeedback) => {\n void dispatch(createIntent(ObservabilityAction.CaptureUserFeedback, values));\n setOpen(false);\n },\n [dispatch],\n );\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <StatusBar.Button data-joyride='welcome/feedback'>\n <Icon icon='ph--paper-plane-tilt--regular' size={4} />\n <StatusBar.Text classNames='hidden sm:block'>{t('feedback label')}</StatusBar.Text>\n </StatusBar.Button>\n </Popover.Trigger>\n {/* TODO(zan): Configure this label? */}\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 label')}</StatusBar.Text>\n </a>\n </StatusBar.Button>\n <VersionNumber />\n <Popover.Portal>\n <Popover.Content classNames='shadow-lg'>\n <FeedbackForm onSave={handleSave} />\n <Popover.Arrow />\n </Popover.Content>\n </Popover.Portal>\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", "//\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 { STATUS_BAR_PLUGIN } from '../meta';\n\nconst repo = 'https://github.com/dxos/dxos';\n\nconst VERSION_REGEX = /([\\d.]+)/;\n\nexport const VersionNumber = () => {\n const config = useConfig();\n const { t } = useTranslation(STATUS_BAR_PLUGIN);\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' className='rounded-be-none p-5'>\n <Message.Title>\n <Icon icon='ph--warning--duotone' size={6} classNames='inline mie-2' />\n <span>{t('warning title')}</span>\n </Message.Title>\n <Message.Body>\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.Body>\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 from 'react';\n\nimport {\n Capabilities,\n contributes,\n createSurface,\n defineModule,\n definePlugin,\n Events,\n Surface,\n} from '@dxos/app-framework';\n\nimport { StatusBarActions, StatusBarPanel } from './components';\nimport { VersionNumber } from './components/VersionNumber';\nimport { meta, STATUS_BAR_PLUGIN } from './meta';\nimport translations from './translations';\n\nexport const StatusBarPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: meta.id,\n role: 'status-bar',\n component: () => <StatusBarPanel />,\n }),\n createSurface({\n id: meta.id,\n role: 'status-bar--r0-footer',\n component: () => <Surface role='status' />,\n }),\n createSurface({\n id: meta.id,\n role: 'status-bar--r1-footer',\n component: () => <StatusBarActions />,\n }),\n createSurface({\n id: `${STATUS_BAR_PLUGIN}/header-end`,\n role: 'header-end',\n component: () => <VersionNumber />,\n }),\n ]),\n }),\n ]);\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/components/StatusBar.tsx", "../../../src/components/StatusBarPanel.tsx", "../../../src/components/VersionNumber.tsx", "../../../src/meta.ts", "../../../src/StatusBarPlugin.tsx", "../../../src/translations.ts"],
|
|
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 React, { useState } from 'react';\n\nimport { Surface } from '@dxos/app-framework';\nimport { Icon, Popover, useTranslation } from '@dxos/react-ui';\n\nimport { StatusBar } from './StatusBar';\nimport { VersionNumber } from './VersionNumber';\nimport { STATUS_BAR_PLUGIN } from '../meta';\n\nexport const StatusBarActions = () => {\n const { t } = useTranslation(STATUS_BAR_PLUGIN);\n const [open, setOpen] = useState(false);\n\n return (\n <Popover.Root open={open} onOpenChange={setOpen}>\n {/* TODO(zan): Configure this label? */}\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 label')}</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 <VersionNumber />\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", "//\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 { STATUS_BAR_PLUGIN } from '../meta';\n\nconst repo = 'https://github.com/dxos/dxos';\n\nconst VERSION_REGEX = /([\\d.]+)/;\n\nexport const VersionNumber = () => {\n const config = useConfig();\n const { t } = useTranslation(STATUS_BAR_PLUGIN);\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' className='rounded-be-none p-5'>\n <Message.Title>\n <Icon icon='ph--warning--duotone' size={6} classNames='inline mie-2' />\n <span>{t('warning title')}</span>\n </Message.Title>\n <Message.Body>\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.Body>\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 { 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 React from 'react';\n\nimport {\n Capabilities,\n contributes,\n createSurface,\n defineModule,\n definePlugin,\n Events,\n Surface,\n} from '@dxos/app-framework';\n\nimport { StatusBarActions, StatusBarPanel } from './components';\nimport { VersionNumber } from './components/VersionNumber';\nimport { meta, STATUS_BAR_PLUGIN } from './meta';\nimport translations from './translations';\n\nexport const StatusBarPlugin = () =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: meta.id,\n role: 'status-bar',\n component: () => <StatusBarPanel />,\n }),\n createSurface({\n id: meta.id,\n role: 'status-bar--r0-footer',\n component: () => <Surface role='status' />,\n }),\n createSurface({\n id: meta.id,\n role: 'status-bar--r1-footer',\n component: () => <StatusBarActions />,\n }),\n createSurface({\n id: `${STATUS_BAR_PLUGIN}/header-end`,\n role: 'header-end',\n component: () => <VersionNumber />,\n }),\n ]),\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type useTranslation } from '@dxos/react-ui';\n\nimport { STATUS_BAR_PLUGIN } from './meta';\n\n// TODO(wittjosiah): There's got to be a better way to do typesafe translations, this is too much boilerplate.\n\ntype StatusBarTranslationKeys =\n | 'plugin name'\n | 'warning title'\n | 'technology preview message'\n | 'learn more label'\n | 'released message'\n | 'see release label'\n | 'powered by dxos message'\n | 'discord label'\n | 'github label'\n | 'feedback label';\n\ntype RequiredTranslation = { [key in StatusBarTranslationKeys]: string };\ntype TranslationEntry = { [STATUS_BAR_PLUGIN]: RequiredTranslation };\ntype Language = string;\n\n// -- helpers.\nconst entry = (translation: RequiredTranslation): TranslationEntry => ({ [STATUS_BAR_PLUGIN]: translation });\nexport const mkTranslation = (t: ReturnType<typeof useTranslation>['t']) => (key: StatusBarTranslationKeys) => t(key);\n\nconst translations: Record<Language, TranslationEntry> = {\n 'en-US': entry({\n 'plugin name': 'Status Bar',\n 'warning title': 'WARNING',\n 'technology preview message': 'Composer is currently in beta.',\n 'learn more label': 'Learn more',\n 'released message': 'This version released {{released}}.',\n 'see release label': 'See release on GitHub',\n 'powered by dxos message': 'Powered by <dxos>DXOS</dxos>',\n 'discord label': 'Discord',\n 'github label': 'GitHub',\n 'feedback label': 'Feedback',\n }),\n};\n\nexport default [translations];\n"],
|
|
5
|
+
"mappings": ";AAIA,SAASA,YAAY;AACrB,OAAOC,SAAqCC,kBAA0D;AAGtG,SAASC,UAAU;AAInB,IAAMC,gBAAgBC,2BAAgD,CAAC,EAAEC,YAAYC,SAAQ,GAAIC,iBAC/F,sBAAA,cAACC,QAAAA;EAAKC,WAAWC,GAAGL,UAAAA;EAAaM,KAAKJ;GACnCD,QAAAA,CAAAA;AAML,IAAMM,kBAAkBR,2BACtB,CAAC,EAAEC,YAAYC,UAAUO,SAAS,GAAGC,MAAAA,GAASP,iBAAAA;AAC5C,QAAMQ,UAAUL,GACd,8DACA,qEACA,kGACAL,UAAAA;AAGF,SAAOQ,UACL,sBAAA,cAACG,MAAAA;IAAKC,MAAK;IAASN,KAAKJ;IAAcE,WAAWM;IAAU,GAAGD;KAC5DR,QAAAA,IAGH,sBAAA,cAACY,UAAAA;IAAOT,WAAWM;IAASJ,KAAKJ;IAAe,GAAGO;KAChDR,QAAAA;AAGP,CAAA;AAOF,IAAMa,gBAAgBC,2BACpB,CAAC,EAAEC,YAAYC,UAAU,GAAGC,MAAAA,GAASC,iBACnC,sBAAA,cAACC,OAAAA;EACCC,MAAK;EACLC,WAAWC,GAAG,0EAA0EP,UAAAA;EACxFQ,KAAKL;EACJ,GAAGD;GAEHD,QAAAA,CAAAA;AAOP,IAAMQ,eAAeV,2B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AAc;QACZX,IAAI,GAAGkB,iBAAAA;QACPN,MAAM;QACNC,WAAW,MAAM,gBAAAC,OAAA,cAACK,eAAAA,IAAAA;MACpB,CAAA;KACD;EACL,CAAA;CACD;",
|
|
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", "React", "useState", "Surface", "Icon", "Popover", "useTranslation", "formatDistance", "React", "useConfig", "Link", "Message", "Popover", "Trans", "useTranslation", "Icon", "STATUS_BAR_PLUGIN", "meta", "id", "name", "description", "icon", "repo", "VERSION_REGEX", "VersionNumber", "config", "useConfig", "t", "useTranslation", "STATUS_BAR_PLUGIN", "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", "className", "Title", "Icon", "icon", "size", "span", "Body", "br", "Link", "href", "target", "rel", "variant", "div", "p", "released", "formatDistance", "Date", "addSuffix", "Trans", "i18nKey", "components", "dxos", "Arrow", "StatusBarActions", "t", "useTranslation", "STATUS_BAR_PLUGIN", "open", "setOpen", "useState", "React", "Popover", "Root", "onOpenChange", "StatusBar", "Button", "asChild", "a", "href", "target", "rel", "Icon", "icon", "size", "Text", "classNames", "VersionNumber", "StatusBarPanel", "span", "role", "className", "Surface", "React", "Capabilities", "contributes", "createSurface", "defineModule", "definePlugin", "Events", "Surface", "entry", "translation", "STATUS_BAR_PLUGIN", "translations", "entry", "StatusBarPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "SetupReactSurface", "ReactSurface", "createSurface", "role", "component", "React", "StatusBarPanel", "Surface", "StatusBarActions", "STATUS_BAR_PLUGIN", "VersionNumber"]
|
|
7
7
|
}
|