@wordpress/interface 4.0.1-next.5df0cd52b7.0 → 4.1.2

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 (57) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +66 -1
  3. package/build/components/index.js +16 -0
  4. package/build/components/index.js.map +1 -1
  5. package/build/components/interface-skeleton/index.js +7 -6
  6. package/build/components/interface-skeleton/index.js.map +1 -1
  7. package/build/components/more-menu-dropdown/index.js +52 -0
  8. package/build/components/more-menu-dropdown/index.js.map +1 -0
  9. package/build/components/more-menu-feature-toggle/index.js +63 -0
  10. package/build/components/more-menu-feature-toggle/index.js.map +1 -0
  11. package/build/index.js +2 -2
  12. package/build/index.js.map +1 -1
  13. package/build/store/actions.js +57 -0
  14. package/build/store/actions.js.map +1 -1
  15. package/build/store/index.js +4 -2
  16. package/build/store/index.js.map +1 -1
  17. package/build/store/reducer.js +64 -2
  18. package/build/store/reducer.js.map +1 -1
  19. package/build/store/selectors.js +20 -0
  20. package/build/store/selectors.js.map +1 -1
  21. package/build-module/components/index.js +2 -0
  22. package/build-module/components/index.js.map +1 -1
  23. package/build-module/components/interface-skeleton/index.js +7 -7
  24. package/build-module/components/interface-skeleton/index.js.map +1 -1
  25. package/build-module/components/more-menu-dropdown/index.js +39 -0
  26. package/build-module/components/more-menu-dropdown/index.js.map +1 -0
  27. package/build-module/components/more-menu-feature-toggle/index.js +50 -0
  28. package/build-module/components/more-menu-feature-toggle/index.js.map +1 -0
  29. package/build-module/index.js +1 -1
  30. package/build-module/index.js.map +1 -1
  31. package/build-module/store/actions.js +51 -0
  32. package/build-module/store/actions.js.map +1 -1
  33. package/build-module/store/index.js +4 -2
  34. package/build-module/store/index.js.map +1 -1
  35. package/build-module/store/reducer.js +61 -1
  36. package/build-module/store/reducer.js.map +1 -1
  37. package/build-module/store/selectors.js +18 -0
  38. package/build-module/store/selectors.js.map +1 -1
  39. package/build-style/style-rtl.css +47 -2
  40. package/build-style/style.css +47 -2
  41. package/package.json +12 -11
  42. package/src/components/complementary-area/style.scss +10 -2
  43. package/src/components/complementary-area-header/style.scss +8 -0
  44. package/src/components/index.js +2 -0
  45. package/src/components/interface-skeleton/index.js +5 -5
  46. package/src/components/more-menu-dropdown/README.md +78 -0
  47. package/src/components/more-menu-dropdown/index.js +46 -0
  48. package/src/components/more-menu-dropdown/style.scss +35 -0
  49. package/src/components/more-menu-feature-toggle/README.md +59 -0
  50. package/src/components/more-menu-feature-toggle/index.js +53 -0
  51. package/src/index.js +1 -1
  52. package/src/store/actions.js +48 -0
  53. package/src/store/index.js +4 -2
  54. package/src/store/reducer.js +55 -0
  55. package/src/store/selectors.js +20 -0
  56. package/src/store/test/selectors.js +107 -0
  57. package/src/style.scss +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["getSingleEnableItem","state","itemType","scope","enableItems","singleEnableItems","getActiveComplementaryArea","isMultipleEnabledItemEnabled","item","multipleEnableItems","isItemPinned"],"mappings":";;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAT,CAA8BC,KAA9B,EAAqCC,QAArC,EAA+CC,KAA/C,EAAuD;AACtD,SAAO,iBAAKF,KAAK,CAACG,WAAN,CAAkBC,iBAAvB,EAA0C,CAAEH,QAAF,EAAYC,KAAZ,CAA1C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,0BAAT,CAAqCL,KAArC,EAA4CE,KAA5C,EAAoD;AAC1D,SAAOH,mBAAmB,CAAEC,KAAF,EAAS,mBAAT,EAA8BE,KAA9B,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,4BAAT,CAAuCN,KAAvC,EAA8CC,QAA9C,EAAwDC,KAAxD,EAA+DK,IAA/D,EAAsE;AACrE,SAAO,iBAAKP,KAAK,CAACG,WAAN,CAAkBK,mBAAvB,EAA4C,CAClDP,QADkD,EAElDC,KAFkD,EAGlDK,IAHkD,CAA5C,CAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,YAAT,CAAuBT,KAAvB,EAA8BE,KAA9B,EAAqCK,IAArC,EAA4C;AAClD,SACCD,4BAA4B,CAAEN,KAAF,EAAS,aAAT,EAAwBE,KAAxB,EAA+BK,IAA/B,CAA5B,KACA,KAFD;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * Returns the item that is enabled in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n *\n * @return {?string|null} The item that is enabled in the passed scope and type.\n */\nfunction getSingleEnableItem( state, itemType, scope ) {\n\treturn get( state.enableItems.singleEnableItems, [ itemType, scope ] );\n}\n\n/**\n * Returns the complementary area that is active in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Item scope.\n *\n * @return {string} The complementary area that is active in the given scope.\n */\nexport function getActiveComplementaryArea( state, scope ) {\n\treturn getSingleEnableItem( state, 'complementaryArea', scope );\n}\n\n/**\n * Returns a boolean indicating if an item is enabled or not in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} itemType Type of item.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean|undefined} True if the item is enabled, false otherwise if the item is explicitly disabled, and undefined if there is no information for that item.\n */\nfunction isMultipleEnabledItemEnabled( state, itemType, scope, item ) {\n\treturn get( state.enableItems.multipleEnableItems, [\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t] );\n}\n\n/**\n * Returns a boolean indicating if an item is pinned or not.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean} True if the item is pinned and false otherwise.\n */\nexport function isItemPinned( state, scope, item ) {\n\treturn (\n\t\tisMultipleEnabledItemEnabled( state, 'pinnedItems', scope, item ) !==\n\t\tfalse\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["getSingleEnableItem","state","itemType","scope","enableItems","singleEnableItems","getActiveComplementaryArea","isMultipleEnabledItemEnabled","item","multipleEnableItems","isItemPinned","isFeatureActive","featureName","featureValue","preferences","features","defaultedFeatureValue","undefined","preferenceDefaults"],"mappings":";;;;;;;;;AAGA;;AAHA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAT,CAA8BC,KAA9B,EAAqCC,QAArC,EAA+CC,KAA/C,EAAuD;AACtD,SAAO,iBAAKF,KAAK,CAACG,WAAN,CAAkBC,iBAAvB,EAA0C,CAAEH,QAAF,EAAYC,KAAZ,CAA1C,CAAP;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,0BAAT,CAAqCL,KAArC,EAA4CE,KAA5C,EAAoD;AAC1D,SAAOH,mBAAmB,CAAEC,KAAF,EAAS,mBAAT,EAA8BE,KAA9B,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASI,4BAAT,CAAuCN,KAAvC,EAA8CC,QAA9C,EAAwDC,KAAxD,EAA+DK,IAA/D,EAAsE;AACrE,SAAO,iBAAKP,KAAK,CAACG,WAAN,CAAkBK,mBAAvB,EAA4C,CAClDP,QADkD,EAElDC,KAFkD,EAGlDK,IAHkD,CAA5C,CAAP;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASE,YAAT,CAAuBT,KAAvB,EAA8BE,KAA9B,EAAqCK,IAArC,EAA4C;AAClD,SACCD,4BAA4B,CAAEN,KAAF,EAAS,aAAT,EAAwBE,KAAxB,EAA+BK,IAA/B,CAA5B,KACA,KAFD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACO,SAASG,eAAT,CAA0BV,KAA1B,EAAiCE,KAAjC,EAAwCS,WAAxC,EAAsD;AAAA;;AAC5D,QAAMC,YAAY,4BAAGZ,KAAK,CAACa,WAAN,CAAkBC,QAAlB,CAA4BZ,KAA5B,CAAH,0DAAG,sBAAuCS,WAAvC,CAArB;AACA,QAAMI,qBAAqB,GAC1BH,YAAY,KAAKI,SAAjB,GACGJ,YADH,4BAEGZ,KAAK,CAACiB,kBAAN,CAAyBH,QAAzB,CAAmCZ,KAAnC,CAFH,0DAEG,sBAA8CS,WAA9C,CAHJ;AAKA,SAAO,CAAC,CAAEI,qBAAV;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * Returns the item that is enabled in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n *\n * @return {?string|null} The item that is enabled in the passed scope and type.\n */\nfunction getSingleEnableItem( state, itemType, scope ) {\n\treturn get( state.enableItems.singleEnableItems, [ itemType, scope ] );\n}\n\n/**\n * Returns the complementary area that is active in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Item scope.\n *\n * @return {string} The complementary area that is active in the given scope.\n */\nexport function getActiveComplementaryArea( state, scope ) {\n\treturn getSingleEnableItem( state, 'complementaryArea', scope );\n}\n\n/**\n * Returns a boolean indicating if an item is enabled or not in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} itemType Type of item.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean|undefined} True if the item is enabled, false otherwise if the item is explicitly disabled, and undefined if there is no information for that item.\n */\nfunction isMultipleEnabledItemEnabled( state, itemType, scope, item ) {\n\treturn get( state.enableItems.multipleEnableItems, [\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t] );\n}\n\n/**\n * Returns a boolean indicating if an item is pinned or not.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean} True if the item is pinned and false otherwise.\n */\nexport function isItemPinned( state, scope, item ) {\n\treturn (\n\t\tisMultipleEnabledItemEnabled( state, 'pinnedItems', scope, item ) !==\n\t\tfalse\n\t);\n}\n\n/**\n * Returns a boolean indicating whether a feature is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} featureName The name of the feature.\n *\n * @return {boolean} Is the feature enabled?\n */\nexport function isFeatureActive( state, scope, featureName ) {\n\tconst featureValue = state.preferences.features[ scope ]?.[ featureName ];\n\tconst defaultedFeatureValue =\n\t\tfeatureValue !== undefined\n\t\t\t? featureValue\n\t\t\t: state.preferenceDefaults.features[ scope ]?.[ featureName ];\n\n\treturn !! defaultedFeatureValue;\n}\n"]}
