strata-react 1.3.16 → 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.
package/dist/index.js CHANGED
@@ -1,13 +1,12 @@
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-jfhLD5XX.js";
2
- import { a as toDate, i as format, n as NBSP, r as createFormat, t as MISSING } from "./format-BNkXVwFx.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-WRXbtUp6.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-D0TsKLwJ.js";
5
- import { a as useMicrophone, c as toastTimeout, d as fetchJson, f as staleOf, g as overlaySurface, h as usePoll, i as explainMicrophoneError, l as StrataQueryProvider, m as useLoad, n as MicrophoneError, o as StrataToastRegion, p as toLoad, r as browserMicrophone, s as toast, t as MicrophoneContext, u as createQueryClient } from "./microphone-CZy0bNEx.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 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-CFBAYaiu.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, FolderX, 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";
13
12
  import { hashKey, useInfiniteQuery, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -1259,105 +1258,6 @@ function useWorkflowRun({ finished, ...options }) {
1259
1258
  isRunning: (run) => isWorkflowRunning(run, finished)
1260
1259
  });
1261
1260
  }
1262
- // src/components/data-view.tsx
1263
- /** The default failed-read panel: the reason on the danger tint, with Try again. Its parent carries `role="alert"`. */
1264
- function LoadError({ message, retry, className }) {
1265
- return /* @__PURE__ */ jsxs("div", {
1266
- className: cn("flex flex-wrap items-start gap-3 rounded-surface bg-danger-subtle p-4 text-danger", className),
1267
- children: [
1268
- /* @__PURE__ */ jsx(CircleAlert, {
1269
- "aria-hidden": true,
1270
- className: "mt-0.5 size-5 shrink-0"
1271
- }),
1272
- /* @__PURE__ */ jsx("p", {
1273
- className: "min-w-0 flex-1 type-body",
1274
- children: message
1275
- }),
1276
- /* @__PURE__ */ jsxs(Button, {
1277
- size: "sm",
1278
- onClick: retry,
1279
- children: [/* @__PURE__ */ jsx(RotateCcw, { "aria-hidden": true }), "Try again"]
1280
- })
1281
- ]
1282
- });
1283
- }
1284
- var defaultError = (failure) => /* @__PURE__ */ jsx(LoadError, { ...failure });
1285
- /** 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. */
1286
- function DataView$1({ state, isEmpty, skeleton, empty, children, staleNotice = (stale) => /* @__PURE__ */ jsx(StaleNotice, { stale }), error = defaultError, className }) {
1287
- return /* @__PURE__ */ jsxs("div", {
1288
- className: cn("min-w-0", className),
1289
- "aria-busy": state.status === "loading" || void 0,
1290
- children: [
1291
- state.status === "loading" && skeleton,
1292
- state.status === "error" && /* @__PURE__ */ jsx("div", {
1293
- role: "alert",
1294
- children: error({
1295
- message: state.message,
1296
- retry: state.retry
1297
- })
1298
- }),
1299
- state.status === "ready" && /* @__PURE__ */ jsxs(Fragment, { children: [state.stale && staleNotice(state.stale), isEmpty(state.data) ? empty : children(state.data)] })
1300
- ]
1301
- });
1302
- }
1303
- /** When `readAt` was, for a person: the clock time today, else the weekday and time. */
1304
- function readTime(readAt, now = /* @__PURE__ */ new Date()) {
1305
- return readAt.toDateString() === now.toDateString() ? format.clock.format(readAt) : format.shortDay.format(readAt);
1306
- }
1307
- /** 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. */
1308
- function StaleNotice({ stale, shown, className }) {
1309
- return /* @__PURE__ */ jsxs("div", {
1310
- role: "status",
1311
- className: cn("mb-4 flex flex-wrap items-start gap-3 rounded-surface bg-warning-subtle p-3 text-warning", className),
1312
- children: [
1313
- /* @__PURE__ */ jsx(History, {
1314
- "aria-hidden": true,
1315
- className: "mt-0.5 size-4 shrink-0"
1316
- }),
1317
- /* @__PURE__ */ jsxs("p", {
1318
- className: "min-w-0 flex-1 type-body-sm",
1319
- children: [
1320
- stale.message,
1321
- " ",
1322
- shown ? shown(readTime(stale.readAt)) : `Showing data from ${readTime(stale.readAt)}.`
1323
- ]
1324
- }),
1325
- /* @__PURE__ */ jsxs(Button, {
1326
- size: "sm",
1327
- onClick: stale.retry,
1328
- disabled: stale.retrying,
1329
- children: [/* @__PURE__ */ jsx(RotateCcw, { "aria-hidden": true }), stale.retrying ? "Trying again…" : "Try again"]
1330
- })
1331
- ]
1332
- });
1333
- }
1334
- /** An empty state that teaches the next action: a title, a sentence and an action. No illustration slot, on purpose. */
1335
- function EmptyState({ title, children, action }) {
1336
- return /* @__PURE__ */ jsxs("div", {
1337
- className: "grid justify-items-start gap-2 border-y border-border py-6",
1338
- children: [
1339
- /* @__PURE__ */ jsx("p", {
1340
- className: "type-heading",
1341
- children: title
1342
- }),
1343
- children && /* @__PURE__ */ jsx("p", {
1344
- className: "max-w-prose type-body text-muted-foreground",
1345
- children
1346
- }),
1347
- action && /* @__PURE__ */ jsx("div", {
1348
- className: "mt-2",
1349
- children: action
1350
- })
1351
- ]
1352
- });
1353
- }
1354
- /** A placeholder block for a loading layout. Size it with layout classes so it mirrors the final content. */
1355
- function Skeleton({ className }) {
1356
- return /* @__PURE__ */ jsx("div", {
1357
- "aria-hidden": true,
1358
- className: cn("rounded-control bg-muted motion-safe:animate-pulse", className)
1359
- });
1360
- }
1361
1261
  // src/components/system-panel.tsx
