strata-react 1.3.19 → 1.3.21
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/README.md +32 -7
- package/UPGRADING.md +10 -1
- package/dist/{errors-jep2voNI.js → button-KGJI6jQr.js} +3 -95
- package/dist/button-KGJI6jQr.js.map +1 -0
- package/dist/components/byte-view.d.ts +32 -0
- package/dist/components/composition.d.ts +10 -1
- package/dist/components/console.d.ts +34 -0
- package/dist/components/disclosure.d.ts +2 -0
- package/dist/components/file-intake.d.ts +9 -0
- package/dist/components/hotkeys.d.ts +4 -0
- package/dist/components/pixel-image.d.ts +29 -0
- package/dist/components/shortcut-editor.d.ts +44 -0
- package/dist/components/tree.d.ts +4 -2
- package/dist/components/workspace.d.ts +22 -2
- package/dist/errors-BUvY1Z4d.js +95 -0
- package/dist/errors-BUvY1Z4d.js.map +1 -0
- package/dist/{field-t4Hoer0d.js → field-BjeE_FeB.js} +6 -101
- package/dist/field-BjeE_FeB.js.map +1 -0
- package/dist/index.d.ts +8 -3
- package/dist/index.js +963 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/object-url.d.ts +2 -0
- package/dist/map.js +3 -2
- package/dist/map.js.map +1 -1
- package/dist/{microphone-B5ITwm4G.js → microphone-Bo3WaXgD.js} +5 -3
- package/dist/{microphone-B5ITwm4G.js.map → microphone-Bo3WaXgD.js.map} +1 -1
- package/dist/panorama.js +3 -3
- package/dist/scene/camera.d.ts +71 -0
- package/dist/scene/index.d.ts +2 -0
- package/dist/scene/scene-viewport.d.ts +46 -0
- package/dist/scene.js +526 -0
- package/dist/scene.js.map +1 -0
- package/dist/strata.bare.css +1 -0
- package/dist/strata.css +1 -0
- package/dist/strata.migrate.css +1 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/layout.d.ts +1 -1
- package/dist/testing/setup.d.ts +14 -0
- package/dist/testing.js +21 -5
- package/dist/testing.js.map +1 -1
- package/dist/{theme-DXacprlw.js → theme-CxYZkUNk.js} +3 -2
- package/dist/{theme-DXacprlw.js.map → theme-CxYZkUNk.js.map} +1 -1
- package/dist/tooltip-DhqrDtyu.js +103 -0
- package/dist/tooltip-DhqrDtyu.js.map +1 -0
- package/dist/{value-controls-DB5l5Qe2.js → value-controls-Dq2-QpvA.js} +8 -4
- package/dist/value-controls-Dq2-QpvA.js.map +1 -0
- package/package.json +6 -1
- package/dist/errors-jep2voNI.js.map +0 -1
- package/dist/field-t4Hoer0d.js.map +0 -1
- package/dist/value-controls-DB5l5Qe2.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
1
|
+
import { i as typeSteps, n as KeyText, r as cn, t as Tooltip } from "./tooltip-DhqrDtyu.js";
|
|
2
|
+
import { a as Textarea, c as useSearchParam, d as createFormat, f as format, i as NativeSelect, l as MISSING, n as Field, o as useFieldControl, p as toDate, r as Input, s as controlHeight, t as ChoiceGroup, u as NBSP } from "./field-BjeE_FeB.js";
|
|
3
|
+
import { a as isDev, i as buttonVariants, n as IconButton, o as useInView, r as RowAction, t as Button } from "./button-KGJI6jQr.js";
|
|
4
|
+
import { A as StrataQueryProvider, C as toast, D as LoadError, E as EmptyState, F as useLoad, I as usePoll, L as overlaySurface, M as fetchJson, N as staleOf, O as Skeleton, P as toLoad, S as StrataToastRegion, T as DataView$1, _ as clampViewport, a as useMicrophone, b as viewportTransform, d as zoomToBox, f as FIT, g as boxViewport, h as actualPixelsScale, i as explainMicrophoneError, j as createQueryClient, k as StaleNotice, l as readingOrder, m as MIN_SCALE, n as MicrophoneError, o as Thumbnail, p as MAX_SCALE, r as browserMicrophone, s as ThumbnailSkeleton, t as MicrophoneContext, u as regionStyle, v as frameBoxToShares, w as toastTimeout, x as zoomAt, y as regionShares } from "./microphone-Bo3WaXgD.js";
|
|
5
|
+
import { a as useAsyncAction, c as KeysLegend, d as useHotkeys, i as AsyncButton, l as isTypingTarget, n as NumberField, o as Toolbar, r as Slider, s as ToolbarSeparator, t as ColorField, u as keyName } from "./value-controls-Dq2-QpvA.js";
|
|
5
6
|
import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-DDGBPiTJ.js";
|
|
6
|
-
import { a as
|
|
7
|
+
import { a as fieldErrorsOf, i as errorPayload, n as describeActionError, o as readErrorBody, r as describeHttpError, t as HttpError } from "./errors-BUvY1Z4d.js";
|
|
8
|
+
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-CxYZkUNk.js";
|
|
7
9
|
import * as React from "react";
|
|
8
10
|
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";
|
|
9
11
|
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";
|
|
@@ -1490,15 +1492,40 @@ function SystemPanel({ load, thresholds = diskThresholds, facts = [], now, headi
|
|
|
1490
1492
|
}
|
|
1491
1493
|
// src/components/composition.tsx
|
|
1492
1494
|
var MAX_TOKENS = 5;
|
|
1495
|
+
/** Keeps the four largest parts in their given order and sums the rest into one last part. */
|
|
1496
|
+
function foldParts(parts, label) {
|
|
1497
|
+
if (parts.length <= MAX_TOKENS) return parts;
|
|
1498
|
+
const keep = new Set(parts.map((p, i) => ({
|
|
1499
|
+
i,
|
|
1500
|
+
v: Math.max(0, p.value)
|
|
1501
|
+
})).sort((a, b) => b.v - a.v || a.i - b.i).slice(0, 4).map((x) => x.i));
|
|
1502
|
+
const rest = parts.filter((_, i) => !keep.has(i));
|
|
1503
|
+
const folded = {
|
|
1504
|
+
key: "strata-other",
|
|
1505
|
+
label: typeof label === "function" ? label(rest.length) : label,
|
|
1506
|
+
value: rest.reduce((n, p) => n + Math.max(0, p.value), 0)
|
|
1507
|
+
};
|
|
1508
|
+
return [...parts.filter((_, i) => keep.has(i)), folded];
|
|
1509
|
+
}
|
|
1493
1510
|
/** A part's colour: its own, or the chart token for its position. Throws past the fifth token. */
|
|
1494
1511
|
function colourFor(part, index) {
|
|
1495
1512
|
if (part.colour) return part.colour;
|
|
1496
1513
|
if (index >= MAX_TOKENS) throw new Error(`CompositionBar: part "${part.label}" is number ${index + 1}, and there are only ${MAX_TOKENS} chart colours. Combine the smallest parts into one "Other" part, or give this part a colour.`);
|
|
1497
1514
|
return `var(--chart-${index + 1})`;
|
|
1498
1515
|
}
|
|
1516
|
+
/** The parts to draw: folded when asked to, or, in production only, when a part has no colour to take. */
|
|
1517
|
+
function shown(label, parts, other) {
|
|
1518
|
+
if (other) return foldParts(parts, other.label);
|
|
1519
|
+
if (!isDev() && parts.some((p, i) => i >= MAX_TOKENS && !p.colour)) {
|
|
1520
|
+
console.error(`CompositionBar "${label}": ${parts.length} parts and only ${MAX_TOKENS} chart colours, so the smallest are shown as "Other". Pass \`other\` to fold them on purpose, or give each part a colour.`);
|
|
1521
|
+
return foldParts(parts, "Other");
|
|
1522
|
+
}
|
|
1523
|
+
return parts;
|
|
1524
|
+
}
|
|
1499
1525
|
/** What a whole is made of: a stacked bar for proportion and a table that names every part, its amount and its share, so colour is never the only cue. */
|
|
1500
|
-
function CompositionBar({ label, parts, formatValue, formatShare = format.share, partHeader = "Part", valueHeader = "Amount", shareHeader = "Share", className, ...whole }) {
|
|
1526
|
+
function CompositionBar({ label, parts, formatValue, formatShare = format.share, partHeader = "Part", valueHeader = "Amount", shareHeader = "Share", other, className, ...whole }) {
|
|
1501
1527
|
const captionId = React.useId();
|
|
1528
|
+
parts = shown(label, parts, other);
|
|
1502
1529
|
const sum = parts.reduce((n, p) => n + Math.max(0, p.value), 0);
|
|
1503
1530
|
const total = Math.max(whole.total ?? sum, sum);
|
|
1504
1531
|
const rest = whole.total !== void 0 ? total - sum : 0;
|
|
@@ -2812,6 +2839,12 @@ function api(expanded, set, single) {
|
|
|
2812
2839
|
else next.delete(key);
|
|
2813
2840
|
set(next);
|
|
2814
2841
|
},
|
|
2842
|
+
toggle: (key) => {
|
|
2843
|
+
const next = single ? /* @__PURE__ */ new Set() : new Set(expanded);
|
|
2844
|
+
if (expanded.has(key)) next.delete(key);
|
|
2845
|
+
else next.add(key);
|
|
2846
|
+
set(next);
|
|
2847
|
+
},
|
|
2815
2848
|
collapseAll: () => set(/* @__PURE__ */ new Set())
|
|
2816
2849
|
};
|
|
2817
2850
|
}
|
|
@@ -8012,6 +8045,82 @@ function FileDropZone({ onFiles, acceptLabel, title, disabled, refuseTypes, chil
|
|
|
8012
8045
|
] })
|
|
8013
8046
|
});
|
|
8014
8047
|
}
|
|
8048
|
+
var carriesFiles = (e, refuse) => {
|
|
8049
|
+
const types = Array.from(e.dataTransfer?.types ?? []);
|
|
8050
|
+
return types.includes("Files") && !refusesDrag({ has: (type) => types.includes(type) }, ["application/x-strata-drag", ...refuse]);
|
|
8051
|
+
};
|
|
8052
|
+
/** While files are dragged anywhere over the window, a dim overlay names what is taken ("Drop to add PAK files"); a drop calls `onFiles`. The app's own drags never trigger it. Keep a `FileButton` beside it for the keyboard and phones. */
|
|
8053
|
+
function FileDropOverlay({ onFiles, acceptLabel, disabled, refuseTypes }) {
|
|
8054
|
+
const [over, setOver] = React.useState(false);
|
|
8055
|
+
const live = React.useRef({
|
|
8056
|
+
onFiles,
|
|
8057
|
+
refuseTypes: refuseTypes ?? []
|
|
8058
|
+
});
|
|
8059
|
+
live.current = {
|
|
8060
|
+
onFiles,
|
|
8061
|
+
refuseTypes: refuseTypes ?? []
|
|
8062
|
+
};
|
|
8063
|
+
React.useEffect(() => {
|
|
8064
|
+
if (disabled) return;
|
|
8065
|
+
let depth = 0;
|
|
8066
|
+
const reset = () => {
|
|
8067
|
+
depth = 0;
|
|
8068
|
+
setOver(false);
|
|
8069
|
+
};
|
|
8070
|
+
const enter = (e) => {
|
|
8071
|
+
if (!carriesFiles(e, live.current.refuseTypes)) return;
|
|
8072
|
+
depth += 1;
|
|
8073
|
+
setOver(true);
|
|
8074
|
+
};
|
|
8075
|
+
const hover = (e) => {
|
|
8076
|
+
if (!carriesFiles(e, live.current.refuseTypes)) return;
|
|
8077
|
+
e.preventDefault();
|
|
8078
|
+
if (e.dataTransfer) e.dataTransfer.dropEffect = "copy";
|
|
8079
|
+
};
|
|
8080
|
+
const leave = (e) => {
|
|
8081
|
+
if (!carriesFiles(e, live.current.refuseTypes)) return;
|
|
8082
|
+
depth = Math.max(0, depth - 1);
|
|
8083
|
+
if (depth === 0) setOver(false);
|
|
8084
|
+
};
|
|
8085
|
+
const drop = (e) => {
|
|
8086
|
+
const wanted = carriesFiles(e, live.current.refuseTypes);
|
|
8087
|
+
reset();
|
|
8088
|
+
if (!wanted || e.defaultPrevented) return;
|
|
8089
|
+
e.preventDefault();
|
|
8090
|
+
const files = Array.from(e.dataTransfer?.items ?? []).filter((i) => i.kind === "file").map((i) => i.getAsFile()).filter((f) => f !== null);
|
|
8091
|
+
const list = files.length ? files : Array.from(e.dataTransfer?.files ?? []);
|
|
8092
|
+
if (list.length) live.current.onFiles(list);
|
|
8093
|
+
};
|
|
8094
|
+
document.addEventListener("dragenter", enter);
|
|
8095
|
+
document.addEventListener("dragover", hover);
|
|
8096
|
+
document.addEventListener("dragleave", leave);
|
|
8097
|
+
document.addEventListener("drop", drop);
|
|
8098
|
+
document.addEventListener("dragend", reset);
|
|
8099
|
+
return () => {
|
|
8100
|
+
document.removeEventListener("dragenter", enter);
|
|
8101
|
+
document.removeEventListener("dragover", hover);
|
|
8102
|
+
document.removeEventListener("dragleave", leave);
|
|
8103
|
+
document.removeEventListener("drop", drop);
|
|
8104
|
+
document.removeEventListener("dragend", reset);
|
|
8105
|
+
};
|
|
8106
|
+
}, [disabled]);
|
|
8107
|
+
if (!over || disabled) return null;
|
|
8108
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8109
|
+
"aria-hidden": true,
|
|
8110
|
+
"data-file-drop-overlay": true,
|
|
8111
|
+
className: "pointer-events-none fixed inset-0 layer-overlay grid place-items-center scrim p-6",
|
|
8112
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
8113
|
+
className: "flex items-center gap-3 rounded-overlay border-2 border-dashed border-primary bg-background px-6 py-5 shadow-overlay",
|
|
8114
|
+
children: [/* @__PURE__ */ jsx(Upload, {
|
|
8115
|
+
"aria-hidden": true,
|
|
8116
|
+
className: "size-5 text-primary"
|
|
8117
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
8118
|
+
className: "type-heading",
|
|
8119
|
+
children: ["Drop to add ", acceptLabel]
|
|
8120
|
+
})]
|
|
8121
|
+
})
|
|
8122
|
+
});
|
|
8123
|
+
}
|
|
8015
8124
|
var rowStatus = {
|
|
8016
8125
|
processing: {
|
|
8017
8126
|
tone: "info",
|
|
@@ -8128,6 +8237,812 @@ function MissingFile({ name, accept, onRelink, thumbnail, className }) {
|
|
|
8128
8237
|
})]
|
|
8129
8238
|
});
|
|
8130
8239
|
}
|
|
8240
|
+
// src/lib/object-url.ts
|
|
8241
|
+
/** Bytes (or a Blob) as an object URL: made once per value, revoked when the value changes or the component unmounts. `null` until made, and for `null` data. `type` is the MIME type for bytes ("audio/wav"); a Blob keeps its own unless `type` is given. */
|
|
8242
|
+
function useObjectUrl(data, type) {
|
|
8243
|
+
const [url, setUrl] = React.useState(null);
|
|
8244
|
+
React.useEffect(() => {
|
|
8245
|
+
if (data === null || data === void 0) {
|
|
8246
|
+
setUrl(null);
|
|
8247
|
+
return;
|
|
8248
|
+
}
|
|
8249
|
+
const blob = data instanceof Blob && (type === void 0 || data.type === type) ? data : new Blob([data], type ? { type } : void 0);
|
|
8250
|
+
const made = URL.createObjectURL(blob);
|
|
8251
|
+
setUrl(made);
|
|
8252
|
+
return () => {
|
|
8253
|
+
URL.revokeObjectURL(made);
|
|
8254
|
+
setUrl((now) => now === made ? null : now);
|
|
8255
|
+
};
|
|
8256
|
+
}, [data, type]);
|
|
8257
|
+
return url;
|
|
8258
|
+
}
|
|
8259
|
+
// src/components/pixel-image.tsx
|
|
8260
|
+
var sizeOf = (p) => p.image ? {
|
|
8261
|
+
width: p.image.width,
|
|
8262
|
+
height: p.image.height,
|
|
8263
|
+
data: p.image.data
|
|
8264
|
+
} : {
|
|
8265
|
+
width: p.width,
|
|
8266
|
+
height: p.height,
|
|
8267
|
+
data: p.rgba
|
|
8268
|
+
};
|
|
8269
|
+
/** The zoom a picture is drawn at: a whole number, at least 1. */
|
|
8270
|
+
function pixelZoom(width, height, zoom = "fit", maxSize = 512) {
|
|
8271
|
+
if (typeof zoom === "number") return Math.max(1, Math.round(zoom));
|
|
8272
|
+
return Math.max(1, Math.floor(maxSize / Math.max(1, width, height)));
|
|
8273
|
+
}
|
|
8274
|
+
/** A decoded RGBA picture on a canvas at a whole-number zoom with square pixels, a checkerboard behind clear pixels, named with its size. */
|
|
8275
|
+
function PixelImage({ label, zoom = "fit", maxSize = 512, className, ...source }) {
|
|
8276
|
+
const { width, height, data } = sizeOf(source);
|
|
8277
|
+
const canvas = React.useRef(null);
|
|
8278
|
+
const complete = data.length === width * height * 4 && width > 0 && height > 0;
|
|
8279
|
+
const scale = pixelZoom(width, height, zoom, maxSize);
|
|
8280
|
+
React.useEffect(() => {
|
|
8281
|
+
const el = canvas.current;
|
|
8282
|
+
if (!el || !complete) return;
|
|
8283
|
+
let ctx = null;
|
|
8284
|
+
try {
|
|
8285
|
+
ctx = el.getContext("2d");
|
|
8286
|
+
} catch {
|
|
8287
|
+
ctx = null;
|
|
8288
|
+
}
|
|
8289
|
+
if (!ctx) return;
|
|
8290
|
+
const picture = ctx.createImageData(width, height);
|
|
8291
|
+
picture.data.set(data);
|
|
8292
|
+
ctx.putImageData(picture, 0, 0);
|
|
8293
|
+
}, [
|
|
8294
|
+
data,
|
|
8295
|
+
width,
|
|
8296
|
+
height,
|
|
8297
|
+
complete
|
|
8298
|
+
]);
|
|
8299
|
+
if (!complete) return /* @__PURE__ */ jsx("span", {
|
|
8300
|
+
role: "img",
|
|
8301
|
+
"aria-label": `${label}, no picture data`,
|
|
8302
|
+
className: cn("inline-grid min-h-16 min-w-40 place-items-center rounded-control border border-dashed border-border bg-surface-sunken px-3 type-body-sm text-muted-foreground", className),
|
|
8303
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
8304
|
+
"aria-hidden": true,
|
|
8305
|
+
children: "No picture data"
|
|
8306
|
+
})
|
|
8307
|
+
});
|
|
8308
|
+
const name = `${label}, ${format.integer(width)} by ${format.integer(height)} pixels${scale > 1 ? `, shown at ${scale}×` : ""}`;
|
|
8309
|
+
return /* @__PURE__ */ jsx("span", {
|
|
8310
|
+
className: cn("inline-block w-fit max-w-full overflow-auto rounded-control align-top", className),
|
|
8311
|
+
style: {
|
|
8312
|
+
backgroundColor: "var(--surface-sunken)",
|
|
8313
|
+
backgroundImage: "conic-gradient(var(--muted) 25%, transparent 0 50%, var(--muted) 0 75%, transparent 0)",
|
|
8314
|
+
backgroundSize: "16px 16px"
|
|
8315
|
+
},
|
|
8316
|
+
children: /* @__PURE__ */ jsx("canvas", {
|
|
8317
|
+
ref: canvas,
|
|
8318
|
+
role: "img",
|
|
8319
|
+
"aria-label": name,
|
|
8320
|
+
width,
|
|
8321
|
+
height,
|
|
8322
|
+
className: "image-pixelated block",
|
|
8323
|
+
style: {
|
|
8324
|
+
width: width * scale,
|
|
8325
|
+
height: height * scale
|
|
8326
|
+
}
|
|
8327
|
+
})
|
|
8328
|
+
});
|
|
8329
|
+
}
|
|
8330
|
+
/** The same pixels as a PNG `Blob`, for a download (`useObjectUrl` makes the link). Rejects where there is no canvas. */
|
|
8331
|
+
function rgbaToBlob(width, height, rgba) {
|
|
8332
|
+
return new Promise((resolve, reject) => {
|
|
8333
|
+
const el = document.createElement("canvas");
|
|
8334
|
+
el.width = width;
|
|
8335
|
+
el.height = height;
|
|
8336
|
+
const ctx = el.getContext("2d");
|
|
8337
|
+
if (!ctx) return reject(/* @__PURE__ */ new Error("This browser cannot draw the picture, so it cannot be saved."));
|
|
8338
|
+
const picture = ctx.createImageData(width, height);
|
|
8339
|
+
picture.data.set(rgba);
|
|
8340
|
+
ctx.putImageData(picture, 0, 0);
|
|
8341
|
+
el.toBlob((blob) => blob ? resolve(blob) : reject(/* @__PURE__ */ new Error("The picture could not be saved.")), "image/png");
|
|
8342
|
+
});
|
|
8343
|
+
}
|
|
8344
|
+
// src/components/byte-view.tsx
|
|
8345
|
+
var PER_ROW = 16;
|
|
8346
|
+
var ROW_PX = 20;
|
|
8347
|
+
var OVERSCAN = 4;
|
|
8348
|
+
var MAX_PX = 8e6;
|
|
8349
|
+
var tints = {
|
|
8350
|
+
neutral: "bg-muted",
|
|
8351
|
+
info: "bg-info-subtle",
|
|
8352
|
+
success: "bg-success-subtle",
|
|
8353
|
+
warning: "bg-warning-subtle",
|
|
8354
|
+
danger: "bg-danger-subtle"
|
|
8355
|
+
};
|
|
8356
|
+
var cellStyle = (k) => ({
|
|
8357
|
+
width: "2ch",
|
|
8358
|
+
marginLeft: k === 8 ? "1ch" : void 0
|
|
8359
|
+
});
|
|
8360
|
+
var hex = (n, width = 2) => n.toString(16).padStart(width, "0");
|
|
8361
|
+
var tintOf = (h) => h ? tints[h.tone ?? "neutral"] : void 0;
|
|
8362
|
+
var printable = (b) => b >= 32 && b < 127 ? String.fromCharCode(b) : "·";
|
|
8363
|
+
/** A virtualised hex dump: offsets, sixteen bytes a row and the printable characters, byte and range keyboard, and the selected range reported as `{ start, end }`. */
|
|
8364
|
+
function ByteView({ bytes, label, offset = 0, highlight, defaultSelection, onSelectionChange, height = 320, className }) {
|
|
8365
|
+
const total = bytes.length;
|
|
8366
|
+
const rows = Math.ceil(total / PER_ROW);
|
|
8367
|
+
const visibleRows = Math.max(1, Math.floor(height / ROW_PX));
|
|
8368
|
+
const fullHeight = rows * ROW_PX;
|
|
8369
|
+
const spacer = Math.max(Math.min(fullHeight, MAX_PX), height);
|
|
8370
|
+
const scrollRange = Math.max(0, spacer - height);
|
|
8371
|
+
const rowRange = Math.max(0, rows - height / ROW_PX);
|
|
8372
|
+
const rowAt = (top) => scrollRange > 0 ? top / scrollRange * rowRange : 0;
|
|
8373
|
+
const topOfRow = (row) => rowRange > 0 ? row / rowRange * scrollRange : 0;
|
|
8374
|
+
const scroller = React.useRef(null);
|
|
8375
|
+
const [scrollTop, setScrollTop] = React.useState(0);
|
|
8376
|
+
const firstFloat = rowAt(scrollTop);
|
|
8377
|
+
const first = Math.min(Math.max(0, rows - 1), Math.floor(firstFloat));
|
|
8378
|
+
const fraction = firstFloat - first;
|
|
8379
|
+
const [rawAnchor, setAnchor] = React.useState(defaultSelection ? defaultSelection.start : null);
|
|
8380
|
+
const [rawCursor, setCursor] = React.useState(defaultSelection ? Math.max(defaultSelection.start, defaultSelection.end - 1) : null);
|
|
8381
|
+
const clampTo = (n) => n === null || total === 0 ? null : Math.min(n, total - 1);
|
|
8382
|
+
const anchor = clampTo(rawAnchor);
|
|
8383
|
+
const cursor = clampTo(rawCursor);
|
|
8384
|
+
const range = anchor === null || cursor === null ? null : {
|
|
8385
|
+
start: Math.min(anchor, cursor),
|
|
8386
|
+
end: Math.max(anchor, cursor) + 1
|
|
8387
|
+
};
|
|
8388
|
+
const notify = React.useRef(onSelectionChange);
|
|
8389
|
+
notify.current = onSelectionChange;
|
|
8390
|
+
const select = (nextAnchor, nextCursor) => {
|
|
8391
|
+
setAnchor(nextAnchor);
|
|
8392
|
+
setCursor(nextCursor);
|
|
8393
|
+
notify.current?.({
|
|
8394
|
+
start: Math.min(nextAnchor, nextCursor),
|
|
8395
|
+
end: Math.max(nextAnchor, nextCursor) + 1
|
|
8396
|
+
});
|
|
8397
|
+
};
|
|
8398
|
+
const reveal = (index) => {
|
|
8399
|
+
const el = scroller.current;
|
|
8400
|
+
if (!el) return;
|
|
8401
|
+
const row = Math.floor(index / PER_ROW);
|
|
8402
|
+
const now = rowAt(el.scrollTop);
|
|
8403
|
+
if (row < Math.ceil(now)) el.scrollTop = topOfRow(row);
|
|
8404
|
+
else if (row >= Math.floor(now) + visibleRows) el.scrollTop = topOfRow(row - visibleRows + 1);
|
|
8405
|
+
setScrollTop(el.scrollTop);
|
|
8406
|
+
};
|
|
8407
|
+
const move = (to, extend) => {
|
|
8408
|
+
if (total === 0) return;
|
|
8409
|
+
const index = Math.min(Math.max(0, to), total - 1);
|
|
8410
|
+
select(extend && anchor !== null ? anchor : index, index);
|
|
8411
|
+
reveal(index);
|
|
8412
|
+
};
|
|
8413
|
+
const onKeyDown = (e) => {
|
|
8414
|
+
if (total === 0) return;
|
|
8415
|
+
const at = cursor ?? 0;
|
|
8416
|
+
const extend = e.shiftKey;
|
|
8417
|
+
const rowStart = Math.floor(at / PER_ROW) * PER_ROW;
|
|
8418
|
+
switch (e.key) {
|
|
8419
|
+
case "ArrowLeft":
|
|
8420
|
+
move(cursor === null ? 0 : at - 1, extend);
|
|
8421
|
+
break;
|
|
8422
|
+
case "ArrowRight":
|
|
8423
|
+
move(cursor === null ? 0 : at + 1, extend);
|
|
8424
|
+
break;
|
|
8425
|
+
case "ArrowUp":
|
|
8426
|
+
move(cursor === null ? 0 : at - PER_ROW, extend);
|
|
8427
|
+
break;
|
|
8428
|
+
case "ArrowDown":
|
|
8429
|
+
move(cursor === null ? 0 : at + PER_ROW, extend);
|
|
8430
|
+
break;
|
|
8431
|
+
case "PageUp":
|
|
8432
|
+
move(at - visibleRows * PER_ROW, extend);
|
|
8433
|
+
break;
|
|
8434
|
+
case "PageDown":
|
|
8435
|
+
move(at + visibleRows * PER_ROW, extend);
|
|
8436
|
+
break;
|
|
8437
|
+
case "Home":
|
|
8438
|
+
move(e.ctrlKey || e.metaKey ? 0 : rowStart, extend);
|
|
8439
|
+
break;
|
|
8440
|
+
case "End":
|
|
8441
|
+
move(e.ctrlKey || e.metaKey ? total - 1 : rowStart + PER_ROW - 1, extend);
|
|
8442
|
+
break;
|
|
8443
|
+
case "Escape":
|
|
8444
|
+
if (cursor === null || anchor === cursor) return;
|
|
8445
|
+
select(cursor, cursor);
|
|
8446
|
+
break;
|
|
8447
|
+
default: return;
|
|
8448
|
+
}
|
|
8449
|
+
e.preventDefault();
|
|
8450
|
+
};
|
|
8451
|
+
const byteAt = (target) => {
|
|
8452
|
+
const cell = target?.closest?.("[data-i]");
|
|
8453
|
+
return cell ? Number(cell.dataset.i) : null;
|
|
8454
|
+
};
|
|
8455
|
+
const onPointerDown = (e) => {
|
|
8456
|
+
if (e.button !== 0) return;
|
|
8457
|
+
const i = byteAt(e.target);
|
|
8458
|
+
e.currentTarget.focus({ preventScroll: true });
|
|
8459
|
+
if (i === null) return;
|
|
8460
|
+
select(e.shiftKey && anchor !== null ? anchor : i, i);
|
|
8461
|
+
};
|
|
8462
|
+
const onPointerMove = (e) => {
|
|
8463
|
+
if (!(e.buttons & 1) || anchor === null) return;
|
|
8464
|
+
const i = byteAt(e.target);
|
|
8465
|
+
if (i !== null && i !== cursor) select(anchor, i);
|
|
8466
|
+
};
|
|
8467
|
+
const hexWidth = Math.max(6, hex(offset + Math.max(0, total - 1), 1).length);
|
|
8468
|
+
const marked = (i) => highlight?.find((h) => i >= h.start && i < h.end);
|
|
8469
|
+
const said = (() => {
|
|
8470
|
+
if (cursor === null || range === null) return "";
|
|
8471
|
+
const b = bytes[cursor];
|
|
8472
|
+
const inside = marked(cursor)?.label;
|
|
8473
|
+
const count = range.end - range.start;
|
|
8474
|
+
return `${`Byte 0x${hex(offset + cursor, 1)} of ${format.integer(total)}: ${hex(b)}, ${b}`}${count > 1 ? `; ${format.integer(count)} bytes selected, 0x${hex(offset + range.start, 1)} to 0x${hex(offset + range.end - 1, 1)}` : ""}${inside ? `; in ${inside}` : ""}`;
|
|
8475
|
+
})();
|
|
8476
|
+
const lastRow = Math.min(rows - 1, first + visibleRows + OVERSCAN);
|
|
8477
|
+
const drawn = [];
|
|
8478
|
+
for (let r = Math.max(0, first - OVERSCAN); r <= lastRow; r++) drawn.push(r);
|
|
8479
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8480
|
+
className: cn("grid min-w-0 gap-1", className),
|
|
8481
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
8482
|
+
role: "group",
|
|
8483
|
+
"aria-label": `${label}, ${format.integer(total)} ${total === 1 ? "byte" : "bytes"}`,
|
|
8484
|
+
tabIndex: 0,
|
|
8485
|
+
onKeyDown,
|
|
8486
|
+
onFocus: (e) => {
|
|
8487
|
+
if (e.target === e.currentTarget && cursor === null && total > 0) select(0, 0);
|
|
8488
|
+
},
|
|
8489
|
+
onPointerDown,
|
|
8490
|
+
onPointerMove,
|
|
8491
|
+
className: "min-w-0 overflow-x-auto rounded-control border border-border bg-surface-sunken font-mono type-body-sm tabular-nums outline-offset-2 select-none",
|
|
8492
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
8493
|
+
"aria-hidden": true,
|
|
8494
|
+
className: "w-max min-w-full",
|
|
8495
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
8496
|
+
className: "flex h-5 items-center gap-3 border-b border-border px-3 text-muted-foreground",
|
|
8497
|
+
children: [
|
|
8498
|
+
/* @__PURE__ */ jsx("span", {
|
|
8499
|
+
style: { width: `${hexWidth}ch` },
|
|
8500
|
+
children: "Offset"
|
|
8501
|
+
}),
|
|
8502
|
+
/* @__PURE__ */ jsx("span", {
|
|
8503
|
+
className: "flex",
|
|
8504
|
+
style: { columnGap: "1ch" },
|
|
8505
|
+
children: Array.from({ length: PER_ROW }, (_, i) => /* @__PURE__ */ jsx("span", {
|
|
8506
|
+
className: "text-center",
|
|
8507
|
+
style: cellStyle(i),
|
|
8508
|
+
children: hex(i)
|
|
8509
|
+
}, i))
|
|
8510
|
+
}),
|
|
8511
|
+
/* @__PURE__ */ jsx("span", { children: "Text" })
|
|
8512
|
+
]
|
|
8513
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
8514
|
+
ref: scroller,
|
|
8515
|
+
onScroll: (e) => setScrollTop(e.currentTarget.scrollTop),
|
|
8516
|
+
className: "overflow-y-auto",
|
|
8517
|
+
style: { height },
|
|
8518
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
8519
|
+
style: { height: spacer },
|
|
8520
|
+
className: "relative",
|
|
8521
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
8522
|
+
className: "sticky top-0 overflow-hidden",
|
|
8523
|
+
style: { height },
|
|
8524
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
8525
|
+
style: { transform: `translateY(${-fraction * ROW_PX}px)` },
|
|
8526
|
+
children: drawn.map((r) => {
|
|
8527
|
+
const base = r * PER_ROW;
|
|
8528
|
+
const count = Math.min(PER_ROW, total - base);
|
|
8529
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8530
|
+
"data-row": r,
|
|
8531
|
+
className: "flex items-center gap-3 px-3",
|
|
8532
|
+
style: {
|
|
8533
|
+
height: ROW_PX,
|
|
8534
|
+
position: "absolute",
|
|
8535
|
+
top: (r - first) * ROW_PX,
|
|
8536
|
+
left: 0,
|
|
8537
|
+
right: 0
|
|
8538
|
+
},
|
|
8539
|
+
children: [
|
|
8540
|
+
/* @__PURE__ */ jsx("span", {
|
|
8541
|
+
className: "text-muted-foreground",
|
|
8542
|
+
style: { width: `${hexWidth}ch` },
|
|
8543
|
+
children: hex(offset + base, hexWidth)
|
|
8544
|
+
}),
|
|
8545
|
+
/* @__PURE__ */ jsx("span", {
|
|
8546
|
+
className: "flex",
|
|
8547
|
+
style: { columnGap: "1ch" },
|
|
8548
|
+
children: Array.from({ length: PER_ROW }, (_, k) => {
|
|
8549
|
+
const i = base + k;
|
|
8550
|
+
if (k >= count) return /* @__PURE__ */ jsx("span", { style: cellStyle(k) }, k);
|
|
8551
|
+
const inRange = range !== null && i >= range.start && i < range.end;
|
|
8552
|
+
return /* @__PURE__ */ jsx("span", {
|
|
8553
|
+
"data-i": i,
|
|
8554
|
+
"data-selected": inRange || void 0,
|
|
8555
|
+
"data-cursor": i === cursor || void 0,
|
|
8556
|
+
style: cellStyle(k),
|
|
8557
|
+
className: cn("rounded-control text-center", inRange ? "bg-primary text-primary-foreground" : tintOf(marked(i)), i === cursor && "outline-2 outline-ring"),
|
|
8558
|
+
children: hex(bytes[i])
|
|
8559
|
+
}, k);
|
|
8560
|
+
})
|
|
8561
|
+
}),
|
|
8562
|
+
/* @__PURE__ */ jsx("span", {
|
|
8563
|
+
className: "flex",
|
|
8564
|
+
children: Array.from({ length: count }, (_, k) => {
|
|
8565
|
+
const i = base + k;
|
|
8566
|
+
const inRange = range !== null && i >= range.start && i < range.end;
|
|
8567
|
+
return /* @__PURE__ */ jsx("span", {
|
|
8568
|
+
"data-i": i,
|
|
8569
|
+
style: { width: "1ch" },
|
|
8570
|
+
className: cn("text-center", inRange ? "bg-primary text-primary-foreground" : tintOf(marked(i))),
|
|
8571
|
+
children: printable(bytes[i])
|
|
8572
|
+
}, k);
|
|
8573
|
+
})
|
|
8574
|
+
})
|
|
8575
|
+
]
|
|
8576
|
+
}, r);
|
|
8577
|
+
})
|
|
8578
|
+
})
|
|
8579
|
+
})
|
|
8580
|
+
})
|
|
8581
|
+
})]
|
|
8582
|
+
})
|
|
8583
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
8584
|
+
role: "status",
|
|
8585
|
+
className: "type-caption text-muted-foreground tabular-nums",
|
|
8586
|
+
children: total === 0 ? "No bytes." : said
|
|
8587
|
+
})]
|
|
8588
|
+
});
|
|
8589
|
+
}
|
|
8590
|
+
// src/components/console.tsx
|
|
8591
|
+
var LEVEL_WORD = {
|
|
8592
|
+
warning: {
|
|
8593
|
+
word: "Warning",
|
|
8594
|
+
tone: "warning"
|
|
8595
|
+
},
|
|
8596
|
+
error: {
|
|
8597
|
+
word: "Error",
|
|
8598
|
+
tone: "danger"
|
|
8599
|
+
}
|
|
8600
|
+
};
|
|
8601
|
+
var lineKey = (line) => String(line.id);
|
|
8602
|
+
function readHistory(key) {
|
|
8603
|
+
if (!key) return [];
|
|
8604
|
+
try {
|
|
8605
|
+
const parsed = JSON.parse(window.localStorage.getItem(key) ?? "[]");
|
|
8606
|
+
return Array.isArray(parsed) ? parsed.filter((c) => typeof c === "string").slice(-100) : [];
|
|
8607
|
+
} catch {
|
|
8608
|
+
return [];
|
|
8609
|
+
}
|
|
8610
|
+
}
|
|
8611
|
+
/** The longest start every string shares. */
|
|
8612
|
+
function commonStart(items) {
|
|
8613
|
+
if (items.length === 0) return "";
|
|
8614
|
+
let prefix = items[0];
|
|
8615
|
+
for (const item of items) while (!item.startsWith(prefix)) prefix = prefix.slice(0, -1);
|
|
8616
|
+
return prefix;
|
|
8617
|
+
}
|
|
8618
|
+
/** A command console: a polite, virtualised log pinned to its end, above a command line with history (Up, Down) and Tab completion from the app's list. */
|
|
8619
|
+
function Console({ label, lines, onCommand, complete, historyKey, height = 320, lineHeight, commandLabel = "Command", inputRef, className }) {
|
|
8620
|
+
const [text, setText] = React.useState("");
|
|
8621
|
+
const history = React.useRef(readHistory(historyKey));
|
|
8622
|
+
const [cursor, setCursor] = React.useState(null);
|
|
8623
|
+
const draft = React.useRef("");
|
|
8624
|
+
const [matches, setMatches] = React.useState([]);
|
|
8625
|
+
const box = React.useRef(null);
|
|
8626
|
+
const [pinned, setPinned] = React.useState(true);
|
|
8627
|
+
const scroller = () => box.current?.querySelector("[data-strata-scroll]") ?? null;
|
|
8628
|
+
const toEnd = React.useCallback(() => {
|
|
8629
|
+
const el = scroller();
|
|
8630
|
+
if (el) el.scrollTop = el.scrollHeight;
|
|
8631
|
+
}, []);
|
|
8632
|
+
React.useEffect(() => {
|
|
8633
|
+
const el = scroller();
|
|
8634
|
+
if (!el) return;
|
|
8635
|
+
const onScroll = () => setPinned(el.scrollHeight - el.scrollTop - el.clientHeight < 8);
|
|
8636
|
+
el.addEventListener("scroll", onScroll);
|
|
8637
|
+
return () => el.removeEventListener("scroll", onScroll);
|
|
8638
|
+
});
|
|
8639
|
+
React.useLayoutEffect(() => {
|
|
8640
|
+
if (pinned) toEnd();
|
|
8641
|
+
const frame = requestAnimationFrame(() => pinned && toEnd());
|
|
8642
|
+
return () => cancelAnimationFrame(frame);
|
|
8643
|
+
}, [
|
|
8644
|
+
lines,
|
|
8645
|
+
pinned,
|
|
8646
|
+
toEnd
|
|
8647
|
+
]);
|
|
8648
|
+
const run = () => {
|
|
8649
|
+
const command = text.trim();
|
|
8650
|
+
if (!command) return;
|
|
8651
|
+
if (history.current[history.current.length - 1] !== command) history.current = [...history.current, command].slice(-100);
|
|
8652
|
+
if (historyKey) try {
|
|
8653
|
+
window.localStorage.setItem(historyKey, JSON.stringify(history.current));
|
|
8654
|
+
} catch {}
|
|
8655
|
+
setText("");
|
|
8656
|
+
setCursor(null);
|
|
8657
|
+
setMatches([]);
|
|
8658
|
+
setPinned(true);
|
|
8659
|
+
onCommand(command);
|
|
8660
|
+
};
|
|
8661
|
+
const walk = (direction) => {
|
|
8662
|
+
const past = history.current;
|
|
8663
|
+
if (past.length === 0) return;
|
|
8664
|
+
if (cursor === null) {
|
|
8665
|
+
if (direction === 1) return;
|
|
8666
|
+
draft.current = text;
|
|
8667
|
+
setCursor(past.length - 1);
|
|
8668
|
+
setText(past[past.length - 1]);
|
|
8669
|
+
return;
|
|
8670
|
+
}
|
|
8671
|
+
const next = cursor + direction;
|
|
8672
|
+
if (next < 0) return;
|
|
8673
|
+
if (next >= past.length) {
|
|
8674
|
+
setCursor(null);
|
|
8675
|
+
setText(draft.current);
|
|
8676
|
+
} else {
|
|
8677
|
+
setCursor(next);
|
|
8678
|
+
setText(past[next]);
|
|
8679
|
+
}
|
|
8680
|
+
};
|
|
8681
|
+
const onKeyDown = (e) => {
|
|
8682
|
+
if (e.nativeEvent.isComposing) return;
|
|
8683
|
+
if (e.key === "ArrowUp" || e.key === "ArrowDown") {
|
|
8684
|
+
e.preventDefault();
|
|
8685
|
+
walk(e.key === "ArrowUp" ? -1 : 1);
|
|
8686
|
+
} else if (e.key === "Tab" && complete && !e.shiftKey && text.length > 0) {
|
|
8687
|
+
const found = complete(text);
|
|
8688
|
+
if (found.length === 0) return;
|
|
8689
|
+
e.preventDefault();
|
|
8690
|
+
const start = commonStart(found);
|
|
8691
|
+
if (start.length > text.length) setText(start);
|
|
8692
|
+
setMatches(found.length > 1 ? found : []);
|
|
8693
|
+
} else if (e.key === "Escape") setMatches([]);
|
|
8694
|
+
};
|
|
8695
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
8696
|
+
"aria-label": label,
|
|
8697
|
+
className: cn("grid min-w-0 gap-2", className),
|
|
8698
|
+
children: [
|
|
8699
|
+
/* @__PURE__ */ jsxs("div", {
|
|
8700
|
+
ref: box,
|
|
8701
|
+
role: "log",
|
|
8702
|
+
"aria-live": "polite",
|
|
8703
|
+
"aria-relevant": "additions",
|
|
8704
|
+
"aria-label": `${label}: log`,
|
|
8705
|
+
className: "relative min-w-0 rounded-control border border-border bg-surface-sunken",
|
|
8706
|
+
children: [
|
|
8707
|
+
/* @__PURE__ */ jsx(VirtualList, {
|
|
8708
|
+
label: `${label} lines`,
|
|
8709
|
+
items: lines,
|
|
8710
|
+
itemKey: lineKey,
|
|
8711
|
+
height,
|
|
8712
|
+
bounded: true,
|
|
8713
|
+
estimateSize: 24,
|
|
8714
|
+
rowHeight: lineHeight,
|
|
8715
|
+
children: (line) => {
|
|
8716
|
+
const word = LEVEL_WORD[line.level ?? "info"];
|
|
8717
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
8718
|
+
className: cn("flex min-w-0 items-start gap-2 px-3 py-0.5 font-mono type-body-sm", line.level === "echo" && "text-muted-foreground"),
|
|
8719
|
+
children: [
|
|
8720
|
+
word ? /* @__PURE__ */ jsx(Status, {
|
|
8721
|
+
tone: word.tone,
|
|
8722
|
+
children: word.word
|
|
8723
|
+
}) : line.level === "echo" ? /* @__PURE__ */ jsx("span", {
|
|
8724
|
+
"aria-hidden": true,
|
|
8725
|
+
children: "›"
|
|
8726
|
+
}) : null,
|
|
8727
|
+
line.level === "echo" && /* @__PURE__ */ jsx("span", {
|
|
8728
|
+
className: "sr-only",
|
|
8729
|
+
children: "Command: "
|
|
8730
|
+
}),
|
|
8731
|
+
/* @__PURE__ */ jsx("span", {
|
|
8732
|
+
title: lineHeight ? line.text : void 0,
|
|
8733
|
+
className: cn("min-w-0 flex-1", lineHeight ? "truncate" : "break-words whitespace-pre-wrap"),
|
|
8734
|
+
children: line.text
|
|
8735
|
+
})
|
|
8736
|
+
]
|
|
8737
|
+
});
|
|
8738
|
+
}
|
|
8739
|
+
}),
|
|
8740
|
+
lines.length === 0 && /* @__PURE__ */ jsx("p", {
|
|
8741
|
+
className: "px-3 py-2 type-body-sm text-muted-foreground",
|
|
8742
|
+
children: "Nothing has been written yet."
|
|
8743
|
+
}),
|
|
8744
|
+
!pinned && /* @__PURE__ */ jsxs(Button, {
|
|
8745
|
+
size: "sm",
|
|
8746
|
+
variant: "outline",
|
|
8747
|
+
onPress: () => {
|
|
8748
|
+
setPinned(true);
|
|
8749
|
+
toEnd();
|
|
8750
|
+
},
|
|
8751
|
+
className: "absolute bottom-2 left-1/2 -translate-x-1/2 shadow-overlay",
|
|
8752
|
+
children: [/* @__PURE__ */ jsx(ArrowDown, {}), " Latest"]
|
|
8753
|
+
})
|
|
8754
|
+
]
|
|
8755
|
+
}),
|
|
8756
|
+
/* @__PURE__ */ jsx("form", {
|
|
8757
|
+
onSubmit: (e) => {
|
|
8758
|
+
e.preventDefault();
|
|
8759
|
+
run();
|
|
8760
|
+
},
|
|
8761
|
+
children: /* @__PURE__ */ jsx(Field, {
|
|
8762
|
+
label: commandLabel,
|
|
8763
|
+
action: /* @__PURE__ */ jsx(Button, {
|
|
8764
|
+
type: "submit",
|
|
8765
|
+
children: "Run"
|
|
8766
|
+
}),
|
|
8767
|
+
children: /* @__PURE__ */ jsx(Input, {
|
|
8768
|
+
ref: inputRef,
|
|
8769
|
+
value: text,
|
|
8770
|
+
onChange: (e) => {
|
|
8771
|
+
setText(e.target.value);
|
|
8772
|
+
setCursor(null);
|
|
8773
|
+
setMatches([]);
|
|
8774
|
+
},
|
|
8775
|
+
onKeyDown,
|
|
8776
|
+
autoComplete: "off",
|
|
8777
|
+
autoCapitalize: "off",
|
|
8778
|
+
autoCorrect: "off",
|
|
8779
|
+
spellCheck: false,
|
|
8780
|
+
className: "font-mono"
|
|
8781
|
+
})
|
|
8782
|
+
})
|
|
8783
|
+
}),
|
|
8784
|
+
/* @__PURE__ */ jsx("p", {
|
|
8785
|
+
role: "status",
|
|
8786
|
+
className: cn("type-caption text-muted-foreground", matches.length === 0 && "sr-only"),
|
|
8787
|
+
children: matches.length > 0 ? `${matches.length} matches: ${matches.join(", ")}` : ""
|
|
8788
|
+
})
|
|
8789
|
+
]
|
|
8790
|
+
});
|
|
8791
|
+
}
|
|
8792
|
+
// src/components/shortcut-editor.tsx
|
|
8793
|
+
var idOf = (s) => s.id ?? s.label;
|
|
8794
|
+
var MODIFIER_KEYS = /* @__PURE__ */ new Set([
|
|
8795
|
+
"Shift",
|
|
8796
|
+
"Control",
|
|
8797
|
+
"Alt",
|
|
8798
|
+
"Meta",
|
|
8799
|
+
"AltGraph",
|
|
8800
|
+
"CapsLock",
|
|
8801
|
+
"Fn",
|
|
8802
|
+
"OS"
|
|
8803
|
+
]);
|
|
8804
|
+
/** Holds a person's rebound keys over a default `Shortcut[]`, remembered under `storageKey` and handed to `onChange`. The result's `shortcuts` is what `useHotkeys` and `KeysLegend` take. */
|
|
8805
|
+
function useRebindableShortcuts(defaults, { storageKey, initial, onChange } = {}) {
|
|
8806
|
+
const [overrides, setOverrides] = React.useState(() => {
|
|
8807
|
+
if (initial) return initial;
|
|
8808
|
+
if (!storageKey) return {};
|
|
8809
|
+
try {
|
|
8810
|
+
const parsed = JSON.parse(window.localStorage.getItem(storageKey) ?? "{}");
|
|
8811
|
+
if (!parsed || typeof parsed !== "object") return {};
|
|
8812
|
+
const out = {};
|
|
8813
|
+
for (const [id, keys] of Object.entries(parsed)) if (Array.isArray(keys) && keys.every((k) => typeof k === "string") && keys.length > 0) out[id] = keys;
|
|
8814
|
+
return out;
|
|
8815
|
+
} catch {
|
|
8816
|
+
return {};
|
|
8817
|
+
}
|
|
8818
|
+
});
|
|
8819
|
+
const latest = React.useRef({
|
|
8820
|
+
onChange,
|
|
8821
|
+
storageKey
|
|
8822
|
+
});
|
|
8823
|
+
latest.current = {
|
|
8824
|
+
onChange,
|
|
8825
|
+
storageKey
|
|
8826
|
+
};
|
|
8827
|
+
const current = React.useRef(overrides);
|
|
8828
|
+
const commit = React.useCallback((next) => {
|
|
8829
|
+
current.current = next;
|
|
8830
|
+
setOverrides(next);
|
|
8831
|
+
const { onChange: notify, storageKey: key } = latest.current;
|
|
8832
|
+
if (key) try {
|
|
8833
|
+
window.localStorage.setItem(key, JSON.stringify(next));
|
|
8834
|
+
} catch {}
|
|
8835
|
+
notify?.(next);
|
|
8836
|
+
}, []);
|
|
8837
|
+
return React.useMemo(() => ({
|
|
8838
|
+
shortcuts: defaults.map((s) => overrides[idOf(s)] ? {
|
|
8839
|
+
...s,
|
|
8840
|
+
keys: overrides[idOf(s)]
|
|
8841
|
+
} : { ...s }),
|
|
8842
|
+
defaults,
|
|
8843
|
+
overrides,
|
|
8844
|
+
isChanged: (id) => id in overrides,
|
|
8845
|
+
setKeys: (id, keys) => {
|
|
8846
|
+
const next = { ...current.current };
|
|
8847
|
+
if (keys === null) delete next[id];
|
|
8848
|
+
else next[id] = keys;
|
|
8849
|
+
commit(next);
|
|
8850
|
+
},
|
|
8851
|
+
resetAll: () => commit({})
|
|
8852
|
+
}), [
|
|
8853
|
+
defaults,
|
|
8854
|
+
overrides,
|
|
8855
|
+
commit
|
|
8856
|
+
]);
|
|
8857
|
+
}
|
|
8858
|
+
/** Judges a key pressed while recording for the shortcut `id`, against the current list. */
|
|
8859
|
+
function checkKey(e, id, shortcuts) {
|
|
8860
|
+
if (e.ctrlKey || e.metaKey || e.altKey) {
|
|
8861
|
+
const chord = [
|
|
8862
|
+
e.ctrlKey && "Ctrl",
|
|
8863
|
+
e.metaKey && "Meta",
|
|
8864
|
+
e.altKey && "Alt",
|
|
8865
|
+
e.shiftKey && "Shift",
|
|
8866
|
+
e.key.length === 1 ? e.key.toUpperCase() : e.key
|
|
8867
|
+
].filter(Boolean).join("+");
|
|
8868
|
+
return {
|
|
8869
|
+
ok: false,
|
|
8870
|
+
reason: isReservedChord(chord) ? `${formatChord(chord)} belongs to the browser.` : `${formatChord(chord)} is a chord, and shortcuts here are single keys: Ctrl, Cmd and Alt belong to the browser and the system.`
|
|
8871
|
+
};
|
|
8872
|
+
}
|
|
8873
|
+
if (e.key === "Tab") return {
|
|
8874
|
+
ok: false,
|
|
8875
|
+
reason: "Tab moves between controls, so it cannot be a shortcut."
|
|
8876
|
+
};
|
|
8877
|
+
const other = shortcuts.find((s) => idOf(s) !== id && !s.disabled && s.keys.includes(e.key));
|
|
8878
|
+
return other ? {
|
|
8879
|
+
ok: "conflict",
|
|
8880
|
+
key: e.key,
|
|
8881
|
+
other
|
|
8882
|
+
} : {
|
|
8883
|
+
ok: true,
|
|
8884
|
+
key: e.key
|
|
8885
|
+
};
|
|
8886
|
+
}
|
|
8887
|
+
/** Each shortcut with its keys and a "Change" that records the next key pressed; refuses keys that cannot be bound, names a conflict and offers a swap, and resets one or all. Edits the list a `useRebindableShortcuts` holds. */
|
|
8888
|
+
function ShortcutEditor({ rebinding, label = "Keyboard shortcuts", className }) {
|
|
8889
|
+
const { shortcuts, defaults, setKeys, isChanged, resetAll, overrides } = rebinding;
|
|
8890
|
+
const [recording, setRecording] = React.useState(null);
|
|
8891
|
+
const [conflict, setConflict] = React.useState(null);
|
|
8892
|
+
const [said, setSaid] = React.useState("");
|
|
8893
|
+
const keysOf = (id) => shortcuts.find((s) => idOf(s) === id).keys;
|
|
8894
|
+
const apply = (id, key, swapWith) => {
|
|
8895
|
+
const own = keysOf(id);
|
|
8896
|
+
const old = own[0];
|
|
8897
|
+
setKeys(id, [key, ...own.slice(1).filter((k) => k !== key)]);
|
|
8898
|
+
if (swapWith) {
|
|
8899
|
+
const theirs = keysOf(idOf(swapWith)).map((k) => k === key ? old : k);
|
|
8900
|
+
setKeys(idOf(swapWith), [...new Set(theirs)]);
|
|
8901
|
+
}
|
|
8902
|
+
};
|
|
8903
|
+
const onKeyDown = (e, shortcut) => {
|
|
8904
|
+
const id = idOf(shortcut);
|
|
8905
|
+
if (e.nativeEvent.isComposing) return;
|
|
8906
|
+
if (e.key === "Tab") {
|
|
8907
|
+
setRecording(null);
|
|
8908
|
+
setSaid("Tab moves between controls, so it cannot be a shortcut. Kept " + keyName(shortcut.keys[0] ?? "") + " for " + shortcut.label + ".");
|
|
8909
|
+
return;
|
|
8910
|
+
}
|
|
8911
|
+
e.stopPropagation();
|
|
8912
|
+
if (e.key === "Escape") {
|
|
8913
|
+
e.preventDefault();
|
|
8914
|
+
setRecording(null);
|
|
8915
|
+
setSaid(`Kept ${keyName(shortcut.keys[0] ?? "")} for ${shortcut.label}.`);
|
|
8916
|
+
return;
|
|
8917
|
+
}
|
|
8918
|
+
if (MODIFIER_KEYS.has(e.key)) return;
|
|
8919
|
+
e.preventDefault();
|
|
8920
|
+
const found = checkKey(e.nativeEvent, id, shortcuts);
|
|
8921
|
+
if (found.ok === false) {
|
|
8922
|
+
setSaid(found.reason);
|
|
8923
|
+
return;
|
|
8924
|
+
}
|
|
8925
|
+
setRecording(null);
|
|
8926
|
+
if (found.ok === "conflict") {
|
|
8927
|
+
setConflict({
|
|
8928
|
+
id,
|
|
8929
|
+
key: found.key,
|
|
8930
|
+
other: found.other
|
|
8931
|
+
});
|
|
8932
|
+
setSaid(`${keyName(found.key)} is already ${found.other.label}. Swap?`);
|
|
8933
|
+
return;
|
|
8934
|
+
}
|
|
8935
|
+
apply(id, found.key);
|
|
8936
|
+
setSaid(`${shortcut.label} is now ${keyName(found.key)}.`);
|
|
8937
|
+
};
|
|
8938
|
+
const anyChanged = Object.keys(overrides).length > 0;
|
|
8939
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
8940
|
+
"aria-label": label,
|
|
8941
|
+
className: cn("grid min-w-0 gap-3", className),
|
|
8942
|
+
children: [/* @__PURE__ */ jsx("ul", {
|
|
8943
|
+
className: "grid min-w-0 divide-y divide-border rounded-surface border border-border",
|
|
8944
|
+
children: shortcuts.map((shortcut) => {
|
|
8945
|
+
const id = idOf(shortcut);
|
|
8946
|
+
const mine = conflict?.id === id ? conflict : null;
|
|
8947
|
+
const isRecording = recording === id;
|
|
8948
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
8949
|
+
className: cn("flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2", shortcut.disabled && "opacity-50"),
|
|
8950
|
+
children: [
|
|
8951
|
+
/* @__PURE__ */ jsx("span", {
|
|
8952
|
+
className: "min-w-0 flex-1 type-body-sm",
|
|
8953
|
+
children: shortcut.label
|
|
8954
|
+
}),
|
|
8955
|
+
/* @__PURE__ */ jsx("span", {
|
|
8956
|
+
className: "flex items-center gap-1",
|
|
8957
|
+
children: shortcut.keys.map((k, i) => /* @__PURE__ */ jsxs(React.Fragment, { children: [i > 0 && /* @__PURE__ */ jsx("span", {
|
|
8958
|
+
className: "sr-only",
|
|
8959
|
+
children: " or "
|
|
8960
|
+
}), /* @__PURE__ */ jsx("kbd", {
|
|
8961
|
+
className: "min-w-5 rounded-control border border-border bg-surface-sunken px-1 text-center font-mono type-caption text-foreground",
|
|
8962
|
+
children: /* @__PURE__ */ jsx(KeyText, { children: keyName(k) })
|
|
8963
|
+
})] }, k))
|
|
8964
|
+
}),
|
|
8965
|
+
isRecording ? /* @__PURE__ */ jsx(Button, {
|
|
8966
|
+
size: "sm",
|
|
8967
|
+
variant: "default",
|
|
8968
|
+
autoFocus: true,
|
|
8969
|
+
"aria-label": `Press a key for ${shortcut.label}. Escape cancels.`,
|
|
8970
|
+
onKeyDown: (e) => onKeyDown(e, shortcut),
|
|
8971
|
+
onBlur: () => setRecording((now) => now === id ? null : now),
|
|
8972
|
+
children: "Press a key…"
|
|
8973
|
+
}) : /* @__PURE__ */ jsx(Button, {
|
|
8974
|
+
size: "sm",
|
|
8975
|
+
"aria-label": `Change ${shortcut.label}`,
|
|
8976
|
+
disabled: shortcut.disabled,
|
|
8977
|
+
onPress: () => {
|
|
8978
|
+
setConflict(null);
|
|
8979
|
+
setRecording(id);
|
|
8980
|
+
setSaid(`Press the new key for ${shortcut.label}. Escape cancels.`);
|
|
8981
|
+
},
|
|
8982
|
+
children: "Change"
|
|
8983
|
+
}),
|
|
8984
|
+
isChanged(id) && !isRecording && /* @__PURE__ */ jsxs(Button, {
|
|
8985
|
+
size: "sm",
|
|
8986
|
+
variant: "ghost",
|
|
8987
|
+
"aria-label": `Reset ${shortcut.label}`,
|
|
8988
|
+
onPress: () => {
|
|
8989
|
+
setKeys(id, null);
|
|
8990
|
+
setConflict(null);
|
|
8991
|
+
const original = defaults.find((s) => idOf(s) === id);
|
|
8992
|
+
setSaid(`${shortcut.label} is back to ${keyName(original?.keys[0] ?? "")}.`);
|
|
8993
|
+
},
|
|
8994
|
+
children: [/* @__PURE__ */ jsx(RotateCcw, { "aria-hidden": true }), " Reset"]
|
|
8995
|
+
}),
|
|
8996
|
+
mine && /* @__PURE__ */ jsxs("p", {
|
|
8997
|
+
className: "flex basis-full flex-wrap items-center gap-2 type-body-sm text-warning",
|
|
8998
|
+
children: [
|
|
8999
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
9000
|
+
"Already “",
|
|
9001
|
+
mine.other.label,
|
|
9002
|
+
"”: swap?"
|
|
9003
|
+
] }),
|
|
9004
|
+
/* @__PURE__ */ jsx(Button, {
|
|
9005
|
+
size: "sm",
|
|
9006
|
+
onPress: () => {
|
|
9007
|
+
const given = keysOf(id)[0] ?? "";
|
|
9008
|
+
apply(id, mine.key, mine.other);
|
|
9009
|
+
setConflict(null);
|
|
9010
|
+
setSaid(`${shortcut.label} is now ${keyName(mine.key)}, and ${mine.other.label} has ${keyName(given)}.`);
|
|
9011
|
+
},
|
|
9012
|
+
children: "Swap"
|
|
9013
|
+
}),
|
|
9014
|
+
/* @__PURE__ */ jsx(Button, {
|
|
9015
|
+
size: "sm",
|
|
9016
|
+
variant: "ghost",
|
|
9017
|
+
onPress: () => {
|
|
9018
|
+
setConflict(null);
|
|
9019
|
+
setSaid("Nothing changed.");
|
|
9020
|
+
},
|
|
9021
|
+
children: "Keep as it was"
|
|
9022
|
+
})
|
|
9023
|
+
]
|
|
9024
|
+
})
|
|
9025
|
+
]
|
|
9026
|
+
}, id);
|
|
9027
|
+
})
|
|
9028
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
9029
|
+
className: "flex items-center gap-3",
|
|
9030
|
+
children: [anyChanged && /* @__PURE__ */ jsx(Button, {
|
|
9031
|
+
size: "sm",
|
|
9032
|
+
onPress: () => {
|
|
9033
|
+
resetAll();
|
|
9034
|
+
setConflict(null);
|
|
9035
|
+
setSaid("Every shortcut is back to its default.");
|
|
9036
|
+
},
|
|
9037
|
+
children: "Reset all"
|
|
9038
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
9039
|
+
role: "status",
|
|
9040
|
+
className: "min-w-0 flex-1 type-body-sm text-muted-foreground",
|
|
9041
|
+
children: said
|
|
9042
|
+
})]
|
|
9043
|
+
})]
|
|
9044
|
+
});
|
|
9045
|
+
}
|
|
8131
9046
|
// src/lib/file-intake.ts
|
|
8132
9047
|
/** Whether a file matches one entry of an `accept` list: extension, exact type or `family/*`, ignoring case. */
|
|
8133
9048
|
function matchesAccept(file, accept) {
|
|
@@ -15554,7 +16469,7 @@ var SlotContext = React.createContext({
|
|
|
15554
16469
|
stacked: false
|
|
15555
16470
|
});
|
|
15556
16471
|
/** The workspace: a labelled region that holds the splits and panes, and stacks them when narrow. */
|
|
15557
|
-
function Workspace({ label, state, narrowBelow = 720, className, children }) {
|
|
16472
|
+
function Workspace({ label, state, narrowBelow = 720, onFiles, acceptLabel, className, children }) {
|
|
15558
16473
|
const ref = React.useRef(null);
|
|
15559
16474
|
const { setNarrow } = state;
|
|
15560
16475
|
React.useLayoutEffect(() => {
|
|
@@ -15571,21 +16486,49 @@ function Workspace({ label, state, narrowBelow = 720, className, children }) {
|
|
|
15571
16486
|
}, [narrowBelow, setNarrow]);
|
|
15572
16487
|
return /* @__PURE__ */ jsx(StateContext.Provider, {
|
|
15573
16488
|
value: state,
|
|
15574
|
-
children: /* @__PURE__ */
|
|
16489
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
15575
16490
|
ref,
|
|
15576
16491
|
role: "group",
|
|
15577
16492
|
"aria-label": label,
|
|
15578
16493
|
className: cn("flex h-full min-h-0 min-w-0 flex-col overflow-hidden bg-background", className),
|
|
15579
|
-
children
|
|
16494
|
+
children: [children, onFiles && /* @__PURE__ */ jsx(FileDropOverlay, {
|
|
16495
|
+
onFiles,
|
|
16496
|
+
acceptLabel: acceptLabel ?? "files"
|
|
16497
|
+
})]
|
|
15580
16498
|
})
|
|
15581
16499
|
});
|
|
15582
16500
|
}
|
|
16501
|
+
/** The bar across the top of a `Workspace`: the tool's name as the heading, a polite status line, the few actions, then an end slot for the scheme and palette choice. Wraps on a phone. */
|
|
16502
|
+
function WorkspaceBar({ title, status, actions, end, className }) {
|
|
16503
|
+
return /* @__PURE__ */ jsxs("header", {
|
|
16504
|
+
className: cn("flex min-h-(--control-h) shrink-0 flex-wrap items-center gap-x-3 gap-y-1 border-b border-border px-3 py-1", className),
|
|
16505
|
+
children: [
|
|
16506
|
+
/* @__PURE__ */ jsx("h1", {
|
|
16507
|
+
className: "type-label min-w-0 shrink-0",
|
|
16508
|
+
children: title
|
|
16509
|
+
}),
|
|
16510
|
+
/* @__PURE__ */ jsx("p", {
|
|
16511
|
+
role: "status",
|
|
16512
|
+
className: "type-body-sm min-w-0 flex-1 truncate text-muted-foreground tabular-nums",
|
|
16513
|
+
children: status
|
|
16514
|
+
}),
|
|
16515
|
+
actions && /* @__PURE__ */ jsx("div", {
|
|
16516
|
+
className: "flex shrink-0 items-center gap-2",
|
|
16517
|
+
children: actions
|
|
16518
|
+
}),
|
|
16519
|
+
end && /* @__PURE__ */ jsx("div", {
|
|
16520
|
+
className: "flex shrink-0 items-center gap-2",
|
|
16521
|
+
children: end
|
|
16522
|
+
})
|
|
16523
|
+
]
|
|
16524
|
+
});
|
|
16525
|
+
}
|
|
15583
16526
|
var iconsFor = (direction, edge, stacked) => {
|
|
15584
16527
|
if (stacked || direction === "column") return edge === "start" ? [PanelTopClose, PanelTopOpen] : [PanelBottomClose, PanelBottomOpen];
|
|
15585
16528
|
return edge === "end" ? [PanelRightClose, PanelRightOpen] : [PanelLeftClose, PanelLeftOpen];
|
|
15586
16529
|
};
|
|
15587
16530
|
/** A region of a workspace with a consistent header (name, actions, fold button) and a body that scrolls. */
|
|
15588
|
-
function Pane({ id, name, grow, size = 280, min, max, collapsible, defaultCollapsed, actions, className, children }) {
|
|
16531
|
+
function Pane({ id, name, grow, size = 280, min, max, collapsible, defaultCollapsed, actions, flush, className, children }) {
|
|
15589
16532
|
const state = useState_();
|
|
15590
16533
|
const { direction, edge, stacked } = React.useContext(SlotContext);
|
|
15591
16534
|
const headingId = React.useId();
|
|
@@ -15642,7 +16585,7 @@ function Pane({ id, name, grow, size = 280, min, max, collapsible, defaultCollap
|
|
|
15642
16585
|
}), /* @__PURE__ */ jsx("div", {
|
|
15643
16586
|
id: `pane-body-${id}`,
|
|
15644
16587
|
hidden: folded,
|
|
15645
|
-
className: "min-h-0 min-w-0 flex-1 overflow-auto",
|
|
16588
|
+
className: cn("min-h-0 min-w-0 flex-1 overflow-auto", !flush && "p-3"),
|
|
15646
16589
|
children
|
|
15647
16590
|
})]
|
|
15648
16591
|
});
|
|
@@ -18346,7 +19289,7 @@ function Children({ node }) {
|
|
|
18346
19289
|
return /* @__PURE__ */ jsx(Nodes, { nodes: load.data });
|
|
18347
19290
|
}
|
|
18348
19291
|
/** A hierarchy whose children load as each node opens (a `useChildren` hook per open node): a skeleton row, a Try again row and an "empty" row per node, type-ahead and arrow keys, single selection, open state optionally in the URL, always virtualised. */
|
|
18349
|
-
function Tree({ label, roots, useChildren, nodeKey, nodeLabel, isBranch, renderNode, selected, onSelect, choices, current, onCurrentChange, count, badge, sortChildren, reveal, resolveBranch, coverNoun = ["item", "items"], expanded, beforeOpen, loadingRow, emptyRow, height = "24rem", className }) {
|
|
19292
|
+
function Tree({ label, roots, useChildren, nodeKey, nodeLabel, isBranch, renderNode, selected, onSelect, choices, current, onCurrentChange, count, badge, sortChildren, reveal, resolveBranch, coverNoun = ["item", "items"], branchPress = "select", expanded, beforeOpen, loadingRow, emptyRow, height = "24rem", className }) {
|
|
18350
19293
|
const nodes = React.useRef(/* @__PURE__ */ new Map()).current;
|
|
18351
19294
|
const [covered, setCovered] = React.useState("");
|
|
18352
19295
|
const scroller = React.useRef(null);
|
|
@@ -18476,7 +19419,13 @@ function Tree({ label, roots, useChildren, nodeKey, nodeLabel, isBranch, renderN
|
|
|
18476
19419
|
if (first === void 0 || isNote(String(first))) return;
|
|
18477
19420
|
const key = String(first);
|
|
18478
19421
|
const node = nodes.get(key);
|
|
18479
|
-
if (node
|
|
19422
|
+
if (node === void 0) return;
|
|
19423
|
+
if (branchPress === "toggle" && (isBranch ? isBranch(node) : true)) {
|
|
19424
|
+
if (!expanded.isOpen(key) && beforeOpen?.(node) === false) return;
|
|
19425
|
+
expanded.toggle(key);
|
|
19426
|
+
return;
|
|
19427
|
+
}
|
|
19428
|
+
onSelect?.(key, node);
|
|
18480
19429
|
};
|
|
18481
19430
|
const displayKeys = choices ? [.../* @__PURE__ */ new Set([...choices.selected, ...nodes.keys()])].filter((k) => stateOf(k) === "on" || choices.selected.has(k) && !nodes.has(k)) : [];
|
|
18482
19431
|
const shown = () => {
|
|
@@ -18802,6 +19751,6 @@ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose
|
|
|
18802
19751
|
]
|
|
18803
19752
|
});
|
|
18804
19753
|
}
|
|
18805
|
-
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, BoxedPicture, 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, MediaContents, 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, WorkflowSummary, 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, currentItem, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, 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, regionStyle, resample, resamplePeaks, resizeRect, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, summariseWorkflow, 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 };
|
|
19754
|
+
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, EmptyState, FIT, Field, FileButton, FileDropOverlay, 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, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, ShortcutEditor, 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, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, cn, colorSchemeScript, commandShortcut, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, 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, keyName, 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, pixelZoom, plainText, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, resample, resamplePeaks, resizeRect, rgbaToBlob, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, summariseWorkflow, 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, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useRebindableShortcuts, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSharedCursor, useSpeech, useSystemColorScheme, useSystemInfo, useTimelineZoom, useUndoable, useViewOptions, useViewport, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
|
|
18806
19755
|
|
|
18807
19756
|
//# sourceMappingURL=index.js.map
|