strata-react 1.3.15 → 1.3.17

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.
Files changed (58) hide show
  1. package/README.md +47 -8
  2. package/UPGRADING.md +15 -0
  3. package/dist/components/data-table.d.ts +6 -0
  4. package/dist/components/field.d.ts +2 -0
  5. package/dist/components/hotkeys.d.ts +1 -1
  6. package/dist/components/link-card.d.ts +4 -2
  7. package/dist/components/pause-button.d.ts +7 -0
  8. package/dist/components/schedule-table.d.ts +24 -0
  9. package/dist/components/system-panel.d.ts +58 -0
  10. package/dist/components/theme.d.ts +46 -1
  11. package/dist/components/thumbnail.d.ts +2 -0
  12. package/dist/{errors-D99YX4XL.js → errors-jep2voNI.js} +42 -3
  13. package/dist/errors-jep2voNI.js.map +1 -0
  14. package/dist/field-t4Hoer0d.js +587 -0
  15. package/dist/field-t4Hoer0d.js.map +1 -0
  16. package/dist/index.d.ts +6 -3
  17. package/dist/index.js +669 -463
  18. package/dist/index.js.map +1 -1
  19. package/dist/lib/breakpoint.d.ts +4 -0
  20. package/dist/lib/format.d.ts +59 -6
  21. package/dist/map.js +2 -3
  22. package/dist/map.js.map +1 -1
  23. package/dist/microphone-Cu1u5Yml.js +547 -0
  24. package/dist/microphone-Cu1u5Yml.js.map +1 -0
  25. package/dist/panorama.js +3 -2
  26. package/dist/panorama.js.map +1 -1
  27. package/dist/query/index.d.ts +5 -1
  28. package/dist/query/poll.d.ts +24 -0
  29. package/dist/reading.css +11 -0
  30. package/dist/{run-hR9neQHM.js → run-BT2WKzMz.js} +83 -17
  31. package/dist/run-BT2WKzMz.js.map +1 -0
  32. package/dist/strata.bare.css +279 -0
  33. package/dist/strata.css +840 -10
  34. package/dist/strata.migrate.css +15 -6
  35. package/dist/testing/index.d.ts +4 -2
  36. package/dist/testing.js +34 -6
  37. package/dist/testing.js.map +1 -1
  38. package/dist/{theme-By3DSUTs.js → theme-DXacprlw.js} +147 -6
  39. package/dist/theme-DXacprlw.js.map +1 -0
  40. package/dist/{value-controls-B7iNh4WO.js → value-controls-DB5l5Qe2.js} +21 -46
  41. package/dist/value-controls-DB5l5Qe2.js.map +1 -0
  42. package/dist/visual/capture.d.ts +2 -0
  43. package/dist/visual/fonts.d.ts +18 -0
  44. package/dist/visual/index.d.ts +1 -0
  45. package/dist/visual/types.d.ts +7 -1
  46. package/dist/visual-cli.js +1 -1
  47. package/dist/visual.js +1 -1
  48. package/package.json +12 -3
  49. package/dist/errors-D99YX4XL.js.map +0 -1
  50. package/dist/field-QCCmWTuY.js +0 -321
  51. package/dist/field-QCCmWTuY.js.map +0 -1
  52. package/dist/format-B32-PVi2.js +0 -201
  53. package/dist/format-B32-PVi2.js.map +0 -1
  54. package/dist/microphone-BZXMKTCM.js +0 -292
  55. package/dist/microphone-BZXMKTCM.js.map +0 -1
  56. package/dist/run-hR9neQHM.js.map +0 -1
  57. package/dist/theme-By3DSUTs.js.map +0 -1
  58. package/dist/value-controls-B7iNh4WO.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,19 +1,18 @@
1
- import { a as Textarea, c as useSearchParam, d as cn, f as typeSteps, i as NativeSelect, l as Tooltip, n as Field, o as useFieldControl, r as Input, s as controlHeight, t as ChoiceGroup, u as KeyText } from "./field-QCCmWTuY.js";
2
- import { a as toDate, i as format, n as NBSP, r as createFormat, t as MISSING } from "./format-B32-PVi2.js";
3
- import { a as useAsyncAction, c as KeysLegend, d as useInView, i as AsyncButton, l as isTypingTarget, n as NumberField, o as Toolbar, r as Slider, s as ToolbarSeparator, t as ColorField, u as useHotkeys } from "./value-controls-B7iNh4WO.js";
4
- import { a as fieldErrorsOf, c as IconButton, d as isDev, i as errorPayload, l as RowAction, n as describeActionError, o as readErrorBody, r as describeHttpError, s as Button, t as HttpError, u as buttonVariants } from "./errors-D99YX4XL.js";
5
- import { a as useMicrophone, c as fetchJson, d as useLoad, f as StrataToastRegion, h as overlaySurface, i as explainMicrophoneError, l as staleOf, m as toastTimeout, n as MicrophoneError, o as StrataQueryProvider, p as toast, r as browserMicrophone, s as createQueryClient, t as MicrophoneContext, u as toLoad } from "./microphone-BZXMKTCM.js";
1
+ import { _ as typeSteps, a as Textarea, c as useSearchParam, d as MISSING, f as NBSP, g as cn, h as toDate, i as NativeSelect, l as Tooltip, m as format, n as Field, o as useFieldControl, p as createFormat, r as Input, s as controlHeight, t as ChoiceGroup, u as KeyText } from "./field-t4Hoer0d.js";
2
+ import { a as fieldErrorsOf, c as IconButton, d as isDev, f as useInView, i as errorPayload, l as RowAction, n as describeActionError, o as readErrorBody, r as describeHttpError, s as Button, t as HttpError, u as buttonVariants } from "./errors-jep2voNI.js";
3
+ import { C as usePoll, S as useLoad, _ as StrataQueryProvider, a as useMicrophone, b as staleOf, d as toastTimeout, f as DataView$1, g as StaleNotice, h as Skeleton, i as explainMicrophoneError, l as StrataToastRegion, m as LoadError, n as MicrophoneError, o as Thumbnail, p as EmptyState, r as browserMicrophone, s as ThumbnailSkeleton, t as MicrophoneContext, u as toast, v as createQueryClient, w as overlaySurface, x as toLoad, y as fetchJson } from "./microphone-Cu1u5Yml.js";
4
+ import { a as useAsyncAction, c as KeysLegend, i as AsyncButton, l as isTypingTarget, n as NumberField, o as Toolbar, r as Slider, s as ToolbarSeparator, t as ColorField, u as useHotkeys } from "./value-controls-DB5l5Qe2.js";
6
5
  import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-DDGBPiTJ.js";
7
- import { a as useColorScheme, i as colorSchemeScript, n as ColorSchemeChoice, o as useSystemColorScheme, r as ThemeProvider, s as Density, t as COLOR_SCHEME_STORAGE_KEY } from "./theme-By3DSUTs.js";
6
+ import { a as PaletteChoice, c as paletteScript, d as usePalette, f as useSystemColorScheme, i as PALETTE_STORAGE_KEY, l as palettes, n as ColorSchemeChoice, o as ThemeProvider, p as Density, r as DEFAULT_PALETTE, s as colorSchemeScript, t as COLOR_SCHEME_STORAGE_KEY, u as useColorScheme } from "./theme-DXacprlw.js";
8
7
  import * as React from "react";
9
8
  import { Autocomplete, Button as Button$1, Cell, Checkbox as Checkbox$1, Collection, Column, Dialog as Dialog$1, DialogTrigger, Disclosure as Disclosure$1, DisclosurePanel, DropIndicator, DropZone, FileTrigger, GridLayout, GridList, GridListItem, Header, Heading, Input as Input$1, Keyboard, Link, ListBox, ListBoxItem, ListLayout, ListStateContext, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, Popover as Popover$1, RouterProvider, Row, SearchField, Select, SelectValue, Separator, Slider as Slider$1, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Table, TableBody, TableHeader, TableLayout, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Tree as Tree$1, TreeItem, TreeItemContent, Virtualizer, useDragAndDrop, useFilter } from "react-aria-components";
10
- import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronDown, ChevronLeft, ChevronRight, CircleAlert, CircleCheck, CircleDashed, Clock, CloudOff, Columns2, Ellipsis, Eye, EyeOff, FileQuestion, Flag, Folder, FolderOpen, GripVertical, History, ImageOff, Info, KeyRound, LayoutGrid, List, Loader, LoaderCircle, Lock, Maximize, Maximize2, Minimize, Minus, PanelBottomClose, PanelBottomOpen, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, PanelTopClose, PanelTopOpen, Pause, Pencil, Play, Redo2, RotateCcw, RotateCw, Scan, Search, Send, SkipBack, SkipForward, SlidersHorizontal, Square, StepBack, StepForward, Trash2, TriangleAlert, Undo2, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
9
+ import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronDown, ChevronLeft, ChevronRight, CircleAlert, CircleCheck, CircleDashed, Clock, CloudOff, Columns2, Ellipsis, Eye, EyeOff, FileQuestion, Flag, Folder, FolderOpen, FolderX, GripVertical, ImageOff, Info, KeyRound, LayoutGrid, List, Loader, LoaderCircle, Lock, Maximize, Maximize2, Minimize, Minus, PanelBottomClose, PanelBottomOpen, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, PanelTopClose, PanelTopOpen, Pause, Pencil, Play, Redo2, RotateCcw, RotateCw, Scan, Search, Send, SkipBack, SkipForward, SlidersHorizontal, Square, StepBack, StepForward, Trash2, TriangleAlert, Undo2, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
11
10
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
11
  import { Link as Link$1, NavLink, useHref, useNavigate, useSearchParams } from "react-router";
