@ohhwells/bridge 0.1.159 → 0.1.160

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
@@ -7383,6 +7383,23 @@ function applyCustomCodeToHead(content) {
7383
7383
  if (beforeNodes.length > 0) document.head.append(...beforeNodes);
7384
7384
  }
7385
7385
 
7386
+ // src/lib/node-font-size.ts
7387
+ var TEXT_NODE_TYPES = /* @__PURE__ */ new Set(["text", "text/rich", "plain", "link"]);
7388
+ function escapeKey(key) {
7389
+ return typeof CSS !== "undefined" && typeof CSS.escape === "function" ? CSS.escape(key) : key.replace(/["\\]/g, "\\$&");
7390
+ }
7391
+ function measureNodeFontSize(key, type, root) {
7392
+ if (!TEXT_NODE_TYPES.has(type)) return void 0;
7393
+ const el = root.querySelector(`[data-ohw-editable][data-ohw-key="${escapeKey(key)}"]`);
7394
+ if (!el) return void 0;
7395
+ const size = Number.parseFloat(window.getComputedStyle(el).fontSize);
7396
+ return Number.isFinite(size) && size > 0 ? Math.round(size) : void 0;
7397
+ }
7398
+ function withNodeFontSize(node, root) {
7399
+ const fontSize = measureNodeFontSize(node.key, node.type, root);
7400
+ return fontSize === void 0 ? node : { ...node, fontSize };
7401
+ }
7402
+
7386
7403
  // src/lib/selectNavContainer.ts
7387
7404
  function isOnScreen(el) {
7388
7405
  const rect = el.getBoundingClientRect();
@@ -17322,7 +17339,7 @@ function apiBase() {
17322
17339
  function bridgeVersion() {
17323
17340
  try {
17324
17341
  if (true) {
17325
- return "0.1.159";
17342
+ return "0.1.160";
17326
17343
  }
17327
17344
  } catch {
17328
17345
  }
@@ -17336,7 +17353,7 @@ function stampBridgeVersionOnDocument() {
17336
17353
  return;
17337
17354
  }
17338
17355
  try {
17339
- const v = true ? "0.1.159" : "";
17356
+ const v = true ? "0.1.160" : "";
17340
17357
  if (v) {
17341
17358
  document.documentElement.setAttribute("data-ohw-bridge-version", v);
17342
17359
  window.__OHW_BRIDGE_VERSION__ = v;
@@ -31501,7 +31518,7 @@ function OhhwellsBridge() {
31501
31518
  const sectionEl = foundEl && !foundEl.hasAttribute("data-ohw-ai-template-hidden") && !foundEl.hasAttribute("data-ohw-ai-removed") && !foundEl.hasAttribute("data-ohw-ai-replaced-by") ? foundEl : null;
31502
31519
  const nodes = sectionEl ? collectEditableNodes(void 0, sectionEl).filter(
31503
31520
  (n) => n.key && !n.key.startsWith("__ohw_") && !["meta", "sections", "video-setting"].includes(n.type)
31504
- ).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })) : [];
31521
+ ).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl)) : [];
31505
31522
  const items = sectionEl ? collectItemGroups(sectionEl) : [];
31506
31523
  const box = sectionEl?.getBoundingClientRect();
31507
31524
  const rect = box ? {
@@ -32245,7 +32262,7 @@ function OhhwellsBridge() {
32245
32262
  postToParent2({
32246
32263
  type: "ow:ready",
32247
32264
  version: "1",
32248
- bridgeVersion: "0.1.159",
32265
+ bridgeVersion: "0.1.160",
32249
32266
  path: pathname,
32250
32267
  nodes: collectEditableNodes(editContentRef.current),
32251
32268
  sections