svelte-typeahead 2.4.1 → 4.2.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/CHANGELOG.md +30 -0
- package/README.md +56 -42
- package/lib/index.js +414 -213
- package/lib/index.mjs +414 -213
- package/package.json +7 -7
- package/src/Typeahead.svelte +36 -29
- package/types/{Typeahead.d.ts → Typeahead.svelte.d.ts} +27 -20
- package/types/index.d.ts +1 -1
package/lib/index.js
CHANGED
|
@@ -58,13 +58,23 @@
|
|
|
58
58
|
}
|
|
59
59
|
return $$scope.dirty;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
62
|
-
const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);
|
|
61
|
+
function update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {
|
|
63
62
|
if (slot_changes) {
|
|
64
63
|
const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);
|
|
65
64
|
slot.p(slot_context, slot_changes);
|
|
66
65
|
}
|
|
67
66
|
}
|
|
67
|
+
function get_all_dirty_from_scope($$scope) {
|
|
68
|
+
if ($$scope.ctx.length > 32) {
|
|
69
|
+
const dirty = [];
|
|
70
|
+
const length = $$scope.ctx.length / 32;
|
|
71
|
+
for (let i = 0; i < length; i++) {
|
|
72
|
+
dirty[i] = -1;
|
|
73
|
+
}
|
|
74
|
+
return dirty;
|
|
75
|
+
}
|
|
76
|
+
return -1;
|
|
77
|
+
}
|
|
68
78
|
function exclude_internal_props(props) {
|
|
69
79
|
const result = {};
|
|
70
80
|
for (const k in props)
|
|
@@ -80,10 +90,37 @@
|
|
|
80
90
|
rest[k] = props[k];
|
|
81
91
|
return rest;
|
|
82
92
|
}
|
|
83
|
-
|
|
93
|
+
function compute_slots(slots) {
|
|
94
|
+
const result = {};
|
|
95
|
+
for (const key in slots) {
|
|
96
|
+
result[key] = true;
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
84
100
|
function append(target, node) {
|
|
85
101
|
target.appendChild(node);
|
|
86
102
|
}
|
|
103
|
+
function append_styles(target, style_sheet_id, styles) {
|
|
104
|
+
const append_styles_to = get_root_for_style(target);
|
|
105
|
+
if (!append_styles_to.getElementById(style_sheet_id)) {
|
|
106
|
+
const style = element('style');
|
|
107
|
+
style.id = style_sheet_id;
|
|
108
|
+
style.textContent = styles;
|
|
109
|
+
append_stylesheet(append_styles_to, style);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function get_root_for_style(node) {
|
|
113
|
+
if (!node)
|
|
114
|
+
return document;
|
|
115
|
+
const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;
|
|
116
|
+
if (root && root.host) {
|
|
117
|
+
return root;
|
|
118
|
+
}
|
|
119
|
+
return node.ownerDocument;
|
|
120
|
+
}
|
|
121
|
+
function append_stylesheet(node, style) {
|
|
122
|
+
append(node.head || node, style);
|
|
123
|
+
}
|
|
87
124
|
function insert(target, node, anchor) {
|
|
88
125
|
target.insertBefore(node, anchor || null);
|
|
89
126
|
}
|
|
@@ -160,21 +197,23 @@
|
|
|
160
197
|
function toggle_class(element, name, toggle) {
|
|
161
198
|
element.classList[toggle ? 'add' : 'remove'](name);
|
|
162
199
|
}
|
|
163
|
-
function custom_event(type, detail) {
|
|
200
|
+
function custom_event(type, detail, bubbles = false) {
|
|
164
201
|
const e = document.createEvent('CustomEvent');
|
|
165
|
-
e.initCustomEvent(type,
|
|
202
|
+
e.initCustomEvent(type, bubbles, false, detail);
|
|
166
203
|
return e;
|
|
167
204
|
}
|
|
168
205
|
class HtmlTag {
|
|
169
|
-
constructor(
|
|
170
|
-
this.a = anchor;
|
|
206
|
+
constructor() {
|
|
171
207
|
this.e = this.n = null;
|
|
172
208
|
}
|
|
209
|
+
c(html) {
|
|
210
|
+
this.h(html);
|
|
211
|
+
}
|
|
173
212
|
m(html, target, anchor = null) {
|
|
174
213
|
if (!this.e) {
|
|
175
214
|
this.e = element(target.nodeName);
|
|
176
215
|
this.t = target;
|
|
177
|
-
this.
|
|
216
|
+
this.c(html);
|
|
178
217
|
}
|
|
179
218
|
this.i(anchor);
|
|
180
219
|
}
|
|
@@ -232,7 +271,8 @@
|
|
|
232
271
|
function bubble(component, event) {
|
|
233
272
|
const callbacks = component.$$.callbacks[event.type];
|
|
234
273
|
if (callbacks) {
|
|
235
|
-
|
|
274
|
+
// @ts-ignore
|
|
275
|
+
callbacks.slice().forEach(fn => fn.call(this, event));
|
|
236
276
|
}
|
|
237
277
|
}
|
|
238
278
|
|
|
@@ -430,7 +470,7 @@
|
|
|
430
470
|
}
|
|
431
471
|
component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));
|
|
432
472
|
}
|
|
433
|
-
function init(component, options, instance, create_fragment, not_equal, props, dirty = [-1]) {
|
|
473
|
+
function init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {
|
|
434
474
|
const parent_component = current_component;
|
|
435
475
|
set_current_component(component);
|
|
436
476
|
const $$ = component.$$ = {
|
|
@@ -447,12 +487,14 @@
|
|
|
447
487
|
on_disconnect: [],
|
|
448
488
|
before_update: [],
|
|
449
489
|
after_update: [],
|
|
450
|
-
context: new Map(parent_component ? parent_component.$$.context : []),
|
|
490
|
+
context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
|
|
451
491
|
// everything else
|
|
452
492
|
callbacks: blank_object(),
|
|
453
493
|
dirty,
|
|
454
|
-
skip_bound: false
|
|
494
|
+
skip_bound: false,
|
|
495
|
+
root: options.target || parent_component.$$.root
|
|
455
496
|
};
|
|
497
|
+
append_styles && append_styles($$.root);
|
|
456
498
|
let ready = false;
|
|
457
499
|
$$.ctx = instance
|
|
458
500
|
? instance(component, options.props || {}, (i, ret, ...rest) => {
|
|
@@ -515,10 +557,7 @@
|
|
|
515
557
|
}
|
|
516
558
|
}
|
|
517
559
|
|
|
518
|
-
|
|
519
|
-
var module = { exports: {} };
|
|
520
|
-
return fn(module, module.exports), module.exports;
|
|
521
|
-
}
|
|
560
|
+
var fuzzy$1 = {exports: {}};
|
|
522
561
|
|
|
523
562
|
/*
|
|
524
563
|
* Fuzzy
|
|
@@ -528,7 +567,7 @@
|
|
|
528
567
|
* Licensed under the MIT license.
|
|
529
568
|
*/
|
|
530
569
|
|
|
531
|
-
|
|
570
|
+
(function (module, exports) {
|
|
532
571
|
(function() {
|
|
533
572
|
|
|
534
573
|
var fuzzy = {};
|
|
@@ -660,21 +699,20 @@
|
|
|
660
699
|
|
|
661
700
|
|
|
662
701
|
}());
|
|
663
|
-
});
|
|
702
|
+
}(fuzzy$1));
|
|
664
703
|
|
|
665
|
-
|
|
704
|
+
var fuzzy = fuzzy$1.exports;
|
|
666
705
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
append(document.head, style);
|
|
706
|
+
/* node_modules/svelte-search/src/Search.svelte generated by Svelte v3.44.0 */
|
|
707
|
+
|
|
708
|
+
function add_css$1(target) {
|
|
709
|
+
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}");
|
|
672
710
|
}
|
|
673
711
|
|
|
674
712
|
const get_label_slot_changes = dirty => ({});
|
|
675
713
|
const get_label_slot_context = ctx => ({});
|
|
676
714
|
|
|
677
|
-
// (
|
|
715
|
+
// (60:23) {label}
|
|
678
716
|
function fallback_block$1(ctx) {
|
|
679
717
|
let t;
|
|
680
718
|
|
|
@@ -700,11 +738,13 @@
|
|
|
700
738
|
let label_1_id_value;
|
|
701
739
|
let t;
|
|
702
740
|
let input;
|
|
741
|
+
let form_role_value;
|
|
742
|
+
let form_aria_labelledby_value;
|
|
703
743
|
let current;
|
|
704
744
|
let mounted;
|
|
705
745
|
let dispose;
|
|
706
|
-
const label_slot_template = /*#slots*/ ctx[
|
|
707
|
-
const label_slot = create_slot(label_slot_template, ctx, /*$$scope*/ ctx[
|
|
746
|
+
const label_slot_template = /*#slots*/ ctx[10].label;
|
|
747
|
+
const label_slot = create_slot(label_slot_template, ctx, /*$$scope*/ ctx[9], get_label_slot_context);
|
|
708
748
|
const label_slot_or_fallback = label_slot || fallback_block$1(ctx);
|
|
709
749
|
|
|
710
750
|
let input_levels = [
|
|
@@ -713,7 +753,7 @@
|
|
|
713
753
|
{ placeholder: "Search..." },
|
|
714
754
|
{ autocomplete: "off" },
|
|
715
755
|
{ spellcheck: "false" },
|
|
716
|
-
/*$$restProps*/ ctx[
|
|
756
|
+
/*$$restProps*/ ctx[6],
|
|
717
757
|
{ id: /*id*/ ctx[4] }
|
|
718
758
|
];
|
|
719
759
|
|
|
@@ -737,8 +777,11 @@
|
|
|
737
777
|
set_attributes(input, input_data);
|
|
738
778
|
toggle_class(input, "svelte-5m0wg6", true);
|
|
739
779
|
attr(form, "data-svelte-search", "");
|
|
740
|
-
attr(form, "role", "search");
|
|
741
|
-
|
|
780
|
+
attr(form, "role", form_role_value = /*removeFormAriaAttributes*/ ctx[5] ? null : "search");
|
|
781
|
+
|
|
782
|
+
attr(form, "aria-labelledby", form_aria_labelledby_value = /*removeFormAriaAttributes*/ ctx[5]
|
|
783
|
+
? null
|
|
784
|
+
: /*id*/ ctx[4]);
|
|
742
785
|
},
|
|
743
786
|
m(target, anchor) {
|
|
744
787
|
insert(target, form, anchor);
|
|
@@ -750,19 +793,20 @@
|
|
|
750
793
|
|
|
751
794
|
append(form, t);
|
|
752
795
|
append(form, input);
|
|
753
|
-
|
|
796
|
+
if (input.autofocus) input.focus();
|
|
797
|
+
/*input_binding*/ ctx[17](input);
|
|
754
798
|
set_input_value(input, /*value*/ ctx[0]);
|
|
755
799
|
current = true;
|
|
756
800
|
|
|
757
801
|
if (!mounted) {
|
|
758
802
|
dispose = [
|
|
759
|
-
listen(input, "input", /*input_input_handler*/ ctx[
|
|
760
|
-
listen(input, "input", /*input_handler*/ ctx[
|
|
761
|
-
listen(input, "change", /*change_handler*/ ctx[
|
|
762
|
-
listen(input, "focus", /*focus_handler*/ ctx[
|
|
763
|
-
listen(input, "blur", /*blur_handler*/ ctx[
|
|
764
|
-
listen(input, "keydown", /*keydown_handler*/ ctx[
|
|
765
|
-
listen(form, "submit", prevent_default(/*submit_handler*/ ctx[
|
|
803
|
+
listen(input, "input", /*input_input_handler*/ ctx[18]),
|
|
804
|
+
listen(input, "input", /*input_handler*/ ctx[12]),
|
|
805
|
+
listen(input, "change", /*change_handler*/ ctx[13]),
|
|
806
|
+
listen(input, "focus", /*focus_handler*/ ctx[14]),
|
|
807
|
+
listen(input, "blur", /*blur_handler*/ ctx[15]),
|
|
808
|
+
listen(input, "keydown", /*keydown_handler*/ ctx[16]),
|
|
809
|
+
listen(form, "submit", prevent_default(/*submit_handler*/ ctx[11]))
|
|
766
810
|
];
|
|
767
811
|
|
|
768
812
|
mounted = true;
|
|
@@ -770,12 +814,21 @@
|
|
|
770
814
|
},
|
|
771
815
|
p(ctx, [dirty]) {
|
|
772
816
|
if (label_slot) {
|
|
773
|
-
if (label_slot.p && dirty & /*$$scope*/
|
|
774
|
-
|
|
817
|
+
if (label_slot.p && (!current || dirty & /*$$scope*/ 512)) {
|
|
818
|
+
update_slot_base(
|
|
819
|
+
label_slot,
|
|
820
|
+
label_slot_template,
|
|
821
|
+
ctx,
|
|
822
|
+
/*$$scope*/ ctx[9],
|
|
823
|
+
!current
|
|
824
|
+
? get_all_dirty_from_scope(/*$$scope*/ ctx[9])
|
|
825
|
+
: get_slot_changes(label_slot_template, /*$$scope*/ ctx[9], dirty, get_label_slot_changes),
|
|
826
|
+
get_label_slot_context
|
|
827
|
+
);
|
|
775
828
|
}
|
|
776
829
|
} else {
|
|
777
|
-
if (label_slot_or_fallback && label_slot_or_fallback.p && dirty & /*label*/ 4) {
|
|
778
|
-
label_slot_or_fallback.p(ctx, dirty);
|
|
830
|
+
if (label_slot_or_fallback && label_slot_or_fallback.p && (!current || dirty & /*label*/ 4)) {
|
|
831
|
+
label_slot_or_fallback.p(ctx, !current ? -1 : dirty);
|
|
779
832
|
}
|
|
780
833
|
}
|
|
781
834
|
|
|
@@ -797,7 +850,7 @@
|
|
|
797
850
|
{ placeholder: "Search..." },
|
|
798
851
|
{ autocomplete: "off" },
|
|
799
852
|
{ spellcheck: "false" },
|
|
800
|
-
dirty & /*$$restProps*/
|
|
853
|
+
dirty & /*$$restProps*/ 64 && /*$$restProps*/ ctx[6],
|
|
801
854
|
(!current || dirty & /*id*/ 16) && { id: /*id*/ ctx[4] }
|
|
802
855
|
]));
|
|
803
856
|
|
|
@@ -807,8 +860,14 @@
|
|
|
807
860
|
|
|
808
861
|
toggle_class(input, "svelte-5m0wg6", true);
|
|
809
862
|
|
|
810
|
-
if (!current || dirty & /*
|
|
811
|
-
attr(form, "
|
|
863
|
+
if (!current || dirty & /*removeFormAriaAttributes*/ 32 && form_role_value !== (form_role_value = /*removeFormAriaAttributes*/ ctx[5] ? null : "search")) {
|
|
864
|
+
attr(form, "role", form_role_value);
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
if (!current || dirty & /*removeFormAriaAttributes, id*/ 48 && form_aria_labelledby_value !== (form_aria_labelledby_value = /*removeFormAriaAttributes*/ ctx[5]
|
|
868
|
+
? null
|
|
869
|
+
: /*id*/ ctx[4])) {
|
|
870
|
+
attr(form, "aria-labelledby", form_aria_labelledby_value);
|
|
812
871
|
}
|
|
813
872
|
},
|
|
814
873
|
i(local) {
|
|
@@ -823,7 +882,7 @@
|
|
|
823
882
|
d(detaching) {
|
|
824
883
|
if (detaching) detach(form);
|
|
825
884
|
if (label_slot_or_fallback) label_slot_or_fallback.d(detaching);
|
|
826
|
-
/*input_binding*/ ctx[
|
|
885
|
+
/*input_binding*/ ctx[17](null);
|
|
827
886
|
mounted = false;
|
|
828
887
|
run_all(dispose);
|
|
829
888
|
}
|
|
@@ -831,7 +890,10 @@
|
|
|
831
890
|
}
|
|
832
891
|
|
|
833
892
|
function instance$1($$self, $$props, $$invalidate) {
|
|
834
|
-
const omit_props_names = [
|
|
893
|
+
const omit_props_names = [
|
|
894
|
+
"value","autofocus","debounce","label","hideLabel","id","ref","removeFormAriaAttributes"
|
|
895
|
+
];
|
|
896
|
+
|
|
835
897
|
let $$restProps = compute_rest_props($$props, omit_props_names);
|
|
836
898
|
let { $$slots: slots = {}, $$scope } = $$props;
|
|
837
899
|
let { value = "" } = $$props;
|
|
@@ -841,6 +903,7 @@
|
|
|
841
903
|
let { hideLabel = false } = $$props;
|
|
842
904
|
let { id = "search" + Math.random().toString(36) } = $$props;
|
|
843
905
|
let { ref = null } = $$props;
|
|
906
|
+
let { removeFormAriaAttributes = false } = $$props;
|
|
844
907
|
const dispatch = createEventDispatcher();
|
|
845
908
|
let prevValue = value;
|
|
846
909
|
let timeout = undefined;
|
|
@@ -878,31 +941,31 @@
|
|
|
878
941
|
});
|
|
879
942
|
|
|
880
943
|
function submit_handler(event) {
|
|
881
|
-
bubble($$self, event);
|
|
944
|
+
bubble.call(this, $$self, event);
|
|
882
945
|
}
|
|
883
946
|
|
|
884
947
|
function input_handler(event) {
|
|
885
|
-
bubble($$self, event);
|
|
948
|
+
bubble.call(this, $$self, event);
|
|
886
949
|
}
|
|
887
950
|
|
|
888
951
|
function change_handler(event) {
|
|
889
|
-
bubble($$self, event);
|
|
952
|
+
bubble.call(this, $$self, event);
|
|
890
953
|
}
|
|
891
954
|
|
|
892
955
|
function focus_handler(event) {
|
|
893
|
-
bubble($$self, event);
|
|
956
|
+
bubble.call(this, $$self, event);
|
|
894
957
|
}
|
|
895
958
|
|
|
896
959
|
function blur_handler(event) {
|
|
897
|
-
bubble($$self, event);
|
|
960
|
+
bubble.call(this, $$self, event);
|
|
898
961
|
}
|
|
899
962
|
|
|
900
963
|
function keydown_handler(event) {
|
|
901
|
-
bubble($$self, event);
|
|
964
|
+
bubble.call(this, $$self, event);
|
|
902
965
|
}
|
|
903
966
|
|
|
904
967
|
function input_binding($$value) {
|
|
905
|
-
binding_callbacks[$$value ?
|
|
968
|
+
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
906
969
|
ref = $$value;
|
|
907
970
|
$$invalidate(1, ref);
|
|
908
971
|
});
|
|
@@ -915,15 +978,16 @@
|
|
|
915
978
|
|
|
916
979
|
$$self.$$set = $$new_props => {
|
|
917
980
|
$$props = assign(assign({}, $$props), exclude_internal_props($$new_props));
|
|
918
|
-
$$invalidate(
|
|
919
|
-
if (
|
|
920
|
-
if (
|
|
921
|
-
if (
|
|
922
|
-
if (
|
|
923
|
-
if (
|
|
924
|
-
if (
|
|
925
|
-
if (
|
|
926
|
-
if (
|
|
981
|
+
$$invalidate(6, $$restProps = compute_rest_props($$props, omit_props_names));
|
|
982
|
+
if ('value' in $$new_props) $$invalidate(0, value = $$new_props.value);
|
|
983
|
+
if ('autofocus' in $$new_props) $$invalidate(7, autofocus = $$new_props.autofocus);
|
|
984
|
+
if ('debounce' in $$new_props) $$invalidate(8, debounce = $$new_props.debounce);
|
|
985
|
+
if ('label' in $$new_props) $$invalidate(2, label = $$new_props.label);
|
|
986
|
+
if ('hideLabel' in $$new_props) $$invalidate(3, hideLabel = $$new_props.hideLabel);
|
|
987
|
+
if ('id' in $$new_props) $$invalidate(4, id = $$new_props.id);
|
|
988
|
+
if ('ref' in $$new_props) $$invalidate(1, ref = $$new_props.ref);
|
|
989
|
+
if ('removeFormAriaAttributes' in $$new_props) $$invalidate(5, removeFormAriaAttributes = $$new_props.removeFormAriaAttributes);
|
|
990
|
+
if ('$$scope' in $$new_props) $$invalidate(9, $$scope = $$new_props.$$scope);
|
|
927
991
|
};
|
|
928
992
|
|
|
929
993
|
return [
|
|
@@ -932,6 +996,7 @@
|
|
|
932
996
|
label,
|
|
933
997
|
hideLabel,
|
|
934
998
|
id,
|
|
999
|
+
removeFormAriaAttributes,
|
|
935
1000
|
$$restProps,
|
|
936
1001
|
autofocus,
|
|
937
1002
|
debounce,
|
|
@@ -951,48 +1016,68 @@
|
|
|
951
1016
|
class Search extends SvelteComponent {
|
|
952
1017
|
constructor(options) {
|
|
953
1018
|
super();
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1019
|
+
|
|
1020
|
+
init(
|
|
1021
|
+
this,
|
|
1022
|
+
options,
|
|
1023
|
+
instance$1,
|
|
1024
|
+
create_fragment$1,
|
|
1025
|
+
safe_not_equal,
|
|
1026
|
+
{
|
|
1027
|
+
value: 0,
|
|
1028
|
+
autofocus: 7,
|
|
1029
|
+
debounce: 8,
|
|
1030
|
+
label: 2,
|
|
1031
|
+
hideLabel: 3,
|
|
1032
|
+
id: 4,
|
|
1033
|
+
ref: 1,
|
|
1034
|
+
removeFormAriaAttributes: 5
|
|
1035
|
+
},
|
|
1036
|
+
add_css$1
|
|
1037
|
+
);
|
|
965
1038
|
}
|
|
966
1039
|
}
|
|
967
1040
|
|
|
968
|
-
|
|
1041
|
+
var Search$1 = Search;
|
|
969
1042
|
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
append(document.head, style);
|
|
1043
|
+
/* src/Typeahead.svelte generated by Svelte v3.44.0 */
|
|
1044
|
+
|
|
1045
|
+
function add_css(target) {
|
|
1046
|
+
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}");
|
|
975
1047
|
}
|
|
976
1048
|
|
|
1049
|
+
const get_no_results_slot_changes = dirty => ({
|
|
1050
|
+
value: dirty[0] & /*value*/ 1,
|
|
1051
|
+
result: dirty[0] & /*results*/ 2
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
const get_no_results_slot_context = ctx => ({
|
|
1055
|
+
value: /*value*/ ctx[0],
|
|
1056
|
+
result: /*result*/ ctx[39],
|
|
1057
|
+
index: /*i*/ ctx[41]
|
|
1058
|
+
});
|
|
1059
|
+
|
|
977
1060
|
function get_each_context(ctx, list, i) {
|
|
978
1061
|
const child_ctx = ctx.slice();
|
|
979
|
-
child_ctx[
|
|
980
|
-
child_ctx[
|
|
1062
|
+
child_ctx[39] = list[i];
|
|
1063
|
+
child_ctx[41] = i;
|
|
981
1064
|
return child_ctx;
|
|
982
1065
|
}
|
|
983
1066
|
|
|
984
|
-
const get_default_slot_changes = dirty => ({
|
|
1067
|
+
const get_default_slot_changes = dirty => ({
|
|
1068
|
+
result: dirty[0] & /*results*/ 2,
|
|
1069
|
+
value: dirty[0] & /*value*/ 1
|
|
1070
|
+
});
|
|
985
1071
|
|
|
986
1072
|
const get_default_slot_context = ctx => ({
|
|
987
|
-
result: /*result*/ ctx[
|
|
988
|
-
index: /*i*/ ctx[
|
|
1073
|
+
result: /*result*/ ctx[39],
|
|
1074
|
+
index: /*i*/ ctx[41],
|
|
1075
|
+
value: /*value*/ ctx[0]
|
|
989
1076
|
});
|
|
990
1077
|
|
|
991
|
-
// (
|
|
992
|
-
function
|
|
993
|
-
let
|
|
994
|
-
let ul_aria_labelledby_value;
|
|
995
|
-
let ul_id_value;
|
|
1078
|
+
// (180:4) {#if !hideDropdown && results.length > 0}
|
|
1079
|
+
function create_if_block_1(ctx) {
|
|
1080
|
+
let each_1_anchor;
|
|
996
1081
|
let current;
|
|
997
1082
|
let each_value = /*results*/ ctx[1];
|
|
998
1083
|
let each_blocks = [];
|
|
@@ -1007,29 +1092,22 @@
|
|
|
1007
1092
|
|
|
1008
1093
|
return {
|
|
1009
1094
|
c() {
|
|
1010
|
-
ul = element("ul");
|
|
1011
|
-
|
|
1012
1095
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1013
1096
|
each_blocks[i].c();
|
|
1014
1097
|
}
|
|
1015
1098
|
|
|
1016
|
-
|
|
1017
|
-
attr(ul, "aria-labelledby", ul_aria_labelledby_value = "" + (/*id*/ ctx[2] + "-label"));
|
|
1018
|
-
attr(ul, "id", ul_id_value = "" + (/*id*/ ctx[2] + "-listbox"));
|
|
1019
|
-
attr(ul, "class", "svelte-t0wd5r");
|
|
1020
|
-
toggle_class(ul, "svelte-typeahead-list", true);
|
|
1099
|
+
each_1_anchor = empty();
|
|
1021
1100
|
},
|
|
1022
1101
|
m(target, anchor) {
|
|
1023
|
-
insert(target, ul, anchor);
|
|
1024
|
-
|
|
1025
1102
|
for (let i = 0; i < each_blocks.length; i += 1) {
|
|
1026
|
-
each_blocks[i].m(
|
|
1103
|
+
each_blocks[i].m(target, anchor);
|
|
1027
1104
|
}
|
|
1028
1105
|
|
|
1106
|
+
insert(target, each_1_anchor, anchor);
|
|
1029
1107
|
current = true;
|
|
1030
1108
|
},
|
|
1031
1109
|
p(ctx, dirty) {
|
|
1032
|
-
if (dirty[0] & /*id, selectedIndex, results, select, $$scope*/
|
|
1110
|
+
if (dirty[0] & /*id, selectedIndex, results, select, $$scope, value*/ 524487) {
|
|
1033
1111
|
each_value = /*results*/ ctx[1];
|
|
1034
1112
|
let i;
|
|
1035
1113
|
|
|
@@ -1043,7 +1121,7 @@
|
|
|
1043
1121
|
each_blocks[i] = create_each_block(child_ctx);
|
|
1044
1122
|
each_blocks[i].c();
|
|
1045
1123
|
transition_in(each_blocks[i], 1);
|
|
1046
|
-
each_blocks[i].m(
|
|
1124
|
+
each_blocks[i].m(each_1_anchor.parentNode, each_1_anchor);
|
|
1047
1125
|
}
|
|
1048
1126
|
}
|
|
1049
1127
|
|
|
@@ -1055,14 +1133,6 @@
|
|
|
1055
1133
|
|
|
1056
1134
|
check_outros();
|
|
1057
1135
|
}
|
|
1058
|
-
|
|
1059
|
-
if (!current || dirty[0] & /*id*/ 4 && ul_aria_labelledby_value !== (ul_aria_labelledby_value = "" + (/*id*/ ctx[2] + "-label"))) {
|
|
1060
|
-
attr(ul, "aria-labelledby", ul_aria_labelledby_value);
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
|
-
if (!current || dirty[0] & /*id*/ 4 && ul_id_value !== (ul_id_value = "" + (/*id*/ ctx[2] + "-listbox"))) {
|
|
1064
|
-
attr(ul, "id", ul_id_value);
|
|
1065
|
-
}
|
|
1066
1136
|
},
|
|
1067
1137
|
i(local) {
|
|
1068
1138
|
if (current) return;
|
|
@@ -1083,29 +1153,30 @@
|
|
|
1083
1153
|
current = false;
|
|
1084
1154
|
},
|
|
1085
1155
|
d(detaching) {
|
|
1086
|
-
if (detaching) detach(ul);
|
|
1087
1156
|
destroy_each(each_blocks, detaching);
|
|
1157
|
+
if (detaching) detach(each_1_anchor);
|
|
1088
1158
|
}
|
|
1089
1159
|
};
|
|
1090
1160
|
}
|
|
1091
1161
|
|
|
1092
|
-
// (
|
|
1162
|
+
// (195:43)
|
|
1093
1163
|
function fallback_block(ctx) {
|
|
1094
1164
|
let html_tag;
|
|
1095
|
-
let raw_value = /*result*/ ctx[
|
|
1165
|
+
let raw_value = /*result*/ ctx[39].string + "";
|
|
1096
1166
|
let html_anchor;
|
|
1097
1167
|
|
|
1098
1168
|
return {
|
|
1099
1169
|
c() {
|
|
1170
|
+
html_tag = new HtmlTag();
|
|
1100
1171
|
html_anchor = empty();
|
|
1101
|
-
html_tag =
|
|
1172
|
+
html_tag.a = html_anchor;
|
|
1102
1173
|
},
|
|
1103
1174
|
m(target, anchor) {
|
|
1104
1175
|
html_tag.m(raw_value, target, anchor);
|
|
1105
1176
|
insert(target, html_anchor, anchor);
|
|
1106
1177
|
},
|
|
1107
1178
|
p(ctx, dirty) {
|
|
1108
|
-
if (dirty[0] & /*results*/ 2 && raw_value !== (raw_value = /*result*/ ctx[
|
|
1179
|
+
if (dirty[0] & /*results*/ 2 && raw_value !== (raw_value = /*result*/ ctx[39].string + "")) html_tag.p(raw_value);
|
|
1109
1180
|
},
|
|
1110
1181
|
d(detaching) {
|
|
1111
1182
|
if (detaching) detach(html_anchor);
|
|
@@ -1114,7 +1185,7 @@
|
|
|
1114
1185
|
};
|
|
1115
1186
|
}
|
|
1116
1187
|
|
|
1117
|
-
// (
|
|
1188
|
+
// (181:6) {#each results as result, i}
|
|
1118
1189
|
function create_each_block(ctx) {
|
|
1119
1190
|
let li;
|
|
1120
1191
|
let t;
|
|
@@ -1123,12 +1194,12 @@
|
|
|
1123
1194
|
let current;
|
|
1124
1195
|
let mounted;
|
|
1125
1196
|
let dispose;
|
|
1126
|
-
const default_slot_template = /*#slots*/ ctx[
|
|
1127
|
-
const default_slot = create_slot(default_slot_template, ctx, /*$$scope*/ ctx[
|
|
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);
|
|
1128
1199
|
const default_slot_or_fallback = default_slot || fallback_block(ctx);
|
|
1129
1200
|
|
|
1130
1201
|
function click_handler_1() {
|
|
1131
|
-
return /*click_handler_1*/ ctx[
|
|
1202
|
+
return /*click_handler_1*/ ctx[34](/*result*/ ctx[39], /*i*/ ctx[41]);
|
|
1132
1203
|
}
|
|
1133
1204
|
|
|
1134
1205
|
return {
|
|
@@ -1137,11 +1208,11 @@
|
|
|
1137
1208
|
if (default_slot_or_fallback) default_slot_or_fallback.c();
|
|
1138
1209
|
t = space();
|
|
1139
1210
|
attr(li, "role", "option");
|
|
1140
|
-
attr(li, "id", li_id_value = "" + (/*id*/ ctx[2] + "-result-" + /*i*/ ctx[
|
|
1141
|
-
attr(li, "aria-selected", li_aria_selected_value = /*selectedIndex*/ ctx[6] === /*i*/ ctx[
|
|
1142
|
-
attr(li, "class", "svelte-
|
|
1143
|
-
toggle_class(li, "selected", /*selectedIndex*/ ctx[6] === /*i*/ ctx[
|
|
1144
|
-
toggle_class(li, "disabled", /*result*/ ctx[
|
|
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]);
|
|
1213
|
+
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);
|
|
1145
1216
|
},
|
|
1146
1217
|
m(target, anchor) {
|
|
1147
1218
|
insert(target, li, anchor);
|
|
@@ -1162,29 +1233,38 @@
|
|
|
1162
1233
|
ctx = new_ctx;
|
|
1163
1234
|
|
|
1164
1235
|
if (default_slot) {
|
|
1165
|
-
if (default_slot.p && dirty[0] & /*$$scope, results*/
|
|
1166
|
-
|
|
1236
|
+
if (default_slot.p && (!current || dirty[0] & /*$$scope, results, value*/ 524291)) {
|
|
1237
|
+
update_slot_base(
|
|
1238
|
+
default_slot,
|
|
1239
|
+
default_slot_template,
|
|
1240
|
+
ctx,
|
|
1241
|
+
/*$$scope*/ ctx[19],
|
|
1242
|
+
!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),
|
|
1245
|
+
get_default_slot_context
|
|
1246
|
+
);
|
|
1167
1247
|
}
|
|
1168
1248
|
} else {
|
|
1169
|
-
if (default_slot_or_fallback && default_slot_or_fallback.p && dirty[0] & /*results*/ 2) {
|
|
1170
|
-
default_slot_or_fallback.p(ctx, dirty);
|
|
1249
|
+
if (default_slot_or_fallback && default_slot_or_fallback.p && (!current || dirty[0] & /*results*/ 2)) {
|
|
1250
|
+
default_slot_or_fallback.p(ctx, !current ? [-1, -1] : dirty);
|
|
1171
1251
|
}
|
|
1172
1252
|
}
|
|
1173
1253
|
|
|
1174
|
-
if (!current || dirty[0] & /*id*/ 4 && li_id_value !== (li_id_value = "" + (/*id*/ ctx[2] + "-result-" + /*i*/ ctx[
|
|
1254
|
+
if (!current || dirty[0] & /*id*/ 4 && li_id_value !== (li_id_value = "" + (/*id*/ ctx[2] + "-result-" + /*i*/ ctx[41]))) {
|
|
1175
1255
|
attr(li, "id", li_id_value);
|
|
1176
1256
|
}
|
|
1177
1257
|
|
|
1178
|
-
if (!current || dirty[0] & /*selectedIndex*/ 64 && li_aria_selected_value !== (li_aria_selected_value = /*selectedIndex*/ ctx[6] === /*i*/ ctx[
|
|
1258
|
+
if (!current || dirty[0] & /*selectedIndex*/ 64 && li_aria_selected_value !== (li_aria_selected_value = /*selectedIndex*/ ctx[6] === /*i*/ ctx[41])) {
|
|
1179
1259
|
attr(li, "aria-selected", li_aria_selected_value);
|
|
1180
1260
|
}
|
|
1181
1261
|
|
|
1182
1262
|
if (dirty[0] & /*selectedIndex*/ 64) {
|
|
1183
|
-
toggle_class(li, "selected", /*selectedIndex*/ ctx[6] === /*i*/ ctx[
|
|
1263
|
+
toggle_class(li, "selected", /*selectedIndex*/ ctx[6] === /*i*/ ctx[41]);
|
|
1184
1264
|
}
|
|
1185
1265
|
|
|
1186
1266
|
if (dirty[0] & /*results*/ 2) {
|
|
1187
|
-
toggle_class(li, "disabled", /*result*/ ctx[
|
|
1267
|
+
toggle_class(li, "disabled", /*result*/ ctx[39].disabled);
|
|
1188
1268
|
}
|
|
1189
1269
|
},
|
|
1190
1270
|
i(local) {
|
|
@@ -1205,12 +1285,71 @@
|
|
|
1205
1285
|
};
|
|
1206
1286
|
}
|
|
1207
1287
|
|
|
1288
|
+
// (201:4) {#if $$slots["no-results"] && !hideDropdown && value.length > 0 && results.length === 0}
|
|
1289
|
+
function create_if_block(ctx) {
|
|
1290
|
+
let div;
|
|
1291
|
+
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);
|
|
1294
|
+
|
|
1295
|
+
return {
|
|
1296
|
+
c() {
|
|
1297
|
+
div = element("div");
|
|
1298
|
+
if (no_results_slot) no_results_slot.c();
|
|
1299
|
+
attr(div, "class", "svelte-j5n77y");
|
|
1300
|
+
toggle_class(div, "no-results", true);
|
|
1301
|
+
},
|
|
1302
|
+
m(target, anchor) {
|
|
1303
|
+
insert(target, div, anchor);
|
|
1304
|
+
|
|
1305
|
+
if (no_results_slot) {
|
|
1306
|
+
no_results_slot.m(div, null);
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
current = true;
|
|
1310
|
+
},
|
|
1311
|
+
p(ctx, dirty) {
|
|
1312
|
+
if (no_results_slot) {
|
|
1313
|
+
if (no_results_slot.p && (!current || dirty[0] & /*$$scope, value, results*/ 524291)) {
|
|
1314
|
+
update_slot_base(
|
|
1315
|
+
no_results_slot,
|
|
1316
|
+
no_results_slot_template,
|
|
1317
|
+
ctx,
|
|
1318
|
+
/*$$scope*/ ctx[19],
|
|
1319
|
+
!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),
|
|
1322
|
+
get_no_results_slot_context
|
|
1323
|
+
);
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
i(local) {
|
|
1328
|
+
if (current) return;
|
|
1329
|
+
transition_in(no_results_slot, local);
|
|
1330
|
+
current = true;
|
|
1331
|
+
},
|
|
1332
|
+
o(local) {
|
|
1333
|
+
transition_out(no_results_slot, local);
|
|
1334
|
+
current = false;
|
|
1335
|
+
},
|
|
1336
|
+
d(detaching) {
|
|
1337
|
+
if (detaching) detach(div);
|
|
1338
|
+
if (no_results_slot) no_results_slot.d(detaching);
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
|
|
1208
1343
|
function create_fragment(ctx) {
|
|
1209
1344
|
let div;
|
|
1210
1345
|
let search;
|
|
1211
1346
|
let updating_ref;
|
|
1212
1347
|
let updating_value;
|
|
1213
|
-
let
|
|
1348
|
+
let t0;
|
|
1349
|
+
let ul;
|
|
1350
|
+
let t1;
|
|
1351
|
+
let ul_aria_labelledby_value;
|
|
1352
|
+
let ul_id_value;
|
|
1214
1353
|
let div_aria_owns_value;
|
|
1215
1354
|
let div_aria_expanded_value;
|
|
1216
1355
|
let div_id_value;
|
|
@@ -1220,7 +1359,8 @@
|
|
|
1220
1359
|
|
|
1221
1360
|
const search_spread_levels = [
|
|
1222
1361
|
{ id: /*id*/ ctx[2] },
|
|
1223
|
-
|
|
1362
|
+
{ removeFormAriaAttributes: true },
|
|
1363
|
+
/*$$restProps*/ ctx[9],
|
|
1224
1364
|
{ "aria-autocomplete": "list" },
|
|
1225
1365
|
{
|
|
1226
1366
|
"aria-controls": "" + (/*id*/ ctx[2] + "-listbox")
|
|
@@ -1228,15 +1368,19 @@
|
|
|
1228
1368
|
{
|
|
1229
1369
|
"aria-labelledby": "" + (/*id*/ ctx[2] + "-label")
|
|
1230
1370
|
},
|
|
1231
|
-
{
|
|
1371
|
+
{
|
|
1372
|
+
"aria-activedescendant": /*selectedIndex*/ ctx[6] >= 0 && !/*hideDropdown*/ ctx[5] && /*results*/ ctx[1].length > 0
|
|
1373
|
+
? `${/*id*/ ctx[2]}-result-${/*selectedIndex*/ ctx[6]}`
|
|
1374
|
+
: null
|
|
1375
|
+
}
|
|
1232
1376
|
];
|
|
1233
1377
|
|
|
1234
1378
|
function search_ref_binding(value) {
|
|
1235
|
-
/*search_ref_binding*/ ctx[
|
|
1379
|
+
/*search_ref_binding*/ ctx[22](value);
|
|
1236
1380
|
}
|
|
1237
1381
|
|
|
1238
1382
|
function search_value_binding(value) {
|
|
1239
|
-
/*search_value_binding*/ ctx[
|
|
1383
|
+
/*search_value_binding*/ ctx[23](value);
|
|
1240
1384
|
}
|
|
1241
1385
|
|
|
1242
1386
|
let search_props = {};
|
|
@@ -1253,62 +1397,79 @@
|
|
|
1253
1397
|
search_props.value = /*value*/ ctx[0];
|
|
1254
1398
|
}
|
|
1255
1399
|
|
|
1256
|
-
search = new Search({ props: search_props });
|
|
1257
|
-
binding_callbacks.push(() => bind(search,
|
|
1258
|
-
binding_callbacks.push(() => bind(search,
|
|
1259
|
-
search.$on("type", /*type_handler*/ ctx[
|
|
1260
|
-
search.$on("input", /*input_handler*/ ctx[
|
|
1261
|
-
search.$on("change", /*change_handler*/ ctx[
|
|
1262
|
-
search.$on("focus", /*focus_handler*/ ctx[
|
|
1263
|
-
search.$on("focus", /*focus_handler_1*/ ctx[
|
|
1264
|
-
search.$on("clear", /*clear_handler*/ ctx[
|
|
1265
|
-
search.$on("clear", /*clear_handler_1*/ ctx[
|
|
1266
|
-
search.$on("blur", /*blur_handler*/ ctx[
|
|
1267
|
-
search.$on("keydown", /*keydown_handler*/ ctx[
|
|
1268
|
-
search.$on("keydown", /*keydown_handler_1*/ ctx[
|
|
1269
|
-
let
|
|
1400
|
+
search = new Search$1({ props: search_props });
|
|
1401
|
+
binding_callbacks.push(() => bind(search, 'ref', search_ref_binding));
|
|
1402
|
+
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]);
|
|
1413
|
+
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);
|
|
1270
1415
|
|
|
1271
1416
|
return {
|
|
1272
1417
|
c() {
|
|
1273
1418
|
div = element("div");
|
|
1274
1419
|
create_component(search.$$.fragment);
|
|
1275
|
-
|
|
1276
|
-
|
|
1420
|
+
t0 = space();
|
|
1421
|
+
ul = element("ul");
|
|
1422
|
+
if (if_block0) if_block0.c();
|
|
1423
|
+
t1 = space();
|
|
1424
|
+
if (if_block1) if_block1.c();
|
|
1425
|
+
attr(ul, "role", "listbox");
|
|
1426
|
+
attr(ul, "aria-labelledby", ul_aria_labelledby_value = "" + (/*id*/ ctx[2] + "-label"));
|
|
1427
|
+
attr(ul, "id", ul_id_value = "" + (/*id*/ ctx[2] + "-listbox"));
|
|
1428
|
+
attr(ul, "class", "svelte-j5n77y");
|
|
1429
|
+
toggle_class(ul, "svelte-typeahead-list", true);
|
|
1277
1430
|
attr(div, "data-svelte-typeahead", "");
|
|
1278
1431
|
attr(div, "role", "combobox");
|
|
1279
1432
|
attr(div, "aria-haspopup", "listbox");
|
|
1280
1433
|
attr(div, "aria-owns", div_aria_owns_value = "" + (/*id*/ ctx[2] + "-listbox"));
|
|
1281
1434
|
attr(div, "aria-expanded", div_aria_expanded_value = !/*hideDropdown*/ ctx[5] && /*results*/ ctx[1].length > 0);
|
|
1282
1435
|
attr(div, "id", div_id_value = "" + (/*id*/ ctx[2] + "-typeahead"));
|
|
1283
|
-
attr(div, "class", "svelte-
|
|
1436
|
+
attr(div, "class", "svelte-j5n77y");
|
|
1284
1437
|
toggle_class(div, "dropdown", /*results*/ ctx[1].length > 0);
|
|
1285
1438
|
},
|
|
1286
1439
|
m(target, anchor) {
|
|
1287
1440
|
insert(target, div, anchor);
|
|
1288
1441
|
mount_component(search, div, null);
|
|
1289
|
-
append(div,
|
|
1290
|
-
|
|
1291
|
-
|
|
1442
|
+
append(div, t0);
|
|
1443
|
+
append(div, ul);
|
|
1444
|
+
if (if_block0) if_block0.m(ul, null);
|
|
1445
|
+
append(ul, t1);
|
|
1446
|
+
if (if_block1) if_block1.m(ul, null);
|
|
1447
|
+
/*div_binding*/ ctx[35](div);
|
|
1292
1448
|
current = true;
|
|
1293
1449
|
|
|
1294
1450
|
if (!mounted) {
|
|
1295
|
-
dispose = listen(window, "click", /*click_handler*/ ctx[
|
|
1451
|
+
dispose = listen(window, "click", /*click_handler*/ ctx[21]);
|
|
1296
1452
|
mounted = true;
|
|
1297
1453
|
}
|
|
1298
1454
|
},
|
|
1299
1455
|
p(ctx, dirty) {
|
|
1300
|
-
const search_changes = (dirty[0] & /*id, $$restProps*/
|
|
1456
|
+
const search_changes = (dirty[0] & /*id, $$restProps, selectedIndex, hideDropdown, results*/ 614)
|
|
1301
1457
|
? get_spread_update(search_spread_levels, [
|
|
1302
1458
|
dirty[0] & /*id*/ 4 && { id: /*id*/ ctx[2] },
|
|
1303
|
-
|
|
1304
|
-
|
|
1459
|
+
search_spread_levels[1],
|
|
1460
|
+
dirty[0] & /*$$restProps*/ 512 && get_spread_object(/*$$restProps*/ ctx[9]),
|
|
1461
|
+
search_spread_levels[3],
|
|
1305
1462
|
dirty[0] & /*id*/ 4 && {
|
|
1306
1463
|
"aria-controls": "" + (/*id*/ ctx[2] + "-listbox")
|
|
1307
1464
|
},
|
|
1308
1465
|
dirty[0] & /*id*/ 4 && {
|
|
1309
1466
|
"aria-labelledby": "" + (/*id*/ ctx[2] + "-label")
|
|
1310
1467
|
},
|
|
1311
|
-
|
|
1468
|
+
dirty[0] & /*selectedIndex, hideDropdown, results, id*/ 102 && {
|
|
1469
|
+
"aria-activedescendant": /*selectedIndex*/ ctx[6] >= 0 && !/*hideDropdown*/ ctx[5] && /*results*/ ctx[1].length > 0
|
|
1470
|
+
? `${/*id*/ ctx[2]}-result-${/*selectedIndex*/ ctx[6]}`
|
|
1471
|
+
: null
|
|
1472
|
+
}
|
|
1312
1473
|
])
|
|
1313
1474
|
: {};
|
|
1314
1475
|
|
|
@@ -1327,28 +1488,59 @@
|
|
|
1327
1488
|
search.$set(search_changes);
|
|
1328
1489
|
|
|
1329
1490
|
if (!/*hideDropdown*/ ctx[5] && /*results*/ ctx[1].length > 0) {
|
|
1330
|
-
if (
|
|
1331
|
-
|
|
1491
|
+
if (if_block0) {
|
|
1492
|
+
if_block0.p(ctx, dirty);
|
|
1332
1493
|
|
|
1333
1494
|
if (dirty[0] & /*hideDropdown, results*/ 34) {
|
|
1334
|
-
transition_in(
|
|
1495
|
+
transition_in(if_block0, 1);
|
|
1335
1496
|
}
|
|
1336
1497
|
} else {
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
transition_in(
|
|
1340
|
-
|
|
1498
|
+
if_block0 = create_if_block_1(ctx);
|
|
1499
|
+
if_block0.c();
|
|
1500
|
+
transition_in(if_block0, 1);
|
|
1501
|
+
if_block0.m(ul, t1);
|
|
1341
1502
|
}
|
|
1342
|
-
} else if (
|
|
1503
|
+
} else if (if_block0) {
|
|
1343
1504
|
group_outros();
|
|
1344
1505
|
|
|
1345
|
-
transition_out(
|
|
1346
|
-
|
|
1506
|
+
transition_out(if_block0, 1, 1, () => {
|
|
1507
|
+
if_block0 = null;
|
|
1347
1508
|
});
|
|
1348
1509
|
|
|
1349
1510
|
check_outros();
|
|
1350
1511
|
}
|
|
1351
1512
|
|
|
1513
|
+
if (/*$$slots*/ ctx[8]["no-results"] && !/*hideDropdown*/ ctx[5] && /*value*/ ctx[0].length > 0 && /*results*/ ctx[1].length === 0) {
|
|
1514
|
+
if (if_block1) {
|
|
1515
|
+
if_block1.p(ctx, dirty);
|
|
1516
|
+
|
|
1517
|
+
if (dirty[0] & /*$$slots, hideDropdown, value, results*/ 291) {
|
|
1518
|
+
transition_in(if_block1, 1);
|
|
1519
|
+
}
|
|
1520
|
+
} else {
|
|
1521
|
+
if_block1 = create_if_block(ctx);
|
|
1522
|
+
if_block1.c();
|
|
1523
|
+
transition_in(if_block1, 1);
|
|
1524
|
+
if_block1.m(ul, null);
|
|
1525
|
+
}
|
|
1526
|
+
} else if (if_block1) {
|
|
1527
|
+
group_outros();
|
|
1528
|
+
|
|
1529
|
+
transition_out(if_block1, 1, 1, () => {
|
|
1530
|
+
if_block1 = null;
|
|
1531
|
+
});
|
|
1532
|
+
|
|
1533
|
+
check_outros();
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
if (!current || dirty[0] & /*id*/ 4 && ul_aria_labelledby_value !== (ul_aria_labelledby_value = "" + (/*id*/ ctx[2] + "-label"))) {
|
|
1537
|
+
attr(ul, "aria-labelledby", ul_aria_labelledby_value);
|
|
1538
|
+
}
|
|
1539
|
+
|
|
1540
|
+
if (!current || dirty[0] & /*id*/ 4 && ul_id_value !== (ul_id_value = "" + (/*id*/ ctx[2] + "-listbox"))) {
|
|
1541
|
+
attr(ul, "id", ul_id_value);
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1352
1544
|
if (!current || dirty[0] & /*id*/ 4 && div_aria_owns_value !== (div_aria_owns_value = "" + (/*id*/ ctx[2] + "-listbox"))) {
|
|
1353
1545
|
attr(div, "aria-owns", div_aria_owns_value);
|
|
1354
1546
|
}
|
|
@@ -1368,19 +1560,22 @@
|
|
|
1368
1560
|
i(local) {
|
|
1369
1561
|
if (current) return;
|
|
1370
1562
|
transition_in(search.$$.fragment, local);
|
|
1371
|
-
transition_in(
|
|
1563
|
+
transition_in(if_block0);
|
|
1564
|
+
transition_in(if_block1);
|
|
1372
1565
|
current = true;
|
|
1373
1566
|
},
|
|
1374
1567
|
o(local) {
|
|
1375
1568
|
transition_out(search.$$.fragment, local);
|
|
1376
|
-
transition_out(
|
|
1569
|
+
transition_out(if_block0);
|
|
1570
|
+
transition_out(if_block1);
|
|
1377
1571
|
current = false;
|
|
1378
1572
|
},
|
|
1379
1573
|
d(detaching) {
|
|
1380
1574
|
if (detaching) detach(div);
|
|
1381
1575
|
destroy_component(search);
|
|
1382
|
-
if (
|
|
1383
|
-
|
|
1576
|
+
if (if_block0) if_block0.d();
|
|
1577
|
+
if (if_block1) if_block1.d();
|
|
1578
|
+
/*div_binding*/ ctx[35](null);
|
|
1384
1579
|
mounted = false;
|
|
1385
1580
|
dispose();
|
|
1386
1581
|
}
|
|
@@ -1397,6 +1592,7 @@
|
|
|
1397
1592
|
|
|
1398
1593
|
let $$restProps = compute_rest_props($$props, omit_props_names);
|
|
1399
1594
|
let { $$slots: slots = {}, $$scope } = $$props;
|
|
1595
|
+
const $$slots = compute_slots(slots);
|
|
1400
1596
|
let { id = "typeahead-" + Math.random().toString(36) } = $$props;
|
|
1401
1597
|
let { value = "" } = $$props;
|
|
1402
1598
|
let { data = [] } = $$props;
|
|
@@ -1420,7 +1616,7 @@
|
|
|
1420
1616
|
$$invalidate(6, selectedIndex = 0);
|
|
1421
1617
|
}
|
|
1422
1618
|
|
|
1423
|
-
if (prevResults !== resultsId) {
|
|
1619
|
+
if (prevResults !== resultsId && !$$slots["no-results"]) {
|
|
1424
1620
|
$$invalidate(5, hideDropdown = results.length === 0);
|
|
1425
1621
|
}
|
|
1426
1622
|
|
|
@@ -1448,7 +1644,7 @@
|
|
|
1448
1644
|
}
|
|
1449
1645
|
|
|
1450
1646
|
const click_handler = ({ target }) => {
|
|
1451
|
-
if (!hideDropdown &&
|
|
1647
|
+
if (!hideDropdown && comboboxRef && !comboboxRef.contains(target)) {
|
|
1452
1648
|
$$invalidate(5, hideDropdown = true);
|
|
1453
1649
|
}
|
|
1454
1650
|
};
|
|
@@ -1464,19 +1660,19 @@
|
|
|
1464
1660
|
}
|
|
1465
1661
|
|
|
1466
1662
|
function type_handler(event) {
|
|
1467
|
-
bubble($$self, event);
|
|
1663
|
+
bubble.call(this, $$self, event);
|
|
1468
1664
|
}
|
|
1469
1665
|
|
|
1470
1666
|
function input_handler(event) {
|
|
1471
|
-
bubble($$self, event);
|
|
1667
|
+
bubble.call(this, $$self, event);
|
|
1472
1668
|
}
|
|
1473
1669
|
|
|
1474
1670
|
function change_handler(event) {
|
|
1475
|
-
bubble($$self, event);
|
|
1671
|
+
bubble.call(this, $$self, event);
|
|
1476
1672
|
}
|
|
1477
1673
|
|
|
1478
1674
|
function focus_handler(event) {
|
|
1479
|
-
bubble($$self, event);
|
|
1675
|
+
bubble.call(this, $$self, event);
|
|
1480
1676
|
}
|
|
1481
1677
|
|
|
1482
1678
|
const focus_handler_1 = () => {
|
|
@@ -1484,7 +1680,7 @@
|
|
|
1484
1680
|
};
|
|
1485
1681
|
|
|
1486
1682
|
function clear_handler(event) {
|
|
1487
|
-
bubble($$self, event);
|
|
1683
|
+
bubble.call(this, $$self, event);
|
|
1488
1684
|
}
|
|
1489
1685
|
|
|
1490
1686
|
const clear_handler_1 = () => {
|
|
@@ -1492,14 +1688,16 @@
|
|
|
1492
1688
|
};
|
|
1493
1689
|
|
|
1494
1690
|
function blur_handler(event) {
|
|
1495
|
-
bubble($$self, event);
|
|
1691
|
+
bubble.call(this, $$self, event);
|
|
1496
1692
|
}
|
|
1497
1693
|
|
|
1498
1694
|
function keydown_handler(event) {
|
|
1499
|
-
bubble($$self, event);
|
|
1695
|
+
bubble.call(this, $$self, event);
|
|
1500
1696
|
}
|
|
1501
1697
|
|
|
1502
1698
|
const keydown_handler_1 = e => {
|
|
1699
|
+
if (results.length === 0) return;
|
|
1700
|
+
|
|
1503
1701
|
switch (e.key) {
|
|
1504
1702
|
case "Enter":
|
|
1505
1703
|
select();
|
|
@@ -1535,7 +1733,7 @@
|
|
|
1535
1733
|
};
|
|
1536
1734
|
|
|
1537
1735
|
function div_binding($$value) {
|
|
1538
|
-
binding_callbacks[$$value ?
|
|
1736
|
+
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
|
|
1539
1737
|
comboboxRef = $$value;
|
|
1540
1738
|
$$invalidate(3, comboboxRef);
|
|
1541
1739
|
});
|
|
@@ -1543,34 +1741,34 @@
|
|
|
1543
1741
|
|
|
1544
1742
|
$$self.$$set = $$new_props => {
|
|
1545
1743
|
$$props = assign(assign({}, $$props), exclude_internal_props($$new_props));
|
|
1546
|
-
$$invalidate(
|
|
1547
|
-
if (
|
|
1548
|
-
if (
|
|
1549
|
-
if (
|
|
1550
|
-
if (
|
|
1551
|
-
if (
|
|
1552
|
-
if (
|
|
1553
|
-
if (
|
|
1554
|
-
if (
|
|
1555
|
-
if (
|
|
1556
|
-
if (
|
|
1557
|
-
if (
|
|
1558
|
-
if (
|
|
1744
|
+
$$invalidate(9, $$restProps = compute_rest_props($$props, omit_props_names));
|
|
1745
|
+
if ('id' in $$new_props) $$invalidate(2, id = $$new_props.id);
|
|
1746
|
+
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);
|
|
1753
|
+
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);
|
|
1559
1757
|
};
|
|
1560
1758
|
|
|
1561
1759
|
$$self.$$.update = () => {
|
|
1562
|
-
if ($$self.$$.dirty[0] & /*extract*/
|
|
1563
|
-
$$invalidate(
|
|
1760
|
+
if ($$self.$$.dirty[0] & /*extract*/ 2048) {
|
|
1761
|
+
$$invalidate(18, options = { pre: "<mark>", post: "</mark>", extract });
|
|
1564
1762
|
}
|
|
1565
1763
|
|
|
1566
|
-
if ($$self.$$.dirty[0] & /*value, data, options, limit, filter, disable*/
|
|
1764
|
+
if ($$self.$$.dirty[0] & /*value, data, options, limit, filter, disable*/ 406529) {
|
|
1567
1765
|
$$invalidate(1, results = fuzzy.filter(value, data, options).filter(({ score }) => score > 0).slice(0, limit).filter(result => !filter(result.original)).map(result => ({
|
|
1568
1766
|
...result,
|
|
1569
1767
|
disabled: disable(result.original)
|
|
1570
1768
|
})));
|
|
1571
1769
|
}
|
|
1572
1770
|
|
|
1573
|
-
if ($$self.$$.dirty[0] & /*results, extract*/
|
|
1771
|
+
if ($$self.$$.dirty[0] & /*results, extract*/ 2050) {
|
|
1574
1772
|
resultsId = results.map(result => extract(result.original)).join("");
|
|
1575
1773
|
}
|
|
1576
1774
|
};
|
|
@@ -1584,6 +1782,7 @@
|
|
|
1584
1782
|
hideDropdown,
|
|
1585
1783
|
selectedIndex,
|
|
1586
1784
|
select,
|
|
1785
|
+
$$slots,
|
|
1587
1786
|
$$restProps,
|
|
1588
1787
|
data,
|
|
1589
1788
|
extract,
|
|
@@ -1617,7 +1816,6 @@
|
|
|
1617
1816
|
class Typeahead extends SvelteComponent {
|
|
1618
1817
|
constructor(options) {
|
|
1619
1818
|
super();
|
|
1620
|
-
if (!document.getElementById("svelte-t0wd5r-style")) add_css();
|
|
1621
1819
|
|
|
1622
1820
|
init(
|
|
1623
1821
|
this,
|
|
@@ -1628,22 +1826,25 @@
|
|
|
1628
1826
|
{
|
|
1629
1827
|
id: 2,
|
|
1630
1828
|
value: 0,
|
|
1631
|
-
data:
|
|
1632
|
-
extract:
|
|
1633
|
-
disable:
|
|
1634
|
-
filter:
|
|
1635
|
-
autoselect:
|
|
1636
|
-
inputAfterSelect:
|
|
1829
|
+
data: 10,
|
|
1830
|
+
extract: 11,
|
|
1831
|
+
disable: 12,
|
|
1832
|
+
filter: 13,
|
|
1833
|
+
autoselect: 14,
|
|
1834
|
+
inputAfterSelect: 15,
|
|
1637
1835
|
results: 1,
|
|
1638
|
-
focusAfterSelect:
|
|
1639
|
-
limit:
|
|
1836
|
+
focusAfterSelect: 16,
|
|
1837
|
+
limit: 17
|
|
1640
1838
|
},
|
|
1839
|
+
add_css,
|
|
1641
1840
|
[-1, -1]
|
|
1642
1841
|
);
|
|
1643
1842
|
}
|
|
1644
1843
|
}
|
|
1645
1844
|
|
|
1646
|
-
|
|
1845
|
+
var Typeahead$1 = Typeahead;
|
|
1846
|
+
|
|
1847
|
+
exports['default'] = Typeahead$1;
|
|
1647
1848
|
|
|
1648
1849
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1649
1850
|
|