@wordpress/edit-site 3.0.26 → 3.0.29

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 (130) hide show
  1. package/build/components/add-new-template/new-template-part.js +4 -1
  2. package/build/components/add-new-template/new-template-part.js.map +1 -1
  3. package/build/components/editor/global-styles-renderer.js +7 -3
  4. package/build/components/editor/global-styles-renderer.js.map +1 -1
  5. package/build/components/error-boundary/index.js +11 -27
  6. package/build/components/error-boundary/index.js.map +1 -1
  7. package/build/components/error-boundary/warning.js +70 -0
  8. package/build/components/error-boundary/warning.js.map +1 -0
  9. package/build/components/global-styles/screen-background-color.js +8 -9
  10. package/build/components/global-styles/screen-background-color.js.map +1 -1
  11. package/build/components/global-styles/screen-link-color.js +6 -10
  12. package/build/components/global-styles/screen-link-color.js.map +1 -1
  13. package/build/components/global-styles/screen-text-color.js +6 -10
  14. package/build/components/global-styles/screen-text-color.js.map +1 -1
  15. package/build/components/header/more-menu/index.js +68 -39
  16. package/build/components/header/more-menu/index.js.map +1 -1
  17. package/build/{plugins → components/header/more-menu}/site-export.js +0 -0
  18. package/build/components/header/more-menu/site-export.js.map +1 -0
  19. package/build/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  20. package/build/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  21. package/build/components/header/tools-more-menu-group/index.js +1 -5
  22. package/build/components/header/tools-more-menu-group/index.js.map +1 -1
  23. package/build/components/keyboard-shortcut-help-modal/config.js +45 -0
  24. package/build/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  25. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +56 -0
  26. package/build/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  27. package/build/components/keyboard-shortcut-help-modal/index.js +137 -0
  28. package/build/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  29. package/build/components/keyboard-shortcut-help-modal/shortcut.js +65 -0
  30. package/build/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  31. package/build/components/keyboard-shortcuts/index.js +9 -0
  32. package/build/components/keyboard-shortcuts/index.js.map +1 -1
  33. package/build/components/list/added-by.js +51 -50
  34. package/build/components/list/added-by.js.map +1 -1
  35. package/build/components/list/table.js +3 -1
  36. package/build/components/list/table.js.map +1 -1
  37. package/build/components/routes/redirect-to-homepage.js +106 -0
  38. package/build/components/routes/redirect-to-homepage.js.map +1 -0
  39. package/build/components/template-part-converter/convert-to-template-part.js +4 -1
  40. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  41. package/build/components/url-query-controller/index.js +1 -38
  42. package/build/components/url-query-controller/index.js.map +1 -1
  43. package/build/index.js +23 -4
  44. package/build/index.js.map +1 -1
  45. package/build/store/actions.js +7 -25
  46. package/build/store/actions.js.map +1 -1
  47. package/build-module/components/add-new-template/new-template-part.js +4 -1
  48. package/build-module/components/add-new-template/new-template-part.js.map +1 -1
  49. package/build-module/components/editor/global-styles-renderer.js +6 -3
  50. package/build-module/components/editor/global-styles-renderer.js.map +1 -1
  51. package/build-module/components/error-boundary/index.js +9 -26
  52. package/build-module/components/error-boundary/index.js.map +1 -1
  53. package/build-module/components/error-boundary/warning.js +60 -0
  54. package/build-module/components/error-boundary/warning.js.map +1 -0
  55. package/build-module/components/global-styles/screen-background-color.js +8 -10
  56. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  57. package/build-module/components/global-styles/screen-link-color.js +7 -11
  58. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  59. package/build-module/components/global-styles/screen-text-color.js +7 -11
  60. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  61. package/build-module/components/header/more-menu/index.js +65 -40
  62. package/build-module/components/header/more-menu/index.js.map +1 -1
  63. package/build-module/{plugins → components/header/more-menu}/site-export.js +0 -0
  64. package/build-module/components/header/more-menu/site-export.js.map +1 -0
  65. package/build-module/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  66. package/build-module/components/header/more-menu/welcome-guide-menu-item.js.map +1 -0
  67. package/build-module/components/header/tools-more-menu-group/index.js +2 -5
  68. package/build-module/components/header/tools-more-menu-group/index.js.map +1 -1
  69. package/build-module/components/keyboard-shortcut-help-modal/config.js +36 -0
  70. package/build-module/components/keyboard-shortcut-help-modal/config.js.map +1 -0
  71. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +44 -0
  72. package/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.js.map +1 -0
  73. package/build-module/components/keyboard-shortcut-help-modal/index.js +120 -0
  74. package/build-module/components/keyboard-shortcut-help-modal/index.js.map +1 -0
  75. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js +58 -0
  76. package/build-module/components/keyboard-shortcut-help-modal/shortcut.js.map +1 -0
  77. package/build-module/components/keyboard-shortcuts/index.js +9 -0
  78. package/build-module/components/keyboard-shortcuts/index.js.map +1 -1
  79. package/build-module/components/list/added-by.js +52 -51
  80. package/build-module/components/list/added-by.js.map +1 -1
  81. package/build-module/components/list/table.js +2 -1
  82. package/build-module/components/list/table.js.map +1 -1
  83. package/build-module/components/routes/redirect-to-homepage.js +94 -0
  84. package/build-module/components/routes/redirect-to-homepage.js.map +1 -0
  85. package/build-module/components/template-part-converter/convert-to-template-part.js +4 -1
  86. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  87. package/build-module/components/url-query-controller/index.js +3 -40
  88. package/build-module/components/url-query-controller/index.js.map +1 -1
  89. package/build-module/index.js +20 -3
  90. package/build-module/index.js.map +1 -1
  91. package/build-module/store/actions.js +7 -23
  92. package/build-module/store/actions.js.map +1 -1
  93. package/build-style/style-rtl.css +51 -0
  94. package/build-style/style.css +51 -0
  95. package/package.json +13 -13
  96. package/src/components/add-new-template/new-template-part.js +7 -1
  97. package/src/components/editor/global-styles-renderer.js +7 -1
  98. package/src/components/error-boundary/index.js +11 -28
  99. package/src/components/error-boundary/warning.js +59 -0
  100. package/src/components/global-styles/screen-background-color.js +6 -9
  101. package/src/components/global-styles/screen-link-color.js +6 -14
  102. package/src/components/global-styles/screen-text-color.js +6 -14
  103. package/src/components/header/more-menu/index.js +103 -44
  104. package/src/{plugins → components/header/more-menu}/site-export.js +0 -0
  105. package/src/{plugins → components/header/more-menu}/welcome-guide-menu-item.js +1 -1
  106. package/src/components/header/tools-more-menu-group/index.js +2 -7
  107. package/src/components/keyboard-shortcut-help-modal/config.js +27 -0
  108. package/src/components/keyboard-shortcut-help-modal/dynamic-shortcut.js +41 -0
  109. package/src/components/keyboard-shortcut-help-modal/index.js +135 -0
  110. package/src/components/keyboard-shortcut-help-modal/shortcut.js +73 -0
  111. package/src/components/keyboard-shortcut-help-modal/style.scss +66 -0
  112. package/src/components/keyboard-shortcuts/index.js +10 -0
  113. package/src/components/list/added-by.js +57 -63
  114. package/src/components/list/table.js +5 -2
  115. package/src/components/routes/redirect-to-homepage.js +94 -0
  116. package/src/components/template-part-converter/convert-to-template-part.js +6 -1
  117. package/src/components/url-query-controller/index.js +3 -35
  118. package/src/index.js +25 -2
  119. package/src/store/actions.js +7 -35
  120. package/src/store/test/actions.js +0 -90
  121. package/src/style.scss +1 -0
  122. package/build/plugins/index.js +0 -28
  123. package/build/plugins/index.js.map +0 -1
  124. package/build/plugins/site-export.js.map +0 -1
  125. package/build/plugins/welcome-guide-menu-item.js.map +0 -1
  126. package/build-module/plugins/index.js +0 -20
  127. package/build-module/plugins/index.js.map +0 -1
  128. package/build-module/plugins/site-export.js.map +0 -1
  129. package/build-module/plugins/welcome-guide-menu-item.js.map +0 -1
  130. package/src/plugins/index.js +0 -24
@@ -50,8 +50,11 @@ export default function NewTemplatePart(_ref) {
50
50
  }
51
51
 
