@wordpress/media-fields 0.22.0 → 0.24.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 (92) hide show
  1. package/build/alt_text/index.cjs +31 -57
  2. package/build/alt_text/index.cjs.map +1 -7
  3. package/build/attached_to/edit.cjs +98 -133
  4. package/build/attached_to/edit.cjs.map +1 -7
  5. package/build/attached_to/index.cjs +33 -38
  6. package/build/attached_to/index.cjs.map +1 -7
  7. package/build/attached_to/view.cjs +25 -46
  8. package/build/attached_to/view.cjs.map +1 -7
  9. package/build/author/index.cjs +43 -56
  10. package/build/author/index.cjs.map +1 -7
  11. package/build/author/view.cjs +67 -74
  12. package/build/author/view.cjs.map +1 -7
  13. package/build/caption/index.cjs +21 -39
  14. package/build/caption/index.cjs.map +1 -7
  15. package/build/date_added/index.cjs +13 -34
  16. package/build/date_added/index.cjs.map +1 -7
  17. package/build/date_modified/index.cjs +13 -34
  18. package/build/date_modified/index.cjs.map +1 -7
  19. package/build/description/index.cjs +22 -40
  20. package/build/description/index.cjs.map +1 -7
  21. package/build/filename/index.cjs +33 -39
  22. package/build/filename/index.cjs.map +1 -7
  23. package/build/filename/view.cjs +23 -51
  24. package/build/filename/view.cjs.map +1 -7
  25. package/build/filesize/index.cjs +54 -83
  26. package/build/filesize/index.cjs.map +1 -7
  27. package/build/index.cjs +111 -63
  28. package/build/media_dimensions/index.cjs +19 -42
  29. package/build/media_dimensions/index.cjs.map +1 -7
  30. package/build/media_thumbnail/index.cjs +30 -36
  31. package/build/media_thumbnail/index.cjs.map +1 -7
  32. package/build/media_thumbnail/view.cjs +117 -164
  33. package/build/media_thumbnail/view.cjs.map +1 -7
  34. package/build/mime_type/index.cjs +16 -37
  35. package/build/mime_type/index.cjs.map +1 -7
  36. package/build/types.cjs +4 -18
  37. package/build/utils/get-media-type-from-mime-type.cjs +41 -56
  38. package/build/utils/get-media-type-from-mime-type.cjs.map +1 -7
  39. package/build/utils/get-raw-content.cjs +23 -38
  40. package/build/utils/get-raw-content.cjs.map +1 -7
  41. package/build/utils/get-rendered-content.cjs +23 -38
  42. package/build/utils/get-rendered-content.cjs.map +1 -7
  43. package/build-module/alt_text/index.mjs +25 -35
  44. package/build-module/alt_text/index.mjs.map +1 -7
  45. package/build-module/attached_to/edit.mjs +88 -110
  46. package/build-module/attached_to/edit.mjs.map +1 -7
  47. package/build-module/attached_to/index.mjs +12 -14
  48. package/build-module/attached_to/index.mjs.map +1 -7
  49. package/build-module/attached_to/view.mjs +19 -24
  50. package/build-module/attached_to/view.mjs.map +1 -7
  51. package/build-module/author/index.mjs +23 -32
  52. package/build-module/author/index.mjs.map +1 -7
  53. package/build-module/author/view.mjs +47 -53
  54. package/build-module/author/view.mjs.map +1 -7
  55. package/build-module/caption/index.mjs +16 -18
  56. package/build-module/caption/index.mjs.map +1 -7
  57. package/build-module/date_added/index.mjs +10 -14
  58. package/build-module/date_added/index.mjs.map +1 -7
  59. package/build-module/date_modified/index.mjs +10 -14
  60. package/build-module/date_modified/index.mjs.map +1 -7
  61. package/build-module/description/index.mjs +16 -18
  62. package/build-module/description/index.mjs.map +1 -7
  63. package/build-module/filename/index.mjs +13 -15
  64. package/build-module/filename/index.mjs.map +1 -7
  65. package/build-module/filename/view.mjs +16 -28
  66. package/build-module/filename/view.mjs.map +1 -7
  67. package/build-module/filesize/index.mjs +50 -63
  68. package/build-module/filesize/index.mjs.map +1 -7
  69. package/build-module/index.mjs +13 -28
  70. package/build-module/media_dimensions/index.mjs +15 -22
  71. package/build-module/media_dimensions/index.mjs.map +1 -7
  72. package/build-module/media_thumbnail/index.mjs +11 -13
  73. package/build-module/media_thumbnail/index.mjs.map +1 -7
  74. package/build-module/media_thumbnail/view.mjs +94 -138
  75. package/build-module/media_thumbnail/view.mjs.map +1 -7
  76. package/build-module/mime_type/index.mjs +13 -17
  77. package/build-module/mime_type/index.mjs.map +1 -7
  78. package/build-module/types.mjs +0 -1
  79. package/build-module/utils/get-media-type-from-mime-type.mjs +37 -32
  80. package/build-module/utils/get-media-type-from-mime-type.mjs.map +1 -7
  81. package/build-module/utils/get-raw-content.mjs +19 -14
  82. package/build-module/utils/get-raw-content.mjs.map +1 -7
  83. package/build-module/utils/get-rendered-content.mjs +19 -14
  84. package/build-module/utils/get-rendered-content.mjs.map +1 -7
  85. package/build-types/media_thumbnail/view.d.ts.map +1 -1
  86. package/package.json +16 -17
  87. package/src/media_thumbnail/view.tsx +1 -3
  88. package/CHANGELOG.md +0 -59
  89. package/build/index.cjs.map +0 -7
  90. package/build/types.cjs.map +0 -7
  91. package/build-module/index.mjs.map +0 -7
  92. package/build-module/types.mjs.map +0 -7
