zss-engine 2.2.3 → 2.2.5
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 +1 -3
- package/dist/cjs/utils/transpile.js +2 -3
- package/dist/esm/index.js +0 -1
- package/dist/esm/utils/transpile.js +2 -3
- package/dist/types/index.d.ts +2 -4
- package/dist/types/types/main/create.d.ts +0 -12
- package/dist/types/types/main/variableTypes.d.ts +0 -7
- package/dist/types/utils/transpile.d.ts +1 -1
- package/package.json +11 -4
- package/readme.md +5 -1
- package/dist/cjs/utils/build.js +0 -28
- package/dist/esm/utils/build.js +0 -24
- package/dist/types/utils/build.d.ts +0 -1
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.
|
|
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;
|
|
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; } });
|
|
@@ -16,8 +16,6 @@ Object.defineProperty(exports, "splitAtomicAndNested", { enumerable: true, get:
|
|
|
16
16
|
Object.defineProperty(exports, "processAtomicProps", { enumerable: true, get: function () { return processor_atomic_js_1.processAtomicProps; } });
|
|
17
17
|
var override_longhand_js_1 = require("./utils/override-longhand.js");
|
|
18
18
|
Object.defineProperty(exports, "overrideLonghand", { enumerable: true, get: function () { return override_longhand_js_1.overrideLonghand; } });
|
|
19
|
-
var build_js_1 = require("./utils/build.js");
|
|
20
|
-
Object.defineProperty(exports, "build", { enumerable: true, get: function () { return build_js_1.build; } });
|
|
21
19
|
var helper_js_2 = require("./utils/helper.js");
|
|
22
20
|
Object.defineProperty(exports, "camelToKebabCase", { enumerable: true, get: function () { return helper_js_2.camelToKebabCase; } });
|
|
23
21
|
Object.defineProperty(exports, "applyCssValue", { enumerable: true, get: function () { return helper_js_2.applyCssValue; } });
|
|
@@ -37,7 +37,6 @@ function transpile(object, base36Hash, core) {
|
|
|
37
37
|
};
|
|
38
38
|
const stringConverter = (className, properties, indentLevel) => {
|
|
39
39
|
const classSelector = {};
|
|
40
|
-
const indent = ''.repeat(indentLevel);
|
|
41
40
|
const innerIndent = ' '.repeat(indentLevel + 1);
|
|
42
41
|
let cssRule = '';
|
|
43
42
|
for (const property in properties) {
|
|
@@ -89,13 +88,13 @@ function transpile(object, base36Hash, core) {
|
|
|
89
88
|
if (regularRules) {
|
|
90
89
|
mediaQueries.push({
|
|
91
90
|
media: mediaRule,
|
|
92
|
-
css: `${mediaRule} {\n${innerIndent}${className} {\n${regularRules} }\n${nestedRules}
|
|
91
|
+
css: `${mediaRule} {\n${innerIndent}${className} {\n${regularRules} }\n${nestedRules}}\n`,
|
|
93
92
|
});
|
|
94
93
|
}
|
|
95
94
|
else {
|
|
96
95
|
mediaQueries.push({
|
|
97
96
|
media: mediaRule,
|
|
98
|
-
css: `${mediaRule} {\n${nestedRules}
|
|
97
|
+
css: `${mediaRule} {\n${nestedRules}}\n`,
|
|
99
98
|
});
|
|
100
99
|
}
|
|
101
100
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -4,5 +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 { build } from './utils/build.js';
|
|
8
7
|
export { camelToKebabCase, applyCssValue } from './utils/helper.js';
|
|
@@ -34,7 +34,6 @@ export function transpile(object, base36Hash, core) {
|
|
|
34
34
|
};
|
|
35
35
|
const stringConverter = (className, properties, indentLevel) => {
|
|
36
36
|
const classSelector = {};
|
|
37
|
-
const indent = ''.repeat(indentLevel);
|
|
38
37
|
const innerIndent = ' '.repeat(indentLevel + 1);
|
|
39
38
|
let cssRule = '';
|
|
40
39
|
for (const property in properties) {
|
|
@@ -86,13 +85,13 @@ export function transpile(object, base36Hash, core) {
|
|
|
86
85
|
if (regularRules) {
|
|
87
86
|
mediaQueries.push({
|
|
88
87
|
media: mediaRule,
|
|
89
|
-
css: `${mediaRule} {\n${innerIndent}${className} {\n${regularRules} }\n${nestedRules}
|
|
88
|
+
css: `${mediaRule} {\n${innerIndent}${className} {\n${regularRules} }\n${nestedRules}}\n`,
|
|
90
89
|
});
|
|
91
90
|
}
|
|
92
91
|
else {
|
|
93
92
|
mediaQueries.push({
|
|
94
93
|
media: mediaRule,
|
|
95
|
-
css: `${mediaRule} {\n${nestedRules}
|
|
94
|
+
css: `${mediaRule} {\n${nestedRules}}\n`,
|
|
96
95
|
});
|
|
97
96
|
}
|
|
98
97
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export type { CSSProperties } from './types/common/css-properties';
|
|
2
|
-
export type {
|
|
3
|
-
export type {
|
|
4
|
-
export type { CreateStatic, CreateTheme, ReturnVariableType, Styles } from './types/main/variableTypes';
|
|
2
|
+
export type { CreateStyle } from './types/main/create';
|
|
3
|
+
export type { CreateTheme } from './types/main/variableTypes';
|
|
5
4
|
export type { ViewTransition } from './types/main/viewTransition';
|
|
6
5
|
export { isServer, isDevelopment, isTestingDevelopment } from './utils/helper.js';
|
|
7
6
|
export { genBase36Hash } from './utils/hash.js';
|
|
@@ -9,5 +8,4 @@ export { transpile } from './utils/transpile.js';
|
|
|
9
8
|
export { transpileAtomic } from './utils/transpile-atomic.js';
|
|
10
9
|
export { splitAtomicAndNested, processAtomicProps } from './utils/processor-atomic.js';
|
|
11
10
|
export { overrideLonghand } from './utils/override-longhand.js';
|
|
12
|
-
export { build } from './utils/build.js';
|
|
13
11
|
export { camelToKebabCase, applyCssValue } from './utils/helper.js';
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
import type { CSSProperties } from '../common/css-properties';
|
|
2
|
-
export type CreateStyleType<T> = {
|
|
3
|
-
readonly [K in keyof T]: T[K] extends CSSProperties ? CSSProperties : T[K];
|
|
4
|
-
};
|
|
5
2
|
export type CreateStyle = {
|
|
6
3
|
[key: string]: CSSProperties;
|
|
7
4
|
};
|
|
8
|
-
type Selector<Properties> = {
|
|
9
|
-
readonly properties: Properties;
|
|
10
|
-
};
|
|
11
|
-
export type ReturnType<T> = {
|
|
12
|
-
[K in keyof T]: Readonly<{
|
|
13
|
-
[P in keyof T[K]]: P extends `@media ${string}` | `@container ${string}` | `:${string}` | `&${string}` ? Selector<keyof T[K][P]> : T[K][P];
|
|
14
|
-
}>;
|
|
15
|
-
};
|
|
16
|
-
export {};
|
|
@@ -3,12 +3,5 @@ export type CSSVariableValue = `var(${CSSVariableKey})`;
|
|
|
3
3
|
export type CSSVariableProperty = {
|
|
4
4
|
[key: CSSVariableKey]: string | number;
|
|
5
5
|
};
|
|
6
|
-
export type CreateStatic = Record<string, string | number>;
|
|
7
6
|
export type CreateTheme = Record<string, Record<string, string | number>>;
|
|
8
|
-
export type ReturnVariableType<T> = {
|
|
9
|
-
[K in keyof T]: CSSVariableValue;
|
|
10
|
-
};
|
|
11
|
-
export type Styles = {
|
|
12
|
-
[key: CSSVariableKey]: string;
|
|
13
|
-
};
|
|
14
7
|
export {};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zss-engine",
|
|
3
|
-
"version": "2.2.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.2.5",
|
|
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",
|
|
7
7
|
"license": "MIT",
|
|
@@ -13,11 +13,18 @@
|
|
|
13
13
|
"url": "https://github.com/zss-in-js/zss-engine/issues"
|
|
14
14
|
},
|
|
15
15
|
"keywords": [
|
|
16
|
-
"zero-runtime",
|
|
17
16
|
"stylesheet",
|
|
17
|
+
"transpiler",
|
|
18
18
|
"atomic",
|
|
19
|
+
"atomic-css",
|
|
20
|
+
"semantic",
|
|
21
|
+
"wyw-in-js",
|
|
19
22
|
"engine",
|
|
20
|
-
"
|
|
23
|
+
"zero-runtime",
|
|
24
|
+
"css-in-js",
|
|
25
|
+
"hash",
|
|
26
|
+
"codegen",
|
|
27
|
+
"compiler"
|
|
21
28
|
],
|
|
22
29
|
"sideEffects": false,
|
|
23
30
|
"exports": {
|
package/readme.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
[](https://codecov.io/github/zss-in-js/zss-engine)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# zss-engine
|
|
4
|
+
|
|
5
|
+
A CSS-in-JS transpiler engine for building zero-runtime stylesheets at build time.
|
|
6
|
+
|
|
7
|
+
> Powers the build pipeline of [@plumeria/core](https://github.com/zss-in-js/plumeria)
|
|
4
8
|
|
|
5
9
|
## License
|
|
6
10
|
|
package/dist/cjs/utils/build.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use server';
|
|
2
|
-
"use strict";
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.build = void 0;
|
|
5
|
-
const helper_js_1 = require("./helper.js");
|
|
6
|
-
const build = async (styleSheet, filePath) => {
|
|
7
|
-
if (!helper_js_1.isServer)
|
|
8
|
-
return;
|
|
9
|
-
const fs = await import('fs');
|
|
10
|
-
try {
|
|
11
|
-
if (fs.existsSync(filePath)) {
|
|
12
|
-
const css = fs.readFileSync(filePath, 'utf-8');
|
|
13
|
-
if (!css.includes(styleSheet)) {
|
|
14
|
-
fs.appendFileSync(filePath, styleSheet, 'utf-8');
|
|
15
|
-
if (process.argv.includes('--view')) {
|
|
16
|
-
const { styleText } = await import('util');
|
|
17
|
-
const line = styleText('gray', '─'.repeat(60));
|
|
18
|
-
console.log('\n' + styleText(['green', 'bold'], '✓ extract...') + '\n\n' + styleText('cyan', styleSheet) + '\n' + line);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
console.error('Error writing to file:', error);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
exports.build = build;
|
package/dist/esm/utils/build.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
'use server';
|
|
2
|
-
import { isServer } from './helper.js';
|
|
3
|
-
export const build = async (styleSheet, filePath) => {
|
|
4
|
-
if (!isServer)
|
|
5
|
-
return;
|
|
6
|
-
const fs = await import('fs');
|
|
7
|
-
try {
|
|
8
|
-
if (fs.existsSync(filePath)) {
|
|
9
|
-
const css = fs.readFileSync(filePath, 'utf-8');
|
|
10
|
-
if (!css.includes(styleSheet)) {
|
|
11
|
-
fs.appendFileSync(filePath, styleSheet, 'utf-8');
|
|
12
|
-
if (process.argv.includes('--view')) {
|
|
13
|
-
const { styleText } = await import('util');
|
|
14
|
-
const line = styleText('gray', '─'.repeat(60));
|
|
15
|
-
console.log('\n' + styleText(['green', 'bold'], '✓ extract...') + '\n\n' + styleText('cyan', styleSheet) + '\n' + line);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
console.error('Error writing to file:', error);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const build: (styleSheet: string, filePath: string) => Promise<void>;
|