@plone/volto 16.13.0 → 17.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/.changelog.draft +12 -11
  2. package/.storybook/main.js +53 -69
  3. package/.yarn/install-state.gz +0 -0
  4. package/CHANGELOG.md +33 -0
  5. package/README.md +21 -19
  6. package/cypress/support/commands.js +7 -7
  7. package/cypress/support/guillotina.js +2 -2
  8. package/cypress/support/reset-fixture.js +2 -2
  9. package/cypress/support/upgradetests.js +1 -1
  10. package/cypress.config.js +1 -1
  11. package/docker-compose.yml +2 -3
  12. package/locales/ca/LC_MESSAGES/volto.po +30 -0
  13. package/locales/ca.json +1 -1
  14. package/locales/de/LC_MESSAGES/volto.po +30 -0
  15. package/locales/de.json +1 -1
  16. package/locales/en/LC_MESSAGES/volto.po +30 -0
  17. package/locales/en.json +1 -1
  18. package/locales/es/LC_MESSAGES/volto.po +30 -0
  19. package/locales/es.json +1 -1
  20. package/locales/eu/LC_MESSAGES/volto.po +30 -0
  21. package/locales/eu.json +1 -1
  22. package/locales/fi.json +1 -1
  23. package/locales/fr/LC_MESSAGES/volto.po +30 -0
  24. package/locales/fr.json +1 -1
  25. package/locales/it/LC_MESSAGES/volto.po +30 -0
  26. package/locales/it.json +1 -1
  27. package/locales/ja/LC_MESSAGES/volto.po +30 -0
  28. package/locales/ja.json +1 -1
  29. package/locales/nl/LC_MESSAGES/volto.po +30 -0
  30. package/locales/nl.json +1 -1
  31. package/locales/pt/LC_MESSAGES/volto.po +30 -0
  32. package/locales/pt.json +1 -1
  33. package/locales/pt_BR/LC_MESSAGES/volto.po +31 -1
  34. package/locales/pt_BR.json +1 -1
  35. package/locales/ro/LC_MESSAGES/volto.po +30 -0
  36. package/locales/ro.json +1 -1
  37. package/locales/volto.pot +31 -1
  38. package/locales/zh_CN/LC_MESSAGES/volto.po +30 -0
  39. package/locales/zh_CN.json +1 -1
  40. package/package.json +22 -20
  41. package/packages/volto-slate/package.json +1 -1
  42. package/razzle.config.js +3 -3
  43. package/src/components/manage/Blocks/Teaser/Body.jsx +30 -0
  44. package/src/components/manage/Blocks/Teaser/Data.jsx +71 -0
  45. package/src/components/manage/Blocks/Teaser/DefaultBody.jsx +89 -0
  46. package/src/components/manage/Blocks/Teaser/Edit.jsx +25 -0
  47. package/src/components/manage/Blocks/Teaser/View.jsx +9 -0
  48. package/src/components/manage/Blocks/Teaser/adapter.js +23 -0
  49. package/src/components/manage/Blocks/Teaser/schema.js +103 -0
  50. package/src/components/manage/Blocks/Teaser/utils.js +44 -0
  51. package/src/components/manage/Blocks/Teaser/utils.test.jsx +229 -0
  52. package/src/components/manage/Controlpanels/VersionOverview.jsx +6 -10
  53. package/src/components/manage/Diff/DiffField.jsx +6 -6
  54. package/src/components/theme/FormattedDate/FormattedDate.jsx +3 -3
  55. package/src/config/Blocks.jsx +28 -0
  56. package/src/express-middleware/sitemap.js +1 -1
  57. package/src/helpers/Blocks/Blocks.test.js +50 -0
  58. package/src/helpers/Utils/Date.js +4 -2
  59. package/src/helpers/Utils/Date.test.js +3 -1
  60. package/src/helpers/index.js +0 -1
  61. package/theme/themes/pastanaga/extras/blocks.less +2 -0
  62. package/theme/themes/pastanaga/extras/teaser.less +166 -0
  63. package/webpack-plugins/webpack-relative-resolver.js +33 -19
  64. package/webpack-plugins/webpack-root-resolver.js +25 -14
  65. package/webpack-plugins/webpack-svg-plugin.js +11 -4
  66. package/locales/fi/LC_MESSAGES/volto.po +0 -4581
