@webmate-studio/builder 0.2.146 → 0.2.148

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webmate-studio/builder",
3
- "version": "0.2.146",
3
+ "version": "0.2.148",
4
4
  "type": "module",
5
5
  "description": "Webmate Studio Component Builder",
6
6
  "keywords": [
@@ -86,8 +86,9 @@ export function validateDesignTokensV2(tokens) {
86
86
  }
87
87
  }
88
88
 
89
- // Dark Mode
90
- if (!v2.darkMode) v2.darkMode = { enabled: false, colors: null, semanticMappings: null };
89
+ // Theme (light/dark) — ersetzt altes darkMode-Objekt
90
+ if (!v2.theme) v2.theme = 'light';
91
+ delete v2.darkMode;
91
92
 
92
93
  // ── Typografie validieren ──
93
94
  if (!v2.typography) v2.typography = structuredClone(defaultDesignTokensV2.typography);
@@ -110,12 +110,13 @@ export function generateDarkColorScale(baseHex, curve) {
110
110
  const chromaScale = curve?.preset === 'custom' ? (curve.chromaScale ?? 0.85) : (preset?.chromaScale ?? 0.85);
111
111
 
112
112
  const isPureNeutral = base.c < 0.008;
113
+ const isLowChroma = base.c < 0.04;
113
114
 
114
115
  // Dark Mode: Base etwas heller für bessere Sichtbarkeit
115
116
  const darkBaseL = Math.min(base.l + 0.08, 0.65);
116
117
 
117
118
  // Lightness-Rampe adaptiv (invertiert für Dark Mode)
118
- const L = buildDarkLightnessRamp(darkBaseL);
119
+ const L = buildDarkLightnessRamp(darkBaseL, isLowChroma);
119
120
 
120
121
  const scale = {};
121
122
  for (let i = 0; i < 12; i++) {
@@ -295,17 +296,24 @@ function buildLightnessRamp(baseL, isLowChroma = false) {
295
296
  * Baut eine strikt monoton steigende Lightness-Rampe für Dark Mode.
296
297
  * Steps 1-8: dunkel → darkBaseL, Steps 10-12: darkBaseL → hell.
297
298
  */
298
- function buildDarkLightnessRamp(darkBaseL) {
299
- const bottomL = 0.14;
299
+ function buildDarkLightnessRamp(darkBaseL, isLowChroma) {
300
+ // Chromatische Farben (Primary, Secondary, Accent) brauchen hellere
301
+ // dunkle Steps, damit der Farbton sichtbar bleibt. Neutraltöne dürfen
302
+ // sehr dunkel werden (Hintergrundflächen).
303
+ const bottomL = isLowChroma ? 0.14 : 0.22;
300
304
  const topL = 0.94;
301
305
 
302
- const safeBaseL = Math.max(0.22, Math.min(0.85, darkBaseL));
306
+ const safeBaseL = Math.max(bottomL + 0.08, Math.min(0.85, darkBaseL));
303
307
 
304
308
  const gap = Math.max(0.02, (safeBaseL - bottomL) * 0.05);
305
309
  const step8Target = safeBaseL - gap;
306
310
  const range = step8Target - bottomL;
307
311
 
308
- const weights = [0.0, 0.04, 0.10, 0.20, 0.34, 0.50, 0.70, 0.92];
312
+ // Chromatische Farben: Steps stärker zur Base hin komprimiert,
313
+ // damit die dunklen Steps nicht zu dunkel (=farblos) werden
314
+ const weights = isLowChroma
315
+ ? [0.0, 0.04, 0.10, 0.20, 0.34, 0.50, 0.70, 0.92]
316
+ : [0.0, 0.06, 0.14, 0.26, 0.40, 0.55, 0.72, 0.90];
309
317
  const darkSteps = weights.map(w => bottomL + w * range);
310
318
 
311
319
  const lightRange = topL - safeBaseL;
@@ -680,6 +688,7 @@ export const BUTTON_SIZES = ['sm', 'md', 'lg'];
680
688
  */
681
689
  export const defaultDesignTokensV2 = {
682
690
  version: 2,
691
+ theme: 'light', // 'light' | 'dark'
683
692
 
684
693
  // ── Farben ──
685
694
  colors: {
@@ -737,12 +746,6 @@ export const defaultDesignTokensV2 = {
737
746
 
738
747
  surface: { ...DEFAULT_SURFACE_TOKENS },
739
748
 
740
- darkMode: {
741
- enabled: false,
742
- colors: null, // Wird bei Aktivierung auto-generiert
743
- semanticMappings: null
744
- },
745
-
746
749
  // ── Typografie ──
747
750
  typography: {
748
751
  fonts: [