@stealthscale/component-graphs 0.1.0 → 0.2.2
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/cyclonedx/bom.json +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -3807
- package/dist/pages/directed-graph/directed-graph.js +1170 -0
- package/dist/pages/directed-graph/directed-graph.props.js +3 -0
- package/dist/pages/graph/graph.js +1619 -0
- package/dist/pages/graph/graph.props.js +3 -0
- package/dist/pages/network-graph/network-graph.js +1542 -0
- package/dist/pages/network-graph/network-graph.props.js +3 -0
- package/dist/pages/pages.json +43 -0
- package/dist/{recipe-BkmwNoaQ.js → recipes-lWPA4IJC.js} +19 -19
- package/dist/shared-DOF4V8-Q.js +3808 -0
- package/dist/theme.js +1 -1
- package/locales/en/specimen/directed-graph.json +88 -0
- package/locales/en/specimen/graph.json +155 -0
- package/locales/en/specimen/network-graph.json +99 -0
- package/package.json +19 -18
|
@@ -0,0 +1,1170 @@
|
|
|
1
|
+
import { t as __exportAll } from "../../rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
import { a as ZoomLevel, c as Controls, d as DirectedGraph, l as Control, s as MiniMap, u as treeEdges } from "../../shared-DOF4V8-Q.js";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { c } from "react/compiler-runtime";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Room, specimen, useWords } from "@stealthscale/specimen";
|
|
7
|
+
import { BrainCircuitIcon, ChartColumnIcon, ChevronDownIcon, DatabaseIcon, FileDownIcon, LayersIcon, MaximizeIcon, MinusIcon, PlusIcon } from "lucide-react";
|
|
8
|
+
import { NativeSelect } from "@stealthscale/component-forms";
|
|
9
|
+
import { Stack } from "@stealthscale/component-layout";
|
|
10
|
+
//#region src/directed-graph/examples/controlled.example.tsx
|
|
11
|
+
var controlled_example_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
Controlled: () => Controlled,
|
|
13
|
+
source: () => source$4
|
|
14
|
+
});
|
|
15
|
+
const DATASETS$2 = [
|
|
16
|
+
{
|
|
17
|
+
icon: /* @__PURE__ */ jsx(DatabaseIcon, {}),
|
|
18
|
+
id: "orders",
|
|
19
|
+
kind: "source"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
icon: /* @__PURE__ */ jsx(DatabaseIcon, {}),
|
|
23
|
+
id: "refunds",
|
|
24
|
+
kind: "source"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
icon: /* @__PURE__ */ jsx(LayersIcon, {}),
|
|
28
|
+
id: "net_orders",
|
|
29
|
+
kind: "model"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
icon: /* @__PURE__ */ jsx(ChartColumnIcon, {}),
|
|
33
|
+
id: "exec_overview",
|
|
34
|
+
kind: "dashboard"
|
|
35
|
+
}
|
|
36
|
+
];
|
|
37
|
+
const EDGES$3 = [
|
|
38
|
+
{
|
|
39
|
+
source: "orders",
|
|
40
|
+
target: "net_orders"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
source: "refunds",
|
|
44
|
+
target: "net_orders"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
source: "net_orders",
|
|
48
|
+
target: "exec_overview"
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
function Controlled() {
|
|
52
|
+
const $ = c(64);
|
|
53
|
+
const { t } = useWords("directed-graph");
|
|
54
|
+
const [focus, setFocus] = useState("net_orders");
|
|
55
|
+
let T0;
|
|
56
|
+
let T1;
|
|
57
|
+
let T2;
|
|
58
|
+
let nodes;
|
|
59
|
+
let t0;
|
|
60
|
+
let t1;
|
|
61
|
+
let t2;
|
|
62
|
+
let t3;
|
|
63
|
+
let t4;
|
|
64
|
+
let t5;
|
|
65
|
+
if ($[0] !== focus || $[1] !== t) {
|
|
66
|
+
let t6;
|
|
67
|
+
if ($[12] !== t) {
|
|
68
|
+
t6 = (dataset) => ({
|
|
69
|
+
icon: dataset.icon,
|
|
70
|
+
id: dataset.id,
|
|
71
|
+
kind: t(`kinds.${dataset.kind}`),
|
|
72
|
+
label: dataset.kind === "dashboard" ? t(`lineage.${dataset.id}`) : dataset.id
|
|
73
|
+
});
|
|
74
|
+
$[12] = t;
|
|
75
|
+
$[13] = t6;
|
|
76
|
+
} else t6 = $[13];
|
|
77
|
+
nodes = DATASETS$2.map(t6);
|
|
78
|
+
T2 = Stack;
|
|
79
|
+
t5 = "flex-start";
|
|
80
|
+
T1 = NativeSelect.Root;
|
|
81
|
+
T0 = NativeSelect.Field;
|
|
82
|
+
if ($[14] !== t) {
|
|
83
|
+
t0 = t("controlled.pick");
|
|
84
|
+
$[14] = t;
|
|
85
|
+
$[15] = t0;
|
|
86
|
+
} else t0 = $[15];
|
|
87
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
88
|
+
t1 = (event) => {
|
|
89
|
+
setFocus(event.target.value === "" ? null : event.target.value);
|
|
90
|
+
};
|
|
91
|
+
$[16] = t1;
|
|
92
|
+
} else t1 = $[16];
|
|
93
|
+
if ($[17] !== t) {
|
|
94
|
+
t2 = t("controlled.none");
|
|
95
|
+
$[17] = t;
|
|
96
|
+
$[18] = t2;
|
|
97
|
+
} else t2 = $[18];
|
|
98
|
+
t3 = focus ?? "";
|
|
99
|
+
t4 = nodes.map(_temp);
|
|
100
|
+
$[0] = focus;
|
|
101
|
+
$[1] = t;
|
|
102
|
+
$[2] = T0;
|
|
103
|
+
$[3] = T1;
|
|
104
|
+
$[4] = T2;
|
|
105
|
+
$[5] = nodes;
|
|
106
|
+
$[6] = t0;
|
|
107
|
+
$[7] = t1;
|
|
108
|
+
$[8] = t2;
|
|
109
|
+
$[9] = t3;
|
|
110
|
+
$[10] = t4;
|
|
111
|
+
$[11] = t5;
|
|
112
|
+
} else {
|
|
113
|
+
T0 = $[2];
|
|
114
|
+
T1 = $[3];
|
|
115
|
+
T2 = $[4];
|
|
116
|
+
nodes = $[5];
|
|
117
|
+
t0 = $[6];
|
|
118
|
+
t1 = $[7];
|
|
119
|
+
t2 = $[8];
|
|
120
|
+
t3 = $[9];
|
|
121
|
+
t4 = $[10];
|
|
122
|
+
t5 = $[11];
|
|
123
|
+
}
|
|
124
|
+
let t6;
|
|
125
|
+
if ($[19] !== T0 || $[20] !== t0 || $[21] !== t1 || $[22] !== t2 || $[23] !== t3 || $[24] !== t4) {
|
|
126
|
+
t6 = /* @__PURE__ */ jsx(T0, {
|
|
127
|
+
"aria-label": t0,
|
|
128
|
+
onChange: t1,
|
|
129
|
+
placeholder: t2,
|
|
130
|
+
value: t3,
|
|
131
|
+
children: t4
|
|
132
|
+
});
|
|
133
|
+
$[19] = T0;
|
|
134
|
+
$[20] = t0;
|
|
135
|
+
$[21] = t1;
|
|
136
|
+
$[22] = t2;
|
|
137
|
+
$[23] = t3;
|
|
138
|
+
$[24] = t4;
|
|
139
|
+
$[25] = t6;
|
|
140
|
+
} else t6 = $[25];
|
|
141
|
+
let t7;
|
|
142
|
+
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
143
|
+
t7 = /* @__PURE__ */ jsx(NativeSelect.Indicator, { children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) });
|
|
144
|
+
$[26] = t7;
|
|
145
|
+
} else t7 = $[26];
|
|
146
|
+
let t8;
|
|
147
|
+
if ($[27] !== T1 || $[28] !== t6) {
|
|
148
|
+
t8 = /* @__PURE__ */ jsxs(T1, { children: [t6, t7] });
|
|
149
|
+
$[27] = T1;
|
|
150
|
+
$[28] = t6;
|
|
151
|
+
$[29] = t8;
|
|
152
|
+
} else t8 = $[29];
|
|
153
|
+
let t9;
|
|
154
|
+
if ($[30] !== t) {
|
|
155
|
+
t9 = t("words.clear");
|
|
156
|
+
$[30] = t;
|
|
157
|
+
$[31] = t9;
|
|
158
|
+
} else t9 = $[31];
|
|
159
|
+
let t10;
|
|
160
|
+
if ($[32] !== t) {
|
|
161
|
+
t10 = t("words.downstream");
|
|
162
|
+
$[32] = t;
|
|
163
|
+
$[33] = t10;
|
|
164
|
+
} else t10 = $[33];
|
|
165
|
+
let t11;
|
|
166
|
+
if ($[34] !== t) {
|
|
167
|
+
t11 = (t12) => {
|
|
168
|
+
const { source, target } = t12;
|
|
169
|
+
return t("words.edge", {
|
|
170
|
+
source,
|
|
171
|
+
target
|
|
172
|
+
});
|
|
173
|
+
};
|
|
174
|
+
$[34] = t;
|
|
175
|
+
$[35] = t11;
|
|
176
|
+
} else t11 = $[35];
|
|
177
|
+
let t12;
|
|
178
|
+
if ($[36] !== t) {
|
|
179
|
+
t12 = t("words.focus");
|
|
180
|
+
$[36] = t;
|
|
181
|
+
$[37] = t12;
|
|
182
|
+
} else t12 = $[37];
|
|
183
|
+
let t13;
|
|
184
|
+
if ($[38] !== t) {
|
|
185
|
+
t13 = t("controlled.label");
|
|
186
|
+
$[38] = t;
|
|
187
|
+
$[39] = t13;
|
|
188
|
+
} else t13 = $[39];
|
|
189
|
+
let t14;
|
|
190
|
+
if ($[40] !== t) {
|
|
191
|
+
t14 = t("words.description");
|
|
192
|
+
$[40] = t;
|
|
193
|
+
$[41] = t14;
|
|
194
|
+
} else t14 = $[41];
|
|
195
|
+
let t15;
|
|
196
|
+
if ($[42] !== t) {
|
|
197
|
+
t15 = t("words.prompt");
|
|
198
|
+
$[42] = t;
|
|
199
|
+
$[43] = t15;
|
|
200
|
+
} else t15 = $[43];
|
|
201
|
+
let t16;
|
|
202
|
+
let t17;
|
|
203
|
+
if ($[44] !== t) {
|
|
204
|
+
t16 = (t18) => {
|
|
205
|
+
const { downstream, name, upstream } = t18;
|
|
206
|
+
return t("words.summary", {
|
|
207
|
+
downstream,
|
|
208
|
+
name,
|
|
209
|
+
upstream
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
t17 = t("words.upstream");
|
|
213
|
+
$[44] = t;
|
|
214
|
+
$[45] = t16;
|
|
215
|
+
$[46] = t17;
|
|
216
|
+
} else {
|
|
217
|
+
t16 = $[45];
|
|
218
|
+
t17 = $[46];
|
|
219
|
+
}
|
|
220
|
+
let t18;
|
|
221
|
+
if ($[47] !== focus || $[48] !== nodes || $[49] !== t10 || $[50] !== t11 || $[51] !== t12 || $[52] !== t13 || $[53] !== t14 || $[54] !== t15 || $[55] !== t16 || $[56] !== t17 || $[57] !== t9) {
|
|
222
|
+
t18 = /* @__PURE__ */ jsx(DirectedGraph, {
|
|
223
|
+
clearLabel: t9,
|
|
224
|
+
direction: "right",
|
|
225
|
+
downstreamLabel: t10,
|
|
226
|
+
edgeName: t11,
|
|
227
|
+
edges: EDGES$3,
|
|
228
|
+
focus,
|
|
229
|
+
focusLabel: t12,
|
|
230
|
+
label: t13,
|
|
231
|
+
nodeDescription: t14,
|
|
232
|
+
nodes,
|
|
233
|
+
onFocusChange: setFocus,
|
|
234
|
+
promptLabel: t15,
|
|
235
|
+
summary: t16,
|
|
236
|
+
upstreamLabel: t17
|
|
237
|
+
});
|
|
238
|
+
$[47] = focus;
|
|
239
|
+
$[48] = nodes;
|
|
240
|
+
$[49] = t10;
|
|
241
|
+
$[50] = t11;
|
|
242
|
+
$[51] = t12;
|
|
243
|
+
$[52] = t13;
|
|
244
|
+
$[53] = t14;
|
|
245
|
+
$[54] = t15;
|
|
246
|
+
$[55] = t16;
|
|
247
|
+
$[56] = t17;
|
|
248
|
+
$[57] = t9;
|
|
249
|
+
$[58] = t18;
|
|
250
|
+
} else t18 = $[58];
|
|
251
|
+
let t19;
|
|
252
|
+
if ($[59] !== T2 || $[60] !== t18 || $[61] !== t5 || $[62] !== t8) {
|
|
253
|
+
t19 = /* @__PURE__ */ jsxs(T2, {
|
|
254
|
+
align: t5,
|
|
255
|
+
children: [t8, t18]
|
|
256
|
+
});
|
|
257
|
+
$[59] = T2;
|
|
258
|
+
$[60] = t18;
|
|
259
|
+
$[61] = t5;
|
|
260
|
+
$[62] = t8;
|
|
261
|
+
$[63] = t19;
|
|
262
|
+
} else t19 = $[63];
|
|
263
|
+
return t19;
|
|
264
|
+
}
|
|
265
|
+
function _temp(node) {
|
|
266
|
+
return /* @__PURE__ */ jsx("option", {
|
|
267
|
+
value: node.id,
|
|
268
|
+
children: node.label
|
|
269
|
+
}, node.id);
|
|
270
|
+
}
|
|
271
|
+
const source$4 = "import { type ReactElement, useState } from \"react\";\n\nimport { ChartColumnIcon, ChevronDownIcon, DatabaseIcon, LayersIcon } from \"lucide-react\";\n\nimport { NativeSelect } from \"@stealthscale/component-forms\";\nimport { Stack } from \"@stealthscale/component-layout\";\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DirectedGraph } from \"@stealthscale/component-graphs\";\n\nconst DATASETS = [\n { icon: <DatabaseIcon />, id: \"orders\", kind: \"source\" },\n { icon: <DatabaseIcon />, id: \"refunds\", kind: \"source\" },\n { icon: <LayersIcon />, id: \"net_orders\", kind: \"model\" },\n { icon: <ChartColumnIcon />, id: \"exec_overview\", kind: \"dashboard\" },\n] as const;\n\nconst EDGES = [\n { source: \"orders\", target: \"net_orders\" },\n { source: \"refunds\", target: \"net_orders\" },\n { source: \"net_orders\", target: \"exec_overview\" },\n];\n\nexport function Controlled(): ReactElement {\n const { t } = useWords(\"directed-graph\");\n const [focus, setFocus] = useState<null | string>(\"net_orders\");\n const nodes = DATASETS.map((dataset) => ({\n icon: dataset.icon,\n id: dataset.id,\n kind: t(`kinds.${dataset.kind}`),\n label: dataset.kind === \"dashboard\" ? t(`lineage.${dataset.id}`) : dataset.id,\n }));\n\n return (\n <Stack align=\"flex-start\">\n <NativeSelect.Root>\n <NativeSelect.Field\n aria-label={t(\"controlled.pick\")}\n onChange={(event) => {\n setFocus(event.target.value === \"\" ? null : event.target.value);\n }}\n placeholder={t(\"controlled.none\")}\n value={focus ?? \"\"}\n >\n {nodes.map((node) => (\n <option key={node.id} value={node.id}>\n {node.label}\n </option>\n ))}\n </NativeSelect.Field>\n <NativeSelect.Indicator>\n <ChevronDownIcon />\n </NativeSelect.Indicator>\n </NativeSelect.Root>\n <DirectedGraph\n clearLabel={t(\"words.clear\")}\n direction=\"right\"\n downstreamLabel={t(\"words.downstream\")}\n edgeName={({ source, target }) => t(\"words.edge\", { source, target })}\n edges={EDGES}\n focus={focus}\n focusLabel={t(\"words.focus\")}\n label={t(\"controlled.label\")}\n nodeDescription={t(\"words.description\")}\n nodes={nodes}\n onFocusChange={setFocus}\n promptLabel={t(\"words.prompt\")}\n summary={({ downstream, name, upstream }) =>\n t(\"words.summary\", { downstream, name, upstream })\n }\n upstreamLabel={t(\"words.upstream\")}\n />\n </Stack>\n );\n}\n";
|
|
272
|
+
//#endregion
|
|
273
|
+
//#region src/directed-graph/examples/empty.example.tsx
|
|
274
|
+
var empty_example_exports = /* @__PURE__ */ __exportAll({
|
|
275
|
+
Empty: () => Empty,
|
|
276
|
+
source: () => source$3
|
|
277
|
+
});
|
|
278
|
+
function Empty() {
|
|
279
|
+
const $ = c(9);
|
|
280
|
+
const { t } = useWords("directed-graph");
|
|
281
|
+
let t0;
|
|
282
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
283
|
+
t0 = [];
|
|
284
|
+
$[0] = t0;
|
|
285
|
+
} else t0 = $[0];
|
|
286
|
+
let t1;
|
|
287
|
+
if ($[1] !== t) {
|
|
288
|
+
t1 = t("empty.message");
|
|
289
|
+
$[1] = t;
|
|
290
|
+
$[2] = t1;
|
|
291
|
+
} else t1 = $[2];
|
|
292
|
+
let t2;
|
|
293
|
+
if ($[3] !== t) {
|
|
294
|
+
t2 = t("empty.label");
|
|
295
|
+
$[3] = t;
|
|
296
|
+
$[4] = t2;
|
|
297
|
+
} else t2 = $[4];
|
|
298
|
+
let t3;
|
|
299
|
+
if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
|
|
300
|
+
t3 = [];
|
|
301
|
+
$[5] = t3;
|
|
302
|
+
} else t3 = $[5];
|
|
303
|
+
let t4;
|
|
304
|
+
if ($[6] !== t1 || $[7] !== t2) {
|
|
305
|
+
t4 = /* @__PURE__ */ jsx(DirectedGraph, {
|
|
306
|
+
edges: t0,
|
|
307
|
+
emptyLabel: t1,
|
|
308
|
+
label: t2,
|
|
309
|
+
nodes: t3,
|
|
310
|
+
ratio: "wide"
|
|
311
|
+
});
|
|
312
|
+
$[6] = t1;
|
|
313
|
+
$[7] = t2;
|
|
314
|
+
$[8] = t4;
|
|
315
|
+
} else t4 = $[8];
|
|
316
|
+
return t4;
|
|
317
|
+
}
|
|
318
|
+
const source$3 = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DirectedGraph } from \"@stealthscale/component-graphs\";\n\nexport function Empty(): ReactElement {\n const { t } = useWords(\"directed-graph\");\n\n return (\n <DirectedGraph\n edges={[]}\n emptyLabel={t(\"empty.message\")}\n label={t(\"empty.label\")}\n nodes={[]}\n ratio=\"wide\"\n />\n );\n}\n";
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region src/directed-graph/examples/isolate.example.tsx
|
|
321
|
+
var isolate_example_exports = /* @__PURE__ */ __exportAll({
|
|
322
|
+
Isolate: () => Isolate,
|
|
323
|
+
source: () => source$2
|
|
324
|
+
});
|
|
325
|
+
const ICONS$1 = {
|
|
326
|
+
dashboard: /* @__PURE__ */ jsx(ChartColumnIcon, {}),
|
|
327
|
+
features: /* @__PURE__ */ jsx(BrainCircuitIcon, {}),
|
|
328
|
+
job: /* @__PURE__ */ jsx(FileDownIcon, {}),
|
|
329
|
+
model: /* @__PURE__ */ jsx(LayersIcon, {}),
|
|
330
|
+
source: /* @__PURE__ */ jsx(DatabaseIcon, {})
|
|
331
|
+
};
|
|
332
|
+
const DATASETS$1 = [
|
|
333
|
+
{
|
|
334
|
+
id: "stripe_charges",
|
|
335
|
+
kind: "source"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
id: "app_events",
|
|
339
|
+
kind: "source"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
id: "crm_accounts",
|
|
343
|
+
kind: "source"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
id: "stg_charges",
|
|
347
|
+
kind: "model"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
id: "stg_events",
|
|
351
|
+
kind: "model"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
id: "stg_accounts",
|
|
355
|
+
kind: "model"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
id: "fct_revenue",
|
|
359
|
+
kind: "model"
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
id: "dim_customer",
|
|
363
|
+
kind: "model"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
id: "exec_overview",
|
|
367
|
+
kind: "dashboard"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
id: "churn_features",
|
|
371
|
+
kind: "features"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
id: "finance_export",
|
|
375
|
+
kind: "job"
|
|
376
|
+
}
|
|
377
|
+
];
|
|
378
|
+
const EDGES$2 = [
|
|
379
|
+
{
|
|
380
|
+
source: "stripe_charges",
|
|
381
|
+
target: "stg_charges"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
source: "app_events",
|
|
385
|
+
target: "stg_events"
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
source: "crm_accounts",
|
|
389
|
+
target: "stg_accounts"
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
source: "stg_charges",
|
|
393
|
+
target: "fct_revenue"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
source: "stg_events",
|
|
397
|
+
target: "fct_revenue"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
source: "stg_accounts",
|
|
401
|
+
target: "dim_customer"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
source: "stg_events",
|
|
405
|
+
target: "dim_customer"
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
source: "fct_revenue",
|
|
409
|
+
target: "exec_overview"
|
|
410
|
+
},
|
|
411
|
+
{
|
|
412
|
+
source: "dim_customer",
|
|
413
|
+
target: "exec_overview"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
source: "dim_customer",
|
|
417
|
+
target: "churn_features"
|
|
418
|
+
},
|
|
419
|
+
{
|
|
420
|
+
source: "fct_revenue",
|
|
421
|
+
target: "finance_export"
|
|
422
|
+
}
|
|
423
|
+
];
|
|
424
|
+
function Isolate() {
|
|
425
|
+
const $ = c(31);
|
|
426
|
+
const { t } = useWords("directed-graph");
|
|
427
|
+
let t0;
|
|
428
|
+
if ($[0] !== t) {
|
|
429
|
+
t0 = DATASETS$1.map((dataset) => ({
|
|
430
|
+
icon: ICONS$1[dataset.kind],
|
|
431
|
+
id: dataset.id,
|
|
432
|
+
kind: t(`kinds.${dataset.kind}`),
|
|
433
|
+
label: dataset.kind === "dashboard" || dataset.kind === "job" ? t(`lineage.${dataset.id}`) : dataset.id
|
|
434
|
+
}));
|
|
435
|
+
$[0] = t;
|
|
436
|
+
$[1] = t0;
|
|
437
|
+
} else t0 = $[1];
|
|
438
|
+
const nodes = t0;
|
|
439
|
+
let t1;
|
|
440
|
+
if ($[2] !== t) {
|
|
441
|
+
t1 = t("words.clear");
|
|
442
|
+
$[2] = t;
|
|
443
|
+
$[3] = t1;
|
|
444
|
+
} else t1 = $[3];
|
|
445
|
+
let t2;
|
|
446
|
+
if ($[4] !== t) {
|
|
447
|
+
t2 = t("words.downstream");
|
|
448
|
+
$[4] = t;
|
|
449
|
+
$[5] = t2;
|
|
450
|
+
} else t2 = $[5];
|
|
451
|
+
let t3;
|
|
452
|
+
if ($[6] !== t) {
|
|
453
|
+
t3 = (t4) => {
|
|
454
|
+
const { source, target } = t4;
|
|
455
|
+
return t("words.edge", {
|
|
456
|
+
source,
|
|
457
|
+
target
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
$[6] = t;
|
|
461
|
+
$[7] = t3;
|
|
462
|
+
} else t3 = $[7];
|
|
463
|
+
let t4;
|
|
464
|
+
if ($[8] !== t) {
|
|
465
|
+
t4 = t("words.focus");
|
|
466
|
+
$[8] = t;
|
|
467
|
+
$[9] = t4;
|
|
468
|
+
} else t4 = $[9];
|
|
469
|
+
let t5;
|
|
470
|
+
if ($[10] !== t) {
|
|
471
|
+
t5 = t("isolate.label");
|
|
472
|
+
$[10] = t;
|
|
473
|
+
$[11] = t5;
|
|
474
|
+
} else t5 = $[11];
|
|
475
|
+
let t6;
|
|
476
|
+
if ($[12] !== t) {
|
|
477
|
+
t6 = t("words.description");
|
|
478
|
+
$[12] = t;
|
|
479
|
+
$[13] = t6;
|
|
480
|
+
} else t6 = $[13];
|
|
481
|
+
let t7;
|
|
482
|
+
if ($[14] !== t) {
|
|
483
|
+
t7 = t("words.prompt");
|
|
484
|
+
$[14] = t;
|
|
485
|
+
$[15] = t7;
|
|
486
|
+
} else t7 = $[15];
|
|
487
|
+
let t8;
|
|
488
|
+
if ($[16] !== t) {
|
|
489
|
+
t8 = (t9) => {
|
|
490
|
+
const { downstream, name, upstream } = t9;
|
|
491
|
+
return t("words.summary", {
|
|
492
|
+
downstream,
|
|
493
|
+
name,
|
|
494
|
+
upstream
|
|
495
|
+
});
|
|
496
|
+
};
|
|
497
|
+
$[16] = t;
|
|
498
|
+
$[17] = t8;
|
|
499
|
+
} else t8 = $[17];
|
|
500
|
+
let t9;
|
|
501
|
+
if ($[18] !== t) {
|
|
502
|
+
t9 = t("words.upstream");
|
|
503
|
+
$[18] = t;
|
|
504
|
+
$[19] = t9;
|
|
505
|
+
} else t9 = $[19];
|
|
506
|
+
let t10;
|
|
507
|
+
if ($[20] !== nodes || $[21] !== t1 || $[22] !== t2 || $[23] !== t3 || $[24] !== t4 || $[25] !== t5 || $[26] !== t6 || $[27] !== t7 || $[28] !== t8 || $[29] !== t9) {
|
|
508
|
+
t10 = /* @__PURE__ */ jsx(DirectedGraph, {
|
|
509
|
+
clearLabel: t1,
|
|
510
|
+
defaultFocus: "fct_revenue",
|
|
511
|
+
depth: 1,
|
|
512
|
+
direction: "right",
|
|
513
|
+
downstreamLabel: t2,
|
|
514
|
+
edgeName: t3,
|
|
515
|
+
edges: EDGES$2,
|
|
516
|
+
focusLabel: t4,
|
|
517
|
+
label: t5,
|
|
518
|
+
nodeDescription: t6,
|
|
519
|
+
nodes,
|
|
520
|
+
promptLabel: t7,
|
|
521
|
+
summary: t8,
|
|
522
|
+
trace: "isolate",
|
|
523
|
+
upstreamLabel: t9
|
|
524
|
+
});
|
|
525
|
+
$[20] = nodes;
|
|
526
|
+
$[21] = t1;
|
|
527
|
+
$[22] = t2;
|
|
528
|
+
$[23] = t3;
|
|
529
|
+
$[24] = t4;
|
|
530
|
+
$[25] = t5;
|
|
531
|
+
$[26] = t6;
|
|
532
|
+
$[27] = t7;
|
|
533
|
+
$[28] = t8;
|
|
534
|
+
$[29] = t9;
|
|
535
|
+
$[30] = t10;
|
|
536
|
+
} else t10 = $[30];
|
|
537
|
+
return t10;
|
|
538
|
+
}
|
|
539
|
+
const source$2 = "import { type ReactElement } from \"react\";\n\nimport {\n BrainCircuitIcon,\n ChartColumnIcon,\n DatabaseIcon,\n FileDownIcon,\n LayersIcon,\n} from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DirectedGraph } from \"@stealthscale/component-graphs\";\n\nconst ICONS = {\n dashboard: <ChartColumnIcon />,\n features: <BrainCircuitIcon />,\n job: <FileDownIcon />,\n model: <LayersIcon />,\n source: <DatabaseIcon />,\n};\n\nconst DATASETS = [\n { id: \"stripe_charges\", kind: \"source\" },\n { id: \"app_events\", kind: \"source\" },\n { id: \"crm_accounts\", kind: \"source\" },\n { id: \"stg_charges\", kind: \"model\" },\n { id: \"stg_events\", kind: \"model\" },\n { id: \"stg_accounts\", kind: \"model\" },\n { id: \"fct_revenue\", kind: \"model\" },\n { id: \"dim_customer\", kind: \"model\" },\n { id: \"exec_overview\", kind: \"dashboard\" },\n { id: \"churn_features\", kind: \"features\" },\n { id: \"finance_export\", kind: \"job\" },\n] as const;\n\nconst EDGES = [\n { source: \"stripe_charges\", target: \"stg_charges\" },\n { source: \"app_events\", target: \"stg_events\" },\n { source: \"crm_accounts\", target: \"stg_accounts\" },\n { source: \"stg_charges\", target: \"fct_revenue\" },\n { source: \"stg_events\", target: \"fct_revenue\" },\n { source: \"stg_accounts\", target: \"dim_customer\" },\n { source: \"stg_events\", target: \"dim_customer\" },\n { source: \"fct_revenue\", target: \"exec_overview\" },\n { source: \"dim_customer\", target: \"exec_overview\" },\n { source: \"dim_customer\", target: \"churn_features\" },\n { source: \"fct_revenue\", target: \"finance_export\" },\n];\n\nexport function Isolate(): ReactElement {\n const { t } = useWords(\"directed-graph\");\n const nodes = DATASETS.map((dataset) => ({\n icon: ICONS[dataset.kind],\n id: dataset.id,\n kind: t(`kinds.${dataset.kind}`),\n label:\n dataset.kind === \"dashboard\" || dataset.kind === \"job\"\n ? t(`lineage.${dataset.id}`)\n : dataset.id,\n }));\n\n return (\n <DirectedGraph\n clearLabel={t(\"words.clear\")}\n defaultFocus=\"fct_revenue\"\n depth={1}\n direction=\"right\"\n downstreamLabel={t(\"words.downstream\")}\n edgeName={({ source, target }) => t(\"words.edge\", { source, target })}\n edges={EDGES}\n focusLabel={t(\"words.focus\")}\n label={t(\"isolate.label\")}\n nodeDescription={t(\"words.description\")}\n nodes={nodes}\n promptLabel={t(\"words.prompt\")}\n summary={({ downstream, name, upstream }) =>\n t(\"words.summary\", { downstream, name, upstream })\n }\n trace=\"isolate\"\n upstreamLabel={t(\"words.upstream\")}\n />\n );\n}\n";
|
|
540
|
+
//#endregion
|
|
541
|
+
//#region src/directed-graph/examples/lineage.example.tsx
|
|
542
|
+
var lineage_example_exports = /* @__PURE__ */ __exportAll({
|
|
543
|
+
Lineage: () => Lineage,
|
|
544
|
+
source: () => source$1
|
|
545
|
+
});
|
|
546
|
+
const ICONS = {
|
|
547
|
+
dashboard: /* @__PURE__ */ jsx(ChartColumnIcon, {}),
|
|
548
|
+
features: /* @__PURE__ */ jsx(BrainCircuitIcon, {}),
|
|
549
|
+
job: /* @__PURE__ */ jsx(FileDownIcon, {}),
|
|
550
|
+
model: /* @__PURE__ */ jsx(LayersIcon, {}),
|
|
551
|
+
source: /* @__PURE__ */ jsx(DatabaseIcon, {})
|
|
552
|
+
};
|
|
553
|
+
const DATASETS = [
|
|
554
|
+
{
|
|
555
|
+
id: "stripe_charges",
|
|
556
|
+
kind: "source"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
id: "app_events",
|
|
560
|
+
kind: "source"
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
id: "crm_accounts",
|
|
564
|
+
kind: "source"
|
|
565
|
+
},
|
|
566
|
+
{
|
|
567
|
+
id: "stg_charges",
|
|
568
|
+
kind: "model"
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
id: "stg_events",
|
|
572
|
+
kind: "model",
|
|
573
|
+
status: {
|
|
574
|
+
key: "failed",
|
|
575
|
+
palette: "error"
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
id: "stg_accounts",
|
|
580
|
+
kind: "model"
|
|
581
|
+
},
|
|
582
|
+
{
|
|
583
|
+
id: "fct_revenue",
|
|
584
|
+
kind: "model"
|
|
585
|
+
},
|
|
586
|
+
{
|
|
587
|
+
id: "dim_customer",
|
|
588
|
+
kind: "model",
|
|
589
|
+
status: {
|
|
590
|
+
key: "stale",
|
|
591
|
+
palette: "warning"
|
|
592
|
+
}
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
id: "exec_overview",
|
|
596
|
+
kind: "dashboard"
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
id: "churn_features",
|
|
600
|
+
kind: "features"
|
|
601
|
+
},
|
|
602
|
+
{
|
|
603
|
+
id: "finance_export",
|
|
604
|
+
kind: "job"
|
|
605
|
+
}
|
|
606
|
+
];
|
|
607
|
+
const EDGES$1 = [
|
|
608
|
+
{
|
|
609
|
+
source: "stripe_charges",
|
|
610
|
+
target: "stg_charges"
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
source: "app_events",
|
|
614
|
+
target: "stg_events"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
source: "crm_accounts",
|
|
618
|
+
target: "stg_accounts"
|
|
619
|
+
},
|
|
620
|
+
{
|
|
621
|
+
source: "stg_charges",
|
|
622
|
+
target: "fct_revenue"
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
source: "stg_events",
|
|
626
|
+
target: "fct_revenue"
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
source: "stg_accounts",
|
|
630
|
+
target: "dim_customer"
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
source: "stg_events",
|
|
634
|
+
target: "dim_customer"
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
source: "fct_revenue",
|
|
638
|
+
target: "exec_overview"
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
source: "dim_customer",
|
|
642
|
+
target: "exec_overview"
|
|
643
|
+
},
|
|
644
|
+
{
|
|
645
|
+
source: "dim_customer",
|
|
646
|
+
target: "churn_features"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
source: "fct_revenue",
|
|
650
|
+
target: "finance_export"
|
|
651
|
+
}
|
|
652
|
+
];
|
|
653
|
+
function Lineage() {
|
|
654
|
+
const $ = c(62);
|
|
655
|
+
const { t } = useWords("directed-graph");
|
|
656
|
+
let t0;
|
|
657
|
+
if ($[0] !== t) {
|
|
658
|
+
t0 = DATASETS.map((dataset) => ({
|
|
659
|
+
icon: ICONS[dataset.kind],
|
|
660
|
+
id: dataset.id,
|
|
661
|
+
kind: t(`kinds.${dataset.kind}`),
|
|
662
|
+
label: dataset.kind === "dashboard" || dataset.kind === "job" ? t(`lineage.${dataset.id}`) : dataset.id,
|
|
663
|
+
status: "status" in dataset ? {
|
|
664
|
+
label: t(`status.${dataset.status.key}`),
|
|
665
|
+
palette: dataset.status.palette
|
|
666
|
+
} : void 0
|
|
667
|
+
}));
|
|
668
|
+
$[0] = t;
|
|
669
|
+
$[1] = t0;
|
|
670
|
+
} else t0 = $[1];
|
|
671
|
+
const nodes = t0;
|
|
672
|
+
let t1;
|
|
673
|
+
if ($[2] !== t) {
|
|
674
|
+
t1 = t("lineage.caption");
|
|
675
|
+
$[2] = t;
|
|
676
|
+
$[3] = t1;
|
|
677
|
+
} else t1 = $[3];
|
|
678
|
+
let t2;
|
|
679
|
+
if ($[4] !== t) {
|
|
680
|
+
t2 = t("words.clear");
|
|
681
|
+
$[4] = t;
|
|
682
|
+
$[5] = t2;
|
|
683
|
+
} else t2 = $[5];
|
|
684
|
+
let t3;
|
|
685
|
+
if ($[6] !== t) {
|
|
686
|
+
t3 = t("controls");
|
|
687
|
+
$[6] = t;
|
|
688
|
+
$[7] = t3;
|
|
689
|
+
} else t3 = $[7];
|
|
690
|
+
let t4;
|
|
691
|
+
if ($[8] !== t) {
|
|
692
|
+
t4 = t("zoomIn");
|
|
693
|
+
$[8] = t;
|
|
694
|
+
$[9] = t4;
|
|
695
|
+
} else t4 = $[9];
|
|
696
|
+
let t5;
|
|
697
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
698
|
+
t5 = /* @__PURE__ */ jsx(PlusIcon, {});
|
|
699
|
+
$[10] = t5;
|
|
700
|
+
} else t5 = $[10];
|
|
701
|
+
let t6;
|
|
702
|
+
if ($[11] !== t4) {
|
|
703
|
+
t6 = /* @__PURE__ */ jsx(Control, {
|
|
704
|
+
action: "zoomIn",
|
|
705
|
+
label: t4,
|
|
706
|
+
children: t5
|
|
707
|
+
});
|
|
708
|
+
$[11] = t4;
|
|
709
|
+
$[12] = t6;
|
|
710
|
+
} else t6 = $[12];
|
|
711
|
+
let t7;
|
|
712
|
+
if ($[13] !== t) {
|
|
713
|
+
t7 = t("zoomOut");
|
|
714
|
+
$[13] = t;
|
|
715
|
+
$[14] = t7;
|
|
716
|
+
} else t7 = $[14];
|
|
717
|
+
let t8;
|
|
718
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
719
|
+
t8 = /* @__PURE__ */ jsx(MinusIcon, {});
|
|
720
|
+
$[15] = t8;
|
|
721
|
+
} else t8 = $[15];
|
|
722
|
+
let t9;
|
|
723
|
+
if ($[16] !== t7) {
|
|
724
|
+
t9 = /* @__PURE__ */ jsx(Control, {
|
|
725
|
+
action: "zoomOut",
|
|
726
|
+
label: t7,
|
|
727
|
+
children: t8
|
|
728
|
+
});
|
|
729
|
+
$[16] = t7;
|
|
730
|
+
$[17] = t9;
|
|
731
|
+
} else t9 = $[17];
|
|
732
|
+
let t10;
|
|
733
|
+
if ($[18] !== t) {
|
|
734
|
+
t10 = t("fit");
|
|
735
|
+
$[18] = t;
|
|
736
|
+
$[19] = t10;
|
|
737
|
+
} else t10 = $[19];
|
|
738
|
+
let t11;
|
|
739
|
+
if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
|
|
740
|
+
t11 = /* @__PURE__ */ jsx(MaximizeIcon, {});
|
|
741
|
+
$[20] = t11;
|
|
742
|
+
} else t11 = $[20];
|
|
743
|
+
let t12;
|
|
744
|
+
if ($[21] !== t10) {
|
|
745
|
+
t12 = /* @__PURE__ */ jsx(Control, {
|
|
746
|
+
action: "fit",
|
|
747
|
+
label: t10,
|
|
748
|
+
children: t11
|
|
749
|
+
});
|
|
750
|
+
$[21] = t10;
|
|
751
|
+
$[22] = t12;
|
|
752
|
+
} else t12 = $[22];
|
|
753
|
+
let t13;
|
|
754
|
+
if ($[23] === Symbol.for("react.memo_cache_sentinel")) {
|
|
755
|
+
t13 = /* @__PURE__ */ jsx(ZoomLevel, {});
|
|
756
|
+
$[23] = t13;
|
|
757
|
+
} else t13 = $[23];
|
|
758
|
+
let t14;
|
|
759
|
+
if ($[24] !== t12 || $[25] !== t3 || $[26] !== t6 || $[27] !== t9) {
|
|
760
|
+
t14 = /* @__PURE__ */ jsxs(Controls, {
|
|
761
|
+
label: t3,
|
|
762
|
+
children: [
|
|
763
|
+
t6,
|
|
764
|
+
t9,
|
|
765
|
+
t12,
|
|
766
|
+
t13
|
|
767
|
+
]
|
|
768
|
+
});
|
|
769
|
+
$[24] = t12;
|
|
770
|
+
$[25] = t3;
|
|
771
|
+
$[26] = t6;
|
|
772
|
+
$[27] = t9;
|
|
773
|
+
$[28] = t14;
|
|
774
|
+
} else t14 = $[28];
|
|
775
|
+
let t15;
|
|
776
|
+
if ($[29] !== t) {
|
|
777
|
+
t15 = t("words.downstream");
|
|
778
|
+
$[29] = t;
|
|
779
|
+
$[30] = t15;
|
|
780
|
+
} else t15 = $[30];
|
|
781
|
+
let t16;
|
|
782
|
+
if ($[31] !== t) {
|
|
783
|
+
t16 = (t17) => {
|
|
784
|
+
const { source, target } = t17;
|
|
785
|
+
return t("words.edge", {
|
|
786
|
+
source,
|
|
787
|
+
target
|
|
788
|
+
});
|
|
789
|
+
};
|
|
790
|
+
$[31] = t;
|
|
791
|
+
$[32] = t16;
|
|
792
|
+
} else t16 = $[32];
|
|
793
|
+
let t17;
|
|
794
|
+
if ($[33] !== t) {
|
|
795
|
+
t17 = t("words.focus");
|
|
796
|
+
$[33] = t;
|
|
797
|
+
$[34] = t17;
|
|
798
|
+
} else t17 = $[34];
|
|
799
|
+
let t18;
|
|
800
|
+
if ($[35] !== t) {
|
|
801
|
+
t18 = t("lineage.label");
|
|
802
|
+
$[35] = t;
|
|
803
|
+
$[36] = t18;
|
|
804
|
+
} else t18 = $[36];
|
|
805
|
+
let t19;
|
|
806
|
+
if ($[37] !== t) {
|
|
807
|
+
t19 = t("words.description");
|
|
808
|
+
$[37] = t;
|
|
809
|
+
$[38] = t19;
|
|
810
|
+
} else t19 = $[38];
|
|
811
|
+
let t20;
|
|
812
|
+
if ($[39] !== t) {
|
|
813
|
+
t20 = t("lineage.overview");
|
|
814
|
+
$[39] = t;
|
|
815
|
+
$[40] = t20;
|
|
816
|
+
} else t20 = $[40];
|
|
817
|
+
let t21;
|
|
818
|
+
if ($[41] !== t20) {
|
|
819
|
+
t21 = /* @__PURE__ */ jsx(MiniMap, { label: t20 });
|
|
820
|
+
$[41] = t20;
|
|
821
|
+
$[42] = t21;
|
|
822
|
+
} else t21 = $[42];
|
|
823
|
+
let t22;
|
|
824
|
+
if ($[43] !== t) {
|
|
825
|
+
t22 = t("words.prompt");
|
|
826
|
+
$[43] = t;
|
|
827
|
+
$[44] = t22;
|
|
828
|
+
} else t22 = $[44];
|
|
829
|
+
let t23;
|
|
830
|
+
let t24;
|
|
831
|
+
if ($[45] !== t) {
|
|
832
|
+
t23 = (t25) => {
|
|
833
|
+
const { downstream, name, upstream } = t25;
|
|
834
|
+
return t("words.summary", {
|
|
835
|
+
downstream,
|
|
836
|
+
name,
|
|
837
|
+
upstream
|
|
838
|
+
});
|
|
839
|
+
};
|
|
840
|
+
t24 = t("words.upstream");
|
|
841
|
+
$[45] = t;
|
|
842
|
+
$[46] = t23;
|
|
843
|
+
$[47] = t24;
|
|
844
|
+
} else {
|
|
845
|
+
t23 = $[46];
|
|
846
|
+
t24 = $[47];
|
|
847
|
+
}
|
|
848
|
+
let t25;
|
|
849
|
+
if ($[48] !== nodes || $[49] !== t1 || $[50] !== t14 || $[51] !== t15 || $[52] !== t16 || $[53] !== t17 || $[54] !== t18 || $[55] !== t19 || $[56] !== t2 || $[57] !== t21 || $[58] !== t22 || $[59] !== t23 || $[60] !== t24) {
|
|
850
|
+
t25 = /* @__PURE__ */ jsx(DirectedGraph, {
|
|
851
|
+
caption: t1,
|
|
852
|
+
clearLabel: t2,
|
|
853
|
+
controls: t14,
|
|
854
|
+
defaultFocus: "dim_customer",
|
|
855
|
+
direction: "right",
|
|
856
|
+
downstreamLabel: t15,
|
|
857
|
+
edgeName: t16,
|
|
858
|
+
edges: EDGES$1,
|
|
859
|
+
focusLabel: t17,
|
|
860
|
+
label: t18,
|
|
861
|
+
nodeDescription: t19,
|
|
862
|
+
nodes,
|
|
863
|
+
overview: t21,
|
|
864
|
+
promptLabel: t22,
|
|
865
|
+
ratio: "wide",
|
|
866
|
+
summary: t23,
|
|
867
|
+
upstreamLabel: t24
|
|
868
|
+
});
|
|
869
|
+
$[48] = nodes;
|
|
870
|
+
$[49] = t1;
|
|
871
|
+
$[50] = t14;
|
|
872
|
+
$[51] = t15;
|
|
873
|
+
$[52] = t16;
|
|
874
|
+
$[53] = t17;
|
|
875
|
+
$[54] = t18;
|
|
876
|
+
$[55] = t19;
|
|
877
|
+
$[56] = t2;
|
|
878
|
+
$[57] = t21;
|
|
879
|
+
$[58] = t22;
|
|
880
|
+
$[59] = t23;
|
|
881
|
+
$[60] = t24;
|
|
882
|
+
$[61] = t25;
|
|
883
|
+
} else t25 = $[61];
|
|
884
|
+
return t25;
|
|
885
|
+
}
|
|
886
|
+
const source$1 = "import { type ReactElement } from \"react\";\n\nimport {\n BrainCircuitIcon,\n ChartColumnIcon,\n DatabaseIcon,\n FileDownIcon,\n LayersIcon,\n MaximizeIcon,\n MinusIcon,\n PlusIcon,\n} from \"lucide-react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DirectedGraph, Graph } from \"@stealthscale/component-graphs\";\n\nconst ICONS = {\n dashboard: <ChartColumnIcon />,\n features: <BrainCircuitIcon />,\n job: <FileDownIcon />,\n model: <LayersIcon />,\n source: <DatabaseIcon />,\n};\n\nconst DATASETS = [\n { id: \"stripe_charges\", kind: \"source\" },\n { id: \"app_events\", kind: \"source\" },\n { id: \"crm_accounts\", kind: \"source\" },\n { id: \"stg_charges\", kind: \"model\" },\n { id: \"stg_events\", kind: \"model\", status: { key: \"failed\", palette: \"error\" } },\n { id: \"stg_accounts\", kind: \"model\" },\n { id: \"fct_revenue\", kind: \"model\" },\n { id: \"dim_customer\", kind: \"model\", status: { key: \"stale\", palette: \"warning\" } },\n { id: \"exec_overview\", kind: \"dashboard\" },\n { id: \"churn_features\", kind: \"features\" },\n { id: \"finance_export\", kind: \"job\" },\n] as const;\n\nconst EDGES = [\n { source: \"stripe_charges\", target: \"stg_charges\" },\n { source: \"app_events\", target: \"stg_events\" },\n { source: \"crm_accounts\", target: \"stg_accounts\" },\n { source: \"stg_charges\", target: \"fct_revenue\" },\n { source: \"stg_events\", target: \"fct_revenue\" },\n { source: \"stg_accounts\", target: \"dim_customer\" },\n { source: \"stg_events\", target: \"dim_customer\" },\n { source: \"fct_revenue\", target: \"exec_overview\" },\n { source: \"dim_customer\", target: \"exec_overview\" },\n { source: \"dim_customer\", target: \"churn_features\" },\n { source: \"fct_revenue\", target: \"finance_export\" },\n];\n\nexport function Lineage(): ReactElement {\n const { t } = useWords(\"directed-graph\");\n const nodes = DATASETS.map((dataset) => ({\n icon: ICONS[dataset.kind],\n id: dataset.id,\n kind: t(`kinds.${dataset.kind}`),\n label:\n dataset.kind === \"dashboard\" || dataset.kind === \"job\"\n ? t(`lineage.${dataset.id}`)\n : dataset.id,\n status:\n \"status\" in dataset\n ? { label: t(`status.${dataset.status.key}`), palette: dataset.status.palette }\n : undefined,\n }));\n\n return (\n <DirectedGraph\n caption={t(\"lineage.caption\")}\n clearLabel={t(\"words.clear\")}\n controls={\n <Graph.Controls label={t(\"controls\")}>\n <Graph.Control action=\"zoomIn\" label={t(\"zoomIn\")}>\n <PlusIcon />\n </Graph.Control>\n <Graph.Control action=\"zoomOut\" label={t(\"zoomOut\")}>\n <MinusIcon />\n </Graph.Control>\n <Graph.Control action=\"fit\" label={t(\"fit\")}>\n <MaximizeIcon />\n </Graph.Control>\n <Graph.ZoomLevel />\n </Graph.Controls>\n }\n defaultFocus=\"dim_customer\"\n direction=\"right\"\n downstreamLabel={t(\"words.downstream\")}\n edgeName={({ source, target }) => t(\"words.edge\", { source, target })}\n edges={EDGES}\n focusLabel={t(\"words.focus\")}\n label={t(\"lineage.label\")}\n nodeDescription={t(\"words.description\")}\n nodes={nodes}\n overview={<Graph.MiniMap label={t(\"lineage.overview\")} />}\n promptLabel={t(\"words.prompt\")}\n ratio=\"wide\"\n summary={({ downstream, name, upstream }) =>\n t(\"words.summary\", { downstream, name, upstream })\n }\n upstreamLabel={t(\"words.upstream\")}\n />\n );\n}\n";
|
|
887
|
+
//#endregion
|
|
888
|
+
//#region src/directed-graph/examples/org-chart.example.tsx
|
|
889
|
+
var org_chart_example_exports = /* @__PURE__ */ __exportAll({
|
|
890
|
+
OrgChart: () => OrgChart,
|
|
891
|
+
source: () => source
|
|
892
|
+
});
|
|
893
|
+
const PEOPLE = [
|
|
894
|
+
{ id: "ceo" },
|
|
895
|
+
{
|
|
896
|
+
id: "cto",
|
|
897
|
+
manager: "ceo"
|
|
898
|
+
},
|
|
899
|
+
{
|
|
900
|
+
id: "cfo",
|
|
901
|
+
manager: "ceo"
|
|
902
|
+
},
|
|
903
|
+
{
|
|
904
|
+
id: "cpo",
|
|
905
|
+
manager: "ceo"
|
|
906
|
+
},
|
|
907
|
+
{
|
|
908
|
+
id: "eng1",
|
|
909
|
+
manager: "cto"
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
id: "eng2",
|
|
913
|
+
manager: "cto"
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
id: "eng3",
|
|
917
|
+
manager: "eng1"
|
|
918
|
+
},
|
|
919
|
+
{
|
|
920
|
+
id: "eng4",
|
|
921
|
+
manager: "eng1"
|
|
922
|
+
},
|
|
923
|
+
{
|
|
924
|
+
id: "fin1",
|
|
925
|
+
manager: "cfo"
|
|
926
|
+
},
|
|
927
|
+
{
|
|
928
|
+
id: "des1",
|
|
929
|
+
manager: "cpo",
|
|
930
|
+
status: {
|
|
931
|
+
key: "leave",
|
|
932
|
+
palette: "warning"
|
|
933
|
+
}
|
|
934
|
+
},
|
|
935
|
+
{
|
|
936
|
+
id: "pm1",
|
|
937
|
+
manager: "cpo",
|
|
938
|
+
status: {
|
|
939
|
+
key: "open",
|
|
940
|
+
palette: "info"
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
];
|
|
944
|
+
const EDGES = treeEdges(PEOPLE, (person) => "manager" in person ? person.manager : void 0);
|
|
945
|
+
function OrgChart() {
|
|
946
|
+
const $ = c(37);
|
|
947
|
+
const { t } = useWords("directed-graph");
|
|
948
|
+
let t0;
|
|
949
|
+
if ($[0] !== t) {
|
|
950
|
+
t0 = PEOPLE.map((person) => ({
|
|
951
|
+
id: person.id,
|
|
952
|
+
kind: t(`people.${person.id}.title`),
|
|
953
|
+
label: t(`people.${person.id}.name`),
|
|
954
|
+
status: "status" in person ? {
|
|
955
|
+
label: t(`org.${person.status.key}`),
|
|
956
|
+
palette: person.status.palette
|
|
957
|
+
} : void 0
|
|
958
|
+
}));
|
|
959
|
+
$[0] = t;
|
|
960
|
+
$[1] = t0;
|
|
961
|
+
} else t0 = $[1];
|
|
962
|
+
const nodes = t0;
|
|
963
|
+
let t1;
|
|
964
|
+
if ($[2] !== t) {
|
|
965
|
+
t1 = t("org.clear");
|
|
966
|
+
$[2] = t;
|
|
967
|
+
$[3] = t1;
|
|
968
|
+
} else t1 = $[3];
|
|
969
|
+
let t2;
|
|
970
|
+
if ($[4] !== t) {
|
|
971
|
+
t2 = (count) => t("org.collapse", { count });
|
|
972
|
+
$[4] = t;
|
|
973
|
+
$[5] = t2;
|
|
974
|
+
} else t2 = $[5];
|
|
975
|
+
let t3;
|
|
976
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
977
|
+
t3 = ["eng1"];
|
|
978
|
+
$[6] = t3;
|
|
979
|
+
} else t3 = $[6];
|
|
980
|
+
let t4;
|
|
981
|
+
if ($[7] !== t) {
|
|
982
|
+
t4 = t("org.reports");
|
|
983
|
+
$[7] = t;
|
|
984
|
+
$[8] = t4;
|
|
985
|
+
} else t4 = $[8];
|
|
986
|
+
let t5;
|
|
987
|
+
if ($[9] !== t) {
|
|
988
|
+
t5 = (t6) => {
|
|
989
|
+
const { source, target } = t6;
|
|
990
|
+
return t("words.edge", {
|
|
991
|
+
source,
|
|
992
|
+
target
|
|
993
|
+
});
|
|
994
|
+
};
|
|
995
|
+
$[9] = t;
|
|
996
|
+
$[10] = t5;
|
|
997
|
+
} else t5 = $[10];
|
|
998
|
+
let t6;
|
|
999
|
+
if ($[11] !== t) {
|
|
1000
|
+
t6 = t("org.empty");
|
|
1001
|
+
$[11] = t;
|
|
1002
|
+
$[12] = t6;
|
|
1003
|
+
} else t6 = $[12];
|
|
1004
|
+
let t7;
|
|
1005
|
+
let t8;
|
|
1006
|
+
if ($[13] !== t) {
|
|
1007
|
+
t7 = (count_0) => t("org.expand", { count: count_0 });
|
|
1008
|
+
t8 = t("org.label");
|
|
1009
|
+
$[13] = t;
|
|
1010
|
+
$[14] = t7;
|
|
1011
|
+
$[15] = t8;
|
|
1012
|
+
} else {
|
|
1013
|
+
t7 = $[14];
|
|
1014
|
+
t8 = $[15];
|
|
1015
|
+
}
|
|
1016
|
+
let t9;
|
|
1017
|
+
if ($[16] !== t) {
|
|
1018
|
+
t9 = t("org.description");
|
|
1019
|
+
$[16] = t;
|
|
1020
|
+
$[17] = t9;
|
|
1021
|
+
} else t9 = $[17];
|
|
1022
|
+
let t10;
|
|
1023
|
+
if ($[18] !== t) {
|
|
1024
|
+
t10 = t("org.prompt");
|
|
1025
|
+
$[18] = t;
|
|
1026
|
+
$[19] = t10;
|
|
1027
|
+
} else t10 = $[19];
|
|
1028
|
+
let t11;
|
|
1029
|
+
if ($[20] !== t) {
|
|
1030
|
+
t11 = (t12) => {
|
|
1031
|
+
const { downstream, name } = t12;
|
|
1032
|
+
return t("org.summary", {
|
|
1033
|
+
count: downstream,
|
|
1034
|
+
name
|
|
1035
|
+
});
|
|
1036
|
+
};
|
|
1037
|
+
$[20] = t;
|
|
1038
|
+
$[21] = t11;
|
|
1039
|
+
} else t11 = $[21];
|
|
1040
|
+
let t12;
|
|
1041
|
+
if ($[22] !== t) {
|
|
1042
|
+
t12 = t("org.reportsTo");
|
|
1043
|
+
$[22] = t;
|
|
1044
|
+
$[23] = t12;
|
|
1045
|
+
} else t12 = $[23];
|
|
1046
|
+
let t13;
|
|
1047
|
+
if ($[24] !== nodes || $[25] !== t1 || $[26] !== t10 || $[27] !== t11 || $[28] !== t12 || $[29] !== t2 || $[30] !== t4 || $[31] !== t5 || $[32] !== t6 || $[33] !== t7 || $[34] !== t8 || $[35] !== t9) {
|
|
1048
|
+
t13 = /* @__PURE__ */ jsx(DirectedGraph, {
|
|
1049
|
+
clearLabel: t1,
|
|
1050
|
+
collapseLabel: t2,
|
|
1051
|
+
collapsible: true,
|
|
1052
|
+
defaultCollapsed: t3,
|
|
1053
|
+
downstreamLabel: t4,
|
|
1054
|
+
edgeName: t5,
|
|
1055
|
+
edges: EDGES,
|
|
1056
|
+
emptyLabel: t6,
|
|
1057
|
+
expandLabel: t7,
|
|
1058
|
+
label: t8,
|
|
1059
|
+
nodeDescription: t9,
|
|
1060
|
+
nodes,
|
|
1061
|
+
promptLabel: t10,
|
|
1062
|
+
summary: t11,
|
|
1063
|
+
trace: "off",
|
|
1064
|
+
upstreamLabel: t12
|
|
1065
|
+
});
|
|
1066
|
+
$[24] = nodes;
|
|
1067
|
+
$[25] = t1;
|
|
1068
|
+
$[26] = t10;
|
|
1069
|
+
$[27] = t11;
|
|
1070
|
+
$[28] = t12;
|
|
1071
|
+
$[29] = t2;
|
|
1072
|
+
$[30] = t4;
|
|
1073
|
+
$[31] = t5;
|
|
1074
|
+
$[32] = t6;
|
|
1075
|
+
$[33] = t7;
|
|
1076
|
+
$[34] = t8;
|
|
1077
|
+
$[35] = t9;
|
|
1078
|
+
$[36] = t13;
|
|
1079
|
+
} else t13 = $[36];
|
|
1080
|
+
return t13;
|
|
1081
|
+
}
|
|
1082
|
+
const source = "import { type ReactElement } from \"react\";\n\nimport { useWords } from \"@stealthscale/specimen\";\n\nimport { DirectedGraph, treeEdges } from \"@stealthscale/component-graphs\";\n\nconst PEOPLE = [\n { id: \"ceo\" },\n { id: \"cto\", manager: \"ceo\" },\n { id: \"cfo\", manager: \"ceo\" },\n { id: \"cpo\", manager: \"ceo\" },\n { id: \"eng1\", manager: \"cto\" },\n { id: \"eng2\", manager: \"cto\" },\n { id: \"eng3\", manager: \"eng1\" },\n { id: \"eng4\", manager: \"eng1\" },\n { id: \"fin1\", manager: \"cfo\" },\n { id: \"des1\", manager: \"cpo\", status: { key: \"leave\", palette: \"warning\" } },\n { id: \"pm1\", manager: \"cpo\", status: { key: \"open\", palette: \"info\" } },\n] as const;\n\nconst EDGES = treeEdges(PEOPLE, (person) => (\"manager\" in person ? person.manager : undefined));\n\nexport function OrgChart(): ReactElement {\n const { t } = useWords(\"directed-graph\");\n const nodes = PEOPLE.map((person) => ({\n id: person.id,\n kind: t(`people.${person.id}.title`),\n label: t(`people.${person.id}.name`),\n status:\n \"status\" in person\n ? { label: t(`org.${person.status.key}`), palette: person.status.palette }\n : undefined,\n }));\n\n return (\n <DirectedGraph\n clearLabel={t(\"org.clear\")}\n collapseLabel={(count) => t(\"org.collapse\", { count })}\n collapsible\n defaultCollapsed={[\"eng1\"]}\n downstreamLabel={t(\"org.reports\")}\n edgeName={({ source, target }) => t(\"words.edge\", { source, target })}\n edges={EDGES}\n emptyLabel={t(\"org.empty\")}\n expandLabel={(count) => t(\"org.expand\", { count })}\n label={t(\"org.label\")}\n nodeDescription={t(\"org.description\")}\n nodes={nodes}\n promptLabel={t(\"org.prompt\")}\n summary={({ downstream, name }) => t(\"org.summary\", { count: downstream, name })}\n trace=\"off\"\n upstreamLabel={t(\"org.reportsTo\")}\n />\n );\n}\n";
|
|
1083
|
+
//#endregion
|
|
1084
|
+
//#region src/directed-graph/directed-graph.specimen.tsx
|
|
1085
|
+
/**
|
|
1086
|
+
* Catalogue page for the directed graph.
|
|
1087
|
+
*
|
|
1088
|
+
* @remarks
|
|
1089
|
+
* Every scene is hand-written, because the directed graph has no recipe of its own: a warehouse
|
|
1090
|
+
* lineage focused on one model with the controls and the overview map, the same lineage isolated
|
|
1091
|
+
* to one hop, an org chart built from a flat list with branches that open and close, a focus kept
|
|
1092
|
+
* in the caller's state, and a graph without a node. Every scene renders a component from
|
|
1093
|
+
* `examples/` and shows that file as its source. The words are keys under `directed-graph` in
|
|
1094
|
+
* `locales/en/specimen/directed-graph.json`.
|
|
1095
|
+
*/
|
|
1096
|
+
/**
|
|
1097
|
+
* Hand-written scene for a lineage focused on one model.
|
|
1098
|
+
*/
|
|
1099
|
+
const traced = {
|
|
1100
|
+
about: "directed-graph.lineage.about",
|
|
1101
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1102
|
+
size: "4xl",
|
|
1103
|
+
children: /* @__PURE__ */ jsx(Lineage, {})
|
|
1104
|
+
}),
|
|
1105
|
+
example: lineage_example_exports,
|
|
1106
|
+
title: "directed-graph.lineage.title"
|
|
1107
|
+
};
|
|
1108
|
+
/**
|
|
1109
|
+
* Hand-written scene for a lineage isolated to one hop.
|
|
1110
|
+
*/
|
|
1111
|
+
const isolated = {
|
|
1112
|
+
about: "directed-graph.isolate.about",
|
|
1113
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1114
|
+
size: "2xl",
|
|
1115
|
+
children: /* @__PURE__ */ jsx(Isolate, {})
|
|
1116
|
+
}),
|
|
1117
|
+
example: isolate_example_exports,
|
|
1118
|
+
title: "directed-graph.isolate.title"
|
|
1119
|
+
};
|
|
1120
|
+
/**
|
|
1121
|
+
* Hand-written scene for an org chart whose branches open and close.
|
|
1122
|
+
*/
|
|
1123
|
+
const chart = {
|
|
1124
|
+
about: "directed-graph.org.about",
|
|
1125
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1126
|
+
size: "4xl",
|
|
1127
|
+
children: /* @__PURE__ */ jsx(OrgChart, {})
|
|
1128
|
+
}),
|
|
1129
|
+
example: org_chart_example_exports,
|
|
1130
|
+
title: "directed-graph.org.title"
|
|
1131
|
+
};
|
|
1132
|
+
/**
|
|
1133
|
+
* Hand-written scene for a focus kept in the caller's state.
|
|
1134
|
+
*/
|
|
1135
|
+
const kept = {
|
|
1136
|
+
about: "directed-graph.controlled.about",
|
|
1137
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1138
|
+
size: "2xl",
|
|
1139
|
+
children: /* @__PURE__ */ jsx(Controlled, {})
|
|
1140
|
+
}),
|
|
1141
|
+
example: controlled_example_exports,
|
|
1142
|
+
title: "directed-graph.controlled.title"
|
|
1143
|
+
};
|
|
1144
|
+
/**
|
|
1145
|
+
* Hand-written scene for a graph without a node.
|
|
1146
|
+
*/
|
|
1147
|
+
const none = {
|
|
1148
|
+
about: "directed-graph.empty.about",
|
|
1149
|
+
draw: () => /* @__PURE__ */ jsx(Room, {
|
|
1150
|
+
size: "2xl",
|
|
1151
|
+
children: /* @__PURE__ */ jsx(Empty, {})
|
|
1152
|
+
}),
|
|
1153
|
+
example: empty_example_exports,
|
|
1154
|
+
title: "directed-graph.empty.title"
|
|
1155
|
+
};
|
|
1156
|
+
var directed_graph_specimen_default = specimen({
|
|
1157
|
+
about: "directed-graph.about",
|
|
1158
|
+
id: "components/graphs/directed-graph",
|
|
1159
|
+
imports: "import { DirectedGraph, Graph, treeEdges } from \"@stealthscale/component-graphs\";",
|
|
1160
|
+
scenes: [
|
|
1161
|
+
traced,
|
|
1162
|
+
isolated,
|
|
1163
|
+
chart,
|
|
1164
|
+
kept,
|
|
1165
|
+
none
|
|
1166
|
+
],
|
|
1167
|
+
title: "directed-graph.title"
|
|
1168
|
+
});
|
|
1169
|
+
//#endregion
|
|
1170
|
+
export { chart, directed_graph_specimen_default as default, isolated, kept, none, traced };
|