@nectary/components 5.31.1 → 5.31.3

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,7 +1,7 @@
1
1
  import "../icon/index.js";
2
2
  import "../text/index.js";
3
3
  import "../title/index.js";
4
- import { isAttrEqual, updateAttribute, updateExplicitBooleanAttribute, isAttrTrue, updateBooleanAttribute, getAttribute, getBooleanAttribute, getLiteralAttribute, updateLiteralAttribute } from "../utils/dom.js";
4
+ import { isAttrEqual, updateBooleanAttribute, isAttrTrue, updateExplicitBooleanAttribute, updateAttribute, getAttribute, getBooleanAttribute, getLiteralAttribute, updateLiteralAttribute } from "../utils/dom.js";
5
5
  import { defineCustomElement, NectaryElement } from "../utils/element.js";
6
6
  import { statusValues } from "./utils.js";
7
7
  const templateHTML = '<style>:host{display:block;outline:0;min-height:48px}#wrapper{display:flex;flex-direction:column;position:relative;width:100%;height:100%;box-sizing:border-box;overflow:hidden;border-bottom:1px solid var(--sinch-comp-accordion-color-default-border-initial)}:host(:last-child)>#wrapper{border-bottom:none}#button{all:initial;display:flex;position:relative;align-items:flex-start;gap:8px;box-sizing:border-box;width:100%;min-height:48px;padding:12px 4px 12px 8px;cursor:pointer;--sinch-global-color-icon:var(--sinch-comp-accordion-color-default-icon-initial);--sinch-global-size-icon:var(--sinch-comp-accordion-size-icon)}#button>*{pointer-events:none}#button:disabled{cursor:initial;--sinch-global-color-icon:var(--sinch-comp-accordion-color-disabled-icon-initial)}#button:focus-visible::after{content:"";position:absolute;inset:0;border:2px solid var(--sinch-comp-accordion-color-default-outline-focus);pointer-events:none}#status-wrapper{display:none;width:18px;height:24px;padding:8px 8px 8px 2px;box-sizing:border-box}#status{width:8px;height:8px;border-radius:50%}:host([status]:not([status=""])) #status-wrapper{display:block}:host([status=success]) #status{background-color:var(--sinch-comp-accordion-color-default-status-success)}:host([status=warn]) #status{background-color:var(--sinch-comp-accordion-color-default-status-warning)}:host([status=error]) #status{background-color:var(--sinch-comp-accordion-color-default-status-error)}:host([status=info]) #status{background-color:var(--sinch-comp-accordion-color-default-status-info)}#title{flex:1;min-width:0;--sinch-comp-title-font:var(--sinch-comp-accordion-font-title);--sinch-global-color-text:var(--sinch-comp-accordion-color-default-title-initial)}#button:disabled>#title{--sinch-global-color-text:var(--sinch-comp-accordion-color-disabled-title-initial)}#content{display:none;overflow-y:auto;flex-shrink:1;min-height:0;padding:0 8px 12px}#dropdown-icon{flex-shrink:0;margin-top:2px;transform:rotate(0);will-change:transform;transition:transform .25s ease-in-out}#button[aria-expanded=true]>#dropdown-icon{transform:rotate(180deg)}#button[aria-expanded=true]+#content{display:block}#optional{flex-shrink:0;--sinch-comp-text-font:var(--sinch-comp-accordion-font-optional-text);--sinch-global-color-text:var(--sinch-comp-accordion-color-default-optional-text-initial)}#button:disabled>#optional{--sinch-global-color-text:var(--sinch-comp-accordion-color-disabled-optional-text-initial)}</style><div id="wrapper"><button id="button" aria-controls="content" aria-expanded="false"><div id="status-wrapper"><div id="status"></div></div><slot name="icon"></slot><sinch-title id="title" level="3" type="m" ellipsis></sinch-title><sinch-text id="optional" type="m"></sinch-text><sinch-icon icons-version="2" name="fa-chevron-down" id="dropdown-icon"></sinch-icon></button><div id="content" role="region" aria-labelledby="button"><slot name="content"></slot></div></div>';