1362
1262
  /** The shared limits for a folder's disk, as shares of its size: filling up at 80%, nearly full at 95%. */
1363
1263
  var diskThresholds = [{
@@ -3366,96 +3266,6 @@ function ScheduleTable({ caption, rows, now, className }) {
3366
3266
  className
3367
3267
  });
3368
3268
  }
3369
- // src/components/thumbnail.tsx
3370
- var ratio = (aspect) => typeof aspect === "number" ? String(aspect) : aspect.replace("/", " / ");
3371
- /** 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. */
3372
- function Thumbnail({ src, alt, missing, aspect = 1, fit = "cover", srcSet, sizes, eager = false, rootMargin = "200px", className, fallback, onLoad, onMissing, children }) {
3373
- const sources = React.useMemo(() => src === null ? [] : typeof src === "string" ? src ? [src] : [] : src.filter(Boolean), [src]);
3374
- const key = sources.length ? `${sources.join("\n")} ${srcSet ?? ""}` : null;
3375
- const [outcome, setOutcome] = React.useState(null);
3376
- const mine = key !== null && outcome?.key === key ? outcome : null;
3377
- const index = mine?.index ?? 0;
3378
- const phase = key === null ? "missing" : mine?.done ?? "loading";
3379
- const current = sources[index];
3380
- const near = useInView({
3381
- active: !eager && sources.length > 0,
3382
- rootMargin,
3383
- once: true,
3384
- unsupported: true
3385
- });
3386
- const requested = eager || near.inView;
3387
- const fail = () => setOutcome(index + 1 < sources.length ? {
3388
- key,
3389
- index: index + 1,
3390
- done: null
3391
- } : {
3392
- key,
3393
- index,
3394
- done: "missing"
3395
- });
3396
- const told = React.useRef(null);
3397
- const tell = React.useRef(onMissing);
3398
- tell.current = onMissing;
3399
- React.useEffect(() => {
3400
- if (phase !== "missing") told.current = null;
3401
- else if (key !== null && told.current !== key) {
3402
- told.current = key;
3403
- tell.current?.();
3404
- }
3405
- }, [key, phase]);
3406
- const name = [alt, missing].filter(Boolean).join(": ");
3407
- return /* @__PURE__ */ jsxs("div", {
3408
- ref: near.ref,
3409
- className: cn("relative overflow-hidden rounded-control bg-muted", className),
3410
- style: { aspectRatio: ratio(aspect) },
3411
- "aria-busy": phase === "loading" || void 0,
3412
- children: [
3413
- phase === "loading" && /* @__PURE__ */ jsx(Skeleton, { className: "absolute inset-0" }),
3414
- key !== null && phase !== "missing" && requested && /* @__PURE__ */ jsx("img", {
3415
- src: current,
3416
- srcSet: index === 0 ? srcSet : void 0,
3417
- sizes,
3418
- alt,
3419
- decoding: "async",
3420
- onLoad: (e) => onLoad?.(e.currentTarget, index) === false ? fail() : setOutcome({
3421
- key,
3422
- index,
3423
- done: "loaded"
3424
- }),
3425
- onError: fail,
3426
- className: cn("absolute inset-0 size-full", fit === "cover" ? "object-cover" : "object-contain", phase === "loading" && "opacity-0")
3427
- }, `${key}#${index}`),
3428
- phase === "missing" && /* @__PURE__ */ jsx("div", {
3429
- ...name ? {
3430
- role: "img",
3431
- "aria-label": name
3432
- } : { "aria-hidden": true },
3433
- className: cn("absolute inset-0 grid", fallback === void 0 && "content-center justify-items-center gap-0.5 p-1 text-center text-muted-foreground"),
3434
- children: fallback === void 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ImageOff, {
3435
- "aria-hidden": true,
3436
- className: "size-4 shrink-0"
3437
- }), /* @__PURE__ */ jsx("span", {
3438
- className: "type-caption text-balance",
3439
- children: missing
3440
- })] }) : /* @__PURE__ */ jsx("div", {
3441
- "aria-hidden": true,
3442
- className: "grid size-full min-h-0 min-w-0",
3443
- children: fallback
3444
- })
3445
- }),
3446
- children
3447
- ]
3448
- });
3449
- }
3450
- /** The loading shape of a `Thumbnail`, for a `DataView` skeleton: the same box and aspect ratio, so nothing moves when the list arrives. */
3451
- function ThumbnailSkeleton({ aspect = 1, className }) {
3452
- return /* @__PURE__ */ jsx("div", {
3453
- "aria-hidden": true,
3454
- className: cn("relative overflow-hidden rounded-control bg-muted", className),
3455
- style: { aspectRatio: ratio(aspect) },
3456
- children: /* @__PURE__ */ jsx(Skeleton, { className: "absolute inset-0" })
3457
- });
3458
- }
3459
3269
  // src/components/film-strip.tsx
