svseeds 0.4.6 → 0.4.8

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 (51) hide show
  1. package/_svseeds/Accordion.svelte +17 -17
  2. package/_svseeds/Accordion.svelte.d.ts +10 -10
  3. package/_svseeds/DarkToggle.svelte +15 -15
  4. package/_svseeds/DarkToggle.svelte.d.ts +6 -6
  5. package/_svseeds/TagsInputField.svelte +48 -53
  6. package/_svseeds/TagsInputField.svelte.d.ts +22 -22
  7. package/_svseeds/ToggleGroupField.svelte +39 -39
  8. package/_svseeds/ToggleGroupField.svelte.d.ts +18 -18
  9. package/_svseeds/_Button.svelte +23 -22
  10. package/_svseeds/_Button.svelte.d.ts +13 -13
  11. package/_svseeds/_CheckField.svelte +33 -33
  12. package/_svseeds/_CheckField.svelte.d.ts +14 -14
  13. package/_svseeds/_ColorPicker.svelte +16 -16
  14. package/_svseeds/_ColorPicker.svelte.d.ts +10 -10
  15. package/_svseeds/_ComboBox.svelte +15 -15
  16. package/_svseeds/_ComboBox.svelte.d.ts +8 -8
  17. package/_svseeds/_ContextMenu.svelte +18 -18
  18. package/_svseeds/_ContextMenu.svelte.d.ts +12 -12
  19. package/_svseeds/_Disclosure.svelte +31 -29
  20. package/_svseeds/_Disclosure.svelte.d.ts +14 -14
  21. package/_svseeds/_HotkeyCapture.svelte +19 -19
  22. package/_svseeds/_HotkeyCapture.svelte.d.ts +10 -10
  23. package/_svseeds/_Modal.svelte +19 -19
  24. package/_svseeds/_Modal.svelte.d.ts +12 -12
  25. package/_svseeds/_ProgressTracker.svelte +27 -26
  26. package/_svseeds/_ProgressTracker.svelte.d.ts +15 -15
  27. package/_svseeds/_SelectField.svelte +36 -36
  28. package/_svseeds/_SelectField.svelte.d.ts +14 -14
  29. package/_svseeds/_Slider.svelte +26 -25
  30. package/_svseeds/_Slider.svelte.d.ts +15 -15
  31. package/_svseeds/_Sortable.svelte +35 -35
  32. package/_svseeds/_Sortable.svelte.d.ts +18 -18
  33. package/_svseeds/_Tabs.svelte +23 -23
  34. package/_svseeds/_Tabs.svelte.d.ts +10 -10
  35. package/_svseeds/{TagsInput.svelte → _TagsInput.svelte} +40 -47
  36. package/_svseeds/{TagsInput.svelte.d.ts → _TagsInput.svelte.d.ts} +17 -21
  37. package/_svseeds/_TextField.svelte +39 -39
  38. package/_svseeds/_TextField.svelte.d.ts +16 -16
  39. package/_svseeds/_Toggle.svelte +30 -34
  40. package/_svseeds/_Toggle.svelte.d.ts +16 -18
  41. package/_svseeds/_ToggleGroup.svelte +16 -16
  42. package/_svseeds/_ToggleGroup.svelte.d.ts +10 -10
  43. package/_svseeds/_Tooltip.svelte +21 -21
  44. package/_svseeds/_Tooltip.svelte.d.ts +13 -13
  45. package/_svseeds/core.d.ts +34 -17
  46. package/_svseeds/core.js +1 -1
  47. package/index.d.ts +3 -4
  48. package/index.js +2 -3
  49. package/package.json +1 -1
  50. package/_svseeds/_Badge.svelte +0 -73
  51. package/_svseeds/_Badge.svelte.d.ts +0 -33
@@ -3,27 +3,27 @@ export interface HotkeyCaptureProps {
3
3
  placeholder?: string;
4
4
  active?: boolean;
5
5
  disabled?: boolean;
6
- status?: string;
7
- style?: SVSStyle;
8
6
  element?: HTMLInputElement;
7
+ styling?: SVSClass;
8
+ variant?: string;
9
9
  }
10
10
  export type HotkeyCaptureReqdProps = never;
11
- export type HotkeyCaptureBindProps = "value" | "active" | "disable" | "status" | "element";
12
- import { type SVSStyle } from "./core";
11
+ export type HotkeyCaptureBindProps = "value" | "active" | "disable" | "variant" | "element";
12
+ import { type SVSClass } from "./core";
13
13
  /**
14
- * default value: `<value>`
14
+ * default value: `(value)`
15
15
  * ```ts
16
16
  * interface HotkeyCaptureProps {
17
17
  * value?: string; // bindable
18
18
  * placeholder?: string;
19
- * active?: boolean; // bindable, <false>
20
- * disabled?: boolean; // bindable, <false>
21
- * status?: string; // bindable <STATE.NEUTRAL>
22
- * style?: SVSStyle;
19
+ * active?: boolean; // bindable, (false)
20
+ * disabled?: boolean; // bindable, (false)
23
21
  * element?: HTMLInputElement; // bindable
22
+ * styling?: SVSClass;
23
+ * variant?: string; // bindable (VARIANT.NEUTRAL)
24
24
  * }
25
25
  * ```
26
26
  */
