tailwind-to-style 2.12.0 → 2.12.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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * tailwind-to-style v2.12.0
2
+ * tailwind-to-style v2.12.2
3
3
  * Convert tailwind classes to inline style
4
4
  *
5
5
  * @author Bigetion
6
6
  * @license MIT
7
7
  */
8
- import React, { useMemo, useEffect, useState, createElement, createContext, useContext } from 'react';
8
+ import React, { useContext, createContext, useMemo, useEffect, useState, useRef, createElement } from 'react';
9
9
 
10
10
  /**
11
11
  * Tailwind Variants (tv) - Type-safe variant system
@@ -1916,6 +1916,14 @@ const logger = new Logger(isProduction ? "error" : "warn");
1916
1916
  */
1917
1917
 
1918
1918
 
1919
+ // Import clearConfigCache - will be set after module loads
1920
+ let clearConfigCache$1 = null;
1921
+
1922
+ // Lazy import to avoid circular dependency
1923
+ function setClearConfigCache(fn) {
1924
+ clearConfigCache$1 = fn;
1925
+ }
1926
+
1919
1927
  /**
1920
1928
  * User configuration state
1921
1929
  */
@@ -1928,6 +1936,9 @@ let userConfig = {
1928
1936
  prefix: ""
1929
1937
  };
1930
1938
 
1939
+ // Cache for extended theme to avoid redundant lookups
1940
+ const extendedThemeCache = new Map();
1941
+
1931
1942
  /**
1932
1943
  * Deep merge two objects
1933
1944
  * @param {Object} target - Target object
@@ -1983,6 +1994,9 @@ function configure() {
1983
1994
  return;
1984
1995
  }
1985
1996
 
1997
+ // Clear extended theme cache when config changes
1998
+ extendedThemeCache.clear();
1999
+
1986
2000
  // Merge user config with defaults
1987
2001
  if (config.theme) {
1988
2002
  if (config.theme.extend) {
@@ -2019,6 +2033,11 @@ function configure() {
2019
2033
 
2020
2034
  // Reset cache to apply new configuration
2021
2035
  resetTailwindCache();
2036
+
2037
+ // Also clear config options cache if available
2038
+ if (clearConfigCache$1) {
2039
+ clearConfigCache$1();
2040
+ }
2022
2041
  logger.info("Configuration applied successfully");
2023
2042
  } catch (error) {
2024
2043
  logger.error("Error applying configuration:", error);
@@ -2042,7 +2061,15 @@ function getConfig() {
2042
2061
  * @returns {Object} Extended theme values
2043
2062
  */
2044
2063
  function getExtendedTheme(key) {
2045
- return userConfig.theme.extend[key] || {};
2064
+ // Check cache first
2065
+ if (extendedThemeCache.has(key)) {
2066
+ return extendedThemeCache.get(key);
2067
+ }
2068
+ const result = userConfig.theme.extend[key] || {};
2069
+
2070
+ // Cache the result
2071
+ extendedThemeCache.set(key, result);
2072
+ return result;
2046
2073
  }
2047
2074
 
2048
2075
  /**
@@ -7992,10 +8019,10 @@ function parseCustomClassWithPatterns(className) {
7992
8019
  return null;
7993
8020
  }
7994
8021
 
7995
- /**
7996
- * Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
7997
- * @param {string} cssString
7998
- * @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
8022
+ /**
8023
+ * Resolve all CSS custom properties (var) in a CSS string and output only clear CSS (no custom property)
8024
+ * @param {string} cssString
8025
+ * @returns {string} e.g. 'color: rgba(255,255,255,1); background: #fff;'
7999
8026
  */
