@cloudcannon/editable-regions 0.0.14 → 0.0.15
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.
|
@@ -9,12 +9,12 @@ export function getEditableComponentRenderers(): Record<string, ComponentRendere
|
|
|
9
9
|
export function getEditableSnippetRenderers(): Record<string, ComponentRenderer>;
|
|
10
10
|
export function realizeAPIValue(value: unknown): Promise<unknown>;
|
|
11
11
|
export { _cloudcannon as CloudCannon };
|
|
12
|
-
export type
|
|
13
|
-
export type
|
|
12
|
+
export type CloudCannonVisualEditorWindow = import("@cloudcannon/visual-editor-api").CloudCannonVisualEditorWindow;
|
|
13
|
+
export type CloudCannonVisualEditorAPIV1 = import("@cloudcannon/visual-editor-api").CloudCannonVisualEditorAPIV1;
|
|
14
14
|
export type ComponentRenderer = (props: any) => HTMLElement | Promise<HTMLElement>;
|
|
15
|
-
export type ExtendedWindow =
|
|
15
|
+
export type ExtendedWindow = CloudCannonVisualEditorWindow & {
|
|
16
16
|
cc_components?: Record<string, ComponentRenderer>;
|
|
17
17
|
cc_snippets?: Record<string, ComponentRenderer>;
|
|
18
18
|
};
|
|
19
|
-
/** @type {
|
|
20
|
-
declare let _cloudcannon:
|
|
19
|
+
/** @type {CloudCannonVisualEditorAPIV1} */
|
|
20
|
+
declare let _cloudcannon: CloudCannonVisualEditorAPIV1;
|
package/helpers/cloudcannon.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @typedef {import("@cloudcannon/
|
|
3
|
-
* @typedef {import("@cloudcannon/
|
|
2
|
+
* @typedef {import("@cloudcannon/visual-editor-api").CloudCannonVisualEditorWindow} CloudCannonVisualEditorWindow
|
|
3
|
+
* @typedef {import("@cloudcannon/visual-editor-api").CloudCannonVisualEditorAPIV1} CloudCannonVisualEditorAPIV1
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @typedef {
|
|
11
|
+
* @typedef {CloudCannonVisualEditorWindow & {
|
|
12
12
|
* cc_components?: Record<string, ComponentRenderer>;
|
|
13
13
|
* cc_snippets?: Record<string, ComponentRenderer>;
|
|
14
14
|
* }} ExtendedWindow
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
/** @type {ExtendedWindow} */
|
|
18
18
|
const extendedWindow = /** @type {any} */ (window);
|
|
19
19
|
|
|
20
|
-
/** @type {
|
|
20
|
+
/** @type {CloudCannonVisualEditorAPIV1} */
|
|
21
21
|
let _cloudcannon;
|
|
22
22
|
|
|
23
23
|
/**
|
package/nodes/editable-array.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "@cloudcannon/
|
|
2
|
+
CloudCannonVisualEditorAPIV1Collection,
|
|
3
|
+
CloudCannonVisualEditorAPIV1Dataset,
|
|
4
|
+
CloudCannonVisualEditorAPIV1File,
|
|
5
|
+
} from "@cloudcannon/visual-editor-api";
|
|
6
6
|
import type EditableArrayItemComponent from "../components/editable-array-item-component.js";
|
|
7
7
|
import type EditableRegionButton from "../components/ui/editable-region-button.js";
|
|
8
8
|
import { isEditableElement } from "../helpers/checks.js";
|
|
@@ -27,9 +27,9 @@ function isArrayDirection(value: unknown): value is ArrayDirection {
|
|
|
27
27
|
export default class EditableArray extends Editable {
|
|
28
28
|
arrayDirection?: ArrayDirection;
|
|
29
29
|
value:
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
|
|
|
30
|
+
| CloudCannonVisualEditorAPIV1Collection
|
|
31
|
+
| CloudCannonVisualEditorAPIV1Dataset
|
|
32
|
+
| CloudCannonVisualEditorAPIV1File
|
|
33
33
|
| unknown[]
|
|
34
34
|
| null
|
|
35
35
|
| undefined = undefined;
|
|
@@ -47,7 +47,7 @@ export default class EditableArray extends Editable {
|
|
|
47
47
|
const __base_context = {
|
|
48
48
|
...this.contextBase,
|
|
49
49
|
};
|
|
50
|
-
let value: unknown[] |
|
|
50
|
+
let value: unknown[] | CloudCannonVisualEditorAPIV1File[];
|
|
51
51
|
if (CloudCannon.isAPICollection(this.value)) {
|
|
52
52
|
value = await this.value.items();
|
|
53
53
|
} else if (CloudCannon.isAPIDataset(this.value)) {
|
|
@@ -169,7 +169,7 @@ export default class EditableArray extends Editable {
|
|
|
169
169
|
}
|
|
170
170
|
|
|
171
171
|
private async _update(partialSubtree?: ChildNode | null): Promise<void> {
|
|
172
|
-
let value: unknown[] |
|
|
172
|
+
let value: unknown[] | CloudCannonVisualEditorAPIV1File[];
|
|
173
173
|
const __base_context = {
|
|
174
174
|
...this.contextBase,
|
|
175
175
|
};
|
package/nodes/editable-source.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CloudCannonVisualEditorAPIV1File } from "@cloudcannon/visual-editor-api";
|
|
2
2
|
import { html as beautifyHtml } from "js-beautify";
|
|
3
3
|
import { CloudCannon } from "../helpers/cloudcannon.mjs";
|
|
4
4
|
import EditableText from "./editable-text.js";
|
|
@@ -25,7 +25,7 @@ const HTML_VOID_ELEMENT: Record<string, boolean> = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export default class EditableSource extends EditableText {
|
|
28
|
-
file?:
|
|
28
|
+
file?: CloudCannonVisualEditorAPIV1File;
|
|
29
29
|
format = {
|
|
30
30
|
leading: "",
|
|
31
31
|
trailing: "",
|
package/nodes/editable.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "@cloudcannon/
|
|
2
|
+
CloudCannonVisualEditorAPIV1Collection,
|
|
3
|
+
CloudCannonVisualEditorAPIV1Dataset,
|
|
4
|
+
CloudCannonVisualEditorAPIV1File,
|
|
5
|
+
} from "@cloudcannon/visual-editor-api";
|
|
6
6
|
import { hasEditable } from "../helpers/checks";
|
|
7
7
|
import { apiLoadedPromise, CloudCannon } from "../helpers/cloudcannon.mjs";
|
|
8
8
|
|
|
@@ -22,9 +22,9 @@ export interface EditableContext {
|
|
|
22
22
|
fullPath?: string;
|
|
23
23
|
filePath?: string;
|
|
24
24
|
isContent?: boolean;
|
|
25
|
-
file?:
|
|
26
|
-
collection?:
|
|
27
|
-
dataset?:
|
|
25
|
+
file?: CloudCannonVisualEditorAPIV1File;
|
|
26
|
+
collection?: CloudCannonVisualEditorAPIV1Collection;
|
|
27
|
+
dataset?: CloudCannonVisualEditorAPIV1Dataset;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
export interface DOMListener {
|
|
@@ -35,9 +35,9 @@ export interface DOMListener {
|
|
|
35
35
|
export interface APIListener {
|
|
36
36
|
fn: (e: any) => void;
|
|
37
37
|
obj:
|
|
38
|
-
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
38
|
+
| CloudCannonVisualEditorAPIV1File
|
|
39
|
+
| CloudCannonVisualEditorAPIV1Collection
|
|
40
|
+
| CloudCannonVisualEditorAPIV1Dataset;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
export default class Editable {
|
|
@@ -598,7 +598,7 @@ export default class Editable {
|
|
|
598
598
|
options.source,
|
|
599
599
|
);
|
|
600
600
|
|
|
601
|
-
let filePromise: Promise<
|
|
601
|
+
let filePromise: Promise<CloudCannonVisualEditorAPIV1File | undefined>;
|
|
602
602
|
if (!file) {
|
|
603
603
|
if (collection && source) {
|
|
604
604
|
const parts = source.split(".");
|
|
@@ -734,9 +734,9 @@ export default class Editable {
|
|
|
734
734
|
}
|
|
735
735
|
|
|
736
736
|
parseSource(source?: string) {
|
|
737
|
-
let collection:
|
|
738
|
-
let file:
|
|
739
|
-
let dataset:
|
|
737
|
+
let collection: CloudCannonVisualEditorAPIV1Collection | undefined;
|
|
738
|
+
let file: CloudCannonVisualEditorAPIV1File | undefined;
|
|
739
|
+
let dataset: CloudCannonVisualEditorAPIV1Dataset | undefined;
|
|
740
740
|
let absolute = false;
|
|
741
741
|
let currentFile = false;
|
|
742
742
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcannon/editable-regions",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Visual Editing for the CloudCannon CMS.",
|
|
6
6
|
"keywords": [
|
|
@@ -55,17 +55,17 @@
|
|
|
55
55
|
"./internal/styles": "./styles/index.js"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
-
"@biomejs/biome": "2.4.
|
|
59
|
-
"@cloudcannon/
|
|
58
|
+
"@biomejs/biome": "2.4.14",
|
|
59
|
+
"@cloudcannon/visual-editor-api": "0.0.15",
|
|
60
60
|
"@sindresorhus/slugify": "3.0.0",
|
|
61
61
|
"@types/js-beautify": "1.14.3",
|
|
62
|
-
"@types/node": "25.
|
|
62
|
+
"@types/node": "25.6.0",
|
|
63
63
|
"@types/react": "19.2.14",
|
|
64
64
|
"@types/react-dom": "19.2.3",
|
|
65
|
-
"astro": "6.1
|
|
65
|
+
"astro": "6.2.1",
|
|
66
66
|
"js-beautify": "1.15.4",
|
|
67
|
-
"liquidjs": "10.25.
|
|
68
|
-
"typescript": "6.0.
|
|
67
|
+
"liquidjs": "10.25.7",
|
|
68
|
+
"typescript": "6.0.3"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"esbuild": "0.28.0"
|
package/types/cloudcannon.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export {};
|
|
|
3
3
|
declare global {
|
|
4
4
|
var ENV_CLIENT: boolean;
|
|
5
5
|
var inEditorMode: boolean;
|
|
6
|
-
var CloudCannonAPI:
|
|
6
|
+
var CloudCannonAPI: CloudCannonVisualEditorAPIRouter | undefined;
|
|
7
7
|
var CloudCannon:
|
|
8
|
-
|
|
|
9
|
-
|
|
|
8
|
+
| CloudCannonVisualEditorAPIV0
|
|
9
|
+
| CloudCannonVisualEditorAPIV1
|
|
10
10
|
| undefined;
|
|
11
11
|
}
|