52
52
  try {
53
+ // Currently template parts only allow latin chars.
54
+ // Fallback slug will receive suffix by default.
55
+ const cleanSlug = kebabCase(title).replace(/[^\w-]+/g, '') || 'wp-custom-part';
53
56
  const templatePart = await saveEntityRecord('postType', 'wp_template_part', {
54
- slug: kebabCase(title),
57
+ slug: cleanSlug,
55
58
  title,
56
59
  content: '',
57
60
  area
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["kebabCase","useState","useSelect","useDispatch","Button","__","store","noticesStore","coreStore","useHistory","CreateTemplatePartModal","NewTemplatePart","postType","history","isModalOpen","setIsModalOpen","createErrorNotice","saveEntityRecord","getLastEntitySaveError","createTemplatePart","title","area","type","templatePart","slug","content","lastEntitySaveError","id","push","postId","error","errorMessage","message","code","labels","add_new"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,OAAOC,uBAAP,MAAoC,+BAApC;AAEA,eAAe,SAASC,eAAT,OAAyC;AAAA,MAAf;AAAEC,IAAAA;AAAF,GAAe;AACvD,QAAMC,OAAO,GAAGJ,UAAU,EAA1B;AACA,QAAM,CAAEK,WAAF,EAAeC,cAAf,IAAkCd,QAAQ,CAAE,KAAF,CAAhD;AACA,QAAM;AAAEe,IAAAA;AAAF,MAAwBb,WAAW,CAAEI,YAAF,CAAzC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAAuBd,WAAW,CAAEK,SAAF,CAAxC;AACA,QAAM;AAAEU,IAAAA;AAAF,MAA6BhB,SAAS,CAAEM,SAAF,CAA5C;;AAEA,iBAAeW,kBAAf,QAAqD;AAAA,QAAlB;AAAEC,MAAAA,KAAF;AAASC,MAAAA;AAAT,KAAkB;;AACpD,QAAK,CAAED,KAAP,EAAe;AACdJ,MAAAA,iBAAiB,CAAEX,EA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AAMC,cAAc,CAAE,KAAF,CADlC;AAEC,IAAA,QAAQ,EAAGI;AAFZ,IAVF,CADD;AAkBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from '../routes';\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function NewTemplatePart( { postType } ) {\n\tconst history = useHistory();\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { getLastEntitySaveError } = useSelect( coreStore );\n\n\tasync function createTemplatePart( { title, area } ) {\n\t\tif ( ! title ) {\n\t\t\tcreateErrorNotice( __( 'Title is not defined.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: kebabCase( title ),\n\t\t\t\t\ttitle,\n\t\t\t\t\tcontent: '',\n\t\t\t\t\tarea,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst lastEntitySaveError = getLastEntitySaveError(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePart.id\n\t\t\t);\n\t\t\tif ( lastEntitySaveError ) {\n\t\t\t\tthrow lastEntitySaveError;\n\t\t\t}\n\n\t\t\tsetIsModalOpen( false );\n\n\t\t\t// Navigate to the created template part editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: templatePart.id,\n\t\t\t\tpostType: templatePart.type,\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tsetIsModalOpen( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new }\n\t\t\t</Button>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tonCreate={ createTemplatePart }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template-part.js"],"names":["kebabCase","useState","useSelect","useDispatch","Button","__","store","noticesStore","coreStore","useHistory","CreateTemplatePartModal","NewTemplatePart","postType","history","isModalOpen","setIsModalOpen","createErrorNotice","saveEntityRecord","getLastEntitySaveError","createTemplatePart","title","area","type","cleanSlug","replace","templatePart","slug","content","lastEntitySaveError","id","push","postId","error","errorMessage","message","code","labels","add_new"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,QAA1B;AAEA;AACA;AACA;;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASD,KAAK,IAAIE,SAAlB,QAAmC,sBAAnC;AAEA;AACA;AACA;;AACA,S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AA,OAAO,CAACiB,IAAR,CAAc;AACbC,QAAAA,MAAM,EAAEN,YAAY,CAACI,EADR;AAEbjB,QAAAA,QAAQ,EAAEa,YAAY,CAACH;AAFV,OAAd,EA9BG,CAmCH;AACA,KApCD,CAoCE,OAAQU,KAAR,EAAgB;AACjB,YAAMC,YAAY,GACjBD,KAAK,CAACE,OAAN,IAAiBF,KAAK,CAACG,IAAN,KAAe,eAAhC,GACGH,KAAK,CAACE,OADT,GAEG7B,EAAE,CACF,qDADE,CAHN;AAOAW,MAAAA,iBAAiB,CAAEiB,YAAF,EAAgB;AAAEX,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AAEAP,MAAAA,cAAc,CAAE,KAAF,CAAd;AACA;AACD;;AAED,SACC,8BACC,cAAC,MAAD;AACC,IAAA,OAAO,EAAC,SADT;AAEC,IAAA,OAAO,EAAG,MAAM;AACfA,MAAAA,cAAc,CAAE,IAAF,CAAd;AACA;AAJF,KAMGH,QAAQ,CAACwB,MAAT,CAAgBC,OANnB,CADD,EASGvB,WAAW,IACZ,cAAC,uBAAD;AACC,IAAA,UAAU,EAAG,MAAMC,cAAc,CAAE,KAAF,CADlC;AAEC,IAAA,QAAQ,EAAGI;AAFZ,IAVF,CADD;AAkBA","sourcesContent":["/**\n * External dependencies\n */\nimport { kebabCase } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useHistory } from '../routes';\nimport CreateTemplatePartModal from '../create-template-part-modal';\n\nexport default function NewTemplatePart( { postType } ) {\n\tconst history = useHistory();\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { getLastEntitySaveError } = useSelect( coreStore );\n\n\tasync function createTemplatePart( { title, area } ) {\n\t\tif ( ! title ) {\n\t\t\tcreateErrorNotice( __( 'Title is not defined.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\t// Currently template parts only allow latin chars.\n\t\t\t// Fallback slug will receive suffix by default.\n\t\t\tconst cleanSlug =\n\t\t\t\tkebabCase( title ).replace( /[^\\w-]+/g, '' ) ||\n\t\t\t\t'wp-custom-part';\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle,\n\t\t\t\t\tcontent: '',\n\t\t\t\t\tarea,\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst lastEntitySaveError = getLastEntitySaveError(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\ttemplatePart.id\n\t\t\t);\n\t\t\tif ( lastEntitySaveError ) {\n\t\t\t\tthrow lastEntitySaveError;\n\t\t\t}\n\n\t\t\tsetIsModalOpen( false );\n\n\t\t\t// Navigate to the created template part editor.\n\t\t\thistory.push( {\n\t\t\t\tpostId: templatePart.id,\n\t\t\t\tpostType: templatePart.type,\n\t\t\t} );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tsetIsModalOpen( false );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<Button\n\t\t\t\tvariant=\"primary\"\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ postType.labels.add_new }\n\t\t\t</Button>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreateTemplatePartModal\n\t\t\t\t\tcloseModal={ () => setIsModalOpen( false ) }\n\t\t\t\t\tonCreate={ createTemplatePart }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
@@ -1,6 +1,11 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { filter } from 'lodash';
1
5
  /**
2
6
  * WordPress dependencies
3
7
  */
8
+
4
9
  import { useEffect } from '@wordpress/element';
5
10
  import { useSelect, useDispatch } from '@wordpress/data';
6
11
  /**
@@ -23,14 +28,12 @@ function useGlobalStylesRenderer() {
23
28
  updateSettings
24
29
  } = useDispatch(editSiteStore);
25
30
  useEffect(() => {
26
- var _currentStoreSettings;
27
-
28
31
  if (!styles || !settings) {
29
32
  return;
30
33
  }
31
34
 
32
35
  const currentStoreSettings = getSettings();
33
- const nonGlobalStyles = currentStoreSettings === null || currentStoreSettings === void 0 ? void 0 : (_currentStoreSettings = currentStoreSettings.styles) === null || _currentStoreSettings === void 0 ? void 0 : _currentStoreSettings.filter(style => !style.isGlobalStyles);
36
+ const nonGlobalStyles = filter(currentStoreSettings.styles, style => !style.isGlobalStyles);
34
37
  updateSettings({ ...currentStoreSettings,
35
38
  styles: [...nonGlobalStyles, ...styles],
36
39
  __experimentalFeatures: settings
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/editor/global-styles-renderer.js"],"names":["useEffect","useSelect","useDispatch","store","editSiteStore","useGlobalStylesOutput","useGlobalStylesRenderer","styles","settings","getSettings","updateSettings","currentStoreSettings","nonGlobalStyles","filter","style","isGlobalStyles","__experimentalFeatures","GlobalStylesRenderer"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA;AACA;AACA;;AACA,SAASC,qBAAT,QAAsC,2CAAtC;;AAEA,SAASC,uBAAT,GAAmC;AAClC,QAAM,CAAEC,MAAF,EAAUC,QAAV,IAAuBH,qBAAqB,EAAlD;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAkBR,SAAS,CAAEG,aAAF,CAAjC;AACA,QAAM;AAAEM,IAAAA;AAAF,MAAqBR,WAAW,CAAEE,aAAF,CAAtC;AAEAJ,EAAAA,SAAS,CAAE,MAAM;AAAA;;AAChB,QAAK,CAAEO,MAAF,IAAY,CAAEC,QAAnB,EAA8B;AAC7B;AACA;;AAED,UAAMG,oBAAoB,GAAGF,WAAW,EAAxC;AACA,UAAMG,eAAe,GAAGD,oBAAH,aAAGA,oBAAH,gDAAGA,oBAAoB,CAAEJ,MAAzB,0DAAG,sBAA8BM,MAA9B,CACrBC,KAAF,IAAa,CAAEA,KAAK,CAACC,cADE,CAAxB;AAGAL,IAAAA,cAAc,CAAE,EACf,GAAGC,oBADY;AAEfJ,MAAAA,MAAM,EAAE,CAAE,GAAGK,eAAL,EAAsB,GAAGL,MAAzB,CAFO;AAGfS,MAAAA,sBAAsB,EAAER;AAHT,KAAF,CAAd;AAKA,GAdQ,EAcN,CAAED,MAAF,EAAUC,QAAV,CAdM,CAAT;AAeA;;AAED,OAAO,SAASS,oBAAT,GAAgC;AACtCX,EAAAA,uBAAuB;AAEvB,SAAO,IAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\n/**\n * Internal dependencies\n */\nimport { useGlobalStylesOutput } from '../global-styles/use-global-styles-output';\n\nfunction useGlobalStylesRenderer() {\n\tconst [ styles, settings ] = useGlobalStylesOutput();\n\tconst { getSettings } = useSelect( editSiteStore );\n\tconst { updateSettings } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( ! styles || ! settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentStoreSettings = getSettings();\n\t\tconst nonGlobalStyles = currentStoreSettings?.styles?.filter(\n\t\t\t( style ) => ! style.isGlobalStyles\n\t\t);\n\t\tupdateSettings( {\n\t\t\t...currentStoreSettings,\n\t\t\tstyles: [ ...nonGlobalStyles, ...styles ],\n\t\t\t__experimentalFeatures: settings,\n\t\t} );\n\t}, [ styles, settings ] );\n}\n\nexport function GlobalStylesRenderer() {\n\tuseGlobalStylesRenderer();\n\n\treturn null;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/editor/global-styles-renderer.js"],"names":["filter","useEffect","useSelect","useDispatch","store","editSiteStore","useGlobalStylesOutput","useGlobalStylesRenderer","styles","settings","getSettings","updateSettings","currentStoreSettings","nonGlobalStyles","style","isGlobalStyles","__experimentalFeatures","GlobalStylesRenderer"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,MAAT,QAAuB,QAAvB;AAEA;AACA;AACA;;AACA,SAASC,SAAT,QAA0B,oBAA1B;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,aAAvC;AAEA;AACA;AACA;;AACA,SAASC,qBAAT,QAAsC,2CAAtC;;AAEA,SAASC,uBAAT,GAAmC;AAClC,QAAM,CAAEC,MAAF,EAAUC,QAAV,IAAuBH,qBAAqB,EAAlD;AACA,QAAM;AAAEI,IAAAA;AAAF,MAAkBR,SAAS,CAAEG,aAAF,CAAjC;AACA,QAAM;AAAEM,IAAAA;AAAF,MAAqBR,WAAW,CAAEE,aAAF,CAAtC;AAEAJ,EAAAA,SAAS,CAAE,MAAM;AAChB,QAAK,CAAEO,MAAF,IAAY,CAAEC,QAAnB,EAA8B;AAC7B;AACA;;AAED,UAAMG,oBAAoB,GAAGF,WAAW,EAAxC;AACA,UAAMG,eAAe,GAAGb,MAAM,CAC7BY,oBAAoB,CAACJ,MADQ,EAE3BM,KAAF,IAAa,CAAEA,KAAK,CAACC,cAFQ,CAA9B;AAIAJ,IAAAA,cAAc,CAAE,EACf,GAAGC,oBADY;AAEfJ,MAAAA,MAAM,EAAE,CAAE,GAAGK,eAAL,EAAsB,GAAGL,MAAzB,CAFO;AAGfQ,MAAAA,sBAAsB,EAAEP;AAHT,KAAF,CAAd;AAKA,GAfQ,EAeN,CAAED,MAAF,EAAUC,QAAV,CAfM,CAAT;AAgBA;;AAED,OAAO,SAASQ,oBAAT,GAAgC;AACtCV,EAAAA,uBAAuB;AAEvB,SAAO,IAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { filter } from 'lodash';\n\n/**\n * WordPress dependencies\n */\nimport { useEffect } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\n\n/**\n * Internal dependencies\n */\nimport { useGlobalStylesOutput } from '../global-styles/use-global-styles-output';\n\nfunction useGlobalStylesRenderer() {\n\tconst [ styles, settings ] = useGlobalStylesOutput();\n\tconst { getSettings } = useSelect( editSiteStore );\n\tconst { updateSettings } = useDispatch( editSiteStore );\n\n\tuseEffect( () => {\n\t\tif ( ! styles || ! settings ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst currentStoreSettings = getSettings();\n\t\tconst nonGlobalStyles = filter(\n\t\t\tcurrentStoreSettings.styles,\n\t\t\t( style ) => ! style.isGlobalStyles\n\t\t);\n\t\tupdateSettings( {\n\t\t\t...currentStoreSettings,\n\t\t\tstyles: [ ...nonGlobalStyles, ...styles ],\n\t\t\t__experimentalFeatures: settings,\n\t\t} );\n\t}, [ styles, settings ] );\n}\n\nexport function GlobalStylesRenderer() {\n\tuseGlobalStylesRenderer();\n\n\treturn null;\n}\n"]}
@@ -5,22 +5,11 @@ import { createElement } from "@wordpress/element";
5
5
  */
6
6
  import { Component } from '@wordpress/element';
7
7
  import { __ } from '@wordpress/i18n';
8
- import { Button } from '@wordpress/components';
9
- import { Warning } from '@wordpress/block-editor';
10
- import { useCopyToClipboard } from '@wordpress/compose';
11
-
12
- function CopyButton(_ref) {
13
- let {
14
- text,
15
- children
16
- } = _ref;
17
- const ref = useCopyToClipboard(text);
18
- return createElement(Button, {
19
- variant: "secondary",
20
- ref: ref
21
- }, children);
22
- }
8
+ /**
9
+ * Internal dependencies
10
+ */
23
11
 
12
+ import ErrorBoundaryWarning from './warning';
24
13
  export default class ErrorBoundary extends Component {
25
14
  constructor() {
26
15
  super(...arguments);
@@ -49,17 +38,11 @@ export default class ErrorBoundary extends Component {
49
38
  return this.props.children;
50
39
  }
51
40
 
52
- return createElement(Warning, {
53
- className: "editor-error-boundary",
54
- actions: [createElement(Button, {
55
- key: "recovery",
56
- onClick: this.reboot,
57
- variant: "secondary"
58
- }, __('Attempt Recovery')), createElement(CopyButton, {
59
- key: "copy-error",
60
- text: error.stack
61
- }, __('Copy Error'))]
62
- }, __('The editor has encountered an unexpected error.'));
41
+ return createElement(ErrorBoundaryWarning, {
42
+ message: __('The editor has encountered an unexpected error.'),
43
+ error: error,
44
+ reboot: this.reboot
45
+ });
63
46
  }
64
47
 
65
48
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/error-boundary/index.js"],"names":["Component","__","Button","Warning","useCopyToClipboard","CopyButton","text","children","ref","ErrorBoundary","constructor","arguments","reboot","bind","state","error","getDerivedStateFromError","props","onError","render","stack"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;;AAEA,SAASC,UAAT,OAA0C;AAAA,MAArB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAqB;AACzC,QAAMC,GAAG,GAAGJ,kBAAkB,CAAEE,IAAF,CAA9B;AACA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAED,eAAe,MAAME,aAAN,SAA4BT,SAA5B,CAAsC;AACpDU,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AAEA,SAAKC,MAAL,GAAc,KAAKA,MAAL,CAAYC,IAAZ,CAAkB,IAAlB,CAAd;AAEA,SAAKC,KAAL,GAAa;AACZC,MAAAA,KAAK,EAAE;AADK,KAAb;AAGA;;AAE8B,SAAxBC,wBAAwB,CAAED,KAAF,EAAU;AACxC,WAAO;AAAEA,MAAAA;AAAF,KAAP;AACA;;AAEDH,EAAAA,MAAM,GAAG;AACR,SAAKK,KAAL,CAAWC,OAAX;AACA;;AAEDC,EAAAA,MAAM,GAAG;AACR,UAAM;AAAEJ,MAAAA;AAAF,QAAY,KAAKD,KAAvB;;AACA,QAAK,CAAEC,KAAP,EAAe;AACd,aAAO,KAAKE,KAAL,CAAWV,QAAlB;AACA;;AAED,WACC,cAAC,OAAD;AACC,MAAA,SAAS,EAAC,uBADX;AAEC,MAAA,OAAO,EAAG,CACT,cAAC,MAAD;AACC,QAAA,GAAG,EAAC,UADL;AAEC,QAAA,OAAO,EAAG,KAAKK,MAFhB;AAGC,QAAA,OAAO,EAAC;AAHT,SAKGX,EAAE,CAAE,kBAAF,CALL,CADS,EAQT,cAAC,UAAD;AAAY,QAAA,GAAG,EAAC,YAAhB;AAA6B,QAAA,IAAI,EAAGc,KAAK,CAACK;AAA1C,SACGnB,EAAE,CAAE,YAAF,CADL,CARS;AAFX,OAeGA,EAAE,CAAE,iDAAF,CAfL,CADD;AAmBA;;AA5CmD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.reboot = this.reboot.bind( this );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\treboot() {\n\t\tthis.props.onError();\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<Warning\n\t\t\t\tclassName=\"editor-error-boundary\"\n\t\t\t\tactions={ [\n\t\t\t\t\t<Button\n\t\t\t\t\t\tkey=\"recovery\"\n\t\t\t\t\t\tonClick={ this.reboot }\n\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Attempt Recovery' ) }\n\t\t\t\t\t</Button>,\n\t\t\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t\t\t</CopyButton>,\n\t\t\t\t] }\n\t\t\t>\n\t\t\t\t{ __( 'The editor has encountered an unexpected error.' ) }\n\t\t\t</Warning>\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/error-boundary/index.js"],"names":["Component","__","ErrorBoundaryWarning","ErrorBoundary","constructor","arguments","reboot","bind","state","error","getDerivedStateFromError","props","onError","render","children"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,oBAA1B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,WAAjC;AAEA,eAAe,MAAMC,aAAN,SAA4BH,SAA5B,CAAsC;AACpDI,EAAAA,WAAW,GAAG;AACb,UAAO,GAAGC,SAAV;AAEA,SAAKC,MAAL,GAAc,KAAKA,MAAL,CAAYC,IAAZ,CAAkB,IAAlB,CAAd;AAEA,SAAKC,KAAL,GAAa;AACZC,MAAAA,KAAK,EAAE;AADK,KAAb;AAGA;;AAE8B,SAAxBC,wBAAwB,CAAED,KAAF,EAAU;AACxC,WAAO;AAAEA,MAAAA;AAAF,KAAP;AACA;;AAEDH,EAAAA,MAAM,GAAG;AACR,SAAKK,KAAL,CAAWC,OAAX;AACA;;AAEDC,EAAAA,MAAM,GAAG;AACR,UAAM;AAAEJ,MAAAA;AAAF,QAAY,KAAKD,KAAvB;;AACA,QAAK,CAAEC,KAAP,EAAe;AACd,aAAO,KAAKE,KAAL,CAAWG,QAAlB;AACA;;AAED,WACC,cAAC,oBAAD;AACC,MAAA,OAAO,EAAGb,EAAE,CACX,iDADW,CADb;AAIC,MAAA,KAAK,EAAGQ,KAJT;AAKC,MAAA,MAAM,EAAG,KAAKH;AALf,MADD;AASA;;AAlCmD","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Component } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport ErrorBoundaryWarning from './warning';\n\nexport default class ErrorBoundary extends Component {\n\tconstructor() {\n\t\tsuper( ...arguments );\n\n\t\tthis.reboot = this.reboot.bind( this );\n\n\t\tthis.state = {\n\t\t\terror: null,\n\t\t};\n\t}\n\n\tstatic getDerivedStateFromError( error ) {\n\t\treturn { error };\n\t}\n\n\treboot() {\n\t\tthis.props.onError();\n\t}\n\n\trender() {\n\t\tconst { error } = this.state;\n\t\tif ( ! error ) {\n\t\t\treturn this.props.children;\n\t\t}\n\n\t\treturn (\n\t\t\t<ErrorBoundaryWarning\n\t\t\t\tmessage={ __(\n\t\t\t\t\t'The editor has encountered an unexpected error.'\n\t\t\t\t) }\n\t\t\t\terror={ error }\n\t\t\t\treboot={ this.reboot }\n\t\t\t/>\n\t\t);\n\t}\n}\n"]}
@@ -0,0 +1,60 @@
1
+ import { createElement } from "@wordpress/element";
2
+
3
+ /**
4
+ * WordPress dependencies
5
+ */
6
+ import { __ } from '@wordpress/i18n';
7
+ import { Button } from '@wordpress/components';
8
+ import { Warning } from '@wordpress/block-editor';
9
+ import { useCopyToClipboard } from '@wordpress/compose';
10
+
11
+ function CopyButton(_ref) {
12
+ let {
13
+ text,
14
+ children
15
+ } = _ref;
16
+ const ref = useCopyToClipboard(text);
17
+ return createElement(Button, {
18
+ variant: "secondary",
19
+ ref: ref
20
+ }, children);
21
+ }
22
+
23
+ export default function ErrorBoundaryWarning(_ref2) {
24
+ let {
25
+ message,
26
+ error,
27
+ reboot,
28
+ dashboardLink
29
+ } = _ref2;
30
+ const actions = [];
31
+
32
+ if (reboot) {
33
+ actions.push(createElement(Button, {
34
+ key: "recovery",
35
+ onClick: reboot,
36
+ variant: "secondary"
37
+ }, __('Attempt Recovery')));
38
+ }
39
+
40
+ if (error) {
41
+ actions.push(createElement(CopyButton, {
42
+ key: "copy-error",
43
+ text: error.stack
44
+ }, __('Copy Error')));
45
+ }
46
+
47
+ if (dashboardLink) {
48
+ actions.push(createElement(Button, {
49
+ key: "back-to-dashboard",
50
+ variant: "secondary",
51
+ href: dashboardLink
52
+ }, __('Back to dashboard')));
53
+ }
54
+
55
+ return createElement(Warning, {
56
+ className: "editor-error-boundary",
57
+ actions: actions
58
+ }, message);
59
+ }
60
+ //# sourceMappingURL=warning.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/error-boundary/warning.js"],"names":["__","Button","Warning","useCopyToClipboard","CopyButton","text","children","ref","ErrorBoundaryWarning","message","error","reboot","dashboardLink","actions","push","stack"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,OAAT,QAAwB,yBAAxB;AACA,SAASC,kBAAT,QAAmC,oBAAnC;;AAEA,SAASC,UAAT,OAA0C;AAAA,MAArB;AAAEC,IAAAA,IAAF;AAAQC,IAAAA;AAAR,GAAqB;AACzC,QAAMC,GAAG,GAAGJ,kBAAkB,CAAEE,IAAF,CAA9B;AACA,SACC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,WAAhB;AAA4B,IAAA,GAAG,EAAGE;AAAlC,KACGD,QADH,CADD;AAKA;;AAED,eAAe,SAASE,oBAAT,QAKX;AAAA,MAL0C;AAC7CC,IAAAA,OAD6C;AAE7CC,IAAAA,KAF6C;AAG7CC,IAAAA,MAH6C;AAI7CC,IAAAA;AAJ6C,GAK1C;AACH,QAAMC,OAAO,GAAG,EAAhB;;AAEA,MAAKF,MAAL,EAAc;AACbE,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,MAAD;AAAQ,MAAA,GAAG,EAAC,UAAZ;AAAuB,MAAA,OAAO,EAAGH,MAAjC;AAA0C,MAAA,OAAO,EAAC;AAAlD,OACGX,EAAE,CAAE,kBAAF,CADL,CADD;AAKA;;AAED,MAAKU,KAAL,EAAa;AACZG,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,UAAD;AAAY,MAAA,GAAG,EAAC,YAAhB;AAA6B,MAAA,IAAI,EAAGJ,KAAK,CAACK;AAA1C,OACGf,EAAE,CAAE,YAAF,CADL,CADD;AAKA;;AAED,MAAKY,aAAL,EAAqB;AACpBC,IAAAA,OAAO,CAACC,IAAR,CACC,cAAC,MAAD;AACC,MAAA,GAAG,EAAC,mBADL;AAEC,MAAA,OAAO,EAAC,WAFT;AAGC,MAAA,IAAI,EAAGF;AAHR,OAKGZ,EAAE,CAAE,mBAAF,CALL,CADD;AASA;;AAED,SACC,cAAC,OAAD;AAAS,IAAA,SAAS,EAAC,uBAAnB;AAA2C,IAAA,OAAO,EAAGa;AAArD,KACGJ,OADH,CADD;AAKA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Button } from '@wordpress/components';\nimport { Warning } from '@wordpress/block-editor';\nimport { useCopyToClipboard } from '@wordpress/compose';\n\nfunction CopyButton( { text, children } ) {\n\tconst ref = useCopyToClipboard( text );\n\treturn (\n\t\t<Button variant=\"secondary\" ref={ ref }>\n\t\t\t{ children }\n\t\t</Button>\n\t);\n}\n\nexport default function ErrorBoundaryWarning( {\n\tmessage,\n\terror,\n\treboot,\n\tdashboardLink,\n} ) {\n\tconst actions = [];\n\n\tif ( reboot ) {\n\t\tactions.push(\n\t\t\t<Button key=\"recovery\" onClick={ reboot } variant=\"secondary\">\n\t\t\t\t{ __( 'Attempt Recovery' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\tif ( error ) {\n\t\tactions.push(\n\t\t\t<CopyButton key=\"copy-error\" text={ error.stack }>\n\t\t\t\t{ __( 'Copy Error' ) }\n\t\t\t</CopyButton>\n\t\t);\n\t}\n\n\tif ( dashboardLink ) {\n\t\tactions.push(\n\t\t\t<Button\n\t\t\t\tkey=\"back-to-dashboard\"\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\thref={ dashboardLink }\n\t\t\t>\n\t\t\t\t{ __( 'Back to dashboard' ) }\n\t\t\t</Button>\n\t\t);\n\t}\n\n\treturn (\n\t\t<Warning className=\"editor-error-boundary\" actions={ actions }>\n\t\t\t{ message }\n\t\t</Warning>\n\t);\n}\n"]}
@@ -1,10 +1,11 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import { createElement, Fragment } from "@wordpress/element";
2
3
 
3
4
  /**
4
5
  * WordPress dependencies
5
6
  */
6
7
  import { __ } from '@wordpress/i18n';
7
- import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';
8
+ import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
8
9
  /**
9
10
  * Internal dependencies
10
11
  */
@@ -36,7 +37,6 @@ function ScreenBackgroundColor(_ref) {
36
37
  return null;
37
38
  }
38
39
 
39
- const settings = [];
40
40
  let backgroundSettings = {};
41
41
 
42
42
  if (hasBackgroundColor) {
@@ -63,17 +63,15 @@ function ScreenBackgroundColor(_ref) {
63
63
  }
64
64
  }
65
65
 
66
- settings.push({ ...backgroundSettings,
67
- ...gradientSettings,
68
- label: __('Background color')
69
- });
66
+ const controlProps = { ...backgroundSettings,
67
+ ...gradientSettings
68
+ };
70
69
  return createElement(Fragment, null, createElement(ScreenHeader, {
71
70
  back: parentMenu + '/colors',
72
71
  title: __('Background'),
73
72
  description: __('Set a background color or gradient for the whole website.')
74
- }), createElement(PanelColorGradientSettings, {
75
- title: __('Color'),
76
- settings: settings,
73
+ }), createElement(ColorGradientControl, _extends({
74
+ className: "edit-site-screen-background-color__control",
77
75
  colors: colorsPerOrigin,
78
76
  gradients: gradientsPerOrigin,
79
77
  disableCustomColors: !areCustomSolidsEnabled,
@@ -82,7 +80,7 @@ function ScreenBackgroundColor(_ref) {
82
80
  showTitle: false,
83
81
  enableAlpha: true,
84
82
  __experimentalIsRenderedInSidebar: true
85
- }));
83
+ }, controlProps)));
86
84
  }
87
85
 
88
86
  export default ScreenBackgroundColor;
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-background-color.js"],"names":["__","__experimentalPanelColorGradientSettings","PanelColorGradientSettings","ScreenHeader","getSupportedGlobalStylesPanels","useColorsPerOrigin","useGradientsPerOrigin","useSetting","useStyle","ScreenBackgroundColor","name","parentMenu","undefined","supports","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","colorsPerOrigin","gradientsPerOrigin","isBackgroundEnabled","hasBackgroundColor","includes","length","hasGradientColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","settings","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","push","label"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,wCAAwC,IAAIC,0BAArD,QAAuF,yBAAvF;AAEA;AACA;AACA;;AACA,OAAOC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IAAA,QAAQ,EAAG+B,QAFZ;AAGC,IAAA,MAAM,EAAGb,eAHV;AAIC,IAAA,SAAS,EAAGC,kBAJb;AAKC,IAAA,mBAAmB,EAAG,CAAEH,sBALzB;AAMC,IAAA,sBAAsB,EAAG,CAAEC,yBAN5B;AAOC,IAAA,gCAAgC,MAPjC;AAQC,IAAA,SAAS,EAAG,KARb;AASC,IAAA,WAAW,MATZ;AAUC,IAAA,iCAAiC;AAVlC,IATD,CADD;AAwBA;;AAED,eAAeR,qBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseGradientsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nfunction ScreenBackgroundColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ gradients ] = useSetting( 'color.gradients', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ areCustomGradientsEnabled ] = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst gradientsPerOrigin = useGradientsPerOrigin( name );\n\n\tconst [ isBackgroundEnabled ] = useSetting( 'color.background', name );\n\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\tconst [ backgroundColor, setBackgroundColor ] = useStyle(\n\t\t'color.background',\n\t\tname\n\t);\n\tconst [ userBackgroundColor ] = useStyle(\n\t\t'color.background',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ gradient, setGradient ] = useStyle( 'color.gradient', name );\n\tconst [ userGradient ] = useStyle( 'color.gradient', name, 'user' );\n\n\tif ( ! hasBackgroundColor && ! hasGradientColor ) {\n\t\treturn null;\n\t}\n\n\tconst settings = [];\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: setBackgroundColor,\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: setGradient,\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tsettings.push( {\n\t\t...backgroundSettings,\n\t\t...gradientSettings,\n\t\tlabel: __( 'Background color' ),\n\t} );\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Background' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set a background color or gradient for the whole website.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<PanelColorGradientSettings\n\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\tsettings={ settings }\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tgradients={ gradientsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenBackgroundColor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-background-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useColorsPerOrigin","useGradientsPerOrigin","useSetting","useStyle","ScreenBackgroundColor","name","parentMenu","undefined","supports","solids","gradients","areCustomSolidsEnabled","areCustomGradientsEnabled","colorsPerOrigin","gradientsPerOrigin","isBackgroundEnabled","hasBackgroundColor","includes","length","hasGradientColor","backgroundColor","setBackgroundColor","userBackgroundColor","gradient","setGradient","userGradient","backgroundSettings","colorValue","onColorChange","clearable","gradientSettings","gradientValue","onGradientChange","controlProps"],"mappings":";;;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,kBAFD,EAGCC,qBAHD,EAICC,UAJD,EAKCC,QALD,QAMO,SANP;;AAQA,SAASC,qBAAT,OAA2C;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AAC1C,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,QAAQ,GAAGT,8BAA8B,CAAEM,IAAF,CAA/C;AACA,QAAM,CAAEI,MAAF,IAAaP,UAAU,CAAE,eAAF,EAAmBG,IAAnB,CAA7B;AACA,QAAM,CAAEK,SAAF,IAAgBR,UAAU,CAAE,iBAAF,EAAqBG,IAArB,CAAhC;AACA,QAAM,CAAEM,sBAAF,IAA6BT,UAAU,CAAE,cAAF,EAAkBG,IAAlB,CAA7C;AACA,QAAM,CAAEO,yBAAF,IAAgCV,UAAU,CAC/C,sBAD+C,EAE/CG,IAF+C,CAAhD;AAKA,QAAMQ,eAAe,GAAGb,kBAAkB,CAAEK,IAAF,CAA1C;AAC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EAAER,QADG;AAElBS,MAAAA,gBAAgB,EAAER;AAFA,KAAnB;;AAIA,QAAKD,QAAL,EAAgB;AACfO,MAAAA,gBAAgB,CAACD,SAAjB,GAA6BN,QAAQ,KAAKE,YAA1C;AACA;AACD;;AAED,QAAMQ,YAAY,GAAG,EACpB,GAAGP,kBADiB;AAEpB,OAAGI;AAFiB,GAArB;AAKA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGxB,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAGX,EAAE,CAAE,YAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,2DADe;AAHjB,IADD,EAQC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,4CADX;AAEC,IAAA,MAAM,EAAGkB,eAFV;AAGC,IAAA,SAAS,EAAGC,kBAHb;AAIC,IAAA,mBAAmB,EAAG,CAAEH,sBAJzB;AAKC,IAAA,sBAAsB,EAAG,CAAEC,yBAL5B;AAMC,IAAA,gCAAgC,MANjC;AAOC,IAAA,SAAS,EAAG,KAPb;AAQC,IAAA,WAAW,MARZ;AASC,IAAA,iCAAiC;AATlC,KAUMqB,YAVN,EARD,CADD;AAuBA;;AAED,eAAe7B,qBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseColorsPerOrigin,\n\tuseGradientsPerOrigin,\n\tuseSetting,\n\tuseStyle,\n} from './hooks';\n\nfunction ScreenBackgroundColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ gradients ] = useSetting( 'color.gradients', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ areCustomGradientsEnabled ] = useSetting(\n\t\t'color.customGradient',\n\t\tname\n\t);\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\tconst gradientsPerOrigin = useGradientsPerOrigin( name );\n\n\tconst [ isBackgroundEnabled ] = useSetting( 'color.background', name );\n\n\tconst hasBackgroundColor =\n\t\tsupports.includes( 'backgroundColor' ) &&\n\t\tisBackgroundEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\tconst hasGradientColor =\n\t\tsupports.includes( 'background' ) &&\n\t\t( gradients.length > 0 || areCustomGradientsEnabled );\n\tconst [ backgroundColor, setBackgroundColor ] = useStyle(\n\t\t'color.background',\n\t\tname\n\t);\n\tconst [ userBackgroundColor ] = useStyle(\n\t\t'color.background',\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ gradient, setGradient ] = useStyle( 'color.gradient', name );\n\tconst [ userGradient ] = useStyle( 'color.gradient', name, 'user' );\n\n\tif ( ! hasBackgroundColor && ! hasGradientColor ) {\n\t\treturn null;\n\t}\n\n\tlet backgroundSettings = {};\n\tif ( hasBackgroundColor ) {\n\t\tbackgroundSettings = {\n\t\t\tcolorValue: backgroundColor,\n\t\t\tonColorChange: setBackgroundColor,\n\t\t};\n\t\tif ( backgroundColor ) {\n\t\t\tbackgroundSettings.clearable =\n\t\t\t\tbackgroundColor === userBackgroundColor;\n\t\t}\n\t}\n\n\tlet gradientSettings = {};\n\tif ( hasGradientColor ) {\n\t\tgradientSettings = {\n\t\t\tgradientValue: gradient,\n\t\t\tonGradientChange: setGradient,\n\t\t};\n\t\tif ( gradient ) {\n\t\t\tgradientSettings.clearable = gradient === userGradient;\n\t\t}\n\t}\n\n\tconst controlProps = {\n\t\t...backgroundSettings,\n\t\t...gradientSettings,\n\t};\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Background' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set a background color or gradient for the whole website.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-background-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tgradients={ gradientsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\tdisableCustomGradients={ ! areCustomGradientsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\t{ ...controlProps }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenBackgroundColor;\n"]}
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __ } from '@wordpress/i18n';
7
- import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';
7
+ import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
@@ -30,25 +30,21 @@ function ScreenLinkColor(_ref) {
30
30
  return null;
31
31
  }
