strata-react 1.0.5 → 1.0.6

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,6 +1,6 @@
1
1
  import { C as readErrorBody, E as typeSteps, S as fieldErrorsOf, T as cn, _ as Textarea, a as toLoad, b as describeActionError, c as ColorSchemeChoice, d as useColorScheme, f as useSystemColorScheme, g as NativeSelect, h as Input, i as staleOf, l as ThemeProvider, m as Field, n as createQueryClient, o as useLoad, p as ChoiceGroup, r as fetchJson, s as COLOR_SCHEME_STORAGE_KEY, t as StrataQueryProvider, u as colorSchemeScript, v as useFieldControl, w as Tooltip, x as describeHttpError, y as HttpError } from "./query-CXlmWmrY.js";
2
2
  import * as React from "react";
3
- import { Autocomplete, Button as Button$1, Checkbox as Checkbox$1, Dialog as Dialog$1, DialogTrigger, Header, Heading, I18nProvider, Input as Input$1, Keyboard, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, NumberField as NumberField$1, Popover as Popover$1, SearchField, Separator, Slider as Slider$1, SliderOutput, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Toolbar as Toolbar$1, UNSTABLE_Toast, UNSTABLE_ToastContent, UNSTABLE_ToastQueue, UNSTABLE_ToastRegion, useFilter } from "react-aria-components";
3
+ import { Autocomplete, Button as Button$1, Checkbox as Checkbox$1, Dialog as Dialog$1, DialogTrigger, Disclosure as Disclosure$1, DisclosurePanel, Header, Heading, I18nProvider, Input as Input$1, Keyboard, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, NumberField as NumberField$1, Popover as Popover$1, SearchField, Separator, Slider as Slider$1, SliderOutput, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Toolbar as Toolbar$1, UNSTABLE_Toast, UNSTABLE_ToastContent, UNSTABLE_ToastQueue, UNSTABLE_ToastRegion, useFilter } from "react-aria-components";
4
4
  import { cva } from "class-variance-authority";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronRight, CircleAlert, CircleCheck, History, ImageOff, Info, LoaderCircle, Maximize, Minimize, Minus, RotateCcw, Scan, Search, Trash2, TriangleAlert, X, ZoomIn, ZoomOut } from "lucide-react";
@@ -8,6 +8,7 @@ import { Link, NavLink, useSearchParams } from "react-router";
8
8
  import { createSortedRowModel, flexRender, rowSortingFeature, tableFeatures, useTable } from "@tanstack/react-table";
9
9
  import { useVirtualizer } from "@tanstack/react-virtual";
10
10
  import { hashKey, useInfiniteQuery, useQuery, useQueryClient } from "@tanstack/react-query";
11
+ import pixelmatch from "pixelmatch";
11
12
  // src/lib/format.ts
12
13
  var NBSP = "\xA0";
13
14
  /** The placeholder printed for a value that is not known: an en dash. */
@@ -2873,6 +2874,182 @@ function TableSkeleton({ rows = 4, columns = 5 }) {
2873
2874
  }, r))]
2874
2875
  });
2875
2876
  }
