@wordpress/block-editor 12.12.0 → 12.13.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 (287) hide show
  1. package/CHANGELOG.md +12 -10
  2. package/README.md +35 -3
  3. package/build/components/block-alignment-control/use-available-alignments.js +30 -28
  4. package/build/components/block-alignment-control/use-available-alignments.js.map +1 -1
  5. package/build/components/block-list/block.native.js +4 -4
  6. package/build/components/block-list/block.native.js.map +1 -1
  7. package/build/components/block-list/layout.js +2 -3
  8. package/build/components/block-list/layout.js.map +1 -1
  9. package/build/components/border-radius-control/index.js +3 -2
  10. package/build/components/border-radius-control/index.js.map +1 -1
  11. package/build/components/color-palette/with-color-context.js +6 -6
  12. package/build/components/color-palette/with-color-context.js.map +1 -1
  13. package/build/components/colors/with-colors.js +2 -8
  14. package/build/components/colors/with-colors.js.map +1 -1
  15. package/build/components/colors-gradients/control.js +6 -7
  16. package/build/components/colors-gradients/control.js.map +1 -1
  17. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +5 -13
  18. package/build/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  19. package/build/components/font-family/index.js +2 -3
  20. package/build/components/font-family/index.js.map +1 -1
  21. package/build/components/font-sizes/font-size-picker.js +3 -5
  22. package/build/components/font-sizes/font-size-picker.js.map +1 -1
  23. package/build/components/font-sizes/with-font-sizes.js +3 -4
  24. package/build/components/font-sizes/with-font-sizes.js.map +1 -1
  25. package/build/components/global-styles/filters-panel.js +7 -8
  26. package/build/components/global-styles/filters-panel.js.map +1 -1
  27. package/build/components/global-styles/image-settings-panel.js +2 -2
  28. package/build/components/global-styles/image-settings-panel.js.map +1 -1
  29. package/build/components/global-styles/typography-panel.js +1 -1
  30. package/build/components/global-styles/typography-panel.js.map +1 -1
  31. package/build/components/gradients/use-gradient.js +2 -5
  32. package/build/components/gradients/use-gradient.js.map +1 -1
  33. package/build/components/height-control/index.js +3 -3
  34. package/build/components/height-control/index.js.map +1 -1
  35. package/build/components/index.js +9 -2
  36. package/build/components/index.js.map +1 -1
  37. package/build/components/index.native.js +9 -2
  38. package/build/components/index.native.js.map +1 -1
  39. package/build/components/inner-blocks/index.js +2 -2
  40. package/build/components/inner-blocks/index.js.map +1 -1
  41. package/build/components/letter-spacing-control/index.js +3 -3
  42. package/build/components/letter-spacing-control/index.js.map +1 -1
  43. package/build/components/link-control/search-item.js +11 -0
  44. package/build/components/link-control/search-item.js.map +1 -1
  45. package/build/components/link-control/search-results.js +2 -1
  46. package/build/components/link-control/search-results.js.map +1 -1
  47. package/build/components/link-control/use-search-handler.js +10 -5
  48. package/build/components/link-control/use-search-handler.js.map +1 -1
  49. package/build/components/resizable-box-popover/index.js +1 -1
  50. package/build/components/resizable-box-popover/index.js.map +1 -1
  51. package/build/components/rich-text/index.js +1 -1
  52. package/build/components/rich-text/index.js.map +1 -1
  53. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js +6 -3
  54. package/build/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  55. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -3
  56. package/build/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  57. package/build/components/unit-control/index.js +3 -3
  58. package/build/components/unit-control/index.js.map +1 -1
  59. package/build/components/use-block-commands/index.js +6 -1
  60. package/build/components/use-block-commands/index.js.map +1 -1
  61. package/build/components/use-settings/index.js +212 -0
  62. package/build/components/use-settings/index.js.map +1 -0
  63. package/build/hooks/align.js +51 -35
  64. package/build/hooks/align.js.map +1 -1
  65. package/build/hooks/anchor.js +37 -32
  66. package/build/hooks/anchor.js.map +1 -1
  67. package/build/hooks/background.js +4 -4
  68. package/build/hooks/background.js.map +1 -1
  69. package/build/hooks/color.js +2 -4
  70. package/build/hooks/color.js.map +1 -1
  71. package/build/hooks/duotone.js +10 -9
  72. package/build/hooks/duotone.js.map +1 -1
  73. package/build/hooks/font-size.js +4 -4
  74. package/build/hooks/font-size.js.map +1 -1
  75. package/build/hooks/layout.js +10 -11
  76. package/build/hooks/layout.js.map +1 -1
  77. package/build/hooks/line-height.js +3 -3
  78. package/build/hooks/line-height.js.map +1 -1
  79. package/build/hooks/position.js +2 -3
  80. package/build/hooks/position.js.map +1 -1
  81. package/build/hooks/use-color-props.js +3 -11
  82. package/build/hooks/use-color-props.js.map +1 -1
  83. package/build/hooks/utils.js +1 -42
  84. package/build/hooks/utils.js.map +1 -1
  85. package/build/layouts/constrained.js +3 -3
  86. package/build/layouts/constrained.js.map +1 -1
  87. package/build/utils/object.js +4 -1
  88. package/build/utils/object.js.map +1 -1
  89. package/build/utils/transform-styles/index.js +19 -24
  90. package/build/utils/transform-styles/index.js.map +1 -1
  91. package/build-module/components/block-alignment-control/use-available-alignments.js +30 -28
  92. package/build-module/components/block-alignment-control/use-available-alignments.js.map +1 -1
  93. package/build-module/components/block-list/block.native.js +4 -4
  94. package/build-module/components/block-list/block.native.js.map +1 -1
  95. package/build-module/components/block-list/layout.js +2 -2
  96. package/build-module/components/block-list/layout.js.map +1 -1
  97. package/build-module/components/border-radius-control/index.js +3 -2
  98. package/build-module/components/border-radius-control/index.js.map +1 -1
  99. package/build-module/components/color-palette/with-color-context.js +6 -5
  100. package/build-module/components/color-palette/with-color-context.js.map +1 -1
  101. package/build-module/components/colors/with-colors.js +2 -7
  102. package/build-module/components/colors/with-colors.js.map +1 -1
  103. package/build-module/components/colors-gradients/control.js +6 -7
  104. package/build-module/components/colors-gradients/control.js.map +1 -1
  105. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +5 -12
  106. package/build-module/components/colors-gradients/use-multiple-origin-colors-and-gradients.js.map +1 -1
  107. package/build-module/components/font-family/index.js +2 -2
  108. package/build-module/components/font-family/index.js.map +1 -1
  109. package/build-module/components/font-sizes/font-size-picker.js +3 -4
  110. package/build-module/components/font-sizes/font-size-picker.js.map +1 -1
  111. package/build-module/components/font-sizes/with-font-sizes.js +3 -3
  112. package/build-module/components/font-sizes/with-font-sizes.js.map +1 -1
  113. package/build-module/components/global-styles/filters-panel.js +7 -8
  114. package/build-module/components/global-styles/filters-panel.js.map +1 -1
  115. package/build-module/components/global-styles/image-settings-panel.js +2 -2
  116. package/build-module/components/global-styles/image-settings-panel.js.map +1 -1
  117. package/build-module/components/global-styles/typography-panel.js +1 -1
  118. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  119. package/build-module/components/gradients/use-gradient.js +2 -4
  120. package/build-module/components/gradients/use-gradient.js.map +1 -1
  121. package/build-module/components/height-control/index.js +3 -2
  122. package/build-module/components/height-control/index.js.map +1 -1
  123. package/build-module/components/index.js +1 -1
  124. package/build-module/components/index.js.map +1 -1
  125. package/build-module/components/index.native.js +1 -1
  126. package/build-module/components/index.native.js.map +1 -1
  127. package/build-module/components/inner-blocks/index.js +2 -2
  128. package/build-module/components/inner-blocks/index.js.map +1 -1
  129. package/build-module/components/letter-spacing-control/index.js +3 -2
  130. package/build-module/components/letter-spacing-control/index.js.map +1 -1
  131. package/build-module/components/link-control/search-item.js +12 -1
  132. package/build-module/components/link-control/search-item.js.map +1 -1
  133. package/build-module/components/link-control/search-results.js +2 -1
  134. package/build-module/components/link-control/search-results.js.map +1 -1
  135. package/build-module/components/link-control/use-search-handler.js +10 -5
  136. package/build-module/components/link-control/use-search-handler.js.map +1 -1
  137. package/build-module/components/resizable-box-popover/index.js +1 -1
  138. package/build-module/components/resizable-box-popover/index.js.map +1 -1
  139. package/build-module/components/rich-text/index.js +1 -1
  140. package/build-module/components/rich-text/index.js.map +1 -1
  141. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js +6 -2
  142. package/build-module/components/spacing-sizes-control/hooks/use-spacing-sizes.js.map +1 -1
  143. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -2
  144. package/build-module/components/spacing-sizes-control/input-controls/spacing-input-control.js.map +1 -1
  145. package/build-module/components/unit-control/index.js +3 -2
  146. package/build-module/components/unit-control/index.js.map +1 -1
  147. package/build-module/components/use-block-commands/index.js +5 -1
  148. package/build-module/components/use-block-commands/index.js.map +1 -1
  149. package/build-module/components/use-settings/index.js +203 -0
  150. package/build-module/components/use-settings/index.js.map +1 -0
  151. package/build-module/hooks/align.js +51 -35
  152. package/build-module/hooks/align.js.map +1 -1
  153. package/build-module/hooks/anchor.js +37 -32
  154. package/build-module/hooks/anchor.js.map +1 -1
  155. package/build-module/hooks/background.js +4 -4
  156. package/build-module/hooks/background.js.map +1 -1
  157. package/build-module/hooks/color.js +2 -4
  158. package/build-module/hooks/color.js.map +1 -1
  159. package/build-module/hooks/duotone.js +11 -10
  160. package/build-module/hooks/duotone.js.map +1 -1
  161. package/build-module/hooks/font-size.js +4 -4
  162. package/build-module/hooks/font-size.js.map +1 -1
  163. package/build-module/hooks/layout.js +10 -11
  164. package/build-module/hooks/layout.js.map +1 -1
  165. package/build-module/hooks/line-height.js +3 -3
  166. package/build-module/hooks/line-height.js.map +1 -1
  167. package/build-module/hooks/position.js +2 -3
  168. package/build-module/hooks/position.js.map +1 -1
  169. package/build-module/hooks/use-color-props.js +3 -11
  170. package/build-module/hooks/use-color-props.js.map +1 -1
  171. package/build-module/hooks/utils.js +2 -43
  172. package/build-module/hooks/utils.js.map +1 -1
  173. package/build-module/layouts/constrained.js +3 -2
  174. package/build-module/layouts/constrained.js.map +1 -1
  175. package/build-module/utils/object.js +3 -1
  176. package/build-module/utils/object.js.map +1 -1
  177. package/build-module/utils/transform-styles/index.js +20 -24
  178. package/build-module/utils/transform-styles/index.js.map +1 -1
  179. package/build-style/style-rtl.css +13 -6
  180. package/build-style/style.css +13 -6
  181. package/package.json +36 -34
  182. package/src/components/block-alignment-control/use-available-alignments.js +49 -34
  183. package/src/components/block-list/block.native.js +4 -4
  184. package/src/components/block-list/layout.js +2 -2
  185. package/src/components/block-styles/style.scss +1 -1
  186. package/src/components/border-radius-control/index.js +3 -2
  187. package/src/components/color-palette/with-color-context.js +9 -9
  188. package/src/components/colors/with-colors.js +6 -7
  189. package/src/components/colors-gradients/control.js +10 -7
  190. package/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js +29 -15
  191. package/src/components/font-family/index.js +2 -2
  192. package/src/components/font-sizes/font-size-picker.js +6 -4
  193. package/src/components/font-sizes/with-font-sizes.js +3 -5
  194. package/src/components/global-styles/filters-panel.js +9 -15
  195. package/src/components/global-styles/image-settings-panel.js +2 -2
  196. package/src/components/global-styles/typography-panel.js +1 -1
  197. package/src/components/gradients/use-gradient.js +10 -4
  198. package/src/components/height-control/index.js +3 -2
  199. package/src/components/index.js +1 -1
  200. package/src/components/index.native.js +1 -1
  201. package/src/components/inner-blocks/index.js +2 -2
  202. package/src/components/inserter/style.scss +9 -1
  203. package/src/components/letter-spacing-control/index.js +3 -2
  204. package/src/components/link-control/search-item.js +14 -0
  205. package/src/components/link-control/search-results.js +1 -0
  206. package/src/components/link-control/use-search-handler.js +22 -15
  207. package/src/components/resizable-box-popover/index.js +1 -1
  208. package/src/components/rich-text/index.js +1 -1
  209. package/src/components/spacing-sizes-control/hooks/use-spacing-sizes.js +7 -5
  210. package/src/components/spacing-sizes-control/input-controls/spacing-input-control.js +3 -2
  211. package/src/components/unit-control/index.js +3 -8
  212. package/src/components/use-block-commands/index.js +2 -1
  213. package/src/components/{use-setting → use-settings}/README.md +9 -10
  214. package/src/components/use-settings/index.js +272 -0
  215. package/src/components/{use-setting → use-settings}/test/index.js +47 -5
  216. package/src/hooks/align.js +79 -54
  217. package/src/hooks/anchor.js +75 -65
  218. package/src/hooks/background.js +7 -9
  219. package/src/hooks/color.js +7 -4
  220. package/src/hooks/duotone.js +24 -19
  221. package/src/hooks/font-size.js +4 -4
  222. package/src/hooks/layout.js +11 -11
  223. package/src/hooks/line-height.js +3 -3
  224. package/src/hooks/position.js +5 -3
  225. package/src/hooks/use-color-props.js +21 -14
  226. package/src/hooks/utils.js +88 -43
  227. package/src/layouts/constrained.js +3 -8
  228. package/src/utils/object.js +4 -1
  229. package/src/utils/test/__snapshots__/transform-styles.js.snap +103 -0
  230. package/src/utils/test/transform-styles.js +217 -0
  231. package/src/utils/transform-styles/index.js +25 -25
  232. package/build/components/use-setting/index.js +0 -161
  233. package/build/components/use-setting/index.js.map +0 -1
  234. package/build/utils/transform-styles/ast/index.js +0 -21
  235. package/build/utils/transform-styles/ast/index.js.map +0 -1
  236. package/build/utils/transform-styles/ast/parse.js +0 -660
  237. package/build/utils/transform-styles/ast/parse.js.map +0 -1
  238. package/build/utils/transform-styles/ast/stringify/compiler.js +0 -52
  239. package/build/utils/transform-styles/ast/stringify/compiler.js.map +0 -1
  240. package/build/utils/transform-styles/ast/stringify/compress.js +0 -178
  241. package/build/utils/transform-styles/ast/stringify/compress.js.map +0 -1
  242. package/build/utils/transform-styles/ast/stringify/identity.js +0 -207
  243. package/build/utils/transform-styles/ast/stringify/identity.js.map +0 -1
  244. package/build/utils/transform-styles/ast/stringify/index.js +0 -36
  245. package/build/utils/transform-styles/ast/stringify/index.js.map +0 -1
  246. package/build/utils/transform-styles/transforms/url-rewrite.js +0 -130
  247. package/build/utils/transform-styles/transforms/url-rewrite.js.map +0 -1
  248. package/build/utils/transform-styles/transforms/wrap.js +0 -59
  249. package/build/utils/transform-styles/transforms/wrap.js.map +0 -1
  250. package/build/utils/transform-styles/traverse.js +0 -37
  251. package/build/utils/transform-styles/traverse.js.map +0 -1
  252. package/build-module/components/use-setting/index.js +0 -154
  253. package/build-module/components/use-setting/index.js.map +0 -1
  254. package/build-module/utils/transform-styles/ast/index.js +0 -6
  255. package/build-module/utils/transform-styles/ast/index.js.map +0 -1
  256. package/build-module/utils/transform-styles/ast/parse.js +0 -654
  257. package/build-module/utils/transform-styles/ast/parse.js.map +0 -1
  258. package/build-module/utils/transform-styles/ast/stringify/compiler.js +0 -49
  259. package/build-module/utils/transform-styles/ast/stringify/compiler.js.map +0 -1
  260. package/build-module/utils/transform-styles/ast/stringify/compress.js +0 -176
  261. package/build-module/utils/transform-styles/ast/stringify/compress.js.map +0 -1
  262. package/build-module/utils/transform-styles/ast/stringify/identity.js +0 -206
  263. package/build-module/utils/transform-styles/ast/stringify/identity.js.map +0 -1
  264. package/build-module/utils/transform-styles/ast/stringify/index.js +0 -29
  265. package/build-module/utils/transform-styles/ast/stringify/index.js.map +0 -1
  266. package/build-module/utils/transform-styles/transforms/url-rewrite.js +0 -123
  267. package/build-module/utils/transform-styles/transforms/url-rewrite.js.map +0 -1
  268. package/build-module/utils/transform-styles/transforms/wrap.js +0 -52
  269. package/build-module/utils/transform-styles/transforms/wrap.js.map +0 -1
  270. package/build-module/utils/transform-styles/traverse.js +0 -28
  271. package/build-module/utils/transform-styles/traverse.js.map +0 -1
  272. package/src/components/use-setting/index.js +0 -218
  273. package/src/utils/transform-styles/ast/index.js +0 -5
  274. package/src/utils/transform-styles/ast/parse.js +0 -732
  275. package/src/utils/transform-styles/ast/stringify/compiler.js +0 -50
  276. package/src/utils/transform-styles/ast/stringify/compress.js +0 -238
  277. package/src/utils/transform-styles/ast/stringify/identity.js +0 -286
  278. package/src/utils/transform-styles/ast/stringify/index.js +0 -32
  279. package/src/utils/transform-styles/test/__snapshots__/traverse.js.snap +0 -7
  280. package/src/utils/transform-styles/test/traverse.js +0 -24
  281. package/src/utils/transform-styles/transforms/test/__snapshots__/url-rewrite.js.snap +0 -25
  282. package/src/utils/transform-styles/transforms/test/__snapshots__/wrap.js.snap +0 -64
  283. package/src/utils/transform-styles/transforms/test/url-rewrite.js +0 -39
  284. package/src/utils/transform-styles/transforms/test/wrap.js +0 -95
  285. package/src/utils/transform-styles/transforms/url-rewrite.js +0 -139
  286. package/src/utils/transform-styles/transforms/wrap.js +0 -56
  287. package/src/utils/transform-styles/traverse.js +0 -32