32
32
 
33
- const settings = [{
34
- colorValue: linkColor,
35
- onColorChange: setLinkColor,
36
- label: __('Link color'),
37
- clearable: linkColor === userLinkColor
38
- }];
39
33
  return createElement(Fragment, null, createElement(ScreenHeader, {
40
34
  back: parentMenu + '/colors',
41
35
  title: __('Links'),
42
36
  description: __('Set the default color used for links across the site.')
43
- }), createElement(PanelColorGradientSettings, {
44
- title: __('Color'),
45
- settings: settings,
37
+ }), createElement(ColorGradientControl, {
38
+ className: "edit-site-screen-link-color__control",
46
39
  colors: colorsPerOrigin,
47
40
  disableCustomColors: !areCustomSolidsEnabled,
48
41
  __experimentalHasMultipleOrigins: true,
49
42
  showTitle: false,
50
43
  enableAlpha: true,
51
- __experimentalIsRenderedInSidebar: true
44
+ __experimentalIsRenderedInSidebar: true,
45
+ colorValue: linkColor,
46
+ onColorChange: setLinkColor,
47
+ clearable: linkColor === userLinkColor
52
48
  }));
53
49
  }
54
50
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["__","__experimentalPanelColorGradientSettings","PanelColorGradientSettings","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenLinkColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","linkColor","setLinkColor","userLinkColor","settings","colorValue","onColorChange","label","clearable"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,wCAAwC,IAAIC,0BAArD,QAAuF,yBAAvF;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACpC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,QAAQ,GAAGR,8BAA8B,CAAEK,IAAF,CAA/C;AACA,QAAM,CAAEI,MAAF,IAAaR,UAAU,CAAE,eAAF,EAAmBI,IAAnB,CAA7B;AACA,QAAM,CAAEK,sBAAF,IAA6BT,UAAU,CAAE,cAAF,EAAkBI,IAAlB,CAA7C;AAEA,QAAMM,eAAe,GAAGR,kBAAkB,CAAEE,IAAF,CAA1C;AAEA,QAAM,CAAEO,aAAF,IAAoBX,UAAU,CAAE,YAAF,EAAgBI,IAAhB,CAApC;AAEA,QAAMQ,YAAY,GACjBL,QAAQ,CAACM,QAAT,CAAmB,WAAnB,KACAF,aADA,KAEEH,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,SAAF,EAAaC,YAAb,IAA8Bf,QAAQ,CAC3C,0BAD2C,EAE3CG,IAF2C,CAA5C;AAIA,QAAM,CAAEa,aAAF,IAAoBhB,QAAQ,CACjC,0BADiC,EAEjCG,IAFiC,EAGjC,MAHiC,CAAlC;;AAMA,MAAK,CAAEQ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,QAAMM,QAAQ,GAAG,CAChB;AACCC,IAAAA,UAAU,EAAEJ,SADb;AAECK,IAAAA,aAAa,EAAEJ,YAFhB;AAGCK,IAAAA,KAAK,EAAE1B,EAAE,CAAE,YAAF,CAHV;AAIC2B,IAAAA,SAAS,EAAEP,SAAS,KAAKE;AAJ1B,GADgB,CAAjB;AASA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGZ,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,OAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,uDADe;AAHjB,IADD,EASC,cAAC,0BAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,QAAQ,EAAGuB,QAFZ;AAGC,IAAA,MAAM,EAAGR,eAHV;AAIC,IAAA,mBAAmB,EAAG,CAAED,sBAJzB;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,SAAS,EAAG,KANb;AAOC,IAAA,WAAW,MAPZ;AAQC,IAAA,iCAAiC;AARlC,IATD,CADD;AAsBA;;AAED,eAAeN,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n} from './hooks';\n\nfunction ScreenLinkColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst [ isLinkEnabled ] = useSetting( 'color.link', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ linkColor, setLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname\n\t);\n\tconst [ userLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasLinkColor ) {\n\t\treturn null;\n\t}\n\n\tconst settings = [\n\t\t{\n\t\t\tcolorValue: linkColor,\n\t\t\tonColorChange: setLinkColor,\n\t\t\tlabel: __( 'Link color' ),\n\t\t\tclearable: linkColor === userLinkColor,\n\t\t},\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Links' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for links across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<PanelColorGradientSettings\n\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\tsettings={ settings }\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenLinkColor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-link-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenLinkColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","colorsPerOrigin","isLinkEnabled","hasLinkColor","includes","length","linkColor","setLinkColor","userLinkColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACpC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,QAAQ,GAAGR,8BAA8B,CAAEK,IAAF,CAA/C;AACA,QAAM,CAAEI,MAAF,IAAaR,UAAU,CAAE,eAAF,EAAmBI,IAAnB,CAA7B;AACA,QAAM,CAAEK,sBAAF,IAA6BT,UAAU,CAAE,cAAF,EAAkBI,IAAlB,CAA7C;AAEA,QAAMM,eAAe,GAAGR,kBAAkB,CAAEE,IAAF,CAA1C;AAEA,QAAM,CAAEO,aAAF,IAAoBX,UAAU,CAAE,YAAF,EAAgBI,IAAhB,CAApC;AAEA,QAAMQ,YAAY,GACjBL,QAAQ,CAACM,QAAT,CAAmB,WAAnB,KACAF,aADA,KAEEH,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,SAAF,EAAaC,YAAb,IAA8Bf,QAAQ,CAC3C,0BAD2C,EAE3CG,IAF2C,CAA5C;AAIA,QAAM,CAAEa,aAAF,IAAoBhB,QAAQ,CACjC,0BADiC,EAEjCG,IAFiC,EAGjC,MAHiC,CAAlC;;AAMA,MAAK,CAAEQ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGP,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,OAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,uDADe;AAHjB,IADD,EAQC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,MAAM,EAAGe,eAFV;AAGC,IAAA,mBAAmB,EAAG,CAAED,sBAHzB;AAIC,IAAA,gCAAgC,MAJjC;AAKC,IAAA,SAAS,EAAG,KALb;AAMC,IAAA,WAAW,MANZ;AAOC,IAAA,iCAAiC,MAPlC;AAQC,IAAA,UAAU,EAAGM,SARd;AASC,IAAA,aAAa,EAAGC,YATjB;AAUC,IAAA,SAAS,EAAGD,SAAS,KAAKE;AAV3B,IARD,CADD;AAuBA;;AAED,eAAed,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n} from './hooks';\n\nfunction ScreenLinkColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst [ isLinkEnabled ] = useSetting( 'color.link', name );\n\n\tconst hasLinkColor =\n\t\tsupports.includes( 'linkColor' ) &&\n\t\tisLinkEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ linkColor, setLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname\n\t);\n\tconst [ userLinkColor ] = useStyle(\n\t\t'elements.link.color.text',\n\t\tname,\n\t\t'user'\n\t);\n\n\tif ( ! hasLinkColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Links' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for links across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-link-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ linkColor }\n\t\t\t\tonColorChange={ setLinkColor }\n\t\t\t\tclearable={ linkColor === userLinkColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenLinkColor;\n"]}
@@ -4,7 +4,7 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __ } from '@wordpress/i18n';
7
- import { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';
7
+ import { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';
8
8
  /**
9
9
  * Internal dependencies
10
10
  */
@@ -30,25 +30,21 @@ function ScreenTextColor(_ref) {
30
30
  return null;
31
31
  }
32
32
 
33
- const settings = [{
34
- colorValue: color,
35
- onColorChange: setColor,
36
- label: __('Text color'),
37
- clearable: color === userColor
38
- }];
39
33
  return createElement(Fragment, null, createElement(ScreenHeader, {
40
34
  back: parentMenu + '/colors',
41
35
  title: __('Text'),
42
36
  description: __('Set the default color used for text across the site.')
43
- }), createElement(PanelColorGradientSettings, {
44
- title: __('Color'),
45
- settings: settings,
37
+ }), createElement(ColorGradientControl, {
38
+ className: "edit-site-screen-text-color__control",
46
39
  colors: colorsPerOrigin,
47
40
  disableCustomColors: !areCustomSolidsEnabled,
48
41
  __experimentalHasMultipleOrigins: true,
49
42
  showTitle: false,
50
43
  enableAlpha: true,
51
- __experimentalIsRenderedInSidebar: true
44
+ __experimentalIsRenderedInSidebar: true,
45
+ colorValue: color,
46
+ onColorChange: setColor,
47
+ clearable: color === userColor
52
48
  }));
53
49
  }
54
50
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["__","__experimentalPanelColorGradientSettings","PanelColorGradientSettings","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenTextColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor","settings","colorValue","onColorChange","label","clearable"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,wCAAwC,IAAIC,0BAArD,QAAuF,yBAAvF;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACpC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,QAAQ,GAAGR,8BAA8B,CAAEK,IAAF,CAA/C;AACA,QAAM,CAAEI,MAAF,IAAaR,UAAU,CAAE,eAAF,EAAmBI,IAAnB,CAA7B;AACA,QAAM,CAAEK,sBAAF,IAA6BT,UAAU,CAAE,cAAF,EAAkBI,IAAlB,CAA7C;AACA,QAAM,CAAEM,aAAF,IAAoBV,UAAU,CAAE,YAAF,EAAgBI,IAAhB,CAApC;AAEA,QAAMO,eAAe,GAAGT,kBAAkB,CAAEE,IAAF,CAA1C;AAEA,QAAMQ,YAAY,GACjBL,QAAQ,CAACM,QAAT,CAAmB,OAAnB,KACAH,aADA,KAEEF,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,KAAF,EAASC,QAAT,IAAsBf,QAAQ,CAAE,YAAF,EAAgBG,IAAhB,CAApC;AACA,QAAM,CAAEa,SAAF,IAAgBhB,QAAQ,CAAE,YAAF,EAAgBG,IAAhB,EAAsB,MAAtB,CAA9B;;AAEA,MAAK,CAAEQ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,QAAMM,QAAQ,GAAG,CAChB;AACCC,IAAAA,UAAU,EAAEJ,KADb;AAECK,IAAAA,aAAa,EAAEJ,QAFhB;AAGCK,IAAAA,KAAK,EAAE1B,EAAE,CAAE,YAAF,CAHV;AAIC2B,IAAAA,SAAS,EAAEP,KAAK,KAAKE;AAJtB,GADgB,CAAjB;AASA,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGZ,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,MAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,sDADe;AAHjB,IADD,EASC,cAAC,0BAAD;AACC,IAAA,KAAK,EAAGA,EAAE,CAAE,OAAF,CADX;AAEC,IAAA,QAAQ,EAAGuB,QAFZ;AAGC,IAAA,MAAM,EAAGP,eAHV;AAIC,IAAA,mBAAmB,EAAG,CAAEF,sBAJzB;AAKC,IAAA,gCAAgC,MALjC;AAMC,IAAA,SAAS,EAAG,KANb;AAOC,IAAA,WAAW,MAPZ;AAQC,IAAA,iCAAiC;AARlC,IATD,CADD;AAsBA;;AAED,eAAeN,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalPanelColorGradientSettings as PanelColorGradientSettings } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n} from './hooks';\n\nfunction ScreenTextColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ isTextEnabled ] = useSetting( 'color.text', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ color, setColor ] = useStyle( 'color.text', name );\n\tconst [ userColor ] = useStyle( 'color.text', name, 'user' );\n\n\tif ( ! hasTextColor ) {\n\t\treturn null;\n\t}\n\n\tconst settings = [\n\t\t{\n\t\t\tcolorValue: color,\n\t\t\tonColorChange: setColor,\n\t\t\tlabel: __( 'Text color' ),\n\t\t\tclearable: color === userColor,\n\t\t},\n\t];\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Text' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for text across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\n\t\t\t<PanelColorGradientSettings\n\t\t\t\ttitle={ __( 'Color' ) }\n\t\t\t\tsettings={ settings }\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/screen-text-color.js"],"names":["__","__experimentalColorGradientControl","ColorGradientControl","ScreenHeader","getSupportedGlobalStylesPanels","useSetting","useStyle","useColorsPerOrigin","ScreenTextColor","name","parentMenu","undefined","supports","solids","areCustomSolidsEnabled","isTextEnabled","colorsPerOrigin","hasTextColor","includes","length","color","setColor","userColor"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,kCAAkC,IAAIC,oBAA/C,QAA2E,yBAA3E;AAEA;AACA;AACA;;AACA,OAAOC,YAAP,MAAyB,UAAzB;AACA,SACCC,8BADD,EAECC,UAFD,EAGCC,QAHD,EAICC,kBAJD,QAKO,SALP;;AAOA,SAASC,eAAT,OAAqC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACpC,QAAMC,UAAU,GAAGD,IAAI,KAAKE,SAAT,GAAqB,EAArB,GAA0B,aAAaF,IAA1D;AACA,QAAMG,QAAQ,GAAGR,8BAA8B,CAAEK,IAAF,CAA/C;AACA,QAAM,CAAEI,MAAF,IAAaR,UAAU,CAAE,eAAF,EAAmBI,IAAnB,CAA7B;AACA,QAAM,CAAEK,sBAAF,IAA6BT,UAAU,CAAE,cAAF,EAAkBI,IAAlB,CAA7C;AACA,QAAM,CAAEM,aAAF,IAAoBV,UAAU,CAAE,YAAF,EAAgBI,IAAhB,CAApC;AAEA,QAAMO,eAAe,GAAGT,kBAAkB,CAAEE,IAAF,CAA1C;AAEA,QAAMQ,YAAY,GACjBL,QAAQ,CAACM,QAAT,CAAmB,OAAnB,KACAH,aADA,KAEEF,MAAM,CAACM,MAAP,GAAgB,CAAhB,IAAqBL,sBAFvB,CADD;AAKA,QAAM,CAAEM,KAAF,EAASC,QAAT,IAAsBf,QAAQ,CAAE,YAAF,EAAgBG,IAAhB,CAApC;AACA,QAAM,CAAEa,SAAF,IAAgBhB,QAAQ,CAAE,YAAF,EAAgBG,IAAhB,EAAsB,MAAtB,CAA9B;;AAEA,MAAK,CAAEQ,YAAP,EAAsB;AACrB,WAAO,IAAP;AACA;;AAED,SACC,8BACC,cAAC,YAAD;AACC,IAAA,IAAI,EAAGP,UAAU,GAAG,SADrB;AAEC,IAAA,KAAK,EAAGV,EAAE,CAAE,MAAF,CAFX;AAGC,IAAA,WAAW,EAAGA,EAAE,CACf,sDADe;AAHjB,IADD,EAQC,cAAC,oBAAD;AACC,IAAA,SAAS,EAAC,sCADX;AAEC,IAAA,MAAM,EAAGgB,eAFV;AAGC,IAAA,mBAAmB,EAAG,CAAEF,sBAHzB;AAIC,IAAA,gCAAgC,MAJjC;AAKC,IAAA,SAAS,EAAG,KALb;AAMC,IAAA,WAAW,MANZ;AAOC,IAAA,iCAAiC,MAPlC;AAQC,IAAA,UAAU,EAAGM,KARd;AASC,IAAA,aAAa,EAAGC,QATjB;AAUC,IAAA,SAAS,EAAGD,KAAK,KAAKE;AAVvB,IARD,CADD;AAuBA;;AAED,eAAed,eAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { __experimentalColorGradientControl as ColorGradientControl } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport ScreenHeader from './header';\nimport {\n\tgetSupportedGlobalStylesPanels,\n\tuseSetting,\n\tuseStyle,\n\tuseColorsPerOrigin,\n} from './hooks';\n\nfunction ScreenTextColor( { name } ) {\n\tconst parentMenu = name === undefined ? '' : '/blocks/' + name;\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\tconst [ solids ] = useSetting( 'color.palette', name );\n\tconst [ areCustomSolidsEnabled ] = useSetting( 'color.custom', name );\n\tconst [ isTextEnabled ] = useSetting( 'color.text', name );\n\n\tconst colorsPerOrigin = useColorsPerOrigin( name );\n\n\tconst hasTextColor =\n\t\tsupports.includes( 'color' ) &&\n\t\tisTextEnabled &&\n\t\t( solids.length > 0 || areCustomSolidsEnabled );\n\n\tconst [ color, setColor ] = useStyle( 'color.text', name );\n\tconst [ userColor ] = useStyle( 'color.text', name, 'user' );\n\n\tif ( ! hasTextColor ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ScreenHeader\n\t\t\t\tback={ parentMenu + '/colors' }\n\t\t\t\ttitle={ __( 'Text' ) }\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Set the default color used for text across the site.'\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t<ColorGradientControl\n\t\t\t\tclassName=\"edit-site-screen-text-color__control\"\n\t\t\t\tcolors={ colorsPerOrigin }\n\t\t\t\tdisableCustomColors={ ! areCustomSolidsEnabled }\n\t\t\t\t__experimentalHasMultipleOrigins\n\t\t\t\tshowTitle={ false }\n\t\t\t\tenableAlpha\n\t\t\t\t__experimentalIsRenderedInSidebar\n\t\t\t\tcolorValue={ color }\n\t\t\t\tonColorChange={ setColor }\n\t\t\t\tclearable={ color === userColor }\n\t\t\t/>\n\t\t</>\n\t);\n}\n\nexport default ScreenTextColor;\n"]}
@@ -4,15 +4,21 @@ import { createElement, Fragment } from "@wordpress/element";
4
4
  * WordPress dependencies
