@schalkneethling/miyagi-core 4.4.2 → 4.4.3

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 (115) hide show
  1. package/README.md +7 -2
  2. package/api/app.js +16 -16
  3. package/api/index.js +263 -262
  4. package/bin/miyagi.js +1 -1
  5. package/dist/css/iframe.css +6 -30
  6. package/frontend/assets/css/iframe/accordion-tabs.css +39 -39
  7. package/frontend/assets/css/iframe/jsontree.js.css +149 -149
  8. package/frontend/assets/css/iframe/prism.css +45 -45
  9. package/frontend/assets/css/iframe/styleguide/colors.css +27 -27
  10. package/frontend/assets/css/iframe/styleguide/fonts.css +23 -23
  11. package/frontend/assets/css/iframe/styleguide/index.css +58 -58
  12. package/frontend/assets/css/iframe/styleguide/spacings.css +10 -10
  13. package/frontend/assets/css/iframe.css +191 -191
  14. package/frontend/assets/css/main/menu/config-switcher.css +21 -21
  15. package/frontend/assets/css/main/menu/config-switchers.css +34 -34
  16. package/frontend/assets/css/main/menu/goto.css +16 -16
  17. package/frontend/assets/css/main/menu/nav.css +49 -49
  18. package/frontend/assets/css/main/menu/search.css +34 -34
  19. package/frontend/assets/css/main/menu/title.css +18 -18
  20. package/frontend/assets/css/main/menu.css +89 -89
  21. package/frontend/assets/css/main/reset.css +47 -47
  22. package/frontend/assets/css/main.css +41 -41
  23. package/frontend/assets/css/shared.css +16 -16
  24. package/frontend/assets/css/tokens.css +108 -107
  25. package/frontend/assets/js/_accordion-tabs.js +392 -392
  26. package/frontend/assets/js/_goto.js +59 -59
  27. package/frontend/assets/js/_iframe-links.js +14 -14
  28. package/frontend/assets/js/_is-triggered.js +3 -3
  29. package/frontend/assets/js/_main.js +369 -369
  30. package/frontend/assets/js/_mock-data.js +8 -8
  31. package/frontend/assets/js/_prism.js +1082 -1081
  32. package/frontend/assets/js/_search.js +186 -186
  33. package/frontend/assets/js/_socket.js +44 -44
  34. package/frontend/assets/js/config-switcher/development-mode.js +38 -38
  35. package/frontend/assets/js/config-switcher/index.js +55 -55
  36. package/frontend/assets/js/config-switcher/text-direction.js +22 -22
  37. package/frontend/assets/js/config-switcher/theme.js +68 -68
  38. package/frontend/assets/js/iframe.build.js +25 -25
  39. package/frontend/assets/js/iframe.js +38 -38
  40. package/frontend/assets/js/jsontree.js +979 -976
  41. package/frontend/assets/js/main.build.js +29 -29
  42. package/frontend/assets/js/main.js +31 -31
  43. package/frontend/assets/js/styleguide/color-converter.js +652 -652
  44. package/frontend/assets/js/styleguide/index.js +100 -100
  45. package/lib/build/index.js +1014 -1020
  46. package/lib/cli/app.js +16 -16
  47. package/lib/cli/component.js +50 -50
  48. package/lib/cli/doctor.js +130 -121
  49. package/lib/cli/drupal-assets.js +163 -157
  50. package/lib/cli/lint.js +196 -196
  51. package/lib/cli/run.js +150 -146
  52. package/lib/config.js +86 -86
  53. package/lib/constants/lint-log-levels.js +6 -6
  54. package/lib/drupal/load-assets-config.js +59 -60
  55. package/lib/drupal/resolve-library-assets.js +132 -141
  56. package/lib/errors.js +20 -20
  57. package/lib/generator/component.js +124 -124
  58. package/lib/generator/mocks.js +156 -156
  59. package/lib/helpers.js +68 -68
  60. package/lib/i18n/en.js +93 -93
  61. package/lib/i18n/index.js +8 -8
  62. package/lib/index.js +13 -13
  63. package/lib/init/args.js +153 -153
  64. package/lib/init/config.js +452 -438
  65. package/lib/init/engines.js +41 -41
  66. package/lib/init/index.js +83 -83
  67. package/lib/init/rendering.js +3 -3
  68. package/lib/init/static.js +90 -90
  69. package/lib/init/twing/cache.js +27 -27
  70. package/lib/init/twing/functions.js +37 -37
  71. package/lib/init/views.js +5 -5
  72. package/lib/logger.js +72 -72
  73. package/lib/mocks/get.js +88 -88
  74. package/lib/mocks/index.js +2 -2
  75. package/lib/mocks/resolve/ref.js +447 -447
  76. package/lib/mocks/resolve/tpl.js +218 -218
  77. package/lib/mocks/resolve.js +154 -154
  78. package/lib/render/helpers/resolve-assets.js +29 -39
  79. package/lib/render/helpers.js +27 -27
  80. package/lib/render/index.js +18 -18
  81. package/lib/render/views/iframe/component.docs.js +50 -50
  82. package/lib/render/views/iframe/component.js +249 -248
  83. package/lib/render/views/iframe/design-tokens/colors.js +38 -38
  84. package/lib/render/views/iframe/design-tokens/index.js +3 -3
  85. package/lib/render/views/iframe/design-tokens/sizes.js +35 -35
  86. package/lib/render/views/iframe/design-tokens/typography.js +37 -37
  87. package/lib/render/views/iframe/docs.js +42 -42
  88. package/lib/render/views/iframe/index.js +28 -28
  89. package/lib/render/views/iframe/variation.js +89 -89
  90. package/lib/render/views/iframe/variation.standalone.js +69 -68
  91. package/lib/render/views/main/component.docs.js +38 -38
  92. package/lib/render/views/main/component.js +55 -55
  93. package/lib/render/views/main/design-tokens.js +38 -38
  94. package/lib/render/views/main/docs.js +33 -33
  95. package/lib/render/views/main/index.js +33 -33
  96. package/lib/state/components.js +99 -99
  97. package/lib/state/css.js +33 -33
  98. package/lib/state/docs.js +72 -72
  99. package/lib/state/file-contents.js +154 -154
  100. package/lib/state/helpers.js +53 -53
  101. package/lib/state/index.js +39 -39
  102. package/lib/state/menu/index.js +202 -202
  103. package/lib/state/menu/structure.js +84 -84
  104. package/lib/state/partials.js +12 -12
  105. package/lib/state/source-tree.js +51 -51
  106. package/lib/styleguide/color-names.js +148 -148
  107. package/lib/styleguide/colors.js +113 -113
  108. package/lib/styleguide/helpers.js +33 -33
  109. package/lib/styleguide/index.js +4 -4
  110. package/lib/styleguide/media-queries.js +18 -18
  111. package/lib/styleguide/spacings.js +22 -22
  112. package/lib/styleguide/typography.js +46 -46
  113. package/lib/validator/mocks.js +110 -83
  114. package/lib/validator/schemas.js +236 -227
  115. package/package.json +118 -117
