@elementor/editor-app-bar 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.
- package/LICENSE +674 -0
- package/README.md +5 -0
- package/dist/index.d.ts +234 -0
- package/dist/index.js +1047 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1017 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +50 -0
- package/src/components/__tests__/top-bar.test.tsx +15 -0
- package/src/components/actions/action.tsx +33 -0
- package/src/components/actions/link.tsx +33 -0
- package/src/components/actions/toggle-action.tsx +35 -0
- package/src/components/app-bar.tsx +37 -0
- package/src/components/locations/__tests__/locations-components.test.tsx +37 -0
- package/src/components/locations/__tests__/menus.test.tsx +89 -0
- package/src/components/locations/main-menu-location.tsx +50 -0
- package/src/components/locations/page-indication-location.tsx +9 -0
- package/src/components/locations/primary-action-location.tsx +9 -0
- package/src/components/locations/responsive-location.tsx +9 -0
- package/src/components/locations/tools-menu-location.tsx +26 -0
- package/src/components/locations/utilities-menu-location.tsx +35 -0
- package/src/components/ui/popover-menu-item.tsx +39 -0
- package/src/components/ui/popover-menu.tsx +23 -0
- package/src/components/ui/toolbar-logo.tsx +80 -0
- package/src/components/ui/toolbar-menu-item.tsx +18 -0
- package/src/components/ui/toolbar-menu-more.tsx +29 -0
- package/src/components/ui/toolbar-menu-toggle-item.tsx +18 -0
- package/src/components/ui/toolbar-menu.tsx +15 -0
- package/src/contexts/menu-context.tsx +20 -0
- package/src/extensions/documents-indicator/components/__tests__/settings-button.test.tsx +46 -0
- package/src/extensions/documents-indicator/components/settings-button.tsx +43 -0
- package/src/extensions/documents-indicator/index.ts +12 -0
- package/src/extensions/documents-preview/hooks/__tests__/use-document-preview-props.test.ts +43 -0
- package/src/extensions/documents-preview/hooks/use-action-props.ts +17 -0
- package/src/extensions/documents-preview/index.ts +10 -0
- package/src/extensions/documents-save/components/__tests__/primary-action-menu.test.tsx +41 -0
- package/src/extensions/documents-save/components/__tests__/primary-action.test.tsx +176 -0
- package/src/extensions/documents-save/components/primary-action-menu.tsx +48 -0
- package/src/extensions/documents-save/components/primary-action.tsx +79 -0
- package/src/extensions/documents-save/hooks/__tests__/use-document-save-draft-props.test.ts +64 -0
- package/src/extensions/documents-save/hooks/__tests__/use-document-save-template-props.test.ts +27 -0
- package/src/extensions/documents-save/hooks/use-document-save-draft-props.ts +16 -0
- package/src/extensions/documents-save/hooks/use-document-save-template-props.ts +14 -0
- package/src/extensions/documents-save/index.ts +26 -0
- package/src/extensions/elements/hooks/__tests__/use-action-props.test.ts +33 -0
- package/src/extensions/elements/hooks/use-action-props.ts +15 -0
- package/src/extensions/elements/index.ts +13 -0
- package/src/extensions/elements/sync/__tests__/sync-panel-title.test.ts +92 -0
- package/src/extensions/elements/sync/sync-panel-title.ts +47 -0
- package/src/extensions/finder/hooks/__tests__/use-action-props.test.ts +36 -0
- package/src/extensions/finder/hooks/use-action-props.ts +18 -0
- package/src/extensions/finder/index.ts +10 -0
- package/src/extensions/help/index.ts +18 -0
- package/src/extensions/history/hooks/__tests__/use-action-props.test.ts +33 -0
- package/src/extensions/history/hooks/use-action-props.ts +15 -0
- package/src/extensions/history/index.ts +10 -0
- package/src/extensions/index.ts +34 -0
- package/src/extensions/keyboard-shortcuts/hooks/__tests__/use-action-props.test.ts +20 -0
- package/src/extensions/keyboard-shortcuts/hooks/use-action-props.ts +12 -0
- package/src/extensions/keyboard-shortcuts/index.ts +11 -0
- package/src/extensions/site-settings/components/__tests__/portalled-primary-action.test.tsx +94 -0
- package/src/extensions/site-settings/components/__tests__/primary-action.test.tsx +100 -0
- package/src/extensions/site-settings/components/portal.tsx +27 -0
- package/src/extensions/site-settings/components/portalled-primary-action.tsx +11 -0
- package/src/extensions/site-settings/components/primary-action.tsx +32 -0
- package/src/extensions/site-settings/hooks/__tests__/use-action-props.test.ts +49 -0
- package/src/extensions/site-settings/hooks/use-action-props.ts +22 -0
- package/src/extensions/site-settings/index.ts +18 -0
- package/src/extensions/structure/hooks/__tests__/use-action-props.test.ts +33 -0
- package/src/extensions/structure/hooks/use-action-props.ts +16 -0
- package/src/extensions/structure/index.ts +10 -0
- package/src/extensions/theme-builder/hooks/__tests__/use-action-props.test.ts +22 -0
- package/src/extensions/theme-builder/hooks/use-action-props.ts +12 -0
- package/src/extensions/theme-builder/index.ts +9 -0
- package/src/extensions/user-preferences/hooks/__tests__/use-action-props.test.ts +34 -0
- package/src/extensions/user-preferences/hooks/use-action-props.ts +16 -0
- package/src/extensions/user-preferences/index.ts +10 -0
- package/src/extensions/wordpress/index.ts +21 -0
- package/src/index.ts +13 -0
- package/src/init.ts +15 -0
- package/src/locations/__tests__/menus.test.tsx +229 -0
- package/src/locations/consts.ts +4 -0
- package/src/locations/index.ts +29 -0
- package/src/locations/menus.tsx +141 -0
- package/src/sync/__tests__/redirect-old-menus.test.ts +34 -0
- package/src/sync/redirect-old-menus.ts +9 -0
- package/src/types.ts +3 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1017 @@
|
|
|
1
|
+
// src/locations/menus.tsx
|
|
2
|
+
import * as React8 from "react";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
import { inject, useInjectionsOf } from "@elementor/locations";
|
|
5
|
+
|
|
6
|
+
// src/components/actions/action.tsx
|
|
7
|
+
import * as React4 from "react";
|
|
8
|
+
|
|
9
|
+
// src/contexts/menu-context.tsx
|
|
10
|
+
import * as React from "react";
|
|
11
|
+
import { createContext, useContext } from "react";
|
|
12
|
+
var MenuContext = createContext({ type: "toolbar" });
|
|
13
|
+
function MenuContextProvider({ type, children }) {
|
|
14
|
+
return /* @__PURE__ */ React.createElement(MenuContext.Provider, { value: { type } }, children);
|
|
15
|
+
}
|
|
16
|
+
function useMenuContext() {
|
|
17
|
+
return useContext(MenuContext);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// src/components/ui/toolbar-menu-item.tsx
|
|
21
|
+
import * as React2 from "react";
|
|
22
|
+
import { Box, IconButton, Tooltip } from "@elementor/ui";
|
|
23
|
+
function ToolbarMenuItem({ title, ...props }) {
|
|
24
|
+
return /* @__PURE__ */ React2.createElement(Tooltip, { title }, /* @__PURE__ */ React2.createElement(Box, { component: "span", "aria-label": void 0 }, /* @__PURE__ */ React2.createElement(IconButton, { ...props, "aria-label": title, size: "small" })));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/components/ui/popover-menu-item.tsx
|
|
28
|
+
import * as React3 from "react";
|
|
29
|
+
import {
|
|
30
|
+
MenuItem,
|
|
31
|
+
ListItemText,
|
|
32
|
+
ListItemIcon,
|
|
33
|
+
withDirection
|
|
34
|
+
} from "@elementor/ui";
|
|
35
|
+
import { ArrowUpRightIcon } from "@elementor/icons";
|
|
36
|
+
var DirectionalArrowIcon = withDirection(ArrowUpRightIcon);
|
|
37
|
+
function PopoverMenuItem({ text, icon, onClick, href, target, disabled, ...props }) {
|
|
38
|
+
const isExternalLink = href && target === "_blank";
|
|
39
|
+
return /* @__PURE__ */ React3.createElement(
|
|
40
|
+
MenuItem,
|
|
41
|
+
{
|
|
42
|
+
...props,
|
|
43
|
+
disabled,
|
|
44
|
+
onClick,
|
|
45
|
+
component: href ? "a" : "div",
|
|
46
|
+
href,
|
|
47
|
+
target
|
|
48
|
+
},
|
|
49
|
+
/* @__PURE__ */ React3.createElement(ListItemIcon, null, icon),
|
|
50
|
+
/* @__PURE__ */ React3.createElement(ListItemText, { primary: text }),
|
|
51
|
+
isExternalLink && /* @__PURE__ */ React3.createElement(DirectionalArrowIcon, null)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/components/actions/action.tsx
|
|
56
|
+
function Action({ icon: Icon, title, visible = true, ...props }) {
|
|
57
|
+
const { type } = useMenuContext();
|
|
58
|
+
if (!visible) {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
return type === "toolbar" ? /* @__PURE__ */ React4.createElement(ToolbarMenuItem, { title, ...props }, /* @__PURE__ */ React4.createElement(Icon, null)) : /* @__PURE__ */ React4.createElement(
|
|
62
|
+
PopoverMenuItem,
|
|
63
|
+
{
|
|
64
|
+
...props,
|
|
65
|
+
text: title,
|
|
66
|
+
icon: /* @__PURE__ */ React4.createElement(Icon, null)
|
|
67
|
+
}
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/components/actions/toggle-action.tsx
|
|
72
|
+
import * as React6 from "react";
|
|
73
|
+
|
|
74
|
+
// src/components/ui/toolbar-menu-toggle-item.tsx
|
|
75
|
+
import * as React5 from "react";
|
|
76
|
+
import { Box as Box2, ToggleButton, Tooltip as Tooltip2 } from "@elementor/ui";
|
|
77
|
+
function ToolbarMenuToggleItem({ title, onClick, ...props }) {
|
|
78
|
+
return /* @__PURE__ */ React5.createElement(Tooltip2, { title }, /* @__PURE__ */ React5.createElement(Box2, { component: "span", "aria-label": void 0 }, /* @__PURE__ */ React5.createElement(ToggleButton, { ...props, onChange: onClick, "aria-label": title, size: "small" })));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/components/actions/toggle-action.tsx
|
|
82
|
+
function ToggleAction({ icon: Icon, title, value, visible = true, ...props }) {
|
|
83
|
+
const { type } = useMenuContext();
|
|
84
|
+
if (!visible) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
return type === "toolbar" ? /* @__PURE__ */ React6.createElement(ToolbarMenuToggleItem, { value: value || title, title, ...props }, /* @__PURE__ */ React6.createElement(Icon, null)) : /* @__PURE__ */ React6.createElement(
|
|
88
|
+
PopoverMenuItem,
|
|
89
|
+
{
|
|
90
|
+
...props,
|
|
91
|
+
text: title,
|
|
92
|
+
icon: /* @__PURE__ */ React6.createElement(Icon, null)
|
|
93
|
+
}
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// src/components/actions/link.tsx
|
|
98
|
+
import * as React7 from "react";
|
|
99
|
+
function Link({ icon: Icon, title, visible = true, ...props }) {
|
|
100
|
+
const { type } = useMenuContext();
|
|
101
|
+
if (!visible) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
return type === "toolbar" ? /* @__PURE__ */ React7.createElement(ToolbarMenuItem, { title, ...props }, /* @__PURE__ */ React7.createElement(Icon, null)) : /* @__PURE__ */ React7.createElement(
|
|
105
|
+
PopoverMenuItem,
|
|
106
|
+
{
|
|
107
|
+
...props,
|
|
108
|
+
text: title,
|
|
109
|
+
icon: /* @__PURE__ */ React7.createElement(Icon, null)
|
|
110
|
+
}
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// src/locations/menus.tsx
|
|
115
|
+
function createMenu({ name: menuName, groups = [] }) {
|
|
116
|
+
const menuGroups = [
|
|
117
|
+
...groups,
|
|
118
|
+
"default"
|
|
119
|
+
];
|
|
120
|
+
const registerAction = createRegisterMenuItem({
|
|
121
|
+
menuName,
|
|
122
|
+
menuGroups,
|
|
123
|
+
component: Action
|
|
124
|
+
});
|
|
125
|
+
const registerToggleAction = createRegisterMenuItem({
|
|
126
|
+
menuName,
|
|
127
|
+
menuGroups,
|
|
128
|
+
component: ToggleAction
|
|
129
|
+
});
|
|
130
|
+
const registerLink = createRegisterMenuItem({
|
|
131
|
+
menuName,
|
|
132
|
+
menuGroups,
|
|
133
|
+
component: Link
|
|
134
|
+
});
|
|
135
|
+
const useMenuItems5 = createUseMenuItems({
|
|
136
|
+
menuName,
|
|
137
|
+
menuGroups
|
|
138
|
+
});
|
|
139
|
+
return {
|
|
140
|
+
registerAction,
|
|
141
|
+
registerToggleAction,
|
|
142
|
+
registerLink,
|
|
143
|
+
useMenuItems: useMenuItems5
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function createRegisterMenuItem({ menuName, menuGroups, component }) {
|
|
147
|
+
return ({ group = "default", name, overwrite, priority, ...args }) => {
|
|
148
|
+
if (!menuGroups.includes(group)) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const useProps = "props" in args ? () => args.props : args.useProps;
|
|
152
|
+
const Component = component;
|
|
153
|
+
const Filler = (props) => {
|
|
154
|
+
const componentProps = useProps();
|
|
155
|
+
return /* @__PURE__ */ React8.createElement(Component, { ...props, ...componentProps });
|
|
156
|
+
};
|
|
157
|
+
const location = getMenuLocationId(menuName, group);
|
|
158
|
+
inject({
|
|
159
|
+
location,
|
|
160
|
+
name,
|
|
161
|
+
filler: Filler,
|
|
162
|
+
options: {
|
|
163
|
+
priority,
|
|
164
|
+
overwrite
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function createUseMenuItems({ menuName, menuGroups }) {
|
|
170
|
+
const locations = menuGroups.map((group) => getMenuLocationId(menuName, group));
|
|
171
|
+
return () => {
|
|
172
|
+
const injectionsGroups = useInjectionsOf(locations);
|
|
173
|
+
return useMemo(() => {
|
|
174
|
+
return injectionsGroups.reduce((acc, injections, index) => {
|
|
175
|
+
const groupName = menuGroups[index];
|
|
176
|
+
return {
|
|
177
|
+
...acc,
|
|
178
|
+
[groupName]: injections.map((injection) => ({
|
|
179
|
+
id: injection.id,
|
|
180
|
+
MenuItem: injection.filler
|
|
181
|
+
}))
|
|
182
|
+
};
|
|
183
|
+
}, {});
|
|
184
|
+
}, [injectionsGroups]);
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
function getMenuLocationId(menu, group) {
|
|
188
|
+
return `editor/app-bar/${menu}/${group}`;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// src/locations/index.ts
|
|
192
|
+
import { createInjectorFor } from "@elementor/locations";
|
|
193
|
+
|
|
194
|
+
// src/locations/consts.ts
|
|
195
|
+
var LOCATION_PAGE_INDICATION = "editor/app-bar/page-indication";
|
|
196
|
+
var LOCATION_RESPONSIVE = "editor/app-bar/responsive";
|
|
197
|
+
var LOCATION_PRIMARY_ACTION = "editor/app-bar/primary-action";
|
|
198
|
+
|
|
199
|
+
// src/locations/index.ts
|
|
200
|
+
var injectIntoPageIndication = createInjectorFor(LOCATION_PAGE_INDICATION);
|
|
201
|
+
var injectIntoResponsive = createInjectorFor(LOCATION_RESPONSIVE);
|
|
202
|
+
var injectIntoPrimaryAction = createInjectorFor(LOCATION_PRIMARY_ACTION);
|
|
203
|
+
var mainMenu = createMenu({
|
|
204
|
+
name: "main",
|
|
205
|
+
groups: ["exits"]
|
|
206
|
+
});
|
|
207
|
+
var toolsMenu = createMenu({
|
|
208
|
+
name: "tools"
|
|
209
|
+
});
|
|
210
|
+
var utilitiesMenu = createMenu({
|
|
211
|
+
name: "utilities"
|
|
212
|
+
});
|
|
213
|
+
var documentOptionsMenu = createMenu({
|
|
214
|
+
name: "document-options",
|
|
215
|
+
groups: ["save"]
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// src/components/app-bar.tsx
|
|
219
|
+
import * as React19 from "react";
|
|
220
|
+
import { AppBar as BaseAppBar, Box as Box3, Divider as Divider3, Grid, ThemeProvider } from "@elementor/ui";
|
|
221
|
+
|
|
222
|
+
// src/components/locations/main-menu-location.tsx
|
|
223
|
+
import * as React11 from "react";
|
|
224
|
+
import { usePopupState, bindMenu, bindTrigger, Stack, Divider } from "@elementor/ui";
|
|
225
|
+
|
|
226
|
+
// src/components/ui/popover-menu.tsx
|
|
227
|
+
import * as React9 from "react";
|
|
228
|
+
import { Menu } from "@elementor/ui";
|
|
229
|
+
function PopoverMenu({ children, ...props }) {
|
|
230
|
+
return /* @__PURE__ */ React9.createElement(MenuContextProvider, { type: "popover" }, /* @__PURE__ */ React9.createElement(
|
|
231
|
+
Menu,
|
|
232
|
+
{
|
|
233
|
+
PaperProps: {
|
|
234
|
+
sx: { mt: 4 }
|
|
235
|
+
},
|
|
236
|
+
...props,
|
|
237
|
+
MenuListProps: {
|
|
238
|
+
component: "div"
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
children
|
|
242
|
+
));
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// src/components/ui/toolbar-logo.tsx
|
|
246
|
+
import * as React10 from "react";
|
|
247
|
+
import { useState } from "react";
|
|
248
|
+
import { __ } from "@wordpress/i18n";
|
|
249
|
+
import { ToggleButton as ToggleButton2, SvgIcon, styled } from "@elementor/ui";
|
|
250
|
+
var ElementorLogo = (props) => {
|
|
251
|
+
return /* @__PURE__ */ React10.createElement(SvgIcon, { viewBox: "0 0 32 32", ...props }, /* @__PURE__ */ React10.createElement("g", null, /* @__PURE__ */ React10.createElement("circle", { cx: "16", cy: "16", r: "16" }), /* @__PURE__ */ React10.createElement("path", { d: "M11.7 9H9V22.3H11.7V9Z" }), /* @__PURE__ */ React10.createElement("path", { d: "M22.4 9H9V11.7H22.4V9Z" }), /* @__PURE__ */ React10.createElement("path", { d: "M22.4 14.4004H9V17.1004H22.4V14.4004Z" }), /* @__PURE__ */ React10.createElement("path", { d: "M22.4 19.6992H9V22.3992H22.4V19.6992Z" })));
|
|
252
|
+
};
|
|
253
|
+
var StyledToggleButton = styled(ToggleButton2)(() => ({
|
|
254
|
+
padding: 0,
|
|
255
|
+
"&.MuiToggleButton-root:hover": {
|
|
256
|
+
backgroundColor: "initial"
|
|
257
|
+
},
|
|
258
|
+
"&.MuiToggleButton-root.Mui-selected": {
|
|
259
|
+
backgroundColor: "initial"
|
|
260
|
+
}
|
|
261
|
+
}));
|
|
262
|
+
var StyledElementorLogo = styled(ElementorLogo, {
|
|
263
|
+
shouldForwardProp: (prop) => prop !== "showMenuIcon"
|
|
264
|
+
})(({ theme, showMenuIcon }) => ({
|
|
265
|
+
width: "auto",
|
|
266
|
+
height: "100%",
|
|
267
|
+
"& path": {
|
|
268
|
+
fill: "initial",
|
|
269
|
+
transition: "all 0.2s linear",
|
|
270
|
+
transformOrigin: "bottom left",
|
|
271
|
+
"&:first-of-type": {
|
|
272
|
+
transitionDelay: !showMenuIcon && "0.2s",
|
|
273
|
+
transform: showMenuIcon && "translateY(-9px) scaleY(0)"
|
|
274
|
+
},
|
|
275
|
+
"&:not(:first-of-type)": {
|
|
276
|
+
// Emotion automatically change 4 to -4 in RTL moode.
|
|
277
|
+
transform: !showMenuIcon && `translateX(${theme.direction === "rtl" ? "4" : "9"}px) scaleX(0.6)`
|
|
278
|
+
},
|
|
279
|
+
"&:nth-of-type(2)": {
|
|
280
|
+
transitionDelay: showMenuIcon ? "0" : "0.2s"
|
|
281
|
+
},
|
|
282
|
+
"&:nth-of-type(3)": {
|
|
283
|
+
transitionDelay: "0.1s"
|
|
284
|
+
},
|
|
285
|
+
"&:nth-of-type(4)": {
|
|
286
|
+
transitionDelay: showMenuIcon ? "0.2s" : "0"
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}));
|
|
290
|
+
function ToolbarLogo(props) {
|
|
291
|
+
const [isHoverState, setIsHoverState] = useState(false);
|
|
292
|
+
const showMenuIcon = props.selected || isHoverState;
|
|
293
|
+
return /* @__PURE__ */ React10.createElement(
|
|
294
|
+
StyledToggleButton,
|
|
295
|
+
{
|
|
296
|
+
...props,
|
|
297
|
+
value: "selected",
|
|
298
|
+
size: "small",
|
|
299
|
+
onMouseEnter: () => setIsHoverState(true),
|
|
300
|
+
onMouseLeave: () => setIsHoverState(false)
|
|
301
|
+
},
|
|
302
|
+
/* @__PURE__ */ React10.createElement(StyledElementorLogo, { titleAccess: __("Elementor Logo", "elementor"), showMenuIcon })
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// src/components/locations/main-menu-location.tsx
|
|
307
|
+
var { useMenuItems } = mainMenu;
|
|
308
|
+
function MainMenuLocation() {
|
|
309
|
+
const menuItems = useMenuItems();
|
|
310
|
+
const orderedGroups = [
|
|
311
|
+
menuItems.default,
|
|
312
|
+
menuItems.exits
|
|
313
|
+
];
|
|
314
|
+
const popupState = usePopupState({
|
|
315
|
+
variant: "popover",
|
|
316
|
+
popupId: "elementor-v2-app-bar-main-menu"
|
|
317
|
+
});
|
|
318
|
+
return /* @__PURE__ */ React11.createElement(Stack, { sx: { paddingInlineStart: 4 }, direction: "row", alignItems: "center" }, /* @__PURE__ */ React11.createElement(
|
|
319
|
+
ToolbarLogo,
|
|
320
|
+
{
|
|
321
|
+
...bindTrigger(popupState),
|
|
322
|
+
selected: popupState.isOpen
|
|
323
|
+
}
|
|
324
|
+
), /* @__PURE__ */ React11.createElement(
|
|
325
|
+
PopoverMenu,
|
|
326
|
+
{
|
|
327
|
+
onClick: popupState.close,
|
|
328
|
+
...bindMenu(popupState),
|
|
329
|
+
PaperProps: {
|
|
330
|
+
sx: { mt: 4, marginInlineStart: -2 }
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
orderedGroups.filter((group) => group.length).map((group, index) => {
|
|
334
|
+
return [
|
|
335
|
+
index > 0 ? /* @__PURE__ */ React11.createElement(Divider, { key: index, orientation: "horizontal" }) : null,
|
|
336
|
+
...group.map(
|
|
337
|
+
({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React11.createElement(MenuItem2, { key: id })
|
|
338
|
+
)
|
|
339
|
+
];
|
|
340
|
+
})
|
|
341
|
+
));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// src/components/locations/tools-menu-location.tsx
|
|
345
|
+
import * as React14 from "react";
|
|
346
|
+
|
|
347
|
+
// src/components/ui/toolbar-menu.tsx
|
|
348
|
+
import * as React12 from "react";
|
|
349
|
+
import { Stack as Stack2 } from "@elementor/ui";
|
|
350
|
+
function ToolbarMenu({ children, ...props }) {
|
|
351
|
+
return /* @__PURE__ */ React12.createElement(MenuContextProvider, { type: "toolbar" }, /* @__PURE__ */ React12.createElement(Stack2, { sx: { px: 4 }, spacing: 4, direction: "row", alignItems: "center", ...props }, children));
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// src/components/ui/toolbar-menu-more.tsx
|
|
355
|
+
import * as React13 from "react";
|
|
356
|
+
import { bindMenu as bindMenu2, bindTrigger as bindTrigger2, usePopupState as usePopupState2 } from "@elementor/ui";
|
|
357
|
+
import { __ as __2 } from "@wordpress/i18n";
|
|
358
|
+
import { DotsVerticalIcon } from "@elementor/icons";
|
|
359
|
+
function ToolbarMenuMore({ children, id }) {
|
|
360
|
+
const popupState = usePopupState2({
|
|
361
|
+
variant: "popover",
|
|
362
|
+
popupId: id
|
|
363
|
+
});
|
|
364
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(ToolbarMenuItem, { ...bindTrigger2(popupState), title: __2("More", "elementor") }, /* @__PURE__ */ React13.createElement(DotsVerticalIcon, null)), /* @__PURE__ */ React13.createElement(PopoverMenu, { onClick: popupState.close, ...bindMenu2(popupState) }, children));
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// src/components/locations/tools-menu-location.tsx
|
|
368
|
+
var MAX_TOOLBAR_ACTIONS = 5;
|
|
369
|
+
var { useMenuItems: useMenuItems2 } = toolsMenu;
|
|
370
|
+
function ToolsMenuLocation() {
|
|
371
|
+
const menuItems = useMenuItems2();
|
|
372
|
+
const toolbarMenuItems = menuItems.default.slice(0, MAX_TOOLBAR_ACTIONS);
|
|
373
|
+
const popoverMenuItems = menuItems.default.slice(MAX_TOOLBAR_ACTIONS);
|
|
374
|
+
return /* @__PURE__ */ React14.createElement(ToolbarMenu, null, toolbarMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React14.createElement(MenuItem2, { key: id })), popoverMenuItems.length > 0 && /* @__PURE__ */ React14.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-tools-more" }, popoverMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React14.createElement(MenuItem2, { key: id }))));
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// src/components/locations/utilities-menu-location.tsx
|
|
378
|
+
import * as React15 from "react";
|
|
379
|
+
import { Fragment as Fragment2 } from "react";
|
|
380
|
+
import { Divider as Divider2 } from "@elementor/ui";
|
|
381
|
+
var MAX_TOOLBAR_ACTIONS2 = 3;
|
|
382
|
+
var { useMenuItems: useMenuItems3 } = utilitiesMenu;
|
|
383
|
+
function UtilitiesMenuLocation() {
|
|
384
|
+
const menuItems = useMenuItems3();
|
|
385
|
+
const toolbarMenuItems = menuItems.default.slice(0, MAX_TOOLBAR_ACTIONS2);
|
|
386
|
+
const popoverMenuItems = menuItems.default.slice(MAX_TOOLBAR_ACTIONS2);
|
|
387
|
+
return /* @__PURE__ */ React15.createElement(ToolbarMenu, null, toolbarMenuItems.map(
|
|
388
|
+
({ MenuItem: MenuItem2, id }, index) => /* @__PURE__ */ React15.createElement(Fragment2, { key: id }, index === 0 && /* @__PURE__ */ React15.createElement(Divider2, { orientation: "vertical" }), /* @__PURE__ */ React15.createElement(MenuItem2, null))
|
|
389
|
+
), popoverMenuItems.length > 0 && /* @__PURE__ */ React15.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-utilities-more" }, popoverMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React15.createElement(MenuItem2, { key: id }))));
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
// src/components/locations/primary-action-location.tsx
|
|
393
|
+
import * as React16 from "react";
|
|
394
|
+
import { Slot } from "@elementor/locations";
|
|
395
|
+
function PrimaryActionLocation() {
|
|
396
|
+
return /* @__PURE__ */ React16.createElement(Slot, { location: LOCATION_PRIMARY_ACTION });
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// src/components/locations/page-indication-location.tsx
|
|
400
|
+
import * as React17 from "react";
|
|
401
|
+
import { Slot as Slot2 } from "@elementor/locations";
|
|
402
|
+
function PageIndicationLocation() {
|
|
403
|
+
return /* @__PURE__ */ React17.createElement(Slot2, { location: LOCATION_PAGE_INDICATION });
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// src/components/locations/responsive-location.tsx
|
|
407
|
+
import * as React18 from "react";
|
|
408
|
+
import { Slot as Slot3 } from "@elementor/locations";
|
|
409
|
+
function ResponsiveLocation() {
|
|
410
|
+
return /* @__PURE__ */ React18.createElement(Slot3, { location: LOCATION_RESPONSIVE });
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
// src/components/app-bar.tsx
|
|
414
|
+
function AppBar() {
|
|
415
|
+
return /* @__PURE__ */ React19.createElement(ThemeProvider, { colorScheme: "dark" }, /* @__PURE__ */ React19.createElement(BaseAppBar, { position: "sticky" }, /* @__PURE__ */ React19.createElement(Box3, { display: "grid", gridTemplateColumns: "repeat(3, 1fr)" }, /* @__PURE__ */ React19.createElement(Grid, { container: true }, /* @__PURE__ */ React19.createElement(MainMenuLocation, null), /* @__PURE__ */ React19.createElement(ToolsMenuLocation, null)), /* @__PURE__ */ React19.createElement(Grid, { container: true, justifyContent: "center" }, /* @__PURE__ */ React19.createElement(ToolbarMenu, { spacing: 3 }, /* @__PURE__ */ React19.createElement(Divider3, { orientation: "vertical" }), /* @__PURE__ */ React19.createElement(PageIndicationLocation, null), /* @__PURE__ */ React19.createElement(Divider3, { orientation: "vertical" }), /* @__PURE__ */ React19.createElement(ResponsiveLocation, null), /* @__PURE__ */ React19.createElement(Divider3, { orientation: "vertical" }))), /* @__PURE__ */ React19.createElement(Grid, { container: true, justifyContent: "flex-end" }, /* @__PURE__ */ React19.createElement(UtilitiesMenuLocation, null), /* @__PURE__ */ React19.createElement(PrimaryActionLocation, null)))));
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// src/init.ts
|
|
419
|
+
import { injectIntoTop as injectIntoTop2 } from "@elementor/editor";
|
|
420
|
+
|
|
421
|
+
// src/sync/redirect-old-menus.ts
|
|
422
|
+
import { listenTo, openRoute, routeOpenEvent } from "@elementor/editor-v1-adapters";
|
|
423
|
+
function redirectOldMenus() {
|
|
424
|
+
listenTo(routeOpenEvent("panel/menu"), () => {
|
|
425
|
+
openRoute("panel/elements/categories");
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// src/extensions/documents-indicator/components/settings-button.tsx
|
|
430
|
+
import * as React20 from "react";
|
|
431
|
+
import { Box as Box4, ToggleButton as ToggleButton3, Tooltip as Tooltip3 } from "@elementor/ui";
|
|
432
|
+
import { __ as __3 } from "@wordpress/i18n";
|
|
433
|
+
import { openRoute as openRoute2, useRouteStatus } from "@elementor/editor-v1-adapters";
|
|
434
|
+
import { SettingsIcon } from "@elementor/icons";
|
|
435
|
+
import { useActiveDocument, useHostDocument } from "@elementor/editor-documents";
|
|
436
|
+
function SettingsButton() {
|
|
437
|
+
const activeDocument = useActiveDocument();
|
|
438
|
+
const hostDocument = useHostDocument();
|
|
439
|
+
const document2 = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument;
|
|
440
|
+
const { isActive, isBlocked } = useRouteStatus("panel/page-settings");
|
|
441
|
+
if (!document2) {
|
|
442
|
+
return null;
|
|
443
|
+
}
|
|
444
|
+
const title = __3("%s Settings", "elementor").replace("%s", document2.type.label);
|
|
445
|
+
return /* @__PURE__ */ React20.createElement(Tooltip3, { title }, /* @__PURE__ */ React20.createElement(Box4, { component: "span", "aria-label": void 0 }, /* @__PURE__ */ React20.createElement(
|
|
446
|
+
ToggleButton3,
|
|
447
|
+
{
|
|
448
|
+
value: "document-settings",
|
|
449
|
+
selected: isActive,
|
|
450
|
+
disabled: isBlocked,
|
|
451
|
+
onChange: () => openRoute2("panel/page-settings/settings"),
|
|
452
|
+
"aria-label": title,
|
|
453
|
+
size: "small"
|
|
454
|
+
},
|
|
455
|
+
/* @__PURE__ */ React20.createElement(SettingsIcon, null)
|
|
456
|
+
)));
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// src/extensions/documents-indicator/index.ts
|
|
460
|
+
function init() {
|
|
461
|
+
injectIntoPageIndication({
|
|
462
|
+
name: "document-settings-button",
|
|
463
|
+
filler: SettingsButton,
|
|
464
|
+
options: {
|
|
465
|
+
priority: 20
|
|
466
|
+
// After document indicator.
|
|
467
|
+
}
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// src/extensions/documents-preview/hooks/use-action-props.ts
|
|
472
|
+
import { __ as __4 } from "@wordpress/i18n";
|
|
473
|
+
import { EyeIcon } from "@elementor/icons";
|
|
474
|
+
import { runCommand } from "@elementor/editor-v1-adapters";
|
|
475
|
+
import { useActiveDocument as useActiveDocument2 } from "@elementor/editor-documents";
|
|
476
|
+
function useActionProps() {
|
|
477
|
+
const document2 = useActiveDocument2();
|
|
478
|
+
return {
|
|
479
|
+
icon: EyeIcon,
|
|
480
|
+
title: __4("Preview Changes", "elementor"),
|
|
481
|
+
onClick: () => document2 && runCommand("editor/documents/preview", {
|
|
482
|
+
id: document2.id,
|
|
483
|
+
force: true
|
|
484
|
+
})
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// src/extensions/documents-preview/index.ts
|
|
489
|
+
function init2() {
|
|
490
|
+
utilitiesMenu.registerAction({
|
|
491
|
+
name: "document-preview-button",
|
|
492
|
+
priority: 30,
|
|
493
|
+
// After help.
|
|
494
|
+
useProps: useActionProps
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// src/extensions/documents-save/hooks/use-document-save-draft-props.ts
|
|
499
|
+
import { __ as __5 } from "@wordpress/i18n";
|
|
500
|
+
import { FileReportIcon } from "@elementor/icons";
|
|
501
|
+
import { useActiveDocument as useActiveDocument3, useActiveDocumentActions } from "@elementor/editor-documents";
|
|
502
|
+
function useDocumentSaveDraftProps() {
|
|
503
|
+
const document2 = useActiveDocument3();
|
|
504
|
+
const { saveDraft } = useActiveDocumentActions();
|
|
505
|
+
return {
|
|
506
|
+
icon: FileReportIcon,
|
|
507
|
+
title: __5("Save Draft", "elementor"),
|
|
508
|
+
onClick: saveDraft,
|
|
509
|
+
disabled: !document2 || document2.isSaving || document2.isSavingDraft || !document2.isDirty
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
// src/extensions/documents-save/hooks/use-document-save-template-props.ts
|
|
514
|
+
import { __ as __6 } from "@wordpress/i18n";
|
|
515
|
+
import { FolderIcon } from "@elementor/icons";
|
|
516
|
+
import { useActiveDocumentActions as useActiveDocumentActions2 } from "@elementor/editor-documents";
|
|
517
|
+
function useDocumentSaveTemplateProps() {
|
|
518
|
+
const { saveTemplate } = useActiveDocumentActions2();
|
|
519
|
+
return {
|
|
520
|
+
icon: FolderIcon,
|
|
521
|
+
title: __6("Save as Template", "elementor"),
|
|
522
|
+
onClick: saveTemplate
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// src/extensions/documents-save/components/primary-action.tsx
|
|
527
|
+
import * as React22 from "react";
|
|
528
|
+
import { __ as __7 } from "@wordpress/i18n";
|
|
529
|
+
|
|
530
|
+
// src/extensions/documents-save/components/primary-action-menu.tsx
|
|
531
|
+
import * as React21 from "react";
|
|
532
|
+
import { Divider as Divider4, styled as styled2 } from "@elementor/ui";
|
|
533
|
+
var { useMenuItems: useMenuItems4 } = documentOptionsMenu;
|
|
534
|
+
var StyledPopoverMenu = styled2(PopoverMenu)`
|
|
535
|
+
& > .MuiPopover-paper > .MuiList-root > .MuiDivider-root {
|
|
536
|
+
&:only-child, /* A divider is being rendered lonely */
|
|
537
|
+
&:last-child, /* The last group renders empty but renders a divider */
|
|
538
|
+
& + .MuiDivider-root /* Multiple dividers due to multiple empty groups */ {
|
|
539
|
+
display: none;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
`;
|
|
543
|
+
function PrimaryActionMenu(props) {
|
|
544
|
+
const { save: saveActions, default: defaultActions } = useMenuItems4();
|
|
545
|
+
return /* @__PURE__ */ React21.createElement(
|
|
546
|
+
StyledPopoverMenu,
|
|
547
|
+
{
|
|
548
|
+
...props,
|
|
549
|
+
anchorOrigin: {
|
|
550
|
+
vertical: "bottom",
|
|
551
|
+
horizontal: "right"
|
|
552
|
+
},
|
|
553
|
+
transformOrigin: {
|
|
554
|
+
vertical: "top",
|
|
555
|
+
horizontal: "right"
|
|
556
|
+
},
|
|
557
|
+
PaperProps: {
|
|
558
|
+
sx: { mt: 2, ml: 3 }
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
saveActions.map(({ MenuItem: MenuItem2, id }, index) => [
|
|
562
|
+
index > 0 && /* @__PURE__ */ React21.createElement(Divider4, { key: `${id}-divider` }),
|
|
563
|
+
/* @__PURE__ */ React21.createElement(MenuItem2, { key: id })
|
|
564
|
+
]),
|
|
565
|
+
defaultActions.length > 0 && /* @__PURE__ */ React21.createElement(Divider4, null),
|
|
566
|
+
defaultActions.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React21.createElement(MenuItem2, { key: id }))
|
|
567
|
+
);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
// src/extensions/documents-save/components/primary-action.tsx
|
|
571
|
+
import {
|
|
572
|
+
bindMenu as bindMenu3,
|
|
573
|
+
bindTrigger as bindTrigger3,
|
|
574
|
+
Button,
|
|
575
|
+
ButtonGroup,
|
|
576
|
+
CircularProgress,
|
|
577
|
+
Tooltip as Tooltip4,
|
|
578
|
+
usePopupState as usePopupState3
|
|
579
|
+
} from "@elementor/ui";
|
|
580
|
+
import { useActiveDocument as useActiveDocument4, useActiveDocumentActions as useActiveDocumentActions3 } from "@elementor/editor-documents";
|
|
581
|
+
import { ChevronDownIcon } from "@elementor/icons";
|
|
582
|
+
function PrimaryAction() {
|
|
583
|
+
const document2 = useActiveDocument4();
|
|
584
|
+
const { save } = useActiveDocumentActions3();
|
|
585
|
+
const popupState = usePopupState3({
|
|
586
|
+
variant: "popover",
|
|
587
|
+
popupId: "document-save-options"
|
|
588
|
+
});
|
|
589
|
+
if (!document2) {
|
|
590
|
+
return null;
|
|
591
|
+
}
|
|
592
|
+
const isDisabled = !isEnabled(document2);
|
|
593
|
+
const shouldShowSpinner = document2.isSaving && !isDisabled;
|
|
594
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(ButtonGroup, { size: "large", variant: "contained" }, /* @__PURE__ */ React22.createElement(
|
|
595
|
+
Button,
|
|
596
|
+
{
|
|
597
|
+
onClick: () => !document2.isSaving && save(),
|
|
598
|
+
sx: { width: "120px" },
|
|
599
|
+
disabled: isDisabled
|
|
600
|
+
},
|
|
601
|
+
shouldShowSpinner ? /* @__PURE__ */ React22.createElement(CircularProgress, null) : getLabel(document2)
|
|
602
|
+
), /* @__PURE__ */ React22.createElement(
|
|
603
|
+
Tooltip4,
|
|
604
|
+
{
|
|
605
|
+
title: __7("Save Options", "elementor"),
|
|
606
|
+
PopperProps: {
|
|
607
|
+
sx: {
|
|
608
|
+
"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
|
|
609
|
+
mt: 3,
|
|
610
|
+
mr: 1
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
/* @__PURE__ */ React22.createElement(Button, { sx: { px: 0 }, ...bindTrigger3(popupState) }, /* @__PURE__ */ React22.createElement(ChevronDownIcon, null))
|
|
616
|
+
)), /* @__PURE__ */ React22.createElement(PrimaryActionMenu, { ...bindMenu3(popupState), onClick: popupState.close }));
|
|
617
|
+
}
|
|
618
|
+
function getLabel(document2) {
|
|
619
|
+
return document2.userCan.publish ? __7("Publish", "elementor") : __7("Submit", "elementor");
|
|
620
|
+
}
|
|
621
|
+
function isEnabled(document2) {
|
|
622
|
+
if (document2.type.value === "kit") {
|
|
623
|
+
return false;
|
|
624
|
+
}
|
|
625
|
+
return document2.isDirty || document2.status.value === "draft";
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
// src/extensions/documents-save/index.ts
|
|
629
|
+
function init3() {
|
|
630
|
+
injectIntoPrimaryAction({
|
|
631
|
+
name: "document-primary-action",
|
|
632
|
+
filler: PrimaryAction
|
|
633
|
+
});
|
|
634
|
+
documentOptionsMenu.registerAction({
|
|
635
|
+
group: "save",
|
|
636
|
+
name: "document-save-draft",
|
|
637
|
+
priority: 10,
|
|
638
|
+
// Before save as template.
|
|
639
|
+
useProps: useDocumentSaveDraftProps
|
|
640
|
+
});
|
|
641
|
+
documentOptionsMenu.registerAction({
|
|
642
|
+
group: "save",
|
|
643
|
+
name: "document-save-as-template",
|
|
644
|
+
priority: 20,
|
|
645
|
+
// After save draft.
|
|
646
|
+
useProps: useDocumentSaveTemplateProps
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// src/extensions/elements/sync/sync-panel-title.ts
|
|
651
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
652
|
+
import { isRouteActive, listenTo as listenTo2, routeOpenEvent as routeOpenEvent2, v1ReadyEvent } from "@elementor/editor-v1-adapters";
|
|
653
|
+
function syncPanelTitle() {
|
|
654
|
+
const panelTitle = __8("Elements", "elementor");
|
|
655
|
+
const tabTitle = __8("Widgets", "elementor");
|
|
656
|
+
listenTo2(
|
|
657
|
+
routeOpenEvent2("panel/elements"),
|
|
658
|
+
() => {
|
|
659
|
+
setPanelTitle(panelTitle);
|
|
660
|
+
setTabTitle(tabTitle);
|
|
661
|
+
}
|
|
662
|
+
);
|
|
663
|
+
listenTo2(
|
|
664
|
+
v1ReadyEvent(),
|
|
665
|
+
() => {
|
|
666
|
+
if (isRouteActive("panel/elements")) {
|
|
667
|
+
setPanelTitle(panelTitle);
|
|
668
|
+
setTabTitle(tabTitle);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
);
|
|
672
|
+
}
|
|
673
|
+
function setPanelTitle(title) {
|
|
674
|
+
window.elementor?.getPanelView?.()?.getHeaderView?.()?.setTitle?.(title);
|
|
675
|
+
}
|
|
676
|
+
function setTabTitle(title) {
|
|
677
|
+
const tab = document.querySelector('.elementor-component-tab[data-tab="categories"]');
|
|
678
|
+
if (tab) {
|
|
679
|
+
tab.textContent = title;
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
// src/extensions/elements/hooks/use-action-props.ts
|
|
684
|
+
import { PlusIcon } from "@elementor/icons";
|
|
685
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
686
|
+
import { openRoute as openRoute3, useRouteStatus as useRouteStatus2 } from "@elementor/editor-v1-adapters";
|
|
687
|
+
function useActionProps2() {
|
|
688
|
+
const { isActive, isBlocked } = useRouteStatus2("panel/elements");
|
|
689
|
+
return {
|
|
690
|
+
title: __9("Add Element", "elementor"),
|
|
691
|
+
icon: PlusIcon,
|
|
692
|
+
onClick: () => openRoute3("panel/elements/categories"),
|
|
693
|
+
selected: isActive,
|
|
694
|
+
disabled: isBlocked
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// src/extensions/elements/index.ts
|
|
699
|
+
function init4() {
|
|
700
|
+
syncPanelTitle();
|
|
701
|
+
toolsMenu.registerToggleAction({
|
|
702
|
+
name: "open-elements-panel",
|
|
703
|
+
priority: 1,
|
|
704
|
+
useProps: useActionProps2
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// src/extensions/finder/hooks/use-action-props.ts
|
|
709
|
+
import { __ as __10 } from "@wordpress/i18n";
|
|
710
|
+
import { SearchIcon } from "@elementor/icons";
|
|
711
|
+
import { runCommand as runCommand2, useRouteStatus as useRouteStatus3 } from "@elementor/editor-v1-adapters";
|
|
712
|
+
function useActionProps3() {
|
|
713
|
+
const { isActive, isBlocked } = useRouteStatus3("finder", {
|
|
714
|
+
blockOnKitRoutes: false,
|
|
715
|
+
blockOnPreviewMode: false
|
|
716
|
+
});
|
|
717
|
+
return {
|
|
718
|
+
title: __10("Finder", "elementor"),
|
|
719
|
+
icon: SearchIcon,
|
|
720
|
+
onClick: () => runCommand2("finder/toggle"),
|
|
721
|
+
selected: isActive,
|
|
722
|
+
disabled: isBlocked
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// src/extensions/finder/index.ts
|
|
727
|
+
function init5() {
|
|
728
|
+
utilitiesMenu.registerToggleAction({
|
|
729
|
+
name: "toggle-finder",
|
|
730
|
+
priority: 10,
|
|
731
|
+
// Before help.
|
|
732
|
+
useProps: useActionProps3
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// src/extensions/help/index.ts
|
|
737
|
+
import { __ as __11 } from "@wordpress/i18n";
|
|
738
|
+
import { HelpIcon } from "@elementor/icons";
|
|
739
|
+
function init6() {
|
|
740
|
+
utilitiesMenu.registerLink({
|
|
741
|
+
name: "open-help-center",
|
|
742
|
+
priority: 20,
|
|
743
|
+
// After Finder.
|
|
744
|
+
useProps: () => {
|
|
745
|
+
return {
|
|
746
|
+
title: __11("Help", "elementor"),
|
|
747
|
+
href: "https://go.elementor.com/editor-top-bar-learn/",
|
|
748
|
+
icon: HelpIcon,
|
|
749
|
+
target: "_blank"
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// src/extensions/history/hooks/use-action-props.ts
|
|
756
|
+
import { HistoryIcon } from "@elementor/icons";
|
|
757
|
+
import { __ as __12 } from "@wordpress/i18n";
|
|
758
|
+
import { openRoute as openRoute4, useRouteStatus as useRouteStatus4 } from "@elementor/editor-v1-adapters";
|
|
759
|
+
function useActionProps4() {
|
|
760
|
+
const { isActive, isBlocked } = useRouteStatus4("panel/history");
|
|
761
|
+
return {
|
|
762
|
+
title: __12("History", "elementor"),
|
|
763
|
+
icon: HistoryIcon,
|
|
764
|
+
onClick: () => openRoute4("panel/history/actions"),
|
|
765
|
+
selected: isActive,
|
|
766
|
+
disabled: isBlocked
|
|
767
|
+
};
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// src/extensions/history/index.ts
|
|
771
|
+
function init7() {
|
|
772
|
+
mainMenu.registerToggleAction({
|
|
773
|
+
name: "open-history",
|
|
774
|
+
priority: 20,
|
|
775
|
+
useProps: useActionProps4
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
// src/extensions/keyboard-shortcuts/hooks/use-action-props.ts
|
|
780
|
+
import { __ as __13 } from "@wordpress/i18n";
|
|
781
|
+
import { KeyboardIcon } from "@elementor/icons";
|
|
782
|
+
import { runCommand as runCommand3 } from "@elementor/editor-v1-adapters";
|
|
783
|
+
function useActionProps5() {
|
|
784
|
+
return {
|
|
785
|
+
icon: KeyboardIcon,
|
|
786
|
+
title: __13("Keyboard Shortcuts", "elementor"),
|
|
787
|
+
onClick: () => runCommand3("shortcuts/open")
|
|
788
|
+
};
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
// src/extensions/keyboard-shortcuts/index.ts
|
|
792
|
+
function init8() {
|
|
793
|
+
mainMenu.registerAction({
|
|
794
|
+
name: "open-keyboard-shortcuts",
|
|
795
|
+
group: "default",
|
|
796
|
+
priority: 40,
|
|
797
|
+
// After user preferences.
|
|
798
|
+
useProps: useActionProps5
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// src/extensions/site-settings/index.ts
|
|
803
|
+
import { injectIntoTop } from "@elementor/editor";
|
|
804
|
+
|
|
805
|
+
// src/extensions/site-settings/components/portalled-primary-action.tsx
|
|
806
|
+
import * as React25 from "react";
|
|
807
|
+
|
|
808
|
+
// src/extensions/site-settings/components/portal.tsx
|
|
809
|
+
import * as React23 from "react";
|
|
810
|
+
import { Portal as BasePortal } from "@elementor/ui";
|
|
811
|
+
import { isRouteActive as isRouteActive2, routeCloseEvent, routeOpenEvent as routeOpenEvent3, useListenTo } from "@elementor/editor-v1-adapters";
|
|
812
|
+
function Portal(props) {
|
|
813
|
+
const containerRef = useListenTo(
|
|
814
|
+
[
|
|
815
|
+
routeOpenEvent3("panel/global"),
|
|
816
|
+
routeCloseEvent("panel/global")
|
|
817
|
+
],
|
|
818
|
+
getContainerRef
|
|
819
|
+
);
|
|
820
|
+
if (!containerRef.current) {
|
|
821
|
+
return null;
|
|
822
|
+
}
|
|
823
|
+
return /* @__PURE__ */ React23.createElement(BasePortal, { container: containerRef.current, ...props });
|
|
824
|
+
}
|
|
825
|
+
function getContainerRef() {
|
|
826
|
+
return isRouteActive2("panel/global") ? { current: document.querySelector("#elementor-panel-inner") } : { current: null };
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// src/extensions/site-settings/components/primary-action.tsx
|
|
830
|
+
import * as React24 from "react";
|
|
831
|
+
import { useActiveDocument as useActiveDocument5, useActiveDocumentActions as useActiveDocumentActions4 } from "@elementor/editor-documents";
|
|
832
|
+
import { Button as Button2, CircularProgress as CircularProgress2, Paper } from "@elementor/ui";
|
|
833
|
+
import { __ as __14 } from "@wordpress/i18n";
|
|
834
|
+
function PrimaryAction2() {
|
|
835
|
+
const document2 = useActiveDocument5();
|
|
836
|
+
const { save } = useActiveDocumentActions4();
|
|
837
|
+
return /* @__PURE__ */ React24.createElement(Paper, { sx: {
|
|
838
|
+
px: 5,
|
|
839
|
+
py: 4,
|
|
840
|
+
borderTop: 1,
|
|
841
|
+
borderColor: "divider"
|
|
842
|
+
} }, /* @__PURE__ */ React24.createElement(
|
|
843
|
+
Button2,
|
|
844
|
+
{
|
|
845
|
+
variant: "contained",
|
|
846
|
+
disabled: !document2 || !document2.isDirty,
|
|
847
|
+
size: "medium",
|
|
848
|
+
sx: { width: "100%" },
|
|
849
|
+
onClick: () => document2 && !document2.isSaving ? save() : null
|
|
850
|
+
},
|
|
851
|
+
document2?.isSaving ? /* @__PURE__ */ React24.createElement(CircularProgress2, null) : __14("Save Changes", "elementor")
|
|
852
|
+
));
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
// src/extensions/site-settings/components/portalled-primary-action.tsx
|
|
856
|
+
function PortalledPrimaryAction() {
|
|
857
|
+
return /* @__PURE__ */ React25.createElement(Portal, null, /* @__PURE__ */ React25.createElement(PrimaryAction2, null));
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
// src/extensions/site-settings/hooks/use-action-props.ts
|
|
861
|
+
import { __ as __15 } from "@wordpress/i18n";
|
|
862
|
+
import { runCommand as runCommand4, useRouteStatus as useRouteStatus5 } from "@elementor/editor-v1-adapters";
|
|
863
|
+
import { AdjustmentsHorizontalIcon } from "@elementor/icons";
|
|
864
|
+
function useActionProps6() {
|
|
865
|
+
const { isActive, isBlocked } = useRouteStatus5("panel/global", {
|
|
866
|
+
blockOnKitRoutes: false
|
|
867
|
+
});
|
|
868
|
+
return {
|
|
869
|
+
title: __15("Site Settings", "elementor"),
|
|
870
|
+
icon: AdjustmentsHorizontalIcon,
|
|
871
|
+
onClick: () => isActive ? runCommand4("panel/global/close") : runCommand4("panel/global/open"),
|
|
872
|
+
selected: isActive,
|
|
873
|
+
disabled: isBlocked
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
// src/extensions/site-settings/index.ts
|
|
878
|
+
function init9() {
|
|
879
|
+
injectIntoTop({
|
|
880
|
+
name: "site-settings-primary-action-portal",
|
|
881
|
+
filler: PortalledPrimaryAction
|
|
882
|
+
});
|
|
883
|
+
toolsMenu.registerToggleAction({
|
|
884
|
+
name: "toggle-site-settings",
|
|
885
|
+
priority: 2,
|
|
886
|
+
useProps: useActionProps6
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// src/extensions/structure/hooks/use-action-props.ts
|
|
891
|
+
import { __ as __16 } from "@wordpress/i18n";
|
|
892
|
+
import { runCommand as runCommand5, useRouteStatus as useRouteStatus6 } from "@elementor/editor-v1-adapters";
|
|
893
|
+
import { StructureIcon } from "@elementor/icons";
|
|
894
|
+
function useActionProps7() {
|
|
895
|
+
const { isActive, isBlocked } = useRouteStatus6("navigator");
|
|
896
|
+
return {
|
|
897
|
+
title: __16("Structure", "elementor"),
|
|
898
|
+
icon: StructureIcon,
|
|
899
|
+
onClick: () => runCommand5("navigator/toggle"),
|
|
900
|
+
selected: isActive,
|
|
901
|
+
disabled: isBlocked
|
|
902
|
+
};
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
// src/extensions/structure/index.ts
|
|
906
|
+
function init10() {
|
|
907
|
+
toolsMenu.registerToggleAction({
|
|
908
|
+
name: "toggle-structure-view",
|
|
909
|
+
priority: 3,
|
|
910
|
+
useProps: useActionProps7
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
// src/extensions/theme-builder/hooks/use-action-props.ts
|
|
915
|
+
import { __ as __17 } from "@wordpress/i18n";
|
|
916
|
+
import { ThemeBuilderIcon } from "@elementor/icons";
|
|
917
|
+
import { runCommand as runCommand6 } from "@elementor/editor-v1-adapters";
|
|
918
|
+
function useActionProps8() {
|
|
919
|
+
return {
|
|
920
|
+
icon: ThemeBuilderIcon,
|
|
921
|
+
title: __17("Theme Builder", "elementor"),
|
|
922
|
+
onClick: () => runCommand6("app/open")
|
|
923
|
+
};
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// src/extensions/theme-builder/index.ts
|
|
927
|
+
function init11() {
|
|
928
|
+
mainMenu.registerAction({
|
|
929
|
+
name: "open-theme-builder",
|
|
930
|
+
useProps: useActionProps8
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// src/extensions/user-preferences/hooks/use-action-props.ts
|
|
935
|
+
import { __ as __18 } from "@wordpress/i18n";
|
|
936
|
+
import { ToggleRightIcon } from "@elementor/icons";
|
|
937
|
+
import { openRoute as openRoute5, useRouteStatus as useRouteStatus7 } from "@elementor/editor-v1-adapters";
|
|
938
|
+
function useActionProps9() {
|
|
939
|
+
const { isActive, isBlocked } = useRouteStatus7("panel/editor-preferences");
|
|
940
|
+
return {
|
|
941
|
+
icon: ToggleRightIcon,
|
|
942
|
+
title: __18("User Preferences", "elementor"),
|
|
943
|
+
onClick: () => openRoute5("panel/editor-preferences"),
|
|
944
|
+
selected: isActive,
|
|
945
|
+
disabled: isBlocked
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
// src/extensions/user-preferences/index.ts
|
|
950
|
+
function init12() {
|
|
951
|
+
mainMenu.registerToggleAction({
|
|
952
|
+
name: "open-user-preferences",
|
|
953
|
+
priority: 30,
|
|
954
|
+
// After history.
|
|
955
|
+
useProps: useActionProps9
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// src/extensions/wordpress/index.ts
|
|
960
|
+
import { useSettings } from "@elementor/editor";
|
|
961
|
+
import { __ as __19 } from "@wordpress/i18n";
|
|
962
|
+
import { WordpressIcon } from "@elementor/icons";
|
|
963
|
+
function init13() {
|
|
964
|
+
mainMenu.registerLink({
|
|
965
|
+
name: "manage-website",
|
|
966
|
+
group: "exits",
|
|
967
|
+
useProps: () => {
|
|
968
|
+
const { urls } = useSettings();
|
|
969
|
+
return {
|
|
970
|
+
title: __19("Manage Website", "elementor"),
|
|
971
|
+
href: urls.admin,
|
|
972
|
+
icon: WordpressIcon,
|
|
973
|
+
target: "_blank"
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// src/extensions/index.ts
|
|
980
|
+
function init14() {
|
|
981
|
+
init();
|
|
982
|
+
init2();
|
|
983
|
+
init3();
|
|
984
|
+
init4();
|
|
985
|
+
init5();
|
|
986
|
+
init6();
|
|
987
|
+
init7();
|
|
988
|
+
init8();
|
|
989
|
+
init9();
|
|
990
|
+
init10();
|
|
991
|
+
init11();
|
|
992
|
+
init12();
|
|
993
|
+
init13();
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
// src/init.ts
|
|
997
|
+
function init15() {
|
|
998
|
+
redirectOldMenus();
|
|
999
|
+
init14();
|
|
1000
|
+
injectIntoTop2({
|
|
1001
|
+
name: "app-bar",
|
|
1002
|
+
filler: AppBar
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// src/index.ts
|
|
1007
|
+
init15();
|
|
1008
|
+
export {
|
|
1009
|
+
documentOptionsMenu,
|
|
1010
|
+
injectIntoPageIndication,
|
|
1011
|
+
injectIntoPrimaryAction,
|
|
1012
|
+
injectIntoResponsive,
|
|
1013
|
+
mainMenu,
|
|
1014
|
+
toolsMenu,
|
|
1015
|
+
utilitiesMenu
|
|
1016
|
+
};
|
|
1017
|
+
//# sourceMappingURL=index.mjs.map
|