27
- declare const HotkeyCapture: import("svelte").Component<HotkeyCaptureProps, {}, "active" | "value" | "disabled" | "status" | "element">;
27
+ declare const HotkeyCapture: import("svelte").Component<HotkeyCaptureProps, {}, "variant" | "active" | "value" | "disabled" | "element">;
28
28
  type HotkeyCapture = ReturnType<typeof HotkeyCapture>;
29
29
  export default HotkeyCapture;
@@ -1,45 +1,45 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface ModalProps {
6
- children: Snippet;
7
- open?: boolean; // bindable <false>
8
- closable?: boolean; // <true>
6
+ children: Snippet<[string]>; // Snippet<[variant]>
7
+ open?: boolean; // bindable (false)
8
+ closable?: boolean; // (true)
9
9
  trigger?: HTMLElement; // bindable
10
10
  ariaLabel?: string;
11
- status?: string; // bindable <STATE.NEUTRAL>
12
- style?: SVSStyle;
11
+ variant?: string; // bindable (VARIANT.NEUTRAL)
12
+ styling?: SVSClass;
13
13
  element?: HTMLDialogElement; // bindable
14
14
  }
15
15
  ```
16
16
  -->
17
17
  <script module lang="ts">
18
18
  export interface ModalProps {
19
- children: Snippet;
20
- open?: boolean; // bindable <false>
21
- closable?: boolean; // <true>
19
+ children: Snippet<[string]>; // Snippet<[variant]>
20
+ open?: boolean; // bindable (false)
21
+ closable?: boolean; // (true)
22
22
  trigger?: HTMLElement; // bindable
23
23
  ariaLabel?: string;
24
- status?: string; // bindable <STATE.NEUTRAL>
25
- style?: SVSStyle;
26
24
  element?: HTMLDialogElement; // bindable
25
+ styling?: SVSClass;
26
+ variant?: string; // bindable (VARIANT.NEUTRAL)
27
27
  }
28
28
  export type ModalReqdProps = "children";
29
- export type ModalBindProps = "open" | "status" | "element";
29
+ export type ModalBindProps = "open" | "variant" | "element";
30
30
 
31
31
  const preset = "svs-modal";
32
32
 
33
33
  import { type Snippet, untrack } from "svelte";
34
- import { type SVSStyle, STATE, PARTS, fnClass } from "./core";
34
+ import { type SVSClass, VARIANT, PARTS, fnClass } from "./core";
35
35
  </script>
36
36
 
37
37
  <script lang="ts">
38
- let { children, open = $bindable(false), closable = true, trigger = $bindable(), ariaLabel, status = $bindable(""), style, element = $bindable() }: ModalProps = $props();
38
+ let { children, open = $bindable(false), closable = true, trigger = $bindable(), ariaLabel, element = $bindable(), styling, variant = $bindable("") }: ModalProps = $props();
39
39
 
40
40
  // *** Initialize *** //
41
- if (!status) status = STATE.NEUTRAL;
42
- const cls = fnClass(preset, style);
41
+ if (!variant) variant = VARIANT.NEUTRAL;
42
+ const cls = fnClass(preset, styling);
43
43
 
44
44
  // *** Bind Handlers *** //
45
45
  $effect(() => {
@@ -70,9 +70,9 @@
70
70
  <!---------------------------------------->
71
71
 
72
72
  <!-- svelte-ignore a11y_autofocus -->
73
- <dialog bind:this={element} class={cls(PARTS.WHOLE, status)} aria-label={ariaLabel} {onclick} {onkeydown} {onclose} autofocus={true}>
74
- <div class={cls(PARTS.MAIN, status)}>
75
- {@render children()}
73
+ <dialog bind:this={element} class={cls(PARTS.WHOLE, variant)} aria-label={ariaLabel} {onclick} {onkeydown} {onclose} autofocus={true}>
74
+ <div class={cls(PARTS.MAIN, variant)}>
75
+ {@render children(variant)}
76
76
  </div>
77
77
  </dialog>
78
78
 
@@ -1,32 +1,32 @@
1
1
  export interface ModalProps {
2
- children: Snippet;
2
+ children: Snippet<[string]>;
3
3
  open?: boolean;
4
4
  closable?: boolean;
5
5
  trigger?: HTMLElement;
6
6
  ariaLabel?: string;
7
- status?: string;
8
- style?: SVSStyle;
9
7
  element?: HTMLDialogElement;
8
+ styling?: SVSClass;
9
+ variant?: string;
10
10
  }
11
11
  export type ModalReqdProps = "children";
12
- export type ModalBindProps = "open" | "status" | "element";
12
+ export type ModalBindProps = "open" | "variant" | "element";
13
13
  import { type Snippet } from "svelte";
14
- import { type SVSStyle } from "./core";
14
+ import { type SVSClass } from "./core";
15
15
  /**
16
- * default value: `<value>`
16
+ * default value: `(value)`
17
17
  * ```ts
