vyuh_diagram_types 3.5.0 copy "vyuh_diagram_types: ^3.5.0" to clipboard
vyuh_diagram_types: ^3.5.0 copied to clipboard

Immutable document model, shapes, text and geometry for Vyuh Diagram. Pure Dart with no Flutter dependency, so it runs on servers, CLIs and agents.

Vyuh Diagram

vyuh_diagram_types on pub.flutter-io.cn pub points Apache-2.0

vyuh_diagram_types

Immutable document model, shapes, text and geometry for Vyuh Diagram, in pure Dart.

Vyuh Diagram · Docs · Examples · API reference

A diagram is plain data. This package defines that data: documents, shapes, text, connectors, styles and the geometry they sit on. Everything is immutable and has no Flutter dependency, so the same model runs in an app, a server, a command-line tool or an agent.

What is inside #

  • Documents and elements: DiagramDocument holds ShapeElement, TextElement and connector elements, each with an id, frame, z-order, visibility and lock state.
  • Geometry: DiagramPoint, DiagramSize and DiagramRect.
  • Appearance: ShapeStyle, DiagramColor, StrokeStyle and arrowheads.
  • Text: stories made of paragraphs and runs, with alignment and sizing modes.
  • Output contracts: the options and results that the SVG and image exporters share.

Most apps never import this package directly: vyuh_diagram_core and vyuh_diagram_flutter re-export what they need. Depend on it when you only build, inspect or transform documents and do not need a controller.

Install #

dart pub add vyuh_diagram_types

Build a document #

import 'package:vyuh_diagram_types/vyuh_diagram_types.dart';

final document = DiagramDocument(
  id: 'plan',
  revision: 0,
  elements: [
    ShapeElement(
      id: 'start',
      type: Shapes.rectangle,
      frame: const DiagramRect.fromLTWH(0, 0, 160, 80),
    ),
  ],
);

final start = document.elementById('start') as ShapeElement;
print(start.frame); // DiagramRect(0.0, 0.0, 160.0, 80.0)

Documents are values: to change one, use a controller from vyuh_diagram_core, which applies edits as undoable transactions and returns a new document.

Learn more #

Where this fits #

Vyuh Diagram is a diagram editor you embed in your own app. Five packages are open source (Apache-2.0) on pub.flutter-io.cn:

Package What it is
vyuh_diagram_types Immutable document model and geometry.
vyuh_diagram_core Controller, edits and history, in pure Dart.
vyuh_diagram_flutter Flutter canvas, input and rendering.
vyuh_diagram_codec_json Save and load diagrams as JSON.
vyuh_diagram_codec_svg Export diagrams as SVG; import SVG shapes.

Commercial extensions add the editor, shape libraries, automatic layout, rich text, tables, a minimap and more. They come from pub.vyuh.tech; see package access and the full package list.

License #

Apache License, Version 2.0 (text). Third-party materials keep their own licenses; see the notices shipped in this package.

0
likes
160
points
245
downloads

Documentation

Documentation
API reference

Publisher

verified publishervyuh.tech

Weekly Downloads

Immutable document model, shapes, text and geometry for Vyuh Diagram. Pure Dart with no Flutter dependency, so it runs on servers, CLIs and agents.

Homepage

Topics

#diagram #data-model #geometry #flowchart #immutable

License

Apache-2.0 (license)

More

Packages that depend on vyuh_diagram_types