8000
8027
  function resolveCssToClearCss(cssString) {
8001
8028
  const customVars = {};
@@ -8028,6 +8055,17 @@ function resolveCssToClearCss(cssString) {
8028
8055
 
8029
8056
  // Cache for getConfigOptions - use LRU cache
8030
8057
  const configOptionsCache = new LRUCache(500);
8058
+
8059
+ /**
8060
+ * Clear config options cache (internal use)
8061
+ * Called when user configuration changes
8062
+ */
8063
+ function clearConfigCache() {
8064
+ configOptionsCache.clear();
8065
+ }
8066
+
8067
+ // Register clearConfigCache with userConfig module
8068
+ setClearConfigCache(clearConfigCache);
8031
8069
  function generateTailwindCssString() {
8032
8070
  var _options$theme, _userConfigData$theme;
8033
8071
  let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -8362,11 +8400,11 @@ function separateAndResolveCSS(arr) {
8362
8400
  }
8363
8401
  }
8364
8402
 
8365
- /**
8366
- * Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
8367
- * @param {string} className - Class name with potential opacity modifier
8368
- * @param {string} cssDeclaration - CSS declaration to modify
8369
- * @returns {string} Modified CSS declaration with opacity applied
8403
+ /**
8404
+ * Process opacity modifier from class name (e.g., text-red-500/50 -> 50% opacity)
8405
+ * @param {string} className - Class name with potential opacity modifier
8406
+ * @param {string} cssDeclaration - CSS declaration to modify
8407
+ * @returns {string} Modified CSS declaration with opacity applied
8370
8408
  */
8371
8409
  function processOpacityModifier(className, cssDeclaration) {
8372
8410
  const opacityMatch = className.match(/\/(\d+)$/);
@@ -8427,11 +8465,11 @@ function processOpacityModifier(className, cssDeclaration) {
8427
8465
  return modifiedDeclaration;
8428
8466
  }
8429
8467
 
8430
- /**
8431
- * Convert Tailwind class string to inline CSS styles or JSON object
8432
- * @param {string} classNames - String containing Tailwind classes to convert
8433
- * @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
8434
- * @returns {string|Object} Inline CSS string or style JSON object
8468
+ /**
8469
+ * Convert Tailwind class string to inline CSS styles or JSON object
8470
+ * @param {string} classNames - String containing Tailwind classes to convert
8471
+ * @param {boolean} convertToJson - If true, result will be JSON object, if false becomes CSS string
8472
+ * @returns {string|Object} Inline CSS string or style JSON object
8435
8473
  */
8436
8474
  function tws(classNames, convertToJson) {
8437
8475
  const totalMarker = performanceMonitor.start("tws:total");
@@ -8875,12 +8913,12 @@ function generateCssString(styles) {
8875
8913
  return cssString.trim();
8876
8914
  }
8877
8915
 
8878
- /**
8879
- * Generate CSS string from style object with SCSS-like syntax
8880
- * Supports nested selectors, state variants, responsive variants, and @css directives
8881
- * @param {Object} obj - Object with SCSS-like style format
8882
- * @param {Object} [options] - Additional options, e.g. { inject: true/false }
8883
- * @returns {string} Generated CSS string
8916
+ /**
8917
+ * Generate CSS string from style object with SCSS-like syntax
8918
+ * Supports nested selectors, state variants, responsive variants, and @css directives
8919
+ * @param {Object} obj - Object with SCSS-like style format
8920
+ * @param {Object} [options] - Additional options, e.g. { inject: true/false }
8921
+ * @returns {string} Generated CSS string
8884
8922
  */
8885
8923
  function twsx(obj) {
8886
8924
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -9070,9 +9108,23 @@ function autoInjectCss(cssString) {
9070
9108
  */
9071
9109
 
9072
9110
 
9111
+ // Create context for config change notifications
9112
+ const TwsxConfigContext = /*#__PURE__*/createContext(null);
9113
+
9073
9114
  // Global CSS cache to prevent duplicate injections
9074
9115
  const globalCssCache = new Map();
9116
+ const globalKeyframesCache = new Map(); // Track injected keyframes: name -> css
9075
9117
  let globalStyleElement = null;
9118
+ let globalKeyframesElement = null;
9119
+
9120
+ // Export function to clear caches (called when config changes)
9121
+ function clearTwsxCache() {
9122
+ // Clear internal caches so new CSS can be generated
9123
+ globalCssCache.clear();
9124
+ globalKeyframesCache.clear();
9125
+ // DON'T clear DOM content - let new CSS replace it naturally
9126
+ // This prevents white flash when navigating between pages
9127
+ }
9076
9128
 
9077
9129
  /**
9078
9130
  * Simple hash function for CSS content
@@ -9089,6 +9141,7 @@ function simpleHash$1(str) {
9089
9141
  return Math.abs(hash).toString(36);
9090
9142
  }
9091
9143
  function getOrCreateGlobalStyleElement() {
9144
+ if (typeof document === "undefined") return null;
9092
9145
  if (!globalStyleElement) {
9093
9146
  globalStyleElement = document.createElement("style");
9094
9147
  globalStyleElement.setAttribute("data-twsx-global", "true");
@@ -9096,11 +9149,117 @@ function getOrCreateGlobalStyleElement() {
9096
9149
  }
9097
9150
  return globalStyleElement;
9098
9151
  }
9152
+ function getOrCreateGlobalKeyframesElement() {
9153
+ if (typeof document === "undefined") return null;
9154
+ if (!globalKeyframesElement) {
9155
+ globalKeyframesElement = document.createElement("style");
9156
+ globalKeyframesElement.setAttribute("data-twsx-keyframes", "true");
9157
+ document.head.appendChild(globalKeyframesElement);
9158
+ }
9159
+ return globalKeyframesElement;
9160
+ }
9161
+ function extractKeyframes(cssString) {
9162
+ const keyframesRegex = /@keyframes\s+([^\s{]+)\s*\{/g;
9163
+ const keyframes = [];
9164
+ let match;
9165
+ while ((match = keyframesRegex.exec(cssString)) !== null) {
9166
+ const keyframeName = match[1];
9167
+ const start = match.index;
9168
+
9169
+ // Find matching closing brace
9170
+ let braceCount = 0;
9171
+ let endIndex = start;
9172
+ let inKeyframe = false;
9173
+ for (let i = start; i < cssString.length; i++) {
9174
+ if (cssString[i] === "{") {
9175
+ braceCount++;
9176
+ inKeyframe = true;
9177
+ } else if (cssString[i] === "}") {
9178
+ braceCount--;
9179
+ if (inKeyframe && braceCount === 0) {
9180
+ endIndex = i + 1;
9181
+ break;
9182
+ }
9183
+ }
9184
+ }
9185
+ const keyframeBlock = cssString.substring(start, endIndex);
9186
+ keyframes.push({
9187
+ name: keyframeName,
9188
+ css: keyframeBlock
9189
+ });
9190
+ }
9191
+ return keyframes;
9192
+ }
9193
+ function removeKeyframes(cssString) {
9194
+ // Remove keyframes but keep the rest
9195
+ let result = cssString;
9196
+ const keyframesRegex = /@keyframes\s+([^\s{]+)\s*\{/g;
9197
+ let match;
9198
+ const toRemove = [];
9199
+ while ((match = keyframesRegex.exec(cssString)) !== null) {
9200
+ const start = match.index;
9201
+ let braceCount = 0;
9202
+ let inKeyframe = false;
9203
+ for (let i = start; i < cssString.length; i++) {
9204
+ if (cssString[i] === "{") {
9205
+ braceCount++;
9206
+ inKeyframe = true;
9207
+ } else if (cssString[i] === "}") {
9208
+ braceCount--;
9209
+ if (inKeyframe && braceCount === 0) {
9210
+ toRemove.push({
9211
+ start,
9212
+ end: i + 1
9213
+ });
9214
+ break;
9215
+ }
9216
+ }
9217
+ }
9218
+ }
9219
+
9220
+ // Remove from end to start to preserve indices
9221
+ for (let i = toRemove.length - 1; i >= 0; i--) {
9222
+ const {
9223
+ start,
9224
+ end
9225
+ } = toRemove[i];
9226
+ result = result.substring(0, start) + result.substring(end);
9227
+ }
9228
+ return result.trim();
9229
+ }
9230
+ function updateGlobalKeyframes(keyframes) {
9231
+ if (typeof document === "undefined") return;
9232
+ const keyframesElement = getOrCreateGlobalKeyframesElement();
9233
+ let hasNewKeyframes = false;
9234
+ for (const {
9235
+ name,
9236
+ css
9237
+ } of keyframes) {
9238
+ if (!globalKeyframesCache.has(name)) {
9239
+ globalKeyframesCache.set(name, css);
9240
+ hasNewKeyframes = true;
9241
+ }
9242
+ }
9243
+ if (hasNewKeyframes) {
9244
+ // Rebuild all keyframes CSS from cache
9245
+ const allKeyframesCSS = Array.from(globalKeyframesCache.values()).join("\n");
9246
+
9247
+ // Only update if content actually changed
9248
+ if (keyframesElement.textContent !== allKeyframesCSS) {
9249
+ keyframesElement.textContent = allKeyframesCSS;
9250
+ }
9251
+ }
9252
+ }
9099
9253
  function updateGlobalCSS() {
9100
9254
  if (typeof document === "undefined") return;
9101
9255
  const styleElement = getOrCreateGlobalStyleElement();
9256
+ // Rebuild CSS from cache - this replaces old content with fresh content
9102
9257
  const allCSS = Array.from(globalCssCache.values()).join("\n");
9103
- styleElement.textContent = allCSS;
9258
+
9259
+ // Only update if content actually changed to avoid unnecessary reflows
9260
+ if (styleElement.textContent !== allCSS) {
9261
+ styleElement.textContent = allCSS;
9262
+ }
9104
9263
  }
9105
9264
 
9106
9265
  /**
@@ -9115,22 +9274,34 @@ function updateGlobalCSS() {
9115
9274
  */
9116
9275
  function useTwsx(styles) {
9117
9276
  let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
9277
+ // Get config version from context to trigger re-generation when config changes
9278
+ const configContext = useContext(TwsxConfigContext);
9279
+ const configVersion = (configContext === null || configContext === void 0 ? void 0 : configContext.version) || 0;
9280
+
9281
+ // Stable options reference to prevent unnecessary re-renders
9282
+ const injectOption = options.inject !== false; // Default to true
9283
+
9284
+ // Serialize styles for stable dependency checking
9285
+ const stylesKey = useMemo(() => {
9286
+ if (!styles) return null;
9287
+ return typeof styles === "string" ? styles : JSON.stringify(styles);
9288
+ }, [styles]);
9289
+
9118
9290
  // Generate CSS with memoization for performance
9291
+ // Include configVersion in deps to regenerate when config changes
9119
9292
  const css = useMemo(() => {
9120
9293
  if (!styles) return "";
9121
- console.log("useTwsx - Input styles:", styles);
9122
9294
  try {
9123
9295
  const result = twsx(styles, {
9124
9296
  inject: false,
9125
9297
  ...options
9126
9298
  });
9127
- console.log("useTwsx - Generated CSS:", result);
9128
9299
  return result;
9129
9300
  } catch (error) {
9130
9301
  console.error("TWSX Error:", error);
9131
9302
  return "";
9132
9303
  }
9133
- }, [styles, options]);
9304
+ }, [stylesKey, configVersion]); // Remove options from deps
9134
9305
 
9135
9306
  // Create a unique key for this CSS based on content hash
9136
9307
  const cssKey = useMemo(() => {
@@ -9141,15 +9312,21 @@ function useTwsx(styles) {
9141
9312
 
9142
9313
  // Auto-inject CSS into global style element (unless inject: false)
9143
9314
  useEffect(() => {
9144
- if (!css || !cssKey || options.inject === false) return;
9315
+ if (!css || !cssKey || !injectOption) return;
9316
+
9317
+ // Extract keyframes from CSS
9318
+ const keyframes = extractKeyframes(css);
9319
+ const cssWithoutKeyframes = removeKeyframes(css);
9320
+
9321
+ // Inject keyframes separately (once per keyframe name)
9322
+ if (keyframes.length > 0) {
9323
+ updateGlobalKeyframes(keyframes);
9324
+ }
9145
9325
 
9146
- // Only add to cache if not already present
9326
+ // Only add component CSS to cache if not already present
9147
9327
  if (!globalCssCache.has(cssKey)) {
9148
- globalCssCache.set(cssKey, css);
9328
+ globalCssCache.set(cssKey, cssWithoutKeyframes);
9149
9329
  updateGlobalCSS();
9150
- console.log("useTwsx - Injected NEW CSS with key:", cssKey);
9151
- } else {
9152
- console.log("useTwsx - CSS already cached with key:", cssKey);
9153
9330
  }
9154
9331
 
9155
9332
  // Cleanup function - use ref counting to track usage
@@ -9157,7 +9334,8 @@ function useTwsx(styles) {
9157
9334
  // Note: We don't delete immediately as other components might use same styles
9158
9335
  // In a production implementation, you'd want ref counting here
9159
9336
  };
9160
- }, [css, cssKey, options.inject]);
9337
+ }, [css, cssKey, injectOption]); // Stable dependencies
9338
+
9161
9339
  return css;
9162
9340
  }
9163
9341
 
@@ -9184,23 +9362,39 @@ function TwsxProvider(_ref) {
9184
9362
  } = _ref;
9185
9363
  const [currentConfig, setCurrentConfig] = useState(null);
9186
9364
  const [isConfigured, setIsConfigured] = useState(false);
9365
+ const [configVersion, setConfigVersion] = useState(0);
9366
+
9367
+ // Use ref to store callback without triggering re-renders
9368
+ const onConfigChangeRef = useRef(onConfigChange);
9369
+ useEffect(() => {
9370
+ onConfigChangeRef.current = onConfigChange;
9371
+ }, [onConfigChange]);
9372
+
9373
+ // Serialize config for stable comparison
9374
+ const configKey = useMemo(() => {
9375
+ return config ? JSON.stringify(config) : null;
9376
+ }, [config]);
9187
9377
 
9188
9378
  // Apply configuration on mount and when config changes
9189
9379
  useEffect(() => {
9190
- if (config) {
9191
- try {
9192
- configure(config);
9193
- setCurrentConfig(config);
9194
- setIsConfigured(true);
9195
- if (onConfigChange) {
9196
- onConfigChange(config);
9197
- }
9198
- } catch (error) {
9199
- console.error("TWSX Configuration Error:", error);
9200
- setIsConfigured(false);
9380
+ if (!config) return;
9381
+ try {
9382
+ // Clear caches before applying new config
9383
+ clearTwsxCache();
9384
+ configure(config);
9385
+ setCurrentConfig(config);
9386
+ setIsConfigured(true);
9387
+
9388
+ // Increment version to trigger useTwsx re-generation
9389
+ setConfigVersion(prev => prev + 1);
9390
+ if (onConfigChangeRef.current) {
9391
+ onConfigChangeRef.current(config);
9201
9392
  }
9393
+ } catch (error) {
9394
+ console.error("TWSX Configuration Error:", error);
9395
+ setIsConfigured(false);
9202
9396
  }
9203
- }, [config, onConfigChange]);
9397
+ }, [configKey]); // Only re-run when config actually changes
9204
9398
 
9205
9399
  // Function to update configuration dynamically
9206
9400
  const updateConfig = newConfig => {
@@ -9223,9 +9417,16 @@ function TwsxProvider(_ref) {
9223
9417
  updateConfig,
9224
9418
  isConfigured
9225
9419
  };
9420
+
9421
+ // Provide config version for useTwsx to detect changes
9422
+ const configContextValue = {
9423
+ version: configVersion
9424
+ };
9226
9425
  return /*#__PURE__*/createElement(TwsxContext.Provider, {
9227
9426
  value: contextValue
9228
- }, children);
9427
+ }, /*#__PURE__*/createElement(TwsxConfigContext.Provider, {
9428
+ value: configContextValue
9429
+ }, children));
9229
9430
  }
9230
9431
 
9231
9432
  /**
@@ -9263,31 +9464,31 @@ function useUpdateTwsxConfig() {
9263
9464
  return updateConfig;
9264
9465
  }
9265
9466
 
9266
- /**
9267
- * styled() - Component factory for tailwind-to-style
9268
- * Create styled components with Tailwind classes and variants
9269
- *
9270
- * @example
9271
- * const Button = styled('button', {
9272
- * base: 'px-4 py-2 rounded-lg',
9273
- * hover: 'bg-blue-600',
9274
- * variants: {
9275
- * color: {
9276
- * primary: 'bg-blue-500 text-white',
9277
- * secondary: 'bg-gray-500 text-white'
9278
- * }
9279
- * },
9280
- * nested: {
9281
- * '.icon': 'w-4 h-4'
9282
- * }
9283
- * })
9467
+ /**
9468
+ * styled() - Component factory for tailwind-to-style
9469
+ * Create styled components with Tailwind classes and variants
9470
+ *
9471
+ * @example
9472
+ * const Button = styled('button', {
9473
+ * base: 'px-4 py-2 rounded-lg',
9474
+ * hover: 'bg-blue-600',
9475
+ * variants: {
9476
+ * color: {
9477
+ * primary: 'bg-blue-500 text-white',
9478
+ * secondary: 'bg-gray-500 text-white'
9479
+ * }
9480
+ * },
9481
+ * nested: {
9482
+ * '.icon': 'w-4 h-4'
9483
+ * }
9484
+ * })
9284
9485
  */
9285
9486
 
9286
9487
 
9287
- /**
9288
- * Simple hash function for deterministic class names
9289
- * @param {string} str - String to hash
9290
- * @returns {string} Hash string
9488
+ /**
9489
+ * Simple hash function for deterministic class names
9490
+ * @param {string} str - String to hash
9491
+ * @returns {string} Hash string
9291
9492
  */
9292
9493
  function simpleHash(str) {
9293
9494
  let hash = 0;
@@ -9299,12 +9500,12 @@ function simpleHash(str) {
9299
9500
  return Math.abs(hash).toString(36).substr(0, 6);
9300
9501
  }
9301
9502
 
9302
- /**
9303
- * Generate deterministic class name based on config and component instance
9304
- * @param {Object|Function} config - Style configuration
9305
- * @param {string} componentType - Component type (e.g., 'button', 'div')
9306
- * @param {string} instanceId - Unique instance identifier (optional)
9307
- * @returns {string} Deterministic class name
9503
+ /**
9504
+ * Generate deterministic class name based on config and component instance
9505
+ * @param {Object|Function} config - Style configuration
9506
+ * @param {string} componentType - Component type (e.g., 'button', 'div')
9507
+ * @param {string} instanceId - Unique instance identifier (optional)
9508
+ * @returns {string} Deterministic class name
9308
9509
  */
9309
9510
  function generateClassName(config) {
9310
9511
  let componentType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "component";
@@ -9321,14 +9522,14 @@ function generateClassName(config) {
9321
9522
  return `twsx-${componentType}-${hash}${suffix}`;
9322
9523
  }
9323
9524
 
9324
- /**
9325
- * Create a styled component with Tailwind classes
9326
- * @param {string|React.Component} component - HTML tag or React component
9327
- * @param {Object} config - Style configuration
9328
- * @param {Object} options - Additional options
9329
- * @param {string} options.scope - Component scope for isolation (optional)
9330
- * @param {boolean} options.isolate - Whether to isolate from other components (default: false)
9331
- * @returns {React.Component} Styled component
9525
+ /**
9526
+ * Create a styled component with Tailwind classes
9527
+ * @param {string|React.Component} component - HTML tag or React component
9528
+ * @param {Object} config - Style configuration
9529
+ * @param {Object} options - Additional options
9530
+ * @param {string} options.scope - Component scope for isolation (optional)
9531
+ * @param {boolean} options.isolate - Whether to isolate from other components (default: false)
9532
+ * @returns {React.Component} Styled component
9332
9533
  */
9333
9534
  function styled(component) {
9334
9535
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -9618,21 +9819,21 @@ function styled(component) {
9618
9819
  return StyledComponent;
9619
9820
  }
9620
9821
 
9621
- /**
9622
- * Create a styled component factory for a specific tag
9623
- * @param {string} tag - HTML tag name
9624
- * @returns {Function} Styled component factory
9822
+ /**
9823
+ * Create a styled component factory for a specific tag
9824
+ * @param {string} tag - HTML tag name
9825
+ * @returns {Function} Styled component factory
9625
9826
  */
9626
9827
  function createStyledTag(tag) {
9627
9828
  return (config, options) => styled(tag, config, options);
9628
9829
  }
9629
9830
 
9630
- /**
9631
- * Create an isolated styled component (automatically scoped)
9632
- * @param {string|React.Component} component - HTML tag or React component
9633
- * @param {Object} config - Style configuration
9634
- * @param {string} scope - Optional scope name
9635
- * @returns {React.Component} Isolated styled component
9831
+ /**
9832
+ * Create an isolated styled component (automatically scoped)
9833
+ * @param {string|React.Component} component - HTML tag or React component
9834
+ * @param {Object} config - Style configuration
9835
+ * @param {string} scope - Optional scope name
9836
+ * @returns {React.Component} Isolated styled component
9636
9837
  */
9637
9838
  function isolatedStyled(component) {
9638
9839
  let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -9643,10 +9844,10 @@ function isolatedStyled(component) {
9643
9844
  });
9644
9845
  }
9645
9846
 
9646
- /**
9647
- * Create a scoped styled component
9648
- * @param {string} scope - Scope name for component isolation
9649
- * @returns {Function} Scoped styled function
9847
+ /**
9848
+ * Create a scoped styled component
9849
+ * @param {string} scope - Scope name for component isolation
9850
+ * @returns {Function} Scoped styled function
9650
9851
  */
9651
9852
  function createScopedStyled(scope) {
9652
9853
  return function (component) {