@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.
- package/dist/{chunk-L5FO6K6L.cjs → chunk-IGCGVSG4.cjs} +156 -87
- package/dist/chunk-IGCGVSG4.cjs.map +1 -0
- package/dist/{chunk-WFKEAD5P.js → chunk-VJN7TIGL.js} +156 -87
- package/dist/chunk-VJN7TIGL.js.map +1 -0
- package/dist/components/Checkbox.d.ts +3 -3
- package/dist/components/Icons/TrashIcon.d.ts +6 -0
- package/dist/components/Icons/TrashIcon.d.ts.map +1 -0
- package/dist/components/Icons/index.d.ts +1 -0
- package/dist/components/Icons/index.d.ts.map +1 -1
- package/dist/figma-codex.json +2 -2
- package/dist/index.cjs +4 -4
- package/dist/index.js +1 -1
- package/dist/languages/transform.d.ts +1 -8
- package/dist/languages/transform.d.ts.map +1 -1
- package/dist/preset/index.cjs +2 -2
- package/dist/preset/index.d.ts.map +1 -1
- package/dist/preset/index.js +1 -1
- package/dist/preset/semantic-tokens.d.ts +95 -45
- package/dist/preset/semantic-tokens.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/token-contract.test.ts +168 -0
- package/src/components/Icons/TrashIcon.tsx +34 -0
- package/src/components/Icons/index.ts +1 -0
- package/src/languages/transform.ts +74 -52
- package/src/preset/index.ts +14 -5
- package/src/preset/semantic-tokens.ts +120 -53
- package/dist/chunk-L5FO6K6L.cjs.map +0 -1
- package/dist/chunk-WFKEAD5P.js.map +0 -1
|
@@ -353,45 +353,55 @@ var material3Language = {
|
|
|
353
353
|
function transformToPandaTheme(language) {
|
|
354
354
|
return {
|
|
355
355
|
tokens: transformTokens(language),
|
|
356
|
-
semanticTokens: transformSemanticTokens(
|
|
356
|
+
semanticTokens: transformSemanticTokens(),
|
|
357
357
|
textStyles: transformTextStyles(language)
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
function transformTokens(language) {
|
|
361
361
|
return {
|
|
362
|
-
colors: transformColorPalettes(
|
|
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(
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
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(
|
|
381
|
-
const light = language.semantic;
|
|
382
|
-
const dark = language.semanticDark || light;
|
|
402
|
+
function transformSemanticTokens(_language) {
|
|
383
403
|
return {
|
|
384
|
-
colors:
|
|
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
|
|
718
|
-
var
|
|
719
|
-
var
|
|
720
|
-
//
|
|
721
|
-
|
|
722
|
-
DEFAULT: { value: { base:
|
|
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
|
-
|
|
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
|
-
|
|
734
|
-
DEFAULT: { value: { base:
|
|
735
|
-
|
|
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
|
-
//
|
|
738
|
-
|
|
739
|
-
DEFAULT: { value: { base:
|
|
740
|
-
container: {
|
|
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
|
-
|
|
743
|
-
DEFAULT: { value: { base:
|
|
744
|
-
container: {
|
|
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
|
-
//
|
|
747
|
-
|
|
748
|
-
DEFAULT: { value: { base:
|
|
749
|
-
container: {
|
|
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
|
-
|
|
752
|
-
DEFAULT: { value: { base:
|
|
753
|
-
container: {
|
|
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
|
-
//
|
|
756
|
-
|
|
757
|
-
DEFAULT: { value: { base:
|
|
758
|
-
container: { value: { base:
|
|
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
|
-
|
|
761
|
-
DEFAULT: { value: { base:
|
|
762
|
-
container: {
|
|
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
|
-
//
|
|
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:
|
|
767
|
-
variant: { value: { base:
|
|
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:
|
|
776
|
-
inverseTertiary: { value: { base:
|
|
777
|
-
//
|
|
778
|
-
scrim: { value: { base:
|
|
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
|
-
//
|
|
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-
|
|
4424
|
-
//# sourceMappingURL=chunk-
|
|
4492
|
+
//# sourceMappingURL=chunk-IGCGVSG4.cjs.map
|
|
4493
|
+
//# sourceMappingURL=chunk-IGCGVSG4.cjs.map
|