@wordpress/edit-site 3.0.9 → 3.0.10

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 (163) hide show
  1. package/build/components/add-new-template/index.js +49 -0
  2. package/build/components/add-new-template/index.js.map +1 -0
  3. package/build/components/add-new-template/new-template-part.js +79 -0
  4. package/build/components/add-new-template/new-template-part.js.map +1 -0
  5. package/build/components/add-new-template/new-template.js +115 -0
  6. package/build/components/add-new-template/new-template.js.map +1 -0
  7. package/build/components/create-template-part-modal/index.js +115 -0
  8. package/build/components/create-template-part-modal/index.js.map +1 -0
  9. package/build/components/editor/index.js +11 -13
  10. package/build/components/editor/index.js.map +1 -1
  11. package/build/components/global-styles/global-styles-provider.js +4 -4
  12. package/build/components/global-styles/global-styles-provider.js.map +1 -1
  13. package/build/components/global-styles/hooks.js +27 -25
  14. package/build/components/global-styles/hooks.js.map +1 -1
  15. package/build/components/global-styles/screen-block-list.js +9 -1
  16. package/build/components/global-styles/screen-block-list.js.map +1 -1
  17. package/build/components/global-styles/use-global-styles-output.js +2 -2
  18. package/build/components/global-styles/use-global-styles-output.js.map +1 -1
  19. package/build/components/global-styles/utils.js +1 -1
  20. package/build/components/global-styles/utils.js.map +1 -1
  21. package/build/components/header/index.js +1 -5
  22. package/build/components/header/index.js.map +1 -1
  23. package/build/components/list/header.js +50 -0
  24. package/build/components/list/header.js.map +1 -0
  25. package/build/components/list/index.js +55 -0
  26. package/build/components/list/index.js.map +1 -0
  27. package/build/components/list/table.js +128 -0
  28. package/build/components/list/table.js.map +1 -0
  29. package/build/components/navigation-sidebar/index.js +11 -10
  30. package/build/components/navigation-sidebar/index.js.map +1 -1
  31. package/build/components/navigation-sidebar/navigation-panel/index.js +33 -53
  32. package/build/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  33. package/build/components/navigation-sidebar/navigation-toggle/index.js +3 -24
  34. package/build/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  35. package/build/components/template-details/index.js +3 -2
  36. package/build/components/template-details/index.js.map +1 -1
  37. package/build/components/template-part-converter/convert-to-template-part.js +20 -84
  38. package/build/components/template-part-converter/convert-to-template-part.js.map +1 -1
  39. package/build/components/welcome-guide/editor.js +58 -0
  40. package/build/components/welcome-guide/editor.js.map +1 -0
  41. package/build/components/welcome-guide/image.js +27 -0
  42. package/build/components/welcome-guide/image.js.map +1 -0
  43. package/build/components/welcome-guide/index.js +49 -0
  44. package/build/components/welcome-guide/index.js.map +1 -0
  45. package/build/components/welcome-guide/styles.js +83 -0
  46. package/build/components/welcome-guide/styles.js.map +1 -0
  47. package/build/index.js +29 -5
  48. package/build/index.js.map +1 -1
  49. package/build/plugins/index.js +4 -2
  50. package/build/plugins/index.js.map +1 -1
  51. package/build/plugins/welcome-guide-menu-item.js +39 -0
  52. package/build/plugins/welcome-guide-menu-item.js.map +1 -0
  53. package/build/store/actions.js +5 -8
  54. package/build/store/actions.js.map +1 -1
  55. package/build/store/defaults.js +4 -1
  56. package/build/store/defaults.js.map +1 -1
  57. package/build/utils/is-template-removable.js +21 -0
  58. package/build/utils/is-template-removable.js.map +1 -0
  59. package/build-module/components/add-new-template/index.js +36 -0
  60. package/build-module/components/add-new-template/index.js.map +1 -0
  61. package/build-module/components/add-new-template/new-template-part.js +66 -0
  62. package/build-module/components/add-new-template/new-template-part.js.map +1 -0
  63. package/build-module/components/add-new-template/new-template.js +98 -0
  64. package/build-module/components/add-new-template/new-template.js.map +1 -0
  65. package/build-module/components/create-template-part-modal/index.js +102 -0
  66. package/build-module/components/create-template-part-modal/index.js.map +1 -0
  67. package/build-module/components/editor/index.js +9 -13
  68. package/build-module/components/editor/index.js.map +1 -1
  69. package/build-module/components/global-styles/global-styles-provider.js +4 -4
  70. package/build-module/components/global-styles/global-styles-provider.js.map +1 -1
  71. package/build-module/components/global-styles/hooks.js +28 -26
  72. package/build-module/components/global-styles/hooks.js.map +1 -1
  73. package/build-module/components/global-styles/screen-block-list.js +7 -1
  74. package/build-module/components/global-styles/screen-block-list.js.map +1 -1
  75. package/build-module/components/global-styles/use-global-styles-output.js +2 -2
  76. package/build-module/components/global-styles/use-global-styles-output.js.map +1 -1
  77. package/build-module/components/global-styles/utils.js +1 -1
  78. package/build-module/components/global-styles/utils.js.map +1 -1
  79. package/build-module/components/header/index.js +1 -3
  80. package/build-module/components/header/index.js.map +1 -1
  81. package/build-module/components/list/header.js +37 -0
  82. package/build-module/components/list/header.js.map +1 -0
  83. package/build-module/components/list/index.js +40 -0
  84. package/build-module/components/list/index.js.map +1 -0
  85. package/build-module/components/list/table.js +112 -0
  86. package/build-module/components/list/table.js.map +1 -0
  87. package/build-module/components/navigation-sidebar/index.js +12 -8
  88. package/build-module/components/navigation-sidebar/index.js.map +1 -1
  89. package/build-module/components/navigation-sidebar/navigation-panel/index.js +35 -53
  90. package/build-module/components/navigation-sidebar/navigation-panel/index.js.map +1 -1
  91. package/build-module/components/navigation-sidebar/navigation-toggle/index.js +4 -24
  92. package/build-module/components/navigation-sidebar/navigation-toggle/index.js.map +1 -1
  93. package/build-module/components/template-details/index.js +3 -2
  94. package/build-module/components/template-details/index.js.map +1 -1
  95. package/build-module/components/template-part-converter/convert-to-template-part.js +20 -84
  96. package/build-module/components/template-part-converter/convert-to-template-part.js.map +1 -1
  97. package/build-module/components/welcome-guide/editor.js +45 -0
  98. package/build-module/components/welcome-guide/editor.js.map +1 -0
  99. package/build-module/components/welcome-guide/image.js +19 -0
  100. package/build-module/components/welcome-guide/image.js.map +1 -0
  101. package/build-module/components/welcome-guide/index.js +35 -0
  102. package/build-module/components/welcome-guide/index.js.map +1 -0
  103. package/build-module/components/welcome-guide/styles.js +69 -0
  104. package/build-module/components/welcome-guide/styles.js.map +1 -0
  105. package/build-module/index.js +21 -1
  106. package/build-module/index.js.map +1 -1
  107. package/build-module/plugins/index.js +3 -2
  108. package/build-module/plugins/index.js.map +1 -1
  109. package/build-module/plugins/welcome-guide-menu-item.js +27 -0
  110. package/build-module/plugins/welcome-guide-menu-item.js.map +1 -0
  111. package/build-module/store/actions.js +5 -8
  112. package/build-module/store/actions.js.map +1 -1
  113. package/build-module/store/defaults.js +4 -1
  114. package/build-module/store/defaults.js.map +1 -1
  115. package/build-module/utils/is-template-removable.js +14 -0
  116. package/build-module/utils/is-template-removable.js.map +1 -0
  117. package/build-style/style-rtl.css +348 -32
  118. package/build-style/style.css +348 -32
  119. package/package.json +7 -7
  120. package/src/components/add-new-template/index.js +30 -0
  121. package/src/components/add-new-template/new-template-part.js +67 -0
  122. package/src/components/add-new-template/new-template.js +117 -0
  123. package/src/components/add-new-template/style.scss +11 -0
  124. package/src/components/create-template-part-modal/index.js +132 -0
  125. package/src/components/{template-part-converter → create-template-part-modal}/style.scss +9 -9
  126. package/src/components/editor/index.js +10 -14
  127. package/src/components/editor/style.scss +8 -0
  128. package/src/components/global-styles/global-styles-provider.js +4 -3
  129. package/src/components/global-styles/hooks.js +58 -26
  130. package/src/components/global-styles/screen-block-list.js +11 -1
  131. package/src/components/global-styles/test/use-global-styles-output.js +2 -2
  132. package/src/components/global-styles/use-global-styles-output.js +2 -2
  133. package/src/components/global-styles/utils.js +1 -1
  134. package/src/components/header/index.js +0 -6
  135. package/src/components/list/header.js +34 -0
  136. package/src/components/list/index.js +38 -0
  137. package/src/components/list/style.scss +113 -0
  138. package/src/components/list/table.js +133 -0
  139. package/src/components/navigation-sidebar/index.js +15 -8
  140. package/src/components/navigation-sidebar/navigation-panel/index.js +44 -55
  141. package/src/components/navigation-sidebar/navigation-panel/style.scss +4 -2
  142. package/src/components/navigation-sidebar/navigation-toggle/index.js +4 -28
  143. package/src/components/template-details/index.js +3 -2
  144. package/src/components/template-part-converter/convert-to-template-part.js +20 -140
  145. package/src/components/welcome-guide/editor.js +63 -0
  146. package/src/components/welcome-guide/image.js +11 -0
  147. package/src/components/welcome-guide/index.js +33 -0
  148. package/src/components/welcome-guide/style.scss +37 -0
  149. package/src/components/welcome-guide/styles.js +116 -0
  150. package/src/index.js +21 -1
  151. package/src/plugins/index.js +3 -1
  152. package/src/plugins/welcome-guide-menu-item.js +35 -0
  153. package/src/store/actions.js +11 -9
  154. package/src/store/defaults.js +4 -1
  155. package/src/store/test/actions.js +14 -20
  156. package/src/style.scss +9 -6
  157. package/src/utils/is-template-removable.js +13 -0
  158. package/build/components/header/navigation-link/index.js +0 -87
  159. package/build/components/header/navigation-link/index.js.map +0 -1
  160. package/build-module/components/header/navigation-link/index.js +0 -74
  161. package/build-module/components/header/navigation-link/index.js.map +0 -1
  162. package/src/components/header/navigation-link/index.js +0 -71
  163. package/src/components/header/navigation-link/style.scss +0 -69
