@erd-studio/renderer 0.1.3 → 0.3.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/CHANGELOG.md +26 -0
- package/README.md +9 -9
- package/dist/{chunk-H2ACJRPZ.js → chunk-HWA32XG5.js} +146 -50
- package/dist/editor.js +9 -9
- package/dist/index.js +3 -3
- package/dist/styles.css +70 -0
- package/dist/types/ErdCanvas.d.ts +4 -4
- package/dist/types/canvas/useCanvasGraph.d.ts +4 -4
- package/dist/types/components/DetailPanel/AliasEditor.d.ts +1 -1
- package/dist/types/components/DetailPanel/ColumnEditor.d.ts +2 -2
- package/dist/types/components/DetailPanel/ModelRationale.d.ts +5 -5
- package/dist/types/components/DetailPanel/RoleEditor.d.ts +3 -3
- package/dist/types/components/Graph/ColumnTooltip.d.ts +1 -1
- package/dist/types/components/Graph/ModelNode.d.ts +4 -4
- package/dist/types/components/Legend/Legend.d.ts +1 -1
- package/dist/types/components/common/ColumnRowEditor.d.ts +2 -2
- package/dist/types/editor.d.ts +2 -2
- package/dist/types/hooks/useColumnReorder.d.ts +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/lib/badgeLabels.d.ts +1 -1
- package/dist/types/lib/dragHandleSides.d.ts +2 -2
- package/dist/types/lib/graphTransformer.d.ts +7 -7
- package/dist/types/lib/modelLabels.d.ts +3 -3
- package/dist/types/lib/nodeOverlays.d.ts +4 -4
- package/dist/types/lib/nodeSizing.d.ts +6 -6
- package/dist/types/store/editorStore.d.ts +8 -8
- package/dist/types/types/graph.d.ts +22 -12
- package/package.json +3 -2
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
* Types for React Flow graph nodes and edges.
|
|
3
3
|
*
|
|
4
4
|
* These types define the data payloads for custom React Flow node and edge
|
|
5
|
-
* components. The graph transformer converts
|
|
5
|
+
* components. The graph transformer converts DisplaySubjectArea data into
|
|
6
6
|
* these shapes.
|
|
7
7
|
*/
|
|
8
8
|
import type { Node, Edge } from '@xyflow/react';
|
|
9
|
-
import type { AnnotationColor, Cardinality, ColumnPair, DbtKeyHint, Layer, Meta,
|
|
9
|
+
import type { AnnotationColor, Cardinality, ColumnPair, DbtKeyHint, Layer, Meta, TableLoadError, TableLoadWarning, TableRole, Stage } from '@erd-studio/core';
|
|
10
10
|
import type { LayerConfig } from '@erd-studio/core';
|
|
11
|
-
import type {
|
|
11
|
+
import type { TableDiscrepancy } from '@erd-studio/core';
|
|
12
12
|
import type { PhysicalProvenance } from '@erd-studio/core';
|
|
13
|
-
/** Column data enriched with PK/FK/NK indicators for display in
|
|
13
|
+
/** Column data enriched with PK/FK/NK indicators for display in TableNode. */
|
|
14
14
|
export interface ColumnDisplay {
|
|
15
15
|
name: string;
|
|
16
16
|
dataType: string;
|
|
@@ -30,14 +30,14 @@ export interface ColumnDisplay {
|
|
|
30
30
|
/** What dbt's tests say about the column (editable logical canvas only) — one line of its hover text. */
|
|
31
31
|
dbtKey?: DbtKeyHint;
|
|
32
32
|
}
|
|
33
|
-
/** Data payload for a
|
|
34
|
-
export type
|
|
33
|
+
/** Data payload for a TableNode React Flow node. */
|
|
34
|
+
export type TableNodeData = {
|
|
35
35
|
/** Model name (unique within a domain). */
|
|
36
36
|
modelName: string;
|
|
37
37
|
/**
|
|
38
38
|
* Header label when it differs from `modelName`: the model's table name
|
|
39
39
|
* (`alias`), qualified by schema when another model on the canvas would read
|
|
40
|
-
* the same. See `
|
|
40
|
+
* the same. See `computeTableLabels`.
|
|
41
41
|
*/
|
|
42
42
|
label?: string;
|
|
43
43
|
/** The active design stage. */
|
|
@@ -65,7 +65,7 @@ export type ModelNodeData = {
|
|
|
65
65
|
/** Grain statement — "One row per ___". Shown as subtitle on node. */
|
|
66
66
|
grain?: string;
|
|
67
67
|
/** Model's role in the data warehouse architecture. Shown as badge on node. */
|
|
68
|
-
modelRole?:
|
|
68
|
+
modelRole?: TableRole;
|
|
69
69
|
/** Structured metadata (`meta:`) — shown in the name's hover tip. Absent when empty. */
|
|
70
70
|
meta?: Meta;
|
|
71
71
|
/** Whether this stage is read-only (physical). */
|
|
@@ -93,11 +93,16 @@ export type ModelNodeData = {
|
|
|
93
93
|
* The model's file exists but could not be read (logical stage only): the
|
|
94
94
|
* node shows the error and an "Open file" button instead of "No columns".
|
|
95
95
|
*/
|
|
96
|
-
loadError?:
|
|
96
|
+
loadError?: TableLoadError;
|
|
97
|
+
/**
|
|
98
|
+
* The model's file was read but needs fixing (logical stage only): a key
|
|
99
|
+
* written twice, whose last value is shown (#164). Absent from an older core.
|
|
100
|
+
*/
|
|
101
|
+
loadWarning?: TableLoadWarning;
|
|
97
102
|
/** Whether this model is in stub display mode (PK/NK columns only). */
|
|
98
103
|
isStub: boolean;
|
|
99
104
|
/** Per-model discrepancy data when a cross-stage comparison report is active. */
|
|
100
|
-
discrepancy?:
|
|
105
|
+
discrepancy?: TableDiscrepancy;
|
|
101
106
|
/** The stage currently being viewed (set when discrepancy overlay is active). */
|
|
102
107
|
discrepancySourceStage?: Stage;
|
|
103
108
|
/** The stage being compared against (set when discrepancy overlay is active). */
|
|
@@ -106,14 +111,14 @@ export type ModelNodeData = {
|
|
|
106
111
|
* Index signature required by React Flow's Node generic.
|
|
107
112
|
*
|
|
108
113
|
* It also means an unknown or misspelled key type-checks, and a field written
|
|
109
|
-
* here but never destructured in
|
|
114
|
+
* here but never destructured in TableNode ships as dead payload — which is
|
|
110
115
|
* exactly how `hasRationale` and `modelRole` gained matching dead CSS. Add a
|
|
111
116
|
* field here only together with the code that reads it.
|
|
112
117
|
*/
|
|
113
118
|
[key: string]: unknown;
|
|
114
119
|
};
|
|
115
120
|
/** Typed React Flow node for a semantic model. */
|
|
116
|
-
export type
|
|
121
|
+
export type TableFlowNode = Node<TableNodeData, 'model'>;
|
|
117
122
|
/** Data payload for an FkEdge React Flow edge. */
|
|
118
123
|
export type FkEdgeData = {
|
|
119
124
|
fromModel: string;
|
|
@@ -130,6 +135,11 @@ export type FkEdgeData = {
|
|
|
130
135
|
pairs?: ColumnPair[];
|
|
131
136
|
/** The composite's `compositeKey` name, alongside `pairs`. */
|
|
132
137
|
compositeKey?: string;
|
|
138
|
+
/**
|
|
139
|
+
* The keys contradict its direction (`DisplayRelationship.keysContradict`,
|
|
140
|
+
* #163): drawn with a ⚠ and Turn round, except for viewers.
|
|
141
|
+
*/
|
|
142
|
+
keysContradict?: true;
|
|
133
143
|
/** Stage of the owning domain canvas — drives CSS colour class. */
|
|
134
144
|
stage?: Stage;
|
|
135
145
|
/** Discrepancy status for ghost/extra/mismatch edges. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erd-studio/renderer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "ERD Studio's React Flow canvas: the entity-relationship diagram renderer shared by the VS Code extension, with a read-only viewer mode.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"files": [
|
|
38
38
|
"dist",
|
|
39
|
+
"CHANGELOG.md",
|
|
39
40
|
"LICENSE",
|
|
40
41
|
"README.md"
|
|
41
42
|
],
|
|
@@ -46,7 +47,7 @@
|
|
|
46
47
|
"prepack": "npm run build"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
|
-
"@erd-studio/core": "0.
|
|
50
|
+
"@erd-studio/core": "0.3.0",
|
|
50
51
|
"zustand": "^5.0.0"
|
|
51
52
|
},
|
|
52
53
|
"peerDependencies": {
|