@wordpress/fields 0.25.2 → 0.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/fields",
3
- "version": "0.25.2",
3
+ "version": "0.25.3",
4
4
  "description": "DataViews is a component that provides an API to render datasets using different types of layouts (table, grid, list, etc.).",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -39,30 +39,30 @@
39
39
  "src/**/*.scss"
40
40
  ],
41
41
  "dependencies": {
42
- "@wordpress/api-fetch": "^7.33.0",
43
- "@wordpress/base-styles": "^6.9.0",
44
- "@wordpress/blob": "^4.33.0",
45
- "@wordpress/block-editor": "^15.6.0",
46
- "@wordpress/blocks": "^15.6.0",
47
- "@wordpress/components": "^30.6.0",
48
- "@wordpress/compose": "^7.33.0",
49
- "@wordpress/core-data": "^7.33.0",
50
- "@wordpress/data": "^10.33.0",
51
- "@wordpress/dataviews": "^10.1.0",
52
- "@wordpress/date": "^5.33.0",
53
- "@wordpress/element": "^6.33.0",
54
- "@wordpress/hooks": "^4.33.0",
55
- "@wordpress/html-entities": "^4.33.0",
56
- "@wordpress/i18n": "^6.6.0",
57
- "@wordpress/icons": "^11.0.0",
58
- "@wordpress/media-utils": "^5.33.0",
59
- "@wordpress/notices": "^5.33.0",
60
- "@wordpress/patterns": "^2.33.0",
61
- "@wordpress/primitives": "^4.33.0",
62
- "@wordpress/private-apis": "^1.33.0",
63
- "@wordpress/router": "^1.33.0",
64
- "@wordpress/url": "^4.33.0",
65
- "@wordpress/warning": "^3.33.0",
42
+ "@wordpress/api-fetch": "^7.33.1",
43
+ "@wordpress/base-styles": "^6.9.1",
44
+ "@wordpress/blob": "^4.33.1",
45
+ "@wordpress/block-editor": "^15.6.1",
46
+ "@wordpress/blocks": "^15.6.1",
47
+ "@wordpress/components": "^30.6.1",
48
+ "@wordpress/compose": "^7.33.1",
49
+ "@wordpress/core-data": "^7.33.1",
50
+ "@wordpress/data": "^10.33.1",
51
+ "@wordpress/dataviews": "^10.1.1",
52
+ "@wordpress/date": "^5.33.1",
53
+ "@wordpress/element": "^6.33.1",
54
+ "@wordpress/hooks": "^4.33.1",
55
+ "@wordpress/html-entities": "^4.33.1",
56
+ "@wordpress/i18n": "^6.6.1",
57
+ "@wordpress/icons": "^11.0.1",
58
+ "@wordpress/media-utils": "^5.33.1",
59
+ "@wordpress/notices": "^5.33.1",
60
+ "@wordpress/patterns": "^2.33.1",
61
+ "@wordpress/primitives": "^4.33.1",
62
+ "@wordpress/private-apis": "^1.33.1",
63
+ "@wordpress/router": "^1.33.1",
64
+ "@wordpress/url": "^4.33.1",
65
+ "@wordpress/warning": "^3.33.1",
66
66
  "change-case": "4.1.2",
67
67
  "client-zip": "^2.4.5",
68
68
  "clsx": "2.1.1",
@@ -74,5 +74,5 @@
74
74
  "publishConfig": {
75
75
  "access": "public"
76
76
  },
77
- "gitHead": "2a8c29e6550fa1a246bfce534fbcc545d035a9a7"
77
+ "gitHead": "5f84bafdec1bed05247c1080c12f6a237951b862"
78
78
  }
@@ -62,9 +62,7 @@ const duplicatePost: Action< BasePost > = {
62
62
  return;
63
63
  }
64
64
 
65
- const isTemplate =
66
- item.type === 'wp_template' ||
67
- item.type === 'wp_registered_template';
65
+ const isTemplate = item.type === 'wp_template';
68
66
 
