@wordpress/edit-site 6.0.0 → 6.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. package/build/components/add-new-page/index.js +2 -1
  2. package/build/components/add-new-page/index.js.map +1 -1
  3. package/build/components/block-editor/inserter-media-categories.js +1 -1
  4. package/build/components/block-editor/inserter-media-categories.js.map +1 -1
  5. package/build/components/editor/index.js +54 -60
  6. package/build/components/editor/index.js.map +1 -1
  7. package/build/components/editor/use-editor-title.js +39 -0
  8. package/build/components/editor/use-editor-title.js.map +1 -0
  9. package/build/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  10. package/build/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  11. package/build/components/global-styles/screen-css.js +1 -1
  12. package/build/components/global-styles/screen-css.js.map +1 -1
  13. package/build/components/global-styles/screen-revisions/index.js +4 -23
  14. package/build/components/global-styles/screen-revisions/index.js.map +1 -1
  15. package/build/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  16. package/build/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  17. package/build/components/global-styles/shadows-edit-panel.js +1 -0
  18. package/build/components/global-styles/shadows-edit-panel.js.map +1 -1
  19. package/build/components/global-styles/variations/variation.js +11 -16
  20. package/build/components/global-styles/variations/variation.js.map +1 -1
  21. package/build/components/global-styles/variations/variations-color.js +2 -1
  22. package/build/components/global-styles/variations/variations-color.js.map +1 -1
  23. package/build/components/global-styles/variations/variations-typography.js +1 -0
  24. package/build/components/global-styles/variations/variations-typography.js.map +1 -1
  25. package/build/components/global-styles-sidebar/index.js +2 -0
  26. package/build/components/global-styles-sidebar/index.js.map +1 -1
  27. package/build/components/layout/index.js +16 -59
  28. package/build/components/layout/index.js.map +1 -1
  29. package/build/components/page-patterns/index.js +5 -5
  30. package/build/components/page-patterns/index.js.map +1 -1
  31. package/build/components/pagination/index.js +17 -8
  32. package/build/components/pagination/index.js.map +1 -1
  33. package/build/components/sidebar-dataviews/dataview-item.js +6 -2
  34. package/build/components/sidebar-dataviews/dataview-item.js.map +1 -1
  35. package/build/components/sidebar-navigation-screen/index.js +1 -1
  36. package/build/components/sidebar-navigation-screen/index.js.map +1 -1
  37. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  38. package/build/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  39. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  40. package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  41. package/build/components/sidebar-navigation-screen-patterns/category-item.js +1 -1
  42. package/build/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  43. package/build/components/sidebar-navigation-screen-patterns/index.js +1 -1
  44. package/build/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  45. package/build/components/site-hub/index.js +38 -128
  46. package/build/components/site-hub/index.js.map +1 -1
  47. package/build/deprecated.js +11 -0
  48. package/build/deprecated.js.map +1 -1
  49. package/build/hooks/push-changes-to-global-styles/index.js +3 -2
  50. package/build/hooks/push-changes-to-global-styles/index.js.map +1 -1
  51. package/build/lock-unlock.js +1 -1
  52. package/build/lock-unlock.js.map +1 -1
  53. package/build/store/private-actions.js +33 -18
  54. package/build/store/private-actions.js.map +1 -1
  55. package/build-module/components/add-new-page/index.js +2 -1
  56. package/build-module/components/add-new-page/index.js.map +1 -1
  57. package/build-module/components/block-editor/inserter-media-categories.js +1 -1
  58. package/build-module/components/block-editor/inserter-media-categories.js.map +1 -1
  59. package/build-module/components/editor/index.js +54 -60
  60. package/build-module/components/editor/index.js.map +1 -1
  61. package/build-module/components/editor/use-editor-title.js +31 -0
  62. package/build-module/components/editor/use-editor-title.js.map +1 -0
  63. package/build-module/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  64. package/build-module/components/global-styles/font-library-modal/installed-fonts.js.map +1 -1
  65. package/build-module/components/global-styles/screen-css.js +1 -1
  66. package/build-module/components/global-styles/screen-css.js.map +1 -1
  67. package/build-module/components/global-styles/screen-revisions/index.js +4 -23
  68. package/build-module/components/global-styles/screen-revisions/index.js.map +1 -1
  69. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  70. package/build-module/components/global-styles/screen-revisions/revisions-buttons.js.map +1 -1
  71. package/build-module/components/global-styles/shadows-edit-panel.js +1 -0
  72. package/build-module/components/global-styles/shadows-edit-panel.js.map +1 -1
  73. package/build-module/components/global-styles/variations/variation.js +11 -16
  74. package/build-module/components/global-styles/variations/variation.js.map +1 -1
  75. package/build-module/components/global-styles/variations/variations-color.js +3 -2
  76. package/build-module/components/global-styles/variations/variations-color.js.map +1 -1
  77. package/build-module/components/global-styles/variations/variations-typography.js +1 -0
  78. package/build-module/components/global-styles/variations/variations-typography.js.map +1 -1
  79. package/build-module/components/global-styles-sidebar/index.js +2 -0
  80. package/build-module/components/global-styles-sidebar/index.js.map +1 -1
  81. package/build-module/components/layout/index.js +18 -61
  82. package/build-module/components/layout/index.js.map +1 -1
  83. package/build-module/components/page-patterns/index.js +5 -5
  84. package/build-module/components/page-patterns/index.js.map +1 -1
  85. package/build-module/components/pagination/index.js +17 -8
  86. package/build-module/components/pagination/index.js.map +1 -1
  87. package/build-module/components/sidebar-dataviews/dataview-item.js +6 -2
  88. package/build-module/components/sidebar-dataviews/dataview-item.js.map +1 -1
  89. package/build-module/components/sidebar-navigation-screen/index.js +1 -1
  90. package/build-module/components/sidebar-navigation-screen/index.js.map +1 -1
  91. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  92. package/build-module/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js.map +1 -1
  93. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  94. package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.js.map +1 -1
  95. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js +2 -2
  96. package/build-module/components/sidebar-navigation-screen-patterns/category-item.js.map +1 -1
  97. package/build-module/components/sidebar-navigation-screen-patterns/index.js +1 -1
  98. package/build-module/components/sidebar-navigation-screen-patterns/index.js.map +1 -1
  99. package/build-module/components/site-hub/index.js +40 -130
  100. package/build-module/components/site-hub/index.js.map +1 -1
  101. package/build-module/deprecated.js +11 -0
  102. package/build-module/deprecated.js.map +1 -1
  103. package/build-module/hooks/push-changes-to-global-styles/index.js +3 -2
  104. package/build-module/hooks/push-changes-to-global-styles/index.js.map +1 -1
  105. package/build-module/lock-unlock.js +1 -1
  106. package/build-module/lock-unlock.js.map +1 -1
  107. package/build-module/store/private-actions.js +33 -18
  108. package/build-module/store/private-actions.js.map +1 -1
  109. package/build-style/style-rtl.css +43 -85
  110. package/build-style/style.css +43 -85
  111. package/package.json +41 -41
  112. package/src/components/add-new-page/index.js +2 -1
  113. package/src/components/block-editor/inserter-media-categories.js +1 -3
  114. package/src/components/block-editor/style.scss +11 -0
  115. package/src/components/editor/index.js +69 -96
  116. package/src/components/editor/style.scss +1 -5
  117. package/src/components/editor/use-editor-title.js +35 -0
  118. package/src/components/global-styles/font-library-modal/installed-fonts.js +1 -0
  119. package/src/components/global-styles/screen-css.js +1 -1
  120. package/src/components/global-styles/screen-revisions/index.js +4 -24
  121. package/src/components/global-styles/screen-revisions/revisions-buttons.js +1 -1
  122. package/src/components/global-styles/screen-revisions/style.scss +4 -8
  123. package/src/components/global-styles/shadows-edit-panel.js +1 -0
  124. package/src/components/global-styles/variations/variation.js +14 -19
  125. package/src/components/global-styles/variations/variations-color.js +12 -4
  126. package/src/components/global-styles/variations/variations-typography.js +5 -1
  127. package/src/components/global-styles-sidebar/index.js +2 -0
  128. package/src/components/layout/index.js +17 -67
  129. package/src/components/layout/style.scss +18 -58
  130. package/src/components/page-patterns/index.js +15 -12
  131. package/src/components/pagination/index.js +21 -16
  132. package/src/components/sidebar-dataviews/dataview-item.js +6 -2
  133. package/src/components/sidebar-navigation-screen/index.js +1 -1
  134. package/src/components/sidebar-navigation-screen/style.scss +2 -2
  135. package/src/components/sidebar-navigation-screen-navigation-menu/delete-confirm-dialog.js +1 -0
  136. package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +1 -0
  137. package/src/components/sidebar-navigation-screen-patterns/category-item.js +11 -2
  138. package/src/components/sidebar-navigation-screen-patterns/index.js +5 -1
  139. package/src/components/site-hub/index.js +55 -146
  140. package/src/components/site-hub/style.scss +1 -4
  141. package/src/components/site-icon/style.scss +0 -4
  142. package/src/deprecated.js +14 -0
  143. package/src/hooks/push-changes-to-global-styles/index.js +3 -2
  144. package/src/lock-unlock.js +1 -1
  145. package/src/store/private-actions.js +58 -30