@@ -51,7 +51,7 @@ class AccordionItem extends NectaryElement {
51
51
  break;
52
52
  }
53
53
  case "ellipsis": {
54
- updateAttribute(this.#$title, "ellipsis", newVal);
54
+ updateBooleanAttribute(this.#$title, name, isAttrTrue(newVal));
55
55
  break;
56
56
  }
57
57
  }
package/bundle.js CHANGED
@@ -452,7 +452,7 @@ class AccordionItem extends NectaryElement {
452
452
  break;
453
453
  }
454
454
  case "ellipsis": {
455
- updateAttribute(this.#$title, "ellipsis", newVal);
455
+ updateBooleanAttribute(this.#$title, name, isAttrTrue(newVal));
456
456
  break;
457
457
  }
458
458
  }
@@ -1418,7 +1418,7 @@ class RichTextareaChip extends NectaryElement {
1418
1418
  };
1419
1419
  }
1420
1420
  defineCustomElement("sinch-rich-textarea-chip", RichTextareaChip);
1421
- const regLinebreak = /(?:<br>\n|<br>|\n)/;
1421
+ const regLinebreak = /(?:<br>\n|<br>| {2,}\n|\n)/;
1422
1422
  const regParagraph = /\n{2,}/;
1423
1423
  const regEm3Star = new RegExp("(?<!\\\\)\\*\\*\\*(?<em3>.+?)(?<!\\\\)\\*\\*\\*");
1424
1424
  const regEm2Star = new RegExp("(?<!\\\\)\\*\\*(?<em2>.+?)(?<!\\\\)\\*\\*");
@@ -4059,6 +4059,7 @@ class Tooltip extends NectaryElement {
4059
4059
  this.#schedulePlacement();
4060
4060
  });
4061
4061
  this.#resizeObserver.observe(this.#$content);
