@sigx/lynx-daisyui 0.4.1 → 0.4.2

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,185 @@
1
+ // Shared status palette — identical across the original built-ins, hoisted to
2
+ // avoid repetition. (Themes are free to override any of these.)
3
+ const STATUS_LIGHT = {
4
+ 'info': '#00b4fa', 'info-content': '#000000',
5
+ 'success': '#00a96e', 'success-content': '#000000',
6
+ 'warning': '#ffc100', 'warning-content': '#000000',
7
+ 'error': '#ff676a', 'error-content': '#000000',
8
+ };
9
+ const registry = [
10
+ {
11
+ name: 'daisy-light', variant: 'light', pair: 'daisy-dark',
12
+ colors: {
13
+ 'primary': '#491dff', 'primary-content': '#d3dbff',
14
+ 'secondary': '#ff20cc', 'secondary-content': '#fff8fc',
15
+ 'accent': '#00cfbd', 'accent-content': '#00100d',
16
+ 'neutral': '#2b3440', 'neutral-content': '#d7dde4',
17
+ 'base-100': '#ffffff', 'base-200': '#f2f2f2', 'base-300': '#e5e6e6',
18
+ 'base-content': '#1f2937',
19
+ ...STATUS_LIGHT,
20
+ },
21
+ },
22
+ {
23
+ name: 'daisy-cupcake', variant: 'light', pair: 'daisy-synthwave',
24
+ colors: {
25
+ 'primary': '#65c3c8', 'primary-content': '#052124',
26
+ 'secondary': '#ef9fbc', 'secondary-content': '#2d0a16',
27
+ 'accent': '#eeaf3a', 'accent-content': '#2d1c00',
28
+ 'neutral': '#291334', 'neutral-content': '#f5f1f8',
29
+ 'base-100': '#faf7f5', 'base-200': '#efeae6', 'base-300': '#e7e2df',
30
+ 'base-content': '#291334',
31
+ ...STATUS_LIGHT,
32
+ },
33
+ },
34
+ {
35
+ name: 'daisy-emerald', variant: 'light', pair: 'daisy-dracula',
36
+ colors: {
37
+ 'primary': '#66cc8a', 'primary-content': '#06200f',
38
+ 'secondary': '#377cfb', 'secondary-content': '#02112d',
39
+ 'accent': '#f68067', 'accent-content': '#2d0a02',
40
+ 'neutral': '#333c4d', 'neutral-content': '#e9eaed',
41
+ 'base-100': '#ffffff', 'base-200': '#f3f4f6', 'base-300': '#e5e7eb',
42
+ 'base-content': '#333c4d',
43
+ 'info': '#1c92f2', 'info-content': '#000a14',
44
+ 'success': '#00a96e', 'success-content': '#000a05',
45
+ 'warning': '#ff9900', 'warning-content': '#261600',
46
+ 'error': '#ff5724', 'error-content': '#000000',
47
+ },
48
+ },
49
+ {
50
+ name: 'daisy-dark', variant: 'dark', pair: 'daisy-light',
51
+ colors: {
52
+ 'primary': '#7582ff', 'primary-content': '#050617',
53
+ 'secondary': '#ff71cf', 'secondary-content': '#190211',
54
+ 'accent': '#00e7d0', 'accent-content': '#001210',
55
+ 'neutral': '#2a323c', 'neutral-content': '#a6adbb',
56
+ 'base-100': '#1d232a', 'base-200': '#191e24', 'base-300': '#343b46',
57
+ 'base-content': '#a6adbb',
58
+ ...STATUS_LIGHT,
59
+ },
60
+ },
61
+ {
62
+ name: 'daisy-synthwave', variant: 'dark', pair: 'daisy-cupcake',
63
+ colors: {
64
+ 'primary': '#e779c1', 'primary-content': '#2a0a1f',
65
+ 'secondary': '#58c7f3', 'secondary-content': '#02141d',
66
+ 'accent': '#f3cc30', 'accent-content': '#2a1f00',
67
+ 'neutral': '#20134e', 'neutral-content': '#e3e0f5',
68
+ 'base-100': '#2d1b69', 'base-200': '#261159', 'base-300': '#1f0f4a',
69
+ 'base-content': '#f9f7fd',
70
+ 'info': '#53c0f3', 'info-content': '#02151e',
71
+ 'success': '#71ead2', 'success-content': '#002721',
72
+ 'warning': '#f3cc30', 'warning-content': '#2a1f00',
73
+ 'error': '#e24056', 'error-content': '#ffffff',
74
+ },
75
+ },
76
+ {
77
+ name: 'daisy-dracula', variant: 'dark', pair: 'daisy-emerald',
78
+ colors: {
79
+ 'primary': '#ff79c6', 'primary-content': '#2d0414',
80
+ 'secondary': '#bd93f9', 'secondary-content': '#160226',
81
+ 'accent': '#50fa7b', 'accent-content': '#002a0e',
82
+ 'neutral': '#414558', 'neutral-content': '#f8f8f2',
83
+ 'base-100': '#282a36', 'base-200': '#21222c', 'base-300': '#181920',
84
+ 'base-content': '#f8f8f2',
85
+ 'info': '#8be9fd', 'info-content': '#002a31',
86
+ 'success': '#50fa7b', 'success-content': '#002a0e',
87
+ 'warning': '#f1fa8c', 'warning-content': '#2a2900',
88
+ 'error': '#ff5555', 'error-content': '#2a0000',
89
+ },
90
+ },
91
+ ];
92
+ /**
93
+ * Resolve a `theme.name` to its registered `Theme`. Supports multi-class names
94
+ * like `'daisy-light daisy-rounded'` by matching the first registered id found.
95
+ */
96
+ function findTheme(name) {
97
+ if (!name)
98
+ return undefined;
99
+ for (const part of name.split(/\s+/)) {
100
+ const hit = registry.find((t) => t.name === part);
101
+ if (hit)
102
+ return hit;
103
+ }
104
+ return undefined;
105
+ }
106
+ /**
107
+ * All registered themes in insertion order. Returns a shallow copy so callers
108
+ * can't mutate the internal registry — re-registration goes through
109
+ * `registerTheme()`. Each entry is a full `Theme` (name, variant, palette),
110
+ * so consumers can render swatches in a picker.
111
+ */
112
+ export function listThemes() {
113
+ return registry.slice();
114
+ }
115
+ /**
116
+ * Register (or replace, by `name`) a theme. Call at module-load time before
117
+ * mounting `<ThemeProvider>` so it shows up in `listThemes()` / `pickThemeFor()`.
118
+ */
119
+ export function registerTheme(theme) {
120
+ const i = registry.findIndex((t) => t.name === theme.name);
121
+ if (i >= 0)
122
+ registry[i] = theme;
123
+ else
124
+ registry.push(theme);
125
+ }
126
+ /**
127
+ * Derive a new theme from a registered base, overriding any colors / roundness.
128
+ * Ergonomic for "tenant tweaks a few tokens": the result is a full `Theme` you
129
+ * pass to `registerTheme()`. Throws if `base` isn't registered.
130
+ *
131
+ * ```ts
132
+ * registerTheme(extendTheme('daisy-dark', {
133
+ * name: 'acme-dark',
134
+ * colors: { primary: '#fb7185' },
135
+ * }));
136
+ * ```
137
+ */
138
+ export function extendTheme(base, patch) {
139
+ const src = findTheme(base);
140
+ if (!src) {
141
+ throw new Error(`[lynx-daisyui] extendTheme: unknown base theme "${base}". `
142
+ + `Register it first, or extend a built-in (e.g. 'daisy-light').`);
143
+ }
144
+ return {
145
+ name: patch.name,
146
+ variant: patch.variant ?? src.variant,
147
+ pair: patch.pair ?? src.pair,
148
+ colors: { ...src.colors, ...patch.colors },
149
+ radius: patch.radius ?? src.radius,
150
+ };
151
+ }
152
+ /** The variant of a registered theme, or `undefined` if not registered. */
153
+ export function variantOf(name) {
154
+ return findTheme(name)?.variant;
155
+ }
156
+ /** The color palette of a registered theme, or `undefined` if not registered. */
157
+ export function colorsOf(name) {
158
+ return findTheme(name)?.colors;
159
+ }
160
+ /** The roundness overrides of a registered theme, if any. */
161
+ export function radiusOf(name) {
162
+ return findTheme(name)?.radius;
163
+ }
164
+ /**
165
+ * Pick a default theme for a given system color scheme — the first registered
166
+ * theme of that variant (`daisy-light` / `daisy-dark` under the seeded
167
+ * registry). Falls back to `'daisy-light'` if none of that variant exists.
168
+ */
169
+ export function pickThemeFor(scheme) {
170
+ const hit = registry.find((t) => t.variant === scheme);
171
+ return hit?.name ?? 'daisy-light';
172
+ }
173
+ /**
174
+ * Resolve the paired theme of a given name — used by `theme.toggle()`. Follows
175
+ * `pair` if set, otherwise the first theme of the opposite variant. Returns the
176
+ * input unchanged when the theme isn't registered.
177
+ */
178
+ export function pairOf(name) {
179
+ const hit = findTheme(name);
180
+ if (!hit)
181
+ return name;
182
+ if (hit.pair)
183
+ return hit.pair;
184
+ return pickThemeFor(hit.variant === 'light' ? 'dark' : 'light');
185
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigx/lynx-daisyui",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "DaisyUI integration for sigx-lynx",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -37,12 +37,15 @@
37
37
  "LICENSE"
38
38
  ],
