@magicx-eng/ai-autocomplete-vanilla 0.23.3 → 0.24.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 +7 -5
- package/dist/index.d.mts +22 -6
- package/dist/index.d.ts +22 -6
- package/dist/index.js +52 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -178,11 +178,12 @@ new AIAutocomplete(container, {
|
|
|
178
178
|
|
|
179
179
|
Each server item becomes a `Product` with `id` (the item's stable id), `title`,
|
|
180
180
|
`price` (the item's lowest price, verbatim as the catalog spells it — the
|
|
181
|
-
currency is yours to add), `vendor`, `imageUrl`, and a
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
currency is yours to add), `vendor`, `imageUrl`, and a `url`: the item's own
|
|
182
|
+
`item_url` when the uploaded catalog named one (absolute or root-relative;
|
|
183
|
+
anything else is ignored), else a **relative** `/products/{handle}` — the right
|
|
184
|
+
link for a Shopify widget running on the storefront itself. An item with
|
|
185
|
+
neither gets no `url`: its card is still activatable and still emits
|
|
186
|
+
`onProductSelect`, it just has nothing for cmd-click to open. `productFromMatchedItem` / `productsFromCustomFields` are
|
|
186
187
|
exported for a hand-rolled strip that wants the same mapping.
|
|
187
188
|
|
|
188
189
|
Set `showProducts: false` to render no strip at all. The catalog report
|
|
@@ -781,6 +782,7 @@ Override these on the container element. The variables are declared with `:where
|
|
|
781
782
|
| `--aia-border` | `rgba(17, 24, 39, 0.14)` | `#505050` | Input container border color |
|
|
782
783
|
| `--aia-shadow` | `inset 0 1px 0 rgba(255,255,255,0.9), 0 1px 2px rgba(16,24,40,0.1), 0 8px 24px rgba(16,24,40,0.16)` | `inset 0 1px 0 rgba(255,255,255,0.06), 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.5)` | Input container elevation (box-shadow) |
|
|
783
784
|
| `--aia-dropdown-offset` | `13px` | `13px` | Gap between the input box and the dropdown (the dropdown's margin toward the input). |
|
|
785
|
+
| `--aia-content-inset-left` | `16px` | `16px` | Left inset of the SDK's content: the input wrapper's left padding, and the line the dropdown's content (parameter label, option text, product strip) starts on. Set it when you pad the field to clear a leading icon of your own, so the dropdown's content stays aligned under the typed text. Practical minimum is `10px` (the option text's own inset); both surfaces floor it there. |
|
|
784
786
|
| `--aia-footer-gap` | `8px` | `8px` | Breathing room above the dropdown footer (badge / keyboard hints), additive to the dropdown's 8px section gap. |
|
|
785
787
|
| `--aia-footer-chip-bg` | `--aia-surface` at 65% | `--aia-surface` at 65% | Fill behind the footer's keyboard hint and AI-Autocomplete badge. The option list scrolls under the footer, so this keeps both legible over the row passing behind them. `transparent` on the glass surface. |
|
|
786
788
|
| `--aia-dropdown-bg` | — | — | Optional bg color the dropdown's "glass" rim shadow tints toward. Set this to the page background behind the dropdown so the bottom-corner glow blends seamlessly. |
|
package/dist/index.d.mts
CHANGED
|
@@ -118,6 +118,13 @@ interface MatchedItem {
|
|
|
118
118
|
*/
|
|
119
119
|
handle?: string;
|
|
120
120
|
image_url?: string;
|
|
121
|
+
/**
|
|
122
|
+
* The item's own page, as the merchant's catalog upload named it — absolute
|
|
123
|
+
* (`https://…`) or storefront-relative (`/menu/pizza`). Set on uploaded
|
|
124
|
+
* catalogs, where there is no platform slug to build a link from; a Shopify
|
|
125
|
+
* item carries `handle` instead. When both are present the strip links here.
|
|
126
|
+
*/
|
|
127
|
+
item_url?: string;
|
|
121
128
|
}
|
|
122
129
|
/** The items the applied filters left standing. */
|
|
123
130
|
interface MatchedItems {
|
|
@@ -1375,8 +1382,11 @@ declare function dateCellMarks(iso: string | null, args: {
|
|
|
1375
1382
|
* suggestion bubbles, 2026-08-19): opacity 0→1 over ~150 ms, a ~16 px rise
|
|
1376
1383
|
* easing out over ~280 ms, consecutive rows ~80–110 ms apart.
|
|
1377
1384
|
*
|
|
1378
|
-
* The per-row motion is CSS
|
|
1379
|
-
*
|
|
1385
|
+
* The per-row motion is CSS: the option rule in each package's stylesheet
|
|
1386
|
+
* fades the cell, and the option's content rule rises it — the rise is on the
|
|
1387
|
+
* inner content, not the cell, because a transformed cell extends the grid's
|
|
1388
|
+
* scrollable area and flashed a scrollbar through the entrance (keep the three
|
|
1389
|
+
* copies identical; the parity test compares them). This module
|
|
1380
1390
|
* owns the *timing numbers* and the per-row delay, so vanilla, React and
|
|
1381
1391
|
* Angular can't drift onto three different cascades. `OPTION_ENTER_RISE_MS` and
|
|
1382
1392
|
* `OPTION_ENTER_FADE_MS` must match the durations declared in those rules.
|
|
@@ -1682,10 +1692,14 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
|
|
|
1682
1692
|
* its dropdown, grid and button elements:
|
|
1683
1693
|
*
|
|
1684
1694
|
* - `update()` after every render — re-measures where the grid's bottom edge
|
|
1685
|
-
* is and re-evaluates visibility. The
|
|
1695
|
+
* is and re-evaluates visibility. The chevron seats itself in the grid's
|
|
1686
1696
|
* reserved fade band when there is one (below-mode with the footer), and
|
|
1687
1697
|
* floats a small gap above the grid's edge in layouts that zero the band
|
|
1688
|
-
* (`optionsPosition="above"
|
|
1698
|
+
* (`optionsPosition="above"`). When a product strip follows the grid it
|
|
1699
|
+
* instead centres itself on the strip's "Products" label row — the label
|
|
1700
|
+
* carries `data-aia-products-label` for this — so it sits on the seam
|
|
1701
|
+
* between the two sections rather than over the last visible option row
|
|
1702
|
+
* (2026-09-14, from the Shopify storefront). A new
|
|
1689
1703
|
* option group (`data-aia-group` on the grid changed) keeps the arrow hidden
|
|
1690
1704
|
* until the rows' entrance animation has settled, because a row mid-rise
|
|
1691
1705
|
* still extends the scrollable area and would flash the arrow on.
|
|
@@ -1808,8 +1822,10 @@ declare const PRODUCT_PATH_PREFIX = "/products/";
|
|
|
1808
1822
|
* shape. Pure, so a Tier 3 consumer rendering its own strip from
|
|
1809
1823
|
* `customFields` gets the same cards the built-in one draws.
|
|
1810
1824
|
*
|
|
1811
|
-
*
|
|
1812
|
-
*
|
|
1825
|
+
* The link is the item's own `item_url` when the catalog named one, else the
|
|
1826
|
+
* `/products/{handle}` path a Shopify item implies. An item with neither
|
|
1827
|
+
* yields a card without a `url`: still activatable, still emitting
|
|
1828
|
+
* `onProductSelect`, just nothing for cmd-click to open.
|
|
1813
1829
|
*/
|
|
1814
1830
|
declare function productFromMatchedItem(item: MatchedItem): Product;
|
|
1815
1831
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -118,6 +118,13 @@ interface MatchedItem {
|
|
|
118
118
|
*/
|
|
119
119
|
handle?: string;
|
|
120
120
|
image_url?: string;
|
|
121
|
+
/**
|
|
122
|
+
* The item's own page, as the merchant's catalog upload named it — absolute
|
|
123
|
+
* (`https://…`) or storefront-relative (`/menu/pizza`). Set on uploaded
|
|
124
|
+
* catalogs, where there is no platform slug to build a link from; a Shopify
|
|
125
|
+
* item carries `handle` instead. When both are present the strip links here.
|
|
126
|
+
*/
|
|
127
|
+
item_url?: string;
|
|
121
128
|
}
|
|
122
129
|
/** The items the applied filters left standing. */
|
|
123
130
|
interface MatchedItems {
|
|
@@ -1375,8 +1382,11 @@ declare function dateCellMarks(iso: string | null, args: {
|
|
|
1375
1382
|
* suggestion bubbles, 2026-08-19): opacity 0→1 over ~150 ms, a ~16 px rise
|
|
1376
1383
|
* easing out over ~280 ms, consecutive rows ~80–110 ms apart.
|
|
1377
1384
|
*
|
|
1378
|
-
* The per-row motion is CSS
|
|
1379
|
-
*
|
|
1385
|
+
* The per-row motion is CSS: the option rule in each package's stylesheet
|
|
1386
|
+
* fades the cell, and the option's content rule rises it — the rise is on the
|
|
1387
|
+
* inner content, not the cell, because a transformed cell extends the grid's
|
|
1388
|
+
* scrollable area and flashed a scrollbar through the entrance (keep the three
|
|
1389
|
+
* copies identical; the parity test compares them). This module
|
|
1380
1390
|
* owns the *timing numbers* and the per-row delay, so vanilla, React and
|
|
1381
1391
|
* Angular can't drift onto three different cascades. `OPTION_ENTER_RISE_MS` and
|
|
1382
1392
|
* `OPTION_ENTER_FADE_MS` must match the durations declared in those rules.
|
|
@@ -1682,10 +1692,14 @@ declare function renderEditableContent(args: RenderEditableArgs): void;
|
|
|
1682
1692
|
* its dropdown, grid and button elements:
|
|
1683
1693
|
*
|
|
1684
1694
|
* - `update()` after every render — re-measures where the grid's bottom edge
|
|
1685
|
-
* is and re-evaluates visibility. The
|
|
1695
|
+
* is and re-evaluates visibility. The chevron seats itself in the grid's
|
|
1686
1696
|
* reserved fade band when there is one (below-mode with the footer), and
|
|
1687
1697
|
* floats a small gap above the grid's edge in layouts that zero the band
|
|
1688
|
-
* (`optionsPosition="above"
|
|
1698
|
+
* (`optionsPosition="above"`). When a product strip follows the grid it
|
|
1699
|
+
* instead centres itself on the strip's "Products" label row — the label
|
|
1700
|
+
* carries `data-aia-products-label` for this — so it sits on the seam
|
|
1701
|
+
* between the two sections rather than over the last visible option row
|
|
1702
|
+
* (2026-09-14, from the Shopify storefront). A new
|
|
1689
1703
|
* option group (`data-aia-group` on the grid changed) keeps the arrow hidden
|
|
1690
1704
|
* until the rows' entrance animation has settled, because a row mid-rise
|
|
1691
1705
|
* still extends the scrollable area and would flash the arrow on.
|
|
@@ -1808,8 +1822,10 @@ declare const PRODUCT_PATH_PREFIX = "/products/";
|
|
|
1808
1822
|
* shape. Pure, so a Tier 3 consumer rendering its own strip from
|
|
1809
1823
|
* `customFields` gets the same cards the built-in one draws.
|
|
1810
1824
|
*
|
|
1811
|
-
*
|
|
1812
|
-
*
|
|
1825
|
+
* The link is the item's own `item_url` when the catalog named one, else the
|
|
1826
|
+
* `/products/{handle}` path a Shopify item implies. An item with neither
|
|
1827
|
+
* yields a card without a `url`: still activatable, still emitting
|
|
1828
|
+
* `onProductSelect`, just nothing for cmd-click to open.
|
|
1813
1829
|
*/
|
|
1814
1830
|
declare function productFromMatchedItem(item: MatchedItem): Product;
|
|
1815
1831
|
/**
|