@@ -0,0 +1,217 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import transformStyles from '../transform-styles';
5
+
6
+ describe( 'transformStyles', () => {
7
+ describe( 'selector wrap', () => {
8
+ it( 'should wrap regular selectors', () => {
9
+ const input = `h1 { color: red; }`;
10
+ const output = transformStyles(
11
+ [
12
+ {
13
+ css: input,
14
+ },
15
+ ],
16
+ '.my-namespace'
17
+ );
18
+
19
+ expect( output ).toMatchSnapshot();
20
+ } );
21
+
22
+ it( 'should wrap multiple selectors', () => {
23
+ const input = `h1, h2 { color: red; }`;
24
+ const output = transformStyles(
25
+ [
26
+ {
27
+ css: input,
28
+ },
29
+ ],
30
+ '.my-namespace'
31
+ );
32
+
33
+ expect( output ).toMatchSnapshot();
34
+ } );
35
+
36
+ it( 'should ignore selectors', () => {
37
+ const input = `h1, body { color: red; }`;
38
+ const output = transformStyles(
39
+ [
40
+ {
41
+ css: input,
42
+ ignoredSelectors: [ 'body' ],
43
+ },
44
+ ],
45
+ '.my-namespace'
46
+ );
47
+
48
+ expect( output ).toMatchSnapshot();
49
+ } );
50
+
51
+ it( 'should replace root tags', () => {
52
+ const input = `body, h1 { color: red; }`;
53
+ const output = transformStyles(
54
+ [
55
+ {
56
+ css: input,
57
+ },
58
+ ],
59
+ '.my-namespace'
60
+ );
61
+
62
+ expect( output ).toMatchSnapshot();
63
+ } );
64
+
65
+ it( 'should ignore keyframes', () => {
66
+ const input = `
67
+ @keyframes edit-post__fade-in-animation {
68
+ from {
69
+ opacity: 0;
70
+ }
71
+ }`;
72
+ const output = transformStyles(
73
+ [
74
+ {
75
+ css: input,
76
+ },
77
+ ],
78
+ '.my-namespace'
79
+ );
80
+
81
+ expect( output ).toMatchSnapshot();
82
+ } );
83
+
84
+ it( 'should wrap selectors inside container queries', () => {
85
+ const input = `
86
+ @container (width > 400px) {
87
+ h1 { color: red; }
88
+ }`;
89
+ const output = transformStyles(
90
+ [
91
+ {
92
+ css: input,
93
+ },
94
+ ],
95
+ '.my-namespace'
96
+ );
97
+
98
+ expect( output ).toMatchSnapshot();
99
+ } );
100
+
101
+ it( 'should ignore font-face selectors', () => {
102
+ const input = `
103
+ @font-face {
104
+ font-family: myFirstFont;
105
+ src: url(sansation_light.woff);
106
+ }`;
107
+ const output = transformStyles(
108
+ [
109
+ {
110
+ css: input,
111
+ },
112
+ ],
113
+ '.my-namespace'
114
+ );
115
+
116
+ expect( output ).toMatchSnapshot();
117
+ } );
118
+
119
+ it( 'should replace :root selectors', () => {
120
+ const input = `
121
+ :root {
122
+ --my-color: #ff0000;
123
+ }`;
124
+ const output = transformStyles(
125
+ [
126
+ {
127
+ css: input,
128
+ },
129
+ ],
130
+ '.my-namespace'
131
+ );
132
+
133
+ expect( output ).toMatchSnapshot();
134
+ } );
135
+
136
+ it( 'should not double wrap selectors', () => {
137
+ const input = ` .my-namespace h1, .red { color: red; }`;
138
+
139
+ const output = transformStyles(
140
+ [
141
+ {
142
+ css: input,
143
+ },
144
+ ],
145
+ '.my-namespace'
146
+ );
147
+
148
+ expect( output ).toMatchSnapshot();
149
+ } );
150
+ } );
151
+
152
+ it( 'should not break with data urls', () => {
153
+ const input = `.wp-block-group {
154
+ background-image: url("data:image/svg+xml,%3Csvg%3E.b%7Bclip-path:url(test);%7D%3C/svg%3E");
155
+ color: red !important;
156
+ }`;
157
+
158
+ const output = transformStyles( [
159
+ {
160
+ css: input,
161
+ baseURL: 'http://wp-site.local/themes/gut/css/',
162
+ },
163
+ ] );
164
+
165
+ expect( output ).toMatchSnapshot();
166
+ } );
167
+
168
+ describe( 'URL rewrite', () => {
169
+ it( 'should rewrite relative paths', () => {
170
+ const input = `h1 { background: url(images/test.png); }`;
171
+ const output = transformStyles( [
172
+ {
173
+ css: input,
174
+ baseURL: 'http://wp-site.local/themes/gut/css/',
175
+ },
176
+ ] );
177
+
178
+ expect( output ).toMatchSnapshot();
179
+ } );
180
+
181
+ it( 'should replace complex relative paths', () => {
182
+ const input = `h1 { background: url(../images/test.png); }`;
183
+ const output = transformStyles( [
184
+ {
185
+ css: input,
186
+ baseURL: 'http://wp-site.local/themes/gut/css/',
187
+ },
188
+ ] );
189
+
190
+ expect( output ).toMatchSnapshot();
191
+ } );
192
+
193
+ it( 'should not replace absolute paths', () => {
194
+ const input = `h1 { background: url(/images/test.png); }`;
195
+ const output = transformStyles( [
196
+ {
197
+ css: input,
198
+ baseURL: 'http://wp-site.local/themes/gut/css/',
199
+ },
200
+ ] );
201
+
202
+ expect( output ).toMatchSnapshot();
203
+ } );
204
+
205
+ it( 'should not replace remote paths', () => {
206
+ const input = `h1 { background: url(http://wp.org/images/test.png); }`;
207
+ const output = transformStyles( [
208
+ {
209
+ css: input,
210
+ baseURL: 'http://wp-site.local/themes/gut/css/',
211
+ },
212
+ ] );
213
+
214
+ expect( output ).toMatchSnapshot();
215
+ } );
216
+ } );
217
+ } );
@@ -1,36 +1,36 @@
1
1
  /**
2
- * WordPress dependencies
2
+ * External dependencies
3
3
  */
