@magicx-eng/ai-autocomplete-vanilla 0.57.1 → 0.58.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 +66 -524
- package/REFERENCE.md +599 -0
- package/dist/index.d.mts +234 -17
- package/dist/index.d.ts +234 -17
- package/dist/index.js +321 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +321 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
package/dist/index.d.ts
CHANGED
|
@@ -67,15 +67,23 @@ interface SuggestionOption {
|
|
|
67
67
|
* tells apart options that read alike but answer different parameters.
|
|
68
68
|
*/
|
|
69
69
|
parameterLabel?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Set by the SDK, never the server, on the one option the phrase being typed
|
|
72
|
+
* is spelling out (its text starts with that phrase). The built-in rows light
|
|
73
|
+
* it and dim the rest, so the choice reads as locked in before the word ends.
|
|
74
|
+
*/
|
|
75
|
+
liveMatch?: boolean;
|
|
70
76
|
}
|
|
71
77
|
/**
|
|
72
78
|
* The value type of a parameter — which picker it needs. The server sends it
|
|
73
|
-
* for every date, date-range or
|
|
74
|
-
* answered from its options.
|
|
79
|
+
* for every date, date-range, time or location parameter; a parameter
|
|
80
|
+
* without one is answered from its options. A `location` parameter that comes
|
|
81
|
+
* with options is answered from them too; only one without options gets the
|
|
82
|
+
* location search field.
|
|
75
83
|
*/
|
|
76
84
|
interface SuggestionType {
|
|
77
85
|
/** `traditional_autocomplete` marks a suggestion whose options complete the word being typed; it is never a pill. */
|
|
78
|
-
kind: "string" | "numeric" | "date" | "date_range" | "time" | "multi_select" | "boolean" | "traditional_autocomplete";
|
|
86
|
+
kind: "string" | "numeric" | "date" | "date_range" | "time" | "multi_select" | "location" | "boolean" | "traditional_autocomplete";
|
|
79
87
|
/** How a date is written, e.g. "DD/MM/YYYY". */
|
|
80
88
|
date_format?: string;
|
|
81
89
|
/** What joins the two dates of a range, e.g. " to ". */
|
|
@@ -108,7 +116,8 @@ interface Suggestion {
|
|
|
108
116
|
interface InputItem {
|
|
109
117
|
parameter: string;
|
|
110
118
|
text: string;
|
|
111
|
-
|
|
119
|
+
/** "need_confirmation" = a value the user may still be typing. It shows no pill and joins the result only on submit. */
|
|
120
|
+
state: "completed" | "in_progress" | "need_confirmation";
|
|
112
121
|
/** Absent or "selected" = echo of client params; "identified" = LLM-inferred. */
|
|
113
122
|
source?: "selected" | "identified";
|
|
114
123
|
/**
|
|
@@ -129,6 +138,8 @@ interface IdentifiedParam {
|
|
|
129
138
|
interface RecentlySuggested {
|
|
130
139
|
parameter: string;
|
|
131
140
|
text: string;
|
|
141
|
+
/** Texts of the tappable options shown for this question. Omitted when none were shown. */
|
|
142
|
+
options?: string[];
|
|
132
143
|
}
|
|
133
144
|
/** Presentment currency context for suggestion requests. */
|
|
134
145
|
interface CurrencyOptions {
|
|
@@ -398,6 +409,12 @@ type Segment = {
|
|
|
398
409
|
type AppearanceMode = "light" | "dark" | "auto";
|
|
399
410
|
interface APIConfigBase {
|
|
400
411
|
endpoint?: string;
|
|
412
|
+
/**
|
|
413
|
+
* Where the location search lives. Defaults to the `endpoint`'s sibling
|
|
414
|
+
* `…/locations/autocomplete` (`/api/suggest` → `/api/locations/autocomplete`).
|
|
415
|
+
* Set it when `endpoint` points at a proxy with its own path.
|
|
416
|
+
*/
|
|
417
|
+
locationEndpoint?: string;
|
|
401
418
|
appIdentifier?: string;
|
|
402
419
|
headers?: Record<string, string>;
|
|
403
420
|
}
|
|
@@ -685,13 +702,17 @@ declare function cellDay(option: SuggestionOption | undefined): number | null;
|
|
|
685
702
|
* renders a calendar instead. `"date-range"` renders the same calendar,
|
|
686
703
|
* answered in two taps — a start and an end — and committed as one span.
|
|
687
704
|
* `"time"` ignores the options the same way and renders the time wheel.
|
|
705
|
+
* `"location"` is a location parameter that came with no options: it renders
|
|
706
|
+
* a search field over the server's location search. A location parameter
|
|
707
|
+
* that has options stays `"options"`.
|
|
688
708
|
*/
|
|
689
|
-
type FormatType = "options" | "date" | "date-range" | "time";
|
|
709
|
+
type FormatType = "options" | "date" | "date-range" | "time" | "location";
|
|
690
710
|
/** Whether this format is answered by a calendar rather than by a list. */
|
|
691
711
|
declare function isCalendarFormat(format: FormatType): boolean;
|
|
692
712
|
/**
|
|
693
|
-
* Whether this format is answered by a picker the SDK draws (a calendar
|
|
694
|
-
* time wheel) rather than by the suggestion's options.
|
|
713
|
+
* Whether this format is answered by a picker the SDK draws (a calendar, the
|
|
714
|
+
* time wheel or the location search) rather than by the suggestion's options.
|
|
715
|
+
* The server still sends
|
|
695
716
|
* options for such a pill, so anything that reasons about options — filtering,
|
|
696
717
|
* exact-match promotion, the request gates, telemetry — has to ask this first.
|
|
697
718
|
*/
|
|
@@ -708,12 +729,76 @@ declare function isPickerFormat(format: FormatType): boolean;
|
|
|
708
729
|
*
|
|
709
730
|
* Accepts anything with a `type`, not a `Suggestion`, so re-edit can ask the
|
|
710
731
|
* same question about a completed param via its `suggestionValueType`, and an
|
|
711
|
-
* identified span via its own `type`.
|
|
732
|
+
* identified span via its own `type`. Pass `options` too: a location
|
|
733
|
+
* parameter is only searched when it has none.
|
|
712
734
|
*/
|
|
713
735
|
declare function resolveFormatType(source: {
|
|
714
736
|
type?: SuggestionType;
|
|
737
|
+
options?: SuggestionOption[];
|
|
715
738
|
} | undefined | null): FormatType;
|
|
716
739
|
|
|
740
|
+
/**
|
|
741
|
+
* Metadata key that carries the provider's place ID on an answer picked from
|
|
742
|
+
* the location search, as `{ id }`. A typed answer (Enter with no result
|
|
743
|
+
* highlighted) carries none: it names no place the provider knows.
|
|
744
|
+
*/
|
|
745
|
+
declare const LOCATION_META_KEY = "aiaPlace";
|
|
746
|
+
/** Shortest phrase the location search sends; shorter ones list nothing. */
|
|
747
|
+
declare const LOCATION_MIN_QUERY = 2;
|
|
748
|
+
/** One place the location search returned. */
|
|
749
|
+
interface LocationPlace {
|
|
750
|
+
/** The provider's place ID. */
|
|
751
|
+
id: string;
|
|
752
|
+
/** What the place is called: "Seattle", "1600 Pennsylvania Ave NW". */
|
|
753
|
+
name: string;
|
|
754
|
+
/** Where it is: "WA, USA". Absent when the provider gave none. */
|
|
755
|
+
secondary?: string;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Where the location search stands for the active location pill.
|
|
759
|
+
*
|
|
760
|
+
* - `idle` — nothing to search yet (the phrase is shorter than
|
|
761
|
+
* `LOCATION_MIN_QUERY`).
|
|
762
|
+
* - `loading` — a search for `query` is pending or in flight.
|
|
763
|
+
* - `done` — `places` answers `query` (possibly empty).
|
|
764
|
+
* - `error` — the search failed; `places` is empty and Enter still answers
|
|
765
|
+
* with the typed text.
|
|
766
|
+
* - `unavailable` — no search: the server's location search route answered
|
|
767
|
+
* 404 (it has none), or the consumer set `locationSearch: false`. The field
|
|
768
|
+
* only takes typed text.
|
|
769
|
+
*/
|
|
770
|
+
type LocationStatus = "idle" | "loading" | "done" | "error" | "unavailable";
|
|
771
|
+
/**
|
|
772
|
+
* What a location pill's search field shows. Derived; null unless
|
|
773
|
+
* `activeFormatType` is `"location"`.
|
|
774
|
+
*/
|
|
775
|
+
interface LocationView {
|
|
776
|
+
/** The text in the search field. */
|
|
777
|
+
query: string;
|
|
778
|
+
places: LocationPlace[];
|
|
779
|
+
status: LocationStatus;
|
|
780
|
+
/** Index into `places` that Enter answers with, or -1 for the typed text. */
|
|
781
|
+
highlighted: number;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* How a picked place reads in the input: its name, then the first part of
|
|
785
|
+
* where it is, so two Portlands stay apart ("Portland, OR", "Portland, ME").
|
|
786
|
+
*/
|
|
787
|
+
declare function formatPlace(place: LocationPlace): string;
|
|
788
|
+
/**
|
|
789
|
+
* The option a location answer commits through `selectOption`: a picked place
|
|
790
|
+
* carries its ID in metadata; a typed answer is just its text.
|
|
791
|
+
*/
|
|
792
|
+
declare function buildLocationOption(answer: LocationPlace | string): SuggestionOption;
|
|
793
|
+
/**
|
|
794
|
+
* The location search endpoint for an API config: `apiConfig.locationEndpoint`
|
|
795
|
+
* when set, else the `/suggest` endpoint's sibling `/locations/autocomplete`.
|
|
796
|
+
* Null when the suggest endpoint doesn't end in `/suggest` (a consumer proxy
|
|
797
|
+
* with its own path) and no location endpoint was given — the field then only
|
|
798
|
+
* takes typed text.
|
|
799
|
+
*/
|
|
800
|
+
declare function locationEndpointFor(apiConfig?: APIConfig): string | null;
|
|
801
|
+
|
|
717
802
|
/**
|
|
718
803
|
* Time-of-day helpers for the time wheel.
|
|
719
804
|
*
|
|
@@ -831,6 +916,14 @@ interface CoreInputState {
|
|
|
831
916
|
* matches, so a fragment inside a word does not hold the request back.
|
|
832
917
|
*/
|
|
833
918
|
traditionalAutocomplete: boolean;
|
|
919
|
+
/**
|
|
920
|
+
* Whether the server's location search is reachable. True from the start:
|
|
921
|
+
* the SDK calls `…/locations/autocomplete` directly, with no signal needed
|
|
922
|
+
* from `/suggest`. Set false for the rest of this instance once that route
|
|
923
|
+
* answers 404 (a server without it), after which a location pill's search
|
|
924
|
+
* field only takes typed text.
|
|
925
|
+
*/
|
|
926
|
+
locationAutocomplete: boolean;
|
|
834
927
|
/**
|
|
835
928
|
* The catalog grounding report the latest applied response carried, or null
|
|
836
929
|
* when it carried none. Replaced wholesale per response, so it always
|
|
@@ -873,6 +966,14 @@ interface CoreInputState {
|
|
|
873
966
|
* See controllers/holdOpenController.ts.
|
|
874
967
|
*/
|
|
875
968
|
dropdownHeld: boolean;
|
|
969
|
+
/**
|
|
970
|
+
* The location pill's search field (inside the dropdown) holds focus, or is
|
|
971
|
+
* about to: set by the field on press and before it focuses itself, ahead
|
|
972
|
+
* of the main input's blur. Counts as focus for the dropdown's blur gate and
|
|
973
|
+
* for the `focus` / `blur` events, so moving into the field neither closes
|
|
974
|
+
* the panel nor tells the consumer the widget lost focus.
|
|
975
|
+
*/
|
|
976
|
+
locationFieldFocused: boolean;
|
|
876
977
|
/**
|
|
877
978
|
* Re-edit state: while non-null, the user is editing a bold completed param.
|
|
878
979
|
* The snapshot stays here even after the param is removed from
|
|
@@ -962,6 +1063,16 @@ interface CoreInputState {
|
|
|
962
1063
|
picked: string[];
|
|
963
1064
|
key: string;
|
|
964
1065
|
} | null;
|
|
1066
|
+
/**
|
|
1067
|
+
* The location search for the active location pill: what its field holds
|
|
1068
|
+
* and what the server answered. Surfaces to readers as the derived
|
|
1069
|
+
* `locationView`. `key` scopes it to the pill it was set for, exactly like
|
|
1070
|
+
* `dateViewMonth` (see `dateViewKey`): a stale key is ignored, so the next
|
|
1071
|
+
* location pill opens on an empty field.
|
|
1072
|
+
*/
|
|
1073
|
+
locationSearch: (LocationView & {
|
|
1074
|
+
key: string;
|
|
1075
|
+
}) | null;
|
|
965
1076
|
/**
|
|
966
1077
|
* Set while the user is picking a date for a span the server identified as
|
|
967
1078
|
* one — "september 5th" in "fly to vegas on september 5th".
|
|
@@ -1049,6 +1160,11 @@ interface CoreDerivedState {
|
|
|
1049
1160
|
multiSelectView: {
|
|
1050
1161
|
picked: string[];
|
|
1051
1162
|
} | null;
|
|
1163
|
+
/**
|
|
1164
|
+
* What the location search field shows. Null unless `activeFormatType` is
|
|
1165
|
+
* `"location"` (a location parameter that came with no options).
|
|
1166
|
+
*/
|
|
1167
|
+
locationView: LocationView | null;
|
|
1052
1168
|
placeholderText: string;
|
|
1053
1169
|
/**
|
|
1054
1170
|
* The phrase the active pill's options are filtered by — what the user has
|
|
@@ -1172,6 +1288,13 @@ interface CoreOptions {
|
|
|
1172
1288
|
closeDropdownOnBlur?: boolean;
|
|
1173
1289
|
/** When true (default), non-tappable options are rendered in the dropdown alongside tappable ones. Set to false to hide them entirely. */
|
|
1174
1290
|
showNonTappableOptions?: boolean;
|
|
1291
|
+
/**
|
|
1292
|
+
* When true (default), a location parameter without options searches the
|
|
1293
|
+
* server's location search (cities, addresses, landmarks) as the user types
|
|
1294
|
+
* in its field. Set to false to keep the field but take typed text only, so
|
|
1295
|
+
* nothing the user types is sent for a lookup.
|
|
1296
|
+
*/
|
|
1297
|
+
locationSearch?: boolean;
|
|
1175
1298
|
/** When true (default), an option that carries an `icon_svg` draws its icon before its text in the dropdown. Set to false to render option rows as text only. */
|
|
1176
1299
|
showOptionIcons?: boolean;
|
|
1177
1300
|
/** When true (default), a completed chip in the input draws the icon of the option that answered it. Set to false to render chips as text only. */
|
|
@@ -1329,6 +1452,33 @@ interface CoreOptions {
|
|
|
1329
1452
|
setCursor?: (offset: number) => void;
|
|
1330
1453
|
}
|
|
1331
1454
|
|
|
1455
|
+
/** How far past the checkbox's inner edge a tap still counts as "on the checkbox". */
|
|
1456
|
+
declare const MULTI_SELECT_TOGGLE_SLOP_PX = 10;
|
|
1457
|
+
/** The checkbox zone is never narrower than this, measured from the row's leading edge. */
|
|
1458
|
+
declare const MULTI_SELECT_TOGGLE_MIN_PX = 44;
|
|
1459
|
+
/** Passed with an option pick to say how a multi_select row was tapped. */
|
|
1460
|
+
interface SelectOptionOptions {
|
|
1461
|
+
/**
|
|
1462
|
+
* In a multi_select question: answer now with this option (plus any already
|
|
1463
|
+
* ticked) instead of only ticking it and waiting for Done. Ignored elsewhere.
|
|
1464
|
+
*/
|
|
1465
|
+
commit?: boolean;
|
|
1466
|
+
}
|
|
1467
|
+
/**
|
|
1468
|
+
* Whether a click on a multi_select row landed in its checkbox zone.
|
|
1469
|
+
*
|
|
1470
|
+
* A row has two halves. The leading strip, from the row's edge to just past
|
|
1471
|
+
* the checkbox, ticks or unticks the option and leaves the question open for
|
|
1472
|
+
* more ticks and Done. The rest of the row (icon, text, the space after it)
|
|
1473
|
+
* answers the question on the spot. A click with no pointer position (a key
|
|
1474
|
+
* press or assistive technology activating the row) always ticks: it has no
|
|
1475
|
+
* "where", and ticking is the choice that can be undone.
|
|
1476
|
+
*/
|
|
1477
|
+
declare function isMultiSelectToggleTap(row: Element, checkbox: Element | null, event: {
|
|
1478
|
+
clientX: number;
|
|
1479
|
+
detail?: number;
|
|
1480
|
+
}): boolean;
|
|
1481
|
+
|
|
1332
1482
|
type AIAutocompleteEvents = {
|
|
1333
1483
|
submit: [result: AutocompleteResult];
|
|
1334
1484
|
result: [result: AutocompleteResult];
|
|
@@ -1381,11 +1531,17 @@ declare class AIAutocomplete {
|
|
|
1381
1531
|
private openWordText;
|
|
1382
1532
|
/** Identified params held back until the word they end ends. */
|
|
1383
1533
|
private heldIdentified;
|
|
1534
|
+
/** Values waiting for confirmation. Only a submit of the same text admits them. */
|
|
1535
|
+
private waitingIdentified;
|
|
1384
1536
|
/** What the last `impression` showed, so an identical response doesn't resend it. */
|
|
1385
1537
|
private lastImpressionKey;
|
|
1386
1538
|
/** The server's `visible_impression`: send an impression only while the dropdown is visible. */
|
|
1387
1539
|
private visibleImpression;
|
|
1388
1540
|
private destroyed;
|
|
1541
|
+
/** The location search in flight, so a newer phrase or destroy() can cancel it. */
|
|
1542
|
+
private locationAbort;
|
|
1543
|
+
/** One provider session per location pill: every search for it, then the pick. */
|
|
1544
|
+
private locationSession;
|
|
1389
1545
|
private readonly emitSubmit;
|
|
1390
1546
|
private readonly emitError;
|
|
1391
1547
|
constructor(container: HTMLElement, opts?: CoreOptions);
|
|
@@ -1514,6 +1670,8 @@ declare class AIAutocomplete {
|
|
|
1514
1670
|
/**
|
|
1515
1671
|
* Call before you build a submit result from your own button.
|
|
1516
1672
|
* A typed word that equals exactly one completion candidate becomes a completed param, the same as Enter.
|
|
1673
|
+
* A typed value the response returned with no pill yet (`state: "need_confirmation"`) joins `identifiedParams` here, if the text has not changed since that response.
|
|
1674
|
+
* It is in no earlier state read, so a submit that skips this call leaves it out.
|
|
1517
1675
|
* Read the updated state with `getState()` to build the result.
|
|
1518
1676
|
*/
|
|
1519
1677
|
prepareSubmit(): void;
|
|
@@ -1567,9 +1725,34 @@ declare class AIAutocomplete {
|
|
|
1567
1725
|
toggleMultiSelectOption(option: SuggestionOption): void;
|
|
1568
1726
|
/** Complete the selected values, or skip the question when no values are selected. */
|
|
1569
1727
|
commitMultiSelect(): void;
|
|
1728
|
+
/**
|
|
1729
|
+
* Answer with `option` right away, together with anything already ticked.
|
|
1730
|
+
* What a tap on a row's text does; a tap on its checkbox only ticks.
|
|
1731
|
+
*/
|
|
1732
|
+
private answerMultiSelectWith;
|
|
1570
1733
|
private finishMultiSelect;
|
|
1571
1734
|
/** Answer the active time pill with the time on the wheel. */
|
|
1572
1735
|
commitTime(): void;
|
|
1736
|
+
/**
|
|
1737
|
+
* Set the text of the location search field. No-op unless a location pill
|
|
1738
|
+
* (a location parameter without options) is active. A phrase of at least
|
|
1739
|
+
* `LOCATION_MIN_QUERY` characters asks the server's location search after a
|
|
1740
|
+
* short pause; each new phrase cancels the search before it. The search
|
|
1741
|
+
* route is called directly: once it answers 404 (a server without it), the
|
|
1742
|
+
* field only takes typed text for the rest of this instance.
|
|
1743
|
+
*/
|
|
1744
|
+
setLocationQuery(query: string): void;
|
|
1745
|
+
/** Move the highlight through the location results (ArrowDown / ArrowUp in the field). */
|
|
1746
|
+
moveLocationHighlight(delta: number): void;
|
|
1747
|
+
/**
|
|
1748
|
+
* Answer the active location pill: with the place at `index` (a tapped
|
|
1749
|
+
* row), else the highlighted place, else the typed text as written. No-op
|
|
1750
|
+
* when there is neither a place nor any text. The answer goes through
|
|
1751
|
+
* `selectOption` like a tapped option — see `buildLocationOption`.
|
|
1752
|
+
*/
|
|
1753
|
+
commitLocation(index?: number): void;
|
|
1754
|
+
private runLocationSearch;
|
|
1755
|
+
private cancelLocationSearch;
|
|
1573
1756
|
/**
|
|
1574
1757
|
* Skip the currently active pill (always index 0 of the actionable
|
|
1575
1758
|
* suggestions) and promote the next pill to active. Invoked by ArrowRight at
|
|
@@ -1596,6 +1779,13 @@ declare class AIAutocomplete {
|
|
|
1596
1779
|
skipActivePill(): void;
|
|
1597
1780
|
handleKeyDown(e: KeyboardEvent): void;
|
|
1598
1781
|
setFocused(focused: boolean): void;
|
|
1782
|
+
/**
|
|
1783
|
+
* Report that the location search field holds focus (or is about to take
|
|
1784
|
+
* it). The renderers call this; a custom UI that draws its own location
|
|
1785
|
+
* field calls it the same way — before moving focus into the field, so the
|
|
1786
|
+
* input's blur doesn't close the panel. See `locationFieldFocused`.
|
|
1787
|
+
*/
|
|
1788
|
+
setLocationFieldFocused(focused: boolean): void;
|
|
1599
1789
|
/**
|
|
1600
1790
|
* Subscribe to state changes. Listener receives the full (input + derived) shape.
|
|
1601
1791
|
*
|
|
@@ -1633,7 +1823,7 @@ declare class AIAutocomplete {
|
|
|
1633
1823
|
*/
|
|
1634
1824
|
refreshProducts(): void;
|
|
1635
1825
|
update(opts: CoreUpdateOptions): void;
|
|
1636
|
-
selectOption(option: SuggestionOption): void;
|
|
1826
|
+
selectOption(option: SuggestionOption, how?: SelectOptionOptions): void;
|
|
1637
1827
|
private applyOption;
|
|
1638
1828
|
private startSelectionAnimationTimer;
|
|
1639
1829
|
private resolveVisitorId;
|
|
@@ -1932,8 +2122,9 @@ declare function dateCellMarks(iso: string | null, args: {
|
|
|
1932
2122
|
* When a new set of options lands, each row fades in while rising into place,
|
|
1933
2123
|
* and the rows start one after another from the input's side outward — the
|
|
1934
2124
|
* row nearest the input first. The reference (the RB2B support box's
|
|
1935
|
-
* suggestion bubbles, 2026-08-19)
|
|
1936
|
-
*
|
|
2125
|
+
* suggestion bubbles, 2026-08-19), retimed to the text-box motion spec
|
|
2126
|
+
* (2026-11): opacity 0→1 and a 7 px rise together over 340 ms on
|
|
2127
|
+
* cubic-bezier(.2,.8,.2,1), consecutive rows 40 ms apart.
|
|
1937
2128
|
*
|
|
1938
2129
|
* The per-row motion is CSS: the option's *content* rule in each package's
|
|
1939
2130
|
* stylesheet both fades and rises it. Neither half runs on the cell — the
|
|
@@ -1949,13 +2140,13 @@ declare function dateCellMarks(iso: string | null, args: {
|
|
|
1949
2140
|
* `OPTION_ENTER_FADE_MS` must match the durations declared in those rules.
|
|
1950
2141
|
*/
|
|
1951
2142
|
/** Gap between consecutive rows starting their entrance. */
|
|
1952
|
-
declare const OPTION_ENTER_STAGGER_MS =
|
|
2143
|
+
declare const OPTION_ENTER_STAGGER_MS = 40;
|
|
1953
2144
|
/** Duration of a row's opacity fade — mirrors the stylesheets' entrance rule. */
|
|
1954
|
-
declare const OPTION_ENTER_FADE_MS =
|
|
2145
|
+
declare const OPTION_ENTER_FADE_MS = 340;
|
|
1955
2146
|
/** Duration of a row's rise into place — mirrors the stylesheets' entrance rule. */
|
|
1956
|
-
declare const OPTION_ENTER_RISE_MS =
|
|
2147
|
+
declare const OPTION_ENTER_RISE_MS = 340;
|
|
1957
2148
|
/** Distance a row rises from, in CSS px — mirrors the stylesheets' entrance rule. */
|
|
1958
|
-
declare const OPTION_ENTER_RISE_PX =
|
|
2149
|
+
declare const OPTION_ENTER_RISE_PX = 7;
|
|
1959
2150
|
/** Inline custom property each option carries with its own start delay. */
|
|
1960
2151
|
declare const OPTION_ENTER_DELAY_VAR = "--aia-option-enter-delay";
|
|
1961
2152
|
/**
|
|
@@ -2150,6 +2341,29 @@ declare function cursorIsAtEnd(root: HTMLElement): boolean;
|
|
|
2150
2341
|
*/
|
|
2151
2342
|
declare function previousGraphemeBoundary(text: string, offset: number): number;
|
|
2152
2343
|
|
|
2344
|
+
/**
|
|
2345
|
+
* Animated growth for the editor box.
|
|
2346
|
+
*
|
|
2347
|
+
* A box sized by its content jumps when a line is added, and CSS cannot
|
|
2348
|
+
* transition `height: auto`. So the editor's height is set explicitly to its
|
|
2349
|
+
* content's height on every change, and the stylesheets transition `height`
|
|
2350
|
+
* (EDITOR_GROW_MS, cubic-bezier(.2,.8,.2,1)) — a new line opens smoothly
|
|
2351
|
+
* instead of popping in. The editor still clips and scrolls past its
|
|
2352
|
+
* `max-height` cap; the measurement respects that cap.
|
|
2353
|
+
*
|
|
2354
|
+
* Reduced motion and `animations: false` zero the transition in CSS, so the
|
|
2355
|
+
* height still tracks the content, just without the slide.
|
|
2356
|
+
*/
|
|
2357
|
+
/** Duration of the editor's height transition — mirrors the stylesheets. */
|
|
2358
|
+
declare const EDITOR_GROW_MS = 340;
|
|
2359
|
+
/**
|
|
2360
|
+
* Keeps `editor`'s explicit height equal to its content's height, measuring on
|
|
2361
|
+
* every content change and again EDITOR_GROW_MS later (a chip forming around a
|
|
2362
|
+
* word widens it over that long and can push a word onto the next line).
|
|
2363
|
+
* Returns a function that stops watching and hands the height back to CSS.
|
|
2364
|
+
*/
|
|
2365
|
+
declare function watchEditorHeight(editor: HTMLElement): () => void;
|
|
2366
|
+
|
|
2153
2367
|
/**
|
|
2154
2368
|
* A mouse wheel over the product strip scrolls it sideways.
|
|
2155
2369
|
*
|
|
@@ -2408,6 +2622,9 @@ declare const en: {
|
|
|
2408
2622
|
keepTyping: string;
|
|
2409
2623
|
done: string;
|
|
2410
2624
|
timeLabel: string;
|
|
2625
|
+
locationSearch: string;
|
|
2626
|
+
locationNoResults: string;
|
|
2627
|
+
locationUseTyped: string;
|
|
2411
2628
|
};
|
|
2412
2629
|
type UIStrings = typeof en;
|
|
2413
2630
|
declare function uiStringsFor(language?: string): UIStrings;
|
|
@@ -2445,7 +2662,7 @@ declare function uiStringsFor(language?: string): UIStrings;
|
|
|
2445
2662
|
* reserved fade band when there is one (below-mode with the footer), and
|
|
2446
2663
|
* floats a small gap above the grid's edge in layouts that zero the band
|
|
2447
2664
|
* (`optionsPosition="above"`). When a product strip follows the grid it
|
|
2448
|
-
* instead centres itself on the strip's "
|
|
2665
|
+
* instead centres itself on the strip's "Best match" label row — the label
|
|
2449
2666
|
* carries `data-aia-products-label` for this — so it sits on the seam
|
|
2450
2667
|
* between the two sections rather than over the last visible option row
|
|
2451
2668
|
* (2026-09-14, from the Shopify storefront). A new
|
|
@@ -2870,4 +3087,4 @@ declare const SMART_SUGGESTION_SPARKLE_SVG: string;
|
|
|
2870
3087
|
/** True when some pill is a question the shopper can decline. */
|
|
2871
3088
|
declare function hasSkippablePill(suggestions: Suggestion[]): boolean;
|
|
2872
3089
|
|
|
2873
|
-
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 CurrencyOptions, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, type LooseDateOptions, type MatchedItem, type MatchedItems, 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, OPTION_IMAGE_WIDTH, 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, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, 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, SMART_SUGGESTION_SPARKLE_SVG, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, TIME_META_KEY, TIME_STEP_MINUTES, TIME_WHEEL_COLUMNS, TIME_WHEEL_ROW_HEIGHT, type TaskKind, type TextPart, type TimeParts, type TimePeriod, type TimeView, type TimeWheelColumn, type TimeWheelRow, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, buildTimeOption, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, formatTime, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isPickerFormat, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, isoTime, keepCaretOnChip, labelTraditionalAutocomplete, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, parseTime, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|
|
3090
|
+
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 CurrencyOptions, type CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, type DateMonthView, type DateRange, type DateSelection, EDITOR_GROW_MS, type ExpressedFilter, type FilterOp, type FormatType, type IdentifiedParam, type IdentifiedParamState, type InputItem, LOCATION_META_KEY, LOCATION_MIN_QUERY, type LocationPlace, type LocationStatus, type LocationView, type LooseDateOptions, MULTI_SELECT_TOGGLE_MIN_PX, MULTI_SELECT_TOGGLE_SLOP_PX, type MatchedItem, type MatchedItems, 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, OPTION_IMAGE_WIDTH, 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, PRODUCT_IMAGE_WIDTH, PRODUCT_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type PhraseMatch, type Product, type ProductImageFallback, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, RANGE_SEPARATOR, type RecentlySuggested, type RenderMode, SCHEMA_VERSION, 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, SMART_SUGGESTION_SPARKLE_SVG, type ScrollArrowArgs, type ScrollArrowController, type Segment, type SelectOptionOptions, type SkippedParamState, type Store, type SubmitResultExtras, type Suggestion, type SuggestionOption, type SuggestionType, TIME_META_KEY, TIME_STEP_MINUTES, TIME_WHEEL_COLUMNS, TIME_WHEEL_ROW_HEIGHT, type TaskKind, type TextPart, type TimeParts, type TimePeriod, type TimeView, type TimeWheelColumn, type TimeWheelRow, type UIStrings, VIEWPORT_FIT_ATTR, VIEWPORT_FIT_HEIGHT_VAR, type ViewportFitArgs, type ViewportFitController, WEEKDAY_LABELS, addMonths, attachProductRowWheel, attachScrollArrow, attachViewportFit, buildAttributionUrl, buildDateOptions, buildLocationOption, buildQuery, buildSubmitResult, buildTimeOption, cellDay, cellIso, chipIdFromTap, computeOptionsGridLayout, containScroll, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, formatPlace, formatTime, getCursorOffset, getFooterHint, hasSkippablePill, highlightParts, identifiedParamLabel, isCalendarFormat, isMultiSelectToggleTap, isOptionsGridMobileViewport, isPickerFormat, isSmartSuggestion, isTraditionalAutocompleteSuggestion, isoDate, isoTime, keepCaretOnChip, labelTraditionalAutocomplete, locationEndpointFor, matchTypedPhrase, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, parseTime, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productImageSources, productImageSrc, productInitial, productPhotoFill, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, shopifyImageSrc, timeWheelIndex, timeWheelIndexFromScroll, timeWheelRows, toWireIdentifiedParams, typedFragment, uiStringsFor, visibleDateRange, watchEditorHeight, withSkippedParams, withTimeWheelIndex, withoutTraditionalAutocomplete };
|