tailwind-to-style 2.10.1 → 2.10.2
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/README.md +229 -15
- package/dist/index.browser.js +31 -31
- package/dist/index.cjs +31 -31
- package/dist/index.esm.js +31 -31
- package/dist/index.min.js.map +1 -1
- package/dist/react.cjs.js +596 -184
- package/dist/react.esm.js +596 -184
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -15,15 +15,14 @@ The library exposes two main functions and a CLI tool:
|
|
|
15
15
|
2. **`twsx`**: A more advanced function that allows you to define nested and complex styles similar to SCSS, including support for responsive design, state variants, grouping, and enhanced CSS capabilities.
|
|
16
16
|
3. **`twsx-cli`**: A command-line tool for generating CSS files from `twsx.*.js` files with watch mode support.
|
|
17
17
|
|
|
18
|
-
## ✨ What's New in v2.
|
|
18
|
+
## ✨ What's New in v2.10.2
|
|
19
19
|
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
Now you can create smooth transitions and eye-catching animations like Tailwind CSS!
|
|
20
|
+
- **⚛️ React Integration**: Built-in React hooks and provider for seamless integration
|
|
21
|
+
- **🎬 Enhanced Animations**: Complete animation system with custom keyframes support
|
|
22
|
+
- **🔄 Improved Transitions**: Full transition utilities with duration, delay, and easing
|
|
23
|
+
- **🎨 Advanced Theming**: More flexible theme customization and plugin system
|
|
24
|
+
- **⚡ Performance Boost**: Better caching and optimized CSS generation
|
|
25
|
+
- **📱 Responsive Selector Syntax**: New intuitive `'md:.title': 'text-lg'` format
|
|
27
26
|
|
|
28
27
|
## ✨ What's New in v2.11.0
|
|
29
28
|
|
|
@@ -58,18 +57,233 @@ All changes are **backward compatible** - your existing code continues to work!
|
|
|
58
57
|
|
|
59
58
|
## Installation
|
|
60
59
|
|
|
61
|
-
To use `tailwind-to-style`, install the library using either npm or yarn:
|
|
62
|
-
|
|
63
|
-
### Using npm
|
|
64
|
-
|
|
65
60
|
```bash
|
|
66
61
|
npm install tailwind-to-style
|
|
67
62
|
```
|
|
68
63
|
|
|
69
|
-
|
|
64
|
+
## React Integration
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
### Quick Start with React
|
|
67
|
+
|
|
68
|
+
```javascript
|
|
69
|
+
import { useTwsx, TwsxProvider } from 'tailwind-to-style'
|
|
70
|
+
|
|
71
|
+
// Theme configuration
|
|
72
|
+
const config = {
|
|
73
|
+
theme: {
|
|
74
|
+
extend: {
|
|
75
|
+
colors: {
|
|
76
|
+
brand: { 500: '#3b82f6', 600: '#2563eb' }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function App() {
|
|
83
|
+
return (
|
|
84
|
+
<TwsxProvider config={config}>
|
|
85
|
+
<MyComponent />
|
|
86
|
+
</TwsxProvider>
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function MyComponent() {
|
|
91
|
+
// Auto-inject CSS into document head
|
|
92
|
+
useTwsx({
|
|
93
|
+
'.card': [
|
|
94
|
+
'bg-brand-500 text-white p-6 rounded-lg',
|
|
95
|
+
{
|
|
96
|
+
'&:hover': 'bg-brand-600 transform scale-105',
|
|
97
|
+
'.title': 'text-xl font-bold mb-2'
|
|
98
|
+
}
|
|
99
|
+
]
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<div className="card">
|
|
104
|
+
<h2 className="title">Interactive Card</h2>
|
|
105
|
+
<p>Hover me to see the effect!</p>
|
|
106
|
+
</div>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Import Options
|
|
112
|
+
|
|
113
|
+
```javascript
|
|
114
|
+
// Import from main package (recommended)
|
|
115
|
+
import { useTwsx, TwsxProvider } from 'tailwind-to-style'
|
|
116
|
+
|
|
117
|
+
// Or from React subpath
|
|
118
|
+
import { useTwsx, TwsxProvider } from 'tailwind-to-style/react'
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### `useTwsx()` Hook
|
|
122
|
+
|
|
123
|
+
The main React hook for component styling:
|
|
124
|
+
|
|
125
|
+
```javascript
|
|
126
|
+
import { useTwsx } from 'tailwind-to-style'
|
|
127
|
+
|
|
128
|
+
function MyComponent() {
|
|
129
|
+
// Auto-inject CSS (default behavior)
|
|
130
|
+
useTwsx({
|
|
131
|
+
'.button': [
|
|
132
|
+
'bg-blue-500 text-white px-6 py-3 rounded-lg font-medium',
|
|
133
|
+
{
|
|
134
|
+
'&:hover': 'bg-blue-600 transform scale-105',
|
|
135
|
+
'&:active': 'bg-blue-700 scale-95',
|
|
136
|
+
'&:disabled': 'bg-gray-400 cursor-not-allowed'
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
// Get CSS without injection
|
|
142
|
+
const css = useTwsx({
|
|
143
|
+
'.card': 'bg-white p-6 rounded-lg shadow-md'
|
|
144
|
+
}, { inject: false })
|
|
145
|
+
|
|
146
|
+
return (
|
|
147
|
+
<>
|
|
148
|
+
<style>{css}</style>
|
|
149
|
+
<div className="card">
|
|
150
|
+
<button className="button">Click me</button>
|
|
151
|
+
</div>
|
|
152
|
+
</>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### `TwsxProvider` - Theme Configuration
|
|
158
|
+
|
|
159
|
+
Provide global theme configuration and custom colors:
|
|
160
|
+
|
|
161
|
+
```javascript
|
|
162
|
+
import { TwsxProvider, useTwsx } from 'tailwind-to-style'
|
|
163
|
+
|
|
164
|
+
const themeConfig = {
|
|
165
|
+
theme: {
|
|
166
|
+
extend: {
|
|
167
|
+
colors: {
|
|
168
|
+
brand: {
|
|
169
|
+
50: '#eff6ff',
|
|
170
|
+
500: '#3b82f6',
|
|
171
|
+
600: '#2563eb',
|
|
172
|
+
900: '#1e3a8a'
|
|
173
|
+
},
|
|
174
|
+
accent: '#f59e0b'
|
|
175
|
+
},
|
|
176
|
+
spacing: {
|
|
177
|
+
'128': '32rem',
|
|
178
|
+
'144': '36rem'
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function App() {
|
|
185
|
+
return (
|
|
186
|
+
<TwsxProvider config={themeConfig}>
|
|
187
|
+
<Header />
|
|
188
|
+
<Main />
|
|
189
|
+
<Footer />
|
|
190
|
+
</TwsxProvider>
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function Header() {
|
|
195
|
+
useTwsx({
|
|
196
|
+
'.header': [
|
|
197
|
+
'bg-brand-500 text-white p-128', // Uses custom spacing
|
|
198
|
+
{
|
|
199
|
+
'.logo': 'text-accent font-bold text-2xl', // Uses custom color
|
|
200
|
+
'&:hover': 'bg-brand-600'
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
return (
|
|
206
|
+
<header className="header">
|
|
207
|
+
<div className="logo">My Brand</div>
|
|
208
|
+
</header>
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Dynamic Styling with State
|
|
214
|
+
|
|
215
|
+
Create dynamic styles that respond to component state:
|
|
216
|
+
|
|
217
|
+
```javascript
|
|
218
|
+
import { useTwsx } from 'tailwind-to-style'
|
|
219
|
+
import { useState } from 'react'
|
|
220
|
+
|
|
221
|
+
function ThemeToggle() {
|
|
222
|
+
const [theme, setTheme] = useState('light')
|
|
223
|
+
|
|
224
|
+
useTwsx({
|
|
225
|
+
'.theme-container': [
|
|
226
|
+
`bg-${theme === 'dark' ? 'gray-900' : 'white'} p-6 rounded-lg transition-all duration-300`,
|
|
227
|
+
{
|
|
228
|
+
[`&.${theme}`]: theme === 'dark'
|
|
229
|
+
? 'text-white border-gray-700'
|
|
230
|
+
: 'text-gray-900 border-gray-200',
|
|
231
|
+
'.theme-title': 'text-2xl font-bold mb-4',
|
|
232
|
+
'.theme-button': [
|
|
233
|
+
'px-4 py-2 rounded-lg font-medium transition-colors',
|
|
234
|
+
theme === 'dark'
|
|
235
|
+
? 'bg-yellow-500 text-gray-900 hover:bg-yellow-400'
|
|
236
|
+
: 'bg-gray-800 text-white hover:bg-gray-700'
|
|
237
|
+
]
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<div className={`theme-container ${theme}`}>
|
|
244
|
+
<h2 className="theme-title">🌓 Dynamic Theme</h2>
|
|
245
|
+
<button
|
|
246
|
+
className="theme-button"
|
|
247
|
+
onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}
|
|
248
|
+
>
|
|
249
|
+
Switch to {theme === 'light' ? 'Dark' : 'Light'} Mode
|
|
250
|
+
</button>
|
|
251
|
+
</div>
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Available React Hooks
|
|
257
|
+
|
|
258
|
+
```javascript
|
|
259
|
+
import {
|
|
260
|
+
useTwsx, // Main hook for styling
|
|
261
|
+
TwsxProvider, // Context provider
|
|
262
|
+
useTwsxContext, // Access provider context
|
|
263
|
+
useTwsxConfig, // Get current config
|
|
264
|
+
useUpdateTwsxConfig // Update config
|
|
265
|
+
} from 'tailwind-to-style'
|
|
266
|
+
|
|
267
|
+
// Example usage
|
|
268
|
+
function ConfigAwareComponent() {
|
|
269
|
+
const { config, isConfigured } = useTwsxConfig()
|
|
270
|
+
const updateConfig = useUpdateTwsxConfig()
|
|
271
|
+
|
|
272
|
+
if (!isConfigured) {
|
|
273
|
+
return <div>Loading theme...</div>
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<div>
|
|
278
|
+
<p>Current theme: {config.theme?.extend?.colors?.brand ? 'Custom' : 'Default'}</p>
|
|
279
|
+
<button onClick={() => updateConfig({
|
|
280
|
+
theme: { extend: { colors: { brand: { 500: '#ef4444' } } } }
|
|
281
|
+
})}>
|
|
282
|
+
Change Brand Color
|
|
283
|
+
</button>
|
|
284
|
+
</div>
|
|
285
|
+
)
|
|
286
|
+
}
|
|
73
287
|
```
|
|
74
288
|
|
|
75
289
|
## Core Functions
|
package/dist/index.browser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tailwind-to-style v2.10.
|
|
2
|
+
* tailwind-to-style v2.10.2
|
|
3
3
|
* Convert tailwind classes to inline style
|
|
4
4
|
*
|
|
5
5
|
* @author Bigetion
|
|
@@ -8324,10 +8324,10 @@ var tailwindToStyle = (function (exports) {
|
|
|
8324
8324
|
return null;
|
|
8325
8325
|
}
|
|
8326
8326
|
|
|
8327
|
-
/**
|
|
8328
|
-
* Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
|
|
8329
|
-
* @param {string} cssString
|
|
8330
|
-
* @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
|
|
8327
|
+
/**
|
|
8328
|
+
* Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
|
|
8329
|
+
* @param {string} cssString
|
|
8330
|
+
* @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
|
|
8331
8331
|
*/
|
|
8332
8332
|
function resolveCssToClearCss(cssString) {
|
|
8333
8333
|
const customVars = {};
|
|
@@ -8621,11 +8621,11 @@ var tailwindToStyle = (function (exports) {
|
|
|
8621
8621
|
}
|
|
8622
8622
|
}
|
|
8623
8623
|
|
|
8624
|
-
/**
|
|
8625
|
-
* Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
|
|
8626
|
-
* @param {string} className - Class name with potential opacity modifier
|
|
8627
|
-
* @param {string} cssDeclaration - CSS declaration to modify
|
|
8628
|
-
* @returns {string} Modified CSS declaration with opacity applied
|
|
8624
|
+
/**
|
|
8625
|
+
* Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
|
|
8626
|
+
* @param {string} className - Class name with potential opacity modifier
|
|
8627
|
+
* @param {string} cssDeclaration - CSS declaration to modify
|
|
8628
|
+
* @returns {string} Modified CSS declaration with opacity applied
|
|
8629
8629
|
*/
|
|
8630
8630
|
function processOpacityModifier(className, cssDeclaration) {
|
|
8631
8631
|
const opacityMatch = className.match(/\/(\d+)$/);
|
|
@@ -8686,11 +8686,11 @@ var tailwindToStyle = (function (exports) {
|
|
|
8686
8686
|
return modifiedDeclaration;
|
|
8687
8687
|
}
|
|
8688
8688
|
|
|
8689
|
-
/**
|
|
8690
|
-
* Convert Tailwind class string to inline CSS styles or JSON object
|
|
8691
|
-
* @param {string} classNames - String containing Tailwind classes to convert
|
|
8692
|
-
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
8693
|
-
* @returns {string|Object} Inline CSS string or style JSON object
|
|
8689
|
+
/**
|
|
8690
|
+
* Convert Tailwind class string to inline CSS styles or JSON object
|
|
8691
|
+
* @param {string} classNames - String containing Tailwind classes to convert
|
|
8692
|
+
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
8693
|
+
* @returns {string|Object} Inline CSS string or style JSON object
|
|
8694
8694
|
*/
|
|
8695
8695
|
function tws(classNames, convertToJson) {
|
|
8696
8696
|
const totalMarker = performanceMonitor.start("tws:total");
|
|
@@ -9134,12 +9134,12 @@ var tailwindToStyle = (function (exports) {
|
|
|
9134
9134
|
return cssString.trim();
|
|
9135
9135
|
}
|
|
9136
9136
|
|
|
9137
|
-
/**
|
|
9138
|
-
* Generate CSS string from style object with SCSS-like syntax
|
|
9139
|
-
* Supports nested selectors, state variants, responsive variants, and @css directives
|
|
9140
|
-
* @param {Object} obj - Object with SCSS-like style format
|
|
9141
|
-
* @param {Object} [options] - Additional options, e.g. { inject: true/false }
|
|
9142
|
-
* @returns {string} Generated CSS string
|
|
9137
|
+
/**
|
|
9138
|
+
* Generate CSS string from style object with SCSS-like syntax
|
|
9139
|
+
* Supports nested selectors, state variants, responsive variants, and @css directives
|
|
9140
|
+
* @param {Object} obj - Object with SCSS-like style format
|
|
9141
|
+
* @param {Object} [options] - Additional options, e.g. { inject: true/false }
|
|
9142
|
+
* @returns {string} Generated CSS string
|
|
9143
9143
|
*/
|
|
9144
9144
|
function twsx(obj) {
|
|
9145
9145
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -9284,19 +9284,19 @@ var tailwindToStyle = (function (exports) {
|
|
|
9284
9284
|
}
|
|
9285
9285
|
|
|
9286
9286
|
// Enhanced debounced functions with performance monitoring configuration
|
|
9287
|
-
/**
|
|
9288
|
-
* Debounced version of tws function with performance monitoring
|
|
9289
|
-
* @param {string} classNames - String containing Tailwind classes to convert
|
|
9290
|
-
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
9291
|
-
* @returns {string|Object} Inline CSS string or style JSON object
|
|
9287
|
+
/**
|
|
9288
|
+
* Debounced version of tws function with performance monitoring
|
|
9289
|
+
* @param {string} classNames - String containing Tailwind classes to convert
|
|
9290
|
+
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
9291
|
+
* @returns {string|Object} Inline CSS string or style JSON object
|
|
9292
9292
|
*/
|
|
9293
9293
|
const debouncedTws = debounce(tws, 50); // Faster debounce for tws
|
|
9294
9294
|
|
|
9295
|
-
/**
|
|
9296
|
-
* Debounced version of twsx function with performance monitoring
|
|
9297
|
-
* @param {Object} obj - Object with SCSS-like style format
|
|
9298
|
-
* @param {Object} [options] - Additional options
|
|
9299
|
-
* @returns {string} Generated CSS string
|
|
9295
|
+
/**
|
|
9296
|
+
* Debounced version of twsx function with performance monitoring
|
|
9297
|
+
* @param {Object} obj - Object with SCSS-like style format
|
|
9298
|
+
* @param {Object} [options] - Additional options
|
|
9299
|
+
* @returns {string} Generated CSS string
|
|
9300
9300
|
*/
|
|
9301
9301
|
const debouncedTwsx = debounce(twsx, 100); // Standard debounce for twsx
|
|
9302
9302
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tailwind-to-style v2.10.
|
|
2
|
+
* tailwind-to-style v2.10.2
|
|
3
3
|
* Convert tailwind classes to inline style
|
|
4
4
|
*
|
|
5
5
|
* @author Bigetion
|
|
@@ -8325,10 +8325,10 @@ function parseCustomClassWithPatterns(className) {
|
|
|
8325
8325
|
return null;
|
|
8326
8326
|
}
|
|
8327
8327
|
|
|
8328
|
-
/**
|
|
8329
|
-
* Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
|
|
8330
|
-
* @param {string} cssString
|
|
8331
|
-
* @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
|
|
8328
|
+
/**
|
|
8329
|
+
* Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
|
|
8330
|
+
* @param {string} cssString
|
|
8331
|
+
* @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
|
|
8332
8332
|
*/
|
|
8333
8333
|
function resolveCssToClearCss(cssString) {
|
|
8334
8334
|
const customVars = {};
|
|
@@ -8622,11 +8622,11 @@ function separateAndResolveCSS(arr) {
|
|
|
8622
8622
|
}
|
|
8623
8623
|
}
|
|
8624
8624
|
|
|
8625
|
-
/**
|
|
8626
|
-
* Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
|
|
8627
|
-
* @param {string} className - Class name with potential opacity modifier
|
|
8628
|
-
* @param {string} cssDeclaration - CSS declaration to modify
|
|
8629
|
-
* @returns {string} Modified CSS declaration with opacity applied
|
|
8625
|
+
/**
|
|
8626
|
+
* Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
|
|
8627
|
+
* @param {string} className - Class name with potential opacity modifier
|
|
8628
|
+
* @param {string} cssDeclaration - CSS declaration to modify
|
|
8629
|
+
* @returns {string} Modified CSS declaration with opacity applied
|
|
8630
8630
|
*/
|
|
8631
8631
|
function processOpacityModifier(className, cssDeclaration) {
|
|
8632
8632
|
const opacityMatch = className.match(/\/(\d+)$/);
|
|
@@ -8687,11 +8687,11 @@ function processOpacityModifier(className, cssDeclaration) {
|
|
|
8687
8687
|
return modifiedDeclaration;
|
|
8688
8688
|
}
|
|
8689
8689
|
|
|
8690
|
-
/**
|
|
8691
|
-
* Convert Tailwind class string to inline CSS styles or JSON object
|
|
8692
|
-
* @param {string} classNames - String containing Tailwind classes to convert
|
|
8693
|
-
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
8694
|
-
* @returns {string|Object} Inline CSS string or style JSON object
|
|
8690
|
+
/**
|
|
8691
|
+
* Convert Tailwind class string to inline CSS styles or JSON object
|
|
8692
|
+
* @param {string} classNames - String containing Tailwind classes to convert
|
|
8693
|
+
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
8694
|
+
* @returns {string|Object} Inline CSS string or style JSON object
|
|
8695
8695
|
*/
|
|
8696
8696
|
function tws(classNames, convertToJson) {
|
|
8697
8697
|
const totalMarker = performanceMonitor.start("tws:total");
|
|
@@ -9135,12 +9135,12 @@ function generateCssString(styles) {
|
|
|
9135
9135
|
return cssString.trim();
|
|
9136
9136
|
}
|
|
9137
9137
|
|
|
9138
|
-
/**
|
|
9139
|
-
* Generate CSS string from style object with SCSS-like syntax
|
|
9140
|
-
* Supports nested selectors, state variants, responsive variants, and @css directives
|
|
9141
|
-
* @param {Object} obj - Object with SCSS-like style format
|
|
9142
|
-
* @param {Object} [options] - Additional options, e.g. { inject: true/false }
|
|
9143
|
-
* @returns {string} Generated CSS string
|
|
9138
|
+
/**
|
|
9139
|
+
* Generate CSS string from style object with SCSS-like syntax
|
|
9140
|
+
* Supports nested selectors, state variants, responsive variants, and @css directives
|
|
9141
|
+
* @param {Object} obj - Object with SCSS-like style format
|
|
9142
|
+
* @param {Object} [options] - Additional options, e.g. { inject: true/false }
|
|
9143
|
+
* @returns {string} Generated CSS string
|
|
9144
9144
|
*/
|
|
9145
9145
|
function twsx(obj) {
|
|
9146
9146
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -9285,19 +9285,19 @@ function autoInjectCss(cssString) {
|
|
|
9285
9285
|
}
|
|
9286
9286
|
|
|
9287
9287
|
// Enhanced debounced functions with performance monitoring configuration
|
|
9288
|
-
/**
|
|
9289
|
-
* Debounced version of tws function with performance monitoring
|
|
9290
|
-
* @param {string} classNames - String containing Tailwind classes to convert
|
|
9291
|
-
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
9292
|
-
* @returns {string|Object} Inline CSS string or style JSON object
|
|
9288
|
+
/**
|
|
9289
|
+
* Debounced version of tws function with performance monitoring
|
|
9290
|
+
* @param {string} classNames - String containing Tailwind classes to convert
|
|
9291
|
+
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
9292
|
+
* @returns {string|Object} Inline CSS string or style JSON object
|
|
9293
9293
|
*/
|
|
9294
9294
|
const debouncedTws = debounce(tws, 50); // Faster debounce for tws
|
|
9295
9295
|
|
|
9296
|
-
/**
|
|
9297
|
-
* Debounced version of twsx function with performance monitoring
|
|
9298
|
-
* @param {Object} obj - Object with SCSS-like style format
|
|
9299
|
-
* @param {Object} [options] - Additional options
|
|
9300
|
-
* @returns {string} Generated CSS string
|
|
9296
|
+
/**
|
|
9297
|
+
* Debounced version of twsx function with performance monitoring
|
|
9298
|
+
* @param {Object} obj - Object with SCSS-like style format
|
|
9299
|
+
* @param {Object} [options] - Additional options
|
|
9300
|
+
* @returns {string} Generated CSS string
|
|
9301
9301
|
*/
|
|
9302
9302
|
const debouncedTwsx = debounce(twsx, 100); // Standard debounce for twsx
|
|
9303
9303
|
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* tailwind-to-style v2.10.
|
|
2
|
+
* tailwind-to-style v2.10.2
|
|
3
3
|
* Convert tailwind classes to inline style
|
|
4
4
|
*
|
|
5
5
|
* @author Bigetion
|
|
@@ -8321,10 +8321,10 @@ function parseCustomClassWithPatterns(className) {
|
|
|
8321
8321
|
return null;
|
|
8322
8322
|
}
|
|
8323
8323
|
|
|
8324
|
-
/**
|
|
8325
|
-
* Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
|
|
8326
|
-
* @param {string} cssString
|
|
8327
|
-
* @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
|
|
8324
|
+
/**
|
|
8325
|
+
* Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
|
|
8326
|
+
* @param {string} cssString
|
|
8327
|
+
* @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
|
|
8328
8328
|
*/
|
|
8329
8329
|
function resolveCssToClearCss(cssString) {
|
|
8330
8330
|
const customVars = {};
|
|
@@ -8618,11 +8618,11 @@ function separateAndResolveCSS(arr) {
|
|
|
8618
8618
|
}
|
|
8619
8619
|
}
|
|
8620
8620
|
|
|
8621
|
-
/**
|
|
8622
|
-
* Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
|
|
8623
|
-
* @param {string} className - Class name with potential opacity modifier
|
|
8624
|
-
* @param {string} cssDeclaration - CSS declaration to modify
|
|
8625
|
-
* @returns {string} Modified CSS declaration with opacity applied
|
|
8621
|
+
/**
|
|
8622
|
+
* Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
|
|
8623
|
+
* @param {string} className - Class name with potential opacity modifier
|
|
8624
|
+
* @param {string} cssDeclaration - CSS declaration to modify
|
|
8625
|
+
* @returns {string} Modified CSS declaration with opacity applied
|
|
8626
8626
|
*/
|
|
8627
8627
|
function processOpacityModifier(className, cssDeclaration) {
|
|
8628
8628
|
const opacityMatch = className.match(/\/(\d+)$/);
|
|
@@ -8683,11 +8683,11 @@ function processOpacityModifier(className, cssDeclaration) {
|
|
|
8683
8683
|
return modifiedDeclaration;
|
|
8684
8684
|
}
|
|
8685
8685
|
|
|
8686
|
-
/**
|
|
8687
|
-
* Convert Tailwind class string to inline CSS styles or JSON object
|
|
8688
|
-
* @param {string} classNames - String containing Tailwind classes to convert
|
|
8689
|
-
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
8690
|
-
* @returns {string|Object} Inline CSS string or style JSON object
|
|
8686
|
+
/**
|
|
8687
|
+
* Convert Tailwind class string to inline CSS styles or JSON object
|
|
8688
|
+
* @param {string} classNames - String containing Tailwind classes to convert
|
|
8689
|
+
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
8690
|
+
* @returns {string|Object} Inline CSS string or style JSON object
|
|
8691
8691
|
*/
|
|
8692
8692
|
function tws(classNames, convertToJson) {
|
|
8693
8693
|
const totalMarker = performanceMonitor.start("tws:total");
|
|
@@ -9131,12 +9131,12 @@ function generateCssString(styles) {
|
|
|
9131
9131
|
return cssString.trim();
|
|
9132
9132
|
}
|
|
9133
9133
|
|
|
9134
|
-
/**
|
|
9135
|
-
* Generate CSS string from style object with SCSS-like syntax
|
|
9136
|
-
* Supports nested selectors, state variants, responsive variants, and @css directives
|
|
9137
|
-
* @param {Object} obj - Object with SCSS-like style format
|
|
9138
|
-
* @param {Object} [options] - Additional options, e.g. { inject: true/false }
|
|
9139
|
-
* @returns {string} Generated CSS string
|
|
9134
|
+
/**
|
|
9135
|
+
* Generate CSS string from style object with SCSS-like syntax
|
|
9136
|
+
* Supports nested selectors, state variants, responsive variants, and @css directives
|
|
9137
|
+
* @param {Object} obj - Object with SCSS-like style format
|
|
9138
|
+
* @param {Object} [options] - Additional options, e.g. { inject: true/false }
|
|
9139
|
+
* @returns {string} Generated CSS string
|
|
9140
9140
|
*/
|
|
9141
9141
|
function twsx(obj) {
|
|
9142
9142
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
@@ -9281,19 +9281,19 @@ function autoInjectCss(cssString) {
|
|
|
9281
9281
|
}
|
|
9282
9282
|
|
|
9283
9283
|
// Enhanced debounced functions with performance monitoring configuration
|
|
9284
|
-
/**
|
|
9285
|
-
* Debounced version of tws function with performance monitoring
|
|
9286
|
-
* @param {string} classNames - String containing Tailwind classes to convert
|
|
9287
|
-
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
9288
|
-
* @returns {string|Object} Inline CSS string or style JSON object
|
|
9284
|
+
/**
|
|
9285
|
+
* Debounced version of tws function with performance monitoring
|
|
9286
|
+
* @param {string} classNames - String containing Tailwind classes to convert
|
|
9287
|
+
* @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
|
|
9288
|
+
* @returns {string|Object} Inline CSS string or style JSON object
|
|
9289
9289
|
*/
|
|
9290
9290
|
const debouncedTws = debounce(tws, 50); // Faster debounce for tws
|
|
9291
9291
|
|
|
9292
|
-
/**
|
|
9293
|
-
* Debounced version of twsx function with performance monitoring
|
|
9294
|
-
* @param {Object} obj - Object with SCSS-like style format
|
|
9295
|
-
* @param {Object} [options] - Additional options
|
|
9296
|
-
* @returns {string} Generated CSS string
|
|
9292
|
+
/**
|
|
9293
|
+
* Debounced version of twsx function with performance monitoring
|
|
9294
|
+
* @param {Object} obj - Object with SCSS-like style format
|
|
9295
|
+
* @param {Object} [options] - Additional options
|
|
9296
|
+
* @returns {string} Generated CSS string
|
|
9297
9297
|
*/
|
|
9298
9298
|
const debouncedTwsx = debounce(twsx, 100); // Standard debounce for twsx
|
|
9299
9299
|
|