@wordpress/edit-site 5.3.3 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/components/add-new-template/new-template.js +1 -20
  3. package/build/components/add-new-template/new-template.js.map +1 -1
  4. package/build/components/app/index.js.map +1 -1
  5. package/build/components/block-editor/editor-canvas.js +1 -0
  6. package/build/components/block-editor/editor-canvas.js.map +1 -1
  7. package/build/components/editor/index.js +3 -1
  8. package/build/components/editor/index.js.map +1 -1
  9. package/build/components/global-styles/border-panel.js +4 -4
  10. package/build/components/global-styles/border-panel.js.map +1 -1
  11. package/build/components/global-styles/color-palette-panel.js +5 -2
  12. package/build/components/global-styles/color-palette-panel.js.map +1 -1
  13. package/build/components/global-styles/color-utils.js +1 -1
  14. package/build/components/global-styles/color-utils.js.map +1 -1
  15. package/build/components/global-styles/context-menu.js +16 -3
  16. package/build/components/global-styles/context-menu.js.map +1 -1
  17. package/build/components/global-styles/custom-css.js +1 -1
  18. package/build/components/global-styles/custom-css.js.map +1 -1
  19. package/build/components/global-styles/dimensions-panel.js +8 -7
  20. package/build/components/global-styles/dimensions-panel.js.map +1 -1
  21. package/build/components/global-styles/gradients-palette-panel.js +8 -3
  22. package/build/components/global-styles/gradients-palette-panel.js.map +1 -1
  23. package/build/components/global-styles/header.js +3 -1
  24. package/build/components/global-styles/header.js.map +1 -1
  25. package/build/components/global-styles/hooks.js +14 -51
  26. package/build/components/global-styles/hooks.js.map +1 -1
  27. package/build/components/global-styles/palette.js +3 -1
  28. package/build/components/global-styles/palette.js.map +1 -1
  29. package/build/components/global-styles/screen-background-color.js +3 -2
  30. package/build/components/global-styles/screen-background-color.js.map +1 -1
  31. package/build/components/global-styles/screen-block-list.js +14 -3
  32. package/build/components/global-styles/screen-block-list.js.map +1 -1
  33. package/build/components/global-styles/screen-button-color.js +7 -5
  34. package/build/components/global-styles/screen-button-color.js.map +1 -1
  35. package/build/components/global-styles/screen-colors.js +8 -6
  36. package/build/components/global-styles/screen-colors.js.map +1 -1
  37. package/build/components/global-styles/screen-heading-color.js +8 -6
  38. package/build/components/global-styles/screen-heading-color.js.map +1 -1
  39. package/build/components/global-styles/screen-link-color.js +3 -2
  40. package/build/components/global-styles/screen-link-color.js.map +1 -1
  41. package/build/components/global-styles/screen-text-color.js +3 -2
  42. package/build/components/global-styles/screen-text-color.js.map +1 -1
  43. package/build/components/global-styles/screen-typography.js +3 -1
  44. package/build/components/global-styles/screen-typography.js.map +1 -1
  45. package/build/components/global-styles/shadow-panel.js +2 -3
  46. package/build/components/global-styles/shadow-panel.js.map +1 -1
  47. package/build/components/global-styles/subtitle.js +3 -2
  48. package/build/components/global-styles/subtitle.js.map +1 -1
  49. package/build/components/global-styles/typography-panel.js +23 -300
  50. package/build/components/global-styles/typography-panel.js.map +1 -1
  51. package/build/components/navigation-inspector/index.js +0 -29
  52. package/build/components/navigation-inspector/index.js.map +1 -1
  53. package/build/components/navigation-inspector/navigation-menu.js +4 -2
  54. package/build/components/navigation-inspector/navigation-menu.js.map +1 -1
  55. package/build/components/sidebar/index.js +1 -20
  56. package/build/components/sidebar/index.js.map +1 -1
  57. package/build/components/sidebar-edit-mode/index.js +1 -1
  58. package/build/components/sidebar-edit-mode/index.js.map +1 -1
  59. package/build/components/sidebar-edit-mode/template-card/index.js +9 -2
  60. package/build/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  61. package/build/components/sidebar-edit-mode/template-card/last-revision.js +84 -0
  62. package/build/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  63. package/build/components/start-template-options/index.js +175 -0
  64. package/build/components/start-template-options/index.js.map +1 -0
  65. package/build/hooks/push-changes-to-global-styles/index.js +5 -4
  66. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  67. package/build-module/components/add-new-template/new-template.js +1 -18
  68. package/build-module/components/add-new-template/new-template.js.map +1 -1
  69. package/build-module/components/app/index.js.map +1 -1
  70. package/build-module/components/block-editor/editor-canvas.js +1 -0
  71. package/build-module/components/block-editor/editor-canvas.js.map +1 -1
  72. package/build-module/components/editor/index.js +2 -1
  73. package/build-module/components/editor/index.js.map +1 -1
  74. package/build-module/components/global-styles/border-panel.js +5 -5
  75. package/build-module/components/global-styles/border-panel.js.map +1 -1
  76. package/build-module/components/global-styles/color-palette-panel.js +5 -2
  77. package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
  78. package/build-module/components/global-styles/color-utils.js +2 -2
  79. package/build-module/components/global-styles/color-utils.js.map +1 -1
  80. package/build-module/components/global-styles/context-menu.js +13 -2
  81. package/build-module/components/global-styles/context-menu.js.map +1 -1
  82. package/build-module/components/global-styles/custom-css.js +1 -1
  83. package/build-module/components/global-styles/custom-css.js.map +1 -1
  84. package/build-module/components/global-styles/dimensions-panel.js +9 -8
  85. package/build-module/components/global-styles/dimensions-panel.js.map +1 -1
  86. package/build-module/components/global-styles/gradients-palette-panel.js +8 -3
  87. package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -1
  88. package/build-module/components/global-styles/header.js +3 -1
  89. package/build-module/components/global-styles/header.js.map +1 -1
  90. package/build-module/components/global-styles/hooks.js +12 -49
  91. package/build-module/components/global-styles/hooks.js.map +1 -1
  92. package/build-module/components/global-styles/palette.js +3 -1
  93. package/build-module/components/global-styles/palette.js.map +1 -1
  94. package/build-module/components/global-styles/screen-background-color.js +4 -3
  95. package/build-module/components/global-styles/screen-background-color.js.map +1 -1
  96. package/build-module/components/global-styles/screen-block-list.js +12 -3
  97. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  98. package/build-module/components/global-styles/screen-button-color.js +8 -6
  99. package/build-module/components/global-styles/screen-button-color.js.map +1 -1
  100. package/build-module/components/global-styles/screen-colors.js +9 -7
  101. package/build-module/components/global-styles/screen-colors.js.map +1 -1
  102. package/build-module/components/global-styles/screen-heading-color.js +9 -7
  103. package/build-module/components/global-styles/screen-heading-color.js.map +1 -1
  104. package/build-module/components/global-styles/screen-link-color.js +4 -3
  105. package/build-module/components/global-styles/screen-link-color.js.map +1 -1
  106. package/build-module/components/global-styles/screen-text-color.js +4 -3
  107. package/build-module/components/global-styles/screen-text-color.js.map +1 -1
  108. package/build-module/components/global-styles/screen-typography.js +3 -1
  109. package/build-module/components/global-styles/screen-typography.js.map +1 -1
  110. package/build-module/components/global-styles/shadow-panel.js +3 -4
  111. package/build-module/components/global-styles/shadow-panel.js.map +1 -1
  112. package/build-module/components/global-styles/subtitle.js +3 -2
  113. package/build-module/components/global-styles/subtitle.js.map +1 -1
  114. package/build-module/components/global-styles/typography-panel.js +27 -300
  115. package/build-module/components/global-styles/typography-panel.js.map +1 -1
  116. package/build-module/components/navigation-inspector/index.js +0 -27
  117. package/build-module/components/navigation-inspector/index.js.map +1 -1
  118. package/build-module/components/navigation-inspector/navigation-menu.js +4 -2
  119. package/build-module/components/navigation-inspector/navigation-menu.js.map +1 -1
  120. package/build-module/components/sidebar/index.js +1 -18
  121. package/build-module/components/sidebar/index.js.map +1 -1
  122. package/build-module/components/sidebar-edit-mode/index.js +1 -1
  123. package/build-module/components/sidebar-edit-mode/index.js.map +1 -1
  124. package/build-module/components/sidebar-edit-mode/template-card/index.js +9 -4
  125. package/build-module/components/sidebar-edit-mode/template-card/index.js.map +1 -1
  126. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js +70 -0
  127. package/build-module/components/sidebar-edit-mode/template-card/last-revision.js.map +1 -0
  128. package/build-module/components/start-template-options/index.js +156 -0
  129. package/build-module/components/start-template-options/index.js.map +1 -0
  130. package/build-module/hooks/push-changes-to-global-styles/index.js +6 -5
  131. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  132. package/build-style/style-rtl.css +73 -4
  133. package/build-style/style.css +73 -4
  134. package/package.json +31 -31
  135. package/src/components/add-new-template/new-template.js +1 -16
  136. package/src/components/app/index.js +0 -1
  137. package/src/components/block-editor/editor-canvas.js +1 -0
  138. package/src/components/editor/index.js +2 -0
  139. package/src/components/global-styles/border-panel.js +5 -5
  140. package/src/components/global-styles/color-palette-panel.js +3 -0
  141. package/src/components/global-styles/color-utils.js +2 -3
  142. package/src/components/global-styles/context-menu.js +17 -2
  143. package/src/components/global-styles/custom-css.js +1 -1
  144. package/src/components/global-styles/dimensions-panel.js +12 -8
  145. package/src/components/global-styles/gradients-palette-panel.js +4 -1
  146. package/src/components/global-styles/header.js +7 -1
  147. package/src/components/global-styles/hooks.js +17 -90
  148. package/src/components/global-styles/palette.js +1 -1
  149. package/src/components/global-styles/screen-background-color.js +3 -2
  150. package/src/components/global-styles/screen-block-list.js +19 -3
  151. package/src/components/global-styles/screen-button-color.js +8 -6
  152. package/src/components/global-styles/screen-colors.js +7 -7
  153. package/src/components/global-styles/screen-heading-color.js +9 -7
  154. package/src/components/global-styles/screen-link-color.js +3 -2
  155. package/src/components/global-styles/screen-text-color.js +3 -2
  156. package/src/components/global-styles/screen-typography.js +1 -1
  157. package/src/components/global-styles/shadow-panel.js +6 -3
  158. package/src/components/global-styles/style.scss +5 -0
  159. package/src/components/global-styles/subtitle.js +5 -2
  160. package/src/components/global-styles/typography-panel.js +30 -394
  161. package/src/components/navigation-inspector/index.js +0 -32
  162. package/src/components/navigation-inspector/navigation-menu.js +8 -2
  163. package/src/components/sidebar/index.js +4 -17
  164. package/src/components/sidebar-edit-mode/index.js +1 -1
  165. package/src/components/sidebar-edit-mode/template-card/index.js +24 -14
  166. package/src/components/sidebar-edit-mode/template-card/last-revision.js +75 -0
  167. package/src/components/sidebar-edit-mode/template-card/style.scss +4 -0
  168. package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +0 -4
  169. package/src/components/start-template-options/index.js +171 -0
  170. package/src/components/start-template-options/style.scss +76 -0
  171. package/src/hooks/push-changes-to-global-styles/index.js +26 -21
  172. package/src/style.scss +1 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["apiFetch","addQueryArgs","DropdownMenu","MenuGroup","MenuItem","NavigableMenu","useState","useDispatch","store","coreStore","archive","blockMeta","category","home","list","media","notFound","page","plus","post","postAuthor","postDate","search","tag","layout","customGenericTemplateIcon","__","sprintf","noticesStore","AddCustomTemplateModal","useExistingTemplates","useDefaultTemplateTypes","useTaxonomiesMenuItems","usePostTypeMenuItems","useAuthorMenuItem","usePostTypeArchiveMenuItems","AddCustomGenericTemplateModal","TemplateActionsLoadingScreen","useHistory","editSiteStore","unlock","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","single","index","author","taxonomy","date","attachment","NewTemplate","postType","toggleProps","showIcon","showCustomTemplateModal","setShowCustomTemplateModal","showCustomGenericTemplateModal","setShowCustomGenericTemplateModal","entityForSuggestions","setEntityForSuggestions","isCreatingTemplate","setIsCreatingTemplate","history","saveEntityRecord","createErrorNotice","createSuccessNotice","setTemplate","setCanvasMode","createTemplate","template","isWPSuggestion","title","description","slug","templatePrefix","templateContent","content","fallbackTemplate","path","is_custom","template_prefix","raw","newTemplate","toString","status","is_wp_suggestion","throwOnError","id","window","queueMicrotask","push","postId","type","error","errorMessage","message","code","missingTemplates","useMissingTemplates","length","labels","add_new","add_new_item","noArrow","map","onClick","icon","existingTemplates","defaultTemplateTypes","existingTemplateSlugs","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","authorMenuItem","forEach","menuItem","matchIndex","findIndex","sort","template1","template2","indexOf"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,QAAP,MAAqB,sBAArB;AACA,SAASC,YAAT,QAA6B,gBAA7B;AACA,SACCC,YADD,EAECC,SAFD,EAGCC,QAHD,EAICC,aAJD,QAKO,uBALP;AAMA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SACCC,OADD,EAEC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C,SAAF,EAAaC,SAAb,KAA4B;AACtE,WACCrF,sBAAsB,CAACsF,OAAvB,CAAgCF,SAAS,CAACrD,IAA1C,IACA/B,sBAAsB,CAACsF,OAAvB,CAAgCD,SAAS,CAACtD,IAA1C,CAFD;AAIA,GALD;AAMA,QAAMwB,gBAAgB,GAAG,CACxB,GAAGkB,mCADqB,EAExB,GAAG/E,2BAA2B,EAFN,EAGxB,GAAGmF,kBAHqB,EAIxB,GAAGF,mBAJqB,CAAzB;AAMA,SAAOpB,gBAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\nimport { addQueryArgs } from '@wordpress/url';\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tarchive,\n\tblockMeta,\n\tcategory,\n\thome,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tplus,\n\tpost,\n\tpostAuthor,\n\tpostDate,\n\tsearch,\n\ttag,\n\tlayout as customGenericTemplateIcon,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModal from './add-custom-template-modal';\nimport {\n\tuseExistingTemplates,\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModal from './add-custom-generic-template-modal';\nimport TemplateActionsLoadingScreen from './template-actions-loading-screen';\nimport { useHistory } from '../routes';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'taxonomy',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\tsingle: post,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: postAuthor,\n\ttaxonomy: blockMeta,\n\tdate: postDate,\n\ttag,\n\tattachment: media,\n};\n\nexport default function NewTemplate( {\n\tpostType,\n\ttoggleProps,\n\tshowIcon = true,\n} ) {\n\tconst [ showCustomTemplateModal, setShowCustomTemplateModal ] =\n\t\tuseState( false );\n\tconst [\n\t\tshowCustomGenericTemplateModal,\n\t\tsetShowCustomGenericTemplateModal,\n\t] = useState( false );\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isCreatingTemplate, setIsCreatingTemplate ] = useState( false );\n\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { setTemplate, setCanvasMode } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isCreatingTemplate ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingTemplate( true );\n\t\ttry {\n\t\t\tconst { title, description, slug, templatePrefix } = template;\n\t\t\tlet templateContent = template.content;\n\t\t\t// Try to find fallback content from existing templates.\n\t\t\tif ( ! templateContent ) {\n\t\t\t\tconst fallbackTemplate = await apiFetch( {\n\t\t\t\t\tpath: addQueryArgs( '/wp/v2/templates/lookup', {\n\t\t\t\t\t\tslug,\n\t\t\t\t\t\tis_custom: ! isWPSuggestion,\n\t\t\t\t\t\ttemplate_prefix: templatePrefix,\n\t\t\t\t\t} ),\n\t\t\t\t} );\n\t\t\t\ttemplateContent = fallbackTemplate.content.raw;\n\t\t\t}\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\tcontent: templateContent,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Set template before navigating away to avoid initial stale value.\n\t\t\tsetTemplate( newTemplate.id, newTemplate.slug );\n\t\t\t// Switch to edit mode.\n\t\t\tsetCanvasMode( 'edit' );\n\n\t\t\t// Navigate to the created template editor.\n\t\t\twindow.queueMicrotask( () => {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: newTemplate.id,\n\t\t\t\t\tpostType: newTemplate.type,\n\t\t\t\t\tpath: '/templates/single',\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\ttitle\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\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: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingTemplate( false );\n\t\t}\n\t}\n\n\tconst missingTemplates = useMissingTemplates(\n\t\tsetEntityForSuggestions,\n\t\tsetShowCustomTemplateModal\n\t);\n\tif ( ! missingTemplates.length ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"edit-site-new-template-dropdown\"\n\t\t\t\ticon={ showIcon ? plus : null }\n\t\t\t\ttext={ showIcon ? null : postType.labels.add_new }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tnoArrow: false,\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isCreatingTemplate && (\n\t\t\t\t\t\t\t<TemplateActionsLoadingScreen />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<NavigableMenu className=\"edit-site-new-template-dropdown__popover\">\n\t\t\t\t\t\t\t<MenuGroup label={ postType.labels.add_new_item }>\n\t\t\t\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\t\tonClick,\n\t\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\t} = template;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\ticon ||\n\t\t\t\t\t\t\t\t\t\t\t\tTEMPLATE_ICONS[ slug ] ||\n\t\t\t\t\t\t\t\t\t\t\t\tpost\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\t\tinfo={ description }\n\t\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\ticon={ customGenericTemplateIcon }\n\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Custom templates can be applied to any post or page.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tkey=\"custom-template\"\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetShowCustomGenericTemplateModal(\n\t\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Custom template' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t{ showCustomTemplateModal && (\n\t\t\t\t<AddCustomTemplateModal\n\t\t\t\t\tonClose={ () => setShowCustomTemplateModal( false ) }\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\tisCreatingTemplate={ isCreatingTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showCustomGenericTemplateModal && (\n\t\t\t\t<AddCustomGenericTemplateModal\n\t\t\t\t\tonClose={ () => setShowCustomGenericTemplateModal( false ) }\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t\tisCreatingTemplate={ isCreatingTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates(\n\tsetEntityForSuggestions,\n\tsetShowCustomTemplateModal\n) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) =>\n\t\t\tDEFAULT_TEMPLATE_SLUGS.includes( template.slug ) &&\n\t\t\t! existingTemplateSlugs.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tsetShowCustomTemplateModal( true );\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/add-new-template/new-template.js"],"names":["DropdownMenu","MenuGroup","MenuItem","NavigableMenu","useState","useDispatch","store","coreStore","archive","blockMeta","category","home","list","media","notFound","page","plus","post","postAuthor","postDate","search","tag","layout","customGenericTemplateIcon","__","sprintf","noticesStore","AddCustomTemplateModal","useExistingTemplates","useDefaultTemplateTypes","useTaxonomiesMenuItems","usePostTypeMenuItems","useAuthorMenuItem","usePostTypeArchiveMenuItems","AddCustomGenericTemplateModal","TemplateActionsLoadingScreen","useHistory","editSiteStore","unlock","DEFAULT_TEMPLATE_SLUGS","TEMPLATE_ICONS","single","index","author","taxonomy","date","attachment","NewTemplate","postType","toggleProps","showIcon","showCustomTemplateModal","setShowCustomTemplateModal","showCustomGenericTemplateModal","setShowCustomGenericTemplateModal","entityForSuggestions","setEntityForSuggestions","isCreatingTemplate","setIsCreatingTemplate","history","saveEntityRecord","createErrorNotice","createSuccessNotice","setTemplate","setCanvasMode","createTemplate","template","isWPSuggestion","title","description","slug","newTemplate","toString","status","is_wp_suggestion","throwOnError","id","window","queueMicrotask","push","postId","type","path","error","errorMessage","message","code","missingTemplates","useMissingTemplates","length","labels","add_new","add_new_item","noArrow","map","onClick","icon","existingTemplates","defaultTemplateTypes","existingTemplateSlugs","missingDefaultTemplates","filter","includes","onClickMenuItem","_entityForSuggestions","enhancedMissingDefaultTemplateTypes","defaultTaxonomiesMenuItems","taxonomiesMenuItems","defaultPostTypesMenuItems","postTypesMenuItems","authorMenuItem","forEach","menuItem","matchIndex","findIndex","sort","template1","template2","indexOf"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,YADD,EAECC,SAFD,EAGCC,QAHD,EAICC,aAJD,QAKO,uBALP;AAMA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SACCC,OADD,EAECC,SAFD,EAGCC,QAHD,EAICC,IAJD,EAKCC,IALD,EAMCC,KAND,EAOCC,QAPD,EAQCC,IARD,EASCC,IATD,EAUCC,IAVD,EAWCC,UAXD,EAYCC,QAZD,EAaCC,MAbD,EAcCC,GAdD,EAeCC,MAAM,IAAIC,yBAfX,QAgBO,kBAhBP;AAiBA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASnB,KAAK,IAAIoB,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,OAAOC,sBAAP,MAAmC,6BAAnC;AACA,SACCC,oBADD,EAECC,uBAFD,EAGCC,sBAHD,EAICC,oBAJD,EAKCC,iBALD,EAMCC,2BAND,QAOO,SAPP;AAQA,OAAOC,6BAAP,MAA0C,qCAA1C;AACA,OAAOC,4BAAP,MAAyC,mCAAzC;AACA,SAASC,UAAT,QAA2B,WAA3B;AACA,SAAS9B,KAAK,IAAI+B,aAAlB,QAAuC,aAAvC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAMC,sBAAsB,GAAG,CAC9B,YAD8B,EAE9B,QAF8B,EAG9B,MAH8B,EAI9B,OAJ8B,EAK9B,SAL8B,EAM9B,QAN8B,EAO9B,UAP8B,EAQ9B,MAR8B,EAS9B,KAT8B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SAAF,EAAaC,SAAb,KAA4B;AACtE,WACC9E,sBAAsB,CAAC+E,OAAvB,CAAgCF,SAAS,CAAC9C,IAA1C,IACA/B,sBAAsB,CAAC+E,OAAvB,CAAgCD,SAAS,CAAC/C,IAA1C,CAFD;AAIA,GALD;AAMA,QAAMiB,gBAAgB,GAAG,CACxB,GAAGkB,mCADqB,EAExB,GAAGxE,2BAA2B,EAFN,EAGxB,GAAG4E,kBAHqB,EAIxB,GAAGF,mBAJqB,CAAzB;AAMA,SAAOpB,gBAAP;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItem,\n\tNavigableMenu,\n} from '@wordpress/components';\nimport { useState } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport {\n\tarchive,\n\tblockMeta,\n\tcategory,\n\thome,\n\tlist,\n\tmedia,\n\tnotFound,\n\tpage,\n\tplus,\n\tpost,\n\tpostAuthor,\n\tpostDate,\n\tsearch,\n\ttag,\n\tlayout as customGenericTemplateIcon,\n} from '@wordpress/icons';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport AddCustomTemplateModal from './add-custom-template-modal';\nimport {\n\tuseExistingTemplates,\n\tuseDefaultTemplateTypes,\n\tuseTaxonomiesMenuItems,\n\tusePostTypeMenuItems,\n\tuseAuthorMenuItem,\n\tusePostTypeArchiveMenuItems,\n} from './utils';\nimport AddCustomGenericTemplateModal from './add-custom-generic-template-modal';\nimport TemplateActionsLoadingScreen from './template-actions-loading-screen';\nimport { useHistory } from '../routes';\nimport { store as editSiteStore } from '../../store';\nimport { unlock } from '../../private-apis';\n\nconst DEFAULT_TEMPLATE_SLUGS = [\n\t'front-page',\n\t'single',\n\t'page',\n\t'index',\n\t'archive',\n\t'author',\n\t'category',\n\t'date',\n\t'tag',\n\t'taxonomy',\n\t'search',\n\t'404',\n];\n\nconst TEMPLATE_ICONS = {\n\t'front-page': home,\n\tsingle: post,\n\tpage,\n\tarchive,\n\tsearch,\n\t404: notFound,\n\tindex: list,\n\tcategory,\n\tauthor: postAuthor,\n\ttaxonomy: blockMeta,\n\tdate: postDate,\n\ttag,\n\tattachment: media,\n};\n\nexport default function NewTemplate( {\n\tpostType,\n\ttoggleProps,\n\tshowIcon = true,\n} ) {\n\tconst [ showCustomTemplateModal, setShowCustomTemplateModal ] =\n\t\tuseState( false );\n\tconst [\n\t\tshowCustomGenericTemplateModal,\n\t\tsetShowCustomGenericTemplateModal,\n\t] = useState( false );\n\tconst [ entityForSuggestions, setEntityForSuggestions ] = useState( {} );\n\tconst [ isCreatingTemplate, setIsCreatingTemplate ] = useState( false );\n\n\tconst history = useHistory();\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst { createErrorNotice, createSuccessNotice } =\n\t\tuseDispatch( noticesStore );\n\tconst { setTemplate, setCanvasMode } = unlock(\n\t\tuseDispatch( editSiteStore )\n\t);\n\tasync function createTemplate( template, isWPSuggestion = true ) {\n\t\tif ( isCreatingTemplate ) {\n\t\t\treturn;\n\t\t}\n\t\tsetIsCreatingTemplate( true );\n\t\ttry {\n\t\t\tconst { title, description, slug } = template;\n\t\t\tconst newTemplate = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\tdescription,\n\t\t\t\t\t// Slugs need to be strings, so this is for template `404`\n\t\t\t\t\tslug: slug.toString(),\n\t\t\t\t\tstatus: 'publish',\n\t\t\t\t\ttitle,\n\t\t\t\t\t// This adds a post meta field in template that is part of `is_custom` value calculation.\n\t\t\t\t\tis_wp_suggestion: isWPSuggestion,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\n\t\t\t// Set template before navigating away to avoid initial stale value.\n\t\t\tsetTemplate( newTemplate.id, newTemplate.slug );\n\t\t\t// Switch to edit mode.\n\t\t\tsetCanvasMode( 'edit' );\n\n\t\t\t// Navigate to the created template editor.\n\t\t\twindow.queueMicrotask( () => {\n\t\t\t\thistory.push( {\n\t\t\t\t\tpostId: newTemplate.id,\n\t\t\t\t\tpostType: newTemplate.type,\n\t\t\t\t\tpath: '/templates/single',\n\t\t\t\t} );\n\t\t\t} );\n\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the created template e.g: \"Category\".\n\t\t\t\t\t__( '\"%s\" successfully created.' ),\n\t\t\t\t\ttitle\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t}\n\t\t\t);\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: __( 'An error occurred while creating the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} finally {\n\t\t\tsetIsCreatingTemplate( false );\n\t\t}\n\t}\n\n\tconst missingTemplates = useMissingTemplates(\n\t\tsetEntityForSuggestions,\n\t\tsetShowCustomTemplateModal\n\t);\n\tif ( ! missingTemplates.length ) {\n\t\treturn null;\n\t}\n\treturn (\n\t\t<>\n\t\t\t<DropdownMenu\n\t\t\t\tclassName=\"edit-site-new-template-dropdown\"\n\t\t\t\ticon={ showIcon ? plus : null }\n\t\t\t\ttext={ showIcon ? null : postType.labels.add_new }\n\t\t\t\tlabel={ postType.labels.add_new_item }\n\t\t\t\tpopoverProps={ {\n\t\t\t\t\tnoArrow: false,\n\t\t\t\t} }\n\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t>\n\t\t\t\t{ () => (\n\t\t\t\t\t<>\n\t\t\t\t\t\t{ isCreatingTemplate && (\n\t\t\t\t\t\t\t<TemplateActionsLoadingScreen />\n\t\t\t\t\t\t) }\n\t\t\t\t\t\t<NavigableMenu className=\"edit-site-new-template-dropdown__popover\">\n\t\t\t\t\t\t\t<MenuGroup label={ postType.labels.add_new_item }>\n\t\t\t\t\t\t\t\t{ missingTemplates.map( ( template ) => {\n\t\t\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\t\t\tdescription,\n\t\t\t\t\t\t\t\t\t\tslug,\n\t\t\t\t\t\t\t\t\t\tonClick,\n\t\t\t\t\t\t\t\t\t\ticon,\n\t\t\t\t\t\t\t\t\t} = template;\n\t\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\ticon ||\n\t\t\t\t\t\t\t\t\t\t\t\tTEMPLATE_ICONS[ slug ] ||\n\t\t\t\t\t\t\t\t\t\t\t\tpost\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\t\t\tinfo={ description }\n\t\t\t\t\t\t\t\t\t\t\tkey={ slug }\n\t\t\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\t\t\tonClick\n\t\t\t\t\t\t\t\t\t\t\t\t\t? onClick( template )\n\t\t\t\t\t\t\t\t\t\t\t\t\t: createTemplate( template )\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ title }\n\t\t\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\ticon={ customGenericTemplateIcon }\n\t\t\t\t\t\t\t\t\ticonPosition=\"left\"\n\t\t\t\t\t\t\t\t\tinfo={ __(\n\t\t\t\t\t\t\t\t\t\t'Custom templates can be applied to any post or page.'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tkey=\"custom-template\"\n\t\t\t\t\t\t\t\t\tonClick={ () =>\n\t\t\t\t\t\t\t\t\t\tsetShowCustomGenericTemplateModal(\n\t\t\t\t\t\t\t\t\t\t\ttrue\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Custom template' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t</NavigableMenu>\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</DropdownMenu>\n\t\t\t{ showCustomTemplateModal && (\n\t\t\t\t<AddCustomTemplateModal\n\t\t\t\t\tonClose={ () => setShowCustomTemplateModal( false ) }\n\t\t\t\t\tonSelect={ createTemplate }\n\t\t\t\t\tentityForSuggestions={ entityForSuggestions }\n\t\t\t\t\tisCreatingTemplate={ isCreatingTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ showCustomGenericTemplateModal && (\n\t\t\t\t<AddCustomGenericTemplateModal\n\t\t\t\t\tonClose={ () => setShowCustomGenericTemplateModal( false ) }\n\t\t\t\t\tcreateTemplate={ createTemplate }\n\t\t\t\t\tisCreatingTemplate={ isCreatingTemplate }\n\t\t\t\t/>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nfunction useMissingTemplates(\n\tsetEntityForSuggestions,\n\tsetShowCustomTemplateModal\n) {\n\tconst existingTemplates = useExistingTemplates();\n\tconst defaultTemplateTypes = useDefaultTemplateTypes();\n\tconst existingTemplateSlugs = ( existingTemplates || [] ).map(\n\t\t( { slug } ) => slug\n\t);\n\tconst missingDefaultTemplates = ( defaultTemplateTypes || [] ).filter(\n\t\t( template ) =>\n\t\t\tDEFAULT_TEMPLATE_SLUGS.includes( template.slug ) &&\n\t\t\t! existingTemplateSlugs.includes( template.slug )\n\t);\n\tconst onClickMenuItem = ( _entityForSuggestions ) => {\n\t\tsetShowCustomTemplateModal( true );\n\t\tsetEntityForSuggestions( _entityForSuggestions );\n\t};\n\t// We need to replace existing default template types with\n\t// the create specific template functionality. The original\n\t// info (title, description, etc.) is preserved in the\n\t// used hooks.\n\tconst enhancedMissingDefaultTemplateTypes = [ ...missingDefaultTemplates ];\n\tconst { defaultTaxonomiesMenuItems, taxonomiesMenuItems } =\n\t\tuseTaxonomiesMenuItems( onClickMenuItem );\n\tconst { defaultPostTypesMenuItems, postTypesMenuItems } =\n\t\tusePostTypeMenuItems( onClickMenuItem );\n\n\tconst authorMenuItem = useAuthorMenuItem( onClickMenuItem );\n\t[\n\t\t...defaultTaxonomiesMenuItems,\n\t\t...defaultPostTypesMenuItems,\n\t\tauthorMenuItem,\n\t].forEach( ( menuItem ) => {\n\t\tif ( ! menuItem ) {\n\t\t\treturn;\n\t\t}\n\t\tconst matchIndex = enhancedMissingDefaultTemplateTypes.findIndex(\n\t\t\t( template ) => template.slug === menuItem.slug\n\t\t);\n\t\t// Some default template types might have been filtered above from\n\t\t// `missingDefaultTemplates` because they only check for the general\n\t\t// template. So here we either replace or append the item, augmented\n\t\t// with the check if it has available specific item to create a\n\t\t// template for.\n\t\tif ( matchIndex > -1 ) {\n\t\t\tenhancedMissingDefaultTemplateTypes[ matchIndex ] = menuItem;\n\t\t} else {\n\t\t\tenhancedMissingDefaultTemplateTypes.push( menuItem );\n\t\t}\n\t} );\n\t// Update the sort order to match the DEFAULT_TEMPLATE_SLUGS order.\n\tenhancedMissingDefaultTemplateTypes?.sort( ( template1, template2 ) => {\n\t\treturn (\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template1.slug ) -\n\t\t\tDEFAULT_TEMPLATE_SLUGS.indexOf( template2.slug )\n\t\t);\n\t} );\n\tconst missingTemplates = [\n\t\t...enhancedMissingDefaultTemplateTypes,\n\t\t...usePostTypeArchiveMenuItems(),\n\t\t...postTypesMenuItems,\n\t\t...taxonomiesMenuItems,\n\t];\n\treturn missingTemplates;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/app/index.js"],"names":["SlotFillProvider","Popover","UnsavedChangesWarning","ShortcutProvider","store","noticesStore","useDispatch","__","sprintf","PluginArea","Routes","Layout","App","createErrorNotice","onPluginAreaError","name","height"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,OAA3B,QAA0C,uBAA1C;AACA,SAASC,qBAAT,QAAsC,mBAAtC;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AAEA,eAAe,SAASC,GAAT,GAAe;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAwBP,WAAW,CAAED,YAAF,CAAzC;;AAEA,WAASS,iBAAT,CAA4BC,IAA5B,EAAmC;AAClCF,IAAAA,iBAAiB,CAChBL,OAAO;AACN;AACAD,IAAAA,EAAE,CACD,kEADC,CAFI,EAKNQ,IALM,CADS,CAAjB;AASA;;AAED,SACC,cAAC,gBAAD;AAAkB,IAAA,KAAK,EAAG;AAAEC,MAAAA,MAAM,EAAE;AAAV;AAA1B,KACC,cAAC,gBAAD,QACC,cAAC,OAAD,CAAS,IAAT,OADD,EAEC,cAAC,qBAAD,OAFD,EAIC,cAAC,MAAD,QACC,cAAC,MAAD,OADD,EAEC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAGF;AAAtB,IAFD,CAJD,CADD,CADD;AAaA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider, Popover } from '@wordpress/components';\nimport { UnsavedChangesWarning } from '@wordpress/editor';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\n\n/**\n * Internal dependencies\n */\nimport { Routes } from '../routes';\nimport Layout from '../layout';\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<ShortcutProvider style={ { height: '100%' } }>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<Popover.Slot />\n\t\t\t\t<UnsavedChangesWarning />\n\n\t\t\t\t<Routes>\n\t\t\t\t\t<Layout />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t</Routes>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/app/index.js"],"names":["SlotFillProvider","Popover","UnsavedChangesWarning","ShortcutProvider","store","noticesStore","useDispatch","__","sprintf","PluginArea","Routes","Layout","App","createErrorNotice","onPluginAreaError","name","height"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,gBAAT,EAA2BC,OAA3B,QAA0C,uBAA1C;AACA,SAASC,qBAAT,QAAsC,mBAAtC;AACA,SAASC,gBAAT,QAAiC,+BAAjC;AACA,SAASC,KAAK,IAAIC,YAAlB,QAAsC,oBAAtC;AACA,SAASC,WAAT,QAA4B,iBAA5B;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASC,UAAT,QAA2B,oBAA3B;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,WAAvB;AACA,OAAOC,MAAP,MAAmB,WAAnB;AAEA,eAAe,SAASC,GAAT,GAAe;AAC7B,QAAM;AAAEC,IAAAA;AAAF,MAAwBP,WAAW,CAAED,YAAF,CAAzC;;AAEA,WAASS,iBAAT,CAA4BC,IAA5B,EAAmC;AAClCF,IAAAA,iBAAiB,CAChBL,OAAO;AACN;AACAD,IAAAA,EAAE,CACD,kEADC,CAFI,EAKNQ,IALM,CADS,CAAjB;AASA;;AAED,SACC,cAAC,gBAAD;AAAkB,IAAA,KAAK,EAAG;AAAEC,MAAAA,MAAM,EAAE;AAAV;AAA1B,KACC,cAAC,gBAAD,QACC,cAAC,OAAD,CAAS,IAAT,OADD,EAEC,cAAC,qBAAD,OAFD,EAGC,cAAC,MAAD,QACC,cAAC,MAAD,OADD,EAEC,cAAC,UAAD;AAAY,IAAA,OAAO,EAAGF;AAAtB,IAFD,CAHD,CADD,CADD;AAYA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { SlotFillProvider, Popover } from '@wordpress/components';\nimport { UnsavedChangesWarning } from '@wordpress/editor';\nimport { ShortcutProvider } from '@wordpress/keyboard-shortcuts';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useDispatch } from '@wordpress/data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { PluginArea } from '@wordpress/plugins';\n\n/**\n * Internal dependencies\n */\nimport { Routes } from '../routes';\nimport Layout from '../layout';\n\nexport default function App() {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\n\tfunction onPluginAreaError( name ) {\n\t\tcreateErrorNotice(\n\t\t\tsprintf(\n\t\t\t\t/* translators: %s: plugin name */\n\t\t\t\t__(\n\t\t\t\t\t'The \"%s\" plugin has encountered an error and cannot be rendered.'\n\t\t\t\t),\n\t\t\t\tname\n\t\t\t)\n\t\t);\n\t}\n\n\treturn (\n\t\t<ShortcutProvider style={ { height: '100%' } }>\n\t\t\t<SlotFillProvider>\n\t\t\t\t<Popover.Slot />\n\t\t\t\t<UnsavedChangesWarning />\n\t\t\t\t<Routes>\n\t\t\t\t\t<Layout />\n\t\t\t\t\t<PluginArea onError={ onPluginAreaError } />\n\t\t\t\t</Routes>\n\t\t\t</SlotFillProvider>\n\t\t</ShortcutProvider>\n\t);\n}\n"]}
@@ -35,6 +35,7 @@ function EditorCanvas(_ref) {
35
35
  const deviceStyles = useResizeCanvas(deviceType);
36
36
  const mouseMoveTypingRef = useMouseMoveTypingReset();
37
37
  return createElement(Iframe, _extends({
38
+ expand: isZoomOutMode,
38
39
  scale: isZoomOutMode && 0.45 || undefined,
39
40
  frameSize: isZoomOutMode ? 100 : undefined,
40
41
  style: enableResizing ? {} : deviceStyles,
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"names":["__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","store","blockEditorStore","useSelect","useDispatch","unlock","editSiteStore","EditorCanvas","enableResizing","settings","children","props","canvasMode","deviceType","isZoomOutMode","select","__experimentalGetPreviewDeviceType","__unstableGetEditorMode","getCanvasMode","setCanvasMode","deviceStyles","mouseMoveTypingRef","undefined","styles","svgFilters"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,6BAA6B,IAAIC,eADlC,EAECC,sBAAsB,IAAIC,YAF3B,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,iCAAiC,IAAIC,uBAJtC,EAKCC,KAAK,IAAIC,gBALV,QAMO,yBANP;AAOA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASJ,KAAK,IAAIK,aAAlB,QAAuC,aAAvC;;AAEA,SAASC,YAAT,OAA0E;AAAA,MAAnD;AAAEC,IAAAA,cAAF;AAAkBC,IAAAA,QAAlB;AAA4BC,IAAAA,QAA5B;AAAsC,OAAGC;AAAzC,G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EGG,SAhCL;AAkCC,IAAA,QAAQ,EAAGV,UAAU,KAAK;AAlC3B,MAqCGH,QAAQ,CAACe,UArCZ,EAsCGd,QAtCH,CADD;AA0CA;;AAED,eAAeH,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nfunction EditorCanvas( { enableResizing, settings, children, ...props } ) {\n\tconst { canvasMode, deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst mouseMoveTypingRef = useMouseMoveTypingReset();\n\treturn (\n\t\t<Iframe\n\t\t\tscale={ ( isZoomOutMode && 0.45 ) || undefined }\n\t\t\tframeSize={ isZoomOutMode ? 100 : undefined }\n\t\t\tstyle={ enableResizing ? {} : deviceStyles }\n\t\t\thead={\n\t\t\t\t<>\n\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t<style>{\n\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t`.is-root-container { display: flow-root; }\n\t\t\t\t\t\t\tbody { position: relative; }`\n\t\t\t\t\t}</style>\n\t\t\t\t\t{ enableResizing && (\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\t\t\t\t`.is-root-container { min-height: 0 !important; }`\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tref={ mouseMoveTypingRef }\n\t\t\tname=\"editor-canvas\"\n\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t{ ...props }\n\t\t\trole={ canvasMode === 'view' ? 'button' : undefined }\n\t\t\tonClick={\n\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t? () => setCanvasMode( 'edit' )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\treadonly={ canvasMode === 'view' }\n\t\t>\n\t\t\t{ /* Filters need to be rendered before children to avoid Safari rendering issues. */ }\n\t\t\t{ settings.svgFilters }\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default EditorCanvas;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/block-editor/editor-canvas.js"],"names":["__experimentalUseResizeCanvas","useResizeCanvas","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","__unstableUseMouseMoveTypingReset","useMouseMoveTypingReset","store","blockEditorStore","useSelect","useDispatch","unlock","editSiteStore","EditorCanvas","enableResizing","settings","children","props","canvasMode","deviceType","isZoomOutMode","select","__experimentalGetPreviewDeviceType","__unstableGetEditorMode","getCanvasMode","setCanvasMode","deviceStyles","mouseMoveTypingRef","undefined","styles","svgFilters"],"mappings":";;;AAAA;AACA;AACA;AACA,SACCA,6BAA6B,IAAIC,eADlC,EAECC,sBAAsB,IAAIC,YAF3B,EAGCC,gBAAgB,IAAIC,MAHrB,EAICC,iCAA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AEC,6BACC;AACA;AACC;AACP,oCAJK,CAFD,EAQGf,cAAc,IACf,6BAEE;AACA;AACC,sDAJH,CATF,CANF;AAyBC,IAAA,GAAG,EAAGa,kBAzBP;AA0BC,IAAA,IAAI,EAAC,eA1BN;AA2BC,IAAA,SAAS,EAAC;AA3BX,KA4BMV,KA5BN;AA6BC,IAAA,IAAI,EAAGC,UAAU,KAAK,MAAf,GAAwB,QAAxB,GAAmCU,SA7B3C;AA8BC,IAAA,OAAO,EACNV,UAAU,KAAK,MAAf,GACG,MAAMO,aAAa,CAAE,MAAF,CADtB,GAEGG,SAjCL;AAmCC,IAAA,QAAQ,EAAGV,UAAU,KAAK;AAnC3B,MAsCGH,QAAQ,CAACe,UAtCZ,EAuCGd,QAvCH,CADD;AA2CA;;AAED,eAAeH,YAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalUseResizeCanvas as useResizeCanvas,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n\t__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport { useSelect, useDispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport { store as editSiteStore } from '../../store';\n\nfunction EditorCanvas( { enableResizing, settings, children, ...props } ) {\n\tconst { canvasMode, deviceType, isZoomOutMode } = useSelect(\n\t\t( select ) => ( {\n\t\t\tdeviceType:\n\t\t\t\tselect( editSiteStore ).__experimentalGetPreviewDeviceType(),\n\t\t\tisZoomOutMode:\n\t\t\t\tselect( blockEditorStore ).__unstableGetEditorMode() ===\n\t\t\t\t'zoom-out',\n\t\t\tcanvasMode: unlock( select( editSiteStore ) ).getCanvasMode(),\n\t\t} ),\n\t\t[]\n\t);\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst deviceStyles = useResizeCanvas( deviceType );\n\tconst mouseMoveTypingRef = useMouseMoveTypingReset();\n\treturn (\n\t\t<Iframe\n\t\t\texpand={ isZoomOutMode }\n\t\t\tscale={ ( isZoomOutMode && 0.45 ) || undefined }\n\t\t\tframeSize={ isZoomOutMode ? 100 : undefined }\n\t\t\tstyle={ enableResizing ? {} : deviceStyles }\n\t\t\thead={\n\t\t\t\t<>\n\t\t\t\t\t<EditorStyles styles={ settings.styles } />\n\t\t\t\t\t<style>{\n\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t`.is-root-container { display: flow-root; }\n\t\t\t\t\t\t\tbody { position: relative; }`\n\t\t\t\t\t}</style>\n\t\t\t\t\t{ enableResizing && (\n\t\t\t\t\t\t<style>\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t// Some themes will have `min-height: 100vh` for the root container,\n\t\t\t\t\t\t\t\t// which isn't a requirement in auto resize mode.\n\t\t\t\t\t\t\t\t`.is-root-container { min-height: 0 !important; }`\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</style>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t}\n\t\t\tref={ mouseMoveTypingRef }\n\t\t\tname=\"editor-canvas\"\n\t\t\tclassName=\"edit-site-visual-editor__editor-canvas\"\n\t\t\t{ ...props }\n\t\t\trole={ canvasMode === 'view' ? 'button' : undefined }\n\t\t\tonClick={\n\t\t\t\tcanvasMode === 'view'\n\t\t\t\t\t? () => setCanvasMode( 'edit' )\n\t\t\t\t\t: undefined\n\t\t\t}\n\t\t\treadonly={ canvasMode === 'view' }\n\t\t>\n\t\t\t{ /* Filters need to be rendered before children to avoid Safari rendering issues. */ }\n\t\t\t{ settings.svgFilters }\n\t\t\t{ children }\n\t\t</Iframe>\n\t);\n}\n\nexport default EditorCanvas;\n"]}
@@ -23,6 +23,7 @@ import KeyboardShortcuts from '../keyboard-shortcuts';
23
23
  import InserterSidebar from '../secondary-sidebar/inserter-sidebar';
24
24
  import ListViewSidebar from '../secondary-sidebar/list-view-sidebar';
25
25
  import WelcomeGuide from '../welcome-guide';
26
+ import StartTemplateOptions from '../start-template-options';
26
27
  import { store as editSiteStore } from '../../store';
27
28
  import { GlobalStylesRenderer } from '../global-styles-renderer';
28
29
  import { GlobalStylesProvider } from '../global-styles/global-styles-provider';
@@ -133,7 +134,7 @@ export default function Editor() {
133
134
  id: editedPostId
134
135
  }, createElement(GlobalStylesProvider, null, createElement(BlockContextProvider, {
135
136
  value: blockContext
136
- }, createElement(SidebarComplementaryAreaFills, null), createElement(InterfaceSkeleton, {
137
+ }, createElement(SidebarComplementaryAreaFills, null), isEditMode && createElement(StartTemplateOptions, null), createElement(InterfaceSkeleton, {
137
138
  enableRegionNavigation: false,
138
139
  className: showIconLabels && 'show-icon-labels',
139
140
  notices: isEditMode && createElement(EditorSnackbars, null),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["useMemo","useSelect","useDispatch","Notice","EntityProvider","store","preferencesStore","BlockContextProvider","BlockBreadcrumb","blockEditorStore","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorNotices","EditorSnackbars","__","sprintf","SidebarComplementaryAreaFills","BlockEditor","CodeEditor","KeyboardShortcuts","InserterSidebar","ListViewSidebar","WelcomeGuide","editSiteStore","GlobalStylesRenderer","GlobalStylesProvider","useTitle","CanvasSpinner","unlock","useEditedEntityRecord","interfaceLabels","body","sidebar","actions","footer","Editor","record","editedPost","getTitle","isLoaded","hasLoadedPost","id","editedPostId","type","editedPostType","context","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","select","getEditedPostContext","getEditorMode","getCanvasMode","isInserterOpened","isListViewOpened","__unstableGetEditorMode","getActiveComplementaryArea","name","get","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","showBlockBreakcrumb","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","queryContext","page","newQueryCont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eAAD,OADC,IAGCC,kBAAkB,IACnB,cAAC,eAAD,OALQ,CA9BZ;AAsCC,IAAA,OAAO,EACNJ,UAAU,IACVhB,kBADA,IAEC,cAAC,iBAAD,CAAmB,IAAnB;AAAwB,MAAA,KAAK,EAAC;AAA9B,MAzCH;AA4CC,IAAA,MAAM,EACLkB,mBAAmB,IAClB,cAAC,eAAD;AACC,MAAA,aAAa,EAAGrD,EAAE,CAAE,UAAF;AADnB,MA9CH;AAmDC,IAAA,MAAM,EAAG,EACR,GAAGgB,eADK;AAER8C,MAAAA,gBAAgB,EAAEN;AAFV;AAnDV,IAFD,CADD,CALD,CADD,CAHD,CADD;AA2EA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { EntityProvider } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { EditorNotices, EditorSnackbars } from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport WelcomeGuide from '../welcome-guide';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\nimport useTitle from '../routes/use-title';\nimport CanvasSpinner from '../canvas-spinner';\nimport { unlock } from '../../private-apis';\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function Editor() {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { id: editedPostId, type: editedPostType } = editedPost;\n\n\tconst {\n\t\tcontext,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\tgetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: getEditedPostContext(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setEditedPostContext } = useDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst showBlockBreakcrumb =\n\t\tisEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...context,\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t} ),\n\t\t[ context, setEditedPostContext ]\n\t);\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\tconst type =\n\t\t\teditedPostType === 'wp_template'\n\t\t\t\t? __( 'Template' )\n\t\t\t\t: __( 'Template Part' );\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s ‹ Editor' ),\n\t\t\tgetTitle(),\n\t\t\ttype\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tif ( ! hasLoadedPost ) {\n\t\treturn <CanvasSpinner />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tshowIconLabels && 'show-icon-labels'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnotices={ isEditMode && <EditorSnackbars /> }\n\t\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\t\teditedPost &&\n\t\t\t\t\t\t\t\t\t\t\tisEditMode && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ isEditMode && <KeyboardShortcuts /> }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t\t\t\t\t\t\t) ) )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\t\tshowBlockBreakcrumb && (\n\t\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\t\trootLabelText={ __( 'Template' ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t</GlobalStylesProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/editor/index.js"],"names":["useMemo","useSelect","useDispatch","Notice","EntityProvider","store","preferencesStore","BlockContextProvider","BlockBreadcrumb","blockEditorStore","InterfaceSkeleton","ComplementaryArea","interfaceStore","EditorNotices","EditorSnackbars","__","sprintf","SidebarComplementaryAreaFills","BlockEditor","CodeEditor","KeyboardShortcuts","InserterSidebar","ListViewSidebar","WelcomeGuide","StartTemplateOptions","editSiteStore","GlobalStylesRenderer","GlobalStylesProvider","useTitle","CanvasSpinner","unlock","useEditedEntityRecord","interfaceLabels","body","sidebar","actions","footer","Editor","record","editedPost","getTitle","isLoaded","hasLoadedPost","id","editedPostId","type","editedPostType","context","editorMode","canvasMode","blockEditorMode","isRightSidebarOpen","isInserterOpen","isListViewOpen","showIconLabels","select","getEditedPostContext","getEditorMode","getCanvasMode","isInserterOpened","isListViewOpened","__unstableGetEditorMode","getActiveComplementaryArea","name","get","setEditedPostContext","isViewMode","isEditMode","showVisualEditor","showBlockBreakcrumb","shouldShowInserter","shouldShowListView","secondarySidebarLabel","blockContext","queryContext","page","newQueryContext","title","secondarySidebar"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,OAAT,QAAwB,oBAAxB;AACA,SAASC,SAAT,EAAoBC,WAApB,QAAuC,iBAAvC;AACA,SAASC,MAAT,QAAuB,uBAAvB;AACA,SAASC,cAAT,QAA+B,sBAA/B;AACA,SAASC,KAAK,IAAIC,gBAAlB,QAA0C,wBAA1C;AACA,SACCC,oBADD,EAECC,eAFD,EAGCH,KAAK,IAAII,gBAHV,QAIO,yBAJP;AAKA,SACCC,iBADD,EAECC,iBAFD,EAGCN,KAAK,IAAIO,cAHV,QAIO,sBAJP;AAKA,SAASC,aAAT,EAAwBC,eAAxB,QAA+C,mBAA/C;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AAEA;AACA;AACA;;AACA,SAASC,6BAAT,QAA8C,sBAA9C;AACA,OAAOC,WAAP,MAAwB,iBAAxB;AACA,OAAOC,UAAP,MAAuB,gBAAvB;AACA,OAAOC,iBAAP,MAA8B,uBAA9B;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,eAAP,MAA4B,wCAA5B;AACA,OAAOC,YAAP,MAAy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IAAA,sBAAsB,EAAG,KAD1B;AAEC,IAAA,SAAS,EACRb,cAAc,IAAI,kBAHpB;AAKC,IAAA,OAAO,EAAGa,UAAU,IAAI,cAAC,eAAD,OALzB;AAMC,IAAA,OAAO,EACN,8BACC,cAAC,oBAAD,OADD,EAEGA,UAAU,IAAI,cAAC,aAAD,OAFjB,EAGGC,gBAAgB,IAAI7B,UAApB,IACD,cAAC,WAAD,OAJF,EAMGS,UAAU,KAAK,MAAf,IACDT,UADC,IAED4B,UAFC,IAEa,cAAC,UAAD,OARhB,EASGzB,aAAa,IAAI,CAAEH,UAAnB,IACD,cAAC,MAAD;AACC,MAAA,MAAM,EAAC,SADR;AAEC,MAAA,aAAa,EAAG;AAFjB,OAIGxB,EAAE,CACH,2EADG,CAJL,CAVF,EAmBGoD,UAAU,IAAI,cAAC,iBAAD,OAnBjB,CAPF;AA6BC,IAAA,gBAAgB,EACfA,UAAU,KACNG,kBAAkB,IACrB,cAAC,eAAD,OADC,IAGCC,kBAAkB,IACnB,cAAC,eAAD,OALQ,CA9BZ;AAsCC,IAAA,OAAO,EACNJ,UAAU,IACVhB,kBADA,IAEC,cAAC,iBAAD,CAAmB,IAAnB;AAAwB,MAAA,KAAK,EAAC;AAA9B,MAzCH;AA4CC,IAAA,MAAM,EACLkB,mBAAmB,IAClB,cAAC,eAAD;AACC,MAAA,aAAa,EAAGtD,EAAE,CAAE,UAAF;AADnB,MA9CH;AAmDC,IAAA,MAAM,EAAG,EACR,GAAGiB,eADK;AAER8C,MAAAA,gBAAgB,EAAEN;AAFV;AAnDV,IAHD,CADD,CALD,CADD,CAHD,CADD;AA4EA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useMemo } from '@wordpress/element';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Notice } from '@wordpress/components';\nimport { EntityProvider } from '@wordpress/core-data';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport {\n\tBlockContextProvider,\n\tBlockBreadcrumb,\n\tstore as blockEditorStore,\n} from '@wordpress/block-editor';\nimport {\n\tInterfaceSkeleton,\n\tComplementaryArea,\n\tstore as interfaceStore,\n} from '@wordpress/interface';\nimport { EditorNotices, EditorSnackbars } from '@wordpress/editor';\nimport { __, sprintf } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { SidebarComplementaryAreaFills } from '../sidebar-edit-mode';\nimport BlockEditor from '../block-editor';\nimport CodeEditor from '../code-editor';\nimport KeyboardShortcuts from '../keyboard-shortcuts';\nimport InserterSidebar from '../secondary-sidebar/inserter-sidebar';\nimport ListViewSidebar from '../secondary-sidebar/list-view-sidebar';\nimport WelcomeGuide from '../welcome-guide';\nimport StartTemplateOptions from '../start-template-options';\nimport { store as editSiteStore } from '../../store';\nimport { GlobalStylesRenderer } from '../global-styles-renderer';\nimport { GlobalStylesProvider } from '../global-styles/global-styles-provider';\nimport useTitle from '../routes/use-title';\nimport CanvasSpinner from '../canvas-spinner';\nimport { unlock } from '../../private-apis';\nimport useEditedEntityRecord from '../use-edited-entity-record';\n\nconst interfaceLabels = {\n\t/* translators: accessibility text for the editor content landmark region. */\n\tbody: __( 'Editor content' ),\n\t/* translators: accessibility text for the editor settings landmark region. */\n\tsidebar: __( 'Editor settings' ),\n\t/* translators: accessibility text for the editor publish landmark region. */\n\tactions: __( 'Editor publish' ),\n\t/* translators: accessibility text for the editor footer landmark region. */\n\tfooter: __( 'Editor footer' ),\n};\n\nexport default function Editor() {\n\tconst {\n\t\trecord: editedPost,\n\t\tgetTitle,\n\t\tisLoaded: hasLoadedPost,\n\t} = useEditedEntityRecord();\n\n\tconst { id: editedPostId, type: editedPostType } = editedPost;\n\n\tconst {\n\t\tcontext,\n\t\teditorMode,\n\t\tcanvasMode,\n\t\tblockEditorMode,\n\t\tisRightSidebarOpen,\n\t\tisInserterOpen,\n\t\tisListViewOpen,\n\t\tshowIconLabels,\n\t} = useSelect( ( select ) => {\n\t\tconst {\n\t\t\tgetEditedPostContext,\n\t\t\tgetEditorMode,\n\t\t\tgetCanvasMode,\n\t\t\tisInserterOpened,\n\t\t\tisListViewOpened,\n\t\t} = unlock( select( editSiteStore ) );\n\t\tconst { __unstableGetEditorMode } = select( blockEditorStore );\n\t\tconst { getActiveComplementaryArea } = select( interfaceStore );\n\n\t\t// The currently selected entity to display.\n\t\t// Typically template or template part in the site editor.\n\t\treturn {\n\t\t\tcontext: getEditedPostContext(),\n\t\t\teditorMode: getEditorMode(),\n\t\t\tcanvasMode: getCanvasMode(),\n\t\t\tblockEditorMode: __unstableGetEditorMode(),\n\t\t\tisInserterOpen: isInserterOpened(),\n\t\t\tisListViewOpen: isListViewOpened(),\n\t\t\tisRightSidebarOpen: getActiveComplementaryArea(\n\t\t\t\teditSiteStore.name\n\t\t\t),\n\t\t\tshowIconLabels: select( preferencesStore ).get(\n\t\t\t\t'core/edit-site',\n\t\t\t\t'showIconLabels'\n\t\t\t),\n\t\t};\n\t}, [] );\n\tconst { setEditedPostContext } = useDispatch( editSiteStore );\n\n\tconst isViewMode = canvasMode === 'view';\n\tconst isEditMode = canvasMode === 'edit';\n\tconst showVisualEditor = isViewMode || editorMode === 'visual';\n\tconst showBlockBreakcrumb =\n\t\tisEditMode && showVisualEditor && blockEditorMode !== 'zoom-out';\n\tconst shouldShowInserter = isEditMode && showVisualEditor && isInserterOpen;\n\tconst shouldShowListView = isEditMode && showVisualEditor && isListViewOpen;\n\tconst secondarySidebarLabel = isListViewOpen\n\t\t? __( 'List View' )\n\t\t: __( 'Block Library' );\n\tconst blockContext = useMemo(\n\t\t() => ( {\n\t\t\t...context,\n\t\t\tqueryContext: [\n\t\t\t\tcontext?.queryContext || { page: 1 },\n\t\t\t\t( newQueryContext ) =>\n\t\t\t\t\tsetEditedPostContext( {\n\t\t\t\t\t\t...context,\n\t\t\t\t\t\tqueryContext: {\n\t\t\t\t\t\t\t...context?.queryContext,\n\t\t\t\t\t\t\t...newQueryContext,\n\t\t\t\t\t\t},\n\t\t\t\t\t} ),\n\t\t\t],\n\t\t} ),\n\t\t[ context, setEditedPostContext ]\n\t);\n\n\tlet title;\n\tif ( hasLoadedPost ) {\n\t\tconst type =\n\t\t\teditedPostType === 'wp_template'\n\t\t\t\t? __( 'Template' )\n\t\t\t\t: __( 'Template Part' );\n\t\ttitle = sprintf(\n\t\t\t// translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part).\n\t\t\t__( '%1$s ‹ %2$s ‹ Editor' ),\n\t\t\tgetTitle(),\n\t\t\ttype\n\t\t);\n\t}\n\n\t// Only announce the title once the editor is ready to prevent \"Replace\"\n\t// action in <URlQueryController> from double-announcing.\n\tuseTitle( hasLoadedPost && title );\n\n\tif ( ! hasLoadedPost ) {\n\t\treturn <CanvasSpinner />;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t{ isEditMode && <WelcomeGuide /> }\n\t\t\t<KeyboardShortcuts.Register />\n\t\t\t<EntityProvider kind=\"root\" type=\"site\">\n\t\t\t\t<EntityProvider\n\t\t\t\t\tkind=\"postType\"\n\t\t\t\t\ttype={ editedPostType }\n\t\t\t\t\tid={ editedPostId }\n\t\t\t\t>\n\t\t\t\t\t<GlobalStylesProvider>\n\t\t\t\t\t\t<BlockContextProvider value={ blockContext }>\n\t\t\t\t\t\t\t<SidebarComplementaryAreaFills />\n\t\t\t\t\t\t\t{ isEditMode && <StartTemplateOptions /> }\n\t\t\t\t\t\t\t<InterfaceSkeleton\n\t\t\t\t\t\t\t\tenableRegionNavigation={ false }\n\t\t\t\t\t\t\t\tclassName={\n\t\t\t\t\t\t\t\t\tshowIconLabels && 'show-icon-labels'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tnotices={ isEditMode && <EditorSnackbars /> }\n\t\t\t\t\t\t\t\tcontent={\n\t\t\t\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t\t\t\t<GlobalStylesRenderer />\n\t\t\t\t\t\t\t\t\t\t{ isEditMode && <EditorNotices /> }\n\t\t\t\t\t\t\t\t\t\t{ showVisualEditor && editedPost && (\n\t\t\t\t\t\t\t\t\t\t\t<BlockEditor />\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ editorMode === 'text' &&\n\t\t\t\t\t\t\t\t\t\t\teditedPost &&\n\t\t\t\t\t\t\t\t\t\t\tisEditMode && <CodeEditor /> }\n\t\t\t\t\t\t\t\t\t\t{ hasLoadedPost && ! editedPost && (\n\t\t\t\t\t\t\t\t\t\t\t<Notice\n\t\t\t\t\t\t\t\t\t\t\t\tstatus=\"warning\"\n\t\t\t\t\t\t\t\t\t\t\t\tisDismissible={ false }\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"You attempted to edit an item that doesn't exist. Perhaps it was deleted?\"\n\t\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\t</Notice>\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t{ isEditMode && <KeyboardShortcuts /> }\n\t\t\t\t\t\t\t\t\t</>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsecondarySidebar={\n\t\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t\t( ( shouldShowInserter && (\n\t\t\t\t\t\t\t\t\t\t<InserterSidebar />\n\t\t\t\t\t\t\t\t\t) ) ||\n\t\t\t\t\t\t\t\t\t\t( shouldShowListView && (\n\t\t\t\t\t\t\t\t\t\t\t<ListViewSidebar />\n\t\t\t\t\t\t\t\t\t\t) ) )\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsidebar={\n\t\t\t\t\t\t\t\t\tisEditMode &&\n\t\t\t\t\t\t\t\t\tisRightSidebarOpen && (\n\t\t\t\t\t\t\t\t\t\t<ComplementaryArea.Slot scope=\"core/edit-site\" />\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tfooter={\n\t\t\t\t\t\t\t\t\tshowBlockBreakcrumb && (\n\t\t\t\t\t\t\t\t\t\t<BlockBreadcrumb\n\t\t\t\t\t\t\t\t\t\t\trootLabelText={ __( 'Template' ) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tlabels={ {\n\t\t\t\t\t\t\t\t\t...interfaceLabels,\n\t\t\t\t\t\t\t\t\tsecondarySidebar: secondarySidebarLabel,\n\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</BlockContextProvider>\n\t\t\t\t\t</GlobalStylesProvider>\n\t\t\t\t</EntityProvider>\n\t\t\t</EntityProvider>\n\t\t</>\n\t);\n}\n"]}
@@ -11,7 +11,7 @@ import { __ } from '@wordpress/i18n';
11
11
  * Internal dependencies
12
12
  */
13
13
 
14
- import { getSupportedGlobalStylesPanels, useColorsPerOrigin } from './hooks';
14
+ import { useSupportedStyles, useColorsPerOrigin } from './hooks';
15
15
  import { unlock } from '../../private-apis';
16
16
  const {
17
17
  useGlobalSetting,
@@ -23,22 +23,22 @@ export function useHasBorderPanel(name) {
23
23
  }
24
24
 
25
25
  function useHasBorderColorControl(name) {
26
- const supports = getSupportedGlobalStylesPanels(name);
26
+ const supports = useSupportedStyles(name);
27
27
  return useGlobalSetting('border.color', name)[0] && supports.includes('borderColor');
28
28
  }
29
29
 
30
30
  function useHasBorderRadiusControl(name) {
31
- const supports = getSupportedGlobalStylesPanels(name);
31
+ const supports = useSupportedStyles(name);
32
32
  return useGlobalSetting('border.radius', name)[0] && supports.includes('borderRadius');
33
33
  }
34
34
 
35
35
  function useHasBorderStyleControl(name) {
36
- const supports = getSupportedGlobalStylesPanels(name);
36
+ const supports = useSupportedStyles(name);
37
37
  return useGlobalSetting('border.style', name)[0] && supports.includes('borderStyle');
38
38
  }
39
39
 
40
40
  function useHasBorderWidthControl(name) {
41
- const supports = getSupportedGlobalStylesPanels(name);
41
+ const supports = useSupportedStyles(name);
42
42
  return useGlobalSetting('border.width', name)[0] && supports.includes('borderWidth');
43
43
  }
44
44
 
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["__experimentalBorderRadiusControl","BorderRadiusControl","privateApis","blockEditorPrivateApis","__experimentalBorderBoxControl","BorderBoxControl","__experimentalHasSplitBorders","hasSplitBorders","__experimentalIsDefinedBorder","isDefinedBorder","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","useCallback","__","getSupportedGlobalStylesPanels","useColorsPerOrigin","unlock","useGlobalSetting","useGlobalStyle","useHasBorderPanel","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","supports","includes","applyFallbackStyle","border","style","color","width","applyAllFallbackStyles","top","right","bottom","left","BorderPanel","variation","prefix","userBorderStyles","setBorder","colors","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","hasBorderRadius","borderValues","radius","Object","entries","resetBorder","undefined","resetAll","onBorderChange","newBorder","newBorderWithStyle","updatedBorder","value"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iCAAiC,IAAIC,mBADtC,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SACCC,8BAA8B,IAAIC,gBADnC,EAECC,6BAA6B,IAAIC,eAFlC,EAGCC,6BAA6B,IAAIC,eAHlC,EAICC,wBAAwB,IAAIC,UAJ7B,EAKCC,4BAA4B,IAAIC,cALjC,QAMO,uBANP;AAOA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,8BAAT,EAAyCC,kBAAzC,QAAmE,SAAnE;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;A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C,IAAA,KAAK,EAAGvC,EAAE,CAAE,QAAF,CAFX;AAGC,IAAA,UAAU,EAAG,MAAMsC,eAAe,CAAEO,SAAF,CAHnC;AAIC,IAAA,gBAAgB,EAAG;AAJpB,KAMC,cAAC,mBAAD;AACC,IAAA,MAAM,EAAGR,kBADV;AAEC,IAAA,QAAQ,EAAKc,KAAF,IAAa;AACvBb,MAAAA,eAAe,CAAEa,KAAK,IAAIN,SAAX,CAAf;AACA;AAJF,IAND,CAtBF,CADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderRadiusControl as BorderRadiusControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { getSupportedGlobalStylesPanels, useColorsPerOrigin } from './hooks';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nexport function useHasBorderPanel( name ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( name ),\n\t\tuseHasBorderRadiusControl( name ),\n\t\tuseHasBorderStyleControl( name ),\n\t\tuseHasBorderWidthControl( name ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.color', name )[ 0 ] &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.radius', name )[ 0 ] &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.style', name )[ 0 ] &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.width', name )[ 0 ] &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( ! border.style && ( border.color || border.width ) ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nexport default function BorderPanel( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\t// To better reflect if the user has customized a value we need to\n\t// ensure the style value being checked is from the `user` origin.\n\tconst [ userBorderStyles ] = useGlobalStyle(\n\t\t`${ prefix }border`,\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ border, setBorder ] = useGlobalStyle( `${ prefix }border`, name );\n\tconst colors = useColorsPerOrigin( name );\n\n\tconst showBorderColor = useHasBorderColorControl( name );\n\tconst showBorderStyle = useHasBorderStyleControl( name );\n\tconst showBorderWidth = useHasBorderWidthControl( name );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( name );\n\tconst [ borderRadiusValues, setBorderRadius ] = useGlobalStyle(\n\t\t`${ prefix }border.radius`,\n\t\tname\n\t);\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = userBorderStyles?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: userBorderStyles.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );\n\tconst onBorderChange = useCallback(\n\t\t( newBorder ) => {\n\t\t\t// Ensure we have a visible border style when a border width or\n\t\t\t// color is being selected.\n\t\t\tconst newBorderWithStyle = applyAllFallbackStyles( newBorder );\n\n\t\t\t// As we can't conditionally generate styles based on if other\n\t\t\t// style properties have been set we need to force split border\n\t\t\t// definitions for user set border styles. Border radius is derived\n\t\t\t// from the same property i.e. `border.radius` if it is a string\n\t\t\t// that is used. The longhand border radii styles are only generated\n\t\t\t// if that property is an object.\n\t\t\t//\n\t\t\t// For borders (color, style, and width) those are all properties on\n\t\t\t// the `border` style property. This means if the theme.json defined\n\t\t\t// split borders and the user condenses them into a flat border or\n\t\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\t\tconst updatedBorder = ! hasSplitBorders( newBorderWithStyle )\n\t\t\t\t? {\n\t\t\t\t\t\ttop: newBorderWithStyle,\n\t\t\t\t\t\tright: newBorderWithStyle,\n\t\t\t\t\t\tbottom: newBorderWithStyle,\n\t\t\t\t\t\tleft: newBorderWithStyle,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tcolor: null,\n\t\t\t\t\t\tstyle: null,\n\t\t\t\t\t\twidth: null,\n\t\t\t\t\t\t...newBorderWithStyle,\n\t\t\t\t };\n\n\t\t\t// As radius is maintained separately to color, style, and width\n\t\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t\t// global styles are saved.\n\t\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t\t},\n\t\t[ setBorder ]\n\t);\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( userBorderStyles ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetBorderRadius( value || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/border-panel.js"],"names":["__experimentalBorderRadiusControl","BorderRadiusControl","privateApis","blockEditorPrivateApis","__experimentalBorderBoxControl","BorderBoxControl","__experimentalHasSplitBorders","hasSplitBorders","__experimentalIsDefinedBorder","isDefinedBorder","__experimentalToolsPanel","ToolsPanel","__experimentalToolsPanelItem","ToolsPanelItem","useCallback","__","useSupportedStyles","useColorsPerOrigin","unlock","useGlobalSetting","useGlobalStyle","useHasBorderPanel","name","controls","useHasBorderColorControl","useHasBorderRadiusControl","useHasBorderStyleControl","useHasBorderWidthControl","some","Boolean","supports","includes","applyFallbackStyle","border","style","color","width","applyAllFallbackStyles","top","right","bottom","left","BorderPanel","variation","prefix","userBorderStyles","setBorder","colors","showBorderColor","showBorderStyle","showBorderWidth","showBorderRadius","borderRadiusValues","setBorderRadius","hasBorderRadius","borderValues","radius","Object","entries","resetBorder","undefined","resetAll","onBorderChange","newBorder","newBorderWithStyle","updatedBorder","value"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,iCAAiC,IAAIC,mBADtC,EAECC,WAAW,IAAIC,sBAFhB,QAGO,yBAHP;AAIA,SACCC,8BAA8B,IAAIC,gBADnC,EAECC,6BAA6B,IAAIC,eAFlC,EAGCC,6BAA6B,IAAIC,eAHlC,EAICC,wBAAwB,IAAIC,UAJ7B,EAKCC,4BAA4B,IAAIC,cALjC,QAMO,uBANP;AAOA,SAASC,WAAT,QAA4B,oBAA5B;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA;AACA;AACA;;AACA,SAASC,kBAAT,EAA6BC,kBAA7B,QAAuD,SAAvD;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA,gBAAF;AAAoBC,EAAAA;AAApB,IAAuCF,MAAM,CAAEf,sBAAF,CAAnD;AAEA,OAAO,SAASkB,iBAAT,CAA4BC,IAA5B,EAAmC;AACzC,QAAMC,QAAQ,GAAG,CAChBC,wBAAwB,CAAEF,IAAF,CADR,EAEhBG,yBAAyB,CAAEH,IAAF,CAFT,EAGhBI,wBAAwB,CAAEJ,IAAF,CAHR,EAIhBK,wBAAwB,CAAEL,IAAF,CAJR,CAAjB;AAOA,S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CAAf;AACA;AAJF,IAND,CAtBF,CADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalBorderRadiusControl as BorderRadiusControl,\n\tprivateApis as blockEditorPrivateApis,\n} from '@wordpress/block-editor';\nimport {\n\t__experimentalBorderBoxControl as BorderBoxControl,\n\t__experimentalHasSplitBorders as hasSplitBorders,\n\t__experimentalIsDefinedBorder as isDefinedBorder,\n\t__experimentalToolsPanel as ToolsPanel,\n\t__experimentalToolsPanelItem as ToolsPanelItem,\n} from '@wordpress/components';\nimport { useCallback } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles, useColorsPerOrigin } from './hooks';\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis );\n\nexport function useHasBorderPanel( name ) {\n\tconst controls = [\n\t\tuseHasBorderColorControl( name ),\n\t\tuseHasBorderRadiusControl( name ),\n\t\tuseHasBorderStyleControl( name ),\n\t\tuseHasBorderWidthControl( name ),\n\t];\n\n\treturn controls.some( Boolean );\n}\n\nfunction useHasBorderColorControl( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.color', name )[ 0 ] &&\n\t\tsupports.includes( 'borderColor' )\n\t);\n}\n\nfunction useHasBorderRadiusControl( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.radius', name )[ 0 ] &&\n\t\tsupports.includes( 'borderRadius' )\n\t);\n}\n\nfunction useHasBorderStyleControl( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.style', name )[ 0 ] &&\n\t\tsupports.includes( 'borderStyle' )\n\t);\n}\n\nfunction useHasBorderWidthControl( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn (\n\t\tuseGlobalSetting( 'border.width', name )[ 0 ] &&\n\t\tsupports.includes( 'borderWidth' )\n\t);\n}\n\nfunction applyFallbackStyle( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( ! border.style && ( border.color || border.width ) ) {\n\t\treturn { ...border, style: 'solid' };\n\t}\n\n\treturn border;\n}\n\nfunction applyAllFallbackStyles( border ) {\n\tif ( ! border ) {\n\t\treturn border;\n\t}\n\n\tif ( hasSplitBorders( border ) ) {\n\t\treturn {\n\t\t\ttop: applyFallbackStyle( border.top ),\n\t\t\tright: applyFallbackStyle( border.right ),\n\t\t\tbottom: applyFallbackStyle( border.bottom ),\n\t\t\tleft: applyFallbackStyle( border.left ),\n\t\t};\n\t}\n\n\treturn applyFallbackStyle( border );\n}\n\nexport default function BorderPanel( { name, variation = '' } ) {\n\tconst prefix = variation ? `variations.${ variation }.` : '';\n\t// To better reflect if the user has customized a value we need to\n\t// ensure the style value being checked is from the `user` origin.\n\tconst [ userBorderStyles ] = useGlobalStyle(\n\t\t`${ prefix }border`,\n\t\tname,\n\t\t'user'\n\t);\n\tconst [ border, setBorder ] = useGlobalStyle( `${ prefix }border`, name );\n\tconst colors = useColorsPerOrigin( name );\n\n\tconst showBorderColor = useHasBorderColorControl( name );\n\tconst showBorderStyle = useHasBorderStyleControl( name );\n\tconst showBorderWidth = useHasBorderWidthControl( name );\n\n\t// Border radius.\n\tconst showBorderRadius = useHasBorderRadiusControl( name );\n\tconst [ borderRadiusValues, setBorderRadius ] = useGlobalStyle(\n\t\t`${ prefix }border.radius`,\n\t\tname\n\t);\n\tconst hasBorderRadius = () => {\n\t\tconst borderValues = userBorderStyles?.radius;\n\t\tif ( typeof borderValues === 'object' ) {\n\t\t\treturn Object.entries( borderValues ).some( Boolean );\n\t\t}\n\t\treturn !! borderValues;\n\t};\n\n\tconst resetBorder = () => {\n\t\tif ( hasBorderRadius() ) {\n\t\t\treturn setBorder( { radius: userBorderStyles.radius } );\n\t\t}\n\n\t\tsetBorder( undefined );\n\t};\n\n\tconst resetAll = useCallback( () => setBorder( undefined ), [ setBorder ] );\n\tconst onBorderChange = useCallback(\n\t\t( newBorder ) => {\n\t\t\t// Ensure we have a visible border style when a border width or\n\t\t\t// color is being selected.\n\t\t\tconst newBorderWithStyle = applyAllFallbackStyles( newBorder );\n\n\t\t\t// As we can't conditionally generate styles based on if other\n\t\t\t// style properties have been set we need to force split border\n\t\t\t// definitions for user set border styles. Border radius is derived\n\t\t\t// from the same property i.e. `border.radius` if it is a string\n\t\t\t// that is used. The longhand border radii styles are only generated\n\t\t\t// if that property is an object.\n\t\t\t//\n\t\t\t// For borders (color, style, and width) those are all properties on\n\t\t\t// the `border` style property. This means if the theme.json defined\n\t\t\t// split borders and the user condenses them into a flat border or\n\t\t\t// vice-versa we'd get both sets of styles which would conflict.\n\t\t\tconst updatedBorder = ! hasSplitBorders( newBorderWithStyle )\n\t\t\t\t? {\n\t\t\t\t\t\ttop: newBorderWithStyle,\n\t\t\t\t\t\tright: newBorderWithStyle,\n\t\t\t\t\t\tbottom: newBorderWithStyle,\n\t\t\t\t\t\tleft: newBorderWithStyle,\n\t\t\t\t }\n\t\t\t\t: {\n\t\t\t\t\t\tcolor: null,\n\t\t\t\t\t\tstyle: null,\n\t\t\t\t\t\twidth: null,\n\t\t\t\t\t\t...newBorderWithStyle,\n\t\t\t\t };\n\n\t\t\t// As radius is maintained separately to color, style, and width\n\t\t\t// maintain its value. Undefined values here will be cleaned when\n\t\t\t// global styles are saved.\n\t\t\tsetBorder( { radius: border?.radius, ...updatedBorder } );\n\t\t},\n\t\t[ setBorder ]\n\t);\n\n\treturn (\n\t\t<ToolsPanel label={ __( 'Border' ) } resetAll={ resetAll }>\n\t\t\t{ ( showBorderWidth || showBorderColor ) && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ () => isDefinedBorder( userBorderStyles ) }\n\t\t\t\t\tlabel={ __( 'Border' ) }\n\t\t\t\t\tonDeselect={ () => resetBorder() }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderBoxControl\n\t\t\t\t\t\tcolors={ colors }\n\t\t\t\t\t\tenableAlpha={ true }\n\t\t\t\t\t\tenableStyle={ showBorderStyle }\n\t\t\t\t\t\tonChange={ onBorderChange }\n\t\t\t\t\t\tpopoverOffset={ 40 }\n\t\t\t\t\t\tpopoverPlacement=\"left-start\"\n\t\t\t\t\t\tvalue={ border }\n\t\t\t\t\t\t__experimentalIsRenderedInSidebar={ true }\n\t\t\t\t\t\tsize={ '__unstable-large' }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t\t{ showBorderRadius && (\n\t\t\t\t<ToolsPanelItem\n\t\t\t\t\thasValue={ hasBorderRadius }\n\t\t\t\t\tlabel={ __( 'Radius' ) }\n\t\t\t\t\tonDeselect={ () => setBorderRadius( undefined ) }\n\t\t\t\t\tisShownByDefault={ true }\n\t\t\t\t>\n\t\t\t\t\t<BorderRadiusControl\n\t\t\t\t\t\tvalues={ borderRadiusValues }\n\t\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\t\tsetBorderRadius( value || undefined );\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t</ToolsPanelItem>\n\t\t\t) }\n\t\t</ToolsPanel>\n\t);\n}\n"]}
@@ -32,17 +32,20 @@ export default function ColorPalettePanel(_ref) {
32
32
  canOnlyChangeValues: true,
33
33
  colors: themeColors,
34
34
  onChange: setThemeColors,
35
- paletteLabel: __('Theme')
35
+ paletteLabel: __('Theme'),
36
+ paletteLabelHeadingLevel: 3
36
37
  }), !!defaultColors && !!defaultColors.length && !!defaultPaletteEnabled && createElement(PaletteEdit, {
37
38
  canReset: defaultColors !== baseDefaultColors,
38
39
  canOnlyChangeValues: true,
39
40
  colors: defaultColors,
40
41
  onChange: setDefaultColors,
41
- paletteLabel: __('Default')
42
+ paletteLabel: __('Default'),
43
+ paletteLabelHeadingLevel: 3
42
44
  }), createElement(PaletteEdit, {
43
45
  colors: customColors,
44
46
  onChange: setCustomColors,
45
47
  paletteLabel: __('Custom'),
48
+ paletteLabelHeadingLevel: 3,
46
49
  emptyMessage: __('Custom colors are empty! Add some colors to create your own color palette.'),
47
50
  slugPrefix: "custom-"
48
51
  }));
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/color-palette-panel.js"],"names":["__experimentalPaletteEdit","PaletteEdit","__experimentalVStack","VStack","__","privateApis","blockEditorPrivateApis","unlock","useGlobalSetting","ColorPalettePanel","name","themeColors","setThemeColors","baseThemeColors","defaultColors","setDefaultColors","baseDefaultColors","customColors","setCustomColors","defaultPaletteEnabled","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,yBAAyB,IAAIC,WAD9B,EAECC,oBAAoB,IAAIC,MAFzB,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAuBD,MAAM,CAAED,sBAAF,CAAnC;AAEA,eAAe,SAASG,iBAAT,OAAuC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACrD,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkCJ,gBAAgB,CACvD,qBADuD,EAEvDE,IAFuD,CAAxD;AAIA,QAAM,CAAEG,eAAF,IAAsBL,gBAAgB,CAC3C,qBAD2C,EAE3CE,IAF2C,EAG3C,MAH2C,CAA5C;AAKA,QAAM,CAAEI,aAAF,EAAiBC,gBAAjB,IAAsCP,gBAAgB,CAC3D,uBAD2D,EAE3DE,IAF2D,CAA5D;AAIA,QAAM,CAAEM,iBAAF,IAAwBR,gBAAgB,CAC7C,uBAD6C,EAE7CE,IAF6C,EAG7C,MAH6C,CAA9C;AAKA,QAAM,CAAEO,YAAF,EAAgBC,eAAhB,IAAoCV,gBAAgB,CACzD,sBADyD,EAEzDE,IAFyD,CAA1D;AAKA,QAAM,CAAES,qBAAF,IAA4BX,gBAAgB,CACjD,sBADiD,EAEjDE,IAFiD,CAAlD;AAIA,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,OAAO,EAAG;AAFX,KAIG,CAAC,CAAEC,WAAH,IAAkB,CAAC,CAAEA,WAAW,CAACS,MAAjC,IACD,cAAC,WAAD;AACC,IAAA,QAAQ,EAAGT,WAAW,KAAKE,eAD5B;AAEC,IAAA,mBAAmB,MAFpB;AAGC,IAAA,MAAM,EAAGF,WAHV;AAIC,IAAA,QAAQ,EAAGC,cAJZ;AAKC,IAAA,YAAY,EAAGR,EAAE,CAAE,OAAF;AALlB,IALF,EAaG,CAAC,CAAEU,aAAH,IACD,CAAC,CAAEA,aAAa,CAACM,MADhB,IAED,CAAC,CAAED,qBAFF,IAGA,cAAC,WAAD;AACC,IAAA,QAAQ,EAAGL,aAAa,KAAKE,iBAD9B;AAEC,IAAA,mBAAmB,MAFpB;AAGC,IAAA,MAAM,EAAGF,aAHV;AAIC,IAAA,QAAQ,EAAGC,gBAJZ;AAKC,IAAA,YAAY,EAAGX,EAAE,CAAE,SAAF;AALlB,IAhBH,EAwBC,cAAC,WAAD;AACC,IAAA,MAAM,EAAGa,YADV;AAEC,IAAA,QAAQ,EAAGC,eAFZ;AAGC,IAAA,YAAY,EAAGd,EAAE,CAAE,QAAF,CAHlB;AAIC,IAAA,YAAY,EAAGA,EAAE,CAChB,4EADgB,CAJlB;AAOC,IAAA,UAAU,EAAC;AAPZ,IAxBD,CADD;AAoCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalPaletteEdit as PaletteEdit,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting } = unlock( blockEditorPrivateApis );\n\nexport default function ColorPalettePanel( { name } ) {\n\tconst [ themeColors, setThemeColors ] = useGlobalSetting(\n\t\t'color.palette.theme',\n\t\tname\n\t);\n\tconst [ baseThemeColors ] = useGlobalSetting(\n\t\t'color.palette.theme',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ defaultColors, setDefaultColors ] = useGlobalSetting(\n\t\t'color.palette.default',\n\t\tname\n\t);\n\tconst [ baseDefaultColors ] = useGlobalSetting(\n\t\t'color.palette.default',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ customColors, setCustomColors ] = useGlobalSetting(\n\t\t'color.palette.custom',\n\t\tname\n\t);\n\n\tconst [ defaultPaletteEnabled ] = useGlobalSetting(\n\t\t'color.defaultPalette',\n\t\tname\n\t);\n\treturn (\n\t\t<VStack\n\t\t\tclassName=\"edit-site-global-styles-color-palette-panel\"\n\t\t\tspacing={ 10 }\n\t\t>\n\t\t\t{ !! themeColors && !! themeColors.length && (\n\t\t\t\t<PaletteEdit\n\t\t\t\t\tcanReset={ themeColors !== baseThemeColors }\n\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\tcolors={ themeColors }\n\t\t\t\t\tonChange={ setThemeColors }\n\t\t\t\t\tpaletteLabel={ __( 'Theme' ) }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! defaultColors &&\n\t\t\t\t!! defaultColors.length &&\n\t\t\t\t!! defaultPaletteEnabled && (\n\t\t\t\t\t<PaletteEdit\n\t\t\t\t\t\tcanReset={ defaultColors !== baseDefaultColors }\n\t\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\t\tcolors={ defaultColors }\n\t\t\t\t\t\tonChange={ setDefaultColors }\n\t\t\t\t\t\tpaletteLabel={ __( 'Default' ) }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t<PaletteEdit\n\t\t\t\tcolors={ customColors }\n\t\t\t\tonChange={ setCustomColors }\n\t\t\t\tpaletteLabel={ __( 'Custom' ) }\n\t\t\t\temptyMessage={ __(\n\t\t\t\t\t'Custom colors are empty! Add some colors to create your own color palette.'\n\t\t\t\t) }\n\t\t\t\tslugPrefix=\"custom-\"\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/color-palette-panel.js"],"names":["__experimentalPaletteEdit","PaletteEdit","__experimentalVStack","VStack","__","privateApis","blockEditorPrivateApis","unlock","useGlobalSetting","ColorPalettePanel","name","themeColors","setThemeColors","baseThemeColors","defaultColors","setDefaultColors","baseDefaultColors","customColors","setCustomColors","defaultPaletteEnabled","length"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,yBAAyB,IAAIC,WAD9B,EAECC,oBAAoB,IAAIC,MAFzB,QAGO,uBAHP;AAIA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAuBD,MAAM,CAAED,sBAAF,CAAnC;AAEA,eAAe,SAASG,iBAAT,OAAuC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACrD,QAAM,CAAEC,WAAF,EAAeC,cAAf,IAAkCJ,gBAAgB,CACvD,qBADuD,EAEvDE,IAFuD,CAAxD;AAIA,QAAM,CAAEG,eAAF,IAAsBL,gBAAgB,CAC3C,qBAD2C,EAE3CE,IAF2C,EAG3C,MAH2C,CAA5C;AAKA,QAAM,CAAEI,aAAF,EAAiBC,gBAAjB,IAAsCP,gBAAgB,CAC3D,uBAD2D,EAE3DE,IAF2D,CAA5D;AAIA,QAAM,CAAEM,iBAAF,IAAwBR,gBAAgB,CAC7C,uBAD6C,EAE7CE,IAF6C,EAG7C,MAH6C,CAA9C;AAKA,QAAM,CAAEO,YAAF,EAAgBC,eAAhB,IAAoCV,gBAAgB,CACzD,sBADyD,EAEzDE,IAFyD,CAA1D;AAKA,QAAM,CAAES,qBAAF,IAA4BX,gBAAgB,CACjD,sBADiD,EAEjDE,IAFiD,CAAlD;AAIA,SACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,6CADX;AAEC,IAAA,OAAO,EAAG;AAFX,KAIG,CAAC,CAAEC,WAAH,IAAkB,CAAC,CAAEA,WAAW,CAACS,MAAjC,IACD,cAAC,WAAD;AACC,IAAA,QAAQ,EAAGT,WAAW,KAAKE,eAD5B;AAEC,IAAA,mBAAmB,MAFpB;AAGC,IAAA,MAAM,EAAGF,WAHV;AAIC,IAAA,QAAQ,EAAGC,cAJZ;AAKC,IAAA,YAAY,EAAGR,EAAE,CAAE,OAAF,CALlB;AAMC,IAAA,wBAAwB,EAAG;AAN5B,IALF,EAcG,CAAC,CAAEU,aAAH,IACD,CAAC,CAAEA,aAAa,CAACM,MADhB,IAED,CAAC,CAAED,qBAFF,IAGA,cAAC,WAAD;AACC,IAAA,QAAQ,EAAGL,aAAa,KAAKE,iBAD9B;AAEC,IAAA,mBAAmB,MAFpB;AAGC,IAAA,MAAM,EAAGF,aAHV;AAIC,IAAA,QAAQ,EAAGC,gBAJZ;AAKC,IAAA,YAAY,EAAGX,EAAE,CAAE,SAAF,CALlB;AAMC,IAAA,wBAAwB,EAAG;AAN5B,IAjBH,EA0BC,cAAC,WAAD;AACC,IAAA,MAAM,EAAGa,YADV;AAEC,IAAA,QAAQ,EAAGC,eAFZ;AAGC,IAAA,YAAY,EAAGd,EAAE,CAAE,QAAF,CAHlB;AAIC,IAAA,wBAAwB,EAAG,CAJ5B;AAKC,IAAA,YAAY,EAAGA,EAAE,CAChB,4EADgB,CALlB;AAQC,IAAA,UAAU,EAAC;AARZ,IA1BD,CADD;AAuCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalPaletteEdit as PaletteEdit,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\n\nconst { useGlobalSetting } = unlock( blockEditorPrivateApis );\n\nexport default function ColorPalettePanel( { name } ) {\n\tconst [ themeColors, setThemeColors ] = useGlobalSetting(\n\t\t'color.palette.theme',\n\t\tname\n\t);\n\tconst [ baseThemeColors ] = useGlobalSetting(\n\t\t'color.palette.theme',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ defaultColors, setDefaultColors ] = useGlobalSetting(\n\t\t'color.palette.default',\n\t\tname\n\t);\n\tconst [ baseDefaultColors ] = useGlobalSetting(\n\t\t'color.palette.default',\n\t\tname,\n\t\t'base'\n\t);\n\tconst [ customColors, setCustomColors ] = useGlobalSetting(\n\t\t'color.palette.custom',\n\t\tname\n\t);\n\n\tconst [ defaultPaletteEnabled ] = useGlobalSetting(\n\t\t'color.defaultPalette',\n\t\tname\n\t);\n\treturn (\n\t\t<VStack\n\t\t\tclassName=\"edit-site-global-styles-color-palette-panel\"\n\t\t\tspacing={ 10 }\n\t\t>\n\t\t\t{ !! themeColors && !! themeColors.length && (\n\t\t\t\t<PaletteEdit\n\t\t\t\t\tcanReset={ themeColors !== baseThemeColors }\n\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\tcolors={ themeColors }\n\t\t\t\t\tonChange={ setThemeColors }\n\t\t\t\t\tpaletteLabel={ __( 'Theme' ) }\n\t\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\t/>\n\t\t\t) }\n\t\t\t{ !! defaultColors &&\n\t\t\t\t!! defaultColors.length &&\n\t\t\t\t!! defaultPaletteEnabled && (\n\t\t\t\t\t<PaletteEdit\n\t\t\t\t\t\tcanReset={ defaultColors !== baseDefaultColors }\n\t\t\t\t\t\tcanOnlyChangeValues\n\t\t\t\t\t\tcolors={ defaultColors }\n\t\t\t\t\t\tonChange={ setDefaultColors }\n\t\t\t\t\t\tpaletteLabel={ __( 'Default' ) }\n\t\t\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t<PaletteEdit\n\t\t\t\tcolors={ customColors }\n\t\t\t\tonChange={ setCustomColors }\n\t\t\t\tpaletteLabel={ __( 'Custom' ) }\n\t\t\t\tpaletteLabelHeadingLevel={ 3 }\n\t\t\t\temptyMessage={ __(\n\t\t\t\t\t'Custom colors are empty! Add some colors to create your own color palette.'\n\t\t\t\t) }\n\t\t\t\tslugPrefix=\"custom-\"\n\t\t\t/>\n\t\t</VStack>\n\t);\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Internal dependencies
3
3
  */
4
- import { getSupportedGlobalStylesPanels } from './hooks';
4
+ import { useSupportedStyles } from './hooks';
5
5
  export function useHasColorPanel(name) {
6
- const supports = getSupportedGlobalStylesPanels(name);
6
+ const supports = useSupportedStyles(name);
7
7
  return supports.includes('color') || supports.includes('backgroundColor') || supports.includes('background') || supports.includes('linkColor');
8
8
  }
9
9
  //# sourceMappingURL=color-utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/color-utils.js"],"names":["getSupportedGlobalStylesPanels","useHasColorPanel","name","supports","includes"],"mappings":"AAAA;AACA;AACA;AAEA,SAASA,8BAAT,QAA+C,SAA/C;AAEA,OAAO,SAASC,gBAAT,CAA2BC,IAA3B,EAAkC;AACxC,QAAMC,QAAQ,GAAGH,8BAA8B,CAAEE,IAAF,CAA/C;AACA,SACCC,QAAQ,CAACC,QAAT,CAAmB,OAAnB,KACAD,QAAQ,CAACC,QAAT,CAAmB,iBAAnB,CADA,IAEAD,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFA,IAGAD,QAAQ,CAACC,QAAT,CAAmB,WAAnB,CAJD;AAMA","sourcesContent":["/**\n * Internal dependencies\n */\n\nimport { getSupportedGlobalStylesPanels } from './hooks';\n\nexport function useHasColorPanel( name ) {\n\tconst supports = getSupportedGlobalStylesPanels( name );\n\treturn (\n\t\tsupports.includes( 'color' ) ||\n\t\tsupports.includes( 'backgroundColor' ) ||\n\t\tsupports.includes( 'background' ) ||\n\t\tsupports.includes( 'linkColor' )\n\t);\n}\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/color-utils.js"],"names":["useSupportedStyles","useHasColorPanel","name","supports","includes"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,kBAAT,QAAmC,SAAnC;AAEA,OAAO,SAASC,gBAAT,CAA2BC,IAA3B,EAAkC;AACxC,QAAMC,QAAQ,GAAGH,kBAAkB,CAAEE,IAAF,CAAnC;AACA,SACCC,QAAQ,CAACC,QAAT,CAAmB,OAAnB,KACAD,QAAQ,CAACC,QAAT,CAAmB,iBAAnB,CADA,IAEAD,QAAQ,CAACC,QAAT,CAAmB,YAAnB,CAFA,IAGAD,QAAQ,CAACC,QAAT,CAAmB,WAAnB,CAJD;AAMA","sourcesContent":["/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from './hooks';\n\nexport function useHasColorPanel( name ) {\n\tconst supports = useSupportedStyles( name );\n\treturn (\n\t\tsupports.includes( 'color' ) ||\n\t\tsupports.includes( 'backgroundColor' ) ||\n\t\tsupports.includes( 'background' ) ||\n\t\tsupports.includes( 'linkColor' )\n\t);\n}\n"]}
@@ -8,6 +8,8 @@ import { typography, border, shadow, color, layout, chevronLeft, chevronRight }
8
8
  import { isRTL, __ } from '@wordpress/i18n';
9
9
  import { useSelect } from '@wordpress/data';
10
10
  import { store as coreStore } from '@wordpress/core-data';
11
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
12
+ import { useMemo } from '@wordpress/element';
11
13
  /**
12
14
  * Internal dependencies
13
15
  */
@@ -15,19 +17,28 @@ import { store as coreStore } from '@wordpress/core-data';
15
17
  import { useHasBorderPanel } from './border-panel';
16
18
  import { useHasColorPanel } from './color-utils';
17
19
  import { useHasDimensionsPanel } from './dimensions-panel';
18
- import { useHasTypographyPanel } from './typography-panel';
19
20
  import { useHasVariationsPanel } from './variations-panel';
20
21
  import { NavigationButtonAsItem } from './navigation-button';
21
22
  import { IconWithCurrentColor } from './icon-with-current-color';
22
23
  import { ScreenVariations } from './screen-variations';
23
24
  import { useHasShadowControl } from './shadow-panel';
25
+ import { unlock } from '../../private-apis';
26
+ import { useSupportedStyles } from './hooks';
27
+ const {
28
+ useHasTypographyPanel,
29
+ useGlobalSetting,
30
+ overrideSettingsWithSupports
31
+ } = unlock(blockEditorPrivateApis);
24
32
 
25
33
  function ContextMenu(_ref) {
26
34
  let {
27
35
  name,
28
36
  parentMenu = ''
29
37
  } = _ref;
30
- const hasTypographyPanel = useHasTypographyPanel(name);
38
+ const [rawSettings] = useGlobalSetting('', name);
39
+ const supports = useSupportedStyles(name);
40
+ const settings = useMemo(() => overrideSettingsWithSupports(rawSettings, supports), [rawSettings, supports]);
41
+ const hasTypographyPanel = useHasTypographyPanel(settings);
31
42
  const hasColorPanel = useHasColorPanel(name);
32
43
  const hasBorderPanel = useHasBorderPanel(name);
33
44
  const hasEffectsPanel = useHasShadowControl(name);
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalSpacer","Spacer","FlexItem","CardBody","CardDivider","typography","border","shadow","color","layout","chevronLeft","chevronRight","isRTL","__","useSelect","store","coreStore","useHasBorderPanel","useHasColorPanel","useHasDimensionsPanel","useHasTypographyPanel","useHasVariationsPanel","NavigationButtonAsItem","IconWithCurrentColor","ScreenVariations","useHasShadowControl","ContextMenu","name","parentMenu","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasEffectsPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","isBlocksPanel","includes"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,QAJD,EAKCC,Q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f,cAAC,sBAAD;AACC,IAAA,IAAI,EAAGzB,MADR;AAEC,IAAA,IAAI,EAAGmB,UAAU,GAAG,SAFrB;AAGC,kBAAaf,EAAE,CAAE,eAAF;AAHhB,KAKGA,EAAE,CAAE,QAAF,CALL,CAtCF,EA8CGsB,kBAAkB,IACnB,cAAC,gBAAD;AAAkB,IAAA,IAAI,EAAGR,IAAzB;AAAgC,IAAA,IAAI,EAAGC;AAAvC,IA/CF,EAiDGgB,aAAa,IAAIR,UAAjB,IACD,8BACC,cAAC,WAAD,OADD,EAEC,cAAC,QAAD,QACC,cAAC,MAAD;AAAQ,IAAA,EAAE,EAAC,GAAX;AAAe,IAAA,UAAU,EAAG,CAA5B;AAAgC,IAAA,YAAY,EAAG;AAA/C,KACGvB,EAAE,CACH,qDADG,CADL,CADD,EAMC,cAAC,SAAD,QACC,cAAC,sBAAD;AACC,IAAA,IAAI,EAAGe,UAAU,GAAG,MADrB;AAEC,kBAAaf,EAAE,CAAE,sBAAF;AAFhB,KAIC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,QAAD,QACGA,EAAE,CAAE,sBAAF,CADL,CADD,EAIC,cAAC,oBAAD;AACC,IAAA,IAAI,EACHD,KAAK,KACFF,WADE,GAEFC;AAJL,IAJD,CAJD,CADD,CAND,CAFD,EA4BC,cAAC,WAAD,OA5BD,CAlDF,CADD,CADD;AAsFA;;AAED,eAAee,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n\tFlexItem,\n\tCardBody,\n\tCardDivider,\n} from '@wordpress/components';\nimport {\n\ttypography,\n\tborder,\n\tshadow,\n\tcolor,\n\tlayout,\n\tchevronLeft,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-utils';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasTypographyPanel } from './typography-panel';\nimport { useHasVariationsPanel } from './variations-panel';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { ScreenVariations } from './screen-variations';\nimport { useHasShadowControl } from './shadow-panel';\n\nfunction ContextMenu( { name, parentMenu = '' } ) {\n\tconst hasTypographyPanel = useHasTypographyPanel( name );\n\tconst hasColorPanel = useHasColorPanel( name );\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst hasEffectsPanel = useHasShadowControl( name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( name );\n\tconst hasLayoutPanel = hasDimensionsPanel;\n\tconst hasVariationsPanel = useHasVariationsPanel( name, parentMenu );\n\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\n\tconst isBlocksPanel =\n\t\tparentMenu.includes( 'blocks' ) &&\n\t\t! parentMenu.includes( 'variations' );\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ hasTypographyPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ typography }\n\t\t\t\t\t\tpath={ parentMenu + '/typography' }\n\t\t\t\t\t\taria-label={ __( 'Typography styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasColorPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ color }\n\t\t\t\t\t\tpath={ parentMenu + '/colors' }\n\t\t\t\t\t\taria-label={ __( 'Colors styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasBorderPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ border }\n\t\t\t\t\t\tpath={ parentMenu + '/border' }\n\t\t\t\t\t\taria-label={ __( 'Border' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Border' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasEffectsPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ shadow }\n\t\t\t\t\t\tpath={ parentMenu + '/effects' }\n\t\t\t\t\t\taria-label={ __( 'Shadow' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasLayoutPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\tpath={ parentMenu + '/layout' }\n\t\t\t\t\t\taria-label={ __( 'Layout styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasVariationsPanel && (\n\t\t\t\t\t<ScreenVariations name={ name } path={ parentMenu } />\n\t\t\t\t) }\n\t\t\t\t{ isBlocksPanel && canEditCSS && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<Spacer as=\"p\" paddingTop={ 2 } marginBottom={ 4 }>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Add your own CSS to customize the block appearance.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\t\t\t\tpath={ parentMenu + '/css' }\n\t\t\t\t\t\t\t\t\taria-label={ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default ContextMenu;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/context-menu.js"],"names":["__experimentalItemGroup","ItemGroup","__experimentalHStack","HStack","__experimentalSpacer","Spacer","FlexItem","CardBody","CardDivider","typography","border","shadow","color","layout","chevronLeft","chevronRight","isRTL","__","useSelect","store","coreStore","privateApis","blockEditorPrivateApis","useMemo","useHasBorderPanel","useHasColorPanel","useHasDimensionsPanel","useHasVariationsPanel","NavigationButtonAsItem","IconWithCurrentColor","ScreenVariations","useHasShadowControl","unlock","useSupportedStyles","useHasTypographyPanel","useGlobalSetting","overrideSettingsWithSupports","ContextMenu","name","parentMenu","rawSettings","supports","settings","hasTypographyPanel","hasColorPanel","hasBorderPanel","hasEffectsPanel","hasDimensionsPanel","hasLayoutPanel","hasVariationsPanel","canEditCSS","select","getEntityRecord","__experimentalGetCurrentGlobalStylesId","globalStylesId","globalStyles","undefined","_links","isBlocksPanel","includes"],"mappings":";;AAAA;AACA;AACA;AACA,SACCA,uBAAuB,IAAIC,SAD5B,EAECC,oBAAoB,IAAIC,MAFzB,EAGCC,oBAAoB,IAAIC,MAHzB,EAICC,QAJD,EAKCC,QALD,EAMCC,WAND,QAOO,uBAPP;AAQA,SACCC,UADD,EAECC,MAFD,EAGCC,MAHD,EAICC,KAJD,EAKCC,MALD,EAMCC,WAND,EAOCC,YAPD,QAQO,kBARP;AASA,SAASC,KAAT,EAAgBC,EAAhB,QAA0B,iBAA1B;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,WAAW,IAAIC,sBAAxB,QAAsD,yBAAtD;AACA,SAASC,OAAT,QAAwB,oBAAxB;AAEA;AACA;AACA;;AACA,SAASC,iBAAT,QAAkC,gBAAlC;AACA,SAASC,gBAAT,QAAiC,eAAjC;AACA,SAASC,qBAAT,QAAsC,oBAAtC;AACA,SAASC,qBAAT,QAAsC,oBAAtC;AACA,SAASC,sBAAT,QAAuC,qBAAvC;AACA,SAASC,oBAAT,QAAqC,2BAArC;AACA,SAASC,gBAAT,QAAiC,qBAAjC;AACA,SAASC,mBAAT,QAAoC,gBAApC;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,SAASC,kBAAT,QAAmC,SAAnC;AAEA,MAAM;AACLC,EAAAA,qBADK;AAELC,EAAAA,gBAFK;AAGLC,EAAAA;AAHK,IAIFJ,MAAM,CAAEV,sBAAF,CAJV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B,IACD,8BACC,cAAC,WAAD,OADD,EAEC,cAAC,QAAD,QACC,cAAC,MAAD;AAAQ,IAAA,EAAE,EAAC,GAAX;AAAe,IAAA,UAAU,EAAG,CAA5B;AAAgC,IAAA,YAAY,EAAG;AAA/C,KACGjC,EAAE,CACH,qDADG,CADL,CADD,EAMC,cAAC,SAAD,QACC,cAAC,sBAAD;AACC,IAAA,IAAI,EAAGsB,UAAU,GAAG,MADrB;AAEC,kBAAatB,EAAE,CAAE,sBAAF;AAFhB,KAIC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC;AAAhB,KACC,cAAC,QAAD,QACGA,EAAE,CAAE,sBAAF,CADL,CADD,EAIC,cAAC,oBAAD;AACC,IAAA,IAAI,EACHD,KAAK,KACFF,WADE,GAEFC;AAJL,IAJD,CAJD,CADD,CAND,CAFD,EA4BC,cAAC,WAAD,OA5BD,CAlDF,CADD,CADD;AAsFA;;AAED,eAAesB,WAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalItemGroup as ItemGroup,\n\t__experimentalHStack as HStack,\n\t__experimentalSpacer as Spacer,\n\tFlexItem,\n\tCardBody,\n\tCardDivider,\n} from '@wordpress/components';\nimport {\n\ttypography,\n\tborder,\n\tshadow,\n\tcolor,\n\tlayout,\n\tchevronLeft,\n\tchevronRight,\n} from '@wordpress/icons';\nimport { isRTL, __ } from '@wordpress/i18n';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { useHasBorderPanel } from './border-panel';\nimport { useHasColorPanel } from './color-utils';\nimport { useHasDimensionsPanel } from './dimensions-panel';\nimport { useHasVariationsPanel } from './variations-panel';\nimport { NavigationButtonAsItem } from './navigation-button';\nimport { IconWithCurrentColor } from './icon-with-current-color';\nimport { ScreenVariations } from './screen-variations';\nimport { useHasShadowControl } from './shadow-panel';\nimport { unlock } from '../../private-apis';\nimport { useSupportedStyles } from './hooks';\n\nconst {\n\tuseHasTypographyPanel,\n\tuseGlobalSetting,\n\toverrideSettingsWithSupports,\n} = unlock( blockEditorPrivateApis );\n\nfunction ContextMenu( { name, parentMenu = '' } ) {\n\tconst [ rawSettings ] = useGlobalSetting( '', name );\n\tconst supports = useSupportedStyles( name );\n\tconst settings = useMemo(\n\t\t() => overrideSettingsWithSupports( rawSettings, supports ),\n\t\t[ rawSettings, supports ]\n\t);\n\tconst hasTypographyPanel = useHasTypographyPanel( settings );\n\tconst hasColorPanel = useHasColorPanel( name );\n\tconst hasBorderPanel = useHasBorderPanel( name );\n\tconst hasEffectsPanel = useHasShadowControl( name );\n\tconst hasDimensionsPanel = useHasDimensionsPanel( name );\n\tconst hasLayoutPanel = hasDimensionsPanel;\n\tconst hasVariationsPanel = useHasVariationsPanel( name, parentMenu );\n\n\tconst { canEditCSS } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, __experimentalGetCurrentGlobalStylesId } =\n\t\t\tselect( coreStore );\n\n\t\tconst globalStylesId = __experimentalGetCurrentGlobalStylesId();\n\t\tconst globalStyles = globalStylesId\n\t\t\t? getEntityRecord( 'root', 'globalStyles', globalStylesId )\n\t\t\t: undefined;\n\n\t\treturn {\n\t\t\tcanEditCSS:\n\t\t\t\t!! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false,\n\t\t};\n\t}, [] );\n\n\tconst isBlocksPanel =\n\t\tparentMenu.includes( 'blocks' ) &&\n\t\t! parentMenu.includes( 'variations' );\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup>\n\t\t\t\t{ hasTypographyPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ typography }\n\t\t\t\t\t\tpath={ parentMenu + '/typography' }\n\t\t\t\t\t\taria-label={ __( 'Typography styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Typography' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasColorPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ color }\n\t\t\t\t\t\tpath={ parentMenu + '/colors' }\n\t\t\t\t\t\taria-label={ __( 'Colors styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Colors' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasBorderPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ border }\n\t\t\t\t\t\tpath={ parentMenu + '/border' }\n\t\t\t\t\t\taria-label={ __( 'Border' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Border' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasEffectsPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ shadow }\n\t\t\t\t\t\tpath={ parentMenu + '/effects' }\n\t\t\t\t\t\taria-label={ __( 'Shadow' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Shadow' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasLayoutPanel && (\n\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\ticon={ layout }\n\t\t\t\t\t\tpath={ parentMenu + '/layout' }\n\t\t\t\t\t\taria-label={ __( 'Layout styles' ) }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Layout' ) }\n\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t) }\n\t\t\t\t{ hasVariationsPanel && (\n\t\t\t\t\t<ScreenVariations name={ name } path={ parentMenu } />\n\t\t\t\t) }\n\t\t\t\t{ isBlocksPanel && canEditCSS && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t\t<CardBody>\n\t\t\t\t\t\t\t<Spacer as=\"p\" paddingTop={ 2 } marginBottom={ 4 }>\n\t\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t\t'Add your own CSS to customize the block appearance.'\n\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t</Spacer>\n\t\t\t\t\t\t\t<ItemGroup>\n\t\t\t\t\t\t\t\t<NavigationButtonAsItem\n\t\t\t\t\t\t\t\t\tpath={ parentMenu + '/css' }\n\t\t\t\t\t\t\t\t\taria-label={ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<HStack justify=\"space-between\">\n\t\t\t\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t\t\t\t{ __( 'Additional block CSS' ) }\n\t\t\t\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t\t\t\t<IconWithCurrentColor\n\t\t\t\t\t\t\t\t\t\t\ticon={\n\t\t\t\t\t\t\t\t\t\t\t\tisRTL()\n\t\t\t\t\t\t\t\t\t\t\t\t\t? chevronLeft\n\t\t\t\t\t\t\t\t\t\t\t\t\t: chevronRight\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t\t\t</NavigationButtonAsItem>\n\t\t\t\t\t\t\t</ItemGroup>\n\t\t\t\t\t\t</CardBody>\n\t\t\t\t\t\t<CardDivider />\n\t\t\t\t\t</>\n\t\t\t\t) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n\nexport default ContextMenu;\n"]}
@@ -77,7 +77,7 @@ function CustomCSSControl(_ref) {
77
77
  className: "edit-site-global-styles__custom-css-theme-css"
78
78
  }, originalThemeCustomCSS))), createElement(VStack, {
79
79
  spacing: 3
80
- }, createElement(Subtitle, null, __('ADDITIONAL CSS')), createElement(TextareaControl, {
80
+ }, createElement(Subtitle, null, __('Additional CSS')), createElement(TextareaControl, {
81
81
  __nextHasNoMarginBottom: true,
82
82
  value: (customCSS === null || customCSS === void 0 ? void 0 : customCSS.replace(ignoreThemeCustomCSS, '')) || themeCustomCSS,
83
83
  onChange: value => handleOnChange(value),
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/custom-css.js"],"names":["useState","TextareaControl","Panel","PanelBody","__experimentalVStack","VStack","Tooltip","Icon","__","privateApis","blockEditorPrivateApis","transformStyles","info","unlock","Subtitle","useGlobalStyle","CustomCSSControl","blockName","block","customCSS","setCustomCSS","themeCSS","cssError","setCSSError","ignoreThemeCustomCSS","themeCustomCSS","undefined","handleOnChange","value","transformed","css","handleOnBlur","event","target","originalThemeCustomCSS","replace"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SACCC,eADD,EAECC,KAFD,EAGCC,SAHD,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,OALD,EAMCC,IAND,QAOO,uBAPP;AAQA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,WAAW,IAAIC,sBADhB,EAECC,eAFD,QAGO,yBAHP;AAIA,SAASC,IAAT,QAAqB,kBAArB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,QAAP,MAAqB,YAArB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAqBF,MAAM,CAAEH,sBAAF,CAAjC;;AACA,SAASM,gBAAT,OAA2C;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC1C;AACA;AACA,QAAMC,KAAK,GAAG,CAAC,CAAED,SAAH,GAAeA,SAAf,GAA2B,IAAzC;AAEA,QAAM,CAAEE,SAAF,EAAaC,YAAb,IAA8BL,cAAc,CAAE,KAAF,EAASG,KAAT,CAAlD;AACA,QAAM,CAAEG,QAAF,IAAeN,cAAc,CAAE,KAAF,EAASG,KAAT,EAAgB,MAAhB,CAAnC;AACA,QAAM,CAAEI,QAAF,EAAYC,WAAZ,IAA4BvB,QAAQ,CAAE,IA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,sBAAsB,IACvB,cAAC,KAAD,QACC,cAAC,SAAD;AACC,IAAA,KAAK,EAAG1B,EAAE,CAAE,2BAAF,CADX;AAEC,IAAA,WAAW,EAAG;AAFf,KAIC;AAAK,IAAA,SAAS,EAAC;AAAf,KACG0B,sBADH,CAJD,CADD,CAFF,EAaC,cAAC,MAAD;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,QAAD,QAAY1B,EAAE,CAAE,gBAAF,CAAd,CADD,EAEC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EACJ,CAAAW,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEgB,OAAX,CAAoBX,oBAApB,EAA0C,EAA1C,MACAC,cAJF;AAMC,IAAA,QAAQ,EAAKG,KAAF,IAAaD,cAAc,CAAEC,KAAF,CANvC;AAOC,IAAA,MAAM,EAAGG,YAPV;AAQC,IAAA,SAAS,EAAC,2CARX;AASC,IAAA,UAAU,EAAG;AATd,IAFD,EAaGT,QAAQ,IACT,cAAC,OAAD;AAAS,IAAA,IAAI,EAAGA;AAAhB,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,IAAD;AACC,IAAA,IAAI,EAAGV,IADR;AAEC,IAAA,SAAS,EAAC;AAFX,IADD,CADD,CAdF,CAbD,CADD;AAwCA;;AAED,eAAeI,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\tTextareaControl,\n\tPanel,\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\tTooltip,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\ttransformStyles,\n} from '@wordpress/block-editor';\nimport { info } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport Subtitle from './subtitle';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\nfunction CustomCSSControl( { blockName } ) {\n\t// If blockName is defined, we are customizing CSS at the block level:\n\t// styles.blocks.blockName.css\n\tconst block = !! blockName ? blockName : null;\n\n\tconst [ customCSS, setCustomCSS ] = useGlobalStyle( 'css', block );\n\tconst [ themeCSS ] = useGlobalStyle( 'css', block, 'base' );\n\tconst [ cssError, setCSSError ] = useState( null );\n\tconst ignoreThemeCustomCSS = '/* IgnoreThemeCustomCSS */';\n\n\t// If there is custom css from theme.json show it in the edit box\n\t// so the user can selectively overwrite it, rather than have the user CSS\n\t// completely overwrite the theme CSS by default.\n\tconst themeCustomCSS =\n\t\t! customCSS && themeCSS\n\t\t\t? `/* ${ __(\n\t\t\t\t\t'Theme Custom CSS start'\n\t\t\t ) } */\\n${ themeCSS }\\n/* ${ __( 'Theme Custom CSS end' ) } */`\n\t\t\t: undefined;\n\n\tfunction handleOnChange( value ) {\n\t\t// If there is theme custom CSS, but the user clears the input box then save the\n\t\t// ignoreThemeCustomCSS string so that the theme custom CSS is not re-applied.\n\t\tif ( themeCSS && value === '' ) {\n\t\t\tsetCustomCSS( ignoreThemeCustomCSS );\n\t\t\treturn;\n\t\t}\n\t\tsetCustomCSS( value );\n\t\tif ( cssError ) {\n\t\t\tconst [ transformed ] = transformStyles(\n\t\t\t\t[ { css: value } ],\n\t\t\t\t'.editor-styles-wrapper'\n\t\t\t);\n\t\t\tif ( transformed ) {\n\t\t\t\tsetCSSError( null );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction handleOnBlur( event ) {\n\t\tif ( ! event?.target?.value ) {\n\t\t\tsetCSSError( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ transformed ] = transformStyles(\n\t\t\t[ { css: event.target.value } ],\n\t\t\t'.editor-styles-wrapper'\n\t\t);\n\n\t\tsetCSSError(\n\t\t\ttransformed === null\n\t\t\t\t? __( 'There is an error with your CSS structure.' )\n\t\t\t\t: null\n\t\t);\n\t}\n\n\tconst originalThemeCustomCSS =\n\t\tthemeCSS && customCSS && themeCustomCSS !== customCSS\n\t\t\t? themeCSS\n\t\t\t: undefined;\n\n\treturn (\n\t\t<>\n\t\t\t{ originalThemeCustomCSS && (\n\t\t\t\t<Panel>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\ttitle={ __( 'Original Theme Custom CSS' ) }\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t<pre className=\"edit-site-global-styles__custom-css-theme-css\">\n\t\t\t\t\t\t\t{ originalThemeCustomCSS }\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</Panel>\n\t\t\t) }\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<Subtitle>{ __( 'ADDITIONAL CSS' ) }</Subtitle>\n\t\t\t\t<TextareaControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tcustomCSS?.replace( ignoreThemeCustomCSS, '' ) ||\n\t\t\t\t\t\tthemeCustomCSS\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( value ) => handleOnChange( value ) }\n\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\tclassName=\"edit-site-global-styles__custom-css-input\"\n\t\t\t\t\tspellCheck={ false }\n\t\t\t\t/>\n\t\t\t\t{ cssError && (\n\t\t\t\t\t<Tooltip text={ cssError }>\n\t\t\t\t\t\t<div className=\"edit-site-global-styles__custom-css-validation-wrapper\">\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ info }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles__custom-css-validation-icon\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\nexport default CustomCSSControl;\n"]}
1
+ {"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/custom-css.js"],"names":["useState","TextareaControl","Panel","PanelBody","__experimentalVStack","VStack","Tooltip","Icon","__","privateApis","blockEditorPrivateApis","transformStyles","info","unlock","Subtitle","useGlobalStyle","CustomCSSControl","blockName","block","customCSS","setCustomCSS","themeCSS","cssError","setCSSError","ignoreThemeCustomCSS","themeCustomCSS","undefined","handleOnChange","value","transformed","css","handleOnBlur","event","target","originalThemeCustomCSS","replace"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,QAAT,QAAyB,oBAAzB;AACA,SACCC,eADD,EAECC,KAFD,EAGCC,SAHD,EAICC,oBAAoB,IAAIC,MAJzB,EAKCC,OALD,EAMCC,IAND,QAOO,uBAPP;AAQA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SACCC,WAAW,IAAIC,sBADhB,EAECC,eAFD,QAGO,yBAHP;AAIA,SAASC,IAAT,QAAqB,kBAArB;AAEA;AACA;AACA;;AACA,SAASC,MAAT,QAAuB,oBAAvB;AACA,OAAOC,QAAP,MAAqB,YAArB;AAEA,MAAM;AAAEC,EAAAA;AAAF,IAAqBF,MAAM,CAAEH,sBAAF,CAAjC;;AACA,SAASM,gBAAT,OAA2C;AAAA,MAAhB;AAAEC,IAAAA;AAAF,GAAgB;AAC1C;AACA;AACA,QAAMC,KAAK,GAAG,CAAC,CAAED,SAAH,GAAeA,SAAf,GAA2B,IAAzC;AAEA,QAAM,CAAEE,SAAF,EAAaC,YAAb,IAA8BL,cAAc,CAAE,KAAF,EAASG,KAAT,CAAlD;AACA,QAAM,CAAEG,QAAF,IAAeN,cAAc,CAAE,KAAF,EAASG,KAAT,EAAgB,MAAhB,CAAnC;AACA,QAAM,CAAEI,QAAF,EAAYC,WAAZ,IAA4BvB,QAAQ,CAAE,IAAF,CAA1C;AACA,QAAMwB,oBAAoB,GAAG,4BAA7B,CAR0C,CAU1C;AACA;AACA;;AACA,QAAMC,cAAc,GACnB,CAAEN,SAAF,IAAeE,QAAf,GACI,MAAMb,EAAE,CACT,wBADS,CAEN,QAAQa,QAAU,QAAQb,EAAE,CAAE,sBAAF,CAA4B,KA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D;AAAQ,IAAA,OAAO,EAAG;AAAlB,KACC,cAAC,QAAD,QAAY1B,EAAE,CAAE,gBAAF,CAAd,CADD,EAEC,cAAC,eAAD;AACC,IAAA,uBAAuB,MADxB;AAEC,IAAA,KAAK,EACJ,CAAAW,SAAS,SAAT,IAAAA,SAAS,WAAT,YAAAA,SAAS,CAAEgB,OAAX,CAAoBX,oBAApB,EAA0C,EAA1C,MACAC,cAJF;AAMC,IAAA,QAAQ,EAAKG,KAAF,IAAaD,cAAc,CAAEC,KAAF,CANvC;AAOC,IAAA,MAAM,EAAGG,YAPV;AAQC,IAAA,SAAS,EAAC,2CARX;AASC,IAAA,UAAU,EAAG;AATd,IAFD,EAaGT,QAAQ,IACT,cAAC,OAAD;AAAS,IAAA,IAAI,EAAGA;AAAhB,KACC;AAAK,IAAA,SAAS,EAAC;AAAf,KACC,cAAC,IAAD;AACC,IAAA,IAAI,EAAGV,IADR;AAEC,IAAA,SAAS,EAAC;AAFX,IADD,CADD,CAdF,CAbD,CADD;AAwCA;;AAED,eAAeI,gBAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useState } from '@wordpress/element';\nimport {\n\tTextareaControl,\n\tPanel,\n\tPanelBody,\n\t__experimentalVStack as VStack,\n\tTooltip,\n\tIcon,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tprivateApis as blockEditorPrivateApis,\n\ttransformStyles,\n} from '@wordpress/block-editor';\nimport { info } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../private-apis';\nimport Subtitle from './subtitle';\n\nconst { useGlobalStyle } = unlock( blockEditorPrivateApis );\nfunction CustomCSSControl( { blockName } ) {\n\t// If blockName is defined, we are customizing CSS at the block level:\n\t// styles.blocks.blockName.css\n\tconst block = !! blockName ? blockName : null;\n\n\tconst [ customCSS, setCustomCSS ] = useGlobalStyle( 'css', block );\n\tconst [ themeCSS ] = useGlobalStyle( 'css', block, 'base' );\n\tconst [ cssError, setCSSError ] = useState( null );\n\tconst ignoreThemeCustomCSS = '/* IgnoreThemeCustomCSS */';\n\n\t// If there is custom css from theme.json show it in the edit box\n\t// so the user can selectively overwrite it, rather than have the user CSS\n\t// completely overwrite the theme CSS by default.\n\tconst themeCustomCSS =\n\t\t! customCSS && themeCSS\n\t\t\t? `/* ${ __(\n\t\t\t\t\t'Theme Custom CSS start'\n\t\t\t ) } */\\n${ themeCSS }\\n/* ${ __( 'Theme Custom CSS end' ) } */`\n\t\t\t: undefined;\n\n\tfunction handleOnChange( value ) {\n\t\t// If there is theme custom CSS, but the user clears the input box then save the\n\t\t// ignoreThemeCustomCSS string so that the theme custom CSS is not re-applied.\n\t\tif ( themeCSS && value === '' ) {\n\t\t\tsetCustomCSS( ignoreThemeCustomCSS );\n\t\t\treturn;\n\t\t}\n\t\tsetCustomCSS( value );\n\t\tif ( cssError ) {\n\t\t\tconst [ transformed ] = transformStyles(\n\t\t\t\t[ { css: value } ],\n\t\t\t\t'.editor-styles-wrapper'\n\t\t\t);\n\t\t\tif ( transformed ) {\n\t\t\t\tsetCSSError( null );\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction handleOnBlur( event ) {\n\t\tif ( ! event?.target?.value ) {\n\t\t\tsetCSSError( null );\n\t\t\treturn;\n\t\t}\n\n\t\tconst [ transformed ] = transformStyles(\n\t\t\t[ { css: event.target.value } ],\n\t\t\t'.editor-styles-wrapper'\n\t\t);\n\n\t\tsetCSSError(\n\t\t\ttransformed === null\n\t\t\t\t? __( 'There is an error with your CSS structure.' )\n\t\t\t\t: null\n\t\t);\n\t}\n\n\tconst originalThemeCustomCSS =\n\t\tthemeCSS && customCSS && themeCustomCSS !== customCSS\n\t\t\t? themeCSS\n\t\t\t: undefined;\n\n\treturn (\n\t\t<>\n\t\t\t{ originalThemeCustomCSS && (\n\t\t\t\t<Panel>\n\t\t\t\t\t<PanelBody\n\t\t\t\t\t\ttitle={ __( 'Original Theme Custom CSS' ) }\n\t\t\t\t\t\tinitialOpen={ false }\n\t\t\t\t\t>\n\t\t\t\t\t\t<pre className=\"edit-site-global-styles__custom-css-theme-css\">\n\t\t\t\t\t\t\t{ originalThemeCustomCSS }\n\t\t\t\t\t\t</pre>\n\t\t\t\t\t</PanelBody>\n\t\t\t\t</Panel>\n\t\t\t) }\n\t\t\t<VStack spacing={ 3 }>\n\t\t\t\t<Subtitle>{ __( 'Additional CSS' ) }</Subtitle>\n\t\t\t\t<TextareaControl\n\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\tvalue={\n\t\t\t\t\t\tcustomCSS?.replace( ignoreThemeCustomCSS, '' ) ||\n\t\t\t\t\t\tthemeCustomCSS\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( value ) => handleOnChange( value ) }\n\t\t\t\t\tonBlur={ handleOnBlur }\n\t\t\t\t\tclassName=\"edit-site-global-styles__custom-css-input\"\n\t\t\t\t\tspellCheck={ false }\n\t\t\t\t/>\n\t\t\t\t{ cssError && (\n\t\t\t\t\t<Tooltip text={ cssError }>\n\t\t\t\t\t\t<div className=\"edit-site-global-styles__custom-css-validation-wrapper\">\n\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\ticon={ info }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-global-styles__custom-css-validation-icon\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</Tooltip>\n\t\t\t\t) }\n\t\t\t</VStack>\n\t\t</>\n\t);\n}\n\nexport default CustomCSSControl;\n"]}