12
+ import { hashKey, useInfiniteQuery, useQuery, useQueryClient } from "@tanstack/react-query";
13
13
  import { createSortedRowModel, flexRender, rowSortingFeature, tableFeatures, useTable } from "@tanstack/react-table";
14
14
  import { UNSAFE_PortalProvider, VisuallyHidden, mergeProps, useDrag, useDrop, useFocusRing, useMove, useSlider, useSliderThumb, useUNSAFE_PortalContext } from "react-aria";
15
15
  import { LayoutInfo, Rect, Size, useSliderState } from "react-stately";
16
- import { hashKey, useInfiniteQuery, useQuery, useQueryClient } from "@tanstack/react-query";
17
16
  import pixelmatch from "pixelmatch";
18
17
  // src/lib/chords.ts
19
18
  /** The platform this page runs on, read from the browser (`mac` for macOS and iOS). Server and test default: `other`. */
@@ -533,6 +532,26 @@ function ToggleGroupView({ label, options, value, onChange, size = "default", cl
533
532
  })
534
533
  });
535
534
  }
535
+ // src/components/pause-button.tsx
536
+ /** The pause control of a polled screen: a "Pause updates" toggle and when the readings were last taken ("Updated 12:00"). Takes the `Poll` from `usePoll`. */
537
+ function PauseButton({ poll, hideUpdated = false, className }) {
538
+ const when = poll.updatedAt ? format.clock(poll.updatedAt) : null;
539
+ return /* @__PURE__ */ jsxs("div", {
540
+ className: cn("inline-flex flex-wrap items-center gap-x-3 gap-y-1", className),
541
+ children: [!hideUpdated && /* @__PURE__ */ jsx("span", {
542
+ role: "status",
543
+ "aria-live": "off",
544
+ className: "type-caption text-muted-foreground tabular-nums",
545
+ children: poll.paused ? when ? `Paused. Last updated ${when}` : "Paused" : when ? `Updated ${when}` : "Not read yet"
546
+ }), /* @__PURE__ */ jsx(Toggle, {
547
+ label: "Pause updates",
548
+ icon: Pause,
549
+ size: "sm",
550
+ pressed: poll.paused,
551
+ onChange: () => poll.toggle()
552
+ })]
553
+ });
554
+ }
536
555
  // src/components/switch.tsx
537
556
  /** An on/off setting that applies at once, its label and control one target. */
538
557
  function Switch({ label, detail, on, defaultOn, onChange, disabled, className }) {
@@ -989,6 +1008,486 @@ function Meter({ label, value, max = 1, valueText, detail, thresholds, worseWhen
989
1008
  ]
990
1009
  });
991
1010
  }
