@glyphlab/diagram-core 0.1.0 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glyphlab/diagram-core",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "The diagram model and the one interface to change it: the file format, the operations, the planner with exact undo, and the controller. No UI.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,15 +9,15 @@
9
9
  "exports": {
10
10
  ".": {
11
11
  "types": "./index.d.ts",
12
- "import": "./index.js"
12
+ "default": "./index.js"
13
13
  },
14
14
  "./versioning": {
15
15
  "types": "./versioning.d.ts",
16
- "import": "./versioning.js"
16
+ "default": "./versioning.js"
17
17
  },
18
18
  "./testing": {
19
19
  "types": "./testing.d.ts",
20
- "import": "./testing.js"
20
+ "default": "./testing.js"
21
21
  }
22
22
  },
23
23
  "files": [
@@ -51,6 +51,6 @@
51
51
  "diagram",
52
52
  "react",
53
53
  "system-design",
54
- "glyph"
54
+ "cakeslice"
55
55
  ]
56
56
  }
@@ -22,7 +22,7 @@ declare const colorKey: (color: string) => string;
22
22
  declare const arrowId: (base: string, color: string | undefined) => string;
23
23
  declare const colorLabel: (color: string) => string;
24
24
 
25
- declare const DIAGRAM_SCHEMA_VERSION = 5;
25
+ declare const DIAGRAM_SCHEMA_VERSION = 6;
26
26
  declare const LAYERS: readonly ["ui", "runtime", "tools", "domain"];
27
27
  declare const layerSchema: z.ZodEnum<{
28
28
  ui: "ui";
@@ -399,6 +399,45 @@ declare const nodeV5Schema: z.ZodObject<{
399
399
  repo: z.ZodOptional<z.ZodString>;
400
400
  }, z.core.$strict>>>;
401
401
  }, z.core.$strict>;
402
+ declare const edgeWidthSchema: z.ZodEnum<{
403
+ thin: "thin";
404
+ thick: "thick";
405
+ }>;
406
+ declare const edgeArrowSchema: z.ZodEnum<{
407
+ end: "end";
408
+ start: "start";
409
+ both: "both";
410
+ none: "none";
411
+ }>;
412
+ declare const edgeV6Schema: z.ZodObject<{
413
+ id: z.ZodString;
414
+ from: z.ZodString;
415
+ to: z.ZodString;
416
+ label: z.ZodString;
417
+ dashed: z.ZodOptional<z.ZodBoolean>;
418
+ optional: z.ZodOptional<z.ZodBoolean>;
419
+ color: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
420
+ red: "red";
421
+ orange: "orange";
422
+ yellow: "yellow";
423
+ green: "green";
424
+ teal: "teal";
425
+ blue: "blue";
426
+ purple: "purple";
427
+ pink: "pink";
428
+ gray: "gray";
429
+ }>, z.ZodString]>>;
430
+ width: z.ZodOptional<z.ZodEnum<{
431
+ thin: "thin";
432
+ thick: "thick";
433
+ }>>;
434
+ arrow: z.ZodOptional<z.ZodEnum<{
435
+ end: "end";
436
+ start: "start";
437
+ both: "both";
438
+ none: "none";
439
+ }>>;
440
+ }, z.core.$strict>;
402
441
  declare const orientationSchema: z.ZodEnum<{
403
442
  horizontal: "horizontal";
404
443
  vertical: "vertical";
@@ -717,6 +756,116 @@ declare const diagramV5Schema: z.ZodObject<{
717
756
  }>, z.ZodString]>>;
718
757
  }, z.core.$strict>>;
719
758
  }, z.core.$strict>;
