svelte-typeahead 4.4.0 → 4.4.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/lib/index.js +87 -63
- package/lib/index.mjs +87 -63
- package/package.json +4 -4
- package/src/Typeahead.svelte +1 -2
- package/types/Typeahead.svelte.d.ts +2 -2
- package/CHANGELOG.md +0 -168
package/lib/index.js
CHANGED
|
@@ -126,7 +126,9 @@
|
|
|
126
126
|
target.insertBefore(node, anchor || null);
|
|
127
127
|
}
|
|
128
128
|
function detach(node) {
|
|
129
|
-
node.parentNode
|
|
129
|
+
if (node.parentNode) {
|
|
130
|
+
node.parentNode.removeChild(node);
|
|
131
|
+
}
|
|
130
132
|
}
|
|
131
133
|
function destroy_each(iterations, detaching) {
|
|
132
134
|
for (let i = 0; i < iterations.length; i += 1) {
|
|
@@ -166,6 +168,14 @@
|
|
|
166
168
|
else if (node.getAttribute(attribute) !== value)
|
|
167
169
|
node.setAttribute(attribute, value);
|
|
168
170
|
}
|
|
171
|
+
/**
|
|
172
|
+
* List of attributes that should always be set through the attr method,
|
|
173
|
+
* because updating them through the property setter doesn't work reliably.
|
|
174
|
+
* In the example of `width`/`height`, the problem is that the setter only
|
|
175
|
+
* accepts numeric values, but the attribute can also be set to a string like `50%`.
|
|
176
|
+
* If this list becomes too big, rethink this approach.
|
|
177
|
+
*/
|
|
178
|
+
const always_set_through_set_attribute = ['width', 'height'];
|
|
169
179
|
function set_attributes(node, attributes) {
|
|
170
180
|
// @ts-ignore
|
|
171
181
|
const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);
|
|
@@ -179,7 +189,7 @@
|
|
|
179
189
|
else if (key === '__value') {
|
|
180
190
|
node.value = node[key] = attributes[key];
|
|
181
191
|
}
|
|
182
|
-
else if (descriptors[key] && descriptors[key].set) {
|
|
192
|
+
else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {
|
|
183
193
|
node[key] = attributes[key];
|
|
184
194
|
}
|
|
185
195
|
else {
|
|
@@ -192,8 +202,9 @@
|
|
|
192
202
|
}
|
|
193
203
|
function set_data(text, data) {
|
|
194
204
|
data = '' + data;
|
|
195
|
-
if (text.
|
|
196
|
-
|
|
205
|
+
if (text.data === data)
|
|
206
|
+
return;
|
|
207
|
+
text.data = data;
|
|
197
208
|
}
|
|
198
209
|
function set_input_value(input, value) {
|
|
199
210
|
input.value = value == null ? '' : value;
|
|
@@ -219,16 +230,17 @@
|
|
|
219
230
|
if (!this.e) {
|
|
220
231
|
if (this.is_svg)
|
|
221
232
|
this.e = svg_element(target.nodeName);
|
|
233
|
+
/** #7364 target for <template> may be provided as #document-fragment(11) */
|
|
222
234
|
else
|
|
223
|
-
this.e = element(target.nodeName);
|
|
224
|
-
this.t = target;
|
|
235
|
+
this.e = element((target.nodeType === 11 ? 'TEMPLATE' : target.nodeName));
|
|
236
|
+
this.t = target.tagName !== 'TEMPLATE' ? target : target.content;
|
|
225
237
|
this.c(html);
|
|
226
238
|
}
|
|
227
239
|
this.i(anchor);
|
|
228
240
|
}
|
|
229
241
|
h(html) {
|
|
230
242
|
this.e.innerHTML = html;
|
|
231
|
-
this.n = Array.from(this.e.childNodes);
|
|
243
|
+
this.n = Array.from(this.e.nodeName === 'TEMPLATE' ? this.e.content.childNodes : this.e.childNodes);
|
|
232
244
|
}
|
|
233
245
|
i(anchor) {
|
|
234
246
|
for (let i = 0; i < this.n.length; i += 1) {
|
|
@@ -315,9 +327,9 @@
|
|
|
315
327
|
|
|
316
328
|
const dirty_components = [];
|
|
317
329
|
const binding_callbacks = [];
|
|
318
|
-
|
|
330
|
+
let render_callbacks = [];
|
|
319
331
|
const flush_callbacks = [];
|
|
320
|
-
const resolved_promise = Promise.resolve();
|
|
332
|
+
const resolved_promise = /* @__PURE__ */ Promise.resolve();
|
|
321
333
|
let update_scheduled = false;
|
|
322
334
|
function schedule_update() {
|
|
323
335
|
if (!update_scheduled) {
|
|
@@ -356,15 +368,29 @@
|
|
|
356
368
|
const seen_callbacks = new Set();
|
|
357
369
|
let flushidx = 0; // Do *not* move this inside the flush() function
|
|
358
370
|
function flush() {
|
|
371
|
+
// Do not reenter flush while dirty components are updated, as this can
|
|
372
|
+
// result in an infinite loop. Instead, let the inner flush handle it.
|
|
373
|
+
// Reentrancy is ok afterwards for bindings etc.
|
|
374
|
+
if (flushidx !== 0) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
359
377
|
const saved_component = current_component;
|
|
360
378
|
do {
|
|
361
379
|
// first, call beforeUpdate functions
|
|
362
380
|
// and update components
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
381
|
+
try {
|
|
382
|
+
while (flushidx < dirty_components.length) {
|
|
383
|
+
const component = dirty_components[flushidx];
|
|
384
|
+
flushidx++;
|
|
385
|
+
set_current_component(component);
|
|
386
|
+
update(component.$$);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
catch (e) {
|
|
390
|
+
// reset dirty state to not end up in a deadlocked state and then rethrow
|
|
391
|
+
dirty_components.length = 0;
|
|
392
|
+
flushidx = 0;
|
|
393
|
+
throw e;
|
|
368
394
|
}
|
|
369
395
|
set_current_component(null);
|
|
370
396
|
dirty_components.length = 0;
|
|
@@ -401,6 +427,16 @@
|
|
|
401
427
|
$$.after_update.forEach(add_render_callback);
|
|
402
428
|
}
|
|
403
429
|
}
|
|
430
|
+
/**
|
|
431
|
+
* Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
|
|
432
|
+
*/
|
|
433
|
+
function flush_render_callbacks(fns) {
|
|
434
|
+
const filtered = [];
|
|
435
|
+
const targets = [];
|
|
436
|
+
render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
|
|
437
|
+
targets.forEach((c) => c());
|
|
438
|
+
render_callbacks = filtered;
|
|
439
|
+
}
|
|
404
440
|
const outroing = new Set();
|
|
405
441
|
let outros;
|
|
406
442
|
function group_outros() {
|
|
@@ -515,6 +551,7 @@
|
|
|
515
551
|
function destroy_component(component, detaching) {
|
|
516
552
|
const $$ = component.$$;
|
|
517
553
|
if ($$.fragment !== null) {
|
|
554
|
+
flush_render_callbacks($$.after_update);
|
|
518
555
|
run_all($$.on_destroy);
|
|
519
556
|
$$.fragment && $$.fragment.d(detaching);
|
|
520
557
|
// TODO null out other refs, including component.$$ (but need to
|
|
@@ -767,16 +804,11 @@
|
|
|
767
804
|
|
|
768
805
|
var fuzzy = fuzzy$1.exports;
|
|
769
806
|
|
|
770
|
-
/* node_modules/svelte-search/src/Search.svelte generated by Svelte v3.
|
|
771
|
-
|
|
772
|
-
function add_css$1(target) {
|
|
773
|
-
append_styles(target, "svelte-5m0wg6", ".hide-label.svelte-5m0wg6{position:absolute;height:1px;width:1px;overflow:hidden;clip:rect(1px 1px 1px 1px);clip:rect(1px, 1px, 1px, 1px);white-space:nowrap}");
|
|
774
|
-
}
|
|
775
|
-
|
|
807
|
+
/* node_modules/svelte-search/src/Search.svelte generated by Svelte v3.59.2 */
|
|
776
808
|
const get_label_slot_changes = dirty => ({});
|
|
777
809
|
const get_label_slot_context = ctx => ({});
|
|
778
810
|
|
|
779
|
-
// (
|
|
811
|
+
// (94:23) {label}
|
|
780
812
|
function fallback_block$1(ctx) {
|
|
781
813
|
let t;
|
|
782
814
|
|
|
@@ -800,6 +832,7 @@
|
|
|
800
832
|
let form;
|
|
801
833
|
let label_1;
|
|
802
834
|
let label_1_id_value;
|
|
835
|
+
let label_1_style_value;
|
|
803
836
|
let t;
|
|
804
837
|
let input;
|
|
805
838
|
let form_role_value;
|
|
@@ -836,16 +869,16 @@
|
|
|
836
869
|
input = element("input");
|
|
837
870
|
attr(label_1, "id", label_1_id_value = "" + (/*id*/ ctx[4] + "-label"));
|
|
838
871
|
attr(label_1, "for", /*id*/ ctx[4]);
|
|
839
|
-
attr(label_1, "
|
|
840
|
-
toggle_class(label_1, "hide-label", /*hideLabel*/ ctx[3]);
|
|
872
|
+
attr(label_1, "style", label_1_style_value = /*hideLabel*/ ctx[3] && "position: absolute;height: 1px;width: 1px;overflow: hidden;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);white-space: nowrap;");
|
|
841
873
|
set_attributes(input, input_data);
|
|
842
|
-
toggle_class(input, "svelte-5m0wg6", true);
|
|
843
874
|
attr(form, "data-svelte-search", "");
|
|
844
875
|
attr(form, "role", form_role_value = /*removeFormAriaAttributes*/ ctx[5] ? null : "search");
|
|
845
876
|
|
|
846
877
|
attr(form, "aria-labelledby", form_aria_labelledby_value = /*removeFormAriaAttributes*/ ctx[5]
|
|
847
878
|
? null
|
|
848
879
|
: /*id*/ ctx[4]);
|
|
880
|
+
|
|
881
|
+
attr(form, "action", "");
|
|
849
882
|
},
|
|
850
883
|
m(target, anchor) {
|
|
851
884
|
insert(target, form, anchor);
|
|
@@ -904,8 +937,8 @@
|
|
|
904
937
|
attr(label_1, "for", /*id*/ ctx[4]);
|
|
905
938
|
}
|
|
906
939
|
|
|
907
|
-
if (!current || dirty & /*hideLabel*/ 8) {
|
|
908
|
-
|
|
940
|
+
if (!current || dirty & /*hideLabel*/ 8 && label_1_style_value !== (label_1_style_value = /*hideLabel*/ ctx[3] && "position: absolute;height: 1px;width: 1px;overflow: hidden;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);white-space: nowrap;")) {
|
|
941
|
+
attr(label_1, "style", label_1_style_value);
|
|
909
942
|
}
|
|
910
943
|
|
|
911
944
|
set_attributes(input, input_data = get_spread_update(input_levels, [
|
|
@@ -918,12 +951,10 @@
|
|
|
918
951
|
(!current || dirty & /*id*/ 16) && { id: /*id*/ ctx[4] }
|
|
919
952
|
]));
|
|
920
953
|
|
|
921
|
-
if (dirty & /*value*/ 1) {
|
|
954
|
+
if (dirty & /*value*/ 1 && input.value !== /*value*/ ctx[0]) {
|
|
922
955
|
set_input_value(input, /*value*/ ctx[0]);
|
|
923
956
|
}
|
|
924
957
|
|
|
925
|
-
toggle_class(input, "svelte-5m0wg6", true);
|
|
926
|
-
|
|
927
958
|
if (!current || dirty & /*removeFormAriaAttributes*/ 32 && form_role_value !== (form_role_value = /*removeFormAriaAttributes*/ ctx[5] ? null : "search")) {
|
|
928
959
|
attr(form, "role", form_role_value);
|
|
929
960
|
}
|
|
@@ -973,13 +1004,14 @@
|
|
|
973
1004
|
let timeout = undefined;
|
|
974
1005
|
let calling = false;
|
|
975
1006
|
|
|
976
|
-
|
|
1007
|
+
/** @type {() => any;} */
|
|
1008
|
+
function debounceFn(fn) {
|
|
977
1009
|
if (calling) return;
|
|
978
1010
|
calling = true;
|
|
979
1011
|
|
|
980
1012
|
timeout = setTimeout(
|
|
981
1013
|
() => {
|
|
982
|
-
|
|
1014
|
+
fn();
|
|
983
1015
|
calling = false;
|
|
984
1016
|
},
|
|
985
1017
|
debounce
|
|
@@ -994,7 +1026,7 @@
|
|
|
994
1026
|
afterUpdate(() => {
|
|
995
1027
|
if (value.length > 0 && value !== prevValue) {
|
|
996
1028
|
if (debounce > 0) {
|
|
997
|
-
|
|
1029
|
+
debounceFn(() => dispatch("type", value));
|
|
998
1030
|
} else {
|
|
999
1031
|
dispatch("type", value);
|
|
1000
1032
|
}
|
|
@@ -1081,30 +1113,20 @@
|
|
|
1081
1113
|
constructor(options) {
|
|
1082
1114
|
super();
|
|
1083
1115
|
|
|
1084
|
-
init(
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
label: 2,
|
|
1095
|
-
hideLabel: 3,
|
|
1096
|
-
id: 4,
|
|
1097
|
-
ref: 1,
|
|
1098
|
-
removeFormAriaAttributes: 5
|
|
1099
|
-
},
|
|
1100
|
-
add_css$1
|
|
1101
|
-
);
|
|
1116
|
+
init(this, options, instance$1, create_fragment$1, safe_not_equal, {
|
|
1117
|
+
value: 0,
|
|
1118
|
+
autofocus: 7,
|
|
1119
|
+
debounce: 8,
|
|
1120
|
+
label: 2,
|
|
1121
|
+
hideLabel: 3,
|
|
1122
|
+
id: 4,
|
|
1123
|
+
ref: 1,
|
|
1124
|
+
removeFormAriaAttributes: 5
|
|
1125
|
+
});
|
|
1102
1126
|
}
|
|
1103
1127
|
}
|
|
1104
1128
|
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
/* src/Typeahead.svelte generated by Svelte v3.52.0 */
|
|
1129
|
+
/* src/Typeahead.svelte generated by Svelte v3.59.2 */
|
|
1108
1130
|
|
|
1109
1131
|
function add_css(target) {
|
|
1110
1132
|
append_styles(target, "svelte-1t4elht", "[data-svelte-typeahead].svelte-1t4elht.svelte-1t4elht{position:relative;background-color:#fff}ul.svelte-1t4elht.svelte-1t4elht{position:absolute;top:100%;left:0;width:100%;margin:0;padding:0;list-style:none;background-color:inherit;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1)}[aria-expanded=\"true\"].svelte-1t4elht ul.svelte-1t4elht{z-index:1}li.svelte-1t4elht.svelte-1t4elht,.no-results.svelte-1t4elht.svelte-1t4elht{padding:0.25rem 1rem}li.svelte-1t4elht.svelte-1t4elht{cursor:pointer}li.svelte-1t4elht.svelte-1t4elht:not(:last-of-type){border-bottom:1px solid #e0e0e0}li.svelte-1t4elht.svelte-1t4elht:hover{background-color:#e5e5e5}.selected.svelte-1t4elht.svelte-1t4elht{background-color:#e5e5e5}.selected.svelte-1t4elht.svelte-1t4elht:hover{background-color:#cacaca}.disabled.svelte-1t4elht.svelte-1t4elht{opacity:0.4;cursor:not-allowed}[data-svelte-search] label{margin-bottom:0.25rem;display:inline-flex;font-size:0.875rem}[data-svelte-search] input{width:100%;padding:0.5rem 0.75rem;background:none;font-size:1rem;border:0;border-radius:0;border:1px solid #e5e5e5}[data-svelte-search] input:focus{outline-color:#0f62fe;outline-offset:2px;outline-width:1px}");
|
|
@@ -1139,7 +1161,7 @@
|
|
|
1139
1161
|
value: /*value*/ ctx[0]
|
|
1140
1162
|
});
|
|
1141
1163
|
|
|
1142
|
-
// (
|
|
1164
|
+
// (247:4) {#if showResults}
|
|
1143
1165
|
function create_if_block_1(ctx) {
|
|
1144
1166
|
let each_1_anchor;
|
|
1145
1167
|
let current;
|
|
@@ -1164,7 +1186,9 @@
|
|
|
1164
1186
|
},
|
|
1165
1187
|
m(target, anchor) {
|
|
1166
1188
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1167
|
-
each_blocks[i]
|
|
1189
|
+
if (each_blocks[i]) {
|
|
1190
|
+
each_blocks[i].m(target, anchor);
|
|
1191
|
+
}
|
|
1168
1192
|
}
|
|
1169
1193
|
|
|
1170
1194
|
insert(target, each_1_anchor, anchor);
|
|
@@ -1223,7 +1247,7 @@
|
|
|
1223
1247
|
};
|
|
1224
1248
|
}
|
|
1225
1249
|
|
|
1226
|
-
// (
|
|
1250
|
+
// (266:41)
|
|
1227
1251
|
function fallback_block(ctx) {
|
|
1228
1252
|
let html_tag;
|
|
1229
1253
|
let raw_value = /*result*/ ctx[47].string + "";
|
|
@@ -1249,7 +1273,7 @@
|
|
|
1249
1273
|
};
|
|
1250
1274
|
}
|
|
1251
1275
|
|
|
1252
|
-
// (
|
|
1276
|
+
// (248:6) {#each results as result, index}
|
|
1253
1277
|
function create_each_block(ctx) {
|
|
1254
1278
|
let li;
|
|
1255
1279
|
let t;
|
|
@@ -1357,7 +1381,7 @@
|
|
|
1357
1381
|
};
|
|
1358
1382
|
}
|
|
1359
1383
|
|
|
1360
|
-
// (
|
|
1384
|
+
// (272:4) {#if $$slots["no-results"] && !hideDropdown && value.length > 0 && results.length === 0}
|
|
1361
1385
|
function create_if_block(ctx) {
|
|
1362
1386
|
let div;
|
|
1363
1387
|
let current;
|
|
@@ -1422,7 +1446,7 @@
|
|
|
1422
1446
|
let t1;
|
|
1423
1447
|
let ul_aria_labelledby_value;
|
|
1424
1448
|
let ul_id_value;
|
|
1425
|
-
let
|
|
1449
|
+
let div_aria_controls_value;
|
|
1426
1450
|
let div_id_value;
|
|
1427
1451
|
let current;
|
|
1428
1452
|
let mounted;
|
|
@@ -1468,7 +1492,7 @@
|
|
|
1468
1492
|
search_props.value = /*value*/ ctx[0];
|
|
1469
1493
|
}
|
|
1470
1494
|
|
|
1471
|
-
search = new Search
|
|
1495
|
+
search = new Search({ props: search_props });
|
|
1472
1496
|
binding_callbacks.push(() => bind(search, 'ref', search_ref_binding));
|
|
1473
1497
|
binding_callbacks.push(() => bind(search, 'value', search_value_binding));
|
|
1474
1498
|
search.$on("type", /*type_handler*/ ctx[31]);
|
|
@@ -1501,7 +1525,7 @@
|
|
|
1501
1525
|
attr(div, "data-svelte-typeahead", "");
|
|
1502
1526
|
attr(div, "role", "combobox");
|
|
1503
1527
|
attr(div, "aria-haspopup", "listbox");
|
|
1504
|
-
attr(div, "aria-
|
|
1528
|
+
attr(div, "aria-controls", div_aria_controls_value = "" + (/*id*/ ctx[2] + "-listbox"));
|
|
1505
1529
|
attr(div, "aria-expanded", /*showResults*/ ctx[7]);
|
|
1506
1530
|
attr(div, "id", div_id_value = "" + (/*id*/ ctx[2] + "-typeahead"));
|
|
1507
1531
|
attr(div, "class", "svelte-1t4elht");
|
|
@@ -1612,8 +1636,8 @@
|
|
|
1612
1636
|
attr(ul, "id", ul_id_value);
|
|
1613
1637
|
}
|
|
1614
1638
|
|
|
1615
|
-
if (!current || dirty[0] & /*id*/ 4 &&
|
|
1616
|
-
attr(div, "aria-
|
|
1639
|
+
if (!current || dirty[0] & /*id*/ 4 && div_aria_controls_value !== (div_aria_controls_value = "" + (/*id*/ ctx[2] + "-listbox"))) {
|
|
1640
|
+
attr(div, "aria-controls", div_aria_controls_value);
|
|
1617
1641
|
}
|
|
1618
1642
|
|
|
1619
1643
|
if (!current || dirty[0] & /*showResults*/ 128) {
|
package/lib/index.mjs
CHANGED
|
@@ -120,7 +120,9 @@ function insert(target, node, anchor) {
|
|
|
120
120
|
target.insertBefore(node, anchor || null);
|
|
121
121
|
}
|
|
122
122
|
function detach(node) {
|
|
123
|
-
node.parentNode
|
|
123
|
+
if (node.parentNode) {
|
|
124
|
+
node.parentNode.removeChild(node);
|
|
125
|
+
}
|
|
124
126
|
}
|
|
125
127
|
function destroy_each(iterations, detaching) {
|
|
126
128
|
for (let i = 0; i < iterations.length; i += 1) {
|
|
@@ -160,6 +162,14 @@ function attr(node, attribute, value) {
|
|
|
160
162
|
else if (node.getAttribute(attribute) !== value)
|
|
161
163
|
node.setAttribute(attribute, value);
|
|
162
164
|
}
|
|
165
|
+
/**
|
|
166
|
+
* List of attributes that should always be set through the attr method,
|
|
167
|
+
* because updating them through the property setter doesn't work reliably.
|
|
168
|
+
* In the example of `width`/`height`, the problem is that the setter only
|
|
169
|
+
* accepts numeric values, but the attribute can also be set to a string like `50%`.
|
|
170
|
+
* If this list becomes too big, rethink this approach.
|
|
171
|
+
*/
|
|
172
|
+
const always_set_through_set_attribute = ['width', 'height'];
|
|
163
173
|
function set_attributes(node, attributes) {
|
|
164
174
|
// @ts-ignore
|
|
165
175
|
const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);
|
|
@@ -173,7 +183,7 @@ function set_attributes(node, attributes) {
|
|
|
173
183
|
else if (key === '__value') {
|
|
174
184
|
node.value = node[key] = attributes[key];
|
|
175
185
|
}
|
|
176
|
-
else if (descriptors[key] && descriptors[key].set) {
|
|
186
|
+
else if (descriptors[key] && descriptors[key].set && always_set_through_set_attribute.indexOf(key) === -1) {
|
|
177
187
|
node[key] = attributes[key];
|
|
178
188
|
}
|
|
179
189
|
else {
|
|
@@ -186,8 +196,9 @@ function children(element) {
|
|
|
186
196
|
}
|
|
187
197
|
function set_data(text, data) {
|
|
188
198
|
data = '' + data;
|
|
189
|
-
if (text.
|
|
190
|
-
|
|
199
|
+
if (text.data === data)
|
|
200
|
+
return;
|
|
201
|
+
text.data = data;
|
|
191
202
|
}
|
|
192
203
|
function set_input_value(input, value) {
|
|
193
204
|
input.value = value == null ? '' : value;
|
|
@@ -213,16 +224,17 @@ class HtmlTag {
|
|
|
213
224
|
if (!this.e) {
|
|
214
225
|
if (this.is_svg)
|
|
215
226
|
this.e = svg_element(target.nodeName);
|
|
227
|
+
/** #7364 target for <template> may be provided as #document-fragment(11) */
|
|
216
228
|
else
|
|
217
|
-
this.e = element(target.nodeName);
|
|
218
|
-
this.t = target;
|
|
229
|
+
this.e = element((target.nodeType === 11 ? 'TEMPLATE' : target.nodeName));
|
|
230
|
+
this.t = target.tagName !== 'TEMPLATE' ? target : target.content;
|
|
219
231
|
this.c(html);
|
|
220
232
|
}
|
|
221
233
|
this.i(anchor);
|
|
222
234
|
}
|
|
223
235
|
h(html) {
|
|
224
236
|
this.e.innerHTML = html;
|
|
225
|
-
this.n = Array.from(this.e.childNodes);
|
|
237
|
+
this.n = Array.from(this.e.nodeName === 'TEMPLATE' ? this.e.content.childNodes : this.e.childNodes);
|
|
226
238
|
}
|
|
227
239
|
i(anchor) {
|
|
228
240
|
for (let i = 0; i < this.n.length; i += 1) {
|
|
@@ -309,9 +321,9 @@ function bubble(component, event) {
|
|
|
309
321
|
|
|
310
322
|
const dirty_components = [];
|
|
311
323
|
const binding_callbacks = [];
|
|
312
|
-
|
|
324
|
+
let render_callbacks = [];
|
|
313
325
|
const flush_callbacks = [];
|
|
314
|
-
const resolved_promise = Promise.resolve();
|
|
326
|
+
const resolved_promise = /* @__PURE__ */ Promise.resolve();
|
|
315
327
|
let update_scheduled = false;
|
|
316
328
|
function schedule_update() {
|
|
317
329
|
if (!update_scheduled) {
|
|
@@ -350,15 +362,29 @@ function add_flush_callback(fn) {
|
|
|
350
362
|
const seen_callbacks = new Set();
|
|
351
363
|
let flushidx = 0; // Do *not* move this inside the flush() function
|
|
352
364
|
function flush() {
|
|
365
|
+
// Do not reenter flush while dirty components are updated, as this can
|
|
366
|
+
// result in an infinite loop. Instead, let the inner flush handle it.
|
|
367
|
+
// Reentrancy is ok afterwards for bindings etc.
|
|
368
|
+
if (flushidx !== 0) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
353
371
|
const saved_component = current_component;
|
|
354
372
|
do {
|
|
355
373
|
// first, call beforeUpdate functions
|
|
356
374
|
// and update components
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
375
|
+
try {
|
|
376
|
+
while (flushidx < dirty_components.length) {
|
|
377
|
+
const component = dirty_components[flushidx];
|
|
378
|
+
flushidx++;
|
|
379
|
+
set_current_component(component);
|
|
380
|
+
update(component.$$);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
catch (e) {
|
|
384
|
+
// reset dirty state to not end up in a deadlocked state and then rethrow
|
|
385
|
+
dirty_components.length = 0;
|
|
386
|
+
flushidx = 0;
|
|
387
|
+
throw e;
|
|
362
388
|
}
|
|
363
389
|
set_current_component(null);
|
|
364
390
|
dirty_components.length = 0;
|
|
@@ -395,6 +421,16 @@ function update($$) {
|
|
|
395
421
|
$$.after_update.forEach(add_render_callback);
|
|
396
422
|
}
|
|
397
423
|
}
|
|
424
|
+
/**
|
|
425
|
+
* Useful for example to execute remaining `afterUpdate` callbacks before executing `destroy`.
|
|
426
|
+
*/
|
|
427
|
+
function flush_render_callbacks(fns) {
|
|
428
|
+
const filtered = [];
|
|
429
|
+
const targets = [];
|
|
430
|
+
render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
|
|
431
|
+
targets.forEach((c) => c());
|
|
432
|
+
render_callbacks = filtered;
|
|
433
|
+
}
|
|
398
434
|
const outroing = new Set();
|
|
399
435
|
let outros;
|
|
400
436
|
function group_outros() {
|
|
@@ -509,6 +545,7 @@ function mount_component(component, target, anchor, customElement) {
|
|
|
509
545
|
function destroy_component(component, detaching) {
|
|
510
546
|
const $$ = component.$$;
|
|
511
547
|
if ($$.fragment !== null) {
|
|
548
|
+
flush_render_callbacks($$.after_update);
|
|
512
549
|
run_all($$.on_destroy);
|
|
513
550
|
$$.fragment && $$.fragment.d(detaching);
|
|
514
551
|
// TODO null out other refs, including component.$$ (but need to
|
|
@@ -761,16 +798,11 @@ fuzzy.filter = function(pattern, arr, opts) {
|
|
|
761
798
|
|
|
762
799
|
var fuzzy = fuzzy$1.exports;
|
|
763
800
|
|
|
764
|
-
/* node_modules/svelte-search/src/Search.svelte generated by Svelte v3.
|
|
765
|
-
|
|
766
|
-
function add_css$1(target) {
|
|
767
|
-
append_styles(target, "svelte-5m0wg6", ".hide-label.svelte-5m0wg6{position:absolute;height:1px;width:1px;overflow:hidden;clip:rect(1px 1px 1px 1px);clip:rect(1px, 1px, 1px, 1px);white-space:nowrap}");
|
|
768
|
-
}
|
|
769
|
-
|
|
801
|
+
/* node_modules/svelte-search/src/Search.svelte generated by Svelte v3.59.2 */
|
|
770
802
|
const get_label_slot_changes = dirty => ({});
|
|
771
803
|
const get_label_slot_context = ctx => ({});
|
|
772
804
|
|
|
773
|
-
// (
|
|
805
|
+
// (94:23) {label}
|
|
774
806
|
function fallback_block$1(ctx) {
|
|
775
807
|
let t;
|
|
776
808
|
|
|
@@ -794,6 +826,7 @@ function create_fragment$1(ctx) {
|
|
|
794
826
|
let form;
|
|
795
827
|
let label_1;
|
|
796
828
|
let label_1_id_value;
|
|
829
|
+
let label_1_style_value;
|
|
797
830
|
let t;
|
|
798
831
|
let input;
|
|
799
832
|
let form_role_value;
|
|
@@ -830,16 +863,16 @@ function create_fragment$1(ctx) {
|
|
|
830
863
|
input = element("input");
|
|
831
864
|
attr(label_1, "id", label_1_id_value = "" + (/*id*/ ctx[4] + "-label"));
|
|
832
865
|
attr(label_1, "for", /*id*/ ctx[4]);
|
|
833
|
-
attr(label_1, "
|
|
834
|
-
toggle_class(label_1, "hide-label", /*hideLabel*/ ctx[3]);
|
|
866
|
+
attr(label_1, "style", label_1_style_value = /*hideLabel*/ ctx[3] && "position: absolute;height: 1px;width: 1px;overflow: hidden;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);white-space: nowrap;");
|
|
835
867
|
set_attributes(input, input_data);
|
|
836
|
-
toggle_class(input, "svelte-5m0wg6", true);
|
|
837
868
|
attr(form, "data-svelte-search", "");
|
|
838
869
|
attr(form, "role", form_role_value = /*removeFormAriaAttributes*/ ctx[5] ? null : "search");
|
|
839
870
|
|
|
840
871
|
attr(form, "aria-labelledby", form_aria_labelledby_value = /*removeFormAriaAttributes*/ ctx[5]
|
|
841
872
|
? null
|
|
842
873
|
: /*id*/ ctx[4]);
|
|
874
|
+
|
|
875
|
+
attr(form, "action", "");
|
|
843
876
|
},
|
|
844
877
|
m(target, anchor) {
|
|
845
878
|
insert(target, form, anchor);
|
|
@@ -898,8 +931,8 @@ function create_fragment$1(ctx) {
|
|
|
898
931
|
attr(label_1, "for", /*id*/ ctx[4]);
|
|
899
932
|
}
|
|
900
933
|
|
|
901
|
-
if (!current || dirty & /*hideLabel*/ 8) {
|
|
902
|
-
|
|
934
|
+
if (!current || dirty & /*hideLabel*/ 8 && label_1_style_value !== (label_1_style_value = /*hideLabel*/ ctx[3] && "position: absolute;height: 1px;width: 1px;overflow: hidden;clip: rect(1px 1px 1px 1px);clip: rect(1px, 1px, 1px, 1px);white-space: nowrap;")) {
|
|
935
|
+
attr(label_1, "style", label_1_style_value);
|
|
903
936
|
}
|
|
904
937
|
|
|
905
938
|
set_attributes(input, input_data = get_spread_update(input_levels, [
|
|
@@ -912,12 +945,10 @@ function create_fragment$1(ctx) {
|
|
|
912
945
|
(!current || dirty & /*id*/ 16) && { id: /*id*/ ctx[4] }
|
|
913
946
|
]));
|
|
914
947
|
|
|
915
|
-
if (dirty & /*value*/ 1) {
|
|
948
|
+
if (dirty & /*value*/ 1 && input.value !== /*value*/ ctx[0]) {
|
|
916
949
|
set_input_value(input, /*value*/ ctx[0]);
|
|
917
950
|
}
|
|
918
951
|
|
|
919
|
-
toggle_class(input, "svelte-5m0wg6", true);
|
|
920
|
-
|
|
921
952
|
if (!current || dirty & /*removeFormAriaAttributes*/ 32 && form_role_value !== (form_role_value = /*removeFormAriaAttributes*/ ctx[5] ? null : "search")) {
|
|
922
953
|
attr(form, "role", form_role_value);
|
|
923
954
|
}
|
|
@@ -967,13 +998,14 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
967
998
|
let timeout = undefined;
|
|
968
999
|
let calling = false;
|
|
969
1000
|
|
|
970
|
-
|
|
1001
|
+
/** @type {() => any;} */
|
|
1002
|
+
function debounceFn(fn) {
|
|
971
1003
|
if (calling) return;
|
|
972
1004
|
calling = true;
|
|
973
1005
|
|
|
974
1006
|
timeout = setTimeout(
|
|
975
1007
|
() => {
|
|
976
|
-
|
|
1008
|
+
fn();
|
|
977
1009
|
calling = false;
|
|
978
1010
|
},
|
|
979
1011
|
debounce
|
|
@@ -988,7 +1020,7 @@ function instance$1($$self, $$props, $$invalidate) {
|
|
|
988
1020
|
afterUpdate(() => {
|
|
989
1021
|
if (value.length > 0 && value !== prevValue) {
|
|
990
1022
|
if (debounce > 0) {
|
|
991
|
-
|
|
1023
|
+
debounceFn(() => dispatch("type", value));
|
|
992
1024
|
} else {
|
|
993
1025
|
dispatch("type", value);
|
|
994
1026
|
}
|
|
@@ -1075,30 +1107,20 @@ class Search extends SvelteComponent {
|
|
|
1075
1107
|
constructor(options) {
|
|
1076
1108
|
super();
|
|
1077
1109
|
|
|
1078
|
-
init(
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
label: 2,
|
|
1089
|
-
hideLabel: 3,
|
|
1090
|
-
id: 4,
|
|
1091
|
-
ref: 1,
|
|
1092
|
-
removeFormAriaAttributes: 5
|
|
1093
|
-
},
|
|
1094
|
-
add_css$1
|
|
1095
|
-
);
|
|
1110
|
+
init(this, options, instance$1, create_fragment$1, safe_not_equal, {
|
|
1111
|
+
value: 0,
|
|
1112
|
+
autofocus: 7,
|
|
1113
|
+
debounce: 8,
|
|
1114
|
+
label: 2,
|
|
1115
|
+
hideLabel: 3,
|
|
1116
|
+
id: 4,
|
|
1117
|
+
ref: 1,
|
|
1118
|
+
removeFormAriaAttributes: 5
|
|
1119
|
+
});
|
|
1096
1120
|
}
|
|
1097
1121
|
}
|
|
1098
1122
|
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
/* src/Typeahead.svelte generated by Svelte v3.52.0 */
|
|
1123
|
+
/* src/Typeahead.svelte generated by Svelte v3.59.2 */
|
|
1102
1124
|
|
|
1103
1125
|
function add_css(target) {
|
|
1104
1126
|
append_styles(target, "svelte-1t4elht", "[data-svelte-typeahead].svelte-1t4elht.svelte-1t4elht{position:relative;background-color:#fff}ul.svelte-1t4elht.svelte-1t4elht{position:absolute;top:100%;left:0;width:100%;margin:0;padding:0;list-style:none;background-color:inherit;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1)}[aria-expanded=\"true\"].svelte-1t4elht ul.svelte-1t4elht{z-index:1}li.svelte-1t4elht.svelte-1t4elht,.no-results.svelte-1t4elht.svelte-1t4elht{padding:0.25rem 1rem}li.svelte-1t4elht.svelte-1t4elht{cursor:pointer}li.svelte-1t4elht.svelte-1t4elht:not(:last-of-type){border-bottom:1px solid #e0e0e0}li.svelte-1t4elht.svelte-1t4elht:hover{background-color:#e5e5e5}.selected.svelte-1t4elht.svelte-1t4elht{background-color:#e5e5e5}.selected.svelte-1t4elht.svelte-1t4elht:hover{background-color:#cacaca}.disabled.svelte-1t4elht.svelte-1t4elht{opacity:0.4;cursor:not-allowed}[data-svelte-search] label{margin-bottom:0.25rem;display:inline-flex;font-size:0.875rem}[data-svelte-search] input{width:100%;padding:0.5rem 0.75rem;background:none;font-size:1rem;border:0;border-radius:0;border:1px solid #e5e5e5}[data-svelte-search] input:focus{outline-color:#0f62fe;outline-offset:2px;outline-width:1px}");
|
|
@@ -1133,7 +1155,7 @@ const get_default_slot_context = ctx => ({
|
|
|
1133
1155
|
value: /*value*/ ctx[0]
|
|
1134
1156
|
});
|
|
1135
1157
|
|
|
1136
|
-
// (
|
|
1158
|
+
// (247:4) {#if showResults}
|
|
1137
1159
|
function create_if_block_1(ctx) {
|
|
1138
1160
|
let each_1_anchor;
|
|
1139
1161
|
let current;
|
|
@@ -1158,7 +1180,9 @@ function create_if_block_1(ctx) {
|
|
|
1158
1180
|
},
|
|
1159
1181
|
m(target, anchor) {
|
|
1160
1182
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1161
|
-
each_blocks[i]
|
|
1183
|
+
if (each_blocks[i]) {
|
|
1184
|
+
each_blocks[i].m(target, anchor);
|
|
1185
|
+
}
|
|
1162
1186
|
}
|
|
1163
1187
|
|
|
1164
1188
|
insert(target, each_1_anchor, anchor);
|
|
@@ -1217,7 +1241,7 @@ function create_if_block_1(ctx) {
|
|
|
1217
1241
|
};
|
|
1218
1242
|
}
|
|
1219
1243
|
|
|
1220
|
-
// (
|
|
1244
|
+
// (266:41)
|
|
1221
1245
|
function fallback_block(ctx) {
|
|
1222
1246
|
let html_tag;
|
|
1223
1247
|
let raw_value = /*result*/ ctx[47].string + "";
|
|
@@ -1243,7 +1267,7 @@ function fallback_block(ctx) {
|
|
|
1243
1267
|
};
|
|
1244
1268
|
}
|
|
1245
1269
|
|
|
1246
|
-
// (
|
|
1270
|
+
// (248:6) {#each results as result, index}
|
|
1247
1271
|
function create_each_block(ctx) {
|
|
1248
1272
|
let li;
|
|
1249
1273
|
let t;
|
|
@@ -1351,7 +1375,7 @@ function create_each_block(ctx) {
|
|
|
1351
1375
|
};
|
|
1352
1376
|
}
|
|
1353
1377
|
|
|
1354
|
-
// (
|
|
1378
|
+
// (272:4) {#if $$slots["no-results"] && !hideDropdown && value.length > 0 && results.length === 0}
|
|
1355
1379
|
function create_if_block(ctx) {
|
|
1356
1380
|
let div;
|
|
1357
1381
|
let current;
|
|
@@ -1416,7 +1440,7 @@ function create_fragment(ctx) {
|
|
|
1416
1440
|
let t1;
|
|
1417
1441
|
let ul_aria_labelledby_value;
|
|
1418
1442
|
let ul_id_value;
|
|
1419
|
-
let
|
|
1443
|
+
let div_aria_controls_value;
|
|
1420
1444
|
let div_id_value;
|
|
1421
1445
|
let current;
|
|
1422
1446
|
let mounted;
|
|
@@ -1462,7 +1486,7 @@ function create_fragment(ctx) {
|
|
|
1462
1486
|
search_props.value = /*value*/ ctx[0];
|
|
1463
1487
|
}
|
|
1464
1488
|
|
|
1465
|
-
search = new Search
|
|
1489
|
+
search = new Search({ props: search_props });
|
|
1466
1490
|
binding_callbacks.push(() => bind(search, 'ref', search_ref_binding));
|
|
1467
1491
|
binding_callbacks.push(() => bind(search, 'value', search_value_binding));
|
|
1468
1492
|
search.$on("type", /*type_handler*/ ctx[31]);
|
|
@@ -1495,7 +1519,7 @@ function create_fragment(ctx) {
|
|
|
1495
1519
|
attr(div, "data-svelte-typeahead", "");
|
|
1496
1520
|
attr(div, "role", "combobox");
|
|
1497
1521
|
attr(div, "aria-haspopup", "listbox");
|
|
1498
|
-
attr(div, "aria-
|
|
1522
|
+
attr(div, "aria-controls", div_aria_controls_value = "" + (/*id*/ ctx[2] + "-listbox"));
|
|
1499
1523
|
attr(div, "aria-expanded", /*showResults*/ ctx[7]);
|
|
1500
1524
|
attr(div, "id", div_id_value = "" + (/*id*/ ctx[2] + "-typeahead"));
|
|
1501
1525
|
attr(div, "class", "svelte-1t4elht");
|
|
@@ -1606,8 +1630,8 @@ function create_fragment(ctx) {
|
|
|
1606
1630
|
attr(ul, "id", ul_id_value);
|
|
1607
1631
|
}
|
|
1608
1632
|
|
|
1609
|
-
if (!current || dirty[0] & /*id*/ 4 &&
|
|
1610
|
-
attr(div, "aria-
|
|
1633
|
+
if (!current || dirty[0] & /*id*/ 4 && div_aria_controls_value !== (div_aria_controls_value = "" + (/*id*/ ctx[2] + "-listbox"))) {
|
|
1634
|
+
attr(div, "aria-controls", div_aria_controls_value);
|
|
1611
1635
|
}
|
|
1612
1636
|
|
|
1613
1637
|
if (!current || dirty[0] & /*showResults*/ 128) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-typeahead",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Accessible, fuzzy search typeahead component",
|
|
6
6
|
"author": "Eric Liu (https://github.com/metonym)",
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"fuzzy": "0.1.3",
|
|
18
|
-
"svelte-search": "^
|
|
18
|
+
"svelte-search": "^2.1.0"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@rollup/plugin-commonjs": "^21.0.2",
|
|
22
|
-
"svelte": "^3.
|
|
23
|
-
"svelte-check": "^
|
|
22
|
+
"svelte": "^3.59.1",
|
|
23
|
+
"svelte-check": "^3.6.2",
|
|
24
24
|
"svelte-readme": "^3.6.3"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|
package/src/Typeahead.svelte
CHANGED
|
@@ -175,13 +175,12 @@
|
|
|
175
175
|
}}
|
|
176
176
|
/>
|
|
177
177
|
|
|
178
|
-
<!-- svelte-ignore a11y-role-has-required-aria-props -->
|
|
179
178
|
<div
|
|
180
179
|
data-svelte-typeahead
|
|
181
180
|
bind:this={comboboxRef}
|
|
182
181
|
role="combobox"
|
|
183
182
|
aria-haspopup="listbox"
|
|
184
|
-
aria-
|
|
183
|
+
aria-controls="{id}-listbox"
|
|
185
184
|
class:dropdown={results.length > 0}
|
|
186
185
|
aria-expanded={showResults}
|
|
187
186
|
id="{id}-typeahead"
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
2
|
import { SvelteComponentTyped } from "svelte";
|
|
3
|
-
import { SearchProps } from "svelte-search/
|
|
3
|
+
import { SearchProps } from "svelte-search/src/Search.svelte";
|
|
4
4
|
|
|
5
|
-
export interface TypeaheadProps<TItem> extends SearchProps {
|
|
5
|
+
export interface TypeaheadProps<TItem> extends Omit<SearchProps, "results"> {
|
|
6
6
|
/**
|
|
7
7
|
* @default "typeahead-" + Math.random().toString(36)
|
|
8
8
|
*/
|
package/CHANGELOG.md
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [4.4.0](https://github.com/metonym/svelte-typeahead/releases/tag/v4.4.0) - 2022-11-08
|
|
9
|
-
|
|
10
|
-
**Features**
|
|
11
|
-
|
|
12
|
-
- add `showAllResultsOnFocus` prop to display all results when focusing an empty input
|
|
13
|
-
|
|
14
|
-
**Fixes**
|
|
15
|
-
|
|
16
|
-
- silence a11y warnings emitted by Svelte@3.52
|
|
17
|
-
- event type for dispatched `clear` event should be `null`
|
|
18
|
-
- unset `ul` margin
|
|
19
|
-
|
|
20
|
-
## [4.3.2](https://github.com/metonym/svelte-typeahead/releases/tag/v4.3.2) - 2022-09-01
|
|
21
|
-
|
|
22
|
-
**Fixes**
|
|
23
|
-
|
|
24
|
-
- allow results to be selected if using `showDropdownOnFocus`
|
|
25
|
-
|
|
26
|
-
## [4.3.1](https://github.com/metonym/svelte-typeahead/releases/tag/v4.3.1) - 2022-08-29
|
|
27
|
-
|
|
28
|
-
**Fixes**
|
|
29
|
-
|
|
30
|
-
- skip disabled results when auto-selecting a result
|
|
31
|
-
|
|
32
|
-
## [4.3.0](https://github.com/metonym/svelte-typeahead/releases/tag/v4.3.0) - 2022-08-29
|
|
33
|
-
|
|
34
|
-
**Features**
|
|
35
|
-
|
|
36
|
-
- add `showDropdownOnFocus` prop to only show dropdown if the search input is focused
|
|
37
|
-
|
|
38
|
-
## [4.2.4](https://github.com/metonym/svelte-typeahead/releases/tag/v4.2.4) - 2022-07-05
|
|
39
|
-
|
|
40
|
-
**Fixes**
|
|
41
|
-
|
|
42
|
-
- set dropdown menu `z-index: 1` when expanded
|
|
43
|
-
|
|
44
|
-
## [4.2.3](https://github.com/metonym/svelte-typeahead/releases/tag/v4.2.3) - 2022-07-04
|
|
45
|
-
|
|
46
|
-
**Fixes**
|
|
47
|
-
|
|
48
|
-
- update selected index when hovering over a result
|
|
49
|
-
|
|
50
|
-
## [4.2.2](https://github.com/metonym/svelte-typeahead/releases/tag/v4.2.2) - 2022-03-20
|
|
51
|
-
|
|
52
|
-
**Fixes**
|
|
53
|
-
|
|
54
|
-
- pressing "ArrowUp" on last item should not reset highlighted index
|
|
55
|
-
|
|
56
|
-
## [4.2.1](https://github.com/metonym/svelte-typeahead/releases/tag/v4.2.1) - 2021-10-30
|
|
57
|
-
|
|
58
|
-
**Fixes**
|
|
59
|
-
|
|
60
|
-
- prevent keyboard selection and navigation of disabled results
|
|
61
|
-
- add missing annotation for `TItem.disabled` to `results` prop
|
|
62
|
-
|
|
63
|
-
**Documentation**
|
|
64
|
-
|
|
65
|
-
- add `pnpm` installation command
|
|
66
|
-
- remove "disabling items after selection" example
|
|
67
|
-
- remove `id` fields from `data` array
|
|
68
|
-
- simplify dispatched events example
|
|
69
|
-
|
|
70
|
-
## [4.2.0](https://github.com/metonym/svelte-typeahead/releases/tag/v4.2.0) - 2021-10-26
|
|
71
|
-
|
|
72
|
-
**Features**
|
|
73
|
-
|
|
74
|
-
- use TypeScript generics so that the item type can be inferred from `data` value
|
|
75
|
-
|
|
76
|
-
## [4.1.0](https://github.com/metonym/svelte-typeahead/releases/tag/v4.1.0) - 2021-10-03
|
|
77
|
-
|
|
78
|
-
**Features**
|
|
79
|
-
|
|
80
|
-
- render a "no-results" slot when the search value does not yield results
|
|
81
|
-
- add `value` to the default slot props
|
|
82
|
-
|
|
83
|
-
## [4.0.0](https://github.com/metonym/svelte-typeahead/releases/tag/v4.0.0) - 2021-09-05
|
|
84
|
-
|
|
85
|
-
**Breaking Changes**
|
|
86
|
-
|
|
87
|
-
- use `.svelte.d.ts` extension for component TypeScript definition
|
|
88
|
-
|
|
89
|
-
## [3.0.0](https://github.com/metonym/svelte-typeahead/releases/tag/v3.0.0) - 2021-03-16
|
|
90
|
-
|
|
91
|
-
**Breaking Changes**
|
|
92
|
-
|
|
93
|
-
- the `ul` element is rendered even without results to preserve the accessibility label
|
|
94
|
-
|
|
95
|
-
**Fixes**
|
|
96
|
-
|
|
97
|
-
- disable form ARIA attributes in `svelte-search`
|
|
98
|
-
- pass the correct `aria-activedescendant` item to `svelte-search`
|
|
99
|
-
|
|
100
|
-
## [2.4.1](https://github.com/metonym/svelte-typeahead/releases/tag/v2.4.1) - 2021-03-14
|
|
101
|
-
|
|
102
|
-
**Fixes**
|
|
103
|
-
|
|
104
|
-
- pass `id` to `Search` to fix `aria-labelledby` references
|
|
105
|
-
|
|
106
|
-
## [2.4.0](https://github.com/metonym/svelte-typeahead/releases/tag/v2.4.0) - 2021-03-04
|
|
107
|
-
|
|
108
|
-
**Features**
|
|
109
|
-
|
|
110
|
-
- add `limit` prop to limit number of results; default value is `Infinity`
|
|
111
|
-
|
|
112
|
-
## [2.3.0](https://github.com/metonym/svelte-typeahead/releases/tag/v2.3.0) - 2021-02-21
|
|
113
|
-
|
|
114
|
-
**Features**
|
|
115
|
-
|
|
116
|
-
- add `disable`, `filter` props to disable and filter items from the result set
|
|
117
|
-
|
|
118
|
-
**Fixes**
|
|
119
|
-
|
|
120
|
-
- bind the input element reference correctly to fix focusing behavior
|
|
121
|
-
- don't pass the Typeahead id to Search
|
|
122
|
-
|
|
123
|
-
## [2.2.0](https://github.com/metonym/svelte-typeahead/releases/tag/v2.2.0) - 2021-02-20
|
|
124
|
-
|
|
125
|
-
**Features**
|
|
126
|
-
|
|
127
|
-
- add `inputAfterSelect` prop to allow user to preserve or clear the input field after selecting a result; possible values are `"update" | "clear" | "keep"` (default is `"update"`)
|
|
128
|
-
- add searched value to dispatched "select" event detail (`e.detail.searched`)
|
|
129
|
-
|
|
130
|
-
## [2.1.0](https://github.com/metonym/svelte-typeahead/releases/tag/v2.1.0) - 2021-02-20
|
|
131
|
-
|
|
132
|
-
**Features**
|
|
133
|
-
|
|
134
|
-
- include `original` item and `originalIndex` in dispatched "select" event
|
|
135
|
-
|
|
136
|
-
## [2.0.0](https://github.com/metonym/svelte-typeahead/releases/tag/v2.0.0) - 2020-12-31
|
|
137
|
-
|
|
138
|
-
**Breaking Changes**
|
|
139
|
-
|
|
140
|
-
- upgrade `svelte-search` to version 1.0.0
|
|
141
|
-
- defer to default `label`, `placeholder` props from `search-svelte`
|
|
142
|
-
- use `SvelteComponentTyped` interface in TypeScript definitions
|
|
143
|
-
|
|
144
|
-
## [1.0.0](https://github.com/metonym/svelte-typeahead/releases/tag/v1.0.0) - 2020-11-28
|
|
145
|
-
|
|
146
|
-
**Features**
|
|
147
|
-
|
|
148
|
-
- export reactive `results` array containing fuzzy results
|
|
149
|
-
- add `focusAfterSelect` to opt in to focusing input after selecting a result
|
|
150
|
-
- keydown default behavior is preventing if pressing "ArrowUp", "ArrowDown", or "Escape"
|
|
151
|
-
|
|
152
|
-
**Breaking changes**
|
|
153
|
-
|
|
154
|
-
- `focusAfterSelect` is `false` by default
|
|
155
|
-
- redesigned default styles
|
|
156
|
-
- if using TS, Svelte version >=3.30 is required
|
|
157
|
-
|
|
158
|
-
## [0.2.0](https://github.com/metonym/svelte-typeahead/releases/tag/v0.2.0) - 2020-11-17
|
|
159
|
-
|
|
160
|
-
- Add TypeScript definitions
|
|
161
|
-
|
|
162
|
-
## [0.1.1](https://github.com/metonym/svelte-typeahead/releases/tag/v0.1.1) - 2020-08-06
|
|
163
|
-
|
|
164
|
-
- Remove `filter` named export
|
|
165
|
-
|
|
166
|
-
## [0.1.0](https://github.com/metonym/svelte-typeahead/releases/tag/v0.1.0) - 2020-04-15
|
|
167
|
-
|
|
168
|
-
- Initial release
|