@ebitex/content-sdk 0.20.109 → 0.21.113
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/preview/index.d.ts +4 -0
- package/dist/preview/index.d.ts.map +1 -1
- package/dist/preview/index.js +7 -0
- package/dist/preview/index.js.map +1 -1
- package/dist/preview/overlay.d.ts +31 -0
- package/dist/preview/overlay.d.ts.map +1 -0
- package/dist/preview/overlay.js +219 -0
- package/dist/preview/overlay.js.map +1 -0
- package/dist/preview/pins.d.ts +79 -0
- package/dist/preview/pins.d.ts.map +1 -0
- package/dist/preview/pins.js +334 -0
- package/dist/preview/pins.js.map +1 -0
- package/dist/preview/script.d.ts +26 -0
- package/dist/preview/script.d.ts.map +1 -0
- package/dist/preview/script.js +88 -0
- package/dist/preview/script.js.map +1 -0
- package/dist/preview/serverBoundaries.d.ts +38 -0
- package/dist/preview/serverBoundaries.d.ts.map +1 -0
- package/dist/preview/serverBoundaries.js +71 -0
- package/dist/preview/serverBoundaries.js.map +1 -0
- package/dist/react/PreviewOverlay.d.ts +7 -16
- package/dist/react/PreviewOverlay.d.ts.map +1 -1
- package/dist/react/PreviewOverlay.js +11 -319
- package/dist/react/PreviewOverlay.js.map +1 -1
- package/dist/react/previewContext.d.ts +2 -13
- package/dist/react/previewContext.d.ts.map +1 -1
- package/dist/react/previewContext.js.map +1 -1
- package/dist/types.d.ts +7 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The pin vocabulary — geometry, naming and appearance — with no framework in it.
|
|
3
|
+
*
|
|
4
|
+
* <p>
|
|
5
|
+
* It was lifted out of <c>react/PreviewOverlay.tsx</c> unchanged rather than copied, because a
|
|
6
|
+
* server-rendered site now draws the same pins from a plain script. Two implementations of one
|
|
7
|
+
* closed vocabulary drift silently, and the drift is invisible until someone compares two
|
|
8
|
+
* screenshots of the same page. Both overlays call into this module for everything except how they
|
|
9
|
+
* put the boxes on screen: React portals them, the script appends elements.
|
|
10
|
+
* </p>
|
|
11
|
+
*
|
|
12
|
+
* <p>
|
|
13
|
+
* Nothing here touches React, and nothing here reads the document except through the element handles
|
|
14
|
+
* its caller supplies — which is what lets the same code serve a live React tree (boundaries
|
|
15
|
+
* registered as components mount) and static server-rendered HTML (boundaries recovered from a
|
|
16
|
+
* registry document).
|
|
17
|
+
* </p>
|
|
18
|
+
*/
|
|
19
|
+
export const BOUNDARY_SELECTOR = '[data-ebitex-source]';
|
|
20
|
+
export const FIELD_SELECTOR = '[data-ebitex-field]';
|
|
21
|
+
export const FALLBACK_SELECTOR = '[data-ebitex-content="fallback"]';
|
|
22
|
+
export function computePins(boundaries) {
|
|
23
|
+
const byElement = new Map();
|
|
24
|
+
for (const boundary of boundaries.values()) {
|
|
25
|
+
byElement.set(boundary.element, boundary);
|
|
26
|
+
}
|
|
27
|
+
const candidates = [];
|
|
28
|
+
for (const boundary of boundaries.values()) {
|
|
29
|
+
if (!boundary.element.isConnected)
|
|
30
|
+
continue;
|
|
31
|
+
// Mapped output pins the binding, once: a boundary nested inside another Adapter-mapped
|
|
32
|
+
// boundary is the same binding again (a relayed page's own hero, its own fields), and a field
|
|
33
|
+
// mark inside mapped output has no authored field behind it — neither gets a pin of its own.
|
|
34
|
+
const mapped = boundary.source?.adapter !== undefined;
|
|
35
|
+
if (mapped) {
|
|
36
|
+
const outer = boundary.element.parentElement?.closest(BOUNDARY_SELECTOR);
|
|
37
|
+
if (outer && byElement.get(outer)?.source?.adapter !== undefined)
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
candidates.push({ element: boundary.element, boundary });
|
|
41
|
+
if (mapped)
|
|
42
|
+
continue;
|
|
43
|
+
for (const fieldElement of Array.from(boundary.element.querySelectorAll(FIELD_SELECTOR))) {
|
|
44
|
+
// A field mark belongs to the nearest boundary, never an outer one.
|
|
45
|
+
if (fieldElement.closest(BOUNDARY_SELECTOR) !== boundary.element)
|
|
46
|
+
continue;
|
|
47
|
+
const key = fieldElement.getAttribute('data-ebitex-field');
|
|
48
|
+
if (key)
|
|
49
|
+
candidates.push({ element: fieldElement, boundary, field: key });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
candidates.sort((a, b) => {
|
|
53
|
+
if (a.element === b.element)
|
|
54
|
+
return a.field === undefined ? -1 : 1;
|
|
55
|
+
const position = a.element.compareDocumentPosition(b.element);
|
|
56
|
+
if (position & Node.DOCUMENT_POSITION_FOLLOWING)
|
|
57
|
+
return -1;
|
|
58
|
+
if (position & Node.DOCUMENT_POSITION_PRECEDING)
|
|
59
|
+
return 1;
|
|
60
|
+
return 0;
|
|
61
|
+
});
|
|
62
|
+
const drawn = [];
|
|
63
|
+
let number = 0;
|
|
64
|
+
for (const candidate of candidates) {
|
|
65
|
+
const rect = measureElement(candidate.element);
|
|
66
|
+
if (rect === null)
|
|
67
|
+
continue;
|
|
68
|
+
number += 1;
|
|
69
|
+
drawn.push(describe(number, candidate.element, candidate.boundary, candidate.field, rect));
|
|
70
|
+
}
|
|
71
|
+
// Two pins on one corner (a field mark that is the boundary's first child): nudge the later one.
|
|
72
|
+
for (let i = 1; i < drawn.length; i++) {
|
|
73
|
+
const previous = drawn[i - 1];
|
|
74
|
+
const current = drawn[i];
|
|
75
|
+
if (Math.abs(previous.rect.top - current.rect.top) < 6 && Math.abs(previous.rect.left - current.rect.left) < 6) {
|
|
76
|
+
current.rect = { ...current.rect, left: current.rect.left + 22 };
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
return drawn;
|
|
80
|
+
}
|
|
81
|
+
function describe(pin, element, boundary, field, rect) {
|
|
82
|
+
const { envelope, component: standaloneComponent, source } = boundary;
|
|
83
|
+
// spec 384-global-chrome-header-footer: a standalone Component boundary carries `component`
|
|
84
|
+
// instead of `envelope` — there is no Template to name it by, only its own Contract.
|
|
85
|
+
const templateName = envelope ? (envelope.template.externalId ?? envelope.template.id) : undefined;
|
|
86
|
+
const component = (envelope ? envelope.component : standaloneComponent);
|
|
87
|
+
const entityName = component?.contract?.externalId ?? templateName ?? 'Component';
|
|
88
|
+
const entity = source?.entity ?? { kind: 'component', id: '' };
|
|
89
|
+
if (field !== undefined) {
|
|
90
|
+
const facts = source?.fields?.[field];
|
|
91
|
+
const basePath = source?.contentPath ?? source?.path ?? [];
|
|
92
|
+
return {
|
|
93
|
+
pin,
|
|
94
|
+
kind: 'field',
|
|
95
|
+
label: field,
|
|
96
|
+
target: { entity, path: [...basePath, field], field },
|
|
97
|
+
facts,
|
|
98
|
+
element,
|
|
99
|
+
boundary,
|
|
100
|
+
rect,
|
|
101
|
+
tag: `${entityName} · ${field}${modifiers(facts)}`,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
if (source?.adapter) {
|
|
105
|
+
return {
|
|
106
|
+
pin,
|
|
107
|
+
kind: 'adapter',
|
|
108
|
+
label: source.adapter.id ? 'Adapter' : 'Adapter (inline)',
|
|
109
|
+
target: { entity, path: source.path },
|
|
110
|
+
element,
|
|
111
|
+
boundary,
|
|
112
|
+
rect,
|
|
113
|
+
tag: `Adapter · ${templateName} · mapped output`,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const unresolved = element.querySelector(FALLBACK_SELECTOR)?.closest(BOUNDARY_SELECTOR) === element;
|
|
117
|
+
if (unresolved) {
|
|
118
|
+
return {
|
|
119
|
+
pin,
|
|
120
|
+
kind: 'unresolved',
|
|
121
|
+
label: templateName ?? entityName,
|
|
122
|
+
target: { entity, path: source?.path ?? [] },
|
|
123
|
+
element,
|
|
124
|
+
boundary,
|
|
125
|
+
rect,
|
|
126
|
+
tag: `${templateName ?? entityName} · unresolvable`,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// spec 384-global-chrome-header-footer: a standalone Component boundary — no Template to name
|
|
130
|
+
// it by, so it gets a `component` kind instead of `envelope`, labeled by its own Contract.
|
|
131
|
+
if (envelope === undefined) {
|
|
132
|
+
return {
|
|
133
|
+
pin,
|
|
134
|
+
kind: 'component',
|
|
135
|
+
label: entityName,
|
|
136
|
+
target: { entity, path: source?.contentPath ?? source?.path ?? [] },
|
|
137
|
+
element,
|
|
138
|
+
boundary,
|
|
139
|
+
rect,
|
|
140
|
+
tag: entityName,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
// Only reachable with envelope defined (the branch above returns otherwise), so templateName is set.
|
|
144
|
+
return {
|
|
145
|
+
pin,
|
|
146
|
+
kind: 'envelope',
|
|
147
|
+
label: templateName,
|
|
148
|
+
target: { entity, path: source?.contentPath ?? source?.path ?? [] },
|
|
149
|
+
element,
|
|
150
|
+
boundary,
|
|
151
|
+
rect,
|
|
152
|
+
tag: `${templateName} · ${entityName}`,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function modifiers(facts) {
|
|
156
|
+
if (!facts)
|
|
157
|
+
return '';
|
|
158
|
+
const parts = [];
|
|
159
|
+
if (facts.variant)
|
|
160
|
+
parts.push(`variant: ${facts.variant}`);
|
|
161
|
+
if (facts.locale)
|
|
162
|
+
parts.push(`served: ${facts.locale}`);
|
|
163
|
+
return parts.length > 0 ? ` (${parts.join(', ')})` : '';
|
|
164
|
+
}
|
|
165
|
+
/** A boundary is `display: contents` — it has no box; its children do. */
|
|
166
|
+
export function measureElement(element) {
|
|
167
|
+
if (element.hasAttribute('data-ebitex-source')) {
|
|
168
|
+
let union = null;
|
|
169
|
+
for (const child of Array.from(element.children)) {
|
|
170
|
+
const rect = child.getBoundingClientRect();
|
|
171
|
+
if (rect.width === 0 && rect.height === 0)
|
|
172
|
+
continue;
|
|
173
|
+
union = union === null ? toRect(rect) : unite(union, toRect(rect));
|
|
174
|
+
}
|
|
175
|
+
return union;
|
|
176
|
+
}
|
|
177
|
+
const rect = element.getBoundingClientRect();
|
|
178
|
+
if (rect.width === 0 && rect.height === 0)
|
|
179
|
+
return null;
|
|
180
|
+
return toRect(rect);
|
|
181
|
+
}
|
|
182
|
+
function toRect(rect) {
|
|
183
|
+
const scrollX = typeof window === 'undefined' ? 0 : window.scrollX;
|
|
184
|
+
const scrollY = typeof window === 'undefined' ? 0 : window.scrollY;
|
|
185
|
+
return { top: rect.top + scrollY, left: rect.left + scrollX, width: rect.width, height: rect.height };
|
|
186
|
+
}
|
|
187
|
+
function unite(a, b) {
|
|
188
|
+
const top = Math.min(a.top, b.top);
|
|
189
|
+
const left = Math.min(a.left, b.left);
|
|
190
|
+
const bottom = Math.max(a.top + a.height, b.top + b.height);
|
|
191
|
+
const right = Math.max(a.left + a.width, b.left + b.width);
|
|
192
|
+
return { top, left, width: right - left, height: bottom - top };
|
|
193
|
+
}
|
|
194
|
+
export function stripDrawn(pin) {
|
|
195
|
+
const { pin: number, kind, label, target, facts } = pin;
|
|
196
|
+
return facts ? { pin: number, kind, label, target, facts } : { pin: number, kind, label, target };
|
|
197
|
+
}
|
|
198
|
+
export function pinFor(target, pins) {
|
|
199
|
+
if (!target)
|
|
200
|
+
return undefined;
|
|
201
|
+
const fieldElement = target.closest(FIELD_SELECTOR);
|
|
202
|
+
if (fieldElement) {
|
|
203
|
+
const match = pins.find((p) => p.element === fieldElement);
|
|
204
|
+
if (match)
|
|
205
|
+
return match;
|
|
206
|
+
}
|
|
207
|
+
const boundaryElement = target.closest(BOUNDARY_SELECTOR);
|
|
208
|
+
return pins.find((p) => p.element === boundaryElement && p.kind !== 'field');
|
|
209
|
+
}
|
|
210
|
+
export function hoverFor(target, pins) {
|
|
211
|
+
if (!target || target.closest('[data-ebitex-overlay]'))
|
|
212
|
+
return null;
|
|
213
|
+
const fieldElement = target.closest(FIELD_SELECTOR);
|
|
214
|
+
if (fieldElement) {
|
|
215
|
+
const match = pins.find((p) => p.element === fieldElement);
|
|
216
|
+
if (match)
|
|
217
|
+
return { kind: 'pin', pin: match.pin };
|
|
218
|
+
}
|
|
219
|
+
const boundaryElement = target.closest(BOUNDARY_SELECTOR);
|
|
220
|
+
if (!boundaryElement)
|
|
221
|
+
return null;
|
|
222
|
+
const boundaryPin = pins.find((p) => p.element === boundaryElement && p.kind !== 'field');
|
|
223
|
+
if (!boundaryPin)
|
|
224
|
+
return null;
|
|
225
|
+
const hasFields = pins.some((p) => p.boundary === boundaryPin.boundary && p.kind === 'field');
|
|
226
|
+
if (!hasFields || boundaryPin.kind !== 'envelope' || boundaryPin.boundary.envelope === undefined)
|
|
227
|
+
return { kind: 'pin', pin: boundaryPin.pin };
|
|
228
|
+
// Inside a boundary with field pins, but not on one: template-owned markup.
|
|
229
|
+
const templateName = boundaryPin.boundary.envelope.template.externalId ?? boundaryPin.boundary.envelope.template.id;
|
|
230
|
+
return { kind: 'template', boundaryId: boundaryPin.boundary.id, rect: boundaryPin.rect, label: `Template "${templateName}" — not a field` };
|
|
231
|
+
}
|
|
232
|
+
/** The pin's own target, for a caller that has a pin number rather than an element. */
|
|
233
|
+
export function targetOf(pins, pin) {
|
|
234
|
+
return pins.find((p) => p.pin === pin);
|
|
235
|
+
}
|
|
236
|
+
const MAGENTA = '#b92f8f';
|
|
237
|
+
const BLUE = '#0179c6';
|
|
238
|
+
const GREY = '#6b7280';
|
|
239
|
+
const RED = '#c9302c';
|
|
240
|
+
export function colorFor(kind) {
|
|
241
|
+
if (kind === 'unresolved')
|
|
242
|
+
return RED;
|
|
243
|
+
if (kind === 'template')
|
|
244
|
+
return GREY;
|
|
245
|
+
if (kind === 'field')
|
|
246
|
+
return MAGENTA;
|
|
247
|
+
return BLUE; // envelope, component, adapter — the boundary color
|
|
248
|
+
}
|
|
249
|
+
export const containerStyle = {
|
|
250
|
+
position: 'absolute',
|
|
251
|
+
top: 0,
|
|
252
|
+
left: 0,
|
|
253
|
+
width: 0,
|
|
254
|
+
height: 0,
|
|
255
|
+
overflow: 'visible',
|
|
256
|
+
zIndex: 2147483000,
|
|
257
|
+
pointerEvents: 'none',
|
|
258
|
+
fontFamily: 'system-ui, sans-serif',
|
|
259
|
+
};
|
|
260
|
+
export function pinStyle(rect, kind) {
|
|
261
|
+
const color = colorFor(kind);
|
|
262
|
+
const base = {
|
|
263
|
+
position: 'absolute',
|
|
264
|
+
top: rect.top - 9,
|
|
265
|
+
left: rect.left - 9,
|
|
266
|
+
fontSize: 10.5,
|
|
267
|
+
fontWeight: 700,
|
|
268
|
+
textAlign: 'center',
|
|
269
|
+
boxShadow: '0 0 0 3px #fff',
|
|
270
|
+
cursor: 'pointer',
|
|
271
|
+
pointerEvents: 'auto',
|
|
272
|
+
};
|
|
273
|
+
if (kind === 'field') {
|
|
274
|
+
// A field pin is always a solid circle — the boundary shape (below) is never used for a field,
|
|
275
|
+
// even though both kinds could otherwise render at the same 18px size.
|
|
276
|
+
return { ...base, width: 18, height: 18, borderRadius: 999, border: 'none', background: color, color: '#fff', lineHeight: '18px', padding: 0 };
|
|
277
|
+
}
|
|
278
|
+
const dashed = kind === 'adapter';
|
|
279
|
+
return {
|
|
280
|
+
...base,
|
|
281
|
+
minWidth: 22,
|
|
282
|
+
height: 18,
|
|
283
|
+
padding: '0 6px',
|
|
284
|
+
borderRadius: 5,
|
|
285
|
+
boxSizing: 'border-box',
|
|
286
|
+
border: dashed ? `1.5px dashed ${color}` : 'none',
|
|
287
|
+
background: dashed ? '#fff' : color,
|
|
288
|
+
color: dashed ? color : '#fff',
|
|
289
|
+
lineHeight: dashed ? '15px' : '18px',
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
export function outlineStyle(rect, kind) {
|
|
293
|
+
return {
|
|
294
|
+
position: 'absolute',
|
|
295
|
+
top: rect.top - 3,
|
|
296
|
+
left: rect.left - 3,
|
|
297
|
+
width: rect.width + 6,
|
|
298
|
+
height: rect.height + 6,
|
|
299
|
+
border: `1.5px ${kind === 'adapter' || kind === 'template' ? 'dashed' : 'solid'} ${colorFor(kind)}`,
|
|
300
|
+
borderRadius: 4,
|
|
301
|
+
boxSizing: 'border-box',
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
/** The always-on, lighter outline every pinned element shows in Edit mode — the same box `outlineStyle` draws for the highlighted pin, just fainter and thinner so it doesn't compete with it. */
|
|
305
|
+
export function persistentOutlineStyle(rect, kind) {
|
|
306
|
+
return {
|
|
307
|
+
position: 'absolute',
|
|
308
|
+
top: rect.top - 3,
|
|
309
|
+
left: rect.left - 3,
|
|
310
|
+
width: rect.width + 6,
|
|
311
|
+
height: rect.height + 6,
|
|
312
|
+
border: `1px ${kind === 'adapter' ? 'dashed' : 'solid'} ${colorFor(kind)}`,
|
|
313
|
+
opacity: 0.4,
|
|
314
|
+
borderRadius: 4,
|
|
315
|
+
boxSizing: 'border-box',
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
export function tagStyle(rect, kind) {
|
|
319
|
+
return {
|
|
320
|
+
position: 'absolute',
|
|
321
|
+
top: rect.top - 9,
|
|
322
|
+
left: rect.left + 14,
|
|
323
|
+
height: 18,
|
|
324
|
+
lineHeight: '18px',
|
|
325
|
+
padding: '0 7px',
|
|
326
|
+
borderRadius: 5,
|
|
327
|
+
background: colorFor(kind),
|
|
328
|
+
color: '#fff',
|
|
329
|
+
fontSize: 10.5,
|
|
330
|
+
fontWeight: 500,
|
|
331
|
+
whiteSpace: 'nowrap',
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
//# sourceMappingURL=pins.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pins.js","sourceRoot":"","sources":["../../src/preview/pins.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAA;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,qBAAqB,CAAA;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,kCAAkC,CAAA;AAwCnE,MAAM,UAAU,WAAW,CAAC,UAA4C;IACtE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgC,CAAA;IACzD,KAAK,MAAM,QAAQ,IAAI,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC;QAC3C,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C;QACjB,IAAI,EAAE,IAAI,CAAC,IAAI,GAAG,EAAE;QACpB,MAAM,EAAE,EAAE;QACV,UAAU,EAAE,MAAM;QAClB,OAAO,EAAE,OAAO;QAChB,YAAY,EAAE,CAAC;QACf,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC;QAC1B,KAAK,EAAE,MAAM;QACb,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,GAAG;QACf,UAAU,EAAE,QAAQ;KACrB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export interface PreviewScriptOptions {
|
|
2
|
+
/** Origins Composer may speak from. Defaults to the script tag's `data-ebitex-preview-origins`, then the built-in. */
|
|
3
|
+
origins?: readonly string[];
|
|
4
|
+
window?: Window;
|
|
5
|
+
}
|
|
6
|
+
export interface PreviewScriptHandle {
|
|
7
|
+
/** Re-read the registry and re-measure — for a site that swapped content in without a page load. */
|
|
8
|
+
refresh(): void;
|
|
9
|
+
dispose(): void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The whole receiver for a site that never hydrates: pins, click-to-edit, and the `v: 1` protocol,
|
|
13
|
+
* with no framework.
|
|
14
|
+
*
|
|
15
|
+
* <p>
|
|
16
|
+
* It is inert unless the page is genuinely being previewed — `isPreviewActivated` requires both the
|
|
17
|
+
* `?ebitex-preview=1` flag and a framing or opening counterpart — so a site may include the script
|
|
18
|
+
* tag unconditionally on every page and pay one cached request for it.
|
|
19
|
+
* </p>
|
|
20
|
+
*
|
|
21
|
+
* <p>
|
|
22
|
+
* Returns `null` when inert, so a caller can tell "not previewing" from "previewing and wired up".
|
|
23
|
+
* </p>
|
|
24
|
+
*/
|
|
25
|
+
export declare function startPreviewScript(options?: PreviewScriptOptions): PreviewScriptHandle | null;
|
|
26
|
+
//# sourceMappingURL=script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.d.ts","sourceRoot":"","sources":["../../src/preview/script.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,oBAAoB;IACnC,sHAAsH;IACtH,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,oGAAoG;IACpG,OAAO,IAAI,IAAI,CAAA;IACf,OAAO,IAAI,IAAI,CAAA;CAChB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,oBAAyB,GAAG,mBAAmB,GAAG,IAAI,CA8DjG"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { isPreviewActivated } from './activation.js';
|
|
2
|
+
import { createScriptOverlay } from './overlay.js';
|
|
3
|
+
import { DEFAULT_PREVIEW_ORIGINS } from './protocol.js';
|
|
4
|
+
import { createPreviewReceiver } from './receiver.js';
|
|
5
|
+
import { bindBoundaries, parseRegistryDocuments } from './serverBoundaries.js';
|
|
6
|
+
/**
|
|
7
|
+
* The whole receiver for a site that never hydrates: pins, click-to-edit, and the `v: 1` protocol,
|
|
8
|
+
* with no framework.
|
|
9
|
+
*
|
|
10
|
+
* <p>
|
|
11
|
+
* It is inert unless the page is genuinely being previewed — `isPreviewActivated` requires both the
|
|
12
|
+
* `?ebitex-preview=1` flag and a framing or opening counterpart — so a site may include the script
|
|
13
|
+
* tag unconditionally on every page and pay one cached request for it.
|
|
14
|
+
* </p>
|
|
15
|
+
*
|
|
16
|
+
* <p>
|
|
17
|
+
* Returns `null` when inert, so a caller can tell "not previewing" from "previewing and wired up".
|
|
18
|
+
* </p>
|
|
19
|
+
*/
|
|
20
|
+
export function startPreviewScript(options = {}) {
|
|
21
|
+
const win = options.window ?? window;
|
|
22
|
+
if (!isPreviewActivated(win.location, win))
|
|
23
|
+
return null;
|
|
24
|
+
const doc = win.document;
|
|
25
|
+
const origins = options.origins ?? originsFromScriptTag(doc) ?? DEFAULT_PREVIEW_ORIGINS;
|
|
26
|
+
let overlay = null;
|
|
27
|
+
let boundaries = new Map();
|
|
28
|
+
const receiver = createPreviewReceiver({
|
|
29
|
+
origins,
|
|
30
|
+
window: win,
|
|
31
|
+
onMode: (mode) => overlay?.setMode(mode),
|
|
32
|
+
onSelect: (pin) => overlay?.select(pin),
|
|
33
|
+
// A `document` message is Composer offering to render a draft in the browser. This page's own
|
|
34
|
+
// server has already rendered the draft it was sent, so there is nothing to do with one — and
|
|
35
|
+
// acting on it would mean shipping a renderer, which is the whole point of server mode not to.
|
|
36
|
+
});
|
|
37
|
+
const registry = parseRegistryDocuments(doc, (message) => receiver.postError('preview_registry_invalid', message));
|
|
38
|
+
function rebind() {
|
|
39
|
+
boundaries = bindBoundaries(doc, registry);
|
|
40
|
+
}
|
|
41
|
+
rebind();
|
|
42
|
+
overlay = createScriptOverlay({
|
|
43
|
+
window: win,
|
|
44
|
+
boundaries: () => boundaries,
|
|
45
|
+
onEdit: (pin, kind, target) => receiver.postEdit(pin, kind, target),
|
|
46
|
+
// seq 0: Composer numbers the documents it *posts*, and in server mode it posts none — the draft
|
|
47
|
+
// reaches this page through its own server instead. Composer's server-mode branch accepts a
|
|
48
|
+
// report on its own terms rather than matching a sequence that was never issued.
|
|
49
|
+
onRendered: (pins) => receiver.postRendered(0, pins),
|
|
50
|
+
});
|
|
51
|
+
receiver.ready();
|
|
52
|
+
// A cross-origin frame's location cannot be read by Composer, so every navigation is silent unless
|
|
53
|
+
// the page says where it landed. With this, browsing a server-rendered site moves Composer's own
|
|
54
|
+
// selection with it — the existing `navigated` handler resolves the path and selects that node.
|
|
55
|
+
//
|
|
56
|
+
// Posted on *every* load, unlike the React bridge's "never on mount": here a navigation IS a load,
|
|
57
|
+
// so skipping the first one would skip all of them. Reporting the page Composer already framed is
|
|
58
|
+
// a no-op at the other end (the path resolves to the node it already has).
|
|
59
|
+
//
|
|
60
|
+
// The pathname alone — a query string is not part of the address Composer resolves, and this
|
|
61
|
+
// page's own URL carries the preview flag and possibly a one-time session token.
|
|
62
|
+
receiver.postNavigated(win.location.pathname);
|
|
63
|
+
return {
|
|
64
|
+
refresh() {
|
|
65
|
+
rebind();
|
|
66
|
+
overlay?.measure();
|
|
67
|
+
},
|
|
68
|
+
dispose() {
|
|
69
|
+
overlay?.dispose();
|
|
70
|
+
overlay = null;
|
|
71
|
+
receiver.dispose();
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** `<script src="…/preview.js" data-ebitex-preview-origins="https://content.example.com">`. */
|
|
76
|
+
function originsFromScriptTag(doc) {
|
|
77
|
+
const current = doc.currentScript;
|
|
78
|
+
const element = current ?? doc.querySelector('script[data-ebitex-preview-origins]');
|
|
79
|
+
const declared = element?.getAttribute('data-ebitex-preview-origins');
|
|
80
|
+
if (!declared)
|
|
81
|
+
return null;
|
|
82
|
+
const origins = declared
|
|
83
|
+
.split(',')
|
|
84
|
+
.map((origin) => origin.trim())
|
|
85
|
+
.filter((origin) => origin.length > 0);
|
|
86
|
+
return origins.length > 0 ? origins : null;
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.js","sourceRoot":"","sources":["../../src/preview/script.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAsB,MAAM,cAAc,CAAA;AACtE,OAAO,EAAE,uBAAuB,EAAoB,MAAM,eAAe,CAAA;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAA;AACrD,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAe9E;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAgC,EAAE;IACnE,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,IAAI,MAAM,CAAA;IACpC,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,QAAQ,EAAE,G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
|
3
|
+
* Recovering the boundary registry a server-rendered page emits.
|
|
4
|
+
*
|
|
5
|
+
* <p>
|
|
6
|
+
* A React page registers each boundary as it mounts, with the live `PreviewSource` the SDK handed
|
|
7
|
+
* the renderer. A server-rendered page has no such registry at runtime, so it serializes one: the
|
|
8
|
+
* two per-element attributes React already emits (`data-ebitex-source`, `data-ebitex-field`) plus a
|
|
9
|
+
* single JSON document mapping each boundary id to the same facts React holds in memory.
|
|
10
|
+
* </p>
|
|
11
|
+
*
|
|
12
|
+
* <p>
|
|
13
|
+
* Keeping the per-element contract identical to React's is what allows one pin implementation
|
|
14
|
+
* (`pins.ts`) to serve both — the registry replaces the in-memory map and nothing else.
|
|
15
|
+
* </p>
|
|
16
|
+
*/
|
|
17
|
+
export declare const BOUNDARY_REGISTRY_SELECTOR = "script[type=\"application/json\"][data-ebitex-preview-sources]";
|
|
18
|
+
/** One registry entry: a `PreviewBoundaryFacts` without the `id`, which is the map key. */
|
|
19
|
+
export type BoundaryRegistryEntry = Omit<PreviewBoundaryFacts, 'id'>;
|
|
20
|
+
export type BoundaryRegistry = Record<string, BoundaryRegistryEntry>;
|
|
21
|
+
/** Parses one registry document. Throws on malformed JSON, so a caller can report it. */
|
|
22
|
+
export declare function parseBoundaryRegistry(text: string): BoundaryRegistry;
|
|
23
|
+
/** Merges every registry document in the page. Parsed once — binding is what repeats per measure. */
|
|
24
|
+
export declare function parseRegistryDocuments(doc: Document, onError?: (message: string) => void): BoundaryRegistry;
|
|
25
|
+
/**
|
|
26
|
+
* Binds every `[data-ebitex-source]` element in the document to its registry facts.
|
|
27
|
+
*
|
|
28
|
+
* <p>
|
|
29
|
+
* An element with no registry entry is still a boundary — it draws a pin named after nothing in
|
|
30
|
+
* particular rather than vanishing. That is deliberate: a renderer that emits the attribute but
|
|
31
|
+
* forgets the registry produces a visibly unnamed pin, which is a far better signal than a page
|
|
32
|
+
* that silently has no pins at all.
|
|
33
|
+
* </p>
|
|
34
|
+
*/
|
|
35
|
+
export declare function bindBoundaries(doc: Document, registry: BoundaryRegistry): Map<string, PreviewBoundaryInfo>;
|
|
36
|
+
/** Parse and bind in one call — the shape a caller reading a page exactly once wants. */
|
|
37
|
+
export declare function readBoundaryRegistry(doc: Document, onError?: (message: string) => void): Map<string, PreviewBoundaryInfo>;
|
|
38
|
+
//# sourceMappingURL=serverBoundaries.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverBoundaries.d.ts","sourceRoot":"","sources":["../../src/preview/serverBoundaries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAA;AAE1E;;;;;;;;;;;;;;GAcG;AAEH,eAAO,MAAM,0BAA0B,mEAAiE,CAAA;AAExG,2FAA2F;AAC3F,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAC,CAAA;AAEpE,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAA;AAEpE,yFAAyF;AACzF,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAMpE;AAED,qGAAqG;AACrG,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,gBAAgB,CAW3G;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,gBAAgB,GAAG,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAkB1G;AAED,yFAAyF;AACzF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAAG,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAEzH"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recovering the boundary registry a server-rendered page emits.
|
|
3
|
+
*
|
|
4
|
+
* <p>
|
|
5
|
+
* A React page registers each boundary as it mounts, with the live `PreviewSource` the SDK handed
|
|
6
|
+
* the renderer. A server-rendered page has no such registry at runtime, so it serializes one: the
|
|
7
|
+
* two per-element attributes React already emits (`data-ebitex-source`, `data-ebitex-field`) plus a
|
|
8
|
+
* single JSON document mapping each boundary id to the same facts React holds in memory.
|
|
9
|
+
* </p>
|
|
10
|
+
*
|
|
11
|
+
* <p>
|
|
12
|
+
* Keeping the per-element contract identical to React's is what allows one pin implementation
|
|
13
|
+
* (`pins.ts`) to serve both — the registry replaces the in-memory map and nothing else.
|
|
14
|
+
* </p>
|
|
15
|
+
*/
|
|
16
|
+
export const BOUNDARY_REGISTRY_SELECTOR = 'script[type="application/json"][data-ebitex-preview-sources]';
|
|
17
|
+
/** Parses one registry document. Throws on malformed JSON, so a caller can report it. */
|
|
18
|
+
export function parseBoundaryRegistry(text) {
|
|
19
|
+
const parsed = JSON.parse(text);
|
|
20
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
21
|
+
throw new Error('the preview source registry must be a JSON object keyed by boundary id');
|
|
22
|
+
}
|
|
23
|
+
return parsed;
|
|
24
|
+
}
|
|
25
|
+
/** Merges every registry document in the page. Parsed once — binding is what repeats per measure. */
|
|
26
|
+
export function parseRegistryDocuments(doc, onError) {
|
|
27
|
+
const registry = {};
|
|
28
|
+
for (const script of Array.from(doc.querySelectorAll(BOUNDARY_REGISTRY_SELECTOR))) {
|
|
29
|
+
try {
|
|
30
|
+
Object.assign(registry, parseBoundaryRegistry(script.textContent ?? ''));
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
onError?.(error instanceof Error ? error.message : String(error));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return registry;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Binds every `[data-ebitex-source]` element in the document to its registry facts.
|
|
40
|
+
*
|
|
41
|
+
* <p>
|
|
42
|
+
* An element with no registry entry is still a boundary — it draws a pin named after nothing in
|
|
43
|
+
* particular rather than vanishing. That is deliberate: a renderer that emits the attribute but
|
|
44
|
+
* forgets the registry produces a visibly unnamed pin, which is a far better signal than a page
|
|
45
|
+
* that silently has no pins at all.
|
|
46
|
+
* </p>
|
|
47
|
+
*/
|
|
48
|
+
export function bindBoundaries(doc, registry) {
|
|
49
|
+
const boundaries = new Map();
|
|
50
|
+
// Matched by attribute value rather than by a built selector: a boundary id is chosen by the
|
|
51
|
+
// site's own renderer, so it can contain anything a CSS selector would have to escape.
|
|
52
|
+
for (const element of Array.from(doc.querySelectorAll('[data-ebitex-source]'))) {
|
|
53
|
+
const id = element.getAttribute('data-ebitex-source');
|
|
54
|
+
if (id === null || id === '')
|
|
55
|
+
continue;
|
|
56
|
+
const facts = registry[id];
|
|
57
|
+
boundaries.set(id, {
|
|
58
|
+
id,
|
|
59
|
+
element,
|
|
60
|
+
envelope: facts?.envelope,
|
|
61
|
+
component: facts?.component,
|
|
62
|
+
source: facts?.source,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return boundaries;
|
|
66
|
+
}
|
|
67
|
+
/** Parse and bind in one call — the shape a caller reading a page exactly once wants. */
|
|
68
|
+
export function readBoundaryRegistry(doc, onError) {
|
|
69
|
+
return bindBoundaries(doc, parseRegistryDocuments(doc, onError));
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=serverBoundaries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverBoundaries.js","sourceRoot":"","sources":["../../src/preview/serverBoundaries.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,8DAA8D,CAAA;AAOxG,yFAAyF;AACzF,MAAM,UAAU,qBAAqB,CAAC,IAAY;IAChD,MAAM,MAAM,GAAY,IAAI,CAAC,KA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GAAG,QAAQ,CAAC,EAAE,CAAC,CAAA;QAC1B,UAAU,CAAC,GAAG,CAAC,EAAE,EAAE;YACjB,EAAE;YACF,OAAO;YACP,QAAQ,EAAE,KAAK,EAAE,QAAQ;YACzB,SAAS,EAAE,KAAK,EAAE,SAAS;YAC3B,MAAM,EAAE,KAAK,EAAE,MAAM;SACtB,CAAC,CAAA;IACJ,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,oBAAoB,CAAC,GAAa,EAAE,OAAmC;IACrF,OAAO,cAAc,CAAC,GAAG,EAAE,sBAAsB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAA;AAClE,CAAC"}
|
|
@@ -1,32 +1,23 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import type { PreviewPin, PreviewPinKind, PreviewTarget } from '../preview/protocol.js';
|
|
3
|
-
import { type PreviewBoundaryInfo } from './previewContext.js';
|
|
4
3
|
export interface PreviewOverlayProps {
|
|
5
4
|
/** The `seq` of the document on screen — pins are re-reported to Composer once per new value. */
|
|
6
5
|
seq: number;
|
|
7
6
|
onEdit: (pin: number, kind: PreviewPinKind, target: PreviewTarget) => void;
|
|
8
7
|
onRendered: (seq: number, pins: PreviewPin[]) => void;
|
|
9
8
|
}
|
|
10
|
-
interface Rect {
|
|
11
|
-
top: number;
|
|
12
|
-
left: number;
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
}
|
|
16
|
-
interface DrawnPin extends PreviewPin {
|
|
17
|
-
element: Element;
|
|
18
|
-
boundary: PreviewBoundaryInfo;
|
|
19
|
-
rect: Rect;
|
|
20
|
-
/** The hover/selection tag, with modifiers. */
|
|
21
|
-
tag: string;
|
|
22
|
-
}
|
|
23
9
|
/**
|
|
24
10
|
* Edit mode's pins, outlines, and tags, drawn in a portal at the end of `document.body` so no site
|
|
25
11
|
* stylesheet clips or restyles them. Field and envelope pins share one numbering in document
|
|
26
12
|
* order; every pin is a real `<button>` (Enter activates). Re-measured on scroll, resize, a
|
|
27
13
|
* `ResizeObserver` on the body, and every boundary change.
|
|
14
|
+
*
|
|
15
|
+
* <p>
|
|
16
|
+
* What a pin *is* — its geometry, numbering, naming and appearance — lives in
|
|
17
|
+
* `preview/pins.ts`, shared verbatim with the script overlay a server-rendered site loads (spec
|
|
18
|
+
* 728-server-mode-preview-pins). This component owns only how those pins reach the screen.
|
|
19
|
+
* </p>
|
|
28
20
|
*/
|
|
29
21
|
export declare function PreviewOverlay({ seq, onEdit, onRendered }: PreviewOverlayProps): ReactNode;
|
|
30
|
-
export
|
|
31
|
-
export {};
|
|
22
|
+
export { computePins } from '../preview/pins.js';
|
|
32
23
|
//# sourceMappingURL=PreviewOverlay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PreviewOverlay.d.ts","sourceRoot":"","sources":["../../src/react/PreviewOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6F,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"PreviewOverlay.d.ts","sourceRoot":"","sources":["../../src/react/PreviewOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA6F,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAiBjI,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAGvF,MAAM,WAAW,mBAAmB;IAClC,iGAAiG;IACjG,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,aAAa,KAAK,IAAI,CAAA;IAC1E,UAAU,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,IAAI,CAAA;CACtD;AAKD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,mBAAmB,GAAG,SAAS,CAkI1F;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA"}
|