@@ -1 +0,0 @@
1
- //# sourceMappingURL=types.mjs.map
@@ -1,35 +1,40 @@
1
- // packages/media-fields/src/utils/get-media-type-from-mime-type.ts
2
1
  import { __ } from "@wordpress/i18n";
3
- import { audio, video, image, file } from "@wordpress/icons";
2
+ import { audio, file, image, video } from "@wordpress/icons";
3
+ // packages/media-fields/src/utils/get-media-type-from-mime-type.ts
4
+ /**
5
+ * Get the media type from a mime type, including an icon.
6
+ * TODO - media types should be formalized somewhere.
7
+ *
8
+ * References:
9
+ * https://developer.wordpress.org/reference/functions/wp_mime_type_icon/
10
+ * https://developer.wordpress.org/reference/hooks/mime_types/
11
+ * https://developer.wordpress.org/reference/functions/wp_get_mime_types/
12
+ *
13
+ * @param mimeType - The mime type to get the media type from.
14
+ * @return The media type.
15
+ */
4
16
  function getMediaTypeFromMimeType(mimeType) {
5
- if (mimeType.startsWith("image/")) {
6
- return {
7
- type: "image",
8
- label: __("Image"),
9
- icon: image
10
- };
11
- }
12
- if (mimeType.startsWith("video/")) {
13
- return {
14
- type: "video",
15
- label: __("Video"),
16
- icon: video
17
- };
18
- }
19
- if (mimeType.startsWith("audio/")) {
20
- return {
21
- type: "audio",
22
- label: __("Audio"),
23
- icon: audio
24
- };
25
- }
26
- return {
27
- type: "application",
28
- label: __("Application"),
29
- icon: file
30
- };
17
+ if (mimeType.startsWith("image/")) return {
18
+ type: "image",
19
+ label: __("Image"),
20
+ icon: image
21
+ };
22
+ if (mimeType.startsWith("video/")) return {
23
+ type: "video",
24
+ label: __("Video"),
25
+ icon: video
26
+ };
27
+ if (mimeType.startsWith("audio/")) return {
28
+ type: "audio",
29
+ label: __("Audio"),
30
+ icon: audio
31
+ };
32
+ return {
33
+ type: "application",
34
+ label: __("Application"),
35
+ icon: file
36
+ };
31
37
  }
