chaincss 2.1.14 → 2.1.15
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 +11 -0
- package/dist/runtime/index.js +11 -0
- package/package.json +1 -1
- package/src/runtime/index.ts +18 -0
package/dist/index.js
CHANGED
|
@@ -3353,8 +3353,18 @@ var compileRuntime = (s, moduleId) => styleInjector.injectMultiple(s, moduleId);
|
|
|
3353
3353
|
// src/runtime/index.ts
|
|
3354
3354
|
function injectChainStyles(styles) {
|
|
3355
3355
|
let css = "";
|
|
3356
|
+
let staticCount = 0, dynamicCount = 0, hybridCount = 0;
|
|
3356
3357
|
for (const [key, obj] of Object.entries(styles)) {
|
|
3357
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++;
|
|
3364
|
+
}
|
|
3365
|
+
if (stat > 0 && dyn > 0) hybridCount++;
|
|
3366
|
+
else if (dyn > 0) dynamicCount++;
|
|
3367
|
+
else staticCount++;
|
|
3358
3368
|
const sel = "." + obj.selectors[0];
|
|
3359
3369
|
css += sel + "{";
|
|
3360
3370
|
for (const [k, v] of Object.entries(obj)) {
|
|
@@ -3379,6 +3389,7 @@ function injectChainStyles(styles) {
|
|
|
3379
3389
|
el.setAttribute("data-chaincss", "runtime");
|
|
3380
3390
|
el.textContent = css;
|
|
3381
3391
|
document.head.appendChild(el);
|
|
3392
|
+
console.log("\u26D3\uFE0F ChainCSS Split: \u{1F4E6} Static=" + staticCount + " \u26A1 Dynamic=" + dynamicCount + " \u{1F500} Hybrid=" + hybridCount + " | CSS: " + css.length + " bytes");
|
|
3382
3393
|
return el;
|
|
3383
3394
|
}
|
|
3384
3395
|
|
package/dist/runtime/index.js
CHANGED
|
@@ -3909,8 +3909,18 @@ var injectStyleContextSvelte = (...args) => getSvelteExports().injectStyleContex
|
|
|
3909
3909
|
var chainStyles2 = (...args) => getSvelteExports().chainStyles?.(...args);
|
|
3910
3910
|
function injectChainStyles(styles3) {
|
|
3911
3911
|
let css = "";
|
|
3912
|
+
let staticCount = 0, dynamicCount = 0, hybridCount = 0;
|
|
3912
3913
|
for (const [key, obj] of Object.entries(styles3)) {
|
|
3913
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++;
|
|
3920
|
+
}
|
|
3921
|
+
if (stat > 0 && dyn > 0) hybridCount++;
|
|
3922
|
+
else if (dyn > 0) dynamicCount++;
|
|
3923
|
+
else staticCount++;
|
|
3914
3924
|
const sel = "." + obj.selectors[0];
|
|
3915
3925
|
css += sel + "{";
|
|
3916
3926
|
for (const [k, v] of Object.entries(obj)) {
|
|
@@ -3935,6 +3945,7 @@ function injectChainStyles(styles3) {
|
|
|
3935
3945
|
el.setAttribute("data-chaincss", "runtime");
|
|
3936
3946
|
el.textContent = css;
|
|
3937
3947
|
document.head.appendChild(el);
|
|
3948
|
+
console.log("\u26D3\uFE0F ChainCSS Split: \u{1F4E6} Static=" + staticCount + " \u26A1 Dynamic=" + dynamicCount + " \u{1F500} Hybrid=" + hybridCount + " | CSS: " + css.length + " bytes");
|
|
3938
3949
|
return el;
|
|
3939
3950
|
}
|
|
3940
3951
|
export {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "chaincss",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.15",
|
|
4
4
|
"description": "ChainCSS v3.0 - 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",
|
package/src/runtime/index.ts
CHANGED
|
@@ -92,8 +92,22 @@ export type {
|
|
|
92
92
|
// Auto-inject styles into DOM
|
|
93
93
|
export function injectChainStyles(styles: Record<string, any>) {
|
|
94
94
|
let css = '';
|
|
95
|
+
let staticCount = 0, dynamicCount = 0, hybridCount = 0;
|
|
96
|
+
|
|
95
97
|
for (const [key, obj] of Object.entries(styles)) {
|
|
96
98
|
if (!obj || !obj.selectors) continue;
|
|
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++;
|
|
106
|
+
}
|
|
107
|
+
if (stat > 0 && dyn > 0) hybridCount++;
|
|
108
|
+
else if (dyn > 0) dynamicCount++;
|
|
109
|
+
else staticCount++;
|
|
110
|
+
|
|
97
111
|
const sel = '.' + obj.selectors[0];
|
|
98
112
|
css += sel + '{';
|
|
99
113
|
for (const [k, v] of Object.entries(obj)) {
|
|
@@ -118,5 +132,9 @@ export function injectChainStyles(styles: Record<string, any>) {
|
|
|
118
132
|
el.setAttribute('data-chaincss', 'runtime');
|
|
119
133
|
el.textContent = css;
|
|
120
134
|
document.head.appendChild(el);
|
|
135
|
+
|
|
136
|
+
// Show split stats in console
|
|
137
|
+
console.log('⛓️ ChainCSS Split: 📦 Static=' + staticCount + ' ⚡ Dynamic=' + dynamicCount + ' 🔀 Hybrid=' + hybridCount + ' | CSS: ' + css.length + ' bytes');
|
|
138
|
+
|
|
121
139
|
return el;
|
|
122
140
|
}
|