@rokkit/core 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,305 @@
1
+ declare const _default: {};
2
+ export default _default;
3
+ export type LineType = "child" | "last" | "sibling" | "empty" | "icon";
4
+ /**
5
+ * An object where keys are event names and values are event handler functions.
6
+ */
7
+ export type EventHandlers = {
8
+ [x: string]: Function;
9
+ };
10
+ /**
11
+ * Component map to be used to render the item.
12
+ */
13
+ export type ComponentMap = {
14
+ [x: string]: import("svelte").SvelteComponent<Record<string, any>, any, any>;
15
+ };
16
+ /**
17
+ * Options for the sort order of the column.
18
+ */
19
+ export type SortOptions = "ascending" | "descending" | "none";
20
+ export type SelectionState = "checked" | "unchecked" | "indeterminate";
21
+ /**
22
+ * Options for the horizontal alignment of the column content.
23
+ */
24
+ export type HorizontalAlignOptions = "left" | "middle" | "right";
25
+ /**
26
+ * Options for the action type of the column.
27
+ */
28
+ export type ActionTypes = "select" | "edit" | "delete";
29
+ /**
30
+ * Structure to map custom fields for rendering. This is used to identofy the attributes for various purposes.
31
+ */
32
+ export type FieldMapping = {
33
+ /**
34
+ * Unique id for the item
35
+ */
36
+ id?: string | undefined;
37
+ /**
38
+ * the text to render
39
+ */
40
+ text?: string | undefined;
41
+ /**
42
+ * the value associated with the item
43
+ */
44
+ value?: string | undefined;
45
+ /**
46
+ * a URL
47
+ */
48
+ url?: string | undefined;
49
+ /**
50
+ * icon to render
51
+ */
52
+ icon?: string | undefined;
53
+ /**
54
+ * the image to render
55
+ */
56
+ image?: string | undefined;
57
+ /**
58
+ * children of the item
59
+ */
60
+ children?: string | undefined;
61
+ /**
62
+ * summary of the item
63
+ */
64
+ summary?: string | undefined;
65
+ /**
66
+ * notes for the item
67
+ */
68
+ notes?: string | undefined;
69
+ /**
70
+ * additional properties
71
+ */
72
+ props?: string | undefined;
73
+ /**
74
+ * item is open or closed
75
+ */
76
+ isOpen?: string | undefined;
77
+ /**
78
+ * level of item
79
+ */
80
+ level?: string | undefined;
81
+ /**
82
+ * item is a parent
83
+ */
84
+ parent?: string | undefined;
85
+ /**
86
+ * {string} [isDeleted='_deleted'] item is deleted
87
+ */
88
+ currency?: string | undefined;
89
+ /**
90
+ * Field mapping to be used on children in the next level
91
+ */
92
+ fields?: FieldMapping | undefined;
93
+ };
94
+ /**
95
+ * Column metadata for the table.
96
+ */
97
+ export type ColumnMetadata = {
98
+ /**
99
+ * - The name of the column.
100
+ */
101
+ name: string;
102
+ /**
103
+ * - The data type of the column (e.g., "string", "number", "date").
104
+ */
105
+ dataType: string;
106
+ /**
107
+ * - Additional attributes for the column.
108
+ */
109
+ fields?: FieldMapping | undefined;
110
+ /**
111
+ * - The number of digits for numeric values (defaults to 0).
112
+ */
113
+ digits?: number | undefined;
114
+ /**
115
+ * - A function to format the column value.
116
+ */
117
+ formatter: Function;
118
+ /**
119
+ * - Indicates if the column is virtual (true/false).
120
+ */
121
+ virtual?: boolean | undefined;
122
+ /**
123
+ * - Indicates if the column is sortable (true/false).
124
+ */
125
+ sortable?: boolean | undefined;
126
+ /**
127
+ * - The sort order of the column.
128
+ */
129
+ sortOrder?: SortOptions | undefined;
130
+ /**
131
+ * - The alignment of the column content.
132
+ */
133
+ align?: HorizontalAlignOptions | undefined;
134
+ /**
135
+ * - Action attribute for action columns.
136
+ */
137
+ action?: ActionTypes | undefined;
138
+ };
139
+ /**
140
+ * Track the state of a row in the table.
141
+ */
142
+ export type RowState = {
143
+ /**
144
+ * - The index of the node in the flat list.
145
+ */
146
+ index: number;
147
+ /**
148
+ * - The depth of the node in the hierarchy.
149
+ */
150
+ depth: number;
151
+ /**
152
+ * - The value of the hierarchy node.
153
+ */
154
+ value?: string | undefined;
155
+ /**
156
+ * - Indicates whether the node is visible (true/false).
157
+ */
158
+ isHidden?: boolean | undefined;
159
+ /**
160
+ * - Indicates if this node is a parent (true/false).
161
+ */
162
+ isParent?: boolean | undefined;
163
+ /**
164
+ * - Indicates whether the node is expanded (true/false).
165
+ */
166
+ isExpanded?: boolean | undefined;
167
+ /**
168
+ * - The index of the parent node in the flat list.
169
+ */
170
+ parentIndex?: number | undefined;
171
+ /**
172
+ * - Indicates whether the node is selected (true/false/indeterminate).
173
+ */
174
+ selected?: SelectionState | undefined;
175
+ /**
176
+ * - The indices of the children in the flat list.
177
+ */
178
+ childred: Array<number>;
179
+ };
180
+ /**
181
+ * Track the state of all rows in the table.
182
+ */
183
+ export type RowStateMap = {
184
+ /**
185
+ * - Flat list of hierarchy nodes.
186
+ */
187
+ rows: RowState[];
188
+ };
189
+ /**
190
+ * Shade mapping for color variables
191
+ */
192
+ export type ShadeMapping = {
193
+ /**
194
+ * - the variable name to be used
195
+ */
196
+ key: string;
197
+ /**
198
+ * - the value to be used
199
+ */
200
+ value: string;
201
+ /**
202
+ * - light or dark mode
203
+ */
204
+ mode: string;
205
+ };
206
+ export type TickMark = {
207
+ /**
208
+ * - The value of the tick mark.
209
+ */
210
+ value: number;
211
+ /**
212
+ * - The label for the tick mark.
213
+ */
214
+ label: string;
215
+ /**
216
+ * - Indicates if the tick mark is a major tick.
217
+ */
218
+ major: boolean;
219
+ };
220
+ export type CalendarDay = {
221
+ /**
222
+ * - The day of the month.
223
+ */
224
+ day: number;
225
+ /**
226
+ * - indicates the offset for positioning
227
+ */
228
+ offset: number;
229
+ /**
230
+ * - Datevalue for the day.
231
+ */
232
+ date: date;
233
+ /**
234
+ * - formatted text for the day.
235
+ */
236
+ text: string;
237
+ /**
238
+ * - Indicates if the day is a holiday.
239
+ */
240
+ holiday: boolean;
241
+ /**
242
+ * - Indicates if the day is on the weekend.
243
+ */
244
+ weekend: boolean;
245
+ };
246
+ export type ColorPalette = {
247
+ /**
248
+ * 50 - The color for the 50 shade.
249
+ */
250
+ "": string;
251
+ };
252
+ export type ColorCollection = {
253
+ [x: string]: ColorPalette;
254
+ };
255
+ export type ColorMapping = {
256
+ /**
257
+ * - The primary color.
258
+ */
259
+ primary?: string | undefined;
260
+ /**
261
+ * - The secondary color.
262
+ */
263
+ secondary?: string | undefined;
264
+ /**
265
+ * - The tertiary color.
266
+ */
267
+ tertiary?: string | undefined;
268
+ /**
269
+ * - The surface color.
270
+ */
271
+ surface?: string | undefined;
272
+ /**
273
+ * - The info color.
274
+ */
275
+ info?: string | undefined;
276
+ /**
277
+ * - The success color.
278
+ */
279
+ success?: string | undefined;
280
+ /**
281
+ * - The warning color.
282
+ */
283
+ warning?: string | undefined;
284
+ /**
285
+ * - The error color.
286
+ */
287
+ error?: string | undefined;
288
+ };
289
+ export type ColorSpace = "rgb" | "hsl" | "oklch";
290
+ export type ColorTheme = {
291
+ /**
292
+ * - The color mapping.
293
+ */
294
+ mapping?: ColorMapping | undefined;
295
+ /**
296
+ * - The color collection.
297
+ */
298
+ colors?: {
299
+ [x: string]: ColorPalette;
300
+ } | undefined;
301
+ /**
302
+ * - Color space for CSS variable values ('rgb', 'hsl', or 'oklch').
303
+ */
304
+ colorSpace?: ColorSpace | undefined;
305
+ };
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Detects text direction based on HTML lang attribute
3
+ * @returns {'ltr' | 'rtl'}
4
+ */
5
+ export function detectDirection(): "ltr" | "rtl";
6
+ /**
7
+ * Checks if current document direction is RTL
8
+ * @returns {boolean}
9
+ */
10
+ export function isRTL(): boolean;
11
+ /**
12
+ * Finds the closest ancestor of the given element that has the given attribute.
13
+ *
14
+ * @param {HTMLElement} element
15
+ * @param {string} attribute
16
+ * @returns {HTMLElement|null}
17
+ */
18
+ export function getClosestAncestorWithAttribute(element: HTMLElement, attribute: string): HTMLElement | null;
19
+ /**
20
+ * A function that performs no operations.
21
+ */
22
+ export function noop(): void;
23
+ /**
24
+ * Generates a random id
25
+ *
26
+ * @returns {string} A random id
27
+ */
28
+ export function id(prefix?: string): string;
29
+ /**
30
+ * Check if a value is a json object
31
+ *
32
+ * @param {*} val
33
+ * @returns {boolean}
34
+ */
35
+ export function isObject(val: any): boolean;
36
+ /**
37
+ * Converts the value to a string. If the value is an object, it will convert it to a JSON string.
38
+ *
39
+ * @param {*} value
40
+ * @returns {string}
41
+ */
42
+ export function toString(value: any): string;
43
+ /**
44
+ * Generates icon shortcuts for a collection of icons
45
+ *
46
+ * @param {string[]} icons
47
+ * @param {string} collection
48
+ * @param {string} variants
49
+ * @returns {Object}
50
+ */
51
+ export function iconShortcuts(icons: string[], collection: string, variants: string): Object;
52
+ /**
53
+ * Scales the path by the size
54
+ *
55
+ * @param {number} size
56
+ * @param {string|number} x
57
+ * @returns {string|number}
58
+ */
59
+ export function scaledPath(size: number, x: string | number): string | number;
60
+ /**
61
+ * Gets a key string from path
62
+ * @param {string[]} path
63
+ * @returns {string}
64
+ */
65
+ export function getKeyFromPath(path: string[]): string;
66
+ /**
67
+ * Gets a path array from key string
68
+ * @param {string} key
69
+ * @returns {string[]}
70
+ */
71
+ export function getPathFromKey(key: string): string[];
72
+ /**
73
+ * Get snippet function from an object
74
+ * @param {Object} obj
75
+ * @param {string} key
76
+ * @param {null|Function} defaultSnippet
77
+ * @returns {Function|undefined}
78
+ */
79
+ export function getSnippet(obj: Object, key: string, defaultSnippet?: null | Function): Function | undefined;
80
+ export function resolveSnippet(snippets: any, proxy: any, fallback?: string): Function | null;
81
+ /**
82
+ * convert hex string to `{r},{g},{b}`
83
+ * @param {string} hex
84
+ * @return {string}
85
+ */
86
+ export function hex2rgb(hex: string): string;
87
+ /**
88
+ * Convert hex string to OKLCH components: `{L} {C} {H}`
89
+ * Uses CSS Color Level 4 two-step conversion via XYZ D65 for precision.
90
+ * @param {string} hex - 6-digit hex color (with or without #)
91
+ * @returns {string} space-separated OKLCH components for CSS `oklch(L C H / alpha)`
92
+ */
93
+ export function hex2oklch(hex: string): string;
94
+ /**
95
+ * Convert OKLCH components back to hex string.
96
+ * Uses CSS Color Level 4 two-step conversion via XYZ D65 for precision.
97
+ * @param {number} L - Lightness 0-1
98
+ * @param {number} C - Chroma >= 0
99
+ * @param {number} H - Hue 0-360 degrees
100
+ * @returns {string} hex color string (#rrggbb)
101
+ */
102
+ export function oklch2hex(L: number, C: number, H: number): string;
103
+ /**
104
+ * Convert hex string to HSL components: `{H} {S}% {L}%`
105
+ * @param {string} hex - 6-digit hex color (with or without #)
106
+ * @returns {string} space-separated HSL components for CSS `hsl(H S% L% / alpha)`
107
+ */
108
+ export function hex2hsl(hex: string): string;
109
+ /** @typedef {'rgb' | 'hsl' | 'oklch'} ColorSpace */
110
+ /**
111
+ * Convert a hex color to the component format for a given color space.
112
+ * - rgb: "r,g,b" → for `rgba(var(--x), alpha)`
113
+ * - hsl: "H S% L%" → for `hsl(var(--x) / alpha)`
114
+ * - oklch: "L C H" → for `oklch(var(--x) / alpha)`
115
+ *
116
+ * @param {string} hex - 6-digit hex color (#rrggbb)
117
+ * @param {ColorSpace} space
118
+ * @returns {string}
119
+ */
120
+ export function hexToComponents(hex: string, space: ColorSpace): string;
121
+ /**
122
+ * Convert a CSS color value to components for use in CSS variables.
123
+ *
124
+ * - Hex (#rrggbb): converted to space-appropriate components via hexToComponents.
125
+ * - oklch(...) strings: inner components extracted (e.g. "0.58 0.15 35") so the
126
+ * value is compatible with the oklch(var(--x) / alpha) wrapper pattern.
127
+ * - All other formats: returned as-is (no opacity-modifier support).
128
+ *
129
+ * @param {unknown} value
130
+ * @param {ColorSpace} [space]
131
+ * @returns {unknown}
132
+ */
133
+ export function colorToRgb(value: unknown, space?: ColorSpace): unknown;
134
+ /**
135
+ * Detects whether an icon value is a CSS class (i-*) or literal text (kanji, emoji, etc.)
136
+ * @param {string | null | undefined} icon
137
+ * @returns {boolean} true if icon is a CSS class string
138
+ */
139
+ export function isIconClass(icon: string | null | undefined): boolean;
140
+ /**
141
+ * A utility function that detects if a string is an image URL or image data (base64)
142
+ *
143
+ * @param {string} str - The string to check
144
+ * @returns {string|null} - Returns the original string if it's an image URL or image data, otherwise null
145
+ */
146
+ export function getImage(str: string): string | null;
147
+ export type ColorSpace = "rgb" | "hsl" | "oklch";
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Creates icon collection loaders for UnoCSS presetIcons from a simple config.
3
+ *
4
+ * This function transforms a map of collection names to JSON package paths
5
+ * into the format expected by UnoCSS's presetIcons.
6
+ *
7
+ * Supports three types of paths:
8
+ * - Package paths (e.g., '@rokkit/icons/ui.json') - resolved via require
9
+ * - Absolute paths (e.g., '/path/to/icons.json') - used directly
10
+ * - Relative paths (e.g., './static/icons.json') - resolved from process.cwd()
11
+ *
12
+ * @example
13
+ * // uno.config.js
14
+ * import { iconCollections } from '@rokkit/core/vite'
15
+ *
16
+ * export default defineConfig({
17
+ * presets: [
18
+ * presetIcons({
19
+ * collections: iconCollections({
20
+ * rokkit: '@rokkit/icons/ui.json',
21
+ * logo: '@rokkit/icons/auth.json',
22
+ * solar: '@iconify-json/solar/icons.json',
23
+ * custom: './static/icons/custom.json'
24
+ * })
25
+ * })
26
+ * ]
27
+ * })
28
+ *
29
+ * @param {Record<string, string>} config - Map of collection alias to JSON path
30
+ * @returns {Record<string, () => any>} Collections object for presetIcons
31
+ */
32
+ export function iconCollections(config: Record<string, string>): Record<string, () => any>;
@@ -0,0 +1 @@
1
+ export { iconCollections } from "./icon-collections.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/core",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Contains core utility functions and classes that can be used in various components.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,6 +46,6 @@
46
46
  "ramda": "^0.32.0"
