@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
@@ -14,78 +14,79 @@ import resolveAssets from "../../helpers/resolve-assets.js";
14
14
  * @returns {Promise} gets resolved when the variation has been rendered
15
15
  */
16
16
  export default async function renderIframeVariationStandalone({
17
- res,
18
- component,
19
- componentData,
20
- componentDeclaredAssets = null,
21
- cb,
22
- cookies,
17
+ res,
18
+ component,
19
+ componentData,
20
+ componentDeclaredAssets = null,
21
+ cb,
22
+ cookies,
23
23
  }) {
24
- const directoryPath = component.paths.dir.short;
24
+ const directoryPath = component.paths.dir.short;
25
25
 
26
- return new Promise((resolve, reject) => {
27
- global.app.render(
28
- component.paths.tpl.full,
29
- componentData ?? {},
30
- async (error, result) => {
31
- if (error) {
32
- if (global.config.isBuild) {
33
- if (cb) {
34
- cb(error);
35
- }
36
- } else {
37
- reject(error);
38
- }
39
- } else if (res) {
40
- const componentsEntry = global.state.components.find(
41
- ({ shortPath }) => shortPath === directoryPath,
42
- );
26
+ return new Promise((resolve, reject) => {
27
+ global.app.render(
28
+ component.paths.tpl.full,
29
+ componentData ?? {},
30
+ async (error, result) => {
31
+ if (error) {
32
+ if (global.config.isBuild) {
33
+ if (cb) {
34
+ cb(error);
35
+ }
36
+ } else {
37
+ reject(error);
38
+ }
39
+ } else if (res) {
40
+ const componentsEntry = global.state.components.find(
41
+ ({ shortPath }) => shortPath === directoryPath,
42
+ );
43
43
 
44
- const { cssFiles, jsFilesHead, jsFilesBody } =
45
- resolveAssets(componentDeclaredAssets);
44
+ const { cssFiles, jsFilesHead, jsFilesBody } = resolveAssets(
45
+ componentDeclaredAssets,
46
+ );
46
47
 
47
- await res.render(
48
- "component_variation.twig.miyagi",
49
- {
50
- html: result,
51
- cssFiles,
52
- jsFilesHead,
53
- jsFilesBody,
54
- assets: {
55
- css: componentsEntry
56
- ? componentsEntry.assets.css
57
- ? path.join("/", componentsEntry.assets.css)
58
- : false
59
- : false,
60
- js: componentsEntry
61
- ? componentsEntry.assets.js
62
- ? path.join("/", componentsEntry.assets.js)
63
- : false
64
- : false,
65
- },
66
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
67
- prod: process.env.NODE_ENV === "production",
68
- projectName: config.projectName,
69
- isBuild: global.config.isBuild,
70
- userUiConfig: getUserUiConfig(cookies),
71
- componentLanguage: global.config.components.lang,
72
- },
73
- (html) => {
74
- if (res.send) {
75
- res.send(html);
76
- }
48
+ await res.render(
49
+ "component_variation.twig.miyagi",
50
+ {
51
+ html: result,
52
+ cssFiles,
53
+ jsFilesHead,
54
+ jsFilesBody,
55
+ assets: {
56
+ css: componentsEntry
57
+ ? componentsEntry.assets.css
58
+ ? path.join("/", componentsEntry.assets.css)
59
+ : false
60
+ : false,
61
+ js: componentsEntry
62
+ ? componentsEntry.assets.js
63
+ ? path.join("/", componentsEntry.assets.js)
64
+ : false
65
+ : false,
66
+ },
67
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
68
+ prod: process.env.NODE_ENV === "production",
69
+ projectName: config.projectName,
70
+ isBuild: global.config.isBuild,
71
+ userUiConfig: getUserUiConfig(cookies),
72
+ componentLanguage: global.config.components.lang,
73
+ },
74
+ (html) => {
75
+ if (res.send) {
76
+ res.send(html);
77
+ }
77
78
 
78
- if (cb) {
79
- cb(null, html);
80
- }
81
- },
82
- );
79
+ if (cb) {
80
+ cb(null, html);
81
+ }
82
+ },
83
+ );
83
84
 
84
- resolve();
85
- } else {
86
- resolve(result);
87
- }
88
- },
89
- );
90
- });
85
+ resolve();
86
+ } else {
87
+ resolve(result);
88
+ }
89
+ },
90
+ );
91
+ });
91
92
  }
