uisv 0.0.15 → 0.0.17

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.
@@ -291,7 +291,7 @@
291
291
  {
292
292
  color: 'surface',
293
293
  variant: 'ghost',
294
- class: 'text-surface-inverted hover-surface-elevated text-surface-inverted)',
294
+ class: 'text-surface-inverted hover:bg-surface-elevated',
295
295
  },
296
296
  {
297
297
  color: 'info',
@@ -106,7 +106,7 @@
106
106
  horizontal: {
107
107
  container: 'flex-row',
108
108
  checkbox:
109
- '[&:not(:last-child)]:(-me-px ms-0) first-of-type:rounded-s-lg last-of-type:rounded-e-lg',
109
+ '[&:not(:last-child)]:-me-px [&:not(:last-child)]:ms-0 first-of-type:rounded-s-lg last-of-type:rounded-e-lg',
110
110
  },
111
111
  vertical: {
112
112
  container: 'flex-col -space-y-px',
@@ -9,9 +9,9 @@
9
9
  class={cn(
10
10
  'relative text-2xl text-highlighted font-bold mt-12 mb-6',
11
11
  'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
12
- '[&>a]:(focus-visible:outline-primary)',
13
- '[&>a>code]:(transition-colors border-dashed font-bold text-xl/7)',
14
- 'hover:[&>a>code]:(border-primary text-primary)',
12
+ '[&>a]:focus-visible:outline-primary',
13
+ '[&>a>code]:transition-colors [&>a>code]:border-dashed [&>a>code]:font-bold [&>a>code]:text-xl/7',
14
+ 'hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary',
15
15
  classes,
16
16
  )}
17
17
  >
@@ -9,8 +9,8 @@
9
9
  class={cn(
10
10
  'relative text-2xl text-highlighted font-bold mt-12 mb-6',
11
11
  'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
12
- 'hover:[&>a>code]:(border-primary text-primary)',
13
- '[&>a>code]:(transition-colors text-xl/7 font-bold border-dashed)',
12
+ 'hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary',
13
+ '[&>a>code]:transition-colors [&>a>code]:text-xl/7 [&>a>code]:font-bold [&>a>code]:border-dashed',
14
14
  '[&>a]:focus-visible:outline-primary',
15
15
  classes,
16
16
  )}
@@ -9,8 +9,8 @@
9
9
  class={cn(
10
10
  'relative text-2xl text-highlighted font-bold mt-12 mb-6',
11
11
  'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
12
- 'hover:[&>a>code]:(border-primary text-primary)',
13
- '[&>a>code]:(transition-colors text-xl/7 font-bold border-dashed)',
12
+ 'hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary',
13
+ '[&>a>code]:transition-colors [&>a>code]:text-xl/7 [&>a>code]:font-bold [&>a>code]:border-dashed',
14
14
  '[&>a]:focus-visible:outline-primary',
15
15
  classes,
16
16
  )}
@@ -9,8 +9,8 @@
9
9
  class={cn(
10
10
  'relative text-2xl text-highlighted font-bold mt-12 mb-6',
11
11
  'scroll-mt-[calc(48px+45px+var(--ui-header-height))] lg:scroll-mt-[calc(48px+var(--ui-header-height))]',
12
- 'hover:[&>a>code]:(border-primary text-primary)',
13
- '[&>a>code]:(transition-colors text-xl/7 font-bold border-dashed)',
12
+ 'hover:[&>a>code]:border-primary hover:[&>a>code]:text-primary',
13
+ '[&>a>code]:transition-colors [&>a>code]:text-xl/7 [&>a>code]:font-bold [&>a>code]:border-dashed',
14
14
  '[&>a]:focus-visible:outline-primary',
15
15
  classes,
16
16
  )}
@@ -5,7 +5,7 @@
5
5
  import { useDebounce, watch } from 'runed';
6
6
 
7
7
  export type IconProps = SvelteHTMLElements['base'] & {
8
- name: string | Component;
8
+ name?: string | Component;
9
9
  };
10
10
  </script>
11
11
 
@@ -54,5 +54,5 @@
54
54
  <div {...rest as SvelteHTMLElements['div']} class={[name, classname]}></div>
55
55
  {:else if isComponent(name)}
56
56
  {@const Icon = name}
57
- <Icon {...rest} />
57
+ <Icon {...rest} class={classname} />
58
58
  {/if}
@@ -1,7 +1,7 @@
1
1
  import type { SvelteHTMLElements } from 'svelte/elements';
2
2
  import type { Component } from 'svelte';
3
3
  export type IconProps = SvelteHTMLElements['base'] & {
4
- name: string | Component;
4
+ name?: string | Component;
5
5
  };
6
6
  declare const Icon: Component<IconProps, {}, "">;
7
7
  type Icon = ReturnType<typeof Icon>;
@@ -1,8 +1,8 @@
1
1
  export * from './button.svelte';
2
2
  export { default as Button } from './button.svelte';
3
- export * from './badge.svelte';
3
+ export * from './input.svelte';
4
4
  export { default as Input } from './input.svelte';
5
- export * from './badge.svelte';
5
+ export * from './input-time.svelte';
6
6
  export { default as InputTime } from './input-time.svelte';
7
7
  export * from './badge.svelte';
8
8
  export { default as Badge } from './badge.svelte';
@@ -1,8 +1,8 @@
1
1
  export * from './button.svelte';
2
2
  export { default as Button } from './button.svelte';
3
- export * from './badge.svelte';
3
+ export * from './input.svelte';
4
4
  export { default as Input } from './input.svelte';
5
- export * from './badge.svelte';
5
+ export * from './input-time.svelte';
6
6
  export { default as InputTime } from './input-time.svelte';
7
7
  export * from './badge.svelte';
8
8
  export { default as Badge } from './badge.svelte';
@@ -79,7 +79,7 @@
79
79
  icon: '',
80
80
  segment: [
81
81
  'rounded text-center outline-hidden transition-all focus:bg-surface-accented shrink',
82
- 'aria-[valuetext="Empty"]:text-dimmed data-[segment="literal"]:(text-muted px-1) data-invalid:text-error data-disabled:(cursor-not-allowed opacity-75)',
82
+ 'aria-[valuetext="Empty"]:text-dimmed data-[segment="literal"]:text-muted data-[segment="literal"]:px-1 data-invalid:text-error data-disabled:cursor-not-allowed data-disabled:opacity-75',
83
83
  ],
84
84
  },
85
85
  variants: {
@@ -39,12 +39,12 @@
39
39
  */
40
40
  highlight?: boolean;
41
41
  value?: string;
42
- icon?: string | Snippet | Component;
42
+ icon?: string | Component;
43
43
  iconposition?: 'leading' | 'trailing';
44
- leading?: string | Snippet | Component;
45
- trailing?: string | Snippet | Component;
44
+ leading?: string | Component;
45
+ trailing?: string | Component;
46
46
  loading?: boolean;
47
- loadingicon?: string | Snippet | Component;
47
+ loadingicon?: string | Component;
48
48
  mask?: string | MaskInputOptions;
49
49
  ui?: {
50
50
  root?: ClassNameValue;
@@ -57,6 +57,8 @@
57
57
  </script>
58
58
 
59
59
  <script lang="ts">
60
+ import Icon from './icon.svelte';
61
+
60
62
  let {
61
63
  type,
62
64
  value = $bindable(),
@@ -83,8 +85,8 @@
83
85
  slots: {
84
86
  root: 'inline-flex items-center rounded transition-all ring ring-inset ring-transparent',
85
87
  base: 'appearance-none outline-none placeholder:text-muted',
86
- leading: 'text-muted',
87
- trailing: 'text-muted',
88
+ leading: 'text-muted flex items-center',
89
+ trailing: 'text-muted flex items-center',
88
90
  icon: '',
89
91
  },
90
92
  variants: {
@@ -135,7 +137,7 @@
135
137
  soft: {
136
138
  root: 'bg-surface-muted hover:bg-surface-elevated focus-within:bg-surface-elevated',
137
139
  },
138
- subtle: { root: 'ring ring-dimmed' },
140
+ subtle: { root: 'bg-surface-muted ring ring-dimmed' },
139
141
  ghost: { root: 'hover:bg-surface-elevated focus-within:bg-surface-elevated' },
140
142
  none: { root: '' },
141
143
  },
@@ -168,42 +170,42 @@
168
170
  color: 'primary',
169
171
  variant: ['outline', 'subtle'],
170
172
  class: {
171
- root: 'focus-within:(ring-primary-500 ring-2)',
173
+ root: 'focus-within:ring-primary-500 focus-within:ring-2',
172
174
  },
173
175
  },
174
176
  {
175
177
  color: 'surface',
176
178
  variant: ['outline', 'subtle'],
177
179
  class: {
178
- root: 'focus-within:(ring-surface-800 ring-2)',
180
+ root: 'focus-within:ring-surface-800 focus-within:ring-2',
179
181
  },
180
182
  },
181
183
  {
182
184
  color: 'info',
183
185
  variant: ['outline', 'subtle'],
184
186
  class: {
185
- root: 'focus-within:(ring-info-500 ring-2)',
187
+ root: 'focus-within:ring-info-500 focus-within:ring-2',
186
188
  },
187
189
  },
188
190
  {
189
191
  color: 'success',
190
192
  variant: ['outline', 'subtle'],
191
193
  class: {
192
- root: 'focus-within:(ring-success-500 ring-2)',
194
+ root: 'focus-within:ring-success-500 focus-within:ring-2',
193
195
  },
194
196
  },
195
197
  {
196
198
  color: 'warning',
197
199
  variant: ['outline', 'subtle'],
198
200
  class: {
199
- root: 'focus-within:(ring-warning-500 ring-2)',
201
+ root: 'focus-within:ring-warning-500 focus-within:ring-2',
200
202
  },
201
203
  },
202
204
  {
203
205
  color: 'error',
204
206
  variant: ['outline', 'subtle'],
205
207
  class: {
206
- root: 'focus-within:(ring-error-500 ring-2)',
208
+ root: 'focus-within:ring-error-500 focus-within:ring-2',
207
209
  },
208
210
  },
209
211
  ],
@@ -234,16 +236,11 @@
234
236
  {@const Leading = leading}
235
237
  <Leading />
236
238
  {/if}
237
- {:else if typeof TrailingIcon === 'string'}
238
- <div
239
- class={variants.icon({
240
- class: [loading && 'animate-spin', TrailingIcon, ui.icon],
241
- })}
242
- ></div>
243
- {:else if isSnippet(TrailingIcon)}
244
- {@render TrailingIcon()}
245
- {:else if isComponent(TrailingIcon)}
246
- <TrailingIcon class={variants.icon({ class: [ui.icon] })} />
239
+ {:else}
240
+ <Icon
241
+ name={TrailingIcon}
242
+ class={variants.icon({ class: [loading ? 'animate-spin' : ''] })}
243
+ />
247
244
  {/if}
248
245
  </span>
249
246
  {/if}
@@ -1,5 +1,5 @@
1
1
  import { type PropColor, type PropVariant } from '../index.js';
2
- import type { Component, Snippet } from 'svelte';
2
+ import type { Component } from 'svelte';
3
3
  import type { SvelteHTMLElements } from 'svelte/elements';
4
4
  import type { ClassNameValue } from 'tailwind-merge';
5
5
  import { type MaskInputOptions } from 'maska';
@@ -35,12 +35,12 @@ export type InputProps = Omit<SvelteHTMLElements['input'], 'size'> & {
35
35
  */
36
36
  highlight?: boolean;
37
37
  value?: string;
38
- icon?: string | Snippet | Component;
38
+ icon?: string | Component;
39
39
  iconposition?: 'leading' | 'trailing';
40
- leading?: string | Snippet | Component;
41
- trailing?: string | Snippet | Component;
40
+ leading?: string | Component;
41
+ trailing?: string | Component;
42
42
  loading?: boolean;
43
- loadingicon?: string | Snippet | Component;
43
+ loadingicon?: string | Component;
44
44
  mask?: string | MaskInputOptions;
45
45
  ui?: {
46
46
  root?: ClassNameValue;
@@ -7,7 +7,7 @@
7
7
  export type PinInputProps = {
8
8
  value?: number[] | string[];
9
9
  color?: PropColor;
10
- variant?: Omit<PropVariant, 'solid'>;
10
+ variant?: Exclude<PropVariant, 'solid'>;
11
11
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
12
  length?: number;
13
13
  autofocus?: boolean | number;
@@ -80,12 +80,12 @@
80
80
  },
81
81
  variant: {
82
82
  outline: {
83
- cell: 'border border-surface-300 focus:(border-2)',
83
+ cell: 'border border-surface-300 focus:border-2',
84
84
  },
85
85
  soft: {
86
86
  cell: 'bg-surface-50 hover:bg-surface-100 focus:bg-surface-100',
87
87
  },
88
- subtle: { cell: 'border border-surface-300 bg-surface-100 focus:(border-2)' },
88
+ subtle: { cell: 'border border-surface-300 bg-surface-100 focus:border-2' },
89
89
  ghost: { cell: 'hover:bg-surface-100 focus:bg-surface-100' },
90
90
  none: { cell: '' },
91
91
  },
@@ -3,7 +3,7 @@ import type { ClassNameValue } from 'tailwind-merge';
3
3
  export type PinInputProps = {
4
4
  value?: number[] | string[];
5
5
  color?: PropColor;
6
- variant?: Omit<PropVariant, 'solid'>;
6
+ variant?: Exclude<PropVariant, 'solid'>;
7
7
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
8
8
  length?: number;
9
9
  autofocus?: boolean | number;
@@ -30,8 +30,8 @@
30
30
  value,
31
31
  orientation = 'horizontal',
32
32
  color = 'primary',
33
- height = '',
34
- ui = {}
33
+ height = 8,
34
+ ui = {},
35
35
  }: ProgressProps = $props();
36
36
 
37
37
  const percentage = $derived.by(() => {
@@ -53,46 +53,46 @@
53
53
  root: 'relative w-full rounded-full overflow-hidden bg-surface-300',
54
54
  status: '',
55
55
  indicator: 'absolute transition-all rounded-full',
56
- steps: ''
56
+ steps: '',
57
57
  },
58
58
  variants: {
59
59
  color: {
60
60
  primary: {
61
- indicator: 'bg-primary-500'
61
+ indicator: 'bg-primary-500',
62
62
  },
63
63
  surface: {
64
- indicator: 'bg-surface-500'
64
+ indicator: 'bg-surface-500',
65
65
  },
66
66
  info: {
67
- indicator: 'bg-info-500'
67
+ indicator: 'bg-info-500',
68
68
  },
69
69
  success: {
70
- indicator: 'bg-success-500'
70
+ indicator: 'bg-success-500',
71
71
  },
72
72
  warning: {
73
- indicator: 'bg-warning-500'
73
+ indicator: 'bg-warning-500',
74
74
  },
75
75
  error: {
76
- indicator: 'bg-error-500'
77
- }
76
+ indicator: 'bg-error-500',
77
+ },
78
78
  },
79
79
  animation: {
80
80
  swing: [indeterminate ? 'animate-[swing_2s_ease-in-out_infinite' : ''],
81
81
  carousel: [indeterminate ? '' : ''],
82
82
  'carousel-inverse': [indeterminate ? '' : ''],
83
- elastic: [indeterminate ? '' : '']
84
- }
83
+ elastic: [indeterminate ? '' : ''],
84
+ },
85
85
  },
86
- compoundVariants: []
86
+ compoundVariants: [],
87
87
  })({
88
88
  color,
89
- animation: animation ?? 'swing'
90
- })
89
+ animation: animation ?? 'swing',
90
+ }),
91
91
  );
