@teurons/vds-diagrams 0.0.0-stage → 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/README.md +170 -2
- package/dist/cli.js +2244 -0
- package/dist/diagrams.css +991 -0
- package/dist/grid.d.ts +1 -0
- package/dist/grid.js +283 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2044 -0
- package/dist/skills/vds-aggregates/SKILL.md +115 -0
- package/dist/skills/vds-ask-or-park/SKILL.md +101 -0
- package/dist/skills/vds-book-to-spec/SKILL.md +136 -0
- package/dist/skills/vds-build-from-published/SKILL.md +89 -0
- package/dist/skills/vds-change/SKILL.md +113 -0
- package/dist/skills/vds-context-map/SKILL.md +125 -0
- package/dist/skills/vds-contexts/SKILL.md +134 -0
- package/dist/skills/vds-diagrams/SKILL.md +88 -0
- package/dist/skills/vds-entities-and-values/SKILL.md +108 -0
- package/dist/skills/vds-language/SKILL.md +106 -0
- package/dist/skills/vds-model-review/SKILL.md +123 -0
- package/dist/skills/vds-ports-and-adapters/SKILL.md +119 -0
- package/dist/skills/vds-publish/SKILL.md +123 -0
- package/dist/skills/vds-reframe/SKILL.md +122 -0
- package/dist/skills/vds-requirements/SKILL.md +128 -0
- package/dist/skills/vds-requirements-review/SKILL.md +121 -0
- package/dist/skills/vds-scenarios/SKILL.md +142 -0
- package/dist/skills/vds-slice-blocks/SKILL.md +127 -0
- package/dist/skills/vds-story-walk/SKILL.md +128 -0
- package/dist/skills/vds-strip-invented/SKILL.md +130 -0
- package/dist/skills/vds-subdomains/SKILL.md +127 -0
- package/dist/skills/vds-which-skill/FILE-SHAPES.md +312 -0
- package/dist/skills/vds-which-skill/SKILL.md +125 -0
- package/dist/types/diagrams/src/grid/camera.d.ts +32 -0
- package/dist/types/diagrams/src/grid/capability.d.ts +11 -0
- package/dist/types/diagrams/src/grid/fold-uj.d.ts +2 -0
- package/dist/types/diagrams/src/grid/grid-canvas.d.ts +95 -0
- package/dist/types/diagrams/src/grid/index.d.ts +5 -0
- package/dist/types/diagrams/src/grid/input.d.ts +93 -0
- package/dist/types/diagrams/src/grid/route.d.ts +21 -0
- package/dist/types/engine/js/bridge.d.ts +12 -0
- package/dist/types/engine/js/index.d.ts +73 -0
- package/dist/types/vds-diagrams/src/canvas.d.ts +43 -0
- package/dist/types/vds-diagrams/src/from-scenarios.d.ts +4 -0
- package/dist/types/vds-diagrams/src/grid-folds.d.ts +1 -0
- package/dist/types/vds-diagrams/src/grid.d.ts +2 -0
- package/dist/types/vds-diagrams/src/index.d.ts +6 -0
- package/dist/types/vds-diagrams/src/types.d.ts +39 -0
- package/dist/types/vds-diagrams/src/user-journey.d.ts +54 -0
- package/dist/types/vds-diagrams/src/workspace.d.ts +25 -0
- package/dist/vds_engine.wasm +0 -0
- package/dist/workspace.d.ts +1 -0
- package/dist/workspace.js +113 -0
- package/package.json +68 -3
package/dist/grid.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types/vds-diagrams/src/grid-folds.js';
|
package/dist/grid.js
ADDED
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// ../diagrams/src/grid/camera.ts
|
|
4
|
+
var pen = typeof document !== "undefined" ? document.createElement("canvas").getContext("2d") : null;
|
|
5
|
+
|
|
6
|
+
// ../diagrams/src/grid/fold-uj.ts
|
|
7
|
+
var ACTOR = "actor";
|
|
8
|
+
var INBOX = "inbox";
|
|
9
|
+
function actionsOf(input) {
|
|
10
|
+
const title = new Map((input.boxes ?? []).map((b) => [b.id, b]));
|
|
11
|
+
const out = /* @__PURE__ */ new Map();
|
|
12
|
+
for (const a of input.arrows ?? []) {
|
|
13
|
+
const to = title.get(a.to);
|
|
14
|
+
if (to?.kind === "cmd" && !out.has(a.from)) out.set(a.from, to.title);
|
|
15
|
+
}
|
|
16
|
+
return out;
|
|
17
|
+
}
|
|
18
|
+
function screenAtStep(columns, screens) {
|
|
19
|
+
const at = /* @__PURE__ */ new Map();
|
|
20
|
+
let open;
|
|
21
|
+
for (const c of columns) {
|
|
22
|
+
open = screens.find((s) => s.column === c.id) ?? open;
|
|
23
|
+
if (open) at.set(c.id, open);
|
|
24
|
+
}
|
|
25
|
+
return at;
|
|
26
|
+
}
|
|
27
|
+
function foldScenarioToUserJourney(input) {
|
|
28
|
+
const rows = (input.rows ?? []).filter((r) => r.kind === ACTOR || r.kind === INBOX);
|
|
29
|
+
const order = new Map((input.columns ?? []).map((c, i) => [c.id, i]));
|
|
30
|
+
const byOrder = (a, b) => (order.get(a.column) ?? 0) - (order.get(b.column) ?? 0);
|
|
31
|
+
const all = input.boxes ?? [];
|
|
32
|
+
const persona = new Set(rows.filter((r) => r.kind === ACTOR).map((r) => r.id));
|
|
33
|
+
const screens = all.filter((b) => persona.has(b.row)).sort(byOrder);
|
|
34
|
+
const used = new Set(screens.map((b) => b.column));
|
|
35
|
+
const openAt = screenAtStep(input.columns ?? [], screens);
|
|
36
|
+
const messages = all.filter((b) => rows.some((r) => r.kind === INBOX && r.id === b.row)).map((b) => ({ ...b, column: openAt.get(b.column)?.column ?? b.column })).filter((b) => used.has(b.column));
|
|
37
|
+
const boxes = screens;
|
|
38
|
+
const keptAt = (input.columns ?? []).map((c) => used.has(c.id));
|
|
39
|
+
const folded = [
|
|
40
|
+
...boxes.map((b) => {
|
|
41
|
+
if (!b.span || b.span < 2) return b;
|
|
42
|
+
const at = order.get(b.column) ?? 0;
|
|
43
|
+
const span = keptAt.slice(at, at + b.span).filter(Boolean).length;
|
|
44
|
+
const { span: _, ...rest } = b;
|
|
45
|
+
return span > 1 ? { ...rest, span } : rest;
|
|
46
|
+
}),
|
|
47
|
+
...messages
|
|
48
|
+
];
|
|
49
|
+
const columns = (input.columns ?? []).filter((c) => used.has(c.id)).map((c, i) => ({
|
|
50
|
+
...c,
|
|
51
|
+
number: String(i + 1),
|
|
52
|
+
label: boxes.find((b) => b.column === c.id)?.title ?? c.label
|
|
53
|
+
}));
|
|
54
|
+
const actions = actionsOf(input);
|
|
55
|
+
const arrows = [];
|
|
56
|
+
for (let i = 1; i < boxes.length; i++) {
|
|
57
|
+
const from = boxes[i - 1];
|
|
58
|
+
const to = boxes[i];
|
|
59
|
+
if (!from || !to || from.column === to.column) continue;
|
|
60
|
+
const label = actions.get(from.id);
|
|
61
|
+
arrows.push({
|
|
62
|
+
from: from.id,
|
|
63
|
+
to: to.id,
|
|
64
|
+
tone: "journey",
|
|
65
|
+
ends: "dots",
|
|
66
|
+
...label ? { label } : {}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return { ...input, corner: ["Screen \u2192", "Persona \u2193"], columns, rows, boxes: folded, arrows };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// ../diagrams/src/grid/grid-canvas.tsx
|
|
73
|
+
import {
|
|
74
|
+
Handle,
|
|
75
|
+
Position,
|
|
76
|
+
ReactFlow,
|
|
77
|
+
ReactFlowProvider,
|
|
78
|
+
useReactFlow,
|
|
79
|
+
useStoreApi
|
|
80
|
+
} from "@xyflow/react";
|
|
81
|
+
import {
|
|
82
|
+
Fragment,
|
|
83
|
+
createContext,
|
|
84
|
+
useContext,
|
|
85
|
+
useEffect,
|
|
86
|
+
useLayoutEffect,
|
|
87
|
+
useMemo,
|
|
88
|
+
useRef,
|
|
89
|
+
useState
|
|
90
|
+
} from "react";
|
|
91
|
+
import { Fragment as Fragment2, jsx, jsxs } from "react/jsx-runtime";
|
|
92
|
+
var Ctx = createContext(null);
|
|
93
|
+
|
|
94
|
+
// ../diagrams/src/grid/capability.ts
|
|
95
|
+
var SCREEN = "scr";
|
|
96
|
+
var PERSONA = "actor";
|
|
97
|
+
var INBOX2 = "inbox";
|
|
98
|
+
var SUMMED = /* @__PURE__ */ new Set(["auto", "call", "ext", "tr"]);
|
|
99
|
+
function screenKey(flow, box) {
|
|
100
|
+
const d = flow.details?.[box.id];
|
|
101
|
+
return d?.rows?.find((r) => r.label === "Screen")?.value ?? box.title;
|
|
102
|
+
}
|
|
103
|
+
function screenColumns(flow) {
|
|
104
|
+
const cols = flow.columns ?? [];
|
|
105
|
+
const at = /* @__PURE__ */ new Map();
|
|
106
|
+
for (const b of (flow.boxes ?? []).filter((x) => x.kind === SCREEN)) {
|
|
107
|
+
const i = cols.findIndex((c) => c.id === b.column);
|
|
108
|
+
for (const c of cols.slice(i, i + (b.span ?? 1))) at.set(c.id, screenKey(flow, b));
|
|
109
|
+
}
|
|
110
|
+
return at;
|
|
111
|
+
}
|
|
112
|
+
function screenAtStep2(flow) {
|
|
113
|
+
const cols = flow.columns ?? [];
|
|
114
|
+
const at = screenColumns(flow);
|
|
115
|
+
let last = cols.map((c) => at.get(c.id)).find(Boolean);
|
|
116
|
+
for (const c of cols) {
|
|
117
|
+
last = at.get(c.id) ?? last;
|
|
118
|
+
if (last) at.set(c.id, last);
|
|
119
|
+
}
|
|
120
|
+
return at;
|
|
121
|
+
}
|
|
122
|
+
function screensInOrder(flows) {
|
|
123
|
+
const rank = /* @__PURE__ */ new Map();
|
|
124
|
+
for (const f of flows) {
|
|
125
|
+
(f.boxes ?? []).filter((b) => b.kind === SCREEN).forEach((b, i) => {
|
|
126
|
+
const k = screenKey(f, b);
|
|
127
|
+
const was = rank.get(k);
|
|
128
|
+
if (!was || i < was.at) rank.set(k, { at: i, title: was?.title ?? b.title });
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return [...rank.entries()].sort((a, b) => a[1].at - b[1].at).map(([key, v]) => ({ key, title: v.title }));
|
|
132
|
+
}
|
|
133
|
+
function mergedPlace(f, b, step, colOf) {
|
|
134
|
+
const screen = b.kind === SCREEN ? screenKey(f, b) : step.get(b.column);
|
|
135
|
+
const column = colOf.get(screen ?? "") ?? "c0";
|
|
136
|
+
return {
|
|
137
|
+
id: b.kind === SCREEN ? `scr:${screen}` : `${b.kind}:${column}:${b.row}:${b.title}`,
|
|
138
|
+
column
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function addBox(into, b, place, d) {
|
|
142
|
+
if (into.boxes.has(place.id)) return;
|
|
143
|
+
const { span: _, ...rest } = b;
|
|
144
|
+
into.boxes.set(place.id, { ...rest, ...place });
|
|
145
|
+
if (d !== void 0) into.details[place.id] = d;
|
|
146
|
+
}
|
|
147
|
+
function mergeBoxes(f, colOf, into) {
|
|
148
|
+
const step = screenAtStep2(f);
|
|
149
|
+
const idOf = /* @__PURE__ */ new Map();
|
|
150
|
+
for (const b of f.boxes ?? []) {
|
|
151
|
+
const place = mergedPlace(f, b, step, colOf);
|
|
152
|
+
idOf.set(b.id, place.id);
|
|
153
|
+
addBox(into, b, place, f.details?.[b.id]);
|
|
154
|
+
}
|
|
155
|
+
return idOf;
|
|
156
|
+
}
|
|
157
|
+
function addArrow(into, a, from = "", to = "") {
|
|
158
|
+
const key = `${from}>${to}>${a.label}`;
|
|
159
|
+
if (from && to && from !== to && !into.arrows.has(key)) into.arrows.set(key, { ...a, from, to });
|
|
160
|
+
}
|
|
161
|
+
function mergeOne(f, colOf, into) {
|
|
162
|
+
const idOf = mergeBoxes(f, colOf, into);
|
|
163
|
+
for (const a of f.arrows ?? []) addArrow(into, a, idOf.get(a.from), idOf.get(a.to));
|
|
164
|
+
}
|
|
165
|
+
function mergeScenarioGrids(flows) {
|
|
166
|
+
const screens = screensInOrder(flows);
|
|
167
|
+
const colOf = new Map(screens.map((s, i) => [s.key, `c${i}`]));
|
|
168
|
+
const columns = screens.map((s, i) => ({
|
|
169
|
+
id: `c${i}`,
|
|
170
|
+
number: String(i + 1),
|
|
171
|
+
label: s.title
|
|
172
|
+
}));
|
|
173
|
+
const rows = [];
|
|
174
|
+
for (const r of flows.flatMap((f) => f.rows ?? []))
|
|
175
|
+
if (!rows.some((x) => x.id === r.id)) rows.push(r);
|
|
176
|
+
const merged = { boxes: /* @__PURE__ */ new Map(), arrows: /* @__PURE__ */ new Map(), details: {} };
|
|
177
|
+
for (const f of flows) mergeOne(f, colOf, merged);
|
|
178
|
+
return {
|
|
179
|
+
...flows[0] ?? { kind: "grid", input: 1 },
|
|
180
|
+
corner: ["Screen \u2192", "Lane \u2193"],
|
|
181
|
+
columns,
|
|
182
|
+
rows,
|
|
183
|
+
boxes: [...merged.boxes.values()],
|
|
184
|
+
arrows: [...merged.arrows.values()],
|
|
185
|
+
details: merged.details
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
function waysOut(s, arrows, byId) {
|
|
189
|
+
const ways = [];
|
|
190
|
+
for (const a of arrows) {
|
|
191
|
+
const to = byId.get(a.to);
|
|
192
|
+
if (a.from !== s.id || to?.kind !== SCREEN || to.id === s.id) continue;
|
|
193
|
+
const label = a.label ?? "Next";
|
|
194
|
+
if (!ways.some((w) => w.label === label && w.to.id === to.id)) ways.push({ label, to });
|
|
195
|
+
}
|
|
196
|
+
return ways;
|
|
197
|
+
}
|
|
198
|
+
function checksOf(s, ways, out) {
|
|
199
|
+
let at = s.id;
|
|
200
|
+
ways.forEach((w, i) => {
|
|
201
|
+
const id = `chk:${s.id}:${i}`;
|
|
202
|
+
const title = `${w.label}?`;
|
|
203
|
+
out.boxes.push({ id, row: "decision", column: s.column, kind: "chk", title });
|
|
204
|
+
out.details[id] = {
|
|
205
|
+
kind: "Check",
|
|
206
|
+
title,
|
|
207
|
+
rows: [
|
|
208
|
+
{ label: "Asked after", value: s.title },
|
|
209
|
+
{ label: "Yes leads to", value: w.to.title }
|
|
210
|
+
],
|
|
211
|
+
steps: []
|
|
212
|
+
};
|
|
213
|
+
const no = at === s.id ? {} : { label: "No", labelAt: "start", numbered: "from" };
|
|
214
|
+
out.arrows.push({
|
|
215
|
+
from: at,
|
|
216
|
+
to: id,
|
|
217
|
+
tone: at === s.id ? "journey" : "no",
|
|
218
|
+
fromSide: "bottom",
|
|
219
|
+
toSide: "top",
|
|
220
|
+
ends: "dots",
|
|
221
|
+
...no
|
|
222
|
+
});
|
|
223
|
+
const up = w.to.column !== s.column ? { toSide: "bottom" } : {};
|
|
224
|
+
out.arrows.push({
|
|
225
|
+
from: id,
|
|
226
|
+
to: w.to.id,
|
|
227
|
+
tone: "yes",
|
|
228
|
+
label: "Yes",
|
|
229
|
+
labelAt: "start",
|
|
230
|
+
numbered: "from",
|
|
231
|
+
fromSide: "right",
|
|
232
|
+
ends: "dots",
|
|
233
|
+
...up
|
|
234
|
+
});
|
|
235
|
+
at = id;
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
function backendOf(c, all, kept) {
|
|
239
|
+
const work = all.filter((b) => b.column === c.id && SUMMED.has(b.kind ?? ""));
|
|
240
|
+
const names = [...new Set(work.map((b) => b.title))];
|
|
241
|
+
if (!names.length) return null;
|
|
242
|
+
const title = names.length > 1 ? `${names[0]} +${names.length - 1} more` : names[0] ?? "";
|
|
243
|
+
const box = { id: `be:${c.id}`, row: "backend", column: c.id, kind: "auto", title };
|
|
244
|
+
const panel = {
|
|
245
|
+
kind: "Backend",
|
|
246
|
+
title: c.label ?? c.id,
|
|
247
|
+
rows: all.filter((b) => b.column === c.id && !kept.has(b.row)).map((b) => ({ label: b.kind ?? "box", value: b.title })),
|
|
248
|
+
steps: []
|
|
249
|
+
};
|
|
250
|
+
return { box, panel };
|
|
251
|
+
}
|
|
252
|
+
function foldCapabilityToUserJourney(full) {
|
|
253
|
+
const all = full.boxes ?? [];
|
|
254
|
+
const persona = (full.rows ?? []).filter((r) => r.kind === PERSONA);
|
|
255
|
+
const inboxes = (full.rows ?? []).filter((r) => r.kind === INBOX2);
|
|
256
|
+
const rows = [
|
|
257
|
+
...persona,
|
|
258
|
+
{ id: "decision", kind: "mid", label: "Decision", sub: "routes to a screen" },
|
|
259
|
+
...inboxes,
|
|
260
|
+
{ id: "backend", kind: "auto", label: "Backend", sub: "system work" }
|
|
261
|
+
];
|
|
262
|
+
const kept = new Set([...persona, ...inboxes].map((r) => r.id));
|
|
263
|
+
const out = {
|
|
264
|
+
boxes: all.filter((b) => kept.has(b.row)),
|
|
265
|
+
arrows: [],
|
|
266
|
+
details: { ...full.details }
|
|
267
|
+
};
|
|
268
|
+
const byId = new Map(all.map((b) => [b.id, b]));
|
|
269
|
+
for (const s of all.filter((b) => b.kind === SCREEN))
|
|
270
|
+
checksOf(s, waysOut(s, full.arrows ?? [], byId), out);
|
|
271
|
+
for (const c of full.columns ?? []) {
|
|
272
|
+
const be = backendOf(c, all, kept);
|
|
273
|
+
if (!be) continue;
|
|
274
|
+
out.boxes.push(be.box);
|
|
275
|
+
out.details[be.box.id] = be.panel;
|
|
276
|
+
}
|
|
277
|
+
return { ...full, corner: ["Screen \u2192", "Lane \u2193"], rows, ...out };
|
|
278
|
+
}
|
|
279
|
+
export {
|
|
280
|
+
foldCapabilityToUserJourney,
|
|
281
|
+
foldScenarioToUserJourney,
|
|
282
|
+
mergeScenarioGrids
|
|
283
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types/vds-diagrams/src/index.js';
|