759
+ declare const diagramV6Schema: z.ZodObject<{
760
+ schemaVersion: z.ZodLiteral<6>;
761
+ name: z.ZodString;
762
+ description: z.ZodOptional<z.ZodString>;
763
+ type: z.ZodOptional<z.ZodEnum<{
764
+ system: "system";
765
+ swimlane: "swimlane";
766
+ }>>;
767
+ repos: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
768
+ remote: z.ZodOptional<z.ZodString>;
769
+ branch: z.ZodOptional<z.ZodString>;
770
+ sha: z.ZodOptional<z.ZodString>;
771
+ }, z.core.$strict>>>;
772
+ groups: z.ZodArray<z.ZodObject<{
773
+ id: z.ZodString;
774
+ title: z.ZodString;
775
+ x: z.ZodNumber;
776
+ y: z.ZodNumber;
777
+ w: z.ZodNumber;
778
+ h: z.ZodNumber;
779
+ layer: z.ZodOptional<z.ZodEnum<{
780
+ ui: "ui";
781
+ runtime: "runtime";
782
+ tools: "tools";
783
+ domain: "domain";
784
+ }>>;
785
+ color: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
786
+ red: "red";
787
+ orange: "orange";
788
+ yellow: "yellow";
789
+ green: "green";
790
+ teal: "teal";
791
+ blue: "blue";
792
+ purple: "purple";
793
+ pink: "pink";
794
+ gray: "gray";
795
+ }>, z.ZodString]>>;
796
+ lane: z.ZodOptional<z.ZodObject<{
797
+ body: z.ZodString;
798
+ orientation: z.ZodEnum<{
799
+ horizontal: "horizontal";
800
+ vertical: "vertical";
801
+ }>;
802
+ }, z.core.$strip>>;
803
+ }, z.core.$strict>>;
804
+ nodes: z.ZodArray<z.ZodObject<{
805
+ id: z.ZodString;
806
+ title: z.ZodString;
807
+ x: z.ZodNumber;
808
+ y: z.ZodNumber;
809
+ w: z.ZodNumber;
810
+ h: z.ZodNumber;
811
+ body: z.ZodString;
812
+ layer: z.ZodOptional<z.ZodEnum<{
813
+ ui: "ui";
814
+ runtime: "runtime";
815
+ tools: "tools";
816
+ domain: "domain";
817
+ }>>;
818
+ color: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
819
+ red: "red";
820
+ orange: "orange";
821
+ yellow: "yellow";
822
+ green: "green";
823
+ teal: "teal";
824
+ blue: "blue";
825
+ purple: "purple";
826
+ pink: "pink";
827
+ gray: "gray";
828
+ }>, z.ZodString]>>;
829
+ decisions: z.ZodOptional<z.ZodString>;
830
+ systemsDesign: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
831
+ links: z.ZodOptional<z.ZodArray<z.ZodObject<{
832
+ path: z.ZodString;
833
+ symbol: z.ZodOptional<z.ZodString>;
834
+ lines: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>;
835
+ hash: z.ZodOptional<z.ZodString>;
836
+ repo: z.ZodOptional<z.ZodString>;
837
+ }, z.core.$strict>>>;
838
+ }, z.core.$strict>>;
839
+ edges: z.ZodArray<z.ZodObject<{
840
+ id: z.ZodString;
841
+ from: z.ZodString;
842
+ to: z.ZodString;
843
+ label: z.ZodString;
844
+ dashed: z.ZodOptional<z.ZodBoolean>;
845
+ optional: z.ZodOptional<z.ZodBoolean>;
846
+ color: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
847
+ red: "red";
848
+ orange: "orange";
849
+ yellow: "yellow";
850
+ green: "green";
851
+ teal: "teal";
852
+ blue: "blue";
853
+ purple: "purple";
854
+ pink: "pink";
855
+ gray: "gray";
856
+ }>, z.ZodString]>>;
857
+ width: z.ZodOptional<z.ZodEnum<{
858
+ thin: "thin";
859
+ thick: "thick";
860
+ }>>;
861
+ arrow: z.ZodOptional<z.ZodEnum<{
862
+ end: "end";
863
+ start: "start";
864
+ both: "both";
865
+ none: "none";
866
+ }>>;
867
+ }, z.core.$strict>>;
868
+ }, z.core.$strict>;
720
869
  type LaneOrientation = z.infer<typeof orientationSchema>;
721
870
  type DiagramType = 'system' | 'swimlane';
722
871
  type Layer = z.infer<typeof layerSchema>;
@@ -725,11 +874,13 @@ type GroupDef = z.infer<typeof groupSchema>;
725
874
  type LinkDef = z.infer<typeof linkSchema>;
726
875
  type NodeDef = z.infer<typeof nodeV5Schema>;
727
876
  type RepoRef = z.infer<typeof repoRefSchema>;
728
- type EdgeDef = z.infer<typeof edgeSchema>;
877
+ type EdgeDef = z.infer<typeof edgeV6Schema>;
878
+ type EdgeWidth = z.infer<typeof edgeWidthSchema>;
879
+ type EdgeArrow = z.infer<typeof edgeArrowSchema>;
729
880
  type DiagramFile = z.infer<typeof diagramSchema>;
730
881
  type DiagramData = Pick<DiagramFile, 'groups' | 'nodes' | 'edges' | 'type' | 'repos'>;
