@wordpress/block-library 9.33.8 → 9.33.10

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 (65) hide show
  1. package/build/accordion/view.js +46 -4
  2. package/build/accordion/view.js.map +2 -2
  3. package/build/accordion-heading/block.json +1 -1
  4. package/build/accordion-heading/deprecated.js +121 -2
  5. package/build/accordion-heading/deprecated.js.map +2 -2
  6. package/build/accordion-heading/save.js +1 -0
  7. package/build/accordion-heading/save.js.map +2 -2
  8. package/build/accordion-panel/block.json +1 -1
  9. package/build/freeform/block.json +1 -2
  10. package/build/math/edit.js +4 -1
  11. package/build/math/edit.js.map +2 -2
  12. package/build/missing/block.json +1 -1
  13. package/build/navigation-link/edit.js +1 -1
  14. package/build/navigation-link/edit.js.map +2 -2
  15. package/build/pattern/block.json +1 -1
  16. package/build-module/accordion/view.js +46 -4
  17. package/build-module/accordion/view.js.map +2 -2
  18. package/build-module/accordion-heading/block.json +1 -1
  19. package/build-module/accordion-heading/deprecated.js +123 -3
  20. package/build-module/accordion-heading/deprecated.js.map +2 -2
  21. package/build-module/accordion-heading/save.js +1 -0
  22. package/build-module/accordion-heading/save.js.map +2 -2
  23. package/build-module/accordion-panel/block.json +1 -1
  24. package/build-module/freeform/block.json +1 -2
  25. package/build-module/math/edit.js +4 -1
  26. package/build-module/math/edit.js.map +2 -2
  27. package/build-module/missing/block.json +1 -1
  28. package/build-module/navigation-link/edit.js +1 -1
  29. package/build-module/navigation-link/edit.js.map +2 -2
  30. package/build-module/pattern/block.json +1 -1
  31. package/build-style/accordion/style-rtl.css +3 -0
  32. package/build-style/accordion/style.css +3 -0
  33. package/build-style/accordion-heading/style-rtl.css +2 -19
  34. package/build-style/accordion-heading/style.css +2 -19
  35. package/build-style/accordion-item/style-rtl.css +0 -7
  36. package/build-style/accordion-item/style.css +0 -7
  37. package/build-style/accordion-panel/style-rtl.css +1 -4
  38. package/build-style/accordion-panel/style.css +1 -4
  39. package/build-style/classic-rtl.css +24 -0
  40. package/build-style/classic.css +24 -0
  41. package/build-style/media-text/style-rtl.css +2 -0
  42. package/build-style/media-text/style.css +2 -0
  43. package/build-style/style-rtl.css +8 -29
  44. package/build-style/style.css +8 -29
  45. package/package.json +11 -11
  46. package/src/accordion/style.scss +4 -0
  47. package/src/accordion/view.js +60 -3
  48. package/src/accordion-heading/block.json +1 -1
  49. package/src/accordion-heading/deprecated.js +123 -2
  50. package/src/accordion-heading/save.js +1 -0
  51. package/src/accordion-heading/style.scss +2 -38
  52. package/src/accordion-item/index.php +1 -0
  53. package/src/accordion-item/style.scss +2 -9
  54. package/src/accordion-panel/block.json +1 -1
  55. package/src/accordion-panel/style.scss +1 -5
  56. package/src/classic.scss +38 -0
  57. package/src/embed/test/index.js +2 -0
  58. package/src/freeform/block.json +1 -2
  59. package/src/math/edit.js +4 -1
  60. package/src/media-text/style.scss +2 -0
  61. package/src/missing/block.json +1 -1
  62. package/src/navigation-link/edit.js +1 -1
  63. package/src/pattern/block.json +1 -1
  64. package/src/style.scss +1 -0
  65. package/src/term-template/index.php +1 -1
