@molecule/app-theme 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.
- package/LICENSE +111 -24
- package/README.md +163 -163
- package/package.json +5 -5
package/LICENSE
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
Apache License
|
|
2
3
|
Version 2.0, January 2004
|
|
3
4
|
http://www.apache.org/licenses/
|
|
@@ -34,21 +35,33 @@
|
|
|
34
35
|
|
|
35
36
|
"Work" shall mean the work of authorship, whether in Source or
|
|
36
37
|
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
38
40
|
|
|
39
41
|
"Derivative Works" shall mean any work, whether in Source or Object
|
|
40
42
|
form, that is based on (or derived from) the Work and for which the
|
|
41
43
|
editorial revisions, annotations, elaborations, or other modifications
|
|
42
|
-
represent, as a whole, an original work of authorship.
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
49
62
|
|
|
50
63
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
51
|
-
on behalf of whom a Contribution has been received by
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
52
65
|
subsequently incorporated within the Work.
|
|
53
66
|
|
|
54
67
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
@@ -61,8 +74,18 @@
|
|
|
61
74
|
3. Grant of Patent License. Subject to the terms and conditions of
|
|
62
75
|
this License, each Contributor hereby grants to You a perpetual,
|
|
63
76
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
64
|
-
|
|
65
|
-
and otherwise transfer the Work
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
66
89
|
|
|
67
90
|
4. Redistribution. You may reproduce and distribute copies of the
|
|
68
91
|
Work or Derivative Works thereof in any medium, with or without
|
|
@@ -84,23 +107,87 @@
|
|
|
84
107
|
(d) If the Work includes a "NOTICE" text file as part of its
|
|
85
108
|
distribution, then any Derivative Works that You distribute must
|
|
86
109
|
include a readable copy of the attribution notices contained
|
|
87
|
-
within such NOTICE file
|
|
88
|
-
|
|
89
|
-
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
90
138
|
|
|
91
139
|
6. Trademarks. This License does not grant permission to use the trade
|
|
92
|
-
names, trademarks, service marks, or product names of the Licensor
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
93
143
|
|
|
94
144
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
95
|
-
agreed to in writing, Licensor provides the Work
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
104
191
|
|
|
105
192
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
106
193
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -3,15 +3,11 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-
|
|
6
|
+
Generated: 2026-10-16T23:38:24.583Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-theme
|
|
10
10
|
|
|
11
|
-
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
-
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
-
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
-
|
|
15
11
|
Theme interface and utilities for molecule.dev.
|
|
16
12
|
|
|
17
13
|
Framework-agnostic theme contract — a {@link Theme} (colors, spacing,
|
|
@@ -21,6 +17,10 @@ Bond a provider (e.g. `@molecule/app-theme-css-variables`, which applies the
|
|
|
21
17
|
palette as CSS variables) at startup; {@link lightTheme}/{@link darkTheme}
|
|
22
18
|
are the base defaults.
|
|
23
19
|
|
|
20
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
21
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
22
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
23
|
+
|
|
24
24
|
## Quick Start
|
|
25
25
|
|
|
26
26
|
```typescript
|
|
@@ -45,53 +45,54 @@ npm install @molecule/app-theme @molecule/app-bond
|
|
|
45
45
|
|
|
46
46
|
### Interfaces
|
|
47
47
|
|
|
48
|
-
#### `
|
|
48
|
+
#### `ThemeProvider`
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Manages theme state including the active theme, mode toggling,
|
|
51
|
+
and change subscriptions.
|
|
51
52
|
|
|
52
53
|
```typescript
|
|
53
|
-
interface
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
spacing: ThemeSpacing
|
|
59
|
-
typography: ThemeTypography
|
|
60
|
-
borderRadius: ThemeBorderRadius
|
|
61
|
-
shadows: ThemeShadows
|
|
62
|
-
transitions: ThemeTransitions
|
|
63
|
-
zIndex: ThemeZIndex
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
#### `ThemeBorderRadius`
|
|
54
|
+
interface ThemeProvider {
|
|
55
|
+
/**
|
|
56
|
+
* Returns the currently active theme.
|
|
57
|
+
*/
|
|
58
|
+
getTheme(): Theme
|
|
68
59
|
|
|
69
|
-
|
|
60
|
+
/**
|
|
61
|
+
* Sets the active theme by reference or by name.
|
|
62
|
+
*
|
|
63
|
+
* @param theme - A `Theme` object or a theme name string to activate.
|
|
64
|
+
*/
|
|
65
|
+
setTheme(theme: Theme | string): void
|
|
70
66
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
md: string
|
|
76
|
-
lg: string
|
|
77
|
-
xl: string
|
|
78
|
-
full: string
|
|
79
|
-
}
|
|
80
|
-
```
|
|
67
|
+
/**
|
|
68
|
+
* Toggles between light and dark mode for the active theme.
|
|
69
|
+
*/
|
|
70
|
+
toggleMode(): void
|
|
81
71
|
|
|
82
|
-
|
|
72
|
+
/**
|
|
73
|
+
* Subscribes to theme changes. The callback fires whenever
|
|
74
|
+
* `setTheme()` or `toggleMode()` is called.
|
|
75
|
+
*
|
|
76
|
+
* @param callback - Invoked with the new theme after each change.
|
|
77
|
+
* @returns An unsubscribe function.
|
|
78
|
+
*/
|
|
79
|
+
subscribe(callback: (theme: Theme) => void): () => void
|
|
83
80
|
|
|
84
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Returns all registered themes. Optional — not all providers
|
|
83
|
+
* support multiple themes.
|
|
84
|
+
*/
|
|
85
|
+
getThemes?(): Theme[]
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
87
|
+
/**
|
|
88
|
+
* Returns the theme a render WITHOUT a browser produces — a server or
|
|
89
|
+
* build-time render, which has no storage and no `prefers-color-scheme`
|
|
90
|
+
* to read. A hydrating client renders this theme first, so its markup
|
|
91
|
+
* matches what the server sent, and switches to `getTheme()` right
|
|
92
|
+
* after. Optional — a provider whose theme cannot differ between the two
|
|
93
|
+
* need not implement it.
|
|
94
|
+
*/
|
|
95
|
+
getServerTheme?(): Theme
|
|
95
96
|
}
|
|
96
97
|
```
|
|
97
98
|
|
|
@@ -144,68 +145,19 @@ interface ThemeColors {
|
|
|
144
145
|
}
|
|
145
146
|
```
|
|
146
147
|
|
|
147
|
-
#### `
|
|
148
|
-
|
|
149
|
-
Manages theme state including the active theme, mode toggling,
|
|
150
|
-
and change subscriptions.
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
interface ThemeProvider {
|
|
154
|
-
/**
|
|
155
|
-
* Returns the currently active theme.
|
|
156
|
-
*/
|
|
157
|
-
getTheme(): Theme
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Sets the active theme by reference or by name.
|
|
161
|
-
*
|
|
162
|
-
* @param theme - A `Theme` object or a theme name string to activate.
|
|
163
|
-
*/
|
|
164
|
-
setTheme(theme: Theme | string): void
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Toggles between light and dark mode for the active theme.
|
|
168
|
-
*/
|
|
169
|
-
toggleMode(): void
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Subscribes to theme changes. The callback fires whenever
|
|
173
|
-
* `setTheme()` or `toggleMode()` is called.
|
|
174
|
-
*
|
|
175
|
-
* @param callback - Invoked with the new theme after each change.
|
|
176
|
-
* @returns An unsubscribe function.
|
|
177
|
-
*/
|
|
178
|
-
subscribe(callback: (theme: Theme) => void): () => void
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* Returns all registered themes. Optional — not all providers
|
|
182
|
-
* support multiple themes.
|
|
183
|
-
*/
|
|
184
|
-
getThemes?(): Theme[]
|
|
185
|
-
|
|
186
|
-
/**
|
|
187
|
-
* Returns the theme a render WITHOUT a browser produces — a server or
|
|
188
|
-
* build-time render, which has no storage and no `prefers-color-scheme`
|
|
189
|
-
* to read. A hydrating client renders this theme first, so its markup
|
|
190
|
-
* matches what the server sent, and switches to `getTheme()` right
|
|
191
|
-
* after. Optional — a provider whose theme cannot differ between the two
|
|
192
|
-
* need not implement it.
|
|
193
|
-
*/
|
|
194
|
-
getServerTheme?(): Theme
|
|
195
|
-
}
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
#### `ThemeShadows`
|
|
148
|
+
#### `ThemeBreakpoints`
|
|
199
149
|
|
|
200
|
-
|
|
150
|
+
Responsive viewport breakpoints from mobileS (320px) to desktop (2560px).
|
|
201
151
|
|
|
202
152
|
```typescript
|
|
203
|
-
interface
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
153
|
+
interface ThemeBreakpoints {
|
|
154
|
+
mobileS: string // 320px
|
|
155
|
+
mobileM: string // 375px
|
|
156
|
+
mobileL: string // 425px
|
|
157
|
+
tablet: string // 768px
|
|
158
|
+
laptop: string // 1024px
|
|
159
|
+
laptopL: string // 1440px
|
|
160
|
+
desktop: string // 2560px
|
|
209
161
|
}
|
|
210
162
|
```
|
|
211
163
|
|
|
@@ -225,18 +177,6 @@ interface ThemeSpacing {
|
|
|
225
177
|
}
|
|
226
178
|
```
|
|
227
179
|
|
|
228
|
-
#### `ThemeTransitions`
|
|
229
|
-
|
|
230
|
-
CSS transition duration presets (fast, normal, slow).
|
|
231
|
-
|
|
232
|
-
```typescript
|
|
233
|
-
interface ThemeTransitions {
|
|
234
|
-
fast: string
|
|
235
|
-
normal: string
|
|
236
|
-
slow: string
|
|
237
|
-
}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
180
|
#### `ThemeTypography`
|
|
241
181
|
|
|
242
182
|
Typography scale (font families, sizes, weights, and line heights).
|
|
@@ -274,6 +214,47 @@ interface ThemeTypography {
|
|
|
274
214
|
}
|
|
275
215
|
```
|
|
276
216
|
|
|
217
|
+
#### `ThemeBorderRadius`
|
|
218
|
+
|
|
219
|
+
Border radius scale.
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
interface ThemeBorderRadius {
|
|
223
|
+
none: string
|
|
224
|
+
sm: string
|
|
225
|
+
md: string
|
|
226
|
+
lg: string
|
|
227
|
+
xl: string
|
|
228
|
+
full: string
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### `ThemeShadows`
|
|
233
|
+
|
|
234
|
+
Box-shadow scale from none to xl for elevation levels.
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
interface ThemeShadows {
|
|
238
|
+
none: string
|
|
239
|
+
sm: string
|
|
240
|
+
md: string
|
|
241
|
+
lg: string
|
|
242
|
+
xl: string
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
#### `ThemeTransitions`
|
|
247
|
+
|
|
248
|
+
CSS transition duration presets (fast, normal, slow).
|
|
249
|
+
|
|
250
|
+
```typescript
|
|
251
|
+
interface ThemeTransitions {
|
|
252
|
+
fast: string
|
|
253
|
+
normal: string
|
|
254
|
+
slow: string
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
277
258
|
#### `ThemeZIndex`
|
|
278
259
|
|
|
279
260
|
Theme z-index scale for layering UI elements (dropdowns, modals, toasts, etc.).
|
|
@@ -292,33 +273,36 @@ interface ThemeZIndex {
|
|
|
292
273
|
}
|
|
293
274
|
```
|
|
294
275
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
#### `createDarkTheme(overrides)`
|
|
276
|
+
#### `Theme`
|
|
298
277
|
|
|
299
|
-
|
|
300
|
-
optional overrides for colors, spacing, typography, etc.
|
|
278
|
+
Complete theme definition.
|
|
301
279
|
|
|
302
280
|
```typescript
|
|
303
|
-
|
|
281
|
+
interface Theme {
|
|
282
|
+
name: string
|
|
283
|
+
mode: 'light' | 'dark'
|
|
284
|
+
colors: ThemeColors
|
|
285
|
+
breakpoints: ThemeBreakpoints
|
|
286
|
+
spacing: ThemeSpacing
|
|
287
|
+
typography: ThemeTypography
|
|
288
|
+
borderRadius: ThemeBorderRadius
|
|
289
|
+
shadows: ThemeShadows
|
|
290
|
+
transitions: ThemeTransitions
|
|
291
|
+
zIndex: ThemeZIndex
|
|
292
|
+
}
|
|
304
293
|
```
|
|
305
294
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
**Returns:** A complete `Theme` object with `mode: 'dark'`.
|
|
295
|
+
### Functions
|
|
309
296
|
|
|
310
|
-
#### `
|
|
297
|
+
#### `setProvider(provider)`
|
|
311
298
|
|
|
312
|
-
|
|
313
|
-
optional overrides for colors, spacing, typography, etc.
|
|
299
|
+
Registers a theme provider as the active singleton.
|
|
314
300
|
|
|
315
301
|
```typescript
|
|
316
|
-
function
|
|
302
|
+
function setProvider(provider: ThemeProvider): void
|
|
317
303
|
```
|
|
318
304
|
|
|
319
|
-
- `
|
|
320
|
-
|
|
321
|
-
**Returns:** A complete `Theme` object with `mode: 'light'`.
|
|
305
|
+
- `provider` — The theme provider implementation to bond.
|
|
322
306
|
|
|
323
307
|
#### `getProvider()`
|
|
324
308
|
|
|
@@ -340,40 +324,48 @@ function hasProvider(): boolean
|
|
|
340
324
|
|
|
341
325
|
**Returns:** `true` if a theme provider is bonded.
|
|
342
326
|
|
|
343
|
-
#### `
|
|
327
|
+
#### `createLightTheme(overrides)`
|
|
344
328
|
|
|
345
|
-
|
|
329
|
+
Creates a light theme by merging default light-mode tokens with
|
|
330
|
+
optional overrides for colors, spacing, typography, etc.
|
|
346
331
|
|
|
347
332
|
```typescript
|
|
348
|
-
function
|
|
333
|
+
function createLightTheme(overrides?: Partial<Theme>): Theme
|
|
349
334
|
```
|
|
350
335
|
|
|
351
|
-
- `
|
|
336
|
+
- `overrides` — Partial theme tokens to merge over the defaults.
|
|
352
337
|
|
|
353
|
-
|
|
338
|
+
**Returns:** A complete `Theme` object with `mode: 'light'`.
|
|
354
339
|
|
|
355
|
-
#### `
|
|
340
|
+
#### `createDarkTheme(overrides)`
|
|
356
341
|
|
|
357
|
-
|
|
342
|
+
Creates a dark theme by merging default dark-mode tokens with
|
|
343
|
+
optional overrides for colors, spacing, typography, etc.
|
|
358
344
|
|
|
359
345
|
```typescript
|
|
360
|
-
|
|
346
|
+
function createDarkTheme(overrides?: Partial<Theme>): Theme
|
|
361
347
|
```
|
|
362
348
|
|
|
363
|
-
|
|
349
|
+
- `overrides` — Partial theme tokens to merge over the defaults.
|
|
364
350
|
|
|
365
|
-
|
|
351
|
+
**Returns:** A complete `Theme` object with `mode: 'dark'`.
|
|
352
|
+
|
|
353
|
+
### Constants
|
|
354
|
+
|
|
355
|
+
#### `lightColors`
|
|
356
|
+
|
|
357
|
+
Default light theme colors.
|
|
366
358
|
|
|
367
359
|
```typescript
|
|
368
|
-
const
|
|
360
|
+
const lightColors: ThemeColors
|
|
369
361
|
```
|
|
370
362
|
|
|
371
|
-
#### `
|
|
363
|
+
#### `darkColors`
|
|
372
364
|
|
|
373
|
-
Default
|
|
365
|
+
Default dark theme colors.
|
|
374
366
|
|
|
375
367
|
```typescript
|
|
376
|
-
const
|
|
368
|
+
const darkColors: ThemeColors
|
|
377
369
|
```
|
|
378
370
|
|
|
379
371
|
#### `defaultBreakpoints`
|
|
@@ -384,52 +376,52 @@ Default responsive breakpoints (320px mobileS → 2560px desktop).
|
|
|
384
376
|
const defaultBreakpoints: ThemeBreakpoints
|
|
385
377
|
```
|
|
386
378
|
|
|
387
|
-
#### `
|
|
379
|
+
#### `defaultSpacing`
|
|
388
380
|
|
|
389
|
-
Default
|
|
381
|
+
Default spacing scale (4px xs → 64px xxxl).
|
|
390
382
|
|
|
391
383
|
```typescript
|
|
392
|
-
const
|
|
384
|
+
const defaultSpacing: ThemeSpacing
|
|
393
385
|
```
|
|
394
386
|
|
|
395
|
-
#### `
|
|
387
|
+
#### `defaultTypography`
|
|
396
388
|
|
|
397
|
-
Default
|
|
389
|
+
Default typography scale (system font stacks, rem-based sizes, weight/line-height presets).
|
|
398
390
|
|
|
399
391
|
```typescript
|
|
400
|
-
const
|
|
392
|
+
const defaultTypography: ThemeTypography
|
|
401
393
|
```
|
|
402
394
|
|
|
403
|
-
#### `
|
|
395
|
+
#### `defaultBorderRadius`
|
|
404
396
|
|
|
405
|
-
Default
|
|
397
|
+
Default border radius.
|
|
406
398
|
|
|
407
399
|
```typescript
|
|
408
|
-
const
|
|
400
|
+
const defaultBorderRadius: ThemeBorderRadius
|
|
409
401
|
```
|
|
410
402
|
|
|
411
|
-
#### `
|
|
403
|
+
#### `defaultShadows`
|
|
412
404
|
|
|
413
|
-
Default
|
|
405
|
+
Default box-shadow scale (none → xl, rgba-based).
|
|
414
406
|
|
|
415
407
|
```typescript
|
|
416
|
-
const
|
|
408
|
+
const defaultShadows: ThemeShadows
|
|
417
409
|
```
|
|
418
410
|
|
|
419
|
-
#### `
|
|
411
|
+
#### `defaultTransitions`
|
|
420
412
|
|
|
421
|
-
Default
|
|
413
|
+
Default CSS transition durations (150ms fast, 250ms normal, 350ms slow).
|
|
422
414
|
|
|
423
415
|
```typescript
|
|
424
|
-
const
|
|
416
|
+
const defaultTransitions: ThemeTransitions
|
|
425
417
|
```
|
|
426
418
|
|
|
427
|
-
#### `
|
|
419
|
+
#### `defaultZIndex`
|
|
428
420
|
|
|
429
|
-
Default
|
|
421
|
+
Default z-index scale.
|
|
430
422
|
|
|
431
423
|
```typescript
|
|
432
|
-
const
|
|
424
|
+
const defaultZIndex: ThemeZIndex
|
|
433
425
|
```
|
|
434
426
|
|
|
435
427
|
#### `lightTheme`
|
|
@@ -440,6 +432,14 @@ Default light theme.
|
|
|
440
432
|
const lightTheme: Theme
|
|
441
433
|
```
|
|
442
434
|
|
|
435
|
+
#### `darkTheme`
|
|
436
|
+
|
|
437
|
+
Default dark theme.
|
|
438
|
+
|
|
439
|
+
```typescript
|
|
440
|
+
const darkTheme: Theme
|
|
441
|
+
```
|
|
442
|
+
|
|
443
443
|
## Available Providers
|
|
444
444
|
|
|
445
445
|
| Provider | Package |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-theme",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "Theme interface and utilities for molecule.dev",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"@molecule/app-bond": "^1.0.1"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@molecule/app-bond": "1.0.
|
|
35
|
-
"@types/node": "26.
|
|
34
|
+
"@molecule/app-bond": "1.0.3",
|
|
35
|
+
"@types/node": "26.6.5",
|
|
36
36
|
"typescript": "6.0.3",
|
|
37
|
-
"vitest": "4.1.
|
|
37
|
+
"vitest": "4.1.12"
|
|
38
38
|
},
|
|
39
39
|
"repository": {
|
|
40
40
|
"type": "git",
|
|
41
41
|
"url": "https://github.com/molecule-dev/molecule.git",
|
|
42
42
|
"directory": "packages/app/core/theme"
|
|
43
43
|
},
|
|
44
|
-
"homepage": "https://
|
|
44
|
+
"homepage": "https://www.molecule.dev/packages/app-theme",
|
|
45
45
|
"bugs": "https://github.com/molecule-dev/molecule/issues",
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|