731
882
  declare const diagramSchema: z.ZodObject<{
732
- schemaVersion: z.ZodLiteral<5>;
883
+ schemaVersion: z.ZodLiteral<6>;
733
884
  name: z.ZodString;
734
885
  description: z.ZodOptional<z.ZodString>;
735
886
  type: z.ZodOptional<z.ZodEnum<{
@@ -826,10 +977,20 @@ declare const diagramSchema: z.ZodObject<{
826
977
  pink: "pink";
827
978
  gray: "gray";
828
979
  }>, z.ZodString]>>;
980
+ width: z.ZodOptional<z.ZodEnum<{
981
+ thin: "thin";
982
+ thick: "thick";
983
+ }>>;
984
+ arrow: z.ZodOptional<z.ZodEnum<{
985
+ end: "end";
986
+ start: "start";
987
+ both: "both";
988
+ none: "none";
989
+ }>>;
829
990
  }, z.core.$strict>>;
830
991
  }, z.core.$strict>;
831
992
  declare const diagramFormat: Format<{
832
- schemaVersion: 5;
993
+ schemaVersion: 6;
833
994
  name: string;
834
995
  groups: {
835
996
  id: string;
@@ -873,6 +1034,8 @@ declare const diagramFormat: Format<{
873
1034
  dashed?: boolean | undefined;
874
1035
  optional?: boolean | undefined;
875
1036
  color?: string | undefined;
1037
+ width?: "thin" | "thick" | undefined;
1038
+ arrow?: "end" | "start" | "both" | "none" | undefined;
876
1039
  }[];
877
1040
  description?: string | undefined;
878
1041
  type?: "system" | "swimlane" | undefined;
@@ -884,7 +1047,7 @@ declare const diagramFormat: Format<{
884
1047
  }>;
885
1048
  declare function parseDiagram(input: unknown): DiagramFile;
886
1049
  declare function readDiagram(input: unknown): ReadResult<{
887
- schemaVersion: 5;
1050
+ schemaVersion: 6;
888
1051
  name: string;
889
1052
  groups: {
890
1053
  id: string;
@@ -928,6 +1091,8 @@ declare function readDiagram(input: unknown): ReadResult<{
928
1091
  dashed?: boolean | undefined;
929
1092
  optional?: boolean | undefined;
930
1093
  color?: string | undefined;
1094
+ width?: "thin" | "thick" | undefined;
1095
+ arrow?: "end" | "start" | "both" | "none" | undefined;
931
1096
  }[];
932
1097
  description?: string | undefined;
933
1098
  type?: "system" | "swimlane" | undefined;
@@ -1082,6 +1247,16 @@ declare const diagramOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1082
1247
  pink: "pink";
1083
1248
  gray: "gray";
1084
1249
  }>, z.ZodString]>>;
1250
+ width: z.ZodOptional<z.ZodEnum<{
1251
+ thin: "thin";
1252
+ thick: "thick";
1253
+ }>>;
1254
+ arrow: z.ZodOptional<z.ZodEnum<{
1255
+ end: "end";
1256
+ start: "start";
1257
+ both: "both";
1258
+ none: "none";
1259
+ }>>;
1085
1260
  }, z.core.$strip>;
1086
1261
  }, z.core.$strip>, z.ZodObject<{
1087
1262
  op: z.ZodLiteral<"updateEdge">;
@@ -1101,6 +1276,16 @@ declare const diagramOpSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1101
1276
  pink: "pink";
1102
1277
  gray: "gray";
1103
1278
  }>, z.ZodString]>>>;
1279
+ width: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1280
+ thin: "thin";
1281
+ thick: "thick";
1282
+ }>>>;
1283
+ arrow: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
1284
+ end: "end";
1285
+ start: "start";
1286
+ both: "both";
1287
+ none: "none";
1288
+ }>>>;
1104
1289
  }, z.core.$strip>;
1105
1290
  }, z.core.$strip>, z.ZodObject<{
1106
1291
  op: z.ZodLiteral<"deleteEdge">;
@@ -1311,7 +1496,10 @@ interface DiagramController {
1311
1496
  schemaVersion?: number;
1312
1497
  }): DiagramFile;
1313
1498
  batch(fn: () => void): void;
1499
+ setReadOnly(message: string | null): void;
1500
+ readonly readOnly: string | null;
1314
1501
  }
