@simple-reporting/base 1.0.18 → 1.0.20

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 (104) hide show
  1. package/dev/package.json +1 -2
  2. package/package.json +1 -1
  3. package/scripts/beaver.js +5 -5
  4. package/scripts/build.js +38 -15
  5. package/scripts/folders.js +1 -1
  6. package/scripts/prepare.js +13 -1
  7. package/srl/{tsconfig.srl.json → .srl/tsconfig.srl.json} +2 -2
  8. package/srl/.srl/utils/html.ts +85 -0
  9. package/srl/srl/colors.scss +2 -2
  10. package/srl/srl/config.scss +7 -7
  11. package/srl/srl/core-styles.scss +1 -1
  12. package/srl/srl/fonts.scss +1 -1
  13. package/srl/srl/grid.scss +1 -1
  14. package/srl/srl/helpers.scss +1 -1
  15. package/srl/srl/index.scss +9 -9
  16. package/srl/srl/meta.scss +1 -1
  17. package/srl/srl/pdf.scss +1 -1
  18. package/srl/srl/spacer.scss +1 -1
  19. package/srl/srl/system.scss +1 -1
  20. package/srl/srl/typography.scss +2 -2
  21. package/srl/utils/html.ts +0 -188
  22. /package/{srl/scss → scss}/colors/functions.scss +0 -0
  23. /package/{srl/scss → scss}/colors/index.scss +0 -0
  24. /package/{srl/scss → scss}/colors/mixins.scss +0 -0
  25. /package/{srl/scss → scss}/colors/variables.scss +0 -0
  26. /package/{srl/scss → scss}/config.scss +0 -0
  27. /package/{srl/scss → scss}/core-styles.scss +0 -0
  28. /package/{srl/scss → scss}/fonts/functions.scss +0 -0
  29. /package/{srl/scss → scss}/fonts/index.scss +0 -0
  30. /package/{srl/scss → scss}/fonts/mixins.scss +0 -0
  31. /package/{srl/scss → scss}/fonts/variables.scss +0 -0
  32. /package/{srl/scss → scss}/grid/functions.scss +0 -0
  33. /package/{srl/scss → scss}/grid/index.scss +0 -0
  34. /package/{srl/scss → scss}/grid/mixins.scss +0 -0
  35. /package/{srl/scss → scss}/grid/variables.scss +0 -0
  36. /package/{srl/scss → scss}/helpers/functions.scss +0 -0
  37. /package/{srl/scss → scss}/helpers/index.scss +0 -0
  38. /package/{srl/scss → scss}/helpers/mixins.scss +0 -0
  39. /package/{srl/scss → scss}/helpers/variables.scss +0 -0
  40. /package/{srl/scss → scss}/index.scss +0 -0
  41. /package/{srl/scss → scss}/meta/functions.scss +0 -0
  42. /package/{srl/scss → scss}/meta/index.scss +0 -0
  43. /package/{srl/scss → scss}/meta/mixins.scss +0 -0
  44. /package/{srl/scss → scss}/meta/variables.scss +0 -0
  45. /package/{srl/scss → scss}/spacer/functions.scss +0 -0
  46. /package/{srl/scss → scss}/spacer/index.scss +0 -0
  47. /package/{srl/scss → scss}/spacer/mixins.scss +0 -0
  48. /package/{srl/scss → scss}/spacer/variables.scss +0 -0
  49. /package/{srl/scss → scss}/system/functions.scss +0 -0
  50. /package/{srl/scss → scss}/system/index.scss +0 -0
  51. /package/{srl/scss → scss}/system/mixins.scss +0 -0
  52. /package/{srl/scss → scss}/system/root.scss +0 -0
  53. /package/{srl/scss → scss}/system/variables.scss +0 -0
  54. /package/{srl/scss → scss}/typography/functions.scss +0 -0
  55. /package/{srl/scss → scss}/typography/index.scss +0 -0
  56. /package/{srl/scss → scss}/typography/mixins.scss +0 -0
  57. /package/{srl/scss → scss}/typography/variables.scss +0 -0
  58. /package/{srl/scss → scss}/xbrl-core-styles.scss +0 -0
  59. /package/srl/{App.vue → .srl/App.vue} +0 -0
  60. /package/srl/{components → .srl/components}/Srl/Aria/TabChain.vue +0 -0
  61. /package/srl/{components → .srl/components}/Srl/Article/Autoload.vue +0 -0
  62. /package/srl/{components → .srl/components}/Srl/Article/Dialog/Button.vue +0 -0
  63. /package/srl/{components → .srl/components}/Srl/Article/Root.vue +0 -0
  64. /package/srl/{components → .srl/components}/Srl/Category/Accordion/Content.vue +0 -0
  65. /package/srl/{components → .srl/components}/Srl/Category/Accordion/Toggle.vue +0 -0
  66. /package/srl/{components → .srl/components}/Srl/Category/Accordion.vue +0 -0
  67. /package/srl/{components → .srl/components}/Srl/Menu/Item/Content/Icon/After.vue +0 -0
  68. /package/srl/{components → .srl/components}/Srl/Menu/Item/Content/Icon/Before.vue +0 -0
  69. /package/srl/{components → .srl/components}/Srl/Menu/Item/Content/Icon.vue +0 -0
  70. /package/srl/{components → .srl/components}/Srl/Menu/Item/Content/Image/After.vue +0 -0
  71. /package/srl/{components → .srl/components}/Srl/Menu/Item/Content/Image/Before.vue +0 -0
  72. /package/srl/{components → .srl/components}/Srl/Menu/Item/Content/Image.vue +0 -0
  73. /package/srl/{components → .srl/components}/Srl/Menu/Item/Content/Text.vue +0 -0
  74. /package/srl/{components → .srl/components}/Srl/Menu/Item/Content.vue +0 -0
  75. /package/srl/{components → .srl/components}/Srl/Menu/Item.vue +0 -0
  76. /package/srl/{components → .srl/components}/Srl/Menu.vue +0 -0
  77. /package/srl/{components → .srl/components}/Srl/Page/Dialog.vue +0 -0
  78. /package/srl/{composables → .srl/composables}/article.ts +0 -0
  79. /package/srl/{composables → .srl/composables}/articles.ts +0 -0
  80. /package/srl/{composables → .srl/composables}/config.ts +0 -0
  81. /package/srl/{composables → .srl/composables}/cssStyles.ts +0 -0
  82. /package/srl/{composables → .srl/composables}/downloads.ts +0 -0
  83. /package/srl/{composables → .srl/composables}/index.ts +0 -0
  84. /package/srl/{composables → .srl/composables}/languageSwitch.ts +0 -0
  85. /package/srl/{composables → .srl/composables}/locale.ts +0 -0
  86. /package/srl/{composables → .srl/composables}/menu.ts +0 -0
  87. /package/srl/{composables → .srl/composables}/search.ts +0 -0
  88. /package/srl/{composables → .srl/composables}/settings.ts +0 -0
  89. /package/srl/{composables → .srl/composables}/viewPort.ts +0 -0
  90. /package/srl/{imports → .srl/imports}/app.scss +0 -0
  91. /package/srl/{imports → .srl/imports}/ldd.scss +0 -0
  92. /package/srl/{imports → .srl/imports}/pdf.scss +0 -0
  93. /package/srl/{imports → .srl/imports}/word.scss +0 -0
  94. /package/srl/{imports → .srl/imports}/xbrl.scss +0 -0
  95. /package/srl/{plugins → .srl/plugins}/asyncLdComponent.ts +0 -0
  96. /package/srl/{plugins → .srl/plugins}/asyncSrlComponents.ts +0 -0
  97. /package/srl/{plugins → .srl/plugins}/initProject.ts +0 -0
  98. /package/srl/{plugins → .srl/plugins}/vueSrlPlugin.ts +0 -0
  99. /package/srl/{types → .srl/types}/components.d.ts +0 -0
  100. /package/srl/{types → .srl/types}/global.d.ts +0 -0
  101. /package/srl/{types → .srl/types}/nswow.d.ts +0 -0
  102. /package/srl/{utils → .srl/utils}/camelCase.ts +0 -0
  103. /package/srl/{utils → .srl/utils}/index.ts +0 -0
  104. /package/srl/{utils → .srl/utils}/uri.ts +0 -0
