@ohhwells/bridge 0.1.51-next.129 → 0.1.52
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/README.md +1 -30
- package/dist/index.cjs +428 -935
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +404 -911
- package/dist/index.js.map +1 -1
- package/dist/styles.css +0 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -344,40 +344,11 @@ import { LinkPopover } from "@ohhwells/bridge";
|
|
|
344
344
|
The iframe bridge reports page sections on `ow:ready`:
|
|
345
345
|
|
|
346
346
|
```json
|
|
347
|
-
{ "type": "ow:ready", "version": "1", "
|
|
347
|
+
{ "type": "ow:ready", "version": "1", "nodes": [...], "sections": [{ "id": "hero", "label": "Hero" }] }
|
|
348
348
|
```
|
|
349
349
|
|
|
350
|
-
`version` is the protocol version; `bridgeVersion` is the npm package version (inlined at build time), letting the editor detect sites running an older bridge and gate version-dependent features (e.g. AI prompting) gracefully.
|
|
351
|
-
|
|
352
350
|
Templates must mark sections with `data-ohw-section` (and optional `data-ohw-section-label`).
|
|
353
351
|
|
|
354
|
-
### Section-scoped content collection (AI prompt context)
|
|
355
|
-
|
|
356
|
-
The editor can request a single section's editable content (edit mode only):
|
|
357
|
-
|
|
358
|
-
```json
|
|
359
|
-
// editor → iframe
|
|
360
|
-
{ "type": "ow:collect-section", "sectionId": "hero" }
|
|
361
|
-
|
|
362
|
-
// iframe → editor
|
|
363
|
-
{ "type": "ow:section-nodes", "sectionId": "hero", "found": true,
|
|
364
|
-
"nodes": [{ "key": "hero-headline", "type": "text/rich", "text": "..." }],
|
|
365
|
-
"rect": { "top": 0, "left": 0, "width": 1280, "height": 720 } }
|
|
366
|
-
```
|
|
367
|
-
|
|
368
|
-
- `found` is `false` (with empty `nodes`, `rect: null`) when no `[data-ohw-section="<id>"]` exists on the current page.
|
|
369
|
-
- `rect` is the section element's document-relative bounding box — the editor uses it to draw the in-flight overlay over just the target section.
|
|
370
|
-
- The returned set contains pure section content only: structural keys (`__ohw_*`), carousel/video-setting/meta nodes, and keyless editables are never included.
|
|
371
|
-
- Node `type` is normalized to the set `image | bg-image | video | link | plain | text/rich | text` (unknown template-declared types become `text`).
|
|
372
|
-
|
|
373
|
-
`ow:enter-edit` (iframe → editor, sent when the user clicks into an editable) also carries the enclosing section so the editor can offer that section as the AI prompt target:
|
|
374
|
-
|
|
375
|
-
```json
|
|
376
|
-
{ "type": "ow:enter-edit", "key": "hero-headline", "sectionId": "hero", "sectionLabel": "Hero" }
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
`sectionId`/`sectionLabel` are `null` for editables outside any `[data-ohw-section]` (label also when `data-ohw-section-label` is absent).
|
|
380
|
-
|
|
381
352
|
### Local link-editor testing (dev fixtures)
|
|
382
353
|
|
|
383
354
|
Without the canvas editor parent, add `ohw-fixtures=1` to the edit URL. This preloads Re:Bound pages and sections into the link popover:
|