@@ -9,45 +9,45 @@ import { getUserUiConfig, getThemeMode } from "../../helpers.js";
9
9
  * @param {object} [object.cookies]
10
10
  */
11
11
  export default async function renderMainComponentDocs({
12
- res,
13
- component,
14
- cb,
15
- cookies,
12
+ res,
13
+ component,
14
+ cb,
15
+ cookies,
16
16
  }) {
17
- const iframeSrc = component.route.embedded;
18
- const themeMode = getThemeMode(cookies);
17
+ const iframeSrc = component.route.embedded;
18
+ const themeMode = getThemeMode(cookies);
19
19
 
20
- await res.render(
21
- "main.twig.miyagi",
22
- {
23
- lang: global.config.ui.lang,
24
- folders: global.state.menu,
25
- components: global.state.components,
26
- flatUrlPattern: global.config.isBuild
27
- ? "/show-{{component}}.html"
28
- : "/show?file={{component}}",
29
- iframeSrc,
30
- requestedComponent: component.paths.dir.short,
31
- projectName: config.projectName,
32
- userProjectName: global.config.projectName,
33
- indexPath: global.config.indexPath.embedded,
34
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
35
- isBuild: global.config.isBuild,
36
- userUiConfig: getUserUiConfig(cookies),
37
- theme: themeMode
38
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
39
- : global.config.ui.theme,
40
- basePath: global.config.isBuild ? global.config.build.basePath : "/",
41
- uiTextDirection: global.config.ui.textDirection,
42
- },
43
- (html) => {
44
- if (res.send) {
45
- res.send(html);
46
- }
20
+ await res.render(
21
+ "main.twig.miyagi",
22
+ {
23
+ lang: global.config.ui.lang,
24
+ folders: global.state.menu,
25
+ components: global.state.components,
26
+ flatUrlPattern: global.config.isBuild
27
+ ? "/show-{{component}}.html"
28
+ : "/show?file={{component}}",
29
+ iframeSrc,
30
+ requestedComponent: component.paths.dir.short,
31
+ projectName: config.projectName,
32
+ userProjectName: global.config.projectName,
33
+ indexPath: global.config.indexPath.embedded,
34
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
35
+ isBuild: global.config.isBuild,
36
+ userUiConfig: getUserUiConfig(cookies),
37
+ theme: themeMode
38
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
39
+ : global.config.ui.theme,
40
+ basePath: global.config.isBuild ? global.config.build.basePath : "/",
41
+ uiTextDirection: global.config.ui.textDirection,
42
+ },
43
+ (html) => {
44
+ if (res.send) {
45
+ res.send(html);
46
+ }
47
47
 
48
- if (cb) {
49
- cb(null, html);
50
- }
51
- },
52
- );
48
+ if (cb) {
49
+ cb(null, html);
50
+ }
51
+ },
52
+ );
53
53
  }
@@ -11,64 +11,64 @@ import { getUserUiConfig, getThemeMode } from "../../helpers.js";
11
11
  * @param {object} [object.cookies]
12
12
  */
