@easy-web/theme-core 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/README.md ADDED
@@ -0,0 +1,218 @@
1
+ # @easy-web/theme-core
2
+
3
+ Design system foundation for the easy-web ecosystem. This package provides semantic design tokens, color ramps, typography, and spacing constants as CSS custom properties and typed TypeScript objects.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @easy-web/theme-core
9
+ ```
10
+
11
+ This package is published to npm. Install it like any other npm package.
12
+
13
+ ## Setup
14
+
15
+ ### 1. Import CSS
16
+ Import the design tokens in your main entry file (e.g., `main.ts` or `app.tsx`).
17
+
18
+ ```typescript
19
+ import '@easy-web/theme-core/tokens.css';
20
+ ```
21
+
22
+ ### 2. Prevent Theme Flash (Optional)
23
+ To avoid a white flash during page load when using dark mode, inject the `noFlashScript` in your HTML `<head>` before the stylesheet.
24
+
25
+ ```typescript
26
+ import { noFlashScript } from '@easy-web/theme-core';
27
+
28
+ // In your root component or HTML template:
29
+ // <script dangerouslySetInnerHTML={{ __html: noFlashScript }} />
30
+ ```
31
+
32
+ **CSP Note:** This script requires `'unsafe-inline'` or a hash-based Content Security Policy.
33
+
34
+ ## Usage
35
+
36
+ ### CSS Variables
37
+ Use semantic variables in your CSS files.
38
+
39
+ ```css
40
+ .card {
41
+ background: var(--ew-surface);
42
+ color: var(--ew-on-surface);
43
+ border: 1px solid var(--ew-border);
44
+ border-radius: var(--ew-radius-md);
45
+ padding: var(--ew-space-4);
46
+ }
47
+ ```
48
+
49
+ ### TypeScript Tokens
50
+ Use the typed `tokens` object for CSS-in-JS or dynamic styles.
51
+
52
+ ```typescript
53
+ import { tokens } from '@easy-web/theme-core';
54
+
55
+ const styles = {
56
+ backgroundColor: tokens.color.surface,
57
+ color: tokens.color.onSurface,
58
+ fontSize: tokens.text.base,
59
+ };
60
+ ```
61
+
62
+ ## Theme Management
63
+
64
+ The system supports light and dark modes via the `data-theme` attribute on the `<html>` element. System preference is automatically detected via media query.
65
+
66
+ ### JavaScript API
67
+
68
+ ```typescript
69
+ import { applyTheme, getPreferredTheme } from '@easy-web/theme-core';
70
+
71
+ // Set theme manually (persists to localStorage)
72
+ applyTheme('dark');
73
+
74
+ // Reset to system preference
75
+ applyTheme('system');
76
+
77
+ // Get current setting
78
+ const current = getPreferredTheme();
79
+ ```
80
+
81
+ ### Manual Trigger
82
+ You can also toggle the theme manually by setting the attribute.
83
+
84
+ ```html
85
+ <html data-theme="dark">
86
+ ```
87
+
88
+ ## Token Reference
89
+
90
+ ### Semantic Colors
91
+ | Token | CSS Variable | Description |
92
+ |---|---|---|
93
+ | `color.surface` | `--ew-surface` | Main background color |
94
+ | `color.onSurface` | `--ew-on-surface` | Text color on surface |
95
+ | `color.surfaceMuted` | `--ew-surface-muted` | Subtle background for containers |
96
+ | `color.primary` | `--ew-primary` | Brand primary color |
97
+ | `color.onPrimary` | `--ew-on-primary` | Text color on primary |
98
+ | `color.border` | `--ew-border` | Default border color |
99
+ | `color.muted` | `--ew-muted` | De-emphasized text |
100
+ | `color.danger` | `--ew-danger` | Error/danger state |
101
+
102
+ ### Other Systems
103
+ - **Neutral Ramp:** `color.neutral[50-950]` / `--ew-neutral-[50-950]`
104
+ - **Primary Ramp:** `color.primaryRamp[50-950]` / `--ew-primary-[50-950]`
105
+ - **Typography:** `font.sans`, `font.mono`, `text.xs` to `text.3xl`
106
+ - **Spacing:** `space[0-12]` / `--ew-space-[0-12]`
107
+ - **Radius:** `radius.none`, `radius.sm`, `radius.md`, `radius.lg`, `radius.xl`, `radius.full`
108
+ - **Shadows:** `shadow.xs` to `shadow.2xl` + `shadow.inner` / `--ew-shadow-*`
109
+ - **Motion durations:** `motion.duration.instant` to `motion.duration.slower` / `--ew-duration-*`
110
+ - **Motion easings:** `motion.ease.default`, `.in`, `.out`, `.inOut`, `.spring` / `--ew-ease-*`
111
+ - **Z-index:** `zIndex.hide` to `zIndex.toast` (−1 to 1500) / `--ew-z-*`
112
+ - **Breakpoints:** `breakpoints.sm` to `breakpoints['2xl']` (raw px numbers) / `--ew-bp-*`
113
+
114
+ ### Shadow Scale
115
+ | Token | CSS Variable | Description |
116
+ |---|---|---|
117
+ | `shadow.xs` | `--ew-shadow-xs` | Very subtle elevation |
118
+ | `shadow.sm` | `--ew-shadow-sm` | Light card shadow |
119
+ | `shadow.md` | `--ew-shadow-md` | Standard elevation |
120
+ | `shadow.lg` | `--ew-shadow-lg` | Pronounced elevation |
121
+ | `shadow.xl` | `--ew-shadow-xl` | High elevation |
122
+ | `shadow.2xl` | `--ew-shadow-2xl` | Maximum elevation |
123
+ | `shadow.inner` | `--ew-shadow-inner` | Inset shadow |
124
+
125
+ Shadows automatically increase opacity in dark mode via the `--ew-shadow-color` primitive.
126
+
127
+ ```css
128
+ .card { box-shadow: var(--ew-shadow-md); }
129
+ ```
130
+
131
+ ### Motion Tokens
132
+ #### Durations
133
+ | Token | CSS Variable | Value |
134
+ |---|---|---|
135
+ | `motion.duration.instant` | `--ew-duration-instant` | 0ms |
136
+ | `motion.duration.fast` | `--ew-duration-fast` | 100ms |
137
+ | `motion.duration.normal` | `--ew-duration-normal` | 200ms |
138
+ | `motion.duration.moderate` | `--ew-duration-moderate` | 300ms |
139
+ | `motion.duration.slow` | `--ew-duration-slow` | 500ms |
140
+ | `motion.duration.slower` | `--ew-duration-slower` | 700ms |
141
+
142
+ All durations automatically reset to `0ms` under `prefers-reduced-motion: reduce`.
143
+
144
+ #### Easings
145
+ | Token | CSS Variable | Usage |
146
+ |---|---|---|
147
+ | `motion.ease.default` | `--ew-ease-default` | General purpose |
148
+ | `motion.ease.in` | `--ew-ease-in` | Accelerating |
149
+ | `motion.ease.out` | `--ew-ease-out` | Decelerating |
150
+ | `motion.ease.inOut` | `--ew-ease-in-out` | Smooth both ways |
151
+ | `motion.ease.spring` | `--ew-ease-spring` | Playful overshoot |
152
+
153
+ ```css
154
+ .menu { transition: transform var(--ew-duration-normal) var(--ew-ease-out); }
155
+ ```
156
+
157
+ ### Breakpoints
158
+ Breakpoints are raw pixel numbers — CSS variables **cannot** be used inside `@media` queries.
159
+
160
+ ```typescript
161
+ import { breakpoints } from '@easy-web/theme-core';
162
+ const isMobile = window.matchMedia(`(max-width: ${breakpoints.md}px)`).matches;
163
+ ```
164
+
165
+ | Export | Value | Tailwind |
166
+ |---|---|---|
167
+ | `breakpoints.sm` | 640 | `sm` |
168
+ | `breakpoints.md` | 768 | `md` |
169
+ | `breakpoints.lg` | 1024 | `lg` |
170
+ | `breakpoints.xl` | 1280 | `xl` |
171
+ | `breakpoints['2xl']` | 1536 | `2xl` |
172
+
173
+ CSS reference variables also available: `--ew-bp-sm`, `--ew-bp-md`, `--ew-bp-lg`, `--ew-bp-xl`, `--ew-bp-2xl`.
174
+
175
+ ### Z-Index Scale
176
+ | Token | CSS Variable | Value | Use case |
177
+ |---|---|---|---|
178
+ | `zIndex.hide` | `--ew-z-hide` | -1 | Hidden elements |
179
+ | `zIndex.base` | `--ew-z-base` | 0 | Default flow |
180
+ | `zIndex.raised` | `--ew-z-raised` | 1 | Slightly elevated |
181
+ | `zIndex.dropdown` | `--ew-z-dropdown` | 1000 | Dropdowns |
182
+ | `zIndex.sticky` | `--ew-z-sticky` | 1100 | Sticky headers |
183
+ | `zIndex.overlay` | `--ew-z-overlay` | 1200 | Background overlays |
184
+ | `zIndex.modal` | `--ew-z-modal` | 1300 | Modal dialogs |
185
+ | `zIndex.popover` | `--ew-z-popover` | 1400 | Floating tooltips |
186
+ | `zIndex.toast` | `--ew-z-toast` | 1500 | Toast notifications |
187
+
188
+ ```css
189
+ .header { position: sticky; z-index: var(--ew-z-sticky); }
190
+ .modal { z-index: var(--ew-z-modal); }
191
+ ```
192
+
193
+ ### Self-Hosted Fonts (Opt-in)
194
+ Import `fonts.css` to activate Inter Variable + JetBrains Mono Variable. Sites that do not import it continue to use the system font stack at zero cost.
195
+
196
+ **Step 1: Import the stylesheet** (after `tokens.css`)
197
+ ```typescript
198
+ import '@easy-web/theme-core/tokens.css';
199
+ import '@easy-web/theme-core/fonts.css';
200
+ ```
201
+
202
+ **Step 2: Add font files** to `public/fonts/`:
203
+ - `Inter-Variable.woff2` — [rsms/inter releases](https://github.com/rsms/inter/releases)
204
+ - `JetBrainsMono-Variable.woff2` — [JetBrains/JetBrainsMono releases](https://github.com/JetBrains/JetBrainsMono/releases)
205
+
206
+ **Step 3: Recommended — add preload hints in `<head>`**
207
+ ```html
208
+ <link rel="preload" as="font" href="/fonts/Inter-Variable.woff2" type="font/woff2" crossorigin>
209
+ <link rel="preload" as="font" href="/fonts/JetBrainsMono-Variable.woff2" type="font/woff2" crossorigin>
210
+ ```
211
+
212
+ ## Migration from v0.1
213
+
214
+ | Old Key (v0.1) | New Token (v0.3) | New CSS Variable |
215
+ |---|---|---|
216
+ | `theme.light.bg` | `tokens.color.surface` | `var(--ew-surface)` |
217
+ | `theme.light.fg` | `tokens.color.onSurface` | `var(--ew-on-surface)` |
218
+ | `theme.light.accent` | `tokens.color.primary` | `var(--ew-primary)` |
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bundle-budget.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle-budget.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/bundle-budget.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { statSync } from 'fs';
3
+ import { resolve } from 'path';
4
+ import { fileURLToPath } from 'url';
5
+ const __dirname = fileURLToPath(new URL('.', import.meta.url));
6
+ const root = resolve(__dirname, '../../');
7
+ describe('bundle budget', () => {
8
+ it('dist/index.js < 20KB', () => {
9
+ const stat = statSync(resolve(root, 'dist/index.js'));
10
+ expect(stat.size).toBeLessThan(20000);
11
+ });
12
+ it('styles/tokens.css < 8KB', () => {
13
+ const stat = statSync(resolve(root, 'styles/tokens.css'));
14
+ expect(stat.size).toBeLessThan(8000);
15
+ });
16
+ });
17
+ //# sourceMappingURL=bundle-budget.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle-budget.test.js","sourceRoot":"","sources":["../../src/__tests__/bundle-budget.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAE1C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC9B,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;QACtD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACjC,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC,CAAC;QAC1D,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=helper.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/helper.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,24 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { noFlashScript, getPreferredTheme } from '../helper.js';
3
+ describe('noFlashScript', () => {
4
+ it('is a non-empty string', () => {
5
+ expect(typeof noFlashScript).toBe('string');
6
+ expect(noFlashScript.length).toBeGreaterThan(0);
7
+ });
8
+ it('contains IIFE pattern', () => {
9
+ expect(noFlashScript).toContain('(function()');
10
+ });
11
+ it('references ew-theme storage key', () => {
12
+ expect(noFlashScript).toContain('ew-theme');
13
+ });
14
+ it('sets data-theme attribute', () => {
15
+ expect(noFlashScript).toContain('dataset');
16
+ });
17
+ });
18
+ describe('getPreferredTheme', () => {
19
+ it('returns system when no window (SSR/Node)', () => {
20
+ const result = getPreferredTheme();
21
+ expect(result).toBe('system');
22
+ });
23
+ });
24
+ //# sourceMappingURL=helper.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.test.js","sourceRoot":"","sources":["../../src/__tests__/helper.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEhE,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,CAAC,OAAO,aAAa,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACzC,MAAM,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,MAAM,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,MAAM,GAAG,iBAAiB,EAAE,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=theme.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/theme.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,14 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { tokens } from "../index.js";
3
+ describe("index re-exports", () => {
4
+ it("re-exports tokens.color.surface", () => {
5
+ expect(tokens.color.surface).toBe("var(--ew-surface)");
6
+ });
7
+ it("re-exports tokens.space[4]", () => {
8
+ expect(tokens.space[4]).toBe("var(--ew-space-4)");
9
+ });
10
+ it("re-exports tokens.radius.md", () => {
11
+ expect(tokens.radius.md).toBe("var(--ew-radius-md)");
12
+ });
13
+ });
14
+ //# sourceMappingURL=theme.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.test.js","sourceRoot":"","sources":["../../src/__tests__/theme.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACtC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=tokens.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/tokens.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,34 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { tokens } from '../tokens.js';
3
+ describe('tokens', () => {
4
+ it('color.surface is a CSS var string', () => {
5
+ expect(tokens.color.surface).toBe('var(--ew-surface)');
6
+ });
7
+ it('color.primary is a CSS var string', () => {
8
+ expect(tokens.color.primary).toBe('var(--ew-primary)');
9
+ });
10
+ it('space.4 is a CSS var string', () => {
11
+ expect(tokens.space[4]).toBe('var(--ew-space-4)');
12
+ });
13
+ it('radius.md is a CSS var string', () => {
14
+ expect(tokens.radius.md).toBe('var(--ew-radius-md)');
15
+ });
16
+ it('color.danger is a CSS var string', () => {
17
+ expect(tokens.color.danger).toBe('var(--ew-danger)');
18
+ });
19
+ it('font.sans is a CSS var string', () => {
20
+ expect(tokens.font.sans).toBe('var(--ew-font-sans)');
21
+ });
22
+ it('text.base is a CSS var string', () => {
23
+ expect(tokens.text.base).toBe('var(--ew-text-base)');
24
+ });
25
+ it('leading.normal is a CSS var string', () => {
26
+ expect(tokens.leading.normal).toBe('var(--ew-leading-normal)');
27
+ });
28
+ // Token-name stability snapshot
29
+ it('token keys are stable (snapshot)', () => {
30
+ const allKeys = JSON.stringify(tokens, null, 2);
31
+ expect(allKeys).toMatchSnapshot();
32
+ });
33
+ });
34
+ //# sourceMappingURL=tokens.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.test.js","sourceRoot":"","sources":["../../src/__tests__/tokens.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QAC3C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACpD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACvD,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IACH,gCAAgC;IAChC,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QAChD,MAAM,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Breakpoint values (Tailwind-compatible)
3
+ *
4
+ * These are raw pixel values, NOT CSS custom properties.
5
+ * CSS custom properties cannot be used in @media queries directly.
6
+ *
7
+ * Usage:
8
+ * import { breakpoints } from '@easy-web/theme-core';
9
+ * const isMobile = window.matchMedia(`(max-width: ${breakpoints.md}px)`).matches;
10
+ */
11
+ export declare const breakpoints: {
12
+ readonly sm: 640;
13
+ readonly md: 768;
14
+ readonly lg: 1024;
15
+ readonly xl: 1280;
16
+ readonly '2xl': 1536;
17
+ };
18
+ export type Breakpoint = keyof typeof breakpoints;
19
+ //# sourceMappingURL=breakpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../src/breakpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Breakpoint values (Tailwind-compatible)
3
+ *
4
+ * These are raw pixel values, NOT CSS custom properties.
5
+ * CSS custom properties cannot be used in @media queries directly.
6
+ *
7
+ * Usage:
8
+ * import { breakpoints } from '@easy-web/theme-core';
9
+ * const isMobile = window.matchMedia(`(max-width: ${breakpoints.md}px)`).matches;
10
+ */
11
+ export const breakpoints = {
12
+ sm: 640,
13
+ md: 768,
14
+ lg: 1024,
15
+ xl: 1280,
16
+ '2xl': 1536,
17
+ };
18
+ //# sourceMappingURL=breakpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.js","sourceRoot":"","sources":["../src/breakpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,KAAK,EAAE,IAAI;CACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type Theme = 'light' | 'dark' | 'system';
2
+ export declare function applyTheme(theme: Theme): void;
3
+ export declare function getPreferredTheme(): Theme;
4
+ export declare function subscribeToSystem(cb: (isDark: boolean) => void): () => void;
5
+ export declare const noFlashScript: string;
6
+ //# sourceMappingURL=helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAA;AAI/C,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAS7C;AAED,wBAAgB,iBAAiB,IAAI,KAAK,CAKzC;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAM3E;AAED,eAAO,MAAM,aAAa,EAAE,MACmH,CAAA"}
package/dist/helper.js ADDED
@@ -0,0 +1,31 @@
1
+ const STORAGE_KEY = 'ew-theme';
2
+ export function applyTheme(theme) {
3
+ if (typeof window === 'undefined')
4
+ return;
5
+ if (theme === 'system') {
6
+ delete document.documentElement.dataset['theme'];
7
+ localStorage.removeItem(STORAGE_KEY);
8
+ }
9
+ else {
10
+ document.documentElement.dataset['theme'] = theme;
11
+ localStorage.setItem(STORAGE_KEY, theme);
12
+ }
13
+ }
14
+ export function getPreferredTheme() {
15
+ if (typeof window === 'undefined')
16
+ return 'system';
17
+ const stored = localStorage.getItem(STORAGE_KEY);
18
+ if (stored === 'light' || stored === 'dark')
19
+ return stored;
20
+ return 'system';
21
+ }
22
+ export function subscribeToSystem(cb) {
23
+ if (typeof window === 'undefined')
24
+ return () => { };
25
+ const mq = window.matchMedia('(prefers-color-scheme: dark)');
26
+ const handler = (e) => cb(e.matches);
27
+ mq.addEventListener('change', handler);
28
+ return () => mq.removeEventListener('change', handler);
29
+ }
30
+ export const noFlashScript = `(function(){try{var s=localStorage.getItem('ew-theme');if(s==='light'||s==='dark'){document.documentElement.dataset.theme=s}}catch(e){}})()`;
31
+ //# sourceMappingURL=helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper.js","sourceRoot":"","sources":["../src/helper.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG,UAAU,CAAA;AAE9B,MAAM,UAAU,UAAU,CAAC,KAAY;IACrC,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAM;IACzC,IAAI,KAAK,KAAK,QAAQ,EAAE,CAAC;QACvB,OAAO,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAChD,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAA;IACtC,CAAC;SAAM,CAAC;QACN,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,KAAK,CAAA;QACjD,YAAY,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,CAAC,CAAA;IAC1C,CAAC;AACH,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,QAAQ,CAAA;IAClD,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,CAAA;IAChD,IAAI,MAAM,KAAK,OAAO,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,MAAM,CAAA;IAC1D,OAAO,QAAQ,CAAA;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,EAA6B;IAC7D,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAA;IAClD,MAAM,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAA;IAC5D,MAAM,OAAO,GAAG,CAAC,CAAsB,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACzD,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACtC,OAAO,GAAG,EAAE,CAAC,EAAE,CAAC,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;AACxD,CAAC;AAED,MAAM,CAAC,MAAM,aAAa,GACxB,6IAA6I,CAAA"}
@@ -0,0 +1,4 @@
1
+ export { applyTheme, getPreferredTheme, noFlashScript, subscribeToSystem, type Theme, } from "./helper.js";
2
+ export { type Tokens, tokens } from "./tokens.js";
3
+ export { breakpoints, type Breakpoint } from './breakpoints.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,KAAK,KAAK,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export { applyTheme, getPreferredTheme, noFlashScript, subscribeToSystem, } from "./helper.js";
2
+ export { tokens } from "./tokens.js";
3
+ export { breakpoints } from './breakpoints.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,iBAAiB,GAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAe,MAAM,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,WAAW,EAAmB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,119 @@
1
+ export declare const tokens: {
2
+ readonly color: {
3
+ readonly surface: "var(--ew-surface)";
4
+ readonly onSurface: "var(--ew-on-surface)";
5
+ readonly surfaceMuted: "var(--ew-surface-muted)";
6
+ readonly primary: "var(--ew-primary)";
7
+ readonly onPrimary: "var(--ew-on-primary)";
8
+ readonly border: "var(--ew-border)";
9
+ readonly muted: "var(--ew-muted)";
10
+ readonly danger: "var(--ew-danger)";
11
+ readonly onDanger: "var(--ew-on-danger)";
12
+ readonly accent: "var(--ew-accent)";
13
+ readonly neutral: {
14
+ readonly 50: "var(--ew-neutral-50)";
15
+ readonly 100: "var(--ew-neutral-100)";
16
+ readonly 200: "var(--ew-neutral-200)";
17
+ readonly 300: "var(--ew-neutral-300)";
18
+ readonly 400: "var(--ew-neutral-400)";
19
+ readonly 500: "var(--ew-neutral-500)";
20
+ readonly 600: "var(--ew-neutral-600)";
21
+ readonly 700: "var(--ew-neutral-700)";
22
+ readonly 800: "var(--ew-neutral-800)";
23
+ readonly 900: "var(--ew-neutral-900)";
24
+ readonly 950: "var(--ew-neutral-950)";
25
+ };
26
+ readonly primaryRamp: {
27
+ readonly 50: "var(--ew-primary-50)";
28
+ readonly 100: "var(--ew-primary-100)";
29
+ readonly 200: "var(--ew-primary-200)";
30
+ readonly 300: "var(--ew-primary-300)";
31
+ readonly 400: "var(--ew-primary-400)";
32
+ readonly 500: "var(--ew-primary-500)";
33
+ readonly 600: "var(--ew-primary-600)";
34
+ readonly 700: "var(--ew-primary-700)";
35
+ readonly 800: "var(--ew-primary-800)";
36
+ readonly 900: "var(--ew-primary-900)";
37
+ readonly 950: "var(--ew-primary-950)";
38
+ };
39
+ };
40
+ readonly font: {
41
+ readonly sans: "var(--ew-font-sans)";
42
+ readonly mono: "var(--ew-font-mono)";
43
+ };
44
+ readonly text: {
45
+ readonly xs: "var(--ew-text-xs)";
46
+ readonly sm: "var(--ew-text-sm)";
47
+ readonly base: "var(--ew-text-base)";
48
+ readonly lg: "var(--ew-text-lg)";
49
+ readonly xl: "var(--ew-text-xl)";
50
+ readonly '3xl': "var(--ew-text-3xl)";
51
+ };
52
+ readonly leading: {
53
+ readonly tight: "var(--ew-leading-tight)";
54
+ readonly normal: "var(--ew-leading-normal)";
55
+ readonly loose: "var(--ew-leading-loose)";
56
+ };
57
+ readonly space: {
58
+ readonly 0: "var(--ew-space-0)";
59
+ readonly 1: "var(--ew-space-1)";
60
+ readonly 2: "var(--ew-space-2)";
61
+ readonly 3: "var(--ew-space-3)";
62
+ readonly 4: "var(--ew-space-4)";
63
+ readonly 5: "var(--ew-space-5)";
64
+ readonly 6: "var(--ew-space-6)";
65
+ readonly 7: "var(--ew-space-7)";
66
+ readonly 8: "var(--ew-space-8)";
67
+ readonly 9: "var(--ew-space-9)";
68
+ readonly 10: "var(--ew-space-10)";
69
+ readonly 11: "var(--ew-space-11)";
70
+ readonly 12: "var(--ew-space-12)";
71
+ };
72
+ readonly radius: {
73
+ readonly none: "var(--ew-radius-none)";
74
+ readonly sm: "var(--ew-radius-sm)";
75
+ readonly md: "var(--ew-radius-md)";
76
+ readonly lg: "var(--ew-radius-lg)";
77
+ readonly xl: "var(--ew-radius-xl)";
78
+ readonly full: "var(--ew-radius-full)";
79
+ };
80
+ readonly shadow: {
81
+ readonly xs: "var(--ew-shadow-xs)";
82
+ readonly sm: "var(--ew-shadow-sm)";
83
+ readonly md: "var(--ew-shadow-md)";
84
+ readonly lg: "var(--ew-shadow-lg)";
85
+ readonly xl: "var(--ew-shadow-xl)";
86
+ readonly '2xl': "var(--ew-shadow-2xl)";
87
+ readonly inner: "var(--ew-shadow-inner)";
88
+ };
89
+ readonly motion: {
90
+ readonly duration: {
91
+ readonly instant: "var(--ew-duration-instant)";
92
+ readonly fast: "var(--ew-duration-fast)";
93
+ readonly normal: "var(--ew-duration-normal)";
94
+ readonly moderate: "var(--ew-duration-moderate)";
95
+ readonly slow: "var(--ew-duration-slow)";
96
+ readonly slower: "var(--ew-duration-slower)";
97
+ };
98
+ readonly ease: {
99
+ readonly default: "var(--ew-ease-default)";
100
+ readonly in: "var(--ew-ease-in)";
101
+ readonly out: "var(--ew-ease-out)";
102
+ readonly inOut: "var(--ew-ease-in-out)";
103
+ readonly spring: "var(--ew-ease-spring)";
104
+ };
105
+ };
106
+ readonly zIndex: {
107
+ readonly hide: "var(--ew-z-hide)";
108
+ readonly base: "var(--ew-z-base)";
109
+ readonly raised: "var(--ew-z-raised)";
110
+ readonly dropdown: "var(--ew-z-dropdown)";
111
+ readonly sticky: "var(--ew-z-sticky)";
112
+ readonly overlay: "var(--ew-z-overlay)";
113
+ readonly modal: "var(--ew-z-modal)";
114
+ readonly popover: "var(--ew-z-popover)";
115
+ readonly toast: "var(--ew-z-toast)";
116
+ };
117
+ };
118
+ export type Tokens = typeof tokens;
119
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoHT,CAAC;AAEX,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC"}
package/dist/tokens.js ADDED
@@ -0,0 +1,118 @@
1
+ export const tokens = {
2
+ color: {
3
+ surface: 'var(--ew-surface)',
4
+ onSurface: 'var(--ew-on-surface)',
5
+ surfaceMuted: 'var(--ew-surface-muted)',
6
+ primary: 'var(--ew-primary)',
7
+ onPrimary: 'var(--ew-on-primary)',
8
+ border: 'var(--ew-border)',
9
+ muted: 'var(--ew-muted)',
10
+ danger: 'var(--ew-danger)',
11
+ onDanger: 'var(--ew-on-danger)',
12
+ accent: 'var(--ew-accent)',
13
+ neutral: {
14
+ 50: 'var(--ew-neutral-50)',
15
+ 100: 'var(--ew-neutral-100)',
16
+ 200: 'var(--ew-neutral-200)',
17
+ 300: 'var(--ew-neutral-300)',
18
+ 400: 'var(--ew-neutral-400)',
19
+ 500: 'var(--ew-neutral-500)',
20
+ 600: 'var(--ew-neutral-600)',
21
+ 700: 'var(--ew-neutral-700)',
22
+ 800: 'var(--ew-neutral-800)',
23
+ 900: 'var(--ew-neutral-900)',
24
+ 950: 'var(--ew-neutral-950)',
25
+ },
26
+ primaryRamp: {
27
+ 50: 'var(--ew-primary-50)',
28
+ 100: 'var(--ew-primary-100)',
29
+ 200: 'var(--ew-primary-200)',
30
+ 300: 'var(--ew-primary-300)',
31
+ 400: 'var(--ew-primary-400)',
32
+ 500: 'var(--ew-primary-500)',
33
+ 600: 'var(--ew-primary-600)',
34
+ 700: 'var(--ew-primary-700)',
35
+ 800: 'var(--ew-primary-800)',
36
+ 900: 'var(--ew-primary-900)',
37
+ 950: 'var(--ew-primary-950)',
38
+ },
39
+ },
40
+ font: {
41
+ sans: 'var(--ew-font-sans)',
42
+ mono: 'var(--ew-font-mono)',
43
+ },
44
+ text: {
45
+ xs: 'var(--ew-text-xs)',
46
+ sm: 'var(--ew-text-sm)',
47
+ base: 'var(--ew-text-base)',
48
+ lg: 'var(--ew-text-lg)',
49
+ xl: 'var(--ew-text-xl)',
50
+ '3xl': 'var(--ew-text-3xl)',
51
+ },
52
+ leading: {
53
+ tight: 'var(--ew-leading-tight)',
54
+ normal: 'var(--ew-leading-normal)',
55
+ loose: 'var(--ew-leading-loose)',
56
+ },
57
+ space: {
58
+ 0: 'var(--ew-space-0)',
59
+ 1: 'var(--ew-space-1)',
60
+ 2: 'var(--ew-space-2)',
61
+ 3: 'var(--ew-space-3)',
62
+ 4: 'var(--ew-space-4)',
63
+ 5: 'var(--ew-space-5)',
64
+ 6: 'var(--ew-space-6)',
65
+ 7: 'var(--ew-space-7)',
66
+ 8: 'var(--ew-space-8)',
67
+ 9: 'var(--ew-space-9)',
68
+ 10: 'var(--ew-space-10)',
69
+ 11: 'var(--ew-space-11)',
70
+ 12: 'var(--ew-space-12)',
71
+ },
72
+ radius: {
73
+ none: 'var(--ew-radius-none)',
74
+ sm: 'var(--ew-radius-sm)',
75
+ md: 'var(--ew-radius-md)',
76
+ lg: 'var(--ew-radius-lg)',
77
+ xl: 'var(--ew-radius-xl)',
78
+ full: 'var(--ew-radius-full)',
79
+ },
80
+ shadow: {
81
+ xs: 'var(--ew-shadow-xs)',
82
+ sm: 'var(--ew-shadow-sm)',
83
+ md: 'var(--ew-shadow-md)',
84
+ lg: 'var(--ew-shadow-lg)',
85
+ xl: 'var(--ew-shadow-xl)',
86
+ '2xl': 'var(--ew-shadow-2xl)',
87
+ inner: 'var(--ew-shadow-inner)',
88
+ },
89
+ motion: {
90
+ duration: {
91
+ instant: 'var(--ew-duration-instant)',
92
+ fast: 'var(--ew-duration-fast)',
93
+ normal: 'var(--ew-duration-normal)',
94
+ moderate: 'var(--ew-duration-moderate)',
95
+ slow: 'var(--ew-duration-slow)',
96
+ slower: 'var(--ew-duration-slower)',
97
+ },
98
+ ease: {
99
+ default: 'var(--ew-ease-default)',
100
+ in: 'var(--ew-ease-in)',
101
+ out: 'var(--ew-ease-out)',
102
+ inOut: 'var(--ew-ease-in-out)',
103
+ spring: 'var(--ew-ease-spring)',
104
+ },
105
+ },
106
+ zIndex: {
107
+ hide: 'var(--ew-z-hide)',
108
+ base: 'var(--ew-z-base)',
109
+ raised: 'var(--ew-z-raised)',
110
+ dropdown: 'var(--ew-z-dropdown)',
111
+ sticky: 'var(--ew-z-sticky)',
112
+ overlay: 'var(--ew-z-overlay)',
113
+ modal: 'var(--ew-z-modal)',
114
+ popover: 'var(--ew-z-popover)',
115
+ toast: 'var(--ew-z-toast)',
116
+ },
117
+ };
118
+ //# sourceMappingURL=tokens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"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"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@easy-web/theme-core",
3
+ "version": "1.0.0",
4
+ "packageManager": "pnpm@10.34.4",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "import": "./dist/index.js"
10
+ },
11
+ "./tokens.css": "./styles/tokens.css",
12
+ "./fonts.css": "./styles/fonts.css"
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "styles",
17
+ "README.md"
18
+ ],
19
+ "sideEffects": [
20
+ "*.css"
21
+ ],
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "test": "vitest run",
25
+ "lint": "eslint src",
26
+ "typecheck": "tsc --noEmit"
27
+ },
28
+ "devDependencies": {
29
+ "vitest": "^3.2.4",
30
+ "@vitest/coverage-v8": "^3.2.4",
31
+ "typescript": "^5.5.0"
32
+ },
33
+ "publishConfig": {
34
+ "access": "public",
35
+ "provenance": true
36
+ },
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/achimismaili/easy-web.git",
40
+ "directory": "packages/theme-core"
41
+ },
42
+ "license": "MIT"
43
+ }
@@ -0,0 +1,45 @@
1
+ /**
2
+ * @easy-web/theme-core — Opt-in self-hosted fonts
3
+ *
4
+ * Import AFTER tokens.css to activate Inter and JetBrains Mono.
5
+ * Instances must also provide font files at the paths below.
6
+ *
7
+ * Usage (in your layout):
8
+ * import '@easy-web/theme-core/tokens.css';
9
+ * import '@easy-web/theme-core/fonts.css';
10
+ *
11
+ * Place these files in your site's public/fonts/ directory:
12
+ * public/fonts/Inter-Variable.woff2
13
+ * public/fonts/JetBrainsMono-Variable.woff2
14
+ *
15
+ * Download Inter Variable from:
16
+ * https://github.com/rsms/inter/releases (Inter.var.woff2)
17
+ * Download JetBrains Mono Variable from:
18
+ * https://github.com/JetBrains/JetBrainsMono/releases (JetBrainsMono[wght].woff2)
19
+ *
20
+ * For best performance, add preload links in your <head>:
21
+ * <link rel="preload" as="font" href="/fonts/Inter-Variable.woff2" type="font/woff2" crossorigin>
22
+ * <link rel="preload" as="font" href="/fonts/JetBrainsMono-Variable.woff2" type="font/woff2" crossorigin>
23
+ */
24
+
25
+ @font-face {
26
+ font-family: 'Inter Variable';
27
+ src: url('/fonts/Inter-Variable.woff2') format('woff2-variations');
28
+ font-weight: 100 900;
29
+ font-style: normal;
30
+ font-display: swap;
31
+ }
32
+
33
+ @font-face {
34
+ font-family: 'JetBrains Mono Variable';
35
+ src: url('/fonts/JetBrainsMono-Variable.woff2') format('woff2-variations');
36
+ font-weight: 100 800;
37
+ font-style: normal;
38
+ font-display: swap;
39
+ }
40
+
41
+ /* Override font-family variables to use the self-hosted fonts */
42
+ :root {
43
+ --ew-font-sans: 'Inter Variable', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
44
+ --ew-font-mono: 'JetBrains Mono Variable', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
45
+ }
@@ -0,0 +1,173 @@
1
+ :root {
2
+ --ew-surface: #ffffff;
3
+ --ew-on-surface: #111827;
4
+ --ew-surface-muted: #f3f4f6;
5
+ --ew-primary: #2563eb;
6
+ --ew-on-primary: #ffffff;
7
+ --ew-border: #d1d5db;
8
+ --ew-muted: #6b7280;
9
+ --ew-danger: #dc2626;
10
+ --ew-on-danger: #ffffff;
11
+ --ew-accent: #f59e0b;
12
+
13
+ --ew-neutral-50: #f9fafb;
14
+ --ew-neutral-100: #f3f4f6;
15
+ --ew-neutral-200: #e5e7eb;
16
+ --ew-neutral-300: #d1d5db;
17
+ --ew-neutral-400: #9ca3af;
18
+ --ew-neutral-500: #6b7280;
19
+ --ew-neutral-600: #4b5563;
20
+ --ew-neutral-700: #374151;
21
+ --ew-neutral-800: #1f2937;
22
+ --ew-neutral-900: #111827;
23
+ --ew-neutral-950: #030712;
24
+
25
+ --ew-primary-50: #eff6ff;
26
+ --ew-primary-100: #dbeafe;
27
+ --ew-primary-200: #bfdbfe;
28
+ --ew-primary-300: #93c5fd;
29
+ --ew-primary-400: #60a5fa;
30
+ --ew-primary-500: #3b82f6;
31
+ --ew-primary-600: #2563eb;
32
+ --ew-primary-700: #1d4ed8;
33
+ --ew-primary-800: #1e40af;
34
+ --ew-primary-900: #1e3a8a;
35
+ --ew-primary-950: #172554;
36
+
37
+ --ew-font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
38
+ --ew-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
39
+
40
+ --ew-text-xs: clamp(0.75rem, 0.72rem + 0.12vw, 0.8125rem);
41
+ --ew-text-sm: clamp(0.875rem, 0.84rem + 0.14vw, 0.9375rem);
42
+ --ew-text-base: clamp(1rem, 0.96rem + 0.16vw, 1.0625rem);
43
+ --ew-text-lg: clamp(1.125rem, 1.08rem + 0.2vw, 1.25rem);
44
+ --ew-text-xl: clamp(1.25rem, 1.18rem + 0.28vw, 1.5rem);
45
+ --ew-text-3xl: clamp(1.875rem, 1.72rem + 0.62vw, 2.5rem);
46
+
47
+ --ew-leading-tight: 1.25;
48
+ --ew-leading-normal: 1.5;
49
+ --ew-leading-loose: 1.75;
50
+
51
+ --ew-space-0: 0rem;
52
+ --ew-space-1: 0.25rem;
53
+ --ew-space-2: 0.5rem;
54
+ --ew-space-3: 0.75rem;
55
+ --ew-space-4: 1rem;
56
+ --ew-space-5: 1.5rem;
57
+ --ew-space-6: 2rem;
58
+ --ew-space-7: 3rem;
59
+ --ew-space-8: 4rem;
60
+ --ew-space-9: 6rem;
61
+ --ew-space-10: 8rem;
62
+ --ew-space-11: 12rem;
63
+ --ew-space-12: 16rem;
64
+
65
+ --ew-radius-none: 0;
66
+ --ew-radius-sm: 0.125rem;
67
+ --ew-radius-md: 0.375rem;
68
+ --ew-radius-lg: 0.5rem;
69
+ --ew-radius-xl: 0.75rem;
70
+ --ew-radius-full: 9999px;
71
+
72
+ /* Shadows */
73
+ --ew-shadow-color: 0 0 0;
74
+ --ew-shadow-xs: 0 1px 2px rgb(var(--ew-shadow-color) / 0.05);
75
+ --ew-shadow-sm: 0 1px 3px rgb(var(--ew-shadow-color) / 0.10), 0 1px 2px rgb(var(--ew-shadow-color) / 0.06);
76
+ --ew-shadow-md: 0 4px 6px rgb(var(--ew-shadow-color) / 0.07), 0 2px 4px rgb(var(--ew-shadow-color) / 0.06);
77
+ --ew-shadow-lg: 0 10px 15px rgb(var(--ew-shadow-color) / 0.10), 0 4px 6px rgb(var(--ew-shadow-color) / 0.05);
78
+ --ew-shadow-xl: 0 20px 25px rgb(var(--ew-shadow-color) / 0.10), 0 8px 10px rgb(var(--ew-shadow-color) / 0.04);
79
+ --ew-shadow-2xl: 0 25px 50px rgb(var(--ew-shadow-color) / 0.25);
80
+ --ew-shadow-inner: inset 0 2px 4px rgb(var(--ew-shadow-color) / 0.06);
81
+
82
+ /* Motion — Durations */
83
+ --ew-duration-instant: 0ms;
84
+ --ew-duration-fast: 100ms;
85
+ --ew-duration-normal: 200ms;
86
+ --ew-duration-moderate: 300ms;
87
+ --ew-duration-slow: 500ms;
88
+ --ew-duration-slower: 700ms;
89
+
90
+ /* Motion — Easings */
91
+ --ew-ease-default: cubic-bezier(0.4, 0, 0.2, 1);
92
+ --ew-ease-in: cubic-bezier(0.4, 0, 1, 1);
93
+ --ew-ease-out: cubic-bezier(0, 0, 0.2, 1);
94
+ --ew-ease-in-out: cubic-bezier(0.4, 0, 0.6, 1);
95
+ --ew-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
96
+
97
+ /* Breakpoints (Tailwind-compatible — note: CSS vars cannot be used in @media queries; use as reference values) */
98
+ --ew-bp-sm: 640px;
99
+ --ew-bp-md: 768px;
100
+ --ew-bp-lg: 1024px;
101
+ --ew-bp-xl: 1280px;
102
+ --ew-bp-2xl: 1536px;
103
+
104
+ /* Z-Index Scale */
105
+ --ew-z-hide: -1;
106
+ --ew-z-base: 0;
107
+ --ew-z-raised: 1;
108
+ --ew-z-dropdown: 1000;
109
+ --ew-z-sticky: 1100;
110
+ --ew-z-overlay: 1200;
111
+ --ew-z-modal: 1300;
112
+ --ew-z-popover: 1400;
113
+ --ew-z-toast: 1500;
114
+ }
115
+
116
+ [data-theme="dark"] {
117
+ --ew-surface: #111827;
118
+ --ew-on-surface: #f9fafb;
119
+ --ew-surface-muted: #1f2937;
120
+ --ew-primary: #60a5fa;
121
+ --ew-on-primary: #08111f;
122
+ --ew-border: #374151;
123
+ --ew-muted: #9ca3af;
124
+ --ew-danger: #f87171;
125
+ --ew-on-danger: #190404;
126
+ --ew-accent: #fbbf24;
127
+
128
+ /* Shadow color — brighter in dark mode so shadows remain visible */
129
+ --ew-shadow-color: 0 0 0;
130
+ --ew-shadow-xs: 0 1px 2px rgb(var(--ew-shadow-color) / 0.30);
131
+ --ew-shadow-sm: 0 1px 3px rgb(var(--ew-shadow-color) / 0.40), 0 1px 2px rgb(var(--ew-shadow-color) / 0.30);
132
+ --ew-shadow-md: 0 4px 6px rgb(var(--ew-shadow-color) / 0.35), 0 2px 4px rgb(var(--ew-shadow-color) / 0.30);
133
+ --ew-shadow-lg: 0 10px 15px rgb(var(--ew-shadow-color) / 0.40), 0 4px 6px rgb(var(--ew-shadow-color) / 0.25);
134
+ --ew-shadow-xl: 0 20px 25px rgb(var(--ew-shadow-color) / 0.40), 0 8px 10px rgb(var(--ew-shadow-color) / 0.20);
135
+ --ew-shadow-2xl: 0 25px 50px rgb(var(--ew-shadow-color) / 0.55);
136
+ --ew-shadow-inner: inset 0 2px 4px rgb(var(--ew-shadow-color) / 0.30);
137
+ }
138
+
139
+ @media (prefers-color-scheme: dark) {
140
+ :root:not([data-theme="light"]) {
141
+ --ew-surface: #111827;
142
+ --ew-on-surface: #f9fafb;
143
+ --ew-surface-muted: #1f2937;
144
+ --ew-primary: #60a5fa;
145
+ --ew-on-primary: #08111f;
146
+ --ew-border: #374151;
147
+ --ew-muted: #9ca3af;
148
+ --ew-danger: #f87171;
149
+ --ew-on-danger: #190404;
150
+ --ew-accent: #fbbf24;
151
+
152
+ /* Shadow color — brighter in dark mode so shadows remain visible */
153
+ --ew-shadow-color: 0 0 0;
154
+ --ew-shadow-xs: 0 1px 2px rgb(var(--ew-shadow-color) / 0.30);
155
+ --ew-shadow-sm: 0 1px 3px rgb(var(--ew-shadow-color) / 0.40), 0 1px 2px rgb(var(--ew-shadow-color) / 0.30);
156
+ --ew-shadow-md: 0 4px 6px rgb(var(--ew-shadow-color) / 0.35), 0 2px 4px rgb(var(--ew-shadow-color) / 0.30);
157
+ --ew-shadow-lg: 0 10px 15px rgb(var(--ew-shadow-color) / 0.40), 0 4px 6px rgb(var(--ew-shadow-color) / 0.25);
158
+ --ew-shadow-xl: 0 20px 25px rgb(var(--ew-shadow-color) / 0.40), 0 8px 10px rgb(var(--ew-shadow-color) / 0.20);
159
+ --ew-shadow-2xl: 0 25px 50px rgb(var(--ew-shadow-color) / 0.55);
160
+ --ew-shadow-inner: inset 0 2px 4px rgb(var(--ew-shadow-color) / 0.30);
161
+ }
162
+ }
163
+
164
+ @media (prefers-reduced-motion: reduce) {
165
+ :root {
166
+ --ew-duration-instant: 0ms;
167
+ --ew-duration-fast: 0ms;
168
+ --ew-duration-normal: 0ms;
169
+ --ew-duration-moderate: 0ms;
170
+ --ew-duration-slow: 0ms;
171
+ --ew-duration-slower: 0ms;
172
+ }
173
+ }