@elementor/editor-responsive 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/index.js ADDED
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from === "object" || typeof from === "function") {
10
+ for (let key of __getOwnPropNames(from))
11
+ if (!__hasOwnProp.call(to, key) && key !== except)
12
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ }
14
+ return to;
15
+ };
16
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
+ // If the importer is in node compatibility mode or this is not an ESM
18
+ // file that has been converted to a CommonJS file using a Babel-
19
+ // compatible transform (i.e. "__esModule" has not been set), then set
20
+ // "default" to the CommonJS "module.exports" for node compatibility.
21
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
+ mod
23
+ ));
24
+
25
+ // src/store/index.ts
26
+ var import_store = require("@elementor/store");
27
+ var initialState = {
28
+ entities: {},
29
+ activeId: null
30
+ };
31
+ function createSlice() {
32
+ return (0, import_store.addSlice)({
33
+ name: "breakpoints",
34
+ initialState,
35
+ reducers: {
36
+ init(state, action) {
37
+ state.activeId = action.payload.activeId;
38
+ state.entities = normalizeEntities(action.payload.entities);
39
+ },
40
+ activateBreakpoint(state, action) {
41
+ if (state.entities[action.payload]) {
42
+ state.activeId = action.payload;
43
+ }
44
+ }
45
+ }
46
+ });
47
+ }
48
+ function normalizeEntities(entities) {
49
+ return entities.reduce((acc, breakpoint) => {
50
+ return {
51
+ ...acc,
52
+ [breakpoint.id]: breakpoint
53
+ };
54
+ }, {});
55
+ }
56
+
57
+ // src/sync/sync-store.ts
58
+ var import_store2 = require("@elementor/store");
59
+ var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
60
+ var import_i18n = require("@wordpress/i18n");
61
+ function syncStore(slice) {
62
+ syncInitialization(slice);
63
+ syncOnChange(slice);
64
+ }
65
+ function syncInitialization(slice) {
66
+ const { init: init2 } = slice.actions;
67
+ (0, import_editor_v1_adapters.listenTo)(
68
+ (0, import_editor_v1_adapters.v1ReadyEvent)(),
69
+ () => {
70
+ (0, import_store2.dispatch)(init2({
71
+ entities: getBreakpoints(),
72
+ activeId: getActiveBreakpoint()
73
+ }));
74
+ }
75
+ );
76
+ }
77
+ function syncOnChange(slice) {
78
+ const { activateBreakpoint } = slice.actions;
79
+ (0, import_editor_v1_adapters.listenTo)(
80
+ deviceModeChangeEvent(),
81
+ () => {
82
+ const activeBreakpoint = getActiveBreakpoint();
83
+ (0, import_store2.dispatch)(activateBreakpoint(activeBreakpoint));
84
+ }
85
+ );
86
+ }
87
+ function getBreakpoints() {
88
+ const { breakpoints } = window.elementor?.config?.responsive || {};
89
+ if (!breakpoints) {
90
+ return [];
91
+ }
92
+ const entities = Object.entries(breakpoints).filter(([, breakpoint]) => breakpoint.is_enabled).map(([id, { value, direction, label }]) => {
93
+ return {
94
+ id,
95
+ label,
96
+ width: value,
97
+ type: direction === "min" ? "min-width" : "max-width"
98
+ };
99
+ });
100
+ entities.push({
101
+ id: "desktop",
102
+ label: (0, import_i18n.__)("Desktop", "elementor")
103
+ });
104
+ return entities;
105
+ }
106
+ function getActiveBreakpoint() {
107
+ const extendedWindow = window;
108
+ return extendedWindow.elementor?.channels?.deviceMode?.request?.("currentMode") || null;
109
+ }
110
+ function deviceModeChangeEvent() {
111
+ return (0, import_editor_v1_adapters.windowEvent)("elementor/device-mode/change");
112
+ }
113
+
114
+ // src/init.ts
115
+ var import_editor_app_bar = require("@elementor/editor-app-bar");
116
+
117
+ // src/components/breakpoints-switcher.tsx
118
+ var React = __toESM(require("react"));
119
+ var import_i18n2 = require("@wordpress/i18n");
120
+
121
+ // src/hooks/use-breakpoints.ts
122
+ var import_store4 = require("@elementor/store");
123
+
124
+ // src/store/selectors.ts
125
+ var import_store3 = require("@elementor/store");
126
+ var selectEntities = (state) => state.breakpoints.entities;
127
+ var selectActiveId = (state) => state.breakpoints.activeId;
128
+ var selectActiveBreakpoint = (0, import_store3.createSelector)(
129
+ selectEntities,
130
+ selectActiveId,
131
+ (entities, activeId) => activeId && entities[activeId] ? entities[activeId] : null
132
+ );
133
+ var selectSortedBreakpoints = (0, import_store3.createSelector)(
134
+ selectEntities,
135
+ (entities) => {
136
+ const byWidth = (a, b) => {
137
+ return a.width && b.width ? b.width - a.width : 0;
138
+ };
139
+ const all = Object.values(entities);
140
+ const defaults = all.filter((breakpoint) => !breakpoint.width);
141
+ const minWidth = all.filter((breakpoint) => breakpoint.type === "min-width");
142
+ const maxWidth = all.filter((breakpoint) => breakpoint.type === "max-width");
143
+ return [
144
+ ...minWidth.sort(byWidth),
145
+ ...defaults,
146
+ ...maxWidth.sort(byWidth)
147
+ ];
148
+ }
149
+ );
150
+
151
+ // src/hooks/use-breakpoints.ts
152
+ function useBreakpoints() {
153
+ const all = (0, import_store4.useSelector)(selectSortedBreakpoints);
154
+ const active = (0, import_store4.useSelector)(selectActiveBreakpoint);
155
+ return {
156
+ all,
157
+ active
158
+ };
159
+ }
160
+
161
+ // src/components/breakpoints-switcher.tsx
162
+ var import_ui = require("@elementor/ui");
163
+ var import_icons = require("@elementor/icons");
164
+
165
+ // src/hooks/use-breakpoints-actions.ts
166
+ var import_react = require("react");
167
+ var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
168
+ function useBreakpointsActions() {
169
+ const activate = (0, import_react.useCallback)((device) => {
170
+ return (0, import_editor_v1_adapters2.runCommand)("panel/change-device-mode", { device });
171
+ }, []);
172
+ return {
173
+ activate
174
+ };
175
+ }
176
+
177
+ // src/components/breakpoints-switcher.tsx
178
+ function BreakpointsSwitcher() {
179
+ const { all, active } = useBreakpoints();
180
+ const { activate } = useBreakpointsActions();
181
+ if (!all.length || !active) {
182
+ return null;
183
+ }
184
+ const onChange = (_, value) => activate(value);
185
+ return /* @__PURE__ */ React.createElement(import_ui.Tabs, { value: active.id, onChange, "aria-label": (0, import_i18n2.__)("Switch Device", "elementor") }, all.map(({ id, label, type, width }) => {
186
+ const Icon = iconsMap[id];
187
+ const title = labelsMap[type || "default"].replace("%s", label).replace("%d", width?.toString() || "");
188
+ return /* @__PURE__ */ React.createElement(
189
+ import_ui.Tab,
190
+ {
191
+ value: id,
192
+ key: id,
193
+ "aria-label": title,
194
+ icon: /* @__PURE__ */ React.createElement(Tooltip, { title }, /* @__PURE__ */ React.createElement(Icon, null))
195
+ }
196
+ );
197
+ }));
198
+ }
199
+ function Tooltip(props) {
200
+ return /* @__PURE__ */ React.createElement(
201
+ import_ui.Tooltip,
202
+ {
203
+ PopperProps: {
204
+ sx: {
205
+ "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
206
+ mt: 7
207
+ }
208
+ }
209
+ },
210
+ ...props
211
+ }
212
+ );
213
+ }
214
+ var iconsMap = {
215
+ widescreen: import_icons.WidescreenIcon,
216
+ desktop: import_icons.DesktopIcon,
217
+ laptop: import_icons.LaptopIcon,
218
+ tablet_extra: import_icons.TabletLandscapeIcon,
219
+ tablet: import_icons.TabletPortraitIcon,
220
+ mobile_extra: import_icons.MobileLandscapeIcon,
221
+ mobile: import_icons.MobilePortraitIcon
222
+ };
223
+ var labelsMap = {
224
+ default: "%s",
225
+ // translators: %s: Breakpoint label, %d: Breakpoint size.
226
+ "min-width": (0, import_i18n2.__)("%s (%dpx and up)", "elementor"),
227
+ // translators: %s: Breakpoint label, %d: Breakpoint size.
228
+ "max-width": (0, import_i18n2.__)("%s (up to %dpx)", "elementor")
229
+ };
230
+
231
+ // src/init.ts
232
+ function init() {
233
+ initStore();
234
+ registerAppBarUI();
235
+ }
236
+ function initStore() {
237
+ const slice = createSlice();
238
+ syncStore(slice);
239
+ }
240
+ function registerAppBarUI() {
241
+ (0, import_editor_app_bar.injectIntoResponsive)({
242
+ name: "responsive-breakpoints-switcher",
243
+ filler: BreakpointsSwitcher,
244
+ options: {
245
+ priority: 20
246
+ // After document indication.
247
+ }
248
+ });
249
+ }
250
+
251
+ // src/index.ts
252
+ init();
253
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/store/index.ts","../src/sync/sync-store.ts","../src/init.ts","../src/components/breakpoints-switcher.tsx","../src/hooks/use-breakpoints.ts","../src/store/selectors.ts","../src/hooks/use-breakpoints-actions.ts","../src/index.ts"],"sourcesContent":["import { addSlice, PayloadAction } from '@elementor/store';\nimport { Breakpoint, BreakpointId } from '../types';\n\nexport type State = {\n\tentities: Record<BreakpointId, Breakpoint>,\n\tactiveId: BreakpointId | null,\n}\nconst initialState: State = {\n\tentities: {} as State['entities'],\n\tactiveId: null,\n};\n\nexport function createSlice() {\n\treturn addSlice( {\n\t\tname: 'breakpoints',\n\t\tinitialState,\n\t\treducers: {\n\t\t\tinit( state, action: PayloadAction<{\n\t\t\t\tentities: Breakpoint[],\n\t\t\t\tactiveId: State['activeId'],\n\t\t\t}> ) {\n\t\t\t\tstate.activeId = action.payload.activeId;\n\t\t\t\tstate.entities = normalizeEntities( action.payload.entities );\n\t\t\t},\n\n\t\t\tactivateBreakpoint( state, action: PayloadAction<BreakpointId> ) {\n\t\t\t\tif ( state.entities[ action.payload ] ) {\n\t\t\t\t\tstate.activeId = action.payload;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t} );\n}\n\nfunction normalizeEntities( entities: Breakpoint[] ) {\n\treturn entities.reduce( ( acc, breakpoint ) => {\n\t\treturn {\n\t\t\t...acc,\n\t\t\t[ breakpoint.id ]: breakpoint,\n\t\t};\n\t}, {} as State['entities'] );\n}\n","import { dispatch } from '@elementor/store';\nimport { Breakpoint, ExtendedWindow, Slice } from '../types';\nimport { listenTo, v1ReadyEvent, windowEvent } from '@elementor/editor-v1-adapters';\nimport { __ } from '@wordpress/i18n';\n\nexport default function syncStore( slice: Slice ) {\n\tsyncInitialization( slice );\n\tsyncOnChange( slice );\n}\n\nfunction syncInitialization( slice: Slice ) {\n\tconst { init } = slice.actions;\n\n\tlistenTo(\n\t\tv1ReadyEvent(),\n\t\t() => {\n\t\t\tdispatch( init( {\n\t\t\t\tentities: getBreakpoints(),\n\t\t\t\tactiveId: getActiveBreakpoint(),\n\t\t\t} ) );\n\t\t}\n\t);\n}\n\nfunction syncOnChange( slice: Slice ) {\n\tconst { activateBreakpoint } = slice.actions;\n\n\tlistenTo(\n\t\tdeviceModeChangeEvent(),\n\t\t() => {\n\t\t\tconst activeBreakpoint = getActiveBreakpoint();\n\n\t\t\tdispatch( activateBreakpoint( activeBreakpoint ) );\n\t\t},\n\t);\n}\n\nfunction getBreakpoints() {\n\tconst { breakpoints } = ( window as unknown as ExtendedWindow ).elementor?.config?.responsive || {};\n\n\tif ( ! breakpoints ) {\n\t\treturn [];\n\t}\n\n\tconst entities = Object\n\t\t.entries( breakpoints )\n\t\t.filter( ( [ , breakpoint ] ) => breakpoint.is_enabled )\n\t\t.map( ( [ id, { value, direction, label } ] ) => {\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tlabel,\n\t\t\t\twidth: value,\n\t\t\t\ttype: direction === 'min' ? 'min-width' : 'max-width',\n\t\t\t} as Breakpoint;\n\t\t} );\n\n\t// Desktop breakpoint is not included in V1 config.\n\tentities.push( {\n\t\tid: 'desktop',\n\t\tlabel: __( 'Desktop', 'elementor' ),\n\t} );\n\n\treturn entities;\n}\n\nfunction getActiveBreakpoint() {\n\tconst extendedWindow = window as unknown as ExtendedWindow;\n\n\treturn extendedWindow.elementor?.channels?.deviceMode?.request?.( 'currentMode' ) || null;\n}\n\nfunction deviceModeChangeEvent() {\n\treturn windowEvent( 'elementor/device-mode/change' );\n}\n","import { createSlice } from './store';\nimport syncStore from './sync/sync-store';\nimport { injectIntoResponsive } from '@elementor/editor-app-bar';\nimport BreakpointsSwitcher from './components/breakpoints-switcher';\n\nexport default function init() {\n\tinitStore();\n\n\tregisterAppBarUI();\n}\n\nfunction initStore() {\n\tconst slice = createSlice();\n\n\tsyncStore( slice );\n}\n\nfunction registerAppBarUI() {\n\tinjectIntoResponsive( {\n\t\tname: 'responsive-breakpoints-switcher',\n\t\tfiller: BreakpointsSwitcher,\n\t\toptions: {\n\t\t\tpriority: 20, // After document indication.\n\t\t},\n\t} );\n}\n","import * as React from 'react';\nimport { __ } from '@wordpress/i18n';\nimport { BreakpointId } from '../types';\nimport useBreakpoints from '../hooks/use-breakpoints';\nimport { Tab, Tabs, Tooltip as BaseTooltip, TooltipProps } from '@elementor/ui';\nimport {\n\tDesktopIcon,\n\tTabletPortraitIcon,\n\tMobilePortraitIcon,\n\tWidescreenIcon,\n\tLaptopIcon,\n\tTabletLandscapeIcon,\n\tMobileLandscapeIcon,\n} from '@elementor/icons';\nimport useBreakpointsActions from '../hooks/use-breakpoints-actions';\n\nexport default function BreakpointsSwitcher() {\n\tconst { all, active } = useBreakpoints();\n\tconst { activate } = useBreakpointsActions();\n\n\tif ( ! all.length || ! active ) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( _: unknown, value: BreakpointId ) => activate( value );\n\n\treturn (\n\t\t<Tabs value={ active.id } onChange={ onChange } aria-label={ __( 'Switch Device', 'elementor' ) }>\n\t\t\t{\n\t\t\t\tall.map( ( { id, label, type, width } ) => {\n\t\t\t\t\tconst Icon = iconsMap[ id ];\n\n\t\t\t\t\tconst title = labelsMap[ type || 'default' ]\n\t\t\t\t\t\t.replace( '%s', label )\n\t\t\t\t\t\t.replace( '%d', width?.toString() || '' );\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Tab value={ id }\n\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t\t\ticon={ <Tooltip title={ title }><Icon /></Tooltip> }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t}\n\t\t</Tabs>\n\n\t);\n}\n\nfunction Tooltip( props: TooltipProps ) {\n\treturn <BaseTooltip\n\t\tPopperProps={ {\n\t\t\tsx: {\n\t\t\t\t'&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom': {\n\t\t\t\t\tmt: 7,\n\t\t\t\t},\n\t\t\t},\n\t\t} }\n\t\t{ ...props }\n\t/>;\n}\n\nconst iconsMap = {\n\twidescreen: WidescreenIcon,\n\tdesktop: DesktopIcon,\n\tlaptop: LaptopIcon,\n\ttablet_extra: TabletLandscapeIcon,\n\ttablet: TabletPortraitIcon,\n\tmobile_extra: MobileLandscapeIcon,\n\tmobile: MobilePortraitIcon,\n};\n\nconst labelsMap = {\n\tdefault: '%s',\n\t// translators: %s: Breakpoint label, %d: Breakpoint size.\n\t'min-width': __( '%s (%dpx and up)', 'elementor' ),\n\n\t// translators: %s: Breakpoint label, %d: Breakpoint size.\n\t'max-width': __( '%s (up to %dpx)', 'elementor' ),\n} as const;\n","import { useSelector } from '@elementor/store';\nimport { selectActiveBreakpoint, selectSortedBreakpoints } from '../store/selectors';\n\nexport default function useBreakpoints() {\n\tconst all = useSelector( selectSortedBreakpoints );\n\tconst active = useSelector( selectActiveBreakpoint );\n\n\treturn {\n\t\tall,\n\t\tactive,\n\t};\n}\n","import { Breakpoint, Slice } from '../types';\nimport { createSelector, SliceState } from '@elementor/store';\n\ntype State = SliceState<Slice>;\n\nexport const selectEntities = ( state: State ) => state.breakpoints.entities;\nexport const selectActiveId = ( state: State ) => state.breakpoints.activeId;\n\nexport const selectActiveBreakpoint = createSelector(\n\tselectEntities,\n\tselectActiveId,\n\t( entities, activeId ) => activeId && entities[ activeId ]\n\t\t? entities[ activeId ]\n\t\t: null,\n);\n\nexport const selectSortedBreakpoints = createSelector(\n\tselectEntities,\n\t( entities ) => {\n\t\tconst byWidth = ( a: Breakpoint, b: Breakpoint ) => {\n\t\t\treturn ( a.width && b.width ) ? b.width - a.width : 0;\n\t\t};\n\n\t\tconst all = Object.values( entities );\n\n\t\tconst defaults = all.filter( ( breakpoint ) => ! breakpoint.width ); // AKA Desktop.\n\t\tconst minWidth = all.filter( ( breakpoint ) => breakpoint.type === 'min-width' );\n\t\tconst maxWidth = all.filter( ( breakpoint ) => breakpoint.type === 'max-width' );\n\n\t\t// Sort by size, big to small.\n\t\treturn [\n\t\t\t...minWidth.sort( byWidth ),\n\t\t\t...defaults,\n\t\t\t...maxWidth.sort( byWidth ),\n\t\t];\n\t},\n);\n","import { useCallback } from 'react';\nimport { BreakpointId } from '../types';\nimport { runCommand } from '@elementor/editor-v1-adapters';\n\nexport default function useBreakpointsActions() {\n\tconst activate = useCallback( ( device: BreakpointId ) => {\n\t\treturn runCommand( 'panel/change-device-mode', { device } );\n\t}, [] );\n\n\treturn {\n\t\tactivate,\n\t};\n}\n","import init from './init';\n\ninit();\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mBAAwC;AAOxC,IAAM,eAAsB;AAAA,EAC3B,UAAU,CAAC;AAAA,EACX,UAAU;AACX;AAEO,SAAS,cAAc;AAC7B,aAAO,uBAAU;AAAA,IAChB,MAAM;AAAA,IACN;AAAA,IACA,UAAU;AAAA,MACT,KAAM,OAAO,QAGR;AACJ,cAAM,WAAW,OAAO,QAAQ;AAChC,cAAM,WAAW,kBAAmB,OAAO,QAAQ,QAAS;AAAA,MAC7D;AAAA,MAEA,mBAAoB,OAAO,QAAsC;AAChE,YAAK,MAAM,SAAU,OAAO,OAAQ,GAAI;AACvC,gBAAM,WAAW,OAAO;AAAA,QACzB;AAAA,MACD;AAAA,IACD;AAAA,EACD,CAAE;AACH;AAEA,SAAS,kBAAmB,UAAyB;AACpD,SAAO,SAAS,OAAQ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;AAAA,EAET,iBAAa,iBAAI,oBAAoB,WAAY;AAAA;AAAA,EAGjD,iBAAa,iBAAI,mBAAmB,WAAY;AACjD;;;AD3Ee,SAAR,OAAwB;AAC9B,YAAU;AAEV,mBAAiB;AAClB;AAEA,SAAS,YAAY;AACpB,QAAM,QAAQ,YAAY;AAE1B,YAAW,KAAM;AAClB;AAEA,SAAS,mBAAmB;AAC3B,kDAAsB;AAAA,IACrB,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,SAAS;AAAA,MACR,UAAU;AAAA;AAAA,IACX;AAAA,EACD,CAAE;AACH;;;AKvBA,KAAK;","names":["import_store","init","import_i18n","import_store","import_store","import_editor_v1_adapters","BaseTooltip"]}
package/dist/index.mjs ADDED
@@ -0,0 +1,237 @@
1
+ // src/store/index.ts
2
+ import { addSlice } from "@elementor/store";
3
+ var initialState = {
4
+ entities: {},
5
+ activeId: null
6
+ };
7
+ function createSlice() {
8
+ return addSlice({
9
+ name: "breakpoints",
10
+ initialState,
11
+ reducers: {
12
+ init(state, action) {
13
+ state.activeId = action.payload.activeId;
14
+ state.entities = normalizeEntities(action.payload.entities);
15
+ },
16
+ activateBreakpoint(state, action) {
17
+ if (state.entities[action.payload]) {
18
+ state.activeId = action.payload;
19
+ }
20
+ }
21
+ }
22
+ });
23
+ }
24
+ function normalizeEntities(entities) {
25
+ return entities.reduce((acc, breakpoint) => {
26
+ return {
27
+ ...acc,
28
+ [breakpoint.id]: breakpoint
29
+ };
30
+ }, {});
31
+ }
32
+
33
+ // src/sync/sync-store.ts
34
+ import { dispatch } from "@elementor/store";
35
+ import { listenTo, v1ReadyEvent, windowEvent } from "@elementor/editor-v1-adapters";
36
+ import { __ } from "@wordpress/i18n";
37
+ function syncStore(slice) {
38
+ syncInitialization(slice);
39
+ syncOnChange(slice);
40
+ }
41
+ function syncInitialization(slice) {
42
+ const { init: init2 } = slice.actions;
43
+ listenTo(
44
+ v1ReadyEvent(),
45
+ () => {
46
+ dispatch(init2({
47
+ entities: getBreakpoints(),
48
+ activeId: getActiveBreakpoint()
49
+ }));
50
+ }
51
+ );
52
+ }
53
+ function syncOnChange(slice) {
54
+ const { activateBreakpoint } = slice.actions;
55
+ listenTo(
56
+ deviceModeChangeEvent(),
57
+ () => {
58
+ const activeBreakpoint = getActiveBreakpoint();
59
+ dispatch(activateBreakpoint(activeBreakpoint));
60
+ }
61
+ );
62
+ }
63
+ function getBreakpoints() {
64
+ const { breakpoints } = window.elementor?.config?.responsive || {};
65
+ if (!breakpoints) {
66
+ return [];
67
+ }
68
+ const entities = Object.entries(breakpoints).filter(([, breakpoint]) => breakpoint.is_enabled).map(([id, { value, direction, label }]) => {
69
+ return {
70
+ id,
71
+ label,
72
+ width: value,
73
+ type: direction === "min" ? "min-width" : "max-width"
74
+ };
75
+ });
76
+ entities.push({
77
+ id: "desktop",
78
+ label: __("Desktop", "elementor")
79
+ });
80
+ return entities;
81
+ }
82
+ function getActiveBreakpoint() {
83
+ const extendedWindow = window;
84
+ return extendedWindow.elementor?.channels?.deviceMode?.request?.("currentMode") || null;
85
+ }
86
+ function deviceModeChangeEvent() {
87
+ return windowEvent("elementor/device-mode/change");
88
+ }
89
+
90
+ // src/init.ts
91
+ import { injectIntoResponsive } from "@elementor/editor-app-bar";
92
+
93
+ // src/components/breakpoints-switcher.tsx
94
+ import * as React from "react";
95
+ import { __ as __2 } from "@wordpress/i18n";
96
+
97
+ // src/hooks/use-breakpoints.ts
98
+ import { useSelector } from "@elementor/store";
99
+
100
+ // src/store/selectors.ts
101
+ import { createSelector } from "@elementor/store";
102
+ var selectEntities = (state) => state.breakpoints.entities;
103
+ var selectActiveId = (state) => state.breakpoints.activeId;
104
+ var selectActiveBreakpoint = createSelector(
105
+ selectEntities,
106
+ selectActiveId,
107
+ (entities, activeId) => activeId && entities[activeId] ? entities[activeId] : null
108
+ );
109
+ var selectSortedBreakpoints = createSelector(
110
+ selectEntities,
111
+ (entities) => {
112
+ const byWidth = (a, b) => {
113
+ return a.width && b.width ? b.width - a.width : 0;
114
+ };
115
+ const all = Object.values(entities);
116
+ const defaults = all.filter((breakpoint) => !breakpoint.width);
117
+ const minWidth = all.filter((breakpoint) => breakpoint.type === "min-width");
118
+ const maxWidth = all.filter((breakpoint) => breakpoint.type === "max-width");
119
+ return [
120
+ ...minWidth.sort(byWidth),
121
+ ...defaults,
122
+ ...maxWidth.sort(byWidth)
123
+ ];
124
+ }
125
+ );
126
+
127
+ // src/hooks/use-breakpoints.ts
128
+ function useBreakpoints() {
129
+ const all = useSelector(selectSortedBreakpoints);
130
+ const active = useSelector(selectActiveBreakpoint);
131
+ return {
132
+ all,
133
+ active
134
+ };
135
+ }
136
+
137
+ // src/components/breakpoints-switcher.tsx
138
+ import { Tab, Tabs, Tooltip as BaseTooltip } from "@elementor/ui";
139
+ import {
140
+ DesktopIcon,
141
+ TabletPortraitIcon,
142
+ MobilePortraitIcon,
143
+ WidescreenIcon,
144
+ LaptopIcon,
145
+ TabletLandscapeIcon,
146
+ MobileLandscapeIcon
147
+ } from "@elementor/icons";
148
+
149
+ // src/hooks/use-breakpoints-actions.ts
150
+ import { useCallback } from "react";
151
+ import { runCommand } from "@elementor/editor-v1-adapters";
152
+ function useBreakpointsActions() {
153
+ const activate = useCallback((device) => {
154
+ return runCommand("panel/change-device-mode", { device });
155
+ }, []);
156
+ return {
157
+ activate
158
+ };
159
+ }
160
+
161
+ // src/components/breakpoints-switcher.tsx
162
+ function BreakpointsSwitcher() {
163
+ const { all, active } = useBreakpoints();
164
+ const { activate } = useBreakpointsActions();
165
+ if (!all.length || !active) {
166
+ return null;
167
+ }
168
+ const onChange = (_, value) => activate(value);
169
+ return /* @__PURE__ */ React.createElement(Tabs, { value: active.id, onChange, "aria-label": __2("Switch Device", "elementor") }, all.map(({ id, label, type, width }) => {
170
+ const Icon = iconsMap[id];
171
+ const title = labelsMap[type || "default"].replace("%s", label).replace("%d", width?.toString() || "");
172
+ return /* @__PURE__ */ React.createElement(
173
+ Tab,
174
+ {
175
+ value: id,
176
+ key: id,
177
+ "aria-label": title,
178
+ icon: /* @__PURE__ */ React.createElement(Tooltip, { title }, /* @__PURE__ */ React.createElement(Icon, null))
179
+ }
180
+ );
181
+ }));
182
+ }
183
+ function Tooltip(props) {
184
+ return /* @__PURE__ */ React.createElement(
185
+ BaseTooltip,
186
+ {
187
+ PopperProps: {
188
+ sx: {
189
+ "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
190
+ mt: 7
191
+ }
192
+ }
193
+ },
194
+ ...props
195
+ }
196
+ );
197
+ }
198
+ var iconsMap = {
199
+ widescreen: WidescreenIcon,
200
+ desktop: DesktopIcon,
201
+ laptop: LaptopIcon,
202
+ tablet_extra: TabletLandscapeIcon,
203
+ tablet: TabletPortraitIcon,
204
+ mobile_extra: MobileLandscapeIcon,
205
+ mobile: MobilePortraitIcon
206
+ };
207
+ var labelsMap = {
208
+ default: "%s",
209
+ // translators: %s: Breakpoint label, %d: Breakpoint size.
210
+ "min-width": __2("%s (%dpx and up)", "elementor"),
211
+ // translators: %s: Breakpoint label, %d: Breakpoint size.
212
+ "max-width": __2("%s (up to %dpx)", "elementor")
213
+ };
214
+
215
+ // src/init.ts
216
+ function init() {
217
+ initStore();
218
+ registerAppBarUI();
219
+ }
220
+ function initStore() {
221
+ const slice = createSlice();
222
+ syncStore(slice);
223
+ }
224
+ function registerAppBarUI() {
225
+ injectIntoResponsive({
226
+ name: "responsive-breakpoints-switcher",
227
+ filler: BreakpointsSwitcher,
228
+ options: {
229
+ priority: 20
230
+ // After document indication.
231
+ }
232
+ });
233
+ }
234
+
235
+ // src/index.ts
236
+ init();
237
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/store/index.ts","../src/sync/sync-store.ts","../src/init.ts","../src/components/breakpoints-switcher.tsx","../src/hooks/use-breakpoints.ts","../src/store/selectors.ts","../src/hooks/use-breakpoints-actions.ts","../src/index.ts"],"sourcesContent":["import { addSlice, PayloadAction } from '@elementor/store';\nimport { Breakpoint, BreakpointId } from '../types';\n\nexport type State = {\n\tentities: Record<BreakpointId, Breakpoint>,\n\tactiveId: BreakpointId | null,\n}\nconst initialState: State = {\n\tentities: {} as State['entities'],\n\tactiveId: null,\n};\n\nexport function createSlice() {\n\treturn addSlice( {\n\t\tname: 'breakpoints',\n\t\tinitialState,\n\t\treducers: {\n\t\t\tinit( state, action: PayloadAction<{\n\t\t\t\tentities: Breakpoint[],\n\t\t\t\tactiveId: State['activeId'],\n\t\t\t}> ) {\n\t\t\t\tstate.activeId = action.payload.activeId;\n\t\t\t\tstate.entities = normalizeEntities( action.payload.entities );\n\t\t\t},\n\n\t\t\tactivateBreakpoint( state, action: PayloadAction<BreakpointId> ) {\n\t\t\t\tif ( state.entities[ action.payload ] ) {\n\t\t\t\t\tstate.activeId = action.payload;\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t} );\n}\n\nfunction normalizeEntities( entities: Breakpoint[] ) {\n\treturn entities.reduce( ( acc, breakpoint ) => {\n\t\treturn {\n\t\t\t...acc,\n\t\t\t[ breakpoint.id ]: breakpoint,\n\t\t};\n\t}, {} as State['entities'] );\n}\n","import { dispatch } from '@elementor/store';\nimport { Breakpoint, ExtendedWindow, Slice } from '../types';\nimport { listenTo, v1ReadyEvent, windowEvent } from '@elementor/editor-v1-adapters';\nimport { __ } from '@wordpress/i18n';\n\nexport default function syncStore( slice: Slice ) {\n\tsyncInitialization( slice );\n\tsyncOnChange( slice );\n}\n\nfunction syncInitialization( slice: Slice ) {\n\tconst { init } = slice.actions;\n\n\tlistenTo(\n\t\tv1ReadyEvent(),\n\t\t() => {\n\t\t\tdispatch( init( {\n\t\t\t\tentities: getBreakpoints(),\n\t\t\t\tactiveId: getActiveBreakpoint(),\n\t\t\t} ) );\n\t\t}\n\t);\n}\n\nfunction syncOnChange( slice: Slice ) {\n\tconst { activateBreakpoint } = slice.actions;\n\n\tlistenTo(\n\t\tdeviceModeChangeEvent(),\n\t\t() => {\n\t\t\tconst activeBreakpoint = getActiveBreakpoint();\n\n\t\t\tdispatch( activateBreakpoint( activeBreakpoint ) );\n\t\t},\n\t);\n}\n\nfunction getBreakpoints() {\n\tconst { breakpoints } = ( window as unknown as ExtendedWindow ).elementor?.config?.responsive || {};\n\n\tif ( ! breakpoints ) {\n\t\treturn [];\n\t}\n\n\tconst entities = Object\n\t\t.entries( breakpoints )\n\t\t.filter( ( [ , breakpoint ] ) => breakpoint.is_enabled )\n\t\t.map( ( [ id, { value, direction, label } ] ) => {\n\t\t\treturn {\n\t\t\t\tid,\n\t\t\t\tlabel,\n\t\t\t\twidth: value,\n\t\t\t\ttype: direction === 'min' ? 'min-width' : 'max-width',\n\t\t\t} as Breakpoint;\n\t\t} );\n\n\t// Desktop breakpoint is not included in V1 config.\n\tentities.push( {\n\t\tid: 'desktop',\n\t\tlabel: __( 'Desktop', 'elementor' ),\n\t} );\n\n\treturn entities;\n}\n\nfunction getActiveBreakpoint() {\n\tconst extendedWindow = window as unknown as ExtendedWindow;\n\n\treturn extendedWindow.elementor?.channels?.deviceMode?.request?.( 'currentMode' ) || null;\n}\n\nfunction deviceModeChangeEvent() {\n\treturn windowEvent( 'elementor/device-mode/change' );\n}\n","import { createSlice } from './store';\nimport syncStore from './sync/sync-store';\nimport { injectIntoResponsive } from '@elementor/editor-app-bar';\nimport BreakpointsSwitcher from './components/breakpoints-switcher';\n\nexport default function init() {\n\tinitStore();\n\n\tregisterAppBarUI();\n}\n\nfunction initStore() {\n\tconst slice = createSlice();\n\n\tsyncStore( slice );\n}\n\nfunction registerAppBarUI() {\n\tinjectIntoResponsive( {\n\t\tname: 'responsive-breakpoints-switcher',\n\t\tfiller: BreakpointsSwitcher,\n\t\toptions: {\n\t\t\tpriority: 20, // After document indication.\n\t\t},\n\t} );\n}\n","import * as React from 'react';\nimport { __ } from '@wordpress/i18n';\nimport { BreakpointId } from '../types';\nimport useBreakpoints from '../hooks/use-breakpoints';\nimport { Tab, Tabs, Tooltip as BaseTooltip, TooltipProps } from '@elementor/ui';\nimport {\n\tDesktopIcon,\n\tTabletPortraitIcon,\n\tMobilePortraitIcon,\n\tWidescreenIcon,\n\tLaptopIcon,\n\tTabletLandscapeIcon,\n\tMobileLandscapeIcon,\n} from '@elementor/icons';\nimport useBreakpointsActions from '../hooks/use-breakpoints-actions';\n\nexport default function BreakpointsSwitcher() {\n\tconst { all, active } = useBreakpoints();\n\tconst { activate } = useBreakpointsActions();\n\n\tif ( ! all.length || ! active ) {\n\t\treturn null;\n\t}\n\n\tconst onChange = ( _: unknown, value: BreakpointId ) => activate( value );\n\n\treturn (\n\t\t<Tabs value={ active.id } onChange={ onChange } aria-label={ __( 'Switch Device', 'elementor' ) }>\n\t\t\t{\n\t\t\t\tall.map( ( { id, label, type, width } ) => {\n\t\t\t\t\tconst Icon = iconsMap[ id ];\n\n\t\t\t\t\tconst title = labelsMap[ type || 'default' ]\n\t\t\t\t\t\t.replace( '%s', label )\n\t\t\t\t\t\t.replace( '%d', width?.toString() || '' );\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<Tab value={ id }\n\t\t\t\t\t\t\tkey={ id }\n\t\t\t\t\t\t\taria-label={ title }\n\t\t\t\t\t\t\ticon={ <Tooltip title={ title }><Icon /></Tooltip> }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} )\n\t\t\t}\n\t\t</Tabs>\n\n\t);\n}\n\nfunction Tooltip( props: TooltipProps ) {\n\treturn <BaseTooltip\n\t\tPopperProps={ {\n\t\t\tsx: {\n\t\t\t\t'&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom': {\n\t\t\t\t\tmt: 7,\n\t\t\t\t},\n\t\t\t},\n\t\t} }\n\t\t{ ...props }\n\t/>;\n}\n\nconst iconsMap = {\n\twidescreen: WidescreenIcon,\n\tdesktop: DesktopIcon,\n\tlaptop: LaptopIcon,\n\ttablet_extra: TabletLandscapeIcon,\n\ttablet: TabletPortraitIcon,\n\tmobile_extra: MobileLandscapeIcon,\n\tmobile: MobilePortraitIcon,\n};\n\nconst labelsMap = {\n\tdefault: '%s',\n\t// translators: %s: Breakpoint label, %d: Breakpoint size.\n\t'min-width': __( '%s (%dpx and up)', 'elementor' ),\n\n\t// translators: %s: Breakpoint label, %d: Breakpoint size.\n\t'max-width': __( '%s (up to %dpx)', 'elementor' ),\n} as const;\n","import { useSelector } from '@elementor/store';\nimport { selectActiveBreakpoint, selectSortedBreakpoints } from '../store/selectors';\n\nexport default function useBreakpoints() {\n\tconst all = useSelector( selectSortedBreakpoints );\n\tconst active = useSelector( selectActiveBreakpoint );\n\n\treturn {\n\t\tall,\n\t\tactive,\n\t};\n}\n","import { Breakpoint, Slice } from '../types';\nimport { createSelector, SliceState } from '@elementor/store';\n\ntype State = SliceState<Slice>;\n\nexport const selectEntities = ( state: State ) => state.breakpoints.entities;\nexport const selectActiveId = ( state: State ) => state.breakpoints.activeId;\n\nexport const selectActiveBreakpoint = createSelector(\n\tselectEntities,\n\tselectActiveId,\n\t( entities, activeId ) => activeId && entities[ activeId ]\n\t\t? entities[ activeId ]\n\t\t: null,\n);\n\nexport const selectSortedBreakpoints = createSelector(\n\tselectEntities,\n\t( entities ) => {\n\t\tconst byWidth = ( a: Breakpoint, b: Breakpoint ) => {\n\t\t\treturn ( a.width && b.width ) ? b.width - a.width : 0;\n\t\t};\n\n\t\tconst all = Object.values( entities );\n\n\t\tconst defaults = all.filter( ( breakpoint ) => ! breakpoint.width ); // AKA Desktop.\n\t\tconst minWidth = all.filter( ( breakpoint ) => breakpoint.type === 'min-width' );\n\t\tconst maxWidth = all.filter( ( breakpoint ) => breakpoint.type === 'max-width' );\n\n\t\t// Sort by size, big to small.\n\t\treturn [\n\t\t\t...minWidth.sort( byWidth ),\n\t\t\t...defaults,\n\t\t\t...maxWidth.sort( byWidth ),\n\t\t];\n\t},\n);\n","import { useCallback } from 'react';\nimport { BreakpointId } from '../types';\nimport { runCommand } from '@elementor/editor-v1-adapters';\n\nexport default function useBreakpointsActions() {\n\tconst activate = useCallback( ( device: BreakpointId ) => {\n\t\treturn runCommand( 'panel/change-device-mode', { device } );\n\t}, [] );\n\n\treturn {\n\t\tactivate,\n\t};\n}\n","import init from './init';\n\ninit();\n"],"mappings":";AAAA,SAAS,gBAA+B;AAOxC,IAAM,eAAsB;AAAA,EAC3B,UAAU,CAAC;AAAA,EACX,UAAU;AACX;AAEO,SAAS,cAAc;AAC7B,SAAO,SAAU;AAAA,IAChB,MAAM;AAAA,IACN;AAAA,IACA,UAAU;AAAA,MACT,KAAM,OAAO,QAGR;AACJ,cAAM,WAAW,OAAO,QAAQ;AAChC,cAAM,WAAW,kBAAmB,OAAO,QAAQ,QAAS;AAAA,MAC7D;AAAA,MAEA,mBAAoB,OAAO,QAAsC;AAChE,YAAK,MAAM,SAAU,OAAO,OAAQ,GAAI;AACvC,gBAAM,WAAW,OAAO;AAAA,QACzB;AAAA,MACD;AAAA,IACD;AAAA,EACD,CAAE;AACH;AAEA,SAAS,kBAAmB,UAAyB;AACpD,SAAO,SAAS,OAAQ,CAAE,KAAK,eAAgB;AAC9C,WAAO;AAAA,MACN,GAAG;AAAA,MACH,CAAE,WAAW,EAAG,GAAG;AAAA,IACpB;AAAA,EACD,GAAG,CAAC,CAAuB;AAC5B;;;ACzCA,SAAS,gBAAgB;AAEzB,SAAS,UAAU,cAAc,mBAAmB;AACpD,SAAS,UAAU;AAEJ,SAAR,UAA4B,OAAe;AACjD,qBAAoB,KAAM;AAC1B,eAAc,KAAM;AACrB;AAEA,SAAS,mBAAoB,OAAe;AAC3C,QAAM,EAAE,MAAAA,MAAK,IAAI,MAAM;AAEvB;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AACL,eAAUA,MAAM;AAAA,QACf,UAAU,eAAe;AAAA,QACzB,UAAU,oBAAoB;AAAA,MAC/B,CAAE,CAAE;AAAA,IACL;AAAA,EACD;AACD;AAEA,SAAS,aAAc,OAAe;AACrC,QAAM,EAAE,mBAAmB,IAAI,MAAM;A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 "version": "0.1.0",
4
+ "private": false,
5
+ "author": "Elementor Team",
6
+ "homepage": "https://elementor.com/",
7
+ "license": "GPL-3.0-or-later",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.mjs",
10
+ "types": "dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "import": "./dist/index.mjs",
14
+ "require": "./dist/index.js",
15
+ "types": "./dist/index.d.ts"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/elementor/elementor-packages.git",
22
+ "directory": "packages/editor-responsive"
23
+ },
24
+ "bugs": {
25
+ "url": "https://github.com/elementor/elementor-packages/issues"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "build": "tsup --config=../../tsup.build.ts",
32
+ "dev": "tsup --config=../../tsup.dev.ts"
33
+ },
34
+ "dependencies": {
35
+ "@elementor/editor-app-bar": "^0.1.0",
36
+ "@elementor/editor-v1-adapters": "^0.1.0",
37
+ "@elementor/icons": "^0.1.0",
38
+ "@elementor/store": "^0.1.0",
39
+ "@elementor/ui": "^1.4.47",
40
+ "@wordpress/i18n": "^4.31.0"
41
+ },
42
+ "peerDependencies": {
43
+ "react": "17.x"
44
+ },
45
+ "elementor": {
46
+ "type": "extension"
47
+ },
48
+ "gitHead": "2ba9f13a9dbd085eb6ed8e6e303e9275ce626b8d"
49
+ }