@wordpress/style-engine 2.32.0 → 2.32.1-next.47f435fc9.0
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/build/index.js +62 -69
- package/build/index.js.map +7 -1
- package/build/styles/background/index.js +76 -34
- package/build/styles/background/index.js.map +7 -1
- package/build/styles/border/index.js +61 -48
- package/build/styles/border/index.js.map +7 -1
- package/build/styles/color/background.js +31 -13
- package/build/styles/color/background.js.map +7 -1
- package/build/styles/color/gradient.js +31 -13
- package/build/styles/color/gradient.js.map +7 -1
- package/build/styles/color/index.js +36 -13
- package/build/styles/color/index.js.map +7 -1
- package/build/styles/color/text.js +26 -13
- package/build/styles/color/text.js.map +7 -1
- package/build/styles/constants.js +33 -8
- package/build/styles/constants.js.map +7 -1
- package/build/styles/dimensions/index.js +38 -15
- package/build/styles/dimensions/index.js.map +7 -1
- package/build/styles/index.js +54 -19
- package/build/styles/index.js.map +7 -1
- package/build/styles/outline/index.js +36 -23
- package/build/styles/outline/index.js.map +7 -1
- package/build/styles/shadow/index.js +26 -13
- package/build/styles/shadow/index.js.map +7 -1
- package/build/styles/spacing/index.js +35 -12
- package/build/styles/spacing/index.js.map +7 -1
- package/build/styles/spacing/margin.js +28 -15
- package/build/styles/spacing/margin.js.map +7 -1
- package/build/styles/spacing/padding.js +28 -15
- package/build/styles/spacing/padding.js.map +7 -1
- package/build/styles/typography/index.js +105 -31
- package/build/styles/typography/index.js.map +7 -1
- package/build/styles/utils.js +90 -132
- package/build/styles/utils.js.map +7 -1
- package/build/types.js +16 -5
- package/build/types.js.map +7 -1
- package/build-module/index.js +40 -61
- package/build-module/index.js.map +7 -1
- package/build-module/styles/background/index.js +58 -30
- package/build-module/styles/background/index.js.map +7 -1
- package/build-module/styles/border/index.js +42 -44
- package/build-module/styles/border/index.js.map +7 -1
- package/build-module/styles/color/background.js +13 -9
- package/build-module/styles/color/background.js.map +7 -1
- package/build-module/styles/color/gradient.js +13 -9
- package/build-module/styles/color/gradient.js.map +7 -1
- package/build-module/styles/color/index.js +8 -8
- package/build-module/styles/color/index.js.map +7 -1
- package/build-module/styles/color/text.js +8 -9
- package/build-module/styles/color/text.js.map +7 -1
- package/build-module/styles/constants.js +9 -4
- package/build-module/styles/constants.js.map +7 -1
- package/build-module/styles/dimensions/index.js +20 -11
- package/build-module/styles/dimensions/index.js.map +7 -1
- package/build-module/styles/index.js +22 -13
- package/build-module/styles/index.js.map +7 -1
- package/build-module/styles/outline/index.js +14 -15
- package/build-module/styles/outline/index.js.map +7 -1
- package/build-module/styles/shadow/index.js +8 -9
- package/build-module/styles/shadow/index.js.map +7 -1
- package/build-module/styles/spacing/index.js +7 -7
- package/build-module/styles/spacing/index.js.map +7 -1
- package/build-module/styles/spacing/margin.js +10 -11
- package/build-module/styles/spacing/margin.js.map +7 -1
- package/build-module/styles/spacing/padding.js +10 -11
- package/build-module/styles/spacing/padding.js.map +7 -1
- package/build-module/styles/typography/index.js +87 -27
- package/build-module/styles/typography/index.js.map +7 -1
- package/build-module/styles/utils.js +72 -128
- package/build-module/styles/utils.js.map +7 -1
- package/build-module/types.js +1 -2
- package/build-module/types.js.map +7 -1
- package/package.json +10 -3
|
@@ -1,22 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var padding_exports = {};
|
|
20
|
+
__export(padding_exports, {
|
|
21
|
+
default: () => padding_default
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
23
|
+
module.exports = __toCommonJS(padding_exports);
|
|
24
|
+
var import_utils = require("../utils");
|
|
12
25
|
const padding = {
|
|
13
|
-
name:
|
|
26
|
+
name: "padding",
|
|
14
27
|
generate: (style, options) => {
|
|
15
|
-
return (0,
|
|
16
|
-
default:
|
|
17
|
-
individual:
|
|
28
|
+
return (0, import_utils.generateBoxRules)(style, options, ["spacing", "padding"], {
|
|
29
|
+
default: "padding",
|
|
30
|
+
individual: "padding%s"
|
|
18
31
|
});
|
|
19
32
|
}
|
|
20
33
|
};
|
|
21
|
-
var
|
|
22
|
-
//# sourceMappingURL=padding.js.map
|
|
34
|
+
var padding_default = padding;
|
|
35
|
+
//# sourceMappingURL=padding.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/styles/spacing/padding.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateBoxRules } from '../utils';\n\nconst padding = {\n\tname: 'padding',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateBoxRules( style, options, [ 'spacing', 'padding' ], {\n\t\t\tdefault: 'padding',\n\t\t\tindividual: 'padding%s',\n\t\t} );\n\t},\n};\n\nexport default padding;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAAiC;AAEjC,MAAM,UAAU;AAAA,EACf,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO,+BAAkB,OAAO,SAAS,CAAE,WAAW,SAAU,GAAG;AAAA,MAClE,SAAS;AAAA,MACT,YAAY;AAAA,IACb,CAAE;AAAA,EACH;AACD;AAEA,IAAO,kBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,73 +1,147 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var typography_exports = {};
|
|
20
|
+
__export(typography_exports, {
|
|
21
|
+
default: () => typography_default
|
|
5
22
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
/**
|
|
9
|
-
* Internal dependencies
|
|
10
|
-
*/
|
|
11
|
-
|
|
23
|
+
module.exports = __toCommonJS(typography_exports);
|
|
24
|
+
var import_utils = require("../utils");
|
|
12
25
|
const fontSize = {
|
|
13
|
-
name:
|
|
26
|
+
name: "fontSize",
|
|
14
27
|
generate: (style, options) => {
|
|
15
|
-
return (0,
|
|
28
|
+
return (0, import_utils.generateRule)(
|
|
29
|
+
style,
|
|
30
|
+
options,
|
|
31
|
+
["typography", "fontSize"],
|
|
32
|
+
"fontSize"
|
|
33
|
+
);
|
|
16
34
|
}
|
|
17
35
|
};
|
|
18
36
|
const fontStyle = {
|
|
19
|
-
name:
|
|
37
|
+
name: "fontStyle",
|
|
20
38
|
generate: (style, options) => {
|
|
21
|
-
return (0,
|
|
39
|
+
return (0, import_utils.generateRule)(
|
|
40
|
+
style,
|
|
41
|
+
options,
|
|
42
|
+
["typography", "fontStyle"],
|
|
43
|
+
"fontStyle"
|
|
44
|
+
);
|
|
22
45
|
}
|
|
23
46
|
};
|
|
24
47
|
const fontWeight = {
|
|
25
|
-
name:
|
|
48
|
+
name: "fontWeight",
|
|
26
49
|
generate: (style, options) => {
|
|
27
|
-
return (0,
|
|
50
|
+
return (0, import_utils.generateRule)(
|
|
51
|
+
style,
|
|
52
|
+
options,
|
|
53
|
+
["typography", "fontWeight"],
|
|
54
|
+
"fontWeight"
|
|
55
|
+
);
|
|
28
56
|
}
|
|
29
57
|
};
|
|
30
58
|
const fontFamily = {
|
|
31
|
-
name:
|
|
59
|
+
name: "fontFamily",
|
|
32
60
|
generate: (style, options) => {
|
|
33
|
-
return (0,
|
|
61
|
+
return (0, import_utils.generateRule)(
|
|
62
|
+
style,
|
|
63
|
+
options,
|
|
64
|
+
["typography", "fontFamily"],
|
|
65
|
+
"fontFamily"
|
|
66
|
+
);
|
|
34
67
|
}
|
|
35
68
|
};
|
|
36
69
|
const letterSpacing = {
|
|
37
|
-
name:
|
|
70
|
+
name: "letterSpacing",
|
|
38
71
|
generate: (style, options) => {
|
|
39
|
-
return (0,
|
|
72
|
+
return (0, import_utils.generateRule)(
|
|
73
|
+
style,
|
|
74
|
+
options,
|
|
75
|
+
["typography", "letterSpacing"],
|
|
76
|
+
"letterSpacing"
|
|
77
|
+
);
|
|
40
78
|
}
|
|
41
79
|
};
|
|
42
80
|
const lineHeight = {
|
|
43
|
-
name:
|
|
81
|
+
name: "lineHeight",
|
|
44
82
|
generate: (style, options) => {
|
|
45
|
-
return (0,
|
|
83
|
+
return (0, import_utils.generateRule)(
|
|
84
|
+
style,
|
|
85
|
+
options,
|
|
86
|
+
["typography", "lineHeight"],
|
|
87
|
+
"lineHeight"
|
|
88
|
+
);
|
|
46
89
|
}
|
|
47
90
|
};
|
|
48
91
|
const textColumns = {
|
|
49
|
-
name:
|
|
92
|
+
name: "textColumns",
|
|
50
93
|
generate: (style, options) => {
|
|
51
|
-
return (0,
|
|
94
|
+
return (0, import_utils.generateRule)(
|
|
95
|
+
style,
|
|
96
|
+
options,
|
|
97
|
+
["typography", "textColumns"],
|
|
98
|
+
"columnCount"
|
|
99
|
+
);
|
|
52
100
|
}
|
|
53
101
|
};
|
|
54
102
|
const textDecoration = {
|
|
55
|
-
name:
|
|
103
|
+
name: "textDecoration",
|
|
56
104
|
generate: (style, options) => {
|
|
57
|
-
return (0,
|
|
105
|
+
return (0, import_utils.generateRule)(
|
|
106
|
+
style,
|
|
107
|
+
options,
|
|
108
|
+
["typography", "textDecoration"],
|
|
109
|
+
"textDecoration"
|
|
110
|
+
);
|
|
58
111
|
}
|
|
59
112
|
};
|
|
60
113
|
const textTransform = {
|
|
61
|
-
name:
|
|
114
|
+
name: "textTransform",
|
|
62
115
|
generate: (style, options) => {
|
|
63
|
-
return (0,
|
|
116
|
+
return (0, import_utils.generateRule)(
|
|
117
|
+
style,
|
|
118
|
+
options,
|
|
119
|
+
["typography", "textTransform"],
|
|
120
|
+
"textTransform"
|
|
121
|
+
);
|
|
64
122
|
}
|
|
65
123
|
};
|
|
66
124
|
const writingMode = {
|
|
67
|
-
name:
|
|
125
|
+
name: "writingMode",
|
|
68
126
|
generate: (style, options) => {
|
|
69
|
-
return (0,
|
|
127
|
+
return (0, import_utils.generateRule)(
|
|
128
|
+
style,
|
|
129
|
+
options,
|
|
130
|
+
["typography", "writingMode"],
|
|
131
|
+
"writingMode"
|
|
132
|
+
);
|
|
70
133
|
}
|
|
71
134
|
};
|
|
72
|
-
var
|
|
73
|
-
|
|
135
|
+
var typography_default = [
|
|
136
|
+
fontFamily,
|
|
137
|
+
fontSize,
|
|
138
|
+
fontStyle,
|
|
139
|
+
fontWeight,
|
|
140
|
+
letterSpacing,
|
|
141
|
+
lineHeight,
|
|
142
|
+
textColumns,
|
|
143
|
+
textDecoration,
|
|
144
|
+
textTransform,
|
|
145
|
+
writingMode
|
|
146
|
+
];
|
|
147
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/styles/typography/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Internal dependencies\n */\nimport type { Style, StyleOptions } from '../../types';\nimport { generateRule } from '../utils';\n\nconst fontSize = {\n\tname: 'fontSize',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontSize' ],\n\t\t\t'fontSize'\n\t\t);\n\t},\n};\n\nconst fontStyle = {\n\tname: 'fontStyle',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontStyle' ],\n\t\t\t'fontStyle'\n\t\t);\n\t},\n};\n\nconst fontWeight = {\n\tname: 'fontWeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontWeight' ],\n\t\t\t'fontWeight'\n\t\t);\n\t},\n};\n\nconst fontFamily = {\n\tname: 'fontFamily',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'fontFamily' ],\n\t\t\t'fontFamily'\n\t\t);\n\t},\n};\n\nconst letterSpacing = {\n\tname: 'letterSpacing',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'letterSpacing' ],\n\t\t\t'letterSpacing'\n\t\t);\n\t},\n};\n\nconst lineHeight = {\n\tname: 'lineHeight',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'lineHeight' ],\n\t\t\t'lineHeight'\n\t\t);\n\t},\n};\n\nconst textColumns = {\n\tname: 'textColumns',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textColumns' ],\n\t\t\t'columnCount'\n\t\t);\n\t},\n};\n\nconst textDecoration = {\n\tname: 'textDecoration',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textDecoration' ],\n\t\t\t'textDecoration'\n\t\t);\n\t},\n};\n\nconst textTransform = {\n\tname: 'textTransform',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'textTransform' ],\n\t\t\t'textTransform'\n\t\t);\n\t},\n};\n\nconst writingMode = {\n\tname: 'writingMode',\n\tgenerate: ( style: Style, options: StyleOptions ) => {\n\t\treturn generateRule(\n\t\t\tstyle,\n\t\t\toptions,\n\t\t\t[ 'typography', 'writingMode' ],\n\t\t\t'writingMode'\n\t\t);\n\t},\n};\n\nexport default [\n\tfontFamily,\n\tfontSize,\n\tfontStyle,\n\tfontWeight,\n\tletterSpacing,\n\tlineHeight,\n\ttextColumns,\n\ttextDecoration,\n\ttextTransform,\n\twritingMode,\n];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,mBAA6B;AAE7B,MAAM,WAAW;AAAA,EAChB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,UAAW;AAAA,MAC3B;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,YAAY;AAAA,EACjB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,WAAY;AAAA,MAC5B;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,YAAa;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,YAAa;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,gBAAgB;AAAA,EACrB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,eAAgB;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,aAAa;AAAA,EAClB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,YAAa;AAAA,MAC7B;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,cAAc;AAAA,EACnB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,aAAc;AAAA,MAC9B;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,gBAAiB;AAAA,MACjC;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,gBAAgB;AAAA,EACrB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,eAAgB;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AACD;AAEA,MAAM,cAAc;AAAA,EACnB,MAAM;AAAA,EACN,UAAU,CAAE,OAAc,YAA2B;AACpD,eAAO;AAAA,MACN;AAAA,MACA;AAAA,MACA,CAAE,cAAc,aAAc;AAAA,MAC9B;AAAA,IACD;AAAA,EACD;AACD;AAEA,IAAO,qBAAQ;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/build/styles/utils.js
CHANGED
|
@@ -1,170 +1,118 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
camelCaseJoin: () => camelCaseJoin,
|
|
22
|
+
generateBoxRules: () => generateBoxRules,
|
|
23
|
+
generateRule: () => generateRule,
|
|
24
|
+
getCSSValueFromRawStyle: () => getCSSValueFromRawStyle,
|
|
25
|
+
getStyleValueByPath: () => getStyleValueByPath,
|
|
26
|
+
safeDecodeURI: () => safeDecodeURI,
|
|
27
|
+
upperFirst: () => upperFirst
|
|
5
28
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
exports.getCSSValueFromRawStyle = getCSSValueFromRawStyle;
|
|
10
|
-
exports.getStyleValueByPath = void 0;
|
|
11
|
-
exports.safeDecodeURI = safeDecodeURI;
|
|
12
|
-
exports.upperFirst = upperFirst;
|
|
13
|
-
var _changeCase = require("change-case");
|
|
14
|
-
var _constants = require("./constants");
|
|
15
|
-
/**
|
|
16
|
-
* External dependencies
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Internal dependencies
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Helper util to return a value from a certain path of the object.
|
|
25
|
-
* Path is specified as an array of properties, like `[ 'x', 'y' ]`.
|
|
26
|
-
*
|
|
27
|
-
* @param object Input object.
|
|
28
|
-
* @param path Path to the object property.
|
|
29
|
-
* @return Value of the object property at the specified path.
|
|
30
|
-
*/
|
|
29
|
+
module.exports = __toCommonJS(utils_exports);
|
|
30
|
+
var import_change_case = require("change-case");
|
|
31
|
+
var import_constants = require("./constants");
|
|
31
32
|
const getStyleValueByPath = (object, path) => {
|
|
32
33
|
let value = object;
|
|
33
|
-
path.forEach(fieldName => {
|
|
34
|
+
path.forEach((fieldName) => {
|
|
34
35
|
value = value?.[fieldName];
|
|
35
36
|
});
|
|
36
37
|
return value;
|
|
37
38
|
};
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Returns a JSON representation of the generated CSS rules.
|
|
41
|
-
*
|
|
42
|
-
* @param style Style object.
|
|
43
|
-
* @param options Options object with settings to adjust how the styles are generated.
|
|
44
|
-
* @param path An array of strings representing the path to the style value in the style object.
|
|
45
|
-
* @param ruleKey A CSS property key.
|
|
46
|
-
*
|
|
47
|
-
* @return GeneratedCSSRule[] CSS rules.
|
|
48
|
-
*/
|
|
49
|
-
exports.getStyleValueByPath = getStyleValueByPath;
|
|
50
39
|
function generateRule(style, options, path, ruleKey) {
|
|
51
40
|
const styleValue = getStyleValueByPath(style, path);
|
|
52
|
-
return styleValue ? [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
41
|
+
return styleValue ? [
|
|
42
|
+
{
|
|
43
|
+
selector: options?.selector,
|
|
44
|
+
key: ruleKey,
|
|
45
|
+
value: getCSSValueFromRawStyle(styleValue)
|
|
46
|
+
}
|
|
47
|
+
] : [];
|
|
57
48
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
* @param options Options object with settings to adjust how the styles are generated.
|
|
64
|
-
* @param path An array of strings representing the path to the style value in the style object.
|
|
65
|
-
* @param ruleKeys An array of CSS property keys and patterns.
|
|
66
|
-
* @param individualProperties The "sides" or individual properties for which to generate rules.
|
|
67
|
-
*
|
|
68
|
-
* @return GeneratedCSSRule[] CSS rules.
|
|
69
|
-
*/
|
|
70
|
-
function generateBoxRules(style, options, path, ruleKeys, individualProperties = ['top', 'right', 'bottom', 'left']) {
|
|
71
|
-
const boxStyle = getStyleValueByPath(style, path);
|
|
49
|
+
function generateBoxRules(style, options, path, ruleKeys, individualProperties = ["top", "right", "bottom", "left"]) {
|
|
50
|
+
const boxStyle = getStyleValueByPath(
|
|
51
|
+
style,
|
|
52
|
+
path
|
|
53
|
+
);
|
|
72
54
|
if (!boxStyle) {
|
|
73
55
|
return [];
|
|
74
56
|
}
|
|
75
57
|
const rules = [];
|
|
76
|
-
if (typeof boxStyle ===
|
|
58
|
+
if (typeof boxStyle === "string") {
|
|
77
59
|
rules.push({
|
|
78
60
|
selector: options?.selector,
|
|
79
61
|
key: ruleKeys.default,
|
|
80
62
|
value: getCSSValueFromRawStyle(boxStyle)
|
|
81
63
|
});
|
|
82
64
|
} else {
|
|
83
|
-
const sideRules = individualProperties.reduce(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
65
|
+
const sideRules = individualProperties.reduce(
|
|
66
|
+
(acc, side) => {
|
|
67
|
+
const value = getCSSValueFromRawStyle(
|
|
68
|
+
getStyleValueByPath(boxStyle, [side])
|
|
69
|
+
);
|
|
70
|
+
if (value) {
|
|
71
|
+
acc.push({
|
|
72
|
+
selector: options?.selector,
|
|
73
|
+
key: ruleKeys?.individual.replace(
|
|
74
|
+
"%s",
|
|
75
|
+
upperFirst(side)
|
|
76
|
+
),
|
|
77
|
+
value
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return acc;
|
|
81
|
+
},
|
|
82
|
+
[]
|
|
83
|
+
);
|
|
94
84
|
rules.push(...sideRules);
|
|
95
85
|
}
|
|
96
86
|
return rules;
|
|
97
87
|
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Returns a WordPress CSS custom var value from incoming style preset value,
|
|
101
|
-
* if one is detected.
|
|
102
|
-
*
|
|
103
|
-
* The preset value is a string and follows the pattern `var:description|context|slug`.
|
|
104
|
-
*
|
|
105
|
-
* Example:
|
|
106
|
-
*
|
|
107
|
-
* `getCSSValueFromRawStyle( 'var:preset|color|heavenlyBlue' )` // returns 'var(--wp--preset--color--heavenly-blue)'
|
|
108
|
-
*
|
|
109
|
-
* @param styleValue A string representing a raw CSS value. Non-strings won't be processed.
|
|
110
|
-
*
|
|
111
|
-
* @return A CSS custom var value if the incoming style value is a preset value.
|
|
112
|
-
*/
|
|
113
|
-
|
|
114
88
|
function getCSSValueFromRawStyle(styleValue) {
|
|
115
|
-
if (typeof styleValue ===
|
|
116
|
-
const variable = styleValue.slice(
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
89
|
+
if (typeof styleValue === "string" && styleValue.startsWith(import_constants.VARIABLE_REFERENCE_PREFIX)) {
|
|
90
|
+
const variable = styleValue.slice(import_constants.VARIABLE_REFERENCE_PREFIX.length).split(import_constants.VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE).map(
|
|
91
|
+
(presetVariable) => (0, import_change_case.paramCase)(presetVariable, {
|
|
92
|
+
splitRegexp: [
|
|
93
|
+
/([a-z0-9])([A-Z])/g,
|
|
94
|
+
// fooBar => foo-bar, 3Bar => 3-bar
|
|
95
|
+
/([0-9])([a-z])/g,
|
|
96
|
+
// 3bar => 3-bar
|
|
97
|
+
/([A-Za-z])([0-9])/g,
|
|
98
|
+
// Foo3 => foo-3, foo3 => foo-3
|
|
99
|
+
/([A-Z])([A-Z][a-z])/g
|
|
100
|
+
// FOOBar => foo-bar
|
|
101
|
+
]
|
|
102
|
+
})
|
|
103
|
+
).join(import_constants.VARIABLE_PATH_SEPARATOR_TOKEN_STYLE);
|
|
126
104
|
return `var(--wp--${variable})`;
|
|
127
105
|
}
|
|
128
106
|
return styleValue;
|
|
129
107
|
}
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Capitalizes the first letter in a string.
|
|
133
|
-
*
|
|
134
|
-
* @param string The string whose first letter the function will capitalize.
|
|
135
|
-
*
|
|
136
|
-
* @return String with the first letter capitalized.
|
|
137
|
-
*/
|
|
138
108
|
function upperFirst(string) {
|
|
139
109
|
const [firstLetter, ...rest] = string;
|
|
140
|
-
return firstLetter.toUpperCase() + rest.join(
|
|
110
|
+
return firstLetter.toUpperCase() + rest.join("");
|
|
141
111
|
}
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* Converts an array of strings into a camelCase string.
|
|
145
|
-
*
|
|
146
|
-
* @param strings The strings to join into a camelCase string.
|
|
147
|
-
*
|
|
148
|
-
* @return camelCase string.
|
|
149
|
-
*/
|
|
150
112
|
function camelCaseJoin(strings) {
|
|
151
113
|
const [firstItem, ...rest] = strings;
|
|
152
|
-
return firstItem.toLowerCase() + rest.map(upperFirst).join(
|
|
114
|
+
return firstItem.toLowerCase() + rest.map(upperFirst).join("");
|
|
153
115
|
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Safely decodes a URI with `decodeURI`. Returns the URI unmodified if
|
|
157
|
-
* `decodeURI` throws an error.
|
|
158
|
-
*
|
|
159
|
-
* @param {string} uri URI to decode.
|
|
160
|
-
*
|
|
161
|
-
* @example
|
|
162
|
-
* ```js
|
|
163
|
-
* const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z'
|
|
164
|
-
* ```
|
|
165
|
-
*
|
|
166
|
-
* @return {string} Decoded URI if possible.
|
|
167
|
-
*/
|
|
168
116
|
function safeDecodeURI(uri) {
|
|
169
117
|
try {
|
|
170
118
|
return decodeURI(uri);
|
|
@@ -172,4 +120,14 @@ function safeDecodeURI(uri) {
|
|
|
172
120
|
return uri;
|
|
173
121
|
}
|
|
174
122
|
}
|
|
175
|
-
|
|
123
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
124
|
+
0 && (module.exports = {
|
|
125
|
+
camelCaseJoin,
|
|
126
|
+
generateBoxRules,
|
|
127
|
+
generateRule,
|
|
128
|
+
getCSSValueFromRawStyle,
|
|
129
|
+
getStyleValueByPath,
|
|
130
|
+
safeDecodeURI,
|
|
131
|
+
upperFirst
|
|
132
|
+
});
|
|
133
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/styles/utils.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\n\n/**\n * Internal dependencies\n */\nimport type {\n\tCssRulesKeys,\n\tGeneratedCSSRule,\n\tStyle,\n\tBox,\n\tStyleOptions,\n} from '../types';\nimport {\n\tVARIABLE_REFERENCE_PREFIX,\n\tVARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE,\n\tVARIABLE_PATH_SEPARATOR_TOKEN_STYLE,\n} from './constants';\n\n/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as an array of properties, like `[ 'x', 'y' ]`.\n *\n * @param object Input object.\n * @param path Path to the object property.\n * @return Value of the object property at the specified path.\n */\nexport const getStyleValueByPath = (\n\tobject: Record< any, any >,\n\tpath: string[]\n) => {\n\tlet value: any = object;\n\tpath.forEach( ( fieldName: string ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\n/**\n * Returns a JSON representation of the generated CSS rules.\n *\n * @param style Style object.\n * @param options Options object with settings to adjust how the styles are generated.\n * @param path An array of strings representing the path to the style value in the style object.\n * @param ruleKey A CSS property key.\n *\n * @return GeneratedCSSRule[] CSS rules.\n */\nexport function generateRule(\n\tstyle: Style,\n\toptions: StyleOptions,\n\tpath: string[],\n\truleKey: string\n): GeneratedCSSRule[] {\n\tconst styleValue: string | undefined = getStyleValueByPath( style, path );\n\n\treturn styleValue\n\t\t? [\n\t\t\t\t{\n\t\t\t\t\tselector: options?.selector,\n\t\t\t\t\tkey: ruleKey,\n\t\t\t\t\tvalue: getCSSValueFromRawStyle( styleValue ),\n\t\t\t\t},\n\t\t ]\n\t\t: [];\n}\n\n/**\n * Returns a JSON representation of the generated CSS rules taking into account box model properties, top, right, bottom, left.\n *\n * @param style Style object.\n * @param options Options object with settings to adjust how the styles are generated.\n * @param path An array of strings representing the path to the style value in the style object.\n * @param ruleKeys An array of CSS property keys and patterns.\n * @param individualProperties The \"sides\" or individual properties for which to generate rules.\n *\n * @return GeneratedCSSRule[] CSS rules.\n */\nexport function generateBoxRules(\n\tstyle: Style,\n\toptions: StyleOptions,\n\tpath: string[],\n\truleKeys: CssRulesKeys,\n\tindividualProperties: string[] = [ 'top', 'right', 'bottom', 'left' ]\n): GeneratedCSSRule[] {\n\tconst boxStyle: Box | string | undefined = getStyleValueByPath(\n\t\tstyle,\n\t\tpath\n\t);\n\tif ( ! boxStyle ) {\n\t\treturn [];\n\t}\n\n\tconst rules: GeneratedCSSRule[] = [];\n\tif ( typeof boxStyle === 'string' ) {\n\t\trules.push( {\n\t\t\tselector: options?.selector,\n\t\t\tkey: ruleKeys.default,\n\t\t\tvalue: getCSSValueFromRawStyle( boxStyle ),\n\t\t} );\n\t} else {\n\t\tconst sideRules = individualProperties.reduce(\n\t\t\t( acc: GeneratedCSSRule[], side: string ) => {\n\t\t\t\tconst value = getCSSValueFromRawStyle(\n\t\t\t\t\tgetStyleValueByPath( boxStyle, [ side ] )\n\t\t\t\t);\n\t\t\t\tif ( value ) {\n\t\t\t\t\tacc.push( {\n\t\t\t\t\t\tselector: options?.selector,\n\t\t\t\t\t\tkey: ruleKeys?.individual.replace(\n\t\t\t\t\t\t\t'%s',\n\t\t\t\t\t\t\tupperFirst( side )\n\t\t\t\t\t\t),\n\t\t\t\t\t\tvalue,\n\t\t\t\t\t} );\n\t\t\t\t}\n\t\t\t\treturn acc;\n\t\t\t},\n\t\t\t[]\n\t\t);\n\t\trules.push( ...sideRules );\n\t}\n\n\treturn rules;\n}\n\n/**\n * Returns a WordPress CSS custom var value from incoming style preset value,\n * if one is detected.\n *\n * The preset value is a string and follows the pattern `var:description|context|slug`.\n *\n * Example:\n *\n * `getCSSValueFromRawStyle( 'var:preset|color|heavenlyBlue' )` // returns 'var(--wp--preset--color--heavenly-blue)'\n *\n * @param styleValue A string representing a raw CSS value. Non-strings won't be processed.\n *\n * @return A CSS custom var value if the incoming style value is a preset value.\n */\n\nexport function getCSSValueFromRawStyle< StyleValue = string >(\n\tstyleValue: StyleValue\n): StyleValue {\n\tif (\n\t\ttypeof styleValue === 'string' &&\n\t\tstyleValue.startsWith( VARIABLE_REFERENCE_PREFIX )\n\t) {\n\t\tconst variable = styleValue\n\t\t\t.slice( VARIABLE_REFERENCE_PREFIX.length )\n\t\t\t.split( VARIABLE_PATH_SEPARATOR_TOKEN_ATTRIBUTE )\n\t\t\t.map( ( presetVariable ) =>\n\t\t\t\tkebabCase( presetVariable, {\n\t\t\t\t\tsplitRegexp: [\n\t\t\t\t\t\t/([a-z0-9])([A-Z])/g, // fooBar => foo-bar, 3Bar => 3-bar\n\t\t\t\t\t\t/([0-9])([a-z])/g, // 3bar => 3-bar\n\t\t\t\t\t\t/([A-Za-z])([0-9])/g, // Foo3 => foo-3, foo3 => foo-3\n\t\t\t\t\t\t/([A-Z])([A-Z][a-z])/g, // FOOBar => foo-bar\n\t\t\t\t\t],\n\t\t\t\t} )\n\t\t\t)\n\t\t\t.join( VARIABLE_PATH_SEPARATOR_TOKEN_STYLE );\n\t\treturn `var(--wp--${ variable })` as StyleValue;\n\t}\n\treturn styleValue;\n}\n\n/**\n * Capitalizes the first letter in a string.\n *\n * @param string The string whose first letter the function will capitalize.\n *\n * @return String with the first letter capitalized.\n */\nexport function upperFirst( string: string ): string {\n\tconst [ firstLetter, ...rest ] = string;\n\treturn firstLetter.toUpperCase() + rest.join( '' );\n}\n\n/**\n * Converts an array of strings into a camelCase string.\n *\n * @param strings The strings to join into a camelCase string.\n *\n * @return camelCase string.\n */\nexport function camelCaseJoin( strings: string[] ): string {\n\tconst [ firstItem, ...rest ] = strings;\n\treturn firstItem.toLowerCase() + rest.map( upperFirst ).join( '' );\n}\n\n/**\n * Safely decodes a URI with `decodeURI`. Returns the URI unmodified if\n * `decodeURI` throws an error.\n *\n * @param {string} uri URI to decode.\n *\n * @example\n * ```js\n * const badUri = safeDecodeURI( '%z' ); // does not throw an Error, simply returns '%z'\n * ```\n *\n * @return {string} Decoded URI if possible.\n */\nexport function safeDecodeURI( uri: string ): string {\n\ttry {\n\t\treturn decodeURI( uri );\n\t} catch ( uriError ) {\n\t\treturn uri;\n\t}\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,yBAAuC;AAYvC,uBAIO;AAUA,MAAM,sBAAsB,CAClC,QACA,SACI;AACJ,MAAI,QAAa;AACjB,OAAK,QAAS,CAAE,cAAuB;AACtC,YAAQ,QAAS,SAAU;AAAA,EAC5B,CAAE;AACF,SAAO;AACR;AAYO,SAAS,aACf,OACA,SACA,MACA,SACqB;AACrB,QAAM,aAAiC,oBAAqB,OAAO,IAAK;AAExE,SAAO,aACJ;AAAA,IACA;AAAA,MACC,UAAU,SAAS;AAAA,MACnB,KAAK;AAAA,MACL,OAAO,wBAAyB,UAAW;AAAA,IAC5C;AAAA,EACA,IACA,CAAC;AACL;AAaO,SAAS,iBACf,OACA,SACA,MACA,UACA,uBAAiC,CAAE,OAAO,SAAS,UAAU,MAAO,GAC/C;AACrB,QAAM,WAAqC;AAAA,IAC1C;AAAA,IACA;AAAA,EACD;AACA,MAAK,CAAE,UAAW;AACjB,WAAO,CAAC;AAAA,EACT;AAEA,QAAM,QAA4B,CAAC;AACnC,MAAK,OAAO,aAAa,UAAW;AACnC,UAAM,KAAM;AAAA,MACX,UAAU,SAAS;AAAA,MACnB,KAAK,SAAS;AAAA,MACd,OAAO,wBAAyB,QAAS;AAAA,IAC1C,CAAE;AAAA,EACH,OAAO;AACN,UAAM,YAAY,qBAAqB;AAAA,MACtC,CAAE,KAAyB,SAAkB;AAC5C,cAAM,QAAQ;AAAA,UACb,oBAAqB,UAAU,CAAE,IAAK,CAAE;AAAA,QACzC;AACA,YAAK,OAAQ;AACZ,cAAI,KAAM;AAAA,YACT,UAAU,SAAS;AAAA,YACnB,KAAK,UAAU,WAAW;AAAA,cACzB;AAAA,cACA,WAAY,IAAK;AAAA,YAClB;AAAA,YACA;AAAA,UACD,CAAE;AAAA,QACH;AACA,eAAO;AAAA,MACR;AAAA,MACA,CAAC;AAAA,IACF;AACA,UAAM,KAAM,GAAG,SAAU;AAAA,EAC1B;AAEA,SAAO;AACR;AAiBO,SAAS,wBACf,YACa;AACb,MACC,OAAO,eAAe,YACtB,WAAW,WAAY,0CAA0B,GAChD;AACD,UAAM,WAAW,WACf,MAAO,2CAA0B,MAAO,EACxC,MAAO,wDAAwC,EAC/C;AAAA,MAAK,CAAE,uBACP,mBAAAA,WAAW,gBAAgB;AAAA,QAC1B,aAAa;AAAA,UACZ;AAAA;AAAA,UACA;AAAA;AAAA,UACA;AAAA;AAAA,UACA;AAAA;AAAA,QACD;AAAA,MACD,CAAE;AAAA,IACH,EACC,KAAM,oDAAoC;AAC5C,WAAO,aAAc,QAAS;AAAA,EAC/B;AACA,SAAO;AACR;AASO,SAAS,WAAY,QAAyB;AACpD,QAAM,CAAE,aAAa,GAAG,IAAK,IAAI;AACjC,SAAO,YAAY,YAAY,IAAI,KAAK,KAAM,EAAG;AAClD;AASO,SAAS,cAAe,SAA4B;AAC1D,QAAM,CAAE,WAAW,GAAG,IAAK,IAAI;AAC/B,SAAO,UAAU,YAAY,IAAI,KAAK,IAAK,UAAW,EAAE,KAAM,EAAG;AAClE;AAeO,SAAS,cAAe,KAAsB;AACpD,MAAI;AACH,WAAO,UAAW,GAAI;AAAA,EACvB,SAAU,UAAW;AACpB,WAAO;AAAA,EACR;AACD;",
|
|
6
|
+
"names": ["kebabCase"]
|
|
7
|
+
}
|
package/build/types.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
package/build/types.js.map
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport type { CSSProperties } from 'react';\n\ntype BoxVariant = 'margin' | 'padding';\nexport interface Box< T extends BoxVariant | undefined = undefined > {\n\ttop?: CSSProperties[ T extends undefined ? 'top' : `${ T }Top` ];\n\tright?: CSSProperties[ T extends undefined ? 'right' : `${ T }Right` ];\n\tbottom?: CSSProperties[ T extends undefined ? 'bottom' : `${ T }Bottom` ];\n\tleft?: CSSProperties[ T extends undefined ? 'left' : `${ T }Left` ];\n}\n\nexport type BoxEdge = 'top' | 'right' | 'bottom' | 'left';\n\n// `T` is one of the values in `BorderIndividualProperty`. The expected CSSProperties key is something like `borderTopColor`.\nexport interface BorderIndividualStyles< T extends BoxEdge > {\n\tcolor?: CSSProperties[ `border${ Capitalize< T > }Color` ];\n\tstyle?: CSSProperties[ `border${ Capitalize< T > }Style` ];\n\twidth?: CSSProperties[ `border${ Capitalize< T > }Width` ];\n}\n\nexport interface Style {\n\tbackground?: {\n\t\tbackgroundImage?:\n\t\t\t| { url?: CSSProperties[ 'backgroundImage' ]; source?: string }\n\t\t\t| CSSProperties[ 'backgroundImage' ];\n\t\tbackgroundPosition?: CSSProperties[ 'backgroundPosition' ];\n\t\tbackgroundRepeat?: CSSProperties[ 'backgroundRepeat' ];\n\t\tbackgroundSize?: CSSProperties[ 'backgroundSize' ];\n\t};\n\tborder?: {\n\t\tcolor?: CSSProperties[ 'borderColor' ];\n\t\tradius?:\n\t\t\t| CSSProperties[ 'borderRadius' ]\n\t\t\t| {\n\t\t\t\t\ttopLeft?: CSSProperties[ 'borderTopLeftRadius' ];\n\t\t\t\t\ttopRight?: CSSProperties[ 'borderTopRightRadius' ];\n\t\t\t\t\tbottomLeft?: CSSProperties[ 'borderBottomLeftRadius' ];\n\t\t\t\t\tbottomRight?: CSSProperties[ 'borderBottomLeftRadius' ];\n\t\t\t };\n\t\tstyle?: CSSProperties[ 'borderStyle' ];\n\t\twidth?: CSSProperties[ 'borderWidth' ];\n\t\ttop?: BorderIndividualStyles< 'top' >;\n\t\tright?: BorderIndividualStyles< 'right' >;\n\t\tbottom?: BorderIndividualStyles< 'bottom' >;\n\t\tleft?: BorderIndividualStyles< 'left' >;\n\t};\n\tdimensions?: {\n\t\taspectRatio?: CSSProperties[ 'aspectRatio' ];\n\t\tminHeight?: CSSProperties[ 'minHeight' ];\n\t};\n\tspacing?: {\n\t\tmargin?: CSSProperties[ 'margin' ] | Box< 'margin' >;\n\t\tpadding?: CSSProperties[ 'padding' ] | Box< 'padding' >;\n\t};\n\ttypography?: {\n\t\tfontSize?: CSSProperties[ 'fontSize' ];\n\t\tfontFamily?: CSSProperties[ 'fontFamily' ];\n\t\tfontWeight?: CSSProperties[ 'fontWeight' ];\n\t\tfontStyle?: CSSProperties[ 'fontStyle' ];\n\t\tletterSpacing?: CSSProperties[ 'letterSpacing' ];\n\t\tlineHeight?: CSSProperties[ 'lineHeight' ];\n\t\ttextColumns?: CSSProperties[ 'columnCount' ];\n\t\ttextDecoration?: CSSProperties[ 'textDecoration' ];\n\t\ttextTransform?: CSSProperties[ 'textTransform' ];\n\t\twritingMode?: CSSProperties[ 'writingMode' ];\n\t};\n\tcolor?: {\n\t\ttext?: CSSProperties[ 'color' ];\n\t\tbackground?: CSSProperties[ 'backgroundColor' ];\n\t\tgradient?: CSSProperties[ 'background' ];\n\t};\n\telements?: {\n\t\tlink?: {\n\t\t\tcolor?: {\n\t\t\t\ttext?: CSSProperties[ 'color' ];\n\t\t\t};\n\t\t};\n\t};\n}\n\nexport interface CssRulesKeys {\n\tdefault: string;\n\tindividual: string;\n}\n\nexport interface StyleOptions {\n\t/**\n\t * CSS selector for the generated style.\n\t */\n\tselector?: string;\n}\n\nexport interface GeneratedCSSRule {\n\tselector?: string;\n\tvalue: string | unknown;\n\t/**\n\t * The CSS key in JS style attribute format, compatible with React.\n\t * E.g. `paddingTop` instead of `padding-top`.\n\t */\n\tkey: string;\n}\n\nexport interface GenerateFunction {\n\t( style: Style, options: StyleOptions ): GeneratedCSSRule[];\n}\n\nexport interface StyleDefinition {\n\tname: string;\n\tgenerate?: GenerateFunction;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|