@tamagui/dom 0.0.0-bootstrap.0 → 3.0.0-beta.643.1

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.
Files changed (93) hide show
  1. package/dist/cjs/events.cjs +17 -0
  2. package/dist/cjs/events.native.cjs +19 -0
  3. package/dist/cjs/events.native.js +21 -0
  4. package/dist/cjs/events.native.js.map +1 -0
  5. package/dist/cjs/index.cjs +26 -0
  6. package/dist/cjs/index.native.cjs +28 -0
  7. package/dist/cjs/index.native.js +30 -0
  8. package/dist/cjs/index.native.js.map +1 -0
  9. package/dist/cjs/props.cjs +17 -0
  10. package/dist/cjs/props.native.cjs +19 -0
  11. package/dist/cjs/props.native.js +21 -0
  12. package/dist/cjs/props.native.js.map +1 -0
  13. package/dist/cjs/tables/attributes.cjs +850 -0
  14. package/dist/cjs/tables/attributes.native.cjs +862 -0
  15. package/dist/cjs/tables/attributes.native.js +864 -0
  16. package/dist/cjs/tables/attributes.native.js.map +1 -0
  17. package/dist/cjs/tables/compatibility.cjs +338 -0
  18. package/dist/cjs/tables/compatibility.native.cjs +340 -0
  19. package/dist/cjs/tables/compatibility.native.js +342 -0
  20. package/dist/cjs/tables/compatibility.native.js.map +1 -0
  21. package/dist/cjs/tables/events.cjs +169 -0
  22. package/dist/cjs/tables/events.native.cjs +175 -0
  23. package/dist/cjs/tables/events.native.js +177 -0
  24. package/dist/cjs/tables/events.native.js.map +1 -0
  25. package/dist/cjs/tables/nativeBacking.cjs +133 -0
  26. package/dist/cjs/tables/nativeBacking.native.cjs +135 -0
  27. package/dist/cjs/tables/nativeBacking.native.js +137 -0
  28. package/dist/cjs/tables/nativeBacking.native.js.map +1 -0
  29. package/dist/cjs/tables/tags.cjs +576 -0
  30. package/dist/cjs/tables/tags.native.cjs +578 -0
  31. package/dist/cjs/tables/tags.native.js +580 -0
  32. package/dist/cjs/tables/tags.native.js.map +1 -0
  33. package/dist/cjs/tables/types.cjs +17 -0
  34. package/dist/cjs/tables/types.native.cjs +19 -0
  35. package/dist/cjs/tables/types.native.js +21 -0
  36. package/dist/cjs/tables/types.native.js.map +1 -0
  37. package/dist/esm/events.mjs +0 -0
  38. package/dist/esm/events.native.js +0 -0
  39. package/dist/esm/index.mjs +15 -0
  40. package/dist/esm/index.native.js +15 -0
  41. package/dist/esm/props.mjs +0 -0
  42. package/dist/esm/props.native.js +0 -0
  43. package/dist/esm/tables/attributes.mjs +821 -0
  44. package/dist/esm/tables/attributes.mjs.map +1 -0
  45. package/dist/esm/tables/attributes.native.js +831 -0
  46. package/dist/esm/tables/attributes.native.js.map +1 -0
  47. package/dist/esm/tables/compatibility.mjs +314 -0
  48. package/dist/esm/tables/compatibility.mjs.map +1 -0
  49. package/dist/esm/tables/compatibility.native.js +314 -0
  50. package/dist/esm/tables/compatibility.native.js.map +1 -0
  51. package/dist/esm/tables/events.mjs +145 -0
  52. package/dist/esm/tables/events.mjs.map +1 -0
  53. package/dist/esm/tables/events.native.js +149 -0
  54. package/dist/esm/tables/events.native.js.map +1 -0
  55. package/dist/esm/tables/nativeBacking.mjs +106 -0
  56. package/dist/esm/tables/nativeBacking.mjs.map +1 -0
  57. package/dist/esm/tables/nativeBacking.native.js +106 -0
  58. package/dist/esm/tables/nativeBacking.native.js.map +1 -0
  59. package/dist/esm/tables/tags.mjs +550 -0
  60. package/dist/esm/tables/tags.mjs.map +1 -0
  61. package/dist/esm/tables/tags.native.js +550 -0
  62. package/dist/esm/tables/tags.native.js.map +1 -0
  63. package/dist/esm/tables/types.mjs +0 -0
  64. package/dist/esm/tables/types.native.js +0 -0
  65. package/package.json +57 -7
  66. package/src/events.ts +58 -0
  67. package/src/index.ts +19 -0
  68. package/src/props.ts +699 -0
  69. package/src/tables/attributes.ts +863 -0
  70. package/src/tables/compatibility.ts +360 -0
  71. package/src/tables/events.ts +176 -0
  72. package/src/tables/nativeBacking.ts +132 -0
  73. package/src/tables/tags.ts +557 -0
  74. package/src/tables/types.ts +202 -0
  75. package/types/events.d.ts +58 -0
  76. package/types/events.d.ts.map +11 -0
  77. package/types/index.d.ts +20 -0
  78. package/types/index.d.ts.map +11 -0
  79. package/types/props.d.ts +499 -0
  80. package/types/props.d.ts.map +11 -0
  81. package/types/tables/attributes.d.ts +21 -0
  82. package/types/tables/attributes.d.ts.map +11 -0
  83. package/types/tables/compatibility.d.ts +28 -0
  84. package/types/tables/compatibility.d.ts.map +11 -0
  85. package/types/tables/events.d.ts +5 -0
  86. package/types/tables/events.d.ts.map +11 -0
  87. package/types/tables/nativeBacking.d.ts +28 -0
  88. package/types/tables/nativeBacking.d.ts.map +11 -0
  89. package/types/tables/tags.d.ts +36 -0
  90. package/types/tables/tags.d.ts.map +11 -0
  91. package/types/tables/types.d.ts +135 -0
  92. package/types/tables/types.d.ts.map +11 -0
  93. package/README.md +0 -1
