@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.
- package/dist/cjs/events.cjs +17 -0
- package/dist/cjs/events.native.cjs +19 -0
- package/dist/cjs/events.native.js +21 -0
- package/dist/cjs/events.native.js.map +1 -0
- package/dist/cjs/index.cjs +26 -0
- package/dist/cjs/index.native.cjs +28 -0
- package/dist/cjs/index.native.js +30 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/cjs/props.cjs +17 -0
- package/dist/cjs/props.native.cjs +19 -0
- package/dist/cjs/props.native.js +21 -0
- package/dist/cjs/props.native.js.map +1 -0
- package/dist/cjs/tables/attributes.cjs +850 -0
- package/dist/cjs/tables/attributes.native.cjs +862 -0
- package/dist/cjs/tables/attributes.native.js +864 -0
- package/dist/cjs/tables/attributes.native.js.map +1 -0
- package/dist/cjs/tables/compatibility.cjs +338 -0
- package/dist/cjs/tables/compatibility.native.cjs +340 -0
- package/dist/cjs/tables/compatibility.native.js +342 -0
- package/dist/cjs/tables/compatibility.native.js.map +1 -0
- package/dist/cjs/tables/events.cjs +169 -0
- package/dist/cjs/tables/events.native.cjs +175 -0
- package/dist/cjs/tables/events.native.js +177 -0
- package/dist/cjs/tables/events.native.js.map +1 -0
- package/dist/cjs/tables/nativeBacking.cjs +133 -0
- package/dist/cjs/tables/nativeBacking.native.cjs +135 -0
- package/dist/cjs/tables/nativeBacking.native.js +137 -0
- package/dist/cjs/tables/nativeBacking.native.js.map +1 -0
- package/dist/cjs/tables/tags.cjs +576 -0
- package/dist/cjs/tables/tags.native.cjs +578 -0
- package/dist/cjs/tables/tags.native.js +580 -0
- package/dist/cjs/tables/tags.native.js.map +1 -0
- package/dist/cjs/tables/types.cjs +17 -0
- package/dist/cjs/tables/types.native.cjs +19 -0
- package/dist/cjs/tables/types.native.js +21 -0
- package/dist/cjs/tables/types.native.js.map +1 -0
- package/dist/esm/events.mjs +0 -0
- package/dist/esm/events.native.js +0 -0
- package/dist/esm/index.mjs +15 -0
- package/dist/esm/index.native.js +15 -0
- package/dist/esm/props.mjs +0 -0
- package/dist/esm/props.native.js +0 -0
- package/dist/esm/tables/attributes.mjs +821 -0
- package/dist/esm/tables/attributes.mjs.map +1 -0
- package/dist/esm/tables/attributes.native.js +831 -0
- package/dist/esm/tables/attributes.native.js.map +1 -0
- package/dist/esm/tables/compatibility.mjs +314 -0
- package/dist/esm/tables/compatibility.mjs.map +1 -0
- package/dist/esm/tables/compatibility.native.js +314 -0
- package/dist/esm/tables/compatibility.native.js.map +1 -0
- package/dist/esm/tables/events.mjs +145 -0
- package/dist/esm/tables/events.mjs.map +1 -0
- package/dist/esm/tables/events.native.js +149 -0
- package/dist/esm/tables/events.native.js.map +1 -0
- package/dist/esm/tables/nativeBacking.mjs +106 -0
- package/dist/esm/tables/nativeBacking.mjs.map +1 -0
- package/dist/esm/tables/nativeBacking.native.js +106 -0
- package/dist/esm/tables/nativeBacking.native.js.map +1 -0
- package/dist/esm/tables/tags.mjs +550 -0
- package/dist/esm/tables/tags.mjs.map +1 -0
- package/dist/esm/tables/tags.native.js +550 -0
- package/dist/esm/tables/tags.native.js.map +1 -0
- package/dist/esm/tables/types.mjs +0 -0
- package/dist/esm/tables/types.native.js +0 -0
- package/package.json +57 -7
- package/src/events.ts +58 -0
- package/src/index.ts +19 -0
- package/src/props.ts +699 -0
- package/src/tables/attributes.ts +863 -0
- package/src/tables/compatibility.ts +360 -0
- package/src/tables/events.ts +176 -0
- package/src/tables/nativeBacking.ts +132 -0
- package/src/tables/tags.ts +557 -0
- package/src/tables/types.ts +202 -0
- package/types/events.d.ts +58 -0
- package/types/events.d.ts.map +11 -0
- package/types/index.d.ts +20 -0
- package/types/index.d.ts.map +11 -0
- package/types/props.d.ts +499 -0
- package/types/props.d.ts.map +11 -0
- package/types/tables/attributes.d.ts +21 -0
- package/types/tables/attributes.d.ts.map +11 -0
- package/types/tables/compatibility.d.ts +28 -0
- package/types/tables/compatibility.d.ts.map +11 -0
- package/types/tables/events.d.ts +5 -0
- package/types/tables/events.d.ts.map +11 -0
- package/types/tables/nativeBacking.d.ts +28 -0
- package/types/tables/nativeBacking.d.ts.map +11 -0
- package/types/tables/tags.d.ts +36 -0
- package/types/tables/tags.d.ts.map +11 -0
- package/types/tables/types.d.ts +135 -0
- package/types/tables/types.d.ts.map +11 -0
- package/README.md +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Row types for the Tamagui DOM contract tables.
|
|
3
|
+
*
|
|
4
|
+
* The tables are the source of truth for the whole DOM lane: the compiler reads
|
|
5
|
+
* them to classify tags, validate props and nesting, and inject native
|
|
6
|
+
* primitives; the runtime reads them for element defaults and native mapping;
|
|
7
|
+
* the type generator reads them to emit the strict prop interfaces.
|
|
8
|
+
*
|
|
9
|
+
* React Strict DOM is the semantic reference and conformance oracle for these
|
|
10
|
+
* tables (see `rsd-snapshot.json` and `compatibility.ts`), never a dependency.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** every tag in the DOM contract, matching the 49 elements RSD exposes */
|
|
14
|
+
export type TagName =
|
|
15
|
+
| 'a'
|
|
16
|
+
| 'article'
|
|
17
|
+
| 'aside'
|
|
18
|
+
| 'b'
|
|
19
|
+
| 'bdi'
|
|
20
|
+
| 'bdo'
|
|
21
|
+
| 'blockquote'
|
|
22
|
+
| 'br'
|
|
23
|
+
| 'button'
|
|
24
|
+
| 'code'
|
|
25
|
+
| 'del'
|
|
26
|
+
| 'div'
|
|
27
|
+
| 'em'
|
|
28
|
+
| 'fieldset'
|
|
29
|
+
| 'footer'
|
|
30
|
+
| 'form'
|
|
31
|
+
| 'h1'
|
|
32
|
+
| 'h2'
|
|
33
|
+
| 'h3'
|
|
34
|
+
| 'h4'
|
|
35
|
+
| 'h5'
|
|
36
|
+
| 'h6'
|
|
37
|
+
| 'header'
|
|
38
|
+
| 'hr'
|
|
39
|
+
| 'i'
|
|
40
|
+
| 'img'
|
|
41
|
+
| 'input'
|
|
42
|
+
| 'ins'
|
|
43
|
+
| 'kbd'
|
|
44
|
+
| 'label'
|
|
45
|
+
| 'li'
|
|
46
|
+
| 'main'
|
|
47
|
+
| 'mark'
|
|
48
|
+
| 'nav'
|
|
49
|
+
| 'ol'
|
|
50
|
+
| 'optgroup'
|
|
51
|
+
| 'option'
|
|
52
|
+
| 'p'
|
|
53
|
+
| 'pre'
|
|
54
|
+
| 's'
|
|
55
|
+
| 'section'
|
|
56
|
+
| 'select'
|
|
57
|
+
| 'span'
|
|
58
|
+
| 'strong'
|
|
59
|
+
| 'sub'
|
|
60
|
+
| 'sup'
|
|
61
|
+
| 'textarea'
|
|
62
|
+
| 'u'
|
|
63
|
+
| 'ul'
|
|
64
|
+
|
|
65
|
+
/** native primitive a tag lowers to, injected by the compiler */
|
|
66
|
+
export type NativeBacking = 'view' | 'text' | 'image' | 'textinput'
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* How much of a feature survives on a platform.
|
|
70
|
+
*
|
|
71
|
+
* - `host`: the platform primitive implements it, we forward the value
|
|
72
|
+
* - `polyfill`: we implement it in the DOM layer on top of the primitive
|
|
73
|
+
* - `none`: unsupported, and using it is a compile diagnostic
|
|
74
|
+
*/
|
|
75
|
+
export type Support = 'host' | 'polyfill' | 'none'
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* What a tag may contain, driving the compile-time nesting diagnostic.
|
|
79
|
+
*
|
|
80
|
+
* - `flow`: block or phrasing children
|
|
81
|
+
* - `phrasing`: phrasing children only, so a block child is an error
|
|
82
|
+
* - `text`: text children only
|
|
83
|
+
* - `void`: no children at all
|
|
84
|
+
* - `tags`: only the tags in `childTags`
|
|
85
|
+
*/
|
|
86
|
+
export type ContentModel = 'flow' | 'phrasing' | 'text' | 'void' | 'tags'
|
|
87
|
+
|
|
88
|
+
/** the generated props interface a tag uses */
|
|
89
|
+
export type PropsGroup =
|
|
90
|
+
| 'common'
|
|
91
|
+
| 'anchor'
|
|
92
|
+
| 'button'
|
|
93
|
+
| 'image'
|
|
94
|
+
| 'input'
|
|
95
|
+
| 'label'
|
|
96
|
+
| 'listitem'
|
|
97
|
+
| 'optgroup'
|
|
98
|
+
| 'option'
|
|
99
|
+
| 'select'
|
|
100
|
+
| 'textarea'
|
|
101
|
+
|
|
102
|
+
/** a style record expressed in Tamagui style-prop terms, valid on both platforms */
|
|
103
|
+
export type DefaultStyle = Readonly<Record<string, string | number>>
|
|
104
|
+
|
|
105
|
+
export type TagRow = {
|
|
106
|
+
/** css display from the browser default stylesheet; native emulates it */
|
|
107
|
+
display: 'block' | 'inline' | 'inline-block'
|
|
108
|
+
content: ContentModel
|
|
109
|
+
/** the only permitted children, when `content` is `tags` */
|
|
110
|
+
childTags?: readonly TagName[]
|
|
111
|
+
backing: NativeBacking
|
|
112
|
+
/** implicit aria role the browser gives the tag, applied explicitly on native */
|
|
113
|
+
role?: string
|
|
114
|
+
/** dom interface a ref resolves to */
|
|
115
|
+
element: string
|
|
116
|
+
props: PropsGroup
|
|
117
|
+
/** element defaults applied on both platforms, before author styles */
|
|
118
|
+
defaults?: DefaultStyle
|
|
119
|
+
/** extra defaults native needs to reach the same result as the browser */
|
|
120
|
+
nativeDefaults?: DefaultStyle
|
|
121
|
+
web: Support
|
|
122
|
+
native: Support
|
|
123
|
+
/** why support is limited, surfaced verbatim by the compiler diagnostic */
|
|
124
|
+
note?: string
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** which tags accept a prop: `*` for all of them */
|
|
128
|
+
export type PropTags = '*' | readonly TagName[]
|
|
129
|
+
|
|
130
|
+
export type AttributeRow = {
|
|
131
|
+
/**
|
|
132
|
+
* - `aria`: an `aria-*` accessibility prop
|
|
133
|
+
* - `global`: an html prop every tag accepts
|
|
134
|
+
* - `element`: an html prop specific to some tags
|
|
135
|
+
* - `data`: `data-*` passthrough
|
|
136
|
+
* - `frontend`: supplied by the styling frontend, not generated as an attribute
|
|
137
|
+
* - `react`: a React prop with no html attribute behind it
|
|
138
|
+
*/
|
|
139
|
+
group: 'aria' | 'global' | 'element' | 'data' | 'frontend' | 'react'
|
|
140
|
+
tags: PropTags
|
|
141
|
+
/** typescript source for the generated prop type, for every tag `perTag` omits */
|
|
142
|
+
type?: string
|
|
143
|
+
/**
|
|
144
|
+
* Per-tag overrides, for props that genuinely differ by element: `type` on a
|
|
145
|
+
* button is not `type` on an input, and the `value` counter note is about
|
|
146
|
+
* `li` alone. Every tag the row accepts has to end up with a type, from here
|
|
147
|
+
* or from `type`; an override with no `type` just narrows the note.
|
|
148
|
+
*/
|
|
149
|
+
perTag?: Readonly<Partial<Record<TagName, { type?: string; note?: string }>>>
|
|
150
|
+
/** react native prop this lowers to, null when nothing carries it */
|
|
151
|
+
nativeProp: string | null
|
|
152
|
+
web: Support
|
|
153
|
+
native: Support
|
|
154
|
+
note?: string
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export type EventRow = {
|
|
158
|
+
tags: PropTags
|
|
159
|
+
/**
|
|
160
|
+
* typescript source for the handler argument. Opaque handlers receive the raw
|
|
161
|
+
* platform event, which differs per platform, so they take `unknown`.
|
|
162
|
+
*/
|
|
163
|
+
payload: string
|
|
164
|
+
/** react native prop this lowers to, null when nothing carries it */
|
|
165
|
+
nativeProp: string | null
|
|
166
|
+
web: Support
|
|
167
|
+
native: Support
|
|
168
|
+
note?: string
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export type NativeBackingRow = {
|
|
172
|
+
/** primitive exported from `@tamagui/dom/native`, injected by the compiler */
|
|
173
|
+
primitive: string
|
|
174
|
+
/** react native host component the primitive renders */
|
|
175
|
+
host: string
|
|
176
|
+
/** tags this backing serves */
|
|
177
|
+
tags: readonly TagName[]
|
|
178
|
+
/** direct literal string children are wrapped at compile time for these */
|
|
179
|
+
wrapsLiteralText: boolean
|
|
180
|
+
note: string
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** an intentional difference from the pinned React Strict DOM reference */
|
|
184
|
+
export type CompatibilityRow = {
|
|
185
|
+
area: 'tag' | 'prop' | 'event' | 'style' | 'ref' | 'behavior'
|
|
186
|
+
/** what differs, spelled as it appears in source */
|
|
187
|
+
subject: string
|
|
188
|
+
/**
|
|
189
|
+
* The identifiers the conformance test matches this row against: prop names
|
|
190
|
+
* for `prop` and `event`, tag names for `tag`, `tag.styleKey` for `style`
|
|
191
|
+
* (`web.` or `native.` prefixed). The test fails on any difference from the
|
|
192
|
+
* RSD snapshot that no row claims, and on any key no longer different, so a
|
|
193
|
+
* row cannot silently go stale. Empty for a difference with no identifier the
|
|
194
|
+
* snapshot can see, which the snapshot therefore cannot check.
|
|
195
|
+
*/
|
|
196
|
+
keys: readonly string[]
|
|
197
|
+
/** what the pinned RSD release does */
|
|
198
|
+
rsd: string
|
|
199
|
+
/** what Tamagui DOM does */
|
|
200
|
+
tamagui: string
|
|
201
|
+
reason: string
|
|
202
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Event payloads for the Tamagui DOM contract.
|
|
3
|
+
*
|
|
4
|
+
* Only the cross-platform subset is typed. Where an event's shape genuinely
|
|
5
|
+
* differs between a browser event and a react native synthetic event, the
|
|
6
|
+
* handler takes `unknown` rather than promising a shape one platform cannot
|
|
7
|
+
* deliver — `payload: 'unknown'` in the event table. These are the payloads a
|
|
8
|
+
* native primitive can construct in full, so a handler written against them
|
|
9
|
+
* behaves the same on both platforms.
|
|
10
|
+
*
|
|
11
|
+
* Extra platform fields are not excluded: a handler receives a value, and
|
|
12
|
+
* TypeScript only seals object literals, so reading a web-only field off the
|
|
13
|
+
* event still needs a cast and still says so at the call site.
|
|
14
|
+
*/
|
|
15
|
+
export type DOMClickEvent = {
|
|
16
|
+
readonly altKey: boolean;
|
|
17
|
+
readonly button: number;
|
|
18
|
+
readonly ctrlKey: boolean;
|
|
19
|
+
readonly defaultPrevented: boolean;
|
|
20
|
+
readonly getModifierState: (key: string) => boolean;
|
|
21
|
+
readonly metaKey: boolean;
|
|
22
|
+
readonly pageX: number;
|
|
23
|
+
readonly pageY: number;
|
|
24
|
+
/** @platform web — native has nothing to cancel, so this is a no-op there */
|
|
25
|
+
readonly preventDefault: () => void;
|
|
26
|
+
readonly shiftKey: boolean;
|
|
27
|
+
/** @platform web — native has nothing to cancel, so this is a no-op there */
|
|
28
|
+
readonly stopPropagation: () => void;
|
|
29
|
+
readonly type: "click";
|
|
30
|
+
};
|
|
31
|
+
export type DOMKeyEvent = {
|
|
32
|
+
readonly key: string;
|
|
33
|
+
readonly type?: string;
|
|
34
|
+
};
|
|
35
|
+
export type DOMChangeEvent = {
|
|
36
|
+
readonly target: {
|
|
37
|
+
readonly value: string;
|
|
38
|
+
};
|
|
39
|
+
readonly type: "change";
|
|
40
|
+
};
|
|
41
|
+
export type DOMInputEvent = {
|
|
42
|
+
readonly target: {
|
|
43
|
+
readonly value: string;
|
|
44
|
+
};
|
|
45
|
+
readonly type: "input";
|
|
46
|
+
};
|
|
47
|
+
export type DOMImageLoadEvent = {
|
|
48
|
+
readonly target: {
|
|
49
|
+
readonly naturalHeight?: number;
|
|
50
|
+
readonly naturalWidth?: number;
|
|
51
|
+
};
|
|
52
|
+
readonly type: "load";
|
|
53
|
+
};
|
|
54
|
+
export type DOMImageErrorEvent = {
|
|
55
|
+
readonly type: "error";
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": ";;;;;;;;;;;;;;AAeA,YAAY,gBAAgB;UACjB;UACA;UACA;UACA;UACA,mBAAmB;UACnB;UACA;UACA;;UAEA;UACA;;UAEA;UACA,MAAM;;AAGjB,YAAY,cAAc;UACf;UACA;;AAGX,YAAY,iBAAiB;UAClB,QAAQ;WAAW;;UACnB,MAAM;;AAGjB,YAAY,gBAAgB;UACjB,QAAQ;WAAW;;UACnB,MAAM;;AAGjB,YAAY,oBAAoB;UACrB,QAAQ;WACN;WACA;;UAEF,MAAM;;AAGjB,YAAY,qBAAqB;UACtB,MAAM",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/events.ts"
|
|
6
|
+
],
|
|
7
|
+
"version": 3,
|
|
8
|
+
"sourcesContent": [
|
|
9
|
+
"/**\n * Event payloads for the Tamagui DOM contract.\n *\n * Only the cross-platform subset is typed. Where an event's shape genuinely\n * differs between a browser event and a react native synthetic event, the\n * handler takes `unknown` rather than promising a shape one platform cannot\n * deliver — `payload: 'unknown'` in the event table. These are the payloads a\n * native primitive can construct in full, so a handler written against them\n * behaves the same on both platforms.\n *\n * Extra platform fields are not excluded: a handler receives a value, and\n * TypeScript only seals object literals, so reading a web-only field off the\n * event still needs a cast and still says so at the call site.\n */\n\nexport type DOMClickEvent = {\n readonly altKey: boolean\n readonly button: number\n readonly ctrlKey: boolean\n readonly defaultPrevented: boolean\n readonly getModifierState: (key: string) => boolean\n readonly metaKey: boolean\n readonly pageX: number\n readonly pageY: number\n /** @platform web — native has nothing to cancel, so this is a no-op there */\n readonly preventDefault: () => void\n readonly shiftKey: boolean\n /** @platform web — native has nothing to cancel, so this is a no-op there */\n readonly stopPropagation: () => void\n readonly type: 'click'\n}\n\nexport type DOMKeyEvent = {\n readonly key: string\n readonly type?: string\n}\n\nexport type DOMChangeEvent = {\n readonly target: { readonly value: string }\n readonly type: 'change'\n}\n\nexport type DOMInputEvent = {\n readonly target: { readonly value: string }\n readonly type: 'input'\n}\n\nexport type DOMImageLoadEvent = {\n readonly target: {\n readonly naturalHeight?: number\n readonly naturalWidth?: number\n }\n readonly type: 'load'\n}\n\nexport type DOMImageErrorEvent = {\n readonly type: 'error'\n}\n"
|
|
10
|
+
]
|
|
11
|
+
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@tamagui/dom` — the Tamagui DOM contract.
|
|
3
|
+
*
|
|
4
|
+
* The tables here are the single source of truth for DOM mode: the compiler
|
|
5
|
+
* reads them to classify tags, validate props and nesting and inject native
|
|
6
|
+
* primitives, the runtime reads them for element defaults and native prop
|
|
7
|
+
* mapping, and the prop-interface generator reads them to emit the strict
|
|
8
|
+
* types. React Strict DOM is the semantic reference and conformance oracle
|
|
9
|
+
* (see `compatibility.ts`), never a dependency.
|
|
10
|
+
*/
|
|
11
|
+
export * from "./events";
|
|
12
|
+
export * from "./props";
|
|
13
|
+
export * from "./tables/attributes";
|
|
14
|
+
export * from "./tables/compatibility";
|
|
15
|
+
export * from "./tables/events";
|
|
16
|
+
export * from "./tables/nativeBacking";
|
|
17
|
+
export * from "./tables/tags";
|
|
18
|
+
export * from "./tables/types";
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mappings": ";;;;;;;;;;AAWA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc",
|
|
3
|
+
"names": [],
|
|
4
|
+
"sources": [
|
|
5
|
+
"src/index.ts"
|
|
6
|
+
],
|
|
7
|
+
"version": 3,
|
|
8
|
+
"sourcesContent": [
|
|
9
|
+
"/**\n * `@tamagui/dom` — the Tamagui DOM contract.\n *\n * The tables here are the single source of truth for DOM mode: the compiler\n * reads them to classify tags, validate props and nesting and inject native\n * primitives, the runtime reads them for element defaults and native prop\n * mapping, and the prop-interface generator reads them to emit the strict\n * types. React Strict DOM is the semantic reference and conformance oracle\n * (see `compatibility.ts`), never a dependency.\n */\n\nexport * from './events'\nexport * from './props'\nexport * from './tables/attributes'\nexport * from './tables/compatibility'\nexport * from './tables/events'\nexport * from './tables/nativeBacking'\nexport * from './tables/tags'\nexport * from './tables/types'\n"
|
|
10
|
+
]
|
|
11
|
+
}
|