@wordpress/customize-widgets 4.35.0 → 5.0.1
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 +7 -0
- package/build/components/block-appender/index.js +2 -2
- package/build/components/block-appender/index.js.map +1 -1
- package/build/components/block-inspector-button/index.js +5 -4
- package/build/components/block-inspector-button/index.js.map +1 -1
- package/build/components/customize-widgets/index.js +24 -18
- package/build/components/customize-widgets/index.js.map +1 -1
- package/build/components/error-boundary/index.js +12 -10
- package/build/components/error-boundary/index.js.map +1 -1
- package/build/components/focus-control/index.js +5 -4
- package/build/components/focus-control/index.js.map +1 -1
- package/build/components/header/index.js +48 -44
- package/build/components/header/index.js.map +1 -1
- package/build/components/inserter/index.js +25 -21
- package/build/components/inserter/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.js +50 -45
- package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.js +30 -26
- package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build/components/more-menu/index.js +65 -54
- package/build/components/more-menu/index.js.map +1 -1
- package/build/components/sidebar-block-editor/index.js +42 -34
- package/build/components/sidebar-block-editor/index.js.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js +5 -4
- package/build/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build/components/sidebar-controls/index.js +5 -4
- package/build/components/sidebar-controls/index.js.map +1 -1
- package/build/components/welcome-guide/index.js +44 -33
- package/build/components/welcome-guide/index.js.map +1 -1
- package/build/filters/move-to-sidebar.js +16 -12
- 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/index.js +3 -3
- package/build/index.js.map +1 -1
- package/build-module/components/block-appender/index.js +2 -2
- package/build-module/components/block-appender/index.js.map +1 -1
- package/build-module/components/block-inspector-button/index.js +5 -4
- package/build-module/components/block-inspector-button/index.js.map +1 -1
- package/build-module/components/customize-widgets/index.js +25 -18
- package/build-module/components/customize-widgets/index.js.map +1 -1
- package/build-module/components/error-boundary/index.js +12 -10
- package/build-module/components/error-boundary/index.js.map +1 -1
- package/build-module/components/focus-control/index.js +5 -4
- package/build-module/components/focus-control/index.js.map +1 -1
- package/build-module/components/header/index.js +50 -44
- package/build-module/components/header/index.js.map +1 -1
- package/build-module/components/inserter/index.js +26 -21
- package/build-module/components/inserter/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +2 -2
- package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.js +51 -45
- package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +32 -26
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
- package/build-module/components/more-menu/index.js +67 -54
- package/build-module/components/more-menu/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/index.js +44 -34
- package/build-module/components/sidebar-block-editor/index.js.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js +5 -4
- package/build-module/components/sidebar-block-editor/sidebar-editor-provider.js.map +1 -1
- package/build-module/components/sidebar-controls/index.js +5 -4
- package/build-module/components/sidebar-controls/index.js.map +1 -1
- package/build-module/components/welcome-guide/index.js +45 -33
- package/build-module/components/welcome-guide/index.js.map +1 -1
- package/build-module/filters/move-to-sidebar.js +18 -12
- 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/index.js +3 -3
- package/build-module/index.js.map +1 -1
- package/package.json +24 -23
- package/src/index.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_coreData","_data","_element","_blockEditor","_mediaUtils","_preferences","_blockLibrary","_blockInspectorButton","_interopRequireDefault","_header","_useInserter","_sidebarEditorProvider","_welcomeGuide","_keyboardShortcuts","_blockAppender","_lockUnlock","ExperimentalBlockCanvas","BlockCanvas","unlock","blockEditorPrivateApis","BlockKeyboardShortcuts","blockLibraryPrivateApis","SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","useInserter","isMediumViewport","useViewportMatch","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","useSelect","select","_select$canUser","get","preferencesStore","coreStore","canUser","settings","useMemo","mediaUploadBlockEditor","onError","argumentsObject","uploadMedia","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","_react","createElement","default","Fragment","Register","undo","redo","save","BlockToolbar","hideDragHandle","shouldIframe","styles","defaultEditorStyles","height","BlockList","renderAppender","BlockAppender","createPortal","onSubmit","event","preventDefault","BlockInspector","contentContainer","__unstableBlockSettingsMenuFirstItem","onClose","closeMenu"],"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockInspector,\n\tprivateApis as blockEditorPrivateApis,\n\t__unstableBlockSettingsMenuFirstItem,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockCanvas: BlockCanvas } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst isMediumViewport = useViewportMatch( 'small' );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ) ?? true,\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive || ! isMediumViewport,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tisMediumViewport,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<BlockKeyboardShortcuts />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={\n\t\t\t\t\t\tisFixedToolbarActive || ! isMediumViewport\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isFixedToolbarActive || ! isMediumViewport ) && (\n\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t) }\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ false }\n\t\t\t\t\tstyles={ settings.defaultEditorStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t>\n\t\t\t\t\t<BlockList renderAppender={ BlockAppender } />\n\t\t\t\t</BlockCanvas>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<BlockInspectorButton\n\t\t\t\t\t\tinspector={ inspector }\n\t\t\t\t\t\tcloseMenu={ onClose }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t</__unstableBlockSettingsMenuFirstItem>\n\t\t</>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AAOA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,aAAA,GAAAP,OAAA;AAKA,IAAAQ,qBAAA,GAAAC,sBAAA,CAAAT,OAAA;AACA,IAAAU,OAAA,GAAAD,sBAAA,CAAAT,OAAA;AACA,IAAAW,YAAA,GAAAF,sBAAA,CAAAT,OAAA;AACA,IAAAY,sBAAA,GAAAH,sBAAA,CAAAT,OAAA;AACA,IAAAa,aAAA,GAAAJ,sBAAA,CAAAT,OAAA;AACA,IAAAc,kBAAA,GAAAL,sBAAA,CAAAT,OAAA;AACA,IAAAe,cAAA,GAAAN,sBAAA,CAAAT,OAAA;AACA,IAAAgB,WAAA,GAAAhB,OAAA;AA5BA;AACA;AACA;;AAgBA;AACA;AACA;;AAUA,MAAM;EAAEiB,uBAAuB,EAAEC;AAAY,CAAC,GAAG,IAAAC,kBAAM,EACtDC,wBACD,CAAC;AAED,MAAM;EAAEC;AAAuB,CAAC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;IAC3CK,oBAAoB,EACnBA,oBAAoB,IAAI,CAAEH;EAC1B,CACD,CAAC,EACA,CAAEG,oBAAoB,IAAI,CAAEH,gBAAgB,KAC7C,IAAA0B,MAAA,CAAAC,aAAA,EAACtD,YAAA,CAAA6D,YAAY;IAACC,cAAc;EAAA,CAAE,CAC9B,EACD,IAAAT,MAAA,CAAAC,aAAA,EAACxC,WAAW;IACXiD,YAAY,EAAG,KAAO;IACtBC,MAAM,EAAGxB,QAAQ,CAACyB,mBAAqB;IACvCC,MAAM,EAAC;EAAM,GAEb,IAAAb,MAAA,CAAAC,aAAA,EAACtD,YAAA,CAAAmE,SAAS;IAACC,cAAc,EAAGC;EAAe,CAAE,CACjC,CAAC,EAEZ,IAAAC,qBAAY;EACb;EACA;EACA,IAAAjB,MAAA,CAAAC,aAAA;IAAMiB,QAAQ,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC;EAAG,GACrD,IAAApB,MAAA,CAAAC,aAAA,EAACtD,YAAA,CAAA0E,cAAc,MAAE,CACZ,CAAC,EACPnD,SAAS,CAACoD,gBAAgB,CAAE,CAAC,CAC9B,CACsB,CAAC,EAExB,IAAAtB,MAAA,CAAAC,aAAA,EAACtD,YAAA,CAAA4E,oCAAoC,QAClC,CAAE;IAAEC;EAAQ,CAAC,KACd,IAAAxB,MAAA,CAAAC,aAAA,EAAClD,qBAAA,CAAAmD,OAAoB;IACpBhC,SAAS,EAAGA,SAAW;IACvBuD,SAAS,EAAGD;EAAS,CACrB,CAEmC,CACrC,CAAC;AAEL","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_compose","require","_coreData","_data","_element","_blockEditor","_mediaUtils","_preferences","_blockLibrary","_blockInspectorButton","_interopRequireDefault","_header","_useInserter","_sidebarEditorProvider","_welcomeGuide","_keyboardShortcuts","_blockAppender","_lockUnlock","_jsxRuntime","ExperimentalBlockCanvas","BlockCanvas","unlock","blockEditorPrivateApis","BlockKeyboardShortcuts","blockLibraryPrivateApis","SidebarBlockEditor","blockEditorSettings","sidebar","inserter","inspector","isInserterOpened","setIsInserterOpened","useInserter","isMediumViewport","useViewportMatch","hasUploadPermissions","isFixedToolbarActive","keepCaretInsideBlock","isWelcomeGuideActive","useSelect","select","_select$canUser","get","preferencesStore","coreStore","canUser","settings","useMemo","mediaUploadBlockEditor","onError","argumentsObject","uploadMedia","wpAllowedMimeTypes","allowedMimeTypes","message","__experimentalSetIsInserterOpened","mediaUpload","hasFixedToolbar","__unstableHasCustomAppender","jsx","default","jsxs","Fragment","children","Register","undo","redo","save","BlockToolbar","hideDragHandle","shouldIframe","styles","defaultEditorStyles","height","BlockList","renderAppender","BlockAppender","createPortal","onSubmit","event","preventDefault","BlockInspector","contentContainer","__unstableBlockSettingsMenuFirstItem","onClose","closeMenu"],"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo, createPortal } from '@wordpress/element';\nimport {\n\tBlockList,\n\tBlockToolbar,\n\tBlockInspector,\n\tprivateApis as blockEditorPrivateApis,\n\t__unstableBlockSettingsMenuFirstItem,\n} from '@wordpress/block-editor';\nimport { uploadMedia } from '@wordpress/media-utils';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';\n\n/**\n * Internal dependencies\n */\nimport BlockInspectorButton from '../block-inspector-button';\nimport Header from '../header';\nimport useInserter from '../inserter/use-inserter';\nimport SidebarEditorProvider from './sidebar-editor-provider';\nimport WelcomeGuide from '../welcome-guide';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport BlockAppender from '../block-appender';\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockCanvas: BlockCanvas } = unlock(\n\tblockEditorPrivateApis\n);\n\nconst { BlockKeyboardShortcuts } = unlock( blockLibraryPrivateApis );\n\nexport default function SidebarBlockEditor( {\n\tblockEditorSettings,\n\tsidebar,\n\tinserter,\n\tinspector,\n} ) {\n\tconst [ isInserterOpened, setIsInserterOpened ] = useInserter( inserter );\n\tconst isMediumViewport = useViewportMatch( 'small' );\n\tconst {\n\t\thasUploadPermissions,\n\t\tisFixedToolbarActive,\n\t\tkeepCaretInsideBlock,\n\t\tisWelcomeGuideActive,\n\t} = useSelect( ( select ) => {\n\t\tconst { get } = select( preferencesStore );\n\t\treturn {\n\t\t\thasUploadPermissions:\n\t\t\t\tselect( coreStore ).canUser( 'create', 'media' ) ?? true,\n\t\t\tisFixedToolbarActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'fixedToolbar'\n\t\t\t),\n\t\t\tkeepCaretInsideBlock: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'keepCaretInsideBlock'\n\t\t\t),\n\t\t\tisWelcomeGuideActive: !! get(\n\t\t\t\t'core/customize-widgets',\n\t\t\t\t'welcomeGuide'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst settings = useMemo( () => {\n\t\tlet mediaUploadBlockEditor;\n\t\tif ( hasUploadPermissions ) {\n\t\t\tmediaUploadBlockEditor = ( { onError, ...argumentsObject } ) => {\n\t\t\t\tuploadMedia( {\n\t\t\t\t\twpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes,\n\t\t\t\t\tonError: ( { message } ) => onError( message ),\n\t\t\t\t\t...argumentsObject,\n\t\t\t\t} );\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\t...blockEditorSettings,\n\t\t\t__experimentalSetIsInserterOpened: setIsInserterOpened,\n\t\t\tmediaUpload: mediaUploadBlockEditor,\n\t\t\thasFixedToolbar: isFixedToolbarActive || ! isMediumViewport,\n\t\t\tkeepCaretInsideBlock,\n\t\t\t__unstableHasCustomAppender: true,\n\t\t};\n\t}, [\n\t\thasUploadPermissions,\n\t\tblockEditorSettings,\n\t\tisFixedToolbarActive,\n\t\tisMediumViewport,\n\t\tkeepCaretInsideBlock,\n\t\tsetIsInserterOpened,\n\t] );\n\n\tif ( isWelcomeGuideActive ) {\n\t\treturn <WelcomeGuide sidebar={ sidebar } />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<BlockKeyboardShortcuts />\n\n\t\t\t<SidebarEditorProvider sidebar={ sidebar } settings={ settings }>\n\t\t\t\t<KeyboardShortcuts\n\t\t\t\t\tundo={ sidebar.undo }\n\t\t\t\t\tredo={ sidebar.redo }\n\t\t\t\t\tsave={ sidebar.save }\n\t\t\t\t/>\n\n\t\t\t\t<Header\n\t\t\t\t\tsidebar={ sidebar }\n\t\t\t\t\tinserter={ inserter }\n\t\t\t\t\tisInserterOpened={ isInserterOpened }\n\t\t\t\t\tsetIsInserterOpened={ setIsInserterOpened }\n\t\t\t\t\tisFixedToolbarActive={\n\t\t\t\t\t\tisFixedToolbarActive || ! isMediumViewport\n\t\t\t\t\t}\n\t\t\t\t/>\n\t\t\t\t{ ( isFixedToolbarActive || ! isMediumViewport ) && (\n\t\t\t\t\t<BlockToolbar hideDragHandle />\n\t\t\t\t) }\n\t\t\t\t<BlockCanvas\n\t\t\t\t\tshouldIframe={ false }\n\t\t\t\t\tstyles={ settings.defaultEditorStyles }\n\t\t\t\t\theight=\"100%\"\n\t\t\t\t>\n\t\t\t\t\t<BlockList renderAppender={ BlockAppender } />\n\t\t\t\t</BlockCanvas>\n\n\t\t\t\t{ createPortal(\n\t\t\t\t\t// This is a temporary hack to prevent button component inside <BlockInspector>\n\t\t\t\t\t// from submitting form when type=\"button\" is not specified.\n\t\t\t\t\t<form onSubmit={ ( event ) => event.preventDefault() }>\n\t\t\t\t\t\t<BlockInspector />\n\t\t\t\t\t</form>,\n\t\t\t\t\tinspector.contentContainer[ 0 ]\n\t\t\t\t) }\n\t\t\t</SidebarEditorProvider>\n\n\t\t\t<__unstableBlockSettingsMenuFirstItem>\n\t\t\t\t{ ( { onClose } ) => (\n\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C9B,eACD,IAAAnD,WAAA,CAAAyC,GAAA,EAACvC,WAAW;QACXkD,YAAY,EAAG,KAAO;QACtBC,MAAM,EAAGzB,QAAQ,CAAC0B,mBAAqB;QACvCC,MAAM,EAAC,MAAM;QAAAV,QAAA,eAEb,IAAA7C,WAAA,CAAAyC,GAAA,EAACtD,YAAA,CAAAqE,SAAS;UAACC,cAAc,EAAGC;QAAe,CAAE;MAAC,CAClC,CAAC,EAEZ,IAAAC,qBAAY;MAAA;MACb;MACA;MACA,IAAA3D,WAAA,CAAAyC,GAAA;QAAMmB,QAAQ,EAAKC,KAAK,IAAMA,KAAK,CAACC,cAAc,CAAC,CAAG;QAAAjB,QAAA,eACrD,IAAA7C,WAAA,CAAAyC,GAAA,EAACtD,YAAA,CAAA4E,cAAc,IAAE;MAAC,CACb,CAAC,EACPpD,SAAS,CAACqD,gBAAgB,CAAE,CAAC,CAC9B,CAAC;IAAA,CACqB,CAAC,eAExB,IAAAhE,WAAA,CAAAyC,GAAA,EAACtD,YAAA,CAAA8E,oCAAoC;MAAApB,QAAA,EAClCA,CAAE;QAAEqB;MAAQ,CAAC,kBACd,IAAAlE,WAAA,CAAAyC,GAAA,EAAClD,qBAAA,CAAAmD,OAAoB;QACpB/B,SAAS,EAAGA,SAAW;QACvBwD,SAAS,EAAGD;MAAS,CACrB;IACD,CACoC,CAAC;EAAA,CACtC,CAAC;AAEL","ignoreList":[]}
|
|
@@ -5,11 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = SidebarEditorProvider;
|
|
8
|
-
var _react = require("react");
|
|
9
8
|
var _blockEditor = require("@wordpress/block-editor");
|
|
10
9
|
var _useSidebarBlockEditor = _interopRequireDefault(require("./use-sidebar-block-editor"));
|
|
11
10
|
var _useBlocksFocusControl = _interopRequireDefault(require("../focus-control/use-blocks-focus-control"));
|
|
12
11
|
var _lockUnlock = require("../../lock-unlock");
|
|
12
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
/**
|
|
14
14
|
* WordPress dependencies
|
|
15
15
|
*/
|
|
@@ -28,12 +28,13 @@ function SidebarEditorProvider({
|
|
|
28
28
|
}) {
|
|
29
29
|
const [blocks, onInput, onChange] = (0, _useSidebarBlockEditor.default)(sidebar);
|
|
30
30
|
(0, _useBlocksFocusControl.default)(blocks);
|
|
31
|
-
return (0,
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ExperimentalBlockEditorProvider, {
|
|
32
32
|
value: blocks,
|
|
33
33
|
onInput: onInput,
|
|
34
34
|
onChange: onChange,
|
|
35
35
|
settings: settings,
|
|
36
|
-
useSubRegistry: false
|
|
37
|
-
|
|
36
|
+
useSubRegistry: false,
|
|
37
|
+
children: children
|
|
38
|
+
});
|
|
38
39
|
}
|
|
39
40
|
//# sourceMappingURL=sidebar-editor-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_useSidebarBlockEditor","_interopRequireDefault","_useBlocksFocusControl","_lockUnlock","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","SidebarEditorProvider","sidebar","settings","children","blocks","onInput","onChange","useSidebarBlockEditor","useBlocksFocusControl","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_useSidebarBlockEditor","_interopRequireDefault","_useBlocksFocusControl","_lockUnlock","_jsxRuntime","ExperimentalBlockEditorProvider","unlock","blockEditorPrivateApis","SidebarEditorProvider","sidebar","settings","children","blocks","onInput","onChange","useSidebarBlockEditor","useBlocksFocusControl","jsx","value","useSubRegistry"],"sources":["@wordpress/customize-widgets/src/components/sidebar-block-editor/sidebar-editor-provider.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport useSidebarBlockEditor from './use-sidebar-block-editor';\nimport useBlocksFocusControl from '../focus-control/use-blocks-focus-control';\n\nimport { unlock } from '../../lock-unlock';\n\nconst { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis );\n\nexport default function SidebarEditorProvider( {\n\tsidebar,\n\tsettings,\n\tchildren,\n} ) {\n\tconst [ blocks, onInput, onChange ] = useSidebarBlockEditor( sidebar );\n\n\tuseBlocksFocusControl( blocks );\n\n\treturn (\n\t\t<ExperimentalBlockEditorProvider\n\t\t\tvalue={ blocks }\n\t\t\tonInput={ onInput }\n\t\t\tonChange={ onChange }\n\t\t\tsettings={ settings }\n\t\t\tuseSubRegistry={ false }\n\t\t>\n\t\t\t{ children }\n\t\t</ExperimentalBlockEditorProvider>\n\t);\n}\n"],"mappings":";;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAD,sBAAA,CAAAF,OAAA;AAEA,IAAAI,WAAA,GAAAJ,OAAA;AAA2C,IAAAK,WAAA,GAAAL,OAAA;AAX3C;AACA;AACA;;AAGA;AACA;AACA;;AAMA,MAAM;EAAEM;AAAgC,CAAC,GAAG,IAAAC,kBAAM,EAAEC,wBAAuB,CAAC;AAE7D,SAASC,qBAAqBA,CAAE;EAC9CC,OAAO;EACPC,QAAQ;EACRC;AACD,CAAC,EAAG;EACH,MAAM,CAAEC,MAAM,EAAEC,OAAO,EAAEC,QAAQ,CAAE,GAAG,IAAAC,8BAAqB,EAAEN,OAAQ,CAAC;EAEtE,IAAAO,8BAAqB,EAAEJ,MAAO,CAAC;EAE/B,oBACC,IAAAR,WAAA,CAAAa,GAAA,EAACZ,+BAA+B;IAC/Ba,KAAK,EAAGN,MAAQ;IAChBC,OAAO,EAAGA,OAAS;IACnBC,QAAQ,EAAGA,QAAU;IACrBJ,QAAQ,EAAGA,QAAU;IACrBS,cAAc,EAAG,KAAO;IAAAR,QAAA,EAEtBA;EAAQ,CACsB,CAAC;AAEpC","ignoreList":[]}
|
|
@@ -7,8 +7,8 @@ exports.SidebarControlsContext = void 0;
|
|
|
7
7
|
exports.default = SidebarControls;
|
|
8
8
|
exports.useActiveSidebarControl = useActiveSidebarControl;
|
|
9
9
|
exports.useSidebarControls = useSidebarControls;
|
|
10
|
-
var _react = require("react");
|
|
11
10
|
var _element = require("@wordpress/element");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
/**
|
|
13
13
|
* WordPress dependencies
|
|
14
14
|
*/
|
|
@@ -23,9 +23,10 @@ function SidebarControls({
|
|
|
23
23
|
sidebarControls,
|
|
24
24
|
activeSidebarControl
|
|
25
25
|
}), [sidebarControls, activeSidebarControl]);
|
|
26
|
-
return (0,
|
|
27
|
-
value: context
|
|
28
|
-
|
|
26
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(SidebarControlsContext.Provider, {
|
|
27
|
+
value: context,
|
|
28
|
+
children: children
|
|
29
|
+
});
|
|
29
30
|
}
|
|
30
31
|
function useSidebarControls() {
|
|
31
32
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","SidebarControlsContext","exports","createContext","SidebarControls","sidebarControls","activeSidebarControl","children","context","useMemo","
|
|
1
|
+
{"version":3,"names":["_element","require","_jsxRuntime","SidebarControlsContext","exports","createContext","SidebarControls","sidebarControls","activeSidebarControl","children","context","useMemo","jsx","Provider","value","useSidebarControls","useContext","useActiveSidebarControl"],"sources":["@wordpress/customize-widgets/src/components/sidebar-controls/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createContext, useMemo, useContext } from '@wordpress/element';\n\nexport const SidebarControlsContext = createContext();\n\nexport default function SidebarControls( {\n\tsidebarControls,\n\tactiveSidebarControl,\n\tchildren,\n} ) {\n\tconst context = useMemo(\n\t\t() => ( {\n\t\t\tsidebarControls,\n\t\t\tactiveSidebarControl,\n\t\t} ),\n\t\t[ sidebarControls, activeSidebarControl ]\n\t);\n\n\treturn (\n\t\t<SidebarControlsContext.Provider value={ context }>\n\t\t\t{ children }\n\t\t</SidebarControlsContext.Provider>\n\t);\n}\n\nexport function useSidebarControls() {\n\tconst { sidebarControls } = useContext( SidebarControlsContext );\n\n\treturn sidebarControls;\n}\n\nexport function useActiveSidebarControl() {\n\tconst { activeSidebarControl } = useContext( SidebarControlsContext );\n\n\treturn activeSidebarControl;\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AAAwE,IAAAC,WAAA,GAAAD,OAAA;AAHxE;AACA;AACA;;AAGO,MAAME,sBAAsB,GAAAC,OAAA,CAAAD,sBAAA,GAAG,IAAAE,sBAAa,EAAC,CAAC;AAEtC,SAASC,eAAeA,CAAE;EACxCC,eAAe;EACfC,oBAAoB;EACpBC;AACD,CAAC,EAAG;EACH,MAAMC,OAAO,GAAG,IAAAC,gBAAO,EACtB,OAAQ;IACPJ,eAAe;IACfC;EACD,CAAC,CAAE,EACH,CAAED,eAAe,EAAEC,oBAAoB,CACxC,CAAC;EAED,oBACC,IAAAN,WAAA,CAAAU,GAAA,EAACT,sBAAsB,CAACU,QAAQ;IAACC,KAAK,EAAGJ,OAAS;IAAAD,QAAA,EAC/CA;EAAQ,CACsB,CAAC;AAEpC;AAEO,SAASM,kBAAkBA,CAAA,EAAG;EACpC,MAAM;IAAER;EAAgB,CAAC,GAAG,IAAAS,mBAAU,EAAEb,sBAAuB,CAAC;EAEhE,OAAOI,eAAe;AACvB;AAEO,SAASU,uBAAuBA,CAAA,EAAG;EACzC,MAAM;IAAET;EAAqB,CAAC,GAAG,IAAAQ,mBAAU,EAAEb,sBAAuB,CAAC;EAErE,OAAOK,oBAAoB;AAC5B","ignoreList":[]}
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = WelcomeGuide;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _i18n = require("@wordpress/i18n");
|
|
9
8
|
var _components = require("@wordpress/components");
|
|
10
9
|
var _data = require("@wordpress/data");
|
|
11
10
|
var _preferences = require("@wordpress/preferences");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
/**
|
|
13
13
|
* WordPress dependencies
|
|
14
14
|
*/
|
|
@@ -20,37 +20,48 @@ function WelcomeGuide({
|
|
|
20
20
|
toggle
|
|
21
21
|
} = (0, _data.useDispatch)(_preferences.store);
|
|
22
22
|
const isEntirelyBlockWidgets = sidebar.getWidgets().every(widget => widget.id.startsWith('block-'));
|
|
23
|
-
return (0,
|
|
24
|
-
className: "customize-widgets-welcome-guide"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
23
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
24
|
+
className: "customize-widgets-welcome-guide",
|
|
25
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
26
|
+
className: "customize-widgets-welcome-guide__image__wrapper",
|
|
27
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("picture", {
|
|
28
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("source", {
|
|
29
|
+
srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg",
|
|
30
|
+
media: "(prefers-reduced-motion: reduce)"
|
|
31
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
32
|
+
className: "customize-widgets-welcome-guide__image",
|
|
33
|
+
src: "https://s.w.org/images/block-editor/welcome-editor.gif",
|
|
34
|
+
width: "312",
|
|
35
|
+
height: "240",
|
|
36
|
+
alt: ""
|
|
37
|
+
})]
|
|
38
|
+
})
|
|
39
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("h1", {
|
|
40
|
+
className: "customize-widgets-welcome-guide__heading",
|
|
41
|
+
children: (0, _i18n.__)('Welcome to block Widgets')
|
|
42
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
43
|
+
className: "customize-widgets-welcome-guide__text",
|
|
44
|
+
children: isEntirelyBlockWidgets ? (0, _i18n.__)('Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.') : (0, _i18n.__)('You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.')
|
|
45
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
|
|
46
|
+
className: "customize-widgets-welcome-guide__button",
|
|
47
|
+
variant: "primary",
|
|
48
|
+
onClick: () => toggle('core/customize-widgets', 'welcomeGuide'),
|
|
49
|
+
children: (0, _i18n.__)('Got it')
|
|
50
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("hr", {
|
|
51
|
+
className: "customize-widgets-welcome-guide__separator"
|
|
52
|
+
}), !isEntirelyBlockWidgets && /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
53
|
+
className: "customize-widgets-welcome-guide__more-info",
|
|
54
|
+
children: [(0, _i18n.__)('Want to stick with the old widgets?'), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
|
|
55
|
+
href: (0, _i18n.__)('https://wordpress.org/plugins/classic-widgets/'),
|
|
56
|
+
children: (0, _i18n.__)('Get the Classic Widgets plugin.')
|
|
57
|
+
})]
|
|
58
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
59
|
+
className: "customize-widgets-welcome-guide__more-info",
|
|
60
|
+
children: [(0, _i18n.__)('New to the block editor?'), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.ExternalLink, {
|
|
61
|
+
href: (0, _i18n.__)('https://wordpress.org/documentation/article/wordpress-block-editor/'),
|
|
62
|
+
children: (0, _i18n.__)("Here's a detailed guide.")
|
|
63
|
+
})]
|
|
64
|
+
})]
|
|
65
|
+
});
|
|
55
66
|
}
|
|
56
67
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_i18n","require","_components","_data","_preferences","WelcomeGuide","sidebar","toggle","useDispatch","preferencesStore","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith","
|
|
1
|
+
{"version":3,"names":["_i18n","require","_components","_data","_preferences","_jsxRuntime","WelcomeGuide","sidebar","toggle","useDispatch","preferencesStore","isEntirelyBlockWidgets","getWidgets","every","widget","id","startsWith","jsxs","className","children","jsx","srcSet","media","src","width","height","alt","__","Button","variant","onClick","ExternalLink","href"],"sources":["@wordpress/customize-widgets/src/components/welcome-guide/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button, ExternalLink } from '@wordpress/components';\nimport { useDispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\nexport default function WelcomeGuide( { sidebar } ) {\n\tconst { toggle } = useDispatch( preferencesStore );\n\n\tconst isEntirelyBlockWidgets = sidebar\n\t\t.getWidgets()\n\t\t.every( ( widget ) => widget.id.startsWith( 'block-' ) );\n\n\treturn (\n\t\t<div className=\"customize-widgets-welcome-guide\">\n\t\t\t<div className=\"customize-widgets-welcome-guide__image__wrapper\">\n\t\t\t\t<picture>\n\t\t\t\t\t<source\n\t\t\t\t\t\tsrcSet=\"https://s.w.org/images/block-editor/welcome-editor.svg\"\n\t\t\t\t\t\tmedia=\"(prefers-reduced-motion: reduce)\"\n\t\t\t\t\t/>\n\t\t\t\t\t<img\n\t\t\t\t\t\tclassName=\"customize-widgets-welcome-guide__image\"\n\t\t\t\t\t\tsrc=\"https://s.w.org/images/block-editor/welcome-editor.gif\"\n\t\t\t\t\t\twidth=\"312\"\n\t\t\t\t\t\theight=\"240\"\n\t\t\t\t\t\talt=\"\"\n\t\t\t\t\t/>\n\t\t\t\t</picture>\n\t\t\t</div>\n\t\t\t<h1 className=\"customize-widgets-welcome-guide__heading\">\n\t\t\t\t{ __( 'Welcome to block Widgets' ) }\n\t\t\t</h1>\n\t\t\t<p className=\"customize-widgets-welcome-guide__text\">\n\t\t\t\t{ isEntirelyBlockWidgets\n\t\t\t\t\t? __(\n\t\t\t\t\t\t\t'Your theme provides different “block” areas for you to add and edit content. Try adding a search bar, social icons, or other types of blocks here and see how they’ll look on your site.'\n\t\t\t\t\t )\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'You can now add any block to your site’s widget areas. Don’t worry, all of your favorite widgets still work flawlessly.'\n\t\t\t\t\t ) }\n\t\t\t</p>\n\t\t\t<Button\n\t\t\t\tclassName=\"customize-widgets-welcome-guide__button\"\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () =>\n\t\t\t\t\ttoggle( 'core/customize-widgets', 'welcomeGuide' )\n\t\t\t\t}\n\t\t\t>\n\t\t\t\t{ __( 'Got it' ) }\n\t\t\t</Button>\n\t\t\t<hr className=\"customize-widgets-welcome-guide__separator\" />\n\t\t\t{ ! isEntirelyBlockWidgets && (\n\t\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t\t{ __( 'Want to stick with the old widgets?' ) }\n\t\t\t\t\t<br />\n\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t'https://wordpress.org/plugins/classic-widgets/'\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Get the Classic Widgets plugin.' ) }\n\t\t\t\t\t</ExternalLink>\n\t\t\t\t</p>\n\t\t\t) }\n\t\t\t<p className=\"customize-widgets-welcome-guide__more-info\">\n\t\t\t\t{ __( 'New to the block editor?' ) }\n\t\t\t\t<br />\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/wordpress-block-editor/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( \"Here's a detailed guide.\" ) }\n\t\t\t\t</ExternalLink>\n\t\t\t</p>\n\t\t</div>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAAmE,IAAAI,WAAA,GAAAJ,OAAA;AANnE;AACA;AACA;;AAMe,SAASK,YAAYA,CAAE;EAAEC;AAAQ,CAAC,EAAG;EACnD,MAAM;IAAEC;EAAO,CAAC,GAAG,IAAAC,iBAAW,EAAEC,kBAAiB,CAAC;EAElD,MAAMC,sBAAsB,GAAGJ,OAAO,CACpCK,UAAU,CAAC,CAAC,CACZC,KAAK,CAAIC,MAAM,IAAMA,MAAM,CAACC,EAAE,CAACC,UAAU,CAAE,QAAS,CAAE,CAAC;EAEzD,oBACC,IAAAX,WAAA,CAAAY,IAAA;IAAKC,SAAS,EAAC,iCAAiC;IAAAC,QAAA,gBAC/C,IAAAd,WAAA,CAAAe,GAAA;MAAKF,SAAS,EAAC,iDAAiD;MAAAC,QAAA,eAC/D,IAAAd,WAAA,CAAAY,IAAA;QAAAE,QAAA,gBACC,IAAAd,WAAA,CAAAe,GAAA;UACCC,MAAM,EAAC,wDAAwD;UAC/DC,KAAK,EAAC;QAAkC,CACxC,CAAC,eACF,IAAAjB,WAAA,CAAAe,GAAA;UACCF,SAAS,EAAC,wCAAwC;UAClDK,GAAG,EAAC,wDAAwD;UAC5DC,KAAK,EAAC,KAAK;UACXC,MAAM,EAAC,KAAK;UACZC,GAAG,EAAC;QAAE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AA,CAAA6B,YAAY;QACZC,IAAI,EAAG,IAAAL,QAAE,EACR,qEACD,CAAG;QAAAR,QAAA,EAED,IAAAQ,QAAE,EAAE,0BAA2B;MAAC,CACrB,CAAC;IAAA,CACb,CAAC;EAAA,CACA,CAAC;AAER","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _react = require("react");
|
|
4
3
|
var _blockEditor = require("@wordpress/block-editor");
|
|
5
4
|
var _compose = require("@wordpress/compose");
|
|
6
5
|
var _data = require("@wordpress/data");
|
|
@@ -9,6 +8,7 @@ var _widgets = require("@wordpress/widgets");
|
|
|
9
8
|
var _sidebarControls = require("../components/sidebar-controls");
|
|
10
9
|
var _focusControl = require("../components/focus-control");
|
|
11
10
|
var _utils = require("../utils");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
12
|
/**
|
|
13
13
|
* WordPress dependencies
|
|
14
14
|
*/
|
|
@@ -60,17 +60,21 @@ const withMoveToSidebarToolbarItem = (0, _compose.createHigherOrderComponent)(Bl
|
|
|
60
60
|
// Move focus to the moved widget and expand the sidebar.
|
|
61
61
|
focusWidget(widgetId);
|
|
62
62
|
}
|
|
63
|
-
return (0,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
63
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
64
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BlockEdit, {
|
|
65
|
+
...props
|
|
66
|
+
}), hasMultipleSidebars && canInsertBlockInSidebar && /*#__PURE__*/(0, _jsxRuntime.jsx)(_blockEditor.BlockControls, {
|
|
67
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_widgets.MoveToWidgetArea, {
|
|
68
|
+
widgetAreas: sidebarControls.map(sidebarControl => ({
|
|
69
|
+
id: sidebarControl.id,
|
|
70
|
+
name: sidebarControl.params.label,
|
|
71
|
+
description: sidebarControl.params.description
|
|
72
|
+
})),
|
|
73
|
+
currentWidgetAreaId: activeSidebarControl?.id,
|
|
74
|
+
onSelect: moveToSidebar
|
|
75
|
+
})
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
74
78
|
}, 'withMoveToSidebarToolbarItem');
|
|
75
79
|
(0, _hooks.addFilter)('editor.BlockEdit', 'core/customize-widgets/block-edit', withMoveToSidebarToolbarItem);
|
|
76
80
|
//# sourceMappingURL=move-to-sidebar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_blockEditor","require","_compose","_data","_hooks","_widgets","_sidebarControls","_focusControl","_utils","withMoveToSidebarToolbarItem","createHigherOrderComponent","BlockEdit","props","widgetId","getWidgetIdFromBlock","sidebarControls","useSidebarControls","activeSidebarControl","useActiveSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","useSelect","select","blockEditorStore","canInsertBlockType","block","getBlock","removeBlock","useDispatch","focusWidget","useFocusControl","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","blockToWidget","reverse","
|
|
1
|
+
{"version":3,"names":["_blockEditor","require","_compose","_data","_hooks","_widgets","_sidebarControls","_focusControl","_utils","_jsxRuntime","withMoveToSidebarToolbarItem","createHigherOrderComponent","BlockEdit","props","widgetId","getWidgetIdFromBlock","sidebarControls","useSidebarControls","activeSidebarControl","useActiveSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","useSelect","select","blockEditorStore","canInsertBlockType","block","getBlock","removeBlock","useDispatch","focusWidget","useFocusControl","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","blockToWidget","reverse","jsxs","Fragment","children","jsx","BlockControls","MoveToWidgetArea","widgetAreas","map","params","label","description","currentWidgetAreaId","onSelect","addFilter"],"sources":["@wordpress/customize-widgets/src/filters/move-to-sidebar.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tBlockControls,\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"],"mappings":";;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAIA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,gBAAA,GAAAL,OAAA;AAIA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAAyC,IAAAQ,WAAA,GAAAR,OAAA;AApBzC;AACA;AACA;;AAUA;AACA;AACA;;AAQA,MAAMS,4BAA4B,GAAG,IAAAC,mCAA0B,EAC5DC,SAAS,IAAQC,KAAK,IAAM;EAC7B,IAAIC,QAAQ,GAAG,IAAAC,6BAAoB,EAAEF,KAAM,CAAC;EAC5C,MAAMG,eAAe,GAAG,IAAAC,mCAAkB,EAAC,CAAC;EAC5C,MAAMC,oBAAoB,GAAG,IAAAC,wCAAuB,EAAC,CAAC;EACtD,MAAMC,mBAAmB,GAAGJ,eAAe,EAAEK,MAAM,GAAG,CAAC;EACvD,MAAMC,SAAS,GAAGT,KAAK,CAACU,IAAI;EAC5B,MAAMC,QAAQ,GAAGX,KAAK,CAACW,QAAQ;EAC/B,MAAMC,uBAAuB,GAAG,IAAAC,eAAS,EACtCC,MAAM,IAAM;IACb;IACA;IACA,OAAOA,MAAM,CAAEC,kBAAiB,CAAC,CAACC,kBAAkB,CACnDP,SAAS,EACT,EACD,CAAC;EACF,CAAC,EACD,CAAEA,SAAS,CACZ,CAAC;EACD,MAAMQ,KAAK,GAAG,IAAAJ,eAAS,EACpBC,MAAM,IAAMA,MAAM,CAAEC,kBA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,WAAA,CAAA8C,GAAA,EAAC3C,SAAS;MAAA,GAAMC;IAAK,CAAI,CAAC,EACxBO,mBAAmB,IAAIK,uBAAuB,iBAC/C,IAAAhB,WAAA,CAAA8C,GAAA,EAACvD,YAAA,CAAAwD,aAAa;MAAAF,QAAA,eACb,IAAA7C,WAAA,CAAA8C,GAAA,EAAClD,QAAA,CAAAoD,gBAAgB;QAChBC,WAAW,EAAG1C,eAAe,CAAC2C,GAAG,CAC9BnB,cAAc,KAAQ;UACvBC,EAAE,EAAED,cAAc,CAACC,EAAE;UACrBlB,IAAI,EAAEiB,cAAc,CAACoB,MAAM,CAACC,KAAK;UACjCC,WAAW,EACVtB,cAAc,CAACoB,MAAM,CAACE;QACxB,CAAC,CACF,CAAG;QACHC,mBAAmB,EAAG7C,oBAAoB,EAAEuB,EAAI;QAChDuB,QAAQ,EAAG5B;MAAe,CAC1B;IAAC,CACY,CACf;EAAA,CACA,CAAC;AAEL,CAAC,EACD,8BACD,CAAC;AAED,IAAA6B,gBAAS,EACR,kBAAkB,EAClB,mCAAmC,EACnCvD,4BACD,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _react = require("react");
|
|
4
3
|
var _compose = require("@wordpress/compose");
|
|
5
4
|
var _hooks = require("@wordpress/hooks");
|
|
5
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
@@ -16,7 +16,7 @@ const withWideWidgetDisplay = (0, _compose.createHigherOrderComponent)(BlockEdit
|
|
|
16
16
|
idBase
|
|
17
17
|
} = props.attributes;
|
|
18
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
|
-
return (0,
|
|
19
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BlockEdit, {
|
|
20
20
|
...props,
|
|
21
21
|
isWide: isWide
|
|
22
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_compose","require","_hooks","wp","window","withWideWidgetDisplay","createHigherOrderComponent","BlockEdit","props","_wp$customize$Widgets","idBase","attributes","isWide","customize","Widgets","data","availableWidgets","find","widget","id_base","is_wide","
|
|
1
|
+
{"version":3,"names":["_compose","require","_hooks","_jsxRuntime","wp","window","withWideWidgetDisplay","createHigherOrderComponent","BlockEdit","props","_wp$customize$Widgets","idBase","attributes","isWide","customize","Widgets","data","availableWidgets","find","widget","id_base","is_wide","jsx","addFilter"],"sources":["@wordpress/customize-widgets/src/filters/wide-widget-display.js"],"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"],"mappings":";;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAA6C,IAAAE,WAAA,GAAAF,OAAA;AAJ7C;AACA;AACA;;AAIA,MAAM;EAAEG;AAAG,CAAC,GAAGC,MAAM;AAErB,MAAMC,qBAAqB,GAAG,IAAAC,mCAA0B,EACrDC,SAAS,IAAQC,KAAK,IAAM;EAAA,IAAAC,qBAAA;EAC7B,MAAM;IAAEC;EAAO,CAAC,GAAGF,KAAK,CAACG,UAAU;EACnC,MAAMC,MAAM,IAAAH,qBAAA,GACXN,EAAE,CAACU,SAAS,CAACC,OAAO,CAACC,IAAI,CAACC,gBAAgB,CAACC,IAAI,CAC5CC,MAAM,IAAMA,MAAM,CAACC,OAAO,KAAKT,MAClC,CAAC,EAAEU,OAAO,cAAAX,qBAAA,cAAAA,qBAAA,GAAI,KAAK;EAEpB,oBAAO,IAAAP,WAAA,CAAAmB,GAAA,EAACd,SAAS;IAAA,GAAMC,KAAK;IAAGI,MAAM,EAAGA;EAAQ,CAAE,CAAC;AACpD,CAAC,EACD,uBACD,CAAC;AAED,IAAAU,gBAAS,EACR,kBAAkB,EAClB,4CAA4C,EAC5CjB,qBACD,CAAC","ignoreList":[]}
|
package/build/index.js
CHANGED
|
@@ -11,7 +11,6 @@ Object.defineProperty(exports, "store", {
|
|
|
11
11
|
return _store.store;
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
var _react = require("react");
|
|
15
14
|
var _element = require("@wordpress/element");
|
|
16
15
|
var _blockLibrary = require("@wordpress/block-library");
|
|
17
16
|
var _widgets = require("@wordpress/widgets");
|
|
@@ -22,6 +21,7 @@ var _customizeWidgets = _interopRequireDefault(require("./components/customize-w
|
|
|
22
21
|
var _sidebarSection = _interopRequireDefault(require("./controls/sidebar-section"));
|
|
23
22
|
var _sidebarControl = _interopRequireDefault(require("./controls/sidebar-control"));
|
|
24
23
|
require("./filters");
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
25
|
var _store = require("./store");
|
|
26
26
|
/**
|
|
27
27
|
* WordPress dependencies
|
|
@@ -54,7 +54,7 @@ function initialize(editorName, blockEditorSettings) {
|
|
|
54
54
|
});
|
|
55
55
|
(0, _blockLibrary.registerCoreBlocks)(coreBlocks);
|
|
56
56
|
(0, _widgets.registerLegacyWidgetBlock)();
|
|
57
|
-
if (
|
|
57
|
+
if (globalThis.IS_GUTENBERG_PLUGIN) {
|
|
58
58
|
(0, _blockLibrary.__experimentalRegisterExperimentalCoreBlocks)({
|
|
59
59
|
enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS
|
|
60
60
|
});
|
|
@@ -79,7 +79,7 @@ function initialize(editorName, blockEditorSettings) {
|
|
|
79
79
|
sidebarControls.push(control);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
(0, _element.createRoot)(container).render((0,
|
|
82
|
+
(0, _element.createRoot)(container).render( /*#__PURE__*/(0, _jsxRuntime.jsx)(_customizeWidgets.default, {
|
|
83
83
|
api: wp.customize,
|
|
84
84
|
sidebarControls: sidebarControls,
|
|
85
85
|
blockEditorSettings: blockEditorSettings
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_element","require","_blockLibrary","_widgets","_blocks","_data","_preferences","_customizeWidgets","_interopRequireDefault","_sidebarSection","_sidebarControl","_store","wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","dispatch","preferencesStore","setDefaults","fixedToolbar","welcomeGuide","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","block","includes","name","startsWith","registerCoreBlocks","registerLegacyWidgetBlock","
|
|
1
|
+
{"version":3,"names":["_element","require","_blockLibrary","_widgets","_blocks","_data","_preferences","_customizeWidgets","_interopRequireDefault","_sidebarSection","_sidebarControl","_jsxRuntime","_store","wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","dispatch","preferencesStore","setDefaults","fixedToolbar","welcomeGuide","blocksStore","reapplyBlockTypeFilters","coreBlocks","__experimentalGetCoreBlocks","filter","block","includes","name","startsWith","registerCoreBlocks","registerLegacyWidgetBlock","globalThis","IS_GUTENBERG_PLUGIN","__experimentalRegisterExperimentalCoreBlocks","enableFSEBlocks","registerLegacyWidgetVariations","registerWidgetGroupBlock","setFreeformContentHandlerName","SidebarControl","getSidebarControl","customize","sectionConstructor","sidebar","getSidebarSection","controlConstructor","sidebar_block_editor","container","document","createElement","body","appendChild","bind","sidebarControls","control","each","push","createRoot","render","jsx","default","api"],"sources":["@wordpress/customize-widgets/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createRoot } from '@wordpress/element';\nimport {\n\tregisterCoreBlocks,\n\t__experimentalGetCoreBlocks,\n\t__experimentalRegisterExperimentalCoreBlocks,\n} from '@wordpress/block-library';\nimport {\n\tregisterLegacyWidgetBlock,\n\tregisterLegacyWidgetVariations,\n\tregisterWidgetGroupBlock,\n} from '@wordpress/widgets';\nimport {\n\tsetFreeformContentHandlerName,\n\tstore as blocksStore,\n} from '@wordpress/blocks';\nimport { dispatch } from '@wordpress/data';\nimport { store as preferencesStore } from '@wordpress/preferences';\n\n/**\n * Internal dependencies\n */\nimport CustomizeWidgets from './components/customize-widgets';\nimport getSidebarSection from './controls/sidebar-section';\nimport getSidebarControl from './controls/sidebar-control';\nimport './filters';\n\nconst { wp } = window;\n\nconst DISABLED_BLOCKS = [\n\t'core/more',\n\t'core/block',\n\t'core/freeform',\n\t'core/template-part',\n];\nconst ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;\n\n/**\n * Initializes the widgets block editor in the customizer.\n *\n * @param {string} editorName The editor name.\n * @param {Object} blockEditorSettings Block editor settings.\n */\nexport function initialize( editorName, blockEditorSettings ) {\n\tdispatch( preferencesStore ).setDefaults( 'core/customize-widgets', {\n\t\tfixedToolbar: false,\n\t\twelcomeGuide: true,\n\t} );\n\n\tdispatch( blocksStore ).reapplyBlockTypeFilters();\n\tconst coreBlocks = __experimentalGetCoreBlocks().filter( ( block ) => {\n\t\treturn ! (\n\t\t\tDISABLED_BLOCKS.includes( block.name ) ||\n\t\t\tblock.name.startsWith( 'core/post' ) ||\n\t\t\tblock.name.startsWith( 'core/query' ) ||\n\t\t\tblock.name.startsWith( 'core/site' ) ||\n\t\t\tblock.name.startsWith( 'core/navigation' )\n\t\t);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks( {\n\t\t\tenableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS,\n\t\t} );\n\t}\n\tregisterLegacyWidgetVariations( blockEditorSettings );\n\tregisterWidgetGroupBlock();\n\n\t// As we are unregistering `core/freeform` to avoid the Classic block, we must\n\t// replace it with something as the default freeform content handler. Failure to\n\t// do this will result in errors in the default block parser.\n\t// see: https://github.com/WordPress/gutenberg/issues/33097\n\tsetFreeformContentHandlerName( 'core/html' );\n\n\tconst SidebarControl = getSidebarControl( blockEditorSettings );\n\n\twp.customize.sectionConstructor.sidebar = getSidebarSection();\n\twp.customize.controlConstructor.sidebar_block_editor = SidebarControl;\n\n\tconst container = document.createElement( 'div' );\n\tdocument.body.appendChild( container );\n\n\twp.customize.bind( 'ready', () => {\n\t\tconst sidebarControls = [];\n\t\twp.customize.control.each( ( control ) => {\n\t\t\tif ( control instanceof SidebarControl ) {\n\t\t\t\tsidebarControls.push( control );\n\t\t\t}\n\t\t} );\n\n\t\tcreateRoot( container ).render(\n\t\t\t<CustomizeWidgets\n\t\t\t\tapi={ wp.customize }\n\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t/>\n\t\t);\n\t} );\n}\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;AAGA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAKA,IAAAE,QAAA,GAAAF,OAAA;AAKA,IAAAG,OAAA,GAAAH,OAAA;AAIA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AAKA,IAAAM,iBAAA,GAAAC,sBAAA,CAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAD,sBAAA,CAAAP,OAAA;AACA,IAAAS,eAAA,GAAAF,sBAAA,CAAAP,OA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AC;;EAE1B;EACA;EACA;EACA;EACA,IAAAC,qCAA6B,EAAE,WAAY,CAAC;EAE5C,MAAMC,cAAc,GAAG,IAAAC,uBAAiB,EAAEzB,mBAAoB,CAAC;EAE/DN,EAAE,CAACgC,SAAS,CAACC,kBAAkB,CAACC,OAAO,GAAG,IAAAC,uBAAiB,EAAC,CAAC;EAC7DnC,EAAE,CAACgC,SAAS,CAACI,kBAAkB,CAACC,oBAAoB,GAAGP,cAAc;EAErE,MAAMQ,SAAS,GAAGC,QAAQ,CAACC,aAAa,CAAE,KAAM,CAAC;EACjDD,QAAQ,CAACE,IAAI,CAACC,WAAW,CAAEJ,SAAU,CAAC;EAEtCtC,EAAE,CAACgC,SAAS,CAACW,IAAI,CAAE,OAAO,EAAE,MAAM;IACjC,MAAMC,eAAe,GAAG,EAAE;IAC1B5C,EAAE,CAACgC,SAAS,CAACa,OAAO,CAACC,IAAI,CAAID,OAAO,IAAM;MACzC,IAAKA,OAAO,YAAYf,cAAc,EAAG;QACxCc,eAAe,CAACG,IAAI,CAAEF,OAAQ,CAAC;MAChC;IACD,CAAE,CAAC;IAEH,IAAAG,mBAAU,EAAEV,SAAU,CAAC,CAACW,MAAM,eAC7B,IAAAnD,WAAA,CAAAoD,GAAA,EAACxD,iBAAA,CAAAyD,OAAgB;MAChBC,GAAG,EAAGpD,EAAE,CAACgC,SAAW;MACpBY,eAAe,EAAGA,eAAiB;MACnCtC,mBAAmB,EAAGA;IAAqB,CAC3C,CACF,CAAC;EACF,CAAE,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
5
4
|
import { useRef, useEffect } from '@wordpress/element';
|
|
6
5
|
import { ButtonBlockAppender, store as blockEditorStore } from '@wordpress/block-editor';
|
|
7
6
|
import { useSelect } from '@wordpress/data';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
export default function BlockAppender(props) {
|
|
9
9
|
const ref = useRef();
|
|
10
10
|
const isBlocksListEmpty = useSelect(select => select(blockEditorStore).getBlockCount() === 0);
|
|
@@ -21,7 +21,7 @@ export default function BlockAppender(props) {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
}, [isBlocksListEmpty]);
|
|
24
|
-
return
|
|
24
|
+
return /*#__PURE__*/_jsx(ButtonBlockAppender, {
|
|
25
25
|
...props,
|
|
26
26
|
ref: ref
|
|
27
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useRef","useEffect","ButtonBlockAppender","store","blockEditorStore","useSelect","BlockAppender","props","ref","isBlocksListEmpty","select","getBlockCount","current","ownerDocument","activeElement","body","focus"
|
|
1
|
+
{"version":3,"names":["useRef","useEffect","ButtonBlockAppender","store","blockEditorStore","useSelect","jsx","_jsx","BlockAppender","props","ref","isBlocksListEmpty","select","getBlockCount","current","ownerDocument","activeElement","body","focus"],"sources":["@wordpress/customize-widgets/src/components/block-appender/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useRef, useEffect } from '@wordpress/element';\nimport {\n\tButtonBlockAppender,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect } from '@wordpress/data';\n\nexport default function BlockAppender( props ) {\n\tconst ref = useRef();\n\tconst isBlocksListEmpty = useSelect(\n\t\t( select ) => select( blockEditorStore ).getBlockCount() === 0\n\t);\n\n\t// Move the focus to the block appender to prevent focus from\n\t// being lost when emptying the widget area.\n\tuseEffect( () => {\n\t\tif ( isBlocksListEmpty && ref.current ) {\n\t\t\tconst { ownerDocument } = ref.current;\n\n\t\t\tif (\n\t\t\t\t! ownerDocument.activeElement ||\n\t\t\t\townerDocument.activeElement === ownerDocument.body\n\t\t\t) {\n\t\t\t\tref.current.focus();\n\t\t\t}\n\t\t}\n\t}, [ isBlocksListEmpty ] );\n\n\treturn <ButtonBlockAppender { ...props } ref={ ref } />;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAM,EAAEC,SAAS,QAAQ,oBAAoB;AACtD,SACCC,mBAAmB,EACnBC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,SAAS,QAAQ,iBAAiB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5C,eAAe,SAASC,aAAaA,CAAEC,KAAK,EAAG;EAC9C,MAAMC,GAAG,GAAGV,MAAM,CAAC,CAAC;EACpB,MAAMW,iBAAiB,GAAGN,SAAS,CAChCO,MAAM,IAAMA,MAAM,CAAER,gBAAiB,CAAC,CAACS,aAAa,CAAC,CAAC,KAAK,CAC9D,CAAC;;EAED;EACA;EACAZ,SAAS,CAAE,MAAM;IAChB,IAAKU,iBAAiB,IAAID,GAAG,CAACI,OAAO,EAAG;MACvC,MAAM;QAAEC;MAAc,CAAC,GAAGL,GAAG,CAACI,OAAO;MAErC,IACC,CAAEC,aAAa,CAACC,aAAa,IAC7BD,aAAa,CAACC,aAAa,KAAKD,aAAa,CAACE,IAAI,EACjD;QACDP,GAAG,CAACI,OAAO,CAACI,KAAK,CAAC,CAAC;MACpB;IACD;EACD,CAAC,EAAE,CAAEP,iBAAiB,CAAG,CAAC;EAE1B,oBAAOJ,IAAA,CAACL,mBAAmB;IAAA,GAAMO,KAAK;IAAGC,GAAG,EAAGA;EAAK,CAAE,CAAC;AACxD","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
1
|
/**
|
|
3
2
|
* WordPress dependencies
|
|
4
3
|
*/
|
|
@@ -7,6 +6,7 @@ import { __ } from '@wordpress/i18n';
|
|
|
7
6
|
import { MenuItem } from '@wordpress/components';
|
|
8
7
|
import { useSelect } from '@wordpress/data';
|
|
9
8
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
function BlockInspectorButton({
|
|
11
11
|
inspector,
|
|
12
12
|
closeMenu,
|
|
@@ -14,7 +14,7 @@ function BlockInspectorButton({
|
|
|
14
14
|
}) {
|
|
15
15
|
const selectedBlockClientId = useSelect(select => select(blockEditorStore).getSelectedBlockClientId(), []);
|
|
16
16
|
const selectedBlock = useMemo(() => document.getElementById(`block-${selectedBlockClientId}`), [selectedBlockClientId]);
|
|
17
|
-
return
|
|
17
|
+
return /*#__PURE__*/_jsx(MenuItem, {
|
|
18
18
|
onClick: () => {
|
|
19
19
|
// Open the inspector.
|
|
20
20
|
inspector.open({
|
|
@@ -23,8 +23,9 @@ function BlockInspectorButton({
|
|
|
23
23
|
// Then close the dropdown menu.
|
|
24
24
|
closeMenu();
|
|
25
25
|
},
|
|
26
|
-
...props
|
|
27
|
-
|
|
26
|
+
...props,
|
|
27
|
+
children: __('Show more settings')
|
|
28
|
+
});
|
|
28
29
|
}
|
|
29
30
|
export default BlockInspectorButton;
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useMemo","__","MenuItem","useSelect","store","blockEditorStore","BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","select","getSelectedBlockClientId","selectedBlock","document","getElementById","
|
|
1
|
+
{"version":3,"names":["useMemo","__","MenuItem","useSelect","store","blockEditorStore","jsx","_jsx","BlockInspectorButton","inspector","closeMenu","props","selectedBlockClientId","select","getSelectedBlockClientId","selectedBlock","document","getElementById","onClick","open","returnFocusWhenClose","children"],"sources":["@wordpress/customize-widgets/src/components/block-inspector-button/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport { useSelect } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\nfunction BlockInspectorButton( { inspector, closeMenu, ...props } ) {\n\tconst selectedBlockClientId = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSelectedBlockClientId(),\n\t\t[]\n\t);\n\n\tconst selectedBlock = useMemo(\n\t\t() => document.getElementById( `block-${ selectedBlockClientId }` ),\n\t\t[ selectedBlockClientId ]\n\t);\n\n\treturn (\n\t\t<MenuItem\n\t\t\tonClick={ () => {\n\t\t\t\t// Open the inspector.\n\t\t\t\tinspector.open( {\n\t\t\t\t\treturnFocusWhenClose: selectedBlock,\n\t\t\t\t} );\n\t\t\t\t// Then close the dropdown menu.\n\t\t\t\tcloseMenu();\n\t\t\t} }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t{ __( 'Show more settings' ) }\n\t\t</MenuItem>\n\t);\n}\n\nexport default BlockInspectorButton;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SAASC,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEpE,SAASC,oBAAoBA,CAAE;EAAEC,SAAS;EAAEC,SAAS;EAAE,GAAGC;AAAM,CAAC,EAAG;EACnE,MAAMC,qBAAqB,GAAGT,SAAS,CACpCU,MAAM,IAAMA,MAAM,CAAER,gBAAiB,CAAC,CAACS,wBAAwB,CAAC,CAAC,EACnE,EACD,CAAC;EAED,MAAMC,aAAa,GAAGf,OAAO,CAC5B,MAAMgB,QAAQ,CAACC,cAAc,CAAG,SAASL,qBAAuB,EAAE,CAAC,EACnE,CAAEA,qBAAqB,CACxB,CAAC;EAED,oBACCL,IAAA,CAACL,QAAQ;IACRgB,OAAO,EAAGA,CAAA,KAAM;MACf;MACAT,SAAS,CAACU,IAAI,CAAE;QACfC,oBAAoB,EAAEL;MACvB,CAAE,CAAC;MACH;MACAL,SAAS,CAAC,CAAC;IACZ,CAAG;IAAA,GACEC,KAAK;IAAAU,QAAA,EAERpB,EAAE,CAAE,oBAAqB;EAAC,CACnB,CAAC;AAEb;AAEA,eAAeO,oBAAoB","ignoreList":[]}
|