@magicx-eng/ai-autocomplete-vanilla 0.18.0 → 0.19.1

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 CHANGED
@@ -14,7 +14,7 @@ A framework-agnostic vanilla JS/TypeScript library that provides a guided AI-pow
14
14
  - **Access token auth** — short-lived tokens with automatic refresh, single-flight deduplication, and 401 retry
15
15
  - **Keyboard navigation** — arrow keys, enter to submit, tab to autocomplete, backspace to un-bold the last completed param
16
16
  - **Client-side filtering** — instant substring filtering on every keystroke
17
- - **Datepicker** — date parameters are answered with a calendar instead of an option list. Click a day or navigate with the arrow keys; the date is committed the way it would be written — `Tuesday` for a date inside the next week, `March 23` for one later this year, `March 23 2027` for another year. Tapping a committed date re-opens the calendar on the month that text names now — for a weekday name, that is the next such day, not the one originally picked.
17
+ - **Datepicker** — date parameters are answered with a calendar instead of an option list. Click a day or navigate with the arrow keys; the date is committed the way it would be written — `Tuesday` for a date inside the next week, `March 23` for one later this year, `March 23 2027` for another year. Tapping a committed date re-opens the calendar on the month that text names now — for a weekday name, that is the next such day, not the one originally picked. A parameter whose options are written as spans (`September 11 - October 13`) gets the same calendar answered in two clicks, committed as one range.
18
18
  - **Option overrides** — supply the options for a parameter yourself: a fixed list, a computed one, or one fetched from your own search endpoint as the user types
19
19
  - **Product strip (opt-in)** — plug in any platform's product search and the dropdown renders a horizontal row of product cards below the options; the SDK owns the UI, your integration owns only `fetch` and `transform`
20
20
  - **Controlled & uncontrolled** — works out of the box or integrates with external state
@@ -344,6 +344,25 @@ say which, and phrases like `next friday`. Those still open the calendar, just
344
344
  on the current month with nothing marked, so the user picks rather than being
345
345
  shown a guess that might be wrong.
346
346
 
347
+ **Date ranges.** A parameter whose options are written as spans — `September 11
348
+ - October 13`, `September 11 to November 16` — is answered by the same calendar
349
+ in two clicks: the first sets the start, the second the end, and the pair
350
+ commits as one answer. The days between them band as the user moves across the
351
+ calendar, so the span being chosen is visible before it is committed. Paging the
352
+ month between the two clicks is expected — that is how a span crosses months —
353
+ and <kbd>Esc</kbd> drops the start and lets them begin again. Clicking the end
354
+ before the start is fine; the two are ordered on the way in.
355
+
356
+ The span is read off the options the same way a single date is read off its own:
357
+ either separator (`-`, `–`, `—`, `to`, `through`, `until`), either half in any
358
+ date format the SDK reads, and a name that says so (`date_range`, `dateRange`)
359
+ counts too. It commits as one parameter, written the way it was offered —
360
+ `September 11 - October 13`, with the year on whichever end needs it — and both
361
+ ends are also recorded on the completed parameter's `metadata` as `YYYY-MM-DD`,
362
+ under the `DATE_RANGE_META_START` / `DATE_RANGE_META_END` keys this package
363
+ exports (`aiaDateRangeStart` / `aiaDateRangeEnd`), so you never have to parse
364
+ the prose. Re-editing one re-opens the calendar with both ends marked.
365
+
347
366
  **Typing** while the calendar is open does not filter it. The text is treated as
348
367
  a new query, so suggestions refresh as the user types — useful when someone
349
368
  would rather describe what they want than pick a day.
@@ -435,7 +454,7 @@ unsub();
435
454
  > **Custom (rich-text) editors:** the wiring above assumes `myInput` is a `<textarea>`/`<input>`, whose caret the library reads directly. If you're driving a contentEditable or rich-text editor instead, also call `ac.handleCaretMove(offset)` on selection changes (with the caret as a plain-text offset) so arrow keys can move from the input into the dropdown.
436
455
 
437
456
 
