first commit

This commit is contained in:
2024-11-04 20:48:19 +01:00
commit 2fa33a3be9
7968 changed files with 2313063 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* This file is generated by Webpack, do not edit it directly.
*/
return [
'handle' => 'elementor-v2-editor-responsive',
'deps' => [
'elementor-v2-editor-app-bar',
'elementor-v2-editor-v1-adapters',
'elementor-v2-icons',
'elementor-v2-store',
'elementor-v2-ui',
'react',
'wp-i18n',
],
];

View File

@@ -0,0 +1,375 @@
/******/ (function() { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ "react":
/*!**************************!*\
!*** external ["React"] ***!
\**************************/
/***/ (function(module) {
module.exports = window["React"];
/***/ }),
/***/ "@elementor/editor-app-bar":
/*!***********************************************!*\
!*** external ["elementorV2","editorAppBar"] ***!
\***********************************************/
/***/ (function(module) {
module.exports = window["elementorV2"]["editorAppBar"];
/***/ }),
/***/ "@elementor/editor-v1-adapters":
/*!***************************************************!*\
!*** external ["elementorV2","editorV1Adapters"] ***!
\***************************************************/
/***/ (function(module) {
module.exports = window["elementorV2"]["editorV1Adapters"];
/***/ }),
/***/ "@elementor/icons":
/*!****************************************!*\
!*** external ["elementorV2","icons"] ***!
\****************************************/
/***/ (function(module) {
module.exports = window["elementorV2"]["icons"];
/***/ }),
/***/ "@elementor/store":
/*!****************************************!*\
!*** external ["elementorV2","store"] ***!
\****************************************/
/***/ (function(module) {
module.exports = window["elementorV2"]["store"];
/***/ }),
/***/ "@elementor/ui":
/*!*************************************!*\
!*** external ["elementorV2","ui"] ***!
\*************************************/
/***/ (function(module) {
module.exports = window["elementorV2"]["ui"];
/***/ }),
/***/ "@wordpress/i18n":
/*!******************************!*\
!*** external ["wp","i18n"] ***!
\******************************/
/***/ (function(module) {
module.exports = window["wp"]["i18n"];
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/make namespace object */
/******/ !function() {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ }();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
/*!******************************************************************!*\
!*** ./node_modules/@elementor/editor-responsive/dist/index.mjs ***!
\******************************************************************/
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _elementor_store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @elementor/store */ "@elementor/store");
/* harmony import */ var _elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @elementor/editor-v1-adapters */ "@elementor/editor-v1-adapters");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @elementor/editor-app-bar */ "@elementor/editor-app-bar");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var _elementor_ui__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @elementor/ui */ "@elementor/ui");
/* harmony import */ var _elementor_icons__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @elementor/icons */ "@elementor/icons");
// src/store/index.ts
var initialState = {
entities: {},
activeId: null
};
var slice = (0,_elementor_store__WEBPACK_IMPORTED_MODULE_0__.__createSlice)({
name: "breakpoints",
initialState,
reducers: {
init(state, action) {
state.activeId = action.payload.activeId;
state.entities = normalizeEntities(action.payload.entities);
},
activateBreakpoint(state, action) {
if (state.entities[action.payload]) {
state.activeId = action.payload;
}
}
}
});
function normalizeEntities(entities) {
return entities.reduce((acc, breakpoint) => {
return {
...acc,
[breakpoint.id]: breakpoint
};
}, {});
}
// src/sync/sync-store.ts
function syncStore() {
syncInitialization();
syncOnChange();
}
function syncInitialization() {
const { init: init2 } = slice.actions;
(0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.__privateListenTo)(
(0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.v1ReadyEvent)(),
() => {
(0,_elementor_store__WEBPACK_IMPORTED_MODULE_0__.__dispatch)(init2({
entities: getBreakpoints(),
activeId: getActiveBreakpoint()
}));
}
);
}
function syncOnChange() {
const { activateBreakpoint } = slice.actions;
(0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.__privateListenTo)(
deviceModeChangeEvent(),
() => {
const activeBreakpoint = getActiveBreakpoint();
(0,_elementor_store__WEBPACK_IMPORTED_MODULE_0__.__dispatch)(activateBreakpoint(activeBreakpoint));
}
);
}
function getBreakpoints() {
const { breakpoints } = window.elementor?.config?.responsive || {};
if (!breakpoints) {
return [];
}
const entities = Object.entries(breakpoints).filter(([, breakpoint]) => breakpoint.is_enabled).map(([id, { value, direction, label }]) => {
return {
id,
label,
width: value,
type: direction === "min" ? "min-width" : "max-width"
};
});
entities.push({
id: "desktop",
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("Desktop", "elementor")
});
return entities;
}
function getActiveBreakpoint() {
const extendedWindow = window;
return extendedWindow.elementor?.channels?.deviceMode?.request?.("currentMode") || null;
}
function deviceModeChangeEvent() {
return (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.windowEvent)("elementor/device-mode/change");
}
// src/init.ts
// src/components/breakpoints-switcher.tsx
// src/hooks/use-breakpoints.ts
// src/store/selectors.ts
var selectEntities = (state) => state.breakpoints.entities;
var selectActiveId = (state) => state.breakpoints.activeId;
var selectActiveBreakpoint = (0,_elementor_store__WEBPACK_IMPORTED_MODULE_0__.__createSelector)(
selectEntities,
selectActiveId,
(entities, activeId) => activeId && entities[activeId] ? entities[activeId] : null
);
var selectSortedBreakpoints = (0,_elementor_store__WEBPACK_IMPORTED_MODULE_0__.__createSelector)(
selectEntities,
(entities) => {
const byWidth = (a, b) => {
return a.width && b.width ? b.width - a.width : 0;
};
const all = Object.values(entities);
const defaults = all.filter((breakpoint) => !breakpoint.width);
const minWidth = all.filter((breakpoint) => breakpoint.type === "min-width");
const maxWidth = all.filter((breakpoint) => breakpoint.type === "max-width");
return [
...minWidth.sort(byWidth),
...defaults,
...maxWidth.sort(byWidth)
];
}
);
// src/hooks/use-breakpoints.ts
function useBreakpoints() {
const all = (0,_elementor_store__WEBPACK_IMPORTED_MODULE_0__.__useSelector)(selectSortedBreakpoints);
const active = (0,_elementor_store__WEBPACK_IMPORTED_MODULE_0__.__useSelector)(selectActiveBreakpoint);
return {
all,
active
};
}
// src/components/breakpoints-switcher.tsx
// src/hooks/use-breakpoints-actions.ts
function useBreakpointsActions() {
const activate = (0,react__WEBPACK_IMPORTED_MODULE_4__.useCallback)((device) => {
return (0,_elementor_editor_v1_adapters__WEBPACK_IMPORTED_MODULE_1__.__privateRunCommand)("panel/change-device-mode", { device });
}, []);
return {
activate
};
}
// src/components/breakpoints-switcher.tsx
function BreakpointsSwitcher() {
const { all, active } = useBreakpoints();
const { activate } = useBreakpointsActions();
if (!all.length || !active) {
return null;
}
const onChange = (_, value) => activate(value);
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_4__.createElement(
_elementor_ui__WEBPACK_IMPORTED_MODULE_5__.Tabs,
{
textColor: "inherit",
indicatorColor: "secondary",
value: active.id,
onChange,
"aria-label": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("Switch Device", "elementor"),
sx: {
"& .MuiTabs-indicator": {
backgroundColor: "text.primary"
}
}
},
all.map(({ id, label, type, width }) => {
const Icon = iconsMap[id];
const title = labelsMap[type || "default"].replace("%s", label).replace("%d", width?.toString() || "");
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_4__.createElement(
_elementor_ui__WEBPACK_IMPORTED_MODULE_5__.Tab,
{
value: id,
key: id,
"aria-label": title,
icon: /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_4__.createElement(Tooltip, { title }, /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_4__.createElement(Icon, null)),
sx: { minWidth: "auto" }
}
);
})
);
}
function Tooltip(props) {
return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_4__.createElement(
_elementor_ui__WEBPACK_IMPORTED_MODULE_5__.Tooltip,
{
PopperProps: {
sx: {
"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
mt: 2.5
}
}
},
...props
}
);
}
var iconsMap = {
widescreen: _elementor_icons__WEBPACK_IMPORTED_MODULE_6__.WidescreenIcon,
desktop: _elementor_icons__WEBPACK_IMPORTED_MODULE_6__.DesktopIcon,
laptop: _elementor_icons__WEBPACK_IMPORTED_MODULE_6__.LaptopIcon,
tablet_extra: _elementor_icons__WEBPACK_IMPORTED_MODULE_6__.TabletLandscapeIcon,
tablet: _elementor_icons__WEBPACK_IMPORTED_MODULE_6__.TabletPortraitIcon,
mobile_extra: _elementor_icons__WEBPACK_IMPORTED_MODULE_6__.MobileLandscapeIcon,
mobile: _elementor_icons__WEBPACK_IMPORTED_MODULE_6__.MobilePortraitIcon
};
var labelsMap = {
default: "%s",
// translators: %s: Breakpoint label, %d: Breakpoint size.
"min-width": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("%s (%dpx and up)", "elementor"),
// translators: %s: Breakpoint label, %d: Breakpoint size.
"max-width": (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("%s (up to %dpx)", "elementor")
};
// src/init.ts
function init() {
initStore();
registerAppBarUI();
}
function initStore() {
(0,_elementor_store__WEBPACK_IMPORTED_MODULE_0__.__registerSlice)(slice);
syncStore();
}
function registerAppBarUI() {
(0,_elementor_editor_app_bar__WEBPACK_IMPORTED_MODULE_3__.injectIntoResponsive)({
id: "responsive-breakpoints-switcher",
component: BreakpointsSwitcher,
options: {
priority: 20
// After document indication.
}
});
}
// src/index.ts
init();
//# sourceMappingURL=index.mjs.map
}();
(window.elementorV2 = window.elementorV2 || {}).editorResponsive = __webpack_exports__;
/******/ })()
;

