svelte-multiselect 11.4.0 → 11.5.1
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/CmdPalette.svelte +2 -2
- package/dist/CmdPalette.svelte.d.ts +10 -0
- package/dist/CopyButton.svelte +2 -9
- package/dist/FileDetails.svelte +23 -10
- package/dist/FileDetails.svelte.d.ts +1 -2
- package/dist/GitHubCorner.svelte +2 -2
- package/dist/MultiSelect.svelte +650 -165
- package/dist/MultiSelect.svelte.d.ts +2 -2
- package/dist/Nav.svelte +2 -2
- package/dist/PrevNext.svelte +6 -2
- package/dist/Toggle.svelte +8 -5
- package/dist/attachments.d.ts +18 -7
- package/dist/attachments.js +98 -0
- package/dist/icons.d.ts +8 -0
- package/dist/icons.js +8 -0
- package/dist/types.d.ts +47 -2
- package/dist/utils.d.ts +3 -0
- package/dist/utils.js +2 -0
- package/package.json +14 -12
- package/readme.md +138 -39
package/dist/CmdPalette.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script
|
|
2
2
|
lang="ts"
|
|
3
|
-
generics="Action extends { label: string; action: (label: string) => void } & Record<string, unknown> = { label: string; action: (label: string) => void }"
|
|
3
|
+
generics="Action extends { label: string; action: (label: string) => void; group?: string } & Record<string, unknown> = { label: string; action: (label: string) => void; group?: string }"
|
|
4
4
|
>import { fade } from 'svelte/transition';
|
|
5
5
|
import MultiSelect from './MultiSelect.svelte';
|
|
6
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();
|
|
@@ -67,7 +67,7 @@ function trigger_action_and_close({ option }) {
|
|
|
67
67
|
padding: 0;
|
|
68
68
|
background-color: transparent;
|
|
69
69
|
display: flex;
|
|
70
|
-
color:
|
|
70
|
+
color: light-dark(#222, #eee);
|
|
71
71
|
z-index: 10;
|
|
72
72
|
font-size: 2.4ex;
|
|
73
73
|
}
|
|
@@ -2,9 +2,11 @@ import type { HTMLAttributes } from 'svelte/elements';
|
|
|
2
2
|
declare function $$render<Action extends {
|
|
3
3
|
label: string;
|
|
4
4
|
action: (label: string) => void;
|
|
5
|
+
group?: string;
|
|
5
6
|
} & Record<string, unknown> = {
|
|
6
7
|
label: string;
|
|
7
8
|
action: (label: string) => void;
|
|
9
|
+
group?: string;
|
|
8
10
|
}>(): {
|
|
9
11
|
props: Omit<import("./types").MultiSelectProps<Action>, "options"> & {
|
|
10
12
|
actions: Action[];
|
|
@@ -26,9 +28,11 @@ declare function $$render<Action extends {
|
|
|
26
28
|
declare class __sveltets_Render<Action extends {
|
|
27
29
|
label: string;
|
|
28
30
|
action: (label: string) => void;
|
|
31
|
+
group?: string;
|
|
29
32
|
} & Record<string, unknown> = {
|
|
30
33
|
label: string;
|
|
31
34
|
action: (label: string) => void;
|
|
35
|
+
group?: string;
|
|
32
36
|
}> {
|
|
33
37
|
props(): ReturnType<typeof $$render<Action>>['props'];
|
|
34
38
|
events(): ReturnType<typeof $$render<Action>>['events'];
|
|
@@ -40,18 +44,22 @@ interface $$IsomorphicComponent {
|
|
|
40
44
|
new <Action extends {
|
|
41
45
|
label: string;
|
|
42
46
|
action: (label: string) => void;
|
|
47
|
+
group?: string;
|
|
43
48
|
} & Record<string, unknown> = {
|
|
44
49
|
label: string;
|
|
45
50
|
action: (label: string) => void;
|
|
51
|
+
group?: string;
|
|
46
52
|
}>(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
53
|
$$bindings?: ReturnType<__sveltets_Render<Action>['bindings']>;
|
|
48
54
|
} & ReturnType<__sveltets_Render<Action>['exports']>;
|
|
49
55
|
<Action extends {
|
|
50
56
|
label: string;
|
|
51
57
|
action: (label: string) => void;
|
|
58
|
+
group?: string;
|
|
52
59
|
} & Record<string, unknown> = {
|
|
53
60
|
label: string;
|
|
54
61
|
action: (label: string) => void;
|
|
62
|
+
group?: string;
|
|
55
63
|
}>(internal: unknown, props: ReturnType<__sveltets_Render<Action>['props']> & {}): ReturnType<__sveltets_Render<Action>['exports']>;
|
|
56
64
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
57
65
|
}
|
|
@@ -59,8 +67,10 @@ declare const CmdPalette: $$IsomorphicComponent;
|
|
|
59
67
|
type CmdPalette<Action extends {
|
|
60
68
|
label: string;
|
|
61
69
|
action: (label: string) => void;
|
|
70
|
+
group?: string;
|
|
62
71
|
} & Record<string, unknown> = {
|
|
63
72
|
label: string;
|
|
64
73
|
action: (label: string) => void;
|
|
74
|
+
group?: string;
|
|
65
75
|
}> = InstanceType<typeof CmdPalette<Action>>;
|
|
66
76
|
export default CmdPalette;
|
package/dist/CopyButton.svelte
CHANGED
|
@@ -10,7 +10,7 @@ $effect(() => {
|
|
|
10
10
|
if (!global && !global_selector)
|
|
11
11
|
return;
|
|
12
12
|
const apply_copy_buttons = () => {
|
|
13
|
-
const
|
|
13
|
+
const style = `position: absolute; top: 6pt; right: 6pt; ${rest.style ?? ``}`;
|
|
14
14
|
const skip_sel = skip_selector ?? as;
|
|
15
15
|
for (const code of document.querySelectorAll(global_selector ?? `pre > code`)) {
|
|
16
16
|
const pre = code.parentElement;
|
|
@@ -19,14 +19,7 @@ $effect(() => {
|
|
|
19
19
|
!(skip_sel && pre.querySelector(skip_sel))) {
|
|
20
20
|
mount(CopyButton, {
|
|
21
21
|
target: pre,
|
|
22
|
-
props: {
|
|
23
|
-
content,
|
|
24
|
-
as,
|
|
25
|
-
labels,
|
|
26
|
-
...rest,
|
|
27
|
-
style: btn_style,
|
|
28
|
-
'data-sms-copy': ``,
|
|
29
|
-
},
|
|
22
|
+
props: { content, as, labels, ...rest, style, 'data-sms-copy': `` },
|
|
30
23
|
});
|
|
31
24
|
}
|
|
32
25
|
}
|
package/dist/FileDetails.svelte
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
|
-
<script lang="ts">let { files = $bindable([]), toggle_all_btn_title = `Toggle all`, default_lang = `typescript`, as = `ol`,
|
|
1
|
+
<script lang="ts">let { files = $bindable([]), toggle_all_btn_title = `Toggle all`, default_lang = `typescript`, as = `ol`, title_snippet, button_props, details_props, ...rest } = $props();
|
|
2
|
+
// Use reactive state for node refs to avoid binding_property_non_reactive warning
|
|
3
|
+
let node_refs = $state([]);
|
|
4
|
+
// Trim stale refs when files shrink and sync node_refs back to files.node for external access
|
|
5
|
+
$effect(() => {
|
|
6
|
+
// Trim stale references when files array shrinks to prevent memory leaks
|
|
7
|
+
if (node_refs.length > files.length) {
|
|
8
|
+
node_refs.splice(files.length);
|
|
9
|
+
}
|
|
10
|
+
for (const [idx, node] of node_refs.entries()) {
|
|
11
|
+
if (files[idx])
|
|
12
|
+
files[idx].node = node;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
// Check if any nodes are open (for button text)
|
|
16
|
+
const any_open = $derived(node_refs.some((node) => node?.open));
|
|
2
17
|
function toggle_all() {
|
|
3
|
-
const
|
|
4
|
-
for (const
|
|
5
|
-
if (!
|
|
18
|
+
const should_close = node_refs.some((node) => node?.open);
|
|
19
|
+
for (const node of node_refs) {
|
|
20
|
+
if (!node)
|
|
6
21
|
continue;
|
|
7
|
-
|
|
22
|
+
node.open = !should_close;
|
|
8
23
|
}
|
|
9
24
|
}
|
|
10
25
|
export {};
|
|
@@ -12,16 +27,15 @@ export {};
|
|
|
12
27
|
|
|
13
28
|
{#if files?.length > 1}
|
|
14
29
|
<button onclick={toggle_all} title={toggle_all_btn_title} {...button_props}>
|
|
15
|
-
{
|
|
30
|
+
{any_open ? `Close` : `Open`} all
|
|
16
31
|
</button>
|
|
17
32
|
{/if}
|
|
18
33
|
|
|
19
|
-
<svelte:element this={as} {
|
|
34
|
+
<svelte:element this={as} {...rest}>
|
|
20
35
|
{#each files as file, idx (file.title)}
|
|
21
36
|
{@const { title, content, language = default_lang } = file ?? {}}
|
|
22
37
|
<li>
|
|
23
|
-
|
|
24
|
-
<details bind:this={file.node} {...details_props}>
|
|
38
|
+
<details bind:this={node_refs[idx]} {...details_props}>
|
|
25
39
|
{#if title || title_snippet}
|
|
26
40
|
<summary>
|
|
27
41
|
{#if title_snippet}
|
|
@@ -33,7 +47,6 @@ export {};
|
|
|
33
47
|
{/if}
|
|
34
48
|
|
|
35
49
|
<pre class="language-{language}"><code>{content}</code></pre>
|
|
36
|
-
<!-- <pre><code>{@html hljs.highlight(content, { language }).value}</code></pre> -->
|
|
37
50
|
</details>
|
|
38
51
|
</li>
|
|
39
52
|
{/each}
|
|
@@ -11,13 +11,12 @@ type $$ComponentProps = {
|
|
|
11
11
|
toggle_all_btn_title?: string;
|
|
12
12
|
default_lang?: string;
|
|
13
13
|
as?: string;
|
|
14
|
-
style?: string | null;
|
|
15
14
|
title_snippet?: Snippet<[{
|
|
16
15
|
idx: number;
|
|
17
16
|
} & File]>;
|
|
18
17
|
button_props?: HTMLAttributes<HTMLButtonElement>;
|
|
19
18
|
details_props?: HTMLDetailsAttributes;
|
|
20
|
-
}
|
|
19
|
+
} & HTMLAttributes<HTMLOListElement>;
|
|
21
20
|
declare const FileDetails: import("svelte").Component<$$ComponentProps, {}, "files">;
|
|
22
21
|
type FileDetails = ReturnType<typeof FileDetails>;
|
|
23
22
|
export default FileDetails;
|
package/dist/GitHubCorner.svelte
CHANGED
|
@@ -33,8 +33,8 @@ let { href, title = `View code on GitHub`, aria_label, target = `_self`, color =
|
|
|
33
33
|
a {
|
|
34
34
|
position: fixed;
|
|
35
35
|
z-index: 1;
|
|
36
|
-
fill: var(--github-corner-bg,
|
|
37
|
-
color: var(--github-corner-color,
|
|
36
|
+
fill: var(--github-corner-bg, light-dark(#222, #eee));
|
|
37
|
+
color: var(--github-corner-color, light-dark(#fafafa, #1a1a1a));
|
|
38
38
|
width: var(--github-corner-size, 70px);
|
|
39
39
|
}
|
|
40
40
|
a.top-right {
|