zss-engine 2.2.5 → 2.2.7
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 +2 -1
- package/dist/cjs/utils/helper.js +2 -1
- package/dist/cjs/utils/override-longhand.js +3 -2
- package/dist/cjs/utils/processor-atomic.js +10 -8
- package/dist/esm/index.js +1 -1
- package/dist/esm/utils/helper.js +1 -0
- package/dist/esm/utils/override-longhand.js +3 -2
- package/dist/esm/utils/processor-atomic.js +10 -8
- package/dist/types/index.d.ts +1 -2
- package/dist/types/utils/helper.d.ts +1 -0
- package/dist/types/utils/override-longhand.d.ts +2 -2
- package/dist/types/utils/processor-atomic.d.ts +2 -2
- package/package.json +7 -7
- package/dist/cjs/types/main/create.js +0 -2
- package/dist/esm/types/main/create.js +0 -1
- package/dist/types/types/main/create.d.ts +0 -4
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.applyCssValue = exports.camelToKebabCase = exports.overrideLonghand = exports.processAtomicProps = exports.splitAtomicAndNested = exports.transpileAtomic = exports.transpile = exports.genBase36Hash = exports.isTestingDevelopment = exports.isDevelopment = exports.isServer = void 0;
|
|
3
|
+
exports.exceptionCamelCase = exports.applyCssValue = exports.camelToKebabCase = exports.overrideLonghand = exports.processAtomicProps = exports.splitAtomicAndNested = 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; } });
|
|
@@ -19,3 +19,4 @@ Object.defineProperty(exports, "overrideLonghand", { enumerable: true, get: func
|
|
|
19
19
|
var helper_js_2 = require("./utils/helper.js");
|
|
20
20
|
Object.defineProperty(exports, "camelToKebabCase", { enumerable: true, get: function () { return helper_js_2.camelToKebabCase; } });
|
|
21
21
|
Object.defineProperty(exports, "applyCssValue", { enumerable: true, get: function () { return helper_js_2.applyCssValue; } });
|
|
22
|
+
Object.defineProperty(exports, "exceptionCamelCase", { enumerable: true, get: function () { return helper_js_2.exceptionCamelCase; } });
|
package/dist/cjs/utils/helper.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.camelToKebabCase = exports.applyCssValue = exports.isTestingDevelopment = exports.isDevelopment = exports.isServer = void 0;
|
|
3
|
+
exports.camelToKebabCase = exports.applyCssValue = exports.exceptionCamelCase = exports.isTestingDevelopment = exports.isDevelopment = exports.isServer = void 0;
|
|
4
4
|
const hex_to_color_name_js_1 = require("./hex-to-color-name.js");
|
|
5
5
|
const isWindowDefined = typeof window !== 'undefined';
|
|
6
6
|
const isDocumentDefined = typeof document !== 'undefined';
|
|
@@ -42,6 +42,7 @@ const exception = [
|
|
|
42
42
|
'z-index',
|
|
43
43
|
'zoom',
|
|
44
44
|
];
|
|
45
|
+
exports.exceptionCamelCase = exception.map(prop => prop.replace(/-([a-z])/g, (_, char) => char.toUpperCase()));
|
|
45
46
|
const convertHexToColorName = (value) => {
|
|
46
47
|
return value.replace(/#[0-9a-fA-F]{3,6}\b/g, match => {
|
|
47
48
|
return hex_to_color_name_js_1.hexToColorName[match.toLowerCase()] || match;
|
|
@@ -32,15 +32,16 @@ const overrideLonghand = (style) => {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
const finalStyle = {};
|
|
35
|
+
const queryStyle = style;
|
|
35
36
|
for (const prop of props) {
|
|
36
37
|
if (propsToRemove.has(prop)) {
|
|
37
38
|
continue;
|
|
38
39
|
}
|
|
39
40
|
if (prop.startsWith('@')) {
|
|
40
|
-
finalStyle[prop] = (0, exports.overrideLonghand)(
|
|
41
|
+
finalStyle[prop] = (0, exports.overrideLonghand)(queryStyle[prop]);
|
|
41
42
|
}
|
|
42
43
|
else {
|
|
43
|
-
finalStyle[prop] =
|
|
44
|
+
finalStyle[prop] = queryStyle[prop];
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
return finalStyle;
|
|
@@ -5,21 +5,23 @@ exports.processAtomicProps = processAtomicProps;
|
|
|
5
5
|
const index_js_1 = require("../index.js");
|
|
6
6
|
const shorthand_js_1 = require("./shorthand.js");
|
|
7
7
|
function splitAtomicAndNested(obj, flat, nonFlat) {
|
|
8
|
+
const queryFlat = flat;
|
|
9
|
+
const queryNonFlat = nonFlat;
|
|
8
10
|
Object.entries(obj).forEach(([property, value]) => {
|
|
9
11
|
if (property.startsWith(':') || property.startsWith('[')) {
|
|
10
|
-
|
|
12
|
+
queryNonFlat[property] = value;
|
|
11
13
|
}
|
|
12
14
|
else if (property.startsWith('@media') || property.startsWith('@container')) {
|
|
13
15
|
const innerFlat = {};
|
|
14
16
|
const innerNonFlat = {};
|
|
15
17
|
splitAtomicAndNested(value, innerFlat, innerNonFlat);
|
|
16
18
|
if (Object.keys(innerFlat).length)
|
|
17
|
-
|
|
19
|
+
queryFlat[property] = innerFlat;
|
|
18
20
|
if (Object.keys(innerNonFlat).length)
|
|
19
|
-
|
|
21
|
+
queryNonFlat[property] = innerNonFlat;
|
|
20
22
|
}
|
|
21
23
|
else {
|
|
22
|
-
|
|
24
|
+
queryFlat[property] = value;
|
|
23
25
|
}
|
|
24
26
|
});
|
|
25
27
|
}
|
|
@@ -31,12 +33,12 @@ Object.entries(shorthand_js_1.SHORTHAND_PROPERTIES).forEach(([shorthand, longhan
|
|
|
31
33
|
});
|
|
32
34
|
function processAtomicProps(flatProps, atomicMap, parentAtRule) {
|
|
33
35
|
const resultQueue = [];
|
|
34
|
-
for (const [
|
|
35
|
-
if (
|
|
36
|
-
processAtomicProps(
|
|
36
|
+
for (const [key, style] of Object.entries(flatProps)) {
|
|
37
|
+
if (key.startsWith('@media') || key.startsWith('@container')) {
|
|
38
|
+
processAtomicProps(style, atomicMap, key);
|
|
37
39
|
continue;
|
|
38
40
|
}
|
|
39
|
-
resultQueue.push([
|
|
41
|
+
resultQueue.push([key, style]);
|
|
40
42
|
}
|
|
41
43
|
for (const [property, value] of resultQueue) {
|
|
42
44
|
const CSSProp = (0, index_js_1.camelToKebabCase)(property);
|
package/dist/esm/index.js
CHANGED
|
@@ -4,4 +4,4 @@ export { transpile } from './utils/transpile.js';
|
|
|
4
4
|
export { transpileAtomic } from './utils/transpile-atomic.js';
|
|
5
5
|
export { splitAtomicAndNested, processAtomicProps } from './utils/processor-atomic.js';
|
|
6
6
|
export { overrideLonghand } from './utils/override-longhand.js';
|
|
7
|
-
export { camelToKebabCase, applyCssValue } from './utils/helper.js';
|
|
7
|
+
export { camelToKebabCase, applyCssValue, exceptionCamelCase } from './utils/helper.js';
|
package/dist/esm/utils/helper.js
CHANGED
|
@@ -39,6 +39,7 @@ const exception = [
|
|
|
39
39
|
'z-index',
|
|
40
40
|
'zoom',
|
|
41
41
|
];
|
|
42
|
+
export const exceptionCamelCase = exception.map(prop => prop.replace(/-([a-z])/g, (_, char) => char.toUpperCase()));
|
|
42
43
|
const convertHexToColorName = (value) => {
|
|
43
44
|
return value.replace(/#[0-9a-fA-F]{3,6}\b/g, match => {
|
|
44
45
|
return hexToColorName[match.toLowerCase()] || match;
|
|
@@ -29,15 +29,16 @@ export const overrideLonghand = (style) => {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
const finalStyle = {};
|
|
32
|
+
const queryStyle = style;
|
|
32
33
|
for (const prop of props) {
|
|
33
34
|
if (propsToRemove.has(prop)) {
|
|
34
35
|
continue;
|
|
35
36
|
}
|
|
36
37
|
if (prop.startsWith('@')) {
|
|
37
|
-
finalStyle[prop] = overrideLonghand(
|
|
38
|
+
finalStyle[prop] = overrideLonghand(queryStyle[prop]);
|
|
38
39
|
}
|
|
39
40
|
else {
|
|
40
|
-
finalStyle[prop] =
|
|
41
|
+
finalStyle[prop] = queryStyle[prop];
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
44
|
return finalStyle;
|
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import { camelToKebabCase, genBase36Hash, applyCssValue, transpileAtomic } from '../index.js';
|
|
2
2
|
import { SHORTHAND_PROPERTIES } from './shorthand.js';
|
|
3
3
|
function splitAtomicAndNested(obj, flat, nonFlat) {
|
|
4
|
+
const queryFlat = flat;
|
|
5
|
+
const queryNonFlat = nonFlat;
|
|
4
6
|
Object.entries(obj).forEach(([property, value]) => {
|
|
5
7
|
if (property.startsWith(':') || property.startsWith('[')) {
|
|
6
|
-
|
|
8
|
+
queryNonFlat[property] = value;
|
|
7
9
|
}
|
|
8
10
|
else if (property.startsWith('@media') || property.startsWith('@container')) {
|
|
9
11
|
const innerFlat = {};
|
|
10
12
|
const innerNonFlat = {};
|
|
11
13
|
splitAtomicAndNested(value, innerFlat, innerNonFlat);
|
|
12
14
|
if (Object.keys(innerFlat).length)
|
|
13
|
-
|
|
15
|
+
queryFlat[property] = innerFlat;
|
|
14
16
|
if (Object.keys(innerNonFlat).length)
|
|
15
|
-
|
|
17
|
+
queryNonFlat[property] = innerNonFlat;
|
|
16
18
|
}
|
|
17
19
|
else {
|
|
18
|
-
|
|
20
|
+
queryFlat[property] = value;
|
|
19
21
|
}
|
|
20
22
|
});
|
|
21
23
|
}
|
|
@@ -27,12 +29,12 @@ Object.entries(SHORTHAND_PROPERTIES).forEach(([shorthand, longhands]) => {
|
|
|
27
29
|
});
|
|
28
30
|
function processAtomicProps(flatProps, atomicMap, parentAtRule) {
|
|
29
31
|
const resultQueue = [];
|
|
30
|
-
for (const [
|
|
31
|
-
if (
|
|
32
|
-
processAtomicProps(
|
|
32
|
+
for (const [key, style] of Object.entries(flatProps)) {
|
|
33
|
+
if (key.startsWith('@media') || key.startsWith('@container')) {
|
|
34
|
+
processAtomicProps(style, atomicMap, key);
|
|
33
35
|
continue;
|
|
34
36
|
}
|
|
35
|
-
resultQueue.push([
|
|
37
|
+
resultQueue.push([key, style]);
|
|
36
38
|
}
|
|
37
39
|
for (const [property, value] of resultQueue) {
|
|
38
40
|
const CSSProp = camelToKebabCase(property);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export type { CSSProperties } from './types/common/css-properties';
|
|
2
|
-
export type { CreateStyle } from './types/main/create';
|
|
3
2
|
export type { CreateTheme } from './types/main/variableTypes';
|
|
4
3
|
export type { ViewTransition } from './types/main/viewTransition';
|
|
5
4
|
export { isServer, isDevelopment, isTestingDevelopment } from './utils/helper.js';
|
|
@@ -8,4 +7,4 @@ export { transpile } from './utils/transpile.js';
|
|
|
8
7
|
export { transpileAtomic } from './utils/transpile-atomic.js';
|
|
9
8
|
export { splitAtomicAndNested, processAtomicProps } from './utils/processor-atomic.js';
|
|
10
9
|
export { overrideLonghand } from './utils/override-longhand.js';
|
|
11
|
-
export { camelToKebabCase, applyCssValue } from './utils/helper.js';
|
|
10
|
+
export { camelToKebabCase, applyCssValue, exceptionCamelCase } from './utils/helper.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const isServer: boolean;
|
|
2
2
|
export declare const isDevelopment: boolean;
|
|
3
3
|
export declare const isTestingDevelopment: boolean;
|
|
4
|
+
export declare const exceptionCamelCase: string[];
|
|
4
5
|
export declare const applyCssValue: (value: string | number, cssProp: string) => string;
|
|
5
6
|
export declare const camelToKebabCase: (property: string) => string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const overrideLonghand: (style:
|
|
1
|
+
import { CSSProperties } from '../types/common/css-properties.js';
|
|
2
|
+
export declare const overrideLonghand: (style: CSSProperties) => CSSProperties;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties
|
|
2
|
-
declare function splitAtomicAndNested(obj: CSSProperties, flat:
|
|
1
|
+
import type { CSSProperties } from '../index.js';
|
|
2
|
+
declare function splitAtomicAndNested(obj: CSSProperties, flat: CSSProperties, nonFlat: CSSProperties): void;
|
|
3
3
|
declare function processAtomicProps(flatProps: CSSProperties, atomicMap: Map<string, string>, parentAtRule?: string): void;
|
|
4
4
|
export { splitAtomicAndNested, processAtomicProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zss-engine",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.7",
|
|
4
4
|
"description": "A CSS-in-JS transpiler engine for building zero-runtime stylesheets at build time.",
|
|
5
5
|
"funding": "https://github.com/sponsors/refirst11",
|
|
6
6
|
"author": "Refirst 11",
|
|
@@ -51,13 +51,13 @@
|
|
|
51
51
|
"csstype": "3.2.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
|
-
"@types/jest": "^
|
|
55
|
-
"@types/node": "^
|
|
56
|
-
"jest": "^
|
|
57
|
-
"jest-environment-jsdom": "^
|
|
54
|
+
"@types/jest": "^30.0.0",
|
|
55
|
+
"@types/node": "^25.6.0",
|
|
56
|
+
"jest": "^30.3.0",
|
|
57
|
+
"jest-environment-jsdom": "^30.3.0",
|
|
58
58
|
"rimraf": "^6.1.2",
|
|
59
|
-
"ts-jest": "^29.4.
|
|
60
|
-
"typescript": "^
|
|
59
|
+
"ts-jest": "^29.4.9",
|
|
60
|
+
"typescript": "^6.0.2"
|
|
61
61
|
},
|
|
62
62
|
"publishConfig": {
|
|
63
63
|
"access": "public",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|