13
13
  export default async function renderMainComponent({
14
- res,
15
- component,
16
- variation,
17
- cb,
18
- cookies,
14
+ res,
15
+ component,
16
+ variation,
17
+ cb,
18
+ cookies,
19
19
  }) {
20
- let iframeSrc = component.route.default;
21
- const themeMode = getThemeMode(cookies);
20
+ let iframeSrc = component.route.default;
21
+ const themeMode = getThemeMode(cookies);
22
22
 
23
- if (variation) {
24
- if (global.config.isBuild) {
25
- iframeSrc = iframeSrc.replace(
26
- /\.html$/,
27
- `-variation-${helpers.normalizeString(variation)}.html`,
28
- );
29
- } else {
30
- iframeSrc += `&variation=${variation}`;
31
- }
32
- }
23
+ if (variation) {
24
+ if (global.config.isBuild) {
25
+ iframeSrc = iframeSrc.replace(
26
+ /\.html$/,
27
+ `-variation-${helpers.normalizeString(variation)}.html`,
28
+ );
29
+ } else {
30
+ iframeSrc += `&variation=${variation}`;
31
+ }
32
+ }
33
33
 
34
- if (global.config.isBuild) {
35
- iframeSrc = iframeSrc.replace(/\.html$/, "-embedded.html");
36
- } else {
37
- iframeSrc += "&embedded=true";
38
- }
34
+ if (global.config.isBuild) {
35
+ iframeSrc = iframeSrc.replace(/\.html$/, "-embedded.html");
36
+ } else {
37
+ iframeSrc += "&embedded=true";
38
+ }
39
39
 
40
- await res.render(
41
- "main.twig.miyagi",
42
- {
43
- lang: global.config.ui.lang,
44
- folders: global.state.menu,
45
- components: global.state.components,
46
- flatUrlPattern: global.config.isBuild
47
- ? "/show-{{component}}.html"
48
- : "/show?file={{component}}",
49
- iframeSrc,
50
- requestedComponent: component.paths.dir.short,
51
- requestedVariation: variation,
52
- projectName: config.projectName,
53
- userProjectName: global.config.projectName,
54
- indexPath: global.config.indexPath.embedded,
55
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
56
- isBuild: global.config.isBuild,
57
- userUiConfig: getUserUiConfig(cookies),
58
- theme: themeMode
59
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
60
- : global.config.ui.theme,
61
- basePath: global.config.isBuild ? global.config.build.basePath : "/",
62
- uiTextDirection: global.config.ui.textDirection,
63
- },
64
- (html) => {
65
- if (res.send) {
66
- res.send(html);
67
- }
40
+ await res.render(
41
+ "main.twig.miyagi",
42
+ {
43
+ lang: global.config.ui.lang,
44
+ folders: global.state.menu,
45
+ components: global.state.components,
46
+ flatUrlPattern: global.config.isBuild
47
+ ? "/show-{{component}}.html"
48
+ : "/show?file={{component}}",
49
+ iframeSrc,
50
+ requestedComponent: component.paths.dir.short,
51
+ requestedVariation: variation,
52
+ projectName: config.projectName,
53
+ userProjectName: global.config.projectName,
54
+ indexPath: global.config.indexPath.embedded,
55
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
56
+ isBuild: global.config.isBuild,
57
+ userUiConfig: getUserUiConfig(cookies),
58
+ theme: themeMode
59
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
60
+ : global.config.ui.theme,
61
+ basePath: global.config.isBuild ? global.config.build.basePath : "/",
62
+ uiTextDirection: global.config.ui.textDirection,
63
+ },
64
+ (html) => {
65
+ if (res.send) {
66
+ res.send(html);
67
+ }
68
68
 
69
- if (cb) {
70
- cb(null, html);
71
- }
72
- },
73
- );
69
+ if (cb) {
70
+ cb(null, html);
71
+ }
72
+ },
73
+ );
74
74
  }
@@ -9,45 +9,45 @@ import { getUserUiConfig, getThemeMode } from "../../helpers.js";
9
9
  * @param {object} [object.cookies]
10
10
  */
