svelte-typeahead 4.1.0 → 4.2.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 CHANGED
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
2
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
3
3
  typeof define === 'function' && define.amd ? define(['exports'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global['svelte-typeahead'] = {}));
5
- }(this, (function (exports) { 'use strict';
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["svelte-typeahead"] = {}));
5
+ })(this, (function (exports) { 'use strict';
6
6
 
7
7
  function noop() { }
8
8
  function assign(tar, src) {
@@ -298,22 +298,40 @@
298
298
  function add_flush_callback(fn) {
299
299
  flush_callbacks.push(fn);
300
300
  }
301
- let flushing = false;
301
+ // flush() calls callbacks in this order:
302
+ // 1. All beforeUpdate callbacks, in order: parents before children
303
+ // 2. All bind:this callbacks, in reverse order: children before parents.
304
+ // 3. All afterUpdate callbacks, in order: parents before children. EXCEPT
305
+ // for afterUpdates called during the initial onMount, which are called in
306
+ // reverse order: children before parents.
307
+ // Since callbacks might update component values, which could trigger another
308
+ // call to flush(), the following steps guard against this:
309
+ // 1. During beforeUpdate, any updated components will be added to the
310
+ // dirty_components array and will cause a reentrant call to flush(). Because
311
+ // the flush index is kept outside the function, the reentrant call will pick
312
+ // up where the earlier call left off and go through all dirty components. The
313
+ // current_component value is saved and restored so that the reentrant call will
314
+ // not interfere with the "parent" flush() call.
315
+ // 2. bind:this callbacks cannot trigger new flush() calls.
316
+ // 3. During afterUpdate, any updated components will NOT have their afterUpdate
317
+ // callback called a second time; the seen_callbacks set, outside the flush()
318
+ // function, guarantees this behavior.
302
319
  const seen_callbacks = new Set();
320
+ let flushidx = 0; // Do *not* move this inside the flush() function
303
321
  function flush() {
304
- if (flushing)
305
- return;
306
- flushing = true;
322
+ const saved_component = current_component;
307
323
  do {
308
324
  // first, call beforeUpdate functions
309
325
  // and update components
310
- for (let i = 0; i < dirty_components.length; i += 1) {
311
- const component = dirty_components[i];
326
+ while (flushidx < dirty_components.length) {
327
+ const component = dirty_components[flushidx];
328
+ flushidx++;
312
329
  set_current_component(component);
313
330
  update(component.$$);
314
331
  }
315
332
  set_current_component(null);
316
333
  dirty_components.length = 0;
334
+ flushidx = 0;
317
335
  while (binding_callbacks.length)
318
336
  binding_callbacks.pop()();
319
337
  // then, once components are updated, call
@@ -333,8 +351,8 @@
333
351
  flush_callbacks.pop()();
334
352
  }
335
353
  update_scheduled = false;
336
- flushing = false;
337
354
  seen_callbacks.clear();
355
+ set_current_component(saved_component);
338
356
  }
339
357
  function update($$) {
340
358
  if ($$.fragment !== null) {
@@ -703,7 +721,7 @@
703
721
 
704
722
  var fuzzy = fuzzy$1.exports;
705
723
 
706
- /* node_modules/svelte-search/src/Search.svelte generated by Svelte v3.43.1 */
724
+ /* node_modules/svelte-search/src/Search.svelte generated by Svelte v3.46.4 */
707
725
 
708
726
  function add_css$1(target) {
709
727
  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}");
@@ -1040,7 +1058,7 @@
1040
1058
 
1041
1059
  var Search$1 = Search;
1042
1060
 
1043
- /* src/Typeahead.svelte generated by Svelte v3.43.1 */
1061
+ /* src/Typeahead.svelte generated by Svelte v3.46.4 */
1044
1062
 
1045
1063
  function add_css(target) {
1046
1064
  append_styles(target, "svelte-j5n77y", "[data-svelte-typeahead].svelte-j5n77y{position:relative;background-color:#fff}ul.svelte-j5n77y{position:absolute;top:100%;left:0;width:100%;padding:0;list-style:none;background-color:inherit;box-shadow:0 4px 8px rgba(0, 0, 0, 0.1)}li.svelte-j5n77y,.no-results.svelte-j5n77y{padding:0.25rem 1rem}li.svelte-j5n77y{cursor:pointer}li.svelte-j5n77y:not(:last-of-type){border-bottom:1px solid #e0e0e0}li.svelte-j5n77y:hover{background-color:#e5e5e5}.selected.svelte-j5n77y{background-color:#e5e5e5}.selected.svelte-j5n77y:hover{background-color:#cacaca}.disabled.svelte-j5n77y{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}");
@@ -1053,14 +1071,14 @@
1053
1071
 
1054
1072
  const get_no_results_slot_context = ctx => ({
1055
1073
  value: /*value*/ ctx[0],
1056
- result: /*result*/ ctx[39],
1057
- index: /*i*/ ctx[41]
1074
+ result: /*result*/ ctx[40],
1075
+ index: /*i*/ ctx[42]
1058
1076
  });
1059
1077
 
1060
1078
  function get_each_context(ctx, list, i) {
1061
1079
  const child_ctx = ctx.slice();
1062
- child_ctx[39] = list[i];
1063
- child_ctx[41] = i;
1080
+ child_ctx[40] = list[i];
1081
+ child_ctx[42] = i;
1064
1082
  return child_ctx;
1065
1083
  }
1066
1084
 
@@ -1070,12 +1088,12 @@
1070
1088
  });
1071
1089
 
1072
1090
  const get_default_slot_context = ctx => ({
1073
- result: /*result*/ ctx[39],
1074
- index: /*i*/ ctx[41],
1091
+ result: /*result*/ ctx[40],
1092
+ index: /*i*/ ctx[42],
1075
1093
  value: /*value*/ ctx[0]
1076
1094
  });
1077
1095
 
1078
- // (184:4) {#if !hideDropdown && results.length > 0}
1096
+ // (198:4) {#if !hideDropdown && results.length > 0}
1079
1097
  function create_if_block_1(ctx) {
1080
1098
  let each_1_anchor;
1081
1099
  let current;
@@ -1107,7 +1125,7 @@
1107
1125
  current = true;
1108
1126
  },
1109
1127
  p(ctx, dirty) {
1110
- if (dirty[0] & /*id, selectedIndex, results, select, $$scope, value*/ 524487) {
1128
+ if (dirty[0] & /*id, selectedIndex, results, select, $$scope, value*/ 1048775) {
1111
1129
  each_value = /*results*/ ctx[1];
1112
1130
  let i;
1113
1131
 
@@ -1159,10 +1177,10 @@
1159
1177
  };
1160
1178
  }
1161
1179
 
1162
- // (199:43)
1180
+ // (213:43)
1163
1181
  function fallback_block(ctx) {
1164
1182
  let html_tag;
1165
- let raw_value = /*result*/ ctx[39].string + "";
1183
+ let raw_value = /*result*/ ctx[40].string + "";
1166
1184
  let html_anchor;
1167
1185
 
1168
1186
  return {
@@ -1176,7 +1194,7 @@
1176
1194
  insert(target, html_anchor, anchor);
1177
1195
  },
1178
1196
  p(ctx, dirty) {
1179
- if (dirty[0] & /*results*/ 2 && raw_value !== (raw_value = /*result*/ ctx[39].string + "")) html_tag.p(raw_value);
1197
+ if (dirty[0] & /*results*/ 2 && raw_value !== (raw_value = /*result*/ ctx[40].string + "")) html_tag.p(raw_value);
1180
1198
  },
1181
1199
  d(detaching) {
1182
1200
  if (detaching) detach(html_anchor);
@@ -1185,7 +1203,7 @@
1185
1203
  };
1186
1204
  }
1187
1205
 
1188
- // (185:6) {#each results as result, i}
1206
+ // (199:6) {#each results as result, i}
1189
1207
  function create_each_block(ctx) {
1190
1208
  let li;
1191
1209
  let t;
@@ -1194,12 +1212,12 @@
1194
1212
  let current;
1195
1213
  let mounted;
1196
1214
  let dispose;
1197
- const default_slot_template = /*#slots*/ ctx[20].default;
1198
- const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[19], get_default_slot_context);
1215
+ const default_slot_template = /*#slots*/ ctx[21].default;
1216
+ const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[20], get_default_slot_context);
1199
1217
  const default_slot_or_fallback = default_slot || fallback_block(ctx);
1200
1218
 
1201
1219
  function click_handler_1() {
1202
- return /*click_handler_1*/ ctx[34](/*result*/ ctx[39], /*i*/ ctx[41]);
1220
+ return /*click_handler_1*/ ctx[35](/*result*/ ctx[40], /*i*/ ctx[42]);
1203
1221
  }
1204
1222
 
1205
1223
  return {
@@ -1208,11 +1226,11 @@
1208
1226
  if (default_slot_or_fallback) default_slot_or_fallback.c();
1209
1227
  t = space();
1210
1228
  attr(li, "role", "option");
1211
- attr(li, "id", li_id_value = "" + (/*id*/ ctx[2] + "-result-" + /*i*/ ctx[41]));
1212
- attr(li, "aria-selected", li_aria_selected_value = /*selectedIndex*/ ctx[6] === /*i*/ ctx[41]);
1229
+ attr(li, "id", li_id_value = "" + (/*id*/ ctx[2] + "-result-" + /*i*/ ctx[42]));
1230
+ attr(li, "aria-selected", li_aria_selected_value = /*selectedIndex*/ ctx[6] === /*i*/ ctx[42]);
1213
1231
  attr(li, "class", "svelte-j5n77y");
1214
- toggle_class(li, "selected", /*selectedIndex*/ ctx[6] === /*i*/ ctx[41]);
1215
- toggle_class(li, "disabled", /*result*/ ctx[39].disabled);
1232
+ toggle_class(li, "selected", /*selectedIndex*/ ctx[6] === /*i*/ ctx[42]);
1233
+ toggle_class(li, "disabled", /*result*/ ctx[40].disabled);
1216
1234
  },
1217
1235
  m(target, anchor) {
1218
1236
  insert(target, li, anchor);
@@ -1233,15 +1251,15 @@
1233
1251
  ctx = new_ctx;
1234
1252
 
1235
1253
  if (default_slot) {
1236
- if (default_slot.p && (!current || dirty[0] & /*$$scope, results, value*/ 524291)) {
1254
+ if (default_slot.p && (!current || dirty[0] & /*$$scope, results, value*/ 1048579)) {
1237
1255
  update_slot_base(
1238
1256
  default_slot,
1239
1257
  default_slot_template,
1240
1258
  ctx,
1241
- /*$$scope*/ ctx[19],
1259
+ /*$$scope*/ ctx[20],
1242
1260
  !current
1243
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[19])
1244
- : get_slot_changes(default_slot_template, /*$$scope*/ ctx[19], dirty, get_default_slot_changes),
1261
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[20])
1262
+ : get_slot_changes(default_slot_template, /*$$scope*/ ctx[20], dirty, get_default_slot_changes),
1245
1263
  get_default_slot_context
1246
1264
  );
1247
1265
  }
@@ -1251,20 +1269,20 @@
1251
1269
  }
1252
1270
  }
1253
1271
 
1254
- if (!current || dirty[0] & /*id*/ 4 && li_id_value !== (li_id_value = "" + (/*id*/ ctx[2] + "-result-" + /*i*/ ctx[41]))) {
1272
+ if (!current || dirty[0] & /*id*/ 4 && li_id_value !== (li_id_value = "" + (/*id*/ ctx[2] + "-result-" + /*i*/ ctx[42]))) {
1255
1273
  attr(li, "id", li_id_value);
1256
1274
  }
1257
1275
 
1258
- if (!current || dirty[0] & /*selectedIndex*/ 64 && li_aria_selected_value !== (li_aria_selected_value = /*selectedIndex*/ ctx[6] === /*i*/ ctx[41])) {
1276
+ if (!current || dirty[0] & /*selectedIndex*/ 64 && li_aria_selected_value !== (li_aria_selected_value = /*selectedIndex*/ ctx[6] === /*i*/ ctx[42])) {
1259
1277
  attr(li, "aria-selected", li_aria_selected_value);
1260
1278
  }
1261
1279
 
1262
1280
  if (dirty[0] & /*selectedIndex*/ 64) {
1263
- toggle_class(li, "selected", /*selectedIndex*/ ctx[6] === /*i*/ ctx[41]);
1281
+ toggle_class(li, "selected", /*selectedIndex*/ ctx[6] === /*i*/ ctx[42]);
1264
1282
  }
1265
1283
 
1266
1284
  if (dirty[0] & /*results*/ 2) {
1267
- toggle_class(li, "disabled", /*result*/ ctx[39].disabled);
1285
+ toggle_class(li, "disabled", /*result*/ ctx[40].disabled);
1268
1286
  }
1269
1287
  },
1270
1288
  i(local) {
@@ -1285,12 +1303,12 @@
1285
1303
  };
1286
1304
  }
1287
1305
 
1288
- // (205:4) {#if $$slots["no-results"] && !hideDropdown && value.length > 0 && results.length === 0}
1306
+ // (219:4) {#if $$slots["no-results"] && !hideDropdown && value.length > 0 && results.length === 0}
1289
1307
  function create_if_block(ctx) {
1290
1308
  let div;
1291
1309
  let current;
1292
- const no_results_slot_template = /*#slots*/ ctx[20]["no-results"];
1293
- const no_results_slot = create_slot(no_results_slot_template, ctx, /*$$scope*/ ctx[19], get_no_results_slot_context);
1310
+ const no_results_slot_template = /*#slots*/ ctx[21]["no-results"];
1311
+ const no_results_slot = create_slot(no_results_slot_template, ctx, /*$$scope*/ ctx[20], get_no_results_slot_context);
1294
1312
 
1295
1313
  return {
1296
1314
  c() {
@@ -1310,15 +1328,15 @@
1310
1328
  },
1311
1329
  p(ctx, dirty) {
1312
1330
  if (no_results_slot) {
1313
- if (no_results_slot.p && (!current || dirty[0] & /*$$scope, value, results*/ 524291)) {
1331
+ if (no_results_slot.p && (!current || dirty[0] & /*$$scope, value, results*/ 1048579)) {
1314
1332
  update_slot_base(
1315
1333
  no_results_slot,
1316
1334
  no_results_slot_template,
1317
1335
  ctx,
1318
- /*$$scope*/ ctx[19],
1336
+ /*$$scope*/ ctx[20],
1319
1337
  !current
1320
- ? get_all_dirty_from_scope(/*$$scope*/ ctx[19])
1321
- : get_slot_changes(no_results_slot_template, /*$$scope*/ ctx[19], dirty, get_no_results_slot_changes),
1338
+ ? get_all_dirty_from_scope(/*$$scope*/ ctx[20])
1339
+ : get_slot_changes(no_results_slot_template, /*$$scope*/ ctx[20], dirty, get_no_results_slot_changes),
1322
1340
  get_no_results_slot_context
1323
1341
  );
1324
1342
  }
@@ -1360,7 +1378,7 @@
1360
1378
  const search_spread_levels = [
1361
1379
  { id: /*id*/ ctx[2] },
1362
1380
  { removeFormAriaAttributes: true },
1363
- /*$$restProps*/ ctx[9],
1381
+ /*$$restProps*/ ctx[10],
1364
1382
  { "aria-autocomplete": "list" },
1365
1383
  {
1366
1384
  "aria-controls": "" + (/*id*/ ctx[2] + "-listbox")
@@ -1376,11 +1394,11 @@
1376
1394
  ];
1377
1395
 
1378
1396
  function search_ref_binding(value) {
1379
- /*search_ref_binding*/ ctx[22](value);
1397
+ /*search_ref_binding*/ ctx[23](value);
1380
1398
  }
1381
1399
 
1382
1400
  function search_value_binding(value) {
1383
- /*search_value_binding*/ ctx[23](value);
1401
+ /*search_value_binding*/ ctx[24](value);
1384
1402
  }
1385
1403
 
1386
1404
  let search_props = {};
@@ -1400,18 +1418,18 @@
1400
1418
  search = new Search$1({ props: search_props });
1401
1419
  binding_callbacks.push(() => bind(search, 'ref', search_ref_binding));
1402
1420
  binding_callbacks.push(() => bind(search, 'value', search_value_binding));
1403
- search.$on("type", /*type_handler*/ ctx[24]);
1404
- search.$on("input", /*input_handler*/ ctx[25]);
1405
- search.$on("change", /*change_handler*/ ctx[26]);
1406
- search.$on("focus", /*focus_handler*/ ctx[27]);
1407
- search.$on("focus", /*focus_handler_1*/ ctx[28]);
1408
- search.$on("clear", /*clear_handler*/ ctx[29]);
1409
- search.$on("clear", /*clear_handler_1*/ ctx[30]);
1410
- search.$on("blur", /*blur_handler*/ ctx[31]);
1411
- search.$on("keydown", /*keydown_handler*/ ctx[32]);
1412
- search.$on("keydown", /*keydown_handler_1*/ ctx[33]);
1421
+ search.$on("type", /*type_handler*/ ctx[25]);
1422
+ search.$on("input", /*input_handler*/ ctx[26]);
1423
+ search.$on("change", /*change_handler*/ ctx[27]);
1424
+ search.$on("focus", /*focus_handler*/ ctx[28]);
1425
+ search.$on("focus", /*focus_handler_1*/ ctx[29]);
1426
+ search.$on("clear", /*clear_handler*/ ctx[30]);
1427
+ search.$on("clear", /*clear_handler_1*/ ctx[31]);
1428
+ search.$on("blur", /*blur_handler*/ ctx[32]);
1429
+ search.$on("keydown", /*keydown_handler*/ ctx[33]);
1430
+ search.$on("keydown", /*keydown_handler_1*/ ctx[34]);
1413
1431
  let if_block0 = !/*hideDropdown*/ ctx[5] && /*results*/ ctx[1].length > 0 && create_if_block_1(ctx);
1414
- let if_block1 = /*$$slots*/ ctx[8]["no-results"] && !/*hideDropdown*/ ctx[5] && /*value*/ ctx[0].length > 0 && /*results*/ ctx[1].length === 0 && create_if_block(ctx);
1432
+ let if_block1 = /*$$slots*/ ctx[9]["no-results"] && !/*hideDropdown*/ ctx[5] && /*value*/ ctx[0].length > 0 && /*results*/ ctx[1].length === 0 && create_if_block(ctx);
1415
1433
 
1416
1434
  return {
1417
1435
  c() {
@@ -1444,20 +1462,20 @@
1444
1462
  if (if_block0) if_block0.m(ul, null);
1445
1463
  append(ul, t1);
1446
1464
  if (if_block1) if_block1.m(ul, null);
1447
- /*div_binding*/ ctx[35](div);
1465
+ /*div_binding*/ ctx[36](div);
1448
1466
  current = true;
1449
1467
 
1450
1468
  if (!mounted) {
1451
- dispose = listen(window, "click", /*click_handler*/ ctx[21]);
1469
+ dispose = listen(window, "click", /*click_handler*/ ctx[22]);
1452
1470
  mounted = true;
1453
1471
  }
1454
1472
  },
1455
1473
  p(ctx, dirty) {
1456
- const search_changes = (dirty[0] & /*id, $$restProps, selectedIndex, hideDropdown, results*/ 614)
1474
+ const search_changes = (dirty[0] & /*id, $$restProps, selectedIndex, hideDropdown, results*/ 1126)
1457
1475
  ? get_spread_update(search_spread_levels, [
1458
1476
  dirty[0] & /*id*/ 4 && { id: /*id*/ ctx[2] },
1459
1477
  search_spread_levels[1],
1460
- dirty[0] & /*$$restProps*/ 512 && get_spread_object(/*$$restProps*/ ctx[9]),
1478
+ dirty[0] & /*$$restProps*/ 1024 && get_spread_object(/*$$restProps*/ ctx[10]),
1461
1479
  search_spread_levels[3],
1462
1480
  dirty[0] & /*id*/ 4 && {
1463
1481
  "aria-controls": "" + (/*id*/ ctx[2] + "-listbox")
@@ -1510,11 +1528,11 @@
1510
1528
  check_outros();
1511
1529
  }
1512
1530
 
1513
- if (/*$$slots*/ ctx[8]["no-results"] && !/*hideDropdown*/ ctx[5] && /*value*/ ctx[0].length > 0 && /*results*/ ctx[1].length === 0) {
1531
+ if (/*$$slots*/ ctx[9]["no-results"] && !/*hideDropdown*/ ctx[5] && /*value*/ ctx[0].length > 0 && /*results*/ ctx[1].length === 0) {
1514
1532
  if (if_block1) {
1515
1533
  if_block1.p(ctx, dirty);
1516
1534
 
1517
- if (dirty[0] & /*$$slots, hideDropdown, value, results*/ 291) {
1535
+ if (dirty[0] & /*$$slots, hideDropdown, value, results*/ 547) {
1518
1536
  transition_in(if_block1, 1);
1519
1537
  }
1520
1538
  } else {
@@ -1575,7 +1593,7 @@
1575
1593
  destroy_component(search);
1576
1594
  if (if_block0) if_block0.d();
1577
1595
  if (if_block1) if_block1.d();
1578
- /*div_binding*/ ctx[35](null);
1596
+ /*div_binding*/ ctx[36](null);
1579
1597
  mounted = false;
1580
1598
  dispose();
1581
1599
  }
@@ -1625,6 +1643,7 @@
1625
1643
 
1626
1644
  async function select() {
1627
1645
  const result = results[selectedIndex];
1646
+ if (result.disabled) return;
1628
1647
  const selectedValue = extract(result.original);
1629
1648
  const searchedValue = value;
1630
1649
  if (inputAfterSelect == "clear") $$invalidate(0, value = "");
@@ -1643,6 +1662,28 @@
1643
1662
  $$invalidate(5, hideDropdown = true);
1644
1663
  }
1645
1664
 
1665
+ /** @type {(direction: -1 | 1) => void} */
1666
+ function change(direction) {
1667
+ let index = direction === 1 && selectedIndex === results.length - 1
1668
+ ? 0
1669
+ : selectedIndex + direction;
1670
+
1671
+ if (index < 0) index = results.length - 1;
1672
+ let disabled = results[index].disabled;
1673
+
1674
+ while (disabled) {
1675
+ if (index === results.length) {
1676
+ index = 0;
1677
+ } else {
1678
+ index += direction;
1679
+ }
1680
+
1681
+ disabled = results[index].disabled;
1682
+ }
1683
+
1684
+ $$invalidate(6, selectedIndex = index);
1685
+ }
1686
+
1646
1687
  const click_handler = ({ target }) => {
1647
1688
  if (!hideDropdown && comboboxRef && !comboboxRef.contains(target)) {
1648
1689
  $$invalidate(5, hideDropdown = true);
@@ -1704,17 +1745,11 @@
1704
1745
  break;
1705
1746
  case "ArrowDown":
1706
1747
  e.preventDefault();
1707
- $$invalidate(6, selectedIndex += 1);
1708
- if (selectedIndex === results.length) {
1709
- $$invalidate(6, selectedIndex = 0);
1710
- }
1748
+ change(1);
1711
1749
  break;
1712
1750
  case "ArrowUp":
1713
1751
  e.preventDefault();
1714
- $$invalidate(6, selectedIndex -= 1);
1715
- if (selectedIndex < 0) {
1716
- $$invalidate(6, selectedIndex = results.length - 1);
1717
- }
1752
+ change(-1);
1718
1753
  break;
1719
1754
  case "Escape":
1720
1755
  e.preventDefault();
@@ -1741,34 +1776,34 @@
1741
1776
 
1742
1777
  $$self.$$set = $$new_props => {
1743
1778
  $$props = assign(assign({}, $$props), exclude_internal_props($$new_props));
1744
- $$invalidate(9, $$restProps = compute_rest_props($$props, omit_props_names));
1779
+ $$invalidate(10, $$restProps = compute_rest_props($$props, omit_props_names));
1745
1780
  if ('id' in $$new_props) $$invalidate(2, id = $$new_props.id);
1746
1781
  if ('value' in $$new_props) $$invalidate(0, value = $$new_props.value);
1747
- if ('data' in $$new_props) $$invalidate(10, data = $$new_props.data);
1748
- if ('extract' in $$new_props) $$invalidate(11, extract = $$new_props.extract);
1749
- if ('disable' in $$new_props) $$invalidate(12, disable = $$new_props.disable);
1750
- if ('filter' in $$new_props) $$invalidate(13, filter = $$new_props.filter);
1751
- if ('autoselect' in $$new_props) $$invalidate(14, autoselect = $$new_props.autoselect);
1752
- if ('inputAfterSelect' in $$new_props) $$invalidate(15, inputAfterSelect = $$new_props.inputAfterSelect);
1782
+ if ('data' in $$new_props) $$invalidate(11, data = $$new_props.data);
1783
+ if ('extract' in $$new_props) $$invalidate(12, extract = $$new_props.extract);
1784
+ if ('disable' in $$new_props) $$invalidate(13, disable = $$new_props.disable);
1785
+ if ('filter' in $$new_props) $$invalidate(14, filter = $$new_props.filter);
1786
+ if ('autoselect' in $$new_props) $$invalidate(15, autoselect = $$new_props.autoselect);
1787
+ if ('inputAfterSelect' in $$new_props) $$invalidate(16, inputAfterSelect = $$new_props.inputAfterSelect);
1753
1788
  if ('results' in $$new_props) $$invalidate(1, results = $$new_props.results);
1754
- if ('focusAfterSelect' in $$new_props) $$invalidate(16, focusAfterSelect = $$new_props.focusAfterSelect);
1755
- if ('limit' in $$new_props) $$invalidate(17, limit = $$new_props.limit);
1756
- if ('$$scope' in $$new_props) $$invalidate(19, $$scope = $$new_props.$$scope);
1789
+ if ('focusAfterSelect' in $$new_props) $$invalidate(17, focusAfterSelect = $$new_props.focusAfterSelect);
1790
+ if ('limit' in $$new_props) $$invalidate(18, limit = $$new_props.limit);
1791
+ if ('$$scope' in $$new_props) $$invalidate(20, $$scope = $$new_props.$$scope);
1757
1792
  };
1758
1793
 
1759
1794
  $$self.$$.update = () => {
1760
- if ($$self.$$.dirty[0] & /*extract*/ 2048) {
1761
- $$invalidate(18, options = { pre: "<mark>", post: "</mark>", extract });
1795
+ if ($$self.$$.dirty[0] & /*extract*/ 4096) {
1796
+ $$invalidate(19, options = { pre: "<mark>", post: "</mark>", extract });
1762
1797
  }
1763
1798
 
1764
- if ($$self.$$.dirty[0] & /*value, data, options, limit, filter, disable*/ 406529) {
1799
+ if ($$self.$$.dirty[0] & /*value, data, options, limit, filter, disable*/ 813057) {
1765
1800
  $$invalidate(1, results = fuzzy.filter(value, data, options).filter(({ score }) => score > 0).slice(0, limit).filter(result => !filter(result.original)).map(result => ({
1766
1801
  ...result,
1767
1802
  disabled: disable(result.original)
1768
1803
  })));
1769
1804
  }
1770
1805
 
1771
- if ($$self.$$.dirty[0] & /*results, extract*/ 2050) {
1806
+ if ($$self.$$.dirty[0] & /*results, extract*/ 4098) {
1772
1807
  resultsId = results.map(result => extract(result.original)).join("");
1773
1808
  }
1774
1809
  };
@@ -1782,6 +1817,7 @@
1782
1817
  hideDropdown,
1783
1818
  selectedIndex,
1784
1819
  select,
1820
+ change,
1785
1821
  $$slots,
1786
1822
  $$restProps,
1787
1823
  data,
@@ -1826,15 +1862,15 @@
1826
1862
  {
1827
1863
  id: 2,
1828
1864
  value: 0,
1829
- data: 10,
1830
- extract: 11,
1831
- disable: 12,
1832
- filter: 13,
1833
- autoselect: 14,
1834
- inputAfterSelect: 15,
1865
+ data: 11,
1866
+ extract: 12,
1867
+ disable: 13,
1868
+ filter: 14,
1869
+ autoselect: 15,
1870
+ inputAfterSelect: 16,
1835
1871
  results: 1,
1836
- focusAfterSelect: 16,
1837
- limit: 17
1872
+ focusAfterSelect: 17,
1873
+ limit: 18
1838
1874
  },
1839
1875
  add_css,
1840
1876
  [-1, -1]
@@ -1844,8 +1880,8 @@
1844
1880
 
1845
1881
  var Typeahead$1 = Typeahead;
1846
1882
 
1847
- exports['default'] = Typeahead$1;
1883
+ exports["default"] = Typeahead$1;
1848
1884
 
1849
1885
  Object.defineProperty(exports, '__esModule', { value: true });
1850
1886
 
1851
- })));
1887
+ }));