1011
+ // src/lib/base.ts
1012
+ /**
1013
+ * Where the app is mounted: the path of the page's `<base href>` without its trailing slash, `""` at the root or where there is no base (SSR, a plain page).
1014
+ * Give it to React Router as `createBrowserRouter(routes, { basename: appBase() || "/" })`.
1015
+ */
1016
+ function appBase(doc = typeof document === "undefined" ? void 0 : document) {
1017
+ if (!doc?.querySelector("base[href]")) return "";
1018
+ return new URL(".", doc.baseURI).pathname.replace(/\/$/, "");
1019
+ }
1020
+ /**
1021
+ * Puts the app's base in front of a root-relative path (`/api/learners` becomes `/proxy/api/learners` behind a proxy).
1022
+ * Anything else (a relative path, a full URL, a protocol-relative `//host`) is returned as it is. Use it for every `fetch`, `<img src>` and download link the app builds; in-app links are router paths and need none.
1023
+ */
1024
+ function withBase(path, base = appBase()) {
1025
+ return path.startsWith("/") && !path.startsWith("//") ? base + path : path;
1026
+ }
1027
+ // src/query/api.ts
1028
+ var isRaw = (body) => typeof Blob !== "undefined" && body instanceof Blob || body instanceof ArrayBuffer || ArrayBuffer.isView(body) || typeof FormData !== "undefined" && body instanceof FormData || body instanceof URLSearchParams || typeof ReadableStream !== "undefined" && body instanceof ReadableStream;
1029
+ /**
1030
+ * A small client over `fetchJson` for the app's own server: root-relative paths get the app's base (so it works behind a reverse proxy),
1031
+ * and `post`, `put` and `patch` send their body as JSON (a `Blob`, bytes, `FormData` or a stream is sent as it is, with the Blob's own type). `api.post<Learner>("/api/learners", { nickname })`.
1032
+ */
1033
+ function createApi({ base, ...options } = {}) {
1034
+ const url = (path) => withBase(path, base ?? appBase());
1035
+ const send = (method, path, body, init) => fetchJson(url(path), {
1036
+ ...init,
1037
+ method,
1038
+ ...body === void 0 ? {} : isRaw(body) ? { body } : { json: body }
1039
+ }, options);
1040
+ return {
1041
+ url,
1042
+ get: (path, init) => send("GET", path, void 0, init),
1043
+ post: (path, body, init) => send("POST", path, body, init),
1044
+ put: (path, body, init) => send("PUT", path, body, init),
1045
+ patch: (path, body, init) => send("PATCH", path, body, init),
1046
+ delete: (path, init) => send("DELETE", path, void 0, init)
1047
+ };
1048
+ }
1049
+ // src/query/typed-api.ts
1050
+ function fill(path, values, query) {
1051
+ const filled = path.replace(/\{([^}]+)\}/g, (_, name) => {
1052
+ const value = values?.[name];
1053
+ if (value === void 0 || value === null) throw new Error(`strata-react: the path ${path} needs "${name}" in \`path\``);
1054
+ return encodeURIComponent(String(value));
1055
+ });
1056
+ const search = new URLSearchParams();
1057
+ for (const [key, value] of Object.entries(query ?? {})) for (const item of Array.isArray(value) ? value : [value]) if (item !== void 0 && item !== null) search.append(key, String(item));
1058
+ const text = search.toString();
1059
+ return text ? `${filled}${filled.includes("?") ? "&" : "?"}${text}` : filled;
1060
+ }
1061
+ /**
1062
+ * `createApi` typed by the server's schema: `const api = createTypedApi<paths>()`, then `api.post("/api/learners", { json: { nickname } })` and
1063
+ * `api.get("/api/learners/{id}", { path: { id } })`; the path, `path` and `query` values, `json` and the answer are checked, and `{id}` is filled and escaped.
1064
+ */
1065
+ function createTypedApi(options = {}) {
1066
+ const api = createApi(options);
1067
+ const call = (method) => (path, request) => {
1068
+ const { path: values, query, json, body, ...init } = request ?? {};
1069
+ const target = fill(path, values, query);
1070
+ const rest = init;
1071
+ return method === "get" ? api.get(target, rest) : method === "delete" ? api.delete(target, rest) : api[method](target, body ?? json, rest);
1072
+ };
1073
+ return {
1074
+ url: api.url,
1075
+ get: call("get"),
1076
+ post: call("post"),
1077
+ put: call("put"),
1078
+ patch: call("patch"),
1079
+ delete: call("delete")
1080
+ };
1081
+ }
1082
+ // src/query/infinite.ts
1083
+ /** `useInfiniteQuery` for cursor-paged data, returned as an `InfiniteLoad<T>` for `InfiniteList` (or `DataView`). */
1084
+ function useInfiniteLoad({ queryKey, queryFn, items, itemKey, hasMore = () => false, nextCursor, cursorAfter = itemKey, isRemoved, describeError = describeHttpError, enabled, staleTime }) {
1085
+ const queryHash = hashKey(queryKey);
1086
+ const [stored, setStored] = React.useState(() => ({
1087
+ query: queryHash,
1088
+ keys: /* @__PURE__ */ new Set()
1089
+ }));
1090
+ const dismissed = stored.query === queryHash ? stored.keys : none;
1091
+ const hidden = React.useCallback((key) => dismissed.has(key) || (isRemoved?.(key) ?? false), [dismissed, isRemoved]);
1092
+ const latest = React.useRef({
1093
+ hidden,
1094
+ items,
1095
+ itemKey,
1096
+ hasMore,
1097
+ cursorAfter,
1098
+ nextCursor
1099
+ });
1100
+ latest.current = {
1101
+ hidden,
1102
+ items,
1103
+ itemKey,
1104
+ hasMore,
1105
+ cursorAfter,
1106
+ nextCursor
1107
+ };
1108
+ const query = useInfiniteQuery({
1109
+ queryKey,
1110
+ queryFn: ({ pageParam, signal }) => queryFn({
1111
+ cursor: pageParam.cursor,
1112
+ signal
1113
+ }),
1114
+ initialPageParam: { cursor: void 0 },
1115
+ getNextPageParam: (lastPage, pages) => {
1116
+ const l = latest.current;
1117
+ if (l.nextCursor) {
1118
+ const next = l.nextCursor(lastPage);
1119
+ return next === null ? null : { cursor: next };
1120
+ }
1121
+ if (!l.hasMore(lastPage)) return null;
1122
+ const after = nextAfter(pages, l.items, l.itemKey, l.hidden);
1123
+ return { cursor: after === void 0 ? void 0 : l.cursorAfter(after) };
1124
+ },
1125
+ enabled,
1126
+ staleTime
1127
+ });
1128
+ const pages = query.data?.pages;
1129
+ const list = React.useMemo(() => pages ? merge(pages, latest.current.items, latest.current.itemKey, hidden).held : void 0, [pages, hidden]);
1130
+ const { hasNextPage, isFetchingNextPage, fetchNextPage, refetch } = query;
1131
+ const loadMore = React.useCallback(() => {
1132
+ if (hasNextPage && !isFetchingNextPage) fetchNextPage();
1133
+ }, [
1134
+ hasNextPage,
1135
+ isFetchingNextPage,
1136
+ fetchNextPage
1137
+ ]);
1138
+ const change = React.useCallback((edit) => setStored((s) => {
1139
+ const keys = new Set(s.query === queryHash ? s.keys : none);
1140
+ edit(keys);
1141
+ return {
1142
+ query: queryHash,
1143
+ keys
1144
+ };
1145
+ }), [queryHash]);
1146
+ const dismiss = React.useCallback((key) => change((keys) => keys.add(key)), [change]);
1147
+ const restore = React.useCallback((key) => change((keys) => keys.delete(key)), [change]);
1148
+ const extra = {
1149
+ more: {
1150
+ hasMore: Boolean(hasNextPage),
1151
+ loadingMore: isFetchingNextPage,
1152
+ error: query.isFetchNextPageError ? describeError(query.error) : void 0,
1153
+ loadMore
1154
+ },
1155
+ itemKey,
1156
+ dismiss,
1157
+ restore
1158
+ };
1159
+ if (list) {
1160
+ const stale = query.isRefetchError ? staleOf(query, describeError) : void 0;
1161
+ return {
1162
+ status: "ready",
1163
+ data: list,
1164
+ ...stale && { stale },
1165
+ ...extra
1166
+ };
1167
+ }
1168
+ if (query.status === "error") return {
1169
+ status: "error",
1170
+ message: describeError(query.error),
1171
+ retry: () => void refetch(),
1172
+ ...extra
1173
+ };
1174
+ return {
1175
+ status: "loading",
1176
+ ...extra
1177
+ };
1178
+ }
1179
+ var none = /* @__PURE__ */ new Set();
1180
+ /** Every page's items, in order, once each by key: the ones held (not dismissed) and the last one seen. */
1181
+ function merge(pages, items, itemKey, hidden) {
1182
+ const seen = /* @__PURE__ */ new Set();
1183
+ const held = [];
1184
+ let last;
1185
+ let lastPageAddedAny = false;
1186
+ pages.forEach((page, p) => {
1187
+ for (const item of items(page)) {
1188
+ const key = itemKey(item);
1189
+ if (seen.has(key)) continue;
1190
+ seen.add(key);
1191
+ last = item;
1192
+ if (p === pages.length - 1) lastPageAddedAny = true;
1193
+ if (!hidden(key)) held.push(item);
1194
+ }
1195
+ });
1196
+ return {
1197
+ held,
1198
+ last,
1199
+ lastPageAddedAny
1200
+ };
1201
+ }
1202
+ /** The item the next page goes after: the last held, or the last seen when nothing is held or the last page brought nothing new. */
1203
+ function nextAfter(pages, items, itemKey, hidden) {
1204
+ const { held, last, lastPageAddedAny } = merge(pages, items, itemKey, hidden);
1205
+ if (held.length === 0 || pages.length > 1 && !lastPageAddedAny) return last;
1206
+ return held[held.length - 1];
1207
+ }
1208
+ /** `useInfiniteLoad`'s `items` and `nextCursor` for the shared `Page<T>` shape: `useInfiniteLoad({ queryKey, queryFn, itemKey, ...apiPage<Item>() })`. */
1209
+ function apiPage() {
1210
+ return {
1211
+ items: (page) => page.items,
1212
+ nextCursor: (page) => page.next
1213
+ };
1214
+ }
1215
+ // src/query/job.ts
1216
+ /** A long-running job's status: polled every `every` ms while `isRunning`, with the `invalidates` queries read again once when it ends. */
1217
+ function useJob({ isRunning, every = 2e3, invalidates = [], describeError, ...options }) {
1218
+ const client = useQueryClient();
1219
+ const query = useQuery({
1220
+ ...options,
1221
+ refetchInterval: (q) => q.state.data !== void 0 && isRunning(q.state.data) ? every : false
1222
+ });
1223
+ const running = query.data !== void 0 && isRunning(query.data);
1224
+ const queryHash = hashKey(options.queryKey);
1225
+ const seen = query.data === void 0 ? void 0 : running;
1226
+ const was = React.useRef(void 0);
1227
+ React.useEffect(() => {
1228
+ if (seen === void 0) return;
1229
+ const before = was.current;
1230
+ if (before && before.query === queryHash && before.running && !seen) for (const queryKey of before.invalidates) client.invalidateQueries({ queryKey });
1231
+ was.current = {
1232
+ query: queryHash,
1233
+ running: seen,
1234
+ invalidates
1235
+ };
1236
+ });
1237
+ const { refetch } = query;
1238
+ const poll = React.useCallback(() => void refetch(), [refetch]);
1239
+ return {
1240
+ ...toLoad(query, describeError),
1241
+ running,
1242
+ poll
1243
+ };
1244
+ }
1245
+ /** Whether a task of the shared contract (`strata_python.contracts.Task`) is still going: its `state` is not one of the finished ones. Pass the generated `FINISHED`; for `useJob({ isRunning: (t) => isTaskRunning(t, FINISHED) })`. */
1246
+ function isTaskRunning(task, finished) {
1247
+ return !(Array.isArray(finished) ? finished.includes(task.state) : finished.has(task.state));
1248
+ }
1249
+ // src/query/workflow.ts
1250
+ /** Whether the queue job advancing a workflow run is still going. `finished` is the generated `FINISHED` (or `["done", "failed", "cancelled"]`). */
1251
+ function isWorkflowRunning(run, finished) {
1252
+ return run.job != null && isTaskRunning(run.job, finished);
1253
+ }
1254
+ /** A subject's `WorkflowRun`: polled while its job runs, its `invalidates` read again once when it ends. */
1255
+ function useWorkflowRun({ finished, ...options }) {
1256
+ return useJob({
1257
+ ...options,
1258
+ isRunning: (run) => isWorkflowRunning(run, finished)
1259
+ });
1260
+ }
1261
+ // src/components/system-panel.tsx
1262
+ /** The shared limits for a folder's disk, as shares of its size: filling up at 80%, nearly full at 95%. */
1263
+ var diskThresholds = [{
1264
+ at: .8,
1265
+ tone: "warning",
1266
+ label: "Filling up"
1267
+ }, {
1268
+ at: .95,
1269
+ tone: "danger",
1270
+ label: "Nearly full"
1271
+ }];
1272
+ /** Reads `GET /api/system` (or another path) as a `Load` for `SystemPanel`, polled when given a `Poll`. Behind a reverse proxy the path is put under the app's base. */
1273
+ function useSystemInfo({ path = "/api/system", poll } = {}) {
1274
+ return useLoad({
1275
+ queryKey: [
1276
+ "strata",
1277
+ "system",
1278
+ path
1279
+ ],
1280
+ queryFn: () => fetchJson(withBase(path)),
1281
+ poll
1282
+ });
1283
+ }
1284
+ function Fact({ term, children }) {
1285
+ return /* @__PURE__ */ jsxs("div", {
1286
+ className: "flex gap-6",
1287
+ children: [/* @__PURE__ */ jsx("dt", {
1288
+ className: "w-28 shrink-0 text-muted-foreground",
1289
+ children: term
1290
+ }), /* @__PURE__ */ jsx("dd", {
1291
+ className: "min-w-0",
1292
+ children
1293
+ })]
1294
+ });
1295
+ }
1296
+ /** "301.6 GB of 512 GB": both in the larger figure's unit, so they read as one comparison. */
1297
+ function ofSize(used, size) {
1298
+ const unit = format.byteUnit(size);
1299
+ return `${format.bytes(used, unit)} of ${format.bytes(size, unit)}`;
1300
+ }
1301
+ function PanelHeading({ id, level, children }) {
1302
+ return React.createElement(`h${level}`, {
1303
+ id,
1304
+ className: "type-heading"
1305
+ }, children);
1306
+ }
1307
+ function SystemSkeleton() {
1308
+ return /* @__PURE__ */ jsxs("div", {
1309
+ className: "grid gap-8",
1310
+ "aria-hidden": true,
1311
+ children: [
1312
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-28 w-full max-w-xl" }),
1313
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-24 w-full max-w-xl" }),
1314
+ /* @__PURE__ */ jsx(Skeleton, { className: "h-16 w-full max-w-xl" })
1315
+ ]
1316
+ });
1317
+ }
1318
+ function FolderRow({ folder, thresholds }) {
1319
+ const { name, path, exists, free_bytes: free, total_bytes: total } = folder;
1320
+ const where = /* @__PURE__ */ jsx("span", {
1321
+ className: "font-mono type-body-sm text-muted-foreground break-all",
1322
+ children: path
1323
+ });
1324
+ if (!exists) return /* @__PURE__ */ jsxs("div", {
1325
+ className: "grid gap-1.5",
1326
+ children: [/* @__PURE__ */ jsxs("div", {
1327
+ className: "flex items-center justify-between gap-3",
1328
+ children: [/* @__PURE__ */ jsx("span", {
1329
+ className: "type-label",
1330
+ children: name
1331
+ }), /* @__PURE__ */ jsx(Status, {
1332
+ tone: "warning",
1333
+ icon: FolderX,
1334
+ children: "Missing"
1335
+ })]
1336
+ }), where]
1337
+ });
1338
+ if (free == null || total == null || total <= 0) return /* @__PURE__ */ jsxs("div", {
1339
+ className: "grid gap-1.5",
1340
+ children: [/* @__PURE__ */ jsxs("div", {
1341
+ className: "flex items-center justify-between gap-3",
1342
+ children: [/* @__PURE__ */ jsx("span", {
1343
+ className: "type-label",
1344
+ children: name
1345
+ }), /* @__PURE__ */ jsx(Status, {
1346
+ tone: "neutral",
1347
+ children: "Not measured"
1348
+ })]
1349
+ }), where]
1350
+ });
1351
+ return /* @__PURE__ */ jsxs("div", {
1352
+ className: "grid gap-1.5",
1353
+ children: [/* @__PURE__ */ jsx(Meter, {
1354
+ label: `${name} folder disk space used`,
1355
+ value: total - free,
1356
+ max: total,
1357
+ thresholds,
1358
+ detail: ofSize(total - free, total)
1359
+ }), where]
1360
+ });
1361
+ }
1362
+ function ServiceRow({ service }) {
1363
+ return /* @__PURE__ */ jsxs("li", {
1364
+ className: "flex flex-wrap items-baseline gap-x-3 gap-y-0.5",
1365
+ children: [
1366
+ /* @__PURE__ */ jsx("span", {
1367
+ className: "type-label",
1368
+ children: service.name
1369
+ }),
1370
+ service.ok ? /* @__PURE__ */ jsx(Status, {
1371
+ tone: "success",
1372
+ icon: CircleCheck,
1373
+ children: "Up"
1374
+ }) : /* @__PURE__ */ jsx(Status, {
1375
+ tone: "danger",
1376
+ icon: CircleAlert,
1377
+ children: "Down"
1378
+ }),
1379
+ service.version && /* @__PURE__ */ jsxs("span", {
1380
+ className: "type-body-sm text-muted-foreground tabular-nums",
1381
+ children: ["version ", service.version]
1382
+ }),
1383
+ !service.ok && service.detail && /* @__PURE__ */ jsx("span", {
1384
+ className: "type-body-sm text-danger",
1385
+ children: service.detail
1386
+ })
1387
+ ]
1388
+ });
1389
+ }
1390
+ /** About this server, from `GET /api/system`: version and commit, when it started, each folder's disk as a meter with its state in words, and each service as Up or Down. Loaded through `DataView`, with a skeleton and the stale notice. */
1391
+ function SystemPanel({ load, thresholds = diskThresholds, facts = [], now, headingLevel = 2, className }) {
1392
+ const headings = {
1393
+ folders: React.useId(),
1394
+ services: React.useId(),
1395
+ server: React.useId()
1396
+ };
1397
+ return /* @__PURE__ */ jsx(DataView$1, {
1398
+ state: load,
1399
+ isEmpty: () => false,
1400
+ skeleton: /* @__PURE__ */ jsx(SystemSkeleton, {}),
1401
+ staleNotice: (stale) => /* @__PURE__ */ jsx(StaleNotice, {
1402
+ stale,
1403
+ shown: (when) => `These readings are from ${when}.`
1404
+ }),
1405
+ empty: /* @__PURE__ */ jsx(EmptyState, {
1406
+ title: "No readings",
1407
+ children: "The server sent nothing to report."
1408
+ }),
1409
+ className,
1410
+ children: (s) => /* @__PURE__ */ jsxs("div", {
1411
+ className: "grid max-w-xl gap-8",
1412
+ children: [
1413
+ /* @__PURE__ */ jsxs("section", {
1414
+ "aria-labelledby": headings.server,
1415
+ className: "grid gap-3",
1416
+ children: [/* @__PURE__ */ jsx(PanelHeading, {
1417
+ id: headings.server,
1418
+ level: headingLevel,
1419
+ children: "Server"
1420
+ }), /* @__PURE__ */ jsxs("dl", {
1421
+ className: "grid gap-2 type-body-sm",
1422
+ children: [
1423
+ /* @__PURE__ */ jsx(Fact, {
1424
+ term: "Version",
1425
+ children: /* @__PURE__ */ jsx("span", {
1426
+ className: "tabular-nums",
1427
+ children: s.version
1428
+ })
1429
+ }),
1430
+ /* @__PURE__ */ jsx(Fact, {
1431
+ term: "Source",
1432
+ children: s.commit ? /* @__PURE__ */ jsx("span", {
1433
+ className: "font-mono",
1434
+ title: s.commit,
1435
+ children: s.commit.slice(0, 12)
1436
+ }) : "Installed package"
1437
+ }),
1438
+ /* @__PURE__ */ jsxs(Fact, {
1439
+ term: "Started",
1440
+ children: [format.dateTime(s.started_at), /* @__PURE__ */ jsxs("span", {
1441
+ className: "ml-2 text-muted-foreground tabular-nums",
1442
+ children: ["up ", format.duration(((now ?? /* @__PURE__ */ new Date()).getTime() - new Date(s.started_at).getTime()) / 1e3, { style: "parts" })]
1443
+ })]
1444
+ }),
1445
+ /* @__PURE__ */ jsx(Fact, {
1446
+ term: "Python",
1447
+ children: /* @__PURE__ */ jsx("span", {
1448
+ className: "tabular-nums",
1449
+ children: s.python
1450
+ })
1451
+ }),
1452
+ /* @__PURE__ */ jsx(Fact, {
1453
+ term: "Platform",
1454
+ children: s.platform
1455
+ }),
1456
+ facts.map((f) => /* @__PURE__ */ jsx(Fact, {
1457
+ term: f.term,
1458
+ children: f.value
1459
+ }, f.term))
1460
+ ]
1461
+ })]
1462
+ }),
1463
+ s.folders.length > 0 && /* @__PURE__ */ jsxs("section", {
1464
+ "aria-labelledby": headings.folders,
1465
+ className: "grid gap-3",
1466
+ children: [/* @__PURE__ */ jsx(PanelHeading, {
1467
+ id: headings.folders,
1468
+ level: headingLevel,
1469
+ children: "Folders"
1470
+ }), s.folders.map((f) => /* @__PURE__ */ jsx(FolderRow, {
1471
+ folder: f,
1472
+ thresholds
1473
+ }, f.name))]
1474
+ }),
1475
+ s.services.length > 0 && /* @__PURE__ */ jsxs("section", {
1476
+ "aria-labelledby": headings.services,
1477
+ className: "grid gap-3",
1478
+ children: [/* @__PURE__ */ jsx(PanelHeading, {
1479
+ id: headings.services,
1480
+ level: headingLevel,
1481
+ children: "Services"
1482
+ }), /* @__PURE__ */ jsx("ul", {
1483
+ className: "grid gap-2",
1484
+ children: s.services.map((svc) => /* @__PURE__ */ jsx(ServiceRow, { service: svc }, svc.name))
1485
+ })]
1486
+ })
1487
+ ]
1488
+ })
1489
+ });
1490
+ }
992
1491
  // src/components/composition.tsx