View File

@@ -0,0 +1 @@
!function(){"use strict";var e={};(function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);var t=window.elementorV2.store,i=window.elementorV2.editorV1Adapters,n=window.wp.i18n,o=window.elementorV2.editorAppBar,a=window.React,r=window.elementorV2.ui,l=window.elementorV2.icons,c=(0,t.__createSlice)({name:"breakpoints",initialState:{entities:{},activeId:null},reducers:{init(e,t){e.activeId=t.payload.activeId,e.entities=t.payload.entities.reduce(((e,t)=>({...e,[t.id]:t})),{})},activateBreakpoint(e,t){e.entities[t.payload]&&(e.activeId=t.payload)}}});function d(){const{breakpoints:e}=window.elementor?.config?.responsive||{};if(!e)return[];const t=Object.entries(e).filter((([,e])=>e.is_enabled)).map((([e,{value:t,direction:i,label:n}])=>({id:e,label:n,width:t,type:"min"===i?"min-width":"max-width"})));return t.push({id:"desktop",label:(0,n.__)("Desktop","elementor")}),t}function s(){const e=window;return e.elementor?.channels?.deviceMode?.request?.("currentMode")||null}var p=e=>e.breakpoints.entities,u=(0,t.__createSelector)(p,(e=>e.breakpoints.activeId),((e,t)=>t&&e[t]?e[t]:null)),m=(0,t.__createSelector)(p,(e=>{const t=(e,t)=>e.width&&t.width?t.width-e.width:0,i=Object.values(e),n=i.filter((e=>!e.width)),o=i.filter((e=>"min-width"===e.type)),a=i.filter((e=>"max-width"===e.type));return[...o.sort(t),...n,...a.sort(t)]}));function w(e){return a.createElement(r.Tooltip,{PopperProps:{sx:{"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom":{mt:2.5}}},...e})}var v={widescreen:l.WidescreenIcon,desktop:l.DesktopIcon,laptop:l.LaptopIcon,tablet_extra:l.TabletLandscapeIcon,tablet:l.TabletPortraitIcon,mobile_extra:l.MobileLandscapeIcon,mobile:l.MobilePortraitIcon},_={default:"%s","min-width":(0,n.__)("%s (%dpx and up)","elementor"),"max-width":(0,n.__)("%s (up to %dpx)","elementor")};(0,t.__registerSlice)(c),function(){const{init:e}=c.actions;(0,i.__privateListenTo)((0,i.v1ReadyEvent)(),(()=>{(0,t.__dispatch)(e({entities:d(),activeId:s()}))}))}(),function(){const{activateBreakpoint:e}=c.actions;(0,i.__privateListenTo)((0,i.windowEvent)("elementor/device-mode/change"),(()=>{const i=s();(0,t.__dispatch)(e(i))}))}(),(0,o.injectIntoResponsive)({id:"responsive-breakpoints-switcher",component:function(){const{all:e,active:o}={all:(0,t.__useSelector)(m),active:(0,t.__useSelector)(u)},{activate:l}={activate:(0,a.useCallback)((e=>(0,i.__privateRunCommand)("panel/change-device-mode",{device:e})),[])};return e.length&&o?a.createElement(r.Tabs,{textColor:"inherit",indicatorColor:"secondary",value:o.id,onChange:(e,t)=>l(t),"aria-label":(0,n.__)("Switch Device","elementor"),sx:{"& .MuiTabs-indicator":{backgroundColor:"text.primary"}}},e.map((({id:e,label:t,type:i,width:n})=>{const o=v[e],l=_[i||"default"].replace("%s",t).replace("%d",n?.toString()||"");return a.createElement(r.Tab,{value:e,key:e,"aria-label":l,icon:a.createElement(w,{title:l},a.createElement(o,null)),sx:{minWidth:"auto"}})}))):null},options:{priority:20}}),(window.elementorV2=window.elementorV2||{}).editorResponsive=e}();

View File

@@ -0,0 +1,6 @@
__( 'Desktop', 'elementor' );
__( 'Switch Device', 'elementor' );
// translators: %s: Breakpoint label, %d: Breakpoint size.
__( '%s (%dpx and up)', 'elementor' );
// translators: %s: Breakpoint label, %d: Breakpoint size.
__( '%s (up to %dpx)', 'elementor' );