lapikit 0.6.4 → 0.6.5

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.
@@ -43,13 +43,23 @@
43
43
  styleProps
44
44
  })
45
45
  );
46
+
47
+ let resolvedStyle = $derived(
48
+ [
49
+ componentStyle,
50
+ color ? `--kit-accordion-item-fg:${color && `var(--kit-color-${color})`}` : '',
51
+ background ? `--kit-accordion-item-bg:${background && `var(--kit-color-${background})`}` : ''
52
+ ]
53
+ .filter(Boolean)
54
+ .join('; ')
55
+ );
46
56
  </script>
47
57
 
48
58
  <svelte:element
49
59
  this={is}
50
60
  bind:this={ref}
51
61
  class={componentClass}
52
- style={componentStyle}
62
+ style={resolvedStyle}
53
63
  data-text={text ? true : undefined}
54
64
  data-spacer={spacer}
55
65
  data-hide-icon={hideIcon}
@@ -57,8 +67,6 @@
57
67
  data-variant={variant}
58
68
  data-density={density}
59
69
  data-rounded={rounded}
60
- style:--kit-accordion-item-fg={color && `var(--kit-color-${color})`}
61
- style:--kit-accordion-item-bg={background && `var(--kit-color-${background})`}
62
70
  {...restProps}
63
71
  >
64
72
  {@render children?.()}
@@ -46,8 +46,6 @@
46
46
  })
47
47
  );
48
48
 
49
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
50
-
51
49
  let safeOpen = $derived(!!open);
52
50
  let model: AccordionItemModelProps = {
53
51
  get open() {
@@ -61,21 +59,29 @@
61
59
  if (readOnly || disabled || !toggle) return;
62
60
  toggle(index);
63
61
  }
62
+
63
+ let resolvedStyle = $derived(
64
+ [
65
+ componentStyle,
66
+ color ? `--kit-accordion-item-fg:${color && `var(--kit-color-${color})`}` : '',
67
+ background ? `--kit-accordion-item-bg:${background && `var(--kit-color-${background})`}` : ''
68
+ ]
69
+ .filter(Boolean)
70
+ .join('; ')
71
+ );
64
72
  </script>
65
73
 
66
74
  <svelte:element
67
75
  this={is}
68
76
  bind:this={ref}
69
77
  class={componentClass}
70
- style={mergedStyle}
78
+ style={resolvedStyle}
71
79
  data-disabled={disabled}
72
80
  data-read-only={readOnly}
73
81
  data-active={safeOpen}
74
82
  data-elevation={elevationState.base}
75
83
  data-elevation-hover={elevationState.hover}
76
84
  data-elevation-active={elevationState.active}
77
- style:--kit-accordion-item-fg={color && `var(--kit-color-${color})`}
78
- style:--kit-accordion-item-bg={background && `var(--kit-color-${background})`}
79
85
  {...restProps}
80
86
  >
81
87
  <span class="outline"></span>
@@ -43,7 +43,7 @@
43
43
  })
44
44
  );
45
45
 