5
5
  */
6
6
  import { __, _x } from '@wordpress/i18n';
7
- import { moreVertical } from '@wordpress/icons';
8
- import { DropdownMenu, MenuGroup } from '@wordpress/components';
7
+ import { useReducer } from '@wordpress/element';
8
+ import { useShortcut } from '@wordpress/keyboard-shortcuts';
9
+ import { displayShortcut } from '@wordpress/keycodes';
10
+ import { external, moreVertical } from '@wordpress/icons';
11
+ import { DropdownMenu, MenuGroup, MenuItem, VisuallyHidden } from '@wordpress/components';
9
12
  import { ActionItem } from '@wordpress/interface';
10
13
  /**
11
14
  * Internal dependencies
12
15
  */
13
16
 
17
+ import KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';
14
18
  import FeatureToggle from '../feature-toggle';
15
19
  import ToolsMoreMenuGroup from '../tools-more-menu-group';
20
+ import SiteExport from './site-export';
21
+ import WelcomeGuideMenuItem from './welcome-guide-menu-item';
16
22
  const POPOVER_PROPS = {
17
23
  className: 'edit-site-more-menu__content',
18
24
  position: 'bottom left'
@@ -20,44 +26,63 @@ const POPOVER_PROPS = {
20
26
  const TOGGLE_PROPS = {
21
27
  tooltipPosition: 'bottom'
22
28
  };
23
-
24
- const MoreMenu = () => createElement(DropdownMenu, {
25
- className: "edit-site-more-menu",
26
- icon: moreVertical,
27
- label: __('More tools & options'),
28
- popoverProps: POPOVER_PROPS,
29
- toggleProps: TOGGLE_PROPS
30
- }, _ref => {
31
- let {
32
- onClose
33
- } = _ref;
34
- return createElement(Fragment, null, createElement(MenuGroup, {
35
- label: _x('View', 'noun')
36
- }, createElement(FeatureToggle, {
37
- feature: "fixedToolbar",
38
- label: __('Top toolbar'),
39
- info: __('Access all block and document tools in a single place'),
40
- messageActivated: __('Top toolbar activated'),
41
- messageDeactivated: __('Top toolbar deactivated')
42
- }), createElement(FeatureToggle, {
43
- feature: "focusMode",
44
- label: __('Spotlight mode'),
45
- info: __('Focus on one block at a time'),
46
- messageActivated: __('Spotlight mode activated'),
47
- messageDeactivated: __('Spotlight mode deactivated')
48
- }), createElement(ActionItem.Slot, {
49
- name: "core/edit-site/plugin-more-menu",
50
- label: __('Plugins'),
51
- as: MenuGroup,
52
- fillProps: {
53
- onClick: onClose
54
- }
55
- })), createElement(ToolsMoreMenuGroup.Slot, {
56
- fillProps: {
29
+ export default function MoreMenu() {
30
+ const [isModalActive, toggleModal] = useReducer(isActive => !isActive, false);
31
+ useShortcut('core/edit-site/keyboard-shortcuts', toggleModal);
32
+ return createElement(Fragment, null, createElement(DropdownMenu, {
33
+ className: "edit-site-more-menu",
34
+ icon: moreVertical,
35
+ label: __('More tools & options'),
36
+ popoverProps: POPOVER_PROPS,
37
+ toggleProps: TOGGLE_PROPS
38
+ }, _ref => {
39
+ let {
57
40
  onClose
58
- }
41
+ } = _ref;
42
+ return createElement(Fragment, null, createElement(MenuGroup, {
43
+ label: _x('View', 'noun')
44
+ }, createElement(FeatureToggle, {
45
+ feature: "fixedToolbar",
46
+ label: __('Top toolbar'),
47
+ info: __('Access all block and document tools in a single place'),
48
+ messageActivated: __('Top toolbar activated'),
49
+ messageDeactivated: __('Top toolbar deactivated')
50
+ }), createElement(FeatureToggle, {
51
+ feature: "focusMode",
52
+ label: __('Spotlight mode'),
53
+ info: __('Focus on one block at a time'),
54
+ messageActivated: __('Spotlight mode activated'),
55
+ messageDeactivated: __('Spotlight mode deactivated')
56
+ }), createElement(ActionItem.Slot, {
57
+ name: "core/edit-site/plugin-more-menu",
58
+ label: __('Plugins'),
59
+ as: MenuGroup,
60
+ fillProps: {
61
+ onClick: onClose
62
+ }
63
+ })), createElement(MenuGroup, {
64
+ label: __('Tools')
65
+ }, createElement(SiteExport, null), createElement(MenuItem, {
66
+ onClick: toggleModal,
67
+ shortcut: displayShortcut.access('h')
68
+ }, __('Keyboard shortcuts')), createElement(WelcomeGuideMenuItem, null), createElement(MenuItem, {
69
+ icon: external,
70
+ role: "menuitem",
71
+ href: __('https://wordpress.org/support/article/site-editor/'),
72
+ target: "_blank",
73
+ rel: "noopener noreferrer"
74
+ }, __('Help'), createElement(VisuallyHidden, {
75
+ as: "span"
76
+ },
77
+ /* translators: accessibility text */
78
+ __('(opens in a new tab)'))), createElement(ToolsMoreMenuGroup.Slot, {
79
+ fillProps: {
80
+ onClose
81
+ }
82
+ })));
83
+ }), createElement(KeyboardShortcutHelpModal, {
84
+ isModalActive: isModalActive,
85
+ toggleModal: toggleModal
59
86
  }));
60
- });
61
-
62
- export default MoreMenu;
87
+ }
63
88
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/index.js"],"names":["__","_x","moreVertical","DropdownMenu","MenuGroup","ActionItem","FeatureToggle","ToolsMoreMenuGroup","POPOVER_PROPS","className","position","TOGGLE_PROPS","tooltipPosition","MoreMenu","onClose","onClick"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASC,YAAT,EAAuBC,SAAvB,QAAwC,uBAAxC;AACA,SAASC,UAAT,QAA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,CAFX;AAGC,IAAA,EAAE,EAAGI,SAHN;AAIC,IAAA,SAAS,EAAG;AAAEW,MAAAA,OAAO,EAAED;AAAX;AAJb,IAnBD,CADD,EA2BC,cAAC,kBAAD,CAAoB,IAApB;AAAyB,IAAA,SAAS,EAAG;AAAEA,MAAAA;AAAF;AAArC,IA3BD,CADC;AAAA,CAPH,CADD;;AA0CA,eAAeD,QAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { moreVertical } from '@wordpress/icons';\nimport { DropdownMenu, MenuGroup } from '@wordpress/components';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport FeatureToggle from '../feature-toggle';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\n\nconst POPOVER_PROPS = {\n\tclassName: 'edit-site-more-menu__content',\n\tposition: 'bottom left',\n};\nconst TOGGLE_PROPS = {\n\ttooltipPosition: 'bottom',\n};\n\nconst MoreMenu = () => (\n\t<DropdownMenu\n\t\tclassName=\"edit-site-more-menu\"\n\t\ticon={ moreVertical }\n\t\tlabel={ __( 'More tools & options' ) }\n\t\tpopoverProps={ POPOVER_PROPS }\n\t\ttoggleProps={ TOGGLE_PROPS }\n\t>\n\t\t{ ( { onClose } ) => (\n\t\t\t<>\n\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t<FeatureToggle\n\t\t\t\t\t\tfeature=\"fixedToolbar\"\n\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tmessageActivated={ __( 'Top toolbar activated' ) }\n\t\t\t\t\t\tmessageDeactivated={ __( 'Top toolbar deactivated' ) }\n\t\t\t\t\t/>\n\t\t\t\t\t<FeatureToggle\n\t\t\t\t\t\tfeature=\"focusMode\"\n\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\t\t\tmessageActivated={ __( 'Spotlight mode activated' ) }\n\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t'Spotlight mode deactivated'\n\t\t\t\t\t\t) }\n\t\t\t\t\t/>\n\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\tname=\"core/edit-site/plugin-more-menu\"\n\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t/>\n\t\t\t\t</MenuGroup>\n\t\t\t\t<ToolsMoreMenuGroup.Slot fillProps={ { onClose } } />\n\t\t\t</>\n\t\t) }\n\t</DropdownMenu>\n);\n\nexport default MoreMenu;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/index.js"],"names":["__","_x","useReducer","useShortcut","displayShortcut","external","moreVertical","DropdownMenu","MenuGroup","MenuItem","VisuallyHidden","ActionItem","KeyboardShortcutHelpModal","FeatureToggle","ToolsMoreMenuGroup","SiteExport","WelcomeGuideMenuItem","POPOVER_PROPS","className","position","TOGGLE_PROPS","tooltipPosition","MoreMenu","isModalActive","toggleModal","isActive","onClose","onClick","access"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,UAAT,QAA2B,oBAA3B;AACA,SAASC,WAAT,QAA4B,+BAA5B;AACA,SAASC,eAAT,QAAgC,qBAAhC;AACA,SAASC,QAAT,EAAmBC,YAAnB,QAAuC,kBAAvC;AACA,SACCC,YADD,EAECC,SAFD,EAGCC,QAHD,EAICC,cAJD,QAKO,uBALP;AAMA,SAASC,UAAT,QAA2B,sBAA3B;AAEA;AACA;AACA;;AACA,OAAOC,yBAAP,MAAsC,oCAAtC;AACA,OAAOC,aAAP,MAA0B,mBAA1B;AACA,OAAOC,kBAAP,MAA+B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JtB;AAOC,MAAA,kBAAkB,EAAGA,EAAE,CACtB,4BADsB;AAPxB,MAdD,EAyBC,cAAC,UAAD,CAAY,IAAZ;AACC,MAAA,IAAI,EAAC,iCADN;AAEC,MAAA,KAAK,EAAGA,EAAE,CAAE,SAAF,CAFX;AAGC,MAAA,EAAE,EAAGQ,SAHN;AAIC,MAAA,SAAS,EAAG;AAAEmB,QAAAA,OAAO,EAAED;AAAX;AAJb,MAzBD,CADD,EAiCC,cAAC,SAAD;AAAW,MAAA,KAAK,EAAG1B,EAAE,CAAE,OAAF;AAArB,OACC,cAAC,UAAD,OADD,EAEC,cAAC,QAAD;AACC,MAAA,OAAO,EAAGwB,WADX;AAEC,MAAA,QAAQ,EAAGpB,eAAe,CAACwB,MAAhB,CAAwB,GAAxB;AAFZ,OAIG5B,EAAE,CAAE,oBAAF,CAJL,CAFD,EAQC,cAAC,oBAAD,OARD,EASC,cAAC,QAAD;AACC,MAAA,IAAI,EAAGK,QADR;AAEC,MAAA,IAAI,EAAC,UAFN;AAGC,MAAA,IAAI,EAAGL,EAAE,CACR,oDADQ,CAHV;AAMC,MAAA,MAAM,EAAC,QANR;AAOC,MAAA,GAAG,EAAC;AAPL,OASGA,EAAE,CAAE,MAAF,CATL,EAUC,cAAC,cAAD;AAAgB,MAAA,EAAE,EAAC;AAAnB;AAEE;AACAA,IAAAA,EAAE,CAAE,sBAAF,CAHJ,CAVD,CATD,EA0BC,cAAC,kBAAD,CAAoB,IAApB;AACC,MAAA,SAAS,EAAG;AAAE0B,QAAAA;AAAF;AADb,MA1BD,CAjCD,CADC;AAAA,GAPH,CADD,EA2EC,cAAC,yBAAD;AACC,IAAA,aAAa,EAAGH,aADjB;AAEC,IAAA,WAAW,EAAGC;AAFf,IA3ED,CADD;AAkFA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { useReducer } from '@wordpress/element';\nimport { useShortcut } from '@wordpress/keyboard-shortcuts';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { external, moreVertical } from '@wordpress/icons';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tVisuallyHidden,\n} from '@wordpress/components';\nimport { ActionItem } from '@wordpress/interface';\n\n/**\n * Internal dependencies\n */\nimport KeyboardShortcutHelpModal from '../../keyboard-shortcut-help-modal';\nimport FeatureToggle from '../feature-toggle';\nimport ToolsMoreMenuGroup from '../tools-more-menu-group';\nimport SiteExport from './site-export';\nimport WelcomeGuideMenuItem from './welcome-guide-menu-item';\n\nconst POPOVER_PROPS = {\n\tclassName: 'edit-site-more-menu__content',\n\tposition: 'bottom left',\n};\nconst TOGGLE_PROPS = {\n\ttooltipPosition: 'bottom',\n};\n\nexport default function MoreMenu() {\n\tconst [ isModalActive, toggleModal ] = useReducer(\n\t\t( isActive ) => ! isActive,\n\t\tfalse\n\t);\n\n\tuseShortcut( 'core/edit-site/keyboard-shortcuts', toggleModal );\n\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"edit-site-more-menu\"\n\t\t\t\ticon={ moreVertical }\n\t\t\t\tlabel={ __( 'More tools & options' ) }\n\t\t\t\tpopoverProps={ POPOVER_PROPS }\n\t\t\t\ttoggleProps={ TOGGLE_PROPS }\n\t\t\t>\n\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<MenuGroup label={ _x( 'View', 'noun' ) }>\n\t\t\t\t\t\t\t<FeatureToggle\n\t\t\t\t\t\t\t\tfeature=\"fixedToolbar\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Top toolbar' ) }\n\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t'Access all block and document tools in a single place'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Top toolbar deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<FeatureToggle\n\t\t\t\t\t\t\t\tfeature=\"focusMode\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Spotlight mode' ) }\n\t\t\t\t\t\t\t\tinfo={ __( 'Focus on one block at a time' ) }\n\t\t\t\t\t\t\t\tmessageActivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode activated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\tmessageDeactivated={ __(\n\t\t\t\t\t\t\t\t\t'Spotlight mode deactivated'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<ActionItem.Slot\n\t\t\t\t\t\t\t\tname=\"core/edit-site/plugin-more-menu\"\n\t\t\t\t\t\t\t\tlabel={ __( 'Plugins' ) }\n\t\t\t\t\t\t\t\tas={ MenuGroup }\n\t\t\t\t\t\t\t\tfillProps={ { onClick: onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t<MenuGroup label={ __( 'Tools' ) }>\n\t\t\t\t\t\t\t<SiteExport />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tonClick={ toggleModal }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.access( 'h' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Keyboard shortcuts' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<WelcomeGuideMenuItem />\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\ticon={ external }\n\t\t\t\t\t\t\t\trole=\"menuitem\"\n\t\t\t\t\t\t\t\thref={ __(\n\t\t\t\t\t\t\t\t\t'https://wordpress.org/support/article/site-editor/'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\trel=\"noopener noreferrer\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ __( 'Help' ) }\n\t\t\t\t\t\t\t\t<VisuallyHidden as=\"span\">\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t/* translators: accessibility text */\n\t\t\t\t\t\t\t\t\t\t__( '(opens in a new tab)' )\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t<ToolsMoreMenuGroup.Slot\n\t\t\t\t\t\t\t\tfillProps={ { onClose } }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t<KeyboardShortcutHelpModal\n\t\t\t\tisModalActive={ isModalActive }\n\t\t\t\ttoggleModal={ toggleModal }\n\t\t\t/>\n\t\t</>\n\t);\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/header/more-menu/site-export.js"],"names":["downloadjs","__","_x","MenuItem","apiFetch","download","useDispatch","store","noticesStore","SiteExport","createErrorNotice","handleExport","response","path","parse","blob","errorResponse","error","json","e","errorMessage","message","code","type"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,EAAT,EAAaC,EAAb,QAAuB,iBAAvB;AACA,SAASC,QAAT,QAAyB,uBAAzB;AACA,OAAOC,QAAP,MAAqB,sBAArB;AACA,SAASC,QAAT,QAAyB,kBAAzB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,UAAT,GAAsB;AACpC,QAAM;AAAEC,IAAAA;AAAF,MAAwBJ,WAAW,CAAEE,YAAF,CAAzC;;AAEA,iBAAeG,YAAf,GAA8B;AAC7B,QAAI;AACH,YAAMC,QAAQ,GAAG,MAAMR,QAAQ,CAAE;AAChCS,QAAAA,IAAI,EAAE,4BAD0B;AAEhCC,QAAAA,KAAK,EAAE;AAFyB,OAAF,CAA/B;AAIA,YAAMC,IAAI,GAAG,MAAMH,QAAQ,CAACG,IAAT,EAAnB;AAEAf,MAAAA,UAAU,CAAEe,IAAF,EAAQ,sBAAR,EAAgC,iBAAhC,CAAV;AACA,KARD,CAQE,OAAQC,aAAR,EAAwB;AACzB,UAAIC,KAAK,GAAG,EAAZ;;AACA,UAAI;AACHA,QAAAA,KAAK,GAAG,MAAMD,aAAa,CAACE,IAAd,EAAd;AACA,OAFD,CAEE,OAAQC,CAAR,EAAY,CAAE;;AAChB,YAAMC,YAAY,GACjBH,KAAK,CAACI,OAAN,IAAiBJ,KAAK,CAACK,IAAN,KAAe,eAAhC,GACGL,KAAK,CAACI,OADT,GAEGpB,EAAE,CAAE,mDAAF,CAHN;AAKAS,MAAAA,iBAAiB,CAAEU,YAAF,EAAgB;AAAEG,QAAAA,IAAI,EAAE;AAAR,OAAhB,CAAjB;AACA;AACD;;AAED,SACC,cAAC,QAAD;AACC,IAAA,IAAI,EAAC,UADN;AAEC,IAAA,IAAI,EAAGlB,QAFR;AAGC,IAAA,OAAO,EAAGM,YAHX;AAIC,IAAA,IAAI,EAAGV,EAAE,CAAE,6CAAF;AAJV,KAMGC,EAAE,CAAE,QAAF,EAAY,yBAAZ,CANL,CADD;AAUA","sourcesContent":["/**\n * External dependencies\n */\nimport downloadjs from 'downloadjs';\n\n/**\n * WordPress dependencies\n */\nimport { __, _x } from '@wordpress/i18n';\nimport { MenuItem } from '@wordpress/components';\nimport apiFetch from '@wordpress/api-fetch';\nimport { download } from '@wordpress/icons';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function SiteExport() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tasync function handleExport() {\n\t\ttry {\n\t\t\tconst response = await apiFetch( {\n\t\t\t\tpath: '/wp-block-editor/v1/export',\n\t\t\t\tparse: false,\n\t\t\t} );\n\t\t\tconst blob = await response.blob();\n\n\t\t\tdownloadjs( blob, 'edit-site-export.zip', 'application/zip' );\n\t\t} catch ( errorResponse ) {\n\t\t\tlet error = {};\n\t\t\ttry {\n\t\t\t\terror = await errorResponse.json();\n\t\t\t} catch ( e ) {}\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while creating the site export.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<MenuItem\n\t\t\trole=\"menuitem\"\n\t\t\ticon={ download }\n\t\t\tonClick={ handleExport }\n\t\t\tinfo={ __( 'Download your templates and template parts.' ) }\n\t\t>\n\t\t\t{ _x( 'Export', 'site exporter menu item' ) }\n\t\t</MenuItem>\n\t);\n}\n"]}