@spark-ui/tailwind-plugins 3.5.0 → 3.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,19 @@
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
+ # [3.7.0](https://github.com/adevinta/spark/compare/@spark-ui/tailwind-plugins@3.6.0...@spark-ui/tailwind-plugins@3.7.0) (2024-04-12)
7
+
8
+ ### Features
9
+
10
+ - **snackbar:** add left gesture to close ([5a0fe20](https://github.com/adevinta/spark/commit/5a0fe200b8dd632b4c6f6c0319f44bc2e5183564))
11
+ - **snackbar:** improve swipe hook and updating styles ([1addc58](https://github.com/adevinta/spark/commit/1addc584567523c149ebfc3dc863e2996f3a028b))
12
+
13
+ # [3.6.0](https://github.com/adevinta/spark/compare/@spark-ui/tailwind-plugins@3.5.0...@spark-ui/tailwind-plugins@3.6.0) (2024-01-04)
14
+
15
+ ### Features
16
+
17
+ - **tailwind-plugins:** export TCV utils ([6fba6dc](https://github.com/adevinta/spark/commit/6fba6dc08a18f0f1c0773464494a5aba331dd572))
18
+
6
19
  # [3.5.0](https://github.com/adevinta/spark/compare/@spark-ui/tailwind-plugins@3.4.2...@spark-ui/tailwind-plugins@3.5.0) (2024-01-03)
7
20
 
8
21
  ### Features
@@ -163,6 +163,14 @@ module.exports = plugin.withOptions(
163
163
  '0%': { transform: 'translateX(0)' },
164
164
  '100%': { transform: 'translateX(-100%)' },
165
165
  },
166
+ swipeOutRight: {
167
+ '0%': { transform: 'translateX(var(--swipe-position-x))' },
168
+ '100%': { transform: 'translateX(100vw)' },
169
+ },
170
+ swipeOutLeft: {
171
+ '0%': { transform: 'translateX(var(--swipe-position-x))' },
172
+ '100%': { transform: 'translateX(-100vw)' },
173
+ },
166
174
  standaloneIndeterminateBar: {
167
175
  '0%': {
168
176
  left: '0',
@@ -197,6 +205,9 @@ module.exports = plugin.withOptions(
197
205
  'slide-out-left': 'slideOutLeft 0.4s cubic-bezier(0.05, 0.7, 0.1, 1)',
198
206
  'standalone-indeterminate-bar':
199
207
  'standaloneIndeterminateBar 1s ease-out infinite normal none running',
208
+ // swipeOut
209
+ 'swipe-out-right': 'swipeOutRight 0.1s ease-out',
210
+ 'swipe-out-left': 'swipeOutLeft 0.1s ease-out',
200
211
  },
201
212
  },
202
213
  },
package/index.js CHANGED
@@ -4,7 +4,8 @@ const sizings = require('./sizings')
4
4
  const utilities = require('./utilities')
5
5
  const variants = require('./variants')
6
6
  const sparkTheme = require('./spark-theme')
7
- const tailwindConfigViewerMisc = require('./tailwind.config.viewer.misc')
7
+ const tailwindConfigViewerUtils = require('./tailwind-config-viewer')
8
+ const tailwindConfigViewerMisc = require('./tailwind-config-viewer/misc')
8
9
  const tailwindcssRadix = require('tailwindcss-radix')
9
10
 
10
11
  /**
@@ -37,5 +38,6 @@ module.exports = {
37
38
  variants,
38
39
  sparkTheme,
39
40
  sparkConfig,
41
+ tailwindConfigViewerUtils,
40
42
  tailwindConfigViewerMisc,
41
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-ui/tailwind-plugins",
3
- "version": "3.5.0",
3
+ "version": "3.7.0",
4
4
  "description": "Spark Tailwind plugins",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -35,5 +35,5 @@
35
35
  },
36
36
  "homepage": "https://sparkui.vercel.app",
37
37
  "license": "MIT",
38
- "gitHead": "d408a2ca70c66ed2b69b7f7bc028f471df99313c"
38
+ "gitHead": "0f4337672a59af327db0c62e0efbd14545bf4003"
39
39
  }
@@ -0,0 +1,48 @@
1
+ const utils = {
2
+ isObject(value) {
3
+ return !!value && value.constructor === Object
4
+ },
5
+ isStringOrNumber(value) {
6
+ return typeof value === 'string' || typeof value === 'number'
7
+ },
8
+ toKebabCase(value) {
9
+ if (value.toUpperCase() === value) return value.toLowerCase()
10
+
11
+ return value.replace(/[A-Z0-9]/g, e => `-${e.toLocaleLowerCase()}`)
12
+ },
13
+ doubleHyphensRegex: /(?<!var\()--+/g,
14
+ }
15
+
16
+ function toTailwindConfigViewer(defaultTheme) {
17
+ const result = {}
18
+
19
+ function flatten(theme, paths = []) {
20
+ Object.entries(theme).forEach(([key, value]) => {
21
+ if (utils.isObject(value)) return flatten(value, paths.concat(key))
22
+
23
+ if (utils.isStringOrNumber(value)) {
24
+ if (paths.includes('colors')) {
25
+ result[
26
+ `rgb(var(--${[...paths, key]
27
+ .map(utils.toKebabCase)
28
+ .join('-')
29
+ .replace(utils.doubleHyphensRegex, '-')}) / <alpha-value>)`
30
+ ] = value
31
+ }
32
+
33
+ result[
34
+ `var(--${[...paths, key]
35
+ .map(utils.toKebabCase)
36
+ .join('-')
37
+ .replace(utils.doubleHyphensRegex, '-')})`
38
+ ] = value
39
+ }
40
+ })
41
+ }
42
+
43
+ flatten(defaultTheme)
44
+
45
+ return result
46
+ }
47
+
48
+ module.exports = { toTailwindConfigViewer }