@magicx-eng/ai-autocomplete-vanilla 0.28.1 → 0.28.2
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 +2 -2
- package/dist/index.d.mts +74 -1
- package/dist/index.d.ts +74 -1
- package/dist/index.js +66 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +66 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -549,7 +549,7 @@ unsub();
|
|
|
549
549
|
|
|
550
550
|
> **Option icons.** An option may carry an icon: `icon_svg` is inline SVG markup and `icon` its name. The built-in dropdown draws the SVG before the option's text, in the text color, and hides it while the row shows its loading skeleton. When rendering options yourself, pass `icon_svg` through the exported `sanitizeOptionIconSvg` before inserting it — it reduces the markup to plain vector drawing and returns `null` for anything else — and use `optionLabel(option)` for the text — it is the option's `text` alone; `icon` is the icon's name and is never shown as text, even when `icon_svg` is missing or fails to draw. A picked option's `icon` / `icon_svg` are copied onto its completed parameter, and the chip in the input draws the glyph before its text. Both surfaces can be switched off: `showOptionIcons: false` renders option rows as text only and `showChipIcons: false` renders chips as text only; either way the icon element is omitted rather than hidden.
|
|
551
551
|
|
|
552
|
-
> **Option pictures and counts.** An option may also carry `image_url` — a picture of the best-matching catalog item offering it — and `item_count`, how many items offer it (each is present only when the server includes it; when it includes counts, the options also arrive ordered by them, most items first; a starting state carries pictures but no counts). The built-in dropdown draws the picture as a square thumbnail before the option's text (in place of its `icon_svg`, so a row never leads with two visuals) and the count as a muted label at the row's trailing edge (`"12 items"`); a skeleton row keeps the tile's placeholder fill and hides the count. The unit word after the number is a token: set `--aia-option-count-unit: "sneakers"` to name what is being counted, `--aia-option-count-unit-one: "sneaker"` for a count of 1 (it falls back to the plural token), or `--aia-option-count-unit: ""` for the number alone. When rendering options yourself, pass `image_url` through the exported `optionImageSrc` before using it as an `<img src>` — it returns the URL only when it is `http(s)` and `null` otherwise — and `formatOptionCount(option.item_count)` gives the number the built-in rows print (`null` when there is no count); `optionCountLabel(count, unit?)` appends a unit for a dropdown that prints the word itself (`"item"` / `"items"` by default; one word, a `{ one, other }` pair, or `""` for none). Both surfaces can be switched off: `showOptionImages: false` renders rows without pictures (an option's icon then draws instead) and `showOptionCounts: false` hides the counts. A picked option's `image_url` is copied onto its completed parameter too, and the chip in the input draws it as a small rounded tile before its text, in place of the icon; `showChipImages: false` renders chips without pictures (the icon then draws instead). The tile is sized by `--aia-option-image-size` (40px), rounded by `--aia-option-image-radius` (12px), spaced by `--aia-option-image-gap` (12px) and filled by `--aia-option-image-bg` while its picture loads; the count reads `--aia-option-count-font-size` (12px), `--aia-option-count-color` and `--aia-option-count-opacity` (0.6); the chip's tile reads `--aia-chip-image-size` (1.25em of the chip's font), `--aia-chip-image-radius` (4px) and `--aia-chip-image-bg
|
|
552
|
+
> **Option pictures and counts.** An option may also carry `image_url` — a picture of the best-matching catalog item offering it — and `item_count`, how many items offer it (each is present only when the server includes it; when it includes counts, the options also arrive ordered by them, most items first; a starting state carries pictures but no counts). The built-in dropdown draws the picture as a square thumbnail before the option's text (in place of its `icon_svg`, so a row never leads with two visuals) and the count as a muted label at the row's trailing edge (`"12 items"`); a skeleton row keeps the tile's placeholder fill and hides the count. The unit word after the number is a token: set `--aia-option-count-unit: "sneakers"` to name what is being counted, `--aia-option-count-unit-one: "sneaker"` for a count of 1 (it falls back to the plural token), or `--aia-option-count-unit: ""` for the number alone. When rendering options yourself, pass `image_url` through the exported `optionImageSrc` before using it as an `<img src>` — it returns the URL only when it is `http(s)` and `null` otherwise — and `formatOptionCount(option.item_count)` gives the number the built-in rows print (`null` when there is no count); `optionCountLabel(count, unit?)` appends a unit for a dropdown that prints the word itself (`"item"` / `"items"` by default; one word, a `{ one, other }` pair, or `""` for none). Both surfaces can be switched off: `showOptionImages: false` renders rows without pictures (an option's icon then draws instead) and `showOptionCounts: false` hides the counts. A picked option's `image_url` is copied onto its completed parameter too, and the chip in the input draws it as a small rounded tile before its text, in place of the icon; `showChipImages: false` renders chips without pictures (the icon then draws instead). The tile is sized by `--aia-option-image-size` (40px), rounded by `--aia-option-image-radius` (12px), spaced by `--aia-option-image-gap` (12px) and filled by `--aia-option-image-bg` (default: `--aia-skeleton-bg`) while its picture loads; the count reads `--aia-option-count-font-size` (12px), `--aia-option-count-color` and `--aia-option-count-opacity` (0.6); the chip's tile reads `--aia-chip-image-size` (1.25em of the chip's font), `--aia-chip-image-radius` (4px) and `--aia-chip-image-bg` (default: `--aia-skeleton-bg`).
|
|
553
553
|
|
|
554
554
|
### State shape (`CoreState`)
|
|
555
555
|
|
|
@@ -831,7 +831,7 @@ Override these on the container element. The variables are declared with `:where
|
|
|
831
831
|
| `--aia-date-today-ring` | `--aia-option-color` | `--aia-option-color` | Outline drawn around today's date. |
|
|
832
832
|
| `--aia-date-selected-bg` | white at 12% | white at 12% | Fill behind the date a re-edited parameter already holds. |
|
|
833
833
|
| `--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`. |
|
|
834
|
-
| `--aia-skeleton-bg` | `rgba(189, 189, 189, 0.
|
|
834
|
+
| `--aia-skeleton-bg` | `rgba(189, 189, 189, 0.083)` | `#1a1b1d` | Fill color for the loading skeleton bars and the masked text in cached pills/options, and of the option and chip image tiles while their picture loads (unless `--aia-option-image-bg` / `--aia-chip-image-bg` are set). |
|
|
835
835
|
|
|
836
836
|
### Per-mode Overrides
|
|
837
837
|
|
package/dist/index.d.mts
CHANGED
|
@@ -666,6 +666,27 @@ interface CoreInputState {
|
|
|
666
666
|
* Set by selectOption / ReEditManager.selectOption, cleared by a timer.
|
|
667
667
|
*/
|
|
668
668
|
inSelectionAnimation: boolean;
|
|
669
|
+
/**
|
|
670
|
+
* The options that were on screen when the user answered, held while the
|
|
671
|
+
* answer's request is in flight so the loading skeleton draws *those* rows —
|
|
672
|
+
* same count, same widths, same columns — instead of the next cached pill's.
|
|
673
|
+
* Display-only: the active suggestion is unaffected, so nothing can select
|
|
674
|
+
* from it. Null outside that window, and for a calendar answer (day cells
|
|
675
|
+
* have no skeleton form).
|
|
676
|
+
*/
|
|
677
|
+
skeletonOptions: SuggestionOption[] | null;
|
|
678
|
+
/**
|
|
679
|
+
* The question `skeletonOptions` were answering — the dropdown's active
|
|
680
|
+
* pill at pick time (or the pill being re-edited). See `dropdownSuggestion`.
|
|
681
|
+
*/
|
|
682
|
+
skeletonSuggestion: Suggestion | null;
|
|
683
|
+
/**
|
|
684
|
+
* Whether the answer's request has started since `skeletonOptions` was set.
|
|
685
|
+
* Lets the derive layer tell "the request settled" (fade the skeleton out)
|
|
686
|
+
* from "the request hasn't started yet" without a follow-up write — see
|
|
687
|
+
* `skeletonExiting`.
|
|
688
|
+
*/
|
|
689
|
+
skeletonRequested: boolean;
|
|
669
690
|
/**
|
|
670
691
|
* Which month the datepicker is showing, when one is showing at all.
|
|
671
692
|
*
|
|
@@ -790,6 +811,36 @@ interface CoreDerivedState {
|
|
|
790
811
|
* should treat it the same way. Never true for a pill without a source.
|
|
791
812
|
*/
|
|
792
813
|
isSearchingOptions: boolean;
|
|
814
|
+
/**
|
|
815
|
+
* Whether the dropdown draws its loading skeleton: a request in flight
|
|
816
|
+
* (outside re-edit and the post-answer press window), a consumer option
|
|
817
|
+
* source still answering, or the skeleton's fade-out. Every built-in
|
|
818
|
+
* dropdown reads this rather than `isLoading`.
|
|
819
|
+
*/
|
|
820
|
+
dropdownLoading: boolean;
|
|
821
|
+
/**
|
|
822
|
+
* True for the short fade-out after the answer's request settles, while the
|
|
823
|
+
* skeleton is still drawn from `skeletonOptions` and the dropdown carries
|
|
824
|
+
* `data-aia-skeleton-exiting`. Derived, so it switches on in the same state
|
|
825
|
+
* update that ends the loading — a renderer never sees a frame between the
|
|
826
|
+
* two.
|
|
827
|
+
*/
|
|
828
|
+
skeletonExiting: boolean;
|
|
829
|
+
/**
|
|
830
|
+
* The options the dropdown renders: `skeletonOptions` while that skeleton
|
|
831
|
+
* is drawn, otherwise `filteredOptions`. Rows are only interactive when
|
|
832
|
+
* `dropdownLoading` is false, and then this *is* `filteredOptions`.
|
|
833
|
+
*/
|
|
834
|
+
dropdownOptions: SuggestionOption[];
|
|
835
|
+
/**
|
|
836
|
+
* The question the dropdown's rows belong to while it draws the mirrored
|
|
837
|
+
* skeleton (`skeletonSuggestion`), else null — use the active pill. Renderers
|
|
838
|
+
* key rows by their question, so holding it steady keeps the skeleton rows
|
|
839
|
+
* mounted from the pick through the fade-out; letting it follow the active
|
|
840
|
+
* pill remounts them as the response lands, which replays their entrance
|
|
841
|
+
* and flashes the old option text.
|
|
842
|
+
*/
|
|
843
|
+
dropdownSuggestion: Suggestion | null;
|
|
793
844
|
isDropdownOpen: boolean;
|
|
794
845
|
/**
|
|
795
846
|
* Whether the active (leading) pill should render in its `selected` state
|
|
@@ -1192,6 +1243,15 @@ declare class AIAutocomplete {
|
|
|
1192
1243
|
/** Batched render subscriber — coalesces multiple store.set calls into one DOM update. */
|
|
1193
1244
|
private subscribeBatchedRender;
|
|
1194
1245
|
/** Auto-clear newParamId after shimmer animation. */
|
|
1246
|
+
/**
|
|
1247
|
+
* Tracks the answer's request for the skeleton mirror. When the request
|
|
1248
|
+
* starts, `skeletonRequested` records it (the skeleton is already showing,
|
|
1249
|
+
* so the extra write changes nothing on screen). When it settles, the
|
|
1250
|
+
* derived `skeletonExiting` is already true in that same state — this only
|
|
1251
|
+
* schedules the release after SKELETON_FADE_MS, or releases at once when the
|
|
1252
|
+
* response beat the press window and no skeleton was ever drawn.
|
|
1253
|
+
*/
|
|
1254
|
+
private subscribeSkeletonMirror;
|
|
1195
1255
|
private subscribeNewParamTimer;
|
|
1196
1256
|
private handleChange;
|
|
1197
1257
|
/**
|
|
@@ -1570,6 +1630,19 @@ declare function measureOptionsGrid(grid: HTMLElement): {
|
|
|
1570
1630
|
declare function optionsGridTemplateColumns(cols: number): string;
|
|
1571
1631
|
/** Whether the current viewport is phone-width. `false` when there's no DOM. */
|
|
1572
1632
|
declare function isOptionsGridMobileViewport(): boolean;
|
|
1633
|
+
/**
|
|
1634
|
+
* Whether two option lists draw the same rows (same texts, same order). A
|
|
1635
|
+
* grid that measured `measured` keeps that plan while `next` shows as a
|
|
1636
|
+
* loading skeleton: after an answer the skeleton mirrors the rows just on
|
|
1637
|
+
* screen (`CoreInputState.skeletonOptions`), so their measured columns still
|
|
1638
|
+
* describe it — re-planning would drop a two-column grid to the one-column
|
|
1639
|
+
* baseline under the user's eyes.
|
|
1640
|
+
*/
|
|
1641
|
+
declare function sameOptionRows(measured: readonly {
|
|
1642
|
+
text: string;
|
|
1643
|
+
}[] | null, next: readonly {
|
|
1644
|
+
text: string;
|
|
1645
|
+
}[]): boolean;
|
|
1573
1646
|
|
|
1574
1647
|
/**
|
|
1575
1648
|
* Plain-text caret utilities for contentEditable elements.
|
|
@@ -2093,4 +2166,4 @@ interface SubmitResultExtras {
|
|
|
2093
2166
|
*/
|
|
2094
2167
|
declare function buildSubmitResult(text: string, completedParams: CompletedParamState[], skippedParams?: SkippedParamState[], extras?: SubmitResultExtras): AutocompleteResult;
|
|
2095
2168
|
|
|
2096
|
-
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 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, 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_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type Product, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, 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, attachProductRowWheel, attachScrollArrow, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, computeOptionsGridLayout, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, toWireIdentifiedParams, visibleDateRange, withSkippedParams };
|
|
2169
|
+
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 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, 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_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type Product, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, 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, attachProductRowWheel, attachScrollArrow, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, computeOptionsGridLayout, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, toWireIdentifiedParams, visibleDateRange, withSkippedParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -666,6 +666,27 @@ interface CoreInputState {
|
|
|
666
666
|
* Set by selectOption / ReEditManager.selectOption, cleared by a timer.
|
|
667
667
|
*/
|
|
668
668
|
inSelectionAnimation: boolean;
|
|
669
|
+
/**
|
|
670
|
+
* The options that were on screen when the user answered, held while the
|
|
671
|
+
* answer's request is in flight so the loading skeleton draws *those* rows —
|
|
672
|
+
* same count, same widths, same columns — instead of the next cached pill's.
|
|
673
|
+
* Display-only: the active suggestion is unaffected, so nothing can select
|
|
674
|
+
* from it. Null outside that window, and for a calendar answer (day cells
|
|
675
|
+
* have no skeleton form).
|
|
676
|
+
*/
|
|
677
|
+
skeletonOptions: SuggestionOption[] | null;
|
|
678
|
+
/**
|
|
679
|
+
* The question `skeletonOptions` were answering — the dropdown's active
|
|
680
|
+
* pill at pick time (or the pill being re-edited). See `dropdownSuggestion`.
|
|
681
|
+
*/
|
|
682
|
+
skeletonSuggestion: Suggestion | null;
|
|
683
|
+
/**
|
|
684
|
+
* Whether the answer's request has started since `skeletonOptions` was set.
|
|
685
|
+
* Lets the derive layer tell "the request settled" (fade the skeleton out)
|
|
686
|
+
* from "the request hasn't started yet" without a follow-up write — see
|
|
687
|
+
* `skeletonExiting`.
|
|
688
|
+
*/
|
|
689
|
+
skeletonRequested: boolean;
|
|
669
690
|
/**
|
|
670
691
|
* Which month the datepicker is showing, when one is showing at all.
|
|
671
692
|
*
|
|
@@ -790,6 +811,36 @@ interface CoreDerivedState {
|
|
|
790
811
|
* should treat it the same way. Never true for a pill without a source.
|
|
791
812
|
*/
|
|
792
813
|
isSearchingOptions: boolean;
|
|
814
|
+
/**
|
|
815
|
+
* Whether the dropdown draws its loading skeleton: a request in flight
|
|
816
|
+
* (outside re-edit and the post-answer press window), a consumer option
|
|
817
|
+
* source still answering, or the skeleton's fade-out. Every built-in
|
|
818
|
+
* dropdown reads this rather than `isLoading`.
|
|
819
|
+
*/
|
|
820
|
+
dropdownLoading: boolean;
|
|
821
|
+
/**
|
|
822
|
+
* True for the short fade-out after the answer's request settles, while the
|
|
823
|
+
* skeleton is still drawn from `skeletonOptions` and the dropdown carries
|
|
824
|
+
* `data-aia-skeleton-exiting`. Derived, so it switches on in the same state
|
|
825
|
+
* update that ends the loading — a renderer never sees a frame between the
|
|
826
|
+
* two.
|
|
827
|
+
*/
|
|
828
|
+
skeletonExiting: boolean;
|
|
829
|
+
/**
|
|
830
|
+
* The options the dropdown renders: `skeletonOptions` while that skeleton
|
|
831
|
+
* is drawn, otherwise `filteredOptions`. Rows are only interactive when
|
|
832
|
+
* `dropdownLoading` is false, and then this *is* `filteredOptions`.
|
|
833
|
+
*/
|
|
834
|
+
dropdownOptions: SuggestionOption[];
|
|
835
|
+
/**
|
|
836
|
+
* The question the dropdown's rows belong to while it draws the mirrored
|
|
837
|
+
* skeleton (`skeletonSuggestion`), else null — use the active pill. Renderers
|
|
838
|
+
* key rows by their question, so holding it steady keeps the skeleton rows
|
|
839
|
+
* mounted from the pick through the fade-out; letting it follow the active
|
|
840
|
+
* pill remounts them as the response lands, which replays their entrance
|
|
841
|
+
* and flashes the old option text.
|
|
842
|
+
*/
|
|
843
|
+
dropdownSuggestion: Suggestion | null;
|
|
793
844
|
isDropdownOpen: boolean;
|
|
794
845
|
/**
|
|
795
846
|
* Whether the active (leading) pill should render in its `selected` state
|
|
@@ -1192,6 +1243,15 @@ declare class AIAutocomplete {
|
|
|
1192
1243
|
/** Batched render subscriber — coalesces multiple store.set calls into one DOM update. */
|
|
1193
1244
|
private subscribeBatchedRender;
|
|
1194
1245
|
/** Auto-clear newParamId after shimmer animation. */
|
|
1246
|
+
/**
|
|
1247
|
+
* Tracks the answer's request for the skeleton mirror. When the request
|
|
1248
|
+
* starts, `skeletonRequested` records it (the skeleton is already showing,
|
|
1249
|
+
* so the extra write changes nothing on screen). When it settles, the
|
|
1250
|
+
* derived `skeletonExiting` is already true in that same state — this only
|
|
1251
|
+
* schedules the release after SKELETON_FADE_MS, or releases at once when the
|
|
1252
|
+
* response beat the press window and no skeleton was ever drawn.
|
|
1253
|
+
*/
|
|
1254
|
+
private subscribeSkeletonMirror;
|
|
1195
1255
|
private subscribeNewParamTimer;
|
|
1196
1256
|
private handleChange;
|
|
1197
1257
|
/**
|
|
@@ -1570,6 +1630,19 @@ declare function measureOptionsGrid(grid: HTMLElement): {
|
|
|
1570
1630
|
declare function optionsGridTemplateColumns(cols: number): string;
|
|
1571
1631
|
/** Whether the current viewport is phone-width. `false` when there's no DOM. */
|
|
1572
1632
|
declare function isOptionsGridMobileViewport(): boolean;
|
|
1633
|
+
/**
|
|
1634
|
+
* Whether two option lists draw the same rows (same texts, same order). A
|
|
1635
|
+
* grid that measured `measured` keeps that plan while `next` shows as a
|
|
1636
|
+
* loading skeleton: after an answer the skeleton mirrors the rows just on
|
|
1637
|
+
* screen (`CoreInputState.skeletonOptions`), so their measured columns still
|
|
1638
|
+
* describe it — re-planning would drop a two-column grid to the one-column
|
|
1639
|
+
* baseline under the user's eyes.
|
|
1640
|
+
*/
|
|
1641
|
+
declare function sameOptionRows(measured: readonly {
|
|
1642
|
+
text: string;
|
|
1643
|
+
}[] | null, next: readonly {
|
|
1644
|
+
text: string;
|
|
1645
|
+
}[]): boolean;
|
|
1573
1646
|
|
|
1574
1647
|
/**
|
|
1575
1648
|
* Plain-text caret utilities for contentEditable elements.
|
|
@@ -2093,4 +2166,4 @@ interface SubmitResultExtras {
|
|
|
2093
2166
|
*/
|
|
2094
2167
|
declare function buildSubmitResult(text: string, completedParams: CompletedParamState[], skippedParams?: SkippedParamState[], extras?: SubmitResultExtras): AutocompleteResult;
|
|
2095
2168
|
|
|
2096
|
-
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 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, 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_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type Product, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, 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, attachProductRowWheel, attachScrollArrow, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, computeOptionsGridLayout, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, toWireIdentifiedParams, visibleDateRange, withSkippedParams };
|
|
2169
|
+
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 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, 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_PATH_PREFIX, PRODUCT_ROW_PX_PER_LINE, type Product, type ProductRowMetrics, type ProductRowWheel, type ProductsConfig, type ProductsLayout, 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, attachProductRowWheel, attachScrollArrow, buildAttributionUrl, buildDateOptions, buildQuery, buildSubmitResult, cellDay, cellIso, computeOptionsGridLayout, createStore, cursorIsAtEnd, dateCellMarks, dateSelectionFor, extractPlainText, formatAbsoluteDate, formatDate, formatDateRange, formatOptionCount, getCursorOffset, getFooterHint, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionCountLabel, optionEnterDelayMs, optionHasImage, optionImageSrc, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sameOptionRows, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, toWireIdentifiedParams, visibleDateRange, withSkippedParams };
|