@ohhwells/bridge 0.1.147 → 0.1.148

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/dist/index.cjs CHANGED
@@ -1571,7 +1571,19 @@ function brandTrackedFontFamily(doc, stack) {
1571
1571
  }
1572
1572
  var paintLockByEl = /* @__PURE__ */ new WeakMap();
1573
1573
  var paintObserverByEl = /* @__PURE__ */ new WeakMap();
1574
- var paintingButton = false;
1574
+ var PAINT_GUARD_ATTRS = {
1575
+ attributes: true,
1576
+ attributeFilter: ["style", "class"]
1577
+ };
1578
+ function paintGuarded(el, assignment, tokens) {
1579
+ const observer = paintObserverByEl.get(el);
1580
+ observer?.disconnect();
1581
+ try {
1582
+ paintButtonChrome(el, assignment, tokens);
1583
+ } finally {
1584
+ observer?.observe(el, PAINT_GUARD_ATTRS);
1585
+ }
1586
+ }
1575
1587
  function paintButtonChrome(el, assignment, tokens) {
1576
1588
  const origin = captureButtonOrigin(el);
1577
1589
  const chrome = tokens.variants[assignment.variant];
@@ -1610,14 +1622,11 @@ function paintButtonChrome(el, assignment, tokens) {
1610
1622
  function guardTemplateHover(el) {
1611
1623
  if (paintObserverByEl.has(el)) return;
1612
1624
  const observer = new MutationObserver(() => {
1613
- if (paintingButton) return;
1614
1625
  const lock = paintLockByEl.get(el);
1615
1626
  if (!lock) return;
1616
- paintingButton = true;
1617
- paintButtonChrome(el, lock.assignment, lock.tokens);
1618
- paintingButton = false;
1627
+ paintGuarded(el, lock.assignment, lock.tokens);
1619
1628
  });
1620
- observer.observe(el, { attributes: true, attributeFilter: ["style", "class"] });
1629
+ observer.observe(el, PAINT_GUARD_ATTRS);
1621
1630
  paintObserverByEl.set(el, observer);
1622
1631
  }
1623
1632
  function paintedTokensOf(el) {
@@ -1634,10 +1643,8 @@ function applyButtonStyle(el, assignment, tokens) {
1634
1643
  }
1635
1644
  };
1636
1645
  paintLockByEl.set(el, { assignment, tokens: tracked });
1637
- paintingButton = true;
1638
- paintButtonChrome(el, assignment, tracked);
1639
- paintingButton = false;
1640
1646
  guardTemplateHover(el);
1647
+ paintGuarded(el, assignment, tracked);
1641
1648
  }
1642
1649
  function applyButtonStylesFromContent(doc, content) {
1643
1650
  const assignments = readAssignments(content);
@@ -31650,7 +31657,7 @@ function OhhwellsBridge() {
31650
31657
  postToParent2({
31651
31658
  type: "ow:ready",
31652
31659
  version: "1",
31653
- bridgeVersion: "0.1.146",
31660
+ bridgeVersion: "0.1.147",
31654
31661
  path: pathname,
31655
31662
  nodes: collectEditableNodes(editContentRef.current),
31656
31663
  sections