11
11
  export default function renderMainDesignTokens({ res, cb, cookies, type }) {
12
- if (!["colors", "sizes", "typography"].includes(type)) return;
12
+ if (!["colors", "sizes", "typography"].includes(type)) return;
13
13
 
14
- const themeMode = getThemeMode(cookies);
14
+ const themeMode = getThemeMode(cookies);
15
15
 
16
- res.render(
17
- "main.twig.miyagi",
18
- {
19
- lang: global.config.ui.lang,
20
- folders: global.state.menu,
21
- components: global.state.components,
22
- flatUrlPattern: global.config.isBuild
23
- ? "/show-{{component}}.html"
24
- : "/show?file={{component}}",
25
- iframeSrc: global.config.isBuild
26
- ? `/iframe-design-tokens-${type}.html`
27
- : `/iframe/design-tokens/${type}`,
28
- showAll: true,
29
- projectName: config.projectName,
30
- userProjectName: global.config.projectName,
31
- indexPath: global.config.indexPath.embedded,
32
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
33
- isBuild: global.config.isBuild,
34
- userUiConfig: getUserUiConfig(cookies),
35
- theme: themeMode
36
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
37
- : global.config.ui.theme,
38
- basePath: global.config.isBuild ? global.config.build.basePath : "/",
39
- uiTextDirection: global.config.ui.textDirection,
40
- requestedComponent: "design-tokens",
41
- requestedVariation: type,
42
- },
43
- (html) => {
44
- if (res.send) {
45
- res.send(html);
46
- }
16
+ res.render(
17
+ "main.twig.miyagi",
18
+ {
19
+ lang: global.config.ui.lang,
20
+ folders: global.state.menu,
21
+ components: global.state.components,
22
+ flatUrlPattern: global.config.isBuild
23
+ ? "/show-{{component}}.html"
24
+ : "/show?file={{component}}",
25
+ iframeSrc: global.config.isBuild
26
+ ? `/iframe-design-tokens-${type}.html`
27
+ : `/iframe/design-tokens/${type}`,
28
+ showAll: true,
29
+ projectName: config.projectName,
30
+ userProjectName: global.config.projectName,
31
+ indexPath: global.config.indexPath.embedded,
32
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
33
+ isBuild: global.config.isBuild,
34
+ userUiConfig: getUserUiConfig(cookies),
35
+ theme: themeMode
36
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
37
+ : global.config.ui.theme,
38
+ basePath: global.config.isBuild ? global.config.build.basePath : "/",
39
+ uiTextDirection: global.config.ui.textDirection,
40
+ requestedComponent: "design-tokens",
41
+ requestedVariation: type,
42
+ },
43
+ (html) => {
44
+ if (res.send) {
45
+ res.send(html);
46
+ }
47
47
 
48
- if (cb) {
49
- cb(null, html);
50
- }
51
- },
52
- );
48
+ if (cb) {
49
+ cb(null, html);
50
+ }
51
+ },
52
+ );
53
53
  }
@@ -9,39 +9,39 @@ import { getUserUiConfig, getThemeMode } from "../../helpers.js";
9
9
  * @param {object} [object.cookies]
10
10
  */
11
11
  export default async function renderMainDocs({ res, doc, cb, cookies }) {
12
- const themeMode = getThemeMode(cookies);
12
+ const themeMode = getThemeMode(cookies);
13
13
 
14
- await res.render(
15
- "main.twig.miyagi",
16
- {
17
- lang: global.config.ui.lang,
18
- folders: global.state.menu,
19
- components: global.state.components,
20
- flatUrlPattern: global.config.isBuild
21
- ? "/show-{{component}}.html"
22
- : "/show?file={{component}}",
23
- iframeSrc: doc.route.embedded,
24
- requestedComponent: doc.paths.dir.short,
25
- projectName: config.projectName,
26
- userProjectName: global.config.projectName,
27
- indexPath: global.config.indexPath.embedded,
28
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
29
- isBuild: global.config.isBuild,
30
- userUiConfig: getUserUiConfig(cookies),
31
- theme: themeMode
32
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
33
- : global.config.ui.theme,
34
- basePath: global.config.isBuild ? global.config.build.basePath : "/",
35
- uiTextDirection: global.config.ui.textDirection,
36
- },
37
- (html) => {
38
- if (res.send) {
39
- res.send(html);
40
- }
14
+ await res.render(
15
+ "main.twig.miyagi",
16
+ {
17
+ lang: global.config.ui.lang,
18
+ folders: global.state.menu,
19
+ components: global.state.components,
20
+ flatUrlPattern: global.config.isBuild
21
+ ? "/show-{{component}}.html"
22
+ : "/show?file={{component}}",
23
+ iframeSrc: doc.route.embedded,
24
+ requestedComponent: doc.paths.dir.short,
25
+ projectName: config.projectName,
26
+ userProjectName: global.config.projectName,
27
+ indexPath: global.config.indexPath.embedded,
28
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
29
+ isBuild: global.config.isBuild,
30
+ userUiConfig: getUserUiConfig(cookies),
31
+ theme: themeMode
32
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
33
+ : global.config.ui.theme,
34
+ basePath: global.config.isBuild ? global.config.build.basePath : "/",
35
+ uiTextDirection: global.config.ui.textDirection,
36
+ },
37
+ (html) => {
38
+ if (res.send) {
39
+ res.send(html);
40
+ }
41
41
 
42
- if (cb) {
43
- cb(null, html);
44
- }
45
- },
46
- );
42
+ if (cb) {
43
+ cb(null, html);
44
+ }
45
+ },
46
+ );
47
47
  }
