@elementor/editor-app-bar 0.14.6 → 0.15.1

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.15.1](https://github.com/elementor/elementor-packages/compare/@elementor/editor-app-bar@0.15.0...@elementor/editor-app-bar@0.15.1) (2024-07-23)
7
+
8
+ **Note:** Version bump only for package @elementor/editor-app-bar
9
+
10
+ # [0.15.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-app-bar@0.14.6...@elementor/editor-app-bar@0.15.0) (2024-07-18)
11
+
12
+ ### Features
13
+
14
+ - **editor-responsive:** separate data and ui [EDS-272] ([#206](https://github.com/elementor/elementor-packages/issues/206)) ([a5a24cc](https://github.com/elementor/elementor-packages/commit/a5a24cc8abed5f5a9b1523436e1c63f24a202198))
15
+
6
16
  ## [0.14.6](https://github.com/elementor/elementor-packages/compare/@elementor/editor-app-bar@0.14.5...@elementor/editor-app-bar@0.14.6) (2024-07-16)
7
17
 
8
18
  **Note:** Version bump only for package @elementor/editor-app-bar
package/dist/index.js CHANGED
@@ -1152,15 +1152,117 @@ function init8() {
1152
1152
  });
1153
1153
  }
1154
1154
 
1155
+ // src/extensions/responsive/components/breakpoints-switcher.tsx
1156
+ var React26 = __toESM(require("react"));
1157
+ var import_i18n17 = require("@wordpress/i18n");
1158
+ var import_ui17 = require("@elementor/ui");
1159
+ var import_editor_responsive = require("@elementor/editor-responsive");
1160
+ var import_icons16 = require("@elementor/icons");
1161
+ function BreakpointsSwitcher() {
1162
+ const breakpoints = (0, import_editor_responsive.useBreakpoints)();
1163
+ const activeBreakpoint = (0, import_editor_responsive.useActiveBreakpoint)();
1164
+ const activateBreakpoint = (0, import_editor_responsive.useActivateBreakpoint)();
1165
+ if (!breakpoints.length || !activeBreakpoint) {
1166
+ return null;
1167
+ }
1168
+ const onChange = (_, value) => {
1169
+ const extendedWindow = window;
1170
+ const config = extendedWindow?.elementor?.editorEvents?.config;
1171
+ if (config) {
1172
+ extendedWindow.elementor.editorEvents.dispatchEvent(config.names.topBar.responsiveControls, {
1173
+ location: config.locations.topBar,
1174
+ secondaryLocation: config.secondaryLocations.responsiveControls,
1175
+ trigger: config.triggers.click,
1176
+ element: config.elements.buttonIcon,
1177
+ mode: value
1178
+ });
1179
+ }
1180
+ activateBreakpoint(value);
1181
+ };
1182
+ return /* @__PURE__ */ React26.createElement(
1183
+ import_ui17.Tabs,
1184
+ {
1185
+ textColor: "inherit",
1186
+ indicatorColor: "secondary",
1187
+ value: activeBreakpoint,
1188
+ onChange,
1189
+ "aria-label": (0, import_i18n17.__)("Switch Device", "elementor"),
1190
+ sx: {
1191
+ "& .MuiTabs-indicator": {
1192
+ backgroundColor: "text.primary"
1193
+ }
1194
+ }
1195
+ },
1196
+ breakpoints.map(({ id, label, type, width }) => {
1197
+ const Icon = iconsMap[id];
1198
+ const title = labelsMap[type || "default"].replace("%s", label).replace("%d", width?.toString() || "");
1199
+ return /* @__PURE__ */ React26.createElement(
1200
+ import_ui17.Tab,
1201
+ {
1202
+ value: id,
1203
+ key: id,
1204
+ "aria-label": title,
1205
+ icon: /* @__PURE__ */ React26.createElement(Tooltip5, { title }, /* @__PURE__ */ React26.createElement(Icon, null)),
1206
+ sx: { minWidth: "auto" },
1207
+ "data-testid": `switch-device-to-${id}`
1208
+ }
1209
+ );
1210
+ })
1211
+ );
1212
+ }
1213
+ function Tooltip5(props) {
1214
+ return /* @__PURE__ */ React26.createElement(
1215
+ import_ui17.Tooltip,
1216
+ {
1217
+ PopperProps: {
1218
+ sx: {
1219
+ "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
1220
+ mt: 2.5
1221
+ }
1222
+ }
1223
+ },
1224
+ ...props
1225
+ }
1226
+ );
1227
+ }
1228
+ var iconsMap = {
1229
+ widescreen: import_icons16.WidescreenIcon,
1230
+ desktop: import_icons16.DesktopIcon,
1231
+ laptop: import_icons16.LaptopIcon,
1232
+ tablet_extra: import_icons16.TabletLandscapeIcon,
1233
+ tablet: import_icons16.TabletPortraitIcon,
1234
+ mobile_extra: import_icons16.MobileLandscapeIcon,
1235
+ mobile: import_icons16.MobilePortraitIcon
1236
+ };
1237
+ var labelsMap = {
1238
+ default: "%s",
1239
+ // translators: %s: Breakpoint label, %d: Breakpoint size.
1240
+ "min-width": (0, import_i18n17.__)("%s (%dpx and up)", "elementor"),
1241
+ // translators: %s: Breakpoint label, %d: Breakpoint size.
1242
+ "max-width": (0, import_i18n17.__)("%s (up to %dpx)", "elementor")
1243
+ };
1244
+
1245
+ // src/extensions/responsive/index.ts
1246
+ function init9() {
1247
+ injectIntoResponsive({
1248
+ id: "responsive-breakpoints-switcher",
1249
+ component: BreakpointsSwitcher,
1250
+ options: {
1251
+ priority: 20
1252
+ // After document indication.
1253
+ }
1254
+ });
1255
+ }
1256
+
1155
1257
  // src/extensions/site-settings/index.ts
