sinwan-ui-core 1.5.0 → 1.6.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,29 @@
2
2
 
3
3
  All notable changes to this package are documented in this file. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package uses [Semantic Versioning](https://semver.org/).
4
4
 
5
+ ## [1.6.0]
6
+
7
+ ### Added
8
+
9
+ - **Custom palettes, discovered from your stylesheet.** Write a palette in the same structure as the built-in ones (`html[data-palette="ocean"]` for light, `html[data-palette="ocean"].dark` for dark, and `html[data-palette="ocean"]:not(.light)` inside `@media (prefers-color-scheme: dark)`) in your `global.css`, then use it like a built-in: `<ThemeProvider defaultPalette="ocean">`, `forcedPalette="ocean"` or `setPalette("ocean")`. When `palettes` is omitted, `ThemeProvider` scans the page's stylesheets (inside `@media`, `@supports`, `@layer` and `@import` too, quoted or minified selectors) and lists every palette they define in `useTheme().palettes`, `carzow` first. It scans again on mount, when `setPalette` gets an unknown name, and on `refreshPalettes()`, so CSS that loads late still counts and a saved custom palette is restored. A palette under `:not(...)` is not counted. Cross-origin stylesheets cannot be read: pass `palettes` explicitly for those. When no stylesheet defines a palette (no DOM, tests), the list is the four built-ins, as before.
10
+ - `discoverPalettes(document?)`, `BUILT_IN_PALETTES`, the `BuiltInPalette` type and `ThemeApi.refreshPalettes()`.
11
+
12
+ ### Changed
13
+
14
+ - `Palette` is now `BuiltInPalette | string`: any palette name type-checks, and the built-in names still autocomplete. `setPalette` still ignores a name that is not in the allowed list.
15
+ - **Breaking:** `ThemeApi.palettes` is a `Signal<Palette[]>` (like `palette` and `theme`), so a palette picker updates when new palettes are found. Read `palettes.value` instead of `palettes`. No alias is kept because sinwan-ui has no consumers outside the registry yet.
16
+ - An explicit `palettes` list is used as given and skips discovery, as before. `palettes={[]}` now means "discover", which falls back to the built-ins as before when nothing is found.
17
+
18
+ ### Fixed
19
+
20
+ - The source of `src/internal/controlled.ts` (SW202 guard, 1.5.1) typechecks without Node or Bun types: it declares the `process.env.NODE_ENV` it reads. Builds are unchanged.
21
+
22
+ ## [1.5.1]
23
+
24
+ ### Fixed
25
+
26
+ - **The SW202 warning no longer ships in production bundles.** sinwan-ui-core is one bundle, and Bun inlined this package's own `process.env.NODE_ENV` while building `dist/`, so the SW202 check and its message stayed in every app's production bundle (it never printed, because `devWarn` is a no-op in sinwan's production build). The check is now guarded by `process.env.NODE_ENV !== "production"`, and `build.ts` leaves that expression in `dist/` for the app's bundler to replace (Bun by default, Vite for dependencies). A production build now drops the check, its message and the value read it needed; a development build keeps the warning.
27
+
5
28
  ## [1.5.0]
6
29
 
7
30
  ### Added
package/README.md CHANGED
@@ -30,9 +30,37 @@ Import from the root barrel or from a subpath (subpaths keep bundles small):
30
30
  | `sinwan-ui-core/menu-sub` | `createMenuSubApi` (closes with its `parentOpen`), `createMenuSubTriggerHandlers`, `isInsideMenuSubContent`, `MenuSubContentLayer` for nested menus |
31
31
  | `sinwan-ui-core/slot` | `Slot` (the `asChild` prop merge) |
32
32
  | `sinwan-ui-core/types` | Intrinsic prop aliases, `isSinwanElement`, `flattenChildren` |
33
- | `sinwan-ui-core/theme` | `ThemeProvider`, `useTheme`, `ThemeToggle` (unstyled), `ThemeKey` |
33
+ | `sinwan-ui-core/theme` | `ThemeProvider`, `useTheme`, `ThemeToggle` (unstyled), `ThemeKey`, `discoverPalettes`, `BUILT_IN_PALETTES` (see [Palettes](#palettes)) |
34
34
  | `sinwan-ui-core/direction` | `DirectionProvider`, `useDirection`, `DirectionKey` |
35
35
 
36
+ ## Palettes
37
+
38
+ `ThemeProvider` writes the light/dark mode as a class (`.light`/`.dark`) and the palette as `html[data-palette]`. The registry stylesheet ships `carzow` (the `:root` default), `jomlaty`, `cazview` and `voltzig`.
39
+
40
+ To add your own, write it in your stylesheet in the same structure as the built-in ones:
41
+
42
+ ```css
43
+ html[data-palette="ocean"] { --background: …; --primary: …; /* every token */ }
44
+ html[data-palette="ocean"].dark { --background: …; --primary: …; }
45
+ @media (prefers-color-scheme: dark) {
46
+ html[data-palette="ocean"]:not(.light) { /* the .dark tokens again */ }
47
+ }
48
+ ```
49
+
50
+ Then use it by name. Nothing to register: without a `palettes` prop, `ThemeProvider` reads the page's stylesheets and allows every palette they define.
51
+
52
+ ```tsx
53
+ <ThemeProvider defaultPalette="ocean">…</ThemeProvider>
54
+
55
+ const { palette, palettes, setPalette } = useTheme();
56
+ palettes.value; // ["carzow", "jomlaty", "cazview", "voltzig", "ocean"]
57
+ setPalette("ocean");
58
+ ```
59
+
60
+ - A token the palette leaves out keeps its `carzow` value, so define every color token in both modes.
61
+ - Pass `palettes={[…]}` to allow a fixed list instead (needed for cross-origin stylesheets, whose rules the page cannot read).
62
+ - For CSS loaded after the provider mounts, `setPalette(name)` scans again for an unknown name, and `refreshPalettes()` rescans on demand.
63
+
36
64
  ## Styling contract
37
65
 
38
66
  Every primitive renders a `data-slot` and, where relevant, `data-state` (`open`/`closed`, `checked`/`unchecked`, `on`/`off`, `active`/`inactive`) and `data-side`. Style those attributes from your component layer. `Presence` keeps closing content mounted for `exitMs` (200 ms by default), so exit animations must hold their last keyframe (`animation-fill-mode: forwards`) and finish within that time.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isControlledProp,
3
3
  Presence2
4
- } from "./chunk-dn425n4g.js";
4
+ } from "./chunk-saen52f0.js";
5
5
  import {
6
6
  DirectionKey2
7
7
  } from "./chunk-f6hw8ash.js";
@@ -6,7 +6,7 @@ import {
6
6
  Presence2,
7
7
  UiPortal2,
8
8
  trapFocus2
9
- } from "./chunk-dn425n4g.js";
9
+ } from "./chunk-saen52f0.js";
10
10
  import {
11
11
  useAnchorPosition2
12
12
  } from "./chunk-6r59k5mb.js";
@@ -18,7 +18,56 @@ var _$tmpl_0 = {
18
18
  { path: [], type: "child" }
19
19
  ]
20
20
  };
