@wordpress/edit-site 3.0.11 → 3.0.15
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/build/components/add-new-template/new-template-part.js +34 -17
- package/build/components/add-new-template/new-template-part.js.map +1 -1
- package/build/components/add-new-template/new-template.js +41 -22
- package/build/components/add-new-template/new-template.js.map +1 -1
- package/build/components/block-editor/index.js +3 -1
- package/build/components/block-editor/index.js.map +1 -1
- package/build/components/global-styles/color-palette-panel.js +4 -4
- package/build/components/global-styles/color-palette-panel.js.map +1 -1
- package/build/components/global-styles/gradients-palette-panel.js +71 -0
- package/build/components/global-styles/gradients-palette-panel.js.map +1 -0
- package/build/components/global-styles/hooks.js +5 -5
- package/build/components/global-styles/hooks.js.map +1 -1
- package/build/components/global-styles/palette.js +11 -5
- package/build/components/global-styles/palette.js.map +1 -1
- package/build/components/global-styles/screen-background-color.js +3 -1
- package/build/components/global-styles/screen-background-color.js.map +1 -1
- package/build/components/global-styles/screen-color-palette.js +23 -3
- package/build/components/global-styles/screen-color-palette.js.map +1 -1
- package/build/components/global-styles/screen-link-color.js +3 -1
- package/build/components/global-styles/screen-link-color.js.map +1 -1
- package/build/components/global-styles/screen-text-color.js +3 -1
- package/build/components/global-styles/screen-text-color.js.map +1 -1
- package/build/components/global-styles/screen-typography-element.js +54 -0
- package/build/components/global-styles/screen-typography-element.js.map +1 -0
- package/build/components/global-styles/screen-typography.js +74 -6
- package/build/components/global-styles/screen-typography.js.map +1 -1
- package/build/components/global-styles/typography-panel.js +28 -8
- package/build/components/global-styles/typography-panel.js.map +1 -1
- package/build/components/global-styles/ui.js +12 -0
- package/build/components/global-styles/ui.js.map +1 -1
- package/build/components/global-styles/use-global-styles-output.js +2 -2
- package/build/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build/components/global-styles/utils.js +1 -1
- package/build/components/global-styles/utils.js.map +1 -1
- package/build/components/list/actions/index.js +104 -0
- package/build/components/list/actions/index.js.map +1 -0
- package/build/components/list/actions/rename-menu-item.js +112 -0
- package/build/components/list/actions/rename-menu-item.js.map +1 -0
- package/build/components/list/added-by.js +180 -0
- package/build/components/list/added-by.js.map +1 -0
- package/build/components/list/index.js +18 -3
- package/build/components/list/index.js.map +1 -1
- package/build/components/list/table.js +58 -67
- package/build/components/list/table.js.map +1 -1
- package/build/components/navigation-sidebar/index.js +12 -11
- package/build/components/navigation-sidebar/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-panel/index.js +28 -11
- package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build/components/navigation-sidebar/navigation-toggle/index.js +14 -5
- package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build/components/template-details/edit-template-title.js +33 -0
- package/build/components/template-details/edit-template-title.js.map +1 -0
- package/build/components/template-details/index.js +6 -2
- package/build/components/template-details/index.js.map +1 -1
- package/build/components/template-details/template-areas.js +1 -1
- package/build/components/template-details/template-areas.js.map +1 -1
- package/build/index.js +8 -2
- package/build/index.js.map +1 -1
- package/build/store/actions.js +47 -18
- package/build/store/actions.js.map +1 -1
- package/build/store/selectors.js +25 -5
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/add-new-template/new-template-part.js +30 -16
- package/build-module/components/add-new-template/new-template-part.js.map +1 -1
- package/build-module/components/add-new-template/new-template.js +40 -23
- package/build-module/components/add-new-template/new-template.js.map +1 -1
- package/build-module/components/block-editor/index.js +2 -1
- package/build-module/components/block-editor/index.js.map +1 -1
- package/build-module/components/global-styles/color-palette-panel.js +5 -5
- package/build-module/components/global-styles/color-palette-panel.js.map +1 -1
- package/build-module/components/global-styles/gradients-palette-panel.js +60 -0
- package/build-module/components/global-styles/gradients-palette-panel.js.map +1 -0
- package/build-module/components/global-styles/hooks.js +5 -5
- package/build-module/components/global-styles/hooks.js.map +1 -1
- package/build-module/components/global-styles/palette.js +12 -5
- package/build-module/components/global-styles/palette.js.map +1 -1
- package/build-module/components/global-styles/screen-background-color.js +3 -1
- package/build-module/components/global-styles/screen-background-color.js.map +1 -1
- package/build-module/components/global-styles/screen-color-palette.js +22 -3
- package/build-module/components/global-styles/screen-color-palette.js.map +1 -1
- package/build-module/components/global-styles/screen-link-color.js +3 -1
- package/build-module/components/global-styles/screen-link-color.js.map +1 -1
- package/build-module/components/global-styles/screen-text-color.js +3 -1
- package/build-module/components/global-styles/screen-text-color.js.map +1 -1
- package/build-module/components/global-styles/screen-typography-element.js +41 -0
- package/build-module/components/global-styles/screen-typography-element.js.map +1 -0
- package/build-module/components/global-styles/screen-typography.js +70 -6
- package/build-module/components/global-styles/screen-typography.js.map +1 -1
- package/build-module/components/global-styles/typography-panel.js +28 -8
- package/build-module/components/global-styles/typography-panel.js.map +1 -1
- package/build-module/components/global-styles/ui.js +11 -0
- package/build-module/components/global-styles/ui.js.map +1 -1
- package/build-module/components/global-styles/use-global-styles-output.js +2 -2
- package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
- package/build-module/components/global-styles/utils.js +1 -1
- package/build-module/components/global-styles/utils.js.map +1 -1
- package/build-module/components/list/actions/index.js +85 -0
- package/build-module/components/list/actions/index.js.map +1 -0
- package/build-module/components/list/actions/rename-menu-item.js +101 -0
- package/build-module/components/list/actions/rename-menu-item.js.map +1 -0
- package/build-module/components/list/added-by.js +166 -0
- package/build-module/components/list/added-by.js.map +1 -0
- package/build-module/components/list/index.js +15 -3
- package/build-module/components/list/index.js.map +1 -1
- package/build-module/components/list/table.js +60 -69
- package/build-module/components/list/table.js.map +1 -1
- package/build-module/components/navigation-sidebar/index.js +11 -12
- package/build-module/components/navigation-sidebar/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-panel/index.js +26 -12
- package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js +14 -6
- package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
- package/build-module/components/template-details/edit-template-title.js +23 -0
- package/build-module/components/template-details/edit-template-title.js.map +1 -0
- package/build-module/components/template-details/index.js +5 -2
- package/build-module/components/template-details/index.js.map +1 -1
- package/build-module/components/template-details/template-areas.js +1 -1
- package/build-module/components/template-details/template-areas.js.map +1 -1
- package/build-module/index.js +8 -3
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +48 -19
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/selectors.js +21 -3
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +146 -21
- package/build-style/style.css +146 -21
- package/package.json +10 -8
- package/src/components/add-new-template/new-template-part.js +32 -17
- package/src/components/add-new-template/new-template.js +39 -19
- package/src/components/block-editor/index.js +2 -0
- package/src/components/global-styles/color-palette-panel.js +5 -5
- package/src/components/global-styles/gradients-palette-panel.js +99 -0
- package/src/components/global-styles/hooks.js +4 -4
- package/src/components/global-styles/palette.js +30 -10
- package/src/components/global-styles/screen-background-color.js +2 -0
- package/src/components/global-styles/screen-color-palette.js +30 -3
- package/src/components/global-styles/screen-link-color.js +2 -0
- package/src/components/global-styles/screen-text-color.js +2 -0
- package/src/components/global-styles/screen-typography-element.js +39 -0
- package/src/components/global-styles/screen-typography.js +84 -3
- package/src/components/global-styles/style.scss +45 -6
- package/src/components/global-styles/test/use-global-styles-output.js +1 -1
- package/src/components/global-styles/test/utils.js +1 -1
- package/src/components/global-styles/typography-panel.js +37 -7
- package/src/components/global-styles/ui.js +9 -0
- package/src/components/global-styles/use-global-styles-output.js +2 -2
- package/src/components/global-styles/utils.js +1 -1
- package/src/components/list/actions/index.js +95 -0
- package/src/components/list/actions/rename-menu-item.js +134 -0
- package/src/components/list/added-by.js +179 -0
- package/src/components/list/index.js +27 -11
- package/src/components/list/style.scss +106 -11
- package/src/components/list/table.js +65 -75
- package/src/components/navigation-sidebar/index.js +9 -16
- package/src/components/navigation-sidebar/navigation-panel/index.js +25 -9
- package/src/components/navigation-sidebar/navigation-toggle/index.js +29 -17
- package/src/components/navigation-sidebar/navigation-toggle/test/index.js +2 -0
- package/src/components/sidebar/style.scss +2 -1
- package/src/components/template-details/edit-template-title.js +28 -0
- package/src/components/template-details/index.js +13 -8
- package/src/components/template-details/template-areas.js +1 -1
- package/src/index.js +10 -2
- package/src/store/actions.js +82 -34
- package/src/store/selectors.js +22 -4
- package/src/store/test/actions.js +0 -24
- package/src/store/test/selectors.js +24 -0
|
@@ -62,7 +62,7 @@ function findInPresetsBy(features, blockName, presetPath, presetProperty, preset
|
|
|
62
62
|
for (const presetByOrigin of orderedPresetsByOrigin) {
|
|
63
63
|
if (presetByOrigin) {
|
|
64
64
|
// Preset origins ordered by priority.
|
|
65
|
-
const origins = ['
|
|
65
|
+
const origins = ['custom', 'theme', 'default'];
|
|
66
66
|
|
|
67
67
|
for (const origin of origins) {
|
|
68
68
|
const presets = presetByOrigin[origin];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/utils.js"],"names":["get","find","isString","ROOT_BLOCK_NAME","ROOT_BLOCK_SELECTOR","ROOT_BLOCK_SUPPORTS","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","STYLE_PATH_TO_CSS_VAR_INFIX","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","presetByOrigin","origins","origin","presets","presetObject","preset","highestPresetObjectWithSameSlug","slug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","split","endsWith","type"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,IAAd,EAAoBC,QAApB,QAAoC,QAApC;AAEA;;AACA,OAAO,MAAMC,eAAe,GAAG,MAAxB;AACP,OAAO,MAAMC,mBAAmB,GAAG,MAA5B;AACP,OAAO,MAAMC,mBAAmB,GAAG,CAClC,YADkC,EAElC,iBAFkC,E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CAClBU,KADU,CACHJ,kBAAkB,CAACK,MADhB,EACwB,CAACJ,kBAAkB,CAACI,MAD5C,EAEVC,KAFU,CAEH,IAFG,CAAZ;AAGA,GAPM,MAOA;AACN;AACA,WAAOZ,QAAP;AACA;;AAED,QAAM,CAAEc,IAAF,EAAQ,GAAG1C,IAAX,IAAoBoC,SAA1B;;AACA,MAAKM,IAAI,KAAK,QAAd,EAAyB;AACxB,WAAOf,0BAA0B,CAChCnB,QADgC,EAEhCC,SAFgC,EAGhCmB,QAHgC,EAIhC5B,IAJgC,CAAjC;AAMA;;AACD,MAAK0C,IAAI,KAAK,QAAd,EAAyB;AACxB,WAAOV,0BAA0B,CAChCxB,QADgC,EAEhCC,SAFgC,EAGhCmB,QAHgC,EAIhC5B,IAJgC,CAAjC;AAMA;;AACD,SAAO4B,QAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, find, isString } from 'lodash';\n\n/* Supporting data */\nexport const ROOT_BLOCK_NAME = 'root';\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_BLOCK_SUPPORTS = [\n\t'background',\n\t'backgroundColor',\n\t'color',\n\t'linkColor',\n\t'fontFamily',\n\t'fontSize',\n\t'fontStyle',\n\t'fontWeight',\n\t'lineHeight',\n\t'textDecoration',\n\t'textTransform',\n\t'padding',\n];\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n];\n\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tget( features, [ 'blocks', blockName, ...presetPath ] ),\n\t\tget( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'user', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = find(\n\t\t\t\t\t\tpresets,\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = find( PRESET_METADATA, [ 'cssVarInfix', cssVarInfix ] );\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = find( PRESET_METADATA, [ 'cssVarInfix', presetType ] );\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tget( features, [ 'blocks', blockName, 'custom', ...path ] ) ??\n\t\tget( features, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || ! isString( variable ) ) {\n\t\treturn variable;\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/global-styles/utils.js"],"names":["get","find","isString","ROOT_BLOCK_NAME","ROOT_BLOCK_SELECTOR","ROOT_BLOCK_SUPPORTS","PRESET_METADATA","path","valueKey","cssVarInfix","classes","classSuffix","propertyName","STYLE_PATH_TO_CSS_VAR_INFIX","findInPresetsBy","features","blockName","presetPath","presetProperty","presetValueValue","orderedPresetsByOrigin","presetByOrigin","origins","origin","presets","presetObject","preset","highestPresetObjectWithSameSlug","slug","undefined","getPresetVariableFromValue","variableStylePath","presetPropertyValue","metadata","getValueFromPresetVariable","variable","presetType","result","getValueFromVariable","getValueFromCustomVariable","USER_VALUE_PREFIX","THEME_VALUE_PREFIX","THEME_VALUE_SUFFIX","parsedVar","startsWith","slice","length","split","endsWith","type"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,GAAT,EAAcC,IAAd,EAAoBC,QAApB,QAAoC,QAApC;AAEA;;AACA,OAAO,MAAMC,eAAe,GAAG,MAAxB;AACP,OAAO,MAAMC,mBAAmB,GAAG,MAA5B;AACP,OAAO,MAAMC,mBAAmB,GAAG,CAClC,YADkC,EAElC,iBAFkC,EAGlC,OAHkC,EAIlC,WAJkC,EAKlC,YALkC,EAMlC,UANkC,EAOlC,WAPkC,EAQlC,YARkC,EASlC,YATkC,EAUlC,gBAVkC,EAWlC,eAXkC,EAYlC,SAZkC,CAA5B;AAeP,OAAO,MAAMC,eAAe,GAAG,CAC9B;AACCC,EAAAA,IAAI,EAAE,CAAE,OAAF,EAAW,SAAX,CADP;AAECC,EAAAA,QAAQ,EAAE,OAFX;AAGCC,EAAAA,WAAW,EAAE,OAHd;AAICC,EAAAA,OAAO,EAAE,CACR;AAAEC,IAAAA,WAAW,EAAE,OAAf;AAAwBC,IAAAA,YAAY,EAAE;AAAtC,GADQ,EAER;AACCD,IAAAA,WAAW,EAAE,kBADd;AAECC,IAAAA,YAAY,EAAE;AAFf,GA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gC,CAAjC;AAMA;;AACD,SAAO4B,QAAP;AACA","sourcesContent":["/**\n * External dependencies\n */\nimport { get, find, isString } from 'lodash';\n\n/* Supporting data */\nexport const ROOT_BLOCK_NAME = 'root';\nexport const ROOT_BLOCK_SELECTOR = 'body';\nexport const ROOT_BLOCK_SUPPORTS = [\n\t'background',\n\t'backgroundColor',\n\t'color',\n\t'linkColor',\n\t'fontFamily',\n\t'fontSize',\n\t'fontStyle',\n\t'fontWeight',\n\t'lineHeight',\n\t'textDecoration',\n\t'textTransform',\n\t'padding',\n];\n\nexport const PRESET_METADATA = [\n\t{\n\t\tpath: [ 'color', 'palette' ],\n\t\tvalueKey: 'color',\n\t\tcssVarInfix: 'color',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'color', propertyName: 'color' },\n\t\t\t{\n\t\t\t\tclassSuffix: 'background-color',\n\t\t\t\tpropertyName: 'background-color',\n\t\t\t},\n\t\t\t{\n\t\t\t\tclassSuffix: 'border-color',\n\t\t\t\tpropertyName: 'border-color',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'color', 'gradients' ],\n\t\tvalueKey: 'gradient',\n\t\tcssVarInfix: 'gradient',\n\t\tclasses: [\n\t\t\t{\n\t\t\t\tclassSuffix: 'gradient-background',\n\t\t\t\tpropertyName: 'background',\n\t\t\t},\n\t\t],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontSizes' ],\n\t\tvalueKey: 'size',\n\t\tcssVarInfix: 'font-size',\n\t\tclasses: [ { classSuffix: 'font-size', propertyName: 'font-size' } ],\n\t},\n\t{\n\t\tpath: [ 'typography', 'fontFamilies' ],\n\t\tvalueKey: 'fontFamily',\n\t\tcssVarInfix: 'font-family',\n\t\tclasses: [\n\t\t\t{ classSuffix: 'font-family', propertyName: 'font-family' },\n\t\t],\n\t},\n];\n\nconst STYLE_PATH_TO_CSS_VAR_INFIX = {\n\t'color.background': 'color',\n\t'color.text': 'color',\n\t'elements.link.color.text': 'color',\n\t'color.gradient': 'gradient',\n\t'typography.fontSize': 'font-size',\n\t'typography.fontFamily': 'font-family',\n};\n\nfunction findInPresetsBy(\n\tfeatures,\n\tblockName,\n\tpresetPath,\n\tpresetProperty,\n\tpresetValueValue\n) {\n\t// Block presets take priority above root level presets.\n\tconst orderedPresetsByOrigin = [\n\t\tget( features, [ 'blocks', blockName, ...presetPath ] ),\n\t\tget( features, presetPath ),\n\t];\n\n\tfor ( const presetByOrigin of orderedPresetsByOrigin ) {\n\t\tif ( presetByOrigin ) {\n\t\t\t// Preset origins ordered by priority.\n\t\t\tconst origins = [ 'custom', 'theme', 'default' ];\n\t\t\tfor ( const origin of origins ) {\n\t\t\t\tconst presets = presetByOrigin[ origin ];\n\t\t\t\tif ( presets ) {\n\t\t\t\t\tconst presetObject = find(\n\t\t\t\t\t\tpresets,\n\t\t\t\t\t\t( preset ) =>\n\t\t\t\t\t\t\tpreset[ presetProperty ] === presetValueValue\n\t\t\t\t\t);\n\t\t\t\t\tif ( presetObject ) {\n\t\t\t\t\t\tif ( presetProperty === 'slug' ) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// if there is a highest priority preset with the same slug but different value the preset we found was overwritten and should be ignored.\n\t\t\t\t\t\tconst highestPresetObjectWithSameSlug = findInPresetsBy(\n\t\t\t\t\t\t\tfeatures,\n\t\t\t\t\t\t\tblockName,\n\t\t\t\t\t\t\tpresetPath,\n\t\t\t\t\t\t\t'slug',\n\t\t\t\t\t\t\tpresetObject.slug\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\thighestPresetObjectWithSameSlug[\n\t\t\t\t\t\t\t\tpresetProperty\n\t\t\t\t\t\t\t] === presetObject[ presetProperty ]\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\treturn presetObject;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function getPresetVariableFromValue(\n\tfeatures,\n\tblockName,\n\tvariableStylePath,\n\tpresetPropertyValue\n) {\n\tif ( ! presetPropertyValue ) {\n\t\treturn presetPropertyValue;\n\t}\n\n\tconst cssVarInfix = STYLE_PATH_TO_CSS_VAR_INFIX[ variableStylePath ];\n\n\tconst metadata = find( PRESET_METADATA, [ 'cssVarInfix', cssVarInfix ] );\n\n\tif ( ! metadata ) {\n\t\t// The property doesn't have preset data\n\t\t// so the value should be returned as it is.\n\t\treturn presetPropertyValue;\n\t}\n\tconst { valueKey, path } = metadata;\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tpath,\n\t\tvalueKey,\n\t\tpresetPropertyValue\n\t);\n\n\tif ( ! presetObject ) {\n\t\t// Value wasn't found in the presets,\n\t\t// so it must be a custom value.\n\t\treturn presetPropertyValue;\n\t}\n\n\treturn `var:preset|${ cssVarInfix }|${ presetObject.slug }`;\n}\n\nfunction getValueFromPresetVariable(\n\tfeatures,\n\tblockName,\n\tvariable,\n\t[ presetType, slug ]\n) {\n\tconst metadata = find( PRESET_METADATA, [ 'cssVarInfix', presetType ] );\n\tif ( ! metadata ) {\n\t\treturn variable;\n\t}\n\n\tconst presetObject = findInPresetsBy(\n\t\tfeatures,\n\t\tblockName,\n\t\tmetadata.path,\n\t\t'slug',\n\t\tslug\n\t);\n\n\tif ( presetObject ) {\n\t\tconst { valueKey } = metadata;\n\t\tconst result = presetObject[ valueKey ];\n\t\treturn getValueFromVariable( features, blockName, result );\n\t}\n\n\treturn variable;\n}\n\nfunction getValueFromCustomVariable( features, blockName, variable, path ) {\n\tconst result =\n\t\tget( features, [ 'blocks', blockName, 'custom', ...path ] ) ??\n\t\tget( features, [ 'custom', ...path ] );\n\tif ( ! result ) {\n\t\treturn variable;\n\t}\n\t// A variable may reference another variable so we need recursion until we find the value.\n\treturn getValueFromVariable( features, blockName, result );\n}\n\nexport function getValueFromVariable( features, blockName, variable ) {\n\tif ( ! variable || ! isString( variable ) ) {\n\t\treturn variable;\n\t}\n\tconst USER_VALUE_PREFIX = 'var:';\n\tconst THEME_VALUE_PREFIX = 'var(--wp--';\n\tconst THEME_VALUE_SUFFIX = ')';\n\n\tlet parsedVar;\n\n\tif ( variable.startsWith( USER_VALUE_PREFIX ) ) {\n\t\tparsedVar = variable.slice( USER_VALUE_PREFIX.length ).split( '|' );\n\t} else if (\n\t\tvariable.startsWith( THEME_VALUE_PREFIX ) &&\n\t\tvariable.endsWith( THEME_VALUE_SUFFIX )\n\t) {\n\t\tparsedVar = variable\n\t\t\t.slice( THEME_VALUE_PREFIX.length, -THEME_VALUE_SUFFIX.length )\n\t\t\t.split( '--' );\n\t} else {\n\t\t// We don't know how to parse the value: either is raw of uses complex CSS such as `calc(1px * var(--wp--variable) )`\n\t\treturn variable;\n\t}\n\n\tconst [ type, ...path ] = parsedVar;\n\tif ( type === 'preset' ) {\n\t\treturn getValueFromPresetVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\tif ( type === 'custom' ) {\n\t\treturn getValueFromCustomVariable(\n\t\t\tfeatures,\n\t\t\tblockName,\n\t\t\tvariable,\n\t\t\tpath\n\t\t);\n\t}\n\treturn variable;\n}\n"]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { useDispatch } from '@wordpress/data';
|
|
7
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
8
|
+
import { __ } from '@wordpress/i18n';
|
|
9
|
+
import { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';
|
|
10
|
+
import { moreVertical } from '@wordpress/icons';
|
|
11
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { store as editSiteStore } from '../../../store';
|
|
17
|
+
import isTemplateRemovable from '../../../utils/is-template-removable';
|
|
18
|
+
import isTemplateRevertable from '../../../utils/is-template-revertable';
|
|
19
|
+
import RenameMenuItem from './rename-menu-item';
|
|
20
|
+
export default function Actions(_ref) {
|
|
21
|
+
let {
|
|
22
|
+
template
|
|
23
|
+
} = _ref;
|
|
24
|
+
const {
|
|
25
|
+
removeTemplate,
|
|
26
|
+
revertTemplate
|
|
27
|
+
} = useDispatch(editSiteStore);
|
|
28
|
+
const {
|
|
29
|
+
saveEditedEntityRecord
|
|
30
|
+
} = useDispatch(coreStore);
|
|
31
|
+
const {
|
|
32
|
+
createSuccessNotice,
|
|
33
|
+
createErrorNotice
|
|
34
|
+
} = useDispatch(noticesStore);
|
|
35
|
+
const isRemovable = isTemplateRemovable(template);
|
|
36
|
+
const isRevertable = isTemplateRevertable(template);
|
|
37
|
+
|
|
38
|
+
if (!isRemovable && !isRevertable) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function revertAndSaveTemplate() {
|
|
43
|
+
try {
|
|
44
|
+
await revertTemplate(template, {
|
|
45
|
+
allowUndo: false
|
|
46
|
+
});
|
|
47
|
+
await saveEditedEntityRecord('postType', template.type, template.id);
|
|
48
|
+
createSuccessNotice(__('Template reverted.'), {
|
|
49
|
+
type: 'snackbar'
|
|
50
|
+
});
|
|
51
|
+
} catch (error) {
|
|
52
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while reverting the template.');
|
|
53
|
+
createErrorNotice(errorMessage, {
|
|
54
|
+
type: 'snackbar'
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return createElement(DropdownMenu, {
|
|
60
|
+
icon: moreVertical,
|
|
61
|
+
label: __('Actions'),
|
|
62
|
+
className: "edit-site-list-table__actions"
|
|
63
|
+
}, _ref2 => {
|
|
64
|
+
let {
|
|
65
|
+
onClose
|
|
66
|
+
} = _ref2;
|
|
67
|
+
return createElement(MenuGroup, null, isRemovable && createElement(Fragment, null, createElement(RenameMenuItem, {
|
|
68
|
+
template: template,
|
|
69
|
+
onClose: onClose
|
|
70
|
+
}), createElement(MenuItem, {
|
|
71
|
+
isDestructive: true,
|
|
72
|
+
onClick: () => {
|
|
73
|
+
removeTemplate(template);
|
|
74
|
+
onClose();
|
|
75
|
+
}
|
|
76
|
+
}, __('Delete template'))), isRevertable && createElement(MenuItem, {
|
|
77
|
+
info: __('Restore template to default state'),
|
|
78
|
+
onClick: () => {
|
|
79
|
+
revertAndSaveTemplate();
|
|
80
|
+
onClose();
|
|
81
|
+
}
|
|
82
|
+
}, __('Clear customizations')));
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/actions/index.js"],"names":["useDispatch","store","coreStore","__","DropdownMenu","MenuGroup","MenuItem","moreVertical","noticesStore","editSiteStore","isTemplateRemovable","isTemplateRevertable","RenameMenuItem","Actions","template","removeTemplate","revertTemplate","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","isRemovable","isRevertable","revertAndSaveTemplate","allowUndo","type","id","error","errorMessage","message","code","onClose"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,WAAT,QAA4B,iBAA5B;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,YAAT,EAAuBC,SAAvB,EAAkCC,QAAlC,QAAkD,uBAAlD;AACA,SAASC,YAAT,QAA6B,kBAA7B;AACA,SAASN,KAAK,IAAIO,YAAlB,QAAsC,oBAAtC;AAEA;AACA;AACA;;AACA,SAASP,KAAK,IAAIQ,aAAlB,QAAuC,gBAAvC;AACA,OAAOC,mBAAP,MAAgC,sCAAhC;AACA,OAAOC,oBAAP,MAAiC,uCAAjC;AACA,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AGJ,EAAE,CAAE,SAAF,CAFX;AAGC,IAAA,SAAS,EAAC;AAHX,KAKG;AAAA,QAAE;AAAE2B,MAAAA;AAAF,KAAF;AAAA,WACD,cAAC,SAAD,QACGV,WAAW,IACZ,8BACC,cAAC,cAAD;AACC,MAAA,QAAQ,EAAGN,QADZ;AAEC,MAAA,OAAO,EAAGgB;AAFX,MADD,EAKC,cAAC,QAAD;AACC,MAAA,aAAa,MADd;AAEC,MAAA,OAAO,EAAG,MAAM;AACff,QAAAA,cAAc,CAAED,QAAF,CAAd;AACAgB,QAAAA,OAAO;AACP;AALF,OAOG3B,EAAE,CAAE,iBAAF,CAPL,CALD,CAFF,EAkBGkB,YAAY,IACb,cAAC,QAAD;AACC,MAAA,IAAI,EAAGlB,EAAE,CAAE,mCAAF,CADV;AAEC,MAAA,OAAO,EAAG,MAAM;AACfmB,QAAAA,qBAAqB;AACrBQ,QAAAA,OAAO;AACP;AALF,OAOG3B,EAAE,CAAE,sBAAF,CAPL,CAnBF,CADC;AAAA,GALH,CADD;AAwCA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { DropdownMenu, MenuGroup, MenuItem } from '@wordpress/components';\nimport { moreVertical } from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\nimport { store as editSiteStore } from '../../../store';\nimport isTemplateRemovable from '../../../utils/is-template-removable';\nimport isTemplateRevertable from '../../../utils/is-template-revertable';\nimport RenameMenuItem from './rename-menu-item';\n\nexport default function Actions( { template } ) {\n\tconst { removeTemplate, revertTemplate } = useDispatch( editSiteStore );\n\tconst { saveEditedEntityRecord } = useDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } = useDispatch(\n\t\tnoticesStore\n\t);\n\n\tconst isRemovable = isTemplateRemovable( template );\n\tconst isRevertable = isTemplateRevertable( template );\n\n\tif ( ! isRemovable && ! isRevertable ) {\n\t\treturn null;\n\t}\n\n\tasync function revertAndSaveTemplate() {\n\t\ttry {\n\t\t\tawait revertTemplate( template, { allowUndo: false } );\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\n\t\t\tcreateSuccessNotice( __( 'Template reverted.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while reverting the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<DropdownMenu\n\t\t\ticon={ moreVertical }\n\t\t\tlabel={ __( 'Actions' ) }\n\t\t\tclassName=\"edit-site-list-table__actions\"\n\t\t>\n\t\t\t{ ( { onClose } ) => (\n\t\t\t\t<MenuGroup>\n\t\t\t\t\t{ isRemovable && (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<RenameMenuItem\n\t\t\t\t\t\t\t\ttemplate={ template }\n\t\t\t\t\t\t\t\tonClose={ onClose }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\tisDestructive\n\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\tremoveTemplate( template );\n\t\t\t\t\t\t\t\t\tonClose();\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\t{ __( 'Delete template' ) }\n\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) }\n\t\t\t\t\t{ isRevertable && (\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tinfo={ __( 'Restore template to default state' ) }\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\trevertAndSaveTemplate();\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Clear customizations' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t) }\n\t\t\t\t</MenuGroup>\n\t\t\t) }\n\t\t</DropdownMenu>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { createElement, Fragment } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WordPress dependencies
|
|
5
|
+
*/
|
|
6
|
+
import { __ } from '@wordpress/i18n';
|
|
7
|
+
import { useState } from '@wordpress/element';
|
|
8
|
+
import { useDispatch, useSelect } from '@wordpress/data';
|
|
9
|
+
import { Button, Flex, FlexItem, MenuItem, Modal, TextControl } from '@wordpress/components';
|
|
10
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
11
|
+
import { store as noticesStore } from '@wordpress/notices';
|
|
12
|
+
export default function RenameMenuItem(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
template,
|
|
15
|
+
onClose
|
|
16
|
+
} = _ref;
|
|
17
|
+
const [title, setTitle] = useState(() => template.title.rendered);
|
|
18
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
19
|
+
const {
|
|
20
|
+
getLastEntitySaveError
|
|
21
|
+
} = useSelect(coreStore);
|
|
22
|
+
const {
|
|
23
|
+
editEntityRecord,
|
|
24
|
+
saveEditedEntityRecord
|
|
25
|
+
} = useDispatch(coreStore);
|
|
26
|
+
const {
|
|
27
|
+
createSuccessNotice,
|
|
28
|
+
createErrorNotice
|
|
29
|
+
} = useDispatch(noticesStore);
|
|
30
|
+
|
|
31
|
+
if (!template.is_custom) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function onTemplateRename(event) {
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
await editEntityRecord('postType', template.type, template.id, {
|
|
40
|
+
title
|
|
41
|
+
}); // Update state before saving rerenders the list.
|
|
42
|
+
|
|
43
|
+
setTitle('');
|
|
44
|
+
setIsModalOpen(false);
|
|
45
|
+
onClose(); // Persist edited entity.
|
|
46
|
+
|
|
47
|
+
await saveEditedEntityRecord('postType', template.type, template.id);
|
|
48
|
+
const lastError = getLastEntitySaveError('postType', template.type, template.id);
|
|
49
|
+
|
|
50
|
+
if (lastError) {
|
|
51
|
+
throw lastError;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
createSuccessNotice(__('Template has been renamed.'), {
|
|
55
|
+
type: 'snackbar'
|
|
56
|
+
});
|
|
57
|
+
} catch (error) {
|
|
58
|
+
const errorMessage = error.message && error.code !== 'unknown_error' ? error.message : __('An error occurred while renaming the template.');
|
|
59
|
+
createErrorNotice(errorMessage, {
|
|
60
|
+
type: 'snackbar'
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return createElement(Fragment, null, createElement(MenuItem, {
|
|
66
|
+
onClick: () => {
|
|
67
|
+
setIsModalOpen(true);
|
|
68
|
+
setTitle(template.title.rendered);
|
|
69
|
+
}
|
|
70
|
+
}, __('Rename')), isModalOpen && createElement(Modal, {
|
|
71
|
+
title: __('Rename template'),
|
|
72
|
+
closeLabel: __('Close'),
|
|
73
|
+
onRequestClose: () => {
|
|
74
|
+
setIsModalOpen(false);
|
|
75
|
+
},
|
|
76
|
+
overlayClassName: "edit-site-list__rename-modal"
|
|
77
|
+
}, createElement("form", {
|
|
78
|
+
onSubmit: onTemplateRename
|
|
79
|
+
}, createElement(Flex, {
|
|
80
|
+
align: "flex-start",
|
|
81
|
+
gap: 8
|
|
82
|
+
}, createElement(FlexItem, null, createElement(TextControl, {
|
|
83
|
+
label: __('Name'),
|
|
84
|
+
value: title,
|
|
85
|
+
onChange: setTitle,
|
|
86
|
+
required: true
|
|
87
|
+
}))), createElement(Flex, {
|
|
88
|
+
className: "edit-site-list__rename-modal-actions",
|
|
89
|
+
justify: "flex-end",
|
|
90
|
+
expanded: false
|
|
91
|
+
}, createElement(FlexItem, null, createElement(Button, {
|
|
92
|
+
variant: "tertiary",
|
|
93
|
+
onClick: () => {
|
|
94
|
+
setIsModalOpen(false);
|
|
95
|
+
}
|
|
96
|
+
}, __('Cancel'))), createElement(FlexItem, null, createElement(Button, {
|
|
97
|
+
variant: "primary",
|
|
98
|
+
type: "submit"
|
|
99
|
+
}, __('Save')))))));
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=rename-menu-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/actions/rename-menu-item.js"],"names":["__","useState","useDispatch","useSelect","Button","Flex","FlexItem","MenuItem","Modal","TextControl","store","coreStore","noticesStore","RenameMenuItem","template","onClose","title","setTitle","rendered","isModalOpen","setIsModalOpen","getLastEntitySaveError","editEntityRecord","saveEditedEntityRecord","createSuccessNotice","createErrorNotice","is_custom","onTemplateRename","event","preventDefault","type","id","lastError","error","errorMessage","message","code"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,EAAT,QAAmB,iBAAnB;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,WAAT,EAAsBC,SAAtB,QAAuC,iBAAvC;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,QAHD,EAICC,QAJD,EAKCC,KALD,EAMCC,WAND,QAOO,uBAPP;AAQA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASD,KAAK,IAAIE,YAAlB,QAAsC,oBAAtC;AAEA,eAAe,SAASC,cAAT,OAAiD;AAAA,MAAxB;AAAEC,IAAAA,QAAF;AAAYC,IAAAA;AAAZ,GAAwB;AAC/D,QAAM,CAAEC,KAAF,EAASC,QAAT,IAAsBhB,QAAQ,CAAE,MAAMa,QAAQ,CAACE,KAAT,CAAeE,QAAvB,CAApC;AACA,QAAM,CAAEC,WAAF,EAAe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cAAC,MAAD;AAAQ,IAAA,OAAO,EAAC,SAAhB;AAA0B,IAAA,IAAI,EAAC;AAA/B,KACGA,EAAE,CAAE,MAAF,CADL,CADD,CAfD,CAZD,CARD,CAVF,CADD;AAyDA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tFlex,\n\tFlexItem,\n\tMenuItem,\n\tModal,\n\tTextControl,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport default function RenameMenuItem( { template, onClose } ) {\n\tconst [ title, setTitle ] = useState( () => template.title.rendered );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\n\tconst { getLastEntitySaveError } = useSelect( coreStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } = useDispatch(\n\t\tcoreStore\n\t);\n\tconst { createSuccessNotice, createErrorNotice } = useDispatch(\n\t\tnoticesStore\n\t);\n\n\tif ( ! template.is_custom ) {\n\t\treturn null;\n\t}\n\n\tasync function onTemplateRename( event ) {\n\t\tevent.preventDefault();\n\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', template.type, template.id, {\n\t\t\t\ttitle,\n\t\t\t} );\n\n\t\t\t// Update state before saving rerenders the list.\n\t\t\tsetTitle( '' );\n\t\t\tsetIsModalOpen( false );\n\t\t\tonClose();\n\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\n\t\t\tconst lastError = getLastEntitySaveError(\n\t\t\t\t'postType',\n\t\t\t\ttemplate.type,\n\t\t\t\ttemplate.id\n\t\t\t);\n\n\t\t\tif ( lastError ) {\n\t\t\t\tthrow lastError;\n\t\t\t}\n\n\t\t\tcreateSuccessNotice( __( 'Template has been renamed.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror.message && error.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __( 'An error occurred while renaming the template.' );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t}\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem\n\t\t\t\tonClick={ () => {\n\t\t\t\t\tsetIsModalOpen( true );\n\t\t\t\t\tsetTitle( template.title.rendered );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t{ __( 'Rename' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Rename template' ) }\n\t\t\t\t\tcloseLabel={ __( 'Close' ) }\n\t\t\t\t\tonRequestClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\toverlayClassName=\"edit-site-list__rename-modal\"\n\t\t\t\t>\n\t\t\t\t\t<form onSubmit={ onTemplateRename }>\n\t\t\t\t\t\t<Flex align=\"flex-start\" gap={ 8 }>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<TextControl\n\t\t\t\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\t\t\t\trequired\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\n\t\t\t\t\t\t<Flex\n\t\t\t\t\t\t\tclassName=\"edit-site-list__rename-modal-actions\"\n\t\t\t\t\t\t\tjustify=\"flex-end\"\n\t\t\t\t\t\t\texpanded={ false }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t\t<FlexItem>\n\t\t\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t</FlexItem>\n\t\t\t\t\t\t</Flex>\n\t\t\t\t\t</form>\n\t\t\t\t</Modal>\n\t\t\t) }\n\t\t</>\n\t);\n}\n"]}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { createElement } from "@wordpress/element";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import classnames from 'classnames';
|
|
7
|
+
/**
|
|
8
|
+
* WordPress dependencies
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { __experimentalHStack as HStack, Icon, Tooltip } from '@wordpress/components';
|
|
12
|
+
import { store as coreStore } from '@wordpress/core-data';
|
|
13
|
+
import { useSelect } from '@wordpress/data';
|
|
14
|
+
import { useState } from '@wordpress/element';
|
|
15
|
+
import { layout as themeIcon, plugins as pluginIcon } from '@wordpress/icons';
|
|
16
|
+
import { __ } from '@wordpress/i18n';
|
|
17
|
+
const TEMPLATE_POST_TYPE_NAMES = ['wp_template', 'wp_template_part'];
|
|
18
|
+
|
|
19
|
+
function CustomizedTooltip(_ref) {
|
|
20
|
+
let {
|
|
21
|
+
isCustomized,
|
|
22
|
+
children
|
|
23
|
+
} = _ref;
|
|
24
|
+
|
|
25
|
+
if (!isCustomized) {
|
|
26
|
+
return children;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return createElement(Tooltip, {
|
|
30
|
+
text: __('This template has been customized')
|
|
31
|
+
}, children);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function AddedByTheme(_ref2) {
|
|
35
|
+
var _theme$name;
|
|
36
|
+
|
|
37
|
+
let {
|
|
38
|
+
slug,
|
|
39
|
+
isCustomized
|
|
40
|
+
} = _ref2;
|
|
41
|
+
const theme = useSelect(select => select(coreStore).getTheme(slug), [slug]);
|
|
42
|
+
return createElement(HStack, {
|
|
43
|
+
alignment: "left"
|
|
44
|
+
}, createElement(CustomizedTooltip, {
|
|
45
|
+
isCustomized: isCustomized
|
|
46
|
+
}, createElement("div", {
|
|
47
|
+
className: classnames('edit-site-list-added-by__icon', {
|
|
48
|
+
'is-customized': isCustomized
|
|
49
|
+
})
|
|
50
|
+
}, createElement(Icon, {
|
|
51
|
+
icon: themeIcon
|
|
52
|
+
}))), createElement("span", null, (theme === null || theme === void 0 ? void 0 : (_theme$name = theme.name) === null || _theme$name === void 0 ? void 0 : _theme$name.rendered) || slug));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function AddedByPlugin(_ref3) {
|
|
56
|
+
let {
|
|
57
|
+
slug,
|
|
58
|
+
isCustomized
|
|
59
|
+
} = _ref3;
|
|
60
|
+
const plugin = useSelect(select => select(coreStore).getPlugin(slug), [slug]);
|
|
61
|
+
return createElement(HStack, {
|
|
62
|
+
alignment: "left"
|
|
63
|
+
}, createElement(CustomizedTooltip, {
|
|
64
|
+
isCustomized: isCustomized
|
|
65
|
+
}, createElement("div", {
|
|
66
|
+
className: "edit-site-list-added-by__icon"
|
|
67
|
+
}, createElement(Icon, {
|
|
68
|
+
icon: pluginIcon
|
|
69
|
+
}))), createElement("span", null, (plugin === null || plugin === void 0 ? void 0 : plugin.name) || slug));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function AddedByAuthor(_ref4) {
|
|
73
|
+
let {
|
|
74
|
+
id
|
|
75
|
+
} = _ref4;
|
|
76
|
+
const user = useSelect(select => select(coreStore).getUser(id), [id]);
|
|
77
|
+
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
78
|
+
return createElement(HStack, {
|
|
79
|
+
alignment: "left"
|
|
80
|
+
}, createElement("div", {
|
|
81
|
+
className: classnames('edit-site-list-added-by__avatar', {
|
|
82
|
+
'is-loaded': isImageLoaded
|
|
83
|
+
})
|
|
84
|
+
}, createElement("img", {
|
|
85
|
+
onLoad: () => setIsImageLoaded(true),
|
|
86
|
+
alt: "",
|
|
87
|
+
src: user === null || user === void 0 ? void 0 : user.avatar_urls[48]
|
|
88
|
+
})), createElement("span", null, user === null || user === void 0 ? void 0 : user.nickname));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function AddedBySite() {
|
|
92
|
+
const {
|
|
93
|
+
name,
|
|
94
|
+
logoURL
|
|
95
|
+
} = useSelect(select => {
|
|
96
|
+
var _getMedia;
|
|
97
|
+
|
|
98
|
+
const {
|
|
99
|
+
getEntityRecord,
|
|
100
|
+
getMedia
|
|
101
|
+
} = select(coreStore);
|
|
102
|
+
const siteData = getEntityRecord('root', '__unstableBase');
|
|
103
|
+
return {
|
|
104
|
+
name: siteData.name,
|
|
105
|
+
logoURL: siteData !== null && siteData !== void 0 && siteData.site_logo ? (_getMedia = getMedia(siteData.site_logo)) === null || _getMedia === void 0 ? void 0 : _getMedia.source_url : undefined
|
|
106
|
+
};
|
|
107
|
+
}, []);
|
|
108
|
+
const [isImageLoaded, setIsImageLoaded] = useState(false);
|
|
109
|
+
return createElement(HStack, {
|
|
110
|
+
alignment: "left"
|
|
111
|
+
}, createElement("div", {
|
|
112
|
+
className: classnames('edit-site-list-added-by__avatar', {
|
|
113
|
+
'is-loaded': isImageLoaded
|
|
114
|
+
})
|
|
115
|
+
}, createElement("img", {
|
|
116
|
+
onLoad: () => setIsImageLoaded(true),
|
|
117
|
+
alt: "",
|
|
118
|
+
src: logoURL
|
|
119
|
+
})), createElement("span", null, name));
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export default function AddedBy(_ref5) {
|
|
123
|
+
let {
|
|
124
|
+
templateType,
|
|
125
|
+
template
|
|
126
|
+
} = _ref5;
|
|
127
|
+
|
|
128
|
+
if (!template) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (TEMPLATE_POST_TYPE_NAMES.includes(templateType)) {
|
|
133
|
+
// Template originally provided by a theme, but customized by a user.
|
|
134
|
+
// Templates originally didn't have the 'origin' field so identify
|
|
135
|
+
// older customized templates by checking for no origin and a 'theme'
|
|
136
|
+
// or 'custom' source.
|
|
137
|
+
if (template.has_theme_file && (template.origin === 'theme' || !template.origin && ['theme', 'custom'].includes(template.source))) {
|
|
138
|
+
return createElement(AddedByTheme, {
|
|
139
|
+
slug: template.theme,
|
|
140
|
+
isCustomized: template.source === 'custom'
|
|
141
|
+
});
|
|
142
|
+
} // Template originally provided by a plugin, but customized by a user.
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
if (template.has_theme_file && template.origin === 'plugin') {
|
|
146
|
+
return createElement(AddedByPlugin, {
|
|
147
|
+
slug: template.theme,
|
|
148
|
+
isCustomized: template.source === 'custom'
|
|
149
|
+
});
|
|
150
|
+
} // Template was created from scratch, but has no author. Author support
|
|
151
|
+
// was only added to templates in WordPress 5.9. Fallback to showing the
|
|
152
|
+
// site logo and title.
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
if (!template.has_theme_file && template.source === 'custom' && !template.author) {
|
|
156
|
+
return createElement(AddedBySite, null);
|
|
157
|
+
}
|
|
158
|
+
} // Simply show the author for templates created from scratch that have an
|
|
159
|
+
// author or for any other post type.
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
return createElement(AddedByAuthor, {
|
|
163
|
+
id: template.author
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=added-by.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/added-by.js"],"names":["classnames","__experimentalHStack","HStack","Icon","Tooltip","store","coreStore","useSelect","useState","layout","themeIcon","plugins","pluginIcon","__","TEMPLATE_POST_TYPE_NAMES","CustomizedTooltip","isCustomized","children","AddedByTheme","slug","theme","select","getTheme","name","rendered","AddedByPlugin","plugin","getPlugin","AddedByAuthor","id","user","getUser","isImageLoaded","setIsImageLoaded","avatar_urls","nickname","AddedBySite","logoURL","getEntityRecord","getMedia","siteData","site_logo","source_url","undefined","AddedBy","templateType","template","includes","has_theme_file","origin","source","author"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SACCC,oBAAoB,IAAIC,MADzB,EAECC,IAFD,EAGCC,OAHD,QAIO,uBAJP;AAKA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,QAAT,QAAyB,oBAAzB;AACA,SAASC,MAAM,IAAIC,SAAnB,EAA8BC,OAAO,IAAIC,UAAzC,QAA2D,kBAA3D;AACA,SAASC,EAAT,QAAmB,iBAAnB;AAEA,MAAMC,wBAAwB,GAAG,CAAE,aAAF,EAAiB,kBAAjB,CAAjC;;AAEA,SAASC,iBAAT,OAAyD;AAAA,MAA7B;AAAEC,IAAAA,YAAF;AAAgBC,IAAAA;AAAhB,GAA6B;;AACxD,MAAK,CAAED,YAAP,EAAsB;AACrB,WAAOC,QAAP;AACA;;AAED,SACC,cAAC,OAAD;AAAS,IAAA,IAAI,EAAGJ,EAAE,CAAE,mCAAF;AAAlB,KACGI,QADH,CADD;AAKA;;AAED,SAASC,YAAT,QAAgD;AAAA;;AAAA,MAAzB;AAAEC,IAAAA,IAAF;AAAQH,IAAAA;AAAR,GAAyB;AAC/C,QAAMI,KAAK,GAAGb,SAAS,CACpBc,MAAF,IAAcA,MAAM,CAAEf,SAAF,CAAN,CAAoBgB,QAApB,CAA8BH,IAA9B,CADQ,EAEtB,CAAEA,IAAF,CAFsB,CAAvB;AAK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* External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport {\n\t__experimentalHStack as HStack,\n\tIcon,\n\tTooltip,\n} from '@wordpress/components';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { layout as themeIcon, plugins as pluginIcon } from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\nconst TEMPLATE_POST_TYPE_NAMES = [ 'wp_template', 'wp_template_part' ];\n\nfunction CustomizedTooltip( { isCustomized, children } ) {\n\tif ( ! isCustomized ) {\n\t\treturn children;\n\t}\n\n\treturn (\n\t\t<Tooltip text={ __( 'This template has been customized' ) }>\n\t\t\t{ children }\n\t\t</Tooltip>\n\t);\n}\n\nfunction AddedByTheme( { slug, isCustomized } ) {\n\tconst theme = useSelect(\n\t\t( select ) => select( coreStore ).getTheme( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<CustomizedTooltip isCustomized={ isCustomized }>\n\t\t\t\t<div\n\t\t\t\t\tclassName={ classnames( 'edit-site-list-added-by__icon', {\n\t\t\t\t\t\t'is-customized': isCustomized,\n\t\t\t\t\t} ) }\n\t\t\t\t>\n\t\t\t\t\t<Icon icon={ themeIcon } />\n\t\t\t\t</div>\n\t\t\t</CustomizedTooltip>\n\t\t\t<span>{ theme?.name?.rendered || slug }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction AddedByPlugin( { slug, isCustomized } ) {\n\tconst plugin = useSelect(\n\t\t( select ) => select( coreStore ).getPlugin( slug ),\n\t\t[ slug ]\n\t);\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<CustomizedTooltip isCustomized={ isCustomized }>\n\t\t\t\t<div className=\"edit-site-list-added-by__icon\">\n\t\t\t\t\t<Icon icon={ pluginIcon } />\n\t\t\t\t</div>\n\t\t\t</CustomizedTooltip>\n\t\t\t<span>{ plugin?.name || slug }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction AddedByAuthor( { id } ) {\n\tconst user = useSelect( ( select ) => select( coreStore ).getUser( id ), [\n\t\tid,\n\t] );\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'edit-site-list-added-by__avatar', {\n\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<img\n\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\talt=\"\"\n\t\t\t\t\tsrc={ user?.avatar_urls[ 48 ] }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<span>{ user?.nickname }</span>\n\t\t</HStack>\n\t);\n}\n\nfunction AddedBySite() {\n\tconst { name, logoURL } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, getMedia } = select( coreStore );\n\t\tconst siteData = getEntityRecord( 'root', '__unstableBase' );\n\n\t\treturn {\n\t\t\tname: siteData.name,\n\t\t\tlogoURL: siteData?.site_logo\n\t\t\t\t? getMedia( siteData.site_logo )?.source_url\n\t\t\t\t: undefined,\n\t\t};\n\t}, [] );\n\tconst [ isImageLoaded, setIsImageLoaded ] = useState( false );\n\n\treturn (\n\t\t<HStack alignment=\"left\">\n\t\t\t<div\n\t\t\t\tclassName={ classnames( 'edit-site-list-added-by__avatar', {\n\t\t\t\t\t'is-loaded': isImageLoaded,\n\t\t\t\t} ) }\n\t\t\t>\n\t\t\t\t<img\n\t\t\t\t\tonLoad={ () => setIsImageLoaded( true ) }\n\t\t\t\t\talt=\"\"\n\t\t\t\t\tsrc={ logoURL }\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<span>{ name }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default function AddedBy( { templateType, template } ) {\n\tif ( ! template ) {\n\t\treturn;\n\t}\n\n\tif ( TEMPLATE_POST_TYPE_NAMES.includes( templateType ) ) {\n\t\t// Template originally provided by a theme, but customized by a user.\n\t\t// Templates originally didn't have the 'origin' field so identify\n\t\t// older customized templates by checking for no origin and a 'theme'\n\t\t// or 'custom' source.\n\t\tif (\n\t\t\ttemplate.has_theme_file &&\n\t\t\t( template.origin === 'theme' ||\n\t\t\t\t( ! template.origin &&\n\t\t\t\t\t[ 'theme', 'custom' ].includes( template.source ) ) )\n\t\t) {\n\t\t\treturn (\n\t\t\t\t<AddedByTheme\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template originally provided by a plugin, but customized by a user.\n\t\tif ( template.has_theme_file && template.origin === 'plugin' ) {\n\t\t\treturn (\n\t\t\t\t<AddedByPlugin\n\t\t\t\t\tslug={ template.theme }\n\t\t\t\t\tisCustomized={ template.source === 'custom' }\n\t\t\t\t/>\n\t\t\t);\n\t\t}\n\n\t\t// Template was created from scratch, but has no author. Author support\n\t\t// was only added to templates in WordPress 5.9. Fallback to showing the\n\t\t// site logo and title.\n\t\tif (\n\t\t\t! template.has_theme_file &&\n\t\t\ttemplate.source === 'custom' &&\n\t\t\t! template.author\n\t\t) {\n\t\t\treturn <AddedBySite />;\n\t\t}\n\t}\n\n\t// Simply show the author for templates created from scratch that have an\n\t// author or for any other post type.\n\treturn <AddedByAuthor id={ template.author } />;\n}\n"]}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
import { createElement } from "@wordpress/element";
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* External dependencies
|
|
5
|
+
*/
|
|
6
|
+
import classnames from 'classnames';
|
|
3
7
|
/**
|
|
4
8
|
* WordPress dependencies
|
|
5
9
|
*/
|
|
10
|
+
|
|
6
11
|
import { store as coreStore } from '@wordpress/core-data';
|
|
7
12
|
import { useSelect } from '@wordpress/data';
|
|
8
13
|
import { InterfaceSkeleton } from '@wordpress/interface';
|
|
9
14
|
import { __, sprintf } from '@wordpress/i18n';
|
|
10
15
|
import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';
|
|
16
|
+
import { EditorSnackbars } from '@wordpress/editor';
|
|
11
17
|
/**
|
|
12
18
|
* Internal dependencies
|
|
13
19
|
*/
|
|
@@ -16,6 +22,7 @@ import useRegisterShortcuts from './use-register-shortcuts';
|
|
|
16
22
|
import Header from './header';
|
|
17
23
|
import NavigationSidebar from '../navigation-sidebar';
|
|
18
24
|
import Table from './table';
|
|
25
|
+
import { store as editSiteStore } from '../../store';
|
|
19
26
|
export default function List(_ref) {
|
|
20
27
|
var _postType$labels;
|
|
21
28
|
|
|
@@ -25,11 +32,13 @@ export default function List(_ref) {
|
|
|
25
32
|
useRegisterShortcuts();
|
|
26
33
|
const {
|
|
27
34
|
previousShortcut,
|
|
28
|
-
nextShortcut
|
|
35
|
+
nextShortcut,
|
|
36
|
+
isNavigationOpen
|
|
29
37
|
} = useSelect(select => {
|
|
30
38
|
return {
|
|
31
39
|
previousShortcut: select(keyboardShortcutsStore).getAllShortcutKeyCombinations('core/edit-site/previous-region'),
|
|
32
|
-
nextShortcut: select(keyboardShortcutsStore).getAllShortcutKeyCombinations('core/edit-site/next-region')
|
|
40
|
+
nextShortcut: select(keyboardShortcutsStore).getAllShortcutKeyCombinations('core/edit-site/next-region'),
|
|
41
|
+
isNavigationOpen: select(editSiteStore).isNavigationOpened()
|
|
33
42
|
};
|
|
34
43
|
}, []);
|
|
35
44
|
const postType = useSelect(select => select(coreStore).getPostType(templateType), [templateType]); // `postType` could load in asynchronously. Only provide the detailed region labels if
|
|
@@ -43,7 +52,9 @@ export default function List(_ref) {
|
|
|
43
52
|
__('%s - Content'), itemsListLabel)
|
|
44
53
|
} : undefined;
|
|
45
54
|
return createElement(InterfaceSkeleton, {
|
|
46
|
-
className:
|
|
55
|
+
className: classnames('edit-site-list', {
|
|
56
|
+
'is-navigation-open': isNavigationOpen
|
|
57
|
+
}),
|
|
47
58
|
labels: {
|
|
48
59
|
drawer: __('Navigation Sidebar'),
|
|
49
60
|
...detailedRegionLabels
|
|
@@ -55,6 +66,7 @@ export default function List(_ref) {
|
|
|
55
66
|
activeTemplateType: templateType,
|
|
56
67
|
isDefaultOpen: true
|
|
57
68
|
}),
|
|
69
|
+
notices: createElement(EditorSnackbars, null),
|
|
58
70
|
content: createElement("main", {
|
|
59
71
|
className: "edit-site-list-main"
|
|
60
72
|
}, createElement(Table, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-site/src/components/list/index.js"],"names":["store","coreStore","useSelect","InterfaceSkeleton","__","sprintf","keyboardShortcutsStore","useRegisterShortcuts","Header","NavigationSidebar","Table","List","templateType","previousShortcut","nextShortcut","select","getAllShortcutKeyCombinations","postType","getPostType","itemsListLabel","labels","items_list","detailedRegionLabels","header","body","undefined","drawer","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,
|
|
1
|
+
{"version":3,"sources":["@wordpress/edit-site/src/components/list/index.js"],"names":["classnames","store","coreStore","useSelect","InterfaceSkeleton","__","sprintf","keyboardShortcutsStore","EditorSnackbars","useRegisterShortcuts","Header","NavigationSidebar","Table","editSiteStore","List","templateType","previousShortcut","nextShortcut","isNavigationOpen","select","getAllShortcutKeyCombinations","isNavigationOpened","postType","getPostType","itemsListLabel","labels","items_list","detailedRegionLabels","header","body","undefined","drawer","previous","next"],"mappings":";;AAAA;AACA;AACA;AACA,OAAOA,UAAP,MAAuB,YAAvB;AAEA;AACA;AACA;;AACA,SAASC,KAAK,IAAIC,SAAlB,QAAmC,sBAAnC;AACA,SAASC,SAAT,QAA0B,iBAA1B;AACA,SAASC,iBAAT,QAAkC,sBAAlC;AACA,SAASC,EAAT,EAAaC,OAAb,QAA4B,iBAA5B;AACA,SAASL,KAAK,IAAIM,sBAAlB,QAAgD,+BAAhD;AACA,SAASC,eAAT,QAAgC,mBAAhC;AAEA;AACA;AACA;;AACA,OAAOC,oBAAP,MAAiC,0BAAjC;AACA,OAAOC,MAAP,MAAmB,UAAnB;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gBAAF,EAAoB;AACzC,4BAAsBkB;AADmB,KAApB,CADvB;AAIC,IAAA,MAAM,EAAG;AACRa,MAAAA,MAAM,EAAE1B,EAAE,CAAE,oBAAF,CADF;AAER,SAAGsB;AAFK,KAJV;AAQC,IAAA,MAAM,EAAG,cAAC,MAAD;AAAQ,MAAA,YAAY,EAAGZ;AAAvB,MARV;AASC,IAAA,MAAM,EACL,cAAC,iBAAD;AACC,MAAA,kBAAkB,EAAGA,YADtB;AAEC,MAAA,aAAa;AAFd,MAVF;AAeC,IAAA,OAAO,EAAG,cAAC,eAAD,OAfX;AAgBC,IAAA,OAAO,EACN;AAAM,MAAA,SAAS,EAAC;AAAhB,OACC,cAAC,KAAD;AAAO,MAAA,YAAY,EAAGA;AAAtB,MADD,CAjBF;AAqBC,IAAA,SAAS,EAAG;AACXiB,MAAAA,QAAQ,EAAEhB,gBADC;AAEXiB,MAAAA,IAAI,EAAEhB;AAFK;AArBb,IADD;AA4BA","sourcesContent":["/**\n * External dependencies\n */\nimport classnames from 'classnames';\n\n/**\n * WordPress dependencies\n */\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useSelect } from '@wordpress/data';\nimport { InterfaceSkeleton } from '@wordpress/interface';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts';\nimport { EditorSnackbars } from '@wordpress/editor';\n\n/**\n * Internal dependencies\n */\nimport useRegisterShortcuts from './use-register-shortcuts';\nimport Header from './header';\nimport NavigationSidebar from '../navigation-sidebar';\nimport Table from './table';\nimport { store as editSiteStore } from '../../store';\n\nexport default function List( { templateType } ) {\n\tuseRegisterShortcuts();\n\n\tconst { previousShortcut, nextShortcut, isNavigationOpen } = useSelect(\n\t\t( select ) => {\n\t\t\treturn {\n\t\t\t\tpreviousShortcut: select(\n\t\t\t\t\tkeyboardShortcutsStore\n\t\t\t\t).getAllShortcutKeyCombinations(\n\t\t\t\t\t'core/edit-site/previous-region'\n\t\t\t\t),\n\t\t\t\tnextShortcut: select(\n\t\t\t\t\tkeyboardShortcutsStore\n\t\t\t\t).getAllShortcutKeyCombinations( 'core/edit-site/next-region' ),\n\t\t\t\tisNavigationOpen: select( editSiteStore ).isNavigationOpened(),\n\t\t\t};\n\t\t},\n\t\t[]\n\t);\n\n\tconst postType = useSelect(\n\t\t( select ) => select( coreStore ).getPostType( templateType ),\n\t\t[ templateType ]\n\t);\n\n\t// `postType` could load in asynchronously. Only provide the detailed region labels if\n\t// the postType has loaded, otherwise `InterfaceSkeleton` will fallback to the defaults.\n\tconst itemsListLabel = postType?.labels?.items_list;\n\tconst detailedRegionLabels = postType\n\t\t? {\n\t\t\t\theader: sprintf(\n\t\t\t\t\t// translators: %s - the name of the page, 'Header' as in the header area of that page.\n\t\t\t\t\t__( '%s - Header' ),\n\t\t\t\t\titemsListLabel\n\t\t\t\t),\n\t\t\t\tbody: sprintf(\n\t\t\t\t\t// translators: %s - the name of the page, 'Content' as in the content area of that page.\n\t\t\t\t\t__( '%s - Content' ),\n\t\t\t\t\titemsListLabel\n\t\t\t\t),\n\t\t }\n\t\t: undefined;\n\n\treturn (\n\t\t<InterfaceSkeleton\n\t\t\tclassName={ classnames( 'edit-site-list', {\n\t\t\t\t'is-navigation-open': isNavigationOpen,\n\t\t\t} ) }\n\t\t\tlabels={ {\n\t\t\t\tdrawer: __( 'Navigation Sidebar' ),\n\t\t\t\t...detailedRegionLabels,\n\t\t\t} }\n\t\t\theader={ <Header templateType={ templateType } /> }\n\t\t\tdrawer={\n\t\t\t\t<NavigationSidebar\n\t\t\t\t\tactiveTemplateType={ templateType }\n\t\t\t\t\tisDefaultOpen\n\t\t\t\t/>\n\t\t\t}\n\t\t\tnotices={ <EditorSnackbars /> }\n\t\t\tcontent={\n\t\t\t\t<main className=\"edit-site-list-main\">\n\t\t\t\t\t<Table templateType={ templateType } />\n\t\t\t\t</main>\n\t\t\t}\n\t\t\tshortcuts={ {\n\t\t\t\tprevious: previousShortcut,\n\t\t\t\tnext: nextShortcut,\n\t\t\t} }\n\t\t/>\n\t);\n}\n"]}
|