svelte-multiselect 11.5.1 → 11.5.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/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './attachments';
2
+ export * from './heading-anchors';
2
3
  export { default as CircleSpinner } from './CircleSpinner.svelte';
3
4
  export { default as CmdPalette } from './CmdPalette.svelte';
4
5
  export { default as CodeExample } from './CodeExample.svelte';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './attachments';
2
+ export * from './heading-anchors';
2
3
  export { default as CircleSpinner } from './CircleSpinner.svelte';
3
4
  export { default as CmdPalette } from './CmdPalette.svelte';
4
5
  export { default as CodeExample } from './CodeExample.svelte';
package/dist/types.d.ts CHANGED
@@ -62,6 +62,22 @@ export interface MultiSelectEvents<T extends Option = Option> {
62
62
  onexpandAll?: (data: {
63
63
  groups: string[];
64
64
  }) => unknown;
65
+ onsearch?: (data: {
66
+ searchText: string;
67
+ matchingCount: number;
68
+ }) => unknown;
69
+ onmaxreached?: (data: {
70
+ selected: T[];
71
+ maxSelect: number;
72
+ attemptedOption: T;
73
+ }) => unknown;
74
+ onduplicate?: (data: {
75
+ option: T;
76
+ }) => unknown;
77
+ onactivate?: (data: {
78
+ option: T | null;
79
+ index: number | null;
80
+ }) => unknown;
65
81
  }
66
82
  export interface LoadOptionsParams {
67
83
  search: string;
@@ -213,4 +229,18 @@ export interface KeyboardShortcuts {
213
229
  open?: string | null;
214
230
  close?: string | null;
215
231
  }
232
+ export interface NavRouteObject {
233
+ href: string;
234
+ label?: string;
235
+ children?: string[];
236
+ disabled?: boolean | string;
237
+ separator?: boolean;
238
+ align?: `left` | `right`;
239
+ external?: boolean;
240
+ tooltip?: string;
241
+ class?: string;
242
+ style?: string;
243
+ [key: string]: unknown;
244
+ }
245
+ export type NavRoute = string | [string, string] | [string, string[]] | NavRouteObject;
216
246
  export {};
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "homepage": "https://janosh.github.io/svelte-multiselect",
6
6
  "repository": "https://github.com/janosh/svelte-multiselect",
7
7
  "license": "MIT",
8
- "version": "11.5.1",
8
+ "version": "11.5.2",
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "dev": "vite dev",
@@ -14,7 +14,7 @@
14
14
  "test": "vitest --run && playwright test",
15
15
  "check": "svelte-check",
16
16
  "package": "svelte-package",
17
- "prepublishOnly": "svelte-package && test -d dist"
17
+ "prepublishOnly": "svelte-package"
18
18
  },
19
19
  "svelte": "./dist/index.js",
20
20
  "bugs": "https://github.com/janosh/svelte-multiselect/issues",
@@ -23,30 +23,27 @@
23
23
  },
24
24
  "devDependencies": {
25
25
  "@playwright/test": "^1.57.0",
26
- "@stylistic/eslint-plugin": "^5.6.1",
26
+ "@stylistic/eslint-plugin": "^5.7.0",
27
27
  "@sveltejs/adapter-static": "^3.0.10",
28
- "@sveltejs/kit": "^2.49.2",
28
+ "@sveltejs/kit": "^2.50.0",
29
29
  "@sveltejs/package": "2.5.7",
30
- "@sveltejs/vite-plugin-svelte": "^6.2.1",
31
- "@types/node": "^25.0.3",
32
- "@vitest/coverage-v8": "^4.0.16",
30
+ "@sveltejs/vite-plugin-svelte": "^6.2.4",
31
+ "@types/node": "^25.0.9",
32
+ "@vitest/coverage-v8": "^4.0.17",
33
33
  "eslint": "^9.39.2",
34
- "eslint-plugin-svelte": "^3.13.1",
35
- "happy-dom": "^20.0.11",
36
- "hastscript": "^9.0.1",
34
+ "eslint-plugin-svelte": "^3.14.0",
35
+ "happy-dom": "^20.3.1",
37
36
  "mdsvex": "^0.12.6",
38
- "mdsvexamples": "^0.5.0",
39
- "rehype-autolink-headings": "^7.1.0",
40
- "rehype-slug": "^6.0.0",
41
- "svelte": "^5.46.1",
37
+ "mdsvexamples": "^0.5.1",
38
+ "svelte": "^5.46.4",
42
39
  "svelte-check": "^4.3.5",
43
40
  "svelte-preprocess": "^6.0.3",
44
41
  "svelte-toc": "^0.6.2",
45
42
  "svelte2tsx": "^0.7.46",
46
43
  "typescript": "5.9.3",
47
- "typescript-eslint": "^8.51.0",
48
- "vite": "^7.3.0",
49
- "vitest": "^4.0.16"
44
+ "typescript-eslint": "^8.53.0",
45
+ "vite": "^7.3.1",
46
+ "vitest": "^4.0.17"
50
47
  },
