@nectary/components 5.57.2 → 5.58.0

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/alert/index.js CHANGED
@@ -4,7 +4,7 @@ import "../text/index.js";
4
4
  import { updateAttribute, getLiteralAttribute, updateLiteralAttribute, getAttribute } from "../utils/dom.js";
5
5
  import { defineCustomElement, NectaryElement } from "../utils/element.js";
6
6
  import { typeValues } from "./utils.js";
7
- const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-alert-color-info-default-background)}#icon-error,#icon-info,#icon-warn{display:none}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-alert-color-info-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=warn]) #icon-warn{display:block}#text{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;--sinch-comp-rich-text-font:var(--sinch-comp-alert-font-body)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-info-default-text)}</style><div id="wrapper"><sinch-icon icons-version="2" name="circle-info" id="icon-info"></sinch-icon><sinch-icon icons-version="2" name="triangle-exclamation" id="icon-warn"></sinch-icon><sinch-icon icons-version="2" name="octagon-exclamation" id="icon-error"></sinch-icon><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
7
+ const templateHTML = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-alert-color-info-default-background)}:host([type=success]) #wrapper{background-color:var(--sinch-comp-alert-color-success-default-background)}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-alert-color-info-default-icon)}#icon-success{--sinch-global-color-icon:var(--sinch-comp-alert-color-success-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=success]) #icon-success,:host([type=warn]) #icon-warn{display:block}#text{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;--sinch-comp-rich-text-font:var(--sinch-comp-alert-font-body)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-info-default-text)}:host([type=success]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-success-default-text)}</style><div id="wrapper"><sinch-icon icons-version="2" name="circle-info" id="icon-info"></sinch-icon><sinch-icon icons-version="2" name="triangle-exclamation" id="icon-warn"></sinch-icon><sinch-icon icons-version="2" name="octagon-exclamation" id="icon-error"></sinch-icon><sinch-icon icons-version="2" name="circle-check" id="icon-success"></sinch-icon><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
8
8
  const template = document.createElement("template");
9
9
  template.innerHTML = templateHTML;
