Reorder React element properties for consistent hidden class
This commit is contained in:
parent
1d0e68f5a1
commit
52fb99a341
@ -60,11 +60,6 @@ export var visitor = {
|
||||
objProps.push(t.property("init", key, value));
|
||||
}
|
||||
|
||||
// metadata
|
||||
pushElemProp("$$typeof", file.addHelper("typeof-react-element"));
|
||||
pushElemProp("type", type);
|
||||
pushElemProp("ref", t.literal(null));
|
||||
|
||||
if (node.children.length) {
|
||||
var children = react.buildChildren(node);
|
||||
children = children.length === 1 ? children[0] : t.arrayExpression(children);
|
||||
@ -85,10 +80,14 @@ export var visitor = {
|
||||
props = t.callExpression(file.addHelper("default-props"), [t.memberExpression(type, t.identifier("defaultProps")), props]);
|
||||
}
|
||||
|
||||
pushElemProp("props", props);
|
||||
|
||||
// key
|
||||
// metadata
|
||||
pushElemProp("$$typeof", file.addHelper("typeof-react-element"));
|
||||
pushElemProp("type", type);
|
||||
pushElemProp("key", key);
|
||||
pushElemProp("ref", t.literal(null));
|
||||
|
||||
pushElemProp("props", props);
|
||||
pushElemProp("_owner", t.literal(null));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
@ -5,9 +5,10 @@ var _typeofReactElement = typeof Symbol === "function" && Symbol["for"] && Symbo
|
||||
var _ref = {
|
||||
$$typeof: _typeofReactElement,
|
||||
type: "foo",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {},
|
||||
key: null
|
||||
_owner: null
|
||||
};
|
||||
function render() {
|
||||
return _ref;
|
||||
@ -18,11 +19,12 @@ function render() {
|
||||
var _ref2 = {
|
||||
$$typeof: _typeofReactElement,
|
||||
type: "foo",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {
|
||||
children: text
|
||||
},
|
||||
key: null
|
||||
_owner: null
|
||||
};
|
||||
return function () {
|
||||
return _ref2;
|
||||
|
||||
@ -3,9 +3,10 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: Baz,
|
||||
key: null,
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Baz.defaultProps, {
|
||||
foo: "bar"
|
||||
}),
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,7 +3,8 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: Baz,
|
||||
key: null,
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Baz.defaultProps, {}),
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,9 +3,10 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: "foo",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {
|
||||
bar: "foo"
|
||||
},
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,7 +3,8 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: "foo",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {},
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,7 +3,8 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: Foo,
|
||||
key: "foo",
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Foo.defaultProps, {}),
|
||||
key: "foo"
|
||||
_owner: null
|
||||
});
|
||||
@ -3,16 +3,18 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: Foo,
|
||||
key: null,
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Foo.defaultProps, {
|
||||
children: [bar, {
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: Baz,
|
||||
key: "baz",
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Baz.defaultProps, {}),
|
||||
key: "baz"
|
||||
_owner: null
|
||||
}],
|
||||
className: "foo"
|
||||
}),
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,10 +3,11 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: "div",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {
|
||||
children: bar,
|
||||
className: "foo"
|
||||
},
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,16 +3,18 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: "div",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {
|
||||
children: [bar, {
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: Baz,
|
||||
key: "baz",
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Baz.defaultProps, {}),
|
||||
key: "baz"
|
||||
_owner: null
|
||||
}],
|
||||
className: "foo"
|
||||
},
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,9 +3,10 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: Baz,
|
||||
key: null,
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Baz.defaultProps, {
|
||||
foo: "bar"
|
||||
}),
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,7 +3,8 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: Baz,
|
||||
key: null,
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Baz.defaultProps, {}),
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,9 +3,10 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: "foo",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {
|
||||
bar: "foo"
|
||||
},
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,7 +3,8 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: "foo",
|
||||
key: null,
|
||||
ref: null,
|
||||
props: {},
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
@ -3,9 +3,10 @@
|
||||
({
|
||||
$$typeof: babelHelpers.typeofReactElement,
|
||||
type: Foo,
|
||||
key: null,
|
||||
ref: null,
|
||||
props: babelHelpers.defaultProps(Foo.defaultProps, {
|
||||
bar: true
|
||||
}),
|
||||
key: null
|
||||
_owner: null
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user