@wordpress/block-library 9.40.2-next.v.202602241322.0 → 9.41.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.
- package/CHANGELOG.md +2 -0
- package/build/accordion/view.cjs +0 -34
- package/build/accordion/view.cjs.map +2 -2
- package/build/button/block.json +11 -3
- package/build/button/deprecated.cjs +246 -13
- package/build/button/deprecated.cjs.map +2 -2
- package/build/button/edit.cjs +45 -58
- package/build/button/edit.cjs.map +3 -3
- package/build/button/save.cjs +3 -7
- package/build/button/save.cjs.map +2 -2
- package/build/button/utils.cjs +59 -0
- package/build/button/utils.cjs.map +7 -0
- package/build/image/image.cjs +1 -1
- package/build/image/image.cjs.map +2 -2
- package/build/navigation/edit/index.cjs +4 -2
- package/build/navigation/edit/index.cjs.map +3 -3
- package/build/navigation/edit/leaf-more-menu.cjs +68 -6
- package/build/navigation/edit/leaf-more-menu.cjs.map +3 -3
- package/build/navigation/edit/menu-inspector-controls.cjs +20 -91
- package/build/navigation/edit/menu-inspector-controls.cjs.map +3 -3
- package/build/navigation/edit/navigation-link-ui.cjs +97 -0
- package/build/navigation/edit/navigation-link-ui.cjs.map +7 -0
- package/build/navigation/edit/navigation-list-view-header.cjs +86 -0
- package/build/navigation/edit/navigation-list-view-header.cjs.map +7 -0
- package/build/navigation/edit/navigation-menu-selector.cjs +4 -2
- package/build/navigation/edit/navigation-menu-selector.cjs.map +3 -3
- package/build/navigation/edit/placeholder/index.cjs +2 -2
- package/build/navigation/edit/placeholder/index.cjs.map +3 -3
- package/build/navigation-link/shared/controls.cjs +29 -52
- package/build/navigation-link/shared/controls.cjs.map +3 -3
- package/build/navigation-link/shared/use-link-preview.cjs +8 -9
- package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
- package/build/page-list-item/edit.cjs +6 -3
- package/build/page-list-item/edit.cjs.map +2 -2
- package/build/playlist/edit.cjs +43 -136
- package/build/playlist/edit.cjs.map +3 -3
- package/build/playlist/view.cjs +56 -38
- package/build/playlist/view.cjs.map +2 -2
- package/build/playlist-track/edit.cjs +0 -1
- package/build/playlist-track/edit.cjs.map +2 -2
- package/build/post-title/block.json +3 -0
- package/build/post-title/edit.cjs +2 -2
- package/build/post-title/edit.cjs.map +2 -2
- package/build/utils/waveform-player.cjs +68 -0
- package/build/utils/waveform-player.cjs.map +7 -0
- package/build/utils/waveform-utils.cjs +171 -0
- package/build/utils/waveform-utils.cjs.map +7 -0
- package/build-module/accordion/view.mjs +1 -35
- package/build-module/accordion/view.mjs.map +2 -2
- package/build-module/button/block.json +11 -3
- package/build-module/button/deprecated.mjs +246 -13
- package/build-module/button/deprecated.mjs.map +2 -2
- package/build-module/button/edit.mjs +47 -63
- package/build-module/button/edit.mjs.map +2 -2
- package/build-module/button/save.mjs +3 -7
- package/build-module/button/save.mjs.map +2 -2
- package/build-module/button/utils.mjs +33 -0
- package/build-module/button/utils.mjs.map +7 -0
- package/build-module/image/image.mjs +1 -1
- package/build-module/image/image.mjs.map +2 -2
- package/build-module/navigation/edit/index.mjs +4 -2
- package/build-module/navigation/edit/index.mjs.map +2 -2
- package/build-module/navigation/edit/leaf-more-menu.mjs +73 -7
- package/build-module/navigation/edit/leaf-more-menu.mjs.map +2 -2
- package/build-module/navigation/edit/menu-inspector-controls.mjs +21 -101
- package/build-module/navigation/edit/menu-inspector-controls.mjs.map +2 -2
- package/build-module/navigation/edit/navigation-link-ui.mjs +76 -0
- package/build-module/navigation/edit/navigation-link-ui.mjs.map +7 -0
- package/build-module/navigation/edit/navigation-list-view-header.mjs +58 -0
- package/build-module/navigation/edit/navigation-list-view-header.mjs.map +7 -0
- package/build-module/navigation/edit/navigation-menu-selector.mjs +5 -3
- package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
- package/build-module/navigation/edit/placeholder/index.mjs +2 -2
- package/build-module/navigation/edit/placeholder/index.mjs.map +2 -2
- package/build-module/navigation-link/shared/controls.mjs +29 -53
- package/build-module/navigation-link/shared/controls.mjs.map +2 -2
- package/build-module/navigation-link/shared/use-link-preview.mjs +8 -9
- package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
- package/build-module/page-list-item/edit.mjs +6 -3
- package/build-module/page-list-item/edit.mjs.map +2 -2
- package/build-module/playlist/edit.mjs +41 -139
- package/build-module/playlist/edit.mjs.map +2 -2
- package/build-module/playlist/view.mjs +56 -38
- package/build-module/playlist/view.mjs.map +2 -2
- package/build-module/playlist-track/edit.mjs +0 -1
- package/build-module/playlist-track/edit.mjs.map +2 -2
- package/build-module/post-title/block.json +3 -0
- package/build-module/post-title/edit.mjs +2 -2
- package/build-module/post-title/edit.mjs.map +2 -2
- package/build-module/utils/waveform-player.mjs +43 -0
- package/build-module/utils/waveform-player.mjs.map +7 -0
- package/build-module/utils/waveform-utils.mjs +131 -0
- package/build-module/utils/waveform-utils.mjs.map +7 -0
- package/build-style/button/style-rtl.css +6 -0
- package/build-style/button/style.css +6 -0
- package/build-style/editor-rtl.css +13 -3
- package/build-style/editor.css +13 -3
- package/build-style/navigation-link/editor-rtl.css +10 -0
- package/build-style/navigation-link/editor.css +10 -0
- package/build-style/playlist/editor-rtl.css +3 -3
- package/build-style/playlist/editor.css +3 -3
- package/build-style/playlist/style-rtl.css +351 -17
- package/build-style/playlist/style.css +351 -17
- package/build-style/style-rtl.css +357 -17
- package/build-style/style.css +357 -17
- package/package.json +39 -38
- package/src/accordion/view.js +1 -44
- package/src/accordion-item/index.php +0 -1
- package/src/button/block.json +11 -3
- package/src/button/deprecated.js +254 -16
- package/src/button/edit.js +50 -61
- package/src/button/index.php +68 -0
- package/src/button/save.js +2 -8
- package/src/button/style.scss +49 -7
- package/src/button/test/utils.js +84 -0
- package/src/button/utils.js +42 -0
- package/src/cover/index.php +4 -4
- package/src/image/image.js +14 -15
- package/src/image/index.php +3 -1
- package/src/navigation/edit/index.js +4 -2
- package/src/navigation/edit/leaf-more-menu.js +86 -11
- package/src/navigation/edit/menu-inspector-controls.js +23 -142
- package/src/navigation/edit/navigation-link-ui.js +115 -0
- package/src/navigation/edit/navigation-list-view-header.js +62 -0
- package/src/navigation/edit/navigation-menu-selector.js +5 -3
- package/src/navigation/edit/placeholder/index.js +3 -2
- package/src/navigation/edit/test/navigation-menu-selector.js +23 -20
- package/src/navigation-link/editor.scss +18 -0
- package/src/navigation-link/shared/controls.js +35 -62
- package/src/navigation-link/shared/test/controls.js +5 -5
- package/src/navigation-link/shared/test/use-link-preview.test.js +19 -1
- package/src/navigation-link/shared/use-link-preview.js +14 -15
- package/src/page-list/index.php +1 -1
- package/src/page-list-item/edit.js +8 -7
- package/src/playlist/edit.js +60 -154
- package/src/playlist/editor.scss +3 -3
- package/src/playlist/index.php +15 -40
- package/src/playlist/style.scss +34 -27
- package/src/playlist/test/edit.js +137 -0
- package/src/playlist/view.js +97 -40
- package/src/playlist-track/edit.js +0 -1
- package/src/post-title/block.json +3 -0
- package/src/post-title/edit.js +4 -2
- package/src/query-title/index.php +1 -1
- package/src/search/index.php +1 -1
- package/src/utils/test/waveform-utils.js +328 -0
- package/src/utils/waveform-player.js +77 -0
- package/src/utils/waveform-utils.js +232 -0
- package/build/navigation/use-navigation-entities.cjs +0 -67
- package/build/navigation/use-navigation-entities.cjs.map +0 -7
- package/build-module/navigation/use-navigation-entities.mjs +0 -46
- package/build-module/navigation/use-navigation-entities.mjs.map +0 -7
- package/src/navigation/use-navigation-entities.js +0 -72
package/CHANGELOG.md
CHANGED
package/build/accordion/view.cjs
CHANGED
|
@@ -30,40 +30,6 @@ var { actions } = (0, import_interactivity.store)(
|
|
|
30
30
|
accordionItem.isOpen = !accordionItem.isOpen;
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
handleKeyDown: (0, import_interactivity.withSyncEvent)((event) => {
|
|
34
|
-
if (event.key !== "ArrowUp" && event.key !== "ArrowDown" && event.key !== "Home" && event.key !== "End") {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
const context = (0, import_interactivity.getContext)();
|
|
39
|
-
const { id, accordionItems } = context;
|
|
40
|
-
const currentIndex = accordionItems.findIndex(
|
|
41
|
-
(item) => item.id === id
|
|
42
|
-
);
|
|
43
|
-
let nextIndex;
|
|
44
|
-
switch (event.key) {
|
|
45
|
-
case "ArrowUp":
|
|
46
|
-
nextIndex = Math.max(0, currentIndex - 1);
|
|
47
|
-
break;
|
|
48
|
-
case "ArrowDown":
|
|
49
|
-
nextIndex = Math.min(
|
|
50
|
-
currentIndex + 1,
|
|
51
|
-
accordionItems.length - 1
|
|
52
|
-
);
|
|
53
|
-
break;
|
|
54
|
-
case "Home":
|
|
55
|
-
nextIndex = 0;
|
|
56
|
-
break;
|
|
57
|
-
case "End":
|
|
58
|
-
nextIndex = accordionItems.length - 1;
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
const nextId = accordionItems[nextIndex].id;
|
|
62
|
-
const nextButton = document.getElementById(nextId);
|
|
63
|
-
if (nextButton) {
|
|
64
|
-
nextButton.focus();
|
|
65
|
-
}
|
|
66
|
-
}),
|
|
67
33
|
openPanelByHash: () => {
|
|
68
34
|
if (hashHandled || !window.location?.hash?.length) {
|
|
69
35
|
return;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/accordion/view.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store, getContext
|
|
5
|
-
"mappings": ";;;AAGA,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store, getContext } from '@wordpress/interactivity';\n\n// Whether the hash has been handled for the current page load.\n// This is used to prevent the hash from being handled multiple times.\nlet hashHandled = false;\n\nconst { actions } = store(\n\t'core/accordion',\n\t{\n\t\tstate: {\n\t\t\tget isOpen() {\n\t\t\t\tconst { id, accordionItems } = getContext();\n\t\t\t\tconst accordionItem = accordionItems.find(\n\t\t\t\t\t( item ) => item.id === id\n\t\t\t\t);\n\t\t\t\treturn accordionItem ? accordionItem.isOpen : false;\n\t\t\t},\n\t\t},\n\t\tactions: {\n\t\t\ttoggle: () => {\n\t\t\t\tconst context = getContext();\n\t\t\t\tconst { id, autoclose, accordionItems } = context;\n\t\t\t\tconst accordionItem = accordionItems.find(\n\t\t\t\t\t( item ) => item.id === id\n\t\t\t\t);\n\n\t\t\t\tif ( autoclose ) {\n\t\t\t\t\taccordionItems.forEach( ( item ) => {\n\t\t\t\t\t\titem.isOpen =\n\t\t\t\t\t\t\titem.id === id ? ! accordionItem.isOpen : false;\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\taccordionItem.isOpen = ! accordionItem.isOpen;\n\t\t\t\t}\n\t\t\t},\n\t\t\topenPanelByHash: () => {\n\t\t\t\tif ( hashHandled || ! window.location?.hash?.length ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst context = getContext();\n\t\t\t\tconst { id, accordionItems, autoclose } = context;\n\t\t\t\tconst hash = decodeURIComponent(\n\t\t\t\t\twindow.location.hash.slice( 1 )\n\t\t\t\t);\n\t\t\t\tconst targetElement = window.document.getElementById( hash );\n\n\t\t\t\tif ( ! targetElement ) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst panelElement = window.document.querySelector(\n\t\t\t\t\t'.wp-block-accordion-panel[aria-labelledby=\"' + id + '\"]'\n\t\t\t\t);\n\n\t\t\t\tif (\n\t\t\t\t\t! panelElement ||\n\t\t\t\t\t! panelElement.contains( targetElement )\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\thashHandled = true;\n\n\t\t\t\tif ( autoclose ) {\n\t\t\t\t\taccordionItems.forEach( ( item ) => {\n\t\t\t\t\t\titem.isOpen = item.id === id;\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tconst targetItem = accordionItems.find(\n\t\t\t\t\t\t( item ) => item.id === id\n\t\t\t\t\t);\n\n\t\t\t\t\tif ( targetItem ) {\n\t\t\t\t\t\ttargetItem.isOpen = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Wait for the panel to be opened before scrolling to it.\n\t\t\t\twindow.setTimeout( () => {\n\t\t\t\t\ttargetElement.scrollIntoView();\n\t\t\t\t}, 0 );\n\t\t\t},\n\t\t},\n\t\tcallbacks: {\n\t\t\tinitAccordionItems: () => {\n\t\t\t\tconst context = getContext();\n\t\t\t\tconst { id, openByDefault, accordionItems } = context;\n\t\t\t\taccordionItems.push( {\n\t\t\t\t\tid,\n\t\t\t\t\tisOpen: openByDefault,\n\t\t\t\t} );\n\t\t\t\tactions.openPanelByHash();\n\t\t\t},\n\t\t\thashChange: () => {\n\t\t\t\thashHandled = false;\n\t\t\t\tactions.openPanelByHash();\n\t\t\t},\n\t\t},\n\t},\n\t{ lock: true }\n);\n"],
|
|
5
|
+
"mappings": ";;;AAGA,2BAAkC;AAIlC,IAAI,cAAc;AAElB,IAAM,EAAE,QAAQ,QAAI;AAAA,EACnB;AAAA,EACA;AAAA,IACC,OAAO;AAAA,MACN,IAAI,SAAS;AACZ,cAAM,EAAE,IAAI,eAAe,QAAI,iCAAW;AAC1C,cAAM,gBAAgB,eAAe;AAAA,UACpC,CAAE,SAAU,KAAK,OAAO;AAAA,QACzB;AACA,eAAO,gBAAgB,cAAc,SAAS;AAAA,MAC/C;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR,QAAQ,MAAM;AACb,cAAM,cAAU,iCAAW;AAC3B,cAAM,EAAE,IAAI,WAAW,eAAe,IAAI;AAC1C,cAAM,gBAAgB,eAAe;AAAA,UACpC,CAAE,SAAU,KAAK,OAAO;AAAA,QACzB;AAEA,YAAK,WAAY;AAChB,yBAAe,QAAS,CAAE,SAAU;AACnC,iBAAK,SACJ,KAAK,OAAO,KAAK,CAAE,cAAc,SAAS;AAAA,UAC5C,CAAE;AAAA,QACH,OAAO;AACN,wBAAc,SAAS,CAAE,cAAc;AAAA,QACxC;AAAA,MACD;AAAA,MACA,iBAAiB,MAAM;AACtB,YAAK,eAAe,CAAE,OAAO,UAAU,MAAM,QAAS;AACrD;AAAA,QACD;AAEA,cAAM,cAAU,iCAAW;AAC3B,cAAM,EAAE,IAAI,gBAAgB,UAAU,IAAI;AAC1C,cAAM,OAAO;AAAA,UACZ,OAAO,SAAS,KAAK,MAAO,CAAE;AAAA,QAC/B;AACA,cAAM,gBAAgB,OAAO,SAAS,eAAgB,IAAK;AAE3D,YAAK,CAAE,eAAgB;AACtB;AAAA,QACD;AAEA,cAAM,eAAe,OAAO,SAAS;AAAA,UACpC,gDAAgD,KAAK;AAAA,QACtD;AAEA,YACC,CAAE,gBACF,CAAE,aAAa,SAAU,aAAc,GACtC;AACD;AAAA,QACD;AAEA,sBAAc;AAEd,YAAK,WAAY;AAChB,yBAAe,QAAS,CAAE,SAAU;AACnC,iBAAK,SAAS,KAAK,OAAO;AAAA,UAC3B,CAAE;AAAA,QACH,OAAO;AACN,gBAAM,aAAa,eAAe;AAAA,YACjC,CAAE,SAAU,KAAK,OAAO;AAAA,UACzB;AAEA,cAAK,YAAa;AACjB,uBAAW,SAAS;AAAA,UACrB;AAAA,QACD;AAGA,eAAO,WAAY,MAAM;AACxB,wBAAc,eAAe;AAAA,QAC9B,GAAG,CAAE;AAAA,MACN;AAAA,IACD;AAAA,IACA,WAAW;AAAA,MACV,oBAAoB,MAAM;AACzB,cAAM,cAAU,iCAAW;AAC3B,cAAM,EAAE,IAAI,eAAe,eAAe,IAAI;AAC9C,uBAAe,KAAM;AAAA,UACpB;AAAA,UACA,QAAQ;AAAA,QACT,CAAE;AACF,gBAAQ,gBAAgB;AAAA,MACzB;AAAA,MACA,YAAY,MAAM;AACjB,sBAAc;AACd,gBAAQ,gBAAgB;AAAA,MACzB;AAAA,IACD;AAAA,EACD;AAAA,EACA,EAAE,MAAM,KAAK;AACd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build/button/block.json
CHANGED
|
@@ -63,9 +63,6 @@
|
|
|
63
63
|
},
|
|
64
64
|
"gradient": {
|
|
65
65
|
"type": "string"
|
|
66
|
-
},
|
|
67
|
-
"width": {
|
|
68
|
-
"type": "number"
|
|
69
66
|
}
|
|
70
67
|
},
|
|
71
68
|
"supports": {
|
|
@@ -81,6 +78,13 @@
|
|
|
81
78
|
"text": true
|
|
82
79
|
}
|
|
83
80
|
},
|
|
81
|
+
"dimensions": {
|
|
82
|
+
"width": true,
|
|
83
|
+
"__experimentalSkipSerialization": [ "width" ],
|
|
84
|
+
"__experimentalDefaultControls": {
|
|
85
|
+
"width": true
|
|
86
|
+
}
|
|
87
|
+
},
|
|
84
88
|
"typography": {
|
|
85
89
|
"__experimentalSkipSerialization": [
|
|
86
90
|
"fontSize",
|
|
@@ -145,6 +149,10 @@
|
|
|
145
149
|
"root": ".wp-block-button .wp-block-button__link",
|
|
146
150
|
"typography": {
|
|
147
151
|
"writingMode": ".wp-block-button"
|
|
152
|
+
},
|
|
153
|
+
"dimensions": {
|
|
154
|
+
"root": ".wp-block-button",
|
|
155
|
+
"width": ".wp-block-button"
|
|
148
156
|
}
|
|
149
157
|
}
|
|
150
158
|
}
|
|
@@ -39,6 +39,22 @@ var import_compose = require("@wordpress/compose");
|
|
|
39
39
|
var import_migrate_font_family = __toESM(require("../utils/migrate-font-family.cjs"));
|
|
40
40
|
var import_migrate_text_align = __toESM(require("../utils/migrate-text-align.cjs"));
|
|
41
41
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
|
+
var migrateWidth = (attributes) => {
|
|
43
|
+
const { width, ...otherAttributes } = attributes;
|
|
44
|
+
if (!width) {
|
|
45
|
+
return otherAttributes;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
...otherAttributes,
|
|
49
|
+
style: {
|
|
50
|
+
...otherAttributes.style,
|
|
51
|
+
dimensions: {
|
|
52
|
+
...otherAttributes.style?.dimensions,
|
|
53
|
+
width: `${width}%`
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
42
58
|
var migrateBorderRadius = (attributes) => {
|
|
43
59
|
const { borderRadius, ...newAttributes } = attributes;
|
|
44
60
|
const oldBorderRadius = [
|
|
@@ -126,6 +142,205 @@ var blockAttributes = {
|
|
|
126
142
|
selector: "a"
|
|
127
143
|
}
|
|
128
144
|
};
|
|
145
|
+
var v14 = {
|
|
146
|
+
attributes: {
|
|
147
|
+
tagName: {
|
|
148
|
+
type: "string",
|
|
149
|
+
enum: ["a", "button"],
|
|
150
|
+
default: "a"
|
|
151
|
+
},
|
|
152
|
+
type: {
|
|
153
|
+
type: "string",
|
|
154
|
+
default: "button"
|
|
155
|
+
},
|
|
156
|
+
url: {
|
|
157
|
+
type: "string",
|
|
158
|
+
source: "attribute",
|
|
159
|
+
selector: "a",
|
|
160
|
+
attribute: "href",
|
|
161
|
+
role: "content"
|
|
162
|
+
},
|
|
163
|
+
title: {
|
|
164
|
+
type: "string",
|
|
165
|
+
source: "attribute",
|
|
166
|
+
selector: "a,button",
|
|
167
|
+
attribute: "title",
|
|
168
|
+
role: "content"
|
|
169
|
+
},
|
|
170
|
+
text: {
|
|
171
|
+
type: "rich-text",
|
|
172
|
+
source: "rich-text",
|
|
173
|
+
selector: "a,button",
|
|
174
|
+
role: "content"
|
|
175
|
+
},
|
|
176
|
+
linkTarget: {
|
|
177
|
+
type: "string",
|
|
178
|
+
source: "attribute",
|
|
179
|
+
selector: "a",
|
|
180
|
+
attribute: "target",
|
|
181
|
+
role: "content"
|
|
182
|
+
},
|
|
183
|
+
rel: {
|
|
184
|
+
type: "string",
|
|
185
|
+
source: "attribute",
|
|
186
|
+
selector: "a",
|
|
187
|
+
attribute: "rel",
|
|
188
|
+
role: "content"
|
|
189
|
+
},
|
|
190
|
+
placeholder: {
|
|
191
|
+
type: "string"
|
|
192
|
+
},
|
|
193
|
+
backgroundColor: {
|
|
194
|
+
type: "string"
|
|
195
|
+
},
|
|
196
|
+
textColor: {
|
|
197
|
+
type: "string"
|
|
198
|
+
},
|
|
199
|
+
gradient: {
|
|
200
|
+
type: "string"
|
|
201
|
+
},
|
|
202
|
+
width: {
|
|
203
|
+
type: "number"
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
supports: {
|
|
207
|
+
anchor: true,
|
|
208
|
+
splitting: true,
|
|
209
|
+
align: false,
|
|
210
|
+
alignWide: false,
|
|
211
|
+
color: {
|
|
212
|
+
__experimentalSkipSerialization: true,
|
|
213
|
+
gradients: true,
|
|
214
|
+
__experimentalDefaultControls: {
|
|
215
|
+
background: true,
|
|
216
|
+
text: true
|
|
217
|
+
}
|
|
218
|
+
},
|
|
219
|
+
typography: {
|
|
220
|
+
__experimentalSkipSerialization: [
|
|
221
|
+
"fontSize",
|
|
222
|
+
"lineHeight",
|
|
223
|
+
"textAlign",
|
|
224
|
+
"fontFamily",
|
|
225
|
+
"fontWeight",
|
|
226
|
+
"fontStyle",
|
|
227
|
+
"textTransform",
|
|
228
|
+
"textDecoration",
|
|
229
|
+
"letterSpacing"
|
|
230
|
+
],
|
|
231
|
+
fontSize: true,
|
|
232
|
+
lineHeight: true,
|
|
233
|
+
textAlign: true,
|
|
234
|
+
__experimentalFontFamily: true,
|
|
235
|
+
__experimentalFontWeight: true,
|
|
236
|
+
__experimentalFontStyle: true,
|
|
237
|
+
__experimentalTextTransform: true,
|
|
238
|
+
__experimentalTextDecoration: true,
|
|
239
|
+
__experimentalLetterSpacing: true,
|
|
240
|
+
__experimentalWritingMode: true,
|
|
241
|
+
__experimentalDefaultControls: {
|
|
242
|
+
fontSize: true
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
reusable: false,
|
|
246
|
+
shadow: {
|
|
247
|
+
__experimentalSkipSerialization: true
|
|
248
|
+
},
|
|
249
|
+
spacing: {
|
|
250
|
+
__experimentalSkipSerialization: true,
|
|
251
|
+
padding: ["horizontal", "vertical"],
|
|
252
|
+
__experimentalDefaultControls: {
|
|
253
|
+
padding: true
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
__experimentalBorder: {
|
|
257
|
+
color: true,
|
|
258
|
+
radius: true,
|
|
259
|
+
style: true,
|
|
260
|
+
width: true,
|
|
261
|
+
__experimentalSkipSerialization: true,
|
|
262
|
+
__experimentalDefaultControls: {
|
|
263
|
+
color: true,
|
|
264
|
+
radius: true,
|
|
265
|
+
style: true,
|
|
266
|
+
width: true
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
interactivity: {
|
|
270
|
+
clientNavigation: true
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
selectors: {
|
|
274
|
+
root: ".wp-block-button .wp-block-button__link",
|
|
275
|
+
typography: {
|
|
276
|
+
writingMode: ".wp-block-button"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
save({ attributes, className }) {
|
|
280
|
+
const {
|
|
281
|
+
tagName,
|
|
282
|
+
type,
|
|
283
|
+
fontSize,
|
|
284
|
+
linkTarget,
|
|
285
|
+
rel,
|
|
286
|
+
style,
|
|
287
|
+
text,
|
|
288
|
+
title,
|
|
289
|
+
url,
|
|
290
|
+
width
|
|
291
|
+
} = attributes;
|
|
292
|
+
const TagName = tagName || "a";
|
|
293
|
+
const isButtonTag = "button" === TagName;
|
|
294
|
+
const buttonType = type || "button";
|
|
295
|
+
const borderProps = (0, import_block_editor.__experimentalGetBorderClassesAndStyles)(attributes);
|
|
296
|
+
const colorProps = (0, import_block_editor.__experimentalGetColorClassesAndStyles)(attributes);
|
|
297
|
+
const spacingProps = (0, import_block_editor.__experimentalGetSpacingClassesAndStyles)(attributes);
|
|
298
|
+
const shadowProps = (0, import_block_editor.__experimentalGetShadowClassesAndStyles)(attributes);
|
|
299
|
+
const typographyProps = (0, import_block_editor.getTypographyClassesAndStyles)(attributes);
|
|
300
|
+
const buttonClasses = (0, import_clsx.default)(
|
|
301
|
+
"wp-block-button__link",
|
|
302
|
+
colorProps.className,
|
|
303
|
+
borderProps.className,
|
|
304
|
+
typographyProps.className,
|
|
305
|
+
{
|
|
306
|
+
// For backwards compatibility add style that isn't
|
|
307
|
+
// provided via block support.
|
|
308
|
+
"no-border-radius": style?.border?.radius === 0,
|
|
309
|
+
[`has-custom-font-size`]: fontSize || style?.typography?.fontSize
|
|
310
|
+
},
|
|
311
|
+
(0, import_block_editor.__experimentalGetElementClassName)("button")
|
|
312
|
+
);
|
|
313
|
+
const buttonStyle = {
|
|
314
|
+
...borderProps.style,
|
|
315
|
+
...colorProps.style,
|
|
316
|
+
...spacingProps.style,
|
|
317
|
+
...shadowProps.style,
|
|
318
|
+
...typographyProps.style,
|
|
319
|
+
writingMode: void 0
|
|
320
|
+
};
|
|
321
|
+
const wrapperClasses = (0, import_clsx.default)(className, {
|
|
322
|
+
[`has-custom-width wp-block-button__width-${width}`]: width
|
|
323
|
+
});
|
|
324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...import_block_editor.useBlockProps.save({ className: wrapperClasses }), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
325
|
+
import_block_editor.RichText.Content,
|
|
326
|
+
{
|
|
327
|
+
tagName: TagName,
|
|
328
|
+
type: isButtonTag ? buttonType : null,
|
|
329
|
+
className: buttonClasses,
|
|
330
|
+
href: isButtonTag ? null : url,
|
|
331
|
+
title,
|
|
332
|
+
style: buttonStyle,
|
|
333
|
+
value: text,
|
|
334
|
+
target: isButtonTag ? null : linkTarget,
|
|
335
|
+
rel: isButtonTag ? null : rel
|
|
336
|
+
}
|
|
337
|
+
) });
|
|
338
|
+
},
|
|
339
|
+
isEligible(attributes) {
|
|
340
|
+
return typeof attributes.width === "number";
|
|
341
|
+
},
|
|
342
|
+
migrate: migrateWidth
|
|
343
|
+
};
|
|
129
344
|
var v13 = {
|
|
130
345
|
attributes: {
|
|
131
346
|
tagName: {
|
|
@@ -323,9 +538,9 @@ var v13 = {
|
|
|
323
538
|
) });
|
|
324
539
|
},
|
|
325
540
|
isEligible(attributes) {
|
|
326
|
-
return !!attributes.textAlign;
|
|
541
|
+
return !!attributes.textAlign || typeof attributes.width === "number";
|
|
327
542
|
},
|
|
328
|
-
migrate: import_migrate_text_align.default
|
|
543
|
+
migrate: (0, import_compose.compose)(migrateWidth, import_migrate_text_align.default)
|
|
329
544
|
};
|
|
330
545
|
var v12 = {
|
|
331
546
|
attributes: {
|
|
@@ -502,7 +717,11 @@ var v12 = {
|
|
|
502
717
|
rel: isButtonTag ? null : rel
|
|
503
718
|
}
|
|
504
719
|
) });
|
|
505
|
-
}
|
|
720
|
+
},
|
|
721
|
+
isEligible(attributes) {
|
|
722
|
+
return typeof attributes.width === "number";
|
|
723
|
+
},
|
|
724
|
+
migrate: migrateWidth
|
|
506
725
|
};
|
|
507
726
|
var v11 = {
|
|
508
727
|
attributes: {
|
|
@@ -743,12 +962,13 @@ var v10 = {
|
|
|
743
962
|
}
|
|
744
963
|
) });
|
|
745
964
|
},
|
|
746
|
-
migrate: import_migrate_font_family.default,
|
|
747
|
-
isEligible({ style }) {
|
|
748
|
-
return style?.typography?.fontFamily;
|
|
965
|
+
migrate: (0, import_compose.compose)(migrateWidth, import_migrate_font_family.default),
|
|
966
|
+
isEligible({ style, width }) {
|
|
967
|
+
return style?.typography?.fontFamily || typeof width === "number";
|
|
749
968
|
}
|
|
750
969
|
};
|
|
751
970
|
var deprecated = [
|
|
971
|
+
v14,
|
|
752
972
|
v13,
|
|
753
973
|
v12,
|
|
754
974
|
v11,
|
|
@@ -847,7 +1067,11 @@ var deprecated = [
|
|
|
847
1067
|
}
|
|
848
1068
|
) });
|
|
849
1069
|
},
|
|
850
|
-
migrate: (0, import_compose.compose)(
|
|
1070
|
+
migrate: (0, import_compose.compose)(
|
|
1071
|
+
migrateWidth,
|
|
1072
|
+
import_migrate_font_family.default,
|
|
1073
|
+
migrateBorderRadius
|
|
1074
|
+
)
|
|
851
1075
|
},
|
|
852
1076
|
{
|
|
853
1077
|
supports: {
|
|
@@ -927,7 +1151,11 @@ var deprecated = [
|
|
|
927
1151
|
}
|
|
928
1152
|
) });
|
|
929
1153
|
},
|
|
930
|
-
migrate: (0, import_compose.compose)(
|
|
1154
|
+
migrate: (0, import_compose.compose)(
|
|
1155
|
+
migrateWidth,
|
|
1156
|
+
import_migrate_font_family.default,
|
|
1157
|
+
migrateBorderRadius
|
|
1158
|
+
)
|
|
931
1159
|
},
|
|
932
1160
|
{
|
|
933
1161
|
supports: {
|
|
@@ -1007,7 +1235,11 @@ var deprecated = [
|
|
|
1007
1235
|
}
|
|
1008
1236
|
) });
|
|
1009
1237
|
},
|
|
1010
|
-
migrate: (0, import_compose.compose)(
|
|
1238
|
+
migrate: (0, import_compose.compose)(
|
|
1239
|
+
migrateWidth,
|
|
1240
|
+
import_migrate_font_family.default,
|
|
1241
|
+
migrateBorderRadius
|
|
1242
|
+
)
|
|
1011
1243
|
},
|
|
1012
1244
|
{
|
|
1013
1245
|
supports: {
|
|
@@ -1070,7 +1302,7 @@ var deprecated = [
|
|
|
1070
1302
|
}
|
|
1071
1303
|
);
|
|
1072
1304
|
},
|
|
1073
|
-
migrate: migrateBorderRadius
|
|
1305
|
+
migrate: (0, import_compose.compose)(migrateWidth, migrateBorderRadius)
|
|
1074
1306
|
},
|
|
1075
1307
|
{
|
|
1076
1308
|
supports: {
|
|
@@ -1118,6 +1350,7 @@ var deprecated = [
|
|
|
1118
1350
|
},
|
|
1119
1351
|
isEligible: (attributes) => !!attributes.customTextColor || !!attributes.customBackgroundColor || !!attributes.customGradient || !!attributes.align,
|
|
1120
1352
|
migrate: (0, import_compose.compose)(
|
|
1353
|
+
migrateWidth,
|
|
1121
1354
|
migrateBorderRadius,
|
|
1122
1355
|
migrateCustomColorsAndGradients,
|
|
1123
1356
|
migrateAlign
|
|
@@ -1282,7 +1515,7 @@ var deprecated = [
|
|
|
1282
1515
|
type: "string"
|
|
1283
1516
|
}
|
|
1284
1517
|
},
|
|
1285
|
-
migrate: oldColorsMigration,
|
|
1518
|
+
migrate: (0, import_compose.compose)(migrateWidth, oldColorsMigration),
|
|
1286
1519
|
save({ attributes }) {
|
|
1287
1520
|
const {
|
|
1288
1521
|
url,
|
|
@@ -1354,7 +1587,7 @@ var deprecated = [
|
|
|
1354
1587
|
}
|
|
1355
1588
|
) });
|
|
1356
1589
|
},
|
|
1357
|
-
migrate: oldColorsMigration
|
|
1590
|
+
migrate: (0, import_compose.compose)(migrateWidth, oldColorsMigration)
|
|
1358
1591
|
},
|
|
1359
1592
|
{
|
|
1360
1593
|
attributes: {
|
|
@@ -1390,7 +1623,7 @@ var deprecated = [
|
|
|
1390
1623
|
}
|
|
1391
1624
|
);
|
|
1392
1625
|
},
|
|
1393
|
-
migrate: oldColorsMigration
|
|
1626
|
+
migrate: (0, import_compose.compose)(migrateWidth, oldColorsMigration)
|
|
1394
1627
|
}
|
|
1395
1628
|
];
|
|
1396
1629
|
var deprecated_default = deprecated;
|