@wordpress/edit-site 5.12.8 → 5.12.9

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 (93) hide show
  1. package/build/components/block-editor/index.js +0 -4
  2. package/build/components/block-editor/index.js.map +1 -1
  3. package/build/components/block-editor/use-site-editor-settings.js +12 -6
  4. package/build/components/block-editor/use-site-editor-settings.js.map +1 -1
  5. package/build/components/page-patterns/grid.js +72 -12
  6. package/build/components/page-patterns/grid.js.map +1 -1
  7. package/build/components/page-patterns/patterns-list.js +2 -3
  8. package/build/components/page-patterns/patterns-list.js.map +1 -1
  9. package/build/components/page-template-parts/add-new-template-part.js +74 -0
  10. package/build/components/page-template-parts/add-new-template-part.js.map +1 -0
  11. package/build/components/page-template-parts/index.js +2 -23
  12. package/build/components/page-template-parts/index.js.map +1 -1
  13. package/build/components/resizable-frame/index.js +75 -32
  14. package/build/components/resizable-frame/index.js.map +1 -1
  15. package/build/components/sidebar-navigation-screen/index.js +13 -7
  16. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  17. package/build/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
  18. package/build/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  19. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  20. package/build/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  21. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
  22. package/build/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  23. package/build/components/sidebar-navigation-screen-pages/index.js +33 -25
  24. package/build/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  25. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
  26. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  27. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  28. package/build/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  29. package/build/components/sidebar-navigation-screen-patterns/index.js +3 -4
  30. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  31. package/build/components/site-hub/index.js +3 -1
  32. package/build/components/site-hub/index.js.map +1 -1
  33. package/build/components/sync-state-with-url/use-sync-path-with-url.js +15 -12
  34. package/build/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  35. package/build-module/components/block-editor/index.js +0 -4
  36. package/build-module/components/block-editor/index.js.map +1 -1
  37. package/build-module/components/block-editor/use-site-editor-settings.js +13 -7
  38. package/build-module/components/block-editor/use-site-editor-settings.js.map +1 -1
  39. package/build-module/components/page-patterns/grid.js +75 -15
  40. package/build-module/components/page-patterns/grid.js.map +1 -1
  41. package/build-module/components/page-patterns/patterns-list.js +3 -4
  42. package/build-module/components/page-patterns/patterns-list.js.map +1 -1
  43. package/build-module/components/page-template-parts/add-new-template-part.js +58 -0
  44. package/build-module/components/page-template-parts/add-new-template-part.js.map +1 -0
  45. package/build-module/components/page-template-parts/index.js +3 -22
  46. package/build-module/components/page-template-parts/index.js.map +1 -1
  47. package/build-module/components/resizable-frame/index.js +76 -35
  48. package/build-module/components/resizable-frame/index.js.map +1 -1
  49. package/build-module/components/sidebar-navigation-screen/index.js +14 -8
  50. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  51. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js +1 -1
  52. package/build-module/components/sidebar-navigation-screen-main/template-part-hint.js.map +1 -1
  53. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  54. package/build-module/components/sidebar-navigation-screen-navigation-menu/more-menu.js.map +1 -1
  55. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +3 -3
  56. package/build-module/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js.map +1 -1
  57. package/build-module/components/sidebar-navigation-screen-pages/index.js +33 -25
  58. package/build-module/components/sidebar-navigation-screen-pages/index.js.map +1 -1
  59. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +3 -2
  60. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js.map +1 -1
  61. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +3 -2
  62. package/build-module/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js.map +1 -1
  63. package/build-module/components/sidebar-navigation-screen-patterns/index.js +3 -4
  64. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  65. package/build-module/components/site-hub/index.js +3 -1
  66. package/build-module/components/site-hub/index.js.map +1 -1
  67. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js +16 -12
  68. package/build-module/components/sync-state-with-url/use-sync-path-with-url.js.map +1 -1
  69. package/build-style/style-rtl.css +48 -10
  70. package/build-style/style.css +48 -10
  71. package/package.json +14 -14
  72. package/src/components/block-editor/index.js +0 -4
  73. package/src/components/block-editor/use-site-editor-settings.js +16 -11
  74. package/src/components/layout/style.scss +1 -0
  75. package/src/components/page-patterns/grid.js +101 -16
  76. package/src/components/page-patterns/patterns-list.js +3 -4
  77. package/src/components/page-patterns/style.scss +21 -1
  78. package/src/components/page-template-parts/add-new-template-part.js +57 -0
  79. package/src/components/page-template-parts/index.js +3 -22
  80. package/src/components/resizable-frame/index.js +100 -31
  81. package/src/components/resizable-frame/style.scss +26 -9
  82. package/src/components/sidebar-navigation-item/style.scss +10 -1
  83. package/src/components/sidebar-navigation-screen/index.js +13 -6
  84. package/src/components/sidebar-navigation-screen-main/template-part-hint.js +1 -3
  85. package/src/components/sidebar-navigation-screen-navigation-menu/more-menu.js +1 -0
  86. package/src/components/sidebar-navigation-screen-navigation-menu/single-navigation-menu.js +1 -1
  87. package/src/components/sidebar-navigation-screen-pages/index.js +39 -29
  88. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menu.js +2 -1
  89. package/src/components/sidebar-navigation-screen-pattern/template-part-navigation-menus.js +2 -1
  90. package/src/components/sidebar-navigation-screen-patterns/index.js +20 -18
  91. package/src/components/site-hub/index.js +5 -1
  92. package/src/components/site-hub/style.scss +5 -0
  93. package/src/components/sync-state-with-url/use-sync-path-with-url.js +73 -66
