@wordpress/block-editor 8.0.2 → 8.0.6

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 (58) hide show
  1. package/build/components/block-preview/auto.js +1 -0
  2. package/build/components/block-preview/auto.js.map +1 -1
  3. package/build/components/colors/with-colors.js +6 -4
  4. package/build/components/colors/with-colors.js.map +1 -1
  5. package/build/components/colors-gradients/control.js +4 -2
  6. package/build/components/colors-gradients/control.js.map +1 -1
  7. package/build/components/colors-gradients/panel-color-gradient-settings.js +29 -25
  8. package/build/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  9. package/build/components/gradients/use-gradient.js +7 -6
  10. package/build/components/gradients/use-gradient.js.map +1 -1
  11. package/build/components/use-setting/index.js +1 -1
  12. package/build/components/use-setting/index.js.map +1 -1
  13. package/build/hooks/color.js +29 -21
  14. package/build/hooks/color.js.map +1 -1
  15. package/build/hooks/typography.js +3 -0
  16. package/build/hooks/typography.js.map +1 -1
  17. package/build/hooks/use-color-props.js +13 -4
  18. package/build/hooks/use-color-props.js.map +1 -1
  19. package/build/store/selectors.js +37 -43
  20. package/build/store/selectors.js.map +1 -1
  21. package/build-module/components/block-preview/auto.js +1 -0
  22. package/build-module/components/block-preview/auto.js.map +1 -1
  23. package/build-module/components/colors/with-colors.js +6 -4
  24. package/build-module/components/colors/with-colors.js.map +1 -1
  25. package/build-module/components/colors-gradients/control.js +4 -2
  26. package/build-module/components/colors-gradients/control.js.map +1 -1
  27. package/build-module/components/colors-gradients/panel-color-gradient-settings.js +30 -26
  28. package/build-module/components/colors-gradients/panel-color-gradient-settings.js.map +1 -1
  29. package/build-module/components/gradients/use-gradient.js +8 -6
  30. package/build-module/components/gradients/use-gradient.js.map +1 -1
  31. package/build-module/components/use-setting/index.js +1 -1
  32. package/build-module/components/use-setting/index.js.map +1 -1
  33. package/build-module/hooks/color.js +30 -22
  34. package/build-module/hooks/color.js.map +1 -1
  35. package/build-module/hooks/typography.js +1 -2
  36. package/build-module/hooks/typography.js.map +1 -1
  37. package/build-module/hooks/use-color-props.js +11 -3
  38. package/build-module/hooks/use-color-props.js.map +1 -1
  39. package/build-module/store/selectors.js +37 -43
  40. package/build-module/store/selectors.js.map +1 -1
  41. package/build-style/style-rtl.css +72 -68
  42. package/build-style/style.css +72 -68
  43. package/package.json +3 -3
  44. package/src/components/block-list-appender/style.scss +0 -42
  45. package/src/components/block-preview/auto.js +3 -0
  46. package/src/components/block-preview/style.scss +5 -0
  47. package/src/components/button-block-appender/style.scss +0 -17
  48. package/src/components/colors/with-colors.js +11 -5
  49. package/src/components/colors-gradients/control.js +2 -0
  50. package/src/components/colors-gradients/panel-color-gradient-settings.js +58 -25
  51. package/src/components/default-block-appender/style.scss +90 -16
  52. package/src/components/gradients/use-gradient.js +16 -7
  53. package/src/components/inner-blocks/style.scss +4 -10
  54. package/src/components/use-setting/index.js +2 -2
  55. package/src/hooks/color.js +58 -26
  56. package/src/hooks/typography.js +1 -1
  57. package/src/hooks/use-color-props.js +23 -4
  58. package/src/store/selectors.js +14 -26
@@ -728,35 +728,6 @@
728
728
  display: none;
729
729
  }
730
730
 