46
- let baseStyle = $derived(
46
+ let componentStyle = $derived(
47
47
  useStyles({
48
48
  styleAttr,
49
49
  sStyle,
@@ -51,7 +51,15 @@
51
51
  })
52
52
  );
53
53
 
54
- let mergedStyle = $derived([baseStyle].filter(Boolean).join('; '));
54
+ let resolvedStyle = $derived(
55
+ [
56
+ componentStyle,
57
+ color ? `--kit-alert-fg:${color && `var(--kit-color-${color})`}` : '',
58
+ background ? `--kit-alert-bg:${background && `var(--kit-color-${background})`}` : ''
59
+ ]
60
+ .filter(Boolean)
61
+ .join('; ')
62
+ );
55
63
  </script>
56
64
 
57
65
  {#if !closable || (closable && open)}
@@ -59,7 +67,7 @@
59
67
  this={is}
60
68
  bind:this={ref}
61
69
  class={componentClass}
62
- style={mergedStyle}
70
+ style={resolvedStyle}
63
71
  role="alert"
64
72
  data-size={size}
65
73
  data-variant={variant}
@@ -73,8 +81,6 @@
73
81
  data-elevation={elevationState.base}
74
82
  data-elevation-hover={elevationState.hover}
75
83
  data-elevation-active={elevationState.active}
76
- style:--kit-alert-fg={color && `var(--kit-color-${color})`}
77
- style:--kit-alert-bg={background && `var(--kit-color-${background})`}
78
84
  {...restProps}
79
85
  >
80
86
  {#if variant === 'outline'}
@@ -53,6 +53,11 @@
53
53
 
54
54
  --kit-shadow-opacity: 30%;
55
55
  --kit-shadow-ambiant-opacity: 15%;
56
+
57
+ --kit-disabled-opacity: 0.55;
58
+ --kit-font:
59
+ ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
60
+ 'Segoe UI Symbol', 'Noto Color Emoji';
56
61
  }
57
62
 
58
63
  .kit-application,
@@ -121,40 +126,74 @@
121
126
  --kit-color-focus: hsl(35 90% 62%);
122
127
  }
123
128
 
124
- .kit-application {
125
- color-scheme: light;
126
-
127
- /* Hue vars — used by components for dynamic semantic color calculations */
128
- --kit-h-neutral: 220;
129
- --kit-h-success: 145;
130
- --kit-h-warning: 35;
131
- --kit-h-danger: 5;
132
- --kit-h-info: 205;
133
-
134
- --kit-bg: hsl(0 0% 100%);
135
- --kit-fg: hsl(222 20% 10%);
136
- --kit-muted: hsl(220 10% 45%);
137
-
138
- --kit-surface-1: hsl(0 0% 100%);
139
- --kit-surface-2: hsl(220 20% 98%);
140
- --kit-surface-3: hsl(220 18% 94%);
141
-
142
- --kit-border: hsl(220 16% 88%);
143
-
144
- --kit-accent: hsl(220 90% 56%);
145
-
146
- --kit-focus: hsl(35, 90%, 56%);
129
+ @media (prefers-color-scheme: light) {
130
+ :global([data-kit-theme='system']) {
131
+ color-scheme: light;
132
+
133
+ --kit-color-surface: hsl(0 0% 100%);
134
+ --kit-color-surface-1: hsl(240 15% 96.5%);
135
+ --kit-color-surface-2: hsl(240 10% 93%);
136
+ --kit-color-surface-3: hsl(0 0% 100%);
137
+
138
+ --kit-color-text: hsl(222 20% 10%);
139
+ --kit-color-text-muted: hsl(220 10% 40%);
140
+ --kit-color-text-subtle: hsl(220 8% 58%);
141
+ --kit-color-text-disabled: hsl(220 5% 76%);
142
+
143
+ --kit-color-fill: hsl(240 8% 93%);
144
+ --kit-color-fill-hover: hsl(240 4% 91%);
145
+ --kit-color-fill-active: hsl(240 4% 88%);
146
+
147
+ --kit-color-border: hsl(220 16% 88%);
148
+ --kit-color-shadow: hsl(240 3% 11%);
149
+
150
+ --kit-color-accent: hsl(220 90% 56%);
151
+ --kit-color-on-accent: hsl(0 0% 100%);
152
+ --kit-color-success: hsl(145 50% 38%);
153
+ --kit-color-on-success: hsl(0 0% 100%);
154
+ --kit-color-warning: hsl(35 80% 45%);
155
+ --kit-color-on-warning: hsl(222 20% 10%);
156
+ --kit-color-error: hsl(5 65% 48%);
157
+ --kit-color-on-error: hsl(0 0% 100%);
158
+ --kit-color-info: hsl(205 60% 42%);
159
+ --kit-color-on-info: hsl(0 0% 100%);
160
+ --kit-color-focus: hsl(35 90% 56%);
161
+ }
162
+ }
147
163
 
148
- /* Layout */
149
- --kit-radius-1: 8px;
150
- --kit-radius-2: 12px;
151
- --kit-space-1: 6px;
152
- --kit-space-2: 10px;
153
- --kit-space-3: 14px;
154
- --kit-disabled-opacity: 0.55;
155
- --kit-font:
156
- ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
157
- 'Segoe UI Symbol', 'Noto Color Emoji';
164
+ @media (prefers-color-scheme: dark) {
165
+ :global([data-kit-theme='system']) {
166
+ color-scheme: dark;
167
+
168
+ --kit-color-surface: hsl(240 3% 11%);
169
+ --kit-color-surface-1: hsl(240 2% 17.5%);
170
+ --kit-color-surface-2: hsl(240 1.5% 23%);
171
+ --kit-color-surface-3: hsl(240 1.5% 28%);
172
+
173
+ --kit-color-text: hsl(0 0% 100%);
174
+ --kit-color-text-muted: hsl(240 3% 56%);
175
+ --kit-color-text-subtle: hsl(240 2.5% 38%);
176
+ --kit-color-text-disabled: hsl(240 1.5% 25%);
177
+
178
+ --kit-color-fill: hsl(240 2.5% 24%);
179
+ --kit-color-fill-hover: hsl(240 2.5% 28%);
180
+ --kit-color-fill-active: hsl(240 2.5% 31%);
181
+
182
+ --kit-color-border: hsl(240 2% 26%);
183
+ --kit-color-shadow: hsl(240 3% 11%);
184
+
185
+ --kit-color-accent: hsl(220 85% 65%);
186
+ --kit-color-on-accent: hsl(240 3% 11%);
187
+ --kit-color-success: hsl(145 50% 50%);
188
+ --kit-color-on-success: hsl(240 3% 11%);
189
+ --kit-color-warning: hsl(35 85% 58%);
190
+ --kit-color-on-warning: hsl(240 3% 11%);
191
+ --kit-color-error: hsl(5 70% 60%);
192
+ --kit-color-on-error: hsl(240 3% 11%);
193
+ --kit-color-info: hsl(205 65% 58%);
194
+ --kit-color-on-info: hsl(240 3% 11%);
195
+ --kit-color-focus: hsl(35 90% 62%);
196
+ }
158
197
  }
159
198
 
160
199
  :global(.outline) {
@@ -56,14 +56,22 @@
56
56
  })
57
57
  );