2877
+ // src/components/inspector.tsx
2878
+ function readRemembered(key) {
2879
+ if (!key) return {};
2880
+ try {
2881
+ const raw = window.localStorage.getItem(key);
2882
+ const parsed = raw ? JSON.parse(raw) : {};
2883
+ return parsed && typeof parsed === "object" ? parsed : {};
2884
+ } catch {
2885
+ return {};
2886
+ }
2887
+ }
2888
+ var InspectorContext = React.createContext(null);
2889
+ /** A panel of properties for the selected thing: a labelled region with a heading, an empty state when `title` is null, and sections whose open state is remembered. */
2890
+ function Inspector({ title, kind, empty, selectionKey, storageKey, actions, summary, children, className }) {
2891
+ const headingId = React.useId();
2892
+ const [remembered, setRemembered] = React.useState(() => readRemembered(storageKey));
2893
+ const root = React.useRef(null);
2894
+ const heading = React.useRef(null);
2895
+ const state = React.useMemo(() => ({
2896
+ isOpen: (id, defaultOpen) => remembered[id] ?? defaultOpen,
2897
+ setOpen: (id, open) => setRemembered((prev) => {
2898
+ const next = {
2899
+ ...prev,
2900
+ [id]: open
2901
+ };
2902
+ if (storageKey) try {
2903
+ window.localStorage.setItem(storageKey, JSON.stringify(next));
2904
+ } catch {}
2905
+ return next;
2906
+ })
2907
+ }), [remembered, storageKey]);
2908
+ const hadFocus = React.useRef(false);
2909
+ React.useEffect(() => {
2910
+ const el = root.current;
2911
+ const onFocus = () => hadFocus.current = true;
2912
+ const onBlur = (e) => {
2913
+ if (!e.relatedTarget) return;
2914
+ hadFocus.current = false;
2915
+ };
2916
+ el?.addEventListener("focusin", onFocus);
2917
+ el?.addEventListener("focusout", onBlur);
2918
+ return () => {
2919
+ el?.removeEventListener("focusin", onFocus);
2920
+ el?.removeEventListener("focusout", onBlur);
2921
+ };
2922
+ }, []);
2923
+ React.useEffect(() => {
2924
+ if (hadFocus.current && (document.activeElement === document.body || !document.activeElement)) (heading.current ?? root.current)?.focus();
2925
+ }, [selectionKey, title]);
2926
+ return /* @__PURE__ */ jsx(InspectorContext.Provider, {
2927
+ value: state,
2928
+ children: /* @__PURE__ */ jsx("aside", {
2929
+ ref: root,
2930
+ tabIndex: -1,
2931
+ "aria-labelledby": title === null ? void 0 : headingId,
2932
+ "aria-label": title === null ? "Properties" : void 0,
2933
+ className: cn("min-w-0", className),
2934
+ children: title === null ? empty : /* @__PURE__ */ jsxs("div", {
2935
+ className: "grid gap-4",
2936
+ children: [
2937
+ /* @__PURE__ */ jsxs("header", {
2938
+ className: "flex items-start gap-3",
2939
+ children: [/* @__PURE__ */ jsxs("div", {
2940
+ className: "min-w-0 flex-1",
2941
+ children: [/* @__PURE__ */ jsx(Heading, {
2942
+ level: 2,
2943
+ id: headingId,
2944
+ ref: heading,
2945
+ tabIndex: -1,
2946
+ title,
2947
+ className: "truncate type-heading outline-offset-2",
2948
+ children: title
2949
+ }), kind && /* @__PURE__ */ jsx("p", {
2950
+ className: "type-body-sm text-muted-foreground",
2951
+ children: kind
2952
+ })]
2953
+ }), actions && /* @__PURE__ */ jsx("div", {
2954
+ className: "flex shrink-0 items-center gap-1",
2955
+ children: actions
2956
+ })]
2957
+ }),
2958
+ summary,
2959
+ /* @__PURE__ */ jsx("div", {
2960
+ className: "grid",
2961
+ children
2962
+ }, selectionKey)
2963
+ ]
2964
+ })
2965
+ })
2966
+ });
2967
+ }
2968
+ /** A titled group of rows that collapses. The body is mounted only while open; the open state is remembered by the surrounding `Inspector` (and held locally outside one). */
2969
+ function InspectorSection({ id, title, defaultOpen = true, actions, children, className }) {
2970
+ const inspector = React.useContext(InspectorContext);
2971
+ const [own, setOwn] = React.useState(defaultOpen);
2972
+ const expanded = inspector ? inspector.isOpen(id, defaultOpen) : own;
2973
+ const onChange = (open) => inspector ? inspector.setOpen(id, open) : setOwn(open);
2974
+ return /* @__PURE__ */ jsx(Disclosure$1, {
2975
+ isExpanded: expanded,
2976
+ onExpandedChange: onChange,
2977
+ className: cn("min-w-0 border-t border-border first:border-t-0", className),
2978
+ children: ({ isExpanded }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
2979
+ className: "flex items-center gap-2",
2980
+ children: [/* @__PURE__ */ jsx(Heading, {
2981
+ level: 3,
2982
+ className: "min-w-0 flex-1",
2983
+ children: /* @__PURE__ */ jsxs(Button$1, {
2984
+ slot: "trigger",
2985
+ className: "-mx-1 flex min-h-(--control-h-sm) w-full cursor-pointer items-center gap-2 rounded-control px-1 text-left type-label hover:bg-muted",
2986
+ children: [/* @__PURE__ */ jsx(ChevronRight, {
2987
+ "aria-hidden": true,
2988
+ className: cn("size-4 shrink-0 text-muted-foreground", isExpanded && "rotate-90")
2989
+ }), /* @__PURE__ */ jsx("span", {
2990
+ className: "min-w-0 flex-1 truncate",
2991
+ children: title
2992
+ })]
2993
+ })
2994
+ }), actions && /* @__PURE__ */ jsx("div", {
2995
+ className: "flex shrink-0 items-center gap-1",
2996
+ children: actions
2997
+ })]
2998
+ }), /* @__PURE__ */ jsx(DisclosurePanel, { children: isExpanded && /* @__PURE__ */ jsx("div", {
2999
+ className: "grid gap-4 pt-2 pb-4 pl-6",
3000
+ children
3001
+ }) })] })
3002
+ });
3003
+ }
3004
+ /** One editable property: a `Field` (label, hint, error wired to the control) with a "Reset <label>" that shows only while `modified`. */
3005
+ function PropertyRow({ label, hint, error, modified, onReset, children, className }) {
3006
+ const reset = modified && onReset ? /* @__PURE__ */ jsx(IconButton, {
3007
+ icon: RotateCcw,
3008
+ label: `Reset ${label.toLowerCase()}`,
3009
+ onClick: onReset
3010
+ }) : void 0;
3011
+ return /* @__PURE__ */ jsx(Field, {
3012
+ label,
3013
+ hint,
3014
+ error,
3015
+ action: reset,
3016
+ className,
3017
+ children
3018
+ });
3019
+ }
3020
+ /** Read-only facts as a description list: term left, value right, long strings truncated with the full value on hover, a missing value printed as an en dash, units muted after a non-breaking space. */
3021
+ function PropertyList({ items, label, className }) {
3022
+ return /* @__PURE__ */ jsx("dl", {
3023
+ "aria-label": label,
3024
+ className: cn("grid gap-y-1.5", className),
3025
+ children: items.map(({ term, value, unit }) => {
3026
+ const missing = value === null || value === void 0 || value === "";
3027
+ return /* @__PURE__ */ jsxs("div", {
3028
+ className: "grid grid-cols-5 gap-x-3 type-body-sm",
3029
+ children: [/* @__PURE__ */ jsx("dt", {
3030
+ className: "col-span-2 min-w-0 text-muted-foreground",
3031
+ children: term
3032
+ }), /* @__PURE__ */ jsx("dd", {
3033
+ className: "col-span-3 min-w-0 tabular-nums",
3034
+ children: /* @__PURE__ */ jsxs("span", {
3035
+ className: "block truncate",
3036
+ title: typeof value === "string" ? value : void 0,
3037
+ children: [missing ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
3038
+ "aria-hidden": true,
3039
+ children: format.missing
3040
+ }), /* @__PURE__ */ jsx("span", {
3041
+ className: "sr-only",
3042
+ children: "Not known"
3043
+ })] }) : value, !missing && unit && /* @__PURE__ */ jsx("span", {
3044
+ className: "text-muted-foreground",
3045
+ children: ` ${unit}`
3046
+ })]
3047
+ })
3048
+ })]
3049
+ }, term);
3050
+ })
3051
+ });
3052
+ }
2876
3053
  // src/components/selectable-grid.tsx