993
1492
  var MAX_TOKENS = 5;
994
1493
  /** A part's colour: its own, or the chart token for its position. Throws past the fifth token. */
@@ -1103,8 +1602,17 @@ function CompositionBar({ label, parts, formatValue, formatShare = format.share,
1103
1602
  });
1104
1603
  }
1105
1604
  // src/components/link-card.tsx
1605
+ /** True when `href` is on another origin than the page (a relative one never is). Unreadable is treated as leaving. */
1606
+ function leavesSite(href) {
1607
+ if (typeof window === "undefined") return false;
1608
+ try {
1609
+ return new URL(href, window.location.href).origin !== window.location.origin;
1610
+ } catch {
1611
+ return true;
1612
+ }
1613
+ }
1106
1614
  /** A destination as a card that is one link: its title is the link's name, the description and status marks are its description, and the whole card is the target. */
1107
- function LinkCard({ title, description, marks, as: Heading = "h3", className, ...destination }) {
1615
+ function LinkCard({ title, description, marks, as: Heading = "h3", className, external, ...destination }) {
1108
1616
  const descriptionId = React.useId();
1109
1617
  const marksId = React.useId();
1110
1618
  const describedBy = [description && descriptionId, marks && marksId].filter(Boolean).join(" ") || void 0;
@@ -1119,7 +1627,7 @@ function LinkCard({ title, description, marks, as: Heading = "h3", className, ..
1119
1627
  "aria-describedby": describedBy,
1120
1628
  className: linkClass,
1121
1629
  children: title
1122
- }), /* @__PURE__ */ jsx(ArrowUpRight, {
1630
+ }), (external ?? leavesSite(destination.href)) && /* @__PURE__ */ jsx(ArrowUpRight, {
1123
1631
  "aria-hidden": true,
1124
1632
  className: "mt-0.5 size-4 shrink-0 text-muted-foreground"
1125
1633
  })] }) : /* @__PURE__ */ jsx(Link$1, {
@@ -1153,105 +1661,6 @@ function LinkCardList({ label, children, className }) {
1153
1661
  }, React.isValidElement(child) && child.key != null ? child.key : i))
1154
1662
  });
1155
1663
  }
