@syntrologie/adapt-content 2.8.0-canary.15 → 2.8.0-canary.151
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/runtime.d.ts.map +1 -1
- package/dist/runtime.js +22 -4
- package/dist/sanitizer.d.ts.map +1 -1
- package/dist/sanitizer.js +7 -0
- package/dist/schema.d.ts +16 -16
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +90 -40
- package/package.json +7 -25
- package/dist/cdn.d.ts +0 -35
- package/dist/cdn.d.ts.map +0 -1
- package/dist/cdn.js +0 -39
- package/dist/components/AnchorPicker.d.ts +0 -8
- package/dist/components/AnchorPicker.d.ts.map +0 -1
- package/dist/components/AnchorPicker.js +0 -6
- package/dist/editor.d.ts +0 -27
- package/dist/editor.d.ts.map +0 -1
- package/dist/editor.js +0 -417
- package/dist/utils/selectorGenerator.d.ts +0 -6
- package/dist/utils/selectorGenerator.d.ts.map +0 -1
- package/dist/utils/selectorGenerator.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts +0 -2
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/cn.js +0 -3
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts +0 -34
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/AnchorPicker.js +0 -160
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/BeforeAfterToggle.js +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts +0 -23
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ConditionStatusLine.js +0 -40
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DetectionBadge.js +0 -22
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/DismissedSection.js +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditBackButton.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorBody.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts +0 -13
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorCard.js +0 -15
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorFooter.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts +0 -9
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorHeader.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorInput.js +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts +0 -7
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorLayout.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorPanelShell.js +0 -379
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorSelect.js +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EditorTextarea.js +0 -17
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts +0 -32
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/ElementHighlight.js +0 -87
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts +0 -6
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/EmptyState.js +0 -4
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/GroupHeader.js +0 -5
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts +0 -12
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/components/TriggerJourney.js +0 -40
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts +0 -26
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/formatConditionLabel.js +0 -202
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts +0 -8
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useElementRect.js +0 -46
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts +0 -24
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/hooks/useTriggerWhenStatus.js +0 -87
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts +0 -34
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/index.js +0 -25
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts +0 -37
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/elementChainRecommender.js +0 -52
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts +0 -22
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.d.ts.map +0 -1
- package/node_modules/@syntrologie/shared-editor-ui/dist/utils/selectorGenerator.js +0 -143
- package/node_modules/@syntrologie/shared-editor-ui/package.json +0 -45
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,CAqI9D,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;AAmBF;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,cAAc,CAAC,aAAa,CAsCxD,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
|
@@ -138,6 +138,23 @@ export const executeInsertHtml = async (action, context) => {
|
|
|
138
138
|
},
|
|
139
139
|
};
|
|
140
140
|
};
|
|
141
|
+
/**
|
|
142
|
+
* Walk the DOM to find the deepest descendant that uniquely carries
|
|
143
|
+
* text content. Avoids destroying sibling elements (icons, images)
|
|
144
|
+
* when setting text on a container like a button.
|
|
145
|
+
*/
|
|
146
|
+
function findTextTarget(el) {
|
|
147
|
+
if (el.children.length === 0)
|
|
148
|
+
return el;
|
|
149
|
+
const textChildren = Array.from(el.children).filter((child) => child.textContent?.trim());
|
|
150
|
+
if (textChildren.length === 1) {
|
|
151
|
+
const child = textChildren[0];
|
|
152
|
+
if (child.textContent?.trim() === el.textContent?.trim()) {
|
|
153
|
+
return findTextTarget(child);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return el;
|
|
157
|
+
}
|
|
141
158
|
/**
|
|
142
159
|
* Execute a setText action
|
|
143
160
|
*/
|
|
@@ -150,10 +167,11 @@ export const executeSetText = async (action, context) => {
|
|
|
150
167
|
console.warn(`[adaptive-content] Anchor not found after waiting: ${action.anchorId.selector}`);
|
|
151
168
|
return { cleanup: () => { } };
|
|
152
169
|
}
|
|
170
|
+
const textTarget = findTextTarget(anchorEl);
|
|
153
171
|
// Snapshot original text
|
|
154
|
-
const originalText =
|
|
172
|
+
const originalText = textTarget.textContent ?? '';
|
|
155
173
|
// Set new text
|
|
156
|
-
|
|
174
|
+
textTarget.textContent = action.text;
|
|
157
175
|
context.publishEvent('action.applied', {
|
|
158
176
|
id: context.generateId(),
|
|
159
177
|
kind: 'content:setText',
|
|
@@ -163,11 +181,11 @@ export const executeSetText = async (action, context) => {
|
|
|
163
181
|
cleanup: () => {
|
|
164
182
|
if (!anchorEl.isConnected)
|
|
165
183
|
return;
|
|
166
|
-
|
|
184
|
+
textTarget.textContent = originalText;
|
|
167
185
|
},
|
|
168
186
|
updateFn: (changes) => {
|
|
169
187
|
if ('text' in changes && typeof changes.text === 'string') {
|
|
170
|
-
|
|
188
|
+
textTarget.textContent = changes.text;
|
|
171
189
|
}
|
|
172
190
|
},
|
|
173
191
|
};
|
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;AAiCH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,
|
|
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,CAkEjD"}
|
package/dist/sanitizer.js
CHANGED
|
@@ -77,6 +77,13 @@ export function sanitizeHtml(html) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
+
// Strip SVG elements that contained script children (XSS vector)
|
|
81
|
+
const svgs = Array.from(root.querySelectorAll('svg'));
|
|
82
|
+
for (const svg of svgs) {
|
|
83
|
+
if (toRemove.some((el) => svg.contains(el) && el.tagName.toLowerCase() === 'script')) {
|
|
84
|
+
toRemove.push(svg);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
80
87
|
// Remove disallowed elements but keep their children
|
|
81
88
|
for (const el of toRemove) {
|
|
82
89
|
while (el.firstChild) {
|
package/dist/schema.d.ts
CHANGED
|
@@ -59,16 +59,16 @@ export declare const configSchema: z.ZodObject<{
|
|
|
59
59
|
selector: string;
|
|
60
60
|
route: string | string[];
|
|
61
61
|
};
|
|
62
|
-
value: string;
|
|
63
62
|
attr: string;
|
|
63
|
+
value: string;
|
|
64
64
|
}, {
|
|
65
65
|
summary: string;
|
|
66
66
|
anchorId: {
|
|
67
67
|
selector: string;
|
|
68
68
|
route: string | string[];
|
|
69
69
|
};
|
|
70
|
-
value: string;
|
|
71
70
|
attr: string;
|
|
71
|
+
value: string;
|
|
72
72
|
}>, "many">>;
|
|
73
73
|
/** Style modifications */
|
|
74
74
|
styleChanges: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -117,19 +117,19 @@ export declare const configSchema: z.ZodObject<{
|
|
|
117
117
|
}, "strip", z.ZodTypeAny, {
|
|
118
118
|
html: string;
|
|
119
119
|
summary: string;
|
|
120
|
-
position: "replace" | "before" | "after" | "prepend" | "append";
|
|
121
120
|
anchorId: {
|
|
122
121
|
selector: string;
|
|
123
122
|
route: string | string[];
|
|
124
123
|
};
|
|
124
|
+
position: "before" | "after" | "prepend" | "append" | "replace";
|
|
125
125
|
}, {
|
|
126
126
|
html: string;
|
|
127
127
|
summary: string;
|
|
128
|
-
position: "replace" | "before" | "after" | "prepend" | "append";
|
|
129
128
|
anchorId: {
|
|
130
129
|
selector: string;
|
|
131
130
|
route: string | string[];
|
|
132
131
|
};
|
|
132
|
+
position: "before" | "after" | "prepend" | "append" | "replace";
|
|
133
133
|
}>, "many">>;
|
|
134
134
|
/** Class additions */
|
|
135
135
|
classAdditions: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -147,18 +147,18 @@ export declare const configSchema: z.ZodObject<{
|
|
|
147
147
|
className: z.ZodString;
|
|
148
148
|
}, "strip", z.ZodTypeAny, {
|
|
149
149
|
summary: string;
|
|
150
|
-
className: string;
|
|
151
150
|
anchorId: {
|
|
152
151
|
selector: string;
|
|
153
152
|
route: string | string[];
|
|
154
153
|
};
|
|
154
|
+
className: string;
|
|
155
155
|
}, {
|
|
156
156
|
summary: string;
|
|
157
|
-
className: string;
|
|
158
157
|
anchorId: {
|
|
159
158
|
selector: string;
|
|
160
159
|
route: string | string[];
|
|
161
160
|
};
|
|
161
|
+
className: string;
|
|
162
162
|
}>, "many">>;
|
|
163
163
|
/** Class removals */
|
|
164
164
|
classRemovals: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -176,18 +176,18 @@ export declare const configSchema: z.ZodObject<{
|
|
|
176
176
|
className: z.ZodString;
|
|
177
177
|
}, "strip", z.ZodTypeAny, {
|
|
178
178
|
summary: string;
|
|
179
|
-
className: string;
|
|
180
179
|
anchorId: {
|
|
181
180
|
selector: string;
|
|
182
181
|
route: string | string[];
|
|
183
182
|
};
|
|
183
|
+
className: string;
|
|
184
184
|
}, {
|
|
185
185
|
summary: string;
|
|
186
|
-
className: string;
|
|
187
186
|
anchorId: {
|
|
188
187
|
selector: string;
|
|
189
188
|
route: string | string[];
|
|
190
189
|
};
|
|
190
|
+
className: string;
|
|
191
191
|
}>, "many">>;
|
|
192
192
|
}, "strip", z.ZodTypeAny, {
|
|
193
193
|
textReplacements?: {
|
|
@@ -204,8 +204,8 @@ export declare const configSchema: z.ZodObject<{
|
|
|
204
204
|
selector: string;
|
|
205
205
|
route: string | string[];
|
|
206
206
|
};
|
|
207
|
-
value: string;
|
|
208
207
|
attr: string;
|
|
208
|
+
value: string;
|
|
209
209
|
}[] | undefined;
|
|
210
210
|
styleChanges?: {
|
|
211
211
|
summary: string;
|
|
@@ -218,27 +218,27 @@ export declare const configSchema: z.ZodObject<{
|
|
|
218
218
|
htmlInsertions?: {
|
|
219
219
|
html: string;
|
|
220
220
|
summary: string;
|
|
221
|
-
position: "replace" | "before" | "after" | "prepend" | "append";
|
|
222
221
|
anchorId: {
|
|
223
222
|
selector: string;
|
|
224
223
|
route: string | string[];
|
|
225
224
|
};
|
|
225
|
+
position: "before" | "after" | "prepend" | "append" | "replace";
|
|
226
226
|
}[] | undefined;
|
|
227
227
|
classAdditions?: {
|
|
228
228
|
summary: string;
|
|
229
|
-
className: string;
|
|
230
229
|
anchorId: {
|
|
231
230
|
selector: string;
|
|
232
231
|
route: string | string[];
|
|
233
232
|
};
|
|
233
|
+
className: string;
|
|
234
234
|
}[] | undefined;
|
|
235
235
|
classRemovals?: {
|
|
236
236
|
summary: string;
|
|
237
|
-
className: string;
|
|
238
237
|
anchorId: {
|
|
239
238
|
selector: string;
|
|
240
239
|
route: string | string[];
|
|
241
240
|
};
|
|
241
|
+
className: string;
|
|
242
242
|
}[] | undefined;
|
|
243
243
|
}, {
|
|
244
244
|
textReplacements?: {
|
|
@@ -255,8 +255,8 @@ export declare const configSchema: z.ZodObject<{
|
|
|
255
255
|
selector: string;
|
|
256
256
|
route: string | string[];
|
|
257
257
|
};
|
|
258
|
-
value: string;
|
|
259
258
|
attr: string;
|
|
259
|
+
value: string;
|
|
260
260
|
}[] | undefined;
|
|
261
261
|
styleChanges?: {
|
|
262
262
|
summary: string;
|
|
@@ -269,27 +269,27 @@ export declare const configSchema: z.ZodObject<{
|
|
|
269
269
|
htmlInsertions?: {
|
|
270
270
|
html: string;
|
|
271
271
|
summary: string;
|
|
272
|
-
position: "replace" | "before" | "after" | "prepend" | "append";
|
|
273
272
|
anchorId: {
|
|
274
273
|
selector: string;
|
|
275
274
|
route: string | string[];
|
|
276
275
|
};
|
|
276
|
+
position: "before" | "after" | "prepend" | "append" | "replace";
|
|
277
277
|
}[] | undefined;
|
|
278
278
|
classAdditions?: {
|
|
279
279
|
summary: string;
|
|
280
|
-
className: string;
|
|
281
280
|
anchorId: {
|
|
282
281
|
selector: string;
|
|
283
282
|
route: string | string[];
|
|
284
283
|
};
|
|
284
|
+
className: string;
|
|
285
285
|
}[] | undefined;
|
|
286
286
|
classRemovals?: {
|
|
287
287
|
summary: string;
|
|
288
|
-
className: string;
|
|
289
288
|
anchorId: {
|
|
290
289
|
selector: string;
|
|
291
290
|
route: string | string[];
|
|
292
291
|
};
|
|
292
|
+
className: string;
|
|
293
293
|
}[] | undefined;
|
|
294
294
|
}>;
|
|
295
295
|
export type ContentConfig = z.infer<typeof configSchema>;
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;IAErB,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAwBxB,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA+B9B,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA0B1B,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqCtB,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA8BtB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCtB,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC"}
|
package/dist/schema.js
CHANGED
|
@@ -9,55 +9,105 @@ import { z } from 'zod';
|
|
|
9
9
|
* Content app config schema.
|
|
10
10
|
* Defines the structure for content modifications in a canvas config.
|
|
11
11
|
*/
|
|
12
|
-
export const configSchema = z
|
|
12
|
+
export const configSchema = z
|
|
13
|
+
.object({
|
|
13
14
|
/** Text replacements */
|
|
14
15
|
textReplacements: z
|
|
15
|
-
.array(z
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
.array(z
|
|
17
|
+
.object({
|
|
18
|
+
anchorId: AnchorIdZ.describe('Route and CSS selector identifying the element whose text content to replace.'),
|
|
19
|
+
summary: z
|
|
20
|
+
.string()
|
|
21
|
+
.describe('Human-readable description of this change, used for logging and debugging.'),
|
|
22
|
+
text: z
|
|
23
|
+
.string()
|
|
24
|
+
.describe('New text content to set on the element (replaces existing text).'),
|
|
25
|
+
})
|
|
26
|
+
.describe('A single text replacement: replaces the text content of a matched element.'))
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Replaces the visible text of DOM elements. Use for copy changes, headline personalization, or CTA label swaps.'),
|
|
21
29
|
/** Attribute modifications */
|
|
22
30
|
attributeChanges: z
|
|
23
|
-
.array(z
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
.array(z
|
|
32
|
+
.object({
|
|
33
|
+
anchorId: AnchorIdZ.describe('Route and CSS selector identifying the element whose attribute to set.'),
|
|
34
|
+
summary: z
|
|
35
|
+
.string()
|
|
36
|
+
.describe('Human-readable description of this change, used for logging and debugging.'),
|
|
37
|
+
attr: z
|
|
38
|
+
.string()
|
|
39
|
+
.min(1, 'Attribute name must not be empty — setAttribute("", ...) throws InvalidCharacterError in all browsers.')
|
|
40
|
+
.describe('HTML attribute name to set (e.g. "href", "src", "data-experiment"). Event handler attributes are blocked.'),
|
|
41
|
+
value: z.string().describe('New attribute value to apply.'),
|
|
42
|
+
})
|
|
43
|
+
.describe('A single attribute change: sets one HTML attribute on a matched element.'))
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('Sets HTML attributes on DOM elements. Use for href swaps, src changes, or adding data-* experiment markers. Event handlers (onclick, onerror, etc.) are blocked.'),
|
|
30
46
|
/** Style modifications */
|
|
31
47
|
styleChanges: z
|
|
32
|
-
.array(z
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
.array(z
|
|
49
|
+
.object({
|
|
50
|
+
anchorId: AnchorIdZ.describe('Route and CSS selector identifying the element to restyle.'),
|
|
51
|
+
summary: z
|
|
52
|
+
.string()
|
|
53
|
+
.describe('Human-readable description of this change, used for logging and debugging.'),
|
|
54
|
+
styles: z
|
|
55
|
+
.record(z.string())
|
|
56
|
+
.describe('Map of CSS property → value pairs applied as inline styles (e.g. {"background-color": "#1e40af", "padding": "2rem"}).'),
|
|
57
|
+
})
|
|
58
|
+
.describe('A single style change: sets inline CSS properties on a matched element.'))
|
|
59
|
+
.optional()
|
|
60
|
+
.describe('Sets inline CSS styles on DOM elements. Use for color, spacing, or visibility changes without modifying the stylesheet.'),
|
|
38
61
|
/** HTML insertions */
|
|
39
62
|
htmlInsertions: z
|
|
40
|
-
.array(z
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
63
|
+
.array(z
|
|
64
|
+
.object({
|
|
65
|
+
anchorId: AnchorIdZ.describe('Route and CSS selector identifying the reference element for the insertion.'),
|
|
66
|
+
summary: z
|
|
67
|
+
.string()
|
|
68
|
+
.describe('Human-readable description of this change, used for logging and debugging.'),
|
|
69
|
+
html: z
|
|
70
|
+
.string()
|
|
71
|
+
.min(1, 'HTML string must not be empty — an empty html with position "replace" silently swaps the anchor element for an empty div.')
|
|
72
|
+
.describe('HTML string to insert. The SDK sanitizes it before injection — no script tags.'),
|
|
73
|
+
position: z
|
|
74
|
+
.enum(['before', 'after', 'prepend', 'append', 'replace'])
|
|
75
|
+
.describe('"before"/"after" inserts adjacent to the element; "prepend"/"append" inserts inside at the start/end; "replace" swaps the entire element.'),
|
|
76
|
+
})
|
|
77
|
+
.describe('A single HTML insertion: injects a sanitized HTML fragment relative to a matched element.'))
|
|
78
|
+
.optional()
|
|
79
|
+
.describe('Inserts sanitized HTML fragments relative to DOM elements. Use for adding badges, banners, or supplementary content. Do NOT embed JavaScript — use deepLink for canvas navigation.'),
|
|
47
80
|
/** Class additions */
|
|
48
81
|
classAdditions: z
|
|
49
|
-
.array(z
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
82
|
+
.array(z
|
|
83
|
+
.object({
|
|
84
|
+
anchorId: AnchorIdZ.describe('Route and CSS selector identifying the element to add the class to.'),
|
|
85
|
+
summary: z
|
|
86
|
+
.string()
|
|
87
|
+
.describe('Human-readable description of this change, used for logging and debugging.'),
|
|
88
|
+
className: z
|
|
89
|
+
.string()
|
|
90
|
+
.min(1, 'Class name must not be empty — classList.add("") throws DOMException in all browsers.')
|
|
91
|
+
.describe('CSS class name to add to the element\'s class list (e.g. "highlighted", "is-active").'),
|
|
92
|
+
})
|
|
93
|
+
.describe('A single class addition: appends one CSS class to a matched element.'))
|
|
94
|
+
.optional()
|
|
95
|
+
.describe('Adds CSS classes to DOM elements. Use to toggle visibility, apply highlight styles, or trigger CSS animations already defined in the host stylesheet.'),
|
|
55
96
|
/** Class removals */
|
|
56
97
|
classRemovals: z
|
|
57
|
-
.array(z
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
98
|
+
.array(z
|
|
99
|
+
.object({
|
|
100
|
+
anchorId: AnchorIdZ.describe('Route and CSS selector identifying the element to remove the class from.'),
|
|
101
|
+
summary: z
|
|
102
|
+
.string()
|
|
103
|
+
.describe('Human-readable description of this change, used for logging and debugging.'),
|
|
104
|
+
className: z
|
|
105
|
+
.string()
|
|
106
|
+
.min(1, 'Class name must not be empty — classList.remove("") throws DOMException in all browsers.')
|
|
107
|
+
.describe('CSS class name to remove from the element\'s class list (e.g. "hidden", "disabled").'),
|
|
108
|
+
})
|
|
109
|
+
.describe('A single class removal: removes one CSS class from a matched element.'))
|
|
110
|
+
.optional()
|
|
111
|
+
.describe('Removes CSS classes from DOM elements. Use to reveal hidden elements, remove disabled states, or undo class-based styling.'),
|
|
112
|
+
})
|
|
113
|
+
.describe('Props for adaptive-content DOM mutation operations. Each field targets a list of elements by anchorId and applies a specific type of change (text, attribute, style, HTML, or class).');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syntrologie/adapt-content",
|
|
3
|
-
"version": "2.8.0-canary.
|
|
3
|
+
"version": "2.8.0-canary.151",
|
|
4
4
|
"description": "Adaptive Content app - DOM manipulation actions for text, attributes, and styles",
|
|
5
5
|
"license": "Proprietary",
|
|
6
6
|
"private": false,
|
|
@@ -22,18 +22,11 @@
|
|
|
22
22
|
"./schema": {
|
|
23
23
|
"types": "./dist/schema.d.ts",
|
|
24
24
|
"import": "./dist/schema.js"
|
|
25
|
-
},
|
|
26
|
-
"./editor": {
|
|
27
|
-
"types": "./dist/editor.d.ts",
|
|
28
|
-
"import": "./dist/editor.js"
|
|
29
25
|
}
|
|
30
26
|
},
|
|
31
27
|
"files": [
|
|
32
28
|
"dist"
|
|
33
29
|
],
|
|
34
|
-
"bundledDependencies": [
|
|
35
|
-
"@syntrologie/shared-editor-ui"
|
|
36
|
-
],
|
|
37
30
|
"scripts": {
|
|
38
31
|
"prepack": "node ../../../scripts/prepare-bundled-deps.mjs",
|
|
39
32
|
"build": "tsc",
|
|
@@ -43,28 +36,17 @@
|
|
|
43
36
|
"test:watch": "vitest"
|
|
44
37
|
},
|
|
45
38
|
"peerDependencies": {
|
|
46
|
-
"lucide-react": ">=0.400.0",
|
|
47
|
-
"react": ">=18.0.0",
|
|
48
|
-
"react-dom": ">=18.0.0",
|
|
49
39
|
"zod": "^3.0.0"
|
|
50
40
|
},
|
|
51
41
|
"dependencies": {
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"data-urls": "^5.0.0"
|
|
42
|
+
"css-selector-generator": "3.8.0",
|
|
43
|
+
"data-urls": "5.0.0"
|
|
55
44
|
},
|
|
56
45
|
"devDependencies": {
|
|
57
|
-
"@floating-ui/dom": "^1.7.5",
|
|
58
46
|
"@syntrologie/sdk-contracts": "*",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"lucide-react": "^0.576.0",
|
|
64
|
-
"react": "^19.2.0",
|
|
65
|
-
"react-dom": "^19.2.0",
|
|
66
|
-
"typescript": "^5.9.3",
|
|
67
|
-
"vitest": "^4.0.18",
|
|
68
|
-
"zod": "^3.25.76"
|
|
47
|
+
"jsdom": "26.1.0",
|
|
48
|
+
"typescript": "5.9.3",
|
|
49
|
+
"vitest": "4.0.18",
|
|
50
|
+
"zod": "3.25.76"
|
|
69
51
|
}
|
|
70
52
|
}
|
package/dist/cdn.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CDN Entry Point for Adaptive Content
|
|
3
|
-
*
|
|
4
|
-
* This module is bundled for CDN delivery and self-registers with the global
|
|
5
|
-
* SynOS app registry when loaded dynamically via the AppLoader.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* App manifest for registry registration.
|
|
9
|
-
* Follows the AppManifest interface expected by AppLoader/AppRegistry.
|
|
10
|
-
*/
|
|
11
|
-
export declare const manifest: {
|
|
12
|
-
id: string;
|
|
13
|
-
version: string;
|
|
14
|
-
name: string;
|
|
15
|
-
description: string;
|
|
16
|
-
runtime: {
|
|
17
|
-
actions: {
|
|
18
|
-
kind: "content:insertHtml" | "content:setText" | "content:setAttr" | "content:addClass" | "content:removeClass" | "content:setStyle";
|
|
19
|
-
executor: import("packages/sdk-contracts/dist").ActionExecutor<import("./types").InsertHtmlAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").SetTextAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").SetAttrAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").AddClassAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").RemoveClassAction> | import("packages/sdk-contracts/dist").ActionExecutor<import("./types").SetStyleAction>;
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
22
|
-
editor: {
|
|
23
|
-
panel: {
|
|
24
|
-
title: string;
|
|
25
|
-
icon: string;
|
|
26
|
-
description: string;
|
|
27
|
-
};
|
|
28
|
-
component: typeof import("./editor").ContentEditor;
|
|
29
|
-
};
|
|
30
|
-
metadata: {
|
|
31
|
-
isBuiltIn: boolean;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export default manifest;
|
|
35
|
-
//# sourceMappingURL=cdn.d.ts.map
|
package/dist/cdn.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cdn.d.ts","sourceRoot":"","sources":["../src/cdn.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;;GAGG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;CAepB,CAAC;AAaF,eAAe,QAAQ,CAAC"}
|
package/dist/cdn.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CDN Entry Point for Adaptive Content
|
|
3
|
-
*
|
|
4
|
-
* This module is bundled for CDN delivery and self-registers with the global
|
|
5
|
-
* SynOS app registry when loaded dynamically via the AppLoader.
|
|
6
|
-
*/
|
|
7
|
-
import { editor } from './editor';
|
|
8
|
-
import { executors, runtime } from './runtime';
|
|
9
|
-
/**
|
|
10
|
-
* App manifest for registry registration.
|
|
11
|
-
* Follows the AppManifest interface expected by AppLoader/AppRegistry.
|
|
12
|
-
*/
|
|
13
|
-
export const manifest = {
|
|
14
|
-
id: runtime.id,
|
|
15
|
-
version: runtime.version,
|
|
16
|
-
name: runtime.name,
|
|
17
|
-
description: runtime.description,
|
|
18
|
-
runtime: {
|
|
19
|
-
actions: executors.map(({ kind, executor }) => ({
|
|
20
|
-
kind,
|
|
21
|
-
executor,
|
|
22
|
-
})),
|
|
23
|
-
},
|
|
24
|
-
editor,
|
|
25
|
-
metadata: {
|
|
26
|
-
isBuiltIn: true,
|
|
27
|
-
},
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Self-register with global registry if available.
|
|
31
|
-
* This happens when loaded via script tag (UMD).
|
|
32
|
-
*/
|
|
33
|
-
if (typeof window !== 'undefined') {
|
|
34
|
-
const registry = window.SynOS?.appRegistry;
|
|
35
|
-
if (registry && typeof registry.register === 'function') {
|
|
36
|
-
registry.register(manifest);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
export default manifest;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Re-export AnchorPicker from shared-editor-ui.
|
|
3
|
-
* This file exists for backwards compatibility — all consumers should
|
|
4
|
-
* migrate to importing directly from @syntrologie/shared-editor-ui.
|
|
5
|
-
*/
|
|
6
|
-
export type { AnchorPickerProps, PickedElement } from '@syntrologie/shared-editor-ui';
|
|
7
|
-
export { AnchorPicker } from '@syntrologie/shared-editor-ui';
|
|
8
|
-
//# sourceMappingURL=AnchorPicker.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AnchorPicker.d.ts","sourceRoot":"","sources":["../../src/components/AnchorPicker.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/editor.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Adaptive Content - Editor Component
|
|
3
|
-
*
|
|
4
|
-
* Review & tweak editor for AI-generated content modifications.
|
|
5
|
-
* Displays a scannable list of one-liner change summaries.
|
|
6
|
-
* Clicking a card navigates to the element and shows a floating edit panel.
|
|
7
|
-
*/
|
|
8
|
-
import type { EditorPanelProps } from './types';
|
|
9
|
-
export declare function ContentEditor({ config, onChange, editor }: EditorPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
-
/**
|
|
11
|
-
* Editor module configuration.
|
|
12
|
-
*/
|
|
13
|
-
export declare const editor: {
|
|
14
|
-
panel: {
|
|
15
|
-
title: string;
|
|
16
|
-
icon: string;
|
|
17
|
-
description: string;
|
|
18
|
-
};
|
|
19
|
-
component: typeof ContentEditor;
|
|
20
|
-
};
|
|
21
|
-
export declare const editorPanel: {
|
|
22
|
-
title: string;
|
|
23
|
-
icon: string;
|
|
24
|
-
description: string;
|
|
25
|
-
};
|
|
26
|
-
export default ContentEditor;
|
|
27
|
-
//# sourceMappingURL=editor.d.ts.map
|
package/dist/editor.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|