58
58
 
59
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
59
+ let resolvedStyle = $derived(
60
+ [
61
+ componentStyle,
62
+ color ? `--kit-appbar-fg:${color && `var(--kit-color-${color})`}` : '',
63
+ background ? `--kit-appbar-bg:${background && `var(--kit-color-${background})`}` : ''
64
+ ]
65
+ .filter(Boolean)
66
+ .join('; ')
67
+ );
60
68
  </script>
61
69
 
62
70
  <svelte:element
63
71
  this={is}
64
72
  bind:this={ref}
65
73
  class={componentClass}
66
- style={mergedStyle}
74
+ style={resolvedStyle}
67
75
  data-size={size}
68
76
  data-variant={variant}
69
77
  data-density={density}
@@ -71,8 +79,6 @@
71
79
  data-elevation={elevationState.base}
72
80
  data-elevation-hover={elevationState.hover}
73
81
  data-elevation-active={elevationState.active}
74
- style:--kit-appbar-fg={color && `var(--kit-color-${color})`}
75
- style:--kit-appbar-bg={background && `var(--kit-color-${background})`}
76
82
  {...restProps}
77
83
  >
78
84
  {#if variant === 'outline'}
@@ -1,4 +1,4 @@
1
- import type { Component, DensityType, ElevationProps, RoundedType } from '../../@types';
1
+ import type { Component, DensityType, ElevationProps, RoundedType, SizeType } from '../../@types';
2
2
  type Variant = 'filled' | 'outline' | 'text';
3
3
  export interface AppbarProps extends Component {
4
4
  ref?: HTMLElement | null;
@@ -6,6 +6,7 @@ export interface AppbarProps extends Component {
6
6
  variant?: Variant;
7
7
  rounded?: RoundedType | 'full';
8
8
  density?: DensityType;
9
+ size?: SizeType;
9
10
  color?: string;
10
11
  background?: string;
11
12
  classContent?: string | string[] | undefined;
@@ -69,14 +69,13 @@
69
69
  );
70
70
 
71
71
  let resolvedRatio = $derived(resolveRatio(ratio ?? aspectRatio));
72
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
73
72
  </script>
74
73
 
75
74
  <svelte:element
76
75
  this={is}
77
76
  bind:this={ref}
78
77
  class={componentClass}
79
- style={mergedStyle}
78
+ style={componentStyle}
80
79
  data-inline={inline}
81
80
  style:--kit-aspect-ratio={resolvedRatio}
82
81
  style:--kit-aspect-fit={fit}
@@ -44,13 +44,23 @@
44
44
  let elevationState = $derived(useElevation(elevation));
45
45
  let contentType = $derived(label && label.trim().length > 0 ? 'label' : children);
46
46
  let displayLabel = $derived(label?.trim() ?? '');
47
+
48
+ let resolvedStyle = $derived(
49
+ [
50
+ componentStyle,
51
+ color ? `--kit-avatar-fg:${color && `var(--kit-color-${color})`}` : '',
52
+ background ? `--kit-avatar-bg:${background && `var(--kit-color-${background})`}` : ''
53
+ ]
54
+ .filter(Boolean)
55
+ .join('; ')
56
+ );
47
57
  </script>
48
58
 
49
59
  <svelte:element
50
60
  this={'div'}
51
61
  bind:this={ref}
52
62
  class={componentClass}
53
- style={componentStyle}
63
+ style={resolvedStyle}
54
64
  data-type={contentType}
55
65
  data-size={contentType === 'label' ? size : undefined}
56
66
  data-density={contentType === 'label' ? density : undefined}
@@ -58,8 +68,6 @@
58
68
  data-elevation={elevationState.base}
59
69
  data-elevation-hover={elevationState.hover}
60
70
  data-elevation-active={elevationState.active}
61
- style:--kit-avatar-fg={color && `var(--kit-color-${color})`}
62
- style:--kit-avatar-bg={background && `var(--kit-color-${background})`}
63
71
  {...restProps}
64
72
  >
65
73
  {#if contentType === 'label'}
@@ -72,6 +72,16 @@
72
72
  if (tag !== 'button') return type;
73
73
  return type ?? 'button';
74
74
  });
75
+
76
+ let resolvedStyle = $derived(
77
+ [
78
+ componentStyle,
79
+ color ? `--kit-btn-fg:${color && `var(--kit-color-${color})`}` : '',
80
+ background ? `--kit-btn-bg:${background && `var(--kit-color-${background})`}` : ''
81
+ ]
82
+ .filter(Boolean)
83
+ .join('; ')
84
+ );
75
85
  </script>
76
86
 
77
87
  {#if isInput}
@@ -79,7 +89,7 @@
79
89
  this={inputWrapperTag}
80
90
  bind:this={ref}
81
91
  class={componentClass}
82
- style={componentStyle}
92
+ style={resolvedStyle}
83
93
  data-size={size}
84
94
  data-variant={variant}
85
95
  data-loading={loading}
@@ -99,8 +109,6 @@
99
109
  component: 'btn',
100
110
  disabled: noRipple || disabled
101
111
  }}