@@ -1,8 +1,3 @@
1
- .wp-block-accordion-heading.wp-block-accordion-heading {
2
- min-width: 100%;
3
- margin: 0;
4
- }
5
-
6
1
  .wp-block-accordion-heading__toggle {
7
2
  font-family: inherit;
8
3
  font-size: inherit;
@@ -13,7 +8,9 @@
13
8
  text-decoration: inherit;
14
9
  word-spacing: inherit;
15
10
  font-style: inherit;
11
+ background: none;
16
12
  border: none;
13
+ color: inherit;
17
14
  padding: var(--wp--preset--spacing--20, 1em) 0;
18
15
  cursor: pointer;
19
16
  overflow: hidden;
@@ -21,24 +18,10 @@
21
18
  align-items: center;
22
19
  text-align: inherit;
23
20
  width: 100%;
24
- background-color: inherit !important;
25
- color: inherit !important;
26
21
  }
27
22
  .wp-block-accordion-heading__toggle:not(:focus-visible) {
28
23
  outline: none;
29
24
  }
30
- .wp-block-accordion-heading__toggle:hover, .wp-block-accordion-heading__toggle:focus {
31
- text-decoration: none;
32
- background-color: inherit !important;
33
- box-shadow: none;
34
- color: inherit;
35
- border: none;
36
- padding: var(--wp--preset--spacing--20, 1em) 0;
37
- }
38
- .wp-block-accordion-heading__toggle:focus-visible {
39
- outline: auto;
40
- outline-offset: 0;
41
- }
42
25
  .wp-block-accordion-heading__toggle:hover .wp-block-accordion-heading__toggle-title {
43
26
  text-decoration: underline;
44
27
  }
@@ -1,8 +1,3 @@
1
- .wp-block-accordion-heading.wp-block-accordion-heading {
2
- min-width: 100%;
3
- margin: 0;
4
- }
5
-
6
1
  .wp-block-accordion-heading__toggle {
7
2
  font-family: inherit;
8
3
  font-size: inherit;
@@ -13,7 +8,9 @@
13
8
  text-decoration: inherit;
14
9
  word-spacing: inherit;
15
10
  font-style: inherit;
11
+ background: none;
16
12
  border: none;
13
+ color: inherit;
17
14
  padding: var(--wp--preset--spacing--20, 1em) 0;
18
15
  cursor: pointer;
19
16
  overflow: hidden;
@@ -21,24 +18,10 @@
21
18
  align-items: center;
22
19
  text-align: inherit;
23
20
  width: 100%;
24
- background-color: inherit !important;
25
- color: inherit !important;
26
21
  }
27
22
  .wp-block-accordion-heading__toggle:not(:focus-visible) {
28
23
  outline: none;
29
24
  }
30
- .wp-block-accordion-heading__toggle:hover, .wp-block-accordion-heading__toggle:focus {
31
- text-decoration: none;
32
- background-color: inherit !important;
33
- box-shadow: none;
34
- color: inherit;
35
- border: none;
36
- padding: var(--wp--preset--spacing--20, 1em) 0;
37
- }
38
- .wp-block-accordion-heading__toggle:focus-visible {
39
- outline: auto;
40
- outline-offset: 0;
41
- }
42
25
  .wp-block-accordion-heading__toggle:hover .wp-block-accordion-heading__toggle-title {
43
26
  text-decoration: underline;
44
27
  }
@@ -1,10 +1,3 @@
1
- .wp-block-accordion-item {
2
- display: grid;
3
- grid-template-rows: max-content 0fr;
4
- }
5
- .wp-block-accordion-item.is-open {
6
- grid-template-rows: max-content 1fr;
7
- }
8
1
  .wp-block-accordion-item.is-open > .wp-block-accordion-heading .wp-block-accordion-heading__toggle-icon {
9
2
  transform: rotate(-45deg);
10
3
  }
@@ -1,10 +1,3 @@
1
- .wp-block-accordion-item {
2
- display: grid;
3
- grid-template-rows: max-content 0fr;
4
- }
5
- .wp-block-accordion-item.is-open {
6
- grid-template-rows: max-content 1fr;
7
- }
8
1
  .wp-block-accordion-item.is-open > .wp-block-accordion-heading .wp-block-accordion-heading__toggle-icon {
9
2
  transform: rotate(45deg);
10
3
  }
