@wordpress/block-editor 12.21.0 → 12.22.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 (213) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/block-actions/index.js +2 -4
  3. package/build/components/block-actions/index.js.map +1 -1
  4. package/build/components/block-heading-level-dropdown/index.js +5 -5
  5. package/build/components/block-heading-level-dropdown/index.js.map +1 -1
  6. package/build/components/block-heading-level-dropdown/index.native.js +5 -4
  7. package/build/components/block-heading-level-dropdown/index.native.js.map +1 -1
  8. package/build/components/block-list/block-crash-boundary.native.js +49 -0
  9. package/build/components/block-list/block-crash-boundary.native.js.map +1 -0
  10. package/build/components/block-list/block-crash-warning.native.js +24 -0
  11. package/build/components/block-list/block-crash-warning.native.js.map +1 -0
  12. package/build/components/block-list/block.native.js +7 -2
  13. package/build/components/block-list/block.native.js.map +1 -1
  14. package/build/components/block-settings/container.native.js +2 -1
  15. package/build/components/block-settings/container.native.js.map +1 -1
  16. package/build/components/block-settings-menu/block-settings-dropdown.js +29 -29
  17. package/build/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  18. package/build/components/block-settings-menu-controls/index.js +1 -3
  19. package/build/components/block-settings-menu-controls/index.js.map +1 -1
  20. package/build/components/block-toolbar/index.js +3 -1
  21. package/build/components/block-toolbar/index.js.map +1 -1
  22. package/build/components/block-toolbar/shuffle.js +1 -1
  23. package/build/components/block-toolbar/shuffle.js.map +1 -1
  24. package/build/components/child-layout-control/index.js +108 -11
  25. package/build/components/child-layout-control/index.js.map +1 -1
  26. package/build/components/convert-to-group-buttons/toolbar.js +11 -0
  27. package/build/components/convert-to-group-buttons/toolbar.js.map +1 -1
  28. package/build/components/global-styles/dimensions-panel.js +8 -33
  29. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  30. package/build/components/global-styles/use-global-styles-output.js +1 -1
  31. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  32. package/build/components/global-styles/utils.js +1 -3
  33. package/build/components/global-styles/utils.js.map +1 -1
  34. package/build/components/iframe/index.js +34 -30
  35. package/build/components/iframe/index.js.map +1 -1
  36. package/build/components/inserter/block-patterns-explorer/index.js +3 -6
  37. package/build/components/inserter/block-patterns-explorer/index.js.map +1 -1
  38. package/build/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  39. package/build/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  40. package/build/components/inserter/menu.js +3 -9
  41. package/build/components/inserter/menu.js.map +1 -1
  42. package/build/components/inserter/mobile-tab-navigation.js +1 -1
  43. package/build/components/inserter/mobile-tab-navigation.js.map +1 -1
  44. package/build/components/inserter/search-results.js +2 -3
  45. package/build/components/inserter/search-results.js.map +1 -1
  46. package/build/components/inserter/tabs.js +1 -2
  47. package/build/components/inserter/tabs.js.map +1 -1
  48. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js +36 -0
  49. package/build/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  50. package/build/components/list-view/block-select-button.js +2 -12
  51. package/build/components/list-view/block-select-button.js.map +1 -1
  52. package/build/components/list-view/block.js +4 -11
  53. package/build/components/list-view/block.js.map +1 -1
  54. package/build/components/list-view/utils.js +5 -3
  55. package/build/components/list-view/utils.js.map +1 -1
  56. package/build/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  57. package/build/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  58. package/build/components/use-moving-animation/index.js +4 -0
  59. package/build/components/use-moving-animation/index.js.map +1 -1
  60. package/build/components/warning/index.native.js +9 -4
  61. package/build/components/warning/index.native.js.map +1 -1
  62. package/build/hooks/anchor.js +7 -8
  63. package/build/hooks/anchor.js.map +1 -1
  64. package/build/hooks/background.js +39 -2
  65. package/build/hooks/background.js.map +1 -1
  66. package/build/hooks/index.js +2 -1
  67. package/build/hooks/index.js.map +1 -1
  68. package/build/hooks/layout-child.js +28 -6
  69. package/build/hooks/layout-child.js.map +1 -1
  70. package/build/hooks/layout.js +21 -10
  71. package/build/hooks/layout.js.map +1 -1
  72. package/build/hooks/position.js +1 -1
  73. package/build/hooks/position.js.map +1 -1
  74. package/build/private-apis.native.js +3 -1
  75. package/build/private-apis.native.js.map +1 -1
  76. package/build/store/reducer.js +31 -26
  77. package/build/store/reducer.js.map +1 -1
  78. package/build-module/components/block-actions/index.js +2 -4
  79. package/build-module/components/block-actions/index.js.map +1 -1
  80. package/build-module/components/block-heading-level-dropdown/index.js +5 -5
  81. package/build-module/components/block-heading-level-dropdown/index.js.map +1 -1
  82. package/build-module/components/block-heading-level-dropdown/index.native.js +5 -4
  83. package/build-module/components/block-heading-level-dropdown/index.native.js.map +1 -1
  84. package/build-module/components/block-list/block-crash-boundary.native.js +42 -0
  85. package/build-module/components/block-list/block-crash-boundary.native.js.map +1 -0
  86. package/build-module/components/block-list/block-crash-warning.native.js +15 -0
  87. package/build-module/components/block-list/block-crash-warning.native.js.map +1 -0
  88. package/build-module/components/block-list/block.native.js +7 -2
  89. package/build-module/components/block-list/block.native.js.map +1 -1
  90. package/build-module/components/block-settings/container.native.js +3 -2
  91. package/build-module/components/block-settings/container.native.js.map +1 -1
  92. package/build-module/components/block-settings-menu/block-settings-dropdown.js +30 -30
  93. package/build-module/components/block-settings-menu/block-settings-dropdown.js.map +1 -1
  94. package/build-module/components/block-settings-menu-controls/index.js +1 -3
  95. package/build-module/components/block-settings-menu-controls/index.js.map +1 -1
  96. package/build-module/components/block-toolbar/index.js +3 -1
  97. package/build-module/components/block-toolbar/index.js.map +1 -1
  98. package/build-module/components/block-toolbar/shuffle.js +1 -1
  99. package/build-module/components/block-toolbar/shuffle.js.map +1 -1
  100. package/build-module/components/child-layout-control/index.js +109 -12
  101. package/build-module/components/child-layout-control/index.js.map +1 -1
  102. package/build-module/components/convert-to-group-buttons/toolbar.js +12 -1
  103. package/build-module/components/convert-to-group-buttons/toolbar.js.map +1 -1
  104. package/build-module/components/global-styles/dimensions-panel.js +9 -34
  105. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  106. package/build-module/components/global-styles/use-global-styles-output.js +1 -1
  107. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  108. package/build-module/components/global-styles/utils.js +0 -2
  109. package/build-module/components/global-styles/utils.js.map +1 -1
  110. package/build-module/components/iframe/index.js +34 -30
  111. package/build-module/components/iframe/index.js.map +1 -1
  112. package/build-module/components/inserter/block-patterns-explorer/index.js +3 -6
  113. package/build-module/components/inserter/block-patterns-explorer/index.js.map +1 -1
  114. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js +3 -1
  115. package/build-module/components/inserter/block-patterns-explorer/pattern-list.js.map +1 -1
  116. package/build-module/components/inserter/menu.js +3 -9
  117. package/build-module/components/inserter/menu.js.map +1 -1
  118. package/build-module/components/inserter/mobile-tab-navigation.js +1 -1
  119. package/build-module/components/inserter/mobile-tab-navigation.js.map +1 -1
  120. package/build-module/components/inserter/search-results.js +2 -3
  121. package/build-module/components/inserter/search-results.js.map +1 -1
  122. package/build-module/components/inserter/tabs.js +1 -2
  123. package/build-module/components/inserter/tabs.js.map +1 -1
  124. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js +28 -0
  125. package/build-module/components/inspector-controls-tabs/advanced-controls-panel.native.js.map +1 -0
  126. package/build-module/components/list-view/block-select-button.js +3 -13
  127. package/build-module/components/list-view/block-select-button.js.map +1 -1
  128. package/build-module/components/list-view/block.js +6 -13
  129. package/build-module/components/list-view/block.js.map +1 -1
  130. package/build-module/components/list-view/utils.js +2 -1
  131. package/build-module/components/list-view/utils.js.map +1 -1
  132. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  133. package/build-module/components/spacing-sizes-control/sides-dropdown/index.js.map +1 -1
  134. package/build-module/components/use-moving-animation/index.js +4 -0
  135. package/build-module/components/use-moving-animation/index.js.map +1 -1
  136. package/build-module/components/warning/index.native.js +9 -4
  137. package/build-module/components/warning/index.native.js.map +1 -1
  138. package/build-module/hooks/anchor.js +8 -9
  139. package/build-module/hooks/anchor.js.map +1 -1
  140. package/build-module/hooks/background.js +38 -1
  141. package/build-module/hooks/background.js.map +1 -1
  142. package/build-module/hooks/index.js +2 -1
  143. package/build-module/hooks/index.js.map +1 -1
  144. package/build-module/hooks/layout-child.js +28 -6
  145. package/build-module/hooks/layout-child.js.map +1 -1
  146. package/build-module/hooks/layout.js +21 -10
  147. package/build-module/hooks/layout.js.map +1 -1
  148. package/build-module/hooks/position.js +1 -1
  149. package/build-module/hooks/position.js.map +1 -1
  150. package/build-module/private-apis.native.js +3 -1
  151. package/build-module/private-apis.native.js.map +1 -1
  152. package/build-module/store/reducer.js +31 -26
  153. package/build-module/store/reducer.js.map +1 -1
  154. package/build-style/content-rtl.css +14 -0
  155. package/build-style/content.css +14 -0
  156. package/build-style/style-rtl.css +8 -20
  157. package/build-style/style.css +8 -20
  158. package/package.json +31 -31
  159. package/src/components/block-actions/index.js +2 -8
  160. package/src/components/block-bindings-toolbar-indicator/style.scss +10 -8
  161. package/src/components/block-heading-level-dropdown/README.md +5 -5
  162. package/src/components/block-heading-level-dropdown/index.js +5 -5
  163. package/src/components/block-heading-level-dropdown/index.native.js +5 -4
  164. package/src/components/block-list/block-crash-boundary.native.js +43 -0
  165. package/src/components/block-list/block-crash-warning.native.js +19 -0
  166. package/src/components/block-list/block.native.js +14 -7
  167. package/src/components/block-list/content.scss +16 -0
  168. package/src/components/block-settings/container.native.js +5 -1
  169. package/src/components/block-settings-menu/block-settings-dropdown.js +41 -56
  170. package/src/components/block-settings-menu-controls/README.md +0 -9
  171. package/src/components/block-settings-menu-controls/index.js +1 -6
  172. package/src/components/block-toolbar/index.js +3 -1
  173. package/src/components/block-toolbar/shuffle.js +1 -1
  174. package/src/components/block-toolbar/test/index.native.js +1 -7
  175. package/src/components/child-layout-control/index.js +147 -35
  176. package/src/components/convert-to-group-buttons/toolbar.js +13 -1
  177. package/src/components/global-styles/dimensions-panel.js +9 -34
  178. package/src/components/global-styles/test/use-global-styles-output.js +31 -0
  179. package/src/components/global-styles/use-global-styles-output.js +3 -1
  180. package/src/components/global-styles/utils.js +0 -18
  181. package/src/components/iframe/index.js +60 -44
  182. package/src/components/inserter/block-patterns-explorer/index.js +2 -9
  183. package/src/components/inserter/block-patterns-explorer/pattern-list.js +7 -1
  184. package/src/components/inserter/menu.js +4 -10
  185. package/src/components/inserter/mobile-tab-navigation.js +1 -1
  186. package/src/components/inserter/search-results.js +1 -2
  187. package/src/components/inserter/tabs.js +1 -2
  188. package/src/components/inspector-controls-tabs/advanced-controls-panel.native.js +31 -0
  189. package/src/components/link-control/style.scss +0 -5
  190. package/src/components/list-view/block-select-button.js +2 -18
  191. package/src/components/list-view/block.js +12 -21
  192. package/src/components/list-view/style.scss +34 -24
  193. package/src/components/list-view/utils.js +4 -1
  194. package/src/components/rich-text/README.md +6 -0
  195. package/src/components/spacing-sizes-control/sides-dropdown/index.js +1 -1
  196. package/src/components/use-moving-animation/index.js +1 -0
  197. package/src/components/warning/index.native.js +19 -15
  198. package/src/hooks/anchor.js +41 -61
  199. package/src/hooks/background.js +48 -3
  200. package/src/hooks/index.js +2 -0
  201. package/src/hooks/layout-child.js +44 -8
  202. package/src/hooks/layout.js +22 -18
  203. package/src/hooks/position.js +1 -1
  204. package/src/hooks/test/__snapshots__/anchor.native.js.snap +7 -0
  205. package/src/hooks/test/anchor.native.js +32 -0
  206. package/src/private-apis.native.js +2 -0
  207. package/src/store/reducer.js +41 -41
  208. package/tsconfig.json +1 -0
  209. package/build/utils/calculate-scale.js +0 -17
  210. package/build/utils/calculate-scale.js.map +0 -1
  211. package/build-module/utils/calculate-scale.js +0 -11
  212. package/build-module/utils/calculate-scale.js.map +0 -1
  213. package/src/utils/calculate-scale.js +0 -20
