@wordpress/customize-widgets 6.1.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/components/block-appender/index.cjs.map +1 -1
- package/build/components/customize-widgets/index.cjs +13 -11
- package/build/components/customize-widgets/index.cjs.map +1 -1
- package/build/components/customize-widgets/use-clear-selected-block.cjs.map +1 -1
- package/build/components/error-boundary/index.cjs +1 -1
- package/build/components/error-boundary/index.cjs.map +1 -1
- package/build/components/focus-control/index.cjs.map +1 -1
- package/build/components/focus-control/use-blocks-focus-control.cjs.map +1 -1
- package/build/components/header/index.cjs +23 -16
- package/build/components/header/index.cjs.map +1 -1
- package/build/components/inserter/use-inserter.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/config.cjs +5 -0
- package/build/components/keyboard-shortcut-help-modal/config.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs +9 -7
- package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/index.cjs +12 -11
- package/build/components/keyboard-shortcut-help-modal/index.cjs.map +1 -1
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs +35 -13
- package/build/components/keyboard-shortcut-help-modal/shortcut.cjs.map +1 -1
- package/build/components/keyboard-shortcuts/index.cjs.map +1 -1
- package/build/components/more-menu/index.cjs +14 -10
- package/build/components/more-menu/index.cjs.map +1 -1
- package/build/components/sidebar-block-editor/index.cjs +15 -13
- package/build/components/sidebar-block-editor/index.cjs.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-adapter.cjs.map +1 -1
- package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs +10 -8
- package/build/components/sidebar-block-editor/sidebar-editor-provider.cjs.map +1 -1
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs +9 -7
- package/build/components/sidebar-block-editor/use-sidebar-block-editor.cjs.map +1 -1
- package/build/controls/inserter-outer-section.cjs +2 -2
- package/build/controls/inserter-outer-section.cjs.map +1 -1
- package/build/controls/sidebar-control.cjs +10 -8
- package/build/controls/sidebar-control.cjs.map +1 -1
- package/build/controls/sidebar-section.cjs +8 -6
- package/build/controls/sidebar-section.cjs.map +1 -1
- package/build/index.cjs +12 -11
- package/build/index.cjs.map +1 -1
- package/build/store/index.cjs +11 -9
- package/build/store/index.cjs.map +1 -1
- package/build/utils.cjs.map +1 -1
- package/build-module/components/error-boundary/index.mjs +2 -2
- package/build-module/components/error-boundary/index.mjs.map +1 -1
- package/build-module/components/focus-control/use-blocks-focus-control.mjs.map +1 -1
- package/build-module/components/header/index.mjs +12 -7
- package/build-module/components/header/index.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs +5 -0
- package/build-module/components/keyboard-shortcut-help-modal/config.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs +1 -2
- package/build-module/components/keyboard-shortcut-help-modal/index.mjs.map +1 -1
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs +35 -13
- package/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs.map +1 -1
- package/build-module/components/more-menu/index.mjs +6 -4
- package/build-module/components/more-menu/index.mjs.map +1 -1
- package/build-module/components/sidebar-block-editor/sidebar-adapter.mjs.map +1 -1
- package/build-module/controls/inserter-outer-section.mjs +3 -3
- package/build-module/controls/inserter-outer-section.mjs.map +1 -1
- package/build-module/index.mjs +1 -2
- package/build-module/index.mjs.map +1 -1
- package/build-module/utils.mjs.map +1 -1
- package/build-style/style-rtl.css +44 -25
- package/build-style/style.css +44 -25
- package/build-types/components/block-appender/index.d.ts +2 -0
- package/build-types/components/block-appender/index.d.ts.map +1 -0
- package/build-types/components/block-inspector-button/index.d.ts +7 -0
- package/build-types/components/block-inspector-button/index.d.ts.map +1 -0
- package/build-types/components/customize-widgets/index.d.ts +6 -0
- package/build-types/components/customize-widgets/index.d.ts.map +1 -0
- package/build-types/components/customize-widgets/use-clear-selected-block.d.ts +18 -0
- package/build-types/components/customize-widgets/use-clear-selected-block.d.ts.map +1 -0
- package/build-types/components/error-boundary/index.d.ts +14 -0
- package/build-types/components/error-boundary/index.d.ts.map +1 -0
- package/build-types/components/focus-control/index.d.ts +7 -0
- package/build-types/components/focus-control/index.d.ts.map +1 -0
- package/build-types/components/focus-control/use-blocks-focus-control.d.ts +2 -0
- package/build-types/components/focus-control/use-blocks-focus-control.d.ts.map +1 -0
- package/build-types/components/header/index.d.ts +9 -0
- package/build-types/components/header/index.d.ts.map +1 -0
- package/build-types/components/inserter/index.d.ts +5 -0
- package/build-types/components/inserter/index.d.ts.map +1 -0
- package/build-types/components/inserter/use-inserter.d.ts +2 -0
- package/build-types/components/inserter/use-inserter.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts +3 -0
- package/build-types/components/keyboard-shortcut-help-modal/config.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts +5 -0
- package/build-types/components/keyboard-shortcut-help-modal/dynamic-shortcut.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts +5 -0
- package/build-types/components/keyboard-shortcut-help-modal/index.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts +25 -0
- package/build-types/components/keyboard-shortcut-help-modal/shortcut.d.ts.map +1 -0
- package/build-types/components/keyboard-shortcuts/index.d.ts +11 -0
- package/build-types/components/keyboard-shortcuts/index.d.ts.map +1 -0
- package/build-types/components/more-menu/index.d.ts +2 -0
- package/build-types/components/more-menu/index.d.ts.map +1 -0
- package/build-types/components/sidebar-block-editor/index.d.ts +7 -0
- package/build-types/components/sidebar-block-editor/index.d.ts.map +1 -0
- package/build-types/components/sidebar-block-editor/sidebar-adapter.d.ts +37 -0
- package/build-types/components/sidebar-block-editor/sidebar-adapter.d.ts.map +1 -0
- package/build-types/components/sidebar-block-editor/sidebar-editor-provider.d.ts +6 -0
- package/build-types/components/sidebar-block-editor/sidebar-editor-provider.d.ts.map +1 -0
- package/build-types/components/sidebar-block-editor/use-sidebar-block-editor.d.ts +2 -0
- package/build-types/components/sidebar-block-editor/use-sidebar-block-editor.d.ts.map +1 -0
- package/build-types/components/sidebar-controls/index.d.ts +9 -0
- package/build-types/components/sidebar-controls/index.d.ts.map +1 -0
- package/build-types/components/welcome-guide/index.d.ts +4 -0
- package/build-types/components/welcome-guide/index.d.ts.map +1 -0
- package/build-types/controls/inserter-outer-section.d.ts +9 -0
- package/build-types/controls/inserter-outer-section.d.ts.map +1 -0
- package/build-types/controls/inspector-section.d.ts +17 -0
- package/build-types/controls/inspector-section.d.ts.map +1 -0
- package/build-types/controls/sidebar-control.d.ts +19 -0
- package/build-types/controls/sidebar-control.d.ts.map +1 -0
- package/build-types/controls/sidebar-section.d.ts +22 -0
- package/build-types/controls/sidebar-section.d.ts.map +1 -0
- package/build-types/filters/index.d.ts +4 -0
- package/build-types/filters/index.d.ts.map +1 -0
- package/build-types/filters/move-to-sidebar.d.ts +2 -0
- package/build-types/filters/move-to-sidebar.d.ts.map +1 -0
- package/build-types/filters/replace-media-upload.d.ts +2 -0
- package/build-types/filters/replace-media-upload.d.ts.map +1 -0
- package/build-types/filters/wide-widget-display.d.ts +2 -0
- package/build-types/filters/wide-widget-display.d.ts.map +1 -0
- package/build-types/index.d.ts +10 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/store/actions.d.ts +39 -0
- package/build-types/store/actions.d.ts.map +1 -0
- package/build-types/store/constants.d.ts +5 -0
- package/build-types/store/constants.d.ts.map +1 -0
- package/build-types/store/index.d.ts +9 -0
- package/build-types/store/index.d.ts.map +1 -0
- package/build-types/store/reducer.d.ts +14 -0
- package/build-types/store/reducer.d.ts.map +1 -0
- package/build-types/store/selectors.d.ts +35 -0
- package/build-types/store/selectors.d.ts.map +1 -0
- package/build-types/utils.d.ts +32 -0
- package/build-types/utils.d.ts.map +1 -0
- package/package.json +28 -28
- package/src/components/error-boundary/index.jsx +2 -2
- package/src/components/header/index.jsx +1 -1
- package/src/components/header/style.scss +27 -13
- package/src/components/header/test/index.jsdom.test.tsx +5 -0
- package/src/components/inserter/style.scss +14 -4
- package/src/components/keyboard-shortcut-help-modal/config.js +3 -0
- package/src/components/keyboard-shortcut-help-modal/index.jsx +0 -2
- package/src/components/keyboard-shortcut-help-modal/shortcut.jsx +39 -25
- package/src/components/keyboard-shortcut-help-modal/style.scss +1 -1
- package/src/components/more-menu/index.jsx +3 -8
- package/src/components/sidebar-block-editor/style.scss +9 -0
- package/src/controls/inserter-outer-section.js +3 -3
- package/src/index.jsx +1 -4
- package/src/utils.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-adapter.mjs","names":[],"sources":["../../../src/components/sidebar-block-editor/sidebar-adapter.js"],"sourcesContent":["import { settingIdToWidgetId } from '../../utils';\n\nconst { wp } = window;\n\nfunction parseWidgetId( widgetId ) {\n\tconst matches = widgetId.match( /^(.+)-(\\d+)$/ );\n\tif ( matches ) {\n\t\treturn {\n\t\t\tidBase: matches[ 1 ],\n\t\t\tnumber: parseInt( matches[ 2 ], 10 ),\n\t\t};\n\t}\n\n\t// Likely an old single widget.\n\treturn { idBase: widgetId };\n}\n\nfunction widgetIdToSettingId( widgetId ) {\n\tconst { idBase, number } = parseWidgetId( widgetId );\n\tif ( number ) {\n\t\treturn `widget_${ idBase }[${ number }]`;\n\t}\n\n\treturn `widget_${ idBase }`;\n}\n\n/**\n * This is a custom debounce function to call different callbacks depending on\n * whether it's the _leading_ call or not.\n *\n * @param {Function} leading The callback that gets called first.\n * @param {Function} callback The callback that gets called after the first time.\n * @param {number} timeout The debounced time in milliseconds.\n * @return {Function} The debounced function.\n */\nfunction debounce( leading, callback, timeout ) {\n\tlet isLeading = false;\n\tlet timerID;\n\n\tfunction debounced( ...args ) {\n\t\tconst result = ( isLeading ? callback : leading ).apply( this, args );\n\n\t\tisLeading = true;\n\n\t\tclearTimeout( timerID );\n\n\t\ttimerID = setTimeout( () => {\n\t\t\tisLeading = false;\n\t\t}, timeout );\n\n\t\treturn result;\n\t}\n\n\tdebounced.cancel = () => {\n\t\tisLeading = false;\n\t\tclearTimeout( timerID );\n\t};\n\n\treturn debounced;\n}\n\nexport default class SidebarAdapter {\n\tconstructor( setting, api ) {\n\t\tthis.setting = setting;\n\t\tthis.api = api;\n\n\t\tthis.locked = false;\n\t\tthis.widgetsCache = new WeakMap();\n\t\tthis.subscribers = new Set();\n\n\t\tthis.history = [\n\t\t\tthis._getWidgetIds().map( ( widgetId ) =>\n\t\t\t\tthis.getWidget( widgetId )\n\t\t\t),\n\t\t];\n\t\tthis.historyIndex = 0;\n\t\tthis.historySubscribers = new Set();\n\t\t// Debounce the input for 1 second.\n\t\tthis._debounceSetHistory = debounce(\n\t\t\tthis._pushHistory,\n\t\t\tthis._replaceHistory,\n\t\t\t1000\n\t\t);\n\n\t\tthis.setting.bind( this._handleSettingChange.bind( this ) );\n\t\tthis.api.bind( 'change', this._handleAllSettingsChange.bind( this ) );\n\n\t\tthis.undo = this.undo.bind( this );\n\t\tthis.redo = this.redo.bind( this );\n\t\tthis.save = this.save.bind( this );\n\t}\n\n\tsubscribe( callback ) {\n\t\tthis.subscribers.add( callback );\n\n\t\treturn () => {\n\t\t\tthis.subscribers.delete( callback );\n\t\t};\n\t}\n\n\tgetWidgets() {\n\t\treturn this.history[ this.historyIndex ];\n\t}\n\n\t_emit( ...args ) {\n\t\tfor ( const callback of this.subscribers ) {\n\t\t\tcallback( ...args );\n\t\t}\n\t}\n\n\t_getWidgetIds() {\n\t\treturn this.setting.get();\n\t}\n\n\t_pushHistory() {\n\t\tthis.history = [\n\t\t\t...this.history.slice( 0, this.historyIndex + 1 ),\n\t\t\tthis._getWidgetIds().map( ( widgetId ) =>\n\t\t\t\tthis.getWidget( widgetId )\n\t\t\t),\n\t\t];\n\t\tthis.historyIndex += 1;\n\n\t\tthis.historySubscribers.forEach( ( listener ) => listener() );\n\t}\n\n\t_replaceHistory() {\n\t\tthis.history[ this.historyIndex ] = this._getWidgetIds().map(\n\t\t\t( widgetId ) => this.getWidget( widgetId )\n\t\t);\n\t}\n\n\t_handleSettingChange() {\n\t\tif ( this.locked ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst prevWidgets = this.getWidgets();\n\n\t\tthis._pushHistory();\n\n\t\tthis._emit( prevWidgets, this.getWidgets() );\n\t}\n\n\t_handleAllSettingsChange( setting ) {\n\t\tif ( this.locked ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! setting.id.startsWith( 'widget_' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst widgetId = settingIdToWidgetId( setting.id );\n\t\tif ( ! this.setting.get().includes( widgetId ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst prevWidgets = this.getWidgets();\n\n\t\tthis._pushHistory();\n\n\t\tthis._emit( prevWidgets, this.getWidgets() );\n\t}\n\n\t_createWidget( widget ) {\n\t\tconst widgetModel = wp.customize.Widgets.availableWidgets.findWhere( {\n\t\t\tid_base: widget.idBase,\n\t\t} );\n\n\t\tlet number = widget.number;\n\t\tif ( widgetModel.get( 'is_multi' ) && ! number ) {\n\t\t\twidgetModel.set(\n\t\t\t\t'multi_number',\n\t\t\t\twidgetModel.get( 'multi_number' ) + 1\n\t\t\t);\n\t\t\tnumber = widgetModel.get( 'multi_number' );\n\t\t}\n\n\t\tconst settingId = number\n\t\t\t? `widget_${ widget.idBase }[${ number }]`\n\t\t\t: `widget_${ widget.idBase }`;\n\n\t\tconst settingArgs = {\n\t\t\ttransport: wp.customize.Widgets.data.selectiveRefreshableWidgets[\n\t\t\t\twidgetModel.get( 'id_base' )\n\t\t\t]\n\t\t\t\t? 'postMessage'\n\t\t\t\t: 'refresh',\n\t\t\tpreviewer: this.setting.previewer,\n\t\t};\n\t\tconst setting = this.api.create(\n\t\t\tsettingId,\n\t\t\tsettingId,\n\t\t\t'',\n\t\t\tsettingArgs\n\t\t);\n\t\tsetting.set( widget.instance );\n\n\t\tconst widgetId = settingIdToWidgetId( settingId );\n\n\t\treturn widgetId;\n\t}\n\n\t_removeWidget( widget ) {\n\t\tconst settingId = widgetIdToSettingId( widget.id );\n\t\tconst setting = this.api( settingId );\n\n\t\tif ( setting ) {\n\t\t\tconst instance = setting.get();\n\t\t\tthis.widgetsCache.delete( instance );\n\t\t}\n\n\t\tthis.api.remove( settingId );\n\t}\n\n\t_updateWidget( widget ) {\n\t\tconst prevWidget = this.getWidget( widget.id );\n\n\t\t// Bail out update if nothing changed.\n\t\tif ( prevWidget === widget ) {\n\t\t\treturn widget.id;\n\t\t}\n\n\t\t// Update existing setting if only the widget's instance changed.\n\t\tif (\n\t\t\tprevWidget.idBase &&\n\t\t\twidget.idBase &&\n\t\t\tprevWidget.idBase === widget.idBase\n\t\t) {\n\t\t\tconst settingId = widgetIdToSettingId( widget.id );\n\t\t\tthis.api( settingId ).set( widget.instance );\n\t\t\treturn widget.id;\n\t\t}\n\n\t\t// Otherwise delete and re-create.\n\t\tthis._removeWidget( widget );\n\t\treturn this._createWidget( widget );\n\t}\n\n\tgetWidget( widgetId ) {\n\t\tif ( ! widgetId ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { idBase, number } = parseWidgetId( widgetId );\n\t\tconst settingId = widgetIdToSettingId( widgetId );\n\t\tconst setting = this.api( settingId );\n\n\t\tif ( ! setting ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst instance = setting.get();\n\n\t\tif ( this.widgetsCache.has( instance ) ) {\n\t\t\treturn this.widgetsCache.get( instance );\n\t\t}\n\n\t\tconst widget = {\n\t\t\tid: widgetId,\n\t\t\tidBase,\n\t\t\tnumber,\n\t\t\tinstance,\n\t\t};\n\n\t\tthis.widgetsCache.set( instance, widget );\n\n\t\treturn widget;\n\t}\n\n\t_updateWidgets( nextWidgets ) {\n\t\tthis.locked = true;\n\n\t\tconst addedWidgetIds = [];\n\n\t\tconst nextWidgetIds = nextWidgets.map( ( nextWidget ) => {\n\t\t\tif ( nextWidget.id && this.getWidget( nextWidget.id ) ) {\n\t\t\t\taddedWidgetIds.push( null );\n\n\t\t\t\treturn this._updateWidget( nextWidget );\n\t\t\t}\n\n\t\t\tconst widgetId = this._createWidget( nextWidget );\n\n\t\t\taddedWidgetIds.push( widgetId );\n\n\t\t\treturn widgetId;\n\t\t} );\n\n\t\tconst deletedWidgets = this.getWidgets().filter(\n\t\t\t( widget ) => ! nextWidgetIds.includes( widget.id )\n\t\t);\n\t\tdeletedWidgets.forEach( ( widget ) => this._removeWidget( widget ) );\n\n\t\tthis.setting.set( nextWidgetIds );\n\n\t\tthis.locked = false;\n\n\t\treturn addedWidgetIds;\n\t}\n\n\tsetWidgets( nextWidgets ) {\n\t\tconst addedWidgetIds = this._updateWidgets( nextWidgets );\n\n\t\tthis._debounceSetHistory();\n\n\t\treturn addedWidgetIds;\n\t}\n\n\t/**\n\t * Undo/Redo related features\n\t */\n\thasUndo() {\n\t\treturn this.historyIndex > 0;\n\t}\n\n\thasRedo() {\n\t\treturn this.historyIndex < this.history.length - 1;\n\t}\n\n\t_seek( historyIndex ) {\n\t\tconst currentWidgets = this.getWidgets();\n\n\t\tthis.historyIndex = historyIndex;\n\n\t\tconst widgets = this.history[ this.historyIndex ];\n\n\t\tthis._updateWidgets( widgets );\n\n\t\tthis._emit( currentWidgets, this.getWidgets() );\n\n\t\tthis.historySubscribers.forEach( ( listener ) => listener() );\n\t\tthis._debounceSetHistory.cancel();\n\t}\n\n\tundo() {\n\t\tif ( ! this.hasUndo() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._seek( this.historyIndex - 1 );\n\t}\n\n\tredo() {\n\t\tif ( ! this.hasRedo() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._seek( this.historyIndex + 1 );\n\t}\n\n\tsubscribeHistory( listener ) {\n\t\tthis.historySubscribers.add( listener );\n\n\t\treturn () => {\n\t\t\t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KAAK,oBAAoB,OAAO;CACjC;CAEA,OAAO;EACN,IAAK,CAAE,KAAK,QAAQ,GACnB;EAGD,KAAK,MAAO,KAAK,eAAe,CAAE;CACnC;CAEA,OAAO;EACN,IAAK,CAAE,KAAK,QAAQ,GACnB;EAGD,KAAK,MAAO,KAAK,eAAe,CAAE;CACnC;CAEA,iBAAkB,UAAW;EAC5B,KAAK,mBAAmB,IAAK,QAAS;EAEtC,aAAa;GACZ,KAAK,mBAAmB,OAAQ,QAAS;EAC1C;CACD;CAEA,OAAO;EACN,KAAK,IAAI,UAAU,KAAK;CACzB;AACD"}
|
|
1
|
+
{"version":3,"file":"sidebar-adapter.mjs","names":[],"sources":["../../../src/components/sidebar-block-editor/sidebar-adapter.js"],"sourcesContent":["import { settingIdToWidgetId } from '../../utils';\n\nconst { wp } = window;\n\nfunction parseWidgetId( widgetId ) {\n\tconst matches = widgetId.match( /^(.+)-(\\d+)$/ );\n\tif ( matches ) {\n\t\treturn {\n\t\t\tidBase: matches[ 1 ],\n\t\t\tnumber: parseInt( matches[ 2 ], 10 ),\n\t\t};\n\t}\n\n\t// Likely an old single widget.\n\treturn { idBase: widgetId };\n}\n\nfunction widgetIdToSettingId( widgetId ) {\n\tconst { idBase, number } = parseWidgetId( widgetId );\n\tif ( number ) {\n\t\treturn `widget_${ idBase }[${ number }]`;\n\t}\n\n\treturn `widget_${ idBase }`;\n}\n\n/**\n * This is a custom debounce function to call different callbacks depending on\n * whether it's the _leading_ call or not.\n *\n * @param {Function} leading The callback that gets called first.\n * @param {Function} callback The callback that gets called after the first time.\n * @param {number} timeout The debounced time in milliseconds.\n * @return {Function} The debounced function.\n */\nfunction debounce( leading, callback, timeout ) {\n\tlet isLeading = false;\n\tlet timerID;\n\n\tfunction debounced( ...args ) {\n\t\tconst result = ( isLeading ? callback : leading ).apply( this, args );\n\n\t\tisLeading = true;\n\n\t\tclearTimeout( timerID );\n\n\t\ttimerID = setTimeout( () => {\n\t\t\tisLeading = false;\n\t\t}, timeout );\n\n\t\treturn result;\n\t}\n\n\tdebounced.cancel = () => {\n\t\tisLeading = false;\n\t\tclearTimeout( timerID );\n\t};\n\n\treturn debounced;\n}\n\nexport default class SidebarAdapter {\n\tconstructor( setting, api ) {\n\t\tthis.setting = setting;\n\t\tthis.api = api;\n\n\t\tthis.locked = false;\n\t\tthis.widgetsCache = new WeakMap();\n\t\tthis.subscribers = new Set();\n\n\t\tthis.history = [\n\t\t\tthis._getWidgetIds().map( ( widgetId ) =>\n\t\t\t\tthis.getWidget( widgetId )\n\t\t\t),\n\t\t];\n\t\tthis.historyIndex = 0;\n\t\tthis.historySubscribers = new Set();\n\t\t// Debounce the input for 1 second.\n\t\tthis._debounceSetHistory = debounce(\n\t\t\tthis._pushHistory,\n\t\t\tthis._replaceHistory,\n\t\t\t1000\n\t\t);\n\n\t\tthis.setting.bind( this._handleSettingChange.bind( this ) );\n\t\tthis.api.bind( 'change', this._handleAllSettingsChange.bind( this ) );\n\n\t\tthis.undo = this.undo.bind( this );\n\t\tthis.redo = this.redo.bind( this );\n\t\tthis.save = this.save.bind( this );\n\t}\n\n\tsubscribe( callback ) {\n\t\tthis.subscribers.add( callback );\n\n\t\treturn () => {\n\t\t\tthis.subscribers.delete( callback );\n\t\t};\n\t}\n\n\tgetWidgets() {\n\t\treturn this.history[ this.historyIndex ];\n\t}\n\n\t_emit( ...args ) {\n\t\tfor ( const callback of this.subscribers ) {\n\t\t\tcallback( ...args );\n\t\t}\n\t}\n\n\t_getWidgetIds() {\n\t\treturn this.setting.get();\n\t}\n\n\t_pushHistory() {\n\t\tthis.history = [\n\t\t\t...this.history.slice( 0, this.historyIndex + 1 ),\n\t\t\tthis._getWidgetIds().map( ( widgetId ) =>\n\t\t\t\tthis.getWidget( widgetId )\n\t\t\t),\n\t\t];\n\t\tthis.historyIndex += 1;\n\n\t\tthis.historySubscribers.forEach( ( listener ) => listener() );\n\t}\n\n\t_replaceHistory() {\n\t\tthis.history[ this.historyIndex ] = this._getWidgetIds().map(\n\t\t\t( widgetId ) => this.getWidget( widgetId )\n\t\t);\n\t}\n\n\t_handleSettingChange() {\n\t\tif ( this.locked ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst prevWidgets = this.getWidgets();\n\n\t\tthis._pushHistory();\n\n\t\tthis._emit( prevWidgets, this.getWidgets() );\n\t}\n\n\t_handleAllSettingsChange( setting ) {\n\t\tif ( this.locked ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( ! setting.id.startsWith( 'widget_' ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst widgetId = settingIdToWidgetId( setting.id );\n\t\tif ( ! this.setting.get().includes( widgetId ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst prevWidgets = this.getWidgets();\n\n\t\tthis._pushHistory();\n\n\t\tthis._emit( prevWidgets, this.getWidgets() );\n\t}\n\n\t_createWidget( widget ) {\n\t\tconst widgetModel = wp.customize.Widgets.availableWidgets.findWhere( {\n\t\t\tid_base: widget.idBase,\n\t\t} );\n\n\t\tlet number = widget.number;\n\t\tif ( widgetModel.get( 'is_multi' ) && ! number ) {\n\t\t\twidgetModel.set(\n\t\t\t\t'multi_number',\n\t\t\t\twidgetModel.get( 'multi_number' ) + 1\n\t\t\t);\n\t\t\tnumber = widgetModel.get( 'multi_number' );\n\t\t}\n\n\t\tconst settingId = number\n\t\t\t? `widget_${ widget.idBase }[${ number }]`\n\t\t\t: `widget_${ widget.idBase }`;\n\n\t\tconst settingArgs = {\n\t\t\ttransport: wp.customize.Widgets.data.selectiveRefreshableWidgets[\n\t\t\t\twidgetModel.get( 'id_base' )\n\t\t\t]\n\t\t\t\t? 'postMessage'\n\t\t\t\t: 'refresh',\n\t\t\tpreviewer: this.setting.previewer,\n\t\t};\n\t\tconst setting = this.api.create(\n\t\t\tsettingId,\n\t\t\tsettingId,\n\t\t\t'',\n\t\t\tsettingArgs\n\t\t);\n\t\tsetting.set( widget.instance );\n\n\t\tconst widgetId = settingIdToWidgetId( settingId );\n\n\t\treturn widgetId;\n\t}\n\n\t_removeWidget( widget ) {\n\t\tconst settingId = widgetIdToSettingId( widget.id );\n\t\tconst setting = this.api( settingId );\n\n\t\tif ( setting ) {\n\t\t\tconst instance = setting.get();\n\t\t\tthis.widgetsCache.delete( instance );\n\t\t}\n\n\t\tthis.api.remove( settingId );\n\t}\n\n\t_updateWidget( widget ) {\n\t\tconst prevWidget = this.getWidget( widget.id );\n\n\t\t// Bail out update if nothing changed.\n\t\tif ( prevWidget === widget ) {\n\t\t\treturn widget.id;\n\t\t}\n\n\t\t// Update existing setting if only the widget's instance changed.\n\t\tif (\n\t\t\tprevWidget.idBase &&\n\t\t\twidget.idBase &&\n\t\t\tprevWidget.idBase === widget.idBase\n\t\t) {\n\t\t\tconst settingId = widgetIdToSettingId( widget.id );\n\t\t\tthis.api( settingId ).set( widget.instance );\n\t\t\treturn widget.id;\n\t\t}\n\n\t\t// Otherwise delete and re-create.\n\t\tthis._removeWidget( widget );\n\t\treturn this._createWidget( widget );\n\t}\n\n\tgetWidget( widgetId ) {\n\t\tif ( ! widgetId ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst { idBase, number } = parseWidgetId( widgetId );\n\t\tconst settingId = widgetIdToSettingId( widgetId );\n\t\tconst setting = this.api( settingId );\n\n\t\tif ( ! setting ) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst instance = setting.get();\n\n\t\tif ( this.widgetsCache.has( instance ) ) {\n\t\t\treturn this.widgetsCache.get( instance );\n\t\t}\n\n\t\tconst widget = {\n\t\t\tid: widgetId,\n\t\t\tidBase,\n\t\t\tnumber,\n\t\t\tinstance,\n\t\t};\n\n\t\tthis.widgetsCache.set( instance, widget );\n\n\t\treturn widget;\n\t}\n\n\t_updateWidgets( nextWidgets ) {\n\t\tthis.locked = true;\n\n\t\tconst addedWidgetIds = [];\n\n\t\tconst nextWidgetIds = nextWidgets.map( ( nextWidget ) => {\n\t\t\tif ( nextWidget.id && this.getWidget( nextWidget.id ) ) {\n\t\t\t\taddedWidgetIds.push( null );\n\n\t\t\t\treturn this._updateWidget( nextWidget );\n\t\t\t}\n\n\t\t\tconst widgetId = this._createWidget( nextWidget );\n\n\t\t\taddedWidgetIds.push( widgetId );\n\n\t\t\treturn widgetId;\n\t\t} );\n\n\t\tconst deletedWidgets = this.getWidgets().filter(\n\t\t\t( widget ) => ! nextWidgetIds.includes( widget.id )\n\t\t);\n\t\tdeletedWidgets.forEach( ( widget ) => this._removeWidget( widget ) );\n\n\t\tthis.setting.set( nextWidgetIds );\n\n\t\tthis.locked = false;\n\n\t\treturn addedWidgetIds;\n\t}\n\n\tsetWidgets( nextWidgets ) {\n\t\tconst addedWidgetIds = this._updateWidgets( nextWidgets );\n\n\t\tthis._debounceSetHistory();\n\n\t\treturn addedWidgetIds;\n\t}\n\n\t/**\n\t * Undo/Redo related features\n\t */\n\thasUndo() {\n\t\treturn this.historyIndex > 0;\n\t}\n\n\thasRedo() {\n\t\treturn this.historyIndex < this.history.length - 1;\n\t}\n\n\t_seek( historyIndex ) {\n\t\tconst currentWidgets = this.getWidgets();\n\n\t\tthis.historyIndex = historyIndex;\n\n\t\tconst widgets = this.history[ this.historyIndex ];\n\n\t\tthis._updateWidgets( widgets );\n\n\t\tthis._emit( currentWidgets, this.getWidgets() );\n\n\t\tthis.historySubscribers.forEach( ( listener ) => listener() );\n\t\tthis._debounceSetHistory.cancel();\n\t}\n\n\tundo() {\n\t\tif ( ! this.hasUndo() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._seek( this.historyIndex - 1 );\n\t}\n\n\tredo() {\n\t\tif ( ! this.hasRedo() ) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._seek( this.historyIndex + 1 );\n\t}\n\n\tsubscribeHistory( listener ) {\n\t\tthis.historySubscribers.add( listener );\n\n\t\treturn () => {\n\t\t\tthis.historySubscribers.delete( listener );\n\t\t};\n\t}\n\n\tsave() {\n\t\tthis.api.previewer.save();\n\t}\n}\n"],"mappings":";;AAEA,MAAM,EAAE,OA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;CACnC;CAEA,OAAO;EACN,IAAK,CAAE,KAAK,QAAQ,GACnB;EAGD,KAAK,MAAO,KAAK,eAAe,CAAE;CACnC;CAEA,iBAAkB,UAAW;EAC5B,KAAK,mBAAmB,IAAK,QAAS;EAEtC,aAAa;GACZ,KAAK,mBAAmB,OAAQ,QAAS;EAC1C;CACD;CAEA,OAAO;EACN,KAAK,IAAI,UAAU,KAAK;CACzB;AACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ESCAPE } from "@wordpress/keycodes";
|
|
1
|
+
import { ESCAPE, withIgnoreIMEEvents } from "@wordpress/keycodes";
|
|
2
2
|
import { focus } from "@wordpress/dom";
|
|
3
3
|
import { dispatch } from "@wordpress/data";
|
|
4
4
|
import { store } from "../store/index.mjs";
|
|
@@ -22,13 +22,13 @@ function getInserterOuterSection() {
|
|
|
22
22
|
super(...args);
|
|
23
23
|
this.params.type = "outer";
|
|
24
24
|
this.activeElementBeforeExpanded = null;
|
|
25
|
-
this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown", (event) => {
|
|
25
|
+
this.contentContainer[0].ownerDocument.defaultView.addEventListener("keydown", withIgnoreIMEEvents((event) => {
|
|
26
26
|
if (this.expanded() && (event.keyCode === ESCAPE || event.code === "Escape") && !event.defaultPrevented) {
|
|
27
27
|
event.preventDefault();
|
|
28
28
|
event.stopPropagation();
|
|
29
29
|
dispatch(store).setIsInserterOpened(false);
|
|
30
30
|
}
|
|
31
|
-
}, true);
|
|
31
|
+
}), true);
|
|
32
32
|
this.contentContainer.addClass("widgets-inserter");
|
|
33
33
|
this.isFromInternalAction = false;
|
|
34
34
|
this.expanded.bind(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inserter-outer-section.mjs","names":["customizeWidgetsStore"],"sources":["../../src/controls/inserter-outer-section.js"],"sourcesContent":["import { ESCAPE } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\nimport { store as customizeWidgetsStore } from '../store';\n\nexport default function getInserterOuterSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst OuterSection = customize.OuterSection;\n\t// Override the OuterSection class to handle multiple outer sections.\n\t// It closes all the other outer sections whenever one is opened.\n\t// The result is that at most one outer section can be opened at the same time.\n\tcustomize.OuterSection = class extends OuterSection {\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tif ( expanded ) {\n\t\t\t\tcustomize.section.each( ( section ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsection.params.type === 'outer' &&\n\t\t\t\t\t\tsection.id !== this.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ( section.expanded() ) {\n\t\t\t\t\t\t\tsection.collapse();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn super.onChangeExpanded( expanded, args );\n\t\t}\n\t};\n\t// Handle constructor so that \"params.type\" can be correctly pointed to \"outer\".\n\tcustomize.sectionConstructor.outer = customize.OuterSection;\n\n\treturn class InserterOuterSection extends customize.OuterSection {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\t// This is necessary since we're creating a new class which is not identical to the original OuterSection.\n\t\t\t// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436\n\t\t\tthis.params.type = 'outer';\n\n\t\t\tthis.activeElementBeforeExpanded = null;\n\n\t\t\tconst ownerWindow =\n\t\t\t\tthis.contentContainer[ 0 ].ownerDocument.defaultView;\n\n\t\t\t// Handle closing the inserter when pressing the Escape key.\n\t\t\townerWindow.addEventListener(\n\t\t\t\t'keydown',\n\t\t\t\
|
|
1
|
+
{"version":3,"file":"inserter-outer-section.mjs","names":["customizeWidgetsStore"],"sources":["../../src/controls/inserter-outer-section.js"],"sourcesContent":["import { ESCAPE, withIgnoreIMEEvents } from '@wordpress/keycodes';\nimport { focus } from '@wordpress/dom';\nimport { dispatch } from '@wordpress/data';\nimport { store as customizeWidgetsStore } from '../store';\n\nexport default function getInserterOuterSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst OuterSection = customize.OuterSection;\n\t// Override the OuterSection class to handle multiple outer sections.\n\t// It closes all the other outer sections whenever one is opened.\n\t// The result is that at most one outer section can be opened at the same time.\n\tcustomize.OuterSection = class extends OuterSection {\n\t\tonChangeExpanded( expanded, args ) {\n\t\t\tif ( expanded ) {\n\t\t\t\tcustomize.section.each( ( section ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tsection.params.type === 'outer' &&\n\t\t\t\t\t\tsection.id !== this.id\n\t\t\t\t\t) {\n\t\t\t\t\t\tif ( section.expanded() ) {\n\t\t\t\t\t\t\tsection.collapse();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} );\n\t\t\t}\n\n\t\t\treturn super.onChangeExpanded( expanded, args );\n\t\t}\n\t};\n\t// Handle constructor so that \"params.type\" can be correctly pointed to \"outer\".\n\tcustomize.sectionConstructor.outer = customize.OuterSection;\n\n\treturn class InserterOuterSection extends customize.OuterSection {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\t// This is necessary since we're creating a new class which is not identical to the original OuterSection.\n\t\t\t// @See https://github.com/WordPress/wordpress-develop/blob/42b05c397c50d9dc244083eff52991413909d4bd/src/js/_enqueues/wp/customize/controls.js#L1427-L1436\n\t\t\tthis.params.type = 'outer';\n\n\t\t\tthis.activeElementBeforeExpanded = null;\n\n\t\t\tconst ownerWindow =\n\t\t\t\tthis.contentContainer[ 0 ].ownerDocument.defaultView;\n\n\t\t\t// Handle closing the inserter when pressing the Escape key.\n\t\t\townerWindow.addEventListener(\n\t\t\t\t'keydown',\n\t\t\t\twithIgnoreIMEEvents( ( event ) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tthis.expanded() &&\n\t\t\t\t\t\t( event.keyCode === ESCAPE ||\n\t\t\t\t\t\t\tevent.code === 'Escape' ) &&\n\t\t\t\t\t\t! event.defaultPrevented\n\t\t\t\t\t) {\n\t\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t} ),\n\t\t\t\t// Use capture mode to make this run before other event listeners.\n\t\t\t\ttrue\n\t\t\t);\n\n\t\t\tthis.contentContainer.addClass( 'widgets-inserter' );\n\n\t\t\t// Set a flag if the state is being changed from open() or close().\n\t\t\t// Don't propagate the event if it's an internal action to prevent infinite loop.\n\t\t\tthis.isFromInternalAction = false;\n\t\t\tthis.expanded.bind( () => {\n\t\t\t\tif ( ! this.isFromInternalAction ) {\n\t\t\t\t\t// Propagate the event to React to sync the state.\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tthis.expanded()\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthis.isFromInternalAction = false;\n\t\t\t} );\n\t\t}\n\t\topen() {\n\t\t\tif ( ! this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tthis.activeElementBeforeExpanded =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.expand( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// We have to do this in a \"completeCallback\" or else the elements will not yet be visible/tabbable.\n\t\t\t\t\t\t// The first one should be the close button,\n\t\t\t\t\t\t// we want to skip it and choose the second one instead, which is the search box.\n\t\t\t\t\t\tconst searchBox =\n\t\t\t\t\t\t\tfocus.tabbable.find( contentContainer )[ 1 ];\n\t\t\t\t\t\tif ( searchBox ) {\n\t\t\t\t\t\t\tsearchBox.focus();\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t\tclose() {\n\t\t\tif ( this.expanded() ) {\n\t\t\t\tconst contentContainer = this.contentContainer[ 0 ];\n\t\t\t\tconst activeElement =\n\t\t\t\t\tcontentContainer.ownerDocument.activeElement;\n\n\t\t\t\tthis.isFromInternalAction = true;\n\n\t\t\t\tthis.collapse( {\n\t\t\t\t\tcompleteCallback() {\n\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t// Only do this if the active element which triggers the action is inside the inserter,\n\t\t\t\t\t\t// (the close button for instance). In that case the focus will be lost.\n\t\t\t\t\t\t// Otherwise, we don't hijack the focus when the user is focusing on other elements\n\t\t\t\t\t\t// (like the quick inserter).\n\t\t\t\t\t\tif ( contentContainer.contains( activeElement ) ) {\n\t\t\t\t\t\t\t// Return back the focus when closing the inserter.\n\t\t\t\t\t\t\tif ( this.activeElementBeforeExpanded ) {\n\t\t\t\t\t\t\t\tthis.activeElementBeforeExpanded.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t} );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":";;;;;AAKA,SAAwB,0BAA0B;CACjD,MAAM,EACL,IAAI,EAAE,gBACH;CAEJ,MAAM,eAAe,UAAU;CAI/B,UAAU,eAAe,cAAc,aAAa;EACnD,iBAAkB,UAAU,MAAO;GAClC,IAAK,UACJ,UAAU,QAAQ,MAAQ,YAAa;IACtC,IACC,QAAQ,OAAO,SAAS,WACxB,QAAQ,OAAO,KAAK,IAEf;SAAA,QAAQ,SAAS,GACrB,QAAQ,SAAS;IAAA;GAGpB,CAAE;GAGH,OAAO,MAAM,iBAAkB,UAAU,IAAK;EAC/C;CACD;CAEA,UAAU,mBAAmB,QAAQ,UAAU;CAE/C,OAAO,MAAM,6BAA6B,UAAU,aAAa;EAChE,YAAa,GAAG,MAAO;GACtB,MAAO,GAAG,IAAK;GAIf,KAAK,OAAO,OAAO;GAEnB,KAAK,8BAA8B;GAGlC,KAAK,iBAAkB,EAAG,CAAC,cAAc,YAG9B,iBACX,WACA,qBAAuB,UAAW;IACjC,IACC,KAAK,SAAS,MACZ,MAAM,YAAY,UACnB,MAAM,SAAS,aAChB,CAAE,MAAM,kBACP;KACD,MAAM,eAAe;KACrB,MAAM,gBAAgB;KACtB,SAAUA,KAAsB,CAAC,CAAC,oBACjC,KACD;IACD;GACD,CAAE,GAEF,IACD;GAEA,KAAK,iBAAiB,SAAU,kBAAmB;GAInD,KAAK,uBAAuB;GAC5B,KAAK,SAAS,WAAY;IACzB,IAAK,CAAE,KAAK,sBAEX,SAAUA,KAAsB,CAAC,CAAC,oBACjC,KAAK,SAAS,CACf;IAED,KAAK,uBAAuB;GAC7B,CAAE;EACH;EACA,OAAO;GACN,IAAK,CAAE,KAAK,SAAS,GAAI;IACxB,MAAM,mBAAmB,KAAK,iBAAkB;IAChD,KAAK,8BACJ,iBAAiB,cAAc;IAEhC,KAAK,uBAAuB;IAE5B,KAAK,OAAQ,EACZ,mBAAmB;KAIlB,MAAM,YACL,MAAM,SAAS,KAAM,gBAAiB,CAAC,CAAE;KAC1C,IAAK,WACJ,UAAU,MAAM;IAElB,EACD,CAAE;GACH;EACD;EACA,QAAQ;GACP,IAAK,KAAK,SAAS,GAAI;IACtB,MAAM,mBAAmB,KAAK,iBAAkB;IAChD,MAAM,gBACL,iBAAiB,cAAc;IAEhC,KAAK,uBAAuB;IAE5B,KAAK,SAAU,EACd,mBAAmB;KAMlB,IAAK,iBAAiB,SAAU,aAAc,GAExC;UAAA,KAAK,6BACT,KAAK,4BAA4B,MAAM;KAAA;IAG1C,EACD,CAAE;GACH;EACD;CACD;AACD"}
|
package/build-module/index.mjs
CHANGED
|
@@ -18,7 +18,6 @@ const DISABLED_BLOCKS = [
|
|
|
18
18
|
"core/freeform",
|
|
19
19
|
"core/template-part"
|
|
20
20
|
];
|
|
21
|
-
const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
|
|
22
21
|
/**
|
|
23
22
|
* Initializes the widgets block editor in the customizer.
|
|
24
23
|
*
|
|
@@ -36,7 +35,7 @@ function initialize(editorName, blockEditorSettings) {
|
|
|
36
35
|
});
|
|
37
36
|
registerCoreBlocks(coreBlocks);
|
|
38
37
|
registerLegacyWidgetBlock();
|
|
39
|
-
if (globalThis.IS_GUTENBERG_PLUGIN) __experimentalRegisterExperimentalCoreBlocks(
|
|
38
|
+
if (globalThis.IS_GUTENBERG_PLUGIN) __experimentalRegisterExperimentalCoreBlocks();
|
|
40
39
|
registerLegacyWidgetVariations(blockEditorSettings);
|
|
41
40
|
registerWidgetGroupBlock();
|
|
42
41
|
setFreeformContentHandlerName("core/html");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["preferencesStore","blocksStore"],"sources":["../src/index.jsx"],"sourcesContent":["import { createRoot, StrictMode } 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';\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];\
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["preferencesStore","blocksStore"],"sources":["../src/index.jsx"],"sourcesContent":["import { createRoot, StrictMode } 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';\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];\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\tblock.name.startsWith( 'core/term' )\n\t\t);\n\t} );\n\tregisterCoreBlocks( coreBlocks );\n\tregisterLegacyWidgetBlock();\n\tif ( globalThis.IS_GUTENBERG_PLUGIN ) {\n\t\t__experimentalRegisterExperimentalCoreBlocks();\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<StrictMode>\n\t\t\t\t<CustomizeWidgets\n\t\t\t\t\tapi={ wp.customize }\n\t\t\t\t\tsidebarControls={ sidebarControls }\n\t\t\t\t\tblockEditorSettings={ blockEditorSettings }\n\t\t\t\t/>\n\t\t\t</StrictMode>\n\t\t);\n\t} );\n}\nexport { store } from './store';\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,EAAE,OAAO;AAEf,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;AACD;;;;;;;AAQA,SAAgB,WAAY,YAAY,qBAAsB;CAC7D,SAAUA,OAAiB,CAAC,CAAC,YAAa,0BAA0B;EACnE,cAAc;EACd,cAAc;CACf,CAAE;CAEF,SAAUC,OAAY,CAAC,CAAC,wBAAwB;CAChD,MAAM,aAAa,4BAA4B,CAAC,CAAC,QAAU,UAAW;EACrE,OAAO,EACN,gBAAgB,SAAU,MAAM,IAAK,KACrC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,YAAa,KACpC,MAAM,KAAK,WAAY,WAAY,KACnC,MAAM,KAAK,WAAY,iBAAkB,KACzC,MAAM,KAAK,WAAY,WAAY;CAErC,CAAE;CACF,mBAAoB,UAAW;CAC/B,0BAA0B;CAC1B,IAAK,WAAW,qBACf,6CAA6C;CAE9C,+BAAgC,mBAAoB;CACpD,yBAAyB;CAMzB,8BAA+B,WAAY;CAE3C,MAAM,iBAAiB,kBAAmB,mBAAoB;CAE9D,GAAG,UAAU,mBAAmB,UAAU,kBAAkB;CAC5D,GAAG,UAAU,mBAAmB,uBAAuB;CAEvD,MAAM,YAAY,SAAS,cAAe,KAAM;CAChD,SAAS,KAAK,YAAa,SAAU;CAErC,GAAG,UAAU,KAAM,eAAe;EACjC,MAAM,kBAAkB,CAAC;EACzB,GAAG,UAAU,QAAQ,MAAQ,YAAa;GACzC,IAAK,mBAAmB,gBACvB,gBAAgB,KAAM,OAAQ;EAEhC,CAAE;EAEF,WAAY,SAAU,CAAC,CAAC,OACvB,oBAAC,YAAD,EAAA,UACC,oBAAC,kBAAD;GACC,KAAM,GAAG;GACS;GACI;EACtB,CAAA,EACU,CAAA,CACb;CACD,CAAE;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../src/utils.js"],"sourcesContent":["import { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"],"mappings":";;;;;;;;;AASA,SAAgB,oBAAqB,WAAY;CAChD,MAAM,UAAU,UAAU,MAAO,4BAA6B;CAE9D,IAAK,SAIJ,OAAO,GAHQ,QAAS,GAGL,GAFJ,SAAU,QAAS,IAAK,EAEX;CAG7B,OAAO;AACR;;;;;;;;AASA,SAAgB,cAAe,OAAO,iBAAiB,MAAO;CAC7D,IAAI;CAMJ,IAHC,MAAM,SAAS,yBACb,MAAM,WAAW,MAAM,MAAM,WAAW,WAEX;EAC/B,IAAK,MAAM,WAAW,IAErB,SAAS,EACR,IAAI,MAAM,WAAW,GACtB;OACM;GACN,MAAM,EAAE,SAAS,MAAM,KAAK,GAAG,SAAS,MAAM,WAAW;GAGzD,SAAS;IACR,QAAQ,MAAM,WAAW;IACzB,UAAU;KACT,GAAG,gBAAgB;KAEnB,+BAA+B;KAC/B,6BAA6B;KAC7B,mBAAmB;KACnB,cAAc;KACd,GAAG;IACJ;GACD;EACD;CACD,OAIC,SAAS;EACR,QAAQ;EACR,aAAa;EACb,UAAU,EACT,cAAc,EANf,SAAS,UAAW,KAAM,EAMJ,EACtB;CACD;CAGD,MAAM,EAAE,MAAM,UAAU,GAAG,uBAAuB,kBAAkB,CAAC;CAErE,OAAO;EACN,GAAG;EACH,GAAG;CACJ;AACD;;;;;;;;;;;AAYA,SAAgB,cAAe,EAAE,IAAI,QAAQ,QAAQ,YAAa;CACjE,IAAI;CAEJ,MAAM,EACL,6BAA6B,SAC7B,mBAAmB,MACnB,cAAc,KACd,GAAG,SACA;CAEJ,IAAK,WAAW,SAAU;EACzB,MAAM,eAAe,MAAO,IAAI,WAAW,IAAI,EAC9C,qBAAqB,KACtB,CAAE;EACF,QAAQ,aAAa,SAClB,aAAc,KACd,YAAa,kBAAkB,CAAC,CAAE;CACtC,OAAO,IAAK,QAEX,QAAQ,YAAa,sBAAsB;EAC1C;EACA,UAAU;GACT;GACA;GACA;GACA,GAAG;EACJ;CACD,CAAE;MAGF,QAAQ,YAAa,sBAAsB,EAC1C,GACD,CAAE;CAGH,OAAO,mBAAoB,OAAO,EAAG;AACtC"}
|
|
@@ -113,12 +113,12 @@
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
body.admin-color-fresh {
|
|
116
|
-
--wp-admin-theme-color: #
|
|
117
|
-
--wp-admin-theme-color--rgb: 0,
|
|
118
|
-
--wp-admin-theme-color-darker-10: rgb(0,
|
|
119
|
-
--wp-admin-theme-color-darker-10--rgb: 0,
|
|
120
|
-
--wp-admin-theme-color-darker-20:
|
|
121
|
-
--wp-admin-theme-color-darker-20--rgb: 0,
|
|
116
|
+
--wp-admin-theme-color: #006daa;
|
|
117
|
+
--wp-admin-theme-color--rgb: 0, 109, 170;
|
|
118
|
+
--wp-admin-theme-color-darker-10: rgb(0, 92.65, 144.5);
|
|
119
|
+
--wp-admin-theme-color-darker-10--rgb: 0, 92.65, 144.5;
|
|
120
|
+
--wp-admin-theme-color-darker-20: rgb(0, 76.3, 119);
|
|
121
|
+
--wp-admin-theme-color-darker-20--rgb: 0, 76.3, 119;
|
|
122
122
|
--wp-admin-border-width-focus: 2px;
|
|
123
123
|
}
|
|
124
124
|
@media (min-resolution: 192dpi) {
|
|
@@ -172,43 +172,51 @@ body.admin-color-fresh {
|
|
|
172
172
|
}
|
|
173
173
|
.customize-widgets-header {
|
|
174
174
|
display: flex;
|
|
175
|
-
|
|
175
|
+
align-items: center;
|
|
176
|
+
gap: 8px;
|
|
177
|
+
padding-inline-end: 12px;
|
|
176
178
|
margin: -15px -12px 0 -12px;
|
|
177
|
-
background: #
|
|
178
|
-
border-bottom: 1px solid #
|
|
179
|
+
background: var(--wpds-color-background-surface-neutral, #fcfcfc);
|
|
180
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
179
181
|
z-index: 8;
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
.customize-widgets-header-toolbar {
|
|
183
185
|
display: flex;
|
|
186
|
+
flex: 1;
|
|
184
187
|
border: none;
|
|
185
|
-
width: 100%;
|
|
186
188
|
align-items: center;
|
|
187
189
|
gap: 8px;
|
|
188
|
-
padding:
|
|
190
|
+
padding-inline-start: 12px;
|
|
189
191
|
}
|
|
190
|
-
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon
|
|
191
|
-
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon {
|
|
192
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon {
|
|
192
193
|
height: 32px;
|
|
193
194
|
min-width: 32px;
|
|
194
195
|
padding: 4px;
|
|
195
196
|
}
|
|
196
|
-
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed {
|
|
198
|
+
background: var(--wpds-color-background-interactive-neutral-strong-active, #2e2e2e);
|
|
199
|
+
}
|
|
200
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]) {
|
|
201
|
+
background: var(--wpds-color-background-interactive-neutral-strong-disabled, #e5e5e5);
|
|
199
202
|
}
|
|
200
|
-
|
|
201
|
-
.customize-widgets-header-toolbar > .components-
|
|
203
|
+
@media (forced-colors: active) {
|
|
204
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed {
|
|
205
|
+
background: Highlight !important;
|
|
206
|
+
}
|
|
207
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:disabled, .customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed[aria-disabled=true] {
|
|
208
|
+
background: GrayText !important;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:active) {
|
|
202
212
|
outline: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)) solid var(--focus-color, var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9)));
|
|
203
213
|
outline-offset: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px));
|
|
204
214
|
}
|
|
205
|
-
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon::before
|
|
206
|
-
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon::before {
|
|
215
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon::before {
|
|
207
216
|
display: none;
|
|
208
217
|
}
|
|
209
218
|
.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon {
|
|
210
219
|
border-radius: 2px;
|
|
211
|
-
color: #fff;
|
|
212
220
|
margin: 12px auto 12px 0;
|
|
213
221
|
}
|
|
214
222
|
@media not (prefers-reduced-motion) {
|
|
@@ -233,7 +241,12 @@ body.admin-color-fresh {
|
|
|
233
241
|
}
|
|
234
242
|
|
|
235
243
|
.customize-widgets-layout__inserter-panel {
|
|
236
|
-
background: #fff;
|
|
244
|
+
background: var(--wpds-color-background-surface-neutral-strong, #fff);
|
|
245
|
+
color: var(--wpds-color-foreground-content-neutral, #1e1e1e);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.customize-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab .block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
249
|
+
display: none;
|
|
237
250
|
}
|
|
238
251
|
|
|
239
252
|
.customize-widgets-layout__inserter-panel-header {
|
|
@@ -243,14 +256,15 @@ body.admin-color-fresh {
|
|
|
243
256
|
padding: 16px;
|
|
244
257
|
height: 46px;
|
|
245
258
|
box-sizing: border-box;
|
|
246
|
-
border-bottom: 1px solid #
|
|
259
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
247
260
|
}
|
|
248
261
|
.customize-widgets-layout__inserter-panel-header .customize-widgets-layout__inserter-panel-header-title {
|
|
249
262
|
margin: 0;
|
|
263
|
+
color: inherit;
|
|
250
264
|
}
|
|
251
265
|
|
|
252
266
|
.block-editor-inserter__quick-inserter .block-editor-inserter__panel-content {
|
|
253
|
-
background: #fff;
|
|
267
|
+
background: var(--wpds-color-background-surface-neutral-strong, #fff);
|
|
254
268
|
}
|
|
255
269
|
|
|
256
270
|
.customize-widgets-keyboard-shortcut-help-modal__section {
|
|
@@ -297,13 +311,18 @@ body.admin-color-fresh {
|
|
|
297
311
|
margin: 0 0.2rem 0 0.2rem;
|
|
298
312
|
}
|
|
299
313
|
.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child {
|
|
300
|
-
margin: 0
|
|
314
|
+
margin-inline-end: 0;
|
|
301
315
|
}
|
|
302
316
|
|
|
303
317
|
.components-popover.more-menu-dropdown__content {
|
|
304
318
|
z-index: 99998;
|
|
305
319
|
}
|
|
306
320
|
|
|
321
|
+
.customize-widgets-header + .block-editor-block-contextual-toolbar {
|
|
322
|
+
margin-inline: -12px;
|
|
323
|
+
width: auto;
|
|
324
|
+
}
|
|
325
|
+
|
|
307
326
|
.customize-control-sidebar_block_editor .block-editor-block-list__block-popover {
|
|
308
327
|
position: fixed !important;
|
|
309
328
|
z-index: 7;
|
package/build-style/style.css
CHANGED
|
@@ -113,12 +113,12 @@
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
body.admin-color-fresh {
|
|
116
|
-
--wp-admin-theme-color: #
|
|
117
|
-
--wp-admin-theme-color--rgb: 0,
|
|
118
|
-
--wp-admin-theme-color-darker-10: rgb(0,
|
|
119
|
-
--wp-admin-theme-color-darker-10--rgb: 0,
|
|
120
|
-
--wp-admin-theme-color-darker-20:
|
|
121
|
-
--wp-admin-theme-color-darker-20--rgb: 0,
|
|
116
|
+
--wp-admin-theme-color: #006daa;
|
|
117
|
+
--wp-admin-theme-color--rgb: 0, 109, 170;
|
|
118
|
+
--wp-admin-theme-color-darker-10: rgb(0, 92.65, 144.5);
|
|
119
|
+
--wp-admin-theme-color-darker-10--rgb: 0, 92.65, 144.5;
|
|
120
|
+
--wp-admin-theme-color-darker-20: rgb(0, 76.3, 119);
|
|
121
|
+
--wp-admin-theme-color-darker-20--rgb: 0, 76.3, 119;
|
|
122
122
|
--wp-admin-border-width-focus: 2px;
|
|
123
123
|
}
|
|
124
124
|
@media (min-resolution: 192dpi) {
|
|
@@ -172,43 +172,51 @@ body.admin-color-fresh {
|
|
|
172
172
|
}
|
|
173
173
|
.customize-widgets-header {
|
|
174
174
|
display: flex;
|
|
175
|
-
|
|
175
|
+
align-items: center;
|
|
176
|
+
gap: 8px;
|
|
177
|
+
padding-inline-end: 12px;
|
|
176
178
|
margin: -15px -12px 0 -12px;
|
|
177
|
-
background: #
|
|
178
|
-
border-bottom: 1px solid #
|
|
179
|
+
background: var(--wpds-color-background-surface-neutral, #fcfcfc);
|
|
180
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
179
181
|
z-index: 8;
|
|
180
182
|
}
|
|
181
183
|
|
|
182
184
|
.customize-widgets-header-toolbar {
|
|
183
185
|
display: flex;
|
|
186
|
+
flex: 1;
|
|
184
187
|
border: none;
|
|
185
|
-
width: 100%;
|
|
186
188
|
align-items: center;
|
|
187
189
|
gap: 8px;
|
|
188
|
-
padding:
|
|
190
|
+
padding-inline-start: 12px;
|
|
189
191
|
}
|
|
190
|
-
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon
|
|
191
|
-
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon {
|
|
192
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon {
|
|
192
193
|
height: 32px;
|
|
193
194
|
min-width: 32px;
|
|
194
195
|
padding: 4px;
|
|
195
196
|
}
|
|
196
|
-
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed {
|
|
198
|
+
background: var(--wpds-color-background-interactive-neutral-strong-active, #2e2e2e);
|
|
199
|
+
}
|
|
200
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:is(:disabled, [aria-disabled=true]) {
|
|
201
|
+
background: var(--wpds-color-background-interactive-neutral-strong-disabled, #e5e5e5);
|
|
199
202
|
}
|
|
200
|
-
|
|
201
|
-
.customize-widgets-header-toolbar > .components-
|
|
203
|
+
@media (forced-colors: active) {
|
|
204
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed {
|
|
205
|
+
background: Highlight !important;
|
|
206
|
+
}
|
|
207
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed:disabled, .customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon.is-pressed[aria-disabled=true] {
|
|
208
|
+
background: GrayText !important;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon:focus:not(:active) {
|
|
202
212
|
outline: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px)) solid var(--focus-color, var(--wpds-color-stroke-focus, var(--wp-admin-theme-color, #3858e9)));
|
|
203
213
|
outline-offset: var(--wpds-border-width-focus, var(--wp-admin-border-width-focus, 2px));
|
|
204
214
|
}
|
|
205
|
-
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon::before
|
|
206
|
-
.customize-widgets-header-toolbar > .components-dropdown > .components-button.has-icon.has-icon::before {
|
|
215
|
+
.customize-widgets-header-toolbar > .components-button.has-icon.has-icon.has-icon::before {
|
|
207
216
|
display: none;
|
|
208
217
|
}
|
|
209
218
|
.customize-widgets-header-toolbar .customize-widgets-header-toolbar__inserter-toggle.components-button.has-icon {
|
|
210
219
|
border-radius: 2px;
|
|
211
|
-
color: #fff;
|
|
212
220
|
margin: 12px 0 12px auto;
|
|
213
221
|
}
|
|
214
222
|
@media not (prefers-reduced-motion) {
|
|
@@ -233,7 +241,12 @@ body.admin-color-fresh {
|
|
|
233
241
|
}
|
|
234
242
|
|
|
235
243
|
.customize-widgets-layout__inserter-panel {
|
|
236
|
-
background: #fff;
|
|
244
|
+
background: var(--wpds-color-background-surface-neutral-strong, #fff);
|
|
245
|
+
color: var(--wpds-color-foreground-content-neutral, #1e1e1e);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
.customize-widgets-layout__inserter-panel-content .block-editor-inserter__menu.has-single-tab .block-editor-tabbed-sidebar__tablist-and-close-button {
|
|
249
|
+
display: none;
|
|
237
250
|
}
|
|
238
251
|
|
|
239
252
|
.customize-widgets-layout__inserter-panel-header {
|
|
@@ -243,14 +256,15 @@ body.admin-color-fresh {
|
|
|
243
256
|
padding: 16px;
|
|
244
257
|
height: 46px;
|
|
245
258
|
box-sizing: border-box;
|
|
246
|
-
border-bottom: 1px solid #
|
|
259
|
+
border-bottom: 1px solid var(--wpds-color-stroke-surface-neutral, #dbdbdb);
|
|
247
260
|
}
|
|
248
261
|
.customize-widgets-layout__inserter-panel-header .customize-widgets-layout__inserter-panel-header-title {
|
|
249
262
|
margin: 0;
|
|
263
|
+
color: inherit;
|
|
250
264
|
}
|
|
251
265
|
|
|
252
266
|
.block-editor-inserter__quick-inserter .block-editor-inserter__panel-content {
|
|
253
|
-
background: #fff;
|
|
267
|
+
background: var(--wpds-color-background-surface-neutral-strong, #fff);
|
|
254
268
|
}
|
|
255
269
|
|
|
256
270
|
.customize-widgets-keyboard-shortcut-help-modal__section {
|
|
@@ -297,13 +311,18 @@ body.admin-color-fresh {
|
|
|
297
311
|
margin: 0 0.2rem 0 0.2rem;
|
|
298
312
|
}
|
|
299
313
|
.customize-widgets-keyboard-shortcut-help-modal__shortcut-key:last-child {
|
|
300
|
-
margin: 0
|
|
314
|
+
margin-inline-end: 0;
|
|
301
315
|
}
|
|
302
316
|
|
|
303
317
|
.components-popover.more-menu-dropdown__content {
|
|
304
318
|
z-index: 99998;
|
|
305
319
|
}
|
|
306
320
|
|
|
321
|
+
.customize-widgets-header + .block-editor-block-contextual-toolbar {
|
|
322
|
+
margin-inline: -12px;
|
|
323
|
+
width: auto;
|
|
324
|
+
}
|
|
325
|
+
|
|
307
326
|
.customize-control-sidebar_block_editor .block-editor-block-list__block-popover {
|
|
308
327
|
position: fixed !important;
|
|
309
328
|
z-index: 7;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/block-appender/index.jsx"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,UAAU,aAAa,CAAE,KAAK,KAAA,+BAsB3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/block-inspector-button/index.jsx"],"names":[],"mappings":"AAMA,iBAAS,oBAAoB,CAAE,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE;;;;CAAA,+BA0BhE;eAEc,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/customize-widgets/index.jsx"],"names":[],"mappings":"AAiBA,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAE,EACzC,GAAG,EACH,eAAe,EACf,mBAAmB,GACnB;;;;CAAA,+BAsEA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* We can't just use <BlockSelectionClearer> because the customizer has
|
|
3
|
+
* many root nodes rather than just one in the post editor.
|
|
4
|
+
* We need to listen to the focus events in all those roots, and also in
|
|
5
|
+
* the preview iframe.
|
|
6
|
+
* This hook will clear the selected block when focusing outside the editor,
|
|
7
|
+
* with a few exceptions:
|
|
8
|
+
* 1. Focusing on popovers, including `@wordpress/ui` overlays.
|
|
9
|
+
* 2. Focusing on the inspector.
|
|
10
|
+
* 3. Focusing on any modals/dialogs.
|
|
11
|
+
* These cases are normally triggered by user interactions from the editor,
|
|
12
|
+
* not by explicitly focusing outside the editor, hence no need for clearing.
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} sidebarControl The sidebar control instance.
|
|
15
|
+
* @param {Object} popoverRef The ref object of the popover node container.
|
|
16
|
+
*/
|
|
17
|
+
export default function useClearSelectedBlock(sidebarControl: Object, popoverRef: Object): void;
|
|
18
|
+
//# sourceMappingURL=use-clear-selected-block.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-clear-selected-block.d.ts","sourceRoot":"","sources":["../../../src/components/customize-widgets/use-clear-selected-block.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAE,cAAc,EAHlD,MAGkD,EAAE,UAAU,EAF9D,MAE8D,QA0DxE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component } from '@wordpress/element';
|
|
2
|
+
export default class ErrorBoundary extends Component {
|
|
3
|
+
state: {
|
|
4
|
+
error: null;
|
|
5
|
+
componentStack: null;
|
|
6
|
+
};
|
|
7
|
+
constructor();
|
|
8
|
+
componentDidCatch(error: any, errorInfo: any): void;
|
|
9
|
+
static getDerivedStateFromError(error: any): {
|
|
10
|
+
error: any;
|
|
11
|
+
};
|
|
12
|
+
render(): any;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/error-boundary/index.jsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA6H/C,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,SAAS;IAI7C,KAAK;;;;IAHX,cAOC;IAED,iBAAiB,CAAE,KAAK,KAAA,EAAE,SAAS,KAAA,QAKlC;IAED,MAAM,CAAC,wBAAwB,CAAE,KAAK,KAAA;;MAErC;IAED,MAAM,QAoCL;CACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/focus-control/index.jsx"],"names":[],"mappings":"AAaA,MAAM,CAAC,OAAO,UAAU,YAAY,CAAE,EAAE,GAAG,EAAE,eAAe,EAAE,QAAQ,EAAE;;;;CAAA,+BAoEvE;AAED,eAAO,MAAM,eAAe,WAA0C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-blocks-focus-control.d.ts","sourceRoot":"","sources":["../../../src/components/focus-control/use-blocks-focus-control.js"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAE,MAAM,KAAA,QA6BpD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function Header({ sidebar, inserter, isInserterOpened, setIsInserterOpened, isFixedToolbarActive, }: {
|
|
2
|
+
inserter: any;
|
|
3
|
+
isFixedToolbarActive: any;
|
|
4
|
+
isInserterOpened: any;
|
|
5
|
+
setIsInserterOpened: any;
|
|
6
|
+
sidebar: any;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
export default Header;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/header/index.jsx"],"names":[],"mappings":"AAUA,iBAAS,MAAM,CAAE,EAChB,OAAO,EACP,QAAQ,EACR,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,GACpB;;;;;;CAAA,+BAiFA;eAEc,MAAM"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/inserter/index.jsx"],"names":[],"mappings":"AAQA,iBAAS,QAAQ,CAAE,EAAE,WAAW,EAAE;;CAAA,+BA0CjC;eAEc,QAAQ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-inserter.d.ts","sourceRoot":"","sources":["../../../src/components/inserter/use-inserter.js"],"names":[],"mappings":"AAIA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAE,QAAQ,KAAA,SA+B5C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/components/keyboard-shortcut-help-modal/config.js"],"names":[],"mappings":"AAEA,yFAAyF;AACzF,eAAO,MAAM,uBAAuB,EADzB,KAAK,CAAC,OAAO,OAAO,EAAE,cAAc,CAAC,cAAc,YAAY,EAAE,OAAO,CAAC,CA2DnF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-shortcut.d.ts","sourceRoot":"","sources":["../../../src/components/keyboard-shortcut-help-modal/dynamic-shortcut.jsx"],"names":[],"mappings":"AAIA,iBAAS,eAAe,CAAE,EAAE,IAAI,EAAE;;CAAA,sCA6BjC;eAEc,eAAe"}
|