@molecule/app-theme 1.0.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/LICENSE ADDED
@@ -0,0 +1,115 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work.
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other modifications
42
+ represent, as a whole, an original work of authorship.
43
+
44
+ "Contribution" shall mean any work of authorship, including the
45
+ original version of the Work and any modifications or additions
46
+ to that Work, that is intentionally submitted to the Licensor for
47
+ inclusion in the Work by the copyright owner or by an individual or
48
+ Legal Entity authorized to submit on behalf of the copyright owner.
49
+
50
+ "Contributor" shall mean Licensor and any individual or Legal Entity
51
+ on behalf of whom a Contribution has been received by the Licensor and
52
+ subsequently incorporated within the Work.
53
+
54
+ 2. Grant of Copyright License. Subject to the terms and conditions of
55
+ this License, each Contributor hereby grants to You a perpetual,
56
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
57
+ copyright license to reproduce, prepare Derivative Works of,
58
+ publicly display, publicly perform, sublicense, and distribute the
59
+ Work and such Derivative Works in Source or Object form.
60
+
61
+ 3. Grant of Patent License. Subject to the terms and conditions of
62
+ this License, each Contributor hereby grants to You a perpetual,
63
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
64
+ patent license to make, have made, use, offer to sell, sell, import,
65
+ and otherwise transfer the Work.
66
+
67
+ 4. Redistribution. You may reproduce and distribute copies of the
68
+ Work or Derivative Works thereof in any medium, with or without
69
+ modifications, and in Source or Object form, provided that You
70
+ meet the following conditions:
71
+
72
+ (a) You must give any other recipients of the Work or
73
+ Derivative Works a copy of this License; and
74
+
75
+ (b) You must cause any modified files to carry prominent notices
76
+ stating that You changed the files; and
77
+
78
+ (c) You must retain, in the Source form of any Derivative Works
79
+ that You distribute, all copyright, patent, trademark, and
80
+ attribution notices from the Source form of the Work,
81
+ excluding those notices that do not pertain to any part of
82
+ the Derivative Works; and
83
+
84
+ (d) If the Work includes a "NOTICE" text file as part of its
85
+ distribution, then any Derivative Works that You distribute must
86
+ include a readable copy of the attribution notices contained
87
+ within such NOTICE file.
88
+
89
+ 5. Submission of Contributions.
90
+
91
+ 6. Trademarks. This License does not grant permission to use the trade
92
+ names, trademarks, service marks, or product names of the Licensor.
93
+
94
+ 7. Disclaimer of Warranty. Unless required by applicable law or
95
+ agreed to in writing, Licensor provides the Work on an "AS IS" BASIS,
96
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND.
97
+
98
+ 8. Limitation of Liability. In no event and under no legal theory shall
99
+ any Contributor be liable to You for damages.
100
+
101
+ 9. Accepting Warranty or Additional Liability.
102
+
103
+ Copyright 2026 Molecule Dev, Inc.
104
+
105
+ Licensed under the Apache License, Version 2.0 (the "License");
106
+ you may not use this file except in compliance with the License.
107
+ You may obtain a copy of the License at
108
+
109
+ http://www.apache.org/licenses/LICENSE-2.0
110
+
111
+ Unless required by applicable law or agreed to in writing, software
112
+ distributed under the License is distributed on an "AS IS" BASIS,
113
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
114
+ See the License for the specific language governing permissions and
115
+ limitations under the License.
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Theme interface and utilities for molecule.dev.
3
+ *
4
+ * Framework-agnostic theme contract — a {@link Theme} (colors, spacing,
5
+ * typography, radii, shadows, z-index) plus a {@link ThemeProvider} bond for
6
+ * reading/switching themes, dark/light toggling, and change subscriptions.
7
+ * Bond a provider (e.g. `@molecule/app-theme-css-variables`, which applies the
8
+ * palette as CSS variables) at startup; {@link lightTheme}/{@link darkTheme}
9
+ * are the base defaults.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { getProvider } from '@molecule/app-theme'
14
+ *
15
+ * const theme = getProvider() // null until a bond is wired at startup
16
+ * theme?.toggleMode() // light <-> dark
17
+ * const unsubscribe = theme?.subscribe((t) => applyBranding(t))
18
+ * ```
19
+ *
20
+ * @remarks
21
+ * - **Recoloring: find the REAL source of truth first.** Apps scaffolded from a
22
+ * template ship a per-app stylesheet (e.g. `app/src/theme.css`) that
23
+ * hardcodes the `--color-*` variables and loads AFTER the bond — its values
24
+ * win, and editing this package's `Theme` objects (or the bond's palette) has
25
+ * NO visible effect there. Precedence: per-app theme stylesheet > theme
26
+ * bond > base defaults. Recolor by editing whichever file actually defines
27
+ * the variables; the bond's `Theme` palette applies only when no per-app
28
+ * stylesheet defines colors.
29
+ * - Read theme values through the provider or the CSS variables it emits —
30
+ * never hardcode hex values in components; surfaces and status colors come
31
+ * from the theme so light AND dark both work.
32
+ * - {@link getProvider} returns `null` when nothing is bonded — theme switching
33
+ * is optional; guard rather than throw.
34
+ *
35
+ * @module
36
+ */
37
+ export * from './provider.js';
38
+ export * from './themes.js';
39
+ export * from './types.js';
40
+ export * from './utilities.js';
41
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Theme interface and utilities for molecule.dev.
3
+ *
4
+ * Framework-agnostic theme contract — a {@link Theme} (colors, spacing,
5
+ * typography, radii, shadows, z-index) plus a {@link ThemeProvider} bond for
6
+ * reading/switching themes, dark/light toggling, and change subscriptions.
7
+ * Bond a provider (e.g. `@molecule/app-theme-css-variables`, which applies the
8
+ * palette as CSS variables) at startup; {@link lightTheme}/{@link darkTheme}
9
+ * are the base defaults.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { getProvider } from '@molecule/app-theme'
14
+ *
15
+ * const theme = getProvider() // null until a bond is wired at startup
16
+ * theme?.toggleMode() // light <-> dark
17
+ * const unsubscribe = theme?.subscribe((t) => applyBranding(t))
18
+ * ```
19
+ *
20
+ * @remarks
21
+ * - **Recoloring: find the REAL source of truth first.** Apps scaffolded from a
22
+ * template ship a per-app stylesheet (e.g. `app/src/theme.css`) that
23
+ * hardcodes the `--color-*` variables and loads AFTER the bond — its values
24
+ * win, and editing this package's `Theme` objects (or the bond's palette) has
25
+ * NO visible effect there. Precedence: per-app theme stylesheet > theme
26
+ * bond > base defaults. Recolor by editing whichever file actually defines
27
+ * the variables; the bond's `Theme` palette applies only when no per-app
28
+ * stylesheet defines colors.
29
+ * - Read theme values through the provider or the CSS variables it emits —
30
+ * never hardcode hex values in components; surfaces and status colors come
31
+ * from the theme so light AND dark both work.
32
+ * - {@link getProvider} returns `null` when nothing is bonded — theme switching
33
+ * is optional; guard rather than throw.
34
+ *
35
+ * @module
36
+ */
37
+ export * from './provider.js';
38
+ export * from './themes.js';
39
+ export * from './types.js';
40
+ export * from './utilities.js';
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,cAAc,eAAe,CAAA;AAC7B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Theme bond accessor.
3
+ *
4
+ * Bond packages (e.g. `@molecule/app-theme-css-variables`) call
5
+ * `setProvider()` during setup. Application code uses `getProvider()`
6
+ * to read and switch themes, toggle dark/light mode, and subscribe
7
+ * to theme changes.
8
+ *
9
+ * @module
10
+ */
11
+ import type { Theme } from './types.js';
12
+ /**
13
+ * Manages theme state including the active theme, mode toggling,
14
+ * and change subscriptions.
15
+ */
16
+ export interface ThemeProvider {
17
+ /**
18
+ * Returns the currently active theme.
19
+ */
20
+ getTheme(): Theme;
21
+ /**
22
+ * Sets the active theme by reference or by name.
23
+ *
24
+ * @param theme - A `Theme` object or a theme name string to activate.
25
+ */
26
+ setTheme(theme: Theme | string): void;
27
+ /**
28
+ * Toggles between light and dark mode for the active theme.
29
+ */
30
+ toggleMode(): void;
31
+ /**
32
+ * Subscribes to theme changes. The callback fires whenever
33
+ * `setTheme()` or `toggleMode()` is called.
34
+ *
35
+ * @param callback - Invoked with the new theme after each change.
36
+ * @returns An unsubscribe function.
37
+ */
38
+ subscribe(callback: (theme: Theme) => void): () => void;
39
+ /**
40
+ * Returns all registered themes. Optional — not all providers
41
+ * support multiple themes.
42
+ */
43
+ getThemes?(): Theme[];
44
+ }
45
+ /**
46
+ * Registers a theme provider as the active singleton.
47
+ *
48
+ * @param provider - The theme provider implementation to bond.
49
+ */
50
+ export declare const setProvider: (provider: ThemeProvider) => void;
51
+ /**
52
+ * Retrieves the bonded theme provider, or `null` if none is configured.
53
+ *
54
+ * @returns The bonded theme provider, or `null`.
55
+ */
56
+ export declare const getProvider: () => ThemeProvider | null;
57
+ /**
58
+ * Checks whether a theme provider is currently bonded.
59
+ *
60
+ * @returns `true` if a theme provider is bonded.
61
+ */
62
+ export declare const hasProvider: () => boolean;
63
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,QAAQ,IAAI,KAAK,CAAA;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,CAAA;IAErC;;OAEG;IACH,UAAU,IAAI,IAAI,CAAA;IAElB;;;;;;OAMG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,MAAM,IAAI,CAAA;IAEvD;;;OAGG;IACH,SAAS,CAAC,IAAI,KAAK,EAAE,CAAA;CACtB;AAID;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,aAAa,KAAG,IAErD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAAO,aAAa,GAAG,IAAiD,CAAA;AAEhG;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAAO,OAA8B,CAAA"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Theme bond accessor.
3
+ *
4
+ * Bond packages (e.g. `@molecule/app-theme-css-variables`) call
5
+ * `setProvider()` during setup. Application code uses `getProvider()`
6
+ * to read and switch themes, toggle dark/light mode, and subscribe
7
+ * to theme changes.
8
+ *
9
+ * @module
10
+ */
11
+ import { bond, get as bondGet, isBonded } from '@molecule/app-bond';
12
+ const BOND_TYPE = 'theme';
13
+ /**
14
+ * Registers a theme provider as the active singleton.
15
+ *
16
+ * @param provider - The theme provider implementation to bond.
17
+ */
18
+ export const setProvider = (provider) => {
19
+ bond(BOND_TYPE, provider);
20
+ };
21
+ /**
22
+ * Retrieves the bonded theme provider, or `null` if none is configured.
23
+ *
24
+ * @returns The bonded theme provider, or `null`.
25
+ */
26
+ export const getProvider = () => bondGet(BOND_TYPE) ?? null;
27
+ /**
28
+ * Checks whether a theme provider is currently bonded.
29
+ *
30
+ * @returns `true` if a theme provider is bonded.
31
+ */
32
+ export const hasProvider = () => isBonded(BOND_TYPE);
33
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AA0CnE,MAAM,SAAS,GAAG,OAAO,CAAA;AAEzB;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAuB,EAAQ,EAAE;IAC3D,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;AAC3B,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAyB,EAAE,CAAC,OAAO,CAAgB,SAAS,CAAC,IAAI,IAAI,CAAA;AAEhG;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAY,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Default light and dark theme definitions for molecule.dev.
3
+ *
4
+ * @module
5
+ */
6
+ import type { Theme, ThemeBorderRadius, ThemeBreakpoints, ThemeColors, ThemeShadows, ThemeSpacing, ThemeTransitions, ThemeTypography, ThemeZIndex } from './types.js';
7
+ /**
8
+ * Default light theme colors.
9
+ */
10
+ export declare const lightColors: ThemeColors;
11
+ /**
12
+ * Default dark theme colors.
13
+ */
14
+ export declare const darkColors: ThemeColors;
15
+ /**
16
+ * Default responsive breakpoints (320px mobileS → 2560px desktop).
17
+ */
18
+ export declare const defaultBreakpoints: ThemeBreakpoints;
19
+ /**
20
+ * Default spacing scale (4px xs → 64px xxxl).
21
+ */
22
+ export declare const defaultSpacing: ThemeSpacing;
23
+ /**
24
+ * Default typography scale (system font stacks, rem-based sizes, weight/line-height presets).
25
+ */
26
+ export declare const defaultTypography: ThemeTypography;
27
+ /**
28
+ * Default border radius.
29
+ */
30
+ export declare const defaultBorderRadius: ThemeBorderRadius;
31
+ /**
32
+ * Default box-shadow scale (none → xl, rgba-based).
33
+ */
34
+ export declare const defaultShadows: ThemeShadows;
35
+ /**
36
+ * Default CSS transition durations (150ms fast, 250ms normal, 350ms slow).
37
+ */
38
+ export declare const defaultTransitions: ThemeTransitions;
39
+ /**
40
+ * Default z-index scale.
41
+ */
42
+ export declare const defaultZIndex: ThemeZIndex;
43
+ /**
44
+ * Default light theme.
45
+ */
46
+ export declare const lightTheme: Theme;
47
+ /**
48
+ * Default dark theme.
49
+ */
50
+ export declare const darkTheme: Theme;
51
+ //# sourceMappingURL=themes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.d.ts","sourceRoot":"","sources":["../src/themes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,KAAK,EACL,iBAAiB,EACjB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,WAAW,EACZ,MAAM,YAAY,CAAA;AAEnB;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,WAmCzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,WAmCxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAQhC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAQ5B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,eA6B/B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,iBAOjC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,YAM5B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,gBAIhC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,WAU3B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,KAWxB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,KAWvB,CAAA"}
package/dist/themes.js ADDED
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Default light and dark theme definitions for molecule.dev.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Default light theme colors.
8
+ */
9
+ export const lightColors = {
10
+ background: '#ffffff',
11
+ backgroundSecondary: '#f5f5f5',
12
+ backgroundTertiary: '#eeeeee',
13
+ surface: '#ffffff',
14
+ surfaceSecondary: '#fafafa',
15
+ inputBackground: '#ffffff',
16
+ text: '#1a1a1a',
17
+ textSecondary: '#666666',
18
+ textTertiary: '#999999',
19
+ textInverse: '#ffffff',
20
+ primary: '#0066cc',
21
+ primaryLight: '#3399ff',
22
+ primaryDark: '#004d99',
23
+ secondary: '#6c757d',
24
+ secondaryLight: '#868e96',
25
+ secondaryDark: '#495057',
26
+ success: '#28a745',
27
+ successLight: '#d4edda',
28
+ warning: '#b87a00',
29
+ warningLight: '#fff3cd',
30
+ error: '#dc3545',
31
+ errorLight: '#f8d7da',
32
+ info: '#17a2b8',
33
+ infoLight: '#d1ecf1',
34
+ border: '#e0e0e0',
35
+ borderSecondary: '#cccccc',
36
+ borderFocus: '#0066cc',
37
+ overlay: 'rgba(0, 0, 0, 0.5)',
38
+ shadow: 'rgba(0, 0, 0, 0.1)',
39
+ };
40
+ /**
41
+ * Default dark theme colors.
42
+ */
43
+ export const darkColors = {
44
+ background: '#121212',
45
+ backgroundSecondary: '#1e1e1e',
46
+ backgroundTertiary: '#2d2d2d',
47
+ surface: '#1e1e1e',
48
+ surfaceSecondary: '#252525',
49
+ inputBackground: '#181818',
50
+ text: '#ffffff',
51
+ textSecondary: '#b3b3b3',
52
+ textTertiary: '#808080',
53
+ textInverse: '#1a1a1a',
54
+ primary: '#3399ff',
55
+ primaryLight: '#66b3ff',
56
+ primaryDark: '#0066cc',
57
+ secondary: '#868e96',
58
+ secondaryLight: '#adb5bd',
59
+ secondaryDark: '#6c757d',
60
+ success: '#28a745',
61
+ successLight: '#1e4620',
62
+ warning: '#b88a12',
63
+ warningLight: '#4d3800',
64
+ error: '#e87080',
65
+ errorLight: '#4d1a1f',
66
+ info: '#17a2b8',
67
+ infoLight: '#0d3d47',
68
+ border: '#333333',
69
+ borderSecondary: '#444444',
70
+ borderFocus: '#3399ff',
71
+ overlay: 'rgba(0, 0, 0, 0.7)',
72
+ shadow: 'rgba(0, 0, 0, 0.3)',
73
+ };
74
+ /**
75
+ * Default responsive breakpoints (320px mobileS → 2560px desktop).
76
+ */
77
+ export const defaultBreakpoints = {
78
+ mobileS: '320px',
79
+ mobileM: '375px',
80
+ mobileL: '425px',
81
+ tablet: '768px',
82
+ laptop: '1024px',
83
+ laptopL: '1440px',
84
+ desktop: '2560px',
85
+ };
86
+ /**
87
+ * Default spacing scale (4px xs → 64px xxxl).
88
+ */
89
+ export const defaultSpacing = {
90
+ xs: '4px',
91
+ sm: '8px',
92
+ md: '16px',
93
+ lg: '24px',
94
+ xl: '32px',
95
+ xxl: '48px',
96
+ xxxl: '64px',
97
+ };
98
+ /**
99
+ * Default typography scale (system font stacks, rem-based sizes, weight/line-height presets).
100
+ */
101
+ export const defaultTypography = {
102
+ fontFamily: {
103
+ sans: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif',
104
+ serif: 'Georgia, "Times New Roman", Times, serif',
105
+ mono: 'SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
106
+ },
107
+ fontSize: {
108
+ xs: '0.75rem',
109
+ sm: '0.875rem',
110
+ base: '1rem',
111
+ lg: '1.125rem',
112
+ xl: '1.25rem',
113
+ '2xl': '1.5rem',
114
+ '3xl': '1.875rem',
115
+ '4xl': '2.25rem',
116
+ '5xl': '3rem',
117
+ },
118
+ fontWeight: {
119
+ light: 300,
120
+ normal: 400,
121
+ medium: 500,
122
+ semibold: 600,
123
+ bold: 700,
124
+ },
125
+ lineHeight: {
126
+ tight: 1.25,
127
+ normal: 1.5,
128
+ relaxed: 1.75,
129
+ },
130
+ };
131
+ /**
132
+ * Default border radius.
133
+ */
134
+ export const defaultBorderRadius = {
135
+ none: '0',
136
+ sm: '4px',
137
+ md: '8px',
138
+ lg: '12px',
139
+ xl: '16px',
140
+ full: '9999px',
141
+ };
142
+ /**
143
+ * Default box-shadow scale (none → xl, rgba-based).
144
+ */
145
+ export const defaultShadows = {
146
+ none: 'none',
147
+ sm: '0 1px 2px 0 rgba(0, 0, 0, 0.05)',
148
+ md: '0 4px 6px -1px rgba(0, 0, 0, 0.1)',
149
+ lg: '0 10px 15px -3px rgba(0, 0, 0, 0.1)',
150
+ xl: '0 20px 25px -5px rgba(0, 0, 0, 0.1)',
151
+ };
152
+ /**
153
+ * Default CSS transition durations (150ms fast, 250ms normal, 350ms slow).
154
+ */
155
+ export const defaultTransitions = {
156
+ fast: '150ms ease-in-out',
157
+ normal: '250ms ease-in-out',
158
+ slow: '350ms ease-in-out',
159
+ };
160
+ /**
161
+ * Default z-index scale.
162
+ */
163
+ export const defaultZIndex = {
164
+ hide: -1,
165
+ base: 0,
166
+ dropdown: 1000,
167
+ sticky: 1100,
168
+ fixed: 1200,
169
+ modal: 1300,
170
+ popover: 1400,
171
+ tooltip: 1500,
172
+ toast: 1600,
173
+ };
174
+ /**
175
+ * Default light theme.
176
+ */
177
+ export const lightTheme = {
178
+ name: 'light',
179
+ mode: 'light',
180
+ colors: lightColors,
181
+ breakpoints: defaultBreakpoints,
182
+ spacing: defaultSpacing,
183
+ typography: defaultTypography,
184
+ borderRadius: defaultBorderRadius,
185
+ shadows: defaultShadows,
186
+ transitions: defaultTransitions,
187
+ zIndex: defaultZIndex,
188
+ };
189
+ /**
190
+ * Default dark theme.
191
+ */
192
+ export const darkTheme = {
193
+ name: 'dark',
194
+ mode: 'dark',
195
+ colors: darkColors,
196
+ breakpoints: defaultBreakpoints,
197
+ spacing: defaultSpacing,
198
+ typography: defaultTypography,
199
+ borderRadius: defaultBorderRadius,
200
+ shadows: defaultShadows,
201
+ transitions: defaultTransitions,
202
+ zIndex: defaultZIndex,
203
+ };
204
+ //# sourceMappingURL=themes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"themes.js","sourceRoot":"","sources":["../src/themes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAcH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAgB;IACtC,UAAU,EAAE,SAAS;IACrB,mBAAmB,EAAE,SAAS;IAC9B,kBAAkB,EAAE,SAAS;IAC7B,OAAO,EAAE,SAAS;IAClB,gBAAgB,EAAE,SAAS;IAC3B,eAAe,EAAE,SAAS;IAE1B,IAAI,EAAE,SAAS;IACf,aAAa,EAAE,SAAS;IACxB,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,SAAS;IAEtB,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,SAAS;IACvB,WAAW,EAAE,SAAS;IACtB,SAAS,EAAE,SAAS;IACpB,cAAc,EAAE,SAAS;IACzB,aAAa,EAAE,SAAS;IAExB,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,SAAS;IACvB,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,SAAS;IACvB,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,SAAS;IACf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B;IAClD,IAAI,EAAE,mBAAmB;IACzB,MAAM,EAAE,mBAAmB;IAC3B,IAAI,EAAE,mBAAmB;CAC1B,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgB;IACxC,IAAI,EAAE,CAAC,CAAC;IACR,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,IAAI;IACd,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,IAAI;IACb,KAAK,EAAE,IAAI;CACZ,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAU;IAC/B,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,WAAW;IACnB,WAAW,EAAE,kBAAkB;IAC/B,OAAO,EAAE,cAAc;IACvB,UAAU,EAAE,iBAAiB;IAC7B,YAAY,EAAE,mBAAmB;IACjC,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,kBAAkB;IAC/B,MAAM,EAAE,aAAa;CACtB,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAU;IAC9B,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,UAAU;IAClB,WAAW,EAAE,kBAAkB;IAC/B,OAAO,EAAE,cAAc;IACvB,UAAU,EAAE,iBAAiB;IAC7B,YAAY,EAAE,mBAAmB;IACjC,OAAO,EAAE,cAAc;IACvB,WAAW,EAAE,kBAAkB;IAC/B,MAAM,EAAE,aAAa;CACtB,CAAA"}
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Theme type definitions for molecule.dev.
3
+ *
4
+ * @module
5
+ */
6
+ /**
7
+ * Color palette definition.
8
+ */
9
+ export interface ThemeColors {
10
+ background: string;
11
+ backgroundSecondary: string;
12
+ backgroundTertiary: string;
13
+ surface: string;
14
+ surfaceSecondary: string;
15
+ inputBackground: string;
16
+ text: string;
17
+ textSecondary: string;
18
+ textTertiary: string;
19
+ textInverse: string;
20
+ primary: string;
21
+ primaryLight: string;
22
+ primaryDark: string;
23
+ secondary: string;
24
+ secondaryLight: string;
25
+ secondaryDark: string;
26
+ success: string;
27
+ successLight: string;
28
+ warning: string;
29
+ warningLight: string;
30
+ error: string;
31
+ errorLight: string;
32
+ info: string;
33
+ infoLight: string;
34
+ border: string;
35
+ borderSecondary: string;
36
+ borderFocus: string;
37
+ overlay: string;
38
+ shadow: string;
39
+ }
40
+ /**
41
+ * Responsive viewport breakpoints from mobileS (320px) to desktop (2560px).
42
+ */
43
+ export interface ThemeBreakpoints {
44
+ mobileS: string;
45
+ mobileM: string;
46
+ mobileL: string;
47
+ tablet: string;
48
+ laptop: string;
49
+ laptopL: string;
50
+ desktop: string;
51
+ }
52
+ /**
53
+ * Theme spacing scale mapping size tokens (xs–3xl) to CSS values (e.g. '4px', '16px').
54
+ */
55
+ export interface ThemeSpacing {
56
+ xs: string;
57
+ sm: string;
58
+ md: string;
59
+ lg: string;
60
+ xl: string;
61
+ xxl: string;
62
+ xxxl: string;
63
+ }
64
+ /**
65
+ * Typography scale (font families, sizes, weights, and line heights).
66
+ */
67
+ export interface ThemeTypography {
68
+ fontFamily: {
69
+ sans: string;
70
+ serif: string;
71
+ mono: string;
72
+ };
73
+ fontSize: {
74
+ xs: string;
75
+ sm: string;
76
+ base: string;
77
+ lg: string;
78
+ xl: string;
79
+ '2xl': string;
80
+ '3xl': string;
81
+ '4xl': string;
82
+ '5xl': string;
83
+ };
84
+ fontWeight: {
85
+ light: number;
86
+ normal: number;
87
+ medium: number;
88
+ semibold: number;
89
+ bold: number;
90
+ };
91
+ lineHeight: {
92
+ tight: number;
93
+ normal: number;
94
+ relaxed: number;
95
+ };
96
+ }
97
+ /**
98
+ * Border radius scale.
99
+ */
100
+ export interface ThemeBorderRadius {
101
+ none: string;
102
+ sm: string;
103
+ md: string;
104
+ lg: string;
105
+ xl: string;
106
+ full: string;
107
+ }
108
+ /**
109
+ * Box-shadow scale from none to xl for elevation levels.
110
+ */
111
+ export interface ThemeShadows {
112
+ none: string;
113
+ sm: string;
114
+ md: string;
115
+ lg: string;
116
+ xl: string;
117
+ }
118
+ /**
119
+ * CSS transition duration presets (fast, normal, slow).
120
+ */
121
+ export interface ThemeTransitions {
122
+ fast: string;
123
+ normal: string;
124
+ slow: string;
125
+ }
126
+ /**
127
+ * Theme z-index scale for layering UI elements (dropdowns, modals, toasts, etc.).
128
+ */
129
+ export interface ThemeZIndex {
130
+ hide: number;
131
+ base: number;
132
+ dropdown: number;
133
+ sticky: number;
134
+ fixed: number;
135
+ modal: number;
136
+ popover: number;
137
+ tooltip: number;
138
+ toast: number;
139
+ }
140
+ /**
141
+ * Complete theme definition.
142
+ */
143
+ export interface Theme {
144
+ name: string;
145
+ mode: 'light' | 'dark';
146
+ colors: ThemeColors;
147
+ breakpoints: ThemeBreakpoints;
148
+ spacing: ThemeSpacing;
149
+ typography: ThemeTypography;
150
+ borderRadius: ThemeBorderRadius;
151
+ shadows: ThemeShadows;
152
+ transitions: ThemeTransitions;
153
+ zIndex: ThemeZIndex;
154
+ }
155
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAE1B,UAAU,EAAE,MAAM,CAAA;IAClB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,gBAAgB,EAAE,MAAM,CAAA;IACxB,eAAe,EAAE,MAAM,CAAA;IAGvB,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IAGnB,OAAO,EAAE,MAAM,CAAA;IACf,YAAY,EAAE,MAA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MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,GAAG,MAAM,CAAA;IACtB,MAAM,EAAE,WAAW,CAAA;IACnB,WAAW,EAAE,gBAAgB,CAAA;IAC7B,OAAO,EAAE,YAAY,CAAA;IACrB,UAAU,EAAE,eAAe,CAAA;IAC3B,YAAY,EAAE,iBAAiB,CAAA;IAC/B,OAAO,EAAE,YAAY,CAAA;IACrB,WAAW,EAAE,gBAAgB,CAAA;IAC7B,MAAM,EAAE,WAAW,CAAA;CACpB"}
package/dist/types.js ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Theme type definitions for molecule.dev.
3
+ *
4
+ * @module
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Theme utility functions for molecule.dev.
3
+ *
4
+ * @module
5
+ */
6
+ import type { Theme } from './types.js';
7
+ /**
8
+ * Creates a light theme by merging default light-mode tokens with
9
+ * optional overrides for colors, spacing, typography, etc.
10
+ *
11
+ * @param overrides - Partial theme tokens to merge over the defaults.
12
+ * @returns A complete `Theme` object with `mode: 'light'`.
13
+ */
14
+ export declare const createLightTheme: (overrides?: Partial<Theme>) => Theme;
15
+ /**
16
+ * Creates a dark theme by merging default dark-mode tokens with
17
+ * optional overrides for colors, spacing, typography, etc.
18
+ *
19
+ * @param overrides - Partial theme tokens to merge over the defaults.
20
+ * @returns A complete `Theme` object with `mode: 'dark'`.
21
+ */
22
+ export declare const createDarkTheme: (overrides?: Partial<Theme>) => Theme;
23
+ //# sourceMappingURL=utilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,YAAY,OAAO,CAAC,KAAK,CAAC,KAAG,KAY5D,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAI,YAAY,OAAO,CAAC,KAAK,CAAC,KAAG,KAY3D,CAAA"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Theme utility functions for molecule.dev.
3
+ *
4
+ * @module
5
+ */
6
+ import { darkColors, defaultBorderRadius, defaultBreakpoints, defaultShadows, defaultSpacing, defaultTransitions, defaultTypography, defaultZIndex, lightColors, } from './themes.js';
7
+ /**
8
+ * Creates a light theme by merging default light-mode tokens with
9
+ * optional overrides for colors, spacing, typography, etc.
10
+ *
11
+ * @param overrides - Partial theme tokens to merge over the defaults.
12
+ * @returns A complete `Theme` object with `mode: 'light'`.
13
+ */
14
+ export const createLightTheme = (overrides) => ({
15
+ name: 'light',
16
+ mode: 'light',
17
+ colors: { ...lightColors, ...overrides?.colors },
18
+ breakpoints: { ...defaultBreakpoints, ...overrides?.breakpoints },
19
+ spacing: { ...defaultSpacing, ...overrides?.spacing },
20
+ typography: { ...defaultTypography, ...overrides?.typography },
21
+ borderRadius: { ...defaultBorderRadius, ...overrides?.borderRadius },
22
+ shadows: { ...defaultShadows, ...overrides?.shadows },
23
+ transitions: { ...defaultTransitions, ...overrides?.transitions },
24
+ zIndex: { ...defaultZIndex, ...overrides?.zIndex },
25
+ ...overrides,
26
+ });
27
+ /**
28
+ * Creates a dark theme by merging default dark-mode tokens with
29
+ * optional overrides for colors, spacing, typography, etc.
30
+ *
31
+ * @param overrides - Partial theme tokens to merge over the defaults.
32
+ * @returns A complete `Theme` object with `mode: 'dark'`.
33
+ */
34
+ export const createDarkTheme = (overrides) => ({
35
+ name: 'dark',
36
+ mode: 'dark',
37
+ colors: { ...darkColors, ...overrides?.colors },
38
+ breakpoints: { ...defaultBreakpoints, ...overrides?.breakpoints },
39
+ spacing: { ...defaultSpacing, ...overrides?.spacing },
40
+ typography: { ...defaultTypography, ...overrides?.typography },
41
+ borderRadius: { ...defaultBorderRadius, ...overrides?.borderRadius },
42
+ shadows: { ...defaultShadows, ...overrides?.shadows },
43
+ transitions: { ...defaultTransitions, ...overrides?.transitions },
44
+ zIndex: { ...defaultZIndex, ...overrides?.zIndex },
45
+ ...overrides,
46
+ });
47
+ //# sourceMappingURL=utilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utilities.js","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,WAAW,GACZ,MAAM,aAAa,CAAA;AAGpB;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAA0B,EAAS,EAAE,CAAC,CAAC;IACtE,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,EAAE,GAAG,WAAW,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE;IAChD,WAAW,EAAE,EAAE,GAAG,kBAAkB,EAAE,GAAG,SAAS,EAAE,WAAW,EAAE;IACjE,OAAO,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE;IACrD,UAAU,EAAE,EAAE,GAAG,iBAAiB,EAAE,GAAG,SAAS,EAAE,UAAU,EAAE;IAC9D,YAAY,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,SAAS,EAAE,YAAY,EAAE;IACpE,OAAO,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE;IACrD,WAAW,EAAE,EAAE,GAAG,kBAAkB,EAAE,GAAG,SAAS,EAAE,WAAW,EAAE;IACjE,MAAM,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE;IAClD,GAAG,SAAS;CACb,CAAC,CAAA;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAA0B,EAAS,EAAE,CAAC,CAAC;IACrE,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE;IAC/C,WAAW,EAAE,EAAE,GAAG,kBAAkB,EAAE,GAAG,SAAS,EAAE,WAAW,EAAE;IACjE,OAAO,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE;IACrD,UAAU,EAAE,EAAE,GAAG,iBAAiB,EAAE,GAAG,SAAS,EAAE,UAAU,EAAE;IAC9D,YAAY,EAAE,EAAE,GAAG,mBAAmB,EAAE,GAAG,SAAS,EAAE,YAAY,EAAE;IACpE,OAAO,EAAE,EAAE,GAAG,cAAc,EAAE,GAAG,SAAS,EAAE,OAAO,EAAE;IACrD,WAAW,EAAE,EAAE,GAAG,kBAAkB,EAAE,GAAG,SAAS,EAAE,WAAW,EAAE;IACjE,MAAM,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,SAAS,EAAE,MAAM,EAAE;IAClD,GAAG,SAAS;CACb,CAAC,CAAA"}
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@molecule/app-theme",
3
+ "version": "1.0.0",
4
+ "description": "Theme interface and utilities for molecule.dev",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "test": "vitest run",
11
+ "test:watch": "vitest"
12
+ },
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist"
21
+ ],
22
+ "keywords": [
23
+ "molecule",
24
+ "theme",
25
+ "styling",
26
+ "dark-mode"
27
+ ],
28
+ "license": "Apache-2.0",
29
+ "peerDependencies": {
30
+ "@molecule/app-bond": "^1.0.0"
31
+ },
32
+ "devDependencies": {
33
+ "@molecule/app-bond": "1.0.0",
34
+ "@types/node": "26.1.2",
35
+ "typescript": "6.0.3",
36
+ "vitest": "4.1.10"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/molecule-dev/molecule.git",
41
+ "directory": "packages/app/core/theme"
42
+ },
43
+ "homepage": "https://github.com/molecule-dev/molecule/tree/main/packages/app/core/theme",
44
+ "bugs": "https://github.com/molecule-dev/molecule/issues",
45
+ "publishConfig": {
46
+ "access": "public"
47
+ }
48
+ }