@tableslayer/ui 0.1.9 → 0.1.10

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.
@@ -22,8 +22,8 @@
22
22
  // midpoint = (min + max) / 2
23
23
  // So: midpoint = coefficient * 50^2
24
24
  // coefficient = midpoint / 2500
25
- const midpoint = (min + max) / 2;
26
- const coefficient = midpoint / 2500;
25
+ const midpoint = $derived((min + max) / 2);
26
+ const coefficient = $derived(midpoint / 2500);
27
27
 
28
28
  const brushSizeToSlider = (size: number): number => {
29
29
  const clampedSize = Math.max(min, Math.min(max, size));
@@ -24,14 +24,9 @@
24
24
  restProps.class ?? ''
25
25
  ]);
26
26
 
27
- const component = as !== undefined ? as : href !== undefined ? 'a' : 'button';
27
+ let component = $derived(as !== undefined ? as : href !== undefined ? 'a' : 'button');
28
28
 
29
- let buttonProps = $state({});
30
- if (component === 'button') {
31
- buttonProps = { disabled: isDisabled };
32
- } else if (component === 'a') {
33
- buttonProps = { href };
34
- }
29
+ let buttonProps = $derived(component === 'button' ? { disabled: isDisabled } : component === 'a' ? { href } : {});
35
30
  </script>
36
31
 
37
32
  <!--
@@ -4,11 +4,8 @@
4
4
  let { children, size = 'md', href, as, variant = 'primary', ...restProps }: IconButtonProps = $props();
5
5
 
6
6
  const iconBtnClasses = $derived(['iconBtn', `iconBtn--${size}`, `iconBtn--${variant}`, restProps.class ?? '']);
7
- const component = as ?? 'button';
8
- let iconButtonProps = $state({});
9
- if (component === 'a') {
10
- iconButtonProps = { href };
11
- }
7
+ let component = $derived(as ?? 'button');
8
+ let iconButtonProps = $derived(component === 'a' ? { href } : {});
12
9
  </script>
13
10
 
14
11
  <svelte:element this={component} {...iconButtonProps} {...restProps} class={iconBtnClasses}>
@@ -9,13 +9,15 @@
9
9
  }: InputProps = $props();
10
10
 
11
11
  const inputClasses = $derived(['input', variant && `input--${variant}`, restProps.class ?? '']);
12
- let autoCompleteOffAttrs = hideAutocomplete
13
- ? {
14
- autocomplete: 'off' as const,
15
- 'data-1p-ignore': 'true' as const,
16
- 'data-lpignore': 'true' as const
17
- }
18
- : {};
12
+ let autoCompleteOffAttrs = $derived(
13
+ hideAutocomplete
14
+ ? {
15
+ autocomplete: 'off' as const,
16
+ 'data-1p-ignore': 'true' as const,
17
+ 'data-lpignore': 'true' as const
18
+ }
19
+ : {}
20
+ );
19
21
  </script>
20
22
 
21
23
  <input bind:this={element} bind:value {...restProps} {...autoCompleteOffAttrs} class={inputClasses} />
@@ -11,13 +11,15 @@
11
11
  }: InputCheckboxProps = $props();
12
12
 
13
13
  const inputClasses = $derived(['input', variant && `input--${variant}`, restProps.class ?? '']);
14
- let autoCompleteOffAttrs = hideAutocomplete
15
- ? {
16
- autocomplete: 'off' as const,
17
- 'data-1p-ignore': 'true' as const,
18
- 'data-lpignore': 'true' as const
19
- }
20
- : {};
14
+ let autoCompleteOffAttrs = $derived(
15
+ hideAutocomplete
16
+ ? {
17
+ autocomplete: 'off' as const,
18
+ 'data-1p-ignore': 'true' as const,
19
+ 'data-lpignore': 'true' as const
20
+ }
21
+ : {}
22
+ );
21
23
 
22
24
  const id = `checkbox-${uuidv4()}`;
23
25
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tableslayer/ui",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "license": "FSL-1.1-ALv2",
5
5
  "repository": {
6
6
  "type": "git",