@wordpress/block-library 10.0.1-next.v.202606191442.0 → 10.1.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 (249) hide show
  1. package/CHANGELOG.md +4 -1
  2. package/build/audio/edit.cjs +8 -1
  3. package/build/audio/edit.cjs.map +2 -2
  4. package/build/breadcrumbs/edit.cjs +0 -1
  5. package/build/breadcrumbs/edit.cjs.map +2 -2
  6. package/build/button/edit.cjs +0 -1
  7. package/build/button/edit.cjs.map +2 -2
  8. package/build/cover/edit/embed-video-url-input.cjs +0 -1
  9. package/build/cover/edit/embed-video-url-input.cjs.map +2 -2
  10. package/build/details/edit.cjs +0 -1
  11. package/build/details/edit.cjs.map +2 -2
  12. package/build/form/edit.cjs +0 -2
  13. package/build/form/edit.cjs.map +2 -2
  14. package/build/form-input/edit.cjs +0 -2
  15. package/build/form-input/edit.cjs.map +2 -2
  16. package/build/freeform/edit.cjs +5 -14
  17. package/build/freeform/edit.cjs.map +3 -3
  18. package/build/freeform/migration-notice.cjs.map +2 -2
  19. package/build/home-link/edit.cjs +0 -1
  20. package/build/home-link/edit.cjs.map +2 -2
  21. package/build/html/modal.cjs +6 -3
  22. package/build/html/modal.cjs.map +2 -2
  23. package/build/icon/edit.cjs +2 -4
  24. package/build/icon/edit.cjs.map +2 -2
  25. package/build/image/image.cjs +0 -2
  26. package/build/image/image.cjs.map +2 -2
  27. package/build/image/use-open-image-media-editor-modal.cjs +5 -25
  28. package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
  29. package/build/list/ordered-list-settings.cjs +0 -1
  30. package/build/list/ordered-list-settings.cjs.map +2 -2
  31. package/build/navigation/edit/index.cjs +9 -9
  32. package/build/navigation/edit/index.cjs.map +2 -2
  33. package/build/navigation/edit/navigation-menu-name-control.cjs +0 -1
  34. package/build/navigation/edit/navigation-menu-name-control.cjs.map +2 -2
  35. package/build/navigation-link/block.json +1 -1
  36. package/build/navigation-link/link-ui/page-creator.cjs +0 -1
  37. package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
  38. package/build/navigation-link/shared/controls.cjs +0 -2
  39. package/build/navigation-link/shared/controls.cjs.map +2 -2
  40. package/build/playlist-track/edit.cjs +0 -3
  41. package/build/playlist-track/edit.cjs.map +2 -2
  42. package/build/post-comment/edit.cjs +0 -1
  43. package/build/post-comment/edit.cjs.map +2 -2
  44. package/build/post-featured-image/edit.cjs +0 -1
  45. package/build/post-featured-image/edit.cjs.map +2 -2
  46. package/build/post-terms/edit.cjs +0 -1
  47. package/build/post-terms/edit.cjs.map +2 -2
  48. package/build/post-title/edit.cjs +0 -1
  49. package/build/post-title/edit.cjs.map +2 -2
  50. package/build/query/edit/enhanced-pagination-modal.cjs +10 -1
  51. package/build/query/edit/enhanced-pagination-modal.cjs.map +3 -3
  52. package/build/query/edit/inspector-controls/index.cjs +0 -1
  53. package/build/query/edit/inspector-controls/index.cjs.map +2 -2
  54. package/build/rss/edit.cjs +0 -1
  55. package/build/rss/edit.cjs.map +2 -2
  56. package/build/search/block.json +4 -0
  57. package/build/search/edit.cjs +242 -204
  58. package/build/search/edit.cjs.map +2 -2
  59. package/build/site-logo/edit.cjs +2 -1
  60. package/build/site-logo/edit.cjs.map +2 -2
  61. package/build/social-link/edit.cjs +0 -3
  62. package/build/social-link/edit.cjs.map +2 -2
  63. package/build/tab-list/block.json +2 -2
  64. package/build/tab-list/edit.cjs +14 -8
  65. package/build/tab-list/edit.cjs.map +2 -2
  66. package/build/tab-list/init.cjs +28 -0
  67. package/build/tab-list/init.cjs.map +7 -0
  68. package/build/tab-panel/edit.cjs +0 -9
  69. package/build/tab-panel/edit.cjs.map +2 -2
  70. package/build/tab-panel/save.cjs +2 -1
  71. package/build/tab-panel/save.cjs.map +2 -2
  72. package/build/tab-panels/block.json +0 -1
  73. package/build/tab-panels/init.cjs +28 -0
  74. package/build/tab-panels/init.cjs.map +7 -0
  75. package/build/table/edit.cjs +0 -2
  76. package/build/table/edit.cjs.map +2 -2
  77. package/build/tabs/view.cjs +20 -94
  78. package/build/tabs/view.cjs.map +2 -2
  79. package/build/template-part/edit/advanced-controls.cjs +0 -1
  80. package/build/template-part/edit/advanced-controls.cjs.map +2 -2
  81. package/build/template-part/edit/title-modal.cjs +1 -2
  82. package/build/template-part/edit/title-modal.cjs.map +2 -2
  83. package/build/video/edit.cjs +3 -2
  84. package/build/video/edit.cjs.map +2 -2
  85. package/build/video/tracks-editor.cjs +0 -2
  86. package/build/video/tracks-editor.cjs.map +2 -2
  87. package/build-module/audio/edit.mjs +8 -2
  88. package/build-module/audio/edit.mjs.map +2 -2
  89. package/build-module/breadcrumbs/edit.mjs +0 -1
  90. package/build-module/breadcrumbs/edit.mjs.map +2 -2
  91. package/build-module/button/edit.mjs +0 -1
  92. package/build-module/button/edit.mjs.map +2 -2
  93. package/build-module/cover/edit/embed-video-url-input.mjs +0 -1
  94. package/build-module/cover/edit/embed-video-url-input.mjs.map +2 -2
  95. package/build-module/details/edit.mjs +0 -1
  96. package/build-module/details/edit.mjs.map +2 -2
  97. package/build-module/form/edit.mjs +0 -2
  98. package/build-module/form/edit.mjs.map +2 -2
  99. package/build-module/form-input/edit.mjs +0 -2
  100. package/build-module/form-input/edit.mjs.map +2 -2
  101. package/build-module/freeform/edit.mjs +5 -14
  102. package/build-module/freeform/edit.mjs.map +2 -2
  103. package/build-module/freeform/migration-notice.mjs.map +2 -2
  104. package/build-module/home-link/edit.mjs +0 -1
  105. package/build-module/home-link/edit.mjs.map +2 -2
  106. package/build-module/html/modal.mjs +6 -3
  107. package/build-module/html/modal.mjs.map +2 -2
  108. package/build-module/icon/edit.mjs +2 -4
  109. package/build-module/icon/edit.mjs.map +2 -2
  110. package/build-module/image/image.mjs +0 -2
  111. package/build-module/image/image.mjs.map +2 -2
  112. package/build-module/image/use-open-image-media-editor-modal.mjs +5 -25
  113. package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
  114. package/build-module/list/ordered-list-settings.mjs +0 -1
  115. package/build-module/list/ordered-list-settings.mjs.map +2 -2
  116. package/build-module/navigation/edit/index.mjs +9 -9
  117. package/build-module/navigation/edit/index.mjs.map +2 -2
  118. package/build-module/navigation/edit/navigation-menu-name-control.mjs +0 -1
  119. package/build-module/navigation/edit/navigation-menu-name-control.mjs.map +2 -2
  120. package/build-module/navigation-link/block.json +1 -1
  121. package/build-module/navigation-link/link-ui/page-creator.mjs +0 -1
  122. package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
  123. package/build-module/navigation-link/shared/controls.mjs +0 -2
  124. package/build-module/navigation-link/shared/controls.mjs.map +2 -2
  125. package/build-module/playlist-track/edit.mjs +0 -3
  126. package/build-module/playlist-track/edit.mjs.map +2 -2
  127. package/build-module/post-comment/edit.mjs +0 -1
  128. package/build-module/post-comment/edit.mjs.map +2 -2
  129. package/build-module/post-featured-image/edit.mjs +0 -1
  130. package/build-module/post-featured-image/edit.mjs.map +2 -2
  131. package/build-module/post-terms/edit.mjs +0 -1
  132. package/build-module/post-terms/edit.mjs.map +2 -2
  133. package/build-module/post-title/edit.mjs +0 -1
  134. package/build-module/post-title/edit.mjs.map +2 -2
  135. package/build-module/query/edit/enhanced-pagination-modal.mjs +10 -1
  136. package/build-module/query/edit/enhanced-pagination-modal.mjs.map +2 -2
  137. package/build-module/query/edit/inspector-controls/index.mjs +0 -1
  138. package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
  139. package/build-module/rss/edit.mjs +0 -1
  140. package/build-module/rss/edit.mjs.map +2 -2
  141. package/build-module/search/block.json +4 -0
  142. package/build-module/search/edit.mjs +242 -204
  143. package/build-module/search/edit.mjs.map +2 -2
  144. package/build-module/site-logo/edit.mjs +2 -1
  145. package/build-module/site-logo/edit.mjs.map +2 -2
  146. package/build-module/social-link/edit.mjs +0 -3
  147. package/build-module/social-link/edit.mjs.map +2 -2
  148. package/build-module/tab-list/block.json +2 -2
  149. package/build-module/tab-list/edit.mjs +15 -9
  150. package/build-module/tab-list/edit.mjs.map +2 -2
  151. package/build-module/tab-list/init.mjs +7 -0
  152. package/build-module/tab-list/init.mjs.map +7 -0
  153. package/build-module/tab-panel/edit.mjs +1 -10
  154. package/build-module/tab-panel/edit.mjs.map +2 -2
  155. package/build-module/tab-panel/save.mjs +2 -1
  156. package/build-module/tab-panel/save.mjs.map +2 -2
  157. package/build-module/tab-panels/block.json +0 -1
  158. package/build-module/tab-panels/init.mjs +7 -0
  159. package/build-module/tab-panels/init.mjs.map +7 -0
  160. package/build-module/table/edit.mjs +0 -2
  161. package/build-module/table/edit.mjs.map +2 -2
  162. package/build-module/tabs/view.mjs +20 -94
  163. package/build-module/tabs/view.mjs.map +2 -2
  164. package/build-module/template-part/edit/advanced-controls.mjs +0 -1
  165. package/build-module/template-part/edit/advanced-controls.mjs.map +2 -2
  166. package/build-module/template-part/edit/title-modal.mjs +1 -2
  167. package/build-module/template-part/edit/title-modal.mjs.map +2 -2
  168. package/build-module/video/edit.mjs +3 -3
  169. package/build-module/video/edit.mjs.map +2 -2
  170. package/build-module/video/tracks-editor.mjs +0 -2
  171. package/build-module/video/tracks-editor.mjs.map +2 -2
  172. package/build-style/editor-rtl.css +0 -15
  173. package/build-style/editor.css +0 -15
  174. package/build-style/style-rtl.css +1 -1
  175. package/build-style/style.css +1 -1
  176. package/build-style/tab-list/style-rtl.css +1 -1
  177. package/build-style/tab-list/style.css +1 -1
  178. package/package.json +40 -40
  179. package/src/audio/edit.js +5 -9
  180. package/src/breadcrumbs/edit.js +0 -1
  181. package/src/button/edit.js +0 -1
  182. package/src/cover/edit/embed-video-url-input.js +0 -1
  183. package/src/cover/test/edit.js +51 -40
  184. package/src/details/edit.js +0 -1
  185. package/src/editor.scss +0 -1
  186. package/src/form/edit.js +0 -2
  187. package/src/form-input/edit.js +0 -2
  188. package/src/freeform/edit.js +6 -29
  189. package/src/freeform/migration-notice.js +2 -4
  190. package/src/home-link/edit.js +0 -1
  191. package/src/html/modal.js +3 -0
  192. package/src/icon/edit.js +0 -2
  193. package/src/image/image.js +0 -2
  194. package/src/image/test/use-open-image-media-editor-modal.js +20 -26
  195. package/src/image/use-open-image-media-editor-modal.js +24 -42
  196. package/src/list/ordered-list-settings.js +0 -1
  197. package/src/navigation/edit/index.js +9 -13
  198. package/src/navigation/edit/navigation-menu-name-control.js +0 -1
  199. package/src/navigation-link/README.md +1 -1
  200. package/src/navigation-link/block.json +1 -1
  201. package/src/navigation-link/link-ui/page-creator.js +0 -1
  202. package/src/navigation-link/shared/controls.js +0 -2
  203. package/src/navigation-link/test/__snapshots__/hooks.js.snap +5 -0
  204. package/src/playlist-track/edit.js +0 -3
  205. package/src/post-comment/edit.js +0 -1
  206. package/src/post-featured-image/edit.js +0 -1
  207. package/src/post-terms/edit.js +0 -1
  208. package/src/post-title/edit.js +0 -1
  209. package/src/query/edit/enhanced-pagination-modal.js +11 -1
  210. package/src/query/edit/inspector-controls/index.js +0 -1
  211. package/src/rss/edit.js +0 -1
  212. package/src/search/README.md +1 -0
  213. package/src/search/block.json +4 -0
  214. package/src/search/edit.js +106 -55
  215. package/src/search/index.php +25 -1
  216. package/src/site-logo/edit.js +3 -1
  217. package/src/social-link/edit.js +0 -3
  218. package/src/tab-list/README.md +1 -1
  219. package/src/tab-list/block.json +2 -2
  220. package/src/tab-list/edit.js +14 -8
  221. package/src/tab-list/index.php +4 -6
  222. package/src/tab-list/init.js +6 -0
  223. package/src/tab-list/style.scss +1 -2
  224. package/src/tab-panel/edit.js +1 -14
  225. package/src/tab-panel/index.php +2 -25
  226. package/src/tab-panel/save.js +1 -0
  227. package/src/tab-panels/block.json +0 -1
  228. package/src/tab-panels/init.js +6 -0
  229. package/src/table/edit.js +0 -2
  230. package/src/tabs/index.php +12 -19
  231. package/src/tabs/view.js +20 -100
  232. package/src/template-part/edit/advanced-controls.js +0 -1
  233. package/src/template-part/edit/title-modal.js +0 -1
  234. package/src/utils/test/style-state.js +26 -26
  235. package/src/video/edit.js +9 -16
  236. package/src/video/tracks-editor.js +0 -2
  237. package/build/freeform/convert-to-blocks-button.cjs +0 -40
  238. package/build/freeform/convert-to-blocks-button.cjs.map +0 -7
  239. package/build/list-item/utils.cjs +0 -57
  240. package/build/list-item/utils.cjs.map +0 -7
  241. package/build-module/freeform/convert-to-blocks-button.mjs +0 -19
  242. package/build-module/freeform/convert-to-blocks-button.mjs.map +0 -7
  243. package/build-module/list-item/utils.mjs +0 -32
  244. package/build-module/list-item/utils.mjs.map +0 -7
  245. package/build-style/tab-list/editor-rtl.css +0 -14
  246. package/build-style/tab-list/editor.css +0 -14
  247. package/src/freeform/convert-to-blocks-button.js +0 -18
  248. package/src/list-item/utils.js +0 -34
  249. package/src/tab-list/editor.scss +0 -17
