@kabel-project/kabel 1.0.7
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/(1.0.7)kabel.md +18 -0
- package/README.md +96 -0
- package/_READ_ME_MEDIA_/documentation/docs.md +293 -0
- package/_READ_ME_MEDIA_/workspace.png +0 -0
- package/comment-renderer/renderer.ts +228 -0
- package/controllers/base.ts +186 -0
- package/controllers/wasd.ts +132 -0
- package/docs/README.md +98 -0
- package/docs/_media/docs.md +289 -0
- package/docs/_media/index.html +168 -0
- package/docs/_media/workspace.png +0 -0
- package/docs/classes/CommentModel.md +271 -0
- package/docs/classes/CommentRenderer.md +457 -0
- package/docs/classes/ConnectableField.md +597 -0
- package/docs/classes/Connection.md +191 -0
- package/docs/classes/ContextMenuHTML.md +163 -0
- package/docs/classes/Coordinates.md +187 -0
- package/docs/classes/DropdownContainer.md +300 -0
- package/docs/classes/DummyField.md +393 -0
- package/docs/classes/Eventer.md +185 -0
- package/docs/classes/Field.md +461 -0
- package/docs/classes/InjectMsg.md +85 -0
- package/docs/classes/NodeSvg.md +1011 -0
- package/docs/classes/NumberField.md +559 -0
- package/docs/classes/OptConnectField.md +624 -0
- package/docs/classes/Renderer.md +1636 -0
- package/docs/classes/RendererConstants.md +343 -0
- package/docs/classes/Representer.md +95 -0
- package/docs/classes/RepresenterNode.md +175 -0
- package/docs/classes/TextField.md +559 -0
- package/docs/classes/Toolbox.md +172 -0
- package/docs/classes/WASDController.md +616 -0
- package/docs/classes/Widget.md +195 -0
- package/docs/classes/WorkspaceController.md +385 -0
- package/docs/classes/WorkspaceCoords.md +218 -0
- package/docs/classes/WorkspaceSvg.md +1380 -0
- package/docs/functions/clearMainWorkspace.md +20 -0
- package/docs/functions/getMainWorkspace.md +19 -0
- package/docs/functions/inject.md +35 -0
- package/docs/functions/setMainWorkspace.md +28 -0
- package/docs/globals.md +95 -0
- package/docs/interfaces/ColorStyle.md +43 -0
- package/docs/interfaces/ConnectorToFrom.md +57 -0
- package/docs/interfaces/DrawState.md +81 -0
- package/docs/interfaces/FieldConnectionData.md +25 -0
- package/docs/interfaces/FieldOptions.md +63 -0
- package/docs/interfaces/FieldRawBoxData.md +25 -0
- package/docs/interfaces/FieldVisualInfo.md +65 -0
- package/docs/interfaces/GridOptions.md +61 -0
- package/docs/interfaces/InjectOptions.md +133 -0
- package/docs/interfaces/InputFieldJson.md +50 -0
- package/docs/interfaces/KabelCommentRendering.md +31 -0
- package/docs/interfaces/KabelInterface.md +469 -0
- package/docs/interfaces/KabelNodeRendering.md +77 -0
- package/docs/interfaces/KabelUIX.md +105 -0
- package/docs/interfaces/KabelUtils.md +215 -0
- package/docs/interfaces/NodeEvents.md +42 -0
- package/docs/interfaces/NodeJson.md +104 -0
- package/docs/interfaces/NodePrototype.md +82 -0
- package/docs/interfaces/RegisteredEl.md +53 -0
- package/docs/interfaces/SerializedNode.md +128 -0
- package/docs/interfaces/TblxCategoryStruct.md +41 -0
- package/docs/interfaces/TblxFieldStruct.md +28 -0
- package/docs/interfaces/TblxNodeStruct.md +35 -0
- package/docs/interfaces/WidgetOptions.md +115 -0
- package/docs/interfaces/WidgetPrototypeList.md +15 -0
- package/docs/type-aliases/AnyField.md +13 -0
- package/docs/type-aliases/AnyFieldCls.md +13 -0
- package/docs/type-aliases/Color.md +13 -0
- package/docs/type-aliases/Connectable.md +13 -0
- package/docs/type-aliases/EventArgs.md +11 -0
- package/docs/type-aliases/EventSetupFn.md +25 -0
- package/docs/type-aliases/Hex.md +13 -0
- package/docs/type-aliases/RGBObject.md +37 -0
- package/docs/type-aliases/RGBString.md +13 -0
- package/docs/type-aliases/RGBTuple.md +13 -0
- package/docs/type-aliases/TblxObjStruct.md +52 -0
- package/docs/variables/CategoryColors.md +29 -0
- package/docs/variables/FieldMap.md +41 -0
- package/docs/variables/NodePrototypes.md +18 -0
- package/docs/variables/default.md +11 -0
- package/events/comment-drag-handle.ts +61 -0
- package/events/comment-input.ts +291 -0
- package/events/connection-line.ts +68 -0
- package/events/connector.ts +116 -0
- package/events/draggable.ts +119 -0
- package/events/events.ts +7 -0
- package/events/input-box.ts +213 -0
- package/events/node-x-btn.ts +25 -0
- package/index.d.ts +4 -0
- package/package.json +49 -0
- package/renderers/apollo/apollo.ts +21 -0
- package/renderers/apollo/constants.ts +40 -0
- package/renderers/apollo/renderer.ts +331 -0
- package/renderers/atlas/atlas.ts +15 -0
- package/renderers/constants.ts +87 -0
- package/renderers/renderer.ts +1288 -0
- package/renderers/representer-node.ts +52 -0
- package/renderers/representer.ts +25 -0
- package/src/category.ts +107 -0
- package/src/colors.ts +20 -0
- package/src/comment.ts +142 -0
- package/src/connection.ts +114 -0
- package/src/context-menu.ts +194 -0
- package/src/coordinates.ts +74 -0
- package/src/core.ts +202 -0
- package/src/ctx-menu-registry.ts +143 -0
- package/src/dropdown-menu.ts +215 -0
- package/src/field.ts +595 -0
- package/src/flyout.ts +165 -0
- package/src/fonts-manager.ts +38 -0
- package/src/grid.ts +162 -0
- package/src/headless-node.ts +27 -0
- package/src/index.ts +115 -0
- package/src/inject-headless.ts +18 -0
- package/src/inject.ts +213 -0
- package/src/main-workspace.ts +51 -0
- package/src/mutator.ts +40 -0
- package/src/node-types.ts +27 -0
- package/src/nodesvg.ts +756 -0
- package/src/prototypes.ts +9 -0
- package/src/renderer-map.ts +86 -0
- package/src/styles.css +224 -0
- package/src/toolbox.ts +125 -0
- package/src/types.ts +205 -0
- package/src/undo-redo.ts +87 -0
- package/src/visual-types.ts +29 -0
- package/src/widget-prototypes.ts +11 -0
- package/src/widget.ts +139 -0
- package/src/workspace-coords.ts +14 -0
- package/src/workspace-svg.ts +736 -0
- package/src/workspace.ts +155 -0
- package/test-server.js +61 -0
- package/themes/dark.ts +32 -0
- package/themes/default.ts +28 -0
- package/themes/themes.ts +9 -0
- package/tsconfig.json +25 -0
- package/typedoc.json +10 -0
- package/util/emitter.ts +33 -0
- package/util/env.ts +11 -0
- package/util/escape-html.ts +22 -0
- package/util/eventer.ts +108 -0
- package/util/has-prop.ts +4 -0
- package/util/parse-color.ts +42 -0
- package/util/path.ts +99 -0
- package/util/styler.ts +41 -0
- package/util/uid.ts +184 -0
- package/util/unescape-html.ts +22 -0
- package/util/user-state.ts +68 -0
- package/util/wait-anim-frames.ts +24 -0
- package/util/window-listeners.ts +62 -0
- package/webpack.config.js +80 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8">
|
|
6
|
+
<title>Kabel Test</title>
|
|
7
|
+
<style>
|
|
8
|
+
html,
|
|
9
|
+
body {
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: 100%;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<script>
|
|
21
|
+
function initKabel() {
|
|
22
|
+
function main() {
|
|
23
|
+
const k = Kabel;
|
|
24
|
+
|
|
25
|
+
const el = document.createElement('div');
|
|
26
|
+
Object.assign(el.style, {
|
|
27
|
+
width: '100vw',
|
|
28
|
+
height: '100vh',
|
|
29
|
+
background: '#f0f0f0'
|
|
30
|
+
});
|
|
31
|
+
document.body.appendChild(el);
|
|
32
|
+
/**
|
|
33
|
+
*{
|
|
34
|
+
type: 'category',
|
|
35
|
+
contents: [{
|
|
36
|
+
name: "Cat",
|
|
37
|
+
color: "#cc0c00",
|
|
38
|
+
contents: [{
|
|
39
|
+
type: 'my_node',
|
|
40
|
+
arguments: {}
|
|
41
|
+
}]
|
|
42
|
+
}]
|
|
43
|
+
}
|
|
44
|
+
*/
|
|
45
|
+
k.Nodes['my_node'] = {
|
|
46
|
+
init() {
|
|
47
|
+
this.jsonInit({
|
|
48
|
+
previousConnection: true,
|
|
49
|
+
nextConnection: true,
|
|
50
|
+
labelText: 'TopbarText',
|
|
51
|
+
type: 'my_node',
|
|
52
|
+
primaryColor: '#cc0c00',
|
|
53
|
+
secondaryColor: '#990900',
|
|
54
|
+
tertiaryColor: '#660500',
|
|
55
|
+
arguments: [
|
|
56
|
+
{
|
|
57
|
+
name: 'FLD',
|
|
58
|
+
type: 'field_str',
|
|
59
|
+
label: 'LabelText: ',
|
|
60
|
+
value: 'ValueText'
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: 'Dummy',
|
|
64
|
+
type: 'field_dummy',
|
|
65
|
+
label: 'Label with no input!'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'Conn',
|
|
69
|
+
type: 'connection',
|
|
70
|
+
label: 'Label!'
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'Conn2',
|
|
74
|
+
type: 'field_both',
|
|
75
|
+
label: 'lowk: ',
|
|
76
|
+
value: 'lowk'
|
|
77
|
+
}, {
|
|
78
|
+
name: 'Dropdown',
|
|
79
|
+
type: 'dropdown',
|
|
80
|
+
label: 'lowk dropdown?: ',
|
|
81
|
+
options: [
|
|
82
|
+
'Oooo option',
|
|
83
|
+
{ text: 'Opt', value: 'opt' }
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
]
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
k.Widgets['testWidget'] = {
|
|
91
|
+
name: 'Test Widget',
|
|
92
|
+
width: 150,
|
|
93
|
+
height: 100,
|
|
94
|
+
coords: new k.Coordinates(50, 50),
|
|
95
|
+
html: '<button id="counterBtn">Count: 0</button>',
|
|
96
|
+
init: function (widget, container) {
|
|
97
|
+
let count = 0;
|
|
98
|
+
const btn = container.querySelector('#counterBtn');
|
|
99
|
+
if (btn) {
|
|
100
|
+
btn.addEventListener('click', function () {
|
|
101
|
+
count++;
|
|
102
|
+
btn.textContent = 'Count: ' + count;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
// Use WASDController with acceleration
|
|
108
|
+
const ws = k.inject(el, {
|
|
109
|
+
theme: k.Themes.Dark,
|
|
110
|
+
renderer: 'apollo',
|
|
111
|
+
moveSpeed: 6, // optional, base speed
|
|
112
|
+
initUndoRedo: false,
|
|
113
|
+
controls: {
|
|
114
|
+
wasd: true,
|
|
115
|
+
wasdSmooth: true,
|
|
116
|
+
wasdAccelerate: 1,
|
|
117
|
+
wasdFriction: 0.9
|
|
118
|
+
},
|
|
119
|
+
grid: {
|
|
120
|
+
type: 'celled',
|
|
121
|
+
color: '#333333'
|
|
122
|
+
},
|
|
123
|
+
toolbox: {
|
|
124
|
+
type: 'category',
|
|
125
|
+
contents: [{
|
|
126
|
+
name: "Cat",
|
|
127
|
+
color: "#cc0c00",
|
|
128
|
+
contents: [{
|
|
129
|
+
type: 'my_node',
|
|
130
|
+
arguments: {}
|
|
131
|
+
}]
|
|
132
|
+
}]
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
// Define custom node type
|
|
137
|
+
|
|
138
|
+
// Create nodes
|
|
139
|
+
ws.toggleHistory(false);
|
|
140
|
+
const node = new k.NodeSvg(k.Nodes['my_node'], ws);
|
|
141
|
+
node.init();
|
|
142
|
+
|
|
143
|
+
const node1 = new k.NodeSvg(k.Nodes['my_node'], ws);
|
|
144
|
+
node1.init();
|
|
145
|
+
node1.relativeCoords.set(20, 0);
|
|
146
|
+
|
|
147
|
+
node.nextConnection.to = node1;
|
|
148
|
+
node1.previousConnection.from = node;
|
|
149
|
+
ws.untoggleHistory();
|
|
150
|
+
ws.redraw();
|
|
151
|
+
ws.history.emitChange();
|
|
152
|
+
const myWidget = ws.newWidget('testWidget');
|
|
153
|
+
if (myWidget) myWidget.show(); // make it visible
|
|
154
|
+
// Expose for debugging
|
|
155
|
+
window.ws = ws;
|
|
156
|
+
window.nodes = [node, node1];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (typeof Kabel !== 'undefined') {
|
|
160
|
+
main();
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
</script>
|
|
164
|
+
|
|
165
|
+
<script src="./kabel.js" onload="initKabel()"></script>
|
|
166
|
+
</body>
|
|
167
|
+
|
|
168
|
+
</html>
|
|
Binary file
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
[**Kabel Project Docs v1.0.6**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[Kabel Project Docs](../globals.md) / CommentModel
|
|
6
|
+
|
|
7
|
+
# Class: CommentModel
|
|
8
|
+
|
|
9
|
+
Defined in: [src/comment.ts:18](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L18)
|
|
10
|
+
|
|
11
|
+
Represents a comment attached to either a NodeSvg or a WorkspaceSvg.
|
|
12
|
+
|
|
13
|
+
## Constructors
|
|
14
|
+
|
|
15
|
+
### Constructor
|
|
16
|
+
|
|
17
|
+
> **new CommentModel**(`parent`): `CommentModel`
|
|
18
|
+
|
|
19
|
+
Defined in: [src/comment.ts:47](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L47)
|
|
20
|
+
|
|
21
|
+
Creates a new comment attached to a node or workspace.
|
|
22
|
+
|
|
23
|
+
#### Parameters
|
|
24
|
+
|
|
25
|
+
##### parent
|
|
26
|
+
|
|
27
|
+
NodeSvg or WorkspaceSvg this comment belongs to
|
|
28
|
+
|
|
29
|
+
[`NodeSvg`](NodeSvg.md) | [`WorkspaceSvg`](WorkspaceSvg.md) | `Workspace`
|
|
30
|
+
|
|
31
|
+
#### Returns
|
|
32
|
+
|
|
33
|
+
`CommentModel`
|
|
34
|
+
|
|
35
|
+
## Properties
|
|
36
|
+
|
|
37
|
+
### \_isWorkspaceComment
|
|
38
|
+
|
|
39
|
+
> **\_isWorkspaceComment**: `boolean`
|
|
40
|
+
|
|
41
|
+
Defined in: [src/comment.ts:23](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L23)
|
|
42
|
+
|
|
43
|
+
True if this comment belongs to the workspace instead of a node
|
|
44
|
+
|
|
45
|
+
***
|
|
46
|
+
|
|
47
|
+
### \_parent
|
|
48
|
+
|
|
49
|
+
> **\_parent**: [`NodeSvg`](NodeSvg.md) \| [`WorkspaceSvg`](WorkspaceSvg.md) \| `Workspace`
|
|
50
|
+
|
|
51
|
+
Defined in: [src/comment.ts:26](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L26)
|
|
52
|
+
|
|
53
|
+
Parent NodeSvg or WorkspaceSvg to which this comment belongs
|
|
54
|
+
|
|
55
|
+
***
|
|
56
|
+
|
|
57
|
+
### \_tempInputBBox?
|
|
58
|
+
|
|
59
|
+
> `optional` **\_tempInputBBox**: `object`
|
|
60
|
+
|
|
61
|
+
Defined in: [src/comment.ts:38](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L38)
|
|
62
|
+
|
|
63
|
+
Temporary bounding box info for input handling
|
|
64
|
+
|
|
65
|
+
#### height
|
|
66
|
+
|
|
67
|
+
> **height**: `number`
|
|
68
|
+
|
|
69
|
+
#### textX
|
|
70
|
+
|
|
71
|
+
> **textX**: `number`
|
|
72
|
+
|
|
73
|
+
#### textY
|
|
74
|
+
|
|
75
|
+
> **textY**: `number`
|
|
76
|
+
|
|
77
|
+
#### width
|
|
78
|
+
|
|
79
|
+
> **width**: `number`
|
|
80
|
+
|
|
81
|
+
***
|
|
82
|
+
|
|
83
|
+
### \_text
|
|
84
|
+
|
|
85
|
+
> **\_text**: `string`
|
|
86
|
+
|
|
87
|
+
Defined in: [src/comment.ts:20](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L20)
|
|
88
|
+
|
|
89
|
+
The comment text
|
|
90
|
+
|
|
91
|
+
***
|
|
92
|
+
|
|
93
|
+
### id
|
|
94
|
+
|
|
95
|
+
> **id**: `string`
|
|
96
|
+
|
|
97
|
+
Defined in: [src/comment.ts:41](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L41)
|
|
98
|
+
|
|
99
|
+
Unique identifier for this comment
|
|
100
|
+
|
|
101
|
+
***
|
|
102
|
+
|
|
103
|
+
### relativeCoords
|
|
104
|
+
|
|
105
|
+
> **relativeCoords**: [`Coordinates`](Coordinates.md)
|
|
106
|
+
|
|
107
|
+
Defined in: [src/comment.ts:32](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L32)
|
|
108
|
+
|
|
109
|
+
Coordinates relative to parent
|
|
110
|
+
|
|
111
|
+
***
|
|
112
|
+
|
|
113
|
+
### svgGroup?
|
|
114
|
+
|
|
115
|
+
> `optional` **svgGroup**: `G`
|
|
116
|
+
|
|
117
|
+
Defined in: [src/comment.ts:29](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L29)
|
|
118
|
+
|
|
119
|
+
SVG group representing this comment in the DOM
|
|
120
|
+
|
|
121
|
+
***
|
|
122
|
+
|
|
123
|
+
### svgLine?
|
|
124
|
+
|
|
125
|
+
> `optional` **svgLine**: `Line`
|
|
126
|
+
|
|
127
|
+
Defined in: [src/comment.ts:35](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L35)
|
|
128
|
+
|
|
129
|
+
Optional SVG line connecting the comment to its node
|
|
130
|
+
|
|
131
|
+
## Methods
|
|
132
|
+
|
|
133
|
+
### getText()
|
|
134
|
+
|
|
135
|
+
> **getText**(): `string`
|
|
136
|
+
|
|
137
|
+
Defined in: [src/comment.ts:70](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L70)
|
|
138
|
+
|
|
139
|
+
Retrieves the current text of the comment.
|
|
140
|
+
|
|
141
|
+
#### Returns
|
|
142
|
+
|
|
143
|
+
`string`
|
|
144
|
+
|
|
145
|
+
The comment text
|
|
146
|
+
|
|
147
|
+
***
|
|
148
|
+
|
|
149
|
+
### getWorkspace()
|
|
150
|
+
|
|
151
|
+
> **getWorkspace**(): [`WorkspaceSvg`](WorkspaceSvg.md)
|
|
152
|
+
|
|
153
|
+
Defined in: [src/comment.ts:104](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L104)
|
|
154
|
+
|
|
155
|
+
Gets the workspace that owns this comment.
|
|
156
|
+
|
|
157
|
+
#### Returns
|
|
158
|
+
|
|
159
|
+
[`WorkspaceSvg`](WorkspaceSvg.md)
|
|
160
|
+
|
|
161
|
+
***
|
|
162
|
+
|
|
163
|
+
### isNodeComment()
|
|
164
|
+
|
|
165
|
+
> **isNodeComment**(): `boolean`
|
|
166
|
+
|
|
167
|
+
Defined in: [src/comment.ts:90](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L90)
|
|
168
|
+
|
|
169
|
+
Returns true if this comment is attached to a node.
|
|
170
|
+
|
|
171
|
+
#### Returns
|
|
172
|
+
|
|
173
|
+
`boolean`
|
|
174
|
+
|
|
175
|
+
***
|
|
176
|
+
|
|
177
|
+
### isWorkspaceComment()
|
|
178
|
+
|
|
179
|
+
> **isWorkspaceComment**(): `boolean`
|
|
180
|
+
|
|
181
|
+
Defined in: [src/comment.ts:97](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L97)
|
|
182
|
+
|
|
183
|
+
Returns true if this comment is attached to the workspace.
|
|
184
|
+
|
|
185
|
+
#### Returns
|
|
186
|
+
|
|
187
|
+
`boolean`
|
|
188
|
+
|
|
189
|
+
***
|
|
190
|
+
|
|
191
|
+
### setText()
|
|
192
|
+
|
|
193
|
+
> **setText**(`value`): `string`
|
|
194
|
+
|
|
195
|
+
Defined in: [src/comment.ts:79](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L79)
|
|
196
|
+
|
|
197
|
+
Sets the text of the comment and triggers a redraw of all comments in the workspace.
|
|
198
|
+
|
|
199
|
+
#### Parameters
|
|
200
|
+
|
|
201
|
+
##### value
|
|
202
|
+
|
|
203
|
+
`string`
|
|
204
|
+
|
|
205
|
+
New text content
|
|
206
|
+
|
|
207
|
+
#### Returns
|
|
208
|
+
|
|
209
|
+
`string`
|
|
210
|
+
|
|
211
|
+
The updated text
|
|
212
|
+
|
|
213
|
+
***
|
|
214
|
+
|
|
215
|
+
### setTextNoRedraw()
|
|
216
|
+
|
|
217
|
+
> **setTextNoRedraw**(`value`): `string`
|
|
218
|
+
|
|
219
|
+
Defined in: [src/comment.ts:62](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L62)
|
|
220
|
+
|
|
221
|
+
Sets the text of the comment without triggering a comment redraw.
|
|
222
|
+
|
|
223
|
+
#### Parameters
|
|
224
|
+
|
|
225
|
+
##### value
|
|
226
|
+
|
|
227
|
+
`string`
|
|
228
|
+
|
|
229
|
+
New text content
|
|
230
|
+
|
|
231
|
+
#### Returns
|
|
232
|
+
|
|
233
|
+
`string`
|
|
234
|
+
|
|
235
|
+
The updated text
|
|
236
|
+
|
|
237
|
+
***
|
|
238
|
+
|
|
239
|
+
### toJson()
|
|
240
|
+
|
|
241
|
+
> **toJson**(): `CommentSerialized`
|
|
242
|
+
|
|
243
|
+
Defined in: [src/comment.ts:114](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L114)
|
|
244
|
+
|
|
245
|
+
Convert to JSON structure holding all important data.
|
|
246
|
+
|
|
247
|
+
#### Returns
|
|
248
|
+
|
|
249
|
+
`CommentSerialized`
|
|
250
|
+
|
|
251
|
+
***
|
|
252
|
+
|
|
253
|
+
### fromJson()
|
|
254
|
+
|
|
255
|
+
> `static` **fromJson**(`data`): `CommentModel`
|
|
256
|
+
|
|
257
|
+
Defined in: [src/comment.ts:129](https://github.com/FentFentFent/Kabel/blob/6a658c7afa967c18ecfb5cdff24af90b7d7319c3/src/comment.ts#L129)
|
|
258
|
+
|
|
259
|
+
Creates a CommentModel from serialized data.
|
|
260
|
+
|
|
261
|
+
#### Parameters
|
|
262
|
+
|
|
263
|
+
##### data
|
|
264
|
+
|
|
265
|
+
`CommentSerialized`
|
|
266
|
+
|
|
267
|
+
The serialized comment
|
|
268
|
+
|
|
269
|
+
#### Returns
|
|
270
|
+
|
|
271
|
+
`CommentModel`
|