39
39
  "dependencies": {
40
- "@sigx/lynx": "^0.4.1",
41
- "@sigx/lynx-gestures": "^0.4.1"
40
+ "@sigx/lynx": "^0.4.2",
41
+ "@sigx/lynx-appearance": "^0.4.2",
42
+ "@sigx/lynx-icons": "^0.4.2",
43
+ "@sigx/lynx-motion": "^0.4.2",
44
+ "@sigx/lynx-gestures": "^0.4.2"
42
45
  },
43
46
  "peerDependencies": {
44
47
  "tailwindcss": "^3.0.0 || ^4.0.0",
45
- "@sigx/lynx-navigation": "^0.4.1"
48
+ "@sigx/lynx-navigation": "^0.4.2"
46
49
  },
47
50
  "peerDependenciesMeta": {
48
51
  "@sigx/lynx-navigation": {
@@ -50,10 +53,10 @@
50
53
  }
51
54
  },
52
55
  "devDependencies": {
53
- "@typescript/native-preview": "7.0.0-dev.20260511.1",
56
+ "@typescript/native-preview": "7.0.0-dev.20260521.1",
54
57
  "tailwindcss": "^4.0.0",
55
58
  "typescript": "^6.0.3",
56
- "@sigx/lynx-navigation": "^0.4.1"
59
+ "@sigx/lynx-navigation": "^0.4.2"
57
60
  },