@@ -40,7 +40,7 @@ function SidesDropdown({
40
40
  label: labelProp,
41
41
  className: "spacing-sizes-control__dropdown",
42
42
  toggleProps: {
43
- isSmall: true
43
+ size: 'small'
44
44
  }
45
45
  }, ({
46
46
  onClose
@@ -1 +1 @@
1
- {"version":3,"names":["_components","require","_icons","_utils","checkIcon","_react","createElement","Icon","icon","check","size","SidesDropdown","label","labelProp","onChange","sides","value","length","supportedItems","getSupportedMenuItems","sideIcon","custom","customItem","menuItems","DropdownMenu","className","toggleProps","isSmall","onClose","Fragment","MenuGroup","Object","entries","map","slug","isSelected","MenuItem","key","iconPosition","role","onClick","suffix","undefined","VIEWS"],"sources":["@wordpress/block-editor/src/components/spacing-sizes-control/sides-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, Icon, MenuGroup, MenuItem } from '@wordpress/components';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedMenuItems, VIEWS } from '../utils';\n\nconst checkIcon = <Icon icon={ check } size={ 24 } />;\n\nexport default function SidesDropdown( {\n\tlabel: labelProp,\n\tonChange,\n\tsides,\n\tvalue,\n} ) {\n\tif ( ! sides || ! sides.length ) {\n\t\treturn;\n\t}\n\n\tconst supportedItems = getSupportedMenuItems( sides );\n\tconst sideIcon = supportedItems[ value ].icon;\n\tconst { custom: customItem, ...menuItems } = supportedItems;\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ sideIcon }\n\t\t\tlabel={ labelProp }\n\t\t\tclassName=\"spacing-sizes-control__dropdown\"\n\t\t\ttoggleProps={ { isSmall: true } }\n\t\t>\n\t\t\t{ ( { onClose } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ Object.entries( menuItems ).map(\n\t\t\t\t\t\t\t\t( [ slug, { label, icon } ] ) => {\n\t\t\t\t\t\t\t\t\tconst isSelected = value === slug;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonChange( slug );\n\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t\t\t\t\t\t\t? checkIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t{ !! customItem && (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\ticon={ customItem.icon }\n\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\tisSelected={ value === VIEWS.custom }\n\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChange( VIEWS.custom );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t\t\tvalue === VIEWS.custom\n\t\t\t\t\t\t\t\t\t\t\t? checkIcon\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ customItem.label }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\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EJ;IAAK,CAAC,CAAE,KAAM;MAChC,MAAM2B,UAAU,GAAGnB,KAAK,KAAKkB,IAAI;MACjC,OACC,IAAA7B,MAAA,CAAAC,aAAA,EAACN,WAAA,CAAAoC,QAAQ;QACRC,GAAG,EAAGH,IAAM;QACZ1B,IAAI,EAAGA,IAAM;QACb8B,YAAY,EAAC,MAAM;QACnBH,UAAU,EAAGA,UAAY;QACzBI,IAAI,EAAC,eAAe;QACpBC,OAAO,EAAGA,CAAA,KAAM;UACf1B,QAAQ,CAAEoB,IAAK,CAAC;UAChBN,OAAO,CAAC,CAAC;QACV,CAAG;QACHa,MAAM,EACLN,UAAU,GACP/B,SAAS,GACTsC;MACH,GAEC9B,KACO,CAAC;IAEb,CACD,CACU,CAAC,EACV,CAAC,CAAEU,UAAU,IACd,IAAAjB,MAAA,CAAAC,aAAA,EAACN,WAAA,CAAA8B,SAAS,QACT,IAAAzB,MAAA,CAAAC,aAAA,EAACN,WAAA,CAAAoC,QAAQ;MACR5B,IAAI,EAAGc,UAAU,CAACd,IAAM;MACxB8B,YAAY,EAAC,MAAM;MACnBH,UAAU,EAAGnB,KAAK,KAAK2B,YAAK,CAACtB,MAAQ;MACrCkB,IAAI,EAAC,eAAe;MACpBC,OAAO,EAAGA,CAAA,KAAM;QACf1B,QAAQ,CAAE6B,YAAK,CAACtB,MAAO,CAAC;QACxBO,OAAO,CAAC,CAAC;MACV,CAAG;MACHa,MAAM,EACLzB,KAAK,KAAK2B,YAAK,CAACtB,MAAM,GACnBjB,SAAS,GACTsC;IACH,GAECpB,UAAU,CAACV,KACJ,CACA,CAEX,CAAC;EAEL,CACa,CAAC;AAEjB"}
1
+ {"version":3,"names":["_components","require","_icons","_utils","checkIcon","_react","createElement","Icon","icon","check","size","SidesDropdown","label","labelProp","onChange","sides","value","length","supportedItems","getSupportedMenuItems","sideIcon","custom","customItem","menuItems","DropdownMenu","className","toggleProps","onClose","Fragment","MenuGroup","Object","entries","map","slug","isSelected","MenuItem","key","iconPosition","role","onClick","suffix","undefined","VIEWS"],"sources":["@wordpress/block-editor/src/components/spacing-sizes-control/sides-dropdown/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { DropdownMenu, Icon, MenuGroup, MenuItem } from '@wordpress/components';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedMenuItems, VIEWS } from '../utils';\n\nconst checkIcon = <Icon icon={ check } size={ 24 } />;\n\nexport default function SidesDropdown( {\n\tlabel: labelProp,\n\tonChange,\n\tsides,\n\tvalue,\n} ) {\n\tif ( ! sides || ! sides.length ) {\n\t\treturn;\n\t}\n\n\tconst supportedItems = getSupportedMenuItems( sides );\n\tconst sideIcon = supportedItems[ value ].icon;\n\tconst { custom: customItem, ...menuItems } = supportedItems;\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ sideIcon }\n\t\t\tlabel={ labelProp }\n\t\t\tclassName=\"spacing-sizes-control__dropdown\"\n\t\t\ttoggleProps={ { size: 'small' } }\n\t\t>\n\t\t\t{ ( { onClose } ) => {\n\t\t\t\treturn (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t{ Object.entries( menuItems ).map(\n\t\t\t\t\t\t\t\t( [ slug, { label, icon } ] ) => {\n\t\t\t\t\t\t\t\t\tconst isSelected = value === slug;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\t\tisSelected={ isSelected }\n\t\t\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tonChange( slug );\n\t\t\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t\t\t\t\tisSelected\n\t\t\t\t\t\t\t\t\t\t\t\t\t? checkIcon\n\t\t\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ label }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t{ !! customItem && (\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\ticon={ customItem.icon }\n\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\tisSelected={ value === VIEWS.custom }\n\t\t\t\t\t\t\t\t\trole=\"menuitemradio\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChange( VIEWS.custom );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t\t\t\tvalue === VIEWS.custom\n\t\t\t\t\t\t\t\t\t\t\t? checkIcon\n\t\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ customItem.label }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\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</DropdownMenu>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAKA,IAAAE,MAAA,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,YAAY,EAAC,MAAM;QACnBH,UAAU,EAAGA,UAAY;QACzBI,IAAI,EAAC,eAAe;QACpBC,OAAO,EAAGA,CAAA,KAAM;UACfzB,QAAQ,CAAEmB,IAAK,CAAC;UAChBN,OAAO,CAAC,CAAC;QACV,CAAG;QACHa,MAAM,EACLN,UAAU,GACP9B,SAAS,GACTqC;MACH,GAEC7B,KACO,CAAC;IAEb,CACD,CACU,CAAC,EACV,CAAC,CAAEU,UAAU,IACd,IAAAjB,MAAA,CAAAC,aAAA,EAACN,WAAA,CAAA6B,SAAS,QACT,IAAAxB,MAAA,CAAAC,aAAA,EAACN,WAAA,CAAAmC,QAAQ;MACR3B,IAAI,EAAGc,UAAU,CAACd,IAAM;MACxB6B,YAAY,EAAC,MAAM;MACnBH,UAAU,EAAGlB,KAAK,KAAK0B,YAAK,CAACrB,MAAQ;MACrCiB,IAAI,EAAC,eAAe;MACpBC,OAAO,EAAGA,CAAA,KAAM;QACfzB,QAAQ,CAAE4B,YAAK,CAACrB,MAAO,CAAC;QACxBM,OAAO,CAAC,CAAC;MACV,CAAG;MACHa,MAAM,EACLxB,KAAK,KAAK0B,YAAK,CAACrB,MAAM,GACnBjB,SAAS,GACTqC;IACH,GAECnB,UAAU,CAACV,KACJ,CACA,CAEX,CAAC;EAEL,CACa,CAAC;AAEjB"}
@@ -148,6 +148,10 @@ function useMovingAnimation({
148
148
  });
149
149
  return () => {
150
150
  controller.stop();
151
+ controller.set({
152
+ x: 0,
153
+ y: 0
154
+ });
151
155
  };
152
156
  }, [previous, prevRect, clientId, isTyping, getGlobalBlockCount, isBlockSelected, isFirstMultiSelectedBlock, isBlockMultiSelected, isAncestorMultiSelected]);
153
157
  return ref;
@@ -1 +1 @@
1
- {"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAG,GAAG;AA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KAAK,CAACE,SAAS,GAAGH,cAAc,GACzC,IAAI,CAAC;QAAA,EACJ,eAAeV,CAAG,MAAMC,CAAG,OAAM;QACrCjC,GAAG,CAACa,OAAO,CAAC8B,KAAK,CAACd,MAAM,GAAGA,MAAM;QACjCT,sBAAsB,CAAC,CAAC;MACzB;IACD,CAAE,CAAC;IAEHpB,GAAG,CAACa,OAAO,CAAC8B,KAAK,CAACE,SAAS,GAAGC,SAAS;IACvC,MAAMC,WAAW,GAAGxD,mBAAmB,CAAES,GAAG,CAACa,OAAQ,CAAC;IAEtD,MAAMmB,CAAC,GAAGQ,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACf,IAAI,GAAGoD,WAAW,CAACpD,IAAK,CAAC;IACxD,MAAMsC,CAAC,GAAGO,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACjB,GAAG,GAAGsD,WAAW,CAACtD,GAAI,CAAC;IAEtDqC,UAAU,CAACkB,KAAK,CAAE;MAAEhB,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE,CAAC;MAAEgB,IAAI,EAAE;QAAEjB,CAAC;QAAEC;MAAE;IAAE,CAAE,CAAC;IAElD,OAAO,MAAM;MACZH,UAAU,CAACoB,IAAI,CAAC,CAAC;IAClB,CAAC;EACF,CAAC,EAAE,CACFxC,QAAQ,EACRC,QAAQ,EACRZ,QAAQ,EACRG,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAOP,GAAG;AACX;AAAC,IAAAmD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEcxD,kBAAkB"}
1
+ {"version":3,"names":["_web","require","_element","_dom","_data","_store","BLOCK_ANIMATION_THRESHOLD","getAbsolutePosition","element","top","offsetTop","left","offsetLeft","useMovingAnimation","triggerAnimationOnChange","clientId","ref","useRef","isTyping","getGlobalBlockCount","isBlockSelected","isFirstMultiSelectedBlock","isBlockMultiSelected","isAncestorMultiSelected","useSelect","blockEditorStore","previous","prevRect","useMemo","current","getBoundingClientRect","useLayoutEffect","scrollContainer","getScrollContainer","isSelected","adjustScrolling","preserveScrollPosition","blockRect","diff","scrollTop","disableAnimation","window","matchMedia","matches","isPartOfSelection","zIndex","controller","Controller","x","y","config","mass","tension","friction","onChange","value","Math","round","finishedMoving","style","transformOrigin","transform","undefined","destination","start","from","stop","set","_default","exports","default"],"sources":["@wordpress/block-editor/src/components/use-moving-animation/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { Controller } from '@react-spring/web';\n\n/**\n * WordPress dependencies\n */\nimport { useLayoutEffect, useMemo, useRef } from '@wordpress/element';\nimport { getScrollContainer } from '@wordpress/dom';\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\n/**\n * If the block count exceeds the threshold, we disable the reordering animation\n * to avoid laginess.\n */\nconst BLOCK_ANIMATION_THRESHOLD = 200;\n\nfunction getAbsolutePosition( element ) {\n\treturn {\n\t\ttop: element.offsetTop,\n\t\tleft: element.offsetLeft,\n\t};\n}\n\n/**\n * Hook used to compute the styles required to move a div into a new position.\n *\n * The way this animation works is the following:\n * - It first renders the element as if there was no animation.\n * - It takes a snapshot of the position of the block to use it\n * as a destination point for the animation.\n * - It restores the element to the previous position using a CSS transform\n * - It uses the \"resetAnimation\" flag to reset the animation\n * from the beginning in order to animate to the new destination point.\n *\n * @param {Object} $1 Options\n * @param {*} $1.triggerAnimationOnChange Variable used to trigger the animation if it changes.\n * @param {string} $1.clientId\n */\nfunction useMovingAnimation( { triggerAnimationOnChange, clientId } ) {\n\tconst ref = useRef();\n\tconst {\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t} = useSelect( blockEditorStore );\n\n\t// Whenever the trigger changes, we need to take a snapshot of the current\n\t// position of the block to use it as a destination point for the animation.\n\tconst { previous, prevRect } = useMemo(\n\t\t() => ( {\n\t\t\tprevious: ref.current && getAbsolutePosition( ref.current ),\n\t\t\tprevRect: ref.current && ref.current.getBoundingClientRect(),\n\t\t} ),\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t\t[ triggerAnimationOnChange ]\n\t);\n\n\tuseLayoutEffect( () => {\n\t\tif ( ! previous || ! ref.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst scrollContainer = getScrollContainer( ref.current );\n\t\tconst isSelected = isBlockSelected( clientId );\n\t\tconst adjustScrolling =\n\t\t\tisSelected || isFirstMultiSelectedBlock( clientId );\n\n\t\tfunction preserveScrollPosition() {\n\t\t\tif ( adjustScrolling && prevRect ) {\n\t\t\t\tconst blockRect = ref.current.getBoundingClientRect();\n\t\t\t\tconst diff = blockRect.top - prevRect.top;\n\n\t\t\t\tif ( diff ) {\n\t\t\t\t\tscrollContainer.scrollTop += diff;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// We disable the animation if the user has a preference for reduced\n\t\t// motion, if the user is typing (insertion by Enter), or if the block\n\t\t// count exceeds the threshold (insertion caused all the blocks that\n\t\t// follow to animate).\n\t\t// To do: consider enableing the _moving_ animation even for large\n\t\t// posts, while only disabling the _insertion_ animation?\n\t\tconst disableAnimation =\n\t\t\twindow.matchMedia( '(prefers-reduced-motion: reduce)' ).matches ||\n\t\t\tisTyping() ||\n\t\t\tgetGlobalBlockCount() > BLOCK_ANIMATION_THRESHOLD;\n\n\t\tif ( disableAnimation ) {\n\t\t\t// If the animation is disabled and the scroll needs to be adjusted,\n\t\t\t// just move directly to the final scroll position.\n\t\t\tpreserveScrollPosition();\n\t\t\treturn;\n\t\t}\n\n\t\tconst isPartOfSelection =\n\t\t\tisSelected ||\n\t\t\tisBlockMultiSelected( clientId ) ||\n\t\t\tisAncestorMultiSelected( clientId );\n\t\t// Make sure the other blocks move under the selected block(s).\n\t\tconst zIndex = isPartOfSelection ? '1' : '';\n\n\t\tconst controller = new Controller( {\n\t\t\tx: 0,\n\t\t\ty: 0,\n\t\t\tconfig: { mass: 5, tension: 2000, friction: 200 },\n\t\t\tonChange( { value } ) {\n\t\t\t\tif ( ! ref.current ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tlet { x, y } = value;\n\t\t\t\tx = Math.round( x );\n\t\t\t\ty = Math.round( y );\n\t\t\t\tconst finishedMoving = x === 0 && y === 0;\n\t\t\t\tref.current.style.transformOrigin = 'center center';\n\t\t\t\tref.current.style.transform = finishedMoving\n\t\t\t\t\t? null // Set to `null` to explicitly remove the transform.\n\t\t\t\t\t: `translate3d(${ x }px,${ y }px,0)`;\n\t\t\t\tref.current.style.zIndex = zIndex;\n\t\t\t\tpreserveScrollPosition();\n\t\t\t},\n\t\t} );\n\n\t\tref.current.style.transform = undefined;\n\t\tconst destination = getAbsolutePosition( ref.current );\n\n\t\tconst x = Math.round( previous.left - destination.left );\n\t\tconst y = Math.round( previous.top - destination.top );\n\n\t\tcontroller.start( { x: 0, y: 0, from: { x, y } } );\n\n\t\treturn () => {\n\t\t\tcontroller.stop();\n\t\t\tcontroller.set( { x: 0, y: 0 } );\n\t\t};\n\t}, [\n\t\tprevious,\n\t\tprevRect,\n\t\tclientId,\n\t\tisTyping,\n\t\tgetGlobalBlockCount,\n\t\tisBlockSelected,\n\t\tisFirstMultiSelectedBlock,\n\t\tisBlockMultiSelected,\n\t\tisAncestorMultiSelected,\n\t] );\n\n\treturn ref;\n}\n\nexport default useMovingAnimation;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA,MAAMK,yBAAyB,GAAG,GAAG;A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,KAAK,CAACE,SAAS,GAAGH,cAAc,GACzC,IAAI,CAAC;QAAA,EACJ,eAAeV,CAAG,MAAMC,CAAG,OAAM;QACrCjC,GAAG,CAACa,OAAO,CAAC8B,KAAK,CAACd,MAAM,GAAGA,MAAM;QACjCT,sBAAsB,CAAC,CAAC;MACzB;IACD,CAAE,CAAC;IAEHpB,GAAG,CAACa,OAAO,CAAC8B,KAAK,CAACE,SAAS,GAAGC,SAAS;IACvC,MAAMC,WAAW,GAAGxD,mBAAmB,CAAES,GAAG,CAACa,OAAQ,CAAC;IAEtD,MAAMmB,CAAC,GAAGQ,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACf,IAAI,GAAGoD,WAAW,CAACpD,IAAK,CAAC;IACxD,MAAMsC,CAAC,GAAGO,IAAI,CAACC,KAAK,CAAE/B,QAAQ,CAACjB,GAAG,GAAGsD,WAAW,CAACtD,GAAI,CAAC;IAEtDqC,UAAU,CAACkB,KAAK,CAAE;MAAEhB,CAAC,EAAE,CAAC;MAAEC,CAAC,EAAE,CAAC;MAAEgB,IAAI,EAAE;QAAEjB,CAAC;QAAEC;MAAE;IAAE,CAAE,CAAC;IAElD,OAAO,MAAM;MACZH,UAAU,CAACoB,IAAI,CAAC,CAAC;MACjBpB,UAAU,CAACqB,GAAG,CAAE;QAAEnB,CAAC,EAAE,CAAC;QAAEC,CAAC,EAAE;MAAE,CAAE,CAAC;IACjC,CAAC;EACF,CAAC,EAAE,CACFvB,QAAQ,EACRC,QAAQ,EACRZ,QAAQ,EACRG,QAAQ,EACRC,mBAAmB,EACnBC,eAAe,EACfC,yBAAyB,EACzBC,oBAAoB,EACpBC,uBAAuB,CACtB,CAAC;EAEH,OAAOP,GAAG;AACX;AAAC,IAAAoD,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEczD,kBAAkB"}
@@ -24,20 +24,25 @@ var _style = _interopRequireDefault(require("./style.scss"));
24
24
  */
25
25
 
26
26
  function Warning({
27
+ actions,
27
28
  title,
28
29
  message,
29
30
  icon,
30
31
  iconClass,
31
32
  preferredColorScheme,
32
33
  getStylesFromColorScheme,
34
+ containerStyle: extraContainerStyle,
35
+ titleStyle: extraTitleStyle,
36
+ messageStyle: extraMessageStyle,
33
37
  ...viewProps
34
38
  }) {
35
39
  icon = icon && (0, _blocks.normalizeIconObject)(icon);
36
40
  const internalIconClass = 'warning-icon' + '-' + preferredColorScheme;
37
- const titleStyle = getStylesFromColorScheme(_style.default.title, _style.default.titleDark);
38
- const messageStyle = getStylesFromColorScheme(_style.default.message, _style.default.messageDark);
41
+ const containerStyle = [getStylesFromColorScheme(_style.default.container, _style.default.containerDark), extraContainerStyle];
42
+ const titleStyle = [getStylesFromColorScheme(_style.default.title, _style.default.titleDark), extraTitleStyle];
43
+ const messageStyle = [getStylesFromColorScheme(_style.default.message, _style.default.messageDark), extraMessageStyle];
39
44
  return (0, _react.createElement)(_reactNative.View, {
40
- style: getStylesFromColorScheme(_style.default.container, _style.default.containerDark),
45
+ style: containerStyle,
41
46
  ...viewProps
42
47
  }, icon && (0, _react.createElement)(_reactNative.View, {
43
48
  style: _style.default.icon
@@ -48,7 +53,7 @@ function Warning({
48
53
  style: titleStyle
49
54
  }, title), message && (0, _react.createElement)(_reactNative.Text, {
50
55
  style: messageStyle
51
- }, message));
56
+ }, message), actions);
52
57
  }
53
58
  var _default = exports.default = (0, _compose.withPreferredColorScheme)(Warning);
54
59
  //# sourceMappingURL=index.native.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_components","_compose","_blocks","_style","_interopRequireDefault","Warning","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","viewProps","normalizeIconObject","internalIconClass","titleStyle","styles","titleDark","messageStyle","messageDark","_react","createElement","View","style","container","containerDark","Icon","className","src","Text","_default","exports","default","withPreferredColorScheme"],"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\tconst titleStyle = getStylesFromColorScheme(\n\t\tstyles.title,\n\t\tstyles.titleDark\n\t);\n\tconst messageStyle = getStylesFromColorScheme(\n\t\tstyles.message,\n\t\tstyles.messageDark\n\t);\n\n\treturn (\n\t\t<View\n\t\t\tstyle={ getStylesFromColorScheme(\n\t\t\t\tstyles.container,\n\t\t\t\tstyles.containerDark\n\t\t\t) }\n\t\t\t{ ...viewProps }\n\t\t>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</Text> }\n\t\t</View>\n\t);\n}\n\nexport default withPreferredColorScheme( Warning );\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAC,sBAAA,CAAAL,OAAA;AAfA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,SAASM,OAAOA,CAAE;EACjBC,KAAK;EACLC,OAAO;EACPC,IAAI;EACJC,SAAS;EACTC,oBAAoB;EACpBC,wBAAwB;EACxB,GAAGC;AACJ,CAAC,EAAG;EACHJ,IAAI,GAAGA,IAAI,IAAI,IAAAK,2BAAmB,EAAEL,IAAK,CAAC;EAC1C,MAAMM,iBAAiB,GAAG,cAAc,GAAG,GAAG,GAAGJ,oBAAoB;EACrE,MAAMK,UAAU,GAAGJ,wBAAwB,CAC1CK,cAAM,CAACV,KAAK,EACZU,cAAM,CAACC,SACR,CAAC;EACD,MAAMC,YAAY,GAAGP,wBAAwB,CAC5CK,cAAM,CAACT,OAAO,EACdS,cAAM,CAACG,WACR,CAAC;EAED,OACC,IAAAC,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAAwB,IAAI;IACJC,KAAK,EAAGZ,wBAAwB,CAC/BK,cAAM,CAACQ,SAAS,EAChBR,cAAM,CAACS,aACR,CAAG;IAAA,GACEb;EAAS,GAEZJ,IAAI,IACL,IAAAY,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAAwB,IAAI;IAACC,KAAK,EAAGP,cAAM,CAACR;EAAM,GAC1B,IAAAY,MAAA,CAAAC,aAAA,EAACrB,WAAA,CAAA0B,IAAI;IACJC,SAAS,EAAGlB,SAAS,IAAIK,iBAAmB;IAC5CN,IAAI,EAAGA,IAAI,IAAIA,IAAI,CAACoB,GAAG,GAAGpB,IAAI,CAACoB,GAAG,GAAGpB;EAAM,CAC3C,CACI,CACN,EACCF,KAAK,IAAI,IAAAc,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAA+B,IAAI;IAACN,KAAK,EAAGR;EAAY,GAAGT,KAAa,CAAC,EACpDC,OAAO,IAAI,IAAAa,MAAA,CAAAC,aAAA,EAACvB,YAAA,CAAA+B,IAAI;IAACN,KAAK,EAAGL;EAAc,GAAGX,OAAe,CACtD,CAAC;AAET;AAAC,IAAAuB,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,iCAAwB,EAAE5B,OAAQ,CAAC"}
1
+ {"version":3,"names":["_reactNative","require","_components","_compose","_blocks","_style","_interopRequireDefault","Warning","actions","title","message","icon","iconClass","preferredColorScheme","getStylesFromColorScheme","containerStyle","extraContainerStyle","titleStyle","extraTitleStyle","messageStyle","extraMessageStyle","viewProps","normalizeIconObject","internalIconClass","styles","container","containerDark","titleDark","messageDark","_react","createElement","View","style","Icon","className","src","Text","_default","exports","default","withPreferredColorScheme"],"sources":["@wordpress/block-editor/src/components/warning/index.native.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport { View, Text } from 'react-native';\n\n/**\n * WordPress dependencies\n */\nimport { Icon } from '@wordpress/components';\nimport { withPreferredColorScheme } from '@wordpress/compose';\nimport { normalizeIconObject } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport styles from './style.scss';\n\nfunction Warning( {\n\tactions,\n\ttitle,\n\tmessage,\n\ticon,\n\ticonClass,\n\tpreferredColorScheme,\n\tgetStylesFromColorScheme,\n\tcontainerStyle: extraContainerStyle,\n\ttitleStyle: extraTitleStyle,\n\tmessageStyle: extraMessageStyle,\n\t...viewProps\n} ) {\n\ticon = icon && normalizeIconObject( icon );\n\tconst internalIconClass = 'warning-icon' + '-' + preferredColorScheme;\n\n\tconst containerStyle = [\n\t\tgetStylesFromColorScheme( styles.container, styles.containerDark ),\n\t\textraContainerStyle,\n\t];\n\tconst titleStyle = [\n\t\tgetStylesFromColorScheme( styles.title, styles.titleDark ),\n\t\textraTitleStyle,\n\t];\n\tconst messageStyle = [\n\t\tgetStylesFromColorScheme( styles.message, styles.messageDark ),\n\t\textraMessageStyle,\n\t];\n\n\treturn (\n\t\t<View style={ containerStyle } { ...viewProps }>\n\t\t\t{ icon && (\n\t\t\t\t<View style={ styles.icon }>\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tclassName={ iconClass || internalIconClass }\n\t\t\t\t\t\ticon={ icon && icon.src ? icon.src : icon }\n\t\t\t\t\t/>\n\t\t\t\t</View>\n\t\t\t) }\n\t\t\t{ title && <Text style={ titleStyle }>{ title }</Text> }\n\t\t\t{ message && <Text style={ messageStyle }>{ message }</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,cAAM,CAACb;EAAM,GAC1B,IAAAkB,MAAA,CAAAC,aAAA,EAAC5B,WAAA,CAAA+B,IAAI;IACJC,SAAS,EAAGtB,SAAS,IAAIW,iBAAmB;IAC5CZ,IAAI,EAAGA,IAAI,IAAIA,IAAI,CAACwB,GAAG,GAAGxB,IAAI,CAACwB,GAAG,GAAGxB;EAAM,CAC3C,CACI,CACN,EACCF,KAAK,IAAI,IAAAoB,MAAA,CAAAC,aAAA,EAAC9B,YAAA,CAAAoC,IAAI;IAACJ,KAAK,EAAGf;EAAY,GAAGR,KAAa,CAAC,EACpDC,OAAO,IAAI,IAAAmB,MAAA,CAAAC,aAAA,EAAC9B,YAAA,CAAAoC,IAAI;IAACJ,KAAK,EAAGb;EAAc,GAAGT,OAAe,CAAC,EAC1DF,OACG,CAAC;AAET;AAAC,IAAA6B,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc,IAAAC,iCAAwB,EAAEjC,OAAQ,CAAC"}
@@ -59,13 +59,17 @@ function addAttribute(settings) {
59
59
  return settings;
60
60
  }
61
61
  function BlockEditAnchorControlPure({
62
- name: blockName,
63
62
  anchor,
64
63
  setAttributes
65
64
  }) {
66
65
  const blockEditingMode = (0, _blockEditingMode.useBlockEditingMode)();
66
+ if (blockEditingMode !== 'default') {
67
+ return null;
68
+ }
67
69
  const isWeb = _element.Platform.OS === 'web';
68
- const textControl = (0, _react.createElement)(_components.TextControl, {
70
+ return (0, _react.createElement)(_components2.InspectorControls, {
71
+ group: "advanced"
72
+ }, (0, _react.createElement)(_components.TextControl, {
69
73
  __nextHasNoMarginBottom: true,
70
74
  __next40pxDefaultSize: true,
71
75
  className: "html-anchor-control",
@@ -83,12 +87,7 @@ function BlockEditAnchorControlPure({
83
87
  },
84
88
  autoCapitalize: "none",
85
89
  autoComplete: "off"
86
- });
87
- return (0, _react.createElement)(_react.Fragment, null, isWeb && blockEditingMode === 'default' && (0, _react.createElement)(_components2.InspectorControls, {
88
- group: "advanced"
89
- }, textControl), !isWeb && blockName === 'core/heading' && (0, _react.createElement)(_components2.InspectorControls, null, (0, _react.createElement)(_components.PanelBody, {
90
- title: (0, _i18n.__)('Heading settings')
91
- }, textControl)));
90
+ }));
92
91
  }
93
92
  var _default = exports.default = {
94
93
  addSaveProps,
@@ -1 +1 @@
1
- {"version":3,"names":["_hooks","require","_components","_i18n","_blocks","_element","_components2","_blockEditingMode","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","hasBlockSupport","BlockEditAnchorControlPure","name","blockName","setAttributes","blockEditingMode","useBlockEditingMode","isWeb","Platform","OS","textControl","_react","createElement","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","className","label","__","help","Fragment","ExternalLink","href","value","placeholder","onChange","nextValue","replace","autoCapitalize","autoComplete","InspectorControls","group","PanelBody","title","_default","exports","default","addSaveProps","edit","attributeKeys","hasSupport","extraProps","blockType","id","addFilter"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { PanelBody, TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( {\n\tname: blockName,\n\tanchor,\n\tsetAttributes,\n} ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tconst isWeb = Platform.OS === 'web';\n\tconst textControl = (\n\t\t<TextControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\t__next40pxDefaultSize\n\t\t\tclassName=\"html-anchor-control\"\n\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\thelp={\n\t\t\t\t<>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t) }\n\n\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tvalue={ anchor || '' }\n\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\tsetAttributes( {\n\t\t\t\t\tanchor: nextValue,\n\t\t\t\t} );\n\t\t\t} }\n\t\t\tautoCapitalize=\"none\"\n\t\t\tautoComplete=\"off\"\n\t\t/>\n\t);\n\n\treturn (\n\t\t<>\n\t\t\t{ isWeb && blockEditingMode === 'default' && (\n\t\t\t\t<InspectorControls group=\"advanced\">\n\t\t\t\t\t{ textControl }\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t\t{ /*\n\t\t\t * We plan to remove scoping anchors to 'core/heading' to support\n\t\t\t * anchors for all eligble blocks. Additionally we plan to explore\n\t\t\t * leveraging InspectorAdvancedControls instead of a custom\n\t\t\t * PanelBody title. https://github.com/WordPress/gutenberg/issues/28363\n\t\t\t */ }\n\t\t\t{ ! isWeb && blockName === 'core/heading' && (\n\t\t\t\t<InspectorControls>\n\t\t\t\t\t<PanelBody title={ __( 'Heading settings' ) }>\n\t\t\t\t\t\t{ textControl }\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</InspectorControls>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA;A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,UAAU,EAAEC,SAAS,EAAE5C,UAAU,EAAG;EACjE,IAAK,IAAAE,uBAAe,EAAE0C,SAAS,EAAE,QAAS,CAAC,EAAG;IAC7CD,UAAU,CAACE,EAAE,GAAG7C,UAAU,CAACC,MAAM,KAAK,EAAE,GAAG,IAAI,GAAGD,UAAU,CAACC,MAAM;EACpE;EAEA,OAAO0C,UAAU;AAClB;AAEA,IAAAG,gBAAS,EAAE,0BAA0B,EAAE,uBAAuB,EAAEjD,YAAa,CAAC"}
1
+ {"version":3,"names":["_hooks","require","_components","_i18n","_blocks","_element","_components2","_blockEditingMode","ANCHOR_REGEX","ANCHOR_SCHEMA","type","source","attribute","selector","addAttribute","settings","_settings$attributes$","attributes","anchor","hasBlockSupport","BlockEditAnchorControlPure","setAttributes","blockEditingMode","useBlockEditingMode","isWeb","Platform","OS","_react","createElement","InspectorControls","group","TextControl","__nextHasNoMarginBottom","__next40pxDefaultSize","className","label","__","help","Fragment","ExternalLink","href","value","placeholder","onChange","nextValue","replace","autoCapitalize","autoComplete","_default","exports","default","addSaveProps","edit","attributeKeys","hasSupport","name","extraProps","blockType","id","addFilter"],"sources":["@wordpress/block-editor/src/hooks/anchor.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { TextControl, ExternalLink } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { hasBlockSupport } from '@wordpress/blocks';\nimport { Platform } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { InspectorControls } from '../components';\nimport { useBlockEditingMode } from '../components/block-editing-mode';\n\n/**\n * Regular expression matching invalid anchor characters for replacement.\n *\n * @type {RegExp}\n */\nconst ANCHOR_REGEX = /[\\s#]/g;\n\nconst ANCHOR_SCHEMA = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tattribute: 'id',\n\tselector: '*',\n};\n\n/**\n * Filters registered block settings, extending attributes with anchor using ID\n * of the first node.\n *\n * @param {Object} settings Original block settings.\n *\n * @return {Object} Filtered block settings.\n */\nexport function addAttribute( settings ) {\n\t// Allow blocks to specify their own attribute definition with default values if needed.\n\tif ( 'type' in ( settings.attributes?.anchor ?? {} ) ) {\n\t\treturn settings;\n\t}\n\tif ( hasBlockSupport( settings, 'anchor' ) ) {\n\t\t// Gracefully handle if settings.attributes is undefined.\n\t\tsettings.attributes = {\n\t\t\t...settings.attributes,\n\t\t\tanchor: ANCHOR_SCHEMA,\n\t\t};\n\t}\n\n\treturn settings;\n}\n\nfunction BlockEditAnchorControlPure( { anchor, setAttributes } ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\n\tif ( blockEditingMode !== 'default' ) {\n\t\treturn null;\n\t}\n\n\tconst isWeb = Platform.OS === 'web';\n\n\treturn (\n\t\t<InspectorControls group=\"advanced\">\n\t\t\t<TextControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tclassName=\"html-anchor-control\"\n\t\t\t\tlabel={ __( 'HTML anchor' ) }\n\t\t\t\thelp={\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t'Enter a word or two — without spaces — to make a unique web address just for this block, called an “anchor.” Then, you’ll be able to link directly to this section of your page.'\n\t\t\t\t\t\t) }\n\n\t\t\t\t\t\t{ isWeb && (\n\t\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/documentation/article/page-jumps/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Learn more about anchors' ) }\n\t\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</>\n\t\t\t\t}\n\t\t\t\tvalue={ anchor || '' }\n\t\t\t\tplaceholder={ ! isWeb ? __( 'Add an anchor' ) : null }\n\t\t\t\tonChange={ ( nextValue ) => {\n\t\t\t\t\tnextValue = nextValue.replace( ANCHOR_REGEX, '-' );\n\t\t\t\t\tsetAttributes( {\n\t\t\t\t\t\tanchor: nextValue,\n\t\t\t\t\t} );\n\t\t\t\t} }\n\t\t\t\tautoCapitalize=\"none\"\n\t\t\t\tautoComplete=\"off\"\n\t\t\t/>\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\taddSaveProps,\n\tedit: BlockEditAnchorControlPure,\n\tattributeKeys: [ 'anchor' ],\n\thasSupport( name ) {\n\t\treturn hasBlockSupport( name, 'anchor' );\n\t},\n};\n\n/**\n * Override props assigned to save component to inject anchor ID, if block\n * supports anchor. This is only applied if the block's save result is an\n * element and not a markup string.\n *\n * @param {Object} extraProps Additional props applied to save element.\n * @param {Object} blockType Block type.\n * @param {Object} attributes Current block attributes.\n *\n * @return {Object} Filtered props applied to save element.\n */\nexport function addSaveProps( extraProps, blockType, attributes ) {\n\tif ( hasBlockSupport( blockType, 'anchor' ) ) {\n\t\textraProps.id = attributes.anchor === '' ? null : attributes.anchor;\n\t}\n\n\treturn extraProps;\n}\n\naddFilter( 'blocks.registerBlockType', 'core/anchor/attribute', addAttribute );\n"],"mappings":";;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAbA;AACA;AACA;;AAOA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA,MAAMO,YAAY,GAAG,QAAQ;AAE7B,MAAMC,aAAa,GAAG;EACrBC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,WAAW;EACnBC,SAAS,EAAE,IAAI;EACfC,QAAQ,EAAE;AACX,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,YAAYA,CAAEC,QAAQ,EAAG;EAAA,IAAAC,qB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AAY,QAAE,EAAE,eAAgB,CAAC,GAAG,IAAM;IACtDO,QAAQ,EAAKC,SAAS,IAAM;MAC3BA,SAAS,GAAGA,SAAS,CAACC,OAAO,CAAErC,YAAY,EAAE,GAAI,CAAC;MAClDa,aAAa,CAAE;QACdH,MAAM,EAAE0B;MACT,CAAE,CAAC;IACJ,CAAG;IACHE,cAAc,EAAC,MAAM;IACrBC,YAAY,EAAC;EAAK,CAClB,CACiB,CAAC;AAEtB;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEc;EACdC,YAAY;EACZC,IAAI,EAAEhC,0BAA0B;EAChCiC,aAAa,EAAE,CAAE,QAAQ,CAAE;EAC3BC,UAAUA,CAAEC,IAAI,EAAG;IAClB,OAAO,IAAApC,uBAAe,EAAEoC,IAAI,EAAE,QAAS,CAAC;EACzC;AACD,CAAC;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASJ,YAAYA,CAAEK,UAAU,EAAEC,SAAS,EAAExC,UAAU,EAAG;EACjE,IAAK,IAAAE,uBAAe,EAAEsC,SAAS,EAAE,QAAS,CAAC,EAAG;IAC7CD,UAAU,CAACE,EAAE,GAAGzC,UAAU,CAACC,MAAM,KAAK,EAAE,GAAG,IAAI,GAAGD,UAAU,CAACC,MAAM;EACpE;EAEA,OAAOsC,UAAU;AAClB;AAEA,IAAAG,gBAAS,EAAE,0BAA0B,EAAE,uBAAuB,EAAE7C,YAAa,CAAC"}
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.BACKGROUND_SUPPORT_KEY = void 0;
8
8
  exports.BackgroundImagePanel = BackgroundImagePanel;
9
- exports.coordsToBackgroundPosition = exports.backgroundPositionToCoords = exports.IMAGE_BACKGROUND_TYPE = void 0;
9
+ exports.default = exports.coordsToBackgroundPosition = exports.backgroundPositionToCoords = exports.IMAGE_BACKGROUND_TYPE = void 0;
10
10
  exports.getBackgroundImageClasses = getBackgroundImageClasses;
11
11
  exports.hasBackgroundImageValue = hasBackgroundImageValue;
12
12
  exports.hasBackgroundSizeValue = hasBackgroundSizeValue;
@@ -88,6 +88,38 @@ function hasBackgroundSupport(blockName, feature = 'any') {
88
88
  }
89
89
  return !!support?.[feature];
90
90
  }
91
+ function useBlockProps({
92
+ name,
93
+ style
94
+ }) {
95
+ if (!hasBackgroundSupport(name) || !style?.background?.backgroundImage) {
96
+ return;
97
+ }
98
+ const backgroundImage = style?.background?.backgroundImage;
99
+ let props;
100
+
101
+ // Set block background defaults.
102
+ if (backgroundImage?.source === 'file' && !!backgroundImage?.url) {
103
+ if (!style?.background?.backgroundSize) {
104
+ props = {
105
+ style: {
106
+ backgroundSize: 'cover'
107
+ }
108
+ };
109
+ }
110
+ if ('contain' === style?.background?.backgroundSize && !style?.background?.backgroundPosition) {
111
+ props = {
112
+ style: {
113
+ backgroundPosition: 'center'
114
+ }
115
+ };
116
+ }
117
+ }
118
+ if (!props) {
119
+ return;
120
+ }
121
+ return props;
122
+ }
91
123
 
92
124
  /**
93
125
  * Resets the background image block support attributes. This can be used when disabling
@@ -356,7 +388,7 @@ function BackgroundSizePanelItem({
356
388
  // If the current value is `cover` and the repeat value is `undefined`, then
357
389
  // the toggle should be unchecked as the default state. Otherwise, the toggle
358
390
  // should reflect the current repeat value.
359
- const repeatCheckedValue = repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined ? false : true;
391
+ const repeatCheckedValue = !(repeatValue === 'no-repeat' || currentValueForToggle === 'cover' && repeatValue === undefined);
360
392
  const hasValue = hasBackgroundSizeValue(style);
361
393
  const resetAllFilter = (0, _element.useCallback)(previousValue => {
362
394
  return {
@@ -475,4 +507,9 @@ function BackgroundImagePanel(props) {
475
507
  ...props
476
508
  }));
477
509
  }
510
+ var _default = exports.default = {
511
+ useBlockProps,
512
+ attributeKeys: ['style'],
513
+ hasSupport: hasBackgroundSupport
514
+ };
478
515
  //# sourceMappingURL=background.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_classnames","_interopRequireDefault","require","_blob","_blocks","_dom","_components","_data","_element","_i18n","_notices","_url","_inspectorControls","_mediaReplaceFlow","_useSettings","_utils","_store","BACKGROUND_SUPPORT_KEY","exports","IMAGE_BACKGROUND_TYPE","hasBackgroundImageValue","style","hasValue","background","backgroundImage","id","url","hasBackgroundSizeValue","backgroundPosition","undefined","backgroundSize","hasBackgroundSupport","blockName","feature","Platform","OS","support","getBlockSupport","backgroundRepeat","resetBackgroundImage","setAttributes","cleanEmptyObject","resetBackgroundSize","getBackgroundImageClasses","InspectorImagePreview","label","filename","imgUrl","imgLabel","getFilename","_react","createElement","__experimentalItemGroup","as","__experimentalHStack","justify","className","classnames","FlexItem","__experimentalTruncate","numberOfLines","VisuallyHidden","sprintf","__","BackgroundImagePanelItem","clientId","isShownByDefault","mediaUpload","useSelect","select","getBlockAttributes","getSettings","blockEditorStore","title","replaceContainerRef","useRef","createErrorNotice","useDispatch","noticesStore","onUploadError","message","type","onSelectMedia","media","newStyle","newAttributes","isBlobURL","media_type","source","onFilesDrop","filesList","allowedTypes","onFileChange","image","onError","resetAllFilter","useCallback","previousValue","__experimentalToolsPanelItem","onDeselect","panelId","ref","default","mediaId","mediaURL","accept","onSelect","name","variant","MenuItem","onClick","toggleButton","focus","tabbable","find","current","click","DropZone","backgroundSizeHelpText","value","coordsToBackgroundPosition","isNaN","x","y","backgroundPositionToCoords","split","map","v","parseFloat","BackgroundSizePanelItem","sizeValue","repeatValue","currentValueForToggle","repeatCheckedValue","updateBackgroundSize","next","nextRepeat","updateBackgroundPosition","toggleIsRepeated","__experimentalVStack","ToolsPanelItem","spacing","FocalPointPicker","__next40pxDefaultSize","onChange","__experimentalToggleGroupControl","size","isBlock","help","__experimentalToggleGroupControlOption","key","__experimentalUnitControl","ToggleControl","checked","BackgroundImagePanel","props","useSettings","showBackgroundSize","defaultControls","group"],"sources":["@wordpress/block-editor/src/hooks/background.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalVStack as VStack,\n\tDropZone,\n\tFlexItem,\n\tFocalPointPicker,\n\tMenuItem,\n\tVisuallyHidden,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Platform, useCallback, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport MediaReplaceFlow from '../components/media-replace-flow';\nimport { useSettings } from '../components/use-settings';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\nexport const IMAGE_BACKGROUND_TYPE = 'image';\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\tconst hasValue =\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t!! style?.background?.backgroundImage?.url;\n\n\treturn hasValue;\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Determine whether there is block support for background.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBackgroundSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BACKGROUND_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn (\n\t\t\t!! support?.backgroundImage ||\n\t\t\t!! support?.backgroundSize ||\n\t\t\t!! support?.backgroundRepeat\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\n/**\n * Resets the background image block support attributes. This can be used when disabling\n * the background image controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nexport function resetBackgroundImage( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Resets the background size block support attributes. This can be used when disabling\n * the background size controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nfunction resetBackgroundSize( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundPosition: undefined,\n\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\tbackgroundSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Generates a CSS class name if an background image is set.\n *\n * @param {Object} style A block's style attribute.\n *\n * @return {string} CSS class name.\n */\nexport function getBackgroundImageClasses( style ) {\n\treturn hasBackgroundImageValue( style ) ? 'has-background' : '';\n}\n\nfunction InspectorImagePreview( { label, filename, url: imgUrl } ) {\n\tconst imgLabel = label || getFilename( imgUrl );\n\treturn (\n\t\t<ItemGroup as=\"span\">\n\t\t\t<HStack justify=\"flex-start\" as=\"span\">\n\t\t\t\t<span\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-hooks__background__inspector-image-indicator-wrapper',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-image': imgUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-hidden\n\t\t\t\t>\n\t\t\t\t\t{ imgUrl && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-image-indicator\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tbackgroundImage: `url(${ imgUrl })`,\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</span>\n\t\t\t\t<FlexItem as=\"span\">\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ imgLabel }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ filename\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t\t\t\t\t__( 'Selected image: %s' ),\n\t\t\t\t\t\t\t\t\tfilename\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __( 'No image selected' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</ItemGroup>\n\t);\n}\n\nfunction BackgroundImagePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst { style, mediaUpload } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style,\n\t\t\t\tmediaUpload: getSettings().mediaUpload,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { id, title, url } = style?.background?.backgroundImage || {};\n\n\tconst replaceContainerRef = useRef();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst onSelectMedia = ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundImage: undefined,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst newAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t};\n\n\t\t\tsetAttributes( newAttributes );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For media selections originated from a file upload.\n\t\tif (\n\t\t\t( media.media_type &&\n\t\t\t\tmedia.media_type !== IMAGE_BACKGROUND_TYPE ) ||\n\t\t\t( ! media.media_type &&\n\t\t\t\tmedia.type &&\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE )\n\t\t) {\n\t\t\tonUploadError(\n\t\t\t\t__( 'Only images can be used as a background image.' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: {\n\t\t\t\t\turl: media.url,\n\t\t\t\t\tid: media.id,\n\t\t\t\t\tsource: 'file',\n\t\t\t\t\ttitle: media.title || undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t};\n\n\t\tsetAttributes( newAttributes );\n\t};\n\n\tconst onFilesDrop = ( filesList ) => {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonSelectMedia( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst hasValue = hasBackgroundImageValue( style );\n\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Background image' ) }\n\t\t\tonDeselect={ () => resetBackgroundImage( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-container\"\n\t\t\t\tref={ replaceContainerRef }\n\t\t\t>\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tname={\n\t\t\t\t\t\t<InspectorImagePreview\n\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t\tfilename={ title }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t>\n\t\t\t\t\t{ hasValue && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst [ toggleButton ] = focus.tabbable.find(\n\t\t\t\t\t\t\t\t\treplaceContainerRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t// Focus the toggle button and close the dropdown menu.\n\t\t\t\t\t\t\t\t// This ensures similar behaviour as to selecting an image, where the dropdown is\n\t\t\t\t\t\t\t\t// closed and focus is redirected to the dropdown toggle button.\n\t\t\t\t\t\t\t\ttoggleButton?.focus();\n\t\t\t\t\t\t\t\ttoggleButton?.click();\n\t\t\t\t\t\t\t\tresetBackgroundImage( style, setAttributes );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset ' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t<DropZone\n\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\tlabel={ __( 'Drop to upload' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</ToolsPanelItem>\n\t);\n}\n\nfunction backgroundSizeHelpText( value ) {\n\tif ( value === 'cover' || value === undefined ) {\n\t\treturn __( 'Image covers the space evenly.' );\n\t}\n\tif ( value === 'contain' ) {\n\t\treturn __( 'Image is contained without distortion.' );\n\t}\n\treturn __( 'Specify a fixed width.' );\n}\n\nexport const coordsToBackgroundPosition = ( value ) => {\n\tif ( ! value || ( isNaN( value.x ) && isNaN( value.y ) ) ) {\n\t\treturn undefined;\n\t}\n\n\tconst x = isNaN( value.x ) ? 0.5 : value.x;\n\tconst y = isNaN( value.y ) ? 0.5 : value.y;\n\n\treturn `${ x * 100 }% ${ y * 100 }%`;\n};\n\nexport const backgroundPositionToCoords = ( value ) => {\n\tif ( ! value ) {\n\t\treturn { x: undefined, y: undefined };\n\t}\n\n\tlet [ x, y ] = value.split( ' ' ).map( ( v ) => parseFloat( v ) / 100 );\n\tx = isNaN( x ) ? undefined : x;\n\ty = isNaN( y ) ? x : y;\n\n\treturn { x, y };\n};\n\nfunction BackgroundSizePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst style = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\n\tconst sizeValue = style?.background?.backgroundSize;\n\tconst repeatValue = style?.background?.backgroundRepeat;\n\n\t// An `undefined` value is treated as `cover` by the toggle group control.\n\t// An empty string is treated as `auto` by the toggle group control. This\n\t// allows a user to select \"Size\" and then enter a custom value, with an\n\t// empty value being treated as `auto`.\n\tconst currentValueForToggle =\n\t\t( sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ) ||\n\t\tsizeValue === ''\n\t\t\t? 'auto'\n\t\t\t: sizeValue || 'cover';\n\n\t// If the current value is `cover` and the repeat value is `undefined`, then\n\t// the toggle should be unchecked as the default state. Otherwise, the toggle\n\t// should reflect the current repeat value.\n\tconst repeatCheckedValue =\n\t\trepeatValue === 'no-repeat' ||\n\t\t( currentValueForToggle === 'cover' && repeatValue === undefined )\n\t\t\t? false\n\t\t\t: true;\n\n\tconst hasValue = hasBackgroundSizeValue( style );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...previousValue.style?.background,\n\t\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\t\tbackgroundSize: undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst updateBackgroundSize = ( next ) => {\n\t\t// When switching to 'contain' toggle the repeat off.\n\t\tlet nextRepeat = repeatValue;\n\n\t\tif ( next === 'contain' ) {\n\t\t\tnextRepeat = 'no-repeat';\n\t\t}\n\n\t\tif (\n\t\t\t( currentValueForToggle === 'cover' ||\n\t\t\t\tcurrentValueForToggle === 'contain' ) &&\n\t\t\tnext === 'auto'\n\t\t) {\n\t\t\tnextRepeat = undefined;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat: nextRepeat,\n\t\t\t\t\tbackgroundSize: next,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst updateBackgroundPosition = ( next ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundPosition: coordsToBackgroundPosition( next ),\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat:\n\t\t\t\t\t\trepeatCheckedValue === true ? 'no-repeat' : undefined,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Size' ) }\n\t\t\tonDeselect={ () => resetBackgroundSize( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<FocalPointPicker\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\turl={ style?.background?.backgroundImage?.url }\n\t\t\t\tvalue={ backgroundPositionToCoords(\n\t\t\t\t\tstyle?.background?.backgroundPosition\n\t\t\t\t) }\n\t\t\t\tonChange={ updateBackgroundPosition }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\tvalue={ currentValueForToggle }\n\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\tisBlock\n\t\t\t\thelp={ backgroundSizeHelpText( sizeValue ) }\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'cover' }\n\t\t\t\t\tvalue={ 'cover' }\n\t\t\t\t\tlabel={ __( 'Cover' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'contain' }\n\t\t\t\t\tvalue={ 'contain' }\n\t\t\t\t\tlabel={ __( 'Contain' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'fixed' }\n\t\t\t\t\tvalue={ 'auto' }\n\t\t\t\t\tlabel={ __( 'Fixed' ) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ? (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\t\tvalue={ sizeValue }\n\t\t\t\t/>\n\t\t\t) : null }\n\t\t\t{ currentValueForToggle !== 'cover' && (\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Repeat' ) }\n\t\t\t\t\tchecked={ repeatCheckedValue }\n\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function BackgroundImagePanel( props ) {\n\tconst [ backgroundImage, backgroundSize ] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize'\n\t);\n\n\tif (\n\t\t! backgroundImage ||\n\t\t! hasBackgroundSupport( props.name, 'backgroundImage' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst showBackgroundSize = !! (\n\t\tbackgroundSize && hasBackgroundSupport( props.name, 'backgroundSize' )\n\t);\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tBACKGROUND_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<InspectorControls group=\"background\">\n\t\t\t<BackgroundImagePanelItem\n\t\t\t\tisShownByDefault={ defaultControls?.backgroundImage }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t{ showBackgroundSize && (\n\t\t\t\t<BackgroundSizePanelItem\n\t\t\t\t\tisShownByDefault={ defaultControls?.backgroundSize }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAgBA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,IAAA,GAAAT,OAAA;AAKA,IAAAU,kBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,iBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,YAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AAxCA;AACA;AACA;;AAGA;AACA;AACA;;AA0BA;AACA;AACA;;AAOO,MAAMe,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,YAAY;AAC3C,MAAME,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AlF,MAAA,CAAAC,aAAA,EAAC7C,WAAA,CAAAkJ,aAAa;IACb3G,KAAK,EAAG,IAAAkB,QAAE,EAAE,QAAS,CAAG;IACxB0F,OAAO,EAAGpB,kBAAoB;IAC9BW,QAAQ,EAAGN;EAAkB,CAC7B,CAEK,CAAC;AAEX;AAEO,SAASgB,oBAAoBA,CAAEC,KAAK,EAAG;EAC7C,MAAM,CAAEnI,eAAe,EAAEM,cAAc,CAAE,GAAG,IAAA8H,wBAAW,EACtD,4BAA4B,EAC5B,2BACD,CAAC;EAED,IACC,CAAEpI,eAAe,IACjB,CAAEO,oBAAoB,CAAE4H,KAAK,CAAChD,IAAI,EAAE,iBAAkB,CAAC,EACtD;IACD,OAAO,IAAI;EACZ;EAEA,MAAMkD,kBAAkB,GAAG,CAAC,EAC3B/H,cAAc,IAAIC,oBAAoB,CAAE4H,KAAK,CAAChD,IAAI,EAAE,gBAAiB,CAAC,CACtE;EAED,MAAMmD,eAAe,GAAG,IAAAzH,uBAAe,EAAEsH,KAAK,CAAChD,IAAI,EAAE,CACpD1F,sBAAsB,EACtB,+BAA+B,CAC9B,CAAC;EAEH,OACC,IAAAiC,MAAA,CAAAC,aAAA,EAACvC,kBAAA,CAAA0F,OAAiB;IAACyD,KAAK,EAAC;EAAY,GACpC,IAAA7G,MAAA,CAAAC,aAAA,EAACa,wBAAwB;IACxBE,gBAAgB,EAAG4F,eAAe,EAAEtI,eAAiB;IAAA,GAChDmI;EAAK,CACV,CAAC,EACAE,kBAAkB,IACnB,IAAA3G,MAAA,CAAAC,aAAA,EAAC8E,uBAAuB;IACvB/D,gBAAgB,EAAG4F,eAAe,EAAEhI,cAAgB;IAAA,GAC/C6H;EAAK,CACV,CAEgB,CAAC;AAEtB"}
1
+ {"version":3,"names":["_classnames","_interopRequireDefault","require","_blob","_blocks","_dom","_components","_data","_element","_i18n","_notices","_url","_inspectorControls","_mediaReplaceFlow","_useSettings","_utils","_store","BACKGROUND_SUPPORT_KEY","exports","IMAGE_BACKGROUND_TYPE","hasBackgroundImageValue","style","hasValue","background","backgroundImage","id","url","hasBackgroundSizeValue","backgroundPosition","undefined","backgroundSize","hasBackgroundSupport","blockName","feature","Platform","OS","support","getBlockSupport","backgroundRepeat","useBlockProps","name","props","source","resetBackgroundImage","setAttributes","cleanEmptyObject","resetBackgroundSize","getBackgroundImageClasses","InspectorImagePreview","label","filename","imgUrl","imgLabel","getFilename","_react","createElement","__experimentalItemGroup","as","__experimentalHStack","justify","className","classnames","FlexItem","__experimentalTruncate","numberOfLines","VisuallyHidden","sprintf","__","BackgroundImagePanelItem","clientId","isShownByDefault","mediaUpload","useSelect","select","getBlockAttributes","getSettings","blockEditorStore","title","replaceContainerRef","useRef","createErrorNotice","useDispatch","noticesStore","onUploadError","message","type","onSelectMedia","media","newStyle","newAttributes","isBlobURL","media_type","onFilesDrop","filesList","allowedTypes","onFileChange","image","onError","resetAllFilter","useCallback","previousValue","__experimentalToolsPanelItem","onDeselect","panelId","ref","default","mediaId","mediaURL","accept","onSelect","variant","MenuItem","onClick","toggleButton","focus","tabbable","find","current","click","DropZone","backgroundSizeHelpText","value","coordsToBackgroundPosition","isNaN","x","y","backgroundPositionToCoords","split","map","v","parseFloat","BackgroundSizePanelItem","sizeValue","repeatValue","currentValueForToggle","repeatCheckedValue","updateBackgroundSize","next","nextRepeat","updateBackgroundPosition","toggleIsRepeated","__experimentalVStack","ToolsPanelItem","spacing","FocalPointPicker","__next40pxDefaultSize","onChange","__experimentalToggleGroupControl","size","isBlock","help","__experimentalToggleGroupControlOption","key","__experimentalUnitControl","ToggleControl","checked","BackgroundImagePanel","useSettings","showBackgroundSize","defaultControls","group","_default","attributeKeys","hasSupport"],"sources":["@wordpress/block-editor/src/hooks/background.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { isBlobURL } from '@wordpress/blob';\nimport { getBlockSupport } from '@wordpress/blocks';\nimport { focus } from '@wordpress/dom';\nimport {\n\tToggleControl,\n\t__experimentalToggleGroupControl as ToggleGroupControl,\n\t__experimentalToggleGroupControlOption as ToggleGroupControlOption,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n\t__experimentalUnitControl as UnitControl,\n\t__experimentalVStack as VStack,\n\tDropZone,\n\tFlexItem,\n\tFocalPointPicker,\n\tMenuItem,\n\tVisuallyHidden,\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalTruncate as Truncate,\n} from '@wordpress/components';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { Platform, useCallback, useRef } from '@wordpress/element';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { getFilename } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport InspectorControls from '../components/inspector-controls';\nimport MediaReplaceFlow from '../components/media-replace-flow';\nimport { useSettings } from '../components/use-settings';\nimport { cleanEmptyObject } from './utils';\nimport { store as blockEditorStore } from '../store';\n\nexport const BACKGROUND_SUPPORT_KEY = 'background';\nexport const IMAGE_BACKGROUND_TYPE = 'image';\n\n/**\n * Checks if there is a current value in the background image block support\n * attributes.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background image value set.\n */\nexport function hasBackgroundImageValue( style ) {\n\tconst hasValue =\n\t\t!! style?.background?.backgroundImage?.id ||\n\t\t!! style?.background?.backgroundImage?.url;\n\n\treturn hasValue;\n}\n\n/**\n * Checks if there is a current value in the background size block support\n * attributes. Background size values include background size as well\n * as background position.\n *\n * @param {Object} style Style attribute.\n * @return {boolean} Whether or not the block has a background size value set.\n */\nexport function hasBackgroundSizeValue( style ) {\n\treturn (\n\t\tstyle?.background?.backgroundPosition !== undefined ||\n\t\tstyle?.background?.backgroundSize !== undefined\n\t);\n}\n\n/**\n * Determine whether there is block support for background.\n *\n * @param {string} blockName Block name.\n * @param {string} feature Background image feature to check for.\n *\n * @return {boolean} Whether there is support.\n */\nexport function hasBackgroundSupport( blockName, feature = 'any' ) {\n\tif ( Platform.OS !== 'web' ) {\n\t\treturn false;\n\t}\n\n\tconst support = getBlockSupport( blockName, BACKGROUND_SUPPORT_KEY );\n\n\tif ( support === true ) {\n\t\treturn true;\n\t}\n\n\tif ( feature === 'any' ) {\n\t\treturn (\n\t\t\t!! support?.backgroundImage ||\n\t\t\t!! support?.backgroundSize ||\n\t\t\t!! support?.backgroundRepeat\n\t\t);\n\t}\n\n\treturn !! support?.[ feature ];\n}\n\nfunction useBlockProps( { name, style } ) {\n\tif (\n\t\t! hasBackgroundSupport( name ) ||\n\t\t! style?.background?.backgroundImage\n\t) {\n\t\treturn;\n\t}\n\n\tconst backgroundImage = style?.background?.backgroundImage;\n\tlet props;\n\n\t// Set block background defaults.\n\tif ( backgroundImage?.source === 'file' && !! backgroundImage?.url ) {\n\t\tif ( ! style?.background?.backgroundSize ) {\n\t\t\tprops = {\n\t\t\t\tstyle: {\n\t\t\t\t\tbackgroundSize: 'cover',\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\t'contain' === style?.background?.backgroundSize &&\n\t\t\t! style?.background?.backgroundPosition\n\t\t) {\n\t\t\tprops = {\n\t\t\t\tstyle: {\n\t\t\t\t\tbackgroundPosition: 'center',\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t}\n\n\tif ( ! props ) {\n\t\treturn;\n\t}\n\n\treturn props;\n}\n\n/**\n * Resets the background image block support attributes. This can be used when disabling\n * the background image controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nexport function resetBackgroundImage( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Resets the background size block support attributes. This can be used when disabling\n * the background size controls for a block via a `ToolsPanel`.\n *\n * @param {Object} style Style attribute.\n * @param {Function} setAttributes Function to set block's attributes.\n */\nfunction resetBackgroundSize( style = {}, setAttributes ) {\n\tsetAttributes( {\n\t\tstyle: cleanEmptyObject( {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundPosition: undefined,\n\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\tbackgroundSize: undefined,\n\t\t\t},\n\t\t} ),\n\t} );\n}\n\n/**\n * Generates a CSS class name if an background image is set.\n *\n * @param {Object} style A block's style attribute.\n *\n * @return {string} CSS class name.\n */\nexport function getBackgroundImageClasses( style ) {\n\treturn hasBackgroundImageValue( style ) ? 'has-background' : '';\n}\n\nfunction InspectorImagePreview( { label, filename, url: imgUrl } ) {\n\tconst imgLabel = label || getFilename( imgUrl );\n\treturn (\n\t\t<ItemGroup as=\"span\">\n\t\t\t<HStack justify=\"flex-start\" as=\"span\">\n\t\t\t\t<span\n\t\t\t\t\tclassName={ classnames(\n\t\t\t\t\t\t'block-editor-hooks__background__inspector-image-indicator-wrapper',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-image': imgUrl,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\taria-hidden\n\t\t\t\t>\n\t\t\t\t\t{ imgUrl && (\n\t\t\t\t\t\t<span\n\t\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-image-indicator\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\tbackgroundImage: `url(${ imgUrl })`,\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</span>\n\t\t\t\t<FlexItem as=\"span\">\n\t\t\t\t\t<Truncate\n\t\t\t\t\t\tnumberOfLines={ 1 }\n\t\t\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-title\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ imgLabel }\n\t\t\t\t\t</Truncate>\n\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t{ filename\n\t\t\t\t\t\t\t? sprintf(\n\t\t\t\t\t\t\t\t\t/* translators: %s: file name */\n\t\t\t\t\t\t\t\t\t__( 'Selected image: %s' ),\n\t\t\t\t\t\t\t\t\tfilename\n\t\t\t\t\t\t\t )\n\t\t\t\t\t\t\t: __( 'No image selected' ) }\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</FlexItem>\n\t\t\t</HStack>\n\t\t</ItemGroup>\n\t);\n}\n\nfunction BackgroundImagePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst { style, mediaUpload } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getBlockAttributes, getSettings } =\n\t\t\t\tselect( blockEditorStore );\n\n\t\t\treturn {\n\t\t\t\tstyle: getBlockAttributes( clientId )?.style,\n\t\t\t\tmediaUpload: getSettings().mediaUpload,\n\t\t\t};\n\t\t},\n\t\t[ clientId ]\n\t);\n\tconst { id, title, url } = style?.background?.backgroundImage || {};\n\n\tconst replaceContainerRef = useRef();\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onUploadError = ( message ) => {\n\t\tcreateErrorNotice( message, { type: 'snackbar' } );\n\t};\n\n\tconst onSelectMedia = ( media ) => {\n\t\tif ( ! media || ! media.url ) {\n\t\t\tconst newStyle = {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundImage: undefined,\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst newAttributes = {\n\t\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t\t};\n\n\t\t\tsetAttributes( newAttributes );\n\t\t\treturn;\n\t\t}\n\n\t\tif ( isBlobURL( media.url ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For media selections originated from a file upload.\n\t\tif (\n\t\t\t( media.media_type &&\n\t\t\t\tmedia.media_type !== IMAGE_BACKGROUND_TYPE ) ||\n\t\t\t( ! media.media_type &&\n\t\t\t\tmedia.type &&\n\t\t\t\tmedia.type !== IMAGE_BACKGROUND_TYPE )\n\t\t) {\n\t\t\tonUploadError(\n\t\t\t\t__( 'Only images can be used as a background image.' )\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst newStyle = {\n\t\t\t...style,\n\t\t\tbackground: {\n\t\t\t\t...style?.background,\n\t\t\t\tbackgroundImage: {\n\t\t\t\t\turl: media.url,\n\t\t\t\t\tid: media.id,\n\t\t\t\t\tsource: 'file',\n\t\t\t\t\ttitle: media.title || undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\n\t\tconst newAttributes = {\n\t\t\tstyle: cleanEmptyObject( newStyle ),\n\t\t};\n\n\t\tsetAttributes( newAttributes );\n\t};\n\n\tconst onFilesDrop = ( filesList ) => {\n\t\tmediaUpload( {\n\t\t\tallowedTypes: [ 'image' ],\n\t\t\tfilesList,\n\t\t\tonFileChange( [ image ] ) {\n\t\t\t\tif ( isBlobURL( image?.url ) ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tonSelectMedia( image );\n\t\t\t},\n\t\t\tonError: onUploadError,\n\t\t} );\n\t};\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: undefined,\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst hasValue = hasBackgroundImageValue( style );\n\n\treturn (\n\t\t<ToolsPanelItem\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Background image' ) }\n\t\t\tonDeselect={ () => resetBackgroundImage( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"block-editor-hooks__background__inspector-media-replace-container\"\n\t\t\t\tref={ replaceContainerRef }\n\t\t\t>\n\t\t\t\t<MediaReplaceFlow\n\t\t\t\t\tmediaId={ id }\n\t\t\t\t\tmediaURL={ url }\n\t\t\t\t\tallowedTypes={ [ IMAGE_BACKGROUND_TYPE ] }\n\t\t\t\t\taccept=\"image/*\"\n\t\t\t\t\tonSelect={ onSelectMedia }\n\t\t\t\t\tname={\n\t\t\t\t\t\t<InspectorImagePreview\n\t\t\t\t\t\t\tlabel={ __( 'Background image' ) }\n\t\t\t\t\t\t\tfilename={ title }\n\t\t\t\t\t\t\turl={ url }\n\t\t\t\t\t\t/>\n\t\t\t\t\t}\n\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t>\n\t\t\t\t\t{ hasValue && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tconst [ toggleButton ] = focus.tabbable.find(\n\t\t\t\t\t\t\t\t\treplaceContainerRef.current\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t// Focus the toggle button and close the dropdown menu.\n\t\t\t\t\t\t\t\t// This ensures similar behaviour as to selecting an image, where the dropdown is\n\t\t\t\t\t\t\t\t// closed and focus is redirected to the dropdown toggle button.\n\t\t\t\t\t\t\t\ttoggleButton?.focus();\n\t\t\t\t\t\t\t\ttoggleButton?.click();\n\t\t\t\t\t\t\t\tresetBackgroundImage( style, setAttributes );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Reset ' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MediaReplaceFlow>\n\t\t\t\t<DropZone\n\t\t\t\t\tonFilesDrop={ onFilesDrop }\n\t\t\t\t\tlabel={ __( 'Drop to upload' ) }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t</ToolsPanelItem>\n\t);\n}\n\nfunction backgroundSizeHelpText( value ) {\n\tif ( value === 'cover' || value === undefined ) {\n\t\treturn __( 'Image covers the space evenly.' );\n\t}\n\tif ( value === 'contain' ) {\n\t\treturn __( 'Image is contained without distortion.' );\n\t}\n\treturn __( 'Specify a fixed width.' );\n}\n\nexport const coordsToBackgroundPosition = ( value ) => {\n\tif ( ! value || ( isNaN( value.x ) && isNaN( value.y ) ) ) {\n\t\treturn undefined;\n\t}\n\n\tconst x = isNaN( value.x ) ? 0.5 : value.x;\n\tconst y = isNaN( value.y ) ? 0.5 : value.y;\n\n\treturn `${ x * 100 }% ${ y * 100 }%`;\n};\n\nexport const backgroundPositionToCoords = ( value ) => {\n\tif ( ! value ) {\n\t\treturn { x: undefined, y: undefined };\n\t}\n\n\tlet [ x, y ] = value.split( ' ' ).map( ( v ) => parseFloat( v ) / 100 );\n\tx = isNaN( x ) ? undefined : x;\n\ty = isNaN( y ) ? x : y;\n\n\treturn { x, y };\n};\n\nfunction BackgroundSizePanelItem( {\n\tclientId,\n\tisShownByDefault,\n\tsetAttributes,\n} ) {\n\tconst style = useSelect(\n\t\t( select ) =>\n\t\t\tselect( blockEditorStore ).getBlockAttributes( clientId )?.style,\n\t\t[ clientId ]\n\t);\n\n\tconst sizeValue = style?.background?.backgroundSize;\n\tconst repeatValue = style?.background?.backgroundRepeat;\n\n\t// An `undefined` value is treated as `cover` by the toggle group control.\n\t// An empty string is treated as `auto` by the toggle group control. This\n\t// allows a user to select \"Size\" and then enter a custom value, with an\n\t// empty value being treated as `auto`.\n\tconst currentValueForToggle =\n\t\t( sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ) ||\n\t\tsizeValue === ''\n\t\t\t? 'auto'\n\t\t\t: sizeValue || 'cover';\n\n\t// If the current value is `cover` and the repeat value is `undefined`, then\n\t// the toggle should be unchecked as the default state. Otherwise, the toggle\n\t// should reflect the current repeat value.\n\tconst repeatCheckedValue = ! (\n\t\trepeatValue === 'no-repeat' ||\n\t\t( currentValueForToggle === 'cover' && repeatValue === undefined )\n\t);\n\n\tconst hasValue = hasBackgroundSizeValue( style );\n\n\tconst resetAllFilter = useCallback( ( previousValue ) => {\n\t\treturn {\n\t\t\t...previousValue,\n\t\t\tstyle: {\n\t\t\t\t...previousValue.style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...previousValue.style?.background,\n\t\t\t\t\tbackgroundRepeat: undefined,\n\t\t\t\t\tbackgroundSize: undefined,\n\t\t\t\t},\n\t\t\t},\n\t\t};\n\t}, [] );\n\n\tconst updateBackgroundSize = ( next ) => {\n\t\t// When switching to 'contain' toggle the repeat off.\n\t\tlet nextRepeat = repeatValue;\n\n\t\tif ( next === 'contain' ) {\n\t\t\tnextRepeat = 'no-repeat';\n\t\t}\n\n\t\tif (\n\t\t\t( currentValueForToggle === 'cover' ||\n\t\t\t\tcurrentValueForToggle === 'contain' ) &&\n\t\t\tnext === 'auto'\n\t\t) {\n\t\t\tnextRepeat = undefined;\n\t\t}\n\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat: nextRepeat,\n\t\t\t\t\tbackgroundSize: next,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst updateBackgroundPosition = ( next ) => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundPosition: coordsToBackgroundPosition( next ),\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\tconst toggleIsRepeated = () => {\n\t\tsetAttributes( {\n\t\t\tstyle: cleanEmptyObject( {\n\t\t\t\t...style,\n\t\t\t\tbackground: {\n\t\t\t\t\t...style?.background,\n\t\t\t\t\tbackgroundRepeat:\n\t\t\t\t\t\trepeatCheckedValue === true ? 'no-repeat' : undefined,\n\t\t\t\t},\n\t\t\t} ),\n\t\t} );\n\t};\n\n\treturn (\n\t\t<VStack\n\t\t\tas={ ToolsPanelItem }\n\t\t\tspacing={ 2 }\n\t\t\tclassName=\"single-column\"\n\t\t\thasValue={ () => hasValue }\n\t\t\tlabel={ __( 'Size' ) }\n\t\t\tonDeselect={ () => resetBackgroundSize( style, setAttributes ) }\n\t\t\tisShownByDefault={ isShownByDefault }\n\t\t\tresetAllFilter={ resetAllFilter }\n\t\t\tpanelId={ clientId }\n\t\t>\n\t\t\t<FocalPointPicker\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tlabel={ __( 'Position' ) }\n\t\t\t\turl={ style?.background?.backgroundImage?.url }\n\t\t\t\tvalue={ backgroundPositionToCoords(\n\t\t\t\t\tstyle?.background?.backgroundPosition\n\t\t\t\t) }\n\t\t\t\tonChange={ updateBackgroundPosition }\n\t\t\t/>\n\t\t\t<ToggleGroupControl\n\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\tlabel={ __( 'Size' ) }\n\t\t\t\tvalue={ currentValueForToggle }\n\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\tisBlock\n\t\t\t\thelp={ backgroundSizeHelpText( sizeValue ) }\n\t\t\t>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'cover' }\n\t\t\t\t\tvalue={ 'cover' }\n\t\t\t\t\tlabel={ __( 'Cover' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'contain' }\n\t\t\t\t\tvalue={ 'contain' }\n\t\t\t\t\tlabel={ __( 'Contain' ) }\n\t\t\t\t/>\n\t\t\t\t<ToggleGroupControlOption\n\t\t\t\t\tkey={ 'fixed' }\n\t\t\t\t\tvalue={ 'auto' }\n\t\t\t\t\tlabel={ __( 'Fixed' ) }\n\t\t\t\t/>\n\t\t\t</ToggleGroupControl>\n\t\t\t{ sizeValue !== undefined &&\n\t\t\tsizeValue !== 'cover' &&\n\t\t\tsizeValue !== 'contain' ? (\n\t\t\t\t<UnitControl\n\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\tonChange={ updateBackgroundSize }\n\t\t\t\t\tvalue={ sizeValue }\n\t\t\t\t/>\n\t\t\t) : null }\n\t\t\t{ currentValueForToggle !== 'cover' && (\n\t\t\t\t<ToggleControl\n\t\t\t\t\tlabel={ __( 'Repeat' ) }\n\t\t\t\t\tchecked={ repeatCheckedValue }\n\t\t\t\t\tonChange={ toggleIsRepeated }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\n\nexport function BackgroundImagePanel( props ) {\n\tconst [ backgroundImage, backgroundSize ] = useSettings(\n\t\t'background.backgroundImage',\n\t\t'background.backgroundSize'\n\t);\n\n\tif (\n\t\t! backgroundImage ||\n\t\t! hasBackgroundSupport( props.name, 'backgroundImage' )\n\t) {\n\t\treturn null;\n\t}\n\n\tconst showBackgroundSize = !! (\n\t\tbackgroundSize && hasBackgroundSupport( props.name, 'backgroundSize' )\n\t);\n\n\tconst defaultControls = getBlockSupport( props.name, [\n\t\tBACKGROUND_SUPPORT_KEY,\n\t\t'__experimentalDefaultControls',\n\t] );\n\n\treturn (\n\t\t<InspectorControls group=\"background\">\n\t\t\t<BackgroundImagePanelItem\n\t\t\t\tisShownByDefault={ defaultControls?.backgroundImage }\n\t\t\t\t{ ...props }\n\t\t\t/>\n\t\t\t{ showBackgroundSize && (\n\t\t\t\t<BackgroundSizePanelItem\n\t\t\t\t\tisShownByDefault={ defaultControls?.backgroundSize }\n\t\t\t\t\t{ ...props }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</InspectorControls>\n\t);\n}\n\nexport default {\n\tuseBlockProps,\n\tattributeKeys: [ 'style' ],\n\thasSupport: hasBackgroundSupport,\n};\n"],"mappings":";;;;;;;;;;;;;;;AAGA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,IAAA,GAAAH,OAAA;AACA,IAAA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7 @@ Object.defineProperty(exports, "useLayoutStyles", {
79
79
  var _utils = require("./utils");
80
80
  require("./compat");
81
81
  var _align = _interopRequireDefault(require("./align"));
82
+ var _background = _interopRequireDefault(require("./background"));
82
83
  require("./lock");
83
84
  var _anchor = _interopRequireDefault(require("./anchor"));
84
85
  var _ariaLabel = _interopRequireDefault(require("./aria-label"));
@@ -114,6 +115,6 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
114
115
  */
115
116
 
116
117
  (0, _utils.createBlockEditFilter)([_align.default, _anchor.default, _customClassName.default, _style.default, _duotone.default, _position.default, _layout.default, _contentLockUi.default, _blockHooks.default, _blockRenaming.default, _layoutChild.default].filter(Boolean));
117
- (0, _utils.createBlockListBlockFilter)([_align.default, _style.default, _color.default, _dimensions.default, _duotone.default, _fontFamily.default, _fontSize.default, _border.default, _position.default, _layoutChild.default]);
118
+ (0, _utils.createBlockListBlockFilter)([_align.default, _background.default, _style.default, _color.default, _dimensions.default, _duotone.default, _fontFamily.default, _fontSize.default, _border.default, _position.default, _layoutChild.default]);
118
119
  (0, _utils.createBlockSaveFilter)([_align.default, _anchor.default, _ariaLabel.default, _customClassName.default, _border.default, _color.default, _style.default, _fontFamily.default, _fontSize.default]);
119
120
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","_align","_interopRequireDefault","_anchor","_ariaLabel","_customClassName","_style","_color","_dimensions","_interopRequireWildcard","_duotone","_fontFamily","_fontSize","_border","_position","_layout","_layoutChild","_contentLockUi","_blockHooks","_blockRenaming","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","createBlockEditFilter","align","anchor","customClassName","style","duotone","position","layout","contentLockUI","blockHooks","blockRenaming","childLayout","filter","Boolean","createBlockListBlockFilter","color","dimensions","fontFamily","fontSize","border","createBlockSaveFilter","ariaLabel"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport './lock';\nimport anchor from './anchor';\nimport ariaLabel from './aria-label';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport './settings';\nimport color from './color';\nimport dimensions from './dimensions';\nimport duotone from './duotone';\nimport fontFamily from './font-family';\nimport fontSize from './font-size';\nimport border from './border';\nimport position from './position';\nimport layout from './layout';\nimport childLayout from './layout-child';\nimport contentLockUI from './content-lock-ui';\nimport './metadata';\nimport blockHooks from './block-hooks';\nimport blockRenaming from './block-renaming';\nimport './use-bindings-attributes';\n\ncreateBlockEditFilter(\n\t[\n\t\talign,\n\t\tanchor,\n\t\tcustomClassName,\n\t\tstyle,\n\t\tduotone,\n\t\tposition,\n\t\tlayout,\n\t\tcontentLockUI,\n\t\tblockHooks,\n\t\tblockRenaming,\n\t\tchildLayout,\n\t].filter( Boolean )\n);\ncreateBlockListBlockFilter( [\n\talign,\n\tstyle,\n\tcolor,\n\tdimensions,\n\tduotone,\n\tfontFamily,\n\tfontSize,\n\tborder,\n\tposition,\n\tchildLayout,\n] );\ncreateBlockSaveFilter( [\n\talign,\n\tanchor,\n\tariaLabel,\n\tcustomClassName,\n\tborder,\n\tcolor,\n\tstyle,\n\tfontFamily,\n\tfontSize,\n] );\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport {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AK,EACLC,gBAAO,EACPC,iBAAQ,EACRC,eAAM,EACNC,sBAAa,EACbC,mBAAU,EACVC,sBAAa,EACbC,oBAAW,CACX,CAACC,MAAM,CAAEC,OAAQ,CACnB,CAAC;AACD,IAAAC,iCAA0B,EAAE,CAC3Bb,cAAK,EACLG,cAAK,EACLW,cAAK,EACLC,mBAAU,EACVX,gBAAO,EACPY,mBAAU,EACVC,iBAAQ,EACRC,eAAM,EACNb,iBAAQ,EACRK,oBAAW,CACV,CAAC;AACH,IAAAS,4BAAqB,EAAE,CACtBnB,cAAK,EACLC,eAAM,EACNmB,kBAAS,EACTlB,wBAAe,EACfgB,eAAM,EACNJ,cAAK,EACLX,cAAK,EACLa,mBAAU,EACVC,iBAAQ,CACP,CAAC"}
1
+ {"version":3,"names":["_utils","require","_align","_interopRequireDefault","_background","_anchor","_ariaLabel","_customClassName","_style","_color","_dimensions","_interopRequireWildcard","_duotone","_fontFamily","_fontSize","_border","_position","_layout","_layoutChild","_contentLockUi","_blockHooks","_blockRenaming","_useBorderProps","_useShadowProps","_useColorProps","_useSpacingProps","_useTypographyProps","_gap","_useCachedTruthy","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","prototype","hasOwnProperty","call","i","set","createBlockEditFilter","align","anchor","customClassName","style","duotone","position","layout","contentLockUI","blockHooks","blockRenaming","childLayout","filter","Boolean","createBlockListBlockFilter","background","color","dimensions","fontFamily","fontSize","border","createBlockSaveFilter","ariaLabel"],"sources":["@wordpress/block-editor/src/hooks/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport {\n\tcreateBlockEditFilter,\n\tcreateBlockListBlockFilter,\n\tcreateBlockSaveFilter,\n} from './utils';\nimport './compat';\nimport align from './align';\nimport background from './background';\nimport './lock';\nimport anchor from './anchor';\nimport ariaLabel from './aria-label';\nimport customClassName from './custom-class-name';\nimport './generated-class-name';\nimport style from './style';\nimport './settings';\nimport color from './color';\nimport dimensions from './dimensions';\nimport duotone from './duotone';\nimport fontFamily from './font-family';\nimport fontSize from './font-size';\nimport border from './border';\nimport position from './position';\nimport layout from './layout';\nimport childLayout from './layout-child';\nimport contentLockUI from './content-lock-ui';\nimport './metadata';\nimport blockHooks from './block-hooks';\nimport blockRenaming from './block-renaming';\nimport './use-bindings-attributes';\n\ncreateBlockEditFilter(\n\t[\n\t\talign,\n\t\tanchor,\n\t\tcustomClassName,\n\t\tstyle,\n\t\tduotone,\n\t\tposition,\n\t\tlayout,\n\t\tcontentLockUI,\n\t\tblockHooks,\n\t\tblockRenaming,\n\t\tchildLayout,\n\t].filter( Boolean )\n);\ncreateBlockListBlockFilter( [\n\talign,\n\tbackground,\n\tstyle,\n\tcolor,\n\tdimensions,\n\tduotone,\n\tfontFamily,\n\tfontSize,\n\tborder,\n\tposition,\n\tchildLayout,\n] );\ncreateBlockSaveFilter( [\n\talign,\n\tanchor,\n\tariaLabel,\n\tcustomClassName,\n\tborder,\n\tcolor,\n\tstyle,\n\tfontFamily,\n\tfontSize,\n] );\n\nexport { useCustomSides } from './dimensions';\nexport { useLayoutClasses, useLayoutStyles } from './layout';\nexport { getBorderClassesAndStyles, useBorderProps } from './use-border-props';\nexport { getShadowClassesAndStyles } from './use-shadow-props';\nexport { getColorClassesAndStyles, useColorProps } from './use-color-props';\nexport { getSpacingClassesAndStyles } from './use-spacing-props';\nexport { getTypographyClassesAndStyles } from './use-typography-props';\nexport { getGapCSSValue } from './gap';\nexport { useCachedTruthy } from './use-cached-truthy';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AAKAA,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AACAA,OAAA;AACA,IAAAI,OAAA,GAAAF,sBAAA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EACVC,iBAAQ,EACRC,eAAM,EACNd,iBAAQ,EACRK,oBAAW,CACV,CAAC;AACH,IAAAU,4BAAqB,EAAE,CACtBpB,cAAK,EACLC,eAAM,EACNoB,kBAAS,EACTnB,wBAAe,EACfiB,eAAM,EACNJ,cAAK,EACLZ,cAAK,EACLc,mBAAU,EACVC,iBAAQ,CACP,CAAC"}
@@ -30,6 +30,8 @@ function useBlockPropsChildLayoutStyles({
30
30
  const {
31
31
  selfStretch,
32
32
  flexSize,
33
+ columnStart,
34
+ rowStart,
33
35
  columnSpan,
34
36
  rowSpan
35
37
  } = layout;
@@ -51,6 +53,14 @@ function useBlockPropsChildLayoutStyles({
51
53
  css = `${selector} {
52
54
  flex-grow: 1;
53
55
  }`;
56
+ } else if (columnStart && columnSpan) {
57
+ css = `${selector} {
58
+ grid-column: ${columnStart} / span ${columnSpan};
59
+ }`;
60
+ } else if (columnStart) {
61
+ css = `${selector} {
62
+ grid-column: ${columnStart};
63
+ }`;
54
64
  } else if (columnSpan) {
55
65
  css = `${selector} {
56
66
  grid-column: span ${columnSpan};
@@ -61,9 +71,11 @@ function useBlockPropsChildLayoutStyles({
61
71
  * columnCount is set, the grid is responsive so a
62
72
  * container query is needed for the span to resize.
63
73
  */
64
- if (columnSpan && (minimumColumnWidth || !columnCount)) {
65
- // Calculate the container query value.
66
- const columnSpanNumber = parseInt(columnSpan);
74
+ if ((columnSpan || columnStart) && (minimumColumnWidth || !columnCount)) {
75
+ // Check if columnSpan and columnStart are numbers so Math.max doesn't break.
76
+ const columnSpanNumber = columnSpan ? parseInt(columnSpan) : null;
77
+ const columnStartNumber = columnStart ? parseInt(columnStart) : null;
78
+ const highestNumber = Math.max(columnSpanNumber, columnStartNumber);
67
79
  let parentColumnValue = parseFloat(minimumColumnWidth);
68
80
  /**
69
81
  * 12rem is the default minimumColumnWidth value.
@@ -81,14 +93,24 @@ function useBlockPropsChildLayoutStyles({
81
93
  parentColumnUnit = 'rem';
82
94
  }
83
95
  const defaultGapValue = parentColumnUnit === 'px' ? 24 : 1.5;
84
- const containerQueryValue = columnSpanNumber * parentColumnValue + (columnSpanNumber - 1) * defaultGapValue;
96
+ const containerQueryValue = highestNumber * parentColumnValue + (highestNumber - 1) * defaultGapValue;
97
+ // If a span is set we want to preserve it as long as possible, otherwise we just reset the value.
98
+ const gridColumnValue = columnSpan ? '1/-1' : 'auto';
85
99
  css += `@container (max-width: ${containerQueryValue}${parentColumnUnit}) {
86
100
  ${selector} {
87
- grid-column: 1 / -1;
101
+ grid-column: ${gridColumnValue};
88
102
  }
89
103
  }`;
90
104
  }
91
- if (rowSpan) {
105
+ if (rowStart && rowSpan) {
106
+ css += `${selector} {
107
+ grid-row: ${rowStart} / span ${rowSpan};
108
+ }`;
109
+ } else if (rowStart) {
110
+ css += `${selector} {
111
+ grid-row: ${rowStart};
112
+ }`;
113
+ } else if (rowSpan) {
92
114
  css += `${selector} {
93
115
  grid-row: span ${rowSpan};
94
116
  }`;