@zuilib/text-editor 0.1.0 → 0.2.1

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/dist/index.d.ts CHANGED
@@ -13,8 +13,12 @@ type Props = Readonly<{
13
13
  autoFocus?: boolean;
14
14
  /** Show the formatting/insert toolbar in edit-md mode (default true) */
15
15
  toolbar?: boolean;
16
+ /** Show a table-of-contents sidebar listing the document's headings */
17
+ outline?: boolean;
18
+ /** Allow collapsing sections under their headings (default true) */
19
+ foldable?: boolean;
16
20
  }>;
17
- declare function MarkdownEditor({ value, onChange, placeholder, readOnly, className, mode, autoFocus, toolbar, }: Props): react_jsx_runtime.JSX.Element;
21
+ declare function MarkdownEditor({ value, onChange, placeholder, readOnly, className, mode, autoFocus, toolbar, outline, foldable, }: Props): react_jsx_runtime.JSX.Element;
18
22
 
19
23
  type SerializedFrontmatterNode = SerializedElementNode;
20
24
  /**
@@ -100,6 +104,8 @@ type DrawingData = Readonly<{
100
104
  height: number;
101
105
  shapes: readonly DrawingShape[];
102
106
  }>;
107
+ declare function serializeDrawingData(data: DrawingData): string;
108
+ declare function parseDrawingData(json: string): DrawingData;
103
109
 
104
110
  type SerializedDrawingNode = Spread<{
105
111
  data: string;
@@ -143,4 +149,136 @@ declare const DRAWING: MultilineElementTransformer;
143
149
  */
144
150
  declare const TABLE: ElementTransformer;
145
151
 
