@vidact/runtime 0.2.0-beta.0 → 0.2.0-beta.4
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/CHANGELOG.md +37 -0
- package/README.md +1 -1
- package/dist/actions.d.ts +32 -30
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +251 -266
- package/dist/actions.js.map +1 -1
- package/dist/async.d.ts +20 -17
- package/dist/async.d.ts.map +1 -1
- package/dist/async.js +18 -17
- package/dist/async.js.map +1 -1
- package/dist/compiled/async-resource.d.ts +9 -6
- package/dist/compiled/async-resource.d.ts.map +1 -1
- package/dist/compiled/async-resource.js +69 -77
- package/dist/compiled/async-resource.js.map +1 -1
- package/dist/compiled/core.d.ts +136 -147
- package/dist/compiled/core.d.ts.map +1 -1
- package/dist/compiled/core.js +2669 -2985
- package/dist/compiled/core.js.map +1 -1
- package/dist/compiled/types.d.ts +44 -56
- package/dist/compiled/types.d.ts.map +1 -1
- package/dist/compiled/types.js +10 -6
- package/dist/compiled/types.js.map +1 -1
- package/dist/compiled/validation.d.ts +4 -1
- package/dist/compiled/validation.d.ts.map +1 -1
- package/dist/compiled/validation.js +17 -20
- package/dist/compiled/validation.js.map +1 -1
- package/dist/component-spread.d.ts +5 -3
- package/dist/component-spread.d.ts.map +1 -1
- package/dist/component-spread.js +49 -67
- package/dist/component-spread.js.map +1 -1
- package/dist/concurrent.d.ts +20 -18
- package/dist/concurrent.d.ts.map +1 -1
- package/dist/concurrent.js +191 -210
- package/dist/concurrent.js.map +1 -1
- package/dist/direct-dom.d.ts +17 -12
- package/dist/direct-dom.d.ts.map +1 -1
- package/dist/direct-dom.js +187 -221
- package/dist/direct-dom.js.map +1 -1
- package/dist/dom/attributes.d.ts +9 -6
- package/dist/dom/attributes.d.ts.map +1 -1
- package/dist/dom/attributes.js +65 -47
- package/dist/dom/attributes.js.map +1 -1
- package/dist/dom/events.d.ts +5 -2
- package/dist/dom/events.d.ts.map +1 -1
- package/dist/dom/events.js +53 -65
- package/dist/dom/events.js.map +1 -1
- package/dist/dom/forms.d.ts +9 -6
- package/dist/dom/forms.d.ts.map +1 -1
- package/dist/dom/forms.js +152 -198
- package/dist/dom/forms.js.map +1 -1
- package/dist/dom/intrinsic.d.ts +17 -15
- package/dist/dom/intrinsic.d.ts.map +1 -1
- package/dist/dom/intrinsic.js +48 -50
- package/dist/dom/intrinsic.js.map +1 -1
- package/dist/dom/namespace.d.ts +4 -1
- package/dist/dom/namespace.d.ts.map +1 -1
- package/dist/dom/namespace.js +25 -28
- package/dist/dom/namespace.js.map +1 -1
- package/dist/dom/namespaces.d.ts +11 -8
- package/dist/dom/namespaces.d.ts.map +1 -1
- package/dist/dom/namespaces.js +14 -12
- package/dist/dom/namespaces.js.map +1 -1
- package/dist/dom/properties.d.ts +18 -16
- package/dist/dom/properties.d.ts.map +1 -1
- package/dist/dom/properties.js +273 -296
- package/dist/dom/properties.js.map +1 -1
- package/dist/dom/style-properties.d.ts +4 -1
- package/dist/dom/style-properties.d.ts.map +1 -1
- package/dist/dom/style-properties.js +49 -45
- package/dist/dom/style-properties.js.map +1 -1
- package/dist/dom/styles.d.ts +5 -2
- package/dist/dom/styles.d.ts.map +1 -1
- package/dist/dom/styles.js +47 -67
- package/dist/dom/styles.js.map +1 -1
- package/dist/dom-forms.d.ts +4 -1
- package/dist/dom-forms.d.ts.map +1 -1
- package/dist/dom-forms.js +16 -13
- package/dist/dom-forms.js.map +1 -1
- package/dist/dom-styles.d.ts +4 -1
- package/dist/dom-styles.d.ts.map +1 -1
- package/dist/dom-styles.js +10 -7
- package/dist/dom-styles.js.map +1 -1
- package/dist/framework-hydrate.d.ts +20 -17
- package/dist/framework-hydrate.d.ts.map +1 -1
- package/dist/framework-hydrate.js +128 -146
- package/dist/framework-hydrate.js.map +1 -1
- package/dist/framework-protocol.d.ts +27 -25
- package/dist/framework-protocol.d.ts.map +1 -1
- package/dist/framework-protocol.js +173 -211
- package/dist/framework-protocol.js.map +1 -1
- package/dist/framework.d.ts +34 -32
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +74 -93
- package/dist/framework.js.map +1 -1
- package/dist/hydrate.d.ts +11 -8
- package/dist/hydrate.d.ts.map +1 -1
- package/dist/hydrate.js +13 -9
- package/dist/hydrate.js.map +1 -1
- package/dist/hydration-bridge.d.ts +61 -58
- package/dist/hydration-bridge.d.ts.map +1 -1
- package/dist/hydration-bridge.js +67 -66
- package/dist/hydration-bridge.js.map +1 -1
- package/dist/hydration.d.ts +31 -28
- package/dist/hydration.d.ts.map +1 -1
- package/dist/hydration.js +376 -462
- package/dist/hydration.js.map +1 -1
- package/dist/index.d.ts +13 -13
- package/dist/index.js +11 -13
- package/dist/indexed-list.d.ts +8 -5
- package/dist/indexed-list.d.ts.map +1 -1
- package/dist/indexed-list.js +14 -7
- package/dist/indexed-list.js.map +1 -1
- package/dist/jsx-runtime.d.ts +10 -8
- package/dist/jsx-runtime.d.ts.map +1 -1
- package/dist/jsx-runtime.js +28 -23
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/keyed-list.d.ts +13 -14
- package/dist/keyed-list.d.ts.map +1 -1
- package/dist/keyed-list.js +132 -160
- package/dist/keyed-list.js.map +1 -1
- package/dist/metadata.d.ts +6 -3
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +131 -164
- package/dist/metadata.js.map +1 -1
- package/dist/nested-prop.d.ts +4 -2
- package/dist/nested-prop.d.ts.map +1 -1
- package/dist/nested-prop.js +17 -16
- package/dist/nested-prop.js.map +1 -1
- package/dist/profiling.d.ts +11 -8
- package/dist/profiling.d.ts.map +1 -1
- package/dist/profiling.js +17 -17
- package/dist/profiling.js.map +1 -1
- package/dist/protocol.d.ts +5 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +8 -5
- package/dist/protocol.js.map +1 -1
- package/dist/raw-html.d.ts +5 -2
- package/dist/raw-html.d.ts.map +1 -1
- package/dist/raw-html.js +86 -146
- package/dist/raw-html.js.map +1 -1
- package/dist/ref.d.ts +8 -3
- package/dist/ref.d.ts.map +1 -1
- package/dist/ref.js +10 -2
- package/dist/ref.js.map +1 -1
- package/dist/renderable-protocol.d.ts +26 -8
- package/dist/renderable-protocol.d.ts.map +1 -1
- package/dist/renderable-protocol.js +30 -9
- package/dist/renderable-protocol.js.map +1 -1
- package/dist/renderable.d.ts +27 -22
- package/dist/renderable.d.ts.map +1 -1
- package/dist/renderable.js +141 -133
- package/dist/renderable.js.map +1 -1
- package/dist/retained-ui.d.ts +9 -6
- package/dist/retained-ui.d.ts.map +1 -1
- package/dist/retained-ui.js +12 -10
- package/dist/retained-ui.js.map +1 -1
- package/dist/root.d.ts +18 -15
- package/dist/root.d.ts.map +1 -1
- package/dist/root.js +73 -85
- package/dist/root.js.map +1 -1
- package/dist/scheduler.d.ts +10 -8
- package/dist/scheduler.d.ts.map +1 -1
- package/dist/scheduler.js +97 -105
- package/dist/scheduler.js.map +1 -1
- package/dist/server-framework.d.ts +45 -42
- package/dist/server-framework.d.ts.map +1 -1
- package/dist/server-framework.js +209 -217
- package/dist/server-framework.js.map +1 -1
- package/dist/server.d.ts +130 -128
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +592 -706
- package/dist/server.js.map +1 -1
- package/dist/shared/promise.d.ts +6 -3
- package/dist/shared/promise.d.ts.map +1 -1
- package/dist/shared/promise.js +21 -19
- package/dist/shared/promise.js.map +1 -1
- package/dist/source-mask.d.ts +9 -6
- package/dist/source-mask.d.ts.map +1 -1
- package/dist/source-mask.js +45 -63
- package/dist/source-mask.js.map +1 -1
- package/dist/spread.d.ts +5 -2
- package/dist/spread.d.ts.map +1 -1
- package/dist/spread.js +79 -99
- package/dist/spread.js.map +1 -1
- package/dist/state-slot.d.ts +18 -15
- package/dist/state-slot.d.ts.map +1 -1
- package/dist/state-slot.js +43 -42
- package/dist/state-slot.js.map +1 -1
- package/dist/testing.d.ts +9 -6
- package/dist/testing.d.ts.map +1 -1
- package/dist/testing.js +16 -12
- package/dist/testing.js.map +1 -1
- package/package.json +8 -7
- package/src/actions.ts +415 -0
- package/src/async.ts +78 -0
- package/src/compiled/async-resource.ts +113 -0
- package/src/compiled/core.ts +4026 -0
- package/src/compiled/types.ts +96 -0
- package/src/compiled/validation.ts +23 -0
- package/src/component-spread.ts +86 -0
- package/src/concurrent.ts +310 -0
- package/src/direct-dom.ts +365 -0
- package/src/dom/attributes.ts +55 -0
- package/src/dom/events.ts +93 -0
- package/src/dom/forms.ts +220 -0
- package/src/dom/intrinsic.ts +94 -0
- package/src/dom/namespace.ts +30 -0
- package/src/dom/namespaces.ts +14 -0
- package/src/dom/properties.ts +355 -0
- package/src/dom/style-properties.ts +46 -0
- package/src/dom/styles.ts +86 -0
- package/src/dom-forms.ts +23 -0
- package/src/dom-styles.ts +11 -0
- package/src/env.d.ts +6 -0
- package/src/framework-hydrate.ts +224 -0
- package/src/framework-protocol.ts +335 -0
- package/src/framework.ts +161 -0
- package/src/hydrate.ts +38 -0
- package/src/hydration-bridge.ts +183 -0
- package/src/hydration.ts +556 -0
- package/src/index.ts +92 -0
- package/src/indexed-list.ts +20 -0
- package/src/jsx-runtime.ts +55 -0
- package/src/keyed-list.ts +233 -0
- package/src/metadata.ts +212 -0
- package/src/nested-prop.ts +27 -0
- package/src/profiling.ts +43 -0
- package/src/protocol.ts +8 -0
- package/src/raw-html.ts +206 -0
- package/src/ref.ts +13 -0
- package/src/renderable-protocol.ts +63 -0
- package/src/renderable.ts +283 -0
- package/src/retained-ui.ts +19 -0
- package/src/root.ts +122 -0
- package/src/scheduler.ts +136 -0
- package/src/server-framework.ts +397 -0
- package/src/server.ts +1143 -0
- package/src/shared/promise.ts +28 -0
- package/src/source-mask.ts +83 -0
- package/src/spread.ts +131 -0
- package/src/state-slot.ts +76 -0
- package/src/testing.ts +27 -0
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/dom/properties.js
CHANGED
|
@@ -1,333 +1,310 @@
|
|
|
1
|
-
import { validateRawHtmlRelatedProp } from
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
import { validateRawHtmlRelatedProp } from "../raw-html.js";
|
|
2
|
+
import { XLINK_NAMESPACE, XMLNS_NAMESPACE, XML_NAMESPACE } from "./namespaces.js";
|
|
3
|
+
//#region src/dom/properties.ts
|
|
4
|
+
const DEV = typeof __VIDACT_DEV__ === "undefined" || __VIDACT_DEV__;
|
|
5
|
+
const UNSAFE_HTML = typeof __VIDACT_UNSAFE_HTML__ === "undefined" || __VIDACT_UNSAFE_HTML__;
|
|
6
|
+
const booleanAttributes = /* @__PURE__ */ new Set([
|
|
7
|
+
"allowFullScreen",
|
|
8
|
+
"async",
|
|
9
|
+
"autoFocus",
|
|
10
|
+
"autoPlay",
|
|
11
|
+
"controls",
|
|
12
|
+
"default",
|
|
13
|
+
"defer",
|
|
14
|
+
"disabled",
|
|
15
|
+
"disablePictureInPicture",
|
|
16
|
+
"disableRemotePlayback",
|
|
17
|
+
"formNoValidate",
|
|
18
|
+
"hidden",
|
|
19
|
+
"inert",
|
|
20
|
+
"itemScope",
|
|
21
|
+
"loop",
|
|
22
|
+
"noModule",
|
|
23
|
+
"noValidate",
|
|
24
|
+
"open",
|
|
25
|
+
"playsInline",
|
|
26
|
+
"readOnly",
|
|
27
|
+
"required",
|
|
28
|
+
"reversed"
|
|
28
29
|
]);
|
|
29
|
-
const booleanishStringAttributes = new Set([
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
'accentunder',
|
|
34
|
-
'displaystyle',
|
|
35
|
-
'fence',
|
|
36
|
-
'largeop',
|
|
37
|
-
'movablelimits',
|
|
38
|
-
'separator',
|
|
39
|
-
'stretchy',
|
|
40
|
-
'symmetric',
|
|
30
|
+
const booleanishStringAttributes = /* @__PURE__ */ new Set([
|
|
31
|
+
"contentEditable",
|
|
32
|
+
"draggable",
|
|
33
|
+
"spellCheck"
|
|
41
34
|
]);
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
35
|
+
const overloadedBooleanAttributes = /* @__PURE__ */ new Set(["capture", "download"]);
|
|
36
|
+
const mathBooleanishStringAttributes = /* @__PURE__ */ new Set([
|
|
37
|
+
"accent",
|
|
38
|
+
"accentunder",
|
|
39
|
+
"displaystyle",
|
|
40
|
+
"fence",
|
|
41
|
+
"largeop",
|
|
42
|
+
"movablelimits",
|
|
43
|
+
"separator",
|
|
44
|
+
"stretchy",
|
|
45
|
+
"symmetric"
|
|
46
|
+
]);
|
|
47
|
+
const svgBooleanishStringAttributes = /* @__PURE__ */ new Set(["focusable", "preserveAlpha"]);
|
|
48
|
+
const kebabCaseSvgAttributes = /* @__PURE__ */ new Set([
|
|
49
|
+
"accentHeight",
|
|
50
|
+
"alignmentBaseline",
|
|
51
|
+
"arabicForm",
|
|
52
|
+
"baselineShift",
|
|
53
|
+
"capHeight",
|
|
54
|
+
"clipPath",
|
|
55
|
+
"clipRule",
|
|
56
|
+
"colorInterpolation",
|
|
57
|
+
"colorInterpolationFilters",
|
|
58
|
+
"colorProfile",
|
|
59
|
+
"colorRendering",
|
|
60
|
+
"dominantBaseline",
|
|
61
|
+
"enableBackground",
|
|
62
|
+
"fillOpacity",
|
|
63
|
+
"fillRule",
|
|
64
|
+
"floodColor",
|
|
65
|
+
"floodOpacity",
|
|
66
|
+
"fontFamily",
|
|
67
|
+
"fontSize",
|
|
68
|
+
"fontSizeAdjust",
|
|
69
|
+
"fontStretch",
|
|
70
|
+
"fontStyle",
|
|
71
|
+
"fontVariant",
|
|
72
|
+
"fontWeight",
|
|
73
|
+
"glyphName",
|
|
74
|
+
"glyphOrientationHorizontal",
|
|
75
|
+
"glyphOrientationVertical",
|
|
76
|
+
"horizAdvX",
|
|
77
|
+
"horizOriginX",
|
|
78
|
+
"imageRendering",
|
|
79
|
+
"letterSpacing",
|
|
80
|
+
"lightingColor",
|
|
81
|
+
"markerEnd",
|
|
82
|
+
"markerMid",
|
|
83
|
+
"markerStart",
|
|
84
|
+
"overlinePosition",
|
|
85
|
+
"overlineThickness",
|
|
86
|
+
"paintOrder",
|
|
87
|
+
"pointerEvents",
|
|
88
|
+
"renderingIntent",
|
|
89
|
+
"shapeRendering",
|
|
90
|
+
"stopColor",
|
|
91
|
+
"stopOpacity",
|
|
92
|
+
"strikethroughPosition",
|
|
93
|
+
"strikethroughThickness",
|
|
94
|
+
"strokeDasharray",
|
|
95
|
+
"strokeDashoffset",
|
|
96
|
+
"strokeLinecap",
|
|
97
|
+
"strokeLinejoin",
|
|
98
|
+
"strokeMiterlimit",
|
|
99
|
+
"strokeOpacity",
|
|
100
|
+
"strokeWidth",
|
|
101
|
+
"textAnchor",
|
|
102
|
+
"textDecoration",
|
|
103
|
+
"textRendering",
|
|
104
|
+
"transformOrigin",
|
|
105
|
+
"underlinePosition",
|
|
106
|
+
"underlineThickness",
|
|
107
|
+
"unicodeBidi",
|
|
108
|
+
"unicodeRange",
|
|
109
|
+
"unitsPerEm",
|
|
110
|
+
"vAlphabetic",
|
|
111
|
+
"vHanging",
|
|
112
|
+
"vIdeographic",
|
|
113
|
+
"vMathematical",
|
|
114
|
+
"vectorEffect",
|
|
115
|
+
"vertAdvY",
|
|
116
|
+
"vertOriginX",
|
|
117
|
+
"vertOriginY",
|
|
118
|
+
"wordSpacing",
|
|
119
|
+
"writingMode",
|
|
120
|
+
"xHeight"
|
|
116
121
|
]);
|
|
117
122
|
let formCapability;
|
|
118
123
|
let styleCapability;
|
|
119
|
-
const NOOP = () => {
|
|
124
|
+
const NOOP = () => {};
|
|
120
125
|
/** @internal */
|
|
121
|
-
|
|
122
|
-
|
|
126
|
+
function installFormDomCapability(capability) {
|
|
127
|
+
formCapability = capability;
|
|
123
128
|
}
|
|
124
129
|
/** @internal */
|
|
125
|
-
|
|
126
|
-
|
|
130
|
+
function installStyleDomCapability(capability) {
|
|
131
|
+
styleCapability = capability;
|
|
127
132
|
}
|
|
128
133
|
/** @internal */
|
|
129
|
-
|
|
130
|
-
|
|
134
|
+
function ensureControlledFormRestoration(element) {
|
|
135
|
+
return formCapability?.ensureControlledRestoration(element) ?? NOOP;
|
|
131
136
|
}
|
|
132
137
|
/** @internal */
|
|
133
|
-
|
|
134
|
-
|
|
138
|
+
function isControlledFormProp(element, name) {
|
|
139
|
+
return formCapability?.isControlledProp(element, name) ?? false;
|
|
135
140
|
}
|
|
136
141
|
/** @internal */
|
|
137
|
-
|
|
138
|
-
|
|
142
|
+
function isReactFormChangeEvent(element, eventName) {
|
|
143
|
+
return formCapability?.isReactChangeEvent(element, eventName) ?? false;
|
|
139
144
|
}
|
|
140
145
|
/** @internal */
|
|
141
|
-
|
|
142
|
-
|
|
146
|
+
function restoreControlledFormState(element) {
|
|
147
|
+
formCapability?.restoreControlledState(element);
|
|
143
148
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
};
|
|
149
|
+
let applyDomProp = applyBaseDomProp;
|
|
150
|
+
function installDomPropHandler(handler) {
|
|
151
|
+
const fallback = applyDomProp;
|
|
152
|
+
applyDomProp = (element, name, value) => {
|
|
153
|
+
if (!handler(element, name, value)) fallback(element, name, value);
|
|
154
|
+
};
|
|
151
155
|
}
|
|
152
156
|
/** @internal Specialized capabilities may own a prop while reusing the base policy. */
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
if (name in element) {
|
|
218
|
-
const current = Reflect.get(element, name);
|
|
219
|
-
if (!isCustomElement(element) &&
|
|
220
|
-
(Object.is(current, value) || String(current) === serialized)) {
|
|
221
|
-
validateRawHtmlProp(element, name);
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
if (Reflect.set(element, name, value)) {
|
|
225
|
-
validateRawHtmlProp(element, name);
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
if (element.getAttribute(attribute) !== serialized) {
|
|
230
|
-
element.setAttribute(attribute, serialized);
|
|
231
|
-
}
|
|
232
|
-
validateRawHtmlProp(element, name);
|
|
157
|
+
function applyBaseDomProp(element, name, value) {
|
|
158
|
+
if (typeof value === "symbol") throw new TypeError(DEV ? `DOM prop ${name} cannot receive a symbol value` : "V105");
|
|
159
|
+
if (name === "dangerouslySetInnerHTML") throw new Error(DEV ? "dangerouslySetInnerHTML must be handled as an owned opaque subtree" : "V401");
|
|
160
|
+
if (name === "style") {
|
|
161
|
+
if (styleCapability === void 0) throw new Error(DEV ? "style prop requires the DOM style capability" : "V503");
|
|
162
|
+
styleCapability(element, value);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (formCapability?.applyProp(element, name, value)) return;
|
|
166
|
+
if (name.startsWith("data-") || name.startsWith("aria-")) {
|
|
167
|
+
applyStringAttribute(element, name, value);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
if (element.namespaceURI === "http://www.w3.org/2000/svg" || element.namespaceURI === "http://www.w3.org/1998/Math/MathML") {
|
|
171
|
+
applyNamespacedAttribute(element, name, value);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const attribute = htmlAttributeName(name);
|
|
175
|
+
if (value === null || value === void 0) {
|
|
176
|
+
element.removeAttribute(attribute);
|
|
177
|
+
if (isCustomElement(element) && name in element) Reflect.set(element, name, null);
|
|
178
|
+
validateRawHtmlProp(element, name);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (booleanishStringAttributes.has(name)) {
|
|
182
|
+
element.setAttribute(attribute, String(value));
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (overloadedBooleanAttributes.has(name)) {
|
|
186
|
+
if (value === false) element.removeAttribute(attribute);
|
|
187
|
+
else element.setAttribute(attribute, value === true ? "" : String(value));
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (booleanAttributes.has(name)) {
|
|
191
|
+
if (name in element) {
|
|
192
|
+
const next = Boolean(value);
|
|
193
|
+
if (!Object.is(Reflect.get(element, name), next)) Reflect.set(element, name, next);
|
|
194
|
+
} else if (value) element.setAttribute(attribute, "");
|
|
195
|
+
else element.removeAttribute(attribute);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
if (typeof value === "boolean") {
|
|
199
|
+
element.removeAttribute(attribute);
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
const serialized = String(value);
|
|
203
|
+
if (element.getAttribute(attribute) === serialized) {
|
|
204
|
+
validateRawHtmlProp(element, name);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (name in element) {
|
|
208
|
+
const current = Reflect.get(element, name);
|
|
209
|
+
if (!isCustomElement(element) && (Object.is(current, value) || String(current) === serialized)) {
|
|
210
|
+
validateRawHtmlProp(element, name);
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (Reflect.set(element, name, value)) {
|
|
214
|
+
validateRawHtmlProp(element, name);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (element.getAttribute(attribute) !== serialized) element.setAttribute(attribute, serialized);
|
|
219
|
+
validateRawHtmlProp(element, name);
|
|
233
220
|
}
|
|
234
221
|
function applyStringAttribute(element, name, value) {
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
? value.map((item) => (typeof item === 'symbol' ? String(item) : typeof item)).join(',')
|
|
248
|
-
: typeof value;
|
|
249
|
-
throw new TypeError(`cannot serialize DOM attribute ${name} from ${detail}`, { cause });
|
|
250
|
-
}
|
|
251
|
-
if (element.getAttribute(name) !== serialized)
|
|
252
|
-
element.setAttribute(name, serialized);
|
|
253
|
-
}
|
|
222
|
+
if (value === null || value === void 0) element.removeAttribute(name);
|
|
223
|
+
else {
|
|
224
|
+
if (typeof value === "symbol") throw new TypeError(`cannot apply a Symbol value to DOM attribute ${name}`);
|
|
225
|
+
let serialized;
|
|
226
|
+
try {
|
|
227
|
+
serialized = String(value);
|
|
228
|
+
} catch (cause) {
|
|
229
|
+
const detail = Array.isArray(value) ? value.map((item) => typeof item === "symbol" ? String(item) : typeof item).join(",") : typeof value;
|
|
230
|
+
throw new TypeError(`cannot serialize DOM attribute ${name} from ${detail}`, { cause });
|
|
231
|
+
}
|
|
232
|
+
if (element.getAttribute(name) !== serialized) element.setAttribute(name, serialized);
|
|
233
|
+
}
|
|
254
234
|
}
|
|
255
235
|
function applyNamespacedAttribute(element, name, value) {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
const serialized = value === true ? '' : String(value);
|
|
277
|
-
if (descriptor.namespace === null)
|
|
278
|
-
element.setAttribute(descriptor.qualifiedName, serialized);
|
|
279
|
-
else
|
|
280
|
-
element.setAttributeNS(descriptor.namespace, descriptor.qualifiedName, serialized);
|
|
236
|
+
const descriptor = namespacedAttribute(name);
|
|
237
|
+
if (value === null || value === void 0) {
|
|
238
|
+
if (descriptor.namespace === null) element.removeAttribute(descriptor.qualifiedName);
|
|
239
|
+
else element.removeAttributeNS(descriptor.namespace, descriptor.localName);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
if (element.namespaceURI === "http://www.w3.org/1998/Math/MathML" && mathBooleanishStringAttributes.has(name) || element.namespaceURI === "http://www.w3.org/2000/svg" && svgBooleanishStringAttributes.has(name)) {
|
|
243
|
+
element.setAttribute(descriptor.qualifiedName, String(value));
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (value === false) {
|
|
247
|
+
if (descriptor.namespace === null) element.removeAttribute(descriptor.qualifiedName);
|
|
248
|
+
else element.removeAttributeNS(descriptor.namespace, descriptor.localName);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const serialized = value === true ? "" : String(value);
|
|
252
|
+
if (descriptor.namespace === null) element.setAttribute(descriptor.qualifiedName, serialized);
|
|
253
|
+
else element.setAttributeNS(descriptor.namespace, descriptor.qualifiedName, serialized);
|
|
281
254
|
}
|
|
282
255
|
function namespacedAttribute(name) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
256
|
+
if (name.startsWith("xlink") && name.length > 5) {
|
|
257
|
+
const localName = lowerInitial(name.slice(5));
|
|
258
|
+
return {
|
|
259
|
+
namespace: XLINK_NAMESPACE,
|
|
260
|
+
qualifiedName: `xlink:${localName}`,
|
|
261
|
+
localName
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
if (name === "xmlnsXlink") return {
|
|
265
|
+
namespace: XMLNS_NAMESPACE,
|
|
266
|
+
qualifiedName: "xmlns:xlink",
|
|
267
|
+
localName: "xlink"
|
|
268
|
+
};
|
|
269
|
+
if (name.startsWith("xml") && name.length > 3) {
|
|
270
|
+
const localName = lowerInitial(name.slice(3));
|
|
271
|
+
return {
|
|
272
|
+
namespace: XML_NAMESPACE,
|
|
273
|
+
qualifiedName: `xml:${localName}`,
|
|
274
|
+
localName
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
const qualifiedName = svgAttributeName(name);
|
|
278
|
+
return {
|
|
279
|
+
namespace: null,
|
|
280
|
+
qualifiedName,
|
|
281
|
+
localName: qualifiedName
|
|
282
|
+
};
|
|
300
283
|
}
|
|
301
284
|
function svgAttributeName(name) {
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
return 'tabindex';
|
|
308
|
-
if (!kebabCaseSvgAttributes.has(name))
|
|
309
|
-
return name;
|
|
310
|
-
return name.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`);
|
|
285
|
+
if (name === "className") return "class";
|
|
286
|
+
if (name === "crossOrigin") return "crossorigin";
|
|
287
|
+
if (name === "tabIndex") return "tabindex";
|
|
288
|
+
if (!kebabCaseSvgAttributes.has(name)) return name;
|
|
289
|
+
return name.replace(/[A-Z]/g, (character) => `-${character.toLowerCase()}`);
|
|
311
290
|
}
|
|
312
291
|
function htmlAttributeName(name) {
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return 'accept-charset';
|
|
319
|
-
if (name === 'httpEquiv')
|
|
320
|
-
return 'http-equiv';
|
|
321
|
-
return name;
|
|
292
|
+
if (name === "className") return "class";
|
|
293
|
+
if (name === "htmlFor") return "for";
|
|
294
|
+
if (name === "acceptCharset") return "accept-charset";
|
|
295
|
+
if (name === "httpEquiv") return "http-equiv";
|
|
296
|
+
return name;
|
|
322
297
|
}
|
|
323
298
|
function isCustomElement(element) {
|
|
324
|
-
|
|
299
|
+
return element instanceof HTMLElement && element.localName.includes("-");
|
|
325
300
|
}
|
|
326
301
|
function validateRawHtmlProp(element, name) {
|
|
327
|
-
|
|
328
|
-
validateRawHtmlRelatedProp(element, name);
|
|
302
|
+
if (UNSAFE_HTML && element instanceof HTMLElement) validateRawHtmlRelatedProp(element, name);
|
|
329
303
|
}
|
|
330
304
|
function lowerInitial(value) {
|
|
331
|
-
|
|
305
|
+
return `${value.charAt(0).toLowerCase()}${value.slice(1)}`;
|
|
332
306
|
}
|
|
307
|
+
//#endregion
|
|
308
|
+
export { applyBaseDomProp, applyDomProp, ensureControlledFormRestoration, installDomPropHandler, installFormDomCapability, installStyleDomCapability, isControlledFormProp, isReactFormChangeEvent, restoreControlledFormState };
|
|
309
|
+
|
|
333
310
|
//# sourceMappingURL=properties.js.map
|