@magicx-eng/ai-autocomplete-vanilla 0.23.0 → 0.23.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 CHANGED
@@ -531,7 +531,7 @@ unsub();
531
531
 
532
532
  > **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.
533
533
 
534
- > **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, which keeps an `icon` that has no `icon_svg` as a legacy text prefix. 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.
534
+ > **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.
535
535
 
536
536
  ### State shape (`CoreState`)
537
537
 
@@ -736,7 +736,7 @@ Styles are auto-injected at runtime (Tier 1 and Tier 2). No CSS import needed. T
736
736
 
737
737
  Every class name the core emits is namespaced — `magicx-aia-*` (plus the bare `magicx-aia` root) and `aia-*` for the layout primitives — so nothing it renders can match a `.container`, `.pill` or `.dropdown` rule in your own stylesheet, and none of its rules can reach your elements.
738
738
 
739
- **Page CSS stops at the widget's edge.** Everything inside the input wrapper (`[data-aia-input-wrapper]`) and the dropdown (`[data-aia-dropdown]`) is reset to browser defaults before the SDK's own styles apply, so element and universal rules in your stylesheet — `button { … }`, `a { … }`, `* { … }`, a CSS reset, a framework's preflight — never reach it, and inherited typography adjustments from the page (line-height, letter-spacing, text-transform, text-align, …) are pinned at those two roots. Font family, size, weight and text colour still inherit from your page; a submit button you provide is left to your own stylesheet; and nothing the SDK ships styles elements outside its own subtree. The reset sits at specificity (0,0,5), below any rule that names a class, attribute or id — your overrides on the `data-aia-*` hooks work exactly as before, and so does a page rule like `.sidebar button { … }`, which names a class: scope rules like that to your own markup. For complete isolation, including rules like that, mount the widget in a shadow root — see [Shadow DOM](#shadow-dom).
739
+ **Page CSS stops at the widget's edge.** Everything inside the input wrapper (`[data-aia-input-wrapper]`) and the dropdown (`[data-aia-dropdown]`) is reset to browser defaults before the SDK's own styles apply, so element and universal rules in your stylesheet — `button { … }`, `a { … }`, `* { … }`, a CSS reset, a framework's preflight — never reach it, and inherited typography adjustments from the page (line-height, letter-spacing, text-transform, text-align, …) are pinned at those two roots. Font family, size, weight and text colour still inherit from your page; a submit button you provide is left to your own stylesheet; and nothing the SDK ships styles elements outside its own subtree. The SDK's inline icons are covered too: a page's `svg { display: block; max-width: 100%; margin: … }` or `svg { width: 100%; fill: currentColor }` leaves the submit arrow, the scroll chevron and the option icons as drawn. The reset sits at specificity (0,0,5), below any rule that names a class, attribute or id — your overrides on the `data-aia-*` hooks work exactly as before, and so does a page rule like `.sidebar button { … }`, which names a class: scope rules like that to your own markup. For complete isolation, including rules like that, mount the widget in a shadow root — see [Shadow DOM](#shadow-dom).
740
740
 
741
741
  ### Shadow DOM
742
742
 
@@ -791,10 +791,7 @@ Override these on the container element. The variables are declared with `:where
791
791
  | `--aia-product-bg` | `transparent` | `transparent` | Product card background. |
792
792
  | `--aia-product-bg-active` | `--aia-option-bg` | `--aia-option-bg` | Product card background on hover. |
793
793
  | `--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. |
794
- | `--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. |
795
794
  | `--aia-scroll-arrow-color` | `--aia-option-color` | `--aia-option-color` | Chevron color of the arrow (`--aia-scroll-arrow-color-hover` on hover). |
796
- | `--aia-scroll-arrow-border` | `--aia-dropdown-border` | `--aia-dropdown-border` | Hairline around the arrow. |
797
- | `--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. |
798
795
  | `--aia-placeholder-fade` | `120ms` | `120ms` | Fade-out of the outgoing placeholder phrase when the starting-state placeholder changes (the incoming one types itself in). |