47
47
  },
48
48
  "devDependencies": {
49
- "@rokkit/icons": "1.0.2"
49
+ "@rokkit/icons": "1.0.4"
50
50
  }
51
51
  }
@@ -10,6 +10,7 @@ export const defaultPalette = [
10
10
  'surface',
11
11
  'primary',
12
12
  'secondary',
13
+ 'tertiary',
13
14
  'accent',
14
15
  'success',
15
16
  'warning',
package/src/constants.js CHANGED
@@ -156,6 +156,7 @@ export const DEFAULT_THEME_MAPPING = {
156
156
  surface: 'slate',
157
157
  primary: 'orange',
158
158
  secondary: 'pink',
159
+ tertiary: 'violet',
159
160
  accent: 'sky',
160
161
  success: 'green',
161
162
  warning: 'yellow',
package/src/theme.ts CHANGED
@@ -7,9 +7,21 @@ import { colorToRgb } from './utils'
7
7
  const modifiers = {
8
8
  hsl: (value) => `hsl(${value} / <alpha-value>)`,
9
9
  rgb: (value) => `rgb(${value} / <alpha-value>)`,
10
+ oklch: (value) => `oklch(${value} / <alpha-value>)`,
10
11
  none: (value) => value
11
12
  }
12
13
 
14
+ /**
15
+ * CSS function wrappers for each color space, used by mapVariant().
16
+ * rgb uses legacy rgba() comma syntax for broad compatibility.
17
+ * hsl/oklch use modern space-separated syntax with / for alpha.
18
+ */
19
+ const COLOR_SPACE_WRAPPERS = {
20
+ rgb: (varRef) => `rgba(${varRef},<alpha-value>)`,
21
+ hsl: (varRef) => `hsl(${varRef} / <alpha-value>)`,
22
+ oklch: (varRef) => `oklch(${varRef} / <alpha-value>)`
23
+ }
24
+
13
25
  /**
14
26
  * Generate shades for a color using css varuable
15
27
  *
@@ -37,13 +49,14 @@ export function shadesOf(name, modifier = 'none') {
37
49
  * @param {string} variant - The name of the variant to generate rules for.
38
50
  * @param {Object} colors - The object containing color definitions.
39
51
  * @param {Object} mapping - An object that maps variant names to color property names.
52
+ * @param {import('./utils').ColorSpace} [colorSpace] - Color space for component format.
40
53
  * @returns {import('./types').ShadeMappings} An array containing the color rules for both light and dark modes.
41
54
  */
42
- function generateColorRules(variant, colors, mapping) {
55
+ function generateColorRules(variant, colors, mapping, colorSpace) {
43
56
  return ['DEFAULT', ...shades].flatMap((shade) => [
44
57
  {
45
58
  key: shade === 'DEFAULT' ? `--color-${variant}` : `--color-${variant}-${shade}`,
46
- value: colorToRgb(colors[mapping[variant]][`${shade}`])
59
+ value: colorToRgb(colors[mapping[variant]][`${shade}`], colorSpace)
47
60
  }
48
61
  ])
49
62
  }
@@ -53,14 +66,15 @@ function generateColorRules(variant, colors, mapping) {
53
66
  *
54
67
  * @param {Object} [mapping=DEFAULT_THEME_MAPPING] - An object mapping variant names to color property names.
55
68
  * @param {Object} [colors=defaultColors] - The object containing default color definitions.
69
+ * @param {import('./utils').ColorSpace} [colorSpace] - Color space for CSS variable values.
56
70
  * @returns {Array<Array>} An array containing two arrays, one for the light theme variant and another for the dark theme.
57
71
  */
58
- export function themeRules(mapping = DEFAULT_THEME_MAPPING, colors = defaultColors) {
72
+ export function themeRules(mapping = DEFAULT_THEME_MAPPING, colors = defaultColors, colorSpace) {
59
73
  mapping = { ...DEFAULT_THEME_MAPPING, ...mapping }
60
74
  colors = { ...defaultColors, ...colors }
61
75
  const variants = Object.keys(mapping)
62
76
  const rules = variants
63
- .flatMap((variant) => generateColorRules(variant, colors, mapping))
77
+ .flatMap((variant) => generateColorRules(variant, colors, mapping, colorSpace))
64
78
  .reduce((acc, { key, value }) => ({ ...acc, [key]: value }), {})
65
79
 
66
80
  return rules
@@ -144,20 +158,48 @@ export function contrastShortcuts(name) {
144
158
  ]
145
159
  }
146
160
 
161
+ /**
162
+ * Fallback chain for nullable color mappings.
163
+ * If a semantic color is null, it inherits from another semantic color.
164
+ */
165
+ const COLOR_FALLBACKS = {
166
+ tertiary: 'primary',
167
+ secondary: 'primary',
168
+ accent: 'primary',
169
+ error: 'danger'
170
+ }
171
+
172
+ /**
173
+ * Resolves null values in a color mapping by following the fallback chain.
174
+ * @param {Record<string, string | null>} mapping
175
+ * @returns {Record<string, string>}
176
+ */
177
+ function resolveColors(mapping) {
178
+ const resolved = { ...mapping }
179
+ for (const [key, fallbackKey] of Object.entries(COLOR_FALLBACKS)) {
180
+ if (resolved[key] === null || resolved[key] === undefined) {
181
+ resolved[key] = resolved[fallbackKey] ?? DEFAULT_THEME_MAPPING[fallbackKey]
182
+ }
183
+ }
184
+ return resolved
185
+ }
186
+
147
187
  /**
148
188
  * Theme class for managing color palettes, mappings, and semantic shortcuts.
149
189
  */
150
190
  export class Theme {
151
191
  #colors
152
192
  #mapping
193
+ #colorSpace
153
194
 
154
195
  /**
155
196
  *
156
- * @param {import('./types.js').ColorTheme} param0
197
+ * @param {import('./types.js').ColorTheme & { colorSpace?: import('./utils').ColorSpace }} param0
157
198
  */
158
- constructor({ colors = defaultColors, mapping = DEFAULT_THEME_MAPPING } = {}) {
199
+ constructor({ colors = defaultColors, mapping = DEFAULT_THEME_MAPPING, colorSpace = 'rgb' } = {}) {
159
200
  this.#colors = { ...defaultColors, ...colors }
160
- this.#mapping = { ...DEFAULT_THEME_MAPPING, ...mapping }
201
+ this.#mapping = resolveColors({ ...DEFAULT_THEME_MAPPING, ...mapping })
202
+ this.#colorSpace = colorSpace
161
203
  }
162
204
 
163
205
  get colors() {
@@ -171,17 +213,25 @@ export class Theme {
171
213
  return this.#mapping
172
214
  }
173
215
  set mapping(mapping) {
174
- this.#mapping = { ...mapping }
216
+ this.#mapping = resolveColors({ ...mapping })
217
+ }
218
+
219
+ get colorSpace() {
220
+ return this.#colorSpace
221
+ }
222
+ set colorSpace(colorSpace) {
223
+ this.#colorSpace = colorSpace
175
224
  }
176
225
 
177
226
  mapVariant(color, variant) {
227
+ const wrap = COLOR_SPACE_WRAPPERS[this.#colorSpace] || COLOR_SPACE_WRAPPERS.rgb
178
228
  return Object.keys(color).reduce(
179
229
  (acc, key) => ({
180
230
  ...acc,
181
231
  [key]:
182
232
  key === 'DEFAULT'
183
- ? `rgba(var(--color-${variant}),<alpha-value>)`
184
- : `rgba(var(--color-${variant}-${key}),<alpha-value>)`
233
+ ? wrap(`var(--color-${variant})`)
234
+ : wrap(`var(--color-${variant}-${key})`)
185
235
  }),
186
236
  {}
187
237
  )
@@ -203,7 +253,7 @@ export class Theme {
203
253
  const useColors = { ...defaultColors, ...this.#colors }
204
254
  const variants = Object.keys(useMapping)
205
255
  const rules = variants
206
- .flatMap((variant) => generateColorRules(variant, useColors, useMapping))
256
+ .flatMap((variant) => generateColorRules(variant, useColors, useMapping, this.#colorSpace))
207
257
  .reduce((acc, { key, value }) => ({ ...acc, [key]: value }), {})
208
258
  return rules
209
259
  }
package/src/types.js CHANGED
@@ -152,9 +152,14 @@
152
152
  * @property {string} [error] - The error color.
153
153
  */
154
154
 
155
+ /**
156
+ * @typedef {'rgb' | 'hsl' | 'oklch'} ColorSpace
157
+ */
158
+
155
159
  /**
156
160
  * @typedef {Object} ColorTheme
157
161
  * @property {ColorMapping} [mapping] - The color mapping.
158
162
  * @property {ColorCollection} [colors] - The color collection.
163
+ * @property {ColorSpace} [colorSpace] - Color space for CSS variable values ('rgb', 'hsl', or 'oklch').
159
164
  */
160
165
  export default {}