69
67
  const newItemObject = {
70
68
  status: isTemplate ? 'publish' : 'draft',
@@ -108,9 +106,7 @@ const duplicatePost: Action< BasePost > = {
108
106
  try {
109
107
  const newItem = await saveEntityRecord(
110
108
  'postType',
111
- item.type === 'wp_registered_template'
112
- ? 'wp_template'
113
- : item.type,
109
+ item.type,
114
110
  newItemObject,
115
111
  { throwOnError: true }
116
112
  );
@@ -149,7 +145,7 @@ const duplicatePost: Action< BasePost > = {
149
145
  return (
150
146
  <form onSubmit={ createPage }>
151
147
  <VStack spacing={ 3 }>
152
- { item.type === 'wp_registered_template' && (
148
+ { typeof item.id === 'string' && (
153
149
  <div>
154
150
  { __(
155
151
  'You are about to duplicate a bundled template. Changes will not be live until you activate the new template.'
@@ -22,12 +22,10 @@ import apiFetch from '@wordpress/api-fetch';
22
22
  /**
23
23
  * Internal dependencies
24
24
  */
25
- import { getItemTitle, isTemplateOrTemplatePart } from './utils';
26
- import type { CoreDataError, Template, TemplatePart } from '../types';
25
+ import { getItemTitle } from './utils';
26
+ import type { CoreDataError, TemplatePart } from '../types';
27
27
 
28
- const isTemplateRevertable = (
29
- templateOrTemplatePart: Template | TemplatePart
30
- ) => {
28
+ const isTemplateRevertable = ( templateOrTemplatePart: TemplatePart ) => {
31
29
  if ( ! templateOrTemplatePart ) {
32
30
  return false;
33
31
  }
@@ -48,7 +46,7 @@ const isTemplateRevertable = (
48
46
  * reverting the template. Default true.
49
47
  */
50
48
  const revertTemplate = async (
51
- template: TemplatePart | Template,
49
+ template: TemplatePart,
52
50
  { allowUndo = true } = {}
53
51
  ) => {
54
52
  const noticeId = 'edit-site-template-reverted';
@@ -175,15 +173,14 @@ const revertTemplate = async (
175
173
  }
176
174
  };
177
175
 
178
- const resetPostAction: Action< Template | TemplatePart > = {
176
+ const resetPostAction: Action< TemplatePart > = {
179
177
  id: 'reset-post',
180
178
  label: __( 'Reset' ),
181
179
  isEligible: ( item ) => {
182
180
  return (
183
- isTemplateOrTemplatePart( item ) &&
181
+ item.type === 'wp_template_part' &&
184
182
  item?.source === 'custom' &&
185
- ( Boolean( item.type === 'wp_template' && item?.plugin ) ||
186
- item?.has_theme_file )
183
+ item?.has_theme_file
187
184
  );
188
185
  },
189
186
  icon: backup,
@@ -226,26 +223,14 @@ const resetPostAction: Action< Template | TemplatePart > = {
226
223
  }
227
224
  );
228
225
  } catch ( error ) {
229
- let fallbackErrorMessage;
230
- if ( items[ 0 ].type === 'wp_template' ) {
231
- fallbackErrorMessage =
232
- items.length === 1
233
- ? __(
234
- 'An error occurred while reverting the template.'
235
- )
236
- : __(
237
- 'An error occurred while reverting the templates.'
238
- );
239
- } else {
240
- fallbackErrorMessage =
241
- items.length === 1
242
- ? __(
243
- 'An error occurred while reverting the template part.'
244
- )
245
- : __(
246
- 'An error occurred while reverting the template parts.'
247
- );
248
- }
226
+ const fallbackErrorMessage =
227
+ items.length === 1
228
+ ? __(
229
+ 'An error occurred while reverting the template part.'
230
+ )
231
+ : __(
232
+ 'An error occurred while reverting the template parts.'
233
+ );
249
234
 
250
235
  const typedError = error as CoreDataError;
251
236
  const errorMessage =
@@ -23,7 +23,7 @@ import type { CoreDataError, PostWithPermissions } from '../types';
23
23
 
24
24
  const trashPost: Action< PostWithPermissions > = {
25
25
  id: 'move-to-trash',
26
- label: __( 'Move to trash' ),
26
+ label: __( 'Trash' ),
27
27
  isPrimary: true,
28
28
  icon: trash,
29
29
  isEligible( item ) {