@fylib/theme 0.1.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.
@@ -0,0 +1,409 @@
1
+ export const defaultTheme = {
2
+ name: 'default',
3
+ backgroundEffect: {
4
+ name: 'particles',
5
+ intensity: 40,
6
+ speed: 0.5,
7
+ loop: true
8
+ },
9
+ wallpaper: {
10
+ name: 'geometric',
11
+ type: 'pattern',
12
+ opacity: 0.05
13
+ },
14
+ tokens: {
15
+ colors: {
16
+ primary: '#3b82f6',
17
+ secondary: '#64748b',
18
+ success: '#22c55e',
19
+ danger: '#ef4444',
20
+ warning: '#f59e0b',
21
+ info: '#3b82f6',
22
+ white: '#ffffff',
23
+ black: '#000000',
24
+ background: '#ffffff',
25
+ text: '#1f2937',
26
+ 'primary-rgb': '59, 130, 246',
27
+ surface: '#dfe9f5'
28
+ },
29
+ spacing: {
30
+ xs: '4px',
31
+ sm: '8px',
32
+ md: '16px',
33
+ lg: '24px',
34
+ xl: '32px',
35
+ },
36
+ borderRadius: {
37
+ sm: '4px',
38
+ md: '8px',
39
+ lg: '12px',
40
+ full: '9999px',
41
+ },
42
+ typography: {
43
+ fontFamily: {
44
+ base: '"Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
45
+ heading: '"Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',
46
+ mono: '"JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'
47
+ },
48
+ fontSize: {
49
+ sm: '12px',
50
+ md: '16px',
51
+ lg: '20px',
52
+ },
53
+ fontWeight: {
54
+ normal: '400',
55
+ bold: '700',
56
+ }
57
+ },
58
+ layout: {
59
+ app: {
60
+ gap: '0'
61
+ },
62
+ header: {
63
+ height: '64px',
64
+ padding: '0 24px',
65
+ background: 'transparent',
66
+ shadow: '0 1px 0 rgba(0,0,0,0.06)',
67
+ toggle: {
68
+ background: 'var(--fy-colors-primary)',
69
+ textColor: 'var(--fy-colors-white)',
70
+ borderRadius: '5px',
71
+ borderWidth: '1px',
72
+ borderColor: "white",
73
+ icon: 'menu'
74
+ },
75
+ logoFilterDarkOpacity: '0.85'
76
+ },
77
+ sidebar: {
78
+ width: '260px',
79
+ padding: '16px 0',
80
+ background: 'transparent',
81
+ toggle: {
82
+ background: 'var(--fy-colors-primary)',
83
+ textColor: 'var(--fy-colors-white)',
84
+ borderRadius: '5px',
85
+ borderColor: "var(--fy-colors-white)",
86
+ icon: 'menu',
87
+ mode: 'floating',
88
+ tonguePosition: 'bottom'
89
+ },
90
+ logoFilterDarkOpacity: '0.85'
91
+ },
92
+ content: {
93
+ padding: '24px'
94
+ }
95
+ },
96
+ effects: {
97
+ button: {
98
+ background: 'var(--fy-colors-primary)',
99
+ borderColor: 'transparent',
100
+ shadow: 'none',
101
+ textColor: 'var(--fy-colors-white)'
102
+ },
103
+ window: {
104
+ background: 'var(--fy-colors-background)',
105
+ shadow: '0 1px 3px rgba(15, 23, 42, 0.08)'
106
+ },
107
+ modal: {
108
+ background: '#ffffff',
109
+ borderColor: 'rgba(15, 23, 42, 0.12)',
110
+ shadow: '0 20px 60px rgba(15, 23, 42, 0.25)',
111
+ overlayColor: 'rgba(0,0,0,0.45)',
112
+ borderWidth: '1px',
113
+ borderRadius: 'var(--fy-borderRadius-md)',
114
+ dividerColor: 'rgba(15, 23, 42, 0.08)'
115
+ },
116
+ input: {
117
+ background: '#ffffff',
118
+ borderColor: 'rgba(15, 23, 42, 0.12)',
119
+ shadow: 'none',
120
+ placeholderColor: '#6b7280',
121
+ borderWidth: '1px',
122
+ borderRadius: 'var(--fy-borderRadius-md)',
123
+ icons: {
124
+ mode: 'inside',
125
+ name: 'search',
126
+ position: 'left',
127
+ outsideGap: '8px',
128
+ color: 'currentColor'
129
+ }
130
+ },
131
+ select: {
132
+ background: '#ffffff',
133
+ borderColor: 'rgba(15, 23, 42, 0.12)',
134
+ shadow: '0 6px 16px rgba(15, 23, 42, 0.08)',
135
+ borderWidth: '1px',
136
+ borderRadius: 'var(--fy-borderRadius-md)'
137
+ },
138
+ table: {
139
+ background: 'var(--fy-colors-white)',
140
+ borderColor: 'rgba(15, 23, 42, 0.08)',
141
+ headerBackground: 'rgba(15, 23, 42, 0.02)',
142
+ rowHoverBackground: 'rgba(15, 23, 42, 0.01)',
143
+ stripedBackground: 'rgba(15, 23, 42, 0.005)',
144
+ textColor: 'var(--fy-colors-text)',
145
+ headerTextColor: 'var(--fy-colors-secondary)'
146
+ },
147
+ chart: {
148
+ background: 'transparent',
149
+ borderColor: 'rgba(15, 23, 42, 0.08)',
150
+ shadow: 'none',
151
+ gridColor: 'rgba(15, 23, 42, 0.05)',
152
+ labelColor: '#64748b',
153
+ colors: ['#3b82f6', '#10b981', '#f59e0b', '#ef4444', '#8b5cf6'],
154
+ fontFamily: 'inherit'
155
+ },
156
+ card: {
157
+ background: '#ffffff',
158
+ borderColor: 'rgba(15, 23, 42, 0.08)',
159
+ shadow: '0 10px 30px rgba(15, 23, 42, 0.06)',
160
+ dividerColor: 'rgba(15, 23, 42, 0.08)',
161
+ icons: {
162
+ header: '',
163
+ footer: ''
164
+ }
165
+ },
166
+ accordion: {
167
+ background: '#ffffff',
168
+ borderColor: 'rgba(15, 23, 42, 0.12)',
169
+ shadow: 'none',
170
+ dividerColor: 'rgba(15, 23, 42, 0.08)',
171
+ borderRadius: 'var(--fy-borderRadius-md)',
172
+ headerBackground: 'transparent'
173
+ },
174
+ badge: {
175
+ background: '#ef4444',
176
+ textColor: '#ffffff',
177
+ borderRadius: '9999px',
178
+ animation: 'shine'
179
+ },
180
+ toast: {
181
+ background: '#ffffff',
182
+ borderColor: 'rgba(15, 23, 42, 0.12)',
183
+ textColor: '#1f2937',
184
+ shadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)',
185
+ borderRadius: 'var(--fy-borderRadius-md)',
186
+ padding: '12px 16px',
187
+ gap: '12px',
188
+ minWidth: '320px',
189
+ maxWidth: '420px',
190
+ titleFontSize: '14px',
191
+ titleFontWeight: '600',
192
+ messageFontSize: '13px',
193
+ messageLineHeight: '1.5',
194
+ iconSize: '20px',
195
+ closeIcon: 'x',
196
+ closeButtonSize: '18px',
197
+ closeButtonOpacity: '0.5',
198
+ closeButtonHoverOpacity: '1',
199
+ iconColor: {
200
+ info: '#3b82f6',
201
+ success: '#10b981',
202
+ warning: '#f59e0b',
203
+ error: '#ef4444'
204
+ }
205
+ },
206
+ notificationMenu: {
207
+ button: {
208
+ background: 'transparent',
209
+ textColor: 'var(--fy-colors-text)',
210
+ icon: 'bell',
211
+ badgeBackground: '#ef4444',
212
+ badgeTextColor: '#ffffff'
213
+ },
214
+ dropdown: {
215
+ background: '#ffffff',
216
+ borderColor: 'rgba(15, 23, 42, 0.12)',
217
+ shadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1)',
218
+ width: '320px',
219
+ maxHeight: '400px',
220
+ borderRadius: 'var(--fy-borderRadius-md)'
221
+ },
222
+ item: {
223
+ background: 'transparent',
224
+ hoverBackground: '#f8fafc',
225
+ textColor: '#1f2937',
226
+ descriptionColor: '#64748b',
227
+ dividerColor: 'rgba(15, 23, 42, 0.08)',
228
+ unreadIndicator: '#3b82f6'
229
+ },
230
+ config: {
231
+ showAll: false,
232
+ limit: 5,
233
+ allowClear: true,
234
+ accordionMode: true,
235
+ showViewAll: true,
236
+ viewAllPosition: 'footer-right'
237
+ }
238
+ }
239
+ },
240
+ icons: {
241
+ defaultSet: 'ph',
242
+ size: {
243
+ sm: '12px',
244
+ md: '16px',
245
+ lg: '20px'
246
+ },
247
+ strokeWidth: '1.5',
248
+ variant: 'regular'
249
+ },
250
+ scrollbar: {
251
+ width: '10px',
252
+ trackBackground: '#f3f4f6',
253
+ thumbBackground: '#d1d5db',
254
+ thumbHoverBackground: '#9ca3af',
255
+ thumbBorderRadius: '5px',
256
+ thumbBorderWidth: '2px',
257
+ thumbBorderColor: '#f3f4f6'
258
+ }
259
+ },
260
+ darkTokens: {
261
+ colors: {
262
+ primary: '#60a5fa',
263
+ background: '#111827',
264
+ text: '#f9fafb',
265
+ secondary: '#9ca3af',
266
+ surface: '#0f172a'
267
+ },
268
+ effects: {
269
+ card: {
270
+ background: '#0f172a',
271
+ borderColor: 'rgba(255,255,255,0.08)',
272
+ dividerColor: 'rgba(255,255,255,0.12)',
273
+ shadow: '0 10px 30px rgba(0,0,0,0.5)'
274
+ },
275
+ modal: {
276
+ background: '#0f172a',
277
+ borderColor: 'rgba(255,255,255,0.12)',
278
+ shadow: '0 24px 70px rgba(0,0,0,0.7)',
279
+ overlayColor: 'rgba(0,0,0,0.6)',
280
+ borderWidth: '1px',
281
+ borderRadius: 'var(--fy-borderRadius-md)',
282
+ dividerColor: 'rgba(255,255,255,0.12)'
283
+ },
284
+ accordion: {
285
+ background: '#0f172a',
286
+ borderColor: 'rgba(255,255,255,0.12)',
287
+ shadow: 'none',
288
+ dividerColor: 'rgba(255,255,255,0.12)',
289
+ borderRadius: 'var(--fy-borderRadius-md)',
290
+ headerBackground: 'transparent'
291
+ },
292
+ input: {
293
+ background: '#111827',
294
+ borderColor: 'rgba(255,255,255,0.12)',
295
+ placeholderColor: '#9ca3af',
296
+ shadow: 'none'
297
+ },
298
+ select: {
299
+ background: '#111827',
300
+ borderColor: 'rgba(255,255,255,0.12)',
301
+ shadow: '0 6px 16px rgba(15, 23, 42, 0.08)',
302
+ borderWidth: '1px',
303
+ borderRadius: 'var(--fy-borderRadius-md)'
304
+ },
305
+ table: {
306
+ background: '#1f2937',
307
+ borderColor: 'rgba(255,255,255,0.08)',
308
+ headerBackground: 'rgba(255,255,255,0.05)',
309
+ rowHoverBackground: 'rgba(255,255,255,0.02)',
310
+ stripedBackground: 'rgba(255,255,255,0.01)',
311
+ textColor: '#f9fafb',
312
+ headerTextColor: '#9ca3af'
313
+ },
314
+ chart: {
315
+ background: 'transparent',
316
+ gridColor: 'rgba(255,255,255,0.05)',
317
+ labelColor: '#9ca3af',
318
+ colors: ['#60a5fa', '#34d399', '#fbbf24', '#f87171', '#a78bfa']
319
+ },
320
+ button: {
321
+ textColor: '#ffffff'
322
+ },
323
+ toast: {
324
+ background: '#1f2937',
325
+ borderColor: 'rgba(255,255,255,0.1)',
326
+ textColor: '#f9fafb',
327
+ shadow: '0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4)',
328
+ borderRadius: 'var(--fy-borderRadius-md)',
329
+ closeButtonOpacity: '0.6',
330
+ closeButtonHoverOpacity: '1',
331
+ iconColor: {
332
+ info: '#60a5fa',
333
+ success: '#34d399',
334
+ warning: '#fbbf24',
335
+ error: '#f87171'
336
+ }
337
+ },
338
+ notificationMenu: {
339
+ button: {
340
+ textColor: 'var(--fy-colors-text)',
341
+ badgeBackground: '#f87171',
342
+ background: 'transparent',
343
+ icon: 'bell',
344
+ badgeTextColor: '#ffffff'
345
+ },
346
+ dropdown: {
347
+ background: '#1f2937',
348
+ borderColor: 'rgba(255,255,255,0.1)',
349
+ shadow: '0 20px 25px -5px rgba(0, 0, 0, 0.5)',
350
+ width: '320px',
351
+ maxHeight: '400px',
352
+ borderRadius: 'var(--fy-borderRadius-md)'
353
+ },
354
+ item: {
355
+ hoverBackground: 'rgba(255,255,255,0.05)',
356
+ textColor: '#f9fafb',
357
+ descriptionColor: '#9ca3af',
358
+ dividerColor: 'rgba(255,255,255,0.08)',
359
+ unreadIndicator: '#60a5fa',
360
+ background: ''
361
+ }
362
+ }
363
+ }
364
+ },
365
+ componentAnimations: {
366
+ 'fy-button': {
367
+ hover: 'button-hover-soft',
368
+ click: 'button-click-press',
369
+ success: 'button-success-pulse',
370
+ error: 'button-error-shake'
371
+ },
372
+ 'fy-input': {
373
+ focus: 'input-focus-glow',
374
+ success: 'input-success-pulse',
375
+ error: 'input-error-shake'
376
+ },
377
+ 'fy-select': {
378
+ focus: 'input-focus-glow',
379
+ success: 'input-success-pulse',
380
+ error: 'input-error-shake'
381
+ },
382
+ 'fy-layout': {
383
+ enter: 'layout-fade-in'
384
+ },
385
+ 'fy-slot:header': {
386
+ open: 'header-menu-slide-in',
387
+ close: 'header-menu-slide-out'
388
+ },
389
+ 'fy-slot:sidebar': {
390
+ open: 'sidebar-slide-in',
391
+ close: 'sidebar-slide-out'
392
+ },
393
+ 'fy-notification-menu': {
394
+ open: 'dropdown-in',
395
+ close: 'dropdown-out'
396
+ },
397
+ 'fy-accordion': {
398
+ expand: 'accordion-expand',
399
+ collapse: 'accordion-collapse'
400
+ },
401
+ 'fy-card': {
402
+ enter: 'card-fade-in'
403
+ },
404
+ 'fy-table': {
405
+ enter: 'table-fade-in',
406
+ rowEnter: 'table-row-enter'
407
+ }
408
+ }
409
+ };
@@ -0,0 +1,37 @@
1
+ import { ThemeDefinition, DesignTokens } from '@fylib/core';
2
+ export interface ThemePlugin {
3
+ name: string;
4
+ apply(tokens: DesignTokens): DesignTokens;
5
+ }
6
+ export declare class ThemeEngine {
7
+ private themes;
8
+ private plugins;
9
+ private currentTheme;
10
+ private currentMode;
11
+ constructor();
12
+ registerTheme(theme: ThemeDefinition): void;
13
+ registerPlugin(plugin: ThemePlugin): void;
14
+ setTheme(name: string): void;
15
+ setMode(mode: ThemeMode): void;
16
+ getMode(): ThemeMode;
17
+ getBackgroundEffect(): {
18
+ name: string;
19
+ intensity?: number;
20
+ speed?: number;
21
+ loop?: boolean;
22
+ } | undefined;
23
+ getWallpaper(): import("@fylib/core").WallpaperDefinition | undefined;
24
+ getComponentAnimation(componentSelector: string, event: string): string | undefined;
25
+ getTokens(): DesignTokens;
26
+ private applyGlobalTokens;
27
+ private injectTokensAsVars;
28
+ private deepMerge;
29
+ private isObject;
30
+ private applyScrollbarStyles;
31
+ }
32
+ export declare const themeEngine: ThemeEngine;
33
+ export type ThemeMode = 'light' | 'dark';
34
+ export declare class ConfigOverridePlugin implements ThemePlugin {
35
+ name: string;
36
+ apply(tokens: DesignTokens): any;
37
+ }