@elementor/editor-site-navigation 0.8.0 → 0.9.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/CHANGELOG.md +22 -0
- package/dist/index.js +52 -17
- package/dist/index.mjs +54 -19
- package/package.json +6 -5
- package/src/components/panel/panel.ts +11 -0
- package/src/components/panel/shell.tsx +24 -32
- package/src/env.ts +9 -0
- package/src/hooks/useToggleButtonProps.ts +20 -0
- package/src/init.ts +15 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,28 @@
|
|
|
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.9.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.8.1...@elementor/editor-site-navigation@0.9.0) (2023-06-26)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* added panel infrastructure to pages panel [ED-10863] ([#65](https://github.com/elementor/elementor-packages/issues/65)) ([e743522](https://github.com/elementor/elementor-packages/commit/e743522558b9e7cdf40e2c2dcf71e4049c815992))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## [0.8.1](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.8.0...@elementor/editor-site-navigation@0.8.1) (2023-06-25)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* comment out pages panel [ED-10871] ([#64](https://github.com/elementor/elementor-packages/issues/64)) ([3a8b890](https://github.com/elementor/elementor-packages/commit/3a8b890d8f21ac816d3c0b961b37372bcb91caff))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
6
28
|
# [0.8.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.7.0...@elementor/editor-site-navigation@0.8.0) (2023-06-25)
|
|
7
29
|
|
|
8
30
|
|
package/dist/index.js
CHANGED
|
@@ -248,12 +248,19 @@ function RecentlyEdited() {
|
|
|
248
248
|
|
|
249
249
|
// src/init.ts
|
|
250
250
|
var import_editor_app_bar = require("@elementor/editor-app-bar");
|
|
251
|
-
|
|
251
|
+
|
|
252
|
+
// src/hooks/useToggleButtonProps.ts
|
|
253
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
254
|
+
var import_icons14 = require("@elementor/icons");
|
|
255
|
+
|
|
256
|
+
// src/components/panel/panel.ts
|
|
257
|
+
var import_editor_panels2 = require("@elementor/editor-panels");
|
|
252
258
|
|
|
253
259
|
// src/components/panel/shell.tsx
|
|
254
260
|
var React18 = __toESM(require("react"));
|
|
255
261
|
var import_ui12 = require("@elementor/ui");
|
|
256
262
|
var import_icons13 = require("@elementor/icons");
|
|
263
|
+
var import_editor_panels = require("@elementor/editor-panels");
|
|
257
264
|
|
|
258
265
|
// src/components/panel/pages-list/pages-collapsible-list.tsx
|
|
259
266
|
var React17 = __toESM(require("react"));
|
|
@@ -537,6 +544,7 @@ function PagesCollapsibleList({ pages, isOpenByDefault = false }) {
|
|
|
537
544
|
}
|
|
538
545
|
|
|
539
546
|
// src/components/panel/shell.tsx
|
|
547
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
540
548
|
var mockPages = [
|
|
541
549
|
{
|
|
542
550
|
id: 1,
|
|
@@ -550,16 +558,7 @@ var mockPages = [
|
|
|
550
558
|
{ id: 5, type: "page", title: "FAQ", status: "publish" }
|
|
551
559
|
];
|
|
552
560
|
var Shell = () => {
|
|
553
|
-
return /* @__PURE__ */ React18.createElement(
|
|
554
|
-
import_ui12.Grid,
|
|
555
|
-
{
|
|
556
|
-
container: true,
|
|
557
|
-
justifyContent: "center",
|
|
558
|
-
alignItems: "center",
|
|
559
|
-
sx: { height: 51 }
|
|
560
|
-
},
|
|
561
|
-
/* @__PURE__ */ React18.createElement(import_ui12.Typography, { variant: "h6" }, "Pages")
|
|
562
|
-
), /* @__PURE__ */ React18.createElement(import_ui12.Divider, null), /* @__PURE__ */ React18.createElement(
|
|
561
|
+
return /* @__PURE__ */ React18.createElement(import_editor_panels.Panel, null, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeader, null, /* @__PURE__ */ React18.createElement(import_editor_panels.PanelHeaderTitle, null, (0, import_i18n8.__)("Pages", "elementor"))), /* @__PURE__ */ React18.createElement(import_editor_panels.PanelBody, null, /* @__PURE__ */ React18.createElement(
|
|
563
562
|
import_ui12.Box,
|
|
564
563
|
{
|
|
565
564
|
display: "flex",
|
|
@@ -574,14 +573,49 @@ var Shell = () => {
|
|
|
574
573
|
},
|
|
575
574
|
"Add New"
|
|
576
575
|
)
|
|
577
|
-
), /* @__PURE__ */ React18.createElement(import_ui12.
|
|
576
|
+
), /* @__PURE__ */ React18.createElement(import_ui12.List, { dense: true }, /* @__PURE__ */ React18.createElement(PagesCollapsibleList, { pages: mockPages, isOpenByDefault: true }))));
|
|
578
577
|
};
|
|
579
578
|
var shell_default = Shell;
|
|
580
579
|
|
|
580
|
+
// src/components/panel/panel.ts
|
|
581
|
+
var {
|
|
582
|
+
panel,
|
|
583
|
+
usePanelStatus,
|
|
584
|
+
usePanelActions
|
|
585
|
+
} = (0, import_editor_panels2.createPanel)({
|
|
586
|
+
id: "site-navigation-panel",
|
|
587
|
+
component: shell_default
|
|
588
|
+
});
|
|
589
|
+
|
|
590
|
+
// src/hooks/useToggleButtonProps.ts
|
|
591
|
+
function useToggleButtonProps() {
|
|
592
|
+
const { isOpen, isBlocked } = usePanelStatus();
|
|
593
|
+
const { open, close } = usePanelActions();
|
|
594
|
+
return {
|
|
595
|
+
title: (0, import_i18n9.__)("Pages", "elementor"),
|
|
596
|
+
icon: import_icons14.PagesIcon,
|
|
597
|
+
onClick: () => isOpen ? close() : open(),
|
|
598
|
+
selected: isOpen,
|
|
599
|
+
disabled: isBlocked
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
// src/init.ts
|
|
604
|
+
var import_editor_panels3 = require("@elementor/editor-panels");
|
|
605
|
+
|
|
606
|
+
// src/env.ts
|
|
607
|
+
var import_env = require("@elementor/env");
|
|
608
|
+
var { env, validateEnv } = (0, import_env.parseEnv)("@elementor/editor-site-navigation", (envData) => {
|
|
609
|
+
return envData;
|
|
610
|
+
});
|
|
611
|
+
|
|
581
612
|
// src/init.ts
|
|
582
613
|
function init() {
|
|
583
614
|
registerTopBarMenuItems();
|
|
584
|
-
|
|
615
|
+
if (env.is_panel_active) {
|
|
616
|
+
(0, import_editor_panels3.registerPanel)(panel);
|
|
617
|
+
registerButton();
|
|
618
|
+
}
|
|
585
619
|
}
|
|
586
620
|
function registerTopBarMenuItems() {
|
|
587
621
|
(0, import_editor_app_bar.injectIntoPageIndication)({
|
|
@@ -589,10 +623,11 @@ function registerTopBarMenuItems() {
|
|
|
589
623
|
filler: RecentlyEdited
|
|
590
624
|
});
|
|
591
625
|
}
|
|
592
|
-
function
|
|
593
|
-
|
|
594
|
-
id: "navigation-panel",
|
|
595
|
-
|
|
626
|
+
function registerButton() {
|
|
627
|
+
import_editor_app_bar.toolsMenu.registerToggleAction({
|
|
628
|
+
id: "toggle-site-navigation-panel",
|
|
629
|
+
priority: 2,
|
|
630
|
+
useProps: useToggleButtonProps
|
|
596
631
|
});
|
|
597
632
|
}
|
|
598
633
|
|
package/dist/index.mjs
CHANGED
|
@@ -229,13 +229,20 @@ function RecentlyEdited() {
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
// src/init.ts
|
|
232
|
-
import { injectIntoPageIndication } from "@elementor/editor-app-bar";
|
|
233
|
-
|
|
232
|
+
import { injectIntoPageIndication, toolsMenu } from "@elementor/editor-app-bar";
|
|
233
|
+
|
|
234
|
+
// src/hooks/useToggleButtonProps.ts
|
|
235
|
+
import { __ as __9 } from "@wordpress/i18n";
|
|
236
|
+
import { PagesIcon } from "@elementor/icons";
|
|
237
|
+
|
|
238
|
+
// src/components/panel/panel.ts
|
|
239
|
+
import { createPanel } from "@elementor/editor-panels";
|
|
234
240
|
|
|
235
241
|
// src/components/panel/shell.tsx
|
|
236
242
|
import * as React18 from "react";
|
|
237
|
-
import { Box as Box3, Button as Button2,
|
|
243
|
+
import { Box as Box3, Button as Button2, List as List2 } from "@elementor/ui";
|
|
238
244
|
import { PlusIcon as PlusIcon2 } from "@elementor/icons";
|
|
245
|
+
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from "@elementor/editor-panels";
|
|
239
246
|
|
|
240
247
|
// src/components/panel/pages-list/pages-collapsible-list.tsx
|
|
241
248
|
import * as React17 from "react";
|
|
@@ -528,6 +535,7 @@ function PagesCollapsibleList({ pages, isOpenByDefault = false }) {
|
|
|
528
535
|
}
|
|
529
536
|
|
|
530
537
|
// src/components/panel/shell.tsx
|
|
538
|
+
import { __ as __8 } from "@wordpress/i18n";
|
|
531
539
|
var mockPages = [
|
|
532
540
|
{
|
|
533
541
|
id: 1,
|
|
@@ -541,16 +549,7 @@ var mockPages = [
|
|
|
541
549
|
{ id: 5, type: "page", title: "FAQ", status: "publish" }
|
|
542
550
|
];
|
|
543
551
|
var Shell = () => {
|
|
544
|
-
return /* @__PURE__ */ React18.createElement(
|
|
545
|
-
Grid,
|
|
546
|
-
{
|
|
547
|
-
container: true,
|
|
548
|
-
justifyContent: "center",
|
|
549
|
-
alignItems: "center",
|
|
550
|
-
sx: { height: 51 }
|
|
551
|
-
},
|
|
552
|
-
/* @__PURE__ */ React18.createElement(Typography4, { variant: "h6" }, "Pages")
|
|
553
|
-
), /* @__PURE__ */ React18.createElement(Divider3, null), /* @__PURE__ */ React18.createElement(
|
|
552
|
+
return /* @__PURE__ */ React18.createElement(Panel, null, /* @__PURE__ */ React18.createElement(PanelHeader, null, /* @__PURE__ */ React18.createElement(PanelHeaderTitle, null, __8("Pages", "elementor"))), /* @__PURE__ */ React18.createElement(PanelBody, null, /* @__PURE__ */ React18.createElement(
|
|
554
553
|
Box3,
|
|
555
554
|
{
|
|
556
555
|
display: "flex",
|
|
@@ -565,14 +564,49 @@ var Shell = () => {
|
|
|
565
564
|
},
|
|
566
565
|
"Add New"
|
|
567
566
|
)
|
|
568
|
-
), /* @__PURE__ */ React18.createElement(
|
|
567
|
+
), /* @__PURE__ */ React18.createElement(List2, { dense: true }, /* @__PURE__ */ React18.createElement(PagesCollapsibleList, { pages: mockPages, isOpenByDefault: true }))));
|
|
569
568
|
};
|
|
570
569
|
var shell_default = Shell;
|
|
571
570
|
|
|
571
|
+
// src/components/panel/panel.ts
|
|
572
|
+
var {
|
|
573
|
+
panel,
|
|
574
|
+
usePanelStatus,
|
|
575
|
+
usePanelActions
|
|
576
|
+
} = createPanel({
|
|
577
|
+
id: "site-navigation-panel",
|
|
578
|
+
component: shell_default
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
// src/hooks/useToggleButtonProps.ts
|
|
582
|
+
function useToggleButtonProps() {
|
|
583
|
+
const { isOpen, isBlocked } = usePanelStatus();
|
|
584
|
+
const { open, close } = usePanelActions();
|
|
585
|
+
return {
|
|
586
|
+
title: __9("Pages", "elementor"),
|
|
587
|
+
icon: PagesIcon,
|
|
588
|
+
onClick: () => isOpen ? close() : open(),
|
|
589
|
+
selected: isOpen,
|
|
590
|
+
disabled: isBlocked
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// src/init.ts
|
|
595
|
+
import { registerPanel } from "@elementor/editor-panels";
|
|
596
|
+
|
|
597
|
+
// src/env.ts
|
|
598
|
+
import { parseEnv } from "@elementor/env";
|
|
599
|
+
var { env, validateEnv } = parseEnv("@elementor/editor-site-navigation", (envData) => {
|
|
600
|
+
return envData;
|
|
601
|
+
});
|
|
602
|
+
|
|
572
603
|
// src/init.ts
|
|
573
604
|
function init() {
|
|
574
605
|
registerTopBarMenuItems();
|
|
575
|
-
|
|
606
|
+
if (env.is_panel_active) {
|
|
607
|
+
registerPanel(panel);
|
|
608
|
+
registerButton();
|
|
609
|
+
}
|
|
576
610
|
}
|
|
577
611
|
function registerTopBarMenuItems() {
|
|
578
612
|
injectIntoPageIndication({
|
|
@@ -580,10 +614,11 @@ function registerTopBarMenuItems() {
|
|
|
580
614
|
filler: RecentlyEdited
|
|
581
615
|
});
|
|
582
616
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
585
|
-
id: "navigation-panel",
|
|
586
|
-
|
|
617
|
+
function registerButton() {
|
|
618
|
+
toolsMenu.registerToggleAction({
|
|
619
|
+
id: "toggle-site-navigation-panel",
|
|
620
|
+
priority: 2,
|
|
621
|
+
useProps: useToggleButtonProps
|
|
587
622
|
});
|
|
588
623
|
}
|
|
589
624
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-site-navigation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Elementor Team",
|
|
6
6
|
"homepage": "https://elementor.com/",
|
|
@@ -32,10 +32,11 @@
|
|
|
32
32
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@elementor/editor": "^0.6.
|
|
36
|
-
"@elementor/editor-app-bar": "^0.6.3",
|
|
35
|
+
"@elementor/editor-app-bar": "^0.6.4",
|
|
37
36
|
"@elementor/editor-documents": "^0.8.2",
|
|
38
|
-
"@elementor/
|
|
37
|
+
"@elementor/editor-panels": "^0.1.1",
|
|
38
|
+
"@elementor/env": "^0.2.0",
|
|
39
|
+
"@elementor/icons": "^0.6.0",
|
|
39
40
|
"@elementor/ui": "^1.4.53",
|
|
40
41
|
"@wordpress/api-fetch": "^6.27.0",
|
|
41
42
|
"@wordpress/i18n": "^4.31.0",
|
|
@@ -47,5 +48,5 @@
|
|
|
47
48
|
"elementor": {
|
|
48
49
|
"type": "extension"
|
|
49
50
|
},
|
|
50
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "ed96d6908a9c9d3bab7fe15df52dba55bd64dff5"
|
|
51
52
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { Box, Button,
|
|
2
|
+
import { Box, Button, List } from '@elementor/ui';
|
|
3
3
|
import { PlusIcon } from '@elementor/icons';
|
|
4
4
|
import { Page } from '../../types';
|
|
5
|
+
import { Panel, PanelBody, PanelHeader, PanelHeaderTitle } from '@elementor/editor-panels';
|
|
5
6
|
import PagesCollapsibleList from './pages-list/pages-collapsible-list';
|
|
7
|
+
import { __ } from '@wordpress/i18n';
|
|
6
8
|
|
|
7
9
|
// TODO: Remove once connected to real data fetching.
|
|
8
10
|
const mockPages: Page[] = [
|
|
@@ -20,38 +22,28 @@ const mockPages: Page[] = [
|
|
|
20
22
|
|
|
21
23
|
const Shell = () => {
|
|
22
24
|
return (
|
|
23
|
-
<
|
|
24
|
-
<
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
justifyContent="flex-end"
|
|
37
|
-
alignItems="center"
|
|
25
|
+
<Panel>
|
|
26
|
+
<PanelHeader>
|
|
27
|
+
<PanelHeaderTitle>{ __( 'Pages', 'elementor' ) }</PanelHeaderTitle>
|
|
28
|
+
</PanelHeader>
|
|
29
|
+
<PanelBody>
|
|
30
|
+
<Box
|
|
31
|
+
display="flex"
|
|
32
|
+
justifyContent="flex-end"
|
|
33
|
+
alignItems="center"
|
|
34
|
+
>
|
|
35
|
+
<Button
|
|
36
|
+
sx={ { mt: 4, mb: 4, mr: 5 } }
|
|
37
|
+
startIcon={ <PlusIcon /> }
|
|
38
38
|
>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<List dense>
|
|
48
|
-
<PagesCollapsibleList pages={ mockPages } isOpenByDefault={ true } />
|
|
49
|
-
</List>
|
|
50
|
-
</Box>
|
|
51
|
-
<Divider />
|
|
52
|
-
</Paper>
|
|
53
|
-
</Box>
|
|
54
|
-
</ThemeProvider>
|
|
39
|
+
Add New
|
|
40
|
+
</Button>
|
|
41
|
+
</Box>
|
|
42
|
+
<List dense>
|
|
43
|
+
<PagesCollapsibleList pages={ mockPages } isOpenByDefault={ true } />
|
|
44
|
+
</List>
|
|
45
|
+
</PanelBody>
|
|
46
|
+
</Panel>
|
|
55
47
|
);
|
|
56
48
|
};
|
|
57
49
|
|
package/src/env.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { __ } from '@wordpress/i18n';
|
|
2
|
+
import { PagesIcon } from '@elementor/icons';
|
|
3
|
+
import { usePanelActions, usePanelStatus } from '../components/panel/panel';
|
|
4
|
+
|
|
5
|
+
export function useToggleButtonProps() {
|
|
6
|
+
const { isOpen, isBlocked } = usePanelStatus();
|
|
7
|
+
const { open, close } = usePanelActions();
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
title: __( 'Pages', 'elementor' ),
|
|
11
|
+
icon: PagesIcon,
|
|
12
|
+
onClick: () => (
|
|
13
|
+
isOpen
|
|
14
|
+
? close()
|
|
15
|
+
: open()
|
|
16
|
+
),
|
|
17
|
+
selected: isOpen,
|
|
18
|
+
disabled: isBlocked,
|
|
19
|
+
};
|
|
20
|
+
}
|
package/src/init.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import RecentlyEdited from './components/top-bar/recently-edited';
|
|
2
|
-
import { injectIntoPageIndication } from '@elementor/editor-app-bar';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import { injectIntoPageIndication, toolsMenu } from '@elementor/editor-app-bar';
|
|
3
|
+
import { useToggleButtonProps } from './hooks/useToggleButtonProps';
|
|
4
|
+
import { registerPanel } from '@elementor/editor-panels';
|
|
5
|
+
import { panel } from './components/panel/panel';
|
|
6
|
+
import { env } from './env';
|
|
5
7
|
|
|
6
8
|
export default function init() {
|
|
7
9
|
registerTopBarMenuItems();
|
|
8
|
-
// TODO 06/06/2023 :
|
|
9
|
-
|
|
10
|
+
// TODO 06/06/2023 : remove if when we are production ready
|
|
11
|
+
if ( env.is_panel_active ) {
|
|
12
|
+
registerPanel( panel );
|
|
13
|
+
registerButton();
|
|
14
|
+
}
|
|
10
15
|
}
|
|
11
16
|
|
|
12
17
|
function registerTopBarMenuItems() {
|
|
@@ -16,10 +21,10 @@ function registerTopBarMenuItems() {
|
|
|
16
21
|
} );
|
|
17
22
|
}
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
function registerButton() {
|
|
25
|
+
toolsMenu.registerToggleAction( {
|
|
26
|
+
id: 'toggle-site-navigation-panel',
|
|
27
|
+
priority: 2,
|
|
28
|
+
useProps: useToggleButtonProps,
|
|
24
29
|
} );
|
|
25
30
|
}
|