92
92
  </script>
93
93
 
94
94
  <div data-state-indeterminate={indeterminate}>
95
- <div class={classes.root({ class: [ui.base] })} style:height={`${height || 8}px`}>
95
+ <div class={classes.root({ class: [ui.base] })} style:height={`${height}px`}>
96
96
  <span class={classes.indicator({ class: ['h-full left-0'] })} style:width={`${percentage}%`}>
97
97
  </span>
98
98
  </div>
@@ -101,7 +101,7 @@
101
101
  <p
102
102
  class={[
103
103
  'text-right transition',
104
- value && value > 0 && max[value] ? 'text-primary-500' : 'text-surface-500'
104
+ value && value > 0 && max[value] ? 'text-primary-500' : 'text-surface-500',
105
105
  ]}
106
106
  >
107
107
  {(value && max[value]) || max[0]}
@@ -2,6 +2,7 @@
2
2
  import type { PropColor, PropVariant } from '../index.js';
3
3
  import { Select } from 'bits-ui';
4
4
  import type { Component, Snippet } from 'svelte';
5
+ import type { ClassNameValue } from 'tailwind-merge';
5
6
  import { tv } from 'tailwind-variants';
6
7
 
7
8
  export type SelectItem<T> =
@@ -21,6 +22,35 @@
21
22
  variant?: Exclude<PropVariant, 'solid'>;
