@wordpress/edit-site 6.48.1 → 6.49.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.
- package/CHANGELOG.md +2 -0
- package/build/components/add-new-post/index.cjs +0 -1
- package/build/components/add-new-post/index.cjs.map +2 -2
- package/build/components/add-new-template/add-custom-generic-template-modal-content.cjs +0 -1
- package/build/components/add-new-template/add-custom-generic-template-modal-content.cjs.map +2 -2
- package/build/components/add-new-template-legacy/add-custom-generic-template-modal-content.cjs +0 -1
- package/build/components/add-new-template-legacy/add-custom-generic-template-modal-content.cjs.map +2 -2
- package/build/components/editor/use-editor-title.cjs +1 -1
- package/build/components/editor/use-editor-title.cjs.map +2 -2
- package/build/components/layout/index.cjs +30 -11
- package/build/components/layout/index.cjs.map +3 -3
- package/build/components/page-patterns/fields.cjs +2 -51
- package/build/components/page-patterns/fields.cjs.map +3 -3
- package/build/components/page-patterns/index.cjs +12 -23
- package/build/components/page-patterns/index.cjs.map +2 -2
- package/build/components/page-templates/index-legacy.cjs +8 -27
- package/build/components/page-templates/index-legacy.cjs.map +2 -2
- package/build/components/resizable-frame/index.cjs.map +2 -2
- package/build/components/routes/use-title.cjs +1 -1
- package/build/components/routes/use-title.cjs.map +2 -2
- package/build/components/save-button/index.cjs +2 -2
- package/build/components/save-button/index.cjs.map +1 -1
- package/build/components/save-hub/index.cjs +3 -3
- package/build/components/save-hub/index.cjs.map +3 -3
- package/build/components/sidebar-dataviews/index.cjs +3 -1
- package/build/components/sidebar-dataviews/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-item/index.cjs +17 -3
- package/build/components/sidebar-navigation-item/index.cjs.map +3 -3
- package/build/components/sidebar-navigation-screen-global-styles/index.cjs +2 -18
- package/build/components/sidebar-navigation-screen-global-styles/index.cjs.map +3 -3
- package/build/components/sidebar-navigation-screen-identity/index.cjs +0 -19
- package/build/components/sidebar-navigation-screen-identity/index.cjs.map +3 -3
- package/build/components/sidebar-navigation-screen-main/index.cjs +49 -56
- package/build/components/sidebar-navigation-screen-main/index.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.cjs +0 -1
- package/build/components/sidebar-navigation-screen-navigation-menu/rename-modal.cjs.map +2 -2
- package/build/components/sidebar-navigation-screen-patterns/index.cjs +6 -3
- package/build/components/sidebar-navigation-screen-patterns/index.cjs.map +2 -2
- package/build/components/welcome-guide/editor.cjs +1 -1
- package/build/components/welcome-guide/editor.cjs.map +1 -1
- package/build/components/welcome-guide/page.cjs +1 -1
- package/build/components/welcome-guide/page.cjs.map +1 -1
- package/build/components/welcome-guide/template.cjs +1 -1
- package/build/components/welcome-guide/template.cjs.map +1 -1
- package/build-module/components/add-new-post/index.mjs +0 -1
- package/build-module/components/add-new-post/index.mjs.map +2 -2
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.mjs +0 -1
- package/build-module/components/add-new-template/add-custom-generic-template-modal-content.mjs.map +2 -2
- package/build-module/components/add-new-template-legacy/add-custom-generic-template-modal-content.mjs +0 -1
- package/build-module/components/add-new-template-legacy/add-custom-generic-template-modal-content.mjs.map +2 -2
- package/build-module/components/editor/use-editor-title.mjs +1 -1
- package/build-module/components/editor/use-editor-title.mjs.map +2 -2
- package/build-module/components/layout/index.mjs +26 -7
- package/build-module/components/layout/index.mjs.map +2 -2
- package/build-module/components/page-patterns/fields.mjs +2 -40
- package/build-module/components/page-patterns/fields.mjs.map +2 -2
- package/build-module/components/page-patterns/index.mjs +14 -29
- package/build-module/components/page-patterns/index.mjs.map +2 -2
- package/build-module/components/page-templates/index-legacy.mjs +9 -28
- package/build-module/components/page-templates/index-legacy.mjs.map +2 -2
- package/build-module/components/resizable-frame/index.mjs.map +2 -2
- package/build-module/components/routes/use-title.mjs +1 -1
- package/build-module/components/routes/use-title.mjs.map +2 -2
- package/build-module/components/save-button/index.mjs +2 -2
- package/build-module/components/save-button/index.mjs.map +1 -1
- package/build-module/components/save-hub/index.mjs +3 -3
- package/build-module/components/save-hub/index.mjs.map +2 -2
- package/build-module/components/sidebar-dataviews/index.mjs +3 -1
- package/build-module/components/sidebar-dataviews/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-item/index.mjs +18 -8
- package/build-module/components/sidebar-navigation-item/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-global-styles/index.mjs +2 -14
- package/build-module/components/sidebar-navigation-screen-global-styles/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-identity/index.mjs +0 -15
- package/build-module/components/sidebar-navigation-screen-identity/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-main/index.mjs +50 -57
- package/build-module/components/sidebar-navigation-screen-main/index.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.mjs +0 -1
- package/build-module/components/sidebar-navigation-screen-navigation-menu/rename-modal.mjs.map +2 -2
- package/build-module/components/sidebar-navigation-screen-patterns/index.mjs +6 -3
- package/build-module/components/sidebar-navigation-screen-patterns/index.mjs.map +2 -2
- package/build-module/components/welcome-guide/editor.mjs +1 -1
- package/build-module/components/welcome-guide/editor.mjs.map +1 -1
- package/build-module/components/welcome-guide/page.mjs +1 -1
- package/build-module/components/welcome-guide/page.mjs.map +1 -1
- package/build-module/components/welcome-guide/template.mjs +1 -1
- package/build-module/components/welcome-guide/template.mjs.map +1 -1
- package/build-style/{experimental-admin-bar-in-editor-rtl.css → experimental-omnibar-rtl.css} +46 -1
- package/build-style/{experimental-admin-bar-in-editor.css → experimental-omnibar.css} +46 -1
- package/build-style/style-rtl.css +250 -273
- package/build-style/style.css +250 -273
- package/package.json +48 -48
- package/src/components/add-new-post/index.js +0 -1
- package/src/components/add-new-template/add-custom-generic-template-modal-content.js +0 -1
- package/src/components/add-new-template-legacy/add-custom-generic-template-modal-content.js +0 -1
- package/src/components/layout/index.js +21 -11
- package/src/components/layout/style.scss +19 -12
- package/src/components/page-patterns/fields.js +1 -48
- package/src/components/page-patterns/index.js +17 -29
- package/src/components/page-patterns/style.scss +1 -1
- package/src/components/page-templates/index-legacy.js +9 -28
- package/src/components/page-templates/style.scss +0 -5
- package/src/components/resizable-frame/index.js +0 -1
- package/src/components/save-hub/index.js +4 -4
- package/src/components/save-hub/style.scss +3 -3
- package/src/components/sidebar-button/style.scss +2 -2
- package/src/components/sidebar-dataviews/index.js +3 -0
- package/src/components/sidebar-global-styles/style.scss +1 -1
- package/src/components/sidebar-navigation-item/index.js +22 -9
- package/src/components/sidebar-navigation-item/style.scss +6 -6
- package/src/components/sidebar-navigation-screen/style.scss +8 -8
- package/src/components/sidebar-navigation-screen-global-styles/index.js +2 -15
- package/src/components/sidebar-navigation-screen-identity/index.js +0 -15
- package/src/components/sidebar-navigation-screen-main/index.js +49 -54
- package/src/components/sidebar-navigation-screen-navigation-menu/rename-modal.js +0 -1
- package/src/components/sidebar-navigation-screen-navigation-menu/style.scss +2 -2
- package/src/components/sidebar-navigation-screen-navigation-menus/style.scss +8 -8
- package/src/components/sidebar-navigation-screen-patterns/index.js +4 -0
- package/src/components/sidebar-navigation-screen-patterns/style.scss +1 -1
- package/src/components/site-hub/style.scss +5 -5
- package/src/components/welcome-guide/page.js +1 -1
- package/src/{experimental-admin-bar-in-editor.scss → experimental-omnibar.scss} +3 -1
- package/src/style.scss +2 -2
|
@@ -49,9 +49,10 @@ var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
|
49
49
|
var import_dataviews_actions = require("../dataviews-actions/index.cjs");
|
|
50
50
|
var import_fields = require("./fields.cjs");
|
|
51
51
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
|
-
var { usePostActions,
|
|
52
|
+
var { usePostActions, usePostFields } = (0, import_lock_unlock.unlock)(import_editor.privateApis);
|
|
53
53
|
var { useHistory, useLocation } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
54
54
|
var { useEntityRecordsWithPermissions } = (0, import_lock_unlock.unlock)(import_core_data.privateApis);
|
|
55
|
+
var VIEW_CONFIG_FIELDS = ["default_view", "default_layouts", "view_list"];
|
|
55
56
|
function PageTemplates() {
|
|
56
57
|
const { path, query } = useLocation();
|
|
57
58
|
const { activeView = "all", postId } = query;
|
|
@@ -62,7 +63,8 @@ function PageTemplates() {
|
|
|
62
63
|
view_list: viewList
|
|
63
64
|
} = (0, import_views.useViewConfig)({
|
|
64
65
|
kind: "postType",
|
|
65
|
-
name: import_constants.TEMPLATE_POST_TYPE
|
|
66
|
+
name: import_constants.TEMPLATE_POST_TYPE,
|
|
67
|
+
fields: VIEW_CONFIG_FIELDS
|
|
66
68
|
});
|
|
67
69
|
const activeViewOverrides = (0, import_element.useMemo)(
|
|
68
70
|
() => viewList?.find((v) => v.slug === activeView)?.view ?? {},
|
|
@@ -106,31 +108,10 @@ function PageTemplates() {
|
|
|
106
108
|
},
|
|
107
109
|
[history, path, view?.type]
|
|
108
110
|
);
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
const authorsSet = /* @__PURE__ */ new Set();
|
|
114
|
-
records.forEach((template) => {
|
|
115
|
-
authorsSet.add(template.author_text);
|
|
116
|
-
});
|
|
117
|
-
return Array.from(authorsSet).map((author) => ({
|
|
118
|
-
value: author,
|
|
119
|
-
label: author
|
|
120
|
-
}));
|
|
121
|
-
}, [records]);
|
|
122
|
-
const fields = (0, import_element.useMemo)(
|
|
123
|
-
() => [
|
|
124
|
-
import_fields.previewField,
|
|
125
|
-
templateTitleField,
|
|
126
|
-
import_fields.descriptionField,
|
|
127
|
-
{
|
|
128
|
-
...import_fields.authorField,
|
|
129
|
-
elements: authors
|
|
130
|
-
}
|
|
131
|
-
],
|
|
132
|
-
[authors]
|
|
133
|
-
);
|
|
111
|
+
const postFields = usePostFields({ postType: import_constants.TEMPLATE_POST_TYPE });
|
|
112
|
+
const fields = (0, import_element.useMemo)(() => {
|
|
113
|
+
return [import_fields.previewField, ...postFields || []];
|
|
114
|
+
}, [postFields]);
|
|
134
115
|
const { data, paginationInfo } = (0, import_element.useMemo)(() => {
|
|
135
116
|
return (0, import_dataviews.filterSortAndPaginate)(records, view, fields);
|
|
136
117
|
}, [records, view, fields]);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/page-templates/index-legacy.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEvent } from '@wordpress/compose';\nimport { useView, useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template-legacy';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAqB;AACrB,kBAAmB;AACnB,qBAA+C;AAC/C,uBAA+C;AAC/C,uBAAiD;AACjD,oBAAiD;AACjD,oBAAiD;AACjD,iBAA6B;AAC7B,qBAAyB;AACzB,mBAAuC;AAKvC,qCAA2B;AAC3B,uBAAmC;AACnC,yBAAuB;AACvB,+BAAkC;AAClC,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { Page } from '@wordpress/admin-ui';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useMemo, useCallback } from '@wordpress/element';\nimport { privateApis as corePrivateApis } from '@wordpress/core-data';\nimport { DataViews, filterSortAndPaginate } from '@wordpress/dataviews';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useEvent } from '@wordpress/compose';\nimport { useView, useViewConfig } from '@wordpress/views';\n\n/**\n * Internal dependencies\n */\nimport AddNewTemplate from '../add-new-template-legacy';\nimport { TEMPLATE_POST_TYPE } from '../../utils/constants';\nimport { unlock } from '../../lock-unlock';\nimport { useEditPostAction } from '../dataviews-actions';\nimport { previewField } from './fields';\n\nconst { usePostActions, usePostFields } = unlock( editorPrivateApis );\nconst { useHistory, useLocation } = unlock( routerPrivateApis );\nconst { useEntityRecordsWithPermissions } = unlock( corePrivateApis );\n\nconst VIEW_CONFIG_FIELDS = [ 'default_view', 'default_layouts', 'view_list' ];\n\nexport default function PageTemplates() {\n\tconst { path, query } = useLocation();\n\tconst { activeView = 'all', postId } = query;\n\tconst [ selection, setSelection ] = useState( [ postId ] );\n\n\tconst {\n\t\tdefault_view: defaultView,\n\t\tdefault_layouts: defaultLayouts,\n\t\tview_list: viewList,\n\t} = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: TEMPLATE_POST_TYPE,\n\t\tfields: VIEW_CONFIG_FIELDS,\n\t} );\n\tconst activeViewOverrides = useMemo(\n\t\t() => viewList?.find( ( v ) => v.slug === activeView )?.view ?? {},\n\t\t[ viewList, activeView ]\n\t);\n\tconst { view, updateView, isModified, resetToDefault } = useView( {\n\t\tkind: 'postType',\n\t\tname: TEMPLATE_POST_TYPE,\n\t\tslug: 'default',\n\t\tdefaultView,\n\t\tactiveViewOverrides,\n\t\tdefaultLayouts,\n\t\tqueryParams: {\n\t\t\tpage: query.pageNumber,\n\t\t\tsearch: query.search,\n\t\t},\n\t\tonChangeQueryParams: ( newQueryParams ) => {\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t...query,\n\t\t\t\t\tpageNumber: newQueryParams.page,\n\t\t\t\t\tsearch: newQueryParams.search || undefined,\n\t\t\t\t} )\n\t\t\t);\n\t\t},\n\t} );\n\n\tconst { records, isResolving: isLoadingData } =\n\t\tuseEntityRecordsWithPermissions( 'postType', TEMPLATE_POST_TYPE, {\n\t\t\tper_page: -1,\n\t\t} );\n\tconst history = useHistory();\n\tconst onChangeSelection = useCallback(\n\t\t( items ) => {\n\t\t\tsetSelection( items );\n\t\t\tif ( view?.type === 'list' ) {\n\t\t\t\thistory.navigate(\n\t\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\t\tpostId: items.length === 1 ? items[ 0 ] : undefined,\n\t\t\t\t\t} )\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ history, path, view?.type ]\n\t);\n\n\tconst postFields = usePostFields( { postType: TEMPLATE_POST_TYPE } );\n\tconst fields = useMemo( () => {\n\t\treturn [ previewField, ...( postFields || [] ) ];\n\t}, [ postFields ] );\n\n\tconst { data, paginationInfo } = useMemo( () => {\n\t\treturn filterSortAndPaginate( records, view, fields );\n\t}, [ records, view, fields ] );\n\n\tconst postTypeActions = usePostActions( {\n\t\tpostType: TEMPLATE_POST_TYPE,\n\t\tcontext: 'list',\n\t} );\n\tconst editAction = useEditPostAction();\n\tconst actions = useMemo(\n\t\t() => [ editAction, ...postTypeActions ],\n\t\t[ postTypeActions, editAction ]\n\t);\n\n\tconst onChangeView = useEvent( ( newView ) => {\n\t\tupdateView( newView );\n\t\tif ( newView.type !== view.type ) {\n\t\t\t// Retrigger the routing areas resolution.\n\t\t\thistory.invalidate();\n\t\t}\n\t} );\n\n\treturn (\n\t\t<Page\n\t\t\tclassName=\"edit-site-page-templates\"\n\t\t\ttitle={ __( 'Templates' ) }\n\t\t\theadingLevel={ 2 }\n\t\t\tactions={ <AddNewTemplate /> }\n\t\t>\n\t\t\t<DataViews\n\t\t\t\tkey={ activeView }\n\t\t\t\tpaginationInfo={ paginationInfo }\n\t\t\t\tfields={ fields }\n\t\t\t\tactions={ actions }\n\t\t\t\tdata={ data }\n\t\t\t\tisLoading={ isLoadingData }\n\t\t\t\tview={ view }\n\t\t\t\tonChangeView={ onChangeView }\n\t\t\t\tonChangeSelection={ onChangeSelection }\n\t\t\t\tisItemClickable={ () => true }\n\t\t\t\tonClickItem={ ( { id } ) => {\n\t\t\t\t\thistory.navigate( `/wp_template/${ id }?canvas=edit` );\n\t\t\t\t} }\n\t\t\t\tselection={ selection }\n\t\t\t\tdefaultLayouts={ defaultLayouts }\n\t\t\t\tonReset={\n\t\t\t\t\tisModified\n\t\t\t\t\t\t? () => {\n\t\t\t\t\t\t\t\tresetToDefault();\n\t\t\t\t\t\t\t\thistory.invalidate();\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: false\n\t\t\t\t}\n\t\t\t/>\n\t\t</Page>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,sBAAqB;AACrB,kBAAmB;AACnB,qBAA+C;AAC/C,uBAA+C;AAC/C,uBAAiD;AACjD,oBAAiD;AACjD,oBAAiD;AACjD,iBAA6B;AAC7B,qBAAyB;AACzB,mBAAuC;AAKvC,qCAA2B;AAC3B,uBAAmC;AACnC,yBAAuB;AACvB,+BAAkC;AAClC,oBAA6B;AAmGhB;AAjGb,IAAM,EAAE,gBAAgB,cAAc,QAAI,2BAAQ,cAAAA,WAAkB;AACpE,IAAM,EAAE,YAAY,YAAY,QAAI,2BAAQ,cAAAC,WAAkB;AAC9D,IAAM,EAAE,gCAAgC,QAAI,2BAAQ,iBAAAC,WAAgB;AAEpE,IAAM,qBAAqB,CAAE,gBAAgB,mBAAmB,WAAY;AAE7D,SAAR,gBAAiC;AACvC,QAAM,EAAE,MAAM,MAAM,IAAI,YAAY;AACpC,QAAM,EAAE,aAAa,OAAO,OAAO,IAAI;AACvC,QAAM,CAAE,WAAW,YAAa,QAAI,yBAAU,CAAE,MAAO,CAAE;AAEzD,QAAM;AAAA,IACL,cAAc;AAAA,IACd,iBAAiB;AAAA,IACjB,WAAW;AAAA,EACZ,QAAI,4BAAe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AAE,MAAM,eAAe,QAAI,wBAAS,MAAM;AAC/C,eAAO,wCAAuB,SAAS,MAAM,MAAO;AAAA,EACrD,GAAG,CAAE,SAAS,MAAM,MAAO,CAAE;AAE7B,QAAM,kBAAkB,eAAgB;AAAA,IACvC,UAAU;AAAA,IACV,SAAS;AAAA,EACV,CAAE;AACF,QAAM,iBAAa,4CAAkB;AACrC,QAAM,cAAU;AAAA,IACf,MAAM,CAAE,YAAY,GAAG,eAAgB;AAAA,IACvC,CAAE,iBAAiB,UAAW;AAAA,EAC/B;AAEA,QAAM,mBAAe,yBAAU,CAAE,YAAa;AAC7C,eAAY,OAAQ;AACpB,QAAK,QAAQ,SAAS,KAAK,MAAO;AAEjC,cAAQ,WAAW;AAAA,IACpB;AAAA,EACD,CAAE;AAEF,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,WAAQ,gBAAI,WAAY;AAAA,MACxB,cAAe;AAAA,MACf,SAAU,4CAAC,+BAAAC,SAAA,EAAe;AAAA,MAE1B;AAAA,QAAC;AAAA;AAAA,UAEA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,WAAY;AAAA,UACZ;AAAA,UACA;AAAA,UACA;AAAA,UACA,iBAAkB,MAAM;AAAA,UACxB,aAAc,CAAE,EAAE,GAAG,MAAO;AAC3B,oBAAQ,SAAU,gBAAiB,EAAG,cAAe;AAAA,UACtD;AAAA,UACA;AAAA,UACA;AAAA,UACA,SACC,aACG,MAAM;AACN,2BAAe;AACf,oBAAQ,WAAW;AAAA,UACnB,IACA;AAAA;AAAA,QArBE;AAAA,MAuBP;AAAA;AAAA,EACD;AAEF;",
|
|
6
6
|
"names": ["editorPrivateApis", "routerPrivateApis", "corePrivateApis", "AddNewTemplate"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/resizable-frame/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tResizableBox,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { addQueryArgs } from '@wordpress/url';\n// eslint-disable-next-line @wordpress/use-recommended-components -- `Tooltip` is not yet on the recommended `@wordpress/ui` allow-list; landing as a migration step ahead of the wider rollout.\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 320;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n// Default size for the `frameSize` state.\nconst INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisOversized,\n\tsetIsOversized,\n\tisReady,\n\tchildren,\n\t/** The default (unresized) width/height of the frame, based on the space available in the viewport. */\n\tdefaultSize,\n\tinnerContentStyle,\n} ) {\n\tconst history = useHistory();\n\tconst { path, query } = useLocation();\n\tconst { canvas = 'view' } = query;\n\tconst disableMotion = useReducedMotion();\n\tconst [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ shouldShowHandle, setShouldShowHandle ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\tconst resizableHandleHelpId = useInstanceId(\n\t\tResizableFrame,\n\t\t'edit-site-resizable-frame-handle-help'\n\t);\n\tconst defaultAspectRatio = defaultSize.width / defaultSize.height;\n\tconst isBlockTheme = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme } = select( coreStore );\n\t\treturn getCurrentTheme()?.is_block_theme;\n\t}, [] );\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( defaultSize.width - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > defaultSize.width );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight( updatedWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif (\n\t\t\tremainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ||\n\t\t\t! isBlockTheme\n\t\t) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( INITIAL_FRAME_SIZE );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} ),\n\t\t\t\t{\n\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\t// Handle resize by arrow keys\n\tconst handleResizableHandleKeyDown = ( event ) => {\n\t\tif ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst step = 20 * ( event.shiftKey ? 5 : 1 );\n\t\tconst delta =\n\t\t\tstep *\n\t\t\t( event.key === 'ArrowLeft' ? 1 : -1 ) *\n\t\t\t( isRTL() ? -1 : 1 );\n\t\tconst newWidth = Math.min(\n\t\t\tMath.max(\n\t\t\t\tFRAME_MIN_WIDTH,\n\t\t\t\tframeRef.current.resizable.offsetWidth + delta\n\t\t\t),\n\t\t\tdefaultSize.width\n\t\t);\n\n\t\tsetFrameSize( {\n\t\t\twidth: newWidth,\n\t\t\theight: calculateNewHeight( newWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\t...( isRTL() ? { right: 0 } : { left: 0 } ),\n\t\t},\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t},\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\tconst currentResizeHandleVariant = ( () => {\n\t\tif ( isResizing ) {\n\t\t\treturn 'active';\n\t\t}\n\t\treturn shouldShowHandle ? 'visible' : 'hidden';\n\t} )();\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' ) {\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t\t}\n\t\t\t} }\n\t\t\twhileHover={\n\t\t\t\tcanvas === 'view' && isBlockTheme\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.5,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\t...( isRTL()\n\t\t\t\t\t? { right: isReady, left: false }\n\t\t\t\t\t: { left: isReady, right: false } ),\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight=\"100%\"\n\t\t\tonFocus={ () => setShouldShowHandle( true ) }\n\t\t\tonBlur={ () => setShouldShowHandle( false ) }\n\t\t\tonMouseOver={ () => setShouldShowHandle( true ) }\n\t\t\tonMouseOut={ () => setShouldShowHandle( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\t[ isRTL() ? 'right' : 'left' ]: canvas === 'view' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tooltip.Root>\n\t\t\t\t\t\t\t<Tooltip.Trigger\n\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t<motion.button\n\t\t\t\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'edit-site-resizable-frame__handle',\n\t\t\t\t\t\t\t\t\t\t\t{ 'is-resizing': isResizing }\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\t\t\t\tanimate={ currentResizeHandleVariant }\n\t\t\t\t\t\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t\tresizableHandleHelpId\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\t\t\t\t\t\tframeRef.current?.resizable\n\t\t\t\t\t\t\t\t\t\t\t\t?.offsetWidth || undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-valuemin={ FRAME_MIN_WIDTH }\n\t\t\t\t\t\t\t\t\t\taria-valuemax={ defaultSize.width }\n\t\t\t\t\t\t\t\t\t\tonKeyDown={\n\t\t\t\t\t\t\t\t\t\t\thandleResizableHandleKeyDown\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\t\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"active\"\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/>\n\t\t\t\t\t\t\t<Tooltip.Popup>\n\t\t\t\t\t\t\t\t{ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t</Tooltip.Popup>\n\t\t\t\t\t\t</Tooltip.Root>\n\t\t\t\t\t\t<div hidden id={ resizableHandleHelpId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ clsx( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tshowHandle={ false } // Do not show the default handle, as we're using a custom one.\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAiC;AACjC,wBAGO;AACP,qBAAgD;AAChD,kBAA0B;AAC1B,oBAAiD;AACjD,kBAA0B;AAC1B,uBAAmC;AACnC,iBAA6B;
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { useState, useRef } from '@wordpress/element';\nimport {\n\tResizableBox,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { useInstanceId, useReducedMotion } from '@wordpress/compose';\nimport { __, isRTL } from '@wordpress/i18n';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { addQueryArgs } from '@wordpress/url';\nimport { Tooltip } from '@wordpress/ui';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\n// Removes the inline styles in the drag handles.\nconst HANDLE_STYLES_OVERRIDE = {\n\tposition: undefined,\n\tuserSelect: undefined,\n\tcursor: undefined,\n\twidth: undefined,\n\theight: undefined,\n\ttop: undefined,\n\tright: undefined,\n\tbottom: undefined,\n\tleft: undefined,\n};\n\n// The minimum width of the frame (in px) while resizing.\nconst FRAME_MIN_WIDTH = 320;\n// The reference width of the frame (in px) used to calculate the aspect ratio.\nconst FRAME_REFERENCE_WIDTH = 1300;\n// 9 : 19.5 is the target aspect ratio enforced (when possible) while resizing.\nconst FRAME_TARGET_ASPECT_RATIO = 9 / 19.5;\n// The minimum distance (in px) between the frame resize handle and the\n// viewport's edge. If the frame is resized to be closer to the viewport's edge\n// than this distance, then \"canvas mode\" will be enabled.\nconst SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD = 200;\n// Default size for the `frameSize` state.\nconst INITIAL_FRAME_SIZE = { width: '100%', height: '100%' };\n\nfunction calculateNewHeight( width, initialAspectRatio ) {\n\tconst lerp = ( a, b, amount ) => {\n\t\treturn a + ( b - a ) * amount;\n\t};\n\n\t// Calculate the intermediate aspect ratio based on the current width.\n\tconst lerpFactor =\n\t\t1 -\n\t\tMath.max(\n\t\t\t0,\n\t\t\tMath.min(\n\t\t\t\t1,\n\t\t\t\t( width - FRAME_MIN_WIDTH ) /\n\t\t\t\t\t( FRAME_REFERENCE_WIDTH - FRAME_MIN_WIDTH )\n\t\t\t)\n\t\t);\n\n\t// Calculate the height based on the intermediate aspect ratio\n\t// ensuring the frame arrives at the target aspect ratio.\n\tconst intermediateAspectRatio = lerp(\n\t\tinitialAspectRatio,\n\t\tFRAME_TARGET_ASPECT_RATIO,\n\t\tlerpFactor\n\t);\n\n\treturn width / intermediateAspectRatio;\n}\n\nfunction ResizableFrame( {\n\tisFullWidth,\n\tisOversized,\n\tsetIsOversized,\n\tisReady,\n\tchildren,\n\t/** The default (unresized) width/height of the frame, based on the space available in the viewport. */\n\tdefaultSize,\n\tinnerContentStyle,\n} ) {\n\tconst history = useHistory();\n\tconst { path, query } = useLocation();\n\tconst { canvas = 'view' } = query;\n\tconst disableMotion = useReducedMotion();\n\tconst [ frameSize, setFrameSize ] = useState( INITIAL_FRAME_SIZE );\n\t// The width of the resizable frame when a new resize gesture starts.\n\tconst [ startingWidth, setStartingWidth ] = useState();\n\tconst [ isResizing, setIsResizing ] = useState( false );\n\tconst [ shouldShowHandle, setShouldShowHandle ] = useState( false );\n\tconst [ resizeRatio, setResizeRatio ] = useState( 1 );\n\n\tconst FRAME_TRANSITION = { type: 'tween', duration: isResizing ? 0 : 0.5 };\n\tconst frameRef = useRef( null );\n\tconst resizableHandleHelpId = useInstanceId(\n\t\tResizableFrame,\n\t\t'edit-site-resizable-frame-handle-help'\n\t);\n\tconst defaultAspectRatio = defaultSize.width / defaultSize.height;\n\tconst isBlockTheme = useSelect( ( select ) => {\n\t\tconst { getCurrentTheme } = select( coreStore );\n\t\treturn getCurrentTheme()?.is_block_theme;\n\t}, [] );\n\n\tconst handleResizeStart = ( _event, _direction, ref ) => {\n\t\t// Remember the starting width so we don't have to get `ref.offsetWidth` on\n\t\t// every resize event thereafter, which will cause layout thrashing.\n\t\tsetStartingWidth( ref.offsetWidth );\n\t\tsetIsResizing( true );\n\t};\n\n\t// Calculate the frame size based on the window width as its resized.\n\tconst handleResize = ( _event, _direction, _ref, delta ) => {\n\t\tconst normalizedDelta = delta.width / resizeRatio;\n\t\tconst deltaAbs = Math.abs( normalizedDelta );\n\t\tconst maxDoubledDelta =\n\t\t\tdelta.width < 0 // is shrinking\n\t\t\t\t? deltaAbs\n\t\t\t\t: ( defaultSize.width - startingWidth ) / 2;\n\t\tconst deltaToDouble = Math.min( deltaAbs, maxDoubledDelta );\n\t\tconst doubleSegment = deltaAbs === 0 ? 0 : deltaToDouble / deltaAbs;\n\t\tconst singleSegment = 1 - doubleSegment;\n\n\t\tsetResizeRatio( singleSegment + doubleSegment * 2 );\n\n\t\tconst updatedWidth = startingWidth + delta.width;\n\n\t\tsetIsOversized( updatedWidth > defaultSize.width );\n\n\t\t// Width will be controlled by the library (via `resizeRatio`),\n\t\t// so we only need to update the height.\n\t\tsetFrameSize( {\n\t\t\theight: isOversized\n\t\t\t\t? '100%'\n\t\t\t\t: calculateNewHeight( updatedWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst handleResizeStop = ( _event, _direction, ref ) => {\n\t\tsetIsResizing( false );\n\n\t\tif ( ! isOversized ) {\n\t\t\treturn;\n\t\t}\n\n\t\tsetIsOversized( false );\n\n\t\tconst remainingWidth =\n\t\t\tref.ownerDocument.documentElement.offsetWidth - ref.offsetWidth;\n\n\t\tif (\n\t\t\tremainingWidth > SNAP_TO_EDIT_CANVAS_MODE_THRESHOLD ||\n\t\t\t! isBlockTheme\n\t\t) {\n\t\t\t// Reset the initial aspect ratio if the frame is resized slightly\n\t\t\t// above the sidebar but not far enough to trigger full screen.\n\t\t\tsetFrameSize( INITIAL_FRAME_SIZE );\n\t\t} else {\n\t\t\t// Trigger full screen if the frame is resized far enough to the left.\n\t\t\thistory.navigate(\n\t\t\t\taddQueryArgs( path, {\n\t\t\t\t\tcanvas: 'edit',\n\t\t\t\t} ),\n\t\t\t\t{\n\t\t\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t\t\t}\n\t\t\t);\n\t\t}\n\t};\n\n\t// Handle resize by arrow keys\n\tconst handleResizableHandleKeyDown = ( event ) => {\n\t\tif ( ! [ 'ArrowLeft', 'ArrowRight' ].includes( event.key ) ) {\n\t\t\treturn;\n\t\t}\n\n\t\tevent.preventDefault();\n\n\t\tconst step = 20 * ( event.shiftKey ? 5 : 1 );\n\t\tconst delta =\n\t\t\tstep *\n\t\t\t( event.key === 'ArrowLeft' ? 1 : -1 ) *\n\t\t\t( isRTL() ? -1 : 1 );\n\t\tconst newWidth = Math.min(\n\t\t\tMath.max(\n\t\t\t\tFRAME_MIN_WIDTH,\n\t\t\t\tframeRef.current.resizable.offsetWidth + delta\n\t\t\t),\n\t\t\tdefaultSize.width\n\t\t);\n\n\t\tsetFrameSize( {\n\t\t\twidth: newWidth,\n\t\t\theight: calculateNewHeight( newWidth, defaultAspectRatio ),\n\t\t} );\n\t};\n\n\tconst frameAnimationVariants = {\n\t\tdefault: {\n\t\t\tflexGrow: 0,\n\t\t\theight: frameSize.height,\n\t\t},\n\t\tfullWidth: {\n\t\t\tflexGrow: 1,\n\t\t\theight: frameSize.height,\n\t\t},\n\t};\n\n\tconst resizeHandleVariants = {\n\t\thidden: {\n\t\t\topacity: 0,\n\t\t\t...( isRTL() ? { right: 0 } : { left: 0 } ),\n\t\t},\n\t\tvisible: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t},\n\t\tactive: {\n\t\t\topacity: 1,\n\t\t\t// Account for the handle's width.\n\t\t\t...( isRTL() ? { right: -14 } : { left: -14 } ),\n\t\t\tscaleY: 1.3,\n\t\t},\n\t};\n\tconst currentResizeHandleVariant = ( () => {\n\t\tif ( isResizing ) {\n\t\t\treturn 'active';\n\t\t}\n\t\treturn shouldShowHandle ? 'visible' : 'hidden';\n\t} )();\n\n\treturn (\n\t\t<ResizableBox\n\t\t\tas={ motion.div }\n\t\t\tref={ frameRef }\n\t\t\tinitial={ false }\n\t\t\tvariants={ frameAnimationVariants }\n\t\t\tanimate={ isFullWidth ? 'fullWidth' : 'default' }\n\t\t\tonAnimationComplete={ ( definition ) => {\n\t\t\t\tif ( definition === 'fullWidth' ) {\n\t\t\t\t\tsetFrameSize( { width: '100%', height: '100%' } );\n\t\t\t\t}\n\t\t\t} }\n\t\t\twhileHover={\n\t\t\t\tcanvas === 'view' && isBlockTheme\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tscale: 1.005,\n\t\t\t\t\t\t\ttransition: {\n\t\t\t\t\t\t\t\tduration: disableMotion ? 0 : 0.5,\n\t\t\t\t\t\t\t\tease: 'easeOut',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t }\n\t\t\t\t\t: {}\n\t\t\t}\n\t\t\ttransition={ FRAME_TRANSITION }\n\t\t\tsize={ frameSize }\n\t\t\tenable={ {\n\t\t\t\ttop: false,\n\t\t\t\tbottom: false,\n\t\t\t\t// Resizing will be disabled until the editor content is loaded.\n\t\t\t\t...( isRTL()\n\t\t\t\t\t? { right: isReady, left: false }\n\t\t\t\t\t: { left: isReady, right: false } ),\n\t\t\t\ttopRight: false,\n\t\t\t\tbottomRight: false,\n\t\t\t\tbottomLeft: false,\n\t\t\t\ttopLeft: false,\n\t\t\t} }\n\t\t\tresizeRatio={ resizeRatio }\n\t\t\thandleClasses={ undefined }\n\t\t\thandleStyles={ {\n\t\t\t\tleft: HANDLE_STYLES_OVERRIDE,\n\t\t\t\tright: HANDLE_STYLES_OVERRIDE,\n\t\t\t} }\n\t\t\tminWidth={ FRAME_MIN_WIDTH }\n\t\t\tmaxWidth={ isFullWidth ? '100%' : '150%' }\n\t\t\tmaxHeight=\"100%\"\n\t\t\tonFocus={ () => setShouldShowHandle( true ) }\n\t\t\tonBlur={ () => setShouldShowHandle( false ) }\n\t\t\tonMouseOver={ () => setShouldShowHandle( true ) }\n\t\t\tonMouseOut={ () => setShouldShowHandle( false ) }\n\t\t\thandleComponent={ {\n\t\t\t\t[ isRTL() ? 'right' : 'left' ]: canvas === 'view' && (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<Tooltip.Root>\n\t\t\t\t\t\t\t<Tooltip.Trigger\n\t\t\t\t\t\t\t\trender={\n\t\t\t\t\t\t\t\t\t<motion.button\n\t\t\t\t\t\t\t\t\t\tkey=\"handle\"\n\t\t\t\t\t\t\t\t\t\trole=\"separator\"\n\t\t\t\t\t\t\t\t\t\taria-orientation=\"vertical\"\n\t\t\t\t\t\t\t\t\t\tclassName={ clsx(\n\t\t\t\t\t\t\t\t\t\t\t'edit-site-resizable-frame__handle',\n\t\t\t\t\t\t\t\t\t\t\t{ 'is-resizing': isResizing }\n\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\tvariants={ resizeHandleVariants }\n\t\t\t\t\t\t\t\t\t\tanimate={ currentResizeHandleVariant }\n\t\t\t\t\t\t\t\t\t\taria-label={ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t\t\t\taria-describedby={\n\t\t\t\t\t\t\t\t\t\t\tresizableHandleHelpId\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-valuenow={\n\t\t\t\t\t\t\t\t\t\t\tframeRef.current?.resizable\n\t\t\t\t\t\t\t\t\t\t\t\t?.offsetWidth || undefined\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\taria-valuemin={ FRAME_MIN_WIDTH }\n\t\t\t\t\t\t\t\t\t\taria-valuemax={ defaultSize.width }\n\t\t\t\t\t\t\t\t\t\tonKeyDown={\n\t\t\t\t\t\t\t\t\t\t\thandleResizableHandleKeyDown\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tinitial=\"hidden\"\n\t\t\t\t\t\t\t\t\t\texit=\"hidden\"\n\t\t\t\t\t\t\t\t\t\twhileFocus=\"active\"\n\t\t\t\t\t\t\t\t\t\twhileHover=\"active\"\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/>\n\t\t\t\t\t\t\t<Tooltip.Popup>\n\t\t\t\t\t\t\t\t{ __( 'Drag to resize' ) }\n\t\t\t\t\t\t\t</Tooltip.Popup>\n\t\t\t\t\t\t</Tooltip.Root>\n\t\t\t\t\t\t<div hidden id={ resizableHandleHelpId }>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Use left and right arrow keys to resize the canvas. Hold shift to resize in larger increments.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</>\n\t\t\t\t),\n\t\t\t} }\n\t\t\tonResizeStart={ handleResizeStart }\n\t\t\tonResize={ handleResize }\n\t\t\tonResizeStop={ handleResizeStop }\n\t\t\tclassName={ clsx( 'edit-site-resizable-frame__inner', {\n\t\t\t\t'is-resizing': isResizing,\n\t\t\t} ) }\n\t\t\tshowHandle={ false } // Do not show the default handle, as we're using a custom one.\n\t\t>\n\t\t\t<div\n\t\t\t\tclassName=\"edit-site-resizable-frame__inner-content\"\n\t\t\t\tstyle={ innerContentStyle }\n\t\t\t>\n\t\t\t\t{ children }\n\t\t\t</div>\n\t\t</ResizableBox>\n\t);\n}\n\nexport default ResizableFrame;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,qBAAiC;AACjC,wBAGO;AACP,qBAAgD;AAChD,kBAA0B;AAC1B,oBAAiD;AACjD,kBAA0B;AAC1B,uBAAmC;AACnC,iBAA6B;AAC7B,gBAAwB;AAKxB,yBAAuB;AA+QlB;AA7QL,IAAM,EAAE,aAAa,WAAW,QAAI,2BAAQ,cAAAA,WAAkB;AAG9D,IAAM,yBAAyB;AAAA,EAC9B,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AACP;AAGA,IAAM,kBAAkB;AAExB,IAAM,wBAAwB;AAE9B,IAAM,4BAA4B,IAAI;AAItC,IAAM,qCAAqC;AAE3C,IAAM,qBAAqB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iBAAgB,YAAY;AAAA,oBAC5B,WACC;AAAA,oBAED,SAAQ;AAAA,oBACR,MAAK;AAAA,oBACL,YAAW;AAAA,oBACX,YAAW;AAAA;AAAA,kBAzBP;AAAA,gBA0BL;AAAA;AAAA,YAEF;AAAA,YACA,4CAAC,kBAAQ,OAAR,EACE,8BAAI,gBAAiB,GACxB;AAAA,aACD;AAAA,UACA,4CAAC,SAAI,QAAM,MAAC,IAAK,uBACd;AAAA,YACD;AAAA,UACD,GACD;AAAA,WACD;AAAA,MAEF;AAAA,MACA,eAAgB;AAAA,MAChB,UAAW;AAAA,MACX,cAAe;AAAA,MACf,eAAY,YAAAA,SAAM,oCAAoC;AAAA,QACrD,eAAe;AAAA,MAChB,CAAE;AAAA,MACF,YAAa;AAAA,MAEb;AAAA,QAAC;AAAA;AAAA,UACA,WAAU;AAAA,UACV,OAAQ;AAAA,UAEN;AAAA;AAAA,MACH;AAAA;AAAA,EACD;AAEF;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": ["routerPrivateApis", "coreStore", "motion", "clsx"]
|
|
7
7
|
}
|
|
@@ -49,7 +49,7 @@ function useTitle(title) {
|
|
|
49
49
|
if (title && siteTitle) {
|
|
50
50
|
const formattedTitle = (0, import_i18n.sprintf)(
|
|
51
51
|
/* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */
|
|
52
|
-
(0, import_i18n.__)("%1$s
|
|
52
|
+
(0, import_i18n.__)("%1$s ‹ %2$s ‹ Editor — WordPress"),
|
|
53
53
|
(0, import_html_entities.decodeEntities)(title),
|
|
54
54
|
(0, import_html_entities.decodeEntities)(siteTitle)
|
|
55
55
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/routes/use-title.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function useTitle( title ) {\n\tconst location = useLocation();\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\tconst isInitialLocationRef = useRef( true );\n\n\tuseEffect( () => {\n\t\tisInitialLocationRef.current = false;\n\t}, [ location ] );\n\n\tuseEffect( () => {\n\t\t// Don't update or announce the title for initial page load.\n\t\tif ( isInitialLocationRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( title && siteTitle ) {\n\t\t\t// @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68\n\t\t\tconst formattedTitle = sprintf(\n\t\t\t\t/* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */\n\t\t\t\t__( '%1$s
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAkC;AAClC,kBAA0B;AAC1B,uBAAmC;AACnC,kBAA4B;AAC5B,kBAAsB;AACtB,2BAA+B;AAC/B,oBAAiD;AAKjD,yBAAuB;AAEvB,IAAM,EAAE,YAAY,QAAI,2BAAQ,cAAAA,WAAkB;AAEnC,SAAR,SAA2B,OAAQ;AACzC,QAAM,WAAW,YAAY;AAC7B,QAAM,gBAAY;AAAA,IACjB,CAAE,WACD,OAAQ,iBAAAC,KAAU,EAAE,gBAAiB,QAAQ,MAAO,GAAG;AAAA,IACxD,CAAC;AAAA,EACF;AACA,QAAM,2BAAuB,uBAAQ,IAAK;AAE1C,gCAAW,MAAM;AAChB,yBAAqB,UAAU;AAAA,EAChC,GAAG,CAAE,QAAS,CAAE;AAEhB,gCAAW,MAAM;AAEhB,QAAK,qBAAqB,SAAU;AACnC;AAAA,IACD;AAEA,QAAK,SAAS,WAAY;AAEzB,YAAM,qBAAiB;AAAA;AAAA,YAEtB,gBAAI,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { speak } from '@wordpress/a11y';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function useTitle( title ) {\n\tconst location = useLocation();\n\tconst siteTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getEntityRecord( 'root', 'site' )?.title,\n\t\t[]\n\t);\n\tconst isInitialLocationRef = useRef( true );\n\n\tuseEffect( () => {\n\t\tisInitialLocationRef.current = false;\n\t}, [ location ] );\n\n\tuseEffect( () => {\n\t\t// Don't update or announce the title for initial page load.\n\t\tif ( isInitialLocationRef.current ) {\n\t\t\treturn;\n\t\t}\n\n\t\tif ( title && siteTitle ) {\n\t\t\t// @see https://github.com/WordPress/wordpress-develop/blob/94849898192d271d533e09756007e176feb80697/src/wp-admin/admin-header.php#L67-L68\n\t\t\tconst formattedTitle = sprintf(\n\t\t\t\t/* translators: Admin document title. 1: Admin screen name, 2: Network or site name. */\n\t\t\t\t__( '%1$s ‹ %2$s ‹ Editor — WordPress' ),\n\t\t\t\tdecodeEntities( title ),\n\t\t\t\tdecodeEntities( siteTitle )\n\t\t\t);\n\n\t\t\tdocument.title = formattedTitle;\n\n\t\t\t// Announce title on route change for screen readers.\n\t\t\tspeak( title, 'assertive' );\n\t\t}\n\t}, [ title, siteTitle, location ] );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,qBAAkC;AAClC,kBAA0B;AAC1B,uBAAmC;AACnC,kBAA4B;AAC5B,kBAAsB;AACtB,2BAA+B;AAC/B,oBAAiD;AAKjD,yBAAuB;AAEvB,IAAM,EAAE,YAAY,QAAI,2BAAQ,cAAAA,WAAkB;AAEnC,SAAR,SAA2B,OAAQ;AACzC,QAAM,WAAW,YAAY;AAC7B,QAAM,gBAAY;AAAA,IACjB,CAAE,WACD,OAAQ,iBAAAC,KAAU,EAAE,gBAAiB,QAAQ,MAAO,GAAG;AAAA,IACxD,CAAC;AAAA,EACF;AACA,QAAM,2BAAuB,uBAAQ,IAAK;AAE1C,gCAAW,MAAM;AAChB,yBAAqB,UAAU;AAAA,EAChC,GAAG,CAAE,QAAS,CAAE;AAEhB,gCAAW,MAAM;AAEhB,QAAK,qBAAqB,SAAU;AACnC;AAAA,IACD;AAEA,QAAK,SAAS,WAAY;AAEzB,YAAM,qBAAiB;AAAA;AAAA,YAEtB,gBAAI,kCAAmC;AAAA,YACvC,qCAAgB,KAAM;AAAA,YACtB,qCAAgB,SAAU;AAAA,MAC3B;AAEA,eAAS,QAAQ;AAGjB,6BAAO,OAAO,WAAY;AAAA,IAC3B;AAAA,EACD,GAAG,CAAE,OAAO,WAAW,QAAS,CAAE;AACnC;",
|
|
6
6
|
"names": ["routerPrivateApis", "coreStore"]
|
|
7
7
|
}
|
|
@@ -113,8 +113,8 @@ function SaveButton({
|
|
|
113
113
|
return (0, import_i18n.sprintf)(
|
|
114
114
|
// translators: %d: number of unsaved changes (number).
|
|
115
115
|
(0, import_i18n._n)(
|
|
116
|
-
"Review %d change
|
|
117
|
-
"Review %d changes
|
|
116
|
+
"Review %d change…",
|
|
117
|
+
"Review %d changes…",
|
|
118
118
|
dirtyEntityRecords.length
|
|
119
119
|
),
|
|
120
120
|
dirtyEntityRecords.length
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/save-button/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tuseEntitiesSavedStatesIsDirty,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport {\n\tcurrentlyPreviewingTheme,\n\tisPreviewingTheme,\n} from '../../utils/is-previewing-theme';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SaveButton( {\n\tclassName = 'edit-site-save-button__button',\n\tvariant = 'primary',\n\tshowTooltip = true,\n\tshowReviewMessage,\n\ticon,\n\tsize,\n\t__next40pxDefaultSize = false,\n} ) {\n\tconst { params } = useLocation();\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst { saveDirtyEntities } = unlock( useDispatch( editorStore ) );\n\tconst { dirtyEntityRecords } = useEntitiesSavedStatesIsDirty();\n\tconst { isSaving, isSaveViewOpen, previewingThemeName } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isSavingEntityRecord, isResolving } = select( coreStore );\n\t\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\t\tconst currentlyPreviewingThemeId = currentlyPreviewingTheme();\n\t\t\treturn {\n\t\t\t\tisSaving:\n\t\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t) || isActivatingTheme,\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\t// Do not call `getTheme` with null, it will cause a request to\n\t\t\t\t// the server.\n\t\t\t\tpreviewingThemeName: currentlyPreviewingThemeId\n\t\t\t\t\t? select( coreStore ).getTheme( currentlyPreviewingThemeId )\n\t\t\t\t\t\t\t?.name?.rendered\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ dirtyEntityRecords ]\n\t);\n\tconst hasDirtyEntities = !! dirtyEntityRecords.length;\n\tlet isOnlyCurrentEntityDirty;\n\t// Check if the current entity is the only entity with changes.\n\t// We have some extra logic for `wp_global_styles` for now, that\n\t// is used in navigation sidebar.\n\tif ( dirtyEntityRecords.length === 1 ) {\n\t\tif ( params.postId ) {\n\t\t\tisOnlyCurrentEntityDirty =\n\t\t\t\t`${ dirtyEntityRecords[ 0 ].key }` === params.postId &&\n\t\t\t\tdirtyEntityRecords[ 0 ].name === params.postType;\n\t\t} else if ( params.path?.includes( 'wp_global_styles' ) ) {\n\t\t\tisOnlyCurrentEntityDirty =\n\t\t\t\tdirtyEntityRecords[ 0 ].name === 'globalStyles';\n\t\t}\n\t}\n\tconst disabled =\n\t\tisSaving || ( ! hasDirtyEntities && ! isPreviewingTheme() );\n\tconst getLabel = () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tif ( isSaving ) {\n\t\t\t\treturn sprintf(\n\t\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t\t__( 'Activating %s' ),\n\t\t\t\t\tpreviewingThemeName\n\t\t\t\t);\n\t\t\t} else if ( disabled ) {\n\t\t\t\treturn __( 'Saved' );\n\t\t\t} else if ( hasDirtyEntities ) {\n\t\t\t\treturn sprintf(\n\t\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t\t__( 'Activate %s & Save' ),\n\t\t\t\t\tpreviewingThemeName\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t__( 'Activate %s' ),\n\t\t\t\tpreviewingThemeName\n\t\t\t);\n\t\t}\n\t\tif ( isSaving ) {\n\t\t\treturn __( 'Saving' );\n\t\t}\n\t\tif ( disabled ) {\n\t\t\treturn __( 'Saved' );\n\t\t}\n\t\tif ( ! isOnlyCurrentEntityDirty && showReviewMessage ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %d: number of unsaved changes (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Review %d change
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { Button } from '@wordpress/components';\nimport { __, _n, sprintf } from '@wordpress/i18n';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { displayShortcut } from '@wordpress/keycodes';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\tuseEntitiesSavedStatesIsDirty,\n\tstore as editorStore,\n} from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../store';\nimport {\n\tcurrentlyPreviewingTheme,\n\tisPreviewingTheme,\n} from '../../utils/is-previewing-theme';\nimport { unlock } from '../../lock-unlock';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nexport default function SaveButton( {\n\tclassName = 'edit-site-save-button__button',\n\tvariant = 'primary',\n\tshowTooltip = true,\n\tshowReviewMessage,\n\ticon,\n\tsize,\n\t__next40pxDefaultSize = false,\n} ) {\n\tconst { params } = useLocation();\n\tconst { setIsSaveViewOpened } = useDispatch( editSiteStore );\n\tconst { saveDirtyEntities } = unlock( useDispatch( editorStore ) );\n\tconst { dirtyEntityRecords } = useEntitiesSavedStatesIsDirty();\n\tconst { isSaving, isSaveViewOpen, previewingThemeName } = useSelect(\n\t\t( select ) => {\n\t\t\tconst { isSavingEntityRecord, isResolving } = select( coreStore );\n\t\t\tconst { isSaveViewOpened } = select( editSiteStore );\n\t\t\tconst isActivatingTheme = isResolving( 'activateTheme' );\n\t\t\tconst currentlyPreviewingThemeId = currentlyPreviewingTheme();\n\t\t\treturn {\n\t\t\t\tisSaving:\n\t\t\t\t\tdirtyEntityRecords.some( ( record ) =>\n\t\t\t\t\t\tisSavingEntityRecord(\n\t\t\t\t\t\t\trecord.kind,\n\t\t\t\t\t\t\trecord.name,\n\t\t\t\t\t\t\trecord.key\n\t\t\t\t\t\t)\n\t\t\t\t\t) || isActivatingTheme,\n\t\t\t\tisSaveViewOpen: isSaveViewOpened(),\n\t\t\t\t// Do not call `getTheme` with null, it will cause a request to\n\t\t\t\t// the server.\n\t\t\t\tpreviewingThemeName: currentlyPreviewingThemeId\n\t\t\t\t\t? select( coreStore ).getTheme( currentlyPreviewingThemeId )\n\t\t\t\t\t\t\t?.name?.rendered\n\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t},\n\t\t[ dirtyEntityRecords ]\n\t);\n\tconst hasDirtyEntities = !! dirtyEntityRecords.length;\n\tlet isOnlyCurrentEntityDirty;\n\t// Check if the current entity is the only entity with changes.\n\t// We have some extra logic for `wp_global_styles` for now, that\n\t// is used in navigation sidebar.\n\tif ( dirtyEntityRecords.length === 1 ) {\n\t\tif ( params.postId ) {\n\t\t\tisOnlyCurrentEntityDirty =\n\t\t\t\t`${ dirtyEntityRecords[ 0 ].key }` === params.postId &&\n\t\t\t\tdirtyEntityRecords[ 0 ].name === params.postType;\n\t\t} else if ( params.path?.includes( 'wp_global_styles' ) ) {\n\t\t\tisOnlyCurrentEntityDirty =\n\t\t\t\tdirtyEntityRecords[ 0 ].name === 'globalStyles';\n\t\t}\n\t}\n\tconst disabled =\n\t\tisSaving || ( ! hasDirtyEntities && ! isPreviewingTheme() );\n\tconst getLabel = () => {\n\t\tif ( isPreviewingTheme() ) {\n\t\t\tif ( isSaving ) {\n\t\t\t\treturn sprintf(\n\t\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t\t__( 'Activating %s' ),\n\t\t\t\t\tpreviewingThemeName\n\t\t\t\t);\n\t\t\t} else if ( disabled ) {\n\t\t\t\treturn __( 'Saved' );\n\t\t\t} else if ( hasDirtyEntities ) {\n\t\t\t\treturn sprintf(\n\t\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t\t__( 'Activate %s & Save' ),\n\t\t\t\t\tpreviewingThemeName\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn sprintf(\n\t\t\t\t/* translators: %s: The name of theme to be activated. */\n\t\t\t\t__( 'Activate %s' ),\n\t\t\t\tpreviewingThemeName\n\t\t\t);\n\t\t}\n\t\tif ( isSaving ) {\n\t\t\treturn __( 'Saving' );\n\t\t}\n\t\tif ( disabled ) {\n\t\t\treturn __( 'Saved' );\n\t\t}\n\t\tif ( ! isOnlyCurrentEntityDirty && showReviewMessage ) {\n\t\t\treturn sprintf(\n\t\t\t\t// translators: %d: number of unsaved changes (number).\n\t\t\t\t_n(\n\t\t\t\t\t'Review %d change…',\n\t\t\t\t\t'Review %d changes…',\n\t\t\t\t\tdirtyEntityRecords.length\n\t\t\t\t),\n\t\t\t\tdirtyEntityRecords.length\n\t\t\t);\n\t\t}\n\t\treturn __( 'Save' );\n\t};\n\tconst label = getLabel();\n\tconst onClick = isOnlyCurrentEntityDirty\n\t\t? () => saveDirtyEntities( { dirtyEntityRecords } )\n\t\t: () => setIsSaveViewOpened( true );\n\treturn (\n\t\t<Button\n\t\t\tvariant={ variant }\n\t\t\tclassName={ className }\n\t\t\taria-disabled={ disabled }\n\t\t\taria-expanded={ isSaveViewOpen }\n\t\t\tisBusy={ isSaving }\n\t\t\tonClick={ disabled ? undefined : onClick }\n\t\t\tlabel={ label }\n\t\t\t/*\n\t\t\t * We want the tooltip to show the keyboard shortcut only when the\n\t\t\t * button does something, i.e. when it's not disabled.\n\t\t\t */\n\t\t\tshortcut={ disabled ? undefined : displayShortcut.primary( 's' ) }\n\t\t\t/*\n\t\t\t * Displaying the keyboard shortcut conditionally makes the tooltip\n\t\t\t * itself show conditionally. This would trigger a full-rerendering\n\t\t\t * of the button that we want to avoid. By setting `showTooltip`,\n\t\t\t * the tooltip is always rendered even when there's no keyboard shortcut.\n\t\t\t */\n\t\t\tshowTooltip={ showTooltip }\n\t\t\ticon={ icon }\n\t\t\t__next40pxDefaultSize={ __next40pxDefaultSize }\n\t\t\tsize={ size }\n\t\t>\n\t\t\t{ label }\n\t\t</Button>\n\t);\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAuC;AACvC,wBAAuB;AACvB,kBAAgC;AAChC,uBAAmC;AACnC,sBAAgC;AAChC,oBAAiD;AACjD,oBAGO;AAKP,mBAAuC;AACvC,iCAGO;AACP,yBAAuB;AA2GrB;AAzGF,IAAM,EAAE,YAAY,QAAI,2BAAQ,cAAAA,WAAkB;AAEnC,SAAR,WAA6B;AAAA,EACnC,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AACzB,GAAI;AACH,QAAM,EAAE,OAAO,IAAI,YAAY;AAC/B,QAAM,EAAE,oBAAoB,QAAI,yBAAa,aAAAC,KAAc;AAC3D,QAAM,EAAE,kBAAkB,QAAI,+BAAQ,yBAAa,cAAAC,KAAY,CAAE;AACjE,QAAM,EAAE,mBAAmB,QAAI,6CAA8B;AAC7D,QAAM,EAAE,UAAU,gBAAgB,oBAAoB,QAAI;AAAA,IACzD,CAAE,WAAY;AACb,YAAM,EAAE,sBAAsB,YAAY,IAAI,OAAQ,iBAAAC,KAAU;AAChE,YAAM,EAAE,iBAAiB,IAAI,OAAQ,aAAAF,KAAc;AACnD,YAAM,oBAAoB,YAAa,eAAgB;AACvD,YAAM,iCAA6B,qDAAyB;AAC5D,aAAO;AAAA,QACN,UACC,mBAAmB;AAAA,UAAM,CAAE,WAC1B;AAAA,YACC,OAAO;AAAA,YACP,OAAO;AAAA,YACP,OAAO;AAAA,UACR;AAAA,QAC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;AAAA,EACnB;AACA,QAAM,QAAQ,SAAS;AACvB,QAAM,UAAU,2BACb,MAAM,kBAAmB,EAAE,mBAAmB,CAAE,IAChD,MAAM,oBAAqB,IAAK;AACnC,SACC;AAAA,IAAC;AAAA;AAAA,MACA;AAAA,MACA;AAAA,MACA,iBAAgB;AAAA,MAChB,iBAAgB;AAAA,MAChB,QAAS;AAAA,MACT,SAAU,WAAW,SAAY;AAAA,MACjC;AAAA,MAKA,UAAW,WAAW,SAAY,gCAAgB,QAAS,GAAI;AAAA,MAO/D;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MAEE;AAAA;AAAA,EACH;AAEF;",
|
|
6
6
|
"names": ["routerPrivateApis", "editSiteStore", "editorStore", "coreStore"]
|
|
7
7
|
}
|
|
@@ -34,7 +34,7 @@ __export(save_hub_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(save_hub_exports);
|
|
36
36
|
var import_data = require("@wordpress/data");
|
|
37
|
-
var
|
|
37
|
+
var import_ui = require("@wordpress/ui");
|
|
38
38
|
var import_core_data = require("@wordpress/core-data");
|
|
39
39
|
var import_icons = require("@wordpress/icons");
|
|
40
40
|
var import_save_button = __toESM(require("../save-button/index.cjs"));
|
|
@@ -52,11 +52,11 @@ function SaveHub() {
|
|
|
52
52
|
isDisabled: _isSaving || !dirtyEntityRecords.length && !(0, import_is_previewing_theme.isPreviewingTheme)()
|
|
53
53
|
};
|
|
54
54
|
}, []);
|
|
55
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ui.Stack, { className: "edit-site-save-hub", gap: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
56
|
import_save_button.default,
|
|
57
57
|
{
|
|
58
58
|
className: "edit-site-save-hub__button",
|
|
59
|
-
variant: isDisabled ? null : "primary",
|
|
59
|
+
variant: isDisabled && !isSaving ? null : "primary",
|
|
60
60
|
showTooltip: false,
|
|
61
61
|
icon: isDisabled && !isSaving ? import_icons.check : null,
|
|
62
62
|
showReviewMessage: true,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/save-hub/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,
|
|
6
|
-
"names": ["coreStore", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { Stack } from '@wordpress/ui';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { check } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport SaveButton from '../save-button';\nimport { isPreviewingTheme } from '../../utils/is-previewing-theme';\n\nexport default function SaveHub() {\n\tconst { isDisabled, isSaving } = useSelect( ( select ) => {\n\t\tconst { __experimentalGetDirtyEntityRecords, isSavingEntityRecord } =\n\t\t\tselect( coreStore );\n\t\tconst dirtyEntityRecords = __experimentalGetDirtyEntityRecords();\n\t\tconst _isSaving = dirtyEntityRecords.some( ( record ) =>\n\t\t\tisSavingEntityRecord( record.kind, record.name, record.key )\n\t\t);\n\t\treturn {\n\t\t\tisSaving: _isSaving,\n\t\t\tisDisabled:\n\t\t\t\t_isSaving ||\n\t\t\t\t( ! dirtyEntityRecords.length && ! isPreviewingTheme() ),\n\t\t};\n\t}, [] );\n\treturn (\n\t\t<Stack className=\"edit-site-save-hub\" gap=\"lg\">\n\t\t\t<SaveButton\n\t\t\t\tclassName=\"edit-site-save-hub__button\"\n\t\t\t\tvariant={ isDisabled && ! isSaving ? null : 'primary' }\n\t\t\t\tshowTooltip={ false }\n\t\t\t\ticon={ isDisabled && ! isSaving ? check : null }\n\t\t\t\tshowReviewMessage\n\t\t\t\t__next40pxDefaultSize\n\t\t\t/>\n\t\t</Stack>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA0B;AAC1B,gBAAsB;AACtB,uBAAmC;AACnC,mBAAsB;AAKtB,yBAAuB;AACvB,iCAAkC;AAmB/B;AAjBY,SAAR,UAA2B;AACjC,QAAM,EAAE,YAAY,SAAS,QAAI,uBAAW,CAAE,WAAY;AACzD,UAAM,EAAE,qCAAqC,qBAAqB,IACjE,OAAQ,iBAAAA,KAAU;AACnB,UAAM,qBAAqB,oCAAoC;AAC/D,UAAM,YAAY,mBAAmB;AAAA,MAAM,CAAE,WAC5C,qBAAsB,OAAO,MAAM,OAAO,MAAM,OAAO,GAAI;AAAA,IAC5D;AACA,WAAO;AAAA,MACN,UAAU;AAAA,MACV,YACC,aACE,CAAE,mBAAmB,UAAU,KAAE,8CAAkB;AAAA,IACvD;AAAA,EACD,GAAG,CAAC,CAAE;AACN,SACC,4CAAC,mBAAM,WAAU,sBAAqB,KAAI,MACzC;AAAA,IAAC,mBAAAC;AAAA,IAAA;AAAA,MACA,WAAU;AAAA,MACV,SAAU,cAAc,CAAE,WAAW,OAAO;AAAA,MAC5C,aAAc;AAAA,MACd,MAAO,cAAc,CAAE,WAAW,qBAAQ;AAAA,MAC1C,mBAAiB;AAAA,MACjB,uBAAqB;AAAA;AAAA,EACtB,GACD;AAEF;",
|
|
6
|
+
"names": ["coreStore", "SaveButton"]
|
|
7
7
|
}
|
|
@@ -42,6 +42,7 @@ var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
|
42
42
|
var import_sidebar_navigation_item = __toESM(require("../sidebar-navigation-item/index.cjs"));
|
|
43
43
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
44
|
var { useLocation } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
45
|
+
var VIEW_CONFIG_FIELDS = ["view_list"];
|
|
45
46
|
var SLUG_TO_ICON = {
|
|
46
47
|
all: import_icons.pages,
|
|
47
48
|
published: import_icons.published,
|
|
@@ -64,7 +65,8 @@ function DataViewsSidebarContent({
|
|
|
64
65
|
} = useLocation();
|
|
65
66
|
const { view_list: viewList } = (0, import_views.useViewConfig)({
|
|
66
67
|
kind: "postType",
|
|
67
|
-
name: postType
|
|
68
|
+
name: postType,
|
|
69
|
+
fields: VIEW_CONFIG_FIELDS
|
|
68
70
|
});
|
|
69
71
|
if (!postType) {
|
|
70
72
|
return null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar-dataviews/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\ttrash,\n\tpages,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\nimport { useViewConfig } from '@wordpress/views';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst SLUG_TO_ICON = {\n\tall: pages,\n\tpublished,\n\tfuture: scheduled,\n\tdrafts,\n\tpending,\n\tprivate: notAllowed,\n\ttrash,\n};\nconst defaultResolveIcon = ( view ) => {\n\treturn SLUG_TO_ICON[ view.slug ];\n};\n\nexport default function DataViewsSidebarContent( {\n\tpostType,\n\tresolveIcon = defaultResolveIcon,\n} ) {\n\tconst {\n\t\tpath,\n\t\tquery: { activeView = 'all' },\n\t} = useLocation();\n\tconst { view_list: viewList } = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t} );\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-dataviews\">\n\t\t\t\t{ viewList?.map( ( view ) => {\n\t\t\t\t\tconst isActive = view.slug === activeView;\n\t\t\t\t\tconst slug = view.slug === 'all' ? undefined : view.slug;\n\t\t\t\t\tconst icon = resolveIcon( view );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tkey={ view.slug }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tto={ addQueryArgs( path, {\n\t\t\t\t\t\t\t\tactiveView: slug,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ view.title }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AACrD,oBAAiD;AACjD,mBAQO;AACP,mBAA8B;AAC9B,iBAA6B;AAK7B,yBAAuB;AACvB,qCAAkC;
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalItemGroup as ItemGroup } from '@wordpress/components';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport {\n\ttrash,\n\tpages,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\nimport { useViewConfig } from '@wordpress/views';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport SidebarNavigationItem from '../sidebar-navigation-item';\n\nconst { useLocation } = unlock( routerPrivateApis );\n\nconst VIEW_CONFIG_FIELDS = [ 'view_list' ];\n\nconst SLUG_TO_ICON = {\n\tall: pages,\n\tpublished,\n\tfuture: scheduled,\n\tdrafts,\n\tpending,\n\tprivate: notAllowed,\n\ttrash,\n};\nconst defaultResolveIcon = ( view ) => {\n\treturn SLUG_TO_ICON[ view.slug ];\n};\n\nexport default function DataViewsSidebarContent( {\n\tpostType,\n\tresolveIcon = defaultResolveIcon,\n} ) {\n\tconst {\n\t\tpath,\n\t\tquery: { activeView = 'all' },\n\t} = useLocation();\n\tconst { view_list: viewList } = useViewConfig( {\n\t\tkind: 'postType',\n\t\tname: postType,\n\t\tfields: VIEW_CONFIG_FIELDS,\n\t} );\n\tif ( ! postType ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<ItemGroup className=\"edit-site-sidebar-dataviews\">\n\t\t\t\t{ viewList?.map( ( view ) => {\n\t\t\t\t\tconst isActive = view.slug === activeView;\n\t\t\t\t\tconst slug = view.slug === 'all' ? undefined : view.slug;\n\t\t\t\t\tconst icon = resolveIcon( view );\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<SidebarNavigationItem\n\t\t\t\t\t\t\tkey={ view.slug }\n\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\tto={ addQueryArgs( path, {\n\t\t\t\t\t\t\t\tactiveView: slug,\n\t\t\t\t\t\t\t} ) }\n\t\t\t\t\t\t\taria-current={ isActive ? 'true' : undefined }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ view.title }\n\t\t\t\t\t\t</SidebarNavigationItem>\n\t\t\t\t\t);\n\t\t\t\t} ) }\n\t\t\t</ItemGroup>\n\t\t</>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,wBAAqD;AACrD,oBAAiD;AACjD,mBAQO;AACP,mBAA8B;AAC9B,iBAA6B;AAK7B,yBAAuB;AACvB,qCAAkC;AAqChC;AAnCF,IAAM,EAAE,YAAY,QAAI,2BAAQ,cAAAA,WAAkB;AAElD,IAAM,qBAAqB,CAAE,WAAY;AAEzC,IAAM,eAAe;AAAA,EACpB,KAAK;AAAA,EACL;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,SAAS;AAAA,EACT;AACD;AACA,IAAM,qBAAqB,CAAE,SAAU;AACtC,SAAO,aAAc,KAAK,IAAK;AAChC;AAEe,SAAR,wBAA0C;AAAA,EAChD;AAAA,EACA,cAAc;AACf,GAAI;AACH,QAAM;AAAA,IACL;AAAA,IACA,OAAO,EAAE,aAAa,MAAM;AAAA,EAC7B,IAAI,YAAY;AAChB,QAAM,EAAE,WAAW,SAAS,QAAI,4BAAe;AAAA,IAC9C,MAAM;AAAA,IACN,MAAM;AAAA,IACN,QAAQ;AAAA,EACT,CAAE;AACF,MAAK,CAAE,UAAW;AACjB,WAAO;AAAA,EACR;AAEA,SACC,2EACC,sDAAC,kBAAAC,yBAAA,EAAU,WAAU,+BAClB,oBAAU,IAAK,CAAE,SAAU;AAC5B,UAAM,WAAW,KAAK,SAAS;AAC/B,UAAM,OAAO,KAAK,SAAS,QAAQ,SAAY,KAAK;AACpD,UAAM,OAAO,YAAa,IAAK;AAC/B,WACC;AAAA,MAAC,+BAAAC;AAAA,MAAA;AAAA,QAEA;AAAA,QACA,QAAK,yBAAc,MAAM;AAAA,UACxB,YAAY;AAAA,QACb,CAAE;AAAA,QACF,gBAAe,WAAW,SAAS;AAAA,QAEjC,eAAK;AAAA;AAAA,MAPD,KAAK;AAAA,IAQZ;AAAA,EAEF,CAAE,GACH,GACD;AAEF;",
|
|
6
6
|
"names": ["routerPrivateApis", "ItemGroup", "SidebarNavigationItem"]
|
|
7
7
|
}
|
|
@@ -35,6 +35,7 @@ __export(sidebar_navigation_item_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(sidebar_navigation_item_exports);
|
|
36
36
|
var import_clsx = __toESM(require("clsx"));
|
|
37
37
|
var import_components = require("@wordpress/components");
|
|
38
|
+
var import_ui = require("@wordpress/ui");
|
|
38
39
|
var import_i18n = require("@wordpress/i18n");
|
|
39
40
|
var import_icons = require("@wordpress/icons");
|
|
40
41
|
var import_router = require("@wordpress/router");
|
|
@@ -42,8 +43,17 @@ var import_element = require("@wordpress/element");
|
|
|
42
43
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
43
44
|
var import_sidebar = require("../sidebar/index.cjs");
|
|
44
45
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
-
var { useHistory, useLink } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
46
|
+
var { useHistory, useLink, useLocation } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
46
47
|
function SidebarNavigationItem({
|
|
48
|
+
isHidden = false,
|
|
49
|
+
...props
|
|
50
|
+
}) {
|
|
51
|
+
if (isHidden) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SidebarNavigationItemContent, { ...props });
|
|
55
|
+
}
|
|
56
|
+
function SidebarNavigationItemContent({
|
|
47
57
|
className,
|
|
48
58
|
icon,
|
|
49
59
|
withChevron = false,
|
|
@@ -51,11 +61,15 @@ function SidebarNavigationItem({
|
|
|
51
61
|
uid,
|
|
52
62
|
to,
|
|
53
63
|
onClick,
|
|
64
|
+
activeOnRouteName,
|
|
54
65
|
children,
|
|
55
66
|
...props
|
|
56
67
|
}) {
|
|
57
68
|
const history = useHistory();
|
|
69
|
+
const linkProps = useLink(to);
|
|
70
|
+
const { name } = useLocation();
|
|
58
71
|
const { navigate } = (0, import_element.useContext)(import_sidebar.SidebarNavigationContext);
|
|
72
|
+
const isActive = activeOnRouteName && name === activeOnRouteName;
|
|
59
73
|
function handleClick(e) {
|
|
60
74
|
if (onClick) {
|
|
61
75
|
onClick(e);
|
|
@@ -66,7 +80,6 @@ function SidebarNavigationItem({
|
|
|
66
80
|
navigate("forward", `[id="${uid}"]`);
|
|
67
81
|
}
|
|
68
82
|
}
|
|
69
|
-
const linkProps = useLink(to);
|
|
70
83
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
84
|
import_components.__experimentalItem,
|
|
72
85
|
{
|
|
@@ -78,8 +91,9 @@ function SidebarNavigationItem({
|
|
|
78
91
|
id: uid,
|
|
79
92
|
onClick: handleClick,
|
|
80
93
|
href: to ? linkProps.href : void 0,
|
|
94
|
+
"aria-current": isActive ? true : void 0,
|
|
81
95
|
...props,
|
|
82
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
96
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_ui.Stack, { direction: "row", align: "center", justify: "start", gap: "sm", children: [
|
|
83
97
|
icon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
98
|
import_icons.Icon,
|
|
85
99
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar-navigation-item/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAiB;AAKjB,
|
|
6
|
-
"names": ["routerPrivateApis", "Item", "clsx"
|
|
4
|
+
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalItem as Item, FlexBlock } from '@wordpress/components';\nimport { Stack } from '@wordpress/ui';\nimport { isRTL } from '@wordpress/i18n';\nimport { chevronRightSmall, chevronLeftSmall, Icon } from '@wordpress/icons';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { useContext } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport { SidebarNavigationContext } from '../sidebar';\n\nconst { useHistory, useLink, useLocation } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationItem( {\n\tisHidden = false,\n\t...props\n} ) {\n\tif ( isHidden ) {\n\t\treturn null;\n\t}\n\n\treturn <SidebarNavigationItemContent { ...props } />;\n}\n\nfunction SidebarNavigationItemContent( {\n\tclassName,\n\ticon,\n\twithChevron = false,\n\tsuffix,\n\tuid,\n\tto,\n\tonClick,\n\tactiveOnRouteName,\n\tchildren,\n\t...props\n} ) {\n\tconst history = useHistory();\n\tconst linkProps = useLink( to );\n\tconst { name } = useLocation();\n\tconst { navigate } = useContext( SidebarNavigationContext );\n\n\tconst isActive = activeOnRouteName && name === activeOnRouteName;\n\t// If there is no custom click handler, create one that navigates to `params`.\n\tfunction handleClick( e ) {\n\t\tif ( onClick ) {\n\t\t\tonClick( e );\n\t\t\tnavigate( 'forward' );\n\t\t} else if ( to ) {\n\t\t\te.preventDefault();\n\t\t\thistory.navigate( to );\n\t\t\tnavigate( 'forward', `[id=\"${ uid }\"]` );\n\t\t}\n\t}\n\n\treturn (\n\t\t<Item\n\t\t\tclassName={ clsx(\n\t\t\t\t'edit-site-sidebar-navigation-item',\n\t\t\t\t{ 'with-suffix': ! withChevron && suffix },\n\t\t\t\tclassName\n\t\t\t) }\n\t\t\tid={ uid }\n\t\t\tonClick={ handleClick }\n\t\t\thref={ to ? linkProps.href : undefined }\n\t\t\taria-current={ isActive ? true : undefined }\n\t\t\t{ ...props }\n\t\t>\n\t\t\t<Stack direction=\"row\" align=\"center\" justify=\"start\" gap=\"sm\">\n\t\t\t\t{ icon && (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\tstyle={ { fill: 'currentcolor' } }\n\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\tsize={ 24 }\n\t\t\t\t\t/>\n\t\t\t\t) }\n\t\t\t\t<FlexBlock>{ children }</FlexBlock>\n\t\t\t\t{ withChevron && (\n\t\t\t\t\t<Icon\n\t\t\t\t\t\ticon={ isRTL() ? chevronLeftSmall : chevronRightSmall }\n\t\t\t\t\t\tclassName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,eAAe,CAAE,eAAe,OAAO;AAAA,QACzC;AAAA,MACD;AAAA,MACA,IAAK;AAAA,MACL,SAAU;AAAA,MACV,MAAO,KAAK,UAAU,OAAO;AAAA,MAC7B,gBAAe,WAAW,OAAO;AAAA,MAC/B,GAAG;AAAA,MAEL,uDAAC,mBAAM,WAAU,OAAM,OAAM,UAAS,SAAQ,SAAQ,KAAI,MACvD;AAAA,gBACD;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,EAAE,MAAM,eAAe;AAAA,YAC/B;AAAA,YACA,MAAO;AAAA;AAAA,QACR;AAAA,QAED,4CAAC,+BAAY,UAAU;AAAA,QACrB,eACD;AAAA,UAAC;AAAA;AAAA,YACA,UAAO,mBAAM,IAAI,gCAAmB;AAAA,YACpC,WAAU;AAAA,YACV,MAAO;AAAA;AAAA,QACR;AAAA,QAEC,CAAE,eAAe;AAAA,SACpB;AAAA;AAAA,EACD;AAEF;",
|
|
6
|
+
"names": ["routerPrivateApis", "Item", "clsx"]
|
|
7
7
|
}
|
|
@@ -30,7 +30,6 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js
|
|
31
31
|
var sidebar_navigation_screen_global_styles_exports = {};
|
|
32
32
|
__export(sidebar_navigation_screen_global_styles_exports, {
|
|
33
|
-
SidebarNavigationItemGlobalStyles: () => SidebarNavigationItemGlobalStyles,
|
|
34
33
|
default: () => SidebarNavigationScreenGlobalStyles
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(sidebar_navigation_screen_global_styles_exports);
|
|
@@ -41,25 +40,14 @@ var import_preferences = require("@wordpress/preferences");
|
|
|
41
40
|
var import_editor = require("@wordpress/editor");
|
|
42
41
|
var import_router = require("@wordpress/router");
|
|
43
42
|
var import_url = require("@wordpress/url");
|
|
43
|
+
var import_global_styles_ui = require("@wordpress/global-styles-ui");
|
|
44
44
|
var import_sidebar_navigation_screen = __toESM(require("../sidebar-navigation-screen/index.cjs"));
|
|
45
45
|
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
46
46
|
var import_store = require("../../store/index.cjs");
|
|
47
|
-
var import_sidebar_navigation_item = __toESM(require("../sidebar-navigation-item/index.cjs"));
|
|
48
|
-
var import_global_styles_ui = require("@wordpress/global-styles-ui");
|
|
49
47
|
var import_sidebar_navigation_screen_details_footer = __toESM(require("../sidebar-navigation-screen-details-footer/index.cjs"));
|
|
50
48
|
var import_sidebar_navigation_screen_main = require("../sidebar-navigation-screen-main/index.cjs");
|
|
51
49
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
52
50
|
var { useLocation, useHistory } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
53
|
-
function SidebarNavigationItemGlobalStyles(props) {
|
|
54
|
-
const { name } = useLocation();
|
|
55
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
56
|
-
import_sidebar_navigation_item.default,
|
|
57
|
-
{
|
|
58
|
-
...props,
|
|
59
|
-
"aria-current": name === "styles"
|
|
60
|
-
}
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
51
|
function SidebarNavigationScreenGlobalStyles() {
|
|
64
52
|
const history = useHistory();
|
|
65
53
|
const { path } = useLocation();
|
|
@@ -93,7 +81,7 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
93
81
|
description: (0, import_i18n.__)(
|
|
94
82
|
"Customize the appearance of your website using the block editor."
|
|
95
83
|
),
|
|
96
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar_navigation_screen_main.MainSidebarNavigationContent, {
|
|
84
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sidebar_navigation_screen_main.MainSidebarNavigationContent, {}),
|
|
97
85
|
footer: shouldShowGlobalStylesFooter && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
86
|
import_sidebar_navigation_screen_details_footer.default,
|
|
99
87
|
{
|
|
@@ -105,8 +93,4 @@ function SidebarNavigationScreenGlobalStyles() {
|
|
|
105
93
|
}
|
|
106
94
|
) });
|
|
107
95
|
}
|
|
108
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
109
|
-
0 && (module.exports = {
|
|
110
|
-
SidebarNavigationItemGlobalStyles
|
|
111
|
-
});
|
|
112
96
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar-navigation-screen-global-styles/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["routerPrivateApis", "
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback } from '@wordpress/element';\nimport { store as preferencesStore } from '@wordpress/preferences';\nimport { store as editorStore } from '@wordpress/editor';\nimport { privateApis as routerPrivateApis } from '@wordpress/router';\nimport { addQueryArgs } from '@wordpress/url';\nimport { useGlobalStylesRevisions } from '@wordpress/global-styles-ui';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { unlock } from '../../lock-unlock';\nimport { store as editSiteStore } from '../../store';\nimport SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-details-footer';\nimport { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';\n\nconst { useLocation, useHistory } = unlock( routerPrivateApis );\n\nexport default function SidebarNavigationScreenGlobalStyles() {\n\tconst history = useHistory();\n\tconst { path } = useLocation();\n\tconst {\n\t\trevisions,\n\t\tisLoading: isLoadingRevisions,\n\t\trevisionsCount,\n\t} = useGlobalStylesRevisions();\n\tconst { openGeneralSidebar } = useDispatch( editSiteStore );\n\tconst { setStylesPath } = unlock( useDispatch( editorStore ) );\n\tconst { set: setPreference } = useDispatch( preferencesStore );\n\n\tconst openGlobalStyles = useCallback( async () => {\n\t\thistory.navigate( addQueryArgs( path, { canvas: 'edit' } ), {\n\t\t\ttransition: 'canvas-mode-edit-transition',\n\t\t} );\n\t\treturn Promise.all( [\n\t\t\tsetPreference( 'core', 'distractionFree', false ),\n\t\t\topenGeneralSidebar( 'edit-site/global-styles' ),\n\t\t] );\n\t}, [ path, history, openGeneralSidebar, setPreference ] );\n\n\tconst openRevisions = useCallback( async () => {\n\t\tawait openGlobalStyles();\n\t\t// Open the global styles revisions once the canvas mode is set to edit,\n\t\t// and the global styles sidebar is open. Set the path to revisions.\n\t\tsetStylesPath( '/revisions' );\n\t}, [ openGlobalStyles, setStylesPath ] );\n\n\t// If there are no revisions, do not render a footer.\n\tconst shouldShowGlobalStylesFooter =\n\t\t!! revisionsCount && ! isLoadingRevisions;\n\n\treturn (\n\t\t<>\n\t\t\t<SidebarNavigationScreen\n\t\t\t\ttitle={ __( 'Design' ) }\n\t\t\t\tisRoot\n\t\t\t\tdescription={ __(\n\t\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t\t) }\n\t\t\t\tcontent={ <MainSidebarNavigationContent /> }\n\t\t\t\tfooter={\n\t\t\t\t\tshouldShowGlobalStylesFooter && (\n\t\t\t\t\t\t<SidebarNavigationScreenDetailsFooter\n\t\t\t\t\t\t\trecord={ revisions?.[ 0 ] }\n\t\t\t\t\t\t\trevisionsC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Ac,CAAE;AAGvC,QAAM,+BACL,CAAC,CAAE,kBAAkB,CAAE;AAExB,SACC,2EACC;AAAA,IAAC,iCAAAC;AAAA,IAAA;AAAA,MACA,WAAQ,gBAAI,QAAS;AAAA,MACrB,QAAM;AAAA,MACN,iBAAc;AAAA,QACb;AAAA,MACD;AAAA,MACA,SAAU,4CAAC,sEAA6B;AAAA,MACxC,QACC,gCACC;AAAA,QAAC,gDAAAC;AAAA,QAAA;AAAA,UACA,QAAS,YAAa,CAAE;AAAA,UACxB;AAAA,UACA,SAAU;AAAA;AAAA,MACX;AAAA;AAAA,EAGH,GACD;AAEF;",
|
|
6
|
+
"names": ["routerPrivateApis", "editSiteStore", "editorStore", "preferencesStore", "SidebarNavigationScreen", "SidebarNavigationScreenDetailsFooter"]
|
|
7
7
|
}
|
|
@@ -30,28 +30,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// packages/edit-site/src/components/sidebar-navigation-screen-identity/index.js
|
|
31
31
|
var sidebar_navigation_screen_identity_exports = {};
|
|
32
32
|
__export(sidebar_navigation_screen_identity_exports, {
|
|
33
|
-
SidebarNavigationItemIdentity: () => SidebarNavigationItemIdentity,
|
|
34
33
|
default: () => SidebarNavigationScreenIdentity
|
|
35
34
|
});
|
|
36
35
|
module.exports = __toCommonJS(sidebar_navigation_screen_identity_exports);
|
|
37
36
|
var import_i18n = require("@wordpress/i18n");
|
|
38
|
-
var import_router = require("@wordpress/router");
|
|
39
37
|
var import_sidebar_navigation_screen = __toESM(require("../sidebar-navigation-screen/index.cjs"));
|
|
40
|
-
var import_lock_unlock = require("../../lock-unlock.cjs");
|
|
41
|
-
var import_sidebar_navigation_item = __toESM(require("../sidebar-navigation-item/index.cjs"));
|
|
42
38
|
var import_sidebar_navigation_screen_main = require("../sidebar-navigation-screen-main/index.cjs");
|
|
43
39
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
-
var { useLocation } = (0, import_lock_unlock.unlock)(import_router.privateApis);
|
|
45
|
-
function SidebarNavigationItemIdentity(props) {
|
|
46
|
-
const { name } = useLocation();
|
|
47
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
48
|
-
import_sidebar_navigation_item.default,
|
|
49
|
-
{
|
|
50
|
-
...props,
|
|
51
|
-
"aria-current": name === "identity"
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
40
|
function SidebarNavigationScreenIdentity() {
|
|
56
41
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
42
|
import_sidebar_navigation_screen.default,
|
|
@@ -65,8 +50,4 @@ function SidebarNavigationScreenIdentity() {
|
|
|
65
50
|
}
|
|
66
51
|
);
|
|
67
52
|
}
|
|
68
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
69
|
-
0 && (module.exports = {
|
|
70
|
-
SidebarNavigationItemIdentity
|
|
71
|
-
});
|
|
72
53
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/sidebar-navigation-screen-identity/index.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
6
|
-
"names": ["
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport SidebarNavigationScreen from '../sidebar-navigation-screen';\nimport { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main';\n\nexport default function SidebarNavigationScreenIdentity() {\n\treturn (\n\t\t<SidebarNavigationScreen\n\t\t\tisRoot\n\t\t\ttitle={ __( 'Design' ) }\n\t\t\tdescription={ __(\n\t\t\t\t'Customize the appearance of your website using the block editor.'\n\t\t\t) }\n\t\t\tcontent={ <MainSidebarNavigationContent /> }\n\t\t/>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAmB;AAKnB,uCAAoC;AACpC,4CAA6C;AAUhC;AARE,SAAR,kCAAmD;AACzD,SACC;AAAA,IAAC,iCAAAA;AAAA,IAAA;AAAA,MACA,QAAM;AAAA,MACN,WAAQ,gBAAI,QAAS;AAAA,MACrB,iBAAc;AAAA,QACb;AAAA,MACD;AAAA,MACA,SAAU,4CAAC,sEAA6B;AAAA;AAAA,EACzC;AAEF;",
|
|
6
|
+
"names": ["SidebarNavigationScreen"]
|
|
7
7
|
}
|