102
- style:--kit-btn-fg={color && `var(--kit-color-${color})`}
103
- style:--kit-btn-bg={background && `var(--kit-color-${background})`}
104
112
  >
105
113
  {#if variant === 'outline'}
106
114
  <span class="outline"></span>
@@ -122,7 +130,7 @@
122
130
  this={tag}
123
131
  bind:this={ref}
124
132
  class={componentClass}
125
- style={componentStyle}
133
+ style={resolvedStyle}
126
134
  type={resolvedType()}
127
135
  href={resolvedHref}
128
136
  data-size={size}
@@ -145,8 +153,6 @@
145
153
  component: 'btn',
146
154
  disabled: noRipple || disabled
147
155
  }}
148
- style:--kit-btn-fg={color && `var(--kit-color-${color})`}
149
- style:--kit-btn-bg={background && `var(--kit-color-${background})`}
150
156
  {...restProps}
151
157
  >
152
158
  {#if variant === 'outline'}
@@ -55,13 +55,23 @@
55
55
  styleProps
56
56
  })
57
57
  );
58
+
59
+ let resolvedStyle = $derived(
60
+ [
61
+ componentStyle,
62
+ color ? `--kit-card-fg:${color && `var(--kit-color-${color})`}` : '',
63
+ background ? `--kit-card-bg:${background && `var(--kit-color-${background})`}` : ''
64
+ ]
65
+ .filter(Boolean)
66
+ .join('; ')
67
+ );
58
68
  </script>
59
69
 
60
70
  <svelte:element
61
71
  this={tag}
62
72
  bind:this={ref}
63
73
  class={componentClass}
64
- style={componentStyle}
74
+ style={resolvedStyle}
65
75
  href={resolvedHref}
66
76
  type={resolvedType}
67
77
  disabled={resolvedDisabled}
@@ -80,8 +90,6 @@
80
90
  component: 'card',
81
91
  disabled: noRipple || disabled || !isInteractive
82
92
  }}
83
- style:--kit-card-fg={color && `var(--kit-color-${color})`}
84
- style:--kit-card-bg={background && `var(--kit-color-${background})`}
85
93
  {...restProps}
86
94
  >
87
95
  {#if variant === 'outline'}
@@ -48,6 +48,6 @@
48
48
  .kit-card-actions {
49
49
  display: inline-flex;
50
50
  align-items: center;
51
- gap: var(--kit-space-1);
51
+ gap: var(--kit-space-compact);
52
52
  }
53
53
  </style>
@@ -87,6 +87,16 @@
87
87
  const resolvedDisabled = $derived((tag === 'button' && isLocked) || undefined);
88
88
 
89
89
  const resolvedType = $derived(tag !== 'button' ? type : (type ?? 'button'));
90
+
91
+ let resolvedStyle = $derived(
92
+ [
93
+ componentStyle,
94
+ color ? `--kit-chip-fg:${color && `var(--kit-color-${color})`}` : '',
95
+ background ? `--kit-chip-bg:${background && `var(--kit-color-${background})`}` : ''
96
+ ]
97
+ .filter(Boolean)
98
+ .join('; ')
99
+ );
90
100
  </script>
91
101
 
92
102
  {#if isInput}
@@ -94,7 +104,7 @@
94
104
  this={inputWrapperTag}
95
105
  bind:this={ref}
96
106
  class={componentClass}
97
- style={componentStyle}
107
+ style={resolvedStyle}
98
108
  data-size={size}
99
109
  data-variant={variant}
100
110
  data-rounded={rounded}
@@ -114,8 +124,6 @@
114
124
  component: 'chip',
115
125
  disabled: noRipple || isLocked
116
126
  }}
