@wordpress/customize-widgets 4.10.0 → 4.12.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 +4 -0
- package/build/components/block-inspector-button/index.js +5 -6
- package/build/components/block-inspector-button/index.js.map +1 -1
- package/build/components/customize-widgets/index.js +5 -6
- package/build/components/customize-widgets/index.js.map +1 -1
- package/build/components/error-boundary/index.js +4 -5
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/focus-control/index.js +5 -6
- package/build/components/focus-control/index.js.map +1 -1
- package/build/components/focus-control/use-blocks-focus-control.js +1 -1
- package/build/components/focus-control/use-blocks-focus-control.js.map +1 -1
- package/build/components/header/index.js +7 -8
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter/index.js +3 -4
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +41 -50
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/keyboard-shortcuts/index.js +5 -6
- package/build/components/keyboard-shortcuts/index.js.map +1 -1
- package/build/components/sidebar-block-editor/index.js +19 -27
- package/build/components/sidebar-block-editor/index.js.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-adapter.js +3 -7
- package/build/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js +5 -6
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build/components/sidebar-controls/index.js +5 -6
- package/build/components/sidebar-controls/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +3 -4
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/controls/inserter-outer-section.js +2 -2
- package/build/controls/inserter-outer-section.js.map +1 -1
- package/build/controls/inspector-section.js +3 -4
- package/build/controls/inspector-section.js.map +1 -1
- package/build/controls/sidebar-control.js +2 -2
- package/build/controls/sidebar-control.js.map +1 -1
- package/build/controls/sidebar-section.js +2 -6
- package/build/controls/sidebar-section.js.map +1 -1
- package/build/filters/move-to-sidebar.js +2 -2
- package/build/filters/move-to-sidebar.js.map +1 -1
- package/build/filters/wide-widget-display.js +2 -2
- package/build/filters/wide-widget-display.js.map +1 -1
- package/build/store/reducer.js +1 -4
- package/build/store/reducer.js.map +1 -1
- package/build/utils.js +8 -10
- package/build/utils.js.map +1 -1
- package/build-module/components/block-inspector-button/index.js +5 -6
- package/build-module/components/block-inspector-button/index.js.map +1 -1
- package/build-module/components/customize-widgets/index.js +5 -6
- package/build-module/components/customize-widgets/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +4 -5
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/focus-control/index.js +5 -6
- package/build-module/components/focus-control/index.js.map +1 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js +1 -1
- package/build-module/components/focus-control/use-blocks-focus-control.js.map +1 -1
- package/build-module/components/header/index.js +7 -8
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter/index.js +3 -4
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +3 -4
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +39 -48
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +10 -12
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcuts/index.js +5 -6
- package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/index.js +19 -27
- package/build-module/components/sidebar-block-editor/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js +3 -7
- package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +5 -6
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build-module/components/sidebar-controls/index.js +5 -6
- package/build-module/components/sidebar-controls/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +3 -4
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/controls/inserter-outer-section.js +2 -2
- package/build-module/controls/inserter-outer-section.js.map +1 -1
- package/build-module/controls/inspector-section.js +3 -4
- package/build-module/controls/inspector-section.js.map +1 -1
- package/build-module/controls/sidebar-control.js +2 -2
- package/build-module/controls/sidebar-control.js.map +1 -1
- package/build-module/controls/sidebar-section.js +2 -6
- package/build-module/controls/sidebar-section.js.map +1 -1
- package/build-module/filters/move-to-sidebar.js +2 -2
- package/build-module/filters/move-to-sidebar.js.map +1 -1
- package/build-module/filters/wide-widget-display.js +2 -2
- package/build-module/filters/wide-widget-display.js.map +1 -1
- package/build-module/store/reducer.js +1 -4
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/utils.js +8 -10
- package/build-module/utils.js.map +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +22 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"names":["__","getInspectorSection","getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","reduceMotionMediaQuery","matchMedia","isReducedMotion","matches","addEventListener","event","SidebarSection","Section","ready","InspectorSection","inspector","id","title","parentSection","customizeAction","params","join","section","add","contentContainer","classList","hasSubSectionOpened","expanded","onChangeExpanded","_args","controls","args","completeCallback","forEach","control","onChangeSectionExpanded","manualTransition","addClass","removeClass","closest","handleTransitionEnd","one"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EA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,QAAF,EAAYE,KAAZ,EAAoB;AACnC,YAAMC,QAAQ,GAAG,KAAKA,QAAL,EAAjB;AACA,YAAMC,IAAI,GAAG,EACZ,GAAGF,KADS;;AAEZG,QAAAA,gBAAgB,GAAG;
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"names":["__","getInspectorSection","getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","reduceMotionMediaQuery","matchMedia","isReducedMotion","matches","addEventListener","event","SidebarSection","Section","ready","InspectorSection","inspector","id","title","parentSection","customizeAction","params","join","section","add","contentContainer","classList","hasSubSectionOpened","expanded","onChangeExpanded","_args","controls","args","completeCallback","forEach","control","onChangeSectionExpanded","manualTransition","addClass","removeClass","closest","handleTransitionEnd","one"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,mBAAP,MAAgC,qBAAhC;;AAEA,MAAMC,qBAAqB,GAAKC,SAAF,IAC5B,qBAAqBA,SAAW,EADlC;;AAGA,eAAe,SAASC,iBAAT,GAA6B;AAC3C,QAAM;AACLC,IAAAA,EAAE,EAAE;AAAEC,MAAAA;AAAF;AADC,MAEFC,MAFJ;AAIA,QAAMC,sBAAsB,GAAGD,MAAM,CAACE,UAAP,CAC9B,kCAD8B,CAA/B;AAGA,MAAIC,eAAe,GAAGF,sBAAsB,CAACG,OAA7C;AACAH,EAAAA,sBAAsB,CAACI,gBAAvB,CAAyC,QAAzC,EAAqDC,KAAF,IAAa;AAC/DH,IAAAA,eAAe,GAAGG,KAAK,CAACF,OAAxB;AACA,GAFD;AAIA,SAAO,MAAMG,cAAN,SAA6BR,SAAS,CAACS,OAAvC,CAA+C;AACrDC,IAAAA,KAAK,GAAG;AACP,YAAMC,gBAAgB,GAAGhB,mBAAmB,EAA5C;AACA,WAAKiB,SAAL,GAAiB,IAAID,gBAAJ,CAChBf,qBAAqB,CAAE,KAAKiB,EAAP,CADL,EAEhB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F,CACW,kBADX,EAEEF,QAFF,CAEY,cAFZ;AAGA,eAAKb,gBAAL,CAAsBc,WAAtB,CAAmC,MAAnC;AACA;;AAED,cAAME,mBAAmB,GAAG,MAAM;AACjC,eAAKhB,gBAAL,CAAsBc,WAAtB,CAAmC,MAAnC;AACAP,UAAAA,IAAI,CAACC,gBAAL;AACA,SAHD;;AAKA,YAAKzB,eAAL,EAAuB;AACtBiC,UAAAA,mBAAmB;AACnB,SAFD,MAEO;AACN,eAAKhB,gBAAL,CAAsBiB,GAAtB,CACC,eADD,EAECD,mBAFD;AAIA;AACD,OA/BD,MA+BO;AACN,cAAMZ,gBAAN,CAAwBD,QAAxB,EAAkCI,IAAlC;AACA;AACD;;AArEoD,GAAtD;AAuEA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport getInspectorSection from './inspector-section';\n\nconst getInspectorSectionId = ( sidebarId ) =>\n\t`widgets-inspector-${ sidebarId }`;\n\nexport default function getSidebarSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst reduceMotionMediaQuery = window.matchMedia(\n\t\t'(prefers-reduced-motion: reduce)'\n\t);\n\tlet isReducedMotion = reduceMotionMediaQuery.matches;\n\treduceMotionMediaQuery.addEventListener( 'change', ( event ) => {\n\t\tisReducedMotion = event.matches;\n\t} );\n\n\treturn class SidebarSection extends customize.Section {\n\t\tready() {\n\t\t\tconst InspectorSection = getInspectorSection();\n\t\t\tthis.inspector = new InspectorSection(\n\t\t\t\tgetInspectorSectionId( this.id ),\n\t\t\t\t{\n\t\t\t\t\ttitle: __( 'Block Settings' ),\n\t\t\t\t\tparentSection: this,\n\t\t\t\t\tcustomizeAction: [\n\t\t\t\t\t\t__( 'Customizing' ),\n\t\t\t\t\t\t__( 'Widgets' ),\n\t\t\t\t\t\tthis.params.title,\n\t\t\t\t\t].join( ' ▸ ' ),\n\t\t\t\t}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inspector );\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets__sidebar-section'\n\t\t\t);\n\t\t}\n\t\thasSubSectionOpened() {\n\t\t\treturn this.inspector.expanded();\n\t\t}\n\t\tonChangeExpanded( expanded, _args ) {\n\t\t\tconst controls = this.controls();\n\t\t\tconst args = {\n\t\t\t\t..._args,\n\t\t\t\tcompleteCallback() {\n\t\t\t\t\tcontrols.forEach( ( control ) => {\n\t\t\t\t\t\tcontrol.onChangeSectionExpanded?.( expanded, args );\n\t\t\t\t\t} );\n\t\t\t\t\t_args.completeCallback?.();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif ( args.manualTransition ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.contentContainer.addClass( [ 'busy', 'open' ] );\n\t\t\t\t\tthis.contentContainer.removeClass( 'is-sub-section-open' );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addClass( [\n\t\t\t\t\t\t'busy',\n\t\t\t\t\t\t'is-sub-section-open',\n\t\t\t\t\t] );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.removeClass( 'open' );\n\t\t\t\t}\n\n\t\t\t\tconst handleTransitionEnd = () => {\n\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\targs.completeCallback();\n\t\t\t\t};\n\n\t\t\t\tif ( isReducedMotion ) {\n\t\t\t\t\thandleTransitionEnd();\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.one(\n\t\t\t\t\t\t'transitionend',\n\t\t\t\t\t\thandleTransitionEnd\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.onChangeExpanded( expanded, args );\n\t\t\t}\n\t\t}\n\t};\n}\n"]}
|
|
@@ -19,7 +19,7 @@ const withMoveToSidebarToolbarItem = createHigherOrderComponent(BlockEdit => pro
|
|
|
19
19
|
let widgetId = getWidgetIdFromBlock(props);
|
|
20
20
|
const sidebarControls = useSidebarControls();
|
|
21
21
|
const activeSidebarControl = useActiveSidebarControl();
|
|
22
|
-
const hasMultipleSidebars =
|
|
22
|
+
const hasMultipleSidebars = sidebarControls?.length > 1;
|
|
23
23
|
const blockName = props.name;
|
|
24
24
|
const clientId = props.clientId;
|
|
25
25
|
const canInsertBlockInSidebar = useSelect(select => {
|
|
@@ -67,7 +67,7 @@ const withMoveToSidebarToolbarItem = createHigherOrderComponent(BlockEdit => pro
|
|
|
67
67
|
name: sidebarControl.params.label,
|
|
68
68
|
description: sidebarControl.params.description
|
|
69
69
|
})),
|
|
70
|
-
currentWidgetAreaId: activeSidebarControl
|
|
70
|
+
currentWidgetAreaId: activeSidebarControl?.id,
|
|
71
71
|
onSelect: moveToSidebar
|
|
72
72
|
})));
|
|
73
73
|
}, 'withMoveToSidebarToolbarItem');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["BlockControls","store","blockEditorStore","createHigherOrderComponent","useSelect","useDispatch","addFilter","MoveToWidgetArea","getWidgetIdFromBlock","useSidebarControls","useActiveSidebarControl","useFocusControl","blockToWidget","withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,gBAAT,EAA2BC,oBAA3B,QAAuD,oBAAvD;AAEA;AACA;AACA;;AACA,SACCC,kBADD,EAECC,uBAFD,QAGO,gCAHP;AAIA,SAASC,eAAT,QAAgC,6BAAhC;AACA,SAASC,aAAT,QAA8B,UAA9B;AAEA,MAAMC,4BAA4B,GAAGV,0BAA0B,CAC5DW,SAAF,IAAmBC,KAAF,IAAa;AAC7B,MAAIC,QAAQ,GAAGR,oBAAoB,CAAEO,KAAF,CAAnC;AACA,QAAME,eAAe,GAAGR,kBAAkB,EAA1C;AACA,QAAMS,oBAAoB,GAAGR,uBAAuB,EAApD;AACA,QAAMS,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"names":["BlockControls","store","blockEditorStore","createHigherOrderComponent","useSelect","useDispatch","addFilter","MoveToWidgetArea","getWidgetIdFromBlock","useSidebarControls","useActiveSidebarControl","useFocusControl","blockToWidget","withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","map","params","label","description"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,aADD,EAECC,KAAK,IAAIC,gBAFV,QAGO,yBAHP;AAIA,SAASC,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,gBAAT,EAA2BC,oBAA3B,QAAuD,oBAAvD;AAEA;AACA;AACA;;AACA,SACCC,kBADD,EAECC,uBAFD,Q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BlockControls,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { addFilter } from '@wordpress/hooks';\nimport { MoveToWidgetArea, getWidgetIdFromBlock } from '@wordpress/widgets';\n\n/**\n * Internal dependencies\n */\nimport {\n\tuseSidebarControls,\n\tuseActiveSidebarControl,\n} from '../components/sidebar-controls';\nimport { useFocusControl } from '../components/focus-control';\nimport { blockToWidget } from '../utils';\n\nconst withMoveToSidebarToolbarItem = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tlet widgetId = getWidgetIdFromBlock( props );\n\t\tconst sidebarControls = useSidebarControls();\n\t\tconst activeSidebarControl = useActiveSidebarControl();\n\t\tconst hasMultipleSidebars = sidebarControls?.length > 1;\n\t\tconst blockName = props.name;\n\t\tconst clientId = props.clientId;\n\t\tconst canInsertBlockInSidebar = useSelect(\n\t\t\t( select ) => {\n\t\t\t\t// Use an empty string to represent the root block list, which\n\t\t\t\t// in the customizer editor represents a sidebar/widget area.\n\t\t\t\treturn select( blockEditorStore ).canInsertBlockType(\n\t\t\t\t\tblockName,\n\t\t\t\t\t''\n\t\t\t\t);\n\t\t\t},\n\t\t\t[ blockName ]\n\t\t);\n\t\tconst block = useSelect(\n\t\t\t( select ) => select( blockEditorStore ).getBlock( clientId ),\n\t\t\t[ clientId ]\n\t\t);\n\t\tconst { removeBlock } = useDispatch( blockEditorStore );\n\t\tconst [ , focusWidget ] = useFocusControl();\n\n\t\tfunction moveToSidebar( sidebarControlId ) {\n\t\t\tconst newSidebarControl = sidebarControls.find(\n\t\t\t\t( sidebarControl ) => sidebarControl.id === sidebarControlId\n\t\t\t);\n\n\t\t\tif ( widgetId ) {\n\t\t\t\t/**\n\t\t\t\t * If there's a widgetId, move it to the other sidebar.\n\t\t\t\t */\n\t\t\t\tconst oldSetting = activeSidebarControl.setting;\n\t\t\t\tconst newSetting = newSidebarControl.setting;\n\n\t\t\t\toldSetting( oldSetting().filter( ( id ) => id !== widgetId ) );\n\t\t\t\tnewSetting( [ ...newSetting(), widgetId ] );\n\t\t\t} else {\n\t\t\t\t/**\n\t\t\t\t * If there isn't a widgetId, it's most likely a inner block.\n\t\t\t\t * First, remove the block in the original sidebar,\n\t\t\t\t * then, create a new widget in the new sidebar and get back its widgetId.\n\t\t\t\t */\n\t\t\t\tconst sidebarAdapter = newSidebarControl.sidebarAdapter;\n\n\t\t\t\tremoveBlock( clientId );\n\t\t\t\tconst addedWidgetIds = sidebarAdapter.setWidgets( [\n\t\t\t\t\t...sidebarAdapter.getWidgets(),\n\t\t\t\t\tblockToWidget( block ),\n\t\t\t\t] );\n\t\t\t\t// The last non-null id is the added widget's id.\n\t\t\t\twidgetId = addedWidgetIds.reverse().find( ( id ) => !! id );\n\t\t\t}\n\n\t\t\t// Move focus to the moved widget and expand the sidebar.\n\t\t\tfocusWidget( widgetId );\n\t\t}\n\n\t\treturn (\n\t\t\t<>\n\t\t\t\t<BlockEdit { ...props } />\n\t\t\t\t{ hasMultipleSidebars && canInsertBlockInSidebar && (\n\t\t\t\t\t<BlockControls>\n\t\t\t\t\t\t<MoveToWidgetArea\n\t\t\t\t\t\t\twidgetAreas={ sidebarControls.map(\n\t\t\t\t\t\t\t\t( sidebarControl ) => ( {\n\t\t\t\t\t\t\t\t\tid: sidebarControl.id,\n\t\t\t\t\t\t\t\t\tname: sidebarControl.params.label,\n\t\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\tsidebarControl.params.description,\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\tcurrentWidgetAreaId={ activeSidebarControl?.id }\n\t\t\t\t\t\t\tonSelect={ moveToSidebar }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</BlockControls>\n\t\t\t\t) }\n\t\t\t</>\n\t\t);\n\t},\n\t'withMoveToSidebarToolbarItem'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/block-edit',\n\twithMoveToSidebarToolbarItem\n);\n"]}
|
|
@@ -10,12 +10,12 @@ const {
|
|
|
10
10
|
wp
|
|
11
11
|
} = window;
|
|
12
12
|
const withWideWidgetDisplay = createHigherOrderComponent(BlockEdit => props => {
|
|
13
|
-
var _wp$customize$Widgets
|
|
13
|
+
var _wp$customize$Widgets;
|
|
14
14
|
|
|
15
15
|
const {
|
|
16
16
|
idBase
|
|
17
17
|
} = props.attributes;
|
|
18
|
-
const isWide = (_wp$customize$Widgets =
|
|
18
|
+
const isWide = (_wp$customize$Widgets = wp.customize.Widgets.data.availableWidgets.find(widget => widget.id_base === idBase)?.is_wide) !== null && _wp$customize$Widgets !== void 0 ? _wp$customize$Widgets : false;
|
|
19
19
|
return createElement(BlockEdit, _extends({}, props, {
|
|
20
20
|
isWide: isWide
|
|
21
21
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/wide-widget-display.js"],"names":["createHigherOrderComponent","addFilter","wp","window","withWideWidgetDisplay","BlockEdit","props","idBase","attributes","isWide","customize","Widgets","data","availableWidgets","find","widget","id_base","is_wide"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAASC,MAAf;AAEA,MAAMC,qBAAqB,GAAGJ,0BAA0B,CACrDK,SAAF,IAAmBC,KAAF,IAAa;AAAA;;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAaD,KAAK,CAACE,UAAzB;AACA,QAAMC,MAAM,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/filters/wide-widget-display.js"],"names":["createHigherOrderComponent","addFilter","wp","window","withWideWidgetDisplay","BlockEdit","props","idBase","attributes","isWide","customize","Widgets","data","availableWidgets","find","widget","id_base","is_wide"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,0BAAT,QAA2C,oBAA3C;AACA,SAASC,SAAT,QAA0B,kBAA1B;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAASC,MAAf;AAEA,MAAMC,qBAAqB,GAAGJ,0BAA0B,CACrDK,SAAF,IAAmBC,KAAF,IAAa;AAAA;;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAaD,KAAK,CAACE,UAAzB;AACA,QAAMC,MAAM,4BACXP,EAAE,CAACQ,SAAH,CAAaC,OAAb,CAAqBC,IAArB,CAA0BC,gBAA1B,CAA2CC,IAA3C,CACGC,MAAF,IAAcA,MAAM,CAACC,OAAP,KAAmBT,MADlC,GAEGU,OAHQ,yEAGG,KAHf;AAKA,SAAO,cAAC,SAAD,eAAgBX,KAAhB;AAAwB,IAAA,MAAM,EAAGG;AAAjC,KAAP;AACA,CATsD,EAUvD,uBAVuD,CAAxD;AAaAR,SAAS,CACR,kBADQ,EAER,4CAFQ,EAGRG,qBAHQ,CAAT","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport { addFilter } from '@wordpress/hooks';\n\nconst { wp } = window;\n\nconst withWideWidgetDisplay = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => {\n\t\tconst { idBase } = props.attributes;\n\t\tconst isWide =\n\t\t\twp.customize.Widgets.data.availableWidgets.find(\n\t\t\t\t( widget ) => widget.id_base === idBase\n\t\t\t)?.is_wide ?? false;\n\n\t\treturn <BlockEdit { ...props } isWide={ isWide } />;\n\t},\n\t'withWideWidgetDisplay'\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/customize-widgets/wide-widget-display',\n\twithWideWidgetDisplay\n);\n"]}
|
|
@@ -9,10 +9,7 @@ import { combineReducers } from '@wordpress/data';
|
|
|
9
9
|
* @param {Object} action
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
function blockInserterPanel() {
|
|
13
|
-
let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
14
|
-
let action = arguments.length > 1 ? arguments[1] : undefined;
|
|
15
|
-
|
|
12
|
+
function blockInserterPanel(state = false, action) {
|
|
16
13
|
switch (action.type) {
|
|
17
14
|
case 'SET_IS_INSERTER_OPENED':
|
|
18
15
|
return action.value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["combineReducers","blockInserterPanel","state","action","type","value"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/store/reducer.js"],"names":["combineReducers","blockInserterPanel","state","action","type","value"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,kBAAT,CAA6BC,KAAK,GAAG,KAArC,EAA4CC,MAA5C,EAAqD;AACpD,UAASA,MAAM,CAACC,IAAhB;AACC,SAAK,wBAAL;AACC,aAAOD,MAAM,CAACE,KAAd;AAFF;;AAIA,SAAOH,KAAP;AACA;;AAED,eAAeF,eAAe,CAAE;AAC/BC,EAAAA;AAD+B,CAAF,CAA9B","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer tracking whether the inserter is open.\n *\n * @param {boolean|Object} state\n * @param {Object} action\n */\nfunction blockInserterPanel( state = false, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'SET_IS_INSERTER_OPENED':\n\t\t\treturn action.value;\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tblockInserterPanel,\n} );\n"]}
|
package/build-module/utils.js
CHANGED
|
@@ -31,8 +31,7 @@ export function settingIdToWidgetId(settingId) {
|
|
|
31
31
|
* @return {Object} The transformed widget.
|
|
32
32
|
*/
|
|
33
33
|
|
|
34
|
-
export function blockToWidget(block) {
|
|
35
|
-
let existingWidget = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
34
|
+
export function blockToWidget(block, existingWidget = null) {
|
|
36
35
|
let widget;
|
|
37
36
|
const isValidLegacyWidgetBlock = block.name === 'core/legacy-widget' && (block.attributes.id || block.attributes.instance);
|
|
38
37
|
|
|
@@ -52,7 +51,7 @@ export function blockToWidget(block) {
|
|
|
52
51
|
|
|
53
52
|
widget = {
|
|
54
53
|
idBase: block.attributes.idBase,
|
|
55
|
-
instance: { ...
|
|
54
|
+
instance: { ...existingWidget?.instance,
|
|
56
55
|
// Required only for the customizer.
|
|
57
56
|
is_widget_customizer_js_value: true,
|
|
58
57
|
encoded_serialized_instance: encoded,
|
|
@@ -95,13 +94,12 @@ export function blockToWidget(block) {
|
|
|
95
94
|
* @return {WPBlock} The transformed block.
|
|
96
95
|
*/
|
|
97
96
|
|
|
98
|
-
export function widgetToBlock(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} = _ref;
|
|
97
|
+
export function widgetToBlock({
|
|
98
|
+
id,
|
|
99
|
+
idBase,
|
|
100
|
+
number,
|
|
101
|
+
instance
|
|
102
|
+
}) {
|
|
105
103
|
let block;
|
|
106
104
|
const {
|
|
107
105
|
encoded_serialized_instance: encoded,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/customize-widgets/src/utils.js"],"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","parsedBlocks","__unstableSkipAutop","length"],"mappings":"AAAA;;AACA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,KAApB,EAA2BC,WAA3B,QAA8C,mBAA9C;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CAA8BC,SAA9B,EAA0C;AAChD,QAAMC,OAAO,GAAGD,SAAS,CAACE,KAAV,CAAiB,4BAAjB,CAAhB;;AAEA,MAAKD,OAAL,EAAe;AACd,UAAME,MAAM,GAAGF,OAAO,CAAE,CAAF,CAAtB;AACA,UAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAF,CAAT,EAAgB,EAAhB,CAAvB;AAEA,WAAQ,GAAGE,MAAQ,IAAIC,MAAQ,EAA/B;AACA;;AAED,SAAOJ,SAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASM,aAAT,CAAwBC,KAAxB,
|
|
1
|
+
{"version":3,"sources":["@wordpress/customize-widgets/src/utils.js"],"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","parsedBlocks","__unstableSkipAutop","length"],"mappings":"AAAA;;AACA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,KAApB,EAA2BC,WAA3B,QAA8C,mBAA9C;AACA,SAASC,kBAAT,QAAmC,oBAAnC;AAEA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CAA8BC,SAA9B,EAA0C;AAChD,QAAMC,OAAO,GAAGD,SAAS,CAACE,KAAV,CAAiB,4BAAjB,CAAhB;;AAEA,MAAKD,OAAL,EAAe;AACd,UAAME,MAAM,GAAGF,OAAO,CAAE,CAAF,CAAtB;AACA,UAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAF,CAAT,EAAgB,EAAhB,CAAvB;AAEA,WAAQ,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AnB;AAGA;;AAED,SAAOf,kBAAkB,CAAES,KAAF,EAASM,EAAT,CAAzB;AACA","sourcesContent":["// @ts-check\n/**\n * WordPress dependencies\n */\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"]}
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
99
|
}
|
|
100
|
-
@media (
|
|
100
|
+
@media (min-resolution: 192dpi) {
|
|
101
101
|
:root {
|
|
102
102
|
--wp-admin-border-width-focus: 1.5px;
|
|
103
103
|
}
|
package/build-style/style.css
CHANGED
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
--wp-block-synced-color: #7a00df;
|
|
98
98
|
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
99
99
|
}
|
|
100
|
-
@media (
|
|
100
|
+
@media (min-resolution: 192dpi) {
|
|
101
101
|
:root {
|
|
102
102
|
--wp-admin-border-width-focus: 1.5px;
|
|
103
103
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/customize-widgets",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.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",
|
|
@@ -24,26 +24,26 @@
|
|
|
24
24
|
"react-native": "src/index",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.16.0",
|
|
27
|
-
"@wordpress/block-editor": "^12.
|
|
28
|
-
"@wordpress/block-library": "^8.
|
|
29
|
-
"@wordpress/blocks": "^12.
|
|
30
|
-
"@wordpress/components": "^
|
|
31
|
-
"@wordpress/compose": "^6.
|
|
32
|
-
"@wordpress/core-data": "^6.
|
|
33
|
-
"@wordpress/data": "^9.
|
|
34
|
-
"@wordpress/dom": "^3.
|
|
35
|
-
"@wordpress/element": "^5.
|
|
36
|
-
"@wordpress/hooks": "^3.
|
|
37
|
-
"@wordpress/i18n": "^4.
|
|
38
|
-
"@wordpress/icons": "^9.
|
|
39
|
-
"@wordpress/interface": "^5.
|
|
40
|
-
"@wordpress/is-shallow-equal": "^4.
|
|
41
|
-
"@wordpress/keyboard-shortcuts": "^4.
|
|
42
|
-
"@wordpress/keycodes": "^3.
|
|
43
|
-
"@wordpress/media-utils": "^4.
|
|
44
|
-
"@wordpress/preferences": "^3.
|
|
45
|
-
"@wordpress/private-apis": "^0.
|
|
46
|
-
"@wordpress/widgets": "^3.
|
|
27
|
+
"@wordpress/block-editor": "^12.3.0",
|
|
28
|
+
"@wordpress/block-library": "^8.12.0",
|
|
29
|
+
"@wordpress/blocks": "^12.12.0",
|
|
30
|
+
"@wordpress/components": "^25.1.0",
|
|
31
|
+
"@wordpress/compose": "^6.12.0",
|
|
32
|
+
"@wordpress/core-data": "^6.12.0",
|
|
33
|
+
"@wordpress/data": "^9.5.0",
|
|
34
|
+
"@wordpress/dom": "^3.35.0",
|
|
35
|
+
"@wordpress/element": "^5.12.0",
|
|
36
|
+
"@wordpress/hooks": "^3.35.0",
|
|
37
|
+
"@wordpress/i18n": "^4.35.0",
|
|
38
|
+
"@wordpress/icons": "^9.26.0",
|
|
39
|
+
"@wordpress/interface": "^5.12.0",
|
|
40
|
+
"@wordpress/is-shallow-equal": "^4.35.0",
|
|
41
|
+
"@wordpress/keyboard-shortcuts": "^4.12.0",
|
|
42
|
+
"@wordpress/keycodes": "^3.35.0",
|
|
43
|
+
"@wordpress/media-utils": "^4.26.0",
|
|
44
|
+
"@wordpress/preferences": "^3.12.0",
|
|
45
|
+
"@wordpress/private-apis": "^0.17.0",
|
|
46
|
+
"@wordpress/widgets": "^3.12.0",
|
|
47
47
|
"classnames": "^2.3.1",
|
|
48
48
|
"fast-deep-equal": "^3.1.3"
|
|
49
49
|
},
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "a92f606309b1541b834ff9b0a76ed2a466fc45ed"
|
|
58
58
|
}
|