@@ -18,105 +18,105 @@ import log from "../../../logger.js";
18
18
  * @param {boolean} [object.noCli]
19
19
  */
20
20
  export default async function renderIframeComponent({
21
- res,
22
- component,
23
- cb,
24
- cookies,
25
- noCli,
21
+ res,
22
+ component,
23
+ cb,
24
+ cookies,
25
+ noCli,
26
26
  }) {
27
- const hasTemplate =
28
- component.paths.tpl &&
29
- Object.values(global.state.partials).includes(component.paths.tpl.full);
30
- const componentJson = (await getComponentData(component)) || [];
31
- const componentDocumentation =
32
- global.state.fileContents[path.join(component.paths.dir.full, "README.md")];
33
- const componentSchema =
34
- global.state.fileContents[component.paths.schema.full];
35
- const componentTemplate = hasTemplate
36
- ? global.state.fileContents[component.paths.tpl.full]
37
- : null;
27
+ const hasTemplate =
28
+ component.paths.tpl &&
29
+ Object.values(global.state.partials).includes(component.paths.tpl.full);
30
+ const componentJson = (await getComponentData(component)) || [];
31
+ const componentDocumentation =
32
+ global.state.fileContents[path.join(component.paths.dir.full, "README.md")];
33
+ const componentSchema =
34
+ global.state.fileContents[component.paths.schema.full];
35
+ const componentTemplate = hasTemplate
36
+ ? global.state.fileContents[component.paths.tpl.full]
37
+ : null;
38
38
 
39
- let mockFilePath;
39
+ let mockFilePath;
40
40
 
41
- const defaultMockDataPath = component.paths.mocks.full(
42
- global.config.files.mocks.extension[0],
43
- );
44
- const jsMockDataPath = component.paths.mocks.full(
45
- global.config.files.mocks.extension[1],
46
- );
47
- const jsMockData = global.state.fileContents[jsMockDataPath];
41
+ const defaultMockDataPath = component.paths.mocks.full(
42
+ global.config.files.mocks.extension[0],
43
+ );
44
+ const jsMockDataPath = component.paths.mocks.full(
45
+ global.config.files.mocks.extension[1],
46
+ );
47
+ const jsMockData = global.state.fileContents[jsMockDataPath];
48
48
 
49
- if (jsMockData) {
50
- mockFilePath = jsMockDataPath;
51
- } else {
52
- mockFilePath = defaultMockDataPath;
53
- }
49
+ if (jsMockData) {
50
+ mockFilePath = jsMockDataPath;
51
+ } else {
52
+ mockFilePath = defaultMockDataPath;
53
+ }
54
54
 
55
- const componentMocks = global.state.fileContents[mockFilePath];
55
+ const componentMocks = global.state.fileContents[mockFilePath];
56
56
 
57
- let componentSchemaString;
58
- if (componentSchema) {
59
- if (["yaml", "yml"].includes(global.config.files.schema.extension)) {
60
- componentSchemaString = jsonToYaml.dump(componentSchema);
61
- } else {
62
- componentSchemaString = JSON.stringify(componentSchema, null, 2);
63
- }
64
- }
57
+ let componentSchemaString;
58
+ if (componentSchema) {
59
+ if (["yaml", "yml"].includes(global.config.files.schema.extension)) {
60
+ componentSchemaString = jsonToYaml.dump(componentSchema);
61
+ } else {
62
+ componentSchemaString = JSON.stringify(componentSchema, null, 2);
63
+ }
64
+ }
65
65
 
66
- let componentMocksString;
67
- if (componentMocks) {
68
- if (["yaml", "yml"].includes(global.config.files.mocks.extension[0])) {
69
- componentMocksString = jsonToYaml.dump(componentMocks);
70
- } else {
71
- componentMocksString = JSON.stringify(componentMocks, null, 2);
72
- }
73
- }
66
+ let componentMocksString;
67
+ if (componentMocks) {
68
+ if (["yaml", "yml"].includes(global.config.files.mocks.extension[0])) {
69
+ componentMocksString = jsonToYaml.dump(componentMocks);
70
+ } else {
71
+ componentMocksString = JSON.stringify(componentMocks, null, 2);
72
+ }
73
+ }
74
74
 
75
- const fileContents = {
76
- schema: componentSchema
77
- ? {
78
- string: componentSchemaString,
79
- type: global.config.files.schema.extension,
80
- file: path.join(
81
- global.config.components.folder,
82
- component.paths.schema.short,
83
- ),
84
- }
85
- : null,
86
- mocks: componentMocks
87
- ? {
88
- string: componentMocksString,
89
- type: global.config.files.mocks.extension[0],
90
- file: path.join(
91
- global.config.components.folder,
92
- helpers.getShortPathFromFullPath(mockFilePath),
93
- ),
94
- }
95
- : null,
96
- template: componentTemplate
97
- ? {
98
- string: componentTemplate,
99
- type: global.config.files.templates.extension,
100
- file: path.join(
101
- global.config.components.folder,
102
- helpers.getShortPathFromFullPath(component.paths.tpl.full),
103
- ),
104
- }
105
- : null,
106
- };
75
+ const fileContents = {
76
+ schema: componentSchema
77
+ ? {
78
+ string: componentSchemaString,
79
+ type: global.config.files.schema.extension,
80
+ file: path.join(
81
+ global.config.components.folder,
82
+ component.paths.schema.short,
83
+ ),
84
+ }
85
+ : null,
86
+ mocks: componentMocks
87
+ ? {
88
+ string: componentMocksString,
89
+ type: global.config.files.mocks.extension[0],
90
+ file: path.join(
91
+ global.config.components.folder,
92
+ helpers.getShortPathFromFullPath(mockFilePath),
93
+ ),
94
+ }
95
+ : null,
96
+ template: componentTemplate
97
+ ? {
98
+ string: componentTemplate,
99
+ type: global.config.files.templates.extension,
100
+ file: path.join(
101
+ global.config.components.folder,
102
+ helpers.getShortPathFromFullPath(component.paths.tpl.full),
103
+ ),
104
+ }
105
+ : null,
106
+ };
107
107
 
108
- await renderVariations({
109
- res,
110
- component,
111
- context: componentJson.filter((entry) => entry !== null),
112
- componentDocumentation,
113
- fileContents,
114
- name: component.name,
115
- cb,
116
- templateFilePath: hasTemplate ? component.paths.tpl.full : null,
117
- cookies,
118
- noCli,
119
- });
108
+ await renderVariations({
109
+ res,
110
+ component,
111
+ context: componentJson.filter((entry) => entry !== null),
112
+ componentDocumentation,
113
+ fileContents,
114
+ name: component.name,
115
+ cb,
116
+ templateFilePath: hasTemplate ? component.paths.tpl.full : null,
117
+ cookies,
118
+ noCli,
119
+ });
120
120
  }
