@total_onion/onion-library 3.1.0 → 3.2.1
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/__spec__/copyBlockComponent.spec.js +4 -4
- package/__spec__/copyFile.spec.js +3 -3
- package/__spec__/copyFileKeeping.spec.js +3 -3
- package/__spec__/update-all-components.spec.js +2 -2
- package/__spec__/update-component.spec.js +4 -4
- package/assembleAssetList.js +3 -3
- package/checkBuildAssets.js +11 -12
- package/createDynamicBlockScss-v3.js +4 -4
- package/createJsAssets-v3.js +3 -3
- package/createJsAssets.js +4 -4
- package/createNewBlock.js +13 -13
- package/createNewChildBlock2.js +27 -29
- package/createPreviewScss.js +8 -8
- package/duplicateBlock.js +8 -8
- package/exportAllBlocks.js +10 -7
- package/exportBlock.js +5 -5
- package/exportChildBlock.js +5 -5
- package/exportCustomCachesToLibrary.js +18 -15
- package/exportEntrypointToLibrary.js +18 -15
- package/exportImagesToLibrary.js +14 -14
- package/exportSEOExtrasToLibrary.js +18 -15
- package/exportToLibrary.js +20 -17
- package/importBlock.js +7 -7
- package/importChildBlock.js +7 -7
- package/index.js +10 -0
- package/install-component.js +3 -3
- package/list-components.js +1 -1
- package/new-block-templates/template-acf-pattern.js +30 -0
- package/new-block-templates/template-block-json.js +1 -1
- package/new-block-templates/template-default.js +10 -7
- package/new-block-templates/template-js-blank.js +2 -2
- package/new-block-templates/template-scss-blank.js +2 -2
- package/onion-loader.js +22 -14
- package/onion-utils.mjs +18 -19
- package/package.json +21 -5
- package/public/block-cocktail-recipe-v3/cocktail-recipe-v3.js +2 -0
- package/public/block-modal-form-v3/modal-form-v3.js +8 -4
- package/public/block-video-content-v3/video-content-v3.js +1 -1
- package/removeBlock.js +4 -4
- package/update-all-components.js +11 -50
- package/update-component.js +6 -5
- package/update-template.js +6 -5
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { promisify } from 'node:util';
|
|
4
4
|
|
|
5
5
|
// Import the function to be tested
|
|
6
|
-
|
|
6
|
+
import updateComponent from '../update-component.js';
|
|
7
7
|
|
|
8
8
|
// Promisify the fs functions used in the copyBlockComponent function
|
|
9
9
|
const readdirPromisified = promisify(fs.readdir);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import updateComponent from '../update-component.js';
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
describe('copyFile function', () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
//
|
|
5
|
-
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
// import path from 'node:path';
|
|
5
|
+
import updateComponent from '../update-component.js';
|
|
6
6
|
|
|
7
7
|
describe('copyFileKeeping', () => {
|
|
8
8
|
const sourceFilePath = './__spec__/files/source.txt';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import * as glob from 'glob';
|
|
4
4
|
const fs = jest.mock('fs');
|
|
5
|
-
|
|
5
|
+
import updateAllComponents from '../update-all-components.js';
|
|
6
6
|
|
|
7
7
|
describe('getComponentsList', () => {
|
|
8
8
|
afterEach(() => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
//
|
|
4
|
-
|
|
3
|
+
// import * as glob from 'glob';
|
|
4
|
+
import fs from 'node:fs';
|
|
5
5
|
// const fse = require("fs-extra");
|
|
6
6
|
|
|
7
|
-
//
|
|
8
|
-
|
|
7
|
+
// import path from 'node:path';
|
|
8
|
+
import updateComponent from '../update-component.js';
|
|
9
9
|
|
|
10
10
|
jest.mock('fs');
|
|
11
11
|
|
package/assembleAssetList.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
4
|
|
|
5
5
|
const dynamicEntryPointsJs = globSync(`./components/block-*/*-v3.js`).map(
|
|
6
6
|
(filePath) => {
|
package/checkBuildAssets.js
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {fork} from 'node:child_process';
|
|
4
|
+
|
|
4
5
|
const themePath = process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
5
6
|
|
|
6
7
|
const paths = {
|
|
7
|
-
createJsAssets:
|
|
8
|
-
|
|
9
|
-
createPreviewScss:
|
|
10
|
-
`${themePath}/assets/scss/modules/dynamicBlocksPreview.scss`,
|
|
8
|
+
createJsAssets: `${themePath}/assets/js/modules/jsAssets.js`,
|
|
9
|
+
createPreviewScss: `${themePath}/assets/scss/modules/dynamicBlocksPreview.scss`,
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
Object.keys(
|
|
14
|
-
if (
|
|
15
|
-
console.log(
|
|
16
|
-
|
|
12
|
+
Object.keys(paths).forEach((key) => {
|
|
13
|
+
if (!fs.existsSync(paths[key])) {
|
|
14
|
+
console.log(`creating missing assets with ${key}`);
|
|
15
|
+
fork(`./node_modules/@pernod-ricard-global-cms/jsbuildutils/${key}.js`);
|
|
17
16
|
}
|
|
18
|
-
}
|
|
17
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
|
+
import path from 'node:path';
|
|
5
5
|
|
|
6
6
|
const scssModulePath = path.join('./public');
|
|
7
7
|
const scssFilePath = path.join(scssModulePath, 'dynamicBlockScss-v3.scss');
|
package/createJsAssets-v3.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
4
|
|
|
5
5
|
const dynamicEntryPoints = globSync(`./components/block-*/*-v{3,4}.js`).map(
|
|
6
6
|
(filePath) => {
|
package/createJsAssets.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {globSync} from 'glob';
|
|
5
5
|
const themePath = process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
6
6
|
|
|
7
7
|
const dynamicEntryPoints = globSync(`${themePath}/assets/js/blocks/*.js`)
|
package/createNewBlock.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
|
+
import yargs from 'yargs/yargs';
|
|
5
|
+
import {exec} from 'node:child_process';
|
|
6
|
+
import acfTemplate from './new-block-templates/template-block-json.js';
|
|
7
|
+
import defaultTemplates from './new-block-templates/template-default.js';
|
|
8
8
|
|
|
9
9
|
const themePath =
|
|
10
10
|
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
@@ -65,12 +65,14 @@ const newBlockName = process.argv[2]?.toLowerCase();
|
|
|
65
65
|
const blockType = process.argv[3];
|
|
66
66
|
|
|
67
67
|
if (!newBlockName) {
|
|
68
|
-
|
|
68
|
+
console.log('Did you forget to give the new block a name?');
|
|
69
|
+
process.exit(1);
|
|
69
70
|
}
|
|
70
71
|
if (dynamicEntryPoints.indexOf(newBlockName) !== -1) {
|
|
71
|
-
|
|
72
|
+
console.log(
|
|
72
73
|
`Alas! There is already a block called ${newBlockName} :( You'll have to try something else..`
|
|
73
74
|
);
|
|
75
|
+
process.exit(1);
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
const templateData = `
|
|
@@ -81,10 +83,8 @@ const templateData = `
|
|
|
81
83
|
</section>`;
|
|
82
84
|
|
|
83
85
|
let jsData;
|
|
84
|
-
if (swiper) {
|
|
85
|
-
jsData =
|
|
86
|
-
} else if (vue) {
|
|
87
|
-
jsData = vueTemplates.templatejs(newBlockName);
|
|
86
|
+
if (swiper || vue || image || content) {
|
|
87
|
+
jsData = defaultTemplates.defaultjs(newBlockName);
|
|
88
88
|
} else {
|
|
89
89
|
jsData = defaultTemplates.defaultjs(newBlockName);
|
|
90
90
|
}
|
package/createNewChildBlock2.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
|
+
import {exec} from 'node:child_process';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import {fileURLToPath} from 'node:url';
|
|
7
|
+
import yaml from 'js-yaml';
|
|
8
|
+
import axios from 'axios';
|
|
9
|
+
import acfTemplate from './new-block-templates/template-acf-pattern.js';
|
|
10
|
+
import acfTemplateScss from './new-block-templates/template-scss-blank.js';
|
|
11
|
+
import acfTemplateJs from './new-block-templates/template-js-blank.js';
|
|
12
|
+
|
|
13
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
const themePath = process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
13
15
|
|
|
14
16
|
const yamlData = yaml.load(fs.readFileSync('../../../../.lando.yml', 'utf8'));
|
|
15
17
|
const siteName = yamlData.config.site;
|
|
@@ -17,11 +19,11 @@ const parentURL = process.env.DESIGN_MULTIDEV
|
|
|
17
19
|
? `${process.env.DESIGN_MULTIDEV}/wp-admin/admin-ajax.php`
|
|
18
20
|
: `http://${siteName}.lndo.site/wp-admin/admin-ajax.php`;
|
|
19
21
|
|
|
20
|
-
const srcPathJs =
|
|
21
|
-
const srcPathScss =
|
|
22
|
+
const srcPathJs = path.join(__dirname, 'components');
|
|
23
|
+
const srcPathScss = path.join(__dirname, 'components');
|
|
22
24
|
|
|
23
25
|
let projectName = 'Global Theme';
|
|
24
|
-
const projectJson = JSON.parse(fs.readFileSync('./package.json'));
|
|
26
|
+
const projectJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
|
25
27
|
if (projectJson) {
|
|
26
28
|
projectName = projectJson.name;
|
|
27
29
|
if (projectName.slice(0, 3) === 'the') {
|
|
@@ -40,8 +42,8 @@ if (projectJson) {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
const dynamicEntryPoints = globSync(`${themePath}/assets/js/blocks/*.js`).map(
|
|
43
|
-
(
|
|
44
|
-
const assetKey =
|
|
45
|
+
(filePath) => {
|
|
46
|
+
const assetKey = filePath
|
|
45
47
|
.replace('assets/js/blocks/', '')
|
|
46
48
|
.replace('.js', '');
|
|
47
49
|
return assetKey;
|
|
@@ -51,10 +53,12 @@ const newBlockName = process.argv[2]?.toLowerCase();
|
|
|
51
53
|
const patternID = process.argv[3];
|
|
52
54
|
|
|
53
55
|
if (!newBlockName) {
|
|
54
|
-
|
|
56
|
+
console.log('Did you forget to give the new block a name?');
|
|
57
|
+
process.exit(1);
|
|
55
58
|
}
|
|
56
59
|
if (!patternID) {
|
|
57
|
-
|
|
60
|
+
console.log('Did you forget to supply the pattern ID?');
|
|
61
|
+
process.exit(1);
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
fs.writeFileSync(
|
|
@@ -64,16 +68,10 @@ fs.writeFileSync(
|
|
|
64
68
|
|
|
65
69
|
const blockName = 'group-container-v3';
|
|
66
70
|
|
|
67
|
-
const fullPath =
|
|
71
|
+
const fullPath = path.join(srcPathJs, `block-${blockName}`, `${blockName}.js`);
|
|
68
72
|
|
|
69
|
-
const jsdir =
|
|
70
|
-
|
|
71
|
-
// fs.mkdirSync(jsdir, 0o744);
|
|
72
|
-
// }
|
|
73
|
-
const scssdir = `Assets/scss/blocks/`;
|
|
74
|
-
// if (!fs.existsSync(scssdir)) {
|
|
75
|
-
// fs.mkdirSync(scssdir, 0o744);
|
|
76
|
-
// }
|
|
73
|
+
const jsdir = 'Assets/js/blocks/';
|
|
74
|
+
const scssdir = 'Assets/scss/blocks/';
|
|
77
75
|
|
|
78
76
|
if (!fs.existsSync(`${jsdir}/${newBlockName}.js`)) {
|
|
79
77
|
fs.writeFileSync(
|
|
@@ -91,7 +89,7 @@ if (!fs.existsSync(`${scssdir}/${newBlockName}.scss`)) {
|
|
|
91
89
|
console.log(`👑👑\x1b[32m Successfully created the scss file! 👑👑`);
|
|
92
90
|
}
|
|
93
91
|
|
|
94
|
-
|
|
92
|
+
const data = new FormData();
|
|
95
93
|
data.append('action', 'get_pattern_block');
|
|
96
94
|
data.append('postID', patternID);
|
|
97
95
|
|
package/createPreviewScss.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
6
|
+
const themePath = process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
7
7
|
|
|
8
8
|
// Create the directory path for the target file
|
|
9
9
|
const scssModulePath = path.join(themePath, 'assets/scss/modules');
|
|
@@ -20,8 +20,8 @@ fs.writeFileSync(
|
|
|
20
20
|
|
|
21
21
|
const dynamicEntryPoints = globSync(
|
|
22
22
|
`${themePath}/assets/scss/blocks/*.scss`
|
|
23
|
-
).map((
|
|
24
|
-
const assetPath =
|
|
23
|
+
).map((filePath) => {
|
|
24
|
+
const assetPath = filePath.replace(
|
|
25
25
|
'assets/scss/blocks/',
|
|
26
26
|
'Assets/scss/blocks/'
|
|
27
27
|
);
|
package/duplicateBlock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {globSync} from 'glob';
|
|
5
|
+
import yargs from 'yargs/yargs';
|
|
6
6
|
const templateOptions = yargs(process.argv.slice(2)).argv._;
|
|
7
7
|
const themePath =
|
|
8
8
|
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
@@ -27,20 +27,20 @@ if (!blockName) {
|
|
|
27
27
|
console.log(
|
|
28
28
|
"\x1b[33m 🤔🤔 Hmmm...You dont't seem to have chosen a block to duplicate. 🤔🤔 \x1b[0m"
|
|
29
29
|
);
|
|
30
|
-
|
|
30
|
+
process.exit(1);
|
|
31
31
|
}
|
|
32
32
|
if (!newName) {
|
|
33
33
|
console.log(
|
|
34
34
|
'\x1b[33m 🤓🤓 Nearly there! Unfortunately you forgot to choose a new name for your duplicate block. 🤓🤓 \x1b[0m'
|
|
35
35
|
);
|
|
36
|
-
|
|
36
|
+
process.exit(1);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
if (blockName === newName) {
|
|
40
40
|
console.log(
|
|
41
41
|
'\x1b[33m Oh no! 😱😱😱 Your new block name cannot be the same as the original block name! \x1b[0m'
|
|
42
42
|
);
|
|
43
|
-
|
|
43
|
+
process.exit(1);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
if (exisitingBlockNames.includes(blockName)) {
|
package/exportAllBlocks.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
|
+
import yargs from 'yargs/yargs';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import {fileURLToPath} from 'node:url';
|
|
7
|
+
import compressing from 'compressing';
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
10
|
const templateOptions = yargs(process.argv.slice(2)).argv._;
|
|
8
11
|
const themePath =
|
|
9
12
|
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
@@ -24,7 +27,7 @@ try {
|
|
|
24
27
|
blocks = JSON.parse(fs.readFileSync(component_list_file, 'utf8'));
|
|
25
28
|
} catch (e) {
|
|
26
29
|
console.error('Component list file error : ' + e);
|
|
27
|
-
|
|
30
|
+
process.exit(1);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
const dynamicEntryPointsJs = globSync(`${themePath}/assets/js/blocks/*.js`).map(
|
package/exportBlock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
|
+
import yargs from 'yargs/yargs';
|
|
5
|
+
import compressing from 'compressing';
|
|
6
6
|
const templateOptions = yargs(process.argv.slice(2)).argv._;
|
|
7
7
|
const themePath =
|
|
8
8
|
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
package/exportChildBlock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
|
+
import yargs from 'yargs/yargs';
|
|
5
|
+
import compressing from 'compressing';
|
|
6
6
|
const templateOptions = yargs(process.argv.slice(2)).argv._;
|
|
7
7
|
const themePath =
|
|
8
8
|
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {fileURLToPath} from 'node:url';
|
|
5
|
+
import {globSync} from 'glob';
|
|
6
|
+
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
8
|
const themePath = process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
6
9
|
const srcPathCustomCaches = `${themePath}/inc/custom-caches`;
|
|
7
10
|
|
|
8
11
|
const bColors = {
|
|
9
|
-
HEADER: '\
|
|
10
|
-
OKBLUE: '\
|
|
11
|
-
OKGREEN: '\
|
|
12
|
-
WARNING: '\
|
|
13
|
-
FAIL: '\
|
|
14
|
-
ENDC: '\
|
|
15
|
-
BOLD: '\
|
|
16
|
-
UNDERLINE: '\
|
|
17
|
-
ORANGE: '\
|
|
18
|
-
MAGENTA: '\
|
|
19
|
-
CYAN: '\
|
|
12
|
+
HEADER: '\u001b[95m',
|
|
13
|
+
OKBLUE: '\u001b[94m',
|
|
14
|
+
OKGREEN: '\u001b[92m',
|
|
15
|
+
WARNING: '\u001b[93m',
|
|
16
|
+
FAIL: '\u001b[91m',
|
|
17
|
+
ENDC: '\u001b[0m',
|
|
18
|
+
BOLD: '\u001b[1m',
|
|
19
|
+
UNDERLINE: '\u001b[4m',
|
|
20
|
+
ORANGE: '\u001b[93m',
|
|
21
|
+
MAGENTA: '\u001b[95m',
|
|
22
|
+
CYAN: '\u001b[96m'
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
const icons = {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import yargs from 'yargs/yargs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import {fileURLToPath} from 'node:url';
|
|
6
|
+
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
8
|
// entry points
|
|
6
9
|
const args = yargs(process.argv.slice(2)).argv;
|
|
7
10
|
const componentOptions = args._;
|
|
@@ -15,17 +18,17 @@ const destPathEntryPoints = path.join(
|
|
|
15
18
|
);
|
|
16
19
|
|
|
17
20
|
const bColors = {
|
|
18
|
-
HEADER: '\
|
|
19
|
-
OKBLUE: '\
|
|
20
|
-
OKGREEN: '\
|
|
21
|
-
WARNING: '\
|
|
22
|
-
FAIL: '\
|
|
23
|
-
ENDC: '\
|
|
24
|
-
BOLD: '\
|
|
25
|
-
UNDERLINE: '\
|
|
26
|
-
ORANGE: '\
|
|
27
|
-
MAGENTA: '\
|
|
28
|
-
CYAN: '\
|
|
21
|
+
HEADER: '\u001b[95m',
|
|
22
|
+
OKBLUE: '\u001b[94m',
|
|
23
|
+
OKGREEN: '\u001b[92m',
|
|
24
|
+
WARNING: '\u001b[93m',
|
|
25
|
+
FAIL: '\u001b[91m',
|
|
26
|
+
ENDC: '\u001b[0m',
|
|
27
|
+
BOLD: '\u001b[1m',
|
|
28
|
+
UNDERLINE: '\u001b[4m',
|
|
29
|
+
ORANGE: '\u001b[93m',
|
|
30
|
+
MAGENTA: '\u001b[95m',
|
|
31
|
+
CYAN: '\u001b[96m'
|
|
29
32
|
};
|
|
30
33
|
|
|
31
34
|
const icons = {
|
package/exportImagesToLibrary.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
4
|
|
|
5
5
|
const themePath = process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
6
6
|
|
|
@@ -8,17 +8,17 @@ const srcPathImages = path.join(themePath, 'assets/images/icon/library-images');
|
|
|
8
8
|
const destPath = '../../../../../onion-library/components/fields-library-images';
|
|
9
9
|
|
|
10
10
|
const bColors = {
|
|
11
|
-
HEADER: '\
|
|
12
|
-
OKBLUE: '\
|
|
13
|
-
OKGREEN: '\
|
|
14
|
-
WARNING: '\
|
|
15
|
-
FAIL: '\
|
|
16
|
-
ENDC: '\
|
|
17
|
-
BOLD: '\
|
|
18
|
-
UNDERLINE: '\
|
|
19
|
-
ORANGE: '\
|
|
20
|
-
MAGENTA: '\
|
|
21
|
-
CYAN: '\
|
|
11
|
+
HEADER: '\u001b[95m',
|
|
12
|
+
OKBLUE: '\u001b[94m',
|
|
13
|
+
OKGREEN: '\u001b[92m',
|
|
14
|
+
WARNING: '\u001b[93m',
|
|
15
|
+
FAIL: '\u001b[91m',
|
|
16
|
+
ENDC: '\u001b[0m',
|
|
17
|
+
BOLD: '\u001b[1m',
|
|
18
|
+
UNDERLINE: '\u001b[4m',
|
|
19
|
+
ORANGE: '\u001b[93m',
|
|
20
|
+
MAGENTA: '\u001b[95m',
|
|
21
|
+
CYAN: '\u001b[96m'
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
const icons = {
|
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import {fileURLToPath} from 'node:url';
|
|
5
|
+
import {globSync} from 'glob';
|
|
6
|
+
|
|
7
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
5
8
|
const themePath = process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
6
9
|
const srcPathSeoExtras = `${themePath}/inc/seo-extras`;
|
|
7
10
|
|
|
8
11
|
const bColors = {
|
|
9
|
-
HEADER: '\
|
|
10
|
-
OKBLUE: '\
|
|
11
|
-
OKGREEN: '\
|
|
12
|
-
WARNING: '\
|
|
13
|
-
FAIL: '\
|
|
14
|
-
ENDC: '\
|
|
15
|
-
BOLD: '\
|
|
16
|
-
UNDERLINE: '\
|
|
17
|
-
ORANGE: '\
|
|
18
|
-
MAGENTA: '\
|
|
19
|
-
CYAN: '\
|
|
12
|
+
HEADER: '\u001b[95m',
|
|
13
|
+
OKBLUE: '\u001b[94m',
|
|
14
|
+
OKGREEN: '\u001b[92m',
|
|
15
|
+
WARNING: '\u001b[93m',
|
|
16
|
+
FAIL: '\u001b[91m',
|
|
17
|
+
ENDC: '\u001b[0m',
|
|
18
|
+
BOLD: '\u001b[1m',
|
|
19
|
+
UNDERLINE: '\u001b[4m',
|
|
20
|
+
ORANGE: '\u001b[93m',
|
|
21
|
+
MAGENTA: '\u001b[95m',
|
|
22
|
+
CYAN: '\u001b[96m'
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
const icons = {
|
package/exportToLibrary.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import fse from 'fs-extra';
|
|
4
|
+
import {globSync} from 'glob';
|
|
5
|
+
import yargs from 'yargs/yargs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import {fileURLToPath} from 'node:url';
|
|
8
|
+
|
|
9
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
7
10
|
const templateOptions = yargs(process.argv.slice(2)).argv._;
|
|
8
11
|
const themePath =
|
|
9
12
|
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
@@ -43,17 +46,17 @@ const destPath = path.join(
|
|
|
43
46
|
);
|
|
44
47
|
|
|
45
48
|
const bColors = {
|
|
46
|
-
HEADER: '\
|
|
47
|
-
OKBLUE: '\
|
|
48
|
-
OKGREEN: '\
|
|
49
|
-
WARNING: '\
|
|
50
|
-
FAIL: '\
|
|
51
|
-
ENDC: '\
|
|
52
|
-
BOLD: '\
|
|
53
|
-
UNDERLINE: '\
|
|
54
|
-
ORANGE: '\
|
|
55
|
-
MAGENTA: '\
|
|
56
|
-
CYAN: '\
|
|
49
|
+
HEADER: '\u001b[95m',
|
|
50
|
+
OKBLUE: '\u001b[94m',
|
|
51
|
+
OKGREEN: '\u001b[92m',
|
|
52
|
+
WARNING: '\u001b[93m',
|
|
53
|
+
FAIL: '\u001b[91m',
|
|
54
|
+
ENDC: '\u001b[0m',
|
|
55
|
+
BOLD: '\u001b[1m',
|
|
56
|
+
UNDERLINE: '\u001b[4m',
|
|
57
|
+
ORANGE: '\u001b[93m',
|
|
58
|
+
MAGENTA: '\u001b[95m',
|
|
59
|
+
CYAN: '\u001b[96m'
|
|
57
60
|
};
|
|
58
61
|
|
|
59
62
|
const icons = {
|
package/importBlock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
|
+
import yargs from 'yargs/yargs';
|
|
5
|
+
import compressing from 'compressing';
|
|
6
6
|
const templateOptions = yargs(process.argv.slice(2)).argv._;
|
|
7
7
|
const blockName = templateOptions[0];
|
|
8
8
|
const exportedFolder = '../../../../exported-blocks';
|
|
@@ -77,11 +77,11 @@ const decompressDone = () => {
|
|
|
77
77
|
if (!existingBlocks.includes(blockName)) {
|
|
78
78
|
if (!blockName) {
|
|
79
79
|
console.log('Aborting because of bad name!');
|
|
80
|
-
|
|
80
|
+
process.exit(1);
|
|
81
81
|
}
|
|
82
82
|
if (!fs.existsSync(`${exportedFolder}/${blockName}.zip`)) {
|
|
83
83
|
console.log('Aborting as could not find the zip file');
|
|
84
|
-
|
|
84
|
+
process.exit(1);
|
|
85
85
|
}
|
|
86
86
|
compressing.zip
|
|
87
87
|
.uncompress(`${exportedFolder}/${blockName}.zip`, `${exportedFolder}/`)
|
package/importChildBlock.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import {globSync} from 'glob';
|
|
4
|
+
import yargs from 'yargs/yargs';
|
|
5
|
+
import compressing from 'compressing';
|
|
6
6
|
const templateOptions = yargs(process.argv.slice(2)).argv._;
|
|
7
7
|
const blockName = templateOptions[0];
|
|
8
8
|
const exportedFolder = '../../../../exported-blocks';
|
|
@@ -64,11 +64,11 @@ const decompressDone = () => {
|
|
|
64
64
|
|
|
65
65
|
if (!blockName) {
|
|
66
66
|
console.log('Aborting because of bad name!');
|
|
67
|
-
|
|
67
|
+
process.exit(1);
|
|
68
68
|
}
|
|
69
69
|
if (!fs.existsSync(`${exportedFolder}/${blockName}.zip`)) {
|
|
70
70
|
console.log('Aborting as could not find the zip file');
|
|
71
|
-
|
|
71
|
+
process.exit(1);
|
|
72
72
|
}
|
|
73
73
|
compressing.zip
|
|
74
74
|
.uncompress(`${exportedFolder}/${blockName}.zip`, `${exportedFolder}/`)
|
package/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import VideoController from './onion-videocontroller/onion-videocontroller.js';
|
|
2
|
+
import ModalController from './onion-modalcontroller/onion-modalcontroller.js';
|
|
3
|
+
export * from './onion-utils.mjs';
|
|
4
|
+
export * from './entry-animation-observer.js';
|
|
5
|
+
|
|
6
|
+
export default VideoController;
|
|
7
|
+
export { VideoController, ModalController };
|
|
8
|
+
export { default as modalController } from './onion-modalcontroller/onion-modalcontroller.js';
|
|
9
|
+
export { default as videoController } from './onion-videocontroller/onion-videocontroller.js';
|
|
10
|
+
export { default as onionLoader } from './onion-loader.js';
|
package/install-component.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import * as glob from 'glob';
|
|
3
|
+
import yargs from 'yargs/yargs';
|
|
4
4
|
|
|
5
5
|
let projectName = 'Global Theme';
|
|
6
6
|
const libraryPath = './node_modules/@total_onion/onion-library';
|
package/list-components.js
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export default function templateAcfPattern(newBlockName, projectName) {
|
|
2
|
+
const blockTitle =
|
|
3
|
+
newBlockName.charAt(0).toUpperCase() +
|
|
4
|
+
newBlockName.slice(1).replaceAll('-', ' ');
|
|
5
|
+
const namespace = projectName.toLowerCase().replaceAll(' ', '-');
|
|
6
|
+
|
|
7
|
+
return `<?php
|
|
8
|
+
/**
|
|
9
|
+
* ${blockTitle}
|
|
10
|
+
*/
|
|
11
|
+
add_action('acf/init', function () {
|
|
12
|
+
if (function_exists('acf_register_block_type')) {
|
|
13
|
+
acf_register_block_type([
|
|
14
|
+
'name' => '${newBlockName}',
|
|
15
|
+
'title' => '${blockTitle}',
|
|
16
|
+
'description' => '${blockTitle}',
|
|
17
|
+
'render_template' => get_template_directory() . '/views/blocks/${newBlockName}.twig',
|
|
18
|
+
'category' => 'project-blocks',
|
|
19
|
+
'icon' => 'editor-code',
|
|
20
|
+
'supports' => [
|
|
21
|
+
'align' => false,
|
|
22
|
+
'anchor' => true,
|
|
23
|
+
],
|
|
24
|
+
'enqueue_style' => get_template_directory_uri() . '/assets/scss/blocks/${newBlockName}.css',
|
|
25
|
+
'enqueue_script' => get_template_directory_uri() . '/assets/js/blocks/${newBlockName}.js',
|
|
26
|
+
]);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
`;
|
|
30
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return `export default function ${newBlockName.replaceAll(
|
|
1
|
+
const defaultjs = function (newBlockName) {
|
|
2
|
+
return `export default function ${newBlockName.replaceAll(
|
|
4
3
|
'-',
|
|
5
4
|
''
|
|
6
5
|
)}Js ( options = {} ) {
|
|
@@ -10,12 +9,16 @@ module.exports = {
|
|
|
10
9
|
console.error( error );
|
|
11
10
|
}
|
|
12
11
|
}`;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const defaultscss = function (newBlockName) {
|
|
15
|
+
return `// @use 'NodeModules/@total_onion/onion-library/components/fields-core-mixins-v3/core-mixins-v3';
|
|
16
16
|
// @use 'NodeModules/@total_onion/onion-library/components/fields-core-functions-v3/core-functions-v3';
|
|
17
17
|
// @use 'NodeModules/@total_onion/onion-library/breakpoints';
|
|
18
18
|
.${newBlockName} {
|
|
19
19
|
}`;
|
|
20
|
-
}
|
|
21
20
|
};
|
|
21
|
+
|
|
22
|
+
export default { defaultjs, defaultscss };
|
|
23
|
+
export { defaultjs, defaultscss };
|
|
24
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
export default function templateJsBlank(newBlockName) {
|
|
2
2
|
return `export default function ${newBlockName.replaceAll(
|
|
3
3
|
'-',
|
|
4
4
|
''
|
|
@@ -9,4 +9,4 @@ module.exports = function (newBlockName, projectName) {
|
|
|
9
9
|
console.error(error);
|
|
10
10
|
}
|
|
11
11
|
}`;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
export default function templateScssBlank(newBlockName) {
|
|
2
2
|
return `// @use 'NodeModules/@total_onion/onion-library/components/fields-core-mixins-v3/core-mixins-v3';
|
|
3
3
|
// @use 'NodeModules/@total_onion/onion-library/components/fields-core-functions-v3/core-functions-v3';
|
|
4
4
|
// @use 'NodeModules/@total_onion/onion-library/breakpoints';
|
|
5
5
|
.${newBlockName} {}`;
|
|
6
|
-
}
|
|
6
|
+
}
|
package/onion-loader.js
CHANGED
|
@@ -52,27 +52,35 @@ function lazyloaderInit() {
|
|
|
52
52
|
options.debugLogMessages && console.log('Lazy Loader initialized!');
|
|
53
53
|
options.lazyBlocksToSearchFor = [];
|
|
54
54
|
assetArray.forEach((asset) => {
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
) {
|
|
55
|
+
// if (
|
|
56
|
+
// asset.assetKey.includes('-v3') &&
|
|
57
|
+
// !asset.assetKey.includes('sub-block')
|
|
58
|
+
// ) {
|
|
59
|
+
// options.assetMap[asset.assetKey] = {
|
|
60
|
+
// js: () =>
|
|
61
|
+
// import(
|
|
62
|
+
// `Assets/blocks/${asset.assetKey}/${asset.assetKey}${options.fileSuffixJs}`
|
|
63
|
+
// ),
|
|
64
|
+
// // import(
|
|
65
|
+
// // `NodeModules/@total_onion/onion-library/components/block-${asset.assetKey}/${asset.assetKey}${options.fileSuffixJs}`
|
|
66
|
+
// // ),
|
|
67
|
+
// css: options.ignoreCss === true
|
|
68
|
+
// };
|
|
69
|
+
// }
|
|
70
|
+
if (asset.assetKey.includes('-v3')) {
|
|
59
71
|
options.assetMap[asset.assetKey] = {
|
|
60
72
|
js: () =>
|
|
61
73
|
import(
|
|
62
|
-
`
|
|
74
|
+
`Assets/sub-blocks/${asset.assetKey}/${asset.assetKey}${options.fileSuffixJs}`
|
|
63
75
|
),
|
|
64
|
-
css: options.ignoreCss ===
|
|
76
|
+
css: options.ignoreCss === false
|
|
65
77
|
};
|
|
66
|
-
} else {
|
|
67
78
|
}
|
|
68
|
-
if (
|
|
69
|
-
options.filePrefix === 'nodemodules' &&
|
|
70
|
-
!asset.assetKey.includes('-v3')
|
|
71
|
-
) {
|
|
79
|
+
if (!asset.assetKey.includes('-v3')) {
|
|
72
80
|
options.assetMap[asset.assetKey] = {
|
|
73
81
|
js: () =>
|
|
74
82
|
import(
|
|
75
|
-
`Assets/
|
|
83
|
+
`Assets/blocks/${asset.assetKey}/${asset.assetKey}${options.fileSuffixJs}`
|
|
76
84
|
),
|
|
77
85
|
css: options.ignoreCss === false
|
|
78
86
|
};
|
|
@@ -236,7 +244,7 @@ export function loadCss(assetKey) {
|
|
|
236
244
|
assetKey.includes('-v3')
|
|
237
245
|
) {
|
|
238
246
|
import(
|
|
239
|
-
/* webpackChunkName: "[request]" */ `
|
|
247
|
+
/* webpackChunkName: "[request]" */ `Assets/sub-blocks/${assetKey}/${assetKey}${options.fileSuffixCss}`
|
|
240
248
|
).then(() => resolve(true));
|
|
241
249
|
} else if (
|
|
242
250
|
options.css === true &&
|
|
@@ -244,7 +252,7 @@ export function loadCss(assetKey) {
|
|
|
244
252
|
!assetKey.includes('-v3')
|
|
245
253
|
) {
|
|
246
254
|
import(
|
|
247
|
-
/* webpackChunkName: "[request]" */ `Assets/
|
|
255
|
+
/* webpackChunkName: "[request]" */ `Assets/blocks/${assetKey}/${assetKey}${options.fileSuffixCss}`
|
|
248
256
|
).then(() => resolve(true));
|
|
249
257
|
} else {
|
|
250
258
|
return resolve(true);
|
package/onion-utils.mjs
CHANGED
|
@@ -88,24 +88,24 @@ export function inCriticalCssConfig(assetKey) {
|
|
|
88
88
|
return true;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
export function loadCss(assetKey, options = { css: true }) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
91
|
+
// /**
|
|
92
|
+
// * Dynamically loads the css for the block if it has not already been included in critical css or the css property is set to false.
|
|
93
|
+
// * @param {string} assetKey The assetkey string of the block.
|
|
94
|
+
// * @param {object} options The options object which will at the very least contain the css property set to true.
|
|
95
|
+
// * @returns {promise}
|
|
96
|
+
// */
|
|
97
|
+
// export function loadCss(assetKey, options = { css: true }) {
|
|
98
|
+
// const promise = new Promise((resolve) => {
|
|
99
|
+
// if (options.css === true && !inCriticalCssConfig(assetKey)) {
|
|
100
|
+
// import(
|
|
101
|
+
// /* webpackChunkName: "[request]" */ `Assets/scss/blocks/${assetKey}.scss`
|
|
102
|
+
// ).then(() => resolve(true));
|
|
103
|
+
// } else {
|
|
104
|
+
// return resolve(true);
|
|
105
|
+
// }
|
|
106
|
+
// });
|
|
107
|
+
// return promise;
|
|
108
|
+
// }
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
111
|
* Checks for browser, device and OS and then adds the relevant classes to the html tag.
|
|
@@ -680,7 +680,6 @@ const api = {
|
|
|
680
680
|
isEmailValid,
|
|
681
681
|
isInViewport,
|
|
682
682
|
isTablet,
|
|
683
|
-
loadCss,
|
|
684
683
|
mobileCheck,
|
|
685
684
|
resizeDebouncer,
|
|
686
685
|
supportsWebp,
|
package/package.json
CHANGED
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@total_onion/onion-library",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Component library",
|
|
5
|
-
"
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"module": "./index.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./index.js",
|
|
10
|
+
"./onion-utils": "./onion-utils.mjs",
|
|
11
|
+
"./onion-utils.mjs": "./onion-utils.mjs",
|
|
12
|
+
"./onion-loader": "./onion-loader.js",
|
|
13
|
+
"./onion-loader.js": "./onion-loader.js",
|
|
14
|
+
"./entry-animation-observer": "./entry-animation-observer.js",
|
|
15
|
+
"./entry-animation-observer.js": "./entry-animation-observer.js",
|
|
16
|
+
"./onion-videocontroller": "./onion-videocontroller/onion-videocontroller.js",
|
|
17
|
+
"./onion-videocontroller.js": "./onion-videocontroller/onion-videocontroller.js",
|
|
18
|
+
"./onion-modalcontroller": "./onion-modalcontroller/onion-modalcontroller.js",
|
|
19
|
+
"./onion-modalcontroller.js": "./onion-modalcontroller/onion-modalcontroller.js"
|
|
20
|
+
},
|
|
6
21
|
"scripts": {
|
|
7
22
|
"build": "node build-library.js",
|
|
8
23
|
"test": ""
|
|
@@ -18,8 +33,7 @@
|
|
|
18
33
|
},
|
|
19
34
|
"homepage": "https://github.com/TotalOnion/onion-library#readme",
|
|
20
35
|
"dependencies": {
|
|
21
|
-
"
|
|
22
|
-
"swiper": "^14.1.0"
|
|
36
|
+
"@vimeo/player": "^2.26.0"
|
|
23
37
|
},
|
|
24
38
|
"devDependencies": {
|
|
25
39
|
"autoprefixer": "^10.4.27",
|
|
@@ -36,6 +50,8 @@
|
|
|
36
50
|
"postcss-preset-env": "^11.2.0",
|
|
37
51
|
"prettier": "^2.6.2",
|
|
38
52
|
"url-loader": "^4.1.1",
|
|
39
|
-
"yargs": "^17.4.1"
|
|
53
|
+
"yargs": "^17.4.1",
|
|
54
|
+
"lottie-web": "^5.13.0",
|
|
55
|
+
"swiper": "^14.1.0"
|
|
40
56
|
}
|
|
41
57
|
}
|
|
@@ -33,6 +33,8 @@ export default function cocktailrecipev3Js(options = {}) {
|
|
|
33
33
|
return (Math.round(num * 100) / 100).toFixed(2).replace(/\.?0+$/, "");
|
|
34
34
|
if (unit === "ml")
|
|
35
35
|
return (Math.round(num * 10) / 10).toString().replace(/\.0$/, "");
|
|
36
|
+
if (unit === "cl")
|
|
37
|
+
return (Math.round(num * 100) / 100).toString().replace(/\.0$/, "");
|
|
36
38
|
return (Math.round(num * 100) / 100).toString().replace(/\.?0+$/, "");
|
|
37
39
|
};
|
|
38
40
|
const convert = (value, fromUnit, toUnit) => {
|
|
@@ -5,7 +5,9 @@ export default function modalformv3Js(options = {}) {
|
|
|
5
5
|
".cdb_form_field input, .cdb_form_field select, .cdb_form_gdpr_information input, .cdb_form_privacypolicy_information input"
|
|
6
6
|
);
|
|
7
7
|
inputs.forEach((input) => {
|
|
8
|
-
const wrapper = input.closest(
|
|
8
|
+
const wrapper = input.closest(
|
|
9
|
+
".cdb_form_field, .cdb_form_gdpr_information, .cdb_form_privacypolicy_information"
|
|
10
|
+
);
|
|
9
11
|
if (!wrapper) return;
|
|
10
12
|
wrapper.classList.remove("invalid");
|
|
11
13
|
if (!input.hasAttribute("required")) return;
|
|
@@ -31,9 +33,11 @@ export default function modalformv3Js(options = {}) {
|
|
|
31
33
|
});
|
|
32
34
|
};
|
|
33
35
|
const { block } = options;
|
|
34
|
-
const submit = block.querySelector(
|
|
35
|
-
|
|
36
|
-
|
|
36
|
+
const submit = block.querySelector(".cdb-submit");
|
|
37
|
+
if (!submit) {
|
|
38
|
+
console.error("could not find submit button");
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
37
41
|
submit.classList.add("cmpl-cta-style-11", "cmpl-cta-animation-style-1");
|
|
38
42
|
submit.addEventListener("click", (e) => {
|
|
39
43
|
validateFormFields(block);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import videocontroller from "
|
|
1
|
+
import videocontroller from "../../onion-videocontroller/onion-videocontroller.js";
|
|
2
2
|
export default function videocontentv3Js(options = {}) {
|
|
3
3
|
try {
|
|
4
4
|
const { block } = options;
|
package/removeBlock.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import readline from 'node:readline';
|
|
4
|
+
import {globSync} from 'glob';
|
|
5
5
|
const themePath =
|
|
6
6
|
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
7
7
|
|
package/update-all-components.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {exec} from 'node:child_process';
|
|
4
|
+
import {pathToFileURL} from 'node:url';
|
|
5
|
+
import * as glob from 'glob';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const libraryPath = './node_modules/@total_onion/onion-library';
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
const getComponentsList = () => {
|
|
10
|
+
let finalList = [];
|
|
10
11
|
|
|
11
12
|
if (fs.existsSync('./project-components-list.json')) {
|
|
12
13
|
const componentsList = glob.sync(`${libraryPath}/components/*`);
|
|
13
|
-
|
|
14
14
|
const listJson = fs.readFileSync('./project-components-list.json');
|
|
15
15
|
const componentsListObject = JSON.parse(listJson);
|
|
16
16
|
|
|
@@ -27,28 +27,19 @@ const getComponentsList = () => {
|
|
|
27
27
|
finalList.push(component);
|
|
28
28
|
}
|
|
29
29
|
});
|
|
30
|
-
|
|
31
|
-
// Free up memory
|
|
32
30
|
} else {
|
|
33
31
|
finalList = glob
|
|
34
32
|
.sync(`${libraryPath}/components/*`)
|
|
35
|
-
.map((componentPath) =>
|
|
36
|
-
return path.basename(componentPath);
|
|
37
|
-
});
|
|
33
|
+
.map((componentPath) => path.basename(componentPath));
|
|
38
34
|
}
|
|
39
35
|
|
|
40
|
-
// printMemoryUsage('After checking components list');
|
|
41
|
-
|
|
42
36
|
return finalList;
|
|
43
37
|
};
|
|
44
38
|
|
|
45
39
|
const updateAllComponents = () => {
|
|
46
|
-
const {exec} = require('child_process');
|
|
47
40
|
const componentsList = getComponentsList();
|
|
48
41
|
console.log('updating all Onions');
|
|
49
42
|
|
|
50
|
-
// printMemoryUsage('Before updating components');
|
|
51
|
-
|
|
52
43
|
if (
|
|
53
44
|
componentsList.includes('admin-core-generic') ||
|
|
54
45
|
componentsList.includes('admin-core-critical')
|
|
@@ -60,7 +51,6 @@ const updateAllComponents = () => {
|
|
|
60
51
|
process.exit();
|
|
61
52
|
}
|
|
62
53
|
|
|
63
|
-
// Limit the number of parallel updates
|
|
64
54
|
const maxConcurrentUpdates = 2;
|
|
65
55
|
let currentIndex = 0;
|
|
66
56
|
|
|
@@ -85,13 +75,11 @@ const updateAllComponents = () => {
|
|
|
85
75
|
console.log(`stdout: ${stdout}`);
|
|
86
76
|
}
|
|
87
77
|
|
|
88
|
-
// Recursively update the next component
|
|
89
78
|
updateNextComponent();
|
|
90
79
|
}
|
|
91
80
|
);
|
|
92
81
|
};
|
|
93
82
|
|
|
94
|
-
// Start the initial batch of updates
|
|
95
83
|
for (
|
|
96
84
|
let i = 0;
|
|
97
85
|
i < Math.min(maxConcurrentUpdates, componentsList.length);
|
|
@@ -99,37 +87,10 @@ const updateAllComponents = () => {
|
|
|
99
87
|
) {
|
|
100
88
|
updateNextComponent();
|
|
101
89
|
}
|
|
102
|
-
|
|
103
|
-
// printMemoryUsage('After updating components');
|
|
104
90
|
};
|
|
105
91
|
|
|
106
|
-
|
|
107
|
-
console.log(console.time(label));
|
|
108
|
-
const memoryUsage = process.memoryUsage();
|
|
109
|
-
console.log(`\nMemory Usage - ${label}`);
|
|
110
|
-
console.log(`RSS: ${Math.round(memoryUsage.rss / 1024 / 1024)} MB`);
|
|
111
|
-
console.log(
|
|
112
|
-
`Heap Total: ${Math.round(memoryUsage.heapTotal / 1024 / 1024)} MB`
|
|
113
|
-
);
|
|
114
|
-
console.log(
|
|
115
|
-
`Heap Used: ${Math.round(memoryUsage.heapUsed / 1024 / 1024)} MB`
|
|
116
|
-
);
|
|
117
|
-
console.log(
|
|
118
|
-
`External: ${Math.round(memoryUsage.external / 1024 / 1024)} MB`
|
|
119
|
-
);
|
|
120
|
-
console.log(
|
|
121
|
-
`Array Buffers: ${Math.round(
|
|
122
|
-
memoryUsage.arrayBuffers / 1024 / 1024
|
|
123
|
-
)} MB\n`
|
|
124
|
-
);
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
module.exports = {
|
|
128
|
-
getComponentsList,
|
|
129
|
-
updateAllComponents
|
|
130
|
-
};
|
|
92
|
+
export {getComponentsList, updateAllComponents};
|
|
131
93
|
|
|
132
|
-
|
|
133
|
-
if (require.main === module) {
|
|
94
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
134
95
|
updateAllComponents();
|
|
135
96
|
}
|
package/update-component.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {pathToFileURL} from 'node:url';
|
|
4
|
+
|
|
1
5
|
const themePath =
|
|
2
6
|
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
7
|
const libraryPath = './node_modules/@total_onion/onion-library';
|
|
6
8
|
|
|
7
9
|
// Get extension of filename
|
|
@@ -516,7 +518,7 @@ const updateComponent = () => {
|
|
|
516
518
|
);
|
|
517
519
|
};
|
|
518
520
|
|
|
519
|
-
|
|
521
|
+
export {
|
|
520
522
|
getExtension,
|
|
521
523
|
getFileType,
|
|
522
524
|
checkFolder,
|
|
@@ -531,7 +533,6 @@ module.exports = {
|
|
|
531
533
|
updateComponent
|
|
532
534
|
};
|
|
533
535
|
|
|
534
|
-
|
|
535
|
-
if (require.main === module) {
|
|
536
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
536
537
|
updateComponent();
|
|
537
538
|
}
|
package/update-template.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import {pathToFileURL} from 'node:url';
|
|
4
|
+
|
|
1
5
|
const themePath =
|
|
2
6
|
process.env.THEME_PATH || 'web/wp-content/themes/global-theme';
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
7
|
const libraryPath = './node_modules/@total_onion/onion-library';
|
|
6
8
|
|
|
7
9
|
// Get extension of filename
|
|
@@ -516,7 +518,7 @@ const updateComponent = () => {
|
|
|
516
518
|
);
|
|
517
519
|
};
|
|
518
520
|
|
|
519
|
-
|
|
521
|
+
export {
|
|
520
522
|
getExtension,
|
|
521
523
|
getFileType,
|
|
522
524
|
checkFolder,
|
|
@@ -531,7 +533,6 @@ module.exports = {
|
|
|
531
533
|
updateComponent
|
|
532
534
|
};
|
|
533
535
|
|
|
534
|
-
|
|
535
|
-
if (require.main === module) {
|
|
536
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
536
537
|
updateComponent();
|
|
537
538
|
}
|