@wordpress/customize-widgets 5.8.7 → 5.10.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/block-inspector-button/index.js.map +1 -1
  3. package/build/components/customize-widgets/index.js +2 -2
  4. package/build/components/customize-widgets/index.js.map +1 -1
  5. package/build/components/error-boundary/index.js +2 -4
  6. package/build/components/error-boundary/index.js.map +1 -1
  7. package/build/components/focus-control/use-blocks-focus-control.js.map +1 -1
  8. package/build/components/header/index.js +1 -1
  9. package/build/components/header/index.js.map +1 -1
  10. package/build/components/inserter/index.js +2 -5
  11. package/build/components/inserter/index.js.map +1 -1
  12. package/build/components/sidebar-block-editor/sidebar-adapter.js +1 -0
  13. package/build/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
  14. package/build/components/welcome-guide/index.js +2 -5
  15. package/build/components/welcome-guide/index.js.map +1 -1
  16. package/build/controls/sidebar-control.js +1 -0
  17. package/build/controls/sidebar-control.js.map +1 -1
  18. package/build/controls/sidebar-section.js.map +1 -1
  19. package/build/index.js +7 -1
  20. package/build/index.js.map +1 -1
  21. package/build/utils.js.map +1 -1
  22. package/build-module/components/block-inspector-button/index.js.map +1 -1
  23. package/build-module/components/customize-widgets/index.js +3 -4
  24. package/build-module/components/customize-widgets/index.js.map +1 -1
  25. package/build-module/components/error-boundary/index.js +2 -4
  26. package/build-module/components/error-boundary/index.js.map +1 -1
  27. package/build-module/components/focus-control/use-blocks-focus-control.js.map +1 -1
  28. package/build-module/components/header/index.js +2 -4
  29. package/build-module/components/header/index.js.map +1 -1
  30. package/build-module/components/inserter/index.js +3 -7
  31. package/build-module/components/inserter/index.js.map +1 -1
  32. package/build-module/components/keyboard-shortcut-help-modal/index.js +1 -2
  33. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -1
  34. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +1 -3
  35. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -1
  36. package/build-module/components/more-menu/index.js +1 -3
  37. package/build-module/components/more-menu/index.js.map +1 -1
  38. package/build-module/components/sidebar-block-editor/index.js +1 -3
  39. package/build-module/components/sidebar-block-editor/index.js.map +1 -1
  40. package/build-module/components/sidebar-block-editor/sidebar-adapter.js +1 -0
  41. package/build-module/components/sidebar-block-editor/sidebar-adapter.js.map +1 -1
  42. package/build-module/components/welcome-guide/index.js +3 -7
  43. package/build-module/components/welcome-guide/index.js.map +1 -1
  44. package/build-module/controls/sidebar-control.js +1 -0
  45. package/build-module/controls/sidebar-control.js.map +1 -1
  46. package/build-module/controls/sidebar-section.js.map +1 -1
  47. package/build-module/filters/move-to-sidebar.js +1 -3
  48. package/build-module/filters/move-to-sidebar.js.map +1 -1
  49. package/build-module/index.js +7 -1
  50. package/build-module/index.js.map +1 -1
  51. package/build-module/utils.js.map +1 -1
  52. package/build-style/style-rtl.css +10 -1
  53. package/build-style/style.css +10 -1
  54. package/package.json +24 -23
  55. package/src/components/error-boundary/index.js +1 -6
  56. package/src/components/inserter/index.js +1 -3
  57. package/src/components/welcome-guide/index.js +1 -3
  58. package/src/index.js +5 -0
