@plone/volto 17.0.0-alpha.3 → 17.0.0-alpha.4

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 (44) hide show
  1. package/.changelog.draft +23 -9
  2. package/.yarn/install-state.gz +0 -0
  3. package/CHANGELOG.md +80 -2
  4. package/addon-registry.js +34 -0
  5. package/create-theme-addons-loader.js +79 -0
  6. package/locales/ca/LC_MESSAGES/volto.po +2 -2
  7. package/locales/de/LC_MESSAGES/volto.po +4 -4
  8. package/locales/de.json +1 -1
  9. package/locales/en/LC_MESSAGES/volto.po +2 -2
  10. package/locales/en.json +1 -1
  11. package/locales/es/LC_MESSAGES/volto.po +2 -2
  12. package/locales/eu/LC_MESSAGES/volto.po +2 -2
  13. package/locales/fr/LC_MESSAGES/volto.po +2 -2
  14. package/locales/it/LC_MESSAGES/volto.po +2 -2
  15. package/locales/ja/LC_MESSAGES/volto.po +2 -2
  16. package/locales/nl/LC_MESSAGES/volto.po +2 -2
  17. package/locales/pt/LC_MESSAGES/volto.po +2 -2
  18. package/locales/pt_BR/LC_MESSAGES/volto.po +2 -2
  19. package/locales/ro/LC_MESSAGES/volto.po +2 -2
  20. package/locales/volto.pot +3 -3
  21. package/locales/zh_CN/LC_MESSAGES/volto.po +2 -2
  22. package/package.json +1 -1
  23. package/packages/volto-slate/package.json +1 -1
  24. package/pyvenv.cfg +1 -1
  25. package/razzle.config.js +23 -0
  26. package/src/actions/language/language.js +1 -0
  27. package/src/actions/querystringsearch/querystringsearch.js +20 -14
  28. package/src/components/manage/Blocks/Listing/ListingBody.test.jsx +20 -0
  29. package/src/components/manage/Blocks/Listing/withQuerystringResults.jsx +1 -2
  30. package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +8 -4
  31. package/src/components/manage/Widgets/SelectUtils.js +1 -1
  32. package/src/components/manage/Widgets/SelectWidget.jsx +1 -1
  33. package/src/components/theme/PasswordReset/PasswordReset.jsx +1 -1
  34. package/src/components/theme/PasswordReset/RequestPasswordReset.jsx +1 -1
  35. package/src/components/theme/View/DefaultView.jsx +1 -1
  36. package/src/config/Widgets.jsx +1 -0
  37. package/src/config/index.js +1 -0
  38. package/src/express-middleware/sitemap.js +0 -1
  39. package/src/helpers/FormValidation/FormValidation.js +10 -1
  40. package/src/helpers/FormValidation/FormValidation.test.js +41 -0
  41. package/src/helpers/Utils/usePagination.js +48 -14
  42. package/src/helpers/Utils/usePagination.test.js +115 -0
  43. package/styles/Vocab/Plone/accept.txt +2 -0
  44. package/styles/Vocab/Plone/reject.txt +5 -0
package/.changelog.draft CHANGED
@@ -1,19 +1,33 @@
1
- ## 17.0.0-alpha.3 (2023-03-22)
1
+ ## 17.0.0-alpha.4 (2023-04-12)
2
2
 
3
3
  ### Feature
4
4
 
