@simple-reporting/base 0.0.1 → 0.1.111

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 (391) hide show
  1. package/.github/workflows/npm-publish.yml +25 -25
  2. package/.nvmrc +1 -1
  3. package/README.md +23 -23
  4. package/cli.js +114 -114
  5. package/dev/.ddev/nginx_full/custom.conf +12 -12
  6. package/dev/index.html +17 -17
  7. package/dev/ldd.html +7 -7
  8. package/dev/livingdocs/Media/image/app.scss +25 -25
  9. package/dev/livingdocs/Media/image/general.scss +11 -11
  10. package/dev/livingdocs/Media/image/image.html +46 -46
  11. package/dev/livingdocs/Media/image/ldd.scss +1 -1
  12. package/dev/livingdocs/Media/image/pdf.scss +1 -1
  13. package/dev/livingdocs/Media/image/print.scss +7 -7
  14. package/dev/livingdocs/Media/image/properties.json +41 -41
  15. package/dev/livingdocs/Media/image/word.scss +1 -1
  16. package/dev/livingdocs/Properties/grid/app.scss +1 -1
  17. package/dev/livingdocs/Properties/grid/general.scss +95 -95
  18. package/dev/livingdocs/Properties/grid/ldd.scss +1 -1
  19. package/dev/livingdocs/Properties/grid/pdf.scss +1 -1
  20. package/dev/livingdocs/Properties/grid/print.scss +94 -94
  21. package/dev/livingdocs/Properties/grid/properties.json +68 -68
  22. package/dev/livingdocs/Properties/grid/web.scss +98 -98
  23. package/dev/livingdocs/Properties/grid/word.scss +1 -1
  24. package/dev/livingdocs/Text/paragraph/general.scss +9 -9
  25. package/dev/livingdocs/Text/paragraph/paragraph.html +22 -22
  26. package/dev/livingdocs/Titles/title-h1/general.scss +10 -10
  27. package/dev/livingdocs/Titles/title-h1/title-h1.html +16 -16
  28. package/dev/livingdocs/Titles/title-h2/app.scss +1 -1
  29. package/dev/livingdocs/Titles/title-h2/general.scss +13 -13
  30. package/dev/livingdocs/Titles/title-h2/ldd.scss +1 -1
  31. package/dev/livingdocs/Titles/title-h2/pdf.scss +1 -1
  32. package/dev/livingdocs/Titles/title-h2/print.scss +36 -36
  33. package/dev/livingdocs/Titles/title-h2/title-h2.html +24 -24
  34. package/dev/livingdocs/Titles/title-h2/web.scss +27 -27
  35. package/dev/livingdocs/Titles/title-h2/word.scss +1 -1
  36. package/dev/livingdocs/Titles/title-h3/app.scss +1 -1
  37. package/dev/livingdocs/Titles/title-h3/general.scss +13 -13
  38. package/dev/livingdocs/Titles/title-h3/ldd.scss +1 -1
  39. package/dev/livingdocs/Titles/title-h3/pdf.scss +1 -1
  40. package/dev/livingdocs/Titles/title-h3/print.scss +34 -34
  41. package/dev/livingdocs/Titles/title-h3/title-h3.html +24 -24
  42. package/dev/livingdocs/Titles/title-h3/web.scss +27 -27
  43. package/dev/livingdocs/Titles/title-h3/word.scss +1 -1
  44. package/dev/livingdocs/Titles/title-h4/app.scss +1 -1
  45. package/dev/livingdocs/Titles/title-h4/general.scss +13 -13
  46. package/dev/livingdocs/Titles/title-h4/ldd.scss +1 -1
  47. package/dev/livingdocs/Titles/title-h4/pdf.scss +1 -1
  48. package/dev/livingdocs/Titles/title-h4/print.scss +34 -34
  49. package/dev/livingdocs/Titles/title-h4/title-h4.html +24 -24
  50. package/dev/livingdocs/Titles/title-h4/web.scss +27 -27
  51. package/dev/livingdocs/Titles/title-h4/word.scss +1 -1
  52. package/dev/livingdocs/Titles/title-h5/general.scss +10 -10
  53. package/dev/livingdocs/Titles/title-h5/title-h5.html +16 -16
  54. package/dev/livingdocs/Titles/title-h6/general.scss +10 -10
  55. package/dev/livingdocs/Titles/title-h6/title-h6.html +16 -16
  56. package/dev/livingdocs.config.json +376 -376
  57. package/dev/nswow/ArticleAutoloader.ts +100 -100
  58. package/dev/nswow/ArticleLoader.ts +91 -91
  59. package/dev/nswow/colors.scss +3 -3
  60. package/dev/nswow/config.scss +13 -13
  61. package/dev/nswow/core-styles.scss +2 -2
  62. package/dev/nswow/fonts.scss +2 -2
  63. package/dev/nswow/grid.scss +2 -2
  64. package/dev/nswow/helpers.scss +2 -2
  65. package/dev/nswow/index.scss +9 -9
  66. package/dev/nswow/meta.scss +2 -2
  67. package/dev/nswow/spacer.scss +2 -2
  68. package/dev/nswow/system.scss +2 -2
  69. package/dev/nswow/typography.scss +3 -3
  70. package/dev/nswow.config.json +293 -293
  71. package/dev/package.json +60 -61
  72. package/dev/pdf/pdf-configuration-debug.xml +5 -5
  73. package/dev/pdf/pdf-configuration.xml +2 -2
  74. package/dev/pdf.ts +1 -1
  75. package/dev/src/App.vue +44 -44
  76. package/dev/src/Autoload.ts +6 -6
  77. package/dev/src/assets/images/mms-logo-black.svg +91 -91
  78. package/dev/src/assets/images/mms-logo-white.svg +105 -105
  79. package/dev/src/assets/scss/app.scss +39 -39
  80. package/dev/src/assets/scss/general.scss +17 -17
  81. package/dev/src/assets/scss/ldd.scss +27 -27
  82. package/dev/src/assets/scss/pdf.scss +2 -2
  83. package/dev/src/assets/scss/print.scss +1 -1
  84. package/dev/src/assets/scss/web.scss +1 -1
  85. package/dev/src/assets/scss/word.scss +2 -2
  86. package/dev/src/components/LanguageSwitch.vue +100 -100
  87. package/dev/src/components/MainNavigation.vue +209 -209
  88. package/dev/src/components/MenuItem/MenuArticle.vue +15 -15
  89. package/dev/src/components/MenuItem/MenuEntry.vue +26 -26
  90. package/dev/src/components/MenuItem/MenuExternal.vue +28 -28
  91. package/dev/src/components/MenuItem/index.ts +5 -5
  92. package/dev/src/components/PageFooter.vue +86 -86
  93. package/dev/src/components/PageHeader.vue +149 -149
  94. package/dev/src/components/PageModal.vue +95 -95
  95. package/dev/src/components/PrevNext.vue +144 -144
  96. package/dev/src/components/ScrollToTop.vue +63 -63
  97. package/dev/src/components/SrlPage/KFCApplication/hooks/kfcData.ts +9 -9
  98. package/dev/src/components/SrlPage/KFCApplication/scss/_iz-keyfigure-comparison.scss +151 -151
  99. package/dev/src/components/SrlPage/KFCApplication/scss/_kfc-loading.scss +40 -40
  100. package/dev/src/components/SrlPage/KFCApplication/scss/_srl-button-kfc.scss +21 -21
  101. package/dev/src/composables/config.ts +48 -48
  102. package/dev/src/i18n/index.ts +51 -51
  103. package/dev/src/i18n/translation.ts +85 -85
  104. package/dev/src/locales/de.json +15 -15
  105. package/dev/src/locales/en.json +15 -15
  106. package/dev/src/main.ts +16 -16
  107. package/dev/src/router/index.ts +47 -47
  108. package/dev/src/types/nswow.d.ts +73 -73
  109. package/dev/src/views/ArticleView.vue +77 -77
  110. package/dev/src/views/DownloadsView.vue +88 -88
  111. package/dev/src/views/HomeView.vue +35 -35
  112. package/dev/src/views/PageNotFound.vue +73 -73
  113. package/dev/src/views/SearchView.vue +126 -126
  114. package/dev/tsconfig.app.json +16 -16
  115. package/dev/tsconfig.node.json +19 -19
  116. package/dev/vite.config.ts +27 -27
  117. package/dev/word.ts +1 -1
  118. package/livingdocs/Buttons/button/app.scss +1 -1
  119. package/livingdocs/Buttons/button/button.html +18 -18
  120. package/livingdocs/Buttons/button/general.scss +33 -33
  121. package/livingdocs/Buttons/button/ldd.scss +1 -1
  122. package/livingdocs/Buttons/button/pdf.scss +1 -1
  123. package/livingdocs/Buttons/button/word.scss +1 -1
  124. package/livingdocs/Buttons/button-container/app.scss +1 -1
  125. package/livingdocs/Buttons/button-container/button-container.html +31 -31
  126. package/livingdocs/Buttons/button-container/general.scss +12 -12
  127. package/livingdocs/Buttons/button-container/ldd.scss +1 -1
  128. package/livingdocs/Buttons/button-container/pdf.scss +3 -3
  129. package/livingdocs/Buttons/button-container/properties.json +19 -19
  130. package/livingdocs/Buttons/button-container/word.scss +3 -3
  131. package/livingdocs/CV/cv-timeline/app.scss +1 -1
  132. package/livingdocs/CV/cv-timeline/cv-timeline.html +19 -19
  133. package/livingdocs/CV/cv-timeline/general.scss +1 -1
  134. package/livingdocs/CV/cv-timeline/ldd.scss +1 -1
  135. package/livingdocs/CV/cv-timeline/pdf.scss +1 -1
  136. package/livingdocs/CV/cv-timeline/print.scss +35 -35
  137. package/livingdocs/CV/cv-timeline/web.scss +27 -27
  138. package/livingdocs/CV/cv-timeline/word.scss +1 -1
  139. package/livingdocs/Container/column-container/column-container.html +44 -44
  140. package/livingdocs/Container/column-container/general.scss +105 -105
  141. package/livingdocs/Container/column-container/properties.json +83 -83
  142. package/livingdocs/Lists/alphanumeric-list-group/alphanumeric-list-group.html +25 -25
  143. package/livingdocs/Lists/alphanumeric-list-group/app.scss +1 -1
  144. package/livingdocs/Lists/alphanumeric-list-group/general.scss +5 -5
  145. package/livingdocs/Lists/alphanumeric-list-group/ldd.scss +1 -1
  146. package/livingdocs/Lists/alphanumeric-list-group/pdf.scss +1 -1
  147. package/livingdocs/Lists/alphanumeric-list-group/word.scss +1 -1
  148. package/livingdocs/Lists/list-item/app.scss +1 -1
  149. package/livingdocs/Lists/list-item/general.scss +4 -4
  150. package/livingdocs/Lists/list-item/ldd.scss +1 -1
  151. package/livingdocs/Lists/list-item/list-item.html +17 -17
  152. package/livingdocs/Lists/list-item/pdf.scss +1 -1
  153. package/livingdocs/Lists/list-item/word.scss +1 -1
  154. package/livingdocs/Lists/ordered-list-group/app.scss +1 -1
  155. package/livingdocs/Lists/ordered-list-group/general.scss +5 -5
  156. package/livingdocs/Lists/ordered-list-group/ldd.scss +1 -1
  157. package/livingdocs/Lists/ordered-list-group/ordered-list-group.html +25 -25
  158. package/livingdocs/Lists/ordered-list-group/pdf.scss +1 -1
  159. package/livingdocs/Lists/ordered-list-group/word.scss +1 -1
  160. package/livingdocs/Lists/unordered-list-group/app.scss +1 -1
  161. package/livingdocs/Lists/unordered-list-group/general.scss +5 -5
  162. package/livingdocs/Lists/unordered-list-group/ldd.scss +1 -1
  163. package/livingdocs/Lists/unordered-list-group/pdf.scss +1 -1
  164. package/livingdocs/Lists/unordered-list-group/unordered-list-group.html +25 -25
  165. package/livingdocs/Lists/unordered-list-group/word.scss +1 -1
  166. package/livingdocs/Media/chart/app.scss +19 -19
  167. package/livingdocs/Media/chart/chart.html +29 -29
  168. package/livingdocs/Media/chart/general.scss +11 -11
  169. package/livingdocs/Media/chart/ldd.scss +1 -1
  170. package/livingdocs/Media/chart/pdf.scss +9 -9
  171. package/livingdocs/Media/chart/properties.json +41 -41
  172. package/livingdocs/Media/chart/word.scss +1 -1
  173. package/livingdocs/Media/graphic/app.scss +1 -1
  174. package/livingdocs/Media/graphic/general.scss +18 -18
  175. package/livingdocs/Media/graphic/graphic.html +29 -29
  176. package/livingdocs/Media/graphic/ldd.scss +1 -1
  177. package/livingdocs/Media/graphic/pdf.scss +1 -1
  178. package/livingdocs/Media/graphic/properties.json +36 -36
  179. package/livingdocs/Media/graphic/word.scss +1 -1
  180. package/livingdocs/Media/image/app.scss +25 -25
  181. package/livingdocs/Media/image/general.scss +11 -11
  182. package/livingdocs/Media/image/image.html +55 -55
  183. package/livingdocs/Media/image/ldd.scss +1 -1
  184. package/livingdocs/Media/image/pdf.scss +1 -1
  185. package/livingdocs/Media/image/print.scss +7 -7
  186. package/livingdocs/Media/image/properties.json +41 -41
  187. package/livingdocs/Media/image/word.scss +1 -1
  188. package/livingdocs/Media/nswow-table/app.scss +2 -2
  189. package/livingdocs/Media/nswow-table/app.ts +35 -35
  190. package/livingdocs/Media/nswow-table/general.scss +281 -281
  191. package/livingdocs/Media/nswow-table/ldd.scss +2 -2
  192. package/livingdocs/Media/nswow-table/nswow-table.html +30 -30
  193. package/livingdocs/Media/nswow-table/pdf.scss +8 -8
  194. package/livingdocs/Media/nswow-table/properties.json +66 -66
  195. package/livingdocs/Media/nswow-table/web.scss +23 -23
  196. package/livingdocs/Media/nswow-table/word.scss +2 -2
  197. package/livingdocs/Media/video/app.scss +1 -1
  198. package/livingdocs/Media/video/general.scss +7 -7
  199. package/livingdocs/Media/video/ldd.scss +1 -1
  200. package/livingdocs/Media/video/pdf.scss +1 -1
  201. package/livingdocs/Media/video/print.scss +5 -5
  202. package/livingdocs/Media/video/properties.json +41 -41
  203. package/livingdocs/Media/video/video.html +26 -26
  204. package/livingdocs/Media/video/word.scss +1 -1
  205. package/livingdocs/Misc/accordion/accordion.html +56 -56
  206. package/livingdocs/Misc/accordion/app.scss +63 -63
  207. package/livingdocs/Misc/accordion/app.ts +10 -10
  208. package/livingdocs/Misc/accordion/general.scss +44 -44
  209. package/livingdocs/Misc/accordion/ldd.scss +36 -36
  210. package/livingdocs/Misc/accordion/pdf.scss +39 -39
  211. package/livingdocs/Misc/accordion/word.scss +39 -39
  212. package/livingdocs/Misc/anchor/anchor.html +15 -15
  213. package/livingdocs/Misc/anchor/app.scss +10 -10
  214. package/livingdocs/Misc/anchor/app.ts +11 -11
  215. package/livingdocs/Misc/anchor/general.scss +1 -1
  216. package/livingdocs/Misc/anchor/pdf.scss +1 -1
  217. package/livingdocs/Misc/anchor/print.scss +3 -3
  218. package/livingdocs/Misc/anchor/word.scss +1 -1
  219. package/livingdocs/Misc/spacer/app.scss +1 -1
  220. package/livingdocs/Misc/spacer/general.scss +8 -8
  221. package/livingdocs/Misc/spacer/ldd.scss +1 -1
  222. package/livingdocs/Misc/spacer/pdf.scss +1 -1
  223. package/livingdocs/Misc/spacer/print.scss +18 -18
  224. package/livingdocs/Misc/spacer/properties.json +52 -52
  225. package/livingdocs/Misc/spacer/spacer.html +12 -12
  226. package/livingdocs/Misc/spacer/web.scss +18 -18
  227. package/livingdocs/Misc/spacer/word.scss +1 -1
  228. package/livingdocs/PDF_only/pdf-cover/ldd.scss +42 -42
  229. package/livingdocs/PDF_only/pdf-cover/pdf-cover.html +29 -29
  230. package/livingdocs/PDF_only/pdf-cover/pdf.scss +1 -1
  231. package/livingdocs/PDF_only/pdf-cover/word.scss +1 -1
  232. package/livingdocs/PDF_only/pdf-cover-chapter/ldd.scss +19 -19
  233. package/livingdocs/PDF_only/pdf-cover-chapter/pdf-chapter-cover.html +18 -18
  234. package/livingdocs/PDF_only/pdf-cover-chapter/pdf.scss +1 -1
  235. package/livingdocs/PDF_only/pdf-cover-chapter/print.scss +19 -19
  236. package/livingdocs/PDF_only/pdf-cover-chapter/word.scss +1 -1
  237. package/livingdocs/PDF_only/pdf-pagebreak/general.scss +4 -4
  238. package/livingdocs/PDF_only/pdf-pagebreak/ldd.scss +5 -5
  239. package/livingdocs/PDF_only/pdf-pagebreak/pdf-pagebreak.html +8 -8
  240. package/livingdocs/PDF_only/pdf-publication-title/general.scss +5 -5
  241. package/livingdocs/PDF_only/pdf-publication-title/pdf-publication-title.html +15 -15
  242. package/livingdocs/PDF_only/pdf-toc-item/general.scss +41 -41
  243. package/livingdocs/PDF_only/pdf-toc-item/pdf-toc-item.html +33 -33
  244. package/livingdocs/PDF_only/pdf-toc-item/properties.json +7 -7
  245. package/livingdocs/PDF_only/pdf-toc-item-blank/general.scss +5 -5
  246. package/livingdocs/PDF_only/pdf-toc-item-blank/pdf-toc-item-blank.html +11 -11
  247. package/livingdocs/PDF_only/pdf-toc-item-title/general.scss +5 -5
  248. package/livingdocs/PDF_only/pdf-toc-item-title/pdf-toc-item-title.html +11 -11
  249. package/livingdocs/PDF_only/pdf-toc-page/app.scss +1 -1
  250. package/livingdocs/PDF_only/pdf-toc-page/general.scss +1 -1
  251. package/livingdocs/PDF_only/pdf-toc-page/ldd.scss +1 -1
  252. package/livingdocs/PDF_only/pdf-toc-page/pdf-toc-page.html +33 -33
  253. package/livingdocs/PDF_only/pdf-toc-page/pdf.scss +1 -1
  254. package/livingdocs/PDF_only/pdf-toc-page/properties.json +12 -12
  255. package/livingdocs/PDF_only/pdf-toc-page/word.scss +1 -1
  256. package/livingdocs/PDF_only/pdf-video-link/ldd.scss +16 -16
  257. package/livingdocs/PDF_only/pdf-video-link/pdf-video-link.html +41 -41
  258. package/livingdocs/PDF_only/pdf-video-link/pdf.scss +1 -1
  259. package/livingdocs/PDF_only/pdf-video-link/print.scss +12 -12
  260. package/livingdocs/PDF_only/pdf-video-link/word.scss +1 -1
  261. package/livingdocs/Properties/grid/app.scss +1 -1
  262. package/livingdocs/Properties/grid/general.scss +95 -95
  263. package/livingdocs/Properties/grid/ldd.scss +1 -1
  264. package/livingdocs/Properties/grid/pdf.scss +1 -1
  265. package/livingdocs/Properties/grid/print.scss +94 -94
  266. package/livingdocs/Properties/grid/properties.json +68 -68
  267. package/livingdocs/Properties/grid/web.scss +98 -98
  268. package/livingdocs/Properties/grid/word.scss +1 -1
  269. package/livingdocs/Signatures/signature-container/app.scss +1 -1
  270. package/livingdocs/Signatures/signature-container/general.scss +7 -7
  271. package/livingdocs/Signatures/signature-container/ldd.scss +1 -1
  272. package/livingdocs/Signatures/signature-container/pdf.scss +1 -1
  273. package/livingdocs/Signatures/signature-container/signature-container.html +30 -30
  274. package/livingdocs/Signatures/signature-container/word.scss +1 -1
  275. package/livingdocs/Signatures/signature-item/app.scss +1 -1
  276. package/livingdocs/Signatures/signature-item/general.scss +53 -53
  277. package/livingdocs/Signatures/signature-item/ldd.scss +1 -1
  278. package/livingdocs/Signatures/signature-item/pdf.scss +1 -1
  279. package/livingdocs/Signatures/signature-item/signature-item.html +23 -23
  280. package/livingdocs/Signatures/signature-item/word.scss +1 -1
  281. package/livingdocs/Text/footnote/app.scss +1 -1
  282. package/livingdocs/Text/footnote/footnote.html +14 -14
  283. package/livingdocs/Text/footnote/general.scss +12 -12
  284. package/livingdocs/Text/footnote/ldd.scss +1 -1
  285. package/livingdocs/Text/footnote/pdf.scss +1 -1
  286. package/livingdocs/Text/footnote/print.scss +36 -36
  287. package/livingdocs/Text/footnote/web.scss +27 -27
  288. package/livingdocs/Text/footnote/word.scss +1 -1
  289. package/livingdocs/Text/lead/general.scss +9 -9
  290. package/livingdocs/Text/lead/lead.html +23 -23
  291. package/livingdocs/Text/paragraph/general.scss +9 -9
  292. package/livingdocs/Text/paragraph/paragraph.html +24 -24
  293. package/livingdocs/Text/quote/general.scss +43 -43
  294. package/livingdocs/Text/quote/properties.json +7 -7
  295. package/livingdocs/Text/quote/quote.html +29 -29
  296. package/livingdocs/Text/quote-with-portrait/general.scss +81 -81
  297. package/livingdocs/Text/quote-with-portrait/properties.json +12 -12
  298. package/livingdocs/Text/quote-with-portrait/quote-with-portrait.html +49 -49
  299. package/livingdocs/Titles/title-h1/general.scss +10 -10
  300. package/livingdocs/Titles/title-h1/title-h1.html +16 -16
  301. package/livingdocs/Titles/title-h2/app.scss +1 -1
  302. package/livingdocs/Titles/title-h2/general.scss +13 -13
  303. package/livingdocs/Titles/title-h2/ldd.scss +1 -1
  304. package/livingdocs/Titles/title-h2/pdf.scss +1 -1
  305. package/livingdocs/Titles/title-h2/print.scss +36 -36
  306. package/livingdocs/Titles/title-h2/title-h2.html +26 -26
  307. package/livingdocs/Titles/title-h2/web.scss +27 -27
  308. package/livingdocs/Titles/title-h2/word.scss +1 -1
  309. package/livingdocs/Titles/title-h3/app.scss +1 -1
  310. package/livingdocs/Titles/title-h3/general.scss +13 -13
  311. package/livingdocs/Titles/title-h3/ldd.scss +1 -1
  312. package/livingdocs/Titles/title-h3/pdf.scss +1 -1
  313. package/livingdocs/Titles/title-h3/print.scss +34 -34
  314. package/livingdocs/Titles/title-h3/title-h3.html +26 -26
  315. package/livingdocs/Titles/title-h3/web.scss +27 -27
  316. package/livingdocs/Titles/title-h3/word.scss +1 -1
  317. package/livingdocs/Titles/title-h4/app.scss +1 -1
  318. package/livingdocs/Titles/title-h4/general.scss +13 -13
  319. package/livingdocs/Titles/title-h4/ldd.scss +1 -1
  320. package/livingdocs/Titles/title-h4/pdf.scss +1 -1
  321. package/livingdocs/Titles/title-h4/print.scss +34 -34
  322. package/livingdocs/Titles/title-h4/title-h4.html +26 -26
  323. package/livingdocs/Titles/title-h4/web.scss +27 -27
  324. package/livingdocs/Titles/title-h4/word.scss +1 -1
  325. package/livingdocs/Titles/title-h5/general.scss +10 -10
  326. package/livingdocs/Titles/title-h5/title-h5.html +16 -16
  327. package/livingdocs/Titles/title-h6/general.scss +10 -10
  328. package/livingdocs/Titles/title-h6/title-h6.html +16 -16
  329. package/package.json +50 -50
  330. package/preparePublish.cjs +95 -95
  331. package/scripts/beaver.js +316 -316
  332. package/scripts/build.js +812 -812
  333. package/scripts/components.js +566 -566
  334. package/scripts/doPublish.js +43 -43
  335. package/scripts/init.js +45 -45
  336. package/scripts/migrate-livingdocs-build/LICENSE +21 -21
  337. package/scripts/migrate-livingdocs-build/bin/build.js +53 -53
  338. package/scripts/migrate-livingdocs-build/bin/migrate.js +43 -43
  339. package/scripts/migrate-livingdocs-build/dev/build/v1.js +51 -51
  340. package/scripts/migrate-livingdocs-build/dev/build/v2.js +44 -44
  341. package/scripts/migrate-livingdocs-build/dev/build/zip-archive.js +39 -39
  342. package/scripts/migrate-livingdocs-build/dev/build.js +7 -7
  343. package/scripts/migrate-livingdocs-build/dev/configuration-defaults.js +18 -18
  344. package/scripts/migrate-livingdocs-build/dev/configuration.js +34 -34
  345. package/scripts/migrate-livingdocs-build/dev/lib.d.ts +1 -1
  346. package/scripts/migrate-livingdocs-build/dev/lib.js +251 -251
  347. package/scripts/migrate-livingdocs-build/dev/livingdocs-design.d.ts +2 -2
  348. package/scripts/migrate-livingdocs-build/dev/livingdocs-design.js +80 -80
  349. package/scripts/migrate-livingdocs-build/dev/logger.js +16 -16
  350. package/scripts/migrate-livingdocs-build/dev/migrate.js +241 -241
  351. package/scripts/migrate-livingdocs-build/readme.md +62 -62
  352. package/scripts/preparePublish.js +88 -88
  353. package/scripts/renamePackage.d.ts +1 -1
  354. package/scripts/renamePackage.js +48 -48
  355. package/scripts/utils.js +106 -106
  356. package/scripts/vite.js +58 -58
  357. package/scss/colors/functions.scss +18 -18
  358. package/scss/colors/index.scss +3 -3
  359. package/scss/colors/mixins.scss +45 -45
  360. package/scss/colors/variables.scss +6 -6
  361. package/scss/config.scss +7 -7
  362. package/scss/core-styles.scss +22 -22
  363. package/scss/fonts/functions.scss +21 -21
  364. package/scss/fonts/index.scss +3 -3
  365. package/scss/fonts/mixins.scss +31 -31
  366. package/scss/fonts/variables.scss +8 -8
  367. package/scss/grid/functions.scss +29 -29
  368. package/scss/grid/index.scss +3 -3
  369. package/scss/grid/mixins.scss +388 -388
  370. package/scss/grid/variables.scss +10 -10
  371. package/scss/helpers/index.scss +3 -3
  372. package/scss/helpers/mixins.scss +87 -87
  373. package/scss/helpers/variables.scss +7 -7
  374. package/scss/index.scss +8 -8
  375. package/scss/meta/functions.scss +64 -64
  376. package/scss/meta/index.scss +3 -3
  377. package/scss/meta/mixins.scss +6 -6
  378. package/scss/meta/variables.scss +8 -8
  379. package/scss/spacer/functions.scss +9 -9
  380. package/scss/spacer/index.scss +3 -3
  381. package/scss/spacer/mixins.scss +236 -236
  382. package/scss/spacer/variables.scss +6 -6
  383. package/scss/system/functions.scss +77 -77
  384. package/scss/system/index.scss +3 -3
  385. package/scss/system/mixins.scss +27 -27
  386. package/scss/system/root.scss +39 -39
  387. package/scss/system/variables.scss +13 -13
  388. package/scss/typography/functions.scss +63 -63
  389. package/scss/typography/index.scss +3 -3
  390. package/scss/typography/mixins.scss +262 -262
  391. package/scss/typography/variables.scss +11 -11
