PluginProbe
Elementor Website Builder – more than just a page builder / 3.28.0-dev2
Elementor Website Builder – more than just a page builder v3.28.0-dev2
4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 All 455 releases
← All changes | assets/js/packages/editor-responsive/editor-responsive.js +2 -148 4.3.1 → 3.28.0-dev2 View file →
@@ -1,148 +1,2 @@
1 -(function(react, _elementor_editor_v1_adapters, _wordpress_i18n) {
2 -
3 -//#region \0rolldown/runtime.js
4 - var __defProp = Object.defineProperty;
5 - var __name = (target, value) => __defProp(target, "name", {
6 - value,
7 - configurable: true
8 - });
9 - var __exportAll = (all, no_symbols) => {
10 - let target = {};
11 - for (var name in all) {
12 - __defProp(target, name, {
13 - get: all[name],
14 - enumerable: true
15 - });
16 - }
17 - if (!no_symbols) {
18 - __defProp(target, Symbol.toStringTag, { value: "Module" });
19 - }
20 - return target;
21 - };
22 -
23 -//#endregion
24 -
25 -//#region packages/packages/libs/editor-responsive/src/hooks/use-activate-breakpoint.ts
26 - function useActivateBreakpoint() {
27 - return (0, react.useCallback)((breakpoint) => {
28 - return (0, _elementor_editor_v1_adapters.__privateRunCommand)("panel/change-device-mode", { device: breakpoint });
29 - }, []);
30 - }
31 -
32 -//#endregion
33 -//#region packages/packages/libs/editor-responsive/src/hooks/use-active-breakpoint.ts
34 - function useActiveBreakpoint() {
35 - return (0, _elementor_editor_v1_adapters.__privateUseListenTo)((0, _elementor_editor_v1_adapters.windowEvent)("elementor/device-mode/change"), getActiveBreakpoint);
36 - }
37 - function getActiveBreakpoint() {
38 - return window.elementor?.channels?.deviceMode?.request?.("currentMode") || null;
39 - }
40 -
41 -//#endregion
42 -//#region packages/packages/libs/editor-responsive/src/sync/utils/get-breakpoints-by-widths.ts
43 - function getBreakpointsByWidths() {
44 - const { breakpoints } = window.elementor?.config?.responsive || {};
45 - if (!breakpoints || Object.entries(breakpoints).length === 0) return {
46 - minWidth: [],
47 - defaults: [],
48 - maxWidth: []
49 - };
50 - const minWidth = [];
51 - const maxWidth = [];
52 - const defaults = [{
53 - id: "desktop",
54 - label: (0, _wordpress_i18n.__)("Desktop", "elementor")
55 - }];
56 - Object.entries(breakpoints).forEach(([id, v1Breakpoint]) => {
57 - if (!v1Breakpoint.is_enabled) return;
58 - const breakpoint = {
59 - id,
60 - label: v1Breakpoint.label,
61 - width: v1Breakpoint.value,
62 - type: v1Breakpoint.direction === "min" ? "min-width" : "max-width"
63 - };
64 - if (!breakpoint.width) defaults.push(breakpoint);
65 - else if (breakpoint.type === "min-width") minWidth.push(breakpoint);
66 - else if (breakpoint.type === "max-width") maxWidth.push(breakpoint);
67 - });
68 - const byWidth = (a, b) => {
69 - return a.width && b.width ? b.width - a.width : 0;
70 - };
71 - return {
72 - minWidth: minWidth.sort(byWidth),
73 - defaults,
74 - maxWidth: maxWidth.sort(byWidth)
75 - };
76 - }
77 -
78 -//#endregion
79 -//#region packages/packages/libs/editor-responsive/src/sync/get-breakpoints.ts
80 - function getBreakpoints() {
81 - const { minWidth, defaults, maxWidth } = getBreakpointsByWidths();
82 - return [
83 - ...minWidth,
84 - ...defaults,
85 - ...maxWidth
86 - ];
87 - }
88 -
89 -//#endregion
90 -//#region packages/packages/libs/editor-responsive/src/hooks/use-breakpoints.ts
91 - function useBreakpoints() {
92 - return (0, _elementor_editor_v1_adapters.__privateUseListenTo)((0, _elementor_editor_v1_adapters.v1ReadyEvent)(), getBreakpoints);
93 - }
94 -
95 -//#endregion
96 -//#region packages/packages/libs/editor-responsive/src/hooks/use-breakpoints-map.ts
97 - function useBreakpointsMap() {
98 - const breakpoints = useBreakpoints();
99 - return (0, react.useMemo)(() => {
100 - const entries = breakpoints.map((breakpoint) => [breakpoint.id, breakpoint]);
101 - return Object.fromEntries(entries);
102 - }, [breakpoints]);
103 - }
104 -
105 -//#endregion
106 -//#region packages/packages/libs/editor-responsive/src/sync/get-breakpoints-tree.ts
107 - function getBreakpointsTree() {
108 - const { minWidth, defaults, maxWidth } = getBreakpointsByWidths();
109 - const [rootBreakpoint] = defaults;
110 - const rootNode = {
111 - ...rootBreakpoint,
112 - children: []
113 - };
114 - const buildBranch = (breakpoints) => {
115 - let last = rootNode;
116 - breakpoints.forEach((breakpoint) => {
117 - const newNode = {
118 - ...breakpoint,
119 - children: []
120 - };
121 - last.children.push(newNode);
122 - last = newNode;
123 - });
124 - };
125 - buildBranch(minWidth);
126 - buildBranch(maxWidth);
127 - return rootNode;
128 - }
129 -
130 -//#endregion
131 -//#region packages/packages/libs/editor-responsive/src/index.ts
132 - var src_exports = /* @__PURE__ */ __exportAll({
133 - getBreakpoints: () => getBreakpoints,
134 - getBreakpointsTree: () => getBreakpointsTree,
135 - useActivateBreakpoint: () => useActivateBreakpoint,
136 - useActiveBreakpoint: () => useActiveBreakpoint,
137 - useBreakpoints: () => useBreakpoints,
138 - useBreakpointsMap: () => useBreakpointsMap
139 - });
140 -
141 -//#endregion
142 -//#region \0elementor-package-library-entry
143 - (window.elementorV2 = window.elementorV2 || {}).editorResponsive = src_exports;
144 -
145 -//#endregion
146 -})(React, elementorV2.editorV1Adapters, wp.i18n);
147 -window.elementorV2.editorResponsive?.init?.();
148 -//# sourceMappingURL=editor-responsive.js.map
1 +/*! For license information please see editor-responsive.js.LICENSE.txt */
2 +!function(){"use strict";var e={react:function(e){e.exports=window.React},"@elementor/editor-v1-adapters":function(e){e.exports=window.elementorV2.editorV1Adapters},"@wordpress/i18n":function(e){e.exports=window.wp.i18n}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=function(e,t){for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};!function(){n.r(r),n.d(r,{getBreakpoints:function(){return i},getBreakpointsMap:function(){return a},useActivateBreakpoint:function(){return c},useActiveBreakpoint:function(){return d},useBreakpoints:function(){return u}});var e=n("@elementor/editor-v1-adapters"),t=n("@wordpress/i18n"),o=n("react");function i(){const{breakpoints:e}=window.elementor?.config?.responsive||{};if(!e||0===Object.entries(e).length)return[];const n=[],r=[],o=[{id:"desktop",label:(0,t.__)("Desktop","elementor")}];Object.entries(e).forEach((([e,t])=>{if(!t.is_enabled)return;const i={id:e,label:t.label,width:t.value,type:"min"===t.direction?"min-width":"max-width"};i.width?"min-width"===i.type?n.push(i):"max-width"===i.type&&r.push(i):o.push(i)}));const i=(e,t)=>e.width&&t.width?t.width-e.width:0;return[...n.sort(i),...o,...r.sort(i)]}function u(){return(0,e.__privateUseListenTo)((0,e.v1ReadyEvent)(),i)}function d(){return(0,e.__privateUseListenTo)((0,e.windowEvent)("elementor/device-mode/change"),s)}function s(){const e=window;return e.elementor?.channels?.deviceMode?.request?.("currentMode")||null}function c(){return(0,o.useCallback)((t=>(0,e.__privateRunCommand)("panel/change-device-mode",{device:t})),[])}function a(){const e=i().map((e=>[e.id,e]));return Object.fromEntries(e)}}(),(window.elementorV2=window.elementorV2||{}).editorResponsive=r}();