5
- - Add Vale to CI for spell and style checks. @MAX-786 [#4423](https://github.com/plone/volto/issues/4423)
5
+ - DefaultView (view of fields for content types with blocks disabled): Show field name as tip on hover of label. @ksuess [#4598](https://github.com/plone/volto/issues/4598)
6
+ - Support RelationList field with named StaticCatalogVocabulary and SelectWidget. @ksuess [#4614](https://github.com/plone/volto/issues/4614)
7
+ - Support for declaring a theme in `volto.config.js` or in `package.json`
8
+ Add two entry points to allow extension of a theme from other add-ons. @sneridagh [#4625](https://github.com/plone/volto/issues/4625)
9
+ - Set sameSite in I18N_LANGUAGE cookie @sneridagh [#4627](https://github.com/plone/volto/issues/4627)
10
+ - Added querystring search get option. @robgietema [#4658](https://github.com/plone/volto/issues/4658)
6
11
 
7
12
  ### Bugfix
8
13
 
9
- - Fix Search is case sensitive in Block chooser @iRohitSingh [#4526](https://github.com/plone/volto/issues/4526)
10
- - InternalURl helper method should incorporate externalRoutes settings into consideration. @iFlameing [#4559](https://github.com/plone/volto/issues/4559)
11
- - Update message add-on control panel: remove 'buildout', update reference. @ksuess [#4574](https://github.com/plone/volto/issues/4574)
14
+ - Added current page parameter to route in listing and search block pagination - Fix: #3868 @bipoza [#4159](https://github.com/plone/volto/issues/4159)
15
+ - Fix regexp that checks valid URLs and improve tests [cekk] [#4601](https://github.com/plone/volto/issues/4601)
16
+ - Fixed wrong localization on password reset page @iRohitSingh [#4656](https://github.com/plone/volto/issues/4656)
17
+ - fix sitemap.xml.gz not is not compressed @dobri1408 [#4663](https://github.com/plone/volto/issues/4663)
18
+
19
+ ### Internal
20
+
21
+ - Trigger CI workflows to run from external pull requests. @davisagli [#4629](https://github.com/plone/volto/issues/4629)
22
+ - Update to p.restapi 8.36.0 and Plone 6.0.3 @sneridagh [#4682](https://github.com/plone/volto/issues/4682)
12
23
 
13
24
  ### Documentation
14
25
 
15
- - Deleted duplicate import and fixed training URLs. @yahya-cloud [#4523](https://github.com/plone/volto/issues/4523)
16
- - Fix grammar in PR #4542. @stevepiercy [#4555](https://github.com/plone/volto/issues/4555)
17
- - Fix broken links at ReactJS.org. @stevepiercy [#4569](https://github.com/plone/volto/issues/4569)
18
- - Fix video warnings and link errors. @stevepiercy [#4578](https://github.com/plone/volto/issues/4578)
26
+ - Added `JavaScript` and `NodeJS` as accepted spellings, and deviations of them as rejected spellings. @utkkkarshhh [#3092](https://github.com/plone/volto/issues/3092)
27
+ - Fix documentation build, add pins @sneridagh [#4626](https://github.com/plone/volto/issues/4626)
28
+ - Update Volto contributing to align with and refer to the new Plone core code contributing requirements. @stevepiercy [#4634](https://github.com/plone/volto/issues/4634)
29
+ - Improve creating views documentation page. @rboixaderg [#4636](https://github.com/plone/volto/issues/4636)
30
+ - Razzle upgrade notice in upgrade guide @sneridagh [#4641](https://github.com/plone/volto/issues/4641)
31
+ - Rename "Developer Guidelines" to "Contributing". @stevepiercy [#4666](https://github.com/plone/volto/issues/4666)
32
+ - Fix broken link to `ReactJS.org`. @stevepiercy [#4667](https://github.com/plone/volto/issues/4667)
19
33
 
Binary file
package/CHANGELOG.md CHANGED
@@ -8,6 +8,40 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 17.0.0-alpha.4 (2023-04-12)
12
+
13
+ ### Feature
14
+
15
+ - DefaultView (view of fields for content types with blocks disabled): Show field name as tip on hover of label. @ksuess [#4598](https://github.com/plone/volto/issues/4598)
16
+ - Support RelationList field with named StaticCatalogVocabulary and SelectWidget. @ksuess [#4614](https://github.com/plone/volto/issues/4614)
17
+ - Support for declaring a theme in `volto.config.js` or in `package.json`
18
+ Add two entry points to allow extension of a theme from other add-ons. @sneridagh [#4625](https://github.com/plone/volto/issues/4625)
19
+ - Set sameSite in I18N_LANGUAGE cookie @sneridagh [#4627](https://github.com/plone/volto/issues/4627)
20
+ - Added querystring search get option. @robgietema [#4658](https://github.com/plone/volto/issues/4658)
21
+
22
+ ### Bugfix
23
+
24
+ - Added current page parameter to route in listing and search block pagination - Fix: #3868 @bipoza [#4159](https://github.com/plone/volto/issues/4159)
25
+ - Fix regexp that checks valid URLs and improve tests [cekk] [#4601](https://github.com/plone/volto/issues/4601)
26
+ - Fixed wrong localization on password reset page @iRohitSingh [#4656](https://github.com/plone/volto/issues/4656)
27
+ - fix sitemap.xml.gz not is not compressed @dobri1408 [#4663](https://github.com/plone/volto/issues/4663)
28
+
29
+ ### Internal
30
+
31
+ - Trigger CI workflows to run from external pull requests. @davisagli [#4629](https://github.com/plone/volto/issues/4629)
32
+ - Update to p.restapi 8.36.0 and Plone 6.0.3 @sneridagh [#4682](https://github.com/plone/volto/issues/4682)
33
+
34
+ ### Documentation
35
+
36
+ - Added `JavaScript` and `NodeJS` as accepted spellings, and deviations of them as rejected spellings. @utkkkarshhh [#3092](https://github.com/plone/volto/issues/3092)
37
+ - Fix documentation build, add pins @sneridagh [#4626](https://github.com/plone/volto/issues/4626)
38
+ - Update Volto contributing to align with and refer to the new Plone core code contributing requirements. @stevepiercy [#4634](https://github.com/plone/volto/issues/4634)
39
+ - Improve creating views documentation page. @rboixaderg [#4636](https://github.com/plone/volto/issues/4636)
40
+ - Razzle upgrade notice in upgrade guide @sneridagh [#4641](https://github.com/plone/volto/issues/4641)
41
+ - Rename "Developer Guidelines" to "Contributing". @stevepiercy [#4666](https://github.com/plone/volto/issues/4666)
42
+ - Fix broken link to `ReactJS.org`. @stevepiercy [#4667](https://github.com/plone/volto/issues/4667)
43
+
44
+
11
45
  ## 17.0.0-alpha.3 (2023-03-22)
12
46
 
13
47
  ### Feature
@@ -24,7 +58,7 @@
24
58
 
25
59
  - Deleted duplicate import and fixed training URLs. @yahya-cloud [#4523](https://github.com/plone/volto/issues/4523)
26
60
  - Fix grammar in PR #4542. @stevepiercy [#4555](https://github.com/plone/volto/issues/4555)
27
- - Fix broken links at ReactJS.org. @stevepiercy [#4569](https://github.com/plone/volto/issues/4569)
61
+ - Fix broken links at `ReactJS.org`. @stevepiercy [#4569](https://github.com/plone/volto/issues/4569)
28
62
  - Fix video warnings and link errors. @stevepiercy [#4578](https://github.com/plone/volto/issues/4578)
29
63
 
30
64
 
@@ -112,6 +146,50 @@
112
146
  - Use a universal static path for both documentation and volto repos. @stevepiercy [#4376](https://github.com/plone/volto/issues/4376)
113
147
 
114
148
 
149
+ ## 16.20.0 (2023-04-12)
150
+
151
+ ### Feature
152
+
153
+ - Support RelationList field with named StaticCatalogVocabulary and SelectWidget. @ksuess [#4614](https://github.com/plone/volto/issues/4614)
154
+ - Support for declaring a theme in `volto.config.js` or in `package.json`
155
+ Add two entry points to allow extension of a theme from other add-ons. @sneridagh [#4625](https://github.com/plone/volto/issues/4625)
156
+ - Added querystring search get option. @robgietema [#4658](https://github.com/plone/volto/issues/4658)
157
+
158
+ ### Bugfix
159
+
160
+ - Added current page parameter to route in listing and search block pagination - Fix: #3868 @bipoza [#4159](https://github.com/plone/volto/issues/4159)
161
+ - Fixed wrong localization on password reset page @iRohitSingh [#4656](https://github.com/plone/volto/issues/4656)
162
+ - fix sitemap.xml.gz not is not compressed @dobri1408 [#4663](https://github.com/plone/volto/issues/4663)
163
+
164
+ ### Internal
165
+
166
+ - Update to p.restapi 8.36.0 and Plone 6.0.3 @sneridagh [#4682](https://github.com/plone/volto/issues/4682)
167
+
168
+ ### Documentation
169
+
170
+ - Update Volto contributing to align with and refer to the new Plone core code contributing requirements. @stevepiercy [#4634](https://github.com/plone/volto/issues/4634)
171
+ - Improve creating views documentation page. @rboixaderg [#4636](https://github.com/plone/volto/issues/4636)
172
+ - Rename "Developer Guidelines" to "Contributing". @stevepiercy [#4666](https://github.com/plone/volto/issues/4666)
173
+ - Fix broken link to `ReactJS.org`. @stevepiercy [#4667](https://github.com/plone/volto/issues/4667)
174
+
175
+
176
+ ## 16.19.0 (2023-04-04)
177
+
178
+ ### Feature
179
+
180
+ - DefaultView (view of fields for content types with blocks disabled): Show field name as tip on hover of label. @ksuess [#4598](https://github.com/plone/volto/issues/4598)
181
+ - Set sameSite in I18N_LANGUAGE cookie @sneridagh [#4627](https://github.com/plone/volto/issues/4627)
182
+
183
+ ### Bugfix
184
+
185
+ - Fix regexp that checks valid URLs and improve tests [cekk] [#4601](https://github.com/plone/volto/issues/4601)
186
+
187
+ ### Documentation
188
+
189
+ - Added `JavaScript` and `NodeJS` as accepted spellings, and deviations of them as rejected spellings. @utkkkarshhh [#3092](https://github.com/plone/volto/issues/3092)
190
+ - Fix documentation build, add pins @sneridagh [#4626](https://github.com/plone/volto/issues/4626)
191
+
192
+
115
193
  ## 16.18.0 (2023-03-22)
116
194
 
117
195
  ### Feature
@@ -126,7 +204,7 @@
126
204
 
127
205
  ### Documentation
128
206
 
129
- - Fix broken links at ReactJS.org. @stevepiercy [#4569](https://github.com/plone/volto/issues/4569)
207
+ - Fix broken links at `ReactJS.org`. @stevepiercy [#4569](https://github.com/plone/volto/issues/4569)
130
208
  - Fix video warnings and link errors. @stevepiercy [#4578](https://github.com/plone/volto/issues/4578)
131
209
 
132
210
 
package/addon-registry.js CHANGED
@@ -130,6 +130,11 @@ class AddonConfigurationRegistry {
130
130
  this.packages = {};
131
131
  this.customizations = new Map();
132
132
 
133
+ // Theme from a package.json key, from volto.config.js or from an ENV VAR
134
+ // Programatically via volto.config.js wins or the ENV VAR if present
135
+ this.theme =
136
+ packageJson.theme || this.voltoConfigJS.theme || process.env.THEME;
137
+
133
138
  this.initDevelopmentPackages();
134
139
  this.initPublishedPackages();
135
140
  this.initAddonsFromEnvVar();
@@ -354,6 +359,35 @@ class AddonConfigurationRegistry {
354
359
  .filter((e) => e);
355
360
  }
356
361
 
362
+ getCustomThemeAddons() {
363
+ const customThemeAddonsInfo = {
364
+ variables: [],
365
+ main: [],
366
+ };
367
+
368
+ this.getAddonDependencies().forEach((addon) => {
369
+ const normalizedAddonName = addon.split(':')[0];
370
+ // We have two possible insertion points, variables and main
371
+
372
+ const customThemeVariables = `${this.packages[normalizedAddonName].modulePath}/theme/_variables.scss`;
373
+ const customThemeMain = `${this.packages[normalizedAddonName].modulePath}/theme/_main.scss`;
374
+ if (
375
+ fs.existsSync(customThemeVariables) &&
376
+ normalizedAddonName !== this.theme
377
+ ) {
378
+ customThemeAddonsInfo.variables.push(normalizedAddonName);
379
+ }
380
+ if (
381
+ fs.existsSync(customThemeMain) &&
382
+ normalizedAddonName !== this.theme
383
+ ) {
384
+ customThemeAddonsInfo.main.push(normalizedAddonName);
385
+ }
386
+ });
387
+
388
+ return customThemeAddonsInfo;
389
+ }
390
+
357
391
  /**
358
392
  * Returns a mapping name:diskpath to be uses in webpack's resolve aliases
359
393
  */
@@ -0,0 +1,79 @@
1
+ const path = require('path');
2
+ const fs = require('fs');
3
+ const tmp = require('tmp');
4
+ const cryptoRandomString = require('crypto-random-string');
5
+
6
+ const titleCase = (w) => w.slice(0, 1).toUpperCase() + w.slice(1, w.length);
7
+
8
+ /*
9
+ * Transforms a package name to javascript variable name
10
+ */
11
+ function nameFromPackage(name) {
12
+ name =
13
+ name.replace(/[@~./\\:\s]/gi, '') ||
14
+ cryptoRandomString({ length: 10, characters: 'abcdefghijk' });
15
+ return name
16
+ .split('-')
17
+ .map((w, i) => (i > 0 ? titleCase(w) : w))
18
+ .join('');
19
+ }
20
+
21
+ /*
22
+ * Creates a static file with code necessary to load the addons configuration
23
+ *
24
+ */
25
+ function getAddonsLoaderCode(name, customThemeAddons = []) {
26
+ let buf = `/*
27
+ This file is autogenerated. Don't change it directly.
28
+ Add a ./theme/_${name}.scss in your add-on to load your theme customizations in the current theme.
29
+ */
30
+
31
+ `;
32
+ customThemeAddons.forEach((addon) => {
33
+ const customization = `${addon}/theme/${name}`;
34
+ const line = `@import '${customization}';\n`;
35
+ buf += line;
36
+ });
37
+
38
+ return buf;
39
+ }
40
+
41
+ module.exports = ({ main, variables }) => {
42
+ // const addonsThemeLoaderVariablesPath = path.join(
43
+ // process.cwd(),
44
+ // 'src',
45
+ // '_variables.scss',
46
+ // );
47
+ // const addonsThemeLoaderMainPath = path.join(
48
+ // process.cwd(),
49
+ // 'src',
50
+ // '_main.scss',
51
+ // );
52
+
53
+ // const addonsThemeLoaderVariablesPath = path.join(
54
+ // process.cwd(),
55
+ // 'src',
56
+ // '_variables.scss',
57
+ // );
58
+ // const addonsThemeLoaderMainPath = path.join(
59
+ // process.cwd(),
60
+ // 'src',
61
+ // '_main.scss',
62
+ // );
63
+
64
+ const addonsThemeLoaderVariablesPath = tmp.tmpNameSync({ postfix: '.scss' });
65
+ const addonsThemeLoaderMainPath = tmp.tmpNameSync({ postfix: '.scss' });
66
+ fs.writeFileSync(
67
+ addonsThemeLoaderVariablesPath,
68
+ new Buffer.from(getAddonsLoaderCode('variables', variables)),
69
+ );
70
+ fs.writeFileSync(
71
+ addonsThemeLoaderMainPath,
72
+ new Buffer.from(getAddonsLoaderCode('main', main)),
73
+ );
74
+
75
+ return [addonsThemeLoaderVariablesPath, addonsThemeLoaderMainPath];
76
+ };
77
+
78
+ module.exports.getAddonsLoaderCode = getAddonsLoaderCode;
79
+ module.exports.nameFromPackage = nameFromPackage;
@@ -2098,7 +2098,7 @@ msgid "My email is"
2098
2098
  msgstr ""
2099
2099
 
2100
2100
  #: components/theme/PasswordReset/PasswordReset
2101
- # defaultMessage: My username is
2101
+ # defaultMessage: My user name is
2102
2102
  msgid "My username is"
2103
2103
  msgstr "El meu nom d'usuari és"
2104
2104
 
@@ -4193,7 +4193,7 @@ msgid "label_my_email_is"
4193
4193
  msgstr ""
4194
4194
 
4195
4195
  #: components/theme/PasswordReset/RequestPasswordReset
4196
- # defaultMessage: My username is
4196
+ # defaultMessage: My user name is
4197
4197
  msgid "label_my_username_is"
4198
4198
  msgstr "El meu nom d'usuari és"
4199
4199
 
@@ -2095,9 +2095,9 @@ msgid "My email is"
2095
2095
  msgstr "Meine E-Mail ist"
2096
2096
 
2097
2097
  #: components/theme/PasswordReset/PasswordReset
2098
- # defaultMessage: My username is
2098
+ # defaultMessage: My user name is
2099
2099
  msgid "My username is"
2100
- msgstr "Mein Benutzername ist"
2100
+ msgstr "Mein Nutzername lautet"
2101
2101
 
2102
2102
  #: components/manage/Sharing/Sharing
2103
2103
  #: components/theme/ContactForm/ContactForm
@@ -4190,9 +4190,9 @@ msgid "label_my_email_is"
4190
4190
  msgstr "Meine E-Mail ist"
4191
4191
 
4192
4192
  #: components/theme/PasswordReset/RequestPasswordReset
4193
- # defaultMessage: My username is
4193
+ # defaultMessage: My user name is
4194
4194
  msgid "label_my_username_is"
4195
- msgstr "El meu nom d'usuari és"
4195
+ msgstr "Mein Nutzername lautet"
4196
4196
 
4197
4197
  #: config/Blocks
4198
4198
  # defaultMessage: Lead Image Field