2877
3054
  var minWidth = {
2878
3055
  sm: 96,
@@ -4156,48 +4333,6 @@ function useJob({ isRunning, every = 2e3, invalidates = [], describeError, ...op
4156
4333
  poll
4157
4334
  };
4158
4335
  }
4159
- // src/lib/viewport.ts
4160
- /** The picture fitted in its frame, not panned. */
4161
- var FIT = {
4162
- scale: 1,
4163
- x: 0,
4164
- y: 0
4165
- };
4166
- /** The least zoom: the whole picture fitted. */
4167
- var MIN_SCALE = 1;
4168
- /** The most zoom, 32 times the fit. */
4169
- var MAX_SCALE = 32;
4170
- /** Keeps the picture from being dragged out of its frame: at most half the extra width or height past each edge. */
4171
- function clampViewport(v, frame) {
4172
- const scale = Math.min(32, Math.max(1, v.scale));
4173
- if (scale === 1) return FIT;
4174
- const mx = (scale - 1) * frame.width / 2;
4175
- const my = (scale - 1) * frame.height / 2;
4176
- return {
4177
- scale,
4178
- x: Math.min(mx, Math.max(-mx, v.x)),
4179
- y: Math.min(my, Math.max(-my, v.y))
4180
- };
4181
- }
4182
- /** A new scale with the point under `at` (pixels from the frame's centre) staying under it. */
4183
- function zoomAt(v, nextScale, at, frame) {
4184
- const scale = Math.min(32, Math.max(1, nextScale));
4185
- const k = scale / v.scale;
4186
- return clampViewport({
4187
- scale,
4188
- x: at.x - k * (at.x - v.x),
4189
- y: at.y - k * (at.y - v.y)
4190
- }, frame);
4191
- }
4192
- /** The scale at which the picture's own pixels are drawn one to one: its natural width over the width it is fitted at. */
4193
- function actualPixelsScale(naturalWidth, fittedWidth) {
4194
- if (!naturalWidth || !fittedWidth) return 1;
4195
- return Math.min(32, Math.max(1, naturalWidth / fittedWidth));
4196
- }
4197
- /** The CSS transform for a viewport. */
4198
- function viewportTransform(v) {
4199
- return `translate(${v.x}px, ${v.y}px) scale(${v.scale})`;
4200
- }
4201
4336
  // src/components/fullscreen-frame.tsx
4202
4337
  /** Whether this browser can show an element full screen. False in jsdom and on iPhone, where the modal fallback is used. */
4203
4338
  function canFullscreen() {
@@ -4252,6 +4387,314 @@ function FullscreenFrame({ label, active, onActiveChange, children, className })
4252
4387
  })
4253
4388
  });
4254
4389
  }
