svelte-multiselect 11.2.4 → 11.4.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/dist/CircleSpinner.svelte.d.ts +3 -3
- package/dist/CmdPalette.svelte +8 -5
- package/dist/CmdPalette.svelte.d.ts +61 -16
- package/dist/CodeExample.svelte +12 -7
- package/dist/CodeExample.svelte.d.ts +6 -3
- package/dist/CopyButton.svelte +4 -3
- package/dist/CopyButton.svelte.d.ts +4 -4
- package/dist/FileDetails.svelte +3 -3
- package/dist/FileDetails.svelte.d.ts +6 -3
- package/dist/GitHubCorner.svelte +2 -2
- package/dist/GitHubCorner.svelte.d.ts +3 -3
- package/dist/Icon.svelte.d.ts +3 -3
- package/dist/MultiSelect.svelte +328 -153
- package/dist/MultiSelect.svelte.d.ts +9 -9
- package/dist/Nav.svelte +444 -0
- package/dist/Nav.svelte.d.ts +42 -0
- package/dist/PrevNext.svelte +3 -3
- package/dist/PrevNext.svelte.d.ts +51 -31
- package/dist/Toggle.svelte +2 -7
- package/dist/Toggle.svelte.d.ts +4 -9
- package/dist/Wiggle.svelte.d.ts +3 -3
- package/dist/attachments.d.ts +17 -9
- package/dist/attachments.js +80 -22
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/types.d.ts +33 -4
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +5 -3
- package/package.json +23 -16
- package/readme.md +84 -8
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
type $$ComponentProps = {
|
|
2
2
|
color?: string;
|
|
3
3
|
duration?: string;
|
|
4
4
|
size?: string;
|
|
5
|
-
}
|
|
6
|
-
declare const CircleSpinner: import("svelte").Component
|
|
5
|
+
};
|
|
6
|
+
declare const CircleSpinner: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
7
|
type CircleSpinner = ReturnType<typeof CircleSpinner>;
|
|
8
8
|
export default CircleSpinner;
|
package/dist/CmdPalette.svelte
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="Action extends { label: string; action: (label: string) => void } & Record<string, unknown> = { label: string; action: (label: string) => void }"
|
|
4
|
+
>import { fade } from 'svelte/transition';
|
|
2
5
|
import MultiSelect from './MultiSelect.svelte';
|
|
3
|
-
let { actions, triggers = [`k`], close_keys = [`Escape`], fade_duration = 200, dialog_style = ``, open = $bindable(false), dialog = $bindable(null), input = $bindable(null), placeholder = `Filter actions...`, ...rest } = $props();
|
|
6
|
+
let { actions, triggers = [`k`], close_keys = [`Escape`], fade_duration = 200, dialog_style = ``, open = $bindable(false), dialog = $bindable(null), input = $bindable(null), placeholder = `Filter actions...`, dialog_props, ...rest } = $props();
|
|
4
7
|
$effect(() => {
|
|
5
8
|
if (open && input && document.activeElement !== input)
|
|
6
9
|
input.focus();
|
|
@@ -22,10 +25,9 @@ function close_if_outside(event) {
|
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
function trigger_action_and_close({ option }) {
|
|
25
|
-
|
|
26
|
-
if (!action)
|
|
28
|
+
if (!option?.action)
|
|
27
29
|
return;
|
|
28
|
-
action(label);
|
|
30
|
+
option.action(option.label);
|
|
29
31
|
open = false;
|
|
30
32
|
}
|
|
31
33
|
</script>
|
|
@@ -38,6 +40,7 @@ function trigger_action_and_close({ option }) {
|
|
|
38
40
|
bind:this={dialog}
|
|
39
41
|
transition:fade={{ duration: fade_duration }}
|
|
40
42
|
style={dialog_style}
|
|
43
|
+
{...dialog_props}
|
|
41
44
|
>
|
|
42
45
|
<MultiSelect
|
|
43
46
|
options={actions}
|
|
@@ -1,21 +1,66 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
import type { ObjectOption } from './types';
|
|
4
|
-
interface Action extends ObjectOption {
|
|
1
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
|
+
declare function $$render<Action extends {
|
|
5
3
|
label: string;
|
|
6
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(): {};
|
|
7
38
|
}
|
|
8
|
-
interface
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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']>;
|
|
18
57
|
}
|
|
19
|
-
declare const CmdPalette:
|
|
20
|
-
type CmdPalette
|
|
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>>;
|
|
21
66
|
export default CmdPalette;
|
package/dist/CodeExample.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<script lang="ts"
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<script lang="ts">import Icon from './Icon.svelte';
|
|
2
|
+
let { src = ``, meta = {}, open = $bindable(!meta.collapsible), title, example, code, link_props, // Applied after computed attributes (href, title, etc.), allowing override
|
|
3
|
+
button_props, } = $props();
|
|
4
4
|
let { id, collapsible, code_above, repl, github, repo, file } = $derived(meta);
|
|
5
5
|
const links = { target: `_blank`, rel: `noreferrer` };
|
|
6
6
|
</script>
|
|
@@ -17,13 +17,19 @@ const links = { target: `_blank`, rel: `noreferrer` };
|
|
|
17
17
|
{ cond, href, icon }
|
|
18
18
|
(icon)
|
|
19
19
|
}
|
|
20
|
-
<a
|
|
20
|
+
<a
|
|
21
|
+
{href}
|
|
22
|
+
{...links}
|
|
23
|
+
title={icon}
|
|
24
|
+
style:display={cond ? `inline-block` : `none`}
|
|
25
|
+
{...link_props}
|
|
26
|
+
>
|
|
21
27
|
<Icon {icon} />
|
|
22
28
|
</a>
|
|
23
29
|
{/each}
|
|
24
30
|
{#if collapsible}
|
|
25
31
|
{@render title?.()}
|
|
26
|
-
<button onclick={() => (open = !open)}>
|
|
32
|
+
<button onclick={() => (open = !open)} {...button_props}>
|
|
27
33
|
<Icon icon={open ? `Collapse` : `Expand`} />
|
|
28
34
|
{open ? `Close` : `View code`}
|
|
29
35
|
</button>
|
|
@@ -35,8 +41,7 @@ const links = { target: `_blank`, rel: `noreferrer` };
|
|
|
35
41
|
{@render example?.()}
|
|
36
42
|
{/if}
|
|
37
43
|
|
|
38
|
-
<pre class:open>
|
|
39
|
-
<code>{#if code}{@render code()}{:else}{src}{/if}</code></pre>
|
|
44
|
+
<pre class:open><code>{#if code}{@render code()}{:else}{src}{/if}</code></pre>
|
|
40
45
|
|
|
41
46
|
{#if code_above}
|
|
42
47
|
{@render example?.()}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
-
|
|
2
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
type $$ComponentProps = {
|
|
3
4
|
src?: string;
|
|
4
5
|
meta?: {
|
|
5
6
|
collapsible?: boolean;
|
|
@@ -16,7 +17,9 @@ interface Props {
|
|
|
16
17
|
title?: Snippet<[]>;
|
|
17
18
|
example?: Snippet<[]>;
|
|
18
19
|
code?: Snippet<[]>;
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
link_props?: HTMLAttributes<HTMLAnchorElement>;
|
|
21
|
+
button_props?: HTMLAttributes<HTMLButtonElement>;
|
|
22
|
+
};
|
|
23
|
+
declare const CodeExample: import("svelte").Component<$$ComponentProps, {}, "open">;
|
|
21
24
|
type CodeExample = ReturnType<typeof CodeExample>;
|
|
22
25
|
export default CodeExample;
|
package/dist/CopyButton.svelte
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
2
|
-
import
|
|
1
|
+
<script lang="ts">import { mount } from 'svelte';
|
|
2
|
+
import CopyButton from './CopyButton.svelte';
|
|
3
|
+
import Icon from './Icon.svelte';
|
|
3
4
|
let { content = ``, state = $bindable(`ready`), global_selector = null, global = false, skip_selector = `button`, as = `button`, labels = {
|
|
4
5
|
ready: { icon: `Copy`, text: `` },
|
|
5
6
|
success: { icon: `Check`, text: `` },
|
|
@@ -9,7 +10,7 @@ $effect(() => {
|
|
|
9
10
|
if (!global && !global_selector)
|
|
10
11
|
return;
|
|
11
12
|
const apply_copy_buttons = () => {
|
|
12
|
-
const btn_style = `position: absolute; top:
|
|
13
|
+
const btn_style = `position: absolute; top: 6pt; right: 6pt; ${rest.style ?? ``}`;
|
|
13
14
|
const skip_sel = skip_selector ?? as;
|
|
14
15
|
for (const code of document.querySelectorAll(global_selector ?? `pre > code`)) {
|
|
15
16
|
const pre = code.parentElement;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CopyButton } from './';
|
|
2
1
|
import type { Snippet } from 'svelte';
|
|
3
2
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
3
|
+
import CopyButton from './CopyButton.svelte';
|
|
4
4
|
import type { IconName } from './icons';
|
|
5
5
|
type State = `ready` | `success` | `error`;
|
|
6
|
-
|
|
6
|
+
type $$ComponentProps = Omit<HTMLAttributes<HTMLButtonElement>, `children`> & {
|
|
7
7
|
content?: string;
|
|
8
8
|
state?: State;
|
|
9
9
|
global_selector?: string | null;
|
|
@@ -19,7 +19,7 @@ interface Props extends Omit<HTMLAttributes<HTMLButtonElement>, `children`> {
|
|
|
19
19
|
icon: IconName;
|
|
20
20
|
text: string;
|
|
21
21
|
}]>;
|
|
22
|
-
}
|
|
23
|
-
declare const CopyButton: import("svelte").Component
|
|
22
|
+
};
|
|
23
|
+
declare const CopyButton: import("svelte").Component<$$ComponentProps, {}, "state">;
|
|
24
24
|
type CopyButton = ReturnType<typeof CopyButton>;
|
|
25
25
|
export default CopyButton;
|
package/dist/FileDetails.svelte
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts">let { files = $bindable([]), toggle_all_btn_title = `Toggle all`, default_lang = `typescript`, as = `ol`, style = null, title_snippet, } = $props();
|
|
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
2
|
function toggle_all() {
|
|
3
3
|
const any_open = files.some((file) => file.node?.open);
|
|
4
4
|
for (const file of files) {
|
|
@@ -11,7 +11,7 @@ export {};
|
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
{#if files?.length > 1}
|
|
14
|
-
<button onclick={toggle_all} title={toggle_all_btn_title}>
|
|
14
|
+
<button onclick={toggle_all} title={toggle_all_btn_title} {...button_props}>
|
|
15
15
|
{files.some((file) => file.node?.open) ? `Close` : `Open`} all
|
|
16
16
|
</button>
|
|
17
17
|
{/if}
|
|
@@ -21,7 +21,7 @@ export {};
|
|
|
21
21
|
{@const { title, content, language = default_lang } = file ?? {}}
|
|
22
22
|
<li>
|
|
23
23
|
<!-- https://github.com/sveltejs/svelte/issues/12721#issuecomment-2269544690 -->
|
|
24
|
-
<details bind:this={file.node}>
|
|
24
|
+
<details bind:this={file.node} {...details_props}>
|
|
25
25
|
{#if title || title_snippet}
|
|
26
26
|
<summary>
|
|
27
27
|
{#if title_snippet}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { HTMLAttributes, HTMLDetailsAttributes } from 'svelte/elements';
|
|
2
3
|
type File = {
|
|
3
4
|
title: string;
|
|
4
5
|
content: string;
|
|
5
6
|
language?: string;
|
|
6
7
|
node?: HTMLDetailsElement | null;
|
|
7
8
|
};
|
|
8
|
-
|
|
9
|
+
type $$ComponentProps = {
|
|
9
10
|
files?: File[];
|
|
10
11
|
toggle_all_btn_title?: string;
|
|
11
12
|
default_lang?: string;
|
|
@@ -14,7 +15,9 @@ interface Props {
|
|
|
14
15
|
title_snippet?: Snippet<[{
|
|
15
16
|
idx: number;
|
|
16
17
|
} & File]>;
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
button_props?: HTMLAttributes<HTMLButtonElement>;
|
|
19
|
+
details_props?: HTMLDetailsAttributes;
|
|
20
|
+
};
|
|
21
|
+
declare const FileDetails: import("svelte").Component<$$ComponentProps, {}, "files">;
|
|
19
22
|
type FileDetails = ReturnType<typeof FileDetails>;
|
|
20
23
|
export default FileDetails;
|
package/dist/GitHubCorner.svelte
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<script lang="ts">"use strict";
|
|
2
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
|
|
3
|
+
let { href, title = `View code on GitHub`, aria_label, target = `_self`, color = null, fill = null, corner = `top-right`, style = ``, } = $props();
|
|
4
4
|
</script>
|
|
5
5
|
|
|
6
6
|
<a
|
|
7
7
|
{href}
|
|
8
8
|
{target}
|
|
9
9
|
{title}
|
|
10
|
-
aria-label={aria_label}
|
|
10
|
+
aria-label={aria_label ?? title}
|
|
11
11
|
{style}
|
|
12
12
|
class={corner}
|
|
13
13
|
style:color
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type $$ComponentProps = {
|
|
2
2
|
href: string;
|
|
3
3
|
title?: string;
|
|
4
4
|
aria_label?: string;
|
|
@@ -7,7 +7,7 @@ interface Props {
|
|
|
7
7
|
fill?: string | null;
|
|
8
8
|
corner?: `top-left` | `top-right` | `bottom-left` | `bottom-right`;
|
|
9
9
|
style?: string;
|
|
10
|
-
}
|
|
11
|
-
declare const GitHubCorner: import("svelte").Component
|
|
10
|
+
};
|
|
11
|
+
declare const GitHubCorner: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
12
12
|
type GitHubCorner = ReturnType<typeof GitHubCorner>;
|
|
13
13
|
export default GitHubCorner;
|
package/dist/Icon.svelte.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { HTMLAttributes } from 'svelte/elements';
|
|
2
2
|
import { type IconName } from './icons';
|
|
3
|
-
|
|
3
|
+
type $$ComponentProps = HTMLAttributes<SVGSVGElement> & {
|
|
4
4
|
icon: IconName;
|
|
5
|
-
}
|
|
6
|
-
declare const Icon: import("svelte").Component
|
|
5
|
+
};
|
|
6
|
+
declare const Icon: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
7
7
|
type Icon = ReturnType<typeof Icon>;
|
|
8
8
|
export default Icon;
|