package/dev/package.json CHANGED
@@ -19,7 +19,7 @@
19
19
  "postinstall": "srl prepare"
20
20
  },
21
21
  "dependencies": {
22
- "@simple-reporting/base": "^1.0.18",
22
+ "@simple-reporting/base": "^1.0.20",
23
23
  "axios": "^1.12.2",
24
24
  "chalk": "^5.6.2",
25
25
  "exceljs": "^4.4.0",
@@ -29,7 +29,6 @@
29
29
  "node-html-parser": "^7.0.1",
30
30
  "pinia": "^2.3.1",
31
31
  "scrollmonitor": "^1.2.11",
32
- "standard-scss": "github:mms-neidhartschoen/nsfd_standard-scss",
33
32
  "vite-plugin-pwa": "^0.21.2",
34
33
  "vue": "^3.5.13",
35
34
  "vue-i18n": "^11.1.12",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-reporting/base",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Manage srl templates, build and publish",
5
5
  "bin": {
6
6
  "srl": "cli.js"
package/scripts/beaver.js CHANGED
@@ -46,7 +46,7 @@ function mapValues(values) {
46
46
  * @returns {string} - The generated SCSS code.
47
47
  */
48
48
  function writeTypographyScss(typography) {
49
- let r = [`@use "config";`, `@forward "../scss/typography";`];
49
+ let r = [`@use "config";`, `@forward "@simple-reporting/base/scss/typography";`];
50
50
  if (typography) {
51
51
  if (typography.typography) {
52
52
  let o = [];
@@ -57,7 +57,7 @@ function writeTypographyScss(typography) {
57
57
  o.push(`}\n`);
58
58
  }
59
59
  if (o.length) {
60
- r.push(`@use "../scss/typography";\n`);
60
+ r.push(`@use "@simple-reporting/base/scss/typography";\n`);
61
61
  r.push(o.join(`\n`));
62
62
  }
63
63
  }
@@ -72,7 +72,7 @@ function writeTypographyScss(typography) {
72
72
  * @returns {string} - The SCSS code for importing and forwarding colors.
73
73
  */
74
74
  function writeColorsScss(colors) {
75
- let r = [`@use "config";`, `@forward "../scss/colors";`];
75
+ let r = [`@use "config";`, `@forward "@simple-reporting/base/scss/colors";`];
76
76
  if (colors) {
77
77
  if (colors.colors) {
78
78
  let o = [];
@@ -84,7 +84,7 @@ function writeColorsScss(colors) {
84
84
  }
85
85
 
86
86
  if (o.length) {
87
- r.push(`@use "../scss/colors";\n`);
87
+ r.push(`@use "@simple-reporting/base/scss/colors";\n`);
88
88
  r.push(o.join(`\n`));
89
89
  }
90
90
  }
@@ -263,7 +263,7 @@ async function beaver(verbose = 0) {
263
263
  if (typeof map[file] !== 'undefined') {
264
264
  const o = [];
265
265
  o.push(
266
- `@use "../scss/${file}/variables.scss" as ${file}Variables with (`,
266
+ `@use "@simple-reporting/base/scss/${file}/variables.scss" as ${file}Variables with (`,
267
267
  );
268
268
  let v = [];
269
269
  for (const variable in map[file]) {
package/scripts/build.js CHANGED
@@ -448,10 +448,10 @@ async function buildLdd(version) {
448
448
  input: importFile,
449
449
  output: {
450
450
  assetFileNames: (assetInfo) => {
451
- if (/woff|woff2|ttf|otf|svg|jpe?g|png|gif|webp|avif|bmp|ico|apng/.test(assetInfo.name)) {
452
- return '[name]-[hash][extname]';
451
+ if (/css/.test(assetInfo.name)) {
452
+ return '[name][extname]';
453
453
  }
454
- return '[name][extname]';
454
+ return '[name]-[hash][extname]';
455
455
  }
456
456
  }
457
457
  }
@@ -478,7 +478,19 @@ async function buildLdd(version) {
478
478
  }
479
479
 
480
480
  async function buildPdfCustomer(customer) {
481
- const customerDir = join(folders.root, 'pdf', 'customers', customer);
481
+
482
+ const customersDir = join(folders.root, 'pdf', 'customers');
483
+
484
+ if (customer === 'all') {
485
+ const customers = readdirSync(customersDir);
486
+ for (let i = 0; i < customers.length; i++) {
487
+ await buildPdfCustomer(customers[i]);
488
+ }
489
+ return true;
490
+ }
491
+
492
+ const customerDir = join(customersDir, customer);
493
+ const customerName = customer.split('-')[0];
482
494
 
483
495
  try {
484
496
  statSync(customerDir);
@@ -502,7 +514,7 @@ async function buildPdfCustomer(customer) {
502
514
 
503
515
  try {
504
516
  statSync(customerDir);
505
- const customerTarget = join(lddPdfDir, customer);
517
+ const customerTarget = join(lddPdfDir, customerName);
506
518
  mkdirSync(customerTarget, { recursive: true });
507
519
  const jsReferences = [
508
520
  'pdf.js'
@@ -514,6 +526,7 @@ async function buildPdfCustomer(customer) {
514
526
  try {
515
527
  const tsPath = join(customerDir, 'custom.ts');
516
528
  statSync(tsPath);
529
+
517
530
  const config = {
518
531
  css: {
519
532
  preprocessorOptions: {
@@ -524,12 +537,22 @@ async function buildPdfCustomer(customer) {
524
537
  },
525
538
  base: './',
526
539
  build: {
540
+ assetsInlineLimit: 0,
527
541
  outDir: customerTarget,
528
- lib: {
529
- fileName: 'custom',
530
- entry: tsPath,
531
- formats: ['es'],
532
- },
542
+ assetsDir: '',
543
+ rollupOptions: {
544
+ input: tsPath,
545
+ output: {
546
+ entryFileNames: '[name].js',
547
+ chunkFileNames: '[name].js',
548
+ assetFileNames: (assetInfo) => {
549
+ if (/css/.test(assetInfo.name)) {
550
+ return '[name][extname]';
551
+ }
552
+ return 'assets/[name]-[hash][extname]';
553
+ }
554
+ }
555
+ }
533
556
  },
534
557
  publicDir: false,
535
558
  };
@@ -862,32 +885,32 @@ async function mapScss() {
862
885
  join(folders.srlImports, 'app.scss'),
863
886
  `@use ` +
864
887
  output.app.join(';\n@use ') +
865
- `;\n@use "../scss/core-styles.scss" as *;\n`,
888
+ `;\n@use "@simple-reporting/base/scss/core-styles.scss" as *;\n`,
866
889
  );
867
890
  await writeFileSync(
868
891
  join(folders.srlImports, 'ldd.scss'),
869
892
  `@use ` +
870
893
  output.ldd.join(';\n@use ') +
871
- `;\n@use "../scss/core-styles.scss" as *;\n`,
894
+ `;\n@use "@simple-reporting/base/scss/core-styles.scss" as *;\n`,
872
895
  );
873
896
  await writeFileSync(
874
897
  join(folders.srlImports, 'pdf.scss'),
875
898
  `@use ` +
876
899
  output.pdf.join(';\n@use ') +
877
- `;\n@use "../scss/core-styles.scss" as *;\n`,
900
+ `;\n@use "@simple-reporting/base/scss/core-styles.scss" as *;\n`,
878
901
  );
879
902
  await writeFileSync(
880
903
  join(folders.srlImports, 'word.scss'),
881
904
  `@use ` +
882
905
  output.word.join(';\n@use ') +
883
- `;\n@use "../scss/core-styles.scss" as *;\n`,
906
+ `;\n@use "@simple-reporting/base/scss/core-styles.scss" as *;\n`,
884
907
  );
885
908
 
886
909
  await writeFileSync(
887
910
  join(folders.srlImports, 'xbrl.scss'),
888
911
  output.xbrl.length
889
912
  ? `@use ` + output.xbrl.join(';\n@use ')
890
- : '' + `;\n@use "../scss/xbrl-core-styles.scss" as *;\n`,
913
+ : '' + `;\n@use "@simple-reporting/base/scss/xbrl-core-styles.scss" as *;\n`,
891
914
  );
892
915
 
893
916
  return true;
@@ -7,7 +7,7 @@ export const packagePath = join(root, 'node_modules', packageName);
7
7
  export const packageSrl = join(packagePath, 'srl');
8
8
  export const packageLd = join(packagePath, 'livingdocs');
9
9
  export const srlRoot = join(root, '.srl');
10
- export const srlSystem = join(srlRoot, 'srl');
10
+ export const srlSystem = join(root, 'srl');
11
11
  export const srlComponents = join(srlRoot, 'components');
12
12
  export const srlComposables = join(srlRoot, 'composables');
13
13
  export const srlUtils = join(srlRoot, 'utils');
@@ -1,11 +1,23 @@
1
1
  import folders from './folders.js';
2
2
  import fs from 'fs';
3
+ import { join } from 'path/posix';
3
4
 
4
5
  async function prepare() {
5
6
  if (fs.existsSync(folders.srlRoot)) {
6
7
  await fs.rmSync(folders.srlRoot, { recursive: true, force: true });
7
8
  }
8
- await fs.cpSync(folders.packageSrl, folders.srlRoot, { recursive: true });
9
+ const srlFolders = fs.readdirSync(folders.packageSrl, { withFileTypes: true });
10
+ for (const srlFolder of srlFolders) {
11
+ const srcPath = join(folders.packageSrl, srlFolder.name);
12
+ const destPath = join(folders.root, srlFolder.name);
13
+ fs.cpSync(srcPath, destPath, { recursive: true });
14
+ }
15
+ const srlIgnoresFiles = fs.readdirSync(join(folders.packageSrl, 'srl'), { withFileTypes: true });
16
+ const srlIgnoreContent = [];
17
+ for (const srlIgnoreFile of srlIgnoresFiles) {
18
+ srlIgnoreContent.push(`/${srlIgnoreFile.name}`);
19
+ }
20
+ fs.writeFileSync(join(folders.root, 'srl', '.gitignore'), srlIgnoreContent.join('\n'));
9
21
  }
10
22
 
11
23
  export default prepare;
@@ -79,10 +79,10 @@
79
79
  "../src/assets/*"
80
80
  ],
81
81
  "srl": [
82
- "./srl"
82
+ "../srl"
83
83
  ],
84
84
  "srl/*": [
85
- "./srl/*"
85
+ "../srl/*"
86
86
  ]
87
87
  }
88
88
  }
@@ -0,0 +1,85 @@
1
+ import { isRouterPath } from '#utils/uri.ts';
2
+ import { useArticles, useLocale, addCssStyles } from '#composables';
3
+
4
+ type AttrObj = { [key: string]: string | null };
5
+ function attributesToString(attributes: Record<string, string | null>): string {
6
+ return Object.entries(attributes)
7
+ .map(([key, value]) => (value !== null ? `${key}="${value}"` : key))
8
+ .join(' ');
9
+ }
10
+
11
+ export function prepareHtmlContent(text: string): string {
12
+ const articles = useArticles();
13
+ const locale = useLocale();
14
+
15
+ const regex = /<a\s+([^>]+)>(.*?)<\/a>/gis;
16
+ text = text.replace(regex, (match, attrString, innerText) => {
17
+
18
+ const attrObj: AttrObj = {};
19
+ attrString.replace(/([a-zA-Z0-9\-_]+)(?:="([^"]*)")?/g, (m, key: string, value: string | null) => {
20
+ attrObj[key] = value || null;
21
+ return m;
22
+ });
23
+
24
+ if (
25
+ attrObj['data-note-target'] &&
26
+ attrObj['data-note-target'] === 'popup'
27
+ ) {
28
+ attrObj.uuid = attrObj.href;
29
+ delete attrObj.href;
30
+ const attrs = attributesToString(attrObj);
31
+ return `<srl-article-dialog-button ${attrs}>${innerText}</srl-article-dialog-button>`;
32
+ }
33
+
34
+ if (attrObj.href) {
35
+ const arrLink = attrObj.href.split('#');
36
+
37
+ if (isRouterPath(arrLink[0])) {
38
+ delete attrObj.href;
39
+ if (arrLink[0].startsWith('./')) {
40
+ arrLink[0] = arrLink[0].substring(1);
41
+ }
42
+ if (arrLink[0] === `/${locale.value}/home`) {
43
+ arrLink[0] = `/${locale.value}`;
44
+ }
45
+ attrObj.to = arrLink[0];
46
+ if (arrLink[1]) {
47
+ attrObj.to += `#${arrLink[1]}`;
48
+ }
49
+ const attrs = attributesToString(attrObj);
50
+ return `<router-link ${attrs}>${innerText}</router-link>`;
51
+ }
52
+
53
+ const a = articles.value.find((i) => i.uuid === arrLink[0]);
54
+ if (a) {
55
+ delete attrObj.href;
56
+ attrObj.to = a.index
57
+ ? `/${locale.value}`
58
+ : `/${locale.value}/${a.slug}`;
59
+ if (arrLink[1]) {
60
+ attrObj.to += `#${arrLink[1]}`;
61
+ }
62
+ const attrs = attributesToString(attrObj);
63
+ return `<router-link ${attrs}>${innerText}</router-link>`;
64
+ }
65
+ }
66
+
67
+ return match;
68
+ });
69
+
70
+ text = text.replace(
71
+ /<template-([a-z]+)>([\s\S]*?)<\/template-\1>/g,
72
+ (_match, name, content) => `<template #${name}>${content}</template>`
73
+ );
74
+
75
+ text = text.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi, (match, p1) => {
76
+ addCssStyles(p1);
77
+ return '';
78
+ });
79
+
80
+ return text;
81
+ }
82
+
83
+ export default {
84
+ prepareHtmlContent,
85
+ };
@@ -1,3 +1,3 @@
1
1
  @use 'config';
2
- @forward '../scss/colors';
3
- @use '../scss/colors';
2
+ @forward '@simple-reporting/base/scss/colors';
3
+ @use '@simple-reporting/base/scss/colors';
@@ -1,7 +1,7 @@
1
- @use '../scss/system/variables' as systemVariables;
2
- @use '../scss/meta/variables' as metaVariables;
3
- @use '../scss/grid/variables' as gridVariables;
4
- @use '../scss/colors/variables' as colorsVariables;
5
- @use '../scss/typography/variables' as typographyVariables;
6
- @use '../scss/spacer/variables' as spacerVariables;
7
- @use '../scss/helpers/variables' as helpersVariables;
1
+ @use '@simple-reporting/base/scss/system/variables' as systemVariables;
2
+ @use '@simple-reporting/base/scss/meta/variables' as metaVariables;
3
+ @use '@simple-reporting/base/scss/grid/variables' as gridVariables;
4
+ @use '@simple-reporting/base/scss/colors/variables' as colorsVariables;
5
+ @use '@simple-reporting/base/scss/typography/variables' as typographyVariables;
6
+ @use '@simple-reporting/base/scss/spacer/variables' as spacerVariables;
7
+ @use '@simple-reporting/base/scss/helpers/variables' as helpersVariables;
@@ -1,2 +1,2 @@
1
1
  @use 'config';
2
- @forward '../scss/core-styles';
2
+ @forward '@simple-reporting/base/scss/core-styles';
@@ -1,2 +1,2 @@
1
1
  @use 'config';
2
- @forward '../scss/fonts';
2
+ @forward '@simple-reporting/base/scss/fonts';
package/srl/srl/grid.scss CHANGED
@@ -1,2 +1,2 @@
1
1
  @use 'config';
2
- @forward '../scss/grid';
2
+ @forward '@simple-reporting/base/scss/grid';
@@ -1,2 +1,2 @@
1
1
  @use 'config';
2
- @forward '../scss/helpers';
2
+ @forward '@simple-reporting/base/scss/helpers';
@@ -1,9 +1,9 @@
1
- @use 'config';
2
- @forward 'system' as system-*;
3
- @forward 'fonts' as fonts-*;
4
- @forward 'grid' as grid-*;
5
- @forward 'colors' as colors-*;
6
- @forward 'typography' as typography-*;
7
- @forward 'helpers' as helpers-*;
8
- @forward 'spacer' as spacer-*;
9
- @forward 'meta';
1
+ @use './config';
2
+ @forward './system' as system-*;
3
+ @forward './fonts' as fonts-*;
4
+ @forward './grid' as grid-*;
5
+ @forward './colors' as colors-*;
6
+ @forward './typography' as typography-*;
7
+ @forward './helpers' as helpers-*;
8
+ @forward './spacer' as spacer-*;
9
+ @forward './meta';
package/srl/srl/meta.scss CHANGED
@@ -1,2 +1,2 @@
1
1
  @use 'config';
2
- @forward '../scss/meta';
2
+ @forward '@simple-reporting/base/scss/meta';
package/srl/srl/pdf.scss CHANGED
@@ -1,2 +1,2 @@
1
1
  @use 'config';
2
- @forward '../scss/pdf';
2
+ @forward '@simple-reporting/base/scss/pdf';
@@ -1,2 +1,2 @@
1
1
  @use 'config';
2
- @forward '../scss/spacer';
2
+ @forward '@simple-reporting/base/scss/spacer';
@@ -1,2 +1,2 @@
1
1
  @use 'config';
2
- @forward '../scss/system';
2
+ @forward '@simple-reporting/base/scss/system';
@@ -1,3 +1,3 @@
1
1
  @use 'config';
2
- @forward '../scss/typography';
3
- @use '../scss/typography';
2
+ @forward '@simple-reporting/base/scss/typography';
3
+ @use '@simple-reporting/base/scss/typography';
package/srl/utils/html.ts DELETED
@@ -1,188 +0,0 @@
1
- import { isRouterPath } from '#utils/uri.ts';
2
- import { useArticles, useLocale, addCssStyles } from '#composables';
3
-
4
- type AttrObj = { [key: string]: string | null };
5
- function attributesToString(attributes: Record<string, string | null>): string {
6
- return Object.entries(attributes)
7
- .map(([key, value]) => (value !== null ? `${key}="${value}"` : key))
8
- .join(' ');
9
- }
10
-
11
- function replaceAccordionContainer(text: string): string {
12
- const openTagRegex = /<div([^>]*\bclass\s*=\s*["']lc-accordion\s[^"']*["'][^>]*)>/gi;
13
- let result = '';
14
- let lastIndex = 0;
15
- let match;
16
-
17
- while ((match = openTagRegex.exec(text)) !== null) {
18
- const start = match.index;
19
- const attrs = match[1];
20
- let depth = 1;
21
- let end = openTagRegex.lastIndex;
22
-
23
- while (depth > 0) {
24
- const nextOpen = text.indexOf('<div', end);
25
- const nextClose = text.indexOf('</div>', end);
26
- if (nextClose === -1) break;
27
- if (nextOpen !== -1 && nextOpen < nextClose) {
28
- depth++;
29
- end = nextOpen + 4;
30
- } else {
31
- depth--;
32
- end = nextClose + 6;
33
- }
34
- }
35
-
36
- const innerContent = replaceAccordionContainer(text.slice(openTagRegex.lastIndex, end - 6));
37
-
38
- result += text.slice(lastIndex, start);
39
- result += `<srl-category-accordion v-slot="{ accordion }"${attrs}>${innerContent}</srl-category-accordion>`;
40
- lastIndex = end;
41
- openTagRegex.lastIndex = end;
42
- }
43
- result += text.slice(lastIndex);
44
- return result;
45
- }
46
-
47
- function replaceAccordionToggle(text: string): string {
48
- const openTagRegex = /<div([^>]*\bclass\s*=\s*["']lc-accordion__head\s[^"']*["'][^>]*)>/gi;
49
- let result = '';
50
- let lastIndex = 0;
51
- let match;
52
-
53
- while ((match = openTagRegex.exec(text)) !== null) {
54
- const start = match.index;
55
- const attrs = match[1];
56
- const contentStart = openTagRegex.lastIndex;
57
- const closeTag = '</div>';
58
- const end = text.indexOf(closeTag, contentStart);
59
- if (end === -1) break;
60
-
61
- const innerContent = text.slice(contentStart, end);
62
-
63
- result += text.slice(lastIndex, start);
64
- result += `<srl-category-accordion-toggle :accordion="accordion"${attrs}>${innerContent}</srl-category-accordion-toggle>`;
65
- lastIndex = end + closeTag.length;
66
- openTagRegex.lastIndex = lastIndex;
67
- }
68
- result += text.slice(lastIndex);
69
- return result;
70
- }
71
-
72
- function replaceAccordionContent(text: string): string {
73
- const openTagRegex = /<div([^>]*\bclass\s*=\s*["']lc-accordion__content(?:\s[^"']*)?["'][^>]*)>/gi;
74
- let result = '';
75
- let lastIndex = 0;
76
- let match;
77
-
78
- while ((match = openTagRegex.exec(text)) !== null) {
79
- const start = match.index;
80
- const attrs = match[1];
81
- let depth = 1;
82
- let end = openTagRegex.lastIndex;
83
-
84
- while (depth > 0) {
85
- const nextOpen = text.indexOf('<div', end);
86
- const nextClose = text.indexOf('</div>', end);
87
- if (nextClose === -1) break;
88
- if (nextOpen !== -1 && nextOpen < nextClose) {
89
- depth++;
90
- end = nextOpen + 4;
91
- } else {
92
- depth--;
93
- end = nextClose + 6;
94
- }
95
- }
96
-
97
- const innerContent = replaceAccordionContent(text.slice(openTagRegex.lastIndex, end - 6));
98
-
99
- result += text.slice(lastIndex, start);
100
- result += `<srl-category-accordion-content :accordion="accordion"${attrs}>${innerContent}</srl-category-accordion-content>`;
101
- lastIndex = end;
102
- openTagRegex.lastIndex = end;
103
- }
104
- result += text.slice(lastIndex);
105
- return result;
106
- }
107
-
108
- export function prepareHtmlContent(text: string): string {
109
- const articles = useArticles();
110
- const locale = useLocale();
111
-
112
- const regex = /<a\s+([^>]+)>(.*?)<\/a>/gis;
113
- text = text.replace(regex, (match, attrString, innerText) => {
114
- // Attribute in ein Array umwandeln
115
- const attrObj: AttrObj = {};
116
- attrString.replace(/([a-zA-Z0-9\-_]+)(?:="([^"]*)")?/g, (m, key: string, value: string | null) => {
117
- attrObj[key] = value || null;
118
- return m;
119
- });
120
-
121
- if (
122
- attrObj['data-note-target'] &&
123
- attrObj['data-note-target'] === 'popup'
124
- ) {
125
- attrObj.uuid = attrObj.href;
126
- delete attrObj.href;
127
- const attrs = attributesToString(attrObj);
128
- return `<srl-article-dialog-button ${attrs}>${innerText}</srl-article-dialog-button>`;
129
- }
130
-
131
- if (attrObj.href) {
132
- const arrLink = attrObj.href.split('#');
133
-
134
- if (isRouterPath(arrLink[0])) {
135
- delete attrObj.href;
136
- if (arrLink[0].startsWith('./')) {
137
- arrLink[0] = arrLink[0].substring(1);
138
- }
139
- if (arrLink[0] === `/${locale.value}/home`) {
140
- arrLink[0] = `/${locale.value}`;
141
- }
142
- attrObj.to = arrLink[0];
143
- if (arrLink[1]) {
144
- attrObj.to += `#${arrLink[1]}`;
145
- }
146
- const attrs = attributesToString(attrObj);
147
- return `<router-link ${attrs}>${innerText}</router-link>`;
148
- }
149
-
150
- const a = articles.value.find((i) => i.uuid === arrLink[0]);
151
- if (a) {
152
- delete attrObj.href;
153
- attrObj.to = a.index
154
- ? `/${locale.value}`
155
- : `/${locale.value}/${a.slug}`;
156
- if (arrLink[1]) {
157
- attrObj.to += `#${arrLink[1]}`;
158
- }
159
- const attrs = attributesToString(attrObj);
160
- return `<router-link ${attrs}>${innerText}</router-link>`;
161
- }
162
- }
163
-
164
- return match;
165
- });
166
-
167
- text = text.replace(
168
- /<template-([a-z]+)>([\s\S]*?)<\/template-\1>/g,
169
- (_match, name, content) => `<template #${name}>${content}</template>`
170
- );
171
-
172
- text = replaceAccordionContainer(text);
173
- text = replaceAccordionToggle(text);
174
- text = replaceAccordionContent(text);
175
-
176
- text = text.replaceAll('../', `./`);
177
-
178
- text = text.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi, (match, p1) => {
179
- addCssStyles(p1);
180
- return '';
181
- });
182
-
183
- return text;
184
- }
185
-
186
- export default {
187
- prepareHtmlContent,
188
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes