klip-components 0.2.1

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.
Files changed (44) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +223 -0
  3. package/dist/components/Button/Button.d.ts +60 -0
  4. package/dist/components/Button/Button.d.ts.map +1 -0
  5. package/dist/components/Button/index.d.ts +3 -0
  6. package/dist/components/Button/index.d.ts.map +1 -0
  7. package/dist/components/Debug/Debug.d.ts +8 -0
  8. package/dist/components/Debug/Debug.d.ts.map +1 -0
  9. package/dist/components/Debug/index.d.ts +2 -0
  10. package/dist/components/Debug/index.d.ts.map +1 -0
  11. package/dist/components/SimpleButton/SimpleButton.d.ts +11 -0
  12. package/dist/components/SimpleButton/SimpleButton.d.ts.map +1 -0
  13. package/dist/components/SimpleButton/index.d.ts +2 -0
  14. package/dist/components/SimpleButton/index.d.ts.map +1 -0
  15. package/dist/components/ThemeToggle/ThemeToggle.d.ts +9 -0
  16. package/dist/components/ThemeToggle/ThemeToggle.d.ts.map +1 -0
  17. package/dist/components/ThemeToggle/index.d.ts +3 -0
  18. package/dist/components/ThemeToggle/index.d.ts.map +1 -0
  19. package/dist/index.d.ts +7 -0
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/klip-components.cjs.js +37 -0
  22. package/dist/klip-components.css +1 -0
  23. package/dist/klip-components.es.js +391 -0
  24. package/dist/theme/ThemeProvider.d.ts +37 -0
  25. package/dist/theme/ThemeProvider.d.ts.map +1 -0
  26. package/dist/theme/context.d.ts +17 -0
  27. package/dist/theme/context.d.ts.map +1 -0
  28. package/dist/theme/cssGenerator.d.ts +14 -0
  29. package/dist/theme/cssGenerator.d.ts.map +1 -0
  30. package/dist/theme/defaultThemes.d.ts +11 -0
  31. package/dist/theme/defaultThemes.d.ts.map +1 -0
  32. package/dist/theme/hooks.d.ts +68 -0
  33. package/dist/theme/hooks.d.ts.map +1 -0
  34. package/dist/theme/index.d.ts +9 -0
  35. package/dist/theme/index.d.ts.map +1 -0
  36. package/dist/theme/utils.d.ts +23 -0
  37. package/dist/theme/utils.d.ts.map +1 -0
  38. package/dist/types/theme.d.ts +78 -0
  39. package/dist/types/theme.d.ts.map +1 -0
  40. package/dist/utils/cn.d.ts +37 -0
  41. package/dist/utils/cn.d.ts.map +1 -0
  42. package/dist/utils/index.d.ts +2 -0
  43. package/dist/utils/index.d.ts.map +1 -0
  44. package/package.json +81 -0
