@simple-reporting/base 1.0.8 → 1.0.9

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.
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.8",
22
+ "@simple-reporting/base": "^1.0.9",
23
23
  "axios": "^1.9.0",
24
24
  "chalk": "^5.4.1",
25
25
  "exceljs": "^4.4.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simple-reporting/base",
3
- "version": "1.0.8",
3
+ "version": "1.0.9",
4
4
  "description": "Manage srl templates, build and publish",
5
5
  "bin": {
6
6
  "srl": "cli.js"
@@ -38,6 +38,7 @@
38
38
  */
39
39
  import { computed, type ComputedRef, ref } from 'vue';
40
40
  import { HTMLElement, parse as parseHtml } from 'node-html-parser';
41
+ import { useConfig, useArticles } from '#composables';
41
42
 
42
43
  const storage = ref<{
43
44
  [locale: string]: NsWowSearchList[];
@@ -68,7 +69,7 @@ function makeWords(html: string) {
68
69
  .replace(/\s{2,}/g, ' ');
69
70
  }
70
71
 
71
- export default async function useSearch(): ComputedRef<NsWowSearchList[]> {
72
+ export default async function useSearch(): Promise<ComputedRef<NsWowSearchList[]>> {
72
73
  const config = useConfig();
73
74
  if (!storage.value || !storage.value[config.value.locale]) {
74
75
  !storage.value ? (storage.value = {}) : null;
@@ -92,6 +92,9 @@ declare global {
92
92
  export type NsWowNavigationItem = {
93
93
  label: string;
94
94
  title?: string;
95
+ icon?: string;
96
+ iconBefore?: string;
97
+ iconAfter?: string;
95
98
  img?: {
96
99
  src: string;
97
100
  alt?: string;
package/srl/utils/html.ts CHANGED
@@ -7,6 +7,8 @@ function attributesToString(attributes: Record<string, string | null>): string {
7
7
  .join(' ');
8
8
  }
9
9
 
10
+ type AttrObj = { [key: string]: string | null };
11
+
10
12
  export function prepareHtmlContent(text: string): string {
11
13
  const articles = useArticles();
12
14
  const locale = useLocale();
@@ -14,8 +16,8 @@ export function prepareHtmlContent(text: string): string {
14
16
  const regex = /<a\s+([^>]+)>(.*?)<\/a>/gis;
15
17
  text = text.replace(regex, (match, attrString, innerText) => {
16
18
  // Attribute in ein Array umwandeln
17
- const attrObj = {};
18
- attrString.replace(/([a-zA-Z0-9\-_]+)(?:="([^"]*)")?/g, (m, key, value) => {
19
+ const attrObj: AttrObj = {};
20
+ attrString.replace(/([a-zA-Z0-9\-_]+)(?:="([^"]*)")?/g, (m, key: string, value: string | null) => {
19
21
  attrObj[key] = value || null;
20
22
  return m;
21
23
  });
@@ -66,6 +68,11 @@ export function prepareHtmlContent(text: string): string {
66
68
  return match;
67
69
  });
68
70
 
71
+ text = text.replace(
72
+ /<template-([a-z]+)>([\s\S]*?)<\/template-\1>/g,
73
+ (_match, name, content) => `<template #${name}>${content}</template>`
74
+ );
75
+
69
76
  text = text.replaceAll('../', `./`);
70
77
 
71
78
  text = text.replace(/<style[^>]*>([\s\S]*?)<\/style>/gi, (match, p1) => {