svseeds 0.4.6 → 0.4.7

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.
Files changed (50) hide show
  1. package/_svseeds/Accordion.svelte +7 -7
  2. package/_svseeds/Accordion.svelte.d.ts +4 -4
  3. package/_svseeds/DarkToggle.svelte +5 -5
  4. package/_svseeds/DarkToggle.svelte.d.ts +3 -3
  5. package/_svseeds/TagsInputField.svelte +13 -17
  6. package/_svseeds/TagsInputField.svelte.d.ts +10 -10
  7. package/_svseeds/ToggleGroupField.svelte +9 -9
  8. package/_svseeds/ToggleGroupField.svelte.d.ts +6 -6
  9. package/_svseeds/_Button.svelte +5 -5
  10. package/_svseeds/_Button.svelte.d.ts +3 -3
  11. package/_svseeds/_CheckField.svelte +9 -9
  12. package/_svseeds/_CheckField.svelte.d.ts +6 -6
  13. package/_svseeds/_ColorPicker.svelte +7 -7
  14. package/_svseeds/_ColorPicker.svelte.d.ts +4 -4
  15. package/_svseeds/_ComboBox.svelte +3 -3
  16. package/_svseeds/_ComboBox.svelte.d.ts +2 -2
  17. package/_svseeds/_ContextMenu.svelte +7 -7
  18. package/_svseeds/_ContextMenu.svelte.d.ts +4 -4
  19. package/_svseeds/_Disclosure.svelte +10 -10
  20. package/_svseeds/_Disclosure.svelte.d.ts +6 -6
  21. package/_svseeds/_HotkeyCapture.svelte +7 -7
  22. package/_svseeds/_HotkeyCapture.svelte.d.ts +4 -4
  23. package/_svseeds/_Modal.svelte +7 -7
  24. package/_svseeds/_Modal.svelte.d.ts +4 -4
  25. package/_svseeds/_ProgressTracker.svelte +5 -5
  26. package/_svseeds/_ProgressTracker.svelte.d.ts +3 -3
  27. package/_svseeds/_SelectField.svelte +7 -7
  28. package/_svseeds/_SelectField.svelte.d.ts +5 -5
  29. package/_svseeds/_Slider.svelte +9 -9
  30. package/_svseeds/_Slider.svelte.d.ts +5 -5
  31. package/_svseeds/_Sortable.svelte +21 -21
  32. package/_svseeds/_Sortable.svelte.d.ts +11 -11
  33. package/_svseeds/_Tabs.svelte +5 -5
  34. package/_svseeds/_Tabs.svelte.d.ts +3 -3
  35. package/_svseeds/{TagsInput.svelte → _TagsInput.svelte} +30 -37
  36. package/_svseeds/{TagsInput.svelte.d.ts → _TagsInput.svelte.d.ts} +11 -15
  37. package/_svseeds/_TextField.svelte +9 -9
  38. package/_svseeds/_TextField.svelte.d.ts +7 -7
  39. package/_svseeds/_Toggle.svelte +7 -7
  40. package/_svseeds/_Toggle.svelte.d.ts +4 -4
  41. package/_svseeds/_ToggleGroup.svelte +5 -5
  42. package/_svseeds/_ToggleGroup.svelte.d.ts +3 -3
  43. package/_svseeds/_Tooltip.svelte +9 -9
  44. package/_svseeds/_Tooltip.svelte.d.ts +5 -5
  45. package/_svseeds/core.d.ts +1 -1
  46. package/index.d.ts +2 -3
  47. package/index.js +1 -2
  48. package/package.json +1 -1
  49. package/_svseeds/_Badge.svelte +0 -73
  50. package/_svseeds/_Badge.svelte.d.ts +0 -33
@@ -1,25 +1,23 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface TagsInputProps {
6
+ label?: Snippet<[string, string]>; // Snippet<[value,status]>
7
+ aux?: Snippet<[string, string]>; // Snippet<[value,status]>
6
8
  values?: string[]; // bindable
7
9
  value?: string; // bindable
8
- type?: "left" | "right"; // <"left">
9
- confirm?: string[]; // <["Enter"]>
10
- trim?: boolean; // <true>
11
- unique?: boolean; // <true>
10
+ type?: "left" | "right"; // ("left")
11
+ confirm?: string[]; // (["Enter"])
12
+ trim?: boolean; // (true)
13
+ unique?: boolean; // (true)
12
14
  ariaErrMsgId?: string; // bindable
13
15
  events?: TagsInputEvents;
14
- status?: string; // bindable <STATE.NEUTRAL>
16
+ status?: string; // bindable (STATE.NEUTRAL)
15
17
  style?: SVSStyle;
16
18
  attributes?: HTMLInputAttributes;
17
19
  action?: Action;
18
20
  element?: HTMLInputElement; // bindable
19
- deps?: TagsInputDeps;
20
- }
21
- interface TagsInputDeps {
22
- svsBadge?: Omit<BadgeProps, BadgeReqdProps | BadgeBindProps | "type" | "href">;
23
21
  }