117
- style:--kit-chip-fg={color && `var(--kit-color-${color})`}
118
- style:--kit-chip-bg={background && `var(--kit-color-${background})`}
119
127
  >
120
128
  {#if variant === 'outline'}
121
129
  <span class="outline"></span>
@@ -143,7 +151,7 @@
143
151
  this={tag}
144
152
  bind:this={ref}
145
153
  class={componentClass}
146
- style={componentStyle}
154
+ style={resolvedStyle}
147
155
  type={resolvedType}
148
156
  href={resolvedHref}
149
157
  data-size={size}
@@ -167,8 +175,8 @@
167
175
  component: 'chip',
168
176
  disabled: noRipple || !isInteractive
169
177
  }}
170
- style:--kit-chip-fg={color && `var(--kit-color-${color})`}
171
- style:--kit-chip-bg={background && `var(--kit-color-${background})`}
178
+ // style:--kit-chip-fg={color && `var(--kit-color-${color})`}
179
+ // style:--kit-chip-bg={background && `var(--kit-color-${background})`}
172
180
  {...restProps}
173
181
  >
174
182
  {#if variant === 'outline'}
@@ -53,8 +53,6 @@
53
53
  : `${classContent ?? ''}`.trim()
54
54
  );
55
55
 
56
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
57
-
58
56
  $effect(() => {
59
57
  if (!ref) return;
60
58
 
@@ -97,12 +95,22 @@
97
95
  if (event.target !== ref || persistent) return;
98
96
  open = false;
99
97
  }
98
+
99
+ let resolvedStyle = $derived(
100
+ [
101
+ componentStyle,
102
+ color ? `--kit-dialog-fg:${color && `var(--kit-color-${color})`}` : '',
103
+ background ? `--kit-dialog-bg:${background && `var(--kit-color-${background})`}` : ''
104
+ ]
105
+ .filter(Boolean)
106
+ .join('; ')
107
+ );
100
108
  </script>
101
109
 
102
110
  <dialog
103
111
  bind:this={ref}
104
112
  class={componentClass}
105
- style={mergedStyle}
113
+ style={resolvedStyle}
106
114
  data-size={size}
107
115
  data-position={position}
108
116
  data-persistent={persistent}
@@ -47,7 +47,15 @@
47
47
  })
48
48
  );
49
49
 
50
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
50
+ let resolvedStyle = $derived(
51
+ [
52
+ componentStyle,
53
+ color ? `--kit-dropdown-fg:${color && `var(--kit-color-${color})`}` : '',
54
+ background ? `--kit-dropdown-bg:${background && `var(--kit-color-${background})`}` : ''
55
+ ]
56
+ .filter(Boolean)
57
+ .join('; ')
58
+ );
51
59
 
52
60
  const positioner = getPositions();
53
61
 
@@ -154,7 +162,7 @@
154
162
  <div
155
163
  bind:this={contentRef}
156
164
  class={componentClass}
157
- style={`left:${axis.x}px; top:${axis.y}px; ${mergedStyle}`}
165
+ style={`left:${axis.x}px; top:${axis.y}px; ${resolvedStyle}`}
158
166
  role="menu"
159
167
  data-rounded={rounded}
160
168
  data-position={axis.location ?? position}
@@ -169,8 +177,6 @@
169
177
  data-elevation-hover={elevationState.hover}
170
178
  data-elevation-active={elevationState.active}
171
179
  use:clickOutside={{ exclude: [contentRef, activatorRef], onClose: handleClose }}
172
- style:--kit-dropdown-fg={color && `var(--kit-color-${color})`}
173
- style:--kit-dropdown-bg={background && `var(--kit-color-${background})`}
174
180
  {...restProps}
175
181
  >
176
182
  {@render children?.()}
@@ -47,6 +47,16 @@
47
47
  })
48
48
  );
49
49
 
