@dxos/plugin-status-bar 0.8.2-staging.7ac8446 → 0.8.2
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/chunk-P5BV6L2J.mjs +253 -0
- package/dist/lib/browser/chunk-P5BV6L2J.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +16 -194
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-FCB6CYVQ.mjs +38 -0
- package/dist/lib/browser/react-surface-FCB6CYVQ.mjs.map +7 -0
- package/dist/lib/node/chunk-4IGLOCOS.cjs +284 -0
- package/dist/lib/node/chunk-4IGLOCOS.cjs.map +7 -0
- package/dist/lib/node/index.cjs +19 -194
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-KZY6SOXE.cjs +61 -0
- package/dist/lib/node/react-surface-KZY6SOXE.cjs.map +7 -0
- package/dist/lib/node-esm/chunk-5Q57YPD6.mjs +255 -0
- package/dist/lib/node-esm/chunk-5Q57YPD6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +16 -195
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-YKOZ4BU7.mjs +39 -0
- package/dist/lib/node-esm/react-surface-YKOZ4BU7.mjs.map +7 -0
- package/dist/types/src/StatusBarPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/components/StatusBarPanel.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +18 -15
- package/src/StatusBarPlugin.ts +23 -0
- package/src/capabilities/index.ts +7 -0
- package/src/capabilities/react-surface.tsx +34 -0
- package/src/components/StatusBarPanel.tsx +31 -2
- package/src/components/VersionNumber.tsx +1 -1
- package/src/components/index.ts +1 -0
- package/src/StatusBarPlugin.tsx +0 -56
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// packages/plugins/plugin-status-bar/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
|
+
// packages/plugins/plugin-status-bar/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
|
+
// packages/plugins/plugin-status-bar/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(STATUS_BAR_PLUGIN);
|
|
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
|
+
className: "rounded-be-none p-5"
|
|
120
|
+
}, /* @__PURE__ */ React2.createElement(Message.Title, null, /* @__PURE__ */ React2.createElement(Icon, {
|
|
121
|
+
icon: "ph--warning--duotone",
|
|
122
|
+
size: 6,
|
|
123
|
+
classNames: "inline mie-2"
|
|
124
|
+
}), /* @__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, {
|
|
125
|
+
href: previewUrl,
|
|
126
|
+
target: "_blank",
|
|
127
|
+
rel: "noreferrer",
|
|
128
|
+
variant: "neutral"
|
|
129
|
+
}, t("learn more label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
130
|
+
icon: "ph--arrow-square-out--bold",
|
|
131
|
+
classNames: "inline mis-1"
|
|
132
|
+
})))), /* @__PURE__ */ React2.createElement("div", {
|
|
133
|
+
role: "none",
|
|
134
|
+
className: "plb-4 pli-5 space-b-2 text-baseText"
|
|
135
|
+
}, timestamp && /* @__PURE__ */ React2.createElement("p", null, t("released message", {
|
|
136
|
+
released: formatDistance(new Date(timestamp), /* @__PURE__ */ new Date(), {
|
|
137
|
+
addSuffix: true
|
|
138
|
+
})
|
|
139
|
+
}), /* @__PURE__ */ React2.createElement("br", null), /* @__PURE__ */ React2.createElement(Link, {
|
|
140
|
+
href: releaseUrl,
|
|
141
|
+
target: "_blank",
|
|
142
|
+
rel: "noreferrer",
|
|
143
|
+
variant: "neutral"
|
|
144
|
+
}, t("see release label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
145
|
+
icon: "ph--arrow-square-out--bold",
|
|
146
|
+
classNames: "inline mis-1"
|
|
147
|
+
}))), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement(Trans, {
|
|
148
|
+
t,
|
|
149
|
+
i18nKey: "powered by dxos message",
|
|
150
|
+
components: {
|
|
151
|
+
dxos: /* @__PURE__ */ React2.createElement(Link, {
|
|
152
|
+
href: "https://dxos.org",
|
|
153
|
+
target: "_blank",
|
|
154
|
+
rel: "noreferrer",
|
|
155
|
+
variant: "neutral"
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
}))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null))));
|
|
159
|
+
} finally {
|
|
160
|
+
_effect.f();
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx
|
|
165
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
166
|
+
import React3, { useState } from "react";
|
|
167
|
+
import { Surface } from "@dxos/app-framework";
|
|
168
|
+
import { useConfig as useConfig2 } from "@dxos/react-client";
|
|
169
|
+
import { Icon as Icon2, Popover as Popover2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
170
|
+
var StatusBarActions = () => {
|
|
171
|
+
var _effect = _useSignals3();
|
|
172
|
+
try {
|
|
173
|
+
const { t } = useTranslation2(STATUS_BAR_PLUGIN);
|
|
174
|
+
const [open, setOpen] = useState(false);
|
|
175
|
+
return /* @__PURE__ */ React3.createElement(Popover2.Root, {
|
|
176
|
+
open,
|
|
177
|
+
onOpenChange: setOpen
|
|
178
|
+
}, /* @__PURE__ */ React3.createElement(EnvironmentLabel, null), /* @__PURE__ */ React3.createElement(VersionNumber, null), /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
179
|
+
asChild: true
|
|
180
|
+
}, /* @__PURE__ */ React3.createElement("a", {
|
|
181
|
+
href: "https://dxos.org/discord",
|
|
182
|
+
target: "_blank",
|
|
183
|
+
rel: "noopener noreferrer"
|
|
184
|
+
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
185
|
+
icon: "ph--discord-logo--regular",
|
|
186
|
+
size: 4
|
|
187
|
+
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
188
|
+
classNames: "hidden sm:block"
|
|
189
|
+
}, t("discord label")))), /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
190
|
+
asChild: true
|
|
191
|
+
}, /* @__PURE__ */ React3.createElement("a", {
|
|
192
|
+
href: "https://github.com/dxos/dxos",
|
|
193
|
+
target: "_blank",
|
|
194
|
+
rel: "noopener noreferrer"
|
|
195
|
+
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
196
|
+
icon: "ph--github-logo--regular",
|
|
197
|
+
size: 4
|
|
198
|
+
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
199
|
+
classNames: "hidden sm:block"
|
|
200
|
+
}, t("github label")))));
|
|
201
|
+
} finally {
|
|
202
|
+
_effect.f();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
var StatusBarPanel = () => {
|
|
206
|
+
var _effect = _useSignals3();
|
|
207
|
+
try {
|
|
208
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(StatusBarActions, null), /* @__PURE__ */ React3.createElement("span", {
|
|
209
|
+
role: "separator",
|
|
210
|
+
className: "grow"
|
|
211
|
+
}), /* @__PURE__ */ React3.createElement(Surface, {
|
|
212
|
+
role: "status"
|
|
213
|
+
}));
|
|
214
|
+
} finally {
|
|
215
|
+
_effect.f();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
var ENV_LABELS = {
|
|
219
|
+
"edge-dev": "Dev",
|
|
220
|
+
"edge-main": "Main",
|
|
221
|
+
"edge-labs": "Labs",
|
|
222
|
+
"edge-production": "Production"
|
|
223
|
+
};
|
|
224
|
+
var EnvironmentLabel = () => {
|
|
225
|
+
var _effect = _useSignals3();
|
|
226
|
+
try {
|
|
227
|
+
const config = useConfig2();
|
|
228
|
+
const edgeUrl = config.values.runtime?.services?.edge?.url;
|
|
229
|
+
if (!edgeUrl) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
const part = new URL(edgeUrl).host.split(".")[0];
|
|
233
|
+
const edgeEnv = ENV_LABELS[part];
|
|
234
|
+
if (!edgeEnv) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
return /* @__PURE__ */ React3.createElement(StatusBar.Item, null, /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
238
|
+
classNames: "text-xs text-subdued border border-separator rounded-full px-1"
|
|
239
|
+
}, /* @__PURE__ */ React3.createElement("span", {
|
|
240
|
+
title: edgeEnv
|
|
241
|
+
}, edgeEnv[0])));
|
|
242
|
+
} finally {
|
|
243
|
+
_effect.f();
|
|
244
|
+
}
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
export {
|
|
248
|
+
StatusBar,
|
|
249
|
+
STATUS_BAR_PLUGIN,
|
|
250
|
+
meta,
|
|
251
|
+
VersionNumber,
|
|
252
|
+
StatusBarActions,
|
|
253
|
+
StatusBarPanel
|
|
254
|
+
};
|
|
255
|
+
//# sourceMappingURL=chunk-5Q57YPD6.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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 { STATUS_BAR_PLUGIN } from '../meta';\n\nconst repo = 'https://github.com/dxos/dxos';\n\nconst VERSION_REGEX = /([\\d.]+)/;\n\nexport const VersionNumber = () => {\n const { t } = useTranslation(STATUS_BAR_PLUGIN);\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' 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, { 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 { 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 <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 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 </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,OAAOC,SAAqCC,kBAA0D;AAGtG,SAASC,UAAU;AAInB,IAAMC,gBAAgBC,2BAAgD,CAAC,EAAEC,YAAYC,SAAQ,GAAIC,iBAAAA;;;WAC/F,sBAAA,cAACC,QAAAA;MAAKC,WAAWC,GAAGL,UAAAA;MAAaM,KAAKJ;OACnCD,QAAAA;;;;;AAML,IAAMM,kBAAkBR,2BACtB,CAAC,EAAEC,YAAYC,UAAUO,SAAS,GAAGC,MAAAA,GAASP,iBAAAA;;;AAC5C,UAAMQ,UAAUL,GACd,8DACA,qEACA,kGACAL,UAAAA;AAGF,WAAOQ,UACL,sBAAA,cAACG,MAAAA;MAAKC,MAAK;MAASN,KAAKJ;MAAcE,WAAWM;MAAU,GAAGD;OAC5DR,QAAAA,IAGH,sBAAA,cAACY,UAAAA;MAAOT,WAAWM;MAASJ,KAAKJ;MAAe,GAAGO;OAChDR,QAAAA;;;;AAGP,CAAA;AAOF,IAAMa,gBAAgBC,2BACpB,CAAC,EAAEC,YAAYC,UAAU,GAAGC,MAAA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;OAChB,gBAAAR,OAAA,cAACS,KAAAA;MAAEC,MAAK;MAA+BC,QAAO;MAASC,KAAI;OACzD,gBAAAZ,OAAA,cAACa,OAAAA;MAAKC,MAAK;MAA2BC,MAAM;QAC5C,gBAAAf,OAAA,cAACM,UAAUU,MAAI;MAACC,YAAW;OAAmBvB,EAAE,cAAA,CAAA,CAAA,CAAA,CAAA;;;;AAK1D;AAEO,IAAMwB,iBAAiB,MAAA;;;AAC5B,WACE,gBAAAlB,OAAA,cAAAA,OAAA,UAAA,MACE,gBAAAA,OAAA,cAACP,kBAAAA,IAAAA,GACD,gBAAAO,OAAA,cAACmB,QAAAA;MAAKC,MAAK;MAAYC,WAAU;QACjC,gBAAArB,OAAA,cAACsB,SAAAA;MAAQF,MAAK;;;;;AAGpB;AAEA,IAAMG,aAAqC;EACzC,YAAY;EACZ,aAAa;EACb,aAAa;EACb,mBAAmB;AACrB;AAEA,IAAMnB,mBAAmB,MAAA;;;AACvB,UAAMoB,SAASC,WAAAA;AACf,UAAMC,UAAUF,OAAOG,OAAOC,SAASC,UAAUC,MAAMC;AACvD,QAAI,CAACL,SAAS;AACZ,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", "STATUS_BAR_PLUGIN", "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", "className", "Title", "Icon", "icon", "size", "span", "Body", "br", "Link", "href", "target", "rel", "variant", "div", "p", "released", "formatDistance", "Date", "addSuffix", "Trans", "i18nKey", "components", "dxos", "Arrow", "React", "useState", "Surface", "useConfig", "Icon", "Popover", "useTranslation", "StatusBarActions", "t", "useTranslation", "STATUS_BAR_PLUGIN", "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,176 +1,19 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
STATUS_BAR_PLUGIN,
|
|
4
|
+
StatusBar,
|
|
5
|
+
StatusBarActions,
|
|
6
|
+
StatusBarPanel,
|
|
7
|
+
VersionNumber,
|
|
8
|
+
meta
|
|
9
|
+
} from "./chunk-5Q57YPD6.mjs";
|
|
2
10
|
|
|
3
|
-
// packages/plugins/plugin-status-bar/src/
|
|
4
|
-
import {
|
|
5
|
-
import React, { forwardRef } from "react";
|
|
6
|
-
import { mx } from "@dxos/react-ui-theme";
|
|
7
|
-
var StatusBarText = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => /* @__PURE__ */ React.createElement("span", {
|
|
8
|
-
className: mx(classNames),
|
|
9
|
-
ref: forwardedRef
|
|
10
|
-
}, children));
|
|
11
|
-
var StatusBarButton = /* @__PURE__ */ forwardRef(({ classNames, children, asChild, ...props }, forwardedRef) => {
|
|
12
|
-
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);
|
|
13
|
-
return asChild ? /* @__PURE__ */ React.createElement(Slot, {
|
|
14
|
-
role: "button",
|
|
15
|
-
ref: forwardedRef,
|
|
16
|
-
className: classes,
|
|
17
|
-
...props
|
|
18
|
-
}, children) : /* @__PURE__ */ React.createElement("button", {
|
|
19
|
-
className: classes,
|
|
20
|
-
ref: forwardedRef,
|
|
21
|
-
...props
|
|
22
|
-
}, children);
|
|
23
|
-
});
|
|
24
|
-
var StatusBarItem = /* @__PURE__ */ forwardRef(({ classNames, children, ...props }, forwardedRef) => /* @__PURE__ */ React.createElement("div", {
|
|
25
|
-
role: "menuitem",
|
|
26
|
-
className: mx("flex items-center justify-center gap-2 p-1 px-2 rounded-sm select-none", classNames),
|
|
27
|
-
ref: forwardedRef,
|
|
28
|
-
...props
|
|
29
|
-
}, children));
|
|
30
|
-
var StartContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => /* @__PURE__ */ React.createElement("div", {
|
|
31
|
-
role: "none",
|
|
32
|
-
className: mx("flex-grow flex items-center space-x-2", classNames),
|
|
33
|
-
ref: forwardedRef
|
|
34
|
-
}, children));
|
|
35
|
-
var EndContent = /* @__PURE__ */ forwardRef(({ classNames, children }, forwardedRef) => /* @__PURE__ */ React.createElement("div", {
|
|
36
|
-
role: "none",
|
|
37
|
-
className: mx("flex-grow flex items-center justify-end", classNames),
|
|
38
|
-
ref: forwardedRef
|
|
39
|
-
}, children));
|
|
40
|
-
var StatusBar = {
|
|
41
|
-
Text: StatusBarText,
|
|
42
|
-
Item: StatusBarItem,
|
|
43
|
-
Button: StatusBarButton,
|
|
44
|
-
StartContent,
|
|
45
|
-
EndContent
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx
|
|
49
|
-
import React3, { useState } from "react";
|
|
50
|
-
import { Surface } from "@dxos/app-framework";
|
|
51
|
-
import { Icon as Icon2, Popover as Popover2, useTranslation as useTranslation2 } from "@dxos/react-ui";
|
|
52
|
-
|
|
53
|
-
// packages/plugins/plugin-status-bar/src/components/VersionNumber.tsx
|
|
54
|
-
import { formatDistance } from "date-fns/formatDistance";
|
|
55
|
-
import React2 from "react";
|
|
56
|
-
import { useConfig } from "@dxos/react-client";
|
|
57
|
-
import { Link, Message, Popover, Trans, useTranslation, Icon } from "@dxos/react-ui";
|
|
58
|
-
|
|
59
|
-
// packages/plugins/plugin-status-bar/src/meta.ts
|
|
60
|
-
var STATUS_BAR_PLUGIN = "dxos.org/plugin/status-bar";
|
|
61
|
-
var meta = {
|
|
62
|
-
id: STATUS_BAR_PLUGIN,
|
|
63
|
-
name: "Status Bar",
|
|
64
|
-
description: "Display a bar with status and actions.",
|
|
65
|
-
icon: "ph--info--regular"
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
// packages/plugins/plugin-status-bar/src/components/VersionNumber.tsx
|
|
69
|
-
var repo = "https://github.com/dxos/dxos";
|
|
70
|
-
var VERSION_REGEX = /([\d.]+)/;
|
|
71
|
-
var VersionNumber = () => {
|
|
72
|
-
const config = useConfig();
|
|
73
|
-
const { t } = useTranslation(STATUS_BAR_PLUGIN);
|
|
74
|
-
const { version, timestamp, commitHash } = config.values.runtime?.app?.build ?? {};
|
|
75
|
-
const [_, v] = version?.match(VERSION_REGEX) ?? [];
|
|
76
|
-
const isLabs = config.values.runtime?.app?.env?.DX_LABS;
|
|
77
|
-
const releaseUrl = config.values.runtime?.app?.env?.DX_ENVIRONMENT === "production" ? `${repo}/releases/tag/v${version}` : `${repo}/commit/${commitHash}`;
|
|
78
|
-
const previewUrl = "https://docs.dxos.org/composer#technology-preview";
|
|
79
|
-
return /* @__PURE__ */ React2.createElement(Popover.Root, null, /* @__PURE__ */ React2.createElement(Popover.Trigger, {
|
|
80
|
-
asChild: true
|
|
81
|
-
}, /* @__PURE__ */ React2.createElement(StatusBar.Button, {
|
|
82
|
-
classNames: "text-xs"
|
|
83
|
-
}, isLabs ? version : v)), /* @__PURE__ */ React2.createElement(Popover.Portal, null, /* @__PURE__ */ React2.createElement(Popover.Content, {
|
|
84
|
-
side: "top",
|
|
85
|
-
role: "message",
|
|
86
|
-
classNames: "z-[12] bg-warning-500 max-is-[min(calc(100vw-16px),40ch)]"
|
|
87
|
-
}, /* @__PURE__ */ React2.createElement(Message.Root, {
|
|
88
|
-
valence: "warning",
|
|
89
|
-
className: "rounded-be-none p-5"
|
|
90
|
-
}, /* @__PURE__ */ React2.createElement(Message.Title, null, /* @__PURE__ */ React2.createElement(Icon, {
|
|
91
|
-
icon: "ph--warning--duotone",
|
|
92
|
-
size: 6,
|
|
93
|
-
classNames: "inline mie-2"
|
|
94
|
-
}), /* @__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, {
|
|
95
|
-
href: previewUrl,
|
|
96
|
-
target: "_blank",
|
|
97
|
-
rel: "noreferrer",
|
|
98
|
-
variant: "neutral"
|
|
99
|
-
}, t("learn more label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
100
|
-
icon: "ph--arrow-square-out--bold",
|
|
101
|
-
classNames: "inline mis-1"
|
|
102
|
-
})))), /* @__PURE__ */ React2.createElement("div", {
|
|
103
|
-
role: "none",
|
|
104
|
-
className: "plb-4 pli-5 space-b-2 text-baseText"
|
|
105
|
-
}, timestamp && /* @__PURE__ */ React2.createElement("p", null, t("released message", {
|
|
106
|
-
released: formatDistance(new Date(timestamp), /* @__PURE__ */ new Date(), {
|
|
107
|
-
addSuffix: true
|
|
108
|
-
})
|
|
109
|
-
}), /* @__PURE__ */ React2.createElement("br", null), /* @__PURE__ */ React2.createElement(Link, {
|
|
110
|
-
href: releaseUrl,
|
|
111
|
-
target: "_blank",
|
|
112
|
-
rel: "noreferrer",
|
|
113
|
-
variant: "neutral"
|
|
114
|
-
}, t("see release label"), /* @__PURE__ */ React2.createElement(Icon, {
|
|
115
|
-
icon: "ph--arrow-square-out--bold",
|
|
116
|
-
classNames: "inline mis-1"
|
|
117
|
-
}))), /* @__PURE__ */ React2.createElement("p", null, /* @__PURE__ */ React2.createElement(Trans, {
|
|
118
|
-
t,
|
|
119
|
-
i18nKey: "powered by dxos message",
|
|
120
|
-
components: {
|
|
121
|
-
dxos: /* @__PURE__ */ React2.createElement(Link, {
|
|
122
|
-
href: "https://dxos.org",
|
|
123
|
-
target: "_blank",
|
|
124
|
-
rel: "noreferrer",
|
|
125
|
-
variant: "neutral"
|
|
126
|
-
})
|
|
127
|
-
}
|
|
128
|
-
}))), /* @__PURE__ */ React2.createElement(Popover.Arrow, null))));
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// packages/plugins/plugin-status-bar/src/components/StatusBarPanel.tsx
|
|
132
|
-
var StatusBarActions = () => {
|
|
133
|
-
const { t } = useTranslation2(STATUS_BAR_PLUGIN);
|
|
134
|
-
const [open, setOpen] = useState(false);
|
|
135
|
-
return /* @__PURE__ */ React3.createElement(Popover2.Root, {
|
|
136
|
-
open,
|
|
137
|
-
onOpenChange: setOpen
|
|
138
|
-
}, /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
139
|
-
asChild: true
|
|
140
|
-
}, /* @__PURE__ */ React3.createElement("a", {
|
|
141
|
-
href: "https://dxos.org/discord",
|
|
142
|
-
target: "_blank",
|
|
143
|
-
rel: "noopener noreferrer"
|
|
144
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
145
|
-
icon: "ph--discord-logo--regular",
|
|
146
|
-
size: 4
|
|
147
|
-
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
148
|
-
classNames: "hidden sm:block"
|
|
149
|
-
}, t("discord label")))), /* @__PURE__ */ React3.createElement(StatusBar.Button, {
|
|
150
|
-
asChild: true
|
|
151
|
-
}, /* @__PURE__ */ React3.createElement("a", {
|
|
152
|
-
href: "https://github.com/dxos/dxos",
|
|
153
|
-
target: "_blank",
|
|
154
|
-
rel: "noopener noreferrer"
|
|
155
|
-
}, /* @__PURE__ */ React3.createElement(Icon2, {
|
|
156
|
-
icon: "ph--github-logo--regular",
|
|
157
|
-
size: 4
|
|
158
|
-
}), /* @__PURE__ */ React3.createElement(StatusBar.Text, {
|
|
159
|
-
classNames: "hidden sm:block"
|
|
160
|
-
}, t("github label")))), /* @__PURE__ */ React3.createElement(VersionNumber, null));
|
|
161
|
-
};
|
|
162
|
-
var StatusBarPanel = () => {
|
|
163
|
-
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, /* @__PURE__ */ React3.createElement(StatusBarActions, null), /* @__PURE__ */ React3.createElement("span", {
|
|
164
|
-
role: "separator",
|
|
165
|
-
className: "grow"
|
|
166
|
-
}), /* @__PURE__ */ React3.createElement(Surface, {
|
|
167
|
-
role: "status"
|
|
168
|
-
}));
|
|
169
|
-
};
|
|
11
|
+
// packages/plugins/plugin-status-bar/src/StatusBarPlugin.ts
|
|
12
|
+
import { Capabilities, contributes, defineModule, definePlugin, Events } from "@dxos/app-framework";
|
|
170
13
|
|
|
171
|
-
// packages/plugins/plugin-status-bar/src/
|
|
172
|
-
import
|
|
173
|
-
|
|
14
|
+
// packages/plugins/plugin-status-bar/src/capabilities/index.ts
|
|
15
|
+
import { lazy } from "@dxos/app-framework";
|
|
16
|
+
var ReactSurface = lazy(() => import("./react-surface-YKOZ4BU7.mjs"));
|
|
174
17
|
|
|
175
18
|
// packages/plugins/plugin-status-bar/src/translations.ts
|
|
176
19
|
var entry = (translation) => ({
|
|
@@ -194,7 +37,7 @@ var translations_default = [
|
|
|
194
37
|
translations
|
|
195
38
|
];
|
|
196
39
|
|
|
197
|
-
// packages/plugins/plugin-status-bar/src/StatusBarPlugin.
|
|
40
|
+
// packages/plugins/plugin-status-bar/src/StatusBarPlugin.ts
|
|
198
41
|
var StatusBarPlugin = () => definePlugin(meta, [
|
|
199
42
|
defineModule({
|
|
200
43
|
id: `${meta.id}/module/translations`,
|
|
@@ -204,30 +47,7 @@ var StatusBarPlugin = () => definePlugin(meta, [
|
|
|
204
47
|
defineModule({
|
|
205
48
|
id: `${meta.id}/module/react-surface`,
|
|
206
49
|
activatesOn: Events.SetupReactSurface,
|
|
207
|
-
activate:
|
|
208
|
-
createSurface({
|
|
209
|
-
id: meta.id,
|
|
210
|
-
role: "status-bar",
|
|
211
|
-
component: () => /* @__PURE__ */ React4.createElement(StatusBarPanel, null)
|
|
212
|
-
}),
|
|
213
|
-
createSurface({
|
|
214
|
-
id: meta.id,
|
|
215
|
-
role: "status-bar--r0-footer",
|
|
216
|
-
component: () => /* @__PURE__ */ React4.createElement(Surface2, {
|
|
217
|
-
role: "status"
|
|
218
|
-
})
|
|
219
|
-
}),
|
|
220
|
-
createSurface({
|
|
221
|
-
id: meta.id,
|
|
222
|
-
role: "status-bar--r1-footer",
|
|
223
|
-
component: () => /* @__PURE__ */ React4.createElement(StatusBarActions, null)
|
|
224
|
-
}),
|
|
225
|
-
createSurface({
|
|
226
|
-
id: `${STATUS_BAR_PLUGIN}/header-end`,
|
|
227
|
-
role: "header-end",
|
|
228
|
-
component: () => /* @__PURE__ */ React4.createElement(VersionNumber, null)
|
|
229
|
-
})
|
|
230
|
-
])
|
|
50
|
+
activate: ReactSurface
|
|
231
51
|
})
|
|
232
52
|
]);
|
|
233
53
|
export {
|
|
@@ -236,6 +56,7 @@ export {
|
|
|
236
56
|
StatusBarActions,
|
|
237
57
|
StatusBarPanel,
|
|
238
58
|
StatusBarPlugin,
|
|
59
|
+
VersionNumber,
|
|
239
60
|
meta
|
|
240
61
|
};
|
|
241
62
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../../src/
|
|
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": "
|
|
6
|
-
"names": ["
|
|
3
|
+
"sources": ["../../../src/StatusBarPlugin.ts", "../../../src/capabilities/index.ts", "../../../src/translations.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport { Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';\n\nimport { ReactSurface } from './capabilities';\nimport { meta } 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: ReactSurface,\n }),\n ]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const ReactSurface = lazy(() => import('./react-surface'));\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,cAAcC,aAAaC,cAAcC,cAAcC,cAAc;;;ACA9E,SAASC,YAAY;AAEd,IAAMC,eAAeC,KAAK,MAAM,OAAO,8BAAA,CAAA;;;ACqB9C,IAAMC,QAAQ,CAACC,iBAAwD;EAAE,CAACC,iBAAAA,GAAoBD;AAAY;AAG1G,IAAME,eAAmD;EACvD,SAASC,MAAM;IACb,eAAe;IACf,iBAAiB;IACjB,8BAA8B;IAC9B,oBAAoB;IACpB,oBAAoB;IACpB,qBAAqB;IACrB,2BAA2B;IAC3B,iBAAiB;IACjB,gBAAgB;IAChB,kBAAkB;EACpB,CAAA;AACF;AAEA,IAAA,uBAAe;EAACD;;;;AFnCT,IAAME,kBAAkB,MAC7BC,aAAaC,MAAM;EACjBC,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOC;IACpBC,UAAU,MAAMC,YAAYC,aAAaC,cAAcC,oBAAAA;EACzD,CAAA;EACAT,aAAa;IACXC,IAAI,GAAGF,KAAKE,EAAE;IACdC,aAAaC,OAAOO;IACpBL,UAAUM;EACZ,CAAA;CACD;",
|
|
6
|
+
"names": ["Capabilities", "contributes", "defineModule", "definePlugin", "Events", "lazy", "ReactSurface", "lazy", "entry", "translation", "STATUS_BAR_PLUGIN", "translations", "entry", "StatusBarPlugin", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Events", "SetupTranslations", "activate", "contributes", "Capabilities", "Translations", "translations", "SetupReactSurface", "ReactSurface"]
|
|
7
7
|
}
|