@eightshift/frontend-libs-tailwind 1.2.0 → 1.3.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 (47) hide show
  1. package/.prettierrc +1 -1
  2. package/CHANGELOG.md +8 -0
  3. package/blocks/init/assets/scripts/application-admin.js +1 -1
  4. package/blocks/init/src/Blocks/assets/scripts/link-section-editor.js +5 -1
  5. package/blocks/init/src/Blocks/assets/scripts/shared.js +3 -1
  6. package/blocks/init/src/Blocks/components/button/components/button-options.js +20 -2
  7. package/blocks/init/src/Blocks/components/card/components/card-editor.js +2 -1
  8. package/blocks/init/src/Blocks/components/icon/icon.php +3 -1
  9. package/blocks/init/src/Blocks/components/image/components/image-editor.js +7 -1
  10. package/blocks/init/src/Blocks/components/image/components/image-options.js +17 -3
  11. package/blocks/init/src/Blocks/components/list/components/list-options.js +3 -1
  12. package/blocks/init/src/Blocks/components/modal/assets/index.js +9 -7
  13. package/blocks/init/src/Blocks/components/paragraph/components/paragraph-options.js +3 -1
  14. package/blocks/init/src/Blocks/components/share/assets/index.js +5 -1
  15. package/blocks/init/src/Blocks/components/share/components/share-options.js +11 -2
  16. package/blocks/init/src/Blocks/components/video/components/video-editor.js +4 -2
  17. package/blocks/init/src/Blocks/components/video/components/video-options.js +24 -3
  18. package/blocks/init/src/Blocks/custom/carousel/assets/pagination.js +8 -2
  19. package/blocks/init/src/Blocks/custom/column/components/column-options.js +12 -4
  20. package/blocks/init/src/Blocks/custom/columns/components/columns-editor.js +6 -2
  21. package/blocks/init/src/Blocks/custom/featured-content/components/featured-content-options.js +29 -8
  22. package/blocks/init/src/Blocks/custom/map/components/map-editor.js +12 -2
  23. package/blocks/init/src/Blocks/custom/map/components/map-options.js +40 -11
  24. package/blocks/init/src/Blocks/custom/site-footer/components/site-footer-options.js +3 -1
  25. package/blocks/init/src/Blocks/wrapper/components/wrapper-options.js +19 -4
  26. package/bun.lockb +0 -0
  27. package/package.json +15 -15
  28. package/schemas/block.json +16 -16
  29. package/schemas/component.json +18 -18
  30. package/scripts/components/block-inserter.js +4 -1
  31. package/scripts/components/link-section-editor.js +5 -1
  32. package/scripts/components/media-picker.js +12 -1
  33. package/scripts/components/picker-placeholder.js +6 -2
  34. package/scripts/components/server-side-render.js +4 -1
  35. package/scripts/components/settings/settings.js +8 -2
  36. package/scripts/editor/attributes.js +8 -3
  37. package/scripts/editor/editor.js +7 -1
  38. package/scripts/editor/fetch.js +2 -1
  39. package/scripts/editor/index.js +8 -1
  40. package/scripts/editor/options.js +3 -1
  41. package/scripts/editor/registration.js +87 -17
  42. package/scripts/editor/tailwindcss.js +96 -58
  43. package/scripts/helpers/index.js +7 -1
  44. package/scripts/index.js +15 -2
  45. package/webpack/base.mjs +3 -1
  46. package/webpack/helpers.mjs +13 -3
  47. package/webpack/project.mjs +8 -2