1156
1258
  var import_editor = require("@elementor/editor");
1157
1259
 
1158
1260
  // src/extensions/site-settings/components/portalled-primary-action.tsx
1159
- var React28 = __toESM(require("react"));
1261
+ var React29 = __toESM(require("react"));
1160
1262
 
1161
1263
  // src/extensions/site-settings/components/portal.tsx
1162
- var React26 = __toESM(require("react"));
1163
- var import_ui17 = require("@elementor/ui");
1264
+ var React27 = __toESM(require("react"));
1265
+ var import_ui18 = require("@elementor/ui");
1164
1266
  var import_editor_v1_adapters11 = require("@elementor/editor-v1-adapters");
1165
1267
  function Portal(props) {
1166
1268
  const containerRef = (0, import_editor_v1_adapters11.__privateUseListenTo)(
@@ -1170,22 +1272,22 @@ function Portal(props) {
1170
1272
  if (!containerRef.current) {
1171
1273
  return null;
1172
1274
  }
1173
- return /* @__PURE__ */ React26.createElement(import_ui17.Portal, { container: containerRef.current, ...props });
1275
+ return /* @__PURE__ */ React27.createElement(import_ui18.Portal, { container: containerRef.current, ...props });
1174
1276
  }
1175
1277
  function getContainerRef() {
1176
1278
  return (0, import_editor_v1_adapters11.__privateIsRouteActive)("panel/global") ? { current: document.querySelector("#elementor-panel-inner") } : { current: null };
1177
1279
  }
1178
1280
 
1179
1281
  // src/extensions/site-settings/components/primary-action.tsx
1180
- var React27 = __toESM(require("react"));
1282
+ var React28 = __toESM(require("react"));
1181
1283
  var import_editor_documents9 = require("@elementor/editor-documents");
1182
- var import_ui18 = require("@elementor/ui");
1183
- var import_i18n17 = require("@wordpress/i18n");
1284
+ var import_ui19 = require("@elementor/ui");
1285
+ var import_i18n18 = require("@wordpress/i18n");
1184
1286
  function PrimaryAction2() {
1185
1287
  const document2 = (0, import_editor_documents9.__useActiveDocument)();
1186
1288
  const { save } = (0, import_editor_documents9.__useActiveDocumentActions)();
1187
- return /* @__PURE__ */ React27.createElement(
1188
- import_ui18.Paper,
1289
+ return /* @__PURE__ */ React28.createElement(
1290
+ import_ui19.Paper,
1189
1291
  {
1190
1292
  sx: {
1191
1293
  px: 5,
@@ -1194,8 +1296,8 @@ function PrimaryAction2() {
1194
1296
  borderColor: "divider"
1195
1297
  }
1196
1298
  },
1197
- /* @__PURE__ */ React27.createElement(
1198
- import_ui18.Button,
1299
+ /* @__PURE__ */ React28.createElement(
1300
+ import_ui19.Button,
1199
1301
  {
1200
1302
  variant: "contained",
1201
1303
  disabled: !document2 || !document2.isDirty,
@@ -1203,27 +1305,27 @@ function PrimaryAction2() {
1203
1305
  sx: { width: "100%" },
1204
1306
  onClick: () => document2 && !document2.isSaving ? save() : null
1205
1307
  },
1206
- document2?.isSaving ? /* @__PURE__ */ React27.createElement(import_ui18.CircularProgress, null) : (0, import_i18n17.__)("Save Changes", "elementor")
1308
+ document2?.isSaving ? /* @__PURE__ */ React28.createElement(import_ui19.CircularProgress, null) : (0, import_i18n18.__)("Save Changes", "elementor")
1207
1309
  )
1208
1310
  );
1209
1311
  }
1210
1312
 
1211
1313
  // src/extensions/site-settings/components/portalled-primary-action.tsx
1212
1314
  function PortalledPrimaryAction() {
1213
- return /* @__PURE__ */ React28.createElement(Portal, null, /* @__PURE__ */ React28.createElement(PrimaryAction2, null));
1315
+ return /* @__PURE__ */ React29.createElement(Portal, null, /* @__PURE__ */ React29.createElement(PrimaryAction2, null));
1214
1316
  }
1215
1317
 
1216
1318
  // src/extensions/site-settings/hooks/use-action-props.ts
1217
- var import_i18n18 = require("@wordpress/i18n");
1319
+ var import_i18n19 = require("@wordpress/i18n");
1218
1320
  var import_editor_v1_adapters12 = require("@elementor/editor-v1-adapters");
1219
- var import_icons16 = require("@elementor/icons");
1321
+ var import_icons17 = require("@elementor/icons");
1220
1322
  function useActionProps6() {
1221
1323
  const { isActive, isBlocked } = (0, import_editor_v1_adapters12.__privateUseRouteStatus)("panel/global", {
1222
1324
  blockOnKitRoutes: false
1223
1325
  });
1224
1326
  return {
1225
- title: (0, import_i18n18.__)("Site Settings", "elementor"),
1226
- icon: import_icons16.AdjustmentsHorizontalIcon,
1327
+ title: (0, import_i18n19.__)("Site Settings", "elementor"),
1328
+ icon: import_icons17.AdjustmentsHorizontalIcon,
1227
1329
  onClick: () => {
1228
1330
  const extendedWindow = window;
1229
1331
  const config = extendedWindow?.elementor?.editorEvents?.config;
@@ -1247,7 +1349,7 @@ function useActionProps6() {
1247
1349
  }
1248
1350
 
1249
1351
  // src/extensions/site-settings/index.ts
1250
- function init9() {
1352
+ function init10() {
1251
1353
  (0, import_editor.injectIntoTop)({
1252
1354
  id: "site-settings-primary-action-portal",
1253
1355
  component: PortalledPrimaryAction
@@ -1260,14 +1362,14 @@ function init9() {
1260
1362
  }
1261
1363
 
1262
1364
  // src/extensions/structure/hooks/use-action-props.ts
1263
- var import_i18n19 = require("@wordpress/i18n");
1365
+ var import_i18n20 = require("@wordpress/i18n");
1264
1366
  var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
1265
- var import_icons17 = require("@elementor/icons");
1367
+ var import_icons18 = require("@elementor/icons");
1266
1368
  function useActionProps7() {
1267
1369
  const { isActive, isBlocked } = (0, import_editor_v1_adapters13.__privateUseRouteStatus)("navigator");
1268
1370
  return {
1269
- title: (0, import_i18n19.__)("Structure", "elementor"),
1270
- icon: import_icons17.StructureIcon,
1371
+ title: (0, import_i18n20.__)("Structure", "elementor"),
1372
+ icon: import_icons18.StructureIcon,
1271
1373
  onClick: () => {
1272
1374
  const extendedWindow = window;
1273
1375
  const config = extendedWindow?.elementor?.editorEvents?.config;
@@ -1287,7 +1389,7 @@ function useActionProps7() {
1287
1389
  }
1288
1390
 
1289
1391
  // src/extensions/structure/index.ts
1290
- function init10() {
1392
+ function init11() {
1291
1393
  toolsMenu.registerToggleAction({
1292
1394
  id: "toggle-structure-view",
1293
1395
  priority: 3,
@@ -1296,13 +1398,13 @@ function init10() {
1296
1398
  }
1297
1399
 
1298
1400
  // src/extensions/theme-builder/hooks/use-action-props.ts
1299
- var import_i18n20 = require("@wordpress/i18n");
1300
- var import_icons18 = require("@elementor/icons");
1401
+ var import_i18n21 = require("@wordpress/i18n");
1402
+ var import_icons19 = require("@elementor/icons");
1301
1403
  var import_editor_v1_adapters14 = require("@elementor/editor-v1-adapters");
1302
1404
  function useActionProps8() {
1303
1405
  return {
1304
- icon: import_icons18.ThemeBuilderIcon,
1305
- title: (0, import_i18n20.__)("Theme Builder", "elementor"),
1406
+ icon: import_icons19.ThemeBuilderIcon,
1407
+ title: (0, import_i18n21.__)("Theme Builder", "elementor"),
1306
1408
  onClick: () => {
1307
1409
  const extendedWindow = window;
1308
1410
  const config = extendedWindow?.elementor?.editorEvents?.config;
@@ -1320,7 +1422,7 @@ function useActionProps8() {
1320
1422
  }
1321
1423
 
1322
1424
  // src/extensions/theme-builder/index.ts
1323
- function init11() {
1425
+ function init12() {
1324
1426
  mainMenu.registerAction({
1325
1427
  id: "open-theme-builder",
1326
1428
  useProps: useActionProps8
@@ -1328,14 +1430,14 @@ function init11() {
1328
1430
  }
1329
1431
 
1330
1432
  // src/extensions/user-preferences/hooks/use-action-props.ts
1331
- var import_i18n21 = require("@wordpress/i18n");
1332
- var import_icons19 = require("@elementor/icons");
1433
+ var import_i18n22 = require("@wordpress/i18n");
1434
+ var import_icons20 = require("@elementor/icons");
1333
1435
  var import_editor_v1_adapters15 = require("@elementor/editor-v1-adapters");
1334
1436
  function useActionProps9() {
1335
1437
  const { isActive, isBlocked } = (0, import_editor_v1_adapters15.__privateUseRouteStatus)("panel/editor-preferences");
1336
1438
  return {
1337
- icon: import_icons19.ToggleRightIcon,
1338
- title: (0, import_i18n21.__)("User Preferences", "elementor"),
1439
+ icon: import_icons20.ToggleRightIcon,
1440
+ title: (0, import_i18n22.__)("User Preferences", "elementor"),
1339
1441
  onClick: () => {
1340
1442
  const extendedWindow = window;
1341
1443
  const config = extendedWindow?.elementor?.editorEvents?.config;
@@ -1355,7 +1457,7 @@ function useActionProps9() {
1355
1457
  }
1356
1458
 
1357
1459
  // src/extensions/user-preferences/index.ts
1358
- function init12() {
1460
+ function init13() {
1359
1461
  mainMenu.registerToggleAction({
1360
1462
  id: "open-user-preferences",
1361
1463
  priority: 30,
@@ -1365,19 +1467,19 @@ function init12() {
1365
1467
  }
1366
1468
 
1367
1469
  // src/extensions/wordpress/index.ts
1368
- var import_i18n22 = require("@wordpress/i18n");
1369
- var import_icons20 = require("@elementor/icons");
1470
+ var import_i18n23 = require("@wordpress/i18n");
1471
+ var import_icons21 = require("@elementor/icons");
1370
1472
  var import_editor_documents10 = require("@elementor/editor-documents");
1371
- function init13() {
1473
+ function init14() {
1372
1474
  mainMenu.registerLink({
1373
1475
  id: "exit-to-wordpress",
1374
1476
  group: "exits",
1375
1477
  useProps: () => {
1376
1478
  const document2 = (0, import_editor_documents10.__useActiveDocument)();
1377
1479
  return {
1378
- title: (0, import_i18n22.__)("Exit to WordPress", "elementor"),
1480
+ title: (0, import_i18n23.__)("Exit to WordPress", "elementor"),
1379
1481
  href: document2?.links?.platformEdit,
1380
- icon: import_icons20.WordpressIcon,
1482
+ icon: import_icons21.WordpressIcon,
1381
1483
  onClick: () => {
1382
1484
  const extendedWindow = window;
1383
1485
  const config = extendedWindow?.elementor?.editorEvents?.config;
@@ -1396,7 +1498,7 @@ function init13() {
1396
1498
  }
1397
1499
 
1398
1500
  // src/extensions/index.ts
1399
- function init14() {
1501
+ function init15() {
1400
1502
  init();
1401
1503
  init2();
1402
1504
  init3();
@@ -1410,12 +1512,13 @@ function init14() {
1410
1512
  init11();
1411
1513
  init12();
1412
1514
  init13();
1515
+ init14();
1413
1516
  }
1414
1517
 
1415
1518
  // src/init.ts
1416
- function init15() {
1519
+ function init16() {
1417
1520
  redirectOldMenus();
1418
- init14();
1521
+ init15();
1419
1522
  (0, import_editor2.injectIntoTop)({
1420
1523
  id: "app-bar",
1421
1524
  component: AppBar
@@ -1423,7 +1526,7 @@ function init15() {
1423
1526
  }
1424
1527
 
1425
1528
  // src/index.ts
1426
- init15();
1529
+ init16();
1427
1530
  // Annotate the CommonJS export names for ESM import in node:
1428
1531
  0 && (module.exports = {
1429
1532
  documentOptionsMenu,