@webstudio-is/css-data 0.91.0 → 0.267.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/index.js +17534 -15
- package/lib/types/__generated__/animatable-properties.d.ts +1 -0
- package/lib/types/__generated__/html.d.ts +2 -0
- package/lib/types/__generated__/keyword-values.d.ts +4 -358
- package/lib/types/__generated__/properties.d.ts +10 -3674
- package/lib/types/__generated__/property-value-descriptions.d.ts +7 -5446
- package/lib/types/__generated__/pseudo-classes.d.ts +1 -0
- package/lib/types/__generated__/pseudo-elements.d.ts +1 -0
- package/lib/types/__generated__/pseudo-selector-descriptions.d.ts +2 -0
- package/lib/types/__generated__/shorthand-properties.d.ts +1 -0
- package/lib/types/css-tree.d.ts +772 -0
- package/lib/types/index.d.ts +18 -3680
- package/lib/types/media-condition-simulator.d.ts +7 -0
- package/lib/types/parse-css-value.d.ts +8 -3
- package/lib/types/parse-css.d.ts +75 -6
- package/lib/types/property-parsers/conic-gradient.d.ts +3 -0
- package/lib/types/property-parsers/gradient-utils.d.ts +20 -0
- package/lib/types/property-parsers/grid-template-areas.d.ts +21 -0
- package/lib/types/property-parsers/grid-template-tracks.d.ts +128 -0
- package/lib/types/property-parsers/index.d.ts +6 -2
- package/lib/types/property-parsers/linear-gradient.d.ts +4 -0
- package/lib/types/property-parsers/radial-gradient.d.ts +3 -0
- package/lib/types/property-parsers/types.d.ts +28 -0
- package/lib/types/selector-validation.d.ts +13 -0
- package/lib/types/shorthands.d.ts +2 -0
- package/package.json +29 -33
- package/lib/__generated__/keyword-values.js +0 -5255
- package/lib/__generated__/properties.js +0 -3697
- package/lib/__generated__/property-value-descriptions.js +0 -2740
- package/lib/__generated__/units.js +0 -65
- package/lib/cjs/__generated__/keyword-values.js +0 -5275
- package/lib/cjs/__generated__/properties.js +0 -3717
- package/lib/cjs/__generated__/property-value-descriptions.js +0 -2760
- package/lib/cjs/__generated__/units.js +0 -85
- package/lib/cjs/custom-data.js +0 -64
- package/lib/cjs/html-check.js +0 -25
- package/lib/cjs/html.js +0 -581
- package/lib/cjs/index.js +0 -48
- package/lib/cjs/package.json +0 -1
- package/lib/cjs/parse-css-value.js +0 -152
- package/lib/cjs/parse-css.js +0 -136
- package/lib/cjs/popularity-index.js +0 -4633
- package/lib/cjs/property-parsers/background.js +0 -119
- package/lib/cjs/property-parsers/box-shadow.js +0 -129
- package/lib/cjs/property-parsers/index.js +0 -19
- package/lib/cjs/property-parsers/parsers.js +0 -26
- package/lib/cjs/property-parsers/to-longhand.js +0 -24
- package/lib/cjs/schema.js +0 -135
- package/lib/custom-data.js +0 -44
- package/lib/html-check.js +0 -2
- package/lib/html.js +0 -561
- package/lib/parse-css-value.js +0 -122
- package/lib/parse-css.js +0 -106
- package/lib/popularity-index.js +0 -4613
- package/lib/property-parsers/background.js +0 -89
- package/lib/property-parsers/box-shadow.js +0 -99
- package/lib/property-parsers/index.js +0 -2
- package/lib/property-parsers/parsers.js +0 -6
- package/lib/property-parsers/to-longhand.js +0 -4
- package/lib/schema.js +0 -115
- package/lib/types/custom-data.d.ts +0 -15
- package/lib/types/html-check.d.ts +0 -1
- package/lib/types/html.d.ts +0 -62
- package/lib/types/parse-css-value.test.d.ts +0 -1
- package/lib/types/parse-css.test.d.ts +0 -1
- package/lib/types/popularity-index.d.ts +0 -6
- package/lib/types/property-parsers/background.d.ts +0 -11
- package/lib/types/property-parsers/background.test.d.ts +0 -1
- package/lib/types/property-parsers/box-shadow.d.ts +0 -3
- package/lib/types/property-parsers/box-shadow.test.d.ts +0 -1
- package/lib/types/property-parsers/parsers.d.ts +0 -2
- package/lib/types/property-parsers/to-longhand.d.ts +0 -1
- package/lib/types/schema.d.ts +0 -3243
- package/src/__generated__/keyword-values.ts +0 -5253
- package/src/__generated__/properties.ts +0 -3696
- package/src/__generated__/property-value-descriptions.ts +0 -4008
- package/src/__generated__/units.ts +0 -63
- package/src/custom-data.ts +0 -57
- package/src/html-check.ts +0 -8
- package/src/html.ts +0 -617
- package/src/index.ts +0 -25
- package/src/parse-css-value.test.ts +0 -136
- package/src/parse-css-value.ts +0 -157
- package/src/parse-css.test.ts +0 -101
- package/src/parse-css.ts +0 -137
- package/src/popularity-index.ts +0 -4611
- package/src/property-parsers/README.md +0 -11
- package/src/property-parsers/background.test.ts +0 -184
- package/src/property-parsers/background.ts +0 -147
- package/src/property-parsers/box-shadow.test.ts +0 -294
- package/src/property-parsers/box-shadow.ts +0 -130
- package/src/property-parsers/index.ts +0 -2
- package/src/property-parsers/parsers.ts +0 -5
- package/src/property-parsers/to-longhand.ts +0 -4
- package/src/schema.ts +0 -193
package/src/html.ts
DELETED
|
@@ -1,617 +0,0 @@
|
|
|
1
|
-
// all styles are taken from following source
|
|
2
|
-
// https://searchfox.org/mozilla-central/source/layout/style/res/html.css
|
|
3
|
-
// https://chromium.googlesource.com/chromium/blink/+/master/Source/core/css/html.css
|
|
4
|
-
// https://trac.webkit.org/browser/trunk/Source/WebCore/css/html.css
|
|
5
|
-
|
|
6
|
-
import type { htmlTags as HtmlTags } from "html-tags";
|
|
7
|
-
import type { StyleProperty, StyleValue } from "./schema";
|
|
8
|
-
|
|
9
|
-
type StyleDecl = {
|
|
10
|
-
property: StyleProperty;
|
|
11
|
-
value: StyleValue;
|
|
12
|
-
};
|
|
13
|
-
type Styles = StyleDecl[];
|
|
14
|
-
|
|
15
|
-
export type Html = {
|
|
16
|
-
[tag in HtmlTags]?: Styles;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
const display = (value: string): Styles[number] => ({
|
|
20
|
-
property: "display",
|
|
21
|
-
value: { type: "keyword", value },
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
const marginTop = (value: number, unit?: "em" | "px"): Styles[number] => ({
|
|
25
|
-
property: "marginTop",
|
|
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
|
-
});
|
|
33
|
-
|
|
34
|
-
const marginBottom = (value: number, unit?: "em" | "px"): Styles[number] => ({
|
|
35
|
-
property: "marginBottom",
|
|
36
|
-
value: { type: "unit", value, unit: unit ?? "number" },
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
const marginLeft = (value: number, unit?: "em" | "px"): Styles[number] => ({
|
|
40
|
-
property: "marginLeft",
|
|
41
|
-
value: { type: "unit", value, unit: unit ?? "number" },
|
|
42
|
-
});
|
|
43
|
-
|
|
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
|
-
});
|
|
53
|
-
|
|
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] => ({
|
|
60
|
-
property: "paddingLeft",
|
|
61
|
-
value: { type: "unit", value, unit },
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
const color = (value: string): Styles[number] => ({
|
|
65
|
-
property: "color",
|
|
66
|
-
value: { type: "keyword", value },
|
|
67
|
-
});
|
|
68
|
-
|
|
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] => ({
|
|
75
|
-
property: "fontWeight",
|
|
76
|
-
value: { type: "keyword", value },
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
const fontStyle = (value: "italic"): Styles[number] => ({
|
|
80
|
-
property: "fontStyle",
|
|
81
|
-
value: { type: "keyword", value },
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
const textAlign = (value: string): Styles[number] => ({
|
|
85
|
-
property: "textAlign",
|
|
86
|
-
value: { type: "keyword", value },
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
const verticalAlign = (value: string): Styles[number] => ({
|
|
90
|
-
property: "verticalAlign",
|
|
91
|
-
value: { type: "keyword", value },
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
const whiteSpace = (value: string): Styles[number] => ({
|
|
95
|
-
property: "whiteSpace",
|
|
96
|
-
value: { type: "keyword", value },
|
|
97
|
-
});
|
|
98
|
-
|
|
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
|
-
});
|
|
175
|
-
|
|
176
|
-
/* blocks */
|
|
177
|
-
|
|
178
|
-
export const article: Styles = [display("block")];
|
|
179
|
-
export {
|
|
180
|
-
article as aside,
|
|
181
|
-
article as details,
|
|
182
|
-
article as div,
|
|
183
|
-
article as dt,
|
|
184
|
-
article as figcaption,
|
|
185
|
-
article as footer,
|
|
186
|
-
article as form,
|
|
187
|
-
article as header,
|
|
188
|
-
article as hgroup,
|
|
189
|
-
article as html,
|
|
190
|
-
article as main,
|
|
191
|
-
article as nav,
|
|
192
|
-
article as section,
|
|
193
|
-
article as summary,
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
export const body: Styles = [
|
|
197
|
-
display("block"),
|
|
198
|
-
marginTop(8, "px"),
|
|
199
|
-
marginRight(8, "px"),
|
|
200
|
-
marginBottom(8, "px"),
|
|
201
|
-
marginLeft(8, "px"),
|
|
202
|
-
];
|
|
203
|
-
|
|
204
|
-
export const p: Styles = [
|
|
205
|
-
display("block"),
|
|
206
|
-
marginTop(1, "em"),
|
|
207
|
-
marginBottom(1, "em"),
|
|
208
|
-
];
|
|
209
|
-
export { p as dl };
|
|
210
|
-
|
|
211
|
-
export const dd: Styles = [display("block"), marginLeft(40, "px")];
|
|
212
|
-
|
|
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
|
-
];
|
|
220
|
-
export { blockquote as figure };
|
|
221
|
-
|
|
222
|
-
export const address: Styles = [display("block"), fontStyle("italic")];
|
|
223
|
-
|
|
224
|
-
// h1 font-size, margin-top and margin-bottom depend on outer tags
|
|
225
|
-
// so better define statically in preset styles
|
|
226
|
-
export const h1: Styles = [
|
|
227
|
-
display("block"),
|
|
228
|
-
fontWeight("bold"),
|
|
229
|
-
fontSize(2, "em"),
|
|
230
|
-
marginTop(0.67, "em"),
|
|
231
|
-
marginBottom(0.67, "em"),
|
|
232
|
-
];
|
|
233
|
-
|
|
234
|
-
export const h2: Styles = [
|
|
235
|
-
display("block"),
|
|
236
|
-
fontWeight("bold"),
|
|
237
|
-
fontSize(1.5, "em"),
|
|
238
|
-
marginTop(0.83, "em"),
|
|
239
|
-
marginBottom(0.83, "em"),
|
|
240
|
-
];
|
|
241
|
-
|
|
242
|
-
export const h3: Styles = [
|
|
243
|
-
display("block"),
|
|
244
|
-
fontWeight("bold"),
|
|
245
|
-
fontSize(1.17, "em"),
|
|
246
|
-
marginTop(1, "em"),
|
|
247
|
-
marginBottom(1, "em"),
|
|
248
|
-
];
|
|
249
|
-
|
|
250
|
-
export const h4: Styles = [
|
|
251
|
-
display("block"),
|
|
252
|
-
fontWeight("bold"),
|
|
253
|
-
marginTop(1.33, "em"),
|
|
254
|
-
marginBottom(1.33, "em"),
|
|
255
|
-
];
|
|
256
|
-
|
|
257
|
-
export const h5: Styles = [
|
|
258
|
-
display("block"),
|
|
259
|
-
fontWeight("bold"),
|
|
260
|
-
fontSize(0.83, "em"),
|
|
261
|
-
marginTop(1.67, "em"),
|
|
262
|
-
marginBottom(1.67, "em"),
|
|
263
|
-
];
|
|
264
|
-
|
|
265
|
-
export const h6: Styles = [
|
|
266
|
-
display("block"),
|
|
267
|
-
fontWeight("bold"),
|
|
268
|
-
fontSize(0.67, "em"),
|
|
269
|
-
marginTop(2.33, "em"),
|
|
270
|
-
marginBottom(2.33, "em"),
|
|
271
|
-
];
|
|
272
|
-
|
|
273
|
-
export const pre: Styles = [
|
|
274
|
-
display("block"),
|
|
275
|
-
whiteSpace("pre"),
|
|
276
|
-
marginTop(1, "em"),
|
|
277
|
-
marginBottom(1, "em"),
|
|
278
|
-
];
|
|
279
|
-
|
|
280
|
-
/* tables */
|
|
281
|
-
|
|
282
|
-
export const table: Styles = [
|
|
283
|
-
display("table"),
|
|
284
|
-
{
|
|
285
|
-
property: "borderSpacing",
|
|
286
|
-
value: { type: "unit", value: 2, unit: "px" },
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
property: "borderCollapse",
|
|
290
|
-
value: { type: "keyword", value: "separate" },
|
|
291
|
-
},
|
|
292
|
-
boxSizing("border-box"),
|
|
293
|
-
{
|
|
294
|
-
property: "textIndent",
|
|
295
|
-
value: { type: "unit", value: 0, unit: "number" },
|
|
296
|
-
},
|
|
297
|
-
];
|
|
298
|
-
|
|
299
|
-
export const caption: Styles = [display("table-caption"), textAlign("center")];
|
|
300
|
-
|
|
301
|
-
export const tr: Styles = [display("table-row"), verticalAlign("inherit")];
|
|
302
|
-
|
|
303
|
-
export const col: Styles = [display("table-column")];
|
|
304
|
-
|
|
305
|
-
export const colgroup: Styles = [display("table-column-group")];
|
|
306
|
-
|
|
307
|
-
export const tbody: Styles = [
|
|
308
|
-
display("table-row-group"),
|
|
309
|
-
verticalAlign("middle"),
|
|
310
|
-
];
|
|
311
|
-
|
|
312
|
-
export const thead: Styles = [
|
|
313
|
-
display("table-header-group"),
|
|
314
|
-
verticalAlign("middle"),
|
|
315
|
-
];
|
|
316
|
-
|
|
317
|
-
export const tfoot: Styles = [
|
|
318
|
-
display("table-footer-group"),
|
|
319
|
-
verticalAlign("middle"),
|
|
320
|
-
];
|
|
321
|
-
|
|
322
|
-
export const td: Styles = [
|
|
323
|
-
display("table-cell"),
|
|
324
|
-
verticalAlign("inherit"),
|
|
325
|
-
paddingTop(1, "px"),
|
|
326
|
-
paddingRight(1, "px"),
|
|
327
|
-
paddingBottom(1, "px"),
|
|
328
|
-
paddingLeft(1, "px"),
|
|
329
|
-
];
|
|
330
|
-
|
|
331
|
-
export const th: Styles = [
|
|
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"),
|
|
339
|
-
];
|
|
340
|
-
|
|
341
|
-
/* inlines */
|
|
342
|
-
|
|
343
|
-
export const b: Styles = [
|
|
344
|
-
// in firefox defined as bolder
|
|
345
|
-
fontWeight("bold"),
|
|
346
|
-
];
|
|
347
|
-
export { b as strong };
|
|
348
|
-
|
|
349
|
-
export const i: Styles = [fontStyle("italic")];
|
|
350
|
-
export { i as cite, i as em, i as var, i as dfn };
|
|
351
|
-
|
|
352
|
-
export const code: Styles = [
|
|
353
|
-
{
|
|
354
|
-
property: "fontFamily",
|
|
355
|
-
// in firefox defined as -moz-fixed
|
|
356
|
-
value: { type: "fontFamily", value: ["monospace"] },
|
|
357
|
-
},
|
|
358
|
-
];
|
|
359
|
-
export { code as kbd, code as samp };
|
|
360
|
-
|
|
361
|
-
export const mark: Styles = [
|
|
362
|
-
{
|
|
363
|
-
property: "backgroundColor",
|
|
364
|
-
// in firefox defined as Mark
|
|
365
|
-
value: { type: "keyword", value: "yellow" },
|
|
366
|
-
},
|
|
367
|
-
// in firefox defined as MarkText
|
|
368
|
-
color("black"),
|
|
369
|
-
];
|
|
370
|
-
|
|
371
|
-
export const u: Styles = [
|
|
372
|
-
{
|
|
373
|
-
property: "textDecorationStyle",
|
|
374
|
-
value: { type: "keyword", value: "underline" },
|
|
375
|
-
},
|
|
376
|
-
];
|
|
377
|
-
export { u as ins };
|
|
378
|
-
|
|
379
|
-
export const s: Styles = [
|
|
380
|
-
{
|
|
381
|
-
property: "textDecorationStyle",
|
|
382
|
-
value: { type: "keyword", value: "line-through" },
|
|
383
|
-
},
|
|
384
|
-
];
|
|
385
|
-
export { s as del };
|
|
386
|
-
|
|
387
|
-
export const sub: Styles = [
|
|
388
|
-
verticalAlign("sub"),
|
|
389
|
-
{
|
|
390
|
-
property: "fontSize",
|
|
391
|
-
value: { type: "keyword", value: "smaller" },
|
|
392
|
-
},
|
|
393
|
-
];
|
|
394
|
-
|
|
395
|
-
export const sup: Styles = [
|
|
396
|
-
verticalAlign("super"),
|
|
397
|
-
{
|
|
398
|
-
property: "fontSize",
|
|
399
|
-
value: { type: "keyword", value: "smaller" },
|
|
400
|
-
},
|
|
401
|
-
];
|
|
402
|
-
|
|
403
|
-
export const a: Styles = [
|
|
404
|
-
{
|
|
405
|
-
property: "textDecorationLine",
|
|
406
|
-
value: { type: "keyword", value: "underline" },
|
|
407
|
-
},
|
|
408
|
-
cursor("pointer"),
|
|
409
|
-
{
|
|
410
|
-
property: "color",
|
|
411
|
-
value: { type: "rgb", r: 0, g: 0, b: 238, alpha: 1 },
|
|
412
|
-
},
|
|
413
|
-
// active and visited states are not defined as usually overriden with stateless color
|
|
414
|
-
// and modeling var-like defaults is too complex
|
|
415
|
-
];
|
|
416
|
-
|
|
417
|
-
/* lists */
|
|
418
|
-
|
|
419
|
-
// nested lists have no top/bottom margins
|
|
420
|
-
// so better redefine statically in preset
|
|
421
|
-
export const ul: Styles = [
|
|
422
|
-
display("block"),
|
|
423
|
-
{
|
|
424
|
-
property: "listStyleType",
|
|
425
|
-
value: { type: "keyword", value: "disc" },
|
|
426
|
-
},
|
|
427
|
-
marginTop(1, "em"),
|
|
428
|
-
marginBottom(1, "em"),
|
|
429
|
-
paddingLeft(40, "px"),
|
|
430
|
-
];
|
|
431
|
-
|
|
432
|
-
export const ol: Styles = [
|
|
433
|
-
display("block"),
|
|
434
|
-
{
|
|
435
|
-
property: "listStyleType",
|
|
436
|
-
value: { type: "keyword", value: "decimal" },
|
|
437
|
-
},
|
|
438
|
-
marginTop(1, "em"),
|
|
439
|
-
marginBottom(1, "em"),
|
|
440
|
-
paddingLeft(40, "px"),
|
|
441
|
-
];
|
|
442
|
-
|
|
443
|
-
export const li: Styles = [display("list-item"), textAlign("match-parent")];
|
|
444
|
-
|
|
445
|
-
/* leafs */
|
|
446
|
-
|
|
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"),
|
|
453
|
-
{
|
|
454
|
-
property: "marginLeft",
|
|
455
|
-
value: { type: "keyword", value: "auto" },
|
|
456
|
-
},
|
|
457
|
-
{
|
|
458
|
-
property: "marginRight",
|
|
459
|
-
value: { type: "keyword", value: "auto" },
|
|
460
|
-
},
|
|
461
|
-
// firefox only
|
|
462
|
-
{
|
|
463
|
-
property: "overflow",
|
|
464
|
-
value: { type: "keyword", value: "hidden" },
|
|
465
|
-
},
|
|
466
|
-
/* This is not really per spec but all browsers define it */
|
|
467
|
-
display("block"),
|
|
468
|
-
];
|
|
469
|
-
|
|
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
|
-
];
|
|
487
|
-
|
|
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" },
|
|
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"),
|
|
572
|
-
{
|
|
573
|
-
property: "overflow",
|
|
574
|
-
value: { type: "keyword", value: "clip" },
|
|
575
|
-
},
|
|
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" },
|
|
594
|
-
},
|
|
595
|
-
];
|
|
596
|
-
|
|
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"),
|
|
612
|
-
{
|
|
613
|
-
property: "backgroundColor",
|
|
614
|
-
// in browsers defined as ButtonFace
|
|
615
|
-
value: { type: "keyword", value: "lightgray" },
|
|
616
|
-
},
|
|
617
|
-
];
|
package/src/index.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { WritableDeep } from "type-fest";
|
|
2
|
-
import type { Html } from "./html";
|
|
3
|
-
import * as exportedHtml from "./html";
|
|
4
|
-
export const html: Html = exportedHtml;
|
|
5
|
-
|
|
6
|
-
export * from "./__generated__/keyword-values";
|
|
7
|
-
export * from "./__generated__/units";
|
|
8
|
-
export {
|
|
9
|
-
properties as propertyDescriptions,
|
|
10
|
-
declarations as declarationDescriptions,
|
|
11
|
-
} from "./__generated__/property-value-descriptions";
|
|
12
|
-
export * from "./schema";
|
|
13
|
-
|
|
14
|
-
// longhand property parsers
|
|
15
|
-
export * from "./property-parsers/index";
|
|
16
|
-
// shorthand property parsers
|
|
17
|
-
export * from "./parse-css-value";
|
|
18
|
-
export * from "./parse-css";
|
|
19
|
-
|
|
20
|
-
import { properties as generatedProperties } from "./__generated__/properties";
|
|
21
|
-
|
|
22
|
-
// convert to writable to avoid conflicts with schema type
|
|
23
|
-
export const properties = generatedProperties as WritableDeep<
|
|
24
|
-
typeof generatedProperties
|
|
25
|
-
>;
|