@@ -84,7 +84,11 @@ export const registerBlocks = (
84
84
 
85
85
  // Get Block Transforms component from block name and transformsComponentPath.
86
86
  if (transformsComponentPath !== null) {
87
- const blockTransformsComponent = getBlockGenericComponent(blockManifest.blockName, transformsComponentPath, 'transforms');
87
+ const blockTransformsComponent = getBlockGenericComponent(
88
+ blockManifest.blockName,
89
+ transformsComponentPath,
90
+ 'transforms',
91
+ );
88
92
 
89
93
  if (blockTransformsComponent !== null) {
90
94
  blockManifest.transforms = blockTransformsComponent;
@@ -93,7 +97,11 @@ export const registerBlocks = (
93
97
 
94
98
  // Get Block Deprecations component from block name and deprecationsComponentPath.
95
99
  if (deprecationsComponentPath !== null) {
96
- const blockDeprecationsComponent = getBlockGenericComponent(blockManifest.blockName, deprecationsComponentPath, 'deprecations');
100
+ const blockDeprecationsComponent = getBlockGenericComponent(
101
+ blockManifest.blockName,
102
+ deprecationsComponentPath,
103
+ 'deprecations',
104
+ );
97
105
 
98
106
  if (blockDeprecationsComponent !== null) {
99
107
  blockManifest.deprecated = blockDeprecationsComponent;
@@ -111,7 +119,11 @@ export const registerBlocks = (
111
119
 
112
120
  // Get Block Overrides component from block name and overridesComponentPath.
113
121
  if (overridesComponentPath !== null) {
114
- const blockOverridesComponent = getBlockGenericComponent(blockManifest.blockName, overridesComponentPath, 'overrides');
122
+ const blockOverridesComponent = getBlockGenericComponent(
123
+ blockManifest.blockName,
124
+ overridesComponentPath,
125
+ 'overrides',
126
+ );
115
127
 
116
128
  if (blockOverridesComponent !== null) {
117
129
  blockManifest = Object.assign(blockManifest, blockOverridesComponent);
@@ -119,7 +131,14 @@ export const registerBlocks = (
119
131
  }
120
132
 
121
133
  // Pass data to registerBlock helper to get final output for registerBlockType.
122
- const blockDetails = registerBlock(globalManifest, wrapperManifest, componentsManifest, blockManifest, wrapperComponent, blockComponent);
134
+ const blockDetails = registerBlock(
135
+ globalManifest,
136
+ wrapperManifest,
137
+ componentsManifest,
138
+ blockManifest,
139
+ wrapperComponent,
140
+ blockComponent,
141
+ );
123
142
 
124
143
  // Format the 'deprecated' attribute details to match the format Gutenberg wants.
125
144
  if (blockDetails?.options?.deprecated) {
@@ -145,7 +164,10 @@ export const registerBlocks = (
145
164
  };
146
165
  },
147
166
 
148
- isEligible: deprecation?.isEligible ?? ((attributes) => Object.keys(deprecation.oldAttributes).every((v) => Object.keys(attributes).includes(v))),
167
+ isEligible:
168
+ deprecation?.isEligible ??
169
+ ((attributes) =>
170
+ Object.keys(deprecation.oldAttributes).every((v) => Object.keys(attributes).includes(v))),
149
171
  save: blockDetails.options.save,
150
172
  };
151
173
  });
@@ -196,7 +218,12 @@ export const registerBlocks = (
196
218
  * );
197
219
  * ```
198
220
  */
199
- export const registerVariations = (globalManifest = {}, variationsManifestPath, blocksManifestPath = null, overridesComponentPath = null) => {
221
+ export const registerVariations = (
222
+ globalManifest = {},
223
+ variationsManifestPath,
224
+ blocksManifestPath = null,
225
+ overridesComponentPath = null,
226
+ ) => {
200
227
  const variationsManifests = variationsManifestPath.keys().map(variationsManifestPath);
201
228
 
202
229
  // Set all store values.
@@ -210,7 +237,11 @@ export const registerVariations = (globalManifest = {}, variationsManifestPath,
210
237
  if (active) {
211
238
  // Get Block Overrides component from block name and overridesComponentPath.
212
239
  if (overridesComponentPath !== null) {
213
- const blockOverridesComponent = getBlockGenericComponent(variationManifest.name, overridesComponentPath, 'overrides');
240
+ const blockOverridesComponent = getBlockGenericComponent(
241
+ variationManifest.name,
242
+ overridesComponentPath,
243
+ 'overrides',
244
+ );
214
245
 
215
246
  if (blockOverridesComponent !== null) {
216
247
  variationManifest = Object.assign(variationManifest, blockOverridesComponent);
@@ -218,7 +249,11 @@ export const registerVariations = (globalManifest = {}, variationsManifestPath,
218
249
  }
219
250
 
220
251
  // Pass data to registerVariation helper to get final output for registerBlockVariation.
221
- const blockDetails = registerVariation(globalManifest, variationManifest, blocksManifestPath !== null ? blocksManifestPath.keys().map(blocksManifestPath) : []);
252
+ const blockDetails = registerVariation(
253
+ globalManifest,
254
+ variationManifest,
255
+ blocksManifestPath !== null ? blocksManifestPath.keys().map(blocksManifestPath) : [],
256
+ );
222
257
 
223
258
  // Native WP method for block registration.
224
259
  registerBlockVariation(blockDetails.blockName, blockDetails.options);
@@ -248,11 +283,15 @@ export const getBlockEditComponent = (blockName, paths, fileName) => {
248
283
  const pathsKeys = paths.keys();
249
284
 
250
285
  // Get Block edit component from block name and pathsKeys.
251
- const editComponent = pathsKeys.filter((filePath) => filePath === `./${blockName}/${blockName}-${fileName}.js`).map(paths)[0];
286
+ const editComponent = pathsKeys
287
+ .filter((filePath) => filePath === `./${blockName}/${blockName}-${fileName}.js`)
288
+ .map(paths)[0];
252
289
 
253
290
  // If edit component is missing throw and error.
254
291
  if (typeof editComponent === 'undefined') {
255
- throw Error(`It looks like you are missing block edit component for block: ${blockName}, please check if you have ${blockName}-block.js file in your block folder.`);
292
+ throw Error(
293
+ `It looks like you are missing block edit component for block: ${blockName}, please check if you have ${blockName}-block.js file in your block folder.`,
294
+ );
256
295
  }
257
296
 
258
297
  // No mater if class of functional component is used fetch the first item in an object.
@@ -260,7 +299,9 @@ export const getBlockEditComponent = (blockName, paths, fileName) => {
260
299
 
261
300
  // If edit component callback is missing throw and error.
262
301
  if (typeof editCallback === 'undefined') {
263
- throw Error(`It looks like you are missing block edit component for block: ${blockName}, please check if you have ${blockName}-block.js file in your block folder.`);
302
+ throw Error(
303
+ `It looks like you are missing block edit component for block: ${blockName}, please check if you have ${blockName}-block.js file in your block folder.`,
304
+ );
264
305
  }
265
306
 
266
307
  return editCallback;
@@ -283,7 +324,9 @@ export const getBlockGenericComponent = (blockName, paths, fileName) => {
283
324
  const pathsKeys = paths.keys();
284
325
 
285
326
  // Get Block edit component from block name and pathsKeys.
286
- const editComponent = pathsKeys.filter((filePath) => filePath === `./${blockName}/${blockName}-${fileName}.js`).map(paths)[0];
327
+ const editComponent = pathsKeys
328
+ .filter((filePath) => filePath === `./${blockName}/${blockName}-${fileName}.js`)
329
+ .map(paths)[0];
287
330
 
288
331
  // If edit component is missing throw and error.
289
332
  if (typeof editComponent === 'undefined') {
@@ -492,7 +535,14 @@ export const getIconOptions = (globalManifest, blockManifest) => {
492
535
  *
493
536
  * @returns {object}
494
537
  */
495
- export const prepareComponentAttribute = (manifest, newName, realName, isExample = false, parent = '', currentAttributes = false) => {
538
+ export const prepareComponentAttribute = (
539
+ manifest,
540
+ newName,
541
+ realName,
542
+ isExample = false,
543
+ parent = '',
544
+ currentAttributes = false,
545
+ ) => {
496
546
  const output = {};
497
547
 
498
548
  // Define different data point for attributes or example.
@@ -563,17 +613,30 @@ export const prepareComponentAttributes = (componentsManifest, manifest, isExamp
563
613
 
564
614
  // Bailout if component doesn't exist.
565
615
  if (!component) {
566
- throw Error(`Component specified in "${name}" manifest doesn't exist in your components list. Please check if you project has "${realComponentName}" component.`);
616
+ throw Error(
617
+ `Component specified in "${name}" manifest doesn't exist in your components list. Please check if you project has "${realComponentName}" component.`,
618
+ );
567
619
  }
568
620
 
569
621
  let outputAttributes = {};
570
622
 
571
623
  // If component has more components do recursive loop.
572
624
  if (component?.components) {
573
- outputAttributes = prepareComponentAttributes(componentsManifest, component, isExample, `${newParent}${upperFirst(camelCase(newComponentName))}`);
625
+ outputAttributes = prepareComponentAttributes(
626
+ componentsManifest,
627
+ component,
628
+ isExample,
629
+ `${newParent}${upperFirst(camelCase(newComponentName))}`,
630
+ );
574
631
  } else {
575
632
  // Output the component attributes if there is no nesting left, and append the parent prefixes.
576
- outputAttributes = prepareComponentAttribute(component, newComponentName, realComponentName, isExample, newParent);
633
+ outputAttributes = prepareComponentAttribute(
634
+ component,
635
+ newComponentName,
636
+ realComponentName,
637
+ isExample,
638
+ newParent,
639
+ );
577
640
  }
578
641
 
579
642
  // Populate the output recursively.
@@ -752,7 +815,14 @@ export const registerVariation = (globalManifest = {}, variationManifest = {}) =
752
815
  *
753
816
  * @returns {object}
754
817
  */
755
- export const registerBlock = (globalManifest = {}, wrapperManifest = {}, componentsManifest = {}, blockManifest = {}, wrapperComponent, blockComponent) => {
818
+ export const registerBlock = (
819
+ globalManifest = {},
820
+ wrapperManifest = {},
821
+ componentsManifest = {},
822
+ blockManifest = {},
823
+ wrapperComponent,
824
+ blockComponent,
825
+ ) => {
756
826
  // Block Icon option.
757
827
  blockManifest['icon'] = getIconOptions(globalManifest, blockManifest);
758
828
 
@@ -21,10 +21,15 @@ import { clsx } from '@eightshift/ui-components/utilities';
21
21
  */
22
22
  export const getTwPart = (part, manifest, ...custom) => {
23
23
  if (!part || !manifest || !manifest?.tailwind || Object.keys(manifest?.tailwind ?? {}).length === 0) {
24
- return '';
24
+ return clsx(...custom);
25
25
  }
26
26
 
27
- const partClasses = manifest?.tailwind?.parts?.[part]?.twClassesEditor ?? manifest?.tailwind?.parts?.[part]?.twClasses ?? '';
27
+ let partClasses =
28
+ manifest?.tailwind?.parts?.[part]?.twClassesEditor ?? manifest?.tailwind?.parts?.[part]?.twClasses ?? '';
29
+
30
+ if (Array.isArray(partClasses)) {
31
+ partClasses = partClasses.join(' ');
32
+ }
28
33
 
29
34
  return clsx(partClasses, ...custom);
30
35
  };
@@ -50,46 +55,56 @@ export const getTwPart = (part, manifest, ...custom) => {
50
55
  */
51
56
  export const getTwDynamicPart = (part, attributes, manifest, ...custom) => {
52
57
  if (!part || !manifest || !manifest?.tailwind || Object.keys(manifest?.tailwind ?? {}).length === 0) {
53
- return '';
58
+ return clsx(...custom);
54
59
  }
55
60
 
56
- const baseClasses = manifest?.tailwind?.parts?.[part]?.twClassesEditor ?? manifest?.tailwind?.parts?.[part]?.twClasses ?? '';
61
+ const baseClasses =
62
+ manifest?.tailwind?.parts?.[part]?.twClassesEditor ?? manifest?.tailwind?.parts?.[part]?.twClasses ?? '';
57
63
 
58
- const mainClasses = Object.entries(manifest?.tailwind?.options ?? {}).reduce((current, [attributeName, { responsive, twClasses, twClassesEditor, part: partName }]) => {
59
- if (partName !== part) {
60
- return current;
61
- }
64
+ const mainClasses = Object.entries(manifest?.tailwind?.options ?? {}).reduce(
65
+ (current, [attributeName, { responsive, twClasses, twClassesEditor, part: partName }]) => {
66
+ if (partName !== part) {
67
+ return current;
68
+ }
62
69
 
63
- const value = checkAttr(attributeName, attributes, manifest, true);
70
+ const value = checkAttr(attributeName, attributes, manifest, true);
64
71
 
65
- if (!value) {
66
- return current;
67
- }
72
+ if (!value) {
73
+ return current;
74
+ }
68
75
 
69
- if (!responsive) {
70
- return [...current, twClassesEditor?.[value] ?? twClasses?.[value]];
71
- }
76
+ if (!responsive) {
77
+ const currentClasses = twClassesEditor?.[value] ?? twClasses?.[value];
72
78
 
73
- const responsiveClasses = Object.keys(value).reduce((curr, breakpoint) => {
74
- if (breakpoint === '_desktopFirst') {
75
- return curr;
79
+ if (Array.isArray(currentClasses)) {
80
+ return [...current, ...currentClasses];
81
+ }
82
+
83
+ return [...current, currentClasses];
76
84
  }
77
85
 
78
- const currentClasses = twClassesEditor?.[value[breakpoint]] ?? twClasses?.[value[breakpoint]];
86
+ const responsiveClasses = Object.keys(value).reduce((curr, breakpoint) => {
87
+ if (breakpoint === '_desktopFirst') {
88
+ return curr;
89
+ }
90
+
91
+ let currentClasses = twClassesEditor?.[value[breakpoint]] ?? twClasses?.[value[breakpoint]];
79
92
 
80
- if (breakpoint === '_default') {
81
- return [...curr, currentClasses];
82
- }
93
+ if (!Array.isArray(currentClasses)) {
94
+ currentClasses = [currentClasses];
95
+ }
83
96
 
84
- if (Array.isArray(currentClasses)) {
85
- return [...curr, ...currentClasses.split(' ').map((currentClass) => `${breakpoint}:${currentClass}`)];
86
- }
97
+ if (breakpoint === '_default') {
98
+ return [...curr, ...currentClasses];
99
+ }
87
100
 
88
- return [...curr, `${breakpoint}:${currentClasses}`];
89
- }, []);
101
+ return [...curr, ...currentClasses.split(' ').map((currentClass) => `${breakpoint}:${currentClass}`)];
102
+ }, []);
90
103
 
91
- return [...current, ...responsiveClasses];
92
- }, []);
104
+ return [...current, ...responsiveClasses];
105
+ },
106
+ [],
107
+ );
93
108
 
94
109
  return clsx(baseClasses, ...mainClasses, ...custom);
95
110
  };
@@ -112,46 +127,59 @@ export const getTwDynamicPart = (part, attributes, manifest, ...custom) => {
112
127
  */
113
128
  export const getTwClasses = (attributes, manifest, ...custom) => {
114
129
  if (!attributes || !manifest || !manifest?.tailwind || Object.keys(manifest?.tailwind ?? {}).length === 0) {
115
- return '';
130
+ return clsx(...custom);
116
131
  }
117
132
 
118
- const baseClasses = manifest?.tailwind?.base?.twClassesEditor ?? manifest?.tailwind?.base?.twClasses ?? '';
119
-
120
- const mainClasses = Object.entries(manifest?.tailwind?.options ?? {}).reduce((current, [attributeName, { responsive, twClasses, twClassesEditor, part: partName }]) => {
121
- if (partName) {
122
- return current;
123
- }
133
+ let baseClasses = manifest?.tailwind?.base?.twClassesEditor ?? manifest?.tailwind?.base?.twClasses ?? '';
124
134
 
125
- const value = checkAttr(attributeName, attributes, manifest, true);
135
+ if (Array.isArray(baseClasses)) {
136
+ baseClasses = baseClasses.join(' ');
137
+ }
126
138
 
127
- if (!value) {
128
- return current;
129
- }
139
+ const mainClasses = Object.entries(manifest?.tailwind?.options ?? {}).reduce(
140
+ (current, [attributeName, { responsive, twClasses, twClassesEditor, part: partName }]) => {
141
+ if (partName) {
142
+ return current;
143
+ }
130
144
 
131
- if (!responsive) {
132
- return [...current, twClassesEditor?.[value] ?? twClasses?.[value]];
133
- }
145
+ const value = checkAttr(attributeName, attributes, manifest, true);
134
146
 
135
- const responsiveClasses = Object.keys(value).reduce((curr, breakpoint) => {
136
- if (breakpoint === '_desktopFirst') {
137
- return curr;
147
+ if (!value) {
148
+ return current;
138
149
  }
139
150
 
140
- const currentClasses = twClassesEditor?.[value[breakpoint]] ?? twClasses?.[value[breakpoint]];
151
+ if (!responsive) {
152
+ let currentClasses = twClassesEditor?.[value] ?? twClasses?.[value];
141
153
 
142
- if (breakpoint === '_default') {
143
- return [...curr, currentClasses];
144
- }
154
+ if (Array.isArray(currentClasses)) {
155
+ currentClasses = currentClasses.join(' ');
156
+ }
145
157
 
146
- if (Array.isArray(currentClasses)) {
147
- return [...curr, ...currentClasses.split(' ').map((currentClass) => `${breakpoint}:${currentClass}`)];
158
+ return [...current, currentClasses];
148
159
  }
149
160
 
150
- return [...curr, `${breakpoint}:${currentClasses}`];
151
- }, []);
161
+ const responsiveClasses = Object.keys(value).reduce((curr, breakpoint) => {
162
+ if (breakpoint === '_desktopFirst') {
163
+ return curr;
164
+ }
165
+
166
+ let currentClasses = twClassesEditor?.[value[breakpoint]] ?? twClasses?.[value[breakpoint]];
167
+
168
+ if (!Array.isArray(currentClasses)) {
169
+ currentClasses = [currentClasses];
170
+ }
171
+
172
+ if (breakpoint === '_default') {
173
+ return [...curr, ...currentClasses];
174
+ }
152
175
 
153
- return [...current, ...responsiveClasses];
154
- }, []);
176
+ return [...curr, ...currentClasses.map((currentClass) => `${breakpoint}:${currentClass}`)];
177
+ }, []);
178
+
179
+ return [...current, ...responsiveClasses];
180
+ },
181
+ [],
182
+ );
155
183
 
156
184
  const combinationClasses =
157
185
  manifest?.tailwind?.combinations?.reduce((current, { attributes: conditions, twClasses, twClassesEditor }) => {
@@ -171,7 +199,13 @@ export const getTwClasses = (attributes, manifest, ...custom) => {
171
199
  }
172
200
  }
173
201
 
174
- return [...current, twClassesEditor ?? twClasses];
202
+ let currentClasses = twClassesEditor ?? twClasses;
203
+
204
+ if (!Array.isArray(currentClasses)) {
205
+ currentClasses = [currentClasses];
206
+ }
207
+
208
+ return [...current, ...currentClasses];
175
209
  }, []) ?? [];
176
210
 
177
211
  return clsx(baseClasses, ...mainClasses, ...combinationClasses, ...custom);
@@ -297,9 +331,13 @@ function* extractKeys(obj, parentKey = '', isResponsive = false) {
297
331
  }
298
332
 
299
333
  const combineAndRemoveDuplicates = (results) => {
300
- return results.reduce((acc, { key, value, responsive }) => {
334
+ return results.reduce((acc, { value, responsive }) => {
301
335
  acc[responsive] = acc[responsive] ? `${acc[responsive]} ${value}` : value;
302
336
 
337
+ if (Array.isArray(acc[responsive])) {
338
+ acc[responsive] = acc[responsive].join(' ');
339
+ }
340
+
303
341
  return acc;
304
342
  }, {});
305
343
  };
@@ -1,5 +1,11 @@
1
1
  // All exports are sorted in alphabetical order.
2
2
 
3
- export { getBreakpointData, getBreakpointNames, getGlobalManifest, getBreakpointUiData, getResponsiveData } from './breakpoints';
3
+ export {
4
+ getBreakpointData,
5
+ getBreakpointNames,
6
+ getGlobalManifest,
7
+ getBreakpointUiData,
8
+ getResponsiveData,
9
+ } from './breakpoints';
4
10
  export { cookies } from './cookies';
5
11
  export { dynamicImport } from './dynamic-import';
package/scripts/index.js CHANGED
@@ -15,10 +15,23 @@ export * from './editor/fetch';
15
15
  export * from './editor/options';
16
16
  export * from './editor/utility';
17
17
  export * from './editor/tailwindcss';
18
- export { getAttributes, getExample, getFullBlockName, getFullBlockNameVariation, registerBlocks, registerVariations } from './editor/registration';
18
+ export {
19
+ getAttributes,
20
+ getExample,
21
+ getFullBlockName,
22
+ getFullBlockNameVariation,
23
+ registerBlocks,
24
+ registerVariations,
25
+ } from './editor/registration';
19
26
  export { STORE_NAME, BUILD_VERSION, setStore, setStoreGlobalWindow, setConfigFlags } from './editor/store';
20
27
 
21
28
  // Helpers.
22
- export { getBreakpointData, getBreakpointNames, getGlobalManifest, getBreakpointUiData, getResponsiveData } from './helpers/breakpoints';
29
+ export {
30
+ getBreakpointData,
31
+ getBreakpointNames,
32
+ getGlobalManifest,
33
+ getBreakpointUiData,
34
+ getResponsiveData,
35
+ } from './helpers/breakpoints';
23
36
  export { cookies } from './helpers/cookies';
24
37
  export { dynamicImport } from './helpers/dynamic-import';
package/webpack/base.mjs CHANGED
@@ -26,7 +26,9 @@ export default (options) => {
26
26
  if (!options.overrides.includes('definePlugin')) {
27
27
  plugins.push(
28
28
  new webpack.DefinePlugin({
29
- 'process.env.VERSION': JSON.stringify(Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15)),
29
+ 'process.env.VERSION': JSON.stringify(
30
+ Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15),
31
+ ),
30
32
  'process.browser': true,
31
33
  }),
32
34
  );
@@ -25,7 +25,9 @@ function getConfig(
25
25
  blocksManifestSettingsPath = 'src/Blocks/manifest.json',
26
26
  ) {
27
27
  if (typeof projectDir === 'undefined') {
28
- throw Error('projectDir parameter is empty, please provide. This key represents: Current project directory absolute path. For example: __dirname');
28
+ throw Error(
29
+ 'projectDir parameter is empty, please provide. This key represents: Current project directory absolute path. For example: __dirname',
30
+ );
29
31
  }
30
32
 
31
33
  if (typeof projectPathConfig === 'undefined') {
@@ -57,8 +59,16 @@ function getConfig(
57
59
  applicationEntry: path.resolve(absolutePath, assetsPathConfigClean, 'application.js'),
58
60
  applicationAdminEntry: path.resolve(absolutePath, assetsPathConfigClean, 'application-admin.js'),
59
61
  applicationBlocksEntry: path.resolve(absolutePath, blocksAssetsPathConfigClean, 'application-blocks.js'),
60
- applicationBlocksEditorEntry: path.resolve(absolutePath, blocksAssetsPathConfigClean, 'application-blocks-editor.js'),
61
- applicationBlocksFrontendEntry: path.resolve(absolutePath, blocksAssetsPathConfigClean, 'application-blocks-frontend.js'),
62
+ applicationBlocksEditorEntry: path.resolve(
63
+ absolutePath,
64
+ blocksAssetsPathConfigClean,
65
+ 'application-blocks-editor.js',
66
+ ),
67
+ applicationBlocksFrontendEntry: path.resolve(
68
+ absolutePath,
69
+ blocksAssetsPathConfigClean,
70
+ 'application-blocks-frontend.js',
71
+ ),
62
72
 
63
73
  blocksManifestSettingsPath: path.resolve(absolutePath, blocksManifestSettingsPathClean),
64
74
  };
@@ -34,12 +34,18 @@ export default (options) => {
34
34
  }
35
35
 
36
36
  // Load ApplicationBlocksEditor Entrypoint.
37
- if (!options.overrides.includes('applicationBlocksEditor') && fs.existsSync(options.config.applicationBlocksEditorEntry)) {
37
+ if (
38
+ !options.overrides.includes('applicationBlocksEditor') &&
39
+ fs.existsSync(options.config.applicationBlocksEditorEntry)
40
+ ) {
38
41
  entry.applicationBlocksEditor = options.config.applicationBlocksEditorEntry;
39
42
  }
40
43
 
41
44
  // Load applicationBlocksFrontend Entrypoint.
42
- if (!options.overrides.includes('applicationBlocksFrontend') && fs.existsSync(options.config.applicationBlocksFrontendEntry)) {
45
+ if (
46
+ !options.overrides.includes('applicationBlocksFrontend') &&
47
+ fs.existsSync(options.config.applicationBlocksFrontendEntry)
48
+ ) {
43
49
  entry.applicationBlocksFrontend = options.config.applicationBlocksFrontendEntry;
44
50
  }
45
51