4062
+ window.addEventListener("resize", this.#onWindowResize, options);
4062
4063
  updateAttribute(this.#$pop, "orientation", getPopOrientation$1(this.orientation));
4063
4064
  updateBooleanAttribute(this.#$pop, "hide-outside-viewport", !this.showOutsideViewport);
4064
4065
  updateBooleanAttribute(this.#$pop, "disable-focus-restore", true);
@@ -4524,6 +4525,14 @@ class Tooltip extends NectaryElement {
4524
4525
  this.#$pop.style.removeProperty("--sinch-pop-offset-x");
4525
4526
  this.#$pop.style.removeProperty("--sinch-pop-offset-y");
4526
4527
  }
4528
+ #onWindowResize = () => {
4529
+ if (!this.#isOpen()) {
4530
+ return;
4531
+ }
4532
+ requestAnimationFrame(() => {
4533
+ this.#schedulePlacement();
4534
+ });
4535
+ };
4527
4536
  #schedulePlacement(resetZeroDimensionRetries = true) {
4528
4537
  if (!this.#isOpen() || this.#placementScheduled) {
4529
4538
  return;
@@ -11357,7 +11366,6 @@ const MD_EM1_STAR_TOKEN = "*";
11357
11366
  const MD_EM3_UNDERSCORE_TOKEN = "___";
11358
11367
  const MD_EM2_UNDERSCORE_TOKEN = "__";
11359
11368
  const MD_EM1_UNDERSCORE_TOKEN = "_";
11360
- const MD_LINEBREAK_TOKEN = " \n";
11361
11369
  const MD_CODETAG_TOKEN = "`";
11362
11370
  const MD_ULISTITEM_TOKEN = "*";
11363
11371
  const MD_OLISTITEM_TOKEN = "1.";
@@ -11484,11 +11492,7 @@ const serializeRoot = ($root, range) => {
11484
11492
  };
11485
11493
  const flushParagraphChunks = () => {
11486
11494
  if (paragraphChunks.length > 0) {
11487
- chunks.push(
11488
- paragraphChunks.reduce((a, b) => {
11489
- return b.length > 0 ? a.concat(MD_LINEBREAK_TOKEN, b) : a.concat("<br>");
11490
- })
11491
- );
11495
+ chunks.push(...paragraphChunks);
11492
11496
  paragraphChunks.length = 0;
11493
11497
  }
11494
11498
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nectary/components",
3
- "version": "5.31.1",
3
+ "version": "5.31.3",
4
4
  "files": [
5
5
  "**/*/*.css",
6
6
  "**/*/*.json",
@@ -1571,7 +1571,6 @@ const MD_EM1_STAR_TOKEN = "*";
1571
1571
  const MD_EM3_UNDERSCORE_TOKEN = "___";
1572
1572
  const MD_EM2_UNDERSCORE_TOKEN = "__";
1573
1573
  const MD_EM1_UNDERSCORE_TOKEN = "_";
1574
- const MD_LINEBREAK_TOKEN = " \n";
1575
1574
  const MD_CODETAG_TOKEN = "`";
1576
1575
  const MD_ULISTITEM_TOKEN = "*";
1577
1576
  const MD_OLISTITEM_TOKEN = "1.";
@@ -1698,11 +1697,7 @@ const serializeRoot = ($root, range) => {
1698
1697
  };
1699
1698
  const flushParagraphChunks = () => {
1700
1699
  if (paragraphChunks.length > 0) {
1701
- chunks.push(
1702
- paragraphChunks.reduce((a, b) => {
1703
- return b.length > 0 ? a.concat(MD_LINEBREAK_TOKEN, b) : a.concat("<br>");
1704
- })
1705
- );
1700
+ chunks.push(...paragraphChunks);
1706
1701
  paragraphChunks.length = 0;
1707
1702
  }
1708
1703
  };
package/tooltip/index.js CHANGED
@@ -83,6 +83,7 @@ class Tooltip extends NectaryElement {
83
83
  this.#schedulePlacement();
84
84
  });
85
85
  this.#resizeObserver.observe(this.#$content);
86
+ window.addEventListener("resize", this.#onWindowResize, options);
86
87
  updateAttribute(this.#$pop, "orientation", getPopOrientation(this.orientation));
87
88
  updateBooleanAttribute(this.#$pop, "hide-outside-viewport", !this.showOutsideViewport);
88
89
  updateBooleanAttribute(this.#$pop, "disable-focus-restore", true);
@@ -548,6 +549,14 @@ class Tooltip extends NectaryElement {
548
549
  this.#$pop.style.removeProperty("--sinch-pop-offset-x");
549
550
  this.#$pop.style.removeProperty("--sinch-pop-offset-y");
550
551
  }
552
+ #onWindowResize = () => {
553
+ if (!this.#isOpen()) {
554
+ return;
555
+ }
556
+ requestAnimationFrame(() => {
557
+ this.#schedulePlacement();
558
+ });
559
+ };
551
560
  #schedulePlacement(resetZeroDimensionRetries = true) {
552
561
  if (!this.#isOpen() || this.#placementScheduled) {
553
562
  return;
package/utils/markdown.js CHANGED
@@ -1,4 +1,4 @@
1
- const regLinebreak = /(?:<br>\n|<br>|\n)/;
1
+ const regLinebreak = /(?:<br>\n|<br>| {2,}\n|\n)/;
2
2
  const regParagraph = /\n{2,}/;
3
3
  const regEm3Star = new RegExp("(?<!\\\\)\\*\\*\\*(?<em3>.+?)(?<!\\\\)\\*\\*\\*");
4
4
  const regEm2Star = new RegExp("(?<!\\\\)\\*\\*(?<em2>.+?)(?<!\\\\)\\*\\*");