21
- var DEFAULT_PALETTES = ["carzow", "jomlaty", "cazview", "voltzig"];
21
+ var BUILT_IN_PALETTES2 = ["carzow", "jomlaty", "cazview", "voltzig"];
22
+ var PALETTE_ATTRIBUTE = /\[\s*data-palette\s*=\s*(?:"([^"]+)"|'([^']+)'|([^\s\]]+))\s*(?:[is]\s*)?\]/g;
23
+ var NOT_PSEUDO = /:not\([^()]*\)/g;
24
+ function isRuleList(value) {
25
+ return typeof value === "object" && value !== null && "length" in value && typeof value.length === "number";
26
+ }
27
+ function isSheet(value) {
28
+ return typeof value === "object" && value !== null && "cssRules" in value;
29
+ }
30
+ function collectPalettes(rules, found) {
31
+ for (let i = 0;i < rules.length; i++) {
32
+ const rule = rules[i];
33
+ if (!rule)
34
+ continue;
35
+ if ("selectorText" in rule && typeof rule.selectorText === "string") {
36
+ const selector = rule.selectorText.replace(NOT_PSEUDO, "");
37
+ for (const match of selector.matchAll(PALETTE_ATTRIBUTE)) {
38
+ const name = match[1] ?? match[2] ?? match[3];
39
+ if (name)
40
+ found.add(name);
41
+ }
42
+ }
43
+ const children = Reflect.get(rule, "cssRules");
44
+ if (isRuleList(children))
45
+ collectPalettes(children, found);
46
+ const imported = Reflect.get(rule, "styleSheet");
47
+ if (isSheet(imported))
48
+ collectSheet(imported, found);
49
+ }
50
+ }
51
+ function collectSheet(sheet, found) {
52
+ let rules;
53
+ try {
54
+ rules = sheet.cssRules;
55
+ } catch {
56
+ return;
57
+ }
58
+ collectPalettes(rules, found);
59
+ }
60
+ function discoverPalettes2(doc) {
61
+ const target = doc ?? (typeof document === "undefined" ? undefined : document);
62
+ if (!target)
63
+ return [];
64
+ const found = new Set;
65
+ for (const sheet of Array.from(target.styleSheets))
66
+ collectSheet(sheet, found);
67
+ if (found.size === 0)
68
+ return [];
69
+ return Array.from(new Set(["carzow", ...found]));
70
+ }
22
71
  var ThemeKey2 = Symbol("sinwan-ui.theme");
