@valbuild/ui 0.21.0 → 0.21.1

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.
@@ -62757,6 +62757,7 @@ function parseTokens(tokens, sourceNodes, cursor, insideList = false) {
62757
62757
  children: parseTokens(token.tokens ? token.tokens : [], sourceNodes, 0).children
62758
62758
  });
62759
62759
  } else if (token.type === "text") {
62760
+ console.log(" ", token.raw.slice(0, 10));
62760
62761
  if ("tokens" in token && Array.isArray(token.tokens)) {
62761
62762
  children.push(
62762
62763
  ...parseTokens(token.tokens, sourceNodes, cursor, insideList).children
@@ -62860,6 +62861,11 @@ function parseTokens(tokens, sourceNodes, cursor, insideList = false) {
62860
62861
  ).children
62861
62862
  });
62862
62863
  }
62864
+ } else if (token.type === "br") {
62865
+ children.push({
62866
+ tag: "br",
62867
+ children: []
62868
+ });
62863
62869
  } else {
62864
62870
  console.error(
62865
62871
  `Could not parse markdown: unsupported token type: ${token.type}. Found: ${token.raw}`
@@ -62755,6 +62755,7 @@ function parseTokens(tokens, sourceNodes, cursor, insideList = false) {
62755
62755
  children: parseTokens(token.tokens ? token.tokens : [], sourceNodes, 0).children
62756
62756
  });
62757
62757
  } else if (token.type === "text") {
62758
+ console.log(" ", token.raw.slice(0, 10));
62758
62759
  if ("tokens" in token && Array.isArray(token.tokens)) {
62759
62760
  children.push(
62760
62761
  ...parseTokens(token.tokens, sourceNodes, cursor, insideList).children
@@ -62858,6 +62859,11 @@ function parseTokens(tokens, sourceNodes, cursor, insideList = false) {
62858
62859
  ).children
62859
62860
  });
62860
62861
  }
62862
+ } else if (token.type === "br") {
62863
+ children.push({
62864
+ tag: "br",
62865
+ children: []
62866
+ });
62861
62867
  } else {
62862
62868
  console.error(
62863
62869
  `Could not parse markdown: unsupported token type: ${token.type}. Found: ${token.raw}`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/ui",
3
- "version": "0.21.0",
3
+ "version": "0.21.1",
4
4
  "sideEffects": false,
5
5
  "scripts": {
6
6
  "typecheck": "tsc --noEmit",
@@ -17,7 +17,7 @@
17
17
  "@lexical/utils": "^0.10.0",
18
18
  "@types/express": "^4.17.17",
19
19
  "@types/react": "^18.0.26",
20
- "@valbuild/core": "~0.21.0",
20
+ "@valbuild/core": "~0.21.1",
21
21
  "classnames": "^2.3.2",
22
22
  "esbuild": "^0.17.19",
23
23
  "lexical": "^0.10.0",
@@ -224,6 +224,51 @@ A nested list:
224
224
  ]);
225
225
  });
226
226
 
227
+ test("br tokens", () => {
228
+ const r = val.richtext`1 år 400,- kinokveld
229
+ 5 år 5000,- en kveld i tretoppene`;
230
+ expect(parseRichTextSource(r).children).toStrictEqual([
231
+ {
232
+ tag: "p",
233
+ children: [
234
+ "1 år 400,- kinokveld",
235
+ { tag: "br", children: [] },
236
+ "5 år 5000,- en kveld i tretoppene",
237
+ ],
238
+ },
239
+ ]);
240
+ });
241
+
242
+ test("multiple br tokens", () => {
243
+ const r = val.richtext`1 år 400,- kinokveld
244
+ 2 år 1000,- kulturell opplevelse
245
+ 3 år 2000,- mat i fjeset
246
+ 4 år 500,- nørding i bokhandel
247
+ 5 år 5000,- en kveld i tretoppene
248
+ 6 år 1200,- ta smaksløkene på trim
249
+ 7 år 2500,- gjør en forskjell`;
250
+ expect(parseRichTextSource(r).children).toStrictEqual([
251
+ {
252
+ tag: "p",
253
+ children: [
254
+ "1 år 400,- kinokveld",
255
+ { tag: "br", children: [] },
256
+ "2 år 1000,- kulturell opplevelse",
257
+ { tag: "br", children: [] },
258
+ "3 år 2000,- mat i fjeset",
259
+ { tag: "br", children: [] },
260
+ "4 år 500,- nørding i bokhandel",
261
+ { tag: "br", children: [] },
262
+ "5 år 5000,- en kveld i tretoppene",
263
+ { tag: "br", children: [] },
264
+ "6 år 1200,- ta smaksløkene på trim",
265
+ { tag: "br", children: [] },
266
+ "7 år 2500,- gjør en forskjell",
267
+ ],
268
+ },
269
+ ]);
270
+ });
271
+
227
272
  test("image", () => {
228
273
  const r = val.richtext`# Title 1
229
274
 
@@ -75,6 +75,7 @@ function parseTokens(
75
75
  .children as SpanNode<AnyRichTextOptions>["children"],
76
76
  });
77
77
  } else if (token.type === "text") {
78
+ console.log(" ", token.raw.slice(0, 10));
78
79
  if ("tokens" in token && Array.isArray(token.tokens)) {
79
80
  children.push(
80
81
  ...parseTokens(token.tokens, sourceNodes, cursor, insideList).children
@@ -180,6 +181,11 @@ function parseTokens(
180
181
  ).children as LinkNode<AnyRichTextOptions>["children"],
181
182
  });
182
183
  }
184
+ } else if (token.type === "br") {
185
+ children.push({
186
+ tag: "br",
187
+ children: [],
188
+ });
183
189
  } else {
184
190
  console.error(
185
191
  `Could not parse markdown: unsupported token type: ${token.type}. Found: ${token.raw}`