24
22
  interface TagsInputEvents { // cancel if true
25
23
  onadd?: (values: string[], value: string) => void | boolean;
@@ -29,23 +27,21 @@
29
27
  -->
30
28
  <script module lang="ts">
31
29
  export interface TagsInputProps {
30
+ label?: Snippet<[string, string]>; // Snippet<[value,status]>
31
+ aux?: Snippet<[string, string]>; // Snippet<[value,status]>
32
32
  values?: string[]; // bindable
33
33
  value?: string; // bindable
34
- type?: "left" | "right"; // <"left">
35
- confirm?: string[]; // <["Enter"]>
36
- trim?: boolean; // <true>
37
- unique?: boolean; // <true>
34
+ type?: "left" | "right"; // ("left")
35
+ confirm?: string[]; // (["Enter"])
36
+ trim?: boolean; // (true)
37
+ unique?: boolean; // (true)
38
38
  ariaErrMsgId?: string; // bindable
39
39
  events?: TagsInputEvents;
40
- status?: string; // bindable <STATE.NEUTRAL>
40
+ status?: string; // bindable (STATE.NEUTRAL)
41
41
  style?: SVSStyle;
42
42
  attributes?: HTMLInputAttributes;
43
43
  action?: Action;
44
44
  element?: HTMLInputElement; // bindable
45
- deps?: TagsInputDeps;
46
- }
47
- export interface TagsInputDeps {
48
- svsBadge?: Omit<BadgeProps, BadgeReqdProps | BadgeBindProps | "type" | "href">;
49
45
  }
50
46
  export type TagsInputReqdProps = never;
51
47
  export type TagsInputBindProps = "values" | "value" | "ariaErrMsgId" | "status" | "element";
@@ -59,14 +55,14 @@
59
55
  const preset = "svs-tags-input";
60
56
  const CONFIRM_KEY = "Enter";
61
57
 
58
+ import { type Snippet } from "svelte";
62
59
  import { type Action } from "svelte/action";
63
60
  import { type HTMLInputAttributes } from "svelte/elements";
64
61
  import { type SVSStyle, STATE, PARTS, fnClass, omit } from "./core";
65
- import Badge, { type BadgeProps, type BadgeReqdProps, type BadgeBindProps } from "./_Badge.svelte";
66
62
  </script>
67
63
 
68
64
  <script lang="ts">
69
- let { values = $bindable([]), value = $bindable(""), type = "left", confirm = [], trim = true, unique = true, ariaErrMsgId = $bindable(), events, status = $bindable(""), style, attributes, action, element = $bindable(), deps }: TagsInputProps = $props();
65
+ let { label, aux, values = $bindable([]), value = $bindable(""), type = "left", confirm = [], trim = true, unique = true, ariaErrMsgId = $bindable(), events, status = $bindable(""), style, attributes, action, element = $bindable() }: TagsInputProps = $props();
70
66
 
71
67
  // *** Initialize *** //
72
68
  if (!status) status = STATE.NEUTRAL;
@@ -75,12 +71,6 @@
75
71
  const confirmKeys = new Set([CONFIRM_KEY, ...confirm]);
76
72
  let invalid = $derived(ariaErrMsgId ? true : undefined);
77
73
 
78
- // *** Initialize Deps *** //
79
- const svsBadge = {
80
- ...omit(deps?.svsBadge, "onclick", "right", "style"),
81
- style: deps?.svsBadge?.style ?? `${preset} svs-badge`,
82
- };
83
-
84
74
  // *** Event Handlers *** //
85
75
  function onkeydown(ev: KeyboardEvent & TagsInputTarget) {
86
76
  attributes?.onkeydown?.(ev);
@@ -97,8 +87,7 @@
97
87
  value = "";
98
88
  }
99
89
  function remove(index: number): (ev: MouseEvent & BadgeTarget) => void {
100
- return (ev) => {
101
- deps?.svsBadge?.onclick?.(ev);
90
+ return () => {
102
91
  if (events?.onremove?.(values, values[index], index)) return;
103
92
  values = values.filter((_, i) => i !== index);
104
93
  };
@@ -121,16 +110,20 @@
121
110
  {#if render}
122
111
  <span class={cls(type, status)}>
123
112
  {#each values as value, i}
124
- <Badge bind:status type="right" onclick={remove(i)} {...svsBadge}>
125
- {value}
126
- {#snippet right(status)}
127
- {#if deps?.svsBadge?.right}
128
- {@render deps.svsBadge.right(status)}
113
+ <span class={cls(PARTS.LABEL, status)}>
114
+ {#if label}
115
+ {@render label(value, status)}
116
+ {:else}
117
+ {value}
118
+ {/if}
119
+ <button class={cls(PARTS.AUX, status)} onclick={remove(i)}>
120
+ {#if aux}
121
+ {@render aux(value, status)}
129
122
  {:else}
130
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" style="min-width: 5px; min-height: 5px;"><path d="M511.998 70.682 441.315 0 256.002 185.313 70.685 0 .002 70.692l185.314 185.314L.002 441.318 70.69 512l185.312-185.312L441.315 512l70.683-70.682-185.314-185.312z" /></svg>
123
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" width="10" height="10"><path d="M511.998 70.682 441.315 0 256.002 185.313 70.685 0 .002 70.692l185.314 185.314L.002 441.318 70.69 512l185.312-185.312L441.315 512l70.683-70.682-185.314-185.312z" /></svg>
131
124
  {/if}
132
- {/snippet}
133
- </Badge>
125
+ </button>
126
+ </span>
134
127
  {/each}
135
128
  </span>
136
129
  {/if}
@@ -1,4 +1,6 @@
1
1
  export interface TagsInputProps {
2
+ label?: Snippet<[string, string]>;
3
+ aux?: Snippet<[string, string]>;
2
4
  values?: string[];
3
5
  value?: string;
4
6
  type?: "left" | "right";
@@ -12,10 +14,6 @@ export interface TagsInputProps {
12
14
  attributes?: HTMLInputAttributes;
13
15
  action?: Action;
14
16
  element?: HTMLInputElement;
15
- deps?: TagsInputDeps;
16
- }
17
- export interface TagsInputDeps {
18
- svsBadge?: Omit<BadgeProps, BadgeReqdProps | BadgeBindProps | "type" | "href">;
19
17
  }
20
18
  export type TagsInputReqdProps = never;
21
19
  export type TagsInputBindProps = "values" | "value" | "ariaErrMsgId" | "status" | "element";
@@ -23,31 +21,29 @@ export interface TagsInputEvents {
23
21
  onadd?: (values: string[], value: string) => void | boolean;
24
22
  onremove?: (values: string[], value: string, index: number) => void | boolean;
25
23
  }
24
+ import { type Snippet } from "svelte";
26
25
  import { type Action } from "svelte/action";
27
26
  import { type HTMLInputAttributes } from "svelte/elements";
28
27
  import { type SVSStyle } from "./core";
29
- import { type BadgeProps, type BadgeReqdProps, type BadgeBindProps } from "./_Badge.svelte";
30
28
  /**
31
- * default value: `<value>`
29
+ * default value: `(value)`
32
30
  * ```ts
33
31
  * interface TagsInputProps {
32
+ * label?: Snippet<[string, string]>; // Snippet<[value,status]>
33
+ * aux?: Snippet<[string, string]>; // Snippet<[value,status]>
34
34
  * values?: string[]; // bindable
35
35
  * value?: string; // bindable
36
- * type?: "left" | "right"; // <"left">
37
- * confirm?: string[]; // <["Enter"]>
38
- * trim?: boolean; // <true>
39
- * unique?: boolean; // <true>
36
+ * type?: "left" | "right"; // ("left")
37
+ * confirm?: string[]; // (["Enter"])
38
+ * trim?: boolean; // (true)
39
+ * unique?: boolean; // (true)
40
40
  * ariaErrMsgId?: string; // bindable
41
41
  * events?: TagsInputEvents;
42
- * status?: string; // bindable <STATE.NEUTRAL>
42
+ * status?: string; // bindable (STATE.NEUTRAL)
43
43
  * style?: SVSStyle;
44
44
  * attributes?: HTMLInputAttributes;
45
45
  * action?: Action;
46
46
  * element?: HTMLInputElement; // bindable
47
- * deps?: TagsInputDeps;
48
- * }
49
- * interface TagsInputDeps {
50
- * svsBadge?: Omit<BadgeProps, BadgeReqdProps | BadgeBindProps | "type" | "href">;
51
47
  * }
52
48
  * interface TagsInputEvents { // cancel if true
53
49
  * onadd?: (values: string[], value: string) => void | boolean;
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface TextFieldProps {
6
6
  label?: string;
@@ -9,18 +9,18 @@
9
9
  left?: Snippet<[string, string, HTMLInputElement | HTMLTextAreaElement | undefined]>; // Snippet<[status,value,element]>
10
10
  right?: Snippet<[string, string, HTMLInputElement | HTMLTextAreaElement | undefined]>; // Snippet<[status,value,element]>
11
11
  bottom?: string;
12
- descFirst?: boolean; // <false>
12
+ descFirst?: boolean; // (false)
13
13
  value?: string; // bindable
14
- type?: "text" | "area" | "email" | "password" | "search" | "tel" | "url" | "number"; // bindable <"text">
14
+ type?: "text" | "area" | "email" | "password" | "search" | "tel" | "url"; // bindable ("text")
15
15
  options?: SvelteSet<string> | Set<string>;
16
16
  validations?: TextFieldValidation[];
17
- status?: string; // bindable <STATE.NEUTRAL>
17
+ status?: string; // bindable (STATE.NEUTRAL)
18
18
  style?: SVSStyle;
19
19
  attributes?: HTMLInputAttributes | HTMLTextareaAttributes;
20
20
  action?: Action;
21
21
  element?: HTMLInputElement | HTMLTextAreaElement; // bindable
22
22
  }
23
- type TextFieldValidation = (value: string, validity: ValidityState) => string;
23
+ type TextFieldValidation = (value: string, validity: ValidityState) => string | undefined;
24
24
  ```
25
25
  -->
26
26
  <script module lang="ts">
@@ -31,12 +31,12 @@
31
31
  left?: Snippet<[string, string, HTMLInputElement | HTMLTextAreaElement | undefined]>; // Snippet<[status,value,element]>
32
32
  right?: Snippet<[string, string, HTMLInputElement | HTMLTextAreaElement | undefined]>; // Snippet<[status,value,element]>
33
33
  bottom?: string;
34
- descFirst?: boolean; // <false>
34
+ descFirst?: boolean; // (false)
35
35
  value?: string; // bindable
36
- type?: "text" | "area" | "email" | "password" | "search" | "tel" | "url" | "number"; // bindable <"text">
36
+ type?: "text" | "area" | "email" | "password" | "search" | "tel" | "url"; // bindable ("text")
37
37
  options?: SvelteSet<string> | Set<string>;
38
38
  validations?: TextFieldValidation[];
39
- status?: string; // bindable <STATE.NEUTRAL>
39
+ status?: string; // bindable (STATE.NEUTRAL)
40
40
  style?: SVSStyle;
41
41
  attributes?: HTMLInputAttributes | HTMLTextareaAttributes;
42
42
  action?: Action;
@@ -44,7 +44,7 @@
44
44
  }
45
45
  export type TextFieldReqdProps = never;
46
46
  export type TextFieldBindProps = "value" | "type" | "status" | "element";
47
- export type TextFieldValidation = (value: string, validity: ValidityState) => string;
47
+ export type TextFieldValidation = (value: string, validity: ValidityState) => string | undefined;
48
48
 
49
49
  const preset = "svs-text-field";
50
50
 
@@ -7,7 +7,7 @@ export interface TextFieldProps {
7
7
  bottom?: string;
8
8
  descFirst?: boolean;
9
9
  value?: string;
10
- type?: "text" | "area" | "email" | "password" | "search" | "tel" | "url" | "number";
10
+ type?: "text" | "area" | "email" | "password" | "search" | "tel" | "url";
11
11
  options?: SvelteSet<string> | Set<string>;
12
12
  validations?: TextFieldValidation[];
13
13
  status?: string;
@@ -18,14 +18,14 @@ export interface TextFieldProps {
18
18
  }
19
19
  export type TextFieldReqdProps = never;
20
20
  export type TextFieldBindProps = "value" | "type" | "status" | "element";
21
- export type TextFieldValidation = (value: string, validity: ValidityState) => string;
21
+ export type TextFieldValidation = (value: string, validity: ValidityState) => string | undefined;
22
22
  import { type Snippet } from "svelte";
23
23
  import { type Action } from "svelte/action";
24
24
  import { type SvelteSet } from "svelte/reactivity";
25
25
  import { type HTMLInputAttributes, type HTMLTextareaAttributes } from "svelte/elements";
26
26
  import { type SVSStyle } from "./core";
27
27
  /**
28
- * default value: `<value>`
28
+ * default value: `(value)`
29
29
  * ```ts
30
30
  * interface TextFieldProps {
31
31
  * label?: string;
@@ -34,18 +34,18 @@ import { type SVSStyle } from "./core";
34
34
  * left?: Snippet<[string, string, HTMLInputElement | HTMLTextAreaElement | undefined]>; // Snippet<[status,value,element]>
35
35
  * right?: Snippet<[string, string, HTMLInputElement | HTMLTextAreaElement | undefined]>; // Snippet<[status,value,element]>
36
36
  * bottom?: string;
37
- * descFirst?: boolean; // <false>
37
+ * descFirst?: boolean; // (false)
38
38
  * value?: string; // bindable
39
- * type?: "text" | "area" | "email" | "password" | "search" | "tel" | "url" | "number"; // bindable <"text">
39
+ * type?: "text" | "area" | "email" | "password" | "search" | "tel" | "url"; // bindable ("text")
40
40
  * options?: SvelteSet<string> | Set<string>;
41
41
  * validations?: TextFieldValidation[];
42
- * status?: string; // bindable <STATE.NEUTRAL>
42
+ * status?: string; // bindable (STATE.NEUTRAL)
43
43
  * style?: SVSStyle;
44
44
  * attributes?: HTMLInputAttributes | HTMLTextareaAttributes;
45
45
  * action?: Action;
46
46
  * element?: HTMLInputElement | HTMLTextAreaElement; // bindable
47
47
  * }
48
- * type TextFieldValidation = (value: string, validity: ValidityState) => string;
48
+ * type TextFieldValidation = (value: string, validity: ValidityState) => string | undefined;
49
49
  * ```
50
50
  */
51
51
  declare const TextField: import("svelte").Component<TextFieldProps, {}, "type" | "value" | "status" | "element">;
@@ -1,15 +1,15 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface ToggleProps {
6
6
  main?: Snippet<[string, boolean, HTMLButtonElement | undefined]>; // Snippet<[status,value,element]>
7
7
  left?: Snippet<[string, boolean, HTMLButtonElement | undefined]>; // Snippet<[status,value,element]>
8
8
  right?: Snippet<[string, boolean, HTMLButtonElement | undefined]>; // Snippet<[status,value,element]>
9
- value?: boolean; // bindable <false>
10
- type?: "button" | "switch"; // <"button">
9
+ value?: boolean; // bindable (false)
10
+ type?: "button" | "switch"; // ("button")
11
11
  ariaLabel?: string;
12
- status?: string; // bindable <STATE.NEUTRAL>
12
+ status?: string; // bindable (STATE.NEUTRAL)
13
13
  style?: SVSStyle;
14
14
  attributes?: HTMLButtonAttributes;
15
15
  action?: Action;
@@ -23,10 +23,10 @@
23
23
  main?: Snippet<[string, boolean, HTMLButtonElement | undefined]>; // Snippet<[status,value,element]>
24
24
  left?: Snippet<[string, boolean, HTMLButtonElement | undefined]>; // Snippet<[status,value,element]>
25
25
  right?: Snippet<[string, boolean, HTMLButtonElement | undefined]>; // Snippet<[status,value,element]>
26
- value?: boolean; // bindable <false>
27
- type?: "button" | "switch"; // <"button">
26
+ value?: boolean; // bindable (false)
27
+ type?: "button" | "switch"; // ("button")
28
28
  ariaLabel?: string;
29
- status?: string; // bindable <STATE.NEUTRAL>
29
+ status?: string; // bindable (STATE.NEUTRAL)
30
30
  style?: SVSStyle;
31
31
  attributes?: HTMLButtonAttributes;
32
32
  action?: Action;
@@ -19,16 +19,16 @@ import { type Action } from "svelte/action";
19
19
  import { type HTMLButtonAttributes } from "svelte/elements";
20
20
  import { type SVSStyle } from "./core";
21
21
  /**
22
- * default value: `<value>`
22
+ * default value: `(value)`
23
23
  * ```ts
24
24
  * interface ToggleProps {
25
25
  * main?: Snippet<[string, boolean, HTMLButtonElement | undefined]>; // Snippet<[status,value,element]>
26
26
  * left?: Snippet<[string, boolean, HTMLButtonElement | undefined]>; // Snippet<[status,value,element]>
27
27
  * right?: Snippet<[string, boolean, HTMLButtonElement | undefined]>; // Snippet<[status,value,element]>
28
- * value?: boolean; // bindable <false>
29
- * type?: "button" | "switch"; // <"button">
28
+ * value?: boolean; // bindable (false)
29
+ * type?: "button" | "switch"; // ("button")
30
30
  * ariaLabel?: string;
31
- * status?: string; // bindable <STATE.NEUTRAL>
31
+ * status?: string; // bindable (STATE.NEUTRAL)
32
32
  * style?: SVSStyle;
33
33
  * attributes?: HTMLButtonAttributes;
34
34
  * action?: Action;
@@ -1,14 +1,14 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface ToggleGroupProps {
6
6
  options: SvelteMap<string, string> | Map<string, string>;
7
7
  values?: string[]; // bindable
8
- multiple?: boolean; // <true>
8
+ multiple?: boolean; // (true)
9
9
  ariaDescId?: string;
10
10
  ariaErrMsgId?: string; // bindable
11
- status?: string; // bindable <STATE.NEUTRAL>
11
+ status?: string; // bindable (STATE.NEUTRAL)
12
12
  style?: SVSStyle;
13
13
  action?: Action;
14
14
  [key: string]: unknown | Snippet<[string]>;
@@ -19,10 +19,10 @@
19
19
  export interface ToggleGroupProps {
20
20
  options: SvelteMap<string, string> | Map<string, string>;
21
21
  values?: string[]; // bindable
22
- multiple?: boolean; // <true>
22
+ multiple?: boolean; // (true)
23
23
  ariaDescId?: string;
24
24
  ariaErrMsgId?: string; // bindable
25
- status?: string; // bindable <STATE.NEUTRAL>
25
+ status?: string; // bindable (STATE.NEUTRAL)
26
26
  style?: SVSStyle;
27
27
  action?: Action;
28
28
  [key: string]: unknown | Snippet<[string]>;
@@ -16,15 +16,15 @@ import { type Action } from "svelte/action";
16
16
  import { type SvelteMap } from "svelte/reactivity";
17
17
  import { type SVSStyle } from "./core";
18
18
  /**
19
- * default value: `<value>`
19
+ * default value: `(value)`
20
20
  * ```ts
21
21
  * interface ToggleGroupProps {
22
22
  * options: SvelteMap<string, string> | Map<string, string>;
23
23
  * values?: string[]; // bindable
24
- * multiple?: boolean; // <true>
24
+ * multiple?: boolean; // (true)
25
25
  * ariaDescId?: string;
26
26
  * ariaErrMsgId?: string; // bindable
27
- * status?: string; // bindable <STATE.NEUTRAL>
27
+ * status?: string; // bindable (STATE.NEUTRAL)
28
28
  * style?: SVSStyle;
29
29
  * action?: Action;
30
30
  * [key: string]: unknown | Snippet<[string]>;
@@ -1,14 +1,14 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface TooltipProps {
6
6
  main?: Snippet<[string, string, boolean]>; // Snippet<[status,text,isFlipped]>
7
7
  name?: string;
8
- position?: Position; // "top"
9
- align?: Align; // "center"
10
- offset?: Vector; // <{ x: 0, y: 0 }>
11
- status?: string; // bindable <STATE.NEUTRAL>
8
+ position?: Position; // ("top")
9
+ align?: Align; // ("center")
10
+ offset?: Vector; // ({ x: 0, y: 0 })
11
+ status?: string; // bindable (STATE.NEUTRAL)
12
12
  style?: SVSStyle;
13
13
  element?: HTMLDivElement; // bindable
14
14
  }
@@ -21,10 +21,10 @@
21
21
  export interface TooltipProps {
22
22
  main?: Snippet<[string, string, boolean]>; // Snippet<[status,text,isFlipped]>
23
23
  name?: string;
24
- position?: Position; // "top"
25
- align?: Align; // "center"
26
- offset?: Vector; // <{ x: 0, y: 0 }>
27
- status?: string; // bindable <STATE.NEUTRAL>
24
+ position?: Position; // ("top")
25
+ align?: Align; // ("center")
26
+ offset?: Vector; // ({ x: 0, y: 0 })
27
+ status?: string; // bindable (STATE.NEUTRAL)
28
28
  style?: SVSStyle;
29
29
  element?: HTMLDivElement; // bindable
30
30
  }
@@ -27,15 +27,15 @@ import { type Snippet } from "svelte";
27
27
  import { type Action, type ActionReturn } from "svelte/action";
28
28
  import { type SVSStyle } from "./core";
29
29
  /**
30
- * default value: `<value>`
30
+ * default value: `(value)`
31
31
  * ```ts
32
32
  * interface TooltipProps {
33
33
  * main?: Snippet<[string, string, boolean]>; // Snippet<[status,text,isFlipped]>
34
34
  * name?: string;
35
- * position?: Position; // "top"
36
- * align?: Align; // "center"
37
- * offset?: Vector; // <{ x: 0, y: 0 }>
38
- * status?: string; // bindable <STATE.NEUTRAL>
35
+ * position?: Position; // ("top")
36
+ * align?: Align; // ("center")
37
+ * offset?: Vector; // ({ x: 0, y: 0 })
38
+ * status?: string; // bindable (STATE.NEUTRAL)
39
39
  * style?: SVSStyle;
40
40
  * element?: HTMLDivElement; // bindable
41
41
  * }
@@ -130,7 +130,7 @@ declare class UniqueId {
130
130
  *
131
131
  * @example
132
132
  * ```typescript
133
- * const generator = new UniqueId();
133
+ * const generator = new UniqueId(4);
134
134
  * const id1 = generator.get(true); // "AbCd"
135
135
  * const id2 = generator.get(false); // undefined
136
136
  * const id3 = generator.get("hello"); // "XyAb"
package/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  export { type SVSStyle, BASE, STATE, PARTS, elemId, fnClass, isNeutral, omit, debounce, throttle, UniqueId } from "./_svseeds/core";
2
- export { default as Badge, type BadgeProps, type BadgeReqdProps, type BadgeBindProps } from "./_svseeds/_Badge.svelte";
3
2
  export { default as Button, type ButtonProps, type ButtonReqdProps, type ButtonBindProps } from "./_svseeds/_Button.svelte";
4
3
  export { default as CheckField, type CheckFieldProps, type CheckFieldReqdProps, type CheckFieldBindProps, type CheckFieldValidation } from "./_svseeds/_CheckField.svelte";
5
4
  export { default as ColorPicker, type ColorPickerProps, type ColorPickerReqdProps, type ColorPickerBindProps, getHex } from "./_svseeds/_ColorPicker.svelte";
@@ -13,12 +12,12 @@ export { default as SelectField, type SelectFieldProps, type SelectFieldReqdProp
13
12
  export { default as Slider, type SliderProps, type SliderReqdProps, type SliderBindProps, type Range } from "./_svseeds/_Slider.svelte";
14
13
  export { default as Sortable, type SortableProps, type SortableReqdProps, type SortableBindProps, SortableItems } from "./_svseeds/_Sortable.svelte";
15
14
  export { default as Tabs, type TabsProps, type TabsReqdProps, type TabsBindProps } from "./_svseeds/_Tabs.svelte";
15
+ export { default as TagsInput, type TagsInputProps, type TagsInputReqdProps, type TagsInputBindProps, type TagsInputEvents } from "./_svseeds/_TagsInput.svelte";
16
16
  export { default as TextField, type TextFieldProps, type TextFieldReqdProps, type TextFieldBindProps, type TextFieldValidation } from "./_svseeds/_TextField.svelte";
17
17
  export { default as Toggle, type ToggleProps, type ToggleReqdProps, type ToggleBindProps } from "./_svseeds/_Toggle.svelte";
18
18
  export { default as ToggleGroup, type ToggleGroupProps, type ToggleGroupReqdProps, type ToggleGroupBindProps } from "./_svseeds/_ToggleGroup.svelte";
19
19
  export { default as Tooltip, type TooltipProps, type TooltipReqdProps, type TooltipBindProps, type Vector, type Position, type Align, tooltip, tooltipAction } from "./_svseeds/_Tooltip.svelte";
20
20
  export { default as Accordion, type AccordionProps, type AccordionDeps, type AccordionReqdProps, type AccordionBindProps } from "./_svseeds/Accordion.svelte";
21
21
  export { default as DarkToggle, type DarkToggleProps, type DarkToggleDeps, type DarkToggleReqdProps, type DarkToggleBindProps, THEME, setThemeToRoot } from "./_svseeds/DarkToggle.svelte";
22
- export { default as TagsInput, type TagsInputProps, type TagsInputDeps, type TagsInputReqdProps, type TagsInputBindProps, type TagsInputEvents } from "./_svseeds/TagsInput.svelte";
23
- export { default as TagsInputField, type TagsInputFieldProps, type TagsInputFieldReqdProps, type TagsInputFieldBindProps, type TagsInputFieldConstraint, type TagsInputFieldValidation, type TagsInputFieldCountValidation } from "./_svseeds/TagsInputField.svelte";
22
+ export { default as TagsInputField, type TagsInputFieldProps, type TagsInputFieldDeps, type TagsInputFieldReqdProps, type TagsInputFieldBindProps, type TagsInputFieldConstraint, type TagsInputFieldValidation, type TagsInputFieldCountValidation } from "./_svseeds/TagsInputField.svelte";
24
23
  export { default as ToggleGroupField, type ToggleGroupFieldProps, type ToggleGroupFieldDeps, type ToggleGroupFieldReqdProps, type ToggleGroupFieldBindProps, type ToggleGroupFieldValidation } from "./_svseeds/ToggleGroupField.svelte";
package/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  export { BASE, STATE, PARTS, elemId, fnClass, isNeutral, omit, debounce, throttle, UniqueId } from "./_svseeds/core";
2
- export { default as Badge } from "./_svseeds/_Badge.svelte";
3
2
  export { default as Button } from "./_svseeds/_Button.svelte";
4
3
  export { default as CheckField } from "./_svseeds/_CheckField.svelte";
5
4
  export { default as ColorPicker, getHex } from "./_svseeds/_ColorPicker.svelte";
@@ -13,12 +12,12 @@ export { default as SelectField } from "./_svseeds/_SelectField.svelte";
13
12
  export { default as Slider } from "./_svseeds/_Slider.svelte";
14
13
  export { default as Sortable, SortableItems } from "./_svseeds/_Sortable.svelte";
15
14
  export { default as Tabs } from "./_svseeds/_Tabs.svelte";
15
+ export { default as TagsInput } from "./_svseeds/_TagsInput.svelte";
16
16
  export { default as TextField } from "./_svseeds/_TextField.svelte";
17
17
  export { default as Toggle } from "./_svseeds/_Toggle.svelte";
18
18
  export { default as ToggleGroup } from "./_svseeds/_ToggleGroup.svelte";
19
19
  export { default as Tooltip, tooltip, tooltipAction } from "./_svseeds/_Tooltip.svelte";
20
20
  export { default as Accordion } from "./_svseeds/Accordion.svelte";
21
21
  export { default as DarkToggle, THEME, setThemeToRoot } from "./_svseeds/DarkToggle.svelte";
22
- export { default as TagsInput } from "./_svseeds/TagsInput.svelte";
23
22
  export { default as TagsInputField } from "./_svseeds/TagsInputField.svelte";
24
23
  export { default as ToggleGroupField } from "./_svseeds/ToggleGroupField.svelte";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svseeds",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "description": "Simple components for Svelte.",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -1,73 +0,0 @@
1
- <!--
2
- @component
3
- default value: `<value>`
4
- ```ts
5
- interface BadgeProps {
6
- children: Snippet;
7
- left?: Snippet<[string]>; // Snippet<[status]>
8
- right?: Snippet<[string]>; // Snippet<[status]>
9
- type?: "plain" | "link" | "left" | "right"; // <"plain">
10
- href?: string;
11
- onclick?: MouseEventHandler<HTMLButtonElement> | null;
12
- status?: string; // bindable <STATE.NEUTRAL>
13
- style?: SVSStyle;
14
- }
15
- ```
16
- -->
17
- <script module lang="ts">
18
- export interface BadgeProps {
19
- children: Snippet;
20
- left?: Snippet<[string]>; // Snippet<[status]>
21
- right?: Snippet<[string]>; // Snippet<[status]>
22
- type?: "plain" | "link" | "left" | "right"; // <"plain">
23
- href?: string;
24
- onclick?: MouseEventHandler<HTMLButtonElement> | null;
25
- status?: string; // bindable <STATE.NEUTRAL>
26
- style?: SVSStyle;
27
- }
28
- export type BadgeReqdProps = "children";
29
- export type BadgeBindProps = "status";
30
-
31
- const preset = "svs-badge";
32
-
33
- import { type Snippet } from "svelte";
34
- import { type MouseEventHandler } from "svelte/elements";
35
- import { type SVSStyle, STATE, PARTS, fnClass } from "./core";
36
- </script>
37
-
38
- <script lang="ts">
39
- let { children, left, right, type = "plain", href = "", onclick, status = $bindable(""), style }: BadgeProps = $props();
40
-
41
- // *** Initialize *** //
42
- if (!status) status = STATE.NEUTRAL;
43
- const cls = fnClass(preset, style);
44
- </script>
45
-
46
- <!---------------------------------------->
47
-
48
- {#if type === "link"}
49
- <a class={cls(PARTS.WHOLE, status)} {href}>
50
- {@render whole()}
51
- </a>
52
- {:else}
53
- <span class={cls(PARTS.WHOLE, status)}>
54
- {@render whole()}
55
- </span>
56
- {/if}
57
-
58
- {#snippet side(area: string, btn: boolean, body?: Snippet<[string]>)}
59
- {#if body}
60
- {#if btn}
61
- <button class={cls(area, status)} {onclick}>{@render body(status)}</button>
62
- {:else}
63
- <span class={cls(area, status)}>{@render body(status)}</span>
64
- {/if}
65
- {/if}
66
- {/snippet}
67
- {#snippet whole()}
68
- {@render side(PARTS.LEFT, type === "left", left)}
69
- <span class={cls(PARTS.MAIN, status)}>
70
- {@render children()}
71
- </span>
72
- {@render side(PARTS.RIGHT, type === "right", right)}
73
- {/snippet}
@@ -1,33 +0,0 @@
1
- export interface BadgeProps {
2
- children: Snippet;
3
- left?: Snippet<[string]>;
4
- right?: Snippet<[string]>;
5
- type?: "plain" | "link" | "left" | "right";
6
- href?: string;
7
- onclick?: MouseEventHandler<HTMLButtonElement> | null;
8
- status?: string;
9
- style?: SVSStyle;
10
- }
11
- export type BadgeReqdProps = "children";
12
- export type BadgeBindProps = "status";
13
- import { type Snippet } from "svelte";
14
- import { type MouseEventHandler } from "svelte/elements";
15
- import { type SVSStyle } from "./core";
16
- /**
17
- * default value: `<value>`
18
- * ```ts
19
- * interface BadgeProps {
20
- * children: Snippet;
21
- * left?: Snippet<[string]>; // Snippet<[status]>
22
- * right?: Snippet<[string]>; // Snippet<[status]>
23
- * type?: "plain" | "link" | "left" | "right"; // <"plain">
24
- * href?: string;
25
- * onclick?: MouseEventHandler<HTMLButtonElement> | null;
26
- * status?: string; // bindable <STATE.NEUTRAL>
27
- * style?: SVSStyle;
28
- * }
29
- * ```
30
- */
31
- declare const Badge: import("svelte").Component<BadgeProps, {}, "status">;
32
- type Badge = ReturnType<typeof Badge>;
33
- export default Badge;