4390
+ // src/lib/viewport.ts
4391
+ /** The picture fitted in its frame, not panned. */
4392
+ var FIT = {
4393
+ scale: 1,
4394
+ x: 0,
4395
+ y: 0
4396
+ };
4397
+ /** The least zoom: the whole picture fitted. */
4398
+ var MIN_SCALE = 1;
4399
+ /** The most zoom, 32 times the fit. */
4400
+ var MAX_SCALE = 32;
4401
+ /** Keeps the picture from being dragged out of its frame: at most half the extra width or height past each edge. */
4402
+ function clampViewport(v, frame) {
4403
+ const scale = Math.min(32, Math.max(1, v.scale));
4404
+ if (scale === 1) return FIT;
4405
+ const mx = (scale - 1) * frame.width / 2;
4406
+ const my = (scale - 1) * frame.height / 2;
4407
+ return {
4408
+ scale,
4409
+ x: Math.min(mx, Math.max(-mx, v.x)),
4410
+ y: Math.min(my, Math.max(-my, v.y))
4411
+ };
4412
+ }
4413
+ /** A new scale with the point under `at` (pixels from the frame's centre) staying under it. */
4414
+ function zoomAt(v, nextScale, at, frame) {
4415
+ const scale = Math.min(32, Math.max(1, nextScale));
4416
+ const k = scale / v.scale;
4417
+ return clampViewport({
4418
+ scale,
4419
+ x: at.x - k * (at.x - v.x),
4420
+ y: at.y - k * (at.y - v.y)
4421
+ }, frame);
4422
+ }
4423
+ /** The scale at which the picture's own pixels are drawn one to one: its natural width over the width it is fitted at. */
4424
+ function actualPixelsScale(naturalWidth, fittedWidth) {
4425
+ if (!naturalWidth || !fittedWidth) return 1;
4426
+ return Math.min(32, Math.max(1, naturalWidth / fittedWidth));
4427
+ }
4428
+ /** The CSS transform for a viewport. */
4429
+ function viewportTransform(v) {
4430
+ return `translate(${v.x}px, ${v.y}px) scale(${v.scale})`;
4431
+ }
4432
+ // src/components/compare-parts.tsx
4433
+ /** A word for a picture's name on the page: its label, with its note unless blind. */
4434
+ function Caption({ c, blind }) {
4435
+ return /* @__PURE__ */ jsxs("div", {
4436
+ className: "flex items-baseline gap-2",
4437
+ children: [/* @__PURE__ */ jsx("span", {
4438
+ className: "type-label",
4439
+ children: c.label
4440
+ }), !blind && c.note && /* @__PURE__ */ jsx("span", {
4441
+ className: "type-caption text-muted-foreground",
4442
+ children: c.note
4443
+ })]
4444
+ });
4445
+ }
4446
+ /** One picture inside a frame: a skeleton while it loads, the product's words if it fails. */
4447
+ function Picture({ c, blind, missing, onNatural, imgRef }) {
4448
+ const [state, setState] = React.useState("loading");
4449
+ React.useEffect(() => setState("loading"), [c.media.src]);
4450
+ const alt = blind ? c.label : c.media.alt;
4451
+ if (state === "failed") return /* @__PURE__ */ jsxs("div", {
4452
+ role: "img",
4453
+ "aria-label": `${alt}: ${missing}`,
4454
+ className: "absolute inset-0 grid place-content-center justify-items-center gap-2 text-muted-foreground",
4455
+ children: [/* @__PURE__ */ jsx(ImageOff, {
4456
+ "aria-hidden": true,
4457
+ className: "size-6"
4458
+ }), /* @__PURE__ */ jsx("span", {
4459
+ className: "type-body-sm",
4460
+ children: missing
4461
+ })]
4462
+ });
4463
+ return /* @__PURE__ */ jsxs(Fragment, { children: [state === "loading" && /* @__PURE__ */ jsx(Skeleton, {
4464
+ "aria-hidden": true,
4465
+ className: "absolute inset-0 size-full rounded-none"
4466
+ }), /* @__PURE__ */ jsx("img", {
4467
+ ref: imgRef,
4468
+ src: c.media.src,
4469
+ alt,
4470
+ draggable: false,
4471
+ onLoad: (e) => {
4472
+ setState("ready");
4473
+ onNatural?.(e.currentTarget.naturalWidth, e.currentTarget.naturalHeight);
4474
+ },
4475
+ onError: () => setState("failed"),
4476
+ className: "absolute inset-0 size-full object-contain"
4477
+ })] });
4478
+ }
4479
+ var frameSize = (frame) => {
4480
+ const r = frame.current?.getBoundingClientRect();
4481
+ return {
4482
+ width: r?.width ?? 0,
4483
+ height: r?.height ?? 0
4484
+ };
4485
+ };
4486
+ /** Zoom steps about the frame's centre, and 1:1. */
4487
+ function useZoom({ viewport, setViewport, frame, natural }) {
4488
+ const by = (k) => setViewport(zoomAt(viewport, viewport.scale * k, {
4489
+ x: 0,
4490
+ y: 0
4491
+ }, frameSize(frame)));
4492
+ const actual = () => {
4493
+ const f = frameSize(frame);
4494
+ const fitted = natural ? Math.min(f.width, f.height * (natural[0] / natural[1])) : f.width;
4495
+ setViewport(zoomAt(viewport, actualPixelsScale(natural?.[0] ?? 0, fitted), {
4496
+ x: 0,
4497
+ y: 0
4498
+ }, f));
4499
+ };
4500
+ return {
4501
+ by,
4502
+ actual,
4503
+ fit: () => setViewport(FIT)
4504
+ };
4505
+ }
4506
+ /** The shortcuts for zoom and full screen, to join a screen's own list. */
4507
+ function zoomShortcuts(zoom, full, setFull) {
4508
+ return [
4509
+ {
4510
+ keys: ["+", "="],
4511
+ label: "Zoom in",
4512
+ run: () => zoom.by(1.5),
4513
+ repeat: true
4514
+ },
4515
+ {
4516
+ keys: ["-"],
4517
+ label: "Zoom out",
4518
+ run: () => zoom.by(1 / 1.5),
4519
+ repeat: true
4520
+ },
4521
+ {
4522
+ keys: ["0"],
4523
+ label: "Fit",
4524
+ run: zoom.fit
4525
+ },
4526
+ {
4527
+ keys: ["f"],
4528
+ label: full ? "Leave full screen" : "Full screen",
4529
+ run: () => setFull(!full)
4530
+ }
4531
+ ];
4532
+ }
4533
+ /** Zoom out, in, fit, 1:1 and the zoom now, for inside a `Toolbar`. */
4534
+ function ZoomControls({ viewport, zoom, natural }) {
4535
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
4536
+ /* @__PURE__ */ jsx(IconButton, {
4537
+ icon: ZoomOut,
4538
+ label: "Zoom out",
4539
+ onPress: () => zoom.by(1 / 1.5),
4540
+ disabled: viewport.scale <= 1
4541
+ }),
4542
+ /* @__PURE__ */ jsx(IconButton, {
4543
+ icon: ZoomIn,
4544
+ label: "Zoom in",
4545
+ onPress: () => zoom.by(1.5)
4546
+ }),
4547
+ /* @__PURE__ */ jsx(IconButton, {
4548
+ icon: Scan,
4549
+ label: "Fit",
4550
+ onPress: zoom.fit,
4551
+ disabled: viewport.scale === 1
4552
+ }),
4553
+ /* @__PURE__ */ jsx(Button, {
4554
+ size: "sm",
4555
+ variant: "ghost",
4556
+ onPress: zoom.actual,
4557
+ disabled: !natural,
4558
+ children: "1:1"
4559
+ }),
4560
+ /* @__PURE__ */ jsx("span", {
4561
+ "aria-live": "off",
4562
+ className: "type-caption tabular-nums text-muted-foreground",
4563
+ children: viewport.scale === 1 ? "Fit" : `${viewport.scale.toFixed(1)}×`
4564
+ })
4565
+ ] });
4566
+ }
4567
+ /** The full-screen button, for inside a `Toolbar`. */
4568
+ function FullscreenButton({ full, setFull }) {
4569
+ return /* @__PURE__ */ jsx(IconButton, {
4570
+ icon: full ? Minimize : Maximize,
4571
+ label: full ? "Leave full screen" : "Full screen",
4572
+ onPress: () => setFull(!full)
4573
+ });
4574
+ }
4575
+ // src/lib/image-diff.ts
4576
+ /** The longest side, in pixels, a picture is compared at. */
4577
+ var MAX_SIDE = 2048;
4578
+ /** pixelmatch's own default colour distance below which two pixels are the same. */
4579
+ var DEFAULT_TOLERANCE = .1;
4580
+ /** The picture drawn at another size, each new pixel taken from the nearest old one. Used to bring the second picture to the first's size. */
4581
+ function resample(p, width, height) {
4582
+ if (p.width === width && p.height === height) return p;
4583
+ const data = new Uint8ClampedArray(width * height * 4);
4584
+ for (let y = 0; y < height; y++) {
4585
+ const sy = Math.min(p.height - 1, Math.floor((y + .5) * p.height / height));
4586
+ for (let x = 0; x < width; x++) {
4587
+ const sx = Math.min(p.width - 1, Math.floor((x + .5) * p.width / width));
4588
+ const from = (sy * p.width + sx) * 4;
4589
+ const to = (y * width + x) * 4;
4590
+ data[to] = p.data[from];
4591
+ data[to + 1] = p.data[from + 1];
4592
+ data[to + 2] = p.data[from + 2];
4593
+ data[to + 3] = p.data[from + 3];
4594
+ }
4595
+ }
4596
+ return {
4597
+ data,
4598
+ width,
4599
+ height
4600
+ };
4601
+ }
4602
+ /**
4603
+ * Which pixels differ between two pictures. `b` is resampled to `a`'s size first when they differ,
4604
+ * so a re-encoded or resized rendering still lines up. `tolerance` is pixelmatch's `threshold`, 0 to 1.
4605
+ */
4606
+ function differences(a, b, tolerance = DEFAULT_TOLERANCE) {
4607
+ const other = resample(b, a.width, a.height);
4608
+ const marks = new Uint8ClampedArray(a.width * a.height * 4);
4609
+ const differing = pixelmatch(a.data, other.data, marks, a.width, a.height, {
4610
+ threshold: tolerance,
4611
+ diffMask: true,
4612
+ alpha: 0
4613
+ });
4614
+ return {
4615
+ marks,
4616
+ width: a.width,
4617
+ height: a.height,
4618
+ differing,
4619
+ total: a.width * a.height
4620
+ };
4621
+ }
4622
+ /** Reads a picture's pixels by drawing it on a canvas, scaled down so its long side is at most `maxSide`. Rejects when the picture cannot be loaded or the browser will not let a page read it (a picture from another site without CORS headers). */
4623
+ async function readPixels(src, maxSide = MAX_SIDE) {
4624
+ const img = new Image();
4625
+ img.crossOrigin = "anonymous";
4626
+ img.src = src;
4627
+ await img.decode();
4628
+ const scale = Math.min(1, maxSide / Math.max(img.naturalWidth, img.naturalHeight));
4629
+ const width = Math.max(1, Math.round(img.naturalWidth * scale));
4630
+ const height = Math.max(1, Math.round(img.naturalHeight * scale));
4631
+ const canvas = document.createElement("canvas");
4632
+ canvas.width = width;
4633
+ canvas.height = height;
4634
+ const ctx = canvas.getContext("2d", { willReadFrequently: true });
4635
+ if (!ctx) throw new Error("This browser cannot read a picture's pixels.");
4636
+ ctx.drawImage(img, 0, 0, width, height);
4637
+ const { data } = ctx.getImageData(0, 0, width, height);
4638
+ return {
4639
+ data,
4640
+ width,
4641
+ height
4642
+ };
4643
+ }
4644
+ // src/components/difference.tsx
4645
+ /** The pixels that differ between two pictures at a tolerance (0 to 1), read only while `enabled`. */
4646
+ function useDifference(a, b, tolerance, enabled, read = readPixels) {
4647
+ const [loaded, setLoaded] = React.useState(null);
4648
+ const key = `${a}|${b}`;
4649
+ const reader = React.useRef(read);
4650
+ reader.current = read;
4651
+ React.useEffect(() => {
4652
+ if (!enabled) return;
4653
+ let cancelled = false;
4654
+ setLoaded(null);
4655
+ Promise.all([reader.current(a), reader.current(b)]).then(([pa, pb]) => !cancelled && setLoaded({
4656
+ key,
4657
+ a: pa,
4658
+ b: pb
4659
+ }), () => !cancelled && setLoaded("failed"));
4660
+ return () => {
4661
+ cancelled = true;
4662
+ };
4663
+ }, [
4664
+ a,
4665
+ b,
4666
+ key,
4667
+ enabled
4668
+ ]);
4669
+ const deferred = React.useDeferredValue(tolerance);
4670
+ const difference = React.useMemo(() => loaded && loaded !== "failed" && loaded.key === key ? differences(loaded.a, loaded.b, deferred) : null, [
4671
+ loaded,
4672
+ key,
4673
+ deferred
4674
+ ]);
4675
+ if (loaded === "failed") return { status: "failed" };
4676
+ return difference ? {
4677
+ status: "ready",
4678
+ difference
4679
+ } : { status: "loading" };
4680
+ }
4681
+ /** The marks of a difference drawn over the picture: a canvas that fits its frame the way the picture does (`object-contain`). */
4682
+ function DifferenceMarks({ difference }) {
4683
+ const ref = React.useRef(null);
4684
+ React.useEffect(() => {
4685
+ const canvas = ref.current;
4686
+ const ctx = canvas?.getContext("2d");
4687
+ if (!canvas || !ctx) return;
4688
+ canvas.width = difference.width;
4689
+ canvas.height = difference.height;
4690
+ ctx.putImageData(new ImageData(difference.marks, difference.width, difference.height), 0, 0);
4691
+ }, [difference]);
4692
+ return /* @__PURE__ */ jsx("canvas", {
4693
+ ref,
4694
+ "aria-hidden": true,
4695
+ className: "absolute inset-0 size-full object-contain"
4696
+ });
4697
+ }
4255
4698
  // src/components/viewport.tsx