@@ -0,0 +1,166 @@
1
+ @teaser-images-aspect-ratio: var(--teaser-images-aspect-ratio, 16/9);
2
+ @teaser-images-object-position: var(--teaser-images-object-position, top left);
3
+
4
+ .teaser-item {
5
+ display: flex;
6
+ color: rgba(0, 0, 0, 0.87);
7
+
8
+ &.placeholder {
9
+ display: flex;
10
+ flex-direction: column;
11
+ align-items: center;
12
+
13
+ img {
14
+ max-width: 300px;
15
+ height: auto;
16
+ align-self: center;
17
+ }
18
+ }
19
+
20
+ p {
21
+ margin-bottom: 0;
22
+ text-align: left;
23
+ }
24
+
25
+ &.default .image-wrapper {
26
+ margin-right: 25px;
27
+
28
+ img {
29
+ max-width: 100%;
30
+ height: auto;
31
+ }
32
+ }
33
+ }
34
+
35
+ .teaser-item.default {
36
+ .content {
37
+ width: 100%;
38
+ }
39
+ }
40
+
41
+ .teaser-item .image-wrapper img {
42
+ width: 100%;
43
+ aspect-ratio: @teaser-images-aspect-ratio;
44
+ object-fit: cover;
45
+ object-position: @teaser-images-object-position;
46
+ }
47
+
48
+ #page-document > .block.teaser {
49
+ padding: 25px 0;
50
+
51
+ &.has--align--left,
52
+ &.has--align--right {
53
+ .teaser-item.default {
54
+ display: flex;
55
+
56
+ .image-wrapper {
57
+ align-self: flex-start;
58
+ }
59
+
60
+ @media only screen and (max-width: @largestMobileScreen) {
61
+ flex-direction: column !important;
62
+
63
+ .image-wrapper {
64
+ margin-right: 0;
65
+ margin-bottom: 25px;
66
+ margin-left: 0;
67
+
68
+ img {
69
+ width: 100%;
70
+ max-width: unset;
71
+ height: auto;
72
+ }
73
+ }
74
+ }
75
+ }
76
+ }
77
+
78
+ &.has--align--left {
79
+ .teaser-item.default {
80
+ flex-direction: row;
81
+
82
+ .image-wrapper {
83
+ margin-right: 20px;
84
+ margin-left: 0;
85
+
86
+ @media only screen and (max-width: @largestMobileScreen) {
87
+ margin-right: 0;
88
+ margin-left: 0;
89
+ }
90
+ }
91
+ }
92
+ }
93
+
94
+ &.has--align--right {
95
+ a .teaser-item.default {
96
+ flex-direction: row-reverse;
97
+
98
+ .image-wrapper {
99
+ margin-right: 0;
100
+ margin-left: 20px;
101
+
102
+ @media only screen and (max-width: @largestMobileScreen) {
103
+ margin-right: 0;
104
+ margin-left: 0;
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ &.has--align--center {
111
+ .teaser-item.default {
112
+ display: block;
113
+
114
+ a {
115
+ display: block;
116
+ }
117
+
118
+ .image-wrapper {
119
+ margin-bottom: 25px;
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ .block-editor-teaser.has--align--left .block.teaser,
126
+ .block-editor-teaser.has--align--right .block.teaser {
127
+ .teaser-item.default {
128
+ display: flex;
129
+
130
+ .image-wrapper {
131
+ align-self: flex-start;
132
+ }
133
+ }
134
+ }
135
+
136
+ .block-editor-teaser.has--align--left .block.teaser {
137
+ .teaser-item.default {
138
+ flex-direction: row;
139
+
140
+ .image-wrapper {
141
+ margin-right: 20px;
142
+ margin-left: 0;
143
+ }
144
+ }
145
+ }
146
+
147
+ .block-editor-teaser.has--align--right .block.teaser {
148
+ .teaser-item.default {
149
+ flex-direction: row-reverse;
150
+
151
+ .image-wrapper {
152
+ margin-right: 0;
153
+ margin-left: 20px;
154
+ }
155
+ }
156
+ }
157
+
158
+ .block-editor-teaser.has--align--center .block.teaser {
159
+ .teaser-item.default {
160
+ display: block;
161
+
162
+ .image-wrapper {
163
+ margin: 0 0 25px 0;
164
+ }
165
+ }
166
+ }
@@ -1,7 +1,9 @@
1
1
  const path = require('path');
2
2
 
3
3
  class RelativeResolverPlugin {
4
- constructor(registry) {
4
+ constructor(registry, source, target) {
5
+ this.source = source || 'resolve';
6
+ this.target = target || 'resolve';
5
7
  this.registry = registry;
6
8
  this.voltoPaths = Object.assign(
7
9
  { '@plone/volto/': `${registry.voltoPath}/src` },
@@ -33,24 +35,36 @@ class RelativeResolverPlugin {
33
35
  }
34
36
 
35
37
  apply(resolver) {
36
- resolver.plugin('resolve', (request, callback) => {
37
- if (
38
- request.request.startsWith('.') &&
39
- request.context &&
40
- request.context.issuer &&
41
- this.isAddon(request)
42
- ) {
43
- const normalizedResourceName = this.getResolvePath(request);
44
- const nextRequest = Object.assign({}, request, {
45
- request: normalizedResourceName,
46
- path: this.registry.projectRootPath,
47
- });
48
-
49
- resolver.doResolve('resolve', nextRequest, '', callback);
50
- } else {
51
- callback();
52
- }
53
- });
38
+ var target = resolver.ensureHook(this.target);
39
+ resolver
40
+ .getHook(this.source)
41
+ .tapAsync(
42
+ 'RelativeResolverPlugin',
43
+ (request, resolveContext, callback) => {
44
+ if (
45
+ request.request.startsWith('.') &&
46
+ request.context &&
47
+ request.context.issuer &&
48
+ this.isAddon(request)
49
+ ) {
50
+ const normalizedResourceName = this.getResolvePath(request);
51
+ const nextRequest = Object.assign({}, request, {
52
+ request: normalizedResourceName,
53
+ path: this.registry.projectRootPath,
54
+ });
55
+
56
+ return resolver.doResolve(
57
+ target,
58
+ nextRequest,
59
+ null,
60
+ resolveContext,
61
+ callback,
62
+ );
63
+ } else {
64
+ callback();
65
+ }
66
+ },
67
+ );
54
68
  }
55
69
  }
56
70
 
@@ -1,23 +1,34 @@
1
1
  const path = require('path');
2
2
 
3
3
  class RootResolverPlugin {
4
+ constructor(source, target) {
5
+ this.source = source || 'resolve';
6
+ this.target = target || 'resolve';
7
+ }
8
+
4
9
  apply(resolver) {
5
- resolver.plugin('resolve', function RelativeBackResolver(
6
- request,
7
- callback,
8
- ) {
9
- if (request.request.startsWith('~/../')) {
10
- const resourcePath = request.request.substr(5);
10
+ var target = resolver.ensureHook(this.target);
11
+ resolver
12
+ .getHook(this.source)
13
+ .tapAsync('RootResolverPlugin', (request, resolveContext, callback) => {
14
+ if (request.request.startsWith('~/../')) {
15
+ const resourcePath = request.request.substr(5);
11
16
 
12
- const nextRequest = Object.assign({}, request, {
13
- request: path.resolve(`./${resourcePath}`),
14
- });
17
+ const nextRequest = Object.assign({}, request, {
18
+ request: path.resolve(`./${resourcePath}`),
19
+ });
15
20
 
16
- resolver.doResolve('resolve', nextRequest, '', callback);
17
- } else {
18
- callback();
19
- }
20
- });
21
+ resolver.doResolve(
22
+ target,
23
+ nextRequest,
24
+ null,
25
+ resolveContext,
26
+ callback,
27
+ );
28
+ } else {
29
+ callback();
30
+ }
31
+ });
21
32
  }
22
33
  }
23
34
 
@@ -16,10 +16,17 @@ module.exports = {
16
16
  loader: 'svgo-loader',
17
17
  options: {
18
18
  plugins: [
19
- { removeTitle: true },
20
- { convertPathData: false },
21
- { removeUselessStrokeAndFill: true },
22
- { removeViewBox: false },
19
+ {
20
+ name: 'preset-default',
21
+ params: {
22
+ overrides: {
23
+ convertPathData: false,
24
+ removeViewBox: false,
25
+ },
26
+ },
27
+ },
28
+ 'removeTitle',
29
+ 'removeUselessStrokeAndFill',
23
30
  ],
24
31
  },
25
32
  },