dsh-open-artifact 0.9.1 → 0.9.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/CHANGELOG.md +153 -0
- package/lib/client.js +732 -470
- package/lib/index.js +177 -61
- package/package.json +2 -1
- package/vendor/open-artifact.mjs +2 -2
package/lib/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// dsh-open-artifact 0.9.
|
|
1
|
+
// dsh-open-artifact 0.9.2: the DSH plugin (browser half). Built by scripts/build.mjs; do not edit.
|
|
2
2
|
window.__ModuleLoader__.load({
|
|
3
3
|
id: "dsh-open-artifact",
|
|
4
4
|
factory: (require) => {
|
|
@@ -66,7 +66,9 @@ window.__ModuleLoader__.load({
|
|
|
66
66
|
/** POST `?id=&opened=1|0`: whether a browser half showed the artifact of one {@link HostOpenRequest}. */
|
|
67
67
|
hostOpened: `${ROUTE_BASE}.host-opened`,
|
|
68
68
|
/** GET: whether this plugin has a newer release on its registry ({@link UpdateCheck}). */
|
|
69
|
-
updates: `${ROUTE_BASE}.updates
|
|
69
|
+
updates: `${ROUTE_BASE}.updates`,
|
|
70
|
+
/** GET `?upcoming=1`: the release notes of the version installed and the ones before it, and with `upcoming` of a newer release offered (`ChangelogAnswer`, src/shared/changelog.ts). */
|
|
71
|
+
changelog: `${ROUTE_BASE}.changelog`
|
|
70
72
|
});
|
|
71
73
|
function isNewer(a, b) {
|
|
72
74
|
const parts = (version) => {
|
|
@@ -444,7 +446,7 @@ window.__ModuleLoader__.load({
|
|
|
444
446
|
}
|
|
445
447
|
|
|
446
448
|
// plugins/dsh/src/client/components/ArtifactsPage.tsx
|
|
447
|
-
var
|
|
449
|
+
var import_react7 = require("react");
|
|
448
450
|
|
|
449
451
|
// plugins/dsh/src/client/env.tsx
|
|
450
452
|
var import_react = require("react");
|
|
@@ -582,6 +584,20 @@ window.__ModuleLoader__.load({
|
|
|
582
584
|
"rename.save": "保存",
|
|
583
585
|
"dialog.cancel": "取消",
|
|
584
586
|
"dialog.close": "关闭",
|
|
587
|
+
"changelog.title": "更新日志",
|
|
588
|
+
"changelog.new": "Open Artifact {version} 更新了这些",
|
|
589
|
+
"changelog.all": "更新日志",
|
|
590
|
+
"changelog.gotIt": "知道了",
|
|
591
|
+
"changelog.more": "展开其余 {count} 条",
|
|
592
|
+
"changelog.version": "Open Artifact {version}",
|
|
593
|
+
"changelog.installed": "当前版本",
|
|
594
|
+
"changelog.available": "可更新",
|
|
595
|
+
"changelog.none": "还没有更新日志。",
|
|
596
|
+
"changelog.releases": "在 GitHub 上查看",
|
|
597
|
+
"changelog.section.added": "新增",
|
|
598
|
+
"changelog.section.changed": "改进",
|
|
599
|
+
"changelog.section.fixed": "修复",
|
|
600
|
+
"changelog.section.removed": "移除",
|
|
585
601
|
"delete.title": "删除“{title}”?",
|
|
586
602
|
"delete.moves": "这会移除这个作品,它的文件夹移到 Open Artifact 的回收站,可以在提示里撤销。",
|
|
587
603
|
"delete.confirm": "删除",
|
|
@@ -685,6 +701,20 @@ window.__ModuleLoader__.load({
|
|
|
685
701
|
"rename.save": "Save",
|
|
686
702
|
"dialog.cancel": "Cancel",
|
|
687
703
|
"dialog.close": "Close",
|
|
704
|
+
"changelog.title": "Changelog",
|
|
705
|
+
"changelog.new": "What's new in Open Artifact {version}",
|
|
706
|
+
"changelog.all": "Changelog",
|
|
707
|
+
"changelog.gotIt": "Got it",
|
|
708
|
+
"changelog.more": "Show {count} more",
|
|
709
|
+
"changelog.version": "Open Artifact {version}",
|
|
710
|
+
"changelog.installed": "Installed",
|
|
711
|
+
"changelog.available": "Available",
|
|
712
|
+
"changelog.none": "No release notes yet.",
|
|
713
|
+
"changelog.releases": "View on GitHub",
|
|
714
|
+
"changelog.section.added": "Added",
|
|
715
|
+
"changelog.section.changed": "Changed",
|
|
716
|
+
"changelog.section.fixed": "Fixed",
|
|
717
|
+
"changelog.section.removed": "Removed",
|
|
688
718
|
"delete.title": "Delete {title}?",
|
|
689
719
|
"delete.moves": "This removes the artifact and moves its folder to Open Artifact's trash. You can undo it from the notice.",
|
|
690
720
|
"delete.confirm": "Delete",
|
|
@@ -985,24 +1015,24 @@ window.__ModuleLoader__.load({
|
|
|
985
1015
|
var import_react3 = require("react");
|
|
986
1016
|
|
|
987
1017
|
var createStoreImpl = (createState) => {
|
|
988
|
-
let
|
|
989
|
-
const
|
|
1018
|
+
let state2;
|
|
1019
|
+
const listeners2 = /* @__PURE__ */ new Set();
|
|
990
1020
|
const setState = (partial, replace) => {
|
|
991
|
-
const nextState = typeof partial === "function" ? partial(
|
|
992
|
-
if (!Object.is(nextState,
|
|
993
|
-
const previousState =
|
|
994
|
-
|
|
995
|
-
|
|
1021
|
+
const nextState = typeof partial === "function" ? partial(state2) : partial;
|
|
1022
|
+
if (!Object.is(nextState, state2)) {
|
|
1023
|
+
const previousState = state2;
|
|
1024
|
+
state2 = (replace != null ? replace : typeof nextState !== "object" || nextState === null) ? nextState : Object.assign({}, state2, nextState);
|
|
1025
|
+
listeners2.forEach((listener) => listener(state2, previousState));
|
|
996
1026
|
}
|
|
997
1027
|
};
|
|
998
|
-
const getState = () =>
|
|
1028
|
+
const getState = () => state2;
|
|
999
1029
|
const getInitialState = () => initialState;
|
|
1000
1030
|
const subscribe2 = (listener) => {
|
|
1001
|
-
|
|
1002
|
-
return () =>
|
|
1031
|
+
listeners2.add(listener);
|
|
1032
|
+
return () => listeners2.delete(listener);
|
|
1003
1033
|
};
|
|
1004
1034
|
const api = { setState, getState, getInitialState, subscribe: subscribe2 };
|
|
1005
|
-
const initialState =
|
|
1035
|
+
const initialState = state2 = createState(setState, getState, api);
|
|
1006
1036
|
return api;
|
|
1007
1037
|
};
|
|
1008
1038
|
var createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
|
|
@@ -1047,8 +1077,8 @@ window.__ModuleLoader__.load({
|
|
|
1047
1077
|
const tried = /* @__PURE__ */ new Set();
|
|
1048
1078
|
let watching = null;
|
|
1049
1079
|
let taking = false;
|
|
1050
|
-
return createStore()((
|
|
1051
|
-
const patch = (id, change) =>
|
|
1080
|
+
return createStore()((set3, get) => {
|
|
1081
|
+
const patch = (id, change) => set3({ artifacts: get().artifacts.map((a) => a.id === id ? { ...a, ...change } : a) });
|
|
1052
1082
|
const failed = (error) => get().showToast(t("action.failed", { message: error.message }), "error");
|
|
1053
1083
|
const openable = (a) => {
|
|
1054
1084
|
if (a.openable) return true;
|
|
@@ -1097,51 +1127,51 @@ window.__ModuleLoader__.load({
|
|
|
1097
1127
|
live: false,
|
|
1098
1128
|
reload() {
|
|
1099
1129
|
if (loading) return loading;
|
|
1100
|
-
if (get().artifacts.length === 0)
|
|
1130
|
+
if (get().artifacts.length === 0) set3({ status: "loading" });
|
|
1101
1131
|
loading = (async () => {
|
|
1102
1132
|
try {
|
|
1103
1133
|
const { artifacts, types } = await api.list();
|
|
1104
|
-
|
|
1134
|
+
set3({ status: "ready", artifacts, types, error: "" });
|
|
1105
1135
|
pump();
|
|
1106
1136
|
} catch (error) {
|
|
1107
|
-
|
|
1137
|
+
set3({ status: "error", error: error.message });
|
|
1108
1138
|
}
|
|
1109
1139
|
})().finally(() => {
|
|
1110
1140
|
loading = null;
|
|
1111
1141
|
});
|
|
1112
1142
|
return loading;
|
|
1113
1143
|
},
|
|
1114
|
-
setFilters: (change) =>
|
|
1115
|
-
clearFilters: () =>
|
|
1116
|
-
setQuery: (query) =>
|
|
1144
|
+
setFilters: (change) => set3({ filters: { ...get().filters, ...change } }),
|
|
1145
|
+
clearFilters: () => set3({ filters: { ...NO_FILTERS, sort: get().filters.sort } }),
|
|
1146
|
+
setQuery: (query) => set3({ query }),
|
|
1117
1147
|
setLayout(layout) {
|
|
1118
|
-
|
|
1148
|
+
set3({ layout });
|
|
1119
1149
|
try {
|
|
1120
1150
|
host.storage?.setItem(LAYOUT_KEY, layout);
|
|
1121
1151
|
} catch {
|
|
1122
1152
|
}
|
|
1123
1153
|
},
|
|
1124
|
-
setMenuFor: (menuFor) =>
|
|
1125
|
-
openDialog: (dialog) =>
|
|
1126
|
-
closeDialog: () =>
|
|
1127
|
-
showToast: (message, kind = "info", undo) =>
|
|
1128
|
-
dismissToast: () =>
|
|
1154
|
+
setMenuFor: (menuFor) => set3({ menuFor }),
|
|
1155
|
+
openDialog: (dialog) => set3({ dialog, menuFor: null }),
|
|
1156
|
+
closeDialog: () => set3({ dialog: null }),
|
|
1157
|
+
showToast: (message, kind = "info", undo) => set3({ toast: { id: ++toastId, message, kind, ...undo ? { undo } : {} } }),
|
|
1158
|
+
dismissToast: () => set3({ toast: null }),
|
|
1129
1159
|
async open(artifact, panel) {
|
|
1130
1160
|
if (get().opening !== null || !openable(artifact)) return;
|
|
1131
1161
|
const away = host.away();
|
|
1132
1162
|
const pending = away ? host.pendingWindow() : null;
|
|
1133
1163
|
if (away && pending === null) return get().showToast(t("open.blocked"), "error");
|
|
1134
|
-
|
|
1164
|
+
set3({ opening: artifact.id, toast: null });
|
|
1135
1165
|
try {
|
|
1136
1166
|
const opened = await api.open(artifact.id);
|
|
1137
1167
|
const answer = panel ? { ...opened, url: withParam(opened.url, "panel", panel) } : opened;
|
|
1138
1168
|
const { sessionGone } = await host.show({ ...answer, sessionId: answer.sessionId || artifact.sessionId }, pending);
|
|
1139
|
-
|
|
1169
|
+
set3({ opening: null });
|
|
1140
1170
|
if (sessionGone && (answer.sessionId || artifact.sessionId)) get().showToast(t("open.noSession"));
|
|
1141
1171
|
void get().reload();
|
|
1142
1172
|
} catch (error) {
|
|
1143
1173
|
pending?.close();
|
|
1144
|
-
|
|
1174
|
+
set3({ opening: null });
|
|
1145
1175
|
get().showToast(t("open.failed", { message: error.message }), "error");
|
|
1146
1176
|
}
|
|
1147
1177
|
},
|
|
@@ -1186,14 +1216,14 @@ window.__ModuleLoader__.load({
|
|
|
1186
1216
|
async remove(artifact) {
|
|
1187
1217
|
try {
|
|
1188
1218
|
const { trash, path } = await api.remove(artifact.id);
|
|
1189
|
-
|
|
1219
|
+
set3({ artifacts: get().artifacts.filter((a) => a.id !== artifact.id), dialog: null });
|
|
1190
1220
|
get().showToast(t(path ? "toast.removed" : "toast.deleted", { title: artifact.title }), "info", trash);
|
|
1191
1221
|
} catch (error) {
|
|
1192
1222
|
failed(error);
|
|
1193
1223
|
}
|
|
1194
1224
|
},
|
|
1195
1225
|
async undo(trash) {
|
|
1196
|
-
|
|
1226
|
+
set3({ toast: null });
|
|
1197
1227
|
try {
|
|
1198
1228
|
await api.restore(trash);
|
|
1199
1229
|
await get().reload();
|
|
@@ -1205,16 +1235,16 @@ window.__ModuleLoader__.load({
|
|
|
1205
1235
|
let timer;
|
|
1206
1236
|
const stop = api.events(
|
|
1207
1237
|
() => {
|
|
1208
|
-
if (!get().live)
|
|
1238
|
+
if (!get().live) set3({ live: true });
|
|
1209
1239
|
clearTimeout(timer);
|
|
1210
1240
|
timer = setTimeout(() => void get().reload(), eventDelayMs);
|
|
1211
1241
|
},
|
|
1212
|
-
() =>
|
|
1242
|
+
() => set3({ live: false })
|
|
1213
1243
|
);
|
|
1214
1244
|
return () => {
|
|
1215
1245
|
clearTimeout(timer);
|
|
1216
1246
|
stop?.();
|
|
1217
|
-
|
|
1247
|
+
set3({ live: false });
|
|
1218
1248
|
};
|
|
1219
1249
|
},
|
|
1220
1250
|
watchThumbnails() {
|
|
@@ -1239,9 +1269,396 @@ window.__ModuleLoader__.load({
|
|
|
1239
1269
|
return useStore(store, select);
|
|
1240
1270
|
}
|
|
1241
1271
|
|
|
1242
|
-
// plugins/dsh/src/client/
|
|
1272
|
+
// plugins/dsh/src/client/changelog.tsx
|
|
1243
1273
|
var import_react4 = require("react");
|
|
1244
1274
|
|
|
1275
|
+
// plugins/dsh/src/shared/changelog.ts
|
|
1276
|
+
function releasesBetween(releases, after, upTo) {
|
|
1277
|
+
return releases.filter((r) => !isNewer(r.version, upTo) && (after === "" || isNewer(r.version, after))).sort((a, b) => isNewer(a.version, b.version) ? -1 : isNewer(b.version, a.version) ? 1 : 0);
|
|
1278
|
+
}
|
|
1279
|
+
var INLINE = /`([^`]+)`|\*\*([^*]+)\*\*|\[([^\]]+)\]\(([^)\s]+)\)/g;
|
|
1280
|
+
function inlinePieces(text) {
|
|
1281
|
+
const pieces = [];
|
|
1282
|
+
let at = 0;
|
|
1283
|
+
for (const match of text.matchAll(INLINE)) {
|
|
1284
|
+
if (match.index > at) pieces.push({ kind: "text", text: text.slice(at, match.index) });
|
|
1285
|
+
if (match[1] !== void 0) pieces.push({ kind: "code", text: match[1] });
|
|
1286
|
+
else if (match[2] !== void 0) pieces.push({ kind: "strong", text: match[2] });
|
|
1287
|
+
else if (/^https?:\/\//i.test(match[4])) pieces.push({ kind: "link", text: match[3], href: match[4] });
|
|
1288
|
+
else pieces.push({ kind: "text", text: match[3] });
|
|
1289
|
+
at = match.index + match[0].length;
|
|
1290
|
+
}
|
|
1291
|
+
if (at < text.length) pieces.push({ kind: "text", text: text.slice(at) });
|
|
1292
|
+
return pieces;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
// plugins/dsh/src/client/changelog-state.ts
|
|
1296
|
+
var SEEN_KEY = "open-artifact.changelog.seen";
|
|
1297
|
+
function readSeen() {
|
|
1298
|
+
try {
|
|
1299
|
+
return localStorage.getItem(SEEN_KEY);
|
|
1300
|
+
} catch {
|
|
1301
|
+
return null;
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
var state = { version: "", releases: [], upcoming: [], upcomingFor: "", seen: readSeen(), open: false };
|
|
1305
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
1306
|
+
function set(patch) {
|
|
1307
|
+
state = { ...state, ...patch };
|
|
1308
|
+
for (const listener of [...listeners]) listener();
|
|
1309
|
+
}
|
|
1310
|
+
var subscribeChangelog = (listener) => {
|
|
1311
|
+
listeners.add(listener);
|
|
1312
|
+
return () => void listeners.delete(listener);
|
|
1313
|
+
};
|
|
1314
|
+
var changelogState = () => state;
|
|
1315
|
+
async function read(upcoming) {
|
|
1316
|
+
try {
|
|
1317
|
+
const response = await fetch(routeUrl(PATHS.changelog, upcoming ? { upcoming: "1" } : void 0), { cache: "no-store" });
|
|
1318
|
+
if (!response.ok) return null;
|
|
1319
|
+
const body = await response.json();
|
|
1320
|
+
return typeof body.version === "string" && Array.isArray(body.releases) ? { version: body.version, releases: body.releases, upcoming: body.upcoming ?? [] } : null;
|
|
1321
|
+
} catch {
|
|
1322
|
+
return null;
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
async function loadChangelog() {
|
|
1326
|
+
const answer = await read(false);
|
|
1327
|
+
if (answer === null) return;
|
|
1328
|
+
const upcoming = state.upcoming.filter((r) => isNewer(r.version, answer.version));
|
|
1329
|
+
set({ version: answer.version, releases: answer.releases, upcoming });
|
|
1330
|
+
}
|
|
1331
|
+
async function loadUpcoming(latest) {
|
|
1332
|
+
if (latest === "" || latest === state.upcomingFor) return;
|
|
1333
|
+
set({ upcomingFor: latest });
|
|
1334
|
+
const answer = await read(true);
|
|
1335
|
+
if (answer === null || state.upcomingFor !== latest) {
|
|
1336
|
+
if (state.upcomingFor === latest) set({ upcomingFor: "" });
|
|
1337
|
+
return;
|
|
1338
|
+
}
|
|
1339
|
+
set({ version: answer.version, releases: answer.releases, upcoming: answer.upcoming });
|
|
1340
|
+
}
|
|
1341
|
+
function whatsNew({ version, releases, seen }) {
|
|
1342
|
+
if (version === "" || seen === version) return [];
|
|
1343
|
+
if (seen === null) return releases.filter((r) => r.version === version);
|
|
1344
|
+
if (isNewer(seen, version)) return [];
|
|
1345
|
+
return releasesBetween(releases, seen, version);
|
|
1346
|
+
}
|
|
1347
|
+
function markSeen() {
|
|
1348
|
+
const { version } = state;
|
|
1349
|
+
if (version === "") return;
|
|
1350
|
+
try {
|
|
1351
|
+
localStorage.setItem(SEEN_KEY, version);
|
|
1352
|
+
} catch {
|
|
1353
|
+
}
|
|
1354
|
+
set({ seen: version });
|
|
1355
|
+
}
|
|
1356
|
+
var openChangelog = () => set({ open: true });
|
|
1357
|
+
var closeChangelog = () => set({ open: false });
|
|
1358
|
+
|
|
1359
|
+
// plugins/dsh/src/client/update-state.ts
|
|
1360
|
+
var NS = "open-artifact-updates";
|
|
1361
|
+
var HUB = Symbol.for("open-artifact/dsh-updates");
|
|
1362
|
+
var DISMISSED_KEY = "open-artifact.update.dismissed";
|
|
1363
|
+
var FIRST_CHECK_MS = 3e3;
|
|
1364
|
+
var CHECK_EVERY_MS = 6 * 60 * 6e4;
|
|
1365
|
+
var REASON_MAX = 240;
|
|
1366
|
+
function readDismissed() {
|
|
1367
|
+
try {
|
|
1368
|
+
return localStorage.getItem(DISMISSED_KEY) ?? "";
|
|
1369
|
+
} catch {
|
|
1370
|
+
return "";
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
function hub() {
|
|
1374
|
+
const g = globalThis;
|
|
1375
|
+
return g[HUB] ??= {
|
|
1376
|
+
state: { updates: [], phase: "idle", to: "", restart: false, failure: null, dismissed: readDismissed() },
|
|
1377
|
+
listeners: /* @__PURE__ */ new Set()
|
|
1378
|
+
};
|
|
1379
|
+
}
|
|
1380
|
+
function set2(patch) {
|
|
1381
|
+
const h = hub();
|
|
1382
|
+
h.state = { ...h.state, ...patch };
|
|
1383
|
+
for (const listener of [...h.listeners]) listener();
|
|
1384
|
+
}
|
|
1385
|
+
var subscribe = (listener) => {
|
|
1386
|
+
const { listeners: listeners2 } = hub();
|
|
1387
|
+
listeners2.add(listener);
|
|
1388
|
+
return () => void listeners2.delete(listener);
|
|
1389
|
+
};
|
|
1390
|
+
var updateState = () => hub().state;
|
|
1391
|
+
var latestOf = (updates) => updates.reduce((best, u) => best === "" || isNewer(u.latest, best) ? u.latest : best, "");
|
|
1392
|
+
async function readUpdates() {
|
|
1393
|
+
try {
|
|
1394
|
+
const response = await fetch(routeUrl(PATHS.updates), { cache: "no-store" });
|
|
1395
|
+
if (!response.ok) return null;
|
|
1396
|
+
const { updates } = await response.json();
|
|
1397
|
+
return Array.isArray(updates) ? updates : null;
|
|
1398
|
+
} catch {
|
|
1399
|
+
return null;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
async function look() {
|
|
1403
|
+
const updates = await readUpdates();
|
|
1404
|
+
if (updates !== null && hub().state.phase !== "running") set2({ updates });
|
|
1405
|
+
}
|
|
1406
|
+
var failedOutcome = (outcome) => outcome.application === "failed" || outcome.application === "cancelled";
|
|
1407
|
+
function reasonOf(outcome) {
|
|
1408
|
+
const { error } = outcome;
|
|
1409
|
+
const refused = error?.incompatible?.[0];
|
|
1410
|
+
if (refused) {
|
|
1411
|
+
return `${refused.name}@${refused.version} needs ${Object.entries(refused.requirements).map(([what, range]) => `${what} ${range}`).join(", ")}`;
|
|
1412
|
+
}
|
|
1413
|
+
const lines = (error?.diagnostic ?? "").split("\n").map((text) => text.trim()).filter(Boolean);
|
|
1414
|
+
const line = lines.find((text) => text.includes("ERR_")) ?? lines.at(-1);
|
|
1415
|
+
return (line ?? error?.code ?? outcome.application ?? "unknown").slice(0, REASON_MAX);
|
|
1416
|
+
}
|
|
1417
|
+
async function install(manager, plugin, requestId) {
|
|
1418
|
+
const answer = await manager.installBundle(plugin.spec, { enabled: plugin.enabled, registry: plugin.registry, requestId });
|
|
1419
|
+
if (answer.ok) return { outcome: answer.value, left: "kept" };
|
|
1420
|
+
const again = await manager.waitForInstall(requestId);
|
|
1421
|
+
if (again.ok && again.value !== null) return { outcome: again.value, left: "kept" };
|
|
1422
|
+
return { outcome: { application: "failed", error: { diagnostic: answer.error.message ?? "the app did not answer" } }, left: "unknown" };
|
|
1423
|
+
}
|
|
1424
|
+
async function run(manager) {
|
|
1425
|
+
set2({ phase: "running", failure: null });
|
|
1426
|
+
const fresh = await readUpdates();
|
|
1427
|
+
if (fresh !== null) set2({ updates: fresh });
|
|
1428
|
+
const plan = hub().state.updates;
|
|
1429
|
+
set2({ to: latestOf(plan) });
|
|
1430
|
+
let restart = false;
|
|
1431
|
+
for (const [index, plugin] of plan.entries()) {
|
|
1432
|
+
let outcome;
|
|
1433
|
+
let left = "kept";
|
|
1434
|
+
try {
|
|
1435
|
+
({ outcome, left } = await install(manager, plugin, `open-artifact-update-${Date.now()}-${index}`));
|
|
1436
|
+
} catch (error) {
|
|
1437
|
+
outcome = { application: "failed", error: { diagnostic: error.message } };
|
|
1438
|
+
left = "unknown";
|
|
1439
|
+
}
|
|
1440
|
+
const already = outcome.application === "failed" && outcome.error?.code === "already-installed";
|
|
1441
|
+
if (failedOutcome(outcome) && !already) {
|
|
1442
|
+
set2({ phase: "failed", failure: { plugin: plugin.name, message: reasonOf(outcome), left } });
|
|
1443
|
+
return void look();
|
|
1444
|
+
}
|
|
1445
|
+
restart ||= outcome.application === "restart-required";
|
|
1446
|
+
set2({ updates: hub().state.updates.filter((u) => u.name !== plugin.name) });
|
|
1447
|
+
}
|
|
1448
|
+
set2({ restart: hub().state.restart || restart });
|
|
1449
|
+
if (plan.length === 0) close();
|
|
1450
|
+
else set2({ phase: "done" });
|
|
1451
|
+
void look();
|
|
1452
|
+
}
|
|
1453
|
+
var pluginManager;
|
|
1454
|
+
function start() {
|
|
1455
|
+
const { phase, updates } = hub().state;
|
|
1456
|
+
if (phase === "running" || updates.length === 0) return;
|
|
1457
|
+
if (pluginManager === void 0) return set2({ phase: "failed", failure: { plugin: updates[0].name, message: "this app has no plugin manager", left: "kept" } });
|
|
1458
|
+
void run(pluginManager);
|
|
1459
|
+
}
|
|
1460
|
+
function later() {
|
|
1461
|
+
const version = latestOf(hub().state.updates);
|
|
1462
|
+
try {
|
|
1463
|
+
localStorage.setItem(DISMISSED_KEY, version);
|
|
1464
|
+
} catch {
|
|
1465
|
+
}
|
|
1466
|
+
set2({ dismissed: version });
|
|
1467
|
+
}
|
|
1468
|
+
function close() {
|
|
1469
|
+
set2({ phase: "idle", failure: null });
|
|
1470
|
+
}
|
|
1471
|
+
function reopen() {
|
|
1472
|
+
try {
|
|
1473
|
+
localStorage.removeItem(DISMISSED_KEY);
|
|
1474
|
+
} catch {
|
|
1475
|
+
}
|
|
1476
|
+
set2({ dismissed: "" });
|
|
1477
|
+
}
|
|
1478
|
+
var zh2 = {
|
|
1479
|
+
available: "Open Artifact 有新版本 {version}",
|
|
1480
|
+
current: "当前是 {version}。",
|
|
1481
|
+
update: "更新",
|
|
1482
|
+
"update.one": "把 Open Artifact 更新到 {version}",
|
|
1483
|
+
later: "稍后",
|
|
1484
|
+
busy: "正在更新…",
|
|
1485
|
+
done: "已更新到 {version}。",
|
|
1486
|
+
"done.session": "新开的会话会用新版本。",
|
|
1487
|
+
"done.restart": "退出 DSH 再重新打开后生效。",
|
|
1488
|
+
failed: "Open Artifact 没有更新成功",
|
|
1489
|
+
"failed.kept": "它还是原来的版本。",
|
|
1490
|
+
"failed.unknown": "到插件页看一下它现在是哪个版本。",
|
|
1491
|
+
retry: "重试",
|
|
1492
|
+
close: "关闭",
|
|
1493
|
+
tag: "有新版本 {version}",
|
|
1494
|
+
show: "查看",
|
|
1495
|
+
"mark.update": "更新",
|
|
1496
|
+
"mark.running": "更新中",
|
|
1497
|
+
"mark.failed": "更新失败",
|
|
1498
|
+
"mark.restart": "待重启",
|
|
1499
|
+
"failed.tag": "更新失败,详情见 Open Artifact 页"
|
|
1500
|
+
};
|
|
1501
|
+
var en2 = {
|
|
1502
|
+
available: "Open Artifact {version} is available",
|
|
1503
|
+
current: "You have {version}.",
|
|
1504
|
+
update: "Update",
|
|
1505
|
+
"update.one": "Update Open Artifact to {version}",
|
|
1506
|
+
later: "Later",
|
|
1507
|
+
busy: "Updating…",
|
|
1508
|
+
done: "Updated to {version}.",
|
|
1509
|
+
"done.session": "New sessions use it.",
|
|
1510
|
+
"done.restart": "Quit DSH and open it again to finish.",
|
|
1511
|
+
failed: "Open Artifact did not update",
|
|
1512
|
+
"failed.kept": "It stays on the version it was.",
|
|
1513
|
+
"failed.unknown": "Check which version it is on, on the Plugins page.",
|
|
1514
|
+
retry: "Try again",
|
|
1515
|
+
close: "Close",
|
|
1516
|
+
tag: "New version {version}",
|
|
1517
|
+
show: "Show",
|
|
1518
|
+
"mark.update": "Update",
|
|
1519
|
+
"mark.running": "Updating",
|
|
1520
|
+
"mark.failed": "Failed",
|
|
1521
|
+
"mark.restart": "Restart",
|
|
1522
|
+
"failed.tag": "Update failed: see Open Artifact"
|
|
1523
|
+
};
|
|
1524
|
+
var fill2 = (text, params) => text.replace(/\{(\w+)\}/g, (all, name) => params?.[name] ?? all);
|
|
1525
|
+
var current = (key, params) => fill2(en2[key] ?? key, params);
|
|
1526
|
+
var translate = (key, params) => current(key, params);
|
|
1527
|
+
function setTranslate(bound) {
|
|
1528
|
+
current = (key, params) => bound(key, params);
|
|
1529
|
+
}
|
|
1530
|
+
function markOf({ phase, updates, restart, dismissed }) {
|
|
1531
|
+
if (phase === "running") return "mark.running";
|
|
1532
|
+
if (phase === "failed") return "mark.failed";
|
|
1533
|
+
if (phase === "done" && restart) return "mark.restart";
|
|
1534
|
+
const latest = latestOf(updates);
|
|
1535
|
+
return latest !== "" && latest !== dismissed ? "mark.update" : null;
|
|
1536
|
+
}
|
|
1537
|
+
function setPluginManager(manager) {
|
|
1538
|
+
pluginManager = manager;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
// plugins/dsh/src/client/changelog.tsx
|
|
1542
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
1543
|
+
var useChangelog = () => (0, import_react4.useSyncExternalStore)(subscribeChangelog, changelogState);
|
|
1544
|
+
var useUpdates = () => (0, import_react4.useSyncExternalStore)(subscribe, updateState);
|
|
1545
|
+
function Inline({ text }) {
|
|
1546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: inlinePieces(text).map((piece, i) => {
|
|
1547
|
+
if (piece.kind === "code") return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("code", { children: piece.text }, i);
|
|
1548
|
+
if (piece.kind === "strong") return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: piece.text }, i);
|
|
1549
|
+
if (piece.kind === "link") {
|
|
1550
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { href: piece.href, target: "_blank", rel: "noopener noreferrer", children: piece.text }, i);
|
|
1551
|
+
}
|
|
1552
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: piece.text }, i);
|
|
1553
|
+
}) });
|
|
1554
|
+
}
|
|
1555
|
+
var sectionTitle = (t, title) => {
|
|
1556
|
+
const key = `changelog.section.${title.toLowerCase()}`;
|
|
1557
|
+
return isKey(key) ? t(key) : title;
|
|
1558
|
+
};
|
|
1559
|
+
var FOLDED_ITEMS = 4;
|
|
1560
|
+
function ReleaseNotesList({ releases, headings, fold = false, tag }) {
|
|
1561
|
+
const { t } = usePageEnv();
|
|
1562
|
+
const [all, setAll] = (0, import_react4.useState)(!fold);
|
|
1563
|
+
const total = releases.reduce((n, r) => n + r.sections.reduce((m, s) => m + s.items.length, 0), 0);
|
|
1564
|
+
let left = all ? Infinity : FOLDED_ITEMS;
|
|
1565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oa-notes", children: [
|
|
1566
|
+
releases.map((release) => {
|
|
1567
|
+
if (left <= 0) return null;
|
|
1568
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("article", { className: "oa-release", "data-version": release.version, children: [
|
|
1569
|
+
headings && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("h3", { className: "oa-release-head", children: [
|
|
1570
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "oa-release-version", children: release.version }),
|
|
1571
|
+
release.date && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "oa-release-date", children: release.date }),
|
|
1572
|
+
tag?.(release)
|
|
1573
|
+
] }),
|
|
1574
|
+
release.summary.map((paragraph, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "oa-release-summary", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Inline, { text: paragraph }) }, i)),
|
|
1575
|
+
release.sections.map((section) => {
|
|
1576
|
+
if (left <= 0 || section.items.length === 0) return null;
|
|
1577
|
+
const items = section.items.slice(0, left);
|
|
1578
|
+
left -= items.length;
|
|
1579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "oa-release-section", children: [
|
|
1580
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h4", { children: sectionTitle(t, section.title) }),
|
|
1581
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { children: items.map((item, i) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Inline, { text: item }) }, i)) })
|
|
1582
|
+
] }, section.title);
|
|
1583
|
+
})
|
|
1584
|
+
] }, release.version);
|
|
1585
|
+
}),
|
|
1586
|
+
!all && total > FOLDED_ITEMS && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "oau-show", onClick: () => setAll(true), children: t("changelog.more", { count: String(total - FOLDED_ITEMS) }) })
|
|
1587
|
+
] });
|
|
1588
|
+
}
|
|
1589
|
+
function useLoadChangelog() {
|
|
1590
|
+
const { phase } = useUpdates();
|
|
1591
|
+
(0, import_react4.useEffect)(() => {
|
|
1592
|
+
void loadChangelog();
|
|
1593
|
+
}, []);
|
|
1594
|
+
(0, import_react4.useEffect)(() => {
|
|
1595
|
+
if (phase !== "done") return;
|
|
1596
|
+
void loadChangelog();
|
|
1597
|
+
const again = setTimeout(() => void loadChangelog(), 5e3);
|
|
1598
|
+
return () => clearTimeout(again);
|
|
1599
|
+
}, [phase]);
|
|
1600
|
+
}
|
|
1601
|
+
function WhatsNewPanel() {
|
|
1602
|
+
const { t } = usePageEnv();
|
|
1603
|
+
useLoadChangelog();
|
|
1604
|
+
const changelog = useChangelog();
|
|
1605
|
+
const releases = whatsNew(changelog);
|
|
1606
|
+
if (releases.length === 0) return null;
|
|
1607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "oau-panel oa-news", role: "status", "aria-label": t("changelog.new", { version: changelog.version }), "data-testid": "open-artifact-whats-new", children: [
|
|
1608
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oau-head", children: [
|
|
1609
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "oau-head-text", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "oau-title", children: t("changelog.new", { version: changelog.version }) }) }),
|
|
1610
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oau-actions", children: [
|
|
1611
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "oa-btn", onClick: openChangelog, children: t("changelog.all") }),
|
|
1612
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "oa-btn", "data-primary": "true", onClick: markSeen, children: t("changelog.gotIt") })
|
|
1613
|
+
] })
|
|
1614
|
+
] }),
|
|
1615
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ReleaseNotesList, { releases, headings: releases.length > 1, fold: true })
|
|
1616
|
+
] });
|
|
1617
|
+
}
|
|
1618
|
+
function UpcomingNotes() {
|
|
1619
|
+
const { t } = usePageEnv();
|
|
1620
|
+
const latest = latestOf(useUpdates().updates);
|
|
1621
|
+
const { upcoming } = useChangelog();
|
|
1622
|
+
(0, import_react4.useEffect)(() => {
|
|
1623
|
+
void loadUpcoming(latest);
|
|
1624
|
+
}, [latest]);
|
|
1625
|
+
if (upcoming.length === 0) return null;
|
|
1626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oa-news-upcoming", children: [
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ReleaseNotesList, { releases: upcoming, headings: upcoming.length > 1, fold: true }),
|
|
1628
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "oau-show", onClick: openChangelog, children: t("changelog.all") })
|
|
1629
|
+
] });
|
|
1630
|
+
}
|
|
1631
|
+
function ChangelogFooter() {
|
|
1632
|
+
const { t } = usePageEnv();
|
|
1633
|
+
const { version } = useChangelog();
|
|
1634
|
+
if (version === "") return null;
|
|
1635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("footer", { className: "oa-foot", children: [
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: t("changelog.version", { version }) }),
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { "aria-hidden": "true", children: "·" }),
|
|
1638
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "oau-show", onClick: openChangelog, "data-testid": "open-artifact-changelog", children: t("changelog.title") })
|
|
1639
|
+
] });
|
|
1640
|
+
}
|
|
1641
|
+
function ChangelogView() {
|
|
1642
|
+
const { t } = usePageEnv();
|
|
1643
|
+
const { version, releases, upcoming } = useChangelog();
|
|
1644
|
+
const latest = latestOf(useUpdates().updates);
|
|
1645
|
+
(0, import_react4.useEffect)(() => {
|
|
1646
|
+
void loadUpcoming(latest);
|
|
1647
|
+
}, [latest]);
|
|
1648
|
+
const tag = (release) => release.version === version ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "oau-tag", "data-tone": "neutral", children: t("changelog.installed") }) : upcoming.includes(release) ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "oau-tag", children: t("changelog.available") }) : null;
|
|
1649
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "oa-dialog-head", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("h2", { children: t("changelog.title") }) }),
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "oa-changelog", children: upcoming.length + releases.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { children: t("changelog.none") }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ReleaseNotesList, { releases: [...upcoming, ...releases], headings: true, tag }) }),
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "oa-dialog-actions", children: [
|
|
1653
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("a", { className: "oa-btn oa-btn-link", href: "https://github.com/JimLiu/open-artifact/releases", target: "_blank", rel: "noopener noreferrer", children: t("changelog.releases") }),
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("button", { type: "button", className: "oa-btn", "data-primary": "true", autoFocus: true, onClick: closeChangelog, children: t("dialog.close") })
|
|
1655
|
+
] })
|
|
1656
|
+
] });
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
// plugins/dsh/src/client/updates.tsx
|
|
1660
|
+
var import_react5 = require("react");
|
|
1661
|
+
|
|
1245
1662
|
// plugins/dsh/src/client/styles.ts
|
|
1246
1663
|
var PAGE_CSS = `
|
|
1247
1664
|
.oa-page{position:relative;width:100%;min-width:0;height:100%;min-height:0;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-bg-base);font-size:14px;line-height:1.6;display:flex;flex-direction:column;overflow:hidden}
|
|
@@ -1420,6 +1837,26 @@ window.__ModuleLoader__.load({
|
|
|
1420
1837
|
.oa-skeleton .oa-preview{background:var(--dsw-alias-bg-skeleton,var(--dsw-alias-interactive-bg-hover))}
|
|
1421
1838
|
.oa-skeleton .oa-line{width:60%;height:10px;margin:18px 14px}
|
|
1422
1839
|
@media (prefers-reduced-motion:reduce){.oa-sheet,.oa-paper,.oa-slide,.oa-film,.oa-act,.oa-tile-art,.oa-card{transition:none}.oa-tile:hover .oa-tile-art,.oa-tile[data-peek=true] .oa-tile-art{transform:none}.oa-peek{animation:none}.oa-spinner{animation-duration:2s}}
|
|
1840
|
+
.oa-news .oau-head{margin-bottom:8px}
|
|
1841
|
+
.oa-notes{display:flex;flex-direction:column;gap:12px;align-items:flex-start}
|
|
1842
|
+
.oa-release{align-self:stretch;min-width:0}
|
|
1843
|
+
.oa-release-head{display:flex;flex-wrap:wrap;align-items:center;gap:4px 8px;margin:0 0 4px;font-size:14px;font-weight:600;line-height:22px;color:var(--dsw-alias-label-primary)}
|
|
1844
|
+
.oa-release-date{font-weight:400;color:var(--dsw-alias-label-tertiary);font-size:12px}
|
|
1845
|
+
.oa-release-summary{margin:0 0 6px;color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;overflow-wrap:anywhere}
|
|
1846
|
+
.oa-release-section{margin-top:6px}
|
|
1847
|
+
.oa-release-section h4{margin:0 0 2px;font-size:12px;font-weight:500;line-height:18px;color:var(--dsw-alias-label-tertiary)}
|
|
1848
|
+
.oa-release-section ul{margin:0;padding-left:18px;color:var(--dsw-alias-label-secondary);font-size:13px;line-height:20px}
|
|
1849
|
+
.oa-release-section li{overflow-wrap:anywhere}
|
|
1850
|
+
.oa-release-section li+li{margin-top:2px}
|
|
1851
|
+
.oa-release code{padding:0 4px;border-radius:4px;background:color-mix(in srgb,var(--dsw-alias-label-primary) 8%,transparent);font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px}
|
|
1852
|
+
.oa-release strong{font-weight:600;color:var(--dsw-alias-label-primary)}
|
|
1853
|
+
.oa-release a{color:var(--dsw-alias-state-business-primary)}
|
|
1854
|
+
.oa-news-upcoming{display:flex;flex-direction:column;align-items:flex-start;gap:8px;margin-top:10px;padding-top:10px;border-top:.5px solid var(--dsw-alias-border-l2)}
|
|
1855
|
+
.oa-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:4px 8px;margin-top:40px;color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}
|
|
1856
|
+
.oa-dialog[data-wide=true]{width:min(640px,100%);display:flex;flex-direction:column;max-height:min(720px,calc(100vh - 48px))}
|
|
1857
|
+
.oa-changelog{flex:1;min-height:0;overflow:auto;margin:0 -20px;padding:0 20px}
|
|
1858
|
+
.oa-changelog .oa-release+.oa-release{padding-top:12px;border-top:.5px solid var(--dsw-alias-border-l2)}
|
|
1859
|
+
.oa-btn-link{display:inline-flex;align-items:center;text-decoration:none;margin-right:auto}
|
|
1423
1860
|
`;
|
|
1424
1861
|
var CARD_CSS = `
|
|
1425
1862
|
.oac-row{display:flex;flex-direction:column;align-items:flex-end;gap:8px;width:100%}
|
|
@@ -1457,192 +1894,10 @@ window.__ModuleLoader__.load({
|
|
|
1457
1894
|
return () => tag.remove();
|
|
1458
1895
|
}
|
|
1459
1896
|
|
|
1460
|
-
// plugins/dsh/src/client/update-state.ts
|
|
1461
|
-
var NS = "open-artifact-updates";
|
|
1462
|
-
var HUB = Symbol.for("open-artifact/dsh-updates");
|
|
1463
|
-
var DISMISSED_KEY = "open-artifact.update.dismissed";
|
|
1464
|
-
var FIRST_CHECK_MS = 3e3;
|
|
1465
|
-
var CHECK_EVERY_MS = 6 * 60 * 6e4;
|
|
1466
|
-
var REASON_MAX = 240;
|
|
1467
|
-
function readDismissed() {
|
|
1468
|
-
try {
|
|
1469
|
-
return localStorage.getItem(DISMISSED_KEY) ?? "";
|
|
1470
|
-
} catch {
|
|
1471
|
-
return "";
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
function hub() {
|
|
1475
|
-
const g = globalThis;
|
|
1476
|
-
return g[HUB] ??= {
|
|
1477
|
-
state: { updates: [], phase: "idle", to: "", restart: false, failure: null, dismissed: readDismissed() },
|
|
1478
|
-
listeners: /* @__PURE__ */ new Set()
|
|
1479
|
-
};
|
|
1480
|
-
}
|
|
1481
|
-
function set(patch) {
|
|
1482
|
-
const h = hub();
|
|
1483
|
-
h.state = { ...h.state, ...patch };
|
|
1484
|
-
for (const listener of [...h.listeners]) listener();
|
|
1485
|
-
}
|
|
1486
|
-
var subscribe = (listener) => {
|
|
1487
|
-
const { listeners } = hub();
|
|
1488
|
-
listeners.add(listener);
|
|
1489
|
-
return () => void listeners.delete(listener);
|
|
1490
|
-
};
|
|
1491
|
-
var updateState = () => hub().state;
|
|
1492
|
-
var latestOf = (updates) => updates.reduce((best, u) => best === "" || isNewer(u.latest, best) ? u.latest : best, "");
|
|
1493
|
-
async function readUpdates() {
|
|
1494
|
-
try {
|
|
1495
|
-
const response = await fetch(routeUrl(PATHS.updates), { cache: "no-store" });
|
|
1496
|
-
if (!response.ok) return null;
|
|
1497
|
-
const { updates } = await response.json();
|
|
1498
|
-
return Array.isArray(updates) ? updates : null;
|
|
1499
|
-
} catch {
|
|
1500
|
-
return null;
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
async function look() {
|
|
1504
|
-
const updates = await readUpdates();
|
|
1505
|
-
if (updates !== null && hub().state.phase !== "running") set({ updates });
|
|
1506
|
-
}
|
|
1507
|
-
var failedOutcome = (outcome) => outcome.application === "failed" || outcome.application === "cancelled";
|
|
1508
|
-
function reasonOf(outcome) {
|
|
1509
|
-
const { error } = outcome;
|
|
1510
|
-
const refused = error?.incompatible?.[0];
|
|
1511
|
-
if (refused) {
|
|
1512
|
-
return `${refused.name}@${refused.version} needs ${Object.entries(refused.requirements).map(([what, range]) => `${what} ${range}`).join(", ")}`;
|
|
1513
|
-
}
|
|
1514
|
-
const lines = (error?.diagnostic ?? "").split("\n").map((text) => text.trim()).filter(Boolean);
|
|
1515
|
-
const line = lines.find((text) => text.includes("ERR_")) ?? lines.at(-1);
|
|
1516
|
-
return (line ?? error?.code ?? outcome.application ?? "unknown").slice(0, REASON_MAX);
|
|
1517
|
-
}
|
|
1518
|
-
async function install(manager, plugin, requestId) {
|
|
1519
|
-
const answer = await manager.installBundle(plugin.spec, { enabled: plugin.enabled, registry: plugin.registry, requestId });
|
|
1520
|
-
if (answer.ok) return { outcome: answer.value, left: "kept" };
|
|
1521
|
-
const again = await manager.waitForInstall(requestId);
|
|
1522
|
-
if (again.ok && again.value !== null) return { outcome: again.value, left: "kept" };
|
|
1523
|
-
return { outcome: { application: "failed", error: { diagnostic: answer.error.message ?? "the app did not answer" } }, left: "unknown" };
|
|
1524
|
-
}
|
|
1525
|
-
async function run(manager) {
|
|
1526
|
-
set({ phase: "running", failure: null });
|
|
1527
|
-
const fresh = await readUpdates();
|
|
1528
|
-
if (fresh !== null) set({ updates: fresh });
|
|
1529
|
-
const plan = hub().state.updates;
|
|
1530
|
-
set({ to: latestOf(plan) });
|
|
1531
|
-
let restart = false;
|
|
1532
|
-
for (const [index, plugin] of plan.entries()) {
|
|
1533
|
-
let outcome;
|
|
1534
|
-
let left = "kept";
|
|
1535
|
-
try {
|
|
1536
|
-
({ outcome, left } = await install(manager, plugin, `open-artifact-update-${Date.now()}-${index}`));
|
|
1537
|
-
} catch (error) {
|
|
1538
|
-
outcome = { application: "failed", error: { diagnostic: error.message } };
|
|
1539
|
-
left = "unknown";
|
|
1540
|
-
}
|
|
1541
|
-
const already = outcome.application === "failed" && outcome.error?.code === "already-installed";
|
|
1542
|
-
if (failedOutcome(outcome) && !already) {
|
|
1543
|
-
set({ phase: "failed", failure: { plugin: plugin.name, message: reasonOf(outcome), left } });
|
|
1544
|
-
return void look();
|
|
1545
|
-
}
|
|
1546
|
-
restart ||= outcome.application === "restart-required";
|
|
1547
|
-
set({ updates: hub().state.updates.filter((u) => u.name !== plugin.name) });
|
|
1548
|
-
}
|
|
1549
|
-
set({ restart: hub().state.restart || restart });
|
|
1550
|
-
if (plan.length === 0) close();
|
|
1551
|
-
else set({ phase: "done" });
|
|
1552
|
-
void look();
|
|
1553
|
-
}
|
|
1554
|
-
var pluginManager;
|
|
1555
|
-
function start() {
|
|
1556
|
-
const { phase, updates } = hub().state;
|
|
1557
|
-
if (phase === "running" || updates.length === 0) return;
|
|
1558
|
-
if (pluginManager === void 0) return set({ phase: "failed", failure: { plugin: updates[0].name, message: "this app has no plugin manager", left: "kept" } });
|
|
1559
|
-
void run(pluginManager);
|
|
1560
|
-
}
|
|
1561
|
-
function later() {
|
|
1562
|
-
const version = latestOf(hub().state.updates);
|
|
1563
|
-
try {
|
|
1564
|
-
localStorage.setItem(DISMISSED_KEY, version);
|
|
1565
|
-
} catch {
|
|
1566
|
-
}
|
|
1567
|
-
set({ dismissed: version });
|
|
1568
|
-
}
|
|
1569
|
-
function close() {
|
|
1570
|
-
set({ phase: "idle", failure: null });
|
|
1571
|
-
}
|
|
1572
|
-
function reopen() {
|
|
1573
|
-
try {
|
|
1574
|
-
localStorage.removeItem(DISMISSED_KEY);
|
|
1575
|
-
} catch {
|
|
1576
|
-
}
|
|
1577
|
-
set({ dismissed: "" });
|
|
1578
|
-
}
|
|
1579
|
-
var zh2 = {
|
|
1580
|
-
available: "Open Artifact 有新版本 {version}",
|
|
1581
|
-
current: "当前是 {version}。",
|
|
1582
|
-
update: "更新",
|
|
1583
|
-
"update.one": "把 Open Artifact 更新到 {version}",
|
|
1584
|
-
later: "稍后",
|
|
1585
|
-
busy: "正在更新…",
|
|
1586
|
-
done: "已更新到 {version}。",
|
|
1587
|
-
"done.session": "新开的会话会用新版本。",
|
|
1588
|
-
"done.restart": "退出 DSH 再重新打开后生效。",
|
|
1589
|
-
failed: "Open Artifact 没有更新成功",
|
|
1590
|
-
"failed.kept": "它还是原来的版本。",
|
|
1591
|
-
"failed.unknown": "到插件页看一下它现在是哪个版本。",
|
|
1592
|
-
retry: "重试",
|
|
1593
|
-
close: "关闭",
|
|
1594
|
-
tag: "有新版本 {version}",
|
|
1595
|
-
show: "查看",
|
|
1596
|
-
"mark.update": "更新",
|
|
1597
|
-
"mark.running": "更新中",
|
|
1598
|
-
"mark.failed": "更新失败",
|
|
1599
|
-
"mark.restart": "待重启",
|
|
1600
|
-
"failed.tag": "更新失败,详情见 Open Artifact 页"
|
|
1601
|
-
};
|
|
1602
|
-
var en2 = {
|
|
1603
|
-
available: "Open Artifact {version} is available",
|
|
1604
|
-
current: "You have {version}.",
|
|
1605
|
-
update: "Update",
|
|
1606
|
-
"update.one": "Update Open Artifact to {version}",
|
|
1607
|
-
later: "Later",
|
|
1608
|
-
busy: "Updating…",
|
|
1609
|
-
done: "Updated to {version}.",
|
|
1610
|
-
"done.session": "New sessions use it.",
|
|
1611
|
-
"done.restart": "Quit DSH and open it again to finish.",
|
|
1612
|
-
failed: "Open Artifact did not update",
|
|
1613
|
-
"failed.kept": "It stays on the version it was.",
|
|
1614
|
-
"failed.unknown": "Check which version it is on, on the Plugins page.",
|
|
1615
|
-
retry: "Try again",
|
|
1616
|
-
close: "Close",
|
|
1617
|
-
tag: "New version {version}",
|
|
1618
|
-
show: "Show",
|
|
1619
|
-
"mark.update": "Update",
|
|
1620
|
-
"mark.running": "Updating",
|
|
1621
|
-
"mark.failed": "Failed",
|
|
1622
|
-
"mark.restart": "Restart",
|
|
1623
|
-
"failed.tag": "Update failed: see Open Artifact"
|
|
1624
|
-
};
|
|
1625
|
-
var fill2 = (text, params) => text.replace(/\{(\w+)\}/g, (all, name) => params?.[name] ?? all);
|
|
1626
|
-
var current = (key, params) => fill2(en2[key] ?? key, params);
|
|
1627
|
-
var translate = (key, params) => current(key, params);
|
|
1628
|
-
function setTranslate(bound) {
|
|
1629
|
-
current = (key, params) => bound(key, params);
|
|
1630
|
-
}
|
|
1631
|
-
function markOf({ phase, updates, restart, dismissed }) {
|
|
1632
|
-
if (phase === "running") return "mark.running";
|
|
1633
|
-
if (phase === "failed") return "mark.failed";
|
|
1634
|
-
if (phase === "done" && restart) return "mark.restart";
|
|
1635
|
-
const latest = latestOf(updates);
|
|
1636
|
-
return latest !== "" && latest !== dismissed ? "mark.update" : null;
|
|
1637
|
-
}
|
|
1638
|
-
function setPluginManager(manager) {
|
|
1639
|
-
pluginManager = manager;
|
|
1640
|
-
}
|
|
1641
|
-
|
|
1642
1897
|
// plugins/dsh/src/client/updates.tsx
|
|
1643
|
-
var
|
|
1898
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1644
1899
|
var SLOT_ID = "open-artifact.update";
|
|
1645
|
-
var
|
|
1900
|
+
var useUpdates2 = () => (0, import_react5.useSyncExternalStore)(subscribe, updateState);
|
|
1646
1901
|
var CSS = `
|
|
1647
1902
|
.oau-panel{margin:0 0 24px;padding:14px 16px;border-radius:12px;background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px}
|
|
1648
1903
|
.oau-head{display:flex;flex-wrap:wrap;align-items:flex-start;gap:8px 16px}
|
|
@@ -1663,17 +1918,17 @@ window.__ModuleLoader__.load({
|
|
|
1663
1918
|
.oau-tag[data-tone="neutral"]{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}
|
|
1664
1919
|
`;
|
|
1665
1920
|
function Action({ primary, onClick, children, label, disabled }) {
|
|
1666
|
-
return /* @__PURE__ */ (0,
|
|
1921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "oa-btn", ...primary ? { "data-primary": "true" } : {}, ...label ? { "aria-label": label } : {}, disabled, onClick, children });
|
|
1667
1922
|
}
|
|
1668
1923
|
function UpdatePanel() {
|
|
1669
|
-
const { phase, updates, to, restart, failure, dismissed } =
|
|
1924
|
+
const { phase, updates, to, restart, failure, dismissed } = useUpdates2();
|
|
1670
1925
|
const t = translate;
|
|
1671
1926
|
const latest = latestOf(updates);
|
|
1672
1927
|
if (phase === "idle" && latest === "") return null;
|
|
1673
1928
|
if (phase === "idle" && latest === dismissed) {
|
|
1674
|
-
return /* @__PURE__ */ (0,
|
|
1675
|
-
/* @__PURE__ */ (0,
|
|
1676
|
-
/* @__PURE__ */ (0,
|
|
1929
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "oau-line", "data-testid": "open-artifact-update-line", children: [
|
|
1930
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: t("available", { version: latest }) }),
|
|
1931
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("button", { type: "button", className: "oau-show", onClick: reopen, children: t("show") })
|
|
1677
1932
|
] });
|
|
1678
1933
|
}
|
|
1679
1934
|
let title;
|
|
@@ -1684,60 +1939,63 @@ window.__ModuleLoader__.load({
|
|
|
1684
1939
|
} else if (phase === "done") {
|
|
1685
1940
|
title = t("done", { version: to });
|
|
1686
1941
|
text = t(restart ? "done.restart" : "done.session");
|
|
1687
|
-
actions = /* @__PURE__ */ (0,
|
|
1942
|
+
actions = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Action, { onClick: close, children: t("close") });
|
|
1688
1943
|
} else if (phase === "failed" && failure) {
|
|
1689
1944
|
title = t("failed");
|
|
1690
1945
|
text = `${failure.message} ${t(failure.left === "unknown" ? "failed.unknown" : "failed.kept")}`;
|
|
1691
|
-
actions = /* @__PURE__ */ (0,
|
|
1692
|
-
/* @__PURE__ */ (0,
|
|
1693
|
-
updates.length > 0 && /* @__PURE__ */ (0,
|
|
1946
|
+
actions = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1947
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Action, { onClick: close, children: t("close") }),
|
|
1948
|
+
updates.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Action, { primary: true, onClick: start, children: t("retry") })
|
|
1694
1949
|
] });
|
|
1695
1950
|
} else {
|
|
1696
1951
|
title = t("available", { version: latest });
|
|
1697
1952
|
text = t("current", { version: updates[0]?.version ?? "" });
|
|
1698
|
-
actions = /* @__PURE__ */ (0,
|
|
1699
|
-
/* @__PURE__ */ (0,
|
|
1700
|
-
/* @__PURE__ */ (0,
|
|
1953
|
+
actions = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1954
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Action, { onClick: later, children: t("later") }),
|
|
1955
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Action, { primary: true, onClick: start, label: t("update.one", { version: latest }), children: t("update") })
|
|
1701
1956
|
] });
|
|
1702
1957
|
}
|
|
1703
|
-
return /* @__PURE__ */ (0,
|
|
1704
|
-
/* @__PURE__ */ (0,
|
|
1705
|
-
/* @__PURE__ */ (0,
|
|
1706
|
-
|
|
1958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "oau-panel", role: phase === "failed" ? "alert" : "status", "data-testid": "open-artifact-update", "data-phase": phase, children: [
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "oau-head", children: [
|
|
1960
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "oau-head-text", children: [
|
|
1961
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "oau-title", children: title }),
|
|
1962
|
+
text !== null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "oau-text", children: text })
|
|
1963
|
+
] }),
|
|
1964
|
+
actions !== null && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "oau-actions", children: actions })
|
|
1707
1965
|
] }),
|
|
1708
|
-
|
|
1709
|
-
] })
|
|
1966
|
+
phase === "idle" && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(UpcomingNotes, {})
|
|
1967
|
+
] });
|
|
1710
1968
|
}
|
|
1711
1969
|
function UpdateMark({ wide, children }) {
|
|
1712
|
-
const mark = markOf(
|
|
1713
|
-
if (mark === null) return /* @__PURE__ */ (0,
|
|
1970
|
+
const mark = markOf(useUpdates2());
|
|
1971
|
+
if (mark === null) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
|
|
1714
1972
|
if (wide) {
|
|
1715
|
-
return /* @__PURE__ */ (0,
|
|
1973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
1716
1974
|
children,
|
|
1717
|
-
/* @__PURE__ */ (0,
|
|
1975
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "oau-mark-pill", "data-testid": "open-artifact-update-mark", "data-mark": mark, children: translate(mark) })
|
|
1718
1976
|
] });
|
|
1719
1977
|
}
|
|
1720
|
-
return /* @__PURE__ */ (0,
|
|
1978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "oau-rail-icon", children: [
|
|
1721
1979
|
children,
|
|
1722
|
-
/* @__PURE__ */ (0,
|
|
1980
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "oau-mark-dot", "data-testid": "open-artifact-update-mark", "data-mark": mark })
|
|
1723
1981
|
] });
|
|
1724
1982
|
}
|
|
1725
1983
|
var pageUpdate = (updates, name) => name === void 0 ? void 0 : updates.find((u) => u.name === name && !u.native);
|
|
1726
1984
|
function DetailAction({ subject }) {
|
|
1727
|
-
const { phase, updates } =
|
|
1985
|
+
const { phase, updates } = useUpdates2();
|
|
1728
1986
|
const update = pageUpdate(updates, subject?.pkg?.name);
|
|
1729
1987
|
if (subject?.kind !== "bundle" || update === void 0) return null;
|
|
1730
1988
|
const running = phase === "running";
|
|
1731
|
-
return /* @__PURE__ */ (0,
|
|
1989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(Action, { onClick: start, disabled: running, label: translate("update.one", { version: update.latest }), children: translate(running ? "busy" : "update") });
|
|
1732
1990
|
}
|
|
1733
1991
|
function DetailBadge({ subject }) {
|
|
1734
|
-
const { phase, updates, failure } =
|
|
1992
|
+
const { phase, updates, failure } = useUpdates2();
|
|
1735
1993
|
if (subject?.kind !== "bundle") return null;
|
|
1736
1994
|
if (phase === "failed" && failure?.plugin === subject.pkg?.name) {
|
|
1737
|
-
return /* @__PURE__ */ (0,
|
|
1995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "oau-tag", "data-tone": "neutral", children: translate("failed.tag") });
|
|
1738
1996
|
}
|
|
1739
1997
|
const update = pageUpdate(updates, subject.pkg?.name);
|
|
1740
|
-
return update === void 0 ? null : /* @__PURE__ */ (0,
|
|
1998
|
+
return update === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "oau-tag", children: translate("tag", { version: update.latest }) });
|
|
1741
1999
|
}
|
|
1742
2000
|
function joinUpdates(ctx, plugin) {
|
|
1743
2001
|
ctx.effect(() => injectStyles(`${plugin}/updates.css`, CSS), `${plugin}: update styles`);
|
|
@@ -1776,7 +2034,7 @@ window.__ModuleLoader__.load({
|
|
|
1776
2034
|
}
|
|
1777
2035
|
|
|
1778
2036
|
// plugins/dsh/src/client/time.ts
|
|
1779
|
-
var
|
|
2037
|
+
var import_react6 = require("react");
|
|
1780
2038
|
var STEPS = [
|
|
1781
2039
|
["minute", 60],
|
|
1782
2040
|
["hour", 3600],
|
|
@@ -1802,8 +2060,8 @@ window.__ModuleLoader__.load({
|
|
|
1802
2060
|
return t("card.opened", { time: format.format(Math.round(seconds / size), unit) });
|
|
1803
2061
|
}
|
|
1804
2062
|
function useNow(everyMs = 6e4) {
|
|
1805
|
-
const [now, setNow] = (0,
|
|
1806
|
-
(0,
|
|
2063
|
+
const [now, setNow] = (0, import_react6.useState)(() => Date.now());
|
|
2064
|
+
(0, import_react6.useEffect)(() => {
|
|
1807
2065
|
const timer = setInterval(() => setNow(Date.now()), everyMs);
|
|
1808
2066
|
return () => clearInterval(timer);
|
|
1809
2067
|
}, [everyMs]);
|
|
@@ -1811,7 +2069,7 @@ window.__ModuleLoader__.load({
|
|
|
1811
2069
|
}
|
|
1812
2070
|
|
|
1813
2071
|
// plugins/dsh/src/client/components/ArtifactsPage.tsx
|
|
1814
|
-
var
|
|
2072
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1815
2073
|
function typeLabel(t, id, title) {
|
|
1816
2074
|
const key = `type.${id}`;
|
|
1817
2075
|
return isKey(key) ? t(key) : title || id;
|
|
@@ -1823,9 +2081,9 @@ window.__ModuleLoader__.load({
|
|
|
1823
2081
|
function Preview({ artifact }) {
|
|
1824
2082
|
const { api } = usePageEnv();
|
|
1825
2083
|
const url = artifact.thumbnail === null ? null : api.thumbnailUrl(artifact.id, artifact.thumbnail);
|
|
1826
|
-
const [broken, setBroken] = (0,
|
|
2084
|
+
const [broken, setBroken] = (0, import_react7.useState)(null);
|
|
1827
2085
|
const shown = url !== null && broken !== url;
|
|
1828
|
-
return /* @__PURE__ */ (0,
|
|
2086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-preview", "data-stack": shown && artifact.type === "docs", children: shown ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-sheet", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("img", { src: url, alt: "", draggable: false, onError: () => setBroken(url) }) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Drawn, { type: artifact.type, title: artifact.title }) });
|
|
1829
2087
|
}
|
|
1830
2088
|
var ITEMS = "[role^=menuitem]";
|
|
1831
2089
|
function menuKeys(event, close2) {
|
|
@@ -1843,9 +2101,9 @@ window.__ModuleLoader__.load({
|
|
|
1843
2101
|
items[(at + (event.key === "ArrowDown" ? 1 : items.length - 1)) % items.length]?.focus();
|
|
1844
2102
|
}
|
|
1845
2103
|
function Menu({ anchor, label, onClose, onKey, children }) {
|
|
1846
|
-
const ref = (0,
|
|
1847
|
-
const [place, setPlace] = (0,
|
|
1848
|
-
(0,
|
|
2104
|
+
const ref = (0, import_react7.useRef)(null);
|
|
2105
|
+
const [place, setPlace] = (0, import_react7.useState)({ visibility: "hidden" });
|
|
2106
|
+
(0, import_react7.useLayoutEffect)(() => {
|
|
1849
2107
|
const box = anchor.getBoundingClientRect();
|
|
1850
2108
|
const height = ref.current?.offsetHeight ?? 0;
|
|
1851
2109
|
const width = ref.current?.offsetWidth ?? 0;
|
|
@@ -1857,10 +2115,10 @@ window.__ModuleLoader__.load({
|
|
|
1857
2115
|
});
|
|
1858
2116
|
}, [anchor]);
|
|
1859
2117
|
const placed = place.visibility !== "hidden";
|
|
1860
|
-
(0,
|
|
2118
|
+
(0, import_react7.useEffect)(() => {
|
|
1861
2119
|
if (placed) ref.current?.querySelector(ITEMS)?.focus({ preventScroll: true });
|
|
1862
2120
|
}, [placed]);
|
|
1863
|
-
(0,
|
|
2121
|
+
(0, import_react7.useEffect)(() => {
|
|
1864
2122
|
const away = (event) => {
|
|
1865
2123
|
const target = event.target;
|
|
1866
2124
|
if (!ref.current?.contains(target) && !anchor.contains(target)) onClose();
|
|
@@ -1873,7 +2131,7 @@ window.__ModuleLoader__.load({
|
|
|
1873
2131
|
window.removeEventListener("resize", gone);
|
|
1874
2132
|
};
|
|
1875
2133
|
}, [anchor, onClose]);
|
|
1876
|
-
return /* @__PURE__ */ (0,
|
|
2134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1877
2135
|
"div",
|
|
1878
2136
|
{
|
|
1879
2137
|
ref,
|
|
@@ -1896,21 +2154,21 @@ window.__ModuleLoader__.load({
|
|
|
1896
2154
|
);
|
|
1897
2155
|
}
|
|
1898
2156
|
function ChoiceItem({ label, on, count, onPick }) {
|
|
1899
|
-
return /* @__PURE__ */ (0,
|
|
1900
|
-
/* @__PURE__ */ (0,
|
|
1901
|
-
count !== void 0 && /* @__PURE__ */ (0,
|
|
1902
|
-
on && /* @__PURE__ */ (0,
|
|
2157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "oa-menu-item", role: "menuitemradio", "aria-checked": on, onClick: onPick, children: [
|
|
2158
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-label", children: label }),
|
|
2159
|
+
count !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-count", children: count }),
|
|
2160
|
+
on && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-tick", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.tick }) })
|
|
1903
2161
|
] });
|
|
1904
2162
|
}
|
|
1905
2163
|
function SubMenu({ id, label, value, open, setOpen, children }) {
|
|
1906
2164
|
const isOpen = open === id;
|
|
1907
|
-
const panel = (0,
|
|
1908
|
-
const [flip, setFlip] = (0,
|
|
1909
|
-
(0,
|
|
2165
|
+
const panel = (0, import_react7.useRef)(null);
|
|
2166
|
+
const [flip, setFlip] = (0, import_react7.useState)(false);
|
|
2167
|
+
(0, import_react7.useLayoutEffect)(() => {
|
|
1910
2168
|
if (isOpen && panel.current) setFlip(panel.current.getBoundingClientRect().right + (flip ? panel.current.offsetWidth : 0) > window.innerWidth - 8);
|
|
1911
2169
|
}, [isOpen]);
|
|
1912
|
-
return /* @__PURE__ */ (0,
|
|
1913
|
-
/* @__PURE__ */ (0,
|
|
2170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-menu-row", onMouseEnter: () => setOpen(id), children: [
|
|
2171
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1914
2172
|
"button",
|
|
1915
2173
|
{
|
|
1916
2174
|
type: "button",
|
|
@@ -1927,13 +2185,13 @@ window.__ModuleLoader__.load({
|
|
|
1927
2185
|
}
|
|
1928
2186
|
},
|
|
1929
2187
|
children: [
|
|
1930
|
-
/* @__PURE__ */ (0,
|
|
1931
|
-
/* @__PURE__ */ (0,
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
2188
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-label", children: label }),
|
|
2189
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-value", children: value }),
|
|
2190
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-chev", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.chevron, size: 12 }) })
|
|
1933
2191
|
]
|
|
1934
2192
|
}
|
|
1935
2193
|
),
|
|
1936
|
-
isOpen && /* @__PURE__ */ (0,
|
|
2194
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1937
2195
|
"div",
|
|
1938
2196
|
{
|
|
1939
2197
|
ref: panel,
|
|
@@ -1957,15 +2215,15 @@ window.__ModuleLoader__.load({
|
|
|
1957
2215
|
] });
|
|
1958
2216
|
}
|
|
1959
2217
|
function FilterMenu({ anchor, filters, setFilters, types, counts, t, onClose }) {
|
|
1960
|
-
const [open, setOpen] = (0,
|
|
2218
|
+
const [open, setOpen] = (0, import_react7.useState)(null);
|
|
1961
2219
|
const titleOf = (id) => typeLabel(t, id, types.find((type) => type.id === id)?.title);
|
|
1962
2220
|
const typeValue = filters.types.length === 0 ? t("filter.any") : filters.types.length === 1 ? titleOf(filters.types[0]) : t("filter.some", { count: String(filters.types.length) });
|
|
1963
|
-
return /* @__PURE__ */ (0,
|
|
1964
|
-
/* @__PURE__ */ (0,
|
|
1965
|
-
/* @__PURE__ */ (0,
|
|
1966
|
-
/* @__PURE__ */ (0,
|
|
2221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Menu, { anchor, label: t("filter.button"), onClose, children: [
|
|
2222
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SubMenu, { id: "sort", label: t("filter.sort"), value: t(`sort.${filters.sort}`), open, setOpen, children: SORTS.map((sort) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChoiceItem, { label: t(`sort.${sort}`), on: filters.sort === sort, onPick: () => setFilters({ ...filters, sort }) }, sort)) }),
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-menu-rule", role: "separator" }),
|
|
2224
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SubMenu, { id: "type", label: t("filter.type"), value: typeValue, open, setOpen, children: types.map(({ id }) => {
|
|
1967
2225
|
const on = filters.types.includes(id);
|
|
1968
|
-
return /* @__PURE__ */ (0,
|
|
2226
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1969
2227
|
"button",
|
|
1970
2228
|
{
|
|
1971
2229
|
type: "button",
|
|
@@ -1974,33 +2232,33 @@ window.__ModuleLoader__.load({
|
|
|
1974
2232
|
"aria-checked": on,
|
|
1975
2233
|
onClick: () => setFilters({ ...filters, types: on ? filters.types.filter((x) => x !== id) : [...filters.types, id] }),
|
|
1976
2234
|
children: [
|
|
1977
|
-
/* @__PURE__ */ (0,
|
|
1978
|
-
/* @__PURE__ */ (0,
|
|
1979
|
-
/* @__PURE__ */ (0,
|
|
2235
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-check", "data-on": on, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.tick, size: 12 }) }),
|
|
2236
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-label", children: titleOf(id) }),
|
|
2237
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-count", children: counts.get(id) ?? 0 })
|
|
1980
2238
|
]
|
|
1981
2239
|
},
|
|
1982
2240
|
id
|
|
1983
2241
|
);
|
|
1984
2242
|
}) }),
|
|
1985
|
-
/* @__PURE__ */ (0,
|
|
1986
|
-
/* @__PURE__ */ (0,
|
|
1987
|
-
/* @__PURE__ */ (0,
|
|
1988
|
-
/* @__PURE__ */ (0,
|
|
1989
|
-
/* @__PURE__ */ (0,
|
|
1990
|
-
/* @__PURE__ */ (0,
|
|
1991
|
-
filters.pinned && /* @__PURE__ */ (0,
|
|
2243
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SubMenu, { id: "date", label: t("filter.date"), value: t(`date.${filters.date}`), open, setOpen, children: DATES.map((date) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChoiceItem, { label: t(`date.${date}`), on: filters.date === date, onPick: () => setFilters({ ...filters, date }) }, date)) }),
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SubMenu, { id: "sharing", label: t("filter.sharing"), value: t(`sharing.${filters.sharing}`), open, setOpen, children: SHARINGS.map((sharing) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChoiceItem, { label: t(`sharing.${sharing}`), on: filters.sharing === sharing, onPick: () => setFilters({ ...filters, sharing }) }, sharing)) }),
|
|
2245
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-menu-rule", role: "separator" }),
|
|
2246
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { onMouseEnter: () => setOpen(null), children: [
|
|
2247
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "oa-menu-item", role: "menuitemcheckbox", "aria-checked": filters.pinned, onClick: () => setFilters({ ...filters, pinned: !filters.pinned }), children: [
|
|
2248
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-label", children: t("filter.pinned") }),
|
|
2249
|
+
filters.pinned && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-tick", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.tick }) })
|
|
1992
2250
|
] }),
|
|
1993
|
-
isFiltered(filters) && /* @__PURE__ */ (0,
|
|
2251
|
+
isFiltered(filters) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-menu-item", role: "menuitem", onClick: () => setFilters({ ...NO_FILTERS, sort: filters.sort }), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-label", children: t("filter.clear") }) })
|
|
1994
2252
|
] })
|
|
1995
2253
|
] });
|
|
1996
2254
|
}
|
|
1997
2255
|
function ActionsMenu({ anchor, artifact, t, onClose, act }) {
|
|
1998
|
-
const item = (what, icon, label, key) => /* @__PURE__ */ (0,
|
|
1999
|
-
/* @__PURE__ */ (0,
|
|
2000
|
-
/* @__PURE__ */ (0,
|
|
2001
|
-
/* @__PURE__ */ (0,
|
|
2256
|
+
const item = (what, icon, label, key) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "oa-menu-item", role: "menuitem", "aria-keyshortcuts": key, onClick: () => act(what), children: [
|
|
2257
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: icon }),
|
|
2258
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-label", children: label }),
|
|
2259
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("kbd", { className: "oa-menu-key", children: key })
|
|
2002
2260
|
] });
|
|
2003
|
-
return /* @__PURE__ */ (0,
|
|
2261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2004
2262
|
Menu,
|
|
2005
2263
|
{
|
|
2006
2264
|
anchor,
|
|
@@ -2017,30 +2275,30 @@ window.__ModuleLoader__.load({
|
|
|
2017
2275
|
item("rename", ICON.rename, t("action.rename"), "R"),
|
|
2018
2276
|
item("copy", ICON.link, t("action.copy"), "C"),
|
|
2019
2277
|
item("share", ICON.share, t("action.share"), "S"),
|
|
2020
|
-
/* @__PURE__ */ (0,
|
|
2021
|
-
/* @__PURE__ */ (0,
|
|
2022
|
-
/* @__PURE__ */ (0,
|
|
2023
|
-
/* @__PURE__ */ (0,
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-menu-rule", role: "separator" }),
|
|
2279
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "oa-menu-item", role: "menuitem", "data-danger": "true", onClick: () => act("delete"), children: [
|
|
2280
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.trash }),
|
|
2281
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-label", children: t("action.delete") })
|
|
2024
2282
|
] })
|
|
2025
2283
|
]
|
|
2026
2284
|
}
|
|
2027
2285
|
);
|
|
2028
2286
|
}
|
|
2029
2287
|
function CreateMenu({ anchor, tiles, canCreate, t, onClose, create }) {
|
|
2030
|
-
return /* @__PURE__ */ (0,
|
|
2031
|
-
/* @__PURE__ */ (0,
|
|
2032
|
-
/* @__PURE__ */ (0,
|
|
2033
|
-
/* @__PURE__ */ (0,
|
|
2288
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Menu, { anchor, label: t("create.new"), onClose, children: [
|
|
2289
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "oa-menu-item", role: "menuitem", disabled: !canCreate, onClick: () => create(), children: [
|
|
2290
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.chat }),
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-label", children: t("create.session") })
|
|
2034
2292
|
] }),
|
|
2035
|
-
tiles.length > 0 && /* @__PURE__ */ (0,
|
|
2036
|
-
tiles.map((tile) => /* @__PURE__ */ (0,
|
|
2037
|
-
/* @__PURE__ */ (0,
|
|
2038
|
-
/* @__PURE__ */ (0,
|
|
2293
|
+
tiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-menu-rule", role: "separator" }),
|
|
2294
|
+
tiles.map((tile) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "oa-menu-item", role: "menuitem", "data-type": tile.id, onClick: () => create(tile.id), style: typeStyle(tile.id), children: [
|
|
2295
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-glyph", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeIcon, { type: tile.id, size: 16 }) }),
|
|
2296
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-menu-label", children: typeLabel(t, tile.id, tile.title) })
|
|
2039
2297
|
] }, tile.id))
|
|
2040
2298
|
] });
|
|
2041
2299
|
}
|
|
2042
|
-
function Dialog({ label, onClose, children }) {
|
|
2043
|
-
return /* @__PURE__ */ (0,
|
|
2300
|
+
function Dialog({ label, onClose, children, wide = false }) {
|
|
2301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2044
2302
|
"div",
|
|
2045
2303
|
{
|
|
2046
2304
|
className: "oa-scrim",
|
|
@@ -2053,20 +2311,20 @@ window.__ModuleLoader__.load({
|
|
|
2053
2311
|
onClose();
|
|
2054
2312
|
}
|
|
2055
2313
|
},
|
|
2056
|
-
children: /* @__PURE__ */ (0,
|
|
2314
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-dialog", role: "dialog", "aria-modal": "true", "aria-label": label, ...wide ? { "data-wide": "true" } : {}, children })
|
|
2057
2315
|
}
|
|
2058
2316
|
);
|
|
2059
2317
|
}
|
|
2060
2318
|
function RenameDialog({ artifact, t, onClose, onSave }) {
|
|
2061
|
-
const [title, setTitle] = (0,
|
|
2062
|
-
const input = (0,
|
|
2063
|
-
(0,
|
|
2319
|
+
const [title, setTitle] = (0, import_react7.useState)(artifact.title);
|
|
2320
|
+
const input = (0, import_react7.useRef)(null);
|
|
2321
|
+
(0, import_react7.useEffect)(() => {
|
|
2064
2322
|
input.current?.focus();
|
|
2065
2323
|
input.current?.select();
|
|
2066
2324
|
}, []);
|
|
2067
2325
|
const clean = title.trim();
|
|
2068
2326
|
const ready = clean !== "" && clean !== artifact.title;
|
|
2069
|
-
return /* @__PURE__ */ (0,
|
|
2327
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog, { label: t("rename.title"), onClose, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2070
2328
|
"form",
|
|
2071
2329
|
{
|
|
2072
2330
|
onSubmit: (event) => {
|
|
@@ -2074,26 +2332,26 @@ window.__ModuleLoader__.load({
|
|
|
2074
2332
|
if (ready) onSave(clean);
|
|
2075
2333
|
},
|
|
2076
2334
|
children: [
|
|
2077
|
-
/* @__PURE__ */ (0,
|
|
2078
|
-
/* @__PURE__ */ (0,
|
|
2079
|
-
/* @__PURE__ */ (0,
|
|
2080
|
-
/* @__PURE__ */ (0,
|
|
2081
|
-
/* @__PURE__ */ (0,
|
|
2335
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: t("rename.title") }),
|
|
2336
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("input", { ref: input, value: title, "aria-label": t("rename.title"), maxLength: 200, onChange: (event) => setTitle(event.target.value) }),
|
|
2337
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-dialog-actions", children: [
|
|
2338
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-btn", onClick: onClose, children: t("dialog.cancel") }),
|
|
2339
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "submit", className: "oa-btn", "data-primary": "true", disabled: !ready, children: t("rename.save") })
|
|
2082
2340
|
] })
|
|
2083
2341
|
]
|
|
2084
2342
|
}
|
|
2085
2343
|
) });
|
|
2086
2344
|
}
|
|
2087
2345
|
function DeleteDialog({ artifact, t, onClose, onDelete }) {
|
|
2088
|
-
const confirm = (0,
|
|
2089
|
-
(0,
|
|
2346
|
+
const confirm = (0, import_react7.useRef)(null);
|
|
2347
|
+
(0, import_react7.useEffect)(() => confirm.current?.focus(), []);
|
|
2090
2348
|
const title = t("delete.title", { title: artifact.title });
|
|
2091
|
-
return /* @__PURE__ */ (0,
|
|
2092
|
-
/* @__PURE__ */ (0,
|
|
2093
|
-
/* @__PURE__ */ (0,
|
|
2094
|
-
/* @__PURE__ */ (0,
|
|
2095
|
-
/* @__PURE__ */ (0,
|
|
2096
|
-
/* @__PURE__ */ (0,
|
|
2349
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Dialog, { label: title, onClose, children: [
|
|
2350
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: title }),
|
|
2351
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: t("delete.moves") }),
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-dialog-actions", children: [
|
|
2353
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-btn", onClick: onClose, children: t("dialog.cancel") }),
|
|
2354
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { ref: confirm, type: "button", className: "oa-btn", "data-danger": "true", onClick: onDelete, children: t("delete.confirm") })
|
|
2097
2355
|
] })
|
|
2098
2356
|
] });
|
|
2099
2357
|
}
|
|
@@ -2102,65 +2360,65 @@ window.__ModuleLoader__.load({
|
|
|
2102
2360
|
const toast = usePage((s) => s.toast);
|
|
2103
2361
|
const dismiss = usePage((s) => s.dismissToast);
|
|
2104
2362
|
const undo = usePage((s) => s.undo);
|
|
2105
|
-
(0,
|
|
2363
|
+
(0, import_react7.useEffect)(() => {
|
|
2106
2364
|
if (toast === null) return;
|
|
2107
2365
|
const timer = setTimeout(dismiss, toast.undo || toast.kind === "error" ? 1e4 : 4e3);
|
|
2108
2366
|
return () => clearTimeout(timer);
|
|
2109
2367
|
}, [toast, dismiss]);
|
|
2110
2368
|
if (toast === null) return null;
|
|
2111
|
-
return /* @__PURE__ */ (0,
|
|
2112
|
-
/* @__PURE__ */ (0,
|
|
2113
|
-
/* @__PURE__ */ (0,
|
|
2114
|
-
toast.undo && /* @__PURE__ */ (0,
|
|
2115
|
-
/* @__PURE__ */ (0,
|
|
2369
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-toast", role: toast.kind === "error" ? "alert" : "status", "data-kind": toast.kind, children: [
|
|
2370
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.info }),
|
|
2371
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-toast-text", children: toast.message }),
|
|
2372
|
+
toast.undo && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-toast-undo", onClick: () => void undo(toast.undo), children: t("toast.undo") }),
|
|
2373
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-toast-close", "aria-label": t("toast.close"), onClick: dismiss, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.clear, size: 14 }) })
|
|
2116
2374
|
] }, toast.id);
|
|
2117
2375
|
}
|
|
2118
2376
|
var hint = (artifact, conversation) => conversation ? `${artifact.root}
|
|
2119
2377
|
${conversation}` : artifact.root;
|
|
2120
2378
|
function PinButton({ artifact, t, onPin }) {
|
|
2121
2379
|
const label = t(artifact.pinned ? "action.unpin" : "action.pin");
|
|
2122
|
-
return /* @__PURE__ */ (0,
|
|
2380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-act", "data-on": artifact.pinned, "aria-pressed": artifact.pinned, "aria-label": label, title: label, onClick: () => onPin(artifact), children: artifact.pinned ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 16 16", "aria-hidden": "true", style: svg(16), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M9.75 2.25 13.75 6.25M10.75 3.25 7 6.25 4.5 6.5 9.5 11.5 9.75 9 12.75 5.25M7 9l-4 4", fill: "currentColor", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.pin }) });
|
|
2123
2381
|
}
|
|
2124
2382
|
function MoreButton({ artifact, t, menuOpen, onMenu, extra }) {
|
|
2125
|
-
return /* @__PURE__ */ (0,
|
|
2383
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: `oa-act ${extra ?? ""}`, "aria-label": t("action.more"), title: t("action.more"), "aria-haspopup": "menu", "aria-expanded": menuOpen, onClick: (event) => onMenu(artifact, event.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.more }) });
|
|
2126
2384
|
}
|
|
2127
2385
|
function Card({ artifact, opening, conversation, now, t, onOpen, onPin, menuOpen, onMenu }) {
|
|
2128
2386
|
const busy = opening === artifact.id;
|
|
2129
|
-
return /* @__PURE__ */ (0,
|
|
2130
|
-
/* @__PURE__ */ (0,
|
|
2131
|
-
/* @__PURE__ */ (0,
|
|
2132
|
-
/* @__PURE__ */ (0,
|
|
2133
|
-
busy && /* @__PURE__ */ (0,
|
|
2134
|
-
/* @__PURE__ */ (0,
|
|
2387
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { className: "oa-item", "data-menu": menuOpen, style: typeStyle(artifact.type), children: [
|
|
2388
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "oa-card", disabled: opening !== null, "aria-busy": busy, title: hint(artifact, conversation), onClick: () => onOpen(artifact), "data-type": artifact.type, children: [
|
|
2389
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "oa-preview-wrap", style: { display: "block", position: "relative", width: "100%" }, children: [
|
|
2390
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Preview, { artifact }),
|
|
2391
|
+
busy && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "oa-busy", children: [
|
|
2392
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-spinner" }),
|
|
2135
2393
|
t("card.opening")
|
|
2136
2394
|
] })
|
|
2137
2395
|
] }),
|
|
2138
|
-
/* @__PURE__ */ (0,
|
|
2139
|
-
/* @__PURE__ */ (0,
|
|
2140
|
-
/* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2142
|
-
/* @__PURE__ */ (0,
|
|
2396
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "oa-info", children: [
|
|
2397
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-glyph", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeIcon, { type: artifact.type }) }),
|
|
2398
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "oa-text", children: [
|
|
2399
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-name", children: artifact.title }),
|
|
2400
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-meta", children: ago(artifact.openedAt, now, t) })
|
|
2143
2401
|
] })
|
|
2144
2402
|
] })
|
|
2145
2403
|
] }),
|
|
2146
|
-
/* @__PURE__ */ (0,
|
|
2147
|
-
/* @__PURE__ */ (0,
|
|
2148
|
-
/* @__PURE__ */ (0,
|
|
2404
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-actions", children: [
|
|
2405
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MoreButton, { artifact, t, menuOpen, onMenu }),
|
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PinButton, { artifact, t, onPin })
|
|
2149
2407
|
] })
|
|
2150
2408
|
] });
|
|
2151
2409
|
}
|
|
2152
2410
|
function Row({ artifact, opening, conversation, now, t, onOpen, onPin, menuOpen, onMenu }) {
|
|
2153
2411
|
const busy = opening === artifact.id;
|
|
2154
|
-
return /* @__PURE__ */ (0,
|
|
2155
|
-
/* @__PURE__ */ (0,
|
|
2156
|
-
/* @__PURE__ */ (0,
|
|
2157
|
-
/* @__PURE__ */ (0,
|
|
2158
|
-
/* @__PURE__ */ (0,
|
|
2412
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("li", { className: "oa-item", "data-menu": menuOpen, style: typeStyle(artifact.type), children: [
|
|
2413
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("button", { type: "button", className: "oa-row", disabled: opening !== null, "aria-busy": busy, title: hint(artifact, conversation), onClick: () => onOpen(artifact), "data-type": artifact.type, children: [
|
|
2414
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-glyph", children: busy ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-spinner" }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeIcon, { type: artifact.type }) }),
|
|
2415
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-name", children: artifact.title }),
|
|
2416
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-meta", children: busy ? t("card.opening") : ago(artifact.openedAt, now, t) })
|
|
2159
2417
|
] }),
|
|
2160
|
-
/* @__PURE__ */ (0,
|
|
2161
|
-
artifact.shared && /* @__PURE__ */ (0,
|
|
2162
|
-
/* @__PURE__ */ (0,
|
|
2163
|
-
/* @__PURE__ */ (0,
|
|
2418
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-row-tools", children: [
|
|
2419
|
+
artifact.shared && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-shared", title: t("card.shared"), "aria-label": t("card.shared"), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.people }) }),
|
|
2420
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(PinButton, { artifact, t, onPin }),
|
|
2421
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(MoreButton, { artifact, t, menuOpen, onMenu, extra: "oa-act-more" })
|
|
2164
2422
|
] })
|
|
2165
2423
|
] });
|
|
2166
2424
|
}
|
|
@@ -2168,9 +2426,9 @@ window.__ModuleLoader__.load({
|
|
|
2168
2426
|
var PEEK_HIDE_MS = 160;
|
|
2169
2427
|
var PEEK_ABOUT_ID = "oa-peek-about";
|
|
2170
2428
|
function TilePeek({ tile, anchor, t, onAct, onEnter, onLeave, onClose }) {
|
|
2171
|
-
const ref = (0,
|
|
2172
|
-
const [place, setPlace] = (0,
|
|
2173
|
-
(0,
|
|
2429
|
+
const ref = (0, import_react7.useRef)(null);
|
|
2430
|
+
const [place, setPlace] = (0, import_react7.useState)({ visibility: "hidden" });
|
|
2431
|
+
(0, import_react7.useLayoutEffect)(() => {
|
|
2174
2432
|
const box = anchor.getBoundingClientRect();
|
|
2175
2433
|
const width = ref.current?.offsetWidth ?? 0;
|
|
2176
2434
|
const height = ref.current?.offsetHeight ?? 0;
|
|
@@ -2180,7 +2438,7 @@ window.__ModuleLoader__.load({
|
|
|
2180
2438
|
top: below + height <= window.innerHeight - 8 ? below : Math.max(8, box.top - 8 - height)
|
|
2181
2439
|
});
|
|
2182
2440
|
}, [anchor]);
|
|
2183
|
-
(0,
|
|
2441
|
+
(0, import_react7.useEffect)(() => {
|
|
2184
2442
|
const gone = () => onClose();
|
|
2185
2443
|
window.addEventListener("scroll", gone, true);
|
|
2186
2444
|
window.addEventListener("resize", gone);
|
|
@@ -2190,7 +2448,7 @@ window.__ModuleLoader__.load({
|
|
|
2190
2448
|
};
|
|
2191
2449
|
}, [onClose]);
|
|
2192
2450
|
const label = typeLabel(t, tile.id, tile.title);
|
|
2193
|
-
return /* @__PURE__ */ (0,
|
|
2451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2194
2452
|
"div",
|
|
2195
2453
|
{
|
|
2196
2454
|
ref,
|
|
@@ -2209,10 +2467,10 @@ window.__ModuleLoader__.load({
|
|
|
2209
2467
|
}
|
|
2210
2468
|
},
|
|
2211
2469
|
children: [
|
|
2212
|
-
/* @__PURE__ */ (0,
|
|
2213
|
-
/* @__PURE__ */ (0,
|
|
2214
|
-
/* @__PURE__ */ (0,
|
|
2215
|
-
/* @__PURE__ */ (0,
|
|
2470
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-peek-title", children: label }),
|
|
2471
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-peek-by", children: t("peek.by") }),
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "oa-peek-about", id: PEEK_ABOUT_ID, children: typeAbout(t, tile.id, tile.description) }),
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-peek-act", onClick: onAct, children: t("peek.start") })
|
|
2216
2474
|
]
|
|
2217
2475
|
}
|
|
2218
2476
|
);
|
|
@@ -2230,14 +2488,15 @@ window.__ModuleLoader__.load({
|
|
|
2230
2488
|
const layout = usePage((s) => s.layout);
|
|
2231
2489
|
const dialog = usePage((s) => s.dialog);
|
|
2232
2490
|
const { reload, watchEvents, watchThumbnails, setFilters, setQuery, setLayout, openDialog, closeDialog, open, create, pin, rename, copyLink, share, remove } = usePage((s) => s);
|
|
2233
|
-
const [peek, setPeek] = (0,
|
|
2234
|
-
const peekTimer = (0,
|
|
2235
|
-
const overPeek = (0,
|
|
2236
|
-
const [searching, setSearching] = (0,
|
|
2237
|
-
const [popup, setPopup] = (0,
|
|
2238
|
-
const searchBox = (0,
|
|
2491
|
+
const [peek, setPeek] = (0, import_react7.useState)(null);
|
|
2492
|
+
const peekTimer = (0, import_react7.useRef)(void 0);
|
|
2493
|
+
const overPeek = (0, import_react7.useRef)(false);
|
|
2494
|
+
const [searching, setSearching] = (0, import_react7.useState)(false);
|
|
2495
|
+
const [popup, setPopup] = (0, import_react7.useState)(null);
|
|
2496
|
+
const searchBox = (0, import_react7.useRef)(null);
|
|
2239
2497
|
const now = useNow();
|
|
2240
|
-
|
|
2498
|
+
const changelogOpen = useChangelog().open;
|
|
2499
|
+
(0, import_react7.useEffect)(() => {
|
|
2241
2500
|
void reload();
|
|
2242
2501
|
const again = () => {
|
|
2243
2502
|
if (document.visibilityState === "visible") void reload();
|
|
@@ -2245,21 +2504,21 @@ window.__ModuleLoader__.load({
|
|
|
2245
2504
|
document.addEventListener("visibilitychange", again);
|
|
2246
2505
|
return () => document.removeEventListener("visibilitychange", again);
|
|
2247
2506
|
}, [reload]);
|
|
2248
|
-
(0,
|
|
2249
|
-
(0,
|
|
2250
|
-
(0,
|
|
2507
|
+
(0, import_react7.useEffect)(() => watchEvents(), [watchEvents]);
|
|
2508
|
+
(0, import_react7.useEffect)(() => watchThumbnails(), [watchThumbnails]);
|
|
2509
|
+
(0, import_react7.useEffect)(() => {
|
|
2251
2510
|
if (searching) searchBox.current?.focus();
|
|
2252
2511
|
}, [searching]);
|
|
2253
|
-
const counts = (0,
|
|
2254
|
-
const tiles = (0,
|
|
2255
|
-
const filterTypes = (0,
|
|
2512
|
+
const counts = (0, import_react7.useMemo)(() => countByType(artifacts), [artifacts]);
|
|
2513
|
+
const tiles = (0, import_react7.useMemo)(() => inTypeOrder(types.map((type) => type.id)).map((id) => types.find((type) => type.id === id)), [types]);
|
|
2514
|
+
const filterTypes = (0, import_react7.useMemo)(
|
|
2256
2515
|
() => inTypeOrder([...types.map((type) => type.id), ...counts.keys()]).map((id) => ({
|
|
2257
2516
|
id,
|
|
2258
2517
|
title: types.find((type) => type.id === id)?.title || artifacts.find((a) => a.type === id)?.typeTitle || id
|
|
2259
2518
|
})),
|
|
2260
2519
|
[types, counts, artifacts]
|
|
2261
2520
|
);
|
|
2262
|
-
const closePeek = (0,
|
|
2521
|
+
const closePeek = (0, import_react7.useMemo)(
|
|
2263
2522
|
() => () => {
|
|
2264
2523
|
clearTimeout(peekTimer.current);
|
|
2265
2524
|
overPeek.current = false;
|
|
@@ -2267,7 +2526,7 @@ window.__ModuleLoader__.load({
|
|
|
2267
2526
|
},
|
|
2268
2527
|
[]
|
|
2269
2528
|
);
|
|
2270
|
-
(0,
|
|
2529
|
+
(0, import_react7.useEffect)(() => () => clearTimeout(peekTimer.current), []);
|
|
2271
2530
|
const showPeek = (id, anchor, at_once = false) => {
|
|
2272
2531
|
clearTimeout(peekTimer.current);
|
|
2273
2532
|
peekTimer.current = setTimeout(() => setPeek({ id, anchor }), at_once || peek !== null ? 0 : PEEK_SHOW_MS);
|
|
@@ -2280,11 +2539,11 @@ window.__ModuleLoader__.load({
|
|
|
2280
2539
|
closePeek();
|
|
2281
2540
|
create(id);
|
|
2282
2541
|
};
|
|
2283
|
-
const shown = (0,
|
|
2542
|
+
const shown = (0, import_react7.useMemo)(
|
|
2284
2543
|
() => visibleArtifacts(artifacts, { filters, query, now, locale: t("time.locale"), sessionTitle }),
|
|
2285
2544
|
[artifacts, filters, query, now, t, sessionTitle]
|
|
2286
2545
|
);
|
|
2287
|
-
const closePopup = (0,
|
|
2546
|
+
const closePopup = (0, import_react7.useMemo)(() => () => setPopup(null), []);
|
|
2288
2547
|
const actionsFor = popup?.kind === "actions" ? artifacts.find((a) => a.id === popup.id) : void 0;
|
|
2289
2548
|
const dialogFor = dialog ? artifacts.find((a) => a.id === dialog.id) : void 0;
|
|
2290
2549
|
const peekTile = peek === null ? void 0 : tiles.find((tile) => tile.id === peek.id);
|
|
@@ -2300,14 +2559,14 @@ window.__ModuleLoader__.load({
|
|
|
2300
2559
|
onMenu: (a, anchor) => setPopup((p) => p?.kind === "actions" && p.id === a.id ? null : { kind: "actions", anchor, id: a.id })
|
|
2301
2560
|
});
|
|
2302
2561
|
const toggle = (kind, anchor) => setPopup((p) => p?.kind === kind ? null : { kind, anchor });
|
|
2303
|
-
return /* @__PURE__ */ (0,
|
|
2304
|
-
/* @__PURE__ */ (0,
|
|
2305
|
-
/* @__PURE__ */ (0,
|
|
2306
|
-
/* @__PURE__ */ (0,
|
|
2307
|
-
/* @__PURE__ */ (0,
|
|
2308
|
-
searching || query ? /* @__PURE__ */ (0,
|
|
2309
|
-
/* @__PURE__ */ (0,
|
|
2310
|
-
/* @__PURE__ */ (0,
|
|
2562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: "oa-page", "aria-label": t("title"), "data-testid": "open-artifact-page", children: [
|
|
2563
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-scroll", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-content", children: [
|
|
2564
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-heading", children: [
|
|
2565
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h1", { children: t("title") }),
|
|
2566
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-tools", children: [
|
|
2567
|
+
searching || query ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: "oa-search", children: [
|
|
2568
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.search, size: 14 }),
|
|
2569
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2311
2570
|
"input",
|
|
2312
2571
|
{
|
|
2313
2572
|
ref: searchBox,
|
|
@@ -2327,7 +2586,7 @@ window.__ModuleLoader__.load({
|
|
|
2327
2586
|
}
|
|
2328
2587
|
}
|
|
2329
2588
|
),
|
|
2330
|
-
query && /* @__PURE__ */ (0,
|
|
2589
|
+
query && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2331
2590
|
"button",
|
|
2332
2591
|
{
|
|
2333
2592
|
type: "button",
|
|
@@ -2336,12 +2595,12 @@ window.__ModuleLoader__.load({
|
|
|
2336
2595
|
setQuery("");
|
|
2337
2596
|
searchBox.current?.focus();
|
|
2338
2597
|
},
|
|
2339
|
-
children: /* @__PURE__ */ (0,
|
|
2598
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.clear, size: 12 })
|
|
2340
2599
|
}
|
|
2341
2600
|
)
|
|
2342
|
-
] }) : /* @__PURE__ */ (0,
|
|
2343
|
-
/* @__PURE__ */ (0,
|
|
2344
|
-
/* @__PURE__ */ (0,
|
|
2601
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-tool", "aria-label": t("search"), title: t("search"), onClick: () => setSearching(true), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.search, size: 18 }) }),
|
|
2602
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-tool", "aria-label": t("filter.button"), title: t("filter.button"), "aria-haspopup": "menu", "aria-expanded": popup?.kind === "filter", "data-active": isFiltered(filters), onClick: (e) => toggle("filter", e.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.filter, size: 18 }) }),
|
|
2603
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2345
2604
|
"button",
|
|
2346
2605
|
{
|
|
2347
2606
|
type: "button",
|
|
@@ -2349,18 +2608,19 @@ window.__ModuleLoader__.load({
|
|
|
2349
2608
|
"aria-label": t(layout === "grid" ? "view.list" : "view.grid"),
|
|
2350
2609
|
title: t(layout === "grid" ? "view.list" : "view.grid"),
|
|
2351
2610
|
onClick: () => setLayout(layout === "grid" ? "list" : "grid"),
|
|
2352
|
-
children: /* @__PURE__ */ (0,
|
|
2611
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: layout === "grid" ? ICON.list : ICON.grid, size: 18 })
|
|
2353
2612
|
}
|
|
2354
2613
|
),
|
|
2355
|
-
canCreate && /* @__PURE__ */ (0,
|
|
2614
|
+
canCreate && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-tool", "aria-label": t("create.new"), title: t("create.new"), "aria-haspopup": "menu", "aria-expanded": popup?.kind === "create", onClick: (e) => toggle("create", e.currentTarget), children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { d: ICON.plus, size: 18 }) })
|
|
2356
2615
|
] })
|
|
2357
2616
|
] }),
|
|
2358
|
-
/* @__PURE__ */ (0,
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
/* @__PURE__ */ (0,
|
|
2617
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(UpdatePanel, {}),
|
|
2618
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(WhatsNewPanel, {}),
|
|
2619
|
+
canCreate && tiles.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
2620
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { className: "oa-section-title", children: t("create.heading") }),
|
|
2621
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "oa-tiles", children: tiles.map((tile) => {
|
|
2362
2622
|
const peeking = peek?.id === tile.id;
|
|
2363
|
-
return /* @__PURE__ */ (0,
|
|
2623
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { onPointerEnter: (event) => event.pointerType !== "touch" && showPeek(tile.id, event.currentTarget.firstElementChild), onPointerLeave: hidePeek, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
2364
2624
|
"button",
|
|
2365
2625
|
{
|
|
2366
2626
|
type: "button",
|
|
@@ -2379,17 +2639,17 @@ window.__ModuleLoader__.load({
|
|
|
2379
2639
|
if (event.key === "Escape" && peek !== null) closePeek();
|
|
2380
2640
|
},
|
|
2381
2641
|
children: [
|
|
2382
|
-
/* @__PURE__ */ (0,
|
|
2383
|
-
/* @__PURE__ */ (0,
|
|
2384
|
-
/* @__PURE__ */ (0,
|
|
2385
|
-
BETA.includes(tile.id) && /* @__PURE__ */ (0,
|
|
2642
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "oa-tile-art", children: [
|
|
2643
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Doodle, { type: tile.id }),
|
|
2644
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TypeIcon, { type: tile.id, size: 42 }),
|
|
2645
|
+
BETA.includes(tile.id) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-tile-beta", children: t("tile.beta") })
|
|
2386
2646
|
] }),
|
|
2387
|
-
/* @__PURE__ */ (0,
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "oa-tile-label", children: typeLabel(t, tile.id, tile.title) })
|
|
2388
2648
|
]
|
|
2389
2649
|
}
|
|
2390
2650
|
) }, tile.id);
|
|
2391
2651
|
}) }),
|
|
2392
|
-
peek !== null && peekTile !== void 0 && popup === null && /* @__PURE__ */ (0,
|
|
2652
|
+
peek !== null && peekTile !== void 0 && popup === null && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2393
2653
|
TilePeek,
|
|
2394
2654
|
{
|
|
2395
2655
|
tile: peekTile,
|
|
@@ -2408,23 +2668,24 @@ window.__ModuleLoader__.load({
|
|
|
2408
2668
|
}
|
|
2409
2669
|
)
|
|
2410
2670
|
] }),
|
|
2411
|
-
status === "loading" && artifacts.length === 0 ? /* @__PURE__ */ (0,
|
|
2412
|
-
/* @__PURE__ */ (0,
|
|
2413
|
-
/* @__PURE__ */ (0,
|
|
2414
|
-
] }) }, i)) }) : status === "error" && artifacts.length === 0 ? /* @__PURE__ */ (0,
|
|
2415
|
-
/* @__PURE__ */ (0,
|
|
2416
|
-
/* @__PURE__ */ (0,
|
|
2417
|
-
] }) : artifacts.length === 0 ? /* @__PURE__ */ (0,
|
|
2418
|
-
/* @__PURE__ */ (0,
|
|
2419
|
-
/* @__PURE__ */ (0,
|
|
2420
|
-
/* @__PURE__ */ (0,
|
|
2421
|
-
] }) : shown.length === 0 ? /* @__PURE__ */ (0,
|
|
2422
|
-
/* @__PURE__ */ (0,
|
|
2423
|
-
isFiltered(filters) && /* @__PURE__ */ (0,
|
|
2424
|
-
] }) : layout === "grid" ? /* @__PURE__ */ (0,
|
|
2671
|
+
status === "loading" && artifacts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "oa-grid oa-skeleton", "aria-hidden": "true", children: [0, 1, 2].map((i) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { className: "oa-item", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-card", children: [
|
|
2672
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-preview" }),
|
|
2673
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "oa-line" })
|
|
2674
|
+
] }) }, i)) }) : status === "error" && artifacts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-empty", role: "alert", children: [
|
|
2675
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: t("load.error", { message: error }) }),
|
|
2676
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-retry", onClick: () => void reload(), children: t("load.retry") })
|
|
2677
|
+
] }) : artifacts.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-empty", children: [
|
|
2678
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ArtifactsIcon, { size: 28 }),
|
|
2679
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h2", { children: t("empty.title") }),
|
|
2680
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: t("empty.body") })
|
|
2681
|
+
] }) : shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "oa-empty", children: [
|
|
2682
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { children: t("empty.noMatches") }),
|
|
2683
|
+
isFiltered(filters) && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { type: "button", className: "oa-retry", onClick: () => setFilters({ ...NO_FILTERS, sort: filters.sort }), children: t("filter.clear") })
|
|
2684
|
+
] }) : layout === "grid" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "oa-grid", children: shown.map((artifact) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Card, { ...itemProps(artifact) }, artifact.id)) }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "oa-list", children: shown.map((artifact) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Row, { ...itemProps(artifact) }, artifact.id)) }),
|
|
2685
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChangelogFooter, {})
|
|
2425
2686
|
] }) }),
|
|
2426
|
-
popup?.kind === "filter" && /* @__PURE__ */ (0,
|
|
2427
|
-
popup?.kind === "create" && /* @__PURE__ */ (0,
|
|
2687
|
+
popup?.kind === "filter" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FilterMenu, { anchor: popup.anchor, filters, setFilters: (next) => setFilters(next), types: filterTypes, counts, t, onClose: closePopup }),
|
|
2688
|
+
popup?.kind === "create" && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2428
2689
|
CreateMenu,
|
|
2429
2690
|
{
|
|
2430
2691
|
anchor: popup.anchor,
|
|
@@ -2438,7 +2699,7 @@ window.__ModuleLoader__.load({
|
|
|
2438
2699
|
}
|
|
2439
2700
|
}
|
|
2440
2701
|
),
|
|
2441
|
-
popup?.kind === "actions" && actionsFor && /* @__PURE__ */ (0,
|
|
2702
|
+
popup?.kind === "actions" && actionsFor && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2442
2703
|
ActionsMenu,
|
|
2443
2704
|
{
|
|
2444
2705
|
anchor: popup.anchor,
|
|
@@ -2454,7 +2715,7 @@ window.__ModuleLoader__.load({
|
|
|
2454
2715
|
}
|
|
2455
2716
|
}
|
|
2456
2717
|
),
|
|
2457
|
-
dialog?.kind === "rename" && dialogFor && /* @__PURE__ */ (0,
|
|
2718
|
+
dialog?.kind === "rename" && dialogFor && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2458
2719
|
RenameDialog,
|
|
2459
2720
|
{
|
|
2460
2721
|
artifact: dialogFor,
|
|
@@ -2466,7 +2727,7 @@ window.__ModuleLoader__.load({
|
|
|
2466
2727
|
}
|
|
2467
2728
|
}
|
|
2468
2729
|
),
|
|
2469
|
-
dialog?.kind === "delete" && dialogFor && /* @__PURE__ */ (0,
|
|
2730
|
+
dialog?.kind === "delete" && dialogFor && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
2470
2731
|
DeleteDialog,
|
|
2471
2732
|
{
|
|
2472
2733
|
artifact: dialogFor,
|
|
@@ -2478,17 +2739,18 @@ window.__ModuleLoader__.load({
|
|
|
2478
2739
|
}
|
|
2479
2740
|
}
|
|
2480
2741
|
),
|
|
2481
|
-
/* @__PURE__ */ (0,
|
|
2742
|
+
changelogOpen && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Dialog, { label: t("changelog.title"), onClose: closeChangelog, wide: true, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ChangelogView, {}) }),
|
|
2743
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ToastBar, {})
|
|
2482
2744
|
] });
|
|
2483
2745
|
}
|
|
2484
2746
|
|
|
2485
2747
|
// plugins/dsh/src/client/components/EventCards.tsx
|
|
2486
|
-
var
|
|
2487
|
-
var
|
|
2748
|
+
var import_react8 = require("react");
|
|
2749
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2488
2750
|
var iconStyle = { display: "block" };
|
|
2489
2751
|
var TITLE_MARK = "";
|
|
2490
2752
|
function CommentIcon() {
|
|
2491
|
-
return /* @__PURE__ */ (0,
|
|
2753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", style: iconStyle, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
2492
2754
|
"path",
|
|
2493
2755
|
{
|
|
2494
2756
|
d: "M3 3.5h10a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1H8.2L5.4 13.8a.3.3 0 0 1-.5-.23V11.5H3a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1Z",
|
|
@@ -2499,41 +2761,41 @@ window.__ModuleLoader__.load({
|
|
|
2499
2761
|
) });
|
|
2500
2762
|
}
|
|
2501
2763
|
function RequestIcon() {
|
|
2502
|
-
return /* @__PURE__ */ (0,
|
|
2503
|
-
/* @__PURE__ */ (0,
|
|
2504
|
-
/* @__PURE__ */ (0,
|
|
2764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("svg", { width: "14", height: "14", viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", style: iconStyle, children: [
|
|
2765
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("rect", { x: "2", y: "4", width: "12", height: "7", rx: "2", stroke: "currentColor", strokeWidth: "1.2" }),
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M8.5 8.5 11 14l.9-2.1L14 11l-5.5-2.5Z", fill: "currentColor", stroke: "var(--dsw-alias-markdown-code-block, #fff)", strokeWidth: "0.8", strokeLinejoin: "round" })
|
|
2505
2767
|
] });
|
|
2506
2768
|
}
|
|
2507
2769
|
function ChevronDown() {
|
|
2508
|
-
return /* @__PURE__ */ (0,
|
|
2770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", style: iconStyle, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M3 4.5 6 7.5l3-3", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2509
2771
|
}
|
|
2510
2772
|
function ChevronRight() {
|
|
2511
|
-
return /* @__PURE__ */ (0,
|
|
2773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", style: iconStyle, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("path", { d: "M4.5 3 7.5 6l-3 3", stroke: "currentColor", strokeWidth: "1.3", strokeLinecap: "round", strokeLinejoin: "round" }) });
|
|
2512
2774
|
}
|
|
2513
2775
|
function Heading({ text, title, parts }) {
|
|
2514
|
-
return /* @__PURE__ */ (0,
|
|
2515
|
-
/* @__PURE__ */ (0,
|
|
2516
|
-
/* @__PURE__ */ (0,
|
|
2517
|
-
/* @__PURE__ */ (0,
|
|
2518
|
-
] }) : /* @__PURE__ */ (0,
|
|
2776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "oac-head-text", title: text, children: parts.length === 2 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
|
|
2777
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: parts[0] }),
|
|
2778
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "oac-head-title", children: title }),
|
|
2779
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: parts[1] })
|
|
2780
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "oac-head-title", children: text }) });
|
|
2519
2781
|
}
|
|
2520
2782
|
function ThreadCard({ data, thread, t, openThread }) {
|
|
2521
|
-
const [open, setOpen] = (0,
|
|
2783
|
+
const [open, setOpen] = (0, import_react8.useState)(true);
|
|
2522
2784
|
const { title } = data;
|
|
2523
2785
|
const canView = data.viewUrl !== "" || data.artifactId !== "";
|
|
2524
2786
|
const meta = thread.where !== "" || canView;
|
|
2525
|
-
return /* @__PURE__ */ (0,
|
|
2526
|
-
/* @__PURE__ */ (0,
|
|
2527
|
-
/* @__PURE__ */ (0,
|
|
2528
|
-
/* @__PURE__ */ (0,
|
|
2529
|
-
meta && /* @__PURE__ */ (0,
|
|
2787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "oac-card", "data-comment-id": thread.id, children: [
|
|
2788
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "oac-head", children: [
|
|
2789
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CommentIcon, {}),
|
|
2790
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Heading, { text: t("card.comment", { title }), title, parts: t("card.comment", { title: TITLE_MARK }).split(TITLE_MARK) }),
|
|
2791
|
+
meta && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { type: "button", className: "oac-toggle", "aria-expanded": open, "aria-label": t(open ? "card.less" : "card.more"), onClick: () => setOpen(!open), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronDown, {}) })
|
|
2530
2792
|
] }),
|
|
2531
|
-
/* @__PURE__ */ (0,
|
|
2532
|
-
meta && open && /* @__PURE__ */ (0,
|
|
2533
|
-
thread.where && /* @__PURE__ */ (0,
|
|
2534
|
-
canView && /* @__PURE__ */ (0,
|
|
2793
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "oac-body", children: thread.text }),
|
|
2794
|
+
meta && open && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "oac-meta", children: [
|
|
2795
|
+
thread.where && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "oac-where", children: thread.where }),
|
|
2796
|
+
canView && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("button", { type: "button", className: "oac-view", onClick: () => openThread(data, thread.id), children: [
|
|
2535
2797
|
t("card.view"),
|
|
2536
|
-
/* @__PURE__ */ (0,
|
|
2798
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ChevronRight, {})
|
|
2537
2799
|
] })
|
|
2538
2800
|
] })
|
|
2539
2801
|
] });
|
|
@@ -2542,19 +2804,19 @@ window.__ModuleLoader__.load({
|
|
|
2542
2804
|
const message = isShellMessage(request);
|
|
2543
2805
|
const label = request.label || t("card.requestLabel");
|
|
2544
2806
|
const key = message ? "card.message" : "card.request";
|
|
2545
|
-
return /* @__PURE__ */ (0,
|
|
2546
|
-
/* @__PURE__ */ (0,
|
|
2547
|
-
message ? /* @__PURE__ */ (0,
|
|
2548
|
-
/* @__PURE__ */ (0,
|
|
2807
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "oac-card", "data-request-id": request.id, children: [
|
|
2808
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "oac-head", children: [
|
|
2809
|
+
message ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CommentIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RequestIcon, {}),
|
|
2810
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Heading, { text: t(key, { title, label }), title, parts: t(key, { title: TITLE_MARK, label }).split(TITLE_MARK) })
|
|
2549
2811
|
] }),
|
|
2550
|
-
/* @__PURE__ */ (0,
|
|
2812
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "oac-body", children: request.text })
|
|
2551
2813
|
] });
|
|
2552
2814
|
}
|
|
2553
2815
|
function EventCards({ node, t, openThread }) {
|
|
2554
2816
|
const data = node.data;
|
|
2555
|
-
return /* @__PURE__ */ (0,
|
|
2556
|
-
data.threads.map((thread) => /* @__PURE__ */ (0,
|
|
2557
|
-
data.requests.map((request) => /* @__PURE__ */ (0,
|
|
2817
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "oac-row", children: [
|
|
2818
|
+
data.threads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ThreadCard, { data, thread, t, openThread }, thread.id)),
|
|
2819
|
+
data.requests.map((request) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(RequestCard, { title: data.title, request, t }, request.id))
|
|
2558
2820
|
] });
|
|
2559
2821
|
}
|
|
2560
2822
|
|
|
@@ -2640,8 +2902,8 @@ window.__ModuleLoader__.load({
|
|
|
2640
2902
|
if (await openInSidebar(sidebar, request.session, request.url, 0)) return true;
|
|
2641
2903
|
const workspace = service(ctx, "uiWorkspace");
|
|
2642
2904
|
if (typeof workspace?.openSession !== "function") return false;
|
|
2643
|
-
const
|
|
2644
|
-
if (
|
|
2905
|
+
const state2 = linkState(request.session, snapshot(ctx, "sessions"), snapshot(ctx, "workspaces"));
|
|
2906
|
+
if (state2 !== "available") return false;
|
|
2645
2907
|
workspace.openSession(request.session);
|
|
2646
2908
|
return openInSidebar(sidebar, request.session, request.url);
|
|
2647
2909
|
}
|
|
@@ -2844,7 +3106,7 @@ window.__ModuleLoader__.load({
|
|
|
2844
3106
|
}
|
|
2845
3107
|
|
|
2846
3108
|
// plugins/dsh/src/client/index.tsx
|
|
2847
|
-
var
|
|
3109
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2848
3110
|
var PLUGIN = "dsh-open-artifact";
|
|
2849
3111
|
var PANEL_ID = "open-artifact";
|
|
2850
3112
|
var NS2 = "open-artifact";
|
|
@@ -2862,7 +3124,7 @@ window.__ModuleLoader__.load({
|
|
|
2862
3124
|
function joinCards(ctx, t) {
|
|
2863
3125
|
const kind = `${PLUGIN}:event`;
|
|
2864
3126
|
ctx.uiConversation.events.register(cardDefinition(kind));
|
|
2865
|
-
const Cards = (props) => /* @__PURE__ */ (0,
|
|
3127
|
+
const Cards = (props) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EventCards, { node: props.node, openThread: props.openThread, t: props.t ? translator(props.t) : t });
|
|
2866
3128
|
ctx.slots.inject(
|
|
2867
3129
|
"conversation.chat.node",
|
|
2868
3130
|
() => ctx.slots.register(
|
|
@@ -2893,7 +3155,7 @@ window.__ModuleLoader__.load({
|
|
|
2893
3155
|
};
|
|
2894
3156
|
const Page = (props) => {
|
|
2895
3157
|
const env = { t: props.t ? translator(props.t) : t, api: httpApi, sessions: sessions() };
|
|
2896
|
-
return /* @__PURE__ */ (0,
|
|
3158
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(EnvProvider, { env, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StoreProvider, { store, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ArtifactsPage, { canCreate: host.canCreate() }) }) });
|
|
2897
3159
|
};
|
|
2898
3160
|
ctx.slots.inject("main", () => ctx.slots.register({ name: "main", key: PANEL_ID, locale: NS2, inject: () => ({}) }, Page));
|
|
2899
3161
|
ctx.slots.inject(
|
|
@@ -2905,7 +3167,7 @@ window.__ModuleLoader__.load({
|
|
|
2905
3167
|
);
|
|
2906
3168
|
}
|
|
2907
3169
|
function ArtifactsEntry({ size = 16 }) {
|
|
2908
|
-
return /* @__PURE__ */ (0,
|
|
3170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(UpdateMark, { wide: size <= 16, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ArtifactsIcon, { size }) });
|
|
2909
3171
|
}
|
|
2910
3172
|
function apply(ctx) {
|
|
2911
3173
|
ctx.effect(() => injectStyles(`${PLUGIN}/page.css`, PAGE_CSS), `${PLUGIN}: page styles`);
|