package/src/style.scss CHANGED
@@ -5,14 +5,18 @@
5
5
  @import "./components/header/style.scss";
6
6
  @import "./components/header/document-actions/style.scss";
7
7
  @import "./components/header/more-menu/style.scss";
8
- @import "./components/header/navigation-link/style.scss";
8
+ @import "./components/navigation-sidebar/navigation-toggle/style.scss";
9
+ @import "./components/navigation-sidebar/navigation-panel/style.scss";
10
+ @import "./components/list/style.scss";
11
+ @import "./components/add-new-template/style.scss";
9
12
  @import "./components/sidebar/style.scss";
10
13
  @import "./components/sidebar/settings-header/style.scss";
11
14
  @import "./components/sidebar/template-card/style.scss";
12
15
  @import "./components/editor/style.scss";
13
16
  @import "./components/template-details/style.scss";
14
- @import "./components/template-part-converter/style.scss";
17
+ @import "./components/create-template-part-modal/style.scss";
15
18
  @import "./components/secondary-sidebar/style.scss";
19
+ @import "./components/welcome-guide/style.scss";
16
20
 
17
21
  // In order to use mix-blend-mode, this element needs to have an explicitly set background-color.
18
22
  // We scope it to .wp-toolbar to be wp-admin only, to prevent bleed into other implementations.
