strata-react 2.1.12 → 2.1.13

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.
@@ -129,6 +129,23 @@ function createFormat(locale, options = {}) {
129
129
  /** A figure in short form for counts that run to thousands: `format.compact(1234)` is "1.2k" in en-GB, "1.2K" in en-US. */
130
130
  compact,
131
131
  /**
132
+ * A monetary amount via `Intl.NumberFormat` with narrow currency symbol (`"$1.25"`, `"£4.50"`,
133
+ * or `format.currency(0.0042, { decimals: 4 })` → `"$0.0042"`). Unknown (`null`, `undefined`,
134
+ * `NaN`, non-finite) prints the placeholder.
135
+ */
136
+ currency: (value, { currency = "USD", decimals } = {}) => {
137
+ if (value == null || !Number.isFinite(value)) return missing;
138
+ return new Intl.NumberFormat(locale, {
139
+ style: "currency",
140
+ currency,
141
+ currencyDisplay: "narrowSymbol",
142
+ ...decimals !== void 0 ? {
143
+ minimumFractionDigits: decimals,
144
+ maximumFractionDigits: decimals
145
+ } : {}
146
+ }).format(value);
147
+ },
148
+ /**
132
149
  * How long ago (or how far ahead) a time is, in the largest unit it reaches:
133
150
  * "3 weeks ago", "yesterday", "in 2 hours", "now" under a minute. Pass `now` in tests.
134
151
  */
@@ -503,4 +520,4 @@ function ChoiceGroupView({ legend, name, choices, value, onChange, error }) {
503
520
  }
504
521
 
505
522
  export { Textarea as a, useSearchParam as c, createFormat as d, format as f, NativeSelect as i, MISSING as l, Field as n, useFieldControl as o, toDate as p, Input$1 as r, controlHeight as s, ChoiceGroup as t, NBSP as u };
506
- //# sourceMappingURL=field-BY42OY3g.js.map
523
+ //# sourceMappingURL=field-S12YUQxn.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-S12YUQxn.js","names":["Input"],"sources":["../src/lib/format.ts","../src/lib/search-param.ts","../src/lib/control.ts","../src/components/field.tsx"],"sourcesContent":["// Every number and date on screen goes through Intl, once, here. Units are joined with a\n// non-breaking space so \"212 °C\" never wraps between figure and unit. A product that is not\n// en-GB calls createFormat with its locale once and exports the result from its own lib.\n//\n// The number formatters are callable (`format.integer(n)`) because that is the form people reach\n// for (strata-react issue #12), and they keep Intl's methods (`format.integer.format(n)`,\n// `formatToParts`, `resolvedOptions`) so existing calls and Intl knowledge still work.\n//\n// Dates follow the same shape. Every date formatter is callable with a Date, an ISO string or\n// epoch milliseconds (`format.dateTime(row.at)`), because rows arrive from an API as ISO strings\n// and an app that has to wrap each one in `new Date(...)` soon builds its own Intl.DateTimeFormat\n// beside it instead (strata-react issue #31, from the Bright Horizons History screen). An invalid\n// date throws a RangeError naming the input rather than printing \"Invalid Date\" into a row.\n// `date` and `dateTime` use Intl's medium/short styles, so the locale decides the order\n// (\"8 Nov 2026, 06:05\" in en-GB, \"Nov 8, 2026, 6:05 AM\" in en-US) and nobody hand-writes a\n// pattern. `timeZone` is optional: left out, times are the viewer's; a product that shows a place's\n// times (a kiln in one room, a shop's opening hours) passes that place's zone once.\n//\n// Tests: the non-breaking space is a real character in the DOM. Testing Library's text matchers\n// (`getByText`, `toHaveTextContent`) collapse whitespace and match \"6 pieces\", but accessible-name\n// matching (`getByRole(\"heading\", { name: \"6 pieces\" })`) compares the name exactly and does not.\n// Build the expected string with the same formatter (`{ name: format.count(6, \"piece\") }`), or\n// use a regex with `\\s` (`/6\\spieces/`), which matches U+00A0.\n//\n// A value that is not known (`null` or `undefined`: a count the source does not give, a date for\n// something never synced) prints as the placeholder, an en dash unless `createFormat`'s `missing`\n// says otherwise, from every number and date formatter (strata-react issue #47). Each screen used\n// to pick its own (\"–\", \"Never\", blank), so tables and cards disagreed. An invalid date still\n// throws: that is a bug, not a missing value.\n//\n// Three formatters came from the Tubes viewer, which wrote its own (strata-react issue #52): `ago`\n// (\"3 weeks ago\", from Intl.RelativeTimeFormat, with `now` passed in by tests), `compact` (\"1.2k\"\n// in en-GB, and `count`'s `{ compact: true }` for \"1.2k views\") and `runningTime` (\"4:05\", \"1:02:09\"), the\n// m:ss of a media player, which Intl.DurationFormat's long form is not. `share` is `percent` for a\n// part of a whole (strata-react issue #43): a part that is there never prints as \"0%\", nor a part\n// short of the whole as \"100%\".\n//\n// Four more came from a status page (strata-react issue #341, jburnhams/homepage), each written by\n// hand there because `format` had no equivalent: `bytes` in binary units (`{ binary: true }`:\n// memory is read in KiB, MiB, GiB, and `free -h` shows them, so a decimal GB reads 7% high);\n// `duration` (\"16 min\", \"3.5 h\", \"2 days\" to say how long, or `style: \"parts\"` for an uptime,\n// \"1d 1h 0m\"), which `runningTime`'s clock cannot say; `measure` (a reading and its unit, \"12.3 GB\",\n// \"41%\"); and `agoTick` (\"now\", \"−30 s\", \"−2 min\") for the axis of a history chart.\n\nexport const NBSP = \" \";\n\n/** The placeholder printed for a value that is not known: an en dash. */\nexport const MISSING = \"–\";\n\n/** The decimal byte units `format.bytes` writes. */\nexport type ByteUnit = \"B\" | \"kB\" | \"MB\" | \"GB\" | \"TB\" | \"PB\";\nconst BYTE_UNITS: readonly ByteUnit[] = [\"B\", \"kB\", \"MB\", \"GB\", \"TB\", \"PB\"];\nconst BYTE_SIZE = Object.fromEntries(BYTE_UNITS.map((u, i) => [u, 1000 ** i])) as Record<ByteUnit, number>;\n\n/** The binary byte units `format.bytes` writes with `{ binary: true }`. */\nexport type BinaryByteUnit = \"B\" | \"KiB\" | \"MiB\" | \"GiB\" | \"TiB\" | \"PiB\";\nconst BINARY_UNITS: readonly BinaryByteUnit[] = [\"B\", \"KiB\", \"MiB\", \"GiB\", \"TiB\", \"PiB\"];\nconst BINARY_SIZE = Object.fromEntries(BINARY_UNITS.map((u, i) => [u, 1024 ** i])) as Record<BinaryByteUnit, number>;\nconst SIZE: Record<ByteUnit | BinaryByteUnit, number> = { ...BYTE_SIZE, ...BINARY_SIZE };\n\n/** What `format.bytes` and `format.byteUnit` take beyond the value: `{ binary: true }` for KiB, MiB, GiB (powers of 1024), or a unit to fix. A binary unit implies binary. */\nexport type BytesOptions = { binary?: boolean; unit?: ByteUnit | BinaryByteUnit };\n\nfunction chooseByteUnit(value: number, binary: boolean): ByteUnit | BinaryByteUnit {\n const units: readonly (ByteUnit | BinaryByteUnit)[] = binary ? BINARY_UNITS : BYTE_UNITS;\n return [...units].reverse().find((u) => Math.abs(value) >= SIZE[u]) ?? \"B\";\n}\n\n/** An `Intl.NumberFormat` that can also be called directly: `f(n)` is `f.format(n)`. `null` or `undefined` prints the placeholder. */\nexport type NumberFormatter = ((value: number | bigint | Intl.StringNumericLiteral | null | undefined) => string) & {\n format: (value: number | bigint | Intl.StringNumericLiteral | null | undefined) => string;\n} & Pick<Intl.NumberFormat, \"formatToParts\" | \"resolvedOptions\">;\n\n/** What a date formatter accepts: a Date, an ISO 8601 string, or epoch milliseconds. */\nexport type DateInput = Date | string | number;\n\n/** An `Intl.DateTimeFormat` that can also be called directly, with a Date, an ISO string or epoch milliseconds. */\nexport type DateFormatter = ((value: DateInput | null | undefined) => string) & {\n format: (value: DateInput | null | undefined) => string;\n formatToParts: (value: DateInput) => Intl.DateTimeFormatPart[];\n formatRange: (start: DateInput, end: DateInput) => string;\n} & Pick<Intl.DateTimeFormat, \"resolvedOptions\">;\n\n/** Options for `format.currency`. */\nexport interface CurrencyOptions {\n /** ISO 4217 currency code. Default `\"USD\"`. */\n currency?: string;\n /** Fixed fraction digits (e.g. `4` for micro-costs like API spend `\"$0.0042\"`). Left out, Intl picks the currency's default (usually 2). */\n decimals?: number;\n}\n\n/** Options shared by every date formatter one `createFormat` call makes. */\nexport interface FormatOptions {\n /** An IANA zone (\"Europe/London\", \"UTC\") to show times in. Left out, times are the viewer's own. */\n timeZone?: string;\n /** What a missing value (`null`, `undefined`) prints as. Default an en dash (`MISSING`). */\n missing?: string;\n}\n\n/** Options for `format.count`. */\nexport interface CountOptions {\n /** Write the figure compactly: \"1.2k views\". The noun still agrees with the exact count. */\n compact?: boolean;\n}\n\n/** A Date from a Date, an ISO string or epoch milliseconds; throws a RangeError naming the input when it is not a date. */\nexport function toDate(value: DateInput): Date {\n const date = value instanceof Date ? value : new Date(value);\n if (Number.isNaN(date.getTime())) throw new RangeError(`Not a date: ${JSON.stringify(String(value))}`);\n return date;\n}\n\nfunction callableDate(df: Intl.DateTimeFormat, missing: string): DateFormatter {\n const format = (value: DateInput | null | undefined) => (value == null ? missing : df.format(toDate(value)));\n return Object.assign(format, {\n format,\n formatToParts: (value: DateInput) => df.formatToParts(toDate(value)),\n formatRange: (start: DateInput, end: DateInput) => df.formatRange(toDate(start), toDate(end)),\n resolvedOptions: () => df.resolvedOptions(),\n });\n}\n\nfunction callable(nf: Intl.NumberFormat, missing: string): NumberFormatter {\n const format = (value: number | bigint | Intl.StringNumericLiteral | null | undefined) =>\n value == null ? missing : nf.format(value);\n return Object.assign(format, {\n format,\n formatToParts: (value: number | bigint) => nf.formatToParts(value),\n resolvedOptions: () => nf.resolvedOptions(),\n });\n}\n\n// Largest first: `ago` says a span in the largest unit it fills at least once, rounded down, so\n// 13 days is \"last week\" and 20 days \"2 weeks ago\", never \"3 weeks\" too early.\nconst DAY = 86_400_000;\nconst AGO_STEPS: readonly [Intl.RelativeTimeFormatUnit, number][] = [\n [\"year\", 365 * DAY],\n [\"month\", 30 * DAY],\n [\"week\", 7 * DAY],\n [\"day\", DAY],\n [\"hour\", 3_600_000],\n [\"minute\", 60_000],\n];\n\n/** Intl formatters for one locale (and optionally one time zone): integers, decimals, percent, dates, times, units with a non-breaking space, byte sizes, and counted nouns. */\nexport function createFormat(locale: string, options: FormatOptions = {}) {\n const { timeZone, missing = MISSING } = options;\n const dates = (opts: Intl.DateTimeFormatOptions) =>\n callableDate(new Intl.DateTimeFormat(locale, { ...opts, timeZone }), missing);\n const integer = callable(new Intl.NumberFormat(locale, { maximumFractionDigits: 0 }), missing);\n const decimal = callable(new Intl.NumberFormat(locale, { maximumFractionDigits: 1 }), missing);\n const percent = callable(new Intl.NumberFormat(locale, { style: \"percent\", maximumFractionDigits: 0 }), missing);\n const compact = callable(new Intl.NumberFormat(locale, { notation: \"compact\", maximumFractionDigits: 1 }), missing);\n const relative = new Intl.RelativeTimeFormat(locale, { numeric: \"auto\" });\n const plurals = new Intl.PluralRules(locale);\n const clock = dates({ hour: \"2-digit\", minute: \"2-digit\" });\n const day = dates({ weekday: \"long\", day: \"numeric\", month: \"long\" });\n const shortDay = dates({ weekday: \"short\", hour: \"2-digit\", minute: \"2-digit\" });\n const date = dates({ dateStyle: \"medium\" });\n const dateTime = dates({ dateStyle: \"medium\", timeStyle: \"short\" });\n const withUnit = (value: number, unit: string, fmt: Pick<Intl.NumberFormat, \"format\"> = integer) =>\n `${fmt.format(value)}${NBSP}${unit}`;\n return {\n locale,\n /** The zone times are shown in, or `undefined` for the viewer's own. */\n timeZone,\n /** Whole numbers with grouping: `format.integer(1222)` is \"1,222\". */\n integer,\n /** One decimal place at most: `format.decimal(3.14)` is \"3.1\". */\n decimal,\n /** A ratio as a whole percent: `format.percent(0.42)` is \"42%\". */\n percent,\n /**\n * A part's share of a whole, as `percent` but never misleading at the ends: a part above 0 that\n * rounds to 0 is \"<1%\", and one short of the whole that rounds to 100 is \">99%\".\n * `format.share(2.4 / 512)` is \"<1%\".\n */\n share: (value: number | null | undefined) => {\n if (value == null || Number.isNaN(value)) return missing;\n if (value > 0 && value < 0.005) return `<${percent.format(0.01)}`;\n if (value >= 0.995 && value < 1) return `>${percent.format(0.99)}`;\n return percent.format(value);\n },\n /** A figure in short form for counts that run to thousands: `format.compact(1234)` is \"1.2k\" in en-GB, \"1.2K\" in en-US. */\n compact,\n /**\n * A monetary amount via `Intl.NumberFormat` with narrow currency symbol (`\"$1.25\"`, `\"£4.50\"`,\n * or `format.currency(0.0042, { decimals: 4 })` → `\"$0.0042\"`). Unknown (`null`, `undefined`,\n * `NaN`, non-finite) prints the placeholder.\n */\n currency: (value: number | null | undefined, { currency = \"USD\", decimals }: CurrencyOptions = {}) => {\n if (value == null || !Number.isFinite(value)) return missing;\n return new Intl.NumberFormat(locale, {\n style: \"currency\",\n currency,\n currencyDisplay: \"narrowSymbol\",\n ...(decimals !== undefined ? { minimumFractionDigits: decimals, maximumFractionDigits: decimals } : {}),\n }).format(value);\n },\n /**\n * How long ago (or how far ahead) a time is, in the largest unit it reaches:\n * \"3 weeks ago\", \"yesterday\", \"in 2 hours\", \"now\" under a minute. Pass `now` in tests.\n */\n ago: (value: DateInput | null | undefined, now: DateInput = new Date()) => {\n if (value == null) return missing;\n const diff = toDate(value).getTime() - toDate(now).getTime();\n const span = Math.abs(diff);\n for (const [unit, size] of AGO_STEPS) {\n if (span >= size) return relative.format(Math.sign(diff) * Math.floor(span / size), unit);\n }\n return relative.format(0, \"second\");\n },\n /**\n * A media running time from seconds, as a player shows it: \"4:05\", \"1:02:09\". Unknown\n * (null, negative, not finite) prints the placeholder. Set it in `tabular-nums`.\n */\n runningTime: (seconds: number | null | undefined) => {\n if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;\n const s = Math.floor(seconds);\n const two = (n: number) => String(n).padStart(2, \"0\");\n const [h, m] = [Math.floor(s / 3600), Math.floor((s % 3600) / 60)];\n return h > 0 ? `${h}:${two(m)}:${two(s % 60)}` : `${m}:${two(s % 60)}`;\n },\n /**\n * A position in media as an editor shows it, to a chosen precision: \"4:05\" (seconds), \"4:05.250\"\n * (`\"ms\"`), or \"0:04:05:07\" (`\"frames\"` at `fps`, the last part the frame). Hours appear only\n * from one hour, except in frames. Frames are always four parts, hours included, as SMPTE\n * timecode is (non-drop frame, with colons): a three-part \"1:05:00\" reads as one hour five, so\n * a frame count must never be three. Editors write the same four parts (strata-react issue\n * #122). Floors, never rounds up, so a time never reads ahead of the picture. Unknown (null,\n * negative, not finite) prints the placeholder. Set it in `tabular-nums`.\n */\n timecode: (\n seconds: number | null | undefined,\n { precision = \"seconds\", fps = 30 }: { precision?: \"seconds\" | \"ms\" | \"frames\"; fps?: number } = {},\n ) => {\n if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;\n const whole = Math.floor(seconds);\n const two = (n: number) => String(n).padStart(2, \"0\");\n const [h, m] = [Math.floor(whole / 3600), Math.floor((whole % 3600) / 60)];\n const base = h > 0 ? `${h}:${two(m)}:${two(whole % 60)}` : `${m}:${two(whole % 60)}`;\n if (precision === \"ms\")\n return `${base}.${String(Math.min(Math.floor((seconds - whole) * 1000 + 1e-6), 999)).padStart(3, \"0\")}`;\n if (precision === \"frames\")\n return `${h}:${two(m)}:${two(whole % 60)}:${two(Math.min(Math.floor((seconds - whole) * fps + 1e-6), Math.ceil(fps) - 1))}`;\n return base;\n },\n /** What a missing value prints as: an en dash unless `createFormat`'s `missing` says otherwise. */\n missing,\n /** A time of day: `format.clock(at)` is \"06:05\". */\n clock,\n /** A day without its year, for this week's things: `format.day(at)` is \"Sunday 8 November\". */\n day,\n /** A weekday and time, for chart axes and recent rows: `format.shortDay(at)` is \"Sun 06:05\". */\n shortDay,\n /** A date with its year, for a record or a deadline: `format.date(at)` is \"8 Nov 2026\". */\n date,\n /** A date and time, for a log or history row: `format.dateTime(at)` is \"8 Nov 2026, 06:05\". */\n dateTime,\n /** A figure and its unit joined by a non-breaking space (`NBSP`), so they never wrap apart. */\n withUnit,\n /** A temperature in °C, joined by a non-breaking space. */\n celsius: (value: number) => withUnit(value, \"°C\"),\n /**\n * A size in bytes in the largest decimal unit it reaches (kB, MB, GB, TB, as disks and\n * networks are sold): one decimal below 10 (\"5.2 GB\"), whole above (\"431 GB\"). Pass `unit`\n * to fix the unit, so figures compared side by side (\"431 of 466 GB\") share one. Memory is\n * read in binary units: `{ binary: true }` writes KiB, MiB, GiB (\"7.6 GiB\"), and a binary\n * unit (\"GiB\") picks that too. The second argument is a unit or `{ binary, unit }`.\n */\n bytes: (value: number, unitOrOptions?: ByteUnit | BinaryByteUnit | BytesOptions) => {\n const { binary = false, unit } =\n typeof unitOrOptions === \"string\" ? { unit: unitOrOptions } : (unitOrOptions ?? {});\n const chosen = unit ?? chooseByteUnit(value, binary);\n const scaled = value / SIZE[chosen];\n return withUnit(scaled, chosen, Math.abs(scaled) < 10 && chosen !== \"B\" ? decimal : integer);\n },\n /**\n * A rate in bits per second, in the largest decimal unit it reaches, as networks and video\n * are measured: \"850 kb/s\", \"4.2 Mb/s\", \"35 Mb/s\", \"1.2 Gb/s\" (one decimal below 10).\n */\n bitrate: (bitsPerSecond: number | null | undefined) => {\n if (bitsPerSecond == null || !Number.isFinite(bitsPerSecond) || bitsPerSecond < 0) return missing;\n const [scale, unit] =\n bitsPerSecond >= 1e9\n ? [1e9, \"Gb/s\"]\n : bitsPerSecond >= 1e6\n ? [1e6, \"Mb/s\"]\n : bitsPerSecond >= 1e3\n ? [1e3, \"kb/s\"]\n : [1, \"b/s\"];\n const scaled = bitsPerSecond / scale;\n return withUnit(scaled, unit, scaled < 10 && scale > 1 ? decimal : integer);\n },\n /**\n * A length of time in words, the unit chosen by size: \"45 s\", \"16 min\", \"3.5 h\", \"2 days\". Unknown\n * (null, negative, not finite) prints the placeholder. `style: \"parts\"` is an uptime, the two\n * largest units written out: \"1d 1h 0m\", \"2h 5m\", \"5m 3s\". Not `runningTime`, which is a media clock.\n */\n duration: (seconds: number | null | undefined, { style = \"approx\" }: { style?: \"approx\" | \"parts\" } = {}) => {\n if (seconds == null || !Number.isFinite(seconds) || seconds < 0) return missing;\n if (style === \"parts\") {\n const s = Math.floor(seconds);\n const [d, h, m] = [Math.floor(s / 86400), Math.floor((s % 86400) / 3600), Math.floor((s % 3600) / 60)];\n if (d > 0) return `${d}d${NBSP}${h}h${NBSP}${m}m`;\n if (h > 0) return `${h}h${NBSP}${m}m`;\n if (m > 0) return `${m}m${NBSP}${s % 60}s`;\n return `${s}s`;\n }\n if (seconds < 60) return withUnit(Math.floor(seconds), \"s\");\n if (seconds < 3600) return withUnit(Math.floor(seconds / 60), \"min\");\n if (seconds < 86400) return withUnit(seconds / 3600, \"h\", decimal);\n const days = seconds / 86400;\n return withUnit(days, plurals.select(Math.round(days * 10) / 10) === \"one\" ? \"day\" : \"days\", decimal);\n },\n /**\n * A reading and its unit: `format.measure(12.34, \"GB\")` is \"12.3 GB\" (one decimal at most, a\n * non-breaking space). `\"%\"` takes the figure as percent points and goes through `percent`, so\n * the locale decides the spacing: `format.measure(41, \"%\")` is \"41%\". Unknown prints the placeholder.\n */\n measure: (value: number | null | undefined, unit: string) =>\n value == null ? missing : unit === \"%\" ? percent.format(value / 100) : withUnit(value, unit, decimal),\n /**\n * A tick for the axis of a chart of the past, from seconds before now: \"now\", \"−30 s\", \"−2 min\",\n * \"−6 h\", \"−3 d\" (a true minus sign). Pass it as `LineChart`'s `formatX` after turning x into seconds ago.\n */\n agoTick: (secondsAgo: number | null | undefined) => {\n if (secondsAgo == null || !Number.isFinite(secondsAgo)) return missing;\n const s = Math.abs(secondsAgo);\n if (s < 1) return \"now\";\n const [n, unit] = s < 60 ? [s, \"s\"] : s < 3600 ? [s / 60, \"min\"] : s < 86400 ? [s / 3600, \"h\"] : [s / 86400, \"d\"];\n return `−${integer.format(n)}${NBSP}${unit}`;\n },\n /**\n * A distance in metres as a person says it: metres under a kilometre (\"850 m\"), then\n * kilometres, one decimal below 100 (\"12.4 km\"), whole above; `\"imperial\"` is feet under a\n * tenth of a mile (\"320 ft\"), then miles (\"7.7 mi\").\n */\n distance: (metres: number, system: \"metric\" | \"imperial\" = \"metric\") => {\n if (system === \"imperial\") {\n const miles = metres / 1609.344;\n return miles < 0.1 ? withUnit(metres * 3.28084, \"ft\") : withUnit(miles, \"mi\", miles < 100 ? decimal : integer);\n }\n return Math.abs(metres) < 1000\n ? withUnit(metres, \"m\")\n : withUnit(metres / 1000, \"km\", Math.abs(metres) < 100_000 ? decimal : integer);\n },\n /** The unit `bytes` would choose for a value, to share it across a set of figures. */\n byteUnit: (value: number, { binary = false }: { binary?: boolean } = {}) => chooseByteUnit(value, binary),\n /**\n * \"1 piece\", \"6 pieces\": the count and its noun, so copy never reads \"1 pieces\". They are\n * joined by a non-breaking space (`NBSP`), not a plain one: in a test, match with the same\n * call or a `\\s` regex, not a typed \"6 pieces\" string in a role's `name`.\n */\n count: (\n value: number | null | undefined,\n one: string,\n many = `${one}s`,\n { compact: short = false }: CountOptions = {},\n ) =>\n value == null\n ? missing\n : `${(short ? compact : integer).format(value)}${NBSP}${plurals.select(value) === \"one\" ? one : many}`,\n };\n}\n\nexport type Format = ReturnType<typeof createFormat>;\n\n/** The en-GB formatters. */\nexport const format = createFormat(\"en-GB\");\n","import * as React from \"react\";\nimport { useSearchParams } from \"react-router\";\n\n// \"Anything a person would link or reload into (tab, sort, filter, page, open item) is in the URL.\"\n// Tabs (`param=`), DataTable (`sortParam`) and `useExpanded({ param })` already do; a plain filter or\n// choice did not, so each app wrote the same `setParams(p => { new URLSearchParams(p) … })` (#297).\n// Rules fixed here once: the default is never written (the plain URL stays plain, as `Tabs` does),\n// a value that does not parse reads as the default (a stale or hand-edited link must not break the\n// screen), other params are kept, and a filter replaces the history entry (Back leaves the screen,\n// it does not walk through every filter change; `replace: false` for a choice worth a Back step).\n\n/** Options of `useSearchParam`. */\nexport type SearchParamOptions<T extends string> = {\n /** Read when the param is missing or invalid; setting it removes the param. */\n default: T;\n /** Says whether a raw value is allowed: a type guard (`isMode`), or a function that returns the typed value or `undefined`. */\n parse?: (raw: string) => T | boolean | undefined;\n /** Replace the history entry instead of adding one. Default `true`, since most params are filters. */\n replace?: boolean;\n};\n\n/** What `useSearchParam` returns: the value, and a setter that takes the next value or `null` for the default. */\nexport type SearchParam<T extends string> = readonly [T, (next: T | null) => void];\n\n/**\n * One value held in a URL search parameter (React Router): `const [mode, setMode] = useSearchParam(\"mode\", { default: \"all\", parse: isMode })`.\n * Reads and validates it, drops the param when set to the default or `null`, keeps the others, and replaces the history entry by default.\n */\nexport function useSearchParam<T extends string = string>(\n key: string,\n { default: fallback, parse, replace = true }: SearchParamOptions<T>,\n): SearchParam<T> {\n const [params, setParams] = useSearchParams();\n const raw = params.get(key);\n let value = fallback;\n if (raw !== null) {\n const parsed = parse ? parse(raw) : (raw as T);\n if (parsed === true) value = raw as T;\n else if (typeof parsed === \"string\") value = parsed;\n }\n const set = React.useCallback(\n (next: T | null) =>\n setParams(\n (p) => {\n const out = new URLSearchParams(p);\n if (next === null || next === fallback) out.delete(key);\n else out.set(key, next);\n return out;\n },\n { replace },\n ),\n [key, fallback, replace, setParams],\n );\n return [value, set];\n}\n","// Control sizes, one set for everything that sits in a toolbar or a property row: `default` is\n// --control-h and `sm` is --control-h-sm, so two controls of the same size name are the same height\n// in every density (issue #117). Button, IconButton, Toggle, ToggleGroup, Input, NativeSelect and\n// NumberField all take it as `size`.\n\n/** The size names a control takes: `default` (--control-h) or `sm` (--control-h-sm). */\nexport type ControlSize = \"default\" | \"sm\";\n\n/** The height class of each control size. */\nexport const controlHeight: Record<ControlSize, string> = {\n default: \"h-(--control-h)\",\n sm: \"h-(--control-h-sm)\",\n};\n","import * as React from \"react\";\nimport { CircleAlert } from \"lucide-react\";\nimport { Label, Radio, RadioGroup } from \"react-aria-components\";\nimport { cn } from \"../lib/utils\";\nimport { useSearchParam } from \"../lib/search-param\";\nimport { controlHeight, type ControlSize } from \"../lib/control\";\n\n// Field owns the wiring a generated form usually forgets: the label's htmlFor, aria-describedby\n// pointing at the hint and the error, and aria-invalid. Controls read it from context, so a control\n// inside a Field cannot end up unlabelled or silently invalid.\n//\n// A one-field form (\"paste a link, Add\", a search box, \"invite by email\") puts its button on the\n// control's row, not beside the whole field (strata-react issue #46, from the Tubes Library\n// screen): in a plain flex row the button lines up with label, hint and error together and drifts\n// off the input whenever one shows. `action` is drawn on the control's row, both at --control-h,\n// with the hint and the error under both across the full width. It wraps under the control only\n// when the row cannot keep the control 10rem wide beside it (a 250px inspector body keeps a Reset beside its slider, issue #116): on a phone a short \"Add\" stays on the\n// row, as a search box's button does, and a long label or a narrow column wraps. The error and hint stay the input's description; the\n// button is not described by them. Field messages for a form come from `useAsyncAction`'s\n// `fieldErrors` (its `validate`, or the server's 422), so no `problem` state is kept by hand.\n\ntype FieldState = {\n id: string;\n label: string;\n describedBy?: string;\n invalid: boolean;\n report: (message: string | undefined) => void;\n};\nconst FieldContext = React.createContext<FieldState | null>(null);\n\n// A control that checks what was typed (a number field, a colour field) reports its own message to\n// the Field it sits in, which draws it as the field's error, so a value outside the limits is\n// explained in the same place and way as a server's 422, with nothing for the screen to wire.\n// `error` from the screen wins over the control's own. Outside a Field `report` does nothing and\n// the control marks itself invalid without a message.\n/** @internal The surrounding Field, and where a control reports its own message. */\nexport function useFieldControl() {\n const field = React.useContext(FieldContext);\n return { field, report: field?.report ?? noReport };\n}\n\nfunction useField(id?: string) {\n const field = React.useContext(FieldContext);\n return {\n // Inside a Field the Field's id wins, so the label always points at the control. To choose the\n // id yourself, pass it to Field.\n id: field?.id ?? id,\n \"aria-describedby\": field?.describedBy,\n \"aria-invalid\": field?.invalid || undefined,\n };\n}\n\nconst noReport = () => {};\n\nexport type FieldProps = {\n label: string;\n /** The control's id, when the page needs a known one (an anchor, a test). Generated otherwise. */\n id?: string;\n /** What the person needs to know before typing, such as limits or units. */\n hint?: React.ReactNode;\n /** What went wrong and how to fix it, in one sentence. Shown under the control, never in a toast. */\n error?: string;\n /** A button on the control's row, for a one-field form (an `AsyncButton` \"Add\"). The hint and error run under both; on a narrow screen it wraps under the control. */\n action?: React.ReactNode;\n children: React.ReactNode;\n className?: string;\n};\n\n/** A labelled form field: wires the label, hint, error, `aria-describedby` and `aria-invalid` into the one control it wraps. */\nexport function Field({ label, id: idProp, hint, error, action, children, className }: FieldProps) {\n const generated = React.useId();\n const id = idProp ?? generated;\n const hintId = hint ? `${id}-hint` : undefined;\n const [reported, report] = React.useState<string>();\n const shown = error ?? reported;\n const errorId = shown ? `${id}-error` : undefined;\n const describedBy = [errorId, hintId].filter(Boolean).join(\" \") || undefined;\n\n return (\n <FieldContext.Provider value={{ id, label, describedBy, invalid: Boolean(shown), report }}>\n <div className={cn(\"grid min-w-0 content-start gap-1.5\", className)}>\n <label htmlFor={id} className=\"type-label text-foreground\">\n {label}\n </label>\n {action ? (\n <div className=\"flex flex-wrap items-start gap-2\">\n <div className=\"min-w-40 flex-1\">{children}</div>\n <div className=\"flex shrink-0 items-center\">{action}</div>\n </div>\n ) : (\n children\n )}\n {shown && (\n <p id={errorId} className=\"flex items-start gap-1.5 type-body-sm text-danger\">\n <CircleAlert aria-hidden className=\"mt-0.5 size-4 shrink-0\" />\n {shown}\n </p>\n )}\n {hint && (\n <p id={hintId} className=\"type-body-sm text-muted-foreground\">\n {hint}\n </p>\n )}\n </div>\n </FieldContext.Provider>\n );\n}\n\nconst control =\n \"w-full min-w-0 rounded-control border border-input bg-background px-3 type-body text-foreground transition-state placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-70 aria-invalid:border-danger\";\n\n/** A text input that picks up its id and descriptions from the surrounding `Field`. `size=\"sm\"` is --control-h-sm; the native `size` (a width in characters) is not passed on. */\nexport function Input({\n className,\n id,\n size = \"default\",\n ...props\n}: Omit<React.ComponentProps<\"input\">, \"size\"> & { size?: ControlSize }) {\n return <input {...useField(id)} className={cn(control, controlHeight[size], className)} {...props} />;\n}\n\n/** A multi-line input that picks up its id and descriptions from the surrounding `Field`. */\nexport function Textarea({ className, id, ...props }: React.ComponentProps<\"textarea\">) {\n return <textarea {...useField(id)} className={cn(control, \"min-h-24 py-2\", className)} {...props} />;\n}\n\n// A native select, styled. For short option lists on a touch screen it beats a custom listbox:\n// the platform picker, typeahead and form autofill all work with no code.\n/** The platform select, styled. The default for short lists, especially on touch screens. `size=\"sm\"` is --control-h-sm. */\nexport function NativeSelect(props: NativeSelectProps) {\n // `param` is a different component so a select outside a router (no `param`) never calls router hooks.\n return props.param === undefined ? <PlainSelect {...(props as PlainSelectProps)} /> : <ParamSelect {...props} />;\n}\n\ntype PlainSelectProps = Omit<React.ComponentProps<\"select\">, \"size\"> & { size?: ControlSize };\n\n/** Props of `NativeSelect`: a native select's own, or (with `param`) a choice held in the URL. */\nexport type NativeSelectProps =\n | (PlainSelectProps & { param?: undefined; paramDefault?: undefined })\n | (Omit<PlainSelectProps, \"value\" | \"defaultValue\" | \"onChange\"> & {\n /** The search parameter that holds the choice (`?mode=…`), so it can be linked and survives a reload. */\n param: string;\n /** The option that is chosen when the URL says nothing; choosing it removes the param. */\n paramDefault: string;\n /** Called after the URL changes. */\n onChange?: (value: string) => void;\n });\n\nfunction PlainSelect({ className, id, size = \"default\", ...props }: PlainSelectProps) {\n return <select {...useField(id)} className={cn(control, controlHeight[size], \"pr-8\", className)} {...props} />;\n}\n\n/** The values of every `<option>`, looking inside `<optgroup>`s and fragments. */\nfunction optionValues(children: React.ReactNode): string[] {\n return React.Children.toArray(children).flatMap((c) => {\n if (!React.isValidElement<{ value?: string; children?: React.ReactNode }>(c)) return [];\n if (c.type === \"option\") return [c.props.value ?? String(c.props.children)];\n return optionValues(c.props.children);\n });\n}\n\nfunction ParamSelect({\n param,\n paramDefault,\n onChange,\n children,\n ...props\n}: Extract<NativeSelectProps, { param: string }>) {\n // An unknown value in the URL reads as the default: the select shows an option that exists.\n const options = optionValues(children);\n const [value, setValue] = useSearchParam(param, {\n default: paramDefault,\n parse: (raw) => options.length === 0 || options.includes(raw),\n });\n return (\n <PlainSelect\n {...props}\n value={value}\n onChange={(e) => {\n setValue(e.target.value);\n onChange?.(e.target.value);\n }}\n >\n {children}\n </PlainSelect>\n );\n}\n\n// Radio choices: React Aria's RadioGroup (a group named by its label, arrow-key movement, one tab\n// stop), and each row wraps its control so the whole row is one hit target. The dot is drawn from\n// tokens, not the platform's accent-color radio.\n/** One option of a `ChoiceGroup`: its value, its words, and optionally a decorative `leading` mark (a swatch) before the words, which a screen reader skips, so the label must say it all. */\nexport type Choice = { value: string; label: string; detail?: string; leading?: React.ReactNode };\n\n/** Radio choices in a fieldset with a legend; each whole row is the hit target. For 2 to 5 options that each need a sentence. */\nexport function ChoiceGroup(props: ChoiceGroupProps) {\n return props.param === undefined ? <ChoiceGroupView {...props} /> : <ParamChoiceGroup {...props} />;\n}\n\n/** Props of `ChoiceGroup`: the value and `onChange` are the caller's, or (with `param`) the URL's, the first choice being the default. */\nexport type ChoiceGroupProps = {\n legend: string;\n name: string;\n choices: Choice[];\n error?: string;\n} & (\n | { value: string; onChange: (value: string) => void; param?: undefined }\n | {\n /** The search parameter that holds the choice, so it can be linked and survives a reload. The first choice is the default and is not written. */\n param: string;\n value?: undefined;\n /** Called after the URL changes. */\n onChange?: (value: string) => void;\n }\n);\n\nfunction ParamChoiceGroup({ param, choices, onChange, ...props }: Extract<ChoiceGroupProps, { param: string }>) {\n const [value, setValue] = useSearchParam(param, {\n default: choices[0]?.value ?? \"\",\n parse: (raw) => choices.some((c) => c.value === raw),\n });\n return (\n <ChoiceGroupView\n {...props}\n choices={choices}\n value={value}\n onChange={(next) => {\n setValue(next);\n onChange?.(next);\n }}\n />\n );\n}\n\nfunction ChoiceGroupView({\n legend,\n name,\n choices,\n value,\n onChange,\n error,\n}: {\n legend: string;\n name: string;\n choices: Choice[];\n value: string;\n onChange: (value: string) => void;\n error?: string;\n}) {\n const errorId = React.useId();\n return (\n <RadioGroup\n name={name}\n value={value}\n onChange={onChange}\n aria-describedby={error ? errorId : undefined}\n className=\"grid gap-2\"\n >\n <Label className=\"mb-1.5 type-label text-foreground\">{legend}</Label>\n {choices.map((c) => (\n <Radio\n key={c.value}\n value={c.value}\n className=\"group flex min-h-(--control-h-sm) cursor-pointer items-start gap-3 py-1\"\n >\n <span\n aria-hidden\n className=\"mt-1 grid size-4 shrink-0 place-items-center rounded-pill border border-input bg-background transition-state group-selected:border-primary group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-ring\"\n >\n <span className=\"size-2 rounded-pill bg-primary opacity-0 group-selected:opacity-100\" />\n </span>\n {c.leading && <span className=\"mt-0.5 shrink-0\">{c.leading}</span>}\n <span className=\"grid\">\n <span className=\"type-body\">{c.label}</span>\n {c.detail && <span className=\"type-body-sm text-muted-foreground\">{c.detail}</span>}\n </span>\n </Radio>\n ))}\n {error && (\n <p id={errorId} className=\"flex items-start gap-1.5 type-body-sm text-danger\">\n <CircleAlert aria-hidden className=\"mt-0.5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KAAI,oBAAC,kBAAD,EAAkB,GAAI,MAAQ;AACpG;AAmBA,SAAS,iBAAiB,EAAE,OAAO,SAAS,UAAU,GAAG,SAAuD;CAC9G,MAAM,CAAC,OAAO,YAAY,eAAe,OAAO;EAC9C,SAAS,QAAQ,EAAE,EAAE,SAAS;EAC9B,QAAQ,QAAQ,QAAQ,MAAM,MAAM,EAAE,UAAU,GAAG;CACrD,CAAC;CACD,OACE,oBAAC,iBAAD;EACE,GAAI;EACK;EACF;EACP,WAAW,SAAS;GAClB,SAAS,IAAI;GACb,WAAW,IAAI;EACjB;CACD;AAEL;AAEA,SAAS,gBAAgB,EACvB,QACA,MACA,SACA,OACA,UACA,SAQC;CACD,MAAM,UAAU,MAAM,MAAM;CAC5B,OACE,qBAAC,YAAD;EACQ;EACC;EACG;EACV,oBAAkB,QAAQ,UAAU;EACpC,WAAU;YALZ;GAOE,oBAAC,OAAD;IAAO,WAAU;cAAqC;GAAc;GACnE,QAAQ,KAAK,MACZ,qBAAC,OAAD;IAEE,OAAO,EAAE;IACT,WAAU;cAHZ;KAKE,oBAAC,QAAD;MACE;MACA,WAAU;gBAEV,oBAAC,QAAD,EAAM,WAAU,sEAAuE;KACnF;KACL,EAAE,WAAW,oBAAC,QAAD;MAAM,WAAU;gBAAmB,EAAE;KAAc;KACjE,qBAAC,QAAD;MAAM,WAAU;gBAAhB,CACE,oBAAC,QAAD;OAAM,WAAU;iBAAa,EAAE;MAAY,IAC1C,EAAE,UAAU,oBAAC,QAAD;OAAM,WAAU;iBAAsC,EAAE;MAAa,EAC9E;;IACD;MAfA,EAAE,KAeF,CACR;GACA,SACC,qBAAC,KAAD;IAAG,IAAI;IAAS,WAAU;cAA1B,CACE,oBAAC,aAAD;KAAa;KAAY,WAAU;IAA0B,IAC5D,KACA;;EAEK;;AAEhB"}
package/dist/index.d.ts CHANGED
@@ -34,6 +34,13 @@ type DateFormatter = ((value: DateInput | null | undefined) => string) & {
34
34
  formatToParts: (value: DateInput) => Intl.DateTimeFormatPart[];
35
35
  formatRange: (start: DateInput, end: DateInput) => string;
36
36
  } & Pick<Intl.DateTimeFormat, "resolvedOptions">;
37
+ /** Options for `format.currency`. */
38
+ interface CurrencyOptions {
39
+ /** ISO 4217 currency code. Default `"USD"`. */
40
+ currency?: string;
41
+ /** Fixed fraction digits (e.g. `4` for micro-costs like API spend `"$0.0042"`). Left out, Intl picks the currency's default (usually 2). */
42
+ decimals?: number;
43
+ }
37
44
  /** Options shared by every date formatter one `createFormat` call makes. */
38
45
  interface FormatOptions {
39
46
  /** An IANA zone ("Europe/London", "UTC") to show times in. Left out, times are the viewer's own. */
@@ -67,6 +74,12 @@ export declare function createFormat(locale: string, options?: FormatOptions): {
67
74
  share: (value: number | null | undefined) => string;
68
75
  /** A figure in short form for counts that run to thousands: `format.compact(1234)` is "1.2k" in en-GB, "1.2K" in en-US. */
69
76
  compact: NumberFormatter;
77
+ /**
78
+ * A monetary amount via `Intl.NumberFormat` with narrow currency symbol (`"$1.25"`, `"£4.50"`,
79
+ * or `format.currency(0.0042, { decimals: 4 })` → `"$0.0042"`). Unknown (`null`, `undefined`,
80
+ * `NaN`, non-finite) prints the placeholder.
81
+ */
82
+ currency: (value: number | null | undefined, { currency, decimals }?: CurrencyOptions) => string;
70
83
  /**
71
84
  * How long ago (or how far ahead) a time is, in the largest unit it reaches:
72
85
  * "3 weeks ago", "yesterday", "in 2 hours", "now" under a minute. Pass `now` in tests.
@@ -175,6 +188,12 @@ declare const format$1: {
175
188
  share: (value: number | null | undefined) => string;
176
189
  /** A figure in short form for counts that run to thousands: `format.compact(1234)` is "1.2k" in en-GB, "1.2K" in en-US. */
177
190
  compact: NumberFormatter;
191
+ /**
192
+ * A monetary amount via `Intl.NumberFormat` with narrow currency symbol (`"$1.25"`, `"£4.50"`,
193
+ * or `format.currency(0.0042, { decimals: 4 })` → `"$0.0042"`). Unknown (`null`, `undefined`,
194
+ * `NaN`, non-finite) prints the placeholder.
195
+ */
196
+ currency: (value: number | null | undefined, { currency, decimals }?: CurrencyOptions) => string;
178
197
  /**
179
198
  * How long ago (or how far ahead) a time is, in the largest unit it reaches:
180
199
  * "3 weeks ago", "yesterday", "in 2 hours", "now" under a minute. Pass `now` in tests.
@@ -2705,6 +2724,100 @@ type ConsoleProps = {
2705
2724
  };
2706
2725
  /** 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. */
2707
2726
  export declare function Console({ label, lines, onCommand, complete, historyKey, height, lineHeight, commandLabel, inputRef, className }: ConsoleProps): React.JSX.Element;
2727
+ /** Open and closed disclosure state: controlled with `open` and `onOpenChange`, or uncontrolled from `defaultOpen`. */
2728
+ type DisclosureOpenProps = {
2729
+ open: boolean;
2730
+ onOpenChange: (open: boolean) => void;
2731
+ defaultOpen?: never;
2732
+ } | {
2733
+ open?: never;
2734
+ onOpenChange?: (open: boolean) => void;
2735
+ defaultOpen?: boolean;
2736
+ };
2737
+ type DisclosureProps = DisclosureOpenProps & {
2738
+ /** The always-visible line, and the button's accessible name: text and marks, no controls. */
2739
+ summary: React.ReactNode;
2740
+ /** Mounted only while open, so a request inside runs when the person opens it. */
2741
+ children: React.ReactNode;
2742
+ /** Controls for the row (a `RowAction`), beside the summary and outside its button. */
2743
+ actions?: React.ReactNode;
2744
+ className?: string;
2745
+ };
2746
+ /** Shows more of one thing in place: a button with `aria-expanded` around `summary`, and a body mounted only while open (so a request inside it runs on first open). Controlled with `open`/`onOpenChange` or `useExpanded`, or uncontrolled with `defaultOpen`. */
2747
+ export declare function Disclosure({ summary, children, actions, open, defaultOpen, onOpenChange, className }: DisclosureProps): React.JSX.Element;
2748
+ /** Which of many disclosures are open, by key: spread into `DataTable`'s `expansion`, or read with `isOpen`/`setOpen` for a list of `Disclosure`s. */
2749
+ type Expanded = {
2750
+ /** Keys of the open items. */
2751
+ expanded: ReadonlySet<string>;
2752
+ /** Replaces the open set. `DataTable` calls this. */
2753
+ onChange: (next: Set<string>) => void;
2754
+ isOpen: (key: string) => boolean;
2755
+ setOpen: (key: string, open: boolean) => void;
2756
+ /** Opens a closed key, closes an open one (the same word as `WorkspaceState.toggle`). */
2757
+ toggle: (key: string) => void;
2758
+ collapseAll: () => void;
2759
+ };
2760
+ type ExpandedOptions = {
2761
+ /** Keep the open keys in this URL search parameter (`?open=a&open=b`), so an opened row can be linked and survives a reload. Needs a React Router context. */
2762
+ param?: string;
2763
+ /** Keys open at first. Ignored with `param`: there the URL says what is open, so a link that opens a row carries it. */
2764
+ initial?: Iterable<string>;
2765
+ /** Opening one closes the others (an accordion). Default false: people compare two rows. */
2766
+ single?: boolean;
2767
+ };
2768
+ /** Shared open state for the disclosures of one list or table, optionally kept in the URL (`param`). */
2769
+ export declare function useExpanded(options?: ExpandedOptions): Expanded;
2770
+ /** One image attached to an event row (e.g. a rendered artifact or inspection crop). */
2771
+ type EventLogImage = {
2772
+ src: string;
2773
+ alt: string;
2774
+ /** Opens the full image in a new tab when given. */
2775
+ href?: string;
2776
+ /** Words shown if the image fails to load. Default `"Image unavailable"`. */
2777
+ missing?: string;
2778
+ /** Thumbnail aspect ratio. Default `"4/3"`. */
2779
+ aspect?: AspectRatio;
2780
+ };
2781
+ /** One row in an `EventLog`. */
2782
+ type EventLogEntry = {
2783
+ /** Stable key for the row. */
2784
+ id: string | number;
2785
+ /** Optional 1-based sequence number, drawn as `#N`. */
2786
+ seq?: number;
2787
+ /** Monospace event kind (e.g. `"llm_response"`, `"tool_call"`). */
2788
+ kind: string;
2789
+ /** When the event occurred. */
2790
+ at?: DateInput | null;
2791
+ /** Optional short inline summary shown beside the kind. */
2792
+ summary?: React.ReactNode;
2793
+ /** Optional status word (rendered with `Status`). */
2794
+ status?: string;
2795
+ /** Tone for `status`. Default `"neutral"`. */
2796
+ tone?: Tone;
2797
+ /** Optional structured payload, formatted as JSON when present. */
2798
+ payload?: unknown;
2799
+ /** Optional images attached to the event. */
2800
+ images?: readonly EventLogImage[];
2801
+ /** Optional custom detail content rendered below the payload. */
2802
+ detail?: React.ReactNode;
2803
+ };
2804
+ type EventLogProps = {
2805
+ /** Ordered list of events. */
2806
+ entries: readonly EventLogEntry[];
2807
+ /** Accessible name for the `<ol>` list (e.g. `"Run events"`). */
2808
+ label?: string;
2809
+ /** Formatter instance for timestamps. Default en-GB `format`. */
2810
+ format?: Format;
2811
+ /** Collapse each entry's payload/detail inside a `Disclosure` (mounted only when open). Default `false`. */
2812
+ collapsible?: boolean;
2813
+ /** Shared open state from `useExpanded` when `collapsible` is true. */
2814
+ expanded?: Expanded;
2815
+ /** Shown when `entries` is empty. */
2816
+ empty?: React.ReactNode;
2817
+ className?: string;
2818
+ };
2819
+ /** Ordered, structured event ledger for run histories, agent traces, and audit logs. */
2820
+ export declare function EventLog({ entries, label, format, collapsible, expanded, empty, className }: EventLogProps): React.JSX.Element | null;
2708
2821
  /** The keys a person has chosen, by shortcut id; an action absent here keeps its default keys. */
2709
2822
  type ShortcutOverrides = Record<string, string[]>;
2710
2823
  /** What `useRebindableShortcuts` returns: the list to hand to `useHotkeys` and `KeysLegend`, and what `ShortcutEditor` edits. */
@@ -2812,49 +2925,6 @@ type PropertyListProps = {
2812
2925
  };
2813
2926
  /** 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. */
2814
2927
  export declare function PropertyList({ items, label, className }: PropertyListProps): React.JSX.Element;
2815
- /** Open and closed disclosure state: controlled with `open` and `onOpenChange`, or uncontrolled from `defaultOpen`. */
2816
- type DisclosureOpenProps = {
2817
- open: boolean;
2818
- onOpenChange: (open: boolean) => void;
2819
- defaultOpen?: never;
2820
- } | {
2821
- open?: never;
2822
- onOpenChange?: (open: boolean) => void;
2823
- defaultOpen?: boolean;
2824
- };
2825
- type DisclosureProps = DisclosureOpenProps & {
2826
- /** The always-visible line, and the button's accessible name: text and marks, no controls. */
2827
- summary: React.ReactNode;
2828
- /** Mounted only while open, so a request inside runs when the person opens it. */
2829
- children: React.ReactNode;
2830
- /** Controls for the row (a `RowAction`), beside the summary and outside its button. */
2831
- actions?: React.ReactNode;
2832
- className?: string;
2833
- };
2834
- /** Shows more of one thing in place: a button with `aria-expanded` around `summary`, and a body mounted only while open (so a request inside it runs on first open). Controlled with `open`/`onOpenChange` or `useExpanded`, or uncontrolled with `defaultOpen`. */
2835
- export declare function Disclosure({ summary, children, actions, open, defaultOpen, onOpenChange, className }: DisclosureProps): React.JSX.Element;
2836
- /** Which of many disclosures are open, by key: spread into `DataTable`'s `expansion`, or read with `isOpen`/`setOpen` for a list of `Disclosure`s. */
2837
- type Expanded = {
2838
- /** Keys of the open items. */
2839
- expanded: ReadonlySet<string>;
2840
- /** Replaces the open set. `DataTable` calls this. */
2841
- onChange: (next: Set<string>) => void;
2842
- isOpen: (key: string) => boolean;
2843
- setOpen: (key: string, open: boolean) => void;
2844
- /** Opens a closed key, closes an open one (the same word as `WorkspaceState.toggle`). */
2845
- toggle: (key: string) => void;
2846
- collapseAll: () => void;
2847
- };
2848
- type ExpandedOptions = {
2849
- /** Keep the open keys in this URL search parameter (`?open=a&open=b`), so an opened row can be linked and survives a reload. Needs a React Router context. */
2850
- param?: string;
2851
- /** Keys open at first. Ignored with `param`: there the URL says what is open, so a link that opens a row carries it. */
2852
- initial?: Iterable<string>;
2853
- /** Opening one closes the others (an accordion). Default false: people compare two rows. */
2854
- single?: boolean;
2855
- };
2856
- /** Shared open state for the disclosures of one list or table, optionally kept in the URL (`param`). */
2857
- export declare function useExpanded(options?: ExpandedOptions): Expanded;
2858
2928
  /** What a chosen key brings with it: keys, or nothing. */
2859
2929
  type Implies = (key: string) => Iterable<string> | null | undefined;
2860
2930
  /** Which rows start chosen: their keys, or a test on each row. Either applies to a row the first time it appears. */
@@ -5919,5 +5989,5 @@ type ClockFaceProps = {
5919
5989
  export declare function clockWords(hours: number, minutes: number): string;
5920
5990
  /** An analogue clock showing one time, its hands telling hours from minutes by length, width and colour. */
5921
5991
  export declare function ClockFace({ hours, minutes, label, numbers, minuteMarks, className }: ClockFaceProps): import("react").JSX.Element;
5922
- export { type ActiveItem, type AlertDialogProps, type AlertProps, type Api, type ApiOptions, type ApiPage, type AspectRatio, type AsyncAction, type AsyncActionOptions, AsyncButton, type AsyncLabels, type AudioMedia, type AutoRecorder, type AutoRecorderState, type AutoSave, type AutoSaveOptions, type AutoTake, type BinaryByteUnit, type BookPage, type BookUrl, type BookViewerProps, type BoxListProps, type BoxOverlayProps, type BoxSource, type BoxTone, type BoxedPictureProps, type BoxesState, type Brush, type BrushControl, type BrushKind, Button, type ButtonLinkProps, type ButtonProps, type ByteHighlight, type ByteRange, type ByteUnit, type ByteViewProps, type BytesOptions, COLOR_SCHEME_STORAGE_KEY, type Candidate, type CellValue, type ChartMark, type ChartSpan, type CheckboxGesture, type CheckboxProps, type Choice, type ChoiceCounts, type ChoiceGridProps, type ChoiceGroupProps, type ChoiceMarks, type ChoiceSize, type ChoiceState, type Choices, type ClientWork, type Clips, type ClipsContext, type ClipsProviderProps, type ClockFaceProps, type ClockNumbers, type ColorFieldProps, type ColorScheme, ColorSchemeChoice, type ColorSchemeLabels, type ColorSchemePreference, type ColorSchemeState, type Column, type Command, type CommandMenuProps, type CommandsOptions, type CompareAudioProps, type CompareGridProps, type CompareMode, type CompareProps, type CompareTextProps, type CompareVideoGridProps, type CompareVideoProps, type ComposerProps, type CompositionBarProps, type CompositionPart, type ConcealedProps, type ConsoleLevel, type ConsoleLine, type ConsoleProps, type ContextMenuProps, type ControlSize, type ConversationImage, type ConversationProps, type ConversationTurn, type CountOptions, type CountdownOptions, type CursorMapping, type CursorOwner, CursorScope, type CursorScopeProps, type CutChange, type CutLimit, type CutRoom, DEFAULT_PALETTE, type DataTableProps, type DateFormatter, type DateInput, type DecodedAudio, type Delivery, Density, type DensityName, type DensityProps, type DescribeError, type DialogProps, type Difference, type DifferenceState, type DisclosureOpenProps, type DisclosureProps, type DragData, type DragSourceProps, type DrawTool, type Drawing, type Box as DrawingBox, type DrawingLayerProps, type DrawingOp, type DrawingOptions, type DrawingState, type DrawingToolbarProps, type DropTarget, type Easing, type EditClip, type EditListOptions, type EditListPlayerProps, type EditListSlot, type EditListState, type EditTimes, type EditableRegion, type EntityMatch, type EntityMatcher, type ErrorBody, type Expanded, type ExpandedOptions, type FailedRemoval, type FetchJsonInit, type FetchJsonOptions, type FieldErrors, type FieldProps, type FileIntake, type FileIntakeOptions, type FileOutcome, type FilmFrame, type FilmStripProps, type Folder, type FolderListing, type FolderPickerProps, type Format, type FormatOptions, type FullscreenFrameProps, type GlimpseLook, type GlimpseProps, type GlimpseWhy, type Grid, type GroupMember, type GroupedChart, type Handle, type History, type HistoryOptions, type HistoryStateOptions, type HistoryStep, type HotkeysOptions, IconButton, type IconButtonProps, type IconComponent, type ImageMedia, type Implies, type InViewOptions, type InfiniteListProps, type InfiniteLoad, type InfiniteLoadOptions, type InitialSelection, type InkColours, type InkMatch, type InkMatchState, type InputLevelProps, type InspectorProps, type InspectorSectionProps, type Job, type JobAction, type JobActionOptions, type JobFailure, type JobOptions, type JobProgress, type JobRow, type JobStatusProps, type JobWords, type JobsTableProps, type KeyCheck, KeysLegend, type LatLng, type LightboxItem, type LightboxProps, type LightboxUrl, LineChart, LineChartGroup, type LineChartGroupProps, type LineChartProps, type LinkCardProps, type ListeningLevelProps, type Load, type LoadFailure, type LoadMoreProps, type Loudness, type MarkKind, type MarkPattern, type MarkTone, type MarkableTextProps, type MediaContentsItem, type MediaContentsProps, type MediaElementOptions, type MediaElementState, type MediaHeading, type MediaMark, MediaPlayer, type MediaPlayerProps, type MediaProblem, type MediaProgress, type MediaSession, type MediaSource, type MediaSpanData, type MediaSpansState, MediaStage, type MediaStat, type MediaStats, type MediaWindow, type MenuEntry, type MenuProps, type MeterProps, type MeterThreshold, type MetricProps, type Microphone, MicrophoneContext, MicrophoneError, type MicrophoneStream, type More, type NativeSelectProps, type NavItem, type Nib, type NumberFieldProps, type NumberFormatter, type Outbox, type OutboxItem, type OutboxOptions, type OutboxRefusal, type OutboxRequest, type OutboxSnapshot, type OutboxStatusProps, PALETTE_STORAGE_KEY, type PageNames, type Pair, type PairAnswer, type PairJudgeProps, type PairVoteProps, type PairVoteSlot, type PairVoteWords, PaletteChoice, type PaletteOption, type PaletteState, type PaneProps, type PeakPair, type PendingRemoval, type Phase, type PictureBox, type PictureRegion, type PixelImageProps, type Pixels, type PlaceBoardProps, type PlaceState, type Platform, type PlayWindowButtonProps, PlayerNotice, type PlayerWarning, type PlayerWarningEvent, type Point, type Poll, type PopoverProps, type Precision, type Property, type PropertyListProps, type PropertyRowProps, type RangeProps, type RangeSliderProps, RateChoice, type ReadAlongPart, type ReadAlongProps, type ReadAloud, type ReadAloudOptions, type ReadPixels, type Rebinding, type Recorder, type RecorderState, type Recording, type Rect, type RectLimits, type Region, type RegionEditorProps, type RegionTone, type Reserve, type ReserveOptions, type ResumeWords, type Revealed, type Block as RichBlock, type Inline as RichInline, type RichTextProps, RowAction, type RowActionProps, type RowExpansion, type RowSelection, SPEECH_RATES, type SaveState, type SayAgainProps, type SayOnShowOptions, type SayPictureProps, type Saying, type ScheduleRow, type ScheduleTableProps, type SearchParam, type SearchParamOptions, type SecretFieldProps, type SecretTestResult, SeekBar, type SeekBarProps, type SeekBarSpan, type Segment, type Segmenter, type SegmenterOptions, type SelectableGridProps, type SequenceItem, type SequenceTimelineProps, type SetOptions, type ShareBox, type SharedCursor, type Shortcut, type ShortcutOverrides, type SkipAction, type SkipLevel, type SkipSteps, type SliderProps, type Sort, type SortableListProps, type SourceAttacher, SpanActions, type SpanActionsNotice, type SpanBehaviour, type SpanKind, type SpanOutcome, SpanStrip, type SpanTone, type SpanWords, type SpeakOptions, type Speech, type SpeechLevel, type SpeechPart, StageGuides, type StageState, type StageWords, type Stale, type StrataToastRegionProps, type StreamAttachment, type StreamContext, type StreamStats, type Stroke, type StrokeChange, type StrokeNoteWords, type StrokePoint, type StrokeShape, type SwitchProps, type SystemFact, type SystemFolder, type SystemInfoLike, type SystemPanelProps, type SystemService, type TabItem, type TakeLevelProps, type TextDifference, type TextLinkProps, type TextMedia, type TextSegment, ThemeProvider, type ThumbnailProps, type TileAspect, type TileGridProps, type TileSize, TimeReadout, type TimelineChange, type TimelineClock, type TimelineClockOptions, type TimelineDrop, type TimelineItem, type TimelineLane, type TimelineMarker, type TimelinePlayerProps, type TimelineProps, type ToastContentProps, type ToggleGroupProps, type ToggleOption, type ToggleProps, type Tone, type ToolChoice, type ToolbarProps, type TooltipProps, type TranscriptGroup, type TranscriptPhrase, type TranscriptPhraseState, type TranscriptSeek, type TranscriptViewProps, type TranscriptWord, Transport, type TransportProps, type TreeNodeState, type TreeProps, type TypedApi, type Undoable, type UndoableOptions, type UseAutoRecorderOptions, type UseRecorderOptions, type UseSpeechOptions, type VideoLoop, type VideoMedia, type VideoMode, type ViewGroup, type ViewGroupRows, type ViewOptionsConfig, type ViewOptionsProps, type ViewOptionsState, type ViewPointerOptions, type ViewSort, type Viewport, type ViewportFrameProps, type ViewportState, VolumeControl, type VolumeControlProps, type WaveformMark, type WaveformMarkKind, type WaveformPeaks, type WaveformProps, type WaveformSpan, type WaveformTone, type WorkContext, type WorkPhase, type WorkflowRunLike, type WorkflowRunOptions, type WorkflowStage, type WorkflowStepsProps, type WorkflowSummaryData, type WorkflowSummaryProps, type WorkflowSummaryState, type WorkflowSummaryWords, type WorkspaceBarProps, type WorkspaceState, type YScale, browserMicrophone, buttonVariants, colorSchemeScript, explainMicrophoneError, format$1 as format, geo, isTypingTarget, keyName, logScale, marksFor, mediaStatRows, paletteScript, palettes, readPixels$1 as readPixels, skipAction, transportShortcuts, useAsyncAction, useAttachedSource, useColorScheme, useHotkeys, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, usePalette, usePlayerWarnings, useSharedCursor, useSystemColorScheme, valueAt };
5992
+ export { type ActiveItem, type AlertDialogProps, type AlertProps, type Api, type ApiOptions, type ApiPage, type AspectRatio, type AsyncAction, type AsyncActionOptions, AsyncButton, type AsyncLabels, type AudioMedia, type AutoRecorder, type AutoRecorderState, type AutoSave, type AutoSaveOptions, type AutoTake, type BinaryByteUnit, type BookPage, type BookUrl, type BookViewerProps, type BoxListProps, type BoxOverlayProps, type BoxSource, type BoxTone, type BoxedPictureProps, type BoxesState, type Brush, type BrushControl, type BrushKind, Button, type ButtonLinkProps, type ButtonProps, type ByteHighlight, type ByteRange, type ByteUnit, type ByteViewProps, type BytesOptions, COLOR_SCHEME_STORAGE_KEY, type Candidate, type CellValue, type ChartMark, type ChartSpan, type CheckboxGesture, type CheckboxProps, type Choice, type ChoiceCounts, type ChoiceGridProps, type ChoiceGroupProps, type ChoiceMarks, type ChoiceSize, type ChoiceState, type Choices, type ClientWork, type Clips, type ClipsContext, type ClipsProviderProps, type ClockFaceProps, type ClockNumbers, type ColorFieldProps, type ColorScheme, ColorSchemeChoice, type ColorSchemeLabels, type ColorSchemePreference, type ColorSchemeState, type Column, type Command, type CommandMenuProps, type CommandsOptions, type CompareAudioProps, type CompareGridProps, type CompareMode, type CompareProps, type CompareTextProps, type CompareVideoGridProps, type CompareVideoProps, type ComposerProps, type CompositionBarProps, type CompositionPart, type ConcealedProps, type ConsoleLevel, type ConsoleLine, type ConsoleProps, type ContextMenuProps, type ControlSize, type ConversationImage, type ConversationProps, type ConversationTurn, type CountOptions, type CountdownOptions, type CurrencyOptions, type CursorMapping, type CursorOwner, CursorScope, type CursorScopeProps, type CutChange, type CutLimit, type CutRoom, DEFAULT_PALETTE, type DataTableProps, type DateFormatter, type DateInput, type DecodedAudio, type Delivery, Density, type DensityName, type DensityProps, type DescribeError, type DialogProps, type Difference, type DifferenceState, type DisclosureOpenProps, type DisclosureProps, type DragData, type DragSourceProps, type DrawTool, type Drawing, type Box as DrawingBox, type DrawingLayerProps, type DrawingOp, type DrawingOptions, type DrawingState, type DrawingToolbarProps, type DropTarget, type Easing, type EditClip, type EditListOptions, type EditListPlayerProps, type EditListSlot, type EditListState, type EditTimes, type EditableRegion, type EntityMatch, type EntityMatcher, type ErrorBody, type EventLogEntry, type EventLogImage, type EventLogProps, type Expanded, type ExpandedOptions, type FailedRemoval, type FetchJsonInit, type FetchJsonOptions, type FieldErrors, type FieldProps, type FileIntake, type FileIntakeOptions, type FileOutcome, type FilmFrame, type FilmStripProps, type Folder, type FolderListing, type FolderPickerProps, type Format, type FormatOptions, type FullscreenFrameProps, type GlimpseLook, type GlimpseProps, type GlimpseWhy, type Grid, type GroupMember, type GroupedChart, type Handle, type History, type HistoryOptions, type HistoryStateOptions, type HistoryStep, type HotkeysOptions, IconButton, type IconButtonProps, type IconComponent, type ImageMedia, type Implies, type InViewOptions, type InfiniteListProps, type InfiniteLoad, type InfiniteLoadOptions, type InitialSelection, type InkColours, type InkMatch, type InkMatchState, type InputLevelProps, type InspectorProps, type InspectorSectionProps, type Job, type JobAction, type JobActionOptions, type JobFailure, type JobOptions, type JobProgress, type JobRow, type JobStatusProps, type JobWords, type JobsTableProps, type KeyCheck, KeysLegend, type LatLng, type LightboxItem, type LightboxProps, type LightboxUrl, LineChart, LineChartGroup, type LineChartGroupProps, type LineChartProps, type LinkCardProps, type ListeningLevelProps, type Load, type LoadFailure, type LoadMoreProps, type Loudness, type MarkKind, type MarkPattern, type MarkTone, type MarkableTextProps, type MediaContentsItem, type MediaContentsProps, type MediaElementOptions, type MediaElementState, type MediaHeading, type MediaMark, MediaPlayer, type MediaPlayerProps, type MediaProblem, type MediaProgress, type MediaSession, type MediaSource, type MediaSpanData, type MediaSpansState, MediaStage, type MediaStat, type MediaStats, type MediaWindow, type MenuEntry, type MenuProps, type MeterProps, type MeterThreshold, type MetricProps, type Microphone, MicrophoneContext, MicrophoneError, type MicrophoneStream, type More, type NativeSelectProps, type NavItem, type Nib, type NumberFieldProps, type NumberFormatter, type Outbox, type OutboxItem, type OutboxOptions, type OutboxRefusal, type OutboxRequest, type OutboxSnapshot, type OutboxStatusProps, PALETTE_STORAGE_KEY, type PageNames, type Pair, type PairAnswer, type PairJudgeProps, type PairVoteProps, type PairVoteSlot, type PairVoteWords, PaletteChoice, type PaletteOption, type PaletteState, type PaneProps, type PeakPair, type PendingRemoval, type Phase, type PictureBox, type PictureRegion, type PixelImageProps, type Pixels, type PlaceBoardProps, type PlaceState, type Platform, type PlayWindowButtonProps, PlayerNotice, type PlayerWarning, type PlayerWarningEvent, type Point, type Poll, type PopoverProps, type Precision, type Property, type PropertyListProps, type PropertyRowProps, type RangeProps, type RangeSliderProps, RateChoice, type ReadAlongPart, type ReadAlongProps, type ReadAloud, type ReadAloudOptions, type ReadPixels, type Rebinding, type Recorder, type RecorderState, type Recording, type Rect, type RectLimits, type Region, type RegionEditorProps, type RegionTone, type Reserve, type ReserveOptions, type ResumeWords, type Revealed, type Block as RichBlock, type Inline as RichInline, type RichTextProps, RowAction, type RowActionProps, type RowExpansion, type RowSelection, SPEECH_RATES, type SaveState, type SayAgainProps, type SayOnShowOptions, type SayPictureProps, type Saying, type ScheduleRow, type ScheduleTableProps, type SearchParam, type SearchParamOptions, type SecretFieldProps, type SecretTestResult, SeekBar, type SeekBarProps, type SeekBarSpan, type Segment, type Segmenter, type SegmenterOptions, type SelectableGridProps, type SequenceItem, type SequenceTimelineProps, type SetOptions, type ShareBox, type SharedCursor, type Shortcut, type ShortcutOverrides, type SkipAction, type SkipLevel, type SkipSteps, type SliderProps, type Sort, type SortableListProps, type SourceAttacher, SpanActions, type SpanActionsNotice, type SpanBehaviour, type SpanKind, type SpanOutcome, SpanStrip, type SpanTone, type SpanWords, type SpeakOptions, type Speech, type SpeechLevel, type SpeechPart, StageGuides, type StageState, type StageWords, type Stale, type StrataToastRegionProps, type StreamAttachment, type StreamContext, type StreamStats, type Stroke, type StrokeChange, type StrokeNoteWords, type StrokePoint, type StrokeShape, type SwitchProps, type SystemFact, type SystemFolder, type SystemInfoLike, type SystemPanelProps, type SystemService, type TabItem, type TakeLevelProps, type TextDifference, type TextLinkProps, type TextMedia, type TextSegment, ThemeProvider, type ThumbnailProps, type TileAspect, type TileGridProps, type TileSize, TimeReadout, type TimelineChange, type TimelineClock, type TimelineClockOptions, type TimelineDrop, type TimelineItem, type TimelineLane, type TimelineMarker, type TimelinePlayerProps, type TimelineProps, type ToastContentProps, type ToggleGroupProps, type ToggleOption, type ToggleProps, type Tone, type ToolChoice, type ToolbarProps, type TooltipProps, type TranscriptGroup, type TranscriptPhrase, type TranscriptPhraseState, type TranscriptSeek, type TranscriptViewProps, type TranscriptWord, Transport, type TransportProps, type TreeNodeState, type TreeProps, type TypedApi, type Undoable, type UndoableOptions, type UseAutoRecorderOptions, type UseRecorderOptions, type UseSpeechOptions, type VideoLoop, type VideoMedia, type VideoMode, type ViewGroup, type ViewGroupRows, type ViewOptionsConfig, type ViewOptionsProps, type ViewOptionsState, type ViewPointerOptions, type ViewSort, type Viewport, type ViewportFrameProps, type ViewportState, VolumeControl, type VolumeControlProps, type WaveformMark, type WaveformMarkKind, type WaveformPeaks, type WaveformProps, type WaveformSpan, type WaveformTone, type WorkContext, type WorkPhase, type WorkflowRunLike, type WorkflowRunOptions, type WorkflowStage, type WorkflowStepsProps, type WorkflowSummaryData, type WorkflowSummaryProps, type WorkflowSummaryState, type WorkflowSummaryWords, type WorkspaceBarProps, type WorkspaceState, type YScale, browserMicrophone, buttonVariants, colorSchemeScript, explainMicrophoneError, format$1 as format, geo, isTypingTarget, keyName, logScale, marksFor, mediaStatRows, paletteScript, palettes, readPixels$1 as readPixels, skipAction, transportShortcuts, useAsyncAction, useAttachedSource, useColorScheme, useHotkeys, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, usePalette, usePlayerWarnings, useSharedCursor, useSystemColorScheme, valueAt };
5923
5993
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { i as typeSteps, n as KeyText, r as cn, t as Tooltip } from "./tooltip-BosfsWYh.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-BY42OY3g.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-S12YUQxn.js";
3
3
  import { a as isDev, i as buttonVariants, n as IconButton, o as useInView, r as RowAction, t as Button } from "./button-CjnotDTb.js";
4
4
  import { t as followAim } from "./follow-CXQsL86O.js";
5
5
  import { n as useViewPointers, r as useWheelZoom, t as useSettledStatus } from "./viewer-input-3Qa-o35k.js";
6
- 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-Db5o3SHZ.js";
7
- import { a as AsyncButton, c as ToolbarSeparator, d as keyName, f as useHotkeys, i as Slider, l as KeysLegend, n as NumberField, o as useAsyncAction, r as RangeSlider, s as Toolbar, t as ColorField, u as isTypingTarget } from "./value-controls-i1aGyO_3.js";
6
+ 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-Bt02Ky5u.js";
7
+ import { a as AsyncButton, c as ToolbarSeparator, d as keyName, f as useHotkeys, i as Slider, l as KeysLegend, n as NumberField, o as useAsyncAction, r as RangeSlider, s as Toolbar, t as ColorField, u as isTypingTarget } from "./value-controls-04bfBLdb.js";
8
8
  import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-Cwyvgwsw.js";
9
9
  import { a as fieldErrorsOf, i as errorPayload, n as describeActionError, o as readErrorBody, r as describeHttpError, t as HttpError } from "./errors-CmuwcWlb.js";
10
- 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-5Mb1ydlA.js";
10
+ 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-kCizTI4-.js";
11
11
  import * as React from "react";
12
12
  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";
13
13
  import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Brush, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsUp, CircleAlert, CircleCheck, CircleDashed, Clock, CloudOff, Columns2, Ellipsis, Eraser, Eye, EyeOff, FastForward, FileQuestion, Flag, Folder, FolderOpen, FolderX, GripVertical, Hand, Highlighter, ImageOff, Info, KeyRound, LayoutGrid, List, Loader, LoaderCircle, Lock, Maximize, Maximize2, Minimize, Minus, MousePointer2, Paintbrush, PanelBottomClose, PanelBottomOpen, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, PanelTopClose, PanelTopOpen, Pause, PenLine, Pencil, Play, Redo2, Rewind, RotateCcw, RotateCw, Scan, Search, Send, SkipBack, SkipForward, SlidersHorizontal, Square, StepBack, StepForward, Trash2, TriangleAlert, Undo2, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
@@ -2858,9 +2858,9 @@ function useChoices({ initial = [], implies, format: fmt = format } = {}) {
2858
2858
  };
2859
2859
  }
2860
2860
  /** The bar for a selection: a polite live count ("2 bookings selected"), the bulk actions, and Clear selection. Renders only the live region while nothing is chosen. */
2861
- function BulkBar({ count, noun, onClear, children, format: format$1 = format, className }) {
2861
+ function BulkBar({ count, noun, onClear, children, format: format$2 = format, className }) {
2862
2862
  const [one, many] = typeof noun === "string" ? [noun, `${noun}s`] : noun;
2863
- const label = `${format$1.count(count, one, many)} selected`;
2863
+ const label = `${format$2.count(count, one, many)} selected`;
2864
2864
  return /* @__PURE__ */ jsxs("div", {
2865
2865
  className: cn(count > 0 && "flex flex-wrap items-center gap-x-4 gap-y-2 rounded-surface bg-surface-sunken py-1.5 pr-1.5 pl-3", className),
2866
2866
  children: [/* @__PURE__ */ jsx("p", {
@@ -10440,6 +10440,102 @@ function Console({ label, lines, onCommand, complete, historyKey, height = 320,
10440
10440
  });
10441
10441
  }
10442
10442
 
10443
+ // src/components/event-log.tsx
10444
+ function formatPayload(payload) {
10445
+ if (typeof payload === "string") return payload;
10446
+ return JSON.stringify(payload, null, 2);
10447
+ }
10448
+ function EventBody({ payload, detail }) {
10449
+ return /* @__PURE__ */ jsxs("div", {
10450
+ className: "grid min-w-0 gap-2",
10451
+ children: [payload !== void 0 && /* @__PURE__ */ jsx("pre", {
10452
+ className: "overflow-x-auto rounded-control bg-muted p-2 font-mono type-body-sm text-foreground",
10453
+ children: formatPayload(payload)
10454
+ }), detail]
10455
+ });
10456
+ }
10457
+ function EventImages({ images }) {
10458
+ if (images.length === 0) return null;
10459
+ return /* @__PURE__ */ jsx("div", {
10460
+ className: "flex flex-wrap gap-3",
10461
+ children: images.map((img) => {
10462
+ const thumb = /* @__PURE__ */ jsx(Thumbnail, {
10463
+ src: img.src,
10464
+ alt: img.alt,
10465
+ aspect: img.aspect ?? "4/3",
10466
+ fit: "contain",
10467
+ missing: img.missing ?? "Image unavailable",
10468
+ className: "w-36 rounded-control border border-border bg-surface-sunken"
10469
+ });
10470
+ return img.href ? /* @__PURE__ */ jsx("a", {
10471
+ href: img.href,
10472
+ target: "_blank",
10473
+ rel: "noreferrer",
10474
+ className: "block rounded-control focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
10475
+ children: thumb
10476
+ }, `${img.src}-${img.alt}`) : /* @__PURE__ */ jsx("div", { children: thumb }, `${img.src}-${img.alt}`);
10477
+ })
10478
+ });
10479
+ }
10480
+ /** Ordered, structured event ledger for run histories, agent traces, and audit logs. */
10481
+ function EventLog({ entries, label = "Events", format: format$1 = format, collapsible = false, expanded, empty, className }) {
10482
+ if (entries.length === 0) return empty ? /* @__PURE__ */ jsx(Fragment, { children: empty }) : null;
10483
+ return /* @__PURE__ */ jsx("ol", {
10484
+ "aria-label": label,
10485
+ className: cn("grid min-w-0", className),
10486
+ children: entries.map((entry) => {
10487
+ const key = String(entry.id);
10488
+ const hasBody = entry.payload !== void 0 || entry.detail !== void 0;
10489
+ const header = /* @__PURE__ */ jsxs("div", {
10490
+ className: "flex flex-wrap items-baseline gap-x-3 gap-y-1 type-body-sm",
10491
+ children: [
10492
+ entry.seq !== void 0 && /* @__PURE__ */ jsxs("span", {
10493
+ className: "font-mono text-muted-foreground tabular-nums",
10494
+ children: ["#", entry.seq]
10495
+ }),
10496
+ /* @__PURE__ */ jsx("span", {
10497
+ className: "font-mono font-medium text-foreground",
10498
+ children: entry.kind
10499
+ }),
10500
+ entry.status && /* @__PURE__ */ jsx(Status, {
10501
+ tone: entry.tone ?? "neutral",
10502
+ children: entry.status
10503
+ }),
10504
+ entry.summary && /* @__PURE__ */ jsx("span", {
10505
+ className: "text-muted-foreground",
10506
+ children: entry.summary
10507
+ }),
10508
+ entry.at != null && /* @__PURE__ */ jsx("time", {
10509
+ className: "text-muted-foreground tabular-nums",
10510
+ children: format$1.dateTime(entry.at)
10511
+ })
10512
+ ]
10513
+ });
10514
+ return /* @__PURE__ */ jsxs("li", {
10515
+ className: "grid min-w-0 gap-2 border-b border-border py-3 last:border-b-0",
10516
+ children: [collapsible && hasBody ? expanded ? /* @__PURE__ */ jsx(Disclosure, {
10517
+ summary: header,
10518
+ open: expanded.isOpen(key),
10519
+ onOpenChange: (open) => expanded.setOpen(key, open),
10520
+ children: /* @__PURE__ */ jsx(EventBody, {
10521
+ payload: entry.payload,
10522
+ detail: entry.detail
10523
+ })
10524
+ }) : /* @__PURE__ */ jsx(Disclosure, {
10525
+ summary: header,
10526
+ children: /* @__PURE__ */ jsx(EventBody, {
10527
+ payload: entry.payload,
10528
+ detail: entry.detail
10529
+ })
10530
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [header, hasBody && /* @__PURE__ */ jsx(EventBody, {
10531
+ payload: entry.payload,
10532
+ detail: entry.detail
10533
+ })] }), entry.images && entry.images.length > 0 && /* @__PURE__ */ jsx(EventImages, { images: entry.images })]
10534
+ }, key);
10535
+ })
10536
+ });
10537
+ }
10538
+
10443
10539
  // src/components/shortcut-editor.tsx
10444
10540
  const idOf = (s) => s.id ?? s.label;
10445
10541
  const MODIFIER_KEYS = /* @__PURE__ */ new Set([
@@ -23695,5 +23791,5 @@ function ClockFace({ hours, minutes, label, numbers = "all", minuteMarks = true,
23695
23791
  });
23696
23792
  }
23697
23793
 
23698
- export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ClockFace, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, 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, RangeSlider, RateChoice, ReadAlong, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, 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, TimelinePlayer, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, applyOp, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, clockWords, cn, colorSchemeScript, commandShortcut, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, drawingToSvg, ease, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, inkMatch, inputLevelThresholds, invertOp, isDoubtful, isRefusal, isReservedChord, isSpeaking, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, moveGutter, movePoints, moveRect, newStrokeId, nextBreak, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, pointsBox, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, replay, resample, resamplePeaks, rescaleDrawing, resizeRect, rgbaToBlob, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, 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, useCountdown, useDifference, useDrawing, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useReadAloud, useRebindableShortcuts, useRecorder, useReserve, useRevealed, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeaking, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
23794
+ export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ClockFace, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, EventLog, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, 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, RangeSlider, RateChoice, ReadAlong, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, 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, TimelinePlayer, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, applyOp, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, clockWords, cn, colorSchemeScript, commandShortcut, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, drawingToSvg, ease, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, inkMatch, inputLevelThresholds, invertOp, isDoubtful, isRefusal, isReservedChord, isSpeaking, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, moveGutter, movePoints, moveRect, newStrokeId, nextBreak, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, pointsBox, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, replay, resample, resamplePeaks, rescaleDrawing, resizeRect, rgbaToBlob, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, 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, useCountdown, useDifference, useDrawing, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useReadAloud, useRebindableShortcuts, useRecorder, useReserve, useRevealed, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeaking, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
23699
23795
  //# sourceMappingURL=index.js.map