50
+ let resolvedStyle = $derived(
51
+ [
52
+ componentStyle,
53
+ color ? `--kit-icon-color:${color && `var(--kit-color-${color})`}` : '',
54
+ color ? `color:${color && `var(--kit-color-${color})`}` : ''
55
+ ]
56
+ .filter(Boolean)
57
+ .join('; ')
58
+ );
59
+
50
60
  let resolvedSrc = $derived(src ?? (icon?.includes('/') ? icon : undefined));
51
61
  let resolvedName = $derived(name ?? (!icon?.includes('/') ? icon : undefined));
52
62
  let hasChildren = $derived(!!children);
@@ -68,7 +78,6 @@
68
78
  let useFilterMode = $derived(
69
79
  !!resolvedSrc && !!imgFilter && (colorMode === 'filter' || colorMode === 'auto')
70
80
  );
71
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
72
81
  </script>
73
82
 
74
83
  {#if hasContent}
@@ -76,13 +85,11 @@
76
85
  this={is}
77
86
  bind:this={ref}
78
87
  class={classWithIconName}
79
- style={mergedStyle}
88
+ style={resolvedStyle}
80
89
  data-size={size}
81
90
  role={iconRole}
82
91
  aria-label={iconAriaLabel}
83
92
  aria-hidden={iconAriaHidden}
84
- style:--kit-icon-color={color && `var(--kit-color-${color})`}
85
- style:color={color && `var(--kit-color-${color})`}
86
93
  {...restProps}
87
94
  >
88
95
  {#if hasChildren}
@@ -42,22 +42,28 @@
42
42
  })
43
43
  );
44
44
 
45
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
45
+ let resolvedStyle = $derived(
46
+ [
47
+ componentStyle,
48
+ color ? `--kit-list-item-fg:${color && `var(--kit-color-${color})`}` : '',
49
+ background ? `--kit-list-item-bg:${background && `var(--kit-color-${background})`}` : ''
50
+ ]
51
+ .filter(Boolean)
52
+ .join('; ')
53
+ );
46
54
  </script>
47
55
 
48
56
  <svelte:element
49
57
  this={is}
50
58
  bind:this={ref}
51
59
  class={componentClass}
52
- style={mergedStyle}
60
+ style={resolvedStyle}
53
61
  data-size={size}
54
62
  data-variant={variant}
55
63
  data-density={density}
56
64
  data-rounded={rounded}
57
65
  data-nav={nav}
58
66
  role={nav ? 'navigation' : is === 'ul' ? undefined : 'list'}
59
- style:--kit-list-item-fg={color && `var(--kit-color-${color})`}
60
- style:--kit-list-item-bg={background && `var(--kit-color-${background})`}
61
67
  {...restProps}
62
68
  >
63
69
  {@render children?.()}
@@ -49,14 +49,22 @@
49
49
  })
50
50
  );
51
51
 
52
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
52
+ let resolvedStyle = $derived(
53
+ [
54
+ componentStyle,
55
+ color ? `--kit-list-item-fg:${color && `var(--kit-color-${color})`}` : '',
56
+ background ? `--kit-list-item-bg:${background && `var(--kit-color-${background})`}` : ''
57
+ ]
58
+ .filter(Boolean)
59
+ .join('; ')
60
+ );
53
61
  </script>
54
62
 
55
63
  <svelte:element
56
64
  this={tag}
57
65
  bind:this={ref}
58
66
  class={componentClass}
59
- style={mergedStyle}
67
+ style={resolvedStyle}
60
68
  href={href && !disabled ? href : undefined}
61
69
  data-active={active}
62
70
  data-disabled={disabled}
@@ -67,8 +75,6 @@
67
75
  data-append={append && true}
68
76
  data-prepend={prepend && true}
69
77
  data-interactive={isInteractive}
