@rokkit/graph 1.8.0 → 1.8.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.
Files changed (119) hide show
  1. package/README.md +59 -0
  2. package/dist/Graph.svelte +108 -134
  3. package/dist/Graph.svelte.d.ts +1 -1
  4. package/dist/GraphLegend.svelte +81 -10
  5. package/dist/GraphLegend.svelte.d.ts +15 -0
  6. package/dist/GraphState.svelte.d.ts +161 -52
  7. package/dist/GraphState.svelte.js +380 -304
  8. package/dist/actions/canvas.d.ts +18 -0
  9. package/dist/actions/canvas.js +59 -0
  10. package/dist/actions/choices.d.ts +12 -0
  11. package/dist/actions/choices.js +23 -0
  12. package/dist/actions/interactions.d.ts +20 -0
  13. package/dist/actions/interactions.js +57 -0
  14. package/dist/actions/listen.d.ts +2 -0
  15. package/dist/actions/listen.js +10 -0
  16. package/dist/canvas/frame.d.ts +41 -0
  17. package/dist/canvas/frame.js +34 -0
  18. package/dist/controls/BundleControl.svelte +11 -10
  19. package/dist/controls/BundleControl.svelte.d.ts +0 -7
  20. package/dist/controls/DensityControl.svelte +17 -9
  21. package/dist/controls/DensityControl.svelte.d.ts +0 -8
  22. package/dist/controls/DepthControl.svelte +11 -4
  23. package/dist/controls/DepthControl.svelte.d.ts +0 -9
  24. package/dist/controls/DrillBar.svelte +63 -0
  25. package/dist/controls/DrillBar.svelte.d.ts +9 -0
  26. package/dist/controls/EdgeStyleControl.svelte +10 -10
  27. package/dist/controls/EdgeStyleControl.svelte.d.ts +0 -6
  28. package/dist/controls/HiddenControl.svelte +27 -0
  29. package/dist/controls/HiddenControl.svelte.d.ts +7 -0
  30. package/dist/controls/MeasureControl.svelte +39 -0
  31. package/dist/controls/MeasureControl.svelte.d.ts +12 -0
  32. package/dist/controls/ToggleControl.svelte +33 -0
  33. package/dist/controls/ToggleControl.svelte.d.ts +13 -0
  34. package/dist/controls/ViolationsControl.svelte +27 -0
  35. package/dist/controls/ViolationsControl.svelte.d.ts +7 -0
  36. package/dist/controls/ZoomControl.svelte +21 -18
  37. package/dist/controls/zoom.d.ts +3 -0
  38. package/dist/controls/zoom.js +6 -0
  39. package/dist/diagrams/ArcDiagram.svelte +116 -0
  40. package/dist/diagrams/ArcDiagram.svelte.d.ts +31 -0
  41. package/dist/diagrams/CallTree.svelte +17 -5
  42. package/dist/diagrams/CallTree.svelte.d.ts +5 -1
  43. package/dist/diagrams/DependencyDiagram.svelte +18 -6
  44. package/dist/diagrams/DependencyDiagram.svelte.d.ts +5 -1
  45. package/dist/diagrams/DependencyMatrix.svelte +11 -32
  46. package/dist/diagrams/ErDiagram.svelte +18 -6
  47. package/dist/diagrams/ErDiagram.svelte.d.ts +5 -1
  48. package/dist/diagrams/LayersDiagram.svelte +124 -0
  49. package/dist/diagrams/LayersDiagram.svelte.d.ts +30 -0
  50. package/dist/diagrams/Neighborhood.svelte +26 -6
  51. package/dist/diagrams/Neighborhood.svelte.d.ts +11 -1
  52. package/dist/diagrams/PolymetricTree.svelte +116 -0
  53. package/dist/diagrams/PolymetricTree.svelte.d.ts +28 -0
  54. package/dist/diagrams/StructureDiagram.svelte +38 -8
  55. package/dist/diagrams/StructureDiagram.svelte.d.ts +9 -1
  56. package/dist/diagrams/Sunburst.svelte +44 -8
  57. package/dist/diagrams/Sunburst.svelte.d.ts +12 -2
  58. package/dist/diagrams/Treemap.svelte +44 -8
  59. package/dist/diagrams/Treemap.svelte.d.ts +12 -2
  60. package/dist/index.d.ts +10 -3
  61. package/dist/index.js +9 -2
  62. package/dist/layout/arcs.d.ts +6 -0
  63. package/dist/layout/arcs.js +141 -0
  64. package/dist/layout/cards.js +9 -2
  65. package/dist/layout/edges.d.ts +13 -1
  66. package/dist/layout/edges.js +26 -2
  67. package/dist/layout/extent.d.ts +17 -0
  68. package/dist/layout/extent.js +27 -0
  69. package/dist/layout/flow.js +3 -1
  70. package/dist/layout/index.d.ts +4 -1
  71. package/dist/layout/index.js +17 -2
  72. package/dist/layout/layers.d.ts +6 -0
  73. package/dist/layout/layers.js +180 -0
  74. package/dist/layout/matrix.d.ts +12 -0
  75. package/dist/layout/matrix.js +20 -0
  76. package/dist/layout/neighborhood.js +16 -7
  77. package/dist/layout/options.d.ts +1 -1
  78. package/dist/layout/options.js +16 -3
  79. package/dist/layout/percentile.d.ts +8 -0
  80. package/dist/layout/percentile.js +13 -0
  81. package/dist/layout/polymetric.d.ts +3 -0
  82. package/dist/layout/polymetric.js +221 -0
  83. package/dist/layout/radial.js +3 -1
  84. package/dist/layout/structure.js +7 -1
  85. package/dist/layout/sunburst.js +11 -4
  86. package/dist/layout/types.d.ts +79 -0
  87. package/dist/layout/world.js +11 -4
  88. package/dist/messages.d.ts +14 -0
  89. package/dist/messages.js +17 -0
  90. package/dist/model/condense.d.ts +8 -0
  91. package/dist/model/condense.js +114 -0
  92. package/dist/model/entities.d.ts +12 -0
  93. package/dist/model/entities.js +12 -0
  94. package/dist/model/normalize.d.ts +2 -6
  95. package/dist/model/normalize.js +64 -2
  96. package/dist/model/relationships.d.ts +30 -0
  97. package/dist/model/relationships.js +51 -0
  98. package/dist/model/share.d.ts +9 -0
  99. package/dist/model/share.js +43 -0
  100. package/dist/model/tree.d.ts +7 -1
  101. package/dist/model/tree.js +11 -4
  102. package/dist/preset.d.ts +18 -0
  103. package/dist/preset.js +34 -3
  104. package/dist/schema/EntitiesView.svelte +8 -6
  105. package/dist/schema/EntityView.svelte +13 -10
  106. package/dist/state/GraphConfig.svelte.d.ts +124 -0
  107. package/dist/state/GraphConfig.svelte.js +253 -0
  108. package/dist/state/GraphDrill.svelte.d.ts +52 -0
  109. package/dist/state/GraphDrill.svelte.js +115 -0
  110. package/dist/state/GraphGroups.svelte.d.ts +35 -0
  111. package/dist/state/GraphGroups.svelte.js +73 -0
  112. package/dist/state/GraphSelection.svelte.d.ts +53 -0
  113. package/dist/state/GraphSelection.svelte.js +94 -0
  114. package/dist/state/intents.d.ts +33 -0
  115. package/dist/state/intents.js +30 -0
  116. package/dist/state/text.d.ts +28 -0
  117. package/dist/state/text.js +56 -0
  118. package/dist/types.d.ts +72 -1
  119. package/package.json +3 -2
