svseeds 0.3.3 → 0.3.4

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 (46) hide show
  1. package/_svseeds/Accordion.svelte +11 -7
  2. package/_svseeds/Accordion.svelte.d.ts +2 -2
  3. package/_svseeds/DarkToggle.svelte +10 -3
  4. package/_svseeds/TagsInput.svelte +21 -22
  5. package/_svseeds/TagsInput.svelte.d.ts +3 -3
  6. package/_svseeds/_Badge.svelte +4 -5
  7. package/_svseeds/_Badge.svelte.d.ts +2 -2
  8. package/_svseeds/_Button.svelte +4 -5
  9. package/_svseeds/_Button.svelte.d.ts +2 -2
  10. package/_svseeds/_CheckField.svelte +7 -7
  11. package/_svseeds/_CheckField.svelte.d.ts +2 -2
  12. package/_svseeds/_ColorPicker.svelte +4 -5
  13. package/_svseeds/_ColorPicker.svelte.d.ts +2 -2
  14. package/_svseeds/_ComboBox.svelte +4 -5
  15. package/_svseeds/_ComboBox.svelte.d.ts +2 -2
  16. package/_svseeds/_ContextMenu.svelte +4 -5
  17. package/_svseeds/_ContextMenu.svelte.d.ts +2 -2
  18. package/_svseeds/_Disclosure.svelte +4 -5
  19. package/_svseeds/_Disclosure.svelte.d.ts +2 -2
  20. package/_svseeds/_HotkeyCapture.svelte +4 -5
  21. package/_svseeds/_HotkeyCapture.svelte.d.ts +2 -2
  22. package/_svseeds/_Modal.svelte +4 -5
  23. package/_svseeds/_Modal.svelte.d.ts +2 -2
  24. package/_svseeds/_ProgressTracker.svelte +4 -5
  25. package/_svseeds/_ProgressTracker.svelte.d.ts +2 -2
  26. package/_svseeds/_SelectField.svelte +7 -8
  27. package/_svseeds/_SelectField.svelte.d.ts +2 -2
  28. package/_svseeds/_Slider.svelte +4 -5
  29. package/_svseeds/_Slider.svelte.d.ts +2 -2
  30. package/_svseeds/_Sortable.svelte +4 -5
  31. package/_svseeds/_Sortable.svelte.d.ts +2 -2
  32. package/_svseeds/_Tabs.svelte +4 -5
  33. package/_svseeds/_Tabs.svelte.d.ts +2 -2
  34. package/_svseeds/_TextField.svelte +7 -8
  35. package/_svseeds/_TextField.svelte.d.ts +2 -2
  36. package/_svseeds/_Toggle.svelte +4 -5
  37. package/_svseeds/_Toggle.svelte.d.ts +2 -2
  38. package/_svseeds/_TogglesField.svelte +7 -7
  39. package/_svseeds/_TogglesField.svelte.d.ts +2 -2
  40. package/_svseeds/_Tooltip.svelte +4 -5
  41. package/_svseeds/_Tooltip.svelte.d.ts +2 -2
  42. package/_svseeds/core.d.ts +4 -3
  43. package/_svseeds/core.js +1 -1
  44. package/index.d.ts +5 -5
  45. package/index.js +5 -5
  46. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  labels?: string[],
4
4
  current?: number, // bindable <-1>
5
5
  status?: string, // bindable <STATE.DEFAULT>
6
- style?: ClassRuleSet | string,
6
+ style?: SVSStyle,
7
7
  deps?: AccordionDeps,
8
8
  [key: string]: unknown | Snippet,
9
9
  };
@@ -14,8 +14,7 @@
14
14
  export type AccordionBindProps = "current" | "status";
15
15
 
16
16
  type NamedId = { id: string, name: string };
17
- const svs = "svs-accordion";
18
- const preset: ClassRuleSet = {};
17
+ const preset = "svs-accordion";
19
18
  const roleLabel = "label";
20
19
  const rolePanel = "panel";
21
20
 
@@ -29,7 +28,7 @@
29
28
  }
30
29
 
31
30
  import { type Snippet, untrack } from "svelte";
32
- import { type ClassRuleSet, STATE, AREA, elemId, fnClass, omit } from "./core";
31
+ import { type SVSStyle, STATE, AREA, elemId, fnClass, omit } from "./core";
33
32
  import Disclosure, { type DisclosureProps, type DisclosureReqdProps, type DisclosureBindProps } from "./_Disclosure.svelte";
34
33
  </script>
35
34
 
@@ -38,8 +37,7 @@
38
37
 
39
38
  // *** Initialize *** //
40
39
  if (!status) status = STATE.DEFAULT;