@@ -1,7 +1,4 @@
1
- .wp-block-accordion-panel.wp-block-accordion-panel {
2
- min-width: 100%;
3
- }
4
- .wp-block-accordion-panel.wp-block-accordion-panel[inert], .wp-block-accordion-panel.wp-block-accordion-panel[aria-hidden=true] {
1
+ .wp-block-accordion-panel[inert], .wp-block-accordion-panel[aria-hidden=true] {
5
2
  display: none;
6
3
  margin-block-start: 0;
7
4
  }
@@ -1,7 +1,4 @@
1
- .wp-block-accordion-panel.wp-block-accordion-panel {
2
- min-width: 100%;
3
- }
4
- .wp-block-accordion-panel.wp-block-accordion-panel[inert], .wp-block-accordion-panel.wp-block-accordion-panel[aria-hidden=true] {
1
+ .wp-block-accordion-panel[inert], .wp-block-accordion-panel[aria-hidden=true] {
5
2
  display: none;
6
3
  margin-block-start: 0;
7
4
  }
@@ -14,4 +14,28 @@
14
14
  .wp-block-file__button {
15
15
  background: #32373c;
16
16
  color: #fff;
17
+ }
18
+
19
+ .wp-block-accordion-heading {
20
+ margin: 0;
21
+ }
22
+
23
+ .wp-block-accordion-heading__toggle {
24
+ background-color: inherit !important;
25
+ color: inherit !important;
26
+ }
27
+ .wp-block-accordion-heading__toggle:not(:focus-visible) {
28
+ outline: none;
29
+ }
30
+ .wp-block-accordion-heading__toggle:hover, .wp-block-accordion-heading__toggle:focus {
31
+ text-decoration: none;
32
+ background-color: inherit !important;
33
+ box-shadow: none;
34
+ color: inherit;
35
+ border: none;
36
+ padding: var(--wp--preset--spacing--20, 1em) 0;
37
+ }
38
+ .wp-block-accordion-heading__toggle:focus-visible {
39
+ outline-offset: 0;
40
+ outline: auto;
17
41
  }
@@ -14,4 +14,28 @@
14
14
  .wp-block-file__button {
15
15
  background: #32373c;
16
16
  color: #fff;
17
+ }
18
+
19
+ .wp-block-accordion-heading {
20
+ margin: 0;
21
+ }
22
+
23
+ .wp-block-accordion-heading__toggle {
24
+ background-color: inherit !important;
25
+ color: inherit !important;
26
+ }
27
+ .wp-block-accordion-heading__toggle:not(:focus-visible) {
28
+ outline: none;
29
+ }
30
+ .wp-block-accordion-heading__toggle:hover, .wp-block-accordion-heading__toggle:focus {
31
+ text-decoration: none;
32
+ background-color: inherit !important;
33
+ box-shadow: none;
34
+ color: inherit;
35
+ border: none;
36
+ padding: var(--wp--preset--spacing--20, 1em) 0;
37
+ }
38
+ .wp-block-accordion-heading__toggle:focus-visible {
39
+ outline-offset: 0;
40
+ outline: auto;
17
41
  }
@@ -90,6 +90,7 @@
90
90
 
91
91
  /* Image fill for versions 8 and onwards */
92
92
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media {
93
+ position: relative;
93
94
  height: 100%;
94
95
  min-height: 250px;
95
96
  }
@@ -100,6 +101,7 @@
100
101
  }
101
102
 
102
103
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media img {
104
+ position: absolute;
103
105
  width: 100%;
104
106
  height: 100%;
105
107
  object-fit: cover;
@@ -100,6 +100,7 @@
100
100
 
101
101
  /* Image fill for versions 8 and onwards */
102
102
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media {
103
+ position: relative;
103
104
  height: 100%;
104
105
  min-height: 250px;
105
106
  }
@@ -110,6 +111,7 @@
110
111
  }
111
112
 
112
113
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media img {
114
+ position: absolute;
113
115
  width: 100%;
114
116
  height: 100%;
115
117
  object-fit: cover;
@@ -1,11 +1,8 @@
1
1
  @charset "UTF-8";
2
- .wp-block-accordion-item {
3
- display: grid;
4
- grid-template-rows: max-content 0fr;
5
- }
6
- .wp-block-accordion-item.is-open {
7
- grid-template-rows: max-content 1fr;
2
+ .wp-block-accordion {
3
+ box-sizing: border-box;
8
4
  }
5
+
9
6
  .wp-block-accordion-item.is-open > .wp-block-accordion-heading .wp-block-accordion-heading__toggle-icon {
10
7
  transform: rotate(-45deg);
11
8
  }
@@ -21,11 +18,6 @@
21
18
  }
22
19
  }
23
20
 
24
- .wp-block-accordion-heading.wp-block-accordion-heading {
25
- min-width: 100%;
26
- margin: 0;
27
- }
28
-
29
21
  .wp-block-accordion-heading__toggle {
30
22
  font-family: inherit;
31
23
  font-size: inherit;
@@ -36,7 +28,9 @@
36
28
  text-decoration: inherit;
37
29
  word-spacing: inherit;
38
30
  font-style: inherit;
31
+ background: none;
39
32
  border: none;
33
+ color: inherit;
40
34
  padding: var(--wp--preset--spacing--20, 1em) 0;
41
35
  cursor: pointer;
42
36
  overflow: hidden;
@@ -44,24 +38,10 @@
44
38
  align-items: center;
45
39
  text-align: inherit;
46
40
  width: 100%;
47
- background-color: inherit !important;
48
- color: inherit !important;
49
41
  }
50
42
  .wp-block-accordion-heading__toggle:not(:focus-visible) {
51
43
  outline: none;
52
44
  }
53
- .wp-block-accordion-heading__toggle:hover, .wp-block-accordion-heading__toggle:focus {
54
- text-decoration: none;
55
- background-color: inherit !important;
56
- box-shadow: none;
57
- color: inherit;
58
- border: none;
59
- padding: var(--wp--preset--spacing--20, 1em) 0;
60
- }
61
- .wp-block-accordion-heading__toggle:focus-visible {
62
- outline: auto;
63
- outline-offset: 0;
64
- }
65
45
  .wp-block-accordion-heading__toggle:hover .wp-block-accordion-heading__toggle-title {
66
46
  text-decoration: underline;
67
47
  }
@@ -78,10 +58,7 @@
78
58
  justify-content: center;
79
59
  }