@@ -8,11 +8,8 @@ exports.default = void 0;
8
8
  var _clsx = _interopRequireDefault(require("clsx"));
9
9
  var _data = require("@wordpress/data");
10
10
  var _components = require("@wordpress/components");
11
- var _compose = require("@wordpress/compose");
12
11
  var _i18n = require("@wordpress/i18n");
13
- var _blockEditor = require("@wordpress/block-editor");
14
12
  var _coreData = require("@wordpress/core-data");
15
- var _editor = require("@wordpress/editor");
16
13
  var _htmlEntities = require("@wordpress/html-entities");
17
14
  var _element = require("@wordpress/element");
18
15
  var _icons = require("@wordpress/icons");
@@ -35,19 +32,15 @@ var _jsxRuntime = require("react/jsx-runtime");
35
32
  * Internal dependencies
36
33
  */
37
34
 
38
- const HUB_ANIMATION_DURATION = 0.3;
39
- const SiteHub = (0, _element.memo)(({
40
- isTransparent,
41
- className
42
- }) => {
35
+ const SiteHub = (0, _element.memo)((0, _element.forwardRef)(({
36
+ isTransparent
37
+ }, ref) => {
43
38
  const {
44
- canvasMode,
45
39
  dashboardLink,
46
40
  homeUrl,
47
41
  siteTitle
48
42
  } = (0, _data.useSelect)(select => {
49
43
  const {
50
- getCanvasMode,
51
44
  getSettings
52
45
  } = (0, _lockUnlock.unlock)(select(_store.store));
53
46
  const {
@@ -56,7 +49,6 @@ const SiteHub = (0, _element.memo)(({
56
49
  } = select(_coreData.store);
57
50
  const _site = getSite();
58
51
  return {
59
- canvasMode: getCanvasMode(),
60
52
  dashboardLink: getSettings().__experimentalDashboardLink || 'index.php',
61
53
  homeUrl: getUnstableBase()?.home,
62
54
  siteTitle: !_site?.title && !!_site?.url ? (0, _url.filterURLForDisplay)(_site?.url) : _site?.title
@@ -65,135 +57,53 @@ const SiteHub = (0, _element.memo)(({
65
57
  const {
66
58
  open: openCommandCenter
67
59
  } = (0, _data.useDispatch)(_commands.store);
68
- const disableMotion = (0, _compose.useReducedMotion)();
69
- const {
70
- setCanvasMode
71
- } = (0, _lockUnlock.unlock)((0, _data.useDispatch)(_store.store));
72
- const {
73
- clearSelectedBlock
74
- } = (0, _data.useDispatch)(_blockEditor.store);
75
- const {
76
- setDeviceType
77
- } = (0, _data.useDispatch)(_editor.store);
78
- const isBackToDashboardButton = canvasMode === 'view';
79
- const siteIconButtonProps = isBackToDashboardButton ? {
80
- href: dashboardLink,
81
- label: (0, _i18n.__)('Go to the Dashboard')
82
- } : {
83
- href: dashboardLink,
84
- // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.
85
- role: 'button',
86
- label: (0, _i18n.__)('Open Navigation'),
87
- onClick: event => {
88
- event.preventDefault();
89
- if (canvasMode === 'edit') {
90
- clearSelectedBlock();
91
- setDeviceType('Desktop');
92
- setCanvasMode('view');
93
- }
94
- }
95
- };
96
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableMotion.div, {
97
- className: (0, _clsx.default)('edit-site-site-hub', className),
98
- variants: {
99
- isDistractionFree: {
100
- x: '-100%'
101
- },
102
- isDistractionFreeHovering: {
103
- x: 0
104
- },
105
- view: {
106
- x: 0
107
- },
108
- edit: {
109
- x: 0
110
- }
111
- },
112
- initial: false,
113
- transition: {
114
- type: 'tween',
115
- duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
116
- ease: 'easeOut'
117
- },
60
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
61
+ className: "edit-site-site-hub",
118
62
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
119
63
  justify: "flex-start",
120
64
  spacing: "0",
121
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableMotion.div, {
65
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
122
66
  className: (0, _clsx.default)('edit-site-site-hub__view-mode-toggle-container', {
123
67
  'has-transparent-background': isTransparent
124
68
  }),
125
- layout: true,
126
- transition: {
127
- type: 'tween',
128
- duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
129
- ease: 'easeOut'
130
- },
131
69
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
132
- ...siteIconButtonProps,
70
+ ref: ref,
71
+ href: dashboardLink,
72
+ label: (0, _i18n.__)('Go to the Dashboard'),
133
73
  className: "edit-site-layout__view-mode-toggle",
134
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableMotion.div, {
135
- initial: false,
136
- animate: {
137
- scale: canvasMode === 'view' ? 0.5 : 1
138
- },
139
- whileHover: {
140
- scale: canvasMode === 'view' ? 0.5 : 0.96
141
- },
142
- transition: {
143
- type: 'tween',
144
- duration: disableMotion ? 0 : HUB_ANIMATION_DURATION,
145
- ease: 'easeOut'
146
- },
147
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_siteIcon.default, {
148
- className: "edit-site-layout__view-mode-toggle-icon"
149
- })
150
- })
151
- })
152
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__unstableAnimatePresence, {
153
- initial: false,
154
- children: canvasMode === 'view' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
155
- as: _components.__unstableMotion.div,
156
- initial: {
157
- opacity: 0
158
- },
159
- animate: {
160
- opacity: isTransparent ? 0 : 1
74
+ style: {
75
+ transform: 'scale(0.5)',
76
+ borderRadius: 4
161
77
  },
162
- exit: {
163
- opacity: 0
164
- },
165
- transition: {
166
- type: 'tween',
167
- duration: disableMotion ? 0 : 0.2,
168
- ease: 'easeOut',
169
- delay: canvasMode === 'view' ? 0.1 : 0
170
- },
171
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
172
- className: "edit-site-site-hub__title",
173
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
174
- variant: "link",
175
- href: homeUrl,
176
- target: "_blank",
177
- label: (0, _i18n.__)('View site (opens in a new tab)'),
178
- "aria-label": (0, _i18n.__)('View site (opens in a new tab)'),
179
- children: (0, _htmlEntities.decodeEntities)(siteTitle)
180
- })
181
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalHStack, {
182
- spacing: 0,
183
- expanded: false,
184
- className: "edit-site-site-hub__actions",
185
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
186
- className: "edit-site-site-hub_toggle-command-center",
187
- icon: _icons.search,
188
- onClick: () => openCommandCenter(),
189
- label: (0, _i18n.__)('Open command palette'),
190
- shortcut: _keycodes.displayShortcut.primary('k')
191
- })
192
- })]
78
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_siteIcon.default, {
79
+ className: "edit-site-layout__view-mode-toggle-icon"
80
+ })
193
81
  })
82
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_components.__experimentalHStack, {
83
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
84
+ className: "edit-site-site-hub__title",
85
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
86
+ variant: "link",
87
+ href: homeUrl,
88
+ target: "_blank",
89
+ label: (0, _i18n.__)('View site (opens in a new tab)'),
90
+ children: (0, _htmlEntities.decodeEntities)(siteTitle)
91
+ })
92
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.__experimentalHStack, {
93
+ spacing: 0,
94
+ expanded: false,
95
+ className: "edit-site-site-hub__actions",
96
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
97
+ className: "edit-site-site-hub_toggle-command-center",
98
+ icon: _icons.search,
99
+ onClick: () => openCommandCenter(),
100
+ label: (0, _i18n.__)('Open command palette'),
101
+ shortcut: _keycodes.displayShortcut.primary('k')
102
+ })
103
+ })]
194
104
  })]
195
105
  })
196
106
  });
197
- });
107
+ }));
198
108
  var _default = exports.default = SiteHub;