22
23
  highlight?: boolean;
23
24
  placeholder?: string;
25
+ ui?: {
26
+ base?: ClassNameValue;
27
+ leading?: ClassNameValue;
28
+ leadingIcon?: ClassNameValue;
29
+ leadingAvatar?: ClassNameValue;
30
+ leadingAvatarSize?: ClassNameValue;
31
+ trailing?: ClassNameValue;
32
+ trailingIcon?: ClassNameValue;
33
+ value?: ClassNameValue;
34
+ placeholder?: ClassNameValue;
35
+ arrow?: ClassNameValue;
36
+ content?: ClassNameValue;
37
+ viewport?: ClassNameValue;
38
+ group?: ClassNameValue;
39
+ empty?: ClassNameValue;
40
+ label?: ClassNameValue;
41
+ separator?: ClassNameValue;
42
+ item?: ClassNameValue;
43
+ itemLeadingIcon?: ClassNameValue;
44
+ itemLeadingAvatar?: ClassNameValue;
45
+ itemLeadingAvatarSize?: ClassNameValue;
46
+ itemLeadingChip?: ClassNameValue;
47
+ itemLeadingChipSize?: ClassNameValue;
48
+ itemTrailing?: ClassNameValue;
49
+ itemTrailingIcon?: ClassNameValue;
50
+ itemWrapper?: ClassNameValue;
51
+ itemLabel?: ClassNameValue;
52
+ itemDescription?: ClassNameValue;
53
+ };
24
54
  } & (
25
55
  | {
26
56
  value?: T;
@@ -45,86 +75,324 @@
45
75
  variant = 'outline',
46
76
  highlight,
47
77
  placeholder,
78
+ ui = {},
48
79
  }: SelectProps<T> = $props();
49
80
 
50
81
  const classes = $derived(
51
82
  tv({
52
83
  slots: {
53
- trigger: 'transition-all rounded w-48 flex items-center justify-between',
84
+ base: [
85
+ 'relative group rounded-md inline-flex items-center focus:outline-none disabled:cursor-not-allowed disabled:opacity-75',
86
+ 'transition-colors',
87
+ ],
88
+ leading: 'absolute inset-y-0 start-0 flex items-center',
89
+ leadingIcon: 'shrink-0 text-dimmed',
90
+ leadingAvatar: 'shrink-0',
91
+ leadingAvatarSize: '',
92
+ trailing: 'absolute inset-y-0 end-0 flex items-center',
93
+ trailingIcon: 'shrink-0 text-dimmed',
94
+ value: 'truncate pointer-events-none',
95
+ placeholder: 'truncate text-dimmed',
96
+ arrow: 'fill-bg stroke-default',
97
+ content:
98
+ 'max-h-60 w-(--bits-select-anchor-width) bg-inverted shadow-lg rounded-md ring ring-surface-accented overflow-hidden data-[state=open]:animate-[scale-in_100ms_ease-out] data-[state=closed]:animate-[scale-out_100ms_ease-in] origin-(--bits-select-content-transform-origin) pointer-events-auto flex flex-col',
99
+ viewport: 'relative divide-y divide-base scroll-py-1 overflow-y-auto flex-1',
100
+ group: 'p-1 isolate',
101
+ empty: 'text-center text-muted',
102
+ label: 'font-semibold text-highlighted',
103
+ separator: '-mx-1 my-1 h-px bg-border',
104
+ item: [
105
+ 'group relative w-full flex items-start select-none outline-none before:absolute before:content-[""] before:z-[-1] before:inset-px before:rounded-md data-disabled:cursor-not-allowed data-disabled:opacity-75 text-default data-highlighted:not-data-disabled:text-highlighted data-highlighted:not-[data-disabled]:before:bg-surface-elevated/50',
106
+ 'transition-colors before:transition-colors',
107
+ ],
108
+ itemLeadingIcon: [
109
+ 'shrink-0 text-dimmed group-data-highlighted:not-group-data-disabled:text-default',
110
+ 'transition-colors',
111
+ ],
112
+ itemLeadingAvatar: 'shrink-0',
113
+ itemLeadingAvatarSize: '',
114
+ itemLeadingChip: 'shrink-0',
115
+ itemLeadingChipSize: '',
116
+ itemTrailing: 'ms-auto inline-flex gap-1.5 items-center',
117
+ itemTrailingIcon: 'shrink-0',
118
+ itemWrapper: 'flex-1 flex flex-col min-w-0',
119
+ itemLabel: 'truncate',
120
+ itemDescription: 'truncate text-muted',
54
121
  },
55
122
  variants: {
56
- color: {
57
- primary: {
58
- trigger: 'outline-primary focus:(border-primary)',
59
- },
60
- surface: {
61
- trigger: 'outline-surface focus:(border-surface)',
62
- },
63
- info: {
64
- trigger: 'outline-info focus:(border-info)',
65
- },
66
- success: {
67
- trigger: 'outline-success focus:(border-success)',
68
- },
69
- warning: {
70
- trigger: 'outline-warning focus:(border-warning)',
71
- },
72
- error: {
73
- trigger: 'outline-error focus:(border-error)',
74
- },
123
+ fieldGroup: {
124
+ horizontal:
125
+ 'not-only:first:rounded-e-none not-only:last:rounded-s-none not-last:not-first:rounded-none focus-visible:z-[1]',
126
+ vertical:
127
+ 'not-only:first:rounded-b-none not-only:last:rounded-t-none not-last:not-first:rounded-none focus-visible:z-[1]',
75
128
  },
76
129
  size: {
77
130
  xs: {
78
- trigger: 'h-6 px-1 text-xs gap-1',
131
+ base: 'px-2 py-1 text-xs gap-1',
132
+ leading: 'ps-2',
133
+ trailing: 'pe-2',
134
+ leadingIcon: 'size-4',
135
+ leadingAvatarSize: '3xs',
136
+ trailingIcon: 'size-4',
137
+ label: 'p-1 text-[10px]/3 gap-1',
138
+ item: 'p-1 text-xs gap-1',
139
+ itemLeadingIcon: 'size-4',
140
+ itemLeadingAvatarSize: '3xs',
141
+ itemLeadingChip: 'size-4',
142
+ itemLeadingChipSize: 'sm',
143
+ itemTrailingIcon: 'size-4',
144
+ empty: 'p-2 text-xs',
79
145
  },
80
146
  sm: {
81
- trigger: 'h-7 px-2 text-xs gap-1',
147
+ base: 'px-2.5 py-1.5 text-xs gap-1.5',
148
+ leading: 'ps-2.5',
149
+ trailing: 'pe-2.5',
150
+ leadingIcon: 'size-4',
151
+ leadingAvatarSize: '3xs',
152
+ trailingIcon: 'size-4',
153
+ label: 'p-1.5 text-[10px]/3 gap-1.5',
154
+ item: 'p-1.5 text-xs gap-1.5',
155
+ itemLeadingIcon: 'size-4',
156
+ itemLeadingAvatarSize: '3xs',
157
+ itemLeadingChip: 'size-4',
158
+ itemLeadingChipSize: 'sm',
159
+ itemTrailingIcon: 'size-4',
160
+ empty: 'p-2.5 text-xs',
82
161
  },
83
162
  md: {
84
- trigger: 'h-8 px-2 text-sm gap-2 ',
163
+ base: 'px-2.5 py-1.5 text-sm gap-1.5',
164
+ leading: 'ps-2.5',
165
+ trailing: 'pe-2.5',
166
+ leadingIcon: 'size-5',
167
+ leadingAvatarSize: '2xs',
168
+ trailingIcon: 'size-5',
169
+ label: 'p-1.5 text-xs gap-1.5',
170
+ item: 'p-1.5 text-sm gap-1.5',
171
+ itemLeadingIcon: 'size-5',
172
+ itemLeadingAvatarSize: '2xs',
173
+ itemLeadingChip: 'size-5',
174
+ itemLeadingChipSize: 'md',
175
+ itemTrailingIcon: 'size-5',
176
+ empty: 'p-2.5 text-sm',
85
177
  },
86
178
  lg: {
87
- trigger: 'h-9 px-3 text-sm gap-3',
179
+ base: 'px-3 py-2 text-sm gap-2',
180
+ leading: 'ps-3',
181
+ trailing: 'pe-3',
182
+ leadingIcon: 'size-5',
183
+ leadingAvatarSize: '2xs',
184
+ trailingIcon: 'size-5',
185
+ label: 'p-2 text-xs gap-2',
186
+ item: 'p-2 text-sm gap-2',
187
+ itemLeadingIcon: 'size-5',
188
+ itemLeadingAvatarSize: '2xs',
189
+ itemLeadingChip: 'size-5',
190
+ itemLeadingChipSize: 'md',
191
+ itemTrailingIcon: 'size-5',
192
+ empty: 'p-3 text-sm',
88
193
  },
89
194
  xl: {
90
- trigger: 'h-10 px-3 gap-4',
195
+ base: 'px-3 py-2 text-base gap-2',
196
+ leading: 'ps-3',
197
+ trailing: 'pe-3',
198
+ leadingIcon: 'size-6',
199
+ leadingAvatarSize: 'xs',
200
+ trailingIcon: 'size-6',
201
+ label: 'p-2 text-sm gap-2',
202
+ item: 'p-2 text-base gap-2',
203
+ itemLeadingIcon: 'size-6',
204
+ itemLeadingAvatarSize: 'xs',
205
+ itemLeadingChip: 'size-6',
206
+ itemLeadingChipSize: 'lg',
207
+ itemTrailingIcon: 'size-6',
208
+ empty: 'p-3 text-base',
91
209
  },
92
210
  },
93
211
  variant: {
94
- outline: {
95
- trigger: 'border border-surface-accented focus:(outline)',
96
- },
97
- soft: {
98
- trigger: 'bg-surface-elevated',
99
- },
100
- subtle: {
101
- trigger: 'bg-surface-elevated border border-surface-accented focus:(outline)',
102
- },
103
- ghost: {
104
- trigger: 'hover:bg-surface-elevated',
105
- },
106
- none: {},
212
+ outline:
213
+ 'text-highlighted bg-default ring ring-inset ring-surface-accented hover:bg-surface-elevated disabled:bg-surface-default',
214
+ soft: 'text-highlighted bg-surface-elevated/50 hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-surface-elevated/50',
215
+ subtle:
216
+ 'text-highlighted bg-surface-elevated ring ring-inset ring-accented hover:bg-surface-accented/75 disabled:bg-surface-elevated',
217
+ ghost:
218
+ 'text-highlighted bg-transparent hover:bg-surface-elevated focus:bg-surface-elevated disabled:bg-transparent dark:disabled:bg-transparent',
219
+ none: 'text-highlighted bg-transparent',
220
+ },
221
+ color: {
222
+ primary: '',
223
+ surface: '',
224
+ success: '',
225
+ info: '',
226
+ warning: '',
227
+ error: '',
228
+ },
229
+ leading: {
230
+ true: '',
231
+ },
232
+ trailing: {
233
+ true: '',
107
234
  },
108
- placeholder: {
109
- true: { trigger: 'text-muted' },
110
- false: {},
235
+ loading: {
236
+ true: '',
111
237
  },
112
238
  highlight: {
113
- true: {
114
- trigger: 'border',
115
- },
116
- false: {},
239
+ true: '',
240
+ },
241
+ fixed: {
242
+ false: '',
243
+ },
244
+ type: {
245
+ file: 'file:me-1.5 file:font-medium file:text-muted file:outline-none',
117
246
  },
118
247
  },
119
248
  compoundVariants: [
120
- { color: 'primary', highlight: true, class: { trigger: 'border-primary-500' } },
121
- { color: 'surface', highlight: true, class: { trigger: 'border-surface-500' } },
122
- { color: 'info', highlight: true, class: { trigger: 'border-info-500' } },
123
- { color: 'success', highlight: true, class: { trigger: 'border-success-500' } },
124
- { color: 'warning', highlight: true, class: { trigger: 'border-warning-500' } },
125
- { color: 'error', highlight: true, class: { trigger: 'border-error-500' } },
249
+ {
250
+ color: 'primary',
251
+ variant: ['outline', 'subtle'],
252
+ class: 'focus:ring-2 focus:ring-inset focus:ring-primary',
253
+ },
254
+ {
255
+ color: 'primary',
256
+ highlight: true,
257
+ class: 'ring ring-inset ring-primary',
258
+ },
259
+ {
260
+ color: 'surface',
261
+ variant: ['outline', 'subtle'],
262
+ class: 'focus:ring-2 focus:ring-inset focus:ring-surface-inverted',
263
+ },
264
+ {
265
+ color: 'surface',
266
+ highlight: true,
267
+ class: 'ring ring-inset ring-surface-inverted',
268
+ },
269
+ {
270
+ color: 'error',
271
+ variant: ['outline', 'subtle'],
272
+ class: 'focus:ring-2 focus:ring-inset focus:ring-error',
273
+ },
274
+ {
275
+ color: 'error',
276
+ highlight: true,
277
+ class: 'ring ring-inset ring-error',
278
+ },
279
+ {
280
+ color: 'info',
281
+ variant: ['outline', 'subtle'],
282
+ class: 'focus:ring-2 focus:ring-inset focus:ring-info',
283
+ },
284
+ {
285
+ color: 'info',
286
+ highlight: true,
287
+ class: 'ring ring-inset ring-info',
288
+ },
289
+ {
290
+ color: 'success',
291
+ variant: ['outline', 'subtle'],
292
+ class: 'focus:ring-2 focus:ring-inset focus:ring-success',
293
+ },
294
+ {
295
+ color: 'success',
296
+ highlight: true,
297
+ class: 'ring ring-inset ring-success',
298
+ },
299
+ {
300
+ color: 'warning',
301
+ variant: ['outline', 'subtle'],
302
+ class: 'focus:ring-2 focus:ring-inset focus:ring-warning',
303
+ },
304
+ {
305
+ color: 'warning',
306
+ highlight: true,
307
+ class: 'ring ring-inset ring-warning',
308
+ },
309
+ {
310
+ leading: true,
311
+ size: 'xs',
312
+ class: 'ps-7',
313
+ },
314
+ {
315
+ leading: true,
316
+ size: 'sm',
317
+ class: 'ps-8',
318
+ },
319
+ {
320
+ leading: true,
321
+ size: 'md',
322
+ class: 'ps-9',
323
+ },
324
+ {
325
+ leading: true,
326
+ size: 'lg',
327
+ class: 'ps-10',
328
+ },
329
+ {
330
+ leading: true,
331
+ size: 'xl',
332
+ class: 'ps-11',
333
+ },
334
+ {
335
+ trailing: true,
336
+ size: 'xs',
337
+ class: 'pe-7',
338
+ },
339
+ {
340
+ trailing: true,
341
+ size: 'sm',
342
+ class: 'pe-8',
343
+ },
344
+ {
345
+ trailing: true,
346
+ size: 'md',
347
+ class: 'pe-9',
348
+ },
349
+ {
350
+ trailing: true,
351
+ size: 'lg',
352
+ class: 'pe-10',
353
+ },
354
+ {
355
+ trailing: true,
356
+ size: 'xl',
357
+ class: 'pe-11',
358
+ },
359
+ {
360
+ loading: true,
361
+ leading: true,
362
+ class: {
363
+ leadingIcon: 'animate-spin',
364
+ },
365
+ },
366
+ {
367
+ loading: true,
368
+ leading: false,
369
+ trailing: true,
370
+ class: {
371
+ trailingIcon: 'animate-spin',
372
+ },
373
+ },
374
+ {
375
+ fixed: false,
376
+ size: 'xs',
377
+ class: 'md:text-xs',
378
+ },
379
+ {
380
+ fixed: false,
381
+ size: 'sm',
382
+ class: 'md:text-xs',
383
+ },
384
+ {
385
+ fixed: false,
386
+ size: 'md',
387
+ class: 'md:text-sm',
388
+ },
389
+ {
390
+ fixed: false,
391
+ size: 'lg',
392
+ class: 'md:text-sm',
393
+ },
126
394
  ],
127
- })({ size, color, variant, placeholder: !!placeholder, highlight }),
395
+ })({ size, color, variant, highlight }),
128
396
  );
129
397
  </script>
130
398
 
@@ -139,12 +407,16 @@
139
407
  (v) => (value = v as T | T[] | undefined)
140
408
  }