@@ -8,39 +8,39 @@ import { getUserUiConfig, getThemeMode } from "../../helpers.js";
8
8
  * @param {object} [object.cookies]
9
9
  */
10
10
  export default function renderMainIndex({ res, cb, cookies }) {
11
- const themeMode = getThemeMode(cookies);
11
+ const themeMode = getThemeMode(cookies);
12
12
 
13
- res.render(
14
- "main.twig.miyagi",
15
- {
16
- lang: global.config.ui.lang,
17
- folders: global.state.menu,
18
- components: global.state.components,
19
- flatUrlPattern: global.config.isBuild
20
- ? "/show-{{component}}.html"
21
- : "/show?file={{component}}",
22
- iframeSrc: global.config.indexPath.default,
23
- showAll: true,
24
- projectName: config.projectName,
25
- userProjectName: global.config.projectName,
26
- indexPath: global.config.indexPath.embedded,
27
- miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
28
- isBuild: global.config.isBuild,
29
- userUiConfig: getUserUiConfig(cookies),
30
- theme: themeMode
31
- ? Object.assign(global.config.ui.theme, { mode: themeMode })
32
- : global.config.ui.theme,
33
- basePath: global.config.isBuild ? global.config.build.basePath : "/",
34
- uiTextDirection: global.config.ui.textDirection,
35
- },
36
- (html) => {
37
- if (res.send) {
38
- res.send(html);
39
- }
13
+ res.render(
14
+ "main.twig.miyagi",
15
+ {
16
+ lang: global.config.ui.lang,
17
+ folders: global.state.menu,
18
+ components: global.state.components,
19
+ flatUrlPattern: global.config.isBuild
20
+ ? "/show-{{component}}.html"
21
+ : "/show?file={{component}}",
22
+ iframeSrc: global.config.indexPath.default,
23
+ showAll: true,
24
+ projectName: config.projectName,
25
+ userProjectName: global.config.projectName,
26
+ indexPath: global.config.indexPath.embedded,
27
+ miyagiDev: !!process.env.MIYAGI_DEVELOPMENT,
28
+ isBuild: global.config.isBuild,
29
+ userUiConfig: getUserUiConfig(cookies),
30
+ theme: themeMode
31
+ ? Object.assign(global.config.ui.theme, { mode: themeMode })
32
+ : global.config.ui.theme,
33
+ basePath: global.config.isBuild ? global.config.build.basePath : "/",
34
+ uiTextDirection: global.config.ui.textDirection,
35
+ },
36
+ (html) => {
37
+ if (res.send) {
38
+ res.send(html);
39
+ }
40
40
 
41
- if (cb) {
42
- cb(null, html);
43
- }
44
- },
45
- );
41
+ if (cb) {
42
+ cb(null, html);
43
+ }
44
+ },
45
+ );
46
46
  }