compote-ui 0.1.0 → 0.2.0

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.
@@ -3,17 +3,17 @@
3
3
  import { tv } from 'tailwind-variants';
4
4
 
5
5
  const button = tv({
6
- base: 'inline-flex items-center justify-center font-medium transition-colors cursor-pointer bg-transparent focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:opacity-50 disabled:pointer-events-none',
6
+ base: 'focus-visible:outline-ring inline-flex cursor-pointer items-center justify-center rounded bg-transparent font-medium transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 disabled:pointer-events-none disabled:opacity-50',
7
7
  variants: {
8
8
  variant: {
9
- solid: 'bg-primary text-primary-foreground hover:bg-primary/90 active:bg-primary/80',
10
- outline: 'border border-border text-foreground hover:bg-muted',
9
+ solid: 'text-primary-foreground bg-primary hover:bg-primary/90 active:bg-primary/80',
10
+ outline: 'border-border text-foreground hover:bg-muted border',
11
11
  ghost: 'text-foreground hover:bg-muted'
12
12
  },
13
13
  size: {
14
- sm: 'h-8 px-3 text-sm rounded-sm gap-1.5',
15
- md: 'h-10 px-4 text-base rounded-md gap-2',
16
- lg: 'h-12 px-6 text-lg rounded-lg gap-2.5'
14
+ sm: 'h-8 gap-1.5 px-2 text-sm',
15
+ md: 'h-9 gap-2 px-3 text-base',
16
+ lg: 'h-10 gap-2.5 px-4 text-lg'
17
17
  }
18
18
  },
19
19
  defaultVariants: { variant: 'solid', size: 'md' }
@@ -14,7 +14,7 @@
14
14
  <Checkbox.Control
15
15
  class="{children
16
16
  ? 'mt-0.5'
17
- : ''} flex size-4 shrink-0 items-center justify-center rounded-sm border border-border bg-transparent transition-colors data-disabled:pointer-events-none data-disabled:opacity-50 data-focus-visible:outline-2 data-focus-visible:outline-offset-2 data-focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-primary"
17
+ : ''} flex size-5 shrink-0 items-center justify-center rounded-sm border border-border bg-transparent transition-colors data-disabled:pointer-events-none data-disabled:opacity-50 data-focus-visible:outline-2 data-focus-visible:outline-offset-2 data-focus-visible:outline-ring data-[state=checked]:border-primary data-[state=checked]:bg-primary"
18
18
  >
19
19
  <Checkbox.Indicator>
20
20
  <PhCheck class="size-3.5 text-primary-foreground" />
