@udixio/theme 1.0.0-beta.17 → 1.0.0-beta.18

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/index.d.ts CHANGED
@@ -7,5 +7,6 @@ export * from './config';
7
7
  export * from './main';
8
8
  export * from './material-color-utilities';
9
9
  export * from './plugin';
10
+ export * from './plugins/font';
10
11
  export * from './plugins/tailwind';
11
12
  export * from './theme';
@@ -0,0 +1 @@
1
+ export * from './font.plugin';
@@ -1650,95 +1650,11 @@ function bootstrapFromConfig(path) {
1650
1650
  var PluginAbstract = function PluginAbstract() {};
1651
1651
  PluginAbstract.dependencies = [];
1652
1652
 
1653
- var state = function state(colorkeys) {
1654
- return plugin(function (pluginArgs) {
1655
- addAllNewComponents(pluginArgs, {
1656
- statePrefix: 'state',
1657
- disabledStyles: {
1658
- textOpacity: 0.38,
1659
- backgroundOpacity: 0.12
1660
- },
1661
- transition: {
1662
- duration: 150
1663
- }
1664
- }, colorkeys);
1665
- }, {});
1666
- };
1667
- var addAllNewComponents = function addAllNewComponents(_ref, _ref2, colorKeys) {
1668
- var addComponents = _ref.addComponents;
1669
- var statePrefix = _ref2.statePrefix,
1670
- disabledStyles = _ref2.disabledStyles,
1671
- transition = _ref2.transition;
1672
- var newComponents = {};
1673
- for (var _i = 0, _arr = [false, true]; _i < _arr.length; _i++) {
1674
- var isGroup = _arr[_i];
1675
- var group = isGroup ? 'group-' : '';
1676
- for (var _iterator = _createForOfIteratorHelperLoose(colorKeys), _step; !(_step = _iterator()).done;) {
1677
- var _newComponents$classN;
1678
- var colorName = _step.value;
1679
- var className = "." + group + statePrefix + "-" + colorName;
1680
- newComponents[className] = (_newComponents$classN = {}, _newComponents$classN["@apply " + group + "hover:bg-" + colorName + "/[0.08]"] = {}, _newComponents$classN["@apply " + group + "active:bg-" + colorName + "/[0.12]"] = {}, _newComponents$classN["@apply " + group + "focus-visible:bg-" + colorName + "/[0.12]"] = {}, _newComponents$classN);
1681
- if (transition) {
1682
- newComponents[className]["@apply transition-colors"] = {};
1683
- newComponents[className]["@apply duration-" + transition.duration] = {};
1684
- }
1685
- if (disabledStyles) {
1686
- newComponents[className]["@apply " + group + "disabled:text-on-surface/[" + disabledStyles.textOpacity + "]"] = {};
1687
- newComponents[className]["@apply " + group + "disabled:bg-on-surface/[" + disabledStyles.backgroundOpacity + "]"] = {};
1688
- }
1689
- }
1690
- }
1691
- for (var _iterator2 = _createForOfIteratorHelperLoose(colorKeys), _step2; !(_step2 = _iterator2()).done;) {
1692
- var _colorName = _step2.value;
1693
- for (var _i2 = 0, _arr2 = ['hover', 'active', 'focus', 'disabled']; _i2 < _arr2.length; _i2++) {
1694
- var stateName = _arr2[_i2];
1695
- var _className = "." + stateName + "-" + statePrefix + "-" + _colorName;
1696
- if (stateName === 'active' || stateName === 'focus') {
1697
- var _newComponents$_class;
1698
- newComponents[_className] = (_newComponents$_class = {}, _newComponents$_class["@apply bg-" + _colorName + "/[0.12]"] = {}, _newComponents$_class);
1699
- } else if (stateName === 'hover') {
1700
- var _newComponents$_class2;
1701
- newComponents[_className] = (_newComponents$_class2 = {}, _newComponents$_class2["@apply bg-" + _colorName + "/[0.08]"] = {}, _newComponents$_class2);
1702
- } else if (stateName === 'disabled') {
1703
- var _newComponents$_class3, _newComponents$_class4;
1704
- newComponents[_className] = (_newComponents$_class3 = {}, _newComponents$_class3["@apply text-on-surface/[" + disabledStyles.textOpacity + "]"] = {}, _newComponents$_class3);
1705
- newComponents[_className] = (_newComponents$_class4 = {}, _newComponents$_class4["@apply bg-on-surface/[" + disabledStyles.backgroundOpacity + "]"] = {}, _newComponents$_class4);
1706
- }
1707
- }
1708
- }
1709
- addComponents(newComponents);
1710
- };
1711
-
1712
- var themer = function themer(colors, darkMode) {
1713
- var options = {
1714
- defaultTheme: {
1715
- extend: {
1716
- colors: {}
1717
- }
1718
- },
1719
- themes: [{
1720
- name: 'darkTheme',
1721
- extend: {
1722
- colors: {}
1723
- }
1724
- }]
1725
- };
1726
- Object.entries(colors).forEach(function (_ref) {
1727
- var key = _ref[0],
1728
- value = _ref[1];
1729
- options.defaultTheme.extend.colors[key] = value.light;
1730
- options.themes[0].extend.colors[key] = value.dark;
1731
- });
1732
- options.themes[0].selectors = darkMode === 'class' ? ['.dark-mode', '[data-theme="dark"]'] : undefined;
1733
- options.themes[0].mediaQuery = darkMode === 'media' ? '@media (prefers-color-scheme: dark)' : undefined;
1734
- return require('tailwindcss-themer')(options);
1735
- };
1736
-
1737
- var FontFamily;
1653
+ exports.FontFamily = void 0;
1738
1654
  (function (FontFamily) {
1739
1655
  FontFamily["Expressive"] = "expressive";
1740
1656
  FontFamily["Neutral"] = "neutral";
1741
- })(FontFamily || (FontFamily = {}));
1657
+ })(exports.FontFamily || (exports.FontFamily = {}));
1742
1658
  var FontPlugin = /*#__PURE__*/function (_PluginAbstract) {
1743
1659
  function FontPlugin(appService, options) {
1744
1660
  var _options$fontFamily$e, _options$fontFamily, _options$fontFamily$n, _options$fontFamily2;
@@ -1761,19 +1677,19 @@ var FontPlugin = /*#__PURE__*/function (_PluginAbstract) {
1761
1677
  fontSize: 3.5625,
1762
1678
  lineHeight: 4,
1763
1679
  letterSpacing: -0.015625,
1764
- fontFamily: FontFamily.Expressive
1680
+ fontFamily: exports.FontFamily.Expressive
1765
1681
  },
1766
1682
  medium: {
1767
1683
  fontWeight: 400,
1768
1684
  fontSize: 2.8125,
1769
1685
  lineHeight: 3.25,
1770
- fontFamily: FontFamily.Expressive
1686
+ fontFamily: exports.FontFamily.Expressive
1771
1687
  },
1772
1688
  small: {
1773
1689
  fontWeight: 400,
1774
1690
  fontSize: 2.25,
1775
1691
  lineHeight: 2.75,
1776
- fontFamily: FontFamily.Expressive
1692
+ fontFamily: exports.FontFamily.Expressive
1777
1693
  }
1778
1694
  },
1779
1695
  headline: {
@@ -1781,19 +1697,19 @@ var FontPlugin = /*#__PURE__*/function (_PluginAbstract) {
1781
1697
  fontWeight: 400,
1782
1698
  fontSize: 2,
1783
1699
  lineHeight: 2.5,
1784
- fontFamily: FontFamily.Expressive
1700
+ fontFamily: exports.FontFamily.Expressive
1785
1701
  },
1786
1702
  medium: {
1787
1703
  fontWeight: 400,
1788
1704
  fontSize: 1.75,
1789
1705
  lineHeight: 2.25,
1790
- fontFamily: FontFamily.Expressive
1706
+ fontFamily: exports.FontFamily.Expressive
1791
1707
  },
1792
1708
  small: {
1793
1709
  fontWeight: 400,
1794
1710
  fontSize: 1.5,
1795
1711
  lineHeight: 2,
1796
- fontFamily: FontFamily.Expressive
1712
+ fontFamily: exports.FontFamily.Expressive
1797
1713
  }
1798
1714
  },
1799
1715
  title: {
@@ -1801,20 +1717,20 @@ var FontPlugin = /*#__PURE__*/function (_PluginAbstract) {
1801
1717
  fontWeight: 400,
1802
1718
  fontSize: 1.375,
1803
1719
  lineHeight: 1.75,
1804
- fontFamily: FontFamily.Neutral
1720
+ fontFamily: exports.FontFamily.Neutral
1805
1721
  },
1806
1722
  medium: {
1807
1723
  fontWeight: 500,
1808
1724
  fontSize: 1,
1809
1725
  lineHeight: 1.5,
1810
- fontFamily: FontFamily.Neutral,
1726
+ fontFamily: exports.FontFamily.Neutral,
1811
1727
  letterSpacing: 0.009375
1812
1728
  },
1813
1729
  small: {
1814
1730
  fontWeight: 500,
1815
1731
  fontSize: 0.875,
1816
1732
  lineHeight: 1.25,
1817
- fontFamily: FontFamily.Neutral,
1733
+ fontFamily: exports.FontFamily.Neutral,
1818
1734
  letterSpacing: 0.00625
1819
1735
  }
1820
1736
  },
@@ -1823,21 +1739,21 @@ var FontPlugin = /*#__PURE__*/function (_PluginAbstract) {
1823
1739
  fontWeight: 500,
1824
1740
  fontSize: 0.875,
1825
1741
  lineHeight: 1.25,
1826
- fontFamily: FontFamily.Neutral,
1742
+ fontFamily: exports.FontFamily.Neutral,
1827
1743
  letterSpacing: 0.00625
1828
1744
  },
1829
1745
  medium: {
1830
1746
  fontWeight: 500,
1831
1747
  fontSize: 0.75,
1832
1748
  lineHeight: 1,
1833
- fontFamily: FontFamily.Neutral,
1749
+ fontFamily: exports.FontFamily.Neutral,
1834
1750
  letterSpacing: 0.03125
1835
1751
  },
1836
1752
  small: {
1837
1753
  fontWeight: 500,
1838
1754
  fontSize: 0.6875,
1839
1755
  lineHeight: 1,
1840
- fontFamily: FontFamily.Neutral,
1756
+ fontFamily: exports.FontFamily.Neutral,
1841
1757
  letterSpacing: 0.03125
1842
1758
  }
1843
1759
  },
