@vue-skuilder/common-ui 0.2.4 → 0.2.5

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.
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownRendererHelpers.d.ts","sourceRoot":"","sources":["../../../src/components/cardRendering/MarkdownRendererHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG7C;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAoB9E;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAmBhE;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,CAAC,SAAS,GAAG,gBAAgB,EAAE,CAkC/E;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,WAanD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,WAAW,WAE7C;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,GAAG,IAAI,CA8BP;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAUnE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG;IACvD,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE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AAI,CAGP"}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.4",
6
+ "version": "0.2.5",
7
7
  "sideEffects": false,
8
8
  "main": "./dist/common-ui.umd.js",
9
9
  "module": "./dist/common-ui.es.js",
@@ -34,8 +34,8 @@
34
34
  "@highlightjs/vue-plugin": "^2.1.2",
35
35
  "@mdi/font": "^7.3.67",
36
36
  "@vojtechlanka/vue-tags-input": "^3",
37
- "@vue-skuilder/common": "0.2.4",
38
- "@vue-skuilder/db": "0.2.4",
37
+ "@vue-skuilder/common": "0.2.5",
38
+ "@vue-skuilder/db": "0.2.5",
39
39
  "highlight.js": "^11.0.1",
40
40
  "marked": "^15.0.6",
41
41
  "moment": "^2.29.4",
@@ -71,5 +71,5 @@
71
71
  "vite-plugin-dts": "^4.5.3",
72
72
  "vitest": "^4.1.0"
73
73
  },
74
- "stableVersion": "0.2.4"
74
+ "stableVersion": "0.2.5"
75
75
  }
@@ -35,10 +35,17 @@ export function splitByDelimiters(text: string, l: string, r: string): string[]
35
35
  return ret;
36
36
  }
37
37
 
38
+ /** Strip trailing newline characters (but not spaces/tabs) from a string. */
39
+ function stripTrailingNewlines(text: string): string {
40
+ return text.replace(/[\r\n]+$/, '');
41
+ }
42
+
38
43
  export function splitTextToken(token: Tokens.Text): Tokens.Text[] {
39
44
  if (containsComponent(token)) {
40
- const textChunks = splitByDelimiters(token.text, '{{', '}}');
41
- const rawChunks = splitByDelimiters(token.raw, '{{', '}}');
45
+ // See splitParagraphToken: normalize trailing newlines (only) to neutralize
46
+ // marked's text/raw asymmetry without disturbing trailing spaces.
47
+ const textChunks = splitByDelimiters(stripTrailingNewlines(token.text), '{{', '}}');
48
+ const rawChunks = splitByDelimiters(stripTrailingNewlines(token.raw), '{{', '}}');
42
49
 
43
50
  if (textChunks.length === rawChunks.length) {
44
51
  return textChunks.map((_c, i) => {
@@ -62,8 +69,14 @@ export function splitParagraphToken(token: Tokens.Paragraph): TokenOrComponent[]
62
69
  let ret: MarkedToken[] = [];
63
70
 
64
71
  if (containsComponent(token)) {
65
- const textChunks = splitByDelimiters(token.text, '{{', '}}');
66
- const rawChunks = splitByDelimiters(token.raw, '{{', '}}');
72
+ // marked strips a trailing newline from token.text but keeps it on token.raw.
73
+ // When a blank/component is the last token, that asymmetry gives raw an extra
74
+ // trailing chunk, tripping the length check below and throwing. Strip trailing
75
+ // newlines (only) from both so the splits stay parallel. We must NOT strip
76
+ // trailing spaces: a trailing-space chunk is the documented workaround that
77
+ // keeps a final component from being treated as `last` (see MdTokenRenderer).
78
+ const textChunks = splitByDelimiters(stripTrailingNewlines(token.text), '{{', '}}');
79
+ const rawChunks = splitByDelimiters(stripTrailingNewlines(token.raw), '{{', '}}');
67
80
  if (textChunks.length === rawChunks.length) {
68
81
  for (let i = 0; i < textChunks.length; i++) {
69
82
  const textToken = {