@syntrologie/adapt-content 2.8.0-canary.9 → 2.9.0
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/editor.d.ts.map +1 -1
- package/dist/editor.js +6 -2
- package/dist/reconciliation-guard.d.ts.map +1 -1
- package/dist/reconciliation-guard.js +8 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +29 -11
- package/dist/sanitizer.d.ts.map +1 -1
- package/dist/sanitizer.js +9 -0
- package/dist/summarize.d.ts.map +1 -1
- package/dist/summarize.js +6 -2
- package/package.json +1 -1
package/dist/editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuBH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuBH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAgLhD,wBAAgB,aAAa,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,gBAAgB,2CAmkB3E;AAED;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;CAOlB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;CAAe,CAAC;AAExC,eAAe,aAAa,CAAC"}
|
package/dist/editor.js
CHANGED
|
@@ -16,9 +16,13 @@ import { summarizeContentChange } from './summarize';
|
|
|
16
16
|
// ============================================================================
|
|
17
17
|
/** Extract the CSS selector string from an anchorId (object or legacy string). */
|
|
18
18
|
function resolveAnchorSelector(anchorId) {
|
|
19
|
-
if (!anchorId
|
|
19
|
+
if (!anchorId)
|
|
20
20
|
return '';
|
|
21
|
-
|
|
21
|
+
if (typeof anchorId === 'string')
|
|
22
|
+
return anchorId;
|
|
23
|
+
if (typeof anchorId === 'object')
|
|
24
|
+
return anchorId.selector ?? '';
|
|
25
|
+
return '';
|
|
22
26
|
}
|
|
23
27
|
/** Extract the target route from an AnchorId object, ignoring wildcard '**'. */
|
|
24
28
|
function resolveAnchorRoute(anchorId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconciliation-guard.d.ts","sourceRoot":"","sources":["../src/reconciliation-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,0BAA0B;IACzC,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,IAAI,EACtB,IAAI,CAAC,EAAE,0BAA0B,GAChC,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"reconciliation-guard.d.ts","sourceRoot":"","sources":["../src/reconciliation-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,0BAA0B;IACzC,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,WAAW,EACtB,MAAM,EAAE,WAAW,EACnB,UAAU,EAAE,MAAM,IAAI,EACtB,IAAI,CAAC,EAAE,0BAA0B,GAChC,MAAM,IAAI,CA4DZ"}
|
|
@@ -48,6 +48,14 @@ export function guardAgainstReconciliation(container, anchor, reinsertFn, opts)
|
|
|
48
48
|
debounceTimer = setTimeout(() => {
|
|
49
49
|
if (disconnected)
|
|
50
50
|
return;
|
|
51
|
+
// If the anchor has been removed from the DOM (SPA navigation),
|
|
52
|
+
// the page has been torn down — stop fighting React's reconciler.
|
|
53
|
+
// Re-inserting into a dying subtree triggers removeChild crashes.
|
|
54
|
+
if (!anchor.isConnected) {
|
|
55
|
+
observer.disconnect();
|
|
56
|
+
disconnected = true;
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
51
59
|
retries++;
|
|
52
60
|
try {
|
|
53
61
|
reinsertFn();
|
package/dist/runtime.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EAEd,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,aAAa,EACd,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EAEd,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,aAAa,EACd,MAAM,SAAS,CAAC;AAMjB;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAAc,CAAC,gBAAgB,CAqI9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CAoCxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CA6DxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CAmC1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,iBAAiB,CAmChE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CAoD1D,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;EAOZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAMnB,CAAC"}
|
package/dist/runtime.js
CHANGED
|
@@ -109,18 +109,26 @@ export const executeInsertHtml = async (action, context) => {
|
|
|
109
109
|
container.removeEventListener('click', deepLinkHandler);
|
|
110
110
|
}
|
|
111
111
|
guardCleanup();
|
|
112
|
-
if
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
restoredEl.
|
|
119
|
-
|
|
120
|
-
|
|
112
|
+
// Skip DOM mutations if nodes are already detached (SPA navigation)
|
|
113
|
+
if (!container.isConnected)
|
|
114
|
+
return;
|
|
115
|
+
try {
|
|
116
|
+
if (action.position === 'replace' && originalContent !== null) {
|
|
117
|
+
// Restore original element
|
|
118
|
+
const restoredEl = document.createElement(anchorEl.tagName);
|
|
119
|
+
restoredEl.innerHTML = originalContent;
|
|
120
|
+
// Copy attributes
|
|
121
|
+
Array.from(anchorEl.attributes).forEach((attr) => {
|
|
122
|
+
restoredEl.setAttribute(attr.name, attr.value);
|
|
123
|
+
});
|
|
124
|
+
container.replaceWith(restoredEl);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
container.remove();
|
|
128
|
+
}
|
|
121
129
|
}
|
|
122
|
-
|
|
123
|
-
|
|
130
|
+
catch {
|
|
131
|
+
// DOM nodes already removed by host framework — safe to ignore
|
|
124
132
|
}
|
|
125
133
|
},
|
|
126
134
|
updateFn: (changes) => {
|
|
@@ -153,6 +161,8 @@ export const executeSetText = async (action, context) => {
|
|
|
153
161
|
});
|
|
154
162
|
return {
|
|
155
163
|
cleanup: () => {
|
|
164
|
+
if (!anchorEl.isConnected)
|
|
165
|
+
return;
|
|
156
166
|
anchorEl.textContent = originalText;
|
|
157
167
|
},
|
|
158
168
|
updateFn: (changes) => {
|
|
@@ -202,6 +212,8 @@ export const executeSetAttr = async (action, context) => {
|
|
|
202
212
|
});
|
|
203
213
|
return {
|
|
204
214
|
cleanup: () => {
|
|
215
|
+
if (!anchorEl.isConnected)
|
|
216
|
+
return;
|
|
205
217
|
if (hadAttribute && originalValue !== null) {
|
|
206
218
|
anchorEl.setAttribute(action.attr, originalValue);
|
|
207
219
|
}
|
|
@@ -240,6 +252,8 @@ export const executeAddClass = async (action, context) => {
|
|
|
240
252
|
});
|
|
241
253
|
return {
|
|
242
254
|
cleanup: () => {
|
|
255
|
+
if (!anchorEl.isConnected)
|
|
256
|
+
return;
|
|
243
257
|
// Only remove if we added it
|
|
244
258
|
if (!hadClass) {
|
|
245
259
|
anchorEl.classList.remove(action.className);
|
|
@@ -271,6 +285,8 @@ export const executeRemoveClass = async (action, context) => {
|
|
|
271
285
|
});
|
|
272
286
|
return {
|
|
273
287
|
cleanup: () => {
|
|
288
|
+
if (!anchorEl.isConnected)
|
|
289
|
+
return;
|
|
274
290
|
// Only re-add if we removed it
|
|
275
291
|
if (hadClass) {
|
|
276
292
|
anchorEl.classList.add(action.className);
|
|
@@ -308,6 +324,8 @@ export const executeSetStyle = async (action, context) => {
|
|
|
308
324
|
});
|
|
309
325
|
return {
|
|
310
326
|
cleanup: () => {
|
|
327
|
+
if (!anchorEl.isConnected)
|
|
328
|
+
return;
|
|
311
329
|
// Restore original styles
|
|
312
330
|
for (const [prop, originalValue] of originalStyles) {
|
|
313
331
|
if (originalValue) {
|
package/dist/sanitizer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizer.d.ts","sourceRoot":"","sources":["../src/sanitizer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"sanitizer.d.ts","sourceRoot":"","sources":["../src/sanitizer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiCH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA0DjD"}
|
package/dist/sanitizer.js
CHANGED
|
@@ -24,6 +24,15 @@ const ALLOWED_TAGS = new Set([
|
|
|
24
24
|
'sub',
|
|
25
25
|
'a',
|
|
26
26
|
'button',
|
|
27
|
+
// SVG elements (for inline Lucide icons in config HTML)
|
|
28
|
+
'svg',
|
|
29
|
+
'path',
|
|
30
|
+
'circle',
|
|
31
|
+
'line',
|
|
32
|
+
'polyline',
|
|
33
|
+
'polygon',
|
|
34
|
+
'rect',
|
|
35
|
+
'g',
|
|
27
36
|
]);
|
|
28
37
|
export function sanitizeHtml(html) {
|
|
29
38
|
// Try native Sanitizer API first
|
package/dist/summarize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summarize.d.ts","sourceRoot":"","sources":["../src/summarize.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"summarize.d.ts","sourceRoot":"","sources":["../src/summarize.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAY9C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwBzD;AAYD;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,aAAa,EACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,MAAM,CAiCR"}
|
package/dist/summarize.js
CHANGED
|
@@ -6,9 +6,13 @@
|
|
|
6
6
|
const MAX_TEXT_LEN = 40;
|
|
7
7
|
/** Extract the CSS selector string from an anchorId object. */
|
|
8
8
|
function resolveAnchorSelector(anchorId) {
|
|
9
|
-
if (!anchorId
|
|
9
|
+
if (!anchorId)
|
|
10
10
|
return '';
|
|
11
|
-
|
|
11
|
+
if (typeof anchorId === 'string')
|
|
12
|
+
return anchorId;
|
|
13
|
+
if (typeof anchorId === 'object')
|
|
14
|
+
return anchorId.selector ?? '';
|
|
15
|
+
return '';
|
|
12
16
|
}
|
|
13
17
|
/**
|
|
14
18
|
* Convert a CSS selector into a human-friendly element description.
|
package/package.json
CHANGED