@@ -1,566 +1,566 @@
1
- import { createRequire } from 'node:module';
2
- import { resolve, dirname } from 'node:path';
3
- import { glob } from 'glob';
4
- import { copy, ensureDir } from 'fs-extra';
5
- import { rm, statSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs';
6
- import { fileURLToPath } from 'node:url';
7
- import { lddGroupNames } from './utils.js';
8
- import { map } from '@simple-reporting/base/scripts/build.js';
9
-
10
- const require = createRequire(import.meta.url);
11
- const __filename = fileURLToPath(import.meta.url);
12
- const __dirname = dirname(__filename);
13
-
14
- const packagePath = resolve(__dirname, '../');
15
- const CWD = process.cwd();
16
-
17
- const { MultiSelect, Confirm, AutoComplete, Input } = require('enquirer');
18
-
19
- /**
20
- * Adds groups of livingdocs to a specified output directory.
21
- * @returns {boolean} - Returns true if groups were added successfully.
22
- */
23
- async function addGroups() {
24
- const outputPath = resolve(CWD, './livingdocs');
25
- const groupsPath = `${packagePath}/livingdocs`;
26
- const groups = readdirSync(groupsPath);
27
- const groupsExists = [];
28
- for (let i = 0; i < groups.length; i++) {
29
- const group = groups[i];
30
- groupsExists.push({ name: lddGroupNames(group), value: group });
31
- }
32
- groupsExists.sort((a, b) => {
33
- const valueA = a.name.toUpperCase(); // ignore upper and lowercase
34
- const valueB = b.name.toUpperCase(); // ignore upper and lowercase
35
- if (valueA < valueB) {
36
- return -1;
37
- }
38
- if (valueA > valueB) {
39
- return 1;
40
- }
41
- return 0;
42
- });
43
- const prompt = new MultiSelect({
44
- name: (i) => {
45
- return i.value;
46
- },
47
- message:
48
- 'Choose your livingdocs to add (space to select or deselect and enter to submit)',
49
- choices: groupsExists,
50
- limit: 10,
51
- result(names) {
52
- return this.map(names);
53
- },
54
- });
55
-
56
- prompt
57
- .run()
58
- .then(async (groups) => {
59
- let action = false;
60
- const installed = [];
61
- for (const key in groups) {
62
- const group = groups[key];
63
- const components = readdirSync(`${groupsPath}/${group}`);
64
- for (let i = 0; i < components.length; i++) {
65
- const component = components[i];
66
- try {
67
- await statSync(`${outputPath}/${group}/${component}`);
68
- console.log(`Component ${key} / ${component} allready exists!`);
69
- } catch (e) {
70
- action = true;
71
- await copy(
72
- `${groupsPath}/${group}/${component}`,
73
- `${outputPath}/${group}/${component}`,
74
- );
75
- console.log(`Component ${key} / ${component} installed!`);
76
- }
77
- }
78
- }
79
- return action;
80
- })
81
- .then((action) => {
82
- if (action) {
83
- map();
84
- }
85
- return action;
86
- })
87
- .catch(console.error);
88
- return true;
89
- }
90
-
91
- /**
92
- * Adds components from a specified directory to another directory.
93
- * Prompts the user to select which components to add.
94
- *
95
- * @async
96
- * @function addComponents
97
- *
98
- * @returns {Promise<void>} - A promise that resolves when the components are added successfully.
99
- */
100
- async function addComponents() {
101
- const filesToAdd = await glob(`${packagePath}/livingdocs/**/*`, {
102
- maxDepth: 6,
103
- });
104
- const filesExists = await glob(`${CWD}/livingdocs/**/*`, { maxDepth: 3 });
105
- const livingdocsToAdd = [];
106
- const livingdocsExists = [];
107
-
108
- for (let x = 0; x < filesExists.length; x++) {
109
- const c = filesExists[x].replace(`${CWD}/livingdocs/`, '');
110
- livingdocsExists.push(c);
111
- }
112
- for (let x = 0; x < filesToAdd.length; x++) {
113
- const c = filesToAdd[x].replace(`${packagePath}/livingdocs/`, '');
114
- if (!livingdocsExists.includes(c) && c.indexOf('/') !== -1) {
115
- livingdocsToAdd.push({ name: lddGroupNames(c), value: c });
116
- }
117
- }
118
-
119
- if (livingdocsToAdd.length) {
120
- livingdocsToAdd.sort((a, b) => {
121
- const valueA = a.name.toUpperCase(); // ignore upper and lowercase
122
- const valueB = b.name.toUpperCase(); // ignore upper and lowercase
123
- if (valueA < valueB) {
124
- return -1;
125
- }
126
- if (valueA > valueB) {
127
- return 1;
128
- }
129
- return 0;
130
- });
131
-
132
- const prompt = new MultiSelect({
133
- name: (i) => {
134
- return i.value;
135
- },
136
- message:
137
- 'Choose your livingdocs to add (space to select or deselect and enter to submit)',
138
- choices: livingdocsToAdd,
139
- limit: 10,
140
- result(names) {
141
- return this.map(names);
142
- },
143
- });
144
-
145
- prompt
146
- .run()
147
- .then(async (livingdocs) => {
148
- const oKeys = Object.keys(livingdocs);
149
- for (let x = 0; x < oKeys.length; x++) {
150
- await copy(
151
- `${packagePath}/livingdocs/${livingdocs[oKeys[x]]}`,
152
- `${CWD}/livingdocs/${livingdocs[oKeys[x]]}`,
153
- );
154
- }
155
- await map();
156
- console.log('Components installed!');
157
- })
158
- .catch(console.error);
159
- }
160
- }
161
-
162
- /**
163
- * Removes livingdocs groups from the specified directory.
164
- *
165
- * @returns {boolean} Returns true if the livingdocs groups were successfully removed, otherwise false.
166
- */
167
- async function removeGroups() {
168
- const livingdocsPath = resolve(CWD, './livingdocs');
169
- const groupsExists = [];
170
- const groupsList = await readdirSync(livingdocsPath);
171
- for (let i = 0; i < groupsList.length; i++) {
172
- const group = groupsList[i];
173
- groupsExists.push({ name: lddGroupNames(group), value: group });
174
- }
175
- groupsExists.sort((a, b) => {
176
- const valueA = a.name.toUpperCase(); // ignore upper and lowercase
177
- const valueB = b.name.toUpperCase(); // ignore upper and lowercase
178
- if (valueA < valueB) {
179
- return -1;
180
- }
181
- if (valueA > valueB) {
182
- return 1;
183
- }
184
- return 0;
185
- });
186
-
187
- const prompt = new MultiSelect({
188
- name: (i) => {
189
- return i.value;
190
- },
191
- message:
192
- 'Choose your livingdocs groups to remove (space to select or deselect and enter to submit)',
193
- choices: groupsExists,
194
- result(names) {
195
- return this.map(names);
196
- },
197
- });
198
-
199
- prompt
200
- .run()
201
- .then((groups) => {
202
- const oKeys = Object.keys(groups);
203
- if (oKeys.length) {
204
- const prompt = new Confirm({
205
- name: 'question',
206
- message: 'Should the selected livingdocs groups really be deleted?',
207
- });
208
-
209
- prompt.run().then(async (remove) => {
210
- if (remove) {
211
- oKeys.forEach(async (k) => {
212
- await rm(
213
- `${CWD}/livingdocs/${groups[k]}`,
214
- { recursive: true, force: true },
215
- (err) => {
216
- if (err) {
217
- console.error(err);
218
- }
219
- },
220
- );
221
- });
222
- await map();
223
- console.log('Groups removed!');
224
- }
225
- });
226
- }
227
- })
228
- .catch(console.error);
229
- return true;
230
- }
231
-
232
- /**
233
- * Removes livingdocs components based on user selection.
234
- *
235
- * @returns {Promise<void>} A promise that resolves once the components are removed.
236
- */
237
- async function removeComponents() {
238
- const filesExists = await glob(`${CWD}/livingdocs/**/*`, { maxDepth: 3 });
239
- const livingdocsExists = [];
240
- for (let x = 0; x < filesExists.length; x++) {
241
- const c = filesExists[x].replace(`${CWD}/livingdocs/`, '');
242
- if (c.indexOf('/') !== -1) {
243
- const p = c.split('/');
244
- let group = p[0].replace('_and_', ' / ').replace('_', ' ');
245
- livingdocsExists.push({
246
- name: lddGroupNames(`${group} / ${p[1]}`),
247
- value: c,
248
- });
249
- }
250
- }
251
- livingdocsExists.sort((a, b) => {
252
- const valueA = a.name.toUpperCase(); // ignore upper and lowercase
253
- const valueB = b.name.toUpperCase(); // ignore upper and lowercase
254
- if (valueA < valueB) {
255
- return -1;
256
- }
257
- if (valueA > valueB) {
258
- return 1;
259
- }
260
- return 0;
261
- });
262
-
263
- const prompt = new MultiSelect({
264
- name: (i) => {
265
- return i.value;
266
- },
267
- message:
268
- 'Choose your livingdocs components to remove (space to select or deselect and enter to submit)',
269
- choices: livingdocsExists,
270
- result(names) {
271
- return this.map(names);
272
- },
273
- });
274
-
275
- prompt
276
- .run()
277
- .then((livingdocs) => {
278
- const oKeys = Object.keys(livingdocs);
279
- if (oKeys.length) {
280
- const prompt = new Confirm({
281
- name: 'question',
282
- message:
283
- 'Should the selected livingdocs components really be deleted?',
284
- });
285
-
286
- prompt.run().then(async (remove) => {
287
- if (remove) {
288
- oKeys.forEach(async (k) => {
289
- await rm(
290
- `${CWD}/livingdocs/${livingdocs[k]}`,
291
- { recursive: true, force: true },
292
- (err) => {
293
- if (err) {
294
- console.error(err);
295
- }
296
- },
297
- );
298
- });
299
- await map();
300
- console.log('Components removed!');
301
- }
302
- });
303
- }
304
- })
305
- .catch(console.error);
306
- }
307
-
308
- /**
309
- * Maps the given component name to a component object containing group and name properties.
310
- *
311
- * @param {string} name - The name of the component.
312
- * @return {object} - An object with group and name properties representing the mapped component.
313
- */
314
- function mapComponentName(name) {
315
- const component = {
316
- group: false,
317
- name: false,
318
- };
319
- if (name) {
320
- const n = name.split('/');
321
- if (n.length > 1) {
322
- component.group = n[0];
323
- component.name = n[1];
324
- } else {
325
- component.name = name;
326
- }
327
- }
328
- return component;
329
- }
330
-
331
- /**
332
- * Creates a component in the specified group with the given name.
333
- * @param {string} group - The group for the component.
334
- * @param {string} name - The name of the component.
335
- * @return {boolean} - Returns true if the component is successfully created, false otherwise.
336
- */
337
- async function writeComponent(group, name) {
338
- if (!group) {
339
- console.error('Component could not be created. The group is not set!');
340
- return false;
341
- }
342
- if (!name) {
343
- console.error('Component could not be created. The name is not set!');
344
- return false;
345
- }
346
-
347
- try {
348
- const stat = await statSync(`${CWD}/livingdocs/${group}/${name}`);
349
- console.error(`Component ${group}/${name} already exist!`);
350
- } catch (e) {
351
- try {
352
- await statSync(`${CWD}/livingdocs/${group}`);
353
- } catch (e) {
354
- await mkdirSync(`${CWD}/livingdocs/${group}`);
355
- }
356
-
357
- await mkdirSync(`${CWD}/livingdocs/${group}/${name}`);
358
- await writeFileSync(
359
- `${CWD}/livingdocs/${group}/${name}/${name}.html`,
360
- `<script type="ld-conf">
361
- {
362
- "name": "${name}",
363
- "label": "${name}",
364
- "properties": [
365
- "web-width",
366
- "pdf-width"
367
- ]
368
- }
369
- </script>
370
- <p class="srl-${name} srl-article__grid srl-article__grid--content">
371
- <span class="srl-article__grid--inner" doc-editable="text">
372
- Editable Text
373
- </span>
374
- </p>
375
- `,
376
- );
377
- await writeFileSync(
378
- `${CWD}/livingdocs/${group}/${name}/general.scss`,
379
- `@use "nswow";
380
-
381
- .srl-${name} {
382
-
383
- }
384
- `,
385
- );
386
- await writeFileSync(
387
- `${CWD}/livingdocs/${group}/${name}/_web.scss`,
388
- '@use "nswow";',
389
- );
390
- await writeFileSync(
391
- `${CWD}/livingdocs/${group}/${name}/_print.scss`,
392
- '@use "nswow";',
393
- );
394
- await writeFileSync(
395
- `${CWD}/livingdocs/${group}/${name}/ldd.scss`,
396
- '@use "_web";',
397
- );
398
- await writeFileSync(
399
- `${CWD}/livingdocs/${group}/${name}/app.scss`,
400
- '@use "_web";',
401
- );
402
- await writeFileSync(
403
- `${CWD}/livingdocs/${group}/${name}/pdf.scss`,
404
- '@use "_print";',
405
- );
406
- await writeFileSync(
407
- `${CWD}/livingdocs/${group}/${name}/word.scss`,
408
- '@use "_print";',
409
- );
410
- await writeFileSync(
411
- `${CWD}/livingdocs/${group}/${name}/properties.json`,
412
- '{}',
413
- );
414
- await map();
415
- console.log(`Component ${group}/${name} created!`);
416
- }
417
- return true;
418
- }
419
-
420
- /**
421
- * Create a component with the given name. If the component name is not provided, it prompts the user to enter a name.
422
- * If the component name does not have a group, it prompts the user to select a group.
423
- * Once the component name and group are determined, it writes the component.
424
- *
425
- * @param {string} name - The name of the component (optional)
426
- * @return {boolean} - Returns true
427
- */
428
- async function createComponent(name) {
429
- let component = mapComponentName(name);
430
-
431
- if (!component.name) {
432
- const { Input } = require('enquirer');
433
- const prompt = new Input({
434
- message: 'What is your component name?',
435
- description: 'You can combine $group/$component',
436
- });
437
-
438
- prompt
439
- .run()
440
- .then(async (name) => {
441
- component = mapComponentName(name);
442
- if (!component.group) {
443
- const groupFolders = await glob(`${CWD}/livingdocs/*`);
444
- const groups = [];
445
- for (let x = 0; x < groupFolders.length; x++) {
446
- const f = groupFolders[x].split('/');
447
- groups.push(f.pop());
448
- }
449
- groups.sort((a, b) => {
450
- if (a < b) {
451
- return -1;
452
- }
453
- if (a > b) {
454
- return 1;
455
- }
456
- return 0;
457
- });
458
-
459
- const prompt = new AutoComplete({
460
- name: 'group',
461
- message: 'Group',
462
- choices: groups,
463
- });
464
-
465
- prompt
466
- .run()
467
- .then(async (group) => {
468
- await writeComponent(group, component.name);
469
- })
470
- .catch(console.error);
471
- } else {
472
- await writeComponent(component.group, component.name);
473
- }
474
- })
475
- .catch(console.error);
476
- } else if (!component.group) {
477
- const groupFolders = await glob(`${CWD}/livingdocs/*`);
478
- const groups = [];
479
- for (let x = 0; x < groupFolders.length; x++) {
480
- const f = groupFolders[x].split('/');
481
- groups.push(f.pop());
482
- }
483
- groups.sort((a, b) => {
484
- if (a < b) {
485
- return -1;
486
- }
487
- if (a > b) {
488
- return 1;
489
- }
490
- return 0;
491
- });
492
-
493
- const prompt = new AutoComplete({
494
- name: 'group',
495
- message: 'Group',
496
- choices: groups,
497
- });
498
-
499
- prompt
500
- .run()
501
- .then(async (group) => {
502
- await writeComponent(group, component.name);
503
- })
504
- .catch(console.error);
505
- } else {
506
- await writeComponent(component.group, component.name);
507
- }
508
- return true;
509
- }
510
-
511
- /**
512
- * Creates a new group folder for saving living documents.
513
- *
514
- * @param {string} group - The name of the group to create.
515
- * @returns {Promise<boolean>} - Returns a promise that resolves to true if the group was created successfully, otherwise false.
516
- */
517
- async function writeGroup(group) {
518
- if (!group) {
519
- console.error('No group name set!');
520
- return false;
521
- }
522
- const path = resolve(CWD, `./livingdocs/${group}`);
523
- try {
524
- const stat = await statSync(path);
525
- console.error(`Group "${group}" allready exist!`);
526
- return false;
527
- } catch (e) {
528
- await mkdirSync(path);
529
- console.log(`Group "${group}" created!`);
530
- }
531
- return true;
532
- }
533
-
534
- /**
535
- * Creates a group.
536
- *
537
- * @param {string} group - The name of the group to be created. If not provided, user will be prompted to enter the group name.
538
- * @returns {Promise<boolean>} - A promise that resolves to a boolean value indicating if the group was successfully created or not.
539
- */
540
- async function createGroup(group) {
541
- if (!group) {
542
- const { Input } = require('enquirer');
543
- const prompt = new Input({
544
- message: 'What is your group name?',
545
- });
546
-
547
- return await prompt
548
- .run()
549
- .then(async (group) => {
550
- return await writeGroup(group);
551
- })
552
- .catch(console.error);
553
- } else {
554
- return await writeGroup(group);
555
- }
556
- return false;
557
- }
558
-
559
- export {
560
- addComponents,
561
- addGroups,
562
- removeComponents,
563
- removeGroups,
564
- createComponent,
565
- createGroup,
566
- };
1
+ import { createRequire } from 'node:module';
2
+ import { resolve, dirname } from 'node:path';
3
+ import { glob } from 'glob';
4
+ import { copy, ensureDir } from 'fs-extra';
5
+ import { rm, statSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { lddGroupNames } from './utils.js';
8
+ import { map } from '@simple-reporting/base/scripts/build.js';
9
+
10
+ const require = createRequire(import.meta.url);
11
+ const __filename = fileURLToPath(import.meta.url);
12
+ const __dirname = dirname(__filename);
13
+
14
+ const packagePath = resolve(__dirname, '../');
15
+ const CWD = process.cwd();
16
+
17
+ const { MultiSelect, Confirm, AutoComplete, Input } = require('enquirer');
18
+
19
+ /**
20
+ * Adds groups of livingdocs to a specified output directory.
21
+ * @returns {boolean} - Returns true if groups were added successfully.
22
+ */
23
+ async function addGroups() {
24
+ const outputPath = resolve(CWD, './livingdocs');
25
+ const groupsPath = `${packagePath}/livingdocs`;
26
+ const groups = readdirSync(groupsPath);
27
+ const groupsExists = [];
28
+ for (let i = 0; i < groups.length; i++) {
29
+ const group = groups[i];
30
+ groupsExists.push({ name: lddGroupNames(group), value: group });
31
+ }
32
+ groupsExists.sort((a, b) => {
33
+ const valueA = a.name.toUpperCase(); // ignore upper and lowercase
34
+ const valueB = b.name.toUpperCase(); // ignore upper and lowercase
35
+ if (valueA < valueB) {
36
+ return -1;
37
+ }
38
+ if (valueA > valueB) {
39
+ return 1;
40
+ }
41
+ return 0;
42
+ });
43
+ const prompt = new MultiSelect({
44
+ name: (i) => {
45
+ return i.value;
46
+ },
47
+ message:
48
+ 'Choose your livingdocs to add (space to select or deselect and enter to submit)',
49
+ choices: groupsExists,
50
+ limit: 10,
51
+ result(names) {
52
+ return this.map(names);
53
+ },
54
+ });
55
+
56
+ prompt
57
+ .run()
58
+ .then(async (groups) => {
59
+ let action = false;
60
+ const installed = [];
61
+ for (const key in groups) {
62
+ const group = groups[key];
63
+ const components = readdirSync(`${groupsPath}/${group}`);
64
+ for (let i = 0; i < components.length; i++) {
65
+ const component = components[i];
66
+ try {
67
+ await statSync(`${outputPath}/${group}/${component}`);
68
+ console.log(`Component ${key} / ${component} allready exists!`);
69
+ } catch (e) {
70
+ action = true;
71
+ await copy(
72
+ `${groupsPath}/${group}/${component}`,
73
+ `${outputPath}/${group}/${component}`,
74
+ );
75
+ console.log(`Component ${key} / ${component} installed!`);
76
+ }
77
+ }
78
+ }
79
+ return action;
80
+ })
81
+ .then((action) => {
82
+ if (action) {
83
+ map();
84
+ }
85
+ return action;
86
+ })
87
+ .catch(console.error);
88
+ return true;
89
+ }
90
+
91
+ /**
92
+ * Adds components from a specified directory to another directory.
93
+ * Prompts the user to select which components to add.
94
+ *
95
+ * @async
96
+ * @function addComponents
97
+ *
98
+ * @returns {Promise<void>} - A promise that resolves when the components are added successfully.
99
+ */
100
+ async function addComponents() {
101
+ const filesToAdd = await glob(`${packagePath}/livingdocs/**/*`, {
102
+ maxDepth: 6,
103
+ });
104
+ const filesExists = await glob(`${CWD}/livingdocs/**/*`, { maxDepth: 3 });
105
+ const livingdocsToAdd = [];
106
+ const livingdocsExists = [];
107
+
108
+ for (let x = 0; x < filesExists.length; x++) {
109
+ const c = filesExists[x].replace(`${CWD}/livingdocs/`, '');
110
+ livingdocsExists.push(c);
111
+ }
112
+ for (let x = 0; x < filesToAdd.length; x++) {
113
+ const c = filesToAdd[x].replace(`${packagePath}/livingdocs/`, '');
114
+ if (!livingdocsExists.includes(c) && c.indexOf('/') !== -1) {
115
+ livingdocsToAdd.push({ name: lddGroupNames(c), value: c });
116
+ }
117
+ }
118
+
119
+ if (livingdocsToAdd.length) {
120
+ livingdocsToAdd.sort((a, b) => {
121
+ const valueA = a.name.toUpperCase(); // ignore upper and lowercase
122
+ const valueB = b.name.toUpperCase(); // ignore upper and lowercase
123
+ if (valueA < valueB) {
124
+ return -1;
125
+ }
126
+ if (valueA > valueB) {
127
+ return 1;
128
+ }
129
+ return 0;
130
+ });
131
+
132
+ const prompt = new MultiSelect({
133
+ name: (i) => {
134
+ return i.value;
135
+ },
136
+ message:
137
+ 'Choose your livingdocs to add (space to select or deselect and enter to submit)',
138
+ choices: livingdocsToAdd,
139
+ limit: 10,
140
+ result(names) {
141
+ return this.map(names);
142
+ },
143
+ });
144
+
145
+ prompt
146
+ .run()
147
+ .then(async (livingdocs) => {
148
+ const oKeys = Object.keys(livingdocs);
149
+ for (let x = 0; x < oKeys.length; x++) {
150
+ await copy(
151
+ `${packagePath}/livingdocs/${livingdocs[oKeys[x]]}`,
152
+ `${CWD}/livingdocs/${livingdocs[oKeys[x]]}`,
153
+ );
154
+ }
155
+ await map();
156
+ console.log('Components installed!');
157
+ })
158
+ .catch(console.error);
159
+ }
160
+ }
161
+
162
+ /**
163
+ * Removes livingdocs groups from the specified directory.
164
+ *
165
+ * @returns {boolean} Returns true if the livingdocs groups were successfully removed, otherwise false.
166
+ */
167
+ async function removeGroups() {
168
+ const livingdocsPath = resolve(CWD, './livingdocs');
169
+ const groupsExists = [];
170
+ const groupsList = await readdirSync(livingdocsPath);
171
+ for (let i = 0; i < groupsList.length; i++) {
172
+ const group = groupsList[i];
173
+ groupsExists.push({ name: lddGroupNames(group), value: group });
174
+ }
175
+ groupsExists.sort((a, b) => {
176
+ const valueA = a.name.toUpperCase(); // ignore upper and lowercase
177
+ const valueB = b.name.toUpperCase(); // ignore upper and lowercase
178
+ if (valueA < valueB) {
179
+ return -1;
180
+ }
181
+ if (valueA > valueB) {
182
+ return 1;
183
+ }
184
+ return 0;
185
+ });
186
+
187
+ const prompt = new MultiSelect({
188
+ name: (i) => {
189
+ return i.value;
190
+ },
191
+ message:
192
+ 'Choose your livingdocs groups to remove (space to select or deselect and enter to submit)',
193
+ choices: groupsExists,
194
+ result(names) {
195
+ return this.map(names);
196
+ },
197
+ });
198
+
199
+ prompt
200
+ .run()
201
+ .then((groups) => {
202
+ const oKeys = Object.keys(groups);
203
+ if (oKeys.length) {
204
+ const prompt = new Confirm({
205
+ name: 'question',
206
+ message: 'Should the selected livingdocs groups really be deleted?',
207
+ });
208
+
209
+ prompt.run().then(async (remove) => {
210
+ if (remove) {
211
+ oKeys.forEach(async (k) => {
212
+ await rm(
213
+ `${CWD}/livingdocs/${groups[k]}`,
214
+ { recursive: true, force: true },
215
+ (err) => {
216
+ if (err) {
217
+ console.error(err);
218
+ }
219
+ },
220
+ );
221
+ });
222
+ await map();
223
+ console.log('Groups removed!');
224
+ }
225
+ });
226
+ }
227
+ })
228
+ .catch(console.error);
229
+ return true;
230
+ }
231
+
232
+ /**
233
+ * Removes livingdocs components based on user selection.
234
+ *
235
+ * @returns {Promise<void>} A promise that resolves once the components are removed.
236
+ */
237
+ async function removeComponents() {
238
+ const filesExists = await glob(`${CWD}/livingdocs/**/*`, { maxDepth: 3 });
239
+ const livingdocsExists = [];
240
+ for (let x = 0; x < filesExists.length; x++) {
241
+ const c = filesExists[x].replace(`${CWD}/livingdocs/`, '');
242
+ if (c.indexOf('/') !== -1) {
243
+ const p = c.split('/');
244
+ let group = p[0].replace('_and_', ' / ').replace('_', ' ');
245
+ livingdocsExists.push({
246
+ name: lddGroupNames(`${group} / ${p[1]}`),
247
+ value: c,
248
+ });
249
+ }
250
+ }
251
+ livingdocsExists.sort((a, b) => {
252
+ const valueA = a.name.toUpperCase(); // ignore upper and lowercase
253
+ const valueB = b.name.toUpperCase(); // ignore upper and lowercase
254
+ if (valueA < valueB) {
255
+ return -1;
256
+ }
257
+ if (valueA > valueB) {
258
+ return 1;
259
+ }
260
+ return 0;
261
+ });
262
+
263
+ const prompt = new MultiSelect({
264
+ name: (i) => {
265
+ return i.value;
266
+ },
267
+ message:
268
+ 'Choose your livingdocs components to remove (space to select or deselect and enter to submit)',
269
+ choices: livingdocsExists,
270
+ result(names) {
271
+ return this.map(names);
272
+ },
273
+ });
274
+
275
+ prompt
276
+ .run()
277
+ .then((livingdocs) => {
278
+ const oKeys = Object.keys(livingdocs);
279
+ if (oKeys.length) {
280
+ const prompt = new Confirm({
281
+ name: 'question',
282
+ message:
283
+ 'Should the selected livingdocs components really be deleted?',
284
+ });
285
+
286
+ prompt.run().then(async (remove) => {
287
+ if (remove) {
288
+ oKeys.forEach(async (k) => {
289
+ await rm(
290
+ `${CWD}/livingdocs/${livingdocs[k]}`,
291
+ { recursive: true, force: true },
292
+ (err) => {
293
+ if (err) {
294
+ console.error(err);
295
+ }
296
+ },
297
+ );
298
+ });
299
+ await map();
300
+ console.log('Components removed!');
301
+ }
302
+ });
303
+ }
304
+ })
305
+ .catch(console.error);
306
+ }
307
+
308
+ /**
309
+ * Maps the given component name to a component object containing group and name properties.
310
+ *
311
+ * @param {string} name - The name of the component.
312
+ * @return {object} - An object with group and name properties representing the mapped component.
313
+ */
314
+ function mapComponentName(name) {
315
+ const component = {
316
+ group: false,
317
+ name: false,
318
+ };
319
+ if (name) {
320
+ const n = name.split('/');
321
+ if (n.length > 1) {
322
+ component.group = n[0];
323
+ component.name = n[1];
324
+ } else {
325
+ component.name = name;
326
+ }
327
+ }
328
+ return component;
329
+ }
330
+
331
+ /**
332
+ * Creates a component in the specified group with the given name.
333
+ * @param {string} group - The group for the component.
334
+ * @param {string} name - The name of the component.
335
+ * @return {boolean} - Returns true if the component is successfully created, false otherwise.
336
+ */
337
+ async function writeComponent(group, name) {
338
+ if (!group) {
339
+ console.error('Component could not be created. The group is not set!');
340
+ return false;
341
+ }
342
+ if (!name) {
343
+ console.error('Component could not be created. The name is not set!');
344
+ return false;
345
+ }
346
+
347
+ try {
348
+ const stat = await statSync(`${CWD}/livingdocs/${group}/${name}`);
349
+ console.error(`Component ${group}/${name} already exist!`);
350
+ } catch (e) {
351
+ try {
352
+ await statSync(`${CWD}/livingdocs/${group}`);
353
+ } catch (e) {
354
+ await mkdirSync(`${CWD}/livingdocs/${group}`);
355
+ }
356
+
357
+ await mkdirSync(`${CWD}/livingdocs/${group}/${name}`);
358
+ await writeFileSync(
359
+ `${CWD}/livingdocs/${group}/${name}/${name}.html`,
360
+ `<script type="ld-conf">
361
+ {
362
+ "name": "${name}",
363
+ "label": "${name}",
364
+ "properties": [
365
+ "web-width",
366
+ "pdf-width"
367
+ ]
368
+ }
369
+ </script>
370
+ <p class="srl-${name} srl-article__grid srl-article__grid--content">
371
+ <span class="srl-article__grid--inner" doc-editable="text">
372
+ Editable Text
373
+ </span>
374
+ </p>
375
+ `,
376
+ );
377
+ await writeFileSync(
378
+ `${CWD}/livingdocs/${group}/${name}/general.scss`,
379
+ `@use "nswow";
380
+
381
+ .srl-${name} {
382
+
383
+ }
384
+ `,
385
+ );
386
+ await writeFileSync(
387
+ `${CWD}/livingdocs/${group}/${name}/_web.scss`,
388
+ '@use "nswow";',
389
+ );
390
+ await writeFileSync(
391
+ `${CWD}/livingdocs/${group}/${name}/_print.scss`,
392
+ '@use "nswow";',
393
+ );
394
+ await writeFileSync(
395
+ `${CWD}/livingdocs/${group}/${name}/ldd.scss`,
396
+ '@use "_web";',
397
+ );
398
+ await writeFileSync(
399
+ `${CWD}/livingdocs/${group}/${name}/app.scss`,
400
+ '@use "_web";',
401
+ );
402
+ await writeFileSync(
403
+ `${CWD}/livingdocs/${group}/${name}/pdf.scss`,
404
+ '@use "_print";',
405
+ );
406
+ await writeFileSync(
407
+ `${CWD}/livingdocs/${group}/${name}/word.scss`,
408
+ '@use "_print";',
409
+ );
410
+ await writeFileSync(
411
+ `${CWD}/livingdocs/${group}/${name}/properties.json`,
412
+ '{}',
413
+ );
414
+ await map();
415
+ console.log(`Component ${group}/${name} created!`);
416
+ }
417
+ return true;
418
+ }
419
+
420
+ /**
421
+ * Create a component with the given name. If the component name is not provided, it prompts the user to enter a name.
422
+ * If the component name does not have a group, it prompts the user to select a group.
423
+ * Once the component name and group are determined, it writes the component.
424
+ *
425
+ * @param {string} name - The name of the component (optional)
426
+ * @return {boolean} - Returns true
427
+ */
428
+ async function createComponent(name) {
429
+ let component = mapComponentName(name);
430
+
431
+ if (!component.name) {
432
+ const { Input } = require('enquirer');
433
+ const prompt = new Input({
434
+ message: 'What is your component name?',
435
+ description: 'You can combine $group/$component',
436
+ });
437
+
438
+ prompt
439
+ .run()
440
+ .then(async (name) => {
441
+ component = mapComponentName(name);
442
+ if (!component.group) {
443
+ const groupFolders = await glob(`${CWD}/livingdocs/*`);
444
+ const groups = [];
445
+ for (let x = 0; x < groupFolders.length; x++) {
446
+ const f = groupFolders[x].split('/');
447
+ groups.push(f.pop());
448
+ }
449
+ groups.sort((a, b) => {
450
+ if (a < b) {
451
+ return -1;
452
+ }
453
+ if (a > b) {
454
+ return 1;
455
+ }
456
+ return 0;
457
+ });
458
+
459
+ const prompt = new AutoComplete({
460
+ name: 'group',
461
+ message: 'Group',
462
+ choices: groups,
463
+ });
464
+
465
+ prompt
466
+ .run()
467
+ .then(async (group) => {
468
+ await writeComponent(group, component.name);
469
+ })
470
+ .catch(console.error);
471
+ } else {
472
+ await writeComponent(component.group, component.name);
473
+ }
474
+ })
475
+ .catch(console.error);
476
+ } else if (!component.group) {
477
+ const groupFolders = await glob(`${CWD}/livingdocs/*`);
478
+ const groups = [];
479
+ for (let x = 0; x < groupFolders.length; x++) {
480
+ const f = groupFolders[x].split('/');
481
+ groups.push(f.pop());
482
+ }
483
+ groups.sort((a, b) => {
484
+ if (a < b) {
485
+ return -1;
486
+ }
487
+ if (a > b) {
488
+ return 1;
489
+ }
490
+ return 0;
491
+ });
492
+
493
+ const prompt = new AutoComplete({
494
+ name: 'group',
495
+ message: 'Group',
496
+ choices: groups,
497
+ });
498
+
499
+ prompt
500
+ .run()
501
+ .then(async (group) => {
502
+ await writeComponent(group, component.name);
503
+ })
504
+ .catch(console.error);
505
+ } else {
506
+ await writeComponent(component.group, component.name);
507
+ }
508
+ return true;
509
+ }
510
+
511
+ /**
512
+ * Creates a new group folder for saving living documents.
513
+ *
514
+ * @param {string} group - The name of the group to create.
515
+ * @returns {Promise<boolean>} - Returns a promise that resolves to true if the group was created successfully, otherwise false.
516
+ */
517
+ async function writeGroup(group) {
518
+ if (!group) {
519
+ console.error('No group name set!');
520
+ return false;
521
+ }
522
+ const path = resolve(CWD, `./livingdocs/${group}`);
523
+ try {
524
+ const stat = await statSync(path);
525
+ console.error(`Group "${group}" allready exist!`);
526
+ return false;
527
+ } catch (e) {
528
+ await mkdirSync(path);
529
+ console.log(`Group "${group}" created!`);
530
+ }
531
+ return true;
532
+ }
533
+
534
+ /**
535
+ * Creates a group.
536
+ *
537
+ * @param {string} group - The name of the group to be created. If not provided, user will be prompted to enter the group name.
538
+ * @returns {Promise<boolean>} - A promise that resolves to a boolean value indicating if the group was successfully created or not.
539
+ */
540
+ async function createGroup(group) {
541
+ if (!group) {
542
+ const { Input } = require('enquirer');
543
+ const prompt = new Input({
544
+ message: 'What is your group name?',
545
+ });
546
+
547
+ return await prompt
548
+ .run()
549
+ .then(async (group) => {
550
+ return await writeGroup(group);
551
+ })
552
+ .catch(console.error);
553
+ } else {
554
+ return await writeGroup(group);
555
+ }
556
+ return false;
557
+ }
558
+
559
+ export {
560
+ addComponents,
561
+ addGroups,
562
+ removeComponents,
563
+ removeGroups,
564
+ createComponent,
565
+ createGroup,
566
+ };