@wordpress/customize-widgets 6.0.0 → 6.2.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/components/block-appender/index.cjs +24 -41
- package/build/components/block-appender/index.cjs.map +1 -7
- package/build/components/block-inspector-button/index.cjs +24 -52
- package/build/components/block-inspector-button/index.cjs.map +1 -7
- package/build/components/customize-widgets/index.cjs +76 -97
- package/build/components/customize-widgets/index.cjs.map +1 -7
- package/build/components/customize-widgets/use-clear-selected-block.cjs +58 -67
- package/build/components/customize-widgets/use-clear-selected-block.cjs.map +1 -7
- package/build/components/error-boundary/index.cjs +115 -155
- package/build/components/error-boundary/index.cjs.map +1 -7
- package/build/components/focus-control/index.cjs +44 -84
- package/build/components/focus-control/index.cjs.map +1 -7
- package/build/components/focus-control/use-blocks-focus-control.cjs +28 -49
- package/build/components/focus-control/use-blocks-focus-control.cjs.map +1 -7
- package/build/components/header/index.cjs +84 -122
- package/build/components/header/index.cjs.map +1 -7
- package/build/components/inserter/index.cjs +43 -78
- package/build/components/inserter/index.cjs.map +1 -7
- package/build/components/inserter/use-inserter.cjs +22 -54
- package/build/components/inserter/use-inserter.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/config.cjs +88 -85
- package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +40 -57
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/index.cjs +103 -165
- package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -7
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +38 -76
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -7
- package/build/components/keyboard-shortcuts/index.cjs +70 -100
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -7
- package/build/components/more-menu/index.cjs +102 -151
- package/build/components/more-menu/index.cjs.map +1 -7
- package/build/components/sidebar-block-editor/index.cjs +122 -155
- package/build/components/sidebar-block-editor/index.cjs.map +1 -7
- package/build/components/sidebar-block-editor/sidebar-adapter.cjs +207 -270
- package/build/components/sidebar-block-editor/sidebar-adapter.cjs.map +1 -7
- package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs +40 -50
- package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs.map +1 -7
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs +75 -110
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs.map +1 -7
- package/build/components/sidebar-controls/index.cjs +27 -53
- package/build/components/sidebar-controls/index.cjs.map +1 -7
- package/build/components/welcome-guide/index.cjs +70 -94
- package/build/components/welcome-guide/index.cjs.map +1 -7
- package/build/controls/inserter-outer-section.cjs +68 -110
- package/build/controls/inserter-outer-section.cjs.map +1 -7
- package/build/controls/inspector-section.cjs +57 -90
- package/build/controls/inspector-section.cjs.map +1 -7
- package/build/controls/sidebar-control.cjs +55 -69
- package/build/controls/sidebar-control.cjs.map +1 -7
- package/build/controls/sidebar-section.cjs +79 -103
- package/build/controls/sidebar-section.cjs.map +1 -7
- package/build/filters/index.cjs +8 -5
- package/build/filters/move-to-sidebar.cjs +62 -78
- package/build/filters/move-to-sidebar.cjs.map +1 -7
- package/build/filters/replace-media-upload.cjs +11 -9
- package/build/filters/replace-media-upload.cjs.map +1 -7
- package/build/filters/wide-widget-display.cjs +20 -20
- package/build/filters/wide-widget-display.cjs.map +1 -7
- package/build/index.cjs +84 -91
- package/build/index.cjs.map +1 -7
- package/build/lock-unlock.cjs +10 -35
- package/build/lock-unlock.cjs.map +1 -7
- package/build/store/actions.cjs +49 -32
- package/build/store/actions.cjs.map +1 -7
- package/build/store/constants.cjs +12 -29
- package/build/store/constants.cjs.map +1 -7
- package/build/store/index.cjs +49 -41
- package/build/store/index.cjs.map +1 -7
- package/build/store/reducer.cjs +20 -33
- package/build/store/reducer.cjs.map +1 -7
- package/build/store/selectors.cjs +47 -38
- package/build/store/selectors.cjs.map +1 -7
- package/build/utils.cjs +81 -108
- package/build/utils.cjs.map +1 -7
- package/build-module/components/block-appender/index.mjs +18 -23
- package/build-module/components/block-appender/index.mjs.map +1 -7
- package/build-module/components/block-inspector-button/index.mjs +15 -28
- package/build-module/components/block-inspector-button/index.mjs.map +1 -7
- package/build-module/components/customize-widgets/index.mjs +45 -73
- package/build-module/components/customize-widgets/index.mjs.map +1 -7
- package/build-module/components/customize-widgets/use-clear-selected-block.mjs +52 -46
- package/build-module/components/customize-widgets/use-clear-selected-block.mjs.map +1 -7
- package/build-module/components/error-boundary/index.mjs +104 -129
- package/build-module/components/error-boundary/index.mjs.map +1 -7
- package/build-module/components/focus-control/index.mjs +37 -66
- package/build-module/components/focus-control/index.mjs.map +1 -7
- package/build-module/components/focus-control/use-blocks-focus-control.mjs +21 -27
- package/build-module/components/focus-control/use-blocks-focus-control.mjs.map +1 -7
- package/build-module/components/header/index.mjs +55 -92
- package/build-module/components/header/index.mjs.map +1 -7
- package/build-module/components/inserter/index.mjs +33 -53
- package/build-module/components/inserter/index.mjs.map +1 -7
- package/build-module/components/inserter/use-inserter.mjs +17 -34
- package/build-module/components/inserter/use-inserter.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs +83 -61
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs +19 -33
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs +75 -139
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -7
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +32 -55
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -7
- package/build-module/components/keyboard-shortcuts/index.mjs +62 -79
- package/build-module/components/keyboard-shortcuts/index.mjs.map +1 -7
- package/build-module/components/more-menu/index.mjs +75 -128
- package/build-module/components/more-menu/index.mjs.map +1 -7
- package/build-module/components/sidebar-block-editor/index.mjs +86 -128
- package/build-module/components/sidebar-block-editor/index.mjs.map +1 -7
- package/build-module/components/sidebar-block-editor/sidebar-adapter.mjs +202 -250
- package/build-module/components/sidebar-block-editor/sidebar-adapter.mjs.map +1 -7
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs +17 -25
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs.map +1 -7
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs +54 -86
- package/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs.map +1 -7
- package/build-module/components/sidebar-controls/index.mjs +19 -27
- package/build-module/components/sidebar-controls/index.mjs.map +1 -7
- package/build-module/components/welcome-guide/index.mjs +62 -71
- package/build-module/components/welcome-guide/index.mjs.map +1 -7
- package/build-module/controls/inserter-outer-section.mjs +61 -88
- package/build-module/controls/inserter-outer-section.mjs.map +1 -7
- package/build-module/controls/inspector-section.mjs +52 -70
- package/build-module/controls/inspector-section.mjs.map +1 -7
- package/build-module/controls/sidebar-control.mjs +33 -45
- package/build-module/controls/sidebar-control.mjs.map +1 -7
- package/build-module/controls/sidebar-section.mjs +59 -80
- package/build-module/controls/sidebar-section.mjs.map +1 -7
- package/build-module/filters/index.mjs +0 -2
- package/build-module/filters/move-to-sidebar.mjs +52 -79
- package/build-module/filters/move-to-sidebar.mjs.map +1 -7
- package/build-module/filters/replace-media-upload.mjs +5 -8
- package/build-module/filters/replace-media-upload.mjs.map +1 -7
- package/build-module/filters/wide-widget-display.mjs +13 -18
- package/build-module/filters/wide-widget-display.mjs.map +1 -7
- package/build-module/index.mjs +53 -71
- package/build-module/index.mjs.map +1 -7
- package/build-module/lock-unlock.mjs +5 -10
- package/build-module/lock-unlock.mjs.map +1 -7
- package/build-module/store/actions.mjs +44 -8
- package/build-module/store/actions.mjs.map +1 -7
- package/build-module/store/constants.mjs +7 -5
- package/build-module/store/constants.mjs.map +1 -7
- package/build-module/store/index.mjs +15 -11
- package/build-module/store/index.mjs.map +1 -7
- package/build-module/store/reducer.mjs +15 -13
- package/build-module/store/reducer.mjs.map +1 -7
- package/build-module/store/selectors.mjs +41 -13
- package/build-module/store/selectors.mjs.map +1 -7
- package/build-module/utils.mjs +74 -82
- package/build-module/utils.mjs.map +1 -7
- package/build-style/style-rtl.css +23 -5
- package/build-style/style.css +23 -5
- package/package.json +27 -27
- package/src/components/customize-widgets/index.jsx +2 -2
- package/src/components/error-boundary/index.jsx +2 -2
- package/src/components/header/style.scss +16 -5
- package/src/components/inserter/style.scss +8 -0
- package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +1 -0
- package/src/components/keyboard-shortcut-help-modal/style.scss +1 -1
- package/src/components/more-menu/index.jsx +0 -1
- package/src/components/welcome-guide/index.jsx +6 -2
- package/build/filters/index.cjs.map +0 -7
- package/build-module/filters/index.mjs.map +0 -7
package/build-module/utils.mjs
CHANGED
|
@@ -1,89 +1,81 @@
|
|
|
1
|
-
|
|
2
|
-
import { serialize, parse, createBlock } from "@wordpress/blocks";
|
|
1
|
+
import { createBlock, parse, serialize } from "@wordpress/blocks";
|
|
3
2
|
import { addWidgetIdToBlock } from "@wordpress/widgets";
|
|
3
|
+
// packages/customize-widgets/src/utils.js
|
|
4
|
+
/**
|
|
5
|
+
* Convert settingId to widgetId.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} settingId The setting id.
|
|
8
|
+
* @return {string} The widget id.
|
|
9
|
+
*/
|
|
4
10
|
function settingIdToWidgetId(settingId) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const number = parseInt(matches[2], 10);
|
|
9
|
-
return `${idBase}-${number}`;
|
|
10
|
-
}
|
|
11
|
-
return settingId;
|
|
11
|
+
const matches = settingId.match(/^widget_(.+)(?:\[(\d+)\])$/);
|
|
12
|
+
if (matches) return `${matches[1]}-${parseInt(matches[2], 10)}`;
|
|
13
|
+
return settingId;
|
|
12
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Transform a block to a customizable widget.
|
|
17
|
+
*
|
|
18
|
+
* @param {WPBlock} block The block to be transformed from.
|
|
19
|
+
* @param {Object} existingWidget The widget to be extended from.
|
|
20
|
+
* @return {Object} The transformed widget.
|
|
21
|
+
*/
|
|
13
22
|
function blockToWidget(block, existingWidget = null) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
idBase: "block",
|
|
42
|
-
widgetClass: "WP_Widget_Block",
|
|
43
|
-
instance: {
|
|
44
|
-
raw_instance: instance
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
const { form, rendered, ...restExistingWidget } = existingWidget || {};
|
|
49
|
-
return {
|
|
50
|
-
...restExistingWidget,
|
|
51
|
-
...widget
|
|
52
|
-
};
|
|
23
|
+
let widget;
|
|
24
|
+
if (block.name === "core/legacy-widget" && (block.attributes.id || block.attributes.instance)) {
|
|
25
|
+
if (block.attributes.id) widget = { id: block.attributes.id };
|
|
26
|
+
else {
|
|
27
|
+
const { encoded, hash, raw, ...rest } = block.attributes.instance;
|
|
28
|
+
widget = {
|
|
29
|
+
idBase: block.attributes.idBase,
|
|
30
|
+
instance: {
|
|
31
|
+
...existingWidget?.instance,
|
|
32
|
+
is_widget_customizer_js_value: true,
|
|
33
|
+
encoded_serialized_instance: encoded,
|
|
34
|
+
instance_hash_key: hash,
|
|
35
|
+
raw_instance: raw,
|
|
36
|
+
...rest
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
} else widget = {
|
|
41
|
+
idBase: "block",
|
|
42
|
+
widgetClass: "WP_Widget_Block",
|
|
43
|
+
instance: { raw_instance: { content: serialize(block) } }
|
|
44
|
+
};
|
|
45
|
+
const { form, rendered, ...restExistingWidget } = existingWidget || {};
|
|
46
|
+
return {
|
|
47
|
+
...restExistingWidget,
|
|
48
|
+
...widget
|
|
49
|
+
};
|
|
53
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Transform a widget to a block.
|
|
53
|
+
*
|
|
54
|
+
* @param {Object} widget The widget to be transformed from.
|
|
55
|
+
* @param {string} widget.id The widget id.
|
|
56
|
+
* @param {string} widget.idBase The id base of the widget.
|
|
57
|
+
* @param {number} widget.number The number/index of the widget.
|
|
58
|
+
* @param {Object} widget.instance The instance of the widget.
|
|
59
|
+
* @return {WPBlock} The transformed block.
|
|
60
|
+
*/
|
|
54
61
|
function widgetToBlock({ id, idBase, number, instance }) {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
encoded,
|
|
72
|
-
hash,
|
|
73
|
-
raw,
|
|
74
|
-
...rest
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
} else {
|
|
78
|
-
block = createBlock("core/legacy-widget", {
|
|
79
|
-
id
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
return addWidgetIdToBlock(block, id);
|
|
62
|
+
let block;
|
|
63
|
+
const { encoded_serialized_instance: encoded, instance_hash_key: hash, raw_instance: raw, ...rest } = instance;
|
|
64
|
+
if (idBase === "block") {
|
|
65
|
+
const parsedBlocks = parse(raw.content ?? "", { __unstableSkipAutop: true });
|
|
66
|
+
block = parsedBlocks.length ? parsedBlocks[0] : createBlock("core/paragraph", {});
|
|
67
|
+
} else if (number) block = createBlock("core/legacy-widget", {
|
|
68
|
+
idBase,
|
|
69
|
+
instance: {
|
|
70
|
+
encoded,
|
|
71
|
+
hash,
|
|
72
|
+
raw,
|
|
73
|
+
...rest
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
else block = createBlock("core/legacy-widget", { id });
|
|
77
|
+
return addWidgetIdToBlock(block, id);
|
|
83
78
|
}
|
|
84
|
-
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
widgetToBlock
|
|
88
|
-
};
|
|
89
|
-
//# sourceMappingURL=utils.mjs.map
|
|
79
|
+
export { blockToWidget, settingIdToWidgetId, widgetToBlock };
|
|
80
|
+
|
|
81
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/utils.js"],
|
|
4
|
-
"sourcesContent": ["// @ts-check\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"],
|
|
5
|
-
"mappings": ";AACA,SAAS,WAAW,OAAO,mBAAmB;AAC9C,SAAS,0BAA0B;AAQ5B,SAAS,oBAAqB,WAAY;AAChD,QAAM,UAAU,UAAU,MAAO,4BAA6B;AAE9D,MAAK,SAAU;AACd,UAAM,SAAS,QAAS,CAAE;AAC1B,UAAM,SAAS,SAAU,QAAS,CAAE,GAAG,EAAG;AAE1C,WAAO,GAAI,MAAO,IAAK,MAAO;AAAA,EAC/B;AAEA,SAAO;AACR;AASO,SAAS,cAAe,OAAO,iBAAiB,MAAO;AAC7D,MAAI;AAEJ,QAAM,2BACL,MAAM,SAAS,yBACb,MAAM,WAAW,MAAM,MAAM,WAAW;AAE3C,MAAK,0BAA2B;AAC/B,QAAK,MAAM,WAAW,IAAK;AAE1B,eAAS;AAAA,QACR,IAAI,MAAM,WAAW;AAAA,MACtB;AAAA,IACD,OAAO;AACN,YAAM,EAAE,SAAS,MAAM,KAAK,GAAG,KAAK,IAAI,MAAM,WAAW;AAGzD,eAAS;AAAA,QACR,QAAQ,MAAM,WAAW;AAAA,QACzB,UAAU;AAAA,UACT,GAAG,gBAAgB;AAAA;AAAA,UAEnB,+BAA+B;AAAA,UAC/B,6BAA6B;AAAA,UAC7B,mBAAmB;AAAA,UACnB,cAAc;AAAA,UACd,GAAG;AAAA,QACJ;AAAA,MACD;AAAA,IACD;AAAA,EACD,OAAO;AACN,UAAM,WAAW;AAAA,MAChB,SAAS,UAAW,KAAM;AAAA,IAC3B;AACA,aAAS;AAAA,MACR,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,UAAU;AAAA,QACT,cAAc;AAAA,MACf;AAAA,IACD;AAAA,EACD;AAEA,QAAM,EAAE,MAAM,UAAU,GAAG,mBAAmB,IAAI,kBAAkB,CAAC;AAErE,SAAO;AAAA,IACN,GAAG;AAAA,IACH,GAAG;AAAA,EACJ;AACD;AAYO,SAAS,cAAe,EAAE,IAAI,QAAQ,QAAQ,SAAS,GAAI;AACjE,MAAI;AAEJ,QAAM;AAAA,IACL,6BAA6B;AAAA,IAC7B,mBAAmB;AAAA,IACnB,cAAc;AAAA,IACd,GAAG;AAAA,EACJ,IAAI;AAEJ,MAAK,WAAW,SAAU;AACzB,UAAM,eAAe,MAAO,IAAI,WAAW,IAAI;AAAA,MAC9C,qBAAqB;AAAA,IACtB,CAAE;AACF,YAAQ,aAAa,SAClB,aAAc,CAAE,IAChB,YAAa,kBAAkB,CAAC,CAAE;AAAA,EACtC,WAAY,QAAS;AAEpB,YAAQ,YAAa,sBAAsB;AAAA,MAC1C;AAAA,MACA,UAAU;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA,GAAG;AAAA,MACJ;AAAA,IACD,CAAE;AAAA,EACH,OAAO;AAEN,YAAQ,YAAa,sBAAsB;AAAA,MAC1C;AAAA,IACD,CAAE;AAAA,EACH;AAEA,SAAO,mBAAoB,OAAO,EAAG;AACtC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.js"],"sourcesContent":["// @ts-check\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgB,oBAAqB,WAAY;CAChD,MAAM,UAAU,UAAU,MAAO,4BAA6B;CAE9D,IAAK,SAIJ,OAAO,GAHQ,QAAS,GAGL,GAFJ,SAAU,QAAS,IAAK,EAEX;CAG7B,OAAO;AACR;;;;;;;;AASA,SAAgB,cAAe,OAAO,iBAAiB,MAAO;CAC7D,IAAI;CAMJ,IAHC,MAAM,SAAS,yBACb,MAAM,WAAW,MAAM,MAAM,WAAW,WAEX;EAC/B,IAAK,MAAM,WAAW,IAErB,SAAS,EACR,IAAI,MAAM,WAAW,GACtB;OACM;GACN,MAAM,EAAE,SAAS,MAAM,KAAK,GAAG,SAAS,MAAM,WAAW;GAGzD,SAAS;IACR,QAAQ,MAAM,WAAW;IACzB,UAAU;KACT,GAAG,gBAAgB;KAEnB,+BAA+B;KAC/B,6BAA6B;KAC7B,mBAAmB;KACnB,cAAc;KACd,GAAG;IACJ;GACD;EACD;CACD,OAIC,SAAS;EACR,QAAQ;EACR,aAAa;EACb,UAAU,EACT,cAAc,EANf,SAAS,UAAW,KAAM,EAMJ,EACtB;CACD;CAGD,MAAM,EAAE,MAAM,UAAU,GAAG,uBAAuB,kBAAkB,CAAC;CAErE,OAAO;EACN,GAAG;EACH,GAAG;CACJ;AACD;;;;;;;;;;;AAYA,SAAgB,cAAe,EAAE,IAAI,QAAQ,QAAQ,YAAa;CACjE,IAAI;CAEJ,MAAM,EACL,6BAA6B,SAC7B,mBAAmB,MACnB,cAAc,KACd,GAAG,SACA;CAEJ,IAAK,WAAW,SAAU;EACzB,MAAM,eAAe,MAAO,IAAI,WAAW,IAAI,EAC9C,qBAAqB,KACtB,CAAE;EACF,QAAQ,aAAa,SAClB,aAAc,KACd,YAAa,kBAAkB,CAAC,CAAE;CACtC,OAAO,IAAK,QAEX,QAAQ,YAAa,sBAAsB;EAC1C;EACA,UAAU;GACT;GACA;GACA;GACA,GAAG;EACJ;CACD,CAAE;MAGF,QAAQ,YAAa,sBAAsB,EAC1C,GACD,CAAE;CAGH,OAAO,mBAAoB,OAAO,EAAG;AACtC"}
|
|
@@ -174,8 +174,8 @@ body.admin-color-fresh {
|
|
|
174
174
|
display: flex;
|
|
175
175
|
justify-content: flex-end;
|
|
176
176
|
margin: -15px -12px 0 -12px;
|
|
177
|
-
background: #
|
|
178
|
-
border-bottom: 1px solid #
|
|
177
|
+
background: var(--wpds-color-background-surface-neutral, #fcfcfc);
|
|
178
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
179
179
|
z-index: 8;
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -195,7 +195,22 @@ body.admin-color-fresh {
|
|
|
195
195
|
}
|
|
196
196
|
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
|
|
197
197
|
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
|
|
198
|
-
background: #1e1e1e;
|
|
198
|
+
background: var(--wpds-color-background-interactive-neutral-strong-active, #1e1e1e);
|
|
199
|
+
}
|
|
200
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]),
|
|
201
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]) {
|
|
202
|
+
background: var(--wpds-color-background-interactive-neutral-strong-disabled, #e5e5e5);
|
|
203
|
+
}
|
|
204
|
+
@media (forced-colors: active) {
|
|
205
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
|
|
206
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
|
|
207
|
+
background: SelectedItem !important;
|
|
208
|
+
}
|
|
209
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:disabled, .customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed[aria-disabled=true],
|
|
210
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:disabled,
|
|
211
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed[aria-disabled=true] {
|
|
212
|
+
background: GrayText !important;
|
|
213
|
+
}
|
|
199
214
|
}
|
|
200
215
|
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:active),
|
|
201
216
|
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon:focus:not(:active) {
|
|
@@ -208,7 +223,6 @@ body.admin-color-fresh {
|
|
|
208
223
|
}
|
|
209
224
|
.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon {
|
|
210
225
|
border-radius: 2px;
|
|
211
|
-
color: #fff;
|
|
212
226
|
margin: 12px auto 12px 0;
|
|
213
227
|
}
|
|
214
228
|
@media not (prefers-reduced-motion) {
|
|
@@ -236,6 +250,10 @@ body.admin-color-fresh {
|
|
|
236
250
|
background: #fff;
|
|
237
251
|
}
|
|
238
252
|
|
|
253
|
+
.customize-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab .block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
254
|
+
display: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
239
257
|
.customize-widgets-layout__inserter-panel-header {
|
|
240
258
|
display: flex;
|
|
241
259
|
justify-content: space-between;
|
|
@@ -297,7 +315,7 @@ body.admin-color-fresh {
|
|
|
297
315
|
margin: 0 0.2rem 0 0.2rem;
|
|
298
316
|
}
|
|
299
317
|
.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child {
|
|
300
|
-
margin: 0
|
|
318
|
+
margin-inline-end: 0;
|
|
301
319
|
}
|
|
302
320
|
|
|
303
321
|
.components-popover.more-menu-dropdown__content {
|
package/build-style/style.css
CHANGED
|
@@ -174,8 +174,8 @@ body.admin-color-fresh {
|
|
|
174
174
|
display: flex;
|
|
175
175
|
justify-content: flex-end;
|
|
176
176
|
margin: -15px -12px 0 -12px;
|
|
177
|
-
background: #
|
|
178
|
-
border-bottom: 1px solid #
|
|
177
|
+
background: var(--wpds-color-background-surface-neutral, #fcfcfc);
|
|
178
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
179
179
|
z-index: 8;
|
|
180
180
|
}
|
|
181
181
|
|
|
@@ -195,7 +195,22 @@ body.admin-color-fresh {
|
|
|
195
195
|
}
|
|
196
196
|
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
|
|
197
197
|
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
|
|
198
|
-
background: #1e1e1e;
|
|
198
|
+
background: var(--wpds-color-background-interactive-neutral-strong-active, #1e1e1e);
|
|
199
|
+
}
|
|
200
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]),
|
|
201
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]) {
|
|
202
|
+
background: var(--wpds-color-background-interactive-neutral-strong-disabled, #e5e5e5);
|
|
203
|
+
}
|
|
204
|
+
@media (forced-colors: active) {
|
|
205
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed,
|
|
206
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed {
|
|
207
|
+
background: SelectedItem !important;
|
|
208
|
+
}
|
|
209
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:disabled, .customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed[aria-disabled=true],
|
|
210
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed:disabled,
|
|
211
|
+
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon.is-pressed[aria-disabled=true] {
|
|
212
|
+
background: GrayText !important;
|
|
213
|
+
}
|
|
199
214
|
}
|
|
200
215
|
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:active),
|
|
201
216
|
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon:focus:not(:active) {
|
|
@@ -208,7 +223,6 @@ body.admin-color-fresh {
|
|
|
208
223
|
}
|
|
209
224
|
.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon {
|
|
210
225
|
border-radius: 2px;
|
|
211
|
-
color: #fff;
|
|
212
226
|
margin: 12px 0 12px auto;
|
|
213
227
|
}
|
|
214
228
|
@media not (prefers-reduced-motion) {
|
|
@@ -236,6 +250,10 @@ body.admin-color-fresh {
|
|
|
236
250
|
background: #fff;
|
|
237
251
|
}
|
|
238
252
|
|
|
253
|
+
.customize-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab .block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
254
|
+
display: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
239
257
|
.customize-widgets-layout__inserter-panel-header {
|
|
240
258
|
display: flex;
|
|
241
259
|
justify-content: space-between;
|
|
@@ -297,7 +315,7 @@ body.admin-color-fresh {
|
|
|
297
315
|
margin: 0 0.2rem 0 0.2rem;
|
|
298
316
|
}
|
|
299
317
|
.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child {
|
|
300
|
-
margin: 0
|
|
318
|
+
margin-inline-end: 0;
|
|
301
319
|
}
|
|
302
320
|
|
|
303
321
|
.components-popover.more-menu-dropdown__content {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Widgets blocks in Customizer Module for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -37,30 +37,30 @@
|
|
|
37
37
|
},
|
|
38
38
|
"wpScript": true,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@wordpress/a11y": "^5.
|
|
41
|
-
"@wordpress/admin-ui": "^3.
|
|
42
|
-
"@wordpress/base-styles": "^
|
|
43
|
-
"@wordpress/block-editor": "^
|
|
44
|
-
"@wordpress/block-library": "^12.
|
|
45
|
-
"@wordpress/blocks": "^17.
|
|
46
|
-
"@wordpress/components": "^
|
|
47
|
-
"@wordpress/compose": "^9.
|
|
48
|
-
"@wordpress/core-data": "^9.
|
|
49
|
-
"@wordpress/data": "^11.
|
|
50
|
-
"@wordpress/dom": "^5.
|
|
51
|
-
"@wordpress/element": "^10.
|
|
52
|
-
"@wordpress/hooks": "^5.
|
|
53
|
-
"@wordpress/i18n": "^7.
|
|
54
|
-
"@wordpress/icons": "^
|
|
55
|
-
"@wordpress/is-shallow-equal": "^6.
|
|
56
|
-
"@wordpress/keyboard-shortcuts": "^6.
|
|
57
|
-
"@wordpress/keycodes": "^5.
|
|
58
|
-
"@wordpress/media-utils": "^6.
|
|
59
|
-
"@wordpress/preferences": "^5.
|
|
60
|
-
"@wordpress/private-apis": "^3.
|
|
61
|
-
"@wordpress/theme": "^
|
|
62
|
-
"@wordpress/ui": "^0.
|
|
63
|
-
"@wordpress/widgets": "^5.
|
|
40
|
+
"@wordpress/a11y": "^5.2.0",
|
|
41
|
+
"@wordpress/admin-ui": "^3.2.0",
|
|
42
|
+
"@wordpress/base-styles": "^15.1.0",
|
|
43
|
+
"@wordpress/block-editor": "^20.1.0",
|
|
44
|
+
"@wordpress/block-library": "^12.2.0",
|
|
45
|
+
"@wordpress/blocks": "^17.2.0",
|
|
46
|
+
"@wordpress/components": "^45.0.0",
|
|
47
|
+
"@wordpress/compose": "^9.2.0",
|
|
48
|
+
"@wordpress/core-data": "^9.2.0",
|
|
49
|
+
"@wordpress/data": "^11.2.0",
|
|
50
|
+
"@wordpress/dom": "^5.2.0",
|
|
51
|
+
"@wordpress/element": "^10.2.0",
|
|
52
|
+
"@wordpress/hooks": "^5.2.0",
|
|
53
|
+
"@wordpress/i18n": "^7.2.0",
|
|
54
|
+
"@wordpress/icons": "^21.0.0",
|
|
55
|
+
"@wordpress/is-shallow-equal": "^6.2.0",
|
|
56
|
+
"@wordpress/keyboard-shortcuts": "^6.2.0",
|
|
57
|
+
"@wordpress/keycodes": "^5.2.0",
|
|
58
|
+
"@wordpress/media-utils": "^6.2.0",
|
|
59
|
+
"@wordpress/preferences": "^5.2.0",
|
|
60
|
+
"@wordpress/private-apis": "^3.2.0",
|
|
61
|
+
"@wordpress/theme": "^5.0.0",
|
|
62
|
+
"@wordpress/ui": "^0.27.0",
|
|
63
|
+
"@wordpress/widgets": "^5.2.0",
|
|
64
64
|
"clsx": "^2.1.1",
|
|
65
65
|
"fast-deep-equal": "^3.1.3"
|
|
66
66
|
},
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@testing-library/dom": "^10.4.2",
|
|
69
69
|
"@testing-library/react": "^16.3.3",
|
|
70
70
|
"@testing-library/user-event": "^14.6.8",
|
|
71
|
-
"vitest": "^5.0
|
|
71
|
+
"vitest": "^5.1.0"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"react": "^18 || ^19",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "1000cdf1dffd5b5e69f75cc4360aa76db8252264"
|
|
81
81
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
createPortal,
|
|
7
7
|
useMemo,
|
|
8
8
|
} from '@wordpress/element';
|
|
9
|
-
import { SlotFillProvider, Popover } from '@wordpress/components';
|
|
9
|
+
import { SlotFillProvider, Popover as WCPopover } from '@wordpress/components';
|
|
10
10
|
import { ThemeProvider } from '@wordpress/theme';
|
|
11
11
|
import { useEnableWpCompatOverlaySlot } from '@wordpress/ui';
|
|
12
12
|
import ErrorBoundary from '../error-boundary';
|
|
@@ -66,7 +66,7 @@ export default function CustomizeWidgets( {
|
|
|
66
66
|
parentContainer &&
|
|
67
67
|
createPortal(
|
|
68
68
|
<div className="customize-widgets-popover" ref={ popoverRef }>
|
|
69
|
-
<
|
|
69
|
+
<WCPopover.Slot />
|
|
70
70
|
</div>,
|
|
71
71
|
parentContainer
|
|
72
72
|
);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component } from '@wordpress/element';
|
|
2
2
|
import { speak } from '@wordpress/a11y';
|
|
3
|
-
import { __ } from '@wordpress/i18n';
|
|
3
|
+
import { __, _x } from '@wordpress/i18n';
|
|
4
4
|
import { Card, CollapsibleCard, Notice, Stack, Text } from '@wordpress/ui';
|
|
5
5
|
import { useCopyToClipboard } from '@wordpress/compose';
|
|
6
6
|
import { doAction } from '@wordpress/hooks';
|
|
@@ -168,7 +168,7 @@ export default class ErrorBoundary extends Component {
|
|
|
168
168
|
getErrorReport( error, componentStack )
|
|
169
169
|
}
|
|
170
170
|
>
|
|
171
|
-
{
|
|
171
|
+
{ _x( 'Copy error', 'button label' ) }
|
|
172
172
|
</CopyButton>
|
|
173
173
|
</Notice.Actions>
|
|
174
174
|
</Notice.Root>
|
|
@@ -21,9 +21,8 @@
|
|
|
21
21
|
// Zero bottom margin so that the fixed toolbar is right under the header.
|
|
22
22
|
margin: -15px ( -$grid-unit-15 ) ( 0 ) ( -$grid-unit-15 );
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
border-bottom: 1px solid $gray-200;
|
|
24
|
+
background: var(--wpds-color-background-surface-neutral);
|
|
25
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral);
|
|
27
26
|
|
|
28
27
|
z-index: z-index(".customize-widgets__topbar");
|
|
29
28
|
}
|
|
@@ -49,7 +48,20 @@
|
|
|
49
48
|
padding: 4px;
|
|
50
49
|
|
|
51
50
|
&.is-pressed {
|
|
52
|
-
background:
|
|
51
|
+
background: var(--wpds-color-background-interactive-neutral-strong-active);
|
|
52
|
+
|
|
53
|
+
&:is(:disabled, [aria-disabled="true"]) {
|
|
54
|
+
background: var(--wpds-color-background-interactive-neutral-strong-disabled);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@media (forced-colors: active) {
|
|
58
|
+
background: SelectedItem !important;
|
|
59
|
+
|
|
60
|
+
&:disabled,
|
|
61
|
+
&[aria-disabled="true"] {
|
|
62
|
+
background: GrayText !important;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
53
65
|
}
|
|
54
66
|
|
|
55
67
|
&:focus:not(:active) {
|
|
@@ -63,7 +75,6 @@
|
|
|
63
75
|
|
|
64
76
|
.customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon {
|
|
65
77
|
border-radius: $radius-small;
|
|
66
|
-
color: $white;
|
|
67
78
|
// Push the inserter toggle and the buttons after it to the end.
|
|
68
79
|
margin: $grid-unit-15 0 $grid-unit-15 auto;
|
|
69
80
|
|
|
@@ -20,6 +20,14 @@
|
|
|
20
20
|
background: $white;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// The panel header has its own close button, so with no tabs to show the
|
|
24
|
+
// inserter's tab list and close button row is hidden.
|
|
25
|
+
.customize-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab {
|
|
26
|
+
.block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
23
31
|
.customize-widgets-layout__inserter-panel-header {
|
|
24
32
|
display: flex;
|
|
25
33
|
justify-content: space-between;
|
|
@@ -16,6 +16,7 @@ function KeyCombination( { keyCombination, forceAriaLabel } ) {
|
|
|
16
16
|
return (
|
|
17
17
|
<kbd
|
|
18
18
|
className="customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
19
|
+
dir="ltr"
|
|
19
20
|
aria-label={ forceAriaLabel || ariaLabel }
|
|
20
21
|
>
|
|
21
22
|
{ ( Array.isArray( shortcut ) ? shortcut : [ shortcut ] ).map(
|
|
@@ -4,7 +4,7 @@ import { useDispatch } from '@wordpress/data';
|
|
|
4
4
|
import { store as preferencesStore } from '@wordpress/preferences';
|
|
5
5
|
|
|
6
6
|
export default function WelcomeGuide( { sidebar } ) {
|
|
7
|
-
const {
|
|
7
|
+
const { set: setPreference } = useDispatch( preferencesStore );
|
|
8
8
|
|
|
9
9
|
const isEntirelyBlockWidgets = sidebar
|
|
10
10
|
.getWidgets()
|
|
@@ -43,7 +43,11 @@ export default function WelcomeGuide( { sidebar } ) {
|
|
|
43
43
|
size="compact"
|
|
44
44
|
variant="primary"
|
|
45
45
|
onClick={ () =>
|
|
46
|
-
|
|
46
|
+
setPreference(
|
|
47
|
+
'core/customize-widgets',
|
|
48
|
+
'welcomeGuide',
|
|
49
|
+
false
|
|
50
|
+
)
|
|
47
51
|
}
|
|
48
52
|
>
|
|
49
53
|
{ __( 'Got it' ) }
|