146
- export { $createDrawingNode, $createFrontmatterNode, $isDrawingNode, $isFrontmatterNode, DRAWING, type DrawingData, DrawingNode, type DrawingShape, type DrawingShapeType, FRONTMATTER, FrontmatterNode, MarkdownEditor, type Props as MarkdownEditorProps, type SerializedDrawingNode, type SerializedFrontmatterNode, TABLE };
152
+ /**
153
+ * JSON Schema (draft-07) for the payload of a ```drawing fenced block.
154
+ *
155
+ * Use it to validate LLM- or tool-generated drawings before embedding them,
156
+ * or pass it as a structured-output / tool schema so a model is forced to
157
+ * emit valid payloads. Kept in sync with `parseDrawingData` / `isValidShape`
158
+ * in drawingTypes.ts — update both together.
159
+ */
160
+ declare const DRAWING_DATA_JSON_SCHEMA: {
161
+ readonly $schema: "http://json-schema.org/draft-07/schema#";
162
+ readonly title: "DrawingData";
163
+ readonly description: "Vector drawing embedded in markdown as a ```drawing fenced code block";
164
+ readonly type: "object";
165
+ readonly required: readonly ["version", "height", "shapes"];
166
+ readonly additionalProperties: false;
167
+ readonly properties: {
168
+ readonly version: {
169
+ readonly const: 1;
170
+ };
171
+ readonly height: {
172
+ readonly type: "number";
173
+ readonly minimum: 80;
174
+ readonly description: "Canvas height in pixels (width is fluid)";
175
+ };
176
+ readonly shapes: {
177
+ readonly type: "array";
178
+ readonly items: {
179
+ readonly $ref: "#/definitions/shape";
180
+ };
181
+ readonly description: "Render order: later shapes draw on top";
182
+ };
183
+ };
184
+ readonly definitions: {
185
+ readonly point: {
186
+ readonly type: "object";
187
+ readonly required: readonly ["x", "y"];
188
+ readonly additionalProperties: false;
189
+ readonly properties: {
190
+ readonly x: {
191
+ readonly type: "number";
192
+ };
193
+ readonly y: {
194
+ readonly type: "number";
195
+ };
196
+ };
197
+ };
198
+ readonly shape: {
199
+ readonly type: "object";
200
+ readonly required: readonly ["id", "type", "x", "y", "w", "h", "stroke", "fill", "strokeWidth"];
201
+ readonly additionalProperties: false;
202
+ readonly properties: {
203
+ readonly id: {
204
+ readonly type: "string";
205
+ readonly description: "Unique within the drawing; connector bindings reference it";
206
+ };
207
+ readonly type: {
208
+ readonly enum: readonly ["rect", "ellipse", "triangle", "pentagon", "arrow", "line", "text"];
209
+ };
210
+ readonly x: {
211
+ readonly type: "number";
212
+ readonly description: "Boxes/text: left edge of the bounding box. Connectors: start point x.";
213
+ };
214
+ readonly y: {
215
+ readonly type: "number";
216
+ readonly description: "Boxes/text: top edge of the bounding box. Connectors: start point y.";
217
+ };
218
+ readonly w: {
219
+ readonly type: "number";
220
+ readonly description: "Boxes/text: width (non-negative). Connectors: delta x to the end point (may be negative).";
221
+ };
222
+ readonly h: {
223
+ readonly type: "number";
224
+ readonly description: "Boxes/text: height (non-negative). Connectors: delta y to the end point (may be negative).";
225
+ };
226
+ readonly stroke: {
227
+ readonly type: "string";
228
+ readonly description: "CSS color of the outline (and of any text)";
229
+ };
230
+ readonly fill: {
231
+ readonly type: "string";
232
+ readonly description: "CSS color of the interior; \"transparent\" for none";
233
+ };
234
+ readonly strokeWidth: {
235
+ readonly type: "number";
236
+ readonly description: "Outline width; use 2";
237
+ };
238
+ readonly text: {
239
+ readonly type: "string";
240
+ readonly description: "Standalone text content; center content of a box; midpoint label of a connector";
241
+ };
242
+ readonly label: {
243
+ readonly type: "string";
244
+ readonly description: "Boxes only: small bold heading at the top";
245
+ };
246
+ readonly footer: {
247
+ readonly type: "string";
248
+ readonly description: "Boxes only: small dim line at the bottom";
249
+ };
250
+ readonly startBinding: {
251
+ readonly type: "string";
252
+ readonly description: "Connectors only: id of the box the start attaches to. The editor re-anchors the endpoint onto that box’s border.";
253
+ };
254
+ readonly endBinding: {
255
+ readonly type: "string";
256
+ readonly description: "Connectors only: id of the box the end attaches to";
257
+ };
258
+ readonly bidirectional: {
259
+ readonly type: "boolean";
260
+ readonly description: "Arrows only: arrowheads on both ends";
261
+ };
262
+ readonly routing: {
263
+ readonly const: "elbow";
264
+ readonly description: "Connectors only: orthogonal (right-angled) auto-routing. Ignored when waypoints are present.";
265
+ };
266
+ readonly elbow: {
267
+ readonly type: "number";
268
+ readonly minimum: 0;
269
+ readonly maximum: 1;
270
+ readonly description: "Elbow middle-segment position as a fraction of the span (default 0.5)";
271
+ };
272
+ readonly waypoints: {
273
+ readonly type: "array";
274
+ readonly items: {
275
+ readonly $ref: "#/definitions/point";
276
+ };
277
+ readonly description: "Connectors only: intermediate path points in canvas coordinates, ordered start→end. Takes precedence over routing.";
278
+ };
279
+ };
280
+ };
281
+ };
282
+ };
283
+
284
+ export { $createDrawingNode, $createFrontmatterNode, $isDrawingNode, $isFrontmatterNode, DRAWING, DRAWING_DATA_JSON_SCHEMA, type DrawingData, DrawingNode, type DrawingShape, type DrawingShapeType, FRONTMATTER, FrontmatterNode, MarkdownEditor, type Props as MarkdownEditorProps, type SerializedDrawingNode, type SerializedFrontmatterNode, TABLE, parseDrawingData, serializeDrawingData };