PluginProbe
Gutenberg / 22.7.0
Gutenberg v22.7.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | build/scripts/viewport/index.js +20 -41 23.6.2 → 22.7.0 View file →
@@ -1,5 +1,4 @@
1 -"use strict";
2 1 var wp;
3 2 (wp ||= {}).viewport = (() => {
4 3 var __create = Object.create;
5 4 var __defProp = Object.defineProperty;
@@ -45,12 +44,12 @@
45 44 module.exports = window.wp.data;
46 45 }
47 46 });
48 47
49 - // package-external:@wordpress/element
50 - var require_element = __commonJS({
51 - "package-external:@wordpress/element"(exports, module) {
52 - module.exports = window.wp.element;
48 + // vendor-external:react/jsx-runtime
49 + var require_jsx_runtime = __commonJS({
50 + "vendor-external:react/jsx-runtime"(exports, module) {
51 + module.exports = window.ReactJSXRuntime;
53 52 }
54 53 });
55 54
56 55 // packages/viewport/build-module/index.mjs
@@ -125,17 +124,15 @@
125 124 );
126 125 const operatorEntries = Object.entries(operators);
127 126 const queries = Object.entries(breakpoints).flatMap(
128 127 ([name, width]) => {
129 - return operatorEntries.map(
130 - ([operator, condition]) => {
131 - const list = window.matchMedia(
132 - `(${condition}: ${width}px)`
133 - );
134 - list.addEventListener("change", setIsMatching2);
135 - return [`${operator} ${name}`, list];
136 - }
137 - );
128 + return operatorEntries.map(([operator, condition]) => {
129 + const list = window.matchMedia(
130 + `(${condition}: ${width}px)`
131 + );
132 + list.addEventListener("change", setIsMatching2);
133 + return [`${operator} ${name}`, list];
134 + });
138 135 }
139 136 );
140 137 window.addEventListener("orientationchange", setIsMatching2);
141 138 setIsMatching2();
@@ -146,10 +143,10 @@
146 143 // packages/viewport/build-module/if-viewport-matches.mjs
147 144 var import_compose3 = __toESM(require_compose(), 1);
148 145
149 146 // packages/viewport/build-module/with-viewport-match.mjs
150 - var import_element = __toESM(require_element(), 1);
151 147 var import_compose2 = __toESM(require_compose(), 1);
148 + var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
152 149 var withViewportMatch = (queries) => {
153 150 const queryEntries = Object.entries(queries);
154 151 const useViewPortQueriesResult = () => Object.fromEntries(
155 152 queryEntries.map(([key, query]) => {
@@ -157,33 +154,17 @@
157 154 if (breakpointName === void 0) {
158 155 breakpointName = operator;
159 156 operator = ">=";
160 157 }
161 - return [
162 - key,
163 - // Hooks should unconditionally execute in the same order,
164 - // we are respecting that as from the static query of the HOC we generate
165 - // a hook that calls other hooks always in the same order (because the query never changes).
166 - // eslint-disable-next-line react-hooks/rules-of-hooks
167 - (0, import_compose2.useViewportMatch)(
168 - breakpointName,
169 - operator
170 - )
171 - ];
158 + return [key, (0, import_compose2.useViewportMatch)(breakpointName, operator)];
172 159 })
173 160 );
174 - return (0, import_compose2.createHigherOrderComponent)(
175 - (WrappedComponent) => {
176 - return function WithViewportMatch(props) {
177 - const queriesResult = useViewPortQueriesResult();
178 - return (0, import_element.createElement)(WrappedComponent, {
179 - ...props,
180 - ...queriesResult
181 - });
182 - };
183 - },
184 - "withViewportMatch"
185 - );
161 + return (0, import_compose2.createHigherOrderComponent)((WrappedComponent) => {
162 + return (0, import_compose2.pure)((props) => {
163 + const queriesResult = useViewPortQueriesResult();
164 + return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WrappedComponent, { ...props, ...queriesResult });
165 + });
166 + }, "withViewportMatch");
186 167 };
187 168 var with_viewport_match_default = withViewportMatch;
188 169
189 170 // packages/viewport/build-module/if-viewport-matches.mjs
@@ -191,11 +172,9 @@
191 172 (0, import_compose3.compose)([
192 173 with_viewport_match_default({
193 174 isViewportMatch: query
194 175 }),
195 - (0, import_compose3.ifCondition)(
196 - (props) => props.isViewportMatch
197 - )
176 + (0, import_compose3.ifCondition)((props) => props.isViewportMatch)
198 177 ]),
199 178 "ifViewportMatches"
200 179 );
201 180 var if_viewport_matches_default = ifViewportMatches;