@@ -1784,8 +1784,10 @@ body.is-fullscreen-mode .edit-site-list-header {
1784
1784
  }
1785
1785
 
1786
1786
  .edit-site-patterns {
1787
- background: rgba(0, 0, 0, 0.15);
1787
+ border: 1px solid #2f2f2f;
1788
+ background: none;
1788
1789
  margin: 60px 0 0;
1790
+ border-radius: 0;
1789
1791
  }
1790
1792
  .edit-site-patterns .components-base-control {
1791
1793
  width: 100%;
@@ -1839,6 +1841,23 @@ body.is-fullscreen-mode .edit-site-list-header {
1839
1841
  background: #757575;
1840
1842
  color: #f0f0f0;
1841
1843
  }
1844
+ .edit-site-patterns .edit-site-patterns__grid-pagination {
1845
+ width: -moz-fit-content;
1846
+ width: fit-content;
1847
+ }
1848
+ .edit-site-patterns .edit-site-patterns__grid-pagination .components-button.is-tertiary {
1849
+ width: 32px;
1850
+ height: 32px;
1851
+ color: #f0f0f0;
1852
+ background-color: #2f2f2f;
1853
+ }
1854
+ .edit-site-patterns .edit-site-patterns__grid-pagination .components-button.is-tertiary:disabled {
1855
+ color: #949494;
1856
+ background: none;
1857
+ }
1858
+ .edit-site-patterns .edit-site-patterns__grid-pagination .components-button.is-tertiary:hover:not(:disabled) {
1859
+ background-color: #757575;
1860
+ }
1842
1861
 
1843
1862
  .edit-site-patterns__section-header .screen-reader-shortcut:focus {
1844
1863
  top: 0;
@@ -1849,6 +1868,7 @@ body.is-fullscreen-mode .edit-site-list-header {
1849
1868
  grid-template-columns: 1fr;
1850
1869
  gap: 32px;
1851
1870
  padding-top: 2px;
1871
+ margin-top: 0;
1852
1872
  margin-bottom: 32px;
1853
1873
  }
1854
1874
  @media (min-width: 960px) {
@@ -2658,6 +2678,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2658
2678
  .edit-site-layout__sidebar {
2659
2679
  z-index: 1;
2660
2680
  width: 100vw;
2681
+ flex-shrink: 0;
2661
2682
  }
2662
2683
  @media (min-width: 782px) {
2663
2684
  .edit-site-layout__sidebar {
@@ -2967,12 +2988,15 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2967
2988
  color: #e0e0e0;
2968
2989
  background: #2f2f2f;
2969
2990
  }
2991
+ .edit-site-sidebar-navigation-item.components-item:hover .edit-site-sidebar-navigation-item__drilldown-indicator, .edit-site-sidebar-navigation-item.components-item:focus .edit-site-sidebar-navigation-item__drilldown-indicator, .edit-site-sidebar-navigation-item.components-item[aria-current] .edit-site-sidebar-navigation-item__drilldown-indicator {
2992
+ fill: #e0e0e0;
2993
+ }
2970
2994
  .edit-site-sidebar-navigation-item.components-item[aria-current] {
2971
2995
  background: var(--wp-admin-theme-color);
2972
2996
  color: #fff;
2973
2997
  }
2974
2998
  .edit-site-sidebar-navigation-item.components-item .edit-site-sidebar-navigation-item__drilldown-indicator {
2975
- fill: #757575;
2999
+ fill: #949494;
2976
3000
  }
2977
3001
  .edit-site-sidebar-navigation-item.components-item:is(a) {
2978
3002
  text-decoration: none;
@@ -2983,6 +3007,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2983
3007
  box-shadow: none;
2984
3008
  outline: none;
2985
3009
  }
3010
+ .edit-site-sidebar-navigation-item.components-item:is(a):focus-visible {
3011
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
3012
+ outline: 2px solid transparent;
3013
+ }
2986
3014
  .edit-site-sidebar-navigation-item.components-item.with-suffix {
2987
3015
  padding-left: 16px;
2988
3016
  }
@@ -3332,6 +3360,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3332
3360
  .edit-site-site-hub .edit-site-site-hub__container {
3333
3361
  gap: 0;
3334
3362
  }
3363
+ .edit-site-site-hub .edit-site-site-hub__site-title,
3364
+ .edit-site-site-hub .edit-site-site-hub_toggle-command-center {
3365
+ transition: opacity ease 0.1s;
3366
+ }
3335
3367
  .edit-site-site-hub .edit-site-site-hub__site-view-link {
3336
3368
  flex-grow: 0;
3337
3369
  }
@@ -3531,6 +3563,14 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3531
3563
  .edit-site-resizable-frame__inner {
3532
3564
  position: relative;
3533
3565
  }
3566
+ body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__site-title,
3567
+ body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub_toggle-command-center {
3568
+ opacity: 0 !important;
3569
+ }
3570
+ body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__view-mode-toggle-container {
3571
+ background-color: transparent;
3572
+ }
3573
+
3534
3574
  body:has(.edit-site-resizable-frame__inner.is-resizing) {
3535
3575
  cursor: col-resize;
3536
3576
  user-select: none;
@@ -3553,11 +3593,13 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
3553
3593
  .edit-site-resizable-frame__handle {
3554
3594
  align-items: center;
3555
3595
  background-color: rgba(117, 117, 117, 0.4);
3596
+ border: 0;
3556
3597
  border-radius: 4px;
3557
3598
  cursor: col-resize;
3558
3599
  display: flex;
3559
3600
  height: 64px;
3560
3601
  justify-content: flex-end;
3602
+ padding: 0;
3561
3603
  position: absolute;
3562
3604
  top: calc(50% - 32px);
3563
3605
  width: 4px;
@@ -3577,15 +3619,11 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
3577
3619
  left: 100%;
3578
3620
  width: 32px;
3579
3621
  }
3580
- .edit-site-resizable-frame__handle:hover, .is-resizing .edit-site-resizable-frame__handle {
3581
- background-color: var(--wp-admin-theme-color);
3622
+ .edit-site-resizable-frame__handle:focus-visible {
3623
+ outline: 2px solid transparent;
3582
3624
  }
3583
- .edit-site-resizable-frame__handle .edit-site-resizable-frame__handle-label {
3584
- background: var(--wp-admin-theme-color);
3585
- border-radius: 2px;
3586
- color: #fff;
3587
- margin-left: 8px;
3588
- padding: 4px 8px;
3625
+ .edit-site-resizable-frame__handle:hover, .edit-site-resizable-frame__handle:focus, .edit-site-resizable-frame__handle.is-resizing {
3626
+ background-color: var(--wp-admin-theme-color);
3589
3627
  }
3590
3628
 
3591
3629
  .edit-site-push-changes-to-global-styles-control .components-button {
@@ -1785,8 +1785,10 @@ body.is-fullscreen-mode .edit-site-list-header {
1785
1785
  }
1786
1786
 
1787
1787
  .edit-site-patterns {
1788
- background: rgba(0, 0, 0, 0.15);
1788
+ border: 1px solid #2f2f2f;
1789
+ background: none;
1789
1790
  margin: 60px 0 0;
1791
+ border-radius: 0;
1790
1792
  }
1791
1793
  .edit-site-patterns .components-base-control {
1792
1794
  width: 100%;
@@ -1840,6 +1842,23 @@ body.is-fullscreen-mode .edit-site-list-header {
1840
1842
  background: #757575;
1841
1843
  color: #f0f0f0;
1842
1844
  }
1845
+ .edit-site-patterns .edit-site-patterns__grid-pagination {
1846
+ width: -moz-fit-content;
1847
+ width: fit-content;
1848
+ }
1849
+ .edit-site-patterns .edit-site-patterns__grid-pagination .components-button.is-tertiary {
1850
+ width: 32px;
1851
+ height: 32px;
1852
+ color: #f0f0f0;
1853
+ background-color: #2f2f2f;
1854
+ }
1855
+ .edit-site-patterns .edit-site-patterns__grid-pagination .components-button.is-tertiary:disabled {
1856
+ color: #949494;
1857
+ background: none;
1858
+ }
1859
+ .edit-site-patterns .edit-site-patterns__grid-pagination .components-button.is-tertiary:hover:not(:disabled) {
1860
+ background-color: #757575;
1861
+ }
1843
1862
 
1844
1863
  .edit-site-patterns__section-header .screen-reader-shortcut:focus {
1845
1864
  top: 0;
@@ -1850,6 +1869,7 @@ body.is-fullscreen-mode .edit-site-list-header {
1850
1869
  grid-template-columns: 1fr;
1851
1870
  gap: 32px;
1852
1871
  padding-top: 2px;
1872
+ margin-top: 0;
1853
1873
  margin-bottom: 32px;
1854
1874
  }
1855
1875
  @media (min-width: 960px) {
@@ -2659,6 +2679,7 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2659
2679
  .edit-site-layout__sidebar {
2660
2680
  z-index: 1;
2661
2681
  width: 100vw;
2682
+ flex-shrink: 0;
2662
2683
  }
2663
2684
  @media (min-width: 782px) {
2664
2685
  .edit-site-layout__sidebar {
@@ -2968,12 +2989,15 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2968
2989
  color: #e0e0e0;
2969
2990
  background: #2f2f2f;
2970
2991
  }
2992
+ .edit-site-sidebar-navigation-item.components-item:hover .edit-site-sidebar-navigation-item__drilldown-indicator, .edit-site-sidebar-navigation-item.components-item:focus .edit-site-sidebar-navigation-item__drilldown-indicator, .edit-site-sidebar-navigation-item.components-item[aria-current] .edit-site-sidebar-navigation-item__drilldown-indicator {
2993
+ fill: #e0e0e0;
2994
+ }
2971
2995
  .edit-site-sidebar-navigation-item.components-item[aria-current] {
2972
2996
  background: var(--wp-admin-theme-color);
2973
2997
  color: #fff;
2974
2998
  }
2975
2999
  .edit-site-sidebar-navigation-item.components-item .edit-site-sidebar-navigation-item__drilldown-indicator {
2976
- fill: #757575;
3000
+ fill: #949494;
2977
3001
  }
2978
3002
  .edit-site-sidebar-navigation-item.components-item:is(a) {
2979
3003
  text-decoration: none;
@@ -2984,6 +3008,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
2984
3008
  box-shadow: none;
2985
3009
  outline: none;
2986
3010
  }
3011
+ .edit-site-sidebar-navigation-item.components-item:is(a):focus-visible {
3012
+ box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
3013
+ outline: 2px solid transparent;
3014
+ }
2987
3015
  .edit-site-sidebar-navigation-item.components-item.with-suffix {
2988
3016
  padding-right: 16px;
2989
3017
  }
@@ -3333,6 +3361,10 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3333
3361
  .edit-site-site-hub .edit-site-site-hub__container {
3334
3362
  gap: 0;
3335
3363
  }
3364
+ .edit-site-site-hub .edit-site-site-hub__site-title,
3365
+ .edit-site-site-hub .edit-site-site-hub_toggle-command-center {
3366
+ transition: opacity ease 0.1s;
3367
+ }
3336
3368
  .edit-site-site-hub .edit-site-site-hub__site-view-link {
3337
3369
  flex-grow: 0;
3338
3370
  }
@@ -3532,6 +3564,14 @@ body.is-fullscreen-mode .edit-site .components-editor-notices__snackbar {
3532
3564
  .edit-site-resizable-frame__inner {
3533
3565
  position: relative;
3534
3566
  }
3567
+ body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__site-title,
3568
+ body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub_toggle-command-center {
3569
+ opacity: 0 !important;
3570
+ }
3571
+ body:has(.edit-site-resizable-frame__inner.edit-site-layout__resizable-frame-oversized) .edit-site-site-hub .edit-site-site-hub__view-mode-toggle-container {
3572
+ background-color: transparent;
3573
+ }
3574
+
3535
3575
  body:has(.edit-site-resizable-frame__inner.is-resizing) {
3536
3576
  cursor: col-resize;
3537
3577
  user-select: none;
@@ -3554,11 +3594,13 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
3554
3594
  .edit-site-resizable-frame__handle {
3555
3595
  align-items: center;
3556
3596
  background-color: rgba(117, 117, 117, 0.4);
3597
+ border: 0;
3557
3598
  border-radius: 4px;
3558
3599
  cursor: col-resize;
3559
3600
  display: flex;
3560
3601
  height: 64px;
3561
3602
  justify-content: flex-end;
3603
+ padding: 0;
3562
3604
  position: absolute;
3563
3605
  top: calc(50% - 32px);
3564
3606
  width: 4px;
@@ -3578,15 +3620,11 @@ body:has(.edit-site-resizable-frame__inner.is-resizing) {
3578
3620
  right: 100%;
3579
3621
  width: 32px;
3580
3622
  }
3581
- .edit-site-resizable-frame__handle:hover, .is-resizing .edit-site-resizable-frame__handle {
3582
- background-color: var(--wp-admin-theme-color);
3623
+ .edit-site-resizable-frame__handle:focus-visible {
3624
+ outline: 2px solid transparent;
3583
3625
  }
3584
- .edit-site-resizable-frame__handle .edit-site-resizable-frame__handle-label {
3585
- background: var(--wp-admin-theme-color);
3586
- border-radius: 2px;
3587
- color: #fff;
3588
- margin-right: 8px;
3589
- padding: 4px 8px;
3626
+ .edit-site-resizable-frame__handle:hover, .edit-site-resizable-frame__handle:focus, .edit-site-resizable-frame__handle.is-resizing {
3627
+ background-color: var(--wp-admin-theme-color);
3590
3628
  }
3591
3629
 
3592
3630
  .edit-site-push-changes-to-global-styles-control .components-button {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/edit-site",
3
- "version": "5.12.8",
3
+ "version": "5.12.9",
4
4
  "description": "Edit Site Page module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -29,40 +29,40 @@
29
29
  "@babel/runtime": "^7.16.0",
30
30
  "@wordpress/a11y": "^3.35.1",
31
31
  "@wordpress/api-fetch": "^6.32.1",
32
- "@wordpress/block-editor": "^12.3.6",
33
- "@wordpress/block-library": "^8.12.8",
32
+ "@wordpress/block-editor": "^12.3.7",
33
+ "@wordpress/block-library": "^8.12.9",
34
34
  "@wordpress/blocks": "^12.12.3",
35
- "@wordpress/commands": "^0.6.6",
36
- "@wordpress/components": "^25.1.6",
35
+ "@wordpress/commands": "^0.6.7",
36
+ "@wordpress/components": "^25.1.7",
37
37
  "@wordpress/compose": "^6.12.1",
38
- "@wordpress/core-commands": "^0.4.6",
39
- "@wordpress/core-data": "^6.12.6",
38
+ "@wordpress/core-commands": "^0.4.7",
39
+ "@wordpress/core-data": "^6.12.7",
40
40
  "@wordpress/data": "^9.5.3",
41
41
  "@wordpress/date": "^4.35.1",
42
42
  "@wordpress/deprecated": "^3.35.1",
43
43
  "@wordpress/dom": "^3.35.1",
44
- "@wordpress/editor": "^13.12.6",
44
+ "@wordpress/editor": "^13.12.7",
45
45
  "@wordpress/element": "^5.12.1",
46
46
  "@wordpress/escape-html": "^2.35.1",
47
47
  "@wordpress/hooks": "^3.35.1",
48
48
  "@wordpress/html-entities": "^3.35.1",
49
49
  "@wordpress/i18n": "^4.35.1",
50
50
  "@wordpress/icons": "^9.26.2",
51
- "@wordpress/interface": "^5.12.6",
51
+ "@wordpress/interface": "^5.12.7",
52
52
  "@wordpress/keyboard-shortcuts": "^4.12.3",
53
53
  "@wordpress/keycodes": "^3.35.1",
54
54
  "@wordpress/media-utils": "^4.26.1",
55
55
  "@wordpress/notices": "^4.3.3",
56
- "@wordpress/plugins": "^6.3.6",
57
- "@wordpress/preferences": "^3.12.6",
56
+ "@wordpress/plugins": "^6.3.7",
57
+ "@wordpress/preferences": "^3.12.7",
58
58
  "@wordpress/primitives": "^3.33.1",
59
59
  "@wordpress/private-apis": "^0.17.1",
60
- "@wordpress/reusable-blocks": "^4.12.6",
60
+ "@wordpress/reusable-blocks": "^4.12.7",
61
61
  "@wordpress/router": "^0.4.1",
62
62
  "@wordpress/style-engine": "^1.18.1",
63
63
  "@wordpress/url": "^3.36.1",
64
64
  "@wordpress/viewport": "^5.12.3",
65
- "@wordpress/widgets": "^3.12.6",
65
+ "@wordpress/widgets": "^3.12.7",
66
66
  "@wordpress/wordcount": "^3.35.1",
67
67
  "change-case": "^4.1.2",
68
68
  "classnames": "^2.3.1",
@@ -84,5 +84,5 @@
84
84
  "publishConfig": {
85
85
  "access": "public"
86
86
  },
87
- "gitHead": "86ecd96b3bcada6b4cc35bb2455b3029cebb0ff3"
87
+ "gitHead": "5a52ea1ed29bbf8f3ead96f83b17d2c1cf84c880"
88
88
  }
@@ -1,7 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
-
5
1
  /**
6
2
  * WordPress dependencies
7
3
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useSelect } from '@wordpress/data';
4
+ import { useDispatch, useSelect } from '@wordpress/data';
5
5
  import { useMemo } from '@wordpress/element';
6
6
  import { store as coreStore } from '@wordpress/core-data';
7
7
  /**
@@ -11,16 +11,21 @@ import { store as editSiteStore } from '../../store';
11
11
  import { unlock } from '../../lock-unlock';
12
12
  import inserterMediaCategories from './inserter-media-categories';
13
13
 
14
- export default function useSiteEditorSettings( templateType ) {
15
- const { storedSettings, canvasMode } = useSelect( ( select ) => {
16
- const { getSettings, getCanvasMode } = unlock(
17
- select( editSiteStore )
18
- );
19
- return {
20
- storedSettings: getSettings(),
21
- canvasMode: getCanvasMode(),
22
- };
23
- }, [] );
14
+ export default function useSiteEditorSettings() {
15
+ const { setIsInserterOpened } = useDispatch( editSiteStore );
16
+ const { storedSettings, canvasMode, templateType } = useSelect(
17
+ ( select ) => {
18
+ const { getSettings, getCanvasMode, getEditedPostType } = unlock(
19
+ select( editSiteStore )
20
+ );
21
+ return {
22
+ storedSettings: getSettings( setIsInserterOpened ),
23
+ canvasMode: getCanvasMode(),
24
+ templateType: getEditedPostType(),
25
+ };
26
+ },
27
+ [ setIsInserterOpened ]
28
+ );
24
29
 
25
30
  const settingsBlockPatterns =
26
31
  storedSettings.__experimentalAdditionalBlockPatterns ?? // WP 6.0
@@ -61,6 +61,7 @@
61
61
  .edit-site-layout__sidebar {
62
62
  z-index: z-index(".edit-site-layout__sidebar");
63
63
  width: 100vw;
64
+ flex-shrink: 0;
64
65
 
65
66
  @include break-medium {
66
67
  width: $nav-sidebar-width;
@@ -1,26 +1,115 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __experimentalText as Text } from '@wordpress/components';
5
- import { useRef } from '@wordpress/element';
6
- import { __, sprintf } from '@wordpress/i18n';
4
+ import {
5
+ __experimentalHStack as HStack,
6
+ __experimentalText as Text,
7
+ Button,
8
+ } from '@wordpress/components';
9
+ import { useRef, useState, useMemo } from '@wordpress/element';
10
+ import { __, _x, _n, sprintf } from '@wordpress/i18n';
11
+ import { useAsyncList } from '@wordpress/compose';
7
12
 
8
13
  /**
9
14
  * Internal dependencies
10
15
  */
11
16
  import GridItem from './grid-item';
12
17
 
13
- const PAGE_SIZE = 100;
18
+ const PAGE_SIZE = 20;
19
+
20
+ function Pagination( { currentPage, numPages, changePage, totalItems } ) {
21
+ return (
22
+ <HStack
23
+ expanded={ false }
24
+ spacing={ 3 }
25
+ className="edit-site-patterns__grid-pagination"
26
+ >
27
+ <Text variant="muted">
28
+ {
29
+ // translators: %s: Total number of patterns.
30
+ sprintf(
31
+ // translators: %s: Total number of patterns.
32
+ _n( '%s item', '%s items', totalItems ),
33
+ totalItems
34
+ )
35
+ }
36
+ </Text>
37
+ <HStack expanded={ false } spacing={ 1 }>
38
+ <Button
39
+ variant="tertiary"
40
+ onClick={ () => changePage( 1 ) }
41
+ disabled={ currentPage === 1 }
42
+ aria-label={ __( 'First page' ) }
43
+ >
44
+ «
45
+ </Button>
46
+ <Button
47
+ variant="tertiary"
48
+ onClick={ () => changePage( currentPage - 1 ) }
49
+ disabled={ currentPage === 1 }
50
+ aria-label={ __( 'Previous page' ) }
51
+ >
52
+
53
+ </Button>
54
+ </HStack>
55
+ <Text variant="muted">
56
+ { sprintf(
57
+ // translators: %1$s: Current page number, %2$s: Total number of pages.
58
+ _x( '%1$s of %2$s', 'paging' ),
59
+ currentPage,
60
+ numPages
61
+ ) }
62
+ </Text>
63
+ <HStack expanded={ false } spacing={ 1 }>
64
+ <Button
65
+ variant="tertiary"
66
+ onClick={ () => changePage( currentPage + 1 ) }
67
+ disabled={ currentPage === numPages }
68
+ aria-label={ __( 'Next page' ) }
69
+ >
70
+
71
+ </Button>
72
+ <Button
73
+ variant="tertiary"
74
+ onClick={ () => changePage( numPages ) }
75
+ disabled={ currentPage === numPages }
76
+ aria-label={ __( 'Last page' ) }
77
+ >
78
+ »
79
+ </Button>
80
+ </HStack>
81
+ </HStack>
82
+ );
83
+ }
14
84
 
15
85
  export default function Grid( { categoryId, items, ...props } ) {
86
+ const [ currentPage, setCurrentPage ] = useState( 1 );
16
87
  const gridRef = useRef();
88
+ const totalItems = items.length;
89
+ const pageIndex = currentPage - 1;
17
90
 
18
- if ( ! items?.length ) {
91
+ const list = useMemo(
92
+ () =>
93
+ items.slice(
94
+ pageIndex * PAGE_SIZE,
95
+ pageIndex * PAGE_SIZE + PAGE_SIZE
96
+ ),
97
+ [ pageIndex, items ]
98
+ );
99
+
100
+ const asyncList = useAsyncList( list, { step: 10 } );
101
+
102
+ if ( ! list?.length ) {
19
103
  return null;
20
104
  }
21
105
 
22
- const list = items.slice( 0, PAGE_SIZE );
23
- const restLength = items.length - PAGE_SIZE;
106
+ const numPages = Math.ceil( items.length / PAGE_SIZE );
107
+ const changePage = ( page ) => {
108
+ const scrollContainer = document.querySelector( '.edit-site-patterns' );
109
+ scrollContainer?.scrollTo( 0, 0 );
110
+
111
+ setCurrentPage( page );
112
+ };
24
113
 
25
114
  return (
26
115
  <>
@@ -30,7 +119,7 @@ export default function Grid( { categoryId, items, ...props } ) {
30
119
  { ...props }
31
120
  ref={ gridRef }
32
121
  >
33
- { list.map( ( item ) => (
122
+ { asyncList.map( ( item ) => (
34
123
  <GridItem
35
124
  key={ item.name }
36
125
  item={ item }
@@ -38,14 +127,10 @@ export default function Grid( { categoryId, items, ...props } ) {
38
127
  />
39
128
  ) ) }
40
129
  </ul>
41
- { restLength > 0 && (
42
- <Text variant="muted" as="p" align="center">
43
- { sprintf(
44
- /* translators: %d: number of patterns */
45
- __( '+ %d more patterns discoverable by searching' ),
46
- restLength
47
- ) }
48
- </Text>
130
+ { numPages > 1 && (
131
+ <Pagination
132
+ { ...{ currentPage, numPages, changePage, totalItems } }
133
+ />
49
134
  ) }
50
135
  </>
51
136
  );
@@ -15,7 +15,7 @@ import {
15
15
  import { __, isRTL } from '@wordpress/i18n';
16
16
  import { chevronLeft, chevronRight } from '@wordpress/icons';
17
17
  import { privateApis as routerPrivateApis } from '@wordpress/router';
18
- import { useViewportMatch, useAsyncList } from '@wordpress/compose';
18
+ import { useViewportMatch } from '@wordpress/compose';
19
19
 
20
20
  /**
21
21
  * Internal dependencies
@@ -70,7 +70,6 @@ export default function PatternsList( { categoryId, type } ) {
70
70
  const hasPatterns = patterns.length;
71
71
  const title = SYNC_FILTERS[ syncFilter ];
72
72
  const description = SYNC_DESCRIPTIONS[ syncFilter ];
73
- const shownPatterns = useAsyncList( patterns );
74
73
 
75
74
  return (
76
75
  <VStack spacing={ 6 }>
@@ -132,7 +131,7 @@ export default function PatternsList( { categoryId, type } ) {
132
131
  </Flex>
133
132
  { syncFilter !== 'all' && (
134
133
  <VStack className="edit-site-patterns__section-header">
135
- <Heading as="h3" level={ 4 } id={ titleId }>
134
+ <Heading as="h3" level={ 5 } id={ titleId }>
136
135
  { title }
137
136
  </Heading>
138
137
  { description ? (
@@ -145,7 +144,7 @@ export default function PatternsList( { categoryId, type } ) {
145
144
  { hasPatterns && (
146
145
  <Grid
147
146
  categoryId={ categoryId }
148
- items={ shownPatterns }
147
+ items={ patterns }
149
148
  aria-labelledby={ titleId }
150
149
  aria-describedby={ descriptionId }
151
150
  />
@@ -1,6 +1,8 @@
1
1
  .edit-site-patterns {
2
- background: rgba(0, 0, 0, 0.15);
2
+ border: 1px solid $gray-800;
3
+ background: none;
3
4
  margin: $header-height 0 0;
5
+ border-radius: 0;
4
6
  .components-base-control {
5
7
  width: 100%;
6
8
  @include break-medium {
@@ -59,6 +61,23 @@
59
61
  background: $gray-700;
60
62
  color: $gray-100;
61
63
  }
64
+
65
+ .edit-site-patterns__grid-pagination {
66
+ width: fit-content;
67
+ .components-button.is-tertiary {
68
+ width: $button-size-compact;
69
+ height: $button-size-compact;
70
+ color: $gray-100;
71
+ background-color: $gray-800;
72
+ &:disabled {
73
+ color: $gray-600;
74
+ background: none;
75
+ }
76
+ &:hover:not(:disabled) {
77
+ background-color: $gray-700;
78
+ }
79
+ }
80
+ }
62
81
  }
63
82
 
64
83
  .edit-site-patterns__section-header {
@@ -74,6 +93,7 @@
74
93
  // Small top padding required to avoid cutting off the visible outline
75
94
  // when hovering items.
76
95
  padding-top: $border-width-focus-fallback;
96
+ margin-top: 0;
77
97
  margin-bottom: $grid-unit-40;
78
98
  @include break-large {
79
99
  grid-template-columns: 1fr 1fr;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { privateApis as routerPrivateApis } from '@wordpress/router';
5
+ import { useSelect } from '@wordpress/data';
6
+ import { store as coreStore } from '@wordpress/core-data';
7
+ import { useState } from '@wordpress/element';
8
+ import { Button } from '@wordpress/components';
9
+
10
+ /**
11
+ * Internal dependencies
12
+ */
13
+ import { unlock } from '../../lock-unlock';
14
+ import { store as editSiteStore } from '../../store';
15
+ import CreateTemplatePartModal from '../create-template-part-modal';
16
+
17
+ const { useHistory } = unlock( routerPrivateApis );
18
+
19
+ export default function AddNewTemplatePart() {
20
+ const { canCreate, postType } = useSelect( ( select ) => {
21
+ const { supportsTemplatePartsMode } =
22
+ select( editSiteStore ).getSettings();
23
+ return {
24
+ canCreate: ! supportsTemplatePartsMode,
25
+ postType: select( coreStore ).getPostType( 'wp_template_part' ),
26
+ };
27
+ }, [] );
28
+ const [ isModalOpen, setIsModalOpen ] = useState( false );
29
+ const history = useHistory();
30
+
31
+ if ( ! canCreate || ! postType ) {
32
+ return null;
33
+ }
34
+
35
+ return (
36
+ <>
37
+ <Button variant="primary" onClick={ () => setIsModalOpen( true ) }>
38
+ { postType.labels.add_new_item }
39
+ </Button>
40
+ { isModalOpen && (
41
+ <CreateTemplatePartModal
42
+ closeModal={ () => setIsModalOpen( false ) }
43
+ blocks={ [] }
44
+ onCreate={ ( templatePart ) => {
45
+ setIsModalOpen( false );
46
+ history.push( {
47
+ postId: templatePart.id,
48
+ postType: 'wp_template_part',
49
+ canvas: 'edit',
50
+ } );
51
+ } }
52
+ onError={ () => setIsModalOpen( false ) }
53
+ />
54
+ ) }
55
+ </>
56
+ );
57
+ }