@dotcms/types 0.0.1-beta.25
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 +29 -0
- package/index.cjs.d.ts +1 -0
- package/index.cjs.default.js +1 -0
- package/index.cjs.js +126 -0
- package/index.cjs.mjs +2 -0
- package/index.esm.d.ts +1 -0
- package/index.esm.js +123 -0
- package/internal.cjs.d.ts +1 -0
- package/internal.cjs.default.js +1 -0
- package/internal.cjs.js +75 -0
- package/internal.cjs.mjs +2 -0
- package/internal.esm.d.ts +1 -0
- package/internal.esm.js +75 -0
- package/package.json +39 -0
- package/src/index.d.ts +4 -0
- package/src/internal.d.ts +3 -0
- package/src/lib/components/block-editor-renderer/internal.d.ts +46 -0
- package/src/lib/components/block-editor-renderer/public.d.ts +38 -0
- package/src/lib/editor/internal.d.ts +103 -0
- package/src/lib/editor/public.d.ts +210 -0
- package/src/lib/events/internal.d.ts +34 -0
- package/src/lib/events/public.d.ts +18 -0
- package/src/lib/page/public.d.ts +1149 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# @dotcms/types
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
This library contains shared TypeScript types and interfaces used across the dotCMS SDK libraries and the Universal Visual Editor. It serves as a central repository for type definitions to ensure consistency and type safety across the ecosystem.
|
|
6
|
+
|
|
7
|
+
## Purpose
|
|
8
|
+
|
|
9
|
+
- Establish a single source of truth for common types
|
|
10
|
+
- Maintain consistency across SDK libraries
|
|
11
|
+
- Support the Universal Visual Editor with necessary type definitions
|
|
12
|
+
- Reduce duplication and prevent drift between related interfaces
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
Import types directly from this library:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { Block, Contentlet } from '@dotcms/types';
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Universal Visual Editor
|
|
23
|
+
|
|
24
|
+
Types in this library provide the foundation for the Universal Visual Editor, including:
|
|
25
|
+
|
|
26
|
+
- Component definitions
|
|
27
|
+
- Editor configuration schemas
|
|
28
|
+
- Content type mappings
|
|
29
|
+
- UI element specifications
|
package/index.cjs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./index.cjs.js').default;
|
package/index.cjs.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Development mode
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
const DEVELOPMENT_MODE = 'development';
|
|
9
|
+
/**
|
|
10
|
+
* Production mode
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
const PRODUCTION_MODE = 'production';
|
|
15
|
+
/**
|
|
16
|
+
* Possible modes of UVE (Universal Visual Editor)
|
|
17
|
+
* @enum {string}
|
|
18
|
+
*
|
|
19
|
+
* @property {string} LIVE - Shows published and future content
|
|
20
|
+
* @property {string} PREVIEW - Shows published and working content
|
|
21
|
+
* @property {string} EDIT - Enables content editing functionality in UVE
|
|
22
|
+
* @property {string} UNKNOWN - Error state, UVE should not remain in this mode
|
|
23
|
+
*/
|
|
24
|
+
exports.UVE_MODE = void 0;
|
|
25
|
+
(function (UVE_MODE) {
|
|
26
|
+
UVE_MODE["EDIT"] = "EDIT_MODE";
|
|
27
|
+
UVE_MODE["PREVIEW"] = "PREVIEW_MODE";
|
|
28
|
+
UVE_MODE["LIVE"] = "LIVE";
|
|
29
|
+
UVE_MODE["UNKNOWN"] = "UNKNOWN";
|
|
30
|
+
})(exports.UVE_MODE || (exports.UVE_MODE = {}));
|
|
31
|
+
/**
|
|
32
|
+
* Actions send to the dotcms editor
|
|
33
|
+
*
|
|
34
|
+
* @export
|
|
35
|
+
* @enum {number}
|
|
36
|
+
*/
|
|
37
|
+
exports.DotCMSUVEAction = void 0;
|
|
38
|
+
(function (DotCMSUVEAction) {
|
|
39
|
+
/**
|
|
40
|
+
* Tell the dotcms editor that page change
|
|
41
|
+
*/
|
|
42
|
+
DotCMSUVEAction["NAVIGATION_UPDATE"] = "set-url";
|
|
43
|
+
/**
|
|
44
|
+
* Send the element position of the rows, columnsm containers and contentlets
|
|
45
|
+
*/
|
|
46
|
+
DotCMSUVEAction["SET_BOUNDS"] = "set-bounds";
|
|
47
|
+
/**
|
|
48
|
+
* Send the information of the hovered contentlet
|
|
49
|
+
*/
|
|
50
|
+
DotCMSUVEAction["SET_CONTENTLET"] = "set-contentlet";
|
|
51
|
+
/**
|
|
52
|
+
* Tell the editor that the page is being scrolled
|
|
53
|
+
*/
|
|
54
|
+
DotCMSUVEAction["IFRAME_SCROLL"] = "scroll";
|
|
55
|
+
/**
|
|
56
|
+
* Tell the editor that the page has stopped scrolling
|
|
57
|
+
*/
|
|
58
|
+
DotCMSUVEAction["IFRAME_SCROLL_END"] = "scroll-end";
|
|
59
|
+
/**
|
|
60
|
+
* Ping the editor to see if the page is inside the editor
|
|
61
|
+
*/
|
|
62
|
+
DotCMSUVEAction["PING_EDITOR"] = "ping-editor";
|
|
63
|
+
/**
|
|
64
|
+
* Tell the editor to init the inline editing editor.
|
|
65
|
+
*/
|
|
66
|
+
DotCMSUVEAction["INIT_INLINE_EDITING"] = "init-inline-editing";
|
|
67
|
+
/**
|
|
68
|
+
* Tell the editor to open the Copy-contentlet dialog
|
|
69
|
+
* To copy a content and then edit it inline.
|
|
70
|
+
*/
|
|
71
|
+
DotCMSUVEAction["COPY_CONTENTLET_INLINE_EDITING"] = "copy-contentlet-inline-editing";
|
|
72
|
+
/**
|
|
73
|
+
* Tell the editor to save inline edited contentlet
|
|
74
|
+
*/
|
|
75
|
+
DotCMSUVEAction["UPDATE_CONTENTLET_INLINE_EDITING"] = "update-contentlet-inline-editing";
|
|
76
|
+
/**
|
|
77
|
+
* Tell the editor to trigger a menu reorder
|
|
78
|
+
*/
|
|
79
|
+
DotCMSUVEAction["REORDER_MENU"] = "reorder-menu";
|
|
80
|
+
/**
|
|
81
|
+
* Tell the editor to send the page info to iframe
|
|
82
|
+
*/
|
|
83
|
+
DotCMSUVEAction["GET_PAGE_DATA"] = "get-page-data";
|
|
84
|
+
/**
|
|
85
|
+
* Tell the editor an user send a graphql query
|
|
86
|
+
*/
|
|
87
|
+
DotCMSUVEAction["CLIENT_READY"] = "client-ready";
|
|
88
|
+
/**
|
|
89
|
+
* Tell the editor to edit a contentlet
|
|
90
|
+
*/
|
|
91
|
+
DotCMSUVEAction["EDIT_CONTENTLET"] = "edit-contentlet";
|
|
92
|
+
/**
|
|
93
|
+
* Tell the editor to do nothing
|
|
94
|
+
*/
|
|
95
|
+
DotCMSUVEAction["NOOP"] = "noop";
|
|
96
|
+
})(exports.DotCMSUVEAction || (exports.DotCMSUVEAction = {}));
|
|
97
|
+
/**
|
|
98
|
+
* Available events in the Universal Visual Editor
|
|
99
|
+
* @enum {string}
|
|
100
|
+
*/
|
|
101
|
+
exports.UVEEventType = void 0;
|
|
102
|
+
(function (UVEEventType) {
|
|
103
|
+
/**
|
|
104
|
+
* Triggered when page data changes from the editor
|
|
105
|
+
*/
|
|
106
|
+
UVEEventType["CONTENT_CHANGES"] = "changes";
|
|
107
|
+
/**
|
|
108
|
+
* Triggered when the page needs to be reloaded
|
|
109
|
+
*/
|
|
110
|
+
UVEEventType["PAGE_RELOAD"] = "page-reload";
|
|
111
|
+
/**
|
|
112
|
+
* Triggered when the editor requests container bounds
|
|
113
|
+
*/
|
|
114
|
+
UVEEventType["REQUEST_BOUNDS"] = "request-bounds";
|
|
115
|
+
/**
|
|
116
|
+
* Triggered when scroll action is needed inside the iframe
|
|
117
|
+
*/
|
|
118
|
+
UVEEventType["IFRAME_SCROLL"] = "iframe-scroll";
|
|
119
|
+
/**
|
|
120
|
+
* Triggered when a contentlet is hovered
|
|
121
|
+
*/
|
|
122
|
+
UVEEventType["CONTENTLET_HOVERED"] = "contentlet-hovered";
|
|
123
|
+
})(exports.UVEEventType || (exports.UVEEventType = {}));
|
|
124
|
+
|
|
125
|
+
exports.DEVELOPMENT_MODE = DEVELOPMENT_MODE;
|
|
126
|
+
exports.PRODUCTION_MODE = PRODUCTION_MODE;
|
package/index.cjs.mjs
ADDED
package/index.esm.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
package/index.esm.js
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Development mode
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
const DEVELOPMENT_MODE = 'development';
|
|
7
|
+
/**
|
|
8
|
+
* Production mode
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
const PRODUCTION_MODE = 'production';
|
|
13
|
+
/**
|
|
14
|
+
* Possible modes of UVE (Universal Visual Editor)
|
|
15
|
+
* @enum {string}
|
|
16
|
+
*
|
|
17
|
+
* @property {string} LIVE - Shows published and future content
|
|
18
|
+
* @property {string} PREVIEW - Shows published and working content
|
|
19
|
+
* @property {string} EDIT - Enables content editing functionality in UVE
|
|
20
|
+
* @property {string} UNKNOWN - Error state, UVE should not remain in this mode
|
|
21
|
+
*/
|
|
22
|
+
var UVE_MODE;
|
|
23
|
+
(function (UVE_MODE) {
|
|
24
|
+
UVE_MODE["EDIT"] = "EDIT_MODE";
|
|
25
|
+
UVE_MODE["PREVIEW"] = "PREVIEW_MODE";
|
|
26
|
+
UVE_MODE["LIVE"] = "LIVE";
|
|
27
|
+
UVE_MODE["UNKNOWN"] = "UNKNOWN";
|
|
28
|
+
})(UVE_MODE || (UVE_MODE = {}));
|
|
29
|
+
/**
|
|
30
|
+
* Actions send to the dotcms editor
|
|
31
|
+
*
|
|
32
|
+
* @export
|
|
33
|
+
* @enum {number}
|
|
34
|
+
*/
|
|
35
|
+
var DotCMSUVEAction;
|
|
36
|
+
(function (DotCMSUVEAction) {
|
|
37
|
+
/**
|
|
38
|
+
* Tell the dotcms editor that page change
|
|
39
|
+
*/
|
|
40
|
+
DotCMSUVEAction["NAVIGATION_UPDATE"] = "set-url";
|
|
41
|
+
/**
|
|
42
|
+
* Send the element position of the rows, columnsm containers and contentlets
|
|
43
|
+
*/
|
|
44
|
+
DotCMSUVEAction["SET_BOUNDS"] = "set-bounds";
|
|
45
|
+
/**
|
|
46
|
+
* Send the information of the hovered contentlet
|
|
47
|
+
*/
|
|
48
|
+
DotCMSUVEAction["SET_CONTENTLET"] = "set-contentlet";
|
|
49
|
+
/**
|
|
50
|
+
* Tell the editor that the page is being scrolled
|
|
51
|
+
*/
|
|
52
|
+
DotCMSUVEAction["IFRAME_SCROLL"] = "scroll";
|
|
53
|
+
/**
|
|
54
|
+
* Tell the editor that the page has stopped scrolling
|
|
55
|
+
*/
|
|
56
|
+
DotCMSUVEAction["IFRAME_SCROLL_END"] = "scroll-end";
|
|
57
|
+
/**
|
|
58
|
+
* Ping the editor to see if the page is inside the editor
|
|
59
|
+
*/
|
|
60
|
+
DotCMSUVEAction["PING_EDITOR"] = "ping-editor";
|
|
61
|
+
/**
|
|
62
|
+
* Tell the editor to init the inline editing editor.
|
|
63
|
+
*/
|
|
64
|
+
DotCMSUVEAction["INIT_INLINE_EDITING"] = "init-inline-editing";
|
|
65
|
+
/**
|
|
66
|
+
* Tell the editor to open the Copy-contentlet dialog
|
|
67
|
+
* To copy a content and then edit it inline.
|
|
68
|
+
*/
|
|
69
|
+
DotCMSUVEAction["COPY_CONTENTLET_INLINE_EDITING"] = "copy-contentlet-inline-editing";
|
|
70
|
+
/**
|
|
71
|
+
* Tell the editor to save inline edited contentlet
|
|
72
|
+
*/
|
|
73
|
+
DotCMSUVEAction["UPDATE_CONTENTLET_INLINE_EDITING"] = "update-contentlet-inline-editing";
|
|
74
|
+
/**
|
|
75
|
+
* Tell the editor to trigger a menu reorder
|
|
76
|
+
*/
|
|
77
|
+
DotCMSUVEAction["REORDER_MENU"] = "reorder-menu";
|
|
78
|
+
/**
|
|
79
|
+
* Tell the editor to send the page info to iframe
|
|
80
|
+
*/
|
|
81
|
+
DotCMSUVEAction["GET_PAGE_DATA"] = "get-page-data";
|
|
82
|
+
/**
|
|
83
|
+
* Tell the editor an user send a graphql query
|
|
84
|
+
*/
|
|
85
|
+
DotCMSUVEAction["CLIENT_READY"] = "client-ready";
|
|
86
|
+
/**
|
|
87
|
+
* Tell the editor to edit a contentlet
|
|
88
|
+
*/
|
|
89
|
+
DotCMSUVEAction["EDIT_CONTENTLET"] = "edit-contentlet";
|
|
90
|
+
/**
|
|
91
|
+
* Tell the editor to do nothing
|
|
92
|
+
*/
|
|
93
|
+
DotCMSUVEAction["NOOP"] = "noop";
|
|
94
|
+
})(DotCMSUVEAction || (DotCMSUVEAction = {}));
|
|
95
|
+
/**
|
|
96
|
+
* Available events in the Universal Visual Editor
|
|
97
|
+
* @enum {string}
|
|
98
|
+
*/
|
|
99
|
+
var UVEEventType;
|
|
100
|
+
(function (UVEEventType) {
|
|
101
|
+
/**
|
|
102
|
+
* Triggered when page data changes from the editor
|
|
103
|
+
*/
|
|
104
|
+
UVEEventType["CONTENT_CHANGES"] = "changes";
|
|
105
|
+
/**
|
|
106
|
+
* Triggered when the page needs to be reloaded
|
|
107
|
+
*/
|
|
108
|
+
UVEEventType["PAGE_RELOAD"] = "page-reload";
|
|
109
|
+
/**
|
|
110
|
+
* Triggered when the editor requests container bounds
|
|
111
|
+
*/
|
|
112
|
+
UVEEventType["REQUEST_BOUNDS"] = "request-bounds";
|
|
113
|
+
/**
|
|
114
|
+
* Triggered when scroll action is needed inside the iframe
|
|
115
|
+
*/
|
|
116
|
+
UVEEventType["IFRAME_SCROLL"] = "iframe-scroll";
|
|
117
|
+
/**
|
|
118
|
+
* Triggered when a contentlet is hovered
|
|
119
|
+
*/
|
|
120
|
+
UVEEventType["CONTENTLET_HOVERED"] = "contentlet-hovered";
|
|
121
|
+
})(UVEEventType || (UVEEventType = {}));
|
|
122
|
+
|
|
123
|
+
export { DEVELOPMENT_MODE, DotCMSUVEAction, PRODUCTION_MODE, UVEEventType, UVE_MODE };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/internal";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exports._default = require('./internal.cjs.js').default;
|
package/internal.cjs.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Enum representing the different types of blocks available in the Block Editor
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @enum {string}
|
|
8
|
+
*/
|
|
9
|
+
exports.BlockEditorDefaultBlocks = void 0;
|
|
10
|
+
(function (BlockEditorDefaultBlocks) {
|
|
11
|
+
/** Represents a paragraph block */
|
|
12
|
+
BlockEditorDefaultBlocks["PARAGRAPH"] = "paragraph";
|
|
13
|
+
/** Represents a heading block */
|
|
14
|
+
BlockEditorDefaultBlocks["HEADING"] = "heading";
|
|
15
|
+
/** Represents a text block */
|
|
16
|
+
BlockEditorDefaultBlocks["TEXT"] = "text";
|
|
17
|
+
/** Represents a bullet/unordered list block */
|
|
18
|
+
BlockEditorDefaultBlocks["BULLET_LIST"] = "bulletList";
|
|
19
|
+
/** Represents an ordered/numbered list block */
|
|
20
|
+
BlockEditorDefaultBlocks["ORDERED_LIST"] = "orderedList";
|
|
21
|
+
/** Represents a list item within a list block */
|
|
22
|
+
BlockEditorDefaultBlocks["LIST_ITEM"] = "listItem";
|
|
23
|
+
/** Represents a blockquote block */
|
|
24
|
+
BlockEditorDefaultBlocks["BLOCK_QUOTE"] = "blockquote";
|
|
25
|
+
/** Represents a code block */
|
|
26
|
+
BlockEditorDefaultBlocks["CODE_BLOCK"] = "codeBlock";
|
|
27
|
+
/** Represents a hard break (line break) */
|
|
28
|
+
BlockEditorDefaultBlocks["HARDBREAK"] = "hardBreak";
|
|
29
|
+
/** Represents a horizontal rule/divider */
|
|
30
|
+
BlockEditorDefaultBlocks["HORIZONTAL_RULE"] = "horizontalRule";
|
|
31
|
+
/** Represents a DotCMS image block */
|
|
32
|
+
BlockEditorDefaultBlocks["DOT_IMAGE"] = "dotImage";
|
|
33
|
+
/** Represents a DotCMS video block */
|
|
34
|
+
BlockEditorDefaultBlocks["DOT_VIDEO"] = "dotVideo";
|
|
35
|
+
/** Represents a table block */
|
|
36
|
+
BlockEditorDefaultBlocks["TABLE"] = "table";
|
|
37
|
+
/** Represents a DotCMS content block */
|
|
38
|
+
BlockEditorDefaultBlocks["DOT_CONTENT"] = "dotContent";
|
|
39
|
+
})(exports.BlockEditorDefaultBlocks || (exports.BlockEditorDefaultBlocks = {}));
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Actions received from the dotcms editor
|
|
43
|
+
*
|
|
44
|
+
* @export
|
|
45
|
+
* @enum {number}
|
|
46
|
+
*/
|
|
47
|
+
exports.__DOTCMS_UVE_EVENT__ = void 0;
|
|
48
|
+
(function (__DOTCMS_UVE_EVENT__) {
|
|
49
|
+
/**
|
|
50
|
+
* Request to page to reload
|
|
51
|
+
*/
|
|
52
|
+
__DOTCMS_UVE_EVENT__["UVE_RELOAD_PAGE"] = "uve-reload-page";
|
|
53
|
+
/**
|
|
54
|
+
* Request the bounds for the elements
|
|
55
|
+
*/
|
|
56
|
+
__DOTCMS_UVE_EVENT__["UVE_REQUEST_BOUNDS"] = "uve-request-bounds";
|
|
57
|
+
/**
|
|
58
|
+
* Received pong from the editor
|
|
59
|
+
*/
|
|
60
|
+
__DOTCMS_UVE_EVENT__["UVE_EDITOR_PONG"] = "uve-editor-pong";
|
|
61
|
+
/**
|
|
62
|
+
* Received scroll event trigger from the editor
|
|
63
|
+
*/
|
|
64
|
+
__DOTCMS_UVE_EVENT__["UVE_SCROLL_INSIDE_IFRAME"] = "uve-scroll-inside-iframe";
|
|
65
|
+
/**
|
|
66
|
+
* TODO:
|
|
67
|
+
* Set the page data - This is used to catch the "changes" event.
|
|
68
|
+
* We must to re-check the name late.
|
|
69
|
+
*/
|
|
70
|
+
__DOTCMS_UVE_EVENT__["UVE_SET_PAGE_DATA"] = "uve-set-page-data";
|
|
71
|
+
/**
|
|
72
|
+
* Copy contentlet inline editing success
|
|
73
|
+
*/
|
|
74
|
+
__DOTCMS_UVE_EVENT__["UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS"] = "uve-copy-contentlet-inline-editing-success";
|
|
75
|
+
})(exports.__DOTCMS_UVE_EVENT__ || (exports.__DOTCMS_UVE_EVENT__ = {}));
|
package/internal.cjs.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/internal";
|
package/internal.esm.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing the different types of blocks available in the Block Editor
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
var BlockEditorDefaultBlocks;
|
|
8
|
+
(function (BlockEditorDefaultBlocks) {
|
|
9
|
+
/** Represents a paragraph block */
|
|
10
|
+
BlockEditorDefaultBlocks["PARAGRAPH"] = "paragraph";
|
|
11
|
+
/** Represents a heading block */
|
|
12
|
+
BlockEditorDefaultBlocks["HEADING"] = "heading";
|
|
13
|
+
/** Represents a text block */
|
|
14
|
+
BlockEditorDefaultBlocks["TEXT"] = "text";
|
|
15
|
+
/** Represents a bullet/unordered list block */
|
|
16
|
+
BlockEditorDefaultBlocks["BULLET_LIST"] = "bulletList";
|
|
17
|
+
/** Represents an ordered/numbered list block */
|
|
18
|
+
BlockEditorDefaultBlocks["ORDERED_LIST"] = "orderedList";
|
|
19
|
+
/** Represents a list item within a list block */
|
|
20
|
+
BlockEditorDefaultBlocks["LIST_ITEM"] = "listItem";
|
|
21
|
+
/** Represents a blockquote block */
|
|
22
|
+
BlockEditorDefaultBlocks["BLOCK_QUOTE"] = "blockquote";
|
|
23
|
+
/** Represents a code block */
|
|
24
|
+
BlockEditorDefaultBlocks["CODE_BLOCK"] = "codeBlock";
|
|
25
|
+
/** Represents a hard break (line break) */
|
|
26
|
+
BlockEditorDefaultBlocks["HARDBREAK"] = "hardBreak";
|
|
27
|
+
/** Represents a horizontal rule/divider */
|
|
28
|
+
BlockEditorDefaultBlocks["HORIZONTAL_RULE"] = "horizontalRule";
|
|
29
|
+
/** Represents a DotCMS image block */
|
|
30
|
+
BlockEditorDefaultBlocks["DOT_IMAGE"] = "dotImage";
|
|
31
|
+
/** Represents a DotCMS video block */
|
|
32
|
+
BlockEditorDefaultBlocks["DOT_VIDEO"] = "dotVideo";
|
|
33
|
+
/** Represents a table block */
|
|
34
|
+
BlockEditorDefaultBlocks["TABLE"] = "table";
|
|
35
|
+
/** Represents a DotCMS content block */
|
|
36
|
+
BlockEditorDefaultBlocks["DOT_CONTENT"] = "dotContent";
|
|
37
|
+
})(BlockEditorDefaultBlocks || (BlockEditorDefaultBlocks = {}));
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Actions received from the dotcms editor
|
|
41
|
+
*
|
|
42
|
+
* @export
|
|
43
|
+
* @enum {number}
|
|
44
|
+
*/
|
|
45
|
+
var __DOTCMS_UVE_EVENT__;
|
|
46
|
+
(function (__DOTCMS_UVE_EVENT__) {
|
|
47
|
+
/**
|
|
48
|
+
* Request to page to reload
|
|
49
|
+
*/
|
|
50
|
+
__DOTCMS_UVE_EVENT__["UVE_RELOAD_PAGE"] = "uve-reload-page";
|
|
51
|
+
/**
|
|
52
|
+
* Request the bounds for the elements
|
|
53
|
+
*/
|
|
54
|
+
__DOTCMS_UVE_EVENT__["UVE_REQUEST_BOUNDS"] = "uve-request-bounds";
|
|
55
|
+
/**
|
|
56
|
+
* Received pong from the editor
|
|
57
|
+
*/
|
|
58
|
+
__DOTCMS_UVE_EVENT__["UVE_EDITOR_PONG"] = "uve-editor-pong";
|
|
59
|
+
/**
|
|
60
|
+
* Received scroll event trigger from the editor
|
|
61
|
+
*/
|
|
62
|
+
__DOTCMS_UVE_EVENT__["UVE_SCROLL_INSIDE_IFRAME"] = "uve-scroll-inside-iframe";
|
|
63
|
+
/**
|
|
64
|
+
* TODO:
|
|
65
|
+
* Set the page data - This is used to catch the "changes" event.
|
|
66
|
+
* We must to re-check the name late.
|
|
67
|
+
*/
|
|
68
|
+
__DOTCMS_UVE_EVENT__["UVE_SET_PAGE_DATA"] = "uve-set-page-data";
|
|
69
|
+
/**
|
|
70
|
+
* Copy contentlet inline editing success
|
|
71
|
+
*/
|
|
72
|
+
__DOTCMS_UVE_EVENT__["UVE_COPY_CONTENTLET_INLINE_EDITING_SUCCESS"] = "uve-copy-contentlet-inline-editing-success";
|
|
73
|
+
})(__DOTCMS_UVE_EVENT__ || (__DOTCMS_UVE_EVENT__ = {}));
|
|
74
|
+
|
|
75
|
+
export { BlockEditorDefaultBlocks, __DOTCMS_UVE_EVENT__ };
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dotcms/types",
|
|
3
|
+
"version": "0.0.1-beta.25",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"dotCMS",
|
|
6
|
+
"CMS",
|
|
7
|
+
"Content Management",
|
|
8
|
+
"UVE",
|
|
9
|
+
"Universal Visual Editor"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
"./package.json": "./package.json",
|
|
13
|
+
".": {
|
|
14
|
+
"module": "./index.esm.js",
|
|
15
|
+
"types": "./index.esm.d.ts",
|
|
16
|
+
"import": "./index.cjs.mjs",
|
|
17
|
+
"default": "./index.cjs.js"
|
|
18
|
+
},
|
|
19
|
+
"./internal": {
|
|
20
|
+
"module": "./internal.esm.js",
|
|
21
|
+
"types": "./internal.esm.d.ts",
|
|
22
|
+
"import": "./internal.cjs.mjs",
|
|
23
|
+
"default": "./internal.cjs.js"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"typesVersions": {
|
|
27
|
+
"*": {
|
|
28
|
+
".": [
|
|
29
|
+
"./src/index.d.ts"
|
|
30
|
+
],
|
|
31
|
+
"internal": [
|
|
32
|
+
"./src/internal.d.ts"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"module": "./index.esm.js",
|
|
37
|
+
"main": "./index.cjs.js",
|
|
38
|
+
"types": "./index.esm.d.ts"
|
|
39
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum representing the different types of blocks available in the Block Editor
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
export declare enum BlockEditorDefaultBlocks {
|
|
8
|
+
/** Represents a paragraph block */
|
|
9
|
+
PARAGRAPH = "paragraph",
|
|
10
|
+
/** Represents a heading block */
|
|
11
|
+
HEADING = "heading",
|
|
12
|
+
/** Represents a text block */
|
|
13
|
+
TEXT = "text",
|
|
14
|
+
/** Represents a bullet/unordered list block */
|
|
15
|
+
BULLET_LIST = "bulletList",
|
|
16
|
+
/** Represents an ordered/numbered list block */
|
|
17
|
+
ORDERED_LIST = "orderedList",
|
|
18
|
+
/** Represents a list item within a list block */
|
|
19
|
+
LIST_ITEM = "listItem",
|
|
20
|
+
/** Represents a blockquote block */
|
|
21
|
+
BLOCK_QUOTE = "blockquote",
|
|
22
|
+
/** Represents a code block */
|
|
23
|
+
CODE_BLOCK = "codeBlock",
|
|
24
|
+
/** Represents a hard break (line break) */
|
|
25
|
+
HARDBREAK = "hardBreak",
|
|
26
|
+
/** Represents a horizontal rule/divider */
|
|
27
|
+
HORIZONTAL_RULE = "horizontalRule",
|
|
28
|
+
/** Represents a DotCMS image block */
|
|
29
|
+
DOT_IMAGE = "dotImage",
|
|
30
|
+
/** Represents a DotCMS video block */
|
|
31
|
+
DOT_VIDEO = "dotVideo",
|
|
32
|
+
/** Represents a table block */
|
|
33
|
+
TABLE = "table",
|
|
34
|
+
/** Represents a DotCMS content block */
|
|
35
|
+
DOT_CONTENT = "dotContent"
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Represents the validation state of a Block Editor instance
|
|
39
|
+
*
|
|
40
|
+
* @interface BlockEditorState
|
|
41
|
+
* @property {boolean} isValid - Whether the blocks structure is valid
|
|
42
|
+
* @property {string | null} error - Error message if blocks are invalid, null otherwise
|
|
43
|
+
*/
|
|
44
|
+
export interface BlockEditorState {
|
|
45
|
+
error: string | null;
|
|
46
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a Mark used by text content in the Block Editor
|
|
3
|
+
*
|
|
4
|
+
* @export
|
|
5
|
+
* @interface Mark
|
|
6
|
+
*/
|
|
7
|
+
export interface BlockEditorMark {
|
|
8
|
+
type: string;
|
|
9
|
+
attrs: Record<string, string>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Represents a Content Node used by the Block Editor
|
|
13
|
+
*
|
|
14
|
+
* @export
|
|
15
|
+
* @interface BlockEditorNode
|
|
16
|
+
*/
|
|
17
|
+
export interface BlockEditorNode {
|
|
18
|
+
/** The type of content node */
|
|
19
|
+
type: string;
|
|
20
|
+
/** Child content nodes */
|
|
21
|
+
content?: BlockEditorNode[];
|
|
22
|
+
/** Optional attributes for the node */
|
|
23
|
+
attrs?: Record<string, any>;
|
|
24
|
+
/** Optional marks applied to text content */
|
|
25
|
+
marks?: BlockEditorMark[];
|
|
26
|
+
/** Optional text content */
|
|
27
|
+
text?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Represents a Block in the Block Editor
|
|
31
|
+
*
|
|
32
|
+
* @export
|
|
33
|
+
* @interface BlockEditorContent
|
|
34
|
+
*/
|
|
35
|
+
export interface BlockEditorContent {
|
|
36
|
+
content?: BlockEditorNode[];
|
|
37
|
+
type: string;
|
|
38
|
+
}
|