package/dist/types.d.ts CHANGED
@@ -12,7 +12,11 @@ export type GraphRow = {
12
12
  * (a view reading a table, a procedure calling a function). Layouts branch on
13
13
  * this rather than on any schema-specific notion.
14
14
  */
15
- export type EdgeKind = 'reference' | 'dependency';
15
+ /**
16
+ * `reference` (a foreign key) and `dependency` come from the data. `containment` is drawn by a
17
+ * tree layout (`polymetric`) between a container and what it holds — the tree's own links.
18
+ */
19
+ export type EdgeKind = 'reference' | 'dependency' | 'containment';
16
20
  export type GraphNode = {
17
21
  /** Stable key. `${group}.${label}` when a group is present, else `label`. */
18
22
  id: string;
@@ -54,8 +58,25 @@ export type GraphNode = {
54
58
  *
55
59
  * Accepts a delimited STRING too (`'dbd/core/lexer/parse'`), since that is how a file path
56
60
  * arrives. See `GraphFields.pathDelimiter`.
61
+ *
62
+ * A host that gives containment as `parent` ids instead (#168) need not convert: a node with
63
+ * no path but a parent chain gets one, as ids (`GraphFields.parent`). The path is still what
64
+ * the model holds — the chain is read once, at normalisation.
57
65
  */
58
66
  path?: string[];
67
+ /**
68
+ * The node ids this node STANDS FOR — a group, typically one strongly-connected component
69
+ * the host condensed (#166). rokkit computes no SCCs: it draws what the host grouped. While
70
+ * the group is collapsed its members are hidden and their edges reroute to it.
71
+ */
72
+ members?: string[];
73
+ /** Whether a group starts collapsed. A node with `members` and no flag is collapsed. */
74
+ collapsed?: boolean;
75
+ /**
76
+ * The layer the HOST assigned (#167) — 0 at the top, foundations at the bottom. rokkit
77
+ * computes no depth; the `layers` layout ranks by this.
78
+ */
79
+ layer?: number;
59
80
  rows: GraphRow[];
60
81
  note?: string;
61
82
  /** Source fields the map did not claim, passed through untouched. */
@@ -107,7 +128,27 @@ export type GraphEdge = {
107
128
  overlay?: boolean;
108
129
  /** A strength this edge carries — co-change count, call frequency. Drives stroke width. */
109
130
  weight?: number;
131
+ /**
132
+ * The cheapest link to cut to break a cycle — the edge with the fewest occurrences (#166).
133
+ * Naming it is the actionable output of a cycles view, so it is styleable on its own
134
+ * (`data-edge-weakest`).
135
+ */
136
+ weakest?: boolean;
137
+ /**
138
+ * Coupling nothing in the code explains — a pair that changes together with no import
139
+ * between them (#169). The host computes it; the graph only styles it (`data-edge-hidden`).
140
+ */
141
+ hidden?: boolean;
142
+ /** How many model edges this one stands for, when it aggregates a collapsed group's edges. */
143
+ count?: number;
144
+ /**
145
+ * How the edge sits against the layering (#167): `down` one layer (conformant), `skip` more
146
+ * than one down (legal, worth seeing), `up` climbing (the violation), `level` within a layer.
147
+ * The host says; when it does not, the `layers` layout derives it from the layers.
148
+ */
149
+ conformance?: Conformance;
110
150
  };
151
+ export type Conformance = 'down' | 'skip' | 'up' | 'level';
111
152
  export type GraphModel = {
112
153
  nodes: GraphNode[];
113
154
  /** Structural edges — the ones layouts, neighbours and relationships see. */
@@ -169,6 +210,19 @@ export type GraphProps = {
169
210
  label?: string;
170
211
  /** Fires on selection AND on clear, where it receives `null`. */
171
212
  onselect?: (id: string | null) => void;
213
+ /**
214
+ * The containment subtree drawn as the whole canvas (`world`, `sunburst`, `structure`).
215
+ * Bindable: drilling moves it. `[]` is the root.
216
+ */
217
+ focusPath?: string[];
218
+ /** The reader drilled into a box — see `GraphStateConfig.ondrill`. */
219
+ ondrill?: (path: string[], node: GraphNode | null) => void | Promise<void>;
220
+ /** The reader drilled out — see `GraphStateConfig.ondrillup`. */
221
+ ondrillup?: (path: string[]) => void | Promise<void>;
222
+ /** The reader expanded a group — see `GraphStateConfig.onexpand`. */
223
+ onexpand?: (id: string, node: GraphNode) => void;
224
+ /** The reader collapsed a group — see `GraphStateConfig.oncollapse`. */
225
+ oncollapse?: (id: string, node: GraphNode) => void;
172
226
  /** Icon class per node kind and row badge, merged over the built-in map. */
173
227
  icons?: Record<string, string>;
174
228
  class?: string;
@@ -225,6 +279,23 @@ export type GraphFields = {
225
279
  relation?: string;
226
280
  /** Path to a truthy flag marking an overlay edge — see `GraphEdge.overlay`. */
227
281
  overlay?: string;
282
+ /** Path to a group's member ids — see `GraphNode.members`. */
283
+ members?: string;
284
+ /** Path to a group's starting state — see `GraphNode.collapsed`. */
285
+ collapsed?: string;
286
+ /** Path to a truthy flag marking the weakest edge of a cycle — see `GraphEdge.weakest`. */
287
+ weakest?: string;
288
+ /** Path to a truthy flag marking hidden coupling — see `GraphEdge.hidden`. */
289
+ hidden?: string;
290
+ /** Path to a node's host-assigned layer — see `GraphNode.layer`. */
291
+ layer?: string;
292
+ /**
293
+ * Path to a node's PARENT id — containment as a parent chain rather than a `path` (#168).
294
+ * Used only for a node with no `path`; it becomes one, as ids.
295
+ */
296
+ parent?: string;
297
+ /** Path to an edge's conformance to the layering — see `GraphEdge.conformance`. */
298
+ conformance?: string;
228
299
  /** Path to an edge's strength — see `GraphEdge.weight`. */
229
300
  edgeWeight?: string;
230
301
  cardinality?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rokkit/graph",
3
- "version": "1.8.0",
3
+ "version": "1.8.1",
4
4
  "description": "Node-link diagram components — pluggable layouts, ER/schema views",
5
5
  "repository": {
6
6
  "type": "git",
@@ -46,7 +46,8 @@
46
46
  "check:types": "tsc --noEmit"
47
47
  },
48
48
  "dependencies": {
49
- "@rokkit/core": "1.8.0"
49
+ "@rokkit/core": "1.8.0",
50
+ "@rokkit/states": "1.8.0"
50
51
  },
51
52
  "peerDependencies": {
52
53
  "@rokkit/ui": "1.8.0",