@soffits/dsh-card-board 0.10.1 → 0.12.0
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 +11 -0
- package/README.md +18 -5
- package/client.js +527 -128
- package/examples/boards/home/cards/countdown.json +9 -0
- package/index.js +2 -0
- package/locale/en.json +16 -1
- package/locale/fr.json +16 -1
- package/locale/zh.json +16 -1
- package/package.json +1 -1
- package/src/arrange-store.js +54 -0
- package/src/arrange.js +119 -0
- package/src/person-store.js +54 -0
- package/src/routes.js +31 -3
- package/src/schema.js +20 -3
- package/src/seen.js +7 -37
package/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* @soffits/dsh-card-board 0.
|
|
1
|
+
/* @soffits/dsh-card-board 0.12.0: built by scripts/build.mjs from src/client/. Do not edit. */
|
|
2
2
|
window.__ModuleLoader__.load({
|
|
3
3
|
id: "@soffits/dsh-card-board",
|
|
4
4
|
factory: (require) => {
|
|
@@ -29,7 +29,7 @@ __export(index_exports, {
|
|
|
29
29
|
inject: () => inject
|
|
30
30
|
});
|
|
31
31
|
module.exports = __toCommonJS(index_exports);
|
|
32
|
-
var
|
|
32
|
+
var import_react16 = require("react");
|
|
33
33
|
|
|
34
34
|
// src/client/look.js
|
|
35
35
|
var STYLE_ID = "dsh-card-board-style";
|
|
@@ -223,6 +223,25 @@ button.cb-cardOpen{border:0;background:transparent;padding:0;font:inherit;cursor
|
|
|
223
223
|
.cb-chips,.cb-summaryLine,.cb-summaryAside,.cb-cardHead,.cb-tabs,.cb-heading .cb-sub,.cb-rowMeta,.cb-rowActions,.cb-statLabel,.cb-strip,.cb-chart svg,.cb-legend,.cb-track b,.cb-more,.cb-doneBox,.cb-delta,.cb-when,.cb-progress small,.cb-bubble,.cb-page .uk-chip,.cb-page .uk-tile,.cb-page .uk-icon,.cb-page .uk-newDot,.cb-page .uk-justNow,.cb-page .uk-ringText small{-webkit-user-select:none;user-select:none}
|
|
224
224
|
.cb-cardHead h3{-webkit-user-select:text;user-select:text}
|
|
225
225
|
.cb-card svg,.cb-card img{-webkit-user-drag:none}
|
|
226
|
+
/* Arranging: a card's own place (drag, pin, move), and the cue on a card a producer has raised for now */
|
|
227
|
+
.cb-card{position:relative}
|
|
228
|
+
.cb-cardRaised{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dsw-alias-state-business-primary) 38%,transparent)}
|
|
229
|
+
.cb-raisedCue{flex:0 1 auto;min-width:0;display:inline-flex}
|
|
230
|
+
button.cb-cardMore{border:0;background:transparent;padding:0;font:inherit;cursor:pointer}
|
|
231
|
+
.cb-pinMark{flex:none;display:inline-flex;color:var(--dsw-alias-state-business-primary)}
|
|
232
|
+
.cb-cardMore.cb-open{background:var(--dsw-alias-interactive-bg-active,var(--dsw-alias-interactive-bg-hover));color:var(--dsw-alias-label-primary)}
|
|
233
|
+
.cb-cardMore:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
|
|
234
|
+
@media (hover:hover) and (pointer:fine){.cb-cardMore{cursor:grab;opacity:0;transition:opacity var(--ds-transition-duration,.2s) var(--ds-ease-in-out,ease)}.cb-cardMore:active{cursor:grabbing}.cb-card:hover .cb-cardMore,.cb-card:focus-within .cb-cardMore,.cb-cardMore.cb-open{opacity:1}}
|
|
235
|
+
@media (hover:none),(pointer:coarse){.cb-cardHead,.cb-cardHead h3{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}}
|
|
236
|
+
.cb-cardDragging{z-index:6;pointer-events:none;opacity:.94;cursor:grabbing;box-shadow:0 14px 36px color-mix(in srgb,var(--dsw-alias-label-primary) 22%,transparent),inset 0 0 0 .5px var(--dsw-alias-border-l3)}
|
|
237
|
+
.cb-card[data-drop]::after{content:"";position:absolute;z-index:5;pointer-events:none;border-radius:3px;background:var(--dsw-alias-state-business-primary);animation:cb-in var(--ds-transition-duration,.2s) var(--ds-ease-in-out,ease) both}
|
|
238
|
+
.cb-card[data-axis=x][data-drop=before]::after{left:-9px;top:6px;bottom:6px;width:3px}
|
|
239
|
+
.cb-card[data-axis=x][data-drop=after]::after{right:-9px;top:6px;bottom:6px;width:3px}
|
|
240
|
+
.cb-card[data-axis=y][data-drop=before]::after{top:-9px;left:6px;right:6px;height:3px}
|
|
241
|
+
.cb-card[data-axis=y][data-drop=after]::after{bottom:-9px;left:6px;right:6px;height:3px}
|
|
242
|
+
.cb-heading .cb-sub{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px}
|
|
243
|
+
.cb-reset{margin:-4px 0}
|
|
244
|
+
.cb-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
|
|
226
245
|
/* The point under the pointer on a chart */
|
|
227
246
|
.cb-chart{position:relative}
|
|
228
247
|
.cb-plot{touch-action:pan-y}
|
|
@@ -249,16 +268,92 @@ button.cb-cardOpen{border:0;background:transparent;padding:0;font:inherit;cursor
|
|
|
249
268
|
.cb-doneBox{min-width:40px;min-height:40px;margin:-6px -6px -6px -10px}
|
|
250
269
|
.cb-doneBox label{display:inline-flex;align-items:center;justify-content:center;min-width:40px;min-height:40px}
|
|
251
270
|
.cb-cardChat{margin:-9px -10px -9px 0}
|
|
271
|
+
.cb-reset{min-height:40px}
|
|
252
272
|
}
|
|
253
273
|
`;
|
|
254
274
|
|
|
255
275
|
// src/client/page.js
|
|
256
|
-
var
|
|
257
|
-
var
|
|
276
|
+
var import_react15 = require("react");
|
|
277
|
+
var import_dsh_client_ui_primitives5 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
278
|
+
|
|
279
|
+
// src/schema.js
|
|
280
|
+
var SIZES = Object.freeze(["small", "medium", "large", "wide"]);
|
|
281
|
+
var CARD_TYPES = Object.freeze(["summary", "countdown", "stat", "line", "bar", "donut", "list", "timeline", "status"]);
|
|
282
|
+
var TONES = Object.freeze(["ok", "warn", "bad", "muted", "accent", "violet"]);
|
|
283
|
+
var ACTION_KINDS = Object.freeze(["chat", "step", "done", "snooze", "event", "link"]);
|
|
284
|
+
var PRESS_KINDS = Object.freeze(["step", "done", "snooze", "event"]);
|
|
285
|
+
var INVERSE_KINDS = Object.freeze(["done", "snooze", "event"]);
|
|
286
|
+
var DIRECTIONS = Object.freeze(["up", "down", "flat"]);
|
|
287
|
+
var TIMELINE_KINDS = Object.freeze(["travel", "due", "event", "health", "home", "money"]);
|
|
288
|
+
var MAX_CARD_BYTES = 256 * 1024;
|
|
289
|
+
|
|
290
|
+
// src/arrange.js
|
|
291
|
+
function arranged(ids, arrangement) {
|
|
292
|
+
if (arrangement === void 0) return { pinned: [], order: [...ids] };
|
|
293
|
+
const present = new Set(ids);
|
|
294
|
+
const pinned = arrangement.pinned.filter((id) => present.has(id));
|
|
295
|
+
const taken = new Set(pinned);
|
|
296
|
+
const order = arrangement.order.filter((id) => present.has(id) && !taken.has(id));
|
|
297
|
+
const placed = new Set(order);
|
|
298
|
+
ids.forEach((id, i) => {
|
|
299
|
+
if (taken.has(id) || placed.has(id)) return;
|
|
300
|
+
let after = -1;
|
|
301
|
+
for (let before = i - 1; before >= 0 && after < 0; before--) after = order.indexOf(ids[before]);
|
|
302
|
+
order.splice(after + 1, 0, id);
|
|
303
|
+
});
|
|
304
|
+
return { pinned, order };
|
|
305
|
+
}
|
|
306
|
+
var sequenceOf = ({ pinned, order }) => [...pinned, ...order];
|
|
307
|
+
function visibleOrder(state, raised) {
|
|
308
|
+
const all = sequenceOf(state);
|
|
309
|
+
return [...all.filter((id) => raised.has(id)), ...all.filter((id) => !raised.has(id))];
|
|
310
|
+
}
|
|
311
|
+
function pinCard({ pinned, order }, id) {
|
|
312
|
+
return { pinned: [...pinned.filter((p) => p !== id), id], order: order.filter((o) => o !== id) };
|
|
313
|
+
}
|
|
314
|
+
function unpinCard({ pinned, order }, id) {
|
|
315
|
+
return { pinned: pinned.filter((p) => p !== id), order: [id, ...order.filter((o) => o !== id)] };
|
|
316
|
+
}
|
|
317
|
+
function shiftCard({ pinned, order }, id, delta) {
|
|
318
|
+
const shift = (list) => {
|
|
319
|
+
const from = list.indexOf(id);
|
|
320
|
+
const to = from + delta;
|
|
321
|
+
if (from < 0 || to < 0 || to >= list.length) return list;
|
|
322
|
+
const next = [...list];
|
|
323
|
+
next.splice(from, 1);
|
|
324
|
+
next.splice(to, 0, id);
|
|
325
|
+
return next;
|
|
326
|
+
};
|
|
327
|
+
return { pinned: shift(pinned), order: shift(order) };
|
|
328
|
+
}
|
|
329
|
+
function canShift({ pinned, order }, id, delta) {
|
|
330
|
+
const list = pinned.includes(id) ? pinned : order;
|
|
331
|
+
const to = list.indexOf(id) + delta;
|
|
332
|
+
return list.includes(id) && to >= 0 && to < list.length;
|
|
333
|
+
}
|
|
334
|
+
function dropCard(state, id, target, after) {
|
|
335
|
+
if (id === target) return state;
|
|
336
|
+
const wasPinned = state.pinned.includes(id);
|
|
337
|
+
const rest = sequenceOf(state).filter((card) => card !== id);
|
|
338
|
+
const pinsLeft = state.pinned.filter((card) => card !== id).length;
|
|
339
|
+
const at2 = rest.indexOf(target) + (after ? 1 : 0);
|
|
340
|
+
if (at2 < 0 || rest.indexOf(target) < 0) return state;
|
|
341
|
+
const next = [...rest.slice(0, at2), id, ...rest.slice(at2)];
|
|
342
|
+
const pinCount = at2 < pinsLeft ? pinsLeft + 1 : at2 > pinsLeft ? pinsLeft : pinsLeft + (wasPinned ? 1 : 0);
|
|
343
|
+
return { pinned: next.slice(0, pinCount), order: next.slice(pinCount) };
|
|
344
|
+
}
|
|
345
|
+
var at = (time, fallback) => time === void 0 ? fallback : Date.parse(time);
|
|
346
|
+
function isRaised(raise, now) {
|
|
347
|
+
return raise !== void 0 && at(raise.from, -Infinity) <= now && now < at(raise.until, Infinity);
|
|
348
|
+
}
|
|
349
|
+
function nextRaiseChange(raises, now) {
|
|
350
|
+
const times = raises.flatMap((raise) => [at(raise?.from, NaN), at(raise?.until, NaN)]).filter((time) => time > now);
|
|
351
|
+
return times.length > 0 ? Math.min(...times) : void 0;
|
|
352
|
+
}
|
|
258
353
|
|
|
259
354
|
// src/client/card.js
|
|
260
|
-
var
|
|
261
|
-
var
|
|
355
|
+
var import_react10 = require("react");
|
|
356
|
+
var import_dsh_client_ui_primitives3 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
262
357
|
|
|
263
358
|
// src/client/charts.js
|
|
264
359
|
var import_react4 = require("react");
|
|
@@ -373,12 +468,12 @@ var useButtons = () => (0, import_react3.useSyncExternalStore)(buttonsStore.subs
|
|
|
373
468
|
var PALETTE = ["accent", "ok", "warn", "violet", "bad", "muted"];
|
|
374
469
|
var toneColor = (tone, index = 0) => kitStore.get().toneColor(tone ?? PALETTE[index % PALETTE.length]);
|
|
375
470
|
function usePointer(pick) {
|
|
376
|
-
const [
|
|
471
|
+
const [at2, setAt] = (0, import_react4.useState)(null);
|
|
377
472
|
const fromEvent = (event) => {
|
|
378
473
|
const box = event.currentTarget.getBoundingClientRect();
|
|
379
474
|
return pick(event.clientX - box.left);
|
|
380
475
|
};
|
|
381
|
-
return [
|
|
476
|
+
return [at2, {
|
|
382
477
|
onPointerMove: (event) => setAt(fromEvent(event)),
|
|
383
478
|
onPointerDown: (event) => setAt(fromEvent(event)),
|
|
384
479
|
onPointerLeave: (event) => {
|
|
@@ -794,8 +889,8 @@ function onControl(event) {
|
|
|
794
889
|
}
|
|
795
890
|
|
|
796
891
|
// src/client/steps.js
|
|
797
|
-
function ownOffset(
|
|
798
|
-
const m = /(?:([+-])(\d{2}):?(\d{2})|Z)$/.exec(String(
|
|
892
|
+
function ownOffset(at2) {
|
|
893
|
+
const m = /(?:([+-])(\d{2}):?(\d{2})|Z)$/.exec(String(at2));
|
|
799
894
|
if (!m) return null;
|
|
800
895
|
return m[1] ? (m[1] === "-" ? -1 : 1) * (Number(m[2]) * 60 + Number(m[3])) : 0;
|
|
801
896
|
}
|
|
@@ -844,6 +939,11 @@ function shownRows(rows, open, limit, live) {
|
|
|
844
939
|
if (open || rows.length <= limit + 1) return rows;
|
|
845
940
|
return rows.filter((row, i) => i < limit || row.key !== void 0 && (live?.freshRows?.has(row.key) || live?.rows?.[row.key] > 0));
|
|
846
941
|
}
|
|
942
|
+
function dropAfter(rect, x, y, single) {
|
|
943
|
+
const across = (x - (rect.left + rect.width / 2)) / Math.max(1, rect.width);
|
|
944
|
+
const down = (y - (rect.top + rect.height / 2)) / Math.max(1, rect.height);
|
|
945
|
+
return single || Math.abs(down) > Math.abs(across) ? down > 0 : across > 0;
|
|
946
|
+
}
|
|
847
947
|
|
|
848
948
|
// src/client/ticks.js
|
|
849
949
|
var doneOf = (row) => row?.actions?.find((action) => action.kind === "done");
|
|
@@ -866,6 +966,15 @@ function doneState(row, latest) {
|
|
|
866
966
|
}
|
|
867
967
|
var withKept = (kept = [], entry) => [...kept.filter((other) => other.id !== entry.id), entry];
|
|
868
968
|
|
|
969
|
+
// src/client/ask.js
|
|
970
|
+
var MAX_ACTIONS = 6;
|
|
971
|
+
function rowButtons(row, cardAsk) {
|
|
972
|
+
const own = row.actions ?? [];
|
|
973
|
+
if (row.ask === false || cardAsk === false) return own;
|
|
974
|
+
if (own.some((action) => action.kind === "chat") || own.length >= MAX_ACTIONS) return own;
|
|
975
|
+
return [...own, { kind: "chat", id: "_ask" }];
|
|
976
|
+
}
|
|
977
|
+
|
|
869
978
|
// src/client/cards.js
|
|
870
979
|
var STATE_OF_TONE = { ok: "done", warn: "warning", bad: "error" };
|
|
871
980
|
var DIRECTION_ICON = { up: "trending-up", down: "trending-down" };
|
|
@@ -927,7 +1036,7 @@ function RowWhen({ row, locale, t }) {
|
|
|
927
1036
|
}
|
|
928
1037
|
return row.date ? (0, import_react6.createElement)("span", { className: "cb-when" }, (0, import_react6.createElement)(kit.RelativeDay, { date: row.date })) : null;
|
|
929
1038
|
}
|
|
930
|
-
function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fresh, rowActions, className, onOpenRow }) {
|
|
1039
|
+
function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fresh, rowActions, ask, className, onOpenRow }) {
|
|
931
1040
|
const kit = useKit();
|
|
932
1041
|
const now = kit.useNow();
|
|
933
1042
|
const wash = kit.useWash(washCount, row.key);
|
|
@@ -949,6 +1058,7 @@ function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fres
|
|
|
949
1058
|
}
|
|
950
1059
|
}
|
|
951
1060
|
};
|
|
1061
|
+
const buttons = rowActions && rowButtons(row, ask);
|
|
952
1062
|
return (0, import_react6.createElement)(
|
|
953
1063
|
"li",
|
|
954
1064
|
{ className: ["cb-row", className, isActive(row.active, now) && "cb-rowNow", go && "cb-rowOpens", wash].filter(Boolean).join(" "), ...opens },
|
|
@@ -963,11 +1073,11 @@ function Row({ lead, title, sub, meta, value, spark, row, index, washCount, fres
|
|
|
963
1073
|
meta,
|
|
964
1074
|
value,
|
|
965
1075
|
// The row's own buttons on the right: its steps first (a step starts the work on one tap), then the others.
|
|
966
|
-
|
|
1076
|
+
buttons?.length > 0 && (0, import_react6.createElement)(
|
|
967
1077
|
"span",
|
|
968
1078
|
{ className: "cb-rowActions" },
|
|
969
|
-
|
|
970
|
-
rowActions(index,
|
|
1079
|
+
buttons.some((action) => action.kind === "step") && rowActions(index, buttons, "steps"),
|
|
1080
|
+
rowActions(index, buttons, "buttons")
|
|
971
1081
|
)
|
|
972
1082
|
);
|
|
973
1083
|
}
|
|
@@ -990,7 +1100,7 @@ function DoneBox({ row, index, done, rowControls, t }) {
|
|
|
990
1100
|
);
|
|
991
1101
|
}
|
|
992
1102
|
var rowLive = (live, row) => ({ washCount: live.rows?.[row.key] ?? 0, fresh: row.key !== void 0 && live.freshRows.has(row.key) });
|
|
993
|
-
function ListCard({ data, live, locale, t, rowActions, all = false, onOpenRow, rowControls }) {
|
|
1103
|
+
function ListCard({ data, live, locale, t, rowActions, ask, all = false, onOpenRow, rowControls }) {
|
|
994
1104
|
const kit = useKit();
|
|
995
1105
|
const [open, setOpen] = (0, import_react6.useState)(false);
|
|
996
1106
|
const listed = keepTicked(data.rows, rowControls?.kept);
|
|
@@ -1025,6 +1135,7 @@ function ListCard({ data, live, locale, t, rowActions, all = false, onOpenRow, r
|
|
|
1025
1135
|
index: data.rows.indexOf(row),
|
|
1026
1136
|
row: doneOf(row) && rowControls ? { ...row, actions: row.actions.filter((a) => a.kind !== "done") } : row,
|
|
1027
1137
|
rowActions: data.rows.includes(row) ? rowActions : void 0,
|
|
1138
|
+
ask,
|
|
1028
1139
|
onOpenRow,
|
|
1029
1140
|
className: [i >= LIST_ROWS && "cb-rowLate", ticked(row) && "cb-done"].filter(Boolean).join(" ") || void 0,
|
|
1030
1141
|
...rowLive(live, row),
|
|
@@ -1048,13 +1159,14 @@ function ListCard({ data, live, locale, t, rowActions, all = false, onOpenRow, r
|
|
|
1048
1159
|
)
|
|
1049
1160
|
);
|
|
1050
1161
|
}
|
|
1051
|
-
function StatusCard({ data, live, locale, rowActions, onOpenRow }) {
|
|
1162
|
+
function StatusCard({ data, live, locale, rowActions, ask, onOpenRow }) {
|
|
1052
1163
|
const kit = useKit();
|
|
1053
1164
|
return (0, import_react6.createElement)("ul", { className: "cb-rows" }, data.rows.map((row, i) => (0, import_react6.createElement)(Row, {
|
|
1054
1165
|
key: row.key ?? i,
|
|
1055
1166
|
index: i,
|
|
1056
1167
|
row,
|
|
1057
1168
|
rowActions,
|
|
1169
|
+
ask,
|
|
1058
1170
|
onOpenRow,
|
|
1059
1171
|
...rowLive(live, row),
|
|
1060
1172
|
className: "cb-statusRow",
|
|
@@ -1256,12 +1368,53 @@ function DetailParts({ detail, locale, t }) {
|
|
|
1256
1368
|
);
|
|
1257
1369
|
}
|
|
1258
1370
|
|
|
1371
|
+
// src/client/arrange-ui.js
|
|
1372
|
+
var import_react9 = require("react");
|
|
1373
|
+
var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1374
|
+
function ArrangeControls({ t, arrange }) {
|
|
1375
|
+
const [open, setOpen] = (0, import_react9.useState)(false);
|
|
1376
|
+
const items = [
|
|
1377
|
+
{ id: "pin", label: t(arrange.pinned ? "arrange.unpin" : "arrange.pin"), icon: (0, import_react9.createElement)(import_dsh_client_ui_primitives2.IconPinOutlineRegular, { size: 14 }) },
|
|
1378
|
+
{ id: "up", label: t("arrange.up"), icon: (0, import_react9.createElement)(import_dsh_client_ui_primitives2.IconChevronUpOutlineRegular, { size: 14 }), disabled: !arrange.canUp },
|
|
1379
|
+
{ id: "down", label: t("arrange.down"), icon: (0, import_react9.createElement)(import_dsh_client_ui_primitives2.IconChevronDownOutlineRegular, { size: 14 }), disabled: !arrange.canDown }
|
|
1380
|
+
];
|
|
1381
|
+
const choose = (id) => {
|
|
1382
|
+
setOpen(false);
|
|
1383
|
+
if (id === "pin") arrange.onPin();
|
|
1384
|
+
else arrange.onMove(id === "up" ? -1 : 1);
|
|
1385
|
+
};
|
|
1386
|
+
const onKeyDown = (event) => {
|
|
1387
|
+
if (!event.altKey || event.key !== "ArrowUp" && event.key !== "ArrowDown") return;
|
|
1388
|
+
event.preventDefault();
|
|
1389
|
+
const delta = event.key === "ArrowUp" ? -1 : 1;
|
|
1390
|
+
if (delta < 0 ? arrange.canUp : arrange.canDown) arrange.onMove(delta);
|
|
1391
|
+
};
|
|
1392
|
+
const onPointerDown = (event) => {
|
|
1393
|
+
if (event.pointerType === "mouse") arrange.onGrip(event);
|
|
1394
|
+
};
|
|
1395
|
+
return [
|
|
1396
|
+
arrange.pinned && (0, import_react9.createElement)("span", { key: "pin", className: "cb-pinMark", role: "img", title: t("arrange.pinned"), "aria-label": t("arrange.pinned") }, (0, import_react9.createElement)(import_dsh_client_ui_primitives2.IconPinFillRegular, { size: 14 })),
|
|
1397
|
+
(0, import_react9.createElement)(import_dsh_client_ui_primitives2.Menu, {
|
|
1398
|
+
key: "menu",
|
|
1399
|
+
open,
|
|
1400
|
+
onClose: () => setOpen(false),
|
|
1401
|
+
onSelect: choose,
|
|
1402
|
+
items,
|
|
1403
|
+
align: "end",
|
|
1404
|
+
portal: true,
|
|
1405
|
+
compact: true,
|
|
1406
|
+
className: "cb-cardMenu",
|
|
1407
|
+
anchor: (0, import_react9.createElement)("button", { type: "button", className: `cb-cardLink cb-cardMore${open ? " cb-open" : ""}`, title: t("arrange.menu"), "aria-label": t("arrange.menu"), "aria-haspopup": "menu", "aria-expanded": open, onPointerDown, onClick: () => setOpen((value) => !value), onKeyDown }, (0, import_react9.createElement)(import_dsh_client_ui_primitives2.IconDragHandleOutlineRegular, { size: 14 }))
|
|
1408
|
+
})
|
|
1409
|
+
];
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1259
1412
|
// src/client/card.js
|
|
1260
1413
|
var CHART_HEIGHT = 150;
|
|
1261
1414
|
function useRowSpan() {
|
|
1262
|
-
const ref = (0,
|
|
1263
|
-
const [rows, setRows] = (0,
|
|
1264
|
-
(0,
|
|
1415
|
+
const ref = (0, import_react10.useRef)(null);
|
|
1416
|
+
const [rows, setRows] = (0, import_react10.useState)(0);
|
|
1417
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
1265
1418
|
const el = ref.current;
|
|
1266
1419
|
if (!el || typeof ResizeObserver === "undefined") return void 0;
|
|
1267
1420
|
const measure = () => setRows(Math.ceil((el.getBoundingClientRect().height + GAP) / ROW));
|
|
@@ -1285,34 +1438,39 @@ function Body({ card, live, wash, locale, t, rowActions, all, onOpenRow, rowCont
|
|
|
1285
1438
|
const data = card.data;
|
|
1286
1439
|
switch (card.type) {
|
|
1287
1440
|
case "stat":
|
|
1288
|
-
return (0,
|
|
1441
|
+
return (0, import_react10.createElement)(StatBlock, { data, locale, wash });
|
|
1289
1442
|
case "list":
|
|
1290
|
-
return (0,
|
|
1443
|
+
return (0, import_react10.createElement)(ListCard, { data, live, locale, t, rowActions, ask: card.ask, all, onOpenRow, rowControls });
|
|
1291
1444
|
case "status":
|
|
1292
|
-
return (0,
|
|
1445
|
+
return (0, import_react10.createElement)(StatusCard, { data, live, locale, rowActions, ask: card.ask, onOpenRow });
|
|
1293
1446
|
case "countdown":
|
|
1294
|
-
return (0,
|
|
1447
|
+
return (0, import_react10.createElement)(CountdownBody, { card, locale });
|
|
1295
1448
|
default: {
|
|
1296
1449
|
const Chart = CHARTS2[card.type];
|
|
1297
1450
|
if (Chart === void 0) return null;
|
|
1298
|
-
return (0,
|
|
1451
|
+
return (0, import_react10.createElement)(Chart, { data, locale, height: all ? card.type === "donut" ? 200 : 240 : card.type === "bar" ? 130 : card.type === "donut" ? 160 : CHART_HEIGHT });
|
|
1299
1452
|
}
|
|
1300
1453
|
}
|
|
1301
1454
|
}
|
|
1302
|
-
function Card({ entry, live, boardId, assistant, tracks, active, locale, t, press, undo, kept, onOpen, sheet = false, row: openRow }) {
|
|
1455
|
+
function Card({ entry, live, boardId, assistant, tracks, active, locale, t, press, undo, kept, onOpen, sheet = false, row: openRow, arrange, raised = false, dragging = null, drop }) {
|
|
1303
1456
|
const kit = useKit();
|
|
1304
1457
|
const actions = useButtons();
|
|
1305
1458
|
const now = kit.useNow();
|
|
1306
1459
|
const wash = kit.useWash(live.wash, entry.id);
|
|
1307
1460
|
const [ref, rows] = useRowSpan();
|
|
1308
|
-
const style = sheet ? void 0 : {
|
|
1461
|
+
const style = sheet ? void 0 : {
|
|
1462
|
+
gridColumn: `span ${spanOf(entry.card?.type, entry.size, tracks)}`,
|
|
1463
|
+
gridRowEnd: rows > 0 ? `span ${rows}` : void 0,
|
|
1464
|
+
...dragging ? { transform: `translate(${dragging.dx}px, ${dragging.dy}px) scale(1.015)`, transition: "box-shadow var(--ds-transition-duration,.2s) var(--ds-ease-in-out,ease)" } : {}
|
|
1465
|
+
};
|
|
1466
|
+
const placing = { "data-card": sheet ? void 0 : entry.id, "data-drop": drop, "data-axis": tracks === 1 ? "y" : "x" };
|
|
1309
1467
|
if (!entry.card) {
|
|
1310
|
-
return (0,
|
|
1468
|
+
return (0, import_react10.createElement)(
|
|
1311
1469
|
"section",
|
|
1312
|
-
{ ref, className:
|
|
1313
|
-
(0,
|
|
1314
|
-
(0,
|
|
1315
|
-
(0,
|
|
1470
|
+
{ ref, className: `cb-card cb-cardError${dragging ? " cb-cardDragging" : ""}`, style, ...placing },
|
|
1471
|
+
(0, import_react10.createElement)("header", { className: "cb-cardHead" }, (0, import_react10.createElement)("h3", { title: entry.id }, entry.id)),
|
|
1472
|
+
(0, import_react10.createElement)("p", { className: "cb-errorText" }, t("cardError")),
|
|
1473
|
+
(0, import_react10.createElement)("ul", { className: "cb-problems" }, (entry.problems ?? []).map((p, i) => (0, import_react10.createElement)("li", { key: i }, p)))
|
|
1316
1474
|
);
|
|
1317
1475
|
}
|
|
1318
1476
|
const card = pickCard(entry.card, active);
|
|
@@ -1331,7 +1489,7 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1331
1489
|
const askName = assistant ? t("action.chatNamed", { name: assistant }) : void 0;
|
|
1332
1490
|
const named = (list) => assistant ? list?.map((action) => action.kind === "chat" && action.label === void 0 ? { ...action, label: askName } : action) : list;
|
|
1333
1491
|
const onPress = (target) => (action, extra) => press(action, extra, { card: entry.id, ...target }, target.row === void 0 ? void 0 : card.data.rows?.[target.row]);
|
|
1334
|
-
const rowActions = actions && ((row, list, part2) => (0,
|
|
1492
|
+
const rowActions = actions && ((row, list, part2) => (0, import_react10.createElement)(actions.ActionBar, {
|
|
1335
1493
|
actions: named(list),
|
|
1336
1494
|
part: part2,
|
|
1337
1495
|
states: statesOf(entry.presses, row),
|
|
@@ -1346,10 +1504,10 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1346
1504
|
kept,
|
|
1347
1505
|
undo: (pressId) => undo(pressId, entry.id)
|
|
1348
1506
|
};
|
|
1349
|
-
const chat = actions && (0,
|
|
1507
|
+
const chat = actions && (0, import_react10.createElement)("span", { className: "cb-cardChat" }, (0, import_react10.createElement)(actions.ActionButton, { action: { kind: "chat", id: "_chat", label: askName }, compact: true, about: about() }));
|
|
1350
1508
|
const others = card.actions?.filter((action) => action.kind !== "step") ?? [];
|
|
1351
|
-
const steps = card.actions?.some((action) => action.kind === "step") && (0,
|
|
1352
|
-
const footer = actions && others.length > 0 && (0,
|
|
1509
|
+
const steps = card.actions?.some((action) => action.kind === "step") && (0, import_react10.createElement)(kit.Suggested, { actions: card.actions, about: about(), states: statesOf(entry.presses, void 0), onPress: onPress({}) });
|
|
1510
|
+
const footer = actions && others.length > 0 && (0, import_react10.createElement)("footer", { className: "cb-cardActions" }, (0, import_react10.createElement)(actions.ActionBar, {
|
|
1353
1511
|
actions: named(others),
|
|
1354
1512
|
part: "buttons",
|
|
1355
1513
|
states: statesOf(entry.presses, void 0),
|
|
@@ -1357,7 +1515,7 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1357
1515
|
onPress: onPress({})
|
|
1358
1516
|
}));
|
|
1359
1517
|
const openable = !sheet && onOpen && card.type !== "summary";
|
|
1360
|
-
const className = ["cb-card", `cb-card-${card.type}`, stale && "cb-cardStale", openable && "cb-cardOpenable", sheet && "cb-cardInSheet", wash].filter(Boolean).join(" ");
|
|
1518
|
+
const className = ["cb-card", `cb-card-${card.type}`, stale && "cb-cardStale", openable && "cb-cardOpenable", sheet && "cb-cardInSheet", raised && "cb-cardRaised", dragging && "cb-cardDragging", wash].filter(Boolean).join(" ");
|
|
1361
1519
|
const openOnTap = openable ? { onClick: (event) => {
|
|
1362
1520
|
if (!onControl(event) && !event.target.closest?.("[data-opens]") && !window.getSelection?.()?.toString()) onOpen();
|
|
1363
1521
|
} } : {};
|
|
@@ -1365,11 +1523,11 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1365
1523
|
if (sheet && openRow !== void 0) {
|
|
1366
1524
|
const index = card.data.rows?.findIndex((r) => r.key === openRow) ?? -1;
|
|
1367
1525
|
const target = index >= 0 ? card.data.rows[index] : null;
|
|
1368
|
-
if (!target) return (0,
|
|
1369
|
-
return (0,
|
|
1526
|
+
if (!target) return (0, import_react10.createElement)("p", { className: "cb-muted" }, t("rowGone"));
|
|
1527
|
+
return (0, import_react10.createElement)(
|
|
1370
1528
|
"div",
|
|
1371
1529
|
{ className: "cb-rowSheet" },
|
|
1372
|
-
(0,
|
|
1530
|
+
(0, import_react10.createElement)(Body, {
|
|
1373
1531
|
card: { ...card, data: { ...card.data, rows: [target], progress: void 0 } },
|
|
1374
1532
|
live,
|
|
1375
1533
|
wash: false,
|
|
@@ -1379,46 +1537,214 @@ function Card({ entry, live, boardId, assistant, tracks, active, locale, t, pres
|
|
|
1379
1537
|
all: true,
|
|
1380
1538
|
rowControls: { ...rowControls, kept: [], press: (_, action) => rowControls.press(index, action), state: (_, id) => rowControls.state(index, id), latest: (_, id) => rowControls.latest(index, id) }
|
|
1381
1539
|
}),
|
|
1382
|
-
(0,
|
|
1540
|
+
(0, import_react10.createElement)(DetailParts, { detail: target.detail, locale, t })
|
|
1383
1541
|
);
|
|
1384
1542
|
}
|
|
1385
1543
|
if (card.type === "summary") {
|
|
1386
|
-
return (0,
|
|
1544
|
+
return (0, import_react10.createElement)(
|
|
1387
1545
|
"section",
|
|
1388
|
-
{ ref, className, style, "data-type": card.type },
|
|
1389
|
-
(0,
|
|
1390
|
-
(0,
|
|
1546
|
+
{ ref, className, style, "data-type": card.type, ...placing },
|
|
1547
|
+
(0, import_react10.createElement)("div", { className: "cb-summaryMain" }, (0, import_react10.createElement)(SummaryBody, { card, locale, t, wash: wash !== "" }), steps, footer),
|
|
1548
|
+
(0, import_react10.createElement)("div", { className: "cb-summaryAside" }, live.fresh && (0, import_react10.createElement)(kit.NewDot), chat)
|
|
1391
1549
|
);
|
|
1392
1550
|
}
|
|
1393
|
-
const statBlock = card.stat && (0,
|
|
1394
|
-
const body = (0,
|
|
1395
|
-
return (0,
|
|
1551
|
+
const statBlock = card.stat && (0, import_react10.createElement)(StatBlock, { data: card.stat, locale, compact: true, wash: wash !== "" });
|
|
1552
|
+
const body = (0, import_react10.createElement)(Body, { card, live, wash: wash !== "", locale, t, rowActions, all: sheet, onOpenRow, rowControls });
|
|
1553
|
+
return (0, import_react10.createElement)(
|
|
1396
1554
|
"section",
|
|
1397
|
-
{ ref, className, style, "data-type": card.type, ...openOnTap },
|
|
1398
|
-
!sheet && (0,
|
|
1555
|
+
{ ref, className, style, "data-type": card.type, ...placing, ...openOnTap },
|
|
1556
|
+
!sheet && (0, import_react10.createElement)(
|
|
1399
1557
|
"header",
|
|
1400
|
-
{ className: "cb-cardHead"
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1558
|
+
{ className: "cb-cardHead", ...arrange ? { onPointerDown: (event) => {
|
|
1559
|
+
if (event.pointerType !== "mouse" && !onControl(event)) arrange.onHold(event);
|
|
1560
|
+
} } : {} },
|
|
1561
|
+
card.icon && (0, import_react10.createElement)(kit.Tile, { icon: card.icon, tone: card.tone ?? "muted", size: 30 }),
|
|
1562
|
+
(0, import_react10.createElement)(Trunc, { as: "h3", text: card.title }),
|
|
1563
|
+
live.fresh && (0, import_react10.createElement)(kit.NewDot),
|
|
1564
|
+
raised && (0, import_react10.createElement)("span", { className: "cb-raisedCue", title: t("arrange.raisedWhy") }, (0, import_react10.createElement)(import_dsh_client_ui_primitives3.Tag, { tone: "info" }, card.raise?.label ?? t("arrange.raised"))),
|
|
1565
|
+
wash !== "" && card.type !== "stat" && !card.stat && (0, import_react10.createElement)(kit.JustNow),
|
|
1566
|
+
stale && (0, import_react10.createElement)(
|
|
1406
1567
|
"span",
|
|
1407
1568
|
{ className: "cb-stale", title: new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short" }).format(updated) },
|
|
1408
|
-
(0,
|
|
1569
|
+
(0, import_react10.createElement)(import_dsh_client_ui_primitives3.Tag, { tone: "warning" }, t("stale", { age: formatAge(age, locale) }))
|
|
1409
1570
|
),
|
|
1410
|
-
|
|
1411
|
-
|
|
1571
|
+
arrange && (0, import_react10.createElement)(ArrangeControls, { t, arrange }),
|
|
1572
|
+
card.link && (0, import_react10.createElement)("a", { className: "cb-cardLink", href: card.link, title: t("open"), "aria-label": t("open"), ...external ? { target: "_blank", rel: "noopener noreferrer" } : {} }, (0, import_react10.createElement)(import_dsh_client_ui_primitives3.IconRightUpOutlineRegular, { size: 14 })),
|
|
1573
|
+
openable && (0, import_react10.createElement)("button", { type: "button", className: "cb-cardLink cb-cardOpen", title: t("details"), "aria-label": t("details"), onClick: () => onOpen() }, (0, import_react10.createElement)(import_dsh_client_ui_primitives3.IconFullscreenOutlineRegular, { size: 14 })),
|
|
1412
1574
|
chat
|
|
1413
1575
|
),
|
|
1414
|
-
statBlock && ["line", "bar", "donut"].includes(card.type) ? (0,
|
|
1415
|
-
sheet && (0,
|
|
1576
|
+
statBlock && ["line", "bar", "donut"].includes(card.type) ? (0, import_react10.createElement)("div", { className: "cb-split" }, statBlock, (0, import_react10.createElement)("div", { className: "cb-cardBody" }, body)) : [statBlock && (0, import_react10.createElement)("div", { key: "stat" }, statBlock), (0, import_react10.createElement)("div", { key: "body", className: "cb-cardBody" }, body)],
|
|
1577
|
+
sheet && (0, import_react10.createElement)(DetailParts, { detail: card.detail, locale, t }),
|
|
1416
1578
|
steps,
|
|
1417
1579
|
footer,
|
|
1418
|
-
sheet && chat && (0,
|
|
1580
|
+
sheet && chat && (0, import_react10.createElement)("div", { className: "cb-sheetChat" }, chat)
|
|
1419
1581
|
);
|
|
1420
1582
|
}
|
|
1421
1583
|
|
|
1584
|
+
// src/client/drag.js
|
|
1585
|
+
var import_react11 = require("react");
|
|
1586
|
+
var HOLD_MS = 380;
|
|
1587
|
+
var SLOP = 8;
|
|
1588
|
+
var PULL = 4;
|
|
1589
|
+
var EDGE = 72;
|
|
1590
|
+
function useCardDrag(onDrop) {
|
|
1591
|
+
const [drag, setDrag] = (0, import_react11.useState)(null);
|
|
1592
|
+
const dropRef = (0, import_react11.useRef)(onDrop);
|
|
1593
|
+
dropRef.current = onDrop;
|
|
1594
|
+
const stop = (0, import_react11.useRef)(() => {
|
|
1595
|
+
});
|
|
1596
|
+
(0, import_react11.useEffect)(() => () => stop.current(), []);
|
|
1597
|
+
const begin = (0, import_react11.useCallback)((event, id, hold) => {
|
|
1598
|
+
if (event.pointerType === "mouse" && event.button !== 0) return;
|
|
1599
|
+
stop.current();
|
|
1600
|
+
const el = event.currentTarget.closest("[data-card]");
|
|
1601
|
+
const scroller = el?.closest(".cb-page");
|
|
1602
|
+
if (!el || !scroller) return;
|
|
1603
|
+
const grid = el.parentElement;
|
|
1604
|
+
const origin = { x: event.clientX, y: event.clientY, scroll: scroller.scrollTop };
|
|
1605
|
+
const point = { x: origin.x, y: origin.y };
|
|
1606
|
+
let active = false;
|
|
1607
|
+
let hint = null;
|
|
1608
|
+
let timer = 0;
|
|
1609
|
+
let frame = 0;
|
|
1610
|
+
const single = () => getComputedStyle(grid).gridTemplateColumns.split(" ").length === 1;
|
|
1611
|
+
const update = () => {
|
|
1612
|
+
const under = document.elementsFromPoint(point.x, point.y).map((node) => node.closest?.("[data-card]")).find((card) => card && card.dataset.card !== id);
|
|
1613
|
+
if (under) hint = { target: under.dataset.card, after: dropAfter(under.getBoundingClientRect(), point.x, point.y, single()) };
|
|
1614
|
+
setDrag({ id, dx: point.x - origin.x, dy: point.y - origin.y + (scroller.scrollTop - origin.scroll), hint });
|
|
1615
|
+
};
|
|
1616
|
+
const scroll = () => {
|
|
1617
|
+
if (!active) return;
|
|
1618
|
+
const box = scroller.getBoundingClientRect();
|
|
1619
|
+
const near = point.y < box.top + EDGE ? (point.y - box.top - EDGE) / EDGE : point.y > box.bottom - EDGE ? (point.y - box.bottom + EDGE) / EDGE : 0;
|
|
1620
|
+
if (near !== 0) {
|
|
1621
|
+
const before = scroller.scrollTop;
|
|
1622
|
+
scroller.scrollTop += Math.round(Math.max(-1, Math.min(1, near)) * 16);
|
|
1623
|
+
if (scroller.scrollTop !== before) update();
|
|
1624
|
+
}
|
|
1625
|
+
frame = requestAnimationFrame(scroll);
|
|
1626
|
+
};
|
|
1627
|
+
const lift = () => {
|
|
1628
|
+
timer = 0;
|
|
1629
|
+
active = true;
|
|
1630
|
+
navigator.vibrate?.(10);
|
|
1631
|
+
document.body.style.cursor = "grabbing";
|
|
1632
|
+
update();
|
|
1633
|
+
scroll();
|
|
1634
|
+
};
|
|
1635
|
+
const onMove = (move) => {
|
|
1636
|
+
point.x = move.clientX;
|
|
1637
|
+
point.y = move.clientY;
|
|
1638
|
+
if (active) return update();
|
|
1639
|
+
const travel = Math.hypot(point.x - origin.x, point.y - origin.y);
|
|
1640
|
+
if (hold && travel > SLOP) finish(false);
|
|
1641
|
+
else if (!hold && travel > PULL) lift();
|
|
1642
|
+
};
|
|
1643
|
+
const onTouchMove = (move) => {
|
|
1644
|
+
if (active && move.cancelable) move.preventDefault();
|
|
1645
|
+
};
|
|
1646
|
+
const onKey = (key) => {
|
|
1647
|
+
if (key.key === "Escape") finish(false);
|
|
1648
|
+
};
|
|
1649
|
+
const onMenu = (menu) => {
|
|
1650
|
+
if (hold) menu.preventDefault();
|
|
1651
|
+
};
|
|
1652
|
+
function finish(drop) {
|
|
1653
|
+
clearTimeout(timer);
|
|
1654
|
+
cancelAnimationFrame(frame);
|
|
1655
|
+
window.removeEventListener("pointermove", onMove);
|
|
1656
|
+
window.removeEventListener("pointerup", onUp);
|
|
1657
|
+
window.removeEventListener("pointercancel", onCancel);
|
|
1658
|
+
window.removeEventListener("touchmove", onTouchMove);
|
|
1659
|
+
window.removeEventListener("keydown", onKey);
|
|
1660
|
+
window.removeEventListener("contextmenu", onMenu);
|
|
1661
|
+
document.body.style.cursor = "";
|
|
1662
|
+
stop.current = () => {
|
|
1663
|
+
};
|
|
1664
|
+
if (active) {
|
|
1665
|
+
const swallow = (click) => {
|
|
1666
|
+
click.stopPropagation();
|
|
1667
|
+
click.preventDefault();
|
|
1668
|
+
};
|
|
1669
|
+
window.addEventListener("click", swallow, { capture: true, once: true });
|
|
1670
|
+
setTimeout(() => window.removeEventListener("click", swallow, true), 60);
|
|
1671
|
+
if (drop && hint) dropRef.current(id, hint.target, hint.after);
|
|
1672
|
+
}
|
|
1673
|
+
active = false;
|
|
1674
|
+
setDrag(null);
|
|
1675
|
+
}
|
|
1676
|
+
const onUp = () => finish(true);
|
|
1677
|
+
const onCancel = () => finish(false);
|
|
1678
|
+
window.addEventListener("pointermove", onMove);
|
|
1679
|
+
window.addEventListener("pointerup", onUp);
|
|
1680
|
+
window.addEventListener("pointercancel", onCancel);
|
|
1681
|
+
window.addEventListener("touchmove", onTouchMove, { passive: false });
|
|
1682
|
+
window.addEventListener("keydown", onKey);
|
|
1683
|
+
window.addEventListener("contextmenu", onMenu);
|
|
1684
|
+
if (hold) timer = setTimeout(lift, HOLD_MS);
|
|
1685
|
+
stop.current = () => finish(false);
|
|
1686
|
+
}, []);
|
|
1687
|
+
return { drag, begin };
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
// src/client/flip.js
|
|
1691
|
+
var import_react12 = require("react");
|
|
1692
|
+
var MS = 240;
|
|
1693
|
+
function useGlide(gridRef, orderKey) {
|
|
1694
|
+
const spots = (0, import_react12.useRef)(/* @__PURE__ */ new Map());
|
|
1695
|
+
const lastKey = (0, import_react12.useRef)(orderKey);
|
|
1696
|
+
(0, import_react12.useLayoutEffect)(() => {
|
|
1697
|
+
const grid = gridRef.current;
|
|
1698
|
+
if (!grid) return;
|
|
1699
|
+
const next = /* @__PURE__ */ new Map();
|
|
1700
|
+
const animate = lastKey.current !== orderKey && typeof matchMedia === "function" && !matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1701
|
+
for (const el of grid.children) {
|
|
1702
|
+
const id = el.dataset?.card;
|
|
1703
|
+
if (id === void 0) continue;
|
|
1704
|
+
const spot = { x: el.offsetLeft, y: el.offsetTop };
|
|
1705
|
+
const was = spots.current.get(id);
|
|
1706
|
+
if (animate && was && typeof el.animate === "function" && (Math.abs(was.x - spot.x) > 1 || Math.abs(was.y - spot.y) > 1)) {
|
|
1707
|
+
el.animate([{ transform: `translate(${was.x - spot.x}px, ${was.y - spot.y}px)` }, { transform: "none" }], { duration: MS, easing: "cubic-bezier(.2,.7,.2,1)" });
|
|
1708
|
+
}
|
|
1709
|
+
next.set(id, spot);
|
|
1710
|
+
}
|
|
1711
|
+
spots.current = next;
|
|
1712
|
+
lastKey.current = orderKey;
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
// src/client/raise.js
|
|
1717
|
+
var import_react13 = require("react");
|
|
1718
|
+
var MAX_WAIT_MS = 2 ** 31 - 1;
|
|
1719
|
+
var SLACK_MS = 25;
|
|
1720
|
+
function useRaised(entries) {
|
|
1721
|
+
const [now, setNow] = (0, import_react13.useState)(() => Date.now());
|
|
1722
|
+
const raises = entries.filter((entry) => entry.card?.raise).map((entry) => [entry.id, entry.card.raise]);
|
|
1723
|
+
const key = JSON.stringify(raises);
|
|
1724
|
+
(0, import_react13.useEffect)(() => {
|
|
1725
|
+
let timer;
|
|
1726
|
+
const arm = () => {
|
|
1727
|
+
clearTimeout(timer);
|
|
1728
|
+
const current = Date.now();
|
|
1729
|
+
setNow(current);
|
|
1730
|
+
const next = nextRaiseChange(raises.map(([, raise]) => raise), current);
|
|
1731
|
+
if (next !== void 0) timer = setTimeout(arm, Math.min(next - current + SLACK_MS, MAX_WAIT_MS));
|
|
1732
|
+
};
|
|
1733
|
+
const wake = () => {
|
|
1734
|
+
if (document.visibilityState === "visible") arm();
|
|
1735
|
+
};
|
|
1736
|
+
arm();
|
|
1737
|
+
document.addEventListener("visibilitychange", wake);
|
|
1738
|
+
window.addEventListener("focus", wake);
|
|
1739
|
+
return () => {
|
|
1740
|
+
clearTimeout(timer);
|
|
1741
|
+
document.removeEventListener("visibilitychange", wake);
|
|
1742
|
+
window.removeEventListener("focus", wake);
|
|
1743
|
+
};
|
|
1744
|
+
}, [key]);
|
|
1745
|
+
return (0, import_react13.useMemo)(() => new Set(raises.filter(([, raise]) => isRaised(raise, now)).map(([id]) => id)), [key, now]);
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1422
1748
|
// src/client/live-state.js
|
|
1423
1749
|
var EMPTY = Object.freeze({ wash: 0, rows: Object.freeze({}), fresh: false, freshRows: /* @__PURE__ */ new Set() });
|
|
1424
1750
|
var liveOf = (live, id) => live[id] ?? EMPTY;
|
|
@@ -1471,10 +1797,10 @@ function writeNav(search, nav) {
|
|
|
1471
1797
|
var hasNav = (search) => Boolean(readNav(search).card);
|
|
1472
1798
|
|
|
1473
1799
|
// src/client/sheet.js
|
|
1474
|
-
var
|
|
1475
|
-
var
|
|
1800
|
+
var import_react14 = require("react");
|
|
1801
|
+
var import_dsh_client_ui_primitives4 = require("@deepseek-ai/dsh-client-ui-primitives");
|
|
1476
1802
|
function Sheet({ open, onClose, title, closeLabel, children }) {
|
|
1477
|
-
return (0,
|
|
1803
|
+
return (0, import_react14.createElement)(import_dsh_client_ui_primitives4.Modal, { open, onClose, title, closeLabel, className: "cb-sheetModal", contentClassName: "cb-sheet" }, children);
|
|
1478
1804
|
}
|
|
1479
1805
|
|
|
1480
1806
|
// src/client/page.js
|
|
@@ -1508,11 +1834,11 @@ var visible = () => document.visibilityState === "visible";
|
|
|
1508
1834
|
function BoardsPage() {
|
|
1509
1835
|
const kit = useKit();
|
|
1510
1836
|
const { active, intl: locale, ready, t } = useActiveLocale();
|
|
1511
|
-
const [boards, setBoards] = (0,
|
|
1512
|
-
const [listError, setListError] = (0,
|
|
1513
|
-
const [opened, setOpened] = (0,
|
|
1514
|
-
const pushed = (0,
|
|
1515
|
-
const [selected, setSelected] = (0,
|
|
1837
|
+
const [boards, setBoards] = (0, import_react15.useState)(null);
|
|
1838
|
+
const [listError, setListError] = (0, import_react15.useState)(null);
|
|
1839
|
+
const [opened, setOpened] = (0, import_react15.useState)(() => typeof location === "undefined" ? {} : readNav(location.search));
|
|
1840
|
+
const pushed = (0, import_react15.useRef)(false);
|
|
1841
|
+
const [selected, setSelected] = (0, import_react15.useState)(() => {
|
|
1516
1842
|
if (opened.board) return opened.board;
|
|
1517
1843
|
try {
|
|
1518
1844
|
return localStorage.getItem(STORE_KEY);
|
|
@@ -1520,25 +1846,36 @@ function BoardsPage() {
|
|
|
1520
1846
|
return null;
|
|
1521
1847
|
}
|
|
1522
1848
|
});
|
|
1523
|
-
const [view, setView] = (0,
|
|
1524
|
-
const [boardError, setBoardError] = (0,
|
|
1525
|
-
const [pollSeconds, setPollSeconds] = (0,
|
|
1526
|
-
const etag = (0,
|
|
1527
|
-
const
|
|
1528
|
-
const
|
|
1529
|
-
const translateRef = (0, import_react11.useRef)(t);
|
|
1849
|
+
const [view, setView] = (0, import_react15.useState)({ board: null, live: {} });
|
|
1850
|
+
const [boardError, setBoardError] = (0, import_react15.useState)(null);
|
|
1851
|
+
const [pollSeconds, setPollSeconds] = (0, import_react15.useState)(30);
|
|
1852
|
+
const etag = (0, import_react15.useRef)(null);
|
|
1853
|
+
const currentRef = (0, import_react15.useRef)(null);
|
|
1854
|
+
const translateRef = (0, import_react15.useRef)(t);
|
|
1530
1855
|
translateRef.current = t;
|
|
1531
|
-
const [kept, setKept] = (0,
|
|
1532
|
-
const [toast, setToast] = (0,
|
|
1533
|
-
const toasts = (0,
|
|
1856
|
+
const [kept, setKept] = (0, import_react15.useState)({});
|
|
1857
|
+
const [toast, setToast] = (0, import_react15.useState)(null);
|
|
1858
|
+
const toasts = (0, import_react15.useRef)(0);
|
|
1534
1859
|
const board = view.board;
|
|
1535
|
-
const boardRef = (0,
|
|
1860
|
+
const boardRef = (0, import_react15.useRef)(null);
|
|
1536
1861
|
boardRef.current = board;
|
|
1537
|
-
const
|
|
1862
|
+
const ids = (0, import_react15.useMemo)(() => board ? board.cards.map((entry) => entry.id) : [], [board]);
|
|
1863
|
+
const mine = (0, import_react15.useMemo)(() => arranged(ids, board?.arrangement), [ids, board?.arrangement]);
|
|
1864
|
+
const raised = useRaised(board?.cards ?? []);
|
|
1865
|
+
const order = (0, import_react15.useMemo)(() => visibleOrder(mine, raised), [mine, raised]);
|
|
1866
|
+
const shown = (0, import_react15.useMemo)(() => {
|
|
1867
|
+
const byId = new Map((board?.cards ?? []).map((entry) => [entry.id, entry]));
|
|
1868
|
+
return order.map((id) => byId.get(id)).filter(Boolean);
|
|
1869
|
+
}, [board, order]);
|
|
1870
|
+
const gridRef = (0, import_react15.useRef)(null);
|
|
1871
|
+
const [contentRef, tracks] = useTracks();
|
|
1872
|
+
useGlide(gridRef, order.join("\n"));
|
|
1873
|
+
const [said, setSaid] = (0, import_react15.useState)("");
|
|
1874
|
+
const show = (0, import_react15.useCallback)((next) => setView((prev) => ({
|
|
1538
1875
|
board: next,
|
|
1539
1876
|
live: next === null ? {} : nextLive(prev.board?.id === next.id ? prev.board : null, next, prev.board?.id === next.id ? prev.live : {})
|
|
1540
1877
|
})), []);
|
|
1541
|
-
const loadList = (0,
|
|
1878
|
+
const loadList = (0, import_react15.useCallback)(async () => {
|
|
1542
1879
|
try {
|
|
1543
1880
|
const { body } = await getJson("boards");
|
|
1544
1881
|
setBoards(body.boards);
|
|
@@ -1549,7 +1886,7 @@ function BoardsPage() {
|
|
|
1549
1886
|
}
|
|
1550
1887
|
}, []);
|
|
1551
1888
|
const current = boards?.some((b) => b.id === selected) ? selected : boards?.[0]?.id ?? null;
|
|
1552
|
-
const loadBoard = (0,
|
|
1889
|
+
const loadBoard = (0, import_react15.useCallback)(async (id, fresh) => {
|
|
1553
1890
|
if (!id) return;
|
|
1554
1891
|
try {
|
|
1555
1892
|
const result = await getJson(`board?id=${encodeURIComponent(id)}`, fresh ? null : etag.current);
|
|
@@ -1565,7 +1902,7 @@ function BoardsPage() {
|
|
|
1565
1902
|
}
|
|
1566
1903
|
}
|
|
1567
1904
|
}, [loadList, show]);
|
|
1568
|
-
const loadCard = (0,
|
|
1905
|
+
const loadCard = (0, import_react15.useCallback)(async (boardId, id) => {
|
|
1569
1906
|
try {
|
|
1570
1907
|
if (boardRef.current?.id !== boardId || !boardRef.current.cards.some((card) => card.id === id)) return loadBoard(boardId, false);
|
|
1571
1908
|
const { body } = await getJson(`card?board=${encodeURIComponent(boardId)}&id=${encodeURIComponent(id)}`);
|
|
@@ -1579,11 +1916,11 @@ function BoardsPage() {
|
|
|
1579
1916
|
else loadBoard(boardId, false);
|
|
1580
1917
|
}
|
|
1581
1918
|
}, [loadBoard]);
|
|
1582
|
-
const onEvent = (0,
|
|
1919
|
+
const onEvent = (0, import_react15.useCallback)((message) => {
|
|
1583
1920
|
const id = currentRef.current;
|
|
1584
1921
|
if (!id) return;
|
|
1585
1922
|
if (message.type === "card") loadCard(id, message.id);
|
|
1586
|
-
else if (message.type === "board" || message.type === "hello") loadBoard(id, false);
|
|
1923
|
+
else if (message.type === "board" || message.type === "hello" || message.type === "arrange") loadBoard(id, false);
|
|
1587
1924
|
else if (message.type === "gone") {
|
|
1588
1925
|
show(null);
|
|
1589
1926
|
setBoardError(requestError(403));
|
|
@@ -1591,7 +1928,7 @@ function BoardsPage() {
|
|
|
1591
1928
|
}
|
|
1592
1929
|
}, [loadBoard, loadCard, loadList, show]);
|
|
1593
1930
|
const status = kit.useEventStream(current ? `api/card-board/events?board=${encodeURIComponent(current)}` : null, onEvent);
|
|
1594
|
-
const post = (0,
|
|
1931
|
+
const post = (0, import_react15.useCallback)(async (body) => {
|
|
1595
1932
|
const response = await fetch(api("action"), {
|
|
1596
1933
|
method: "POST",
|
|
1597
1934
|
credentials: "same-origin",
|
|
@@ -1603,8 +1940,23 @@ function BoardsPage() {
|
|
|
1603
1940
|
loadBoard(currentRef.current, false);
|
|
1604
1941
|
return answer;
|
|
1605
1942
|
}, [loadBoard]);
|
|
1606
|
-
const showToast = (0,
|
|
1607
|
-
const
|
|
1943
|
+
const showToast = (0, import_react15.useCallback)((next) => setToast({ seq: ++toasts.current, ...next }), []);
|
|
1944
|
+
const keepArrangement = (0, import_react15.useCallback)(async (next, board2) => {
|
|
1945
|
+
setView((prev) => prev.board?.id === board2 ? { ...prev, board: { ...prev.board, arrangement: next ?? void 0 } } : prev);
|
|
1946
|
+
try {
|
|
1947
|
+
const response = await fetch(api("arrange"), {
|
|
1948
|
+
method: "POST",
|
|
1949
|
+
credentials: "same-origin",
|
|
1950
|
+
headers: { "content-type": "application/json" },
|
|
1951
|
+
body: JSON.stringify(next === null ? { board: board2, reset: true } : { board: board2, ...next })
|
|
1952
|
+
});
|
|
1953
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
1954
|
+
} catch {
|
|
1955
|
+
showToast({ text: "arrange.failed" });
|
|
1956
|
+
loadBoard(board2, true);
|
|
1957
|
+
}
|
|
1958
|
+
}, [loadBoard, showToast]);
|
|
1959
|
+
const undo = (0, import_react15.useCallback)(async (pressId, card) => {
|
|
1608
1960
|
try {
|
|
1609
1961
|
await post({ card, undo: pressId });
|
|
1610
1962
|
showToast({ text: "toast.undone" });
|
|
@@ -1612,7 +1964,7 @@ function BoardsPage() {
|
|
|
1612
1964
|
showToast({ text: "toast.undoFailed" });
|
|
1613
1965
|
}
|
|
1614
1966
|
}, [post, showToast]);
|
|
1615
|
-
const press = (0,
|
|
1967
|
+
const press = (0, import_react15.useCallback)(async (action, extra, target, row) => {
|
|
1616
1968
|
const answer = await post({ ...target, id: action.id, ...extra });
|
|
1617
1969
|
if (answer?.undoable) {
|
|
1618
1970
|
showToast({ text: TOAST_KEYS[action.kind] ?? "toast.event", undo: () => undo(answer.press, target.card) });
|
|
@@ -1621,10 +1973,10 @@ function BoardsPage() {
|
|
|
1621
1973
|
}
|
|
1622
1974
|
return answer;
|
|
1623
1975
|
}, [post, showToast, undo]);
|
|
1624
|
-
(0,
|
|
1976
|
+
(0, import_react15.useEffect)(() => {
|
|
1625
1977
|
loadList();
|
|
1626
1978
|
}, [loadList]);
|
|
1627
|
-
(0,
|
|
1979
|
+
(0, import_react15.useEffect)(() => {
|
|
1628
1980
|
currentRef.current = current;
|
|
1629
1981
|
if (!current) return;
|
|
1630
1982
|
etag.current = null;
|
|
@@ -1634,7 +1986,7 @@ function BoardsPage() {
|
|
|
1634
1986
|
loadBoard(current, true);
|
|
1635
1987
|
}, [current, loadBoard]);
|
|
1636
1988
|
const waiting = board?.cards.some((entry) => entry.presses?.some((p) => p.state === "pending")) === true;
|
|
1637
|
-
(0,
|
|
1989
|
+
(0, import_react15.useEffect)(() => {
|
|
1638
1990
|
if (!current || status === "live" && !waiting) return void 0;
|
|
1639
1991
|
let ticks = 0;
|
|
1640
1992
|
const timer = setInterval(() => {
|
|
@@ -1654,8 +2006,8 @@ function BoardsPage() {
|
|
|
1654
2006
|
document.removeEventListener("visibilitychange", onVisible);
|
|
1655
2007
|
};
|
|
1656
2008
|
}, [current, status, waiting, pollSeconds, loadBoard, loadList]);
|
|
1657
|
-
const reported = (0,
|
|
1658
|
-
(0,
|
|
2009
|
+
const reported = (0, import_react15.useRef)("");
|
|
2010
|
+
(0, import_react15.useEffect)(() => {
|
|
1659
2011
|
if (!board) return void 0;
|
|
1660
2012
|
const report = seenReport(board);
|
|
1661
2013
|
const text = JSON.stringify(report);
|
|
@@ -1669,7 +2021,7 @@ function BoardsPage() {
|
|
|
1669
2021
|
}, SEEN_AFTER_MS);
|
|
1670
2022
|
return () => clearTimeout(timer);
|
|
1671
2023
|
}, [board]);
|
|
1672
|
-
(0,
|
|
2024
|
+
(0, import_react15.useEffect)(() => {
|
|
1673
2025
|
const onPop = () => {
|
|
1674
2026
|
pushed.current = false;
|
|
1675
2027
|
setOpened(readNav(location.search));
|
|
@@ -1677,19 +2029,39 @@ function BoardsPage() {
|
|
|
1677
2029
|
window.addEventListener("popstate", onPop);
|
|
1678
2030
|
return () => window.removeEventListener("popstate", onPop);
|
|
1679
2031
|
}, []);
|
|
1680
|
-
const openCard = (0,
|
|
2032
|
+
const openCard = (0, import_react15.useCallback)((boardId, card, row) => {
|
|
1681
2033
|
const nav = { board: boardId, card, ...row === void 0 ? {} : { row } };
|
|
1682
2034
|
window.history[pushed.current ? "replaceState" : "pushState"](window.history.state, "", `${location.pathname}${writeNav(location.search, nav)}${location.hash}`);
|
|
1683
2035
|
pushed.current = true;
|
|
1684
2036
|
setOpened(nav);
|
|
1685
2037
|
}, []);
|
|
1686
|
-
const closeCard = (0,
|
|
2038
|
+
const closeCard = (0, import_react15.useCallback)(() => {
|
|
1687
2039
|
setOpened({});
|
|
1688
2040
|
if (pushed.current) {
|
|
1689
2041
|
pushed.current = false;
|
|
1690
2042
|
window.history.back();
|
|
1691
2043
|
} else window.history.replaceState(window.history.state, "", `${location.pathname}${writeNav(location.search, {})}${location.hash}`);
|
|
1692
2044
|
}, []);
|
|
2045
|
+
const rearrange = (next, id, saying) => {
|
|
2046
|
+
if (board === null) return;
|
|
2047
|
+
keepArrangement(next, board.id);
|
|
2048
|
+
const title = pickText(boardRef.current?.cards.find((entry) => entry.id === id)?.card?.title, active) ?? id;
|
|
2049
|
+
const place = [...visibleOrder(next, raised)].indexOf(id) + 1;
|
|
2050
|
+
setSaid(t(saying, { title, n: place, total: ids.length }));
|
|
2051
|
+
};
|
|
2052
|
+
const { drag, begin } = useCardDrag((id, target, after) => rearrange(dropCard(mine, id, target, after), id, "arrange.moved"));
|
|
2053
|
+
const arrangeOf = (id) => ({
|
|
2054
|
+
pinned: mine.pinned.includes(id),
|
|
2055
|
+
canUp: canShift(mine, id, -1),
|
|
2056
|
+
canDown: canShift(mine, id, 1),
|
|
2057
|
+
onPin: () => mine.pinned.includes(id) ? rearrange(unpinCard(mine, id), id, "arrange.unpinnedDone") : rearrange(pinCard(mine, id), id, "arrange.pinnedDone"),
|
|
2058
|
+
onMove: (delta) => rearrange(shiftCard(mine, id, delta), id, "arrange.moved"),
|
|
2059
|
+
onGrip: (event) => {
|
|
2060
|
+
event.preventDefault();
|
|
2061
|
+
begin(event, id, false);
|
|
2062
|
+
},
|
|
2063
|
+
onHold: (event) => begin(event, id, true)
|
|
2064
|
+
});
|
|
1693
2065
|
const choose = (id) => {
|
|
1694
2066
|
setSelected(id);
|
|
1695
2067
|
try {
|
|
@@ -1702,54 +2074,81 @@ function BoardsPage() {
|
|
|
1702
2074
|
return Number.isFinite(time) && time > max ? time : max;
|
|
1703
2075
|
}, 0);
|
|
1704
2076
|
const titleOf = (entry) => pickText(entry.title, active);
|
|
1705
|
-
if (!ready) return (0,
|
|
2077
|
+
if (!ready) return (0, import_react15.createElement)("div", { className: "cb-page" });
|
|
1706
2078
|
let content;
|
|
1707
|
-
if (listError) content = (0,
|
|
1708
|
-
else if (boards === null) content = (0,
|
|
1709
|
-
else if (boards.length === 0) content = (0,
|
|
1710
|
-
else if (boardError) content = (0,
|
|
1711
|
-
else if (!board) content = (0,
|
|
1712
|
-
else content = (0,
|
|
1713
|
-
|
|
2079
|
+
if (listError) content = (0, import_react15.createElement)("p", { className: "cb-notice" }, errorText(listError, t));
|
|
2080
|
+
else if (boards === null) content = (0, import_react15.createElement)("p", { className: "cb-muted" }, t("loading"));
|
|
2081
|
+
else if (boards.length === 0) content = (0, import_react15.createElement)("div", { className: "cb-empty" }, (0, import_react15.createElement)("p", { className: "cb-emptyTitle" }, t("emptyTitle")), (0, import_react15.createElement)("p", { className: "cb-muted" }, t("emptyHint")));
|
|
2082
|
+
else if (boardError) content = (0, import_react15.createElement)("p", { className: "cb-notice" }, errorText(boardError, t));
|
|
2083
|
+
else if (!board) content = (0, import_react15.createElement)("p", { className: "cb-muted" }, t("loading"));
|
|
2084
|
+
else content = (0, import_react15.createElement)(
|
|
2085
|
+
import_react15.Fragment,
|
|
1714
2086
|
null,
|
|
1715
|
-
board.problems?.length > 0 && (0,
|
|
1716
|
-
board.cards.length === 0 && (0,
|
|
1717
|
-
(0,
|
|
2087
|
+
board.problems?.length > 0 && (0, import_react15.createElement)("div", { className: "cb-notice" }, t("boardProblems"), (0, import_react15.createElement)("ul", { className: "cb-problems" }, board.problems.map((p, i) => (0, import_react15.createElement)("li", { key: i }, p)))),
|
|
2088
|
+
board.cards.length === 0 && (0, import_react15.createElement)("p", { className: "cb-muted" }, t("noCards")),
|
|
2089
|
+
(0, import_react15.createElement)(
|
|
1718
2090
|
"div",
|
|
1719
|
-
{ className: "cb-grid", style: { gridTemplateColumns: `repeat(${tracks}, minmax(0, 1fr))`, gridAutoRows: `${ROW}px`, columnGap: GAP } },
|
|
1720
|
-
|
|
2091
|
+
{ className: "cb-grid", ref: gridRef, style: { gridTemplateColumns: `repeat(${tracks}, minmax(0, 1fr))`, gridAutoRows: `${ROW}px`, columnGap: GAP } },
|
|
2092
|
+
shown.map((entry) => (0, import_react15.createElement)(Card, {
|
|
2093
|
+
key: entry.id,
|
|
2094
|
+
entry,
|
|
2095
|
+
live: liveOf(view.live, entry.id),
|
|
2096
|
+
boardId: board.id,
|
|
2097
|
+
assistant: board.assistant,
|
|
2098
|
+
tracks,
|
|
2099
|
+
active,
|
|
2100
|
+
locale,
|
|
2101
|
+
t,
|
|
2102
|
+
press,
|
|
2103
|
+
undo,
|
|
2104
|
+
kept: kept[entry.id],
|
|
2105
|
+
onOpen: (row) => openCard(board.id, entry.id, row),
|
|
2106
|
+
raised: raised.has(entry.id),
|
|
2107
|
+
dragging: drag?.id === entry.id ? drag : null,
|
|
2108
|
+
drop: drag?.hint?.target === entry.id ? drag.hint.after ? "after" : "before" : void 0,
|
|
2109
|
+
arrange: entry.card && arrangeOf(entry.id)
|
|
2110
|
+
}))
|
|
1721
2111
|
)
|
|
1722
2112
|
);
|
|
1723
2113
|
const openEntry = opened.card && board && (!opened.board || opened.board === board.id) ? board.cards.find((entry) => entry.id === opened.card && entry.card) : void 0;
|
|
1724
2114
|
const openCardData = openEntry && pickCard(openEntry.card, active);
|
|
1725
2115
|
const openRow = openCardData && opened.row !== void 0 ? openCardData.data.rows?.find((r) => r.key === opened.row) : void 0;
|
|
1726
|
-
const sheet = (0,
|
|
2116
|
+
const sheet = (0, import_react15.createElement)(Sheet, {
|
|
1727
2117
|
open: Boolean(openEntry),
|
|
1728
2118
|
onClose: closeCard,
|
|
1729
2119
|
title: openRow ? openRow.title ?? openRow.label : openCardData?.title,
|
|
1730
2120
|
closeLabel: t("close")
|
|
1731
|
-
}, openEntry && (0,
|
|
1732
|
-
return (0,
|
|
2121
|
+
}, openEntry && (0, import_react15.createElement)(Card, { entry: openEntry, live: liveOf(view.live, openEntry.id), boardId: board.id, assistant: board.assistant, tracks: 1, active, locale, t, press, undo, kept: kept[openEntry.id], sheet: true, row: opened.row }));
|
|
2122
|
+
return (0, import_react15.createElement)(
|
|
1733
2123
|
"div",
|
|
1734
2124
|
{ className: "cb-page" },
|
|
1735
|
-
(0,
|
|
2125
|
+
(0, import_react15.createElement)(
|
|
1736
2126
|
"div",
|
|
1737
|
-
{ className: "cb-content", ref:
|
|
1738
|
-
(0,
|
|
2127
|
+
{ className: "cb-content", ref: contentRef },
|
|
2128
|
+
(0, import_react15.createElement)(
|
|
1739
2129
|
"div",
|
|
1740
2130
|
{ className: "cb-heading" },
|
|
1741
|
-
(0,
|
|
1742
|
-
board && (0,
|
|
2131
|
+
(0, import_react15.createElement)("h1", null, boards?.length === 1 ? titleOf(boards[0]) : t("title")),
|
|
2132
|
+
board && (0, import_react15.createElement)(
|
|
2133
|
+
"div",
|
|
2134
|
+
{ className: "cb-sub" },
|
|
2135
|
+
(0, import_react15.createElement)(kit.LiveStatus, { status, updatedAt: newest || void 0 }),
|
|
2136
|
+
board.arrangement && (0, import_react15.createElement)(import_dsh_client_ui_primitives5.Button, { variant: "ghost", size: "sm", className: "cb-reset", title: t("arrange.resetHint"), onClick: () => {
|
|
2137
|
+
keepArrangement(null, board.id);
|
|
2138
|
+
setSaid(t("arrange.resetDone"));
|
|
2139
|
+
} }, t("arrange.reset"))
|
|
2140
|
+
)
|
|
1743
2141
|
),
|
|
1744
|
-
boards && boards.length > 1 && (0,
|
|
2142
|
+
boards && boards.length > 1 && (0, import_react15.createElement)("div", { className: "cb-tabs", role: "tablist" }, boards.map((b) => (0, import_react15.createElement)(import_dsh_client_ui_primitives5.Pill, { key: b.id, active: b.id === current, role: "tab", "aria-selected": b.id === current, title: titleOf(b), onClick: () => choose(b.id) }, titleOf(b)))),
|
|
1745
2143
|
content
|
|
1746
2144
|
),
|
|
1747
2145
|
board && sheet,
|
|
1748
|
-
|
|
2146
|
+
(0, import_react15.createElement)("div", { className: "cb-sr", role: "status", "aria-live": "polite" }, said),
|
|
2147
|
+
toast && (0, import_react15.createElement)(import_dsh_client_ui_primitives5.Toast, {
|
|
1749
2148
|
key: toast.seq,
|
|
1750
2149
|
text: t(toast.text),
|
|
1751
2150
|
tone: "success",
|
|
1752
|
-
...toast.undo ? { holdMs: UNDO_HOLD_MS, actions: [{ label: (0,
|
|
2151
|
+
...toast.undo ? { holdMs: UNDO_HOLD_MS, actions: [{ label: (0, import_react15.createElement)("span", { className: "cb-toastUndo" }, t("undo")), onClick: () => {
|
|
1753
2152
|
setToast(null);
|
|
1754
2153
|
toast.undo();
|
|
1755
2154
|
} }] } : {},
|
|
@@ -1763,17 +2162,17 @@ var NS = "dsh-card-board";
|
|
|
1763
2162
|
var PANEL = "dsh-card-board";
|
|
1764
2163
|
function SidebarIcon({ size }) {
|
|
1765
2164
|
const stroke = { stroke: "currentColor", strokeWidth: 1.2, strokeLinecap: "round", strokeLinejoin: "round", fill: "none" };
|
|
1766
|
-
return (0,
|
|
2165
|
+
return (0, import_react16.createElement)(
|
|
1767
2166
|
"svg",
|
|
1768
2167
|
{ width: size, height: size, viewBox: "0 0 16 16", "aria-hidden": true, focusable: "false" },
|
|
1769
|
-
(0,
|
|
1770
|
-
(0,
|
|
1771
|
-
(0,
|
|
1772
|
-
(0,
|
|
2168
|
+
(0, import_react16.createElement)("rect", { x: 1.75, y: 1.75, width: 5.5, height: 5.5, rx: 1.4, ...stroke }),
|
|
2169
|
+
(0, import_react16.createElement)("rect", { x: 8.75, y: 1.75, width: 5.5, height: 5.5, rx: 1.4, ...stroke }),
|
|
2170
|
+
(0, import_react16.createElement)("rect", { x: 1.75, y: 8.75, width: 5.5, height: 5.5, rx: 1.4, ...stroke }),
|
|
2171
|
+
(0, import_react16.createElement)("path", { d: "M9 13.5l1.6-2 1.4 1 2-2.8", ...stroke })
|
|
1773
2172
|
);
|
|
1774
2173
|
}
|
|
1775
2174
|
function Page() {
|
|
1776
|
-
return useKit() === null ? (0,
|
|
2175
|
+
return useKit() === null ? (0, import_react16.createElement)("div", { className: "cb-page" }) : (0, import_react16.createElement)(BoardsPage);
|
|
1777
2176
|
}
|
|
1778
2177
|
var inject = ["slots", "locale"];
|
|
1779
2178
|
function apply(ctx) {
|