1156
- // src/components/data-view.tsx
1157
- /** The default failed-read panel: the reason on the danger tint, with Try again. Its parent carries `role="alert"`. */
1158
- function LoadError({ message, retry, className }) {
1159
- return /* @__PURE__ */ jsxs("div", {
1160
- className: cn("flex flex-wrap items-start gap-3 rounded-surface bg-danger-subtle p-4 text-danger", className),
1161
- children: [
1162
- /* @__PURE__ */ jsx(CircleAlert, {
1163
- "aria-hidden": true,
1164
- className: "mt-0.5 size-5 shrink-0"
1165
- }),
1166
- /* @__PURE__ */ jsx("p", {
1167
- className: "min-w-0 flex-1 type-body",
1168
- children: message
1169
- }),
1170
- /* @__PURE__ */ jsxs(Button, {
1171
- size: "sm",
1172
- onClick: retry,
1173
- children: [/* @__PURE__ */ jsx(RotateCcw, { "aria-hidden": true }), "Try again"]
1174
- })
1175
- ]
1176
- });
1177
- }
1178
- var defaultError = (failure) => /* @__PURE__ */ jsx(LoadError, { ...failure });
1179
- /** Every view of remote data: renders `skeleton` while loading, an alert with Try again on error, `empty` when `isEmpty`, else `children(data)`, under a `StaleNotice` when a refresh failed. The skeleton and empty state are required. */
1180
- function DataView$1({ state, isEmpty, skeleton, empty, children, staleNotice = (stale) => /* @__PURE__ */ jsx(StaleNotice, { stale }), error = defaultError, className }) {
1181
- return /* @__PURE__ */ jsxs("div", {
1182
- className: cn("min-w-0", className),
1183
- "aria-busy": state.status === "loading" || void 0,
1184
- children: [
1185
- state.status === "loading" && skeleton,
1186
- state.status === "error" && /* @__PURE__ */ jsx("div", {
1187
- role: "alert",
1188
- children: error({
1189
- message: state.message,
1190
- retry: state.retry
1191
- })
1192
- }),
1193
- state.status === "ready" && /* @__PURE__ */ jsxs(Fragment, { children: [state.stale && staleNotice(state.stale), isEmpty(state.data) ? empty : children(state.data)] })
1194
- ]
1195
- });
1196
- }
1197
- /** When `readAt` was, for a person: the clock time today, else the weekday and time. */
1198
- function readTime(readAt, now = /* @__PURE__ */ new Date()) {
1199
- return readAt.toDateString() === now.toDateString() ? format.clock.format(readAt) : format.shortDay.format(readAt);
1200
- }
1201
- /** The notice over data whose refresh failed: what happened, how old the data shown is, and Try again. A polite status, not an alert: nothing was lost. */
1202
- function StaleNotice({ stale, shown, className }) {
1203
- return /* @__PURE__ */ jsxs("div", {
1204
- role: "status",
1205
- className: cn("mb-4 flex flex-wrap items-start gap-3 rounded-surface bg-warning-subtle p-3 text-warning", className),
1206
- children: [
1207
- /* @__PURE__ */ jsx(History, {
1208
- "aria-hidden": true,
1209
- className: "mt-0.5 size-4 shrink-0"
1210
- }),
1211
- /* @__PURE__ */ jsxs("p", {
1212
- className: "min-w-0 flex-1 type-body-sm",
1213
- children: [
1214
- stale.message,
1215
- " ",
1216
- shown ? shown(readTime(stale.readAt)) : `Showing data from ${readTime(stale.readAt)}.`
1217
- ]
1218
- }),
1219
- /* @__PURE__ */ jsxs(Button, {
1220
- size: "sm",
1221
- onClick: stale.retry,
1222
- disabled: stale.retrying,
1223
- children: [/* @__PURE__ */ jsx(RotateCcw, { "aria-hidden": true }), stale.retrying ? "Trying again…" : "Try again"]
1224
- })
1225
- ]
1226
- });
1227
- }
1228
- /** An empty state that teaches the next action: a title, a sentence and an action. No illustration slot, on purpose. */
1229
- function EmptyState({ title, children, action }) {
1230
- return /* @__PURE__ */ jsxs("div", {
1231
- className: "grid justify-items-start gap-2 border-y border-border py-6",
1232
- children: [
1233
- /* @__PURE__ */ jsx("p", {
1234
- className: "type-heading",
1235
- children: title
1236
- }),
1237
- children && /* @__PURE__ */ jsx("p", {
1238
- className: "max-w-prose type-body text-muted-foreground",
1239
- children
1240
- }),
1241
- action && /* @__PURE__ */ jsx("div", {
1242
- className: "mt-2",
1243
- children: action
1244
- })
1245
- ]
1246
- });
1247
- }
1248
- /** A placeholder block for a loading layout. Size it with layout classes so it mirrors the final content. */
1249
- function Skeleton({ className }) {
1250
- return /* @__PURE__ */ jsx("div", {
1251
- "aria-hidden": true,
1252
- className: cn("rounded-control bg-muted motion-safe:animate-pulse", className)
1253
- });
1254
- }
1255
1664
  // src/components/secret-field.tsx
1256
1665
  var input = "w-full min-w-0 rounded-control border border-input bg-background pl-3 pr-1 type-body text-foreground transition-state placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-70 aria-invalid:border-danger";
1257
1666
  /** A credential the server keeps and never shows again: "Not set", "Set" (no characters, not even its length), a masked entry with a named Show toggle, Replace, a confirmed Remove that says what stops working, and a Test with its result beside it. A set, untouched field reports nothing. */
@@ -1810,7 +2219,7 @@ var DEFAULT_WORDS = {
1810
2219
  waiting: "Needs review",
1811
2220
  blocked: "Waiting"
1812
2221
  };
