@cardenelabs/dragon 0.39.0 → 0.41.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 +39 -1
- package/dist/cli.cjs +1921 -429
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1926 -434
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +1718 -353
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/export.js +1723 -358
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +1835 -342
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -15
- package/dist/index.d.ts +5 -15
- package/dist/index.js +1836 -342
- package/dist/index.js.map +1 -1
- package/dist/{ink-Cg-v6XSG.d.cts → ink-B_7OXxtb.d.cts} +27 -2
- package/dist/{ink-Cg-v6XSG.d.ts → ink-B_7OXxtb.d.ts} +27 -2
- package/dist/node.cjs +2946 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +9 -0
- package/dist/node.d.ts +9 -0
- package/dist/node.js +2944 -0
- package/dist/node.js.map +1 -0
- package/dist/player.global.js +2 -2
- package/package.json +11 -1
- package/src/field-messages.ts +8 -0
- package/src/index.ts +5 -2
- package/src/layout/git.ts +728 -0
- package/src/look/values.ts +40 -1
- package/src/messages.ts +47 -4
- package/src/node.ts +23 -0
- package/src/parser.ts +142 -7
- package/src/printer.ts +16 -4
- package/src/render/git.ts +161 -0
- package/src/render/parts.ts +1 -1
- package/src/render/svg.ts +26 -1
- package/src/schema.ts +47 -13
- package/src/schemas/diagram.schema.json +75 -8
- package/src/schemas/validate-diagram.js +1 -1
- package/src/timeline.ts +18 -3
- package/src/version.ts +1 -20
- package/src/words.ts +19 -3
package/dist/cli.cjs
CHANGED
|
@@ -270,7 +270,11 @@ var TYPE = {
|
|
|
270
270
|
stepTitle: text(15, 700),
|
|
271
271
|
stepBody: text(13.5, 500),
|
|
272
272
|
stepNo: text(13, 700, "mono"),
|
|
273
|
-
button: text(14, 700)
|
|
273
|
+
button: text(14, 700),
|
|
274
|
+
/** 枝分かれの図 (#3164) の、丸の中の commit の名札と、丸の外に添える hash と一言 */
|
|
275
|
+
gitId: text(11, 700),
|
|
276
|
+
gitHash: text(10.5, 600, "mono"),
|
|
277
|
+
gitNote: text(10.5, 650)
|
|
274
278
|
};
|
|
275
279
|
var LOOK = {
|
|
276
280
|
/** 部品どうしの最小の隙間 */
|
|
@@ -314,6 +318,41 @@ var LOOK = {
|
|
|
314
318
|
done: { r: 6.5, inset: 13 },
|
|
315
319
|
pastLabel: 0.85
|
|
316
320
|
},
|
|
321
|
+
/**
|
|
322
|
+
* 枝分かれの図 (#3164)。見本帳の試作 (`scenes/git.js`) の寸法を写す。
|
|
323
|
+
* commit は列ごとに `pitch` ずつ右へ並べ、一番上でない帯の commit は列の半分だけ右へずらす。`x0` は最初の列の真ん中の x の下限、
|
|
324
|
+
* `textGap` は隣の列の hash と一言の間に空ける最小の隙間。`r` は丸の半径、`orphan` はどの札からも辿れなくなった commit の点線の丸の半径。
|
|
325
|
+
* `topLine` と `line` は帯の上端から丸を並べる線まで (一番上の帯と、それより下の帯)、`topBelow` と `below` は線から帯の下端まで。
|
|
326
|
+
* `bare` は線の名前を下に置かない帯の、線から帯の下端まで。
|
|
327
|
+
* hash と一言は一番上の帯では丸の上に、ほかの帯では丸の下に置き、`above` と `under` は丸の真ん中から丸に近い行の基準線まで、`lineStep` は行の間。
|
|
328
|
+
* 札は丸の上に段を重ねて置き、`tagTop` と `tag` は丸の真ん中から 1 段目の札の真ん中まで (一番上の帯と、ほかの帯)、`row` は札の段の間。
|
|
329
|
+
* 札の段が 2 段より多い commit がある帯は、多い段の分だけ線を下げる。
|
|
330
|
+
* `turn` は枝へ分かれる線と枝から入る線が曲がり終えて横へ進むまでの長さ、`samples` は曲がりを区切る点の数、`boxGap` は commit の並びと箱の間。
|
|
331
|
+
* `labelUnder` はほかの帯で、丸の真ん中から線の名前の札の上端まで。`colors` は帯の色を上から配る順
|
|
332
|
+
*/
|
|
333
|
+
git: {
|
|
334
|
+
x0: 120,
|
|
335
|
+
pitch: 90,
|
|
336
|
+
textGap: 12,
|
|
337
|
+
r: 12,
|
|
338
|
+
orphan: 13.5,
|
|
339
|
+
topLine: 120,
|
|
340
|
+
line: 90,
|
|
341
|
+
topBelow: 30,
|
|
342
|
+
below: 82,
|
|
343
|
+
bare: 62,
|
|
344
|
+
above: 18,
|
|
345
|
+
under: 27,
|
|
346
|
+
lineStep: 13,
|
|
347
|
+
tagTop: 58,
|
|
348
|
+
tag: 30,
|
|
349
|
+
row: 22,
|
|
350
|
+
turn: 60,
|
|
351
|
+
samples: 12,
|
|
352
|
+
boxGap: 24,
|
|
353
|
+
labelUnder: 50,
|
|
354
|
+
colors: ["blue", "violet", "green", "amber", "rose"]
|
|
355
|
+
},
|
|
317
356
|
/** `bend` は線の曲がりを丸める半径 (#3171) */
|
|
318
357
|
edge: { inset: 3, arrow: 6, arrowHalf: 3.5, parallel: 5, ghostDash: 5, flowDash: 9, bend: 12 },
|
|
319
358
|
/** `touch` は線の名前と、同じ時刻に見えている段の番号の丸の間に空ける最小の隙間 (#3175) */
|
|
@@ -332,7 +371,7 @@ var LOOK = {
|
|
|
332
371
|
* `trail` は状態遷移図の帯の最後の、通った状態の点 (#3171)。`r` は点の半径、`step` は点の中心どうしの間、`now` は変わった値の欄の名前の横の点の半径と、名前からの離れ
|
|
333
372
|
*/
|
|
334
373
|
strip: { h: 72, line: 44, pad: 12, icon: 24, titleX: 44, fieldGap: 22, sepInset: 14, tagGap: 6, tagH: 15, tagPadX: 7, nameY: 22, valueY: 43, trail: { r: 5.4, step: 16 }, now: { r: 3, gap: 7 } },
|
|
335
|
-
stroke: { slot: 1.2, hair: 1, edge: 1.7, edgeOn: 2.25, arrow: 1.5, flow: 1.3, halo: 7, on: 1.75, glyph: 2, lifeline: 1.2, envelope: 1.5, badgeRing: 1.5, path: 1.6, end: 1.6, done: 1.2, trail: 1.2 },
|
|
374
|
+
stroke: { git: 2.25, gitOrphan: 1.5, slot: 1.2, hair: 1, edge: 1.7, edgeOn: 2.25, arrow: 1.5, flow: 1.3, halo: 7, on: 1.75, glyph: 2, lifeline: 1.2, envelope: 1.5, badgeRing: 1.5, path: 1.6, end: 1.6, done: 1.2, trail: 1.2 },
|
|
336
375
|
shadow: { near: 0.8, far: 4, nearY: 1, farY: 3 },
|
|
337
376
|
mini: { w: 168, pad: 8, title: 14, inset: 12, radius: 10 },
|
|
338
377
|
/**
|
|
@@ -947,7 +986,7 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
947
986
|
const headerW = Math.max(0, ...headers.map((h) => h ? h.w + R.inset * 2 : 0));
|
|
948
987
|
const colLeft = [];
|
|
949
988
|
for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin + (headerW > 0 ? headerW : R.pad) : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
|
|
950
|
-
const
|
|
989
|
+
const center2 = (c) => colLeft[c] + colW[c] / 2;
|
|
951
990
|
const looped = new Set(edges.filter(({ edge: edge2 }) => edge2.from === edge2.to).map(({ edge: edge2 }) => edge2.from));
|
|
952
991
|
const loopRows = new Set([...looped].flatMap((id) => {
|
|
953
992
|
const slot = slots.get(id);
|
|
@@ -967,7 +1006,7 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
967
1006
|
const slot = slots.get(id);
|
|
968
1007
|
const source = diagram.boxes.find((b) => b.id === id);
|
|
969
1008
|
const w = widths.get(id) ?? B.minW;
|
|
970
|
-
const cx =
|
|
1009
|
+
const cx = center2(slot.col);
|
|
971
1010
|
const y = top + rowTop[slot.row];
|
|
972
1011
|
boxes.push({
|
|
973
1012
|
id,
|
|
@@ -1191,6 +1230,524 @@ function grow(layout, groups, slots, rooms) {
|
|
|
1191
1230
|
return grown;
|
|
1192
1231
|
}
|
|
1193
1232
|
|
|
1233
|
+
// src/words.ts
|
|
1234
|
+
var keys = (table) => Object.keys(table);
|
|
1235
|
+
var KINDS = keys({ sequence: true, architecture: true, state: true, git: true });
|
|
1236
|
+
var STATE_ENDS = ["start", "finish"];
|
|
1237
|
+
var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set", "branch", "commit"];
|
|
1238
|
+
var AS = "as";
|
|
1239
|
+
var ON = "on";
|
|
1240
|
+
var COPY = "copy";
|
|
1241
|
+
var MERGE = "merge";
|
|
1242
|
+
var FROM = "from";
|
|
1243
|
+
var HEAD = "HEAD";
|
|
1244
|
+
var ATTRS = {
|
|
1245
|
+
diagram: ["view"],
|
|
1246
|
+
group: ["note", "color", "icon"],
|
|
1247
|
+
box: ["note", "color", "icon"],
|
|
1248
|
+
edge: ["carry", "tag", "side"],
|
|
1249
|
+
set: ["tag"],
|
|
1250
|
+
branch: ["note"],
|
|
1251
|
+
commit: ["hash", "note"]
|
|
1252
|
+
};
|
|
1253
|
+
var CARRIES = keys({ coin: true, none: true });
|
|
1254
|
+
var VIEWS = keys({ fixed: true, follow: true });
|
|
1255
|
+
var SIDES = keys({ above: true, below: true, left: true, right: true });
|
|
1256
|
+
var OLD_HEADS = {
|
|
1257
|
+
\u6642\u7CFB\u5217\u56F3: "sequence",
|
|
1258
|
+
\u69CB\u6210\u56F3: "architecture",
|
|
1259
|
+
\u533A\u753B: "group",
|
|
1260
|
+
\u898B\u305B\u65B9: "view",
|
|
1261
|
+
region: "group",
|
|
1262
|
+
view: "view"
|
|
1263
|
+
};
|
|
1264
|
+
|
|
1265
|
+
// src/layout/git.ts
|
|
1266
|
+
var isGitLayout = (layout) => layout.kind === "git";
|
|
1267
|
+
function walk(diagram) {
|
|
1268
|
+
const branches = (diagram.git?.branches ?? []).map((b) => b.id);
|
|
1269
|
+
const lane = (id) => {
|
|
1270
|
+
if (!branches.includes(id)) branches.push(id);
|
|
1271
|
+
};
|
|
1272
|
+
for (const step of diagram.steps) for (const e of step.events) if (e.type === "commit" || e.type === "branch") lane(e.branch);
|
|
1273
|
+
const tips = new Map(branches.map((b) => [b, null]));
|
|
1274
|
+
let headAt = null;
|
|
1275
|
+
let attached = null;
|
|
1276
|
+
const made = [];
|
|
1277
|
+
const byId = /* @__PURE__ */ new Map();
|
|
1278
|
+
const links = [];
|
|
1279
|
+
const moves = [];
|
|
1280
|
+
const tags = [];
|
|
1281
|
+
const rows = /* @__PURE__ */ new Map();
|
|
1282
|
+
const most = /* @__PURE__ */ new Map();
|
|
1283
|
+
const shown = /* @__PURE__ */ new Map();
|
|
1284
|
+
const names = [...branches, HEAD];
|
|
1285
|
+
const at2 = new Map(names.map((n) => [n, []]));
|
|
1286
|
+
const heads = [];
|
|
1287
|
+
const visible2 = (ref) => ref === HEAD ? attached === null ? headAt : null : tips.get(ref) ?? null;
|
|
1288
|
+
const freeRow = (commit2) => {
|
|
1289
|
+
const list2 = rows.get(commit2) ?? [];
|
|
1290
|
+
const free = list2.indexOf(null);
|
|
1291
|
+
return free < 0 ? list2.length : free;
|
|
1292
|
+
};
|
|
1293
|
+
const settle = (step, event, change, lineFor) => {
|
|
1294
|
+
const before = new Map(names.map((n) => [n, visible2(n)]));
|
|
1295
|
+
const headBefore = headAt;
|
|
1296
|
+
change();
|
|
1297
|
+
const changed = names.filter((n) => before.get(n) !== visible2(n));
|
|
1298
|
+
const leaving = changed.map((ref) => {
|
|
1299
|
+
const slot = shown.get(ref);
|
|
1300
|
+
if (slot) {
|
|
1301
|
+
rows.get(slot.commit)[slot.row] = null;
|
|
1302
|
+
shown.delete(ref);
|
|
1303
|
+
}
|
|
1304
|
+
return { ref, slot };
|
|
1305
|
+
});
|
|
1306
|
+
for (const { ref, slot } of leaving) {
|
|
1307
|
+
const from = slot ?? (ref === HEAD && headBefore !== null ? { commit: headBefore, row: freeRow(headBefore) } : void 0);
|
|
1308
|
+
const target = visible2(ref);
|
|
1309
|
+
let to;
|
|
1310
|
+
if (target !== null) {
|
|
1311
|
+
to = { commit: target, row: freeRow(target) };
|
|
1312
|
+
const list2 = rows.get(target) ?? [];
|
|
1313
|
+
list2[to.row] = ref;
|
|
1314
|
+
rows.set(target, list2);
|
|
1315
|
+
most.set(target, Math.max(most.get(target) ?? 0, list2.filter((r) => r !== null).length));
|
|
1316
|
+
shown.set(ref, to);
|
|
1317
|
+
}
|
|
1318
|
+
moves.push({ ref, step, event, ...from ? { from } : {}, ...to ? { to } : {}, line: ref === lineFor });
|
|
1319
|
+
}
|
|
1320
|
+
};
|
|
1321
|
+
const prune = (step, event) => {
|
|
1322
|
+
const reach = /* @__PURE__ */ new Set();
|
|
1323
|
+
const stack = [...tips.values(), headAt].filter((c) => c !== null);
|
|
1324
|
+
while (stack.length > 0) {
|
|
1325
|
+
const id = stack.pop();
|
|
1326
|
+
if (reach.has(id)) continue;
|
|
1327
|
+
reach.add(id);
|
|
1328
|
+
stack.push(...byId.get(id)?.parents ?? []);
|
|
1329
|
+
}
|
|
1330
|
+
for (const c of made) if (!reach.has(c.id) && c.orphan === void 0) c.orphan = { step, event };
|
|
1331
|
+
};
|
|
1332
|
+
diagram.steps.forEach((step, s) => {
|
|
1333
|
+
step.events.forEach((e, k) => {
|
|
1334
|
+
if (e.type === "commit") commit(e, s, k);
|
|
1335
|
+
else if (e.type === "branch") {
|
|
1336
|
+
if (!byId.has(e.from)) return;
|
|
1337
|
+
if (laneOf(e.from) !== e.branch) links.push({ kind: "branch", from: e.from, to: e.branch, step: s, event: k });
|
|
1338
|
+
settle(s, k, () => {
|
|
1339
|
+
tips.set(e.branch, e.from);
|
|
1340
|
+
attached = e.branch;
|
|
1341
|
+
headAt = e.from;
|
|
1342
|
+
});
|
|
1343
|
+
} else if (e.type === "edge") {
|
|
1344
|
+
const ref = e.from;
|
|
1345
|
+
if (ref !== HEAD && !tips.has(ref) || !byId.has(e.to)) return;
|
|
1346
|
+
settle(
|
|
1347
|
+
s,
|
|
1348
|
+
k,
|
|
1349
|
+
() => {
|
|
1350
|
+
if (ref === HEAD) {
|
|
1351
|
+
attached = null;
|
|
1352
|
+
headAt = e.to;
|
|
1353
|
+
return;
|
|
1354
|
+
}
|
|
1355
|
+
tips.set(ref, e.to);
|
|
1356
|
+
if (attached === ref) headAt = e.to;
|
|
1357
|
+
else if (attached === null && headAt === e.to) attached = ref;
|
|
1358
|
+
},
|
|
1359
|
+
ref
|
|
1360
|
+
);
|
|
1361
|
+
} else return;
|
|
1362
|
+
prune(s, k);
|
|
1363
|
+
});
|
|
1364
|
+
for (const n of names) at2.get(n)?.push(n === HEAD ? headAt : tips.get(n) ?? null);
|
|
1365
|
+
heads.push(attached);
|
|
1366
|
+
for (const n of names) {
|
|
1367
|
+
const slot = shown.get(n);
|
|
1368
|
+
if (slot) tags.push({ ref: n, step: s, slot });
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
function laneOf(id) {
|
|
1372
|
+
return byId.get(id)?.branch;
|
|
1373
|
+
}
|
|
1374
|
+
function commit(e, s, k) {
|
|
1375
|
+
if (byId.has(e.id)) return;
|
|
1376
|
+
const copy = e.copy !== void 0 && byId.has(e.copy) ? e.copy : void 0;
|
|
1377
|
+
const base = copy !== void 0 && attached === null && headAt !== null ? headAt : tips.get(e.branch) ?? null;
|
|
1378
|
+
const joined = e.merge !== void 0 && e.merge !== e.branch ? tips.get(e.merge) ?? void 0 : void 0;
|
|
1379
|
+
const parents = [...new Set([base, joined].filter((c2) => c2 !== null && c2 !== void 0))];
|
|
1380
|
+
const c = {
|
|
1381
|
+
id: e.id,
|
|
1382
|
+
branch: e.branch,
|
|
1383
|
+
parents,
|
|
1384
|
+
...joined !== void 0 && joined !== base ? { joined } : {},
|
|
1385
|
+
...copy !== void 0 ? { copy } : {},
|
|
1386
|
+
...e.hash !== void 0 ? { hash: e.hash } : {},
|
|
1387
|
+
...e.note !== void 0 ? { note: e.note } : {},
|
|
1388
|
+
step: s,
|
|
1389
|
+
event: k
|
|
1390
|
+
};
|
|
1391
|
+
made.push(c);
|
|
1392
|
+
byId.set(c.id, c);
|
|
1393
|
+
for (const p of parents) links.push({ kind: "parent", from: p, to: c.id, step: s, event: k });
|
|
1394
|
+
if (copy !== void 0) links.push({ kind: "copy", from: copy, to: c.id, step: s, event: k });
|
|
1395
|
+
const first = attached === null && headAt === null;
|
|
1396
|
+
settle(s, k, () => {
|
|
1397
|
+
if (copy === void 0) {
|
|
1398
|
+
tips.set(e.branch, c.id);
|
|
1399
|
+
if (attached === e.branch) headAt = c.id;
|
|
1400
|
+
} else if (attached === null) headAt = c.id;
|
|
1401
|
+
if (first) {
|
|
1402
|
+
attached = e.branch;
|
|
1403
|
+
headAt = c.id;
|
|
1404
|
+
}
|
|
1405
|
+
});
|
|
1406
|
+
}
|
|
1407
|
+
const refs = names.map((name) => ({ name, at: at2.get(name) ?? [], ...name === HEAD ? { attached: heads } : {} }));
|
|
1408
|
+
return { branches, made, links, moves, refs, tags, rows: most };
|
|
1409
|
+
}
|
|
1410
|
+
function cubic(p0, c1, c2, p3) {
|
|
1411
|
+
const n = LOOK.git.samples;
|
|
1412
|
+
return Array.from({ length: n }, (_, k) => {
|
|
1413
|
+
const t = (k + 1) / n;
|
|
1414
|
+
const u = 1 - t;
|
|
1415
|
+
const at2 = (i) => u * u * u * p0[i] + 3 * u * u * t * c1[i] + 3 * u * t * t * c2[i] + t * t * t * p3[i];
|
|
1416
|
+
return [at2(0), at2(1)];
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
function elbow(from, to) {
|
|
1420
|
+
if (Math.abs(from[1] - to[1]) < 0.5) return [from, to];
|
|
1421
|
+
return from[1] > to[1] ? [from, [from[0], to[1]], to] : [from, [to[0], from[1]], to];
|
|
1422
|
+
}
|
|
1423
|
+
function fork(p, tx, ty) {
|
|
1424
|
+
const sign = ty > p.cy ? 1 : -1;
|
|
1425
|
+
const p0 = [p.cx, p.cy + sign * p.r];
|
|
1426
|
+
const turn = Math.max(0, Math.min(LOOK.git.turn, tx - p.cx));
|
|
1427
|
+
const p3 = [p.cx + turn, ty];
|
|
1428
|
+
const curve = cubic(p0, [p0[0], p0[1] + (ty - p0[1]) * 0.7], [p.cx + turn * 0.2, ty], p3);
|
|
1429
|
+
return [p0, ...curve, ...tx > p3[0] ? [[tx, ty]] : []];
|
|
1430
|
+
}
|
|
1431
|
+
function join(p, c) {
|
|
1432
|
+
const sign = c.cy < p.cy ? 1 : -1;
|
|
1433
|
+
const p0 = [p.cx + p.r, p.cy];
|
|
1434
|
+
const p3 = [c.cx, c.cy + sign * c.r];
|
|
1435
|
+
const turn = Math.max(0, Math.min(LOOK.git.turn, c.cx - p0[0]));
|
|
1436
|
+
const h = [c.cx - turn, p.cy];
|
|
1437
|
+
const curve = cubic(h, [c.cx - turn * 0.2, p.cy], [c.cx, p3[1] + (p.cy - p3[1]) * 0.7], p3);
|
|
1438
|
+
return [p0, ...h[0] > p0[0] ? [h] : [], ...curve];
|
|
1439
|
+
}
|
|
1440
|
+
function copyLine(p, c) {
|
|
1441
|
+
if (Math.abs(p.cy - c.cy) < 0.5) {
|
|
1442
|
+
const top = p.cy - p.r;
|
|
1443
|
+
const lift = LOOK.git.turn * 0.7;
|
|
1444
|
+
return [[p.cx, top], ...cubic([p.cx, top], [p.cx, top - lift], [c.cx, top - lift], [c.cx, top])];
|
|
1445
|
+
}
|
|
1446
|
+
const sign = c.cy < p.cy ? -1 : 1;
|
|
1447
|
+
const p0 = [p.cx, p.cy + sign * p.r];
|
|
1448
|
+
const p3 = [c.cx, c.cy - sign * c.r];
|
|
1449
|
+
const mid = (p3[1] - p0[1]) * 0.5;
|
|
1450
|
+
return [p0, ...cubic(p0, [p0[0], p0[1] + mid], [p3[0], p3[1] - mid], p3)];
|
|
1451
|
+
}
|
|
1452
|
+
function layoutGit(diagram) {
|
|
1453
|
+
const { margin, gap, box: B, region: R, git: G, carrier: C } = LOOK;
|
|
1454
|
+
const walked = walk(diagram);
|
|
1455
|
+
const notes = new Map((diagram.git?.branches ?? []).map((b) => [b.id, b.note]));
|
|
1456
|
+
const laneIndex = new Map(walked.branches.map((id, i) => [id, i]));
|
|
1457
|
+
const colorOf2 = (branch) => G.colors[(laneIndex.get(branch) ?? 0) % G.colors.length];
|
|
1458
|
+
const col = /* @__PURE__ */ new Map();
|
|
1459
|
+
const laneLast = /* @__PURE__ */ new Map();
|
|
1460
|
+
for (const c of walked.made) {
|
|
1461
|
+
const k = Math.max(0, ...c.parents.map((p) => (col.get(p) ?? -1) + 1), (laneLast.get(c.branch) ?? -1) + 1);
|
|
1462
|
+
col.set(c.id, k);
|
|
1463
|
+
laneLast.set(c.branch, k);
|
|
1464
|
+
}
|
|
1465
|
+
const linesOf = (c) => [
|
|
1466
|
+
...c.hash !== void 0 ? [{ text: c.hash, style: TYPE.gitHash }] : [],
|
|
1467
|
+
...c.note !== void 0 ? [{ text: c.note, style: TYPE.gitNote }] : []
|
|
1468
|
+
];
|
|
1469
|
+
const textW = (c) => Math.max(0, ...linesOf(c).map((line) => textWidth(line.text, line.style)));
|
|
1470
|
+
const tagW = (ref) => textWidth(ref, hasWide(ref) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
|
|
1471
|
+
const refWidth = Math.max(0, ...walked.refs.map((r) => tagW(r.name)));
|
|
1472
|
+
const pitch = Math.max(G.pitch, ...walked.made.map((c) => textW(c) + G.textGap), refWidth + G.textGap);
|
|
1473
|
+
const headers = walked.branches.map((id) => ({ w: Math.max(R.icon, textWidth(id, TYPE.regionName), textWidth(notes.get(id) ?? "", TYPE.regionNote)) }));
|
|
1474
|
+
const headerRight = margin + R.inset + Math.max(0, ...headers.map((h) => h.w));
|
|
1475
|
+
const firstHalf = Math.max(G.r, ...walked.made.filter((c) => col.get(c.id) === 0 && laneIndex.get(c.branch) === 0).map((c) => textW(c) / 2), refWidth / 2);
|
|
1476
|
+
const x0 = Math.max(G.x0, headerRight + gap + firstHalf);
|
|
1477
|
+
const named = new Set(
|
|
1478
|
+
walked.moves.flatMap((mv) => {
|
|
1479
|
+
const source = diagram.steps[mv.step]?.events[mv.event];
|
|
1480
|
+
return mv.line && mv.to && source?.type === "edge" && source.label !== void 0 ? [walked.made.find((c) => c.id === mv.to?.commit)?.branch ?? ""] : [];
|
|
1481
|
+
})
|
|
1482
|
+
);
|
|
1483
|
+
const extraRows = (branch) => Math.max(0, ...walked.made.filter((c) => c.branch === branch).map((c) => (walked.rows.get(c.id) ?? 0) - 2)) * G.row;
|
|
1484
|
+
const topText = walked.made.some((c) => laneIndex.get(c.branch) === 0 && linesOf(c).length > 0);
|
|
1485
|
+
const lanes = [];
|
|
1486
|
+
let y = margin;
|
|
1487
|
+
walked.branches.forEach((id, i) => {
|
|
1488
|
+
const top = i === 0;
|
|
1489
|
+
const tagBase = top && topText ? G.tagTop : G.tag;
|
|
1490
|
+
const line = y + (top ? G.topLine - (G.tagTop - tagBase) : G.line) + extraRows(id);
|
|
1491
|
+
const h = line - y + (top ? G.topBelow : named.has(id) ? G.below : G.bare);
|
|
1492
|
+
lanes.push({ id, x: margin, y, w: 0, h, line, color: colorOf2(id), tagBase });
|
|
1493
|
+
y += h + R.gap;
|
|
1494
|
+
});
|
|
1495
|
+
const lanesBottom = y - R.gap;
|
|
1496
|
+
const laneOf = new Map(lanes.map((l) => [l.id, l]));
|
|
1497
|
+
const commits = walked.made.map((c) => {
|
|
1498
|
+
const lane = laneOf.get(c.branch);
|
|
1499
|
+
const isTop = laneIndex.get(c.branch) === 0;
|
|
1500
|
+
const cx = x0 + pitch * (col.get(c.id) ?? 0) + (isTop ? 0 : pitch / 2);
|
|
1501
|
+
const cy = lane.line;
|
|
1502
|
+
const lines = linesOf(c);
|
|
1503
|
+
const baselines = lines.map((_, k) => isTop ? cy - G.above - (lines.length - 1 - k) * G.lineStep : cy + G.under + k * G.lineStep);
|
|
1504
|
+
const boxes2 = lines.map((line, k) => textBox(line.text, cx, baselines[k], line.style, "middle"));
|
|
1505
|
+
const text2 = boxes2.length === 0 ? void 0 : { ...union(boxes2), lines: lines.map((line) => line.text), baselines };
|
|
1506
|
+
const color = c.copy !== void 0 ? colorOf2(walked.made.find((m) => m.id === c.copy)?.branch ?? c.branch) : colorOf2(c.branch);
|
|
1507
|
+
return {
|
|
1508
|
+
id: c.id,
|
|
1509
|
+
branch: c.branch,
|
|
1510
|
+
color,
|
|
1511
|
+
cx,
|
|
1512
|
+
cy,
|
|
1513
|
+
r: G.r,
|
|
1514
|
+
step: c.step,
|
|
1515
|
+
event: c.event,
|
|
1516
|
+
parents: c.parents,
|
|
1517
|
+
...c.copy !== void 0 ? { copy: c.copy } : {},
|
|
1518
|
+
...c.hash !== void 0 ? { hash: c.hash } : {},
|
|
1519
|
+
...c.note !== void 0 ? { note: c.note } : {},
|
|
1520
|
+
...text2 ? { text: text2 } : {},
|
|
1521
|
+
...c.orphan ? { orphan: c.orphan.step, orphanEvent: c.orphan.event } : {}
|
|
1522
|
+
};
|
|
1523
|
+
});
|
|
1524
|
+
const placed = new Map(commits.map((c) => [c.id, c]));
|
|
1525
|
+
const links = walked.links.flatMap((l) => {
|
|
1526
|
+
const from = placed.get(l.from);
|
|
1527
|
+
if (!from) return [];
|
|
1528
|
+
if (l.kind === "branch") {
|
|
1529
|
+
if (!walked.made.some((c) => c.branch === l.to)) return [];
|
|
1530
|
+
const lane = laneOf.get(l.to);
|
|
1531
|
+
return [{ ...l, points: fork(from, from.cx + G.turn, lane.line), color: colorOf2(l.to) }];
|
|
1532
|
+
}
|
|
1533
|
+
const to = placed.get(l.to);
|
|
1534
|
+
const made = walked.made.find((m) => m.id === l.to);
|
|
1535
|
+
let points;
|
|
1536
|
+
if (l.kind === "copy") points = copyLine(from, to);
|
|
1537
|
+
else if (Math.abs(from.cy - to.cy) < 0.5) points = [[from.cx + from.r, from.cy], [to.cx - to.r, to.cy]];
|
|
1538
|
+
else if (made?.joined === l.from) points = join(from, to);
|
|
1539
|
+
else points = fork(from, to.cx - to.r, to.cy);
|
|
1540
|
+
return [{ ...l, points, color: to.color }];
|
|
1541
|
+
});
|
|
1542
|
+
const tagRect = (ref, slot) => {
|
|
1543
|
+
const c = placed.get(slot.commit);
|
|
1544
|
+
const base = laneOf.get(c.branch)?.tagBase ?? G.tag;
|
|
1545
|
+
const w = tagW(ref);
|
|
1546
|
+
return { x: c.cx - w / 2, y: c.cy - base - slot.row * G.row - C.tagH / 2, w, h: C.tagH };
|
|
1547
|
+
};
|
|
1548
|
+
const center2 = (r) => [r.x + r.w / 2, r.y + r.h / 2];
|
|
1549
|
+
const moves = walked.moves.map((m) => {
|
|
1550
|
+
const from = m.from ? tagRect(m.ref, m.from) : void 0;
|
|
1551
|
+
const to = m.to ? tagRect(m.ref, m.to) : void 0;
|
|
1552
|
+
const source = diagram.steps[m.step]?.events[m.event];
|
|
1553
|
+
const carried = m.line && source?.type === "edge" && source.carry.kind !== "none" && !(source.carry.kind === "tag" && source.carry.text === source.from);
|
|
1554
|
+
return {
|
|
1555
|
+
ref: m.ref,
|
|
1556
|
+
step: m.step,
|
|
1557
|
+
event: m.event,
|
|
1558
|
+
...from ? { from } : {},
|
|
1559
|
+
...to ? { to } : {},
|
|
1560
|
+
...m.to ? { target: m.to.commit } : {},
|
|
1561
|
+
...carried ? { carried: true } : {},
|
|
1562
|
+
...m.line && from && to ? { line: elbow(center2(from), center2(to)) } : {},
|
|
1563
|
+
color: "slate"
|
|
1564
|
+
};
|
|
1565
|
+
});
|
|
1566
|
+
const tags = walked.tags.map((t) => ({ ...tagRect(t.ref, t.slot), ref: t.ref, step: t.step }));
|
|
1567
|
+
const colors = boxColors(diagram);
|
|
1568
|
+
const right = Math.max(
|
|
1569
|
+
x0,
|
|
1570
|
+
...commits.flatMap((c) => [c.cx + c.r, ...c.text ? [c.text.x + c.text.w] : []]),
|
|
1571
|
+
...tags.map((t) => t.x + t.w),
|
|
1572
|
+
...moves.flatMap((m) => [m.from, m.to].flatMap((r) => r ? [r.x + r.w] : []))
|
|
1573
|
+
);
|
|
1574
|
+
const boxX = right + G.boxGap;
|
|
1575
|
+
const firstCy = (lanes[1] ?? lanes[0])?.line ?? margin + B.h / 2;
|
|
1576
|
+
const boxes = diagram.boxes.map((b, i) => {
|
|
1577
|
+
const w = boxWidth(diagram, b.id, true);
|
|
1578
|
+
const cy = firstCy + i * (B.h + gap);
|
|
1579
|
+
return {
|
|
1580
|
+
id: b.id,
|
|
1581
|
+
name: b.name,
|
|
1582
|
+
...b.sub !== void 0 ? { sub: b.sub } : {},
|
|
1583
|
+
...b.icon !== void 0 ? { icon: b.icon } : {},
|
|
1584
|
+
color: colors.get(b.id) ?? "slate",
|
|
1585
|
+
x: boxX,
|
|
1586
|
+
y: cy - B.h / 2,
|
|
1587
|
+
w,
|
|
1588
|
+
h: B.h,
|
|
1589
|
+
cx: boxX + w / 2,
|
|
1590
|
+
cy
|
|
1591
|
+
};
|
|
1592
|
+
});
|
|
1593
|
+
const regions = lanes.map((lane, i) => {
|
|
1594
|
+
const note = notes.get(lane.id);
|
|
1595
|
+
return {
|
|
1596
|
+
id: lane.id,
|
|
1597
|
+
lines: [lane.id],
|
|
1598
|
+
...note !== void 0 ? { note } : {},
|
|
1599
|
+
icon: "branch",
|
|
1600
|
+
color: lane.color,
|
|
1601
|
+
x: lane.x,
|
|
1602
|
+
y: lane.y,
|
|
1603
|
+
w: 0,
|
|
1604
|
+
h: lane.h,
|
|
1605
|
+
header: { x: lane.x + R.inset, y: lane.y + R.inset, w: headers[i]?.w ?? 0, h: R.nameY - R.inset + (note !== void 0 ? R.line : 0) + gap / 2 }
|
|
1606
|
+
};
|
|
1607
|
+
});
|
|
1608
|
+
const layout = {
|
|
1609
|
+
kind: "git",
|
|
1610
|
+
width: 0,
|
|
1611
|
+
height: 0,
|
|
1612
|
+
regions,
|
|
1613
|
+
boxes,
|
|
1614
|
+
lifelines: [],
|
|
1615
|
+
edges: [],
|
|
1616
|
+
labels: [],
|
|
1617
|
+
actions: [],
|
|
1618
|
+
badges: [],
|
|
1619
|
+
paths: [],
|
|
1620
|
+
ends: [],
|
|
1621
|
+
lanes,
|
|
1622
|
+
commits,
|
|
1623
|
+
links,
|
|
1624
|
+
tags,
|
|
1625
|
+
refs: walked.refs,
|
|
1626
|
+
moves
|
|
1627
|
+
};
|
|
1628
|
+
layout.badges = badgesOf(diagram, layout);
|
|
1629
|
+
layout.labels = labelsOf(diagram, layout);
|
|
1630
|
+
const contentRight = Math.max(right, ...boxes.map((b) => b.x + b.w), ...layout.labels.map((l) => l.x + l.w)) + R.pad;
|
|
1631
|
+
const width = Math.max(contentRight + margin, stripNeed(diagram) + margin * 2);
|
|
1632
|
+
for (const region of regions) region.w = width - margin * 2;
|
|
1633
|
+
for (const lane of lanes) lane.w = width - margin * 2;
|
|
1634
|
+
const bottom = Math.max(lanesBottom, ...boxes.map((b) => b.y + b.h), ...layout.labels.map((l) => l.y + l.h));
|
|
1635
|
+
const strip2 = layoutStrip(diagram, margin, bottom + gap, width - margin * 2);
|
|
1636
|
+
layout.width = width;
|
|
1637
|
+
layout.height = (strip2 ? strip2.y + strip2.h : bottom) + margin;
|
|
1638
|
+
if (strip2) layout.strip = strip2;
|
|
1639
|
+
layout.badges = badgesOf(diagram, layout);
|
|
1640
|
+
return layout;
|
|
1641
|
+
}
|
|
1642
|
+
function union(rects) {
|
|
1643
|
+
const x = Math.min(...rects.map((r) => r.x));
|
|
1644
|
+
const y = Math.min(...rects.map((r) => r.y));
|
|
1645
|
+
return { x, y, w: Math.max(...rects.map((r) => r.x + r.w)) - x, h: Math.max(...rects.map((r) => r.y + r.h)) - y };
|
|
1646
|
+
}
|
|
1647
|
+
function firstMark(layout, step) {
|
|
1648
|
+
const marks = [
|
|
1649
|
+
...layout.links.filter((l) => l.step === step && l.kind !== "copy").map((l) => ({ event: l.event, points: l.points, color: l.color })),
|
|
1650
|
+
...layout.moves.flatMap((m) => {
|
|
1651
|
+
const target = layout.commits.find((c) => c.id === m.target);
|
|
1652
|
+
return m.step === step && m.line && target ? [{ event: m.event, target, color: target.color }] : [];
|
|
1653
|
+
})
|
|
1654
|
+
].sort((a, b) => a.event - b.event);
|
|
1655
|
+
return marks[0];
|
|
1656
|
+
}
|
|
1657
|
+
function besideCommit(c, taken, avoid) {
|
|
1658
|
+
const { r, inset } = LOOK.badge;
|
|
1659
|
+
const d = c.r + inset + r;
|
|
1660
|
+
const apart = r * 2 + inset;
|
|
1661
|
+
const spots = [
|
|
1662
|
+
[c.cx + d, c.cy],
|
|
1663
|
+
[c.cx, c.cy + d],
|
|
1664
|
+
[c.cx - d, c.cy],
|
|
1665
|
+
[c.cx, c.cy - d]
|
|
1666
|
+
];
|
|
1667
|
+
return spots.find((p) => taken.every(([x, y]) => Math.hypot(p[0] - x, p[1] - y) >= apart) && avoid.every((a) => gapBetween(badgeRect(p), a) >= LOOK.label.touch));
|
|
1668
|
+
}
|
|
1669
|
+
function clearOnPath(points, taken, avoid) {
|
|
1670
|
+
const { r, inset, along: start, short } = LOOK.badge;
|
|
1671
|
+
const length = pathLength(points);
|
|
1672
|
+
const first = length < short ? Math.min(r + 1, length / 2) : start;
|
|
1673
|
+
const apart = r * 2 + inset;
|
|
1674
|
+
for (let d = first; d <= length; d += 1) {
|
|
1675
|
+
const p = along(points, d);
|
|
1676
|
+
const rect = badgeRect(p);
|
|
1677
|
+
if (taken.every(([x, y]) => Math.hypot(p[0] - x, p[1] - y) >= apart) && avoid.every((a) => gapBetween(rect, a) >= LOOK.label.touch)) return p;
|
|
1678
|
+
}
|
|
1679
|
+
return void 0;
|
|
1680
|
+
}
|
|
1681
|
+
function badgesOf(diagram, layout) {
|
|
1682
|
+
const { inset } = LOOK.badge;
|
|
1683
|
+
const taken = [];
|
|
1684
|
+
const all = [...layout.links.map((l) => l.points), ...layout.moves.flatMap((m) => m.line ? [m.line] : [])];
|
|
1685
|
+
const out = [];
|
|
1686
|
+
const avoid = [
|
|
1687
|
+
...layout.tags,
|
|
1688
|
+
...layout.commits.flatMap((c) => [{ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }, ...c.text ? [c.text] : []])
|
|
1689
|
+
];
|
|
1690
|
+
diagram.steps.forEach((step, s) => {
|
|
1691
|
+
const mark = firstMark(layout, s);
|
|
1692
|
+
const near = mark?.target ? besideCommit(mark.target, taken, avoid) : void 0;
|
|
1693
|
+
if (mark && (mark.points || near)) {
|
|
1694
|
+
const points = mark.points;
|
|
1695
|
+
const point = near ?? (points ? clearOnPath(points, taken, avoid) ?? badgeOnPath(points, taken, all.filter((p) => p !== points)) : [0, 0]);
|
|
1696
|
+
taken.push(point);
|
|
1697
|
+
out.push({ step: s, x: point[0], y: point[1], color: mark.color });
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
const box = step.events.flatMap((e) => e.type === "swap" || e.type === "action" ? [e.box] : []).map((id) => layout.boxes.find((b) => b.id === id))[0];
|
|
1701
|
+
if (box) {
|
|
1702
|
+
out.push({ step: s, x: box.x, y: box.y, color: box.color });
|
|
1703
|
+
return;
|
|
1704
|
+
}
|
|
1705
|
+
if (layout.strip && step.events.some((e) => e.type === "strip")) {
|
|
1706
|
+
out.push({ step: s, x: layout.strip.x + inset, y: layout.strip.y + inset, color: "slate" });
|
|
1707
|
+
return;
|
|
1708
|
+
}
|
|
1709
|
+
const tip = layout.commits.find((c) => c.id === layout.refs[0]?.at[s]);
|
|
1710
|
+
const spot = tip ? besideCommit(tip, taken, avoid) : void 0;
|
|
1711
|
+
if (tip && spot) {
|
|
1712
|
+
taken.push(spot);
|
|
1713
|
+
out.push({ step: s, x: spot[0], y: spot[1], color: tip.color });
|
|
1714
|
+
return;
|
|
1715
|
+
}
|
|
1716
|
+
const before = out[out.length - 1];
|
|
1717
|
+
const lane = layout.lanes[0];
|
|
1718
|
+
out.push(before ? { ...before, step: s } : { step: s, x: (lane?.x ?? 0) + (lane?.w ?? 0) - inset - LOOK.badge.r, y: (lane?.y ?? 0) + inset + LOOK.badge.r, color: lane?.color ?? "slate" });
|
|
1719
|
+
});
|
|
1720
|
+
return replaceSameSpot(out);
|
|
1721
|
+
}
|
|
1722
|
+
function labelsOf(diagram, layout) {
|
|
1723
|
+
const G = LOOK.git;
|
|
1724
|
+
const labels = [];
|
|
1725
|
+
const circles = layout.commits.map((c) => ({ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }));
|
|
1726
|
+
const texts = layout.commits.flatMap((c) => c.text ? [c.text] : []);
|
|
1727
|
+
const headers = layout.regions.map((r) => r.header);
|
|
1728
|
+
for (const move of layout.moves) {
|
|
1729
|
+
const source = diagram.steps[move.step]?.events[move.event];
|
|
1730
|
+
if (source?.type !== "edge" || source.label === void 0 || !move.line) continue;
|
|
1731
|
+
const target = layout.commits.find((c) => c.id === source.to);
|
|
1732
|
+
if (!target) continue;
|
|
1733
|
+
const top = layout.lanes[0]?.id === target.branch;
|
|
1734
|
+
const w = textWidth(source.label, hasWide(source.label) ? TYPE.labelJa : TYPE.label) + LOOK.label.padX * 2;
|
|
1735
|
+
const [mx] = move.line.reduce((sum, p) => [sum[0] + p[0] / move.line.length, 0], [0, 0]);
|
|
1736
|
+
const rows = Math.max(0, ...layout.tags.filter((t) => t.step === move.step && Math.abs(t.x + t.w / 2 - target.cx) < 0.5).map((t) => target.cy - t.y));
|
|
1737
|
+
const side2 = source.labelSide ?? (top ? "above" : "below");
|
|
1738
|
+
const base = source.labelSide !== void 0 ? void 0 : top ? { x: mx - w / 2, y: target.cy - Math.max(rows, (layout.lanes[0]?.tagBase ?? G.tag) + LOOK.carrier.tagH / 2) - LOOK.label.soft - LOOK.label.h } : { x: mx - w / 2, y: target.cy + G.labelUnder };
|
|
1739
|
+
const seen = layout.badges.filter((b) => b.step <= move.step).map((b) => badgeRect([b.x, b.y]));
|
|
1740
|
+
const tags = layout.tags.filter((t) => t.step === move.step);
|
|
1741
|
+
labels.push(
|
|
1742
|
+
placeLabel(
|
|
1743
|
+
{ step: move.step, event: move.event, text: source.label, points: move.line, color: move.color, side: side2, ...base ? { base } : {} },
|
|
1744
|
+
{ hard: [...circles, ...layout.boxes], soft: [...texts, ...tags, ...headers, ...labels.filter((l) => l.step === move.step)], touch: seen }
|
|
1745
|
+
)
|
|
1746
|
+
);
|
|
1747
|
+
}
|
|
1748
|
+
return labels;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1194
1751
|
// src/layout/sequence.ts
|
|
1195
1752
|
function layoutSequence(diagram) {
|
|
1196
1753
|
const { box: B, sequence: Q, label: L, margin, gap } = LOOK;
|
|
@@ -1345,31 +1902,6 @@ function badges(diagram, layout) {
|
|
|
1345
1902
|
return replaceSameSpot(placed);
|
|
1346
1903
|
}
|
|
1347
1904
|
|
|
1348
|
-
// src/words.ts
|
|
1349
|
-
var keys = (table) => Object.keys(table);
|
|
1350
|
-
var KINDS = keys({ sequence: true, architecture: true, state: true });
|
|
1351
|
-
var STATE_ENDS = ["start", "finish"];
|
|
1352
|
-
var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set"];
|
|
1353
|
-
var AS = "as";
|
|
1354
|
-
var ATTRS = {
|
|
1355
|
-
diagram: ["view"],
|
|
1356
|
-
group: ["note", "color", "icon"],
|
|
1357
|
-
box: ["note", "color", "icon"],
|
|
1358
|
-
edge: ["carry", "tag", "side"],
|
|
1359
|
-
set: ["tag"]
|
|
1360
|
-
};
|
|
1361
|
-
var CARRIES = keys({ coin: true, none: true });
|
|
1362
|
-
var VIEWS = keys({ fixed: true, follow: true });
|
|
1363
|
-
var SIDES = keys({ above: true, below: true, left: true, right: true });
|
|
1364
|
-
var OLD_HEADS = {
|
|
1365
|
-
\u6642\u7CFB\u5217\u56F3: "sequence",
|
|
1366
|
-
\u69CB\u6210\u56F3: "architecture",
|
|
1367
|
-
\u533A\u753B: "group",
|
|
1368
|
-
\u898B\u305B\u65B9: "view",
|
|
1369
|
-
region: "group",
|
|
1370
|
-
view: "view"
|
|
1371
|
-
};
|
|
1372
|
-
|
|
1373
1905
|
// src/layout/state.ts
|
|
1374
1906
|
var isEnd = (id) => STATE_ENDS.includes(id);
|
|
1375
1907
|
function visitOrder(diagram) {
|
|
@@ -1424,7 +1956,7 @@ function layoutState(diagram, lang) {
|
|
|
1424
1956
|
}
|
|
1425
1957
|
const colLeft = [];
|
|
1426
1958
|
for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
|
|
1427
|
-
const
|
|
1959
|
+
const center2 = (c) => colLeft[c] + colW[c] / 2;
|
|
1428
1960
|
const isGhost = (id) => ghosts.includes(id);
|
|
1429
1961
|
const enteringFrom = new Set(notTaken.filter((p) => isGhost(p.to) && !isGhost(p.from) && !isEnd(p.from)).map((p) => p.from));
|
|
1430
1962
|
const notes = [words.sideNote, ...enteringFrom.size > 0 ? [words.sideFrom(enteringFrom.size)] : []];
|
|
@@ -1454,7 +1986,7 @@ function layoutState(diagram, lang) {
|
|
|
1454
1986
|
};
|
|
1455
1987
|
const boxes = walked.map((id) => {
|
|
1456
1988
|
const s = slot.get(id);
|
|
1457
|
-
return boxOf(id,
|
|
1989
|
+
return boxOf(id, center2(s.col), rowY(s.row), false);
|
|
1458
1990
|
});
|
|
1459
1991
|
for (const box of boxes) placeSlot(box, carriedIn.get(box.id), doneSide);
|
|
1460
1992
|
const byId = new Map(boxes.map((b) => [b.id, b]));
|
|
@@ -1699,6 +2231,8 @@ var ja = {
|
|
|
1699
2231
|
const: (value) => `${value} \u306B\u3059\u308B`,
|
|
1700
2232
|
not: (allowed) => allowed ? `${allowed.field} \u306E\u6B04\u306F kind \u304C ${allowed.kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B` : "\u3053\u306E\u6B04\u306E\u7D44\u307F\u5408\u308F\u305B\u306F\u66F8\u3051\u306A\u3044",
|
|
1701
2233
|
reserved: (names) => `${names.join(" \u3068 ")} \u306F\u72B6\u614B\u9077\u79FB\u56F3\u306E\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u3067\u3001\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,
|
|
2234
|
+
kindOnly: (types, kind) => `${types.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,
|
|
2235
|
+
hex: (min, max) => `0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${min} \u304B\u3089 ${max} \u5B57\u306B\u3059\u308B`,
|
|
1702
2236
|
anyOf: (fields) => fields.length > 0 ? `${fields.join(" \u304B ")} \u306E${fields.length === 2 ? "\u3069\u3061\u3089\u304B" : "\u3069\u308C\u304B"}\u306E\u6B04\u304C\u8981\u308B` : "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u306B\u3082\u5408\u308F\u306A\u3044",
|
|
1703
2237
|
oneOf: "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",
|
|
1704
2238
|
discriminator: (tag, values) => `${tag} \u306F ${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
|
|
@@ -1716,6 +2250,8 @@ var en = {
|
|
|
1716
2250
|
const: (value) => `Use ${value}`,
|
|
1717
2251
|
not: (allowed) => allowed ? `The ${allowed.field} field is allowed only when kind is ${allowed.kind}` : "This combination of fields is not allowed",
|
|
1718
2252
|
reserved: (names) => `${names.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,
|
|
2253
|
+
kindOnly: (types, kind) => `${types.join(" and ")} events are allowed only when kind is ${kind}`,
|
|
2254
|
+
hex: (min, max) => `Use ${min} to ${max} characters of 0-9 and a-f`,
|
|
1719
2255
|
anyOf: (fields) => fields.length > 0 ? `Write one of the ${fields.join(" or ")} fields` : "Does not match any of the allowed shapes",
|
|
1720
2256
|
oneOf: "Match exactly one of the allowed shapes",
|
|
1721
2257
|
discriminator: (tag, values) => `${tag} is one of ${values.join(" / ")}`,
|
|
@@ -1730,10 +2266,10 @@ function ucs2length(str) {
|
|
|
1730
2266
|
return length;
|
|
1731
2267
|
}
|
|
1732
2268
|
var validate_diagram_default = validate10;
|
|
1733
|
-
var schema11 = { "properties": { "version": { "description": "\u5F62\u5F0F\u306E\u7248", "type": "integer", "minimum": 1 }, "kind": { "description": "\u56F3\u306E\u7A2E\u985E", "enum": ["sequence", "architecture", "state"] }, "title": { "$ref": "#/definitions/text" }, "view": { "description": "\u898B\u305B\u65B9\u3002\u66F8\u304B\u306A\u3051\u308C\u3070\u5B57\u306E\u5927\u304D\u3055\u3067\u9078\u3076\u3002fixed \u306F\u5168\u4F53\u3092\u6B62\u3081\u3066\u4E2D\u3060\u3051\u52D5\u304B\u3057\u3001follow \u306F\u5BC4\u3063\u3066\u52D5\u304B\u3057\u5168\u4F53\u56F3\u3067\u4ECA\u3069\u3053\u304B\u3092\u793A\u3059", "enum": ["fixed", "follow"] }, "regions": { "type": "array", "items": { "$ref": "#/definitions/region" } }, "boxes": { "type": "array", "
|
|
2269
|
+
var schema11 = { "properties": { "version": { "description": "\u5F62\u5F0F\u306E\u7248", "type": "integer", "minimum": 1 }, "kind": { "description": "\u56F3\u306E\u7A2E\u985E", "enum": ["sequence", "architecture", "state", "git"] }, "title": { "$ref": "#/definitions/text" }, "view": { "description": "\u898B\u305B\u65B9\u3002\u66F8\u304B\u306A\u3051\u308C\u3070\u5B57\u306E\u5927\u304D\u3055\u3067\u9078\u3076\u3002fixed \u306F\u5168\u4F53\u3092\u6B62\u3081\u3066\u4E2D\u3060\u3051\u52D5\u304B\u3057\u3001follow \u306F\u5BC4\u3063\u3066\u52D5\u304B\u3057\u5168\u4F53\u56F3\u3067\u4ECA\u3069\u3053\u304B\u3092\u793A\u3059", "enum": ["fixed", "follow"] }, "regions": { "type": "array", "items": { "$ref": "#/definitions/region" } }, "boxes": { "type": "array", "items": { "$ref": "#/definitions/box" } }, "strip": { "$ref": "#/definitions/strip" }, "steps": { "type": "array", "minItems": 1, "items": { "$ref": "#/definitions/step" } }, "sequence": { "$ref": "#/definitions/sequence" }, "state": { "$ref": "#/definitions/state" }, "git": { "$ref": "#/definitions/git" } }};
|
|
1734
2270
|
var func2 = Object.prototype.hasOwnProperty;
|
|
1735
2271
|
var func3 = ucs2length;
|
|
1736
|
-
var
|
|
2272
|
+
var schema28 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
|
|
1737
2273
|
var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
|
|
1738
2274
|
function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
1739
2275
|
let vErrors = null;
|
|
@@ -1837,7 +2373,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1837
2373
|
if (data.color !== void 0) {
|
|
1838
2374
|
let data3 = data.color;
|
|
1839
2375
|
if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
|
|
1840
|
-
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues:
|
|
2376
|
+
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema28.enum }, message: "must be equal to one of the allowed values" };
|
|
1841
2377
|
if (vErrors === null) {
|
|
1842
2378
|
vErrors = [err9];
|
|
1843
2379
|
} else {
|
|
@@ -1982,7 +2518,7 @@ function validate13(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1982
2518
|
if (data.color !== void 0) {
|
|
1983
2519
|
let data3 = data.color;
|
|
1984
2520
|
if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
|
|
1985
|
-
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues:
|
|
2521
|
+
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues: schema28.enum }, message: "must be equal to one of the allowed values" };
|
|
1986
2522
|
if (vErrors === null) {
|
|
1987
2523
|
vErrors = [err9];
|
|
1988
2524
|
} else {
|
|
@@ -2159,8 +2695,9 @@ function validate15(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2159
2695
|
validate15.errors = vErrors;
|
|
2160
2696
|
return errors === 0;
|
|
2161
2697
|
}
|
|
2162
|
-
var
|
|
2163
|
-
var
|
|
2698
|
+
var schema44 = { "oneOf": [{ "description": "\u7DDA\u3002\u904B\u3076\u7269\u3092\u8F09\u305B\u3066\u9001\u308B\u5074\u304B\u3089\u53D7\u3051\u308B\u5074\u3078\u8D70\u308B", "type": "object", "additionalProperties": false, "required": ["type", "from", "to", "carry"], "properties": { "type": { "const": "edge" }, "from": { "$ref": "#/definitions/id" }, "to": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" }, "carry": { "$ref": "#/definitions/carry" }, "labelSide": { "description": "\u7DDA\u306E\u540D\u524D\u3092\u7F6E\u304F\u5074 (\u5BC4\u305B\u306E\u6307\u793A)", "enum": ["above", "below", "left", "right"] } } }, { "description": "\u7BB1\u306E\u4E2D\u306E\u51E6\u7406", "type": "object", "additionalProperties": false, "required": ["type", "box", "label"], "properties": { "type": { "const": "action" }, "box": { "$ref": "#/definitions/id" }, "label": { "$ref": "#/definitions/text" } } }, { "description": "\u7BB1\u306E\u4E0B\u306E\u5C0F\u3055\u306A\u5B57\u306E\u66F8\u304D\u63DB\u3048", "type": "object", "additionalProperties": false, "required": ["type", "box", "text"], "properties": { "type": { "const": "swap" }, "box": { "$ref": "#/definitions/id" }, "text": { "$ref": "#/definitions/text" } } }, { "description": "commit \u3092\u7A4D\u3080\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u7A4D\u3093\u3060\u679D\u306E\u672D\u3068\u3001\u305D\u306E\u679D\u3092\u6307\u3059 HEAD \u304C\u9032\u3080\u3002\u5F53\u3066\u76F4\u3057 (copy) \u306F\u679D\u306E\u672D\u3092\u52D5\u304B\u3055\u305A\u3001merge commit (merge) \u306F\u53D6\u308A\u8FBC\u3080\u679D\u306E\u5148\u7AEF\u3082\u89AA\u306B\u6301\u3064", "type": "object", "additionalProperties": false, "required": ["type", "id", "branch"], "properties": { "type": { "const": "commit" }, "id": { "$ref": "#/definitions/id" }, "branch": { "$ref": "#/definitions/id" }, "copy": { "$ref": "#/definitions/id" }, "merge": { "$ref": "#/definitions/id" }, "hash": { "$ref": "#/definitions/hash" }, "note": { "$ref": "#/definitions/text" } } }, { "description": "\u679D\u3092\u5207\u308B\u3002\u679D\u5206\u304B\u308C\u306E\u56F3\u3060\u3051\u304C\u66F8\u3051\u308B\u3002\u679D\u306E\u672D\u3092 from \u306E commit \u3078\u7F6E\u304D\u3001HEAD \u3092\u305D\u306E\u679D\u3078\u79FB\u3059", "type": "object", "additionalProperties": false, "required": ["type", "branch", "from"], "properties": { "type": { "const": "branch" }, "branch": { "$ref": "#/definitions/id" }, "from": { "$ref": "#/definitions/id" } } }, { "description": "\u4E2D\u8EAB\u306E\u5E2F\u306E\u6B04\u306E\u5024\u3068\u672D", "type": "object", "additionalProperties": false, "required": ["type", "field"], "anyOf": [{ "required": ["value"] }, { "required": ["tag"] }], "properties": { "type": { "const": "strip" }, "field": { "$ref": "#/definitions/text" }, "value": { "$ref": "#/definitions/text" }, "tag": { "$ref": "#/definitions/text" } } }] };
|
|
2699
|
+
var pattern11 = new RegExp("^[0-9a-f]{4,40}$", "u");
|
|
2700
|
+
var schema48 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
|
|
2164
2701
|
function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
2165
2702
|
let vErrors = null;
|
|
2166
2703
|
let errors = 0;
|
|
@@ -2287,7 +2824,7 @@ function validate19(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2287
2824
|
if (data.kind !== void 0) {
|
|
2288
2825
|
let data1 = data.kind;
|
|
2289
2826
|
if (!(data1 === "envelope" || data1 === "tag" || data1 === "coin" || data1 === "none")) {
|
|
2290
|
-
const err8 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues:
|
|
2827
|
+
const err8 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema48.properties.kind.enum }, message: "must be equal to one of the allowed values" };
|
|
2291
2828
|
if (vErrors === null) {
|
|
2292
2829
|
vErrors = [err8];
|
|
2293
2830
|
} else {
|
|
@@ -2480,7 +3017,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2480
3017
|
if (data.labelSide !== void 0) {
|
|
2481
3018
|
let data5 = data.labelSide;
|
|
2482
3019
|
if (!(data5 === "above" || data5 === "below" || data5 === "left" || data5 === "right")) {
|
|
2483
|
-
const err13 = { instancePath: instancePath + "/labelSide", schemaPath: "#/oneOf/0/properties/labelSide/enum", keyword: "enum", params: { allowedValues:
|
|
3020
|
+
const err13 = { instancePath: instancePath + "/labelSide", schemaPath: "#/oneOf/0/properties/labelSide/enum", keyword: "enum", params: { allowedValues: schema44.oneOf[0].properties.labelSide.enum }, message: "must be equal to one of the allowed values" };
|
|
2484
3021
|
if (vErrors === null) {
|
|
2485
3022
|
vErrors = [err13];
|
|
2486
3023
|
} else {
|
|
@@ -2706,13 +3243,10 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2706
3243
|
}
|
|
2707
3244
|
errors++;
|
|
2708
3245
|
}
|
|
2709
|
-
} else if (tag0 === "
|
|
2710
|
-
const _errs39 = errors;
|
|
2711
|
-
let valid15 = false;
|
|
2712
|
-
const _errs40 = errors;
|
|
3246
|
+
} else if (tag0 === "commit") {
|
|
2713
3247
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2714
|
-
if (data.
|
|
2715
|
-
const err35 = { instancePath, schemaPath: "#/oneOf/3/
|
|
3248
|
+
if (data.type === void 0) {
|
|
3249
|
+
const err35 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
2716
3250
|
if (vErrors === null) {
|
|
2717
3251
|
vErrors = [err35];
|
|
2718
3252
|
} else {
|
|
@@ -2720,76 +3254,60 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2720
3254
|
}
|
|
2721
3255
|
errors++;
|
|
2722
3256
|
}
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
valid15 = valid15 || _valid0;
|
|
2726
|
-
if (!valid15) {
|
|
2727
|
-
const _errs41 = errors;
|
|
2728
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2729
|
-
if (data.tag === void 0) {
|
|
2730
|
-
const err36 = { instancePath, schemaPath: "#/oneOf/3/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
|
|
2731
|
-
if (vErrors === null) {
|
|
2732
|
-
vErrors = [err36];
|
|
2733
|
-
} else {
|
|
2734
|
-
vErrors.push(err36);
|
|
2735
|
-
}
|
|
2736
|
-
errors++;
|
|
2737
|
-
}
|
|
2738
|
-
}
|
|
2739
|
-
var _valid0 = _errs41 === errors;
|
|
2740
|
-
valid15 = valid15 || _valid0;
|
|
2741
|
-
}
|
|
2742
|
-
if (!valid15) {
|
|
2743
|
-
const err37 = { instancePath, schemaPath: "#/oneOf/3/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
2744
|
-
if (vErrors === null) {
|
|
2745
|
-
vErrors = [err37];
|
|
2746
|
-
} else {
|
|
2747
|
-
vErrors.push(err37);
|
|
2748
|
-
}
|
|
2749
|
-
errors++;
|
|
2750
|
-
} else {
|
|
2751
|
-
errors = _errs39;
|
|
2752
|
-
if (vErrors !== null) {
|
|
2753
|
-
if (_errs39) {
|
|
2754
|
-
vErrors.length = _errs39;
|
|
2755
|
-
} else {
|
|
2756
|
-
vErrors = null;
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
}
|
|
2760
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2761
|
-
if (data.type === void 0) {
|
|
2762
|
-
const err38 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
3257
|
+
if (data.id === void 0) {
|
|
3258
|
+
const err36 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
|
|
2763
3259
|
if (vErrors === null) {
|
|
2764
|
-
vErrors = [
|
|
3260
|
+
vErrors = [err36];
|
|
2765
3261
|
} else {
|
|
2766
|
-
vErrors.push(
|
|
3262
|
+
vErrors.push(err36);
|
|
2767
3263
|
}
|
|
2768
3264
|
errors++;
|
|
2769
3265
|
}
|
|
2770
|
-
if (data.
|
|
2771
|
-
const
|
|
3266
|
+
if (data.branch === void 0) {
|
|
3267
|
+
const err37 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
|
|
2772
3268
|
if (vErrors === null) {
|
|
2773
|
-
vErrors = [
|
|
3269
|
+
vErrors = [err37];
|
|
2774
3270
|
} else {
|
|
2775
|
-
vErrors.push(
|
|
3271
|
+
vErrors.push(err37);
|
|
2776
3272
|
}
|
|
2777
3273
|
errors++;
|
|
2778
3274
|
}
|
|
2779
3275
|
for (const key3 in data) {
|
|
2780
|
-
if (!(key3 === "type" || key3 === "
|
|
2781
|
-
const
|
|
3276
|
+
if (!(key3 === "type" || key3 === "id" || key3 === "branch" || key3 === "copy" || key3 === "merge" || key3 === "hash" || key3 === "note")) {
|
|
3277
|
+
const err38 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
|
|
2782
3278
|
if (vErrors === null) {
|
|
2783
|
-
vErrors = [
|
|
3279
|
+
vErrors = [err38];
|
|
2784
3280
|
} else {
|
|
2785
|
-
vErrors.push(
|
|
3281
|
+
vErrors.push(err38);
|
|
2786
3282
|
}
|
|
2787
3283
|
errors++;
|
|
2788
3284
|
}
|
|
2789
3285
|
}
|
|
2790
3286
|
if (data.type !== void 0) {
|
|
2791
|
-
if ("
|
|
2792
|
-
const
|
|
3287
|
+
if ("commit" !== data.type) {
|
|
3288
|
+
const err39 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "commit" }, message: "must be equal to constant" };
|
|
3289
|
+
if (vErrors === null) {
|
|
3290
|
+
vErrors = [err39];
|
|
3291
|
+
} else {
|
|
3292
|
+
vErrors.push(err39);
|
|
3293
|
+
}
|
|
3294
|
+
errors++;
|
|
3295
|
+
}
|
|
3296
|
+
}
|
|
3297
|
+
if (data.id !== void 0) {
|
|
3298
|
+
let data13 = data.id;
|
|
3299
|
+
if (typeof data13 === "string") {
|
|
3300
|
+
if (!pattern0.test(data13)) {
|
|
3301
|
+
const err40 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
3302
|
+
if (vErrors === null) {
|
|
3303
|
+
vErrors = [err40];
|
|
3304
|
+
} else {
|
|
3305
|
+
vErrors.push(err40);
|
|
3306
|
+
}
|
|
3307
|
+
errors++;
|
|
3308
|
+
}
|
|
3309
|
+
} else {
|
|
3310
|
+
const err41 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2793
3311
|
if (vErrors === null) {
|
|
2794
3312
|
vErrors = [err41];
|
|
2795
3313
|
} else {
|
|
@@ -2798,11 +3316,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2798
3316
|
errors++;
|
|
2799
3317
|
}
|
|
2800
3318
|
}
|
|
2801
|
-
if (data.
|
|
2802
|
-
let
|
|
2803
|
-
if (typeof
|
|
2804
|
-
if (
|
|
2805
|
-
const err42 = { instancePath: instancePath + "/
|
|
3319
|
+
if (data.branch !== void 0) {
|
|
3320
|
+
let data14 = data.branch;
|
|
3321
|
+
if (typeof data14 === "string") {
|
|
3322
|
+
if (!pattern0.test(data14)) {
|
|
3323
|
+
const err42 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2806
3324
|
if (vErrors === null) {
|
|
2807
3325
|
vErrors = [err42];
|
|
2808
3326
|
} else {
|
|
@@ -2811,7 +3329,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2811
3329
|
errors++;
|
|
2812
3330
|
}
|
|
2813
3331
|
} else {
|
|
2814
|
-
const err43 = { instancePath: instancePath + "/
|
|
3332
|
+
const err43 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2815
3333
|
if (vErrors === null) {
|
|
2816
3334
|
vErrors = [err43];
|
|
2817
3335
|
} else {
|
|
@@ -2820,11 +3338,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2820
3338
|
errors++;
|
|
2821
3339
|
}
|
|
2822
3340
|
}
|
|
2823
|
-
if (data.
|
|
2824
|
-
let
|
|
2825
|
-
if (typeof
|
|
2826
|
-
if (
|
|
2827
|
-
const err44 = { instancePath: instancePath + "/
|
|
3341
|
+
if (data.copy !== void 0) {
|
|
3342
|
+
let data15 = data.copy;
|
|
3343
|
+
if (typeof data15 === "string") {
|
|
3344
|
+
if (!pattern0.test(data15)) {
|
|
3345
|
+
const err44 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2828
3346
|
if (vErrors === null) {
|
|
2829
3347
|
vErrors = [err44];
|
|
2830
3348
|
} else {
|
|
@@ -2833,7 +3351,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2833
3351
|
errors++;
|
|
2834
3352
|
}
|
|
2835
3353
|
} else {
|
|
2836
|
-
const err45 = { instancePath: instancePath + "/
|
|
3354
|
+
const err45 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2837
3355
|
if (vErrors === null) {
|
|
2838
3356
|
vErrors = [err45];
|
|
2839
3357
|
} else {
|
|
@@ -2842,11 +3360,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2842
3360
|
errors++;
|
|
2843
3361
|
}
|
|
2844
3362
|
}
|
|
2845
|
-
if (data.
|
|
2846
|
-
let
|
|
2847
|
-
if (typeof
|
|
2848
|
-
if (
|
|
2849
|
-
const err46 = { instancePath: instancePath + "/
|
|
3363
|
+
if (data.merge !== void 0) {
|
|
3364
|
+
let data16 = data.merge;
|
|
3365
|
+
if (typeof data16 === "string") {
|
|
3366
|
+
if (!pattern0.test(data16)) {
|
|
3367
|
+
const err46 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2850
3368
|
if (vErrors === null) {
|
|
2851
3369
|
vErrors = [err46];
|
|
2852
3370
|
} else {
|
|
@@ -2855,7 +3373,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2855
3373
|
errors++;
|
|
2856
3374
|
}
|
|
2857
3375
|
} else {
|
|
2858
|
-
const err47 = { instancePath: instancePath + "/
|
|
3376
|
+
const err47 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2859
3377
|
if (vErrors === null) {
|
|
2860
3378
|
vErrors = [err47];
|
|
2861
3379
|
} else {
|
|
@@ -2864,68 +3382,383 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2864
3382
|
errors++;
|
|
2865
3383
|
}
|
|
2866
3384
|
}
|
|
3385
|
+
if (data.hash !== void 0) {
|
|
3386
|
+
let data17 = data.hash;
|
|
3387
|
+
if (typeof data17 === "string") {
|
|
3388
|
+
if (!pattern11.test(data17)) {
|
|
3389
|
+
const err48 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/pattern", keyword: "pattern", params: { pattern: "^[0-9a-f]{4,40}$" }, message: 'must match pattern "^[0-9a-f]{4,40}$"' };
|
|
3390
|
+
if (vErrors === null) {
|
|
3391
|
+
vErrors = [err48];
|
|
3392
|
+
} else {
|
|
3393
|
+
vErrors.push(err48);
|
|
3394
|
+
}
|
|
3395
|
+
errors++;
|
|
3396
|
+
}
|
|
3397
|
+
} else {
|
|
3398
|
+
const err49 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3399
|
+
if (vErrors === null) {
|
|
3400
|
+
vErrors = [err49];
|
|
3401
|
+
} else {
|
|
3402
|
+
vErrors.push(err49);
|
|
3403
|
+
}
|
|
3404
|
+
errors++;
|
|
3405
|
+
}
|
|
3406
|
+
}
|
|
3407
|
+
if (data.note !== void 0) {
|
|
3408
|
+
let data18 = data.note;
|
|
3409
|
+
if (typeof data18 === "string") {
|
|
3410
|
+
if (func3(data18) < 1) {
|
|
3411
|
+
const err50 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3412
|
+
if (vErrors === null) {
|
|
3413
|
+
vErrors = [err50];
|
|
3414
|
+
} else {
|
|
3415
|
+
vErrors.push(err50);
|
|
3416
|
+
}
|
|
3417
|
+
errors++;
|
|
3418
|
+
}
|
|
3419
|
+
} else {
|
|
3420
|
+
const err51 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3421
|
+
if (vErrors === null) {
|
|
3422
|
+
vErrors = [err51];
|
|
3423
|
+
} else {
|
|
3424
|
+
vErrors.push(err51);
|
|
3425
|
+
}
|
|
3426
|
+
errors++;
|
|
3427
|
+
}
|
|
3428
|
+
}
|
|
2867
3429
|
} else {
|
|
2868
|
-
const
|
|
3430
|
+
const err52 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2869
3431
|
if (vErrors === null) {
|
|
2870
|
-
vErrors = [
|
|
3432
|
+
vErrors = [err52];
|
|
2871
3433
|
} else {
|
|
2872
|
-
vErrors.push(
|
|
3434
|
+
vErrors.push(err52);
|
|
2873
3435
|
}
|
|
2874
3436
|
errors++;
|
|
2875
3437
|
}
|
|
2876
|
-
} else {
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
3438
|
+
} else if (tag0 === "branch") {
|
|
3439
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3440
|
+
if (data.type === void 0) {
|
|
3441
|
+
const err53 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
3442
|
+
if (vErrors === null) {
|
|
3443
|
+
vErrors = [err53];
|
|
3444
|
+
} else {
|
|
3445
|
+
vErrors.push(err53);
|
|
3446
|
+
}
|
|
3447
|
+
errors++;
|
|
3448
|
+
}
|
|
3449
|
+
if (data.branch === void 0) {
|
|
3450
|
+
const err54 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
|
|
3451
|
+
if (vErrors === null) {
|
|
3452
|
+
vErrors = [err54];
|
|
3453
|
+
} else {
|
|
3454
|
+
vErrors.push(err54);
|
|
3455
|
+
}
|
|
3456
|
+
errors++;
|
|
3457
|
+
}
|
|
3458
|
+
if (data.from === void 0) {
|
|
3459
|
+
const err55 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
|
|
3460
|
+
if (vErrors === null) {
|
|
3461
|
+
vErrors = [err55];
|
|
3462
|
+
} else {
|
|
3463
|
+
vErrors.push(err55);
|
|
3464
|
+
}
|
|
3465
|
+
errors++;
|
|
3466
|
+
}
|
|
3467
|
+
for (const key4 in data) {
|
|
3468
|
+
if (!(key4 === "type" || key4 === "branch" || key4 === "from")) {
|
|
3469
|
+
const err56 = { instancePath, schemaPath: "#/oneOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
|
|
3470
|
+
if (vErrors === null) {
|
|
3471
|
+
vErrors = [err56];
|
|
3472
|
+
} else {
|
|
3473
|
+
vErrors.push(err56);
|
|
3474
|
+
}
|
|
3475
|
+
errors++;
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
if (data.type !== void 0) {
|
|
3479
|
+
if ("branch" !== data.type) {
|
|
3480
|
+
const err57 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/4/properties/type/const", keyword: "const", params: { allowedValue: "branch" }, message: "must be equal to constant" };
|
|
3481
|
+
if (vErrors === null) {
|
|
3482
|
+
vErrors = [err57];
|
|
3483
|
+
} else {
|
|
3484
|
+
vErrors.push(err57);
|
|
3485
|
+
}
|
|
3486
|
+
errors++;
|
|
3487
|
+
}
|
|
3488
|
+
}
|
|
3489
|
+
if (data.branch !== void 0) {
|
|
3490
|
+
let data20 = data.branch;
|
|
3491
|
+
if (typeof data20 === "string") {
|
|
3492
|
+
if (!pattern0.test(data20)) {
|
|
3493
|
+
const err58 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
3494
|
+
if (vErrors === null) {
|
|
3495
|
+
vErrors = [err58];
|
|
3496
|
+
} else {
|
|
3497
|
+
vErrors.push(err58);
|
|
3498
|
+
}
|
|
3499
|
+
errors++;
|
|
3500
|
+
}
|
|
3501
|
+
} else {
|
|
3502
|
+
const err59 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3503
|
+
if (vErrors === null) {
|
|
3504
|
+
vErrors = [err59];
|
|
3505
|
+
} else {
|
|
3506
|
+
vErrors.push(err59);
|
|
3507
|
+
}
|
|
3508
|
+
errors++;
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3511
|
+
if (data.from !== void 0) {
|
|
3512
|
+
let data21 = data.from;
|
|
3513
|
+
if (typeof data21 === "string") {
|
|
3514
|
+
if (!pattern0.test(data21)) {
|
|
3515
|
+
const err60 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
3516
|
+
if (vErrors === null) {
|
|
3517
|
+
vErrors = [err60];
|
|
3518
|
+
} else {
|
|
3519
|
+
vErrors.push(err60);
|
|
3520
|
+
}
|
|
3521
|
+
errors++;
|
|
3522
|
+
}
|
|
3523
|
+
} else {
|
|
3524
|
+
const err61 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3525
|
+
if (vErrors === null) {
|
|
3526
|
+
vErrors = [err61];
|
|
3527
|
+
} else {
|
|
3528
|
+
vErrors.push(err61);
|
|
3529
|
+
}
|
|
3530
|
+
errors++;
|
|
3531
|
+
}
|
|
3532
|
+
}
|
|
3533
|
+
} else {
|
|
3534
|
+
const err62 = { instancePath, schemaPath: "#/oneOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3535
|
+
if (vErrors === null) {
|
|
3536
|
+
vErrors = [err62];
|
|
3537
|
+
} else {
|
|
3538
|
+
vErrors.push(err62);
|
|
3539
|
+
}
|
|
3540
|
+
errors++;
|
|
3541
|
+
}
|
|
3542
|
+
} else if (tag0 === "strip") {
|
|
3543
|
+
const _errs71 = errors;
|
|
3544
|
+
let valid27 = false;
|
|
3545
|
+
const _errs72 = errors;
|
|
3546
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3547
|
+
if (data.value === void 0) {
|
|
3548
|
+
const err63 = { instancePath, schemaPath: "#/oneOf/5/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
|
|
3549
|
+
if (vErrors === null) {
|
|
3550
|
+
vErrors = [err63];
|
|
3551
|
+
} else {
|
|
3552
|
+
vErrors.push(err63);
|
|
3553
|
+
}
|
|
3554
|
+
errors++;
|
|
3555
|
+
}
|
|
3556
|
+
}
|
|
3557
|
+
var _valid0 = _errs72 === errors;
|
|
3558
|
+
valid27 = valid27 || _valid0;
|
|
3559
|
+
if (!valid27) {
|
|
3560
|
+
const _errs73 = errors;
|
|
3561
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3562
|
+
if (data.tag === void 0) {
|
|
3563
|
+
const err64 = { instancePath, schemaPath: "#/oneOf/5/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
|
|
3564
|
+
if (vErrors === null) {
|
|
3565
|
+
vErrors = [err64];
|
|
3566
|
+
} else {
|
|
3567
|
+
vErrors.push(err64);
|
|
3568
|
+
}
|
|
3569
|
+
errors++;
|
|
3570
|
+
}
|
|
3571
|
+
}
|
|
3572
|
+
var _valid0 = _errs73 === errors;
|
|
3573
|
+
valid27 = valid27 || _valid0;
|
|
3574
|
+
}
|
|
3575
|
+
if (!valid27) {
|
|
3576
|
+
const err65 = { instancePath, schemaPath: "#/oneOf/5/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
3577
|
+
if (vErrors === null) {
|
|
3578
|
+
vErrors = [err65];
|
|
3579
|
+
} else {
|
|
3580
|
+
vErrors.push(err65);
|
|
3581
|
+
}
|
|
3582
|
+
errors++;
|
|
3583
|
+
} else {
|
|
3584
|
+
errors = _errs71;
|
|
3585
|
+
if (vErrors !== null) {
|
|
3586
|
+
if (_errs71) {
|
|
3587
|
+
vErrors.length = _errs71;
|
|
3588
|
+
} else {
|
|
3589
|
+
vErrors = null;
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
}
|
|
3593
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3594
|
+
if (data.type === void 0) {
|
|
3595
|
+
const err66 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
3596
|
+
if (vErrors === null) {
|
|
3597
|
+
vErrors = [err66];
|
|
3598
|
+
} else {
|
|
3599
|
+
vErrors.push(err66);
|
|
3600
|
+
}
|
|
3601
|
+
errors++;
|
|
3602
|
+
}
|
|
3603
|
+
if (data.field === void 0) {
|
|
3604
|
+
const err67 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
|
|
3605
|
+
if (vErrors === null) {
|
|
3606
|
+
vErrors = [err67];
|
|
3607
|
+
} else {
|
|
3608
|
+
vErrors.push(err67);
|
|
3609
|
+
}
|
|
3610
|
+
errors++;
|
|
3611
|
+
}
|
|
3612
|
+
for (const key5 in data) {
|
|
3613
|
+
if (!(key5 === "type" || key5 === "field" || key5 === "value" || key5 === "tag")) {
|
|
3614
|
+
const err68 = { instancePath, schemaPath: "#/oneOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
|
|
3615
|
+
if (vErrors === null) {
|
|
3616
|
+
vErrors = [err68];
|
|
3617
|
+
} else {
|
|
3618
|
+
vErrors.push(err68);
|
|
3619
|
+
}
|
|
3620
|
+
errors++;
|
|
3621
|
+
}
|
|
3622
|
+
}
|
|
3623
|
+
if (data.type !== void 0) {
|
|
3624
|
+
if ("strip" !== data.type) {
|
|
3625
|
+
const err69 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/5/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
|
|
3626
|
+
if (vErrors === null) {
|
|
3627
|
+
vErrors = [err69];
|
|
3628
|
+
} else {
|
|
3629
|
+
vErrors.push(err69);
|
|
3630
|
+
}
|
|
3631
|
+
errors++;
|
|
3632
|
+
}
|
|
3633
|
+
}
|
|
3634
|
+
if (data.field !== void 0) {
|
|
3635
|
+
let data23 = data.field;
|
|
3636
|
+
if (typeof data23 === "string") {
|
|
3637
|
+
if (func3(data23) < 1) {
|
|
3638
|
+
const err70 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3639
|
+
if (vErrors === null) {
|
|
3640
|
+
vErrors = [err70];
|
|
3641
|
+
} else {
|
|
3642
|
+
vErrors.push(err70);
|
|
3643
|
+
}
|
|
3644
|
+
errors++;
|
|
3645
|
+
}
|
|
3646
|
+
} else {
|
|
3647
|
+
const err71 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3648
|
+
if (vErrors === null) {
|
|
3649
|
+
vErrors = [err71];
|
|
3650
|
+
} else {
|
|
3651
|
+
vErrors.push(err71);
|
|
3652
|
+
}
|
|
3653
|
+
errors++;
|
|
3654
|
+
}
|
|
3655
|
+
}
|
|
3656
|
+
if (data.value !== void 0) {
|
|
3657
|
+
let data24 = data.value;
|
|
3658
|
+
if (typeof data24 === "string") {
|
|
3659
|
+
if (func3(data24) < 1) {
|
|
3660
|
+
const err72 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3661
|
+
if (vErrors === null) {
|
|
3662
|
+
vErrors = [err72];
|
|
3663
|
+
} else {
|
|
3664
|
+
vErrors.push(err72);
|
|
3665
|
+
}
|
|
3666
|
+
errors++;
|
|
3667
|
+
}
|
|
3668
|
+
} else {
|
|
3669
|
+
const err73 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3670
|
+
if (vErrors === null) {
|
|
3671
|
+
vErrors = [err73];
|
|
3672
|
+
} else {
|
|
3673
|
+
vErrors.push(err73);
|
|
3674
|
+
}
|
|
3675
|
+
errors++;
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
if (data.tag !== void 0) {
|
|
3679
|
+
let data25 = data.tag;
|
|
3680
|
+
if (typeof data25 === "string") {
|
|
3681
|
+
if (func3(data25) < 1) {
|
|
3682
|
+
const err74 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3683
|
+
if (vErrors === null) {
|
|
3684
|
+
vErrors = [err74];
|
|
3685
|
+
} else {
|
|
3686
|
+
vErrors.push(err74);
|
|
3687
|
+
}
|
|
3688
|
+
errors++;
|
|
3689
|
+
}
|
|
3690
|
+
} else {
|
|
3691
|
+
const err75 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3692
|
+
if (vErrors === null) {
|
|
3693
|
+
vErrors = [err75];
|
|
3694
|
+
} else {
|
|
3695
|
+
vErrors.push(err75);
|
|
3696
|
+
}
|
|
3697
|
+
errors++;
|
|
3698
|
+
}
|
|
3699
|
+
}
|
|
3700
|
+
} else {
|
|
3701
|
+
const err76 = { instancePath, schemaPath: "#/oneOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3702
|
+
if (vErrors === null) {
|
|
3703
|
+
vErrors = [err76];
|
|
3704
|
+
} else {
|
|
3705
|
+
vErrors.push(err76);
|
|
3706
|
+
}
|
|
3707
|
+
errors++;
|
|
3708
|
+
}
|
|
3709
|
+
} else {
|
|
3710
|
+
const err77 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
|
|
3711
|
+
if (vErrors === null) {
|
|
3712
|
+
vErrors = [err77];
|
|
3713
|
+
} else {
|
|
3714
|
+
vErrors.push(err77);
|
|
3715
|
+
}
|
|
3716
|
+
errors++;
|
|
3717
|
+
}
|
|
3718
|
+
} else {
|
|
3719
|
+
const err78 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
|
|
3720
|
+
if (vErrors === null) {
|
|
3721
|
+
vErrors = [err78];
|
|
3722
|
+
} else {
|
|
3723
|
+
vErrors.push(err78);
|
|
3724
|
+
}
|
|
3725
|
+
errors++;
|
|
3726
|
+
}
|
|
3727
|
+
} else {
|
|
3728
|
+
const err79 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3729
|
+
if (vErrors === null) {
|
|
3730
|
+
vErrors = [err79];
|
|
3731
|
+
} else {
|
|
3732
|
+
vErrors.push(err79);
|
|
3733
|
+
}
|
|
3734
|
+
errors++;
|
|
3735
|
+
}
|
|
3736
|
+
validate18.errors = vErrors;
|
|
3737
|
+
return errors === 0;
|
|
3738
|
+
}
|
|
3739
|
+
function validate17(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
3740
|
+
let vErrors = null;
|
|
3741
|
+
let errors = 0;
|
|
3742
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3743
|
+
if (data.title === void 0) {
|
|
3744
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
|
|
3745
|
+
if (vErrors === null) {
|
|
3746
|
+
vErrors = [err0];
|
|
3747
|
+
} else {
|
|
3748
|
+
vErrors.push(err0);
|
|
3749
|
+
}
|
|
3750
|
+
errors++;
|
|
3751
|
+
}
|
|
3752
|
+
if (data.body === void 0) {
|
|
3753
|
+
const err1 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "body" }, message: "must have required property 'body'" };
|
|
3754
|
+
if (vErrors === null) {
|
|
3755
|
+
vErrors = [err1];
|
|
3756
|
+
} else {
|
|
3757
|
+
vErrors.push(err1);
|
|
3758
|
+
}
|
|
3759
|
+
errors++;
|
|
3760
|
+
}
|
|
3761
|
+
if (data.events === void 0) {
|
|
2929
3762
|
const err2 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "events" }, message: "must have required property 'events'" };
|
|
2930
3763
|
if (vErrors === null) {
|
|
2931
3764
|
vErrors = [err2];
|
|
@@ -3207,40 +4040,185 @@ function validate26(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3207
4040
|
if (func3(data2) < 1) {
|
|
3208
4041
|
const err7 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3209
4042
|
if (vErrors === null) {
|
|
3210
|
-
vErrors = [err7];
|
|
4043
|
+
vErrors = [err7];
|
|
4044
|
+
} else {
|
|
4045
|
+
vErrors.push(err7);
|
|
4046
|
+
}
|
|
4047
|
+
errors++;
|
|
4048
|
+
}
|
|
4049
|
+
} else {
|
|
4050
|
+
const err8 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
4051
|
+
if (vErrors === null) {
|
|
4052
|
+
vErrors = [err8];
|
|
4053
|
+
} else {
|
|
4054
|
+
vErrors.push(err8);
|
|
4055
|
+
}
|
|
4056
|
+
errors++;
|
|
4057
|
+
}
|
|
4058
|
+
}
|
|
4059
|
+
} else {
|
|
4060
|
+
const err9 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
4061
|
+
if (vErrors === null) {
|
|
4062
|
+
vErrors = [err9];
|
|
4063
|
+
} else {
|
|
4064
|
+
vErrors.push(err9);
|
|
4065
|
+
}
|
|
4066
|
+
errors++;
|
|
4067
|
+
}
|
|
4068
|
+
validate26.errors = vErrors;
|
|
4069
|
+
return errors === 0;
|
|
4070
|
+
}
|
|
4071
|
+
function validate25(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
4072
|
+
let vErrors = null;
|
|
4073
|
+
let errors = 0;
|
|
4074
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4075
|
+
if (data.paths === void 0) {
|
|
4076
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "paths" }, message: "must have required property 'paths'" };
|
|
4077
|
+
if (vErrors === null) {
|
|
4078
|
+
vErrors = [err0];
|
|
4079
|
+
} else {
|
|
4080
|
+
vErrors.push(err0);
|
|
4081
|
+
}
|
|
4082
|
+
errors++;
|
|
4083
|
+
}
|
|
4084
|
+
for (const key0 in data) {
|
|
4085
|
+
if (!(key0 === "paths")) {
|
|
4086
|
+
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
4087
|
+
if (vErrors === null) {
|
|
4088
|
+
vErrors = [err1];
|
|
4089
|
+
} else {
|
|
4090
|
+
vErrors.push(err1);
|
|
4091
|
+
}
|
|
4092
|
+
errors++;
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
4095
|
+
if (data.paths !== void 0) {
|
|
4096
|
+
let data0 = data.paths;
|
|
4097
|
+
if (Array.isArray(data0)) {
|
|
4098
|
+
if (data0.length < 1) {
|
|
4099
|
+
const err2 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4100
|
+
if (vErrors === null) {
|
|
4101
|
+
vErrors = [err2];
|
|
4102
|
+
} else {
|
|
4103
|
+
vErrors.push(err2);
|
|
4104
|
+
}
|
|
4105
|
+
errors++;
|
|
4106
|
+
}
|
|
4107
|
+
const len0 = data0.length;
|
|
4108
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
4109
|
+
if (!validate26(data0[i0], { instancePath: instancePath + "/paths/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
|
|
4110
|
+
vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);
|
|
4111
|
+
errors = vErrors.length;
|
|
4112
|
+
}
|
|
4113
|
+
}
|
|
4114
|
+
} else {
|
|
4115
|
+
const err3 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
4116
|
+
if (vErrors === null) {
|
|
4117
|
+
vErrors = [err3];
|
|
4118
|
+
} else {
|
|
4119
|
+
vErrors.push(err3);
|
|
4120
|
+
}
|
|
4121
|
+
errors++;
|
|
4122
|
+
}
|
|
4123
|
+
}
|
|
4124
|
+
} else {
|
|
4125
|
+
const err4 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
4126
|
+
if (vErrors === null) {
|
|
4127
|
+
vErrors = [err4];
|
|
4128
|
+
} else {
|
|
4129
|
+
vErrors.push(err4);
|
|
4130
|
+
}
|
|
4131
|
+
errors++;
|
|
4132
|
+
}
|
|
4133
|
+
validate25.errors = vErrors;
|
|
4134
|
+
return errors === 0;
|
|
4135
|
+
}
|
|
4136
|
+
function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
4137
|
+
let vErrors = null;
|
|
4138
|
+
let errors = 0;
|
|
4139
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4140
|
+
if (data.id === void 0) {
|
|
4141
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
|
|
4142
|
+
if (vErrors === null) {
|
|
4143
|
+
vErrors = [err0];
|
|
4144
|
+
} else {
|
|
4145
|
+
vErrors.push(err0);
|
|
4146
|
+
}
|
|
4147
|
+
errors++;
|
|
4148
|
+
}
|
|
4149
|
+
for (const key0 in data) {
|
|
4150
|
+
if (!(key0 === "id" || key0 === "note")) {
|
|
4151
|
+
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
4152
|
+
if (vErrors === null) {
|
|
4153
|
+
vErrors = [err1];
|
|
4154
|
+
} else {
|
|
4155
|
+
vErrors.push(err1);
|
|
4156
|
+
}
|
|
4157
|
+
errors++;
|
|
4158
|
+
}
|
|
4159
|
+
}
|
|
4160
|
+
if (data.id !== void 0) {
|
|
4161
|
+
let data0 = data.id;
|
|
4162
|
+
if (typeof data0 === "string") {
|
|
4163
|
+
if (!pattern0.test(data0)) {
|
|
4164
|
+
const err2 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
4165
|
+
if (vErrors === null) {
|
|
4166
|
+
vErrors = [err2];
|
|
4167
|
+
} else {
|
|
4168
|
+
vErrors.push(err2);
|
|
4169
|
+
}
|
|
4170
|
+
errors++;
|
|
4171
|
+
}
|
|
4172
|
+
} else {
|
|
4173
|
+
const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
4174
|
+
if (vErrors === null) {
|
|
4175
|
+
vErrors = [err3];
|
|
4176
|
+
} else {
|
|
4177
|
+
vErrors.push(err3);
|
|
4178
|
+
}
|
|
4179
|
+
errors++;
|
|
4180
|
+
}
|
|
4181
|
+
}
|
|
4182
|
+
if (data.note !== void 0) {
|
|
4183
|
+
let data1 = data.note;
|
|
4184
|
+
if (typeof data1 === "string") {
|
|
4185
|
+
if (func3(data1) < 1) {
|
|
4186
|
+
const err4 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
4187
|
+
if (vErrors === null) {
|
|
4188
|
+
vErrors = [err4];
|
|
3211
4189
|
} else {
|
|
3212
|
-
vErrors.push(
|
|
4190
|
+
vErrors.push(err4);
|
|
3213
4191
|
}
|
|
3214
4192
|
errors++;
|
|
3215
4193
|
}
|
|
3216
4194
|
} else {
|
|
3217
|
-
const
|
|
4195
|
+
const err5 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3218
4196
|
if (vErrors === null) {
|
|
3219
|
-
vErrors = [
|
|
4197
|
+
vErrors = [err5];
|
|
3220
4198
|
} else {
|
|
3221
|
-
vErrors.push(
|
|
4199
|
+
vErrors.push(err5);
|
|
3222
4200
|
}
|
|
3223
4201
|
errors++;
|
|
3224
4202
|
}
|
|
3225
4203
|
}
|
|
3226
4204
|
} else {
|
|
3227
|
-
const
|
|
4205
|
+
const err6 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3228
4206
|
if (vErrors === null) {
|
|
3229
|
-
vErrors = [
|
|
4207
|
+
vErrors = [err6];
|
|
3230
4208
|
} else {
|
|
3231
|
-
vErrors.push(
|
|
4209
|
+
vErrors.push(err6);
|
|
3232
4210
|
}
|
|
3233
4211
|
errors++;
|
|
3234
4212
|
}
|
|
3235
|
-
|
|
4213
|
+
validate30.errors = vErrors;
|
|
3236
4214
|
return errors === 0;
|
|
3237
4215
|
}
|
|
3238
|
-
function
|
|
4216
|
+
function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
3239
4217
|
let vErrors = null;
|
|
3240
4218
|
let errors = 0;
|
|
3241
4219
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3242
|
-
if (data.
|
|
3243
|
-
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "
|
|
4220
|
+
if (data.branches === void 0) {
|
|
4221
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "branches" }, message: "must have required property 'branches'" };
|
|
3244
4222
|
if (vErrors === null) {
|
|
3245
4223
|
vErrors = [err0];
|
|
3246
4224
|
} else {
|
|
@@ -3249,7 +4227,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3249
4227
|
errors++;
|
|
3250
4228
|
}
|
|
3251
4229
|
for (const key0 in data) {
|
|
3252
|
-
if (!(key0 === "
|
|
4230
|
+
if (!(key0 === "branches")) {
|
|
3253
4231
|
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
3254
4232
|
if (vErrors === null) {
|
|
3255
4233
|
vErrors = [err1];
|
|
@@ -3259,11 +4237,11 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3259
4237
|
errors++;
|
|
3260
4238
|
}
|
|
3261
4239
|
}
|
|
3262
|
-
if (data.
|
|
3263
|
-
let data0 = data.
|
|
4240
|
+
if (data.branches !== void 0) {
|
|
4241
|
+
let data0 = data.branches;
|
|
3264
4242
|
if (Array.isArray(data0)) {
|
|
3265
4243
|
if (data0.length < 1) {
|
|
3266
|
-
const err2 = { instancePath: instancePath + "/
|
|
4244
|
+
const err2 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
3267
4245
|
if (vErrors === null) {
|
|
3268
4246
|
vErrors = [err2];
|
|
3269
4247
|
} else {
|
|
@@ -3273,13 +4251,13 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3273
4251
|
}
|
|
3274
4252
|
const len0 = data0.length;
|
|
3275
4253
|
for (let i0 = 0; i0 < len0; i0++) {
|
|
3276
|
-
if (!
|
|
3277
|
-
vErrors = vErrors === null ?
|
|
4254
|
+
if (!validate30(data0[i0], { instancePath: instancePath + "/branches/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
|
|
4255
|
+
vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors);
|
|
3278
4256
|
errors = vErrors.length;
|
|
3279
4257
|
}
|
|
3280
4258
|
}
|
|
3281
4259
|
} else {
|
|
3282
|
-
const err3 = { instancePath: instancePath + "/
|
|
4260
|
+
const err3 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3283
4261
|
if (vErrors === null) {
|
|
3284
4262
|
vErrors = [err3];
|
|
3285
4263
|
} else {
|
|
@@ -3297,7 +4275,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3297
4275
|
}
|
|
3298
4276
|
errors++;
|
|
3299
4277
|
}
|
|
3300
|
-
|
|
4278
|
+
validate29.errors = vErrors;
|
|
3301
4279
|
return errors === 0;
|
|
3302
4280
|
}
|
|
3303
4281
|
function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
@@ -3341,11 +4319,9 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3341
4319
|
let ifClause0;
|
|
3342
4320
|
if (_valid0) {
|
|
3343
4321
|
const _errs4 = errors;
|
|
3344
|
-
const _errs5 = errors;
|
|
3345
|
-
const _errs6 = errors;
|
|
3346
4322
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3347
|
-
if (data.
|
|
3348
|
-
const err2 = {};
|
|
4323
|
+
if (data.sequence === void 0) {
|
|
4324
|
+
const err2 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
|
|
3349
4325
|
if (vErrors === null) {
|
|
3350
4326
|
vErrors = [err2];
|
|
3351
4327
|
} else {
|
|
@@ -3353,147 +4329,181 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3353
4329
|
}
|
|
3354
4330
|
errors++;
|
|
3355
4331
|
}
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
4332
|
+
if (data.boxes !== void 0) {
|
|
4333
|
+
let data1 = data.boxes;
|
|
4334
|
+
if (Array.isArray(data1)) {
|
|
4335
|
+
if (data1.length < 1) {
|
|
4336
|
+
const err3 = { instancePath: instancePath + "/boxes", schemaPath: "#/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4337
|
+
if (vErrors === null) {
|
|
4338
|
+
vErrors = [err3];
|
|
4339
|
+
} else {
|
|
4340
|
+
vErrors.push(err3);
|
|
4341
|
+
}
|
|
4342
|
+
errors++;
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
3364
4345
|
}
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
4346
|
+
if (data.steps !== void 0) {
|
|
4347
|
+
let data2 = data.steps;
|
|
4348
|
+
if (Array.isArray(data2)) {
|
|
4349
|
+
const len0 = data2.length;
|
|
4350
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
4351
|
+
let data3 = data2[i0];
|
|
4352
|
+
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
|
|
4353
|
+
if (data3.events !== void 0) {
|
|
4354
|
+
let data4 = data3.events;
|
|
4355
|
+
if (Array.isArray(data4)) {
|
|
4356
|
+
const len1 = data4.length;
|
|
4357
|
+
for (let i1 = 0; i1 < len1; i1++) {
|
|
4358
|
+
let data5 = data4[i1];
|
|
4359
|
+
if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
|
|
4360
|
+
if (data5.type !== void 0) {
|
|
4361
|
+
let data6 = data5.type;
|
|
4362
|
+
const _errs12 = errors;
|
|
4363
|
+
const _errs13 = errors;
|
|
4364
|
+
if (!(data6 === "commit" || data6 === "branch")) {
|
|
4365
|
+
const err4 = {};
|
|
4366
|
+
if (vErrors === null) {
|
|
4367
|
+
vErrors = [err4];
|
|
4368
|
+
} else {
|
|
4369
|
+
vErrors.push(err4);
|
|
4370
|
+
}
|
|
4371
|
+
errors++;
|
|
4372
|
+
}
|
|
4373
|
+
var valid10 = _errs13 === errors;
|
|
4374
|
+
if (valid10) {
|
|
4375
|
+
const err5 = { instancePath: instancePath + "/steps/" + i0 + "/events/" + i1 + "/type", schemaPath: "#/definitions/plainSteps/items/properties/events/items/properties/type/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4376
|
+
if (vErrors === null) {
|
|
4377
|
+
vErrors = [err5];
|
|
4378
|
+
} else {
|
|
4379
|
+
vErrors.push(err5);
|
|
4380
|
+
}
|
|
4381
|
+
errors++;
|
|
4382
|
+
} else {
|
|
4383
|
+
errors = _errs12;
|
|
4384
|
+
if (vErrors !== null) {
|
|
4385
|
+
if (_errs12) {
|
|
4386
|
+
vErrors.length = _errs12;
|
|
4387
|
+
} else {
|
|
4388
|
+
vErrors = null;
|
|
4389
|
+
}
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
}
|
|
4393
|
+
}
|
|
4394
|
+
}
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
}
|
|
4398
|
+
}
|
|
3373
4399
|
}
|
|
3374
4400
|
}
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
if (data.sequence === void 0) {
|
|
3378
|
-
const err4 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
|
|
4401
|
+
if (data.state !== void 0) {
|
|
4402
|
+
const err6 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
3379
4403
|
if (vErrors === null) {
|
|
3380
|
-
vErrors = [
|
|
4404
|
+
vErrors = [err6];
|
|
3381
4405
|
} else {
|
|
3382
|
-
vErrors.push(
|
|
4406
|
+
vErrors.push(err6);
|
|
3383
4407
|
}
|
|
3384
4408
|
errors++;
|
|
3385
4409
|
}
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
valid0 = _valid0;
|
|
3389
|
-
ifClause0 = "then";
|
|
3390
|
-
} else {
|
|
3391
|
-
const _errs7 = errors;
|
|
3392
|
-
const _errs8 = errors;
|
|
3393
|
-
const _errs9 = errors;
|
|
3394
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3395
|
-
if (data.sequence === void 0 && ("sequence")) {
|
|
3396
|
-
const err5 = {};
|
|
4410
|
+
if (data.git !== void 0) {
|
|
4411
|
+
const err7 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
3397
4412
|
if (vErrors === null) {
|
|
3398
|
-
vErrors = [
|
|
4413
|
+
vErrors = [err7];
|
|
3399
4414
|
} else {
|
|
3400
|
-
vErrors.push(
|
|
4415
|
+
vErrors.push(err7);
|
|
3401
4416
|
}
|
|
3402
4417
|
errors++;
|
|
3403
4418
|
}
|
|
3404
4419
|
}
|
|
3405
|
-
var
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
errors++;
|
|
3414
|
-
} else {
|
|
3415
|
-
errors = _errs8;
|
|
3416
|
-
if (vErrors !== null) {
|
|
3417
|
-
if (_errs8) {
|
|
3418
|
-
vErrors.length = _errs8;
|
|
3419
|
-
} else {
|
|
3420
|
-
vErrors = null;
|
|
3421
|
-
}
|
|
3422
|
-
}
|
|
3423
|
-
}
|
|
3424
|
-
const _errs10 = errors;
|
|
3425
|
-
let valid4 = true;
|
|
3426
|
-
const _errs11 = errors;
|
|
4420
|
+
var _valid0 = _errs4 === errors;
|
|
4421
|
+
valid0 = _valid0;
|
|
4422
|
+
ifClause0 = "then";
|
|
4423
|
+
} else {
|
|
4424
|
+
const _errs20 = errors;
|
|
4425
|
+
const _errs21 = errors;
|
|
4426
|
+
let valid13 = true;
|
|
4427
|
+
const _errs22 = errors;
|
|
3427
4428
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3428
4429
|
if (data.kind === void 0 && ("kind")) {
|
|
3429
|
-
const
|
|
4430
|
+
const err8 = {};
|
|
3430
4431
|
if (vErrors === null) {
|
|
3431
|
-
vErrors = [
|
|
4432
|
+
vErrors = [err8];
|
|
3432
4433
|
} else {
|
|
3433
|
-
vErrors.push(
|
|
4434
|
+
vErrors.push(err8);
|
|
3434
4435
|
}
|
|
3435
4436
|
errors++;
|
|
3436
4437
|
} else {
|
|
3437
4438
|
if (data.kind !== void 0) {
|
|
3438
4439
|
if ("state" !== data.kind) {
|
|
3439
|
-
const
|
|
4440
|
+
const err9 = {};
|
|
3440
4441
|
if (vErrors === null) {
|
|
3441
|
-
vErrors = [
|
|
4442
|
+
vErrors = [err9];
|
|
3442
4443
|
} else {
|
|
3443
|
-
vErrors.push(
|
|
4444
|
+
vErrors.push(err9);
|
|
3444
4445
|
}
|
|
3445
4446
|
errors++;
|
|
3446
4447
|
}
|
|
3447
4448
|
}
|
|
3448
4449
|
}
|
|
3449
4450
|
}
|
|
3450
|
-
var _valid1 =
|
|
3451
|
-
errors =
|
|
4451
|
+
var _valid1 = _errs22 === errors;
|
|
4452
|
+
errors = _errs21;
|
|
3452
4453
|
if (vErrors !== null) {
|
|
3453
|
-
if (
|
|
3454
|
-
vErrors.length =
|
|
4454
|
+
if (_errs21) {
|
|
4455
|
+
vErrors.length = _errs21;
|
|
3455
4456
|
} else {
|
|
3456
4457
|
vErrors = null;
|
|
3457
4458
|
}
|
|
3458
4459
|
}
|
|
3459
4460
|
let ifClause1;
|
|
3460
4461
|
if (_valid1) {
|
|
3461
|
-
const
|
|
4462
|
+
const _errs24 = errors;
|
|
3462
4463
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3463
4464
|
if (data.boxes !== void 0) {
|
|
3464
|
-
let
|
|
3465
|
-
if (Array.isArray(
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
4465
|
+
let data10 = data.boxes;
|
|
4466
|
+
if (Array.isArray(data10)) {
|
|
4467
|
+
if (data10.length < 1) {
|
|
4468
|
+
const err10 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4469
|
+
if (vErrors === null) {
|
|
4470
|
+
vErrors = [err10];
|
|
4471
|
+
} else {
|
|
4472
|
+
vErrors.push(err10);
|
|
4473
|
+
}
|
|
4474
|
+
errors++;
|
|
4475
|
+
}
|
|
4476
|
+
const len2 = data10.length;
|
|
4477
|
+
for (let i2 = 0; i2 < len2; i2++) {
|
|
4478
|
+
let data11 = data10[i2];
|
|
4479
|
+
if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
|
|
4480
|
+
if (data11.id !== void 0) {
|
|
4481
|
+
let data12 = data11.id;
|
|
4482
|
+
const _errs28 = errors;
|
|
4483
|
+
const _errs29 = errors;
|
|
4484
|
+
if (!(data12 === "start" || data12 === "finish")) {
|
|
4485
|
+
const err11 = {};
|
|
3476
4486
|
if (vErrors === null) {
|
|
3477
|
-
vErrors = [
|
|
4487
|
+
vErrors = [err11];
|
|
3478
4488
|
} else {
|
|
3479
|
-
vErrors.push(
|
|
4489
|
+
vErrors.push(err11);
|
|
3480
4490
|
}
|
|
3481
4491
|
errors++;
|
|
3482
4492
|
}
|
|
3483
|
-
var
|
|
3484
|
-
if (
|
|
3485
|
-
const
|
|
4493
|
+
var valid19 = _errs29 === errors;
|
|
4494
|
+
if (valid19) {
|
|
4495
|
+
const err12 = { instancePath: instancePath + "/boxes/" + i2 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
3486
4496
|
if (vErrors === null) {
|
|
3487
|
-
vErrors = [
|
|
4497
|
+
vErrors = [err12];
|
|
3488
4498
|
} else {
|
|
3489
|
-
vErrors.push(
|
|
4499
|
+
vErrors.push(err12);
|
|
3490
4500
|
}
|
|
3491
4501
|
errors++;
|
|
3492
4502
|
} else {
|
|
3493
|
-
errors =
|
|
4503
|
+
errors = _errs28;
|
|
3494
4504
|
if (vErrors !== null) {
|
|
3495
|
-
if (
|
|
3496
|
-
vErrors.length =
|
|
4505
|
+
if (_errs28) {
|
|
4506
|
+
vErrors.length = _errs28;
|
|
3497
4507
|
} else {
|
|
3498
4508
|
vErrors = null;
|
|
3499
4509
|
}
|
|
@@ -3504,241 +4514,449 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3504
4514
|
}
|
|
3505
4515
|
}
|
|
3506
4516
|
}
|
|
4517
|
+
if (data.steps !== void 0) {
|
|
4518
|
+
let data13 = data.steps;
|
|
4519
|
+
if (Array.isArray(data13)) {
|
|
4520
|
+
const len3 = data13.length;
|
|
4521
|
+
for (let i3 = 0; i3 < len3; i3++) {
|
|
4522
|
+
let data14 = data13[i3];
|
|
4523
|
+
if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
|
|
4524
|
+
if (data14.events !== void 0) {
|
|
4525
|
+
let data15 = data14.events;
|
|
4526
|
+
if (Array.isArray(data15)) {
|
|
4527
|
+
const len4 = data15.length;
|
|
4528
|
+
for (let i4 = 0; i4 < len4; i4++) {
|
|
4529
|
+
let data16 = data15[i4];
|
|
4530
|
+
if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
|
|
4531
|
+
if (data16.type !== void 0) {
|
|
4532
|
+
let data17 = data16.type;
|
|
4533
|
+
const _errs36 = errors;
|
|
4534
|
+
const _errs37 = errors;
|
|
4535
|
+
if (!(data17 === "commit" || data17 === "branch")) {
|
|
4536
|
+
const err13 = {};
|
|
4537
|
+
if (vErrors === null) {
|
|
4538
|
+
vErrors = [err13];
|
|
4539
|
+
} else {
|
|
4540
|
+
vErrors.push(err13);
|
|
4541
|
+
}
|
|
4542
|
+
errors++;
|
|
4543
|
+
}
|
|
4544
|
+
var valid27 = _errs37 === errors;
|
|
4545
|
+
if (valid27) {
|
|
4546
|
+
const err14 = { instancePath: instancePath + "/steps/" + i3 + "/events/" + i4 + "/type", schemaPath: "#/definitions/plainSteps/items/properties/events/items/properties/type/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4547
|
+
if (vErrors === null) {
|
|
4548
|
+
vErrors = [err14];
|
|
4549
|
+
} else {
|
|
4550
|
+
vErrors.push(err14);
|
|
4551
|
+
}
|
|
4552
|
+
errors++;
|
|
4553
|
+
} else {
|
|
4554
|
+
errors = _errs36;
|
|
4555
|
+
if (vErrors !== null) {
|
|
4556
|
+
if (_errs36) {
|
|
4557
|
+
vErrors.length = _errs36;
|
|
4558
|
+
} else {
|
|
4559
|
+
vErrors = null;
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4566
|
+
}
|
|
4567
|
+
}
|
|
4568
|
+
}
|
|
4569
|
+
}
|
|
4570
|
+
}
|
|
4571
|
+
}
|
|
4572
|
+
if (data.git !== void 0) {
|
|
4573
|
+
const err15 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4574
|
+
if (vErrors === null) {
|
|
4575
|
+
vErrors = [err15];
|
|
4576
|
+
} else {
|
|
4577
|
+
vErrors.push(err15);
|
|
4578
|
+
}
|
|
4579
|
+
errors++;
|
|
4580
|
+
}
|
|
3507
4581
|
}
|
|
3508
|
-
var _valid1 =
|
|
3509
|
-
|
|
4582
|
+
var _valid1 = _errs24 === errors;
|
|
4583
|
+
valid13 = _valid1;
|
|
3510
4584
|
ifClause1 = "then";
|
|
3511
4585
|
} else {
|
|
3512
|
-
const
|
|
3513
|
-
const
|
|
3514
|
-
|
|
4586
|
+
const _errs41 = errors;
|
|
4587
|
+
const _errs42 = errors;
|
|
4588
|
+
let valid29 = true;
|
|
4589
|
+
const _errs43 = errors;
|
|
3515
4590
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3516
|
-
if (data.
|
|
3517
|
-
const
|
|
4591
|
+
if (data.kind === void 0 && ("kind")) {
|
|
4592
|
+
const err16 = {};
|
|
3518
4593
|
if (vErrors === null) {
|
|
3519
|
-
vErrors = [
|
|
4594
|
+
vErrors = [err16];
|
|
3520
4595
|
} else {
|
|
3521
|
-
vErrors.push(
|
|
4596
|
+
vErrors.push(err16);
|
|
3522
4597
|
}
|
|
3523
4598
|
errors++;
|
|
4599
|
+
} else {
|
|
4600
|
+
if (data.kind !== void 0) {
|
|
4601
|
+
if ("git" !== data.kind) {
|
|
4602
|
+
const err17 = {};
|
|
4603
|
+
if (vErrors === null) {
|
|
4604
|
+
vErrors = [err17];
|
|
4605
|
+
} else {
|
|
4606
|
+
vErrors.push(err17);
|
|
4607
|
+
}
|
|
4608
|
+
errors++;
|
|
4609
|
+
}
|
|
4610
|
+
}
|
|
3524
4611
|
}
|
|
3525
4612
|
}
|
|
3526
|
-
var
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
if (
|
|
3530
|
-
vErrors =
|
|
4613
|
+
var _valid2 = _errs43 === errors;
|
|
4614
|
+
errors = _errs42;
|
|
4615
|
+
if (vErrors !== null) {
|
|
4616
|
+
if (_errs42) {
|
|
4617
|
+
vErrors.length = _errs42;
|
|
3531
4618
|
} else {
|
|
3532
|
-
vErrors
|
|
4619
|
+
vErrors = null;
|
|
3533
4620
|
}
|
|
3534
|
-
|
|
4621
|
+
}
|
|
4622
|
+
let ifClause2;
|
|
4623
|
+
if (_valid2) {
|
|
4624
|
+
const _errs45 = errors;
|
|
4625
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4626
|
+
if (data.git === void 0) {
|
|
4627
|
+
const err18 = { instancePath, schemaPath: "#/else/else/then/required", keyword: "required", params: { missingProperty: "git" }, message: "must have required property 'git'" };
|
|
4628
|
+
if (vErrors === null) {
|
|
4629
|
+
vErrors = [err18];
|
|
4630
|
+
} else {
|
|
4631
|
+
vErrors.push(err18);
|
|
4632
|
+
}
|
|
4633
|
+
errors++;
|
|
4634
|
+
}
|
|
4635
|
+
if (data.state !== void 0) {
|
|
4636
|
+
const err19 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4637
|
+
if (vErrors === null) {
|
|
4638
|
+
vErrors = [err19];
|
|
4639
|
+
} else {
|
|
4640
|
+
vErrors.push(err19);
|
|
4641
|
+
}
|
|
4642
|
+
errors++;
|
|
4643
|
+
}
|
|
4644
|
+
if (data.regions !== void 0) {
|
|
4645
|
+
const err20 = { instancePath: instancePath + "/regions", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4646
|
+
if (vErrors === null) {
|
|
4647
|
+
vErrors = [err20];
|
|
4648
|
+
} else {
|
|
4649
|
+
vErrors.push(err20);
|
|
4650
|
+
}
|
|
4651
|
+
errors++;
|
|
4652
|
+
}
|
|
4653
|
+
}
|
|
4654
|
+
var _valid2 = _errs45 === errors;
|
|
4655
|
+
valid29 = _valid2;
|
|
4656
|
+
ifClause2 = "then";
|
|
3535
4657
|
} else {
|
|
3536
|
-
|
|
3537
|
-
if (
|
|
3538
|
-
if (
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
4658
|
+
const _errs52 = errors;
|
|
4659
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4660
|
+
if (data.boxes !== void 0) {
|
|
4661
|
+
let data22 = data.boxes;
|
|
4662
|
+
if (Array.isArray(data22)) {
|
|
4663
|
+
if (data22.length < 1) {
|
|
4664
|
+
const err21 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/else/else/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4665
|
+
if (vErrors === null) {
|
|
4666
|
+
vErrors = [err21];
|
|
4667
|
+
} else {
|
|
4668
|
+
vErrors.push(err21);
|
|
4669
|
+
}
|
|
4670
|
+
errors++;
|
|
4671
|
+
}
|
|
4672
|
+
}
|
|
4673
|
+
}
|
|
4674
|
+
if (data.steps !== void 0) {
|
|
4675
|
+
let data23 = data.steps;
|
|
4676
|
+
if (Array.isArray(data23)) {
|
|
4677
|
+
const len5 = data23.length;
|
|
4678
|
+
for (let i5 = 0; i5 < len5; i5++) {
|
|
4679
|
+
let data24 = data23[i5];
|
|
4680
|
+
if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
|
|
4681
|
+
if (data24.events !== void 0) {
|
|
4682
|
+
let data25 = data24.events;
|
|
4683
|
+
if (Array.isArray(data25)) {
|
|
4684
|
+
const len6 = data25.length;
|
|
4685
|
+
for (let i6 = 0; i6 < len6; i6++) {
|
|
4686
|
+
let data26 = data25[i6];
|
|
4687
|
+
if (data26 && typeof data26 == "object" && !Array.isArray(data26)) {
|
|
4688
|
+
if (data26.type !== void 0) {
|
|
4689
|
+
let data27 = data26.type;
|
|
4690
|
+
const _errs60 = errors;
|
|
4691
|
+
const _errs61 = errors;
|
|
4692
|
+
if (!(data27 === "commit" || data27 === "branch")) {
|
|
4693
|
+
const err22 = {};
|
|
4694
|
+
if (vErrors === null) {
|
|
4695
|
+
vErrors = [err22];
|
|
4696
|
+
} else {
|
|
4697
|
+
vErrors.push(err22);
|
|
4698
|
+
}
|
|
4699
|
+
errors++;
|
|
4700
|
+
}
|
|
4701
|
+
var valid42 = _errs61 === errors;
|
|
4702
|
+
if (valid42) {
|
|
4703
|
+
const err23 = { instancePath: instancePath + "/steps/" + i5 + "/events/" + i6 + "/type", schemaPath: "#/definitions/plainSteps/items/properties/events/items/properties/type/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4704
|
+
if (vErrors === null) {
|
|
4705
|
+
vErrors = [err23];
|
|
4706
|
+
} else {
|
|
4707
|
+
vErrors.push(err23);
|
|
4708
|
+
}
|
|
4709
|
+
errors++;
|
|
4710
|
+
} else {
|
|
4711
|
+
errors = _errs60;
|
|
4712
|
+
if (vErrors !== null) {
|
|
4713
|
+
if (_errs60) {
|
|
4714
|
+
vErrors.length = _errs60;
|
|
4715
|
+
} else {
|
|
4716
|
+
vErrors = null;
|
|
4717
|
+
}
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
}
|
|
4723
|
+
}
|
|
4724
|
+
}
|
|
4725
|
+
}
|
|
4726
|
+
}
|
|
4727
|
+
}
|
|
4728
|
+
}
|
|
4729
|
+
if (data.state !== void 0) {
|
|
4730
|
+
const err24 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4731
|
+
if (vErrors === null) {
|
|
4732
|
+
vErrors = [err24];
|
|
4733
|
+
} else {
|
|
4734
|
+
vErrors.push(err24);
|
|
4735
|
+
}
|
|
4736
|
+
errors++;
|
|
3542
4737
|
}
|
|
4738
|
+
if (data.git !== void 0) {
|
|
4739
|
+
const err25 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4740
|
+
if (vErrors === null) {
|
|
4741
|
+
vErrors = [err25];
|
|
4742
|
+
} else {
|
|
4743
|
+
vErrors.push(err25);
|
|
4744
|
+
}
|
|
4745
|
+
errors++;
|
|
4746
|
+
}
|
|
4747
|
+
}
|
|
4748
|
+
var _valid2 = _errs52 === errors;
|
|
4749
|
+
valid29 = _valid2;
|
|
4750
|
+
ifClause2 = "else";
|
|
4751
|
+
}
|
|
4752
|
+
if (!valid29) {
|
|
4753
|
+
const err26 = { instancePath, schemaPath: "#/else/else/if", keyword: "if", params: { failingKeyword: ifClause2 }, message: 'must match "' + ifClause2 + '" schema' };
|
|
4754
|
+
if (vErrors === null) {
|
|
4755
|
+
vErrors = [err26];
|
|
4756
|
+
} else {
|
|
4757
|
+
vErrors.push(err26);
|
|
3543
4758
|
}
|
|
4759
|
+
errors++;
|
|
3544
4760
|
}
|
|
3545
|
-
var _valid1 =
|
|
3546
|
-
|
|
4761
|
+
var _valid1 = _errs41 === errors;
|
|
4762
|
+
valid13 = _valid1;
|
|
3547
4763
|
ifClause1 = "else";
|
|
3548
4764
|
}
|
|
3549
|
-
if (!
|
|
3550
|
-
const
|
|
4765
|
+
if (!valid13) {
|
|
4766
|
+
const err27 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
|
|
3551
4767
|
if (vErrors === null) {
|
|
3552
|
-
vErrors = [
|
|
4768
|
+
vErrors = [err27];
|
|
3553
4769
|
} else {
|
|
3554
|
-
vErrors.push(
|
|
4770
|
+
vErrors.push(err27);
|
|
3555
4771
|
}
|
|
3556
4772
|
errors++;
|
|
3557
4773
|
}
|
|
3558
|
-
|
|
4774
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4775
|
+
if (data.sequence !== void 0) {
|
|
4776
|
+
const err28 = { instancePath: instancePath + "/sequence", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4777
|
+
if (vErrors === null) {
|
|
4778
|
+
vErrors = [err28];
|
|
4779
|
+
} else {
|
|
4780
|
+
vErrors.push(err28);
|
|
4781
|
+
}
|
|
4782
|
+
errors++;
|
|
4783
|
+
}
|
|
4784
|
+
}
|
|
4785
|
+
var _valid0 = _errs20 === errors;
|
|
3559
4786
|
valid0 = _valid0;
|
|
3560
4787
|
ifClause0 = "else";
|
|
3561
4788
|
}
|
|
3562
4789
|
if (!valid0) {
|
|
3563
|
-
const
|
|
4790
|
+
const err29 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
|
|
3564
4791
|
if (vErrors === null) {
|
|
3565
|
-
vErrors = [
|
|
4792
|
+
vErrors = [err29];
|
|
3566
4793
|
} else {
|
|
3567
|
-
vErrors.push(
|
|
4794
|
+
vErrors.push(err29);
|
|
3568
4795
|
}
|
|
3569
4796
|
errors++;
|
|
3570
4797
|
}
|
|
3571
4798
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3572
4799
|
if (data.version === void 0) {
|
|
3573
|
-
const
|
|
4800
|
+
const err30 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
|
|
3574
4801
|
if (vErrors === null) {
|
|
3575
|
-
vErrors = [
|
|
4802
|
+
vErrors = [err30];
|
|
3576
4803
|
} else {
|
|
3577
|
-
vErrors.push(
|
|
4804
|
+
vErrors.push(err30);
|
|
3578
4805
|
}
|
|
3579
4806
|
errors++;
|
|
3580
4807
|
}
|
|
3581
4808
|
if (data.kind === void 0) {
|
|
3582
|
-
const
|
|
4809
|
+
const err31 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
|
|
3583
4810
|
if (vErrors === null) {
|
|
3584
|
-
vErrors = [
|
|
4811
|
+
vErrors = [err31];
|
|
3585
4812
|
} else {
|
|
3586
|
-
vErrors.push(
|
|
4813
|
+
vErrors.push(err31);
|
|
3587
4814
|
}
|
|
3588
4815
|
errors++;
|
|
3589
4816
|
}
|
|
3590
4817
|
if (data.title === void 0) {
|
|
3591
|
-
const
|
|
4818
|
+
const err32 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
|
|
3592
4819
|
if (vErrors === null) {
|
|
3593
|
-
vErrors = [
|
|
4820
|
+
vErrors = [err32];
|
|
3594
4821
|
} else {
|
|
3595
|
-
vErrors.push(
|
|
4822
|
+
vErrors.push(err32);
|
|
3596
4823
|
}
|
|
3597
4824
|
errors++;
|
|
3598
4825
|
}
|
|
3599
4826
|
if (data.boxes === void 0) {
|
|
3600
|
-
const
|
|
4827
|
+
const err33 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
|
|
3601
4828
|
if (vErrors === null) {
|
|
3602
|
-
vErrors = [
|
|
4829
|
+
vErrors = [err33];
|
|
3603
4830
|
} else {
|
|
3604
|
-
vErrors.push(
|
|
4831
|
+
vErrors.push(err33);
|
|
3605
4832
|
}
|
|
3606
4833
|
errors++;
|
|
3607
4834
|
}
|
|
3608
4835
|
if (data.steps === void 0) {
|
|
3609
|
-
const
|
|
4836
|
+
const err34 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
|
|
3610
4837
|
if (vErrors === null) {
|
|
3611
|
-
vErrors = [
|
|
4838
|
+
vErrors = [err34];
|
|
3612
4839
|
} else {
|
|
3613
|
-
vErrors.push(
|
|
4840
|
+
vErrors.push(err34);
|
|
3614
4841
|
}
|
|
3615
4842
|
errors++;
|
|
3616
4843
|
}
|
|
3617
4844
|
for (const key0 in data) {
|
|
3618
4845
|
if (!func2.call(schema11.properties, key0)) {
|
|
3619
|
-
const
|
|
4846
|
+
const err35 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
3620
4847
|
if (vErrors === null) {
|
|
3621
|
-
vErrors = [
|
|
4848
|
+
vErrors = [err35];
|
|
3622
4849
|
} else {
|
|
3623
|
-
vErrors.push(
|
|
4850
|
+
vErrors.push(err35);
|
|
3624
4851
|
}
|
|
3625
4852
|
errors++;
|
|
3626
4853
|
}
|
|
3627
4854
|
}
|
|
3628
4855
|
if (data.version !== void 0) {
|
|
3629
|
-
let
|
|
3630
|
-
if (!(typeof
|
|
3631
|
-
const
|
|
4856
|
+
let data31 = data.version;
|
|
4857
|
+
if (!(typeof data31 == "number" && (!(data31 % 1) && !isNaN(data31)) && isFinite(data31))) {
|
|
4858
|
+
const err36 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
|
|
3632
4859
|
if (vErrors === null) {
|
|
3633
|
-
vErrors = [
|
|
4860
|
+
vErrors = [err36];
|
|
3634
4861
|
} else {
|
|
3635
|
-
vErrors.push(
|
|
4862
|
+
vErrors.push(err36);
|
|
3636
4863
|
}
|
|
3637
4864
|
errors++;
|
|
3638
4865
|
}
|
|
3639
|
-
if (typeof
|
|
3640
|
-
if (
|
|
3641
|
-
const
|
|
4866
|
+
if (typeof data31 == "number" && isFinite(data31)) {
|
|
4867
|
+
if (data31 < 1 || isNaN(data31)) {
|
|
4868
|
+
const err37 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
|
|
3642
4869
|
if (vErrors === null) {
|
|
3643
|
-
vErrors = [
|
|
4870
|
+
vErrors = [err37];
|
|
3644
4871
|
} else {
|
|
3645
|
-
vErrors.push(
|
|
4872
|
+
vErrors.push(err37);
|
|
3646
4873
|
}
|
|
3647
4874
|
errors++;
|
|
3648
4875
|
}
|
|
3649
4876
|
}
|
|
3650
4877
|
}
|
|
3651
4878
|
if (data.kind !== void 0) {
|
|
3652
|
-
let
|
|
3653
|
-
if (!(
|
|
3654
|
-
const
|
|
4879
|
+
let data32 = data.kind;
|
|
4880
|
+
if (!(data32 === "sequence" || data32 === "architecture" || data32 === "state" || data32 === "git")) {
|
|
4881
|
+
const err38 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues: schema11.properties.kind.enum }, message: "must be equal to one of the allowed values" };
|
|
3655
4882
|
if (vErrors === null) {
|
|
3656
|
-
vErrors = [
|
|
4883
|
+
vErrors = [err38];
|
|
3657
4884
|
} else {
|
|
3658
|
-
vErrors.push(
|
|
4885
|
+
vErrors.push(err38);
|
|
3659
4886
|
}
|
|
3660
4887
|
errors++;
|
|
3661
4888
|
}
|
|
3662
4889
|
}
|
|
3663
4890
|
if (data.title !== void 0) {
|
|
3664
|
-
let
|
|
3665
|
-
if (typeof
|
|
3666
|
-
if (func3(
|
|
3667
|
-
const
|
|
4891
|
+
let data33 = data.title;
|
|
4892
|
+
if (typeof data33 === "string") {
|
|
4893
|
+
if (func3(data33) < 1) {
|
|
4894
|
+
const err39 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3668
4895
|
if (vErrors === null) {
|
|
3669
|
-
vErrors = [
|
|
4896
|
+
vErrors = [err39];
|
|
3670
4897
|
} else {
|
|
3671
|
-
vErrors.push(
|
|
4898
|
+
vErrors.push(err39);
|
|
3672
4899
|
}
|
|
3673
4900
|
errors++;
|
|
3674
4901
|
}
|
|
3675
4902
|
} else {
|
|
3676
|
-
const
|
|
4903
|
+
const err40 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3677
4904
|
if (vErrors === null) {
|
|
3678
|
-
vErrors = [
|
|
4905
|
+
vErrors = [err40];
|
|
3679
4906
|
} else {
|
|
3680
|
-
vErrors.push(
|
|
4907
|
+
vErrors.push(err40);
|
|
3681
4908
|
}
|
|
3682
4909
|
errors++;
|
|
3683
4910
|
}
|
|
3684
4911
|
}
|
|
3685
4912
|
if (data.view !== void 0) {
|
|
3686
|
-
let
|
|
3687
|
-
if (!(
|
|
3688
|
-
const
|
|
4913
|
+
let data34 = data.view;
|
|
4914
|
+
if (!(data34 === "fixed" || data34 === "follow")) {
|
|
4915
|
+
const err41 = { instancePath: instancePath + "/view", schemaPath: "#/properties/view/enum", keyword: "enum", params: { allowedValues: schema11.properties.view.enum }, message: "must be equal to one of the allowed values" };
|
|
3689
4916
|
if (vErrors === null) {
|
|
3690
|
-
vErrors = [
|
|
4917
|
+
vErrors = [err41];
|
|
3691
4918
|
} else {
|
|
3692
|
-
vErrors.push(
|
|
4919
|
+
vErrors.push(err41);
|
|
3693
4920
|
}
|
|
3694
4921
|
errors++;
|
|
3695
4922
|
}
|
|
3696
4923
|
}
|
|
3697
4924
|
if (data.regions !== void 0) {
|
|
3698
|
-
let
|
|
3699
|
-
if (Array.isArray(
|
|
3700
|
-
const
|
|
3701
|
-
for (let
|
|
3702
|
-
if (!validate11(
|
|
4925
|
+
let data35 = data.regions;
|
|
4926
|
+
if (Array.isArray(data35)) {
|
|
4927
|
+
const len7 = data35.length;
|
|
4928
|
+
for (let i7 = 0; i7 < len7; i7++) {
|
|
4929
|
+
if (!validate11(data35[i7], { instancePath: instancePath + "/regions/" + i7, parentData: data35, parentDataProperty: i7, rootData })) {
|
|
3703
4930
|
vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);
|
|
3704
4931
|
errors = vErrors.length;
|
|
3705
4932
|
}
|
|
3706
4933
|
}
|
|
3707
4934
|
} else {
|
|
3708
|
-
const
|
|
4935
|
+
const err42 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3709
4936
|
if (vErrors === null) {
|
|
3710
|
-
vErrors = [
|
|
4937
|
+
vErrors = [err42];
|
|
3711
4938
|
} else {
|
|
3712
|
-
vErrors.push(
|
|
4939
|
+
vErrors.push(err42);
|
|
3713
4940
|
}
|
|
3714
4941
|
errors++;
|
|
3715
4942
|
}
|
|
3716
4943
|
}
|
|
3717
4944
|
if (data.boxes !== void 0) {
|
|
3718
|
-
let
|
|
3719
|
-
if (Array.isArray(
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
if (
|
|
3723
|
-
vErrors = [err28];
|
|
3724
|
-
} else {
|
|
3725
|
-
vErrors.push(err28);
|
|
3726
|
-
}
|
|
3727
|
-
errors++;
|
|
3728
|
-
}
|
|
3729
|
-
const len2 = data11.length;
|
|
3730
|
-
for (let i2 = 0; i2 < len2; i2++) {
|
|
3731
|
-
if (!validate13(data11[i2], { instancePath: instancePath + "/boxes/" + i2, parentData: data11, parentDataProperty: i2, rootData })) {
|
|
4945
|
+
let data37 = data.boxes;
|
|
4946
|
+
if (Array.isArray(data37)) {
|
|
4947
|
+
const len8 = data37.length;
|
|
4948
|
+
for (let i8 = 0; i8 < len8; i8++) {
|
|
4949
|
+
if (!validate13(data37[i8], { instancePath: instancePath + "/boxes/" + i8, parentData: data37, parentDataProperty: i8, rootData })) {
|
|
3732
4950
|
vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);
|
|
3733
4951
|
errors = vErrors.length;
|
|
3734
4952
|
}
|
|
3735
4953
|
}
|
|
3736
4954
|
} else {
|
|
3737
|
-
const
|
|
4955
|
+
const err43 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3738
4956
|
if (vErrors === null) {
|
|
3739
|
-
vErrors = [
|
|
4957
|
+
vErrors = [err43];
|
|
3740
4958
|
} else {
|
|
3741
|
-
vErrors.push(
|
|
4959
|
+
vErrors.push(err43);
|
|
3742
4960
|
}
|
|
3743
4961
|
errors++;
|
|
3744
4962
|
}
|
|
@@ -3750,30 +4968,30 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3750
4968
|
}
|
|
3751
4969
|
}
|
|
3752
4970
|
if (data.steps !== void 0) {
|
|
3753
|
-
let
|
|
3754
|
-
if (Array.isArray(
|
|
3755
|
-
if (
|
|
3756
|
-
const
|
|
4971
|
+
let data40 = data.steps;
|
|
4972
|
+
if (Array.isArray(data40)) {
|
|
4973
|
+
if (data40.length < 1) {
|
|
4974
|
+
const err44 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
3757
4975
|
if (vErrors === null) {
|
|
3758
|
-
vErrors = [
|
|
4976
|
+
vErrors = [err44];
|
|
3759
4977
|
} else {
|
|
3760
|
-
vErrors.push(
|
|
4978
|
+
vErrors.push(err44);
|
|
3761
4979
|
}
|
|
3762
4980
|
errors++;
|
|
3763
4981
|
}
|
|
3764
|
-
const
|
|
3765
|
-
for (let
|
|
3766
|
-
if (!validate17(
|
|
4982
|
+
const len9 = data40.length;
|
|
4983
|
+
for (let i9 = 0; i9 < len9; i9++) {
|
|
4984
|
+
if (!validate17(data40[i9], { instancePath: instancePath + "/steps/" + i9, parentData: data40, parentDataProperty: i9, rootData })) {
|
|
3767
4985
|
vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);
|
|
3768
4986
|
errors = vErrors.length;
|
|
3769
4987
|
}
|
|
3770
4988
|
}
|
|
3771
4989
|
} else {
|
|
3772
|
-
const
|
|
4990
|
+
const err45 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3773
4991
|
if (vErrors === null) {
|
|
3774
|
-
vErrors = [
|
|
4992
|
+
vErrors = [err45];
|
|
3775
4993
|
} else {
|
|
3776
|
-
vErrors.push(
|
|
4994
|
+
vErrors.push(err45);
|
|
3777
4995
|
}
|
|
3778
4996
|
errors++;
|
|
3779
4997
|
}
|
|
@@ -3790,12 +5008,18 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3790
5008
|
errors = vErrors.length;
|
|
3791
5009
|
}
|
|
3792
5010
|
}
|
|
5011
|
+
if (data.git !== void 0) {
|
|
5012
|
+
if (!validate29(data.git, { instancePath: instancePath + "/git", parentData: data, parentDataProperty: "git", rootData })) {
|
|
5013
|
+
vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors);
|
|
5014
|
+
errors = vErrors.length;
|
|
5015
|
+
}
|
|
5016
|
+
}
|
|
3793
5017
|
} else {
|
|
3794
|
-
const
|
|
5018
|
+
const err46 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3795
5019
|
if (vErrors === null) {
|
|
3796
|
-
vErrors = [
|
|
5020
|
+
vErrors = [err46];
|
|
3797
5021
|
} else {
|
|
3798
|
-
vErrors.push(
|
|
5022
|
+
vErrors.push(err46);
|
|
3799
5023
|
}
|
|
3800
5024
|
errors++;
|
|
3801
5025
|
}
|
|
@@ -3805,17 +5029,17 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3805
5029
|
|
|
3806
5030
|
// src/schema.ts
|
|
3807
5031
|
var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
|
|
3808
|
-
var EVENT_TYPES = ["edge", "action", "swap", "strip"];
|
|
3809
|
-
var
|
|
3810
|
-
|
|
3811
|
-
"#/then/not": { field: "state", kind: "state" },
|
|
3812
|
-
"#/else/else/not": { field: "state", kind: "state" }
|
|
3813
|
-
};
|
|
5032
|
+
var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch"];
|
|
5033
|
+
var ABSENT = "#/definitions/absent/not";
|
|
5034
|
+
var ABSENT_KINDS = { regions: "sequence / architecture / state" };
|
|
3814
5035
|
var NOT_ALLOWED = {
|
|
3815
5036
|
carry: { field: "text", kind: "tag" }
|
|
3816
5037
|
};
|
|
3817
5038
|
var RESERVED_ID = /\/boxes\/items\/properties\/id\/not$/u;
|
|
5039
|
+
var GIT_EVENT = /\/events\/items\/properties\/type\/not$/u;
|
|
5040
|
+
var GIT_EVENTS = ["commit", "branch"];
|
|
3818
5041
|
var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
5042
|
+
var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
|
|
3819
5043
|
function forbiddenOf(pattern) {
|
|
3820
5044
|
const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
|
|
3821
5045
|
if (inside === void 0) return void 0;
|
|
@@ -3839,7 +5063,10 @@ function toFieldError(error, errors, m) {
|
|
|
3839
5063
|
}
|
|
3840
5064
|
case "not": {
|
|
3841
5065
|
if (RESERVED_ID.test(error.schemaPath)) return { pointer: at2, message: m.reserved(STATE_ENDS) };
|
|
3842
|
-
|
|
5066
|
+
if (GIT_EVENT.test(error.schemaPath)) return { pointer: at2, message: m.kindOnly(GIT_EVENTS, "git") };
|
|
5067
|
+
const last = at2.slice(at2.lastIndexOf("/") + 1);
|
|
5068
|
+
if (error.schemaPath === ABSENT) return { pointer: at2, message: m.not({ field: last, kind: ABSENT_KINDS[last] ?? last }) };
|
|
5069
|
+
const allowed = NOT_ALLOWED[last];
|
|
3843
5070
|
return { pointer: allowed ? `${at2}/${allowed.field}` : at2, message: m.not(allowed) };
|
|
3844
5071
|
}
|
|
3845
5072
|
case "anyOf": {
|
|
@@ -3857,8 +5084,10 @@ function toFieldError(error, errors, m) {
|
|
|
3857
5084
|
return { pointer: at2, message: m.type(String(params.type)) };
|
|
3858
5085
|
case "minLength":
|
|
3859
5086
|
return { pointer: at2, message: m.minLength(Number(params.limit)) };
|
|
3860
|
-
case "pattern":
|
|
3861
|
-
|
|
5087
|
+
case "pattern": {
|
|
5088
|
+
const hex2 = HEX.exec(String(params.pattern));
|
|
5089
|
+
return { pointer: at2, message: hex2 ? m.hex(Number(hex2[1]), Number(hex2[2])) : m.pattern(forbiddenOf(String(params.pattern))) };
|
|
5090
|
+
}
|
|
3862
5091
|
case "minItems":
|
|
3863
5092
|
return { pointer: at2, message: m.minItems(Number(params.limit)) };
|
|
3864
5093
|
case "minimum":
|
|
@@ -3906,7 +5135,15 @@ function plan(step) {
|
|
|
3906
5135
|
let arrived;
|
|
3907
5136
|
let changes = 0;
|
|
3908
5137
|
step.events.forEach((event, e) => {
|
|
3909
|
-
if (event.type === "
|
|
5138
|
+
if (event.type === "commit" || event.type === "branch") {
|
|
5139
|
+
const a = cursor;
|
|
5140
|
+
const b = a + MOTION.draw;
|
|
5141
|
+
out.edges.push({ event: e, a, b, carries: false, coin: false, named: false });
|
|
5142
|
+
cursor = a + MOTION.stagger;
|
|
5143
|
+
arrived = b;
|
|
5144
|
+
changes = 0;
|
|
5145
|
+
out.busy = Math.max(out.busy, b);
|
|
5146
|
+
} else if (event.type === "edge") {
|
|
3910
5147
|
const carries = event.carry.kind !== "none";
|
|
3911
5148
|
const a = cursor;
|
|
3912
5149
|
const b = a + (carries ? MOTION.drawCarry : MOTION.draw);
|
|
@@ -3951,7 +5188,9 @@ function buildTimeline(diagram) {
|
|
|
3951
5188
|
for (const edge2 of p.edges) {
|
|
3952
5189
|
const a = span.start + edge2.a;
|
|
3953
5190
|
edges.push({ step: s, event: edge2.event, start: a, drawn: span.start + edge2.b, end: span.end });
|
|
3954
|
-
|
|
5191
|
+
const event = diagram.steps[s]?.events[edge2.event];
|
|
5192
|
+
const own = diagram.kind === "git" && event?.type === "edge" && event.carry.kind === "tag" && event.carry.text === event.from;
|
|
5193
|
+
if (edge2.carries && !own) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
|
|
3955
5194
|
if (edge2.named) named.push({ step: s, event: edge2.event, start: a + MOTION.labelDelay, end: span.end });
|
|
3956
5195
|
}
|
|
3957
5196
|
named.forEach((label2, k) => {
|
|
@@ -4438,6 +5677,123 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4438
5677
|
return parts.join("");
|
|
4439
5678
|
}
|
|
4440
5679
|
|
|
5680
|
+
// src/render/git.ts
|
|
5681
|
+
var r12 = (v) => Math.round(v * 100) / 100;
|
|
5682
|
+
var center = (r) => [r.x + r.w / 2, r.y + r.h / 2];
|
|
5683
|
+
function tagShape(text2, sh) {
|
|
5684
|
+
const C = LOOK.carrier;
|
|
5685
|
+
const ja3 = hasWide(text2);
|
|
5686
|
+
const w = textWidth(text2, ja3 ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
|
|
5687
|
+
return `<rect class="dg-car" x="${r12(-w / 2)}" y="${ -18 / 2}" width="${r12(w)}" height="${C.tagH}" rx="${C.tagH / 2}" ${sh}/><text class="dg-car-t${ja3 ? " dg-car-tj" : ""}" y="${LOOK.baseline.carrier}" text-anchor="middle">${esc(text2)}</text>`;
|
|
5688
|
+
}
|
|
5689
|
+
function drawGit(layout, diagram, timeline, ctx) {
|
|
5690
|
+
const { m } = ctx;
|
|
5691
|
+
const G = LOOK.git;
|
|
5692
|
+
const timeOf = (step, event) => timeline.edges.find((t) => t.step === step && t.event === event);
|
|
5693
|
+
const links = layout.links.map((l) => {
|
|
5694
|
+
const time = timeOf(l.step, l.event);
|
|
5695
|
+
if (!time) return "";
|
|
5696
|
+
ctx.traces.push({ from: l.from, to: l.to, points: l.points, shown: [[time.start, Number.POSITIVE_INFINITY]] });
|
|
5697
|
+
const d = pathOf(l.points);
|
|
5698
|
+
if (l.kind === "copy") return `<g style="${cs(l.color)}"><path class="dg-git-cp dg-a" d="${d}" style="${m.vis(time.start, m.last)}"/></g>`;
|
|
5699
|
+
const kf = m.kf([
|
|
5700
|
+
[0, { opacity: 0, "stroke-dashoffset": 1 }],
|
|
5701
|
+
[time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
|
|
5702
|
+
[time.start + 0.05, { opacity: 1 }],
|
|
5703
|
+
[time.drawn, { "stroke-dashoffset": 0 }],
|
|
5704
|
+
[m.last, { opacity: 1, "stroke-dashoffset": 0 }, EASE.inOut],
|
|
5705
|
+
[m.total, { opacity: 0, "stroke-dashoffset": 0 }]
|
|
5706
|
+
]);
|
|
5707
|
+
return `<g style="${cs(l.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${d}" style="${kf}"/></g>`;
|
|
5708
|
+
}).join("");
|
|
5709
|
+
const commits = layout.commits.map((c) => {
|
|
5710
|
+
const at2 = timeOf(c.step, c.event)?.drawn ?? 0;
|
|
5711
|
+
const ring = { x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 };
|
|
5712
|
+
ctx.ink.push({ text: c.id, rect: ring, shown: [[at2, Number.POSITIVE_INFINITY]], boxed: true });
|
|
5713
|
+
const lines2 = (c.text?.lines ?? []).map((line, k) => {
|
|
5714
|
+
const hash = k === 0 && c.hash !== void 0;
|
|
5715
|
+
const baseline = c.text?.baselines[k] ?? c.cy;
|
|
5716
|
+
return write(ctx.ink, hash ? "dg-git-h" : "dg-git-n", c.cx, baseline, line, hash ? TYPE.gitHash : TYPE.gitNote, [[at2, Number.POSITIVE_INFINITY]], "middle");
|
|
5717
|
+
}).join("");
|
|
5718
|
+
const id = `<text class="dg-git-id" x="${r12(c.cx)}" y="${r12(c.cy + LOOK.baseline.badge)}" text-anchor="middle">${esc(c.id)}</text>`;
|
|
5719
|
+
const node = `<g class="dg-popc dg-a" style="${m.pop(at2)}"><circle class="dg-git-c" cx="${r12(c.cx)}" cy="${r12(c.cy)}" r="${c.r}" ${ctx.sh}/>${id}</g>`;
|
|
5720
|
+
const text2 = lines2 === "" ? "" : `<g class="dg-a" style="${m.vis(at2)}">${lines2}</g>`;
|
|
5721
|
+
const orphanAt = c.orphan === void 0 ? void 0 : timeOf(c.orphan, c.orphanEvent ?? 0)?.drawn;
|
|
5722
|
+
const orphan = orphanAt === void 0 ? "" : `<g class="dg-a" data-orphan="${esc(c.id)}" style="${m.vis(orphanAt, m.last, { f: 0.5 })}"><circle class="dg-git-old" cx="${r12(c.cx)}" cy="${r12(c.cy)}" r="${G.orphan}"/><text class="dg-git-oldl" x="${r12(c.cx)}" y="${r12(c.cy + LOOK.baseline.badge)}" text-anchor="middle">${esc(c.id)}</text></g>`;
|
|
5723
|
+
return `<g data-commit="${esc(c.id)}" style="${cs(c.color)}">${node}${text2}${orphan}</g>`;
|
|
5724
|
+
}).join("");
|
|
5725
|
+
const lines = layout.moves.flatMap((mv) => {
|
|
5726
|
+
const time = timeOf(mv.step, mv.event);
|
|
5727
|
+
if (!mv.line || !time) return [];
|
|
5728
|
+
const end = timeline.steps[mv.step].end;
|
|
5729
|
+
ctx.traces.push({ from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, shown: [[time.start, end + 0.4]] });
|
|
5730
|
+
const kf = m.kf([
|
|
5731
|
+
[0, { opacity: 0, "stroke-dashoffset": 1 }],
|
|
5732
|
+
[time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
|
|
5733
|
+
[time.start + 0.05, { opacity: 1 }],
|
|
5734
|
+
[time.drawn, { "stroke-dashoffset": 0 }],
|
|
5735
|
+
[end, { opacity: 1 }, EASE.inOut],
|
|
5736
|
+
[end + 0.4, { opacity: 0 }],
|
|
5737
|
+
[m.total, { opacity: 0, "stroke-dashoffset": 0 }]
|
|
5738
|
+
]);
|
|
5739
|
+
return [`<g style="${cs(mv.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${pathOf(mv.line)}" style="${kf}"/></g>`];
|
|
5740
|
+
}).join("");
|
|
5741
|
+
const carried = timeline.carriers.flatMap((t) => {
|
|
5742
|
+
const mv = layout.moves.find((x) => x.step === t.step && x.event === t.event && x.line);
|
|
5743
|
+
const source = diagram.steps[t.step]?.events[t.event];
|
|
5744
|
+
if (!mv?.line || source?.type !== "edge") return [];
|
|
5745
|
+
const edge2 = { step: t.step, event: t.event, from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, color: mv.color, carry: source.carry };
|
|
5746
|
+
return [carrier(edge2, { ...t, start: t.depart, end: t.arrive + MOTION.fade }, ctx)];
|
|
5747
|
+
}).join("");
|
|
5748
|
+
const refs = [...new Set(layout.moves.map((mv) => mv.ref))];
|
|
5749
|
+
const tags = refs.map((ref) => tagMotion(ref, layout.moves.filter((mv) => mv.ref === ref), timeOf, ctx)).join("") + carried;
|
|
5750
|
+
return { links, lines, commits, tags };
|
|
5751
|
+
}
|
|
5752
|
+
function tagMotion(ref, list2, timeOf, ctx) {
|
|
5753
|
+
const { m } = ctx;
|
|
5754
|
+
const points = [];
|
|
5755
|
+
const fades = [[0, { opacity: 0 }]];
|
|
5756
|
+
let on = false;
|
|
5757
|
+
let rest;
|
|
5758
|
+
const leave = (t) => {
|
|
5759
|
+
if (rest) ctx.ink.push({ text: ref, rect: rest.rect, shown: [[rest.since, t]], boxed: true });
|
|
5760
|
+
rest = void 0;
|
|
5761
|
+
};
|
|
5762
|
+
for (const mv of list2) {
|
|
5763
|
+
const time = timeOf(mv.step, mv.event);
|
|
5764
|
+
if (!time) continue;
|
|
5765
|
+
const { start: a, drawn: b } = time;
|
|
5766
|
+
const from = mv.from ? center(mv.from) : void 0;
|
|
5767
|
+
const to = mv.to ? center(mv.to) : void 0;
|
|
5768
|
+
leave(a);
|
|
5769
|
+
if (mv.carried && from && to && on) {
|
|
5770
|
+
points.push([a + MOTION.fade, from[0], from[1]], [b - MOTION.fade, to[0], to[1]]);
|
|
5771
|
+
fades.push([a, { opacity: 1 }, EASE.inOut], [a + MOTION.fade, { opacity: 0 }], [b - MOTION.fade, { opacity: 0 }, EASE.out], [b, { opacity: 1 }]);
|
|
5772
|
+
rest = { rect: mv.to, since: b };
|
|
5773
|
+
continue;
|
|
5774
|
+
}
|
|
5775
|
+
if (from) points.push([a, from[0], from[1]]);
|
|
5776
|
+
if (to) points.push([b, to[0], to[1]]);
|
|
5777
|
+
if (to && !on) {
|
|
5778
|
+
const show = from ? a : b - MOTION.fade;
|
|
5779
|
+
fades.push([show, { opacity: 0 }, EASE.out], [show + MOTION.fade, { opacity: 1 }]);
|
|
5780
|
+
on = true;
|
|
5781
|
+
} else if (!to && on) {
|
|
5782
|
+
fades.push([b, { opacity: 1 }, EASE.inOut], [b + MOTION.untilFade, { opacity: 0 }]);
|
|
5783
|
+
on = false;
|
|
5784
|
+
}
|
|
5785
|
+
if (mv.to) rest = { rect: mv.to, since: b };
|
|
5786
|
+
}
|
|
5787
|
+
leave(Number.POSITIVE_INFINITY);
|
|
5788
|
+
if (points.length === 0) return "";
|
|
5789
|
+
const first = points[0];
|
|
5790
|
+
const last = points[points.length - 1];
|
|
5791
|
+
if (on) fades.push([m.last, { opacity: 1 }, EASE.inOut], [m.total, { opacity: 0 }]);
|
|
5792
|
+
else fades.push([m.total, { opacity: 0 }]);
|
|
5793
|
+
const style = m.move([[0, first[1], first[2]], ...points, [m.total, last[1], last[2]]], fades);
|
|
5794
|
+
return `<g class="dg-a" data-ref="${esc(ref)}" style="${style}">${tagShape(ref, ctx.sh)}</g>`;
|
|
5795
|
+
}
|
|
5796
|
+
|
|
4441
5797
|
// src/render/motion.ts
|
|
4442
5798
|
var r2 = (v) => Math.round(v * 100) / 100;
|
|
4443
5799
|
var Motion = class {
|
|
@@ -4608,6 +5964,14 @@ var PART_CSS = [
|
|
|
4608
5964
|
`.dg-mark{${font(TYPE.regionNote)};fill:var(--mute)}`,
|
|
4609
5965
|
`.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${S.done}}`,
|
|
4610
5966
|
`.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${S.glyph};stroke-linecap:round;stroke-linejoin:round}`,
|
|
5967
|
+
`.dg-git-l{fill:none;stroke:var(--c);stroke-width:${S.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,
|
|
5968
|
+
`.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${S.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,
|
|
5969
|
+
`.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${S.git}}`,
|
|
5970
|
+
`.dg-git-id{${font(TYPE.gitId)};fill:var(--ct)}`,
|
|
5971
|
+
`.dg-git-h{${font(TYPE.gitHash)};fill:var(--mute)}`,
|
|
5972
|
+
`.dg-git-n{${font(TYPE.gitNote)};fill:var(--ink2)}`,
|
|
5973
|
+
`.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${S.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,
|
|
5974
|
+
`.dg-git-oldl{${font(TYPE.gitId)};fill:var(--ct);opacity:.55}`,
|
|
4611
5975
|
".dg-vp-bg{fill:var(--bg)}",
|
|
4612
5976
|
".dg-vp-frame{fill:none;stroke:var(--hair)}",
|
|
4613
5977
|
".dg-hd-bg{fill:var(--bg)}",
|
|
@@ -4714,6 +6078,13 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
|
|
|
4714
6078
|
const arrivals = new Map((timeline.states ?? []).flatMap((s) => s.lit[0] ? [[s.box, s.lit[0].start]] : []));
|
|
4715
6079
|
if (layout.strip) L.band.push(strip(layout.strip, fieldChanges(diagram, timeline, layout), ctx, isState, arrivals));
|
|
4716
6080
|
for (const line of layout.lifelines) L.base.push(lifeline(line.x, line.y1, line.y2));
|
|
6081
|
+
if (isGitLayout(layout)) {
|
|
6082
|
+
const git = drawGit(layout, diagram, timeline, ctx);
|
|
6083
|
+
L.base.push(git.links);
|
|
6084
|
+
L.lit.push(git.lines);
|
|
6085
|
+
L.node.push(git.commits);
|
|
6086
|
+
L.top.push(git.tags);
|
|
6087
|
+
}
|
|
4717
6088
|
for (const e of layout.edges) {
|
|
4718
6089
|
const time = timeline.edges.find((t) => t.step === e.step && t.event === e.event);
|
|
4719
6090
|
if (!time) continue;
|
|
@@ -4752,14 +6123,14 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
|
|
|
4752
6123
|
const css = `.dg-${id}{${FONT_VARS};--T:${timeline.total}s;${paletteVars(palette, theme)}}${PART_CSS}${m.frames.join("")}`;
|
|
4753
6124
|
return `<svg xmlns="http://www.w3.org/2000/svg" class="dg dg-${id}" viewBox="0 0 ${Math.ceil(view.w)} ${Math.ceil(view.h)}" width="${Math.ceil(view.w)}" height="${Math.ceil(view.h)}" role="img" aria-label="${esc(diagram.title)}" data-dragon="figure" data-view="${follow ? "follow" : "fixed"}"><style>${css}</style><defs>${shadow}</defs>${view.body}</svg>`;
|
|
4754
6125
|
}
|
|
4755
|
-
function
|
|
6126
|
+
function union2(rects) {
|
|
4756
6127
|
const x = Math.min(...rects.map((r) => r.x));
|
|
4757
6128
|
const y = Math.min(...rects.map((r) => r.y));
|
|
4758
6129
|
return { x, y, w: Math.max(...rects.map((r) => r.x + r.w)) - x, h: Math.max(...rects.map((r) => r.y + r.h)) - y };
|
|
4759
6130
|
}
|
|
4760
6131
|
function focusOf(layout, diagram, step) {
|
|
4761
6132
|
const rects = focusParts(layout, diagram, step);
|
|
4762
|
-
return rects.length === 0 ? void 0 :
|
|
6133
|
+
return rects.length === 0 ? void 0 : union2(rects);
|
|
4763
6134
|
}
|
|
4764
6135
|
function badgeFocus(badge2, parts, vw, vh) {
|
|
4765
6136
|
const room = LOOK.badge.r + LOOK.follow.badgeRoom;
|
|
@@ -4767,7 +6138,7 @@ function badgeFocus(badge2, parts, vw, vh) {
|
|
|
4767
6138
|
const away = (p) => Math.hypot(Math.max(0, p.x - bx, bx - p.x - p.w), Math.max(0, p.y - by, by - p.y - p.h));
|
|
4768
6139
|
let held = { x: bx - room, y: by - room, w: room * 2, h: room * 2 };
|
|
4769
6140
|
for (const p of [...parts].sort((a, b) => away(a) - away(b))) {
|
|
4770
|
-
const next =
|
|
6141
|
+
const next = union2([held, p]);
|
|
4771
6142
|
if (next.w <= vw && next.h <= vh) held = next;
|
|
4772
6143
|
}
|
|
4773
6144
|
return held;
|
|
@@ -4865,7 +6236,7 @@ function renderDiagram(input, options = {}) {
|
|
|
4865
6236
|
const read2 = readDiagram(input, { lang });
|
|
4866
6237
|
if (!read2.ok) throw new Error(FIGURE_TEXT[lang].cannotDraw(read2.errors.map((e) => `${e.pointer} ${e.message}`).join(" / ")));
|
|
4867
6238
|
const diagram = read2.diagram;
|
|
4868
|
-
const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : layoutArchitecture(diagram);
|
|
6239
|
+
const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : diagram.kind === "git" ? layoutGit(diagram) : layoutArchitecture(diagram);
|
|
4869
6240
|
return renderLayout(diagram, layout, buildTimeline(diagram), options);
|
|
4870
6241
|
}
|
|
4871
6242
|
function renderLayout(diagram, layout, timeline, options = {}) {
|
|
@@ -5270,8 +6641,8 @@ var ja2 = () => {
|
|
|
5270
6641
|
sayTwice: "1 \u3064\u306E\u6BB5\u306B say \u306F 1 \u3064\u307E\u3067\u3002\u9577\u3044\u672C\u6587\u306F say \u306E\u4E0B\u306B\u5B57\u4E0B\u3052\u3057\u3066\u7D9A\u3051\u308B",
|
|
5271
6642
|
codeTwice: "1 \u3064\u306E\u6BB5\u306B code \u306F 1 \u884C\u307E\u3067",
|
|
5272
6643
|
emptyCode: "code \u306E\u5F8C\u308D\u306B\u547D\u4EE4\u3092\u66F8\u304F",
|
|
5273
|
-
declarationInStep: "group \u3068 box \u3068 strip \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
|
|
5274
|
-
stepLineBeforeStep: "\u7DDA\u3068 say \u3068 code \u3068 act \u3068 note \u3068 set \u306F step \u306E\u4E0B\u306B\u66F8\u304F",
|
|
6644
|
+
declarationInStep: "group \u3068 box \u3068 strip \u3068 branch \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
|
|
6645
|
+
stepLineBeforeStep: "\u7DDA\u3068 say \u3068 code \u3068 act \u3068 note \u3068 set \u3068 commit \u3068\u679D\u3092\u5207\u308B\u884C\u306F step \u306E\u4E0B\u306B\u66F8\u304F",
|
|
5275
6646
|
nestedGroup: "group \u306E\u4E2D\u306B group \u306F\u66F8\u3051\u306A\u3044\u3002\u5148\u306B end \u3067\u9589\u3058\u308B",
|
|
5276
6647
|
strayEnd: "end \u306E\u524D\u306B\u3001\u9589\u3058\u308B group \u304C\u7121\u3044",
|
|
5277
6648
|
endTakesNothing: "end \u306E\u5F8C\u308D\u306B\u306F\u4F55\u3082\u66F8\u304B\u306A\u3044",
|
|
@@ -5303,7 +6674,20 @@ var ja2 = () => {
|
|
|
5303
6674
|
reservedId: (id) => `${id} \u306F\u72B6\u614B\u9077\u79FB\u56F3\u306E\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u3067\u3001\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,
|
|
5304
6675
|
intoStart: "start \u3078\u5165\u308B\u7DDA\u306F\u66F8\u3051\u306A\u3044\u3002start \u306F\u59CB\u307E\u308A\u306E\u5370\u3067\u3001\u7DDA\u306F start \u304B\u3089\u51FA\u308B",
|
|
5305
6676
|
outOfFinish: "finish \u304B\u3089\u51FA\u308B\u7DDA\u306F\u66F8\u3051\u306A\u3044\u3002finish \u306F\u7D42\u308F\u308A\u306E\u5370\u3067\u3001\u7DDA\u306F finish \u3078\u5165\u308B",
|
|
5306
|
-
pathNoAttrs: "\u6700\u521D\u306E step \u3088\u308A\u524D\u306E\u7DDA\u306F\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044\u9053\u306A\u306E\u3067\u3001\u5C5E\u6027 (carry \u3068 tag \u3068 side) \u3092\u66F8\u3051\u306A\u3044"
|
|
6677
|
+
pathNoAttrs: "\u6700\u521D\u306E step \u3088\u308A\u524D\u306E\u7DDA\u306F\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044\u9053\u306A\u306E\u3067\u3001\u5C5E\u6027 (carry \u3068 tag \u3068 side) \u3092\u66F8\u3051\u306A\u3044",
|
|
6678
|
+
gitOnly: (word) => `${word} \u306E\u884C\u306F git (\u679D\u5206\u304B\u308C\u306E\u56F3) \u3067\u3060\u3051\u66F8\u3051\u308B`,
|
|
6679
|
+
gitNoGroup: "git (\u679D\u5206\u304B\u308C\u306E\u56F3) \u306B\u306F group \u3092\u66F8\u3051\u306A\u3044\u3002\u679D\u306F branch \u306E\u884C\u3067\u5BA3\u8A00\u3059\u308B",
|
|
6680
|
+
noBranches: "branch \u306E\u884C\u3067\u679D\u3092 1 \u3064\u4EE5\u4E0A\u5BA3\u8A00\u3059\u308B",
|
|
6681
|
+
branchShape: "branch \u306F branch <\u540D\u672D> [note: <\u6DFB\u3048\u66F8\u304D>] \u306E\u5F62\u3067\u66F8\u304F",
|
|
6682
|
+
commitShape: "commit \u306F commit <\u540D\u672D> on <\u679D> [hash: <hash>, note: <\u4E00\u8A00>] \u306E\u5F62\u3067\u66F8\u304F\u3002\u5F53\u3066\u76F4\u3057\u306F copy <commit> \u3092\u3001\u53D6\u308A\u8FBC\u307F\u306F merge <\u679D> \u3092 on <\u679D> \u306E\u5F8C\u308D\u306B\u66F8\u304F",
|
|
6683
|
+
fromShape: "\u679D\u3092\u5207\u308B\u884C\u306F <\u679D> from <commit> \u306E\u5F62\u3067\u66F8\u304F",
|
|
6684
|
+
undeclaredBranch: (id) => `${id} \u3068\u3044\u3046\u679D\u306F\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044`,
|
|
6685
|
+
undeclaredRef: (id) => `${id} \u3068\u3044\u3046\u679D\u306F\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044\u3002\u672D\u3092\u52D5\u304B\u3059\u7DDA\u306F\u679D\u306E\u540D\u672D\u304B HEAD \u304B\u3089\u5F15\u304F`,
|
|
6686
|
+
noCommit: (id) => `${id} \u3068\u3044\u3046 commit \u306F\u307E\u3060\u7A4D\u3093\u3067\u3044\u306A\u3044`,
|
|
6687
|
+
emptyBranch: (id) => `${id} \u306E\u679D\u306F\u307E\u3060\u3069\u306E commit \u3082\u6307\u3057\u3066\u3044\u306A\u3044\u306E\u3067\u53D6\u308A\u8FBC\u3081\u306A\u3044`,
|
|
6688
|
+
mergeSelf: (id) => `${id} \u306F\u7A4D\u3080\u679D\u306A\u306E\u3067\u3001\u53D6\u308A\u8FBC\u3080\u679D\u306B\u3067\u304D\u306A\u3044`,
|
|
6689
|
+
headReserved: (name) => `${name} \u306F\u679D\u5206\u304B\u308C\u306E\u56F3\u3067\u4ECA\u3044\u308B\u5834\u6240\u306E\u672D\u306E\u540D\u524D\u3067\u3001\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,
|
|
6690
|
+
badHash: "hash \u306F 0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 4 \u304B\u3089 40 \u5B57\u306B\u3059\u308B"
|
|
5307
6691
|
};
|
|
5308
6692
|
};
|
|
5309
6693
|
var en2 = () => {
|
|
@@ -5339,8 +6723,8 @@ var en2 = () => {
|
|
|
5339
6723
|
sayTwice: "A step takes one say. Continue a long body on indented lines below it",
|
|
5340
6724
|
codeTwice: "A step takes at most one code line",
|
|
5341
6725
|
emptyCode: "Write the command after code",
|
|
5342
|
-
declarationInStep: "Write group, box and
|
|
5343
|
-
stepLineBeforeStep: "Write lines, say, code, act, note and
|
|
6726
|
+
declarationInStep: "Write group, box, strip and branch before the first step",
|
|
6727
|
+
stepLineBeforeStep: "Write lines, say, code, act, note, set, commit and branch cuts under a step",
|
|
5344
6728
|
nestedGroup: "A group cannot hold another group. Close it with end first",
|
|
5345
6729
|
strayEnd: "There is no group for this end to close",
|
|
5346
6730
|
endTakesNothing: "Write nothing after end",
|
|
@@ -5372,7 +6756,20 @@ var en2 = () => {
|
|
|
5372
6756
|
reservedId: (id) => `${id} names the start or end mark of a state diagram and cannot be a box id`,
|
|
5373
6757
|
intoStart: "A line cannot go into start. start is the start mark, and lines leave it",
|
|
5374
6758
|
outOfFinish: "A line cannot leave finish. finish is the end mark, and lines go into it",
|
|
5375
|
-
pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)"
|
|
6759
|
+
pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)",
|
|
6760
|
+
gitOnly: (word) => `${word} lines can be written only in git diagrams`,
|
|
6761
|
+
gitNoGroup: "A git diagram takes no group. Declare branches with branch lines",
|
|
6762
|
+
noBranches: "Declare at least one branch with a branch line",
|
|
6763
|
+
branchShape: "Write a branch as branch <id> [note: <note>]",
|
|
6764
|
+
commitShape: "Write a commit as commit <id> on <branch> [hash: <hash>, note: <note>]. For a replayed commit add copy <commit>, and for a merge commit add merge <branch>, after on <branch>",
|
|
6765
|
+
fromShape: "Write a branch cut as <branch> from <commit>",
|
|
6766
|
+
undeclaredBranch: (id) => `No branch named ${id} is declared`,
|
|
6767
|
+
undeclaredRef: (id) => `No branch named ${id} is declared. A line that moves a ref starts from a branch id or HEAD`,
|
|
6768
|
+
noCommit: (id) => `No commit named ${id} has been made yet`,
|
|
6769
|
+
emptyBranch: (id) => `Branch ${id} does not point at any commit yet, so it cannot be merged`,
|
|
6770
|
+
mergeSelf: (id) => `${id} is the branch being committed to, so it cannot be the branch merged in`,
|
|
6771
|
+
headReserved: (name) => `${name} names where you are in a git diagram and cannot be an id`,
|
|
6772
|
+
badHash: "Write a hash as 4 to 40 characters of 0-9 and a-f"
|
|
5376
6773
|
};
|
|
5377
6774
|
};
|
|
5378
6775
|
var MESSAGES = { ja: ja2(), en: en2() };
|
|
@@ -5403,6 +6800,9 @@ var NotationError = class extends Error {
|
|
|
5403
6800
|
var fail = (source, index, message) => new NotationError(source.line, columnOf(source, index), message);
|
|
5404
6801
|
var ID = /^[^\s[\]「」=:]+$/u;
|
|
5405
6802
|
var EDGE = /^([^\s:[\]]+?)\s*->\s*([^\s:[\]]+)/du;
|
|
6803
|
+
var COMMIT = new RegExp(`^commit\\s+([^\\s[]+)(?:\\s+${ON}\\s+([^\\s[]+))?(?:\\s+${COPY}\\s+([^\\s[]+))?(?:\\s+${MERGE}\\s+([^\\s[]+))?`, "du");
|
|
6804
|
+
var CUT = new RegExp(`^([^\\s[]+)\\s+${FROM}(?:\\s+([^\\s[]+))?\\s*$`, "du");
|
|
6805
|
+
var HASH = /^[0-9a-f]{4,40}$/u;
|
|
5406
6806
|
var isOneOf = (list2, word) => list2.includes(word);
|
|
5407
6807
|
function skipSpaces(text2, at2) {
|
|
5408
6808
|
let i = at2;
|
|
@@ -5551,6 +6951,10 @@ function parseLines(lines, m) {
|
|
|
5551
6951
|
if (shown && !isOneOf(VIEWS, shown.value)) throw fail(head, shown.at, m.badView);
|
|
5552
6952
|
const view = shown?.value;
|
|
5553
6953
|
const isState = kind === "state";
|
|
6954
|
+
const isGit = kind === "git";
|
|
6955
|
+
const branches = [];
|
|
6956
|
+
const commits = /* @__PURE__ */ new Set();
|
|
6957
|
+
const tips = /* @__PURE__ */ new Map();
|
|
5554
6958
|
const regions = [];
|
|
5555
6959
|
const boxes = [];
|
|
5556
6960
|
const paths = [];
|
|
@@ -5567,13 +6971,27 @@ function parseLines(lines, m) {
|
|
|
5567
6971
|
if (!boxes.some((box) => box.id === id)) throw fail(source, at2, m.undeclaredBox(id));
|
|
5568
6972
|
return id;
|
|
5569
6973
|
};
|
|
6974
|
+
const branchAt = (source, id, at2) => {
|
|
6975
|
+
if (!tips.has(id)) throw fail(source, at2, m.undeclaredBranch(id));
|
|
6976
|
+
return id;
|
|
6977
|
+
};
|
|
6978
|
+
const commitAt = (source, id, at2) => {
|
|
6979
|
+
if (!commits.has(id)) throw fail(source, at2, m.noCommit(id));
|
|
6980
|
+
return id;
|
|
6981
|
+
};
|
|
5570
6982
|
const endAt = (source, id, at2, side2) => {
|
|
6983
|
+
if (isGit) {
|
|
6984
|
+
if (side2 === "to") return commitAt(source, id, at2);
|
|
6985
|
+
if (id !== HEAD && !tips.has(id)) throw fail(source, at2, m.undeclaredRef(id));
|
|
6986
|
+
return id;
|
|
6987
|
+
}
|
|
5571
6988
|
if (!isState || !isOneOf(STATE_ENDS, id)) return boxAt(source, id, at2);
|
|
5572
6989
|
if (id === "start" !== (side2 === "from")) throw fail(source, at2, id === "start" ? m.intoStart : m.outOfFinish);
|
|
5573
6990
|
return id;
|
|
5574
6991
|
};
|
|
5575
6992
|
const notReserved = (source, id, at2) => {
|
|
5576
6993
|
if (isState && isOneOf(STATE_ENDS, id)) throw fail(source, at2, m.reservedId(id));
|
|
6994
|
+
if (isGit && id === HEAD) throw fail(source, at2, m.headReserved(id));
|
|
5577
6995
|
};
|
|
5578
6996
|
const inStep = (source) => {
|
|
5579
6997
|
if (!building) throw fail(source, 0, m.stepLineBeforeStep);
|
|
@@ -5603,7 +7021,13 @@ function parseLines(lines, m) {
|
|
|
5603
7021
|
else inStep(source).events.push(readEdge(source, edge2));
|
|
5604
7022
|
continue;
|
|
5605
7023
|
}
|
|
5606
|
-
const word = text2.split(/\s
|
|
7024
|
+
const [word = "", second] = text2.split(/\s+/u);
|
|
7025
|
+
if (isGit && tips.has(word) && second === FROM) {
|
|
7026
|
+
const step = inStep(source);
|
|
7027
|
+
step.events.push(readCut(source));
|
|
7028
|
+
continue;
|
|
7029
|
+
}
|
|
7030
|
+
if (!isGit && (word === "branch" || word === "commit")) throw fail(source, 0, m.gitOnly(word));
|
|
5607
7031
|
if (!isOneOf(HEADS, word)) {
|
|
5608
7032
|
const old = oldForm(text2, building !== void 0);
|
|
5609
7033
|
throw fail(source, 0, old ? m.oldForm(old.word, old.shape) : m.unknownHead(word));
|
|
@@ -5657,11 +7081,20 @@ function parseLines(lines, m) {
|
|
|
5657
7081
|
case "set":
|
|
5658
7082
|
inStep(source).events.push(readSet(source));
|
|
5659
7083
|
break;
|
|
7084
|
+
case "branch":
|
|
7085
|
+
readBranch(source);
|
|
7086
|
+
break;
|
|
7087
|
+
case "commit": {
|
|
7088
|
+
const step = inStep(source);
|
|
7089
|
+
step.events.push(readCommit(source));
|
|
7090
|
+
break;
|
|
7091
|
+
}
|
|
5660
7092
|
}
|
|
5661
7093
|
}
|
|
5662
7094
|
if (group) throw fail(group.source, 0, m.unclosedGroup(group.id));
|
|
5663
7095
|
finish();
|
|
5664
|
-
if (
|
|
7096
|
+
if (isGit && branches.length === 0) throw fail(head, 0, m.noBranches);
|
|
7097
|
+
if (boxes.length === 0 && !isGit) throw fail(head, 0, m.noBoxes);
|
|
5665
7098
|
if (steps.length === 0) throw fail(head, 0, m.noSteps);
|
|
5666
7099
|
return {
|
|
5667
7100
|
version: FORMAT_VERSION,
|
|
@@ -5673,10 +7106,12 @@ function parseLines(lines, m) {
|
|
|
5673
7106
|
...strip2 ? { strip: strip2 } : {},
|
|
5674
7107
|
steps,
|
|
5675
7108
|
...kind === "sequence" ? { sequence: { lifelines: boxes.map((box) => box.id) } } : {},
|
|
5676
|
-
...paths.length > 0 ? { state: { paths } } : {}
|
|
7109
|
+
...paths.length > 0 ? { state: { paths } } : {},
|
|
7110
|
+
...isGit ? { git: { branches } } : {}
|
|
5677
7111
|
};
|
|
5678
7112
|
function readGroup(source) {
|
|
5679
7113
|
beforeSteps(source);
|
|
7114
|
+
if (isGit) throw fail(source, 0, m.gitNoGroup);
|
|
5680
7115
|
if (group) throw fail(source, 0, m.nestedGroup);
|
|
5681
7116
|
const declared = readDeclared(source, "group", ATTRS.group, m);
|
|
5682
7117
|
if (regions.some((region) => region.id === declared.id)) {
|
|
@@ -5702,6 +7137,62 @@ function parseLines(lines, m) {
|
|
|
5702
7137
|
...group ? { region: group.id } : {}
|
|
5703
7138
|
});
|
|
5704
7139
|
}
|
|
7140
|
+
function readBranch(source) {
|
|
7141
|
+
beforeSteps(source);
|
|
7142
|
+
const declared = readDeclared(source, "branch", ATTRS.branch, m);
|
|
7143
|
+
if (declared.name !== void 0) throw fail(source, 0, m.branchShape);
|
|
7144
|
+
notReserved(source, declared.id, declared.idAt);
|
|
7145
|
+
declare(source, declared.id, declared.idAt);
|
|
7146
|
+
const note = declared.attrs.get("note")?.value;
|
|
7147
|
+
branches.push({ id: declared.id, ...note !== void 0 ? { note } : {} });
|
|
7148
|
+
tips.set(declared.id, null);
|
|
7149
|
+
}
|
|
7150
|
+
function readCommit(source) {
|
|
7151
|
+
const text2 = source.text;
|
|
7152
|
+
const found = COMMIT.exec(text2);
|
|
7153
|
+
const at2 = (k) => found?.indices?.[k]?.[0] ?? 0;
|
|
7154
|
+
const id = found?.[1];
|
|
7155
|
+
const on = found?.[2];
|
|
7156
|
+
if (!found || id === void 0 || on === void 0) throw fail(source, 0, m.commitShape);
|
|
7157
|
+
const rest2 = skipSpaces(text2, found[0].length);
|
|
7158
|
+
if (rest2 < text2.length && text2[rest2] !== "[") throw fail(source, rest2, m.commitShape);
|
|
7159
|
+
if (!ID.test(id)) throw fail(source, at2(1), m.badId(id));
|
|
7160
|
+
notReserved(source, id, at2(1));
|
|
7161
|
+
declare(source, id, at2(1));
|
|
7162
|
+
const branch = branchAt(source, on, at2(2));
|
|
7163
|
+
const copy = found[3] === void 0 ? void 0 : commitAt(source, found[3], at2(3));
|
|
7164
|
+
const merge = found[4] === void 0 ? void 0 : mergedAt(source, found[4], at2(4), branch);
|
|
7165
|
+
const attrs = rest2 < text2.length ? readAttrs(source, rest2, ATTRS.commit, m) : /* @__PURE__ */ new Map();
|
|
7166
|
+
const hash = attrs.get("hash");
|
|
7167
|
+
if (hash && !HASH.test(hash.value)) throw fail(source, hash.at, m.badHash);
|
|
7168
|
+
const note = attrs.get("note")?.value;
|
|
7169
|
+
commits.add(id);
|
|
7170
|
+
if (copy === void 0) tips.set(branch, id);
|
|
7171
|
+
return {
|
|
7172
|
+
type: "commit",
|
|
7173
|
+
id,
|
|
7174
|
+
branch,
|
|
7175
|
+
...copy !== void 0 ? { copy } : {},
|
|
7176
|
+
...merge !== void 0 ? { merge } : {},
|
|
7177
|
+
...hash ? { hash: hash.value } : {},
|
|
7178
|
+
...note !== void 0 ? { note } : {}
|
|
7179
|
+
};
|
|
7180
|
+
}
|
|
7181
|
+
function mergedAt(source, id, at2, into) {
|
|
7182
|
+
branchAt(source, id, at2);
|
|
7183
|
+
if (id === into) throw fail(source, at2, m.mergeSelf(id));
|
|
7184
|
+
if (tips.get(id) === null) throw fail(source, at2, m.emptyBranch(id));
|
|
7185
|
+
return id;
|
|
7186
|
+
}
|
|
7187
|
+
function readCut(source) {
|
|
7188
|
+
const found = CUT.exec(source.text);
|
|
7189
|
+
const branch = found?.[1];
|
|
7190
|
+
const from = found?.[2];
|
|
7191
|
+
if (!found || branch === void 0 || from === void 0) throw fail(source, 0, m.fromShape);
|
|
7192
|
+
commitAt(source, from, found.indices?.[2]?.[0] ?? 0);
|
|
7193
|
+
tips.set(branch, from);
|
|
7194
|
+
return { type: "branch", branch, from };
|
|
7195
|
+
}
|
|
5705
7196
|
function readStrip(source) {
|
|
5706
7197
|
beforeSteps(source);
|
|
5707
7198
|
if (strip2) throw fail(source, 0, m.stripTwice);
|
|
@@ -5775,9 +7266,10 @@ function parseLines(lines, m) {
|
|
|
5775
7266
|
if (carried && !isOneOf(CARRIES, carried.value)) throw fail(source, carried.at, m.badCarry);
|
|
5776
7267
|
const side2 = attrs.get("side");
|
|
5777
7268
|
if (side2 && !isOneOf(SIDES, side2.value)) throw fail(source, side2.at, m.badSide);
|
|
5778
|
-
let carry = { kind: "envelope" };
|
|
7269
|
+
let carry = isGit ? { kind: "tag", text: from } : { kind: "envelope" };
|
|
5779
7270
|
if (tag) carry = { kind: "tag", text: tag.value };
|
|
5780
7271
|
else if (carried) carry = carried.value === "coin" ? { kind: "coin" } : { kind: "none" };
|
|
7272
|
+
if (isGit && from !== HEAD) tips.set(from, to);
|
|
5781
7273
|
return {
|
|
5782
7274
|
type: "edge",
|
|
5783
7275
|
from,
|