@@ -3,5 +3,7 @@ export { default as ComplementaryAreaMoreMenuItem } from './complementary-area-m
3
3
  export { default as FullscreenMode } from './fullscreen-mode';
4
4
  export { default as InterfaceSkeleton } from './interface-skeleton';
5
5
  export { default as PinnedItems } from './pinned-items';
6
+ export { default as MoreMenuDropdown } from './more-menu-dropdown';
7
+ export { default as MoreMenuFeatureToggle } from './more-menu-feature-toggle';
6
8
  export { default as ActionItem } from './action-item';
7
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/index.js"],"names":["default","ComplementaryArea","ComplementaryAreaMoreMenuItem","FullscreenMode","InterfaceSkeleton","PinnedItems","ActionItem"],"mappings":"AAAA,SAASA,OAAO,IAAIC,iBAApB,QAA6C,sBAA7C;AACA,SAASD,OAAO,IAAIE,6BAApB,QAAyD,qCAAzD;AACA,SAASF,OAAO,IAAIG,cAApB,QAA0C,mBAA1C;AACA,SAASH,OAAO,IAAII,iBAApB,QAA6C,sBAA7C;AACA,SAASJ,OAAO,IAAIK,WAApB,QAAuC,gBAAvC;AACA,SAASL,OAAO,IAAIM,UAApB,QAAsC,eAAtC","sourcesContent":["export { default as ComplementaryArea } from './complementary-area';\nexport { default as ComplementaryAreaMoreMenuItem } from './complementary-area-more-menu-item';\nexport { default as FullscreenMode } from './fullscreen-mode';\nexport { default as InterfaceSkeleton } from './interface-skeleton';\nexport { default as PinnedItems } from './pinned-items';\nexport { default as ActionItem } from './action-item';\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/components/index.js"],"names":["default","ComplementaryArea","ComplementaryAreaMoreMenuItem","FullscreenMode","InterfaceSkeleton","PinnedItems","MoreMenuDropdown","MoreMenuFeatureToggle","ActionItem"],"mappings":"AAAA,SAASA,OAAO,IAAIC,iBAApB,QAA6C,sBAA7C;AACA,SAASD,OAAO,IAAIE,6BAApB,QAAyD,qCAAzD;AACA,SAASF,OAAO,IAAIG,cAApB,QAA0C,mBAA1C;AACA,SAASH,OAAO,IAAII,iBAApB,QAA6C,sBAA7C;AACA,SAASJ,OAAO,IAAIK,WAApB,QAAuC,gBAAvC;AACA,SAASL,OAAO,IAAIM,gBAApB,QAA4C,sBAA5C;AACA,SAASN,OAAO,IAAIO,qBAApB,QAAiD,4BAAjD;AACA,SAASP,OAAO,IAAIQ,UAApB,QAAsC,eAAtC","sourcesContent":["export { default as ComplementaryArea } from './complementary-area';\nexport { default as ComplementaryAreaMoreMenuItem } from './complementary-area-more-menu-item';\nexport { default as FullscreenMode } from './fullscreen-mode';\nexport { default as InterfaceSkeleton } from './interface-skeleton';\nexport { default as PinnedItems } from './pinned-items';\nexport { default as MoreMenuDropdown } from './more-menu-dropdown';\nexport { default as MoreMenuFeatureToggle } from './more-menu-feature-toggle';\nexport { default as ActionItem } from './action-item';\n"]}
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import { createElement } from "@wordpress/element";
2
3
 
3
4
  /**
@@ -12,7 +13,7 @@ import classnames from 'classnames';
12
13
  * WordPress dependencies
13
14
  */
14
15
 