51
48
  "keywords": [
52
49
  "svelte",
@@ -72,6 +69,10 @@
72
69
  "./attachments": {
73
70
  "types": "./dist/attachments.d.ts",
74
71
  "default": "./dist/attachments.js"
72
+ },
73
+ "./heading-anchors": {
74
+ "types": "./dist/heading-anchors.d.ts",
75
+ "default": "./dist/heading-anchors.js"
75
76
  }
76
77
  },
77
78
  "types": "./dist/index.d.ts",
package/readme.md CHANGED
@@ -802,6 +802,30 @@ Example using several snippets:
802
802
 
803
803
  Triggers when the dropdown list of options disappears. `event` is the DOM's `FocusEvent`, `KeyboardEvent` or `ClickEvent` that triggered the close.
804
804
 
805
+ 1. ```ts
806
+ onsearch={({ searchText, matchingCount }) => console.log(searchText, matchingCount)}
807
+ ```
808
+
809
+ Triggers (debounced, 150ms) when the search text changes. Useful for analytics or loading remote options. `searchText` is the current input value, `matchingCount` is the number of options that match.
810
+
811
+ 1. ```ts
812
+ onmaxreached={({ selected, maxSelect, attemptedOption }) => console.log(attemptedOption)}
813
+ ```
814
+
815
+ Triggers when a user tries to select more options than `maxSelect` allows. Useful for showing feedback. Does not fire for `maxSelect=1` (which uses replace behavior).
816
+
817
+ 1. ```ts
818
+ onduplicate={({ option }) => console.log(`Duplicate:`, option)}
819
+ ```
820
+
821
+ Triggers when a user tries to add an already-selected option (when `duplicates=false`). Useful for showing feedback to the user.
822
+
823
+ 1. ```ts
824
+ onactivate={({ option, index }) => console.log(`Active:`, option, index)}
825
+ ```
826
+
827
+ Triggers during keyboard navigation (ArrowUp/ArrowDown) through options. `option` is the newly active option, `index` is its position. Does not fire on mouse hover.
828
+
805
829
  For example, here's how you might annoy your users with an alert every time one or more options are added or removed:
806
830
 
807
831
  ```svelte
@@ -987,7 +1011,7 @@ This simplified version of the DOM structure of the component shows where these
987
1011
 
988
1012
  ### With global CSS
989
1013
 
990
- Odd as it may seem, you get the most fine-grained control over the styling of every part of this component by using the following `:global()` CSS selectors. `ul.selected` is the list of currently selected options rendered inside the component's input whereas `ul.options` is the list of available options that slides out when the component is in its `open` state. See also [simplified DOM structure](#--styling).
1014
+ Odd as it may seem, you get the most fine-grained control over the styling of every part of this component by using the following `:global()` CSS selectors. `ul.selected` is the list of currently selected options rendered inside the component's input whereas `ul.options` is the list of available options that slides out when the component is in its `open` state. See also [simplified DOM structure](#styling).
991
1015
 
992
1016
  ```css
993
1017
  :global(div.multiselect) {