@@ -0,0 +1,557 @@
1
+ import type { DefaultStyle, TagName, TagRow } from './types'
2
+
3
+ /**
4
+ * The tag table: the 49 elements of the Tamagui DOM contract.
5
+ *
6
+ * `display` and `backing` are independent columns. `p` is a block element
7
+ * backed by a native Text, `button` is inline-block backed by a native View.
8
+ * The compiler reads `backing` to inject primitives and `content` to report
9
+ * invalid nesting; the runtime reads the defaults to build each element.
10
+ *
11
+ * Element defaults follow React Strict DOM's resets: an explicit, equal
12
+ * starting point on both platforms instead of the browser default stylesheet on
13
+ * web and nothing on native. Differences from RSD are in `compatibility.ts`.
14
+ */
15
+
16
+ /**
17
+ * Undoes the browser default stylesheet, keyed by `display`, before any tag
18
+ * default. Web only: react native has no default stylesheet to undo, so every
19
+ * key here would be a no-op that still costs a style lookup per element.
20
+ */
21
+ export const DISPLAY_WEB_RESET: Readonly<Record<TagRow['display'], DefaultStyle>> = {
22
+ block: { margin: 0, padding: 0 },
23
+ inline: { margin: 0, padding: 0, textDecorationLine: 'none' },
24
+ 'inline-block': { margin: 0, padding: 0, borderStyle: 'solid' },
25
+ }
26
+
27
+ const MONOSPACE: DefaultStyle = { fontFamily: 'monospace' }
28
+ const HEADING: DefaultStyle = { fontSize: '1.5rem', fontWeight: 'bold' }
29
+
30
+ const NO_FORM_SUBMISSION =
31
+ 'renders as a container on native; there is no form submission, validation or reset'
32
+
33
+ const NO_NATIVE_PICKER =
34
+ 'native has no menu-based select control, so this tag is a native build error'
35
+
36
+ export const TAGS: Readonly<Record<TagName, TagRow>> = {
37
+ a: {
38
+ display: 'inline',
39
+ content: 'phrasing',
40
+ backing: 'text',
41
+ role: 'link',
42
+ element: 'HTMLAnchorElement',
43
+ props: 'anchor',
44
+ web: 'host',
45
+ native: 'polyfill',
46
+ note: 'native has no navigation for href, target, rel, download or referrerPolicy',
47
+ },
48
+ article: {
49
+ display: 'block',
50
+ content: 'flow',
51
+ backing: 'view',
52
+ element: 'HTMLElement',
53
+ props: 'common',
54
+ web: 'host',
55
+ native: 'polyfill',
56
+ },
57
+ aside: {
58
+ display: 'block',
59
+ content: 'flow',
60
+ backing: 'view',
61
+ element: 'HTMLElement',
62
+ props: 'common',
63
+ web: 'host',
64
+ native: 'polyfill',
65
+ },
66
+ b: {
67
+ display: 'inline',
68
+ content: 'phrasing',
69
+ backing: 'text',
70
+ element: 'HTMLElement',
71
+ props: 'common',
72
+ defaults: { fontWeight: 'bold' },
73
+ web: 'host',
74
+ native: 'polyfill',
75
+ },
76
+ bdi: {
77
+ display: 'inline',
78
+ content: 'phrasing',
79
+ backing: 'text',
80
+ element: 'HTMLElement',
81
+ props: 'common',
82
+ web: 'host',
83
+ native: 'polyfill',
84
+ note: 'native has no bidirectional isolation; the text renders in the inherited direction',
85
+ },
86
+ bdo: {
87
+ display: 'inline',
88
+ content: 'phrasing',
89
+ backing: 'text',
90
+ element: 'HTMLElement',
91
+ props: 'common',
92
+ web: 'host',
93
+ native: 'polyfill',
94
+ note: 'native honours dir as a writing direction but does not override embedded bidi runs',
95
+ },
96
+ blockquote: {
97
+ display: 'block',
98
+ content: 'flow',
99
+ backing: 'view',
100
+ element: 'HTMLQuoteElement',
101
+ props: 'common',
102
+ web: 'host',
103
+ native: 'polyfill',
104
+ },
105
+ br: {
106
+ display: 'inline',
107
+ content: 'void',
108
+ backing: 'text',
109
+ element: 'HTMLBRElement',
110
+ props: 'common',
111
+ web: 'host',
112
+ native: 'polyfill',
113
+ },
114
+ button: {
115
+ display: 'inline-block',
116
+ content: 'flow',
117
+ backing: 'view',
118
+ role: 'button',
119
+ element: 'HTMLButtonElement',
120
+ props: 'button',
121
+ defaults: { borderWidth: 1 },
122
+ web: 'host',
123
+ native: 'polyfill',
124
+ note: 'html restricts button content to phrasing; the native backing is a view, so block children are allowed',
125
+ },
126
+ code: {
127
+ display: 'inline',
128
+ content: 'phrasing',
129
+ backing: 'text',
130
+ element: 'HTMLElement',
131
+ props: 'common',
132
+ defaults: MONOSPACE,
133
+ web: 'host',
134
+ native: 'polyfill',
135
+ },
136
+ del: {
137
+ display: 'inline',
138
+ content: 'phrasing',
139
+ backing: 'text',
140
+ element: 'HTMLModElement',
141
+ props: 'common',
142
+ defaults: { textDecorationLine: 'line-through' },
143
+ web: 'host',
144
+ native: 'polyfill',
145
+ },
146
+ div: {
147
+ display: 'block',
148
+ content: 'flow',
149
+ backing: 'view',
150
+ element: 'HTMLDivElement',
151
+ props: 'common',
152
+ web: 'host',
153
+ native: 'polyfill',
154
+ },
155
+ em: {
156
+ display: 'inline',
157
+ content: 'phrasing',
158
+ backing: 'text',
159
+ element: 'HTMLElement',
160
+ props: 'common',
161
+ defaults: { fontStyle: 'italic' },
162
+ web: 'host',
163
+ native: 'polyfill',
164
+ },
165
+ fieldset: {
166
+ display: 'block',
167
+ content: 'flow',
168
+ backing: 'view',
169
+ element: 'HTMLFieldSetElement',
170
+ props: 'common',
171
+ web: 'host',
172
+ native: 'polyfill',
173
+ note: NO_FORM_SUBMISSION,
174
+ },
175
+ footer: {
176
+ display: 'block',
177
+ content: 'flow',
178
+ backing: 'view',
179
+ element: 'HTMLElement',
180
+ props: 'common',
181
+ web: 'host',
182
+ native: 'polyfill',
183
+ },
184
+ form: {
185
+ display: 'block',
186
+ content: 'flow',
187
+ backing: 'view',
188
+ element: 'HTMLFormElement',
189
+ props: 'common',
190
+ web: 'host',
191
+ native: 'polyfill',
192
+ note: NO_FORM_SUBMISSION,
193
+ },
194
+ h1: {
195
+ display: 'block',
196
+ content: 'phrasing',
197
+ backing: 'text',
198
+ role: 'heading',
199
+ element: 'HTMLHeadingElement',
200
+ props: 'common',
201
+ defaults: HEADING,
202
+ web: 'host',
203
+ native: 'polyfill',
204
+ },
205
+ h2: {
206
+ display: 'block',
207
+ content: 'phrasing',
208
+ backing: 'text',
209
+ role: 'heading',
210
+ element: 'HTMLHeadingElement',
211
+ props: 'common',
212
+ defaults: HEADING,
213
+ web: 'host',
214
+ native: 'polyfill',
215
+ },
216
+ h3: {
217
+ display: 'block',
218
+ content: 'phrasing',
219
+ backing: 'text',
220
+ role: 'heading',
221
+ element: 'HTMLHeadingElement',
222
+ props: 'common',
223
+ defaults: HEADING,
224
+ web: 'host',
225
+ native: 'polyfill',
226
+ },
227
+ h4: {
228
+ display: 'block',
229
+ content: 'phrasing',
230
+ backing: 'text',
231
+ role: 'heading',
232
+ element: 'HTMLHeadingElement',
233
+ props: 'common',
234
+ defaults: HEADING,
235
+ web: 'host',
236
+ native: 'polyfill',
237
+ },
238
+ h5: {
239
+ display: 'block',
240
+ content: 'phrasing',
241
+ backing: 'text',
242
+ role: 'heading',
243
+ element: 'HTMLHeadingElement',
244
+ props: 'common',
245
+ defaults: HEADING,
246
+ web: 'host',
247
+ native: 'polyfill',
248
+ },
249
+ h6: {
250
+ display: 'block',
251
+ content: 'phrasing',
252
+ backing: 'text',
253
+ role: 'heading',
254
+ element: 'HTMLHeadingElement',
255
+ props: 'common',
256
+ defaults: HEADING,
257
+ web: 'host',
258
+ native: 'polyfill',
259
+ },
260
+ header: {
261
+ display: 'block',
262
+ content: 'flow',
263
+ backing: 'view',
264
+ role: 'header',
265
+ element: 'HTMLElement',
266
+ props: 'common',
267
+ web: 'host',
268
+ native: 'polyfill',
269
+ },
270
+ hr: {
271
+ display: 'block',
272
+ content: 'void',
273
+ backing: 'view',
274
+ element: 'HTMLHRElement',
275
+ props: 'common',
276
+ defaults: { backgroundColor: 'black', height: 1 },
277
+ web: 'host',
278
+ native: 'polyfill',
279
+ },
280
+ i: {
281
+ display: 'inline',
282
+ content: 'phrasing',
283
+ backing: 'text',
284
+ element: 'HTMLElement',
285
+ props: 'common',
286
+ defaults: { fontStyle: 'italic' },
287
+ web: 'host',
288
+ native: 'polyfill',
289
+ },
290
+ img: {
291
+ display: 'inline',
292
+ content: 'void',
293
+ backing: 'image',
294
+ element: 'HTMLImageElement',
295
+ props: 'image',
296
+ defaults: { objectFit: 'fill' },
297
+ web: 'host',
298
+ native: 'polyfill',
299
+ note: 'width and height props set an aspect ratio on native, where images have no intrinsic layout size until they load',
300
+ },
301
+ input: {
302
+ display: 'inline-block',
303
+ content: 'void',
304
+ backing: 'textinput',
305
+ element: 'HTMLInputElement',
306
+ props: 'input',
307
+ defaults: { borderWidth: 1 },
308
+ web: 'host',
309
+ native: 'polyfill',
310
+ note: 'native supports the text-like input types only; checkbox, color, date, datetime-local, file, month, radio, range, time and week are a native build error',
311
+ },
312
+ ins: {
313
+ display: 'inline',
314
+ content: 'phrasing',
315
+ backing: 'text',
316
+ element: 'HTMLModElement',
317
+ props: 'common',
318
+ defaults: { textDecorationLine: 'underline' },
319
+ web: 'host',
320
+ native: 'polyfill',
321
+ },
322
+ kbd: {
323
+ display: 'inline',
324
+ content: 'phrasing',
325
+ backing: 'text',
326
+ element: 'HTMLElement',
327
+ props: 'common',
328
+ defaults: MONOSPACE,
329
+ web: 'host',
330
+ native: 'polyfill',
331
+ },
332
+ label: {
333
+ display: 'inline',
334
+ content: 'phrasing',
335
+ backing: 'text',
336
+ element: 'HTMLLabelElement',
337
+ props: 'label',
338
+ web: 'host',
339
+ native: 'polyfill',
340
+ note: 'native has no label association, so `for` does not focus or activate its control',
341
+ },
342
+ li: {
343
+ display: 'block',
344
+ content: 'flow',
345
+ backing: 'view',
346
+ role: 'listitem',
347
+ element: 'HTMLLIElement',
348
+ props: 'listitem',
349
+ web: 'host',
350
+ native: 'polyfill',
351
+ note: 'list markers and the `value` counter are not rendered on either platform, matching the list-style reset',
352
+ },
353
+ main: {
354
+ display: 'block',
355
+ content: 'flow',
356
+ backing: 'view',
357
+ element: 'HTMLElement',
358
+ props: 'common',
359
+ web: 'host',
360
+ native: 'polyfill',
361
+ },
362
+ mark: {
363
+ display: 'inline',
364
+ content: 'phrasing',
365
+ backing: 'text',
366
+ element: 'HTMLElement',
367
+ props: 'common',
368
+ defaults: { backgroundColor: 'yellow', color: 'black' },
369
+ web: 'host',
370
+ native: 'polyfill',
371
+ },
372
+ nav: {
373
+ display: 'block',
374
+ content: 'flow',
375
+ backing: 'view',
376
+ element: 'HTMLElement',
377
+ props: 'common',
378
+ web: 'host',
379
+ native: 'polyfill',
380
+ },
381
+ ol: {
382
+ display: 'block',
383
+ content: 'tags',
384
+ childTags: ['li'],
385
+ backing: 'view',
386
+ role: 'list',
387
+ element: 'HTMLOListElement',
388
+ props: 'common',
389
+ web: 'host',
390
+ native: 'polyfill',
391
+ },
392
+ optgroup: {
393
+ display: 'block',
394
+ content: 'tags',
395
+ childTags: ['option'],
396
+ backing: 'view',
397
+ element: 'HTMLOptGroupElement',
398
+ props: 'optgroup',
399
+ web: 'host',
400
+ native: 'none',
401
+ note: NO_NATIVE_PICKER,
402
+ },
403
+ option: {
404
+ display: 'block',
405
+ content: 'text',
406
+ backing: 'text',
407
+ element: 'HTMLOptionElement',
408
+ props: 'option',
409
+ web: 'host',
410
+ native: 'none',
411
+ note: NO_NATIVE_PICKER,
412
+ },
413
+ p: {
414
+ display: 'block',
415
+ content: 'phrasing',
416
+ backing: 'text',
417
+ element: 'HTMLParagraphElement',
418
+ props: 'common',
419
+ web: 'host',
420
+ native: 'polyfill',
421
+ },
422
+ pre: {
423
+ display: 'block',
424
+ content: 'phrasing',
425
+ backing: 'text',
426
+ element: 'HTMLPreElement',
427
+ props: 'common',
428
+ defaults: MONOSPACE,
429
+ web: 'host',
430
+ native: 'polyfill',
431
+ note: 'native preserves whitespace in text but has no scroll container, so long lines wrap instead of scrolling',
432
+ },
433
+ s: {
434
+ display: 'inline',
435
+ content: 'phrasing',
436
+ backing: 'text',
437
+ element: 'HTMLElement',
438
+ props: 'common',
439
+ defaults: { textDecorationLine: 'line-through' },
440
+ web: 'host',
441
+ native: 'polyfill',
442
+ },
443
+ section: {
444
+ display: 'block',
445
+ content: 'flow',
446
+ backing: 'view',
447
+ element: 'HTMLElement',
448
+ props: 'common',
449
+ web: 'host',
450
+ native: 'polyfill',
451
+ },
452
+ select: {
453
+ display: 'inline-block',
454
+ content: 'tags',
455
+ childTags: ['optgroup', 'option'],
456
+ backing: 'view',
457
+ element: 'HTMLSelectElement',
458
+ props: 'select',
459
+ web: 'host',
460
+ native: 'none',
461
+ note: NO_NATIVE_PICKER,
462
+ },
463
+ span: {
464
+ display: 'inline',
465
+ content: 'phrasing',
466
+ backing: 'text',
467
+ element: 'HTMLSpanElement',
468
+ props: 'common',
469
+ web: 'host',
470
+ native: 'polyfill',
471
+ },
472
+ strong: {
473
+ display: 'inline',
474
+ content: 'phrasing',
475
+ backing: 'text',
476
+ element: 'HTMLElement',
477
+ props: 'common',
478
+ defaults: { fontWeight: 'bold' },
479
+ web: 'host',
480
+ native: 'polyfill',
481
+ },
482
+ sub: {
483
+ display: 'inline',
484
+ content: 'phrasing',
485
+ backing: 'text',
486
+ element: 'HTMLElement',
487
+ props: 'common',
488
+ web: 'host',
489
+ native: 'polyfill',
490
+ note: 'native has no vertical-align, so subscript text sits on the baseline',
491
+ },
492
+ sup: {
493
+ display: 'inline',
494
+ content: 'phrasing',
495
+ backing: 'text',
496
+ element: 'HTMLElement',
497
+ props: 'common',
498
+ web: 'host',
499
+ native: 'polyfill',
500
+ note: 'native has no vertical-align, so superscript text sits on the baseline',
501
+ },
502
+ textarea: {
503
+ display: 'inline-block',
504
+ content: 'void',
505
+ backing: 'textinput',
506
+ element: 'HTMLTextAreaElement',
507
+ props: 'textarea',
508
+ defaults: { borderWidth: 1 },
509
+ nativeDefaults: { verticalAlign: 'top' },
510
+ web: 'host',
511
+ native: 'polyfill',
512
+ note: 'the value comes from value or defaultValue; children are a build error on both platforms',
513
+ },
514
+ u: {
515
+ display: 'inline',
516
+ content: 'phrasing',
517
+ backing: 'text',
518
+ element: 'HTMLElement',
519
+ props: 'common',
520
+ defaults: { textDecorationLine: 'underline' },
521
+ web: 'host',
522
+ native: 'polyfill',
523
+ },
524
+ ul: {
525
+ display: 'block',
526
+ content: 'tags',
527
+ childTags: ['li'],
528
+ backing: 'view',
529
+ role: 'list',
530
+ element: 'HTMLUListElement',
531
+ props: 'common',
532
+ web: 'host',
533
+ native: 'polyfill',
534
+ },
535
+ }
536
+
537
+ /**
538
+ * Web-only defaults: undoing a browser default, or a property with no
539
+ * cross-platform spelling. `fontSize: 1em` cancels the browser's smaller
540
+ * default size for monospace text, which is the whole reason the browser
541
+ * renders `code`, `kbd` and `pre` at a different size from their surroundings.
542
+ *
543
+ * Everything here has to be a style property Tamagui actually resolves. A key
544
+ * Tamagui does not know is not a silent no-op — it falls through to the element
545
+ * as an attribute, which is a react warning and no styling. `list-style`,
546
+ * `resize` and `overflow-wrap` are all in that category today, which is why
547
+ * they are absent and recorded in `compatibility.ts` instead.
548
+ */
549
+ export const TAG_WEB_DEFAULTS: Readonly<Partial<Record<TagName, DefaultStyle>>> = {
550
+ code: { fontSize: '1em' },
551
+ hr: { borderStyle: 'none', borderWidth: 0, boxSizing: 'border-box' },
552
+ img: { height: 'auto', maxWidth: '100%' },
553
+ kbd: { fontSize: '1em' },
554
+ pre: { fontSize: '1em', overflow: 'auto' },
555
+ }
556
+
557
+ export const TAG_NAMES: readonly TagName[] = Object.keys(TAGS) as TagName[]