svelte-multiselect 4.0.4 → 4.0.5

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.
@@ -1,9 +1,8 @@
1
- <script >import { createEventDispatcher, onMount, tick } from 'svelte';
1
+ <script >import { createEventDispatcher, tick } from 'svelte';
2
2
  import { fly } from 'svelte/transition';
3
3
  import CircleSpinner from './CircleSpinner.svelte';
4
4
  import { CrossIcon, ExpandIcon, DisabledIcon } from './icons';
5
5
  import Wiggle from './Wiggle.svelte';
6
- export let selected = [];
7
6
  export let selectedLabels = [];
8
7
  export let selectedValues = [];
9
8
  export let searchText = ``;
@@ -13,6 +12,7 @@ export let maxSelectMsg = null;
13
12
  export let disabled = false;
14
13
  export let disabledTitle = `This field is disabled`;
15
14
  export let options;
15
+ export let selected = options.filter((op) => op?.preselected) ?? [];
16
16
  export let input = null;
17
17
  export let outerDiv = null;
18
18
  export let placeholder = undefined;
@@ -48,9 +48,6 @@ if (!(options?.length > 0))
48
48
  console.error(`MultiSelect missing options`);
49
49
  if (!Array.isArray(selected))
50
50
  console.error(`selected prop must be an array`);
51
- onMount(() => {
52
- selected = _options.filter((op) => op?.preselected) ?? [];
53
- });
54
51
  const dispatch = createEventDispatcher();
55
52
  function isObject(item) {
56
53
  return typeof item === `object` && !Array.isArray(item) && item !== null;
@@ -2,7 +2,6 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { Option, Primitive, ProtoOption } from './';
3
3
  declare const __propDef: {
4
4
  props: {
5
- selected?: Option[] | undefined;
6
5
  selectedLabels?: Primitive[] | undefined;
7
6
  selectedValues?: Primitive[] | undefined;
8
7
  searchText?: string | undefined;
@@ -12,6 +11,7 @@ declare const __propDef: {
12
11
  disabled?: boolean | undefined;
13
12
  disabledTitle?: string | undefined;
14
13
  options: ProtoOption[];
14
+ selected?: Option[] | undefined;
15
15
  input?: HTMLInputElement | null | undefined;
16
16
  outerDiv?: HTMLDivElement | null | undefined;
17
17
  placeholder?: string | undefined;
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "homepage": "https://svelte-multiselect.netlify.app",
6
6
  "repository": "https://github.com/janosh/svelte-multiselect",
7
7
  "license": "MIT",
8
- "version": "4.0.4",
8
+ "version": "4.0.5",
9
9
  "type": "module",
10
10
  "svelte": "index.js",
11
11
  "bugs": "https://github.com/janosh/svelte-multiselect/issues",
@@ -30,7 +30,7 @@
30
30
  "svelte-check": "^2.4.6",
31
31
  "svelte-github-corner": "^0.1.0",
32
32
  "svelte-preprocess": "^4.10.4",
33
- "svelte-toc": "^0.2.8",
33
+ "svelte-toc": "^0.2.9",
34
34
  "svelte2tsx": "^0.5.6",
35
35
  "tslib": "^2.3.1",
36
36
  "typescript": "^4.6.2",
package/readme.md CHANGED
@@ -381,7 +381,7 @@ export default {
381
381
  }
382
382
  ```
383
383
 
384
- Here's a [Stackblitz example](https://stackblitz.com/fork/github/davipon/test-svelte-multiselect?initialPath=__vitest__) that also uses [`'vitest-svelte-kit'`](https://github.com/nickbreaton/vitest-svelte-kit).
384
+ Here's a [Stackblitz example](https://stackblitz.com/fork/github/davipon/test-svelte-multiselect?initialPath=__vitest__) that also uses [`vitest-svelte-kit`](https://github.com/nickbreaton/vitest-svelte-kit).
385
385
 
386
386
  ## Want to contribute?
387
387