@wordpress/edit-site 6.42.0 → 6.43.1-next.v.202604091042.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/more-menu/site-export.cjs +1 -1
  3. package/build/components/more-menu/site-export.cjs.map +2 -2
  4. package/build/components/page-patterns/index.cjs +7 -27
  5. package/build/components/page-patterns/index.cjs.map +2 -2
  6. package/build/components/page-templates/index-legacy.cjs +13 -6
  7. package/build/components/page-templates/index-legacy.cjs.map +2 -2
  8. package/build/components/post-list/index.cjs +15 -6
  9. package/build/components/post-list/index.cjs.map +2 -2
  10. package/build/components/post-list/quick-edit-modal.cjs +16 -48
  11. package/build/components/post-list/quick-edit-modal.cjs.map +2 -2
  12. package/build/components/sidebar-dataviews/index.cjs +37 -25
  13. package/build/components/sidebar-dataviews/index.cjs.map +3 -3
  14. package/build/components/sidebar-identity/index.cjs +17 -1
  15. package/build/components/sidebar-identity/index.cjs.map +2 -2
  16. package/build/components/sidebar-navigation-screen-patterns/index.cjs +55 -47
  17. package/build/components/sidebar-navigation-screen-patterns/index.cjs.map +2 -2
  18. package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs +33 -56
  19. package/build/components/sidebar-navigation-screen-templates-browse/content-legacy.cjs.map +3 -3
  20. package/build/components/site-editor-routes/home.cjs +8 -4
  21. package/build/components/site-editor-routes/home.cjs.map +2 -2
  22. package/build/components/site-editor-routes/navigation-item.cjs +13 -6
  23. package/build/components/site-editor-routes/navigation-item.cjs.map +2 -2
  24. package/build/components/site-editor-routes/navigation.cjs +9 -4
  25. package/build/components/site-editor-routes/navigation.cjs.map +2 -2
  26. package/build/components/site-editor-routes/page-item.cjs +13 -6
  27. package/build/components/site-editor-routes/page-item.cjs.map +2 -2
  28. package/build/components/site-editor-routes/pages.cjs +21 -7
  29. package/build/components/site-editor-routes/pages.cjs.map +3 -3
  30. package/build/components/site-editor-routes/stylebook.cjs +17 -2
  31. package/build/components/site-editor-routes/stylebook.cjs.map +2 -2
  32. package/build/components/site-editor-routes/template-item.cjs +13 -6
  33. package/build/components/site-editor-routes/template-item.cjs.map +2 -2
  34. package/build/components/site-editor-routes/templates.cjs +20 -7
  35. package/build/components/site-editor-routes/templates.cjs.map +3 -3
  36. package/build/components/site-editor-routes/utils.cjs +7 -2
  37. package/build/components/site-editor-routes/utils.cjs.map +2 -2
  38. package/build-module/components/more-menu/site-export.mjs +1 -1
  39. package/build-module/components/more-menu/site-export.mjs.map +2 -2
  40. package/build-module/components/page-patterns/index.mjs +8 -30
  41. package/build-module/components/page-patterns/index.mjs.map +2 -2
  42. package/build-module/components/page-templates/index-legacy.mjs +14 -11
  43. package/build-module/components/page-templates/index-legacy.mjs.map +2 -2
  44. package/build-module/components/post-list/index.mjs +16 -11
  45. package/build-module/components/post-list/index.mjs.map +2 -2
  46. package/build-module/components/post-list/quick-edit-modal.mjs +16 -48
  47. package/build-module/components/post-list/quick-edit-modal.mjs.map +2 -2
  48. package/build-module/components/sidebar-dataviews/index.mjs +45 -25
  49. package/build-module/components/sidebar-dataviews/index.mjs.map +2 -2
  50. package/build-module/components/sidebar-identity/index.mjs +17 -1
  51. package/build-module/components/sidebar-identity/index.mjs.map +2 -2
  52. package/build-module/components/sidebar-navigation-screen-patterns/index.mjs +55 -47
  53. package/build-module/components/sidebar-navigation-screen-patterns/index.mjs.map +2 -2
  54. package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs +41 -59
  55. package/build-module/components/sidebar-navigation-screen-templates-browse/content-legacy.mjs.map +2 -2
  56. package/build-module/components/site-editor-routes/home.mjs +10 -6
  57. package/build-module/components/site-editor-routes/home.mjs.map +2 -2
  58. package/build-module/components/site-editor-routes/navigation-item.mjs +14 -7
  59. package/build-module/components/site-editor-routes/navigation-item.mjs.map +2 -2
  60. package/build-module/components/site-editor-routes/navigation.mjs +10 -5
  61. package/build-module/components/site-editor-routes/navigation.mjs.map +2 -2
  62. package/build-module/components/site-editor-routes/page-item.mjs +14 -7
  63. package/build-module/components/site-editor-routes/page-item.mjs.map +2 -2
  64. package/build-module/components/site-editor-routes/pages.mjs +22 -11
  65. package/build-module/components/site-editor-routes/pages.mjs.map +2 -2
  66. package/build-module/components/site-editor-routes/stylebook.mjs +18 -3
  67. package/build-module/components/site-editor-routes/stylebook.mjs.map +2 -2
  68. package/build-module/components/site-editor-routes/template-item.mjs +14 -7
  69. package/build-module/components/site-editor-routes/template-item.mjs.map +2 -2
  70. package/build-module/components/site-editor-routes/templates.mjs +21 -11
  71. package/build-module/components/site-editor-routes/templates.mjs.map +2 -2
  72. package/build-module/components/site-editor-routes/utils.mjs +5 -1
  73. package/build-module/components/site-editor-routes/utils.mjs.map +2 -2
  74. package/build-style/style-rtl.css +68 -51
  75. package/build-style/style.css +68 -51
  76. package/package.json +46 -46
  77. package/src/components/more-menu/site-export.js +1 -1
  78. package/src/components/page-patterns/index.js +9 -30
  79. package/src/components/page-templates/index-legacy.js +14 -11
  80. package/src/components/post-list/index.js +16 -10
  81. package/src/components/post-list/quick-edit-modal.js +19 -54
  82. package/src/components/post-list/style.scss +2 -0
  83. package/src/components/sidebar-dataviews/index.js +48 -26
  84. package/src/components/sidebar-dataviews/style.scss +0 -16
  85. package/src/components/sidebar-identity/index.js +17 -1
  86. package/src/components/sidebar-navigation-screen-patterns/index.js +62 -55
  87. package/src/components/sidebar-navigation-screen-templates-browse/content-legacy.js +44 -64
  88. package/src/components/site-editor-routes/home.js +9 -5
  89. package/src/components/site-editor-routes/navigation-item.js +13 -6
  90. package/src/components/site-editor-routes/navigation.js +9 -4
  91. package/src/components/site-editor-routes/page-item.js +13 -6
  92. package/src/components/site-editor-routes/pages.js +21 -10
  93. package/src/components/site-editor-routes/stylebook.js +12 -3
  94. package/src/components/site-editor-routes/template-item.js +13 -6
  95. package/src/components/site-editor-routes/templates.js +21 -10
  96. package/src/components/site-editor-routes/utils.js +12 -0
  97. package/build/components/post-list/view-utils.cjs +0 -202
  98. package/build/components/post-list/view-utils.cjs.map +0 -7
  99. package/build/components/sidebar-dataviews/dataview-item.cjs +0 -82
  100. package/build/components/sidebar-dataviews/dataview-item.cjs.map +0 -7
  101. package/build-module/components/post-list/view-utils.mjs +0 -182
  102. package/build-module/components/post-list/view-utils.mjs.map +0 -7
  103. package/build-module/components/sidebar-dataviews/dataview-item.mjs +0 -51
  104. package/build-module/components/sidebar-dataviews/dataview-item.mjs.map +0 -7
  105. package/src/components/post-list/view-utils.js +0 -187
  106. package/src/components/sidebar-dataviews/dataview-item.js +0 -56
