@webstudio-is/css-data 0.83.0 → 0.85.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/lib/__generated__/keyword-values.js +36 -2
- package/lib/__generated__/properties.js +81 -11
- package/lib/cjs/__generated__/keyword-values.js +36 -2
- package/lib/cjs/__generated__/properties.js +81 -11
- package/lib/cjs/custom-data.js +9 -0
- package/lib/cjs/html.js +353 -308
- package/lib/custom-data.js +9 -0
- package/lib/html.js +353 -308
- package/lib/types/__generated__/keyword-values.d.ts +9 -2
- package/lib/types/__generated__/properties.d.ts +81 -11
- package/lib/types/html.d.ts +8 -0
- package/lib/types/index.d.ts +81 -11
- package/package.json +4 -4
- package/src/__generated__/keyword-values.ts +36 -2
- package/src/__generated__/properties.ts +81 -11
- package/src/custom-data.ts +10 -0
- package/src/html.ts +387 -330
package/src/html.ts
CHANGED
|
@@ -16,69 +16,166 @@ export type Html = {
|
|
|
16
16
|
[tag in HtmlTags]?: Styles;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
const
|
|
19
|
+
const display = (value: string): Styles[number] => ({
|
|
20
20
|
property: "display",
|
|
21
|
-
value: { type: "keyword", value
|
|
22
|
-
};
|
|
21
|
+
value: { type: "keyword", value },
|
|
22
|
+
});
|
|
23
23
|
|
|
24
|
-
const
|
|
24
|
+
const marginTop = (value: number, unit?: "em" | "px"): Styles[number] => ({
|
|
25
25
|
property: "marginTop",
|
|
26
|
-
value: { type: "unit", value
|
|
27
|
-
};
|
|
26
|
+
value: { type: "unit", value, unit: unit ?? "number" },
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const marginRight = (value: number, unit?: "em" | "px"): Styles[number] => ({
|
|
30
|
+
property: "marginRight",
|
|
31
|
+
value: { type: "unit", value, unit: unit ?? "number" },
|
|
32
|
+
});
|
|
28
33
|
|
|
29
|
-
const
|
|
34
|
+
const marginBottom = (value: number, unit?: "em" | "px"): Styles[number] => ({
|
|
30
35
|
property: "marginBottom",
|
|
31
|
-
value: { type: "unit", value
|
|
32
|
-
};
|
|
36
|
+
value: { type: "unit", value, unit: unit ?? "number" },
|
|
37
|
+
});
|
|
33
38
|
|
|
34
|
-
const
|
|
39
|
+
const marginLeft = (value: number, unit?: "em" | "px"): Styles[number] => ({
|
|
35
40
|
property: "marginLeft",
|
|
36
|
-
value: { type: "unit", value
|
|
37
|
-
};
|
|
41
|
+
value: { type: "unit", value, unit: unit ?? "number" },
|
|
42
|
+
});
|
|
38
43
|
|
|
39
|
-
const
|
|
40
|
-
property: "
|
|
41
|
-
value: { type: "unit", value
|
|
42
|
-
};
|
|
44
|
+
const paddingTop = (value: number, unit: "em" | "px"): Styles[number] => ({
|
|
45
|
+
property: "paddingTop",
|
|
46
|
+
value: { type: "unit", value, unit },
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const paddingRight = (value: number, unit: "em" | "px"): Styles[number] => ({
|
|
50
|
+
property: "paddingRight",
|
|
51
|
+
value: { type: "unit", value, unit },
|
|
52
|
+
});
|
|
43
53
|
|
|
44
|
-
const
|
|
54
|
+
const paddingBottom = (value: number, unit: "em" | "px"): Styles[number] => ({
|
|
55
|
+
property: "paddingBottom",
|
|
56
|
+
value: { type: "unit", value, unit },
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const paddingLeft = (value: number, unit: "em" | "px"): Styles[number] => ({
|
|
45
60
|
property: "paddingLeft",
|
|
46
|
-
value: { type: "unit", value
|
|
47
|
-
};
|
|
61
|
+
value: { type: "unit", value, unit },
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const color = (value: string): Styles[number] => ({
|
|
65
|
+
property: "color",
|
|
66
|
+
value: { type: "keyword", value },
|
|
67
|
+
});
|
|
48
68
|
|
|
49
|
-
const
|
|
69
|
+
const fontSize = (value: number, unit: "em"): Styles[number] => ({
|
|
70
|
+
property: "fontSize",
|
|
71
|
+
value: { type: "unit", value, unit },
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const fontWeight = (value: "bold"): Styles[number] => ({
|
|
50
75
|
property: "fontWeight",
|
|
51
|
-
value: { type: "keyword", value
|
|
52
|
-
};
|
|
76
|
+
value: { type: "keyword", value },
|
|
77
|
+
});
|
|
53
78
|
|
|
54
|
-
const
|
|
79
|
+
const fontStyle = (value: "italic"): Styles[number] => ({
|
|
55
80
|
property: "fontStyle",
|
|
56
|
-
value: { type: "keyword", value
|
|
57
|
-
};
|
|
81
|
+
value: { type: "keyword", value },
|
|
82
|
+
});
|
|
58
83
|
|
|
59
|
-
const
|
|
60
|
-
property: "
|
|
61
|
-
value: { type: "
|
|
62
|
-
};
|
|
84
|
+
const textAlign = (value: string): Styles[number] => ({
|
|
85
|
+
property: "textAlign",
|
|
86
|
+
value: { type: "keyword", value },
|
|
87
|
+
});
|
|
63
88
|
|
|
64
|
-
const
|
|
65
|
-
property: "
|
|
66
|
-
value: { type: "
|
|
67
|
-
};
|
|
89
|
+
const verticalAlign = (value: string): Styles[number] => ({
|
|
90
|
+
property: "verticalAlign",
|
|
91
|
+
value: { type: "keyword", value },
|
|
92
|
+
});
|
|
68
93
|
|
|
69
|
-
const
|
|
70
|
-
property: "
|
|
71
|
-
value: { type: "
|
|
72
|
-
};
|
|
94
|
+
const whiteSpace = (value: string): Styles[number] => ({
|
|
95
|
+
property: "whiteSpace",
|
|
96
|
+
value: { type: "keyword", value },
|
|
97
|
+
});
|
|
73
98
|
|
|
74
|
-
const
|
|
75
|
-
property: "
|
|
76
|
-
value: { type: "
|
|
77
|
-
};
|
|
99
|
+
const cursor = (value: string): Styles[number] => ({
|
|
100
|
+
property: "cursor",
|
|
101
|
+
value: { type: "keyword", value },
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const borderWidth = (value: number, unit: "px"): Styles => [
|
|
105
|
+
{
|
|
106
|
+
property: "borderTopWidth",
|
|
107
|
+
value: { type: "unit", value, unit },
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
property: "borderRightWidth",
|
|
111
|
+
value: { type: "unit", value, unit },
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
property: "borderBottomWidth",
|
|
115
|
+
value: { type: "unit", value, unit },
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
property: "borderLeftWidth",
|
|
119
|
+
value: { type: "unit", value, unit },
|
|
120
|
+
},
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
const borderStyle = (value: string): Styles => [
|
|
124
|
+
{
|
|
125
|
+
property: "borderTopStyle",
|
|
126
|
+
value: { type: "keyword", value },
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
property: "borderRightStyle",
|
|
130
|
+
value: { type: "keyword", value },
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
property: "borderBottomStyle",
|
|
134
|
+
value: { type: "keyword", value },
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
property: "borderLeftStyle",
|
|
138
|
+
value: { type: "keyword", value },
|
|
139
|
+
},
|
|
140
|
+
];
|
|
141
|
+
|
|
142
|
+
const borderColor = (value: string): Styles => [
|
|
143
|
+
{
|
|
144
|
+
property: "borderTopColor",
|
|
145
|
+
value: { type: "keyword", value },
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
property: "borderRightColor",
|
|
149
|
+
value: { type: "keyword", value },
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
property: "borderBottomColor",
|
|
153
|
+
value: { type: "keyword", value },
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
property: "borderLeftColor",
|
|
157
|
+
value: { type: "keyword", value },
|
|
158
|
+
},
|
|
159
|
+
];
|
|
160
|
+
|
|
161
|
+
const appearance = (value: string): Styles[number] => ({
|
|
162
|
+
property: "appearance",
|
|
163
|
+
value: { type: "keyword", value },
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const userSelect = (value: string): Styles[number] => ({
|
|
167
|
+
property: "userSelect",
|
|
168
|
+
value: { type: "keyword", value },
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
const boxSizing = (value: string): Styles[number] => ({
|
|
172
|
+
property: "boxSizing",
|
|
173
|
+
value: { type: "keyword", value },
|
|
174
|
+
});
|
|
78
175
|
|
|
79
176
|
/* blocks */
|
|
80
177
|
|
|
81
|
-
export const article: Styles = [
|
|
178
|
+
export const article: Styles = [display("block")];
|
|
82
179
|
export {
|
|
83
180
|
article as aside,
|
|
84
181
|
article as details,
|
|
@@ -97,152 +194,93 @@ export {
|
|
|
97
194
|
};
|
|
98
195
|
|
|
99
196
|
export const body: Styles = [
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
{
|
|
106
|
-
property: "marginRight",
|
|
107
|
-
value: { type: "unit", value: 8, unit: "px" },
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
property: "marginBottom",
|
|
111
|
-
value: { type: "unit", value: 8, unit: "px" },
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
property: "marginLeft",
|
|
115
|
-
value: { type: "unit", value: 8, unit: "px" },
|
|
116
|
-
},
|
|
197
|
+
display("block"),
|
|
198
|
+
marginTop(8, "px"),
|
|
199
|
+
marginRight(8, "px"),
|
|
200
|
+
marginBottom(8, "px"),
|
|
201
|
+
marginLeft(8, "px"),
|
|
117
202
|
];
|
|
118
203
|
|
|
119
|
-
export const p: Styles = [
|
|
204
|
+
export const p: Styles = [
|
|
205
|
+
display("block"),
|
|
206
|
+
marginTop(1, "em"),
|
|
207
|
+
marginBottom(1, "em"),
|
|
208
|
+
];
|
|
120
209
|
export { p as dl };
|
|
121
210
|
|
|
122
|
-
export const dd: Styles = [
|
|
211
|
+
export const dd: Styles = [display("block"), marginLeft(40, "px")];
|
|
123
212
|
|
|
124
|
-
export const blockquote: Styles = [
|
|
213
|
+
export const blockquote: Styles = [
|
|
214
|
+
display("block"),
|
|
215
|
+
marginTop(1, "em"),
|
|
216
|
+
marginBottom(1, "em"),
|
|
217
|
+
marginLeft(40, "px"),
|
|
218
|
+
marginRight(40, "px"),
|
|
219
|
+
];
|
|
125
220
|
export { blockquote as figure };
|
|
126
221
|
|
|
127
|
-
export const address: Styles = [
|
|
222
|
+
export const address: Styles = [display("block"), fontStyle("italic")];
|
|
128
223
|
|
|
129
224
|
// h1 font-size, margin-top and margin-bottom depend on outer tags
|
|
130
225
|
// so better define statically in preset styles
|
|
131
226
|
export const h1: Styles = [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
property: "marginTop",
|
|
140
|
-
value: { type: "unit", value: 0.67, unit: "em" },
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
property: "marginBottom",
|
|
144
|
-
value: { type: "unit", value: 0.67, unit: "em" },
|
|
145
|
-
},
|
|
227
|
+
display("block"),
|
|
228
|
+
fontWeight("bold"),
|
|
229
|
+
fontSize(2, "em"),
|
|
230
|
+
marginTop(0.67, "em"),
|
|
231
|
+
marginBottom(0.67, "em"),
|
|
146
232
|
];
|
|
147
233
|
|
|
148
234
|
export const h2: Styles = [
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
property: "marginTop",
|
|
157
|
-
value: { type: "unit", value: 0.83, unit: "em" },
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
property: "marginBottom",
|
|
161
|
-
value: { type: "unit", value: 0.83, unit: "em" },
|
|
162
|
-
},
|
|
235
|
+
display("block"),
|
|
236
|
+
fontWeight("bold"),
|
|
237
|
+
fontSize(1.5, "em"),
|
|
238
|
+
marginTop(0.83, "em"),
|
|
239
|
+
marginBottom(0.83, "em"),
|
|
163
240
|
];
|
|
164
241
|
|
|
165
242
|
export const h3: Styles = [
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
property: "marginTop",
|
|
174
|
-
value: { type: "unit", value: 1, unit: "em" },
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
property: "marginBottom",
|
|
178
|
-
value: { type: "unit", value: 1, unit: "em" },
|
|
179
|
-
},
|
|
243
|
+
display("block"),
|
|
244
|
+
fontWeight("bold"),
|
|
245
|
+
fontSize(1.17, "em"),
|
|
246
|
+
marginTop(1, "em"),
|
|
247
|
+
marginBottom(1, "em"),
|
|
180
248
|
];
|
|
181
249
|
|
|
182
250
|
export const h4: Styles = [
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
value: { type: "unit", value: 1.33, unit: "em" },
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
property: "marginBottom",
|
|
191
|
-
value: { type: "unit", value: 1.33, unit: "em" },
|
|
192
|
-
},
|
|
251
|
+
display("block"),
|
|
252
|
+
fontWeight("bold"),
|
|
253
|
+
marginTop(1.33, "em"),
|
|
254
|
+
marginBottom(1.33, "em"),
|
|
193
255
|
];
|
|
194
256
|
|
|
195
257
|
export const h5: Styles = [
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
property: "marginTop",
|
|
204
|
-
value: { type: "unit", value: 1.67, unit: "em" },
|
|
205
|
-
},
|
|
206
|
-
{
|
|
207
|
-
property: "marginBottom",
|
|
208
|
-
value: { type: "unit", value: 1.67, unit: "em" },
|
|
209
|
-
},
|
|
258
|
+
display("block"),
|
|
259
|
+
fontWeight("bold"),
|
|
260
|
+
fontSize(0.83, "em"),
|
|
261
|
+
marginTop(1.67, "em"),
|
|
262
|
+
marginBottom(1.67, "em"),
|
|
210
263
|
];
|
|
211
264
|
|
|
212
265
|
export const h6: Styles = [
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
property: "marginTop",
|
|
221
|
-
value: { type: "unit", value: 2.33, unit: "em" },
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
property: "marginBottom",
|
|
225
|
-
value: { type: "unit", value: 2.33, unit: "em" },
|
|
226
|
-
},
|
|
266
|
+
display("block"),
|
|
267
|
+
fontWeight("bold"),
|
|
268
|
+
fontSize(0.67, "em"),
|
|
269
|
+
marginTop(2.33, "em"),
|
|
270
|
+
marginBottom(2.33, "em"),
|
|
227
271
|
];
|
|
228
272
|
|
|
229
273
|
export const pre: Styles = [
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
},
|
|
235
|
-
mt1em,
|
|
236
|
-
mb1em,
|
|
274
|
+
display("block"),
|
|
275
|
+
whiteSpace("pre"),
|
|
276
|
+
marginTop(1, "em"),
|
|
277
|
+
marginBottom(1, "em"),
|
|
237
278
|
];
|
|
238
279
|
|
|
239
280
|
/* tables */
|
|
240
281
|
|
|
241
282
|
export const table: Styles = [
|
|
242
|
-
|
|
243
|
-
property: "display",
|
|
244
|
-
value: { type: "keyword", value: "table" },
|
|
245
|
-
},
|
|
283
|
+
display("table"),
|
|
246
284
|
{
|
|
247
285
|
property: "borderSpacing",
|
|
248
286
|
value: { type: "unit", value: 2, unit: "px" },
|
|
@@ -251,129 +289,64 @@ export const table: Styles = [
|
|
|
251
289
|
property: "borderCollapse",
|
|
252
290
|
value: { type: "keyword", value: "separate" },
|
|
253
291
|
},
|
|
292
|
+
boxSizing("border-box"),
|
|
254
293
|
{
|
|
255
|
-
property: "
|
|
256
|
-
value: { type: "keyword", value: "border-box" },
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
property: "borderSpacing",
|
|
294
|
+
property: "textIndent",
|
|
260
295
|
value: { type: "unit", value: 0, unit: "number" },
|
|
261
296
|
},
|
|
262
297
|
];
|
|
263
298
|
|
|
264
|
-
export const caption: Styles = [
|
|
265
|
-
{
|
|
266
|
-
property: "display",
|
|
267
|
-
value: { type: "keyword", value: "table" },
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
property: "textAlign",
|
|
271
|
-
value: { type: "keyword", value: "center" },
|
|
272
|
-
},
|
|
273
|
-
];
|
|
299
|
+
export const caption: Styles = [display("table-caption"), textAlign("center")];
|
|
274
300
|
|
|
275
|
-
export const tr: Styles = [
|
|
276
|
-
{
|
|
277
|
-
property: "display",
|
|
278
|
-
value: { type: "keyword", value: "table-row" },
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
property: "verticalAlign",
|
|
282
|
-
value: { type: "keyword", value: "inherit" },
|
|
283
|
-
},
|
|
284
|
-
];
|
|
301
|
+
export const tr: Styles = [display("table-row"), verticalAlign("inherit")];
|
|
285
302
|
|
|
286
|
-
export const col: Styles = [
|
|
287
|
-
{
|
|
288
|
-
property: "display",
|
|
289
|
-
value: { type: "keyword", value: "table-column" },
|
|
290
|
-
},
|
|
291
|
-
];
|
|
303
|
+
export const col: Styles = [display("table-column")];
|
|
292
304
|
|
|
293
|
-
export const colgroup: Styles = [
|
|
294
|
-
{
|
|
295
|
-
property: "display",
|
|
296
|
-
value: { type: "keyword", value: "table-column-group" },
|
|
297
|
-
},
|
|
298
|
-
];
|
|
305
|
+
export const colgroup: Styles = [display("table-column-group")];
|
|
299
306
|
|
|
300
307
|
export const tbody: Styles = [
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
value: { type: "keyword", value: "table-row-group" },
|
|
304
|
-
},
|
|
305
|
-
{
|
|
306
|
-
property: "verticalAlign",
|
|
307
|
-
value: { type: "keyword", value: "middle" },
|
|
308
|
-
},
|
|
308
|
+
display("table-row-group"),
|
|
309
|
+
verticalAlign("middle"),
|
|
309
310
|
];
|
|
310
311
|
|
|
311
312
|
export const thead: Styles = [
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
value: { type: "keyword", value: "table-header-group" },
|
|
315
|
-
},
|
|
316
|
-
{
|
|
317
|
-
property: "verticalAlign",
|
|
318
|
-
value: { type: "keyword", value: "middle" },
|
|
319
|
-
},
|
|
313
|
+
display("table-header-group"),
|
|
314
|
+
verticalAlign("middle"),
|
|
320
315
|
];
|
|
321
316
|
|
|
322
317
|
export const tfoot: Styles = [
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
value: { type: "keyword", value: "table-footer-group" },
|
|
326
|
-
},
|
|
327
|
-
{
|
|
328
|
-
property: "verticalAlign",
|
|
329
|
-
value: { type: "keyword", value: "middle" },
|
|
330
|
-
},
|
|
318
|
+
display("table-footer-group"),
|
|
319
|
+
verticalAlign("middle"),
|
|
331
320
|
];
|
|
332
321
|
|
|
333
322
|
export const td: Styles = [
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
value: { type: "keyword", value: "inherit" },
|
|
341
|
-
},
|
|
342
|
-
{
|
|
343
|
-
property: "textAlign",
|
|
344
|
-
value: { type: "keyword", value: "unset" },
|
|
345
|
-
},
|
|
346
|
-
pt1px,
|
|
347
|
-
pr1px,
|
|
348
|
-
pb1px,
|
|
349
|
-
pl1px,
|
|
323
|
+
display("table-cell"),
|
|
324
|
+
verticalAlign("inherit"),
|
|
325
|
+
paddingTop(1, "px"),
|
|
326
|
+
paddingRight(1, "px"),
|
|
327
|
+
paddingBottom(1, "px"),
|
|
328
|
+
paddingLeft(1, "px"),
|
|
350
329
|
];
|
|
351
330
|
|
|
352
331
|
export const th: Styles = [
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
},
|
|
361
|
-
fontWeightBold,
|
|
362
|
-
pt1px,
|
|
363
|
-
pr1px,
|
|
364
|
-
pb1px,
|
|
365
|
-
pl1px,
|
|
332
|
+
display("table-cell"),
|
|
333
|
+
verticalAlign("inherit"),
|
|
334
|
+
fontWeight("bold"),
|
|
335
|
+
paddingTop(1, "px"),
|
|
336
|
+
paddingRight(1, "px"),
|
|
337
|
+
paddingBottom(1, "px"),
|
|
338
|
+
paddingLeft(1, "px"),
|
|
366
339
|
];
|
|
367
340
|
|
|
368
341
|
/* inlines */
|
|
369
342
|
|
|
370
343
|
export const b: Styles = [
|
|
371
344
|
// in firefox defined as bolder
|
|
372
|
-
|
|
345
|
+
fontWeight("bold"),
|
|
373
346
|
];
|
|
374
347
|
export { b as strong };
|
|
375
348
|
|
|
376
|
-
export const i: Styles = [
|
|
349
|
+
export const i: Styles = [fontStyle("italic")];
|
|
377
350
|
export { i as cite, i as em, i as var, i as dfn };
|
|
378
351
|
|
|
379
352
|
export const code: Styles = [
|
|
@@ -391,11 +364,8 @@ export const mark: Styles = [
|
|
|
391
364
|
// in firefox defined as Mark
|
|
392
365
|
value: { type: "keyword", value: "yellow" },
|
|
393
366
|
},
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
// in firefox defined as MarkText
|
|
397
|
-
value: { type: "keyword", value: "black" },
|
|
398
|
-
},
|
|
367
|
+
// in firefox defined as MarkText
|
|
368
|
+
color("black"),
|
|
399
369
|
];
|
|
400
370
|
|
|
401
371
|
export const u: Styles = [
|
|
@@ -415,10 +385,7 @@ export const s: Styles = [
|
|
|
415
385
|
export { s as del };
|
|
416
386
|
|
|
417
387
|
export const sub: Styles = [
|
|
418
|
-
|
|
419
|
-
property: "verticalAlign",
|
|
420
|
-
value: { type: "keyword", value: "sub" },
|
|
421
|
-
},
|
|
388
|
+
verticalAlign("sub"),
|
|
422
389
|
{
|
|
423
390
|
property: "fontSize",
|
|
424
391
|
value: { type: "keyword", value: "smaller" },
|
|
@@ -426,10 +393,7 @@ export const sub: Styles = [
|
|
|
426
393
|
];
|
|
427
394
|
|
|
428
395
|
export const sup: Styles = [
|
|
429
|
-
|
|
430
|
-
property: "verticalAlign",
|
|
431
|
-
value: { type: "keyword", value: "super" },
|
|
432
|
-
},
|
|
396
|
+
verticalAlign("super"),
|
|
433
397
|
{
|
|
434
398
|
property: "fontSize",
|
|
435
399
|
value: { type: "keyword", value: "smaller" },
|
|
@@ -441,10 +405,7 @@ export const a: Styles = [
|
|
|
441
405
|
property: "textDecorationLine",
|
|
442
406
|
value: { type: "keyword", value: "underline" },
|
|
443
407
|
},
|
|
444
|
-
|
|
445
|
-
property: "cursor",
|
|
446
|
-
value: { type: "keyword", value: "pointer" },
|
|
447
|
-
},
|
|
408
|
+
cursor("pointer"),
|
|
448
409
|
{
|
|
449
410
|
property: "color",
|
|
450
411
|
value: { type: "rgb", r: 0, g: 0, b: 238, alpha: 1 },
|
|
@@ -458,103 +419,199 @@ export const a: Styles = [
|
|
|
458
419
|
// nested lists have no top/bottom margins
|
|
459
420
|
// so better redefine statically in preset
|
|
460
421
|
export const ul: Styles = [
|
|
461
|
-
|
|
422
|
+
display("block"),
|
|
462
423
|
{
|
|
463
424
|
property: "listStyleType",
|
|
464
425
|
value: { type: "keyword", value: "disc" },
|
|
465
426
|
},
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
427
|
+
marginTop(1, "em"),
|
|
428
|
+
marginBottom(1, "em"),
|
|
429
|
+
paddingLeft(40, "px"),
|
|
469
430
|
];
|
|
470
431
|
|
|
471
432
|
export const ol: Styles = [
|
|
472
|
-
|
|
433
|
+
display("block"),
|
|
473
434
|
{
|
|
474
435
|
property: "listStyleType",
|
|
475
436
|
value: { type: "keyword", value: "decimal" },
|
|
476
437
|
},
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
438
|
+
marginTop(1, "em"),
|
|
439
|
+
marginBottom(1, "em"),
|
|
440
|
+
paddingLeft(40, "px"),
|
|
480
441
|
];
|
|
481
442
|
|
|
482
|
-
export const li: Styles = [
|
|
483
|
-
{
|
|
484
|
-
property: "display",
|
|
485
|
-
value: { type: "keyword", value: "list-item" },
|
|
486
|
-
},
|
|
487
|
-
{
|
|
488
|
-
property: "textAlign",
|
|
489
|
-
value: { type: "keyword", value: "match-parent" },
|
|
490
|
-
},
|
|
491
|
-
];
|
|
443
|
+
export const li: Styles = [display("list-item"), textAlign("match-parent")];
|
|
492
444
|
|
|
493
445
|
/* leafs */
|
|
494
446
|
|
|
495
447
|
export const hr: Styles = [
|
|
448
|
+
color("gray"),
|
|
449
|
+
...borderWidth(1, "px"),
|
|
450
|
+
...borderStyle("inset"),
|
|
451
|
+
marginTop(0.5, "em"),
|
|
452
|
+
marginBottom(0.5, "em"),
|
|
496
453
|
{
|
|
497
|
-
property: "
|
|
498
|
-
value: { type: "keyword", value: "
|
|
499
|
-
},
|
|
500
|
-
|
|
501
|
-
{
|
|
502
|
-
property: "borderTopWidth",
|
|
503
|
-
value: { type: "unit", value: 1, unit: "px" },
|
|
504
|
-
},
|
|
505
|
-
{
|
|
506
|
-
property: "borderRightWidth",
|
|
507
|
-
value: { type: "unit", value: 1, unit: "px" },
|
|
454
|
+
property: "marginLeft",
|
|
455
|
+
value: { type: "keyword", value: "auto" },
|
|
508
456
|
},
|
|
509
457
|
{
|
|
510
|
-
property: "
|
|
511
|
-
value: { type: "
|
|
458
|
+
property: "marginRight",
|
|
459
|
+
value: { type: "keyword", value: "auto" },
|
|
512
460
|
},
|
|
461
|
+
// firefox only
|
|
513
462
|
{
|
|
514
|
-
property: "
|
|
515
|
-
value: { type: "
|
|
463
|
+
property: "overflow",
|
|
464
|
+
value: { type: "keyword", value: "hidden" },
|
|
516
465
|
},
|
|
466
|
+
/* This is not really per spec but all browsers define it */
|
|
467
|
+
display("block"),
|
|
468
|
+
];
|
|
517
469
|
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
{
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
},
|
|
530
|
-
{
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
470
|
+
/**
|
|
471
|
+
* forms
|
|
472
|
+
* https://searchfox.org/mozilla-central/source/layout/style/res/forms.css
|
|
473
|
+
**/
|
|
474
|
+
|
|
475
|
+
const formControlReset: Styles = [
|
|
476
|
+
// in firefox defined as FieldText
|
|
477
|
+
color("initial"),
|
|
478
|
+
{ property: "letterSpacing", value: { type: "keyword", value: "normal" } },
|
|
479
|
+
{ property: "wordSpacing", value: { type: "keyword", value: "normal" } },
|
|
480
|
+
{ property: "lineHeight", value: { type: "keyword", value: "normal" } },
|
|
481
|
+
{ property: "textTransform", value: { type: "keyword", value: "none" } },
|
|
482
|
+
{ property: "textIndent", value: { type: "unit", value: 0, unit: "number" } },
|
|
483
|
+
{ property: "textShadow", value: { type: "keyword", value: "none" } },
|
|
484
|
+
display("inline-block"),
|
|
485
|
+
textAlign("start"),
|
|
486
|
+
];
|
|
534
487
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
488
|
+
export const legend: Styles = [
|
|
489
|
+
display("block"),
|
|
490
|
+
paddingLeft(2, "px"),
|
|
491
|
+
paddingRight(2, "px"),
|
|
492
|
+
];
|
|
493
|
+
|
|
494
|
+
export const fieldset: Styles = [
|
|
495
|
+
display("block"),
|
|
496
|
+
marginLeft(2, "px"),
|
|
497
|
+
marginRight(2, "px"),
|
|
498
|
+
paddingTop(0.35, "em"),
|
|
499
|
+
paddingBottom(0.625, "em"),
|
|
500
|
+
paddingLeft(0.75, "em"),
|
|
501
|
+
paddingRight(0.75, "em"),
|
|
502
|
+
...borderWidth(2, "px"),
|
|
503
|
+
// in browsers defined as groove
|
|
504
|
+
...borderStyle("solid"),
|
|
505
|
+
...borderColor("ThreeDFace"),
|
|
506
|
+
{ property: "minWidth", value: { type: "keyword", value: "min-content" } },
|
|
507
|
+
];
|
|
508
|
+
|
|
509
|
+
export const label: Styles = [cursor("default")];
|
|
510
|
+
|
|
511
|
+
export const input: Styles = [
|
|
512
|
+
appearance("auto"),
|
|
513
|
+
paddingTop(1, "px"),
|
|
514
|
+
paddingRight(1, "px"),
|
|
515
|
+
paddingBottom(1, "px"),
|
|
516
|
+
paddingLeft(1, "px"),
|
|
517
|
+
...borderWidth(2, "px"),
|
|
518
|
+
// in browsers defined as inset
|
|
519
|
+
...borderStyle("solid"),
|
|
520
|
+
// in firefox defined as Field
|
|
521
|
+
{ property: "backgroundColor", value: { type: "keyword", value: "white" } },
|
|
522
|
+
cursor("text"),
|
|
523
|
+
];
|
|
524
|
+
|
|
525
|
+
export const textarea: Styles = [
|
|
526
|
+
...formControlReset,
|
|
527
|
+
appearance("auto"),
|
|
528
|
+
marginTop(1, "px"),
|
|
529
|
+
marginBottom(1, "px"),
|
|
530
|
+
// in firefox 2px
|
|
531
|
+
...borderWidth(1, "px"),
|
|
532
|
+
// in browsers defined as inset
|
|
533
|
+
...borderStyle("solid"),
|
|
534
|
+
paddingTop(2, "px"),
|
|
535
|
+
paddingRight(2, "px"),
|
|
536
|
+
paddingBottom(2, "px"),
|
|
537
|
+
paddingLeft(2, "px"),
|
|
538
|
+
// in firefox defined as Field
|
|
539
|
+
{ property: "backgroundColor", value: { type: "keyword", value: "white" } },
|
|
540
|
+
verticalAlign("text-bottom"),
|
|
541
|
+
cursor("text"),
|
|
542
|
+
{ property: "resize", value: { type: "keyword", value: "both" } },
|
|
543
|
+
whiteSpace("pre-wrap"),
|
|
544
|
+
{
|
|
545
|
+
property: "wordWrap",
|
|
546
|
+
value: { type: "keyword", value: "break-word" },
|
|
542
547
|
},
|
|
548
|
+
];
|
|
549
|
+
|
|
550
|
+
export const select: Styles = [
|
|
551
|
+
...formControlReset,
|
|
552
|
+
display("inline-block"),
|
|
553
|
+
marginTop(0),
|
|
554
|
+
marginRight(0),
|
|
555
|
+
marginBottom(0),
|
|
556
|
+
marginLeft(0),
|
|
557
|
+
paddingTop(1, "px"),
|
|
558
|
+
paddingBottom(1, "px"),
|
|
559
|
+
paddingRight(4, "px"),
|
|
560
|
+
paddingLeft(4, "px"),
|
|
561
|
+
...borderWidth(2, "px"),
|
|
562
|
+
// in browsers defined as inset
|
|
563
|
+
...borderStyle("solid"),
|
|
564
|
+
whiteSpace("nowrap"),
|
|
565
|
+
{
|
|
566
|
+
property: "wordWrap",
|
|
567
|
+
value: { type: "keyword", value: "normal" },
|
|
568
|
+
},
|
|
569
|
+
cursor("default"),
|
|
570
|
+
boxSizing("border-box"),
|
|
571
|
+
userSelect("none"),
|
|
543
572
|
{
|
|
544
|
-
property: "
|
|
545
|
-
value: { type: "keyword", value: "
|
|
573
|
+
property: "overflow",
|
|
574
|
+
value: { type: "keyword", value: "clip" },
|
|
546
575
|
},
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
576
|
+
verticalAlign("baseline"),
|
|
577
|
+
appearance("auto"),
|
|
578
|
+
];
|
|
579
|
+
|
|
580
|
+
export const option: Styles = [
|
|
581
|
+
display("block"),
|
|
582
|
+
{ property: "float", value: { type: "keyword", value: "none" } },
|
|
583
|
+
{ property: "position", value: { type: "keyword", value: "static" } },
|
|
584
|
+
{ property: "minHeight", value: { type: "unit", value: 1, unit: "em" } },
|
|
585
|
+
paddingTop(2, "px"),
|
|
586
|
+
paddingBottom(2, "px"),
|
|
587
|
+
paddingRight(2, "px"),
|
|
588
|
+
paddingLeft(4, "px"),
|
|
589
|
+
userSelect("none"),
|
|
590
|
+
whiteSpace("nowrap"),
|
|
591
|
+
{
|
|
592
|
+
property: "wordWrap",
|
|
593
|
+
value: { type: "keyword", value: "normal" },
|
|
550
594
|
},
|
|
595
|
+
];
|
|
551
596
|
|
|
552
|
-
|
|
597
|
+
export const button: Styles = [
|
|
598
|
+
...formControlReset,
|
|
599
|
+
appearance("auto"),
|
|
600
|
+
// in firefox defined as 1px 8px
|
|
601
|
+
paddingTop(2, "px"),
|
|
602
|
+
paddingBottom(3, "px"),
|
|
603
|
+
paddingLeft(6, "px"),
|
|
604
|
+
paddingRight(6, "px"),
|
|
605
|
+
...borderWidth(2, "px"),
|
|
606
|
+
// in browsers defined as outset
|
|
607
|
+
...borderStyle("solid"),
|
|
608
|
+
cursor("default"),
|
|
609
|
+
boxSizing("border-box"),
|
|
610
|
+
userSelect("none"),
|
|
611
|
+
textAlign("center"),
|
|
553
612
|
{
|
|
554
|
-
property: "
|
|
555
|
-
|
|
613
|
+
property: "backgroundColor",
|
|
614
|
+
// in browsers defined as ButtonFace
|
|
615
|
+
value: { type: "keyword", value: "lightgray" },
|
|
556
616
|
},
|
|
557
|
-
|
|
558
|
-
/* This is not really per spec but all browsers define it */
|
|
559
|
-
displayBlock,
|
|
560
617
|
];
|