@@ -0,0 +1,182 @@
1
+ <script lang="ts" generics="T extends ComboboxItem">
2
+ import { Combobox, createListCollection } from '@ark-ui/svelte/combobox';
3
+ import { Field } from '@ark-ui/svelte/field';
4
+ import { useFilter } from '@ark-ui/svelte/locale';
5
+ import { Portal } from '@ark-ui/svelte/portal';
6
+ import type { ComboboxItem, ComboboxProps } from './types';
7
+ import { cn } from 'tailwind-variants';
8
+ import PhCaretDown from '../../icons/PhCaretDown.svelte';
9
+ import PhCheck from '../../icons/PhCheck.svelte';
10
+ import PhX from '../../icons/PhX.svelte';
11
+
12
+ let {
13
+ value = $bindable(),
14
+ items,
15
+ label,
16
+ placeholder,
17
+ layout = 'vertical',
18
+ name,
19
+ readonly,
20
+ multiple,
21
+ ...restProps
22
+ }: ComboboxProps<T> = $props();
23
+
24
+ // Client-side filtering state
25
+ let filterText = $state('');
26
+ const filters = useFilter({ sensitivity: 'base' });
27
+
28
+ // Base collection — only rebuilds when items prop changes
29
+ const baseCollection = $derived(
30
+ createListCollection({
31
+ items,
32
+ itemToString: (item) => item?.label ?? '',
33
+ itemToValue: (item) => item?.value?.toString() ?? ''
34
+ })
35
+ );
36
+
37
+ // Filtered view — lightweight .filter() on keystroke, full collection when empty
38
+ const collection = $derived(
39
+ filterText
40
+ ? baseCollection.filter((itemString) => filters().contains(itemString, filterText))
41
+ : baseCollection
42
+ );
43
+
44
+ // Handle input change — only filter on actual user typing, not on selection/clear events
45
+ function handleInputChange(details: Combobox.InputValueChangeDetails) {
46
+ if (details.reason === 'input-change') {
47
+ filterText = details.inputValue;
48
+ } else {
49
+ filterText = '';
50
+ }
51
+ }
52
+
53
+ // Compute display label for current value — handles async-loaded items
54
+ const displayValue = $derived.by(() => {
55
+ if (value == null || multiple) return undefined;
56
+ const v = Array.isArray(value) ? value[0] : value;
57
+ const found = items.find((item) => item.value.toString() === v?.toString());
58
+ return found ? found.label : undefined;
59
+ });
60
+
61
+ // Memoize value/inputValue props to prevent reactive cascade (new array/object refs cause Zag loops)
62
+ const valueProp = $derived(
63
+ value != null
64
+ ? Array.isArray(value)
65
+ ? value.map((v) => v.toString())
66
+ : [value.toString()]
67
+ : []
68
+ );
69
+ const controlledInputValue = $derived(multiple ? undefined : (displayValue ?? ''));
70
+
71
+ // Handle value change - look up typed value from items prop by string match
72
+ function handleValueChange(details: Combobox.ValueChangeDetails<T>) {
73
+ if (details.value.length === 0) {
74
+ value = multiple ? [] : null;
75
+ } else if (multiple) {
76
+ value = details.value
77
+ .map((v) => items.find((item) => item.value.toString() === v)?.value)
78
+ .filter((v) => v !== undefined);
79
+ } else {
80
+ const found = items.find((item) => item.value.toString() === details.value[0]);
81
+ value = found?.value ?? null;
82
+ }
83
+ }
84
+ </script>
85
+
86
+ <Combobox.Root
87
+ {collection}
88
+ value={valueProp}
89
+ inputValue={controlledInputValue}
90
+ onValueChange={handleValueChange}
91
+ onInputValueChange={handleInputChange}
92
+ openOnClick
93
+ {multiple}
94
+ readOnly={readonly}
95
+ {...restProps}
96
+ class={cn(layout === 'horizontal' ? 'flex items-center gap-1.5' : 'grid gap-1.5')}
97
+ >
98
+ {#if label}
99
+ <Combobox.Label>
100
+ {label}
101
+ <Field.RequiredIndicator />
102
+ </Combobox.Label>
103
+ {/if}
104
+
105
+ <Combobox.Control
106
+ class={cn(
107
+ 'rounded-ark flex min-h-9 items-center gap-1 border px-3 shadow-sm',
108
+ 'focus-within:ring-1 focus-within:ring-(--ark-ring)',
109
+ multiple && 'flex-wrap py-1'
110
+ )}
111
+ >
112
+ {#if multiple && Array.isArray(value) && value.length > 0}
113
+ <div class="flex flex-wrap gap-1">
114
+ {#each value as v (v)}
115
+ {@const item = items.find((i) => i.value === v)}
116
+ {#if item}
117
+ <span
118
+ class="inline-flex items-center gap-1 rounded bg-(--ark-hover-bg) px-2 py-0.5 text-xs"
119
+ >
120
+ {item.label}
121
+ {#if !readonly}
122
+ <button
123
+ type="button"
124
+ onclick={() => {
125
+ value = (value as (number | string)[]).filter((x) => x !== v);
126
+ }}
127
+ class="hover:text-(--ark-error)"
128
+ >
129
+ <PhX class="size-3" />
130
+ </button>
131
+ {/if}
132
+ </span>
133
+ {/if}
134
+ {/each}
135
+ </div>
136
+ {/if}
137
+ <Combobox.Input
138
+ placeholder={placeholder ?? 'Search...'}
139
+ class="flex-1 bg-transparent text-sm outline-none placeholder:text-ink-dim disabled:cursor-not-allowed disabled:opacity-50"
140
+ />
141
+ {#if value != null && !readonly && !multiple}
142
+ <Combobox.ClearTrigger class="text-ink-dim transition-colors hover:text-ink">
143
+ <PhX class="size-4" />
144
+ </Combobox.ClearTrigger>
145
+ {/if}
146
+ <Combobox.Trigger class="text-ink-dim">
147
+ <PhCaretDown class="size-4 opacity-50" />
148
+ </Combobox.Trigger>
149
+ </Combobox.Control>
150
+
151
+ <Portal>
152
+ <Combobox.Positioner class="data-[state=closed]:pointer-events-none">
153
+ <Combobox.Content
154
+ class="data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 z-50 max-h-60 min-w-(--reference-width) overflow-auto rounded-md border bg-surface-1 p-1 shadow-md"
155
+ >
156
+ <Combobox.Empty class="py-2 text-center text-sm text-ink-dim">
157
+ No results found
158
+ </Combobox.Empty>
159
+
160
+ {#each collection.items as item (item.value)}
161
+ <Combobox.Item
162
+ {item}
163
+ class="relative flex cursor-default items-center rounded-sm py-1.5 pr-8 pl-2 text-sm text-(--ark-accent-fg) select-none data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-surface-2 data-[state=checked]:bg-surface-2"
164
+ >
165
+ <Combobox.ItemText>{item.label}</Combobox.ItemText>
166
+ <Combobox.ItemIndicator class="absolute right-2 items-center justify-center">
167
+ <PhCheck class="size-3.5" />
168
+ </Combobox.ItemIndicator>
169
+ </Combobox.Item>
170
+ {/each}
171
+ </Combobox.Content>
172
+ </Combobox.Positioner>
173
+ </Portal>
174
+
175
+ {#if multiple && Array.isArray(value)}
176
+ {#each value as v, i (v)}
177
+ <input type="hidden" name="{name}[{i}]" value={v ?? ''} />
178
+ {/each}
179
+ {:else if value != null}
180
+ <input type="hidden" {name} {value} />
181
+ {/if}
182
+ </Combobox.Root>
@@ -0,0 +1,26 @@
1
+ import { Combobox } from '@ark-ui/svelte/combobox';
2
+ import type { ComboboxItem, ComboboxProps } from './types';
3
+ declare function $$render<T extends ComboboxItem>(): {
4
+ props: ComboboxProps<T>;
5
+ exports: {};
6
+ bindings: "value";
7
+ slots: {};
8
+ events: {};
9
+ };
10
+ declare class __sveltets_Render<T extends ComboboxItem> {
11
+ props(): ReturnType<typeof $$render<T>>['props'];
12
+ events(): ReturnType<typeof $$render<T>>['events'];
13
+ slots(): ReturnType<typeof $$render<T>>['slots'];
14
+ bindings(): "value";
15
+ exports(): {};
16
+ }
17
+ interface $$IsomorphicComponent {
18
+ new <T extends ComboboxItem>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
19
+ $$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
20
+ } & ReturnType<__sveltets_Render<T>['exports']>;
21
+ <T extends ComboboxItem>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
22
+ z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
23
+ }
24
+ declare const Combobox: $$IsomorphicComponent;
25
+ type Combobox<T extends ComboboxItem> = InstanceType<typeof Combobox<T>>;
26
+ export default Combobox;
@@ -0,0 +1,16 @@
1
+ import type { ComboboxRootBaseProps } from '@ark-ui/svelte/combobox';
2
+ export interface ComboboxItem<T = number | string> {
3
+ value: T;
4
+ label: string;
5
+ disabled?: boolean;
6
+ }
7
+ export interface ComboboxProps<T extends ComboboxItem> extends Omit<ComboboxRootBaseProps<T>, 'value' | 'collection'> {
8
+ value?: number | string | null | (number | string)[];
9
+ items: T[];
10
+ label?: string;
11
+ placeholder?: string;
12
+ readonly?: boolean;
13
+ name?: string;
14
+ multiple?: boolean;
15
+ layout?: 'vertical' | 'horizontal';
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ :where(html){--green-0-hsl:131 67% 95%;--green-1-hsl:128 76% 90%;--green-2-hsl:128 71% 82%;--green-3-hsl:129 68% 73%;--green-4-hsl:130 61% 64%;--green-5-hsl:130 57% 56%;--green-6-hsl:131 50% 50%;--green-7-hsl:131 53% 46%;--green-8-hsl:131 54% 40%;--green-9-hsl:132 52% 35%;--green-10-hsl:132 52% 29%;--green-11-hsl:132 53% 22%;--green-12-hsl:131 53% 16%}
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ let { class: className = '', ...restProps } = $props();
3
+ </script>
4
+
5
+ <!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ width="1em"
9
+ height="1em"
10
+ viewBox="0 0 256 256"
11
+ class={className}
12
+ {...restProps}
13
+ >
14
+ <path
15
+ fill="currentColor"
16
+ d="m213.66 101.66l-80 80a8 8 0 0 1-11.32 0l-80-80a8 8 0 0 1 11.32-11.32L128 164.69l74.34-74.35a8 8 0 0 1 11.32 11.32"
17
+ />
18
+ </svg>
@@ -0,0 +1,5 @@
1
+ declare const PhCaretDown: import("svelte").Component<{
2
+ class?: string;
3
+ } & Record<string, any>, {}, "">;
4
+ type PhCaretDown = ReturnType<typeof PhCaretDown>;
5
+ export default PhCaretDown;
@@ -4,11 +4,11 @@
4
4
 
5
5
  <!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
6
6
  <svg
7
- class={className}
8
7
  xmlns="http://www.w3.org/2000/svg"
9
8
  width="1em"
10
9
  height="1em"
11
10
  viewBox="0 0 256 256"
11
+ class={className}
12
12
  {...restProps}
13
13
  >
14
14
  <path
@@ -4,11 +4,11 @@
4
4
 
5
5
  <!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
6
6
  <svg
7
- class={className}
8
7
  xmlns="http://www.w3.org/2000/svg"
9
8
  width="1em"
10
9
  height="1em"
11
10
  viewBox="0 0 256 256"
11
+ class={className}
12
12
  {...restProps}
13
13
  >
14
14
  <path fill="currentColor" d="M224 128a8 8 0 0 1-8 8H40a8 8 0 0 1 0-16h176a8 8 0 0 1 8 8" />
@@ -0,0 +1,18 @@
1
+ <script lang="ts">
2
+ let { class: className = '', ...restProps } = $props();
3
+ </script>
4
+
5
+ <svg
6
+ xmlns="http://www.w3.org/2000/svg"
7
+ width="1em"
8
+ height="1em"
9
+ viewBox="0 0 256 256"
10
+ class={className}
11
+ {...restProps}
12
+ >
13
+ <path
14
+ fill="currentColor"
15
+ d="M205.66 194.34a8 8 0 0 1-11.32 11.32L128 139.31l-66.34 66.35a8 8 0 0 1-11.32-11.32L116.69 128L50.34 61.66a8 8 0 0 1 11.32-11.32L128 116.69l66.34-66.35a8 8 0 0 1 11.32 11.32L139.31 128Z"
16
+ />
17
+ </svg>
18
+ <!-- Icon from Phosphor by Phosphor Icons - https://github.com/phosphor-icons/core/blob/main/LICENSE -->
@@ -0,0 +1,5 @@
1
+ declare const PhX: import("svelte").Component<{
2
+ class?: string;
3
+ } & Record<string, any>, {}, "">;
4
+ type PhX = ReturnType<typeof PhX>;
5
+ export default PhX;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export { default as Button } from './components/button/Button.svelte';
1
2
  export { default as Checkbox } from './components/checkbox/Checkbox.svelte';
2
3
  export { default as CheckboxGroup } from './components/checkbox/Checkbox-group.svelte';
3
- export { default as Button } from './components/button/Button.svelte';
4
+ export { default as Combobox } from './components/combobox/Combobox.svelte';
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  // Reexport your entry components here
2
+ export { default as Button } from './components/button/Button.svelte';
2
3
  export { default as Checkbox } from './components/checkbox/Checkbox.svelte';
3
4
  export { default as CheckboxGroup } from './components/checkbox/Checkbox-group.svelte';
4
- export { default as Button } from './components/button/Button.svelte';
5
+ export { default as Combobox } from './components/combobox/Combobox.svelte';
@@ -0,0 +1,14 @@
1
+ :where(html) {
2
+ --hue-red: 25;
3
+ --hue-pink: 350;
4
+ --hue-purple: 310;
5
+ --hue-violet: 290;
6
+ --hue-indigo: 270;
7
+ --hue-blue: 240;
8
+ --hue-cyan: 210;
9
+ --hue-teal: 185;
10
+ --hue-green: 145;
11
+ --hue-lime: 125;
12
+ --hue-yellow: 100;
13
+ --hue-orange: 75;
14
+ }
@@ -0,0 +1,19 @@
1
+ :where(*) {
2
+ --color-0: oklch(99% .03 var(--color-hue, 0));
3
+ --color-1: oklch(95% .06 var(--color-hue, 0));
4
+ --color-2: oklch(88% .12 var(--color-hue, 0));
5
+ --color-3: oklch(80% .14 var(--color-hue, 0));
6
+ --color-4: oklch(74% .16 var(--color-hue, 0));
7
+ --color-5: oklch(68% .19 var(--color-hue, 0));
8
+ --color-6: oklch(63% .20 var(--color-hue, 0));
9
+ --color-7: oklch(58% .21 var(--color-hue, 0));
10
+ --color-8: oklch(53% .20 var(--color-hue, 0));
11
+ --color-9: oklch(49% .19 var(--color-hue, 0));
12
+ --color-10: oklch(42% .17 var(--color-hue, 0));
13
+ --color-11: oklch(35% .15 var(--color-hue, 0));
14
+ --color-12: oklch(27% .12 var(--color-hue, 0));
15
+ --color-13: oklch(20% .09 var(--color-hue, 0));
16
+ --color-14: oklch(14% .07 var(--color-hue, 0));
17
+ --color-15: oklch(11% .05 var(--color-hue, 0));
18
+ --color-bright: oklch(65% .3 var(--color-hue, 0));
19
+ }
@@ -0,0 +1,18 @@
1
+ :where(*) {
2
+ --gray-0: oklch(99% var(--gray-chroma, none) var(--gray-hue, none));
3
+ --gray-1: oklch(95% var(--gray-chroma, none) var(--gray-hue, none));
4
+ --gray-2: oklch(88% var(--gray-chroma, none) var(--gray-hue, none));
5
+ --gray-3: oklch(80% var(--gray-chroma, none) var(--gray-hue, none));
6
+ --gray-4: oklch(74% var(--gray-chroma, none) var(--gray-hue, none));
7
+ --gray-5: oklch(68% var(--gray-chroma, none) var(--gray-hue, none));
8
+ --gray-6: oklch(63% var(--gray-chroma, none) var(--gray-hue, none));
9
+ --gray-7: oklch(58% var(--gray-chroma, none) var(--gray-hue, none));
10
+ --gray-8: oklch(53% var(--gray-chroma, none) var(--gray-hue, none));
11
+ --gray-9: oklch(49% var(--gray-chroma, none) var(--gray-hue, none));
12
+ --gray-10: oklch(43% var(--gray-chroma, none) var(--gray-hue, none));
13
+ --gray-11: oklch(37% var(--gray-chroma, none) var(--gray-hue, none));
14
+ --gray-12: oklch(31% var(--gray-chroma, none) var(--gray-hue, none));
15
+ --gray-13: oklch(25% var(--gray-chroma, none) var(--gray-hue, none));
16
+ --gray-14: oklch(18% var(--gray-chroma, none) var(--gray-hue, none));
17
+ --gray-15: oklch(10% var(--gray-chroma, none) var(--gray-hue, none));
18
+ }
package/dist/theme.css CHANGED
@@ -1,69 +1,39 @@
1
- @import './palette.oklch.css';
1
+ @import './props.colors-oklch-hues.css';
2
+ @import './props.colors-oklch.css';
3
+ @import './props.gray-oklch.css';
2
4
 
3
5
  :root {
4
- --gray-hue: 248.19;
5
- --gray-chroma: 0.009;
6
- --radius: 6px;
7
6
  --dim: 0.3;
8
- --compote-ink: var(--color-gray-900);
9
- --compote-ink-dim: oklch(from var(--compote-ink) calc(l + var(--dim)) c h);
10
- --compote-surface: oklch(from var(--compote-ink) calc(1 - l) c h);
11
- --compote-surface: oklch(from var(--compote-ink) calc(1 - l) c h);
12
-
13
- --background: oklch(0.9885 0.0057 84.5659);
14
- --foreground: oklch(0.366 0.0251 49.6085);
15
- --card: oklch(0.9686 0.0091 78.2818);
16
- --card-foreground: oklch(0.366 0.0251 49.6085);
17
- --popover: oklch(0.9686 0.0091 78.2818);
18
- --popover-foreground: oklch(0.366 0.0251 49.6085);
19
- --primary: oklch(0.5553 0.1455 48.9975);
20
- --primary-foreground: oklch(1 0 0);
21
- --secondary: oklch(0.8276 0.0752 74.44);
22
- --secondary-foreground: oklch(0.4444 0.0096 73.639);
23
- --muted: oklch(0.9363 0.0218 83.2637);
24
- --muted-foreground: oklch(0.5534 0.0116 58.0708);
25
- --accent: oklch(0.9 0.05 74.9889);
26
- --accent-foreground: oklch(0.4444 0.0096 73.639);
27
- --destructive: oklch(0.4437 0.1613 26.8994);
28
- --destructive-foreground: oklch(1 0 0);
29
- --border: oklch(0.8866 0.0404 89.6994);
30
- --input: oklch(0.8866 0.0404 89.6994);
31
- --ring: oklch(0.5553 0.1455 48.9975);
7
+ --radius: 6px;
32
8
  --font-sans: 'Wix Madefor Text Variable', sans-serif;
33
9
  --font-serif: Merriweather, serif;
34
10
  --font-mono: Fira Code, monospace;
11
+
12
+ --color-hue: var(--hue-orange);
13
+ --gray-hue: 250;
14
+
15
+ --compote-ink: var(--gray-15);
16
+ --compote-ink-dim: var(--gray-11);
17
+ --compote-surface-3: var(--gray-5);
18
+ --compote-surface-2: var(--gray-4);
19
+ --compote-surface-1: var(--gray-3);
20
+ --compote-surface-document: var(--gray-2);
21
+ --compote-well: var(--gray-1);
22
+
23
+ --compote-primary: var(--color-7);
35
24
  }
36
25
 
37
26
  @media (prefers-color-scheme: dark) {
38
27
  :root {
39
- --compote-ink: var(--color-1);
40
- --compote-ink-dim: var(--color-5);
41
- --compote-surface-3: var(--color-11);
42
- --compote-surface-2: var(--color-12);
43
- --compote-surface-1: var(--color-13);
44
- --compote-surface-document: var(--color-14);
45
- --compote-well-1: var(--color-15);
46
- --compote-well-2: var(--color-16);
28
+ --compote-ink: var(--gray-1);
29
+ --compote-ink-dim: var(--gray-5);
30
+ --compote-surface-3: var(--gray-11);
31
+ --compote-surface-2: var(--gray-12);
32
+ --compote-surface-1: var(--gray-13);
33
+ --compote-surface-document: var(--gray-14);
34
+ --compote-well: var(--gray-15);
47
35
 
48
- --background: oklch(26.21% 0.009 248.19);
49
- --foreground: oklch(0.9699 0.0013 106.4238);
50
- --card: oklch(34.51% 0.013 248.21);
51
- --card-foreground: oklch(0.9699 0.0013 106.4238);
52
- --popover: oklch(0.2685 0.0063 34.2976);
53
- --popover-foreground: oklch(0.9699 0.0013 106.4238);
54
- --primary: oklch(0.7049 0.1867 47.6044);
55
- --primary-foreground: oklch(1 0 0);
56
- --secondary: oklch(0.4444 0.0096 73.639);
57
- --secondary-foreground: oklch(0.9232 0.0026 48.7171);
58
- --muted: oklch(0.233 0.0073 67.4563);
59
- --muted-foreground: oklch(0.7161 0.0091 56.259);
60
- --accent: oklch(0.3598 0.0497 229.3202);
61
- --accent-foreground: oklch(0.9232 0.0026 48.7171);
62
- --destructive: oklch(0.5771 0.2152 27.325);
63
- --destructive-foreground: oklch(1 0 0);
64
- --border: oklch(42.76% 0.015 248.17);
65
- --input: oklch(0.3741 0.0087 67.5582);
66
- --ring: oklch(0.7049 0.1867 47.6044);
36
+ --compote-primary: var(--color-7);
67
37
  }
68
38
  }
69
39
 
@@ -74,28 +44,9 @@
74
44
  --color-surface-2: var(--compote-surface-2);
75
45
  --color-surface-1: var(--compote-surface-1);
76
46
  --color-surface-document: var(--compote-surface-document);
77
- --color-well-1: var(--compote-well-1);
78
- --color-well-2: var(--compote-well-2);
47
+ --color-well: var(--compote-well);
79
48
 
80
- --color-background: var(--background);
81
- --color-foreground: var(--foreground);
82
- --color-card: var(--card);
83
- --color-card-foreground: var(--card-foreground);
84
- --color-popover: var(--popover);
85
- --color-popover-foreground: var(--popover-foreground);
86
- --color-primary: var(--primary);
87
- --color-primary-foreground: var(--primary-foreground);
88
- --color-secondary: var(--secondary);
89
- --color-secondary-foreground: var(--secondary-foreground);
90
- --color-muted: var(--muted);
91
- --color-muted-foreground: var(--muted-foreground);
92
- --color-accent: var(--accent);
93
- --color-accent-foreground: var(--accent-foreground);
94
- --color-destructive: var(--destructive);
95
- --color-destructive-foreground: var(--destructive-foreground);
96
- --color-border: var(--border);
97
- --color-input: var(--input);
98
- --color-ring: var(--ring);
49
+ --color-primary: var(--compote-primary);
99
50
 
100
51
  --font-sans: var(--font-sans);
101
52
  --font-mono: var(--font-mono);
@@ -109,7 +60,7 @@
109
60
 
110
61
  @layer base {
111
62
  * {
112
- @apply border-border outline-ring/50;
63
+ @apply border-surface-3;
113
64
  }
114
65
  body {
115
66
  @apply bg-surface-document text-ink;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "compote-ui",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run prepack",
package/dist/palette.css DELETED
@@ -1 +0,0 @@
1
- :where(:root){--palette-hue:250;--palette-hue-rotate-by:0;--palette-chroma:.15}*{--color-1:oklch(98% calc(.03*var(--palette-chroma,1))calc(var(--palette-hue) + (0*var(--palette-hue-rotate-by))));--color-2:oklch(97% calc(.06*var(--palette-chroma,1))calc(var(--palette-hue) + (1*var(--palette-hue-rotate-by))));--color-3:oklch(93% calc(.1*var(--palette-chroma,1))calc(var(--palette-hue) + (2*var(--palette-hue-rotate-by))));--color-4:oklch(84% calc(.12*var(--palette-chroma,1))calc(var(--palette-hue) + (3*var(--palette-hue-rotate-by))));--color-5:oklch(80% calc(.16*var(--palette-chroma,1))calc(var(--palette-hue) + (4*var(--palette-hue-rotate-by))));--color-6:oklch(71% calc(.19*var(--palette-chroma,1))calc(var(--palette-hue) + (5*var(--palette-hue-rotate-by))));--color-7:oklch(66% calc(.2*var(--palette-chroma,1))calc(var(--palette-hue) + (6*var(--palette-hue-rotate-by))));--color-8:oklch(58% calc(.21*var(--palette-chroma,1))calc(var(--palette-hue) + (7*var(--palette-hue-rotate-by))));--color-9:oklch(53% calc(.2*var(--palette-chroma,1))calc(var(--palette-hue) + (8*var(--palette-hue-rotate-by))));--color-10:oklch(49% calc(.19*var(--palette-chroma,1))calc(var(--palette-hue) + (9*var(--palette-hue-rotate-by))));--color-11:oklch(42% calc(.17*var(--palette-chroma,1))calc(var(--palette-hue) + (10*var(--palette-hue-rotate-by))));--color-12:oklch(35% calc(.15*var(--palette-chroma,1))calc(var(--palette-hue) + (11*var(--palette-hue-rotate-by))));--color-13:oklch(27% calc(.12*var(--palette-chroma,1))calc(var(--palette-hue) + (12*var(--palette-hue-rotate-by))));--color-14:oklch(20% calc(.09*var(--palette-chroma,1))calc(var(--palette-hue) + (13*var(--palette-hue-rotate-by))));--color-15:oklch(16% calc(.07*var(--palette-chroma,1))calc(var(--palette-hue) + (14*var(--palette-hue-rotate-by))));--color-16:oklch(10% calc(.05*var(--palette-chroma,1))calc(var(--palette-hue) + (15*var(--palette-hue-rotate-by))))}
@@ -1,72 +0,0 @@
1
- :where(:root) {
2
- --palette-hue: 250; /* <angle */
3
- --palette-hue-rotate-by: 0; /* +- deg : warm or cool the palette */
4
- --palette-chroma: 0.15; /* 0-1 : lower to mute and pastel, over 2 at own risk */
5
- }
6
-
7
- * {
8
- --color-1: oklch(
9
- 98% calc(0.03 * var(--palette-chroma, 1))
10
- calc(var(--palette-hue) + (0 * var(--palette-hue-rotate-by)))
11
- );
12
- --color-2: oklch(
13
- 97% calc(0.06 * var(--palette-chroma, 1))
14
- calc(var(--palette-hue) + (1 * var(--palette-hue-rotate-by)))
15
- );
16
- --color-3: oklch(
17
- 93% calc(0.1 * var(--palette-chroma, 1))
18
- calc(var(--palette-hue) + (2 * var(--palette-hue-rotate-by)))
19
- );
20
- --color-4: oklch(
21
- 84% calc(0.12 * var(--palette-chroma, 1))
22
- calc(var(--palette-hue) + (3 * var(--palette-hue-rotate-by)))
23
- );
24
- --color-5: oklch(
25
- 80% calc(0.16 * var(--palette-chroma, 1))
26
- calc(var(--palette-hue) + (4 * var(--palette-hue-rotate-by)))
27
- );
28
- --color-6: oklch(
29
- 71% calc(0.19 * var(--palette-chroma, 1))
30
- calc(var(--palette-hue) + (5 * var(--palette-hue-rotate-by)))
31
- );
32
- --color-7: oklch(
33
- 66% calc(0.2 * var(--palette-chroma, 1))
34
- calc(var(--palette-hue) + (6 * var(--palette-hue-rotate-by)))
35
- );
36
- --color-8: oklch(
37
- 58% calc(0.21 * var(--palette-chroma, 1))
38
- calc(var(--palette-hue) + (7 * var(--palette-hue-rotate-by)))
39
- );
40
- --color-9: oklch(
41
- 53% calc(0.2 * var(--palette-chroma, 1))
42
- calc(var(--palette-hue) + (8 * var(--palette-hue-rotate-by)))
43
- );
44
- --color-10: oklch(
45
- 49% calc(0.19 * var(--palette-chroma, 1))
46
- calc(var(--palette-hue) + (9 * var(--palette-hue-rotate-by)))
47
- );
48
- --color-11: oklch(
49
- 42% calc(0.17 * var(--palette-chroma, 1))
50
- calc(var(--palette-hue) + (10 * var(--palette-hue-rotate-by)))
51
- );
52
- --color-12: oklch(
53
- 35% calc(0.15 * var(--palette-chroma, 1))
54
- calc(var(--palette-hue) + (11 * var(--palette-hue-rotate-by)))
55
- );
56
- --color-13: oklch(
57
- 27% calc(0.12 * var(--palette-chroma, 1))
58
- calc(var(--palette-hue) + (12 * var(--palette-hue-rotate-by)))
59
- );
60
- --color-14: oklch(
61
- 20% calc(0.09 * var(--palette-chroma, 1))
62
- calc(var(--palette-hue) + (13 * var(--palette-hue-rotate-by)))
63
- );
64
- --color-15: oklch(
65
- 16% calc(0.07 * var(--palette-chroma, 1))
66
- calc(var(--palette-hue) + (14 * var(--palette-hue-rotate-by)))
67
- );
68
- --color-16: oklch(
69
- 10% calc(0.05 * var(--palette-chroma, 1))
70
- calc(var(--palette-hue) + (15 * var(--palette-hue-rotate-by)))
71
- );
72
- }