@syntrologie/adapt-content 2.8.0-canary.8 → 2.8.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.
@@ -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;AAkLhD,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"}
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
@@ -20,9 +20,8 @@ function resolveAnchorSelector(anchorId) {
20
20
  return '';
21
21
  if (typeof anchorId === 'string')
22
22
  return anchorId;
23
- if (typeof anchorId === 'object' && 'selector' in anchorId) {
24
- return anchorId.selector;
25
- }
23
+ if (typeof anchorId === 'object')
24
+ return anchorId.selector ?? '';
26
25
  return '';
27
26
  }
28
27
  /** Extract the target route from an AnchorId object, ignoring wildcard '**'. */
@@ -317,7 +316,7 @@ export function ContentEditor({ config, onChange, editor }) {
317
316
  // Add a new textReplacement to the config
318
317
  const existing = typedConfig.textReplacements || [];
319
318
  const newItem = {
320
- anchorId: createAnchorId,
319
+ anchorId: { selector: createAnchorId, route: '**' },
321
320
  text: createText,
322
321
  summary: `Set text on ${createAnchorId}`,
323
322
  };
@@ -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,CAoDZ"}
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();
@@ -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,CA+H9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CAmCxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CA4DxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CAkC1D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAAc,CAAC,iBAAiB,CAkChE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,cAAc,CAAC,cAAc,CAmD1D,CAAC;AAMF;;;GAGG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;EAOZ,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAMnB,CAAC"}
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 (action.position === 'replace' && originalContent !== null) {
113
- // Restore original element
114
- const restoredEl = document.createElement(anchorEl.tagName);
115
- restoredEl.innerHTML = originalContent;
116
- // Copy attributes
117
- Array.from(anchorEl.attributes).forEach((attr) => {
118
- restoredEl.setAttribute(attr.name, attr.value);
119
- });
120
- container.replaceWith(restoredEl);
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
- else {
123
- container.remove();
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) {
@@ -1 +1 @@
1
- {"version":3,"file":"sanitizer.d.ts","sourceRoot":"","sources":["../src/sanitizer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwBH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA0DjD"}
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/schema.d.ts CHANGED
@@ -11,52 +11,106 @@ import { z } from 'zod';
11
11
  export declare const configSchema: z.ZodObject<{
12
12
  /** Text replacements */
13
13
  textReplacements: z.ZodOptional<z.ZodArray<z.ZodObject<{
14
- anchorId: z.ZodString;
14
+ anchorId: z.ZodObject<{
15
+ selector: z.ZodString;
16
+ route: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
17
+ }, "strict", z.ZodTypeAny, {
18
+ selector: string;
19
+ route: string | string[];
20
+ }, {
21
+ selector: string;
22
+ route: string | string[];
23
+ }>;
15
24
  summary: z.ZodString;
16
25
  text: z.ZodString;
17
26
  }, "strip", z.ZodTypeAny, {
18
27
  summary: string;
19
28
  text: string;
20
- anchorId: string;
29
+ anchorId: {
30
+ selector: string;
31
+ route: string | string[];
32
+ };
21
33
  }, {
22
34
  summary: string;
23
35
  text: string;
24
- anchorId: string;
36
+ anchorId: {
37
+ selector: string;
38
+ route: string | string[];
39
+ };
25
40
  }>, "many">>;
26
41
  /** Attribute modifications */
27
42
  attributeChanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
28
- anchorId: z.ZodString;
43
+ anchorId: z.ZodObject<{
44
+ selector: z.ZodString;
45
+ route: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
46
+ }, "strict", z.ZodTypeAny, {
47
+ selector: string;
48
+ route: string | string[];
49
+ }, {
50
+ selector: string;
51
+ route: string | string[];
52
+ }>;
29
53
  summary: z.ZodString;
30
54
  attr: z.ZodString;
31
55
  value: z.ZodString;
32
56
  }, "strip", z.ZodTypeAny, {
33
57
  summary: string;
34
- anchorId: string;
58
+ anchorId: {
59
+ selector: string;
60
+ route: string | string[];
61
+ };
35
62
  value: string;
36
63
  attr: string;
37
64
  }, {
38
65
  summary: string;
39
- anchorId: string;
66
+ anchorId: {
67
+ selector: string;
68
+ route: string | string[];
69
+ };
40
70
  value: string;
41
71
  attr: string;
42
72
  }>, "many">>;
43
73
  /** Style modifications */
44
74
  styleChanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
45
- anchorId: z.ZodString;
75
+ anchorId: z.ZodObject<{
76
+ selector: z.ZodString;
77
+ route: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
78
+ }, "strict", z.ZodTypeAny, {
79
+ selector: string;
80
+ route: string | string[];
81
+ }, {
82
+ selector: string;
83
+ route: string | string[];
84
+ }>;
46
85
  summary: z.ZodString;
47
86
  styles: z.ZodRecord<z.ZodString, z.ZodString>;
48
87
  }, "strip", z.ZodTypeAny, {
49
88
  summary: string;
50
- anchorId: string;
89
+ anchorId: {
90
+ selector: string;
91
+ route: string | string[];
92
+ };
51
93
  styles: Record<string, string>;
52
94
  }, {
53
95
  summary: string;
54
- anchorId: string;
96
+ anchorId: {
97
+ selector: string;
98
+ route: string | string[];
99
+ };
55
100
  styles: Record<string, string>;
56
101
  }>, "many">>;
57
102
  /** HTML insertions */
58
103
  htmlInsertions: z.ZodOptional<z.ZodArray<z.ZodObject<{
59
- anchorId: z.ZodString;
104
+ anchorId: z.ZodObject<{
105
+ selector: z.ZodString;
106
+ route: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
107
+ }, "strict", z.ZodTypeAny, {
108
+ selector: string;
109
+ route: string | string[];
110
+ }, {
111
+ selector: string;
112
+ route: string | string[];
113
+ }>;
60
114
  summary: z.ZodString;
61
115
  html: z.ZodString;
62
116
  position: z.ZodEnum<["before", "after", "prepend", "append", "replace"]>;
@@ -64,106 +118,178 @@ export declare const configSchema: z.ZodObject<{
64
118
  html: string;
65
119
  summary: string;
66
120
  position: "replace" | "before" | "after" | "prepend" | "append";
67
- anchorId: string;
121
+ anchorId: {
122
+ selector: string;
123
+ route: string | string[];
124
+ };
68
125
  }, {
69
126
  html: string;
70
127
  summary: string;
71
128
  position: "replace" | "before" | "after" | "prepend" | "append";
72
- anchorId: string;
129
+ anchorId: {
130
+ selector: string;
131
+ route: string | string[];
132
+ };
73
133
  }>, "many">>;
74
134
  /** Class additions */
75
135
  classAdditions: z.ZodOptional<z.ZodArray<z.ZodObject<{
76
- anchorId: z.ZodString;
136
+ anchorId: z.ZodObject<{
137
+ selector: z.ZodString;
138
+ route: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
139
+ }, "strict", z.ZodTypeAny, {
140
+ selector: string;
141
+ route: string | string[];
142
+ }, {
143
+ selector: string;
144
+ route: string | string[];
145
+ }>;
77
146
  summary: z.ZodString;
78
147
  className: z.ZodString;
79
148
  }, "strip", z.ZodTypeAny, {
80
149
  summary: string;
81
150
  className: string;
82
- anchorId: string;
151
+ anchorId: {
152
+ selector: string;
153
+ route: string | string[];
154
+ };
83
155
  }, {
84
156
  summary: string;
85
157
  className: string;
86
- anchorId: string;
158
+ anchorId: {
159
+ selector: string;
160
+ route: string | string[];
161
+ };
87
162
  }>, "many">>;
88
163
  /** Class removals */
89
164
  classRemovals: z.ZodOptional<z.ZodArray<z.ZodObject<{
90
- anchorId: z.ZodString;
165
+ anchorId: z.ZodObject<{
166
+ selector: z.ZodString;
167
+ route: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
168
+ }, "strict", z.ZodTypeAny, {
169
+ selector: string;
170
+ route: string | string[];
171
+ }, {
172
+ selector: string;
173
+ route: string | string[];
174
+ }>;
91
175
  summary: z.ZodString;
92
176
  className: z.ZodString;
93
177
  }, "strip", z.ZodTypeAny, {
94
178
  summary: string;
95
179
  className: string;
96
- anchorId: string;
180
+ anchorId: {
181
+ selector: string;
182
+ route: string | string[];
183
+ };
97
184
  }, {
98
185
  summary: string;
99
186
  className: string;
100
- anchorId: string;
187
+ anchorId: {
188
+ selector: string;
189
+ route: string | string[];
190
+ };
101
191
  }>, "many">>;
102
192
  }, "strip", z.ZodTypeAny, {
103
193
  textReplacements?: {
104
194
  summary: string;
105
195
  text: string;
106
- anchorId: string;
196
+ anchorId: {
197
+ selector: string;
198
+ route: string | string[];
199
+ };
107
200
  }[] | undefined;
108
201
  attributeChanges?: {
109
202
  summary: string;
110
- anchorId: string;
203
+ anchorId: {
204
+ selector: string;
205
+ route: string | string[];
206
+ };
111
207
  value: string;
112
208
  attr: string;
113
209
  }[] | undefined;
114
210
  styleChanges?: {
115
211
  summary: string;
116
- anchorId: string;
212
+ anchorId: {
213
+ selector: string;
214
+ route: string | string[];
215
+ };
117
216
  styles: Record<string, string>;
118
217
  }[] | undefined;
119
218
  htmlInsertions?: {
120
219
  html: string;
121
220
  summary: string;
122
221
  position: "replace" | "before" | "after" | "prepend" | "append";
123
- anchorId: string;
222
+ anchorId: {
223
+ selector: string;
224
+ route: string | string[];
225
+ };
124
226
  }[] | undefined;
125
227
  classAdditions?: {
126
228
  summary: string;
127
229
  className: string;
128
- anchorId: string;
230
+ anchorId: {
231
+ selector: string;
232
+ route: string | string[];
233
+ };
129
234
  }[] | undefined;
130
235
  classRemovals?: {
131
236
  summary: string;
132
237
  className: string;
133
- anchorId: string;
238
+ anchorId: {
239
+ selector: string;
240
+ route: string | string[];
241
+ };
134
242
  }[] | undefined;
135
243
  }, {
136
244
  textReplacements?: {
137
245
  summary: string;
138
246
  text: string;
139
- anchorId: string;
247
+ anchorId: {
248
+ selector: string;
249
+ route: string | string[];
250
+ };
140
251
  }[] | undefined;
141
252
  attributeChanges?: {
142
253
  summary: string;
143
- anchorId: string;
254
+ anchorId: {
255
+ selector: string;
256
+ route: string | string[];
257
+ };
144
258
  value: string;
145
259
  attr: string;
146
260
  }[] | undefined;
147
261
  styleChanges?: {
148
262
  summary: string;
149
- anchorId: string;
263
+ anchorId: {
264
+ selector: string;
265
+ route: string | string[];
266
+ };
150
267
  styles: Record<string, string>;
151
268
  }[] | undefined;
152
269
  htmlInsertions?: {
153
270
  html: string;
154
271
  summary: string;
155
272
  position: "replace" | "before" | "after" | "prepend" | "append";
156
- anchorId: string;
273
+ anchorId: {
274
+ selector: string;
275
+ route: string | string[];
276
+ };
157
277
  }[] | undefined;
158
278
  classAdditions?: {
159
279
  summary: string;
160
280
  className: string;
161
- anchorId: string;
281
+ anchorId: {
282
+ selector: string;
283
+ route: string | string[];
284
+ };
162
285
  }[] | undefined;
163
286
  classRemovals?: {
164
287
  summary: string;
165
288
  className: string;
166
- anchorId: string;
289
+ anchorId: {
290
+ selector: string;
291
+ route: string | string[];
292
+ };
167
293
  }[] | undefined;
168
294
  }>;
169
295
  export type ContentConfig = z.infer<typeof configSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,YAAY;IACvB,wBAAwB;;;;;;;;;;;;;;IAWxB,8BAA8B;;;;;;;;;;;;;;;;;IAY9B,0BAA0B;;;;;;;;;;;;;;IAW1B,sBAAsB;;;;;;;;;;;;;;;;;IAYtB,sBAAsB;;;;;;;;;;;;;;IAWtB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUrB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,YAAY;IACvB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWxB,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAY9B,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAW1B,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAYtB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAWtB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUrB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
package/dist/schema.js CHANGED
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * Zod schema for validating content app configuration.
5
5
  */
6
+ import { AnchorIdZ } from '@syntrologie/sdk-contracts';
6
7
  import { z } from 'zod';
7
8
  /**
8
9
  * Content app config schema.
@@ -12,7 +13,7 @@ export const configSchema = z.object({
12
13
  /** Text replacements */
13
14
  textReplacements: z
14
15
  .array(z.object({
15
- anchorId: z.string(),
16
+ anchorId: AnchorIdZ,
16
17
  summary: z.string(),
17
18
  text: z.string(),
18
19
  }))
@@ -20,7 +21,7 @@ export const configSchema = z.object({
20
21
  /** Attribute modifications */
21
22
  attributeChanges: z
22
23
  .array(z.object({
23
- anchorId: z.string(),
24
+ anchorId: AnchorIdZ,
24
25
  summary: z.string(),
25
26
  attr: z.string(),
26
27
  value: z.string(),
@@ -29,7 +30,7 @@ export const configSchema = z.object({
29
30
  /** Style modifications */
30
31
  styleChanges: z
31
32
  .array(z.object({
32
- anchorId: z.string(),
33
+ anchorId: AnchorIdZ,
33
34
  summary: z.string(),
34
35
  styles: z.record(z.string()),
35
36
  }))
@@ -37,7 +38,7 @@ export const configSchema = z.object({
37
38
  /** HTML insertions */
38
39
  htmlInsertions: z
39
40
  .array(z.object({
40
- anchorId: z.string(),
41
+ anchorId: AnchorIdZ,
41
42
  summary: z.string(),
42
43
  html: z.string(),
43
44
  position: z.enum(['before', 'after', 'prepend', 'append', 'replace']),
@@ -46,7 +47,7 @@ export const configSchema = z.object({
46
47
  /** Class additions */
47
48
  classAdditions: z
48
49
  .array(z.object({
49
- anchorId: z.string(),
50
+ anchorId: AnchorIdZ,
50
51
  summary: z.string(),
51
52
  className: z.string(),
52
53
  }))
@@ -54,7 +55,7 @@ export const configSchema = z.object({
54
55
  /** Class removals */
55
56
  classRemovals: z
56
57
  .array(z.object({
57
- anchorId: z.string(),
58
+ anchorId: AnchorIdZ,
58
59
  summary: z.string(),
59
60
  className: z.string(),
60
61
  }))
@@ -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;AAc9C;;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"}
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
@@ -4,15 +4,14 @@
4
4
  * Pure functions — no DOM access, just string formatting from config data.
5
5
  */
6
6
  const MAX_TEXT_LEN = 40;
7
- /** Extract the CSS selector string from an anchorId (object or legacy string). */
7
+ /** Extract the CSS selector string from an anchorId object. */
8
8
  function resolveAnchorSelector(anchorId) {
9
9
  if (!anchorId)
10
10
  return '';
11
11
  if (typeof anchorId === 'string')
12
12
  return anchorId;
13
- if (typeof anchorId === 'object' && 'selector' in anchorId) {
14
- return anchorId.selector;
15
- }
13
+ if (typeof anchorId === 'object')
14
+ return anchorId.selector ?? '';
16
15
  return '';
17
16
  }
18
17
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@syntrologie/adapt-content",
3
- "version": "2.8.0-canary.8",
3
+ "version": "2.8.0",
4
4
  "description": "Adaptive Content app - DOM manipulation actions for text, attributes, and styles",
5
5
  "license": "Proprietary",
6
6
  "private": false,