@kreozalabs/styles 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.
package/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Kreoza
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # @kreozalabs/styles
2
+
3
+ Core design system for the Kreoza platform. This package provides synchronized design tokens for TypeScript, CSS, and Tailwind CSS (v3 and v4).
4
+
5
+ ## 🚀 Usage
6
+
7
+ ### 1. Tailwind CSS v4 (Recommended)
8
+ Tailwind v4 is CSS-first. Simply import the styles in your main CSS file:
9
+ ```css
10
+ @import "tailwindcss";
11
+ @import "@kreozalabs/styles";
12
+ ```
13
+ This automatically registers all theme variables (e.g., `bg-primary`, `rounded-kreoza`, `text-h1`).
14
+
15
+ ### 2. TypeScript / JavaScript
16
+ Programmatic access to all raw hex values and design constants:
17
+ ```typescript
18
+ import { tokens } from '@kreozalabs/styles';
19
+
20
+ const primaryColor = tokens.colors.light.primary;
21
+ ```
22
+
23
+ ### 3. Tailwind CSS v3
24
+ Add the preset to your `tailwind.config.js`:
25
+ ```javascript
26
+ module.exports = {
27
+ presets: [require('@kreozalabs/styles/tailwind-preset')],
28
+ content: ["./src/**/*.{ts,tsx}"],
29
+ }
30
+ ```
31
+
32
+ ---
33
+
34
+ ## 🛠 Maintenance (Single Source of Truth)
35
+
36
+ This package uses `tokens.ts` as the **Single Source of Truth**. Do not edit `tokens.css` or `base.css` variables manually.
37
+
38
+ ### How to update existing values
39
+ 1. Open `tokens.ts`.
40
+ 2. Update the values (colors, fonts, etc.).
41
+ 3. Run `pnpm build`. This will regenerate `tokens.css` and the `dist/` files.
42
+
43
+ ### How to add NEW token categories
44
+ If you add a new category to `tokens.ts` (e.g., `spacing` or `shadows`):
45
+ 1. Update `tokens.ts` with the new data.
46
+ 2. Update `scripts/sync-tokens.ts` to include the logic for mapping these new tokens to CSS variables and the Tailwind `@theme` block.
47
+ 3. Run `pnpm build`.
48
+
49
+ ---
50
+
51
+ ## 📜 Development Scripts
52
+
53
+ - `pnpm build`: Cleans, synchronizes tokens, and transpiles.
54
+ - `pnpm clean`: Removes all generated files (`dist/`, `tokens.css`).
55
+ - `pnpm build:tokens`: Only runs the synchronization script.
56
+ - `pnpm pack`: Creates a `.tgz` for local testing.
57
+
58
+ ---
59
+
60
+ ## 🎨 Design Summary
61
+
62
+ - **Primary Font**: `PT Sans` (legible, professional sans-serif).
63
+ - **Modular Scale**: Uses a **1.414 ratio** (Augmented Fourth) to ensure harmonious typography sizing across all headings.
64
+ - **Color System**: Tokens are centralized in `tokens.ts` to ensure consistent saturation and contrast across Light and Dark themes.
65
+ - **License**: BSD-3-Clause
package/base.css ADDED
@@ -0,0 +1,24 @@
1
+ @import url('https://fonts.googleapis.com/css?family=PT%20Sans:700|PT%20Sans:400');
2
+
3
+ @import "tailwindcss";
4
+
5
+ @import "./tokens.css";
6
+
7
+ body {
8
+ background-color: hsl(var(--background));
9
+ color: hsl(var(--foreground));
10
+ font-family: var(--font-family-sans);
11
+ font-size: var(--font-size-base);
12
+ }
13
+
14
+ h1 { font-size: var(--font-size-h1); }
15
+ h2 { font-size: var(--font-size-h2); }
16
+ h3 { font-size: var(--font-size-h3); }
17
+ h4 { font-size: var(--font-size-h4); }
18
+ h5 { font-size: var(--font-size-h5); }
19
+
20
+ h1, h2, h3, h4, h5 {
21
+ font-family: var(--font-family-sans);
22
+ font-weight: 700;
23
+ }
24
+
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sync-tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync-tokens.d.ts","sourceRoot":"","sources":["../../scripts/sync-tokens.ts"],"names":[],"mappings":""}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const node_fs_1 = __importDefault(require("node:fs"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
+ const color_1 = __importDefault(require("color"));
9
+ const tokens_js_1 = require("../tokens.js");
10
+ const OUTPUT_FILE = node_path_1.default.join(process.cwd(), 'tokens.css');
11
+ function hexToHslValues(hex) {
12
+ const color = (0, color_1.default)(hex);
13
+ const hsl = color.hsl().array();
14
+ // We want: H S% L% (without the hsl() wrapper) for Tailwind opacity support
15
+ return `${Math.round(hsl[0])} ${Math.round(hsl[1])}% ${Math.round(hsl[2])}%`;
16
+ }
17
+ function generateCSS() {
18
+ let css = '/* Generated file - do not edit manually */\n\n@layer base {\n :root {\n';
19
+ // Light colors
20
+ Object.entries(tokens_js_1.tokens.colors.light).forEach(([name, value]) => {
21
+ css += ` --${name}: ${hexToHslValues(value)}; /* ${value} */\n`;
22
+ });
23
+ // Typography & Border Radius
24
+ css += '\n /* Typography */\n';
25
+ css += ` --font-family-sans: ${tokens_js_1.tokens.typography.fontFamily};\n`;
26
+ Object.entries(tokens_js_1.tokens.typography.modularScale).forEach(([name, value]) => {
27
+ css += ` --font-size-${name}: ${value};\n`;
28
+ });
29
+ css += '\n /* Border Radius */\n';
30
+ Object.entries(tokens_js_1.tokens.borderRadius).forEach(([name, value]) => {
31
+ css += ` --radius-${name}: ${value};\n`;
32
+ });
33
+ css += ' }\n\n .dark {\n';
34
+ // Dark colors
35
+ Object.entries(tokens_js_1.tokens.colors.dark).forEach(([name, value]) => {
36
+ css += ` --${name}: ${hexToHslValues(value)}; /* ${value} */\n`;
37
+ });
38
+ // Tailwind CSS v4 Theme Block
39
+ css += ' }\n\n /* Tailwind CSS v4 Theme */\n';
40
+ css += ' @theme {\n';
41
+ // Map colors
42
+ Object.keys(tokens_js_1.tokens.colors.light).forEach((name) => {
43
+ css += ` --color-${name}: hsl(var(--${name}));\n`;
44
+ });
45
+ // Map Typography
46
+ css += ' --font-sans: var(--font-family-sans);\n';
47
+ Object.keys(tokens_js_1.tokens.typography.modularScale).forEach((name) => {
48
+ css += ` --text-${name}: var(--font-size-${name});\n`;
49
+ });
50
+ // Map Radius
51
+ Object.keys(tokens_js_1.tokens.borderRadius).forEach((name) => {
52
+ css += ` --radius-${name}: var(--radius-${name});\n`;
53
+ });
54
+ css += ' }\n}\n';
55
+ node_fs_1.default.writeFileSync(OUTPUT_FILE, css);
56
+ console.log(`Successfully generated ${OUTPUT_FILE}`);
57
+ }
58
+ generateCSS();
@@ -0,0 +1,70 @@
1
+ export declare const tokens: {
2
+ readonly colors: {
3
+ readonly light: {
4
+ readonly text: "#0c0e13";
5
+ readonly background: "#e8eaed";
6
+ readonly primary: "#5e8cc5";
7
+ readonly "primary-foreground": "#e8eaed";
8
+ readonly secondary: "#2fce03";
9
+ readonly "secondary-foreground": "#0c0e13";
10
+ readonly accent: "#d3763c";
11
+ readonly "accent-foreground": "#e8eaed";
12
+ readonly card: "#e8eaed";
13
+ readonly "card-foreground": "#0c0e13";
14
+ readonly popover: "#e8eaed";
15
+ readonly "popover-foreground": "#0c0e13";
16
+ readonly muted: "#d8d9db";
17
+ readonly "muted-foreground": "#464d59";
18
+ readonly destructive: "#ef4444";
19
+ readonly "destructive-foreground": "#e8eaed";
20
+ readonly border: "#ccd1d9";
21
+ readonly input: "#ccd1d9";
22
+ readonly ring: "#5e8cc5";
23
+ };
24
+ readonly dark: {
25
+ readonly text: "#eceef3";
26
+ readonly background: "#121417";
27
+ readonly primary: "#3a68a1";
28
+ readonly "primary-foreground": "#eceef3";
29
+ readonly secondary: "#5dfc31";
30
+ readonly "secondary-foreground": "#121417";
31
+ readonly accent: "#c3662c";
32
+ readonly "accent-foreground": "#eceef3";
33
+ readonly card: "#121417";
34
+ readonly "card-foreground": "#eceef3";
35
+ readonly popover: "#121417";
36
+ readonly "popover-foreground": "#eceef3";
37
+ readonly muted: "#21252b";
38
+ readonly "muted-foreground": "#b0b7c3";
39
+ readonly destructive: "#7f1d1d";
40
+ readonly "destructive-foreground": "#eceef3";
41
+ readonly border: "#2d343f";
42
+ readonly input: "#2d343f";
43
+ readonly ring: "#3a68a1";
44
+ };
45
+ };
46
+ readonly typography: {
47
+ readonly fontFamily: "'PT Sans', sans-serif";
48
+ readonly modularScale: {
49
+ readonly h1: "5.652rem";
50
+ readonly h2: "3.997rem";
51
+ readonly h3: "2.827rem";
52
+ readonly h4: "1.999rem";
53
+ readonly h5: "1.414rem";
54
+ readonly base: "1rem";
55
+ readonly small: "0.707rem";
56
+ };
57
+ readonly fontWeights: {
58
+ readonly regular: 400;
59
+ readonly bold: 700;
60
+ };
61
+ };
62
+ readonly borderRadius: {
63
+ readonly small: "0.25rem";
64
+ readonly medium: "0.5rem";
65
+ readonly large: "0.75rem";
66
+ readonly kreoza: "0.75rem";
67
+ };
68
+ };
69
+ export type DesignTokens = typeof tokens;
70
+ //# sourceMappingURL=tokens.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../tokens.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmET,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,MAAM,CAAC"}
package/dist/tokens.js ADDED
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tokens = void 0;
4
+ exports.tokens = {
5
+ colors: {
6
+ light: {
7
+ text: "#0c0e13",
8
+ background: "#e8eaed",
9
+ primary: "#5e8cc5",
10
+ "primary-foreground": "#e8eaed",
11
+ secondary: "#2fce03",
12
+ "secondary-foreground": "#0c0e13",
13
+ accent: "#d3763c",
14
+ "accent-foreground": "#e8eaed",
15
+ card: "#e8eaed",
16
+ "card-foreground": "#0c0e13",
17
+ popover: "#e8eaed",
18
+ "popover-foreground": "#0c0e13",
19
+ muted: "#d8d9db", // #d8d9db is approx 210 5% 85%
20
+ "muted-foreground": "#464d59", // #464d59 is approx 225 10% 30%
21
+ destructive: "#ef4444", // #ef4444 is 0 84% 60%
22
+ "destructive-foreground": "#e8eaed",
23
+ border: "#ccd1d9", // #ccd1d9 is 210 10% 80%
24
+ input: "#ccd1d9",
25
+ ring: "#5e8cc5",
26
+ },
27
+ dark: {
28
+ text: "#eceef3",
29
+ background: "#121417",
30
+ primary: "#3a68a1",
31
+ "primary-foreground": "#eceef3",
32
+ secondary: "#5dfc31",
33
+ "secondary-foreground": "#121417",
34
+ accent: "#c3662c",
35
+ "accent-foreground": "#eceef3",
36
+ card: "#121417",
37
+ "card-foreground": "#eceef3",
38
+ popover: "#121417",
39
+ "popover-foreground": "#eceef3",
40
+ muted: "#21252b", // approx 216 10% 15%
41
+ "muted-foreground": "#b0b7c3", // approx 225 10% 70%
42
+ destructive: "#7f1d1d", // approx 0 62.8% 30.6%
43
+ "destructive-foreground": "#eceef3",
44
+ border: "#2d343f", // approx 216 10% 20%
45
+ input: "#2d343f",
46
+ ring: "#3a68a1",
47
+ },
48
+ },
49
+ typography: {
50
+ fontFamily: "'PT Sans', sans-serif",
51
+ modularScale: {
52
+ h1: "5.652rem",
53
+ h2: "3.997rem",
54
+ h3: "2.827rem",
55
+ h4: "1.999rem",
56
+ h5: "1.414rem",
57
+ base: "1rem",
58
+ small: "0.707rem",
59
+ },
60
+ fontWeights: {
61
+ regular: 400,
62
+ bold: 700,
63
+ },
64
+ },
65
+ borderRadius: {
66
+ small: "0.25rem",
67
+ medium: "0.5rem",
68
+ large: "0.75rem",
69
+ kreoza: "0.75rem",
70
+ },
71
+ };
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@kreozalabs/styles",
3
+ "version": "0.1.0",
4
+ "description": "Shared design system and styling for Kreoza platform",
5
+ "main": "dist/tokens.js",
6
+ "module": "dist/tokens.js",
7
+ "types": "dist/tokens.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "base.css",
11
+ "tokens.css",
12
+ "tailwind-preset.js",
13
+ "README.md"
14
+ ],
15
+ "author": "Kreoza Labs",
16
+ "license": "BSD-3-Clause",
17
+ "publishConfig": {
18
+ "access": "public"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/kreozalabs/styles.git"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^25.5.0",
26
+ "color": "^5.0.3",
27
+ "tsx": "^4.21.0",
28
+ "typescript": "^6.0.2"
29
+ },
30
+ "scripts": {
31
+ "clean": "rm -rf dist tokens.css",
32
+ "build:tokens": "tsx scripts/sync-tokens.ts",
33
+ "build:ts": "tsc",
34
+ "build": "pnpm clean && pnpm build:tokens && pnpm build:ts"
35
+ }
36
+ }
@@ -0,0 +1,42 @@
1
+ module.exports = {
2
+ theme: {
3
+ extend: {
4
+ colors: {
5
+ background: "hsl(var(--background))",
6
+ foreground: "hsl(var(--foreground))",
7
+ primary: {
8
+ DEFAULT: "hsl(var(--primary))",
9
+ foreground: "hsl(var(--primary-foreground))",
10
+ },
11
+ secondary: {
12
+ DEFAULT: "hsl(var(--secondary))",
13
+ foreground: "hsl(var(--secondary-foreground))",
14
+ },
15
+ accent: {
16
+ DEFAULT: "hsl(var(--accent))",
17
+ foreground: "hsl(var(--accent-foreground))",
18
+ },
19
+ muted: {
20
+ DEFAULT: "hsl(var(--muted))",
21
+ foreground: "hsl(var(--muted-foreground))",
22
+ },
23
+ destructive: {
24
+ DEFAULT: "hsl(var(--destructive))",
25
+ foreground: "hsl(var(--destructive-foreground))",
26
+ },
27
+ border: "hsl(var(--border))",
28
+ input: "hsl(var(--input))",
29
+ ring: "hsl(var(--ring))",
30
+ },
31
+ fontFamily: {
32
+ sans: ["PT Sans", "system-ui", "sans-serif"],
33
+ serif: ["Georgia", "serif"],
34
+ mono: ["JetBrains Mono", "monospace"],
35
+ },
36
+ borderRadius: {
37
+ 'kreoza': '0.75rem',
38
+ },
39
+ },
40
+ },
41
+ plugins: [],
42
+ };
package/tokens.css ADDED
@@ -0,0 +1,98 @@
1
+ /* Generated file - do not edit manually */
2
+
3
+ @layer base {
4
+ :root {
5
+ --text: 223 23% 6%; /* #0c0e13 */
6
+ --background: 216 12% 92%; /* #e8eaed */
7
+ --primary: 213 47% 57%; /* #5e8cc5 */
8
+ --primary-foreground: 216 12% 92%; /* #e8eaed */
9
+ --secondary: 107 97% 41%; /* #2fce03 */
10
+ --secondary-foreground: 223 23% 6%; /* #0c0e13 */
11
+ --accent: 23 63% 53%; /* #d3763c */
12
+ --accent-foreground: 216 12% 92%; /* #e8eaed */
13
+ --card: 216 12% 92%; /* #e8eaed */
14
+ --card-foreground: 223 23% 6%; /* #0c0e13 */
15
+ --popover: 216 12% 92%; /* #e8eaed */
16
+ --popover-foreground: 223 23% 6%; /* #0c0e13 */
17
+ --muted: 220 4% 85%; /* #d8d9db */
18
+ --muted-foreground: 218 12% 31%; /* #464d59 */
19
+ --destructive: 0 84% 60%; /* #ef4444 */
20
+ --destructive-foreground: 216 12% 92%; /* #e8eaed */
21
+ --border: 217 15% 83%; /* #ccd1d9 */
22
+ --input: 217 15% 83%; /* #ccd1d9 */
23
+ --ring: 213 47% 57%; /* #5e8cc5 */
24
+
25
+ /* Typography */
26
+ --font-family-sans: 'PT Sans', sans-serif;
27
+ --font-size-h1: 5.652rem;
28
+ --font-size-h2: 3.997rem;
29
+ --font-size-h3: 2.827rem;
30
+ --font-size-h4: 1.999rem;
31
+ --font-size-h5: 1.414rem;
32
+ --font-size-base: 1rem;
33
+ --font-size-small: 0.707rem;
34
+
35
+ /* Border Radius */
36
+ --radius-small: 0.25rem;
37
+ --radius-medium: 0.5rem;
38
+ --radius-large: 0.75rem;
39
+ --radius-kreoza: 0.75rem;
40
+ }
41
+
42
+ .dark {
43
+ --text: 223 23% 94%; /* #eceef3 */
44
+ --background: 216 12% 8%; /* #121417 */
45
+ --primary: 213 47% 43%; /* #3a68a1 */
46
+ --primary-foreground: 223 23% 94%; /* #eceef3 */
47
+ --secondary: 107 97% 59%; /* #5dfc31 */
48
+ --secondary-foreground: 216 12% 8%; /* #121417 */
49
+ --accent: 23 63% 47%; /* #c3662c */
50
+ --accent-foreground: 223 23% 94%; /* #eceef3 */
51
+ --card: 216 12% 8%; /* #121417 */
52
+ --card-foreground: 223 23% 94%; /* #eceef3 */
53
+ --popover: 216 12% 8%; /* #121417 */
54
+ --popover-foreground: 223 23% 94%; /* #eceef3 */
55
+ --muted: 216 13% 15%; /* #21252b */
56
+ --muted-foreground: 218 14% 73%; /* #b0b7c3 */
57
+ --destructive: 0 63% 31%; /* #7f1d1d */
58
+ --destructive-foreground: 223 23% 94%; /* #eceef3 */
59
+ --border: 217 17% 21%; /* #2d343f */
60
+ --input: 217 17% 21%; /* #2d343f */
61
+ --ring: 213 47% 43%; /* #3a68a1 */
62
+ }
63
+
64
+ /* Tailwind CSS v4 Theme */
65
+ @theme {
66
+ --color-text: hsl(var(--text));
67
+ --color-background: hsl(var(--background));
68
+ --color-primary: hsl(var(--primary));
69
+ --color-primary-foreground: hsl(var(--primary-foreground));
70
+ --color-secondary: hsl(var(--secondary));
71
+ --color-secondary-foreground: hsl(var(--secondary-foreground));
72
+ --color-accent: hsl(var(--accent));
73
+ --color-accent-foreground: hsl(var(--accent-foreground));
74
+ --color-card: hsl(var(--card));
75
+ --color-card-foreground: hsl(var(--card-foreground));
76
+ --color-popover: hsl(var(--popover));
77
+ --color-popover-foreground: hsl(var(--popover-foreground));
78
+ --color-muted: hsl(var(--muted));
79
+ --color-muted-foreground: hsl(var(--muted-foreground));
80
+ --color-destructive: hsl(var(--destructive));
81
+ --color-destructive-foreground: hsl(var(--destructive-foreground));
82
+ --color-border: hsl(var(--border));
83
+ --color-input: hsl(var(--input));
84
+ --color-ring: hsl(var(--ring));
85
+ --font-sans: var(--font-family-sans);
86
+ --text-h1: var(--font-size-h1);
87
+ --text-h2: var(--font-size-h2);
88
+ --text-h3: var(--font-size-h3);
89
+ --text-h4: var(--font-size-h4);
90
+ --text-h5: var(--font-size-h5);
91
+ --text-base: var(--font-size-base);
92
+ --text-small: var(--font-size-small);
93
+ --radius-small: var(--radius-small);
94
+ --radius-medium: var(--radius-medium);
95
+ --radius-large: var(--radius-large);
96
+ --radius-kreoza: var(--radius-kreoza);
97
+ }
98
+ }