@wordpress/customize-widgets 6.2.0 → 6.3.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.map +1 -1
- package/build/components/customize-widgets/index.cjs +13 -11
- package/build/components/customize-widgets/index.cjs.map +1 -1
- package/build/components/customize-widgets/use-clear-selected-block.cjs.map +1 -1
- package/build/components/error-boundary/index.cjs.map +1 -1
- package/build/components/focus-control/index.cjs.map +1 -1
- package/build/components/focus-control/use-blocks-focus-control.cjs.map +1 -1
- package/build/components/header/index.cjs +23 -16
- package/build/components/header/index.cjs.map +1 -1
- package/build/components/inserter/use-inserter.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.cjs +5 -0
- package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +9 -7
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.cjs +12 -11
- package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +34 -13
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -1
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/more-menu/index.cjs +14 -9
- package/build/components/more-menu/index.cjs.map +1 -1
- package/build/components/sidebar-block-editor/index.cjs +15 -13
- package/build/components/sidebar-block-editor/index.cjs.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-adapter.cjs.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs +10 -8
- package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs.map +1 -1
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs +9 -7
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs.map +1 -1
- package/build/controls/inserter-outer-section.cjs +2 -2
- package/build/controls/inserter-outer-section.cjs.map +1 -1
- package/build/controls/sidebar-control.cjs +10 -8
- package/build/controls/sidebar-control.cjs.map +1 -1
- package/build/controls/sidebar-section.cjs +8 -6
- package/build/controls/sidebar-section.cjs.map +1 -1
- package/build/index.cjs +12 -11
- package/build/index.cjs.map +1 -1
- package/build/store/index.cjs +11 -9
- package/build/store/index.cjs.map +1 -1
- package/build/utils.cjs.map +1 -1
- package/build-module/components/focus-control/use-blocks-focus-control.mjs.map +1 -1
- package/build-module/components/header/index.mjs +12 -7
- package/build-module/components/header/index.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs +5 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs +1 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +34 -13
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -1
- package/build-module/components/more-menu/index.mjs +6 -3
- package/build-module/components/more-menu/index.mjs.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-adapter.mjs.map +1 -1
- package/build-module/controls/inserter-outer-section.mjs +3 -3
- package/build-module/controls/inserter-outer-section.mjs.map +1 -1
- package/build-module/index.mjs +1 -2
- package/build-module/index.mjs.map +1 -1
- package/build-module/utils.mjs.map +1 -1
- package/build-style/style-rtl.css +30 -29
- package/build-style/style.css +30 -29
- package/build-types/components/block-appender/index.d.ts +2 -0
- package/build-types/components/block-appender/index.d.ts.map +1 -0
- package/build-types/components/block-inspector-button/index.d.ts +7 -0
- package/build-types/components/block-inspector-button/index.d.ts.map +1 -0
- package/build-types/components/customize-widgets/index.d.ts +6 -0
- package/build-types/components/customize-widgets/index.d.ts.map +1 -0
- package/build-types/components/customize-widgets/use-clear-selected-block.d.ts +18 -0
- package/build-types/components/customize-widgets/use-clear-selected-block.d.ts.map +1 -0
- package/build-types/components/error-boundary/index.d.ts +14 -0
- package/build-types/components/error-boundary/index.d.ts.map +1 -0
- package/build-types/components/focus-control/index.d.ts +7 -0
- package/build-types/components/focus-control/index.d.ts.map +1 -0
- package/build-types/components/focus-control/use-blocks-focus-control.d.ts +2 -0
- package/build-types/components/focus-control/use-blocks-focus-control.d.ts.map +1 -0
- package/build-types/components/header/index.d.ts +9 -0
- package/build-types/components/header/index.d.ts.map +1 -0
- package/build-types/components/inserter/index.d.ts +5 -0
- package/build-types/components/inserter/index.d.ts.map +1 -0
- package/build-types/components/inserter/use-inserter.d.ts +2 -0
- package/build-types/components/inserter/use-inserter.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +3 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts +5 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts +5 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +25 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcuts/index.d.ts +11 -0
- package/build-types/components/keyboard-shortcuts/index.d.ts.map +1 -0
- package/build-types/components/more-menu/index.d.ts +2 -0
- package/build-types/components/more-menu/index.d.ts.map +1 -0
- package/build-types/components/sidebar-block-editor/index.d.ts +7 -0
- package/build-types/components/sidebar-block-editor/index.d.ts.map +1 -0
- package/build-types/components/sidebar-block-editor/sidebar-adapter.d.ts +37 -0
- package/build-types/components/sidebar-block-editor/sidebar-adapter.d.ts.map +1 -0
- package/build-types/components/sidebar-block-editor/sidebar-editor-provider.d.ts +6 -0
- package/build-types/components/sidebar-block-editor/sidebar-editor-provider.d.ts.map +1 -0
- package/build-types/components/sidebar-block-editor/use-sidebar-block-editor.d.ts +2 -0
- package/build-types/components/sidebar-block-editor/use-sidebar-block-editor.d.ts.map +1 -0
- package/build-types/components/sidebar-controls/index.d.ts +9 -0
- package/build-types/components/sidebar-controls/index.d.ts.map +1 -0
- package/build-types/components/welcome-guide/index.d.ts +4 -0
- package/build-types/components/welcome-guide/index.d.ts.map +1 -0
- package/build-types/controls/inserter-outer-section.d.ts +9 -0
- package/build-types/controls/inserter-outer-section.d.ts.map +1 -0
- package/build-types/controls/inspector-section.d.ts +17 -0
- package/build-types/controls/inspector-section.d.ts.map +1 -0
- package/build-types/controls/sidebar-control.d.ts +19 -0
- package/build-types/controls/sidebar-control.d.ts.map +1 -0
- package/build-types/controls/sidebar-section.d.ts +22 -0
- package/build-types/controls/sidebar-section.d.ts.map +1 -0
- package/build-types/filters/index.d.ts +4 -0
- package/build-types/filters/index.d.ts.map +1 -0
- package/build-types/filters/move-to-sidebar.d.ts +2 -0
- package/build-types/filters/move-to-sidebar.d.ts.map +1 -0
- package/build-types/filters/replace-media-upload.d.ts +2 -0
- package/build-types/filters/replace-media-upload.d.ts.map +1 -0
- package/build-types/filters/wide-widget-display.d.ts +2 -0
- package/build-types/filters/wide-widget-display.d.ts.map +1 -0
- package/build-types/index.d.ts +10 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +39 -0
- package/build-types/store/actions.d.ts.map +1 -0
- package/build-types/store/constants.d.ts +5 -0
- package/build-types/store/constants.d.ts.map +1 -0
- package/build-types/store/index.d.ts +9 -0
- package/build-types/store/index.d.ts.map +1 -0
- package/build-types/store/reducer.d.ts +14 -0
- package/build-types/store/reducer.d.ts.map +1 -0
- package/build-types/store/selectors.d.ts +35 -0
- package/build-types/store/selectors.d.ts.map +1 -0
- package/build-types/utils.d.ts +32 -0
- package/build-types/utils.d.ts.map +1 -0
- package/package.json +28 -28
- package/src/components/header/index.jsx +1 -1
- package/src/components/header/style.scss +12 -9
- package/src/components/header/test/index.jsdom.test.tsx +5 -0
- package/src/components/inserter/style.scss +6 -4
- package/src/components/keyboard-shortcut-help-modal/config.js +3 -0
- package/src/components/keyboard-shortcut-help-modal/index.jsx +0 -2
- package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +38 -25
- package/src/components/more-menu/index.jsx +3 -7
- package/src/components/sidebar-block-editor/style.scss +9 -0
- package/src/controls/inserter-outer-section.js +3 -3
- package/src/index.jsx +1 -4
- package/src/utils.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector-section.d.ts","sourceRoot":"","sources":["../../src/controls/inspector-section.js"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,mBAAmB;;;;;;;;;;;;;;;EAiG1C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';
|
|
2
|
+
export default function getSidebarControl(): {
|
|
3
|
+
new (...args: any[]): {
|
|
4
|
+
subscribers: Set<any>;
|
|
5
|
+
ready(): void;
|
|
6
|
+
inserter: {
|
|
7
|
+
activeElementBeforeExpanded: any;
|
|
8
|
+
isFromInternalAction: boolean;
|
|
9
|
+
open(): void;
|
|
10
|
+
close(): void;
|
|
11
|
+
} | undefined;
|
|
12
|
+
sectionInstance: any;
|
|
13
|
+
inspector: any;
|
|
14
|
+
sidebarAdapter: SidebarAdapter | undefined;
|
|
15
|
+
subscribe(callback: any): () => void;
|
|
16
|
+
onChangeSectionExpanded(expanded: any, args: any): void;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=sidebar-control.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-control.d.ts","sourceRoot":"","sources":["../../src/controls/sidebar-control.js"],"names":[],"mappings":"AACA,OAAO,cAAc,MAAM,oDAAoD,CAAC;AAMhF,MAAM,CAAC,OAAO,UAAU,iBAAiB;;;;;;;;;;;;;;;;EAkDxC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export default function getSidebarSection(): {
|
|
2
|
+
new (): {
|
|
3
|
+
ready(): void;
|
|
4
|
+
inspector: {
|
|
5
|
+
parentSection: any;
|
|
6
|
+
returnFocusWhenClose: any;
|
|
7
|
+
_isOpen: boolean;
|
|
8
|
+
get isOpen(): boolean;
|
|
9
|
+
set isOpen(value: boolean);
|
|
10
|
+
ready(): void;
|
|
11
|
+
isContextuallyActive(): boolean;
|
|
12
|
+
onChangeExpanded(expanded: any, args: any): void;
|
|
13
|
+
open({ returnFocusWhenClose }?: {}): void;
|
|
14
|
+
close(): void;
|
|
15
|
+
collapse(options: any): void;
|
|
16
|
+
triggerActiveCallbacks(): void;
|
|
17
|
+
} | undefined;
|
|
18
|
+
hasSubSectionOpened(): any;
|
|
19
|
+
onChangeExpanded(expanded: any, _args: any): void;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=sidebar-section.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebar-section.d.ts","sourceRoot":"","sources":["../../src/controls/sidebar-section.js"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,iBAAiB;;;;;;;;;;;;;;;;;;;;EAoFxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/filters/index.js"],"names":[],"mappings":"AAAA,OAAO,mBAAmB,CAAC;AAC3B,OAAO,wBAAwB,CAAC;AAChC,OAAO,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"move-to-sidebar.d.ts","sourceRoot":"","sources":["../../src/filters/move-to-sidebar.jsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace-media-upload.d.ts","sourceRoot":"","sources":["../../src/filters/replace-media-upload.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wide-widget-display.d.ts","sourceRoot":"","sources":["../../src/filters/wide-widget-display.jsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import './filters';
|
|
2
|
+
/**
|
|
3
|
+
* Initializes the widgets block editor in the customizer.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} editorName The editor name.
|
|
6
|
+
* @param {Object} blockEditorSettings Block editor settings.
|
|
7
|
+
*/
|
|
8
|
+
export declare function initialize(editorName: string, blockEditorSettings: Object): void;
|
|
9
|
+
export { store } from './store';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.jsx"],"names":[],"mappings":"AAoBA,OAAO,WAAW,CAAC;AAWnB;;;;;GAKG;AACH,wBAAgB,UAAU,CAAE,UAAU,EAH3B,MAG2B,EAAE,mBAAmB,EAFhD,MAEgD,QAyD1D;AACD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lock-unlock.d.ts","sourceRoot":"","sources":["../src/lock-unlock.js"],"names":[],"mappings":"AAEA,eAAO,MAAQ,IAAI,mDAAE,MAAM,iCAIzB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns an action object used to open/close the inserter.
|
|
3
|
+
*
|
|
4
|
+
* @param {boolean|Object} value Whether the inserter should be
|
|
5
|
+
* opened (true) or closed (false).
|
|
6
|
+
* To specify an insertion point,
|
|
7
|
+
* use an object.
|
|
8
|
+
* @param {string} value.rootClientId The root client ID to insert at.
|
|
9
|
+
* @param {number} value.insertionIndex The index to insert at.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```js
|
|
13
|
+
* import { useState } from 'react';
|
|
14
|
+
* import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';
|
|
15
|
+
* import { __ } from '@wordpress/i18n';
|
|
16
|
+
* import { useDispatch } from '@wordpress/data';
|
|
17
|
+
* import { Button } from '@wordpress/components';
|
|
18
|
+
*
|
|
19
|
+
* const ExampleComponent = () => {
|
|
20
|
+
* const { setIsInserterOpened } = useDispatch( customizeWidgetsStore );
|
|
21
|
+
* const [ isOpen, setIsOpen ] = useState( false );
|
|
22
|
+
*
|
|
23
|
+
* return (
|
|
24
|
+
* <Button
|
|
25
|
+
* onClick={ () => {
|
|
26
|
+
* setIsInserterOpened( ! isOpen );
|
|
27
|
+
* setIsOpen( ! isOpen );
|
|
28
|
+
* } }
|
|
29
|
+
* >
|
|
30
|
+
* { __( 'Open/close inserter' ) }
|
|
31
|
+
* </Button>
|
|
32
|
+
* );
|
|
33
|
+
* };
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @return {Object} Action object.
|
|
37
|
+
*/
|
|
38
|
+
export declare function setIsInserterOpened(value: boolean | Object): Object;
|
|
39
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../src/store/actions.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,mBAAmB,CAAE,KAAK,EAlC/B,OAAO,GAAC,MAkCuB,GAF9B,MAAM,CAOjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/store/constants.js"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.js"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,EAFR,MAEsD,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reducer tracking whether the inserter is open.
|
|
3
|
+
*
|
|
4
|
+
* @param {boolean|Object} state
|
|
5
|
+
* @param {Object} action
|
|
6
|
+
*/
|
|
7
|
+
declare function blockInserterPanel(state: boolean | Object | undefined, action: Object): any;
|
|
8
|
+
declare const _default: import("redux").Reducer<{
|
|
9
|
+
blockInserterPanel: typeof blockInserterPanel;
|
|
10
|
+
}, import("redux").Action<string>, Partial<{
|
|
11
|
+
blockInserterPanel: boolean | Object | undefined;
|
|
12
|
+
}>>;
|
|
13
|
+
export default _default;
|
|
14
|
+
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../src/store/reducer.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,iBAAS,kBAAkB,CAAE,KAAK,EAHvB,OAAO,GAAC,MAAM,YAGiB,EAAE,MAAM,EAFvC,MAEuC,OAMjD"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns true if the inserter is opened.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} state Global application state.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```js
|
|
8
|
+
* import { store as customizeWidgetsStore } from '@wordpress/customize-widgets';
|
|
9
|
+
* import { __ } from '@wordpress/i18n';
|
|
10
|
+
* import { useSelect } from '@wordpress/data';
|
|
11
|
+
*
|
|
12
|
+
* const ExampleComponent = () => {
|
|
13
|
+
* const { isInserterOpened } = useSelect(
|
|
14
|
+
* ( select ) => select( customizeWidgetsStore ),
|
|
15
|
+
* []
|
|
16
|
+
* );
|
|
17
|
+
*
|
|
18
|
+
* return isInserterOpened()
|
|
19
|
+
* ? __( 'Inserter is open' )
|
|
20
|
+
* : __( 'Inserter is closed.' );
|
|
21
|
+
* };
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @return {boolean} Whether the inserter is opened.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isInserterOpened(state: Object): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Get the insertion point for the inserter.
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} state Global application state.
|
|
31
|
+
*
|
|
32
|
+
* @return {Object} The root client ID and index to insert at.
|
|
33
|
+
*/
|
|
34
|
+
export declare function __experimentalGetInsertionPoint(state: Object): Object;
|
|
35
|
+
//# sourceMappingURL=selectors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../src/store/selectors.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAE,KAAK,EAtB5B,MAsB4B,GAF3B,OAAO,CAIlB;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAAE,KAAK,EAJ3C,MAI2C,GAF1C,MAAM,CAQjB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert settingId to widgetId.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} settingId The setting id.
|
|
5
|
+
* @return {string} The widget id.
|
|
6
|
+
*/
|
|
7
|
+
export declare function settingIdToWidgetId(settingId: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Transform a block to a customizable widget.
|
|
10
|
+
*
|
|
11
|
+
* @param {WPBlock} block The block to be transformed from.
|
|
12
|
+
* @param {Object} existingWidget The widget to be extended from.
|
|
13
|
+
* @return {Object} The transformed widget.
|
|
14
|
+
*/
|
|
15
|
+
export declare function blockToWidget(block: WPBlock, existingWidget?: Object): Object;
|
|
16
|
+
/**
|
|
17
|
+
* Transform a widget to a block.
|
|
18
|
+
*
|
|
19
|
+
* @param {Object} widget The widget to be transformed from.
|
|
20
|
+
* @param {string} widget.id The widget id.
|
|
21
|
+
* @param {string} widget.idBase The id base of the widget.
|
|
22
|
+
* @param {number} widget.number The number/index of the widget.
|
|
23
|
+
* @param {Object} widget.instance The instance of the widget.
|
|
24
|
+
* @return {WPBlock} The transformed block.
|
|
25
|
+
*/
|
|
26
|
+
export declare function widgetToBlock({ id, idBase, number, instance }: {
|
|
27
|
+
id: string;
|
|
28
|
+
idBase: string;
|
|
29
|
+
number: number;
|
|
30
|
+
instance: Object;
|
|
31
|
+
}): WPBlock;
|
|
32
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAE,SAAS,EAHnC,MAGmC,GAFlC,MAAM,CAajB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAE,KAAK,EAJzB,OAIyB,EAAE,cAAc,GAHzC,MAGgD,GAF/C,MAAM,CAmDjB;AAED;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAE,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,EAN5D;IAAuB,EAAE,EAAjB,MAAM,CACd;IAAuB,MAAM,EAArB,MAAM,CACd;IAAuB,MAAM,EAArB,MAAM,CACd;IAAuB,QAAQ,EAAvB,MAAM,CACd;CAE4D,GAFnD,OAAO,CAsClB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.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,38 +37,38 @@
|
|
|
37
37
|
},
|
|
38
38
|
"wpScript": true,
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@wordpress/a11y": "^5.
|
|
41
|
-
"@wordpress/admin-ui": "^3.
|
|
42
|
-
"@wordpress/base-styles": "^15.
|
|
43
|
-
"@wordpress/block-editor": "^20.
|
|
44
|
-
"@wordpress/block-library": "^12.
|
|
45
|
-
"@wordpress/blocks": "^17.
|
|
46
|
-
"@wordpress/components": "^45.
|
|
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": "^21.
|
|
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": "^5.
|
|
62
|
-
"@wordpress/ui": "^0.
|
|
63
|
-
"@wordpress/widgets": "^5.
|
|
40
|
+
"@wordpress/a11y": "^5.3.0",
|
|
41
|
+
"@wordpress/admin-ui": "^3.3.0",
|
|
42
|
+
"@wordpress/base-styles": "^15.2.0",
|
|
43
|
+
"@wordpress/block-editor": "^20.2.0",
|
|
44
|
+
"@wordpress/block-library": "^12.3.0",
|
|
45
|
+
"@wordpress/blocks": "^17.3.0",
|
|
46
|
+
"@wordpress/components": "^45.1.0",
|
|
47
|
+
"@wordpress/compose": "^9.3.0",
|
|
48
|
+
"@wordpress/core-data": "^9.3.0",
|
|
49
|
+
"@wordpress/data": "^11.3.0",
|
|
50
|
+
"@wordpress/dom": "^5.3.0",
|
|
51
|
+
"@wordpress/element": "^10.3.0",
|
|
52
|
+
"@wordpress/hooks": "^5.3.0",
|
|
53
|
+
"@wordpress/i18n": "^7.3.0",
|
|
54
|
+
"@wordpress/icons": "^21.1.0",
|
|
55
|
+
"@wordpress/is-shallow-equal": "^6.3.0",
|
|
56
|
+
"@wordpress/keyboard-shortcuts": "^6.3.0",
|
|
57
|
+
"@wordpress/keycodes": "^5.3.0",
|
|
58
|
+
"@wordpress/media-utils": "^6.3.0",
|
|
59
|
+
"@wordpress/preferences": "^5.3.0",
|
|
60
|
+
"@wordpress/private-apis": "^3.3.0",
|
|
61
|
+
"@wordpress/theme": "^5.1.0",
|
|
62
|
+
"@wordpress/ui": "^0.28.0",
|
|
63
|
+
"@wordpress/widgets": "^5.3.0",
|
|
64
64
|
"clsx": "^2.1.1",
|
|
65
65
|
"fast-deep-equal": "^3.1.3"
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@testing-library/dom": "^10.4.2",
|
|
69
69
|
"@testing-library/react": "^16.3.3",
|
|
70
|
-
"@testing-library/user-event": "^14.6.
|
|
71
|
-
"vitest": "^5.1.
|
|
70
|
+
"@testing-library/user-event": "^14.6.13",
|
|
71
|
+
"vitest": "^5.1.1"
|
|
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": "7f19202f61aeba8f4bdce892a1a0df485ad76e2b"
|
|
81
81
|
}
|
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
display: flex;
|
|
18
|
-
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: $grid-unit-10;
|
|
20
|
+
// Keep the focus ring of the options menu toggle within the customizer
|
|
21
|
+
// sidebar, which clips its overflow.
|
|
22
|
+
padding-inline-end: $grid-unit-15;
|
|
19
23
|
|
|
20
24
|
// Offset the customizer's sidebar padding.
|
|
21
25
|
// Zero bottom margin so that the fixed toolbar is right under the header.
|
|
@@ -29,20 +33,19 @@
|
|
|
29
33
|
|
|
30
34
|
.customize-widgets-header-toolbar {
|
|
31
35
|
display: flex;
|
|
36
|
+
flex: 1;
|
|
32
37
|
border: none;
|
|
33
|
-
width: 100%;
|
|
34
38
|
align-items: center;
|
|
35
39
|
gap: $grid-unit-10;
|
|
36
|
-
// Keep the outset focus ring of the first
|
|
37
|
-
//
|
|
38
|
-
padding:
|
|
40
|
+
// Keep the outset focus ring of the first button within the customizer
|
|
41
|
+
// sidebar, which clips its overflow.
|
|
42
|
+
padding-inline-start: $grid-unit-15;
|
|
39
43
|
|
|
40
44
|
// The Toolbar component adds different styles to buttons, so we reset them
|
|
41
45
|
// here to the original button styles, consistent with the document tools
|
|
42
46
|
// of the other editors.
|
|
43
47
|
// Specificity bump needed to offset https://github.com/WordPress/gutenberg/blob/8ea29cb04412c80c9adf7c1db0e816d6a0ac1232/packages/components/src/toolbar/style.scss#L76
|
|
44
|
-
> .components-button.has-icon.has-icon.has-icon
|
|
45
|
-
> .components-dropdown > .components-button.has-icon.has-icon {
|
|
48
|
+
> .components-button.has-icon.has-icon.has-icon {
|
|
46
49
|
height: $button-size-compact;
|
|
47
50
|
min-width: $button-size-compact;
|
|
48
51
|
padding: 4px;
|
|
@@ -55,7 +58,7 @@
|
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
@media (forced-colors: active) {
|
|
58
|
-
background:
|
|
61
|
+
background: Highlight !important;
|
|
59
62
|
|
|
60
63
|
&:disabled,
|
|
61
64
|
&[aria-disabled="true"] {
|
|
@@ -75,7 +78,7 @@
|
|
|
75
78
|
|
|
76
79
|
.customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon {
|
|
77
80
|
border-radius: $radius-small;
|
|
78
|
-
// Push the inserter toggle
|
|
81
|
+
// Push the inserter toggle to the end.
|
|
79
82
|
margin: $grid-unit-15 0 $grid-unit-15 auto;
|
|
80
83
|
|
|
81
84
|
svg {
|
|
@@ -70,6 +70,11 @@ describe( 'Header', () => {
|
|
|
70
70
|
screen.getByRole( 'button', { name: 'Add block' } )
|
|
71
71
|
).toHaveFocus();
|
|
72
72
|
await user.keyboard( '{ArrowRight}' );
|
|
73
|
+
expect( undoButton ).toHaveFocus();
|
|
74
|
+
|
|
75
|
+
// The options menu toggle is outside the toolbar, and is the next
|
|
76
|
+
// tab stop.
|
|
77
|
+
await user.tab();
|
|
73
78
|
expect(
|
|
74
79
|
screen.getByRole( 'button', { name: 'Options' } )
|
|
75
80
|
).toHaveFocus();
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
@use "@wordpress/base-styles/colors" as *;
|
|
2
1
|
@use "@wordpress/base-styles/variables" as *;
|
|
3
2
|
|
|
4
3
|
#customize-sidebar-outer-content {
|
|
@@ -17,7 +16,8 @@
|
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
.customize-widgets-layout__inserter-panel {
|
|
20
|
-
background:
|
|
19
|
+
background: var(--wpds-color-background-surface-neutral-strong);
|
|
20
|
+
color: var(--wpds-color-foreground-content-neutral);
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
// The panel header has its own close button, so with no tabs to show the
|
|
@@ -36,16 +36,18 @@
|
|
|
36
36
|
// Match the "wp-full-overlay-header" height in core, plus the 1px border.
|
|
37
37
|
height: 46px;
|
|
38
38
|
box-sizing: border-box;
|
|
39
|
-
border-bottom: $border-width solid
|
|
39
|
+
border-bottom: $border-width solid var(--wpds-color-stroke-surface-neutral);
|
|
40
40
|
|
|
41
41
|
.customize-widgets-layout__inserter-panel-header-title {
|
|
42
42
|
margin: 0;
|
|
43
|
+
// Override the admin heading color.
|
|
44
|
+
color: inherit;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
.block-editor-inserter__quick-inserter {
|
|
47
49
|
.block-editor-inserter__panel-content {
|
|
48
50
|
// To fix quick inserter doesn't have background.
|
|
49
|
-
background:
|
|
51
|
+
background: var(--wpds-color-background-surface-neutral-strong);
|
|
50
52
|
}
|
|
51
53
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __ } from '@wordpress/i18n';
|
|
2
2
|
|
|
3
|
+
/** @type {Array<import('react').ComponentProps<typeof import('./shortcut').default>>} */
|
|
3
4
|
export const textFormattingShortcuts = [
|
|
4
5
|
{
|
|
5
6
|
keyCombination: { modifier: 'primary', character: 'b' },
|
|
@@ -19,6 +20,8 @@ export const textFormattingShortcuts = [
|
|
|
19
20
|
},
|
|
20
21
|
{
|
|
21
22
|
keyCombination: { character: '[[' },
|
|
23
|
+
/* translators: The keyboard sequence [[, pressing the left bracket key twice. */
|
|
24
|
+
ariaLabel: __( 'Left bracket twice' ),
|
|
22
25
|
description: __( 'Insert a link to a post or page.' ),
|
|
23
26
|
},
|
|
24
27
|
{
|
|
@@ -128,8 +128,6 @@ export default function KeyboardShortcutHelpModal( {
|
|
|
128
128
|
description: __(
|
|
129
129
|
'Change the block type after adding a new paragraph.'
|
|
130
130
|
),
|
|
131
|
-
/* translators: The forward-slash character. e.g. '/'. */
|
|
132
|
-
ariaLabel: __( 'Forward-slash' ),
|
|
133
131
|
},
|
|
134
132
|
] }
|
|
135
133
|
/>
|
|
@@ -1,44 +1,57 @@
|
|
|
1
1
|
import { Fragment } from '@wordpress/element';
|
|
2
2
|
import { displayShortcutList, shortcutAriaLabel } from '@wordpress/keycodes';
|
|
3
|
+
import { VisuallyHidden } from '@wordpress/ui';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {Object} ShortcutKeyCombination
|
|
7
|
+
* @property {string} character Shortcut key.
|
|
8
|
+
* @property {import('@wordpress/keycodes').WPKeycodeModifier | null} [modifier] Optional shortcut modifier.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @param {Object} props Component props.
|
|
13
|
+
* @param {ShortcutKeyCombination} props.keyCombination Shortcut to display.
|
|
14
|
+
* @param {string} [props.ariaLabel] Custom readable shortcut label.
|
|
15
|
+
*/
|
|
16
|
+
function KeyCombination( { keyCombination, ariaLabel } ) {
|
|
17
|
+
const { character, modifier } = keyCombination;
|
|
18
|
+
const normalizedModifier = modifier ?? 'undefined';
|
|
19
|
+
const keys = displayShortcutList[ normalizedModifier ]( character );
|
|
15
20
|
|
|
16
21
|
return (
|
|
17
22
|
<kbd
|
|
18
23
|
className="customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination"
|
|
19
24
|
dir="ltr"
|
|
20
|
-
aria-label={ forceAriaLabel || ariaLabel }
|
|
21
25
|
>
|
|
22
|
-
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
<VisuallyHidden render={ <span /> }>
|
|
27
|
+
{ ariaLabel ||
|
|
28
|
+
shortcutAriaLabel[ normalizedModifier ]( character ) }
|
|
29
|
+
</VisuallyHidden>
|
|
30
|
+
<span aria-hidden="true">
|
|
31
|
+
{ keys.map( ( key, index ) =>
|
|
32
|
+
key === '+' && index < keys.length - 1 ? (
|
|
33
|
+
<Fragment key={ index }>{ key }</Fragment>
|
|
34
|
+
) : (
|
|
29
35
|
<kbd
|
|
30
36
|
key={ index }
|
|
31
37
|
className="customize-widgets-keyboard-shortcut-help-modal__shortcut-key"
|
|
32
38
|
>
|
|
33
|
-
{
|
|
39
|
+
{ key }
|
|
34
40
|
</kbd>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
41
|
+
)
|
|
42
|
+
) }
|
|
43
|
+
</span>
|
|
38
44
|
</kbd>
|
|
39
45
|
);
|
|
40
46
|
}
|
|
41
47
|
|
|
48
|
+
/**
|
|
49
|
+
* @param {Object} props Component props.
|
|
50
|
+
* @param {string} props.description Description of the shortcut action.
|
|
51
|
+
* @param {ShortcutKeyCombination} props.keyCombination Primary shortcut.
|
|
52
|
+
* @param {ShortcutKeyCombination[]} [props.aliases] Alternative shortcuts.
|
|
53
|
+
* @param {string} [props.ariaLabel] Custom readable shortcut label.
|
|
54
|
+
*/
|
|
42
55
|
function Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {
|
|
43
56
|
return (
|
|
44
57
|
<>
|
|
@@ -48,12 +61,12 @@ function Shortcut( { description, keyCombination, aliases = [], ariaLabel } ) {
|
|
|
48
61
|
<div className="customize-widgets-keyboard-shortcut-help-modal__shortcut-term">
|
|
49
62
|
<KeyCombination
|
|
50
63
|
keyCombination={ keyCombination }
|
|
51
|
-
|
|
64
|
+
ariaLabel={ ariaLabel }
|
|
52
65
|
/>
|
|
53
66
|
{ aliases.map( ( alias, index ) => (
|
|
54
67
|
<KeyCombination
|
|
55
68
|
keyCombination={ alias }
|
|
56
|
-
|
|
69
|
+
ariaLabel={ ariaLabel }
|
|
57
70
|
key={ index }
|
|
58
71
|
/>
|
|
59
72
|
) ) }
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MenuGroup,
|
|
3
|
-
MenuItem,
|
|
4
|
-
ToolbarDropdownMenu,
|
|
5
|
-
} from '@wordpress/components';
|
|
1
|
+
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
6
2
|
import { useDispatch } from '@wordpress/data';
|
|
7
3
|
import { useState } from '@wordpress/element';
|
|
8
4
|
import { __, _x } from '@wordpress/i18n';
|
|
@@ -33,7 +29,7 @@ export default function MoreMenu() {
|
|
|
33
29
|
|
|
34
30
|
return (
|
|
35
31
|
<>
|
|
36
|
-
<
|
|
32
|
+
<DropdownMenu
|
|
37
33
|
icon={ moreVertical }
|
|
38
34
|
label={ __( 'Options' ) }
|
|
39
35
|
popoverProps={ {
|
|
@@ -119,7 +115,7 @@ export default function MoreMenu() {
|
|
|
119
115
|
</MenuGroup>
|
|
120
116
|
</>
|
|
121
117
|
) }
|
|
122
|
-
</
|
|
118
|
+
</DropdownMenu>
|
|
123
119
|
<KeyboardShortcutHelpModal
|
|
124
120
|
isModalActive={ isKeyboardShortcutsModalActive }
|
|
125
121
|
toggleModal={ toggleKeyboardShortcutsModal }
|
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
@use "@wordpress/base-styles/variables" as *;
|
|
1
2
|
@use "@wordpress/base-styles/z-index" as *;
|
|
2
3
|
|
|
4
|
+
// The fixed block toolbar, rendered right after the header in top toolbar mode
|
|
5
|
+
// and on small screens.
|
|
6
|
+
.customize-widgets-header + .block-editor-block-contextual-toolbar {
|
|
7
|
+
// Offset the customizer's sidebar padding, like the header.
|
|
8
|
+
margin-inline: -$grid-unit-15;
|
|
9
|
+
width: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
3
12
|
// stylelint-disable selector-class-pattern -- WordPress Customizer control class names use underscores by convention.
|
|
4
13
|
.customize-control-sidebar_block_editor .block-editor-block-list__block-popover {
|
|
5
14
|
// FloatingUI library used in Popover component forces us to have an "absolute" inline style.
|