@cloudcannon/editable-regions 0.0.20-rc.2 → 0.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +885 -0
- package/components/ui/editable-region-error-card.ts +9 -0
- package/helpers/cloudcannon.mjs +20 -9
- package/helpers/hydrate-editable-regions.ts +36 -3
- package/integrations/hugo/browser/errors.ts +81 -10
- package/integrations/hugo/browser/hugo-renderer.ts +282 -0
- package/integrations/hugo/browser/hugo-wasm.ts +116 -0
- package/integrations/hugo/browser/index.ts +31 -211
- package/integrations/hugo/browser/worker-protocol.ts +18 -0
- package/integrations/hugo/browser/worker.ts +51 -0
- package/integrations/hugo/hugo-module/layouts/partials/editable-regions/resources.html +11 -0
- package/integrations/hugo/renderer/main.go +41 -14
- package/integrations/react.mjs +63 -1
- package/integrations/svelte/EditableRegions.svelte +80 -0
- package/integrations/{svelte.mjs → svelte/index.mjs} +3 -1
- package/integrations/vue.mjs +97 -1
- package/nodes/editable-array-item.ts +5 -1
- package/nodes/editable-component.ts +10 -4
- package/nodes/editable-image.ts +80 -75
- package/nodes/editable.ts +28 -5
- package/package.json +17 -16
- package/types/hugo.d.ts +6 -2
- package/types/react.d.ts +20 -6
- package/types/svelte.d.ts +10 -0
- package/types/vue.d.ts +14 -1
- package/integrations/liquid/README.md +0 -677
package/integrations/vue.mjs
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
createApp,
|
|
3
|
+
defineComponent,
|
|
4
|
+
h,
|
|
5
|
+
onMounted,
|
|
6
|
+
onUnmounted,
|
|
7
|
+
ref,
|
|
8
|
+
} from "vue";
|
|
2
9
|
import { addEditableComponentRenderer } from "../helpers/cloudcannon.mjs";
|
|
3
10
|
|
|
4
11
|
/**
|
|
@@ -26,3 +33,92 @@ export const registerVueComponent = (key, component) => {
|
|
|
26
33
|
|
|
27
34
|
addEditableComponentRenderer(key, wrappedComponent);
|
|
28
35
|
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Root editable region component for Vue.
|
|
39
|
+
* Keeps editable regions from mutating the DOM before frameworks like Nuxt finish hydrating.
|
|
40
|
+
*
|
|
41
|
+
* @param {string} [props.tag] - Element type to render. Defaults to "div".
|
|
42
|
+
* All other props and attributes are forwarded to the rendered element.
|
|
43
|
+
*/
|
|
44
|
+
export const EditableRegions = defineComponent({
|
|
45
|
+
name: "EditableRegions",
|
|
46
|
+
props: {
|
|
47
|
+
tag: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: "div",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
inheritAttrs: false,
|
|
53
|
+
/**
|
|
54
|
+
* @param {{ tag: string }} props
|
|
55
|
+
* @param {{ attrs: any; slots: any }} context
|
|
56
|
+
*/
|
|
57
|
+
setup(props, { attrs, slots }) {
|
|
58
|
+
const element = ref(null);
|
|
59
|
+
/** @type {any} */
|
|
60
|
+
let editable = null;
|
|
61
|
+
/** @type {(() => void) | null} */
|
|
62
|
+
let pendingLoadHandler = null;
|
|
63
|
+
|
|
64
|
+
/** @param {any} regions */
|
|
65
|
+
const connectEditable = (regions) => {
|
|
66
|
+
if (!regions || editable) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
editable = new regions.Editable(element.value);
|
|
71
|
+
editable.connect();
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
onMounted(() => {
|
|
75
|
+
const regions = /** @type {any} */ (window).editableRegions;
|
|
76
|
+
if (regions) {
|
|
77
|
+
connectEditable(regions);
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
pendingLoadHandler = () => {
|
|
82
|
+
connectEditable(/** @type {any} */ (window).editableRegions);
|
|
83
|
+
};
|
|
84
|
+
document.addEventListener("editable-regions:load", pendingLoadHandler, {
|
|
85
|
+
once: true,
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
onUnmounted(() => {
|
|
90
|
+
if (pendingLoadHandler) {
|
|
91
|
+
document.removeEventListener(
|
|
92
|
+
"editable-regions:load",
|
|
93
|
+
pendingLoadHandler,
|
|
94
|
+
);
|
|
95
|
+
pendingLoadHandler = null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
editable?.disconnect();
|
|
99
|
+
editable = null;
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
return () => {
|
|
103
|
+
/** @type {Record<string, any>} */
|
|
104
|
+
const forwarded = {};
|
|
105
|
+
for (const [name, value] of Object.entries(attrs)) {
|
|
106
|
+
if (/^data-(prop|literal)/i.test(name)) {
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
forwarded[name] = value;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return h(
|
|
113
|
+
props.tag,
|
|
114
|
+
{
|
|
115
|
+
...forwarded,
|
|
116
|
+
ref: element,
|
|
117
|
+
"data-editable": "_dynamic",
|
|
118
|
+
"data-prop": "",
|
|
119
|
+
},
|
|
120
|
+
/** @type {any} */ (slots.default?.()),
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
});
|
|
@@ -18,12 +18,16 @@ export const hasEditableArrayItem = <T extends object>(
|
|
|
18
18
|
export default class EditableArrayItem extends EditableComponent {
|
|
19
19
|
parent: EditableArray | null = null;
|
|
20
20
|
|
|
21
|
-
protected
|
|
21
|
+
declare protected controlsElement?: EditableArrayItemControls;
|
|
22
22
|
|
|
23
23
|
private inputConfig?: any;
|
|
24
24
|
private structureStrings: string[] = [];
|
|
25
25
|
|
|
26
26
|
shouldMount(): boolean {
|
|
27
|
+
if (this.mounted) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
|
|
27
31
|
return this.value !== undefined;
|
|
28
32
|
}
|
|
29
33
|
|
|
@@ -25,13 +25,19 @@ export default class EditableComponent extends Editable {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
shouldMount(): boolean {
|
|
28
|
-
if (
|
|
29
|
-
return
|
|
28
|
+
if (this.mounted) {
|
|
29
|
+
return false;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
key.startsWith("prop"),
|
|
32
|
+
const hasNoProps = Object.keys(this.element.dataset).every(
|
|
33
|
+
(key) => !key.startsWith("prop"),
|
|
34
34
|
);
|
|
35
|
+
|
|
36
|
+
if (hasNoProps) {
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return super.shouldMount();
|
|
35
41
|
}
|
|
36
42
|
|
|
37
43
|
validateConfiguration(): boolean {
|
package/nodes/editable-image.ts
CHANGED
|
@@ -185,87 +185,92 @@ export default class EditableImage extends Editable {
|
|
|
185
185
|
this.configuredTitle =
|
|
186
186
|
!!this.element.dataset.propTitle || !!this.element.dataset.prop;
|
|
187
187
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
// Loading the input config costs a round trip per configured prop, so the
|
|
189
|
+
// listener is attached up front and the click waits for it. Attaching after
|
|
190
|
+
// the load resolves instead leaves a window where clicks are dropped.
|
|
191
|
+
const inputConfigLoaded = this.loadInputConfig();
|
|
191
192
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
193
|
+
this.imageEl?.addEventListener("click", async (e) => {
|
|
194
|
+
e.preventDefault();
|
|
195
195
|
|
|
196
|
-
|
|
197
|
-
if ("src" in this.value) {
|
|
198
|
-
data.src = this.value.src;
|
|
199
|
-
}
|
|
200
|
-
if ("alt" in this.value) {
|
|
201
|
-
data.alt = this.value.alt;
|
|
202
|
-
}
|
|
203
|
-
if ("title" in this.value) {
|
|
204
|
-
data.title = this.value.title;
|
|
205
|
-
}
|
|
196
|
+
await inputConfigLoaded;
|
|
206
197
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
198
|
+
if (!this.value) {
|
|
199
|
+
throw new Error("Value is not defined");
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const data: this["value"] = {};
|
|
203
|
+
if ("src" in this.value) {
|
|
204
|
+
data.src = this.value.src;
|
|
205
|
+
}
|
|
206
|
+
if ("alt" in this.value) {
|
|
207
|
+
data.alt = this.value.alt;
|
|
208
|
+
}
|
|
209
|
+
if ("title" in this.value) {
|
|
210
|
+
data.title = this.value.title;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
this.panelId = await CloudCannon.createCustomDataPanel({
|
|
214
|
+
title: "Edit Image",
|
|
215
|
+
data,
|
|
216
|
+
position: this.imageEl?.getBoundingClientRect(),
|
|
217
|
+
config: {
|
|
218
|
+
_inputs: {
|
|
219
|
+
src: {
|
|
220
|
+
label: "Image",
|
|
221
|
+
type: "image",
|
|
222
|
+
...this.inputConfig.src,
|
|
223
|
+
},
|
|
224
|
+
alt: {
|
|
225
|
+
comment:
|
|
226
|
+
"A description which provides information about this image if for some reason it cannot be viewed.",
|
|
227
|
+
...this.inputConfig.alt,
|
|
228
|
+
},
|
|
229
|
+
title: {
|
|
230
|
+
comment: "Displayed when hovering over the image.",
|
|
231
|
+
...this.inputConfig.title,
|
|
227
232
|
},
|
|
228
233
|
},
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
234
|
+
},
|
|
235
|
+
onChange: (value): void => {
|
|
236
|
+
if (!value || typeof value !== "object") {
|
|
237
|
+
throw new Error("Invalid image data");
|
|
238
|
+
}
|
|
233
239
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
});
|
|
240
|
+
if (
|
|
241
|
+
"src" in value &&
|
|
242
|
+
this.configuredSrc &&
|
|
243
|
+
value.src !== this.value?.src
|
|
244
|
+
) {
|
|
245
|
+
this.dispatchSet(
|
|
246
|
+
this.element.dataset.propSrc ??
|
|
247
|
+
`${this.element.dataset.prop}.src`,
|
|
248
|
+
value.src,
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
if (
|
|
252
|
+
"alt" in value &&
|
|
253
|
+
this.configuredAlt &&
|
|
254
|
+
value.alt !== this.value?.alt
|
|
255
|
+
) {
|
|
256
|
+
this.dispatchSet(
|
|
257
|
+
this.element.dataset.propAlt ??
|
|
258
|
+
`${this.element.dataset.prop}.alt`,
|
|
259
|
+
value.alt,
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
if (
|
|
263
|
+
"title" in value &&
|
|
264
|
+
this.configuredTitle &&
|
|
265
|
+
value.title !== this.value?.title
|
|
266
|
+
) {
|
|
267
|
+
this.dispatchSet(
|
|
268
|
+
this.element.dataset.propTitle ??
|
|
269
|
+
`${this.element.dataset.prop}.title`,
|
|
270
|
+
value.title,
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
},
|
|
269
274
|
});
|
|
270
275
|
});
|
|
271
276
|
}
|
package/nodes/editable.ts
CHANGED
|
@@ -174,7 +174,19 @@ export default class Editable {
|
|
|
174
174
|
return true;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
private parentMounted(): boolean {
|
|
178
|
+
if (this.parent) {
|
|
179
|
+
return this.parent.mounted;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return !this.pendingParentElement;
|
|
183
|
+
}
|
|
184
|
+
|
|
177
185
|
shouldMount() {
|
|
186
|
+
if (this.mounted) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
|
|
178
190
|
return this.value !== undefined;
|
|
179
191
|
}
|
|
180
192
|
|
|
@@ -211,8 +223,10 @@ export default class Editable {
|
|
|
211
223
|
contexts?: { [key: string]: EditableContext },
|
|
212
224
|
): Promise<unknown> {
|
|
213
225
|
const { key, path } = listener ?? {};
|
|
226
|
+
let shouldValidate = false;
|
|
214
227
|
|
|
215
228
|
if (typeof path === "string") {
|
|
229
|
+
shouldValidate = true;
|
|
216
230
|
const { value: resolvedValue, context: newContext } =
|
|
217
231
|
await this.lookupPathAndContext(path, value, contexts);
|
|
218
232
|
|
|
@@ -255,6 +269,7 @@ export default class Editable {
|
|
|
255
269
|
({ key }) => !!key,
|
|
256
270
|
);
|
|
257
271
|
if (filteredSpecialPropsListener.length > 0) {
|
|
272
|
+
shouldValidate = true;
|
|
258
273
|
newValue = filteredSpecialPropsListener.reduce(
|
|
259
274
|
(acc, { key, path }) => {
|
|
260
275
|
if (key && path) {
|
|
@@ -271,6 +286,7 @@ export default class Editable {
|
|
|
271
286
|
}
|
|
272
287
|
|
|
273
288
|
if (Object.entries(literalProps).length > 0) {
|
|
289
|
+
shouldValidate = true;
|
|
274
290
|
newValue = Object.entries(literalProps).reduce(
|
|
275
291
|
(acc, [key, val]) => {
|
|
276
292
|
(acc as any)[key] = structuredClone(val);
|
|
@@ -282,7 +298,11 @@ export default class Editable {
|
|
|
282
298
|
);
|
|
283
299
|
}
|
|
284
300
|
|
|
285
|
-
|
|
301
|
+
if (shouldValidate) {
|
|
302
|
+
newValue = this.validateValue(newValue);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
return newValue;
|
|
286
306
|
}
|
|
287
307
|
|
|
288
308
|
async pushValue(
|
|
@@ -299,15 +319,18 @@ export default class Editable {
|
|
|
299
319
|
contexts,
|
|
300
320
|
);
|
|
301
321
|
|
|
302
|
-
if (
|
|
322
|
+
if (
|
|
323
|
+
typeof newValue === "undefined" ||
|
|
324
|
+
!this.shouldUpdate(newValue) ||
|
|
325
|
+
!this.parentMounted()
|
|
326
|
+
) {
|
|
303
327
|
return;
|
|
304
328
|
}
|
|
305
329
|
|
|
306
330
|
this.value = newValue;
|
|
307
|
-
if (this.connected &&
|
|
331
|
+
if (this.connected && this.shouldMount()) {
|
|
308
332
|
this.mounted = true;
|
|
309
333
|
this.mount();
|
|
310
|
-
return this.update(partialSubtree);
|
|
311
334
|
}
|
|
312
335
|
|
|
313
336
|
if (this.mounted) {
|
|
@@ -440,7 +463,7 @@ export default class Editable {
|
|
|
440
463
|
this.connectPromise = apiLoadedPromise.then(() => {
|
|
441
464
|
this.setupListeners();
|
|
442
465
|
this.connected = true;
|
|
443
|
-
if (
|
|
466
|
+
if (this.parentMounted() && this.shouldMount()) {
|
|
444
467
|
this.mounted = true;
|
|
445
468
|
this.mount();
|
|
446
469
|
this.update();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcannon/editable-regions",
|
|
3
|
-
"version": "0.0.20
|
|
3
|
+
"version": "0.0.20",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Visual Editing for the CloudCannon CMS.",
|
|
6
6
|
"keywords": [
|
|
@@ -77,7 +77,8 @@
|
|
|
77
77
|
},
|
|
78
78
|
"./svelte": {
|
|
79
79
|
"types": "./types/svelte.d.ts",
|
|
80
|
-
"
|
|
80
|
+
"svelte": "./integrations/svelte/index.mjs",
|
|
81
|
+
"default": "./integrations/svelte/index.mjs"
|
|
81
82
|
},
|
|
82
83
|
"./vue": {
|
|
83
84
|
"types": "./types/vue.d.ts",
|
|
@@ -103,30 +104,30 @@
|
|
|
103
104
|
"./internal/styles": "./styles/index.js"
|
|
104
105
|
},
|
|
105
106
|
"devDependencies": {
|
|
106
|
-
"@astrojs/react": "6.0.
|
|
107
|
+
"@astrojs/react": "6.0.5",
|
|
107
108
|
"@astrojs/svelte": "9.0.1",
|
|
108
109
|
"@astrojs/vue": "7.0.2",
|
|
109
|
-
"@biomejs/biome": "2.5.
|
|
110
|
+
"@biomejs/biome": "2.5.13",
|
|
110
111
|
"@cloudcannon/visual-editor-api": "0.0.20",
|
|
111
|
-
"@sindresorhus/slugify": "3.0.
|
|
112
|
+
"@sindresorhus/slugify": "3.0.1",
|
|
112
113
|
"@sveltejs/vite-plugin-svelte": "7.3.0",
|
|
113
114
|
"@types/js-beautify": "1.14.3",
|
|
114
|
-
"@types/node": "26.
|
|
115
|
-
"@types/react": "19.
|
|
116
|
-
"@types/react-dom": "19.
|
|
115
|
+
"@types/node": "26.5.1",
|
|
116
|
+
"@types/react": "19.3.0",
|
|
117
|
+
"@types/react-dom": "19.3.0",
|
|
117
118
|
"@vitejs/plugin-vue": "6.0.8",
|
|
118
|
-
"astro": "7.
|
|
119
|
-
"happy-dom": "20.
|
|
119
|
+
"astro": "7.3.2",
|
|
120
|
+
"happy-dom": "20.14.5",
|
|
120
121
|
"js-beautify": "2.0.3",
|
|
121
122
|
"liquidjs": "10.29.0",
|
|
122
|
-
"react": "19.
|
|
123
|
-
"react-dom": "19.
|
|
123
|
+
"react": "19.3.0",
|
|
124
|
+
"react-dom": "19.3.0",
|
|
124
125
|
"slugify": "1.6.9",
|
|
125
|
-
"svelte": "5.
|
|
126
|
+
"svelte": "5.57.0",
|
|
126
127
|
"typescript": "6.0.3",
|
|
127
|
-
"vitest": "4.1.
|
|
128
|
-
"vue": "3.5.
|
|
129
|
-
"vue-tsc": "3.3.
|
|
128
|
+
"vitest": "^4.1.11",
|
|
129
|
+
"vue": "3.5.42",
|
|
130
|
+
"vue-tsc": "3.3.11"
|
|
130
131
|
},
|
|
131
132
|
"dependencies": {
|
|
132
133
|
"esbuild": "0.28.2"
|
package/types/hugo.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ declare global {
|
|
|
29
29
|
interface HugoRuntimeMeta {
|
|
30
30
|
generator?: string;
|
|
31
31
|
wasmUrl?: string;
|
|
32
|
+
workerUrl?: string;
|
|
32
33
|
verbose?: boolean;
|
|
33
34
|
env?: string;
|
|
34
35
|
}
|
|
@@ -53,7 +54,7 @@ declare global {
|
|
|
53
54
|
CloudCannonAPI?: CloudCannonVisualEditorAPIRouter;
|
|
54
55
|
/** The installed v0/v1 CloudCannon API for this page. */
|
|
55
56
|
CloudCannon?: CloudCannonVisualEditorAPIV0 | CloudCannonVisualEditorAPIV1;
|
|
56
|
-
/** Emitter metadata: generator, wasmUrl, verbose, env. */
|
|
57
|
+
/** Emitter metadata: generator, wasmUrl, workerUrl, verbose, env. */
|
|
57
58
|
cc_hugo?: HugoRuntimeMeta;
|
|
58
59
|
/** Template/config snapshot keyed by physical path. */
|
|
59
60
|
cc_hugo_files?: Record<string, string>;
|
|
@@ -65,5 +66,8 @@ declare global {
|
|
|
65
66
|
function removeHugoFiles(json: string): HugoEditorResult | null;
|
|
66
67
|
function readHugoFiles(json: string): Record<string, string>;
|
|
67
68
|
function initHugoEditorSite(): HugoEditorResult | null;
|
|
68
|
-
function renderHugoPartials(
|
|
69
|
+
function renderHugoPartials(
|
|
70
|
+
json: string,
|
|
71
|
+
callback: (result: HugoRenderResult) => void,
|
|
72
|
+
): void;
|
|
69
73
|
}
|
package/types/react.d.ts
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
1
|
/// <reference path="./cloudcannon.d.ts" />
|
|
2
2
|
|
|
3
|
-
import type { HTMLAttributes, RefAttributes } from "react";
|
|
3
|
+
import type { FC, HTMLAttributes, RefAttributes } from "react";
|
|
4
4
|
|
|
5
5
|
export function registerReactComponent(key: string, component: unknown): void;
|
|
6
6
|
|
|
7
|
+
export const EditableRegions: FC<
|
|
8
|
+
HTMLAttributes<HTMLElement> & {
|
|
9
|
+
tag?: string;
|
|
10
|
+
}
|
|
11
|
+
>;
|
|
12
|
+
|
|
7
13
|
declare global {
|
|
8
14
|
namespace React.JSX {
|
|
9
15
|
interface IntrinsicElements {
|
|
10
16
|
"editable-component": RefAttributes<HTMLElement> &
|
|
11
|
-
|
|
17
|
+
HTMLAttributes<HTMLElement> & {
|
|
12
18
|
class?: string;
|
|
13
19
|
"data-prop": string;
|
|
14
20
|
"data-component": string;
|
|
15
21
|
};
|
|
16
22
|
"editable-text": RefAttributes<HTMLElement> &
|
|
17
|
-
|
|
23
|
+
HTMLAttributes<HTMLElement> & {
|
|
18
24
|
class?: string;
|
|
19
25
|
"data-prop": string;
|
|
20
26
|
"data-type"?: "block" | "text" | "span";
|
|
21
27
|
};
|
|
22
28
|
"editable-source": RefAttributes<HTMLElement> &
|
|
23
|
-
|
|
29
|
+
HTMLAttributes<HTMLElement> & {
|
|
24
30
|
class?: string;
|
|
25
31
|
"data-path": string;
|
|
26
32
|
"data-key": string;
|
|
27
33
|
};
|
|
28
34
|
"editable-array": RefAttributes<HTMLElement> &
|
|
29
|
-
|
|
35
|
+
HTMLAttributes<HTMLElement> & {
|
|
30
36
|
class?: string;
|
|
31
37
|
"data-prop": string;
|
|
32
38
|
"data-id-key"?: string;
|
|
@@ -39,11 +45,19 @@ declare global {
|
|
|
39
45
|
| "row-reverse";
|
|
40
46
|
};
|
|
41
47
|
"editable-array-item": RefAttributes<HTMLElement> &
|
|
42
|
-
|
|
48
|
+
HTMLAttributes<HTMLElement> & {
|
|
43
49
|
class?: string;
|
|
44
50
|
"data-id"?: string;
|
|
45
51
|
"data-component"?: string;
|
|
46
52
|
};
|
|
53
|
+
"editable-image": RefAttributes<HTMLElement> &
|
|
54
|
+
HTMLAttributes<HTMLElement> & {
|
|
55
|
+
class?: string;
|
|
56
|
+
"data-prop"?: string;
|
|
57
|
+
"data-prop-src"?: string;
|
|
58
|
+
"data-prop-alt"?: string;
|
|
59
|
+
"data-prop-title"?: string;
|
|
60
|
+
};
|
|
47
61
|
}
|
|
48
62
|
}
|
|
49
63
|
}
|
package/types/svelte.d.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
/// <reference path="./cloudcannon.d.ts" />
|
|
2
2
|
|
|
3
|
+
import type { SvelteComponentTyped } from "svelte";
|
|
4
|
+
|
|
3
5
|
export function registerSvelteComponent(key: string, component: unknown): void;
|
|
6
|
+
|
|
7
|
+
export const EditableRegions: import("svelte").ComponentType<
|
|
8
|
+
SvelteComponentTyped<
|
|
9
|
+
{
|
|
10
|
+
tag?: string;
|
|
11
|
+
} & Record<string, any>
|
|
12
|
+
>
|
|
13
|
+
>;
|
package/types/vue.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/// <reference path="./cloudcannon.d.ts" />
|
|
2
2
|
|
|
3
|
-
import type { HTMLAttributes } from "vue";
|
|
3
|
+
import type { DefineComponent, HTMLAttributes } from "vue";
|
|
4
4
|
|
|
5
5
|
export function registerVueComponent(key: string, component: unknown): void;
|
|
6
6
|
|
|
7
|
+
export const EditableRegions: DefineComponent<
|
|
8
|
+
Omit<HTMLAttributes, "data-prop"> & {
|
|
9
|
+
tag?: string;
|
|
10
|
+
}
|
|
11
|
+
>;
|
|
12
|
+
|
|
7
13
|
declare global {
|
|
8
14
|
namespace JSX {
|
|
9
15
|
interface IntrinsicElements {
|
|
@@ -17,6 +23,13 @@ declare global {
|
|
|
17
23
|
"data-prop": string;
|
|
18
24
|
"data-type"?: "block" | "text" | "span";
|
|
19
25
|
};
|
|
26
|
+
"editable-image": HTMLAttributes & {
|
|
27
|
+
class?: string;
|
|
28
|
+
"data-prop"?: string;
|
|
29
|
+
"data-prop-src"?: string;
|
|
30
|
+
"data-prop-alt"?: string;
|
|
31
|
+
"data-prop-title"?: string;
|
|
32
|
+
};
|
|
20
33
|
"editable-source": HTMLAttributes & {
|
|
21
34
|
class?: string;
|
|
22
35
|
"data-path": string;
|