@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/src/html.ts CHANGED
@@ -16,69 +16,166 @@ export type Html = {
16
16
  [tag in HtmlTags]?: Styles;
17
17
  };
18
18
 
19
- const displayBlock: Styles[number] = {
19
+ const display = (value: string): Styles[number] => ({
20
20
  property: "display",
21
- value: { type: "keyword", value: "block" },
22
- };
21
+ value: { type: "keyword", value },
22
+ });
23
23
 
24
- const mt1em: Styles[number] = {
24
+ const marginTop = (value: number, unit?: "em" | "px"): Styles[number] => ({
25
25
  property: "marginTop",
26
- value: { type: "unit", value: 1, unit: "em" },
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 mb1em: Styles[number] = {
34
+ const marginBottom = (value: number, unit?: "em" | "px"): Styles[number] => ({
30
35
  property: "marginBottom",
31
- value: { type: "unit", value: 1, unit: "em" },
32
- };
36
+ value: { type: "unit", value, unit: unit ?? "number" },
37
+ });
33
38
 
34
- const ml40px: Styles[number] = {
39
+ const marginLeft = (value: number, unit?: "em" | "px"): Styles[number] => ({
35
40
  property: "marginLeft",
36
- value: { type: "unit", value: 40, unit: "px" },
37
- };
41
+ value: { type: "unit", value, unit: unit ?? "number" },
42
+ });
38
43
 
39
- const mr40px: Styles[number] = {
40
- property: "marginRight",
41
- value: { type: "unit", value: 40, unit: "px" },
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 pl40px: Styles[number] = {
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: 40, unit: "px" },
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 fontWeightBold: Styles[number] = {
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: "bold" },
52
- };
76
+ value: { type: "keyword", value },
77
+ });
53
78
 
54
- const fontStyleItalic: Styles[number] = {
79
+ const fontStyle = (value: "italic"): Styles[number] => ({
55
80
  property: "fontStyle",
56
- value: { type: "keyword", value: "italic" },
57
- };
81
+ value: { type: "keyword", value },
82
+ });
58
83
 
59
- const pt1px: Styles[number] = {
60
- property: "paddingTop",
61
- value: { type: "unit", value: 1, unit: "px" },
62
- };
84
+ const textAlign = (value: string): Styles[number] => ({
85
+ property: "textAlign",
86
+ value: { type: "keyword", value },
87
+ });
63
88
 
64
- const pr1px: Styles[number] = {
65
- property: "paddingRight",
66
- value: { type: "unit", value: 1, unit: "px" },
67
- };
89
+ const verticalAlign = (value: string): Styles[number] => ({
90
+ property: "verticalAlign",
91
+ value: { type: "keyword", value },
92
+ });
68
93
 
69
- const pb1px: Styles[number] = {
70
- property: "paddingBottom",
71
- value: { type: "unit", value: 1, unit: "px" },
72
- };
94
+ const whiteSpace = (value: string): Styles[number] => ({
95
+ property: "whiteSpace",
96
+ value: { type: "keyword", value },
97
+ });
73
98
 
74
- const pl1px: Styles[number] = {
75
- property: "paddingLeft",
76
- value: { type: "unit", value: 1, unit: "px" },
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 = [displayBlock];
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
- displayBlock,
101
- {
102
- property: "marginTop",
103
- value: { type: "unit", value: 8, unit: "px" },
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 = [displayBlock, mt1em, mb1em];
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 = [displayBlock, ml40px];
211
+ export const dd: Styles = [display("block"), marginLeft(40, "px")];
123
212
 
124
- export const blockquote: Styles = [displayBlock, mt1em, mb1em, ml40px, mr40px];
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 = [displayBlock, fontStyleItalic];
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
- displayBlock,
133
- fontWeightBold,
134
- {
135
- property: "fontSize",
136
- value: { type: "unit", value: 2, unit: "em" },
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
- displayBlock,
150
- fontWeightBold,
151
- {
152
- property: "fontSize",
153
- value: { type: "unit", value: 1.5, unit: "em" },
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
- displayBlock,
167
- fontWeightBold,
168
- {
169
- property: "fontSize",
170
- value: { type: "unit", value: 1.17, unit: "em" },
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
- displayBlock,
184
- fontWeightBold,
185
- {
186
- property: "marginTop",
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
- displayBlock,
197
- fontWeightBold,
198
- {
199
- property: "fontSize",
200
- value: { type: "unit", value: 0.83, unit: "em" },
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
- displayBlock,
214
- fontWeightBold,
215
- {
216
- property: "fontSize",
217
- value: { type: "unit", value: 0.67, unit: "em" },
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
- displayBlock,
231
- {
232
- property: "whiteSpace",
233
- value: { type: "keyword", value: "pre" },
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: "boxSizing",
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
- property: "display",
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
- property: "display",
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
- property: "display",
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
- property: "display",
336
- value: { type: "keyword", value: "table-cell" },
337
- },
338
- {
339
- property: "verticalAlign",
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
- property: "display",
355
- value: { type: "keyword", value: "table-cell" },
356
- },
357
- {
358
- property: "verticalAlign",
359
- value: { type: "keyword", value: "inherit" },
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
- fontWeightBold,
345
+ fontWeight("bold"),
373
346
  ];
374
347
  export { b as strong };
375
348
 
376
- export const i: Styles = [fontStyleItalic];
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
- property: "color",
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
- displayBlock,
422
+ display("block"),
462
423
  {
463
424
  property: "listStyleType",
464
425
  value: { type: "keyword", value: "disc" },
465
426
  },
466
- mt1em,
467
- mb1em,
468
- pl40px,
427
+ marginTop(1, "em"),
428
+ marginBottom(1, "em"),
429
+ paddingLeft(40, "px"),
469
430
  ];
470
431
 
471
432
  export const ol: Styles = [
472
- displayBlock,
433
+ display("block"),
473
434
  {
474
435
  property: "listStyleType",
475
436
  value: { type: "keyword", value: "decimal" },
476
437
  },
477
- mt1em,
478
- mb1em,
479
- pl40px,
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: "color",
498
- value: { type: "keyword", value: "gray" },
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: "borderBottomWidth",
511
- value: { type: "unit", value: 1, unit: "px" },
458
+ property: "marginRight",
459
+ value: { type: "keyword", value: "auto" },
512
460
  },
461
+ // firefox only
513
462
  {
514
- property: "borderLeftWidth",
515
- value: { type: "unit", value: 1, unit: "px" },
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
- property: "borderTopStyle",
520
- value: { type: "keyword", value: "inset" },
521
- },
522
- {
523
- property: "borderRightStyle",
524
- value: { type: "keyword", value: "inset" },
525
- },
526
- {
527
- property: "borderBottomStyle",
528
- value: { type: "keyword", value: "inset" },
529
- },
530
- {
531
- property: "borderLeftStyle",
532
- value: { type: "keyword", value: "inset" },
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
- property: "marginTop",
537
- value: { type: "unit", value: 0.5, unit: "em" },
538
- },
539
- {
540
- property: "marginBottom",
541
- value: { type: "unit", value: 0.5, unit: "em" },
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: "marginLeft",
545
- value: { type: "keyword", value: "auto" },
573
+ property: "overflow",
574
+ value: { type: "keyword", value: "clip" },
546
575
  },
547
- {
548
- property: "marginRight",
549
- value: { type: "keyword", value: "auto" },
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
- // firefox only
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: "overflow",
555
- value: { type: "keyword", value: "hidden" },
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
  ];