@wordpress/edit-site 6.7.1-next.5368f64a9.0 → 6.8.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 (113) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/editor/index.js +1 -5
  3. package/build/components/editor/index.js.map +1 -1
  4. package/build/components/editor-canvas-container/index.js +6 -17
  5. package/build/components/editor-canvas-container/index.js.map +1 -1
  6. package/build/components/global-styles/font-library-modal/font-card.js +2 -4
  7. package/build/components/global-styles/font-library-modal/font-card.js.map +1 -1
  8. package/build/components/global-styles/font-library-modal/font-collection.js +2 -4
  9. package/build/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  10. package/build/components/global-styles/font-library-modal/index.js +28 -28
  11. package/build/components/global-styles/font-library-modal/index.js.map +1 -1
  12. package/build/components/global-styles/font-library-modal/installed-fonts.js +4 -8
  13. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  14. package/build/components/global-styles/font-library-modal/upload-fonts.js +2 -4
  15. package/build/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  16. package/build/components/global-styles/palette.js +2 -4
  17. package/build/components/global-styles/palette.js.map +1 -1
  18. package/build/components/global-styles/root-menu.js +12 -1
  19. package/build/components/global-styles/root-menu.js.map +1 -1
  20. package/build/components/global-styles/screen-background.js +40 -0
  21. package/build/components/global-styles/screen-background.js.map +1 -0
  22. package/build/components/global-styles/screen-layout.js +1 -8
  23. package/build/components/global-styles/screen-layout.js.map +1 -1
  24. package/build/components/global-styles/screen-revisions/revisions-buttons.js +2 -4
  25. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  26. package/build/components/global-styles/screen-root.js +3 -0
  27. package/build/components/global-styles/screen-root.js.map +1 -1
  28. package/build/components/global-styles/shadows-edit-panel.js +14 -58
  29. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  30. package/build/components/global-styles/ui.js +4 -0
  31. package/build/components/global-styles/ui.js.map +1 -1
  32. package/build/components/post-list/index.js +35 -2
  33. package/build/components/post-list/index.js.map +1 -1
  34. package/build/components/sidebar-dataviews/dataview-item.js +3 -1
  35. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  36. package/build/components/sidebar-dataviews/default-views.js +79 -47
  37. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  38. package/build/components/sidebar-dataviews/index.js +4 -1
  39. package/build/components/sidebar-dataviews/index.js.map +1 -1
  40. package/build/hooks/push-changes-to-global-styles/index.js +1 -0
  41. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  42. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +1 -0
  43. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  44. package/build-module/components/editor/index.js +2 -6
  45. package/build-module/components/editor/index.js.map +1 -1
  46. package/build-module/components/editor-canvas-container/index.js +7 -18
  47. package/build-module/components/editor-canvas-container/index.js.map +1 -1
  48. package/build-module/components/global-styles/font-library-modal/font-card.js +2 -4
  49. package/build-module/components/global-styles/font-library-modal/font-card.js.map +1 -1
  50. package/build-module/components/global-styles/font-library-modal/font-collection.js +2 -4
  51. package/build-module/components/global-styles/font-library-modal/font-collection.js.map +1 -1
  52. package/build-module/components/global-styles/font-library-modal/index.js +28 -28
  53. package/build-module/components/global-styles/font-library-modal/index.js.map +1 -1
  54. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +4 -8
  55. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  56. package/build-module/components/global-styles/font-library-modal/upload-fonts.js +2 -4
  57. package/build-module/components/global-styles/font-library-modal/upload-fonts.js.map +1 -1
  58. package/build-module/components/global-styles/palette.js +2 -4
  59. package/build-module/components/global-styles/palette.js.map +1 -1
  60. package/build-module/components/global-styles/root-menu.js +13 -2
  61. package/build-module/components/global-styles/root-menu.js.map +1 -1
  62. package/build-module/components/global-styles/screen-background.js +34 -0
  63. package/build-module/components/global-styles/screen-background.js.map +1 -0
  64. package/build-module/components/global-styles/screen-layout.js +1 -8
  65. package/build-module/components/global-styles/screen-layout.js.map +1 -1
  66. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +2 -4
  67. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  68. package/build-module/components/global-styles/screen-root.js +3 -0
  69. package/build-module/components/global-styles/screen-root.js.map +1 -1
  70. package/build-module/components/global-styles/shadows-edit-panel.js +17 -61
  71. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  72. package/build-module/components/global-styles/ui.js +4 -0
  73. package/build-module/components/global-styles/ui.js.map +1 -1
  74. package/build-module/components/post-list/index.js +35 -2
  75. package/build-module/components/post-list/index.js.map +1 -1
  76. package/build-module/components/sidebar-dataviews/dataview-item.js +3 -1
  77. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  78. package/build-module/components/sidebar-dataviews/default-views.js +79 -48
  79. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  80. package/build-module/components/sidebar-dataviews/index.js +5 -2
  81. package/build-module/components/sidebar-dataviews/index.js.map +1 -1
  82. package/build-module/hooks/push-changes-to-global-styles/index.js +1 -0
  83. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  84. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +1 -0
  85. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  86. package/build-style/posts-rtl.css +5 -5
  87. package/build-style/posts.css +5 -5
  88. package/build-style/style-rtl.css +15 -19
  89. package/build-style/style.css +15 -19
  90. package/package.json +41 -41
  91. package/src/components/editor/index.js +2 -4
  92. package/src/components/editor-canvas-container/index.js +7 -18
  93. package/src/components/global-styles/font-library-modal/font-card.js +1 -2
  94. package/src/components/global-styles/font-library-modal/font-collection.js +1 -2
  95. package/src/components/global-styles/font-library-modal/index.js +26 -26
  96. package/src/components/global-styles/font-library-modal/installed-fonts.js +2 -4
  97. package/src/components/global-styles/font-library-modal/style.scss +19 -12
  98. package/src/components/global-styles/font-library-modal/upload-fonts.js +1 -2
  99. package/src/components/global-styles/palette.js +1 -2
  100. package/src/components/global-styles/root-menu.js +16 -0
  101. package/src/components/global-styles/screen-background.js +37 -0
  102. package/src/components/global-styles/screen-layout.js +3 -13
  103. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -2
  104. package/src/components/global-styles/screen-root.js +7 -3
  105. package/src/components/global-styles/shadows-edit-panel.js +11 -70
  106. package/src/components/global-styles/style.scss +8 -0
  107. package/src/components/global-styles/ui.js +5 -0
  108. package/src/components/post-list/index.js +48 -2
  109. package/src/components/sidebar-dataviews/dataview-item.js +2 -0
  110. package/src/components/sidebar-dataviews/default-views.js +92 -58
  111. package/src/components/sidebar-dataviews/index.js +7 -2
  112. package/src/components/sidebar-dataviews/style.scss +4 -0
  113. package/src/style.scss +0 -16
@@ -4,7 +4,7 @@
4
4
  import { __ } from '@wordpress/i18n';