1813
- var LOOKS$1 = {
2222
+ var LOOKS$2 = {
1814
2223
  done: {
1815
2224
  tone: "success",
1816
2225
  icon: Check
@@ -1837,7 +2246,7 @@ var LOOKS$1 = {
1837
2246
  }
1838
2247
  };
1839
2248
  function wordOf(stage, words) {
1840
- const state = stage.state in LOOKS$1 ? stage.state : "blocked";
2249
+ const state = stage.state in LOOKS$2 ? stage.state : "blocked";
1841
2250
  if (state === "done" && stage.gate) return words.approved;
1842
2251
  return words[state];
1843
2252
  }
@@ -1872,11 +2281,11 @@ function WorkflowSteps({ label, stages, onApprove, onRetry, words, now, classNam
1872
2281
  "aria-label": label,
1873
2282
  className: cn("grid min-w-0 gap-0 divide-y divide-border", className),
1874
2283
  children: stages.map((stage) => {
1875
- const state = stage.state in LOOKS$1 ? stage.state : "blocked";
2284
+ const state = stage.state in LOOKS$2 ? stage.state : "blocked";
1876
2285
  const look = stage.state === "done" && stage.gate ? {
1877
2286
  tone: "success",
1878
2287
  icon: Check
1879
- } : LOOKS$1[state];
2288
+ } : LOOKS$2[state];
1880
2289
  const detail = detailOf(stage, now);
1881
2290
  const error = state === "failed" ? stage.last?.error : null;
1882
2291
  return /* @__PURE__ */ jsxs("li", {
@@ -1929,6 +2338,35 @@ function WorkflowSteps({ label, stages, onApprove, onRetry, words, now, classNam
1929
2338
  })
1930
2339
  });
1931
2340
  }
2341
+ // src/lib/breakpoint.ts
2342
+ var DEFAULTS = {
2343
+ sm: "40rem",
2344
+ md: "48rem",
2345
+ lg: "64rem"
2346
+ };
2347
+ function width(name) {
2348
+ if (typeof document === "undefined") return DEFAULTS[name];
2349
+ return getComputedStyle(document.documentElement).getPropertyValue(`--breakpoint-${name}`).trim() || DEFAULTS[name];
2350
+ }
2351
+ /** The breakpoints the screen is currently narrower than. Empty on the server and where `matchMedia` is missing (jsdom), so nothing is hidden there. */
2352
+ function useNarrowerThan(active) {
2353
+ const [below, setBelow] = React.useState(() => /* @__PURE__ */ new Set());
2354
+ React.useEffect(() => {
2355
+ if (!active || typeof matchMedia !== "function") return;
2356
+ const queries = [
2357
+ "sm",
2358
+ "md",
2359
+ "lg"
2360
+ ].map((name) => [name, matchMedia(`(width < ${width(name)})`)]);
2361
+ const read = () => setBelow(new Set(queries.filter(([, q]) => q.matches).map(([name]) => name)));
2362
+ read();
2363
+ for (const [, q] of queries) q.addEventListener("change", read);
2364
+ return () => {
2365
+ for (const [, q] of queries) q.removeEventListener("change", read);
2366
+ };
2367
+ }, [active]);
2368
+ return below;
2369
+ }
1932
2370
  // src/lib/choice.ts
1933
2371
  function resolve(explicit, implies) {
1934
2372
  const all = new Set(explicit);
@@ -2379,8 +2817,21 @@ var features = tableFeatures({
2379
2817
  rowSortingFeature,
2380
2818
  sortedRowModel: createSortedRowModel()
2381
2819
  });
2382
- function Table$1({ caption, columns, rows, rowKey, sortState: [sort, setSort], virtualizeFrom = 100, maxHeight = 480, selection, expansion, className }) {
2383
- const defs = React.useMemo(() => columns.map((c) => {
2820
+ var HIDE_BELOW = {
2821
+ sm: "max-sm:hidden",
2822
+ md: "max-md:hidden",
2823
+ lg: "max-lg:hidden"
2824
+ };
2825
+ function Table$1({ caption, columns: allColumns, rows, rowKey, sortState: [sort, setSort], virtualizeFrom = 100, maxHeight = 480, selection, expansion, className }) {
2826
+ const willVirtualize = rows.length >= virtualizeFrom;
2827
+ const narrower = useNarrowerThan(willVirtualize && allColumns.some((c) => c.hideBelow));
2828
+ const columns = React.useMemo(() => willVirtualize ? allColumns.filter((c, i) => i === 0 || !c.hideBelow || !narrower.has(c.hideBelow)) : allColumns, [
2829
+ allColumns,
2830
+ willVirtualize,
2831
+ narrower
2832
+ ]);
2833
+ const hiddenBelow = (c, i) => i > 0 && c.hideBelow ? HIDE_BELOW[c.hideBelow] : void 0;
2834
+ const defs = React.useMemo(() => allColumns.map((c) => {
2384
2835
  const { value, sort } = c;
2385
2836
  if (!value) return {
2386
2837
  id: c.key,
@@ -2403,9 +2854,9 @@ function Table$1({ caption, columns, rows, rowKey, sortState: [sort, setSort], v
2403
2854
  sortUndefined: "last",
2404
2855
  sortFn: sort ? (a, b) => sort(a.original, b.original) : (a, b) => compareValues(a.getValue(c.key), b.getValue(c.key))
2405
2856
  };
2406
- }), [columns]);
2857
+ }), [allColumns]);
2407
2858
  const sortable = (c) => c.value ? c.sort !== false : Boolean(c.sort);
2408
- const sorting = sort && columns.some((c) => c.key === sort.key && sortable(c)) ? [{
2859
+ const sorting = sort && allColumns.some((c) => c.key === sort.key && sortable(c)) ? [{
2409
2860
  id: sort.key,
2410
2861
  desc: sort.dir === "descending"
2411
2862
  }] : [];
@@ -2503,7 +2954,7 @@ function Table$1({ caption, columns, rows, rowKey, sortState: [sort, setSort], v
2503
2954
  isRowHeader: i === 0,
2504
2955
  allowsSorting: sortable(c),
2505
2956
  width: c.numeric ? "0.6fr" : "1fr",
2506
- className: cn("py-2 text-left align-bottom type-caption font-normal text-muted-foreground outline-offset-[-2px]", i < columns.length - 1 && "pr-4", c.numeric && "text-right"),
2957
+ className: cn("py-2 text-left align-bottom type-caption font-normal text-muted-foreground outline-offset-[-2px]", i < columns.length - 1 && "pr-4", c.numeric && "text-right", hiddenBelow(c, i)),
2507
2958
  children: ({ allowsSorting, sortDirection }) => {
2508
2959
  const Icon = sortDirection === "ascending" ? ArrowUp : sortDirection === "descending" ? ArrowDown : ArrowUpDown;
2509
2960
  const label = c.hideHeader ? /* @__PURE__ */ jsx("span", {
@@ -2554,7 +3005,7 @@ function Table$1({ caption, columns, rows, rowKey, sortState: [sort, setSort], v
2554
3005
  columns.map((c, i) => {
2555
3006
  const cell = cells.get(c.key);
2556
3007
  return /* @__PURE__ */ jsx(Cell, {
2557
- className: cn("py-2.5 align-middle", i < columns.length - 1 && "pr-4", c.numeric && "text-right tabular-nums", c.truncate && "max-w-48 truncate", c.className),
3008
+ className: cn("py-2.5 align-middle", i < columns.length - 1 && "pr-4", c.numeric && "text-right tabular-nums", c.truncate && "max-w-48 truncate", hiddenBelow(c, i), c.className),
2558
3009
  children: flexRender(cell.column.columnDef.cell, cell.getContext())
2559
3010
  }, c.key);
2560
3011
  })
@@ -2614,7 +3065,7 @@ function TableSkeleton({ rows = 4, columns = 5 }) {
2614
3065
  });
2615
3066
  }
2616
3067
  // src/components/jobs-table.tsx
2617
- var LOOKS = {
3068
+ var LOOKS$1 = {
2618
3069
  queued: {
2619
3070
  tone: "neutral",
2620
3071
  icon: Clock,
@@ -2670,7 +3121,7 @@ function JobsTable({ caption, jobs, describe = (j) => j.kind, onCancel, onRetry,
2670
3121
  key: "state",
2671
3122
  header: "State",
2672
3123
  cell: (j) => {
2673
- const look = LOOKS[j.state] ?? LOOKS.queued;
3124
+ const look = LOOKS$1[j.state] ?? LOOKS$1.queued;
2674
3125
  return /* @__PURE__ */ jsx(Status, {
2675
3126
  tone: look.tone,
2676
3127
  icon: look.icon,
@@ -2729,94 +3180,90 @@ function JobsTable({ caption, jobs, describe = (j) => j.kind, onCancel, onRetry,
2729
3180
  className: cn(className)
2730
3181
  });
2731
3182
  }
2732
- // src/components/thumbnail.tsx
2733
- var ratio = (aspect) => typeof aspect === "number" ? String(aspect) : aspect.replace("/", " / ");
2734
- /** A box of fixed aspect ratio for a remote image: a skeleton until it loads, the `missing` words (or a `fallback`) if it cannot, a request only when it nears the screen, and `children` overlaid in its corners. `alt` and `missing` or `fallback` are required. */
2735
- function Thumbnail({ src, alt, missing, aspect = 1, fit = "cover", srcSet, sizes, eager = false, rootMargin = "200px", className, fallback, onLoad, onMissing, children }) {
2736
- const sources = React.useMemo(() => src === null ? [] : typeof src === "string" ? src ? [src] : [] : src.filter(Boolean), [src]);
2737
- const key = sources.length ? `${sources.join("\n")} ${srcSet ?? ""}` : null;
2738
- const [outcome, setOutcome] = React.useState(null);
2739
- const mine = key !== null && outcome?.key === key ? outcome : null;
2740
- const index = mine?.index ?? 0;
2741
- const phase = key === null ? "missing" : mine?.done ?? "loading";
2742
- const current = sources[index];
2743
- const near = useInView({
2744
- active: !eager && sources.length > 0,
2745
- rootMargin,
2746
- once: true,
2747
- unsupported: true
2748
- });
2749
- const requested = eager || near.inView;
2750
- const fail = () => setOutcome(index + 1 < sources.length ? {
2751
- key,
2752
- index: index + 1,
2753
- done: null
2754
- } : {
2755
- key,
2756
- index,
2757
- done: "missing"
2758
- });
2759
- const told = React.useRef(null);
2760
- const tell = React.useRef(onMissing);
2761
- tell.current = onMissing;
2762
- React.useEffect(() => {
2763
- if (phase !== "missing") told.current = null;
2764
- else if (key !== null && told.current !== key) {
2765
- told.current = key;
2766
- tell.current?.();
2767
- }
2768
- }, [key, phase]);
2769
- const name = [alt, missing].filter(Boolean).join(": ");
2770
- return /* @__PURE__ */ jsxs("div", {
2771
- ref: near.ref,
2772
- className: cn("relative overflow-hidden rounded-control bg-muted", className),
2773
- style: { aspectRatio: ratio(aspect) },
2774
- "aria-busy": phase === "loading" || void 0,
2775
- children: [
2776
- phase === "loading" && /* @__PURE__ */ jsx(Skeleton, { className: "absolute inset-0" }),
2777
- key !== null && phase !== "missing" && requested && /* @__PURE__ */ jsx("img", {
2778
- src: current,
2779
- srcSet: index === 0 ? srcSet : void 0,
2780
- sizes,
2781
- alt,
2782
- decoding: "async",
2783
- onLoad: (e) => onLoad?.(e.currentTarget, index) === false ? fail() : setOutcome({
2784
- key,
2785
- index,
2786
- done: "loaded"
2787
- }),
2788
- onError: fail,
2789
- className: cn("absolute inset-0 size-full", fit === "cover" ? "object-cover" : "object-contain", phase === "loading" && "opacity-0")
2790
- }, `${key}#${index}`),
2791
- phase === "missing" && /* @__PURE__ */ jsx("div", {
2792
- ...name ? {
2793
- role: "img",
2794
- "aria-label": name
2795
- } : { "aria-hidden": true },
2796
- className: cn("absolute inset-0 grid", fallback === void 0 && "content-center justify-items-center gap-0.5 p-1 text-center text-muted-foreground"),
2797
- children: fallback === void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ImageOff, {
2798
- "aria-hidden": true,
2799
- className: "size-4 shrink-0"
2800
- }), /* @__PURE__ */ jsx("span", {
2801
- className: "type-caption text-balance",
2802
- children: missing
2803
- })] }) : /* @__PURE__ */ jsx("div", {
2804
- "aria-hidden": true,
2805
- className: "grid size-full min-h-0 min-w-0",
2806
- children: fallback
2807
- })
2808
- }),
2809
- children
2810
- ]
2811
- });
3183
+ // src/components/schedule-table.tsx
3184
+ var LOOKS = {
3185
+ ok: {
3186
+ tone: "success",
3187
+ icon: Check,
3188
+ word: "OK"
3189
+ },
3190
+ success: {
3191
+ tone: "success",
3192
+ icon: Check,
3193
+ word: "OK"
3194
+ },
3195
+ failed: {
3196
+ tone: "danger",
3197
+ icon: CircleAlert,
3198
+ word: "Failed"
3199
+ },
3200
+ failure: {
3201
+ tone: "danger",
3202
+ icon: CircleAlert,
3203
+ word: "Failed"
3204
+ }
3205
+ };
3206
+ function lookOf(row) {
3207
+ if (row.running) return {
3208
+ tone: "info",
3209
+ icon: LoaderCircle,
3210
+ word: "Running"
3211
+ };
3212
+ if (row.result == null) return {
3213
+ tone: "neutral",
3214
+ icon: CircleDashed,
3215
+ word: "Never run"
3216
+ };
3217
+ return LOOKS[row.result.toLowerCase()] ?? {
3218
+ tone: "neutral",
3219
+ icon: Ban,
3220
+ word: row.result
3221
+ };
2812
3222
  }
2813
- /** The loading shape of a `Thumbnail`, for a `DataView` skeleton: the same box and aspect ratio, so nothing moves when the list arrives. */
2814
- function ThumbnailSkeleton({ aspect = 1, className }) {
2815
- return /* @__PURE__ */ jsx("div", {
2816
- "aria-hidden": true,
2817
- className: cn("relative overflow-hidden rounded-control bg-muted", className),
2818
- style: { aspectRatio: ratio(aspect) },
2819
- children: /* @__PURE__ */ jsx(Skeleton, { className: "absolute inset-0" })
3223
+ /** A table of a machine's scheduled jobs: each one's last result as a word, when it last ran and when it runs next. The last and next columns drop on a phone. */
3224
+ function ScheduleTable({ caption, rows, now, className }) {
3225
+ return /* @__PURE__ */ jsx(DataTable, {
3226
+ caption,
3227
+ columns: [
3228
+ {
3229
+ key: "label",
3230
+ header: "Job",
3231
+ cell: (r) => r.label,
3232
+ value: (r) => r.label,
3233
+ truncate: true
3234
+ },
3235
+ {
3236
+ key: "result",
3237
+ header: "Last result",
3238
+ cell: (r) => {
3239
+ const look = lookOf(r);
3240
+ return /* @__PURE__ */ jsx(Status, {
3241
+ tone: look.tone,
3242
+ icon: look.icon,
3243
+ children: look.word
3244
+ });
3245
+ },
3246
+ value: (r) => lookOf(r).word
3247
+ },
3248
+ {
3249
+ key: "last",
3250
+ header: "Last run",
3251
+ cell: (r) => format.ago(r.last, now),
3252
+ value: (r) => r.last == null ? null : new Date(r.last),
3253
+ missing: "Never",
3254
+ hideBelow: "sm"
3255
+ },
3256
+ {
3257
+ key: "next",
3258
+ header: "Next run",
3259
+ cell: (r) => format.ago(r.next, now),
3260
+ value: (r) => r.next == null ? null : new Date(r.next),
3261
+ hideBelow: "sm"
3262
+ }
3263
+ ],
3264
+ rows,
3265
+ rowKey: (r) => r.label,
3266
+ className
2820
3267
  });
2821
3268
  }
2822
3269
  // src/components/film-strip.tsx
@@ -2851,6 +3298,15 @@ function FilmStrip({ label, frames, span, time, onSeek, aspect = "4/3", frameWid
2851
3298
  }, []);
2852
3299
  const shown = pickEvenly(frames, Math.max(1, Math.floor((width + GAP$1) / (frameWidth + GAP$1))));
2853
3300
  const current = frameAt(shown, time, span ?? [frames[0]?.time ?? 0, frames.length ? frames[frames.length - 1].time + 1e-6 : 0]);
3301
+ const seen = /* @__PURE__ */ new Map();
3302
+ const keyed = shown.map((f) => {
3303
+ const n = seen.get(f.time) ?? 0;
3304
+ seen.set(f.time, n + 1);
3305
+ return {
3306
+ f,
3307
+ k: n ? `${f.time}#${n}` : String(f.time)
3308
+ };
3309
+ });
2854
3310
  const picture = (f, i) => /* @__PURE__ */ jsx(Thumbnail, {
2855
3311
  src: f.src,
2856
3312
  alt: onSeek ? "" : `Frame at ${format.runningTime(f.time)}`,
@@ -2875,22 +3331,22 @@ function FilmStrip({ label, frames, span, time, onSeek, aspect = "4/3", frameWid
2875
3331
  }) : onSeek ? /* @__PURE__ */ jsx(Toolbar, {
2876
3332
  label,
2877
3333
  className: "flex-nowrap gap-1",
2878
- children: shown.map((f, i) => /* @__PURE__ */ jsx(Button$1, {
3334
+ children: keyed.map(({ f, k }, i) => /* @__PURE__ */ jsx(Button$1, {
2879
3335
  "aria-label": `${seekVerb} ${format.runningTime(f.time)}`,
2880
3336
  "aria-current": i === current ? "time" : void 0,
2881
3337
  onPress: () => onSeek(f.time),
2882
3338
  className: "min-w-0 flex-1 rounded-control outline-offset-2 transition-state press",
2883
3339
  children: picture(f, i)
2884
- }, `${f.time}-${i}`))
3340
+ }, k))
2885
3341
  }) : /* @__PURE__ */ jsx("div", {
2886
3342
  role: "group",
2887
3343
  "aria-label": label,
2888
3344
  className: "flex gap-1",
2889
- children: shown.map((f, i) => /* @__PURE__ */ jsx("div", {
3345
+ children: keyed.map(({ f, k }, i) => /* @__PURE__ */ jsx("div", {
2890
3346
  "aria-current": i === current ? "time" : void 0,
2891
3347
  className: "min-w-0 flex-1",
2892
3348
  children: picture(f, i)
2893
- }, `${f.time}-${i}`))
3349
+ }, k))
2894
3350
  })
2895
3351
  });
2896
3352
  }
@@ -11520,256 +11976,6 @@ function ActiveList({ label, active, empty, children, className }) {
11520
11976
  })
11521
11977
  });
11522
11978
  }
11523
- // src/lib/base.ts
11524
- /**
11525
- * Where the app is mounted: the path of the page's `<base href>` without its trailing slash, `""` at the root or where there is no base (SSR, a plain page).
11526
- * Give it to React Router as `createBrowserRouter(routes, { basename: appBase() || "/" })`.
11527
- */
11528
- function appBase(doc = typeof document === "undefined" ? void 0 : document) {
11529
- if (!doc?.querySelector("base[href]")) return "";
11530
- return new URL(".", doc.baseURI).pathname.replace(/\/$/, "");
11531
- }
11532
- /**
11533
- * Puts the app's base in front of a root-relative path (`/api/learners` becomes `/proxy/api/learners` behind a proxy).
11534
- * Anything else (a relative path, a full URL, a protocol-relative `//host`) is returned as it is. Use it for every `fetch`, `<img src>` and download link the app builds; in-app links are router paths and need none.
11535
- */
11536
- function withBase(path, base = appBase()) {
11537
- return path.startsWith("/") && !path.startsWith("//") ? base + path : path;
11538
- }
11539
- // src/query/api.ts
11540
- var isRaw = (body) => typeof Blob !== "undefined" && body instanceof Blob || body instanceof ArrayBuffer || ArrayBuffer.isView(body) || typeof FormData !== "undefined" && body instanceof FormData || body instanceof URLSearchParams || typeof ReadableStream !== "undefined" && body instanceof ReadableStream;
11541
- /**
11542
- * A small client over `fetchJson` for the app's own server: root-relative paths get the app's base (so it works behind a reverse proxy),
11543
- * and `post`, `put` and `patch` send their body as JSON (a `Blob`, bytes, `FormData` or a stream is sent as it is, with the Blob's own type). `api.post<Learner>("/api/learners", { nickname })`.
11544
- */
11545
- function createApi({ base, ...options } = {}) {
11546
- const url = (path) => withBase(path, base ?? appBase());
11547
- const send = (method, path, body, init) => fetchJson(url(path), {
11548
- ...init,
11549
- method,
11550
- ...body === void 0 ? {} : isRaw(body) ? { body } : { json: body }
11551
- }, options);
11552
- return {
11553
- url,
11554
- get: (path, init) => send("GET", path, void 0, init),
11555
- post: (path, body, init) => send("POST", path, body, init),
11556
- put: (path, body, init) => send("PUT", path, body, init),
11557
- patch: (path, body, init) => send("PATCH", path, body, init),
11558
- delete: (path, init) => send("DELETE", path, void 0, init)
11559
- };
11560
- }
11561
- // src/query/typed-api.ts
11562
- function fill(path, values, query) {
11563
- const filled = path.replace(/\{([^}]+)\}/g, (_, name) => {
11564
- const value = values?.[name];
11565
- if (value === void 0 || value === null) throw new Error(`strata-react: the path ${path} needs "${name}" in \`path\``);
11566
- return encodeURIComponent(String(value));
11567
- });
11568
- const search = new URLSearchParams();
11569
- for (const [key, value] of Object.entries(query ?? {})) for (const item of Array.isArray(value) ? value : [value]) if (item !== void 0 && item !== null) search.append(key, String(item));
11570
- const text = search.toString();
11571
- return text ? `${filled}${filled.includes("?") ? "&" : "?"}${text}` : filled;
11572
- }
11573
- /**
11574
- * `createApi` typed by the server's schema: `const api = createTypedApi<paths>()`, then `api.post("/api/learners", { json: { nickname } })` and
11575
- * `api.get("/api/learners/{id}", { path: { id } })`; the path, `path` and `query` values, `json` and the answer are checked, and `{id}` is filled and escaped.
11576
- */
11577
- function createTypedApi(options = {}) {
11578
- const api = createApi(options);
11579
- const call = (method) => (path, request) => {
11580
- const { path: values, query, json, body, ...init } = request ?? {};
11581
- const target = fill(path, values, query);
11582
- const rest = init;
11583
- return method === "get" ? api.get(target, rest) : method === "delete" ? api.delete(target, rest) : api[method](target, body ?? json, rest);
11584
- };
11585
- return {
11586
- url: api.url,
11587
- get: call("get"),
11588
- post: call("post"),
11589
- put: call("put"),
11590
- patch: call("patch"),
11591
- delete: call("delete")
11592
- };
11593
- }
11594
- // src/query/infinite.ts
11595
- /** `useInfiniteQuery` for cursor-paged data, returned as an `InfiniteLoad<T>` for `InfiniteList` (or `DataView`). */
11596
- function useInfiniteLoad({ queryKey, queryFn, items, itemKey, hasMore = () => false, nextCursor, cursorAfter = itemKey, isRemoved, describeError = describeHttpError, enabled, staleTime }) {
11597
- const queryHash = hashKey(queryKey);
11598
- const [stored, setStored] = React.useState(() => ({
11599
- query: queryHash,
11600
- keys: /* @__PURE__ */ new Set()
11601
- }));
11602
- const dismissed = stored.query === queryHash ? stored.keys : none;
11603
- const hidden = React.useCallback((key) => dismissed.has(key) || (isRemoved?.(key) ?? false), [dismissed, isRemoved]);
11604
- const latest = React.useRef({
11605
- hidden,
11606
- items,
11607
- itemKey,
11608
- hasMore,
11609
- cursorAfter,
11610
- nextCursor
11611
- });
11612
- latest.current = {
11613
- hidden,
11614
- items,
11615
- itemKey,
11616
- hasMore,
11617
- cursorAfter,
11618
- nextCursor
11619
- };
11620
- const query = useInfiniteQuery({
11621
- queryKey,
11622
- queryFn: ({ pageParam, signal }) => queryFn({
11623
- cursor: pageParam.cursor,
11624
- signal
11625
- }),
11626
- initialPageParam: { cursor: void 0 },
11627
- getNextPageParam: (lastPage, pages) => {
11628
- const l = latest.current;
11629
- if (l.nextCursor) {
11630
- const next = l.nextCursor(lastPage);
11631
- return next === null ? null : { cursor: next };
11632
- }
11633
- if (!l.hasMore(lastPage)) return null;
11634
- const after = nextAfter(pages, l.items, l.itemKey, l.hidden);
11635
- return { cursor: after === void 0 ? void 0 : l.cursorAfter(after) };
11636
- },
11637
- enabled,
11638
- staleTime
11639
- });
11640
- const pages = query.data?.pages;
11641
- const list = React.useMemo(() => pages ? merge(pages, latest.current.items, latest.current.itemKey, hidden).held : void 0, [pages, hidden]);
11642
- const { hasNextPage, isFetchingNextPage, fetchNextPage, refetch } = query;
11643
- const loadMore = React.useCallback(() => {
11644
- if (hasNextPage && !isFetchingNextPage) fetchNextPage();
11645
- }, [
11646
- hasNextPage,
11647
- isFetchingNextPage,
11648
- fetchNextPage
11649
- ]);
11650
- const change = React.useCallback((edit) => setStored((s) => {
11651
- const keys = new Set(s.query === queryHash ? s.keys : none);
11652
- edit(keys);
11653
- return {
11654
- query: queryHash,
11655
- keys
11656
- };
11657
- }), [queryHash]);
11658
- const dismiss = React.useCallback((key) => change((keys) => keys.add(key)), [change]);
11659
- const restore = React.useCallback((key) => change((keys) => keys.delete(key)), [change]);
11660
- const extra = {
11661
- more: {
11662
- hasMore: Boolean(hasNextPage),
11663
- loadingMore: isFetchingNextPage,
11664
- error: query.isFetchNextPageError ? describeError(query.error) : void 0,
11665
- loadMore
11666
- },
11667
- itemKey,
11668
- dismiss,
11669
- restore
11670
- };
11671
- if (list) {
11672
- const stale = query.isRefetchError ? staleOf(query, describeError) : void 0;
11673
- return {
11674
- status: "ready",
11675
- data: list,
11676
- ...stale && { stale },
11677
- ...extra
11678
- };
11679
- }
11680
- if (query.status === "error") return {
11681
- status: "error",
11682
- message: describeError(query.error),
11683
- retry: () => void refetch(),
11684
- ...extra
11685
- };
11686
- return {
11687
- status: "loading",
11688
- ...extra
11689
- };
11690
- }
11691
- var none = /* @__PURE__ */ new Set();
11692
- /** Every page's items, in order, once each by key: the ones held (not dismissed) and the last one seen. */
11693
- function merge(pages, items, itemKey, hidden) {
11694
- const seen = /* @__PURE__ */ new Set();
11695
- const held = [];
11696
- let last;
11697
- let lastPageAddedAny = false;
11698
- pages.forEach((page, p) => {
11699
- for (const item of items(page)) {
11700
- const key = itemKey(item);
11701
- if (seen.has(key)) continue;
11702
- seen.add(key);
11703
- last = item;
11704
- if (p === pages.length - 1) lastPageAddedAny = true;
11705
- if (!hidden(key)) held.push(item);
11706
- }
11707
- });
11708
- return {
11709
- held,
11710
- last,
11711
- lastPageAddedAny
11712
- };
11713
- }
11714
- /** The item the next page goes after: the last held, or the last seen when nothing is held or the last page brought nothing new. */
11715
- function nextAfter(pages, items, itemKey, hidden) {
11716
- const { held, last, lastPageAddedAny } = merge(pages, items, itemKey, hidden);
11717
- if (held.length === 0 || pages.length > 1 && !lastPageAddedAny) return last;
11718
- return held[held.length - 1];
11719
- }
11720
- /** `useInfiniteLoad`'s `items` and `nextCursor` for the shared `Page<T>` shape: `useInfiniteLoad({ queryKey, queryFn, itemKey, ...apiPage<Item>() })`. */
11721
- function apiPage() {
11722
- return {
11723
- items: (page) => page.items,
11724
- nextCursor: (page) => page.next
11725
- };
11726
- }
11727
- // src/query/job.ts
11728
- /** A long-running job's status: polled every `every` ms while `isRunning`, with the `invalidates` queries read again once when it ends. */
11729
- function useJob({ isRunning, every = 2e3, invalidates = [], describeError, ...options }) {
11730
- const client = useQueryClient();
11731
- const query = useQuery({
11732
- ...options,
11733
- refetchInterval: (q) => q.state.data !== void 0 && isRunning(q.state.data) ? every : false
11734
- });
11735
- const running = query.data !== void 0 && isRunning(query.data);
11736
- const queryHash = hashKey(options.queryKey);
11737
- const seen = query.data === void 0 ? void 0 : running;
11738
- const was = React.useRef(void 0);
11739
- React.useEffect(() => {
11740
- if (seen === void 0) return;
11741
- const before = was.current;
11742
- if (before && before.query === queryHash && before.running && !seen) for (const queryKey of before.invalidates) client.invalidateQueries({ queryKey });
11743
- was.current = {
11744
- query: queryHash,
11745
- running: seen,
11746
- invalidates
11747
- };
11748
- });
11749
- const { refetch } = query;
11750
- const poll = React.useCallback(() => void refetch(), [refetch]);
11751
- return {
11752
- ...toLoad(query, describeError),
11753
- running,
11754
- poll
11755
- };
11756
- }
11757
- /** Whether a task of the shared contract (`strata_python.contracts.Task`) is still going: its `state` is not one of the finished ones. Pass the generated `FINISHED`; for `useJob({ isRunning: (t) => isTaskRunning(t, FINISHED) })`. */
11758
- function isTaskRunning(task, finished) {
11759
- return !(Array.isArray(finished) ? finished.includes(task.state) : finished.has(task.state));
11760
- }
11761
- // src/query/workflow.ts
11762
- /** Whether the queue job advancing a workflow run is still going. `finished` is the generated `FINISHED` (or `["done", "failed", "cancelled"]`). */
11763
- function isWorkflowRunning(run, finished) {
11764
- return run.job != null && isTaskRunning(run.job, finished);
11765
- }
11766
- /** A subject's `WorkflowRun`: polled while its job runs, its `invalidates` read again once when it ends. */
11767
- function useWorkflowRun({ finished, ...options }) {
11768
- return useJob({
11769
- ...options,
11770
- isRunning: (run) => isWorkflowRunning(run, finished)
11771
- });
11772
- }
11773
11979
  // src/query/outbox.ts
11774
11980
  /** Whether a failure is the server's answer for good (refused) rather than for now (waiting). */
11775
11981
  function isRefusal(error) {
@@ -18499,6 +18705,6 @@ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose
18499
18705
  ]
18500
18706
  });
18501
18707
  }
18502
- export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, Breadcrumb, BulkBar, Button, ButtonLink, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, ContextMenu, Conversation, CursorScope, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, EmptyState, FIT, Field, FileButton, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PageHeader, PairJudge, PairVote, Pane, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SideNav, Skeleton, Slider, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, Workspace, actualPixelsScale, ancestorsOf, apiPage, appBase, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, clampToRoom, clampViewport, clipsQueryKey, cn, colorSchemeScript, commandShortcut, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, describeActionError, describeHttpError, describeRegion, detectPlatform, diffWords, differences, drawRect, ease, encodeWav, errorPayload, explainMicrophoneError, fetchJson, fieldErrorsOf, findPage, fitRect, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, inputLevelThresholds, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, labelOf, lerpRect, logScale, loudnessOf, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, moveGutter, moveRect, noOverlap, normaliseAngle, pageName, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, plainText, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, resample, resamplePeaks, resizeRect, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useDifference, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMicrophone, useOutbox, useOutboxStarted, usePlayerWarnings, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSharedCursor, useSpeech, useSystemColorScheme, useTimelineZoom, useUndoable, useViewOptions, useViewport, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
18708
+ export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, Breadcrumb, BulkBar, Button, ButtonLink, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, EmptyState, FIT, Field, FileButton, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SideNav, Skeleton, Slider, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, Workspace, actualPixelsScale, ancestorsOf, apiPage, appBase, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, clampToRoom, clampViewport, clipsQueryKey, cn, colorSchemeScript, commandShortcut, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, describeActionError, describeHttpError, describeRegion, detectPlatform, diffWords, differences, diskThresholds, drawRect, ease, encodeWav, errorPayload, explainMicrophoneError, fetchJson, fieldErrorsOf, findPage, fitRect, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, inputLevelThresholds, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, labelOf, lerpRect, logScale, loudnessOf, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, moveGutter, moveRect, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, plainText, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, resample, resamplePeaks, resizeRect, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useDifference, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMicrophone, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSharedCursor, useSpeech, useSystemColorScheme, useSystemInfo, useTimelineZoom, useUndoable, useViewOptions, useViewport, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
18503
18709
 
18504
18710
  //# sourceMappingURL=index.js.map