@magicx-eng/ai-autocomplete-vanilla 0.61.0 → 0.62.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 +2 -0
- package/dist/index.d.mts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -727,6 +727,8 @@ new AIAutocomplete(el, {
|
|
|
727
727
|
|
|
728
728
|
**What's shown.** Your answer, as-is: it is not filtered again by the phrase it was produced for, so a fuzzy or synonym match survives. Between two calls the previous answer is filtered locally by what the user types, so the list reacts to every keystroke. Typing the full text of an option in the answer completes the parameter, exactly as it does for a server option.
|
|
729
729
|
|
|
730
|
+
**Icons.** When the server has an icon saved for the parameter it sends it on the suggestion (`icon` / `icon_svg`), and each option you return that has no `icon_svg` or `image_url` of its own is drawn with it. Give an option its own `icon_svg` or `image_url` to show that instead.
|
|
731
|
+
|
|
730
732
|
**The server's role.** The server's own options for an overridden parameter are never shown. While an override owns the active parameter the server is not asked for suggestions; it is asked again when the parameter is answered or skipped. Return an empty list for a typed phrase and the SDK falls back to the server for that phrase — the typed text goes out the way it does for a parameter with no matching options — and won't ask you the same phrase twice. An empty list for `""` leaves the parameter on screen with no options.
|
|
731
733
|
|
|
732
734
|
**Cancellation and errors.** Honour `signal`: it is aborted when a newer phrase supersedes the call, when the parameter stops being active, and on `destroy()`. A throw or a rejection is logged once per instance and treated as an empty answer, never as a fetch error.
|
package/dist/index.d.mts
CHANGED
|
@@ -113,6 +113,19 @@ interface Suggestion {
|
|
|
113
113
|
* none, which then answer exactly as before.
|
|
114
114
|
*/
|
|
115
115
|
lead_in?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The name of an icon for the whole question, such as `"map-pinned"` for a
|
|
118
|
+
* destination. The server sends it with `icon_svg` on a question it lists
|
|
119
|
+
* no tappable options for, when it has an icon saved for the parameter.
|
|
120
|
+
*/
|
|
121
|
+
icon?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Inline SVG markup for the question's icon. The SDK copies it, with `icon`,
|
|
124
|
+
* onto each `optionOverrides` option that brings no `icon_svg` or
|
|
125
|
+
* `image_url` of its own, so the rows the app supplies draw it like any
|
|
126
|
+
* option icon. It is not drawn anywhere else.
|
|
127
|
+
*/
|
|
128
|
+
icon_svg?: string;
|
|
116
129
|
}
|
|
117
130
|
interface InputItem {
|
|
118
131
|
parameter: string;
|
|
@@ -351,6 +364,13 @@ interface CompletedParamState extends CompletedParam {
|
|
|
351
364
|
suggestionValueType?: SuggestionType;
|
|
352
365
|
/** Source suggestion's `text` — used by re-edit mode to render the dropdown pill. */
|
|
353
366
|
suggestionPlaceholder: string;
|
|
367
|
+
/**
|
|
368
|
+
* Source suggestion's `icon` / `icon_svg` (see {@link Suggestion.icon_svg}),
|
|
369
|
+
* carried so the `optionOverrides` options asked again in re-edit draw the
|
|
370
|
+
* same icon the first list did.
|
|
371
|
+
*/
|
|
372
|
+
suggestionIcon?: string;
|
|
373
|
+
suggestionIconSvg?: string;
|
|
354
374
|
/** Cached options from the suggestion that produced this param — re-edit shows these. */
|
|
355
375
|
options: SuggestionOption[];
|
|
356
376
|
metadata?: Record<string, unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,19 @@ interface Suggestion {
|
|
|
113
113
|
* none, which then answer exactly as before.
|
|
114
114
|
*/
|
|
115
115
|
lead_in?: string;
|
|
116
|
+
/**
|
|
117
|
+
* The name of an icon for the whole question, such as `"map-pinned"` for a
|
|
118
|
+
* destination. The server sends it with `icon_svg` on a question it lists
|
|
119
|
+
* no tappable options for, when it has an icon saved for the parameter.
|
|
120
|
+
*/
|
|
121
|
+
icon?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Inline SVG markup for the question's icon. The SDK copies it, with `icon`,
|
|
124
|
+
* onto each `optionOverrides` option that brings no `icon_svg` or
|
|
125
|
+
* `image_url` of its own, so the rows the app supplies draw it like any
|
|
126
|
+
* option icon. It is not drawn anywhere else.
|
|
127
|
+
*/
|
|
128
|
+
icon_svg?: string;
|
|
116
129
|
}
|
|
117
130
|
interface InputItem {
|
|
118
131
|
parameter: string;
|
|
@@ -351,6 +364,13 @@ interface CompletedParamState extends CompletedParam {
|
|
|
351
364
|
suggestionValueType?: SuggestionType;
|
|
352
365
|
/** Source suggestion's `text` — used by re-edit mode to render the dropdown pill. */
|
|
353
366
|
suggestionPlaceholder: string;
|
|
367
|
+
/**
|
|
368
|
+
* Source suggestion's `icon` / `icon_svg` (see {@link Suggestion.icon_svg}),
|
|
369
|
+
* carried so the `optionOverrides` options asked again in re-edit draw the
|
|
370
|
+
* same icon the first list did.
|
|
371
|
+
*/
|
|
372
|
+
suggestionIcon?: string;
|
|
373
|
+
suggestionIconSvg?: string;
|
|
354
374
|
/** Cached options from the suggestion that produced this param — re-edit shows these. */
|
|
355
375
|
options: SuggestionOption[];
|
|
356
376
|
metadata?: Record<string, unknown>;
|