@wordpress/widgets 4.36.1-next.738bb1424.0 → 4.37.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/blocks/legacy-widget/edit/{control.cjs → control.js} +2 -2
- package/build/blocks/legacy-widget/edit/{convert-to-blocks-button.cjs → convert-to-blocks-button.js} +1 -1
- package/build/blocks/legacy-widget/edit/{form.cjs → form.js} +3 -3
- package/build/blocks/legacy-widget/edit/{index.cjs → index.js} +8 -8
- package/build/blocks/legacy-widget/edit/{inspector-card.cjs → inspector-card.js} +1 -1
- package/build/blocks/legacy-widget/edit/{no-preview.cjs → no-preview.js} +1 -1
- package/build/blocks/legacy-widget/edit/{preview.cjs → preview.js} +3 -3
- package/build/blocks/legacy-widget/edit/{widget-type-selector.cjs → widget-type-selector.js} +2 -1
- package/build/blocks/legacy-widget/edit/{widget-type-selector.cjs.map → widget-type-selector.js.map} +2 -2
- package/build/blocks/legacy-widget/{index.cjs → index.js} +4 -4
- package/build/blocks/legacy-widget/{transforms.cjs → transforms.js} +1 -1
- package/build/blocks/widget-group/{deprecated.cjs → deprecated.js} +1 -1
- package/build/blocks/widget-group/{edit.cjs → edit.js} +4 -4
- package/build/blocks/widget-group/{edit.cjs.map → edit.js.map} +2 -2
- package/build/blocks/widget-group/{index.cjs → index.js} +5 -5
- package/build/blocks/widget-group/{save.cjs → save.js} +1 -1
- package/build/components/{index.cjs → index.js} +2 -2
- package/build/components/move-to-widget-area/{index.cjs → index.js} +1 -1
- package/build/{index.cjs → index.js} +8 -8
- package/build/{index.cjs.map → index.js.map} +1 -1
- package/build/{register-legacy-widget-variations.cjs → register-legacy-widget-variations.js} +1 -1
- package/build/{utils.cjs → utils.js} +1 -1
- package/build-module/blocks/legacy-widget/edit/form.js +1 -1
- package/build-module/blocks/legacy-widget/edit/index.js +6 -6
- package/build-module/blocks/legacy-widget/edit/widget-type-selector.js +1 -0
- package/build-module/blocks/legacy-widget/edit/widget-type-selector.js.map +2 -2
- package/build-module/blocks/legacy-widget/index.js +2 -2
- package/build-module/blocks/widget-group/edit.js +3 -3
- package/build-module/blocks/widget-group/edit.js.map +2 -2
- package/build-module/blocks/widget-group/index.js +3 -3
- package/build-module/components/index.js +1 -1
- package/build-module/index.js +5 -5
- package/build-style/style-rtl.css +10 -0
- package/build-style/style.css +10 -0
- package/package.json +16 -25
- package/src/blocks/legacy-widget/edit/widget-type-selector.js +1 -0
- package/src/blocks/widget-group/edit.js +3 -3
- package/src/blocks/widget-group/editor.scss +11 -0
- /package/build/blocks/legacy-widget/edit/{control.cjs.map → control.js.map} +0 -0
- /package/build/blocks/legacy-widget/edit/{convert-to-blocks-button.cjs.map → convert-to-blocks-button.js.map} +0 -0
- /package/build/blocks/legacy-widget/edit/{form.cjs.map → form.js.map} +0 -0
- /package/build/blocks/legacy-widget/edit/{index.cjs.map → index.js.map} +0 -0
- /package/build/blocks/legacy-widget/edit/{inspector-card.cjs.map → inspector-card.js.map} +0 -0
- /package/build/blocks/legacy-widget/edit/{no-preview.cjs.map → no-preview.js.map} +0 -0
- /package/build/blocks/legacy-widget/edit/{preview.cjs.map → preview.js.map} +0 -0
- /package/build/blocks/legacy-widget/{index.cjs.map → index.js.map} +0 -0
- /package/build/blocks/legacy-widget/{transforms.cjs.map → transforms.js.map} +0 -0
- /package/build/blocks/widget-group/{deprecated.cjs.map → deprecated.js.map} +0 -0
- /package/build/blocks/widget-group/{index.cjs.map → index.js.map} +0 -0
- /package/build/blocks/widget-group/{save.cjs.map → save.js.map} +0 -0
- /package/build/components/{index.cjs.map → index.js.map} +0 -0
- /package/build/components/move-to-widget-area/{index.cjs.map → index.js.map} +0 -0
- /package/build/{register-legacy-widget-variations.cjs.map → register-legacy-widget-variations.js.map} +0 -0
- /package/build/{utils.cjs.map → utils.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -32,7 +32,7 @@ __export(control_exports, {
|
|
|
32
32
|
default: () => Control
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(control_exports);
|
|
35
|
-
var import_api_fetch = __toESM(require("@wordpress/api-fetch")
|
|
35
|
+
var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
|
|
36
36
|
var import_compose = require("@wordpress/compose");
|
|
37
37
|
var import_i18n = require("@wordpress/i18n");
|
|
38
38
|
var Control = class {
|
|
@@ -387,4 +387,4 @@ function serializeForm(form) {
|
|
|
387
387
|
Array.from(new window.FormData(form))
|
|
388
388
|
).toString();
|
|
389
389
|
}
|
|
390
|
-
//# sourceMappingURL=control.
|
|
390
|
+
//# sourceMappingURL=control.js.map
|
|
@@ -32,14 +32,14 @@ __export(form_exports, {
|
|
|
32
32
|
default: () => Form
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(form_exports);
|
|
35
|
-
var import_clsx = __toESM(require("clsx")
|
|
35
|
+
var import_clsx = __toESM(require("clsx"));
|
|
36
36
|
var import_element = require("@wordpress/element");
|
|
37
37
|
var import_data = require("@wordpress/data");
|
|
38
38
|
var import_notices = require("@wordpress/notices");
|
|
39
39
|
var import_i18n = require("@wordpress/i18n");
|
|
40
40
|
var import_components = require("@wordpress/components");
|
|
41
41
|
var import_compose = require("@wordpress/compose");
|
|
42
|
-
var import_control = __toESM(require("./control
|
|
42
|
+
var import_control = __toESM(require("./control"));
|
|
43
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
44
|
function Form({
|
|
45
45
|
title,
|
|
@@ -143,4 +143,4 @@ function Form({
|
|
|
143
143
|
}
|
|
144
144
|
);
|
|
145
145
|
}
|
|
146
|
-
//# sourceMappingURL=form.
|
|
146
|
+
//# sourceMappingURL=form.js.map
|
|
@@ -32,19 +32,19 @@ __export(edit_exports, {
|
|
|
32
32
|
default: () => Edit
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(edit_exports);
|
|
35
|
-
var import_clsx = __toESM(require("clsx")
|
|
35
|
+
var import_clsx = __toESM(require("clsx"));
|
|
36
36
|
var import_block_editor = require("@wordpress/block-editor");
|
|
37
37
|
var import_components = require("@wordpress/components");
|
|
38
38
|
var import_icons = require("@wordpress/icons");
|
|
39
39
|
var import_i18n = require("@wordpress/i18n");
|
|
40
40
|
var import_element = require("@wordpress/element");
|
|
41
41
|
var import_core_data = require("@wordpress/core-data");
|
|
42
|
-
var import_widget_type_selector = __toESM(require("./widget-type-selector
|
|
43
|
-
var import_inspector_card = __toESM(require("./inspector-card
|
|
44
|
-
var import_form = __toESM(require("./form
|
|
45
|
-
var import_preview = __toESM(require("./preview
|
|
46
|
-
var import_no_preview = __toESM(require("./no-preview
|
|
47
|
-
var import_convert_to_blocks_button = __toESM(require("./convert-to-blocks-button
|
|
42
|
+
var import_widget_type_selector = __toESM(require("./widget-type-selector"));
|
|
43
|
+
var import_inspector_card = __toESM(require("./inspector-card"));
|
|
44
|
+
var import_form = __toESM(require("./form"));
|
|
45
|
+
var import_preview = __toESM(require("./preview"));
|
|
46
|
+
var import_no_preview = __toESM(require("./no-preview"));
|
|
47
|
+
var import_convert_to_blocks_button = __toESM(require("./convert-to-blocks-button"));
|
|
48
48
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
49
49
|
function Edit(props) {
|
|
50
50
|
const { id, idBase } = props.attributes;
|
|
@@ -161,4 +161,4 @@ function NotEmpty({
|
|
|
161
161
|
] })
|
|
162
162
|
] });
|
|
163
163
|
}
|
|
164
|
-
//# sourceMappingURL=index.
|
|
164
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -32,12 +32,12 @@ __export(preview_exports, {
|
|
|
32
32
|
default: () => Preview
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(preview_exports);
|
|
35
|
-
var import_clsx = __toESM(require("clsx")
|
|
35
|
+
var import_clsx = __toESM(require("clsx"));
|
|
36
36
|
var import_compose = require("@wordpress/compose");
|
|
37
37
|
var import_element = require("@wordpress/element");
|
|
38
38
|
var import_components = require("@wordpress/components");
|
|
39
39
|
var import_i18n = require("@wordpress/i18n");
|
|
40
|
-
var import_api_fetch = __toESM(require("@wordpress/api-fetch")
|
|
40
|
+
var import_api_fetch = __toESM(require("@wordpress/api-fetch"));
|
|
41
41
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
42
42
|
function Preview({ idBase, instance, isVisible }) {
|
|
43
43
|
const [isLoaded, setIsLoaded] = (0, import_element.useState)(false);
|
|
@@ -122,4 +122,4 @@ function Preview({ idBase, instance, isVisible }) {
|
|
|
122
122
|
)
|
|
123
123
|
] });
|
|
124
124
|
}
|
|
125
|
-
//# sourceMappingURL=preview.
|
|
125
|
+
//# sourceMappingURL=preview.js.map
|
package/build/blocks/legacy-widget/edit/{widget-type-selector.cjs → widget-type-selector.js}
RENAMED
|
@@ -43,6 +43,7 @@ function WidgetTypeSelector({ selectedId, onSelect }) {
|
|
|
43
43
|
import_components.SelectControl,
|
|
44
44
|
{
|
|
45
45
|
__next40pxDefaultSize: true,
|
|
46
|
+
__nextHasNoMarginBottom: true,
|
|
46
47
|
label: (0, import_i18n.__)("Legacy widget"),
|
|
47
48
|
value: selectedId ?? "",
|
|
48
49
|
options: [
|
|
@@ -68,4 +69,4 @@ function WidgetTypeSelector({ selectedId, onSelect }) {
|
|
|
68
69
|
}
|
|
69
70
|
);
|
|
70
71
|
}
|
|
71
|
-
//# sourceMappingURL=widget-type-selector.
|
|
72
|
+
//# sourceMappingURL=widget-type-selector.js.map
|
package/build/blocks/legacy-widget/edit/{widget-type-selector.cjs.map → widget-type-selector.js.map}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/blocks/legacy-widget/edit/widget-type-selector.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Spinner, SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nexport default function WidgetTypeSelector( { selectedId, onSelect } ) {\n\tconst widgetTypes = useSelect( ( select ) => {\n\t\tconst hiddenIds =\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t?.widgetTypesToHideFromLegacyWidgetBlock ?? [];\n\t\treturn select( coreStore )\n\t\t\t.getWidgetTypes( { per_page: -1 } )\n\t\t\t?.filter( ( widgetType ) => ! hiddenIds.includes( widgetType.id ) );\n\t}, [] );\n\n\tif ( ! widgetTypes ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( widgetTypes.length === 0 ) {\n\t\treturn __( 'There are no widgets available.' );\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Legacy widget' ) }\n\t\t\tvalue={ selectedId ?? '' }\n\t\t\toptions={ [\n\t\t\t\t{ value: '', label: __( 'Select widget' ) },\n\t\t\t\t...widgetTypes.map( ( widgetType ) => ( {\n\t\t\t\t\tvalue: widgetType.id,\n\t\t\t\t\tlabel: widgetType.name,\n\t\t\t\t} ) ),\n\t\t\t] }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tif ( value ) {\n\t\t\t\t\tconst selected = widgetTypes.find(\n\t\t\t\t\t\t( widgetType ) => widgetType.id === value\n\t\t\t\t\t);\n\t\t\t\t\tonSelect( {\n\t\t\t\t\t\tselectedId: selected.id,\n\t\t\t\t\t\tisMulti: selected.is_multi,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tonSelect( { selectedId: null } );\n\t\t\t\t}\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAuC;AACvC,kBAAmB;AACnB,kBAA0B;AAC1B,uBAAmC;AACnC,0BAA0C;AAajC;AAXM,SAAR,mBAAqC,EAAE,YAAY,SAAS,GAAI;AACtE,QAAM,kBAAc,uBAAW,CAAE,WAAY;AAC5C,UAAM,YACL,OAAQ,oBAAAA,KAAiB,EAAE,YAAY,GACpC,0CAA0C,CAAC;AAC/C,WAAO,OAAQ,iBAAAC,KAAU,EACvB,eAAgB,EAAE,UAAU,GAAG,CAAE,GAChC,OAAQ,CAAE,eAAgB,CAAE,UAAU,SAAU,WAAW,EAAG,CAAE;AAAA,EACpE,GAAG,CAAC,CAAE;AAEN,MAAK,CAAE,aAAc;AACpB,WAAO,4CAAC,6BAAQ;AAAA,EACjB;AAEA,MAAK,YAAY,WAAW,GAAI;AAC/B,eAAO,gBAAI,iCAAkC;AAAA,EAC9C;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,WAAQ,gBAAI,eAAgB;AAAA,MAC5B,OAAQ,cAAc;AAAA,MACtB,SAAU;AAAA,QACT,EAAE,OAAO,IAAI,WAAO,gBAAI,eAAgB,EAAE;AAAA,QAC1C,GAAG,YAAY,IAAK,CAAE,gBAAkB;AAAA,UACvC,OAAO,WAAW;AAAA,UAClB,OAAO,WAAW;AAAA,QACnB,EAAI;AAAA,MACL;AAAA,MACA,UAAW,CAAE,UAAW;AACvB,YAAK,OAAQ;AACZ,gBAAM,WAAW,YAAY;AAAA,YAC5B,CAAE,eAAgB,WAAW,OAAO;AAAA,UACrC;AACA,mBAAU;AAAA,YACT,YAAY,SAAS;AAAA,YACrB,SAAS,SAAS;AAAA,UACnB,CAAE;AAAA,QACH,OAAO;AACN,mBAAU,EAAE,YAAY,KAAK,CAAE;AAAA,QAChC;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Spinner, SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nexport default function WidgetTypeSelector( { selectedId, onSelect } ) {\n\tconst widgetTypes = useSelect( ( select ) => {\n\t\tconst hiddenIds =\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t?.widgetTypesToHideFromLegacyWidgetBlock ?? [];\n\t\treturn select( coreStore )\n\t\t\t.getWidgetTypes( { per_page: -1 } )\n\t\t\t?.filter( ( widgetType ) => ! hiddenIds.includes( widgetType.id ) );\n\t}, [] );\n\n\tif ( ! widgetTypes ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( widgetTypes.length === 0 ) {\n\t\treturn __( 'There are no widgets available.' );\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__next40pxDefaultSize\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Legacy widget' ) }\n\t\t\tvalue={ selectedId ?? '' }\n\t\t\toptions={ [\n\t\t\t\t{ value: '', label: __( 'Select widget' ) },\n\t\t\t\t...widgetTypes.map( ( widgetType ) => ( {\n\t\t\t\t\tvalue: widgetType.id,\n\t\t\t\t\tlabel: widgetType.name,\n\t\t\t\t} ) ),\n\t\t\t] }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tif ( value ) {\n\t\t\t\t\tconst selected = widgetTypes.find(\n\t\t\t\t\t\t( widgetType ) => widgetType.id === value\n\t\t\t\t\t);\n\t\t\t\t\tonSelect( {\n\t\t\t\t\t\tselectedId: selected.id,\n\t\t\t\t\t\tisMulti: selected.is_multi,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tonSelect( { selectedId: null } );\n\t\t\t\t}\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAuC;AACvC,kBAAmB;AACnB,kBAA0B;AAC1B,uBAAmC;AACnC,0BAA0C;AAajC;AAXM,SAAR,mBAAqC,EAAE,YAAY,SAAS,GAAI;AACtE,QAAM,kBAAc,uBAAW,CAAE,WAAY;AAC5C,UAAM,YACL,OAAQ,oBAAAA,KAAiB,EAAE,YAAY,GACpC,0CAA0C,CAAC;AAC/C,WAAO,OAAQ,iBAAAC,KAAU,EACvB,eAAgB,EAAE,UAAU,GAAG,CAAE,GAChC,OAAQ,CAAE,eAAgB,CAAE,UAAU,SAAU,WAAW,EAAG,CAAE;AAAA,EACpE,GAAG,CAAC,CAAE;AAEN,MAAK,CAAE,aAAc;AACpB,WAAO,4CAAC,6BAAQ;AAAA,EACjB;AAEA,MAAK,YAAY,WAAW,GAAI;AAC/B,eAAO,gBAAI,iCAAkC;AAAA,EAC9C;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,yBAAuB;AAAA,MACvB,WAAQ,gBAAI,eAAgB;AAAA,MAC5B,OAAQ,cAAc;AAAA,MACtB,SAAU;AAAA,QACT,EAAE,OAAO,IAAI,WAAO,gBAAI,eAAgB,EAAE;AAAA,QAC1C,GAAG,YAAY,IAAK,CAAE,gBAAkB;AAAA,UACvC,OAAO,WAAW;AAAA,UAClB,OAAO,WAAW;AAAA,QACnB,EAAI;AAAA,MACL;AAAA,MACA,UAAW,CAAE,UAAW;AACvB,YAAK,OAAQ;AACZ,gBAAM,WAAW,YAAY;AAAA,YAC5B,CAAE,eAAgB,WAAW,OAAO;AAAA,UACrC;AACA,mBAAU;AAAA,YACT,YAAY,SAAS;AAAA,YACrB,SAAS,SAAS;AAAA,UACnB,CAAE;AAAA,QACH,OAAO;AACN,mBAAU,EAAE,YAAY,KAAK,CAAE;AAAA,QAChC;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["blockEditorStore", "coreStore"]
|
|
7
7
|
}
|
|
@@ -35,9 +35,9 @@ __export(legacy_widget_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(legacy_widget_exports);
|
|
37
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_transforms = __toESM(require("./transforms
|
|
38
|
+
var import_block = __toESM(require("./block.json"));
|
|
39
|
+
var import_edit = __toESM(require("./edit"));
|
|
40
|
+
var import_transforms = __toESM(require("./transforms"));
|
|
41
41
|
var { name } = import_block.default;
|
|
42
42
|
var settings = {
|
|
43
43
|
icon: import_icons.widget,
|
|
@@ -50,4 +50,4 @@ var settings = {
|
|
|
50
50
|
name,
|
|
51
51
|
settings
|
|
52
52
|
});
|
|
53
|
-
//# sourceMappingURL=index.
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -30,11 +30,11 @@ var import_data = require("@wordpress/data");
|
|
|
30
30
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
31
31
|
function Edit(props) {
|
|
32
32
|
const { clientId } = props;
|
|
33
|
-
const
|
|
34
|
-
(select) => select(import_block_editor.store).
|
|
33
|
+
const { innerBlocks } = (0, import_data.useSelect)(
|
|
34
|
+
(select) => select(import_block_editor.store).getBlock(clientId),
|
|
35
35
|
[clientId]
|
|
36
36
|
);
|
|
37
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ...(0, import_block_editor.useBlockProps)({ className: "widget" }), children:
|
|
37
|
+
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 }) });
|
|
38
38
|
}
|
|
39
39
|
function PlaceholderContent({ clientId }) {
|
|
40
40
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
@@ -67,4 +67,4 @@ function PreviewContent({ attributes, setAttributes }) {
|
|
|
67
67
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_block_editor.InnerBlocks, {})
|
|
68
68
|
] });
|
|
69
69
|
}
|
|
70
|
-
//# sourceMappingURL=edit.
|
|
70
|
+
//# sourceMappingURL=edit.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,0BAOO;AACP,wBAA4B;AAC5B,mBAAmC;AACnC,kBAAmB;AACnB,kBAA0B;AAYtB;AAVW,SAAR,KAAuB,OAAQ;AACrC,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,
|
|
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;AAGA,0BAOO;AACP,wBAA4B;AAC5B,mBAAmC;AACnC,kBAAmB;AACnB,kBAA0B;AAYtB;AAVW,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
6
|
"names": ["blockEditorStore", "groupIcon"]
|
|
7
7
|
}
|
|
@@ -37,10 +37,10 @@ module.exports = __toCommonJS(widget_group_exports);
|
|
|
37
37
|
var import_i18n = require("@wordpress/i18n");
|
|
38
38
|
var import_blocks = require("@wordpress/blocks");
|
|
39
39
|
var import_icons = require("@wordpress/icons");
|
|
40
|
-
var import_block = __toESM(require("./block.json")
|
|
41
|
-
var import_edit = __toESM(require("./edit
|
|
42
|
-
var import_save = __toESM(require("./save
|
|
43
|
-
var import_deprecated = __toESM(require("./deprecated
|
|
40
|
+
var import_block = __toESM(require("./block.json"));
|
|
41
|
+
var import_edit = __toESM(require("./edit"));
|
|
42
|
+
var import_save = __toESM(require("./save"));
|
|
43
|
+
var import_deprecated = __toESM(require("./deprecated"));
|
|
44
44
|
var { name } = import_block.default;
|
|
45
45
|
var settings = {
|
|
46
46
|
title: (0, import_i18n.__)("Widget Group"),
|
|
@@ -97,4 +97,4 @@ var settings = {
|
|
|
97
97
|
name,
|
|
98
98
|
settings
|
|
99
99
|
});
|
|
100
|
-
//# sourceMappingURL=index.
|
|
100
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -37,4 +37,4 @@ function save({ attributes }) {
|
|
|
37
37
|
/* @__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, {}) })
|
|
38
38
|
] });
|
|
39
39
|
}
|
|
40
|
-
//# sourceMappingURL=save.
|
|
40
|
+
//# sourceMappingURL=save.js.map
|
|
@@ -32,9 +32,9 @@ __export(components_exports, {
|
|
|
32
32
|
MoveToWidgetArea: () => import_move_to_widget_area.default
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(components_exports);
|
|
35
|
-
var import_move_to_widget_area = __toESM(require("./move-to-widget-area
|
|
35
|
+
var import_move_to_widget_area = __toESM(require("./move-to-widget-area"));
|
|
36
36
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
37
|
0 && (module.exports = {
|
|
38
38
|
MoveToWidgetArea
|
|
39
39
|
});
|
|
40
|
-
//# sourceMappingURL=index.
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -36,11 +36,11 @@ __export(index_exports, {
|
|
|
36
36
|
});
|
|
37
37
|
module.exports = __toCommonJS(index_exports);
|
|
38
38
|
var import_blocks = require("@wordpress/blocks");
|
|
39
|
-
var legacyWidget = __toESM(require("./blocks/legacy-widget
|
|
40
|
-
var widgetGroup = __toESM(require("./blocks/widget-group
|
|
41
|
-
__reExport(index_exports, require("./components
|
|
42
|
-
__reExport(index_exports, require("./utils
|
|
43
|
-
var import_register_legacy_widget_variations = __toESM(require("./register-legacy-widget-variations
|
|
39
|
+
var legacyWidget = __toESM(require("./blocks/legacy-widget"));
|
|
40
|
+
var widgetGroup = __toESM(require("./blocks/widget-group"));
|
|
41
|
+
__reExport(index_exports, require("./components"), module.exports);
|
|
42
|
+
__reExport(index_exports, require("./utils"), module.exports);
|
|
43
|
+
var import_register_legacy_widget_variations = __toESM(require("./register-legacy-widget-variations"));
|
|
44
44
|
function registerLegacyWidgetBlock(supports = {}) {
|
|
45
45
|
const { metadata, settings, name } = legacyWidget;
|
|
46
46
|
(0, import_blocks.registerBlockType)(
|
|
@@ -72,7 +72,7 @@ function registerWidgetGroupBlock(supports = {}) {
|
|
|
72
72
|
registerLegacyWidgetBlock,
|
|
73
73
|
registerLegacyWidgetVariations,
|
|
74
74
|
registerWidgetGroupBlock,
|
|
75
|
-
...require("./components
|
|
76
|
-
...require("./utils
|
|
75
|
+
...require("./components"),
|
|
76
|
+
...require("./utils")
|
|
77
77
|
});
|
|
78
|
-
//# sourceMappingURL=index.
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.js"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport * as legacyWidget from './blocks/legacy-widget';\nimport * as widgetGroup from './blocks/widget-group';\n\nexport * from './components';\nexport * from './utils';\n\n/**\n * Registers the Legacy Widget block.\n *\n * Note that for the block to be useful, any scripts required by a widget must\n * be loaded into the page.\n *\n * @param {Object} supports Block support settings.\n * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/\n */\nexport function registerLegacyWidgetBlock( supports = {} ) {\n\tconst { metadata, settings, name } = legacyWidget;\n\tregisterBlockType(\n\t\t{ name, ...metadata },\n\t\t{\n\t\t\t...settings,\n\t\t\tsupports: {\n\t\t\t\t...settings.supports,\n\t\t\t\t...supports,\n\t\t\t},\n\t\t}\n\t);\n}\n\n/**\n * Registers the Widget Group block.\n *\n * @param {Object} supports Block support settings.\n */\nexport function registerWidgetGroupBlock( supports = {} ) {\n\tconst { metadata, settings, name } = widgetGroup;\n\tregisterBlockType(\n\t\t{ name, ...metadata },\n\t\t{\n\t\t\t...settings,\n\t\t\tsupports: {\n\t\t\t\t...settings.supports,\n\t\t\t\t...supports,\n\t\t\t},\n\t\t}\n\t);\n}\n\nexport { default as registerLegacyWidgetVariations } from './register-legacy-widget-variations';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAkC;AAKlC,mBAA8B;AAC9B,kBAA6B;AAE7B,0BAAc,
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAkC;AAKlC,mBAA8B;AAC9B,kBAA6B;AAE7B,0BAAc,yBAXd;AAYA,0BAAc,oBAZd;AAwDA,+CAA0D;AAjCnD,SAAS,0BAA2B,WAAW,CAAC,GAAI;AAC1D,QAAM,EAAE,UAAU,UAAU,KAAK,IAAI;AACrC;AAAA,IACC,EAAE,MAAM,GAAG,SAAS;AAAA,IACpB;AAAA,MACC,GAAG;AAAA,MACH,UAAU;AAAA,QACT,GAAG,SAAS;AAAA,QACZ,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AACD;AAOO,SAAS,yBAA0B,WAAW,CAAC,GAAI;AACzD,QAAM,EAAE,UAAU,UAAU,KAAK,IAAI;AACrC;AAAA,IACC,EAAE,MAAM,GAAG,SAAS;AAAA,IACpB;AAAA,MACC,GAAG;AAAA,MACH,UAAU;AAAA,QACT,GAAG,SAAS;AAAA,QACZ,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -6,7 +6,7 @@ import { store as noticesStore } from "@wordpress/notices";
|
|
|
6
6
|
import { __, sprintf } from "@wordpress/i18n";
|
|
7
7
|
import { Popover } from "@wordpress/components";
|
|
8
8
|
import { useViewportMatch } from "@wordpress/compose";
|
|
9
|
-
import Control from "./control
|
|
9
|
+
import Control from "./control";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
function Form({
|
|
12
12
|
title,
|
|
@@ -11,12 +11,12 @@ import { brush as brushIcon } from "@wordpress/icons";
|
|
|
11
11
|
import { __ } from "@wordpress/i18n";
|
|
12
12
|
import { useState, useCallback } from "@wordpress/element";
|
|
13
13
|
import { useEntityRecord } from "@wordpress/core-data";
|
|
14
|
-
import WidgetTypeSelector from "./widget-type-selector
|
|
15
|
-
import InspectorCard from "./inspector-card
|
|
16
|
-
import Form from "./form
|
|
17
|
-
import Preview from "./preview
|
|
18
|
-
import NoPreview from "./no-preview
|
|
19
|
-
import ConvertToBlocksButton from "./convert-to-blocks-button
|
|
14
|
+
import WidgetTypeSelector from "./widget-type-selector";
|
|
15
|
+
import InspectorCard from "./inspector-card";
|
|
16
|
+
import Form from "./form";
|
|
17
|
+
import Preview from "./preview";
|
|
18
|
+
import NoPreview from "./no-preview";
|
|
19
|
+
import ConvertToBlocksButton from "./convert-to-blocks-button";
|
|
20
20
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
21
21
|
function Edit(props) {
|
|
22
22
|
const { id, idBase } = props.attributes;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/blocks/legacy-widget/edit/widget-type-selector.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Spinner, SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nexport default function WidgetTypeSelector( { selectedId, onSelect } ) {\n\tconst widgetTypes = useSelect( ( select ) => {\n\t\tconst hiddenIds =\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t?.widgetTypesToHideFromLegacyWidgetBlock ?? [];\n\t\treturn select( coreStore )\n\t\t\t.getWidgetTypes( { per_page: -1 } )\n\t\t\t?.filter( ( widgetType ) => ! hiddenIds.includes( widgetType.id ) );\n\t}, [] );\n\n\tif ( ! widgetTypes ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( widgetTypes.length === 0 ) {\n\t\treturn __( 'There are no widgets available.' );\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__next40pxDefaultSize\n\t\t\tlabel={ __( 'Legacy widget' ) }\n\t\t\tvalue={ selectedId ?? '' }\n\t\t\toptions={ [\n\t\t\t\t{ value: '', label: __( 'Select widget' ) },\n\t\t\t\t...widgetTypes.map( ( widgetType ) => ( {\n\t\t\t\t\tvalue: widgetType.id,\n\t\t\t\t\tlabel: widgetType.name,\n\t\t\t\t} ) ),\n\t\t\t] }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tif ( value ) {\n\t\t\t\t\tconst selected = widgetTypes.find(\n\t\t\t\t\t\t( widgetType ) => widgetType.id === value\n\t\t\t\t\t);\n\t\t\t\t\tonSelect( {\n\t\t\t\t\t\tselectedId: selected.id,\n\t\t\t\t\t\tisMulti: selected.is_multi,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tonSelect( { selectedId: null } );\n\t\t\t\t}\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";AAGA,SAAS,SAAS,qBAAqB;AACvC,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,wBAAwB;AAajC;AAXM,SAAR,mBAAqC,EAAE,YAAY,SAAS,GAAI;AACtE,QAAM,cAAc,UAAW,CAAE,WAAY;AAC5C,UAAM,YACL,OAAQ,gBAAiB,EAAE,YAAY,GACpC,0CAA0C,CAAC;AAC/C,WAAO,OAAQ,SAAU,EACvB,eAAgB,EAAE,UAAU,GAAG,CAAE,GAChC,OAAQ,CAAE,eAAgB,CAAE,UAAU,SAAU,WAAW,EAAG,CAAE;AAAA,EACpE,GAAG,CAAC,CAAE;AAEN,MAAK,CAAE,aAAc;AACpB,WAAO,oBAAC,WAAQ;AAAA,EACjB;AAEA,MAAK,YAAY,WAAW,GAAI;AAC/B,WAAO,GAAI,iCAAkC;AAAA,EAC9C;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,OAAQ,GAAI,eAAgB;AAAA,MAC5B,OAAQ,cAAc;AAAA,MACtB,SAAU;AAAA,QACT,EAAE,OAAO,IAAI,OAAO,GAAI,eAAgB,EAAE;AAAA,QAC1C,GAAG,YAAY,IAAK,CAAE,gBAAkB;AAAA,UACvC,OAAO,WAAW;AAAA,UAClB,OAAO,WAAW;AAAA,QACnB,EAAI;AAAA,MACL;AAAA,MACA,UAAW,CAAE,UAAW;AACvB,YAAK,OAAQ;AACZ,gBAAM,WAAW,YAAY;AAAA,YAC5B,CAAE,eAAgB,WAAW,OAAO;AAAA,UACrC;AACA,mBAAU;AAAA,YACT,YAAY,SAAS;AAAA,YACrB,SAAS,SAAS;AAAA,UACnB,CAAE;AAAA,QACH,OAAO;AACN,mBAAU,EAAE,YAAY,KAAK,CAAE;AAAA,QAChC;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Spinner, SelectControl } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nexport default function WidgetTypeSelector( { selectedId, onSelect } ) {\n\tconst widgetTypes = useSelect( ( select ) => {\n\t\tconst hiddenIds =\n\t\t\tselect( blockEditorStore ).getSettings()\n\t\t\t\t?.widgetTypesToHideFromLegacyWidgetBlock ?? [];\n\t\treturn select( coreStore )\n\t\t\t.getWidgetTypes( { per_page: -1 } )\n\t\t\t?.filter( ( widgetType ) => ! hiddenIds.includes( widgetType.id ) );\n\t}, [] );\n\n\tif ( ! widgetTypes ) {\n\t\treturn <Spinner />;\n\t}\n\n\tif ( widgetTypes.length === 0 ) {\n\t\treturn __( 'There are no widgets available.' );\n\t}\n\n\treturn (\n\t\t<SelectControl\n\t\t\t__next40pxDefaultSize\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Legacy widget' ) }\n\t\t\tvalue={ selectedId ?? '' }\n\t\t\toptions={ [\n\t\t\t\t{ value: '', label: __( 'Select widget' ) },\n\t\t\t\t...widgetTypes.map( ( widgetType ) => ( {\n\t\t\t\t\tvalue: widgetType.id,\n\t\t\t\t\tlabel: widgetType.name,\n\t\t\t\t} ) ),\n\t\t\t] }\n\t\t\tonChange={ ( value ) => {\n\t\t\t\tif ( value ) {\n\t\t\t\t\tconst selected = widgetTypes.find(\n\t\t\t\t\t\t( widgetType ) => widgetType.id === value\n\t\t\t\t\t);\n\t\t\t\t\tonSelect( {\n\t\t\t\t\t\tselectedId: selected.id,\n\t\t\t\t\t\tisMulti: selected.is_multi,\n\t\t\t\t\t} );\n\t\t\t\t} else {\n\t\t\t\t\tonSelect( { selectedId: null } );\n\t\t\t\t}\n\t\t\t} }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,SAAS,qBAAqB;AACvC,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AACnC,SAAS,SAAS,wBAAwB;AAajC;AAXM,SAAR,mBAAqC,EAAE,YAAY,SAAS,GAAI;AACtE,QAAM,cAAc,UAAW,CAAE,WAAY;AAC5C,UAAM,YACL,OAAQ,gBAAiB,EAAE,YAAY,GACpC,0CAA0C,CAAC;AAC/C,WAAO,OAAQ,SAAU,EACvB,eAAgB,EAAE,UAAU,GAAG,CAAE,GAChC,OAAQ,CAAE,eAAgB,CAAE,UAAU,SAAU,WAAW,EAAG,CAAE;AAAA,EACpE,GAAG,CAAC,CAAE;AAEN,MAAK,CAAE,aAAc;AACpB,WAAO,oBAAC,WAAQ;AAAA,EACjB;AAEA,MAAK,YAAY,WAAW,GAAI;AAC/B,WAAO,GAAI,iCAAkC;AAAA,EAC9C;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,uBAAqB;AAAA,MACrB,yBAAuB;AAAA,MACvB,OAAQ,GAAI,eAAgB;AAAA,MAC5B,OAAQ,cAAc;AAAA,MACtB,SAAU;AAAA,QACT,EAAE,OAAO,IAAI,OAAO,GAAI,eAAgB,EAAE;AAAA,QAC1C,GAAG,YAAY,IAAK,CAAE,gBAAkB;AAAA,UACvC,OAAO,WAAW;AAAA,UAClB,OAAO,WAAW;AAAA,QACnB,EAAI;AAAA,MACL;AAAA,MACA,UAAW,CAAE,UAAW;AACvB,YAAK,OAAQ;AACZ,gBAAM,WAAW,YAAY;AAAA,YAC5B,CAAE,eAAgB,WAAW,OAAO;AAAA,UACrC;AACA,mBAAU;AAAA,YACT,YAAY,SAAS;AAAA,YACrB,SAAS,SAAS;AAAA,UACnB,CAAE;AAAA,QACH,OAAO;AACN,mBAAU,EAAE,YAAY,KAAK,CAAE;AAAA,QAChC;AAAA,MACD;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// packages/widgets/src/blocks/legacy-widget/index.js
|
|
2
2
|
import { widget as icon } from "@wordpress/icons";
|
|
3
3
|
import metadata from "./block.json";
|
|
4
|
-
import edit from "./edit
|
|
5
|
-
import transforms from "./transforms
|
|
4
|
+
import edit from "./edit";
|
|
5
|
+
import transforms from "./transforms";
|
|
6
6
|
var { name } = metadata;
|
|
7
7
|
var settings = {
|
|
8
8
|
icon,
|
|
@@ -14,11 +14,11 @@ import { useSelect } from "@wordpress/data";
|
|
|
14
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
function Edit(props) {
|
|
16
16
|
const { clientId } = props;
|
|
17
|
-
const
|
|
18
|
-
(select) => select(blockEditorStore).
|
|
17
|
+
const { innerBlocks } = useSelect(
|
|
18
|
+
(select) => select(blockEditorStore).getBlock(clientId),
|
|
19
19
|
[clientId]
|
|
20
20
|
);
|
|
21
|
-
return /* @__PURE__ */ jsx("div", { ...useBlockProps({ className: "widget" }), children:
|
|
21
|
+
return /* @__PURE__ */ jsx("div", { ...useBlockProps({ className: "widget" }), children: innerBlocks.length === 0 ? /* @__PURE__ */ jsx(PlaceholderContent, { ...props }) : /* @__PURE__ */ jsx(PreviewContent, { ...props }) });
|
|
22
22
|
}
|
|
23
23
|
function PlaceholderContent({ clientId }) {
|
|
24
24
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
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
|
|
5
|
-
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,mBAAmB;AAC5B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAYtB,SAUF,UAVE,KAUF,YAVE;AAVW,SAAR,KAAuB,OAAQ;AACrC,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,
|
|
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": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AAAA,OACM;AACP,SAAS,mBAAmB;AAC5B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAYtB,SAUF,UAVE,KAUF,YAVE;AAVW,SAAR,KAAuB,OAAQ;AACrC,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,YAAY,IAAI;AAAA,IACvB,CAAE,WAAY,OAAQ,gBAAiB,EAAE,SAAU,QAAS;AAAA,IAC5D,CAAE,QAAS;AAAA,EACZ;AAEA,SACC,oBAAC,SAAM,GAAG,cAAe,EAAE,WAAW,SAAS,CAAE,GAC9C,sBAAY,WAAW,IACxB,oBAAC,sBAAqB,GAAG,OAAQ,IAEjC,oBAAC,kBAAiB,GAAG,OAAQ,GAE/B;AAEF;AAEA,SAAS,mBAAoB,EAAE,SAAS,GAAI;AAC3C,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,MAAO,oBAAC,aAAU,MAAO,WAAY;AAAA,QACrC,OAAQ,GAAI,cAAe;AAAA,QAE3B,8BAAC,uBAAoB,cAAe,UAAW;AAAA;AAAA,IAChD;AAAA,IACA,oBAAC,eAAY,gBAAiB,OAAQ;AAAA,KACvC;AAEF;AAEA,SAAS,eAAgB,EAAE,YAAY,cAAc,GAAI;AACxD,SACC,iCACC;AAAA;AAAA,MAAC;AAAA;AAAA,QACA,SAAQ;AAAA,QACR,YAAW;AAAA,QACX,WAAU;AAAA,QACV,gBAAiB,CAAC;AAAA,QAClB,aAAc,GAAI,OAAQ;AAAA,QAC1B,OAAQ,WAAW,SAAS;AAAA,QAC5B,UAAW,CAAE,UAAW,cAAe,EAAE,MAAM,CAAE;AAAA;AAAA,IAClD;AAAA,IACA,oBAAC,eAAY;AAAA,KACd;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -3,9 +3,9 @@ import { __ } from "@wordpress/i18n";
|
|
|
3
3
|
import { createBlock } from "@wordpress/blocks";
|
|
4
4
|
import { group as icon } from "@wordpress/icons";
|
|
5
5
|
import metadata from "./block.json";
|
|
6
|
-
import edit from "./edit
|
|
7
|
-
import save from "./save
|
|
8
|
-
import deprecated from "./deprecated
|
|
6
|
+
import edit from "./edit";
|
|
7
|
+
import save from "./save";
|
|
8
|
+
import deprecated from "./deprecated";
|
|
9
9
|
var { name } = metadata;
|
|
10
10
|
var settings = {
|
|
11
11
|
title: __("Widget Group"),
|
package/build-module/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// packages/widgets/src/index.js
|
|
2
2
|
import { registerBlockType } from "@wordpress/blocks";
|
|
3
|
-
import * as legacyWidget from "./blocks/legacy-widget
|
|
4
|
-
import * as widgetGroup from "./blocks/widget-group
|
|
5
|
-
export * from "./components
|
|
6
|
-
export * from "./utils
|
|
7
|
-
import { default as default2 } from "./register-legacy-widget-variations
|
|
3
|
+
import * as legacyWidget from "./blocks/legacy-widget";
|
|
4
|
+
import * as widgetGroup from "./blocks/widget-group";
|
|
5
|
+
export * from "./components";
|
|
6
|
+
export * from "./utils";
|
|
7
|
+
import { default as default2 } from "./register-legacy-widget-variations";
|
|
8
8
|
function registerLegacyWidgetBlock(supports = {}) {
|
|
9
9
|
const { metadata, settings, name } = legacyWidget;
|
|
10
10
|
registerBlockType(
|
|
@@ -248,6 +248,16 @@
|
|
|
248
248
|
min-width: 400px;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
.wp-block-widget-group.has-child-selected::after {
|
|
252
|
+
border-radius: 2px;
|
|
253
|
+
border: 1px solid var(--wp-admin-theme-color);
|
|
254
|
+
bottom: 0;
|
|
255
|
+
content: "";
|
|
256
|
+
right: 0;
|
|
257
|
+
position: absolute;
|
|
258
|
+
left: 0;
|
|
259
|
+
top: 0;
|
|
260
|
+
}
|
|
251
261
|
.wp-block-widget-group .widget-title {
|
|
252
262
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
253
263
|
font-size: 18px;
|
package/build-style/style.css
CHANGED
|
@@ -248,6 +248,16 @@
|
|
|
248
248
|
min-width: 400px;
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
.wp-block-widget-group.has-child-selected::after {
|
|
252
|
+
border-radius: 2px;
|
|
253
|
+
border: 1px solid var(--wp-admin-theme-color);
|
|
254
|
+
bottom: 0;
|
|
255
|
+
content: "";
|
|
256
|
+
left: 0;
|
|
257
|
+
position: absolute;
|
|
258
|
+
right: 0;
|
|
259
|
+
top: 0;
|
|
260
|
+
}
|
|
251
261
|
.wp-block-widget-group .widget-title {
|
|
252
262
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
|
|
253
263
|
font-size: 18px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/widgets",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.37.0",
|
|
4
4
|
"description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -20,21 +20,12 @@
|
|
|
20
20
|
"node": ">=18.12.0",
|
|
21
21
|
"npm": ">=8.19.2"
|
|
22
22
|
},
|
|
23
|
-
"
|
|
24
|
-
"src",
|
|
25
|
-
"build",
|
|
26
|
-
"build-module",
|
|
27
|
-
"build-style",
|
|
28
|
-
"build-types",
|
|
29
|
-
"*.md"
|
|
30
|
-
],
|
|
31
|
-
"type": "module",
|
|
32
|
-
"main": "build/index.cjs",
|
|
23
|
+
"main": "build/index.js",
|
|
33
24
|
"module": "build-module/index.js",
|
|
34
25
|
"exports": {
|
|
35
26
|
".": {
|
|
36
27
|
"import": "./build-module/index.js",
|
|
37
|
-
"require": "./build/index.
|
|
28
|
+
"require": "./build/index.js"
|
|
38
29
|
},
|
|
39
30
|
"./package.json": "./package.json"
|
|
40
31
|
},
|
|
@@ -65,18 +56,18 @@
|
|
|
65
56
|
}
|
|
66
57
|
},
|
|
67
58
|
"dependencies": {
|
|
68
|
-
"@wordpress/api-fetch": "^7.
|
|
69
|
-
"@wordpress/base-styles": "^6.
|
|
70
|
-
"@wordpress/block-editor": "^15.
|
|
71
|
-
"@wordpress/blocks": "^15.
|
|
72
|
-
"@wordpress/components": "^31.0.
|
|
73
|
-
"@wordpress/compose": "^7.
|
|
74
|
-
"@wordpress/core-data": "^7.
|
|
75
|
-
"@wordpress/data": "^10.
|
|
76
|
-
"@wordpress/element": "^6.
|
|
77
|
-
"@wordpress/i18n": "^6.
|
|
78
|
-
"@wordpress/icons": "^11.
|
|
79
|
-
"@wordpress/notices": "^5.
|
|
59
|
+
"@wordpress/api-fetch": "^7.37.0",
|
|
60
|
+
"@wordpress/base-styles": "^6.13.0",
|
|
61
|
+
"@wordpress/block-editor": "^15.10.0",
|
|
62
|
+
"@wordpress/blocks": "^15.10.0",
|
|
63
|
+
"@wordpress/components": "^31.0.0",
|
|
64
|
+
"@wordpress/compose": "^7.37.0",
|
|
65
|
+
"@wordpress/core-data": "^7.37.0",
|
|
66
|
+
"@wordpress/data": "^10.37.0",
|
|
67
|
+
"@wordpress/element": "^6.37.0",
|
|
68
|
+
"@wordpress/i18n": "^6.10.0",
|
|
69
|
+
"@wordpress/icons": "^11.4.0",
|
|
70
|
+
"@wordpress/notices": "^5.37.0",
|
|
80
71
|
"clsx": "^2.1.1"
|
|
81
72
|
},
|
|
82
73
|
"peerDependencies": {
|
|
@@ -86,5 +77,5 @@
|
|
|
86
77
|
"publishConfig": {
|
|
87
78
|
"access": "public"
|
|
88
79
|
},
|
|
89
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "2cf13ec6cf86153c9b3cf369bf5c59046f5cd950"
|
|
90
81
|
}
|
|
@@ -16,14 +16,14 @@ import { useSelect } from '@wordpress/data';
|
|
|
16
16
|
|
|
17
17
|
export default function Edit( props ) {
|
|
18
18
|
const { clientId } = props;
|
|
19
|
-
const
|
|
20
|
-
( select ) => select( blockEditorStore ).
|
|
19
|
+
const { innerBlocks } = useSelect(
|
|
20
|
+
( select ) => select( blockEditorStore ).getBlock( clientId ),
|
|
21
21
|
[ clientId ]
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
25
|
<div { ...useBlockProps( { className: 'widget' } ) }>
|
|
26
|
-
{
|
|
26
|
+
{ innerBlocks.length === 0 ? (
|
|
27
27
|
<PlaceholderContent { ...props } />
|
|
28
28
|
) : (
|
|
29
29
|
<PreviewContent { ...props } />
|
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
@use "@wordpress/base-styles/variables" as *;
|
|
3
3
|
|
|
4
4
|
.wp-block-widget-group {
|
|
5
|
+
&.has-child-selected::after {
|
|
6
|
+
border-radius: $radius-small;
|
|
7
|
+
border: $border-width solid var(--wp-admin-theme-color);
|
|
8
|
+
bottom: 0;
|
|
9
|
+
content: "";
|
|
10
|
+
left: 0;
|
|
11
|
+
position: absolute;
|
|
12
|
+
right: 0;
|
|
13
|
+
top: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
5
16
|
.widget-title {
|
|
6
17
|
font-family: $default-font;
|
|
7
18
|
font-size: 18px;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|