731
- .block-editor-block-list__block .block-list-appender {
732
- align-self: center;
733
- padding: 0;
734
- list-style: none;
735
- margin-bottom: revert;
736
- }
737
- .block-editor-block-list__block .block-list-appender.wp-block {
738
- max-width: none;
739
- }
740
- .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender {
741
- margin: 8px 0;
742
- }
743
- .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
744
- padding: 0;
745
- opacity: 1;
746
- transform: scale(1);
747
- transition: all 0.1s ease;
748
- margin-right: 8px;
749
- }
750
- @media (prefers-reduced-motion: reduce) {
751
- .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
752
- transition-duration: 0s;
753
- transition-delay: 0s;
754
- }
755
- }
756
- .block-editor-block-list__block .block-list-appender:first-of-type .block-list-appender__toggle {
757
- margin-right: 0;
758
- }
759
-
760
731
  .is-vertical .block-list-appender {
761
732
  width: 24px;
762
733
  margin-left: auto;
@@ -1213,6 +1184,10 @@
1213
1184
  display: none;
1214
1185
  }
1215
1186
 
1187
+ .block-editor-block-preview__content-iframe .block-list-appender {
1188
+ display: none;
1189
+ }
1190
+
1216
1191
  .block-editor-block-settings-menu__popover .components-dropdown-menu__menu {
1217
1192
  padding: 0;
1218
1193
  }
@@ -1762,20 +1737,6 @@
1762
1737
  .block-editor-button-block-appender:active {
1763
1738
  color: #000;
1764
1739
  }
1765
- .block-editor-button-block-appender.block-list-appender__toggle {
1766
- display: flex;
1767
- flex-direction: row;
1768
- box-shadow: none;
1769
- height: 24px;
1770
- width: 24px;
1771
- }
1772
- .block-editor-button-block-appender.block-list-appender__toggle > svg {
1773
- width: 24px;
1774
- background-color: #1e1e1e;
1775
- color: #fff;
1776
- border-radius: 2px;
1777
- flex: 1 0 auto;
1778
- }
1779
1740
 
1780
1741
  .block-editor-color-gradient-control .block-editor-color-gradient-control__color-indicator {
1781
1742
  margin-bottom: 12px;
@@ -1805,6 +1766,14 @@
1805
1766
  margin: 0;
1806
1767
  }
1807
1768
 
1769
+ /**
1770
+ * Default block appender.
1771
+ *
1772
+ * This component shows up in 3 places:
1773
+ * - the black plus that sits at the end of the canvas, if the last block isn't a paragraph
1774
+ * - on the right, inside empty paragraphs
1775
+ * - absolute positioned and blue inside nesting containers
1776
+ */
1808
1777
  .block-editor-default-block-appender {
1809
1778
  clear: both;
1810
1779
  margin-right: auto;
@@ -1821,32 +1790,72 @@
1821
1790
  display: none;
1822
1791
  }
1823
1792
 
