@zubra/runtime 5.10.0 → 5.10.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.
@@ -1639,6 +1639,7 @@ function defineElement(tag, definition) {
1639
1639
  #signals = {};
1640
1640
  #given = new Set(); // props set from outside (property, attribute, or before upgrade)
1641
1641
  #scope = null;
1642
+ #starting = null; // the wait for remark.js, while the element hasn't rendered yet
1642
1643
  #hooks = null;
1643
1644
  #cleanups = [];
1644
1645
  #internals = null; // form-associated only
@@ -1700,7 +1701,10 @@ function defineElement(tag, definition) {
1700
1701
  if (this.#scope) this.#scope.resume();
1701
1702
  else if (!remarker && lostComments(shadow ? this.shadowRoot : this, componentTemplate.content)) {
1702
1703
  // Server markup without its comments: start once the code that puts them back is here.
1703
- loadRemark().then(() => { if (this.isConnected && !this.#scope) this.connectedCallback(); });
1704
+ this.#starting ??= loadRemark().then(() => {
1705
+ this.#starting = null;
1706
+ if (this.isConnected && !this.#scope) this.connectedCallback();
1707
+ });
1704
1708
  return;
1705
1709
  } else {
1706
1710
  if (lowercased.length) checkAttributeCase(this);
@@ -1737,9 +1741,12 @@ function defineElement(tag, definition) {
1737
1741
  return this.dispatchEvent(event);
1738
1742
  }
1739
1743
 
1740
- /** Resolves once pending prop changes have reached the DOM. */
1744
+ /**
1745
+ * Resolves once pending prop changes have reached the DOM: after the first render too, when
1746
+ * that's waiting for remark.js (content that might be stripped server markup).
1747
+ */
1741
1748
  get updateComplete() {
1742
- return tick();
1749
+ return this.#starting ? this.#starting.then(tick) : tick();
1743
1750
  }
1744
1751
 
1745
1752
  // Form-associated lifecycle (only called by the browser when `formAssociated` is true).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zubra/runtime",
3
- "version": "5.10.0",
3
+ "version": "5.10.1",
4
4
  "description": "Browser runtime for Zubra compiled components, built on the TC39 Signals API",
5
5
  "license": "ISC",
6
6
  "repository": {
package/src/element.js CHANGED
@@ -1700,6 +1700,7 @@ function defineElement(tag, definition) {
1700
1700
  #signals = {};
1701
1701
  #given = new Set(); // props set from outside (property, attribute, or before upgrade)
1702
1702
  #scope = null;
1703
+ #starting = null; // the wait for remark.js, while the element hasn't rendered yet
1703
1704
  #hooks = null;
1704
1705
  #cleanups = [];
1705
1706
  #internals = null; // form-associated only
@@ -1761,7 +1762,10 @@ function defineElement(tag, definition) {
1761
1762
  if (this.#scope) this.#scope.resume();
1762
1763
  else if (!remarker && lostComments(shadow ? this.shadowRoot : this, componentTemplate.content)) {
1763
1764
  // Server markup without its comments: start once the code that puts them back is here.
1764
- loadRemark().then(() => { if (this.isConnected && !this.#scope) this.connectedCallback(); });
1765
+ this.#starting ??= loadRemark().then(() => {
1766
+ this.#starting = null;
1767
+ if (this.isConnected && !this.#scope) this.connectedCallback();
1768
+ });
1765
1769
  return;
1766
1770
  } else {
1767
1771
  if (lowercased.length) checkAttributeCase(this);
@@ -1798,9 +1802,12 @@ function defineElement(tag, definition) {
1798
1802
  return this.dispatchEvent(event);
1799
1803
  }
1800
1804
 
1801
- /** Resolves once pending prop changes have reached the DOM. */
1805
+ /**
1806
+ * Resolves once pending prop changes have reached the DOM: after the first render too, when
1807
+ * that's waiting for remark.js (content that might be stripped server markup).
1808
+ */
1802
1809
  get updateComplete() {
1803
- return tick();
1810
+ return this.#starting ? this.#starting.then(tick) : tick();
1804
1811
  }
1805
1812
 
1806
1813
  // Form-associated lifecycle (only called by the browser when `formAssociated` is true).