15
- import { forwardRef, useEffect, useRef } from '@wordpress/element';
16
+ import { forwardRef, useEffect } from '@wordpress/element';
16
17
  import { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';
17
18
  import { __ } from '@wordpress/i18n';
18
19
  import { useMergeRefs } from '@wordpress/compose';
@@ -45,8 +46,7 @@ function InterfaceSkeleton({
45
46
  className,
46
47
  shortcuts
47
48
  }, ref) {
48
- const fallbackRef = useRef();
49
- const regionsClassName = useNavigateRegions(fallbackRef, shortcuts);
49
+ const navigateRegionsProps = useNavigateRegions(shortcuts);
50
50
  useHTMLClass('interface-interface-skeleton__html-container');
51
51
  const defaultLabels = {
52
52
  /* translators: accessibility text for the nav bar landmark region. */
@@ -73,10 +73,10 @@ function InterfaceSkeleton({
73
73
  const mergedLabels = { ...defaultLabels,
74
74
  ...labels
75
75
  };
76
- return createElement("div", {
77
- ref: useMergeRefs([ref, fallbackRef]),
78
- className: classnames(className, 'interface-interface-skeleton', regionsClassName, !!footer && 'has-footer')
79
- }, !!drawer && createElement("div", {
76
+ return createElement("div", _extends({}, navigateRegionsProps, {
77
+ ref: useMergeRefs([ref, navigateRegionsProps.ref]),
78
+ className: classnames(className, 'interface-interface-skeleton', navigateRegionsProps.className, !!footer && 'has-footer')
79
+ }), !!drawer && createElement("div", {
80
80
  className: "interface-interface-skeleton__drawer",
81
81
  role: "region",
82
82
  "aria-label": mergedLabels.drawer
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["classnames","forwardRef","useEffect","useRef","__unstableUseNavigateRegions","useNavigateRegions","__","useMergeRefs","useHTMLClass","className","element","document","querySelector","classList","toggle","InterfaceSkeleton","footer","header","sidebar","secondarySidebar","notices","content","drawer","actions","labels","shortcuts","ref","fallbackRef","regionsClassName","defaultLabels","body","mergedLabels"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,SAArB,EAAgCC,MAAhC,QAA8C,oBAA9C;AACA,SAASC,4BAA4B,IAAIC,kBAAzC,QAAmE,uBAAnE;AACA,SAASC,E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,uCADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAaa,YAAY,CAACb,OAH3B;AAIC,IAAA,QAAQ,EAAC;AAJV,KAMGA,OANH,CAzBF,EAkCG,CAAC,CAAEK,OAAH,IACD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAaQ,YAAY,CAACR,OAH3B;AAIC,IAAA,QAAQ,EAAC;AAJV,KAMGA,OANH,CAnCF,CAXD,CAlBD,EA2EG,CAAC,CAAEP,MAAH,IACD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAae,YAAY,CAACf,MAH3B;AAIC,IAAA,QAAQ,EAAC;AAJV,KAMGA,MANH,CA5EF,CADD;AAwFA;;AAED,eAAef,UAAU,CAAEc,iBAAF,CAAzB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect, useRef } from '@wordpress/element';\nimport { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs } from '@wordpress/compose';\n\nfunction useHTMLClass( className ) {\n\tuseEffect( () => {\n\t\tconst element =\n\t\t\tdocument && document.querySelector( `html:not(.${ className })` );\n\t\tif ( ! element ) {\n\t\t\treturn;\n\t\t}\n\t\telement.classList.toggle( className );\n\t\treturn () => {\n\t\t\telement.classList.toggle( className );\n\t\t};\n\t}, [ className ] );\n}\n\nfunction InterfaceSkeleton(\n\t{\n\t\tfooter,\n\t\theader,\n\t\tsidebar,\n\t\tsecondarySidebar,\n\t\tnotices,\n\t\tcontent,\n\t\tdrawer,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t\tshortcuts,\n\t},\n\tref\n) {\n\tconst fallbackRef = useRef();\n\tconst regionsClassName = useNavigateRegions( fallbackRef, shortcuts );\n\n\tuseHTMLClass( 'interface-interface-skeleton__html-container' );\n\n\tconst defaultLabels = {\n\t\t/* translators: accessibility text for the nav bar landmark region. */\n\t\tdrawer: __( 'Drawer' ),\n\t\t/* translators: accessibility text for the top bar landmark region. */\n\t\theader: __( 'Header' ),\n\t\t/* translators: accessibility text for the content landmark region. */\n\t\tbody: __( 'Content' ),\n\t\t/* translators: accessibility text for the secondary sidebar landmark region. */\n\t\tsecondarySidebar: __( 'Block Library' ),\n\t\t/* translators: accessibility text for the settings landmark region. */\n\t\tsidebar: __( 'Settings' ),\n\t\t/* translators: accessibility text for the publish landmark region. */\n\t\tactions: __( 'Publish' ),\n\t\t/* translators: accessibility text for the footer landmark region. */\n\t\tfooter: __( 'Footer' ),\n\t};\n\n\tconst mergedLabels = { ...defaultLabels, ...labels };\n\n\treturn (\n\t\t<div\n\t\t\tref={ useMergeRefs( [ ref, fallbackRef ] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\tclassName,\n\t\t\t\t'interface-interface-skeleton',\n\t\t\t\tregionsClassName,\n\t\t\t\t!! footer && 'has-footer'\n\t\t\t) }\n\t\t>\n\t\t\t{ !! drawer && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"interface-interface-skeleton__drawer\"\n\t\t\t\t\trole=\"region\"\n\t\t\t\t\taria-label={ mergedLabels.drawer }\n\t\t\t\t>\n\t\t\t\t\t{ drawer }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"interface-interface-skeleton__editor\">\n\t\t\t\t{ !! header && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"interface-interface-skeleton__body\">\n\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! notices && (\n\t\t\t\t\t\t<div className=\"interface-interface-skeleton__notices\">\n\t\t\t\t\t\t\t{ notices }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__content\"\n\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\taria-label={ mergedLabels.body }\n\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ !! sidebar && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__sidebar\"\n\t\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.sidebar }\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sidebar }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! actions && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__actions\"\n\t\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.actions }\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ !! footer && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"interface-interface-skeleton__footer\"\n\t\t\t\t\trole=\"region\"\n\t\t\t\t\taria-label={ mergedLabels.footer }\n\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t>\n\t\t\t\t\t{ footer }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( InterfaceSkeleton );\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/components/interface-skeleton/index.js"],"names":["classnames","forwardRef","useEffect","__unstableUseNavigateRegions","useNavigateRegions","__","useMergeRefs","useHTMLClass","className","element","document","querySelector","classList","toggle","InterfaceSkeleton","footer","header","sidebar","secondarySidebar","notices","content","drawer","actions","labels","shortcuts","ref","navigateRegionsProps","defaultLabels","body","mergedLabels"],"mappings":";;;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA;AACA;AACA;;AACA,SAASC,UAAT,EAAqBC,SAArB,QAAsC,oBAAtC;AACA,SAASC,4BAA4B,IAAIC,kBAAzC,QAAmE,uBAAnE;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,oBAA7B;;AAEA,SAASC,YAAT,CAAuBC,SAAvB,EAAmC;AAClCN,EAAAA,SAAS,CAAE,MAAM;AAChB,UAAMO,OAAO,GACZC,QAAQ,IAAIA,QAAQ,CAACC,aAAT,CAAyB,aAAaH,SAAW,GAAjD,CADb;;AAEA,QAAK,CAAEC,OAAP,EAAiB;AAChB;AACA;;AACDA,IAAAA,OAAO,CAACG,SAAR,CAAkBC,MAAlB,CAA0BL,SAA1B;AACA,WAAO,MAAM;AACZC,MAAAA,OAAO,CAACG,SAAR,CAAkBC,MAAlB,CAA0BL,SAA1B;AACA,KAFD;AAGA,GAVQ,EAUN,CAAEA,SAAF,CAVM,CAAT;AAWA;;AAED,SAASM,iBAAT,CACC;AACCC,EAAAA,MADD;AAECC,EAAAA,MAFD;AAGCC,EAAAA,OAHD;AAICC,EAAAA,gBAJD;AAKCC,EAAAA,OALD;AAMCC,EAAAA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,SAAS,EAAC,sCADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAaa,YAAY,CAACb,MAH3B;AAIC,IAAA,QAAQ,EAAC;AAJV,KAMGA,MANH,CAFF,EAWC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG,CAAC,CAAEE,gBAAH,IACD;AACC,IAAA,SAAS,EAAC,iDADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAaW,YAAY,CAACX,gBAH3B;AAIC,IAAA,QAAQ,EAAC;AAJV,KAMGA,gBANH,CAFF,EAWG,CAAC,CAAEC,OAAH,IACD;AAAK,IAAA,SAAS,EAAC;AAAf,KACGA,OADH,CAZF,EAgBC;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAaU,YAAY,CAACD,IAH3B;AAIC,IAAA,QAAQ,EAAC;AAJV,KAMGR,OANH,CAhBD,EAwBG,CAAC,CAAEH,OAAH,IACD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAaY,YAAY,CAACZ,OAH3B;AAIC,IAAA,QAAQ,EAAC;AAJV,KAMGA,OANH,CAzBF,EAkCG,CAAC,CAAEK,OAAH,IACD;AACC,IAAA,SAAS,EAAC,uCADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAaO,YAAY,CAACP,OAH3B;AAIC,IAAA,QAAQ,EAAC;AAJV,KAMGA,OANH,CAnCF,CAXD,CAnBD,EA4EG,CAAC,CAAEP,MAAH,IACD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,IAAI,EAAC,QAFN;AAGC,kBAAac,YAAY,CAACd,MAH3B;AAIC,IAAA,QAAQ,EAAC;AAJV,KAMGA,MANH,CA7EF,CADD;AAyFA;;AAED,eAAed,UAAU,CAAEa,iBAAF,CAAzB","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\n/**\n * WordPress dependencies\n */\nimport { forwardRef, useEffect } from '@wordpress/element';\nimport { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useMergeRefs } from '@wordpress/compose';\n\nfunction useHTMLClass( className ) {\n\tuseEffect( () => {\n\t\tconst element =\n\t\t\tdocument && document.querySelector( `html:not(.${ className })` );\n\t\tif ( ! element ) {\n\t\t\treturn;\n\t\t}\n\t\telement.classList.toggle( className );\n\t\treturn () => {\n\t\t\telement.classList.toggle( className );\n\t\t};\n\t}, [ className ] );\n}\n\nfunction InterfaceSkeleton(\n\t{\n\t\tfooter,\n\t\theader,\n\t\tsidebar,\n\t\tsecondarySidebar,\n\t\tnotices,\n\t\tcontent,\n\t\tdrawer,\n\t\tactions,\n\t\tlabels,\n\t\tclassName,\n\t\tshortcuts,\n\t},\n\tref\n) {\n\tconst navigateRegionsProps = useNavigateRegions( shortcuts );\n\n\tuseHTMLClass( 'interface-interface-skeleton__html-container' );\n\n\tconst defaultLabels = {\n\t\t/* translators: accessibility text for the nav bar landmark region. */\n\t\tdrawer: __( 'Drawer' ),\n\t\t/* translators: accessibility text for the top bar landmark region. */\n\t\theader: __( 'Header' ),\n\t\t/* translators: accessibility text for the content landmark region. */\n\t\tbody: __( 'Content' ),\n\t\t/* translators: accessibility text for the secondary sidebar landmark region. */\n\t\tsecondarySidebar: __( 'Block Library' ),\n\t\t/* translators: accessibility text for the settings landmark region. */\n\t\tsidebar: __( 'Settings' ),\n\t\t/* translators: accessibility text for the publish landmark region. */\n\t\tactions: __( 'Publish' ),\n\t\t/* translators: accessibility text for the footer landmark region. */\n\t\tfooter: __( 'Footer' ),\n\t};\n\n\tconst mergedLabels = { ...defaultLabels, ...labels };\n\n\treturn (\n\t\t<div\n\t\t\t{ ...navigateRegionsProps }\n\t\t\tref={ useMergeRefs( [ ref, navigateRegionsProps.ref ] ) }\n\t\t\tclassName={ classnames(\n\t\t\t\tclassName,\n\t\t\t\t'interface-interface-skeleton',\n\t\t\t\tnavigateRegionsProps.className,\n\t\t\t\t!! footer && 'has-footer'\n\t\t\t) }\n\t\t>\n\t\t\t{ !! drawer && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"interface-interface-skeleton__drawer\"\n\t\t\t\t\trole=\"region\"\n\t\t\t\t\taria-label={ mergedLabels.drawer }\n\t\t\t\t>\n\t\t\t\t\t{ drawer }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<div className=\"interface-interface-skeleton__editor\">\n\t\t\t\t{ !! header && (\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__header\"\n\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\taria-label={ mergedLabels.header }\n\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ header }\n\t\t\t\t\t</div>\n\t\t\t\t) }\n\t\t\t\t<div className=\"interface-interface-skeleton__body\">\n\t\t\t\t\t{ !! secondarySidebar && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__secondary-sidebar\"\n\t\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.secondarySidebar }\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ secondarySidebar }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! notices && (\n\t\t\t\t\t\t<div className=\"interface-interface-skeleton__notices\">\n\t\t\t\t\t\t\t{ notices }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName=\"interface-interface-skeleton__content\"\n\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\taria-label={ mergedLabels.body }\n\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ content }\n\t\t\t\t\t</div>\n\t\t\t\t\t{ !! sidebar && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__sidebar\"\n\t\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.sidebar }\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ sidebar }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t\t{ !! actions && (\n\t\t\t\t\t\t<div\n\t\t\t\t\t\t\tclassName=\"interface-interface-skeleton__actions\"\n\t\t\t\t\t\t\trole=\"region\"\n\t\t\t\t\t\t\taria-label={ mergedLabels.actions }\n\t\t\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ actions }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t{ !! footer && (\n\t\t\t\t<div\n\t\t\t\t\tclassName=\"interface-interface-skeleton__footer\"\n\t\t\t\t\trole=\"region\"\n\t\t\t\t\taria-label={ mergedLabels.footer }\n\t\t\t\t\ttabIndex=\"-1\"\n\t\t\t\t>\n\t\t\t\t\t{ footer }\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</div>\n\t);\n}\n\nexport default forwardRef( InterfaceSkeleton );\n"]}
@@ -0,0 +1,39 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * External dependencies
5
+ */
6
+ import classnames from 'classnames';
7
+ /**
8
+ * WordPress dependencies
9
+ */
10
+
11
+ import { DropdownMenu } from '@wordpress/components';
12
+ import { __ } from '@wordpress/i18n';
13
+ import { moreVertical } from '@wordpress/icons';
14
+ export default function MoreMenuDropdown({
15
+ as: DropdownComponent = DropdownMenu,
16
+ className,
17
+
18
+ /* translators: button label text should, if possible, be under 16 characters. */
19
+ label = __('Options'),
20
+ popoverProps,
21
+ toggleProps,
22
+ children
23
+ }) {
24
+ return createElement(DropdownComponent, {
25
+ className: classnames('interface-more-menu-dropdown', className),
26
+ icon: moreVertical,
27
+ label: label,
28
+ popoverProps: {
29
+ position: 'bottom left',
30
+ ...popoverProps,
31
+ className: classnames('interface-more-menu-dropdown__content', popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.className)
32
+ },
33
+ toggleProps: {
34
+ tooltipPosition: 'bottom',
35
+ ...toggleProps
36
+ }
37
+ }, onClose => children(onClose));
38
+ }
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/interface/src/components/more-menu-dropdown/index.js"],"names":["classnames","DropdownMenu","__","moreVertical","MoreMenuDropdown","as","DropdownComponent","className","label","popoverProps","toggleProps","children","position","tooltipPosition","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,YAAT,QAA6B,uBAA7B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AAEA,eAAe,SAASC,gBAAT,CAA2B;AACzCC,EAAAA,EAAE,EAAEC,iBAAiB,GAAGL,YADiB;AAEzCM,EAAAA,SAFyC;;AAGzC;AACAC,EAAAA,KAAK,GAAGN,EAAE,CAAE,SAAF,CAJ+B;AAKzCO,EAAAA,YALyC;AAMzCC,EAAAA,WANyC;AAOzCC,EAAAA;AAPyC,CAA3B,EAQX;AACH,SACC,cAAC,iBAAD;AACC,IAAA,SAAS,EAAGX,UAAU,CACrB,8BADqB,EAErBO,SAFqB,CADvB;AAKC,IAAA,IAAI,EAAGJ,YALR;AAMC,IAAA,KAAK,EAAGK,KANT;AAOC,IAAA,YAAY,EAAG;AACdI,MAAAA,QAAQ,EAAE,aADI;AAEd,SAAGH,YAFW;AAGdF,MAAAA,SAAS,EAAEP,UAAU,CACpB,uCADoB,EAEpBS,YAFoB,aAEpBA,YAFoB,uBAEpBA,YAAY,CAAEF,SAFM;AAHP,KAPhB;AAeC,IAAA,WAAW,EAAG;AACbM,MAAAA,eAAe,EAAE,QADJ;AAEb,SAAGH;AAFU;AAff,KAoBKI,OAAF,IAAeH,QAAQ,CAAEG,OAAF,CApB1B,CADD;AAwBA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { DropdownMenu } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\n\nexport default function MoreMenuDropdown( {\n\tas: DropdownComponent = DropdownMenu,\n\tclassName,\n\t/* translators: button label text should, if possible, be under 16 characters. */\n\tlabel = __( 'Options' ),\n\tpopoverProps,\n\ttoggleProps,\n\tchildren,\n} ) {\n\treturn (\n\t\t<DropdownComponent\n\t\t\tclassName={ classnames(\n\t\t\t\t'interface-more-menu-dropdown',\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ label }\n\t\t\tpopoverProps={ {\n\t\t\t\tposition: 'bottom left',\n\t\t\t\t...popoverProps,\n\t\t\t\tclassName: classnames(\n\t\t\t\t\t'interface-more-menu-dropdown__content',\n\t\t\t\t\tpopoverProps?.className\n\t\t\t\t),\n\t\t\t} }\n\t\t\ttoggleProps={ {\n\t\t\t\ttooltipPosition: 'bottom',\n\t\t\t\t...toggleProps,\n\t\t\t} }\n\t\t>\n\t\t\t{ ( onClose ) => children( onClose ) }\n\t\t</DropdownComponent>\n\t);\n}\n"]}
@@ -0,0 +1,50 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { useSelect, useDispatch } from '@wordpress/data';
7
+ import { MenuItem } from '@wordpress/components';
8
+ import { __ } from '@wordpress/i18n';
9
+ import { check } from '@wordpress/icons';
10
+ import { speak } from '@wordpress/a11y';
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ import { store as interfaceStore } from '../../store';
16
+ export default function MoreMenuFeatureToggle({
17
+ scope,
18
+ label,
19
+ info,
20
+ messageActivated,
21
+ messageDeactivated,
22
+ shortcut,
23
+ feature
24
+ }) {
25
+ const isActive = useSelect(select => select(interfaceStore).isFeatureActive(scope, feature), [feature]);
26
+ const {
27
+ toggleFeature
28
+ } = useDispatch(interfaceStore);
29
+
30
+ const speakMessage = () => {
31
+ if (isActive) {
32
+ speak(messageDeactivated || __('Feature deactivated'));
33
+ } else {
34
+ speak(messageActivated || __('Feature activated'));
35
+ }
36
+ };
37
+
38
+ return createElement(MenuItem, {
39
+ icon: isActive && check,
40
+ isSelected: isActive,
41
+ onClick: () => {
42
+ toggleFeature(scope, feature);
43
+ speakMessage();
44
+ },
45
+ role: "menuitemcheckbox",
46
+ info: info,
47
+ shortcut: shortcut
48
+ }, label);
49
+ }
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/interface/src/components/more-menu-feature-toggle/index.js"],"names":["useSelect","useDispatch","MenuItem","__","check","speak","store","interfaceStore","MoreMenuFeatureToggle","scope","label","info","messageActivated","messageDeactivated","shortcut","feature","isActive","select","isFeatureActive","toggleFeature","speakMessage"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAT,QAAsB,kBAAtB;AACA,SAASC,KAAT,QAAsB,iBAAtB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,cAAlB,QAAwC,aAAxC;AAEA,eAAe,SAASC,qBAAT,CAAgC;AAC9CC,EAAAA,KAD8C;AAE9CC,EAAAA,KAF8C;AAG9CC,EAAAA,IAH8C;AAI9CC,EAAAA,gBAJ8C;AAK9CC,EAAAA,kBAL8C;AAM9CC,EAAAA,QAN8C;AAO9CC,EAAAA;AAP8C,CAAhC,EAQX;AACH,QAAMC,QAAQ,GAAGhB,SAAS,CACvBiB,MAAF,IACCA,MAAM,CAAEV,cAAF,CAAN,CAAyBW,eAAzB,CAA0CT,KAA1C,EAAiDM,OAAjD,CAFwB,EAGzB,CAAEA,OAAF,CAHyB,CAA1B;AAKA,QAAM;AAAEI,IAAAA;AAAF,MAAoBlB,WAAW,CAAEM,cAAF,CAArC;;AACA,QAAMa,YAAY,GAAG,MAAM;AAC1B,QAAKJ,QAAL,EAAgB;AACfX,MAAAA,KAAK,CAAEQ,kBAAkB,IAAIV,EAAE,CAAE,qBAAF,CAA1B,CAAL;AACA,KAFD,MAEO;AACNE,MAAAA,KAAK,CAAEO,gBAAgB,IAAIT,EAAE,CAAE,mBAAF,CAAxB,CAAL;AACA;AACD,GAND;;AAQA,SACC,cAAC,QAAD;AACC,IAAA,IAAI,EAAGa,QAAQ,IAAIZ,KADpB;AAEC,IAAA,UAAU,EAAGY,QAFd;AAGC,IAAA,OAAO,EAAG,MAAM;AACfG,MAAAA,aAAa,CAAEV,KAAF,EAASM,OAAT,CAAb;AACAK,MAAAA,YAAY;AACZ,KANF;AAOC,IAAA,IAAI,EAAC,kBAPN;AAQC,IAAA,IAAI,EAAGT,IARR;AASC,IAAA,QAAQ,EAAGG;AATZ,KAWGJ,KAXH,CADD;AAeA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { check } from '@wordpress/icons';\nimport { speak } from '@wordpress/a11y';\n\n/**\n * Internal dependencies\n */\nimport { store as interfaceStore } from '../../store';\n\nexport default function MoreMenuFeatureToggle( {\n\tscope,\n\tlabel,\n\tinfo,\n\tmessageActivated,\n\tmessageDeactivated,\n\tshortcut,\n\tfeature,\n} ) {\n\tconst isActive = useSelect(\n\t\t( select ) =>\n\t\t\tselect( interfaceStore ).isFeatureActive( scope, feature ),\n\t\t[ feature ]\n\t);\n\tconst { toggleFeature } = useDispatch( interfaceStore );\n\tconst speakMessage = () => {\n\t\tif ( isActive ) {\n\t\t\tspeak( messageDeactivated || __( 'Feature deactivated' ) );\n\t\t} else {\n\t\t\tspeak( messageActivated || __( 'Feature activated' ) );\n\t\t}\n\t};\n\n\treturn (\n\t\t<MenuItem\n\t\t\ticon={ isActive && check }\n\t\t\tisSelected={ isActive }\n\t\t\tonClick={ () => {\n\t\t\t\ttoggleFeature( scope, feature );\n\t\t\t\tspeakMessage();\n\t\t\t} }\n\t\t\trole=\"menuitemcheckbox\"\n\t\t\tinfo={ info }\n\t\t\tshortcut={ shortcut }\n\t\t>\n\t\t\t{ label }\n\t\t</MenuItem>\n\t);\n}\n"]}
@@ -1,3 +1,3 @@
1
- export { store } from './store';
2
1
  export * from './components';
2
+ export { store } from './store';
3
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/index.js"],"names":["store"],"mappings":"AAAA,SAASA,KAAT,QAAsB,SAAtB;AACA,cAAc,cAAd","sourcesContent":["export { store } from './store';\nexport * from './components';\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/index.js"],"names":["store"],"mappings":"AAAA,cAAc,cAAd;AACA,SAASA,KAAT,QAAsB,SAAtB","sourcesContent":["export * from './components';\nexport { store } from './store';\n"]}
@@ -84,4 +84,55 @@ export function pinItem(scope, itemId) {
84
84
  export function unpinItem(scope, itemId) {
85
85
  return setMultipleEnableItem('pinnedItems', scope, itemId, false);
86
86
  }
87
+ /**
88
+ * Returns an action object used in signalling that a feature should be toggled.
89
+ *
90
+ * @param {string} scope The feature scope (e.g. core/edit-post).
91
+ * @param {string} featureName The feature name.
92
+ */
93
+
94
+ export function toggleFeature(scope, featureName) {
95
+ return function ({
96
+ select,
97
+ dispatch
98
+ }) {
99
+ const currentValue = select.isFeatureActive(scope, featureName);
100
+ dispatch.setFeatureValue(scope, featureName, !currentValue);
101
+ };
102
+ }
103
+ /**
104
+ * Returns an action object used in signalling that a feature should be set to
105
+ * a true or false value
106
+ *
107
+ * @param {string} scope The feature scope (e.g. core/edit-post).
108
+ * @param {string} featureName The feature name.
109
+ * @param {boolean} value The value to set.
110
+ *
111
+ * @return {Object} Action object.
112
+ */
113
+
114
+ export function setFeatureValue(scope, featureName, value) {
115
+ return {
116
+ type: 'SET_FEATURE_VALUE',
117
+ scope,
118
+ featureName,
119
+ value: !!value
120
+ };
121
+ }
122
+ /**
123
+ * Returns an action object used in signalling that defaults should be set for features.
124
+ *
125
+ * @param {string} scope The feature scope (e.g. core/edit-post).
126
+ * @param {Object<string, boolean>} defaults A key/value map of feature names to values.
127
+ *
128
+ * @return {Object} Action object.
129
+ */
130
+
131
+ export function setFeatureDefaults(scope, defaults) {
132
+ return {
133
+ type: 'SET_FEATURE_DEFAULTS',
134
+ scope,
135
+ defaults
136
+ };
137
+ }
87
138
  //# sourceMappingURL=actions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["setSingleEnableItem","itemType","scope","item","type","enableComplementaryArea","area","disableComplementaryArea","undefined","setMultipleEnableItem","isEnable","pinItem","itemId","unpinItem"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAT,CAA8BC,QAA9B,EAAwCC,KAAxC,EAA+CC,IAA/C,EAAsD;AACrD,SAAO;AACNC,IAAAA,IAAI,EAAE,wBADA;AAENH,IAAAA,QAFM;AAGNC,IAAAA,KAHM;AAINC,IAAAA;AAJM,GAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASE,uBAAT,CAAkCH,KAAlC,EAAyCI,IAAzC,EAAgD;AACtD,SAAON,mBAAmB,CAAE,mBAAF,EAAuBE,KAAvB,EAA8BI,IAA9B,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,wBAAT,CAAmCL,KAAnC,EAA2C;AACjD,SAAOF,mBAAmB,CAAE,mBAAF,EAAuBE,KAAvB,EAA8BM,SAA9B,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,qBAAT,CAAgCR,QAAhC,EAA0CC,KAA1C,EAAiDC,IAAjD,EAAuDO,QAAvD,EAAkE;AACjE,SAAO;AACNN,IAAAA,IAAI,EAAE,0BADA;AAENH,IAAAA,QAFM;AAGNC,IAAAA,KAHM;AAINC,IAAAA,IAJM;AAKNO,IAAAA;AALM,GAAP;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASC,OAAT,CAAkBT,KAAlB,EAAyBU,MAAzB,EAAkC;AACxC,SAAOH,qBAAqB,CAAE,aAAF,EAAiBP,KAAjB,EAAwBU,MAAxB,EAAgC,IAAhC,CAA5B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,SAAT,CAAoBX,KAApB,EAA2BU,MAA3B,EAAoC;AAC1C,SAAOH,qBAAqB,CAAE,aAAF,EAAiBP,KAAjB,EAAwBU,MAAxB,EAAgC,KAAhC,CAA5B;AACA","sourcesContent":["/**\n * Returns an action object used in signalling that an active area should be changed.\n *\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n *\n * @return {Object} Action object.\n */\nfunction setSingleEnableItem( itemType, scope, item ) {\n\treturn {\n\t\ttype: 'SET_SINGLE_ENABLE_ITEM',\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a complementary item should be enabled.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n *\n * @return {Object} Action object.\n */\nexport function enableComplementaryArea( scope, area ) {\n\treturn setSingleEnableItem( 'complementaryArea', scope, area );\n}\n\n/**\n * Returns an action object used in signalling that the complementary area of a given scope should be disabled.\n *\n * @param {string} scope Complementary area scope.\n *\n * @return {Object} Action object.\n */\nexport function disableComplementaryArea( scope ) {\n\treturn setSingleEnableItem( 'complementaryArea', scope, undefined );\n}\n\n/**\n * Returns an action object to make an area enabled/disabled.\n *\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n * @param {boolean} isEnable Boolean indicating if an area should be pinned or not.\n *\n * @return {Object} Action object.\n */\nfunction setMultipleEnableItem( itemType, scope, item, isEnable ) {\n\treturn {\n\t\ttype: 'SET_MULTIPLE_ENABLE_ITEM',\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t\tisEnable,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that an item should be pinned.\n *\n * @param {string} scope Item scope.\n * @param {string} itemId Item identifier.\n *\n * @return {Object} Action object.\n */\nexport function pinItem( scope, itemId ) {\n\treturn setMultipleEnableItem( 'pinnedItems', scope, itemId, true );\n}\n\n/**\n * Returns an action object used in signalling that an item should be unpinned.\n *\n * @param {string} scope Item scope.\n * @param {string} itemId Item identifier.\n *\n * @return {Object} Action object.\n */\nexport function unpinItem( scope, itemId ) {\n\treturn setMultipleEnableItem( 'pinnedItems', scope, itemId, false );\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/actions.js"],"names":["setSingleEnableItem","itemType","scope","item","type","enableComplementaryArea","area","disableComplementaryArea","undefined","setMultipleEnableItem","isEnable","pinItem","itemId","unpinItem","toggleFeature","featureName","select","dispatch","currentValue","isFeatureActive","setFeatureValue","value","setFeatureDefaults","defaults"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAT,CAA8BC,QAA9B,EAAwCC,KAAxC,EAA+CC,IAA/C,EAAsD;AACrD,SAAO;AACNC,IAAAA,IAAI,EAAE,wBADA;AAENH,IAAAA,QAFM;AAGNC,IAAAA,KAHM;AAINC,IAAAA;AAJM,GAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASE,uBAAT,CAAkCH,KAAlC,EAAyCI,IAAzC,EAAgD;AACtD,SAAON,mBAAmB,CAAE,mBAAF,EAAuBE,KAAvB,EAA8BI,IAA9B,CAA1B;A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O,SAASE,eAAT,CAA0BlB,KAA1B,EAAiCa,WAAjC,EAA8CM,KAA9C,EAAsD;AAC5D,SAAO;AACNjB,IAAAA,IAAI,EAAE,mBADA;AAENF,IAAAA,KAFM;AAGNa,IAAAA,WAHM;AAINM,IAAAA,KAAK,EAAE,CAAC,CAAEA;AAJJ,GAAP;AAMA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA6BpB,KAA7B,EAAoCqB,QAApC,EAA+C;AACrD,SAAO;AACNnB,IAAAA,IAAI,EAAE,sBADA;AAENF,IAAAA,KAFM;AAGNqB,IAAAA;AAHM,GAAP;AAKA","sourcesContent":["/**\n * Returns an action object used in signalling that an active area should be changed.\n *\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n *\n * @return {Object} Action object.\n */\nfunction setSingleEnableItem( itemType, scope, item ) {\n\treturn {\n\t\ttype: 'SET_SINGLE_ENABLE_ITEM',\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a complementary item should be enabled.\n *\n * @param {string} scope Complementary area scope.\n * @param {string} area Area identifier.\n *\n * @return {Object} Action object.\n */\nexport function enableComplementaryArea( scope, area ) {\n\treturn setSingleEnableItem( 'complementaryArea', scope, area );\n}\n\n/**\n * Returns an action object used in signalling that the complementary area of a given scope should be disabled.\n *\n * @param {string} scope Complementary area scope.\n *\n * @return {Object} Action object.\n */\nexport function disableComplementaryArea( scope ) {\n\treturn setSingleEnableItem( 'complementaryArea', scope, undefined );\n}\n\n/**\n * Returns an action object to make an area enabled/disabled.\n *\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n * @param {string} item Item identifier.\n * @param {boolean} isEnable Boolean indicating if an area should be pinned or not.\n *\n * @return {Object} Action object.\n */\nfunction setMultipleEnableItem( itemType, scope, item, isEnable ) {\n\treturn {\n\t\ttype: 'SET_MULTIPLE_ENABLE_ITEM',\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t\tisEnable,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that an item should be pinned.\n *\n * @param {string} scope Item scope.\n * @param {string} itemId Item identifier.\n *\n * @return {Object} Action object.\n */\nexport function pinItem( scope, itemId ) {\n\treturn setMultipleEnableItem( 'pinnedItems', scope, itemId, true );\n}\n\n/**\n * Returns an action object used in signalling that an item should be unpinned.\n *\n * @param {string} scope Item scope.\n * @param {string} itemId Item identifier.\n *\n * @return {Object} Action object.\n */\nexport function unpinItem( scope, itemId ) {\n\treturn setMultipleEnableItem( 'pinnedItems', scope, itemId, false );\n}\n\n/**\n * Returns an action object used in signalling that a feature should be toggled.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n */\nexport function toggleFeature( scope, featureName ) {\n\treturn function ( { select, dispatch } ) {\n\t\tconst currentValue = select.isFeatureActive( scope, featureName );\n\t\tdispatch.setFeatureValue( scope, featureName, ! currentValue );\n\t};\n}\n\n/**\n * Returns an action object used in signalling that a feature should be set to\n * a true or false value\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {string} featureName The feature name.\n * @param {boolean} value The value to set.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureValue( scope, featureName, value ) {\n\treturn {\n\t\ttype: 'SET_FEATURE_VALUE',\n\t\tscope,\n\t\tfeatureName,\n\t\tvalue: !! value,\n\t};\n}\n\n/**\n * Returns an action object used in signalling that defaults should be set for features.\n *\n * @param {string} scope The feature scope (e.g. core/edit-post).\n * @param {Object<string, boolean>} defaults A key/value map of feature names to values.\n *\n * @return {Object} Action object.\n */\nexport function setFeatureDefaults( scope, defaults ) {\n\treturn {\n\t\ttype: 'SET_FEATURE_DEFAULTS',\n\t\tscope,\n\t\tdefaults,\n\t};\n}\n"]}
@@ -22,7 +22,8 @@ export const store = createReduxStore(STORE_NAME, {
22
22
  reducer,
23
23
  actions,
24
24
  selectors,
25
- persist: ['enableItems']
25
+ persist: ['enableItems', 'preferences'],
26
+ __experimentalUseThunks: true
26
27
  }); // Once we build a more generic persistence plugin that works across types of stores
27
28
  // we'd be able to replace this with a register call.
28
29
 
@@ -30,6 +31,7 @@ registerStore(STORE_NAME, {
30
31
  reducer,
31
32
  actions,
32
33
  selectors,
33
- persist: ['enableItems']
34
+ persist: ['enableItems', 'preferences'],
35
+ __experimentalUseThunks: true
34
36
  });
35
37
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/index.js"],"names":["createReduxStore","registerStore","reducer","actions","selectors","STORE_NAME","store","persist"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,aAA3B,QAAgD,iBAAhD;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,KAAK,GAAGN,gBAAgB,CAAEK,UAAF,EAAc;AAClDH,EAAAA,OADkD;AAElDC,EAAAA,OAFkD;AAGlDC,EAAAA,SAHkD;AAIlDG,EAAAA,OAAO,EAAE,CAAE,aAAF;AAJyC,CAAd,CAA9B,C,CAOP;AACA;;AACAN,aAAa,CAAEI,UAAF,EAAc;AAC1BH,EAAAA,OAD0B;AAE1BC,EAAAA,OAF0B;AAG1BC,EAAAA,SAH0B;AAI1BG,EAAAA,OAAO,EAAE,CAAE,aAAF;AAJiB,CAAd,CAAb","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the interface namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'enableItems' ],\n} );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregisterStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'enableItems' ],\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/index.js"],"names":["createReduxStore","registerStore","reducer","actions","selectors","STORE_NAME","store","persist","__experimentalUseThunks"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,aAA3B,QAAgD,iBAAhD;AAEA;AACA;AACA;;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAO,KAAKC,OAAZ,MAAyB,WAAzB;AACA,OAAO,KAAKC,SAAZ,MAA2B,aAA3B;AACA,SAASC,UAAT,QAA2B,aAA3B;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMC,KAAK,GAAGN,gBAAgB,CAAEK,UAAF,EAAc;AAClDH,EAAAA,OADkD;AAElDC,EAAAA,OAFkD;AAGlDC,EAAAA,SAHkD;AAIlDG,EAAAA,OAAO,EAAE,CAAE,aAAF,EAAiB,aAAjB,CAJyC;AAKlDC,EAAAA,uBAAuB,EAAE;AALyB,CAAd,CAA9B,C,CAQP;AACA;;AACAP,aAAa,CAAEI,UAAF,EAAc;AAC1BH,EAAAA,OAD0B;AAE1BC,EAAAA,OAF0B;AAG1BC,EAAAA,SAH0B;AAI1BG,EAAAA,OAAO,EAAE,CAAE,aAAF,EAAiB,aAAjB,CAJiB;AAK1BC,EAAAA,uBAAuB,EAAE;AALC,CAAd,CAAb","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createReduxStore, registerStore } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport reducer from './reducer';\nimport * as actions from './actions';\nimport * as selectors from './selectors';\nimport { STORE_NAME } from './constants';\n\n/**\n * Store definition for the interface namespace.\n *\n * @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/data/README.md#createReduxStore\n *\n * @type {Object}\n */\nexport const store = createReduxStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'enableItems', 'preferences' ],\n\t__experimentalUseThunks: true,\n} );\n\n// Once we build a more generic persistence plugin that works across types of stores\n// we'd be able to replace this with a register call.\nregisterStore( STORE_NAME, {\n\treducer,\n\tactions,\n\tselectors,\n\tpersist: [ 'enableItems', 'preferences' ],\n\t__experimentalUseThunks: true,\n} );\n"]}
@@ -71,11 +71,71 @@ export function multipleEnableItems(state = {}, {
71
71
  }
72
72
  };
73
73
  }
74
+ /**
75
+ * Reducer returning the defaults for user preferences.
76
+ *
77
+ * This is kept intentionally separate from the preferences
78
+ * themselves so that defaults are not persisted.
79
+ *
80
+ * @param {Object} state Current state.
81
+ * @param {Object} action Dispatched action.
82
+ *
83
+ * @return {Object} Updated state.
84
+ */
85
+
86
+ export const preferenceDefaults = combineReducers({
87
+ features(state = {}, action) {
88
+ if (action.type === 'SET_FEATURE_DEFAULTS') {
89
+ const {
90
+ scope,
91
+ defaults
92
+ } = action;
93
+ return { ...state,
94
+ [scope]: { ...state[scope],
95
+ ...defaults
96
+ }
97
+ };
98
+ }
99
+
100
+ return state;
101
+ }
102
+
103
+ });
104
+ /**
105
+ * Reducer returning the user preferences.
106
+ *
107
+ * @param {Object} state Current state.
108
+ * @param {Object} action Dispatched action.
109
+ *
110
+ * @return {Object} Updated state.
111
+ */
112
+
113
+ export const preferences = combineReducers({
114
+ features(state = {}, action) {
115
+ if (action.type === 'SET_FEATURE_VALUE') {
116
+ const {
117
+ scope,
118
+ featureName,
119
+ value
120
+ } = action;
121
+ return { ...state,
122
+ [scope]: { ...state[scope],
123
+ [featureName]: value
124
+ }
125
+ };
126
+ }
127
+
128
+ return state;
129
+ }
130
+
131
+ });
74
132
  const enableItems = combineReducers({
75
133
  singleEnableItems,
76
134
  multipleEnableItems
77
135
  });
78
136
  export default combineReducers({
79
- enableItems
137
+ enableItems,
138
+ preferenceDefaults,
139
+ preferences
80
140
  });
81
141
  //# sourceMappingURL=reducer.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["get","combineReducers","singleEnableItems","state","type","itemType","scope","item","multipleEnableItems","isEnable","currentTypeState","currentScopeState","enableItems"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CACNC,KAAK,GAAG,EADF,EAEN;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA,KAAlB;AAAyBC,EAAAA;AAAzB,CAFM,EAGL;AACD,MAAKH,IAAI,KAAK,wBAAT,IAAqC,CAAEC,QAAvC,IAAmD,CAAEC,KAA1D,EAAkE;AACjE,WAAOH,KAAP;AACA;;AAED,SAAO,EACN,GAAGA,KADG;AAEN,KAAEE,QAAF,GAAc,EACb,GAAGF,KAAK,CAAEE,QAAF,CADK;AAEb,OAAEC,KAAF,GAAWC,IAAI,IAAI;AAFN;AAFR,GAAP;AAOA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,mBAAT,CACNL,KAAK,GAAG,EADF,EAEN;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA,KAAlB;AAAyBC,EAAAA,IAAzB;AAA+BE,EAAAA;AAA/B,CAFM,EAGL;AACD,MACCL,IAAI,KAAK,0BAAT,IACA,CAAEC,QADF,IAEA,CAAEC,KAFF,IAGA,CAAEC,IAHF,IAIAP,GAAG,CAAEG,KAAF,EAAS,CAAEE,QAAF,EAAYC,KAAZ,EAAmBC,IAAnB,CAAT,CAAH,KAA4CE,QAL7C,EAME;AACD,WAAON,KAAP;AACA;;AACD,QAAMO,gBAAgB,GAAGP,KAAK,CAAEE,QAAF,CAAL,IAAqB,EAA9C;AACA,QAAMM,iBAAiB,GAAGD,gBAAgB,CAAEJ,KAAF,CAAhB,IAA6B,EAAvD;AAEA,SAAO,EACN,GAAGH,KADG;AAEN,KAAEE,QAAF,GAAc,EACb,GAAGK,gBADU;AAEb,OAAEJ,KAAF,GAAW,EACV,GAAGK,iBADO;AAEV,SAAEJ,IAAF,GAAUE,QAAQ,IAAI;AAFZ;AAFE;AAFR,GAAP;AAUA;AAED,MAAMG,WAAW,GAAGX,eAAe,CAAE;AACpCC,EAAAA,iBADoC;AAEpCM,EAAAA;AAFoC,CAAF,CAAnC;AAKA,eAAeP,eAAe,CAAE;AAC/BW,EAAAA;AAD+B,CAAF,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer to keep tract of the active area per scope.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action object.\n * @param {string} action.type Action type.\n * @param {string} action.itemType Type of item.\n * @param {string} action.scope Item scope.\n * @param {string} action.item Item name.\n *\n * @return {Object} Updated state.\n */\nexport function singleEnableItems(\n\tstate = {},\n\t{ type, itemType, scope, item }\n) {\n\tif ( type !== 'SET_SINGLE_ENABLE_ITEM' || ! itemType || ! scope ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t...state,\n\t\t[ itemType ]: {\n\t\t\t...state[ itemType ],\n\t\t\t[ scope ]: item || null,\n\t\t},\n\t};\n}\n\n/**\n * Reducer keeping track of the \"pinned\" items per scope.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action object.\n * @param {string} action.type Action type.\n * @param {string} action.itemType Type of item.\n * @param {string} action.scope Item scope.\n * @param {string} action.item Item name.\n * @param {boolean} action.isEnable Whether the item is pinned.\n *\n * @return {Object} Updated state.\n */\nexport function multipleEnableItems(\n\tstate = {},\n\t{ type, itemType, scope, item, isEnable }\n) {\n\tif (\n\t\ttype !== 'SET_MULTIPLE_ENABLE_ITEM' ||\n\t\t! itemType ||\n\t\t! scope ||\n\t\t! item ||\n\t\tget( state, [ itemType, scope, item ] ) === isEnable\n\t) {\n\t\treturn state;\n\t}\n\tconst currentTypeState = state[ itemType ] || {};\n\tconst currentScopeState = currentTypeState[ scope ] || {};\n\n\treturn {\n\t\t...state,\n\t\t[ itemType ]: {\n\t\t\t...currentTypeState,\n\t\t\t[ scope ]: {\n\t\t\t\t...currentScopeState,\n\t\t\t\t[ item ]: isEnable || false,\n\t\t\t},\n\t\t},\n\t};\n}\n\nconst enableItems = combineReducers( {\n\tsingleEnableItems,\n\tmultipleEnableItems,\n} );\n\nexport default combineReducers( {\n\tenableItems,\n} );\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/reducer.js"],"names":["get","combineReducers","singleEnableItems","state","type","itemType","scope","item","multipleEnableItems","isEnable","currentTypeState","currentScopeState","preferenceDefaults","features","action","defaults","preferences","featureName","value","enableItems"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;;AACA,SAASC,eAAT,QAAgC,iBAAhC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,iBAAT,CACNC,KAAK,GAAG,EADF,EAEN;AAAEC,EAAAA,IAAF;AAAQC,EAAAA,QAAR;AAAkBC,EAAAA,KAAlB;AAAyBC,EAAAA;AAAzB,CAFM,EAGL;AACD,MAAKH,IAAI,KAAK,wBAAT,IAAqC,CAAEC,QAAvC,IAAmD,CAAEC,KAA1D,EAAkE;AACjE,WAAOH,KAAP;AACA;;AAED,SAAO,EACN,GAAGA,KADG;AAEN,KAAEE,QAAF,GAAc,EACb,GAAGF,KAAK,CAAEE,QAAF,CADK;AAEb,OAAEC,KAAF,GAAWC,IAAI,IAAI;AAFN;AA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AP;AACA;;AAdiD,CAAF,CAA1C;AAiBP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,MAAMa,WAAW,GAAGf,eAAe,CAAE;AAC3CY,EAAAA,QAAQ,CAAEV,KAAK,GAAG,EAAV,EAAcW,MAAd,EAAuB;AAC9B,QAAKA,MAAM,CAACV,IAAP,KAAgB,mBAArB,EAA2C;AAC1C,YAAM;AAAEE,QAAAA,KAAF;AAASW,QAAAA,WAAT;AAAsBC,QAAAA;AAAtB,UAAgCJ,MAAtC;AACA,aAAO,EACN,GAAGX,KADG;AAEN,SAAEG,KAAF,GAAW,EACV,GAAGH,KAAK,CAAEG,KAAF,CADE;AAEV,WAAEW,WAAF,GAAiBC;AAFP;AAFL,OAAP;AAOA;;AAED,WAAOf,KAAP;AACA;;AAd0C,CAAF,CAAnC;AAiBP,MAAMgB,WAAW,GAAGlB,eAAe,CAAE;AACpCC,EAAAA,iBADoC;AAEpCM,EAAAA;AAFoC,CAAF,CAAnC;AAKA,eAAeP,eAAe,CAAE;AAC/BkB,EAAAA,WAD+B;AAE/BP,EAAAA,kBAF+B;AAG/BI,EAAAA;AAH+B,CAAF,CAA9B","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { combineReducers } from '@wordpress/data';\n\n/**\n * Reducer to keep tract of the active area per scope.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action object.\n * @param {string} action.type Action type.\n * @param {string} action.itemType Type of item.\n * @param {string} action.scope Item scope.\n * @param {string} action.item Item name.\n *\n * @return {Object} Updated state.\n */\nexport function singleEnableItems(\n\tstate = {},\n\t{ type, itemType, scope, item }\n) {\n\tif ( type !== 'SET_SINGLE_ENABLE_ITEM' || ! itemType || ! scope ) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\t...state,\n\t\t[ itemType ]: {\n\t\t\t...state[ itemType ],\n\t\t\t[ scope ]: item || null,\n\t\t},\n\t};\n}\n\n/**\n * Reducer keeping track of the \"pinned\" items per scope.\n *\n * @param {boolean} state Previous state.\n * @param {Object} action Action object.\n * @param {string} action.type Action type.\n * @param {string} action.itemType Type of item.\n * @param {string} action.scope Item scope.\n * @param {string} action.item Item name.\n * @param {boolean} action.isEnable Whether the item is pinned.\n *\n * @return {Object} Updated state.\n */\nexport function multipleEnableItems(\n\tstate = {},\n\t{ type, itemType, scope, item, isEnable }\n) {\n\tif (\n\t\ttype !== 'SET_MULTIPLE_ENABLE_ITEM' ||\n\t\t! itemType ||\n\t\t! scope ||\n\t\t! item ||\n\t\tget( state, [ itemType, scope, item ] ) === isEnable\n\t) {\n\t\treturn state;\n\t}\n\tconst currentTypeState = state[ itemType ] || {};\n\tconst currentScopeState = currentTypeState[ scope ] || {};\n\n\treturn {\n\t\t...state,\n\t\t[ itemType ]: {\n\t\t\t...currentTypeState,\n\t\t\t[ scope ]: {\n\t\t\t\t...currentScopeState,\n\t\t\t\t[ item ]: isEnable || false,\n\t\t\t},\n\t\t},\n\t};\n}\n\n/**\n * Reducer returning the defaults for user preferences.\n *\n * This is kept intentionally separate from the preferences\n * themselves so that defaults are not persisted.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferenceDefaults = combineReducers( {\n\tfeatures( state = {}, action ) {\n\t\tif ( action.type === 'SET_FEATURE_DEFAULTS' ) {\n\t\t\tconst { scope, defaults } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: {\n\t\t\t\t\t...state[ scope ],\n\t\t\t\t\t...defaults,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\n/**\n * Reducer returning the user preferences.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const preferences = combineReducers( {\n\tfeatures( state = {}, action ) {\n\t\tif ( action.type === 'SET_FEATURE_VALUE' ) {\n\t\t\tconst { scope, featureName, value } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ scope ]: {\n\t\t\t\t\t...state[ scope ],\n\t\t\t\t\t[ featureName ]: value,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\treturn state;\n\t},\n} );\n\nconst enableItems = combineReducers( {\n\tsingleEnableItems,\n\tmultipleEnableItems,\n} );\n\nexport default combineReducers( {\n\tenableItems,\n\tpreferenceDefaults,\n\tpreferences,\n} );\n"]}
@@ -56,4 +56,22 @@ function isMultipleEnabledItemEnabled(state, itemType, scope, item) {
56
56
  export function isItemPinned(state, scope, item) {
57
57
  return isMultipleEnabledItemEnabled(state, 'pinnedItems', scope, item) !== false;
58
58
  }
59
+ /**
60
+ * Returns a boolean indicating whether a feature is active for a particular
61
+ * scope.
62
+ *
63
+ * @param {Object} state The store state.
64
+ * @param {string} scope The scope of the feature (e.g. core/edit-post).
65
+ * @param {string} featureName The name of the feature.
66
+ *
67
+ * @return {boolean} Is the feature enabled?
68
+ */
69
+
70
+ export function isFeatureActive(state, scope, featureName) {
71
+ var _state$preferences$fe, _state$preferenceDefa;
72
+
73
+ const featureValue = (_state$preferences$fe = state.preferences.features[scope]) === null || _state$preferences$fe === void 0 ? void 0 : _state$preferences$fe[featureName];
74
+ const defaultedFeatureValue = featureValue !== undefined ? featureValue : (_state$preferenceDefa = state.preferenceDefaults.features[scope]) === null || _state$preferenceDefa === void 0 ? void 0 : _state$preferenceDefa[featureName];
75
+ return !!defaultedFeatureValue;
76
+ }
59
77
  //# sourceMappingURL=selectors.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["get","getSingleEnableItem","state","itemType","scope","enableItems","singleEnableItems","getActiveComplementaryArea","isMultipleEnabledItemEnabled","item","multipleEnableItems","isItemPinned"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,mBAAT,CAA8BC,KAA9B,EAAqCC,QAArC,EAA+CC,KAA/C,EAAuD;AACtD,SAAOJ,GAAG,CAAEE,KAAK,CAACG,WAAN,CAAkBC,iBAApB,EAAuC,CAAEH,QAAF,EAAYC,KAAZ,CAAvC,CAAV;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASG,0BAAT,CAAqCL,KAArC,EAA4CE,KAA5C,EAAoD;AAC1D,SAAOH,mBAAmB,CAAEC,KAAF,EAAS,mBAAT,EAA8BE,KAA9B,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASI,4BAAT,CAAuCN,KAAvC,EAA8CC,QAA9C,EAAwDC,KAAxD,EAA+DK,IAA/D,EAAsE;AACrE,SAAOT,GAAG,CAAEE,KAAK,CAACG,WAAN,CAAkBK,mBAApB,EAAyC,CAClDP,QADkD,EAElDC,KAFkD,EAGlDK,IAHkD,CAAzC,CAAV;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASE,YAAT,CAAuBT,KAAvB,EAA8BE,KAA9B,EAAqCK,IAArC,EAA4C;AAClD,SACCD,4BAA4B,CAAEN,KAAF,EAAS,aAAT,EAAwBE,KAAxB,EAA+BK,IAA/B,CAA5B,KACA,KAFD;AAIA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * Returns the item that is enabled in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n *\n * @return {?string|null} The item that is enabled in the passed scope and type.\n */\nfunction getSingleEnableItem( state, itemType, scope ) {\n\treturn get( state.enableItems.singleEnableItems, [ itemType, scope ] );\n}\n\n/**\n * Returns the complementary area that is active in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Item scope.\n *\n * @return {string} The complementary area that is active in the given scope.\n */\nexport function getActiveComplementaryArea( state, scope ) {\n\treturn getSingleEnableItem( state, 'complementaryArea', scope );\n}\n\n/**\n * Returns a boolean indicating if an item is enabled or not in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} itemType Type of item.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean|undefined} True if the item is enabled, false otherwise if the item is explicitly disabled, and undefined if there is no information for that item.\n */\nfunction isMultipleEnabledItemEnabled( state, itemType, scope, item ) {\n\treturn get( state.enableItems.multipleEnableItems, [\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t] );\n}\n\n/**\n * Returns a boolean indicating if an item is pinned or not.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean} True if the item is pinned and false otherwise.\n */\nexport function isItemPinned( state, scope, item ) {\n\treturn (\n\t\tisMultipleEnabledItemEnabled( state, 'pinnedItems', scope, item ) !==\n\t\tfalse\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/interface/src/store/selectors.js"],"names":["get","getSingleEnableItem","state","itemType","scope","enableItems","singleEnableItems","getActiveComplementaryArea","isMultipleEnabledItemEnabled","item","multipleEnableItems","isItemPinned","isFeatureActive","featureName","featureValue","preferences","features","defaultedFeatureValue","undefined","preferenceDefaults"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,QAAoB,QAApB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASC,mBAAT,CAA8BC,KAA9B,EAAqCC,QAArC,EAA+CC,KAA/C,EAAuD;AACtD,SAAOJ,GAAG,CAAEE,KAAK,CAACG,WAAN,CAAkBC,iBAApB,EAAuC,CAAEH,QAAF,EAAYC,KAAZ,CAAvC,CAAV;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASG,0BAAT,CAAqCL,KAArC,EAA4CE,KAA5C,EAAoD;AAC1D,SAAOH,mBAAmB,CAAEC,KAAF,EAAS,mBAAT,EAA8BE,KAA9B,CAA1B;AACA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,SAASI,4BAAT,CAAuCN,KAAvC,EAA8CC,QAA9C,EAAwDC,KAAxD,EAA+DK,IAA/D,EAAsE;AACrE,SAAOT,GAAG,CAAEE,KAAK,CAACG,WAAN,CAAkBK,mBAApB,EAAyC,CAClDP,QADkD,EAElDC,KAFkD,EAGlDK,IAHkD,CAAzC,CAAV;AAKA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,OAAO,SAASE,YAAT,CAAuBT,KAAvB,EAA8BE,KAA9B,EAAqCK,IAArC,EAA4C;AAClD,SACCD,4BAA4B,CAAEN,KAAF,EAAS,aAAT,EAAwBE,KAAxB,EAA+BK,IAA/B,CAA5B,KACA,KAFD;AAIA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,eAAT,CAA0BV,KAA1B,EAAiCE,KAAjC,EAAwCS,WAAxC,EAAsD;AAAA;;AAC5D,QAAMC,YAAY,4BAAGZ,KAAK,CAACa,WAAN,CAAkBC,QAAlB,CAA4BZ,KAA5B,CAAH,0DAAG,sBAAuCS,WAAvC,CAArB;AACA,QAAMI,qBAAqB,GAC1BH,YAAY,KAAKI,SAAjB,GACGJ,YADH,4BAEGZ,KAAK,CAACiB,kBAAN,CAAyBH,QAAzB,CAAmCZ,KAAnC,CAFH,0DAEG,sBAA8CS,WAA9C,CAHJ;AAKA,SAAO,CAAC,CAAEI,qBAAV;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get } from 'lodash';\n\n/**\n * Returns the item that is enabled in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} itemType Type of item.\n * @param {string} scope Item scope.\n *\n * @return {?string|null} The item that is enabled in the passed scope and type.\n */\nfunction getSingleEnableItem( state, itemType, scope ) {\n\treturn get( state.enableItems.singleEnableItems, [ itemType, scope ] );\n}\n\n/**\n * Returns the complementary area that is active in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Item scope.\n *\n * @return {string} The complementary area that is active in the given scope.\n */\nexport function getActiveComplementaryArea( state, scope ) {\n\treturn getSingleEnableItem( state, 'complementaryArea', scope );\n}\n\n/**\n * Returns a boolean indicating if an item is enabled or not in a given scope.\n *\n * @param {Object} state Global application state.\n * @param {string} itemType Type of item.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean|undefined} True if the item is enabled, false otherwise if the item is explicitly disabled, and undefined if there is no information for that item.\n */\nfunction isMultipleEnabledItemEnabled( state, itemType, scope, item ) {\n\treturn get( state.enableItems.multipleEnableItems, [\n\t\titemType,\n\t\tscope,\n\t\titem,\n\t] );\n}\n\n/**\n * Returns a boolean indicating if an item is pinned or not.\n *\n * @param {Object} state Global application state.\n * @param {string} scope Scope.\n * @param {string} item Item to check.\n *\n * @return {boolean} True if the item is pinned and false otherwise.\n */\nexport function isItemPinned( state, scope, item ) {\n\treturn (\n\t\tisMultipleEnabledItemEnabled( state, 'pinnedItems', scope, item ) !==\n\t\tfalse\n\t);\n}\n\n/**\n * Returns a boolean indicating whether a feature is active for a particular\n * scope.\n *\n * @param {Object} state The store state.\n * @param {string} scope The scope of the feature (e.g. core/edit-post).\n * @param {string} featureName The name of the feature.\n *\n * @return {boolean} Is the feature enabled?\n */\nexport function isFeatureActive( state, scope, featureName ) {\n\tconst featureValue = state.preferences.features[ scope ]?.[ featureName ];\n\tconst defaultedFeatureValue =\n\t\tfeatureValue !== undefined\n\t\t\t? featureValue\n\t\t\t: state.preferenceDefaults.features[ scope ]?.[ featureName ];\n\n\treturn !! defaultedFeatureValue;\n}\n"]}
@@ -122,6 +122,12 @@
122
122
  }
123
123
  }
124
124
 
125
+ @media (min-width: 782px) {
126
+ .components-panel__header + .interface-complementary-area-header {
127
+ margin-top: 0;
128
+ }
129
+ }
130
+
125
131
  .interface-complementary-area {
126
132
  background: #fff;
127
133
  color: #1e1e1e;
@@ -157,12 +163,18 @@
157
163
  .interface-complementary-area p {
158
164
  margin-top: 0;
159
165
  }
160
- .interface-complementary-area h2,
161
- .interface-complementary-area h3 {
166
+ .interface-complementary-area h2 {
162
167
  font-size: 13px;
163
168
  color: #1e1e1e;
164
169
  margin-bottom: 1.5em;
165
170
  }
171
+ .interface-complementary-area h3 {
172
+ font-size: 11px;
173
+ text-transform: uppercase;
174
+ font-weight: 500;
175
+ color: #1e1e1e;
176
+ margin-bottom: 1.5em;
177
+ }
166
178
  .interface-complementary-area hr {
167
179
  border-top: none;
168
180
  border-bottom: 1px solid #f0f0f0;
@@ -383,6 +395,39 @@ body.is-fullscreen-mode .interface-interface-skeleton {
383
395
  bottom: 0;
384
396
  }
385
397
 
398
+ .interface-more-menu-dropdown {
399
+ margin-right: -4px;
400
+ }
401
+ .interface-more-menu-dropdown .components-button {
402
+ width: auto;
403
+ padding: 0 2px;
404
+ }
405
+ @media (min-width: 600px) {
406
+ .interface-more-menu-dropdown {
407
+ margin-right: 0;
408
+ }
409
+ .interface-more-menu-dropdown .components-button {
410
+ padding: 0 4px;
411
+ }
412
+ }
413
+
414
+ .interface-more-menu-dropdown__content .components-popover__content {
415
+ min-width: 280px;
416
+ }
417
+ @media (min-width: 480px) {
418
+ .interface-more-menu-dropdown__content .components-popover__content {
419
+ width: auto;
420
+ max-width: 480px;
421
+ }
422
+ }
423
+ .interface-more-menu-dropdown__content .components-popover__content .components-dropdown-menu__menu {
424
+ padding: 0;
425
+ }
426
+
427
+ .components-popover.interface-more-menu-dropdown__content {
428
+ z-index: 99998;
429
+ }
430
+
386
431
  .interface-pinned-items {
387
432
  display: flex;
388
433
  }