@elementor/editor-app-bar 0.14.6 → 0.15.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.
package/dist/index.mjs CHANGED
@@ -1151,14 +1151,128 @@ function init8() {
1151
1151
  });
1152
1152
  }
1153
1153
 
1154
+ // src/extensions/responsive/components/breakpoints-switcher.tsx
1155
+ import * as React26 from "react";
1156
+ import { __ as __17 } from "@wordpress/i18n";
1157
+ import { Tab, Tabs, Tooltip as BaseTooltip3 } from "@elementor/ui";
1158
+ import {
1159
+ useBreakpoints,
1160
+ useActivateBreakpoint,
1161
+ useActiveBreakpoint
1162
+ } from "@elementor/editor-responsive";
1163
+ import {
1164
+ DesktopIcon,
1165
+ TabletPortraitIcon,
1166
+ MobilePortraitIcon,
1167
+ WidescreenIcon,
1168
+ LaptopIcon,
1169
+ TabletLandscapeIcon,
1170
+ MobileLandscapeIcon
1171
+ } from "@elementor/icons";
1172
+ function BreakpointsSwitcher() {
1173
+ const breakpoints = useBreakpoints();
1174
+ const activeBreakpoint = useActiveBreakpoint();
1175
+ const activateBreakpoint = useActivateBreakpoint();
1176
+ if (!breakpoints.length || !activeBreakpoint) {
1177
+ return null;
1178
+ }
1179
+ const onChange = (_, value) => {
1180
+ const extendedWindow = window;
1181
+ const config = extendedWindow?.elementor?.editorEvents?.config;
1182
+ if (config) {
1183
+ extendedWindow.elementor.editorEvents.dispatchEvent(config.names.topBar.responsiveControls, {
1184
+ location: config.locations.topBar,
1185
+ secondaryLocation: config.secondaryLocations.responsiveControls,
1186
+ trigger: config.triggers.click,
1187
+ element: config.elements.buttonIcon,
1188
+ mode: value
1189
+ });
1190
+ }
1191
+ activateBreakpoint(value);
1192
+ };
1193
+ return /* @__PURE__ */ React26.createElement(
1194
+ Tabs,
1195
+ {
1196
+ textColor: "inherit",
1197
+ indicatorColor: "secondary",
1198
+ value: activeBreakpoint,
1199
+ onChange,
1200
+ "aria-label": __17("Switch Device", "elementor"),
1201
+ sx: {
1202
+ "& .MuiTabs-indicator": {
1203
+ backgroundColor: "text.primary"
1204
+ }
1205
+ }
1206
+ },
1207
+ breakpoints.map(({ id, label, type, width }) => {
1208
+ const Icon = iconsMap[id];
1209
+ const title = labelsMap[type || "default"].replace("%s", label).replace("%d", width?.toString() || "");
1210
+ return /* @__PURE__ */ React26.createElement(
1211
+ Tab,
1212
+ {
1213
+ value: id,
1214
+ key: id,
1215
+ "aria-label": title,
1216
+ icon: /* @__PURE__ */ React26.createElement(Tooltip5, { title }, /* @__PURE__ */ React26.createElement(Icon, null)),
1217
+ sx: { minWidth: "auto" },
1218
+ "data-testid": `switch-device-to-${id}`
1219
+ }
1220
+ );
1221
+ })
1222
+ );
1223
+ }
1224
+ function Tooltip5(props) {
1225
+ return /* @__PURE__ */ React26.createElement(
1226
+ BaseTooltip3,
1227
+ {
1228
+ PopperProps: {
1229
+ sx: {
1230
+ "&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
1231
+ mt: 2.5
1232
+ }
1233
+ }
1234
+ },
1235
+ ...props
1236
+ }
1237
+ );
1238
+ }
1239
+ var iconsMap = {
1240
+ widescreen: WidescreenIcon,
1241
+ desktop: DesktopIcon,
1242
+ laptop: LaptopIcon,
1243
+ tablet_extra: TabletLandscapeIcon,
1244
+ tablet: TabletPortraitIcon,
1245
+ mobile_extra: MobileLandscapeIcon,
1246
+ mobile: MobilePortraitIcon
1247
+ };
1248
+ var labelsMap = {
1249
+ default: "%s",
1250
+ // translators: %s: Breakpoint label, %d: Breakpoint size.
1251
+ "min-width": __17("%s (%dpx and up)", "elementor"),
1252
+ // translators: %s: Breakpoint label, %d: Breakpoint size.
1253
+ "max-width": __17("%s (up to %dpx)", "elementor")
1254
+ };
1255
+
1256
+ // src/extensions/responsive/index.ts
1257
+ function init9() {
1258
+ injectIntoResponsive({
1259
+ id: "responsive-breakpoints-switcher",
1260
+ component: BreakpointsSwitcher,
1261
+ options: {
1262
+ priority: 20
1263
+ // After document indication.
1264
+ }
1265
+ });
1266
+ }
1267
+
1154
1268
  // src/extensions/site-settings/index.ts