121
121
 
122
122
  /**
@@ -153,138 +153,139 @@ export default async function renderIframeComponent({
153
153
  * @returns {Promise}
154
154
  */
155
155
  async function renderVariations({
156
- res,
157
- component,
158
- context,
159
- componentDocumentation,
160
- fileContents,
161
- name,
162
- cb,
163
- templateFilePath,
164
- cookies,
165
- noCli,
156
+ res,
157
+ component,
158
+ context,
159
+ componentDocumentation,
160
+ fileContents,
161
+ name,
162
+ cb,
163
+ templateFilePath,
164
+ cookies,
165
+ noCli,
166
166
  }) {
167
- const variations = [];
168
- const promises = [];
169
- const validatedMocks = validateMocks(component, context, noCli);
167
+ const variations = [];
168
+ const promises = [];
169
+ const validatedMocks = validateMocks(component, context, noCli);
170
170
 
171
- if (templateFilePath) {
172
- if (context.length > 0) {
173
- for (let i = 0, len = context.length; i < len; i += 1) {
174
- const entry = context[i];
171
+ if (templateFilePath) {
172
+ if (context.length > 0) {
173
+ for (let i = 0, len = context.length; i < len; i += 1) {
174
+ const entry = context[i];
175
175
 
176
- variations[i] = getData(
177
- context[i].name,
178
- component.paths.dir.short,
179
- entry,
180
- validatedMocks,
181
- );
182
- }
183
- }
184
- } else {
185
- promises.push(Promise.resolve());
186
- }
176
+ variations[i] = getData(
177
+ context[i].name,
178
+ component.paths.dir.short,
179
+ entry,
180
+ validatedMocks,
181
+ );
182
+ }
183
+ }
184
+ } else {
185
+ promises.push(Promise.resolve());
186
+ }
187
187
 
188
- let schemaJson;
188
+ let schemaJson;
189
189
 
190
- if (fileContents?.schema?.string) {
191
- try {
192
- schemaJson = JSON.stringify(jsonToYaml.load(fileContents.schema.string));
193
- } catch (err) {
194
- log("error", null, err);
195
- }
196
- }
190
+ if (fileContents?.schema?.string) {
191
+ try {
192
+ schemaJson = JSON.stringify(jsonToYaml.load(fileContents.schema.string));
193
+ } catch (err) {
194
+ log("error", null, err);
195
+ }
196
+ }
197
197
 
198
- let mocksJson;
198
+ let mocksJson;
199
199
 
200
- if (fileContents?.mocks?.string) {
201
- try {
202
- mocksJson = JSON.stringify(jsonToYaml.load(fileContents.mocks.string));
203
- } catch (err) {
204
- log("error", null, err);
205
- }
206
- }
200
+ if (fileContents?.mocks?.string) {
201
+ try {
202
+ mocksJson = JSON.stringify(jsonToYaml.load(fileContents.mocks.string));
203
+ } catch (err) {
204
+ log("error", null, err);
205
+ }
206
+ }
207
207
 
208
- return Promise.all(promises)
209
- .then(async () => {
210
- const themeMode = getThemeMode(cookies);
211
- const renderFileTabs = !!(
212
- fileContents.schema ||
213
- fileContents.mocks ||
214
- fileContents.template
215
- );
216
- const componentsEntry = global.state.components.find(
217
- ({ shortPath }) => shortPath === component.paths.dir.short,
218
- );
208
+ return Promise.all(promises)
209
+ .then(async () => {
210
+ const themeMode = getThemeMode(cookies);
211
+ const renderFileTabs = !!(
212
+ fileContents.schema ||
213
+ fileContents.mocks ||
214
+ fileContents.template
215
+ );
216
+ const componentsEntry = global.state.components.find(
217
+ ({ shortPath }) => shortPath === component.paths.dir.short,
218
+ );
219
219
 
220
- const componentDeclaredAssets =
221
- context.length > 0 ? context[0].$assets || null : null;
222
- const { cssFiles, jsFilesHead, jsFilesBody } =
223
- resolveAssets(componentDeclaredAssets);
220
+ const componentDeclaredAssets =
221
+ context.length > 0 ? context[0].$assets || null : null;
222
+ const { cssFiles, jsFilesHead, jsFilesBody } = resolveAssets(
223
+ componentDeclaredAssets,
224
+ );
224
225
 
225
- await res.render(
226
- "iframe_component.twig.miyagi",
227
- {
228
- lang: global.config.ui.lang,
229
- variations,
230
- cssFiles,
231
- jsFilesHead,
232
- jsFilesBody,
233
- assets: {
234
- css: componentsEntry
235
- ? componentsEntry.assets.css
236
- ? path.join("/", componentsEntry.assets.css)
237
- : false
238
- : false,
239
- js: componentsEntry
240
- ? componentsEntry.assets.js
241
- ? path.join("/", componentsEntry.assets.js)
242
- : false
243
- : false,
244
- },
245
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
246
- prod: process.env.NODE_ENV === "production",
247
- projectName: config.projectName,
248
- userProjectName: global.config.projectName,
249
- isBuild: global.config.isBuild,
250
- userUiConfig: getUserUiConfig(cookies),
251
- theme: themeMode
252
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
253
- : global.config.ui.theme,
254
- documentation: componentDocumentation,
255
- schema: schemaJson,
256
- schemaError:
257
- validatedMocks?.length > 0 && validatedMocks[0].type === "schema"
258
- ? validatedMocks[0].data.map((error) => error.message).join("\n")
259
- : null,
260
- mocks: mocksJson,
261
- template: fileContents.template,
262
- renderInformation: renderFileTabs || variations.length > 0,
263
- renderFileTabs,
264
- folder: path.join(
265
- global.config.components.folder,
266
- component.paths.dir.short,
267
- ),
268
- name: componentDocumentation?.includes("<h1>") ? null : name,
269
- uiTextDirection: global.config.ui.textDirection,
270
- componentLanguage: global.config.components.lang,
271
- },
272
- (html) => {
273
- if (res.send) {
274
- res.send(html);
275
- }
226
+ await res.render(
227
+ "iframe_component.twig.miyagi",
228
+ {
229
+ lang: global.config.ui.lang,
230
+ variations,
231
+ cssFiles,
232
+ jsFilesHead,
233
+ jsFilesBody,
234
+ assets: {
235
+ css: componentsEntry
236
+ ? componentsEntry.assets.css
237
+ ? path.join("/", componentsEntry.assets.css)
238
+ : false
239
+ : false,
240
+ js: componentsEntry
241
+ ? componentsEntry.assets.js
242
+ ? path.join("/", componentsEntry.assets.js)
243
+ : false
244
+ : false,
245
+ },
246
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
247
+ prod: process.env.NODE_ENV === "production",
248
+ projectName: config.projectName,
249
+ userProjectName: global.config.projectName,
250
+ isBuild: global.config.isBuild,
251
+ userUiConfig: getUserUiConfig(cookies),
252
+ theme: themeMode
253
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
254
+ : global.config.ui.theme,
255
+ documentation: componentDocumentation,
256
+ schema: schemaJson,
257
+ schemaError:
258
+ validatedMocks?.length > 0 && validatedMocks[0].type === "schema"
259
+ ? validatedMocks[0].data.map((error) => error.message).join("\n")
260
+ : null,
261
+ mocks: mocksJson,
262
+ template: fileContents.template,
263
+ renderInformation: renderFileTabs || variations.length > 0,
264
+ renderFileTabs,
265
+ folder: path.join(
266
+ global.config.components.folder,
267
+ component.paths.dir.short,
268
+ ),
269
+ name: componentDocumentation?.includes("<h1>") ? null : name,
270
+ uiTextDirection: global.config.ui.textDirection,
271
+ componentLanguage: global.config.components.lang,
272
+ },
273
+ (html) => {
274
+ if (res.send) {
275
+ res.send(html);
276
+ }
276
277
 
277
- if (cb) {
278
- cb(null, html);
279
- }
280
- },
281
- );
282
- })
283
- .catch(() => {
284
- if (cb) {
285
- cb(true);
286
- }
287
- });
278
+ if (cb) {
279
+ cb(null, html);
280
+ }
281
+ },
282
+ );
283
+ })
284
+ .catch(() => {
285
+ if (cb) {
286
+ cb(true);
287
+ }
288
+ });
288
289
  }