18
18
  * interface ModalProps {
19
- * children: Snippet;
20
- * open?: boolean; // bindable <false>
21
- * closable?: boolean; // <true>
19
+ * children: Snippet<[string]>; // Snippet<[variant]>
20
+ * open?: boolean; // bindable (false)
21
+ * closable?: boolean; // (true)
22
22
  * trigger?: HTMLElement; // bindable
23
23
  * ariaLabel?: string;
24
- * status?: string; // bindable <STATE.NEUTRAL>
25
- * style?: SVSStyle;
24
+ * variant?: string; // bindable (VARIANT.NEUTRAL)
25
+ * styling?: SVSClass;
26
26
  * element?: HTMLDialogElement; // bindable
27
27
  * }
28
28
  * ```
29
29
  */
30
- declare const Modal: import("svelte").Component<ModalProps, {}, "open" | "status" | "element" | "trigger">;
30
+ declare const Modal: import("svelte").Component<ModalProps, {}, "variant" | "open" | "element" | "trigger">;
31
31
  type Modal = ReturnType<typeof Modal>;
32
32
  export default Modal;
@@ -1,58 +1,59 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface ProgressTrackerProps {
6
- current: number; // bindable <0>
6
+ current: number; // bindable (0)
7
7
  labels: string[];
8
- aux?: Snippet<[string, number]>; // Snippet<[status,index]>
9
- extra?: Snippet<[string, number]>; // Snippet<[status,index]>
10
- status?: string; // bindable <STATE.NEUTRAL>
11
- eachStatus?: SvelteMap<number, string> | Map<number, string>;
12
- style?: SVSStyle;
8
+ aux?: Snippet<[string, number]>; // Snippet<[variant,index]>
9
+ extra?: Snippet<[string, number]>; // Snippet<[variant,index]>
10
+ variant?: string; // bindable (VARIANT.NEUTRAL)
11
+ eachVariant?: SvelteMap<number, string> | Map<number, string>;
12
+ styling?: SVSClass;
13
13
  }
14
14
  ```
15
15
  -->
16
16
  <script module lang="ts">
17
17
  export interface ProgressTrackerProps {
18
- current: number; // bindable <0>
18
+ current: number; // bindable (0)
19
19
  labels: string[];
20
- aux?: Snippet<[string, number]>; // Snippet<[status,index]>
21
- extra?: Snippet<[string, number]>; // Snippet<[status,index]>
22
- status?: string; // bindable <STATE.NEUTRAL>
23
- eachStatus?: SvelteMap<number, string> | Map<number, string>;
24
- style?: SVSStyle;
20
+ aux?: Snippet<[number, string]>; // Snippet<[index,variant]>
21
+ extra?: Snippet<[number, string]>; // Snippet<[index,variant]>
22
+ styling?: SVSClass;
23
+ variant?: string; // bindable (VARIANT.NEUTRAL)
24
+ eachVariant?: SvelteMap<number, string> | Map<number, string>;
25
25
  }
26
26
  export type ProgressTrackerReqdProps = "current" | "labels";
27
- export type ProgressTrackerBindProps = "current" | "status";
27
+ export type ProgressTrackerBindProps = "current" | "variant";
28
28
 
29
29
  const preset = "svs-progress-tracker";
30
30
 
31
31
  import { type Snippet } from "svelte";
32
32
  import { type SvelteMap } from "svelte/reactivity";
33
- import { type SVSStyle, STATE, PARTS, fnClass } from "./core";
33
+ import { type SVSClass, VARIANT, PARTS, fnClass, isUnsignedInteger } from "./core";
34
34
  </script>
35
35
 
36
36
  <script lang="ts">
37
- let { current = $bindable(0), labels, aux, extra, status = $bindable(""), eachStatus, style }: ProgressTrackerProps = $props();
37
+ let { current = $bindable(-1), labels, aux, extra, styling, variant = $bindable(""), eachVariant }: ProgressTrackerProps = $props();
38
38
 
39
39
  // *** Initialize *** //
