PluginProbe
Polylang / 3.8.10
Polylang v3.8.10
3.8.10 3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 All 234 releases
← All changes | js/build/blocks.js +188 -142 3.8.6 → 3.8.10 View file →
@@ -1,40 +1,7 @@
1 1 /******/ (() => { // webpackBootstrap
2 2 /******/ var __webpack_modules__ = ({
3 3
4 -/***/ 20
5 -(__unused_webpack_module, exports, __webpack_require__) {
6 -
7 -"use strict";
8 -/**
9 - * @license React
10 - * react-jsx-runtime.production.min.js
11 - *
12 - * Copyright (c) Facebook, Inc. and its affiliates.
13 - *
14 - * This source code is licensed under the MIT license found in the
15 - * LICENSE file in the root directory of this source tree.
16 - */
17 -var f=__webpack_require__(677),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
18 -function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;
19 -
20 -
21 -/***/ },
22 -
23 -/***/ 848
24 -(module, __unused_webpack_exports, __webpack_require__) {
25 -
26 -"use strict";
27 -
28 -
29 -if (true) {
30 - module.exports = __webpack_require__(20);
31 -} else // removed by dead control flow
32 -{}
33 -
34 -
35 -/***/ },
36 -
37 4 /***/ 677
38 5 (module) {
39 6
40 7 module.exports = (function() { return this["React"]; }());
@@ -145,50 +112,46 @@
145 112 /******/ }
146 113 /******/
147 114 /************************************************************************/
148 115 /******/ /* webpack/runtime/compat get default export */
149 -/******/ (() => {
150 -/******/ // getDefaultExport function for compatibility with non-harmony modules
151 -/******/ __webpack_require__.n = (module) => {
152 -/******/ const getter = module && module.__esModule ?
153 -/******/ () => (module['default']) :
154 -/******/ () => (module);
155 -/******/ __webpack_require__.d(getter, { a: getter });
156 -/******/ return getter;
116 +/******/ // getDefaultExport function for compatibility with non-harmony modules
117 +/******/ __webpack_require__.n = (module) => {
118 +/******/ const getter = module && module.__esModule ?
119 +/******/ () => (module['default']) :
120 +/******/ () => (module);
121 +/******/ __webpack_require__.d(getter, { a: getter });
122 +/******/ return getter;
123 +/******/ };
124 +/******/
125 +/******/ /* webpack/runtime/concatenation wrap */
126 +/******/ // wrap a concatenated module body as a lazy, memoized accessor; mod is
127 +/******/ // set before the body runs so re-entrant calls (require cycles) observe
128 +/******/ // the partial exports like Node.js
129 +/******/ __webpack_require__.cw = (body) => {
130 +/******/ var mod;
131 +/******/ return () => {
132 +/******/ if (body) {
133 +/******/ var fn = body;
134 +/******/ body = 0;
135 +/******/ mod = { exports: {} };
136 +/******/ fn.call(mod.exports, mod, mod.exports);
137 +/******/ }
138 +/******/ return mod.exports;
157 139 /******/ };
158 -/******/ })();
140 +/******/ };
159 141 /******/
160 142 /******/ /* webpack/runtime/define property getters */
161 -/******/ (() => {
162 -/******/ // define getter/value functions for harmony exports
163 -/******/ __webpack_require__.d = (exports, definition) => {
164 -/******/ if(Array.isArray(definition)) {
165 -/******/ var i = 0;
166 -/******/ while(i < definition.length) {
167 -/******/ var key = definition[i++];
168 -/******/ var binding = definition[i++];
169 -/******/ if(!__webpack_require__.o(exports, key)) {
170 -/******/ if(binding === 0) {
171 -/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
172 -/******/ } else {
173 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
174 -/******/ }
175 -/******/ } else if(binding === 0) { i++; }
176 -/******/ }
177 -/******/ } else {
178 -/******/ for(var key in definition) {
179 -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
180 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
181 -/******/ }
182 -/******/ }
143 +/******/ // define getter/value functions for harmony exports
144 +/******/ __webpack_require__.d = (exports, definition) => {
145 +/******/ for(var key in definition) {
146 +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
147 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
183 148 /******/ }
184 -/******/ };
185 -/******/ })();
149 +/******/ }
150 +/******/ };
186 151 /******/
187 152 /******/ /* webpack/runtime/hasOwnProperty shorthand */
188 -/******/ (() => {
189 -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
190 -/******/ })();
153 +/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop));
191 154 /******/
192 155 /************************************************************************/
193 156 let __webpack_exports__ = {};
194 157 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
@@ -194,14 +157,47 @@
194 157 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
195 158 (() => {
196 159 "use strict";
197 160
161 +// MODULE: ./node_modules/react/cjs/react-jsx-runtime.production.min.js
162 +var react_jsx_runtime_production_min_namespaceFn = /*#__PURE__*/__webpack_require__.cw(function(module, exports) {
163 +/**
164 + * @license React
165 + * react-jsx-runtime.production.min.js
166 + *
167 + * Copyright (c) Facebook, Inc. and its affiliates.
168 + *
169 + * This source code is licensed under the MIT license found in the
170 + * LICENSE file in the root directory of this source tree.
171 + */
172 +var f=(external_React_namespaceFn()),k=Symbol.for("react.element"),l=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};
173 +function q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=""+g);void 0!==a.key&&(e=""+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;
174 +
175 +});
176 +
177 +// MODULE: ./node_modules/react/jsx-runtime.js
178 +var jsx_runtime_namespaceFn = /*#__PURE__*/__webpack_require__.cw(function(module, exports) {
179 +
180 +
181 +if (true) {
182 + module.exports = (react_jsx_runtime_production_min_namespaceFn());
183 +} else // removed by dead control flow
184 +{}
185 +
186 +});
187 +
188 +// EXTERNAL MODULE: external "React"
189 +var external_React_namespaceFn = () => {
190 + return __webpack_require__(677);
191 +};
192 +
198 193 // EXTERNAL MODULE: external {"this":["wp","blocks"]}
199 194 var external_this_wp_blocks_ = __webpack_require__(545);
200 195 // EXTERNAL MODULE: external {"this":["wp","primitives"]}
201 196 var external_this_wp_primitives_ = __webpack_require__(933);
202 -// EXTERNAL MODULE: ./node_modules/react/jsx-runtime.js
203 -var jsx_runtime = __webpack_require__(848);
197 +;// ./node_modules/react/jsx-runtime.js
198 +jsx_runtime_namespaceFn();
199 +
204 200 ;// ./node_modules/@wpsyntex/polylang-react-library/build/icons/translation.js
205 201 /**
206 202 * Translation icon - translation Dashicon.
207 203 */
@@ -211,14 +207,14 @@
211 207 */
212 208
213 209
214 210 const isPrimitivesComponents = 'undefined' !== typeof wp.primitives;
215 -const translation = isPrimitivesComponents ? /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_primitives_.SVG, {
211 +const translation = isPrimitivesComponents ? /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_primitives_.SVG, {
216 212 width: "20",
217 213 height: "20",
218 214 xmlns: "http://www.w3.org/2000/svg",
219 215 viewBox: "0 0 20 20",
220 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_primitives_.Path, {
216 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_primitives_.Path, {
221 217 d: "M11 7H9.49c-.63 0-1.25.3-1.59.7L7 5H4.13l-2.39 7h1.69l.74-2H7v4H2c-1.1 0-2-.9-2-2V5c0-1.1.9-2 2-2h7c1.1 0 2 .9 2 2v2zM6.51 9H4.49l1-2.93zM10 8h7c1.1 0 2 .9 2 2v7c0 1.1-.9 2-2 2h-7c-1.1 0-2-.9-2-2v-7c0-1.1.9-2 2-2zm7.25 5v-1.08h-3.17V9.75h-1.16v2.17H9.75V13h1.28c.11.85.56 1.85 1.28 2.62-.87.36-1.89.62-2.31.62-.01.02.22.97.2 1.46.84 0 2.21-.5 3.28-1.15 1.09.65 2.48 1.15 3.34 1.15-.02-.49.2-1.44.2-1.46-.43 0-1.49-.27-2.38-.63.7-.77 1.14-1.77 1.25-2.61h1.36zm-3.81 1.93c-.5-.46-.85-1.13-1.01-1.93h2.09c-.17.8-.51 1.47-1 1.93l-.04.03s-.03-.02-.04-.03z"
222 218 })
223 219 }) : 'translation';
224 220 /* harmony default export */ const icons_translation = (translation);
@@ -294,9 +290,9 @@
294 290 hide_current,
295 291 hide_if_no_translation
296 292 } = props.attributes;
297 293 function ToggleControlDropdown() {
298 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
294 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
299 295 label: i18nAttributeStrings.dropdown,
300 296 checked: dropdown,
301 297 onChange: toggleDropdown
302 298 });
@@ -301,9 +297,9 @@
301 297 onChange: toggleDropdown
302 298 });
303 299 }
304 300 function ToggleControlShowNames() {
305 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
301 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
306 302 label: i18nAttributeStrings.show_names,
307 303 checked: show_names // eslint-disable-line camelcase
308 304 ,
309 305 onChange: toggleShowNames
@@ -309,9 +305,9 @@
309 305 onChange: toggleShowNames
310 306 });
311 307 }
312 308 function ToggleControlShowFlags() {
313 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
309 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
314 310 label: i18nAttributeStrings.show_flags,
315 311 checked: show_flags // eslint-disable-line camelcase
316 312 ,
317 313 onChange: toggleShowFlags
@@ -317,9 +313,9 @@
317 313 onChange: toggleShowFlags
318 314 });
319 315 }
320 316 function ToggleControlForceHome() {
321 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
317 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
322 318 label: i18nAttributeStrings.force_home,
323 319 checked: force_home // eslint-disable-line camelcase
324 320 ,
325 321 onChange: toggleForceHome
@@ -325,9 +321,9 @@
325 321 onChange: toggleForceHome
326 322 });
327 323 }
328 324 function ToggleControlHideCurrent() {
329 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
325 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
330 326 label: i18nAttributeStrings.hide_current,
331 327 checked: hide_current // eslint-disable-line camelcase
332 328 ,
333 329 onChange: toggleHideCurrent
@@ -333,9 +329,9 @@
333 329 onChange: toggleHideCurrent
334 330 });
335 331 }
336 332 function ToggleControlHideIfNoTranslations() {
337 - return /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.ToggleControl, {
333 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.ToggleControl, {
338 334 label: i18nAttributeStrings.hide_if_no_translation,
339 335 checked: hide_if_no_translation // eslint-disable-line camelcase
340 336 ,
341 337 onChange: toggleHideIfNoTranslation
@@ -351,8 +347,62 @@
351 347 };
352 348 }
353 349 // EXTERNAL MODULE: external {"this":["wp","element"]}
354 350 var external_this_wp_element_ = __webpack_require__(601);
351 +// EXTERNAL MODULE: external {"this":["wp","data"]}
352 +var external_this_wp_data_ = __webpack_require__(987);
353 +;// ./js/src/blocks/hooks/use-current-language-with-editor-context.js
354 +/**
355 + * WordPress dependencies
356 + */
357 +
358 +
359 +/**
360 + * Finds a language by slug.
361 + *
362 + * @param {Array} languages The languages list.
363 + * @param {string} slug The language slug.
364 + * @return {Object|null} The language, `null` if not found.
365 + */
366 +const findLanguageBySlug = (languages, slug) => {
367 + if (!languages || !slug) {
368 + return null;
369 + }
370 + const currentLanguage = languages.find(language => {
371 + return language.slug === slug;
372 + });
373 + return currentLanguage ? currentLanguage : null;
374 +};
375 +
376 +/**
377 + * Resolves the current language in block editor contexts.
378 + *
379 + * The widgets editor does not load `@wordpress/editor`, so the `core/editor`
380 + * store may be unavailable. In that context, fall back to the current language
381 + * slug injected by PHP (default language when none is set).
382 + *
383 + * @param {Array} languages The languages list.
384 + * @return {Object|null} The current language, `null` if not found.
385 + */
386 +const useCurrentLanguageWithEditorContext = languages => {
387 + return (0,external_this_wp_data_.useSelect)(select => {
388 + if (!languages) {
389 + return null;
390 + }
391 + const editorStore = select('core/editor');
392 + if (!editorStore) {
393 + return findLanguageBySlug(languages, pllEditorCurrentLanguageSlug // eslint-disable-line no-undef
394 + );
395 + }
396 + const currentPost = editorStore.getCurrentPost();
397 + if (!currentPost) {
398 + return null;
399 + }
400 + const currentLanguageSlug = currentPost.lang ?? pllEditorCurrentLanguageSlug; // eslint-disable-line no-undef
401 +
402 + return findLanguageBySlug(languages, currentLanguageSlug);
403 + }, [languages]);
404 +};
355 405 ;// ./js/src/blocks/languages-context.js
356 406 /**
357 407 * WordPress dependencies.
358 408 */
@@ -428,10 +478,10 @@
428 478 const {
429 479 text,
430 480 flag
431 481 } = useMemoizedSwitcherLabel(language, showFlags, showNames);
432 - return /*#__PURE__*/(0,jsx_runtime.jsxs)("li", {
433 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
482 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)("li", {
483 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("span", {
434 484 dangerouslySetInnerHTML: {
435 485 __html: flag
436 486 }
437 487 }), " ", text, " "]
@@ -460,11 +510,11 @@
460 510 showNames,
461 511 isDropdown
462 512 }) => {
463 513 if (isDropdown) {
464 - return /*#__PURE__*/(0,jsx_runtime.jsx)("select", {
514 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("select", {
465 515 children: languages.map(language => {
466 - return /*#__PURE__*/(0,jsx_runtime.jsx)("option", {
516 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("option", {
467 517 value: language.slug,
468 518 children: language.name
469 519 }, language.slug);
470 520 })
@@ -469,11 +519,11 @@
469 519 }, language.slug);
470 520 })
471 521 });
472 522 }
473 - return /*#__PURE__*/(0,jsx_runtime.jsx)("ul", {
523 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("ul", {
474 524 children: languages.map(language => {
475 - return /*#__PURE__*/(0,jsx_runtime.jsx)(SwitcherListElement, {
525 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherListElement, {
476 526 language: language,
477 527 showFlags: showFlags,
478 528 showNames: showNames
479 529 }, language.slug);
@@ -479,39 +529,8 @@
479 529 }, language.slug);
480 530 })
481 531 });
482 532 };
483 -// EXTERNAL MODULE: external {"this":["wp","data"]}
484 -var external_this_wp_data_ = __webpack_require__(987);
485 -// EXTERNAL MODULE: external {"this":["wp","editor"]}
486 -var external_this_wp_editor_ = __webpack_require__(2);
487 -;// ./node_modules/@wpsyntex/polylang-react-library/build/hooks/use-current-language.js
488 -/**
489 - * WordPress dependencies
490 - */
491 -
492 -// This package is not found in `@wordpress/scripts` like others (peer dependency).
493 -// eslint-disable-next-line import/no-unresolved
494 -
495 -
496 -/**
497 - * Custom hook to get the current language from the editor.
498 - *
499 - * @param {Array} languages The languages list.
500 - * @return {Object|null} The current language, `null` if not found.
501 - */
502 -const useCurrentLanguage = languages => {
503 - const currentPost = (0,external_this_wp_data_.useSelect)(select => select(external_this_wp_editor_.store).getCurrentPost());
504 - if (!languages || !currentPost) {
505 - return null;
506 - }
507 - const currentLanguageSlug = currentPost.lang ?? pllEditorCurrentLanguageSlug; // eslint-disable-line no-undef
508 -
509 - const currentLanguage = languages.find(language => {
510 - return language.slug === currentLanguageSlug;
511 - });
512 - return currentLanguage ? currentLanguage : null;
513 -};
514 533 ;// ./node_modules/@wpsyntex/polylang-react-library/build/hooks/use-curated-languages.js
515 534 /**
516 535 * WordPress dependencies
517 536 */
@@ -552,8 +571,9 @@
552 571
553 572
554 573
555 574
575 +
556 576 /**
557 577 * Switcher container component.
558 578 *
559 579 * @param {Object} props The component props.
@@ -571,11 +591,11 @@
571 591 } = attributes;
572 592 const {
573 593 languages
574 594 } = (0,external_this_wp_element_.useContext)(LanguagesContext);
575 - const currentLanguage = useCurrentLanguage(languages);
595 + const currentLanguage = useCurrentLanguageWithEditorContext(languages);
576 596 const curatedLanguages = useCuratedLanguages(languages, currentLanguage, dropdown);
577 - return /*#__PURE__*/(0,jsx_runtime.jsx)(SwitcherUI, {
597 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherUI, {
578 598 languages: curatedLanguages,
579 599 showFlags: show_flags,
580 600 showNames: show_names,
581 601 isDropdown: dropdown
@@ -645,21 +665,21 @@
645 665 ToggleControlForceHome,
646 666 ToggleControlHideCurrent,
647 667 ToggleControlHideIfNoTranslations
648 668 } = createLanguageSwitcherEdit(props);
649 - return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
669 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)("div", {
650 670 ...(0,external_this_wp_blockEditor_.useBlockProps)(),
651 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_blockEditor_.InspectorControls, {
652 - children: /*#__PURE__*/(0,jsx_runtime.jsxs)(external_this_wp_components_.PanelBody, {
671 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_blockEditor_.InspectorControls, {
672 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)(external_this_wp_components_.PanelBody, {
653 673 title: (0,external_this_wp_i18n_.__)('Language switcher settings', 'polylang'),
654 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlDropdown, {}), !dropdown && /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlShowNames, {}), !dropdown && /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlShowFlags, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlForceHome, {}), !dropdown && /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlHideCurrent, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlHideIfNoTranslations, {})]
674 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlDropdown, {}), !dropdown && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlShowNames, {}), !dropdown && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlShowFlags, {}), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlForceHome, {}), !dropdown && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlHideCurrent, {}), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlHideIfNoTranslations, {})]
655 675 })
656 - }), /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.Disabled, {
657 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(LanguagesContext.Provider, {
676 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.Disabled, {
677 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(LanguagesContext.Provider, {
658 678 value: {
659 679 languages
660 680 },
661 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(SwitcherContainer, {
681 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherContainer, {
662 682 attributes: props.attributes
663 683 })
664 684 })
665 685 })]
@@ -719,11 +739,11 @@
719 739 const prefix = isTopLevel ? '' : ' ';
720 740 return (
721 741 /*#__PURE__*/
722 742 // eslint-disable-next-line jsx-a11y/anchor-is-valid
723 - (0,jsx_runtime.jsxs)("a", {
743 + (0,react_jsx_runtime_production_min_namespaceFn().jsxs)("a", {
724 744 href: '#',
725 - children: [prefix, /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
745 + children: [prefix, /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("span", {
726 746 dangerouslySetInnerHTML: {
727 747 __html: flag
728 748 }
729 749 }), " ", text, " "]
@@ -740,15 +760,15 @@
740 760 */
741 761
742 762
743 763 const submenu_isPrimitivesComponents = 'undefined' !== typeof wp.primitives;
744 -const SubmenuIcon = () => submenu_isPrimitivesComponents ? /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_primitives_.SVG, {
764 +const SubmenuIcon = () => submenu_isPrimitivesComponents ? /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_primitives_.SVG, {
745 765 xmlns: "http://www.w3.org/2000/svg",
746 766 width: "12",
747 767 height: "12",
748 768 viewBox: "0 0 12 12",
749 769 fill: "none",
750 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_primitives_.Path, {
770 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_primitives_.Path, {
751 771 d: "M1.50002 4L6.00002 8L10.5 4",
752 772 strokeWidth: "1.5"
753 773 })
754 774 }) : 'submenu';
@@ -781,24 +801,50 @@
781 801 showFlags,
782 802 showNames,
783 803 withSubmenuIcon
784 804 }) => {
785 - return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
805 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)((react_jsx_runtime_production_min_namespaceFn().Fragment), {
786 806 children: languages && languages.map(language => {
787 - return /*#__PURE__*/(0,jsx_runtime.jsxs)(external_this_wp_element_.Fragment, {
788 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(SwitcherLinkElement, {
807 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)(external_this_wp_element_.Fragment, {
808 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(SwitcherLinkElement, {
789 809 language: language,
790 810 isTopLevel: languages.indexOf(language) === 0,
791 811 showFlags: showFlags,
792 812 showNames: showNames
793 - }), withSubmenuIcon && /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
813 + }), withSubmenuIcon && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)("span", {
794 814 className: "wp-block-navigation__submenu-icon",
795 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(submenu, {})
815 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(submenu, {})
796 816 })]
797 817 }, language.slug);
798 818 })
799 819 });
800 820 };
821 +// EXTERNAL MODULE: external {"this":["wp","editor"]}
822 +var external_this_wp_editor_ = __webpack_require__(2);
823 +;// ./node_modules/@wpsyntex/polylang-react-library/build/hooks/use-current-language.js
824 +/**
825 + * WordPress dependencies
826 + */
827 +
828 +
829 +
830 +/**
831 + * Custom hook to get the current language from the editor.
832 + *
833 + * @param {Array} languages The languages list.
834 + * @return {Object|null} The current language, `null` if not found.
835 + */
836 +const useCurrentLanguage = languages => {
837 + const currentPost = (0,external_this_wp_data_.useSelect)(select => select(external_this_wp_editor_.store).getCurrentPost());
838 + if (!languages || !currentPost) {
839 + return null;
840 + }
841 + const currentLanguageSlug = currentPost.lang ?? pllEditorCurrentLanguageSlug;
842 + const currentLanguage = languages.find(language => {
843 + return language.slug === currentLanguageSlug;
844 + });
845 + return currentLanguage ? currentLanguage : null;
846 +};
801 847 ;// ./js/src/blocks/navigation-language-switcher/components/navigation-switcher-container.js
802 848 /**
803 849 * WordPress dependencies
804 850 */
@@ -837,9 +883,9 @@
837 883 languages
838 884 } = (0,external_this_wp_element_.useContext)(LanguagesContext);
839 885 const currentLanguage = useCurrentLanguage(languages);
840 886 const curatedLanguages = useCuratedLanguages(languages, currentLanguage, dropdown);
841 - return /*#__PURE__*/(0,jsx_runtime.jsx)(switcher_ui_SwitcherUI, {
887 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(switcher_ui_SwitcherUI, {
842 888 languages: curatedLanguages,
843 889 showFlags: Boolean(show_flags),
844 890 showNames: Boolean(show_names),
845 891 withSubmenuIcon: Boolean((showSubmenuIcon || openSubmenusOnClick) && dropdown)
@@ -884,21 +930,21 @@
884 930 ToggleControlForceHome,
885 931 ToggleControlHideCurrent,
886 932 ToggleControlHideIfNoTranslations
887 933 } = createLanguageSwitcherEdit(props);
888 - return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
934 + return /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)("div", {
889 935 ...(0,external_this_wp_blockEditor_.useBlockProps)(),
890 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_blockEditor_.InspectorControls, {
891 - children: /*#__PURE__*/(0,jsx_runtime.jsxs)(external_this_wp_components_.PanelBody, {
936 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_blockEditor_.InspectorControls, {
937 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsxs)(external_this_wp_components_.PanelBody, {
892 938 title: (0,external_this_wp_i18n_.__)('Language switcher settings', 'polylang'),
893 - children: [/*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlDropdown, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlShowNames, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlShowFlags, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlForceHome, {}), !dropdown && /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlHideCurrent, {}), /*#__PURE__*/(0,jsx_runtime.jsx)(ToggleControlHideIfNoTranslations, {})]
939 + children: [/*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlDropdown, {}), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlShowNames, {}), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlShowFlags, {}), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlForceHome, {}), !dropdown && /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlHideCurrent, {}), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(ToggleControlHideIfNoTranslations, {})]
894 940 })
895 - }), /*#__PURE__*/(0,jsx_runtime.jsx)(external_this_wp_components_.Disabled, {
896 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(LanguagesContext.Provider, {
941 + }), /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(external_this_wp_components_.Disabled, {
942 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(LanguagesContext.Provider, {
897 943 value: {
898 944 languages
899 945 },
900 - children: /*#__PURE__*/(0,jsx_runtime.jsx)(NavigationSwitcherContainer, {
946 + children: /*#__PURE__*/(0,react_jsx_runtime_production_min_namespaceFn().jsx)(NavigationSwitcherContainer, {
901 947 attributes: props.attributes,
902 948 context: props.context
903 949 })
904 950 })