141
409
  >
142
- <Select.Trigger class={classes.trigger()}>
410
+ <Select.Trigger class={classes.base({ class: ui.base })}>
143
411
  {value || placeholder}
144
412
  <div class="i-lucide-chevron-down size-4"></div>
145
413
  </Select.Trigger>
146
414
  <Select.Portal>
147
- <Select.Content class="bg-red">
415
+ <Select.Content
416
+ class={classes.content({ class: ui.content })}
417
+ preventScroll={true}
418
+ sideOffset={8}
419
+ >
148
420
  <Select.ScrollUpButton />
149
421
  <Select.Viewport>
150
422
  {#each items as item, idx (idx)}
@@ -153,12 +425,15 @@
153
425
  <Select.GroupHeading />
154
426
 
155
427
  {#each item as group_item, gidx (gidx)}
156
- <Select.Item value=""></Select.Item>
428
+ <Select.Item class={classes.item({ class: ui.item })} value=""></Select.Item>
157
429
  {/each}
158
430
  </Select.Group>
159
431
  {:else}
160
432
  {@const is_object = typeof item === 'object' && item !== null && 'value' in item}
161
- <Select.Item value={(is_object ? item.value : item) as string}>
433
+ <Select.Item
434
+ class={classes.item({ class: ui.item })}
435
+ value={(is_object ? item.value : item) as string}
436
+ >
162
437
  {item}
163
438
  </Select.Item>
164
439
  {/if}
@@ -1,6 +1,7 @@
1
1
  import type { PropColor, PropVariant } from '../index.js';
2
2
  import { Select } from 'bits-ui';
3
3
  import type { Component, Snippet } from 'svelte';
4
+ import type { ClassNameValue } from 'tailwind-merge';
4
5
  export type SelectItem<T> = T | {
5
6
  icon?: string | Component;
6
7
  label: string | Component;
@@ -17,6 +18,35 @@ export type SelectProps<T> = {
17
18
  variant?: Exclude<PropVariant, 'solid'>;
18
19
  highlight?: boolean;
19
20
  placeholder?: string;
21
+ ui?: {
22
+ base?: ClassNameValue;
23
+ leading?: ClassNameValue;
24
+ leadingIcon?: ClassNameValue;
25
+ leadingAvatar?: ClassNameValue;
26
+ leadingAvatarSize?: ClassNameValue;
27
+ trailing?: ClassNameValue;
28
+ trailingIcon?: ClassNameValue;
29
+ value?: ClassNameValue;
30
+ placeholder?: ClassNameValue;
31
+ arrow?: ClassNameValue;
32
+ content?: ClassNameValue;
33
+ viewport?: ClassNameValue;
34
+ group?: ClassNameValue;
35
+ empty?: ClassNameValue;
36
+ label?: ClassNameValue;
37
+ separator?: ClassNameValue;
38
+ item?: ClassNameValue;
39
+ itemLeadingIcon?: ClassNameValue;
40
+ itemLeadingAvatar?: ClassNameValue;
41
+ itemLeadingAvatarSize?: ClassNameValue;
42
+ itemLeadingChip?: ClassNameValue;
43
+ itemLeadingChipSize?: ClassNameValue;
44
+ itemTrailing?: ClassNameValue;
45
+ itemTrailingIcon?: ClassNameValue;
46
+ itemWrapper?: ClassNameValue;
47
+ itemLabel?: ClassNameValue;
48
+ itemDescription?: ClassNameValue;
49
+ };
20
50
  } & ({
21
51
  value?: T;
22
52
  type?: 'single';
@@ -35,7 +35,7 @@
35
35
  step,
36
36
  min,
37
37
  max,
38
- ui = {}
38
+ ui = {},
39
39
  }: SliderProps<T> = $props();
40
40
 
41
41
  const default_value = $derived.by(() => {
@@ -51,7 +51,7 @@
51
51
  },
52
52
  set(v: number[]) {
53
53
  value = (v?.length !== 1 ? v : v[0]) as T;
54
- }
54
+ },
55
55
  });
56
56
  const thumbs = $derived(slider_value.get()?.length ?? 1);
57
57
  const classes = $derived.by(() =>
@@ -59,85 +59,85 @@
59
59
  slots: {
60
60
  root: [
61
61
  'relative w-full flex rounded-full bg-neutral-300',
62
- orientation === 'horizontal' ? 'items-center' : 'justify-center mx-1'
62
+ orientation === 'horizontal' ? 'items-center' : 'justify-center mx-1',
63
63
  ],
64
64
  range: [
65
65
  'rounded-full bg-neutral-200 p-0.5 relative transition',
66
- orientation === 'horizontal' ? 'h-full' : 'w-full'
66
+ orientation === 'horizontal' ? 'h-full' : 'w-full',
67
67
  ],
68
68
  thumb: 'bg-white rounded-full border-2 outline-none transition',
69
- tick: ''
69
+ tick: '',
70
70
  },
71
71
  variants: {
72
72
  color: {
73
73
  primary: {
74
74
  root: '',
75
75
  range: 'bg-primary-500',
76
- thumb: 'border-primary-500'
76
+ thumb: 'border-primary-500',
77
77
  },
78
78
  surface: {
79
79
  range: ['bg-neutral-900'],
80
- thumb: 'border-neutral-900'
80
+ thumb: 'border-neutral-900',
81
81
  },
82
82
  info: {
83
83
  range: ['bg-info-500'],
84
- thumb: 'border-info-500'
84
+ thumb: 'border-info-500',
85
85
  },
86
86
  success: {
87
87
  range: ['bg-success-500'],
88
- thumb: 'border-success-500'
88
+ thumb: 'border-success-500',
89
89
  },
90
90
  warning: {
91
91
  range: ['bg-warning-500'],
92
- thumb: 'border-warning-500'
92
+ thumb: 'border-warning-500',
93
93
  },
94
94
  error: {
95
95
  range: ['bg-error-500'],
96
- thumb: 'border-error-500'
97
- }
96
+ thumb: 'border-error-500',
97
+ },
98
98
  },
99
99
  size: {
100
100
  xs: {
101
101
  root: [orientation === 'horizontal' ? 'h-1.5' : ''],
102
102
  thumb: 'size-4',
103
- tick: 'size-2.5'
103
+ tick: 'size-2.5',
104
104
  },
105
105
  sm: {
106
106
  root: [orientation === 'horizontal' ? 'h-1.75' : ''],
107
107
  thumb: 'size-4.5',
108
- tick: 'size-3'
108
+ tick: 'size-3',
109
109
  },
110
110
  md: {
111
111
  root: [orientation === 'horizontal' ? 'h-2' : 'w-2 h-48'],
112
112
  thumb: 'size-5',
113
- tick: 'size-3.5'
113
+ tick: 'size-3.5',
114
114
  },
115
115
  lg: {
116
116
  root: [orientation === 'horizontal' ? 'h-2.5' : ''],
117
117
  thumb: 'size-5.5',
118
- tick: 'size-4'
118
+ tick: 'size-4',
119
119
  },
120
120
  xl: {
121
121
  root: [orientation === 'horizontal' ? 'h-3' : 'w-3'],
122
122
  thumb: 'size-6',
123
- tick: 'size-4.5'
124
- }
123
+ tick: 'size-4.5',
124
+ },
125
125
  },
126
126
  orientation: {
127
127
  horizontal: {
128
128
  root: '',
129
129
  thumb: '',
130
- tick: ''
130
+ tick: '',
131
131
  },
132
132
  vertical: {
133
133
  root: '',
134
134
  thumb: '',
135
- tick: ''
136
- }
137
- }
135
+ tick: '',
136
+ },
137
+ },
138
138
  },