289
290
 
290
291
  /**
@@ -295,46 +296,46 @@ async function renderVariations({
295
296
  * @returns {object}
296
297
  */
297
298
  function getData(variation, shortPath, entry, validatedMocks) {
298
- let standaloneUrl;
299
+ let standaloneUrl;
299
300
 
300
- if (global.config.isBuild) {
301
- standaloneUrl = `component-${helpers.normalizeString(
302
- shortPath,
303
- )}-variation-${helpers.normalizeString(variation)}.html`;
304
- } else {
305
- standaloneUrl = `/component?file=${shortPath}&variation=${encodeURIComponent(
306
- variation,
307
- )}`;
308
- }
301
+ if (global.config.isBuild) {
302
+ standaloneUrl = `component-${helpers.normalizeString(
303
+ shortPath,
304
+ )}-variation-${helpers.normalizeString(variation)}.html`;
305
+ } else {
306
+ standaloneUrl = `/component?file=${shortPath}&variation=${encodeURIComponent(
307
+ variation,
308
+ )}`;
309
+ }
309
310
 
310
- const data = {
311
- url: global.config.isBuild
312
- ? `component-${helpers.normalizeString(
313
- shortPath,
314
- )}-variation-${helpers.normalizeString(variation)}-embedded.html`
315
- : `/component?file=${shortPath}&variation=${variation}&embedded=true`,
316
- file: shortPath,
317
- variation,
318
- normalizedVariation: helpers.normalizeString(variation),
319
- standaloneUrl,
320
- mockData: JSON.stringify(entry.raw),
321
- mockDataResolved: JSON.stringify(entry.resolved),
322
- };
311
+ const data = {
312
+ url: global.config.isBuild
313
+ ? `component-${helpers.normalizeString(
314
+ shortPath,
315
+ )}-variation-${helpers.normalizeString(variation)}-embedded.html`
316
+ : `/component?file=${shortPath}&variation=${variation}&embedded=true`,
317
+ file: shortPath,
318
+ variation,
319
+ normalizedVariation: helpers.normalizeString(variation),
320
+ standaloneUrl,
321
+ mockData: JSON.stringify(entry.raw),
322
+ mockDataResolved: JSON.stringify(entry.resolved),
323
+ };
323
324
 
324
- const validationEntry = validatedMocks?.find(
325
- (item) => item.variant === entry.name,
326
- );
325
+ const validationEntry = validatedMocks?.find(
326
+ (item) => item.variant === entry.name,
327
+ );
327
328
 
328
- if (validationEntry) {
329
- data.mockValidation = {
330
- valid: false,
331
- copy: t("validator.mocks.invalid"),
332
- };
333
- } else {
334
- data.mockValidation = {
335
- valid: true,
336
- };
337
- }
329
+ if (validationEntry) {
330
+ data.mockValidation = {
331
+ valid: false,
332
+ copy: t("validator.mocks.invalid"),
333
+ };
334
+ } else {
335
+ data.mockValidation = {
336
+ valid: true,
337
+ };
338
+ }
338
339
 
339
- return data;
340
+ return data;
340
341
  }