1155
1269
  import { injectIntoTop } from "@elementor/editor";
1156
1270
 
1157
1271
  // src/extensions/site-settings/components/portalled-primary-action.tsx
1158
- import * as React28 from "react";
1272
+ import * as React29 from "react";
1159
1273
 
1160
1274
  // src/extensions/site-settings/components/portal.tsx
1161
- import * as React26 from "react";
1275
+ import * as React27 from "react";
1162
1276
  import { Portal as BasePortal } from "@elementor/ui";
1163
1277
  import {
1164
1278
  __privateIsRouteActive as isRouteActive2,
@@ -1174,24 +1288,24 @@ function Portal(props) {
1174
1288
  if (!containerRef.current) {
1175
1289
  return null;
1176
1290
  }
1177
- return /* @__PURE__ */ React26.createElement(BasePortal, { container: containerRef.current, ...props });
1291
+ return /* @__PURE__ */ React27.createElement(BasePortal, { container: containerRef.current, ...props });
1178
1292
  }
1179
1293
  function getContainerRef() {
1180
1294
  return isRouteActive2("panel/global") ? { current: document.querySelector("#elementor-panel-inner") } : { current: null };
1181
1295
  }
1182
1296
 
1183
1297
  // src/extensions/site-settings/components/primary-action.tsx
1184
- import * as React27 from "react";
1298
+ import * as React28 from "react";
1185
1299
  import {
1186
1300
  __useActiveDocument as useActiveDocument8,
1187
1301
  __useActiveDocumentActions as useActiveDocumentActions5
1188
1302
  } from "@elementor/editor-documents";
1189
1303
  import { Button as Button2, CircularProgress as CircularProgress2, Paper } from "@elementor/ui";
1190
- import { __ as __17 } from "@wordpress/i18n";
1304
+ import { __ as __18 } from "@wordpress/i18n";
1191
1305
  function PrimaryAction2() {
1192
1306
  const document2 = useActiveDocument8();
1193
1307
  const { save } = useActiveDocumentActions5();
1194
- return /* @__PURE__ */ React27.createElement(
1308
+ return /* @__PURE__ */ React28.createElement(
1195
1309
  Paper,
1196
1310
  {
1197
1311
  sx: {
@@ -1201,7 +1315,7 @@ function PrimaryAction2() {
1201
1315
  borderColor: "divider"
1202
1316
  }
1203
1317
  },
1204
- /* @__PURE__ */ React27.createElement(
1318
+ /* @__PURE__ */ React28.createElement(
1205
1319
  Button2,
1206
1320
  {
1207
1321
  variant: "contained",
@@ -1210,18 +1324,18 @@ function PrimaryAction2() {
1210
1324
  sx: { width: "100%" },
1211
1325
  onClick: () => document2 && !document2.isSaving ? save() : null
1212
1326
  },
1213
- document2?.isSaving ? /* @__PURE__ */ React27.createElement(CircularProgress2, null) : __17("Save Changes", "elementor")
1327
+ document2?.isSaving ? /* @__PURE__ */ React28.createElement(CircularProgress2, null) : __18("Save Changes", "elementor")
1214
1328
  )
1215
1329
  );
1216
1330
  }
1217
1331
 
1218
1332
  // src/extensions/site-settings/components/portalled-primary-action.tsx
1219
1333
  function PortalledPrimaryAction() {
1220
- return /* @__PURE__ */ React28.createElement(Portal, null, /* @__PURE__ */ React28.createElement(PrimaryAction2, null));
1334
+ return /* @__PURE__ */ React29.createElement(Portal, null, /* @__PURE__ */ React29.createElement(PrimaryAction2, null));
1221
1335
  }
1222
1336
 
1223
1337
  // src/extensions/site-settings/hooks/use-action-props.ts
1224
- import { __ as __18 } from "@wordpress/i18n";
1338
+ import { __ as __19 } from "@wordpress/i18n";
1225
1339
  import {
1226
1340
  __privateRunCommand as runCommand5,
1227
1341
  __privateUseRouteStatus as useRouteStatus5
@@ -1232,7 +1346,7 @@ function useActionProps6() {
1232
1346
  blockOnKitRoutes: false
1233
1347
  });
1234
1348
  return {
1235
- title: __18("Site Settings", "elementor"),
1349
+ title: __19("Site Settings", "elementor"),
1236
1350
  icon: AdjustmentsHorizontalIcon,
1237
1351
  onClick: () => {
1238
1352
  const extendedWindow = window;
@@ -1257,7 +1371,7 @@ function useActionProps6() {
1257
1371
  }
1258
1372
 
1259
1373
  // src/extensions/site-settings/index.ts
1260
- function init9() {
1374
+ function init10() {
1261
1375
  injectIntoTop({
1262
1376
  id: "site-settings-primary-action-portal",
1263
1377
  component: PortalledPrimaryAction
@@ -1270,7 +1384,7 @@ function init9() {
1270
1384
  }
1271
1385
 
1272
1386
  // src/extensions/structure/hooks/use-action-props.ts
1273
- import { __ as __19 } from "@wordpress/i18n";
1387
+ import { __ as __20 } from "@wordpress/i18n";
1274
1388
  import {
1275
1389
  __privateRunCommand as runCommand6,
1276
1390
  __privateUseRouteStatus as useRouteStatus6
@@ -1279,7 +1393,7 @@ import { StructureIcon } from "@elementor/icons";
1279
1393
  function useActionProps7() {
1280
1394
  const { isActive, isBlocked } = useRouteStatus6("navigator");
1281
1395
  return {
1282
- title: __19("Structure", "elementor"),
1396
+ title: __20("Structure", "elementor"),
1283
1397
  icon: StructureIcon,
1284
1398
  onClick: () => {
1285
1399
  const extendedWindow = window;
@@ -1300,7 +1414,7 @@ function useActionProps7() {
1300
1414
  }
1301
1415
 
1302
1416
  // src/extensions/structure/index.ts
1303
- function init10() {
1417
+ function init11() {
1304
1418
  toolsMenu.registerToggleAction({
1305
1419
  id: "toggle-structure-view",
1306
1420
  priority: 3,
@@ -1309,13 +1423,13 @@ function init10() {
1309
1423
  }
1310
1424
 
1311
1425
  // src/extensions/theme-builder/hooks/use-action-props.ts
1312
- import { __ as __20 } from "@wordpress/i18n";
1426
+ import { __ as __21 } from "@wordpress/i18n";
1313
1427
  import { ThemeBuilderIcon } from "@elementor/icons";
1314
1428
  import { __privateRunCommand as runCommand7 } from "@elementor/editor-v1-adapters";
1315
1429
  function useActionProps8() {
1316
1430
  return {
1317
1431
  icon: ThemeBuilderIcon,
1318
- title: __20("Theme Builder", "elementor"),
1432
+ title: __21("Theme Builder", "elementor"),
1319
1433
  onClick: () => {
1320
1434
  const extendedWindow = window;
1321
1435
  const config = extendedWindow?.elementor?.editorEvents?.config;
@@ -1333,7 +1447,7 @@ function useActionProps8() {
1333
1447
  }
1334
1448
 
1335
1449
  // src/extensions/theme-builder/index.ts
1336
- function init11() {
1450
+ function init12() {
1337
1451
  mainMenu.registerAction({
1338
1452
  id: "open-theme-builder",
1339
1453
  useProps: useActionProps8
@@ -1341,7 +1455,7 @@ function init11() {
1341
1455
  }
1342
1456
 
1343
1457
  // src/extensions/user-preferences/hooks/use-action-props.ts
1344
- import { __ as __21 } from "@wordpress/i18n";
1458
+ import { __ as __22 } from "@wordpress/i18n";
1345
1459
  import { ToggleRightIcon } from "@elementor/icons";
1346
1460
  import {
1347
1461
  __privateOpenRoute as openRoute5,
@@ -1351,7 +1465,7 @@ function useActionProps9() {
1351
1465
  const { isActive, isBlocked } = useRouteStatus7("panel/editor-preferences");
1352
1466
  return {
1353
1467
  icon: ToggleRightIcon,
1354
- title: __21("User Preferences", "elementor"),
1468
+ title: __22("User Preferences", "elementor"),
1355
1469
  onClick: () => {
1356
1470
  const extendedWindow = window;
1357
1471
  const config = extendedWindow?.elementor?.editorEvents?.config;
@@ -1371,7 +1485,7 @@ function useActionProps9() {
1371
1485
  }
1372
1486
 
1373
1487
  // src/extensions/user-preferences/index.ts
1374
- function init12() {
1488
+ function init13() {
1375
1489
  mainMenu.registerToggleAction({
1376
1490
  id: "open-user-preferences",
1377
1491
  priority: 30,
@@ -1381,17 +1495,17 @@ function init12() {
1381
1495
  }
1382
1496
 
1383
1497
  // src/extensions/wordpress/index.ts
1384
- import { __ as __22 } from "@wordpress/i18n";
1498
+ import { __ as __23 } from "@wordpress/i18n";
1385
1499
  import { WordpressIcon } from "@elementor/icons";
1386
1500
  import { __useActiveDocument as useActiveDocument9 } from "@elementor/editor-documents";
1387
- function init13() {
1501
+ function init14() {
1388
1502
  mainMenu.registerLink({
1389
1503
  id: "exit-to-wordpress",
1390
1504
  group: "exits",
1391
1505
  useProps: () => {
1392
1506
  const document2 = useActiveDocument9();
1393
1507
  return {
1394
- title: __22("Exit to WordPress", "elementor"),
1508
+ title: __23("Exit to WordPress", "elementor"),
1395
1509
  href: document2?.links?.platformEdit,
1396
1510
  icon: WordpressIcon,
1397
1511
  onClick: () => {
@@ -1412,7 +1526,7 @@ function init13() {
1412
1526
  }
1413
1527
 
1414
1528
  // src/extensions/index.ts
1415
- function init14() {
1529
+ function init15() {
1416
1530
  init();
1417
1531
  init2();
1418
1532
  init3();
@@ -1426,12 +1540,13 @@ function init14() {
1426
1540
  init11();
1427
1541
  init12();
1428
1542
  init13();
1543
+ init14();
1429
1544
  }
1430
1545
 
1431
1546
  // src/init.ts
1432
- function init15() {
1547
+ function init16() {
1433
1548
  redirectOldMenus();
1434
- init14();
1549
+ init15();
1435
1550
  injectIntoTop2({
1436
1551
  id: "app-bar",
1437
1552
  component: AppBar
@@ -1439,7 +1554,7 @@ function init15() {
1439
1554
  }
1440
1555
 
1441
1556
  // src/index.ts
1442
- init15();
1557
+ init16();
1443
1558
  export {
1444
1559
  documentOptionsMenu,
1445
1560
  injectIntoPageIndication,