32
- export {
33
- getMediaTypeFromMimeType
34
- };
35
- //# sourceMappingURL=get-media-type-from-mime-type.mjs.map
38
+ export { getMediaTypeFromMimeType };
39
+
40
+ //# sourceMappingURL=get-media-type-from-mime-type.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/get-media-type-from-mime-type.ts"],
4
- "sourcesContent": ["import { __ } from '@wordpress/i18n';\nimport { audio, video, image, file } from '@wordpress/icons';\nimport type { MediaType } from '../types';\n\n/**\n * Get the media type from a mime type, including an icon.\n * TODO - media types should be formalized somewhere.\n *\n * References:\n * https://developer.wordpress.org/reference/functions/wp_mime_type_icon/\n * https://developer.wordpress.org/reference/hooks/mime_types/\n * https://developer.wordpress.org/reference/functions/wp_get_mime_types/\n *\n * @param mimeType - The mime type to get the media type from.\n * @return The media type.\n */\nexport function getMediaTypeFromMimeType( mimeType: string ): MediaType {\n\tif ( mimeType.startsWith( 'image/' ) ) {\n\t\treturn {\n\t\t\ttype: 'image',\n\t\t\tlabel: __( 'Image' ),\n\t\t\ticon: image,\n\t\t};\n\t}\n\n\tif ( mimeType.startsWith( 'video/' ) ) {\n\t\treturn {\n\t\t\ttype: 'video',\n\t\t\tlabel: __( 'Video' ),\n\t\t\ticon: video,\n\t\t};\n\t}\n\n\tif ( mimeType.startsWith( 'audio/' ) ) {\n\t\treturn {\n\t\t\ttype: 'audio',\n\t\t\tlabel: __( 'Audio' ),\n\t\t\ticon: audio,\n\t\t};\n\t}\n\n\treturn {\n\t\ttype: 'application',\n\t\tlabel: __( 'Application' ),\n\t\ticon: file,\n\t};\n}\n"],
5
- "mappings": ";AAAA,SAAS,UAAU;AACnB,SAAS,OAAO,OAAO,OAAO,YAAY;AAenC,SAAS,yBAA0B,UAA8B;AACvE,MAAK,SAAS,WAAY,QAAS,GAAI;AACtC,WAAO;AAAA,MACN,MAAM;AAAA,MACN,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,IACP;AAAA,EACD;AAEA,MAAK,SAAS,WAAY,QAAS,GAAI;AACtC,WAAO;AAAA,MACN,MAAM;AAAA,MACN,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,IACP;AAAA,EACD;AAEA,MAAK,SAAS,WAAY,QAAS,GAAI;AACtC,WAAO;AAAA,MACN,MAAM;AAAA,MACN,OAAO,GAAI,OAAQ;AAAA,MACnB,MAAM;AAAA,IACP;AAAA,EACD;AAEA,SAAO;AAAA,IACN,MAAM;AAAA,IACN,OAAO,GAAI,aAAc;AAAA,IACzB,MAAM;AAAA,EACP;AACD;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"get-media-type-from-mime-type.mjs","names":[],"sources":["../../src/utils/get-media-type-from-mime-type.ts"],"sourcesContent":["import { __ } from '@wordpress/i18n';\nimport { audio, video, image, file } from '@wordpress/icons';\nimport type { MediaType } from '../types';\n\n/**\n * Get the media type from a mime type, including an icon.\n * TODO - media types should be formalized somewhere.\n *\n * References:\n * https://developer.wordpress.org/reference/functions/wp_mime_type_icon/\n * https://developer.wordpress.org/reference/hooks/mime_types/\n * https://developer.wordpress.org/reference/functions/wp_get_mime_types/\n *\n * @param mimeType - The mime type to get the media type from.\n * @return The media type.\n */\nexport function getMediaTypeFromMimeType( mimeType: string ): MediaType {\n\tif ( mimeType.startsWith( 'image/' ) ) {\n\t\treturn {\n\t\t\ttype: 'image',\n\t\t\tlabel: __( 'Image' ),\n\t\t\ticon: image,\n\t\t};\n\t}\n\n\tif ( mimeType.startsWith( 'video/' ) ) {\n\t\treturn {\n\t\t\ttype: 'video',\n\t\t\tlabel: __( 'Video' ),\n\t\t\ticon: video,\n\t\t};\n\t}\n\n\tif ( mimeType.startsWith( 'audio/' ) ) {\n\t\treturn {\n\t\t\ttype: 'audio',\n\t\t\tlabel: __( 'Audio' ),\n\t\t\ticon: audio,\n\t\t};\n\t}\n\n\treturn {\n\t\ttype: 'application',\n\t\tlabel: __( 'Application' ),\n\t\ticon: file,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,SAAgB,yBAA0B,UAA8B;CACvE,IAAK,SAAS,WAAY,QAAS,GAClC,OAAO;EACN,MAAM;EACN,OAAO,GAAI,OAAQ;EACnB,MAAM;CACP;CAGD,IAAK,SAAS,WAAY,QAAS,GAClC,OAAO;EACN,MAAM;EACN,OAAO,GAAI,OAAQ;EACnB,MAAM;CACP;CAGD,IAAK,SAAS,WAAY,QAAS,GAClC,OAAO;EACN,MAAM;EACN,OAAO,GAAI,OAAQ;EACnB,MAAM;CACP;CAGD,OAAO;EACN,MAAM;EACN,OAAO,GAAI,aAAc;EACzB,MAAM;CACP;AACD"}
@@ -1,17 +1,22 @@
1
1
  // packages/media-fields/src/utils/get-raw-content.ts
2
+ /**
3
+ * Utility function to extract raw content from either a string or an object
4
+ * containing raw and rendered properties.
5
+ *
6
+ * This handles the inconsistency in WordPress REST API responses where
7
+ * some fields like caption and description can be either:
8
+ * - A simple string
9
+ * - An object with { raw: string, rendered: string }
10
+ *
11
+ * @param content - The content to extract raw value from
12
+ * @return The raw content string, or empty string if content is falsy
13
+ */
2
14
  function getRawContent(content) {
3
- if (!content) {
4
- return "";
5
- }
6
- if (typeof content === "string") {
7
- return content;
8
- }
9
- if (typeof content === "object" && "raw" in content) {
10
- return content.raw || "";
11
- }
12
- return "";
15
+ if (!content) return "";
16
+ if (typeof content === "string") return content;
17
+ if (typeof content === "object" && "raw" in content) return content.raw || "";
18
+ return "";
13
19
  }
14
- export {
15
- getRawContent
16
- };
17
- //# sourceMappingURL=get-raw-content.mjs.map
20
+ export { getRawContent };
21
+
22
+ //# sourceMappingURL=get-raw-content.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/get-raw-content.ts"],
4
- "sourcesContent": ["/**\n * Utility function to extract raw content from either a string or an object\n * containing raw and rendered properties.\n *\n * This handles the inconsistency in WordPress REST API responses where\n * some fields like caption and description can be either:\n * - A simple string\n * - An object with { raw: string, rendered: string }\n *\n * @param content - The content to extract raw value from\n * @return The raw content string, or empty string if content is falsy\n */\nexport function getRawContent(\n\tcontent: string | { raw: string; rendered: string } | undefined | null\n): string {\n\tif ( ! content ) {\n\t\treturn '';\n\t}\n\n\t// If it's a string, return it directly\n\tif ( typeof content === 'string' ) {\n\t\treturn content;\n\t}\n\n\t// If it's an object with raw property, return the raw value\n\tif ( typeof content === 'object' && 'raw' in content ) {\n\t\treturn content.raw || '';\n\t}\n\n\t// Fallback to empty string\n\treturn '';\n}\n"],
5
- "mappings": ";AAYO,SAAS,cACf,SACS;AACT,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,YAAY,YAAY,SAAS,SAAU;AACtD,WAAO,QAAQ,OAAO;AAAA,EACvB;AAGA,SAAO;AACR;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"get-raw-content.mjs","names":[],"sources":["../../src/utils/get-raw-content.ts"],"sourcesContent":["/**\n * Utility function to extract raw content from either a string or an object\n * containing raw and rendered properties.\n *\n * This handles the inconsistency in WordPress REST API responses where\n * some fields like caption and description can be either:\n * - A simple string\n * - An object with { raw: string, rendered: string }\n *\n * @param content - The content to extract raw value from\n * @return The raw content string, or empty string if content is falsy\n */\nexport function getRawContent(\n\tcontent: string | { raw: string; rendered: string } | undefined | null\n): string {\n\tif ( ! content ) {\n\t\treturn '';\n\t}\n\n\t// If it's a string, return it directly\n\tif ( typeof content === 'string' ) {\n\t\treturn content;\n\t}\n\n\t// If it's an object with raw property, return the raw value\n\tif ( typeof content === 'object' && 'raw' in content ) {\n\t\treturn content.raw || '';\n\t}\n\n\t// Fallback to empty string\n\treturn '';\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,cACf,SACS;CACT,IAAK,CAAE,SACN,OAAO;CAIR,IAAK,OAAO,YAAY,UACvB,OAAO;CAIR,IAAK,OAAO,YAAY,YAAY,SAAS,SAC5C,OAAO,QAAQ,OAAO;CAIvB,OAAO;AACR"}
@@ -1,17 +1,22 @@
1
1
  // packages/media-fields/src/utils/get-rendered-content.ts
2
+ /**
3
+ * Utility function to extract rendered content from either a string or an object
4
+ * containing raw and rendered properties.
5
+ *
6
+ * This handles the inconsistency in WordPress REST API responses where
7
+ * some fields like caption and description can be either:
8
+ * - A simple string
9
+ * - An object with { raw: string, rendered: string }
10
+ *
11
+ * @param content - The content to extract raw value from
12
+ * @return The rendered content string, falling back to raw or empty string if content is falsy
13
+ */
2
14
  function getRenderedContent(content) {
3
- if (!content) {
4
- return "";
5
- }
6
- if (typeof content === "string") {
7
- return content;
8
- }
9
- if (typeof content === "object") {
10
- return content.rendered || content.raw || "";
11
- }
12
- return "";
15
+ if (!content) return "";
16
+ if (typeof content === "string") return content;
17
+ if (typeof content === "object") return content.rendered || content.raw || "";
18
+ return "";
13
19
  }
14
- export {
15
- getRenderedContent
16
- };
17
- //# sourceMappingURL=get-rendered-content.mjs.map
20
+ export { getRenderedContent };
21
+
22
+ //# sourceMappingURL=get-rendered-content.mjs.map
@@ -1,7 +1 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/utils/get-rendered-content.ts"],
4
- "sourcesContent": ["/**\n * Utility function to extract rendered content from either a string or an object\n * containing raw and rendered properties.\n *\n * This handles the inconsistency in WordPress REST API responses where\n * some fields like caption and description can be either:\n * - A simple string\n * - An object with { raw: string, rendered: string }\n *\n * @param content - The content to extract raw value from\n * @return The rendered content string, falling back to raw or empty string if content is falsy\n */\nexport function getRenderedContent(\n\tcontent: string | { raw: string; rendered: string } | undefined | null\n): string {\n\tif ( ! content ) {\n\t\treturn '';\n\t}\n\n\t// If it's a string, return it directly\n\tif ( typeof content === 'string' ) {\n\t\treturn content;\n\t}\n\n\t// If it's an object with raw property, return the raw value\n\tif ( typeof content === 'object' ) {\n\t\treturn content.rendered || content.raw || '';\n\t}\n\n\t// Fallback to empty string\n\treturn '';\n}\n"],
5
- "mappings": ";AAYO,SAAS,mBACf,SACS;AACT,MAAK,CAAE,SAAU;AAChB,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO;AAAA,EACR;AAGA,MAAK,OAAO,YAAY,UAAW;AAClC,WAAO,QAAQ,YAAY,QAAQ,OAAO;AAAA,EAC3C;AAGA,SAAO;AACR;",
6
- "names": []
7
- }
1
+ {"version":3,"file":"get-rendered-content.mjs","names":[],"sources":["../../src/utils/get-rendered-content.ts"],"sourcesContent":["/**\n * Utility function to extract rendered content from either a string or an object\n * containing raw and rendered properties.\n *\n * This handles the inconsistency in WordPress REST API responses where\n * some fields like caption and description can be either:\n * - A simple string\n * - An object with { raw: string, rendered: string }\n *\n * @param content - The content to extract raw value from\n * @return The rendered content string, falling back to raw or empty string if content is falsy\n */\nexport function getRenderedContent(\n\tcontent: string | { raw: string; rendered: string } | undefined | null\n): string {\n\tif ( ! content ) {\n\t\treturn '';\n\t}\n\n\t// If it's a string, return it directly\n\tif ( typeof content === 'string' ) {\n\t\treturn content;\n\t}\n\n\t// If it's an object with raw property, return the raw value\n\tif ( typeof content === 'object' ) {\n\t\treturn content.rendered || content.raw || '';\n\t}\n\n\t// Fallback to empty string\n\treturn '';\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,SAAgB,mBACf,SACS;CACT,IAAK,CAAE,SACN,OAAO;CAIR,IAAK,OAAO,YAAY,UACvB,OAAO;CAIR,IAAK,OAAO,YAAY,UACvB,OAAO,QAAQ,YAAY,QAAQ,OAAO;CAI3C,OAAO;AACR"}
@@ -1 +1 @@
1
- {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/media_thumbnail/view.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,aAAa,EAAE,UAAU,GAAG,SAAS,EACrC,WAAW,CAAC,EAAE,MAAM,GAClB,MAAM,CAwCR;AA4FD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,EAC3C,IAAI,EACJ,MAAM,GACN,EAAE,wBAAwB,CAAE,SAAS,CAAE,sCA4CvC"}
1
+ {"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/media_thumbnail/view.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAErE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC9B,aAAa,EAAE,UAAU,GAAG,SAAS,EACrC,WAAW,CAAC,EAAE,MAAM,GAClB,MAAM,CAsCR;AA4FD,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAE,EAC3C,IAAI,EACJ,MAAM,GACN,EAAE,wBAAwB,CAAE,SAAS,CAAE,sCA4CvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/media-fields",
3
- "version": "0.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "Reusable field definitions for displaying and editing media attachment properties in WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -21,15 +21,14 @@
21
21
  "url": "https://github.com/WordPress/gutenberg/issues"
22
22
  },
23
23
  "engines": {
24
- "node": ">=18.12.0"
24
+ "node": ">=22.13.0"
25
25
  },
26
26
  "files": [
27
27
  "src",
28
28
  "build",
29
29
  "build-module",
30
30
  "build-style",
31
- "build-types",
32
- "*.md"
31
+ "build-types"
33
32
  ],
34
33
  "main": "build/index.cjs",
35
34
  "module": "build-module/index.mjs",
@@ -47,24 +46,24 @@
47
46
  "src/**/*.scss"
48
47
  ],
49
48
  "dependencies": {
50
- "@wordpress/base-styles": "^13.3.0",
51
- "@wordpress/components": "^42.0.0",
52
- "@wordpress/compose": "^8.10.0",
53
- "@wordpress/core-data": "^8.2.0",
54
- "@wordpress/data": "^10.57.0",
55
- "@wordpress/dataviews": "^20.0.0",
56
- "@wordpress/element": "^9.0.0",
57
- "@wordpress/i18n": "^6.30.0",
58
- "@wordpress/icons": "^18.0.0",
59
- "@wordpress/ui": "^0.24.0",
60
- "@wordpress/url": "^4.57.0",
49
+ "@wordpress/base-styles": "^15.0.0",
50
+ "@wordpress/components": "^44.0.0",
51
+ "@wordpress/compose": "^9.1.0",
52
+ "@wordpress/core-data": "^9.1.0",
53
+ "@wordpress/data": "^11.1.0",
54
+ "@wordpress/dataviews": "^22.0.0",
55
+ "@wordpress/element": "^10.1.0",
56
+ "@wordpress/i18n": "^7.1.0",
57
+ "@wordpress/icons": "^20.0.0",
58
+ "@wordpress/ui": "^0.26.0",
59
+ "@wordpress/url": "^5.1.0",
61
60
  "clsx": "^2.1.1"
62
61
  },
63
62
  "devDependencies": {
64
63
  "@testing-library/dom": "^10.4.2",
65
64
  "@testing-library/jest-dom": "^7.0.1",
66
65
  "@testing-library/react": "^16.3.3",
67
- "vitest": "^5.0.3"
66
+ "vitest": "^5.0.5"
68
67
  },
69
68
  "peerDependencies": {
70
69
  "@types/react": "^18 || ^19",
@@ -83,5 +82,5 @@
83
82
  "publishConfig": {
84
83
  "access": "public"
85
84
  },
86
- "gitHead": "12441e2520c78b2254a792a8cba40c34110be060"
85
+ "gitHead": "9b70363b9f93cff0583a1f3153738d383cf5a49e"
87
86
  }
@@ -50,9 +50,7 @@ export function getBestImageUrl(
50
50
  }
51
51
 
52
52
  // Sort ascending by width.
53
- const sorted = [ ...validEntries ].sort(
54
- ( a, b ) => a.width - b.width
55
- );
53
+ const sorted = validEntries.toSorted( ( a, b ) => a.width - b.width );
56
54
  // Pick the smallest size that is >= target width.
57
55
  const match = sorted.find( ( s ) => s.width >= targetWidth );
58
56
  if ( match ) {
package/CHANGELOG.md DELETED
@@ -1,59 +0,0 @@
1
- <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. -->
2
-
3
- ## Unreleased
4
-
5
- ## 0.22.0 (2026-10-07)
6
-
7
- ### Bug Fixes
8
-
9
- - Declare `react-dom` and `@types/react-dom` as peer dependencies, forwarding the peers of `@wordpress/element`, so strict package managers such as Yarn PnP can resolve them ([#83765](https://github.com/WordPress/gutenberg/pull/83765)).
10
-
11
- ## 0.21.0 (2026-09-23)
12
-
13
- ## 0.20.0 (2026-09-10)
14
-
15
- ### Bug Fixes
16
-
17
- - `author`: Drop the custom `sort` callback, which read `_embedded.author` from the arguments although `Field.sort` receives the field values (the author ids), so every comparison returned `0` and in-memory sorting by author was a no-op. The field now sorts by author id through the `integer` type, matching the order the REST API returns for `orderby=author` ([#82559](https://github.com/WordPress/gutenberg/pull/82559)).
18
- - `alt_text`, `caption`, `description`: Pass the field's disabled state to the textarea control, so disabling one of these fields stops it accepting input. ([#82516](https://github.com/WordPress/gutenberg/pull/82516))
19
-
20
- ### Internal
21
-
22
- - `caption`: Replace the custom `Edit` component with the built-in `textarea` control ([#82539](https://github.com/WordPress/gutenberg/pull/82539)).
23
- - `alt_text`: Replace the custom `Edit` component with the built-in `textarea` control, passing the help text as the field's `description` ([#82539](https://github.com/WordPress/gutenberg/pull/82539)).
24
- - `description`: Replace the custom `Edit` component with the built-in `textarea` control ([#82539](https://github.com/WordPress/gutenberg/pull/82539)).
25
- - Remove unused dependencies `@wordpress/date` and `@wordpress/primitives` ([#82103](https://github.com/WordPress/gutenberg/pull/82103)).
26
- - Remove tsconfig project references to packages that are not dependencies ([#82106](https://github.com/WordPress/gutenberg/pull/82106)).
27
-
28
- ## 0.19.0 (2026-08-26)
29
-
30
- ### Internal
31
-
32
- - Split tsconfig into a build project and a default dev project so dev files are type checked without publishing their declarations. ([#81514](https://github.com/WordPress/gutenberg/pull/81514))
33
- - `attached_to`: Narrow the combobox `onChange` handler parameter to `string | null`, following the upstream `ComboboxControl` type fix that removed the accidental `undefined` from the callback type. ([#81568](https://github.com/WordPress/gutenberg/pull/81568))
34
-
35
- ## 0.18.0 (2026-08-12)
36
-
37
- ### Bug Fixes
38
-
39
- - `attached_to`: Reserve room for the suggestions so the field's DataForm panel dropdown is placed with space for them, instead of being sized to the row and then crushing them into a box too small to scroll comfortably. Also don't expand the suggestion list until the user searches, debounce the search so a request isn't fired per keystroke, allow re-attaching straight after detaching, and drop the detach link from the help text in favour of the field's own reset button ([#81122](https://github.com/WordPress/gutenberg/issues/81122)).
40
-
41
- ## 0.17.0 (2026-07-29)
42
-
43
- ## 0.16.0 (2026-07-14)
44
-
45
- ### Enhancements
46
-
47
- - Widen React peer dependency ranges to `^18 || ^19` to support both React 18 and React 19 environments ([#80024](https://github.com/WordPress/gutenberg/pull/80024)).
48
-
49
- ## 0.15.0 (2026-07-01)
50
-
51
- ## 0.14.0 (2026-06-24)
52
-
53
- ## 0.13.1 (2026-06-16)
54
-
55
- ## 0.13.0 (2026-06-10)
56
-
57
- ### Code Quality
58
-
59
- - Add missing `@types/react` dependency. [#78882](https://github.com/WordPress/gutenberg/pull/78882).
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export { default as altTextField } from './alt_text';\nexport { default as attachedToField } from './attached_to';\nexport { default as authorField } from './author';\nexport { default as captionField } from './caption';\nexport { default as dateAddedField } from './date_added';\nexport { default as dateModifiedField } from './date_modified';\nexport { default as descriptionField } from './description';\nexport { default as filenameField } from './filename';\nexport { default as filesizeField } from './filesize';\nexport { default as mediaDimensionsField } from './media_dimensions';\nexport { default as mediaThumbnailField } from './media_thumbnail';\nexport { default as mimeTypeField } from './mime_type';\n\nexport type {\n\tMediaItem,\n\tMediaKind,\n\tMediaType,\n\tMediaItemUpdatable,\n} from './types';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAwC;AACxC,yBAA2C;AAC3C,oBAAuC;AACvC,qBAAwC;AACxC,wBAA0C;AAC1C,2BAA6C;AAC7C,yBAA4C;AAC5C,sBAAyC;AACzC,sBAAyC;AACzC,8BAAgD;AAChD,6BAA+C;AAC/C,uBAAyC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/types.ts"],
4
- "sourcesContent": ["import type { Attachment, Updatable, Post, User } from '@wordpress/core-data';\n\nexport type MediaKind = 'image' | 'video' | 'audio' | 'application';\n\nexport interface MediaType {\n\ttype: MediaKind;\n\tlabel: string;\n\ticon: React.JSX.Element;\n}\n\n// TODO: Update the Attachment type separately.\nexport interface MediaItem extends Attachment< 'edit' > {\n\t// featured_media is not in the Attachment type. See https://github.com/WordPress/gutenberg/blob/trunk/packages/core-data/src/entity-types/attachment.ts#L10\n\tfeatured_media: number;\n\t_embedded?: {\n\t\t// TODO: Include wp:attached-to properly, and backport PHP changes from wordpress-develop to support this.\n\t\t'wp:attached-to'?: Post[] | Partial< Post >[];\n\t\tauthor?: User[] | Partial< User >[];\n\t};\n}\n\nexport type MediaItemUpdatable = Updatable< Attachment >;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/index.ts"],
4
- "sourcesContent": ["export { default as altTextField } from './alt_text';\nexport { default as attachedToField } from './attached_to';\nexport { default as authorField } from './author';\nexport { default as captionField } from './caption';\nexport { default as dateAddedField } from './date_added';\nexport { default as dateModifiedField } from './date_modified';\nexport { default as descriptionField } from './description';\nexport { default as filenameField } from './filename';\nexport { default as filesizeField } from './filesize';\nexport { default as mediaDimensionsField } from './media_dimensions';\nexport { default as mediaThumbnailField } from './media_thumbnail';\nexport { default as mimeTypeField } from './mime_type';\n\nexport type {\n\tMediaItem,\n\tMediaKind,\n\tMediaType,\n\tMediaItemUpdatable,\n} from './types';\n"],
5
- "mappings": ";AAAA,SAAoB,WAAXA,gBAA+B;AACxC,SAAoB,WAAXA,gBAAkC;AAC3C,SAAoB,WAAXA,gBAA8B;AACvC,SAAoB,WAAXA,gBAA+B;AACxC,SAAoB,WAAXA,gBAAiC;AAC1C,SAAoB,WAAXA,gBAAoC;AAC7C,SAAoB,WAAXA,gBAAmC;AAC5C,SAAoB,WAAXA,gBAAgC;AACzC,SAAoB,WAAXA,iBAAgC;AACzC,SAAoB,WAAXA,iBAAuC;AAChD,SAAoB,WAAXA,iBAAsC;AAC/C,SAAoB,WAAXA,iBAAgC;",
6
- "names": ["default"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": [],
4
- "sourcesContent": [],
5
- "mappings": "",
6
- "names": []
7
- }