@discourser/design-system 0.20.1 → 0.22.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.
@@ -353,45 +353,55 @@ var material3Language = {
353
353
  function transformToPandaTheme(language) {
354
354
  return {
355
355
  tokens: transformTokens(language),
356
- semanticTokens: transformSemanticTokens(language),
356
+ semanticTokens: transformSemanticTokens(),
357
357
  textStyles: transformTextStyles(language)
358
358
  };
359
359
  }
360
360
  function transformTokens(language) {
361
361
  return {
362
- colors: transformColorPalettes(language.colors),
362
+ colors: transformColorPalettes(
363
+ language.colors
364
+ ),
363
365
  fonts: {
364
366
  display: { value: language.typography.fonts.display },
365
367
  body: { value: language.typography.fonts.body },
366
368
  mono: { value: language.typography.fonts.mono }
367
369
  },
368
- fontSizes: extractFontSizes(language.typography.scale),
369
- lineHeights: extractLineHeights(language.typography.scale),
370
- fontWeights: extractFontWeights(language.typography.scale),
371
- letterSpacings: extractLetterSpacings(language.typography.scale),
372
- spacing: objectToTokens(language.spacing),
373
- radii: objectToTokens(language.shape.radii),
374
- shadows: objectToTokens(language.elevation.levels),
375
- durations: objectToTokens(language.motion.durations),
376
- easings: objectToTokens(language.motion.easings),
377
- borderWidths: objectToTokens(language.border.widths)
370
+ fontSizes: extractFontSizes(
371
+ language.typography.scale
372
+ ),
373
+ lineHeights: extractLineHeights(
374
+ language.typography.scale
375
+ ),
376
+ fontWeights: extractFontWeights(
377
+ language.typography.scale
378
+ ),
379
+ letterSpacings: extractLetterSpacings(
380
+ language.typography.scale
381
+ ),
382
+ spacing: objectToTokens(
383
+ language.spacing
384
+ ),
385
+ radii: objectToTokens(
386
+ language.shape.radii
387
+ ),
388
+ shadows: objectToTokens(
389
+ language.elevation.levels
390
+ ),
391
+ durations: objectToTokens(
392
+ language.motion.durations
393
+ ),
394
+ easings: objectToTokens(
395
+ language.motion.easings
396
+ ),
397
+ borderWidths: objectToTokens(
398
+ language.border.widths
399
+ )
378
400
  };
379
401
  }
380
- function transformSemanticTokens(language) {
381
- const light = language.semantic;
382
- const dark = language.semanticDark || light;
402
+ function transformSemanticTokens(_language) {
383
403
  return {
384
- colors: Object.fromEntries(
385
- Object.entries(light).map(([key, lightValue]) => [
386
- key,
387
- {
388
- value: {
389
- base: lightValue,
390
- _dark: dark[key] || lightValue
391
- }
392
- }
393
- ])
394
- )
404
+ colors: {}
395
405
  };
396
406
  }
397
407
  function transformTextStyles(language) {
@@ -416,10 +426,7 @@ function transformColorPalettes(palettes) {
416
426
  Object.entries(palettes).map(([name, palette]) => [
417
427
  name,
418
428
  Object.fromEntries(
419
- Object.entries(palette).map(([tone, value]) => [
420
- tone,
421
- { value }
422
- ])
429
+ Object.entries(palette).map(([tone, value]) => [tone, { value }])
423
430
  )
424
431
  ])
425
432
  );
@@ -451,10 +458,7 @@ function extractFontWeights(scale) {
451
458
  weights.set(style.fontWeight, style.fontWeight);
452
459
  });
453
460
  return Object.fromEntries(
454
- Array.from(weights.entries()).map(([key, value]) => [
455
- key,
456
- { value }
457
- ])
461
+ Array.from(weights.entries()).map(([key, value]) => [key, { value }])
458
462
  );
459
463
  }
460
464
  function extractLetterSpacings(scale) {
@@ -714,68 +718,124 @@ var colors = {
714
718
  // Map red to error for Park UI compatibility
715
719
  red: error
716
720
  };
717
- var semantic = material3Language.semantic;
718
- var semanticDark = material3Language.semanticDark;
719
- var m3SemanticTokens = dev.defineSemanticTokens.colors({
720
- // M3 Surface System
721
- surface: {
722
- DEFAULT: { value: { base: semantic.surface, _dark: semanticDark.surface } },
723
- dim: { value: { base: semantic.surfaceContainerLow, _dark: semanticDark.surfaceContainerLow } },
724
- bright: { value: { base: semantic.surfaceContainerHigh, _dark: semanticDark.surfaceContainerHigh } },
721
+ var s = material3Language.semantic;
722
+ var d = material3Language.semanticDark;
723
+ var semanticColorTokens = dev.defineSemanticTokens.colors({
724
+ // Primary
725
+ primary: {
726
+ DEFAULT: { value: { base: s.primary, _dark: d.primary } },
725
727
  container: {
726
- DEFAULT: { value: { base: semantic.surfaceContainer, _dark: semanticDark.surfaceContainer } },
727
- low: { value: { base: semantic.surfaceContainerLow, _dark: semanticDark.surfaceContainerLow } },
728
- lowest: { value: { base: semantic.surfaceContainerLowest, _dark: semanticDark.surfaceContainerLowest } },
729
- high: { value: { base: semantic.surfaceContainerHigh, _dark: semanticDark.surfaceContainerHigh } },
730
- highest: { value: { base: semantic.surfaceContainerHighest, _dark: semanticDark.surfaceContainerHighest } }
728
+ value: { base: s.primaryContainer, _dark: d.primaryContainer }
731
729
  }
732
730
  },
733
- onSurface: {
734
- DEFAULT: { value: { base: semantic.onSurface, _dark: semanticDark.onSurface } },
735
- variant: { value: { base: semantic.onSurfaceVariant, _dark: semanticDark.onSurfaceVariant } }
731
+ onPrimary: {
732
+ DEFAULT: { value: { base: s.onPrimary, _dark: d.onPrimary } },
733
+ container: {
734
+ value: { base: s.onPrimaryContainer, _dark: d.onPrimaryContainer }
735
+ }
736
736
  },
737
- // M3 Primary tokens (for explicit M3 usage)
738
- m3Primary: {
739
- DEFAULT: { value: { base: semantic.primary, _dark: semanticDark.primary } },
740
- container: { value: { base: semantic.primaryContainer, _dark: semanticDark.primaryContainer } }
737
+ // Secondary
738
+ secondary: {
739
+ DEFAULT: { value: { base: s.secondary, _dark: d.secondary } },
740
+ container: {
741
+ value: { base: s.secondaryContainer, _dark: d.secondaryContainer }
742
+ }
741
743
  },
742
- onM3Primary: {
743
- DEFAULT: { value: { base: semantic.onPrimary, _dark: semanticDark.onPrimary } },
744
- container: { value: { base: semantic.onPrimaryContainer, _dark: semanticDark.onPrimaryContainer } }
744
+ onSecondary: {
745
+ DEFAULT: { value: { base: s.onSecondary, _dark: d.onSecondary } },
746
+ container: {
747
+ value: { base: s.onSecondaryContainer, _dark: d.onSecondaryContainer }
748
+ }
745
749
  },
746
- // M3 Secondary (prefixed to avoid conflict with Park UI Radix-scale bridge)
747
- m3Secondary: {
748
- DEFAULT: { value: { base: semantic.secondary, _dark: semanticDark.secondary } },
749
- container: { value: { base: semantic.secondaryContainer, _dark: semanticDark.secondaryContainer } }
750
+ // Tertiary
751
+ tertiary: {
752
+ DEFAULT: { value: { base: s.tertiary, _dark: d.tertiary } },
753
+ container: {
754
+ value: { base: s.tertiaryContainer, _dark: d.tertiaryContainer }
755
+ }
750
756
  },
751
- onM3Secondary: {
752
- DEFAULT: { value: { base: semantic.onSecondary, _dark: semanticDark.onSecondary } },
753
- container: { value: { base: semantic.onSecondaryContainer, _dark: semanticDark.onSecondaryContainer } }
757
+ onTertiary: {
758
+ DEFAULT: { value: { base: s.onTertiary, _dark: d.onTertiary } },
759
+ container: {
760
+ value: { base: s.onTertiaryContainer, _dark: d.onTertiaryContainer }
761
+ }
754
762
  },
755
- // M3 Tertiary (prefixed to avoid conflict with Park UI Radix-scale bridge)
756
- m3Tertiary: {
757
- DEFAULT: { value: { base: semantic.tertiary, _dark: semanticDark.tertiary } },
758
- container: { value: { base: semantic.tertiaryContainer, _dark: semanticDark.tertiaryContainer } }
763
+ // Error
764
+ error: {
765
+ DEFAULT: { value: { base: s.error, _dark: d.error } },
766
+ container: { value: { base: s.errorContainer, _dark: d.errorContainer } }
759
767
  },
760
- onM3Tertiary: {
761
- DEFAULT: { value: { base: semantic.onTertiary, _dark: semanticDark.onTertiary } },
762
- container: { value: { base: semantic.onTertiaryContainer, _dark: semanticDark.onTertiaryContainer } }
768
+ onError: {
769
+ DEFAULT: { value: { base: s.onError, _dark: d.onError } },
770
+ container: {
771
+ value: { base: s.onErrorContainer, _dark: d.onErrorContainer }
772
+ }
763
773
  },
764
- // M3 Outline
774
+ // Surface system
775
+ surface: {
776
+ DEFAULT: { value: { base: s.surface, _dark: d.surface } },
777
+ dim: {
778
+ value: { base: s.surfaceContainerLow, _dark: d.surfaceContainerLow }
779
+ },
780
+ bright: {
781
+ value: { base: s.surfaceContainerHigh, _dark: d.surfaceContainerHigh }
782
+ },
783
+ container: {
784
+ DEFAULT: {
785
+ value: { base: s.surfaceContainer, _dark: d.surfaceContainer }
786
+ },
787
+ low: {
788
+ value: { base: s.surfaceContainerLow, _dark: d.surfaceContainerLow }
789
+ },
790
+ lowest: {
791
+ value: {
792
+ base: s.surfaceContainerLowest,
793
+ _dark: d.surfaceContainerLowest
794
+ }
795
+ },
796
+ high: {
797
+ value: { base: s.surfaceContainerHigh, _dark: d.surfaceContainerHigh }
798
+ },
799
+ highest: {
800
+ value: {
801
+ base: s.surfaceContainerHighest,
802
+ _dark: d.surfaceContainerHighest
803
+ }
804
+ }
805
+ }
806
+ },
807
+ onSurface: {
808
+ DEFAULT: { value: { base: s.onSurface, _dark: d.onSurface } },
809
+ variant: { value: { base: s.onSurfaceVariant, _dark: d.onSurfaceVariant } }
810
+ },
811
+ surfaceVariant: {
812
+ value: { base: s.surfaceVariant, _dark: d.surfaceVariant }
813
+ },
814
+ // Background
815
+ background: { value: { base: s.background, _dark: d.background } },
816
+ onBackground: { value: { base: s.onBackground, _dark: d.onBackground } },
817
+ // Outline
765
818
  outline: {
766
- DEFAULT: { value: { base: semantic.outline, _dark: semanticDark.outline } },
767
- variant: { value: { base: semantic.outlineVariant, _dark: semanticDark.outlineVariant } }
819
+ DEFAULT: { value: { base: s.outline, _dark: d.outline } },
820
+ variant: { value: { base: s.outlineVariant, _dark: d.outlineVariant } }
821
+ },
822
+ // Inverse
823
+ inverseSurface: {
824
+ value: { base: s.inverseSurface, _dark: d.inverseSurface }
825
+ },
826
+ inverseOnSurface: {
827
+ value: { base: s.inverseOnSurface, _dark: d.inverseOnSurface }
828
+ },
829
+ inversePrimary: {
830
+ value: { base: s.inversePrimary, _dark: d.inversePrimary }
768
831
  },
769
- // M3 Inverse
770
- inverseSurface: { value: { base: semantic.inverseSurface, _dark: semanticDark.inverseSurface } },
771
- inverseOnSurface: { value: { base: semantic.inverseOnSurface, _dark: semanticDark.inverseOnSurface } },
772
- inversePrimary: { value: { base: semantic.inversePrimary, _dark: semanticDark.inversePrimary } },
773
832
  // Not standard M3 tokens, but follow inversePrimary's pattern:
774
833
  // light mode = dark-palette value, dark mode = light-palette value.
775
- inverseSecondary: { value: { base: semanticDark.secondary, _dark: semantic.secondary } },
776
- inverseTertiary: { value: { base: semanticDark.tertiary, _dark: semantic.tertiary } },
777
- // Scrim/Shadow
778
- scrim: { value: { base: semantic.scrim, _dark: semanticDark.scrim } }
834
+ inverseSecondary: { value: { base: d.secondary, _dark: s.secondary } },
835
+ inverseTertiary: { value: { base: d.tertiary, _dark: s.tertiary } },
836
+ // Utility
837
+ scrim: { value: { base: s.scrim, _dark: d.scrim } },
838
+ shadow: { value: { base: s.shadow, _dark: d.shadow } }
779
839
  });
780
840
  var button = dev.defineRecipe({
781
841
  className: "button",
@@ -4311,8 +4371,19 @@ var discourserPandaPreset = dev.definePreset({
4311
4371
  // Semantic tokens: M3 colors + Park UI aliases + shadows + radii
4312
4372
  semanticTokens: {
4313
4373
  colors: {
4314
- // M3-to-Radix color bridges
4374
+ // Non-conflicting M3 semantic tokens land here first
4375
+ // (onPrimary, onSecondary, surface, outline, etc.)
4376
+ ...semanticColorTokens,
4377
+ // M3-to-Radix color bridges — overwrite conflicting top-level keys,
4378
+ // then re-merge the M3 semantic DEFAULT+container back in
4315
4379
  ...colors,
4380
+ primary: { ...colors.primary, ...semanticColorTokens.primary },
4381
+ secondary: {
4382
+ ...colors.secondary,
4383
+ ...semanticColorTokens.secondary
4384
+ },
4385
+ tertiary: { ...colors.tertiary, ...semanticColorTokens.tertiary },
4386
+ error: { ...colors.error, ...semanticColorTokens.error },
4316
4387
  // Park UI-style aliases for component compatibility
4317
4388
  fg: {
4318
4389
  default: {
@@ -4331,8 +4402,6 @@ var discourserPandaPreset = dev.definePreset({
4331
4402
  border: {
4332
4403
  value: { base: "{colors.gray.6}", _dark: "{colors.gray.6}" }
4333
4404
  },
4334
- // M3 semantic tokens (surface, onSurface, etc.)
4335
- ...m3SemanticTokens,
4336
4405
  // Base colors
4337
4406
  white: { value: "#FFFFFF" },
4338
4407
  black: { value: "#000000" }
@@ -4420,5 +4489,5 @@ var discourserPandaPreset = dev.definePreset({
4420
4489
  exports.discourserPandaPreset = discourserPandaPreset;
4421
4490
  exports.material3Language = material3Language;
4422
4491
  exports.transformToPandaTheme = transformToPandaTheme;
4423
- //# sourceMappingURL=chunk-L5FO6K6L.cjs.map
4424
- //# sourceMappingURL=chunk-L5FO6K6L.cjs.map
4492
+ //# sourceMappingURL=chunk-IGCGVSG4.cjs.map
4493
+ //# sourceMappingURL=chunk-IGCGVSG4.cjs.map