1824
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter,
1825
- .block-editor-default-block-appender .block-editor-inserter {
1793
+ .block-editor-default-block-appender .block-editor-inserter,
1794
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter {
1826
1795
  position: absolute;
1827
1796
  top: 0;
1828
- height: 32px;
1797
+ left: 0;
1798
+ line-height: 0;
1829
1799
  }
1830
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle,
1831
- .block-editor-default-block-appender .block-editor-inserter .block-editor-inserter__toggle {
1832
- margin-left: 0;
1800
+ .block-editor-default-block-appender .block-editor-inserter:disabled,
1801
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter:disabled {
1802
+ display: none;
1833
1803
  }
1834
1804
 
1835
- @media (min-width: 600px) {
1836
- .block-editor-block-list__empty-block-inserter,
1837
- .block-editor-default-block-appender .block-editor-inserter {
1838
- display: flex;
1839
- height: 100%;
1840
- }
1805
+ /**
1806
+ * Fixed position appender.
1807
+ * These styles apply to all in-canvas inserters that exist inside nesting containers.
1808
+ */
1809
+ .block-editor-block-list__block .block-list-appender {
1810
+ position: absolute;
1811
+ list-style: none;
1812
+ padding: 0;
1813
+ z-index: 2;
1814
+ bottom: 0;
1815
+ left: 0;
1816
+ }
1817
+ .block-editor-block-list__block .block-list-appender.block-list-appender {
1818
+ margin: 0;
1819
+ line-height: 0;
1820
+ }
1821
+ .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender {
1822
+ height: 24px;
1823
+ }
1824
+ .block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1825
+ .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
1826
+ flex-direction: row;
1827
+ box-shadow: none;
1828
+ height: 24px;
1829
+ width: 24px;
1830
+ display: none;
1831
+ padding: 0 !important;
1832
+ background: #1e1e1e;
1833
+ color: #fff;
1834
+ }
1835
+ .block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon:hover,
1836
+ .block-editor-block-list__block .block-list-appender .block-list-appender__toggle:hover {
1837
+ color: #fff;
1838
+ background: var(--wp-admin-theme-color);
1841
1839
  }
1842
- .block-editor-block-list__empty-block-inserter:disabled,
1843
- .block-editor-default-block-appender .block-editor-inserter:disabled {
1840
+ .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender__content {
1844
1841
  display: none;
1845
1842
  }
1843
+ .block-editor-block-list__block .block-list-appender:only-child {
1844
+ position: relative;
1845
+ left: auto;
1846
+ align-self: center;
1847
+ list-style: none;
1848
+ line-height: inherit;
1849
+ }
1850
+ .block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content {
1851
+ display: block;
1852
+ }
1846
1853
 
1847
- .block-editor-default-block-appender.has-visible-prompt .block-editor-inserter,
1848
- .block-editor-block-list__empty-block-inserter {
1849
- left: 0;
1854
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1855
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle,
1856
+ .block-editor-block-list__block.is-selected > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1857
+ .block-editor-block-list__block.is-selected > .block-list-appender .block-list-appender__toggle {
1858
+ display: flex;
1850
1859
  }
1851
1860
 
1852
1861
  .block-editor-duotone-control__popover > .components-popover__content > div {
@@ -2384,16 +2393,11 @@
2384
2393
  .block-editor-block-list__layout.has-overlay::after {
2385
2394
  content: "";
2386
2395
  position: absolute;
2387
- top: -14px;
2388
- left: -14px;
2389
- bottom: -14px;
2390
- right: -14px;
2391
- z-index: 60;
2392
- }
2393
-
2394
- [data-align=full] .has-overlay::after {
2396
+ top: 0;
2395
2397
  left: 0;
2398
+ bottom: 0;
2396
2399
  right: 0;
2400
+ z-index: 60;
2397
2401
  }
2398
2402
 
2399
2403
  .block-editor-block-types-list__list-item {
@@ -728,35 +728,6 @@
728
728
  display: none;
729
729
  }
730
730
 
731
- .block-editor-block-list__block .block-list-appender {
732
- align-self: center;
733
- padding: 0;
734
- list-style: none;
735
- margin-bottom: revert;
736
- }
737
- .block-editor-block-list__block .block-list-appender.wp-block {
738
- max-width: none;
739
- }
740
- .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender {
741
- margin: 8px 0;
742
- }
743
- .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
744
- padding: 0;
745
- opacity: 1;
746
- transform: scale(1);
747
- transition: all 0.1s ease;
748
- margin-left: 8px;
749
- }
750
- @media (prefers-reduced-motion: reduce) {
751
- .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
752
- transition-duration: 0s;
753
- transition-delay: 0s;
754
- }
755
- }
756
- .block-editor-block-list__block .block-list-appender:first-of-type .block-list-appender__toggle {
757
- margin-left: 0;
758
- }
759
-
760
731
  .is-vertical .block-list-appender {
761
732
  width: 24px;
762
733
  margin-right: auto;
@@ -1213,6 +1184,10 @@
1213
1184
  display: none;
1214
1185
  }
1215
1186
 
1187
+ .block-editor-block-preview__content-iframe .block-list-appender {
1188
+ display: none;
1189
+ }
1190
+
1216
1191
  .block-editor-block-settings-menu__popover .components-dropdown-menu__menu {
1217
1192
  padding: 0;
1218
1193
  }
@@ -1762,20 +1737,6 @@
1762
1737
  .block-editor-button-block-appender:active {
1763
1738
  color: #000;
1764
1739
  }
1765
- .block-editor-button-block-appender.block-list-appender__toggle {
1766
- display: flex;
1767
- flex-direction: row;
1768
- box-shadow: none;
1769
- height: 24px;
1770
- width: 24px;
1771
- }
1772
- .block-editor-button-block-appender.block-list-appender__toggle > svg {
1773
- width: 24px;
1774
- background-color: #1e1e1e;
1775
- color: #fff;
1776
- border-radius: 2px;
1777
- flex: 1 0 auto;
1778
- }
1779
1740
 
1780
1741
  .block-editor-color-gradient-control .block-editor-color-gradient-control__color-indicator {
1781
1742
  margin-bottom: 12px;
@@ -1805,6 +1766,14 @@
1805
1766
  margin: 0;
1806
1767
  }
1807
1768
 
1769
+ /**
1770
+ * Default block appender.
1771
+ *
1772
+ * This component shows up in 3 places:
1773
+ * - the black plus that sits at the end of the canvas, if the last block isn't a paragraph
1774
+ * - on the right, inside empty paragraphs
1775
+ * - absolute positioned and blue inside nesting containers
1776
+ */
1808
1777
  .block-editor-default-block-appender {
1809
1778
  clear: both;
1810
1779
  margin-left: auto;
@@ -1821,32 +1790,72 @@
1821
1790
  display: none;
1822
1791
  }
1823
1792
 
1824
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter,
1825
- .block-editor-default-block-appender .block-editor-inserter {
1793
+ .block-editor-default-block-appender .block-editor-inserter,
1794
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter {
1826
1795
  position: absolute;
1827
1796
  top: 0;
1828
- height: 32px;
1797
+ right: 0;
1798
+ line-height: 0;
1829
1799
  }
1830
- .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle,
1831
- .block-editor-default-block-appender .block-editor-inserter .block-editor-inserter__toggle {
1832
- margin-right: 0;
1800
+ .block-editor-default-block-appender .block-editor-inserter:disabled,
1801
+ .block-editor-block-list__empty-block-inserter.block-editor-block-list__empty-block-inserter:disabled {
1802
+ display: none;
1833
1803
  }
1834
1804
 
1835
- @media (min-width: 600px) {
1836
- .block-editor-block-list__empty-block-inserter,
1837
- .block-editor-default-block-appender .block-editor-inserter {
1838
- display: flex;
1839
- height: 100%;
1840
- }
1805
+ /**
1806
+ * Fixed position appender.
1807
+ * These styles apply to all in-canvas inserters that exist inside nesting containers.
1808
+ */
1809
+ .block-editor-block-list__block .block-list-appender {
1810
+ position: absolute;
1811
+ list-style: none;
1812
+ padding: 0;
1813
+ z-index: 2;
1814
+ bottom: 0;
1815
+ right: 0;
1816
+ }
1817
+ .block-editor-block-list__block .block-list-appender.block-list-appender {
1818
+ margin: 0;
1819
+ line-height: 0;
1820
+ }
1821
+ .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender {
1822
+ height: 24px;
1823
+ }
1824
+ .block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1825
+ .block-editor-block-list__block .block-list-appender .block-list-appender__toggle {
1826
+ flex-direction: row;
1827
+ box-shadow: none;
1828
+ height: 24px;
1829
+ width: 24px;
1830
+ display: none;
1831
+ padding: 0 !important;
1832
+ background: #1e1e1e;
1833
+ color: #fff;
1834
+ }
1835
+ .block-editor-block-list__block .block-list-appender .block-editor-inserter__toggle.components-button.has-icon:hover,
1836
+ .block-editor-block-list__block .block-list-appender .block-list-appender__toggle:hover {
1837
+ color: #fff;
1838
+ background: var(--wp-admin-theme-color);
1841
1839
  }
1842
- .block-editor-block-list__empty-block-inserter:disabled,
1843
- .block-editor-default-block-appender .block-editor-inserter:disabled {
1840
+ .block-editor-block-list__block .block-list-appender .block-editor-default-block-appender__content {
1844
1841
  display: none;
1845
1842
  }
1843
+ .block-editor-block-list__block .block-list-appender:only-child {
1844
+ position: relative;
1845
+ right: auto;
1846
+ align-self: center;
1847
+ list-style: none;
1848
+ line-height: inherit;
1849
+ }
1850
+ .block-editor-block-list__block .block-list-appender:only-child .block-editor-default-block-appender__content {
1851
+ display: block;
1852
+ }
1846
1853
 
1847
- .block-editor-default-block-appender.has-visible-prompt .block-editor-inserter,
1848
- .block-editor-block-list__empty-block-inserter {
1849
- right: 0;
1854
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1855
+ .block-editor-block-list__block.is-selected .block-editor-block-list__layout > .block-list-appender .block-list-appender__toggle,
1856
+ .block-editor-block-list__block.is-selected > .block-list-appender .block-editor-inserter__toggle.components-button.has-icon,
1857
+ .block-editor-block-list__block.is-selected > .block-list-appender .block-list-appender__toggle {
1858
+ display: flex;
1850
1859
  }
1851
1860
 
1852
1861
  .block-editor-duotone-control__popover > .components-popover__content > div {
@@ -2384,16 +2393,11 @@
2384
2393
  .block-editor-block-list__layout.has-overlay::after {
2385
2394
  content: "";
2386
2395
  position: absolute;
2387
- top: -14px;
2388
- right: -14px;
2389
- bottom: -14px;
2390
- left: -14px;
2391
- z-index: 60;
2392
- }
2393
-
2394
- [data-align=full] .has-overlay::after {
2396
+ top: 0;
2395
2397
  right: 0;
2398
+ bottom: 0;
2396
2399
  left: 0;
2400
+ z-index: 60;
2397
2401
  }
2398
2402
 
2399
2403
  .block-editor-block-types-list__list-item {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-editor",
3
- "version": "8.0.2",
3
+ "version": "8.0.6",
4
4
  "description": "Generic block editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -38,7 +38,7 @@
38
38
  "@wordpress/blob": "^3.2.2",
39
39
  "@wordpress/block-serialization-default-parser": "^4.2.3",
40
40
  "@wordpress/blocks": "^11.1.4",
41
- "@wordpress/components": "^19.0.2",
41
+ "@wordpress/components": "^19.1.0",
42
42
  "@wordpress/compose": "^5.0.6",
43
43
  "@wordpress/data": "^6.1.4",
44
44
  "@wordpress/deprecated": "^3.2.3",
@@ -75,5 +75,5 @@
75
75
  "publishConfig": {
76
76
  "access": "public"
77
77
  },
78
- "gitHead": "9a1dd3474d937468e4cf9caf9886ad61ef0a8f50"
78
+ "gitHead": "6d3bd917064b4b194677233ee426f5988fa441b9"
79
79
  }
@@ -1,45 +1,3 @@
1
- // These styles are only applied to the appender when it appears inside of a block.
2
- // Otherwise the default appender may be improperly positioned in some themes.
3
- .block-editor-block-list__block .block-list-appender {
4
- align-self: center;
5
- padding: 0;
6
- list-style: none;
7
-
8
- // Themes sometimes apply a max-width to all elements classed blocks.
9
- &.wp-block {
10
- max-width: none;
11
- }
12
-
13
- .block-editor-default-block-appender {
14
- margin: $grid-unit-10 0;
15
- }
16
-
17
- // Zero out the margin that's inherited from common.scss.
18
- margin-bottom: revert;
19
-
20
- // Black square plus appender.
21
- .block-list-appender__toggle {
22
- padding: 0;
23
-
24
- // Animate appearance.
25
- opacity: 1;
26
- transform: scale(1);
27
- transition: all 0.1s ease;
28
- @include reduce-motion("transition");
29
-
30
- // The black square button should have a little left margin in horizontal containers.
31
- margin-left: $grid-unit-10;
32
- }
33
-
34
- // Cancel any left margin if the black plus sits alone in the container.
35
- // `first-of-type` is used instead of `first-child` as the element is not always the only
36
- // element in the "empty" container. For example the empty navigation block state has a
37
- // zero-width placeholder state that is meant to help correctly size the dimensions.
38
- &:first-of-type .block-list-appender__toggle {
39
- margin-left: 0;
40
- }
41
- }
42
-
43
1
  // For vertical flex containers, a 100% width ensures correct alignment.
44
2
  .is-vertical .block-list-appender {
45
3
  width: $icon-size;
@@ -50,6 +50,9 @@ function AutoBlockPreview( { viewportWidth, __experimentalPadding } ) {
50
50
  const {
51
51
  ownerDocument: { documentElement },
52
52
  } = bodyElement;
53
+ documentElement.classList.add(
54
+ 'block-editor-block-preview__content-iframe'
55
+ );
53
56
  documentElement.style.position = 'absolute';
54
57
  documentElement.style.width = '100%';
55
58
  bodyElement.style.padding =
@@ -36,3 +36,8 @@
36
36
  }
37
37
  }
38
38
  }
39
+
40
+ // Hide inserter from previews.
41
+ .block-editor-block-preview__content-iframe .block-list-appender {
42
+ display: none;
43
+ }
@@ -26,21 +26,4 @@
26
26
  &:active {
27
27
  color: $black;
28
28
  }
29
-
30
- // This variant is used in inline situations, like Buttons, Social Links, Navigation Menu.
31
- &.block-list-appender__toggle {
32
- display: flex;
33
- flex-direction: row;
34
- box-shadow: none;
35
- height: $icon-size;
36
- width: $icon-size;
37
-
38
- & > svg {
39
- width: $icon-size;
40
- background-color: $gray-900;
41
- color: $white;
42
- border-radius: $radius-block-ui;
43
- flex: 1 0 auto;
44
- }
45
- }
46
29
  }
@@ -6,7 +6,7 @@ import { isString, kebabCase, reduce, upperFirst } from 'lodash';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { Component } from '@wordpress/element';
9
+ import { useMemo, Component } from '@wordpress/element';
10
10
  import { compose, createHigherOrderComponent } from '@wordpress/compose';
11
11
 
12
12
  /**
@@ -20,8 +20,6 @@ import {
20
20
  } from './utils';
21
21
  import useSetting from '../use-setting';
22
22
 
23
- const DEFAULT_COLORS = [];
24
-
25
23
  /**
26
24
  * Higher order component factory for injecting the `colorsArray` argument as
27
25
  * the colors prop in the `withCustomColors` HOC.
@@ -47,8 +45,16 @@ const withCustomColorPalette = ( colorsArray ) =>
47
45
  const withEditorColorPalette = () =>
48
46
  createHigherOrderComponent(
49
47
  ( WrappedComponent ) => ( props ) => {
50
- const colors = useSetting( 'color.palette' ) || DEFAULT_COLORS;
51
- return <WrappedComponent { ...props } colors={ colors } />;
48
+ const { palette: colorPerOrigin } = useSetting( 'color' ) || {};
49
+ const allColors = useMemo(
50
+ () => [
51
+ ...( colorPerOrigin?.custom || [] ),
52
+ ...( colorPerOrigin?.theme || [] ),
53
+ ...( colorPerOrigin?.default || [] ),
54
+ ],
55
+ [ colorPerOrigin ]
56
+ );
57
+ return <WrappedComponent { ...props } colors={ allColors } />;
52
58
  },
53
59
  'withEditorColorPalette'
54
60
  );
@@ -44,6 +44,7 @@ function ColorGradientControlInner( {
44
44
  gradientValue,
45
45
  clearable,
46
46
  showTitle = true,
47
+ enableAlpha,
47
48
  } ) {
48
49
  const canChooseAColor =
49
50
  onColorChange && ( ! isEmpty( colors ) || ! disableCustomColors );
@@ -109,6 +110,7 @@ function ColorGradientControlInner( {
109
110
  __experimentalHasMultipleOrigins
110
111
  }
111
112
  clearable={ clearable }
113
+ enableAlpha={ enableAlpha }
112
114
  />
113
115
  ) }
114
116
  { ( currentTab === 'gradient' || ! canChooseAColor ) && (
@@ -8,7 +8,7 @@ import { every, isEmpty } from 'lodash';
8
8
  * WordPress dependencies
9
9
  */
10
10
  import { PanelBody, ColorIndicator } from '@wordpress/components';
11
- import { sprintf, __ } from '@wordpress/i18n';
11
+ import { sprintf, __, _x } from '@wordpress/i18n';
12
12
  import { useMemo } from '@wordpress/element';
13
13
 
14
14
  /**
@@ -92,6 +92,7 @@ export const PanelColorGradientSettingsInner = ( {
92
92
  title,
93
93
  showTitle = true,
94
94
  __experimentalHasMultipleOrigins,
95
+ enableAlpha,
95
96
  ...props
96
97
  } ) => {
97
98
  if (
@@ -143,6 +144,7 @@ export const PanelColorGradientSettingsInner = ( {
143
144
  disableCustomColors,
144
145
  disableCustomGradients,
145
146
  __experimentalHasMultipleOrigins,
147
+ enableAlpha,
146
148
  ...setting,
147
149
  } }
148
150
  />
@@ -172,57 +174,88 @@ const PanelColorGradientSettingsSingleSelect = ( props ) => {
172
174
 
173
175
  const PanelColorGradientSettingsMultipleSelect = ( props ) => {
174
176
  const colorGradientSettings = useCommonSingleMultipleSelects();
175
- const userColors = useSetting( 'color.palette.user' );
177
+ const customColors = useSetting( 'color.palette.custom' );
176
178
  const themeColors = useSetting( 'color.palette.theme' );
177
- const coreColors = useSetting( 'color.palette.core' );
179
+ const defaultColors = useSetting( 'color.palette.default' );
180
+ const shouldDisplayDefaultColors = useSetting( 'color.defaultPalette' );
181
+
178
182
  colorGradientSettings.colors = useMemo( () => {
179
183
  const result = [];
180
- if ( coreColors && coreColors.length ) {
184
+ if ( themeColors && themeColors.length ) {
181
185
  result.push( {
182
- name: __( 'Core' ),
183
- colors: coreColors,
186
+ name: _x(
187
+ 'Theme',
188
+ 'Indicates this palette comes from the theme.'
189
+ ),
190
+ colors: themeColors,
184
191
  } );
185
192
  }
186
- if ( themeColors && themeColors.length ) {
193
+ if (
194
+ shouldDisplayDefaultColors &&
195
+ defaultColors &&
196
+ defaultColors.length
197
+ ) {
187
198
  result.push( {
188
- name: __( 'Theme' ),
189
- colors: themeColors,
199
+ name: _x(
200
+ 'Default',
201
+ 'Indicates this palette comes from WordPress.'
202
+ ),
203
+ colors: defaultColors,
190
204
  } );
191
205
  }
192
- if ( userColors && userColors.length ) {
206
+ if ( customColors && customColors.length ) {
193
207
  result.push( {
194
- name: __( 'User' ),
195
- colors: userColors,
208
+ name: _x(
209
+ 'Custom',
210
+ 'Indicates this palette comes from the theme.'
211
+ ),
212
+ colors: customColors,
196
213
  } );
197
214
  }
198
215
  return result;
199
- }, [ coreColors, themeColors, userColors ] );
216
+ }, [ defaultColors, themeColors, customColors ] );
200
217
 
201
- const userGradients = useSetting( 'color.gradients.user' );
218
+ const customGradients = useSetting( 'color.gradients.custom' );
202
219
  const themeGradients = useSetting( 'color.gradients.theme' );
203
- const coreGradients = useSetting( 'color.gradients.core' );
220
+ const defaultGradients = useSetting( 'color.gradients.default' );
221
+ const shouldDisplayDefaultGradients = useSetting(
222
+ 'color.defaultGradients'
223
+ );
204
224
  colorGradientSettings.gradients = useMemo( () => {
205
225
  const result = [];
206
- if ( coreGradients && coreGradients.length ) {
226
+ if ( themeGradients && themeGradients.length ) {
207
227
  result.push( {
208
- name: __( 'Core' ),
209
- gradients: coreGradients,
228
+ name: _x(
229
+ 'Theme',
230
+ 'Indicates this palette comes from the theme.'
231
+ ),
232
+ gradients: themeGradients,
210
233
  } );
211
234
  }
212
- if ( themeGradients && themeGradients.length ) {
235
+ if (
236
+ shouldDisplayDefaultGradients &&
237
+ defaultGradients &&
238
+ defaultGradients.length
239
+ ) {
213
240
  result.push( {
214
- name: __( 'Theme' ),
215
- gradients: themeGradients,
241
+ name: _x(
242
+ 'Default',
243
+ 'Indicates this palette comes from WordPress.'
244
+ ),
245
+ gradients: defaultGradients,
216
246
  } );
217
247
  }
218
- if ( userGradients && userGradients.length ) {
248
+ if ( customGradients && customGradients.length ) {
219
249
  result.push( {
220
- name: __( 'User' ),
221
- gradients: userGradients,
250
+ name: _x(
251
+ 'Custom',
252
+ 'Indicates this palette is created by the user.'
253
+ ),
254
+ gradients: customGradients,
222
255
  } );
223
256
  }
224
257
  return result;
225
- }, [ userGradients, themeGradients, coreGradients ] );
258
+ }, [ customGradients, themeGradients, defaultGradients ] );
226
259
  return (
227
260
  <PanelColorGradientSettingsInner
228
261
  { ...{ ...colorGradientSettings, ...props } }