@wordpress/edit-site 6.0.3 → 6.0.5

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 (69) hide show
  1. package/build/components/add-new-page/index.js +7 -1
  2. package/build/components/add-new-page/index.js.map +1 -1
  3. package/build/components/add-new-pattern/index.js +30 -16
  4. package/build/components/add-new-pattern/index.js.map +1 -1
  5. package/build/components/editor/index.js +2 -0
  6. package/build/components/editor/index.js.map +1 -1
  7. package/build/components/layout/index.js +5 -5
  8. package/build/components/layout/index.js.map +1 -1
  9. package/build/components/layout/router.js +15 -10
  10. package/build/components/layout/router.js.map +1 -1
  11. package/build/components/page-pages/index.js +38 -6
  12. package/build/components/page-pages/index.js.map +1 -1
  13. package/build/components/page-patterns/index.js +8 -2
  14. package/build/components/page-patterns/index.js.map +1 -1
  15. package/build/components/page-templates/index.js +10 -3
  16. package/build/components/page-templates/index.js.map +1 -1
  17. package/build/components/revisions/index.js +10 -7
  18. package/build/components/revisions/index.js.map +1 -1
  19. package/build/components/sidebar-dataviews/default-views.js +4 -4
  20. package/build/components/sidebar-dataviews/default-views.js.map +1 -1
  21. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +20 -88
  22. package/build/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  23. package/build/store/private-actions.js +7 -2
  24. package/build/store/private-actions.js.map +1 -1
  25. package/build-module/components/add-new-page/index.js +8 -2
  26. package/build-module/components/add-new-page/index.js.map +1 -1
  27. package/build-module/components/add-new-pattern/index.js +30 -16
  28. package/build-module/components/add-new-pattern/index.js.map +1 -1
  29. package/build-module/components/editor/index.js +2 -0
  30. package/build-module/components/editor/index.js.map +1 -1
  31. package/build-module/components/layout/index.js +5 -5
  32. package/build-module/components/layout/index.js.map +1 -1
  33. package/build-module/components/layout/router.js +15 -10
  34. package/build-module/components/layout/router.js.map +1 -1
  35. package/build-module/components/page-pages/index.js +38 -6
  36. package/build-module/components/page-pages/index.js.map +1 -1
  37. package/build-module/components/page-patterns/index.js +8 -2
  38. package/build-module/components/page-patterns/index.js.map +1 -1
  39. package/build-module/components/page-templates/index.js +10 -3
  40. package/build-module/components/page-templates/index.js.map +1 -1
  41. package/build-module/components/revisions/index.js +10 -7
  42. package/build-module/components/revisions/index.js.map +1 -1
  43. package/build-module/components/sidebar-dataviews/default-views.js +5 -5
  44. package/build-module/components/sidebar-dataviews/default-views.js.map +1 -1
  45. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +19 -86
  46. package/build-module/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js.map +1 -1
  47. package/build-module/store/private-actions.js +7 -2
  48. package/build-module/store/private-actions.js.map +1 -1
  49. package/build-style/style-rtl.css +17 -25
  50. package/build-style/style.css +17 -25
  51. package/package.json +17 -17
  52. package/src/components/add-new-page/index.js +14 -1
  53. package/src/components/add-new-pattern/index.js +37 -23
  54. package/src/components/block-editor/style.scss +0 -11
  55. package/src/components/editor/index.js +2 -0
  56. package/src/components/layout/index.js +2 -3
  57. package/src/components/layout/router.js +23 -15
  58. package/src/components/page-pages/index.js +45 -11
  59. package/src/components/page-pages/style.scss +1 -1
  60. package/src/components/page-patterns/index.js +8 -2
  61. package/src/components/page-patterns/style.scss +1 -8
  62. package/src/components/page-templates/index.js +9 -2
  63. package/src/components/page-templates/style.scss +1 -6
  64. package/src/components/revisions/index.js +9 -1
  65. package/src/components/sidebar-dataviews/default-views.js +13 -5
  66. package/src/hooks/use-theme-style-variations/test/use-theme-style-variations-by-property.js +1 -875
  67. package/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js +29 -117
  68. package/src/store/private-actions.js +7 -3
  69. package/src/style.scss +13 -0