4256
4699
  /** Zoom and pan held in React state, to give to every `ViewportFrame` that should move together. */
4257
4700
  function useViewport(initial = FIT) {
@@ -4402,62 +4845,18 @@ var MODE_LABEL = {
4402
4845
  side: "Side by side",
4403
4846
  swipe: "Swipe",
4404
4847
  fade: "Fade",
4405
- blink: "Blink"
4848
+ blink: "Blink",
4849
+ difference: "Difference"
4406
4850
  };
4407
4851
  var ALL_MODES = [
4408
4852
  "side",
4409
4853
  "swipe",
4410
4854
  "fade",
4411
- "blink"
4855
+ "blink",
4856
+ "difference"
4412
4857
  ];
4413
- /** A word for a picture's name on the page: its label, with its note unless blind. */
4414
- function Caption({ c, blind }) {
4415
- return /* @__PURE__ */ jsxs("div", {
4416
- className: "flex items-baseline gap-2",
4417
- children: [/* @__PURE__ */ jsx("span", {
4418
- className: "type-label",
4419
- children: c.label
4420
- }), !blind && c.note && /* @__PURE__ */ jsx("span", {
4421
- className: "type-caption text-muted-foreground",
4422
- children: c.note
4423
- })]
4424
- });
4425
- }
4426
- /** One picture inside a frame: a skeleton while it loads, the product's words if it fails. */
4427
- function Picture({ c, blind, missing, onNatural, imgRef }) {
4428
- const [state, setState] = React.useState("loading");
4429
- React.useEffect(() => setState("loading"), [c.media.src]);
4430
- const alt = blind ? c.label : c.media.alt;
4431
- if (state === "failed") return /* @__PURE__ */ jsxs("div", {
4432
- role: "img",
4433
- "aria-label": `${alt}: ${missing}`,
4434
- className: "absolute inset-0 grid place-content-center justify-items-center gap-2 text-muted-foreground",
4435
- children: [/* @__PURE__ */ jsx(ImageOff, {
4436
- "aria-hidden": true,
4437
- className: "size-6"
4438
- }), /* @__PURE__ */ jsx("span", {
4439
- className: "type-body-sm",
4440
- children: missing
4441
- })]
4442
- });
4443
- return /* @__PURE__ */ jsxs(Fragment, { children: [state === "loading" && /* @__PURE__ */ jsx(Skeleton, {
4444
- "aria-hidden": true,
4445
- className: "absolute inset-0 size-full rounded-none"
4446
- }), /* @__PURE__ */ jsx("img", {
4447
- ref: imgRef,
4448
- src: c.media.src,
4449
- alt,
4450
- draggable: false,
4451
- onLoad: (e) => {
4452
- setState("ready");
4453
- onNatural?.(e.currentTarget.naturalWidth, e.currentTarget.naturalHeight);
4454
- },
4455
- onError: () => setState("failed"),
4456
- className: "absolute inset-0 size-full object-contain"
4457
- })] });
4458
- }
4459
4858
  /** Two pictures to judge, side by side or laid over each other, zoomed and panned together, and full screen. */
4460
- function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_MODES, keys = true, className }) {
4859
+ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_MODES, keys = true, cannotCompare = "Could not read these pictures to compare their pixels.", readPixels, defaultDifference = "brightness", className }) {
4461
4860
  const { viewport, setViewport } = useViewport();
4462
4861
  const [full, setFull] = React.useState(false);
4463
4862
  const pairKey = `${a.media.src}|${b.media.src}`;
@@ -4466,28 +4865,19 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
4466
4865
  const [divider, setDivider] = React.useState(50);
4467
4866
  const [blend, setBlend] = React.useState(50);
4468
4867
  const [showing, setShowing] = React.useState("a");
4868
+ const [style, setStyle] = React.useState(defaultDifference);
4869
+ const [amplify, setAmplify] = React.useState(4);
4870
+ const [tolerance, setTolerance] = React.useState(10);
4871
+ const diff = useDifference(a.media.src, b.media.src, tolerance / 100, mode === "difference" && style === "pixels", readPixels);
4469
4872
  const frameRef = React.useRef(null);
4470
4873
  const imgRef = React.useRef(null);
4471
4874
  const aspect = natural ? natural[0] / natural[1] : 3 / 2;
4472
- const frameSize = () => {
4473
- const r = frameRef.current?.getBoundingClientRect();
4474
- return {
4475
- width: r?.width ?? 0,
4476
- height: r?.height ?? 0
4477
- };
4478
- };
4479
- const zoomBy = (k) => setViewport(zoomAt(viewport, viewport.scale * k, {
4480
- x: 0,
4481
- y: 0
4482
- }, frameSize()));
4483
- const actual = () => {
4484
- const f = frameSize();
4485
- const fitted = natural ? Math.min(f.width, f.height * (natural[0] / natural[1])) : f.width;
4486
- setViewport(zoomAt(viewport, actualPixelsScale(natural?.[0] ?? 0, fitted), {
4487
- x: 0,
4488
- y: 0
4489
- }, f));
4490
- };
4875
+ const zoom = useZoom({
4876
+ viewport,
4877
+ setViewport,
4878
+ frame: frameRef,
4879
+ natural
4880
+ });
4491
4881
  const flip = () => setShowing((s) => s === "a" ? "b" : "a");
4492
4882
  const offered = modes.includes(mode) ? modes : [mode, ...modes];
4493
4883
  const shortcuts = [
@@ -4502,28 +4892,7 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
4502
4892
  run: flip,
4503
4893
  disabled: mode !== "blink"
4504
4894
  },
4505
- {
4506
- keys: ["+", "="],
4507
- label: "Zoom in",
4508
- run: () => zoomBy(1.5),
4509
- repeat: true
4510
- },
4511
- {
4512
- keys: ["-"],
4513
- label: "Zoom out",
4514
- run: () => zoomBy(1 / 1.5),
4515
- repeat: true
4516
- },
4517
- {
4518
- keys: ["0"],
4519
- label: "Fit",
4520
- run: () => setViewport(FIT)
4521
- },
4522
- {
4523
- keys: ["f"],
4524
- label: full ? "Leave full screen" : "Full screen",
4525
- run: () => setFull((f) => !f)
4526
- }
4895
+ ...zoomShortcuts(zoom, full, setFull)
4527
4896
  ];