1502
+ declare const REMOTE_SOURCE = "remote";
1315
1503
  declare function createDiagramController(initial?: DiagramData & {
1316
1504
  name?: string;
1317
1505
  description?: string;
@@ -1355,5 +1543,5 @@ interface BindOptions {
1355
1543
  }
1356
1544
  declare function bindRepository(controller: DiagramController, repository: DiagramRepository, options: BindOptions): Binding;
1357
1545
 
1358
- export { diagramV4Schema as $, COLOR_PRESETS as C, applyPatch as F, HEX_COLOR as H, arrowId as I, bindRepository as J, colorCss as K, LAYERS as L, MIN_GROUP as M, colorKey as O, colorLabel as Q, colorSchema as T, createDiagramController as U, diagramFormat as V, diagramOpSchema as W, diagramSchema as X, diagramV1Schema as Y, diagramV2Schema as Z, diagramV3Schema as _, diagramV5Schema as a0, diffSnapshots as a1, edgeSchema as a2, edgeV1Schema as a3, findNodeRef as a4, groupSchema as a5, groupV1Schema as a6, groupV2Schema as a7, httpRepository as a8, isEmptyPatch as a9, isPreset as aa, layerSchema as ab, linkSchema as ac, linkV4Schema as ad, memoryRepository as ae, nodeSchema as af, nodeV1Schema as ag, nodeV2Schema as ah, nodeV3Schema as ai, nodeV4Schema as aj, nodeV5Schema as ak, orientationSchema as al, parseDiagram as am, parseDiagramJson as an, planChanges as ao, readDiagram as ap, repoIdSchema as aq, repoRefSchema as ar, serializeDiagram as as, storageRepository as at, DIAGRAM_SCHEMA_VERSION as f, LIMITS as p, MIN_NODE as t, RepositoryConflictError as x };
1359
- export type { ApplyRequest as A, BindOptions as B, DiagramFile as D, EdgeDef as E, GroupDef as G, NodeDef as N, Patch as P, RepoRef as R, SaveMeta as S, ApplyResult as a, Binding as b, ChangeEvent as c, Color as d, ColorPreset as e, DiagramController as g, DiagramData as h, DiagramOp as i, DiagramRepository as j, DiagramSnapshot as k, DiagramStores as l, DiagramType as m, EdgeState as n, GroupState as o, LaneOrientation as q, Layer as r, LinkDef as s, MetaState as u, NodeState as v, PlanResult as w, Snapshot as y, StoredDiagram as z };
1546
+ export { diagramV1Schema as $, COLOR_PRESETS as C, RepositoryConflictError as F, HEX_COLOR as H, applyPatch as K, LAYERS as L, MIN_GROUP as M, arrowId as O, bindRepository as Q, REMOTE_SOURCE as R, colorCss as T, colorKey as U, colorLabel as V, colorSchema as W, createDiagramController as X, diagramFormat as Y, diagramOpSchema as Z, diagramSchema as _, diagramV2Schema as a0, diagramV3Schema as a1, diagramV4Schema as a2, diagramV5Schema as a3, diagramV6Schema as a4, diffSnapshots as a5, edgeArrowSchema as a6, edgeSchema as a7, edgeV1Schema as a8, edgeV6Schema as a9, storageRepository as aA, edgeWidthSchema as aa, findNodeRef as ab, groupSchema as ac, groupV1Schema as ad, groupV2Schema as ae, httpRepository as af, isEmptyPatch as ag, isPreset as ah, layerSchema as ai, linkSchema as aj, linkV4Schema as ak, memoryRepository as al, nodeSchema as am, nodeV1Schema as an, nodeV2Schema as ao, nodeV3Schema as ap, nodeV4Schema as aq, nodeV5Schema as ar, orientationSchema as as, parseDiagram as at, parseDiagramJson as au, planChanges as av, readDiagram as aw, repoIdSchema as ax, repoRefSchema as ay, serializeDiagram as az, DIAGRAM_SCHEMA_VERSION as f, LIMITS as r, MIN_NODE as v };
1547
+ export type { ApplyRequest as A, BindOptions as B, DiagramFile as D, EdgeDef as E, GroupDef as G, Snapshot as I, StoredDiagram as J, NodeDef as N, Patch as P, SaveMeta as S, ApplyResult as a, Binding as b, ChangeEvent as c, Color as d, ColorPreset as e, DiagramController as g, DiagramData as h, DiagramOp as i, DiagramRepository as j, DiagramSnapshot as k, DiagramStores as l, DiagramType as m, EdgeArrow as n, EdgeState as o, EdgeWidth as p, GroupState as q, LaneOrientation as s, Layer as t, LinkDef as u, MetaState as w, NodeState as x, PlanResult as y, RepoRef as z };
package/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DIAGRAM_SCHEMA_VERSION
3
- } from "./chunk-XCRPIPPL.js";
3
+ } from "./chunk-KZD7D662.js";
4
4
  import "./chunk-FFPBFKRE.js";
5
5
 
6
6
  // packages/diagram-core/src/testing/controllerConformance.ts