embedded-react 0.20.0 → 0.22.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/NOTICE +5 -0
- package/README.md +3 -2
- package/aot/app-file-loader.mjs +116 -0
- package/aot/compile.mjs +17 -47
- package/aot/compiler/alerts.mjs +604 -0
- package/aot/compiler/animations.mjs +299 -57
- package/aot/compiler/boot.mjs +27 -2
- package/aot/compiler/check.mjs +62 -10
- package/aot/compiler/collect.mjs +517 -137
- package/aot/compiler/contexts.mjs +391 -0
- package/aot/compiler/control-flow.mjs +276 -117
- package/aot/compiler/custom-hooks.mjs +686 -0
- package/aot/compiler/elements/button.mjs +182 -0
- package/aot/compiler/elements/image-background.mjs +76 -0
- package/aot/compiler/elements/image.mjs +2 -1
- package/aot/compiler/elements/props.mjs +47 -8
- package/aot/compiler/elements/rewrite.mjs +118 -0
- package/aot/compiler/elements/section-list.mjs +370 -0
- package/aot/compiler/expressions.mjs +1378 -97
- package/aot/compiler/handlers.mjs +1807 -354
- package/aot/compiler/helper-values.mjs +312 -0
- package/aot/compiler/ir/nodes.mjs +40 -1
- package/aot/compiler/ir/reads.mjs +206 -5
- package/aot/compiler/ir/text.mjs +5 -1
- package/aot/compiler/ir/types.mjs +12 -0
- package/aot/compiler/kept-states.mjs +177 -0
- package/aot/compiler/keyboard-dismiss.mjs +99 -0
- package/aot/compiler/keyboard.mjs +1 -1
- package/aot/compiler/list-items.mjs +226 -0
- package/aot/compiler/list-order.mjs +586 -0
- package/aot/compiler/list-split.mjs +259 -0
- package/aot/compiler/loops.mjs +582 -0
- package/aot/compiler/lower.mjs +203 -53
- package/aot/compiler/native-files.mjs +439 -0
- package/aot/compiler/native-header.mjs +335 -0
- package/aot/compiler/native-modules.mjs +1173 -0
- package/aot/compiler/nodes.mjs +45 -31
- package/aot/compiler/options.mjs +3 -2
- package/aot/compiler/out.mjs +18 -1
- package/aot/compiler/package/animations.mjs +133 -23
- package/aot/compiler/package/assemble.mjs +2 -4
- package/aot/compiler/package/bytecode.mjs +37 -8
- package/aot/compiler/package/checks.mjs +4 -0
- package/aot/compiler/package/codegen.mjs +906 -33
- package/aot/compiler/package/enums.mjs +10 -0
- package/aot/compiler/package/format.mjs +16 -3
- package/aot/compiler/package/lower.mjs +707 -176
- package/aot/compiler/package/string-caps.mjs +515 -0
- package/aot/compiler/package/tables.mjs +24 -0
- package/aot/compiler/package/writer.mjs +22 -0
- package/aot/compiler/parse.mjs +3 -1
- package/aot/compiler/record-shapes.mjs +246 -0
- package/aot/compiler/records.mjs +654 -0
- package/aot/compiler/reducers.mjs +272 -0
- package/aot/compiler/scroll-to.mjs +112 -0
- package/aot/compiler/static-eval.mjs +315 -7
- package/aot/compiler/style-text.mjs +20 -5
- package/aot/compiler/svg.mjs +13 -7
- package/aot/compiler/switch-cases.mjs +198 -0
- package/aot/compiler/tagged-records.mjs +450 -0
- package/aot/compiler/typing.mjs +307 -0
- package/aot/compiler/updaters.mjs +321 -0
- package/aot/compiler/window-dimensions.mjs +94 -0
- package/aot/compiler/worked-values.mjs +319 -0
- package/aot/demo-file.mjs +30 -0
- package/aot/style-map.mjs +94 -3
- package/assets/bake-font.mjs +187 -244
- package/assets/bake-image.mjs +47 -71
- package/assets/bake-svg.mjs +465 -533
- package/assets/build-builtin-font.mjs +14 -27
- package/assets/emit-c.mjs +124 -204
- package/assets/emit-container.mjs +129 -197
- package/assets/emit-pack.mjs +92 -136
- package/assets/font-config.mjs +19 -27
- package/assets/font-sizes.mjs +432 -507
- package/assets/glyph-coverage.mjs +170 -214
- package/assets/index.mjs +52 -97
- package/assets/rasterize.mjs +173 -194
- package/assets/svg-loader.mjs +42 -48
- package/build.mjs +85 -94
- package/cli.mjs +490 -586
- package/compile-bin.mjs +24 -36
- package/flash.mjs +297 -401
- package/hotreload/dev-device.mjs +229 -270
- package/hotreload/pack-app.mjs +118 -159
- package/hotreload/pack-split.mjs +146 -213
- package/hotreload/package-transfer.mjs +128 -131
- package/hotreload/protocol.mjs +118 -118
- package/hotreload/uploader.mjs +132 -159
- package/hotreload/watch-tree.mjs +56 -65
- package/pack-container.mjs +94 -116
- package/package.json +19 -16
- package/persist-transform.mjs +89 -105
- package/qjsc-wasm.mjs +47 -72
- package/sim/embedded-react.wasm +0 -0
- package/sim/index.html +1 -1
- package/sim-server.mjs +260 -354
- package/src/embedded-react/Alert.mjs +112 -0
- package/src/embedded-react/Animated.mjs +412 -0
- package/src/embedded-react/{AppRegistry.js → AppRegistry.mjs} +26 -25
- package/src/embedded-react/{Button.js → Button.mjs} +29 -53
- package/src/embedded-react/Dimensions.mjs +32 -0
- package/src/embedded-react/Easing.mjs +34 -0
- package/src/embedded-react/{FlatList.js → FlatList.mjs} +25 -42
- package/src/embedded-react/{ImageBackground.js → ImageBackground.mjs} +11 -22
- package/src/embedded-react/Keyboard.mjs +82 -0
- package/src/embedded-react/{LayoutAnimation.js → LayoutAnimation.mjs} +17 -28
- package/src/embedded-react/PanResponder.mjs +256 -0
- package/src/embedded-react/{Platform.js → Platform.mjs} +8 -9
- package/src/embedded-react/{Pressable.js → Pressable.mjs} +12 -25
- package/src/embedded-react/SectionList.mjs +103 -0
- package/src/embedded-react/{StyleSheet.js → StyleSheet.mjs} +16 -20
- package/src/embedded-react/{TouchableOpacity.js → TouchableOpacity.mjs} +47 -83
- package/src/embedded-react/background-image.mjs +321 -0
- package/src/embedded-react/{components.js → components.mjs} +1 -3
- package/src/embedded-react/{imperative.js → imperative.mjs} +27 -38
- package/src/embedded-react/index.d.ts +238 -5
- package/src/embedded-react/index.js +26 -17
- package/src/embedded-react/layout-anim-config.mjs +85 -0
- package/src/embedded-react/{list-child.js → list-child.mjs} +11 -20
- package/src/embedded-react/{named-colors.js → named-colors.mjs} +2 -6
- package/src/embedded-react/nativeModule.mjs +371 -0
- package/src/embedded-react/split-style.mjs +57 -0
- package/src/embedded-react/svg-ops.mjs +1075 -0
- package/src/embedded-react/{useHostValue.js → useHostValue.mjs} +2 -4
- package/src/embedded-react/{usePersistentState.js → usePersistentState.mjs} +34 -38
- package/src/embedded-react/{warn-props.js → warn-props.mjs} +32 -39
- package/src/host-config.mjs +512 -0
- package/src/{native-ui.js → native-ui.mjs} +1 -8
- package/src/props.mjs +341 -0
- package/src/{renderer.js → renderer.mjs} +30 -44
- package/src/embedded-react/Animated.js +0 -440
- package/src/embedded-react/Easing.js +0 -39
- package/src/embedded-react/PanResponder.js +0 -330
- package/src/embedded-react/SectionList.js +0 -148
- package/src/embedded-react/layout-anim-config.js +0 -101
- package/src/embedded-react/split-style.js +0 -58
- package/src/embedded-react/svg-ops.js +0 -1295
- package/src/host-config.js +0 -548
- package/src/props.js +0 -306
package/src/props.js
DELETED
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2026 Cory Lamming
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
// Pure prop-marshalling helpers. No engine / NativeUI dependency, so these are unit-testable in
|
|
18
|
-
// plain Node (see src/__tests__/props.unit.test.js). The host config wires them to NativeUI.
|
|
19
|
-
|
|
20
|
-
// Top-level props NativeUI understands directly (not part of `style`). Everything else style-ish is
|
|
21
|
-
// expected inside props.style. Event handlers (on*) are routed separately via setEvent.
|
|
22
|
-
export const PASSTHROUGH = [
|
|
23
|
-
'delayLongPress',
|
|
24
|
-
'numberOfLines',
|
|
25
|
-
'ellipsizeMode',
|
|
26
|
-
'value',
|
|
27
|
-
'placeholder',
|
|
28
|
-
'placeholderTextColor',
|
|
29
|
-
'editable',
|
|
30
|
-
'secureTextEntry',
|
|
31
|
-
'animating',
|
|
32
|
-
'visible',
|
|
33
|
-
'backdropColor', // <Modal>'s scrim, as React Native takes it (the style key works too)
|
|
34
|
-
'resizeMode',
|
|
35
|
-
'tintColor',
|
|
36
|
-
'imageName',
|
|
37
|
-
// Switch colours.
|
|
38
|
-
'trackColor',
|
|
39
|
-
'thumbColor',
|
|
40
|
-
// <Dial> (the native arc widget, ER_NODE_ARC).
|
|
41
|
-
'min',
|
|
42
|
-
'max',
|
|
43
|
-
'startAngle',
|
|
44
|
-
'sweepAngle',
|
|
45
|
-
'step',
|
|
46
|
-
'gapAngle',
|
|
47
|
-
'thickness',
|
|
48
|
-
'bandThickness',
|
|
49
|
-
'knobSize',
|
|
50
|
-
'knobBorderWidth',
|
|
51
|
-
'indicatorColor',
|
|
52
|
-
'bandColor',
|
|
53
|
-
'knobColor',
|
|
54
|
-
'knobBorderColor',
|
|
55
|
-
'segments',
|
|
56
|
-
'cap',
|
|
57
|
-
'knob',
|
|
58
|
-
'knobImage',
|
|
59
|
-
'adjustable',
|
|
60
|
-
'range',
|
|
61
|
-
'valueStart',
|
|
62
|
-
'minSpan',
|
|
63
|
-
'indicatorGradient',
|
|
64
|
-
];
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Flattens RN-style `style` (object or nested array) into the `output` object.
|
|
68
|
-
*/
|
|
69
|
-
export function flattenStyle(style, output) {
|
|
70
|
-
if (!style) return;
|
|
71
|
-
if (Array.isArray(style)) {
|
|
72
|
-
for (const entry of style) flattenStyle(entry, output);
|
|
73
|
-
} else {
|
|
74
|
-
Object.assign(output, style);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/** Flattens a style (object/array) into a fresh plain object. */
|
|
79
|
-
export function flattenStyleObj(style) {
|
|
80
|
-
const flattened = {};
|
|
81
|
-
flattenStyle(style, flattened);
|
|
82
|
-
return flattened;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Style fields the engine honors per inline text span (everything else inherits from the node).
|
|
86
|
-
const SPAN_STYLE_KEYS = [
|
|
87
|
-
'color',
|
|
88
|
-
'fontSize',
|
|
89
|
-
'fontWeight',
|
|
90
|
-
'fontStyle',
|
|
91
|
-
'textDecorationLine',
|
|
92
|
-
'letterSpacing',
|
|
93
|
-
];
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* True when a <Text>'s children can be flattened inline — i.e. every leaf is a string/number or a
|
|
97
|
-
* nested <Text> element. A non-Text element (View, a component) makes it false, so the reconciler
|
|
98
|
-
* falls back to mounting children as separate instances.
|
|
99
|
-
*/
|
|
100
|
-
export function isTextContent(children) {
|
|
101
|
-
if (children == null || children === false || children === true) return true;
|
|
102
|
-
if (typeof children === 'string' || typeof children === 'number') return true;
|
|
103
|
-
if (Array.isArray(children)) return children.every(isTextContent);
|
|
104
|
-
// A React element: only nested <Text> participates in inline flattening (type is the 'Text' tag).
|
|
105
|
-
if (children && children.props !== undefined) return children.type === 'Text';
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Walks a <Text>'s children into an ordered list of { text, style } segments. Primitive siblings
|
|
111
|
-
* share the parent's (base) style object by reference; a nested <Text> with its own style produces
|
|
112
|
-
* a new merged style object. Adjacent segments with the same style reference are coalesced — so
|
|
113
|
-
* plain interpolation like `Hi {name}` collapses to a single segment (no spans needed).
|
|
114
|
-
*/
|
|
115
|
-
export function flattenTextChildren(children, baseStyle) {
|
|
116
|
-
const segments = [];
|
|
117
|
-
const push = (text, style) => {
|
|
118
|
-
if (text === '') return;
|
|
119
|
-
const last = segments[segments.length - 1];
|
|
120
|
-
if (last && last.style === style) last.text += text;
|
|
121
|
-
else segments.push({text, style});
|
|
122
|
-
};
|
|
123
|
-
const walk = (node, style) => {
|
|
124
|
-
if (node == null || node === false || node === true) return;
|
|
125
|
-
if (typeof node === 'string' || typeof node === 'number') {
|
|
126
|
-
push(String(node), style);
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
if (Array.isArray(node)) {
|
|
130
|
-
for (const child of node) walk(child, style);
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
if (node && node.props !== undefined) {
|
|
134
|
-
// Nested <Text>: merge its style over the inherited one (new object only when it has style,
|
|
135
|
-
// so an unstyled nested <Text> keeps the same reference and still coalesces with siblings).
|
|
136
|
-
const merged = node.props.style
|
|
137
|
-
? Object.assign({}, style, flattenStyleObj(node.props.style))
|
|
138
|
-
: style;
|
|
139
|
-
walk(node.props.children, merged);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
walk(children, baseStyle);
|
|
143
|
-
return segments;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Builds the inline-span array for a <Text> (for NativeUI.setTextSpans). Returns [] when the content
|
|
148
|
-
* is uniformly the base style (plain text — no spans needed); otherwise one span per styled segment,
|
|
149
|
-
* each carrying only the span-relevant style keys (the engine inherits the rest from the node).
|
|
150
|
-
*/
|
|
151
|
-
export function buildTextSpans(props, flatStyle) {
|
|
152
|
-
if (!isTextContent(props.children)) return [];
|
|
153
|
-
const baseStyle = flatStyle || flattenStyleObj(props.style);
|
|
154
|
-
const segments = flattenTextChildren(props.children, baseStyle);
|
|
155
|
-
if (!segments.some(segment => segment.style !== baseStyle)) return [];
|
|
156
|
-
return segments.map(segment => {
|
|
157
|
-
const span = {text: segment.text};
|
|
158
|
-
for (const key of SPAN_STYLE_KEYS) {
|
|
159
|
-
if (segment.style && segment.style[key] !== undefined)
|
|
160
|
-
span[key] = segment.style[key];
|
|
161
|
-
}
|
|
162
|
-
return span;
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Builds the flat prop bag NativeUI.setProps expects: resolved style + passthrough props + text.
|
|
168
|
-
*/
|
|
169
|
-
/**
|
|
170
|
-
* Resolves an <Image source> to the engine asset name (the string registered via er_image_load and
|
|
171
|
-
* stored on the node as imageName). Accepts a bare name string — which is also what the bundler's
|
|
172
|
-
* image plugin turns `import logo from './logo.png'` into (the file's basename) — or an RN-style
|
|
173
|
-
* { uri } object. Returns null for anything unresolvable (e.g., a numeric require() id).
|
|
174
|
-
*/
|
|
175
|
-
export function resolveImageSource(source) {
|
|
176
|
-
if (typeof source === 'string') return source;
|
|
177
|
-
if (source && typeof source === 'object' && typeof source.uri === 'string')
|
|
178
|
-
return source.uri;
|
|
179
|
-
return null;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export function buildProps(type, props, flatStyle) {
|
|
183
|
-
const flat = flatStyle ? {...flatStyle} : {};
|
|
184
|
-
if (!flatStyle) flattenStyle(props.style, flat);
|
|
185
|
-
for (const key of PASSTHROUGH) {
|
|
186
|
-
if (props[key] !== undefined) flat[key] = props[key];
|
|
187
|
-
}
|
|
188
|
-
// <Svg> takes width/height as DIRECT props (the react-native-svg convention) — the engine sizes the
|
|
189
|
-
// vector node from them. Fold them into the resolved style (an explicit style width/height still wins)
|
|
190
|
-
// so Flow A matches the Flow B AOT, which reads svg.props.width/height directly (aot/compiler/svg.mts emitSvgBox).
|
|
191
|
-
if (type === 'Svg') {
|
|
192
|
-
if (flat.width === undefined && props.width !== undefined)
|
|
193
|
-
flat.width = props.width;
|
|
194
|
-
if (flat.height === undefined && props.height !== undefined)
|
|
195
|
-
flat.height = props.height;
|
|
196
|
-
}
|
|
197
|
-
// <Image source={...}> resolves to the engine asset name unless imageName was set explicitly.
|
|
198
|
-
if (flat.imageName === undefined && props.source != null) {
|
|
199
|
-
const name = resolveImageSource(props.source);
|
|
200
|
-
if (name != null) flat.imageName = name;
|
|
201
|
-
}
|
|
202
|
-
// <Dial knobImage={require(...)}> takes an asset source like <Image source>; a plain string is an
|
|
203
|
-
// asset name already.
|
|
204
|
-
if (
|
|
205
|
-
type === 'Dial' &&
|
|
206
|
-
props.knobImage != null &&
|
|
207
|
-
typeof props.knobImage !== 'string'
|
|
208
|
-
) {
|
|
209
|
-
const name = resolveImageSource(props.knobImage);
|
|
210
|
-
flat.knobImage = name != null ? name : undefined;
|
|
211
|
-
}
|
|
212
|
-
// `visible` is the Modal's own show/hide prop (it maps to ERProps.modal_visible). On every other
|
|
213
|
-
// component it used to be silently inert; it now means the same thing as `display`, so a subtree can
|
|
214
|
-
// be pruned from layout, raster and hit-testing without unmounting it. An explicit style `display`
|
|
215
|
-
// wins, so the two spellings can't disagree.
|
|
216
|
-
if (type !== 'Modal' && flat.visible !== undefined) {
|
|
217
|
-
if (flat.display === undefined)
|
|
218
|
-
flat.display = flat.visible ? 'flex' : 'none';
|
|
219
|
-
delete flat.visible;
|
|
220
|
-
}
|
|
221
|
-
// <Text> content: flatten string/number/nested-<Text> children into the node's full-text string.
|
|
222
|
-
// The engine renders this when no spans are set; with spans (buildTextSpans) it carries the same
|
|
223
|
-
// text for the plain-text fallback. Non-flattenable children fall back to mounted child instances.
|
|
224
|
-
if (type === 'Text' && isTextContent(props.children)) {
|
|
225
|
-
const baseStyle = flatStyle || flattenStyleObj(props.style);
|
|
226
|
-
flat.text = flattenTextChildren(props.children, baseStyle)
|
|
227
|
-
.map(segment => segment.text)
|
|
228
|
-
.join('');
|
|
229
|
-
}
|
|
230
|
-
return flat;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Bail-out depth for deepEqualProps. Real host props are shallow (style ≈ 2 levels, a nested-<Text>
|
|
234
|
-
// span or <Svg> shape tree ≈ 3 levels per element); anything deeper is pathological and bails to
|
|
235
|
-
// "changed", whose worst case is a redundant re-apply — exactly the pre-diff behavior.
|
|
236
|
-
const DEEP_EQUAL_MAX_DEPTH = 24;
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Deep value equality for host-prop diffing (the reconciler's prepareUpdate). Re-renders recreate
|
|
240
|
-
* prop objects every time, so identity alone can't tell "nothing changed" — this compares by value:
|
|
241
|
-
* primitives via Object.is, arrays elementwise, React elements by type and props (keys don't affect a
|
|
242
|
-
* flattened <Text>/<Svg> subtree's output), and plain objects key-by-key. Class instances (e.g.,
|
|
243
|
-
* Animated.Value) compare by IDENTITY only: a fresh instance must read as changed, so it gets bound
|
|
244
|
-
* to the node, while the same instance is already bound and can be skipped.
|
|
245
|
-
*/
|
|
246
|
-
export function deepEqualProps(left, right, depth = 0) {
|
|
247
|
-
if (Object.is(left, right)) return true;
|
|
248
|
-
if (depth >= DEEP_EQUAL_MAX_DEPTH) return false;
|
|
249
|
-
if (
|
|
250
|
-
typeof left !== 'object' ||
|
|
251
|
-
typeof right !== 'object' ||
|
|
252
|
-
left === null ||
|
|
253
|
-
right === null
|
|
254
|
-
)
|
|
255
|
-
return false;
|
|
256
|
-
if (Array.isArray(left) || Array.isArray(right)) {
|
|
257
|
-
if (
|
|
258
|
-
!Array.isArray(left) ||
|
|
259
|
-
!Array.isArray(right) ||
|
|
260
|
-
left.length !== right.length
|
|
261
|
-
)
|
|
262
|
-
return false;
|
|
263
|
-
for (let index = 0; index < left.length; index++) {
|
|
264
|
-
if (!deepEqualProps(left[index], right[index], depth + 1)) return false;
|
|
265
|
-
}
|
|
266
|
-
return true;
|
|
267
|
-
}
|
|
268
|
-
// React elements: equal when they render the same host output — same type, same props.
|
|
269
|
-
if (left.$$typeof !== right.$$typeof) return false;
|
|
270
|
-
if (left.$$typeof !== undefined) {
|
|
271
|
-
return (
|
|
272
|
-
left.type === right.type &&
|
|
273
|
-
deepEqualProps(left.props, right.props, depth + 1)
|
|
274
|
-
);
|
|
275
|
-
}
|
|
276
|
-
// Plain objects only; class instances fall through to "changed" (identity already ruled equal out).
|
|
277
|
-
const leftPrototype = Object.getPrototypeOf(left);
|
|
278
|
-
const rightPrototype = Object.getPrototypeOf(right);
|
|
279
|
-
if (
|
|
280
|
-
(leftPrototype !== null && leftPrototype !== Object.prototype) ||
|
|
281
|
-
(rightPrototype !== null && rightPrototype !== Object.prototype)
|
|
282
|
-
)
|
|
283
|
-
return false;
|
|
284
|
-
const leftKeys = Object.keys(left);
|
|
285
|
-
const rightKeys = Object.keys(right);
|
|
286
|
-
if (leftKeys.length !== rightKeys.length) return false;
|
|
287
|
-
for (const key of leftKeys) {
|
|
288
|
-
if (!Object.prototype.hasOwnProperty.call(right, key)) return false;
|
|
289
|
-
if (!deepEqualProps(left[key], right[key], depth + 1)) return false;
|
|
290
|
-
}
|
|
291
|
-
return true;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/**
|
|
295
|
-
* True for an `onXxx` prop whose value is a function (an event handler to route via setEvent).
|
|
296
|
-
*/
|
|
297
|
-
export function isEventProp(key, value) {
|
|
298
|
-
return (
|
|
299
|
-
key.length > 2 &&
|
|
300
|
-
key[0] === 'o' &&
|
|
301
|
-
key[1] === 'n' &&
|
|
302
|
-
key[2] >= 'A' &&
|
|
303
|
-
key[2] <= 'Z' &&
|
|
304
|
-
typeof value === 'function'
|
|
305
|
-
);
|
|
306
|
-
}
|