svelte-multiselect 8.0.1 → 8.0.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.
@@ -301,7 +301,8 @@ function on_click_outside(event) {
301
301
  <!-- bind:value={selected} prevents form submission if required prop is true and no options are selected -->
302
302
  <input
303
303
  {required}
304
- bind:value={selected}
304
+ {name}
305
+ value={selected.length > 0 ? JSON.stringify(selected) : null}
305
306
  tabindex="-1"
306
307
  aria-hidden="true"
307
308
  aria-label="ignore this, used only to prevent form submission if select is required but empty"
@@ -344,7 +345,6 @@ function on_click_outside(event) {
344
345
  on:focus
345
346
  on:focus={open_dropdown}
346
347
  {id}
347
- {name}
348
348
  {disabled}
349
349
  {inputmode}
350
350
  {pattern}
package/Wiggle.svelte CHANGED
@@ -9,9 +9,9 @@ export let dy = 0; // try 10
9
9
  export let duration = 200;
10
10
  export let stiffness = 0.05;
11
11
  export let damping = 0.1;
12
- let restState = { angle: 0, scale: 1, dx: 0, dy: 0 };
13
- let store = spring(restState, { stiffness, damping });
14
- $: store.set(wiggle ? { scale, angle, dx, dy } : restState);
12
+ let rest_state = { angle: 0, scale: 1, dx: 0, dy: 0 };
13
+ let store = spring(rest_state, { stiffness, damping });
14
+ $: store.set(wiggle ? { scale, angle, dx, dy } : rest_state);
15
15
  $: if (wiggle)
16
16
  setTimeout(() => (wiggle = false), duration);
17
17
  </script>
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": "8.0.1",
8
+ "version": "8.0.2",
9
9
  "type": "module",
10
10
  "svelte": "index.js",
11
11
  "main": "index.js",
@@ -13,31 +13,32 @@
13
13
  "devDependencies": {
14
14
  "@iconify/svelte": "^3.0.0",
15
15
  "@playwright/test": "^1.27.1",
16
- "@sveltejs/adapter-static": "^1.0.0-next.44",
17
- "@sveltejs/kit": "^1.0.0-next.516",
18
- "@sveltejs/package": "^1.0.0-next.5",
19
- "@sveltejs/vite-plugin-svelte": "^1.0.9",
20
- "@typescript-eslint/eslint-plugin": "^5.40.0",
21
- "@typescript-eslint/parser": "^5.40.0",
22
- "eslint": "^8.25.0",
16
+ "@sveltejs/adapter-static": "1.0.0-next.48",
17
+ "@sveltejs/kit": "1.0.0-next.538",
18
+ "@sveltejs/package": "1.0.0-next.5",
19
+ "@sveltejs/vite-plugin-svelte": "^1.1.0",
20
+ "@typescript-eslint/eslint-plugin": "^5.42.1",
21
+ "@typescript-eslint/parser": "^5.42.1",
22
+ "eslint": "^8.27.0",
23
23
  "eslint-plugin-svelte3": "^4.0.0",
24
24
  "hastscript": "^7.1.0",
25
- "jsdom": "^20.0.1",
25
+ "highlight.js": "^11.6.0",
26
+ "jsdom": "^20.0.2",
26
27
  "mdsvex": "^0.10.6",
27
28
  "prettier": "^2.7.1",
28
29
  "prettier-plugin-svelte": "^2.8.0",
29
30
  "rehype-autolink-headings": "^6.1.1",
30
- "rehype-slug": "^5.0.1",
31
+ "rehype-slug": "^5.1.0",
31
32
  "svelte": "^3.52.0",
32
33
  "svelte-check": "^2.9.2",
33
34
  "svelte-github-corner": "^0.1.0",
34
- "svelte-preprocess": "^4.10.6",
35
- "svelte-toc": "^0.4.0",
35
+ "svelte-preprocess": "^4.10.7",
36
+ "svelte-toc": "^0.4.1",
36
37
  "svelte2tsx": "^0.5.20",
37
- "tslib": "^2.4.0",
38
+ "tslib": "^2.4.1",
38
39
  "typescript": "^4.8.4",
39
- "vite": "^3.1.8",
40
- "vitest": "^0.24.3"
40
+ "vite": "^3.2.3",
41
+ "vitest": "^0.25.0"
41
42
  },
42
43
  "keywords": [
43
44
  "svelte",
package/readme.md CHANGED
@@ -14,10 +14,10 @@
14
14
 
15
15
  </h4>
16
16
 
17
- **Keyboard-friendly, accessible and highly customizable multi-select component.**
18
- <span class="hide-in-docs">
19
- <a href="https://svelte-multiselect.netlify.app">View the docs</a>
20
- </span>
17
+ <p align="center"><strong>
18
+ Keyboard-friendly, accessible and highly customizable multi-select component.
19
+ <a class="hide-in-docs" href="https://svelte-multiselect.netlify.app">View the docs</a>
20
+ </strong></p>
21
21
 
22
22
  <slot name="examples" />
23
23
 
@@ -148,7 +148,7 @@ Full list of props/bindable variables for this component. The `Option` type you
148
148
  duplicates: boolean = false
149
149
  ```
150
150
 
151
- Whether to allow users to select duplicate options. Applies only to the selected item list, not the options dropdown. Keeping that free of duplicates is left to developer. The selected item list can have duplicates if `allowUserOptions` is truthy, `duplicates` is ` true` and users create the same option multiple times. Use `duplicateOptionMsg` to customize the message shown to user if `duplicates` is `false` and users attempt this and `duplicateFunc` to customize when a pair of options is considered a duplicate.
151
+ Whether to allow users to select duplicate options. Applies only to the selected item list, not the options dropdown. Keeping that free of duplicates is left to developer. The selected item list can have duplicates if `allowUserOptions` is truthy, `duplicates` is `true` and users create the same option multiple times. Use `duplicateOptionMsg` to customize the message shown to user if `duplicates` is `false` and users attempt this and `duplicateFunc` to customize when a pair of options is considered a duplicate.
152
152
 
153
153
  1. ```ts
154
154
  duplicateOptionMsg: string = `This option is already selected`
@@ -215,9 +215,9 @@ Full list of props/bindable variables for this component. The `Option` type you
215
215
 
216
216
  1. ```ts
217
217
  maxSelectMsg: ((current: number, max: number) => string) | null = (
218
- current: number,
219
- max: number
220
- ) => (max > 1 ? `${current}/${max}` : ``)
218
+ current: number,
219
+ max: number
220
+ ) => (max > 1 ? `${current}/${max}` : ``)
221
221
  ```
222
222
 
223
223
  Inform users how many of the maximum allowed options they have already selected. Set `maxSelectMsg={null}` to not show a message. Defaults to `null` when `maxSelect={1}` or `maxSelect={null}`. Else if `maxSelect > 1`, defaults to:
@@ -230,7 +230,7 @@ Full list of props/bindable variables for this component. The `Option` type you
230
230
  name: string | null = null
231
231
  ```
232
232
 
233
- Applied to the `<input>` element. Sets the key of this field in a submitted form data object. Not useful at the moment since the value is stored in Svelte state, not on the `<input>` node.
233
+ Applied to the `<input>` element. Sets the key of this field in a submitted form data object. See [form example](https://svelte-multiselect.netlify.app/form).
234
234
 
235
235
  1. ```ts
236
236
  noMatchingOptionsMsg: string = `No matching options`
@@ -425,7 +425,8 @@ TypeScript users can import the types used for internal type safety:
425
425
 
426
426
  ```svelte
427
427
  <script lang="ts">
428
- import MultiSelect, { Option, ObjectOption } from 'svelte-multiselect'
428
+ import MultiSelect from 'svelte-multiselect'
429
+ import type { Option, ObjectOption } from 'svelte-multiselect'
429
430
 
430
431
  const myOptions: ObjectOption[] = [
431
432
  { label: 'foo', value: 42 },
@@ -585,40 +586,6 @@ Odd as it may seem, you get the most fine-grained control over the styling of ev
585
586
  }
586
587
  ```
587
588
 
588
- ## Downstream testing
589
-
590
- To test a Svelte component which imports `svelte-multiselect`, you need to configure your test runner to avoid [transpiling issues](https://github.com/janosh/svelte-multiselect/issues/48).
591
-
592
- For Jest, exclude `svelte-multiselect` from `transformIgnorePatterns` in your `jest.config.json`:
593
-
594
- ```json
595
- {
596
- "transformIgnorePatterns": ["node_modules/?!(svelte-multiselect)"],
597
- "transform": {
598
- "^.+\\.[t|j]s?$": "esbuild-jest",
599
- "^.+\\.svelte$": ["svelte-jester", { "preprocess": true }]
600
- }
601
- }
602
- ```
603
-
604
- For Vitest, include `svelte-multiselect` in `deps.inline`:
605
-
606
- ```ts
607
- // vite.config.ts
608
- import { svelte } from '@sveltejs/vite-plugin-svelte'
609
-
610
- export default {
611
- plugins: [svelte({ hot: !process.env.VITEST })],
612
- test: {
613
- deps: {
614
- inline: [/svelte-multiselect/],
615
- },
616
- },
617
- }
618
- ```
619
-
620
- 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).
621
-
622
589
  ## Want to contribute?
623
590
 
624
591
  To submit a PR, clone the repo, install dependencies and start the dev server to try out your changes.
@@ -626,6 +593,6 @@ To submit a PR, clone the repo, install dependencies and start the dev server to
626
593
  ```sh
627
594
  git clone https://github.com/janosh/svelte-multiselect
628
595
  cd svelte-multiselect
629
- npm install
630
- npm run dev
596
+ pnpm install
597
+ pnpm dev
631
598
  ```