@@ -1846,21 +1762,21 @@ var FontPlugin = /*#__PURE__*/function (_PluginAbstract) {
1846
1762
  fontWeight: 400,
1847
1763
  fontSize: 1,
1848
1764
  lineHeight: 1.5625,
1849
- fontFamily: FontFamily.Neutral,
1765
+ fontFamily: exports.FontFamily.Neutral,
1850
1766
  letterSpacing: 0.03125
1851
1767
  },
1852
1768
  medium: {
1853
1769
  fontWeight: 400,
1854
1770
  fontSize: 0.875,
1855
1771
  lineHeight: 1.25,
1856
- fontFamily: FontFamily.Neutral,
1772
+ fontFamily: exports.FontFamily.Neutral,
1857
1773
  letterSpacing: 0.015625
1858
1774
  },
1859
1775
  small: {
1860
1776
  fontWeight: 400,
1861
1777
  fontSize: 0.75,
1862
1778
  lineHeight: 1,
1863
- fontFamily: FontFamily.Neutral,
1779
+ fontFamily: exports.FontFamily.Neutral,
1864
1780
  letterSpacing: 0.025
1865
1781
  }
1866
1782
  }
@@ -1894,6 +1810,90 @@ var FontPlugin = /*#__PURE__*/function (_PluginAbstract) {
1894
1810
  return FontPlugin;
1895
1811
  }(PluginAbstract);