@@ -0,0 +1,391 @@
1
+ import { jsx as d, jsxs as m } from "react/jsx-runtime";
2
+ import l, { createContext as j, useContext as B, useState as g, useCallback as u, useEffect as D, useLayoutEffect as E } from "react";
3
+ function x(r) {
4
+ var o, e, s = "";
5
+ if (typeof r == "string" || typeof r == "number") s += r;
6
+ else if (typeof r == "object") if (Array.isArray(r)) {
7
+ var a = r.length;
8
+ for (o = 0; o < a; o++) r[o] && (e = x(r[o])) && (s && (s += " "), s += e);
9
+ } else for (e in r) r[e] && (s && (s += " "), s += e);
10
+ return s;
11
+ }
12
+ function L() {
13
+ for (var r, o, e = 0, s = "", a = arguments.length; e < a; e++) (r = arguments[e]) && (o = x(r)) && (s && (s += " "), s += o);
14
+ return s;
15
+ }
16
+ function A(...r) {
17
+ const o = r.join(" ").split(" ").filter(Boolean);
18
+ return [...new Set(o)].join(" ");
19
+ }
20
+ function $(...r) {
21
+ const o = L(...r);
22
+ return A(o);
23
+ }
24
+ const N = ({
25
+ variant: r = "primary",
26
+ size: o = "md",
27
+ block: e = !1,
28
+ className: s = "",
29
+ children: a,
30
+ ...i
31
+ }) => /* @__PURE__ */ d(
32
+ "button",
33
+ {
34
+ className: $("btn", `btn-${r}`, o !== "md" && `btn-${o}`, e && "btn-block", s),
35
+ ...i,
36
+ children: a
37
+ }
38
+ ), w = j(void 0);
39
+ function S() {
40
+ const r = B(w);
41
+ if (r === void 0)
42
+ throw new Error("useTheme must be used within a ThemeProvider");
43
+ return r;
44
+ }
45
+ function X() {
46
+ const { theme: r } = S();
47
+ return {
48
+ // Colors
49
+ primaryColor: `var(--primary-color, ${r.colors.primary.main})`,
50
+ primaryHover: `var(--primary-hover, ${r.colors.primary.hover})`,
51
+ secondaryColor: `var(--secondary-color, ${r.colors.secondary.main})`,
52
+ secondaryHover: `var(--secondary-hover, ${r.colors.secondary.hover})`,
53
+ tertiaryColor: `var(--tertiary-color, ${r.colors.tertiary.main})`,
54
+ tertiaryHover: `var(--tertiary-hover, ${r.colors.tertiary.hover})`,
55
+ successColor: `var(--success-color, ${r.colors.semantic.success})`,
56
+ dangerColor: `var(--danger-color, ${r.colors.semantic.danger})`,
57
+ warningColor: `var(--warning-color, ${r.colors.semantic.warning})`,
58
+ infoColor: `var(--info-color, ${r.colors.semantic.info})`,
59
+ // Spacing
60
+ spacingXs: `var(--spacing-xs, ${r.spacing.xs})`,
61
+ spacingSm: `var(--spacing-sm, ${r.spacing.sm})`,
62
+ spacingMd: `var(--spacing-md, ${r.spacing.md})`,
63
+ spacingLg: `var(--spacing-lg, ${r.spacing.lg})`,
64
+ spacingXl: `var(--spacing-xl, ${r.spacing.xl})`,
65
+ // Border radius
66
+ borderRadiusSm: `var(--border-radius-sm, ${r.borderRadius.sm})`,
67
+ borderRadius: `var(--border-radius, ${r.borderRadius.base})`,
68
+ borderRadiusLg: `var(--border-radius-lg, ${r.borderRadius.lg})`,
69
+ // Typography
70
+ fontFamily: `var(--font-family, ${r.typography.fontFamily})`,
71
+ fontSizeSm: `var(--font-size-sm, ${r.typography.fontSize.sm})`,
72
+ fontSizeBase: `var(--font-size-base, ${r.typography.fontSize.base})`,
73
+ fontSizeLg: `var(--font-size-lg, ${r.typography.fontSize.lg})`,
74
+ // Shadows
75
+ shadowSm: `var(--shadow-sm, ${r.shadows.sm})`,
76
+ shadowMd: `var(--shadow-md, ${r.shadows.md})`,
77
+ shadowLg: `var(--shadow-lg, ${r.shadows.lg})`
78
+ };
79
+ }
80
+ function Q({ className: r }) {
81
+ const { mode: o, setMode: e, isDark: s } = S(), a = () => {
82
+ e(o === "auto" ? "light" : o === "light" ? "dark" : "auto");
83
+ }, i = () => {
84
+ switch (o) {
85
+ case "light":
86
+ return "☀️ Light";
87
+ case "dark":
88
+ return "🌙 Dark";
89
+ case "auto":
90
+ return `🔄 Auto (${s ? "Dark" : "Light"})`;
91
+ default:
92
+ return "Theme";
93
+ }
94
+ };
95
+ return /* @__PURE__ */ d(
96
+ "button",
97
+ {
98
+ onClick: a,
99
+ className: $(
100
+ "px-3 py-2 rounded-md text-sm font-medium transition-colors",
101
+ "bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600",
102
+ "text-gray-900 dark:text-gray-100",
103
+ r
104
+ ),
105
+ title: `Current theme: ${o}${o === "auto" ? ` (${s ? "dark" : "light"})` : ""}`,
106
+ children: i()
107
+ }
108
+ );
109
+ }
110
+ function Y({ className: r }) {
111
+ return console.log("React version:", l.version), console.log("React object:", l), /* @__PURE__ */ m("div", { className: r, children: [
112
+ /* @__PURE__ */ m("p", { children: [
113
+ "React Version: ",
114
+ l.version
115
+ ] }),
116
+ /* @__PURE__ */ m("p", { children: [
117
+ "React loaded: ",
118
+ l ? "Yes" : "No"
119
+ ] })
120
+ ] });
121
+ }
122
+ function q({ children: r, onClick: o, className: e }) {
123
+ return /* @__PURE__ */ d(
124
+ "button",
125
+ {
126
+ onClick: o,
127
+ className: e,
128
+ style: {
129
+ padding: "8px 16px",
130
+ backgroundColor: "#007bff",
131
+ color: "white",
132
+ border: "none",
133
+ borderRadius: "4px"
134
+ },
135
+ children: r
136
+ }
137
+ );
138
+ }
139
+ const b = {
140
+ colors: {
141
+ primary: {
142
+ main: "#05445e",
143
+ hover: "#033e52"
144
+ },
145
+ secondary: {
146
+ main: "#189ab4",
147
+ hover: "#0f7a9c"
148
+ },
149
+ tertiary: {
150
+ main: "#75e6da",
151
+ hover: "#5cc6c0"
152
+ },
153
+ semantic: {
154
+ success: "#18a558",
155
+ danger: "#db1f48",
156
+ warning: "#e9b210",
157
+ info: "#e0e9e0"
158
+ }
159
+ },
160
+ spacing: {
161
+ xs: "0.25rem",
162
+ sm: "0.5rem",
163
+ md: "1rem",
164
+ lg: "1.5rem",
165
+ xl: "2rem"
166
+ },
167
+ borderRadius: {
168
+ sm: "4px",
169
+ base: "8px",
170
+ lg: "12px"
171
+ },
172
+ typography: {
173
+ fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
174
+ fontSize: {
175
+ sm: "0.875rem",
176
+ base: "1rem",
177
+ lg: "1.125rem"
178
+ }
179
+ },
180
+ shadows: {
181
+ sm: "0 1px 2px 0 rgb(0 0 0 / 0.05)",
182
+ md: "0 4px 6px -1px rgb(0 0 0 / 0.1)",
183
+ lg: "0 10px 15px -3px rgb(0 0 0 / 0.1)"
184
+ }
185
+ }, M = {
186
+ colors: {
187
+ primary: {
188
+ main: "#7dd3fc",
189
+ hover: "#0ea5e9"
190
+ },
191
+ secondary: {
192
+ main: "#34d399",
193
+ hover: "#10b981"
194
+ },
195
+ tertiary: {
196
+ main: "#fbbf24",
197
+ hover: "#f59e0b"
198
+ },
199
+ semantic: {
200
+ success: "#22c55e",
201
+ danger: "#ef4444",
202
+ warning: "#f59e0b",
203
+ info: "#3b82f6"
204
+ }
205
+ },
206
+ spacing: {
207
+ xs: "0.25rem",
208
+ sm: "0.5rem",
209
+ md: "1rem",
210
+ lg: "1.5rem",
211
+ xl: "2rem"
212
+ },
213
+ borderRadius: {
214
+ sm: "4px",
215
+ base: "8px",
216
+ lg: "12px"
217
+ },
218
+ typography: {
219
+ fontFamily: "Inter, system-ui, Avenir, Helvetica, Arial, sans-serif",
220
+ fontSize: {
221
+ sm: "0.875rem",
222
+ base: "1rem",
223
+ lg: "1.125rem"
224
+ }
225
+ },
226
+ shadows: {
227
+ sm: "0 1px 2px 0 rgb(0 0 0 / 0.15)",
228
+ md: "0 4px 6px -1px rgb(0 0 0 / 0.2)",
229
+ lg: "0 10px 15px -3px rgb(0 0 0 / 0.25)"
230
+ }
231
+ };
232
+ function v(r, o) {
233
+ return {
234
+ colors: {
235
+ primary: {
236
+ ...r.colors.primary,
237
+ ...o.colors?.primary
238
+ },
239
+ secondary: {
240
+ ...r.colors.secondary,
241
+ ...o.colors?.secondary
242
+ },
243
+ tertiary: {
244
+ ...r.colors.tertiary,
245
+ ...o.colors?.tertiary
246
+ },
247
+ semantic: {
248
+ ...r.colors.semantic,
249
+ ...o.colors?.semantic
250
+ }
251
+ },
252
+ spacing: {
253
+ ...r.spacing,
254
+ ...o.spacing
255
+ },
256
+ borderRadius: {
257
+ ...r.borderRadius,
258
+ ...o.borderRadius
259
+ },
260
+ typography: {
261
+ ...r.typography,
262
+ ...o.typography,
263
+ fontSize: {
264
+ ...r.typography.fontSize,
265
+ ...o.typography?.fontSize
266
+ }
267
+ },
268
+ shadows: {
269
+ ...r.shadows,
270
+ ...o.shadows
271
+ }
272
+ };
273
+ }
274
+ function G(r, o = document.documentElement) {
275
+ o.style.setProperty("--primary-color", r.colors.primary.main), o.style.setProperty("--primary-hover", r.colors.primary.hover), o.style.setProperty("--secondary-color", r.colors.secondary.main), o.style.setProperty("--secondary-hover", r.colors.secondary.hover), o.style.setProperty("--tertiary-color", r.colors.tertiary.main), o.style.setProperty("--tertiary-hover", r.colors.tertiary.hover), o.style.setProperty("--success-color", r.colors.semantic.success), o.style.setProperty("--danger-color", r.colors.semantic.danger), o.style.setProperty("--warning-color", r.colors.semantic.warning), o.style.setProperty("--info-color", r.colors.semantic.info), o.style.setProperty("--spacing-xs", r.spacing.xs), o.style.setProperty("--spacing-sm", r.spacing.sm), o.style.setProperty("--spacing-md", r.spacing.md), o.style.setProperty("--spacing-lg", r.spacing.lg), o.style.setProperty("--spacing-xl", r.spacing.xl), o.style.setProperty("--border-radius-sm", r.borderRadius.sm), o.style.setProperty("--border-radius", r.borderRadius.base), o.style.setProperty("--border-radius-lg", r.borderRadius.lg), o.style.setProperty("--font-family", r.typography.fontFamily), o.style.setProperty("--font-size-sm", r.typography.fontSize.sm), o.style.setProperty("--font-size-base", r.typography.fontSize.base), o.style.setProperty("--font-size-lg", r.typography.fontSize.lg), o.style.setProperty("--shadow-sm", r.shadows.sm), o.style.setProperty("--shadow-md", r.shadows.md), o.style.setProperty("--shadow-lg", r.shadows.lg);
276
+ }
277
+ function J(r, o) {
278
+ const e = o.split(".");
279
+ let s = r;
280
+ for (const a of e) {
281
+ if (typeof s != "object" || s === null || !(a in s))
282
+ return;
283
+ s = s[a];
284
+ }
285
+ return typeof s == "string" ? s : void 0;
286
+ }
287
+ function K(r) {
288
+ return `--${r.replace(/\./g, "-")}`;
289
+ }
290
+ function F() {
291
+ return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
292
+ }
293
+ function H(r, o = ":root") {
294
+ return `
295
+ ${o} {
296
+ /* Colors */
297
+ --primary-color: ${r.colors.primary.main};
298
+ --primary-hover: ${r.colors.primary.hover};
299
+ --secondary-color: ${r.colors.secondary.main};
300
+ --secondary-hover: ${r.colors.secondary.hover};
301
+ --tertiary-color: ${r.colors.tertiary.main};
302
+ --tertiary-hover: ${r.colors.tertiary.hover};
303
+ --success-color: ${r.colors.semantic.success};
304
+ --danger-color: ${r.colors.semantic.danger};
305
+ --warning-color: ${r.colors.semantic.warning};
306
+ --info-color: ${r.colors.semantic.info};
307
+
308
+ /* Spacing */
309
+ --spacing-xs: ${r.spacing.xs};
310
+ --spacing-sm: ${r.spacing.sm};
311
+ --spacing-md: ${r.spacing.md};
312
+ --spacing-lg: ${r.spacing.lg};
313
+ --spacing-xl: ${r.spacing.xl};
314
+
315
+ /* Border Radius */
316
+ --border-radius-sm: ${r.borderRadius.sm};
317
+ --border-radius: ${r.borderRadius.base};
318
+ --border-radius-lg: ${r.borderRadius.lg};
319
+
320
+ /* Typography */
321
+ --font-family: ${r.typography.fontFamily};
322
+ --font-size-sm: ${r.typography.fontSize.sm};
323
+ --font-size-base: ${r.typography.fontSize.base};
324
+ --font-size-lg: ${r.typography.fontSize.lg};
325
+
326
+ /* Shadows */
327
+ --shadow-sm: ${r.shadows.sm};
328
+ --shadow-md: ${r.shadows.md};
329
+ --shadow-lg: ${r.shadows.lg};
330
+ }`;
331
+ }
332
+ function U({
333
+ children: r,
334
+ defaultMode: o = "auto",
335
+ theme: e,
336
+ darkTheme: s = M
337
+ }) {
338
+ const [a, i] = g(o), [y, f] = g(e || {}), [k, P] = g(() => F() === "dark"), h = a === "dark" || a === "auto" && k, p = v(h ? s : b, y), z = u((n) => {
339
+ i(n);
340
+ }, []), C = u((n) => {
341
+ f((t) => v({ ...b, ...t }, n));
342
+ }, []), R = u(() => {
343
+ f({});
344
+ }, []);
345
+ D(() => {
346
+ if (typeof window > "u") return;
347
+ const n = window.matchMedia("(prefers-color-scheme: dark)"), t = (c) => {
348
+ P(c.matches);
349
+ };
350
+ return n.addEventListener("change", t), () => n.removeEventListener("change", t);
351
+ }, []), E(() => {
352
+ if (Object.keys(y).length > 0) {
353
+ const n = H(p), t = document.getElementById("klip-custom-theme");
354
+ t && t.remove();
355
+ const c = document.createElement("style");
356
+ c.id = "klip-custom-theme", c.textContent = n, document.head.insertBefore(c, document.head.firstChild);
357
+ } else {
358
+ const n = document.getElementById("klip-custom-theme");
359
+ n && n.remove();
360
+ }
361
+ }, [p, y]);
362
+ const T = {
363
+ theme: p,
364
+ mode: a,
365
+ setMode: z,
366
+ updateTheme: C,
367
+ resetTheme: R,
368
+ isDark: h
369
+ };
370
+ return /* @__PURE__ */ d(w.Provider, { value: T, children: r });
371
+ }
372
+ export {
373
+ N as Button,
374
+ Y as Debug,
375
+ q as SimpleButton,
376
+ w as ThemeContext,
377
+ U as ThemeProvider,
378
+ Q as ThemeToggle,
379
+ G as applyThemeToDOM,
380
+ L as clsx,
381
+ $ as cn,
382
+ K as createCSSVariable,
383
+ M as darkTheme,
384
+ b as defaultTheme,
385
+ F as detectColorScheme,
386
+ J as getThemeValue,
387
+ A as mergeClasses,
388
+ v as mergeTheme,
389
+ S as useTheme,
390
+ X as useThemeVariables
391
+ };
@@ -0,0 +1,37 @@
1
+ import { default as React } from 'react';
2
+ import { Theme, ThemeMode, ThemeOverride } from '../types/theme';
3
+ export interface ThemeProviderProps {
4
+ /** Children components */
5
+ children: React.ReactNode;
6
+ /** Initial theme mode */
7
+ defaultMode?: ThemeMode;
8
+ /** Initial theme overrides */
9
+ theme?: ThemeOverride;
10
+ /** Custom dark theme (overrides default) */
11
+ darkTheme?: Theme;
12
+ }
13
+ /**
14
+ * Theme Provider component that manages theme state and applies themes to the DOM
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * import { ThemeProvider } from 'klip-components';
19
+ *
20
+ * function App() {
21
+ * return (
22
+ * <ThemeProvider
23
+ * defaultMode="auto"
24
+ * theme={{
25
+ * colors: {
26
+ * primary: { main: '#ff6b6b', hover: '#ff5252' }
27
+ * }
28
+ * }}
29
+ * >
30
+ * <YourApp />
31
+ * </ThemeProvider>
32
+ * );
33
+ * }
34
+ * ```
35
+ */
36
+ export declare function ThemeProvider({ children, defaultMode, theme, darkTheme, }: ThemeProviderProps): import("react/jsx-runtime").JSX.Element;
37
+ //# sourceMappingURL=ThemeProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../src/theme/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AACjF,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAMjE,MAAM,WAAW,kBAAkB;IACjC,0BAA0B;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,yBAAyB;IACzB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,8BAA8B;IAC9B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,4CAA4C;IAC5C,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,QAAQ,EACR,WAAoB,EACpB,KAAK,EACL,SAA4B,GAC7B,EAAE,kBAAkB,2CAgFpB"}
@@ -0,0 +1,17 @@
1
+ import { Theme, ThemeOverride, ThemeMode } from '../types/theme';
2
+ export interface ThemeContextValue {
3
+ /** Current active theme */
4
+ theme: Theme;
5
+ /** Current theme mode */
6
+ mode: ThemeMode;
7
+ /** Set theme mode */
8
+ setMode: (mode: ThemeMode) => void;
9
+ /** Update theme with overrides */
10
+ updateTheme: (override: ThemeOverride) => void;
11
+ /** Reset theme to default */
12
+ resetTheme: () => void;
13
+ /** Whether dark mode is active */
14
+ isDark: boolean;
15
+ }
16
+ export declare const ThemeContext: import('react').Context<ThemeContextValue | undefined>;
17
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/theme/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEjE,MAAM,WAAW,iBAAiB;IAChC,2BAA2B;IAC3B,KAAK,EAAE,KAAK,CAAC;IACb,yBAAyB;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,qBAAqB;IACrB,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACnC,kCAAkC;IAClC,WAAW,EAAE,CAAC,QAAQ,EAAE,aAAa,KAAK,IAAI,CAAC;IAC/C,6BAA6B;IAC7B,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,kCAAkC;IAClC,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,wDAA0D,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { Theme } from '../types/theme';
2
+ /**
3
+ * Generates CSS string from theme object
4
+ */
5
+ export declare function generateThemeCSS(theme: Theme, selector?: string): string;
6
+ /**
7
+ * Injects CSS into the document head
8
+ */
9
+ export declare function injectThemeCSS(theme: Theme, id?: string): void;
10
+ /**
11
+ * Downloads theme as CSS file
12
+ */
13
+ export declare function downloadThemeCSS(theme: Theme, filename?: string): void;
14
+ //# sourceMappingURL=cssGenerator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cssGenerator.d.ts","sourceRoot":"","sources":["../../src/theme/cssGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAE,MAAgB,GAAG,MAAM,CAsCjF;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,GAAE,MAAwB,GAAG,IAAI,CAc/E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,GAAE,MAA2B,GAAG,IAAI,CAW1F"}
@@ -0,0 +1,11 @@
1
+ import { Theme } from '../types/theme';
2
+ /**
3
+ * Default light theme configuration
4
+ * Based on the existing CSS variables in variables.css
5
+ */
6
+ export declare const defaultTheme: Theme;
7
+ /**
8
+ * Example dark theme
9
+ */
10
+ export declare const defaultDarkTheme: Theme;
11
+ //# sourceMappingURL=defaultThemes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultThemes.d.ts","sourceRoot":"","sources":["../../src/theme/defaultThemes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,KA8C1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,KA8C9B,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { ThemeContextValue } from './context';
2
+ /**
3
+ * Hook to access theme context
4
+ * Must be used within a ThemeProvider
5
+ *
6
+ * @example
7
+ * ```tsx
8
+ * function MyComponent() {
9
+ * const { theme, isDark, setMode } = useTheme();
10
+ *
11
+ * return (
12
+ * <div style={{ color: theme.colors.primary.main }}>
13
+ * <button onClick={() => setMode(isDark ? 'light' : 'dark')}>
14
+ * Toggle theme
15
+ * </button>
16
+ * </div>
17
+ * );
18
+ * }
19
+ * ```
20
+ */
21
+ export declare function useTheme(): ThemeContextValue;
22
+ /**
23
+ * Hook to get theme-aware CSS variables
24
+ *
25
+ * @example
26
+ * ```tsx
27
+ * function MyComponent() {
28
+ * const cssVars = useThemeVariables();
29
+ *
30
+ * return (
31
+ * <div style={{
32
+ * backgroundColor: cssVars.primaryColor,
33
+ * padding: cssVars.spacingMd,
34
+ * }}>
35
+ * Content
36
+ * </div>
37
+ * );
38
+ * }
39
+ * ```
40
+ */
41
+ export declare function useThemeVariables(): {
42
+ primaryColor: string;
43
+ primaryHover: string;
44
+ secondaryColor: string;
45
+ secondaryHover: string;
46
+ tertiaryColor: string;
47
+ tertiaryHover: string;
48
+ successColor: string;
49
+ dangerColor: string;
50
+ warningColor: string;
51
+ infoColor: string;
52
+ spacingXs: string;
53
+ spacingSm: string;
54
+ spacingMd: string;
55
+ spacingLg: string;
56
+ spacingXl: string;
57
+ borderRadiusSm: string;
58
+ borderRadius: string;
59
+ borderRadiusLg: string;
60
+ fontFamily: string;
61
+ fontSizeSm: string;
62
+ fontSizeBase: string;
63
+ fontSizeLg: string;
64
+ shadowSm: string;
65
+ shadowMd: string;
66
+ shadowLg: string;
67
+ };
68
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/theme/hooks.ts"],"names":[],"mappings":"AACA,OAAO,EAAgB,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,IAAI,iBAAiB,CAM5C;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;EAuChC"}
@@ -0,0 +1,9 @@
1
+ export type { Theme, ThemeOverride, ThemeMode, ColorPalette, SpacingScale, BorderRadius, Typography, Shadows, } from '../types/theme';
2
+ export { ThemeProvider } from './ThemeProvider';
3
+ export type { ThemeProviderProps } from './ThemeProvider';
4
+ export { ThemeContext } from './context';
5
+ export type { ThemeContextValue } from './context';
6
+ export { useTheme, useThemeVariables } from './hooks';
7
+ export { defaultTheme, defaultDarkTheme as darkTheme } from './defaultThemes';
8
+ export { mergeTheme, applyThemeToDOM, getThemeValue, createCSSVariable, detectColorScheme } from './utils';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,KAAK,EACL,aAAa,EACb,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,OAAO,GACR,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,YAAY,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAGnD,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,gBAAgB,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG9E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { Theme, ThemeOverride } from '../types/theme';
2
+ /**
3
+ * Merges theme overrides with base theme
4
+ * Performs deep merge to allow partial customization
5
+ */
6
+ export declare function mergeTheme(baseTheme: Theme, override: ThemeOverride): Theme;
7
+ /**
8
+ * Applies theme CSS custom properties to the DOM
9
+ */
10
+ export declare function applyThemeToDOM(theme: Theme, target?: HTMLElement): void;
11
+ /**
12
+ * Gets CSS custom property value from theme
13
+ */
14
+ export declare function getThemeValue(theme: Theme, path: string): string | undefined;
15
+ /**
16
+ * Creates CSS custom property name from theme path
17
+ */
18
+ export declare function createCSSVariable(path: string): string;
19
+ /**
20
+ * Detects user's preferred color scheme
21
+ */
22
+ export declare function detectColorScheme(): 'light' | 'dark';
23
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/theme/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,GAAG,KAAK,CAyC3E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,WAAsC,GAAG,IAAI,CAmClG;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY5E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,GAAG,MAAM,CAMpD"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Theme system type definitions for klip-components
3
+ * Provides type safety for color palettes and design tokens
4
+ */
5
+ export interface ColorPalette {
6
+ /** Primary color variants */
7
+ primary: {
8
+ main: string;
9
+ hover: string;
10
+ };
11
+ /** Secondary color variants */
12
+ secondary: {
13
+ main: string;
14
+ hover: string;
15
+ };
16
+ /** Tertiary color variants */
17
+ tertiary: {
18
+ main: string;
19
+ hover: string;
20
+ };
21
+ /** Semantic colors */
22
+ semantic: {
23
+ success: string;
24
+ danger: string;
25
+ warning: string;
26
+ info: string;
27
+ };
28
+ }
29
+ export interface SpacingScale {
30
+ xs: string;
31
+ sm: string;
32
+ md: string;
33
+ lg: string;
34
+ xl: string;
35
+ }
36
+ export interface BorderRadius {
37
+ sm: string;
38
+ base: string;
39
+ lg: string;
40
+ }
41
+ export interface Typography {
42
+ fontFamily: string;
43
+ fontSize: {
44
+ sm: string;
45
+ base: string;
46
+ lg: string;
47
+ };
48
+ }
49
+ export interface Shadows {
50
+ sm: string;
51
+ md: string;
52
+ lg: string;
53
+ }
54
+ /**
55
+ * Complete theme configuration
56
+ */
57
+ export interface Theme {
58
+ colors: ColorPalette;
59
+ spacing: SpacingScale;
60
+ borderRadius: BorderRadius;
61
+ typography: Typography;
62
+ shadows: Shadows;
63
+ }
64
+ /**
65
+ * Partial theme for customization - allows users to override only specific parts
66
+ */
67
+ export type ThemeOverride = {
68
+ colors?: Partial<ColorPalette>;
69
+ spacing?: Partial<SpacingScale>;
70
+ borderRadius?: Partial<BorderRadius>;
71
+ typography?: Partial<Typography>;
72
+ shadows?: Partial<Shadows>;
73
+ };
74
+ /**
75
+ * Theme mode options
76
+ */
77
+ export type ThemeMode = 'light' | 'dark' | 'auto';
78
+ //# sourceMappingURL=theme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/types/theme.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,YAAY;IAC3B,6BAA6B;IAC7B,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,+BAA+B;IAC/B,SAAS,EAAE;QACT,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,8BAA8B;IAC9B,QAAQ,EAAE;QACR,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,sBAAsB;IACtB,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,UAAU;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE;QACR,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;CACH;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE,YAAY,CAAC;IACtB,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACrC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;CAC5B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC"}