@sanity/ui 2.0.0-alpha.35 → 2.0.0-alpha.37

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/theme.js CHANGED
@@ -1684,13 +1684,34 @@ function getTheme_v2(theme) {
1684
1684
  if (cached_v2) return cached_v2;
1685
1685
  const v2 = {
1686
1686
  _version: 2,
1687
- avatar: theme.sanity.avatar,
1688
- button: theme.sanity.button,
1689
- card: theme.sanity.card,
1687
+ avatar: {
1688
+ ...defaultThemeConfig.avatar,
1689
+ ...theme.sanity.avatar
1690
+ },
1691
+ button: {
1692
+ ...defaultThemeConfig.button,
1693
+ ...theme.sanity.button
1694
+ },
1695
+ card: defaultThemeConfig.card,
1690
1696
  color: themeColor_v0_v2(theme.sanity.color),
1691
1697
  container: theme.sanity.container,
1692
1698
  font: theme.sanity.fonts,
1693
- input: theme.sanity.input,
1699
+ input: {
1700
+ ...defaultThemeConfig.input,
1701
+ ...theme.sanity.input,
1702
+ checkbox: {
1703
+ ...defaultThemeConfig.input.checkbox,
1704
+ ...theme.sanity.input.checkbox
1705
+ },
1706
+ radio: {
1707
+ ...defaultThemeConfig.input.radio,
1708
+ ...theme.sanity.input.radio
1709
+ },
1710
+ switch: {
1711
+ ...defaultThemeConfig.input.switch,
1712
+ ...theme.sanity.input.switch
1713
+ }
1714
+ },
1694
1715
  layer: (_a = theme.sanity.layer) != null ? _a : defaultThemeConfig.layer,
1695
1716
  media: theme.sanity.media,
1696
1717
  radius: theme.sanity.radius,
@@ -1715,7 +1736,6 @@ function v0_v2(v0) {
1715
1736
  const {
1716
1737
  avatar,
1717
1738
  button,
1718
- card,
1719
1739
  color,
1720
1740
  container,
1721
1741
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -1731,9 +1751,15 @@ function v0_v2(v0) {
1731
1751
  } = v0;
1732
1752
  const v2 = {
1733
1753
  _version: 2,
1734
- avatar,
1735
- button,
1736
- card,
1754
+ avatar: {
1755
+ ...defaultThemeConfig.avatar,
1756
+ ...avatar
1757
+ },
1758
+ button: {
1759
+ ...defaultThemeConfig.button,
1760
+ ...button
1761
+ },
1762
+ card: defaultThemeConfig.card,
1737
1763
  color: {
1738
1764
  light: {
1739
1765
  transparent: themeColor_v0_v2(color.light.transparent),
@@ -1754,7 +1780,22 @@ function v0_v2(v0) {
1754
1780
  },
1755
1781
  container,
1756
1782
  font,
1757
- input,
1783
+ input: {
1784
+ ...defaultThemeConfig.input,
1785
+ ...input,
1786
+ checkbox: {
1787
+ ...defaultThemeConfig.input.checkbox,
1788
+ ...input.checkbox
1789
+ },
1790
+ radio: {
1791
+ ...defaultThemeConfig.input.radio,
1792
+ ...input.radio
1793
+ },
1794
+ switch: {
1795
+ ...defaultThemeConfig.input.switch,
1796
+ ...input.switch
1797
+ }
1798
+ },
1758
1799
  layer: layer != null ? layer : defaultThemeConfig.layer,
1759
1800
  media,
1760
1801
  radius,
@@ -1772,7 +1813,6 @@ function v2_v0(v2) {
1772
1813
  const {
1773
1814
  avatar,
1774
1815
  button,
1775
- card,
1776
1816
  color,
1777
1817
  container,
1778
1818
  font: fonts,
@@ -1787,7 +1827,6 @@ function v2_v0(v2) {
1787
1827
  _version: 0,
1788
1828
  avatar,
1789
1829
  button,
1790
- card,
1791
1830
  container,
1792
1831
  color: {
1793
1832
  light: {
@@ -4242,9 +4281,14 @@ function buildTheme(config) {
4242
4281
  avatar: (_a = config == null ? void 0 : config.avatar) != null ? _a : defaultThemeConfig.avatar,
4243
4282
  button: (_b = config == null ? void 0 : config.button) != null ? _b : defaultThemeConfig.button,
4244
4283
  card: (_c = config == null ? void 0 : config.card) != null ? _c : defaultThemeConfig.card,
4284
+ // How colors are generated:
4285
+ // 1. Merge custom tokens with default tokens
4286
+ // 2. Generate tree of color keys (gray/500, black, white, etc.)
4287
+ // 3. Apply mixing and render to hex values
4288
+ // render(build(mergeWithDefaults()))
4245
4289
  color: renderThemeColorSchemes(colorTheme, config),
4246
4290
  container: (_d = config == null ? void 0 : config.container) != null ? _d : defaultThemeConfig.container,
4247
- font: (_e = config == null ? void 0 : config.fonts) != null ? _e : defaultThemeFonts,
4291
+ font: (_e = config == null ? void 0 : config.font) != null ? _e : defaultThemeFonts,
4248
4292
  input: (_f = config == null ? void 0 : config.input) != null ? _f : defaultThemeConfig.input,
4249
4293
  layer: (_g = config == null ? void 0 : config.layer) != null ? _g : defaultThemeConfig.layer,
4250
4294
  media: (_h = config == null ? void 0 : config.media) != null ? _h : defaultThemeConfig.media,