58
61
  "publishConfig": {
59
62
  "access": "public"
@@ -1,95 +0,0 @@
1
- /* DaisyUI Light Theme — design tokens as CSS custom properties */
2
- /* Scoped under .daisy-light; CSS inheritance propagates to descendants */
3
-
4
- .daisy-light {
5
- /* Apply base colors to the theme root */
6
- background-color: #ffffff;
7
- color: #1f2937;
8
-
9
- /* Semantic colors */
10
- --color-primary: #491dff;
11
- --color-primary-content: #d3dbff;
12
- --color-secondary: #ff20cc;
13
- --color-secondary-content: #fff8fc;
14
- --color-accent: #00cfbd;
15
- --color-accent-content: #00100d;
16
- --color-neutral: #2b3440;
17
- --color-neutral-content: #d7dde4;
18
-
19
- /* Base colors */
20
- --color-base-100: #ffffff;
21
- --color-base-200: #f2f2f2;
22
- --color-base-300: #e5e6e6;
23
- --color-base-content: #1f2937;
24
-
25
- /* Status colors */
26
- --color-info: #00b4fa;
27
- --color-info-content: #000000;
28
- --color-success: #00a96e;
29
- --color-success-content: #000000;
30
- --color-warning: #ffc100;
31
- --color-warning-content: #000000;
32
- --color-error: #ff676a;
33
- --color-error-content: #000000;
34
-
35
- /* ── Roundness ── */
36
- --rounded-box: 16px;
37
- --rounded-btn: 8px;
38
- --rounded-badge: 9999px;
39
- --rounded-tab: 8px;
40
- --rounded-selector: 8px;
41
- --rounded-toggle: 9999px;
42
-
43
- /* ── Sizing scale ── */
44
- --size-xs: 24px;
45
- --size-sm: 32px;
46
- --size-md: 48px;
47
- --size-lg: 64px;
48
-
49
- /* ── Font sizes ── */
50
- --font-xs: 12px;
51
- --font-sm: 14px;
52
- --font-md: 14px;
53
- --font-lg: 18px;
54
-
55
- /* ── Spacing ── */
56
- --padding-btn-xs: 8px;
57
- --padding-btn-sm: 12px;
58
- --padding-btn-md: 16px;
59
- --padding-btn-lg: 24px;
60
- --padding-box: 16px;
61
- --padding-box-compact: 8px;
62
- --gap-box: 8px;
63
-
64
- /* ── Borders ── */
65
- --border-btn: 1px;
66
- --border-card: 1px;
67
-
68
- /* ── Component-specific sizes ── */
69
- --checkbox-xs: 16px;
70
- --checkbox-sm: 20px;
71
- --checkbox-md: 24px;
72
- --checkbox-lg: 32px;
73
- --toggle-width-xs: 32px;
74
- --toggle-width-sm: 40px;
75
- --toggle-width-md: 48px;
76
- --toggle-width-lg: 56px;
77
- --toggle-height-xs: 22px;
78
- --toggle-height-sm: 24px;
79
- --toggle-height-md: 28px;
80
- --toggle-height-lg: 32px;
81
- --toggle-thumb-xs: 14px;
82
- --toggle-thumb-sm: 16px;
83
- --toggle-thumb-md: 20px;
84
- --toggle-thumb-lg: 24px;
85
- --badge-xs: 16px;
86
- --badge-sm: 20px;
87
- --badge-md: 24px;
88
- --badge-lg: 32px;
89
- --step-indicator: 32px;
90
- --progress-height: 8px;
91
- --modal-max-width: 400px;
92
-
93
- /* ── Opacity ── */
94
- --disabled-opacity: 0.5;
95
- }