chaincss 2.1.20 → 2.1.21

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.js CHANGED
@@ -3356,15 +3356,13 @@ function injectChainStyles(styles) {
3356
3356
  let staticCount = 0, dynamicCount = 0, hybridCount = 0;
3357
3357
  for (const [key, obj] of Object.entries(styles)) {
3358
3358
  if (!obj || !obj.selectors) continue;
3359
- let stat = 0, dyn = 0;
3360
- for (const [k, v] of Object.entries(obj)) {
3361
- if (["selectors", "hover", "atRules", "nestedRules", "_name", "_classes", "__buildClasses", "__runtimeClasses", "__isHybrid"].includes(k)) continue;
3362
- if (typeof v === "function") dyn++;
3363
- else stat++;
3359
+ if (obj.__isHybrid) {
3360
+ hybridCount++;
3361
+ } else if (obj.__runtimeClasses && Object.keys(obj.__runtimeClasses).length > 0) {
3362
+ dynamicCount++;
3363
+ } else {
3364
+ staticCount++;
3364
3365
  }
3365
- if (stat > 0 && dyn > 0) hybridCount++;
3366
- else if (dyn > 0) dynamicCount++;
3367
- else staticCount++;
3368
3366
  const sel = "." + obj.selectors[0];
3369
3367
  css += sel + "{";
3370
3368
  for (const [k, v] of Object.entries(obj)) {
@@ -3912,15 +3912,13 @@ function injectChainStyles(styles3) {
3912
3912
  let staticCount = 0, dynamicCount = 0, hybridCount = 0;
3913
3913
  for (const [key, obj] of Object.entries(styles3)) {
3914
3914
  if (!obj || !obj.selectors) continue;
3915
- let stat = 0, dyn = 0;
3916
- for (const [k, v] of Object.entries(obj)) {
3917
- if (["selectors", "hover", "atRules", "nestedRules", "_name", "_classes", "__buildClasses", "__runtimeClasses", "__isHybrid"].includes(k)) continue;
3918
- if (typeof v === "function") dyn++;
3919
- else stat++;
3915
+ if (obj.__isHybrid) {
3916
+ hybridCount++;
3917
+ } else if (obj.__runtimeClasses && Object.keys(obj.__runtimeClasses).length > 0) {
3918
+ dynamicCount++;
3919
+ } else {
3920
+ staticCount++;
3920
3921
  }
3921
- if (stat > 0 && dyn > 0) hybridCount++;
3922
- else if (dyn > 0) dynamicCount++;
3923
- else staticCount++;
3924
3922
  const sel = "." + obj.selectors[0];
3925
3923
  css += sel + "{";
3926
3924
  for (const [k, v] of Object.entries(obj)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaincss",
3
- "version": "2.1.20",
3
+ "version": "2.1.21",
4
4
  "description": "ChainCSS - The first CSS-in-JS library with true auto-detection mixed mode. Zero runtime by default, dynamic when you need it.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -97,16 +97,14 @@ export function injectChainStyles(styles: Record<string, any>) {
97
97
  for (const [key, obj] of Object.entries(styles)) {
98
98
  if (!obj || !obj.selectors) continue;
99
99
 
100
- // Count static vs dynamic
101
- let stat = 0, dyn = 0;
102
- for (const [k, v] of Object.entries(obj)) {
103
- if (['selectors','hover','atRules','nestedRules','_name','_classes','__buildClasses','__runtimeClasses','__isHybrid'].includes(k)) continue;
104
- if (typeof v === 'function') dyn++;
105
- else stat++;
100
+ // Use smartChain's built-in detection
101
+ if (obj.__isHybrid) {
102
+ hybridCount++;
103
+ } else if (obj.__runtimeClasses && Object.keys(obj.__runtimeClasses).length > 0) {
104
+ dynamicCount++;
105
+ } else {
106
+ staticCount++;
106
107
  }
107
- if (stat > 0 && dyn > 0) hybridCount++;
108
- else if (dyn > 0) dynamicCount++;
109
- else staticCount++;
110
108
 
111
109
  const sel = '.' + obj.selectors[0];
112
110
  css += sel + '{';