@nectary/components 4.7.3 → 4.7.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.
package/input/types.d.ts CHANGED
@@ -15,7 +15,7 @@ export type TSinchInputElement = HTMLElement & {
15
15
  /** Text that appears in the text field when it has no value set */
16
16
  placeholder: string | null;
17
17
  /** The HTML autocomplete attribute */
18
- autocomplete: string;
18
+ autocomplete: HTMLInputElement['autocomplete'];
19
19
  /** Invalid state */
20
20
  invalid: boolean;
21
21
  /** Disabled */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "4.7.3",
3
+ "version": "4.7.5",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -12,6 +12,15 @@ export const createParseVisitor = doc => {
12
12
  let $li = null;
13
13
  const $lists = [];
14
14
  return {
15
+ escaped(char) {
16
+ const $text = doc.createTextNode(char);
17
+ if ($p != null) {
18
+ $p.appendChild($text);
19
+ } else {
20
+ this.paragraph();
21
+ $p.appendChild($text);
22
+ }
23
+ },
15
24
  emoji(emojiChar) {
16
25
  const $emoji = doc.createElement('sinch-emoji');
17
26
  setEmojiBaseUrl($emoji, emojiBaseUrl);
@@ -1636,6 +1636,15 @@ export const createParseVisitor = doc => {
1636
1636
  const listsStack = [];
1637
1637
  let isFirstListItem = false;
1638
1638
  return {
1639
+ escaped(char) {
1640
+ const $text = doc.createTextNode(char);
1641
+ if ($currentBlock != null) {
1642
+ $currentBlock.appendChild($text);
1643
+ } else {
1644
+ this.paragraph();
1645
+ $currentBlock.appendChild($text);
1646
+ }
1647
+ },
1639
1648
  emoji(emojiChar) {
1640
1649
  const $emoji = createEmoji(emojiChar, emojiBaseUrl, doc);
1641
1650
  $currentBlock.appendChild($emoji);
@@ -54,7 +54,7 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
54
54
  this.#controller = null;
55
55
  }
56
56
  static get observedAttributes() {
57
- return ['value', 'rows', 'multiple', 'search-value', 'search-placeholder'];
57
+ return ['value', 'rows', 'multiple', 'search-value', 'search-placeholder', 'search-autocomplete'];
58
58
  }
59
59
  attributeChangedCallback(name, oldVal, newVal) {
60
60
  switch (name) {
@@ -64,6 +64,11 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
64
64
  updateExplicitBooleanAttribute(this, 'aria-multiselectable', isAttrTrue(newVal));
65
65
  break;
66
66
  }
67
+ case 'search-autocomplete':
68
+ {
69
+ updateAttribute(this.#$search, 'autocomplete', newVal);
70
+ break;
71
+ }
67
72
  case 'value':
68
73
  {
69
74
  this.#onValueChange(newVal ?? '');
@@ -119,6 +124,12 @@ defineCustomElement('sinch-select-menu', class extends NectaryElement {
119
124
  const searchableAttribute = this.getAttribute('searchable');
120
125
  return searchableAttribute === null ? searchableAttribute : isAttrTrue(searchableAttribute);
121
126
  }
127
+ set 'search-autocomplete'(autocomplete) {
128
+ updateAttribute(this.#$search, 'autocomplete', autocomplete);
129
+ }
130
+ get 'search-autocomplete'() {
131
+ return getAttribute(this.#$search, 'autocomplete', '');
132
+ }
122
133
  set 'search-placeholder'(placeholder) {
123
134
  updateAttribute(this.#$search, 'placeholder', placeholder);
124
135
  }
@@ -8,6 +8,8 @@ export type TSinchSelectMenuElement = HTMLElement & {
8
8
  multiple: boolean;
9
9
  /** Enforce the search bar appearing, by default it appears above a certain number of options */
10
10
  searchable: boolean | null;
11
+ /** Controls the autocomplete of the search input */
12
+ 'search-autocomplete': HTMLInputElement['autocomplete'];
11
13
  /** Text for search bar's placeholder */
12
14
  'search-placeholder': string;
13
15
  /** Optionally control search value manually */
@@ -32,6 +34,8 @@ export type TSinchSelectMenuReact = TSinchElementReact<TSinchSelectMenuElement>
32
34
  multiple?: boolean;
33
35
  /** Enforce the search bar appearing, by default it appears above a certain number of options */
34
36
  searchable?: boolean | null;
37
+ /** Controls the autocomplete of the search input */
38
+ 'search-autocomplete'?: HTMLInputElement['autocomplete'];
35
39
  /** Text for search bar's placeholder */
36
40
  'search-placeholder'?: string;
37
41
  /** Label that is used for a11y */
@@ -4,6 +4,7 @@ export type TMarkdownInlineParams = {
4
4
  isStrikethrough?: boolean;
5
5
  };
6
6
  export type TMarkdownParseVisitor = {
7
+ escaped(char: string): void;
7
8
  link(text: string, href: string, attributes?: string[]): void;
8
9
  emoji(emojiChar: string): void;
9
10
  codetag(text: string): void;
package/utils/markdown.js CHANGED
@@ -1,18 +1,19 @@
1
1
  const regLinebreak = /(?:<br>\n|<br>|\n)/;
2
2
  const regParagraph = /\n{2,}/;
3
- const regEm3Star = /\*\*\*(?<em3>.+?)\*\*\*/;
4
- const regEm2Star = /\*\*(?<em2>.+?)\*\*/;
5
- const regEm1Star = /\*(?<em1>.+?)\*/;
6
- const regEm3Underscore = /___(?<em3>.+?)___/;
7
- const regEm2Underscore = /__(?<em2>.+?)__/;
8
- const regEm1Underscore = /_(?<em1>.+?)_/;
9
- const regCodeTag = /`(?<code>.+?)`/;
10
- const regStrikethrough = /~~(?<strike>.+?)~~/;
11
- const regLink = /!?\[(?<linktext>[^\]]*?)\]\((?<linkhref>[^)]+?)\)(\{(?<linkattrs>[^)]+?)\})?/;
3
+ const regEm3Star = /(?<!\\)\*\*\*(?<em3>.+?)(?<!\\)\*\*\*/;
4
+ const regEm2Star = /(?<!\\)\*\*(?<em2>.+?)(?<!\\)\*\*/;
5
+ const regEm1Star = /(?<!\\)\*(?<em1>.+?)(?<!\\)\*/;
6
+ const regEm3Underscore = /(?<!\\)___(?<em3>.+?)(?<!\\)___/;
7
+ const regEm2Underscore = /(?<!\\)__(?<em2>.+?)(?<!\\)__/;
8
+ const regEm1Underscore = /(?<!\\)_(?<em1>.+?)(?<!\\)_/;
9
+ const regCodeTag = /(?<!\\)`(?<code>.+?)(?<!\\)`/;
10
+ const regStrikethrough = /(?<!\\)~~(?<strike>.+?)(?<!\\)~~/;
11
+ const regLink = /(?<!\\)!?\[(?<linktext>[^\]]*?)\]\((?<linkhref>[^)]+?)\)(\{(?<linkattrs>[^)]+?)\})?/;
12
12
  const regEmoji = /(?<emoji>(?![0-9*#])\p{Emoji})/u;
13
13
  const regUList = /^(?<indent>[\t ]*?)[*+-][\t ]+(?<ultext>.*?)[\t ]*?$/;
14
14
  const regOList = /^(?<indent>[\t ]*?)\d+\.[\t ]+(?<oltext>.*?)[\t ]*?$/;
15
- const allRegs = [regCodeTag, regLink, regEm3Star, regEm2Star, regEm1Star, regEm3Underscore, regEm2Underscore, regEm1Underscore, regStrikethrough, regEmoji];
15
+ const regEscapedChars = /\\(?<escaped>[\\\*_\[\]`~])/;
16
+ const allRegs = [regEscapedChars, regCodeTag, regLink, regEm3Star, regEm2Star, regEm1Star, regEm3Underscore, regEm2Underscore, regEm1Underscore, regStrikethrough, regEmoji];
16
17
  export const isEmojiString = data => regEmoji.test(data);
17
18
  const excludeRegs = function (regs) {
18
19
  for (var _len = arguments.length, excluding = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
@@ -47,6 +48,10 @@ const createLineParser = visitor => function parseLine(regs, md) {
47
48
  visitor.inline(line.substring(0, match.index), context);
48
49
  }
49
50
  line = line.substring(match.index + matchedStr.length);
51
+ if (groups?.escaped != null) {
52
+ visitor.escaped(groups.escaped);
53
+ continue;
54
+ }
50
55
  if (groups?.linkhref != null) {
51
56
  visitor.link(groups.linktext, groups.linkhref, groups.linkattrs?.split(' '));
52
57
  }