| @@ -1,4 +1,5 @@ | ||
| 1 | +(function() { | |
| 1 | 2 | "use strict"; |
| 2 | 3 | var wp; |
| 3 | 4 | (wp ||= {}).element = (() => { |
| 4 | 5 | var __create = Object.create; |
| @@ -59,19 +60,11 @@ | ||
| 59 | 60 | module.exports = window.wp.escapeHtml; |
| 60 | 61 | } |
| 61 | 62 | }); |
| 62 | 63 | |
| 63 | - // package-external:@wordpress/deprecated | |
| 64 | - var require_deprecated = __commonJS({ | |
| 65 | - "package-external:@wordpress/deprecated"(exports, module) { | |
| 66 | - module.exports = window.wp.deprecated; | |
| 67 | - } | |
| 68 | - }); | |
| 69 | - | |
| 70 | 64 | // packages/element/build-module/index.mjs |
| 71 | 65 | var index_exports = {}; |
| 72 | 66 | __export(index_exports, { |
| 73 | - Activity: () => import_react.Activity, | |
| 74 | 67 | Children: () => import_react.Children, |
| 75 | 68 | Component: () => import_react.Component, |
| 76 | 69 | Fragment: () => import_react.Fragment, |
| 77 | 70 | Platform: () => platform_default, |
| @@ -83,46 +76,35 @@ | ||
| 83 | 76 | concatChildren: () => concatChildren, |
| 84 | 77 | createContext: () => import_react.createContext, |
| 85 | 78 | createElement: () => import_react.createElement, |
| 86 | 79 | createInterpolateElement: () => create_interpolate_element_default, |
| 87 | - createPortal: () => import_react_dom.createPortal, | |
| 80 | + createPortal: () => createPortal, | |
| 88 | 81 | createRef: () => import_react.createRef, |
| 89 | 82 | createRoot: () => import_client.createRoot, |
| 90 | - findDOMNode: () => findDOMNode2, | |
| 91 | - flushSync: () => import_react_dom.flushSync, | |
| 83 | + findDOMNode: () => findDOMNode, | |
| 84 | + flushSync: () => flushSync, | |
| 92 | 85 | forwardRef: () => import_react.forwardRef, |
| 93 | - hydrate: () => hydrate2, | |
| 86 | + hydrate: () => hydrate, | |
| 94 | 87 | hydrateRoot: () => import_client.hydrateRoot, |
| 95 | 88 | isEmptyElement: () => isEmptyElement, |
| 96 | 89 | isValidElement: () => import_react.isValidElement, |
| 97 | 90 | lazy: () => import_react.lazy, |
| 98 | 91 | memo: () => import_react.memo, |
| 99 | - preconnect: () => import_react_dom.preconnect, | |
| 100 | - prefetchDNS: () => import_react_dom.prefetchDNS, | |
| 101 | - preinit: () => import_react_dom.preinit, | |
| 102 | - preinitModule: () => import_react_dom.preinitModule, | |
| 103 | - preload: () => import_react_dom.preload, | |
| 104 | - preloadModule: () => import_react_dom.preloadModule, | |
| 105 | - render: () => render2, | |
| 92 | + render: () => render, | |
| 106 | 93 | renderToString: () => serialize_default, |
| 107 | 94 | startTransition: () => import_react.startTransition, |
| 108 | 95 | switchChildrenNodeName: () => switchChildrenNodeName, |
| 109 | - unmountComponentAtNode: () => unmountComponentAtNode2, | |
| 110 | - use: () => import_react.use, | |
| 111 | - useActionState: () => import_react.useActionState, | |
| 96 | + unmountComponentAtNode: () => unmountComponentAtNode, | |
| 112 | 97 | useCallback: () => import_react.useCallback, |
| 113 | 98 | useContext: () => import_react.useContext, |
| 114 | 99 | useDebugValue: () => import_react.useDebugValue, |
| 115 | 100 | useDeferredValue: () => import_react.useDeferredValue, |
| 116 | 101 | useEffect: () => import_react.useEffect, |
| 117 | - useEffectEvent: () => import_react.useEffectEvent, | |
| 118 | - useFormStatus: () => import_react_dom.useFormStatus, | |
| 119 | 102 | useId: () => import_react.useId, |
| 120 | 103 | useImperativeHandle: () => import_react.useImperativeHandle, |
| 121 | 104 | useInsertionEffect: () => import_react.useInsertionEffect, |
| 122 | 105 | useLayoutEffect: () => import_react.useLayoutEffect, |
| 123 | 106 | useMemo: () => import_react.useMemo, |
| 124 | - useOptimistic: () => import_react.useOptimistic, | |
| 125 | 107 | useReducer: () => import_react.useReducer, |
| 126 | 108 | useRef: () => import_react.useRef, |
| 127 | 109 | useState: () => import_react.useState, |
| 128 | 110 | useSyncExternalStore: () => import_react.useSyncExternalStore, |
| @@ -248,8 +230,17 @@ | ||
| 248 | 230 | ); |
| 249 | 231 | offset = startOffset + tokenLength; |
| 250 | 232 | return true; |
| 251 | 233 | case "closer": |
| 234 | + if (0 === stackDepth) { | |
| 235 | + if (true) { | |
| 236 | + console.warn( | |
| 237 | + `Unmatched closing tag '</${name}>' in createInterpolateElement. The rest of the string was not interpolated.` | |
| 238 | + ); | |
| 239 | + } | |
| 240 | + addText(); | |
| 241 | + return false; | |
| 242 | + } | |
| 252 | 243 | if (1 === stackDepth) { |
| 253 | 244 | closeOuterElement(startOffset); |
| 254 | 245 | offset = startOffset + tokenLength; |
| 255 | 246 | return true; |
| @@ -327,10 +318,20 @@ | ||
| 327 | 318 | } |
| 328 | 319 | var create_interpolate_element_default = createInterpolateElement; |
| 329 | 320 | |
| 330 | 321 | // packages/element/build-module/react-platform.mjs |
| 331 | - var import_react_dom = __toESM(require_react_dom(), 1); | |
| 322 | + var ReactDOM = __toESM(require_react_dom(), 1); | |
| 332 | 323 | var import_client = __toESM(require_client(), 1); |
| 324 | + var { | |
| 325 | + createPortal, | |
| 326 | + flushSync, | |
| 327 | + /* eslint-disable react/no-deprecated */ | |
| 328 | + findDOMNode, | |
| 329 | + render, | |
| 330 | + hydrate, | |
| 331 | + unmountComponentAtNode | |
| 332 | + /* eslint-enable react/no-deprecated */ | |
| 333 | + } = ReactDOM; | |
| 333 | 334 | |
| 334 | 335 | // packages/element/build-module/utils.mjs |
| 335 | 336 | var isEmptyElement = (element) => { |
| 336 | 337 | if (typeof element === "number") { |
| @@ -459,8 +460,11 @@ | ||
| 459 | 460 | var { Provider, Consumer } = Context; |
| 460 | 461 | var ForwardRef = (0, import_react.forwardRef)(() => { |
| 461 | 462 | return null; |
| 462 | 463 | }); |
| 464 | + var Memo = (0, import_react.memo)(() => { | |
| 465 | + return null; | |
| 466 | + }); | |
| 463 | 467 | var ATTRIBUTES_TYPES = /* @__PURE__ */ new Set(["string", "boolean", "number"]); |
| 464 | 468 | var SELF_CLOSING_TAGS = /* @__PURE__ */ new Set([ |
| 465 | 469 | "area", |
| 466 | 470 | "base", |
| @@ -840,11 +844,9 @@ | ||
| 840 | 844 | case Provider.$$typeof: |
| 841 | 845 | return renderChildren(props.children, props.value, legacyContext); |
| 842 | 846 | case Consumer.$$typeof: |
| 843 | 847 | return renderElement( |
| 844 | - props.children( | |
| 845 | - context || type._currentValue || type._context._currentValue | |
| 846 | - ), | |
| 848 | + props.children(context || type._currentValue), | |
| 847 | 849 | context, |
| 848 | 850 | legacyContext |
| 849 | 851 | ); |
| 850 | 852 | case ForwardRef.$$typeof: |
| @@ -852,8 +854,14 @@ | ||
| 852 | 854 | type.render(props), |
| 853 | 855 | context, |
| 854 | 856 | legacyContext |
| 855 | 857 | ); |
| 858 | + case Memo.$$typeof: | |
| 859 | + return renderElement( | |
| 860 | + (0, import_react.createElement)(type.type, props), | |
| 861 | + context, | |
| 862 | + legacyContext | |
| 863 | + ); | |
| 856 | 864 | } |
| 857 | 865 | return ""; |
| 858 | 866 | } |
| 859 | 867 | function renderNativeComponent(type, props, context, legacyContext = {}) { |
| @@ -948,143 +956,8 @@ | ||
| 948 | 956 | } |
| 949 | 957 | return result; |
| 950 | 958 | } |
| 951 | 959 | var serialize_default = renderElement; |
| 952 | - | |
| 953 | - // packages/element/build-module/react-polyfill.mjs | |
| 954 | - var import_deprecated = __toESM(require_deprecated(), 1); | |
| 955 | - | |
| 956 | - // packages/element/build-module/react-polyfill-base.mjs | |
| 957 | - var import_react_dom2 = __toESM(require_react_dom(), 1); | |
| 958 | - var import_client2 = __toESM(require_client(), 1); | |
| 959 | - var internalsKey = "_reactInternals"; | |
| 960 | - var HostComponent = 5; | |
| 961 | - var HostText = 6; | |
| 962 | - function findCurrentFiber(fiber) { | |
| 963 | - if (!fiber.alternate) { | |
| 964 | - return fiber; | |
| 965 | - } | |
| 966 | - let node = fiber; | |
| 967 | - while (node.return) { | |
| 968 | - node = node.return; | |
| 969 | - } | |
| 970 | - if (node.stateNode.current === node) { | |
| 971 | - return fiber; | |
| 972 | - } | |
| 973 | - return fiber.alternate; | |
| 974 | - } | |
| 975 | - function findHostFiber(fiber) { | |
| 976 | - const current = findCurrentFiber(fiber); | |
| 977 | - if (!current) { | |
| 978 | - return null; | |
| 979 | - } | |
| 980 | - return findHostFiberImpl(current); | |
| 981 | - } | |
| 982 | - function findHostFiberImpl(fiber) { | |
| 983 | - if (fiber.tag === HostComponent || fiber.tag === HostText) { | |
| 984 | - return fiber; | |
| 985 | - } | |
| 986 | - let child = fiber.child; | |
| 987 | - while (child) { | |
| 988 | - const hostFiber = findHostFiberImpl(child); | |
| 989 | - if (hostFiber) { | |
| 990 | - return hostFiber; | |
| 991 | - } | |
| 992 | - child = child.sibling; | |
| 993 | - } | |
| 994 | - return null; | |
| 995 | - } | |
| 996 | - function findDOMNode(instance) { | |
| 997 | - if (instance === null || instance === void 0) { | |
| 998 | - return null; | |
| 999 | - } | |
| 1000 | - if (instance.nodeType !== void 0) { | |
| 1001 | - return instance; | |
| 1002 | - } | |
| 1003 | - const fiber = instance[internalsKey]; | |
| 1004 | - if (fiber === void 0) { | |
| 1005 | - if (typeof instance.render === "function") { | |
| 1006 | - throw new Error("Unable to find node on an unmounted component."); | |
| 1007 | - } | |
| 1008 | - const keys = Object.keys(instance).join(","); | |
| 1009 | - throw new Error( | |
| 1010 | - `Argument appears to not be a ReactComponent. Keys: ${keys}` | |
| 1011 | - ); | |
| 1012 | - } | |
| 1013 | - const hostFiber = findHostFiber(fiber); | |
| 1014 | - return hostFiber?.stateNode ?? null; | |
| 1015 | - } | |
| 1016 | - var roots = /* @__PURE__ */ new WeakMap(); | |
| 1017 | - function render(element, container, callback) { | |
| 1018 | - let root = roots.get(container); | |
| 1019 | - if (!root) { | |
| 1020 | - root = (0, import_client2.createRoot)(container); | |
| 1021 | - roots.set(container, root); | |
| 1022 | - } | |
| 1023 | - (0, import_react_dom2.flushSync)(() => { | |
| 1024 | - root.render(element); | |
| 1025 | - }); | |
| 1026 | - if (typeof callback === "function") { | |
| 1027 | - callback(); | |
| 1028 | - } | |
| 1029 | - } | |
| 1030 | - function hydrate(element, container, callback) { | |
| 1031 | - let root = roots.get(container); | |
| 1032 | - if (!root) { | |
| 1033 | - root = (0, import_client2.hydrateRoot)(container, element); | |
| 1034 | - roots.set(container, root); | |
| 1035 | - } else { | |
| 1036 | - root.render(element); | |
| 1037 | - } | |
| 1038 | - if (typeof callback === "function") { | |
| 1039 | - callback(); | |
| 1040 | - } | |
| 1041 | - } | |
| 1042 | - function unmountComponentAtNode(container) { | |
| 1043 | - const root = roots.get(container); | |
| 1044 | - if (!root) { | |
| 1045 | - return false; | |
| 1046 | - } | |
| 1047 | - (0, import_react_dom2.flushSync)(() => { | |
| 1048 | - root.unmount(); | |
| 1049 | - }); | |
| 1050 | - roots.delete(container); | |
| 1051 | - return true; | |
| 1052 | - } | |
| 1053 | - | |
| 1054 | - // packages/element/build-module/react-polyfill.mjs | |
| 1055 | - function findDOMNode2(instance) { | |
| 1056 | - (0, import_deprecated.default)("wp.element.findDOMNode", { | |
| 1057 | - since: "7.1", | |
| 1058 | - alternative: "DOM refs", | |
| 1059 | - link: "https://react.dev/reference/react-dom/findDOMNode" | |
| 1060 | - }); | |
| 1061 | - return findDOMNode(instance); | |
| 1062 | - } | |
| 1063 | - function render2(element, container, callback) { | |
| 1064 | - (0, import_deprecated.default)("wp.element.render", { | |
| 1065 | - since: "6.2", | |
| 1066 | - alternative: "wp.element.createRoot", | |
| 1067 | - link: "https://react.dev/reference/react-dom/client/createRoot" | |
| 1068 | - }); | |
| 1069 | - render(element, container, callback); | |
| 1070 | - } | |
| 1071 | - function hydrate2(element, container, callback) { | |
| 1072 | - (0, import_deprecated.default)("wp.element.hydrate", { | |
| 1073 | - since: "6.2", | |
| 1074 | - alternative: "wp.element.hydrateRoot", | |
| 1075 | - link: "https://react.dev/reference/react-dom/client/hydrateRoot" | |
| 1076 | - }); | |
| 1077 | - hydrate(element, container, callback); | |
| 1078 | - } | |
| 1079 | - function unmountComponentAtNode2(container) { | |
| 1080 | - (0, import_deprecated.default)("wp.element.unmountComponentAtNode", { | |
| 1081 | - since: "6.2", | |
| 1082 | - alternative: "root.unmount()", | |
| 1083 | - link: "https://react.dev/reference/react-dom/client/createRoot#root-unmount" | |
| 1084 | - }); | |
| 1085 | - return unmountComponentAtNode(container); | |
| 1086 | - } | |
| 1087 | 960 | return __toCommonJS(index_exports); |
| 1088 | 961 | })(); |
| 1089 | 962 | /*! Bundled license information: |
| 1090 | 963 | |
| @@ -1095,5 +968,7 @@ | ||
| 1095 | 968 | * Copyright (c) 2014-2017, Jon Schlinkert. |
| 1096 | 969 | * Released under the MIT License. |
| 1097 | 970 | *) |
| 1098 | 971 | */ |
| 972 | +(window.wp ||= {}).element = wp.element; | |
| 973 | +})(); | |
| 1099 | 974 | //# sourceMappingURL=index.js.map |