jsx.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import _Symbol from "@babel/runtime-corejs3/core-js/symbol";
  2. import _Symbol$for from "@babel/runtime-corejs3/core-js/symbol/for";
  3. var REACT_ELEMENT_TYPE;
  4. export default function _createRawReactElement(type, props, key, children) {
  5. if (!REACT_ELEMENT_TYPE) {
  6. REACT_ELEMENT_TYPE = typeof _Symbol === "function" && _Symbol$for && _Symbol$for("react.element") || 0xeac7;
  7. }
  8. var defaultProps = type && type.defaultProps;
  9. var childrenLength = arguments.length - 3;
  10. if (!props && childrenLength !== 0) {
  11. props = {
  12. children: void 0
  13. };
  14. }
  15. if (childrenLength === 1) {
  16. props.children = children;
  17. } else if (childrenLength > 1) {
  18. var childArray = new Array(childrenLength);
  19. for (var i = 0; i < childrenLength; i++) {
  20. childArray[i] = arguments[i + 3];
  21. }
  22. props.children = childArray;
  23. }
  24. if (props && defaultProps) {
  25. for (var propName in defaultProps) {
  26. if (props[propName] === void 0) {
  27. props[propName] = defaultProps[propName];
  28. }
  29. }
  30. } else if (!props) {
  31. props = defaultProps || {};
  32. }
  33. return {
  34. $$typeof: REACT_ELEMENT_TYPE,
  35. type: type,
  36. key: key === undefined ? null : "" + key,
  37. ref: null,
  38. props: props,
  39. _owner: null
  40. };
  41. }