70
- style:--kit-list-item-fg={color && `var(--kit-color-${color})`}
71
- style:--kit-list-item-bg={background && `var(--kit-color-${background})`}
72
78
  use:ripple={{
73
79
  component: 'list-item',
74
80
  disabled: noRipple || !isInteractive
@@ -24,8 +24,8 @@
24
24
  rounded = 'md',
25
25
  density = 'default',
26
26
  classContent = '',
27
- color = undefined,
28
- background = undefined,
27
+ color,
28
+ background,
29
29
  closeWithEsc = true,
30
30
  space,
31
31
  elevation = '2',
@@ -61,8 +61,6 @@
61
61
  : `${classContent ?? ''}`.trim()
62
62
  );
63
63
 
64
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
65
-
66
64
  $effect(() => {
67
65
  if (open && !wasPushed) {
68
66
  pushModal(modalId);
@@ -111,13 +109,24 @@
111
109
  function handleClose() {
112
110
  if (!persistent) open = false;
113
111
  }
112
+
113
+ let resolvedStyle = $derived(
114
+ [
115
+ componentStyle,
116
+ color ? `--kit-modal-fg:${color && `var(--kit-color-${color})`}` : '',
117
+ background ? `--kit-modal-bg:${background && `var(--kit-color-${background})`}` : '',
118
+ space ? `--kit-modal-space:${space}` : ''
119
+ ]
120
+ .filter(Boolean)
121
+ .join('; ')
122
+ );
114
123
  </script>
115
124
 
116
125
  {#if open}
117
126
  <div
118
127
  bind:this={ref}
119
128
  class={componentClass}
120
- style={mergedStyle}
129
+ style={resolvedStyle}
121
130
  role="dialog"
122
131
  aria-modal={!contain}
123
132
  data-contain={contain}
@@ -137,9 +146,6 @@
137
146
  data-elevation-hover={elevationState.hover}
138
147
  data-elevation-active={elevationState.active}
139
148
  onclick={(event: MouseEvent) => event.stopPropagation()}
140
- style:--kit-modal-fg={color && `var(--kit-color-${color})`}
141
- style:--kit-modal-bg={background && `var(--kit-color-${background})`}
142
- style:--kit-modal-space={space}
143
149
  >
144
150
  {@render children?.()}
145
151
  </div>
@@ -45,8 +45,6 @@
45
45
  })
46
46
  );
47
47
 
48
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
49
-
50
48
  const positioner = getPositions();
51
49
 
52
50
  let contentRef = $state<HTMLElement | null>(null);
@@ -97,6 +95,16 @@
97
95
  $effect(() => {
98
96
  ref = contentRef;
99
97
  });
98
+
99
+ let resolvedStyle = $derived(
100
+ [
101
+ componentStyle,
102
+ color ? `--kit-popover-fg:${color && `var(--kit-color-${color})`}` : '',
103
+ background ? `--kit-popover-bg:${background && `var(--kit-color-${background})`}` : ''
104
+ ]
105
+ .filter(Boolean)
106
+ .join('; ')
107
+ );
100
108
  </script>
101
109
 
102
110
  <svelte:window bind:innerHeight bind:innerWidth bind:scrollX bind:scrollY />
@@ -107,7 +115,7 @@
107
115
  <div
108
116
  bind:this={contentRef}
109
117
  class={componentClass}
110
- style={`left:${axis.x}px; top:${axis.y}px; ${mergedStyle}`}
118
+ style={`left:${axis.x}px; top:${axis.y}px; ${resolvedStyle}`}
111
119
  role="dialog"
112
120
  data-rounded={rounded}
113
121
  data-position={axis.location ?? position}
@@ -115,8 +123,6 @@
115
123
  data-elevation={elevationState.base}
116
124
  data-elevation-hover={elevationState.hover}
117
125
  data-elevation-active={elevationState.active}
118
- style:--kit-modal-fg={color && `var(--kit-color-${color})`}
119
- style:--kit-modal-bg={background && `var(--kit-color-${background})`}
120
126
  use:clickOutside={{ exclude: [contentRef, activatorRef], onClose: () => (open = false) }}
121
127
  {...restProps}
122
128
  >
@@ -11,7 +11,7 @@ export type ModelPopoverProps = {
11
11
  export interface PopoverProps extends Component {
12
12
  ref?: HTMLElement | null;
13
13
  open?: boolean;
14
- rounded?: RoundedType | string;
14
+ rounded?: RoundedType;
15
15
  position?: 'top' | 'bottom' | 'left' | 'right';
16
16
  color?: string;
17
17
  background?: string;
@@ -41,7 +41,20 @@
41
41
  const formatThickness = (value?: number | string) =>
42
42
  typeof thickness === 'number' ? `${value}px` : value;
43
43
 
44
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
44
+ let resolvedStyle = $derived(
45
+ [
46
+ componentStyle,
47
+ color ? `--kit-separator-fg:${color && `var(--kit-color-${color})`}` : '',
48
+ thickness && orientation === 'horizontal'
49
+ ? `--kit-separator-top-width:${formatThickness(thickness)}`
50
+ : '',
51
+ thickness && orientation === 'vertical'
52
+ ? `--kit-separator-right-width:${formatThickness(thickness)}`
53
+ : ''
54
+ ]
55
+ .filter(Boolean)
56
+ .join('; ')
57
+ );
45
58
  </script>
46
59
 
47
60
  <svelte:element
@@ -49,14 +62,12 @@
49
62
  bind:this={ref}
50
63
  {...restProps}
51
64
  class={componentClass}
52
- style={mergedStyle}
65
+ style={resolvedStyle}
53
66
  role="separator"
54
67
  aria-orientation={orientation || 'horizontal'}
55
68
  data-inset={inset || undefined}
56
69
  data-orientation={orientation}
57
70
  style:--kit-separator-color={color && `var(--kit-color-${color})`}
58
- style:--kit-separator-top-width={orientation === 'horizontal' ? formatThickness(thickness) : ''}
59
- style:--kit-separator-right-width={orientation === 'vertical' ? formatThickness(thickness) : ''}
60
71
  />
61
72
 
62
73
  <style>
@@ -70,7 +70,15 @@
70
70
  })
71
71
  );
72
72
 
73
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
73
+ let resolvedStyle = $derived(
74
+ [
75
+ componentStyle,
76
+ color ? `--kit-textfield-fg:${color && `var(--kit-color-${color})`}` : '',
77
+ background ? `--kit-textfield-bg:${background && `var(--kit-color-${background})`}` : ''
78
+ ]
79
+ .filter(Boolean)
80
+ .join('; ')
81
+ );
74
82
 
75
83
  let counterValue = $state(0);
76
84
  let displayMessage = $state(false);
@@ -122,7 +130,7 @@
122
130
  <div
123
131
  bind:this={ref}
124
132
  class={componentClass}
125
- style={mergedStyle}
133
+ style={resolvedStyle}
126
134
  {...restProps}
127
135
  data-size={size}
128
136
  data-variant={variant}
@@ -133,8 +141,6 @@
133
141
  data-hide-spin-buttons={type === 'number' && hideSpinButtons}
134
142
  data-rounded={rounded}
135
143
  data-with-message={(messageValue || messagePrefix || messageSuffix || counter) && true}
136
- style:--kit-textfield-fg={color && `var(--kit-color-${color})`}
137
- style:--kit-textfield-bg={background && `var(--kit-color-${background})`}
138
144
  >
139
145
  {#if prepend}
140
146
  <div class="kit-textfield__prepend">
@@ -57,14 +57,22 @@
57
57
  })