package/src/tabs/view.js CHANGED
@@ -8,44 +8,8 @@ import {
8
8
  withSyncEvent,
9
9
  } from '@wordpress/interactivity';
10
10
 
11
- function createReadOnlyProxy( obj ) {
12
- const arrayMutationMethods = new Set( [
13
- 'push',
14
- 'pop',
15
- 'shift',
16
- 'unshift',
17
- 'splice',
18
- 'sort',
19
- 'reverse',
20
- 'copyWithin',
21
- 'fill',
22
- ] );
23
-
24
- return new Proxy( obj, {
25
- get( target, prop ) {
26
- // If accessing an array mutation method, return a no-op function.
27
- if ( Array.isArray( target ) && arrayMutationMethods.has( prop ) ) {
28
- return () => {};
29
- }
30
-
31
- const value = target[ prop ];
32
- if ( typeof value === 'object' && value !== null ) {
33
- return createReadOnlyProxy( value );
34
- }
35
- return value;
36
- },
37
- set() {
38
- return false;
39
- },
40
- deleteProperty() {
41
- return false;
42
- },
43
- } );
44
- }
45
-
46
- // Private store for internal tabs functionality and security.
47
- const { actions: privateActions, state: privateState } = store(
48
- 'core/tabs/private',
11
+ const { actions, state } = store(
12
+ 'core/tabs',
49
13
  {
50
14
  state: {
51
15
  /**
@@ -56,7 +20,7 @@ const { actions: privateActions, state: privateState } = store(
56
20
  get tabsList() {
57
21
  const context = getContext();
58
22
  const tabsId = context?.tabsId;
59
- const tabsList = privateState[ tabsId ];
23
+ const tabsList = state[ tabsId ];
60
24
  return tabsList;
61
25
  },
62
26
  /**
@@ -71,8 +35,8 @@ const { actions: privateActions, state: privateState } = store(
71
35
  if ( ! tabId ) {
72
36
  return null;
73
37
  }
74
- const { tabsList } = privateState;
75
- const tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );
38
+ const { tabsList } = state;
39
+ const tabIndex = tabsList.findIndex( ( t ) => t === tabId );
76
40
  return tabIndex;
77
41
  },
78
42
  /**
@@ -82,7 +46,7 @@ const { actions: privateActions, state: privateState } = store(
82
46
  */
83
47
  get isActiveTab() {
84
48
  const { activeTabIndex } = getContext();
85
- const { tabIndex } = privateState;
49
+ const { tabIndex } = state;
86
50
  return activeTabIndex === tabIndex;
87
51
  },
88
52
  /**
@@ -92,7 +56,7 @@ const { actions: privateActions, state: privateState } = store(
92
56
  * @type {number}
93
57
  */
94
58
  get tabIndexAttribute() {
95
- return privateState.isActiveTab ? 0 : -1;
59
+ return state.isActiveTab ? 0 : -1;
96
60
  },
97
61
  },
98
62
  actions: {
@@ -102,7 +66,7 @@ const { actions: privateActions, state: privateState } = store(
102
66
  * @param {KeyboardEvent} event The keydown event.
103
67
  */
104
68
  handleTabKeyDown: withSyncEvent( ( event ) => {
105
- const { tabIndex } = privateState;
69
+ const { tabIndex } = state;
106
70
 
107
71
  if ( tabIndex === null ) {
108
72
  return;
@@ -110,10 +74,10 @@ const { actions: privateActions, state: privateState } = store(
110
74
 
111
75
  if ( event.key === 'ArrowRight' ) {
112
76
  event.preventDefault();
113
- privateActions.moveFocus( tabIndex + 1 );
77
+ actions.moveFocus( tabIndex + 1 );
114
78
  } else if ( event.key === 'ArrowLeft' ) {
115
79
  event.preventDefault();
116
- privateActions.moveFocus( tabIndex - 1 );
80
+ actions.moveFocus( tabIndex - 1 );
117
81
  }
118
82
  } ),
119
83
  /**
@@ -124,9 +88,9 @@ const { actions: privateActions, state: privateState } = store(
124
88
  handleTabClick: withSyncEvent( ( event ) => {
125
89
  event.preventDefault();
126
90
 
127
- const { tabIndex } = privateState;
91
+ const { tabIndex } = state;
128
92
  if ( tabIndex !== null ) {
129
- privateActions.setActiveTab( tabIndex );
93
+ actions.setActiveTab( tabIndex );
130
94
  }
131
95
  } ),
132
96
  /**
@@ -135,7 +99,7 @@ const { actions: privateActions, state: privateState } = store(
135
99
  * @param {number} tabIndex The index to move focus to.
136
100
  */
137
101
  moveFocus: ( tabIndex ) => {
138
- const { tabsList } = privateState;
102
+ const { tabsList } = state;
139
103
 
140
104
  if ( ! tabsList || tabsList.length === 0 ) {
141
105
  return;
@@ -148,20 +112,20 @@ const { actions: privateActions, state: privateState } = store(
148
112
  newIndex = 0;
149
113
  }
150
114
 
151
- const tabId = tabsList[ newIndex ].id;
115
+ const tabId = tabsList[ newIndex ];
152
116
  const tabElement = document.getElementById( 'tab__' + tabId );
153
117
  if ( tabElement ) {
154
118
  tabElement.focus();
155
119
  }
156
120
  },
157
121
  /**
158
- * Sets the active tab index (internal implementation).
122
+ * Sets the active tab index.
159
123
  *
160
124
  * @param {number} tabIndex The index of the active tab.
161
125
  * @param {boolean} scrollToTab Whether to scroll to the tab element.
162
126
  */
163
127
  setActiveTab: ( tabIndex, scrollToTab = false ) => {
164
- const { tabsList } = privateState;
128
+ const { tabsList } = state;
165
129
 
166
130
  if ( ! tabsList || tabsList.length === 0 ) {
167
131
  return;
@@ -178,7 +142,7 @@ const { actions: privateActions, state: privateState } = store(
178
142
  context.activeTabIndex = newIndex;
179
143
 
180
144
  if ( scrollToTab ) {
181
- const tabId = tabsList[ newIndex ].id;
145
+ const tabId = tabsList[ newIndex ];
182
146
  const tabElement = document.getElementById( tabId );
183
147
  if ( tabElement ) {
184
148
  setTimeout( () => {
@@ -194,17 +158,17 @@ const { actions: privateActions, state: privateState } = store(
194
158
  *
195
159
  */
196
160
  onTabsInit: () => {
197
- const { tabsList } = privateState;
161
+ const { tabsList } = state;
198
162
  if ( tabsList.length === 0 ) {
199
163
  return;
200
164
  }
201
165
 
202
166
  const { hash } = window.location;
203
167
  const tabId = hash.replace( '#', '' );
204
- const tabIndex = tabsList.findIndex( ( t ) => t.id === tabId );
168
+ const tabIndex = tabsList.findIndex( ( t ) => t === tabId );
205
169
  // Check if tabIndex is a positive number and if so we'll auto activate that tab.
206
170
  if ( tabIndex >= 0 ) {
207
- privateActions.setActiveTab( tabIndex, true );
171
+ actions.setActiveTab( tabIndex, true );
208
172
  }
209
173
  },
210
174
  },
@@ -213,47 +177,3 @@ const { actions: privateActions, state: privateState } = store(
213
177
  lock: true,
214
178
  }
215
179
  );
216
-
217
- // Public store for third-party extensibility.
218
- store( 'core/tabs', {
219
- state: {
220
- /**
221
- * Gets a contextually aware list of tabs for the current tabs block.
222
- * Public API for third-party access.
223
- *
224
- * @type {Array}
225
- */
226
- get tabsList() {
227
- return createReadOnlyProxy( privateState.tabsList );
228
- },
229
- /**
230
- * Gets the index of the active tab element whether it
231
- * is a tab label or tab panel.
232
- *
233
- * @type {number|null}
234
- */
235
- get tabIndex() {
236
- return privateState.tabIndex;
237
- },
238
- /**
239
- * Whether the tab panel or tab label is the active tab.
240
- *
241
- * @type {boolean}
242
- */
243
- get isActiveTab() {
244
- return privateState.isActiveTab;
245
- },
246
- },
247
- actions: {
248
- /**
249
- * Sets the active tab index.
250
- * Public API for third-party programmatic tab activation.
251
- *
252
- * @param {number} tabIndex The index of the active tab.
253
- * @param {boolean} scrollToTab Whether to scroll to the tab element.
254
- */
255
- setActiveTab: ( tabIndex, scrollToTab = false ) => {
256
- privateActions.setActiveTab( tabIndex, scrollToTab );
257
- },
258
- },
259
- } );
@@ -57,7 +57,6 @@ export function TemplatePartAdvancedControls( {
57
57
  { isEntityAvailable && (
58
58
  <>
59
59
  <TextControl
60
- __next40pxDefaultSize
61
60
  label={ __( 'Title' ) }
62
61
  value={ title }
63
62
  onChange={ ( value ) => {
@@ -39,7 +39,6 @@ export default function TitleModal( { areaLabel, onClose, onSubmit } ) {
39
39
  value={ title }
40
40
  onChange={ setTitle }
41
41
  placeholder={ __( 'Custom Template Part' ) }
42
- __next40pxDefaultSize
43
42
  />
44
43
  <HStack justify="right">
45
44
  <Button
@@ -18,7 +18,7 @@ describe( 'style state dimension utilities', () => {
18
18
  aspectRatio: '1',
19
19
  minHeight: '40px',
20
20
  },
21
- mobile: {
21
+ '@mobile': {
22
22
  dimensions: {
23
23
  aspectRatio: '2',
24
24
  },
@@ -29,7 +29,7 @@ describe( 'style state dimension utilities', () => {
29
29
  dimensions: {
30
30
  minHeight: '40px',
31
31
  },
32
- mobile: {
32
+ '@mobile': {
33
33
  dimensions: {
34
34
  aspectRatio: '2',
35
35
  },
@@ -42,13 +42,13 @@ describe( 'style state dimension utilities', () => {
42
42
  dimensions: {
43
43
  aspectRatio: '1',
44
44
  },
45
- mobile: {
45
+ '@mobile': {
46
46
  dimensions: {
47
47
  aspectRatio: '2',
48
48
  width: '200px',
49
49
  },
50
50
  },
51
- tablet: {
51
+ '@tablet': {
52
52
  dimensions: {
53
53
  aspectRatio: '3',
54
54
  },
@@ -58,19 +58,19 @@ describe( 'style state dimension utilities', () => {
58
58
  expect(
59
59
  resetStateDimensions(
60
60
  style,
61
- { viewport: 'mobile', pseudo: 'default' },
61
+ { viewport: '@mobile', pseudo: 'default' },
62
62
  [ 'aspectRatio' ]
63
63
  )
64
64
  ).toEqual( {
65
65
  dimensions: {
66
66
  aspectRatio: '1',
67
67
  },
68
- mobile: {
68
+ '@mobile': {
69
69
  dimensions: {
70
70
  width: '200px',
71
71
  },
72
72
  },
73
- tablet: {
73
+ '@tablet': {
74
74
  dimensions: {
75
75
  aspectRatio: '3',
76
76
  },
@@ -80,12 +80,12 @@ describe( 'style state dimension utilities', () => {
80
80
 
81
81
  it( 'sets dimensions only for the selected viewport state', () => {
82
82
  const style = {
83
- mobile: {
83
+ '@mobile': {
84
84
  dimensions: {
85
85
  width: '200px',
86
86
  },
87
87
  },
88
- tablet: {
88
+ '@tablet': {
89
89
  dimensions: {
90
90
  width: '300px',
91
91
  },
@@ -95,17 +95,17 @@ describe( 'style state dimension utilities', () => {
95
95
  expect(
96
96
  setStateDimensions(
97
97
  style,
98
- { viewport: 'mobile', pseudo: 'default' },
98
+ { viewport: '@mobile', pseudo: 'default' },
99
99
  { height: '100px' }
100
100
  )
101
101
  ).toEqual( {
102
- mobile: {
102
+ '@mobile': {
103
103
  dimensions: {
104
104
  height: '100px',
105
105
  width: '200px',
106
106
  },
107
107
  },
108
- tablet: {
108
+ '@tablet': {
109
109
  dimensions: {
110
110
  width: '300px',
111
111
  },
@@ -115,8 +115,8 @@ describe( 'style state dimension utilities', () => {
115
115
 
116
116
  it( 'generates a stable key for selected style states', () => {
117
117
  expect(
118
- getStyleStateKey( { viewport: 'mobile', pseudo: ':hover' } )
119
- ).toBe( 'mobile::hover' );
118
+ getStyleStateKey( { viewport: '@mobile', pseudo: ':hover' } )
119
+ ).toBe( '@mobile::hover' );
120
120
  expect( getStyleStateKey( undefined ) ).toBe( 'default:default' );
121
121
  } );
122
122
 
@@ -138,14 +138,14 @@ describe( 'style state dimension utilities', () => {
138
138
  attributes: {
139
139
  scale: 'cover',
140
140
  style: {
141
- mobile: {
141
+ '@mobile': {
142
142
  dimensions: {
143
143
  objectFit: 'contain',
144
144
  },
145
145
  },
146
146
  },
147
147
  },
148
- selectedState: { viewport: 'mobile', pseudo: 'default' },
148
+ selectedState: { viewport: '@mobile', pseudo: 'default' },
149
149
  hasSelectedStyleState: true,
150
150
  attributeKey: 'scale',
151
151
  styleKey: 'objectFit',
@@ -157,13 +157,13 @@ describe( 'style state dimension utilities', () => {
157
157
  expect(
158
158
  getDimensionUpdateAttributes( {
159
159
  style: {
160
- mobile: {
160
+ '@mobile': {
161
161
  dimensions: {
162
162
  width: '200px',
163
163
  },
164
164
  },
165
165
  },
166
- selectedState: { viewport: 'mobile', pseudo: 'default' },
166
+ selectedState: { viewport: '@mobile', pseudo: 'default' },
167
167
  hasSelectedStyleState: true,
168
168
  nextDimensions: {
169
169
  scale: 'contain',
@@ -174,7 +174,7 @@ describe( 'style state dimension utilities', () => {
174
174
  } )
175
175
  ).toEqual( {
176
176
  style: {
177
- mobile: {
177
+ '@mobile': {
178
178
  dimensions: {
179
179
  objectFit: 'contain',
180
180
  width: '200px',
@@ -207,14 +207,14 @@ describe( 'style state dimension utilities', () => {
207
207
  expect(
208
208
  getDimensionUpdateAttributes( {
209
209
  style: {
210
- mobile: {
210
+ '@mobile': {
211
211
  dimensions: {
212
212
  height: '100px',
213
213
  width: '200px',
214
214
  },
215
215
  },
216
216
  },
217
- selectedState: { viewport: 'mobile', pseudo: 'default' },
217
+ selectedState: { viewport: '@mobile', pseudo: 'default' },
218
218
  hasSelectedStyleState: true,
219
219
  nextDimensions: {
220
220
  aspectRatio: '16/9',
@@ -228,7 +228,7 @@ describe( 'style state dimension utilities', () => {
228
228
  } )
229
229
  ).toEqual( {
230
230
  style: {
231
- mobile: {
231
+ '@mobile': {
232
232
  dimensions: {
233
233
  aspectRatio: '16/9',
234
234
  objectFit: 'cover',
@@ -248,14 +248,14 @@ describe( 'style state dimension utilities', () => {
248
248
  dimensions: {
249
249
  width: '300px',
250
250
  },
251
- mobile: {
251
+ '@mobile': {
252
252
  dimensions: {
253
253
  width: '400px',
254
254
  },
255
255
  },
256
256
  },
257
257
  },
258
- selectedState: { viewport: 'mobile', pseudo: 'default' },
258
+ selectedState: { viewport: '@mobile', pseudo: 'default' },
259
259
  hasSelectedStyleState: true,
260
260
  keys: [ 'width' ],
261
261
  defaultAttributes: {
@@ -280,7 +280,7 @@ describe( 'style state dimension utilities', () => {
280
280
  dimensions: {
281
281
  width: '300px',
282
282
  },
283
- mobile: {
283
+ '@mobile': {
284
284
  dimensions: {
285
285
  width: '400px',
286
286
  },
@@ -296,7 +296,7 @@ describe( 'style state dimension utilities', () => {
296
296
  ).toEqual( {
297
297
  width: undefined,
298
298
  style: {
299
- mobile: {
299
+ '@mobile': {
300
300
  dimensions: {
301
301
  width: '400px',
302
302
  },
package/src/video/edit.js CHANGED
@@ -8,7 +8,6 @@ import clsx from 'clsx';
8
8
  */
9
9
  import { isBlobURL } from '@wordpress/blob';
10
10
  import {
11
- Disabled,
12
11
  Spinner,
13
12
  Placeholder,
14
13
  __experimentalToolsPanel as ToolsPanel,
@@ -235,21 +234,15 @@ function VideoEdit( {
235
234
  </ToolsPanel>
236
235
  </InspectorControls>
237
236
  <figure { ...blockProps }>
238
- { /*
239
- Disable the video tag if the block is not selected
240
- so the user clicking on it won't play the
241
- video when the controls are enabled.
242
- */ }
243
- <Disabled isDisabled={ ! isSingleSelected }>
244
- <video
245
- controls={ controls }
246
- poster={ poster }
247
- src={ src || temporaryURL }
248
- ref={ videoPlayer }
249
- >
250
- <Tracks tracks={ tracks } />
251
- </video>
252
- </Disabled>
237
+ <video
238
+ controls={ controls }
239
+ inert={ ! isSingleSelected ? 'true' : undefined }
240
+ poster={ poster }
241
+ src={ src || temporaryURL }
242
+ ref={ videoPlayer }
243
+ >
244
+ <Tracks tracks={ tracks } />
245
+ </video>
253
246
  { !! temporaryURL && <Spinner /> }
254
247
  <Caption
255
248
  attributes={ attributes }
@@ -120,7 +120,6 @@ function SingleTrackEditor( {
120
120
  </span>
121
121
  <Grid columns={ 2 } gap={ 4 }>
122
122
  <TextControl
123
- __next40pxDefaultSize
124
123
  onChange={ ( newLabel ) =>
125
124
  setTrackState( ( prevTrackState ) => ( {
126
125
  ...prevTrackState,
@@ -132,7 +131,6 @@ function SingleTrackEditor( {
132
131
  help={ __( 'Title of track' ) }
133
132
  />
134
133
  <TextControl
135
- __next40pxDefaultSize
136
134
  onChange={ ( newSrcLang ) =>
137
135
  setTrackState( ( prevTrackState ) => ( {
138
136
  ...prevTrackState,
@@ -1,40 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/block-library/src/freeform/convert-to-blocks-button.js
21
- var convert_to_blocks_button_exports = {};
22
- __export(convert_to_blocks_button_exports, {
23
- default: () => convert_to_blocks_button_default
24
- });
25
- module.exports = __toCommonJS(convert_to_blocks_button_exports);
26
- var import_i18n = require("@wordpress/i18n");
27
- var import_components = require("@wordpress/components");
28
- var import_blocks = require("@wordpress/blocks");
29
- var import_jsx_runtime = require("react/jsx-runtime");
30
- var ConvertToBlocksButton = ({ content, onReplace }) => {
31
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
32
- import_components.ToolbarButton,
33
- {
34
- onClick: () => onReplace((0, import_blocks.rawHandler)({ HTML: content })),
35
- children: (0, import_i18n.__)("Convert to blocks")
36
- }
37
- );
38
- };
39
- var convert_to_blocks_button_default = ConvertToBlocksButton;
40
- //# sourceMappingURL=convert-to-blocks-button.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/freeform/convert-to-blocks-button.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { rawHandler } from '@wordpress/blocks';\n\nconst ConvertToBlocksButton = ( { content, onReplace } ) => {\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={ () => onReplace( rawHandler( { HTML: content } ) ) }\n\t\t>\n\t\t\t{ __( 'Convert to blocks' ) }\n\t\t</ToolbarButton>\n\t);\n};\n\nexport default ConvertToBlocksButton;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,wBAA8B;AAC9B,oBAA2B;AAIzB;AAFF,IAAM,wBAAwB,CAAE,EAAE,SAAS,UAAU,MAAO;AAC3D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM,cAAW,0BAAY,EAAE,MAAM,QAAQ,CAAE,CAAE;AAAA,MAEzD,8BAAI,mBAAoB;AAAA;AAAA,EAC3B;AAEF;AAEA,IAAO,mCAAQ;",
6
- "names": []
7
- }
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // packages/block-library/src/list-item/utils.js
21
- var utils_exports = {};
22
- __export(utils_exports, {
23
- convertToListItems: () => convertToListItems
24
- });
25
- module.exports = __toCommonJS(utils_exports);
26
- var import_blocks = require("@wordpress/blocks");
27
- function convertBlockToList(block) {
28
- const list = (0, import_blocks.switchToBlockType)(block, "core/list");
29
- if (list) {
30
- return list;
31
- }
32
- const paragraph = (0, import_blocks.switchToBlockType)(block, "core/paragraph");
33
- if (!paragraph) {
34
- return null;
35
- }
36
- return (0, import_blocks.switchToBlockType)(paragraph, "core/list");
37
- }
38
- function convertToListItems(blocks) {
39
- const listItems = [];
40
- for (let block of blocks) {
41
- if (block.name === "core/list-item") {
42
- listItems.push(block);
43
- } else if (block.name === "core/list") {
44
- listItems.push(...block.innerBlocks);
45
- } else if (block = convertBlockToList(block)) {
46
- for (const { innerBlocks } of block) {
47
- listItems.push(...innerBlocks);
48
- }
49
- }
50
- }
51
- return listItems;
52
- }
53
- // Annotate the CommonJS export names for ESM import in node:
54
- 0 && (module.exports = {
55
- convertToListItems
56
- });
57
- //# sourceMappingURL=utils.cjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/list-item/utils.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { switchToBlockType } from '@wordpress/blocks';\n\nfunction convertBlockToList( block ) {\n\tconst list = switchToBlockType( block, 'core/list' );\n\tif ( list ) {\n\t\treturn list;\n\t}\n\tconst paragraph = switchToBlockType( block, 'core/paragraph' );\n\tif ( ! paragraph ) {\n\t\treturn null;\n\t}\n\treturn switchToBlockType( paragraph, 'core/list' );\n}\n\nexport function convertToListItems( blocks ) {\n\tconst listItems = [];\n\n\tfor ( let block of blocks ) {\n\t\tif ( block.name === 'core/list-item' ) {\n\t\t\tlistItems.push( block );\n\t\t} else if ( block.name === 'core/list' ) {\n\t\t\tlistItems.push( ...block.innerBlocks );\n\t\t} else if ( ( block = convertBlockToList( block ) ) ) {\n\t\t\tfor ( const { innerBlocks } of block ) {\n\t\t\t\tlistItems.push( ...innerBlocks );\n\t\t\t}\n\t\t}\n\t}\n\n\treturn listItems;\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAkC;AAElC,SAAS,mBAAoB,OAAQ;AACpC,QAAM,WAAO,iCAAmB,OAAO,WAAY;AACnD,MAAK,MAAO;AACX,WAAO;AAAA,EACR;AACA,QAAM,gBAAY,iCAAmB,OAAO,gBAAiB;AAC7D,MAAK,CAAE,WAAY;AAClB,WAAO;AAAA,EACR;AACA,aAAO,iCAAmB,WAAW,WAAY;AAClD;AAEO,SAAS,mBAAoB,QAAS;AAC5C,QAAM,YAAY,CAAC;AAEnB,WAAU,SAAS,QAAS;AAC3B,QAAK,MAAM,SAAS,kBAAmB;AACtC,gBAAU,KAAM,KAAM;AAAA,IACvB,WAAY,MAAM,SAAS,aAAc;AACxC,gBAAU,KAAM,GAAG,MAAM,WAAY;AAAA,IACtC,WAAc,QAAQ,mBAAoB,KAAM,GAAM;AACrD,iBAAY,EAAE,YAAY,KAAK,OAAQ;AACtC,kBAAU,KAAM,GAAG,WAAY;AAAA,MAChC;AAAA,IACD;AAAA,EACD;AAEA,SAAO;AACR;",
6
- "names": []
7
- }
@@ -1,19 +0,0 @@
1
- // packages/block-library/src/freeform/convert-to-blocks-button.js
2
- import { __ } from "@wordpress/i18n";
3
- import { ToolbarButton } from "@wordpress/components";
4
- import { rawHandler } from "@wordpress/blocks";
5
- import { jsx } from "react/jsx-runtime";
6
- var ConvertToBlocksButton = ({ content, onReplace }) => {
7
- return /* @__PURE__ */ jsx(
8
- ToolbarButton,
9
- {
10
- onClick: () => onReplace(rawHandler({ HTML: content })),
11
- children: __("Convert to blocks")
12
- }
13
- );
14
- };
15
- var convert_to_blocks_button_default = ConvertToBlocksButton;
16
- export {
17
- convert_to_blocks_button_default as default
18
- };
19
- //# sourceMappingURL=convert-to-blocks-button.mjs.map
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/freeform/convert-to-blocks-button.js"],
4
- "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { ToolbarButton } from '@wordpress/components';\nimport { rawHandler } from '@wordpress/blocks';\n\nconst ConvertToBlocksButton = ( { content, onReplace } ) => {\n\treturn (\n\t\t<ToolbarButton\n\t\t\tonClick={ () => onReplace( rawHandler( { HTML: content } ) ) }\n\t\t>\n\t\t\t{ __( 'Convert to blocks' ) }\n\t\t</ToolbarButton>\n\t);\n};\n\nexport default ConvertToBlocksButton;\n"],
5
- "mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,qBAAqB;AAC9B,SAAS,kBAAkB;AAIzB;AAFF,IAAM,wBAAwB,CAAE,EAAE,SAAS,UAAU,MAAO;AAC3D,SACC;AAAA,IAAC;AAAA;AAAA,MACA,SAAU,MAAM,UAAW,WAAY,EAAE,MAAM,QAAQ,CAAE,CAAE;AAAA,MAEzD,aAAI,mBAAoB;AAAA;AAAA,EAC3B;AAEF;AAEA,IAAO,mCAAQ;",
6
- "names": []
7
- }
@@ -1,32 +0,0 @@
1
- // packages/block-library/src/list-item/utils.js
2
- import { switchToBlockType } from "@wordpress/blocks";
3
- function convertBlockToList(block) {
4
- const list = switchToBlockType(block, "core/list");
5
- if (list) {
6
- return list;
7
- }
8
- const paragraph = switchToBlockType(block, "core/paragraph");
9
- if (!paragraph) {
10
- return null;
11
- }
12
- return switchToBlockType(paragraph, "core/list");
13
- }
14
- function convertToListItems(blocks) {
15
- const listItems = [];
16
- for (let block of blocks) {
17
- if (block.name === "core/list-item") {
18
- listItems.push(block);
19
- } else if (block.name === "core/list") {
20
- listItems.push(...block.innerBlocks);
21
- } else if (block = convertBlockToList(block)) {
22
- for (const { innerBlocks } of block) {
23
- listItems.push(...innerBlocks);
24
- }
25
- }
26
- }
27
- return listItems;
28
- }
29
- export {
30
- convertToListItems
31
- };
32
- //# sourceMappingURL=utils.mjs.map