799
796
  | `--aia-product-placeholder-image` | storefront pictogram | storefront pictogram | The image drawn on the placeholder tile when a product has no `imageUrl`: a two-tone storefront pictogram, inlined as a data URI. Set it to any `url(...)` to swap the pictogram; it is drawn centered and contained inside the tile, over `--aia-product-media-bg`. |
800
797
  | `--aia-product-title-color` | `--aia-option-color-selected` | `--aia-option-color-selected` | Product title text. Follows the option colors by default, so theming the panel moves suggestions and products together. |
package/dist/index.d.mts CHANGED
@@ -8,10 +8,9 @@ interface CompletedParam {
8
8
  interface SuggestionOption {
9
9
  text: string;
10
10
  /**
11
- * Icon for the option. When `icon_svg` is also set this is the icon's name
12
- * (an identifier such as `"apple"`, exposed on the row as `data-aia-icon`)
13
- * and the SVG is what renders. Without `icon_svg` it is legacy display text
14
- * (an emoji, say) drawn as a prefix to `text`.
11
+ * The icon's name an identifier such as `"apple"`, exposed on the row as
12
+ * `data-aia-icon` when its `icon_svg` draws. Never rendered as text: a row
13
+ * without a drawable `icon_svg` shows `text` alone.
15
14
  */
16
15
  icon?: string;
17
16
  /**
@@ -1587,9 +1586,11 @@ declare function scrollCaretIntoView(root: HTMLElement): void;
1587
1586
  */
1588
1587
  declare function sanitizeOptionIconSvg(markup: string): string | null;
1589
1588
  /**
1590
- * The text an option row shows. With `icon_svg` the icon draws as its own
1591
- * element and `icon` is just its name; without it, a legacy `icon` (an emoji
1592
- * from an option override, say) is display text prefixed to the option.
1589
+ * The text an option row shows: its `text`, alone. `icon` is the icon's name
1590
+ * (`"apple"`), an identifier for `data-aia-icon` and consumer CSS, never
1591
+ * display text so it is not prefixed to the option, whether `icon_svg`
1592
+ * came with it, failed to draw, or was switched off. A row whose icon cannot
1593
+ * draw shows the text by itself rather than the icon's name.
1593
1594
  */
1594
1595
  declare function optionLabel(option: {
1595
1596
  text: string;
@@ -1655,10 +1656,11 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
1655
1656
  /**
1656
1657
  * The "more below" arrow for the options grid.
1657
1658
  *
1658
- * When the option list is taller than its scroll box, a small round button
1659
- * with a down chevron sits at the bottom-centre of the list and scrolls it a
1660
- * page on click. It never moves — every appearance is an opacity fade in
1661
- * place, SCROLL_ARROW_FADE_MS long (the stylesheets own the curve):
1659
+ * When the option list is taller than its scroll box, a bare down chevron
1660
+ * sits at the bottom-centre of the list and scrolls it a page on click. It
1661
+ * never travels with the scroll — every appearance is an opacity fade in
1662
+ * place, SCROLL_ARROW_FADE_MS long, and its only motion is the stylesheets'
1663
+ * slow idle bob of a few pixels (the stylesheets own both curves):
1662
1664
  *
1663
1665
  * - At rest with more below (the list just opened, or scrolling has stopped
1664
1666
  * short of the end), it fades in.
@@ -1667,9 +1669,10 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
1667
1669
  * - Once scrolling has been quiet for SCROLL_ARROW_SCROLL_IDLE_MS it fades
1668
1670
  * back in — unless the list is now at its bottom, where it stays out.
1669
1671
  *
1670
- * Earlier versions rose from behind the footer and slid or shrank away; each
1671
- * read as the disc travelling with the scroll (2026-09-03/04), hence the
1672
- * fade-only rule. The stylesheets key everything off one attribute,
1672
+ * Earlier versions were a white disc that rose from behind the footer and
1673
+ * slid or shrank away; each read as the disc travelling with the scroll
1674
+ * (2026-09-03/04), hence the fade-only rule, and on 2026-09-05 the disc was
1675
+ * dropped for a plain chevron. The stylesheets key everything off one attribute,
1673
1676
  * `data-aia-visible`: present → opacity 1, absent → opacity 0, both
1674
1677
  * transitioned.
1675
1678
  *
package/dist/index.d.ts CHANGED
@@ -8,10 +8,9 @@ interface CompletedParam {
8
8
  interface SuggestionOption {
9
9
  text: string;
10
10
  /**
11
- * Icon for the option. When `icon_svg` is also set this is the icon's name
12
- * (an identifier such as `"apple"`, exposed on the row as `data-aia-icon`)
13
- * and the SVG is what renders. Without `icon_svg` it is legacy display text
14
- * (an emoji, say) drawn as a prefix to `text`.
11
+ * The icon's name an identifier such as `"apple"`, exposed on the row as
12
+ * `data-aia-icon` when its `icon_svg` draws. Never rendered as text: a row
13
+ * without a drawable `icon_svg` shows `text` alone.
15
14
  */
16
15
  icon?: string;
17
16
  /**
@@ -1587,9 +1586,11 @@ declare function scrollCaretIntoView(root: HTMLElement): void;
1587
1586
  */
1588
1587
  declare function sanitizeOptionIconSvg(markup: string): string | null;
1589
1588
  /**
1590
- * The text an option row shows. With `icon_svg` the icon draws as its own
1591
- * element and `icon` is just its name; without it, a legacy `icon` (an emoji
1592
- * from an option override, say) is display text prefixed to the option.
1589
+ * The text an option row shows: its `text`, alone. `icon` is the icon's name
1590
+ * (`"apple"`), an identifier for `data-aia-icon` and consumer CSS, never
1591
+ * display text so it is not prefixed to the option, whether `icon_svg`
1592
+ * came with it, failed to draw, or was switched off. A row whose icon cannot
1593
+ * draw shows the text by itself rather than the icon's name.
1593
1594
  */
1594
1595
  declare function optionLabel(option: {
1595
1596
  text: string;
@@ -1655,10 +1656,11 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
1655
1656
  /**
1656
1657
  * The "more below" arrow for the options grid.
1657
1658
  *
1658
- * When the option list is taller than its scroll box, a small round button
1659
- * with a down chevron sits at the bottom-centre of the list and scrolls it a
1660
- * page on click. It never moves — every appearance is an opacity fade in
1661
- * place, SCROLL_ARROW_FADE_MS long (the stylesheets own the curve):
1659
+ * When the option list is taller than its scroll box, a bare down chevron
1660
+ * sits at the bottom-centre of the list and scrolls it a page on click. It
1661
+ * never travels with the scroll — every appearance is an opacity fade in
1662
+ * place, SCROLL_ARROW_FADE_MS long, and its only motion is the stylesheets'
1663
+ * slow idle bob of a few pixels (the stylesheets own both curves):
1662
1664
  *
1663
1665
  * - At rest with more below (the list just opened, or scrolling has stopped
1664
1666
  * short of the end), it fades in.
@@ -1667,9 +1669,10 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
1667
1669
  * - Once scrolling has been quiet for SCROLL_ARROW_SCROLL_IDLE_MS it fades
1668
1670
  * back in — unless the list is now at its bottom, where it stays out.
1669
1671
  *
1670
- * Earlier versions rose from behind the footer and slid or shrank away; each
1671
- * read as the disc travelling with the scroll (2026-09-03/04), hence the
1672
- * fade-only rule. The stylesheets key everything off one attribute,
1672
+ * Earlier versions were a white disc that rose from behind the footer and
1673
+ * slid or shrank away; each read as the disc travelling with the scroll
1674
+ * (2026-09-03/04), hence the fade-only rule, and on 2026-09-05 the disc was
1675
+ * dropped for a plain chevron. The stylesheets key everything off one attribute,
1673
1676
  * `data-aia-visible`: present → opacity 1, absent → opacity 0, both
1674
1677
  * transitioned.
1675
1678
  *