1896
1812
 
1813
+ var state = function state(colorkeys) {
1814
+ return plugin(function (pluginArgs) {
1815
+ addAllNewComponents(pluginArgs, {
1816
+ statePrefix: 'state',
1817
+ disabledStyles: {
1818
+ textOpacity: 0.38,
1819
+ backgroundOpacity: 0.12
1820
+ },
1821
+ transition: {
1822
+ duration: 150
1823
+ }
1824
+ }, colorkeys);
1825
+ }, {});
1826
+ };
1827
+ var addAllNewComponents = function addAllNewComponents(_ref, _ref2, colorKeys) {
1828
+ var addComponents = _ref.addComponents;
1829
+ var statePrefix = _ref2.statePrefix,
1830
+ disabledStyles = _ref2.disabledStyles,
1831
+ transition = _ref2.transition;
1832
+ var newComponents = {};
1833
+ for (var _i = 0, _arr = [false, true]; _i < _arr.length; _i++) {
1834
+ var isGroup = _arr[_i];
1835
+ var group = isGroup ? 'group-' : '';
1836
+ for (var _iterator = _createForOfIteratorHelperLoose(colorKeys), _step; !(_step = _iterator()).done;) {
1837
+ var _newComponents$classN;
1838
+ var colorName = _step.value;
1839
+ var className = "." + group + statePrefix + "-" + colorName;
1840
+ newComponents[className] = (_newComponents$classN = {}, _newComponents$classN["@apply " + group + "hover:bg-" + colorName + "/[0.08]"] = {}, _newComponents$classN["@apply " + group + "active:bg-" + colorName + "/[0.12]"] = {}, _newComponents$classN["@apply " + group + "focus-visible:bg-" + colorName + "/[0.12]"] = {}, _newComponents$classN);
1841
+ if (transition) {
1842
+ newComponents[className]["@apply transition-colors"] = {};
1843
+ newComponents[className]["@apply duration-" + transition.duration] = {};
1844
+ }
1845
+ if (disabledStyles) {
1846
+ newComponents[className]["@apply " + group + "disabled:text-on-surface/[" + disabledStyles.textOpacity + "]"] = {};
1847
+ newComponents[className]["@apply " + group + "disabled:bg-on-surface/[" + disabledStyles.backgroundOpacity + "]"] = {};
1848
+ }
1849
+ }
1850
+ }
1851
+ for (var _iterator2 = _createForOfIteratorHelperLoose(colorKeys), _step2; !(_step2 = _iterator2()).done;) {
1852
+ var _colorName = _step2.value;
1853
+ for (var _i2 = 0, _arr2 = ['hover', 'active', 'focus', 'disabled']; _i2 < _arr2.length; _i2++) {
1854
+ var stateName = _arr2[_i2];
1855
+ var _className = "." + stateName + "-" + statePrefix + "-" + _colorName;
1856
+ if (stateName === 'active' || stateName === 'focus') {
1857
+ var _newComponents$_class;
1858
+ newComponents[_className] = (_newComponents$_class = {}, _newComponents$_class["@apply bg-" + _colorName + "/[0.12]"] = {}, _newComponents$_class);
1859
+ } else if (stateName === 'hover') {
1860
+ var _newComponents$_class2;
1861
+ newComponents[_className] = (_newComponents$_class2 = {}, _newComponents$_class2["@apply bg-" + _colorName + "/[0.08]"] = {}, _newComponents$_class2);
1862
+ } else if (stateName === 'disabled') {
1863
+ var _newComponents$_class3, _newComponents$_class4;
1864
+ newComponents[_className] = (_newComponents$_class3 = {}, _newComponents$_class3["@apply text-on-surface/[" + disabledStyles.textOpacity + "]"] = {}, _newComponents$_class3);
1865
+ newComponents[_className] = (_newComponents$_class4 = {}, _newComponents$_class4["@apply bg-on-surface/[" + disabledStyles.backgroundOpacity + "]"] = {}, _newComponents$_class4);
1866
+ }
1867
+ }
1868
+ }
1869
+ addComponents(newComponents);
1870
+ };
1871
+
1872
+ var themer = function themer(colors, darkMode) {
1873
+ var options = {
1874
+ defaultTheme: {
1875
+ extend: {
1876
+ colors: {}
1877
+ }
1878
+ },
1879
+ themes: [{
1880
+ name: 'darkTheme',
1881
+ extend: {
1882
+ colors: {}
1883
+ }
1884
+ }]
1885
+ };
1886
+ Object.entries(colors).forEach(function (_ref) {
1887
+ var key = _ref[0],
1888
+ value = _ref[1];
1889
+ options.defaultTheme.extend.colors[key] = value.light;
1890
+ options.themes[0].extend.colors[key] = value.dark;
1891
+ });
1892
+ options.themes[0].selectors = darkMode === 'class' ? ['.dark-mode', '[data-theme="dark"]'] : undefined;
1893
+ options.themes[0].mediaQuery = darkMode === 'media' ? '@media (prefers-color-scheme: dark)' : undefined;
1894
+ return require('tailwindcss-themer')(options);
1895
+ };
1896
+
1897
1897
  var font = function font(fontStyles, responsiveBreakPoints) {
1898
1898
  var createUtilities = function createUtilities(_ref) {
1899
1899
  var theme = _ref.theme;
@@ -2014,6 +2014,7 @@ exports.ConfigModule = ConfigModule;
2014
2014
  exports.ConfigService = ConfigService;
2015
2015
  exports.ContrastCurve = ContrastCurve;
2016
2016
  exports.DynamicColor = DynamicColor;
2017
+ exports.FontPlugin = FontPlugin;
2017
2018
  exports.PluginAbstract = PluginAbstract;
2018
2019
  exports.PluginModule = PluginModule;
2019
2020
  exports.PluginService = PluginService;