@magicx-eng/ai-autocomplete-vanilla 0.25.1 → 0.26.0
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 +12 -0
- package/dist/index.d.mts +18 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.js +39 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -103,6 +103,9 @@ const ac = new AIAutocomplete(container, {
|
|
|
103
103
|
// Product strip. Shown by default from the items the /suggest response
|
|
104
104
|
// reports; false renders no strip.
|
|
105
105
|
showProducts: true,
|
|
106
|
+
// How the strip lays its cards out: a scrolling row, or "list" — the same
|
|
107
|
+
// cards stacked as full-width rows.
|
|
108
|
+
productsLayout: "row",
|
|
106
109
|
// Custom source for the strip. Omit it and the server's items are shown.
|
|
107
110
|
products: {
|
|
108
111
|
fetch: (query, signal) => myPlatform.search(query, { signal }),
|
|
@@ -189,6 +192,15 @@ exported for a hand-rolled strip that wants the same mapping.
|
|
|
189
192
|
Set `showProducts: false` to render no strip at all. The catalog report
|
|
190
193
|
(below) stays readable either way.
|
|
191
194
|
|
|
195
|
+
`productsLayout: "list"` stacks the same cards as full-width rows — thumbnail
|
|
196
|
+
on the left, title, vendor and price on the right — for results that read as
|
|
197
|
+
a list (courses, listings, documents) rather than products on a shelf. The
|
|
198
|
+
column scrolls vertically inside `--aia-product-list-max-height` (320px by
|
|
199
|
+
default); `--aia-product-list-media-size` (44px) sizes the thumbnail and
|
|
200
|
+
`--aia-product-list-gap` (2px) the space between rows. `"row"`, the default,
|
|
201
|
+
is the horizontal strip. `update({ productsLayout })` re-lays the strip out at
|
|
202
|
+
once.
|
|
203
|
+
|
|
192
204
|
#### The catalog report (`customFields`)
|
|
193
205
|
|
|
194
206
|
Every response that read the catalog also says what it did with the query, and
|
package/dist/index.d.mts
CHANGED
|
@@ -316,6 +316,13 @@ interface Product {
|
|
|
316
316
|
price?: string;
|
|
317
317
|
vendor?: string;
|
|
318
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* How the product strip lays its cards out. `"row"` is the horizontally
|
|
321
|
+
* scrolling shelf; `"list"` stacks the same cards as full-width rows —
|
|
322
|
+
* thumbnail on the left, text on the right — for results that read as a list
|
|
323
|
+
* (courses, listings, documents) rather than products on a shelf.
|
|
324
|
+
*/
|
|
325
|
+
type ProductsLayout = "row" | "list";
|
|
319
326
|
/**
|
|
320
327
|
* Custom product-search wiring for the strip. Absent (the default), the strip
|
|
321
328
|
* shows the items the `/suggest` response itself reports as matching the query
|
|
@@ -851,6 +858,16 @@ interface CoreOptions {
|
|
|
851
858
|
* request, since its search rides the suggest cadence.
|
|
852
859
|
*/
|
|
853
860
|
showProducts?: boolean;
|
|
861
|
+
/**
|
|
862
|
+
* How the product strip lays its cards out. `"row"` (the default) is a
|
|
863
|
+
* horizontally scrolling shelf of cards. `"list"` stacks the same cards as
|
|
864
|
+
* full-width rows — thumbnail on the left, title, vendor and price on the
|
|
865
|
+
* right — for results that read as a list (courses, listings, documents)
|
|
866
|
+
* rather than products on a shelf; the column scrolls vertically inside
|
|
867
|
+
* `--aia-product-list-max-height`. Changing it through `update()` re-lays
|
|
868
|
+
* the strip out at once.
|
|
869
|
+
*/
|
|
870
|
+
productsLayout?: ProductsLayout;
|
|
854
871
|
/**
|
|
855
872
|
* Custom source for the product strip. Omit it and the strip shows the items
|
|
856
873
|
* the `/suggest` response itself reports (`custom_fields.items`), with no
|
|
@@ -1978,4 +1995,4 @@ interface SubmitResultExtras {
|
|
|
1978
1995
|
*/
|
|
1979
1996
|
declare function buildSubmitResult(text: string, completedParams: CompletedParamState[], skippedParams?: SkippedParamState[], extras?: SubmitResultExtras): AutocompleteResult;
|
|
1980
1997
|
|
|
1981
|
-
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, 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, 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, getCursorOffset, getFooterHint, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionEnterDelayMs, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, toWireIdentifiedParams, visibleDateRange, withSkippedParams };
|
|
1998
|
+
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, 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, getCursorOffset, getFooterHint, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionEnterDelayMs, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, toWireIdentifiedParams, visibleDateRange, withSkippedParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -316,6 +316,13 @@ interface Product {
|
|
|
316
316
|
price?: string;
|
|
317
317
|
vendor?: string;
|
|
318
318
|
}
|
|
319
|
+
/**
|
|
320
|
+
* How the product strip lays its cards out. `"row"` is the horizontally
|
|
321
|
+
* scrolling shelf; `"list"` stacks the same cards as full-width rows —
|
|
322
|
+
* thumbnail on the left, text on the right — for results that read as a list
|
|
323
|
+
* (courses, listings, documents) rather than products on a shelf.
|
|
324
|
+
*/
|
|
325
|
+
type ProductsLayout = "row" | "list";
|
|
319
326
|
/**
|
|
320
327
|
* Custom product-search wiring for the strip. Absent (the default), the strip
|
|
321
328
|
* shows the items the `/suggest` response itself reports as matching the query
|
|
@@ -851,6 +858,16 @@ interface CoreOptions {
|
|
|
851
858
|
* request, since its search rides the suggest cadence.
|
|
852
859
|
*/
|
|
853
860
|
showProducts?: boolean;
|
|
861
|
+
/**
|
|
862
|
+
* How the product strip lays its cards out. `"row"` (the default) is a
|
|
863
|
+
* horizontally scrolling shelf of cards. `"list"` stacks the same cards as
|
|
864
|
+
* full-width rows — thumbnail on the left, title, vendor and price on the
|
|
865
|
+
* right — for results that read as a list (courses, listings, documents)
|
|
866
|
+
* rather than products on a shelf; the column scrolls vertically inside
|
|
867
|
+
* `--aia-product-list-max-height`. Changing it through `update()` re-lays
|
|
868
|
+
* the strip out at once.
|
|
869
|
+
*/
|
|
870
|
+
productsLayout?: ProductsLayout;
|
|
854
871
|
/**
|
|
855
872
|
* Custom source for the product strip. Omit it and the strip shows the items
|
|
856
873
|
* the `/suggest` response itself reports (`custom_fields.items`), with no
|
|
@@ -1978,4 +1995,4 @@ interface SubmitResultExtras {
|
|
|
1978
1995
|
*/
|
|
1979
1996
|
declare function buildSubmitResult(text: string, completedParams: CompletedParamState[], skippedParams?: SkippedParamState[], extras?: SubmitResultExtras): AutocompleteResult;
|
|
1980
1997
|
|
|
1981
|
-
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, 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, 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, getCursorOffset, getFooterHint, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionEnterDelayMs, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, toWireIdentifiedParams, visibleDateRange, withSkippedParams };
|
|
1998
|
+
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, 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, getCursorOffset, getFooterHint, identifiedParamLabel, isCalendarFormat, isOptionsGridMobileViewport, isoDate, measureOptionsGrid, monthLabel, needsOptionsGridMeasurement, optionEnterDelayMs, optionLabel, optionsEntranceDurationMs, optionsGridTemplateColumns, parseDate, parseLooseDate, parseLooseDateRange, plainTextLength, planOptionsGrid, previousGraphemeBoundary, productFromMatchedItem, productRowWheelTarget, productsFromCustomFields, renderEditableContent, resolveFormatType, resolveIdentifiedDate, sanitizeOptionIconSvg, scrollCaretIntoView, selectedIsoFromText, selectedRangeFor, setCursorOffset, toWireIdentifiedParams, visibleDateRange, withSkippedParams };
|