438
- > **Datepicker in a custom UI.** For a date parameter, `state.activeFormatType` is `"date"` and `state.filteredOptions` holds that month's day cells. Each cell's `text` is the date it commits (`"March 23"`, or `"Tuesday"` inside the next week), so rendering them as a plain list already works — `selectOption(cell)` behaves exactly as it does for an option. To draw an actual calendar, read `state.dateView` for the month on show, `cellDay(cell)` for the number to paint, and call `showPreviousMonth()` / `showNextMonth()` to page. Cells that pad the start and end of the month have `is_tappable: false`.
457
+ > **Datepicker in a custom UI.** For a date parameter, `state.activeFormatType` is `"date"` and `state.filteredOptions` holds that month's day cells. Each cell's `text` is the date it commits (`"March 23"`, or `"Tuesday"` inside the next week), so rendering them as a plain list already works — `selectOption(cell)` behaves exactly as it does for an option. To draw an actual calendar, read `state.dateView` for the month on show, `cellDay(cell)` for the number to paint, and call `showPreviousMonth()` / `showNextMonth()` to page. Cells that pad the start and end of the month have `is_tappable: false`. For a **range** parameter `activeFormatType` is `"date-range"` and the same `selectOption(cell)` is called twice: the first records the start (`state.dateRangeStart` holds it, and nothing is committed yet), the second commits the span. `dateCellMarks` and `visibleDateRange` are exported to paint the two ends and the band between them the way the built-in calendars do.
439
458
  ### State shape (`CoreState`)
440
459
 
441
460
  | Field | Type | Description |
@@ -445,8 +464,9 @@ unsub();
445
464
  | `suggestions` | `Suggestion[]` | All suggestions from server (including placeholder type) |
446
465
  | `actionableSuggestions` | `Suggestion[]` | Non-placeholder suggestions (the pills) |
447
466
  | `filteredOptions` | `SuggestionOption[]` | Options for the active suggestion, filtered by current query. For a date parameter these are the visible month's day cells instead — each cell's `text` is the date it commits (`"March 23"`, or `"Tuesday"` inside the next week), and cells padding the start/end of the month have `is_tappable: false`. |
448
- | `activeFormatType` | `"options" \| "date"` | How the active parameter is answered: pick an option, or pick a date. `"date"` shows a calendar instead of the option list. Typing does not filter it — the text is treated as a new query. |
449
- | `dateView` | `DateMonthView \| null` | The month the calendar is showing (`{ year, month }`, 0-based month). Null unless `activeFormatType` is `"date"`. |
467
+ | `activeFormatType` | `"options" \| "date" \| "date-range"` | How the active parameter is answered: pick an option, pick a date, or pick a span of dates. Both date formats show a calendar instead of the option list; `"date-range"` takes two clicks, a start and an end. Typing does not filter it — the text is treated as a new query. |
468
+ | `dateView` | `DateMonthView \| null` | The month the calendar is showing (`{ year, month }`, 0-based month). Null unless `activeFormatType` is a calendar one. |
469
+ | `dateRangeStart` | `string \| null` | While a range is half-picked, the start already chosen, as `YYYY-MM-DD`. Null at every other moment, including for every non-range parameter. |
450
470
  | `segments` | `Segment[]` | Input text split into typed text vs completed params — completed segments render as bold `<strong>` runs inside the editor |
451
471
  | `placeholderText` | `string` | Placeholder text from server suggestions (joined `placeholder`-type suggestion texts) |
452
472
  | `activeDropdownIndex` | `number` | Highlighted option index (-1 = none) |