139
- compoundVariants: []
140
- })({ color, size, orientation })
139
+ compoundVariants: [],
140
+ })({ color, size, orientation }),
141
141
  );
142
142
  </script>
143
143
 
@@ -161,7 +161,7 @@
161
161
  position="bottom"
162
162
  class={[
163
163
  'opacity-0 transition pointer-events-none text-sm shadow-md px-2 h-6 flex items-center rounded-md mt-1 border border-surface-200',
164
- 'data-[active=""]:(opacity-100) group-hover:(opacity-100)'
164
+ 'data-[active=""]:opacity-100 group-hover:opacity-100',
165
165
  ]}
166
166
  >
167
167
  {slider_value.get()[index]}
@@ -1,9 +1,8 @@
1
1
  <script module lang="ts">
2
- import { type PropColor, isComponent, isSnippet } from '../index.js';
3
- import type { Snippet } from 'svelte';
2
+ import { type PropColor, Icon } from '../index.js';
3
+ import type { Snippet, Component } from 'svelte';
4
4
  import type { ClassNameValue } from 'tailwind-merge';
5
5
  import { tv } from 'tailwind-variants';
6
- import type { Component } from 'vitest-browser-svelte';
7
6
 
8
7
  export type SwitchProps = {
9
8
  value?: boolean;
@@ -11,9 +10,9 @@
11
10
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
11
  disabled?: boolean;
13
12
  loading?: boolean;
14
- loadingicon?: string | Snippet | Component;
15
- uncheckedicon?: string | Snippet | Component;
16
- checkedicon?: string | Snippet | Component;
13
+ loadingicon?: string | Component;
14
+ uncheckedicon?: string | Component;
15
+ checkedicon?: string | Component;
17
16
  label?: string | Snippet;
18
17
  description?: string | Snippet;
19
18
  required?: boolean;
@@ -121,18 +120,15 @@
121
120
  data-state={value ? 'checked' : 'unchecked'}
122
121
  class={classes.container({ class: [loading && 'cursor-not-allowed', ui.thumb] })}
123
122
  onclick={() => {
124
- console.log('click');
125
- if (loading) return;
123
+ if (loading || disabled) return;
126
124
  value = !value;
127
125
  }}
128
126
  >
129
127
  <span data-state={value ? 'checked' : 'unchecked'} class={classes.thumb({ class: ui.thumb })}>
130
- {@render Icon(uncheckedicon, [(loading || value) && 'opacity-0'])}
131
- {@render Icon(checkedicon, [(loading || !value) && 'opacity-0'])}
132
- {@render Icon(loadingicon || 'i-lucide-loader-circle', [
133
- 'animate-spin',
134
- !loading && 'opacity-0',
135
- ])}
128
+ <Icon
129
+ name={loading ? loadingicon : value ? checkedicon : uncheckedicon}
130
+ class={classes.icon({ class: [loading && 'animate-spin'] })}
131
+ />
136
132
  </span>
137
133
  </button>
138
134
 
@@ -163,18 +159,6 @@
163
159
  {/if}
164
160
  </div>
165
161
 
166
- {#snippet Icon(ico?: SwitchProps['checkedicon'], icon_class?: ClassNameValue)}
167
- <div class={['absolute', icon_class]}>
168
- {#if typeof ico === 'string'}
169
- <div
170
- data-state={value ? 'checked' : 'unchecked'}
171
- class={classes.icon({ class: [ico] })}
172
- ></div>
173
- {:else if isSnippet(ico)}
174
- {@render ico()}
175
- {:else if isComponent(ico)}
176
- {@const Iconn = ico}
177
- <Iconn />
178
- {/if}
179
- </div>
162
+ {#snippet icon(ico?: SwitchProps['checkedicon'], icon_class?: ClassNameValue)}
163
+ <div class={['absolute', icon_class]}></div>
180
164
  {/snippet}
@@ -1,16 +1,15 @@
1
1
  import { type PropColor } from '../index.js';
2
- import type { Snippet } from 'svelte';
2
+ import type { Snippet, Component } from 'svelte';
3
3
  import type { ClassNameValue } from 'tailwind-merge';
4
- import type { Component } from 'vitest-browser-svelte';
5
4
  export type SwitchProps = {
6
5
  value?: boolean;
7
6
  color?: PropColor;
8
7
  size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
9
8
  disabled?: boolean;
10
9
  loading?: boolean;
11
- loadingicon?: string | Snippet | Component;
12
- uncheckedicon?: string | Snippet | Component;
13
- checkedicon?: string | Snippet | Component;
10
+ loadingicon?: string | Component;
11
+ uncheckedicon?: string | Component;
12
+ checkedicon?: string | Component;
14
13
  label?: string | Snippet;
15
14
  description?: string | Snippet;
16
15
  required?: boolean;
@@ -22,6 +21,6 @@ export type SwitchProps = {
22
21
  description?: ClassNameValue;
23
22
  };
24
23
  };
25
- declare const Switch: import("svelte").Component<SwitchProps, {}, "value">;
24
+ declare const Switch: Component<SwitchProps, {}, "value">;
26
25
  type Switch = ReturnType<typeof Switch>;
27
26
  export default Switch;
@@ -70,7 +70,7 @@
70
70
  slots: {
71
71
  root: '',
72
72
  list: 'flex relative p-1',
73
- item: 'flex items-center justify-center text-muted data-[state="inactive"]:hover:(text-highlighted) font-medium z-1 transition-all',
73
+ item: 'flex items-center justify-center text-muted data-[state="inactive"]:hover:text-highlighted font-medium z-1 transition-all',
74
74
  icon: '',
75
75
  content: 'mt-2',
76
76
  indicator: 'absolute z-0 transition-all duration-200 rounded-md w---width',
@@ -79,7 +79,7 @@
79
79
  variant: {
80
80
  pill: {
81
81
  list: 'bg-surface-elevated rounded-lg',
82
- item: 'flex-1 data-[state="active"]:(text-inverted)',
82
+ item: 'flex-1 data-[state="active"]:text-inverted',
83
83
  trigger: 'flex-1',
84
84
  indicator: 'rounded-md shadow-xs',
85
85
  },
package/dist/index.d.ts CHANGED
@@ -1,6 +1,3 @@
1
1
  export * from './components/index.js';
2
2
  export * from './utilities.svelte.js';
3
- export type PropColor = 'primary' | 'surface' | 'info' | 'success' | 'warning' | 'error';
4
- export declare const COLORS: PropColor[];
5
- export type PropVariant = 'solid' | 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
6
- export type PropSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
3
+ export * from './types.js';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  export * from './components/index.js';
2
2
  export * from './utilities.svelte.js';
3
- export const COLORS = ['primary', 'surface', 'info', 'success', 'warning', 'error'];
3
+ export * from './types.js';
@@ -0,0 +1,3 @@
1
+ export type PropColor = 'primary' | 'surface' | 'info' | 'success' | 'warning' | 'error';
2
+ export type PropVariant = 'solid' | 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
3
+ export type PropSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -5,13 +5,13 @@ import { type MaybeGetter, type ElementSizeOptions } from 'runed';
5
5
  * @param v - The value to check
6
6
  * @returns true if the value is a component, false otherwise
7
7
  */
8
- export declare const isComponent: (v: unknown) => v is Component;
8
+ export declare function isComponent(v: unknown): v is Component;
9
9
  /**
10
10
  * Checks if a value is a Svelte snippet
11
11
  * @param v - The value to check
12
12
  * @returns true if the value is a snippet, false otherwise
13
13
  */
14
- export declare const isSnippet: (v: unknown) => v is Snippet;
14
+ export declare function isSnippet(v: unknown): v is Snippet;
15
15
  /**
16
16
  * Returns a reactive value holding the dom rect of `node`s.
17
17
  *
@@ -4,17 +4,17 @@ import { extract, useMutationObserver, useResizeObserver, } from 'runed';
4
4
  * @param v - The value to check
5
5
  * @returns true if the value is a component, false otherwise
6
6
  */
7
- export const isComponent = (v) => {
7
+ export function isComponent(v) {
8
8
  return typeof v === 'function' || (typeof v === 'object' && v !== null && !('$$render' in v));
9
- };
9
+ }
10
10
  /**
11
11
  * Checks if a value is a Svelte snippet
12
12
  * @param v - The value to check
13
13
  * @returns true if the value is a snippet, false otherwise
14
14
  */
15
- export const isSnippet = (v) => {
15
+ export function isSnippet(v) {
16
16
  return typeof v === 'object' && v !== null && '$$render' in v;
17
- };
17
+ }
18
18
  /**
19
19
  * Returns a reactive value holding the dom rect of `node`s.
20
20
  *
package/dist/vite.js CHANGED
@@ -71,14 +71,14 @@ export function uisv(options) {
71
71
  if (typeof colors.surface !== 'object')
72
72
  return '';
73
73
  const variables = `
74
- --colors-DEFAULT: ${colors.surface['200']};
74
+ --colors-base: ${colors.surface['200']};
75
75
  --colors-dimmed: ${colors.surface['500']};
76
76
  --colors-muted: ${colors.surface['400']};
77
77
  --colors-toned: ${colors.surface['300']};
78
78
  --colors-highlighted: white;
79
79
  --colors-inverted: ${colors.surface['900']};
80
80
 
81
- --colors-surface-DEFAULT: ${colors.surface['900']};
81
+ --colors-surface-base: ${colors.surface['900']};
82
82
  --colors-surface-muted: ${colors.surface['800']};
83
83
  --colors-surface-elevated: ${colors.surface['800']};
84
84
  --colors-surface-accented: ${colors.surface['700']};
@@ -120,14 +120,14 @@ export function uisv(options) {
120
120
  colors[color] = in_theme ? in_theme : getColors(value);
121
121
  }
122
122
  if (typeof colors.surface === 'object') {
123
- colors['DEFAULT'] = colors.surface['700'];
123
+ colors['base'] = colors.surface['700'];
124
124
  colors['dimmed'] = colors.surface['400'];
125
125
  colors['muted'] = colors.surface['500'];
126
126
  colors['toned'] = colors.surface['600'];
127
127
  colors['highlighted'] = colors.surface['900'];
128
128
  colors['inverted'] = 'white';
129
129
  colors['surface'] = defu(colors.surface, {
130
- DEFAULT: 'white',
130
+ base: 'white',
131
131
  muted: colors.surface['50'],
132
132
  elevated: colors.surface['100'],
133
133
  accented: colors.surface['200'],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uisv",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "ui library for the rest of us",
5
5
  "license": "MIT",
6
6
  "repository": "ui-sv/uisv",