4528
4897
  useHotkeys(shortcuts, { enabled: keys });
4529
4898
  const pane = (c, ref, onNatural) => /* @__PURE__ */ jsx(Picture, {
@@ -4558,6 +4927,56 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
4558
4927
  })]
4559
4928
  }, i))
4560
4929
  });
4930
+ else if (mode === "difference") body = /* @__PURE__ */ jsxs("figure", {
4931
+ className: "grid gap-1.5",
4932
+ children: [/* @__PURE__ */ jsxs("div", {
4933
+ className: "flex justify-between gap-4",
4934
+ children: [
4935
+ /* @__PURE__ */ jsx(Caption, {
4936
+ c: a,
4937
+ blind
4938
+ }),
4939
+ /* @__PURE__ */ jsx("span", {
4940
+ className: "type-caption text-muted-foreground",
4941
+ children: "against"
4942
+ }),
4943
+ /* @__PURE__ */ jsx(Caption, {
4944
+ c: b,
4945
+ blind
4946
+ })
4947
+ ]
4948
+ }), /* @__PURE__ */ jsx(ViewportFrame, {
4949
+ ...frameProps,
4950
+ ref: frameRef,
4951
+ label: `Difference between ${a.label} and ${b.label}`,
4952
+ children: style === "brightness" ? /* @__PURE__ */ jsxs("div", {
4953
+ className: "absolute inset-0 isolate",
4954
+ style: { filter: `brightness(${amplify})` },
4955
+ children: [/* @__PURE__ */ jsx("div", {
4956
+ className: "absolute inset-0 bg-background",
4957
+ children: pane(a, imgRef, learn)
4958
+ }), /* @__PURE__ */ jsx("div", {
4959
+ className: "absolute inset-0 bg-background mix-blend-difference",
4960
+ children: pane(b)
4961
+ })]
4962
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
4963
+ /* @__PURE__ */ jsx("div", {
4964
+ className: "absolute inset-0 opacity-35",
4965
+ children: pane(a, imgRef, learn)
4966
+ }),
4967
+ diff.status === "ready" && /* @__PURE__ */ jsx(DifferenceMarks, { difference: diff.difference }),
4968
+ diff.status === "loading" && /* @__PURE__ */ jsx(Skeleton, {
4969
+ "aria-hidden": true,
4970
+ className: "absolute inset-0 size-full rounded-none opacity-40"
4971
+ }),
4972
+ diff.status === "failed" && /* @__PURE__ */ jsx("p", {
4973
+ role: "alert",
4974
+ className: "absolute inset-x-0 bottom-0 bg-background/90 p-2 type-body-sm text-danger",
4975
+ children: cannotCompare
4976
+ })
4977
+ ] })
4978
+ })]
4979
+ });
4561
4980
  else {
4562
4981
  const top = mode === "blink" ? showing === "a" ? a : b : a;
4563
4982
  const bottom = b;
@@ -4638,40 +5057,15 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
4638
5057
  size: "sm"
4639
5058
  }),