@@ -687,7 +707,7 @@ Override these on the container element. All built-in defaults use `:where()` (z
687
707
  | `--aia-product-bg` | `transparent` | `transparent` | Product card background. |
688
708
  | `--aia-product-bg-active` | `--aia-option-bg` | `--aia-option-bg` | Product card background on hover. |
689
709
  | `--aia-product-media-bg` | `--aia-skeleton-bg` | `--aia-skeleton-bg` | Fill behind the product image, and of the placeholder tile when a product has no image. |
690
- | `--aia-scroll-arrow-bg` | `--aia-surface` | `--aia-surface` | Fill of the "more below" arrow — the round button that rises at the bottom of the option list while there is more to scroll to. |
710
+ | `--aia-scroll-arrow-bg` | `--aia-surface` | `--aia-surface` | Fill of the "more below" arrow — the round button that fades in at the bottom of the option list while there is more to scroll to, and out while it scrolls. |
691
711
  | `--aia-scroll-arrow-color` | `--aia-option-color` | `--aia-option-color` | Chevron color of the arrow (`--aia-scroll-arrow-color-hover` on hover). |
692
712
  | `--aia-scroll-arrow-border` | `--aia-dropdown-border` | `--aia-dropdown-border` | Hairline around the arrow. |
693
713
  | `--aia-scroll-arrow-shadow` | `0 2px 8px rgba(0,0,0,0.12)` | `0 2px 8px rgba(0,0,0,0.12)` | Elevation of the arrow. |
@@ -710,6 +730,7 @@ Override these on the container element. All built-in defaults use `:where()` (z
710
730
  | `--aia-date-weekday-font-size` | `11px` | `11px` | Font size of the S/M/T/W/T/F/S column letters. |
711
731
  | `--aia-date-today-ring` | `--aia-option-color` | `--aia-option-color` | Outline drawn around today's date. |
712
732
  | `--aia-date-selected-bg` | white at 12% | white at 12% | Fill behind the date a re-edited parameter already holds. |
733
+ | `--aia-date-range-bg` | white at 6% | white at 6% | Band across the days between the two ends of a picked date range. The ends themselves use `--aia-date-selected-bg`. |
713
734
  | `--aia-skeleton-bg` | `rgba(189, 189, 189, 0.25)` | `#1a1b1d` | Fill color for the loading skeleton bars and the masked text in cached pills/options. |
714
735
 
715
736
  ### Per-mode Overrides
package/dist/index.d.mts CHANGED
@@ -299,6 +299,17 @@ declare function isoDate(d: Date): string;
299
299
  * - a different year: "March 23 2027".
300
300
  */
301
301
  declare function formatDate(d: Date): string;
302
+ /**
303
+ * A date written as month and day, with the year only when it isn't this one —
304
+ * {@link formatDate} without the weekday shorthand.
305
+ *
306
+ * The shorthand is what a range must not use. "Tuesday - Friday" names four
307
+ * possible spans depending on when it is read, and the two ends of a range are
308
+ * read against each other rather than against today, so the one thing the
309
+ * weekday form is good at — naming a day inside this week unambiguously —
310
+ * stops being true the moment it is half of a span. See `formatDateRange`.
311
+ */
312
+ declare function formatAbsoluteDate(d: Date): string;
302
313
  /**
303
314
  * Inverse of {@link formatDate}, for re-opening the calendar on the month a
304
315
  * completed date param already holds. Reads all three committed shapes — a
@@ -361,21 +372,29 @@ declare function cellDay(option: SuggestionOption | undefined): number | null;
361
372
  *
362
373
  * `"options"` is every suggestion the server has ever sent: pick one of its
363
374
  * options, or type to filter them. `"date"` ignores the options entirely and
364
- * renders a calendar instead.
375
+ * renders a calendar instead. `"date-range"` renders the same calendar,
376
+ * answered in two taps — a start and an end — and committed as one span.
365
377
  */
366
- type FormatType = "options" | "date";
378
+ type FormatType = "options" | "date" | "date-range";
379
+ /** Whether this format is answered by a calendar rather than by a list. */
380
+ declare function isCalendarFormat(format: FormatType): boolean;
367
381
  /**
368
382
  * Decide how a suggestion should be answered.
369
383
  *
370
- * The server cannot send a `formatType` yet, so a suggestion whose `type` names
371
- * a date is detected here by its name and rendered as a calendar with its
372
- * options ignored.
384
+ * The server cannot send a `formatType` yet, so a suggestion that holds a date
385
+ * is detected here by the options it offers, and failing that by its name
386
+ * and rendered as a calendar with those options ignored.
373
387
  *
374
- * That name check is deliberately the LAST resort. A `formatType` that *is* on
388
+ * The detection is deliberately the LAST resort. A `formatType` that *is* on
375
389
  * the wire always wins, so the day the server starts sending one this function
376
- * needs a single line deleted — the datepicker itself, and every gate that
390
+ * needs a single block deleted — the datepicker itself, and every gate that
377
391
  * consults this, keep working untouched.
378
392
  *
393
+ * Options are read before the name because they are the stronger evidence:
394
+ * they are the values themselves, while a name is what someone chose to call
395
+ * them. A parameter called `travel_date` whose options are all spans is a span
396
+ * parameter, whatever its name says.
397
+ *
379
398
  * Accepts anything with a `type`, not a `Suggestion`, so re-edit can ask the
380
399
  * same question about a completed param via its `suggestionType`.
381
400
  */
@@ -482,6 +501,25 @@ interface CoreInputState {
482
501
  dateViewMonth: (DateMonthView & {
483
502
  key: string;
484
503
  }) | null;
504
+ /**
505
+ * The first end of a range the user is part-way through picking, as
506
+ * `YYYY-MM-DD`, or null when no pick is in progress. Surfaces to readers as
507
+ * the derived `dateRangeStart`, the way `dateViewMonth` surfaces as
508
+ * `dateView`.
509
+ *
510
+ * Only meaningful while `activeFormatType` is `"date-range"`, where a date is
511
+ * answered in two taps. `key` names the parameter the pick belongs to (see
512
+ * `dateViewKey`), and unlike `dateViewMonth` a stale one is not merely
513
+ * ignored — it is cleared, by the invariant in `AIAutocomplete`'s
514
+ * constructor. Scoping alone would only HIDE it, and every key it can carry
515
+ * reproduces exactly later in a session: the same pill type re-suggested, the
516
+ * same param re-edited, the same span re-tapped. A resurrected start would
517
+ * then pair with an unrelated tap and commit a span nobody chose.
518
+ */
519
+ pendingRangeStart: {
520
+ iso: string;
521
+ key: string;
522
+ } | null;
485
523
  /**
486
524
  * Set while the user is picking a date for a span the server identified as
487
525
  * one — "september 5th" in "fly to vegas on september 5th".
@@ -511,6 +549,20 @@ interface CoreInputState {
511
549
  */
512
550
  text: string;
513
551
  iso: string | null;
552
+ /**
553
+ * The other end, when the span reads as a range ("september 11 to november
554
+ * 16") rather than as one day. Null for a single date, and null for a range
555
+ * whose text couldn't be read — which costs the pre-selection only.
556
+ */
557
+ isoEnd: string | null;
558
+ /**
559
+ * How this span is answered — a calendar, or a calendar in two taps.
560
+ *
561
+ * Resolved once when the picker opens and carried here rather than
562
+ * re-derived, because it depends on the span's own text (a `travel_date`
563
+ * written as a span is a range) and the derive layer only sees its type.
564
+ */
565
+ format: FormatType;
514
566
  } | null;
515
567
  }
516
568
  /**
@@ -523,8 +575,9 @@ interface CoreDerivedState {
523
575
  actionableSuggestions: Suggestion[];
524
576
  /**
525
577
  * What the dropdown renders. Options for the active pill, filtered by what
526
- * the user typed — EXCEPT when `activeFormatType` is `"date"`, where these
527
- * are the visible month's calendar cells and the server's own options for
578
+ * the user typed — EXCEPT when `activeFormatType` is a calendar one
579
+ * (`"date"` / `"date-range"`), where these are the visible month's calendar
580
+ * cells and the server's own options for
528
581
  * that suggestion are ignored. See {@link buildDateOptions}.
529
582
  */
530
583
  filteredOptions: SuggestionOption[];
@@ -536,8 +589,15 @@ interface CoreDerivedState {
536
589
  * exact-match gates in `fetchController`).
537
590
  */
538
591
  activeFormatType: FormatType;
539
- /** The month the datepicker is showing. Null unless `activeFormatType` is `"date"`. */
592
+ /** The month the datepicker is showing. Null unless `activeFormatType` is a calendar one. */
540
593
  dateView: DateMonthView | null;
594
+ /**
595
+ * The first end of a range already picked, as `YYYY-MM-DD`, while the user is
596
+ * choosing the second. Null whenever no pick is in progress — including for
597
+ * every non-range format, so a UI can read it without checking the format
598
+ * first. The calendars paint the span between it and the highlighted cell.
599
+ */
600
+ dateRangeStart: string | null;
541
601
  placeholderText: string;
542
602
  /**
543
603
  * The phrase the active pill's options are filtered by — what the user has
@@ -1018,6 +1078,149 @@ declare function resolveIdentifiedDate(param: {
1018
1078
  isoDate?: unknown;
1019
1079
  }, opts?: LooseDateOptions): string | null;
1020
1080
 
1081
+ /**
1082
+ * A span of days, both ends inclusive, as `YYYY-MM-DD`. `start <= end` always —
1083
+ * every producer here orders the two.
1084
+ */
1085
+ interface DateRange {
1086
+ start: string;
1087
+ end: string;
1088
+ }
1089
+ /**
1090
+ * What joins the two ends of a committed range.
1091
+ *
1092
+ * A spaced hyphen, because the committed text lands verbatim in the user's own
1093
+ * sentence and is what the server parses back. `parseLooseDateRange` reads far
1094
+ * more separators than this one — it has to, since it is also what reads a
1095
+ * server's option text and the user's own words — but the SDK only ever writes
1096
+ * this one.
1097
+ */
1098
+ declare const RANGE_SEPARATOR = " - ";
1099
+ /** Metadata key holding a committed range's start, as `YYYY-MM-DD`. */
1100
+ declare const DATE_RANGE_META_START = "aiaDateRangeStart";
1101
+ /** Metadata key holding a committed range's end, as `YYYY-MM-DD`. */
1102
+ declare const DATE_RANGE_META_END = "aiaDateRangeEnd";
1103
+ /**
1104
+ * Best-effort parse of a span of days written in the user's (or the server's)
1105
+ * own words — "September 11 - October 13", "September 11 to November 16",
1106
+ * "13/05/2026 - 20/05/2026".
1107
+ *
1108
+ * Each half goes through {@link parseLooseDate}, so a range reads exactly the
1109
+ * date formats a single date does, and refuses exactly what it refuses. Same
1110
+ * trade as everywhere in this corner of the SDK: **null is a normal outcome**.
1111
+ * It costs the range picker's pre-selection, or keeps a suggestion rendering as
1112
+ * a plain option list — never correctness.
1113
+ *
1114
+ * Refused on purpose:
1115
+ * - A backwards span ("October 13 - September 11"). Nothing here can tell a
1116
+ * typo from a year boundary the writer left implicit, and silently swapping
1117
+ * the ends would answer a question the user didn't ask.
1118
+ * - A shared-month shorthand ("September 11 - 13"). The right half alone is
1119
+ * not a date, and inferring the month from the left half is the kind of
1120
+ * guess this file exists not to make.
1121
+ * - Anything where two different splits both read as a range — the text is
1122
+ * then genuinely ambiguous about where its own separator is.
1123
+ *
1124
+ * A yearless half resolves the way {@link parseLooseDate} resolves one: to its
1125
+ * next occurrence. That is what makes "December 30 - January 5" read as the
1126
+ * turn of the year rather than as a backwards span.
1127
+ */
1128
+ declare function parseLooseDateRange(text: string | undefined | null, opts?: LooseDateOptions): DateRange | null;
1129
+ /**
1130
+ * The committed text for a range — "September 11 - October 13".
1131
+ *
1132
+ * Each end is written by {@link formatAbsoluteDate}, never by `formatDate`:
1133
+ * the weekday shorthand it would use for a nearby day ("Tuesday") names a
1134
+ * different date every week it is read, which a single answer can carry and a
1135
+ * span cannot.
1136
+ *
1137
+ * A span of one day commits as that day alone. "September 11 - September 11"
1138
+ * is not how anyone writes it, and the range is still recoverable from the
1139
+ * option's metadata when the answer is re-edited.
1140
+ */
1141
+ declare function formatDateRange(range: DateRange): string;
1142
+ /**
1143
+ * The range an already-answered param holds, so both its ends can be marked
1144
+ * when it is re-opened.
1145
+ *
1146
+ * Metadata first — it is what the SDK itself wrote, exact and free of the
1147
+ * yearless-date resolution the text form needs. Text second, which is what a
1148
+ * range that reached the input any other way (a server-identified span, a
1149
+ * consumer's controlled value) has.
1150
+ */
1151
+ declare function selectedRangeFor(param: {
1152
+ text?: string;
1153
+ metadata?: Record<string, unknown>;
1154
+ } | undefined | null, opts?: LooseDateOptions): DateRange | null;
1155
+
1156
+ /**
1157
+ * What a calendar paints as answered.
1158
+ *
1159
+ * Three fields rather than one because they answer three different questions,
1160
+ * and a range picker shows two of them at once: what is already committed
1161
+ * (`selectedIso` for a day, `selectedRange` for a span) and what the user is
1162
+ * half-way through picking (`rangeStart`). {@link visibleDateRange} folds the
1163
+ * last two into the span actually drawn.
1164
+ */
1165
+ interface DateSelection {
1166
+ /** `YYYY-MM-DD` a re-edited single-date param already holds, or null. */
1167
+ selectedIso: string | null;
1168
+ /** Both ends of a re-edited range param, or null. */
1169
+ selectedRange: DateRange | null;
1170
+ /** The first end of a range being picked right now, or null. */
1171
+ rangeStart: string | null;
1172
+ }
1173
+ /**
1174
+ * The calendar's selection, read off core state.
1175
+ *
1176
+ * Every package's dropdown needs exactly this, and computing it four times
1177
+ * over — vanilla Tier 1, vanilla Tier 2, the React hook, the Angular
1178
+ * controller — is how the four copies would come to disagree about which cells
1179
+ * a re-edited range fills. Typed structurally so each of them can hand it the
1180
+ * state object it already has.
1181
+ */
1182
+ declare function dateSelectionFor(state: {
1183
+ activeFormatType: FormatType;
1184
+ editingIdentified: {
1185
+ iso: string | null;
1186
+ isoEnd: string | null;
1187
+ } | null;
1188
+ editingParam: {
1189
+ text: string;
1190
+ metadata?: Record<string, unknown>;
1191
+ } | null;
1192
+ dateRangeStart: string | null;
1193
+ }): DateSelection;
1194
+ /**
1195
+ * The span the calendar should paint right now.
1196
+ *
1197
+ * While a first end is pending, that is the live span between it and whatever
1198
+ * the user is pointing at — the preview every range picker shows, which is also
1199
+ * what tells them the first tap registered. Otherwise it is the answer already
1200
+ * committed, if there is one.
1201
+ */
1202
+ declare function visibleDateRange(args: {
1203
+ pendingStart: string | null;
1204
+ highlightedIso: string | null;
1205
+ selected: DateRange | null;
1206
+ }): DateRange | null;
1207
+ /**
1208
+ * How one cell renders against the current selection: filled at either end of
1209
+ * the span, banded in between.
1210
+ *
1211
+ * Shared by all three packages' calendars so a range can't be painted three
1212
+ * subtly different ways. `selectedIso` is the single-date answer, which is
1213
+ * mutually exclusive with `range` in practice but costs nothing to fold in
1214
+ * here — it keeps every cell's appearance one function call at every call site.
1215
+ */
1216
+ declare function dateCellMarks(iso: string | null, args: {
1217
+ selectedIso: string | null;
1218
+ range: DateRange | null;
1219
+ }): {
1220
+ selected: boolean;
1221
+ inRange: boolean;
1222
+ };
1223
+
1021
1224
  /**
1022
1225
  * Entrance choreography for the dropdown's option rows.
1023
1226
  *
@@ -1114,19 +1317,15 @@ declare function needsOptionsGridMeasurement(count: number, isMobile: boolean):
1114
1317
  * The full layout decision, measurements included.
1115
1318
  *
1116
1319
  * Web, five-plus options: two columns of three visible rows — but only when
1117
- * every option provably fits on one line. Rows fill row-major (even indices
1118
- * left, odd right). The left track is exactly as wide as its widest option
1119
- * (a fixed pixel width from the measurement) and the right track takes the
1120
- * rest of the grid which is at least its own widest option, because
1121
- * `left + right <= gridWidth` is the fit check. So the second column starts
1122
- * right where the first column's longest text ends, and short options such as
1123
- * sizes sit beside each other. (Splitting the width in proportion to the two
1124
- * maxima, as this used to, handed ALL the slack out in that ratio too: one
1125
- * long option in the left column and "34"-length options on the right gave
1126
- * the left column ~85% of the box and pushed the right column to the far
1127
- * edge, 2026-09-03.) When the pair doesn't fit — or there are no usable
1128
- * measurements (SSR, hidden grid, loading skeletons) — the layout stays one
1129
- * scrollable column.
1320
+ * every option provably fits on one line in half the grid. Rows fill
1321
+ * row-major (even indices left, odd right) and the two columns are always the
1322
+ * same width, a plain 50/50 split, so the fit check is that the widest option
1323
+ * fits in half of `gridWidth`. Content-sized tracks were tried twice (split in
1324
+ * proportion to the column maxima, then left column to its content) and both
1325
+ * read as columns of "weird widths" (2026-09-04); an even split is what the
1326
+ * eye expects. When the widest option doesn't fit in half or there are no
1327
+ * usable measurements (SSR, hidden grid, loading skeletons) the layout stays
1328
+ * one scrollable column.
1130
1329
  *
1131
1330
  * `rowWidths` are single-line pixel widths of the rendered rows (see
1132
1331
  * `measureOptionsGrid`); `gridWidth` is the grid's content width.
@@ -1284,19 +1483,22 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
1284
1483
  * The "more below" arrow for the options grid.
1285
1484
  *
1286
1485
  * When the option list is taller than its scroll box, a small round button
1287
- * with a down chevron sits at the bottom-centre of the list. It slides up into
1288
- * view from behind the dropdown's lower edge (the footer, when the dropdown
1289
- * opens below the input) the moment there is more to scroll to, dissolves in
1290
- * place once the list is scrolled to its end, and scrolls the list a page on
1291
- * click. The entrance follows the reference (the RB2B support panel,
1292
- * 2026-08-19): a white 32 px disc that rises from behind the composer over
1293
- * ~150–180 ms, no fade. The exit deliberately does not mirror it sliding
1294
- * back down read as the disc "falling" into the footer (2026-09-03), so
1295
- * instead it fades out where it stands, with a slight shrink, over
1296
- * SCROLL_ARROW_LEAVE_MS. The stylesheets key the two moves off two attributes:
1297
- * `data-aia-visible` (rise, stay) and `data-aia-leaving` (dissolve), which
1298
- * this controller holds for the fade's length and then clears, so the disc
1299
- * re-parks below the edge invisibly ready to rise again.
1486
+ * with a down chevron sits at the bottom-centre of the list and scrolls it a
1487
+ * page on click. It never moves every appearance is an opacity fade in
1488
+ * place, SCROLL_ARROW_FADE_MS long (the stylesheets own the curve):
1489
+ *
1490
+ * - At rest with more below (the list just opened, or scrolling has stopped
1491
+ * short of the end), it fades in.
1492
+ * - The moment the list scrolls, it fades out, and stays out while scroll
1493
+ * events keep coming.
1494
+ * - Once scrolling has been quiet for SCROLL_ARROW_SCROLL_IDLE_MS it fades
1495
+ * back in unless the list is now at its bottom, where it stays out.
1496
+ *
1497
+ * Earlier versions rose from behind the footer and slid or shrank away; each
1498
+ * read as the disc travelling with the scroll (2026-09-03/04), hence the
1499
+ * fade-only rule. The stylesheets key everything off one attribute,
1500
+ * `data-aia-visible`: present → opacity 1, absent → opacity 0, both
1501
+ * transitioned.
1300
1502
  *
1301
1503
  * The DOM differs per package (vanilla builds the button here; React and
1302
1504
  * Angular render their own markup with the same classes and data attributes),
@@ -1317,18 +1519,22 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
1317
1519
  declare const SCROLL_ARROW_CLASS = "magicx-aia-scroll-arrow";
1318
1520
  /** Stable styling hook (module class names aren't part of the API). */
1319
1521
  declare const SCROLL_ARROW_ATTR = "data-aia-scroll-arrow";
1320
- /** Present on the button while it is shown. The stylesheets slide it in on this. */
1522
+ /**
1523
+ * Present on the button while it is shown. The stylesheets fade it in on this
1524
+ * and back out when it is removed.
1525
+ */
1321
1526
  declare const SCROLL_ARROW_VISIBLE_ATTR = "data-aia-visible";
1322
1527
  /**
1323
- * Present on the button while it fades out. The stylesheets dissolve it in
1324
- * place on this; the controller clears it after SCROLL_ARROW_LEAVE_MS.
1528
+ * Length of the fade, either way. Documents the `opacity` transition in each
1529
+ * package's stylesheet, which is what actually runs it change both together.
1325
1530
  */
1326
- declare const SCROLL_ARROW_LEAVING_ATTR = "data-aia-leaving";
1531
+ declare const SCROLL_ARROW_FADE_MS = 1000;
1327
1532
  /**
1328
- * Length of the fade-out. Mirrors the `[data-aia-leaving]` transition in each
1329
- * package's stylesheet change both together.
1533
+ * Quiet time after the last scroll event before the list counts as "stopped"
1534
+ * and the arrow may come back. Wheel and trackpad scrolls deliver events a
1535
+ * frame or so apart, so this only has to outlast a frame with some slack.
1330
1536
  */
1331
- declare const SCROLL_ARROW_LEAVE_MS = 240;
1537
+ declare const SCROLL_ARROW_SCROLL_IDLE_MS = 160;
1332
1538
  /** Inline custom property: how far the button's bottom edge sits above the dropdown's padding edge. */
1333
1539
  declare const SCROLL_ARROW_BOTTOM_VAR = "--aia-scroll-arrow-bottom";
1334
1540
  declare const SCROLL_ARROW_LABEL = "Scroll down for more options";
@@ -1338,7 +1544,7 @@ interface ScrollArrowController {
1338
1544
  destroy(): void;
1339
1545
  }
1340
1546
  interface ScrollArrowArgs {
1341
- /** The dropdown panel — the button's containing block; its lower edge clips the hidden button. */
1547
+ /** The dropdown panel — the button's containing block. */
1342
1548
  dropdown: HTMLElement;
1343
1549
  /** The options grid (the scroll box). */
1344
1550
  grid: HTMLElement;
@@ -1487,4 +1693,4 @@ interface SubmitResultExtras {
1487
1693
  */
1488
1694
  declare function buildSubmitResult(text: string, completedParams: CompletedParamState[], skippedParams?: SkippedParamState[], extras?: SubmitResultExtras): AutocompleteResult;
1489
1695
 
1490
- export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, type DateMonthView, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, type Product, type ProductsConfig, type RecentlySuggested, type RenderMode, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_LABEL, SCROLL_ARROW_LEAVE_MS, SCROLL_ARROW_LEAVING_ATTR, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type TaskKind, WEEKDAY_LABELS, addMonths, attachScrollArrow, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, computeOptionsGridLayout, createStore, cursorIsAtEnd, extractPlainText, formatDate, getCursorOffset, getFooterHint, identifiedParamLabel, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionEnterDelayMs, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, plainTextLength, planOptionsGrid, previousGraphemeBoundary, renderEditableContent, resolveFormatType, resolveIdentifiedDate, scrollCaretIntoView, selectedIsoFromText, setCursorOffset, toWireIdentifiedParams, withSkippedParams };
1696
+ export { AIAutocomplete, type APIConfig, type APIKeyConfig, ATTRIBUTION_URL, type AccessTokenConfig, type AccessTokenResult, type AppearanceMode, type AutocompleteRequest, type AutocompleteResponse, type AutocompleteResult, type CompletedParam, type CompletedParamState, type CoreOptions, type CoreState, DATE_RANGE_META_END, DATE_RANGE_META_START, type DateMonthView, type DateRange, type DateSelection, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, ModeController, OPTIONS_GRID_MOBILE_QUERY, OPTION_ENTER_DELAY_VAR, OPTION_ENTER_FADE_MS, OPTION_ENTER_RISE_MS, OPTION_ENTER_RISE_PX, OPTION_ENTER_STAGGER_MS, type OptionOverride, type OptionOverrides, type OptionsGridLayout, type OptionsGridPlan, PLACEHOLDER_FADE_OUT_MS, PLACEHOLDER_LEAVING_ATTR, PLACEHOLDER_SWAP_GAP_MS, PLACEHOLDER_TYPE_MS, PLACEHOLDER_WORD_PAUSE_MS, type Product, type ProductsConfig, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCROLL_ARROW_ATTR, SCROLL_ARROW_BOTTOM_VAR, SCROLL_ARROW_CLASS, SCROLL_ARROW_FADE_MS, SCROLL_ARROW_LABEL, SCROLL_ARROW_SCROLL_IDLE_MS, SCROLL_ARROW_VISIBLE_ATTR, SKIPPED_PARAM_TEXT, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type TaskKind, WEEKDAY_LABELS, addMonths, attachScrollArrow, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, computeOptionsGridLayout, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, getCursorOffset, getFooterHint, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionEnterDelayMs, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, renderEditableContent, resolveFormatType, resolveIdentifiedDate, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, toWireIdentifiedParams, visibleDateRange, withSkippedParams };