10
10
  class Alert extends NectaryElement {
package/alert/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { NectaryComponentReactByType, NectaryComponentVanillaByType, NectaryComponentReact, NectaryComponentVanilla } from '../types';
2
- export type TSinchAlertType = 'info' | 'warn' | 'error';
2
+ export type TSinchAlertType = 'info' | 'success' | 'warn' | 'error';
3
3
  export type TSinchAlertProps = {
4
4
  /** Type */
5
5
  type: TSinchAlertType;
@@ -16,6 +16,9 @@ export type TSinchAlertStyle = {
16
16
  '--sinch-comp-alert-color-info-default-background'?: string;
17
17
  '--sinch-comp-alert-color-info-default-icon'?: string;
18
18
  '--sinch-comp-alert-color-info-default-text'?: string;
19
+ '--sinch-comp-alert-color-success-default-background'?: string;
20
+ '--sinch-comp-alert-color-success-default-icon'?: string;
21
+ '--sinch-comp-alert-color-success-default-text'?: string;
19
22
  '--sinch-comp-alert-font-body'?: string;
20
23
  '--sinch-global-color-icon'?: string;
21
24
  '--sinch-global-color-text'?: string;
package/alert/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- const typeValues = ["info", "warn", "error"];
1
+ const typeValues = ["info", "success", "warn", "error"];
2
2
  export {
3
3
  typeValues
4
4
  };
package/bundle.js CHANGED
@@ -1667,7 +1667,7 @@ const regLink = new RegExp("(?<!\\\\)!?\\[(?<linktext>[^\\]]*?)\\]\\((?<linkhref
1667
1667
  const regChip = new RegExp("(?<!\\\\)\\{\\{(?<chip>[a-zA-Z0-9_-]+)\\}\\}");
1668
1668
  const regEmojiSeq = "(?![0-9#*])\\p{Emoji}(?:\\uFE0F|\\p{Emoji_Modifier})?\\u20E3?";
1669
1669
  const regEmoji = new RegExp(`(?<emoji>\\p{RI}\\p{RI}|${regEmojiSeq}(?:\\u200D${regEmojiSeq})*)`, "u");
1670
- const regUList = /^(?<indent>[\t ]*?)[*+-][\t ]+(?<ultext>.*?)[\t ]*?$/;
1670
+ const regUList = /^(?<indent>[\t ]*?)\*[\t ]+(?<ultext>.*?)[\t ]*?$/;
1671
1671
  const regOList = /^(?<indent>[\t ]*?)\d+\.[\t ]+(?<oltext>.*?)[\t ]*?$/;
1672
1672
  const regEscapedChars = /\\(?<escaped>[\\\*_\[\]`~\{\}])/;
1673
1673
  const buildEscapedCharsReg = (extraChars) => {
@@ -1791,6 +1791,10 @@ const createBlockParser = (visitor, chipReg, escapeReg = regEscapedChars) => {
1791
1791
  const getListItemText = (match) => {
1792
1792
  return match.groups.ultext ?? match.groups.oltext;
1793
1793
  };
1794
+ const leadingIndentLength = (line) => {
1795
+ const match = /^[\t ]*/.exec(line);
1796
+ return match === null ? 0 : match[0].length;
1797
+ };
1794
1798
  const BLOCK_MODE_PARAGRAPH = 1;
1795
1799
  const BLOCK_MODE_ULIST = 2;
1796
1800
  const BLOCK_MODE_OLIST = 2;
@@ -1808,13 +1812,17 @@ const createBlockParser = (visitor, chipReg, escapeReg = regEscapedChars) => {
1808
1812
  let listItemLines = [getListItemText(listMatch.match)];
1809
1813
  visitor.listItem();
1810
1814
  for (++i; i < lines.length; ++i) {
1811
- const listItemMatch = isOrderedList ? regOList.exec(lines[i]) : regUList.exec(lines[i]);
1815
+ const line = lines[i];
1816
+ const listItemMatch = isOrderedList ? regOList.exec(line) : regUList.exec(line);
1812
1817
  if (listItemMatch !== null && listItemMatch.groups.indent === listItemInitialIndent) {
1813
1818
  parseBlock(listItemLines);
1814
1819
  listItemLines = [getListItemText(listItemMatch)];
1815
1820
  visitor.listItem();
1821
+ } else if (leadingIndentLength(line) > listItemInitialIndent.length) {
1822
+ listItemLines.push(line);
1816
1823
  } else {
1817
- listItemLines.push(lines[i]);
1824
+ i -= 1;
1825
+ break;
1818
1826
  }
1819
1827
  }
1820
1828
  parseBlock(listItemLines);
@@ -2164,8 +2172,8 @@ class RichText extends NectaryElement {
2164
2172
  };
2165
2173
  }
2166
2174
  defineCustomElement("sinch-rich-text", RichText);
2167
- const typeValues$5 = ["info", "warn", "error"];
2168
- const templateHTML$19 = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-alert-color-info-default-background)}#icon-error,#icon-info,#icon-warn{display:none}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-alert-color-info-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=warn]) #icon-warn{display:block}#text{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;--sinch-comp-rich-text-font:var(--sinch-comp-alert-font-body)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-info-default-text)}</style><div id="wrapper"><sinch-icon icons-version="2" name="circle-info" id="icon-info"></sinch-icon><sinch-icon icons-version="2" name="triangle-exclamation" id="icon-warn"></sinch-icon><sinch-icon icons-version="2" name="octagon-exclamation" id="icon-error"></sinch-icon><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
2175
+ const typeValues$5 = ["info", "success", "warn", "error"];
2176
+ const templateHTML$19 = '<style>:host{display:block}#wrapper{display:flex;flex-direction:row;gap:8px;align-items:center;padding:8px 16px;box-sizing:border-box;width:100%;min-height:48px}:host([type=warn]) #wrapper{background-color:var(--sinch-comp-alert-color-warning-default-background)}:host([type=error]) #wrapper{background-color:var(--sinch-comp-alert-color-error-default-background)}:host([type=info]) #wrapper{background-color:var(--sinch-comp-alert-color-info-default-background)}:host([type=success]) #wrapper{background-color:var(--sinch-comp-alert-color-success-default-background)}#icon-error,#icon-info,#icon-success,#icon-warn{display:none}#icon-warn{--sinch-global-color-icon:var(--sinch-comp-alert-color-warning-default-icon)}#icon-error{--sinch-global-color-icon:var(--sinch-comp-alert-color-error-default-icon)}#icon-info{--sinch-global-color-icon:var(--sinch-comp-alert-color-info-default-icon)}#icon-success{--sinch-global-color-icon:var(--sinch-comp-alert-color-success-default-icon)}:host([type=error]) #icon-error,:host([type=info]) #icon-info,:host([type=success]) #icon-success,:host([type=warn]) #icon-warn{display:block}#text{display:flex;flex-direction:column;gap:8px;flex:1;min-width:0;--sinch-comp-rich-text-font:var(--sinch-comp-alert-font-body)}:host([type=warn]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-warning-default-text)}:host([type=error]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-error-default-text)}:host([type=info]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-info-default-text)}:host([type=success]) #text{--sinch-global-color-text:var(--sinch-comp-alert-color-success-default-text)}</style><div id="wrapper"><sinch-icon icons-version="2" name="circle-info" id="icon-info"></sinch-icon><sinch-icon icons-version="2" name="triangle-exclamation" id="icon-warn"></sinch-icon><sinch-icon icons-version="2" name="octagon-exclamation" id="icon-error"></sinch-icon><sinch-icon icons-version="2" name="circle-check" id="icon-success"></sinch-icon><sinch-rich-text id="text"></sinch-rich-text><slot name="action"></slot><slot name="close"></slot></div>';
2169
2177
  const template$19 = document.createElement("template");
2170
2178
  template$19.innerHTML = templateHTML$19;
2171
2179
  class Alert extends NectaryElement {
@@ -8932,6 +8940,7 @@ class FieldV2 extends NectaryElement {
8932
8940
  #$tooltipWrapper;
8933
8941
  #$tooltipSlot;
8934
8942
  #controller = null;
8943
+ #writtenAriaLabel = null;
8935
8944
  constructor() {
8936
8945
  super();
8937
8946
  const shadowRoot = this.attachShadow();
@@ -9109,14 +9118,22 @@ class FieldV2 extends NectaryElement {
9109
9118
  }
9110
9119
  #syncInputAriaLabel(labelText) {
9111
9120
  const inputElement = getFirstSlotElement(this.#$inputSlot);
9121
+ const name = labelText ?? "";
9112
9122
  if (inputElement === null) {
9123
+ if (name.trim().length === 0) {
9124
+ this.#writtenAriaLabel = null;
9125
+ }
9113
9126
  return;
9114
9127
  }
9115
- if (labelText != null && labelText.length > 0) {
9116
- inputElement.setAttribute("aria-label", labelText);
9117
- } else {
9128
+ if (name.trim().length > 0) {
9129
+ inputElement.setAttribute("aria-label", name);
9130
+ this.#writtenAriaLabel = name;
9131
+ return;
9132
+ }
9133
+ if (this.#writtenAriaLabel !== null && inputElement.getAttribute("aria-label") === this.#writtenAriaLabel) {
9118
9134
  inputElement.removeAttribute("aria-label");
9119
9135
  }
9136
+ this.#writtenAriaLabel = null;
9120
9137
  }
9121
9138
  #syncInputDescription() {
9122
9139
  const inputElement = getFirstSlotElement(this.#$inputSlot);
@@ -14843,10 +14860,11 @@ const createParseVisitor = (doc) => {
14843
14860
  $currentBlock.appendChild($inline);
14844
14861
  },
14845
14862
  linebreak() {
14846
- if (listsStack.length === 0) {
14847
- $currentBlock = createActuallyEmptyParagraph(doc);
14848
- $root.appendChild($currentBlock);
14863
+ if (listsStack.length > 0 && isListItem($currentBlock)) {
14864
+ return;
14849
14865
  }
14866
+ $currentBlock = createActuallyEmptyParagraph(doc);
14867
+ $root.appendChild($currentBlock);
14850
14868
  },
14851
14869
  link(text, href, _attributes, isCode) {
14852
14870
  const $link = createLink(text, href, doc);
@@ -14857,15 +14875,16 @@ const createParseVisitor = (doc) => {
14857
14875
  },
14858
14876
  list(isOrdered) {
14859
14877
  listsStack.push({
14860
- isOrdered
14878
+ isOrdered,
14879
+ $parentBlock: $currentBlock
14861
14880
  });
14862
14881
  isFirstListItem = true;
14863
14882
  $currentBlock = null;
14864
14883
  },
14865
14884
  endList() {
14866
- listsStack.length = listsStack.length - 1;
14885
+ const ended = listsStack.pop();
14867
14886
  isFirstListItem = false;
14868
- $currentBlock = null;
14887
+ $currentBlock = ended !== void 0 && isListItem(ended.$parentBlock) ? ended.$parentBlock : null;
14869
14888
  },
14870
14889
  listItem() {
14871
14890
  const listLevel = listsStack.length - 1;
@@ -14879,12 +14898,13 @@ const createParseVisitor = (doc) => {
14879
14898
  $currentBlock = $li;
14880
14899
  },
14881
14900
  paragraph() {
14882
- if (listsStack.length === 0) {
14883
- const $p = createActuallyEmptyParagraph(doc);
14884
- markParagraphAsBlock($p);
14885
- $currentBlock = $p;
14886
- $root.appendChild($p);
14901
+ if (listsStack.length > 0 && $currentBlock !== null) {
14902
+ return;
14887
14903
  }
14904
+ const $p = createActuallyEmptyParagraph(doc);
14905
+ markParagraphAsBlock($p);
14906
+ $currentBlock = $p;
14907
+ $root.appendChild($p);
14888
14908
  },
14889
14909
  end() {
14890
14910
  const children = $root.childNodes;
package/field-v2/index.js CHANGED
@@ -54,6 +54,7 @@ class FieldV2 extends NectaryElement {
54
54
  #$tooltipWrapper;
55
55
  #$tooltipSlot;
56
56
  #controller = null;
57
+ #writtenAriaLabel = null;
57
58
  constructor() {
58
59
  super();
59
60
  const shadowRoot = this.attachShadow();
@@ -231,14 +232,22 @@ class FieldV2 extends NectaryElement {
231
232
  }
232
233
  #syncInputAriaLabel(labelText) {
233
234
  const inputElement = getFirstSlotElement(this.#$inputSlot);
235
+ const name = labelText ?? "";
234
236
  if (inputElement === null) {
237
+ if (name.trim().length === 0) {
238
+ this.#writtenAriaLabel = null;
239
+ }
235
240
  return;
236
241
  }
237
- if (labelText != null && labelText.length > 0) {
238
- inputElement.setAttribute("aria-label", labelText);
239
- } else {
242
+ if (name.trim().length > 0) {
243
+ inputElement.setAttribute("aria-label", name);
244
+ this.#writtenAriaLabel = name;
245
+ return;
246
+ }
247
+ if (this.#writtenAriaLabel !== null && inputElement.getAttribute("aria-label") === this.#writtenAriaLabel) {
240
248
  inputElement.removeAttribute("aria-label");
241
249
  }
250
+ this.#writtenAriaLabel = null;
242
251
  }
243
252
  #syncInputDescription() {
244
253
  const inputElement = getFirstSlotElement(this.#$inputSlot);
package/input/types.d.ts CHANGED
@@ -12,8 +12,8 @@ export type TSinchInputProps = {
12
12
  value?: string;
13
13
  /** Mask */
14
14
  mask?: string | null;
15
- /** Label that is used for a11y – might be different from `label` */
16
- 'aria-label': string;
15
+ /** Accessible name. May be omitted when a parent field `label` supplies the name. */
16
+ 'aria-label'?: string;
17
17
  /** Accessible description. Exposed on the native input through a description in this shadow root. */
18
18
  'aria-description'?: string;
19
19
  /** Text field type, `text` by default */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.57.2",
3
+ "version": "5.58.0",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.22.15",
27
- "@nectary/assets": "3.7.0"
27
+ "@nectary/assets": "3.7.1"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/cli": "^7.22.15",
@@ -41,6 +41,6 @@
41
41
  "vite": "^7.0.6"
42
42
  },
43
43
  "peerDependencies": {
44
- "@nectary/theme-base": "1.19.0"
44
+ "@nectary/theme-base": "1.20.0"
45
45
  }
46
46
  }
@@ -1833,10 +1833,11 @@ const createParseVisitor = (doc) => {
1833
1833
  $currentBlock.appendChild($inline);
1834
1834
  },
1835
1835
  linebreak() {
1836
- if (listsStack.length === 0) {
1837
- $currentBlock = createActuallyEmptyParagraph(doc);
1838
- $root.appendChild($currentBlock);
1836
+ if (listsStack.length > 0 && isListItem($currentBlock)) {
1837
+ return;
1839
1838
  }
1839
+ $currentBlock = createActuallyEmptyParagraph(doc);
1840
+ $root.appendChild($currentBlock);
1840
1841
  },
1841
1842
  link(text, href, _attributes, isCode) {
1842
1843
  const $link = createLink(text, href, doc);
@@ -1847,15 +1848,16 @@ const createParseVisitor = (doc) => {
1847
1848
  },
1848
1849
  list(isOrdered) {
1849
1850
  listsStack.push({
1850
- isOrdered
1851
+ isOrdered,
1852
+ $parentBlock: $currentBlock
1851
1853
  });
1852
1854
  isFirstListItem = true;
1853
1855
  $currentBlock = null;
1854
1856
  },
1855
1857
  endList() {
1856
- listsStack.length = listsStack.length - 1;
1858
+ const ended = listsStack.pop();
1857
1859
  isFirstListItem = false;
1858
- $currentBlock = null;
1860
+ $currentBlock = ended !== void 0 && isListItem(ended.$parentBlock) ? ended.$parentBlock : null;
1859
1861
  },
1860
1862
  listItem() {
1861
1863
  const listLevel = listsStack.length - 1;
@@ -1869,12 +1871,13 @@ const createParseVisitor = (doc) => {
1869
1871
  $currentBlock = $li;
1870
1872
  },
1871
1873
  paragraph() {
1872
- if (listsStack.length === 0) {
1873
- const $p = createActuallyEmptyParagraph(doc);
1874
- markParagraphAsBlock($p);
1875
- $currentBlock = $p;
1876
- $root.appendChild($p);
1874
+ if (listsStack.length > 0 && $currentBlock !== null) {
1875
+ return;
1877
1876
  }
1877
+ const $p = createActuallyEmptyParagraph(doc);
1878
+ markParagraphAsBlock($p);
1879
+ $currentBlock = $p;
1880
+ $root.appendChild($p);
1878
1881
  },
1879
1882
  end() {
1880
1883
  const children = $root.childNodes;
package/utils/markdown.js CHANGED
@@ -13,7 +13,7 @@ const regLink = new RegExp("(?<!\\\\)!?\\[(?<linktext>[^\\]]*?)\\]\\((?<linkhref
13
13
  const regChip = new RegExp("(?<!\\\\)\\{\\{(?<chip>[a-zA-Z0-9_-]+)\\}\\}");
14
14
  const regEmojiSeq = "(?![0-9#*])\\p{Emoji}(?:\\uFE0F|\\p{Emoji_Modifier})?\\u20E3?";
15
15
  const regEmoji = new RegExp(`(?<emoji>\\p{RI}\\p{RI}|${regEmojiSeq}(?:\\u200D${regEmojiSeq})*)`, "u");
16
- const regUList = /^(?<indent>[\t ]*?)[*+-][\t ]+(?<ultext>.*?)[\t ]*?$/;
16
+ const regUList = /^(?<indent>[\t ]*?)\*[\t ]+(?<ultext>.*?)[\t ]*?$/;
17
17
  const regOList = /^(?<indent>[\t ]*?)\d+\.[\t ]+(?<oltext>.*?)[\t ]*?$/;
18
18
  const regEscapedChars = /\\(?<escaped>[\\\*_\[\]`~\{\}])/;
19
19
  const buildEscapedCharsReg = (extraChars) => {
@@ -137,6 +137,10 @@ const createBlockParser = (visitor, chipReg, escapeReg = regEscapedChars) => {
137
137
  const getListItemText = (match) => {
138
138
  return match.groups.ultext ?? match.groups.oltext;
139
139
  };
140
+ const leadingIndentLength = (line) => {
141
+ const match = /^[\t ]*/.exec(line);
142
+ return match === null ? 0 : match[0].length;
143
+ };
140
144
  const BLOCK_MODE_PARAGRAPH = 1;
141
145
  const BLOCK_MODE_ULIST = 2;
142
146
  const BLOCK_MODE_OLIST = 2;
@@ -154,13 +158,17 @@ const createBlockParser = (visitor, chipReg, escapeReg = regEscapedChars) => {
154
158
  let listItemLines = [getListItemText(listMatch.match)];
155
159
  visitor.listItem();
156
160
  for (++i; i < lines.length; ++i) {
157
- const listItemMatch = isOrderedList ? regOList.exec(lines[i]) : regUList.exec(lines[i]);
161
+ const line = lines[i];
162
+ const listItemMatch = isOrderedList ? regOList.exec(line) : regUList.exec(line);
158
163
  if (listItemMatch !== null && listItemMatch.groups.indent === listItemInitialIndent) {
159
164
  parseBlock(listItemLines);
160
165
  listItemLines = [getListItemText(listItemMatch)];
161
166
  visitor.listItem();
167
+ } else if (leadingIndentLength(line) > listItemInitialIndent.length) {
168
+ listItemLines.push(line);
162
169
  } else {
163
- listItemLines.push(lines[i]);
170
+ i -= 1;
171
+ break;
164
172
  }
165
173
  }
166
174
  parseBlock(listItemLines);