@wordpress/widgets 4.32.0 → 4.32.1-next.ff1cebbba.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/build/blocks/legacy-widget/block.json +29 -0
- package/build/blocks/legacy-widget/edit/control.js +137 -167
- package/build/blocks/legacy-widget/edit/control.js.map +7 -1
- package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js +51 -39
- package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js.map +7 -1
- package/build/blocks/legacy-widget/edit/form.js +105 -75
- package/build/blocks/legacy-widget/edit/form.js.map +7 -1
- package/build/blocks/legacy-widget/edit/index.js +121 -131
- package/build/blocks/legacy-widget/edit/index.js.map +7 -1
- package/build/blocks/legacy-widget/edit/inspector-card.js +28 -20
- package/build/blocks/legacy-widget/edit/inspector-card.js.map +7 -1
- package/build/blocks/legacy-widget/edit/no-preview.js +29 -23
- package/build/blocks/legacy-widget/edit/no-preview.js.map +7 -1
- package/build/blocks/legacy-widget/edit/preview.js +107 -108
- package/build/blocks/legacy-widget/edit/preview.js.map +7 -1
- package/build/blocks/legacy-widget/edit/widget-type-selector.js +61 -52
- package/build/blocks/legacy-widget/edit/widget-type-selector.js.map +7 -1
- package/build/blocks/legacy-widget/index.js +49 -53
- package/build/blocks/legacy-widget/index.js.map +7 -1
- package/build/blocks/legacy-widget/transforms.js +189 -198
- package/build/blocks/legacy-widget/transforms.js.map +7 -1
- package/build/blocks/widget-group/block.json +20 -0
- package/build/blocks/widget-group/deprecated.js +38 -24
- package/build/blocks/widget-group/deprecated.js.map +7 -1
- package/build/blocks/widget-group/edit.js +63 -67
- package/build/blocks/widget-group/edit.js.map +7 -1
- package/build/blocks/widget-group/index.js +93 -80
- package/build/blocks/widget-group/index.js.map +7 -1
- package/build/blocks/widget-group/save.js +36 -25
- package/build/blocks/widget-group/save.js.map +7 -1
- package/build/components/index.js +36 -12
- package/build/components/index.js.map +7 -1
- package/build/components/move-to-widget-area/index.js +48 -37
- package/build/components/move-to-widget-area/index.js.map +7 -1
- package/build/index.js +67 -98
- package/build/index.js.map +7 -1
- package/build/register-legacy-widget-variations.js +42 -30
- package/build/register-legacy-widget-variations.js.map +7 -1
- package/build/utils.js +29 -29
- package/build/utils.js.map +7 -1
- package/build-module/blocks/legacy-widget/block.json +29 -0
- package/build-module/blocks/legacy-widget/edit/control.js +107 -158
- package/build-module/blocks/legacy-widget/edit/control.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js +33 -33
- package/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/form.js +75 -64
- package/build-module/blocks/legacy-widget/edit/form.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/index.js +96 -122
- package/build-module/blocks/legacy-widget/edit/index.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/inspector-card.js +10 -15
- package/build-module/blocks/legacy-widget/edit/inspector-card.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/no-preview.js +11 -17
- package/build-module/blocks/legacy-widget/edit/no-preview.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/preview.js +76 -98
- package/build-module/blocks/legacy-widget/edit/preview.js.map +7 -1
- package/build-module/blocks/legacy-widget/edit/widget-type-selector.js +43 -46
- package/build-module/blocks/legacy-widget/edit/widget-type-selector.js.map +7 -1
- package/build-module/blocks/legacy-widget/index.js +12 -45
- package/build-module/blocks/legacy-widget/index.js.map +7 -1
- package/build-module/blocks/legacy-widget/transforms.js +171 -192
- package/build-module/blocks/legacy-widget/transforms.js.map +7 -1
- package/build-module/blocks/widget-group/block.json +20 -0
- package/build-module/blocks/widget-group/deprecated.js +20 -18
- package/build-module/blocks/widget-group/deprecated.js.map +7 -1
- package/build-module/blocks/widget-group/edit.js +53 -62
- package/build-module/blocks/widget-group/edit.js.map +7 -1
- package/build-module/blocks/widget-group/index.js +55 -71
- package/build-module/blocks/widget-group/index.js.map +7 -1
- package/build-module/blocks/widget-group/save.js +18 -19
- package/build-module/blocks/widget-group/save.js.map +7 -1
- package/build-module/components/index.js +5 -2
- package/build-module/components/index.js.map +7 -1
- package/build-module/components/move-to-widget-area/index.js +37 -32
- package/build-module/components/move-to-widget-area/index.js.map +7 -1
- package/build-module/index.js +34 -60
- package/build-module/index.js.map +7 -1
- package/build-module/register-legacy-widget-variations.js +24 -24
- package/build-module/register-legacy-widget-variations.js.map +7 -1
- package/build-module/utils.js +8 -25
- package/build-module/utils.js.map +7 -1
- package/build-style/style-rtl.css +10 -145
- package/build-style/style.css +10 -145
- package/package.json +21 -14
- package/src/blocks/legacy-widget/editor.scss +3 -0
- package/src/blocks/widget-group/editor.scss +3 -0
- package/src/style.scss +3 -2
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blocks/widget-group/deprecated.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText } from '@wordpress/block-editor';\n\nconst v1 = {\n\tattributes: {\n\t\ttitle: {\n\t\t\ttype: 'string',\n\t\t},\n\t},\n\tsupports: {\n\t\thtml: false,\n\t\tinserter: true,\n\t\tcustomClassName: true,\n\t\treusable: false,\n\t},\n\tsave( { attributes } ) {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<RichText.Content\n\t\t\t\t\ttagName=\"h2\"\n\t\t\t\t\tclassName=\"widget-title\"\n\t\t\t\t\tvalue={ attributes.title }\n\t\t\t\t/>\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</>\n\t\t);\n\t},\n};\n\nexport default [ v1 ];\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBG;AAhBH,0BAAsC;AAEtC,MAAM,KAAK;AAAA,EACV,YAAY;AAAA,IACX,OAAO;AAAA,MACN,MAAM;AAAA,IACP;AAAA,EACD;AAAA,EACA,UAAU;AAAA,IACT,MAAM;AAAA,IACN,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,UAAU;AAAA,EACX;AAAA,EACA,KAAM,EAAE,WAAW,GAAI;AACtB,WACC,4EACC;AAAA;AAAA,QAAC,6BAAS;AAAA,QAAT;AAAA,UACA,SAAQ;AAAA,UACR,WAAU;AAAA,UACV,OAAQ,WAAW;AAAA;AAAA,MACpB;AAAA,MACA,4CAAC,gCAAY,SAAZ,EAAoB;AAAA,OACtB;AAAA,EAEF;AACD;AAEA,IAAO,qBAAQ,CAAE,EAAG;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,72 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var edit_exports = {};
|
|
19
|
+
__export(edit_exports, {
|
|
20
|
+
default: () => Edit
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
|
-
|
|
22
|
+
module.exports = __toCommonJS(edit_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
25
|
+
var import_components = require("@wordpress/components");
|
|
26
|
+
var import_icons = require("@wordpress/icons");
|
|
27
|
+
var import_i18n = require("@wordpress/i18n");
|
|
28
|
+
var import_data = require("@wordpress/data");
|
|
17
29
|
function Edit(props) {
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
25
|
-
...(0, _blockEditor.useBlockProps)({
|
|
26
|
-
className: 'widget'
|
|
27
|
-
}),
|
|
28
|
-
children: innerBlocks.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(PlaceholderContent, {
|
|
29
|
-
...props
|
|
30
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(PreviewContent, {
|
|
31
|
-
...props
|
|
32
|
-
})
|
|
33
|
-
});
|
|
30
|
+
const { clientId } = props;
|
|
31
|
+
const { innerBlocks } = (0, import_data.useSelect)(
|
|
32
|
+
(select) => select(import_block_editor.store).getBlock(clientId),
|
|
33
|
+
[clientId]
|
|
34
|
+
);
|
|
35
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...(0, import_block_editor.useBlockProps)({ className: "widget" }), children: innerBlocks.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlaceholderContent, { ...props }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PreviewContent, { ...props }) });
|
|
34
36
|
}
|
|
35
|
-
function PlaceholderContent({
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InnerBlocks, {
|
|
49
|
-
renderAppender: false
|
|
50
|
-
})]
|
|
51
|
-
});
|
|
37
|
+
function PlaceholderContent({ clientId }) {
|
|
38
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
39
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
40
|
+
import_components.Placeholder,
|
|
41
|
+
{
|
|
42
|
+
className: "wp-block-widget-group__placeholder",
|
|
43
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.BlockIcon, { icon: import_icons.group }),
|
|
44
|
+
label: (0, import_i18n.__)("Widget Group"),
|
|
45
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.ButtonBlockAppender, { rootClientId: clientId })
|
|
46
|
+
}
|
|
47
|
+
),
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InnerBlocks, { renderAppender: false })
|
|
49
|
+
] });
|
|
52
50
|
}
|
|
53
|
-
function PreviewContent({
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InnerBlocks, {})]
|
|
70
|
-
});
|
|
51
|
+
function PreviewContent({ attributes, setAttributes }) {
|
|
52
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
54
|
+
import_block_editor.RichText,
|
|
55
|
+
{
|
|
56
|
+
tagName: "h2",
|
|
57
|
+
identifier: "title",
|
|
58
|
+
className: "widget-title",
|
|
59
|
+
allowedFormats: [],
|
|
60
|
+
placeholder: (0, import_i18n.__)("Title"),
|
|
61
|
+
value: attributes.title ?? "",
|
|
62
|
+
onChange: (title) => setAttributes({ title })
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InnerBlocks, {})
|
|
66
|
+
] });
|
|
71
67
|
}
|
|
72
|
-
//# sourceMappingURL=edit.js.map
|
|
68
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blocks/widget-group/edit.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tuseBlockProps,\n\tBlockIcon,\n\tButtonBlockAppender,\n\tInnerBlocks,\n\tstore as blockEditorStore,\n\tRichText,\n} from '@wordpress/block-editor';\nimport { Placeholder } from '@wordpress/components';\nimport { group as groupIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\n\nexport default function Edit( props ) {\n\tconst { clientId } = props;\n\tconst { innerBlocks } = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t[ clientId ]\n\t);\n\n\treturn (\n\t\t<div { ...useBlockProps( { className: 'widget' } ) }>\n\t\t\t{ innerBlocks.length === 0 ? (\n\t\t\t\t<PlaceholderContent { ...props } />\n\t\t\t) : (\n\t\t\t\t<PreviewContent { ...props } />\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nfunction PlaceholderContent( { clientId } ) {\n\treturn (\n\t\t<>\n\t\t\t<Placeholder\n\t\t\t\tclassName=\"wp-block-widget-group__placeholder\"\n\t\t\t\ticon={ <BlockIcon icon={ groupIcon } /> }\n\t\t\t\tlabel={ __( 'Widget Group' ) }\n\t\t\t>\n\t\t\t\t<ButtonBlockAppender rootClientId={ clientId } />\n\t\t\t</Placeholder>\n\t\t\t<InnerBlocks renderAppender={ false } />\n\t\t</>\n\t);\n}\n\nfunction PreviewContent( { attributes, setAttributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tidentifier=\"title\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tallowedFormats={ [] }\n\t\t\t\tplaceholder={ __( 'Title' ) }\n\t\t\t\tvalue={ attributes.title ?? '' }\n\t\t\t\tonChange={ ( title ) => setAttributes( { title } ) }\n\t\t\t/>\n\t\t\t<InnerBlocks />\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0BI;AAvBJ,0BAOO;AACP,wBAA4B;AAC5B,mBAAmC;AACnC,kBAAmB;AACnB,kBAA0B;AAEX,SAAR,KAAuB,OAAQ;AACrC,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,YAAY,QAAI;AAAA,IACvB,CAAE,WAAY,OAAQ,oBAAAA,KAAiB,EAAE,SAAU,QAAS;AAAA,IAC5D,CAAE,QAAS;AAAA,EACZ;AAEA,SACC,4CAAC,SAAM,OAAG,mCAAe,EAAE,WAAW,SAAS,CAAE,GAC9C,sBAAY,WAAW,IACxB,4CAAC,sBAAqB,GAAG,OAAQ,IAEjC,4CAAC,kBAAiB,GAAG,OAAQ,GAE/B;AAEF;AAEA,SAAS,mBAAoB,EAAE,SAAS,GAAI;AAC3C,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,MAAO,4CAAC,iCAAU,MAAO,aAAAC,OAAY;AAAA,QACrC,WAAQ,gBAAI,cAAe;AAAA,QAE3B,sDAAC,2CAAoB,cAAe,UAAW;AAAA;AAAA,IAChD;AAAA,IACA,4CAAC,mCAAY,gBAAiB,OAAQ;AAAA,KACvC;AAEF;AAEA,SAAS,eAAgB,EAAE,YAAY,cAAc,GAAI;AACxD,SACC,4EACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,SAAQ;AAAA,QACR,YAAW;AAAA,QACX,WAAU;AAAA,QACV,gBAAiB,CAAC;AAAA,QAClB,iBAAc,gBAAI,OAAQ;AAAA,QAC1B,OAAQ,WAAW,SAAS;AAAA,QAC5B,UAAW,CAAE,UAAW,cAAe,EAAE,MAAM,CAAE;AAAA;AAAA,IAClD;AAAA,IACA,4CAAC,mCAAY;AAAA,KACd;AAEF;",
|
|
6
|
+
"names": ["blockEditorStore", "groupIcon"]
|
|
7
|
+
}
|
|
@@ -1,85 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
var _icons = require("@wordpress/icons");
|
|
11
|
-
var _edit = _interopRequireDefault(require("./edit"));
|
|
12
|
-
var _save = _interopRequireDefault(require("./save"));
|
|
13
|
-
var _deprecated = _interopRequireDefault(require("./deprecated"));
|
|
14
|
-
/**
|
|
15
|
-
* WordPress dependencies
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Internal dependencies
|
|
19
|
-
*/
|
|
20
|
-
const metadata = exports.metadata = {
|
|
21
|
-
$schema: "https://schemas.wp.org/trunk/block.json",
|
|
22
|
-
apiVersion: 3,
|
|
23
|
-
name: "core/widget-group",
|
|
24
|
-
title: "Widget Group",
|
|
25
|
-
category: "widgets",
|
|
26
|
-
attributes: {
|
|
27
|
-
title: {
|
|
28
|
-
type: "string"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
supports: {
|
|
32
|
-
html: false,
|
|
33
|
-
inserter: true,
|
|
34
|
-
customClassName: true,
|
|
35
|
-
reusable: false
|
|
36
|
-
},
|
|
37
|
-
editorStyle: "wp-block-widget-group-editor",
|
|
38
|
-
style: "wp-block-widget-group"
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name2 in all)
|
|
9
|
+
__defProp(target, name2, { get: all[name2], enumerable: true });
|
|
39
10
|
};
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var widget_group_exports = {};
|
|
29
|
+
__export(widget_group_exports, {
|
|
30
|
+
metadata: () => import_block.default,
|
|
31
|
+
name: () => name,
|
|
32
|
+
settings: () => settings
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(widget_group_exports);
|
|
35
|
+
var import_i18n = require("@wordpress/i18n");
|
|
36
|
+
var import_blocks = require("@wordpress/blocks");
|
|
37
|
+
var import_icons = require("@wordpress/icons");
|
|
38
|
+
var import_block = __toESM(require("./block.json"));
|
|
39
|
+
var import_edit = __toESM(require("./edit"));
|
|
40
|
+
var import_save = __toESM(require("./save"));
|
|
41
|
+
var import_deprecated = __toESM(require("./deprecated"));
|
|
42
|
+
const { name } = import_block.default;
|
|
43
|
+
const settings = {
|
|
44
|
+
title: (0, import_i18n.__)("Widget Group"),
|
|
45
|
+
description: (0, import_i18n.__)(
|
|
46
|
+
"Create a classic widget layout with a title that\u2019s styled by your theme for your widget areas."
|
|
47
|
+
),
|
|
48
|
+
icon: import_icons.group,
|
|
49
|
+
__experimentalLabel: ({ name: label }) => label,
|
|
50
|
+
edit: import_edit.default,
|
|
51
|
+
save: import_save.default,
|
|
53
52
|
transforms: {
|
|
54
|
-
from: [
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
53
|
+
from: [
|
|
54
|
+
{
|
|
55
|
+
type: "block",
|
|
56
|
+
isMultiBlock: true,
|
|
57
|
+
blocks: ["*"],
|
|
58
|
+
isMatch(attributes, blocks) {
|
|
59
|
+
return !blocks.some(
|
|
60
|
+
(block) => block.name === "core/widget-group"
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
__experimentalConvert(blocks) {
|
|
64
|
+
let innerBlocks = [
|
|
65
|
+
...blocks.map((block) => {
|
|
66
|
+
return (0, import_blocks.createBlock)(
|
|
67
|
+
block.name,
|
|
68
|
+
block.attributes,
|
|
69
|
+
block.innerBlocks
|
|
70
|
+
);
|
|
71
|
+
})
|
|
72
|
+
];
|
|
73
|
+
const firstHeadingBlock = innerBlocks[0].name === "core/heading" ? innerBlocks[0] : null;
|
|
74
|
+
innerBlocks = innerBlocks.filter(
|
|
75
|
+
(block) => block !== firstHeadingBlock
|
|
76
|
+
);
|
|
77
|
+
return (0, import_blocks.createBlock)(
|
|
78
|
+
"core/widget-group",
|
|
79
|
+
{
|
|
80
|
+
...firstHeadingBlock && {
|
|
81
|
+
title: firstHeadingBlock.attributes.content
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
innerBlocks
|
|
85
|
+
);
|
|
86
|
+
}
|
|
80
87
|
}
|
|
81
|
-
|
|
88
|
+
]
|
|
82
89
|
},
|
|
83
|
-
deprecated:
|
|
90
|
+
deprecated: import_deprecated.default
|
|
84
91
|
};
|
|
85
|
-
|
|
92
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
93
|
+
0 && (module.exports = {
|
|
94
|
+
metadata,
|
|
95
|
+
name,
|
|
96
|
+
settings
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blocks/widget-group/index.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { createBlock } from '@wordpress/blocks';\nimport { group as icon } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport metadata from './block.json';\nimport edit from './edit';\nimport save from './save';\nimport deprecated from './deprecated';\n\nconst { name } = metadata;\nexport { metadata, name };\n\nexport const settings = {\n\ttitle: __( 'Widget Group' ),\n\tdescription: __(\n\t\t'Create a classic widget layout with a title that\u2019s styled by your theme for your widget areas.'\n\t),\n\ticon,\n\t__experimentalLabel: ( { name: label } ) => label,\n\tedit,\n\tsave,\n\ttransforms: {\n\t\tfrom: [\n\t\t\t{\n\t\t\t\ttype: 'block',\n\t\t\t\tisMultiBlock: true,\n\t\t\t\tblocks: [ '*' ],\n\t\t\t\tisMatch( attributes, blocks ) {\n\t\t\t\t\t// Avoid transforming existing `widget-group` blocks.\n\t\t\t\t\treturn ! blocks.some(\n\t\t\t\t\t\t( block ) => block.name === 'core/widget-group'\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\t__experimentalConvert( blocks ) {\n\t\t\t\t\t// Put the selected blocks inside the new Widget Group's innerBlocks.\n\t\t\t\t\tlet innerBlocks = [\n\t\t\t\t\t\t...blocks.map( ( block ) => {\n\t\t\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t\t\tblock.name,\n\t\t\t\t\t\t\t\tblock.attributes,\n\t\t\t\t\t\t\t\tblock.innerBlocks\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} ),\n\t\t\t\t\t];\n\n\t\t\t\t\t// If the first block is a heading then assume this is intended\n\t\t\t\t\t// to be the Widget's \"title\".\n\t\t\t\t\tconst firstHeadingBlock =\n\t\t\t\t\t\tinnerBlocks[ 0 ].name === 'core/heading'\n\t\t\t\t\t\t\t? innerBlocks[ 0 ]\n\t\t\t\t\t\t\t: null;\n\n\t\t\t\t\t// Remove the first heading block as we're copying\n\t\t\t\t\t// it's content into the Widget Group's title attribute.\n\t\t\t\t\tinnerBlocks = innerBlocks.filter(\n\t\t\t\t\t\t( block ) => block !== firstHeadingBlock\n\t\t\t\t\t);\n\n\t\t\t\t\treturn createBlock(\n\t\t\t\t\t\t'core/widget-group',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t...( firstHeadingBlock && {\n\t\t\t\t\t\t\t\ttitle: firstHeadingBlock.attributes.content,\n\t\t\t\t\t\t\t} ),\n\t\t\t\t\t\t},\n\t\t\t\t\t\tinnerBlocks\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n\tdeprecated,\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AACnB,oBAA4B;AAC5B,mBAA8B;AAK9B,mBAAqB;AACrB,kBAAiB;AACjB,kBAAiB;AACjB,wBAAuB;AAEvB,MAAM,EAAE,KAAK,IAAI,aAAAA;AAGV,MAAM,WAAW;AAAA,EACvB,WAAO,gBAAI,cAAe;AAAA,EAC1B,iBAAa;AAAA,IACZ;AAAA,EACD;AAAA,EACA,mBAAAC;AAAA,EACA,qBAAqB,CAAE,EAAE,MAAM,MAAM,MAAO;AAAA,EAC5C,kBAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,YAAY;AAAA,IACX,MAAM;AAAA,MACL;AAAA,QACC,MAAM;AAAA,QACN,cAAc;AAAA,QACd,QAAQ,CAAE,GAAI;AAAA,QACd,QAAS,YAAY,QAAS;AAE7B,iBAAO,CAAE,OAAO;AAAA,YACf,CAAE,UAAW,MAAM,SAAS;AAAA,UAC7B;AAAA,QACD;AAAA,QACA,sBAAuB,QAAS;AAE/B,cAAI,cAAc;AAAA,YACjB,GAAG,OAAO,IAAK,CAAE,UAAW;AAC3B,yBAAO;AAAA,gBACN,MAAM;AAAA,gBACN,MAAM;AAAA,gBACN,MAAM;AAAA,cACP;AAAA,YACD,CAAE;AAAA,UACH;AAIA,gBAAM,oBACL,YAAa,CAAE,EAAE,SAAS,iBACvB,YAAa,CAAE,IACf;AAIJ,wBAAc,YAAY;AAAA,YACzB,CAAE,UAAW,UAAU;AAAA,UACxB;AAEA,qBAAO;AAAA,YACN;AAAA,YACA;AAAA,cACC,GAAK,qBAAqB;AAAA,gBACzB,OAAO,kBAAkB,WAAW;AAAA,cACrC;AAAA,YACD;AAAA,YACA;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAAA,EACD;AAAA,EACA,8BAAAC;AACD;",
|
|
6
|
+
"names": ["metadata", "icon", "edit", "save", "deprecated"]
|
|
7
|
+
}
|
|
@@ -1,27 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var save_exports = {};
|
|
19
|
+
__export(save_exports, {
|
|
20
|
+
default: () => save
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22
|
-
className: "wp-widget-group__inner-blocks",
|
|
23
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.InnerBlocks.Content, {})
|
|
24
|
-
})]
|
|
25
|
-
});
|
|
22
|
+
module.exports = __toCommonJS(save_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_block_editor = require("@wordpress/block-editor");
|
|
25
|
+
function save({ attributes }) {
|
|
26
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
27
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
28
|
+
import_block_editor.RichText.Content,
|
|
29
|
+
{
|
|
30
|
+
tagName: "h2",
|
|
31
|
+
className: "widget-title",
|
|
32
|
+
value: attributes.title
|
|
33
|
+
}
|
|
34
|
+
),
|
|
35
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "wp-widget-group__inner-blocks", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InnerBlocks.Content, {}) })
|
|
36
|
+
] });
|
|
26
37
|
}
|
|
27
|
-
//# sourceMappingURL=save.js.map
|
|
38
|
+
//# sourceMappingURL=save.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/blocks/widget-group/save.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { InnerBlocks, RichText } from '@wordpress/block-editor';\n\nexport default function save( { attributes } ) {\n\treturn (\n\t\t<>\n\t\t\t<RichText.Content\n\t\t\t\ttagName=\"h2\"\n\t\t\t\tclassName=\"widget-title\"\n\t\t\t\tvalue={ attributes.title }\n\t\t\t/>\n\t\t\t<div className=\"wp-widget-group__inner-blocks\">\n\t\t\t\t<InnerBlocks.Content />\n\t\t\t</div>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOE;AAJF,0BAAsC;AAEvB,SAAR,KAAuB,EAAE,WAAW,GAAI;AAC9C,SACC,4EACC;AAAA;AAAA,MAAC,6BAAS;AAAA,MAAT;AAAA,QACA,SAAQ;AAAA,QACR,WAAU;AAAA,QACV,OAAQ,WAAW;AAAA;AAAA,IACpB;AAAA,IACA,4CAAC,SAAI,WAAU,iCACd,sDAAC,gCAAY,SAAZ,EAAoB,GACtB;AAAA,KACD;AAEF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,14 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
Object.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
16
|
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var components_exports = {};
|
|
29
|
+
__export(components_exports, {
|
|
30
|
+
MoveToWidgetArea: () => import_move_to_widget_area.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(components_exports);
|
|
33
|
+
var import_move_to_widget_area = __toESM(require("./move-to-widget-area"));
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
MoveToWidgetArea
|
|
12
37
|
});
|
|
13
|
-
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/components/index.js"],
|
|
4
|
+
"sourcesContent": ["export { default as MoveToWidgetArea } from './move-to-widget-area';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iCAA4C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,47 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var move_to_widget_area_exports = {};
|
|
19
|
+
__export(move_to_widget_area_exports, {
|
|
20
|
+
default: () => MoveToWidgetArea
|
|
5
21
|
});
|
|
6
|
-
exports
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
/**
|
|
12
|
-
* WordPress dependencies
|
|
13
|
-
*/
|
|
14
|
-
|
|
22
|
+
module.exports = __toCommonJS(move_to_widget_area_exports);
|
|
23
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
24
|
+
var import_components = require("@wordpress/components");
|
|
25
|
+
var import_i18n = require("@wordpress/i18n");
|
|
26
|
+
var import_icons = require("@wordpress/icons");
|
|
15
27
|
function MoveToWidgetArea({
|
|
16
28
|
currentWidgetAreaId,
|
|
17
29
|
widgetAreas,
|
|
18
30
|
onSelect
|
|
19
31
|
}) {
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
choices: widgetAreas.map(widgetArea => ({
|
|
32
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarGroup, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.ToolbarItem, { children: (toggleProps) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
33
|
+
import_components.DropdownMenu,
|
|
34
|
+
{
|
|
35
|
+
icon: import_icons.moveTo,
|
|
36
|
+
label: (0, import_i18n.__)("Move to widget area"),
|
|
37
|
+
toggleProps,
|
|
38
|
+
children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.MenuGroup, { label: (0, import_i18n.__)("Move to"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
39
|
+
import_components.MenuItemsChoice,
|
|
40
|
+
{
|
|
41
|
+
choices: widgetAreas.map(
|
|
42
|
+
(widgetArea) => ({
|
|
32
43
|
value: widgetArea.id,
|
|
33
44
|
label: widgetArea.name,
|
|
34
45
|
info: widgetArea.description
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
+
})
|
|
47
|
+
),
|
|
48
|
+
value: currentWidgetAreaId,
|
|
49
|
+
onSelect: (value) => {
|
|
50
|
+
onSelect(value);
|
|
51
|
+
onClose();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
) })
|
|
55
|
+
}
|
|
56
|
+
) }) });
|
|
46
57
|
}
|
|
47
|
-
//# sourceMappingURL=index.js.map
|
|
58
|
+
//# sourceMappingURL=index.js.map
|