@kitconcept/volto-light-theme 5.0.1 → 6.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 (112) hide show
  1. package/.changelog.draft +26 -6
  2. package/CHANGELOG.md +32 -0
  3. package/README.md +7 -367
  4. package/package.json +20 -7
  5. package/razzle.extend.js +38 -0
  6. package/src/components/Anontools/Anontools.jsx +1 -1
  7. package/src/components/Blocks/Button/schema.js +25 -5
  8. package/src/components/Blocks/EventMetadata/View.jsx +8 -7
  9. package/src/components/Blocks/Image/Edit.jsx +4 -6
  10. package/src/components/Blocks/Image/ImageSidebar.jsx +4 -2
  11. package/src/components/Blocks/Image/View.jsx +3 -6
  12. package/src/components/Blocks/Image/schema.js +37 -6
  13. package/src/components/Blocks/Listing/DefaultTemplate.jsx +3 -2
  14. package/src/components/Blocks/Listing/GridTemplate.jsx +4 -2
  15. package/src/components/Blocks/Listing/ImageGallery.jsx +2 -2
  16. package/src/components/Blocks/Listing/SummaryTemplate.jsx +3 -2
  17. package/src/components/Blocks/Search/components/SearchInput.jsx +1 -1
  18. package/src/components/Blocks/Separator/schema.js +59 -0
  19. package/src/components/Blocks/Slider/DefaultBody.jsx +4 -2
  20. package/src/components/Blocks/Teaser/schema.js +21 -1
  21. package/src/components/Blocks/schema.js +16 -15
  22. package/src/components/Breadcrumbs/Breadcrumbs.jsx +4 -3
  23. package/src/components/Footer/Footer.jsx +77 -27
  24. package/src/components/Header/Header.jsx +34 -29
  25. package/src/components/LanguageSelector/{LanguageSelector.js → LanguageSelector.jsx} +11 -7
  26. package/src/components/Logo/Logo.jsx +28 -22
  27. package/src/components/MobileNavigation/MobileNavigation.jsx +3 -2
  28. package/src/components/MobileNavigation/MobileToolsFooter.jsx +1 -1
  29. package/src/components/Navigation/Navigation.jsx +4 -3
  30. package/src/components/SearchWidget/IntranetSearchWidget.jsx +1 -1
  31. package/src/components/SearchWidget/SearchWidget.jsx +1 -1
  32. package/src/components/Theme/EventView.jsx +3 -2
  33. package/src/components/Theme/FileView.jsx +1 -1
  34. package/src/components/Theme/NewsItemView.jsx +1 -1
  35. package/src/components/Theming/Theming.tsx +52 -0
  36. package/src/components/Widgets/AlignWidget.jsx +2 -2
  37. package/src/components/Widgets/BackgroundColorWidget.tsx +18 -0
  38. package/src/components/Widgets/BlockAlignmentWidget.tsx +81 -0
  39. package/src/components/Widgets/BlockWidthWidget.tsx +94 -0
  40. package/src/components/Widgets/BlocksObjectWidget.tsx +333 -0
  41. package/src/components/Widgets/ButtonsWidget.tsx +68 -0
  42. package/src/components/Widgets/ColorPickerWidget.tsx +60 -0
  43. package/src/components/Widgets/FooterLinksWidget.tsx +106 -0
  44. package/src/components/Widgets/FooterLogosWidget.tsx +120 -0
  45. package/src/components/Widgets/ThemingColorPicker.tsx +33 -0
  46. package/src/config/blocks.tsx +352 -0
  47. package/src/config/classExtenders.ts +101 -0
  48. package/src/config/settings.ts +35 -0
  49. package/src/config/slots.ts +12 -0
  50. package/src/config/widgets.ts +31 -0
  51. package/src/customizations/volto/components/theme/View/RenderBlocks.jsx +97 -80
  52. package/src/customizations/volto/components/theme/View/RenderBlocks.test.jsx +16 -48
  53. package/src/helpers/helpers.test.ts +51 -0
  54. package/src/helpers/helpers.ts +48 -0
  55. package/src/index.ts +54 -0
  56. package/src/theme/_bgcolor-blocks-layout.scss +1127 -20
  57. package/src/theme/_footer.scss +8 -5
  58. package/src/theme/_header.scss +3 -8
  59. package/src/theme/_layout.scss +24 -7
  60. package/src/theme/_typo-custom.scss +1 -1
  61. package/src/theme/_variables.scss +95 -12
  62. package/src/theme/_widgets.scss +102 -0
  63. package/src/theme/blocks/_accordion.scss +2 -4
  64. package/src/theme/blocks/_button.scss +32 -31
  65. package/src/theme/blocks/_eventMetadata.scss +7 -0
  66. package/src/theme/blocks/_grid.scss +11 -36
  67. package/src/theme/blocks/_highlight.scss +1 -0
  68. package/src/theme/blocks/_image.scss +38 -17
  69. package/src/theme/blocks/_introduction.scss +16 -0
  70. package/src/theme/blocks/_listing.scss +1 -6
  71. package/src/theme/blocks/_search.scss +1 -23
  72. package/src/theme/blocks/_separator.scss +17 -20
  73. package/src/theme/blocks/_slider.scss +57 -56
  74. package/src/theme/blocks/_teaser.scss +3 -3
  75. package/src/theme/main.scss +1 -0
  76. package/src/transforms/to6.ts +94 -0
  77. package/tsconfig.json +33 -0
  78. package/.release-it.json +0 -31
  79. package/babel.config.js +0 -17
  80. package/build/messages/src/components/Anontools/Anontools.json +0 -10
  81. package/build/messages/src/components/Blocks/Button/schema.json +0 -6
  82. package/build/messages/src/components/Blocks/EventMetadata/View.json +0 -30
  83. package/build/messages/src/components/Blocks/Image/Edit.json +0 -10
  84. package/build/messages/src/components/Blocks/Image/ImageSidebar.json +0 -18
  85. package/build/messages/src/components/Blocks/Image/schema.json +0 -10
  86. package/build/messages/src/components/Blocks/Listing/ListingBody.json +0 -26
  87. package/build/messages/src/components/Blocks/Search/TopSideFacets.json +0 -10
  88. package/build/messages/src/components/Blocks/Search/components/SearchDetails.json +0 -10
  89. package/build/messages/src/components/Blocks/Search/components/SearchInput.json +0 -6
  90. package/build/messages/src/components/Blocks/Slider/DefaultBody.json +0 -18
  91. package/build/messages/src/components/Blocks/Slider/schema.json +0 -14
  92. package/build/messages/src/components/Blocks/schema.json +0 -6
  93. package/build/messages/src/components/Breadcrumbs/Breadcrumbs.json +0 -10
  94. package/build/messages/src/components/Footer/Footer.json +0 -30
  95. package/build/messages/src/components/Header/Header.json +0 -6
  96. package/build/messages/src/components/LanguageSelector/LanguageSelector.json +0 -6
  97. package/build/messages/src/components/Logo/Logo.json +0 -10
  98. package/build/messages/src/components/MobileNavigation/MobileNavigation.json +0 -26
  99. package/build/messages/src/components/Navigation/Navigation.json +0 -10
  100. package/build/messages/src/components/SearchWidget/IntranetSearchWidget.json +0 -14
  101. package/build/messages/src/components/SearchWidget/SearchWidget.json +0 -10
  102. package/build/messages/src/components/Theme/EventView.json +0 -6
  103. package/build/messages/src/components/Widgets/AlignWidget.json +0 -22
  104. package/build/messages/src/index.json +0 -10
  105. package/news/.gitkeep +0 -0
  106. package/src/components/Atoms/Container/Container.jsx +0 -32
  107. package/src/components/Atoms/README.md +0 -1
  108. package/src/components/Atoms/helpers.jsx +0 -9
  109. package/src/components/CQPolyfill.jsx +0 -9
  110. package/src/index.js +0 -367
  111. package/towncrier.toml +0 -33
  112. /package/src/components/Blocks/Slate/{ExtraAlignWrapper.js → ExtraAlignWrapper.jsx} +0 -0