3460
3270
  var GAP$1 = 4;
3461
3271
  /** `n` of `items` spread evenly from the first to the last (all of them when there are no more than `n`). */
@@ -3488,6 +3298,15 @@ function FilmStrip({ label, frames, span, time, onSeek, aspect = "4/3", frameWid
3488
3298
  }, []);
3489
3299
  const shown = pickEvenly(frames, Math.max(1, Math.floor((width + GAP$1) / (frameWidth + GAP$1))));
3490
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
+ });
3491
3310
  const picture = (f, i) => /* @__PURE__ */ jsx(Thumbnail, {
3492
3311
  src: f.src,
3493
3312
  alt: onSeek ? "" : `Frame at ${format.runningTime(f.time)}`,
@@ -3512,22 +3331,22 @@ function FilmStrip({ label, frames, span, time, onSeek, aspect = "4/3", frameWid
3512
3331
  }) : onSeek ? /* @__PURE__ */ jsx(Toolbar, {
3513
3332
  label,
3514
3333
  className: "flex-nowrap gap-1",
3515
- children: shown.map((f, i) => /* @__PURE__ */ jsx(Button$1, {
3334
+ children: keyed.map(({ f, k }, i) => /* @__PURE__ */ jsx(Button$1, {
3516
3335
  "aria-label": `${seekVerb} ${format.runningTime(f.time)}`,
3517
3336
  "aria-current": i === current ? "time" : void 0,
3518
3337
  onPress: () => onSeek(f.time),
3519
3338
  className: "min-w-0 flex-1 rounded-control outline-offset-2 transition-state press",
3520
3339
  children: picture(f, i)
3521
- }, `${f.time}-${i}`))
3340
+ }, k))
3522
3341
  }) : /* @__PURE__ */ jsx("div", {
3523
3342
  role: "group",
3524
3343
  "aria-label": label,
3525
3344
  className: "flex gap-1",
3526
- children: shown.map((f, i) => /* @__PURE__ */ jsx("div", {
3345
+ children: keyed.map(({ f, k }, i) => /* @__PURE__ */ jsx("div", {
3527
3346
  "aria-current": i === current ? "time" : void 0,
3528
3347
  className: "min-w-0 flex-1",
3529
3348
  children: picture(f, i)
3530
- }, `${f.time}-${i}`))
3349
+ }, k))
3531
3350
  })
3532
3351
  });
3533
3352
  }