@@ -37,15 +41,14 @@ body.site-editor-php {
37
41
  @include break-small {
38
42
  bottom: 0;
39
43
  left: 0;
40
- min-height: calc(100vh - #{$admin-bar-height-big});
44
+ min-height: 100vh;
41
45
  position: absolute;
42
46
  right: 0;
43
47
  top: 0;
44
48
  }
45
49
 
46
- // The WP header height changes at this breakpoint.
47
- @include break-medium {
48
- min-height: calc(100vh - #{$admin-bar-height});
50
+ .interface-interface-skeleton {
51
+ top: 0;
49
52
  }
50
53
 
51
54
  // Todo: Remove this rule when edit site gets support
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Check if a template is removable.
3
+ *
4
+ * @param {Object} template The template entity to check.
5
+ * @return {boolean} Whether the template is revertable.
6
+ */
7
+ export default function isTemplateRemovable( template ) {
8
+ if ( ! template ) {
9
+ return false;
10
+ }
11
+
12
+ return template.source === 'custom' && ! template.has_theme_file;
13
+ }
@@ -1,87 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _element = require("@wordpress/element");
9
-
10
- var _data = require("@wordpress/data");
11
-
12
- var _components = require("@wordpress/components");
13
-
14
- var _i18n = require("@wordpress/i18n");
15
-
16
- var _icons = require("@wordpress/icons");
17
-
18
- var _coreData = require("@wordpress/core-data");
19
-
20
- var _compose = require("@wordpress/compose");
21
-
22
- /**
23
- * WordPress dependencies
24
- */
25
- function NavigationLink(_ref) {
26
- let {
27
- icon
28
- } = _ref;
29
- const {
30
- isRequestingSiteIcon,
31
- siteIconUrl
32
- } = (0, _data.useSelect)(select => {
33
- const {
34
- getEntityRecord,
35
- isResolving
36
- } = select(_coreData.store);
37
- const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
38
- return {
39
- isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
40
- siteIconUrl: siteData.site_icon_url
41
- };
42
- }, []);
43
- const disableMotion = (0, _compose.useReducedMotion)();
44
- let buttonIcon = (0, _element.createElement)(_components.Icon, {
45
- size: "36px",
46
- icon: _icons.wordpress
47
- });
48
- const effect = {
49
- expand: {
50
- scale: 1.7,
51
- borderRadius: 0,
52
- transition: {
53
- type: 'tween',
54
- duration: '0.2'
55
- }
56
- }
57
- };
58
-
59
- if (siteIconUrl) {
60
- buttonIcon = (0, _element.createElement)(_components.__unstableMotion.img, {
61
- variants: !disableMotion && effect,
62
- alt: (0, _i18n.__)('Site Icon'),
63
- className: "edit-site-navigation-link__site-icon",
64
- src: siteIconUrl
65
- });
66
- } else if (isRequestingSiteIcon) {
67
- buttonIcon = null;
68
- } else if (icon) {
69
- buttonIcon = (0, _element.createElement)(_components.Icon, {
70
- size: "36px",
71
- icon: icon
72
- });
73
- }
74
-
75
- return (0, _element.createElement)(_components.__unstableMotion.div, {
76
- className: "edit-site-navigation-link",
77
- whileHover: "expand"
78
- }, (0, _element.createElement)(_components.Button, {
79
- className: "edit-site-navigation-link__button has-icon",
80
- label: (0, _i18n.__)('Dashboard'),
81
- href: "index.php"
82
- }, buttonIcon));
83
- }
84
-
85
- var _default = NavigationLink;
86
- exports.default = _default;
87
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/header/navigation-link/index.js"],"names":["NavigationLink","icon","isRequestingSiteIcon","siteIconUrl","select","getEntityRecord","isResolving","coreDataStore","siteData","undefined","site_icon_url","disableMotion","buttonIcon","wordpress","effect","expand","scale","borderRadius","transition","type","duration"],"mappings":";;;;;;;;;AAGA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AAZA;AACA;AACA;AAYA,SAASA,cAAT,OAAoC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACnC,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MAAwC,qBAAaC,MAAF,IAAc;AACtE,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCF,MAAM,CAAEG,eAAF,CAA/C;AACA,UAAMC,QAAQ,GACbH,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BI,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNP,MAAAA,oBAAoB,EAAEI,WAAW,CAAE,MAAF,EAAU,iBAAV,EAA6B,CAC7D,MAD6D,EAE7D,gBAF6D,EAG7DG,SAH6D,CAA7B,CAD3B;AAMNN,MAAAA,WAAW,EAAEK,QAAQ,CAACE;AANhB,KAAP;AAQA,GAb6C,EAa3C,EAb2C,CAA9C;AAeA,QAAMC,aAAa,GAAG,gCAAtB;AAEA,MAAIC,UAAU,GAAG,4BAAC,gBAAD;AAAM,IAAA,IAAI,EAAC,MAAX;AAAkB,IAAA,IAAI,EAAGC;AAAzB,IAAjB;AAEA,QAAMC,MAAM,GAAG;AACdC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,GADA;AAEPC,MAAAA,YAAY,EAAE,CAFP;AAGPC,MAAAA,UAAU,EAAE;AAAEC,QAAAA,IAAI,EAAE,OAAR;AAAiBC,QAAAA,QAAQ,EAAE;AAA3B;AAHL;AADM,GAAf;;AAQA,MAAKjB,WAAL,EAAmB;AAClBS,IAAAA,UAAU,GACT,4BAAC,4BAAD,CAAQ,GAAR;AACC,MAAA,QAAQ,EAAG,CAAED,aAAF,IAAmBG,MAD/B;AAEC,MAAA,GAAG,EAAG,cAAI,WAAJ,CAFP;AAGC,MAAA,SAAS,EAAC,sCAHX;AAIC,MAAA,GAAG,EAAGX;AAJP,MADD;AAQA,GATD,MASO,IAAKD,oBAAL,EAA4B;AAClCU,IAAAA,UAAU,GAAG,IAAb;AACA,GAFM,MAEA,IAAKX,IAAL,EAAY;AAClBW,IAAAA,UAAU,GAAG,4BAAC,gBAAD;AAAM,MAAA,IAAI,EAAC,MAAX;AAAkB,MAAA,IAAI,EAAGX;AAAzB,MAAb;AACA;;AAED,SACC,4BAAC,4BAAD,CAAQ,GAAR;AAAY,IAAA,SAAS,EAAC,2BAAtB;AAAkD,IAAA,UAAU,EAAC;AAA7D,KACC,4BAAC,kBAAD;AACC,IAAA,SAAS,EAAC,4CADX;AAEC,IAAA,KAAK,EAAG,cAAI,WAAJ,CAFT;AAGC,IAAA,IAAI,EAAC;AAHN,KAKGW,UALH,CADD,CADD;AAWA;;eAEcZ,c","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { wordpress } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\nfunction NavigationLink( { icon } ) {\n\tconst { isRequestingSiteIcon, siteIconUrl } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, isResolving } = select( coreDataStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\tisRequestingSiteIcon: isResolving( 'core', 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t};\n\t}, [] );\n\n\tconst disableMotion = useReducedMotion();\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.7,\n\t\t\tborderRadius: 0,\n\t\t\ttransition: { type: 'tween', duration: '0.2' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-site-navigation-link__site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t} else if ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t} else if ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\treturn (\n\t\t<motion.div className=\"edit-site-navigation-link\" whileHover=\"expand\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-navigation-link__button has-icon\"\n\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\thref=\"index.php\"\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default NavigationLink;\n"]}
@@ -1,74 +0,0 @@
1
- import { createElement } from "@wordpress/element";
2
-
3
- /**
4
- * WordPress dependencies
5
- */
6
- import { useSelect } from '@wordpress/data';
7
- import { Button, Icon, __unstableMotion as motion } from '@wordpress/components';
8
- import { __ } from '@wordpress/i18n';
9
- import { wordpress } from '@wordpress/icons';
10
- import { store as coreDataStore } from '@wordpress/core-data';
11
- import { useReducedMotion } from '@wordpress/compose';
12
-
13
- function NavigationLink(_ref) {
14
- let {
15
- icon
16
- } = _ref;
17
- const {
18
- isRequestingSiteIcon,
19
- siteIconUrl
20
- } = useSelect(select => {
21
- const {
22
- getEntityRecord,
23
- isResolving
24
- } = select(coreDataStore);
25
- const siteData = getEntityRecord('root', '__unstableBase', undefined) || {};
26
- return {
27
- isRequestingSiteIcon: isResolving('core', 'getEntityRecord', ['root', '__unstableBase', undefined]),
28
- siteIconUrl: siteData.site_icon_url
29
- };
30
- }, []);
31
- const disableMotion = useReducedMotion();
32
- let buttonIcon = createElement(Icon, {
33
- size: "36px",
34
- icon: wordpress
35
- });
36
- const effect = {
37
- expand: {
38
- scale: 1.7,
39
- borderRadius: 0,
40
- transition: {
41
- type: 'tween',
42
- duration: '0.2'
43
- }
44
- }
45
- };
46
-
47
- if (siteIconUrl) {
48
- buttonIcon = createElement(motion.img, {
49
- variants: !disableMotion && effect,
50
- alt: __('Site Icon'),
51
- className: "edit-site-navigation-link__site-icon",
52
- src: siteIconUrl
53
- });
54
- } else if (isRequestingSiteIcon) {
55
- buttonIcon = null;
56
- } else if (icon) {
57
- buttonIcon = createElement(Icon, {
58
- size: "36px",
59
- icon: icon
60
- });
61
- }
62
-
63
- return createElement(motion.div, {
64
- className: "edit-site-navigation-link",
65
- whileHover: "expand"
66
- }, createElement(Button, {
67
- className: "edit-site-navigation-link__button has-icon",
68
- label: __('Dashboard'),
69
- href: "index.php"
70
- }, buttonIcon));
71
- }
72
-
73
- export default NavigationLink;
74
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["@wordpress/edit-site/src/components/header/navigation-link/index.js"],"names":["useSelect","Button","Icon","__unstableMotion","motion","__","wordpress","store","coreDataStore","useReducedMotion","NavigationLink","icon","isRequestingSiteIcon","siteIconUrl","select","getEntityRecord","isResolving","siteData","undefined","site_icon_url","disableMotion","buttonIcon","effect","expand","scale","borderRadius","transition","type","duration"],"mappings":";;AAAA;AACA;AACA;AACA,SAASA,SAAT,QAA0B,iBAA1B;AACA,SACCC,MADD,EAECC,IAFD,EAGCC,gBAAgB,IAAIC,MAHrB,QAIO,uBAJP;AAKA,SAASC,EAAT,QAAmB,iBAAnB;AACA,SAASC,SAAT,QAA0B,kBAA1B;AACA,SAASC,KAAK,IAAIC,aAAlB,QAAuC,sBAAvC;AACA,SAASC,gBAAT,QAAiC,oBAAjC;;AAEA,SAASC,cAAT,OAAoC;AAAA,MAAX;AAAEC,IAAAA;AAAF,GAAW;AACnC,QAAM;AAAEC,IAAAA,oBAAF;AAAwBC,IAAAA;AAAxB,MAAwCb,SAAS,CAAIc,MAAF,IAAc;AACtE,UAAM;AAAEC,MAAAA,eAAF;AAAmBC,MAAAA;AAAnB,QAAmCF,MAAM,CAAEN,aAAF,CAA/C;AACA,UAAMS,QAAQ,GACbF,eAAe,CAAE,MAAF,EAAU,gBAAV,EAA4BG,SAA5B,CAAf,IAA0D,EAD3D;AAGA,WAAO;AACNN,MAAAA,oBAAoB,EAAEI,WAAW,CAAE,MAAF,EAAU,iBAAV,EAA6B,CAC7D,MAD6D,EAE7D,gBAF6D,EAG7DE,SAH6D,CAA7B,CAD3B;AAMNL,MAAAA,WAAW,EAAEI,QAAQ,CAACE;AANhB,KAAP;AAQA,GAbsD,EAapD,EAboD,CAAvD;AAeA,QAAMC,aAAa,GAAGX,gBAAgB,EAAtC;AAEA,MAAIY,UAAU,GAAG,cAAC,IAAD;AAAM,IAAA,IAAI,EAAC,MAAX;AAAkB,IAAA,IAAI,EAAGf;AAAzB,IAAjB;AAEA,QAAMgB,MAAM,GAAG;AACdC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,GADA;AAEPC,MAAAA,YAAY,EAAE,CAFP;AAGPC,MAAAA,UAAU,EAAE;AAAEC,QAAAA,IAAI,EAAE,OAAR;AAAiBC,QAAAA,QAAQ,EAAE;AAA3B;AAHL;AADM,GAAf;;AAQA,MAAKf,WAAL,EAAmB;AAClBQ,IAAAA,UAAU,GACT,cAAC,MAAD,CAAQ,GAAR;AACC,MAAA,QAAQ,EAAG,CAAED,aAAF,IAAmBE,MAD/B;AAEC,MAAA,GAAG,EAAGjB,EAAE,CAAE,WAAF,CAFT;AAGC,MAAA,SAAS,EAAC,sCAHX;AAIC,MAAA,GAAG,EAAGQ;AAJP,MADD;AAQA,GATD,MASO,IAAKD,oBAAL,EAA4B;AAClCS,IAAAA,UAAU,GAAG,IAAb;AACA,GAFM,MAEA,IAAKV,IAAL,EAAY;AAClBU,IAAAA,UAAU,GAAG,cAAC,IAAD;AAAM,MAAA,IAAI,EAAC,MAAX;AAAkB,MAAA,IAAI,EAAGV;AAAzB,MAAb;AACA;;AAED,SACC,cAAC,MAAD,CAAQ,GAAR;AAAY,IAAA,SAAS,EAAC,2BAAtB;AAAkD,IAAA,UAAU,EAAC;AAA7D,KACC,cAAC,MAAD;AACC,IAAA,SAAS,EAAC,4CADX;AAEC,IAAA,KAAK,EAAGN,EAAE,CAAE,WAAF,CAFX;AAGC,IAAA,IAAI,EAAC;AAHN,KAKGgB,UALH,CADD,CADD;AAWA;;AAED,eAAeX,cAAf","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport {\n\tButton,\n\tIcon,\n\t__unstableMotion as motion,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { wordpress } from '@wordpress/icons';\nimport { store as coreDataStore } from '@wordpress/core-data';\nimport { useReducedMotion } from '@wordpress/compose';\n\nfunction NavigationLink( { icon } ) {\n\tconst { isRequestingSiteIcon, siteIconUrl } = useSelect( ( select ) => {\n\t\tconst { getEntityRecord, isResolving } = select( coreDataStore );\n\t\tconst siteData =\n\t\t\tgetEntityRecord( 'root', '__unstableBase', undefined ) || {};\n\n\t\treturn {\n\t\t\tisRequestingSiteIcon: isResolving( 'core', 'getEntityRecord', [\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase',\n\t\t\t\tundefined,\n\t\t\t] ),\n\t\t\tsiteIconUrl: siteData.site_icon_url,\n\t\t};\n\t}, [] );\n\n\tconst disableMotion = useReducedMotion();\n\n\tlet buttonIcon = <Icon size=\"36px\" icon={ wordpress } />;\n\n\tconst effect = {\n\t\texpand: {\n\t\t\tscale: 1.7,\n\t\t\tborderRadius: 0,\n\t\t\ttransition: { type: 'tween', duration: '0.2' },\n\t\t},\n\t};\n\n\tif ( siteIconUrl ) {\n\t\tbuttonIcon = (\n\t\t\t<motion.img\n\t\t\t\tvariants={ ! disableMotion && effect }\n\t\t\t\talt={ __( 'Site Icon' ) }\n\t\t\t\tclassName=\"edit-site-navigation-link__site-icon\"\n\t\t\t\tsrc={ siteIconUrl }\n\t\t\t/>\n\t\t);\n\t} else if ( isRequestingSiteIcon ) {\n\t\tbuttonIcon = null;\n\t} else if ( icon ) {\n\t\tbuttonIcon = <Icon size=\"36px\" icon={ icon } />;\n\t}\n\n\treturn (\n\t\t<motion.div className=\"edit-site-navigation-link\" whileHover=\"expand\">\n\t\t\t<Button\n\t\t\t\tclassName=\"edit-site-navigation-link__button has-icon\"\n\t\t\t\tlabel={ __( 'Dashboard' ) }\n\t\t\t\thref=\"index.php\"\n\t\t\t>\n\t\t\t\t{ buttonIcon }\n\t\t\t</Button>\n\t\t</motion.div>\n\t);\n}\n\nexport default NavigationLink;\n"]}
@@ -1,71 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import { useSelect } from '@wordpress/data';
5
- import {
6
- Button,
7
- Icon,
8
- __unstableMotion as motion,
9
- } from '@wordpress/components';
10
- import { __ } from '@wordpress/i18n';
11
- import { wordpress } from '@wordpress/icons';
12
- import { store as coreDataStore } from '@wordpress/core-data';
13
- import { useReducedMotion } from '@wordpress/compose';
14
-
15
- function NavigationLink( { icon } ) {
16
- const { isRequestingSiteIcon, siteIconUrl } = useSelect( ( select ) => {
17
- const { getEntityRecord, isResolving } = select( coreDataStore );
18
- const siteData =
19
- getEntityRecord( 'root', '__unstableBase', undefined ) || {};
20
-
21
- return {
22
- isRequestingSiteIcon: isResolving( 'core', 'getEntityRecord', [
23
- 'root',
24
- '__unstableBase',
25
- undefined,
26
- ] ),
27
- siteIconUrl: siteData.site_icon_url,
28
- };
29
- }, [] );
30
-
31
- const disableMotion = useReducedMotion();
32
-
33
- let buttonIcon = <Icon size="36px" icon={ wordpress } />;
34
-
35
- const effect = {
36
- expand: {
37
- scale: 1.7,
38
- borderRadius: 0,
39
- transition: { type: 'tween', duration: '0.2' },
40
- },
41
- };
42
-
43
- if ( siteIconUrl ) {
44
- buttonIcon = (
45
- <motion.img
46
- variants={ ! disableMotion && effect }
47
- alt={ __( 'Site Icon' ) }
48
- className="edit-site-navigation-link__site-icon"
49
- src={ siteIconUrl }
50
- />
51
- );
52
- } else if ( isRequestingSiteIcon ) {
53
- buttonIcon = null;
54
- } else if ( icon ) {
55
- buttonIcon = <Icon size="36px" icon={ icon } />;
56
- }
57
-
58
- return (
59
- <motion.div className="edit-site-navigation-link" whileHover="expand">
60
- <Button
61
- className="edit-site-navigation-link__button has-icon"
62
- label={ __( 'Dashboard' ) }
63
- href="index.php"
64
- >
65
- { buttonIcon }
66
- </Button>
67
- </motion.div>
68
- );
69
- }
70
-
71
- export default NavigationLink;
@@ -1,69 +0,0 @@
1
- // Developer notes: these rules are duplicated for the post editor.
2
- // They need to be updated in both places.
3
-
4
- .edit-site-navigation-link {
5
- align-items: center;
6
- background: $gray-900;
7
- border-radius: 0;
8
- display: flex;
9
- position: absolute;
10
- top: 0;
11
- left: 0;
12
- z-index: z-index(".edit-site-navigation-link");
13
- height: $header-height;
14
- width: $header-height;
15
- }
16
-
17
- .edit-site-navigation-link__button {
18
- align-items: center;
19
- background: $gray-900;
20
- border-radius: 0;
21
- color: $white;
22
- height: $header-height + $border-width;
23
- width: $header-height;
24
- z-index: 1;
25
- margin-bottom: - $border-width;
26
-
27
- &.has-icon {
28
- min-width: $header-height;
29
-
30
- &:hover,
31
- &:active,
32
- &:focus {
33
- color: $white;
34
- }
35
-
36
- &:focus {
37
- box-shadow: none;
38
- }
39
-
40
- &::before {
41
- transition: box-shadow 0.1s ease;
42
- @include reduce-motion("transition");
43
- content: "";
44
- display: block;
45
- position: absolute;
46
- top: 9px;
47
- right: 9px;
48
- bottom: 9px;
49
- left: 9px;
50
- border-radius: $radius-block-ui + $border-width + $border-width;
51
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-900;
52
- }
53
-
54
- // Hover color.
55
- &:hover::before {
56
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $gray-700;
57
- }
58
-
59
- // Lightened spot color focus.
60
- &:focus::before {
61
- box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) rgba($white, 0.1), inset 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
62
- }
63
- }
64
- }
65
-
66
- .edit-site-navigation-link__site-icon {
67
- width: $button-size;
68
- border-radius: $radius-block-ui;
69
- }