5
5
  import { trash, pages, drafts, published, scheduled, pending, notAllowed } from '@wordpress/icons';
6
6
  import { useSelect } from '@wordpress/data';
7
- import { store as coreStore } from '@wordpress/core-data';
7
+ import { store as coreStore, useEntityRecords } from '@wordpress/core-data';
8
8
  import { useMemo } from '@wordpress/element';
9
9
 
10
10
  /**
@@ -51,6 +51,47 @@ const DEFAULT_POST_BASE = {
51
51
  fields: ['title', 'author', 'status'],
52
52
  layout: defaultLayouts[LAYOUT_LIST].layout
53
53
  };
54
+ export function useDefaultViewsWithItemCounts({
55
+ postType
56
+ }) {
57
+ const defaultViews = useDefaultViews({
58
+ postType
59
+ });
60
+ const {
61
+ records,
62
+ totalItems
63
+ } = useEntityRecords('postType', postType, {
64
+ per_page: -1,
65
+ status: ['any', 'trash']
66
+ });
67
+ return useMemo(() => {
68
+ if (!defaultViews) {
69
+ return [];
70
+ }
71
+
72
+ // If there are no records, return the default views with no counts.
73
+ if (!records) {
74
+ return defaultViews;
75
+ }
76
+ const counts = {
77
+ drafts: records.filter(record => record.status === 'draft').length,
78
+ future: records.filter(record => record.status === 'future').length,
79
+ pending: records.filter(record => record.status === 'pending').length,
80
+ private: records.filter(record => record.status === 'private').length,
81
+ published: records.filter(record => record.status === 'publish').length,
82
+ trash: records.filter(record => record.status === 'trash').length
83
+ };
84
+
85
+ // All items excluding trashed items as per the default "all" status query.
86
+ counts.all = totalItems ? totalItems - counts.trash : 0;
87
+
88
+ // Filter out views with > 0 item counts.
89
+ return defaultViews.map(_view => {
90
+ _view.count = counts[_view.slug];
91
+ return _view;
92
+ });
93
+ }, [defaultViews, records, totalItems]);
94
+ }
54
95
  export function useDefaultViews({
55
96
  postType
56
97
  }) {
@@ -70,62 +111,52 @@ export function useDefaultViews({
70
111
  title: __('Published'),
71
112
  slug: 'published',
72
113
  icon: published,
73
- view: {
74
- ...DEFAULT_POST_BASE,
75
- filters: [{
76
- field: 'status',
77
- operator: OPERATOR_IS_ANY,
78
- value: 'publish'
79
- }]
80
- }
114
+ view: DEFAULT_POST_BASE,
115
+ filters: [{
116
+ field: 'status',
117
+ operator: OPERATOR_IS_ANY,
118
+ value: 'publish'
119
+ }]
81
120
  }, {
82
121
  title: __('Scheduled'),
83
122
  slug: 'future',
84
123
  icon: scheduled,
85
- view: {
86
- ...DEFAULT_POST_BASE,
87
- filters: [{
88
- field: 'status',
89
- operator: OPERATOR_IS_ANY,
90
- value: 'future'
91
- }]
92
- }
124
+ view: DEFAULT_POST_BASE,
125
+ filters: [{
126
+ field: 'status',
127
+ operator: OPERATOR_IS_ANY,
128
+ value: 'future'
129
+ }]
93
130
  }, {
94
131
  title: __('Drafts'),
95
132
  slug: 'drafts',
96
133
  icon: drafts,
97
- view: {
98
- ...DEFAULT_POST_BASE,
99
- filters: [{
100
- field: 'status',
101
- operator: OPERATOR_IS_ANY,
102
- value: 'draft'
103
- }]
104
- }
134
+ view: DEFAULT_POST_BASE,
135
+ filters: [{
136
+ field: 'status',
137
+ operator: OPERATOR_IS_ANY,
138
+ value: 'draft'
139
+ }]
105
140
  }, {
106
141
  title: __('Pending'),
107
142
  slug: 'pending',
108
143
  icon: pending,
109
- view: {
110
- ...DEFAULT_POST_BASE,
111
- filters: [{
112
- field: 'status',
113
- operator: OPERATOR_IS_ANY,
114
- value: 'pending'
115
- }]
116
- }
144
+ view: DEFAULT_POST_BASE,
145
+ filters: [{
146
+ field: 'status',
147
+ operator: OPERATOR_IS_ANY,
148
+ value: 'pending'
149
+ }]
117
150
  }, {
118
151
  title: __('Private'),
119
152
  slug: 'private',
120
153
  icon: notAllowed,
121
- view: {
122
- ...DEFAULT_POST_BASE,
123
- filters: [{
124
- field: 'status',
125
- operator: OPERATOR_IS_ANY,
126
- value: 'private'
127
- }]
128
- }
154
+ view: DEFAULT_POST_BASE,
155
+ filters: [{
156
+ field: 'status',
157
+ operator: OPERATOR_IS_ANY,
158
+ value: 'private'
159
+ }]
129
160
  }, {
130
161
  title: __('Trash'),
131
162
  slug: 'trash',
@@ -133,13 +164,13 @@ export function useDefaultViews({
133
164
  view: {
134
165
  ...DEFAULT_POST_BASE,
135
166
  type: LAYOUT_TABLE,
136
- layout: defaultLayouts[LAYOUT_TABLE].layout,
137
- filters: [{
138
- field: 'status',
139
- operator: OPERATOR_IS_ANY,
140
- value: 'trash'
141
- }]
142
- }
167
+ layout: defaultLayouts[LAYOUT_TABLE].layout
168
+ },
169
+ filters: [{
170
+ field: 'status',
171
+ operator: OPERATOR_IS_ANY,
172
+ value: 'trash'
173
+ }]
143
174
  }];
144
175
  }, [labels]);
145
176
  }
@@ -1 +1 @@
1
- {"version":3,"names":["__","trash","pages","drafts","published","scheduled","pending","notAllowed","useSelect","store","coreStore","useMemo","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","defaultLayouts","layout","primaryField","styles","width","title","maxWidth","mediaField","DEFAULT_POST_BASE","type","search","filters","page","perPage","sort","field","direction","fields","useDefaultViews","postType","labels","select","getPostType","all_items","slug","icon","view","operator","value"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"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';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tstyles: {\n\t\t\t\t'featured-image': {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t\ttitle: {\n\t\t\t\t\tmaxWidth: 300,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tlayout: {\n\t\t\tmediaField: 'featured-image',\n\t\t\tprimaryField: 'title',\n\t\t},\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tmediaField: 'featured-image',\n\t\t},\n\t},\n};\n\nconst DEFAULT_POST_BASE = {\n\ttype: LAYOUT_LIST,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\tfields: [ 'title', 'author', 'status' ],\n\tlayout: defaultLayouts[ LAYOUT_LIST ].layout,\n};\n\nexport function useDefaultViews( { postType } ) {\n\tconst labels = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\treturn getPostType( postType )?.labels;\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: labels?.all_items || __( 'All items' ),\n\t\t\t\tslug: 'all',\n\t\t\t\ticon: pages,\n\t\t\t\tview: DEFAULT_POST_BASE,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Published' ),\n\t\t\t\tslug: 'published',\n\t\t\t\ticon: published,\n\t\t\t\tview: {\n\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\tfilters: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\tvalue: 'publish',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Scheduled' ),\n\t\t\t\tslug: 'future',\n\t\t\t\ticon: scheduled,\n\t\t\t\tview: {\n\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\tfilters: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\tvalue: 'future',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Drafts' ),\n\t\t\t\tslug: 'drafts',\n\t\t\t\ticon: drafts,\n\t\t\t\tview: {\n\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\tfilters: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Pending' ),\n\t\t\t\tslug: 'pending',\n\t\t\t\ticon: pending,\n\t\t\t\tview: {\n\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\tfilters: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\tvalue: 'pending',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Private' ),\n\t\t\t\tslug: 'private',\n\t\t\t\ticon: notAllowed,\n\t\t\t\tview: {\n\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\tfilters: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\tvalue: 'private',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Trash' ),\n\t\t\t\tslug: 'trash',\n\t\t\t\ticon: trash,\n\t\t\t\tview: {\n\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\ttype: LAYOUT_TABLE,\n\t\t\t\t\tlayout: defaultLayouts[ LAYOUT_TABLE ].layout,\n\t\t\t\t\tfilters: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\t\tvalue: 'trash',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t];\n\t}, [ labels ] );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AAEpC,SACCC,KAAK,EACLC,KAAK,EACLC,MAAM,EACNC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,UAAU,QACJ,kBAAkB;AACzB,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,OAAO,QAAQ,oBAAoB;;AAE5C;AACA;AACA;AACA,SACCC,WAAW,EACXC,YAAY,EACZC,WAA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,UAAU;MAChBmC,IAAI,EAAE;QACL,GAAGlB,iBAAiB;QACpBG,OAAO,EAAE,CACR;UACCI,KAAK,EAAE,QAAQ;UACfY,QAAQ,EAAE5B,eAAe;UACzB6B,KAAK,EAAE;QACR,CAAC;MAEH;IACD,CAAC,EACD;MACCvB,KAAK,EAAErB,EAAE,CAAE,OAAQ,CAAC;MACpBwC,IAAI,EAAE,OAAO;MACbC,IAAI,EAAExC,KAAK;MACXyC,IAAI,EAAE;QACL,GAAGlB,iBAAiB;QACpBC,IAAI,EAAEZ,YAAY;QAClBI,MAAM,EAAED,cAAc,CAAEH,YAAY,CAAE,CAACI,MAAM;QAC7CU,OAAO,EAAE,CACR;UACCI,KAAK,EAAE,QAAQ;UACfY,QAAQ,EAAE5B,eAAe;UACzB6B,KAAK,EAAE;QACR,CAAC;MAEH;IACD,CAAC,CACD;EACF,CAAC,EAAE,CAAER,MAAM,CAAG,CAAC;AAChB","ignoreList":[]}
1
+ {"version":3,"names":["__","trash","pages","drafts","published","scheduled","pending","notAllowed","useSelect","store","coreStore","useEntityRecords","useMemo","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","defaultLayouts","layout","primaryField","styles","width","title","maxWidth","mediaField","DEFAULT_POST_BASE","type","search","filters","page","perPage","sort","field","direction","fields","useDefaultViewsWithItemCounts","postType","defaultViews","useDefaultViews","records","totalItems","per_page","status","counts","filter","record","length","future","private","all","map","_view","count","slug","labels","select","getPostType","all_items","icon","view","operator","value"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"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';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore, useEntityRecords } from '@wordpress/core-data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const defaultLayouts = {\n\t[ LAYOUT_TABLE ]: {\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tstyles: {\n\t\t\t\t'featured-image': {\n\t\t\t\t\twidth: '1%',\n\t\t\t\t},\n\t\t\t\ttitle: {\n\t\t\t\t\tmaxWidth: 300,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tlayout: {\n\t\t\tmediaField: 'featured-image',\n\t\t\tprimaryField: 'title',\n\t\t},\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tlayout: {\n\t\t\tprimaryField: 'title',\n\t\t\tmediaField: 'featured-image',\n\t\t},\n\t},\n};\n\nconst DEFAULT_POST_BASE = {\n\ttype: LAYOUT_LIST,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\tfields: [ 'title', 'author', 'status' ],\n\tlayout: defaultLayouts[ LAYOUT_LIST ].layout,\n};\n\nexport function useDefaultViewsWithItemCounts( { postType } ) {\n\tconst defaultViews = useDefaultViews( { postType } );\n\tconst { records, totalItems } = useEntityRecords( 'postType', postType, {\n\t\tper_page: -1,\n\t\tstatus: [ 'any', 'trash' ],\n\t} );\n\n\treturn useMemo( () => {\n\t\tif ( ! defaultViews ) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// If there are no records, return the default views with no counts.\n\t\tif ( ! records ) {\n\t\t\treturn defaultViews;\n\t\t}\n\n\t\tconst counts = {\n\t\t\tdrafts: records.filter( ( record ) => record.status === 'draft' )\n\t\t\t\t.length,\n\t\t\tfuture: records.filter( ( record ) => record.status === 'future' )\n\t\t\t\t.length,\n\t\t\tpending: records.filter( ( record ) => record.status === 'pending' )\n\t\t\t\t.length,\n\t\t\tprivate: records.filter( ( record ) => record.status === 'private' )\n\t\t\t\t.length,\n\t\t\tpublished: records.filter(\n\t\t\t\t( record ) => record.status === 'publish'\n\t\t\t).length,\n\t\t\ttrash: records.filter( ( record ) => record.status === 'trash' )\n\t\t\t\t.length,\n\t\t};\n\n\t\t// All items excluding trashed items as per the default \"all\" status query.\n\t\tcounts.all = totalItems ? totalItems - counts.trash : 0;\n\n\t\t// Filter out views with > 0 item counts.\n\t\treturn defaultViews.map( ( _view ) => {\n\t\t\t_view.count = counts[ _view.slug ];\n\t\t\treturn _view;\n\t\t} );\n\t}, [ defaultViews, records, totalItems ] );\n}\n\nexport function useDefaultViews( { postType } ) {\n\tconst labels = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getPostType } = select( coreStore );\n\t\t\treturn getPostType( postType )?.labels;\n\t\t},\n\t\t[ postType ]\n\t);\n\treturn useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: labels?.all_items || __( 'All items' ),\n\t\t\t\tslug: 'all',\n\t\t\t\ticon: pages,\n\t\t\t\tview: DEFAULT_POST_BASE,\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Published' ),\n\t\t\t\tslug: 'published',\n\t\t\t\ticon: published,\n\t\t\t\tview: DEFAULT_POST_BASE,\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},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Scheduled' ),\n\t\t\t\tslug: 'future',\n\t\t\t\ticon: scheduled,\n\t\t\t\tview: DEFAULT_POST_BASE,\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},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Drafts' ),\n\t\t\t\tslug: 'drafts',\n\t\t\t\ticon: drafts,\n\t\t\t\tview: DEFAULT_POST_BASE,\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},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Pending' ),\n\t\t\t\tslug: 'pending',\n\t\t\t\ticon: pending,\n\t\t\t\tview: DEFAULT_POST_BASE,\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},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Private' ),\n\t\t\t\tslug: 'private',\n\t\t\t\ticon: notAllowed,\n\t\t\t\tview: DEFAULT_POST_BASE,\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},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\ttitle: __( 'Trash' ),\n\t\t\t\tslug: 'trash',\n\t\t\t\ticon: trash,\n\t\t\t\tview: {\n\t\t\t\t\t...DEFAULT_POST_BASE,\n\t\t\t\t\ttype: LAYOUT_TABLE,\n\t\t\t\t\tlayout: defaultLayouts[ LAYOUT_TABLE ].layout,\n\t\t\t\t},\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},\n\t\t\t\t],\n\t\t\t},\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* Internal dependencies
9
9
  */