@@ -10,14 +10,17 @@ import Editor from '../editor';
10
10
  import DataViewsSidebarContent from '../sidebar-dataviews';
11
11
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
12
12
  import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
13
+ import { isThemeDataLoaded } from './utils';
13
14
 
14
15
  export const pageItemRoute = {
15
16
  name: 'page-item',
16
17
  path: '/page/:postId',
17
18
  areas: {
18
19
  sidebar( { siteData } ) {
19
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
20
- return isBlockTheme ? (
20
+ if ( ! isThemeDataLoaded( siteData ) ) {
21
+ return null;
22
+ }
23
+ return siteData.currentTheme.is_block_theme ? (
21
24
  <SidebarNavigationScreen
22
25
  title={ __( 'Pages' ) }
23
26
  backPath="/"
@@ -28,16 +31,20 @@ export const pageItemRoute = {
28
31
  );
29
32
  },
30
33
  mobile( { siteData } ) {
31
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
32
- return isBlockTheme ? (
34
+ if ( ! isThemeDataLoaded( siteData ) ) {
35
+ return <></>;
36
+ }
37
+ return siteData.currentTheme.is_block_theme ? (
33
38
  <Editor />
34
39
  ) : (
35
40
  <SidebarNavigationScreenUnsupported />
36
41
  );
37
42
  },
38
43
  preview( { siteData } ) {
39
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
40
- return isBlockTheme ? (
44
+ if ( ! isThemeDataLoaded( siteData ) ) {
45
+ return null;
46
+ }
47
+ return siteData.currentTheme.is_block_theme ? (
41
48
  <Editor />
42
49
  ) : (
43
50
  <SidebarNavigationScreenUnsupported />
@@ -3,6 +3,8 @@
3
3
  */
4
4
  import { privateApis as routerPrivateApis } from '@wordpress/router';
5
5
  import { __ } from '@wordpress/i18n';
6
+ import { resolveSelect } from '@wordpress/data';
7
+ import { store as coreStore } from '@wordpress/core-data';
6
8
  import { loadView } from '@wordpress/views';
7
9
 
8
10
  /**
@@ -14,21 +16,26 @@ import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-uns
14
16
  import DataViewsSidebarContent from '../sidebar-dataviews';
15
17
  import PostList from '../post-list';
16
18
  import { unlock } from '../../lock-unlock';
17
- import {
18
- DEFAULT_VIEW,
19
- getActiveViewOverridesForTab,
20
- } from '../post-list/view-utils';
19
+ import { isThemeDataLoaded } from './utils';
21
20
 
22
21
  const { useLocation } = unlock( routerPrivateApis );
23
22
 
24
23
  async function isListView( query ) {
25
24
  const { activeView = 'all' } = query;
25
+ const config = await unlock( resolveSelect( coreStore ) ).getViewConfig(
26
+ 'postType',
27
+ 'page'
28
+ );
29
+ const defaultView = config?.default_view;
30
+ const defaultLayouts = config?.default_layouts;
31
+ const viewEntry = config?.view_list?.find( ( v ) => v.slug === activeView );
26
32
  const view = await loadView( {
27
33
  kind: 'postType',
28
34
  name: 'page',
29
35
  slug: 'default',
30
- defaultView: DEFAULT_VIEW,
31
- activeViewOverrides: getActiveViewOverridesForTab( activeView ),
36
+ defaultView,
37
+ defaultLayouts,
38
+ activeViewOverrides: viewEntry?.view ?? {},
32
39
  } );
33
40
  return view.type === 'list';
34
41
  }
@@ -45,8 +52,10 @@ export const pagesRoute = {
45
52
  path: '/page',
46
53
  areas: {
47
54
  sidebar( { siteData } ) {
48
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
49
- return isBlockTheme ? (
55
+ if ( ! isThemeDataLoaded( siteData ) ) {
56
+ return null;
57
+ }
58
+ return siteData.currentTheme.is_block_theme ? (
50
59
  <SidebarNavigationScreen
51
60
  title={ __( 'Pages' ) }
52
61
  backPath="/"
@@ -69,8 +78,10 @@ export const pagesRoute = {
69
78
  return isList ? <Editor /> : undefined;
70
79
  },
71
80
  mobile( { siteData } ) {
72
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
73
- return isBlockTheme ? (
81
+ if ( ! isThemeDataLoaded( siteData ) ) {
82
+ return <></>;
83
+ }
84
+ return siteData.currentTheme.is_block_theme ? (
74
85
  <MobilePagesView />
75
86
  ) : (
76
87
  <SidebarNavigationScreenUnsupported />
@@ -10,7 +10,7 @@ import { privateApis as editorPrivateApis } from '@wordpress/editor';
10
10
  import SidebarNavigationScreen from '../sidebar-navigation-screen';
11
11
  import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
12
12
  import { unlock } from '../../lock-unlock';
13
- import { isClassicThemeWithStyleBookSupport } from './utils';
13
+ import { isClassicThemeWithStyleBookSupport, isThemeDataLoaded } from './utils';
14
14
 
15
15
  const { StyleBookPreview } = unlock( editorPrivateApis );
16
16
 
@@ -19,6 +19,9 @@ export const stylebookRoute = {
19
19
  path: '/stylebook',
20
20
  areas: {
21
21
  sidebar( { siteData } ) {
22
+ if ( ! isThemeDataLoaded( siteData ) ) {
23
+ return null;
24
+ }
22
25
  return isClassicThemeWithStyleBookSupport( siteData ) ? (
23
26
  <SidebarNavigationScreen
24
27
  title={ __( 'Styles' ) }
@@ -33,12 +36,18 @@ export const stylebookRoute = {
33
36
  },
34
37
  preview( { siteData } ) {
35
38
  return isClassicThemeWithStyleBookSupport( siteData ) ? (
36
- <StyleBookPreview isStatic />
39
+ <StyleBookPreview
40
+ isStatic
41
+ settings={ siteData.editorSettings }
42
+ />
37
43
  ) : undefined;
38
44
  },
39
45
  mobile( { siteData } ) {
40
46
  return isClassicThemeWithStyleBookSupport( siteData ) ? (
41
- <StyleBookPreview isStatic />
47
+ <StyleBookPreview
48
+ isStatic
49
+ settings={ siteData.editorSettings }
50
+ />
42
51
  ) : undefined;
43
52
  },
44
53
  },
@@ -4,27 +4,34 @@
4
4
  import Editor from '../editor';
5
5
  import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
6
6
  import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
7
+ import { isThemeDataLoaded } from './utils';
7
8
 
8
9
  const areas = {
9
10
  sidebar( { siteData } ) {
10
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
11
- return isBlockTheme ? (
11
+ if ( ! isThemeDataLoaded( siteData ) ) {
12
+ return null;
13
+ }
14
+ return siteData.currentTheme.is_block_theme ? (
12
15
  <SidebarNavigationScreenTemplatesBrowse backPath="/" />
13
16
  ) : (
14
17
  <SidebarNavigationScreenUnsupported />
15
18
  );
16
19
  },
17
20
  mobile( { siteData } ) {
18
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
19
- return isBlockTheme ? (
21
+ if ( ! isThemeDataLoaded( siteData ) ) {
22
+ return <></>;
23
+ }
24
+ return siteData.currentTheme.is_block_theme ? (
20
25
  <Editor />
21
26
  ) : (
22
27
  <SidebarNavigationScreenUnsupported />
23
28
  );
24
29
  },
25
30
  preview( { siteData } ) {
26
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
27
- return isBlockTheme ? (
31
+ if ( ! isThemeDataLoaded( siteData ) ) {
32
+ return null;
33
+ }
34
+ return siteData.currentTheme.is_block_theme ? (
28
35
  <Editor />
29
36
  ) : (
30
37
  <SidebarNavigationScreenUnsupported />
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
+ import { resolveSelect } from '@wordpress/data';
5
+ import { store as coreStore } from '@wordpress/core-data';
4
6
  import { loadView } from '@wordpress/views';
5
7
 
6
8
  /**
@@ -11,19 +13,24 @@ import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen
11
13
  import SidebarNavigationScreenUnsupported from '../sidebar-navigation-screen-unsupported';
12
14
  import PageTemplates from '../page-templates';
13
15
  import PageTemplatesLegacy from '../page-templates/index-legacy';
14
- import {
15
- DEFAULT_VIEW,
16
- getActiveViewOverridesForTab,
17
- } from '../page-templates/view-utils';
16
+ import { unlock } from '../../lock-unlock';
17
+ import { isThemeDataLoaded } from './utils';
18
18
 
19
19
  async function isTemplateListView( query ) {
20
20
  const { activeView = 'active' } = query;
21
+ const config = await unlock( resolveSelect( coreStore ) ).getViewConfig(
22
+ 'postType',
23
+ 'wp_template'
24
+ );
25
+ const defaultView = config?.default_view;
26
+ const activeViewOverrides =
27
+ config?.view_list?.find( ( v ) => v.slug === activeView )?.view ?? {};
21
28
  const view = await loadView( {
22
29
  kind: 'postType',
23
30
  name: 'wp_template',
24
31
  slug: 'default',
25
- defaultView: DEFAULT_VIEW,
26
- activeViewOverrides: getActiveViewOverridesForTab( activeView ),
32
+ defaultView,
33
+ activeViewOverrides,
27
34
  } );
28
35
  return view.type === 'list';
29
36
  }
@@ -33,8 +40,10 @@ export const templatesRoute = {
33
40
  path: '/template',
34
41
  areas: {
35
42
  sidebar( { siteData } ) {
36
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
37
- return isBlockTheme ? (
43
+ if ( ! isThemeDataLoaded( siteData ) ) {
44
+ return null;
45
+ }
46
+ return siteData.currentTheme.is_block_theme ? (
38
47
  <SidebarNavigationScreenTemplatesBrowse backPath="/" />
39
48
  ) : (
40
49
  <SidebarNavigationScreenUnsupported />
@@ -62,8 +71,10 @@ export const templatesRoute = {
62
71
  return isListView ? <Editor /> : undefined;
63
72
  },
64
73
  mobile( { siteData } ) {
65
- const isBlockTheme = siteData.currentTheme?.is_block_theme;
66
- if ( ! isBlockTheme ) {
74
+ if ( ! isThemeDataLoaded( siteData ) ) {
75
+ return <></>;
76
+ }
77
+ if ( ! siteData.currentTheme.is_block_theme ) {
67
78
  return <SidebarNavigationScreenUnsupported />;
68
79
  }
69
80
  // Check if the template activation experiment is enabled.
@@ -1,3 +1,15 @@
1
+ /**
2
+ * Check if the current theme data has been loaded from the REST API.
3
+ *
4
+ * @param {Object} siteData - The site data provided by the site editor route area resolvers.
5
+ * @return {boolean} True if the theme data is available, false otherwise.
6
+ */
7
+ export function isThemeDataLoaded( siteData ) {
8
+ return (
9
+ siteData.currentTheme !== undefined && siteData.currentTheme !== null
10
+ );
11
+ }
12
+
1
13
  /**
2
14
  * Check if the classic theme supports the stylebook.
3
15
  *
@@ -1,202 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/edit-site/src/components/post-list/view-utils.js
21
- var view_utils_exports = {};
22
- __export(view_utils_exports, {
23
- DEFAULT_VIEW: () => DEFAULT_VIEW,
24
- defaultLayouts: () => defaultLayouts,
25
- getActiveViewOverridesForTab: () => getActiveViewOverridesForTab,
26
- getDefaultViews: () => getDefaultViews
27
- });
28
- module.exports = __toCommonJS(view_utils_exports);
29
- var import_i18n = require("@wordpress/i18n");
30
- var import_icons = require("@wordpress/icons");
31
- var import_constants = require("../../utils/constants.cjs");
32
- var defaultLayouts = {
33
- table: {
34
- layout: {
35
- styles: {
36
- author: {
37
- align: "start"
38
- }
39
- }
40
- }
41
- },
42
- grid: {},
43
- list: {}
44
- };
45
- var DEFAULT_VIEW = {
46
- type: "list",
47
- filters: [],
48
- perPage: 20,
49
- sort: {
50
- field: "title",
51
- direction: "asc"
52
- },
53
- showLevels: true,
54
- titleField: "title",
55
- mediaField: "featured_media",
56
- fields: ["author", "status"],
57
- ...defaultLayouts.list
58
- };
59
- function getDefaultViews(postType) {
60
- return [
61
- {
62
- title: postType?.labels?.all_items || (0, import_i18n.__)("All items"),
63
- slug: "all",
64
- icon: import_icons.pages,
65
- view: DEFAULT_VIEW
66
- },
67
- {
68
- title: (0, import_i18n.__)("Published"),
69
- slug: "published",
70
- icon: import_icons.published,
71
- view: {
72
- ...DEFAULT_VIEW,
73
- filters: [
74
- {
75
- field: "status",
76
- operator: import_constants.OPERATOR_IS_ANY,
77
- value: "publish",
78
- isLocked: true
79
- }
80
- ]
81
- }
82
- },
83
- {
84
- title: (0, import_i18n.__)("Scheduled"),
85
- slug: "future",
86
- icon: import_icons.scheduled,
87
- view: {
88
- ...DEFAULT_VIEW,
89
- filters: [
90
- {
91
- field: "status",
92
- operator: import_constants.OPERATOR_IS_ANY,
93
- value: "future",
94
- isLocked: true
95
- }
96
- ]
97
- }
98
- },
99
- {
100
- title: (0, import_i18n.__)("Drafts"),
101
- slug: "drafts",
102
- icon: import_icons.drafts,
103
- view: {
104
- ...DEFAULT_VIEW,
105
- filters: [
106
- {
107
- field: "status",
108
- operator: import_constants.OPERATOR_IS_ANY,
109
- value: "draft",
110
- isLocked: true
111
- }
112
- ]
113
- }
114
- },
115
- {
116
- title: (0, import_i18n.__)("Pending"),
117
- slug: "pending",
118
- icon: import_icons.pending,
119
- view: {
120
- ...DEFAULT_VIEW,
121
- filters: [
122
- {
123
- field: "status",
124
- operator: import_constants.OPERATOR_IS_ANY,
125
- value: "pending",
126
- isLocked: true
127
- }
128
- ]
129
- }
130
- },
131
- {
132
- title: (0, import_i18n.__)("Private"),
133
- slug: "private",
134
- icon: import_icons.notAllowed,
135
- view: {
136
- ...DEFAULT_VIEW,
137
- filters: [
138
- {
139
- field: "status",
140
- operator: import_constants.OPERATOR_IS_ANY,
141
- value: "private",
142
- isLocked: true
143
- }
144
- ]
145
- }
146
- },
147
- {
148
- title: (0, import_i18n.__)("Trash"),
149
- slug: "trash",
150
- icon: import_icons.trash,
151
- view: {
152
- ...DEFAULT_VIEW,
153
- type: "table",
154
- layout: defaultLayouts.table.layout,
155
- filters: [
156
- {
157
- field: "status",
158
- operator: import_constants.OPERATOR_IS_ANY,
159
- value: "trash",
160
- isLocked: true
161
- }
162
- ]
163
- }
164
- }
165
- ];
166
- }
167
- var SLUG_TO_STATUS = {
168
- published: "publish",
169
- future: "future",
170
- drafts: "draft",
171
- pending: "pending",
172
- private: "private",
173
- trash: "trash"
174
- };
175
- function getActiveViewOverridesForTab(activeView) {
176
- const base = {
177
- ...defaultLayouts.table
178
- };
179
- const status = SLUG_TO_STATUS[activeView];
180
- if (!status) {
181
- return base;
182
- }
183
- return {
184
- ...base,
185
- filters: [
186
- {
187
- field: "status",
188
- operator: import_constants.OPERATOR_IS_ANY,
189
- value: status,
190
- isLocked: true
191
- }
192
- ]
193
- };
194
- }
195
- // Annotate the CommonJS export names for ESM import in node:
196
- 0 && (module.exports = {
197
- DEFAULT_VIEW,
198
- defaultLayouts,
199
- getActiveViewOverridesForTab,
200
- getDefaultViews
201
- });
202
- //# sourceMappingURL=view-utils.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/post-list/view-utils.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\nimport {\n\ttrash,\n\tpages,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { OPERATOR_IS_ANY } from '../../utils/constants';\n\nexport const defaultLayouts = {\n\ttable: {\n\t\tlayout: {\n\t\t\tstyles: {\n\t\t\t\tauthor: {\n\t\t\t\t\talign: 'start',\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\tgrid: {},\n\tlist: {},\n};\n\nexport const DEFAULT_VIEW = {\n\ttype: 'list',\n\tfilters: [],\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'title',\n\t\tdirection: 'asc',\n\t},\n\tshowLevels: true,\n\ttitleField: 'title',\n\tmediaField: 'featured_media',\n\tfields: [ 'author', 'status' ],\n\t...defaultLayouts.list,\n};\n\nexport function getDefaultViews( postType ) {\n\treturn [\n\t\t{\n\t\t\ttitle: postType?.labels?.all_items || __( 'All items' ),\n\t\t\tslug: 'all',\n\t\t\ticon: pages,\n\t\t\tview: DEFAULT_VIEW,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Published' ),\n\t\t\tslug: 'published',\n\t\t\ticon: published,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'publish',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Scheduled' ),\n\t\t\tslug: 'future',\n\t\t\ticon: scheduled,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'future',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\ticon: drafts,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Pending' ),\n\t\t\tslug: 'pending',\n\t\t\ticon: pending,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'pending',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Private' ),\n\t\t\tslug: 'private',\n\t\t\ticon: notAllowed,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'private',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_VIEW,\n\t\t\t\ttype: 'table',\n\t\t\t\tlayout: defaultLayouts.table.layout,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'trash',\n\t\t\t\t\t\tisLocked: true,\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t];\n}\n\nconst SLUG_TO_STATUS = {\n\tpublished: 'publish',\n\tfuture: 'future',\n\tdrafts: 'draft',\n\tpending: 'pending',\n\tprivate: 'private',\n\ttrash: 'trash',\n};\n\nexport function getActiveViewOverridesForTab( activeView ) {\n\tconst base = {\n\t\t...defaultLayouts.table,\n\t};\n\tconst status = SLUG_TO_STATUS[ activeView ];\n\tif ( ! status ) {\n\t\treturn base;\n\t}\n\treturn {\n\t\t...base,\n\t\tfilters: [\n\t\t\t{\n\t\t\t\tfield: 'status',\n\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\tvalue: status,\n\t\t\t\tisLocked: true,\n\t\t\t},\n\t\t],\n\t};\n}\n"],
5
- "mappings": "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",
6
- "names": []
7
- }
@@ -1,82 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
-
30
- // packages/edit-site/src/components/sidebar-dataviews/dataview-item.js
31
- var dataview_item_exports = {};
32
- __export(dataview_item_exports, {
33
- default: () => DataViewItem
34
- });
35
- module.exports = __toCommonJS(dataview_item_exports);
36
- var import_clsx = __toESM(require("clsx"));
37
- var import_router = require("@wordpress/router");
38
- var import_components = require("@wordpress/components");
39
- var import_dataviews = require("@wordpress/dataviews");
40
- var import_url = require("@wordpress/url");
41
- var import_sidebar_navigation_item = __toESM(require("../sidebar-navigation-item/index.cjs"));
42
- var import_lock_unlock = require("../../lock-unlock.cjs");
43
- var import_jsx_runtime = require("react/jsx-runtime");
44
- var { useLocation } = (0, import_lock_unlock.unlock)(import_router.privateApis);
45
- function DataViewItem({
46
- title,
47
- slug,
48
- type,
49
- icon,
50
- isActive,
51
- suffix
52
- }) {
53
- const { path } = useLocation();
54
- const iconToUse = icon || import_dataviews.VIEW_LAYOUTS.find((v) => v.type === type).icon;
55
- if (slug === "all") {
56
- slug = void 0;
57
- }
58
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
59
- import_components.__experimentalHStack,
60
- {
61
- justify: "flex-start",
62
- className: (0, import_clsx.default)("edit-site-sidebar-dataviews-dataview-item", {
63
- "is-selected": isActive
64
- }),
65
- children: [
66
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
67
- import_sidebar_navigation_item.default,
68
- {
69
- icon: iconToUse,
70
- to: (0, import_url.addQueryArgs)(path, {
71
- activeView: slug
72
- }),
73
- "aria-current": isActive ? "true" : void 0,
74
- children: title
75
- }
76
- ),
77
- suffix
78
- ]
79
- }
80
- );
81
- }
82
- //# sourceMappingURL=dataview-item.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../../src/components/sidebar-dataviews/dataview-item.js"],
4
- "sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { VIEW_LAYOUTS } from '@wordpress/dataviews';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationItem from '../sidebar-navigation-item';\nimport { unlock } from '../../lock-unlock';\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function DataViewItem( {\n\ttitle,\n\tslug,\n\ttype,\n\ticon,\n\tisActive,\n\tsuffix,\n} ) {\n\tconst { path } = useLocation();\n\n\tconst iconToUse =\n\t\ticon || VIEW_LAYOUTS.find( ( v ) => v.type === type ).icon;\n\n\tif ( slug === 'all' ) {\n\t\tslug = undefined;\n\t}\n\treturn (\n\t\t<HStack\n\t\t\tjustify=\"flex-start\"\n\t\t\tclassName={ clsx( 'edit-site-sidebar-dataviews-dataview-item', {\n\t\t\t\t'is-selected': isActive,\n\t\t\t} ) }\n\t\t>\n\t\t\t<SidebarNavigationItem\n\t\t\t\ticon={ iconToUse }\n\t\t\t\tto={ addQueryArgs( path, {\n\t\t\t\t\tactiveView: slug,\n\t\t\t\t} ) }\n\t\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t\t>\n\t\t\t\t{ title }\n\t\t\t</SidebarNavigationItem>\n\t\t\t{ suffix }\n\t\t</HStack>\n\t);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,oBAAiD;AACjD,wBAA+C;AAC/C,uBAA6B;AAC7B,iBAA6B;AAK7B,qCAAkC;AAClC,yBAAuB;AAoBrB;AAnBF,IAAM,EAAE,YAAY,QAAI,2BAAQ,cAAAA,WAAkB;AAEnC,SAAR,aAA+B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,QAAM,EAAE,KAAK,IAAI,YAAY;AAE7B,QAAM,YACL,QAAQ,8BAAa,KAAM,CAAE,MAAO,EAAE,SAAS,IAAK,EAAE;AAEvD,MAAK,SAAS,OAAQ;AACrB,WAAO;AAAA,EACR;AACA,SACC;AAAA,IAAC,kBAAAC;AAAA,IAAA;AAAA,MACA,SAAQ;AAAA,MACR,eAAY,YAAAC,SAAM,6CAA6C;AAAA,QAC9D,eAAe;AAAA,MAChB,CAAE;AAAA,MAEF;AAAA;AAAA,UAAC,+BAAAC;AAAA,UAAA;AAAA,YACA,MAAO;AAAA,YACP,QAAK,yBAAc,MAAM;AAAA,cACxB,YAAY;AAAA,YACb,CAAE;AAAA,YACF,gBAAe,WAAW,SAAS;AAAA,YAEjC;AAAA;AAAA,QACH;AAAA,QACE;AAAA;AAAA;AAAA,EACH;AAEF;",
6
- "names": ["routerPrivateApis", "HStack", "clsx", "SidebarNavigationItem"]
7
- }