@@ -1 +1 @@
1
- {"version":3,"names":["Disabled","__","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","editorPrivateApis","useSelect","useContext","useMemo","unlock","EditorCanvasContainer","jsx","_jsx","jsxs","_jsxs","ExperimentalBlockEditorProvider","GlobalStylesContext","useGlobalStylesOutputWithConfig","mergeBaseAndUserConfigs","isObjectEmpty","object","Object","keys","length","Revisions","userConfig","blocks","base","baseConfig","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","select","getSettings","settings","__unstableIsPreviewMode","globalStyles","editorStyles","styles","title","closeButtonLabel","enableResizing","children","className","name","tabIndex","value","renderAppender"],"sources":["@wordpress/edit-site/src/components/revisions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\tGlobalStylesContext,\n\tuseGlobalStylesOutputWithConfig,\n} = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\nfunction Revisions( { userConfig, blocks } ) {\n\tconst { base: baseConfig } = useContext( GlobalStylesContext );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\tconst renderedBlocksArray = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst editorStyles =\n\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\tcloseButtonLabel={ __( 'Close revisions' ) }\n\t\t\tenableResizing\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tclassName=\"edit-site-revisions__iframe\"\n\t\t\t\tname=\"revisions\"\n\t\t\t\ttabIndex={ 0 }\n\t\t\t>\n\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t<style>\n\t\t\t\t\t{\n\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t`.is-root-container { display: flow-root; }`\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t<Disabled className=\"edit-site-revisions__example-preview__content\">\n\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\tvalue={ renderedBlocksArray }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t</Disabled>\n\t\t\t</Iframe>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nexport default Revisions;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,SAAS,EACTC,WAAW,IAAIC,sBAAsB,EACrCC,KAAK,IAAIC,gBAAgB,EACz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version":3,"names":["Disabled","__","BlockList","privateApis","blockEditorPrivateApis","store","blockEditorStore","__unstableEditorStyles","EditorStyles","__unstableIframe","Iframe","editorPrivateApis","useSelect","useContext","useMemo","unlock","EditorCanvasContainer","jsx","_jsx","jsxs","_jsxs","ExperimentalBlockEditorProvider","GlobalStylesContext","useGlobalStylesOutputWithConfig","__unstableBlockStyleVariationOverridesWithConfig","mergeBaseAndUserConfigs","isObjectEmpty","object","Object","keys","length","Revisions","userConfig","blocks","base","baseConfig","mergedConfig","renderedBlocksArray","Array","isArray","originalSettings","select","getSettings","settings","__unstableIsPreviewMode","globalStyles","editorStyles","styles","title","closeButtonLabel","enableResizing","children","className","name","tabIndex","value","renderAppender","config"],"sources":["@wordpress/edit-site/src/components/revisions/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { Disabled } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tBlockList,\n\tprivateApis as blockEditorPrivateApis,\n\tstore as blockEditorStore,\n\t__unstableEditorStyles as EditorStyles,\n\t__unstableIframe as Iframe,\n} from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { useSelect } from '@wordpress/data';\nimport { useContext, useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../../lock-unlock';\nimport EditorCanvasContainer from '../editor-canvas-container';\n\nconst {\n\tExperimentalBlockEditorProvider,\n\tGlobalStylesContext,\n\tuseGlobalStylesOutputWithConfig,\n\t__unstableBlockStyleVariationOverridesWithConfig,\n} = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\nfunction isObjectEmpty( object ) {\n\treturn ! object || Object.keys( object ).length === 0;\n}\n\nfunction Revisions( { userConfig, blocks } ) {\n\tconst { base: baseConfig } = useContext( GlobalStylesContext );\n\n\tconst mergedConfig = useMemo( () => {\n\t\tif ( ! isObjectEmpty( userConfig ) && ! isObjectEmpty( baseConfig ) ) {\n\t\t\treturn mergeBaseAndUserConfigs( baseConfig, userConfig );\n\t\t}\n\t\treturn {};\n\t}, [ baseConfig, userConfig ] );\n\n\tconst renderedBlocksArray = useMemo(\n\t\t() => ( Array.isArray( blocks ) ? blocks : [ blocks ] ),\n\t\t[ blocks ]\n\t);\n\n\tconst originalSettings = useSelect(\n\t\t( select ) => select( blockEditorStore ).getSettings(),\n\t\t[]\n\t);\n\tconst settings = useMemo(\n\t\t() => ( { ...originalSettings, __unstableIsPreviewMode: true } ),\n\t\t[ originalSettings ]\n\t);\n\n\tconst [ globalStyles ] = useGlobalStylesOutputWithConfig( mergedConfig );\n\n\tconst editorStyles =\n\t\t! isObjectEmpty( globalStyles ) && ! isObjectEmpty( userConfig )\n\t\t\t? globalStyles\n\t\t\t: settings.styles;\n\n\treturn (\n\t\t<EditorCanvasContainer\n\t\t\ttitle={ __( 'Revisions' ) }\n\t\t\tcloseButtonLabel={ __( 'Close revisions' ) }\n\t\t\tenableResizing\n\t\t>\n\t\t\t<Iframe\n\t\t\t\tclassName=\"edit-site-revisions__iframe\"\n\t\t\t\tname=\"revisions\"\n\t\t\t\ttabIndex={ 0 }\n\t\t\t>\n\t\t\t\t<style>\n\t\t\t\t\t{\n\t\t\t\t\t\t// Forming a \"block formatting context\" to prevent margin collapsing.\n\t\t\t\t\t\t// @see https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context\n\t\t\t\t\t\t`.is-root-container { display: flow-root; }`\n\t\t\t\t\t}\n\t\t\t\t</style>\n\t\t\t\t<Disabled className=\"edit-site-revisions__example-preview__content\">\n\t\t\t\t\t<ExperimentalBlockEditorProvider\n\t\t\t\t\t\tvalue={ renderedBlocksArray }\n\t\t\t\t\t\tsettings={ settings }\n\t\t\t\t\t>\n\t\t\t\t\t\t<BlockList renderAppender={ false } />\n\t\t\t\t\t\t{ /*\n\t\t\t\t\t\t * Styles are printed inside the block editor provider,\n\t\t\t\t\t\t * so they can access any registered style overrides.\n\t\t\t\t\t\t */ }\n\t\t\t\t\t\t<EditorStyles styles={ editorStyles } />\n\t\t\t\t\t\t<__unstableBlockStyleVariationOverridesWithConfig\n\t\t\t\t\t\t\tconfig={ mergedConfig }\n\t\t\t\t\t\t/>\n\t\t\t\t\t</ExperimentalBlockEditorProvider>\n\t\t\t\t</Disabled>\n\t\t\t</Iframe>\n\t\t</EditorCanvasContainer>\n\t);\n}\n\nexport default Revisions;\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,QAAQ,QAAQ,uBAAuB;AAChD,SAASC,EAAE,QAAQ,iBAAiB;AACpC,SACCC,SAAS,EACTC,WAAW,IAAIC,sBAAsB,EACrCC,KAAK,IAAIC,gBAAgB,EACzBC,sBAAsB,IAAIC,YAAY,EACtCC,gBAAgB,IAAIC,MAAM,QACpB,yBAAyB;AAChC,SAASP,WAAW,IAAIQ,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;;AAExD;AACA;AACA;;AAEA,SAASC,MAAM,QAAQ,mBAAmB;AAC1C,OAAOC,qBAAqB,MAAM,4BAA4B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAAA,SAAAC,IAAA,IAAAC,KAAA;AAE/D,MAAM;EACLC,+BAA+B;EAC/BC,mBAAmB;EACnBC,+BAA+B;EAC/BC;AACD,CAAC,GAAGT,MAAM,CAAEX,sBAAuB,CAAC;AACpC,MAAM;EAAEqB;AAAwB,CAAC,GAAGV,MAAM,CAAEJ,iBAAkB,CAAC;AAE/D,SAASe,aAAaA,CAAEC,MAAM,EAAG;EAChC,OAAO,CAAEA,MAAM,IAAIC,MAAM,CAACC,IAAI,CAAEF,MAAO,CAAC,CAACG,MAAM,KAAK,CAAC;AACtD;AAEA,SAASC,SAASA,CAAE;EAAEC,UAAU;EAAEC;AAAO,CAAC,EAAG;EAC5C,MAAM;IAAEC,IAAI,EAAEC;EAAW,CAAC,GAAGtB,UAAU,C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AiC,QAAA;QAEE;QACA;QACC;MAA2C,CAEvC,CAAC,eACRjC,IAAA,CAAClB,QAAQ;QAACoD,SAAS,EAAC,+CAA+C;QAAAD,QAAA,eAClE/B,KAAA,CAACC,+BAA+B;UAC/BkC,KAAK,EAAGlB,mBAAqB;UAC7BM,QAAQ,EAAGA,QAAU;UAAAQ,QAAA,gBAErBjC,IAAA,CAAChB,SAAS;YAACsD,cAAc,EAAG;UAAO,CAAE,CAAC,eAKtCtC,IAAA,CAACV,YAAY;YAACuC,MAAM,EAAGD;UAAc,CAAE,CAAC,eACxC5B,IAAA,CAACM,gDAAgD;YAChDiC,MAAM,EAAGrB;UAAc,CACvB,CAAC;QAAA,CAC8B;MAAC,CACzB,CAAC;IAAA,CACJ;EAAC,CACa,CAAC;AAE1B;AAEA,eAAeL,SAAS","ignoreList":[]}
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __ } from '@wordpress/i18n';
5
- import { trash, pages, drafts, unseen, inbox } from '@wordpress/icons';
5
+ import { trash, pages, drafts, published, scheduled, pending, notAllowed } from '@wordpress/icons';
6
6
 
7
7
  /**
8
8
  * Internal dependencies
@@ -47,7 +47,7 @@ export const DEFAULT_VIEWS = {
47
47
  }, {
48
48
  title: __('Published'),
49
49
  slug: 'published',
50
- icon: pages,
50
+ icon: published,
51
51
  view: {
52
52
  ...DEFAULT_PAGE_BASE,
53
53
  filters: [{
@@ -59,7 +59,7 @@ export const DEFAULT_VIEWS = {
59
59
  }, {
60
60
  title: __('Scheduled'),
61
61
  slug: 'future',
62
- icon: pages,
62
+ icon: scheduled,
63
63
  view: {
64
64
  ...DEFAULT_PAGE_BASE,
65
65
  filters: [{
@@ -83,7 +83,7 @@ export const DEFAULT_VIEWS = {
83
83
  }, {
84
84
  title: __('Pending'),
85
85
  slug: 'pending',
86
- icon: inbox,
86
+ icon: pending,
87
87
  view: {
88
88
  ...DEFAULT_PAGE_BASE,
89
89
  filters: [{
@@ -95,7 +95,7 @@ export const DEFAULT_VIEWS = {
95
95
  }, {
96
96
  title: __('Private'),
97
97
  slug: 'private',
98
- icon: unseen,
98
+ icon: notAllowed,
99
99
  view: {
100
100
  ...DEFAULT_PAGE_BASE,
101
101
  filters: [{
@@ -1 +1 @@
1
- {"version":3,"names":["__","trash","pages","drafts","unseen","inbox","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","DEFAULT_CONFIG_PER_VIEW_TYPE","primaryField","mediaField","DEFAULT_PAGE_BASE","type","search","filters","page","perPage","sort","field","direction","hiddenFields","layout","DEFAULT_VIEWS","title","slug","icon","view","operator","value"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { trash, pages, drafts, unseen, inbox } from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const DEFAULT_CONFIG_PER_VIEW_TYPE = {\n\t[ LAYOUT_TABLE ]: {\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'featured-image',\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tprimaryField: 'title',\n\t\tmediaField: 'featured-image',\n\t},\n};\n\nconst DEFAULT_PAGE_BASE = {\n\ttype: LAYOUT_LIST,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'date', 'featured-image' ],\n\tlayout: {\n\t\t...DEFAULT_CONFIG_PER_VIEW_TYPE[ LAYOUT_LIST ],\n\t},\n};\n\nexport const DEFAULT_VIEWS = {\n\tpage: [\n\t\t{\n\t\t\ttitle: __( 'All pages' ),\n\t\t\tslug: 'all',\n\t\t\ticon: pages,\n\t\t\tview: DEFAULT_PAGE_BASE,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Published' ),\n\t\t\tslug: 'published',\n\t\t\ticon: pages,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'publish',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Scheduled' ),\n\t\t\tslug: 'future',\n\t\t\ticon: pages,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'future',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\ticon: drafts,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Pending' ),\n\t\t\tslug: 'pending',\n\t\t\ticon: inbox,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'pending',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Private' ),\n\t\t\tslug: 'private',\n\t\t\ticon: unseen,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'private',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'trash',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t],\n};\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,EAAE,QAAQ,iBAAiB;AACpC,SAASC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,MAAM,EAAEC,KAAK,QAAQ,kBAAkB;;AAEtE;AACA;AACA;AACA,SACCC,WAAW,EACXC,YAAY,EACZC,WAAW,EACXC,eAAe,QACT,uBAAuB;AAE9B,OAAO,MAAMC,4BAA4B,GAAG;EAC3C,CAAEH,YAAY,GAAI;IACjBI,YAAY,EAAE;EACf,CAAC;EACD,CAAEH,WAAW,GAAI;IAChBI,UAAU,EAAE,gBAAgB;IAC5BD,YAAY,EAAE;EACf,CAAC;EACD,CAAEL,WAAW,GAAI;IAChBK,YAAY,EAAE,OAAO;IACrBC,UAAU,EAAE;EACb;AACD,CAAC;AAED,MAAMC,iBAAiB,GAAG;EACzBC,IAAI,EAAER,WAAW;EACjBS,MAAM,EAAE,EAAE;EACVC,OAAO,EAAE,EAAE;EACXC,IAAI,EAAE,CAAC;EACPC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EAAEzB,EAAE,CAAE,SAAU,CAAC;IACtB0B,IAAI,EAAE,SAAS;IACfC,IAAI,EAAEtB,KAAK;IACXuB,IAAI,EAAE;MACL,GAAGf,iBAAiB;MACpBG,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfS,QAAQ,EAAEpB,eAAe;QACzBqB,KAAK,EAAE;MACR,CAAC;IAEH;EACD,CAAC,EACD;IACCL,KAAK,EAAEzB,EAAE,CAAE,SAAU,CAAC;IACtB0B,IAAI,EAAE,SAAS;IACfC,IAAI,EAAEvB,MAAM;IACZwB,IAAI,EAAE;MACL,GAAGf,iBAAiB;MACpBG,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfS,QAAQ,EAAEpB,eAAe;QACzBqB,KAAK,EAAE;MACR,CAAC;IAEH;EACD,CAAC,EACD;IACCL,KAAK,EAAEzB,EAAE,CAAE,OAAQ,CAAC;IACpB0B,IAAI,EAAE,OAAO;IACbC,IAAI,EAAE1B,KAAK;IACX2B,IAAI,EAAE;MACL,GAAGf,iBAAiB;MACpBG,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfS,QAAQ,EAAEpB,eAAe;QACzBqB,KAAK,EAAE;MACR,CAAC;IAEH;EACD,CAAC;AAEH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["__","trash","pages","drafts","published","scheduled","pending","notAllowed","LAYOUT_LIST","LAYOUT_TABLE","LAYOUT_GRID","OPERATOR_IS_ANY","DEFAULT_CONFIG_PER_VIEW_TYPE","primaryField","mediaField","DEFAULT_PAGE_BASE","type","search","filters","page","perPage","sort","field","direction","hiddenFields","layout","DEFAULT_VIEWS","title","slug","icon","view","operator","value"],"sources":["@wordpress/edit-site/src/components/sidebar-dataviews/default-views.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport {\n\ttrash,\n\tpages,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\n\n/**\n * Internal dependencies\n */\nimport {\n\tLAYOUT_LIST,\n\tLAYOUT_TABLE,\n\tLAYOUT_GRID,\n\tOPERATOR_IS_ANY,\n} from '../../utils/constants';\n\nexport const DEFAULT_CONFIG_PER_VIEW_TYPE = {\n\t[ LAYOUT_TABLE ]: {\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_GRID ]: {\n\t\tmediaField: 'featured-image',\n\t\tprimaryField: 'title',\n\t},\n\t[ LAYOUT_LIST ]: {\n\t\tprimaryField: 'title',\n\t\tmediaField: 'featured-image',\n\t},\n};\n\nconst DEFAULT_PAGE_BASE = {\n\ttype: LAYOUT_LIST,\n\tsearch: '',\n\tfilters: [],\n\tpage: 1,\n\tperPage: 20,\n\tsort: {\n\t\tfield: 'date',\n\t\tdirection: 'desc',\n\t},\n\t// All fields are visible by default, so it's\n\t// better to keep track of the hidden ones.\n\thiddenFields: [ 'date', 'featured-image' ],\n\tlayout: {\n\t\t...DEFAULT_CONFIG_PER_VIEW_TYPE[ LAYOUT_LIST ],\n\t},\n};\n\nexport const DEFAULT_VIEWS = {\n\tpage: [\n\t\t{\n\t\t\ttitle: __( 'All pages' ),\n\t\t\tslug: 'all',\n\t\t\ticon: pages,\n\t\t\tview: DEFAULT_PAGE_BASE,\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Published' ),\n\t\t\tslug: 'published',\n\t\t\ticon: published,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'publish',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Scheduled' ),\n\t\t\tslug: 'future',\n\t\t\ticon: scheduled,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'future',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Drafts' ),\n\t\t\tslug: 'drafts',\n\t\t\ticon: drafts,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'draft',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Pending' ),\n\t\t\tslug: 'pending',\n\t\t\ticon: pending,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'pending',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Private' ),\n\t\t\tslug: 'private',\n\t\t\ticon: notAllowed,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_IS_ANY,\n\t\t\t\t\t\tvalue: 'private',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttitle: __( 'Trash' ),\n\t\t\tslug: 'trash',\n\t\t\ticon: trash,\n\t\t\tview: {\n\t\t\t\t...DEFAULT_PAGE_BASE,\n\t\t\t\tfilters: [\n\t\t\t\t\t{\n\t\t\t\t\t\tfield: 'status',\n\t\t\t\t\t\toperator: OPERATOR_I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;IAEH;EACD,CAAC,EACD;IACCL,KAAK,EAAE3B,EAAE,CAAE,OAAQ,CAAC;IACpB4B,IAAI,EAAE,OAAO;IACbC,IAAI,EAAE5B,KAAK;IACX6B,IAAI,EAAE;MACL,GAAGf,iBAAiB;MACpBG,OAAO,EAAE,CACR;QACCI,KAAK,EAAE,QAAQ;QACfS,QAAQ,EAAEpB,eAAe;QACzBqB,KAAK,EAAE;MACR,CAAC;IAEH;EACD,CAAC;AAEH,CAAC","ignoreList":[]}
@@ -45,17 +45,15 @@ export function removePropertyFromObject(object, property) {
45
45
  }
46
46
 
47
47
  /**
48
- * A convenience wrapper for `useThemeStyleVariationsByProperty()` that fetches the current theme style variations,
49
- * and user-defined global style/settings object.
48
+ * Fetches the current theme style variations that contain only the specified property
49
+ * and merges them with the user config.
50
50
  *
51
- * @param {Object} props Object of hook args.
52
- * @param {string} props.property The property to filter by.
53
- * @param {Function} props.filter Optional. The filter function to apply to the variations.
51
+ * @param {Object} props Object of hook args.
52
+ * @param {string} props.property The property to filter by.
54
53
  * @return {Object[]|*} The merged object.
55
54
  */
56
55
  export function useCurrentMergeThemeStyleVariationsWithUserConfig({
57
- property,
58
- filter
56
+ property
59
57
  }) {
60
58
  const {
61
59
  variationsFromTheme
@@ -66,21 +64,21 @@ export function useCurrentMergeThemeStyleVariationsWithUserConfig({
66
64
  };
67
65
  }, []);
68
66
  const {
69
- user: baseVariation
67
+ user: userVariation
70
68
  } = useContext(GlobalStylesContext);
71
- const variations = useMemo(() => {
72
- return [{
73
- title: __('Default'),
74
- settings: {},
75
- styles: {}
76
- }, ...variationsFromTheme];
77
- }, [variationsFromTheme]);
78
- return useThemeStyleVariationsByProperty({
79
- variations,
80
- property,
81
- filter,
82
- baseVariation: removePropertyFromObject(cloneDeep(baseVariation), property)
83
- });
69
+ return useMemo(() => {
70
+ const clonedUserVariation = cloneDeep(userVariation);
71
+
72
+ // Get user variation and remove the settings for the given property.
73
+ const userVariationWithoutProperty = removePropertyFromObject(clonedUserVariation, property);
74
+ userVariationWithoutProperty.title = __('Default');
75
+ const variationsWithSinglePropertyAndBase = variationsFromTheme.filter(variation => {
76
+ return isVariationWithSingleProperty(variation, property);
77
+ }).map(variation => {
78
+ return mergeBaseAndUserConfigs(userVariationWithoutProperty, variation);
79
+ });
80
+ return [userVariationWithoutProperty, ...variationsWithSinglePropertyAndBase];
81
+ }, [property, userVariation, variationsFromTheme]);
84
82
  }
85
83
 
86
84
  /**
@@ -111,71 +109,6 @@ export const filterObjectByProperty = (object, property) => {
111
109
  return newObject;
112
110
  };
113
111
 
114
- /**
115
- * Returns a new object with only the properties specified in `property`.
116
- * Optional merges the baseVariation object with the variation object.
117
- * Note: this function will only overwrite the specified property in baseVariation if it exists.
118
- * The baseVariation will not be otherwise modified. To strip a property from the baseVariation object, use `removePropertyFromObject`.
119
- * See useCurrentMergeThemeStyleVariationsWithUserConfig for an example of how to use this function.
120
- *
121
- * @param {Object} props Object of hook args.
122
- * @param {Object[]} props.variations The theme style variations to filter.
123
- * @param {string} props.property The property to filter by.
124
- * @param {Function} props.filter Optional. The filter function to apply to the variations.
125
- * @param {Object} props.baseVariation Optional. Base or user settings to be updated with variation properties.
126
- * @return {Object[]|*} The merged object.
127
- */
128
- export default function useThemeStyleVariationsByProperty({
129
- variations,
130
- property,
131
- filter,
132
- baseVariation
133
- }) {
134
- return useMemo(() => {
135
- if (!property || !variations || variations?.length === 0) {
136
- return variations;
137
- }
138
- const clonedBaseVariation = typeof baseVariation === 'object' && Object.keys(baseVariation).length > 0 ? cloneDeep(baseVariation) : null;
139
- let processedStyleVariations = variations.reduce((accumulator, variation) => {
140
- const variationFilteredByProperty = filterObjectByProperty(cloneDeep(variation), property);
141
-
142
- // Remove variations that are empty once the property is filtered out.
143
- if (variation.title !== __('Default') && Object.keys(variationFilteredByProperty).length === 0) {
144
- return accumulator;
145
- }
146
- let result = {
147
- ...variationFilteredByProperty,
148
- title: variation?.title,
149
- description: variation?.description
150
- };
151
- if (clonedBaseVariation) {
152
- /*
153
- * Overwrites all baseVariation object `styleProperty` properties
154
- * with the theme variation `styleProperty` properties.
155
- */
156
- result = mergeBaseAndUserConfigs(clonedBaseVariation, result);
157
- }
158
-
159
- // Detect if this is a duplicate variation.
160
- const isDuplicate = accumulator.some(item => {
161
- return JSON.stringify(item.styles) === JSON.stringify(result?.styles) && JSON.stringify(item.settings) === JSON.stringify(result?.settings);
162
- });
163
- if (isDuplicate) {
164
- return accumulator;
165
- }
166
-
167
- // If the variation is not a duplicate, add it to the accumulator.
168
- accumulator.push(result);
169
- return accumulator;
170
- }, [] // Initial accumulator value.
171
- );
172
- if ('function' === typeof filter) {
173
- processedStyleVariations = processedStyleVariations.filter(filter);
174
- }
175
- return processedStyleVariations;
176
- }, [variations, property, baseVariation, filter]);
177
- }
178
-
179
112
  /**
180
113
  * Compares a style variation to the same variation filtered by a single property.
181
114
  * Returns true if the variation contains only the property specified.
@@ -1 +1 @@
1
- {"version":3,"names":["useSelect","store","coreStore","useContext","useMemo","privateApis","blockEditorPrivateApis","editorPrivateApis","__","cloneDeep","unlock","GlobalStylesContext","mergeBaseAndUserConfigs","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","filter","variationsFromTheme","select","_variationsFromTheme","__experimentalGetCurrentThemeGlobalStylesVariations","user","baseVariation","variations","title","settings","styles","useThemeStyleVariationsByProperty","filterObjectByProperty","newObject","forEach","newFilter","clonedBaseVariation","processedStyleVariations","reduce","accumulator","variation","variationFilteredByProperty","result","description","isDuplicate","some","item","JSON","stringify","push","isVariationWithSingleProperty","variationWithProperty"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of a property from an object.\n *\n * @param {Object} object The object to remove the property from.\n * @param {string} property The property to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertyFromObject( object, property ) {\n\tif ( ! property || typeof property !== 'string' ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( key === property ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertyFromObject( object[ key ], property );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * A convenience wrapper for `useThemeStyleVariationsByProperty()` that fetches the current theme style variations,\n * and user-defined global style/settings object.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\n\tfilter,\n} ) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: baseVariation } = useContext( GlobalStylesContext );\n\n\tconst variations = useMemo( () => {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttitle: __( 'Default' ),\n\t\t\t\tsettings: {},\n\t\t\t\tstyles: {},\n\t\t\t},\n\t\t\t...variationsFromTheme,\n\t\t];\n\t}, [ variationsFromTheme ] );\n\n\treturn useThemeStyleVariationsByProperty( {\n\t\tvariations,\n\t\tproperty,\n\t\tfilter,\n\t\tbaseVariation: removePropertyFromObject(\n\t\t\tcloneDeep( baseVariation ),\n\t\t\tproperty\n\t\t),\n\t} );\n}\n\n/**\n * Returns a new object, with properties specified in `property`,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given property.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.\n *\n * @param {Object} object The object to filter\n * @param {Object} property The property to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperty = ( object, property ) => {\n\tif ( ! object ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( key === property ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperty( object[ key ], property );\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Returns a new object with only the properties specified in `property`.\n * Optional merges the baseVariation object with the variation object.\n * Note: this function will only overwrite the specified property in baseVariation if it exists.\n * The baseVariation will not be otherwise modified. To strip a property from the baseVariation object, use `removePropertyFromObject`.\n * See useCurrentMergeThemeStyleVariationsWithUserConfig for an example of how to use this function.\n *\n * @param {Object} props Object of hook args.\n * @param {Object[]} props.variations The theme style variations to filter.\n * @param {string} props.property The property to filter by.\n * @param {Function} props.filter Optional. The filter function to apply to the variations.\n * @param {Object} props.baseVariation Optional. Base or user settings to be updated with variation properties.\n * @return {Object[]|*} The merged object.\n */\nexport default function useThemeStyleVariationsByProperty( {\n\tvariations,\n\tproperty,\n\tfilter,\n\tbaseVariation,\n} ) {\n\treturn useMemo( () => {\n\t\tif ( ! property || ! variations || variations?.length === 0 ) {\n\t\t\treturn variations;\n\t\t}\n\n\t\tconst clonedBaseVariation =\n\t\t\ttypeof baseVariation === 'object' &&\n\t\t\tObject.keys( baseVariation ).length > 0\n\t\t\t\t? cloneDeep( baseVariation )\n\t\t\t\t: null;\n\n\t\tlet processedStyleVariations = variations.reduce(\n\t\t\t( accumulator, variation ) => {\n\t\t\t\tconst variationFilteredByProperty = filterObjectByProperty(\n\t\t\t\t\tcloneDeep( variation ),\n\t\t\t\t\tproperty\n\t\t\t\t);\n\n\t\t\t\t// Remove variations that are empty once the property is filtered out.\n\t\t\t\tif (\n\t\t\t\t\tvariation.title !== __( 'Default' ) &&\n\t\t\t\t\tObject.keys( variationFilteredByProperty ).length === 0\n\t\t\t\t) {\n\t\t\t\t\treturn accumulator;\n\t\t\t\t}\n\n\t\t\t\tlet result = {\n\t\t\t\t\t...variationFilteredByProperty,\n\t\t\t\t\ttitle: variation?.title,\n\t\t\t\t\tdescription: variation?.description,\n\t\t\t\t};\n\n\t\t\t\tif ( clonedBaseVariation ) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Overwrites all baseVariation object `styleProperty` properties\n\t\t\t\t\t * with the theme variation `styleProperty` properties.\n\t\t\t\t\t */\n\t\t\t\t\tresult = mergeBaseAndUserConfigs(\n\t\t\t\t\t\tclonedBaseVariation,\n\t\t\t\t\t\tresult\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Detect if this is a duplicate variation.\n\t\t\t\tconst isDuplicate = accumulator.some( ( item ) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\tJSON.stringify( item.styles ) ===\n\t\t\t\t\t\t\tJSON.stringify( result?.styles ) &&\n\t\t\t\t\t\tJSON.stringify( item.settings ) ===\n\t\t\t\t\t\t\tJSON.stringify( result?.settings )\n\t\t\t\t\t);\n\t\t\t\t} );\n\t\t\t\tif ( isDuplicate ) {\n\t\t\t\t\treturn accumulator;\n\t\t\t\t}\n\n\t\t\t\t// If the variation is not a duplicate, add it to the accumulator.\n\t\t\t\taccumulator.push( result );\n\t\t\t\treturn accumulator;\n\t\t\t},\n\t\t\t[] // Initial accumulator value.\n\t\t);\n\n\t\tif ( 'function' === typeof filter ) {\n\t\t\tprocessedStyleVariations =\n\t\t\t\tprocessedStyleVariations.filter( filter );\n\t\t}\n\n\t\treturn processedStyleVariations;\n\t}, [ variations, property, baseVariation, filter ] );\n}\n\n/**\n * Compares a style variation to the same variation filtered by a single property.\n * Returns true if the variation contains only the property specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string} property The property to compare.\n * @return {boolean} Whether the variation contains only a single property.\n */\nexport function isVariationWithSingleProperty( variation, property ) {\n\tconst variationWithProperty = filterObjectByProperty(\n\t\tcloneDeep( variation ),\n\t\tproperty\n\t);\n\n\treturn (\n\t\tJSON.stringify( variationWithProperty?.styles ) ===\n\t\t\tJSON.stringify( variation?.styles ) &&\n\t\tJSON.stringify( variationWithProperty?.settings ) ===\n\t\t\tJSON.stringify( variation?.settings )\n\t);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,iBAAiB;AAC3C,SAASC,KAAK,IAAIC,SAAS,QAAQ,sBAAsB;AACzD,SAASC,UAAU,EAAEC,OAAO,QAAQ,oBAAoB;AACxD,SAASC,WAAW,IAAIC,sBAAsB,QAAQ,yBAAyB;AAC/E,SAASD,WAAW,IAAIE,iBAAiB,QAAQ,mBAAmB;AACpE,SAASC,EAAE,QAAQ,iBAAiB;;AAEpC;AACA;AACA;AACA,OAAOC,SAAS,MAAM,wBAAwB;AAC9C,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,MAAM;EAAEC;AAAoB,CAAC,GAAGD,MAAM,CAAEJ,sBAAuB,CAAC;AAChE,MAAM;EAAEM;AAAwB,CAAC,GAAGF,MAAM,CAAEH,iBAAkB,CAAC;;AAE/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASM,wBAAwBA,CAAEC,MAAM,EAAEC,QAAQ,EAAG;EAC5D,IAAK,CAAEA,QAAQ,IAAI,OAAOA,QAAQ,KAAK,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OAAOnB,MAAM,EAAG;MACnCiB,wBAAwB,GACvBA,wBAAwB,CAACjB,MAAM,CAAEA,MAAO,CAAC;IAC3C;IAEA,OAAOiB,wBAAwB;EAChC,CAAC,EAAE,CAAEV,UAAU,EAAEb,QAAQ,EAAEY,aAAa,EAAEN,MAAM,CAAG,CAAC;AACrD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS8B,6BAA6BA,CAAEV,SAAS,EAAE1B,QAAQ,EAAG;EACpE,MAAMqC,qBAAqB,GAAGnB,sBAAsB,CACnDxB,SAAS,CAAEgC,SAAU,CAAC,EACtB1B,QACD,CAAC;EAED,OACCiC,IAAI,CAACC,SAAS,CAAEG,qBAAqB,EAAErB,MAAO,CAAC,KAC9CiB,IAAI,CAACC,SAAS,CAAER,SAAS,EAAEV,MAAO,CAAC,IACpCiB,IAAI,CAACC,SAAS,CAAEG,qBAAqB,EAAEtB,QAAS,CAAC,KAChDkB,IAAI,CAACC,SAAS,CAAER,SAAS,EAAEX,QAAS,CAAC;AAExC","ignoreList":[]}
1
+ {"version":3,"names":["useSelect","store","coreStore","useContext","useMemo","privateApis","blockEditorPrivateApis","editorPrivateApis","__","cloneDeep","unlock","GlobalStylesContext","mergeBaseAndUserConfigs","removePropertyFromObject","object","property","Object","keys","length","key","useCurrentMergeThemeStyleVariationsWithUserConfig","variationsFromTheme","select","_variationsFromTheme","__experimentalGetCurrentThemeGlobalStylesVariations","user","userVariation","clonedUserVariation","userVariationWithoutProperty","title","variationsWithSinglePropertyAndBase","filter","variation","isVariationWithSingleProperty","map","filterObjectByProperty","newObject","forEach","newFilter","variationWithProperty","JSON","stringify","styles","settings"],"sources":["@wordpress/edit-site/src/hooks/use-theme-style-variations/use-theme-style-variations-by-property.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useContext, useMemo } from '@wordpress/element';\nimport { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';\nimport { privateApis as editorPrivateApis } from '@wordpress/editor';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport cloneDeep from '../../utils/clone-deep';\nimport { unlock } from '../../lock-unlock';\n\nconst { GlobalStylesContext } = unlock( blockEditorPrivateApis );\nconst { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );\n\n/**\n * Removes all instances of a property from an object.\n *\n * @param {Object} object The object to remove the property from.\n * @param {string} property The property to remove.\n * @return {Object} The modified object.\n */\nexport function removePropertyFromObject( object, property ) {\n\tif ( ! property || typeof property !== 'string' ) {\n\t\treturn object;\n\t}\n\n\tif (\n\t\ttypeof object !== 'object' ||\n\t\t! object ||\n\t\t! Object.keys( object ).length\n\t) {\n\t\treturn object;\n\t}\n\n\tfor ( const key in object ) {\n\t\tif ( key === property ) {\n\t\t\tdelete object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tremovePropertyFromObject( object[ key ], property );\n\t\t}\n\t}\n\treturn object;\n}\n\n/**\n * Fetches the current theme style variations that contain only the specified property\n * and merges them with the user config.\n *\n * @param {Object} props Object of hook args.\n * @param {string} props.property The property to filter by.\n * @return {Object[]|*} The merged object.\n */\nexport function useCurrentMergeThemeStyleVariationsWithUserConfig( {\n\tproperty,\n} ) {\n\tconst { variationsFromTheme } = useSelect( ( select ) => {\n\t\tconst _variationsFromTheme =\n\t\t\tselect(\n\t\t\t\tcoreStore\n\t\t\t).__experimentalGetCurrentThemeGlobalStylesVariations();\n\n\t\treturn {\n\t\t\tvariationsFromTheme: _variationsFromTheme || [],\n\t\t};\n\t}, [] );\n\tconst { user: userVariation } = useContext( GlobalStylesContext );\n\n\treturn useMemo( () => {\n\t\tconst clonedUserVariation = cloneDeep( userVariation );\n\n\t\t// Get user variation and remove the settings for the given property.\n\t\tconst userVariationWithoutProperty = removePropertyFromObject(\n\t\t\tclonedUserVariation,\n\t\t\tproperty\n\t\t);\n\t\tuserVariationWithoutProperty.title = __( 'Default' );\n\n\t\tconst variationsWithSinglePropertyAndBase = variationsFromTheme\n\t\t\t.filter( ( variation ) => {\n\t\t\t\treturn isVariationWithSingleProperty( variation, property );\n\t\t\t} )\n\t\t\t.map( ( variation ) => {\n\t\t\t\treturn mergeBaseAndUserConfigs(\n\t\t\t\t\tuserVariationWithoutProperty,\n\t\t\t\t\tvariation\n\t\t\t\t);\n\t\t\t} );\n\n\t\treturn [\n\t\t\tuserVariationWithoutProperty,\n\t\t\t...variationsWithSinglePropertyAndBase,\n\t\t];\n\t}, [ property, userVariation, variationsFromTheme ] );\n}\n\n/**\n * Returns a new object, with properties specified in `property`,\n * maintain the original object tree structure.\n * The function is recursive, so it will perform a deep search for the given property.\n * E.g., the function will return `{ a: { b: { c: { test: 1 } } } }` if the property is `test`.\n *\n * @param {Object} object The object to filter\n * @param {Object} property The property to filter by\n * @return {Object} The merged object.\n */\nexport const filterObjectByProperty = ( object, property ) => {\n\tif ( ! object ) {\n\t\treturn {};\n\t}\n\n\tconst newObject = {};\n\tObject.keys( object ).forEach( ( key ) => {\n\t\tif ( key === property ) {\n\t\t\tnewObject[ key ] = object[ key ];\n\t\t} else if ( typeof object[ key ] === 'object' ) {\n\t\t\tconst newFilter = filterObjectByProperty( object[ key ], property );\n\t\t\tif ( Object.keys( newFilter ).length ) {\n\t\t\t\tnewObject[ key ] = newFilter;\n\t\t\t}\n\t\t}\n\t} );\n\treturn newObject;\n};\n\n/**\n * Compares a style variation to the same variation filtered by a single property.\n * Returns true if the variation contains only the property specified.\n *\n * @param {Object} variation The variation to compare.\n * @param {string} property The property to compare.\n * @return {boolean} Whether the variation contains only a single property.\n */\nexport function isVariationWithSingleProperty( variation, property ) {\n\tconst variationWithProperty = filterObjectByProperty(\n\t\tcloneDeep( variation ),\n\t\tproperty\n\t);\n\n\treturn (\n\t\tJSON.stringify( variationWithProperty?.styles ) ===\n\t\t\tJSON.stringify( variation?.styles ) &&\n\t\tJSON.stringify( variationWithProperty?.settings ) ===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,IAAI,CAAEH,MAAO,CAAC,CAACuB,OAAO,CAAIlB,GAAG,IAAM;IACzC,IAAKA,GAAG,KAAKJ,QAAQ,EAAG;MACvBqB,SAAS,CAAEjB,GAAG,CAAE,GAAGL,MAAM,CAAEK,GAAG,CAAE;IACjC,CAAC,MAAM,IAAK,OAAOL,MAAM,CAAEK,GAAG,CAAE,KAAK,QAAQ,EAAG;MAC/C,MAAMmB,SAAS,GAAGH,sBAAsB,CAAErB,MAAM,CAAEK,GAAG,CAAE,EAAEJ,QAAS,CAAC;MACnE,IAAKC,MAAM,CAACC,IAAI,CAAEqB,SAAU,CAAC,CAACpB,MAAM,EAAG;QACtCkB,SAAS,CAAEjB,GAAG,CAAE,GAAGmB,SAAS;MAC7B;IACD;EACD,CAAE,CAAC;EACH,OAAOF,SAAS;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASH,6BAA6BA,CAAED,SAAS,EAAEjB,QAAQ,EAAG;EACpE,MAAMwB,qBAAqB,GAAGJ,sBAAsB,CACnD1B,SAAS,CAAEuB,SAAU,CAAC,EACtBjB,QACD,CAAC;EAED,OACCyB,IAAI,CAACC,SAAS,CAAEF,qBAAqB,EAAEG,MAAO,CAAC,KAC9CF,IAAI,CAACC,SAAS,CAAET,SAAS,EAAEU,MAAO,CAAC,IACpCF,IAAI,CAACC,SAAS,CAAEF,qBAAqB,EAAEI,QAAS,CAAC,KAChDH,IAAI,CAACC,SAAS,CAAET,SAAS,EAAEW,QAAS,CAAC;AAExC","ignoreList":[]}
@@ -14,9 +14,9 @@ export const setCanvasMode = mode => ({
14
14
  registry,
15
15
  dispatch
16
16
  }) => {
17
+ const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
17
18
  const switchCanvasMode = () => {
18
19
  registry.batch(() => {
19
- const isMediumOrBigger = window.matchMedia('(min-width: 782px)').matches;
20
20
  registry.dispatch(blockEditorStore).clearSelectedBlock();
21
21
  registry.dispatch(editorStore).setDeviceType('Desktop');
22
22
  registry.dispatch(blockEditorStore).__unstableSetEditorMode('edit');
@@ -41,7 +41,12 @@ export const setCanvasMode = mode => ({
41
41
  registry.dispatch(editorStore).setIsInserterOpened(false);
42
42
  });
43
43
  };
44
- if (!document.startViewTransition) {
44
+
45
+ /*
46
+ * Skip transition in mobile, otherwise it crashes the browser.
47
+ * See: https://github.com/WordPress/gutenberg/pull/63002.
48
+ */
49
+ if (!isMediumOrBigger || !document.startViewTransition) {
45
50
  switchCanvasMode();
46
51
  } else {
47
52
  document.documentElement.classList.add(`canvas-mode-${mode}-transition`);
@@ -1 +1 @@
1
- {"version":3,"names":["store","blockEditorStore","preferencesStore","editorStore","setCanvasMode","mode","registry","dispatch","switchCanvasMode","batch","isMediumOrBigger","window","matchMedia","matches","clearSelectedBlock","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","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":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;;AAExD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,aAAa,GACvBC,IAAI,IACN,CAAE;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EAC7B,MAAMC,gBAAgB,GAAGA,CAAA,KAAM;IAC9BF,QAAQ,CAACG,KAAK,CAAE,MAAM;MACrB,MAAMC,gBAAgB,GACrBC,MAAM,CAACC,UAAU,CAAE,oBAAqB,CAAC,CAACC,OAAO;MAClDP,QAAQ,CAACC,QAAQ,CAAEN,gBAAiB,CAAC,CAACa,kBAAkB,CAAC,CAAC;MAC1DR,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACY,aAAa,CAAE,SAAU,CAAC;MAC3DT,QAAQ,CACNC,QAAQ,CAAEN,gBAAiB,CAAC,CAC5Be,uBAAuB,CAAE,MAAO,CAAC;MACnC,MAAMC,sBAAsB,GAAGX,QAAQ,CACrCY,MAAM,CAAEf,WAAY,CAAC,CACrBc,sBAAsB,CAAC,CAAC;MAC1BV,QAAQ,CAAE;QACTY,IAAI,EAAE,iBAAiB;QACvBd;MACD,CAAE,CAAC;MACH,MAAMe,UAAU,GAAGf,IAAI,KAAK,MAAM;MAClC,IAAKY,sBAAsB,IAAI,CAAEG,UAAU,EAAG;QAC7Cd,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACkB,mBAAmB,CAAC,CAAC;MACvD;;MAEA;MACA;MACA;MACA,IACCX,gBAAgB,IAChBU,UAAU,IACVd,QAAQ,CACNY,MAAM,CAAEhB,gBAAiB,CAAC,CAC1BoB,GAAG,CAAE,MAAM,EAAE,uBAAwB,CAAC,IACxC,CAAEhB,QAAQ,CACRY,MAAM,CAAEhB,gBAAiB,CAAC,CAC1BoB,GAAG,CAAE,MAAM,EAAE,iBAAkB,CAAC,EACjC;QACDhB,QAAQ,CACNC,QAAQ,CAAEJ,WAAY,CAAC,CACvBoB,mBAAmB,CAAE,IAAK,CAAC;MAC9B,CAAC,MAAM;QACNjB,QAAQ,CACNC,QAAQ,CAAEJ,WAAY,CAAC,CACvBoB,mBAAmB,CAAE,KAAM,CAAC;MAC/B;MACAjB,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACqB,mBAAmB,CAAE,KAAM,CAAC;IAC9D,CAAE,CAAC;EACJ,CAAC;EAED,IAAK,CAAEC,QAAQ,CAACC,mBAAmB,EAAG;IACrClB,gBAAgB,CAAC,CAAC;EACnB,CAAC,MAAM;IACNiB,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACC,GAAG,CACpC,eAAexB,IAAM,aACvB,CAAC;IACD,MAAMyB,UAAU,GAAGL,QAAQ,CAACC,mBAAmB,CAAE,MAChDlB,gBAAgB,CAAC,CAClB,CAAC;IACDsB,UAAU,CAACC,QAAQ,CAACC,OAAO,CAAE,MAAM;MAClCP,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACK,MAAM,CACvC,eAAe5B,IAAM,aACvB,CAAC;IACF,CAAE,CAAC;EACJ;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM6B,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAE5B;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTY,IAAI,EAAE,kCAAkC;IACxCgB;EACD,CAAE,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["store","blockEditorStore","preferencesStore","editorStore","setCanvasMode","mode","registry","dispatch","isMediumOrBigger","window","matchMedia","matches","switchCanvasMode","batch","clearSelectedBlock","setDeviceType","__unstableSetEditorMode","isPublishSidebarOpened","select","type","isEditMode","closePublishSidebar","get","setIsListViewOpened","setIsInserterOpened","document","startViewTransition","documentElement","classList","add","transition","finished","finally","remove","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\tconst switchCanvasMode = () => {\n\t\t\tregistry.batch( () => {\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\t/*\n\t\t * Skip transition in mobile, otherwise it crashes the browser.\n\t\t * See: https://github.com/WordPress/gutenberg/pull/63002.\n\t\t */\n\t\tif ( ! isMediumOrBigger || ! 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":"AAAA;AACA;AACA;AACA,SAASA,KAAK,IAAIC,gBAAgB,QAAQ,yBAAyB;AACnE,SAASD,KAAK,IAAIE,gBAAgB,QAAQ,wBAAwB;AAClE,SAASF,KAAK,IAAIG,WAAW,QAAQ,mBAAmB;;AAExD;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AAQ,CAAEJ,WAAY,CAAC,CACvBoB,mBAAmB,CAAE,KAAM,CAAC;MAC/B;MACAjB,QAAQ,CAACC,QAAQ,CAAEJ,WAAY,CAAC,CAACqB,mBAAmB,CAAE,KAAM,CAAC;IAC9D,CAAE,CAAC;EACJ,CAAC;;EAED;AACF;AACA;AACA;EACE,IAAK,CAAEhB,gBAAgB,IAAI,CAAEiB,QAAQ,CAACC,mBAAmB,EAAG;IAC3Dd,gBAAgB,CAAC,CAAC;EACnB,CAAC,MAAM;IACNa,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACC,GAAG,CACpC,eAAexB,IAAM,aACvB,CAAC;IACD,MAAMyB,UAAU,GAAGL,QAAQ,CAACC,mBAAmB,CAAE,MAChDd,gBAAgB,CAAC,CAClB,CAAC;IACDkB,UAAU,CAACC,QAAQ,CAACC,OAAO,CAAE,MAAM;MAClCP,QAAQ,CAACE,eAAe,CAACC,SAAS,CAACK,MAAM,CACvC,eAAe5B,IAAM,aACvB,CAAC;IACF,CAAE,CAAC;EACJ;AACD,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM6B,4BAA4B,GACtCC,IAAI,IACN,CAAE;EAAE5B;AAAS,CAAC,KAAM;EACnBA,QAAQ,CAAE;IACTY,IAAI,EAAE,kCAAkC;IACxCgB;EACD,CAAE,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -434,7 +434,6 @@
434
434
  aspect-ratio: 1/1;
435
435
  background-color: #f0f0f0;
436
436
  border-radius: 4px;
437
- overflow: hidden;
438
437
  position: relative;
439
438
  }
440
439
  .dataviews-view-grid .dataviews-view-grid__media img {
@@ -826,7 +825,7 @@
826
825
  padding: 0 12px;
827
826
  height: 32px;
828
827
  background: #f0f0f0;
829
- color: #757575;
828
+ color: #2f2f2f;
830
829
  position: relative;
831
830
  display: flex;
832
831
  align-items: center;
@@ -1114,18 +1113,6 @@
1114
1113
  align-items: flex-start;
1115
1114
  }
1116
1115
 
1117
- /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
1118
- ::view-transition-old(frame),
1119
- ::view-transition-new(frame) {
1120
- animation-duration: 0;
1121
- }
1122
-
1123
- /* stylelint-enable */
1124
- .edit-site-visual-editor__editor-canvas {
1125
- /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
1126
- view-transition-name: frame;
1127
- /* stylelint-enable */
1128
- }
1129
1116
  .edit-site-visual-editor__editor-canvas.is-focused {
1130
1117
  outline: calc(2 * var(--wp-admin-border-width-focus)) solid var(--wp-admin-theme-color);
1131
1118
  outline-offset: calc(-2 * var(--wp-admin-border-width-focus));
@@ -1716,7 +1703,7 @@
1716
1703
  overflow: hidden;
1717
1704
  height: 100%;
1718
1705
  width: 100%;
1719
- border-radius: 3px 3px 0 0;
1706
+ border-radius: 4px;
1720
1707
  }
1721
1708
  .page-pages-preview-field__button:focus-visible {
1722
1709
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -1766,10 +1753,6 @@
1766
1753
  display: flex;
1767
1754
  flex-direction: column;
1768
1755
  height: 100%;
1769
- border-radius: 3px 3px 0 0;
1770
- }
1771
- .edit-site-page-patterns-dataviews .page-patterns-preview-field.is-viewtype-grid .block-editor-block-preview__container {
1772
- border-radius: 3px 3px 0 0;
1773
1756
  }
1774
1757
  .edit-site-page-patterns-dataviews .page-patterns-preview-field.is-viewtype-table {
1775
1758
  width: 96px;
@@ -1788,7 +1771,7 @@
1788
1771
  cursor: pointer;
1789
1772
  overflow: hidden;
1790
1773
  height: 100%;
1791
- border-radius: 3px 3px 0 0;
1774
+ border-radius: 4px;
1792
1775
  }
1793
1776
  .edit-site-page-patterns-dataviews .page-patterns-preview-field .page-patterns-preview-field__button:focus-visible {
1794
1777
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -1880,7 +1863,6 @@
1880
1863
  display: flex;
1881
1864
  flex-direction: column;
1882
1865
  height: 100%;
1883
- border-radius: 3px 3px 0 0;
1884
1866
  }
1885
1867
  .page-templates-preview-field .page-templates-preview-field__button {
1886
1868
  box-shadow: none;
@@ -1891,7 +1873,7 @@
1891
1873
  cursor: pointer;
1892
1874
  overflow: hidden;
1893
1875
  height: 100%;
1894
- border-radius: 3px;
1876
+ border-radius: 4px;
1895
1877
  }
1896
1878
  .page-templates-preview-field .page-templates-preview-field__button:focus-visible {
1897
1879
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -1903,9 +1885,6 @@
1903
1885
  .page-templates-preview-field.is-viewtype-grid .block-editor-block-preview__container {
1904
1886
  height: 100%;
1905
1887
  }
1906
- .page-templates-preview-field.is-viewtype-grid .page-templates-preview-field__button {
1907
- border-radius: 3px 3px 0 0;
1908
- }
1909
1888
  .page-templates-preview-field.is-viewtype-table {
1910
1889
  border-radius: 2px;
1911
1890
  position: relative;
@@ -3137,6 +3116,19 @@ button.font-library-modal__upload-area {
3137
3116
  outline-color: var(--wp-admin-theme-color);
3138
3117
  }
3139
3118
 
3119
+ /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
3120
+ ::view-transition-image-pair(root) {
3121
+ isolation: auto;
3122
+ }
3123
+
3124
+ ::view-transition-old(root),
3125
+ ::view-transition-new(root) {
3126
+ animation: none;
3127
+ mix-blend-mode: normal;
3128
+ display: block;
3129
+ }
3130
+
3131
+ /* stylelint-enable */
3140
3132
  body.js #wpadminbar {
3141
3133
  display: none;
3142
3134
  }
@@ -434,7 +434,6 @@
434
434
  aspect-ratio: 1/1;
435
435
  background-color: #f0f0f0;
436
436
  border-radius: 4px;
437
- overflow: hidden;
438
437
  position: relative;
439
438
  }
440
439
  .dataviews-view-grid .dataviews-view-grid__media img {
@@ -826,7 +825,7 @@
826
825
  padding: 0 12px;
827
826
  height: 32px;
828
827
  background: #f0f0f0;
829
- color: #757575;
828
+ color: #2f2f2f;
830
829
  position: relative;
831
830
  display: flex;
832
831
  align-items: center;
@@ -1114,18 +1113,6 @@
1114
1113
  align-items: flex-start;
1115
1114
  }
1116
1115
 
1117
- /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
1118
- ::view-transition-old(frame),
1119
- ::view-transition-new(frame) {
1120
- animation-duration: 0;
1121
- }
1122
-
1123
- /* stylelint-enable */
1124
- .edit-site-visual-editor__editor-canvas {
1125
- /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
1126
- view-transition-name: frame;
1127
- /* stylelint-enable */
1128
- }
1129
1116
  .edit-site-visual-editor__editor-canvas.is-focused {
1130
1117
  outline: calc(2 * var(--wp-admin-border-width-focus)) solid var(--wp-admin-theme-color);
1131
1118
  outline-offset: calc(-2 * var(--wp-admin-border-width-focus));
@@ -1717,7 +1704,7 @@
1717
1704
  overflow: hidden;
1718
1705
  height: 100%;
1719
1706
  width: 100%;
1720
- border-radius: 3px 3px 0 0;
1707
+ border-radius: 4px;
1721
1708
  }
1722
1709
  .page-pages-preview-field__button:focus-visible {
1723
1710
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -1767,10 +1754,6 @@
1767
1754
  display: flex;
1768
1755
  flex-direction: column;
1769
1756
  height: 100%;
1770
- border-radius: 3px 3px 0 0;
1771
- }
1772
- .edit-site-page-patterns-dataviews .page-patterns-preview-field.is-viewtype-grid .block-editor-block-preview__container {
1773
- border-radius: 3px 3px 0 0;
1774
1757
  }
1775
1758
  .edit-site-page-patterns-dataviews .page-patterns-preview-field.is-viewtype-table {
1776
1759
  width: 96px;
@@ -1789,7 +1772,7 @@
1789
1772
  cursor: pointer;
1790
1773
  overflow: hidden;
1791
1774
  height: 100%;
1792
- border-radius: 3px 3px 0 0;
1775
+ border-radius: 4px;
1793
1776
  }
1794
1777
  .edit-site-page-patterns-dataviews .page-patterns-preview-field .page-patterns-preview-field__button:focus-visible {
1795
1778
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -1881,7 +1864,6 @@
1881
1864
  display: flex;
1882
1865
  flex-direction: column;
1883
1866
  height: 100%;
1884
- border-radius: 3px 3px 0 0;
1885
1867
  }
1886
1868
  .page-templates-preview-field .page-templates-preview-field__button {
1887
1869
  box-shadow: none;
@@ -1892,7 +1874,7 @@
1892
1874
  cursor: pointer;
1893
1875
  overflow: hidden;
1894
1876
  height: 100%;
1895
- border-radius: 3px;
1877
+ border-radius: 4px;
1896
1878
  }
1897
1879
  .page-templates-preview-field .page-templates-preview-field__button:focus-visible {
1898
1880
  box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
@@ -1904,9 +1886,6 @@
1904
1886
  .page-templates-preview-field.is-viewtype-grid .block-editor-block-preview__container {
1905
1887
  height: 100%;
1906
1888
  }
1907
- .page-templates-preview-field.is-viewtype-grid .page-templates-preview-field__button {
1908
- border-radius: 3px 3px 0 0;
1909
- }
1910
1889
  .page-templates-preview-field.is-viewtype-table {
1911
1890
  border-radius: 2px;
1912
1891
  position: relative;
@@ -3138,6 +3117,19 @@ button.font-library-modal__upload-area {
3138
3117
  outline-color: var(--wp-admin-theme-color);
3139
3118
  }
3140
3119
 
3120
+ /* stylelint-disable -- Disable reason: View Transitions not supported properly by stylelint. */
3121
+ ::view-transition-image-pair(root) {
3122
+ isolation: auto;
3123
+ }
3124
+
3125
+ ::view-transition-old(root),
3126
+ ::view-transition-new(root) {
3127
+ animation: none;
3128
+ mix-blend-mode: normal;
3129
+ display: block;
3130
+ }
3131
+
3132
+ /* stylelint-enable */
3141
3133
  body.js #wpadminbar {
3142
3134
  display: none;
3143
3135
  }