@total_onion/onion-library 2.0.23 → 2.0.25
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/checkBuildAssets.js +18 -0
- package/components/block-block-interactions-v3/group_687e1575ba23d.json +9 -2
- package/components/block-carousel-multi-layout-v3/carousel-multi-layout-v3.js +10 -5
- package/components/block-carousel-multi-layout-v3/group_686bd42e551d6.json +2 -5
- package/components/block-post-info-v3/post-info-v3/post-link.twig +1 -1
- package/createJsAssets.js +31 -0
- package/createPreviewScss.js +35 -0
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* eslint-disable global-require */
|
|
2
|
+
require('dotenv').config();
|
|
3
|
+
const fs = require( 'fs' );
|
|
4
|
+
const themePath = process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
5
|
+
|
|
6
|
+
const paths = {
|
|
7
|
+
createJsAssets:
|
|
8
|
+
`${themePath}/assets/js/modules/jsAssets.js`,
|
|
9
|
+
createPreviewScss:
|
|
10
|
+
`${themePath}/assets/scss/modules/dynamicBlocksPreview.scss`,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
Object.keys( paths ).forEach( ( key ) => {
|
|
14
|
+
if ( ! fs.existsSync( paths[ key ] ) ) {
|
|
15
|
+
console.log( `creating missing assets with ${ key }` );
|
|
16
|
+
require( 'child_process' ).fork( `./node_modules/@pernod-ricard-global-cms/jsbuildutils/${ key }.js` );
|
|
17
|
+
}
|
|
18
|
+
} );
|
|
@@ -554,14 +554,21 @@
|
|
|
554
554
|
"class": "",
|
|
555
555
|
"id": ""
|
|
556
556
|
},
|
|
557
|
+
"hide_field": "",
|
|
558
|
+
"hide_label": "",
|
|
559
|
+
"hide_instructions": "",
|
|
560
|
+
"hide_required": "",
|
|
557
561
|
"wpml_cf_preferences": 3,
|
|
558
562
|
"clone": [
|
|
559
|
-
"
|
|
563
|
+
"group_689f66f3e26df"
|
|
560
564
|
],
|
|
561
565
|
"display": "seamless",
|
|
562
566
|
"layout": "block",
|
|
563
567
|
"prefix_label": 0,
|
|
564
568
|
"prefix_name": 0,
|
|
569
|
+
"acfe_settings": "",
|
|
570
|
+
"instruction_placement": "",
|
|
571
|
+
"acfe_permissions": "",
|
|
565
572
|
"acfe_seamless_style": 0,
|
|
566
573
|
"acfe_clone_modal": 0,
|
|
567
574
|
"acfe_clone_modal_close": 0,
|
|
@@ -682,5 +689,5 @@
|
|
|
682
689
|
"acfe_permissions": "",
|
|
683
690
|
"acfe_meta": "",
|
|
684
691
|
"acfe_note": "",
|
|
685
|
-
"modified":
|
|
692
|
+
"modified": 1759416263
|
|
686
693
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {getSwiperAssetsV2} from '@total_onion/onion-utils/onion-utils.mjs';
|
|
2
|
-
import {
|
|
2
|
+
import {Navigation, Pagination, Autoplay} from 'swiper/modules';
|
|
3
3
|
// import Swiper and modules styles
|
|
4
4
|
import 'swiper/css';
|
|
5
5
|
import 'swiper/css/navigation';
|
|
@@ -10,9 +10,7 @@ export default function carouselmultilayoutv3Js(options = {}) {
|
|
|
10
10
|
const {block} = options;
|
|
11
11
|
const totalSlides = block.querySelectorAll('.swiper-slide').length || 1;
|
|
12
12
|
Promise.all([getSwiperAssetsV2()]).then((values) => {
|
|
13
|
-
const {
|
|
14
|
-
Swiper
|
|
15
|
-
} = values[0][0];
|
|
13
|
+
const {Swiper} = values[0][0];
|
|
16
14
|
|
|
17
15
|
const dataAttributes = block.dataset;
|
|
18
16
|
const slidesDesktop = Number(dataAttributes.desktopslides);
|
|
@@ -115,8 +113,8 @@ export default function carouselmultilayoutv3Js(options = {}) {
|
|
|
115
113
|
modules: [
|
|
116
114
|
Navigation,
|
|
117
115
|
Pagination,
|
|
116
|
+
Autoplay
|
|
118
117
|
// Lazy,
|
|
119
|
-
// Autoplay,
|
|
120
118
|
// EffectFade,
|
|
121
119
|
// EffectCoverflow,
|
|
122
120
|
// EffectCreative,
|
|
@@ -203,6 +201,13 @@ export default function carouselmultilayoutv3Js(options = {}) {
|
|
|
203
201
|
}
|
|
204
202
|
}
|
|
205
203
|
);
|
|
204
|
+
if (true) {
|
|
205
|
+
import(
|
|
206
|
+
'Assets/js/blocks/carousel-multi-layout-v3/carousel-multi-layout-v3-extra.js'
|
|
207
|
+
).then((result) => {
|
|
208
|
+
result.default()
|
|
209
|
+
});
|
|
210
|
+
}
|
|
206
211
|
});
|
|
207
212
|
} catch (error) {
|
|
208
213
|
console.error(error);
|
|
@@ -409,11 +409,8 @@
|
|
|
409
409
|
"id": ""
|
|
410
410
|
},
|
|
411
411
|
"wpml_cf_preferences": 3,
|
|
412
|
-
"user_roles": [
|
|
413
|
-
"administrator"
|
|
414
|
-
],
|
|
415
412
|
"clone": [
|
|
416
|
-
"
|
|
413
|
+
"group_689f66f3e26df"
|
|
417
414
|
],
|
|
418
415
|
"display": "seamless",
|
|
419
416
|
"layout": "block",
|
|
@@ -574,5 +571,5 @@
|
|
|
574
571
|
"acfe_display_title": "",
|
|
575
572
|
"acfe_meta": "",
|
|
576
573
|
"acfe_note": "",
|
|
577
|
-
"modified":
|
|
574
|
+
"modified": 1759787683
|
|
578
575
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{% set gridLayoutElement = include('components/grid-layout-element.twig', { fields: field, block: block }, with_context = false) %}
|
|
1
|
+
{% set gridLayoutElement = include('components/grid-layout-element-v3.twig', { fields: field, block: block }, with_context = false) %}
|
|
2
2
|
{% set postColour = '--post-colour: ' ~ post.post_colour|ru ~ ';' %}
|
|
3
3
|
{% set postTextColourStyle = '--post-text-colour-style: ' ~ post.post_text_colour_style|ru ~ ';' %}
|
|
4
4
|
{% set ctaStyle = field.cta_style|ru %}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
require('dotenv').config();
|
|
2
|
+
const fs = require( 'fs' );
|
|
3
|
+
const path = require( 'path' );
|
|
4
|
+
const { globSync } = require( 'glob' );
|
|
5
|
+
const themePath = process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
6
|
+
|
|
7
|
+
const dynamicEntryPoints = globSync(`${themePath}/assets/js/blocks/*.js`)
|
|
8
|
+
.map((path) => {
|
|
9
|
+
const assetKey = path
|
|
10
|
+
.replace('assets/js/blocks/', '')
|
|
11
|
+
.replace('.js', '');
|
|
12
|
+
return assetKey;
|
|
13
|
+
});
|
|
14
|
+
const assetArray = dynamicEntryPoints.map((entry) => {
|
|
15
|
+
return { assetKey: entry };
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const jsAssetsFilePath = path.join(themePath, 'assets/js/modules/jsAssets.js'); // Create the absolute path to the destination file
|
|
19
|
+
|
|
20
|
+
// Create directories if they don't exist
|
|
21
|
+
const dirPath = path.dirname(jsAssetsFilePath);
|
|
22
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
23
|
+
|
|
24
|
+
const data = `// This file is auto-generated. To include assets for the lazyloader, just add your .js file to Assets/js/blocks/ and it will be included here.
|
|
25
|
+
const dynamicAssets = ${JSON.stringify(assetArray)};
|
|
26
|
+
const api = {
|
|
27
|
+
dynamicAssets,
|
|
28
|
+
};
|
|
29
|
+
export default api;`;
|
|
30
|
+
|
|
31
|
+
fs.writeFileSync(jsAssetsFilePath, data);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
require('dotenv').config();
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const {globSync} = require('glob');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const themePath =
|
|
6
|
+
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
7
|
+
|
|
8
|
+
// Create the directory path for the target file
|
|
9
|
+
const scssModulePath = path.join(themePath, 'assets/scss/modules');
|
|
10
|
+
const scssFilePath = path.join(scssModulePath, 'dynamicBlocksPreview.scss');
|
|
11
|
+
|
|
12
|
+
// Create directories if they don't exist
|
|
13
|
+
fs.mkdirSync(scssModulePath, {recursive: true});
|
|
14
|
+
|
|
15
|
+
// Write the initial content to the target file
|
|
16
|
+
fs.writeFileSync(
|
|
17
|
+
scssFilePath,
|
|
18
|
+
'// This file is auto-generated. To include assets for the lazyloader, just add your .scss file to Assets/scss/blocks/ and it will be included here.\n'
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const dynamicEntryPoints = globSync(
|
|
22
|
+
`${themePath}/assets/scss/blocks/*.scss`
|
|
23
|
+
).map((path) => {
|
|
24
|
+
const assetPath = path.replace(
|
|
25
|
+
'assets/scss/blocks/',
|
|
26
|
+
'Assets/scss/blocks/'
|
|
27
|
+
);
|
|
28
|
+
return assetPath;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const stream = fs.createWriteStream(scssFilePath, {flags: 'a'});
|
|
32
|
+
dynamicEntryPoints.forEach((entry) => {
|
|
33
|
+
stream.write(`@use '${entry}';\n`);
|
|
34
|
+
});
|
|
35
|
+
stream.end();
|