@@ -1 +1 @@
1
- {"version":3,"names":["dispatch","SidebarAdapter","getInserterOuterSection","store","customizeWidgetsStore","getInserterId","controlId","getSidebarControl","wp","customize","window","SidebarControl","Control","constructor","args","subscribers","Set","ready","InserterOuterSection","inserter","id","section","add","sectionInstance","inspector","sidebarAdapter","setting","subscribe","callback","delete","onChangeSectionExpanded","expanded","unchanged","setIsInserterOpened","forEach","subscriber"],"sources":["@wordpress/customize-widgets/src/controls/sidebar-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';\nimport getInserterOuterSection from './inserter-outer-section';\nimport { store as customizeWidgetsStore } from '../store';\n\nconst getInserterId = ( controlId ) => `widgets-inserter-${ controlId }`;\n\nexport default function getSidebarControl() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarControl extends customize.Control {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\tthis.subscribers = new Set();\n\t\t}\n\n\t\tready() {\n\t\t\tconst InserterOuterSection = getInserterOuterSection();\n\t\t\tthis.inserter = new InserterOuterSection(\n\t\t\t\tgetInserterId( this.id ),\n\t\t\t\t{}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inserter );\n\n\t\t\tthis.sectionInstance = customize.section( this.section() );\n\n\t\t\tthis.inspector = this.sectionInstance.inspector;\n\n\t\t\tthis.sidebarAdapter = new SidebarAdapter( this.setting, customize );\n\t\t}\n\n\t\tsubscribe( callback ) {\n\t\t\tthis.subscribers.add( callback );\n\n\t\t\treturn () => {\n\t\t\t\tthis.subscribers.delete( callback );\n\t\t\t};\n\t\t}\n\n\t\tonChangeSectionExpanded( expanded, args ) {\n\t\t\tif ( ! args.unchanged ) {\n\t\t\t\t// Close the inserter when the section collapses.\n\t\t\t\tif ( ! expanded ) {\n\t\t\t\t\tdispatch( customizeWidgetsStore ).setIsInserterOpened(\n\t\t\t\t\t\tfalse\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\tthis.subscribers.forEach( ( subscriber ) =>\n\t\t\t\t\tsubscriber( expanded, args )\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,iBAAiB;;AAE1C;AACA;AACA;AACA,OAAOC,cAAc,MAAM,oDAAoD;AAC/E,OAAOC,uBAAuB,MAAM,0BAA0B;AAC9D,SAASC,KAAK,IAAIC,qBAAqB,QAAQ,UAAU;AAEzD,MAAMC,aAAa,GAAKC,SAAS,IAAO,oBAAoBA,SAAW,EAAC;AAExE,eAAe,SAASC,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IACLC,EAAE,EAAE;MA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AC;MACF;IACD;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["dispatch","SidebarAdapter","getInserterOuterSection","store","customizeWidgetsStore","getInserterId","controlId","getSidebarControl","wp","customize","window","SidebarControl","Control","constructor","args","subscribers","Set","ready","InserterOuterSection","inserter","id","section","add","sectionInstance","inspector","sidebarAdapter","setting","subscribe","callback","delete","onChangeSectionExpanded","expanded","unchanged","setIsInserterOpened","forEach","subscriber"],"sources":["@wordpress/customize-widgets/src/controls/sidebar-control.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport SidebarAdapter from '../components/sidebar-block-editor/sidebar-adapter';\nimport getInserterOuterSection from './inserter-outer-section';\nimport { store as customizeWidgetsStore } from '../store';\n\nconst getInserterId = ( controlId ) => `widgets-inserter-${ controlId }`;\n\nexport default function getSidebarControl() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\treturn class SidebarControl extends customize.Control {\n\t\tconstructor( ...args ) {\n\t\t\tsuper( ...args );\n\n\t\t\tthis.subscribers = new Set();\n\t\t}\n\n\t\tready() {\n\t\t\tconst InserterOuterSection = getInserterOuterSection();\n\t\t\tthis.inserter = new InserterOuterSection(\n\t\t\t\tgetInserterId( this.id ),\n\t\t\t\t{}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inserter );\n\n\t\t\tthis.sectionInstance = customize.section( this.section() );\n\n\t\t\tthis.inspector = this.sectionInstance.inspector;\n\n\t\t\tthis.sidebarAdapter = new SidebarAdapter( this.setting, customize );\n\t\t}\n\n\t\tsubscribe( callback ) {\n\t\t\tthis.subscribers.add( callback );\n\n\t\t\treturn () => {\n\t\t\t\tthis.subscribers.delete( callback );\n\t\t\t};\n\t\t}\n\n\t\tonChangeSectionExpanded( expanded, args ) {\n\t\t\tif ( ! args.unchanged ) {\n\t\t\t\t// Close the inserter when the section collapses.\n\t\t\t\tif ( ! expanded ) {\n\t\t\t\t\tdispatch( custom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AAEjB,SAAU,CAAC;IACpE;IAEAkB,SAASA,CAAEC,QAAQ,EAAG;MACrB,IAAI,CAACb,WAAW,CAACO,GAAG,CAAEM,QAAS,CAAC;MAEhC,OAAO,MAAM;QACZ,IAAI,CAACb,WAAW,CAACc,MAAM,CAAED,QAAS,CAAC;MACpC,CAAC;IACF;IAEAE,uBAAuBA,CAAEC,QAAQ,EAAEjB,IAAI,EAAG;MACzC,IAAK,CAAEA,IAAI,CAACkB,SAAS,EAAG;QACvB;QACA,IAAK,CAAED,QAAQ,EAAG;UACjB/B,QAAQ,CAAEI,qBAAsB,CAAC,CAAC6B,mBAAmB,CACpD,KACD,CAAC;QACF;QAEA,IAAI,CAAClB,WAAW,CAACmB,OAAO,CAAIC,UAAU,IACrCA,UAAU,CAAEJ,QAAQ,EAAEjB,IAAK,CAC5B,CAAC;MACF;IACD;EACD,CAAC;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["__","getInspectorSection","getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","reduceMotionMediaQuery","matchMedia","isReducedMotion","matches","addEventListener","event","SidebarSection","Section","ready","InspectorSection","inspector","id","title","parentSection","customizeAction","params","join","section","add","contentContainer","classList","hasSubSectionOpened","expanded","onChangeExpanded","_args","controls","args","completeCallback","forEach","control","onChangeSectionExpanded","manualTransition","addClass","removeClass","closest","handleTransitionEnd","one"],"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport getInspectorSection from './inspector-section';\n\nconst getInspectorSectionId = ( sidebarId ) =>\n\t`widgets-inspector-${ sidebarId }`;\n\nexport default function getSidebarSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst reduceMotionMediaQuery = window.matchMedia(\n\t\t'(prefers-reduced-motion: reduce)'\n\t);\n\tlet isReducedMotion = reduceMotionMediaQuery.matches;\n\treduceMotionMediaQuery.addEventListener( 'change', ( event ) => {\n\t\tisReducedMotion = event.matches;\n\t} );\n\n\treturn class SidebarSection extends customize.Section {\n\t\tready() {\n\t\t\tconst InspectorSection = getInspectorSection();\n\t\t\tthis.inspector = new InspectorSection(\n\t\t\t\tgetInspectorSectionId( this.id ),\n\t\t\t\t{\n\t\t\t\t\ttitle: __( 'Block Settings' ),\n\t\t\t\t\tparentSection: this,\n\t\t\t\t\tcustomizeAction: [\n\t\t\t\t\t\t__( 'Customizing' ),\n\t\t\t\t\t\t__( 'Widgets' ),\n\t\t\t\t\t\tthis.params.title,\n\t\t\t\t\t].join( ' ▸ ' ),\n\t\t\t\t}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inspector );\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets__sidebar-section'\n\t\t\t);\n\t\t}\n\t\thasSubSectionOpened() {\n\t\t\treturn this.inspector.expanded();\n\t\t}\n\t\tonChangeExpanded( expanded, _args ) {\n\t\t\tconst controls = this.controls();\n\t\t\tconst args = {\n\t\t\t\t..._args,\n\t\t\t\tcompleteCallback() {\n\t\t\t\t\tcontrols.forEach( ( control ) => {\n\t\t\t\t\t\tcontrol.onChangeSectionExpanded?.( expanded, args );\n\t\t\t\t\t} );\n\t\t\t\t\t_args.completeCallback?.();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif ( args.manualTransition ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.contentContainer.addClass( [ 'busy', 'open' ] );\n\t\t\t\t\tthis.contentContainer.removeClass( 'is-sub-section-open' );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addClass( [\n\t\t\t\t\t\t'busy',\n\t\t\t\t\t\t'is-sub-section-open',\n\t\t\t\t\t] );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.removeClass( 'open' );\n\t\t\t\t}\n\n\t\t\t\tconst handleTransitionEnd = () => {\n\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\targs.completeCallback();\n\t\t\t\t};\n\n\t\t\t\tif ( isReducedMotion ) {\n\t\t\t\t\thandleTransitionEnd();\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.one(\n\t\t\t\t\t\t'transitionend',\n\t\t\t\t\t\thandleTransitionEnd\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.onChangeExpanded( expanded, args );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,qBAAqB;AAErD,MAAMC,qBAAqB,GAAKC,SAAS,IACvC,qBAAqBA,SAAW,EAAC;AAEnC,eAAe,SAASC,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IACLC,EAAE,EAAE;MAAEC;IAAU;EACjB,CAAC,GAAGC,MAAM;EAEV,MAAMC,sBAAsB,GAAGD,MAAM,CAACE,UAAU,CAC/C,kCACD,CAAC;EACD,IAAIC,eAAe,GAAGF,sBAAsB,CAACG,OAAO;EACpDH,sBAAsB,CAACI,gBAAgB,CAAE,QAAQ,EAAIC,KAAK,IAAM;IAC/DH,eAAe,GAAGG,KAAK,CAACF,OAAO;EAChC,CAAE,CAAC;EAEH,OAAO,MAAMG,cAAc,SAASR,SAAS,CAACS,OAAO,CAAC;IACrDC,KAAKA,CAAA,EAAG;MACP,MAAMC,gBAAgB,GAAGhB,mBAAmB,CAAC,CAAC;MAC9C,IAAI,CAACiB,SAAS,GAAG,IAAID,gBAAgB,CACpCf,qBAAqB,CAAE,IAAI,CAACiB,EAAG,CAAC,EAChC;QACCC,KAAK,EAAEpB,EA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,IAAI,CAACb,gBAAgB,CACnBe,OAAO,CAAE,kBAAmB,CAAC,CAC7BF,QAAQ,CAAE,cAAe,CAAC;UAC5B,IAAI,CAACb,gBAAgB,CAACc,WAAW,CAAE,MAAO,CAAC;QAC5C;QAEA,MAAME,mBAAmB,GAAGA,CAAA,KAAM;UACjC,IAAI,CAAChB,gBAAgB,CAACc,WAAW,CAAE,MAAO,CAAC;UAC3CP,IAAI,CAACC,gBAAgB,CAAC,CAAC;QACxB,CAAC;QAED,IAAKzB,eAAe,EAAG;UACtBiC,mBAAmB,CAAC,CAAC;QACtB,CAAC,MAAM;UACN,IAAI,CAAChB,gBAAgB,CAACiB,GAAG,CACxB,eAAe,EACfD,mBACD,CAAC;QACF;MACD,CAAC,MAAM;QACN,KAAK,CAACZ,gBAAgB,CAAED,QAAQ,EAAEI,IAAK,CAAC;MACzC;IACD;EACD,CAAC;AACF","ignoreList":[]}
1
+ {"version":3,"names":["__","getInspectorSection","getInspectorSectionId","sidebarId","getSidebarSection","wp","customize","window","reduceMotionMediaQuery","matchMedia","isReducedMotion","matches","addEventListener","event","SidebarSection","Section","ready","InspectorSection","inspector","id","title","parentSection","customizeAction","params","join","section","add","contentContainer","classList","hasSubSectionOpened","expanded","onChangeExpanded","_args","controls","args","completeCallback","forEach","control","onChangeSectionExpanded","manualTransition","addClass","removeClass","closest","handleTransitionEnd","one"],"sources":["@wordpress/customize-widgets/src/controls/sidebar-section.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport getInspectorSection from './inspector-section';\n\nconst getInspectorSectionId = ( sidebarId ) =>\n\t`widgets-inspector-${ sidebarId }`;\n\nexport default function getSidebarSection() {\n\tconst {\n\t\twp: { customize },\n\t} = window;\n\n\tconst reduceMotionMediaQuery = window.matchMedia(\n\t\t'(prefers-reduced-motion: reduce)'\n\t);\n\tlet isReducedMotion = reduceMotionMediaQuery.matches;\n\treduceMotionMediaQuery.addEventListener( 'change', ( event ) => {\n\t\tisReducedMotion = event.matches;\n\t} );\n\n\treturn class SidebarSection extends customize.Section {\n\t\tready() {\n\t\t\tconst InspectorSection = getInspectorSection();\n\t\t\tthis.inspector = new InspectorSection(\n\t\t\t\tgetInspectorSectionId( this.id ),\n\t\t\t\t{\n\t\t\t\t\ttitle: __( 'Block Settings' ),\n\t\t\t\t\tparentSection: this,\n\t\t\t\t\tcustomizeAction: [\n\t\t\t\t\t\t__( 'Customizing' ),\n\t\t\t\t\t\t__( 'Widgets' ),\n\t\t\t\t\t\tthis.params.title,\n\t\t\t\t\t].join( ' ▸ ' ),\n\t\t\t\t}\n\t\t\t);\n\t\t\tcustomize.section.add( this.inspector );\n\t\t\tthis.contentContainer[ 0 ].classList.add(\n\t\t\t\t'customize-widgets__sidebar-section'\n\t\t\t);\n\t\t}\n\t\thasSubSectionOpened() {\n\t\t\treturn this.inspector.expanded();\n\t\t}\n\t\tonChangeExpanded( expanded, _args ) {\n\t\t\tconst controls = this.controls();\n\t\t\tconst args = {\n\t\t\t\t..._args,\n\t\t\t\tcompleteCallback() {\n\t\t\t\t\tcontrols.forEach( ( control ) => {\n\t\t\t\t\t\tcontrol.onChangeSectionExpanded?.( expanded, args );\n\t\t\t\t\t} );\n\t\t\t\t\t_args.completeCallback?.();\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tif ( args.manualTransition ) {\n\t\t\t\tif ( expanded ) {\n\t\t\t\t\tthis.contentContainer.addClass( [ 'busy', 'open' ] );\n\t\t\t\t\tthis.contentContainer.removeClass( 'is-sub-section-open' );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.addClass( [\n\t\t\t\t\t\t'busy',\n\t\t\t\t\t\t'is-sub-section-open',\n\t\t\t\t\t] );\n\t\t\t\t\tthis.contentContainer\n\t\t\t\t\t\t.closest( '.wp-full-overlay' )\n\t\t\t\t\t\t.addClass( 'section-open' );\n\t\t\t\t\tthis.contentContainer.removeClass( 'open' );\n\t\t\t\t}\n\n\t\t\t\tconst handleTransitionEnd = () => {\n\t\t\t\t\tthis.contentContainer.removeClass( 'busy' );\n\t\t\t\t\targs.completeCallback();\n\t\t\t\t};\n\n\t\t\t\tif ( isReducedMotion ) {\n\t\t\t\t\thandleTransitionEnd();\n\t\t\t\t} else {\n\t\t\t\t\tthis.contentContainer.one(\n\t\t\t\t\t\t'transitionend',\n\t\t\t\t\t\thandleTransitionEnd\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsuper.onChangeExpanded( expanded, args );\n\t\t\t}\n\t\t}\n\t};\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,mBAAmB,MAAM,qBAAqB;AAErD,MAAMC,qBAAqB,GAAKC,SAAS,IACxC,qBAAsBA,SAAS,EAAG;AAEnC,eAAe,SAASC,iBAAiBA,CAAA,EAAG;EAC3C,MAAM;IACLC,EAAE,EAAE;MAAEC;IAAU;EACjB,CAAC,GAAGC,MAAM;EAEV,MAAMC,sBAAsB,GAAGD,MAAM,CAACE,UAAU,CAC/C,kCACD,CAAC;EACD,IAAIC,eAAe,GAAGF,sBAAsB,CAACG,OAAO;EACpDH,sBAAsB,CAACI,gBAAgB,CAAE,QAAQ,EAAIC,KAAK,IAAM;IAC/DH,eAAe,GAAGG,KAAK,CAACF,OAAO;EAChC,CAAE,CAAC;EAEH,OAAO,MAAMG,cAAc,SAASR,SAAS,CAACS,OAAO,CAAC;IACrDC,KAAKA,CAAA,EAAG;MACP,MAAMC,gBAAgB,GAAGhB,mBAAmB,CAAC,CAAC;MAC9C,IAAI,CAACiB,SAAS,GAAG,IAAID,gBAAgB,CACpCf,qBAAqB,CAAE,IAAI,CAACiB,EAAG,CAAC,EAChC;QACCC,KAAK,EAAEpB,EAAE,CAA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CAACb,gBAAgB,CACnBe,OAAO,CAAE,kBAAmB,CAAC,CAC7BF,QAAQ,CAAE,cAAe,CAAC;UAC5B,IAAI,CAACb,gBAAgB,CAACc,WAAW,CAAE,MAAO,CAAC;QAC5C;QAEA,MAAME,mBAAmB,GAAGA,CAAA,KAAM;UACjC,IAAI,CAAChB,gBAAgB,CAACc,WAAW,CAAE,MAAO,CAAC;UAC3CP,IAAI,CAACC,gBAAgB,CAAC,CAAC;QACxB,CAAC;QAED,IAAKzB,eAAe,EAAG;UACtBiC,mBAAmB,CAAC,CAAC;QACtB,CAAC,MAAM;UACN,IAAI,CAAChB,gBAAgB,CAACiB,GAAG,CACxB,eAAe,EACfD,mBACD,CAAC;QACF;MACD,CAAC,MAAM;QACN,KAAK,CAACZ,gBAAgB,CAAED,QAAQ,EAAEI,IAAK,CAAC;MACzC;IACD;EACD,CAAC;AACF","ignoreList":[]}
@@ -13,9 +13,7 @@ import { MoveToWidgetArea, getWidgetIdFromBlock } from '@wordpress/widgets';
13
13
  import { useSidebarControls, useActiveSidebarControl } from '../components/sidebar-controls';
14
14
  import { useFocusControl } from '../components/focus-control';
15
15
  import { blockToWidget } from '../utils';
16
- import { jsx as _jsx } from "react/jsx-runtime";
17
- import { Fragment as _Fragment } from "react/jsx-runtime";
18
- import { jsxs as _jsxs } from "react/jsx-runtime";
16
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
19
17
  const withMoveToSidebarToolbarItem = createHigherOrderComponent(BlockEdit => props => {
20
18
  let widgetId = getWidgetIdFromBlock(props);
21
19
  const sidebarControls = useSidebarControls();
@@ -1 +1 @@
1
- {"version":3,"names":["BlockControls","store","blockEditorStore","createHigherOrderComponent","useSelect","useDispatch","addFilter","MoveToWidgetArea","getWidgetIdFromBlock","useSidebarControls","useActiveSidebarControl","useFocusControl","blockToWidget","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","children","widgetAreas","map","params","label","description","currentWidgetAreaId","onSelect"],"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 key=\"edit\" { ...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":"AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,gBAAgB,EAAEC,oBAAoB,QAAQ,oBAAoB;;AAE3E;AACA;AACA;AACA,SACCC,kBAAkB,EAClBC,uBAAuB,QACjB,gCAAgC;AACvC,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,aAAa,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,QAAA,IAAAC,SAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAEzC,MAAMC,4BAA4B,GAAGhB,0BAA0B,CAC5DiB,SAAS,IAAQC,KAAK,IAAM;EAC7B,IAAIC,QAAQ,GAAGd,oBAAoB,CAAEa,KAAM,CAAC;EAC5C,MAAME,eAAe,GAAGd,kBAAkB,CAAC,CAAC;EAC5C,MAAMe,oBAAoB,GAAGd,uBAAuB,CAAC,CAAC;EACtD,MAAMe,mBAAmB,GAAGF,eAAe,EAAEG,MAAM,GAAG,CAAC;EACvD,MAAMC,SAAS,GAAGN,KAAK,CAACO,IAAI;EAC5B,MAAMC,QAAQ,GAAGR,KA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rB,CAAC;MACH;MACAX,QAAQ,GAAG0B,cAAc,CAACG,OAAO,CAAC,CAAC,CAACX,IAAI,CAAIE,EAAE,IAAM,CAAC,CAAEA,EAAG,CAAC;IAC5D;;IAEA;IACAN,WAAW,CAAEd,QAAS,CAAC;EACxB;EAEA,oBACCJ,KAAA,CAAAF,SAAA;IAAAoC,QAAA,gBACCtC,IAAA,CAACM,SAAS;MAAA,GAAiBC;IAAK,GAAjB,MAAqB,CAAC,EACnCI,mBAAmB,IAAIK,uBAAuB,iBAC/ChB,IAAA,CAACd,aAAa;MAAAoD,QAAA,eACbtC,IAAA,CAACP,gBAAgB;QAChB8C,WAAW,EAAG9B,eAAe,CAAC+B,GAAG,CAC9Bb,cAAc,KAAQ;UACvBC,EAAE,EAAED,cAAc,CAACC,EAAE;UACrBd,IAAI,EAAEa,cAAc,CAACc,MAAM,CAACC,KAAK;UACjCC,WAAW,EACVhB,cAAc,CAACc,MAAM,CAACE;QACxB,CAAC,CACF,CAAG;QACHC,mBAAmB,EAAGlC,oBAAoB,EAAEkB,EAAI;QAChDiB,QAAQ,EAAGtB;MAAe,CAC1B;IAAC,CACY,CACf;EAAA,CACA,CAAC;AAEL,CAAC,EACD,8BACD,CAAC;AAED/B,SAAS,CACR,kBAAkB,EAClB,mCAAmC,EACnCa,4BACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["BlockControls","store","blockEditorStore","createHigherOrderComponent","useSelect","useDispatch","addFilter","MoveToWidgetArea","getWidgetIdFromBlock","useSidebarControls","useActiveSidebarControl","useFocusControl","blockToWidget","jsx","_jsx","Fragment","_Fragment","jsxs","_jsxs","withMoveToSidebarToolbarItem","BlockEdit","props","widgetId","sidebarControls","activeSidebarControl","hasMultipleSidebars","length","blockName","name","clientId","canInsertBlockInSidebar","select","canInsertBlockType","block","getBlock","removeBlock","focusWidget","moveToSidebar","sidebarControlId","newSidebarControl","find","sidebarControl","id","oldSetting","setting","newSetting","filter","sidebarAdapter","addedWidgetIds","setWidgets","getWidgets","reverse","children","widgetAreas","map","params","label","description","currentWidgetAreaId","onSelect"],"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 key=\"edit\" { ...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":"AAAA;AACA;AACA;AACA,SACCA,aAAa,EACbC,KAAK,IAAIC,gBAAgB,QACnB,yBAAyB;AAChC,SAASC,0BAA0B,QAAQ,oBAAoB;AAC/D,SAASC,SAAS,EAAEC,WAAW,QAAQ,iBAAiB;AACxD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,gBAAgB,EAAEC,oBAAoB,QAAQ,oBAAoB;;AAE3E;AACA;AACA;AACA,SACCC,kBAAkB,EAClBC,uBAAuB,QACjB,gCAAgC;AACvC,SAASC,eAAe,QAAQ,6BAA6B;AAC7D,SAASC,aAAa,QAAQ,UAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA,EAAAC,IAAA,IAAAC,KAAA;AAEzC,MAAMC,4BAA4B,GAAGhB,0BAA0B,CAC5DiB,SAAS,IAAQC,KAAK,IAAM;EAC7B,IAAIC,QAAQ,GAAGd,oBAAoB,CAAEa,KAAM,CAAC;EAC5C,MAAME,eAAe,GAAGd,kBAAkB,CAAC,CAAC;EAC5C,MAAMe,oBAAoB,GAAGd,uBAAuB,CAAC,CAAC;EACtD,MAAMe,mBAAmB,GAAGF,eAAe,EAAEG,MAAM,GAAG,CAAC;EACvD,MAAMC,SAAS,GAAGN,KAAK,CAACO,IAAI;EAC5B,MAAMC,QAAQ,GAAGR,KAAK,CAACQ,QAAQ;EAC/B,MAAMC,uBAAuB,GAAG1B,SAAS,CACtC2B,MAAM,IAAM;IACb;IACA;IACA,OAAOA,MAAM,CAAE7B,gBAAiB,CAAC,CAAC8B,kBAAkB,CACnDL,SAAS,EACT,EACD,CAAC;EACF,CAAC,EACD,CAAEA,SA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AAF,SAAA;IAAAoC,QAAA,gBACCtC,IAAA,CAACM,SAAS;MAAA,GAAiBC;IAAK,GAAjB,MAAqB,CAAC,EACnCI,mBAAmB,IAAIK,uBAAuB,iBAC/ChB,IAAA,CAACd,aAAa;MAAAoD,QAAA,eACbtC,IAAA,CAACP,gBAAgB;QAChB8C,WAAW,EAAG9B,eAAe,CAAC+B,GAAG,CAC9Bb,cAAc,KAAQ;UACvBC,EAAE,EAAED,cAAc,CAACC,EAAE;UACrBd,IAAI,EAAEa,cAAc,CAACc,MAAM,CAACC,KAAK;UACjCC,WAAW,EACVhB,cAAc,CAACc,MAAM,CAACE;QACxB,CAAC,CACF,CAAG;QACHC,mBAAmB,EAAGlC,oBAAoB,EAAEkB,EAAI;QAChDiB,QAAQ,EAAGtB;MAAe,CAC1B;IAAC,CACY,CACf;EAAA,CACA,CAAC;AAEL,CAAC,EACD,8BACD,CAAC;AAED/B,SAAS,CACR,kBAAkB,EAClB,mCAAmC,EACnCa,4BACD,CAAC","ignoreList":[]}
@@ -6,6 +6,7 @@ import { registerCoreBlocks, __experimentalGetCoreBlocks, __experimentalRegister
6
6
  import { registerLegacyWidgetBlock, registerLegacyWidgetVariations, registerWidgetGroupBlock } from '@wordpress/widgets';
7
7
  import { setFreeformContentHandlerName, store as blocksStore } from '@wordpress/blocks';
8
8
  import { dispatch } from '@wordpress/data';
9
+ import { privateApis as editorPrivateApis } from '@wordpress/editor';
9
10
  import { store as preferencesStore } from '@wordpress/preferences';
10
11
 
11
12
  /**
@@ -15,12 +16,16 @@ import CustomizeWidgets from './components/customize-widgets';
15
16
  import getSidebarSection from './controls/sidebar-section';
16
17
  import getSidebarControl from './controls/sidebar-control';
17
18
  import './filters';
19
+ import { unlock } from './lock-unlock';
18
20
  import { jsx as _jsx } from "react/jsx-runtime";
19
21
  const {
20
22
  wp
21
23
  } = window;
22
24
  const DISABLED_BLOCKS = ['core/more', 'core/block', 'core/freeform', 'core/template-part'];
23
25
  const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
26
+ const {
27
+ registerCoreBlockBindingsSources
28
+ } = unlock(editorPrivateApis);
24
29
 
25
30
  /**
26
31
  * Initializes the widgets block editor in the customizer.
@@ -38,6 +43,7 @@ export function initialize(editorName, blockEditorSettings) {
38
43
  return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith('core/post') || block.name.startsWith('core/query') || block.name.startsWith('core/site') || block.name.startsWith('core/navigation'));
39
44
  });
40
45
  registerCoreBlocks(coreBlocks);
46
+ registerCoreBlockBindingsSources();
41
47
  registerLegacyWidgetBlock();
42
48
  if (globalThis.IS_GUTENBERG_PLUGIN) {
43
49
  __experimentalRegisterExperimentalCoreBlocks({
@@ -64,7 +70,7 @@ export function initialize(editorName, blockEditorSettings) {
64
70
  sidebarControls.push(control);
65
71
  }
66
72
  });
67
- createRoot(container).render( /*#__PURE__*/_jsx(StrictMode, {
73
+ createRoot(container).render(/*#__PURE__*/_jsx(StrictMode, {
68
74
  children: /*#__PURE__*/_jsx(CustomizeWidgets, {
69
75
  api: wp.customize,
70
76
  sidebarControls: sidebarControls,
@@ -1 +1 @@
1
- {"version":3,"names":["createRoot","StrictMode","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","setFreeformContentHandlerName","store","blocksStore","dispatch","preferencesStore","CustomizeWidgets","getSidebarSection","getSidebarControl","jsx","_jsx","wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","initialize","editorName","blockEditorSettings","setDefaults","fixedToolbar","welcomeGuide","reapplyBlockTypeFilters","coreBlocks","filter","block","includes","name","startsWith","globalThis","IS_GUTENBERG_PLUGIN","enableFSEBlocks","SidebarControl","customize","sectionConstructor","sidebar","controlConstructor","sidebar_block_editor","container","document","createElement","body","appendChild","bind","sidebarControls","control","each","push","render","children","api"],"sources":["@wordpress/customize-widgets/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { 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';\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<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":"AAAA;AACA;AACA;AACA,SAASA,UAAU,EAAEC,UAAU,QAAQ,oBAAoB;AAC3D,SACCC,kBAAkB,EAClBC,2BAA2B,EAC3BC,4CAA4C,QACtC,0BAA0B;AACjC,SACCC,yBAAyB,EACzBC,8BAA8B,EAC9BC,wBAAwB,QAClB,oBAAoB;AAC3B,SACCC,6BAA6B,EAC7BC,KAAK,IAAIC,WAAW,QACd,mBAAmB;AAC1B,SAASC,QAAQ,QAAQ,iBAAiB;AAC1C,SAASF,KAAK,IAAIG,gBAAgB,QAAQ,wBAAwB;;AAElE;AACA;AACA;AACA,OAAOC,gBAAgB,MAAM,gCAAgC;AAC7D,OAAOC,iBAAiB,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Y,CAAC;EAE5C,MAAM8B,cAAc,GAAGvB,iBAAiB,CAAES,mBAAoB,CAAC;EAE/DN,EAAE,CAACqB,SAAS,CAACC,kBAAkB,CAACC,OAAO,GAAG3B,iBAAiB,CAAC,CAAC;EAC7DI,EAAE,CAACqB,SAAS,CAACG,kBAAkB,CAACC,oBAAoB,GAAGL,cAAc;EAErE,MAAMM,SAAS,GAAGC,QAAQ,CAACC,aAAa,CAAE,KAAM,CAAC;EACjDD,QAAQ,CAACE,IAAI,CAACC,WAAW,CAAEJ,SAAU,CAAC;EAEtC1B,EAAE,CAACqB,SAAS,CAACU,IAAI,CAAE,OAAO,EAAE,MAAM;IACjC,MAAMC,eAAe,GAAG,EAAE;IAC1BhC,EAAE,CAACqB,SAAS,CAACY,OAAO,CAACC,IAAI,CAAID,OAAO,IAAM;MACzC,IAAKA,OAAO,YAAYb,cAAc,EAAG;QACxCY,eAAe,CAACG,IAAI,CAAEF,OAAQ,CAAC;MAChC;IACD,CAAE,CAAC;IAEHnD,UAAU,CAAE4C,SAAU,CAAC,CAACU,MAAM,eAC7BrC,IAAA,CAAChB,UAAU;MAAAsD,QAAA,eACVtC,IAAA,CAACJ,gBAAgB;QAChB2C,GAAG,EAAGtC,EAAE,CAACqB,SAAW;QACpBW,eAAe,EAAGA,eAAiB;QACnC1B,mBAAmB,EAAGA;MAAqB,CAC3C;IAAC,CACS,CACb,CAAC;EACF,CAAE,CAAC;AACJ;AACA,SAASf,KAAK,QAAQ,SAAS","ignoreList":[]}
1
+ {"version":3,"names":["createRoot","StrictMode","registerCoreBlocks","__experimentalGetCoreBlocks","__experimentalRegisterExperimentalCoreBlocks","registerLegacyWidgetBlock","registerLegacyWidgetVariations","registerWidgetGroupBlock","setFreeformContentHandlerName","store","blocksStore","dispatch","privateApis","editorPrivateApis","preferencesStore","CustomizeWidgets","getSidebarSection","getSidebarControl","unlock","jsx","_jsx","wp","window","DISABLED_BLOCKS","ENABLE_EXPERIMENTAL_FSE_BLOCKS","registerCoreBlockBindingsSources","initialize","editorName","blockEditorSettings","setDefaults","fixedToolbar","welcomeGuide","reapplyBlockTypeFilters","coreBlocks","filter","block","includes","name","startsWith","globalThis","IS_GUTENBERG_PLUGIN","enableFSEBlocks","SidebarControl","customize","sectionConstructor","sidebar","controlConstructor","sidebar_block_editor","container","document","createElement","body","appendChild","bind","sidebarControls","control","each","push","render","children","api"],"sources":["@wordpress/customize-widgets/src/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { 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 { privateApis as editorPrivateApis } from '@wordpress/editor';\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';\nimport { unlock } from './lock-unlock';\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\nconst { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );\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\tregisterCoreBlockBindingsSources();\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<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":"AAAA;AACA;AACA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AU,CAAC,CAACU,MAAM,cAC7BtC,IAAA,CAACnB,UAAU;MAAA0D,QAAA,eACVvC,IAAA,CAACL,gBAAgB;QAChB6C,GAAG,EAAGvC,EAAE,CAACsB,SAAW;QACpBW,eAAe,EAAGA,eAAiB;QACnC1B,mBAAmB,EAAGA;MAAqB,CAC3C;IAAC,CACS,CACb,CAAC;EACF,CAAE,CAAC;AACJ;AACA,SAASnB,KAAK,QAAQ,SAAS","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","_raw$content","parsedBlocks","__unstableSkipAutop","length"],"sources":["@wordpress/customize-widgets/src/utils.js"],"sourcesContent":["// @ts-check\n/**\n * WordPress dependencies\n */\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,KAAK,EAAEC,WAAW,QAAQ,mBAAmB;AACjE,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAEC,SAAS,EAAG;EAChD,MAAMC,OAAO,GAAGD,SAAS,CAACE,KAAK,CAAE,4BAA6B,CAAC;EAE/D,IAAKD,OAAO,EAAG;IACd,MAAME,MAAM,GAAGF,OAAO,CAAE,CAAC,CAAE;IAC3B,MAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAC,CAAE,EAAE,EAAG,CAAC;IAE3C,OAAQ,GAAGE,MAAQ,IAAIC,MAAQ,EAAC;EACjC;EAEA,OAAOJ,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,aAAaA,CAAEC,KAAK,EAAEC,cAAc,GAAG,IAAI,EAAG;EAC7D,IAAIC,MAAM;EAEV,MAAMC,wBAAwB,GAC7BH,KAAK,CAACI,IAAI,KAAK,oBAAoB,KACjCJ,KAAK,CAACK,UAAU,CAACC,EAAE,IAAIN,KAAK,CAACK,UAAU,CAACE,QAAQ,CAAE;EAErD,IAAKJ,wBAAwB,EAAG;IAC/B,IAAKH,KAAK,CAACK,UAAU,CAACC,EAAE,EAAG;MAC1B;MACAJ,MAAM,GAAG;QACRI,EAAE,EAAEN,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AAK,EAAAiC,YAAA,GAAEZ,GAAG,CAACM,OAAO,cAAAM,YAAA,cAAAA,YAAA,GAAI,EAAE,EAAE;MAC9CE,mBAAmB,EAAE;IACtB,CAAE,CAAC;IACHxB,KAAK,GAAGuB,YAAY,CAACE,MAAM,GACxBF,YAAY,CAAE,CAAC,CAAE,GACjBjC,WAAW,CAAE,gBAAgB,EAAE,CAAC,CAAE,CAAC;EACvC,CAAC,MAAM,IAAKO,MAAM,EAAG;IACpB;IACAG,KAAK,GAAGV,WAAW,CAAE,oBAAoB,EAAE;MAC1CM,MAAM;MACNW,QAAQ,EAAE;QACTC,OAAO;QACPC,IAAI;QACJC,GAAG;QACH,GAAGC;MACJ;IACD,CAAE,CAAC;EACJ,CAAC,MAAM;IACN;IACAX,KAAK,GAAGV,WAAW,CAAE,oBAAoB,EAAE;MAC1CgB;IACD,CAAE,CAAC;EACJ;EAEA,OAAOf,kBAAkB,CAAES,KAAK,EAAEM,EAAG,CAAC;AACvC","ignoreList":[]}
1
+ {"version":3,"names":["serialize","parse","createBlock","addWidgetIdToBlock","settingIdToWidgetId","settingId","matches","match","idBase","number","parseInt","blockToWidget","block","existingWidget","widget","isValidLegacyWidgetBlock","name","attributes","id","instance","encoded","hash","raw","rest","is_widget_customizer_js_value","encoded_serialized_instance","instance_hash_key","raw_instance","content","widgetClass","form","rendered","restExistingWidget","widgetToBlock","_raw$content","parsedBlocks","__unstableSkipAutop","length"],"sources":["@wordpress/customize-widgets/src/utils.js"],"sourcesContent":["// @ts-check\n/**\n * WordPress dependencies\n */\nimport { serialize, parse, createBlock } from '@wordpress/blocks';\nimport { addWidgetIdToBlock } from '@wordpress/widgets';\n\n/**\n * Convert settingId to widgetId.\n *\n * @param {string} settingId The setting id.\n * @return {string} The widget id.\n */\nexport function settingIdToWidgetId( settingId ) {\n\tconst matches = settingId.match( /^widget_(.+)(?:\\[(\\d+)\\])$/ );\n\n\tif ( matches ) {\n\t\tconst idBase = matches[ 1 ];\n\t\tconst number = parseInt( matches[ 2 ], 10 );\n\n\t\treturn `${ idBase }-${ number }`;\n\t}\n\n\treturn settingId;\n}\n\n/**\n * Transform a block to a customizable widget.\n *\n * @param {WPBlock} block The block to be transformed from.\n * @param {Object} existingWidget The widget to be extended from.\n * @return {Object} The transformed widget.\n */\nexport function blockToWidget( block, existingWidget = null ) {\n\tlet widget;\n\n\tconst isValidLegacyWidgetBlock =\n\t\tblock.name === 'core/legacy-widget' &&\n\t\t( block.attributes.id || block.attributes.instance );\n\n\tif ( isValidLegacyWidgetBlock ) {\n\t\tif ( block.attributes.id ) {\n\t\t\t// Widget that does not extend WP_Widget.\n\t\t\twidget = {\n\t\t\t\tid: block.attributes.id,\n\t\t\t};\n\t\t} else {\n\t\t\tconst { encoded, hash, raw, ...rest } = block.attributes.instance;\n\n\t\t\t// Widget that extends WP_Widget.\n\t\t\twidget = {\n\t\t\t\tidBase: block.attributes.idBase,\n\t\t\t\tinstance: {\n\t\t\t\t\t...existingWidget?.instance,\n\t\t\t\t\t// Required only for the customizer.\n\t\t\t\t\tis_widget_customizer_js_value: true,\n\t\t\t\t\tencoded_serialized_instance: encoded,\n\t\t\t\t\tinstance_hash_key: hash,\n\t\t\t\t\traw_instance: raw,\n\t\t\t\t\t...rest,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\t} else {\n\t\tconst instance = {\n\t\t\tcontent: serialize( block ),\n\t\t};\n\t\twidget = {\n\t\t\tidBase: 'block',\n\t\t\twidgetClass: 'WP_Widget_Block',\n\t\t\tinstance: {\n\t\t\t\traw_instance: instance,\n\t\t\t},\n\t\t};\n\t}\n\n\tconst { form, rendered, ...restExistingWidget } = existingWidget || {};\n\n\treturn {\n\t\t...restExistingWidget,\n\t\t...widget,\n\t};\n}\n\n/**\n * Transform a widget to a block.\n *\n * @param {Object} widget The widget to be transformed from.\n * @param {string} widget.id The widget id.\n * @param {string} widget.idBase The id base of the widget.\n * @param {number} widget.number The number/index of the widget.\n * @param {Object} widget.instance The instance of the widget.\n * @return {WPBlock} The transformed block.\n */\nexport function widgetToBlock( { id, idBase, number, instance } ) {\n\tlet block;\n\n\tconst {\n\t\tencoded_serialized_instance: encoded,\n\t\tinstance_hash_key: hash,\n\t\traw_instance: raw,\n\t\t...rest\n\t} = instance;\n\n\tif ( idBase === 'block' ) {\n\t\tconst parsedBlocks = parse( raw.content ?? '', {\n\t\t\t__unstableSkipAutop: true,\n\t\t} );\n\t\tblock = parsedBlocks.length\n\t\t\t? parsedBlocks[ 0 ]\n\t\t\t: createBlock( 'core/paragraph', {} );\n\t} else if ( number ) {\n\t\t// Widget that extends WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tidBase,\n\t\t\tinstance: {\n\t\t\t\tencoded,\n\t\t\t\thash,\n\t\t\t\traw,\n\t\t\t\t...rest,\n\t\t\t},\n\t\t} );\n\t} else {\n\t\t// Widget that does not extend WP_Widget.\n\t\tblock = createBlock( 'core/legacy-widget', {\n\t\t\tid,\n\t\t} );\n\t}\n\n\treturn addWidgetIdToBlock( block, id );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,KAAK,EAAEC,WAAW,QAAQ,mBAAmB;AACjE,SAASC,kBAAkB,QAAQ,oBAAoB;;AAEvD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CAAEC,SAAS,EAAG;EAChD,MAAMC,OAAO,GAAGD,SAAS,CAACE,KAAK,CAAE,4BAA6B,CAAC;EAE/D,IAAKD,OAAO,EAAG;IACd,MAAME,MAAM,GAAGF,OAAO,CAAE,CAAC,CAAE;IAC3B,MAAMG,MAAM,GAAGC,QAAQ,CAAEJ,OAAO,CAAE,CAAC,CAAE,EAAE,EAAG,CAAC;IAE3C,OAAO,GAAIE,MAAM,IAAMC,MAAM,EAAG;EACjC;EAEA,OAAOJ,SAAS;AACjB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,aAAaA,CAAEC,KAAK,EAAEC,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A,CAAE;EAAEf,EAAE;EAAEV,MAAM;EAAEC,MAAM;EAAEU;AAAS,CAAC,EAAG;EACjE,IAAIP,KAAK;EAET,MAAM;IACLa,2BAA2B,EAAEL,OAAO;IACpCM,iBAAiB,EAAEL,IAAI;IACvBM,YAAY,EAAEL,GAAG;IACjB,GAAGC;EACJ,CAAC,GAAGJ,QAAQ;EAEZ,IAAKX,MAAM,KAAK,OAAO,EAAG;IAAA,IAAA0B,YAAA;IACzB,MAAMC,YAAY,GAAGlC,KAAK,EAAAiC,YAAA,GAAEZ,GAAG,CAACM,OAAO,cAAAM,YAAA,cAAAA,YAAA,GAAI,EAAE,EAAE;MAC9CE,mBAAmB,EAAE;IACtB,CAAE,CAAC;IACHxB,KAAK,GAAGuB,YAAY,CAACE,MAAM,GACxBF,YAAY,CAAE,CAAC,CAAE,GACjBjC,WAAW,CAAE,gBAAgB,EAAE,CAAC,CAAE,CAAC;EACvC,CAAC,MAAM,IAAKO,MAAM,EAAG;IACpB;IACAG,KAAK,GAAGV,WAAW,CAAE,oBAAoB,EAAE;MAC1CM,MAAM;MACNW,QAAQ,EAAE;QACTC,OAAO;QACPC,IAAI;QACJC,GAAG;QACH,GAAGC;MACJ;IACD,CAAE,CAAC;EACJ,CAAC,MAAM;IACN;IACAX,KAAK,GAAGV,WAAW,CAAE,oBAAoB,EAAE;MAC1CgB;IACD,CAAE,CAAC;EACJ;EAEA,OAAOf,kBAAkB,CAAES,KAAK,EAAEM,EAAG,CAAC;AACvC","ignoreList":[]}
@@ -29,6 +29,9 @@
29
29
  /**
30
30
  * Fonts & basic variables.
31
31
  */
32
+ /**
33
+ * Typography
34
+ */
32
35
  /**
33
36
  * Grid System.
34
37
  * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
@@ -43,7 +46,10 @@
43
46
  * Dimensions.
44
47
  */
45
48
  /**
46
- * Editor widths.
49
+ * Mobile specific styles
50
+ */
51
+ /**
52
+ * Editor styles.
47
53
  */
48
54
  /**
49
55
  * Block & Editor UI.
@@ -67,6 +73,9 @@
67
73
  * Creates a fading overlay to signify that the content is longer
68
74
  * than the space allows.
69
75
  */
76
+ /**
77
+ * Typography
78
+ */
70
79
  /**
71
80
  * Breakpoint mixins
72
81
  */
@@ -29,6 +29,9 @@
29
29
  /**
30
30
  * Fonts & basic variables.
31
31
  */
32
+ /**
33
+ * Typography
34
+ */
32
35
  /**
33
36
  * Grid System.
34
37
  * https://make.wordpress.org/design/2019/10/31/proposal-a-consistent-spacing-system-for-wordpress/
@@ -43,7 +46,10 @@
43
46
  * Dimensions.
44
47
  */
45
48
  /**
46
- * Editor widths.
49
+ * Mobile specific styles
50
+ */
51
+ /**
52
+ * Editor styles.
47
53
  */
48
54
  /**
49
55
  * Block & Editor UI.
@@ -67,6 +73,9 @@
67
73
  * Creates a fading overlay to signify that the content is longer
68
74
  * than the space allows.
69
75
  */
76
+ /**
77
+ * Typography
78
+ */
70
79
  /**
71
80
  * Breakpoint mixins
72
81
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/customize-widgets",
3
- "version": "5.8.7",
3
+ "version": "5.10.0",
4
4
  "description": "Widgets blocks in Customizer Module for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -24,27 +24,28 @@
24
24
  "module": "build-module/index.js",
25
25
  "react-native": "src/index",
26
26
  "dependencies": {
27
- "@babel/runtime": "^7.16.0",
28
- "@wordpress/block-editor": "^14.3.6",
29
- "@wordpress/block-library": "^9.8.7",
30
- "@wordpress/blocks": "^13.8.4",
31
- "@wordpress/components": "^28.8.6",
32
- "@wordpress/compose": "^7.8.3",
33
- "@wordpress/core-data": "^7.8.6",
34
- "@wordpress/data": "^10.8.3",
35
- "@wordpress/dom": "^4.8.2",
36
- "@wordpress/element": "^6.8.1",
37
- "@wordpress/hooks": "^4.8.2",
38
- "@wordpress/i18n": "^5.8.2",
39
- "@wordpress/icons": "^10.8.2",
40
- "@wordpress/interface": "^6.8.6",
41
- "@wordpress/is-shallow-equal": "^5.8.1",
42
- "@wordpress/keyboard-shortcuts": "^5.8.3",
43
- "@wordpress/keycodes": "^4.8.2",
44
- "@wordpress/media-utils": "^5.8.2",
45
- "@wordpress/preferences": "^4.8.6",
46
- "@wordpress/private-apis": "^1.8.1",
47
- "@wordpress/widgets": "^4.8.6",
27
+ "@babel/runtime": "7.25.7",
28
+ "@wordpress/block-editor": "^14.5.0",
29
+ "@wordpress/block-library": "^9.10.0",
30
+ "@wordpress/blocks": "^13.10.0",
31
+ "@wordpress/components": "^28.10.0",
32
+ "@wordpress/compose": "^7.10.0",
33
+ "@wordpress/core-data": "^7.10.0",
34
+ "@wordpress/data": "^10.10.0",
35
+ "@wordpress/dom": "^4.10.0",
36
+ "@wordpress/editor": "^14.10.0",
37
+ "@wordpress/element": "^6.10.0",
38
+ "@wordpress/hooks": "^4.10.0",
39
+ "@wordpress/i18n": "^5.10.0",
40
+ "@wordpress/icons": "^10.10.0",
41
+ "@wordpress/interface": "^7.0.0",
42
+ "@wordpress/is-shallow-equal": "^5.10.0",
43
+ "@wordpress/keyboard-shortcuts": "^5.10.0",
44
+ "@wordpress/keycodes": "^4.10.0",
45
+ "@wordpress/media-utils": "^5.10.0",
46
+ "@wordpress/preferences": "^4.10.0",
47
+ "@wordpress/private-apis": "^1.10.0",
48
+ "@wordpress/widgets": "^4.10.0",
48
49
  "clsx": "^2.1.1",
49
50
  "fast-deep-equal": "^3.1.3"
50
51
  },
@@ -55,5 +56,5 @@
55
56
  "publishConfig": {
56
57
  "access": "public"
57
58
  },
58
- "gitHead": "b7af02f8431034ee19cdc33dd105d21705823eed"
59
+ "gitHead": "ab34a7ac935fd1478eac63b596242d83270897ee"
59
60
  }
@@ -11,12 +11,7 @@ import { doAction } from '@wordpress/hooks';
11
11
  function CopyButton( { text, children } ) {
12
12
  const ref = useCopyToClipboard( text );
13
13
  return (
14
- <Button
15
- // TODO: Switch to `true` (40px size) if possible
16
- __next40pxDefaultSize={ false }
17
- variant="secondary"
18
- ref={ ref }
19
- >
14
+ <Button size="compact" variant="secondary" ref={ ref }>
20
15
  { children }
21
16
  </Button>
22
17
  );
@@ -37,9 +37,7 @@ function Inserter( { setIsOpened } ) {
37
37
  { __( 'Add a block' ) }
38
38
  </h2>
39
39
  <Button
40
- // TODO: Switch to `true` (40px size) if possible
41
- __next40pxDefaultSize={ false }
42
- className="customize-widgets-layout__inserter-panel-header-close-button"
40
+ size="small"
43
41
  icon={ closeSmall }
44
42
  onClick={ () => setIsOpened( false ) }
45
43
  aria-label={ __( 'Close inserter' ) }
@@ -43,9 +43,7 @@ export default function WelcomeGuide( { sidebar } ) {
43
43
  ) }
44
44
  </p>
45
45
  <Button
46
- // TODO: Switch to `true` (40px size) if possible
47
- __next40pxDefaultSize={ false }
48
- className="customize-widgets-welcome-guide__button"
46
+ size="compact"
49
47
  variant="primary"
50
48
  onClick={ () =>
51
49
  toggle( 'core/customize-widgets', 'welcomeGuide' )
package/src/index.js CHANGED
@@ -17,6 +17,7 @@ import {
17
17
  store as blocksStore,
18
18
  } from '@wordpress/blocks';
19
19
  import { dispatch } from '@wordpress/data';
20
+ import { privateApis as editorPrivateApis } from '@wordpress/editor';
20
21
  import { store as preferencesStore } from '@wordpress/preferences';
21
22
 
22
23
  /**
@@ -26,6 +27,7 @@ import CustomizeWidgets from './components/customize-widgets';
26
27
  import getSidebarSection from './controls/sidebar-section';
27
28
  import getSidebarControl from './controls/sidebar-control';
28
29
  import './filters';
30
+ import { unlock } from './lock-unlock';
29
31
 
30
32
  const { wp } = window;
31
33
 
@@ -37,6 +39,8 @@ const DISABLED_BLOCKS = [
37
39
  ];
38
40
  const ENABLE_EXPERIMENTAL_FSE_BLOCKS = false;
39
41
 
42
+ const { registerCoreBlockBindingsSources } = unlock( editorPrivateApis );
43
+
40
44
  /**
41
45
  * Initializes the widgets block editor in the customizer.
42
46
  *
@@ -60,6 +64,7 @@ export function initialize( editorName, blockEditorSettings ) {
60
64
  );
61
65
  } );
62
66
  registerCoreBlocks( coreBlocks );
67
+ registerCoreBlockBindingsSources();
63
68
  registerLegacyWidgetBlock();
64
69
  if ( globalThis.IS_GUTENBERG_PLUGIN ) {
65
70
  __experimentalRegisterExperimentalCoreBlocks( {