80
60
 
81
- .wp-block-accordion-panel.wp-block-accordion-panel {
82
- min-width: 100%;
83
- }
84
- .wp-block-accordion-panel.wp-block-accordion-panel[inert], .wp-block-accordion-panel.wp-block-accordion-panel[aria-hidden=true] {
61
+ .wp-block-accordion-panel[inert], .wp-block-accordion-panel[aria-hidden=true] {
85
62
  display: none;
86
63
  margin-block-start: 0;
87
64
  }
@@ -2297,6 +2274,7 @@ ul {
2297
2274
 
2298
2275
  /* Image fill for versions 8 and onwards */
2299
2276
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media {
2277
+ position: relative;
2300
2278
  height: 100%;
2301
2279
  min-height: 250px;
2302
2280
  }
@@ -2307,6 +2285,7 @@ ul {
2307
2285
  }
2308
2286
 
2309
2287
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media img {
2288
+ position: absolute;
2310
2289
  width: 100%;
2311
2290
  height: 100%;
2312
2291
  object-fit: cover;
@@ -1,11 +1,8 @@
1
1
  @charset "UTF-8";
2
- .wp-block-accordion-item {
3
- display: grid;
4
- grid-template-rows: max-content 0fr;
5
- }
6
- .wp-block-accordion-item.is-open {
7
- grid-template-rows: max-content 1fr;
2
+ .wp-block-accordion {
3
+ box-sizing: border-box;
8
4
  }
5
+
9
6
  .wp-block-accordion-item.is-open > .wp-block-accordion-heading .wp-block-accordion-heading__toggle-icon {
10
7
  transform: rotate(45deg);
11
8
  }
@@ -21,11 +18,6 @@
21
18
  }
22
19
  }
23
20
 
24
- .wp-block-accordion-heading.wp-block-accordion-heading {
25
- min-width: 100%;
26
- margin: 0;
27
- }
28
-
29
21
  .wp-block-accordion-heading__toggle {
30
22
  font-family: inherit;
31
23
  font-size: inherit;
@@ -36,7 +28,9 @@
36
28
  text-decoration: inherit;
37
29
  word-spacing: inherit;
38
30
  font-style: inherit;
31
+ background: none;
39
32
  border: none;
33
+ color: inherit;
40
34
  padding: var(--wp--preset--spacing--20, 1em) 0;
41
35
  cursor: pointer;
42
36
  overflow: hidden;
@@ -44,24 +38,10 @@
44
38
  align-items: center;
45
39
  text-align: inherit;
46
40
  width: 100%;
47
- background-color: inherit !important;
48
- color: inherit !important;
49
41
  }
50
42
  .wp-block-accordion-heading__toggle:not(:focus-visible) {
51
43
  outline: none;
52
44
  }
53
- .wp-block-accordion-heading__toggle:hover, .wp-block-accordion-heading__toggle:focus {
54
- text-decoration: none;
55
- background-color: inherit !important;
56
- box-shadow: none;
57
- color: inherit;
58
- border: none;
59
- padding: var(--wp--preset--spacing--20, 1em) 0;
60
- }
61
- .wp-block-accordion-heading__toggle:focus-visible {
62
- outline: auto;
63
- outline-offset: 0;
64
- }
65
45
  .wp-block-accordion-heading__toggle:hover .wp-block-accordion-heading__toggle-title {
66
46
  text-decoration: underline;
67
47
  }
@@ -78,10 +58,7 @@
78
58
  justify-content: center;
79
59
  }
80
60
 
81
- .wp-block-accordion-panel.wp-block-accordion-panel {
82
- min-width: 100%;
83
- }
84
- .wp-block-accordion-panel.wp-block-accordion-panel[inert], .wp-block-accordion-panel.wp-block-accordion-panel[aria-hidden=true] {
61
+ .wp-block-accordion-panel[inert], .wp-block-accordion-panel[aria-hidden=true] {
85
62
  display: none;
86
63
  margin-block-start: 0;
87
64
  }
@@ -2327,6 +2304,7 @@ ul {
2327
2304
 
2328
2305
  /* Image fill for versions 8 and onwards */
2329
2306
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media {
2307
+ position: relative;
2330
2308
  height: 100%;
2331
2309
  min-height: 250px;
2332
2310
  }
@@ -2337,6 +2315,7 @@ ul {
2337
2315
  }
2338
2316
 
2339
2317
  .wp-block-media-text.is-image-fill-element > .wp-block-media-text__media img {
2318
+ position: absolute;
2340
2319
  width: 100%;
2341
2320
  height: 100%;
2342
2321
  object-fit: cover;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.33.8",
3
+ "version": "9.33.10",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -86,11 +86,11 @@
86
86
  "@wordpress/autop": "^4.33.1",
87
87
  "@wordpress/base-styles": "^6.9.1",
88
88
  "@wordpress/blob": "^4.33.1",
89
- "@wordpress/block-editor": "^15.6.7",
90
- "@wordpress/blocks": "^15.6.2",
91
- "@wordpress/components": "^30.6.4",
89
+ "@wordpress/block-editor": "^15.6.9",
90
+ "@wordpress/blocks": "^15.6.3",
91
+ "@wordpress/components": "^30.6.5",
92
92
  "@wordpress/compose": "^7.33.1",
93
- "@wordpress/core-data": "^7.33.7",
93
+ "@wordpress/core-data": "^7.33.9",
94
94
  "@wordpress/data": "^10.33.1",
95
95
  "@wordpress/date": "^5.33.1",
96
96
  "@wordpress/deprecated": "^4.33.1",
@@ -101,18 +101,18 @@
101
101
  "@wordpress/html-entities": "^4.33.1",
102
102
  "@wordpress/i18n": "^6.6.1",
103
103
  "@wordpress/icons": "^11.0.1",
104
- "@wordpress/interactivity": "^6.33.1",
105
- "@wordpress/interactivity-router": "^2.33.1",
104
+ "@wordpress/interactivity": "^6.33.3",
105
+ "@wordpress/interactivity-router": "^2.33.3",
106
106
  "@wordpress/keyboard-shortcuts": "^5.33.1",
107
107
  "@wordpress/keycodes": "^4.33.1",
108
108
  "@wordpress/latex-to-mathml": "^1.1.2",
109
109
  "@wordpress/notices": "^5.33.1",
110
- "@wordpress/patterns": "^2.33.7",
110
+ "@wordpress/patterns": "^2.33.9",
111
111
  "@wordpress/primitives": "^4.33.1",
112
112
  "@wordpress/private-apis": "^1.33.1",
113
- "@wordpress/reusable-blocks": "^5.33.7",
113
+ "@wordpress/reusable-blocks": "^5.33.9",
114
114
  "@wordpress/rich-text": "^7.33.2",
115
- "@wordpress/server-side-render": "^6.9.4",
115
+ "@wordpress/server-side-render": "^6.9.5",
116
116
  "@wordpress/url": "^4.33.1",
117
117
  "@wordpress/viewport": "^6.33.1",
118
118
  "@wordpress/wordcount": "^4.33.1",
@@ -133,5 +133,5 @@
133
133
  "publishConfig": {
134
134
  "access": "public"
135
135
  },
136
- "gitHead": "1c473d047a0b8f529f07cc1e23324a6be723bbc9"
136
+ "gitHead": "ece3841462592f9e9b99cfa7cac0fe98bdce8fd7"
137
137
  }
@@ -0,0 +1,4 @@
1
+ .wp-block-accordion {
2
+ // This block has customizable padding, border-box makes that more predictable.
3
+ box-sizing: border-box;
4
+ }
@@ -3,7 +3,11 @@
3
3
  */
4
4
  import { store, getContext, withSyncEvent } from '@wordpress/interactivity';
5
5
 
6
- store(
6
+ // Whether the hash has been handled for the current page load.
7
+ // This is used to prevent the hash from being handled multiple times.
8
+ let hashHandled = false;
9
+
10
+ const { actions } = store(
7
11
  'core/accordion',
8
12
  {
9
13
  state: {
@@ -75,15 +79,68 @@ store(
75
79
  nextButton.focus();
76
80
  }
77
81
  } ),
82
+ openPanelByHash: () => {
83
+ if ( hashHandled || ! window.location?.hash?.length ) {
84
+ return;
85
+ }
86
+
87
+ const context = getContext();
88
+ const { id, accordionItems, autoclose } = context;
89
+ const hash = decodeURIComponent(
90
+ window.location.hash.slice( 1 )
91
+ );
92
+ const targetElement = window.document.getElementById( hash );
93
+
94
+ if ( ! targetElement ) {
95
+ return;
96
+ }
97
+
98
+ const panelElement = window.document.querySelector(
99
+ '.wp-block-accordion-panel[aria-labelledby="' + id + '"]'
100
+ );
101
+
102
+ if (
103
+ ! panelElement ||
104
+ ! panelElement.contains( targetElement )
105
+ ) {
106
+ return;
107
+ }
108
+
109
+ hashHandled = true;
110
+
111
+ if ( autoclose ) {
112
+ accordionItems.forEach( ( item ) => {
113
+ item.isOpen = item.id === id;
114
+ } );
115
+ } else {
116
+ const targetItem = accordionItems.find(
117
+ ( item ) => item.id === id
118
+ );
119
+
120
+ if ( targetItem ) {
121
+ targetItem.isOpen = true;
122
+ }
123
+ }
124
+
125
+ // Wait for the panel to be opened before scrolling to it.
126
+ window.setTimeout( () => {
127
+ targetElement.scrollIntoView();
128
+ }, 0 );
129
+ },
78
130
  },
79
131
  callbacks: {
80
132
  initAccordionItems: () => {
81
133
  const context = getContext();
82
- const { id, openByDefault } = context;
83
- context.accordionItems.push( {
134
+ const { id, openByDefault, accordionItems } = context;
135
+ accordionItems.push( {
84
136
  id,
85
137
  isOpen: openByDefault,
86
138
  } );
139
+ actions.openPanelByHash();
140
+ },
141
+ hashChange: () => {
142
+ hashHandled = false;
143
+ actions.openPanelByHash();
87
144
  },
88
145
  },
89
146
  },
@@ -57,7 +57,7 @@
57
57
  }
58
58
  },
59
59
  "shadow": true,
60
- "blockVisibility": false,
60
+ "visibility": false,
61
61
  "lock": false
62
62
  },
63
63
  "selectors": {
@@ -5,6 +5,7 @@ import {
5
5
  useBlockProps,
6
6
  __experimentalGetSpacingClassesAndStyles as getSpacingClassesAndStyles,
7
7
  RichText,
8
+ getTypographyClassesAndStyles,
8
9
  } from '@wordpress/block-editor';
9
10
 
10
11
  const v1 = {
@@ -74,7 +75,7 @@ const v1 = {
74
75
  },
75
76
  },
76
77
  shadow: true,
77
- blockVisibility: false,
78
+ visibility: false,
78
79
  },
79
80
  save( { attributes } ) {
80
81
  const { level, title, iconPosition, showIcon } = attributes;
@@ -116,4 +117,124 @@ const v1 = {
116
117
  },
117
118
  };
118
119
 
119
- export default [ v1 ];
120
+ const v2 = {
121
+ attributes: {
122
+ openByDefault: {
123
+ type: 'boolean',
124
+ default: false,
125
+ },
126
+ title: {
127
+ type: 'rich-text',
128
+ source: 'rich-text',
129
+ selector: '.wp-block-accordion-heading__toggle-title',
130
+ role: 'content',
131
+ },
132
+ level: {
133
+ type: 'number',
134
+ },
135
+ iconPosition: {
136
+ type: 'string',
137
+ enum: [ 'left', 'right' ],
138
+ default: 'right',
139
+ },
140
+ showIcon: {
141
+ type: 'boolean',
142
+ default: true,
143
+ },
144
+ },
145
+ supports: {
146
+ anchor: true,
147
+ color: {
148
+ background: true,
149
+ gradients: true,
150
+ },
151
+ align: false,
152
+ interactivity: true,
153
+ spacing: {
154
+ padding: true,
155
+ __experimentalDefaultControls: {
156
+ padding: true,
157
+ },
158
+ __experimentalSkipSerialization: true,
159
+ __experimentalSelector: '.wp-block-accordion-heading__toggle',
160
+ },
161
+ __experimentalBorder: {
162
+ color: true,
163
+ radius: true,
164
+ style: true,
165
+ width: true,
166
+ __experimentalDefaultControls: {
167
+ color: true,
168
+ radius: true,
169
+ style: true,
170
+ width: true,
171
+ },
172
+ },
173
+ typography: {
174
+ __experimentalSkipSerialization: [
175
+ 'textDecoration',
176
+ 'letterSpacing',
177
+ ],
178
+ fontSize: true,
179
+ __experimentalFontFamily: true,
180
+ __experimentalFontWeight: true,
181
+ __experimentalFontStyle: true,
182
+ __experimentalTextTransform: true,
183
+ __experimentalTextDecoration: true,
184
+ __experimentalLetterSpacing: true,
185
+ __experimentalDefaultControls: {
186
+ fontSize: true,
187
+ fontFamily: true,
188
+ },
189
+ },
190
+ shadow: true,
191
+ visibility: false,
192
+ lock: false,
193
+ },
194
+ save( { attributes } ) {
195
+ const { level, title, iconPosition, showIcon } = attributes;
196
+ const TagName = 'h' + ( level || 3 );
197
+ const typographyProps = getTypographyClassesAndStyles( attributes );
198
+
199
+ const blockProps = useBlockProps.save();
200
+ const spacingProps = getSpacingClassesAndStyles( attributes );
201
+
202
+ return (
203
+ <TagName { ...blockProps }>
204
+ <button
205
+ className="wp-block-accordion-heading__toggle"
206
+ style={ spacingProps.style }
207
+ >
208
+ { showIcon && iconPosition === 'left' && (
209
+ <span
210
+ className="wp-block-accordion-heading__toggle-icon"
211
+ aria-hidden="true"
212
+ >
213
+ +
214
+ </span>
215
+ ) }
216
+ <RichText.Content
217
+ className="wp-block-accordion-heading__toggle-title"
218
+ tagName="span"
219
+ value={ title }
220
+ style={ {
221
+ letterSpacing: typographyProps.style.letterSpacing,
222
+ textDecoration:
223
+ typographyProps.style.textDecoration,
224
+ } }
225
+ />
226
+ { showIcon && iconPosition === 'right' && (
227
+ <span
228
+ className="wp-block-accordion-heading__toggle-icon"
229
+ aria-hidden="true"
230
+ >
231
+ +
232
+ </span>
233
+ ) }
234
+ </button>
235
+ </TagName>
236
+ );
237
+ },
238
+ };
239
+
240
+ export default [ v1, v2 ];