zss-engine 0.2.64 → 0.2.66
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/utils/build.js +1 -2
- package/dist/cjs/utils/hash.js +6 -3
- package/dist/cjs/utils/processor-atomic.js +44 -15
- package/dist/cjs/utils/shorthand.js +80 -0
- package/dist/esm/utils/build.js +1 -2
- package/dist/esm/utils/hash.js +6 -3
- package/dist/esm/utils/processor-atomic.js +44 -15
- package/dist/esm/utils/shorthand.js +77 -0
- package/package.json +1 -1
- package/types/types/main/create.d.ts +3 -5
- package/types/types/main/global.d.ts +1 -5
- package/types/utils/shorthand.d.ts +1 -0
package/dist/cjs/utils/build.js
CHANGED
|
@@ -7,8 +7,7 @@ const build = async (styleSheet, filePath, global) => {
|
|
|
7
7
|
if (!helper_js_1.isServer)
|
|
8
8
|
return;
|
|
9
9
|
const fs = await import('fs');
|
|
10
|
-
const
|
|
11
|
-
const message = global === '--global' ? styleText('underline', `✅Generated global CSS\n\n`) : styleText('underline', `✅Generated create CSS\n\n`);
|
|
10
|
+
const message = global === '--global' ? `💫 style.global(...):\n\n` : `💫 style.props(...):\n\n`;
|
|
12
11
|
try {
|
|
13
12
|
if (fs.existsSync(filePath)) {
|
|
14
13
|
const cssData = fs.readFileSync(filePath, 'utf-8');
|
package/dist/cjs/utils/hash.js
CHANGED
|
@@ -2,15 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.genBase36Hash = genBase36Hash;
|
|
4
4
|
function deepNormalize(obj) {
|
|
5
|
-
if (obj === null
|
|
5
|
+
if (obj === null)
|
|
6
6
|
return 'null';
|
|
7
|
+
if (obj === undefined)
|
|
8
|
+
return 'undefined';
|
|
7
9
|
if (typeof obj !== 'object')
|
|
8
10
|
return String(obj);
|
|
9
11
|
if (Array.isArray(obj)) {
|
|
10
12
|
return '[' + obj.map(deepNormalize).join(',') + ']';
|
|
11
13
|
}
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
+
const recordObj = obj;
|
|
15
|
+
const keys = Object.keys(recordObj).sort();
|
|
16
|
+
const pairs = keys.map(key => `"${key}":${deepNormalize(recordObj[key])}`);
|
|
14
17
|
return '{' + pairs.join(',') + '}';
|
|
15
18
|
}
|
|
16
19
|
function murmurhash3_32(str, seed = 0) {
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.splitAtomicAndNested = splitAtomicAndNested;
|
|
4
4
|
exports.processAtomicProps = processAtomicProps;
|
|
5
5
|
const index_js_1 = require("../index.js");
|
|
6
|
+
const shorthand_1 = require("./shorthand");
|
|
6
7
|
function splitAtomicAndNested(obj, flat, nonFlat) {
|
|
7
8
|
Object.entries(obj).forEach(([property, value]) => {
|
|
8
9
|
if (property.startsWith(':') || property.startsWith('&')) {
|
|
@@ -25,25 +26,53 @@ function splitAtomicAndNested(obj, flat, nonFlat) {
|
|
|
25
26
|
}
|
|
26
27
|
});
|
|
27
28
|
}
|
|
29
|
+
const LONG_TO_SHORT = {};
|
|
30
|
+
Object.entries(shorthand_1.SHORTHAND_PROPERTIES).forEach(([shorthand, longhands]) => {
|
|
31
|
+
longhands.forEach(long => {
|
|
32
|
+
LONG_TO_SHORT[long] = shorthand;
|
|
33
|
+
});
|
|
34
|
+
});
|
|
28
35
|
function processAtomicProps(flatProps, atomicHashes, allStyleSheets, parentAtRule) {
|
|
29
|
-
|
|
36
|
+
const seen = new Set();
|
|
37
|
+
const resultQueue = [];
|
|
38
|
+
for (const [property, value] of Object.entries(flatProps)) {
|
|
30
39
|
if (property.startsWith('@media') || property.startsWith('@container')) {
|
|
31
40
|
processAtomicProps(value, atomicHashes, allStyleSheets, property);
|
|
41
|
+
continue;
|
|
32
42
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
styleSheet = `${parentAtRule} { ${styleSheet} }`;
|
|
43
|
+
const kebab = (0, index_js_1.camelToKebabCase)(property);
|
|
44
|
+
if (shorthand_1.SHORTHAND_PROPERTIES[kebab]) {
|
|
45
|
+
const longhands = shorthand_1.SHORTHAND_PROPERTIES[kebab];
|
|
46
|
+
longhands.forEach(l => seen.delete(l));
|
|
47
|
+
seen.add(kebab);
|
|
48
|
+
resultQueue.push([property, value]);
|
|
49
|
+
}
|
|
50
|
+
else if (kebab in LONG_TO_SHORT) {
|
|
51
|
+
const shorthand = LONG_TO_SHORT[kebab];
|
|
52
|
+
if (seen.has(shorthand)) {
|
|
53
|
+
continue;
|
|
45
54
|
}
|
|
46
|
-
|
|
55
|
+
seen.add(kebab);
|
|
56
|
+
resultQueue.push([property, value]);
|
|
47
57
|
}
|
|
48
|
-
|
|
58
|
+
else {
|
|
59
|
+
seen.add(kebab);
|
|
60
|
+
resultQueue.push([property, value]);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
for (const [property, value] of resultQueue) {
|
|
64
|
+
const CSSProp = (0, index_js_1.camelToKebabCase)(property);
|
|
65
|
+
const normalizedValue = (0, index_js_1.applyCssValue)(value, CSSProp);
|
|
66
|
+
const singlePropObj = { [property]: normalizedValue };
|
|
67
|
+
const styleObj = parentAtRule ? { [parentAtRule]: singlePropObj } : singlePropObj;
|
|
68
|
+
const atomicHash = (0, index_js_1.genBase36Hash)(styleObj, 1, 8);
|
|
69
|
+
if (atomicHashes.has(atomicHash))
|
|
70
|
+
continue;
|
|
71
|
+
atomicHashes.add(atomicHash);
|
|
72
|
+
let styleSheet = (0, index_js_1.transpileAtomic)(property, value, atomicHash);
|
|
73
|
+
if (parentAtRule) {
|
|
74
|
+
styleSheet = `${parentAtRule} { ${styleSheet} }`;
|
|
75
|
+
}
|
|
76
|
+
allStyleSheets.add(styleSheet + '\n');
|
|
77
|
+
}
|
|
49
78
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SHORTHAND_PROPERTIES = void 0;
|
|
4
|
+
exports.SHORTHAND_PROPERTIES = {
|
|
5
|
+
margin: ['margin-top', 'margin-bottom', 'margin-left', 'margin-right'],
|
|
6
|
+
padding: ['padding-top', 'padding-bottom', 'padding-left', 'padding-right'],
|
|
7
|
+
background: [
|
|
8
|
+
'background-image',
|
|
9
|
+
'background-size',
|
|
10
|
+
'background-position',
|
|
11
|
+
'background-repeat',
|
|
12
|
+
'background-origin',
|
|
13
|
+
'background-clip',
|
|
14
|
+
'background-attachment',
|
|
15
|
+
'background-color',
|
|
16
|
+
],
|
|
17
|
+
font: ['font-style', 'font-variant', 'font-weight', 'font-stretch', 'font-size', 'font-family', 'line-height'],
|
|
18
|
+
border: [
|
|
19
|
+
'border-top-width',
|
|
20
|
+
'border-bottom-width',
|
|
21
|
+
'border-left-width',
|
|
22
|
+
'border-right-width',
|
|
23
|
+
'border-top-style',
|
|
24
|
+
'border-bottom-style',
|
|
25
|
+
'border-left-style',
|
|
26
|
+
'border-right-style',
|
|
27
|
+
'border-top-color',
|
|
28
|
+
'border-bottom-color',
|
|
29
|
+
'border-left-color',
|
|
30
|
+
'border-right-color',
|
|
31
|
+
],
|
|
32
|
+
'border-top': ['border-top-width', 'border-top-style', 'border-top-color'],
|
|
33
|
+
'border-bottom': ['border-bottom-width', 'border-bottom-style', 'border-bottom-color'],
|
|
34
|
+
'border-left': ['border-left-width', 'border-left-style', 'border-left-color'],
|
|
35
|
+
'border-right': ['border-right-width', 'border-right-style', 'border-right-color'],
|
|
36
|
+
'border-width': ['border-top-width', 'border-bottom-width', 'border-left-width', 'border-right-width'],
|
|
37
|
+
'border-style': ['border-top-style', 'border-bottom-style', 'border-left-style', 'border-right-style'],
|
|
38
|
+
'border-color': ['border-top-color', 'border-bottom-color', 'border-left-color', 'border-right-color'],
|
|
39
|
+
'list-style': ['list-style-type', 'list-style-position', 'list-style-image'],
|
|
40
|
+
'border-radius': ['border-top-right-radius', 'border-top-left-radius', 'border-bottom-right-radius', 'border-bottom-left-radius'],
|
|
41
|
+
transition: ['transition-delay', 'transition-duration', 'transition-property', 'transition-timing-function'],
|
|
42
|
+
animation: [
|
|
43
|
+
'animation-name',
|
|
44
|
+
'animation-duration',
|
|
45
|
+
'animation-timing-function',
|
|
46
|
+
'animation-delay',
|
|
47
|
+
'animation-iteration-count',
|
|
48
|
+
'animation-direction',
|
|
49
|
+
'animation-fill-mode',
|
|
50
|
+
'animation-play-state',
|
|
51
|
+
],
|
|
52
|
+
'border-block-end': ['border-block-end-width', 'border-block-end-style', 'border-block-end-color'],
|
|
53
|
+
'border-block-start': ['border-block-start-width', 'border-block-start-style', 'border-block-start-color'],
|
|
54
|
+
'border-image': ['border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset', 'border-image-repeat'],
|
|
55
|
+
'border-inline-end': ['border-inline-end-width', 'border-inline-end-style', 'border-inline-end-color'],
|
|
56
|
+
'border-inline-start': ['border-inline-start-width', 'border-inline-start-style', 'border-inline-start-color'],
|
|
57
|
+
'column-rule': ['column-rule-width', 'column-rule-style', 'column-rule-color'],
|
|
58
|
+
columns: ['column-width', 'column-count'],
|
|
59
|
+
flex: ['flex-grow', 'flex-shrink', 'flex-basis'],
|
|
60
|
+
'flex-flow': ['flex-direction', 'flex-wrap'],
|
|
61
|
+
grid: [
|
|
62
|
+
'grid-template-rows',
|
|
63
|
+
'grid-template-columns',
|
|
64
|
+
'grid-template-areas',
|
|
65
|
+
'grid-auto-rows',
|
|
66
|
+
'grid-auto-columns',
|
|
67
|
+
'grid-auto-flow',
|
|
68
|
+
'grid-column-gap',
|
|
69
|
+
'grid-row-gap',
|
|
70
|
+
],
|
|
71
|
+
'grid-area': ['grid-row-start', 'grid-column-start', 'grid-row-end', 'grid-column-end'],
|
|
72
|
+
'grid-column': ['grid-column-start', 'grid-column-end'],
|
|
73
|
+
'grid-gap': ['grid-row-gap', 'grid-column-gap'],
|
|
74
|
+
'grid-row': ['grid-row-start', 'grid-row-end'],
|
|
75
|
+
'grid-template': ['grid-template-columns', 'grid-template-rows', 'grid-template-areas'],
|
|
76
|
+
outline: ['outline-color', 'outline-style', 'outline-width'],
|
|
77
|
+
'text-decoration': ['text-decoration-color', 'text-decoration-style', 'text-decoration-line'],
|
|
78
|
+
'text-emphasis': ['text-emphasis-style', 'text-emphasis-color'],
|
|
79
|
+
mask: ['mask-image', 'mask-mode', 'mask-position', 'mask-size', 'mask-repeat', 'mask-origin', 'mask-clip', 'mask-composite'],
|
|
80
|
+
};
|
package/dist/esm/utils/build.js
CHANGED
|
@@ -4,8 +4,7 @@ export const build = async (styleSheet, filePath, global) => {
|
|
|
4
4
|
if (!isServer)
|
|
5
5
|
return;
|
|
6
6
|
const fs = await import('fs');
|
|
7
|
-
const
|
|
8
|
-
const message = global === '--global' ? styleText('underline', `✅Generated global CSS\n\n`) : styleText('underline', `✅Generated create CSS\n\n`);
|
|
7
|
+
const message = global === '--global' ? `💫 style.global(...):\n\n` : `💫 style.props(...):\n\n`;
|
|
9
8
|
try {
|
|
10
9
|
if (fs.existsSync(filePath)) {
|
|
11
10
|
const cssData = fs.readFileSync(filePath, 'utf-8');
|
package/dist/esm/utils/hash.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
function deepNormalize(obj) {
|
|
2
|
-
if (obj === null
|
|
2
|
+
if (obj === null)
|
|
3
3
|
return 'null';
|
|
4
|
+
if (obj === undefined)
|
|
5
|
+
return 'undefined';
|
|
4
6
|
if (typeof obj !== 'object')
|
|
5
7
|
return String(obj);
|
|
6
8
|
if (Array.isArray(obj)) {
|
|
7
9
|
return '[' + obj.map(deepNormalize).join(',') + ']';
|
|
8
10
|
}
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
+
const recordObj = obj;
|
|
12
|
+
const keys = Object.keys(recordObj).sort();
|
|
13
|
+
const pairs = keys.map(key => `"${key}":${deepNormalize(recordObj[key])}`);
|
|
11
14
|
return '{' + pairs.join(',') + '}';
|
|
12
15
|
}
|
|
13
16
|
function murmurhash3_32(str, seed = 0) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { camelToKebabCase, genBase36Hash, applyCssValue, transpileAtomic } from '../index.js';
|
|
2
|
+
import { SHORTHAND_PROPERTIES } from './shorthand';
|
|
2
3
|
function splitAtomicAndNested(obj, flat, nonFlat) {
|
|
3
4
|
Object.entries(obj).forEach(([property, value]) => {
|
|
4
5
|
if (property.startsWith(':') || property.startsWith('&')) {
|
|
@@ -21,26 +22,54 @@ function splitAtomicAndNested(obj, flat, nonFlat) {
|
|
|
21
22
|
}
|
|
22
23
|
});
|
|
23
24
|
}
|
|
25
|
+
const LONG_TO_SHORT = {};
|
|
26
|
+
Object.entries(SHORTHAND_PROPERTIES).forEach(([shorthand, longhands]) => {
|
|
27
|
+
longhands.forEach(long => {
|
|
28
|
+
LONG_TO_SHORT[long] = shorthand;
|
|
29
|
+
});
|
|
30
|
+
});
|
|
24
31
|
function processAtomicProps(flatProps, atomicHashes, allStyleSheets, parentAtRule) {
|
|
25
|
-
|
|
32
|
+
const seen = new Set();
|
|
33
|
+
const resultQueue = [];
|
|
34
|
+
for (const [property, value] of Object.entries(flatProps)) {
|
|
26
35
|
if (property.startsWith('@media') || property.startsWith('@container')) {
|
|
27
36
|
processAtomicProps(value, atomicHashes, allStyleSheets, property);
|
|
37
|
+
continue;
|
|
28
38
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
styleSheet = `${parentAtRule} { ${styleSheet} }`;
|
|
39
|
+
const kebab = camelToKebabCase(property);
|
|
40
|
+
if (SHORTHAND_PROPERTIES[kebab]) {
|
|
41
|
+
const longhands = SHORTHAND_PROPERTIES[kebab];
|
|
42
|
+
longhands.forEach(l => seen.delete(l));
|
|
43
|
+
seen.add(kebab);
|
|
44
|
+
resultQueue.push([property, value]);
|
|
45
|
+
}
|
|
46
|
+
else if (kebab in LONG_TO_SHORT) {
|
|
47
|
+
const shorthand = LONG_TO_SHORT[kebab];
|
|
48
|
+
if (seen.has(shorthand)) {
|
|
49
|
+
continue;
|
|
41
50
|
}
|
|
42
|
-
|
|
51
|
+
seen.add(kebab);
|
|
52
|
+
resultQueue.push([property, value]);
|
|
43
53
|
}
|
|
44
|
-
|
|
54
|
+
else {
|
|
55
|
+
seen.add(kebab);
|
|
56
|
+
resultQueue.push([property, value]);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const [property, value] of resultQueue) {
|
|
60
|
+
const CSSProp = camelToKebabCase(property);
|
|
61
|
+
const normalizedValue = applyCssValue(value, CSSProp);
|
|
62
|
+
const singlePropObj = { [property]: normalizedValue };
|
|
63
|
+
const styleObj = parentAtRule ? { [parentAtRule]: singlePropObj } : singlePropObj;
|
|
64
|
+
const atomicHash = genBase36Hash(styleObj, 1, 8);
|
|
65
|
+
if (atomicHashes.has(atomicHash))
|
|
66
|
+
continue;
|
|
67
|
+
atomicHashes.add(atomicHash);
|
|
68
|
+
let styleSheet = transpileAtomic(property, value, atomicHash);
|
|
69
|
+
if (parentAtRule) {
|
|
70
|
+
styleSheet = `${parentAtRule} { ${styleSheet} }`;
|
|
71
|
+
}
|
|
72
|
+
allStyleSheets.add(styleSheet + '\n');
|
|
73
|
+
}
|
|
45
74
|
}
|
|
46
75
|
export { splitAtomicAndNested, processAtomicProps };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export const SHORTHAND_PROPERTIES = {
|
|
2
|
+
margin: ['margin-top', 'margin-bottom', 'margin-left', 'margin-right'],
|
|
3
|
+
padding: ['padding-top', 'padding-bottom', 'padding-left', 'padding-right'],
|
|
4
|
+
background: [
|
|
5
|
+
'background-image',
|
|
6
|
+
'background-size',
|
|
7
|
+
'background-position',
|
|
8
|
+
'background-repeat',
|
|
9
|
+
'background-origin',
|
|
10
|
+
'background-clip',
|
|
11
|
+
'background-attachment',
|
|
12
|
+
'background-color',
|
|
13
|
+
],
|
|
14
|
+
font: ['font-style', 'font-variant', 'font-weight', 'font-stretch', 'font-size', 'font-family', 'line-height'],
|
|
15
|
+
border: [
|
|
16
|
+
'border-top-width',
|
|
17
|
+
'border-bottom-width',
|
|
18
|
+
'border-left-width',
|
|
19
|
+
'border-right-width',
|
|
20
|
+
'border-top-style',
|
|
21
|
+
'border-bottom-style',
|
|
22
|
+
'border-left-style',
|
|
23
|
+
'border-right-style',
|
|
24
|
+
'border-top-color',
|
|
25
|
+
'border-bottom-color',
|
|
26
|
+
'border-left-color',
|
|
27
|
+
'border-right-color',
|
|
28
|
+
],
|
|
29
|
+
'border-top': ['border-top-width', 'border-top-style', 'border-top-color'],
|
|
30
|
+
'border-bottom': ['border-bottom-width', 'border-bottom-style', 'border-bottom-color'],
|
|
31
|
+
'border-left': ['border-left-width', 'border-left-style', 'border-left-color'],
|
|
32
|
+
'border-right': ['border-right-width', 'border-right-style', 'border-right-color'],
|
|
33
|
+
'border-width': ['border-top-width', 'border-bottom-width', 'border-left-width', 'border-right-width'],
|
|
34
|
+
'border-style': ['border-top-style', 'border-bottom-style', 'border-left-style', 'border-right-style'],
|
|
35
|
+
'border-color': ['border-top-color', 'border-bottom-color', 'border-left-color', 'border-right-color'],
|
|
36
|
+
'list-style': ['list-style-type', 'list-style-position', 'list-style-image'],
|
|
37
|
+
'border-radius': ['border-top-right-radius', 'border-top-left-radius', 'border-bottom-right-radius', 'border-bottom-left-radius'],
|
|
38
|
+
transition: ['transition-delay', 'transition-duration', 'transition-property', 'transition-timing-function'],
|
|
39
|
+
animation: [
|
|
40
|
+
'animation-name',
|
|
41
|
+
'animation-duration',
|
|
42
|
+
'animation-timing-function',
|
|
43
|
+
'animation-delay',
|
|
44
|
+
'animation-iteration-count',
|
|
45
|
+
'animation-direction',
|
|
46
|
+
'animation-fill-mode',
|
|
47
|
+
'animation-play-state',
|
|
48
|
+
],
|
|
49
|
+
'border-block-end': ['border-block-end-width', 'border-block-end-style', 'border-block-end-color'],
|
|
50
|
+
'border-block-start': ['border-block-start-width', 'border-block-start-style', 'border-block-start-color'],
|
|
51
|
+
'border-image': ['border-image-source', 'border-image-slice', 'border-image-width', 'border-image-outset', 'border-image-repeat'],
|
|
52
|
+
'border-inline-end': ['border-inline-end-width', 'border-inline-end-style', 'border-inline-end-color'],
|
|
53
|
+
'border-inline-start': ['border-inline-start-width', 'border-inline-start-style', 'border-inline-start-color'],
|
|
54
|
+
'column-rule': ['column-rule-width', 'column-rule-style', 'column-rule-color'],
|
|
55
|
+
columns: ['column-width', 'column-count'],
|
|
56
|
+
flex: ['flex-grow', 'flex-shrink', 'flex-basis'],
|
|
57
|
+
'flex-flow': ['flex-direction', 'flex-wrap'],
|
|
58
|
+
grid: [
|
|
59
|
+
'grid-template-rows',
|
|
60
|
+
'grid-template-columns',
|
|
61
|
+
'grid-template-areas',
|
|
62
|
+
'grid-auto-rows',
|
|
63
|
+
'grid-auto-columns',
|
|
64
|
+
'grid-auto-flow',
|
|
65
|
+
'grid-column-gap',
|
|
66
|
+
'grid-row-gap',
|
|
67
|
+
],
|
|
68
|
+
'grid-area': ['grid-row-start', 'grid-column-start', 'grid-row-end', 'grid-column-end'],
|
|
69
|
+
'grid-column': ['grid-column-start', 'grid-column-end'],
|
|
70
|
+
'grid-gap': ['grid-row-gap', 'grid-column-gap'],
|
|
71
|
+
'grid-row': ['grid-row-start', 'grid-row-end'],
|
|
72
|
+
'grid-template': ['grid-template-columns', 'grid-template-rows', 'grid-template-areas'],
|
|
73
|
+
outline: ['outline-color', 'outline-style', 'outline-width'],
|
|
74
|
+
'text-decoration': ['text-decoration-color', 'text-decoration-style', 'text-decoration-line'],
|
|
75
|
+
'text-emphasis': ['text-emphasis-style', 'text-emphasis-color'],
|
|
76
|
+
mask: ['mask-image', 'mask-mode', 'mask-position', 'mask-size', 'mask-repeat', 'mask-origin', 'mask-clip', 'mask-composite'],
|
|
77
|
+
};
|
package/package.json
CHANGED
|
@@ -5,17 +5,15 @@ export type CreateStyleType<T> = {
|
|
|
5
5
|
export type CreateStyle = {
|
|
6
6
|
[key: string]: CSSProperties;
|
|
7
7
|
};
|
|
8
|
-
type
|
|
8
|
+
type SelectorProperties<Properties> = {
|
|
9
9
|
readonly properties: Properties;
|
|
10
10
|
};
|
|
11
|
-
type
|
|
11
|
+
type StyleAtomClassFor<P extends string, V> = {
|
|
12
12
|
readonly property: `${P}: ${V & (string | number)}`;
|
|
13
13
|
};
|
|
14
14
|
export type ReturnType<T> = {
|
|
15
15
|
[K in keyof T]: Readonly<{
|
|
16
|
-
[P in keyof T[K]]: P extends `@media ${string}` | `@container ${string}` | `:${string}` | `&${string}` ?
|
|
16
|
+
[P in keyof T[K]]: P extends `@media ${string}` | `@container ${string}` | `:${string}` | `&${string}` ? SelectorProperties<keyof T[K][P]> : StyleAtomClassFor<P & string, T[K][P]>;
|
|
17
17
|
}>;
|
|
18
|
-
} & {
|
|
19
|
-
[K in keyof T as `$${string & K}`]: string;
|
|
20
18
|
};
|
|
21
19
|
export {};
|
|
@@ -3,10 +3,6 @@ type JSXType = keyof HTMLElementTagNameMap | '*' | ':root';
|
|
|
3
3
|
type HTMLSelector = {
|
|
4
4
|
[K in JSXType]: CSSProperties;
|
|
5
5
|
};
|
|
6
|
-
type ClassName = `.${string}`;
|
|
7
|
-
type ClassNameSelector = {
|
|
8
|
-
[K in ClassName]: CSSProperties;
|
|
9
|
-
};
|
|
10
6
|
type Attribute = `${string}[${string}]${string}`;
|
|
11
7
|
type AttributeSelector = {
|
|
12
8
|
[K in Attribute]: CSSProperties;
|
|
@@ -33,5 +29,5 @@ type KeyframesSelector = {
|
|
|
33
29
|
type QuerySelectorHTML = {
|
|
34
30
|
[K in Query]: CSSHTML;
|
|
35
31
|
};
|
|
36
|
-
export type CSSHTML = HTMLSelector |
|
|
32
|
+
export type CSSHTML = HTMLSelector | AttributeSelector | ConsecutiveSelector | PseudoClassSelector | PseudoElementSelector | KeyframesSelector | QuerySelectorHTML;
|
|
37
33
|
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SHORTHAND_PROPERTIES: Record<string, string[]>;
|