svelte-multiselect 11.3.0 → 11.5.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.
@@ -1,66 +0,0 @@
1
- import type { HTMLAttributes } from 'svelte/elements';
2
- declare function $$render<Action extends {
3
- label: string;
4
- action: (label: string) => void;
5
- } & Record<string, unknown> = {
6
- label: string;
7
- action: (label: string) => void;
8
- }>(): {
9
- props: Omit<import("./types").MultiSelectProps<Action>, "options"> & {
10
- actions: Action[];
11
- triggers?: string[];
12
- close_keys?: string[];
13
- fade_duration?: number;
14
- dialog_style?: string;
15
- open?: boolean;
16
- dialog?: HTMLDialogElement | null;
17
- input?: HTMLInputElement | null;
18
- placeholder?: string;
19
- dialog_props?: HTMLAttributes<HTMLDialogElement>;
20
- };
21
- exports: {};
22
- bindings: "dialog" | "input" | "open";
23
- slots: {};
24
- events: {};
25
- };
26
- declare class __sveltets_Render<Action extends {
27
- label: string;
28
- action: (label: string) => void;
29
- } & Record<string, unknown> = {
30
- label: string;
31
- action: (label: string) => void;
32
- }> {
33
- props(): ReturnType<typeof $$render<Action>>['props'];
34
- events(): ReturnType<typeof $$render<Action>>['events'];
35
- slots(): ReturnType<typeof $$render<Action>>['slots'];
36
- bindings(): "dialog" | "input" | "open";
37
- exports(): {};
38
- }
39
- interface $$IsomorphicComponent {
40
- new <Action extends {
41
- label: string;
42
- action: (label: string) => void;
43
- } & Record<string, unknown> = {
44
- label: string;
45
- action: (label: string) => void;
46
- }>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<Action>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<Action>['props']>, ReturnType<__sveltets_Render<Action>['events']>, ReturnType<__sveltets_Render<Action>['slots']>> & {
47
- $$bindings?: ReturnType<__sveltets_Render<Action>['bindings']>;
48
- } & ReturnType<__sveltets_Render<Action>['exports']>;
49
- <Action extends {
50
- label: string;
51
- action: (label: string) => void;
52
- } & Record<string, unknown> = {
53
- label: string;
54
- action: (label: string) => void;
55
- }>(internal: unknown, props: ReturnType<__sveltets_Render<Action>['props']> & {}): ReturnType<__sveltets_Render<Action>['exports']>;
56
- z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
57
- }
58
- declare const CmdPalette: $$IsomorphicComponent;
59
- type CmdPalette<Action extends {
60
- label: string;
61
- action: (label: string) => void;
62
- } & Record<string, unknown> = {
63
- label: string;
64
- action: (label: string) => void;
65
- }> = InstanceType<typeof CmdPalette<Action>>;
66
- export default CmdPalette;
@@ -1,87 +0,0 @@
1
- <script lang="ts">// see svelte.config.js where this component is passed to mdsvexamples
2
- import { Icon } from './';
3
- let { src = ``, meta = {}, open = $bindable(!meta.collapsible), title, example, code, link_props, // Applied after computed attributes (href, title, etc.), allowing override
4
- button_props, } = $props();
5
- let { id, collapsible, code_above, repl, github, repo, file } = $derived(meta);
6
- const links = { target: `_blank`, rel: `noreferrer` };
7
- </script>
8
-
9
- <nav>
10
- {#each [
11
- { cond: repl, href: repl, icon: `Svelte` },
12
- {
13
- cond: github && repo,
14
- href: file ? `${repo}/blob/-/${github == true ? file : github}` : repo,
15
- icon: `GitHub`,
16
- },
17
- ] as const as
18
- { cond, href, icon }
19
- (icon)
20
- }
21
- <a
22
- {href}
23
- {...links}
24
- title={icon}
25
- style:display={cond ? `inline-block` : `none`}
26
- {...link_props}
27
- >
28
- <Icon {icon} />
29
- </a>
30
- {/each}
31
- {#if collapsible}
32
- {@render title?.()}
33
- <button onclick={() => (open = !open)} {...button_props}>
34
- <Icon icon={open ? `Collapse` : `Expand`} />
35
- {open ? `Close` : `View code`}
36
- </button>
37
- {/if}
38
- </nav>
39
- <!-- wrap in div with id for precise CSS selectors in playwright E2E tests -->
40
- <div {id} class="code-example">
41
- {#if !code_above}
42
- {@render example?.()}
43
- {/if}
44
-
45
- <pre class:open>
46
- <code>{#if code}{@render code()}{:else}{src}{/if}</code></pre>
47
-
48
- {#if code_above}
49
- {@render example?.()}
50
- {/if}
51
- </div>
52
-
53
- <style>
54
- div.code-example {
55
- margin: var(--code-example-margin, 1em auto);
56
- position: relative;
57
- }
58
- nav {
59
- display: flex;
60
- justify-content: end;
61
- align-items: center;
62
- margin: var(--code-example-nav-margin, initial);
63
- gap: var(--code-example-nav-gap, 1ex);
64
- }
65
- pre code {
66
- background-color: transparent;
67
- display: inline-block;
68
- }
69
- pre {
70
- position: relative;
71
- overflow-x: auto;
72
- visibility: hidden;
73
- opacity: 0;
74
- max-height: 0;
75
- transition: max-height, opacity, visibility;
76
- transition-duration: var(--code-example-pre-transition-duration, 0.3s);
77
- border-radius: var(--code-example-pre-border-radius, 4pt);
78
- background-color: var(--code-example-pre-bg, var(--pre-bg));
79
- padding: var(--code-example-pre-padding, 1em);
80
- }
81
- pre.open {
82
- visibility: visible;
83
- opacity: 1;
84
- max-height: 9999vh;
85
- margin: var(--code-example-pre-margin, 1em 0 0 0);
86
- }
87
- </style>
@@ -1,25 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import type { HTMLAttributes } from 'svelte/elements';
3
- type $$ComponentProps = {
4
- src?: string;
5
- meta?: {
6
- collapsible?: boolean;
7
- code_above?: boolean;
8
- id?: string;
9
- repl?: string;
10
- github?: string | boolean;
11
- repo?: string;
12
- Wrapper?: string;
13
- example?: boolean;
14
- file?: string;
15
- };
16
- open?: boolean;
17
- title?: Snippet<[]>;
18
- example?: Snippet<[]>;
19
- code?: Snippet<[]>;
20
- link_props?: HTMLAttributes<HTMLAnchorElement>;
21
- button_props?: HTMLAttributes<HTMLButtonElement>;
22
- };
23
- declare const CodeExample: import("svelte").Component<$$ComponentProps, {}, "open">;
24
- type CodeExample = ReturnType<typeof CodeExample>;
25
- export default CodeExample;
@@ -1,73 +0,0 @@
1
- <script lang="ts">import { CopyButton, Icon } from './';
2
- import { mount } from 'svelte';
3
- let { content = ``, state = $bindable(`ready`), global_selector = null, global = false, skip_selector = `button`, as = `button`, labels = {
4
- ready: { icon: `Copy`, text: `` },
5
- success: { icon: `Check`, text: `` },
6
- error: { icon: `Alert`, text: `` },
7
- }, children, ...rest } = $props();
8
- $effect(() => {
9
- if (!global && !global_selector)
10
- return;
11
- const apply_copy_buttons = () => {
12
- const btn_style = `position: absolute; top: 6pt; right: 6pt; ${rest.style ?? ``}`;
13
- const skip_sel = skip_selector ?? as;
14
- for (const code of document.querySelectorAll(global_selector ?? `pre > code`)) {
15
- const pre = code.parentElement;
16
- const content = code.textContent ?? ``;
17
- if (pre && !pre.querySelector(`[data-sms-copy]`) &&
18
- !(skip_sel && pre.querySelector(skip_sel))) {
19
- mount(CopyButton, {
20
- target: pre,
21
- props: {
22
- content,
23
- as,
24
- labels,
25
- ...rest,
26
- style: btn_style,
27
- 'data-sms-copy': ``,
28
- },
29
- });
30
- }
31
- }
32
- };
33
- apply_copy_buttons();
34
- const observer = new MutationObserver(apply_copy_buttons);
35
- observer.observe(document.body, { childList: true, subtree: true });
36
- return () => observer.disconnect();
37
- });
38
- async function copy() {
39
- try {
40
- await navigator.clipboard.writeText(content);
41
- state = `success`;
42
- }
43
- catch (err) {
44
- console.error(err);
45
- state = `error`;
46
- }
47
- setTimeout(() => (state = `ready`), 2000);
48
- }
49
- </script>
50
-
51
- {#if !(global || global_selector)}
52
- {@const { text, icon } = labels[state]}
53
- <svelte:element
54
- this={as}
55
- onclick={copy}
56
- onkeydown={(event) => {
57
- if (event.key === `Enter` || event.key === ` `) {
58
- event.preventDefault()
59
- copy()
60
- }
61
- }}
62
- role="button"
63
- tabindex={0}
64
- data-sms-copy=""
65
- {...rest}
66
- >
67
- {#if children}
68
- {@render children({ state, icon, text })}
69
- {:else}
70
- <Icon {icon} />{@html text}
71
- {/if}
72
- </svelte:element>
73
- {/if}
@@ -1,25 +0,0 @@
1
- import { CopyButton } from './';
2
- import type { Snippet } from 'svelte';
3
- import type { HTMLAttributes } from 'svelte/elements';
4
- import type { IconName } from './icons';
5
- type State = `ready` | `success` | `error`;
6
- type $$ComponentProps = Omit<HTMLAttributes<HTMLButtonElement>, `children`> & {
7
- content?: string;
8
- state?: State;
9
- global_selector?: string | null;
10
- global?: boolean;
11
- skip_selector?: string | null;
12
- as?: string;
13
- labels?: Record<State, {
14
- icon: IconName;
15
- text: string;
16
- }>;
17
- children?: Snippet<[{
18
- state: State;
19
- icon: IconName;
20
- text: string;
21
- }]>;
22
- };
23
- declare const CopyButton: import("svelte").Component<$$ComponentProps, {}, "state">;
24
- type CopyButton = ReturnType<typeof CopyButton>;
25
- export default CopyButton;
@@ -1,52 +0,0 @@
1
- <script lang="ts">let { files = $bindable([]), toggle_all_btn_title = `Toggle all`, default_lang = `typescript`, as = `ol`, style = null, title_snippet, button_props, details_props, } = $props();
2
- function toggle_all() {
3
- const any_open = files.some((file) => file.node?.open);
4
- for (const file of files) {
5
- if (!file.node)
6
- continue;
7
- file.node.open = !any_open;
8
- }
9
- }
10
- export {};
11
- </script>
12
-
13
- {#if files?.length > 1}
14
- <button onclick={toggle_all} title={toggle_all_btn_title} {...button_props}>
15
- {files.some((file) => file.node?.open) ? `Close` : `Open`} all
16
- </button>
17
- {/if}
18
-
19
- <svelte:element this={as} {style}>
20
- {#each files as file, idx (file.title)}
21
- {@const { title, content, language = default_lang } = file ?? {}}
22
- <li>
23
- <!-- https://github.com/sveltejs/svelte/issues/12721#issuecomment-2269544690 -->
24
- <details bind:this={file.node} {...details_props}>
25
- {#if title || title_snippet}
26
- <summary>
27
- {#if title_snippet}
28
- {@render title_snippet({ idx, ...file })}
29
- {:else}
30
- {@html title}
31
- {/if}
32
- </summary>
33
- {/if}
34
-
35
- <pre class="language-{language}"><code>{content}</code></pre>
36
- <!-- <pre><code>{@html hljs.highlight(content, { language }).value}</code></pre> -->
37
- </details>
38
- </li>
39
- {/each}
40
- </svelte:element>
41
-
42
- <style>
43
- button {
44
- float: right;
45
- }
46
- ol {
47
- padding: 0;
48
- }
49
- ol > li {
50
- margin: 1ex 0;
51
- }
52
- </style>
@@ -1,23 +0,0 @@
1
- import type { Snippet } from 'svelte';
2
- import type { HTMLAttributes, HTMLDetailsAttributes } from 'svelte/elements';
3
- type File = {
4
- title: string;
5
- content: string;
6
- language?: string;
7
- node?: HTMLDetailsElement | null;
8
- };
9
- type $$ComponentProps = {
10
- files?: File[];
11
- toggle_all_btn_title?: string;
12
- default_lang?: string;
13
- as?: string;
14
- style?: string | null;
15
- title_snippet?: Snippet<[{
16
- idx: number;
17
- } & File]>;
18
- button_props?: HTMLAttributes<HTMLButtonElement>;
19
- details_props?: HTMLDetailsAttributes;
20
- };
21
- declare const FileDetails: import("svelte").Component<$$ComponentProps, {}, "files">;
22
- type FileDetails = ReturnType<typeof FileDetails>;
23
- export default FileDetails;
@@ -1,82 +0,0 @@
1
- <script lang="ts">"use strict";
2
- // Display an animated Octocat in a corner of the screen to link to the GitHub repo.
3
- let { href, title = `View code on GitHub`, aria_label = title, target = `_self`, color = null, fill = null, corner = `top-right`, style = ``, } = $props();
4
- </script>
5
-
6
- <a
7
- {href}
8
- {target}
9
- {title}
10
- aria-label={aria_label}
11
- {style}
12
- class={corner}
13
- style:color
14
- style:fill
15
- >
16
- <svg viewBox="0 0 250 250" aria-hidden="true">
17
- <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z" />
18
- <path
19
- d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
20
- fill="currentColor"
21
- style="transform-origin: 130px 106px"
22
- class="octo-arm"
23
- />
24
- <path
25
- d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
26
- fill="currentColor"
27
- class="octo-body"
28
- />
29
- </svg>
30
- </a>
31
-
32
- <style>
33
- a {
34
- position: fixed;
35
- z-index: 1;
36
- fill: var(--github-corner-bg, black);
37
- color: var(--github-corner-color, white);
38
- width: var(--github-corner-size, 70px);
39
- }
40
- a.top-right {
41
- top: 0;
42
- right: 0;
43
- }
44
- a.top-left {
45
- top: 0;
46
- left: 0;
47
- transform: rotate(-90deg);
48
- }
49
- a.bottom-left {
50
- bottom: 0;
51
- left: 0;
52
- transform: rotate(180deg);
53
- }
54
- a.bottom-right {
55
- bottom: 0;
56
- right: 0;
57
- transform: rotate(90deg);
58
- }
59
- a:hover .octo-arm {
60
- animation: octocat-wave 0.5s ease-in-out;
61
- }
62
- @keyframes octocat-wave {
63
- 0%,
64
- 100% {
65
- transform: rotate(0);
66
- }
67
- 20%,
68
- 60% {
69
- transform: rotate(-25deg);
70
- }
71
- 40%,
72
- 80% {
73
- transform: rotate(10deg);
74
- }
75
- }
76
- /* hide this component by default when printing since it would show up on every page */
77
- @media print {
78
- a {
79
- display: var(--github-corner-print-display, none);
80
- }
81
- }
82
- </style>
@@ -1,13 +0,0 @@
1
- type $$ComponentProps = {
2
- href: string;
3
- title?: string;
4
- aria_label?: string;
5
- target?: `_self` | `_blank`;
6
- color?: string | null;
7
- fill?: string | null;
8
- corner?: `top-left` | `top-right` | `bottom-left` | `bottom-right`;
9
- style?: string;
10
- };
11
- declare const GitHubCorner: import("svelte").Component<$$ComponentProps, {}, "">;
12
- type GitHubCorner = ReturnType<typeof GitHubCorner>;
13
- export default GitHubCorner;
package/dist/Icon.svelte DELETED
@@ -1,23 +0,0 @@
1
- <script lang="ts">import { icon_data } from './icons';
2
- let { icon, ...rest } = $props();
3
- const data = $derived.by(() => {
4
- if (!(icon in icon_data)) {
5
- console.error(`Icon '${icon}' not found`);
6
- return icon_data.Alert; // fallback
7
- }
8
- return icon_data[icon];
9
- });
10
- </script>
11
-
12
- <svg viewBox={data.viewBox} fill="currentColor" {...rest}>
13
- <path d={data.path} />
14
- </svg>
15
-
16
- <style>
17
- svg {
18
- width: 1em;
19
- height: 1em;
20
- display: inline-block;
21
- vertical-align: middle;
22
- }
23
- </style>
@@ -1,8 +0,0 @@
1
- import type { HTMLAttributes } from 'svelte/elements';
2
- import { type IconName } from './icons';
3
- type $$ComponentProps = HTMLAttributes<SVGSVGElement> & {
4
- icon: IconName;
5
- };
6
- declare const Icon: import("svelte").Component<$$ComponentProps, {}, "">;
7
- type Icon = ReturnType<typeof Icon>;
8
- export default Icon;