tycho-components 0.21.13 → 0.21.15

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,4 +1,4 @@
1
- import { Struct, Token } from "../configs/types/Struct";
1
+ import { Struct, Token } from '../configs/types/Struct';
2
2
  declare const SentenceUtils: {
3
3
  sort: (struct: Struct) => Token[];
4
4
  getAsText: (struct: Struct, displayTags?: boolean) => string;
@@ -6,7 +6,7 @@ declare const SentenceUtils: {
6
6
  isVisible: (token: Token) => boolean;
7
7
  isFirstFromSplit: (token: Token) => boolean;
8
8
  getColspan: (thisToken: Token) => number;
9
- skipToken: (token: Token, splits?: boolean) => boolean;
9
+ skipToken: (token: Token, splits?: boolean, keepEmpty?: boolean) => boolean;
10
10
  getTag: (token: Token) => string;
11
11
  getEditionTierName: (k: string) => string;
12
12
  };
@@ -1,15 +1,17 @@
1
- import { EditionTiers } from "../configs/types/EditionTiers";
1
+ import { EditionTiers } from '../configs/types/EditionTiers';
2
2
  const getTag = (token) => {
3
3
  if (token.split)
4
- return token.split.t || "";
5
- return token.t ?? "";
4
+ return token.split.t || '';
5
+ return token.t ?? '';
6
6
  };
7
- const skipToken = (token, splits) => {
7
+ const skipToken = (token, splits, keepEmpty) => {
8
+ if (keepEmpty && token.ec)
9
+ return false;
8
10
  if (token.ec)
9
11
  return true;
10
12
  if (!token.v)
11
13
  return false;
12
- if (!splits && token.v.startsWith("@") && token.split)
14
+ if (!splits && token.v.startsWith('@') && token.split)
13
15
  return true;
14
16
  return false;
15
17
  };
@@ -18,7 +20,7 @@ const getColspan = (thisToken) => {
18
20
  };
19
21
  const getAsText = (struct, displayTags) => {
20
22
  const tokens = sort(struct);
21
- let value = "";
23
+ let value = '';
22
24
  tokens.forEach((token, idx) => {
23
25
  if (!isVisible(token))
24
26
  return;
@@ -28,11 +30,11 @@ const getAsText = (struct, displayTags) => {
28
30
  };
29
31
  const getAsTextWithTags = (struct) => {
30
32
  const tokens = sort(struct);
31
- let value = "";
33
+ let value = '';
32
34
  tokens.forEach((token) => {
33
35
  if (!isVisible(token))
34
36
  return;
35
- let tokenValue = token.split !== undefined ? token.split.v || "" : token.v;
37
+ let tokenValue = token.split !== undefined ? token.split.v || '' : token.v;
36
38
  const tag = getTag(token);
37
39
  if (tag) {
38
40
  tokenValue = `${tokenValue}/${tag}`;
@@ -43,7 +45,7 @@ const getAsTextWithTags = (struct) => {
43
45
  };
44
46
  const getValue = (token, displayTags) => {
45
47
  return token.split !== undefined && token.ec === undefined && !displayTags
46
- ? token.split.v || ""
48
+ ? token.split.v || ''
47
49
  : token.v;
48
50
  };
49
51
  const sort = (struct) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tycho-components",
3
3
  "private": false,
4
- "version": "0.21.13",
4
+ "version": "0.21.15",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "exports": {
@@ -80,7 +80,7 @@
80
80
  "react-i18next": "^13.0.2",
81
81
  "react-router-dom": "^6.14.2",
82
82
  "react-toastify": "^9.1.3",
83
- "tycho-storybook": "0.8.4",
83
+ "tycho-storybook": "0.8.5",
84
84
  "wavesurfer-react": "^2.2.2",
85
85
  "wavesurfer.js": "^6.6.3"
86
86
  },