10
- import { useDefaultViews } from './default-views';
10
+ import { useDefaultViewsWithItemCounts } from './default-views';
11
11
  import { unlock } from '../../lock-unlock';
12
12
  import DataViewItem from './dataview-item';
13
13
  import CustomDataViewsList from './custom-dataviews-list';
@@ -25,7 +25,7 @@ export default function DataViewsSidebarContent() {
25
25
  isCustom = 'false'
26
26
  }
27
27
  } = useLocation();
28
- const defaultViews = useDefaultViews({
28
+ const defaultViews = useDefaultViewsWithItemCounts({
29
29
  postType
30
30
  });
31
31
  if (!postType) {
@@ -39,6 +39,9 @@ export default function DataViewsSidebarContent() {
39
39
  slug: dataview.slug,
40
40
  title: dataview.title,
41
41
  icon: dataview.icon,
42
+ navigationItemSuffix: /*#__PURE__*/_jsx("span", {
43
+ children: dataview.count
44
+ }),
42
45
  type: dataview.view.type,
43
46
  isActive: !isCustomBoolean && dataview.slug === activeView,
44
47
  isCustom: false
@@ -1 +1 @@
1
- {"version":3,"names":["__experimentalItemGroup","ItemGroup","privateApis","routerPrivateApis","useDefaultViews","unlock","DataViewItem","CustomDataViewsList","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLocation","DataViewsSidebarContent","params","postType","activeView","isCustom","defaultViews","isCustomBoolean","children","map","dataview","slug","title","icon","type","view","isActive","window","__experimentalCustomViews"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useDefaultViews } from './default-views';\nimport { unlock } from '../../lock-unlock';\nimport DataViewItem from './dataview-item';\nimport CustomDataViewsList from './custom-dataviews-list';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function DataViewsSidebarContent() {\n\tconst {\n\t\tparams: { postType, activeView = 'all', isCustom = 'false' },\n\t} = useLocation();\n\tconst defaultViews = useDefaultViews( { postType } );\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\tconst isCustomBoolean = isCustom === 'true';\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ defaultViews.map( ( dataview ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DataViewItem\n\t\t\t\t\t\t\tkey={ dataview.slug }\n\t\t\t\t\t\t\tslug={ dataview.slug }\n\t\t\t\t\t\t\ttitle={ dataview.title }\n\t\t\t\t\t\t\ticon={ dataview.icon }\n\t\t\t\t\t\t\ttype={ dataview.view.type }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t! isCustomBoolean &&\n\t\t\t\t\t\t\t\tdataview.slug === activeView\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisCustom={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ItemGroup>\n\t\t\t{ window?.__experimentalCustomViews && (\n\t\t\t\t<CustomDataViewsList\n\t\t\t\t\tactiveView={ activeView }\n\t\t\t\t\ttype={ postType }\n\t\t\t\t\tisCustom\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,uBAAuB,IAAIC,SAAS,QAAQ,uBAAuB;AAC5E,SAASC,WAAW,IAAIC,iBAAiB,QAAQ,mBAAmB;;AAEpE;AACA;AACA;AACA,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,YAAY,MAAM,iBAAiB;AAC1C,OAAOC,mBAAmB,MAAM,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE1D,MAAM;EAAEC;AAAY,CAAC,GAAGT,MAAM,CAAEF,iBAAkB,CAAC;AAEnD,eAAe,SAASY,uBAAuBA,CAAA,EAAG;EACjD,MAAM;IACLC,MAAM,EAAE;MAAEC,QAAQ;MAAEC,UAAU,GAAG,KAAK;MAAEC,QAAQ,GAAG;IAAQ;EAC5D,CAAC,GAAGL,WAAW,CAAC,CAAC;EACjB,MAAMM,YAAY,GAAGhB,eAAe,CAAE;IAAEa;EAAS,CAAE,CAAC;EACpD,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,IAAI;EACZ;EACA,MAAMI,eAAe,GAAGF,QAAQ,KAAK,MAAM;EAE3C,oBACCN,KAAA,CAAAF,SAAA;IAAAW,QAAA,gBACCb,IAAA,CAACR,SAAS;MAAAqB,QAAA,EACPF,YAAY,CAACG,GAAG,CAAIC,QAAQ,IAAM;QACnC,oBACCf,IAAA,CAACH,YAAY;UAEZmB,IAAI,EAAGD,QAAQ,CAACC,IAAM;UACtBC,KAAK,EAAGF,QAAQ,CAACE,KAAO;UACxBC,IAAI,EAAGH,QAAQ,CAACG,IAAM;UACtBC,IAAI,EAAGJ,QAAQ,CAACK,IAAI,CAACD,IAAM;UAC3BE,QAAQ,EACP,CAAET,eAAe,IACjBG,QAAQ,CAACC,IAAI,KAAKP,UAClB;UACDC,QAAQ,EAAG;QAAO,GATZK,QAAQ,CAACC,IAUf,CAAC;MAEJ,CAAE;IAAC,CACO,CAAC,EACVM,MAAM,EAAEC,yBAAyB,iBAClCvB,IAAA,CAACF,mBAAmB;MACnBW,UAAU,EAAGA,UAAY;MACzBU,IAAI,EAAGX,QAAU;MACjBE,QAAQ;IAAA,CACR,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
1
+ {"version":3,"names":["__experimentalItemGroup","ItemGroup","privateApis","routerPrivateApis","useDefaultViewsWithItemCounts","unlock","DataViewItem","CustomDataViewsList","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","useLocation","DataViewsSidebarContent","params","postType","activeView","isCustom","defaultViews","isCustomBoolean","children","map","dataview","slug","title","icon","navigationItemSuffix","count","type","view","isActive","window","__experimentalCustomViews"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { useDefaultViewsWithItemCounts } from './default-views';\nimport { unlock } from '../../lock-unlock';\nimport DataViewItem from './dataview-item';\nimport CustomDataViewsList from './custom-dataviews-list';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function DataViewsSidebarContent() {\n\tconst {\n\t\tparams: { postType, activeView = 'all', isCustom = 'false' },\n\t} = useLocation();\n\n\tconst defaultViews = useDefaultViewsWithItemCounts( { postType } );\n\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\tconst isCustomBoolean = isCustom === 'true';\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ defaultViews.map( ( dataview ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<DataViewItem\n\t\t\t\t\t\t\tkey={ dataview.slug }\n\t\t\t\t\t\t\tslug={ dataview.slug }\n\t\t\t\t\t\t\ttitle={ dataview.title }\n\t\t\t\t\t\t\ticon={ dataview.icon }\n\t\t\t\t\t\t\tnavigationItemSuffix={\n\t\t\t\t\t\t\t\t<span>{ dataview.count }</span>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttype={ dataview.view.type }\n\t\t\t\t\t\t\tisActive={\n\t\t\t\t\t\t\t\t! isCustomBoolean &&\n\t\t\t\t\t\t\t\tdataview.slug === activeView\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tisCustom={ false }\n\t\t\t\t\t\t/>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ItemGroup>\n\t\t\t{ window?.__experimentalCustomViews && (\n\t\t\t\t<CustomDataViewsList\n\t\t\t\t\tactiveView={ activeView }\n\t\t\t\t\ttype={ postType }\n\t\t\t\t\tisCustom\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"],"mappings":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eAAe,IACjBG,QAAQ,CAACC,IAAI,KAAKP,UAClB;UACDC,QAAQ,EAAG;QAAO,GAZZK,QAAQ,CAACC,IAaf,CAAC;MAEJ,CAAE;IAAC,CACO,CAAC,EACVQ,MAAM,EAAEC,yBAAyB,iBAClCzB,IAAA,CAACF,mBAAmB;MACnBW,UAAU,EAAGA,UAAY;MACzBY,IAAI,EAAGb,QAAU;MACjBE,QAAQ;IAAA,CACR,CACD;EAAA,CACA,CAAC;AAEL","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * WordPress dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","useBlockEditingMode","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","useSelect","noticesStore","coreStore","useSupportedStyles","unlock","setNestedValue","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","cleanEmptyObject","GlobalStylesContext","STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","blockUserConfig","styles","blocks","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","structuredClone","newUserConfig","undefined","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","title","type","actions","label","onClick","__nextHasNoMarginBottom","className","help","children","VisualLabel","__next40pxDefaultSize","variant","accessibleWhenDisabled","disabled","PushChangesToGlobalStyles","props","blockEditingMode","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","supportsStyles","some","feature","isDisplayed","withPushChangesToGlobalStyles","BlockEdit","isSelected"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { cleanEmptyObject, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = structuredClone( blockStyles );\n\t\t\tconst newUserConfig = structuredClone( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SACCC,yBAAyB,EACzBC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB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DrH,SAAS,CACR,kBAAkB,EAClB,8CAA8C,EAC9C+H,6BACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["addFilter","createHigherOrderComponent","InspectorAdvancedControls","store","blockEditorStore","privateApis","blockEditorPrivateApis","useBlockEditingMode","BaseControl","Button","__","sprintf","__EXPERIMENTAL_STYLE_PROPERTY","getBlockType","hasBlockSupport","useContext","useMemo","useCallback","useDispatch","useSelect","noticesStore","coreStore","useSupportedStyles","unlock","setNestedValue","jsx","_jsx","jsxs","_jsxs","Fragment","_Fragment","cleanEmptyObject","GlobalStylesContext","STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","blockUserConfig","styles","blocks","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","__unstableMarkNextChangeAsNotPersistent","createSuccessNotice","pushChanges","length","blockStyles","newBlockStyles","structuredClone","newUserConfig","undefined","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","title","type","actions","label","onClick","__nextHasNoMarginBottom","className","help","children","VisualLabel","__next40pxDefaultSize","variant","accessibleWhenDisabled","disabled","PushChangesToGlobalStyles","props","blockEditingMode","isBlockBasedTheme","select","getCurrentTheme","is_block_theme","supportsStyles","some","feature","isDisplayed","withPushChangesToGlobalStyles","BlockEdit","isSelected"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { cleanEmptyObject, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = structuredClone( blockStyles );\n\t\t\tconst newUserConfig = structuredClone( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\taccessibleWhenDisabled\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit key=\"edit\" { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SACCC,yBAAyB,EACzBC,KAAK,IAAIC,gBAAgB,EACzBC,WAAW,IAAIC,sBAAsB,EACrCC,mBAAmB,QACb,yBAAyB;AAChC,SAASC,WAAW,EAAEC,MAAM,QAAQ,uBAAuB;AAC3D,SAASC,EAAE,EAAEC,OAAO,QAAQ,iBAAiB;AAC7C,SACCC,6BAA6B,EAC7BC,YAAY,EACZC,eAAe,QACT,mBAAmB;AAC1B,SAASC,UAAU,EAAEC,OAAO,EAAEC,WAAW,QAAQ,oBAAoB;AACrE,SAASC,WAAW,EAAEC,SAAS,QAAQ,iBAAiB;AACxD,SAAShB,KAAK,IAAIiB,YA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CAAEC,KAAK,EAAG;EAC3C,MAAMC,gBAAgB,GAAG/G,mBAAmB,CAAC,CAAC;EAC9C,MAAMgH,iBAAiB,GAAGpG,SAAS,CAChCqG,MAAM,IAAMA,MAAM,CAAEnG,SAAU,CAAC,CAACoG,eAAe,CAAC,CAAC,EAAEC,cAAc,EACnE,EACD,CAAC;EACD,MAAMC,cAAc,GAAGrF,gBAAgB,CAACsF,IAAI,CAAIC,OAAO,IACtD/G,eAAe,CAAEuG,KAAK,CAACxD,IAAI,EAAEgE,OAAQ,CACtC,CAAC;EACD,MAAMC,WAAW,GAChBR,gBAAgB,KAAK,SAAS,IAAIK,cAAc,IAAIJ,iBAAiB;EAEtE,IAAK,CAAEO,WAAW,EAAG;IACpB,OAAO,IAAI;EACZ;EAEA,oBACCpG,IAAA,CAACxB,yBAAyB;IAAA4G,QAAA,eACzBpF,IAAA,CAACwD,gCAAgC;MAAA,GAAMmC;IAAK,CAAI;EAAC,CACvB,CAAC;AAE9B;AAEA,MAAMU,6BAA6B,GAAG9H,0BAA0B,CAC7D+H,SAAS,IAAQX,KAAK,iBACvBzF,KAAA,CAAAE,SAAA;EAAAgF,QAAA,gBACCpF,IAAA,CAACsG,SAAS;IAAA,GAAiBX;EAAK,GAAjB,MAAqB,CAAC,EACnCA,KAAK,CAACY,UAAU,iBAAIvG,IAAA,CAAC0F,yBAAyB;IAAA,GAAMC;EAAK,CAAI,CAAC;AAAA,CAC/D,CAEJ,CAAC;AAEDrH,SAAS,CACR,kBAAkB,EAClB,8CAA8C,EAC9C+H,6BACD,CAAC","ignoreList":[]}
@@ -1,3 +1,4 @@
1
+ /* wp:polyfill */
1
2
  /**
2
3
  * WordPress dependencies
3
4
  */
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","useContext","useMemo","privateApis","blockEditorPrivateApis","editorPrivateApis","__","unlock","GlobalStylesContext","areGlobalStyleConfigsEqual","mergeBaseAndUserConfigs","removePropertiesFromObject","object","properties","length","Object","keys","key","includes","hasThemeVariation","title","settings","styles","useCurrentMergeThemeStyleVariationsWithUserConfig","variationsFromTheme","select","_variationsFromTheme","__experimentalGetCurrentThemeGlobalStylesVariations","user","userVariation","propertiesAsString","toString","clonedUserVariation","structuredClone","userVariationWithoutProperties","variationsWithPropertiesAndBase","filter","variation","isVariationWithProperties","map","variationsByProperties","filterObjectByProperties","newObject","forEach","newFilter","variationWithProperties"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of properties from an object.\n *\n * @param {Object} object The object to remove the properties from.\n * @param {string[]} properties The properties to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertiesFromObject( object, properties ) {\n\tif ( ! properties?.length ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertiesFromObject( object[ key ], properties );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * Checks whether a style variation is empty.\n *\n * @param {Object} variation A style variation object.\n * @param {string} variation.title The title of the variation.\n * @param {Object} variation.settings The settings of the variation.\n * @param {Object} variation.styles The styles of the variation.\n * @return {boolean} Whether the variation is empty.\n */\nfunction hasThemeVariation( { title, settings, styles } ) {\n\treturn (\n\t\ttitle === __( 'Default' ) || // Always preserve the default variation.\n\t\tObject.keys( settings ).length > 0 ||\n\t\tObject.keys( styles ).length > 0\n\t);\n}\n\n/**\n * Fetches the current theme style variations that contain only the specified properties\n * and merges them with the user config.\n *\n * @param {string[]} properties The properties to filter by.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig(\n\tproperties = []\n) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: userVariation } = useContext( GlobalStylesContext );\n\n\tconst propertiesAsString = properties.toString();\n\n\treturn useMemo( () => {\n\t\tconst clonedUserVariation = structuredClone( userVariation );\n\n\t\t// Get user variation and remove the settings for the given property.\n\t\tconst userVariationWithoutProperties = removePropertiesFromObject(\n\t\t\tclonedUserVariation,\n\t\t\tproperties\n\t\t);\n\t\tuserVariationWithoutProperties.title = __( 'Default' );\n\n\t\tconst variationsWithPropertiesAndBase = variationsFromTheme\n\t\t\t.filter( ( variation ) => {\n\t\t\t\treturn isVariationWithProperties( variation, properties );\n\t\t\t} )\n\t\t\t.map( ( variation ) => {\n\t\t\t\treturn mergeBaseAndUserConfigs(\n\t\t\t\t\tuserVariationWithoutProperties,\n\t\t\t\t\tvariation\n\t\t\t\t);\n\t\t\t} );\n\n\t\tconst variationsByProperties = [\n\t\t\tuserVariationWithoutProperties,\n\t\t\t...variationsWithPropertiesAndBase,\n\t\t];\n\n\t\t/*\n\t\t * Filter out variations with no settings or styles.\n\t\t */\n\t\treturn variationsByProperties?.length\n\t\t\t? variationsByProperties.filter( hasThemeVariation )\n\t\t\t: [];\n\t}, [ propertiesAsString, userVariation, variationsFromTheme ] );\n}\n\n/**\n * Returns a new object, with properties specified in `properties` array.,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given properties.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`.\n *\n * @param {Object} object The object to filter\n * @param {string[]} properties The properties to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperties = ( object, properties ) => {\n\tif ( ! object || ! properties?.length ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperties(\n\t\t\t\tobject[ key ],\n\t\t\t\tproperties\n\t\t\t);\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Compares a style variation to the same variation filtered by the specified properties.\n * Returns true if the variation contains only the properties specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string[]} properties The properties to compare.\n * @return {boolean} Whether the variation contains only the specified properties.\n */\nexport function isVariationWithProperties( variation, properties ) {\n\tconst variationWithProperties = filterObjectByProperties(\n\t\tstructuredClone( variation ),\n\t\tproperties\n\t);\n\n\treturn areGlobalStyleConfigsEqual( variationWithProperties, variation );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AA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K,CAAED,MAAM,IAAI,CAAEC,UAAU,EAAEC,MAAM,EAAG;IACvC,OAAO,CAAC,CAAC;EACV;EAEA,MAAM4B,SAAS,GAAG,CAAC,CAAC;EACpB3B,MAAM,CAACC,IAAI,CAAEJ,MAAO,CAAC,CAAC+B,OAAO,CAAI1B,GAAG,IAAM;IACzC,IAAKJ,UAAU,CAACK,QAAQ,CAAED,GAAI,CAAC,EAAG;MACjCyB,SAAS,CAAEzB,GAAG,CAAE,GAAGL,MAAM,CAAEK,GAAG,CAAE;IACjC,CAAC,MAAM,IAAK,OAAOL,MAAM,CAAEK,GAAG,CAAE,KAAK,QAAQ,EAAG;MAC/C,MAAM2B,SAAS,GAAGH,wBAAwB,CACzC7B,MAAM,CAAEK,GAAG,CAAE,EACbJ,UACD,CAAC;MACD,IAAKE,MAAM,CAACC,IAAI,CAAE4B,SAAU,CAAC,CAAC9B,MAAM,EAAG;QACtC4B,SAAS,CAAEzB,GAAG,CAAE,GAAG2B,SAAS;MAC7B;IACD;EACD,CAAE,CAAC;EACH,OAAOF,SAAS;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASJ,yBAAyBA,CAAED,SAAS,EAAExB,UAAU,EAAG;EAClE,MAAMgC,uBAAuB,GAAGJ,wBAAwB,CACvDR,eAAe,CAAEI,SAAU,CAAC,EAC5BxB,UACD,CAAC;EAED,OAAOJ,0BAA0B,CAAEoC,uBAAuB,EAAER,SAAU,CAAC;AACxE","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","coreStore","useContext","useMemo","privateApis","blockEditorPrivateApis","editorPrivateApis","__","unlock","GlobalStylesContext","areGlobalStyleConfigsEqual","mergeBaseAndUserConfigs","removePropertiesFromObject","object","properties","length","Object","keys","key","includes","hasThemeVariation","title","settings","styles","useCurrentMergeThemeStyleVariationsWithUserConfig","variationsFromTheme","select","_variationsFromTheme","__experimentalGetCurrentThemeGlobalStylesVariations","user","userVariation","propertiesAsString","toString","clonedUserVariation","structuredClone","userVariationWithoutProperties","variationsWithPropertiesAndBase","filter","variation","isVariationWithProperties","map","variationsByProperties","filterObjectByProperties","newObject","forEach","newFilter","variationWithProperties"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext, areGlobalStyleConfigsEqual } = unlock(\n\tblockEditorPrivateApis\n);\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of properties from an object.\n *\n * @param {Object} object The object to remove the properties from.\n * @param {string[]} properties The properties to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertiesFromObject( object, properties ) {\n\tif ( ! properties?.length ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertiesFromObject( object[ key ], properties );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * Checks whether a style variation is empty.\n *\n * @param {Object} variation A style variation object.\n * @param {string} variation.title The title of the variation.\n * @param {Object} variation.settings The settings of the variation.\n * @param {Object} variation.styles The styles of the variation.\n * @return {boolean} Whether the variation is empty.\n */\nfunction hasThemeVariation( { title, settings, styles } ) {\n\treturn (\n\t\ttitle === __( 'Default' ) || // Always preserve the default variation.\n\t\tObject.keys( settings ).length > 0 ||\n\t\tObject.keys( styles ).length > 0\n\t);\n}\n\n/**\n * Fetches the current theme style variations that contain only the specified properties\n * and merges them with the user config.\n *\n * @param {string[]} properties The properties to filter by.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig(\n\tproperties = []\n) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: userVariation } = useContext( GlobalStylesContext );\n\n\tconst propertiesAsString = properties.toString();\n\n\treturn useMemo( () => {\n\t\tconst clonedUserVariation = structuredClone( userVariation );\n\n\t\t// Get user variation and remove the settings for the given property.\n\t\tconst userVariationWithoutProperties = removePropertiesFromObject(\n\t\t\tclonedUserVariation,\n\t\t\tproperties\n\t\t);\n\t\tuserVariationWithoutProperties.title = __( 'Default' );\n\n\t\tconst variationsWithPropertiesAndBase = variationsFromTheme\n\t\t\t.filter( ( variation ) => {\n\t\t\t\treturn isVariationWithProperties( variation, properties );\n\t\t\t} )\n\t\t\t.map( ( variation ) => {\n\t\t\t\treturn mergeBaseAndUserConfigs(\n\t\t\t\t\tuserVariationWithoutProperties,\n\t\t\t\t\tvariation\n\t\t\t\t);\n\t\t\t} );\n\n\t\tconst variationsByProperties = [\n\t\t\tuserVariationWithoutProperties,\n\t\t\t...variationsWithPropertiesAndBase,\n\t\t];\n\n\t\t/*\n\t\t * Filter out variations with no settings or styles.\n\t\t */\n\t\treturn variationsByProperties?.length\n\t\t\t? variationsByProperties.filter( hasThemeVariation )\n\t\t\t: [];\n\t}, [ propertiesAsString, userVariation, variationsFromTheme ] );\n}\n\n/**\n * Returns a new object, with properties specified in `properties` array.,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given properties.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the properties are `[ 'test' ]`.\n *\n * @param {Object} object The object to filter\n * @param {string[]} properties The properties to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperties = ( object, properties ) => {\n\tif ( ! object || ! properties?.length ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( properties.includes( key ) ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperties(\n\t\t\t\tobject[ key ],\n\t\t\t\tproperties\n\t\t\t);\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Compares a style variation to the same variation filtered by the specified properties.\n * Returns true if the variation contains only the properties specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string[]} properties The properties to compare.\n * @return {boolean} Whether the variation contains only the specified properties.\n */\nexport function isVariationWithProperties( variation, properties ) {\n\tconst variationWithProperties = filterObjectByProperties(\n\t\tstructuredClone( variation ),\n\t\tproperties\n\t);\n\n\treturn areGlobalStyleConfigsEqual( variationWithProperties, variation );\n}\n"],"mappings":";AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC,mBAAmB;EAAEC;AAA2B,CAAC,GAAGF,MAAM,CACjEH,sBACD,CAAC;AACD,MAAM;EAAEM;AAAwB,CAAC,GAAGH,MAAM,CAAE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MAAM,CAACC,IAAI,CAAEJ,MAAO,CAAC,CAAC+B,OAAO,CAAI1B,GAAG,IAAM;IACzC,IAAKJ,UAAU,CAACK,QAAQ,CAAED,GAAI,CAAC,EAAG;MACjCyB,SAAS,CAAEzB,GAAG,CAAE,GAAGL,MAAM,CAAEK,GAAG,CAAE;IACjC,CAAC,MAAM,IAAK,OAAOL,MAAM,CAAEK,GAAG,CAAE,KAAK,QAAQ,EAAG;MAC/C,MAAM2B,SAAS,GAAGH,wBAAwB,CACzC7B,MAAM,CAAEK,GAAG,CAAE,EACbJ,UACD,CAAC;MACD,IAAKE,MAAM,CAACC,IAAI,CAAE4B,SAAU,CAAC,CAAC9B,MAAM,EAAG;QACtC4B,SAAS,CAAEzB,GAAG,CAAE,GAAG2B,SAAS;MAC7B;IACD;EACD,CAAE,CAAC;EACH,OAAOF,SAAS;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASJ,yBAAyBA,CAAED,SAAS,EAAExB,UAAU,EAAG;EAClE,MAAMgC,uBAAuB,GAAGJ,wBAAwB,CACvDR,eAAe,CAAEI,SAAU,CAAC,EAC5BxB,UACD,CAAC;EAED,OAAOJ,0BAA0B,CAAEoC,uBAAuB,EAAER,SAAU,CAAC;AACxE","ignoreList":[]}
@@ -578,7 +578,7 @@
578
578
  margin: 0;
579
579
  }
580
580
 
581
- .dataviews-view-config {
581
+ .dataviews-view-config .components-popover__content {
582
582
  width: 320px;
583
583
  /* stylelint-disable-next-line property-no-unknown -- the linter needs to be updated to accepted the container-type property */
584
584
  container-type: inline-size;
@@ -1516,7 +1516,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
1516
1516
  contain: content;
1517
1517
  }
1518
1518
 
1519
- @keyframes _omac0_slide-from-right {
1519
+ @keyframes _m3bxv_slide-from-right {
1520
1520
  from {
1521
1521
  transform: translateX(-50px);
1522
1522
  opacity: 0;
@@ -1526,7 +1526,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
1526
1526
  opacity: 1;
1527
1527
  }
1528
1528
  }
1529
- @keyframes _omac0_slide-from-left {
1529
+ @keyframes _m3bxv_slide-from-left {
1530
1530
  from {
1531
1531
  transform: translateX(50px);
1532
1532
  opacity: 0;
@@ -1582,10 +1582,10 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
1582
1582
  }
1583
1583
  }
1584
1584
  .edit-site-sidebar__screen-wrapper.slide-from-left {
1585
- animation-name: _omac0_slide-from-left;
1585
+ animation-name: _m3bxv_slide-from-left;
1586
1586
  }
1587
1587
  .edit-site-sidebar__screen-wrapper.slide-from-right {
1588
- animation-name: _omac0_slide-from-right;
1588
+ animation-name: _m3bxv_slide-from-right;
1589
1589
  }
1590
1590
 
1591
1591
  .edit-site-site-hub {
@@ -578,7 +578,7 @@
578
578
  margin: 0;
579
579
  }
580
580
 
581
- .dataviews-view-config {
581
+ .dataviews-view-config .components-popover__content {
582
582
  width: 320px;
583
583
  /* stylelint-disable-next-line property-no-unknown -- the linter needs to be updated to accepted the container-type property */
584
584
  container-type: inline-size;
@@ -1516,7 +1516,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
1516
1516
  contain: content;
1517
1517
  }
1518
1518
 
1519
- @keyframes _omac0_slide-from-right {
1519
+ @keyframes _m3bxv_slide-from-right {
1520
1520
  from {
1521
1521
  transform: translateX(50px);
1522
1522
  opacity: 0;
@@ -1526,7 +1526,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
1526
1526
  opacity: 1;
1527
1527
  }
1528
1528
  }
1529
- @keyframes _omac0_slide-from-left {
1529
+ @keyframes _m3bxv_slide-from-left {
1530
1530
  from {
1531
1531
  transform: translateX(-50px);
1532
1532
  opacity: 0;
@@ -1582,10 +1582,10 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
1582
1582
  }
1583
1583
  }
1584
1584
  .edit-site-sidebar__screen-wrapper.slide-from-left {
1585
- animation-name: _omac0_slide-from-left;
1585
+ animation-name: _m3bxv_slide-from-left;
1586
1586
  }
1587
1587
  .edit-site-sidebar__screen-wrapper.slide-from-right {
1588
- animation-name: _omac0_slide-from-right;
1588
+ animation-name: _m3bxv_slide-from-right;
1589
1589
  }
1590
1590
 
1591
1591
  .edit-site-site-hub {
@@ -578,7 +578,7 @@
578
578
  margin: 0;
579
579
  }
580
580
 
581
- .dataviews-view-config {
581
+ .dataviews-view-config .components-popover__content {
582
582
  width: 320px;
583
583
  /* stylelint-disable-next-line property-no-unknown -- the linter needs to be updated to accepted the container-type property */
584
584
  container-type: inline-size;
@@ -1574,6 +1574,10 @@ ul.dataviews-view-list {
1574
1574
  fill: currentColor;
1575
1575
  }
1576
1576
 
1577
+ .edit-site-global-styles-screen-root__active-style-tile.edit-site-global-styles-screen-root__active-style-tile, .edit-site-global-styles-screen-root__active-style-tile.edit-site-global-styles-screen-root__active-style-tile .edit-site-global-styles-screen-root__active-style-tile-preview {
1578
+ border-radius: 2px;
1579
+ }
1580
+
1577
1581
  .edit-site-global-styles-screen-revisions__revisions-list {
1578
1582
  list-style: none;
1579
1583
  margin: 0 16px 16px 16px;
@@ -2528,7 +2532,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
2528
2532
  contain: content;
2529
2533
  }
2530
2534
 
2531
- @keyframes _g2zts_slide-from-right {
2535
+ @keyframes _hn47y_slide-from-right {
2532
2536
  from {
2533
2537
  transform: translateX(-50px);
2534
2538
  opacity: 0;
@@ -2538,7 +2542,7 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
2538
2542
  opacity: 1;
2539
2543
  }
2540
2544
  }
2541
- @keyframes _g2zts_slide-from-left {
2545
+ @keyframes _hn47y_slide-from-left {
2542
2546
  from {
2543
2547
  transform: translateX(50px);
2544
2548
  opacity: 0;
@@ -2594,10 +2598,10 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
2594
2598
  }
2595
2599
  }
2596
2600
  .edit-site-sidebar__screen-wrapper.slide-from-left {
2597
- animation-name: _g2zts_slide-from-left;
2601
+ animation-name: _hn47y_slide-from-left;
2598
2602
  }
2599
2603
  .edit-site-sidebar__screen-wrapper.slide-from-right {
2600
- animation-name: _g2zts_slide-from-right;
2604
+ animation-name: _hn47y_slide-from-right;
2601
2605
  }
2602
2606
 
2603
2607
  .edit-site-sidebar-button {
@@ -2861,6 +2865,9 @@ html.canvas-mode-edit-transition::view-transition-group(toggle) {
2861
2865
  .edit-site-sidebar-dataviews-dataview-item .edit-site-sidebar-dataviews-dataview-item__dropdown-menu {
2862
2866
  min-width: initial;
2863
2867
  }
2868
+ .edit-site-sidebar-dataviews-dataview-item .edit-site-sidebar-navigation-item.with-suffix {
2869
+ padding-left: 8px;
2870
+ }
2864
2871
  .edit-site-sidebar-dataviews-dataview-item:hover, .edit-site-sidebar-dataviews-dataview-item:focus, .edit-site-sidebar-dataviews-dataview-item[aria-current] {
2865
2872
  color: #e0e0e0;
2866
2873
  background: #2f2f2f;
@@ -3285,7 +3292,7 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
3285
3292
  .font-library-modal__font-card {
3286
3293
  border: 1px solid #e0e0e0;
3287
3294
  width: 100%;
3288
- height: auto;
3295
+ height: auto !important;
3289
3296
  padding: 16px;
3290
3297
  margin-top: -1px;
3291
3298
  /* To collapse the margin with the previous element */
@@ -3321,7 +3328,7 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
3321
3328
  padding-bottom: 16px;
3322
3329
  }
3323
3330
 
3324
- .font-library-modal__tabs [role=tablist] {
3331
+ .font-library-modal__tablist {
3325
3332
  position: sticky;
3326
3333
  top: 0;
3327
3334
  border-bottom: 1px solid #ddd;
@@ -3335,7 +3342,7 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
3335
3342
  align-items: center;
3336
3343
  display: flex;
3337
3344
  justify-content: center;
3338
- height: 256px;
3345
+ height: 256px !important;
3339
3346
  width: 100%;
3340
3347
  }
3341
3348
 
@@ -3513,17 +3520,6 @@ body.js.site-editor-php {
3513
3520
  top: 0;
3514
3521
  }
3515
3522
 
3516
- /**
3517
- * Animations
3518
- */
3519
- @keyframes edit-post__fade-in-animation {
3520
- from {
3521
- opacity: 0;
3522
- }
3523
- to {
3524
- opacity: 1;
3525
- }
3526
- }
3527
3523
  body.admin-color-light {
3528
3524
  --wp-admin-theme-color: #0085ba;
3529
3525
  --wp-admin-theme-color--rgb: 0, 133, 186;