40
- if (!status) status = STATE.NEUTRAL;
41
- const cls = fnClass(preset, style);
40
+ if (!variant) variant = VARIANT.NEUTRAL;
41
+ if (!isUnsignedInteger(current)) current = 0;
42
+ const cls = fnClass(preset, styling);
42
43
 
43
44
  // *** Status *** //
44
45
  function getEachStatus(index: number): string {
45
- if (eachStatus?.has(index)) return eachStatus.get(index)!;
46
- if (index < current) return STATE.ACTIVE;
47
- if (index > current) return STATE.INACTIVE;
48
- return status;
46
+ if (eachVariant?.has(index)) return eachVariant.get(index)!;
47
+ if (index < current) return VARIANT.ACTIVE;
48
+ if (index > current) return VARIANT.INACTIVE;
49
+ return variant;
49
50
  }
50
51
  </script>
51
52
 
52
53
  <!---------------------------------------->
53
54
 
54
55
  {#if labels.length}
55
- <ol class={cls(PARTS.WHOLE, status)}>
56
+ <ol class={cls(PARTS.WHOLE, variant)}>
56
57
  {#each labels as label, i}
57
58
  {@const stat = getEachStatus(i)}
58
59
  {#if i > current}
@@ -61,7 +62,7 @@
61
62
  <li class={cls(PARTS.MAIN, stat)} aria-current={i === current ? "step" : false}>
62
63
  {#if aux}
63
64
  <div class={cls(PARTS.AUX, stat)}>
64
- {@render aux(stat, i)}
65
+ {@render aux(i, stat)}
65
66
  </div>
66
67
  {/if}
67
68
  <div class={cls(PARTS.LABEL, stat)}>
@@ -77,9 +78,9 @@
77
78
 
78
79
  {#snippet separator(i: number)}
79
80
  {#if extra}
80
- {@const stat = i < current ? STATE.ACTIVE : STATE.INACTIVE}
81
+ {@const stat = i < current ? VARIANT.ACTIVE : VARIANT.INACTIVE}
81
82
  <li class={cls(PARTS.EXTRA, stat)} role="separator">
82
- {@render extra(stat, i)}
83
+ {@render extra(i, stat)}
83
84
  </li>
84
85
  {/if}
85
86
  {/snippet}
@@ -1,31 +1,31 @@
1
1
  export interface ProgressTrackerProps {
2
2
  current: number;
3
3
  labels: string[];
4
- aux?: Snippet<[string, number]>;
5
- extra?: Snippet<[string, number]>;
6
- status?: string;
7
- eachStatus?: SvelteMap<number, string> | Map<number, string>;
8
- style?: SVSStyle;
4
+ aux?: Snippet<[number, string]>;
5
+ extra?: Snippet<[number, string]>;
6
+ styling?: SVSClass;
7
+ variant?: string;
8
+ eachVariant?: SvelteMap<number, string> | Map<number, string>;
9
9
  }
10
10
  export type ProgressTrackerReqdProps = "current" | "labels";
11
- export type ProgressTrackerBindProps = "current" | "status";
11
+ export type ProgressTrackerBindProps = "current" | "variant";
12
12
  import { type Snippet } from "svelte";
13
13
  import { type SvelteMap } from "svelte/reactivity";
14
- import { type SVSStyle } from "./core";
14
+ import { type SVSClass } from "./core";
15
15
  /**
16
- * default value: `<value>`
16
+ * default value: `(value)`
17
17
  * ```ts
18
18
  * interface ProgressTrackerProps {
19
- * current: number; // bindable <0>
19
+ * current: number; // bindable (0)
20
20
  * labels: string[];
21
- * aux?: Snippet<[string, number]>; // Snippet<[status,index]>
22
- * extra?: Snippet<[string, number]>; // Snippet<[status,index]>
23
- * status?: string; // bindable <STATE.NEUTRAL>
24
- * eachStatus?: SvelteMap<number, string> | Map<number, string>;
25
- * style?: SVSStyle;
21
+ * aux?: Snippet<[string, number]>; // Snippet<[variant,index]>
22
+ * extra?: Snippet<[string, number]>; // Snippet<[variant,index]>
23
+ * variant?: string; // bindable (VARIANT.NEUTRAL)
24
+ * eachVariant?: SvelteMap<number, string> | Map<number, string>;
25
+ * styling?: SVSClass;
26
26
  * }
27
27
  * ```
28
28
  */
29
- declare const ProgressTracker: import("svelte").Component<ProgressTrackerProps, {}, "status" | "current">;
29
+ declare const ProgressTracker: import("svelte").Component<ProgressTrackerProps, {}, "variant" | "current">;
30
30
  type ProgressTracker = ReturnType<typeof ProgressTracker>;
31
31
  export default ProgressTracker;
@@ -1,25 +1,25 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface SelectFieldProps {
6
6
  options: SvelteMap<string, string> | Map<string, string>;
7
7
  label?: string;
8
8
  extra?: string;
9
- aux?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[status,value,element]>
10
- left?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[status,value,element]>
11
- right?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[status,value,element]>
9
+ aux?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[value,variant,element]>
10
+ left?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[value,variant,element]>
11
+ right?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[value,variant,element]>
12
12
  bottom?: string;
13
- descFirst?: boolean; // <false>
13
+ descFirst?: boolean; // (false)
14
14
  value?: string; // bindable
15
15
  validations?: SelectFieldValidation[];
16
- status?: string; // bindable <STATE.NEUTRAL>
17
- style?: SVSStyle;
18
16
  attributes?: HTMLSelectAttributes;
19
17
  action?: Action;
20
18
  element?: HTMLSelectElement; // bindable
19
+ styling?: SVSClass;
20
+ variant?: string; // bindable (VARIANT.NEUTRAL)
21
21
  }
22
- type SelectFieldValidation = (value: string, validity: ValidityState) => string;
22
+ type SelectFieldValidation = (value: string, validity: ValidityState) => string | undefined;
23
23
  ```
24
24
  -->
25
25
  <script module lang="ts">
@@ -27,22 +27,22 @@
27
27
  options: SvelteMap<string, string> | Map<string, string>;
28
28
  label?: string;
29
29
  extra?: string;
30
- aux?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[status,value,element]>
31
- left?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[status,value,element]>
32
- right?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[status,value,element]>
30
+ aux?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[value,variant,element]>
31
+ left?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[value,variant,element]>
32
+ right?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[value,variant,element]>
33
33
  bottom?: string;
34
- descFirst?: boolean; // <false>
34
+ descFirst?: boolean; // (false)
35
35
  value?: string; // bindable
36
36
  validations?: SelectFieldValidation[];
37
- status?: string; // bindable <STATE.NEUTRAL>
38
- style?: SVSStyle;
39
37
  attributes?: HTMLSelectAttributes;
40
38
  action?: Action;
41
39
  element?: HTMLSelectElement; // bindable
40
+ styling?: SVSClass;
41
+ variant?: string; // bindable (VARIANT.NEUTRAL)
42
42
  }
43
43
  export type SelectFieldReqdProps = "options";
44
- export type SelectFieldBindProps = "value" | "status" | "element";
45
- export type SelectFieldValidation = (value: string, validity: ValidityState) => string;
44
+ export type SelectFieldBindProps = "value" | "variant" | "element";
45
+ export type SelectFieldValidation = (value: string, validity: ValidityState) => string | undefined;
46
46
 
47
47
  const preset = "svs-select-field";
48
48
 
@@ -50,15 +50,15 @@
50
50
  import { type Action } from "svelte/action";
51
51
  import { type SvelteMap } from "svelte/reactivity";
52
52
  import { type HTMLSelectAttributes } from "svelte/elements";
53
- import { type SVSStyle, STATE, PARTS, elemId, fnClass, isNeutral, omit } from "./core";
53
+ import { type SVSClass, VARIANT, PARTS, elemId, fnClass, isNeutral, omit } from "./core";
54
54
  </script>
55
55
 
56
56
  <script lang="ts">
57
- let { options, label, extra, aux, left, right, bottom, descFirst = false, value = $bindable(""), validations = [], status = $bindable(""), style, attributes, action, element = $bindable() }: SelectFieldProps = $props();
57
+ let { options, label, extra, aux, left, right, bottom, descFirst = false, value = $bindable(""), validations = [], attributes, action, element = $bindable(), styling, variant = $bindable("") }: SelectFieldProps = $props();
58
58
 
59
59
  // *** Initialize *** //
60
- if (!status) status = STATE.NEUTRAL;
61
- const cls = fnClass(preset, style);
60
+ if (!variant) variant = VARIANT.NEUTRAL;
61
+ const cls = fnClass(preset, styling);
62
62
  const id = attributes?.id ? attributes.id : elemId.get(label?.trim());
63
63
  const idLabel = elemId.get(label?.trim());
64
64
  const idDesc = elemId.get(bottom?.trim());
@@ -67,15 +67,15 @@
67
67
  let message = $state(bottom);
68
68
 
69
69
  // *** Status *** //
70
- let neutral = isNeutral(status) ? status : STATE.NEUTRAL;
71
- $effect(() => { neutral = isNeutral(status) ? status : neutral; });
72
- let live = $derived(status === STATE.INACTIVE ? "alert" : "status");
73
- let invalid = $derived(status === STATE.INACTIVE ? true : undefined);
74
- let idMsg = $derived(status === STATE.INACTIVE && message?.trim() ? idErr : undefined);
70
+ let neutral = isNeutral(variant) ? variant : VARIANT.NEUTRAL;
71
+ $effect(() => { neutral = isNeutral(variant) ? variant : neutral; });
72
+ let live = $derived(variant === VARIANT.INACTIVE ? "alert" : "status");
73
+ let invalid = $derived(variant === VARIANT.INACTIVE ? true : undefined);
74
+ let idMsg = $derived(variant === VARIANT.INACTIVE && message?.trim() ? idErr : undefined);
75
75
  function shift(oninvalid?: boolean) {
76
76
  const vmsg = element?.validationMessage ?? "";
77
- status = !value && !oninvalid ? neutral : vmsg ? STATE.INACTIVE : STATE.ACTIVE;
78
- message = status === STATE.INACTIVE ? vmsg ? vmsg : bottom : bottom;
77
+ variant = !value && !oninvalid ? neutral : vmsg ? VARIANT.INACTIVE : VARIANT.ACTIVE;
78
+ message = variant === VARIANT.INACTIVE ? vmsg ? vmsg : bottom : bottom;
79
79
  }
80
80
  function verify() {
81
81
  if (!element) return;
@@ -109,17 +109,17 @@
109
109
  <!---------------------------------------->
110
110
 
111
111
  {#if opts.length}
112
- <div class={cls(PARTS.WHOLE, status)} role="group" aria-labelledby={idLabel}>
112
+ <div class={cls(PARTS.WHOLE, variant)} role="group" aria-labelledby={idLabel}>
113
113
  {#if aux}
114
- <div class={cls(PARTS.TOP, status)}>
114
+ <div class={cls(PARTS.TOP, variant)}>
115
115
  {@render lbl()}
116
- <span class={cls(PARTS.AUX, status)}>{@render aux(status, value, element)}</span>
116
+ <span class={cls(PARTS.AUX, variant)}>{@render aux(value, variant, element)}</span>
117
117
  </div>
118
118
  {:else}
119
119
  {@render lbl()}
120
120
  {/if}
121
121
  {@render desc(descFirst)}
122
- <div class={cls(PARTS.MIDDLE, status)}>
122
+ <div class={cls(PARTS.MIDDLE, variant)}>
123
123
  {@render side(PARTS.LEFT, left)}
124
124
  {@render main()}
125
125
  {@render side(PARTS.RIGHT, right)}
@@ -130,21 +130,21 @@
130
130
 
131
131
  {#snippet lbl()}
132
132
  {#if label?.trim()}
133
- <span class={cls(PARTS.LABEL, status)} id={idLabel}>
133
+ <span class={cls(PARTS.LABEL, variant)} id={idLabel}>
134
134
  {label}
135
135
  {#if extra?.trim()}
136
- <span class={cls(PARTS.EXTRA, status)}>{extra}</span>
136
+ <span class={cls(PARTS.EXTRA, variant)}>{extra}</span>
137
137
  {/if}
138
138
  </span>
139
139
  {/if}
140
140
  {/snippet}
141
141
  {#snippet side(area: string, body?: Snippet<[string, string, HTMLSelectElement | undefined]>)}
142
142
  {#if body}
143
- <span class={cls(area, status)}>{@render body(status, value, element)}</span>
143
+ <span class={cls(area, variant)}>{@render body(value, variant, element)}</span>
144
144
  {/if}
145
145
  {/snippet}
146
146
  {#snippet main()}
147
- {@const c = cls(PARTS.MAIN, status)}
147
+ {@const c = cls(PARTS.MAIN, variant)}
148
148
  {#if action}
149
149
  <select bind:value bind:this={element} class={c} {id} {oninvalid} {...attrs} aria-describedby={idDesc} aria-invalid={invalid} aria-errormessage={idMsg} use:action>
150
150
  {@render option()}
@@ -162,6 +162,6 @@
162
162
  {/snippet}
163
163
  {#snippet desc(show: boolean)}
164
164
  {#if show && message?.trim()}
165
- <div class={cls(PARTS.BOTTOM, status)} id={idDesc ?? idErr} role={live}>{message}</div>
165
+ <div class={cls(PARTS.BOTTOM, variant)} id={idDesc ?? idErr} role={live}>{message}</div>
166
166
  {/if}
167
167
  {/snippet}
@@ -9,43 +9,43 @@ export interface SelectFieldProps {
9
9
  descFirst?: boolean;
10
10
  value?: string;
11
11
  validations?: SelectFieldValidation[];
12
- status?: string;
13
- style?: SVSStyle;
14
12
  attributes?: HTMLSelectAttributes;
15
13
  action?: Action;
16
14
  element?: HTMLSelectElement;
15
+ styling?: SVSClass;
16
+ variant?: string;
17
17
  }
18
18
  export type SelectFieldReqdProps = "options";
19
- export type SelectFieldBindProps = "value" | "status" | "element";
20
- export type SelectFieldValidation = (value: string, validity: ValidityState) => string;
19
+ export type SelectFieldBindProps = "value" | "variant" | "element";
20
+ export type SelectFieldValidation = (value: string, validity: ValidityState) => string | undefined;
21
21
  import { type Snippet } from "svelte";
22
22
  import { type Action } from "svelte/action";
23
23
  import { type SvelteMap } from "svelte/reactivity";
24
24
  import { type HTMLSelectAttributes } from "svelte/elements";
25
- import { type SVSStyle } from "./core";
25
+ import { type SVSClass } from "./core";
26
26
  /**
27
- * default value: `<value>`
27
+ * default value: `(value)`
28
28
  * ```ts
29
29
  * interface SelectFieldProps {
30
30
  * options: SvelteMap<string, string> | Map<string, string>;
31
31
  * label?: string;
32
32
  * extra?: string;
33
- * aux?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[status,value,element]>
34
- * left?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[status,value,element]>
35
- * right?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[status,value,element]>
33
+ * aux?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[value,variant,element]>
34
+ * left?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[value,variant,element]>
35
+ * right?: Snippet<[string, string, HTMLSelectElement | undefined]>; // Snippet<[value,variant,element]>
36
36
  * bottom?: string;
37
- * descFirst?: boolean; // <false>
37
+ * descFirst?: boolean; // (false)
38
38
  * value?: string; // bindable
39
39
  * validations?: SelectFieldValidation[];
40
- * status?: string; // bindable <STATE.NEUTRAL>
41
- * style?: SVSStyle;
42
40
  * attributes?: HTMLSelectAttributes;
43
41
  * action?: Action;
44
42
  * element?: HTMLSelectElement; // bindable
43
+ * styling?: SVSClass;
44
+ * variant?: string; // bindable (VARIANT.NEUTRAL)
45
45
  * }
46
- * type SelectFieldValidation = (value: string, validity: ValidityState) => string;
46
+ * type SelectFieldValidation = (value: string, validity: ValidityState) => string | undefined;
47
47
  * ```
48
48
  */
49
- declare const SelectField: import("svelte").Component<SelectFieldProps, {}, "value" | "status" | "element">;
49
+ declare const SelectField: import("svelte").Component<SelectFieldProps, {}, "variant" | "value" | "element">;
50
50
  type SelectField = ReturnType<typeof SelectField>;
51
51
  export default SelectField;
@@ -1,20 +1,20 @@
1
1
  <!--
2
2
  @component
3
- default value: `<value>`
3
+ default value: `(value)`
4
4
  ```ts
5
5
  interface SliderProps {
6
6
  range: Range; // bindable
7
- left?: Snippet<[string, number, HTMLInputElement | undefined]>; // Snippet<[status,value,element]>
8
- right?: Snippet<[string, number, HTMLInputElement | undefined]>; // Snippet<[status,value,element]>
9
- value?: number; // bindable <min+((max-min)/2)>
10
- step?: number | "any"; // <1>
7
+ left?: Snippet<[number, string, HTMLInputElement | undefined]>; // Snippet<[value,variant,element]>
8
+ right?: Snippet<[number, string, HTMLInputElement | undefined]>; // Snippet<[value,variant,element]>
9
+ value?: number; // bindable (min+((max-min)/2))
10
+ step?: number | "any"; // (1)
11
11
  options?: SvelteSet<number> | Set<number>;
12
- background?: Range; // <{ min: 5, max: 95 }>
13
- status?: string; // bindable <STATE.NEUTRAL>
14
- style?: SVSStyle;
12
+ background?: Range; // ({ min: 5, max: 95 }); linear-gradient rate limit of slider's track
15
13
  attributes?: HTMLInputAttributes;
16
14
  action?: Action;
17
15
  element?: HTMLInputElement; // bindable
16
+ styling?: SVSClass;
17
+ variant?: string; // bindable (VARIANT.NEUTRAL)
18
18
  }
19
19
  type Range = { min: number, max: number };
20
20
  ```
@@ -22,20 +22,20 @@
22
22
  <script module lang="ts">
23
23
  export interface SliderProps {
24
24
  range: Range; // bindable
25
- left?: Snippet<[string, number, HTMLInputElement | undefined]>; // Snippet<[status,value,element]>
26
- right?: Snippet<[string, number, HTMLInputElement | undefined]>; // Snippet<[status,value,element]>
27
- value?: number; // bindable <min+((max-min)/2)>
28
- step?: number | "any"; // <1>
25
+ left?: Snippet<[number, string, HTMLInputElement | undefined]>; // Snippet<[value,variant,element]>
26
+ right?: Snippet<[number, string, HTMLInputElement | undefined]>; // Snippet<[value,variant,element]>
27
+ value?: number; // bindable (min+((max-min)/2))
28
+ step?: number | "any"; // (1)
29
29
  options?: SvelteSet<number> | Set<number>;
30
- background?: Range; // <{ min: 5, max: 95 }>
31
- status?: string; // bindable <STATE.NEUTRAL>
32
- style?: SVSStyle;
30
+ background?: Range; // ({ min: 5, max: 95 }); linear-gradient rate limit of slider's track
33
31
  attributes?: HTMLInputAttributes;
34
32
  action?: Action;
35
33
  element?: HTMLInputElement; // bindable
34
+ styling?: SVSClass;
35
+ variant?: string; // bindable (VARIANT.NEUTRAL)
36
36
  }
37
37
  export type SliderReqdProps = "min" | "max";
38
- export type SliderBindProps = "min" | "max" | "value" | "status" | "element";
38
+ export type SliderBindProps = "min" | "max" | "value" | "variant" | "element";
39
39
  export type Range = { min: number, max: number };
40
40
 
41
41
  const preset = "svs-slider";
@@ -44,18 +44,19 @@
44
44
  import { type Action } from "svelte/action";
45
45
  import { type SvelteSet } from "svelte/reactivity";
46
46
  import { type HTMLInputAttributes } from "svelte/elements";
47
- import { type SVSStyle, STATE, PARTS, elemId, fnClass, omit } from "./core";
47
+ import { type SVSClass, VARIANT, PARTS, elemId, fnClass, omit } from "./core";
48
48
  </script>
49
49
 
50
50
  <script lang="ts">
51
- let { range = $bindable(), left, right, value = $bindable(), step = 1, options, background = { min: 5, max: 95 }, status = $bindable(""), style, attributes, action, element = $bindable()}: SliderProps = $props();
51
+ let { range = $bindable(), left, right, value = $bindable(), step = 1, options, background = { min: 5, max: 95 }, attributes, action, element = $bindable(), styling, variant = $bindable("") }: SliderProps = $props();
52
52
 
53
53
  // *** Initialize *** //
54
- if (!status) status = STATE.NEUTRAL;
55
- const cls = fnClass(preset, style);
54
+ if (!variant) variant = VARIANT.NEUTRAL;
55
+ const cls = fnClass(preset, styling);
56
56
  const idList = elemId.get(options?.size);
57
57
  const attrs = omit(attributes, "class", "type", "value", "min", "max", "step", "list");
58
58
  if (range.min > range.max) range = { min: range.max, max: range.min };
59
+ if (background.min > background.max) background = { min: background.max, max: background.min };
59
60
  if (value === undefined || value < range.min || value > range.max) value = range.min + ((range.max - range.min) / 2);
60
61
 
61
62
  // *** Bind Handlers *** //
@@ -65,12 +66,12 @@
65
66
 
66
67
  <!---------------------------------------->
67
68
 
68
- <span class={cls(PARTS.WHOLE, status)}>
69
+ <span class={cls(PARTS.WHOLE, variant)}>
69
70
  {@render side(PARTS.LEFT, left)}
70
71
  {#if action}
71
- <input bind:value bind:this={element} class={cls(PARTS.MAIN, status)} style={dynStyle} list={idList} type="range" min={range.min} max={range.max} {step} {...attrs} use:action />
72
+ <input bind:value bind:this={element} class={cls(PARTS.MAIN, variant)} style={dynStyle} list={idList} type="range" min={range.min} max={range.max} {step} {...attrs} use:action />
72
73
  {:else}
73
- <input bind:value bind:this={element} class={cls(PARTS.MAIN, status)} style={dynStyle} list={idList} type="range" min={range.min} max={range.max} {step} {...attrs} />
74
+ <input bind:value bind:this={element} class={cls(PARTS.MAIN, variant)} style={dynStyle} list={idList} type="range" min={range.min} max={range.max} {step} {...attrs} />
74
75
  {/if}
75
76
  {#if options?.size}
76
77
  <datalist id={idList}>
@@ -82,8 +83,8 @@
82
83
  {@render side(PARTS.RIGHT, right)}
83
84
  </span>
84
85
 
85
- {#snippet side(area: string, body?: Snippet<[string, number, HTMLInputElement | undefined]>)}
86
+ {#snippet side(area: string, body?: Snippet<[number, string, HTMLInputElement | undefined]>)}
86
87
  {#if body}
87
- <span class={cls(area, status)}>{@render body(status, value!, element)}</span>
88
+ <span class={cls(area, variant)}>{@render body(value!, variant, element)}</span>
88
89
  {/if}
89
90
  {/snippet}