@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 +21 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -7269,6 +7269,23 @@ function applyCustomCodeToHead(content) {
|
|
|
7269
7269
|
if (beforeNodes.length > 0) document.head.append(...beforeNodes);
|
|
7270
7270
|
}
|
|
7271
7271
|
|
|
7272
|
+
// src/lib/node-font-size.ts
|
|
7273
|
+
var TEXT_NODE_TYPES = /* @__PURE__ */ new Set(["text", "text/rich", "plain", "link"]);
|
|
7274
|
+
function escapeKey(key) {
|
|
7275
|
+
return typeof CSS !== "undefined" && typeof CSS.escape === "function" ? CSS.escape(key) : key.replace(/["\\]/g, "\\$&");
|
|
7276
|
+
}
|
|
7277
|
+
function measureNodeFontSize(key, type, root) {
|
|
7278
|
+
if (!TEXT_NODE_TYPES.has(type)) return void 0;
|
|
7279
|
+
const el = root.querySelector(`[data-ohw-editable][data-ohw-key="${escapeKey(key)}"]`);
|
|
7280
|
+
if (!el) return void 0;
|
|
7281
|
+
const size = Number.parseFloat(window.getComputedStyle(el).fontSize);
|
|
7282
|
+
return Number.isFinite(size) && size > 0 ? Math.round(size) : void 0;
|
|
7283
|
+
}
|
|
7284
|
+
function withNodeFontSize(node, root) {
|
|
7285
|
+
const fontSize = measureNodeFontSize(node.key, node.type, root);
|
|
7286
|
+
return fontSize === void 0 ? node : { ...node, fontSize };
|
|
7287
|
+
}
|
|
7288
|
+
|
|
7272
7289
|
// src/lib/selectNavContainer.ts
|
|
7273
7290
|
function isOnScreen(el) {
|
|
7274
7291
|
const rect = el.getBoundingClientRect();
|
|
@@ -17208,7 +17225,7 @@ function apiBase() {
|
|
|
17208
17225
|
function bridgeVersion() {
|
|
17209
17226
|
try {
|
|
17210
17227
|
if (true) {
|
|
17211
|
-
return "0.1.
|
|
17228
|
+
return "0.1.160";
|
|
17212
17229
|
}
|
|
17213
17230
|
} catch {
|
|
17214
17231
|
}
|
|
@@ -17222,7 +17239,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17222
17239
|
return;
|
|
17223
17240
|
}
|
|
17224
17241
|
try {
|
|
17225
|
-
const v = true ? "0.1.
|
|
17242
|
+
const v = true ? "0.1.160" : "";
|
|
17226
17243
|
if (v) {
|
|
17227
17244
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17228
17245
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -31393,7 +31410,7 @@ function OhhwellsBridge() {
|
|
|
31393
31410
|
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;
|
|
31394
31411
|
const nodes = sectionEl ? collectEditableNodes(void 0, sectionEl).filter(
|
|
31395
31412
|
(n) => n.key && !n.key.startsWith("__ohw_") && !["meta", "sections", "video-setting"].includes(n.type)
|
|
31396
|
-
).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })) : [];
|
|
31413
|
+
).map((n) => ({ ...n, text: n.text ?? "", type: normalizeAiNodeType(n.type) })).map((n) => withNodeFontSize(n, sectionEl)) : [];
|
|
31397
31414
|
const items = sectionEl ? collectItemGroups(sectionEl) : [];
|
|
31398
31415
|
const box = sectionEl?.getBoundingClientRect();
|
|
31399
31416
|
const rect = box ? {
|
|
@@ -32137,7 +32154,7 @@ function OhhwellsBridge() {
|
|
|
32137
32154
|
postToParent2({
|
|
32138
32155
|
type: "ow:ready",
|
|
32139
32156
|
version: "1",
|
|
32140
|
-
bridgeVersion: "0.1.
|
|
32157
|
+
bridgeVersion: "0.1.160",
|
|
32141
32158
|
path: pathname,
|
|
32142
32159
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32143
32160
|
sections
|