vue-block-editor-headless 0.0.0-stage → 4.5.0
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/LICENSE +201 -0
- package/README.md +68 -2
- package/dist/index.d.ts +383 -0
- package/dist/index.js +1245 -0
- package/package.json +54 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2020-present Jimmy Chen
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,69 @@
|
|
|
1
|
-
#
|
|
1
|
+
# vue-block-editor-headless
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[![Apache-2.0 licensed][badge-license]][url-license]
|
|
4
|
+
[![NPM version][badge-npm-version]][url-npm]
|
|
5
|
+
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
|
+
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
|
+
|
|
8
|
+
This package is a headless Vue block editor with no styling or DOM. It edits a typed node tree over a registry, with commands that edit it as JSON Patch operations, and its `useEditSession` composable holds one document's edit state for a Vue component.
|
|
9
|
+
|
|
10
|
+
Design notes live in [the specs](https://github.com/Esposter/Esposter/tree/main/openspec/specs/vue-block-editor-headless).
|
|
11
|
+
|
|
12
|
+
## Table of Contents
|
|
13
|
+
|
|
14
|
+
- 🚀 [Getting Started](#getting-started)
|
|
15
|
+
- 🧩 [Key Exports](#key-exports)
|
|
16
|
+
- 📝 [Usage](#usage)
|
|
17
|
+
- ⚖️ [License](#license)
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## <a name="getting-started">🚀 Getting Started</a>
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pnpm i vue-block-editor-headless zod
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## <a name="key-exports">🧩 Key Exports</a>
|
|
28
|
+
|
|
29
|
+
| Export | Kind | Purpose |
|
|
30
|
+
| :-------------------------- | :--------- | :----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
31
|
+
| `applyBlockEdit` | function | Applies an edit's operations and parses the result with the document's schema, refusing the whole edit if either fails |
|
|
32
|
+
| `BlockChildren` | type | A consumer's children port, switched on a node's type so a slot the type lacks fails the typecheck |
|
|
33
|
+
| `BlockDocument` | interface | A document: its content and its root's props, with a third type parameter naming the node type the root accepts (default: every node type) |
|
|
34
|
+
| `BlockRegistry` | interface | One definition per block type, and the root's definition |
|
|
35
|
+
| `BlockTypeDefinition` | interface | One block type's props schema, and the child types each of its slots allows |
|
|
36
|
+
| `createBlockDocumentSchema` | function | The document's schema: content the root accepts, props, ids unique across every slot, and a node limit |
|
|
37
|
+
| `getBlockLayerRows` | function | Every node in document order, with its depth and pointer |
|
|
38
|
+
| `insertBlockNode` | function | Adds a node at an index of a slot, or no operations when the slot does not accept its type |
|
|
39
|
+
| `moveBlockNode` | function | Moves a node to an index of another slot as a remove and an add, or no operations when refused |
|
|
40
|
+
| `NO_BLOCK_SLOTS` | constant | The slots of a node that holds none, the record a children port returns for it |
|
|
41
|
+
| `removeBlockNode` | function | Removes the node a pointer names, with its subtree |
|
|
42
|
+
| `renderBlockNodes` | function | Renders each node once its slots have rendered, skipping a node whose type the registry lacks |
|
|
43
|
+
| `updateBlockNodeProps` | function | One JSON Patch add per prop, replacing a prop the node already has |
|
|
44
|
+
| `useEditSession` | composable | An editing session over one document: a commit sets the document and its undo history together, and a load clears the history |
|
|
45
|
+
|
|
46
|
+
## <a name="usage">📝 Usage</a>
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { applyBlockEdit, insertBlockNode } from "vue-block-editor-headless";
|
|
50
|
+
|
|
51
|
+
// The registry, children port and document schema are the consumer's own, the schema made by createBlockDocumentSchema
|
|
52
|
+
const operations = insertBlockNode(document, registry, children, "/content/0/props/children", 1, {
|
|
53
|
+
props: { id: crypto.randomUUID(), text: "" },
|
|
54
|
+
type: "heading",
|
|
55
|
+
});
|
|
56
|
+
// A neverthrow Result: its document is the schema's typed output, and its inverses undo the edit
|
|
57
|
+
const edit = applyBlockEdit(documentSchema, document, operations);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## <a name="license">⚖️ License</a>
|
|
61
|
+
|
|
62
|
+
Licensed under [Apache-2.0][url-license].
|
|
63
|
+
|
|
64
|
+
[badge-license]: https://img.shields.io/github/license/Esposter/Esposter.svg?color=blue
|
|
65
|
+
[url-license]: https://github.com/Esposter/Esposter/blob/main/LICENSE
|
|
66
|
+
[badge-npm-version]: https://img.shields.io/npm/v/vue-block-editor-headless/latest?color=brightgreen
|
|
67
|
+
[url-npm]: https://www.npmjs.com/package/vue-block-editor-headless/v/latest
|
|
68
|
+
[badge-npm-unpacked-size]: https://img.shields.io/npm/unpacked-size/vue-block-editor-headless/latest?label=npm
|
|
69
|
+
[badge-npm-downloads]: https://img.shields.io/npm/dm/vue-block-editor-headless.svg
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import { ApplyPatchesResult, History, ItemEntityType, JsonPatchOperation } from "@esposter/shared";
|
|
2
|
+
import { Ref, ShallowRef, WritableComputedRef } from "vue";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { Result } from "neverthrow";
|
|
5
|
+
export interface EditSession<TDocument, TEntry> {
|
|
6
|
+
commit: (newDocument: TDocument, newHistory: History<TEntry>) => void;
|
|
7
|
+
history: ShallowRef<History<TEntry>>;
|
|
8
|
+
load: (newDocument: TDocument) => void;
|
|
9
|
+
selectedPointer: WritableComputedRef<string>;
|
|
10
|
+
}
|
|
11
|
+
export interface EditSessionSelection<TDocument> {
|
|
12
|
+
getIdByPointer: (document: TDocument, nodePointer: string) => string;
|
|
13
|
+
getPointerById: (document: TDocument, id: string) => string;
|
|
14
|
+
}
|
|
15
|
+
export declare const useEditSession: <TDocument, TEntry>(document: Ref<TDocument>, historyLimit: number, selection?: EditSessionSelection<TDocument>) => EditSession<TDocument, TEntry>;
|
|
16
|
+
export interface ArrowBinding {
|
|
17
|
+
connectionPointIndex: number;
|
|
18
|
+
elementId: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const arrowBindingSchema: z.ZodObject<{
|
|
21
|
+
connectionPointIndex: z.ZodNumber;
|
|
22
|
+
elementId: z.ZodUUID;
|
|
23
|
+
}>;
|
|
24
|
+
export interface Point {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
}
|
|
28
|
+
export declare const pointSchema: z.ZodObject<{
|
|
29
|
+
x: z.ZodNumber;
|
|
30
|
+
y: z.ZodNumber;
|
|
31
|
+
}>;
|
|
32
|
+
export interface ArrowEnd {
|
|
33
|
+
binding?: ArrowBinding;
|
|
34
|
+
hasArrowhead: boolean;
|
|
35
|
+
point: Point;
|
|
36
|
+
}
|
|
37
|
+
export declare const arrowEndSchema: z.ZodObject<{
|
|
38
|
+
binding: z.ZodOptional<typeof arrowBindingSchema>;
|
|
39
|
+
hasArrowhead: z.ZodBoolean;
|
|
40
|
+
point: typeof pointSchema;
|
|
41
|
+
}>;
|
|
42
|
+
export declare enum ArrowPathKind {
|
|
43
|
+
Curved = "curved",
|
|
44
|
+
RightAngled = "rightAngled",
|
|
45
|
+
Straight = "straight"
|
|
46
|
+
}
|
|
47
|
+
export declare const arrowPathKindSchema: z.ZodEnum<typeof ArrowPathKind>;
|
|
48
|
+
export declare enum PositionedElementType {
|
|
49
|
+
Arrow = "arrow",
|
|
50
|
+
Image = "image",
|
|
51
|
+
Shape = "shape",
|
|
52
|
+
StickyNote = "stickyNote",
|
|
53
|
+
Stroke = "stroke",
|
|
54
|
+
Text = "text"
|
|
55
|
+
}
|
|
56
|
+
export interface ArrowElement extends ItemEntityType<PositionedElementType.Arrow> {
|
|
57
|
+
end: ArrowEnd;
|
|
58
|
+
id: string;
|
|
59
|
+
label: string;
|
|
60
|
+
pathKind: ArrowPathKind;
|
|
61
|
+
start: ArrowEnd;
|
|
62
|
+
}
|
|
63
|
+
export declare const arrowElementSchema: z.ZodObject<{
|
|
64
|
+
end: typeof arrowEndSchema;
|
|
65
|
+
id: z.ZodUUID;
|
|
66
|
+
label: z.ZodString;
|
|
67
|
+
pathKind: typeof arrowPathKindSchema;
|
|
68
|
+
start: typeof arrowEndSchema;
|
|
69
|
+
type: z.ZodLiteral<PositionedElementType.Arrow>;
|
|
70
|
+
}>;
|
|
71
|
+
export declare enum ArrowEndKey {
|
|
72
|
+
End = "end",
|
|
73
|
+
Start = "start"
|
|
74
|
+
}
|
|
75
|
+
export interface BlockNodeProps {
|
|
76
|
+
id: string;
|
|
77
|
+
}
|
|
78
|
+
export interface BlockNode<TType extends string = string, TProps extends BlockNodeProps = BlockNodeProps> {
|
|
79
|
+
props: TProps;
|
|
80
|
+
type: TType;
|
|
81
|
+
}
|
|
82
|
+
export type SlotKeys<TProps extends BlockNodeProps> = { [K in keyof TProps]: TProps[K] extends BlockNode[] ? K : never; }[keyof TProps];
|
|
83
|
+
export type BlockSlots<TNode extends BlockNode, TChild extends BlockNode = TNode> = TNode extends BlockNode ? { [TSlot in SlotKeys<TNode["props"]>]: readonly TChild[]; } : never;
|
|
84
|
+
export type BlockChildren<TNode extends BlockNode> = (node: TNode) => BlockSlots<TNode>;
|
|
85
|
+
export interface BlockCollection {
|
|
86
|
+
count: number;
|
|
87
|
+
ids: Set<string>;
|
|
88
|
+
}
|
|
89
|
+
export type BlockRootProps = object;
|
|
90
|
+
export interface BlockDocument<TNode extends BlockNode = BlockNode, TRootProps extends BlockRootProps = BlockRootProps, TRootNode extends TNode = TNode> {
|
|
91
|
+
content: TRootNode[];
|
|
92
|
+
root: {
|
|
93
|
+
props: TRootProps;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface BlockDocumentInput {
|
|
97
|
+
content: unknown[];
|
|
98
|
+
root: {
|
|
99
|
+
props: unknown;
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export interface BlockLayerRow {
|
|
103
|
+
depth: number;
|
|
104
|
+
nodePointer: string;
|
|
105
|
+
type: string;
|
|
106
|
+
}
|
|
107
|
+
export interface BlockRootDefinition<TProps extends BlockRootProps = BlockRootProps, TType extends string = string> {
|
|
108
|
+
content: TType[];
|
|
109
|
+
propsSchema: z.ZodType<TProps>;
|
|
110
|
+
}
|
|
111
|
+
export type NodeTypeOf<TList> = TList extends BlockNode[] ? TList[number]["type"] : never;
|
|
112
|
+
export type OwnProps<TProps extends BlockNodeProps> = { [K in keyof TProps as K extends "id" | SlotKeys<TProps> ? never : K]: TProps[K]; };
|
|
113
|
+
export interface BlockTypeDefinition<TNode extends BlockNode = BlockNode> {
|
|
114
|
+
propsSchema: z.ZodType<OwnProps<TNode["props"]>>;
|
|
115
|
+
slots: { [K in SlotKeys<TNode["props"]>]: NodeTypeOf<TNode["props"][K]>[]; };
|
|
116
|
+
type: TNode["type"];
|
|
117
|
+
}
|
|
118
|
+
export interface BlockRegistry<TNode extends BlockNode = BlockNode, TRootProps extends BlockRootProps = BlockRootProps, TDefinition extends BlockTypeDefinition<TNode> = BlockTypeDefinition<TNode>> {
|
|
119
|
+
root: BlockRootDefinition<TRootProps, TNode["type"]>;
|
|
120
|
+
types: TDefinition[];
|
|
121
|
+
}
|
|
122
|
+
export type BlockSlotName<TNode extends BlockNode> = Extract<TNode extends BlockNode ? SlotKeys<TNode["props"]> : never, string>;
|
|
123
|
+
export interface Bounds {
|
|
124
|
+
height: number;
|
|
125
|
+
width: number;
|
|
126
|
+
x: number;
|
|
127
|
+
y: number;
|
|
128
|
+
}
|
|
129
|
+
export interface BoxElement {
|
|
130
|
+
height: number;
|
|
131
|
+
id: string;
|
|
132
|
+
width: number;
|
|
133
|
+
x: number;
|
|
134
|
+
y: number;
|
|
135
|
+
}
|
|
136
|
+
export declare const boxElementSchema: z.ZodObject<{
|
|
137
|
+
height: z.ZodNumber;
|
|
138
|
+
id: z.ZodUUID;
|
|
139
|
+
width: z.ZodNumber;
|
|
140
|
+
x: z.ZodNumber;
|
|
141
|
+
y: z.ZodNumber;
|
|
142
|
+
}>;
|
|
143
|
+
export declare enum TextAnchor {
|
|
144
|
+
Middle = "middle",
|
|
145
|
+
Start = "start"
|
|
146
|
+
}
|
|
147
|
+
export interface TextLayout {
|
|
148
|
+
baselineY: number;
|
|
149
|
+
lines: {
|
|
150
|
+
dy: number;
|
|
151
|
+
text: string;
|
|
152
|
+
}[];
|
|
153
|
+
}
|
|
154
|
+
export interface TextPlacement {
|
|
155
|
+
point: Point;
|
|
156
|
+
textAnchor: TextAnchor;
|
|
157
|
+
width: number;
|
|
158
|
+
}
|
|
159
|
+
export interface ImageElement extends BoxElement, ItemEntityType<PositionedElementType.Image> {
|
|
160
|
+
fileId: string;
|
|
161
|
+
}
|
|
162
|
+
export declare const imageElementSchema: z.ZodObject<typeof boxElementSchema.shape & {
|
|
163
|
+
fileId: z.ZodCustomStringFormat<"sha256_hex">;
|
|
164
|
+
type: z.ZodLiteral<PositionedElementType.Image>;
|
|
165
|
+
}>;
|
|
166
|
+
export declare enum ShapeKind {
|
|
167
|
+
Annotation = "annotation",
|
|
168
|
+
Decision = "decision",
|
|
169
|
+
Diamond = "diamond",
|
|
170
|
+
Ellipse = "ellipse",
|
|
171
|
+
InputOutput = "inputOutput",
|
|
172
|
+
PredefinedProcess = "predefinedProcess",
|
|
173
|
+
Process = "process",
|
|
174
|
+
Rectangle = "rectangle",
|
|
175
|
+
Terminal = "terminal"
|
|
176
|
+
}
|
|
177
|
+
export declare const shapeKindSchema: z.ZodEnum<typeof ShapeKind>;
|
|
178
|
+
export interface ShapeElement extends BoxElement, ItemEntityType<PositionedElementType.Shape> {
|
|
179
|
+
fill: string;
|
|
180
|
+
kind: ShapeKind;
|
|
181
|
+
text: string;
|
|
182
|
+
}
|
|
183
|
+
export declare const shapeElementSchema: z.ZodObject<typeof boxElementSchema.shape & {
|
|
184
|
+
fill: z.ZodString;
|
|
185
|
+
kind: typeof shapeKindSchema;
|
|
186
|
+
text: z.ZodString;
|
|
187
|
+
type: z.ZodLiteral<PositionedElementType.Shape>;
|
|
188
|
+
}>;
|
|
189
|
+
export interface StickyNoteElement extends BoxElement, ItemEntityType<PositionedElementType.StickyNote> {
|
|
190
|
+
fill: string;
|
|
191
|
+
text: string;
|
|
192
|
+
}
|
|
193
|
+
export declare const stickyNoteElementSchema: z.ZodObject<typeof boxElementSchema.shape & {
|
|
194
|
+
fill: z.ZodString;
|
|
195
|
+
text: z.ZodString;
|
|
196
|
+
type: z.ZodLiteral<PositionedElementType.StickyNote>;
|
|
197
|
+
}>;
|
|
198
|
+
export interface StrokeElement extends ItemEntityType<PositionedElementType.Stroke> {
|
|
199
|
+
id: string;
|
|
200
|
+
points: Point[];
|
|
201
|
+
strokeWidth: number;
|
|
202
|
+
}
|
|
203
|
+
export declare const strokeElementSchema: z.ZodObject<{
|
|
204
|
+
id: z.ZodUUID;
|
|
205
|
+
points: z.ZodArray<typeof pointSchema>;
|
|
206
|
+
strokeWidth: z.ZodNumber;
|
|
207
|
+
type: z.ZodLiteral<PositionedElementType.Stroke>;
|
|
208
|
+
}>;
|
|
209
|
+
export interface TextElement extends ItemEntityType<PositionedElementType.Text> {
|
|
210
|
+
id: string;
|
|
211
|
+
text: string;
|
|
212
|
+
width: number;
|
|
213
|
+
x: number;
|
|
214
|
+
y: number;
|
|
215
|
+
}
|
|
216
|
+
export declare const textElementSchema: z.ZodObject<{
|
|
217
|
+
id: z.ZodUUID;
|
|
218
|
+
text: z.ZodString;
|
|
219
|
+
type: z.ZodLiteral<PositionedElementType.Text>;
|
|
220
|
+
width: z.ZodNumber;
|
|
221
|
+
x: z.ZodNumber;
|
|
222
|
+
y: z.ZodNumber;
|
|
223
|
+
}>;
|
|
224
|
+
export type PositionedElement = ArrowElement | ImageElement | ShapeElement | StickyNoteElement | StrokeElement | TextElement;
|
|
225
|
+
export declare const positionedElementSchema: z.ZodDiscriminatedUnion<[typeof arrowElementSchema, typeof imageElementSchema, typeof shapeElementSchema, typeof stickyNoteElementSchema, typeof strokeElementSchema, typeof textElementSchema]>;
|
|
226
|
+
export interface PositionedDocument {
|
|
227
|
+
elements: PositionedElement[];
|
|
228
|
+
}
|
|
229
|
+
export declare const positionedDocumentSchema: z.ZodType<PositionedDocument>;
|
|
230
|
+
export type PositionedElementProperty = {
|
|
231
|
+
end: ArrowEndKey;
|
|
232
|
+
property: "hasArrowhead";
|
|
233
|
+
value: boolean;
|
|
234
|
+
} | {
|
|
235
|
+
property: "fill";
|
|
236
|
+
value: string;
|
|
237
|
+
} | {
|
|
238
|
+
property: "pathKind";
|
|
239
|
+
value: ArrowPathKind;
|
|
240
|
+
};
|
|
241
|
+
export interface Size {
|
|
242
|
+
height: number;
|
|
243
|
+
width: number;
|
|
244
|
+
}
|
|
245
|
+
export declare const applyBlockEdit: <TDocument>(schema: z.ZodType<TDocument>, document: TDocument, operations: JsonPatchOperation[]) => Result<ApplyPatchesResult<TDocument>, Error>;
|
|
246
|
+
export declare const bindPositionedArrowEnd: (document: PositionedDocument, index: number, arrowEndKey: ArrowEndKey, binding: ArrowBinding) => JsonPatchOperation[];
|
|
247
|
+
export declare const changePositionedElementZOrder: (document: PositionedDocument, fromIndex: number, toIndex: number) => JsonPatchOperation[];
|
|
248
|
+
export declare const checkAcceptedType: (context: z.RefinementCtx, type: string, acceptedTypes: readonly string[], path: PropertyKey[]) => void;
|
|
249
|
+
export declare const checkBlockNodeIds: <TNode extends BlockNode>(context: z.RefinementCtx, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, nodes: readonly TNode[], segments: PropertyKey[], collection: BlockCollection) => void;
|
|
250
|
+
export declare const checkIsBoundOnlyTo: (arrow: ArrowElement, elementId: string) => boolean;
|
|
251
|
+
export declare const checkIsPointInBounds: (bounds: Bounds, point: Point, tolerance: number) => boolean;
|
|
252
|
+
export declare const checkIsPointInPolygon: (polygon: Point[], point: Point) => boolean;
|
|
253
|
+
export declare const checkIsPointInShape: (shape: ShapeElement, point: Point, tolerance: number) => boolean;
|
|
254
|
+
export declare const checkIsPointOnElement: (element: PositionedElement, point: Point, tolerance: number) => boolean;
|
|
255
|
+
export declare const checkIsResizablePositionedElement: (element: PositionedElement) => boolean;
|
|
256
|
+
export declare const checkIsSamePoint: (point: Point, otherPoint: Point) => boolean;
|
|
257
|
+
export declare const checkIsVertical: (direction: Point | undefined) => boolean;
|
|
258
|
+
export declare const checkPositionedBindings: (context: z.RefinementCtx, elements: PositionedElement[]) => void;
|
|
259
|
+
export declare const checkPositionedDocument: (document: PositionedDocument, context: z.RefinementCtx) => void;
|
|
260
|
+
export declare const checkPositionedElementIds: (context: z.RefinementCtx, elements: PositionedElement[]) => void;
|
|
261
|
+
export declare const CONNECTION_POINT_COUNT = 4;
|
|
262
|
+
export declare const ARROW_STUB_LENGTH = 16;
|
|
263
|
+
export declare const GRID_SIZE = 20;
|
|
264
|
+
export declare const ARROW_LABEL_WIDTH = 120;
|
|
265
|
+
export declare const ARROW_CURVE_SEGMENT_COUNT = 16;
|
|
266
|
+
export declare const ELLIPSE_OUTLINE_SEGMENT_COUNT = 32;
|
|
267
|
+
export declare const INPUT_OUTPUT_SLANT_RATIO = .2;
|
|
268
|
+
export declare const HEX_COLOR_REGEX: RegExp;
|
|
269
|
+
export declare const NO_BLOCK_SLOTS: Readonly<Record<string, readonly never[]>>;
|
|
270
|
+
export declare const createAcceptedTypesError: (acceptedTypes: readonly string[]) => {
|
|
271
|
+
error: (issue: z.core.$ZodRawIssue) => string | undefined;
|
|
272
|
+
};
|
|
273
|
+
export declare const createBlockDocumentSchema: <TNode extends BlockNode, TRootProps extends BlockRootProps, TRootNode extends TNode = TNode>(contentSchema: z.ZodType<TRootNode>, registry: BlockRegistry<TNode, TRootProps>, children: BlockChildren<TNode>, maxNodes: number) => z.ZodType<BlockDocument<TNode, TRootProps, TRootNode>, BlockDocumentInput>;
|
|
274
|
+
export declare const createBlockNodesSchema: <TNode extends BlockNode>(nodeSchema: z.ZodType<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, acceptedTypes: readonly string[]) => z.ZodType<TNode[]>;
|
|
275
|
+
export declare const deletePositionedElement: (document: PositionedDocument, index: number) => JsonPatchOperation[];
|
|
276
|
+
export declare const duplicateBlockNode: <TNode extends BlockNode>(document: BlockDocument<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, nodeSchema: z.ZodType<TNode>, nodePointer: string) => JsonPatchOperation[];
|
|
277
|
+
export declare const EXPORT_PADDING = 16;
|
|
278
|
+
export declare const EXPORT_BACKGROUND_COLOR = "#ffffff";
|
|
279
|
+
export declare const EXPORT_LINE_COLOR = "#1e1e1e";
|
|
280
|
+
export declare const EXPORT_LINE_WIDTH = 2;
|
|
281
|
+
export declare const EXPORT_LINE_ATTRIBUTES: string;
|
|
282
|
+
export declare const SKETCH_OFFSET_LIMIT = 1.5;
|
|
283
|
+
export declare const SKETCH_HASH_MODULUS = 2147483647;
|
|
284
|
+
export declare const TEXT_FONT_FAMILY = "sans-serif";
|
|
285
|
+
export declare const TEXT_FONT_SIZE = 16;
|
|
286
|
+
export declare const TEXT_LINE_HEIGHT = 20;
|
|
287
|
+
export declare const TEXT_CHARACTER_WIDTH: number;
|
|
288
|
+
export declare const TEXT_WIDE_CHARACTER_WIDTH: number;
|
|
289
|
+
export declare const TEXT_WIDE_CHARACTER_REGEX: RegExp;
|
|
290
|
+
export declare const ARROWHEAD_LENGTH = 12;
|
|
291
|
+
export declare const ARROWHEAD_HALF_WIDTH = 5;
|
|
292
|
+
export declare const escapeSvgValue: (value: string) => string;
|
|
293
|
+
export declare const getArrowheadPoints: (tip: Point, previous: Point) => Point[];
|
|
294
|
+
export declare const getArrowheads: (arrow: ArrowElement, route: Point[]) => Point[][];
|
|
295
|
+
export declare const getExportBounds: (positionedDocument: PositionedDocument) => Bounds;
|
|
296
|
+
export declare const getRouteMidpoint: (route: Point[]) => Point;
|
|
297
|
+
export declare const getSketchedPoints: (points: Point[], elementId: string) => Point[];
|
|
298
|
+
export declare const getSketchOffset: (key: string) => number;
|
|
299
|
+
export declare const getTextLayout: (text: string, { point, textAnchor, width }: TextPlacement) => TextLayout;
|
|
300
|
+
export declare const getTextPlacement: (element: PositionedElement) => TextPlacement | undefined;
|
|
301
|
+
export declare const getTextWidth: (text: string) => number;
|
|
302
|
+
export declare const getWrappedLines: (text: string, width: number) => string[];
|
|
303
|
+
export declare const toArrowSvg: (arrow: ArrowElement) => string;
|
|
304
|
+
export declare const toClosedSketchedPathData: (points: Point[], elementId: string) => string;
|
|
305
|
+
export declare const toElementTextSvg: (element: PositionedElement) => string;
|
|
306
|
+
export declare const toImageSvg: ({ fileId, height, width, x, y }: ImageElement, getAssetUrl: (fileId: string) => string) => string;
|
|
307
|
+
export declare const toPathData: (points: Point[]) => string;
|
|
308
|
+
export declare const toPolygonPoints: (points: Point[]) => string;
|
|
309
|
+
export declare const toPositionedElementSvg: (element: PositionedElement, getAssetUrl: (fileId: string) => string) => string;
|
|
310
|
+
export declare const toPositionedSvg: (positionedDocument: PositionedDocument, getAssetUrl: (fileId: string) => string) => string;
|
|
311
|
+
export declare const toShapeSvg: (shape: ShapeElement) => string;
|
|
312
|
+
export declare const toSketchedPathData: (points: Point[], elementId: string) => string;
|
|
313
|
+
export declare const toStickyNoteSvg: (stickyNote: StickyNoteElement) => string;
|
|
314
|
+
export declare const toStrokeSvg: ({ points, strokeWidth }: StrokeElement) => string;
|
|
315
|
+
export declare const toTextSvg: (text: string, placement: TextPlacement) => string;
|
|
316
|
+
export declare const wrapParagraph: (paragraph: string, width: number) => string[];
|
|
317
|
+
export declare const getAcceptedTypes: <TNode extends BlockNode>(document: BlockDocument<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, slotPointer: string) => readonly string[];
|
|
318
|
+
export declare const getAcceptedTypesMessage: (acceptedTypes: readonly string[]) => string;
|
|
319
|
+
export declare const getAcceptingSlotPointers: <TNode extends BlockNode>(document: BlockDocument<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, nodePointer: string) => string[];
|
|
320
|
+
export declare const getAdjacentBlockNodePointer: <TNode extends BlockNode>(document: BlockDocument<TNode>, children: BlockChildren<TNode>, nodePointer: string, offset: number) => string | undefined;
|
|
321
|
+
export declare const getArrowEndDirection: (arrowEnd: ArrowEnd) => Point | undefined;
|
|
322
|
+
export declare const getArrowRoute: (arrow: ArrowElement) => Point[];
|
|
323
|
+
export declare const getBezierPoint: (controlPoints: Point[], progress: number) => Point;
|
|
324
|
+
export declare const getBindableShape: (elements: PositionedElement[], binding: ArrowBinding) => ShapeElement | undefined;
|
|
325
|
+
export declare const getBlockLayerRows: <TNode extends BlockNode>(document: BlockDocument<TNode>, children: BlockChildren<TNode>) => BlockLayerRow[];
|
|
326
|
+
export declare const getBlockNode: <TNode extends BlockNode>(document: BlockDocument<TNode>, nodePointer: string, children: BlockChildren<TNode>) => TNode | undefined;
|
|
327
|
+
export declare const getBlockNodeAt: <TNode extends BlockNode>(nodes: readonly TNode[], segments: string[], children: BlockChildren<TNode>) => TNode | undefined;
|
|
328
|
+
export declare const getBlockPropPointer: (nodePointer: string, key: string) => string;
|
|
329
|
+
export declare const getBlockPropValue: (props: BlockNodeProps, key: string) => unknown;
|
|
330
|
+
export declare const getBlockSlots: <TNode extends BlockNode>(children: BlockChildren<TNode>, node: TNode) => Readonly<Record<string, readonly TNode[]>>;
|
|
331
|
+
export declare const getBlockTypeDefinition: <TDefinition extends {
|
|
332
|
+
type: string;
|
|
333
|
+
}>(registry: {
|
|
334
|
+
types: TDefinition[];
|
|
335
|
+
}, type: string) => TDefinition | undefined;
|
|
336
|
+
export declare const getBoundsCorners: ({ height, width, x, y }: Bounds) => Point[];
|
|
337
|
+
export declare const getChildRows: <TNode extends BlockNode>(children: BlockChildren<TNode>, nodes: readonly TNode[], listPointer: string, depth: number) => BlockLayerRow[];
|
|
338
|
+
export declare const getConnectionPoint: (bounds: Bounds, connectionPointIndex: number) => Point;
|
|
339
|
+
export declare const getConnectionPointDirection: (connectionPointIndex: number) => Point | undefined;
|
|
340
|
+
export declare const getCurveControl: (point: Point, direction: Point | undefined, span: Point) => Point;
|
|
341
|
+
export declare const getCurvedRoute: (start: ArrowEnd, end: ArrowEnd) => Point[];
|
|
342
|
+
export declare const getDistanceToPolyline: (points: Point[], point: Point) => number;
|
|
343
|
+
export declare const getDistanceToSegment: (start: Point, end: Point, point: Point) => number;
|
|
344
|
+
export declare const getEdgeMidpoints: (bounds: Bounds) => Point[];
|
|
345
|
+
export declare const getElementBounds: (element: PositionedElement) => Bounds;
|
|
346
|
+
export declare const getElementPointer: (index: number) => string;
|
|
347
|
+
export declare const getEllipseOutline: (bounds: Bounds) => Point[];
|
|
348
|
+
export declare const getFocusAfterRemoval: <TNode extends BlockNode>(document: BlockDocument<TNode>, children: BlockChildren<TNode>, nodePointer: string) => string;
|
|
349
|
+
export declare const getHitElementIndex: (document: PositionedDocument, point: Point, tolerance: number) => number | undefined;
|
|
350
|
+
export declare const getPointsBounds: (points: Point[]) => Bounds;
|
|
351
|
+
export declare const getPositionedElement: (document: PositionedDocument, index: number) => PositionedElement | undefined;
|
|
352
|
+
export declare const getPositionedElementText: (element: PositionedElement) => string | undefined;
|
|
353
|
+
export declare const getPositionOperations: (pointer: string, point: Point) => JsonPatchOperation[];
|
|
354
|
+
export declare const getRerouteOperations: (elements: PositionedElement[], shape: ShapeElement) => JsonPatchOperation[];
|
|
355
|
+
export declare const getRightAngledMiddlePoints: (startStub: Point, endStub: Point, isStartVertical: boolean, isEndVertical: boolean) => Point[];
|
|
356
|
+
export declare const getRightAngledRoute: (start: ArrowEnd, end: ArrowEnd) => Point[];
|
|
357
|
+
export declare const getRootAcceptedTypes: <TNode extends BlockNode>(registry: BlockRegistry<TNode>) => TNode["type"][];
|
|
358
|
+
export declare const getShapeOutline: (shape: ShapeElement) => Point[];
|
|
359
|
+
export declare const getSiblingMoveOperations: <TNode extends BlockNode>(document: BlockDocument<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, nodePointer: string, offset: number) => JsonPatchOperation[];
|
|
360
|
+
export declare const getSlotItems: <TItem>(slots: Readonly<Record<string, readonly TItem[]>>, slot: string) => readonly TItem[];
|
|
361
|
+
export declare const getSlotPointer: <TNode extends BlockNode>(nodePointer: string, slot: BlockSlotName<TNode>) => string;
|
|
362
|
+
export declare const getSlotPointerAfterRemoval: (nodePointer: string, slotPointer: string) => string;
|
|
363
|
+
export declare const getStubPoint: (point: Point, direction: Point | undefined) => Point;
|
|
364
|
+
export declare const insertBlockNode: <TNode extends BlockNode>(document: BlockDocument<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, slotPointer: string, index: number, node: TNode) => JsonPatchOperation[];
|
|
365
|
+
export declare const insertPositionedElement: (document: PositionedDocument, index: number, element: PositionedElement) => JsonPatchOperation[];
|
|
366
|
+
export declare const moveBlockNode: <TNode extends BlockNode>(document: BlockDocument<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, nodePointer: string, slotPointer: string, index: number) => JsonPatchOperation[];
|
|
367
|
+
export declare const moveIntoPreviousSibling: <TNode extends BlockNode>(document: BlockDocument<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, nodePointer: string) => JsonPatchOperation[];
|
|
368
|
+
export declare const moveOutAfterParent: <TNode extends BlockNode>(document: BlockDocument<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, nodePointer: string) => JsonPatchOperation[];
|
|
369
|
+
export declare const movePositionedElement: (document: PositionedDocument, index: number, point: Point) => JsonPatchOperation[];
|
|
370
|
+
export declare const pasteBlockNodes: <TNode extends BlockNode>(document: BlockDocument<TNode>, registry: BlockRegistry<TNode>, children: BlockChildren<TNode>, nodeSchema: z.ZodType<TNode>, nodes: TNode[], slotPointer: string, index: number) => JsonPatchOperation[];
|
|
371
|
+
export declare const remintBlockNode: <TNode extends BlockNode>(children: BlockChildren<TNode>, node: TNode) => BlockNode;
|
|
372
|
+
export declare const removeBlockNode: (nodePointer: string) => JsonPatchOperation[];
|
|
373
|
+
export declare const removeRepeatedPoints: (points: Point[]) => Point[];
|
|
374
|
+
export declare const renderBlockNodes: <TNode extends BlockNode, TDefinition extends BlockTypeDefinition, TOutput>(nodes: readonly TNode[], registry: {
|
|
375
|
+
types: TDefinition[];
|
|
376
|
+
}, children: BlockChildren<TNode>, render: (node: TNode, definition: TDefinition, slots: Record<string, TOutput[]>) => TOutput) => TOutput[];
|
|
377
|
+
export declare const resizePositionedElement: (document: PositionedDocument, index: number, size: Size, position?: Point) => JsonPatchOperation[];
|
|
378
|
+
export declare const resizePositionedElementBounds: (document: PositionedDocument, index: number, bounds: Bounds) => JsonPatchOperation[];
|
|
379
|
+
export declare const snapToGrid: (value: number, gridSize: number) => number;
|
|
380
|
+
export declare const unbindPositionedArrowEnd: (document: PositionedDocument, index: number, arrowEndKey: ArrowEndKey) => JsonPatchOperation[];
|
|
381
|
+
export declare const updateBlockNodeProps: <TProps extends BlockNodeProps>(nodePointer: string, props: Partial<TProps>) => JsonPatchOperation[];
|
|
382
|
+
export declare const updatePositionedElementProperty: (document: PositionedDocument, index: number, change: PositionedElementProperty) => JsonPatchOperation[];
|
|
383
|
+
export declare const updatePositionedElementText: (document: PositionedDocument, index: number, text: string) => JsonPatchOperation[];
|