@@ -9,44 +9,44 @@ import { getColors, getMediaQueries } from "../../../../styleguide/index.js";
9
9
  * @param {object} o.cookies
10
10
  */
11
11
  export default async function ({ res, cb, cookies }) {
12
- const colors = global.state.css
13
- ? getColors(
14
- global.state.css,
15
- global.config.assets.customProperties.prefixes.color,
16
- )
17
- : [];
18
- const mediaQueries = global.state.css
19
- ? getMediaQueries(global.state.css)
20
- : [];
21
- const themeMode = getThemeMode(cookies);
12
+ const colors = global.state.css
13
+ ? getColors(
14
+ global.state.css,
15
+ global.config.assets.customProperties.prefixes.color,
16
+ )
17
+ : [];
18
+ const mediaQueries = global.state.css
19
+ ? getMediaQueries(global.state.css)
20
+ : [];
21
+ const themeMode = getThemeMode(cookies);
22
22
 
23
- await res.render(
24
- "design-tokens/colors.twig.miyagi",
25
- {
26
- additionalCssFiles: global.config.assets?.customProperties?.files || [],
27
- colors:
28
- colors.map(({ styles }) => styles.length).reduce((a, b) => a + b, 0) > 0
29
- ? colors
30
- : [],
31
- isBuild: global.config.isBuild,
32
- lang: global.config.ui.lang,
33
- mediaQueries,
34
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
35
- projectName: config.projectName,
36
- userUiConfig: getUserUiConfig(cookies),
37
- theme: themeMode
38
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
39
- : global.config.ui.theme,
40
- uiTextDirection: global.config.ui.textDirection,
41
- },
42
- (html) => {
43
- if (res.send) {
44
- res.send(html);
45
- }
23
+ await res.render(
24
+ "design-tokens/colors.twig.miyagi",
25
+ {
26
+ additionalCssFiles: global.config.assets?.customProperties?.files || [],
27
+ colors:
28
+ colors.map(({ styles }) => styles.length).reduce((a, b) => a + b, 0) > 0
29
+ ? colors
30
+ : [],
31
+ isBuild: global.config.isBuild,
32
+ lang: global.config.ui.lang,
33
+ mediaQueries,
34
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
35
+ projectName: config.projectName,
36
+ userUiConfig: getUserUiConfig(cookies),
37
+ theme: themeMode
38
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
39
+ : global.config.ui.theme,
40
+ uiTextDirection: global.config.ui.textDirection,
41
+ },
42
+ (html) => {
43
+ if (res.send) {
44
+ res.send(html);
45
+ }
46
46
 
47
- if (cb) {
48
- cb(null, html);
49
- }
50
- },
51
- );
47
+ if (cb) {
48
+ cb(null, html);
49
+ }
50
+ },
51
+ );
52
52
  }
@@ -3,7 +3,7 @@ import sizes from "./sizes.js";
3
3
  import typography from "./typography.js";
4
4
 
5
5
  export default {
6
- colors,
7
- sizes,
8
- typography,
6
+ colors,
7
+ sizes,
8
+ typography,
9
9
  };