commit 3a94b2e741fa2af1bfe1df073b9216cbc666fd7e
parent f7cdac1ea1223c29b9f74622032635fef927c209
Author: triesap <137732411+triesap@users.noreply.github.com>
Date: Mon, 10 Feb 2025 10:16:02 +0000
themes: edit colors, update handlers for hex string color fields, migrate from direct index.ts entry to tsup compilation
Diffstat:
10 files changed, 106 insertions(+), 82 deletions(-)
diff --git a/themes/.gitignore b/themes/.gitignore
@@ -18,18 +18,30 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*
-# local env files
-.env.local
-.env.development.local
-.env.test.local
-.env.production.local
-
# turbo
.turbo
+
+# Output
+.output
+/build
+dist
+
+# local env files
+.env*
+!.env.example
+
+
+# Vite
+vite.config.js.timestamp-*
+vite.config.ts.timestamp-*
+
+# local
.tmp*
+.backup*
+.dev*
.vscode
notes*.txt
notes*.md
+git-diff.txt
justfile
-git-diff.txt
-\ No newline at end of file
diff --git a/themes/index.ts b/themes/index.ts
@@ -1 +0,0 @@
-export * from "./src";
diff --git a/themes/package.json b/themes/package.json
@@ -4,12 +4,22 @@
"private": true,
"license": "GPLv3",
"type": "module",
- "module": "index.ts",
+ "main": "dist/index.js",
+ "module": "dist/index.js",
+ "types": "dist/index.d.ts",
+ "exports": {
+ ".": {
+ "import": "./dist/index.js",
+ "require": "./dist/index.cjs"
+ }
+ },
"scripts": {
- "build": "just build && tsc",
- "dev": "tsc -w"
+ "build": "tsup",
+ "dev": "tsup --watch",
+ "watch": "tsc -w"
},
"devDependencies": {
+ "tsup": "^6.2.3",
"typescript": "^5.3.3"
},
"publishConfig": {
diff --git a/themes/src/colors.ts b/themes/src/colors.ts
@@ -36,6 +36,8 @@ export const theme_colors = {
"layer-2-glyph-hl": "hsl(var(--layer-2-glyph-hl) / <alpha-value>)",
"layer-2-glyph-hl_a": "hsl(var(--layer-2-glyph-hl_a) / <alpha-value>)",
"layer-2-glyph-shade": "hsl(var(--layer-2-glyph-shade) / <alpha-value>)",
+ "radroots-accent-focus": "hsl(var(--radroots-accent-focus) / <alpha-value>)",
+
};
export type ThemeLayer0 = {
diff --git a/themes/src/garden/light.ts b/themes/src/garden/light.ts
@@ -4,22 +4,13 @@ export const record_garden_light: ThemeRecord = {
layers: {
layer_0: {
surface: {
- //rgb(135, 163, 126)
- // _: [86, 38, 87],
- //_: [86, 39, 83],
- // _: [112, 41, 85],
_: [86, 30, 95],
- //[95, 27, 82],
- // hsl(86, 30%, 95%)
_w: [248, 248, 250],
_a: [240, 6, 83],
edge: [0, 0, 87],
blur: [0, 0, 100],
- //[179, 7, 96],
},
glyphs: {
- // _: [101, 56, 22],
- // _: [180, 4, 26],
_: [180, 2, 32],
_a: [240, 2, 60],
_pl: [240, 2, 78],
@@ -31,9 +22,6 @@ export const record_garden_light: ThemeRecord = {
},
layer_1: {
surface: {
- //_: [92, 42, 74],
- // _: [112, 32, 78],
- //_: [95, 26, 77],
_: [87, 15, 88],
_a: [89, 14, 68],
edge: [274, 4, 90],
@@ -41,7 +29,6 @@ export const record_garden_light: ThemeRecord = {
focus: [46, 46, 88],
},
glyphs: {
- // _: [112, 15, 22],
_: [180, 2, 40],
_a: [0, 0, 10],
_d: [0, 0, 20],
@@ -54,7 +41,6 @@ export const record_garden_light: ThemeRecord = {
},
layer_2: {
surface: {
- //_: [96, 21, 65],
_: [193, 204, 182],
_a: [240, 5, 95],
edge: [242, 2, 88],
@@ -74,27 +60,22 @@ export const record_garden_light: ThemeRecord = {
"primary": [219, 92, 58],
"primary-focus": [216, 92, 66],
"primary-content": [0, 0, 100],
- "secondary": [0, 0, 0],
- "secondary-focus": [0, 0, 0],
- "secondary-content": [0, 0, 0],
- "accent": [0, 0, 0],
- "accent-focus": [0, 0, 0],
- "accent-content": [0, 0, 0],
+ "secondary": "#1c4128",
+ "secondary-focus": "#132318",
+ "secondary-content": "ffffff",
+ "accent": "#ff2594",
+ "accent-focus": [331, 68, 48],
+ "accent-content": "ffffff",
"neutral": [240, 3, 94],
"neutral-focus": [240, 4, 95],
"neutral-content": [219, 92, 58],
- "base-100": [89, 29, 82],
- //[84, 26, 96],
- //[87, 43, 96],//[84, 17, 96],
- //hsl(90, 29%, 77%)
+ "base-100": "#2ecc71",
"base-200": [90, 29, 77],
- //[87, 13, 86], hsl(89, 29%, 73%)
"base-300": [89, 29, 73],
"base-content": [0, 0, 0],
"info": [211, 100, 50],
"info-content": [0, 0, 100],
"success": [121, 45, 58],
- //[135, 58, 49],
"success-content": [132, 65, 95],
"warning": [56, 89, 74],
"warning-content": [56, 59, 34],
diff --git a/themes/src/os/light.ts b/themes/src/os/light.ts
@@ -26,7 +26,7 @@ export const record_os_light: ThemeRecord = {
_a: [240, 6, 83],
edge: [274, 4, 90],
err: [0, 0, 0],
- focus: [240, 15, 94],//[240, 5, 92],
+ focus: [240, 15, 94],
},
glyphs: {
_: [0, 0, 10],
diff --git a/themes/src/types.ts b/themes/src/types.ts
@@ -18,40 +18,40 @@ export type ThemeLayers = {
layer_2: ThemeLayer2;
};
export type ThemeDaisy = {
- primary: HslTuple;
- "primary-focus": HslTuple;
- "primary-content": HslTuple;
- secondary: HslTuple;
- "secondary-focus": HslTuple;
- "secondary-content": HslTuple;
- accent: HslTuple;
- "accent-focus": HslTuple;
- "accent-content": HslTuple;
- neutral: HslTuple;
- "neutral-focus": HslTuple;
- "neutral-content": HslTuple;
- "base-100": HslTuple;
- "base-200": HslTuple;
- "base-300": HslTuple;
- "base-content": HslTuple;
- info: HslTuple;
- "info-content": HslTuple;
- success: HslTuple;
- "success-content": HslTuple;
- warning: HslTuple;
- "warning-content": HslTuple;
- error: HslTuple;
- "error-content": HslTuple;
- "--rounded-box": HslTuple;
- "--rounded-btn": HslTuple;
- "--rounded-badge": HslTuple;
- "--animation-btn": HslTuple;
- "--animation-input": HslTuple;
- "--btn-text-case": HslTuple;
- "--btn-focus-scale": HslTuple;
- "--border-btn": HslTuple;
- "--tab-border": HslTuple;
- "--tab-radius": HslTuple;
- "--spinner-color-base": HslTuple;
- "--spinner-color-white": HslTuple;
+ primary: HslTuple | string;
+ "primary-focus": HslTuple | string;
+ "primary-content": HslTuple | string;
+ secondary: HslTuple | string;
+ "secondary-focus": HslTuple | string;
+ "secondary-content": HslTuple | string;
+ accent: HslTuple | string;
+ "accent-focus": HslTuple | string;
+ "accent-content": HslTuple | string;
+ neutral: HslTuple | string;
+ "neutral-focus": HslTuple | string;
+ "neutral-content": HslTuple | string;
+ "base-100": HslTuple | string;
+ "base-200": HslTuple | string;
+ "base-300": HslTuple | string;
+ "base-content": HslTuple | string;
+ info: HslTuple | string;
+ "info-content": HslTuple | string;
+ success: HslTuple | string;
+ "success-content": HslTuple | string;
+ warning: HslTuple | string;
+ "warning-content": HslTuple | string;
+ error: HslTuple | string;
+ "error-content": HslTuple | string;
+ "--rounded-box": HslTuple | string;
+ "--rounded-btn": HslTuple | string;
+ "--rounded-badge": HslTuple | string;
+ "--animation-btn": HslTuple | string;
+ "--animation-input": HslTuple | string;
+ "--btn-text-case": HslTuple | string;
+ "--btn-focus-scale": HslTuple | string;
+ "--border-btn": HslTuple | string;
+ "--tab-border": HslTuple | string;
+ "--tab-radius": HslTuple | string;
+ "--spinner-color-base": HslTuple | string;
+ "--spinner-color-white": HslTuple | string;
};
\ No newline at end of file
diff --git a/themes/src/utils.ts b/themes/src/utils.ts
@@ -5,7 +5,7 @@ export const hsl_lighten = (c: HslTuple, amt: number = 25): string => hsl([c[0],
export const hsl_darken = (c: HslTuple, amt: number = 25): string => hsl([c[0], c[1], c[2] - amt]);
export const hsl_css = (c: HslTuple): string => `hsl(${hsl(c)})`;
export const write_daisy = (obj_c: ThemeDaisy): Record<string, string> => Object.fromEntries(
- Object.entries(obj_c).map(([key, val]) => [key, hsl_css(val)])
+ Object.entries(obj_c).map(([key, val]) => [key, typeof val === `string` ? val : hsl_css(val)])
);
export const parse_theme_key = (key?: string): ThemeKey => {
@@ -29,6 +29,7 @@ export const parse_color_mode = (color_mode?: string): ColorMode => {
};
export const write_layers = ({ layer_0: { surface: l0_s, glyphs: l0_g }, layer_1: { surface: l1_s, glyphs: l1_g }, layer_2: { surface: l2_s, glyphs: l2_g }}: ThemeLayers): Record<string, string> => ({
+ "--radroots-accent-focus": hsl([331, 68, 48]),
"--layer-0-surface": hsl(l0_s._),
"--layer-0-surface_a": hsl(l0_s._a),
"--layer-0-surface_w": hsl(l0_s._w),
diff --git a/themes/tsconfig.json b/themes/tsconfig.json
@@ -1,19 +1,28 @@
{
"compilerOptions": {
"strict": true,
+ "target": "es2021",
"lib": [
- "es2021"
+ "es2021",
+ "dom"
],
- "module": "CommonJS",
+ "module": "ESNext",
+ "moduleResolution": "node",
+ "declaration": true,
+ "declarationMap": true,
"outDir": "./dist",
- "rootDir": "./src",
- "noEmit": true,
- "skipLibCheck": true
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "baseUrl": ".",
+ "paths": {
+ "$root": ["src/index.js"]
+ }
},
"include": [
"src"
],
"exclude": [
- "node_modules"
+ "node_modules",
+ "dist"
],
}
\ No newline at end of file
diff --git a/themes/tsup.config.ts b/themes/tsup.config.ts
@@ -0,0 +1,11 @@
+import { defineConfig } from "tsup";
+
+export default defineConfig({
+ entry: ['src/index.ts'],
+ format: ['esm', 'cjs'],
+ dts: true,
+ outDir: 'dist',
+ splitting: false,
+ clean: true,
+ sourcemap: true,
+});