199
109
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_components","_compose","_i18n","_blockEditor","_coreData","_editor","_htmlEntities","_element","_icons","_commands","_keycodes","_url","_store","_siteIcon","_lockUnlock","_jsxRuntime","HUB_ANIMATION_DURATION","SiteHub","memo","isTransparent","className","canvasMode","dashboardLink","homeUrl","siteTitle","useSelect","select","getCanvasMode","getSettings","unlock","editSiteStore","getSite","getUnstableBase","coreStore","_site","__experimentalDashboardLink","home","title","url","filterURLForDisplay","open","openCommandCenter","useDispatch","commandsStore","disableMotion","useReducedMotion","setCanvasMode","clearSelectedBlock","blockEditorStore","setDeviceType","editorStore","isBackToDashboardButton","siteIconButtonProps","href","label","__","role","onClick","event","preventDefault","jsx","__unstableMotion","div","clsx","variants","isDistractionFree","x","isDistractionFreeHovering","view","edit","initial","transition","type","duration","ease","children","jsxs","__experimentalHStack","justify","spacing","layout","Button","animate","scale","whileHover","default","__unstableAnimatePresence","as","motion","opacity","exit","delay","variant","target","decodeEntities","expanded","icon","search","shortcut","displayShortcut","primary","_default","exports"],"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport {\n\tButton,\n\t__unstableMotion as motion,\n\t__unstableAnimatePresence as AnimatePresence,\n\t__experimentalHStack as HStack,\n} from '@wordpress/components';\nimport { useReducedMotion } from '@wordpress/compose';\nimport { __ } from '@wordpress/i18n';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as editorStore } from '@wordpress/editor';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { memo } from '@wordpress/element';\nimport { search } from '@wordpress/icons';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { filterURLForDisplay } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../lock-unlock';\n\nconst HUB_ANIMATION_DURATION = 0.3;\n\nconst SiteHub = memo( ( { isTransparent, className } ) => {\n\tconst { canvasMode, dashboardLink, homeUrl, siteTitle } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getCanvasMode, getSettings } = unlock(\n\t\t\t\tselect( editSiteStore )\n\t\t\t);\n\n\t\t\tconst {\n\t\t\t\tgetSite,\n\t\t\t\tgetUnstableBase, // Site index.\n\t\t\t} = select( coreStore );\n\t\t\tconst _site = getSite();\n\t\t\treturn {\n\t\t\t\tcanvasMode: getCanvasMode(),\n\t\t\t\tdashboardLink:\n\t\t\t\t\tgetSettings().__experimentalDashboardLink || 'index.php',\n\t\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\t\tsiteTitle:\n\t\t\t\t\t! _site?.title && !! _site?.url\n\t\t\t\t\t\t? filterURLForDisplay( _site?.url )\n\t\t\t\t\t\t: _site?.title,\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\tconst disableMotion = useReducedMotion();\n\tconst { setCanvasMode } = unlock( useDispatch( editSiteStore ) );\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst { setDeviceType } = useDispatch( editorStore );\n\tconst isBackToDashboardButton = canvasMode === 'view';\n\tconst siteIconButtonProps = isBackToDashboardButton\n\t\t? {\n\t\t\t\thref: dashboardLink,\n\t\t\t\tlabel: __( 'Go to the Dashboard' ),\n\t\t }\n\t\t: {\n\t\t\t\thref: dashboardLink, // We need to keep the `href` here so the component doesn't remount as a `<button>` and break the animation.\n\t\t\t\trole: 'button',\n\t\t\t\tlabel: __( 'Open Navigation' ),\n\t\t\t\tonClick: ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tif ( canvasMode === 'edit' ) {\n\t\t\t\t\t\tclearSelectedBlock();\n\t\t\t\t\t\tsetDeviceType( 'Desktop' );\n\t\t\t\t\t\tsetCanvasMode( 'view' );\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t };\n\n\treturn (\n\t\t<motion.div\n\t\t\tclassName={ clsx( 'edit-site-site-hub', className ) }\n\t\t\tvariants={ {\n\t\t\t\tisDistractionFree: { x: '-100%' },\n\t\t\t\tisDistractionFreeHovering: { x: 0 },\n\t\t\t\tview: { x: 0 },\n\t\t\t\tedit: { x: 0 },\n\t\t\t} }\n\t\t\tinitial={ false }\n\t\t\ttransition={ {\n\t\t\t\ttype: 'tween',\n\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\tease: 'easeOut',\n\t\t\t} }\n\t\t>\n\t\t\t<HStack justify=\"flex-start\" spacing=\"0\">\n\t\t\t\t<motion.div\n\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t'edit-site-site-hub__view-mode-toggle-container',\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t'has-transparent-background': isTransparent,\n\t\t\t\t\t\t}\n\t\t\t\t\t) }\n\t\t\t\t\tlayout\n\t\t\t\t\ttransition={ {\n\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\tduration: disableMotion ? 0 : HUB_ANIMATION_DURATION,\n\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t} }\n\t\t\t\t>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t{ ...siteIconButtonProps }\n\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<motion.div\n\t\t\t\t\t\t\tinitial={ false }\n\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 1,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\twhileHover={ {\n\t\t\t\t\t\t\t\tscale: canvasMode === 'view' ? 0.5 : 0.96,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tduration: disableMotion\n\t\t\t\t\t\t\t\t\t? 0\n\t\t\t\t\t\t\t\t\t: HUB_ANIMATION_DURATION,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t</motion.div>\n\t\t\t\t\t</Button>\n\t\t\t\t</motion.div>\n\n\t\t\t\t<AnimatePresence initial={ false }>\n\t\t\t\t\t{ canvasMode === 'view' && (\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tas={ motion.div }\n\t\t\t\t\t\t\tinitial={ { opacity: 0 } }\n\t\t\t\t\t\t\tanimate={ {\n\t\t\t\t\t\t\t\topacity: isTransparent ? 0 : 1,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\texit={ { opacity: 0 } }\n\t\t\t\t\t\t\ttransition={ {\n\t\t\t\t\t\t\t\ttype: 'tween',\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.2,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t\tdelay: canvasMode === 'view' ? 0.1 : 0,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<div className=\"edit-site-site-hub__title\">\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\t\tlabel={ __(\n\t\t\t\t\t\t\t\t\t\t'View site (opens in a new tab)'\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\taria-label={ __(\n\t\t\t\t\t\t\t\t\t\t'View site (opens in a new tab)'\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{ decodeEntities( siteTitle ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t\t\tclassName=\"edit-site-site-hub__actions\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tclassName=\"edit-site-site-hub_toggle-command-center\"\n\t\t\t\t\t\t\t\t\ticon={ search }\n\t\t\t\t\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Open command palette' ) }\n\t\t\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</HStack>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t) }\n\t\t\t\t</AnimatePresence>\n\t\t\t</HStack>\n\t\t</motion.div>\n\t);\n} );\n\nexport default SiteHub;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,aAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,MAAA,G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A5D,WAAA,CAAA6C,GAAA,EAAC5D,WAAA,CAAAiF,MAAM;cACN7D,SAAS,EAAC,0CAA0C;cACpD4E,IAAI,EAAGC,aAAQ;cACfxC,OAAO,EAAGA,CAAA,KAAMhB,iBAAiB,CAAC,CAAG;cACrCa,KAAK,EAAG,IAAAC,QAAE,EAAE,sBAAuB,CAAG;cACtC2C,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;YAAG,CAC3C;UAAC,CACK,CAAC;QAAA,CACF;MACR,CACe,CAAC;IAAA,CACX;EAAC,CACE,CAAC;AAEf,CAAE,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAjB,OAAA,GAEWpE,OAAO","ignoreList":[]}
1
+ {"version":3,"names":["_clsx","_interopRequireDefault","require","_data","_components","_i18n","_coreData","_htmlEntities","_element","_icons","_commands","_keycodes","_url","_store","_siteIcon","_lockUnlock","_jsxRuntime","SiteHub","memo","forwardRef","isTransparent","ref","dashboardLink","homeUrl","siteTitle","useSelect","select","getSettings","unlock","editSiteStore","getSite","getUnstableBase","coreStore","_site","__experimentalDashboardLink","home","title","url","filterURLForDisplay","open","openCommandCenter","useDispatch","commandsStore","jsx","className","children","jsxs","__experimentalHStack","justify","spacing","clsx","Button","href","label","__","style","transform","borderRadius","default","variant","target","decodeEntities","expanded","icon","search","onClick","shortcut","displayShortcut","primary","_default","exports"],"sources":["@wordpress/edit-site/src/components/site-hub/index.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button, __experimentalHStack as HStack } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { memo, forwardRef } from '@wordpress/element';\nimport { search } from '@wordpress/icons';\nimport { store as commandsStore } from '@wordpress/commands';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { filterURLForDisplay } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport SiteIcon from '../site-icon';\nimport { unlock } from '../../lock-unlock';\n\nconst SiteHub = memo(\n\tforwardRef( ( { isTransparent }, ref ) => {\n\t\tconst { dashboardLink, homeUrl, siteTitle } = useSelect( ( select ) => {\n\t\t\tconst { getSettings } = unlock( select( editSiteStore ) );\n\n\t\t\tconst {\n\t\t\t\tgetSite,\n\t\t\t\tgetUnstableBase, // Site index.\n\t\t\t} = select( coreStore );\n\t\t\tconst _site = getSite();\n\t\t\treturn {\n\t\t\t\tdashboardLink:\n\t\t\t\t\tgetSettings().__experimentalDashboardLink || 'index.php',\n\t\t\t\thomeUrl: getUnstableBase()?.home,\n\t\t\t\tsiteTitle:\n\t\t\t\t\t! _site?.title && !! _site?.url\n\t\t\t\t\t\t? filterURLForDisplay( _site?.url )\n\t\t\t\t\t\t: _site?.title,\n\t\t\t};\n\t\t}, [] );\n\t\tconst { open: openCommandCenter } = useDispatch( commandsStore );\n\n\t\treturn (\n\t\t\t<div className=\"edit-site-site-hub\">\n\t\t\t\t<HStack justify=\"flex-start\" spacing=\"0\">\n\t\t\t\t\t<div\n\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t'edit-site-site-hub__view-mode-toggle-container',\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t'has-transparent-background': isTransparent,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tref={ ref }\n\t\t\t\t\t\t\thref={ dashboardLink }\n\t\t\t\t\t\t\tlabel={ __( 'Go to the Dashboard' ) }\n\t\t\t\t\t\t\tclassName=\"edit-site-layout__view-mode-toggle\"\n\t\t\t\t\t\t\tstyle={ {\n\t\t\t\t\t\t\t\ttransform: 'scale(0.5)',\n\t\t\t\t\t\t\t\tborderRadius: 4,\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<SiteIcon className=\"edit-site-layout__view-mode-toggle-icon\" />\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<HStack>\n\t\t\t\t\t\t<div className=\"edit-site-site-hub__title\">\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tvariant=\"link\"\n\t\t\t\t\t\t\t\thref={ homeUrl }\n\t\t\t\t\t\t\t\ttarget=\"_blank\"\n\t\t\t\t\t\t\t\tlabel={ __( 'View site (opens in a new tab)' ) }\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{ decodeEntities( siteTitle ) }\n\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<HStack\n\t\t\t\t\t\t\tspacing={ 0 }\n\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t\tclassName=\"edit-site-site-hub__actions\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\tclassName=\"edit-site-site-hub_toggle-command-center\"\n\t\t\t\t\t\t\t\ticon={ search }\n\t\t\t\t\t\t\t\tonClick={ () => openCommandCenter() }\n\t\t\t\t\t\t\t\tlabel={ __( 'Open command palette' ) }\n\t\t\t\t\t\t\t\tshortcut={ displayShortcut.primary( 'k' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</HStack>\n\t\t\t\t\t</HStack>\n\t\t\t\t</HStack>\n\t\t\t</div>\n\t\t);\n\t} )\n);\n\nexport default SiteHub;\n"],"mappings":";;;;;;;AAGA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA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,6BAA6B;UAAAC,QAAA,eAEvC,IAAA7B,WAAA,CAAA2B,GAAA,EAACvC,WAAA,CAAA+C,MAAM;YACNP,SAAS,EAAC,0CAA0C;YACpDmB,IAAI,EAAGC,aAAQ;YACfC,OAAO,EAAGA,CAAA,KAAMzB,iBAAiB,CAAC,CAAG;YACrCa,KAAK,EAAG,IAAAC,QAAE,EAAE,sBAAuB,CAAG;YACtCY,QAAQ,EAAGC,yBAAe,CAACC,OAAO,CAAE,GAAI;UAAG,CAC3C;QAAC,CACK,CAAC;MAAA,CACF,CAAC;IAAA,CACF;EAAC,CACL,CAAC;AAER,CAAE,CACH,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAZ,OAAA,GAEazC,OAAO","ignoreList":[]}
@@ -8,12 +8,14 @@ exports.PluginMoreMenuItem = PluginMoreMenuItem;
8
8
  exports.PluginSidebar = PluginSidebar;