@@ -0,0 +1,33 @@
1
+ import { ColorField, ColorPicker } from '@plone/components';
2
+ import FormFieldWrapper from '@plone/volto/components/manage/Widgets/FormFieldWrapper';
3
+
4
+ import '@plone/components/src/styles/basic/ColorPicker.css';
5
+
6
+ const ColorPickerWidget = (props: {
7
+ id: string;
8
+ title: string;
9
+ value: string;
10
+ default: string;
11
+ onChange: (id: string, value: any) => void;
12
+ }) => {
13
+ return (
14
+ <FormFieldWrapper {...props} className="color">
15
+ <ColorPicker
16
+ defaultValue="#ffffff"
17
+ onChange={(value) =>
18
+ props.onChange(props.id, value?.toString('hex') || null)
19
+ }
20
+ value={props.value || '#ffffff'}
21
+ />
22
+ <ColorField
23
+ aria-label={`Pick a color for ${props.title}`}
24
+ value={props.value}
25
+ onChange={(value) =>
26
+ props.onChange(props.id, value?.toString('hex') || null)
27
+ }
28
+ />
29
+ </FormFieldWrapper>
30
+ );
31
+ };
32
+
33
+ export default ColorPickerWidget;
@@ -0,0 +1,352 @@
1
+ import type { ConfigType } from '@plone/registry';
2
+ import type { StyleDefinition } from '@plone/types';
3
+
4
+ import cloneDeep from 'lodash/cloneDeep';
5
+
6
+ import { composeSchema } from '@plone/volto/helpers/Extensions';
7
+ import { findStyleByName } from '@plone/volto/helpers/Blocks/Blocks';
8
+ import { defaultStylingSchema } from '../components/Blocks/schema';
9
+ import { teaserSchemaEnhancer } from '../components/Blocks/Teaser/schema';
10
+ import { videoBlockSchemaEnhancer } from '../components/Blocks/Video/schema';
11
+ import { gridTeaserDisableStylingSchema } from '@plone/volto/components/manage/Blocks/Teaser/schema';
12
+ import { gridImageDisableSizeAndPositionHandlersSchema } from '@plone/volto/components/manage/Blocks/Image/schema';
13
+ import { disableBgColorSchema } from '../components/Blocks/disableBgColorSchema';
14
+
15
+ import TopSideFacets from '../components/Blocks/Search/TopSideFacets';
16
+
17
+ import GridListingBlockTemplate from '../components/Blocks/Listing/GridTemplate';
18
+ import { ButtonStylingSchema } from '../components/Blocks/Button/schema';
19
+ import { SeparatorStylingSchema } from '../components/Blocks/Separator/schema';
20
+
21
+ import { imageBlockSchemaEnhancer } from '../components/Blocks/Image/schema';
22
+ import { ImageBlockDataAdapter } from '../components/Blocks/Image/adapter';
23
+
24
+ import { AccordionSchemaEnhancer } from '../components/Blocks/Accordion/schema';
25
+
26
+ import { searchBlockSchemaEnhancer } from '../components/Blocks/Search/schema';
27
+
28
+ import gridSVG from '../icons/block_icn_grid.svg';
29
+ import accordionSVG from '../icons/block_icn_accordion.svg';
30
+ import descriptionSVG from '@plone/volto/icons/description.svg';
31
+
32
+ import { tocBlockSchemaEnhancer } from '../components/Blocks/Toc/schema';
33
+ import { mapsBlockSchemaEnhancer } from '../components/Blocks/Maps/schema';
34
+ import { sliderBlockSchemaEnhancer } from '../components/Blocks/Slider/schema';
35
+ import EventMetadataView from '../components/Blocks/EventMetadata/View';
36
+
37
+ declare module '@plone/types' {
38
+ export interface BlocksConfigData {
39
+ introduction: BlockConfigBase;
40
+ heading: BlockConfigBase;
41
+ __button: BlockConfigBase;
42
+ separator: BlockConfigBase;
43
+ slider: BlockConfigBase;
44
+ eventMetadata: BlockConfigBase;
45
+ accordion: BlockConfigBase;
46
+ hero: BlockConfigBase;
47
+ slateTable: BlockConfigBase;
48
+ }
49
+ export interface BlockConfigBase {
50
+ themes?: StyleDefinition[];
51
+ allowedBlocks?: string[];
52
+ allowed_headline_tags?: string[][];
53
+ dataAdapter?: any;
54
+ unwantedButtons?: string[];
55
+ imageScale?: string;
56
+ allowed_headings?: string[][];
57
+ }
58
+ export interface BlocksFormData {
59
+ headline: string;
60
+ styles: string;
61
+ }
62
+ }
63
+
64
+ export default function install(config: ConfigType) {
65
+ // Initial block for event content type
66
+ config.blocks.initialBlocks = {
67
+ Event: [
68
+ { '@type': 'title' },
69
+ { '@type': 'eventMetadata', fixed: true, required: true },
70
+ { '@type': 'slate' },
71
+ ],
72
+ };
73
+
74
+ // Palettes
75
+ config.blocks.themes = [
76
+ {
77
+ style: {
78
+ '--theme-color': '#fff', // Block Wrapper
79
+ '--theme-high-contrast-color': '#ecebeb', // Cards in Grid block
80
+ '--theme-foreground-color': '#000',
81
+ '--theme-low-contrast-foreground-color': '#555555',
82
+ },
83
+ name: 'default',
84
+ label: 'Default',
85
+ },
86
+ {
87
+ style: {
88
+ '--theme-color': '#ecebeb',
89
+ '--theme-high-contrast-color': '#fff',
90
+ '--theme-foreground-color': '#000',
91
+ '--theme-low-contrast-foreground-color': '#555555',
92
+ },
93
+ name: 'grey',
94
+ label: 'Grey',
95
+ },
96
+ ];
97
+
98
+ // Default block widths
99
+ config.blocks.widths = [
100
+ {
101
+ style: {
102
+ '--block-width': 'var(--narrow-container-width)',
103
+ },
104
+ name: 'narrow',
105
+ label: 'Narrow',
106
+ },
107
+ {
108
+ style: {
109
+ '--block-width': 'var(--default-container-width)',
110
+ },
111
+ name: 'default',
112
+ label: 'Default',
113
+ },
114
+ {
115
+ style: {
116
+ '--block-width': 'var(--layout-container-width)',
117
+ },
118
+ name: 'layout',
119
+ label: 'Layout',
120
+ },
121
+ {
122
+ style: {
123
+ '--block-width': '100%',
124
+ },
125
+ name: 'full',
126
+ label: 'Full Width',
127
+ },
128
+ ];
129
+
130
+ function blockThemesEnhancer(data) {
131
+ if (!data['@type']) return {};
132
+ if (data.theme) {
133
+ const blockConfig = config.blocks.blocksConfig[data['@type']];
134
+ const blockStyleDefinitions =
135
+ // We look up for the blockThemes in the block's config, then in the global config
136
+ // We keep `colors` for BBB, but `themes` should be used
137
+ blockConfig.themes || blockConfig.colors || config.blocks.themes || [];
138
+ return data.theme
139
+ ? findStyleByName(blockStyleDefinitions, data.theme)
140
+ : {};
141
+ } else {
142
+ // No theme, return default color
143
+ return findStyleByName(config.blocks.themes, 'default');
144
+ }
145
+ }
146
+
147
+ config.registerUtility({
148
+ name: 'blockThemesEnhancer',
149
+ type: 'styleWrapperStyleObjectEnhancer',
150
+ method: blockThemesEnhancer,
151
+ });
152
+
153
+ // No required blocks (eg. Title)
154
+ config.blocks.requiredBlocks = [
155
+ ...config.blocks.requiredBlocks,
156
+ 'eventMetadata',
157
+ ];
158
+
159
+ // Remove Hero Block (No longer in Volto 18)
160
+ // TODO: Remove already?
161
+ if (config.blocks.blocksConfig?.hero) {
162
+ config.blocks.blocksConfig.hero.restricted = true;
163
+ }
164
+
165
+ // Default Blocks configuration
166
+
167
+ config.blocks.blocksConfig.accordion = {
168
+ ...config.blocks.blocksConfig.accordion,
169
+ mostUsed: true,
170
+ icon: accordionSVG,
171
+ allowedBlocks: [
172
+ 'slate',
173
+ 'teaser',
174
+ 'image',
175
+ 'listing',
176
+ 'slateTable',
177
+ 'separator',
178
+ ],
179
+ // Not needed anymore, as we have the the fallback in the StyleWrapperEnhancer
180
+ schemaEnhancer: composeSchema(
181
+ AccordionSchemaEnhancer,
182
+ defaultStylingSchema,
183
+ ),
184
+ sidebarTab: 1,
185
+ };
186
+
187
+ config.blocks.blocksConfig.slateTable = {
188
+ ...config.blocks.blocksConfig.slateTable,
189
+ schemaEnhancer: defaultStylingSchema,
190
+ };
191
+
192
+ config.blocks.blocksConfig.listing = {
193
+ ...config.blocks.blocksConfig.listing,
194
+ schemaEnhancer: defaultStylingSchema,
195
+ allowed_headline_tags: [['h2', 'h2']],
196
+ variations: [
197
+ ...config.blocks.blocksConfig.listing.variations,
198
+ {
199
+ id: 'grid',
200
+ title: 'Grid',
201
+ template: GridListingBlockTemplate,
202
+ },
203
+ ],
204
+ };
205
+
206
+ config.blocks.blocksConfig.image = {
207
+ ...config.blocks.blocksConfig.image,
208
+ schemaEnhancer: composeSchema(
209
+ defaultStylingSchema,
210
+ imageBlockSchemaEnhancer,
211
+ ),
212
+ dataAdapter: ImageBlockDataAdapter,
213
+ };
214
+
215
+ // Accordion internal `blocksConfig` amendments
216
+ // We cloneDeep the blocksConfig to avoid modifying the original object
217
+ // in subsequent modifications of the accordion block config
218
+ config.blocks.blocksConfig.accordion.blocksConfig = cloneDeep(
219
+ config.blocks.blocksConfig,
220
+ );
221
+
222
+ config.blocks.blocksConfig.accordion.blocksConfig.teaser.schemaEnhancer =
223
+ composeSchema(teaserSchemaEnhancer, disableBgColorSchema);
224
+
225
+ config.blocks.blocksConfig.gridBlock.themes = config.blocks.themes;
226
+ config.blocks.blocksConfig.gridBlock.schemaEnhancer = defaultStylingSchema;
227
+ config.blocks.blocksConfig.gridBlock.icon = gridSVG;
228
+
229
+ // Grids internal `blocksConfig` amendments
230
+ // Slate in grids must have an extra wrapper with the `slate` className
231
+ const OriginalSlateBlockView = config.blocks.blocksConfig.slate.view;
232
+ config.blocks.blocksConfig.gridBlock.blocksConfig.slate.view = (props) => {
233
+ return (
234
+ <div className="slate">
235
+ <OriginalSlateBlockView {...props} />
236
+ </div>
237
+ );
238
+ };
239
+
240
+ config.blocks.blocksConfig.gridBlock.blocksConfig.image.schemaEnhancer =
241
+ composeSchema(
242
+ imageBlockSchemaEnhancer,
243
+ gridImageDisableSizeAndPositionHandlersSchema,
244
+ );
245
+ config.blocks.blocksConfig.gridBlock.blocksConfig.image.dataAdapter =
246
+ ImageBlockDataAdapter;
247
+
248
+ config.blocks.blocksConfig.gridBlock.blocksConfig.teaser.schemaEnhancer =
249
+ composeSchema(gridTeaserDisableStylingSchema, teaserSchemaEnhancer);
250
+
251
+ config.blocks.blocksConfig.gridBlock.blocksConfig.listing.allowed_headline_tags =
252
+ [['h2', 'h2']];
253
+
254
+ config.blocks.blocksConfig.introduction = {
255
+ ...config.blocks.blocksConfig.introduction,
256
+ unwantedButtons: ['heading-three', 'blockquote'],
257
+ schemaEnhancer: defaultStylingSchema,
258
+ };
259
+
260
+ config.blocks.blocksConfig.slate = {
261
+ ...config.blocks.blocksConfig.slate,
262
+ schemaEnhancer: defaultStylingSchema,
263
+ sidebarTab: 1,
264
+ };
265
+
266
+ config.blocks.blocksConfig.teaser = {
267
+ ...config.blocks.blocksConfig.teaser,
268
+ group: 'teasers',
269
+ imageScale: 'larger',
270
+ schemaEnhancer: composeSchema(defaultStylingSchema, teaserSchemaEnhancer),
271
+ };
272
+
273
+ config.blocks.blocksConfig.video = {
274
+ ...config.blocks.blocksConfig.video,
275
+ schemaEnhancer: composeSchema(
276
+ defaultStylingSchema,
277
+ videoBlockSchemaEnhancer,
278
+ ),
279
+ };
280
+ config.blocks.blocksConfig.maps = {
281
+ ...config.blocks.blocksConfig.maps,
282
+ schemaEnhancer: composeSchema(
283
+ defaultStylingSchema,
284
+ mapsBlockSchemaEnhancer,
285
+ ),
286
+ };
287
+
288
+ config.blocks.blocksConfig.heading = {
289
+ ...config.blocks.blocksConfig.heading,
290
+ sidebarTab: 0,
291
+ allowed_headings: [['h2', 'h2']],
292
+ schemaEnhancer: defaultStylingSchema,
293
+ };
294
+
295
+ config.blocks.blocksConfig.search = {
296
+ ...config.blocks.blocksConfig.search,
297
+ schemaEnhancer: composeSchema(
298
+ defaultStylingSchema,
299
+ searchBlockSchemaEnhancer,
300
+ ),
301
+ variations: [
302
+ {
303
+ id: 'facetsTopSide',
304
+ title: 'Facets on top',
305
+ view: TopSideFacets,
306
+ isDefault: true,
307
+ },
308
+ ],
309
+ };
310
+
311
+ config.blocks.blocksConfig.__button = {
312
+ ...config.blocks.blocksConfig.__button,
313
+ schemaEnhancer: ButtonStylingSchema,
314
+ };
315
+
316
+ config.blocks.blocksConfig.eventMetadata = {
317
+ id: 'eventMetadata',
318
+ title: 'EventMetadata',
319
+ icon: descriptionSVG,
320
+ group: 'common',
321
+ view: EventMetadataView,
322
+ edit: EventMetadataView,
323
+ restricted: ({ properties, block }) =>
324
+ properties['@type'] === 'Event' ? false : true,
325
+ mostUsed: false,
326
+ sidebarTab: 0,
327
+ };
328
+
329
+ // Check if the separator is present before enhancing it
330
+ if (config.blocks.blocksConfig?.separator?.id) {
331
+ config.blocks.blocksConfig.separator = {
332
+ ...config.blocks.blocksConfig.separator,
333
+ schemaEnhancer: SeparatorStylingSchema,
334
+ };
335
+ }
336
+
337
+ // TOC Block
338
+ config.blocks.blocksConfig.toc = {
339
+ ...config.blocks.blocksConfig.toc,
340
+ schemaEnhancer: composeSchema(tocBlockSchemaEnhancer, defaultStylingSchema),
341
+ // remove horizontal variation
342
+ variations: [config.blocks.blocksConfig.toc.variations[0]],
343
+ };
344
+
345
+ // Slider Block
346
+ config.blocks.blocksConfig.slider = {
347
+ ...config.blocks.blocksConfig.slider,
348
+ schemaEnhancer: sliderBlockSchemaEnhancer,
349
+ };
350
+
351
+ return config;
352
+ }
@@ -0,0 +1,101 @@
1
+ import type { ConfigType } from '@plone/registry';
2
+ import { getPreviousNextBlock } from '@plone/volto/helpers/Blocks/Blocks';
3
+ import { getCurrentStyleByName } from '../helpers/helpers';
4
+
5
+ export default function install(config: ConfigType) {
6
+ // Register custom StyleWrapper ClassNames
7
+ config.settings.styleClassNameExtenders = [
8
+ ({ block, content, data, classNames }) => {
9
+ let styles = [];
10
+ const [previousBlock, nextBlock] = getPreviousNextBlock({
11
+ content,
12
+ block,
13
+ });
14
+
15
+ // Inject a class depending of which type is the next block
16
+ if (nextBlock?.['@type']) {
17
+ styles.push(`next--is--${nextBlock['@type']}`);
18
+ }
19
+
20
+ // Inject a class depending if previous is the same type of block
21
+ if (data?.['@type'] === previousBlock?.['@type']) {
22
+ styles.push('previous--is--same--block-type');
23
+ }
24
+
25
+ // Inject a class depending if next is the same type of block
26
+ if (data?.['@type'] === nextBlock?.['@type']) {
27
+ styles.push('next--is--same--block-type');
28
+ }
29
+
30
+ // Inject a class depending if it's the first of block type
31
+ if (data?.['@type'] !== previousBlock?.['@type']) {
32
+ styles.push('is--first--of--block-type');
33
+ }
34
+
35
+ // Inject a class depending if it's the last of block type
36
+ if (data?.['@type'] !== nextBlock?.['@type']) {
37
+ styles.push('is--last--of--block-type');
38
+ }
39
+
40
+ // Inject a class depending if it has a headline
41
+ if (data?.headline || previousBlock?.['@type'] === 'heading') {
42
+ styles.push('has--headline');
43
+ }
44
+
45
+ // Given a StyleWrapper defined `backgroundColor` style
46
+ const previousColor = previousBlock?.theme || 'default';
47
+
48
+ const currentColor = data?.theme || 'default';
49
+
50
+ const nextColor = nextBlock?.theme || 'default';
51
+
52
+ // Inject a class depending if the previous block has the same `backgroundColor`
53
+ if (currentColor === previousColor) {
54
+ styles.push('previous--has--same--backgroundColor');
55
+ } else if (currentColor !== previousColor) {
56
+ styles.push('previous--has--different--backgroundColor');
57
+ }
58
+
59
+ // Inject a class depending if the next block has the same `backgroundColor`
60
+ if (currentColor === nextColor) {
61
+ styles.push('next--has--same--backgroundColor');
62
+ } else if (currentColor !== nextColor) {
63
+ styles.push('next--has--different--backgroundColor');
64
+ }
65
+
66
+ return [...classNames, ...styles];
67
+ },
68
+ ];
69
+
70
+ // Blocks width convenience classes injection
71
+ config.settings.styleClassNameExtenders.push(
72
+ ({ data, classNames }: { data: any; classNames: Array<string> }) => {
73
+ const currentBlockWidth =
74
+ getCurrentStyleByName(
75
+ config.blocks.widths,
76
+ 'blockWidth:noprefix',
77
+ data,
78
+ ) || 'default';
79
+ if (currentBlockWidth) {
80
+ return [...classNames, `has--block-width--${currentBlockWidth}`];
81
+ }
82
+ return classNames;
83
+ },
84
+ );
85
+
86
+ config.settings.styleClassNameExtenders.push(
87
+ ({ data, classNames }: { data: any; classNames: Array<string> }) => {
88
+ const currentBlockBackgroundColor = data?.theme || 'default';
89
+ if (currentBlockBackgroundColor) {
90
+ // This has intentionally a different class name than in `VLT3`
91
+ return [
92
+ ...classNames,
93
+ `has--background-color--${currentBlockBackgroundColor}`,
94
+ ];
95
+ }
96
+ return classNames;
97
+ },
98
+ );
99
+
100
+ return config;
101
+ }
@@ -0,0 +1,35 @@
1
+ import type { ConfigType } from '@plone/registry';
2
+
3
+ declare module '@plone/types' {
4
+ export interface SettingsConfig {
5
+ slate: {
6
+ useLinkedHeadings: boolean;
7
+ };
8
+ userDefinedControlPanelColors: string[];
9
+ }
10
+ }
11
+
12
+ export default function install(config: ConfigType) {
13
+ config.settings.enableAutoBlockGroupingByBackgroundColor = true;
14
+ config.settings.navDepth = 3;
15
+ config.settings.enableFatMenu = true;
16
+ config.settings.slate.useLinkedHeadings = false;
17
+ config.settings.contentMetadataTagsImageField = 'preview_image';
18
+ config.settings.querystringSearchGet = true;
19
+
20
+ config.settings.siteLabel = '';
21
+ config.settings.intranetHeader = false;
22
+
23
+ config.settings.slidingSearchAnimation = true;
24
+ config.settings.openExternalLinkInNewTab = true;
25
+ config.settings.userDefinedControlPanelColors = [
26
+ 'accent_color',
27
+ 'accent_foreground_color',
28
+ 'primary_color',
29
+ 'primary_foreground_color',
30
+ 'secondary_color',
31
+ 'secondary_foreground_color',
32
+ ];
33
+
34
+ return config;
35
+ }
@@ -0,0 +1,12 @@
1
+ import type { ConfigType } from '@plone/registry';
2
+ import Theming from '../components/Theming/Theming';
3
+
4
+ export default function install(config: ConfigType) {
5
+ config.registerSlotComponent({
6
+ slot: 'aboveHeader',
7
+ name: 'Theming',
8
+ component: Theming,
9
+ });
10
+
11
+ return config;
12
+ }
@@ -0,0 +1,31 @@
1
+ import type { ConfigType } from '@plone/registry';
2
+ import ThemingColorPicker from '../components/Widgets/ThemingColorPicker';
3
+ import BackgroundColorWidget from '../components/Widgets/BackgroundColorWidget';
4
+ import BlockWidthWidget from '../components/Widgets/BlockWidthWidget';
5
+ import BlockAlignmentWidget from '../components/Widgets/BlockAlignmentWidget';
6
+ import ColorPickerWidget from '../components/Widgets/ColorPickerWidget';
7
+ import FooterLogosWidget from '../components/Widgets/FooterLogosWidget';
8
+ import FooterLinksWidget from '../components/Widgets/FooterLinksWidget';
9
+
10
+ declare module '@plone/types' {
11
+ export interface WidgetsConfigByWidget {
12
+ BackgroundColorWidget: React.ComponentType<any>;
13
+ blockWidth: React.ComponentType<any>;
14
+ blockAlignment: React.ComponentType<any>;
15
+ themingColorPicker: typeof ThemingColorPicker;
16
+ footerLogos: typeof FooterLogosWidget;
17
+ footerLinks: typeof FooterLinksWidget;
18
+ }
19
+ }
20
+
21
+ export default function install(config: ConfigType) {
22
+ config.widgets.widget.BackgroundColorWidget = BackgroundColorWidget;
23
+ config.widgets.widget.blockWidth = BlockWidthWidget;
24
+ config.widgets.widget.blockAlignment = BlockAlignmentWidget;
25
+ config.widgets.widget.color_picker = ColorPickerWidget;
26
+ config.widgets.widget.themingColorPicker = ThemingColorPicker;
27
+ config.widgets.widget.footerLogos = FooterLogosWidget;
28
+ config.widgets.widget.footerLinks = FooterLinksWidget;
29
+
30
+ return config;
31
+ }