4640
5059
  /* @__PURE__ */ jsx(ToolbarSeparator, {}),
4641
- /* @__PURE__ */ jsx(IconButton, {
4642
- icon: ZoomOut,
4643
- label: "Zoom out",
4644
- onPress: () => zoomBy(1 / 1.5),
4645
- disabled: viewport.scale <= 1
4646
- }),
4647
- /* @__PURE__ */ jsx(IconButton, {
4648
- icon: ZoomIn,
4649
- label: "Zoom in",
4650
- onPress: () => zoomBy(1.5)
4651
- }),
4652
- /* @__PURE__ */ jsx(IconButton, {
4653
- icon: Scan,
4654
- label: "Fit",
4655
- onPress: () => setViewport(FIT),
4656
- disabled: viewport.scale === 1
4657
- }),
4658
- /* @__PURE__ */ jsx(Button, {
4659
- size: "sm",
4660
- variant: "ghost",
4661
- onPress: actual,
4662
- disabled: !natural,
4663
- children: "1:1"
4664
- }),
4665
- /* @__PURE__ */ jsx("span", {
4666
- "aria-live": "off",
4667
- className: "type-caption tabular-nums text-muted-foreground",
4668
- children: viewport.scale === 1 ? "Fit" : `${viewport.scale.toFixed(1)}×`
5060
+ /* @__PURE__ */ jsx(ZoomControls, {
5061
+ viewport,
5062
+ zoom,
5063
+ natural
4669
5064
  }),
4670
5065
  /* @__PURE__ */ jsx(ToolbarSeparator, {}),
4671
- /* @__PURE__ */ jsx(IconButton, {
4672
- icon: full ? Minimize : Maximize,
4673
- label: full ? "Leave full screen" : "Full screen",
4674
- onPress: () => setFull(!full)
5066
+ /* @__PURE__ */ jsx(FullscreenButton, {
5067
+ full,
5068
+ setFull
4675
5069
  })
4676
5070
  ]
4677
5071
  }),
@@ -4698,6 +5092,70 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
4698
5092
  })
4699
5093
  ]
4700
5094
  }),
5095
+ mode === "difference" && /* @__PURE__ */ jsxs("div", {
5096
+ className: "grid gap-2",
5097
+ children: [/* @__PURE__ */ jsx(ToggleGroup, {
5098
+ label: "Difference style",
5099
+ options: [{
5100
+ value: "brightness",
5101
+ label: "Brightness"
5102
+ }, {
5103
+ value: "pixels",
5104
+ label: "Changed pixels"
5105
+ }],
5106
+ value: style,
5107
+ onChange: (v) => setStyle(v),
5108
+ size: "sm",
5109
+ className: "justify-self-start"
5110
+ }), style === "brightness" ? /* @__PURE__ */ jsxs("div", {
5111
+ className: "flex items-center gap-3",
5112
+ children: [
5113
+ /* @__PURE__ */ jsx("span", {
5114
+ className: "type-caption text-muted-foreground",
5115
+ children: "Amplify"
5116
+ }),
5117
+ /* @__PURE__ */ jsx(Slider, {
5118
+ "aria-label": "Amplify differences",
5119
+ value: amplify,
5120
+ onChange: setAmplify,
5121
+ min: 1,
5122
+ max: 8,
5123
+ hideValue: true,
5124
+ className: "flex-1"
5125
+ }),
5126
+ /* @__PURE__ */ jsxs("span", {
5127
+ className: "w-8 type-caption tabular-nums text-muted-foreground",
5128
+ children: [amplify, "×"]
5129
+ })
5130
+ ]
5131
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
5132
+ className: "flex items-center gap-3",
5133
+ children: [
5134
+ /* @__PURE__ */ jsx("span", {
5135
+ className: "type-caption text-muted-foreground",
5136
+ children: "Tolerance"
5137
+ }),
5138
+ /* @__PURE__ */ jsx(Slider, {
5139
+ "aria-label": "Tolerance for a changed pixel",
5140
+ value: tolerance,
5141
+ onChange: setTolerance,
5142
+ min: 0,
5143
+ max: 50,
5144
+ unit: "%",
5145
+ hideValue: true,
5146
+ className: "flex-1"
5147
+ }),
5148
+ /* @__PURE__ */ jsxs("span", {
5149
+ className: "w-10 type-caption tabular-nums text-muted-foreground",
5150
+ children: [tolerance, "%"]
5151
+ })
5152
+ ]
5153
+ }), /* @__PURE__ */ jsx("p", {
5154
+ role: "status",
5155
+ className: "type-body-sm text-muted-foreground",
5156
+ children: diff.status === "ready" ? diff.difference.differing === 0 ? "No pixels differ at this tolerance." : `${format.share(diff.difference.differing / diff.difference.total)} of pixels differ at this tolerance.` : diff.status === "loading" ? "Comparing pixels…" : ""
5157
+ })] })]
5158
+ }),
4701
5159
  mode === "blink" && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(ToggleGroup, {
4702
5160
  label: "Showing",
4703
5161
  options: [{
@@ -4717,6 +5175,91 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
4717
5175
  })
4718
5176
  });
4719
5177
  }