58
58
  );
59
59
 
60
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
60
+ let resolvedStyle = $derived(
61
+ [
62
+ componentStyle,
63
+ color ? `--kit-toolbar-fg:${color && `var(--kit-color-${color})`}` : '',
64
+ background ? `--kit-toolbar-bg:${background && `var(--kit-color-${background})`}` : ''
65
+ ]
66
+ .filter(Boolean)
67
+ .join('; ')
68
+ );
61
69
  </script>
62
70
 
63
71
  <svelte:element
64
72
  this={is}
65
73
  bind:this={ref}
66
74
  class={componentClass}
67
- style={mergedStyle}
75
+ style={resolvedStyle}
68
76
  {...restProps}
69
77
  role="toolbar"
70
78
  data-variant={variant}
@@ -75,8 +83,6 @@
75
83
  data-elevation={elevationState.base}
76
84
  data-elevation-hover={elevationState.hover}
77
85
  data-elevation-active={elevationState.active}
78
- style:--kit-toolbar-fg={color && `var(--kit-color-${color})`}
79
- style:--kit-toolbar-bg={background && `var(--kit-color-${background})`}
80
86
  >
81
87
  {#if variant === 'outline'}
82
88
  <span class="outline"></span>
@@ -56,7 +56,15 @@
56
56
  })
57
57
  );
58
58
 
59
- let mergedStyle = $derived([componentStyle].filter(Boolean).join('; '));
59
+ let resolvedStyle = $derived(
60
+ [
61
+ componentStyle,
62
+ color ? `--kit-tooltip-fg:${color && `var(--kit-color-${color})`}` : '',
63
+ background ? `--kit-tooltip-bg:${background && `var(--kit-color-${background})`}` : ''
64
+ ]
65
+ .filter(Boolean)
66
+ .join('; ')
67
+ );
60
68
 
61
69
  const positioner = getPositionsTooltip();
62
70
 
@@ -174,12 +182,10 @@
174
182
  role="tooltip"
175
183
  aria-label={label}
176
184
  style={`transform: translate(${axis.x}px, ${axis.y}px); display:${open ? 'block' : 'none'}`}
177
- style:--kit-tooltip-fg={color && `var(--kit-color-${color})`}
178
- style:--kit-tooltip-bg={background && `var(--kit-color-${background})`}
179
185
  >
180
186
  <div
181
187
  class={componentClass}
182
- style={mergedStyle}
188
+ style={resolvedStyle}
183
189
  data-density={density}
184
190
  data-location={axis.location ?? location}
185
191
  data-variant={variant}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lapikit",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"