@plone/volto 16.14.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.
- package/.changelog.draft +19 -3
- package/.storybook/main.js +53 -69
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +26 -0
- package/README.md +21 -19
- package/cypress/support/commands.js +7 -7
- package/cypress/support/guillotina.js +2 -2
- package/cypress/support/reset-fixture.js +2 -2
- package/cypress/support/upgradetests.js +1 -1
- package/cypress.config.js +1 -1
- package/docker-compose.yml +2 -3
- package/locales/pt_BR/LC_MESSAGES/volto.po +1 -1
- package/locales/pt_BR.json +1 -1
- package/locales/volto.pot +1 -1
- package/package.json +22 -20
- package/packages/volto-slate/package.json +1 -1
- package/razzle.config.js +3 -3
- package/src/components/manage/Controlpanels/VersionOverview.jsx +6 -10
- package/src/components/manage/Diff/DiffField.jsx +6 -6
- package/src/components/theme/FormattedDate/FormattedDate.jsx +3 -3
- package/src/express-middleware/sitemap.js +1 -1
- package/src/helpers/Blocks/Blocks.test.js +50 -0
- package/src/helpers/Utils/Date.js +4 -2
- package/src/helpers/Utils/Date.test.js +3 -1
- package/src/helpers/index.js +0 -1
- package/webpack-plugins/webpack-relative-resolver.js +33 -19
- package/webpack-plugins/webpack-root-resolver.js +25 -14
- package/webpack-plugins/webpack-svg-plugin.js +11 -4
- package/locales/fi/LC_MESSAGES/volto.po +0 -4611
|
@@ -48,7 +48,9 @@ export function formatDate({
|
|
|
48
48
|
: short_date_format;
|
|
49
49
|
|
|
50
50
|
const formatter = new Intl.DateTimeFormat(locale, format);
|
|
51
|
-
return formatToParts
|
|
51
|
+
return formatToParts
|
|
52
|
+
? formatter.formatToParts(date)
|
|
53
|
+
: formatter.format(date).replace('\u202F', ' ');
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
export function formatRelativeDate({
|
|
@@ -93,5 +95,5 @@ export function formatRelativeDate({
|
|
|
93
95
|
? ''
|
|
94
96
|
: formatToParts
|
|
95
97
|
? formatter.formatToParts(v, tag)
|
|
96
|
-
: formatter.format(v, tag); // use "now" ?
|
|
98
|
+
: formatter.format(v, tag).replace('\u202F', ' '); // use "now" ?
|
|
97
99
|
}
|
|
@@ -192,6 +192,8 @@ describe('formatRelativeDate helper', () => {
|
|
|
192
192
|
it('can use alternate style narrow', () => {
|
|
193
193
|
const now = Date.now();
|
|
194
194
|
const d = new Date(now + 3 * MONTH);
|
|
195
|
-
expect(
|
|
195
|
+
expect(['in 3 mo.', 'in 3mo']).toContain(
|
|
196
|
+
formatRelativeDate({ date: d, style: 'narrow' }),
|
|
197
|
+
);
|
|
196
198
|
});
|
|
197
199
|
});
|
package/src/helpers/index.js
CHANGED
|
@@ -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.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
const nextRequest = Object.assign({}, request, {
|
|
18
|
+
request: path.resolve(`./${resourcePath}`),
|
|
19
|
+
});
|
|
15
20
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
},
|