4720
- export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, Breadcrumb, BulkBar, Button, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGroup, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompositionBar, ContextMenu, DataTable, DataView, Dialog, Disclosure, Done, EmptyState, FIT, Field, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, JobStatus, KeysLegend, LineChart, LinkCard, LinkCardList, LoadError, LoadMore, MAX_SCALE, MIN_SCALE, MISSING, Menu, Meter, Metric, MetricStrip, NBSP, NativeSelect, NumberField, PageHeader, Popover, RowAction, SelectableGrid, SideNav, Skeleton, Slider, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, TableSkeleton, Tabs, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, UndoBar, ViewportFrame, VirtualList, actualPixelsScale, buttonVariants, canFullscreen, clampViewport, cn, colorSchemeScript, commandShortcut, createFormat, createQueryClient, crossedThreshold, describeActionError, describeHttpError, detectPlatform, fetchJson, fieldErrorsOf, format, formatChord, isReservedChord, isTypingTarget, labelOf, matchesChord, parseChord, parseSort, readErrorBody, serialiseSort, staleOf, toDate, toLoad, toast, toastTimeout, typeSteps, useActiveItem, useAsyncAction, useClientWork, useColorScheme, useCommands, useExpanded, useHotkeys, useInView, useInfiniteLoad, useJob, useLoad, useSelection, useSystemColorScheme, useUndoable, useViewport, zoomAt };
5178
+ // src/components/compare-grid.tsx
5179
+ var COLUMNS = {
5180
+ 2: "sm:grid-cols-2",
5181
+ 3: "sm:grid-cols-2 lg:grid-cols-3",
5182
+ 4: "sm:grid-cols-2 lg:grid-cols-4"
5183
+ };
5184
+ /** Many pictures in a grid, zoomed and panned together, and full screen. */
5185
+ function CompareGrid({ label, items, blind, missing, actions, columns = 3, keys = true, className }) {
5186
+ const { viewport, setViewport } = useViewport();
5187
+ const [full, setFull] = React.useState(false);
5188
+ const key = items.map((i) => i.media.src).join("|");
5189
+ const [learned, setLearned] = React.useState(null);
5190
+ const natural = items[0]?.media.size ?? (learned?.key === key ? learned.size : null);
5191
+ const aspect = natural ? natural[0] / natural[1] : 3 / 2;
5192
+ const first = React.useRef(null);
5193
+ const zoom = useZoom({
5194
+ viewport,
5195
+ setViewport,
5196
+ frame: first,
5197
+ natural
5198
+ });
5199
+ const shortcuts = zoomShortcuts(zoom, full, setFull);
5200
+ useHotkeys(shortcuts, { enabled: keys });
5201
+ return /* @__PURE__ */ jsx(FullscreenFrame, {
5202
+ label,
5203
+ active: full,
5204
+ onActiveChange: setFull,
5205
+ className,
5206
+ children: /* @__PURE__ */ jsxs("section", {
5207
+ "aria-label": label,
5208
+ className: cn("grid gap-3", full && "min-h-0 flex-1 content-start overflow-auto"),
5209
+ children: [
5210
+ /* @__PURE__ */ jsxs(Toolbar, {
5211
+ label: "Zoom",
5212
+ className: "items-center gap-2",
5213
+ children: [
5214
+ /* @__PURE__ */ jsx(ZoomControls, {
5215
+ viewport,
5216
+ zoom,
5217
+ natural
5218
+ }),
5219
+ /* @__PURE__ */ jsx(ToolbarSeparator, {}),
5220
+ /* @__PURE__ */ jsx(FullscreenButton, {
5221
+ full,
5222
+ setFull
5223
+ })
5224
+ ]
5225
+ }),
5226
+ /* @__PURE__ */ jsx("div", {
5227
+ className: cn("grid gap-3", COLUMNS[columns]),
5228
+ children: items.map((c, i) => /* @__PURE__ */ jsxs("figure", {
5229
+ className: "grid content-start gap-1.5",
5230
+ children: [
5231
+ /* @__PURE__ */ jsx(Caption, {
5232
+ c,
5233
+ blind
5234
+ }),
5235
+ /* @__PURE__ */ jsx(ViewportFrame, {
5236
+ viewport,
5237
+ setViewport,
5238
+ aspect,
5239
+ label: blind ? `Picture ${c.label}` : c.label,
5240
+ ref: i === 0 ? first : void 0,
5241
+ children: /* @__PURE__ */ jsx(Picture, {
5242
+ c,
5243
+ blind,
5244
+ missing,
5245
+ onNatural: i === 0 ? (w, h) => setLearned({
5246
+ key,
5247
+ size: [w, h]
5248
+ }) : void 0
5249
+ })
5250
+ }),
5251
+ actions && /* @__PURE__ */ jsx("div", {
5252
+ className: "flex flex-wrap gap-2",
5253
+ children: actions(c)
5254
+ })
5255
+ ]
5256
+ }, c.id))
5257
+ }),
5258
+ keys && /* @__PURE__ */ jsx(KeysLegend, { shortcuts })
5259
+ ]
5260
+ })
5261
+ });
5262
+ }
5263
+ export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, Breadcrumb, BulkBar, Button, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGroup, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareGrid, CompositionBar, ContextMenu, DEFAULT_TOLERANCE, DataTable, DataView, Dialog, Disclosure, Done, EmptyState, FIT, Field, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, Inspector, InspectorSection, JobStatus, KeysLegend, LineChart, LinkCard, LinkCardList, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Menu, Meter, Metric, MetricStrip, NBSP, NativeSelect, NumberField, PageHeader, Popover, PropertyList, PropertyRow, RowAction, SelectableGrid, SideNav, Skeleton, Slider, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, TableSkeleton, Tabs, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, UndoBar, ViewportFrame, VirtualList, actualPixelsScale, buttonVariants, canFullscreen, clampViewport, cn, colorSchemeScript, commandShortcut, createFormat, createQueryClient, crossedThreshold, describeActionError, describeHttpError, detectPlatform, differences, fetchJson, fieldErrorsOf, format, formatChord, isReservedChord, isTypingTarget, labelOf, matchesChord, parseChord, parseSort, readErrorBody, readPixels, resample, serialiseSort, staleOf, toDate, toLoad, toast, toastTimeout, typeSteps, useActiveItem, useAsyncAction, useClientWork, useColorScheme, useCommands, useDifference, useExpanded, useHotkeys, useInView, useInfiniteLoad, useJob, useLoad, useSelection, useSystemColorScheme, useUndoable, useViewport, zoomAt };
4721
5264
 
4722
5265
  //# sourceMappingURL=index.js.map