41
- const cls = fnClass(svs, preset, style);
42
- const propsDisclosure = omit(deps?.svsDisclosure, "attributes");
40
+ const cls = fnClass(preset, style);
43
41
  const isStrLabel = labels.length > 0;
44
42
  const lbls = toNamedId(isStrLabel ? labels : getSnippetNames(roleLabel, rest));
45
43
  const panels = getSnippetNames(rolePanel, rest);
@@ -49,6 +47,12 @@
49
47
  let opens = $state(Array(lbls.length).fill(false));
50
48
  let elems: HTMLDetailsElement[] = $state([]);
51
49
 
50
+ // *** Initialize Deps *** //
51
+ const svsDisclosure = {
52
+ ...omit(deps?.svsDisclosure, "attributes", "style"),
53
+ style: deps?.svsDisclosure?.style ?? `${preset} svs-disclosure`,
54
+ };
55
+
52
56
  // *** Bind Handlers *** //
53
57
  $effect.pre(() => {
54
58
  current;
@@ -83,7 +87,7 @@
83
87
  <div class={cls(AREA.WHOLE, status)} role="group">
84
88
  {#each lbls as { id, name }, i (id)}
85
89
  {@const ontoggle = exclusiveToggle(i)}
86
- <Disclosure bind:open={opens[i]} bind:element={elems[i]} label={isStrLabel ? name : (rest[name] as Snippet)} attributes={{...deps?.svsDisclosure?.attributes, ontoggle}} {...propsDisclosure}>
90
+ <Disclosure bind:open={opens[i]} bind:element={elems[i]} label={isStrLabel ? name : (rest[name] as Snippet)} attributes={{...deps?.svsDisclosure?.attributes, ontoggle}} {...svsDisclosure}>
87
91
  {@render (rest[panels[i]] as Snippet)()}
88
92
  </Disclosure>
89
93
  {/each}
@@ -2,7 +2,7 @@ export type AccordionProps = {
2
2
  labels?: string[];
3
3
  current?: number;
4
4
  status?: string;
5
- style?: ClassRuleSet | string;
5
+ style?: SVSStyle;
6
6
  deps?: AccordionDeps;
7
7
  [key: string]: unknown | Snippet;
8
8
  };
@@ -12,7 +12,7 @@ export type AccordionDeps = {
12
12
  export type AccordionReqdProps = never;
13
13
  export type AccordionBindProps = "current" | "status";
14
14
  import { type Snippet } from "svelte";
15
- import { type ClassRuleSet } from "./core";
15
+ import { type SVSStyle } from "./core";
16
16
  import { type DisclosureProps, type DisclosureReqdProps, type DisclosureBindProps } from "./_Disclosure.svelte";
17
17
  declare const Accordion: import("svelte").Component<AccordionProps, {}, "status" | "current">;
18
18
  type Accordion = ReturnType<typeof Accordion>;
@@ -11,7 +11,8 @@
11
11
  export type DarkToggleReqdProps = never;
12
12
  export type DarkToggleBindProps = "dark" | "status" | "element";
13
13
 
14
- const ariaLabel = "Toggle theme color";
14
+ const label = "Toggle theme color";
15
+ const preset = "svs-dark-toggle";
15
16
 
16
17
  class Theme {
17
18
  static #DARK = "dark";
@@ -112,7 +113,12 @@
112
113
  // *** Initialize *** //
113
114
  if (!status) status = STATE.DEFAULT;
114
115
  dark = theme.dark;
115
- const propsToggle = omit(deps?.svsToggle, "main");
116
+
117
+ // *** Initialize Deps *** //
118
+ const svsToggle = {
119
+ ...omit(deps?.svsToggle, "main", "style"),
120
+ style: deps?.svsToggle?.style ?? `${preset} svs-toggle`,
121
+ };
116
122
 
117
123
  // *** Bind Handlers *** //
118
124
  $effect.pre(() => { theme.dark = dark });
@@ -120,7 +126,8 @@
120
126
 
121
127
  <!---------------------------------------->
122
128
 
123
- <Toggle bind:value={dark} bind:status bind:element label={ariaLabel} {main} {...propsToggle} />
129
+ <Toggle bind:value={dark} bind:status bind:element {label} {main} {...svsToggle} />
130
+
124
131
  {#snippet svgDark()}
125
132
  <svg style="width: 100%; height: 100%;" viewBox="0 0 24 24" aria-hidden="true">
126
133
  <path fill-rule="evenodd" clip-rule="evenodd" d="M12.2256 2.00253C9.59172 1.94346 6.93894 2.9189 4.92893 4.92891C1.02369 8.83415 1.02369 15.1658 4.92893 19.071C8.83418 22.9763 15.1658 22.9763 19.0711 19.071C21.0811 17.061 22.0565 14.4082 21.9975 11.7743C21.9796 10.9772 21.8669 10.1818 21.6595 9.40643C21.0933 9.9488 20.5078 10.4276 19.9163 10.8425C18.5649 11.7906 17.1826 12.4053 15.9301 12.6837C14.0241 13.1072 12.7156 12.7156 12 12C11.2844 11.2844 10.8928 9.97588 11.3163 8.0699C11.5947 6.81738 12.2094 5.43511 13.1575 4.08368C13.5724 3.49221 14.0512 2.90664 14.5935 2.34046C13.8182 2.13305 13.0228 2.02041 12.2256 2.00253ZM17.6569 17.6568C18.9081 16.4056 19.6582 14.8431 19.9072 13.2186C16.3611 15.2643 12.638 15.4664 10.5858 13.4142C8.53361 11.362 8.73568 7.63895 10.7814 4.09281C9.1569 4.34184 7.59434 5.09193 6.34315 6.34313C3.21895 9.46732 3.21895 14.5326 6.34315 17.6568C9.46734 20.781 14.5327 20.781 17.6569 17.6568Z" />
@@ -9,7 +9,7 @@
9
9
  max?: TagCountValidation,
10
10
  validations?: ((values: string[]) => string)[],
11
11
  status?: string, // bindable <STATE.DEFAULT>
12
- style?: ClassRuleSet | string,
12
+ style?: SVSStyle,
13
13
  element?: HTMLInputElement, // bindable
14
14
  deps?: TagsInputDeps,
15
15
  };
@@ -21,12 +21,11 @@
21
21
  export type TagsInputBindProps = "dark" | "status" | "element";
22
22
  export type TagCountValidation = { value: number, message: string };
23
23
 
24
- const svs = "svs-tags-input";
25
- const preset: ClassRuleSet = {};
24
+ const preset = "svs-tags-input";
26
25
  const CONFIRM_KEY = "Enter";
27
26
 
28
27
  import { untrack } from "svelte";
29
- import { type ClassRuleSet, STATE, AREA, fnClass, omit } from "./core";
28
+ import { type SVSStyle, STATE, AREA, fnClass, omit } from "./core";
30
29
  import TextField, { type TextFieldProps, type TextFieldReqdProps, type TextFieldBindProps } from "./_TextField.svelte";
31
30
  import Badge, { type BadgeProps, type BadgeReqdProps, type BadgeBindProps } from "./_Badge.svelte";
32
31
  </script>
@@ -36,24 +35,24 @@
36
35
 
37
36
  // *** Initialize *** //
38
37
  if (!status) status = STATE.DEFAULT;
39
- const cls = fnClass(svs, preset, style);
40
- initDeps();
38
+ const cls = fnClass(preset, style);
41
39
  const confirmKeys = new Set([CONFIRM_KEY, ...confirm]);
42
- const onkeydown = deps!.svsTextField!.attributes!.onkeydown;
43
- deps!.svsTextField!.attributes!.onkeydown = confirmTag;
44
- const onclick = deps!.svsBadge!.onclick;
45
- const svsBadge = omit(deps!.svsBadge, "onclick", "right");
46
40
  if (min) validations.push((values) => values.length < min.value ? min.message : "");
47
- if (max) deps!.svsTextField!.validations!.push((_) => values.length >= max.value ? max.message : "");
48
41
  let value = $state("");
49
42
 
50
- function initDeps() {
51
- if (!deps) deps = {};
52
- if (!deps.svsTextField) deps.svsTextField = {};
53
- if (!deps.svsTextField.attributes) deps.svsTextField.attributes = {};
54
- if (!deps.svsTextField.validations) deps.svsTextField.validations = [];
55
- if (!deps.svsBadge) deps.svsBadge = {};
56
- }
43
+ // *** Initialize Deps *** //
44
+ const svsBadge = {
45
+ ...omit(deps?.svsBadge, "onclick", "right", "style"),
46
+ style: deps?.svsBadge?.style ?? `${preset} svs-badge`,
47
+ };
48
+ const textValidations = deps?.svsTextField?.validations ?? [];
49
+ if (max) textValidations.push((values) => values.length >= max.value ? max.message : "");
50
+ const svsTextField = {
51
+ ...omit(deps?.svsTextField, "validations", "style", "attributes"),
52
+ validations: textValidations,
53
+ style: deps?.svsTextField?.style ?? `${preset} svs-text-field`,
54
+ attributes: { ...deps?.svsTextField?.attributes, onkeydown },
55
+ };
57
56
 
58
57
  // *** Bind Handlers *** //
59
58
  $effect.pre(() => {
@@ -69,8 +68,8 @@
69
68
 
70
69
  // *** Event Handlers *** //
71
70
  const change = new Event("change", { bubbles: true, cancelable: true });
72
- function confirmTag(ev: KeyboardEvent) {
73
- onkeydown?.(ev as any);
71
+ function onkeydown(ev: KeyboardEvent) {
72
+ deps?.svsTextField?.attributes?.onkeydown?.(ev as any);
74
73
  if (!confirmKeys.has(ev.key) || ev.isComposing) return;
75
74
  ev.preventDefault();
76
75
  element?.dispatchEvent(change);
@@ -86,7 +85,7 @@
86
85
  }
87
86
  function removeTag(index: number): (ev: Event) => void {
88
87
  return (ev) => {
89
- onclick?.(ev as any);
88
+ deps?.svsBadge?.onclick?.(ev as any);
90
89
  values.splice(index, 1);
91
90
  };
92
91
  }
@@ -94,7 +93,7 @@
94
93
 
95
94
  <!---------------------------------------->
96
95
 
97
- <TextField bind:value bind:status bind:element type="text" {...deps?.svsTextField} {left} {right} />
96
+ <TextField bind:value bind:status bind:element type="text" {left} {right} {...svsTextField} />
98
97
  {#if type === "bottom"}
99
98
  <div class={cls(AREA.BOTTOM, status)}>
100
99
  {@render tags()}
@@ -8,7 +8,7 @@ export type TagsInputProps = {
8
8
  max?: TagCountValidation;
9
9
  validations?: ((values: string[]) => string)[];
10
10
  status?: string;
11
- style?: ClassRuleSet | string;
11
+ style?: SVSStyle;
12
12
  element?: HTMLInputElement;
13
13
  deps?: TagsInputDeps;
14
14
  };
@@ -22,9 +22,9 @@ export type TagCountValidation = {
22
22
  value: number;
23
23
  message: string;
24
24
  };
25
- import { type ClassRuleSet } from "./core";
25
+ import { type SVSStyle } from "./core";
26
26
  import { type TextFieldProps, type TextFieldReqdProps, type TextFieldBindProps } from "./_TextField.svelte";
27
27
  import { type BadgeProps, type BadgeReqdProps, type BadgeBindProps } from "./_Badge.svelte";
28
- declare const TagsInput: import("svelte").Component<TagsInputProps, {}, "status" | "element" | "values">;
28
+ declare const TagsInput: import("svelte").Component<TagsInputProps, {}, "status" | "values" | "element">;
29
29
  type TagsInput = ReturnType<typeof TagsInput>;
30
30
  export default TagsInput;
@@ -7,17 +7,16 @@
7
7
  href?: string,
8
8
  onclick?: MouseEventHandler<HTMLButtonElement> | null,
9
9
  status?: string, // bindable <STATE.DEFAULT>
10
- style?: ClassRuleSet | string,
10
+ style?: SVSStyle,
11
11
  };
12
12
  export type BadgeReqdProps = "children";
13
13
  export type BadgeBindProps = "status";
14
14
 
15
- const svs = "svs-badge";
16
- const preset: ClassRuleSet = {};
15
+ const preset = "svs-badge";
17
16
 
18
17
  import { type Snippet } from "svelte";
19
18
  import { type MouseEventHandler } from "svelte/elements";
20
- import { type ClassRuleSet, STATE, AREA, fnClass } from "./core";
19
+ import { type SVSStyle, STATE, AREA, fnClass } from "./core";
21
20
  </script>
22
21
 
23
22
  <script lang="ts">
@@ -25,7 +24,7 @@
25
24
 
26
25
  // *** Initialize *** //
27
26
  if (!status) status = STATE.DEFAULT;
28
- const cls = fnClass(svs, preset, style);
27
+ const cls = fnClass(preset, style);
29
28
  </script>
30
29
 
31
30
  <!---------------------------------------->
@@ -6,13 +6,13 @@ export type BadgeProps = {
6
6
  href?: string;
7
7
  onclick?: MouseEventHandler<HTMLButtonElement> | null;
8
8
  status?: string;
9
- style?: ClassRuleSet | string;
9
+ style?: SVSStyle;
10
10
  };
11
11
  export type BadgeReqdProps = "children";
12
12
  export type BadgeBindProps = "status";
13
13
  import { type Snippet } from "svelte";
14
14
  import { type MouseEventHandler } from "svelte/elements";
15
- import { type ClassRuleSet } from "./core";
15
+ import { type SVSStyle } from "./core";
16
16
  declare const Badge: import("svelte").Component<BadgeProps, {}, "status">;
17
17
  type Badge = ReturnType<typeof Badge>;
18
18
  export default Badge;
@@ -7,7 +7,7 @@
7
7
  onclick?: MouseEventHandler<HTMLButtonElement> | null,
8
8
  form?: HTMLFormElement, // bindable
9
9
  status?: string, // bindable <STATE.DEFAULT>
10
- style?: ClassRuleSet | string,
10
+ style?: SVSStyle,
11
11
  attributes?: HTMLButtonAttributes,
12
12
  action?: Action,
13
13
  element?: HTMLButtonElement, // bindable
@@ -15,20 +15,19 @@
15
15
  export type ButtonReqdProps = "children";
16
16
  export type ButtonBindProps = "form" | "status" | "element";
17
17
 
18
- const svs = "svs-button";
19
- const preset: ClassRuleSet = {};
18
+ const preset = "svs-button";
20
19
 
21
20
  import { type Snippet } from "svelte";
22
21
  import { type Action } from "svelte/action";
23
22
  import { type HTMLButtonAttributes, type MouseEventHandler } from "svelte/elements";
24
- import { type ClassRuleSet, STATE, AREA, fnClass, omit } from "./core";
23
+ import { type SVSStyle, STATE, AREA, fnClass, omit } from "./core";
25
24
  </script>
26
25
 
27
26
  <script lang="ts">
28
27
  let { children, left, right, type = "button", onclick, form = $bindable(), status = $bindable(STATE.DEFAULT), style, attributes, action, element = $bindable()}: ButtonProps = $props();
29
28
 
30
29
  // *** Initialize *** //
31
- const cls = fnClass(svs, preset, style);
30
+ const cls = fnClass(preset, style);
32
31
  const click = onclick ?? attributes?.["onclick"];
33
32
  const attrs = omit(attributes, "class", "type", "onclick");
34
33
 
@@ -6,7 +6,7 @@ export type ButtonProps = {
6
6
  onclick?: MouseEventHandler<HTMLButtonElement> | null;
7
7
  form?: HTMLFormElement;
8
8
  status?: string;
9
- style?: ClassRuleSet | string;
9
+ style?: SVSStyle;
10
10
  attributes?: HTMLButtonAttributes;
11
11
  action?: Action;
12
12
  element?: HTMLButtonElement;
@@ -16,7 +16,7 @@ export type ButtonBindProps = "form" | "status" | "element";
16
16
  import { type Snippet } from "svelte";
17
17
  import { type Action } from "svelte/action";
18
18
  import { type HTMLButtonAttributes, type MouseEventHandler } from "svelte/elements";
19
- import { type ClassRuleSet } from "./core";
19
+ import { type SVSStyle } from "./core";
20
20
  declare const Button: import("svelte").Component<ButtonProps, {}, "form" | "status" | "element">;
21
21
  type Button = ReturnType<typeof Button>;
22
22
  export default Button;
@@ -10,7 +10,7 @@
10
10
  descFirst?: boolean, // <false>
11
11
  validations?: ((values: string[], validities?: ValidityState[]) => string)[],
12
12
  status?: string, // bindable <STATE.DEFAULT>
13
- style?: ClassRuleSet | string,
13
+ style?: SVSStyle,
14
14
  attributes?: HTMLInputAttributes,
15
15
  action?: Action,
16
16
  elements?: HTMLInputElement[], // bindable
@@ -19,14 +19,13 @@
19
19
  export type CheckFieldBindProps = "values" | "status" | "elements";
20
20
 
21
21
  type CheckFieldTarget = { currentTarget: EventTarget & HTMLInputElement };
22
- const svs = "svs-check-field";
23
- const preset: ClassRuleSet = {};
22
+ const preset = "svs-check-field";
24
23
 
25
24
  import { type Snippet, untrack } from "svelte";
26
25
  import { type Action } from "svelte/action";
27
26
  import { type SvelteMap } from "svelte/reactivity";
28
27
  import { type HTMLInputAttributes } from "svelte/elements";
29
- import { type ClassRuleSet, STATE, AREA, elemId, fnClass, isNeutral, omit } from "./core";
28
+ import { type SVSStyle, STATE, AREA, elemId, fnClass, isNeutral, omit } from "./core";
30
29
  </script>
31
30
 
32
31
  <script lang="ts">
@@ -34,7 +33,7 @@
34
33
 
35
34
  // *** Initialize *** //
36
35
  if (!status) status = STATE.DEFAULT;
37
- const cls = fnClass(svs, preset, style);
36
+ const cls = fnClass(preset, style);
38
37
  const type = multiple ? "checkbox" : "radio";
39
38
  const name = attributes?.["name"] ? attributes?.["name"] : elemId.id;
40
39
  const idLabel = elemId.get(label?.trim());
@@ -58,8 +57,8 @@
58
57
  message = stat === STATE.INACTIVE ? msg ?? bottom : bottom;
59
58
  elements[0]?.setCustomValidity(msg ?? "");
60
59
  }
61
- function validate() {
62
- if (!values.length) return toNonInvalid();
60
+ function validate(oninvalid?: boolean) {
61
+ if (!values.length && !oninvalid) return toNonInvalid();
63
62
  const validities = elements.map((x) => x.validity);
64
63
  for (const v of validations) {
65
64
  const msg = v(values, validities);
@@ -85,6 +84,7 @@
85
84
  attributes?.oninvalid?.(ev);
86
85
  ev.preventDefault();
87
86
  phase.submit = true;
87
+ validate(true);
88
88
  if (status !== STATE.INACTIVE) toInvalid(elements[0]?.validationMessage);
89
89
  }
90
90
  </script>
@@ -9,7 +9,7 @@ export type CheckFieldProps = {
9
9
  descFirst?: boolean;
10
10
  validations?: ((values: string[], validities?: ValidityState[]) => string)[];
11
11
  status?: string;
12
- style?: ClassRuleSet | string;
12
+ style?: SVSStyle;
13
13
  attributes?: HTMLInputAttributes;
14
14
  action?: Action;
15
15
  elements?: HTMLInputElement[];
@@ -20,7 +20,7 @@ import { type Snippet } from "svelte";
20
20
  import { type Action } from "svelte/action";
21
21
  import { type SvelteMap } from "svelte/reactivity";
22
22
  import { type HTMLInputAttributes } from "svelte/elements";
23
- import { type ClassRuleSet } from "./core";
23
+ import { type SVSStyle } from "./core";
24
24
  declare const CheckField: import("svelte").Component<CheckFieldProps, {}, "elements" | "status" | "values">;
25
25
  type CheckField = ReturnType<typeof CheckField>;
26
26
  export default CheckField;
@@ -3,7 +3,7 @@
3
3
  value?: string, // bindable <"#000">
4
4
  alpha?: number, // bindable <1>
5
5
  status?: string, // bindable <STATE.DEFAULT>
6
- style?: ClassRuleSet | string,
6
+ style?: SVSStyle,
7
7
  attributes?: HTMLInputAttributes;
8
8
  action?: Action,
9
9
  element?: HTMLInputElement, // bindable
@@ -16,8 +16,7 @@
16
16
  }
17
17
 
18
18
  type RgbColor = [number, number, number];
19
- const svs = "svs-color-picker";
20
- const preset: ClassRuleSet = {};
19
+ const preset = "svs-color-picker";
21
20
 
22
21
  function isValidHex(hex: string): boolean {
23
22
  return Boolean(formatHex(hex));
@@ -42,7 +41,7 @@
42
41
 
43
42
  import { type Action } from "svelte/action";
44
43
  import { type HTMLInputAttributes } from "svelte/elements";
45
- import { type ClassRuleSet, STATE, AREA, fnClass, omit } from "./core";
44
+ import { type SVSStyle, STATE, AREA, fnClass, omit } from "./core";
46
45
  </script>
47
46
 
48
47
  <script lang="ts">
@@ -50,7 +49,7 @@
50
49
 
51
50
  // *** Initialize *** //
52
51
  if (!status) status = STATE.DEFAULT;
53
- const cls = fnClass(svs, preset, style);
52
+ const cls = fnClass(preset, style);
54
53
  const attrs = omit(attributes, "type");
55
54
  if (!isValidHex(value)) value = "#000";
56
55
 
@@ -2,7 +2,7 @@ export type ColorPickerProps = {
2
2
  value?: string;
3
3
  alpha?: number;
4
4
  status?: string;
5
- style?: ClassRuleSet | string;
5
+ style?: SVSStyle;
6
6
  attributes?: HTMLInputAttributes;
7
7
  action?: Action;
8
8
  element?: HTMLInputElement;
@@ -13,7 +13,7 @@ export declare function getHex(rgb: RgbColor): string;
13
13
  type RgbColor = [number, number, number];
14
14
  import { type Action } from "svelte/action";
15
15
  import { type HTMLInputAttributes } from "svelte/elements";
16
- import { type ClassRuleSet } from "./core";
16
+ import { type SVSStyle } from "./core";
17
17
  declare const ColorPicker: import("svelte").Component<ColorPickerProps, {}, "alpha" | "value" | "status" | "element">;
18
18
  type ColorPicker = ReturnType<typeof ColorPicker>;
19
19
  export default ColorPicker;
@@ -4,7 +4,7 @@
4
4
  value?: string, // bindable
5
5
  expanded?: boolean, // bindable
6
6
  status?: string, // bindable <STATE.DEFAULT>
7
- style?: ClassRuleSet | string,
7
+ style?: SVSStyle,
8
8
  attributes?: HTMLInputAttributes,
9
9
  action?: Action,
10
10
  element?: HTMLInputElement, // bindable
@@ -12,8 +12,7 @@
12
12
  export type ComboBoxReqdProps = "options";
13
13
  export type ComboBoxBindProps = "value" | "expanded" | "status" | "element";
14
14
 
15
- const svs = "svs-combo-box";
16
- const preset: ClassRuleSet = {};
15
+ const preset = "svs-combo-box";
17
16
  const NA = -1;
18
17
  const optionStyle = "cursor: default; user-select: none;";
19
18
 
@@ -21,7 +20,7 @@
21
20
  import { type Action } from "svelte/action";
22
21
  import { type SvelteSet } from "svelte/reactivity";
23
22
  import { type HTMLInputAttributes } from "svelte/elements";
24
- import { type ClassRuleSet, STATE, AREA, elemId, fnClass, omit } from "./core";
23
+ import { type SVSStyle, STATE, AREA, elemId, fnClass, omit } from "./core";
25
24
  </script>
26
25
 
27
26
  <script lang="ts">
@@ -29,7 +28,7 @@
29
28
 
30
29
  // *** Initialize *** //
31
30
  if (!status) status = STATE.DEFAULT;
32
- const cls = fnClass(svs, preset, style);
31
+ const cls = fnClass(preset, style);
33
32
  const idList = elemId.id;
34
33
  const attrs = omit(attributes, "class", "type", "value", "list", "role", "aria-haspopup", "aria-autocomplete", "aria-controls", "aria-expanded");
35
34
  let selected = $state(NA);
@@ -3,7 +3,7 @@ export type ComboBoxProps = {
3
3
  value?: string;
4
4
  expanded?: boolean;
5
5
  status?: string;
6
- style?: ClassRuleSet | string;
6
+ style?: SVSStyle;
7
7
  attributes?: HTMLInputAttributes;
8
8
  action?: Action;
9
9
  element?: HTMLInputElement;
@@ -13,7 +13,7 @@ export type ComboBoxBindProps = "value" | "expanded" | "status" | "element";
13
13
  import { type Action } from "svelte/action";
14
14
  import { type SvelteSet } from "svelte/reactivity";
15
15
  import { type HTMLInputAttributes } from "svelte/elements";
16
- import { type ClassRuleSet } from "./core";
16
+ import { type SVSStyle } from "./core";
17
17
  declare const ComboBox: import("svelte").Component<ComboBoxProps, {}, "expanded" | "value" | "status" | "element">;
18
18
  type ComboBox = ReturnType<typeof ComboBox>;
19
19
  export default ComboBox;
@@ -4,17 +4,16 @@
4
4
  open?: boolean, // bindable <false>; to observe state, not to control
5
5
  lock?: boolean, // bindable <false>
6
6
  status?: string, // bindable <STATE.DEFAULT>
7
- style?: ClassRuleSet | string,
7
+ style?: SVSStyle,
8
8
  element?: HTMLElement, // bindable
9
9
  };
10
10
  export type ContextMenuReqdProps = "children";
11
11
  export type ContextMenuBindProps = "open" | "lock" | "status" | "element";
12
12
 
13
- const svs = "svs-context-menu";
14
- const preset: ClassRuleSet = {};
13
+ const preset = "svs-context-menu";
15
14
 
16
15
  import { type Snippet } from "svelte";
17
- import { type ClassRuleSet, STATE, AREA, fnClass } from "./core";
16
+ import { type SVSStyle, STATE, AREA, fnClass } from "./core";
18
17
  </script>
19
18
 
20
19
  <!---------------------------------------->
@@ -24,7 +23,7 @@
24
23
 
25
24
  // *** Initialize *** //
26
25
  if (!status) status = STATE.DEFAULT;
27
- const cls = fnClass(svs, preset, style);
26
+ const cls = fnClass(preset, style);
28
27
  let position = $state({ x: 0, y: 0 });
29
28
 
30
29
  // *** Bind Handlers *** //
@@ -3,13 +3,13 @@ export type ContextMenuProps = {
3
3
  open?: boolean;
4
4
  lock?: boolean;
5
5
  status?: string;
6
- style?: ClassRuleSet | string;
6
+ style?: SVSStyle;
7
7
  element?: HTMLElement;
8
8
  };
9
9
  export type ContextMenuReqdProps = "children";
10
10
  export type ContextMenuBindProps = "open" | "lock" | "status" | "element";
11
11
  import { type Snippet } from "svelte";
12
- import { type ClassRuleSet } from "./core";
12
+ import { type SVSStyle } from "./core";
13
13
  declare const ContextMenu: import("svelte").Component<ContextMenuProps, {}, "open" | "status" | "element" | "lock">;
14
14
  type ContextMenu = ReturnType<typeof ContextMenu>;
15
15
  export default ContextMenu;
@@ -5,7 +5,7 @@
5
5
  open?: boolean, // bindable <false>
6
6
  duration?: number, // <400>
7
7
  status?: string, // bindable <STATE.DEFAULT>
8
- style?: ClassRuleSet | string,
8
+ style?: SVSStyle,
9
9
  attributes?: HTMLDetailsAttributes;
10
10
  action?: Action,
11
11
  element?: HTMLDetailsElement, // bindable
@@ -14,8 +14,7 @@
14
14
  export type DisclosureBindProps = "open" | "status" | "elementent";
15
15
 
16
16
  type DisclosureTarget = { currentTarget: EventTarget & HTMLDetailsElement };
17
- const svs = "svs-disclosure";
18
- const preset: ClassRuleSet = {};
17
+ const preset = "svs-disclosure";
19
18
 
20
19
  const sleep = (msec: number) => new Promise(resolve => setTimeout(resolve, msec));
21
20
  class ToggleGurad {
@@ -33,7 +32,7 @@
33
32
  import { type Action } from "svelte/action";
34
33
  import { type HTMLDetailsAttributes } from "svelte/elements";
35
34
  import { slide } from "svelte/transition";
36
- import { type ClassRuleSet, STATE, AREA, fnClass, isNeutral, omit } from "./core";
35
+ import { type SVSStyle, STATE, AREA, fnClass, isNeutral, omit } from "./core";
37
36
  </script>
38
37
 
39
38
  <script lang="ts">
@@ -41,7 +40,7 @@
41
40
 
42
41
  // *** Initialize *** //
43
42
  if (!status) status = STATE.DEFAULT;
44
- const cls = fnClass(svs, preset, style);
43
+ const cls = fnClass(preset, style);
45
44
  const attrs = omit(attributes, "class", "open", "ontoggle");
46
45
  const guard = new ToggleGurad();
47
46
  let hidden = $state(!open);
@@ -4,7 +4,7 @@ export type DisclosureProps = {
4
4
  open?: boolean;
5
5
  duration?: number;
6
6
  status?: string;
7
- style?: ClassRuleSet | string;
7
+ style?: SVSStyle;
8
8
  attributes?: HTMLDetailsAttributes;
9
9
  action?: Action;
10
10
  element?: HTMLDetailsElement;
@@ -14,7 +14,7 @@ export type DisclosureBindProps = "open" | "status" | "elementent";
14
14
  import { type Snippet } from "svelte";
15
15
  import { type Action } from "svelte/action";
16
16
  import { type HTMLDetailsAttributes } from "svelte/elements";
17
- import { type ClassRuleSet } from "./core";
17
+ import { type SVSStyle } from "./core";
18
18
  declare const Disclosure: import("svelte").Component<DisclosureProps, {}, "open" | "status" | "element">;
19
19
  type Disclosure = ReturnType<typeof Disclosure>;
20
20
  export default Disclosure;
@@ -5,14 +5,13 @@
5
5
  active?: boolean, // bindable, <false>
6
6
  disabled?: boolean, // bindable, <false>
7
7
  status?: string, // bindable <STATE.DEFAULT>
8
- style?: ClassRuleSet | string,
8
+ style?: SVSStyle,
9
9
  element?: HTMLInputElement, // bindable
10
10
  };
11
11
  export type HotkeyCaptureReqdProps = never;
12
12
  export type HotkeyCaptureBindProps = "value" | "active" | "disable" | "status" | "element";
13
13
 
14
- const svs = "svs-hotkey-capture";
15
- const preset: ClassRuleSet = {};
14
+ const preset = "svs-hotkey-capture";
16
15
  const KEY_MODIFIER = new Set(["Control", "Alt", "Shift", "Meta"]);
17
16
  const LABEL_SPACE = "SPACE";
18
17
  const LABEL_POINTER = ["BTN_MAIN","BTN_WHEEL","BTN_SUB","BTN_BACK","BTN_FORWARD"] as const;
@@ -22,7 +21,7 @@
22
21
  }
23
22
 
24
23
  import { untrack } from "svelte";
25
- import { type ClassRuleSet, STATE, AREA, fnClass, isNeutral } from "./core";
24
+ import { type SVSStyle, STATE, AREA, fnClass, isNeutral } from "./core";
26
25
  </script>
27
26
 
28
27
  <script lang="ts">
@@ -30,7 +29,7 @@
30
29
 
31
30
  // *** Initialize *** //
32
31
  if (!status) status = STATE.DEFAULT;
33
- const cls = fnClass(svs, preset, style);
32
+ const cls = fnClass(preset, style);
34
33
  let neutral = isNeutral(status) ? status : STATE.DEFAULT;
35
34
 
36
35
  // *** Bind Handlers *** //