zss-engine 0.2.48 → 0.2.50
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/cjs/index.js +6 -3
- package/dist/cjs/utils/transpile-atomic.js +16 -0
- package/dist/cjs/utils/{transpiler.js → transpile.js} +5 -8
- package/dist/esm/index.js +3 -2
- package/dist/esm/utils/transpile-atomic.js +14 -0
- package/dist/esm/utils/{transpiler.js → transpile.js} +4 -7
- package/package.json +1 -1
- package/types/index.d.ts +3 -2
- package/types/utils/hash.d.ts +2 -2
- package/types/utils/transpile-atomic.d.ts +2 -0
- package/types/utils/transpile.d.ts +4 -0
- package/types/utils/transpiler.d.ts +0 -4
package/dist/cjs/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getServerCSS = exports.injectServerCSS = exports.injectClientGlobalCSS = exports.injectClientCSS = exports.camelToKebabCase = exports.build = exports.
|
|
3
|
+
exports.getServerCSS = exports.injectServerCSS = exports.injectClientGlobalCSS = exports.injectClientCSS = exports.applyCssValue = exports.camelToKebabCase = exports.build = exports.transpileAtomic = exports.transpile = exports.genBase36Hash = exports.isTestingDevelopment = exports.isDevelopment = exports.isServer = void 0;
|
|
4
4
|
var helper_js_1 = require("./utils/helper.js");
|
|
5
5
|
Object.defineProperty(exports, "isServer", { enumerable: true, get: function () { return helper_js_1.isServer; } });
|
|
6
6
|
Object.defineProperty(exports, "isDevelopment", { enumerable: true, get: function () { return helper_js_1.isDevelopment; } });
|
|
7
7
|
Object.defineProperty(exports, "isTestingDevelopment", { enumerable: true, get: function () { return helper_js_1.isTestingDevelopment; } });
|
|
8
8
|
var hash_js_1 = require("./utils/hash.js");
|
|
9
9
|
Object.defineProperty(exports, "genBase36Hash", { enumerable: true, get: function () { return hash_js_1.genBase36Hash; } });
|
|
10
|
-
var
|
|
11
|
-
Object.defineProperty(exports, "
|
|
10
|
+
var transpile_js_1 = require("./utils/transpile.js");
|
|
11
|
+
Object.defineProperty(exports, "transpile", { enumerable: true, get: function () { return transpile_js_1.transpile; } });
|
|
12
|
+
var transpile_atomic_js_1 = require("./utils/transpile-atomic.js");
|
|
13
|
+
Object.defineProperty(exports, "transpileAtomic", { enumerable: true, get: function () { return transpile_atomic_js_1.transpileAtomic; } });
|
|
12
14
|
var build_js_1 = require("./utils/build.js");
|
|
13
15
|
Object.defineProperty(exports, "build", { enumerable: true, get: function () { return build_js_1.build; } });
|
|
14
16
|
var helper_js_2 = require("./utils/helper.js");
|
|
15
17
|
Object.defineProperty(exports, "camelToKebabCase", { enumerable: true, get: function () { return helper_js_2.camelToKebabCase; } });
|
|
18
|
+
Object.defineProperty(exports, "applyCssValue", { enumerable: true, get: function () { return helper_js_2.applyCssValue; } });
|
|
16
19
|
var inject_client_css_js_1 = require("./utils/inject-client-css.js");
|
|
17
20
|
Object.defineProperty(exports, "injectClientCSS", { enumerable: true, get: function () { return inject_client_css_js_1.injectClientCSS; } });
|
|
18
21
|
var inject_client_global_css_js_1 = require("./utils/inject-client-global-css.js");
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transpileAtomic = transpileAtomic;
|
|
4
|
+
const helper_1 = require("./helper");
|
|
5
|
+
function transpileAtomic(property, value, hash) {
|
|
6
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
7
|
+
const CSSProp = (0, helper_1.camelToKebabCase)(property);
|
|
8
|
+
const applyValue = (0, helper_1.applyCssValue)(value, CSSProp);
|
|
9
|
+
const atomicRule = `.${hash} { ${CSSProp}: ${applyValue}; }`;
|
|
10
|
+
if (property.startsWith('@media') || property.startsWith('@container')) {
|
|
11
|
+
return `${property} {\n ${atomicRule}\n}\n`;
|
|
12
|
+
}
|
|
13
|
+
return `${atomicRule}\n`;
|
|
14
|
+
}
|
|
15
|
+
return '';
|
|
16
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.transpile = transpile;
|
|
4
4
|
const helper_js_1 = require("./helper.js");
|
|
5
5
|
const createKeyframes = (property, content) => {
|
|
6
6
|
let keyframesRules = `${property} {\n`;
|
|
@@ -24,11 +24,11 @@ const createKeyframes = (property, content) => {
|
|
|
24
24
|
keyframesRules += `}\n`;
|
|
25
25
|
return keyframesRules;
|
|
26
26
|
};
|
|
27
|
-
function
|
|
27
|
+
function transpile(object, base36Hash, core) {
|
|
28
28
|
let styleSheet = '';
|
|
29
29
|
const mediaQueries = [];
|
|
30
|
-
const
|
|
31
|
-
return core === '--global' ? property : `.${
|
|
30
|
+
const classNameApply = (property) => {
|
|
31
|
+
return core === '--global' ? property : `.${base36Hash}`;
|
|
32
32
|
};
|
|
33
33
|
const rules = (indent, rulesValue, property) => {
|
|
34
34
|
if (typeof property !== 'string')
|
|
@@ -47,9 +47,6 @@ function transpiler(object, base36Hash, core) {
|
|
|
47
47
|
const value = properties[property];
|
|
48
48
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
49
49
|
let CSSProp = (0, helper_js_1.camelToKebabCase)(property);
|
|
50
|
-
if (property.startsWith('ms')) {
|
|
51
|
-
CSSProp = `-${CSSProp}`;
|
|
52
|
-
}
|
|
53
50
|
const applyValue = (0, helper_js_1.applyCssValue)(value, CSSProp);
|
|
54
51
|
cssRule += ` ${CSSProp}: ${applyValue};\n`;
|
|
55
52
|
}
|
|
@@ -111,7 +108,7 @@ function transpiler(object, base36Hash, core) {
|
|
|
111
108
|
const keyframesContent = object[property];
|
|
112
109
|
styleSheet += createKeyframes(property, keyframesContent);
|
|
113
110
|
}
|
|
114
|
-
const classSelectors = stringConverter(
|
|
111
|
+
const classSelectors = stringConverter(classNameApply(property), object[property], 1);
|
|
115
112
|
for (const selector in classSelectors) {
|
|
116
113
|
if (!selector.startsWith('@keyframes') && classSelectors[selector]) {
|
|
117
114
|
styleSheet += selector + ' {\n' + classSelectors[selector] + '}\n';
|
package/dist/esm/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { isServer, isDevelopment, isTestingDevelopment } from './utils/helper.js';
|
|
2
2
|
export { genBase36Hash } from './utils/hash.js';
|
|
3
|
-
export {
|
|
3
|
+
export { transpile } from './utils/transpile.js';
|
|
4
|
+
export { transpileAtomic } from './utils/transpile-atomic.js';
|
|
4
5
|
export { build } from './utils/build.js';
|
|
5
|
-
export { camelToKebabCase } from './utils/helper.js';
|
|
6
|
+
export { camelToKebabCase, applyCssValue } from './utils/helper.js';
|
|
6
7
|
export { injectClientCSS } from './utils/inject-client-css.js';
|
|
7
8
|
export { injectClientGlobalCSS } from './utils/inject-client-global-css.js';
|
|
8
9
|
export { injectServerCSS, getServerCSS } from './utils/inject-server-css.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { applyCssValue, camelToKebabCase } from './helper';
|
|
2
|
+
function transpileAtomic(property, value, hash) {
|
|
3
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
4
|
+
const CSSProp = camelToKebabCase(property);
|
|
5
|
+
const applyValue = applyCssValue(value, CSSProp);
|
|
6
|
+
const atomicRule = `.${hash} { ${CSSProp}: ${applyValue}; }`;
|
|
7
|
+
if (property.startsWith('@media') || property.startsWith('@container')) {
|
|
8
|
+
return `${property} {\n ${atomicRule}\n}\n`;
|
|
9
|
+
}
|
|
10
|
+
return `${atomicRule}\n`;
|
|
11
|
+
}
|
|
12
|
+
return '';
|
|
13
|
+
}
|
|
14
|
+
export { transpileAtomic };
|
|
@@ -21,11 +21,11 @@ const createKeyframes = (property, content) => {
|
|
|
21
21
|
keyframesRules += `}\n`;
|
|
22
22
|
return keyframesRules;
|
|
23
23
|
};
|
|
24
|
-
export function
|
|
24
|
+
export function transpile(object, base36Hash, core) {
|
|
25
25
|
let styleSheet = '';
|
|
26
26
|
const mediaQueries = [];
|
|
27
|
-
const
|
|
28
|
-
return core === '--global' ? property : `.${
|
|
27
|
+
const classNameApply = (property) => {
|
|
28
|
+
return core === '--global' ? property : `.${base36Hash}`;
|
|
29
29
|
};
|
|
30
30
|
const rules = (indent, rulesValue, property) => {
|
|
31
31
|
if (typeof property !== 'string')
|
|
@@ -44,9 +44,6 @@ export function transpiler(object, base36Hash, core) {
|
|
|
44
44
|
const value = properties[property];
|
|
45
45
|
if (typeof value === 'string' || typeof value === 'number') {
|
|
46
46
|
let CSSProp = camelToKebabCase(property);
|
|
47
|
-
if (property.startsWith('ms')) {
|
|
48
|
-
CSSProp = `-${CSSProp}`;
|
|
49
|
-
}
|
|
50
47
|
const applyValue = applyCssValue(value, CSSProp);
|
|
51
48
|
cssRule += ` ${CSSProp}: ${applyValue};\n`;
|
|
52
49
|
}
|
|
@@ -108,7 +105,7 @@ export function transpiler(object, base36Hash, core) {
|
|
|
108
105
|
const keyframesContent = object[property];
|
|
109
106
|
styleSheet += createKeyframes(property, keyframesContent);
|
|
110
107
|
}
|
|
111
|
-
const classSelectors = stringConverter(
|
|
108
|
+
const classSelectors = stringConverter(classNameApply(property), object[property], 1);
|
|
112
109
|
for (const selector in classSelectors) {
|
|
113
110
|
if (!selector.startsWith('@keyframes') && classSelectors[selector]) {
|
|
114
111
|
styleSheet += selector + ' {\n' + classSelectors[selector] + '}\n';
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ export type { CreateValues, CreateTheme, ReturnVariableType, RxVariableSet, Retu
|
|
|
5
5
|
export type { Join } from './types/main/join';
|
|
6
6
|
export { isServer, isDevelopment, isTestingDevelopment } from './utils/helper.js';
|
|
7
7
|
export { genBase36Hash } from './utils/hash.js';
|
|
8
|
-
export {
|
|
8
|
+
export { transpile } from './utils/transpile.js';
|
|
9
|
+
export { transpileAtomic } from './utils/transpile-atomic.js';
|
|
9
10
|
export { build } from './utils/build.js';
|
|
10
|
-
export { camelToKebabCase } from './utils/helper.js';
|
|
11
|
+
export { camelToKebabCase, applyCssValue } from './utils/helper.js';
|
|
11
12
|
export { injectClientCSS } from './utils/inject-client-css.js';
|
|
12
13
|
export { injectClientGlobalCSS } from './utils/inject-client-global-css.js';
|
|
13
14
|
export { injectServerCSS, getServerCSS } from './utils/inject-server-css.js';
|
package/types/utils/hash.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { CreateStyle, CreateKeyframes } from '../index.js';
|
|
2
|
-
export declare function genBase36Hash(object: CreateStyle | CreateKeyframes, n: number): string;
|
|
1
|
+
import { CreateStyle, CreateKeyframes, CSSProperties } from '../index.js';
|
|
2
|
+
export declare function genBase36Hash(object: CreateStyle | CSSProperties | CreateKeyframes, n: number): string;
|