@spark-ui/tailwind-plugins 2.5.0 → 2.7.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/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.7.0](https://github.com/adevinta/spark/compare/@spark-ui/tailwind-plugins@2.6.0...@spark-ui/tailwind-plugins@2.7.0) (2023-04-19)
7
+
8
+ ### Features
9
+
10
+ - **tailwind-plugins:** add a new utilities plugin ([9fa1d36](https://github.com/adevinta/spark/commit/9fa1d36024563953314af438942542a70b372851))
11
+
12
+ # [2.6.0](https://github.com/adevinta/spark/compare/@spark-ui/tailwind-plugins@2.5.0...@spark-ui/tailwind-plugins@2.6.0) (2023-04-14)
13
+
14
+ ### Features
15
+
16
+ - **tailwind-plugins:** optimize multi-theme handling by eliminating token duplication ([fdf1483](https://github.com/adevinta/spark/commit/fdf1483685f0ce1ab64c4a8f03270b32a97796ec)), closes [#592](https://github.com/adevinta/spark/issues/592)
17
+
6
18
  # [2.5.0](https://github.com/adevinta/spark/compare/@spark-ui/tailwind-plugins@2.4.0...@spark-ui/tailwind-plugins@2.5.0) (2023-04-07)
7
19
 
8
20
  ### Features
package/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-var-requires */
2
2
  const animations = require('./animations')
3
3
  const sizings = require('./sizings')
4
+ const utilities = require('./utilities')
4
5
  const sparkTheme = require('./spark-theme')
5
6
  const tailwindcssRadix = require('tailwindcss-radix')
6
7
 
@@ -21,6 +22,7 @@ const sparkConfig = ({ htmlFontSize, themes }) => {
21
22
  sparkTheme({ htmlFontSize, themes }),
22
23
  sizings({ htmlFontSize }),
23
24
  animations(),
25
+ utilities(),
24
26
  tailwindcssRadix({ variantPrefix: 'spark' }),
25
27
  ]
26
28
  }
@@ -28,6 +30,7 @@ const sparkConfig = ({ htmlFontSize, themes }) => {
28
30
  module.exports = {
29
31
  animations,
30
32
  sizings,
33
+ utilities,
31
34
  sparkTheme,
32
35
  sparkConfig,
33
36
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/tailwind-plugins",
3
- "version": "2.5.0",
3
+ "version": "2.7.0",
4
4
  "description": "Spark Tailwind plugins",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -18,5 +18,5 @@
18
18
  "url": "git@github.com:adevinta/spark.git",
19
19
  "directory": "packages/utils/tailwind-plugins"
20
20
  },
21
- "gitHead": "a5e5af21496ded1cce43912266002fa36b3ac328"
21
+ "gitHead": "51d8f4725c9636e9d47dc0d8761fc6e589bb9d9c"
22
22
  }
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-var-requires */
2
2
  const { getCSSVariableDeclarations } = require('./getCSSVariableDeclarations')
3
3
  const { getCSSVariableReferences } = require('./getCSSVariableReferences')
4
- const { retrieveArrayDifferences, getAllObjectKeys } = require('./utils')
4
+ const { retrieveArrayDifferences, getAllObjectKeys, getObjectDifferences } = require('./utils')
5
5
 
6
6
  const themeUtils = require('@spark-ui/theme-utils')
7
7
  const plugin = require('tailwindcss/plugin')
@@ -78,7 +78,10 @@ module.exports = plugin.withOptions(
78
78
  }
79
79
 
80
80
  addBase({
81
- [`[data-theme="${key}"]`]: getCSSVariableDeclarations(value, htmlFontSize),
81
+ [`[data-theme="${key}"]`]: getObjectDifferences(
82
+ getCSSVariableDeclarations(themes.default, htmlFontSize),
83
+ getCSSVariableDeclarations(value, htmlFontSize)
84
+ ),
82
85
  })
83
86
  })
84
87
  },
@@ -68,6 +68,19 @@ function retrieveArrayDifferences({ ref, comp }) {
68
68
  }
69
69
  }
70
70
 
71
+ function getObjectDifferences(reference, comparison) {
72
+ const diffObj = {}
73
+
74
+ Object.keys(comparison).forEach(key => {
75
+ if (reference[key] === comparison[key]) {
76
+ return
77
+ }
78
+ diffObj[key] = comparison[key]
79
+ })
80
+
81
+ return diffObj
82
+ }
83
+
71
84
  module.exports = {
72
85
  isObject,
73
86
  isStringOrNumber,
@@ -80,4 +93,5 @@ module.exports = {
80
93
  doubleHyphensRegex,
81
94
  getAllObjectKeys,
82
95
  retrieveArrayDifferences,
96
+ getObjectDifferences,
83
97
  }
@@ -0,0 +1,11 @@
1
+ /* eslint-disable-next-line @typescript-eslint/no-var-requires */
2
+ const plugin = require('tailwindcss/plugin')
3
+
4
+ module.exports = plugin.withOptions(options => ({ addUtilities }) => {
5
+ addUtilities({
6
+ '.current-font-size': {
7
+ width: '1em',
8
+ height: '1em',
9
+ },
10
+ })
11
+ })