23
72
  function isTheme(value) {
24
73
  return value === "light" || value === "dark" || value === "system";
@@ -36,15 +85,14 @@ function readStoredTheme(storageKey, fallback) {
36
85
  } catch {}
37
86
  return fallback;
38
87
  }
39
- function readStoredPalette(storageKey, fallback, allowed) {
88
+ function readStoredValue(storageKey) {
40
89
  if (typeof localStorage === "undefined")
41
- return fallback;
90
+ return null;
42
91
  try {
43
- const value = localStorage.getItem(storageKey);
44
- if (isPalette(value, allowed))
45
- return value;
46
- } catch {}
47
- return fallback;
92
+ return localStorage.getItem(storageKey);
93
+ } catch {
94
+ return null;
95
+ }
48
96
  }
49
97
  function getSystemTheme() {
50
98
  if (typeof window === "undefined" || !window.matchMedia)
@@ -78,11 +126,31 @@ function writeDomPalette(next) {
78
126
  document.documentElement.setAttribute("data-palette", next);
79
127
  }
80
128
  var ThemeProvider2 = cc((props) => {
81
- const allowedPalettes = () => (props.palettes === undefined ? DEFAULT_PALETTES : props.palettes).length > 0 ? props.palettes === undefined ? DEFAULT_PALETTES : props.palettes : DEFAULT_PALETTES;
129
+ const explicitPalettes = () => (props.palettes === undefined ? [] : props.palettes).length > 0 ? props.palettes === undefined ? [] : props.palettes : null;
130
+ const listPalettes = () => {
131
+ if (explicitPalettes())
132
+ return explicitPalettes();
133
+ const discovered = discoverPalettes2();
134
+ return Array.from(new Set([
135
+ ...discovered.length > 0 ? discovered : BUILT_IN_PALETTES2,
136
+ props.defaultPalette === undefined ? "carzow" : props.defaultPalette,
137
+ ...props.forcedPalette === undefined ? [] : [props.forcedPalette]
138
+ ]));
139
+ };
140
+ const allowedPalettes = signal(listPalettes());
82
141
  const initialTheme = props.forcedTheme ?? readStoredTheme(props.storageKey === undefined ? "sinwan-ui-theme" : props.storageKey, props.defaultTheme === undefined ? "system" : props.defaultTheme);
83
- const initialPalette = props.forcedPalette ?? readStoredPalette(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, props.defaultPalette === undefined ? "carzow" : props.defaultPalette, allowedPalettes());
142
+ const storedPalette = readStoredValue(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey);
143
+ const initialPalette = props.forcedPalette ?? (isPalette(storedPalette, allowedPalettes.peek()) ? storedPalette : props.defaultPalette === undefined ? "carzow" : props.defaultPalette);
84
144
  const theme = signal(initialTheme);
85
145
  const palette = signal(initialPalette);
146
+ const refreshPalettes = () => {
147
+ const next = listPalettes();
148
+ const current = allowedPalettes.peek();
149
+ if (next.length !== current.length || next.some((name, index) => name !== current[index])) {
150
+ allowedPalettes.value = next;
151
+ }
152
+ return allowedPalettes.peek();
153
+ };
86
154
  const resolved = signal(initialTheme === "system" ? getSystemTheme() : initialTheme);
87
155
  const resolve = (value) => {
88
156
  if (props.forcedTheme === "light" || props.forcedTheme === "dark")
@@ -129,8 +197,9 @@ var ThemeProvider2 = cc((props) => {
129
197
  const setPalette = (value) => {
130
198
  if (props.forcedPalette)
131
199
  return;
132
- if (!allowedPalettes().includes(value))
200
+ if (!allowedPalettes.peek().includes(value) && !refreshPalettes().includes(value)) {
133
201
  return;
202
+ }
134
203
  try {
135
204
  localStorage.setItem(props.paletteStorageKey === undefined ? "sinwan-ui-palette" : props.paletteStorageKey, value);
136
205
  } catch {}
@@ -139,6 +208,9 @@ var ThemeProvider2 = cc((props) => {
139
208
  onMounted(() => {
140
209
  commit(theme.value);
141
210
  writeDomPalette(palette.value);
211
+ if (!props.forcedPalette && !explicitPalettes() && storedPalette !== null && storedPalette !== palette.peek() && isPalette(storedPalette, refreshPalettes())) {
212
+ commitPalette(storedPalette);
213
+ }
142
214
  if (!(props.enableSystem === undefined ? true : props.enableSystem))
143
215
  return;
144
216
  const mq = window.matchMedia("(prefers-color-scheme: dark)");
@@ -157,7 +229,8 @@ var ThemeProvider2 = cc((props) => {
157
229
  themes: (props.enableSystem === undefined ? true : props.enableSystem) ? ["light", "dark", "system"] : ["light", "dark"],
158
230
  palette,
159
231
  setPalette,
160
- palettes: allowedPalettes()
232
+ palettes: allowedPalettes,
233
+ refreshPalettes
161
234
  });
162
235
  computed(() => resolved.value);
163
236
  computed(() => palette.value);
@@ -184,4 +257,4 @@ var ThemeToggle2 = cc((props) => {
184
257
  ]);
185
258
  });
186
259
 
187
- export { ThemeKey2, ThemeProvider2, useTheme2, ThemeToggle2 };
260
+ export { BUILT_IN_PALETTES2, discoverPalettes2, ThemeKey2, ThemeProvider2, useTheme2, ThemeToggle2 };
@@ -7,7 +7,7 @@ function currentValue(props, key) {
7
7
  function isControlledProp(props, key, component) {
8
8
  if (!(key in props))
9
9
  return false;
10
- if (currentValue(props, key) === undefined) {
10
+ if (process.env.NODE_ENV !== "production" && currentValue(props, key) === undefined) {
11
11
  devWarn("SW202", `<${component}> ${key} is undefined: the control is controlled with no value and ignores input. Omit ${key}, or pass null or "" for an empty controlled value.`);
12
12
  }
13
13
  return true;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Presence2,
3
3
  UiPortal2
4
- } from "./chunk-dn425n4g.js";
4
+ } from "./chunk-saen52f0.js";
5
5
  import {
6
6
  useAnchorPosition2
7
7
  } from "./chunk-6r59k5mb.js";
package/dist/controls.js CHANGED
@@ -21,13 +21,13 @@ import {
21
21
  ToggleGroupKey2,
22
22
  ToggleGroupRoot2,
23
23
  ToggleGroupItem2
24
- } from "./chunks/chunk-n6gs6631.js";
24
+ } from "./chunks/chunk-0dsacv44.js";
25
25
  import"./chunks/chunk-f6hw8ash.js";
26
26
  import {
27
27
  Slot2
28
28
  } from "./chunks/chunk-bw9vp0y9.js";
29
29
  import"./chunks/chunk-7r6fwdyt.js";
30
- import"./chunks/chunk-dn425n4g.js";
30
+ import"./chunks/chunk-saen52f0.js";
31
31
  import"./chunks/chunk-6r59k5mb.js";
32
32
  export {
33
33
  AccordionContent2 as AccordionContent,
package/dist/core.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  useControllableState2,
8
8
  getFocusableElements2,
9
9
  trapFocus2
10
- } from "./chunks/chunk-dn425n4g.js";
10
+ } from "./chunks/chunk-saen52f0.js";
11
11
  import {
12
12
  toFloatingPlacement2,
13
13
  basePlacement2,
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  useControllableState2,
14
14
  getFocusableElements2,
15
15
  trapFocus2
16
- } from "./chunks/chunk-dn425n4g.js";
16
+ } from "./chunks/chunk-saen52f0.js";
17
17
  import {
18
18
  toFloatingPlacement2,
19
19
  basePlacement2,
@@ -53,7 +53,7 @@ import {
53
53
  ToggleGroupKey2,
54
54
  ToggleGroupRoot2,
55
55
  ToggleGroupItem2
56
- } from "./chunks/chunk-n6gs6631.js";
56
+ } from "./chunks/chunk-0dsacv44.js";
57
57
  import {
58
58
  isDismissExemptPointerTarget2
59
59
  } from "./chunks/chunk-9whagkb6.js";
@@ -62,7 +62,7 @@ import {
62
62
  createMenuSubTriggerHandlers2,
63
63
  isInsideMenuSubContent2,
64
64
  MenuSubContentLayer2
65
- } from "./chunks/chunk-vwgz1k38.js";
65
+ } from "./chunks/chunk-zmvg5gy1.js";
66
66
  import {
67
67
  DialogKey2,
68
68
  DialogLabelsKey2,
@@ -86,13 +86,15 @@ import {
86
86
  TooltipRoot2,
87
87
  TooltipTrigger2,
88
88
  TooltipContent2
89
- } from "./chunks/chunk-hzq68qq0.js";
89
+ } from "./chunks/chunk-6bm550r5.js";
90
90
  import {
91
+ BUILT_IN_PALETTES2,
92
+ discoverPalettes2,
91
93
  ThemeKey2,
92
94
  ThemeProvider2,
93
95
  useTheme2,
94
96
  ThemeToggle2
95
- } from "./chunks/chunk-16d43dkc.js";
97
+ } from "./chunks/chunk-assqp8wg.js";
96
98
  export {
97
99
  AccordionContent2 as AccordionContent,
98
100
  AccordionItem2 as AccordionItem,
@@ -100,6 +102,7 @@ export {
100
102
  AccordionKey2 as AccordionKey,
101
103
  AccordionRoot2 as AccordionRoot,
102
104
  AccordionTrigger2 as AccordionTrigger,
105
+ BUILT_IN_PALETTES2 as BUILT_IN_PALETTES,
103
106
  CheckboxRoot2 as CheckboxRoot,
104
107
  CollapsibleContent2 as CollapsibleContent,
105
108
  CollapsibleKey2 as CollapsibleKey,
@@ -154,6 +157,7 @@ export {
154
157
  createPointReference2 as createPointReference,
155
158
  createRectReference2 as createRectReference,
156
159
  createSizeFloating2 as createSizeFloating,
160
+ discoverPalettes2 as discoverPalettes,
157
161
  estimatePosition2 as estimatePosition,
158
162
  flattenChildren2 as flattenChildren,
159
163
  getFocusableElements2 as getFocusableElements,
@@ -2,5 +2,10 @@
2
2
  * Whether a control is controlled through `key`: the prop is present, even
3
3
  * when its value is `undefined`. In development, a present prop that is
4
4
  * `undefined` warns (SW202): the control would ignore input.
5
+ *
6
+ * sinwan-ui-core ships one bundle, so the check is guarded by
7
+ * `process.env.NODE_ENV`, which `build.ts` leaves as is in `dist/`. The app's
8
+ * bundler replaces it (Bun by default, Vite for dependencies): a production
9
+ * build drops the check and its message; a development build keeps them.
5
10
  */
6
11
  export declare function isControlledProp(props: object, key: string, component: string): boolean;
package/dist/menu-sub.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  createMenuSubTriggerHandlers2,
4
4
  isInsideMenuSubContent2,
5
5
  MenuSubContentLayer2
6
- } from "./chunks/chunk-vwgz1k38.js";
7
- import"./chunks/chunk-dn425n4g.js";
6
+ } from "./chunks/chunk-zmvg5gy1.js";
7
+ import"./chunks/chunk-saen52f0.js";
8
8
  import"./chunks/chunk-6r59k5mb.js";
9
9
  export {
10
10
  MenuSubContentLayer2 as MenuSubContentLayer,
package/dist/overlay.js CHANGED
@@ -21,11 +21,11 @@ import {
21
21
  TooltipRoot2,
22
22
  TooltipTrigger2,
23
23
  TooltipContent2
24
- } from "./chunks/chunk-hzq68qq0.js";
24
+ } from "./chunks/chunk-6bm550r5.js";
25
25
  import"./chunks/chunk-bw9vp0y9.js";
26
26
  import"./chunks/chunk-7r6fwdyt.js";
27
27
  import"./chunks/chunk-9whagkb6.js";
28
- import"./chunks/chunk-dn425n4g.js";
28
+ import"./chunks/chunk-saen52f0.js";
29
29
  import"./chunks/chunk-6r59k5mb.js";
30
30
  export {
31
31
  CollapsibleContent2 as CollapsibleContent,
package/dist/theme.d.ts CHANGED
@@ -2,7 +2,22 @@ import { type InjectionKey, type SinwanNode } from "sinwan/component";
2
2
  import { type Signal } from "sinwan/reactivity";
3
3
  export type Theme = "light" | "dark" | "system";
4
4
  export type ResolvedTheme = "light" | "dark";
5
- export type Palette = "carzow" | "jomlaty" | "cazview" | "voltzig";
5
+ /** The palettes the sinwan-ui stylesheet ships. `carzow` is the `:root` default. */
6
+ export type BuiltInPalette = "carzow" | "jomlaty" | "cazview" | "voltzig";
7
+ /**
8
+ * A built-in palette, or a custom one: any name the app's stylesheet defines
9
+ * as `html[data-palette="name"]`. Built-in names keep their autocompletion.
10
+ */
11
+ export type Palette = BuiltInPalette | (string & Record<never, never>);
12
+ export declare const BUILT_IN_PALETTES: readonly BuiltInPalette[];
13
+ /**
14
+ * The palettes the page's stylesheets define, in stylesheet order: every
15
+ * `html[data-palette="name"]` selector names one, inside `@media`, `@supports`,
16
+ * `@layer` and `@import` too. `carzow` comes first when any is found, since
17
+ * the stylesheet's `:root` tokens are that palette. Empty when no stylesheet
18
+ * defines a palette (no DOM, CSS not loaded yet, or cross-origin CSS).
19
+ */
20
+ export declare function discoverPalettes(doc?: Document): Palette[];
6
21
  export type ThemeApi = {
7
22
  theme: Signal<Theme>;
8
23
  resolved: Signal<ResolvedTheme>;
@@ -10,7 +25,14 @@ export type ThemeApi = {
10
25
  themes: Theme[];
11
26
  palette: Signal<Palette>;
12
27
  setPalette: (palette: Palette) => void;
13
- palettes: Palette[];
28
+ /**
29
+ * The palettes `setPalette` accepts: the `palettes` prop, or the ones the
30
+ * stylesheets define (see `discoverPalettes`). A signal, so a palette
31
+ * picker follows `refreshPalettes`.
32
+ */
33
+ palettes: Signal<Palette[]>;
34
+ /** Scans the stylesheets again, for CSS loaded after the provider mounted. */
35
+ refreshPalettes: () => Palette[];
14
36
  };
15
37
  export declare const ThemeKey: InjectionKey<ThemeApi>;
16
38
  export type ThemeProviderProps = {
@@ -21,6 +43,11 @@ export type ThemeProviderProps = {
21
43
  defaultPalette?: Palette;
22
44
  forcedPalette?: Palette;
23
45
  paletteStorageKey?: string;
46
+ /**
47
+ * The palettes to allow. Omit it (or pass `[]`) to discover them from the
48
+ * stylesheets: a custom `html[data-palette="name"]` block in the app's CSS
49
+ * is then a palette like the built-in ones.
50
+ */
24
51
  palettes?: Palette[];
25
52
  disableTransitionOnChange?: boolean;
26
53
  enableSystem?: boolean;
package/dist/theme.js CHANGED
@@ -1,12 +1,16 @@
1
1
  import {
2
+ BUILT_IN_PALETTES2,
3
+ discoverPalettes2,
2
4
  ThemeKey2,
3
5
  ThemeProvider2,
4
6
  useTheme2,
5
7
  ThemeToggle2
6
- } from "./chunks/chunk-16d43dkc.js";
8
+ } from "./chunks/chunk-assqp8wg.js";
7
9
  export {
10
+ BUILT_IN_PALETTES2 as BUILT_IN_PALETTES,
8
11
  ThemeKey2 as ThemeKey,
9
12
  ThemeProvider2 as ThemeProvider,
10
13
  ThemeToggle2 as ThemeToggle,
14
+ discoverPalettes2 as discoverPalettes,
11
15
  useTheme2 as useTheme
12
16
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sinwan-ui-core",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "Headless behaviour primitives for Sinwan UI components: overlays, floating positioning, dismiss layers, controls, slots, theme and direction.",
5
5
  "author": "Mohammed Ben Cheikh",
6
6
  "license": "MIT",