9
9
  exports.PluginSidebarMoreMenuItem = PluginSidebarMoreMenuItem;
10
10
  var _editor = require("@wordpress/editor");
11
+ var _url = require("@wordpress/url");
11
12
  var _deprecated = _interopRequireDefault(require("@wordpress/deprecated"));
12
13
  var _jsxRuntime = require("react/jsx-runtime");
13
14
  /**
14
15
  * WordPress dependencies
15
16
  */
16
17
 
18
+ const isSiteEditor = (0, _url.getPath)(window.location.href)?.includes('site-editor.php');
17
19
  const deprecateSlot = name => {
18
20
  (0, _deprecated.default)(`wp.editPost.${name}`, {
19
21
  since: '6.6',
@@ -26,6 +28,9 @@ const deprecateSlot = name => {
26
28
  * @see PluginMoreMenuItem in @wordpress/editor package.
27
29
  */
28
30
  function PluginMoreMenuItem(props) {
31
+ if (!isSiteEditor) {
32
+ return null;
33
+ }
29
34
  deprecateSlot('PluginMoreMenuItem');
30
35
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.PluginMoreMenuItem, {
31
36
  ...props
@@ -36,6 +41,9 @@ function PluginMoreMenuItem(props) {
36
41
  * @see PluginSidebar in @wordpress/editor package.
37
42
  */
38
43
  function PluginSidebar(props) {
44
+ if (!isSiteEditor) {
45
+ return null;
46
+ }
39
47
  deprecateSlot('PluginSidebar');
40
48
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.PluginSidebar, {
41
49
  ...props
@@ -46,6 +54,9 @@ function PluginSidebar(props) {
46
54
  * @see PluginSidebarMoreMenuItem in @wordpress/editor package.
47
55
  */
48
56
  function PluginSidebarMoreMenuItem(props) {
57
+ if (!isSiteEditor) {
58
+ return null;
59
+ }
49
60
  deprecateSlot('PluginSidebarMoreMenuItem');
50
61
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_editor.PluginSidebarMoreMenuItem, {
51
62
  ...props
@@ -1 +1 @@
1
- {"version":3,"names":["_editor","require","_deprecated","_interopRequireDefault","_jsxRuntime","deprecateSlot","name","deprecated","since","alternative","PluginMoreMenuItem","props","jsx","PluginSidebar","PluginSidebarMoreMenuItem"],"sources":["@wordpress/edit-site/src/deprecated.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPluginMoreMenuItem as EditorPluginMoreMenuItem,\n\tPluginSidebar as EditorPluginSidebar,\n\tPluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,\n} from '@wordpress/editor';\nimport deprecated from '@wordpress/deprecated';\n\nconst deprecateSlot = ( name ) => {\n\tdeprecated( `wp.editPost.${ name }`, {\n\t\tsince: '6.6',\n\t\talternative: `wp.editor.${ name }`,\n\t} );\n};\n\n/* eslint-disable jsdoc/require-param */\n/**\n * @see PluginMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginMoreMenuItem( props ) {\n\tdeprecateSlot( 'PluginMoreMenuItem' );\n\treturn <EditorPluginMoreMenuItem { ...props } />;\n}\n\n/**\n * @see PluginSidebar in @wordpress/editor package.\n */\nexport function PluginSidebar( props ) {\n\tdeprecateSlot( 'PluginSidebar' );\n\treturn <EditorPluginSidebar { ...props } />;\n}\n\n/**\n * @see PluginSidebarMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginSidebarMoreMenuItem( props ) {\n\tdeprecateSlot( 'PluginSidebarMoreMenuItem' );\n\treturn <EditorPluginSidebarMoreMenuItem { ...props } />;\n}\n/* eslint-enable jsdoc/require-param */\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AAA+C,IAAAG,WAAA,GAAAH,OAAA;AAR/C;AACA;AACA;;AAQA,MAAMI,aAAa,GAAKC,IAAI,IAAM;EACjC,IAAAC,mBAAU,EAAG,eAAeD,IAAM,EAAC,EAAE;IACpCE,KAAK,EAAE,KAAK;IACZC,WAAW,EAAG,aAAaH,IAAM;EAClC,CAAE,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACO,SAASI,kBAAkBA,CAAEC,KAAK,EAAG;EAC3CN,aAAa,CAAE,oBAAqB,CAAC;EACrC,oBAAO,IAAAD,WAAA,CAAAQ,GAAA,EAACZ,OAAA,CAAAU,kBAAwB;IAAA,GAAMC;EAAK,CAAI,CAAC;AACjD;;AAEA;AACA;AACA;AACO,SAASE,aAAaA,CAAEF,KAAK,EAAG;EACtCN,aAAa,CAAE,eAAgB,CAAC;EAChC,oBAAO,IAAAD,WAAA,CAAAQ,GAAA,EAACZ,OAAA,CAAAa,aAAmB;IAAA,GAAMF;EAAK,CAAI,CAAC;AAC5C;;AAEA;AACA;AACA;AACO,SAASG,yBAAyBA,CAAEH,KAAK,EAAG;EAClDN,aAAa,CAAE,2BAA4B,CAAC;EAC5C,oBAAO,IAAAD,WAAA,CAAAQ,GAAA,EAACZ,OAAA,CAAAc,yBAA+B;IAAA,GAAMH;EAAK,CAAI,CAAC;AACxD;AACA","ignoreList":[]}
1
+ {"version":3,"names":["_editor","require","_url","_deprecated","_interopRequireDefault","_jsxRuntime","isSiteEditor","getPath","window","location","href","includes","deprecateSlot","name","deprecated","since","alternative","PluginMoreMenuItem","props","jsx","PluginSidebar","PluginSidebarMoreMenuItem"],"sources":["@wordpress/edit-site/src/deprecated.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tPluginMoreMenuItem as EditorPluginMoreMenuItem,\n\tPluginSidebar as EditorPluginSidebar,\n\tPluginSidebarMoreMenuItem as EditorPluginSidebarMoreMenuItem,\n} from '@wordpress/editor';\nimport { getPath } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\n\nconst isSiteEditor = getPath( window.location.href )?.includes(\n\t'site-editor.php'\n);\n\nconst deprecateSlot = ( name ) => {\n\tdeprecated( `wp.editPost.${ name }`, {\n\t\tsince: '6.6',\n\t\talternative: `wp.editor.${ name }`,\n\t} );\n};\n\n/* eslint-disable jsdoc/require-param */\n/**\n * @see PluginMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginMoreMenuItem( props ) {\n\tif ( ! isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginMoreMenuItem' );\n\treturn <EditorPluginMoreMenuItem { ...props } />;\n}\n\n/**\n * @see PluginSidebar in @wordpress/editor package.\n */\nexport function PluginSidebar( props ) {\n\tif ( ! isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginSidebar' );\n\treturn <EditorPluginSidebar { ...props } />;\n}\n\n/**\n * @see PluginSidebarMoreMenuItem in @wordpress/editor package.\n */\nexport function PluginSidebarMoreMenuItem( props ) {\n\tif ( ! isSiteEditor ) {\n\t\treturn null;\n\t}\n\tdeprecateSlot( 'PluginSidebarMoreMenuItem' );\n\treturn <EditorPluginSidebarMoreMenuItem { ...props } />;\n}\n/* eslint-enable jsdoc/require-param */\n"],"mappings":";;;;;;;;;AAGA,IAAAA,OAAA,GAAAC,OAAA;AAKA,IAAAC,IAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAC,sBAAA,CAAAH,OAAA;AAA+C,IAAAI,WAAA,GAAAJ,OAAA;AAT/C;AACA;AACA;;AASA,MAAMK,YAAY,GAAG,IAAAC,YAAO,EAAEC,MAAM,CAACC,QAAQ,CAACC,IAAK,CAAC,EAAEC,QAAQ,CAC7D,iBACD,CAAC;AAED,MAAMC,aAAa,GAAKC,IAAI,IAAM;EACjC,IAAAC,mBAAU,EAAG,eAAeD,IAAM,EAAC,EAAE;IACpCE,KAAK,EAAE,KAAK;IACZC,WAAW,EAAG,aAAaH,IAAM;EAClC,CAAE,CAAC;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACO,SAASI,kBAAkBA,CAAEC,KAAK,EAAG;EAC3C,IAAK,CAAEZ,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACAM,aAAa,CAAE,oBAAqB,CAAC;EACrC,oBAAO,IAAAP,WAAA,CAAAc,GAAA,EAACnB,OAAA,CAAAiB,kBAAwB;IAAA,GAAMC;EAAK,CAAI,CAAC;AACjD;;AAEA;AACA;AACA;AACO,SAASE,aAAaA,CAAEF,KAAK,EAAG;EACtC,IAAK,CAAEZ,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACAM,aAAa,CAAE,eAAgB,CAAC;EAChC,oBAAO,IAAAP,WAAA,CAAAc,GAAA,EAACnB,OAAA,CAAAoB,aAAmB;IAAA,GAAMF;EAAK,CAAI,CAAC;AAC5C;;AAEA;AACA;AACA;AACO,SAASG,yBAAyBA,CAAEH,KAAK,EAAG;EAClD,IAAK,CAAEZ,YAAY,EAAG;IACrB,OAAO,IAAI;EACZ;EACAM,aAAa,CAAE,2BAA4B,CAAC;EAC5C,oBAAO,IAAAP,WAAA,CAAAc,GAAA,EAACnB,OAAA,CAAAqB,yBAA+B;IAAA,GAAMH;EAAK,CAAI,CAAC;AACxD;AACA","ignoreList":[]}
@@ -271,7 +271,7 @@ function PushChangesToGlobalStylesControl({
271
271
  // notification.
272
272
  __unstableMarkNextChangeAsNotPersistent();
273
273
  setAttributes(newBlockAttributes);
274
- setUserConfig(() => newUserConfig, {
274
+ setUserConfig(newUserConfig, {
275
275
  undoIgnore: true
276
276
  });
277
277
  createSuccessNotice((0, _i18n.sprintf)(
@@ -283,7 +283,7 @@ function PushChangesToGlobalStylesControl({
283
283
  onClick() {
284
284
  __unstableMarkNextChangeAsNotPersistent();
285
285
  setAttributes(attributes);
286
- setUserConfig(() => userConfig, {
286
+ setUserConfig(userConfig, {
287
287
  undoIgnore: true
288
288
  });
289
289
  }
@@ -301,6 +301,7 @@ function PushChangesToGlobalStylesControl({
301
301
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.Button, {
302
302
  __next40pxDefaultSize: true,
303
303
  variant: "secondary",
304
+ __experimentalIsFocusable: true,
304
305
  disabled: changes.length === 0,
305
306
  onClick: pushChanges,
306
307
  children: (0, _i18n.__)('Apply globally')
@@ -1 +1 @@
1
- {"version":3,"names":["_hooks","require","_compose","_blockEditor","_components","_i18n","_blocks","_element","_data","_notices","_coreData","_hooks2","_lockUnlock","_cloneDeep","_interopRequireDefault","_setNestedValue","_jsxRuntime","cleanEmptyObject","GlobalStylesContext","unlock","blockEditorPrivateApis","STYLE_PROPERTY","__EXPERIMENTAL_STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","useSupportedStyles","blockUserConfig","styles","blocks","useMemo","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","useContext","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","createSuccessNotice","noticesStore","pushChanges","useCallback","length","blockStyles","newBlockStyles","cloneDeep","newUserConfig","setNestedValue","undefined","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","sprintf","__","getBlockType","title","type","actions","label","onClick","jsxs","BaseControl","className","help","children","jsx","VisualLabel","Button","__next40pxDefaultSize","variant","disabled","PushChangesToGlobalStyles","props","blockEditingMode","useBlockEditingMode","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","supportsStyles","some","feature","hasBlockSupport","isDisplayed","InspectorAdvancedControls","withPushChangesToGlobalStyles","createHigherOrderComponent","BlockEdit","Fragment","isSelected","addFilter"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\nimport cloneDeep from '../../utils/clone-deep';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { cleanEmptyObject, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( () => newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( () => userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":";;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IA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IAAA,GAAMjB;EAAK,CAAI,CAAC,EACxBA,KAAK,CAACmB,UAAU,iBAAI,IAAA1H,WAAA,CAAAgG,GAAA,EAACM,yBAAyB;IAAA,GAAMC;EAAK,CAAI,CAAC;AAAA,CAC/D,CAEJ,CAAC;AAED,IAAAoB,gBAAS,EACR,kBAAkB,EAClB,8CAA8C,EAC9CL,6BACD,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_hooks","require","_compose","_blockEditor","_components","_i18n","_blocks","_element","_data","_notices","_coreData","_hooks2","_lockUnlock","_cloneDeep","_interopRequireDefault","_setNestedValue","_jsxRuntime","cleanEmptyObject","GlobalStylesContext","unlock","blockEditorPrivateApis","STYLE_PROPERTY","__EXPERIMENTAL_STYLE_PROPERTY","blockGap","value","STYLE_PATH_TO_CSS_VAR_INFIX","STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE","SUPPORTED_STYLES","getValueFromObjectPath","object","path","forEach","fieldName","flatBorderProperties","sides","getBorderStyleChanges","border","presetColor","userStyle","changes","getFallbackBorderStyleChange","color","customColor","style","width","hasColorOrWidth","side","push","globalBorderStyle","useChangesToPush","name","attributes","userConfig","supports","useSupportedStyles","blockUserConfig","styles","blocks","useMemo","flatMap","key","presetAttributeKey","join","presetAttributeValue","linkChanges","hoverPath","hoverValue","includes","borderChanges","currentPath","splice","borderColor","change","PushChangesToGlobalStylesControl","setAttributes","user","setUserConfig","useContext","__unstableMarkNextChangeAsNotPersistent","useDispatch","blockEditorStore","createSuccessNotice","noticesStore","pushChanges","useCallback","length","blockStyles","newBlockStyles","cloneDeep","newUserConfig","setNestedValue","undefined","newBlockAttributes","backgroundColor","textColor","gradient","fontSize","fontFamily","undoIgnore","sprintf","__","getBlockType","title","type","actions","label","onClick","jsxs","BaseControl","className","help","children","jsx","VisualLabel","Button","__next40pxDefaultSize","variant","__experimentalIsFocusable","disabled","PushChangesToGlobalStyles","props","blockEditingMode","useBlockEditingMode","isBlockBasedTheme","useSelect","select","coreStore","getCurrentTheme","is_block_theme","supportsStyles","some","feature","hasBlockSupport","isDisplayed","InspectorAdvancedControls","withPushChangesToGlobalStyles","createHigherOrderComponent","BlockEdit","Fragment","isSelected","addFilter"],"sources":["@wordpress/edit-site/src/hooks/push-changes-to-global-styles/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addFilter } from '@wordpress/hooks';\nimport { createHigherOrderComponent } from '@wordpress/compose';\nimport {\n\tInspectorAdvancedControls,\n\tstore as blockEditorStore,\n\tprivateApis as blockEditorPrivateApis,\n\tuseBlockEditingMode,\n} from '@wordpress/block-editor';\nimport { BaseControl, Button } from '@wordpress/components';\nimport { __, sprintf } from '@wordpress/i18n';\nimport {\n\t__EXPERIMENTAL_STYLE_PROPERTY,\n\tgetBlockType,\n\thasBlockSupport,\n} from '@wordpress/blocks';\nimport { useContext, useMemo, useCallback } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { useSupportedStyles } from '../../components/global-styles/hooks';\nimport { unlock } from '../../lock-unlock';\nimport cloneDeep from '../../utils/clone-deep';\nimport setNestedValue from '../../utils/set-nested-value';\n\nconst { cleanEmptyObject, GlobalStylesContext } = unlock(\n\tblockEditorPrivateApis\n);\n\n// Block Gap is a special case and isn't defined within the blocks\n// style properties config. We'll add it here to allow it to be pushed\n// to global styles as well.\nconst STYLE_PROPERTY = {\n\t...__EXPERIMENTAL_STYLE_PROPERTY,\n\tblockGap: { value: [ 'spacing', 'blockGap' ] },\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'border.color': 'color',\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'elements.link.:hover.color.text': 'color',\n\t'elements.link.typography.fontFamily': 'font-family',\n\t'elements.link.typography.fontSize': 'font-size',\n\t'elements.button.color.text': 'color',\n\t'elements.button.color.background': 'color',\n\t'elements.button.typography.fontFamily': 'font-family',\n\t'elements.button.typography.fontSize': 'font-size',\n\t'elements.caption.color.text': 'color',\n\t'elements.heading.color': 'color',\n\t'elements.heading.color.background': 'color',\n\t'elements.heading.typography.fontFamily': 'font-family',\n\t'elements.heading.gradient': 'gradient',\n\t'elements.heading.color.gradient': 'gradient',\n\t'elements.h1.color': 'color',\n\t'elements.h1.color.background': 'color',\n\t'elements.h1.typography.fontFamily': 'font-family',\n\t'elements.h1.color.gradient': 'gradient',\n\t'elements.h2.color': 'color',\n\t'elements.h2.color.background': 'color',\n\t'elements.h2.typography.fontFamily': 'font-family',\n\t'elements.h2.color.gradient': 'gradient',\n\t'elements.h3.color': 'color',\n\t'elements.h3.color.background': 'color',\n\t'elements.h3.typography.fontFamily': 'font-family',\n\t'elements.h3.color.gradient': 'gradient',\n\t'elements.h4.color': 'color',\n\t'elements.h4.color.background': 'color',\n\t'elements.h4.typography.fontFamily': 'font-family',\n\t'elements.h4.color.gradient': 'gradient',\n\t'elements.h5.color': 'color',\n\t'elements.h5.color.background': 'color',\n\t'elements.h5.typography.fontFamily': 'font-family',\n\t'elements.h5.color.gradient': 'gradient',\n\t'elements.h6.color': 'color',\n\t'elements.h6.color.background': 'color',\n\t'elements.h6.typography.fontFamily': 'font-family',\n\t'elements.h6.color.gradient': 'gradient',\n\t'color.gradient': 'gradient',\n\tblockGap: 'spacing',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\n// TODO: Temporary duplication of constant in @wordpress/block-editor. Can be\n// removed by moving PushChangesToGlobalStylesControl to\n// @wordpress/block-editor.\nconst STYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE = {\n\t'border.color': 'borderColor',\n\t'color.background': 'backgroundColor',\n\t'color.text': 'textColor',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'fontSize',\n\t'typography.fontFamily': 'fontFamily',\n};\n\nconst SUPPORTED_STYLES = [ 'border', 'color', 'spacing', 'typography' ];\n\nconst getValueFromObjectPath = ( object, path ) => {\n\tlet value = object;\n\tpath.forEach( ( fieldName ) => {\n\t\tvalue = value?.[ fieldName ];\n\t} );\n\treturn value;\n};\n\nconst flatBorderProperties = [ 'borderColor', 'borderWidth', 'borderStyle' ];\nconst sides = [ 'top', 'right', 'bottom', 'left' ];\n\nfunction getBorderStyleChanges( border, presetColor, userStyle ) {\n\tif ( ! border && ! presetColor ) {\n\t\treturn [];\n\t}\n\n\tconst changes = [\n\t\t...getFallbackBorderStyleChange( 'top', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'right', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'bottom', border, userStyle ),\n\t\t...getFallbackBorderStyleChange( 'left', border, userStyle ),\n\t];\n\n\t// Handle a flat border i.e. all sides the same, CSS shorthand.\n\tconst { color: customColor, style, width } = border || {};\n\tconst hasColorOrWidth = presetColor || customColor || width;\n\n\tif ( hasColorOrWidth && ! style ) {\n\t\t// Global Styles need individual side configurations to overcome\n\t\t// theme.json configurations which are per side as well.\n\t\tsides.forEach( ( side ) => {\n\t\t\t// Only add fallback border-style if global styles don't already\n\t\t\t// have something set.\n\t\t\tif ( ! userStyle?.[ side ]?.style ) {\n\t\t\t\tchanges.push( {\n\t\t\t\t\tpath: [ 'border', side, 'style' ],\n\t\t\t\t\tvalue: 'solid',\n\t\t\t\t} );\n\t\t\t}\n\t\t} );\n\t}\n\n\treturn changes;\n}\n\nfunction getFallbackBorderStyleChange( side, border, globalBorderStyle ) {\n\tif ( ! border?.[ side ] || globalBorderStyle?.[ side ]?.style ) {\n\t\treturn [];\n\t}\n\n\tconst { color, style, width } = border[ side ];\n\tconst hasColorOrWidth = color || width;\n\n\tif ( ! hasColorOrWidth || style ) {\n\t\treturn [];\n\t}\n\n\treturn [ { path: [ 'border', side, 'style' ], value: 'solid' } ];\n}\n\nfunction useChangesToPush( name, attributes, userConfig ) {\n\tconst supports = useSupportedStyles( name );\n\tconst blockUserConfig = userConfig?.styles?.blocks?.[ name ];\n\n\treturn useMemo( () => {\n\t\tconst changes = supports.flatMap( ( key ) => {\n\t\t\tif ( ! STYLE_PROPERTY[ key ] ) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst { value: path } = STYLE_PROPERTY[ key ];\n\t\t\tconst presetAttributeKey = path.join( '.' );\n\t\t\tconst presetAttributeValue =\n\t\t\t\tattributes[\n\t\t\t\t\tSTYLE_PATH_TO_PRESET_BLOCK_ATTRIBUTE[ presetAttributeKey ]\n\t\t\t\t];\n\t\t\tconst value = presetAttributeValue\n\t\t\t\t? `var:preset|${ STYLE_PATH_TO_CSS_VAR_INFIX[ presetAttributeKey ] }|${ presetAttributeValue }`\n\t\t\t\t: getValueFromObjectPath( attributes.style, path );\n\n\t\t\t// Links only have a single support entry but have two element\n\t\t\t// style properties, color and hover color. The following check\n\t\t\t// will add the hover color to the changes if required.\n\t\t\tif ( key === 'linkColor' ) {\n\t\t\t\tconst linkChanges = value ? [ { path, value } ] : [];\n\t\t\t\tconst hoverPath = [\n\t\t\t\t\t'elements',\n\t\t\t\t\t'link',\n\t\t\t\t\t':hover',\n\t\t\t\t\t'color',\n\t\t\t\t\t'text',\n\t\t\t\t];\n\t\t\t\tconst hoverValue = getValueFromObjectPath(\n\t\t\t\t\tattributes.style,\n\t\t\t\t\thoverPath\n\t\t\t\t);\n\n\t\t\t\tif ( hoverValue ) {\n\t\t\t\t\tlinkChanges.push( { path: hoverPath, value: hoverValue } );\n\t\t\t\t}\n\n\t\t\t\treturn linkChanges;\n\t\t\t}\n\n\t\t\t// The shorthand border styles can't be mapped directly as global\n\t\t\t// styles requires longhand config.\n\t\t\tif ( flatBorderProperties.includes( key ) && value ) {\n\t\t\t\t// The shorthand config path is included to clear the block attribute.\n\t\t\t\tconst borderChanges = [ { path, value } ];\n\t\t\t\tsides.forEach( ( side ) => {\n\t\t\t\t\tconst currentPath = [ ...path ];\n\t\t\t\t\tcurrentPath.splice( -1, 0, side );\n\t\t\t\t\tborderChanges.push( { path: currentPath, value } );\n\t\t\t\t} );\n\t\t\t\treturn borderChanges;\n\t\t\t}\n\n\t\t\treturn value ? [ { path, value } ] : [];\n\t\t} );\n\n\t\t// To ensure display of a visible border, global styles require a\n\t\t// default border style if a border color or width is present.\n\t\tgetBorderStyleChanges(\n\t\t\tattributes.style?.border,\n\t\t\tattributes.borderColor,\n\t\t\tblockUserConfig?.border\n\t\t).forEach( ( change ) => changes.push( change ) );\n\n\t\treturn changes;\n\t}, [ supports, attributes, blockUserConfig ] );\n}\n\nfunction PushChangesToGlobalStylesControl( {\n\tname,\n\tattributes,\n\tsetAttributes,\n} ) {\n\tconst { user: userConfig, setUserConfig } =\n\t\tuseContext( GlobalStylesContext );\n\n\tconst changes = useChangesToPush( name, attributes, userConfig );\n\n\tconst { __unstableMarkNextChangeAsNotPersistent } =\n\t\tuseDispatch( blockEditorStore );\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\n\tconst pushChanges = useCallback( () => {\n\t\tif ( changes.length === 0 ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( changes.length > 0 ) {\n\t\t\tconst { style: blockStyles } = attributes;\n\n\t\t\tconst newBlockStyles = cloneDeep( blockStyles );\n\t\t\tconst newUserConfig = cloneDeep( userConfig );\n\n\t\t\tfor ( const { path, value } of changes ) {\n\t\t\t\tsetNestedValue( newBlockStyles, path, undefined );\n\t\t\t\tsetNestedValue(\n\t\t\t\t\tnewUserConfig,\n\t\t\t\t\t[ 'styles', 'blocks', name, ...path ],\n\t\t\t\t\tvalue\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst newBlockAttributes = {\n\t\t\t\tborderColor: undefined,\n\t\t\t\tbackgroundColor: undefined,\n\t\t\t\ttextColor: undefined,\n\t\t\t\tgradient: undefined,\n\t\t\t\tfontSize: undefined,\n\t\t\t\tfontFamily: undefined,\n\t\t\t\tstyle: cleanEmptyObject( newBlockStyles ),\n\t\t\t};\n\n\t\t\t// @wordpress/core-data doesn't support editing multiple entity types in\n\t\t\t// a single undo level. So for now, we disable @wordpress/core-data undo\n\t\t\t// tracking and implement our own Undo button in the snackbar\n\t\t\t// notification.\n\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\tsetAttributes( newBlockAttributes );\n\t\t\tsetUserConfig( newUserConfig, { undoIgnore: true } );\n\t\t\tcreateSuccessNotice(\n\t\t\t\tsprintf(\n\t\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t\t__( '%s styles applied.' ),\n\t\t\t\t\tgetBlockType( name ).title\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tactions: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tlabel: __( 'Undo' ),\n\t\t\t\t\t\t\tonClick() {\n\t\t\t\t\t\t\t\t__unstableMarkNextChangeAsNotPersistent();\n\t\t\t\t\t\t\t\tsetAttributes( attributes );\n\t\t\t\t\t\t\t\tsetUserConfig( userConfig, {\n\t\t\t\t\t\t\t\t\tundoIgnore: true,\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t}, [\n\t\t__unstableMarkNextChangeAsNotPersistent,\n\t\tattributes,\n\t\tchanges,\n\t\tcreateSuccessNotice,\n\t\tname,\n\t\tsetAttributes,\n\t\tsetUserConfig,\n\t\tuserConfig,\n\t] );\n\n\treturn (\n\t\t<BaseControl\n\t\t\tclassName=\"edit-site-push-changes-to-global-styles-control\"\n\t\t\thelp={ sprintf(\n\t\t\t\t// translators: %s: Title of the block e.g. 'Heading'.\n\t\t\t\t__(\n\t\t\t\t\t'Apply this block’s typography, spacing, dimensions, and color styles to all %s blocks.'\n\t\t\t\t),\n\t\t\t\tgetBlockType( name ).title\n\t\t\t) }\n\t\t>\n\t\t\t<BaseControl.VisualLabel>\n\t\t\t\t{ __( 'Styles' ) }\n\t\t\t</BaseControl.VisualLabel>\n\t\t\t<Button\n\t\t\t\t__next40pxDefaultSize\n\t\t\t\tvariant=\"secondary\"\n\t\t\t\t__experimentalIsFocusable\n\t\t\t\tdisabled={ changes.length === 0 }\n\t\t\t\tonClick={ pushChanges }\n\t\t\t>\n\t\t\t\t{ __( 'Apply globally' ) }\n\t\t\t</Button>\n\t\t</BaseControl>\n\t);\n}\n\nfunction PushChangesToGlobalStyles( props ) {\n\tconst blockEditingMode = useBlockEditingMode();\n\tconst isBlockBasedTheme = useSelect(\n\t\t( select ) => select( coreStore ).getCurrentTheme()?.is_block_theme,\n\t\t[]\n\t);\n\tconst supportsStyles = SUPPORTED_STYLES.some( ( feature ) =>\n\t\thasBlockSupport( props.name, feature )\n\t);\n\tconst isDisplayed =\n\t\tblockEditingMode === 'default' && supportsStyles && isBlockBasedTheme;\n\n\tif ( ! isDisplayed ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<InspectorAdvancedControls>\n\t\t\t<PushChangesToGlobalStylesControl { ...props } />\n\t\t</InspectorAdvancedControls>\n\t);\n}\n\nconst withPushChangesToGlobalStyles = createHigherOrderComponent(\n\t( BlockEdit ) => ( props ) => (\n\t\t<>\n\t\t\t<BlockEdit { ...props } />\n\t\t\t{ props.isSelected && <PushChangesToGlobalStyles { ...props } /> }\n\t\t</>\n\t)\n);\n\naddFilter(\n\t'editor.BlockEdit',\n\t'core/edit-site/push-changes-to-global-styles',\n\twithPushChangesToGlobalStyles\n);\n"],"mappings":";;;AAGA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AAMA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAL,OAAA;AAKA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAA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;AAAA,CAC/D,CAEJ,CAAC;AAED,IAAAoB,gBAAS,EACR,kBAAkB,EAClB,8CAA8C,EAC9CL,6BACD,CAAC","ignoreList":[]}
@@ -12,7 +12,7 @@ var _privateApis = require("@wordpress/private-apis");
12
12
  const {
13
13
  lock,
14
14
  unlock
15
- } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.', '@wordpress/edit-site');
15
+ } = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/edit-site');
16
16
  exports.unlock = unlock;
17
17
  exports.lock = lock;
18
18
  //# sourceMappingURL=lock-unlock.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/edit-site/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my theme or plugin will inevitably break in the next version of WordPress.',\n\t\t'@wordpress/edit-site'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,iHAAiH,EACjH,sBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
1
+ {"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/edit-site/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\n\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/edit-site'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,+HAA+H,EAC/H,sBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -20,27 +20,42 @@ const setCanvasMode = mode => ({
20
20
  registry,
21
21
  dispatch
22
22
  }) => {
23
- const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
24
- registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
25
- const isPublishSidebarOpened = registry.select(_editor.store).isPublishSidebarOpened();
26
- dispatch({
27
- type: 'SET_CANVAS_MODE',
28
- mode
29
- });
30
- const isEditMode = mode === 'edit';
31
- if (isPublishSidebarOpened && !isEditMode) {
32
- registry.dispatch(_editor.store).closePublishSidebar();
33
- }
23
+ const switchCanvasMode = () => {
24
+ registry.batch(() => {
25
+ const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
26
+ registry.dispatch(_blockEditor.store).clearSelectedBlock();
27
+ registry.dispatch(_editor.store).setDeviceType('Desktop');
28
+ registry.dispatch(_blockEditor.store).__unstableSetEditorMode('edit');
29
+ const isPublishSidebarOpened = registry.select(_editor.store).isPublishSidebarOpened();
30
+ dispatch({
31
+ type: 'SET_CANVAS_MODE',
32
+ mode
33
+ });
34
+ const isEditMode = mode === 'edit';
35
+ if (isPublishSidebarOpened && !isEditMode) {
36
+ registry.dispatch(_editor.store).closePublishSidebar();
37
+ }
34
38
 
35
- // Check if the block list view should be open by default.
36
- // If `distractionFree` mode is enabled, the block list view should not be open.
37
- // This behavior is disabled for small viewports.
38
- if (isMediumOrBigger && isEditMode && registry.select(_preferences.store).get('core', 'showListViewByDefault') && !registry.select(_preferences.store).get('core', 'distractionFree')) {
39
- registry.dispatch(_editor.store).setIsListViewOpened(true);
39
+ // Check if the block list view should be open by default.
40
+ // If `distractionFree` mode is enabled, the block list view should not be open.
41
+ // This behavior is disabled for small viewports.
42
+ if (isMediumOrBigger && isEditMode && registry.select(_preferences.store).get('core', 'showListViewByDefault') && !registry.select(_preferences.store).get('core', 'distractionFree')) {
43
+ registry.dispatch(_editor.store).setIsListViewOpened(true);
44
+ } else {
45
+ registry.dispatch(_editor.store).setIsListViewOpened(false);
46
+ }
47
+ registry.dispatch(_editor.store).setIsInserterOpened(false);
48
+ });
49
+ };
50
+ if (!document.startViewTransition) {
51
+ switchCanvasMode();
40
52
  } else {
41
- registry.dispatch(_editor.store).setIsListViewOpened(false);
53
+ document.documentElement.classList.add(`canvas-mode-${mode}-transition`);
54
+ const transition = document.startViewTransition(() => switchCanvasMode());
55
+ transition.finished.finally(() => {
56
+ document.documentElement.classList.remove(`canvas-mode-${mode}-transition`);
57
+ });
42
58
  }
43
- registry.dispatch(_editor.store).setIsInserterOpened(false);
44
59
  };
45
60
 
46
61
  /**
@@ -1 +1 @@
1
- {"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","isMediumOrBigger","window","matchMedia","matches","blockEditorStore","__unstableSetEditorMode","isPublishSidebarOpened","select","editorStore","type","isEditMode","closePublishSidebar","preferencesStore","get","setIsListViewOpened","setIsInserterOpened","exports","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst isMediumOrBigger =\n\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\tregistry.dispatch( blockEditorStore ).__unstableSetEditorMode( 'edit' );\n\t\tconst isPublishSidebarOpened = registry\n\t\t\t.select( editorStore )\n\t\t\t.isPublishSidebarOpened();\n\t\tdispatch( {\n\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\tmode,\n\t\t} );\n\t\tconst isEditMode = mode === 'edit';\n\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t}\n\n\t\t// Check if the block list view should be open by default.\n\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t// This behavior is disabled for small viewports.\n\t\tif (\n\t\t\tisMediumOrBigger &&\n\t\t\tisEditMode &&\n\t\t\tregistry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t! registry\n\t\t\t\t.select( preferencesStore )\n\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t) {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( true );\n\t\t} else {\n\t\t\tregistry.dispatch( editorStore ).setIsListViewOpened( false );\n\t\t}\n\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACO,MAAMG,aAAa,GACvBC,IAAI,IACN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E;IACTU,IAAI,EAAE,kCAAkC;IACxCS;EACD,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_blockEditor","require","_preferences","_editor","setCanvasMode","mode","registry","dispatch","switchCanvasMode","batch","isMediumOrBigger","window","matchMedia","matches","blockEditorStore","clearSelectedBlock","editorStore","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","preferencesStore","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","exports","setEditorCanvasContainerView","view"],"sources":["@wordpress/edit-site/src/store/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\n\n/**\n * Action that switches the canvas mode.\n *\n * @param {?string} mode Canvas mode.\n */\nexport const setCanvasMode =\n\t( mode ) =>\n\t( { registry, dispatch } ) => {\n\t\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\n\t\t\t\tconst isMediumOrBigger =\n\t\t\t\t\twindow.matchMedia( '(min-width: 782px)' ).matches;\n\t\t\t\tregistry.dispatch( blockEditorStore ).clearSelectedBlock();\n\t\t\t\tregistry.dispatch( editorStore ).setDeviceType( 'Desktop' );\n\t\t\t\tregistry\n\t\t\t\t\t.dispatch( blockEditorStore )\n\t\t\t\t\t.__unstableSetEditorMode( 'edit' );\n\t\t\t\tconst isPublishSidebarOpened = registry\n\t\t\t\t\t.select( editorStore )\n\t\t\t\t\t.isPublishSidebarOpened();\n\t\t\t\tdispatch( {\n\t\t\t\t\ttype: 'SET_CANVAS_MODE',\n\t\t\t\t\tmode,\n\t\t\t\t} );\n\t\t\t\tconst isEditMode = mode === 'edit';\n\t\t\t\tif ( isPublishSidebarOpened && ! isEditMode ) {\n\t\t\t\t\tregistry.dispatch( editorStore ).closePublishSidebar();\n\t\t\t\t}\n\n\t\t\t\t// Check if the block list view should be open by default.\n\t\t\t\t// If `distractionFree` mode is enabled, the block list view should not be open.\n\t\t\t\t// This behavior is disabled for small viewports.\n\t\t\t\tif (\n\t\t\t\t\tisMediumOrBigger &&\n\t\t\t\t\tisEditMode &&\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'showListViewByDefault' ) &&\n\t\t\t\t\t! registry\n\t\t\t\t\t\t.select( preferencesStore )\n\t\t\t\t\t\t.get( 'core', 'distractionFree' )\n\t\t\t\t) {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( true );\n\t\t\t\t} else {\n\t\t\t\t\tregistry\n\t\t\t\t\t\t.dispatch( editorStore )\n\t\t\t\t\t\t.setIsListViewOpened( false );\n\t\t\t\t}\n\t\t\t\tregistry.dispatch( editorStore ).setIsInserterOpened( false );\n\t\t\t} );\n\t\t};\n\n\t\tif ( ! document.startViewTransition ) {\n\t\t\tswitchCanvasMode();\n\t\t} else {\n\t\t\tdocument.documentElement.classList.add(\n\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t);\n\t\t\tconst transition = document.startViewTransition( () =>\n\t\t\t\tswitchCanvasMode()\n\t\t\t);\n\t\t\ttransition.finished.finally( () => {\n\t\t\t\tdocument.documentElement.classList.remove(\n\t\t\t\t\t`canvas-mode-${ mode }-transition`\n\t\t\t\t);\n\t\t\t} );\n\t\t}\n\t};\n\n/**\n * Action that switches the editor canvas container view.\n *\n * @param {?string} view Editor canvas container view.\n */\nexport const setEditorCanvasContainerView =\n\t( view ) =>\n\t( { dispatch } ) => {\n\t\tdispatch( {\n\t\t\ttype: 'SET_EDITOR_CANVAS_CONTAINER_VIEW',\n\t\t\tview,\n\t\t} );\n\t};\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,YAA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E,IAAK,CAAC;MAC9B,CAAC,MAAM;QACNpB,QAAQ,CACNC,QAAQ,CAAES,aAAY,CAAC,CACvBU,mBAAmB,CAAE,KAAM,CAAC;MAC/B;MACApB,QAAQ,CAACC,QAAQ,CAAES,aAAY,CAAC,CAACW,mBAAmB,CAAE,KAAM,CAAC;IAC9D,CAAE,CAAC;EACJ,CAAC;EAED,IAAK,CAAEC,QAAQ,CAACC,mBAAmB,EAAG;IACrCrB,gBAAgB,CAAC,CAAC;EACnB,CAAC,MAAM;IACNoB,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACC,GAAG,CACpC,eAAe3B,IAAM,aACvB,CAAC;IACD,MAAM4B,UAAU,GAAGL,QAAQ,CAACC,mBAAmB,CAAE,MAChDrB,gBAAgB,CAAC,CAClB,CAAC;IACDyB,UAAU,CAACC,QAAQ,CAACC,OAAO,CAAE,MAAM;MAClCP,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACK,MAAM,CACvC,eAAe/B,IAAM,aACvB,CAAC;IACF,CAAE,CAAC;EACJ;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AAJAgC,OAAA,CAAAjC,aAAA,GAAAA,aAAA;AAKO,MAAMkC,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAEhC;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTc,IAAI,EAAE,kCAAkC;IACxCkB;EACD,CAAE,CAAC;AACJ,CAAC;AAACF,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
@@ -7,6 +7,7 @@ import { useDispatch } from '@wordpress/data';
7
7
  import { useState } from '@wordpress/element';
8
8
  import { store as coreStore } from '@wordpress/core-data';
9
9
  import { store as noticesStore } from '@wordpress/notices';
10
+ import { decodeEntities } from '@wordpress/html-entities';
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
11
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
12
13
  export default function AddNewPageModal({
@@ -39,7 +40,7 @@ export default function AddNewPageModal({
39
40
  onSave(newPage);
40
41
  createSuccessNotice(sprintf(
41
42
  // translators: %s: Title of the created template e.g: "Category".
42
- __('"%s" successfully created.'), newPage.title?.rendered || title), {
43
+ __('"%s" successfully created.'), decodeEntities(newPage.title?.rendered || title)), {
43
44
  type: 'snackbar'
44
45
  });
45
46
  } catch (error) {