4
- import { compose } from '@wordpress/compose';
5
-
6
- /**
7
- * Internal dependencies
8
- */
9
- import traverse from './traverse';
10
- import urlRewrite from './transforms/url-rewrite';
11
- import wrap from './transforms/wrap';
4
+ import postcss from 'postcss';
5
+ import wrap from 'postcss-prefixwrap';
6
+ import rebaseUrl from 'postcss-urlrebase';
12
7
 
13
8
  /**
14
9
  * Applies a series of CSS rule transforms to wrap selectors inside a given class and/or rewrite URLs depending on the parameters passed.
15
10
  *
16
- * @param {Object|Array} styles CSS rules.
17
- * @param {string} wrapperClassName Wrapper Class Name.
11
+ * @typedef {Object} EditorStyle
12
+ * @property {string} css the CSS block(s), as a single string.
13
+ * @property {?string} baseURL the base URL to be used as the reference when rewritting urls.
14
+ * @property {?string[]} ignoredSelectors the selectors not to wrap.
15
+ *
16
+ * @param {EditorStyle[]} styles CSS rules.
17
+ * @param {string} wrapperSelector Wrapper selector.
18
18
  * @return {Array} converted rules.
19
19
  */
20
- const transformStyles = ( styles, wrapperClassName = '' ) => {
21
- return Object.values( styles ?? [] ).map( ( { css, baseURL } ) => {
22
- const transforms = [];
23
- if ( wrapperClassName ) {
24
- transforms.push( wrap( wrapperClassName ) );
25
- }
26
- if ( baseURL ) {
27
- transforms.push( urlRewrite( baseURL ) );
28
- }
29
- if ( transforms.length ) {
30
- return traverse( css, compose( transforms ) );
31
- }
32
-
33
- return css;
20
+ const transformStyles = ( styles, wrapperSelector = '' ) => {
21
+ return styles.map( ( { css, ignoredSelectors = [], baseURL } ) => {
22
+ return postcss(
23
+ [
24
+ wrapperSelector &&
25
+ wrap( wrapperSelector, {
26
+ ignoredSelectors: [
27
+ ...ignoredSelectors,
28
+ wrapperSelector,
29
+ ],
30
+ } ),
31
+ baseURL && rebaseUrl( { rootUrl: baseURL } ),
32
+ ].filter( Boolean )
33
+ ).process( css, {} ).css; // use sync PostCSS API
34
34
  } );
35
35
  };
36
36
 
@@ -1,161 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = useSetting;
7
- var _data = require("@wordpress/data");
8
- var _blocks = require("@wordpress/blocks");
9
- var _hooks = require("@wordpress/hooks");
10
- var _blockEdit = require("../block-edit");
11
- var _store = require("../../store");
12
- var _object = require("../../utils/object");
13
- /**
14
- * WordPress dependencies
15
- */
16
-
17
- /**
18
- * Internal dependencies
19
- */
20
-
21
- const blockedPaths = ['color', 'border', 'dimensions', 'typography', 'spacing'];
22
- const deprecatedFlags = {
23
- 'color.palette': settings => settings.colors,
24
- 'color.gradients': settings => settings.gradients,
25
- 'color.custom': settings => settings.disableCustomColors === undefined ? undefined : !settings.disableCustomColors,
26
- 'color.customGradient': settings => settings.disableCustomGradients === undefined ? undefined : !settings.disableCustomGradients,
27
- 'typography.fontSizes': settings => settings.fontSizes,
28
- 'typography.customFontSize': settings => settings.disableCustomFontSizes === undefined ? undefined : !settings.disableCustomFontSizes,
29
- 'typography.lineHeight': settings => settings.enableCustomLineHeight,
30
- 'spacing.units': settings => {
31
- if (settings.enableCustomUnits === undefined) {
32
- return;
33
- }
34
- if (settings.enableCustomUnits === true) {
35
- return ['px', 'em', 'rem', 'vh', 'vw', '%'];
36
- }
37
- return settings.enableCustomUnits;
38
- },
39
- 'spacing.padding': settings => settings.enableCustomSpacing
40
- };
41
- const prefixedFlags = {
42
- /*
43
- * These were only available in the plugin
44
- * and can be removed when the minimum WordPress version
45
- * for the plugin is 5.9.
46
- */
47
- 'border.customColor': 'border.color',
48
- 'border.customStyle': 'border.style',
49
- 'border.customWidth': 'border.width',
50
- 'typography.customFontStyle': 'typography.fontStyle',
51
- 'typography.customFontWeight': 'typography.fontWeight',
52
- 'typography.customLetterSpacing': 'typography.letterSpacing',
53
- 'typography.customTextDecorations': 'typography.textDecoration',
54
- 'typography.customTextTransforms': 'typography.textTransform',
55
- /*
56
- * These were part of WordPress 5.8 and we need to keep them.
57
- */
58
- 'border.customRadius': 'border.radius',
59
- 'spacing.customMargin': 'spacing.margin',
60
- 'spacing.customPadding': 'spacing.padding',
61
- 'typography.customLineHeight': 'typography.lineHeight'
62
- };
63
-
64
- /**
65
- * Remove `custom` prefixes for flags that did not land in 5.8.
66
- *
67
- * This provides continued support for `custom` prefixed properties. It will
68
- * be removed once third party devs have had sufficient time to update themes,
69
- * plugins, etc.
70
- *
71
- * @see https://github.com/WordPress/gutenberg/pull/34485
72
- *
73
- * @param {string} path Path to desired value in settings.
74
- * @return {string} The value for defined setting.
75
- */
76
- const removeCustomPrefixes = path => {
77
- return prefixedFlags[path] || path;
78
- };
79
-
80
- /**
81
- * Hook that retrieves the given setting for the block instance in use.
82
- *
83
- * It looks up the settings first in the block instance hierarchy.
84
- * If none is found, it'll look it up in the block editor store.
85
- *
86
- * @param {string} path The path to the setting.
87
- * @return {any} Returns the value defined for the setting.
88
- * @example
89
- * ```js
90
- * const isEnabled = useSetting( 'typography.dropCap' );
91
- * ```
92
- */
93
- function useSetting(path) {
94
- const {
95
- name: blockName,
96
- clientId
97
- } = (0, _blockEdit.useBlockEditContext)();
98
- return (0, _data.useSelect)(select => {
99
- if (blockedPaths.includes(path)) {
100
- // eslint-disable-next-line no-console
101
- console.warn('Top level useSetting paths are disabled. Please use a subpath to query the information needed.');
102
- return undefined;
103
- }
104
-
105
- // 0. Allow third parties to filter the block's settings at runtime.
106
- let result = (0, _hooks.applyFilters)('blockEditor.useSetting.before', undefined, path, clientId, blockName);
107
- if (undefined !== result) {
108
- return result;
109
- }
110
- const normalizedPath = removeCustomPrefixes(path);
111
-
112
- // 1. Take settings from the block instance or its ancestors.
113
- // Start from the current block and work our way up the ancestors.
114
- const candidates = [clientId, ...select(_store.store).getBlockParents(clientId, /* ascending */true)];
115
- for (const candidateClientId of candidates) {
116
- const candidateBlockName = select(_store.store).getBlockName(candidateClientId);
117
- if ((0, _blocks.hasBlockSupport)(candidateBlockName, '__experimentalSettings', false)) {
118
- var _getValueFromObjectPa;
119
- const candidateAtts = select(_store.store).getBlockAttributes(candidateClientId);
120
- result = (_getValueFromObjectPa = (0, _object.getValueFromObjectPath)(candidateAtts, `settings.blocks.${blockName}.${normalizedPath}`)) !== null && _getValueFromObjectPa !== void 0 ? _getValueFromObjectPa : (0, _object.getValueFromObjectPath)(candidateAtts, `settings.${normalizedPath}`);
121
- if (result !== undefined) {
122
- // Stop the search for more distant ancestors and move on.
123
- break;
124
- }
125
- }
126
- }
127
-
128
- // 2. Fall back to the settings from the block editor store (__experimentalFeatures).
129
- const settings = select(_store.store).getSettings();
130
- if (result === undefined) {
131
- var _getValueFromObjectPa2;
132
- const defaultsPath = `__experimentalFeatures.${normalizedPath}`;
133
- const blockPath = `__experimentalFeatures.blocks.${blockName}.${normalizedPath}`;
134
- result = (_getValueFromObjectPa2 = (0, _object.getValueFromObjectPath)(settings, blockPath)) !== null && _getValueFromObjectPa2 !== void 0 ? _getValueFromObjectPa2 : (0, _object.getValueFromObjectPath)(settings, defaultsPath);
135
- }
136
-
137
- // Return if the setting was found in either the block instance or the store.
138
- if (result !== undefined) {
139
- if (_blocks.__EXPERIMENTAL_PATHS_WITH_MERGE[normalizedPath]) {
140
- return ['default', 'theme', 'custom'].reduce((acc, key) => {
141
- var _result$key;
142
- return acc.concat((_result$key = result[key]) !== null && _result$key !== void 0 ? _result$key : []);
143
- }, []);
144
- }
145
- return result;
146
- }
147
-
148
- // 3. Otherwise, use deprecated settings.
149
- const deprecatedSettingsValue = deprecatedFlags[normalizedPath] ? deprecatedFlags[normalizedPath](settings) : undefined;
150
- if (deprecatedSettingsValue !== undefined) {
151
- return deprecatedSettingsValue;
152
- }
153
-
154
- // 4. Fallback for typography.dropCap:
155
- // This is only necessary to support typography.dropCap.
156
- // when __experimentalFeatures are not present (core without plugin).
157
- // To remove when __experimentalFeatures are ported to core.
158
- return normalizedPath === 'typography.dropCap' ? true : undefined;
159
- }, [blockName, clientId, path]);
160
- }
161
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_data","require","_blocks","_hooks","_blockEdit","_store","_object","blockedPaths","deprecatedFlags","settings","colors","gradients","disableCustomColors","undefined","disableCustomGradients","fontSizes","disableCustomFontSizes","enableCustomLineHeight","enableCustomUnits","enableCustomSpacing","prefixedFlags","removeCustomPrefixes","path","useSetting","name","blockName","clientId","useBlockEditContext","useSelect","select","includes","console","warn","result","applyFilters","normalizedPath","candidates","blockEditorStore","getBlockParents","candidateClientId","candidateBlockName","getBlockName","hasBlockSupport","_getValueFromObjectPa","candidateAtts","getBlockAttributes","getValueFromObjectPath","getSettings","_getValueFromObjectPa2","defaultsPath","blockPath","PATHS_WITH_MERGE","reduce","acc","key","_result$key","concat","deprecatedSettingsValue"],"sources":["@wordpress/block-editor/src/components/use-setting/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\t__EXPERIMENTAL_PATHS_WITH_MERGE as PATHS_WITH_MERGE,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { applyFilters } from '@wordpress/hooks';\n\n/**\n * Internal dependencies\n */\nimport { useBlockEditContext } from '../block-edit';\nimport { store as blockEditorStore } from '../../store';\nimport { getValueFromObjectPath } from '../../utils/object';\n\nconst blockedPaths = [\n\t'color',\n\t'border',\n\t'dimensions',\n\t'typography',\n\t'spacing',\n];\n\nconst deprecatedFlags = {\n\t'color.palette': ( settings ) => settings.colors,\n\t'color.gradients': ( settings ) => settings.gradients,\n\t'color.custom': ( settings ) =>\n\t\tsettings.disableCustomColors === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomColors,\n\t'color.customGradient': ( settings ) =>\n\t\tsettings.disableCustomGradients === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomGradients,\n\t'typography.fontSizes': ( settings ) => settings.fontSizes,\n\t'typography.customFontSize': ( settings ) =>\n\t\tsettings.disableCustomFontSizes === undefined\n\t\t\t? undefined\n\t\t\t: ! settings.disableCustomFontSizes,\n\t'typography.lineHeight': ( settings ) => settings.enableCustomLineHeight,\n\t'spacing.units': ( settings ) => {\n\t\tif ( settings.enableCustomUnits === undefined ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( settings.enableCustomUnits === true ) {\n\t\t\treturn [ 'px', 'em', 'rem', 'vh', 'vw', '%' ];\n\t\t}\n\n\t\treturn settings.enableCustomUnits;\n\t},\n\t'spacing.padding': ( settings ) => settings.enableCustomSpacing,\n};\n\nconst prefixedFlags = {\n\t/*\n\t * These were only available in the plugin\n\t * and can be removed when the minimum WordPress version\n\t * for the plugin is 5.9.\n\t */\n\t'border.customColor': 'border.color',\n\t'border.customStyle': 'border.style',\n\t'border.customWidth': 'border.width',\n\t'typography.customFontStyle': 'typography.fontStyle',\n\t'typography.customFontWeight': 'typography.fontWeight',\n\t'typography.customLetterSpacing': 'typography.letterSpacing',\n\t'typography.customTextDecorations': 'typography.textDecoration',\n\t'typography.customTextTransforms': 'typography.textTransform',\n\t/*\n\t * These were part of WordPress 5.8 and we need to keep them.\n\t */\n\t'border.customRadius': 'border.radius',\n\t'spacing.customMargin': 'spacing.margin',\n\t'spacing.customPadding': 'spacing.padding',\n\t'typography.customLineHeight': 'typography.lineHeight',\n};\n\n/**\n * Remove `custom` prefixes for flags that did not land in 5.8.\n *\n * This provides continued support for `custom` prefixed properties. It will\n * be removed once third party devs have had sufficient time to update themes,\n * plugins, etc.\n *\n * @see https://github.com/WordPress/gutenberg/pull/34485\n *\n * @param {string} path Path to desired value in settings.\n * @return {string} The value for defined setting.\n */\nconst removeCustomPrefixes = ( path ) => {\n\treturn prefixedFlags[ path ] || path;\n};\n\n/**\n * Hook that retrieves the given setting for the block instance in use.\n *\n * It looks up the settings first in the block instance hierarchy.\n * If none is found, it'll look it up in the block editor store.\n *\n * @param {string} path The path to the setting.\n * @return {any} Returns the value defined for the setting.\n * @example\n * ```js\n * const isEnabled = useSetting( 'typography.dropCap' );\n * ```\n */\nexport default function useSetting( path ) {\n\tconst { name: blockName, clientId } = useBlockEditContext();\n\n\treturn useSelect(\n\t\t( select ) => {\n\t\t\tif ( blockedPaths.includes( path ) ) {\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.warn(\n\t\t\t\t\t'Top level useSetting paths are disabled. Please use a subpath to query the information needed.'\n\t\t\t\t);\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\t// 0. Allow third parties to filter the block's settings at runtime.\n\t\t\tlet result = applyFilters(\n\t\t\t\t'blockEditor.useSetting.before',\n\t\t\t\tundefined,\n\t\t\t\tpath,\n\t\t\t\tclientId,\n\t\t\t\tblockName\n\t\t\t);\n\n\t\t\tif ( undefined !== result ) {\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\tconst normalizedPath = removeCustomPrefixes( path );\n\n\t\t\t// 1. Take settings from the block instance or its ancestors.\n\t\t\t// Start from the current block and work our way up the ancestors.\n\t\t\tconst candidates = [\n\t\t\t\tclientId,\n\t\t\t\t...select( blockEditorStore ).getBlockParents(\n\t\t\t\t\tclientId,\n\t\t\t\t\t/* ascending */ true\n\t\t\t\t),\n\t\t\t];\n\n\t\t\tfor ( const candidateClientId of candidates ) {\n\t\t\t\tconst candidateBlockName =\n\t\t\t\t\tselect( blockEditorStore ).getBlockName(\n\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t);\n\t\t\t\tif (\n\t\t\t\t\thasBlockSupport(\n\t\t\t\t\t\tcandidateBlockName,\n\t\t\t\t\t\t'__experimentalSettings',\n\t\t\t\t\t\tfalse\n\t\t\t\t\t)\n\t\t\t\t) {\n\t\t\t\t\tconst candidateAtts =\n\t\t\t\t\t\tselect( blockEditorStore ).getBlockAttributes(\n\t\t\t\t\t\t\tcandidateClientId\n\t\t\t\t\t\t);\n\t\t\t\t\tresult =\n\t\t\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\t\t\tcandidateAtts,\n\t\t\t\t\t\t\t`settings.blocks.${ blockName }.${ normalizedPath }`\n\t\t\t\t\t\t) ??\n\t\t\t\t\t\tgetValueFromObjectPath(\n\t\t\t\t\t\t\tcandidateAtts,\n\t\t\t\t\t\t\t`settings.${ normalizedPath }`\n\t\t\t\t\t\t);\n\t\t\t\t\tif ( result !== undefined ) {\n\t\t\t\t\t\t// Stop the search for more distant ancestors and move on.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// 2. Fall back to the settings from the block editor store (__experimentalFeatures).\n\t\t\tconst settings = select( blockEditorStore ).getSettings();\n\t\t\tif ( result === undefined ) {\n\t\t\t\tconst defaultsPath = `__experimentalFeatures.${ normalizedPath }`;\n\t\t\t\tconst blockPath = `__experimentalFeatures.blocks.${ blockName }.${ normalizedPath }`;\n\t\t\t\tresult =\n\t\t\t\t\tgetValueFromObjectPath( settings, blockPath ) ??\n\t\t\t\t\tgetValueFromObjectPath( settings, defaultsPath );\n\t\t\t}\n\n\t\t\t// Return if the setting was found in either the block instance or the store.\n\t\t\tif ( result !== undefined ) {\n\t\t\t\tif ( PATHS_WITH_MERGE[ normalizedPath ] ) {\n\t\t\t\t\treturn [ 'default', 'theme', 'custom' ].reduce(\n\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\treturn acc.concat( result[ key ] ?? [] );\n\t\t\t\t\t\t},\n\t\t\t\t\t\t[]\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\n\t\t\t// 3. Otherwise, use deprecated settings.\n\t\t\tconst deprecatedSettingsValue = deprecatedFlags[ normalizedPath ]\n\t\t\t\t? deprecatedFlags[ normalizedPath ]( settings )\n\t\t\t\t: undefined;\n\t\t\tif ( deprecatedSettingsValue !== undefined ) {\n\t\t\t\treturn deprecatedSettingsValue;\n\t\t\t}\n\n\t\t\t// 4. Fallback for typography.dropCap:\n\t\t\t// This is only necessary to support typography.dropCap.\n\t\t\t// when __experimentalFeatures are not present (core without plugin).\n\t\t\t// To remove when __experimentalFeatures are ported to core.\n\t\t\treturn normalizedPath === 'typography.dropCap' ? true : undefined;\n\t\t},\n\t\t[ blockName, clientId, path ]\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAIA,IAAAE,MAAA,GAAAF,OAAA;AAKA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAfA;AACA;AACA;;AAQA;AACA;AACA;;AAKA,MAAMM,YAAY,GAAG,CACpB,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,SAAS,CACT;AAED,MAAMC,eAAe,GAAG;EACvB,eAAe,EAAIC,QAAQ,IAAMA,QAAQ,CAACC,MAAM;EAChD,iBAAiB,EAAID,QAAQ,IAAMA,QAAQ,CAACE,SAAS;EACrD,cAAc,EAAIF,QAAQ,IACzBA,QAAQ,CAACG,mBAAmB,KAAKC,SAAS,GACvCA,SAAS,GACT,CAAEJ,QAAQ,CAACG,mBAAmB;EAClC,sBAAsB,EAAIH,QAAQ,IACjCA,QAAQ,CAACK,sBAAsB,KAAKD,SAAS,GAC1CA,SAAS,GACT,CAAEJ,QAAQ,CAACK,sBAAsB;EACrC,sBAAsB,EAAIL,QAAQ,IAAMA,QAAQ,CAACM,SAAS;EAC1D,2BAA2B,EAAIN,QAAQ,IACtCA,QAAQ,CAACO,sBAAsB,KAAKH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(exports, "__esModule", {
5
- value: true
6
- });
7
- Object.defineProperty(exports, "parse", {
8
- enumerable: true,
9
- get: function () {
10
- return _parse.default;
11
- }
12
- });
13
- Object.defineProperty(exports, "stringify", {
14
- enumerable: true,
15
- get: function () {
16
- return _stringify.default;
17
- }
18
- });
19
- var _parse = _interopRequireDefault(require("./parse"));
20
- var _stringify = _interopRequireDefault(require("./stringify"));
21
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_parse","_interopRequireDefault","require","_stringify"],"sources":["@wordpress/block-editor/src/utils/transform-styles/ast/index.js"],"sourcesContent":["// Adapted from https://github.com/reworkcss/css\n// because we needed to remove source map support.\n\nexport { default as parse } from './parse';\nexport { default as stringify } from './stringify';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA"}