@gemx-dev/clarity-visualize 0.8.70 → 0.8.72

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.
@@ -68,7 +68,6 @@ function reset$8() {
68
68
  }
69
69
  function config$2(classNames) {
70
70
  extraExcludeClassNames = classNames || [];
71
- console.log("[Selector] config called \u2014 extraExcludeClassNames set to: [".concat(extraExcludeClassNames.join(', '), "]"));
72
71
  }
73
72
  function get$1(input, type) {
74
73
  var a = input.attributes;
@@ -94,10 +93,10 @@ function get$1(input, type) {
94
93
  var id = "id" /* Constant.Id */ in a && a["id" /* Constant.Id */].length > 0 ? a["id" /* Constant.Id */] : null;
95
94
  var rawClasses = "class" /* Constant.Class */ in a ? a["class" /* Constant.Class */].trim().split(/\s+/) : [];
96
95
  var filteredClasses = rawClasses.filter(function (c) { return filter(c); });
97
- var removedClasses = rawClasses.filter(function (c) { return !filter(c); });
98
- if (removedClasses.length > 0) {
99
- console.log("[Selector] tag=\"".concat(input.tag, "\" id=\"").concat(input.id, "\" \u2014 removed classes: [").concat(removedClasses.join(', '), "] | kept: [").concat(filteredClasses.join(', '), "] | extraExclude: [").concat(extraExcludeClassNames.join(', '), "]"));
100
- }
96
+ // const removedClasses = rawClasses.filter(c => !filter(c));
97
+ // if (removedClasses.length > 0) {
98
+ // console.log(`[Selector] tag="${input.tag}" id="${input.id}" removed classes: [${removedClasses.join(', ')}] | kept: [${filteredClasses.join(', ')}] | extraExclude: [${extraExcludeClassNames.join(', ')}]`);
99
+ // }
101
100
  var classes = input.tag !== "BODY" /* Constant.BodyTag */ && filteredClasses.length > 0 ? filteredClasses.join("." /* Constant.Period */) : null;
102
101
  if (classes && classes.length > 0) {
103
102
  if (type === 0 /* Selector.Alpha */) {
@@ -1670,6 +1669,35 @@ class LayoutHelper {
1670
1669
  // Reset dialog render state for new render cycle
1671
1670
  resetDialogRenderState();
1672
1671
  };
1672
+ /** Rebuild internal node/hash maps from a pre-rendered document (used for HTML cache restore). */
1673
+ this.hydrate = (doc) => {
1674
+ this.nodes = {};
1675
+ this.hashMapAlpha = {};
1676
+ this.hashMapBeta = {};
1677
+ // querySelectorAll does not include documentElement itself
1678
+ const htmlEl = doc.documentElement;
1679
+ if (htmlEl === null || htmlEl === void 0 ? void 0 : htmlEl.hasAttribute("data-clarity-id" /* Constant.Id */)) {
1680
+ const id = parseInt(htmlEl.getAttribute("data-clarity-id" /* Constant.Id */), 10);
1681
+ if (!isNaN(id) && id > 0) {
1682
+ this.nodes[id] = htmlEl;
1683
+ }
1684
+ }
1685
+ const elements = doc.querySelectorAll(`[${"data-clarity-id" /* Constant.Id */}]`);
1686
+ for (const el of Array.from(elements)) {
1687
+ const id = parseInt(el.getAttribute("data-clarity-id" /* Constant.Id */), 10);
1688
+ if (!isNaN(id) && id > 0) {
1689
+ this.nodes[id] = el;
1690
+ const ha = el.getAttribute("data-clarity-hashalpha" /* Constant.HashAlpha */);
1691
+ const hb = el.getAttribute("data-clarity-hashbeta" /* Constant.HashBeta */);
1692
+ if (ha) {
1693
+ this.hashMapAlpha[ha] = el;
1694
+ }
1695
+ if (hb) {
1696
+ this.hashMapBeta[hb] = el;
1697
+ }
1698
+ }
1699
+ }
1700
+ };
1673
1701
  this.get = (hash) => {
1674
1702
  if (hash in this.hashMapBeta && this.hashMapBeta[hash].isConnected) {
1675
1703
  return this.hashMapBeta[hash];