@cardenelabs/dragon 0.37.0 → 0.40.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 +38 -1
- package/dist/cli.cjs +2403 -550
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +2408 -555
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +2252 -537
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +3 -1
- package/dist/export.d.ts +3 -1
- package/dist/export.js +2257 -542
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +2387 -495
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -154
- package/dist/index.d.ts +11 -154
- package/dist/index.js +2387 -496
- package/dist/index.js.map +1 -1
- package/dist/ink-B_7OXxtb.d.cts +360 -0
- package/dist/ink-B_7OXxtb.d.ts +360 -0
- package/dist/player.global.js +2 -2
- package/package.json +1 -1
- package/src/cli.ts +9 -0
- package/src/export/index.ts +4 -1
- package/src/field-messages.ts +8 -0
- package/src/figure-text.ts +28 -0
- package/src/index.ts +3 -0
- package/src/layout/architecture.ts +123 -44
- package/src/layout/git.ts +728 -0
- package/src/layout/measure.ts +10 -0
- package/src/layout/scene.ts +300 -19
- package/src/layout/sequence.ts +29 -11
- package/src/layout/state.ts +82 -62
- package/src/look/values.ts +57 -4
- package/src/messages.ts +47 -4
- package/src/parser.ts +142 -7
- package/src/player.ts +44 -0
- package/src/printer.ts +16 -4
- package/src/render/git.ts +161 -0
- package/src/render/ink.ts +104 -0
- package/src/render/parts.ts +103 -36
- package/src/render/svg.ts +63 -15
- 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/words.ts +19 -3
- package/dist/schema-B2MTRv66.d.cts +0 -133
- package/dist/schema-B2MTRv66.d.ts +0 -133
package/dist/export.cjs
CHANGED
|
@@ -268,7 +268,11 @@ var TYPE = {
|
|
|
268
268
|
stepTitle: text(15, 700),
|
|
269
269
|
stepBody: text(13.5, 500),
|
|
270
270
|
stepNo: text(13, 700, "mono"),
|
|
271
|
-
button: text(14, 700)
|
|
271
|
+
button: text(14, 700),
|
|
272
|
+
/** 枝分かれの図 (#3164) の、丸の中の commit の名札と、丸の外に添える hash と一言 */
|
|
273
|
+
gitId: text(11, 700),
|
|
274
|
+
gitHash: text(10.5, 600, "mono"),
|
|
275
|
+
gitNote: text(10.5, 650)
|
|
272
276
|
};
|
|
273
277
|
var LOOK = {
|
|
274
278
|
/** 部品どうしの最小の隙間 */
|
|
@@ -278,7 +282,11 @@ var LOOK = {
|
|
|
278
282
|
box: { h: 72, minW: 92, padX: 12, radius: 12, icon: 24, iconRadius: 7, iconY: -16, iconScale: 0.74, nameY: 12, subY: 27 },
|
|
279
283
|
region: { pad: 18, gap: 10, radius: 14, inset: 14, icon: 24, iconRadius: 7, iconScale: 0.68, nameY: 58, line: 16, minH: 108 },
|
|
280
284
|
architecture: { columns: 4, columnGap: 56, maxColumnGap: 160, rowGap: 44, labelRoom: 16 },
|
|
281
|
-
|
|
285
|
+
/**
|
|
286
|
+
* 時系列図。線の名前の札は、構成図と状態遷移図より線に寄せる (`labelOffset` は線から札の真ん中まで)。
|
|
287
|
+
* 札と線の離れが図の他の空きと同じ 6 になり、行を詰めても札がどの線の名前かが分かる (#3177)。
|
|
288
|
+
*/
|
|
289
|
+
sequence: { columnGap: 40, labelRoom: 16, labelOffset: 16, firstRow: 10, rowGap: 6, stepGap: 6, minPitch: 32, tail: 10, selfW: 34, selfH: 18 },
|
|
282
290
|
/**
|
|
283
291
|
* 状態遷移図 (#3163)。状態は `columns` つずつ並べて次の段へ折り返し、段の間 (`rowGap`) の真ん中を、段をまたぐ線が通る。
|
|
284
292
|
* `start` と `end` は始まりと終わりの印の半径と、印の中の丸の半径。`drop` は最初の状態の上端から始まりの印の中心まで、
|
|
@@ -308,17 +316,60 @@ var LOOK = {
|
|
|
308
316
|
done: { r: 6.5, inset: 13 },
|
|
309
317
|
pastLabel: 0.85
|
|
310
318
|
},
|
|
319
|
+
/**
|
|
320
|
+
* 枝分かれの図 (#3164)。見本帳の試作 (`scenes/git.js`) の寸法を写す。
|
|
321
|
+
* commit は列ごとに `pitch` ずつ右へ並べ、一番上でない帯の commit は列の半分だけ右へずらす。`x0` は最初の列の真ん中の x の下限、
|
|
322
|
+
* `textGap` は隣の列の hash と一言の間に空ける最小の隙間。`r` は丸の半径、`orphan` はどの札からも辿れなくなった commit の点線の丸の半径。
|
|
323
|
+
* `topLine` と `line` は帯の上端から丸を並べる線まで (一番上の帯と、それより下の帯)、`topBelow` と `below` は線から帯の下端まで。
|
|
324
|
+
* `bare` は線の名前を下に置かない帯の、線から帯の下端まで。
|
|
325
|
+
* hash と一言は一番上の帯では丸の上に、ほかの帯では丸の下に置き、`above` と `under` は丸の真ん中から丸に近い行の基準線まで、`lineStep` は行の間。
|
|
326
|
+
* 札は丸の上に段を重ねて置き、`tagTop` と `tag` は丸の真ん中から 1 段目の札の真ん中まで (一番上の帯と、ほかの帯)、`row` は札の段の間。
|
|
327
|
+
* 札の段が 2 段より多い commit がある帯は、多い段の分だけ線を下げる。
|
|
328
|
+
* `turn` は枝へ分かれる線と枝から入る線が曲がり終えて横へ進むまでの長さ、`samples` は曲がりを区切る点の数、`boxGap` は commit の並びと箱の間。
|
|
329
|
+
* `labelUnder` はほかの帯で、丸の真ん中から線の名前の札の上端まで。`colors` は帯の色を上から配る順
|
|
330
|
+
*/
|
|
331
|
+
git: {
|
|
332
|
+
x0: 120,
|
|
333
|
+
pitch: 90,
|
|
334
|
+
textGap: 12,
|
|
335
|
+
r: 12,
|
|
336
|
+
orphan: 13.5,
|
|
337
|
+
topLine: 120,
|
|
338
|
+
line: 90,
|
|
339
|
+
topBelow: 30,
|
|
340
|
+
below: 82,
|
|
341
|
+
bare: 62,
|
|
342
|
+
above: 18,
|
|
343
|
+
under: 27,
|
|
344
|
+
lineStep: 13,
|
|
345
|
+
tagTop: 58,
|
|
346
|
+
tag: 30,
|
|
347
|
+
row: 22,
|
|
348
|
+
turn: 60,
|
|
349
|
+
samples: 12,
|
|
350
|
+
boxGap: 24,
|
|
351
|
+
labelUnder: 50,
|
|
352
|
+
colors: ["blue", "violet", "green", "amber", "rose"]
|
|
353
|
+
},
|
|
311
354
|
/** `bend` は線の曲がりを丸める半径 (#3171) */
|
|
312
355
|
edge: { inset: 3, arrow: 6, arrowHalf: 3.5, parallel: 5, ghostDash: 5, flowDash: 9, bend: 12 },
|
|
313
|
-
|
|
356
|
+
/** `touch` は線の名前と、同じ時刻に見えている段の番号の丸の間に空ける最小の隙間 (#3175) */
|
|
357
|
+
label: { h: 20, padX: 9, radius: 10, offset: 22, side: 14, search: 4, searchMax: 400, soft: 6, touch: 2 },
|
|
314
358
|
action: { h: 22, padX: 10, radius: 11 },
|
|
315
359
|
badge: { r: 9.5, ring: 9, inset: 4, along: 14, short: 44 },
|
|
316
360
|
carrier: { envW: 24, envH: 17, coinR: 6.5, coinIn: 3.8, tagH: 18, tagPadX: 8, samples: 16 },
|
|
361
|
+
/**
|
|
362
|
+
* 運ぶ物の置き場 (#3176)。運ぶ物を出し入れする箱は、絵柄の右に点線の枠を持ち、運ぶ物は着いた後と走り出す前にそこで待つ。
|
|
363
|
+
* `gap` は絵柄と枠の間、`pad` は枠と運ぶ物の間、`spread` は枠の中に横に並べた運ぶ物の間、`h` と `radius` は枠の高さと角の丸み。
|
|
364
|
+
* `clear` は状態遷移図の右上の済んだ印と枠の間に空ける最小の隙間。`lifeline` は時系列図で生存線と運ぶ物の間、
|
|
365
|
+
* `mark` は状態遷移図の始まりの印と、その左で走り出しを待つ運ぶ物の間
|
|
366
|
+
*/
|
|
367
|
+
slot: { gap: 6, pad: 3, spread: 4, h: 24, radius: 7, clear: 2, lifeline: 5, mark: 4 },
|
|
317
368
|
/**
|
|
318
369
|
* `trail` は状態遷移図の帯の最後の、通った状態の点 (#3171)。`r` は点の半径、`step` は点の中心どうしの間、`now` は変わった値の欄の名前の横の点の半径と、名前からの離れ
|
|
319
370
|
*/
|
|
320
371
|
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 } },
|
|
321
|
-
stroke: { 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 },
|
|
372
|
+
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 },
|
|
322
373
|
shadow: { near: 0.8, far: 4, nearY: 1, farY: 3 },
|
|
323
374
|
mini: { w: 168, pad: 8, title: 14, inset: 12, radius: 10 },
|
|
324
375
|
/**
|
|
@@ -332,7 +383,7 @@ var LOOK = {
|
|
|
332
383
|
*/
|
|
333
384
|
follow: { aspect: 0.75, minH: 320, fitMinH: 160, ease: 0.6, narrow: 440, badgeRoom: 8, headRoom: 10, head: { pad: 8, h: 40, nameY: 17, subY: 31 } },
|
|
334
385
|
/** 色を混ぜる割合 (%) */
|
|
335
|
-
mix: { icon: 14, regionIcon: 16, regionIconEdge: 34, cap: 12, capEdge: 42, badgePast: 14, badgePastEdge: 70, mini: 62, miniBand: 16, miniBandEdge: 36, view: 6, side: 4, sideEdge: 36, ghostEdge: 60, path: 55, past: 72 },
|
|
386
|
+
mix: { slot: 45, icon: 14, regionIcon: 16, regionIconEdge: 34, cap: 12, capEdge: 42, badgePast: 14, badgePastEdge: 70, mini: 62, miniBand: 16, miniBandEdge: 36, view: 6, side: 4, sideEdge: 36, ghostEdge: 60, path: 55, past: 72 },
|
|
336
387
|
/** 字の並びの基準線を、置きたい高さの真ん中からどれだけ下げるか */
|
|
337
388
|
baseline: { label: 3.8, badge: 3.5, carrier: 3.7, stripTitle: 4.5, tag: 3.6, action: 3.8, mark: 4 },
|
|
338
389
|
/** 浮いて出る物が下から上がる長さと、弾んで出る物の始まりの大きさ */
|
|
@@ -380,6 +431,8 @@ var EASE = {
|
|
|
380
431
|
};
|
|
381
432
|
|
|
382
433
|
// src/figure-text.ts
|
|
434
|
+
var spaced = (word) => /[0-9A-Za-z]$/u.test(word) ? `${word} ` : word;
|
|
435
|
+
var capital = (text2) => text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
383
436
|
var FIGURE_TEXT = {
|
|
384
437
|
ja: {
|
|
385
438
|
cannotDraw: (detail) => `\u56F3\u3092\u63CF\u3051\u306A\u3044: ${detail}`,
|
|
@@ -394,7 +447,14 @@ var FIGURE_TEXT = {
|
|
|
394
447
|
sideFrom: (count) => `${count} \u3064\u306E\u72B6\u614B\u304B\u3089\u5165\u308C\u308B`,
|
|
395
448
|
trail: "\u901A\u3063\u305F\u72B6\u614B",
|
|
396
449
|
start: "\u59CB\u307E\u308A",
|
|
397
|
-
end: "\u7D42\u308F\u308A"
|
|
450
|
+
end: "\u7D42\u308F\u308A",
|
|
451
|
+
badgeName: (no) => `\u6BB5\u306E\u756A\u53F7 ${no}`,
|
|
452
|
+
quoted: (text2) => `\u300C${text2}\u300D`,
|
|
453
|
+
iconOf: (box) => `\u300C${box} \u306E\u7D75\u67C4\u300D`,
|
|
454
|
+
coin: "\u300C\u786C\u8CA8\u300D",
|
|
455
|
+
envelope: "\u300C\u5C01\u7B52\u300D",
|
|
456
|
+
textsOverlap: (a, b) => `${spaced(a)}\u3068${spaced(b)}\u304C\u91CD\u306A\u308B`,
|
|
457
|
+
lineCrosses: (from, to, text2) => `\u7DDA ${from} \u2192 ${to} \u304C${spaced(text2)}\u3092\u6A2A\u5207\u308B`
|
|
398
458
|
},
|
|
399
459
|
en: {
|
|
400
460
|
cannotDraw: (detail) => `Cannot draw the diagram: ${detail}`,
|
|
@@ -409,7 +469,14 @@ var FIGURE_TEXT = {
|
|
|
409
469
|
sideFrom: (count) => `Enterable from ${count} ${count === 1 ? "state" : "states"}`,
|
|
410
470
|
trail: "States passed",
|
|
411
471
|
start: "Start",
|
|
412
|
-
end: "End"
|
|
472
|
+
end: "End",
|
|
473
|
+
badgeName: (no) => `step number ${no}`,
|
|
474
|
+
quoted: (text2) => `"${text2}"`,
|
|
475
|
+
iconOf: (box) => `the icon of "${box}"`,
|
|
476
|
+
coin: "the coin",
|
|
477
|
+
envelope: "the envelope",
|
|
478
|
+
textsOverlap: (a, b) => capital(`${a} and ${b} overlap`),
|
|
479
|
+
lineCrosses: (from, to, text2) => `The line ${from} \u2192 ${to} crosses ${text2}`
|
|
413
480
|
}
|
|
414
481
|
};
|
|
415
482
|
|
|
@@ -424,6 +491,10 @@ function textWidth(text2, style) {
|
|
|
424
491
|
for (const ch of text2) sum += advance(ch, family);
|
|
425
492
|
return sum * style.size / EM;
|
|
426
493
|
}
|
|
494
|
+
function textBox(text2, x, y, style, anchor = "start") {
|
|
495
|
+
const w = textWidth(text2, style);
|
|
496
|
+
return { x: anchor === "middle" ? x - w / 2 : x, y: y - style.size * 0.8, w, h: style.size };
|
|
497
|
+
}
|
|
427
498
|
|
|
428
499
|
// src/layout/scene.ts
|
|
429
500
|
function edgesOf(diagram) {
|
|
@@ -458,11 +529,93 @@ function boxWidth(diagram, id, withActions) {
|
|
|
458
529
|
}
|
|
459
530
|
return Math.max(LOOK.box.minW, Math.max(...lines) + LOOK.box.padX * 2);
|
|
460
531
|
}
|
|
532
|
+
function carrierHalf(carry) {
|
|
533
|
+
const C = LOOK.carrier;
|
|
534
|
+
if (carry.kind === "tag") return [(textWidth(carry.text, hasWide(carry.text) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2) / 2, C.tagH / 2];
|
|
535
|
+
if (carry.kind === "coin") return [C.coinR, C.coinR];
|
|
536
|
+
return [C.envW / 2, C.envH / 2];
|
|
537
|
+
}
|
|
538
|
+
var roomWidth = (room) => room.main + room.coin + (room.main > 0 && room.coin > 0 ? LOOK.slot.spread : 0);
|
|
539
|
+
function slotRooms(diagram) {
|
|
540
|
+
const rooms = /* @__PURE__ */ new Map();
|
|
541
|
+
const ids = new Set(diagram.boxes.map((b) => b.id));
|
|
542
|
+
for (const step of diagram.steps) {
|
|
543
|
+
for (const event of step.events) {
|
|
544
|
+
if (event.type !== "edge" || event.carry.kind === "none") continue;
|
|
545
|
+
const who = event.carry.kind === "coin" ? "coin" : "main";
|
|
546
|
+
const w = carrierHalf(event.carry)[0] * 2;
|
|
547
|
+
for (const id of [event.from, event.to]) {
|
|
548
|
+
if (!ids.has(id)) continue;
|
|
549
|
+
const room = rooms.get(id) ?? { main: 0, coin: 0 };
|
|
550
|
+
room[who] = Math.max(room[who], w);
|
|
551
|
+
rooms.set(id, room);
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return rooms;
|
|
556
|
+
}
|
|
557
|
+
function slotBoxWidth(room, icon, right) {
|
|
558
|
+
if (!room) return 0;
|
|
559
|
+
return (icon ? LOOK.box.icon + LOOK.slot.gap : 0) + roomWidth(room) + LOOK.slot.pad * 2 + LOOK.box.padX + right;
|
|
560
|
+
}
|
|
561
|
+
function placeSlot(box, room, right = LOOK.box.padX) {
|
|
562
|
+
if (!room) return;
|
|
563
|
+
const B = LOOK.box;
|
|
564
|
+
const S2 = LOOK.slot;
|
|
565
|
+
const w = roomWidth(room) + S2.pad * 2;
|
|
566
|
+
const lead = box.icon ? B.icon + S2.gap : 0;
|
|
567
|
+
const left = Math.max(box.x + B.padX, Math.min(box.cx - (lead + w) / 2, box.x + box.w - right - (lead + w)));
|
|
568
|
+
if (box.icon) box.iconX = left + B.icon / 2;
|
|
569
|
+
box.slot = { x: left + lead, y: box.cy + B.iconY - S2.h / 2, w, h: S2.h };
|
|
570
|
+
}
|
|
571
|
+
function seatCarriers(edges, boxes, rooms) {
|
|
572
|
+
const S2 = LOOK.slot;
|
|
573
|
+
const seat = (id, carry) => {
|
|
574
|
+
const box = boxes.get(id);
|
|
575
|
+
const room = rooms.get(id);
|
|
576
|
+
if (!box?.slot || !room) return void 0;
|
|
577
|
+
const inner = box.slot.x + S2.pad;
|
|
578
|
+
const y = box.slot.y + box.slot.h / 2;
|
|
579
|
+
if (room.main > 0 && room.coin > 0) return carry.kind === "coin" ? [inner + room.main + S2.spread + room.coin / 2, y] : [inner + room.main / 2, y];
|
|
580
|
+
return [box.slot.x + box.slot.w / 2, y];
|
|
581
|
+
};
|
|
582
|
+
for (const edge2 of edges) {
|
|
583
|
+
if (edge2.carry.kind === "none") continue;
|
|
584
|
+
const settle = seat(edge2.to, edge2.carry);
|
|
585
|
+
const wait = seat(edge2.from, edge2.carry);
|
|
586
|
+
if (settle) edge2.settle = settle;
|
|
587
|
+
if (wait) edge2.wait = wait;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
461
590
|
function gapBetween(a, b) {
|
|
462
591
|
const dx = Math.max(b.x - (a.x + a.w), a.x - (b.x + b.w));
|
|
463
592
|
const dy = Math.max(b.y - (a.y + a.h), a.y - (b.y + b.h));
|
|
464
593
|
return Math.max(dx, dy);
|
|
465
594
|
}
|
|
595
|
+
function crossesRect(points, rect, inset = 0) {
|
|
596
|
+
const x0 = rect.x + inset;
|
|
597
|
+
const y0 = rect.y + inset;
|
|
598
|
+
const x1 = rect.x + rect.w - inset;
|
|
599
|
+
const y1 = rect.y + rect.h - inset;
|
|
600
|
+
if (x1 <= x0 || y1 <= y0) return false;
|
|
601
|
+
for (let i = 1; i < points.length; i++) {
|
|
602
|
+
const [ax, ay] = points[i - 1];
|
|
603
|
+
const [bx, by] = points[i];
|
|
604
|
+
const dx = bx - ax;
|
|
605
|
+
const dy = by - ay;
|
|
606
|
+
let lo = 0;
|
|
607
|
+
let hi = 1;
|
|
608
|
+
const cut = (p, q) => {
|
|
609
|
+
if (p === 0) return q > 0;
|
|
610
|
+
const r = q / p;
|
|
611
|
+
if (p < 0) lo = Math.max(lo, r);
|
|
612
|
+
else hi = Math.min(hi, r);
|
|
613
|
+
return lo < hi;
|
|
614
|
+
};
|
|
615
|
+
if (cut(-dx, ax - x0) && cut(dx, x1 - ax) && cut(-dy, ay - y0) && cut(dy, y1 - ay)) return true;
|
|
616
|
+
}
|
|
617
|
+
return false;
|
|
618
|
+
}
|
|
466
619
|
function longest(points) {
|
|
467
620
|
let best = { a: points[0], b: points[1] ?? points[0], length: -1 };
|
|
468
621
|
for (let i = 1; i < points.length; i++) {
|
|
@@ -493,34 +646,122 @@ function pathLength(points) {
|
|
|
493
646
|
}
|
|
494
647
|
return sum;
|
|
495
648
|
}
|
|
496
|
-
function
|
|
649
|
+
function loopUnder(box) {
|
|
650
|
+
const { w, h, samples } = LOOK.state.loop;
|
|
651
|
+
const bottom = box.y + box.h;
|
|
652
|
+
const p0 = [box.cx + w / 2, bottom];
|
|
653
|
+
const c1 = [box.cx + w * 3 / 4, bottom + h * 4 / 3];
|
|
654
|
+
const c2 = [box.cx - w * 3 / 4, bottom + h * 4 / 3];
|
|
655
|
+
const p3 = [box.cx - w / 2, bottom + LOOK.edge.inset];
|
|
656
|
+
return Array.from({ length: samples + 1 }, (_, k) => {
|
|
657
|
+
const t = k / samples;
|
|
658
|
+
const u = 1 - t;
|
|
659
|
+
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];
|
|
660
|
+
return [at2(0), at2(1)];
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
function loopBadge(points) {
|
|
664
|
+
const right = Math.max(...points.map(([px]) => px));
|
|
665
|
+
const top = points[0][1];
|
|
666
|
+
const deep = Math.max(...points.map(([, py]) => py));
|
|
667
|
+
return [right + LOOK.badge.r + LOOK.badge.inset, top + (deep - top) * LOOK.state.loop.badgeAt];
|
|
668
|
+
}
|
|
669
|
+
function loopLabelBase(points, w) {
|
|
670
|
+
return { x: (points[0]?.[0] ?? 0) - LOOK.state.loop.w / 2 - w / 2, y: Math.max(...points.map(([, y]) => y)) + LOOK.label.soft };
|
|
671
|
+
}
|
|
672
|
+
var LOOP_ROOM = LOOK.state.loop.h + LOOK.label.soft * 2 + LOOK.label.h;
|
|
673
|
+
function badgeOnPath(points, taken = [], lines = []) {
|
|
674
|
+
const length = pathLength(points);
|
|
675
|
+
const first = length < LOOK.badge.short ? Math.min(LOOK.badge.r + 1, length / 2) : LOOK.badge.along;
|
|
676
|
+
const apart = LOOK.badge.r * 2 + LOOK.badge.inset;
|
|
677
|
+
for (let d = first; d <= length; d += 1) {
|
|
678
|
+
const p = along(points, d);
|
|
679
|
+
if (taken.every(([x, y]) => Math.hypot(p[0] - x, p[1] - y) >= apart)) return p;
|
|
680
|
+
}
|
|
681
|
+
return besideLine(points, first, taken, lines) ?? along(points, first);
|
|
682
|
+
}
|
|
683
|
+
function besideLine(points, at2, taken, lines) {
|
|
497
684
|
const length = pathLength(points);
|
|
498
|
-
|
|
685
|
+
const [px, py] = along(points, at2);
|
|
686
|
+
const [ax, ay] = along(points, Math.max(0, at2 - 1));
|
|
687
|
+
const [bx, by] = along(points, Math.min(length, at2 + 1));
|
|
688
|
+
const n = Math.hypot(bx - ax, by - ay);
|
|
689
|
+
if (n === 0) return void 0;
|
|
690
|
+
const [nx, ny] = [-(by - ay) / n, (bx - ax) / n];
|
|
691
|
+
const size = LOOK.badge.r * 2;
|
|
692
|
+
for (const margin of [LOOK.edge.arrowHalf, 0]) {
|
|
693
|
+
for (let s = 1; s <= size + LOOK.badge.inset; s++) {
|
|
694
|
+
for (const sign of [1, -1]) {
|
|
695
|
+
const c = [px + nx * s * sign, py + ny * s * sign];
|
|
696
|
+
const free = taken.every(([x, y]) => Math.max(Math.abs(c[0] - x), Math.abs(c[1] - y)) >= size + 1);
|
|
697
|
+
if (free && lines.every((line) => !crossesRect(line, badgeRect(c), -margin))) return c;
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
return void 0;
|
|
702
|
+
}
|
|
703
|
+
var lineKey = (edge2) => edge2.points.map(([x, y]) => `${Math.round(x * 10)},${Math.round(y * 10)}`).join(" ");
|
|
704
|
+
function lineBadges(edges, steps, at2 = (edge2, taken, lines) => badgeOnPath(edge2.points, taken, lines)) {
|
|
705
|
+
const out = /* @__PURE__ */ new Map();
|
|
706
|
+
const taken = [];
|
|
707
|
+
const placed = /* @__PURE__ */ new Map();
|
|
708
|
+
for (let s = 0; s < steps; s++) {
|
|
709
|
+
const edge2 = edges.find((e) => e.step === s && e.points.length > 0);
|
|
710
|
+
if (!edge2) continue;
|
|
711
|
+
const key = lineKey(edge2);
|
|
712
|
+
const before = placed.get(key);
|
|
713
|
+
if (before) {
|
|
714
|
+
out.set(s, { point: before, edge: edge2 });
|
|
715
|
+
continue;
|
|
716
|
+
}
|
|
717
|
+
const lines = edges.filter((e) => e.points.length > 1 && lineKey(e) !== key).map((e) => e.points);
|
|
718
|
+
const point = at2(edge2, taken, lines);
|
|
719
|
+
taken.push(point);
|
|
720
|
+
placed.set(key, point);
|
|
721
|
+
out.set(s, { point, edge: edge2 });
|
|
722
|
+
}
|
|
723
|
+
return out;
|
|
724
|
+
}
|
|
725
|
+
function replaceSameSpot(badges2) {
|
|
726
|
+
const same2 = (a, b) => Math.hypot(a.x - b.x, a.y - b.y) <= 0.5;
|
|
727
|
+
return badges2.map((badge2) => {
|
|
728
|
+
const next = badges2.filter((other) => other.step > badge2.step && same2(other, badge2)).sort((a, b) => a.step - b.step)[0];
|
|
729
|
+
return next ? { ...badge2, until: next.step } : badge2;
|
|
730
|
+
});
|
|
499
731
|
}
|
|
732
|
+
var badgeRect = ([x, y]) => ({ x: x - LOOK.badge.r, y: y - LOOK.badge.r, w: LOOK.badge.r * 2, h: LOOK.badge.r * 2 });
|
|
733
|
+
var markText = (e) => [e.x + LOOK.state.text, e.y + LOOK.baseline.mark];
|
|
500
734
|
var labelStyle = (text2) => hasWide(text2) ? TYPE.labelJa : TYPE.label;
|
|
735
|
+
var OPPOSITE = { above: "below", below: "above", left: "right", right: "left" };
|
|
501
736
|
function placeLabel(request, obstacles) {
|
|
502
737
|
const w = textWidth(request.text, labelStyle(request.text)) + LOOK.label.padX * 2;
|
|
503
738
|
const h = LOOK.label.h;
|
|
504
739
|
const segment = longest(request.points);
|
|
505
740
|
const mx = (segment.a[0] + segment.b[0]) / 2;
|
|
506
741
|
const my = (segment.a[1] + segment.b[1]) / 2;
|
|
507
|
-
const
|
|
508
|
-
const {
|
|
509
|
-
const
|
|
510
|
-
const
|
|
511
|
-
const
|
|
512
|
-
const
|
|
513
|
-
const clear = (rect) => obstacles.hard.every((box) => gapBetween(rect, box) >= LOOK.gap) && obstacles.soft.every((other) => gapBetween(rect, other) >= LOOK.label.soft);
|
|
742
|
+
const preferred = request.side ?? (segment.vertical ? "right" : "above");
|
|
743
|
+
const { side: sideGap } = LOOK.label;
|
|
744
|
+
const offset = request.offset ?? LOOK.label.offset;
|
|
745
|
+
const baseOf = (side2) => side2 === "above" ? { x: mx - w / 2, y: my - offset - h / 2, w, h } : side2 === "below" ? { x: mx - w / 2, y: my + offset - h / 2, w, h } : side2 === "left" ? { x: mx - sideGap - w, y: my - h / 2, w, h } : { x: mx + sideGap, y: my - h / 2, w, h };
|
|
746
|
+
const first = request.base ? { ...request.base, w, h } : baseOf(preferred);
|
|
747
|
+
const sides = request.flip ? [preferred, OPPOSITE[preferred]] : [preferred];
|
|
748
|
+
const clear = (rect) => obstacles.hard.every((box) => gapBetween(rect, box) >= LOOK.gap) && obstacles.soft.every((other) => gapBetween(rect, other) >= LOOK.label.soft) && (obstacles.touch ?? []).every((mark) => gapBetween(rect, mark) >= LOOK.label.touch) && (obstacles.lines ?? []).every((line) => !crossesRect(line, rect, -2));
|
|
514
749
|
const { search, searchMax } = LOOK.label;
|
|
515
750
|
for (let d = 0; d <= searchMax; d += search) {
|
|
516
|
-
for (
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
751
|
+
for (const side2 of sides) {
|
|
752
|
+
const base = side2 === preferred ? first : baseOf(side2);
|
|
753
|
+
const away = side2 === "above" ? [0, -1] : side2 === "below" ? [0, 1] : side2 === "left" ? [-1, 0] : [1, 0];
|
|
754
|
+
const slideAxis = [Math.abs(away[1]), Math.abs(away[0])];
|
|
755
|
+
const slideMax = request.slide ?? (side2 === "above" || side2 === "below" ? w : h * 4);
|
|
756
|
+
for (let s = 0; s <= slideMax; s += search) {
|
|
757
|
+
for (const sign of s === 0 ? [1] : [1, -1]) {
|
|
758
|
+
const rect = { x: base.x + away[0] * d + slideAxis[0] * s * sign, y: base.y + away[1] * d + slideAxis[1] * s * sign, w, h };
|
|
759
|
+
if (clear(rect)) return { ...rect, step: request.step, event: request.event, text: request.text, family: labelStyle(request.text).family, color: request.color };
|
|
760
|
+
}
|
|
520
761
|
}
|
|
521
762
|
}
|
|
522
763
|
}
|
|
523
|
-
return { ...
|
|
764
|
+
return { ...first, step: request.step, event: request.event, text: request.text, family: labelStyle(request.text).family, color: request.color };
|
|
524
765
|
}
|
|
525
766
|
function fieldWidth(diagram, name) {
|
|
526
767
|
let value = 0;
|
|
@@ -575,6 +816,8 @@ function shiftContent(layout, dx, dy) {
|
|
|
575
816
|
move(box);
|
|
576
817
|
box.cx += dx;
|
|
577
818
|
box.cy += dy;
|
|
819
|
+
if (box.slot) move(box.slot);
|
|
820
|
+
if (box.iconX !== void 0) box.iconX += dx;
|
|
578
821
|
}
|
|
579
822
|
for (const region of layout.regions) {
|
|
580
823
|
region.y += dy;
|
|
@@ -588,6 +831,7 @@ function shiftContent(layout, dx, dy) {
|
|
|
588
831
|
for (const edge2 of layout.edges) {
|
|
589
832
|
edge2.points = edge2.points.map(([px, py]) => [px + dx, py + dy]);
|
|
590
833
|
if (edge2.settle) edge2.settle = [edge2.settle[0] + dx, edge2.settle[1] + dy];
|
|
834
|
+
if (edge2.wait) edge2.wait = [edge2.wait[0] + dx, edge2.wait[1] + dy];
|
|
591
835
|
}
|
|
592
836
|
for (const label2 of layout.labels) move(label2);
|
|
593
837
|
for (const path2 of layout.paths) {
|
|
@@ -621,11 +865,11 @@ function cornerBadge(events, step, layout) {
|
|
|
621
865
|
for (const event of events) {
|
|
622
866
|
const id = event.type === "swap" || event.type === "action" ? event.box : void 0;
|
|
623
867
|
const box2 = layout.boxes.find((b) => b.id === id);
|
|
624
|
-
if (box2) return { step, x: box2.x
|
|
868
|
+
if (box2) return { step, x: box2.x, y: box2.y, color: box2.color };
|
|
625
869
|
}
|
|
626
870
|
if (layout.strip && events.some((event) => event.type === "strip")) return { step, x: layout.strip.x + inset, y: layout.strip.y + inset, color: "slate" };
|
|
627
871
|
const box = layout.boxes[0];
|
|
628
|
-
return { step, x: box.x
|
|
872
|
+
return { step, x: box.x, y: box.y, color: box.color };
|
|
629
873
|
}
|
|
630
874
|
|
|
631
875
|
// src/layout/architecture.ts
|
|
@@ -724,7 +968,8 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
724
968
|
const regionColor = regionColors(diagram);
|
|
725
969
|
const edges = edgesOf(diagram);
|
|
726
970
|
const columnCount = Math.max(1, ...[...slots.values()].map((s) => s.col + 1));
|
|
727
|
-
const
|
|
971
|
+
const carriedIn = slotRooms(diagram);
|
|
972
|
+
const widths = new Map(diagram.boxes.map((b) => [b.id, Math.max(boxWidth(diagram, b.id, true), slotBoxWidth(carriedIn.get(b.id), b.icon !== void 0, B.padX))]));
|
|
728
973
|
const colW = Array.from({ length: columnCount }, (_, c) => Math.max(B.minW, ...[...slots].filter(([, s]) => s.col === c).map(([id]) => widths.get(id) ?? B.minW)));
|
|
729
974
|
const between = Array.from({ length: Math.max(0, columnCount - 1) }, () => A.columnGap);
|
|
730
975
|
for (const { edge: edge2 } of edges) {
|
|
@@ -739,7 +984,13 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
739
984
|
const headerW = Math.max(0, ...headers.map((h) => h ? h.w + R.inset * 2 : 0));
|
|
740
985
|
const colLeft = [];
|
|
741
986
|
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]);
|
|
742
|
-
const
|
|
987
|
+
const center2 = (c) => colLeft[c] + colW[c] / 2;
|
|
988
|
+
const looped = new Set(edges.filter(({ edge: edge2 }) => edge2.from === edge2.to).map(({ edge: edge2 }) => edge2.from));
|
|
989
|
+
const loopRows = new Set([...looped].flatMap((id) => {
|
|
990
|
+
const slot = slots.get(id);
|
|
991
|
+
return slot ? [`${slot.group}:${slot.row}`] : [];
|
|
992
|
+
}));
|
|
993
|
+
const loopRoom = (g, row) => loopRows.has(`${g}:${row}`) ? LOOP_ROOM : 0;
|
|
743
994
|
const boxes = [];
|
|
744
995
|
const bands = [];
|
|
745
996
|
let cursor = margin;
|
|
@@ -747,12 +998,14 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
747
998
|
const rows = Math.max(1, ...group.members.map((id) => (slots.get(id)?.row ?? 0) + 1));
|
|
748
999
|
const room = rooms[g];
|
|
749
1000
|
const top = cursor + R.pad + room.top;
|
|
1001
|
+
const rowTop = [0];
|
|
1002
|
+
for (let r = 1; r < rows; r++) rowTop.push(rowTop[r - 1] + B.h + A.rowGap + loopRoom(g, r - 1));
|
|
750
1003
|
for (const id of group.members) {
|
|
751
1004
|
const slot = slots.get(id);
|
|
752
1005
|
const source = diagram.boxes.find((b) => b.id === id);
|
|
753
1006
|
const w = widths.get(id) ?? B.minW;
|
|
754
|
-
const cx =
|
|
755
|
-
const y = top + slot.row
|
|
1007
|
+
const cx = center2(slot.col);
|
|
1008
|
+
const y = top + rowTop[slot.row];
|
|
756
1009
|
boxes.push({
|
|
757
1010
|
id,
|
|
758
1011
|
name: source?.name ?? id,
|
|
@@ -767,29 +1020,36 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
767
1020
|
cy: y + B.h / 2
|
|
768
1021
|
});
|
|
769
1022
|
}
|
|
770
|
-
const
|
|
1023
|
+
const contentBottom2 = top + rowTop[rows - 1] + B.h + loopRoom(g, rows - 1);
|
|
771
1024
|
const header = headers[g];
|
|
772
|
-
const h = Math.max(
|
|
1025
|
+
const h = Math.max(contentBottom2 + R.pad + room.bottom - cursor, header ? header.h + R.inset * 2 : 0, group.region ? R.minH : 0);
|
|
773
1026
|
bands.push({ group: g, y: cursor, h, rows });
|
|
774
1027
|
cursor += h + R.gap;
|
|
775
1028
|
});
|
|
776
1029
|
const bandsBottom = cursor - R.gap;
|
|
1030
|
+
for (const box of boxes) placeSlot(box, carriedIn.get(box.id));
|
|
777
1031
|
const byId = new Map(boxes.map((b) => [b.id, b]));
|
|
778
1032
|
const bandOf = (id) => bands[slots.get(id)?.group ?? 0];
|
|
779
|
-
const
|
|
780
|
-
if (box.id === a || box.id === b) return false;
|
|
781
|
-
const pad2 = LOOK.label.search;
|
|
1033
|
+
const crosses = (points, rect, pad2) => {
|
|
782
1034
|
for (let i = 1; i < points.length; i++) {
|
|
783
1035
|
const [x1, y1] = points[i - 1];
|
|
784
1036
|
const [x2, y2] = points[i];
|
|
785
|
-
if (Math.min(x1, x2) <=
|
|
1037
|
+
if (Math.min(x1, x2) <= rect.x + rect.w + pad2 && Math.max(x1, x2) >= rect.x - pad2 && Math.min(y1, y2) <= rect.y + rect.h + pad2 && Math.max(y1, y2) >= rect.y - pad2) return true;
|
|
786
1038
|
}
|
|
787
1039
|
return false;
|
|
1040
|
+
};
|
|
1041
|
+
const loopZones = [...looped].flatMap((id) => {
|
|
1042
|
+
const box = byId.get(id);
|
|
1043
|
+
return box ? [{ x: box.x, y: box.y + box.h, w: box.w, h: LOOP_ROOM }] : [];
|
|
788
1044
|
});
|
|
1045
|
+
const onLoop = (points) => loopZones.some((zone) => crosses(points, zone, 0));
|
|
1046
|
+
const blocked = (points, a, b) => boxes.some((box) => box.id !== a && box.id !== b && crosses(points, box, LOOK.label.search)) || onLoop(points);
|
|
789
1047
|
const laneBelow = (id) => {
|
|
790
1048
|
const box = byId.get(id);
|
|
791
1049
|
const band2 = bandOf(id);
|
|
792
|
-
|
|
1050
|
+
const slot = slots.get(id);
|
|
1051
|
+
const under = box.y + box.h + (slot ? loopRoom(slot.group, slot.row) : 0);
|
|
1052
|
+
return (slot?.row ?? 0) < band2.rows - 1 ? under + A.rowGap / 2 : Math.min(under + R.pad / 2, band2.y + band2.h - LOOK.edge.inset);
|
|
793
1053
|
};
|
|
794
1054
|
const laneAbove = (id) => {
|
|
795
1055
|
const box = byId.get(id);
|
|
@@ -797,9 +1057,11 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
797
1057
|
return (slots.get(id)?.row ?? 0) > 0 ? box.y - A.rowGap / 2 : Math.max(box.y - R.pad / 2, band2.y + LOOK.edge.inset);
|
|
798
1058
|
};
|
|
799
1059
|
const inset = LOOK.edge.inset;
|
|
1060
|
+
const gapX = (col, toRight) => toRight ? colLeft[col] + colW[col] + (between[col] ?? A.columnGap) / 2 : colLeft[col] - (between[col - 1] ?? A.columnGap) / 2;
|
|
800
1061
|
const route = (from, to) => {
|
|
801
1062
|
const a = byId.get(from);
|
|
802
1063
|
const b = byId.get(to);
|
|
1064
|
+
if (from === to) return loopUnder(a);
|
|
803
1065
|
const sa = slots.get(from);
|
|
804
1066
|
const sb = slots.get(to);
|
|
805
1067
|
if (sa.group === sb.group && sa.row === sb.row) {
|
|
@@ -809,13 +1071,22 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
809
1071
|
[right2 ? b.x - inset : b.x + b.w + inset, b.cy]
|
|
810
1072
|
];
|
|
811
1073
|
if (!blocked(straight, from, to)) return straight;
|
|
812
|
-
const
|
|
813
|
-
|
|
1074
|
+
const below = laneBelow(from);
|
|
1075
|
+
const under = [
|
|
814
1076
|
[a.cx, a.y + a.h],
|
|
815
|
-
[a.cx,
|
|
816
|
-
[b.cx,
|
|
1077
|
+
[a.cx, below],
|
|
1078
|
+
[b.cx, below],
|
|
817
1079
|
[b.cx, b.y + b.h + inset]
|
|
818
1080
|
];
|
|
1081
|
+
if (!onLoop(under)) return under;
|
|
1082
|
+
const above = laneAbove(from);
|
|
1083
|
+
const over = [
|
|
1084
|
+
[a.cx, a.y],
|
|
1085
|
+
[a.cx, above],
|
|
1086
|
+
[b.cx, above],
|
|
1087
|
+
[b.cx, b.y - inset]
|
|
1088
|
+
];
|
|
1089
|
+
return onLoop(over) ? under : over;
|
|
819
1090
|
}
|
|
820
1091
|
const down = b.cy > a.cy;
|
|
821
1092
|
const leave = [a.cx, down ? a.y + a.h : a.y];
|
|
@@ -823,7 +1094,7 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
823
1094
|
if (sa.col === sb.col) {
|
|
824
1095
|
const straight = [leave, enter];
|
|
825
1096
|
if (!blocked(straight, from, to)) return straight;
|
|
826
|
-
const x =
|
|
1097
|
+
const x = gapX(sa.col, true);
|
|
827
1098
|
return [
|
|
828
1099
|
[a.x + a.w, a.cy],
|
|
829
1100
|
[x, a.cy],
|
|
@@ -838,21 +1109,34 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
838
1109
|
[[right ? a.x + a.w : a.x, a.cy], [b.cx, a.cy], enter],
|
|
839
1110
|
[leave, [a.cx, lane], [b.cx, lane], enter]
|
|
840
1111
|
];
|
|
1112
|
+
if (looped.has(from) || looped.has(to)) {
|
|
1113
|
+
const ax = gapX(sa.col, right);
|
|
1114
|
+
const bx = gapX(sb.col, !right);
|
|
1115
|
+
const out = [
|
|
1116
|
+
[right ? a.x + a.w : a.x, a.cy],
|
|
1117
|
+
[ax, a.cy]
|
|
1118
|
+
];
|
|
1119
|
+
const side2 = [right ? b.x - inset : b.x + b.w + inset, b.cy];
|
|
1120
|
+
candidates.push(
|
|
1121
|
+
[...out, [ax, b.cy], side2],
|
|
1122
|
+
[...out, [ax, lane], [b.cx, lane], enter],
|
|
1123
|
+
[leave, [a.cx, lane], [bx, lane], [bx, b.cy], side2],
|
|
1124
|
+
[...out, [ax, lane], [bx, lane], [bx, b.cy], side2]
|
|
1125
|
+
);
|
|
1126
|
+
}
|
|
841
1127
|
return candidates.find((points) => !blocked(points, from, to)) ?? candidates[2];
|
|
842
1128
|
};
|
|
843
|
-
const sceneEdges = edges.map(({ step, event, edge: edge2 }) => {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
};
|
|
855
|
-
});
|
|
1129
|
+
const sceneEdges = edges.map(({ step, event, edge: edge2 }) => ({
|
|
1130
|
+
step,
|
|
1131
|
+
event,
|
|
1132
|
+
from: edge2.from,
|
|
1133
|
+
to: edge2.to,
|
|
1134
|
+
points: route(edge2.from, edge2.to),
|
|
1135
|
+
color: edgeColor(edge2, colors),
|
|
1136
|
+
carry: edge2.carry
|
|
1137
|
+
}));
|
|
1138
|
+
seatCarriers(sceneEdges, byId, carriedIn);
|
|
1139
|
+
const outward = /* @__PURE__ */ new Map();
|
|
856
1140
|
for (const edge2 of sceneEdges) {
|
|
857
1141
|
if (edge2.points.length !== 2) continue;
|
|
858
1142
|
const back = sceneEdges.some((other) => other.from === edge2.to && other.to === edge2.from && other.points.length === 2);
|
|
@@ -861,6 +1145,7 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
861
1145
|
const flat = Math.abs(q[1] - p[1]) < Math.abs(q[0] - p[0]);
|
|
862
1146
|
const d = (edge2.from < edge2.to ? 1 : -1) * LOOK.edge.parallel;
|
|
863
1147
|
edge2.points = edge2.points.map(([x, y]) => flat ? [x, y + d] : [x + d, y]);
|
|
1148
|
+
outward.set(edge2, flat ? d > 0 ? "below" : "above" : d > 0 ? "right" : "left");
|
|
864
1149
|
}
|
|
865
1150
|
const regions = [];
|
|
866
1151
|
groups.forEach((group, g) => {
|
|
@@ -880,15 +1165,20 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
880
1165
|
header: { x: margin + R.inset, y: band2.y + R.inset, w: header.w, h: header.h }
|
|
881
1166
|
});
|
|
882
1167
|
});
|
|
1168
|
+
const badgeAt = (edge2, taken, lines2) => edge2.from === edge2.to ? loopBadge(edge2.points) : badgeOnPath(edge2.points, taken, lines2);
|
|
1169
|
+
const early = lineBadges(sceneEdges, diagram.steps.length, badgeAt);
|
|
883
1170
|
const labels = [];
|
|
884
1171
|
for (const edge2 of sceneEdges) {
|
|
885
1172
|
const source = diagram.steps[edge2.step]?.events[edge2.event];
|
|
886
1173
|
if (source?.type !== "edge" || source.label === void 0) continue;
|
|
1174
|
+
const seen = [...early].filter(([s]) => s <= edge2.step).map(([, b]) => badgeRect(b.point));
|
|
887
1175
|
const soft = [...regions.map((r) => r.header), ...labels.filter((l) => l.step === edge2.step)];
|
|
1176
|
+
const side2 = source.labelSide ?? outward.get(edge2);
|
|
1177
|
+
const below = edge2.from === edge2.to ? { side: "below", base: loopLabelBase(edge2.points, textWidth(source.label, labelStyle(source.label)) + LOOK.label.padX * 2) } : void 0;
|
|
888
1178
|
labels.push(
|
|
889
1179
|
placeLabel(
|
|
890
|
-
{ step: edge2.step, event: edge2.event, text: source.label, points: edge2.points, color: edge2.color, ...
|
|
891
|
-
{ hard: boxes, soft }
|
|
1180
|
+
{ step: edge2.step, event: edge2.event, text: source.label, points: edge2.points, color: edge2.color, ...below ?? (side2 ? { side: side2 } : { flip: true }) },
|
|
1181
|
+
{ hard: boxes, soft, touch: seen }
|
|
892
1182
|
)
|
|
893
1183
|
);
|
|
894
1184
|
}
|
|
@@ -898,16 +1188,19 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
898
1188
|
const contentRight = Math.max(...boxes.map((b) => b.x + b.w + R.pad), ...labels.map((l) => l.x + l.w + LOOK.label.soft), ...sceneEdges.flatMap((e) => e.points.map((p) => p[0] + R.pad)));
|
|
899
1189
|
const width = Math.max(contentRight + margin, stripNeed(diagram) + margin * 2);
|
|
900
1190
|
for (const region of regions) region.w = width - margin * 2;
|
|
901
|
-
const
|
|
1191
|
+
const contentBottom = Math.max(bandsBottom, ...labels.map((l) => l.y + l.h));
|
|
1192
|
+
const strip2 = layoutStrip(diagram, margin, contentBottom + gap, width - margin * 2);
|
|
902
1193
|
layout.width = width;
|
|
903
|
-
layout.height = (strip2 ? strip2.y + strip2.h :
|
|
1194
|
+
layout.height = (strip2 ? strip2.y + strip2.h : contentBottom) + margin;
|
|
904
1195
|
if (strip2) layout.strip = strip2;
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
1196
|
+
const lines = lineBadges(sceneEdges, diagram.steps.length, badgeAt);
|
|
1197
|
+
layout.badges = replaceSameSpot(
|
|
1198
|
+
diagram.steps.map((step, s) => {
|
|
1199
|
+
const line = lines.get(s);
|
|
1200
|
+
if (!line) return cornerBadge(step.events, s, layout);
|
|
1201
|
+
return { step: s, x: line.point[0], y: line.point[1], color: line.edge.color };
|
|
1202
|
+
})
|
|
1203
|
+
);
|
|
911
1204
|
return layout;
|
|
912
1205
|
}
|
|
913
1206
|
function grow(layout, groups, slots, rooms) {
|
|
@@ -934,6 +1227,494 @@ function grow(layout, groups, slots, rooms) {
|
|
|
934
1227
|
}
|
|
935
1228
|
return grown;
|
|
936
1229
|
}
|
|
1230
|
+
var STATE_ENDS = ["start", "finish"];
|
|
1231
|
+
var HEAD = "HEAD";
|
|
1232
|
+
|
|
1233
|
+
// src/layout/git.ts
|
|
1234
|
+
var isGitLayout = (layout) => layout.kind === "git";
|
|
1235
|
+
function walk(diagram) {
|
|
1236
|
+
const branches = (diagram.git?.branches ?? []).map((b) => b.id);
|
|
1237
|
+
const lane = (id) => {
|
|
1238
|
+
if (!branches.includes(id)) branches.push(id);
|
|
1239
|
+
};
|
|
1240
|
+
for (const step of diagram.steps) for (const e of step.events) if (e.type === "commit" || e.type === "branch") lane(e.branch);
|
|
1241
|
+
const tips = new Map(branches.map((b) => [b, null]));
|
|
1242
|
+
let headAt = null;
|
|
1243
|
+
let attached = null;
|
|
1244
|
+
const made = [];
|
|
1245
|
+
const byId = /* @__PURE__ */ new Map();
|
|
1246
|
+
const links = [];
|
|
1247
|
+
const moves = [];
|
|
1248
|
+
const tags = [];
|
|
1249
|
+
const rows = /* @__PURE__ */ new Map();
|
|
1250
|
+
const most = /* @__PURE__ */ new Map();
|
|
1251
|
+
const shown = /* @__PURE__ */ new Map();
|
|
1252
|
+
const names = [...branches, HEAD];
|
|
1253
|
+
const at2 = new Map(names.map((n) => [n, []]));
|
|
1254
|
+
const heads = [];
|
|
1255
|
+
const visible2 = (ref) => ref === HEAD ? attached === null ? headAt : null : tips.get(ref) ?? null;
|
|
1256
|
+
const freeRow = (commit2) => {
|
|
1257
|
+
const list = rows.get(commit2) ?? [];
|
|
1258
|
+
const free = list.indexOf(null);
|
|
1259
|
+
return free < 0 ? list.length : free;
|
|
1260
|
+
};
|
|
1261
|
+
const settle = (step, event, change, lineFor) => {
|
|
1262
|
+
const before = new Map(names.map((n) => [n, visible2(n)]));
|
|
1263
|
+
const headBefore = headAt;
|
|
1264
|
+
change();
|
|
1265
|
+
const changed = names.filter((n) => before.get(n) !== visible2(n));
|
|
1266
|
+
const leaving = changed.map((ref) => {
|
|
1267
|
+
const slot = shown.get(ref);
|
|
1268
|
+
if (slot) {
|
|
1269
|
+
rows.get(slot.commit)[slot.row] = null;
|
|
1270
|
+
shown.delete(ref);
|
|
1271
|
+
}
|
|
1272
|
+
return { ref, slot };
|
|
1273
|
+
});
|
|
1274
|
+
for (const { ref, slot } of leaving) {
|
|
1275
|
+
const from = slot ?? (ref === HEAD && headBefore !== null ? { commit: headBefore, row: freeRow(headBefore) } : void 0);
|
|
1276
|
+
const target = visible2(ref);
|
|
1277
|
+
let to;
|
|
1278
|
+
if (target !== null) {
|
|
1279
|
+
to = { commit: target, row: freeRow(target) };
|
|
1280
|
+
const list = rows.get(target) ?? [];
|
|
1281
|
+
list[to.row] = ref;
|
|
1282
|
+
rows.set(target, list);
|
|
1283
|
+
most.set(target, Math.max(most.get(target) ?? 0, list.filter((r) => r !== null).length));
|
|
1284
|
+
shown.set(ref, to);
|
|
1285
|
+
}
|
|
1286
|
+
moves.push({ ref, step, event, ...from ? { from } : {}, ...to ? { to } : {}, line: ref === lineFor });
|
|
1287
|
+
}
|
|
1288
|
+
};
|
|
1289
|
+
const prune = (step, event) => {
|
|
1290
|
+
const reach = /* @__PURE__ */ new Set();
|
|
1291
|
+
const stack = [...tips.values(), headAt].filter((c) => c !== null);
|
|
1292
|
+
while (stack.length > 0) {
|
|
1293
|
+
const id = stack.pop();
|
|
1294
|
+
if (reach.has(id)) continue;
|
|
1295
|
+
reach.add(id);
|
|
1296
|
+
stack.push(...byId.get(id)?.parents ?? []);
|
|
1297
|
+
}
|
|
1298
|
+
for (const c of made) if (!reach.has(c.id) && c.orphan === void 0) c.orphan = { step, event };
|
|
1299
|
+
};
|
|
1300
|
+
diagram.steps.forEach((step, s) => {
|
|
1301
|
+
step.events.forEach((e, k) => {
|
|
1302
|
+
if (e.type === "commit") commit(e, s, k);
|
|
1303
|
+
else if (e.type === "branch") {
|
|
1304
|
+
if (!byId.has(e.from)) return;
|
|
1305
|
+
if (laneOf(e.from) !== e.branch) links.push({ kind: "branch", from: e.from, to: e.branch, step: s, event: k });
|
|
1306
|
+
settle(s, k, () => {
|
|
1307
|
+
tips.set(e.branch, e.from);
|
|
1308
|
+
attached = e.branch;
|
|
1309
|
+
headAt = e.from;
|
|
1310
|
+
});
|
|
1311
|
+
} else if (e.type === "edge") {
|
|
1312
|
+
const ref = e.from;
|
|
1313
|
+
if (ref !== HEAD && !tips.has(ref) || !byId.has(e.to)) return;
|
|
1314
|
+
settle(
|
|
1315
|
+
s,
|
|
1316
|
+
k,
|
|
1317
|
+
() => {
|
|
1318
|
+
if (ref === HEAD) {
|
|
1319
|
+
attached = null;
|
|
1320
|
+
headAt = e.to;
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
tips.set(ref, e.to);
|
|
1324
|
+
if (attached === ref) headAt = e.to;
|
|
1325
|
+
else if (attached === null && headAt === e.to) attached = ref;
|
|
1326
|
+
},
|
|
1327
|
+
ref
|
|
1328
|
+
);
|
|
1329
|
+
} else return;
|
|
1330
|
+
prune(s, k);
|
|
1331
|
+
});
|
|
1332
|
+
for (const n of names) at2.get(n)?.push(n === HEAD ? headAt : tips.get(n) ?? null);
|
|
1333
|
+
heads.push(attached);
|
|
1334
|
+
for (const n of names) {
|
|
1335
|
+
const slot = shown.get(n);
|
|
1336
|
+
if (slot) tags.push({ ref: n, step: s, slot });
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
function laneOf(id) {
|
|
1340
|
+
return byId.get(id)?.branch;
|
|
1341
|
+
}
|
|
1342
|
+
function commit(e, s, k) {
|
|
1343
|
+
if (byId.has(e.id)) return;
|
|
1344
|
+
const copy = e.copy !== void 0 && byId.has(e.copy) ? e.copy : void 0;
|
|
1345
|
+
const base = copy !== void 0 && attached === null && headAt !== null ? headAt : tips.get(e.branch) ?? null;
|
|
1346
|
+
const joined = e.merge !== void 0 && e.merge !== e.branch ? tips.get(e.merge) ?? void 0 : void 0;
|
|
1347
|
+
const parents = [...new Set([base, joined].filter((c2) => c2 !== null && c2 !== void 0))];
|
|
1348
|
+
const c = {
|
|
1349
|
+
id: e.id,
|
|
1350
|
+
branch: e.branch,
|
|
1351
|
+
parents,
|
|
1352
|
+
...joined !== void 0 && joined !== base ? { joined } : {},
|
|
1353
|
+
...copy !== void 0 ? { copy } : {},
|
|
1354
|
+
...e.hash !== void 0 ? { hash: e.hash } : {},
|
|
1355
|
+
...e.note !== void 0 ? { note: e.note } : {},
|
|
1356
|
+
step: s,
|
|
1357
|
+
event: k
|
|
1358
|
+
};
|
|
1359
|
+
made.push(c);
|
|
1360
|
+
byId.set(c.id, c);
|
|
1361
|
+
for (const p of parents) links.push({ kind: "parent", from: p, to: c.id, step: s, event: k });
|
|
1362
|
+
if (copy !== void 0) links.push({ kind: "copy", from: copy, to: c.id, step: s, event: k });
|
|
1363
|
+
const first = attached === null && headAt === null;
|
|
1364
|
+
settle(s, k, () => {
|
|
1365
|
+
if (copy === void 0) {
|
|
1366
|
+
tips.set(e.branch, c.id);
|
|
1367
|
+
if (attached === e.branch) headAt = c.id;
|
|
1368
|
+
} else if (attached === null) headAt = c.id;
|
|
1369
|
+
if (first) {
|
|
1370
|
+
attached = e.branch;
|
|
1371
|
+
headAt = c.id;
|
|
1372
|
+
}
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
const refs = names.map((name) => ({ name, at: at2.get(name) ?? [], ...name === HEAD ? { attached: heads } : {} }));
|
|
1376
|
+
return { branches, made, links, moves, refs, tags, rows: most };
|
|
1377
|
+
}
|
|
1378
|
+
function cubic(p0, c1, c2, p3) {
|
|
1379
|
+
const n = LOOK.git.samples;
|
|
1380
|
+
return Array.from({ length: n }, (_, k) => {
|
|
1381
|
+
const t = (k + 1) / n;
|
|
1382
|
+
const u = 1 - t;
|
|
1383
|
+
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];
|
|
1384
|
+
return [at2(0), at2(1)];
|
|
1385
|
+
});
|
|
1386
|
+
}
|
|
1387
|
+
function elbow(from, to) {
|
|
1388
|
+
if (Math.abs(from[1] - to[1]) < 0.5) return [from, to];
|
|
1389
|
+
return from[1] > to[1] ? [from, [from[0], to[1]], to] : [from, [to[0], from[1]], to];
|
|
1390
|
+
}
|
|
1391
|
+
function fork(p, tx, ty) {
|
|
1392
|
+
const sign = ty > p.cy ? 1 : -1;
|
|
1393
|
+
const p0 = [p.cx, p.cy + sign * p.r];
|
|
1394
|
+
const turn = Math.max(0, Math.min(LOOK.git.turn, tx - p.cx));
|
|
1395
|
+
const p3 = [p.cx + turn, ty];
|
|
1396
|
+
const curve = cubic(p0, [p0[0], p0[1] + (ty - p0[1]) * 0.7], [p.cx + turn * 0.2, ty], p3);
|
|
1397
|
+
return [p0, ...curve, ...tx > p3[0] ? [[tx, ty]] : []];
|
|
1398
|
+
}
|
|
1399
|
+
function join(p, c) {
|
|
1400
|
+
const sign = c.cy < p.cy ? 1 : -1;
|
|
1401
|
+
const p0 = [p.cx + p.r, p.cy];
|
|
1402
|
+
const p3 = [c.cx, c.cy + sign * c.r];
|
|
1403
|
+
const turn = Math.max(0, Math.min(LOOK.git.turn, c.cx - p0[0]));
|
|
1404
|
+
const h = [c.cx - turn, p.cy];
|
|
1405
|
+
const curve = cubic(h, [c.cx - turn * 0.2, p.cy], [c.cx, p3[1] + (p.cy - p3[1]) * 0.7], p3);
|
|
1406
|
+
return [p0, ...h[0] > p0[0] ? [h] : [], ...curve];
|
|
1407
|
+
}
|
|
1408
|
+
function copyLine(p, c) {
|
|
1409
|
+
if (Math.abs(p.cy - c.cy) < 0.5) {
|
|
1410
|
+
const top = p.cy - p.r;
|
|
1411
|
+
const lift = LOOK.git.turn * 0.7;
|
|
1412
|
+
return [[p.cx, top], ...cubic([p.cx, top], [p.cx, top - lift], [c.cx, top - lift], [c.cx, top])];
|
|
1413
|
+
}
|
|
1414
|
+
const sign = c.cy < p.cy ? -1 : 1;
|
|
1415
|
+
const p0 = [p.cx, p.cy + sign * p.r];
|
|
1416
|
+
const p3 = [c.cx, c.cy - sign * c.r];
|
|
1417
|
+
const mid = (p3[1] - p0[1]) * 0.5;
|
|
1418
|
+
return [p0, ...cubic(p0, [p0[0], p0[1] + mid], [p3[0], p3[1] - mid], p3)];
|
|
1419
|
+
}
|
|
1420
|
+
function layoutGit(diagram) {
|
|
1421
|
+
const { margin, gap, box: B, region: R, git: G, carrier: C } = LOOK;
|
|
1422
|
+
const walked = walk(diagram);
|
|
1423
|
+
const notes = new Map((diagram.git?.branches ?? []).map((b) => [b.id, b.note]));
|
|
1424
|
+
const laneIndex = new Map(walked.branches.map((id, i) => [id, i]));
|
|
1425
|
+
const colorOf2 = (branch) => G.colors[(laneIndex.get(branch) ?? 0) % G.colors.length];
|
|
1426
|
+
const col = /* @__PURE__ */ new Map();
|
|
1427
|
+
const laneLast = /* @__PURE__ */ new Map();
|
|
1428
|
+
for (const c of walked.made) {
|
|
1429
|
+
const k = Math.max(0, ...c.parents.map((p) => (col.get(p) ?? -1) + 1), (laneLast.get(c.branch) ?? -1) + 1);
|
|
1430
|
+
col.set(c.id, k);
|
|
1431
|
+
laneLast.set(c.branch, k);
|
|
1432
|
+
}
|
|
1433
|
+
const linesOf = (c) => [
|
|
1434
|
+
...c.hash !== void 0 ? [{ text: c.hash, style: TYPE.gitHash }] : [],
|
|
1435
|
+
...c.note !== void 0 ? [{ text: c.note, style: TYPE.gitNote }] : []
|
|
1436
|
+
];
|
|
1437
|
+
const textW = (c) => Math.max(0, ...linesOf(c).map((line) => textWidth(line.text, line.style)));
|
|
1438
|
+
const tagW = (ref) => textWidth(ref, hasWide(ref) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
|
|
1439
|
+
const refWidth = Math.max(0, ...walked.refs.map((r) => tagW(r.name)));
|
|
1440
|
+
const pitch = Math.max(G.pitch, ...walked.made.map((c) => textW(c) + G.textGap), refWidth + G.textGap);
|
|
1441
|
+
const headers = walked.branches.map((id) => ({ w: Math.max(R.icon, textWidth(id, TYPE.regionName), textWidth(notes.get(id) ?? "", TYPE.regionNote)) }));
|
|
1442
|
+
const headerRight = margin + R.inset + Math.max(0, ...headers.map((h) => h.w));
|
|
1443
|
+
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);
|
|
1444
|
+
const x0 = Math.max(G.x0, headerRight + gap + firstHalf);
|
|
1445
|
+
const named = new Set(
|
|
1446
|
+
walked.moves.flatMap((mv) => {
|
|
1447
|
+
const source = diagram.steps[mv.step]?.events[mv.event];
|
|
1448
|
+
return mv.line && mv.to && source?.type === "edge" && source.label !== void 0 ? [walked.made.find((c) => c.id === mv.to?.commit)?.branch ?? ""] : [];
|
|
1449
|
+
})
|
|
1450
|
+
);
|
|
1451
|
+
const extraRows = (branch) => Math.max(0, ...walked.made.filter((c) => c.branch === branch).map((c) => (walked.rows.get(c.id) ?? 0) - 2)) * G.row;
|
|
1452
|
+
const topText = walked.made.some((c) => laneIndex.get(c.branch) === 0 && linesOf(c).length > 0);
|
|
1453
|
+
const lanes = [];
|
|
1454
|
+
let y = margin;
|
|
1455
|
+
walked.branches.forEach((id, i) => {
|
|
1456
|
+
const top = i === 0;
|
|
1457
|
+
const tagBase = top && topText ? G.tagTop : G.tag;
|
|
1458
|
+
const line = y + (top ? G.topLine - (G.tagTop - tagBase) : G.line) + extraRows(id);
|
|
1459
|
+
const h = line - y + (top ? G.topBelow : named.has(id) ? G.below : G.bare);
|
|
1460
|
+
lanes.push({ id, x: margin, y, w: 0, h, line, color: colorOf2(id), tagBase });
|
|
1461
|
+
y += h + R.gap;
|
|
1462
|
+
});
|
|
1463
|
+
const lanesBottom = y - R.gap;
|
|
1464
|
+
const laneOf = new Map(lanes.map((l) => [l.id, l]));
|
|
1465
|
+
const commits = walked.made.map((c) => {
|
|
1466
|
+
const lane = laneOf.get(c.branch);
|
|
1467
|
+
const isTop = laneIndex.get(c.branch) === 0;
|
|
1468
|
+
const cx = x0 + pitch * (col.get(c.id) ?? 0) + (isTop ? 0 : pitch / 2);
|
|
1469
|
+
const cy = lane.line;
|
|
1470
|
+
const lines = linesOf(c);
|
|
1471
|
+
const baselines = lines.map((_, k) => isTop ? cy - G.above - (lines.length - 1 - k) * G.lineStep : cy + G.under + k * G.lineStep);
|
|
1472
|
+
const boxes2 = lines.map((line, k) => textBox(line.text, cx, baselines[k], line.style, "middle"));
|
|
1473
|
+
const text2 = boxes2.length === 0 ? void 0 : { ...union(boxes2), lines: lines.map((line) => line.text), baselines };
|
|
1474
|
+
const color = c.copy !== void 0 ? colorOf2(walked.made.find((m) => m.id === c.copy)?.branch ?? c.branch) : colorOf2(c.branch);
|
|
1475
|
+
return {
|
|
1476
|
+
id: c.id,
|
|
1477
|
+
branch: c.branch,
|
|
1478
|
+
color,
|
|
1479
|
+
cx,
|
|
1480
|
+
cy,
|
|
1481
|
+
r: G.r,
|
|
1482
|
+
step: c.step,
|
|
1483
|
+
event: c.event,
|
|
1484
|
+
parents: c.parents,
|
|
1485
|
+
...c.copy !== void 0 ? { copy: c.copy } : {},
|
|
1486
|
+
...c.hash !== void 0 ? { hash: c.hash } : {},
|
|
1487
|
+
...c.note !== void 0 ? { note: c.note } : {},
|
|
1488
|
+
...text2 ? { text: text2 } : {},
|
|
1489
|
+
...c.orphan ? { orphan: c.orphan.step, orphanEvent: c.orphan.event } : {}
|
|
1490
|
+
};
|
|
1491
|
+
});
|
|
1492
|
+
const placed = new Map(commits.map((c) => [c.id, c]));
|
|
1493
|
+
const links = walked.links.flatMap((l) => {
|
|
1494
|
+
const from = placed.get(l.from);
|
|
1495
|
+
if (!from) return [];
|
|
1496
|
+
if (l.kind === "branch") {
|
|
1497
|
+
if (!walked.made.some((c) => c.branch === l.to)) return [];
|
|
1498
|
+
const lane = laneOf.get(l.to);
|
|
1499
|
+
return [{ ...l, points: fork(from, from.cx + G.turn, lane.line), color: colorOf2(l.to) }];
|
|
1500
|
+
}
|
|
1501
|
+
const to = placed.get(l.to);
|
|
1502
|
+
const made = walked.made.find((m) => m.id === l.to);
|
|
1503
|
+
let points;
|
|
1504
|
+
if (l.kind === "copy") points = copyLine(from, to);
|
|
1505
|
+
else if (Math.abs(from.cy - to.cy) < 0.5) points = [[from.cx + from.r, from.cy], [to.cx - to.r, to.cy]];
|
|
1506
|
+
else if (made?.joined === l.from) points = join(from, to);
|
|
1507
|
+
else points = fork(from, to.cx - to.r, to.cy);
|
|
1508
|
+
return [{ ...l, points, color: to.color }];
|
|
1509
|
+
});
|
|
1510
|
+
const tagRect = (ref, slot) => {
|
|
1511
|
+
const c = placed.get(slot.commit);
|
|
1512
|
+
const base = laneOf.get(c.branch)?.tagBase ?? G.tag;
|
|
1513
|
+
const w = tagW(ref);
|
|
1514
|
+
return { x: c.cx - w / 2, y: c.cy - base - slot.row * G.row - C.tagH / 2, w, h: C.tagH };
|
|
1515
|
+
};
|
|
1516
|
+
const center2 = (r) => [r.x + r.w / 2, r.y + r.h / 2];
|
|
1517
|
+
const moves = walked.moves.map((m) => {
|
|
1518
|
+
const from = m.from ? tagRect(m.ref, m.from) : void 0;
|
|
1519
|
+
const to = m.to ? tagRect(m.ref, m.to) : void 0;
|
|
1520
|
+
const source = diagram.steps[m.step]?.events[m.event];
|
|
1521
|
+
const carried = m.line && source?.type === "edge" && source.carry.kind !== "none" && !(source.carry.kind === "tag" && source.carry.text === source.from);
|
|
1522
|
+
return {
|
|
1523
|
+
ref: m.ref,
|
|
1524
|
+
step: m.step,
|
|
1525
|
+
event: m.event,
|
|
1526
|
+
...from ? { from } : {},
|
|
1527
|
+
...to ? { to } : {},
|
|
1528
|
+
...m.to ? { target: m.to.commit } : {},
|
|
1529
|
+
...carried ? { carried: true } : {},
|
|
1530
|
+
...m.line && from && to ? { line: elbow(center2(from), center2(to)) } : {},
|
|
1531
|
+
color: "slate"
|
|
1532
|
+
};
|
|
1533
|
+
});
|
|
1534
|
+
const tags = walked.tags.map((t) => ({ ...tagRect(t.ref, t.slot), ref: t.ref, step: t.step }));
|
|
1535
|
+
const colors = boxColors(diagram);
|
|
1536
|
+
const right = Math.max(
|
|
1537
|
+
x0,
|
|
1538
|
+
...commits.flatMap((c) => [c.cx + c.r, ...c.text ? [c.text.x + c.text.w] : []]),
|
|
1539
|
+
...tags.map((t) => t.x + t.w),
|
|
1540
|
+
...moves.flatMap((m) => [m.from, m.to].flatMap((r) => r ? [r.x + r.w] : []))
|
|
1541
|
+
);
|
|
1542
|
+
const boxX = right + G.boxGap;
|
|
1543
|
+
const firstCy = (lanes[1] ?? lanes[0])?.line ?? margin + B.h / 2;
|
|
1544
|
+
const boxes = diagram.boxes.map((b, i) => {
|
|
1545
|
+
const w = boxWidth(diagram, b.id, true);
|
|
1546
|
+
const cy = firstCy + i * (B.h + gap);
|
|
1547
|
+
return {
|
|
1548
|
+
id: b.id,
|
|
1549
|
+
name: b.name,
|
|
1550
|
+
...b.sub !== void 0 ? { sub: b.sub } : {},
|
|
1551
|
+
...b.icon !== void 0 ? { icon: b.icon } : {},
|
|
1552
|
+
color: colors.get(b.id) ?? "slate",
|
|
1553
|
+
x: boxX,
|
|
1554
|
+
y: cy - B.h / 2,
|
|
1555
|
+
w,
|
|
1556
|
+
h: B.h,
|
|
1557
|
+
cx: boxX + w / 2,
|
|
1558
|
+
cy
|
|
1559
|
+
};
|
|
1560
|
+
});
|
|
1561
|
+
const regions = lanes.map((lane, i) => {
|
|
1562
|
+
const note = notes.get(lane.id);
|
|
1563
|
+
return {
|
|
1564
|
+
id: lane.id,
|
|
1565
|
+
lines: [lane.id],
|
|
1566
|
+
...note !== void 0 ? { note } : {},
|
|
1567
|
+
icon: "branch",
|
|
1568
|
+
color: lane.color,
|
|
1569
|
+
x: lane.x,
|
|
1570
|
+
y: lane.y,
|
|
1571
|
+
w: 0,
|
|
1572
|
+
h: lane.h,
|
|
1573
|
+
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 }
|
|
1574
|
+
};
|
|
1575
|
+
});
|
|
1576
|
+
const layout = {
|
|
1577
|
+
kind: "git",
|
|
1578
|
+
width: 0,
|
|
1579
|
+
height: 0,
|
|
1580
|
+
regions,
|
|
1581
|
+
boxes,
|
|
1582
|
+
lifelines: [],
|
|
1583
|
+
edges: [],
|
|
1584
|
+
labels: [],
|
|
1585
|
+
actions: [],
|
|
1586
|
+
badges: [],
|
|
1587
|
+
paths: [],
|
|
1588
|
+
ends: [],
|
|
1589
|
+
lanes,
|
|
1590
|
+
commits,
|
|
1591
|
+
links,
|
|
1592
|
+
tags,
|
|
1593
|
+
refs: walked.refs,
|
|
1594
|
+
moves
|
|
1595
|
+
};
|
|
1596
|
+
layout.badges = badgesOf(diagram, layout);
|
|
1597
|
+
layout.labels = labelsOf(diagram, layout);
|
|
1598
|
+
const contentRight = Math.max(right, ...boxes.map((b) => b.x + b.w), ...layout.labels.map((l) => l.x + l.w)) + R.pad;
|
|
1599
|
+
const width = Math.max(contentRight + margin, stripNeed(diagram) + margin * 2);
|
|
1600
|
+
for (const region of regions) region.w = width - margin * 2;
|
|
1601
|
+
for (const lane of lanes) lane.w = width - margin * 2;
|
|
1602
|
+
const bottom = Math.max(lanesBottom, ...boxes.map((b) => b.y + b.h), ...layout.labels.map((l) => l.y + l.h));
|
|
1603
|
+
const strip2 = layoutStrip(diagram, margin, bottom + gap, width - margin * 2);
|
|
1604
|
+
layout.width = width;
|
|
1605
|
+
layout.height = (strip2 ? strip2.y + strip2.h : bottom) + margin;
|
|
1606
|
+
if (strip2) layout.strip = strip2;
|
|
1607
|
+
layout.badges = badgesOf(diagram, layout);
|
|
1608
|
+
return layout;
|
|
1609
|
+
}
|
|
1610
|
+
function union(rects) {
|
|
1611
|
+
const x = Math.min(...rects.map((r) => r.x));
|
|
1612
|
+
const y = Math.min(...rects.map((r) => r.y));
|
|
1613
|
+
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 };
|
|
1614
|
+
}
|
|
1615
|
+
function firstMark(layout, step) {
|
|
1616
|
+
const marks = [
|
|
1617
|
+
...layout.links.filter((l) => l.step === step && l.kind !== "copy").map((l) => ({ event: l.event, points: l.points, color: l.color })),
|
|
1618
|
+
...layout.moves.flatMap((m) => {
|
|
1619
|
+
const target = layout.commits.find((c) => c.id === m.target);
|
|
1620
|
+
return m.step === step && m.line && target ? [{ event: m.event, target, color: target.color }] : [];
|
|
1621
|
+
})
|
|
1622
|
+
].sort((a, b) => a.event - b.event);
|
|
1623
|
+
return marks[0];
|
|
1624
|
+
}
|
|
1625
|
+
function besideCommit(c, taken, avoid) {
|
|
1626
|
+
const { r, inset } = LOOK.badge;
|
|
1627
|
+
const d = c.r + inset + r;
|
|
1628
|
+
const apart = r * 2 + inset;
|
|
1629
|
+
const spots = [
|
|
1630
|
+
[c.cx + d, c.cy],
|
|
1631
|
+
[c.cx, c.cy + d],
|
|
1632
|
+
[c.cx - d, c.cy],
|
|
1633
|
+
[c.cx, c.cy - d]
|
|
1634
|
+
];
|
|
1635
|
+
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));
|
|
1636
|
+
}
|
|
1637
|
+
function clearOnPath(points, taken, avoid) {
|
|
1638
|
+
const { r, inset, along: start, short } = LOOK.badge;
|
|
1639
|
+
const length = pathLength(points);
|
|
1640
|
+
const first = length < short ? Math.min(r + 1, length / 2) : start;
|
|
1641
|
+
const apart = r * 2 + inset;
|
|
1642
|
+
for (let d = first; d <= length; d += 1) {
|
|
1643
|
+
const p = along(points, d);
|
|
1644
|
+
const rect = badgeRect(p);
|
|
1645
|
+
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;
|
|
1646
|
+
}
|
|
1647
|
+
return void 0;
|
|
1648
|
+
}
|
|
1649
|
+
function badgesOf(diagram, layout) {
|
|
1650
|
+
const { inset } = LOOK.badge;
|
|
1651
|
+
const taken = [];
|
|
1652
|
+
const all = [...layout.links.map((l) => l.points), ...layout.moves.flatMap((m) => m.line ? [m.line] : [])];
|
|
1653
|
+
const out = [];
|
|
1654
|
+
const avoid = [
|
|
1655
|
+
...layout.tags,
|
|
1656
|
+
...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] : []])
|
|
1657
|
+
];
|
|
1658
|
+
diagram.steps.forEach((step, s) => {
|
|
1659
|
+
const mark = firstMark(layout, s);
|
|
1660
|
+
const near = mark?.target ? besideCommit(mark.target, taken, avoid) : void 0;
|
|
1661
|
+
if (mark && (mark.points || near)) {
|
|
1662
|
+
const points = mark.points;
|
|
1663
|
+
const point = near ?? (points ? clearOnPath(points, taken, avoid) ?? badgeOnPath(points, taken, all.filter((p) => p !== points)) : [0, 0]);
|
|
1664
|
+
taken.push(point);
|
|
1665
|
+
out.push({ step: s, x: point[0], y: point[1], color: mark.color });
|
|
1666
|
+
return;
|
|
1667
|
+
}
|
|
1668
|
+
const box = step.events.flatMap((e) => e.type === "swap" || e.type === "action" ? [e.box] : []).map((id) => layout.boxes.find((b) => b.id === id))[0];
|
|
1669
|
+
if (box) {
|
|
1670
|
+
out.push({ step: s, x: box.x, y: box.y, color: box.color });
|
|
1671
|
+
return;
|
|
1672
|
+
}
|
|
1673
|
+
if (layout.strip && step.events.some((e) => e.type === "strip")) {
|
|
1674
|
+
out.push({ step: s, x: layout.strip.x + inset, y: layout.strip.y + inset, color: "slate" });
|
|
1675
|
+
return;
|
|
1676
|
+
}
|
|
1677
|
+
const tip = layout.commits.find((c) => c.id === layout.refs[0]?.at[s]);
|
|
1678
|
+
const spot = tip ? besideCommit(tip, taken, avoid) : void 0;
|
|
1679
|
+
if (tip && spot) {
|
|
1680
|
+
taken.push(spot);
|
|
1681
|
+
out.push({ step: s, x: spot[0], y: spot[1], color: tip.color });
|
|
1682
|
+
return;
|
|
1683
|
+
}
|
|
1684
|
+
const before = out[out.length - 1];
|
|
1685
|
+
const lane = layout.lanes[0];
|
|
1686
|
+
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" });
|
|
1687
|
+
});
|
|
1688
|
+
return replaceSameSpot(out);
|
|
1689
|
+
}
|
|
1690
|
+
function labelsOf(diagram, layout) {
|
|
1691
|
+
const G = LOOK.git;
|
|
1692
|
+
const labels = [];
|
|
1693
|
+
const circles = layout.commits.map((c) => ({ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }));
|
|
1694
|
+
const texts = layout.commits.flatMap((c) => c.text ? [c.text] : []);
|
|
1695
|
+
const headers = layout.regions.map((r) => r.header);
|
|
1696
|
+
for (const move of layout.moves) {
|
|
1697
|
+
const source = diagram.steps[move.step]?.events[move.event];
|
|
1698
|
+
if (source?.type !== "edge" || source.label === void 0 || !move.line) continue;
|
|
1699
|
+
const target = layout.commits.find((c) => c.id === source.to);
|
|
1700
|
+
if (!target) continue;
|
|
1701
|
+
const top = layout.lanes[0]?.id === target.branch;
|
|
1702
|
+
const w = textWidth(source.label, hasWide(source.label) ? TYPE.labelJa : TYPE.label) + LOOK.label.padX * 2;
|
|
1703
|
+
const [mx] = move.line.reduce((sum, p) => [sum[0] + p[0] / move.line.length, 0], [0, 0]);
|
|
1704
|
+
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));
|
|
1705
|
+
const side2 = source.labelSide ?? (top ? "above" : "below");
|
|
1706
|
+
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 };
|
|
1707
|
+
const seen = layout.badges.filter((b) => b.step <= move.step).map((b) => badgeRect([b.x, b.y]));
|
|
1708
|
+
const tags = layout.tags.filter((t) => t.step === move.step);
|
|
1709
|
+
labels.push(
|
|
1710
|
+
placeLabel(
|
|
1711
|
+
{ step: move.step, event: move.event, text: source.label, points: move.line, color: move.color, side: side2, ...base ? { base } : {} },
|
|
1712
|
+
{ hard: [...circles, ...layout.boxes], soft: [...texts, ...tags, ...headers, ...labels.filter((l) => l.step === move.step)], touch: seen }
|
|
1713
|
+
)
|
|
1714
|
+
);
|
|
1715
|
+
}
|
|
1716
|
+
return labels;
|
|
1717
|
+
}
|
|
937
1718
|
|
|
938
1719
|
// src/layout/sequence.ts
|
|
939
1720
|
function layoutSequence(diagram) {
|
|
@@ -1002,8 +1783,8 @@ function layoutSequence(diagram) {
|
|
|
1002
1783
|
const side2 = event.labelSide ?? "above";
|
|
1003
1784
|
const self = event.from === event.to;
|
|
1004
1785
|
const named = event.label !== void 0;
|
|
1005
|
-
above = named && side2 === "above" ?
|
|
1006
|
-
under = self ? Q.selfH + gap : named && side2 === "below" ?
|
|
1786
|
+
above = named && side2 === "above" ? Q.labelOffset + L.h / 2 : gap;
|
|
1787
|
+
under = self ? Q.selfH + gap : named && side2 === "below" ? Q.labelOffset + L.h / 2 : gap;
|
|
1007
1788
|
} else {
|
|
1008
1789
|
above = LOOK.action.h / 2;
|
|
1009
1790
|
under = LOOK.action.h / 2;
|
|
@@ -1025,7 +1806,17 @@ function layoutSequence(diagram) {
|
|
|
1025
1806
|
[xt - dir * LOOK.edge.inset, y]
|
|
1026
1807
|
];
|
|
1027
1808
|
const color = edgeColor(event, colors);
|
|
1028
|
-
|
|
1809
|
+
const seats = {};
|
|
1810
|
+
if (event.carry.kind !== "none") {
|
|
1811
|
+
const reach = LOOK.slot.lifeline + carrierHalf(event.carry)[0];
|
|
1812
|
+
const [p0, p1] = points;
|
|
1813
|
+
const [q0, q1] = points.slice(-2);
|
|
1814
|
+
const out = Math.sign(p1[0] - p0[0]) || 1;
|
|
1815
|
+
const into = Math.sign(q1[0] - q0[0]) || -1;
|
|
1816
|
+
seats.wait = [xf - out * reach, p0[1]];
|
|
1817
|
+
seats.settle = [xt + into * reach, q1[1]];
|
|
1818
|
+
}
|
|
1819
|
+
edges.push({ step: s, event: e, from: event.from, to: event.to, points, color, carry: event.carry, ...seats });
|
|
1029
1820
|
if (event.label !== void 0) {
|
|
1030
1821
|
requests.push({
|
|
1031
1822
|
step: s,
|
|
@@ -1033,7 +1824,8 @@ function layoutSequence(diagram) {
|
|
|
1033
1824
|
text: event.label,
|
|
1034
1825
|
points,
|
|
1035
1826
|
color,
|
|
1036
|
-
...event.labelSide ? { side: event.labelSide } : xf === xt ? { side: "right" } : {}
|
|
1827
|
+
...event.labelSide ? { side: event.labelSide } : xf === xt ? { side: "right" } : {},
|
|
1828
|
+
offset: Q.labelOffset
|
|
1037
1829
|
});
|
|
1038
1830
|
}
|
|
1039
1831
|
} else {
|
|
@@ -1045,10 +1837,12 @@ function layoutSequence(diagram) {
|
|
|
1045
1837
|
});
|
|
1046
1838
|
const bottom = (first ? headBottom : y + below) + Q.tail;
|
|
1047
1839
|
const lifelines = order.map((id, i) => ({ id, x: xs[i], y1: headBottom, y2: bottom }));
|
|
1840
|
+
const early = lineBadges(edges, diagram.steps.length);
|
|
1048
1841
|
const labels = [];
|
|
1049
1842
|
for (const request of requests) {
|
|
1843
|
+
const seen = [...early].filter(([s]) => s <= request.step).map(([, b]) => badgeRect(b.point));
|
|
1050
1844
|
const soft = [...labels.filter((l) => l.step === request.step), ...actions];
|
|
1051
|
-
labels.push(placeLabel(request, { hard: boxes, soft }));
|
|
1845
|
+
labels.push(placeLabel(request, { hard: boxes, soft, touch: seen }));
|
|
1052
1846
|
}
|
|
1053
1847
|
const layout = { kind: "sequence", width: 0, height: 0, regions: [], boxes, lifelines, edges, labels, actions, badges: [], paths: [], ends: [] };
|
|
1054
1848
|
const lefts = [...boxes.map((b) => b.x), ...labels.map((l) => l.x), ...actions.map((a) => a.x)];
|
|
@@ -1064,19 +1858,17 @@ function layoutSequence(diagram) {
|
|
|
1064
1858
|
return layout;
|
|
1065
1859
|
}
|
|
1066
1860
|
function badges(diagram, layout) {
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
return { step: s, x, y, color: edge2.color };
|
|
1072
|
-
}
|
|
1861
|
+
const lines = lineBadges(layout.edges, diagram.steps.length);
|
|
1862
|
+
const placed = diagram.steps.map((step, s) => {
|
|
1863
|
+
const line = lines.get(s);
|
|
1864
|
+
if (line) return { step: s, x: line.point[0], y: line.point[1], color: line.edge.color };
|
|
1073
1865
|
const action2 = layout.actions.find((a) => a.step === s);
|
|
1074
1866
|
const lifeline2 = action2 && layout.lifelines.find((l) => l.id === action2.box);
|
|
1075
1867
|
if (action2 && lifeline2) return { step: s, x: lifeline2.x, y: action2.y + action2.h / 2, color: action2.color };
|
|
1076
1868
|
return cornerBadge(step.events, s, layout);
|
|
1077
1869
|
});
|
|
1870
|
+
return replaceSameSpot(placed);
|
|
1078
1871
|
}
|
|
1079
|
-
var STATE_ENDS = ["start", "finish"];
|
|
1080
1872
|
|
|
1081
1873
|
// src/layout/state.ts
|
|
1082
1874
|
var isEnd = (id) => STATE_ENDS.includes(id);
|
|
@@ -1091,12 +1883,6 @@ function visitOrder(diagram) {
|
|
|
1091
1883
|
}
|
|
1092
1884
|
return order;
|
|
1093
1885
|
}
|
|
1094
|
-
function carrierHalf(carry) {
|
|
1095
|
-
const C = LOOK.carrier;
|
|
1096
|
-
if (carry.kind === "tag") return (textWidth(carry.text, hasWide(carry.text) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2) / 2;
|
|
1097
|
-
if (carry.kind === "coin") return C.coinR;
|
|
1098
|
-
return C.envW / 2;
|
|
1099
|
-
}
|
|
1100
1886
|
var same = (a, b) => a.from === b.from && a.to === b.to;
|
|
1101
1887
|
function layoutState(diagram, lang) {
|
|
1102
1888
|
const { box: B, state: T, margin, gap } = LOOK;
|
|
@@ -1113,7 +1899,11 @@ function layoutState(diagram, lang) {
|
|
|
1113
1899
|
const source = diagram.boxes.find((b) => b.id === id);
|
|
1114
1900
|
return G.pad * 2 + B.icon + G.gap + Math.max(textWidth(source?.name ?? id, TYPE.boxName), textWidth(source?.sub ?? "", TYPE.boxSub));
|
|
1115
1901
|
};
|
|
1116
|
-
const
|
|
1902
|
+
const carriedIn = slotRooms(diagram);
|
|
1903
|
+
const doneSide = Math.max(B.padX, T.done.inset + T.done.r + LOOK.slot.clear);
|
|
1904
|
+
const widths = new Map(
|
|
1905
|
+
diagram.boxes.map((b) => [b.id, ghosts.includes(b.id) ? ghostWidth(b.id) : Math.max(boxWidth(diagram, b.id, true), slotBoxWidth(carriedIn.get(b.id), b.icon !== void 0, doneSide))])
|
|
1906
|
+
);
|
|
1117
1907
|
const columnCount = Math.max(1, Math.min(T.columns, walked.length));
|
|
1118
1908
|
const rowCount = Math.max(1, Math.ceil(walked.length / T.columns));
|
|
1119
1909
|
const slot = new Map(
|
|
@@ -1134,7 +1924,7 @@ function layoutState(diagram, lang) {
|
|
|
1134
1924
|
}
|
|
1135
1925
|
const colLeft = [];
|
|
1136
1926
|
for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
|
|
1137
|
-
const
|
|
1927
|
+
const center2 = (c) => colLeft[c] + colW[c] / 2;
|
|
1138
1928
|
const isGhost = (id) => ghosts.includes(id);
|
|
1139
1929
|
const enteringFrom = new Set(notTaken.filter((p) => isGhost(p.to) && !isGhost(p.from) && !isEnd(p.from)).map((p) => p.from));
|
|
1140
1930
|
const notes = [words.sideNote, ...enteringFrom.size > 0 ? [words.sideFrom(enteringFrom.size)] : []];
|
|
@@ -1164,8 +1954,9 @@ function layoutState(diagram, lang) {
|
|
|
1164
1954
|
};
|
|
1165
1955
|
const boxes = walked.map((id) => {
|
|
1166
1956
|
const s = slot.get(id);
|
|
1167
|
-
return boxOf(id,
|
|
1957
|
+
return boxOf(id, center2(s.col), rowY(s.row), false);
|
|
1168
1958
|
});
|
|
1959
|
+
for (const box of boxes) placeSlot(box, carriedIn.get(box.id), doneSide);
|
|
1169
1960
|
const byId = new Map(boxes.map((b) => [b.id, b]));
|
|
1170
1961
|
const below = (box) => boxes.some((other) => other !== box && Math.abs(other.cx - box.cx) < 0.5 && other.y > box.y);
|
|
1171
1962
|
const ends = [];
|
|
@@ -1236,20 +2027,6 @@ function layoutState(diagram, lang) {
|
|
|
1236
2027
|
};
|
|
1237
2028
|
const exitX = (box) => starts && box === first ? box.cx + T.side.entry : box.cx;
|
|
1238
2029
|
const finishOf = (id) => ends.find((e) => e.kind === "finish" && e.box === id);
|
|
1239
|
-
const loopOf = (box) => {
|
|
1240
|
-
const { w, h, samples } = T.loop;
|
|
1241
|
-
const bottom2 = box.y + box.h;
|
|
1242
|
-
const p0 = [box.cx + w / 2, bottom2];
|
|
1243
|
-
const c1 = [box.cx + w * 3 / 4, bottom2 + h * 4 / 3];
|
|
1244
|
-
const c2 = [box.cx - w * 3 / 4, bottom2 + h * 4 / 3];
|
|
1245
|
-
const p3 = [box.cx - w / 2, bottom2 + inset];
|
|
1246
|
-
return Array.from({ length: samples + 1 }, (_, k) => {
|
|
1247
|
-
const t = k / samples;
|
|
1248
|
-
const u = 1 - t;
|
|
1249
|
-
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];
|
|
1250
|
-
return [at2(0), at2(1)];
|
|
1251
|
-
});
|
|
1252
|
-
};
|
|
1253
2030
|
const route = (from, to) => {
|
|
1254
2031
|
if (from === "start") {
|
|
1255
2032
|
const start = ends.find((e) => e.kind === "start");
|
|
@@ -1266,7 +2043,7 @@ function layoutState(diagram, lang) {
|
|
|
1266
2043
|
}
|
|
1267
2044
|
const b = byId.get(to);
|
|
1268
2045
|
if (!b) return [];
|
|
1269
|
-
if (from === to) return
|
|
2046
|
+
if (from === to) return loopUnder(a);
|
|
1270
2047
|
if (b.ghost && !a.ghost) {
|
|
1271
2048
|
const sx = exitX(a);
|
|
1272
2049
|
const ex = entryOf(from, b);
|
|
@@ -1277,15 +2054,18 @@ function layoutState(diagram, lang) {
|
|
|
1277
2054
|
return between2(a, b);
|
|
1278
2055
|
};
|
|
1279
2056
|
const settleOf = (edge2) => {
|
|
1280
|
-
const target = byId.get(edge2.to);
|
|
1281
|
-
if (target) return [target.cx, target.cy + B.iconY];
|
|
1282
2057
|
const end = edge2.to === "finish" ? finishOf(edge2.from) : void 0;
|
|
1283
2058
|
if (!end) return void 0;
|
|
1284
2059
|
const from = byId.get(edge2.from);
|
|
1285
|
-
return from && Math.abs(end.x - from.cx) < 0.5 ? [end.x - end.r - gap - carrierHalf(edge2.carry), end.y] : [end.x, end.y + end.r + gap + LOOK.carrier.tagH / 2];
|
|
2060
|
+
return from && Math.abs(end.x - from.cx) < 0.5 ? [end.x - end.r - gap - carrierHalf(edge2.carry)[0], end.y] : [end.x, end.y + end.r + gap + LOOK.carrier.tagH / 2];
|
|
2061
|
+
};
|
|
2062
|
+
const waitOf = (edge2) => {
|
|
2063
|
+
const start = edge2.from === "start" ? ends.find((e) => e.kind === "start") : void 0;
|
|
2064
|
+
return start ? [start.x - start.r - LOOK.slot.mark - carrierHalf(edge2.carry)[0], start.y] : void 0;
|
|
1286
2065
|
};
|
|
1287
2066
|
const sceneEdges = steps.map(({ step, event, edge: edge2 }) => {
|
|
1288
2067
|
const settle = settleOf(edge2);
|
|
2068
|
+
const wait = edge2.carry.kind === "none" ? void 0 : waitOf(edge2);
|
|
1289
2069
|
return {
|
|
1290
2070
|
step,
|
|
1291
2071
|
event,
|
|
@@ -1294,49 +2074,67 @@ function layoutState(diagram, lang) {
|
|
|
1294
2074
|
points: route(edge2.from, edge2.to),
|
|
1295
2075
|
color: colorOf(edge2, colors),
|
|
1296
2076
|
carry: edge2.carry,
|
|
1297
|
-
...settle ? { settle } : {}
|
|
2077
|
+
...settle ? { settle } : {},
|
|
2078
|
+
...wait ? { wait } : {}
|
|
1298
2079
|
};
|
|
1299
2080
|
});
|
|
2081
|
+
seatCarriers(sceneEdges, byId, carriedIn);
|
|
2082
|
+
const outward = /* @__PURE__ */ new Map();
|
|
1300
2083
|
for (const e of sceneEdges) {
|
|
1301
2084
|
if (e.points.length !== 2 || !sceneEdges.some((o) => o.from === e.to && o.to === e.from && o.points.length === 2)) continue;
|
|
1302
2085
|
const [p, q] = e.points;
|
|
1303
2086
|
const flat = Math.abs(q[1] - p[1]) < Math.abs(q[0] - p[0]);
|
|
1304
2087
|
const d = (e.from < e.to ? 1 : -1) * LOOK.edge.parallel;
|
|
1305
2088
|
e.points = e.points.map(([x, y]) => flat ? [x, y + d] : [x + d, y]);
|
|
2089
|
+
outward.set(e, flat ? d > 0 ? "below" : "above" : d > 0 ? "right" : "left");
|
|
1306
2090
|
}
|
|
1307
2091
|
const paths = notTaken.map((p) => ({ from: p.from, to: p.to, points: route(p.from, p.to) }));
|
|
2092
|
+
const badgeAt = (edge2, taken, lines2) => edge2.from === edge2.to ? loopBadge(edge2.points) : badgeOnPath(edge2.points, taken, lines2);
|
|
1308
2093
|
const labels = [];
|
|
1309
|
-
const
|
|
2094
|
+
const marks = ends.flatMap((e) => e.text === "" ? [] : [textBox(e.text, ...markText(e), TYPE.regionNote)]);
|
|
2095
|
+
const badgeRects = [...lineBadges(sceneEdges, diagram.steps.length, badgeAt).values()].map((b) => badgeRect(b.point));
|
|
2096
|
+
const soft = [...side2 ? [{ x: side2.x, y: side2.y, w: T.side.pad + titleW, h: side2.h }] : [], ...marks];
|
|
2097
|
+
const others = (own) => [...sceneEdges.map((o) => o.points), ...paths.map((o) => o.points)].filter((line) => line !== own);
|
|
1310
2098
|
for (const e of sceneEdges) {
|
|
1311
2099
|
const source = diagram.steps[e.step]?.events[e.event];
|
|
1312
2100
|
if (source?.type !== "edge" || source.label === void 0) continue;
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
2101
|
+
const loop = e.from === e.to;
|
|
2102
|
+
const key = lineKey(e);
|
|
2103
|
+
const named = labels.filter((l) => l.text === source.label && sceneEdges.some((o) => o.step === l.step && o.event === l.event && lineKey(o) === key));
|
|
2104
|
+
const same2 = named[named.length - 1];
|
|
2105
|
+
if (same2) {
|
|
2106
|
+
same2.until = e.step;
|
|
2107
|
+
labels.push({ x: same2.x, y: same2.y, w: same2.w, h: same2.h, step: e.step, event: e.event, text: same2.text, family: same2.family, color: e.color });
|
|
1318
2108
|
continue;
|
|
1319
2109
|
}
|
|
1320
|
-
const
|
|
2110
|
+
const w = textWidth(source.label, labelStyle(source.label)) + LOOK.label.padX * 2;
|
|
2111
|
+
const below2 = loop ? { side: "below", base: loopLabelBase(e.points, w) } : {};
|
|
2112
|
+
const side22 = source.labelSide ?? (e.to === "finish" ? "left" : outward.get(e));
|
|
1321
2113
|
labels.push(
|
|
1322
2114
|
placeLabel(
|
|
1323
|
-
{ step: e.step, event: e.event, text: source.label, points: e.points, color: e.color, ...side22 ? { side: side22 } : {} },
|
|
1324
|
-
{ hard: boxes, soft: [...soft, ...labels
|
|
2115
|
+
{ step: e.step, event: e.event, text: source.label, points: e.points, color: e.color, ...side22 ? { side: side22 } : loop ? {} : { flip: true }, ...below2 },
|
|
2116
|
+
{ hard: boxes, soft: [...soft, ...labels], touch: badgeRects, lines: others(e.points) }
|
|
1325
2117
|
)
|
|
1326
2118
|
);
|
|
1327
2119
|
}
|
|
2120
|
+
const placed = [];
|
|
1328
2121
|
notTaken.forEach((p, i) => {
|
|
1329
2122
|
const path2 = paths[i];
|
|
1330
2123
|
if (p.label === void 0 || path2.points.length === 0) return;
|
|
1331
2124
|
const style = labelStyle(p.label);
|
|
1332
2125
|
const into = byId.get(p.to)?.ghost === true && byId.get(p.from)?.ghost !== true;
|
|
1333
|
-
const
|
|
2126
|
+
const x0 = path2.points[0][0];
|
|
2127
|
+
const lead = into ? { side: "below", base: { x: x0 + LOOK.label.soft, y: lane + LOOK.label.soft }, slide: Math.max(...path2.points.map(([x]) => Math.abs(x - x0))) } : {};
|
|
2128
|
+
const rect = placeLabel({ step: -1, event: i, text: p.label, points: path2.points, color: "slate", ...lead }, { hard: boxes, soft: [...soft, ...labels, ...placed], touch: badgeRects, lines: others(path2.points) });
|
|
2129
|
+
placed.push(rect);
|
|
1334
2130
|
path2.label = { x: rect.x, y: rect.y, w: rect.w, h: rect.h, text: p.label, family: style.family };
|
|
1335
2131
|
});
|
|
1336
2132
|
const layout = { kind: "state", width: 0, height: 0, regions: [], boxes, lifelines: [], edges: sceneEdges, labels, actions: [], badges: [], paths, ends, ...side2 ? { side: side2 } : {} };
|
|
1337
2133
|
const lefts = [...boxes.map((b) => b.x), ...labels.map((l) => l.x), ...paths.flatMap((p) => p.label ? [p.label.x] : [])];
|
|
2134
|
+
const tops = [...labels.map((l) => l.y), ...paths.flatMap((p) => p.label ? [p.label.y] : [])];
|
|
1338
2135
|
const shift = Math.max(0, margin - Math.min(...lefts));
|
|
1339
|
-
|
|
2136
|
+
const drop = tops.length > 0 ? Math.max(0, margin - Math.min(...tops)) : 0;
|
|
2137
|
+
if (shift > 0 || drop > 0) shiftContent(layout, shift, drop);
|
|
1340
2138
|
const endRight = (e) => e.x + (e.text === "" ? e.r : T.text + textWidth(e.text, TYPE.regionNote));
|
|
1341
2139
|
const rights = [
|
|
1342
2140
|
...boxes.map((b) => b.x + b.w),
|
|
@@ -1354,18 +2152,14 @@ function layoutState(diagram, lang) {
|
|
|
1354
2152
|
layout.width = width;
|
|
1355
2153
|
layout.height = (strip2 ? strip2.y + strip2.h : bottom) + margin;
|
|
1356
2154
|
if (strip2) layout.strip = strip2;
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
}
|
|
1366
|
-
const [x, y] = badgeOnPath(edge2.points);
|
|
1367
|
-
return { step: s, x, y, color: edge2.color };
|
|
1368
|
-
});
|
|
2155
|
+
const placedBadges = lineBadges(sceneEdges, diagram.steps.length, badgeAt);
|
|
2156
|
+
layout.badges = replaceSameSpot(
|
|
2157
|
+
diagram.steps.map((step, s) => {
|
|
2158
|
+
const line = placedBadges.get(s);
|
|
2159
|
+
if (!line) return cornerBadge(step.events, s, layout);
|
|
2160
|
+
return { step: s, x: line.point[0], y: line.point[1], color: line.edge.color };
|
|
2161
|
+
})
|
|
2162
|
+
);
|
|
1369
2163
|
return layout;
|
|
1370
2164
|
}
|
|
1371
2165
|
function colorOf(edge2, colors) {
|
|
@@ -1405,6 +2199,8 @@ var ja = {
|
|
|
1405
2199
|
const: (value) => `${value} \u306B\u3059\u308B`,
|
|
1406
2200
|
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",
|
|
1407
2201
|
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`,
|
|
2202
|
+
kindOnly: (types, kind) => `${types.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,
|
|
2203
|
+
hex: (min, max) => `0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${min} \u304B\u3089 ${max} \u5B57\u306B\u3059\u308B`,
|
|
1408
2204
|
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",
|
|
1409
2205
|
oneOf: "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",
|
|
1410
2206
|
discriminator: (tag, values) => `${tag} \u306F ${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
|
|
@@ -1422,6 +2218,8 @@ var en = {
|
|
|
1422
2218
|
const: (value) => `Use ${value}`,
|
|
1423
2219
|
not: (allowed) => allowed ? `The ${allowed.field} field is allowed only when kind is ${allowed.kind}` : "This combination of fields is not allowed",
|
|
1424
2220
|
reserved: (names) => `${names.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,
|
|
2221
|
+
kindOnly: (types, kind) => `${types.join(" and ")} events are allowed only when kind is ${kind}`,
|
|
2222
|
+
hex: (min, max) => `Use ${min} to ${max} characters of 0-9 and a-f`,
|
|
1425
2223
|
anyOf: (fields) => fields.length > 0 ? `Write one of the ${fields.join(" or ")} fields` : "Does not match any of the allowed shapes",
|
|
1426
2224
|
oneOf: "Match exactly one of the allowed shapes",
|
|
1427
2225
|
discriminator: (tag, values) => `${tag} is one of ${values.join(" / ")}`,
|
|
@@ -1436,10 +2234,10 @@ function ucs2length(str) {
|
|
|
1436
2234
|
return length;
|
|
1437
2235
|
}
|
|
1438
2236
|
var validate_diagram_default = validate10;
|
|
1439
|
-
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", "
|
|
2237
|
+
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" } }};
|
|
1440
2238
|
var func2 = Object.prototype.hasOwnProperty;
|
|
1441
2239
|
var func3 = ucs2length;
|
|
1442
|
-
var
|
|
2240
|
+
var schema28 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
|
|
1443
2241
|
var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
|
|
1444
2242
|
function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
1445
2243
|
let vErrors = null;
|
|
@@ -1543,7 +2341,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1543
2341
|
if (data.color !== void 0) {
|
|
1544
2342
|
let data3 = data.color;
|
|
1545
2343
|
if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
|
|
1546
|
-
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues:
|
|
2344
|
+
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" };
|
|
1547
2345
|
if (vErrors === null) {
|
|
1548
2346
|
vErrors = [err9];
|
|
1549
2347
|
} else {
|
|
@@ -1688,7 +2486,7 @@ function validate13(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1688
2486
|
if (data.color !== void 0) {
|
|
1689
2487
|
let data3 = data.color;
|
|
1690
2488
|
if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
|
|
1691
|
-
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues:
|
|
2489
|
+
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" };
|
|
1692
2490
|
if (vErrors === null) {
|
|
1693
2491
|
vErrors = [err9];
|
|
1694
2492
|
} else {
|
|
@@ -1865,8 +2663,9 @@ function validate15(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1865
2663
|
validate15.errors = vErrors;
|
|
1866
2664
|
return errors === 0;
|
|
1867
2665
|
}
|
|
1868
|
-
var
|
|
1869
|
-
var
|
|
2666
|
+
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" } } }] };
|
|
2667
|
+
var pattern11 = new RegExp("^[0-9a-f]{4,40}$", "u");
|
|
2668
|
+
var schema48 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
|
|
1870
2669
|
function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
1871
2670
|
let vErrors = null;
|
|
1872
2671
|
let errors = 0;
|
|
@@ -1993,7 +2792,7 @@ function validate19(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1993
2792
|
if (data.kind !== void 0) {
|
|
1994
2793
|
let data1 = data.kind;
|
|
1995
2794
|
if (!(data1 === "envelope" || data1 === "tag" || data1 === "coin" || data1 === "none")) {
|
|
1996
|
-
const err8 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues:
|
|
2795
|
+
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" };
|
|
1997
2796
|
if (vErrors === null) {
|
|
1998
2797
|
vErrors = [err8];
|
|
1999
2798
|
} else {
|
|
@@ -2186,7 +2985,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2186
2985
|
if (data.labelSide !== void 0) {
|
|
2187
2986
|
let data5 = data.labelSide;
|
|
2188
2987
|
if (!(data5 === "above" || data5 === "below" || data5 === "left" || data5 === "right")) {
|
|
2189
|
-
const err13 = { instancePath: instancePath + "/labelSide", schemaPath: "#/oneOf/0/properties/labelSide/enum", keyword: "enum", params: { allowedValues:
|
|
2988
|
+
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" };
|
|
2190
2989
|
if (vErrors === null) {
|
|
2191
2990
|
vErrors = [err13];
|
|
2192
2991
|
} else {
|
|
@@ -2412,13 +3211,10 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2412
3211
|
}
|
|
2413
3212
|
errors++;
|
|
2414
3213
|
}
|
|
2415
|
-
} else if (tag0 === "
|
|
2416
|
-
const _errs39 = errors;
|
|
2417
|
-
let valid15 = false;
|
|
2418
|
-
const _errs40 = errors;
|
|
3214
|
+
} else if (tag0 === "commit") {
|
|
2419
3215
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2420
|
-
if (data.
|
|
2421
|
-
const err35 = { instancePath, schemaPath: "#/oneOf/3/
|
|
3216
|
+
if (data.type === void 0) {
|
|
3217
|
+
const err35 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
2422
3218
|
if (vErrors === null) {
|
|
2423
3219
|
vErrors = [err35];
|
|
2424
3220
|
} else {
|
|
@@ -2426,76 +3222,60 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2426
3222
|
}
|
|
2427
3223
|
errors++;
|
|
2428
3224
|
}
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
valid15 = valid15 || _valid0;
|
|
2432
|
-
if (!valid15) {
|
|
2433
|
-
const _errs41 = errors;
|
|
2434
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2435
|
-
if (data.tag === void 0) {
|
|
2436
|
-
const err36 = { instancePath, schemaPath: "#/oneOf/3/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
|
|
2437
|
-
if (vErrors === null) {
|
|
2438
|
-
vErrors = [err36];
|
|
2439
|
-
} else {
|
|
2440
|
-
vErrors.push(err36);
|
|
2441
|
-
}
|
|
2442
|
-
errors++;
|
|
2443
|
-
}
|
|
2444
|
-
}
|
|
2445
|
-
var _valid0 = _errs41 === errors;
|
|
2446
|
-
valid15 = valid15 || _valid0;
|
|
2447
|
-
}
|
|
2448
|
-
if (!valid15) {
|
|
2449
|
-
const err37 = { instancePath, schemaPath: "#/oneOf/3/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
2450
|
-
if (vErrors === null) {
|
|
2451
|
-
vErrors = [err37];
|
|
2452
|
-
} else {
|
|
2453
|
-
vErrors.push(err37);
|
|
2454
|
-
}
|
|
2455
|
-
errors++;
|
|
2456
|
-
} else {
|
|
2457
|
-
errors = _errs39;
|
|
2458
|
-
if (vErrors !== null) {
|
|
2459
|
-
if (_errs39) {
|
|
2460
|
-
vErrors.length = _errs39;
|
|
2461
|
-
} else {
|
|
2462
|
-
vErrors = null;
|
|
2463
|
-
}
|
|
2464
|
-
}
|
|
2465
|
-
}
|
|
2466
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2467
|
-
if (data.type === void 0) {
|
|
2468
|
-
const err38 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
3225
|
+
if (data.id === void 0) {
|
|
3226
|
+
const err36 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
|
|
2469
3227
|
if (vErrors === null) {
|
|
2470
|
-
vErrors = [
|
|
3228
|
+
vErrors = [err36];
|
|
2471
3229
|
} else {
|
|
2472
|
-
vErrors.push(
|
|
3230
|
+
vErrors.push(err36);
|
|
2473
3231
|
}
|
|
2474
3232
|
errors++;
|
|
2475
3233
|
}
|
|
2476
|
-
if (data.
|
|
2477
|
-
const
|
|
3234
|
+
if (data.branch === void 0) {
|
|
3235
|
+
const err37 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
|
|
2478
3236
|
if (vErrors === null) {
|
|
2479
|
-
vErrors = [
|
|
3237
|
+
vErrors = [err37];
|
|
2480
3238
|
} else {
|
|
2481
|
-
vErrors.push(
|
|
3239
|
+
vErrors.push(err37);
|
|
2482
3240
|
}
|
|
2483
3241
|
errors++;
|
|
2484
3242
|
}
|
|
2485
3243
|
for (const key3 in data) {
|
|
2486
|
-
if (!(key3 === "type" || key3 === "
|
|
2487
|
-
const
|
|
3244
|
+
if (!(key3 === "type" || key3 === "id" || key3 === "branch" || key3 === "copy" || key3 === "merge" || key3 === "hash" || key3 === "note")) {
|
|
3245
|
+
const err38 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
|
|
2488
3246
|
if (vErrors === null) {
|
|
2489
|
-
vErrors = [
|
|
3247
|
+
vErrors = [err38];
|
|
2490
3248
|
} else {
|
|
2491
|
-
vErrors.push(
|
|
3249
|
+
vErrors.push(err38);
|
|
2492
3250
|
}
|
|
2493
3251
|
errors++;
|
|
2494
3252
|
}
|
|
2495
3253
|
}
|
|
2496
3254
|
if (data.type !== void 0) {
|
|
2497
|
-
if ("
|
|
2498
|
-
const
|
|
3255
|
+
if ("commit" !== data.type) {
|
|
3256
|
+
const err39 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "commit" }, message: "must be equal to constant" };
|
|
3257
|
+
if (vErrors === null) {
|
|
3258
|
+
vErrors = [err39];
|
|
3259
|
+
} else {
|
|
3260
|
+
vErrors.push(err39);
|
|
3261
|
+
}
|
|
3262
|
+
errors++;
|
|
3263
|
+
}
|
|
3264
|
+
}
|
|
3265
|
+
if (data.id !== void 0) {
|
|
3266
|
+
let data13 = data.id;
|
|
3267
|
+
if (typeof data13 === "string") {
|
|
3268
|
+
if (!pattern0.test(data13)) {
|
|
3269
|
+
const err40 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
3270
|
+
if (vErrors === null) {
|
|
3271
|
+
vErrors = [err40];
|
|
3272
|
+
} else {
|
|
3273
|
+
vErrors.push(err40);
|
|
3274
|
+
}
|
|
3275
|
+
errors++;
|
|
3276
|
+
}
|
|
3277
|
+
} else {
|
|
3278
|
+
const err41 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2499
3279
|
if (vErrors === null) {
|
|
2500
3280
|
vErrors = [err41];
|
|
2501
3281
|
} else {
|
|
@@ -2504,11 +3284,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2504
3284
|
errors++;
|
|
2505
3285
|
}
|
|
2506
3286
|
}
|
|
2507
|
-
if (data.
|
|
2508
|
-
let
|
|
2509
|
-
if (typeof
|
|
2510
|
-
if (
|
|
2511
|
-
const err42 = { instancePath: instancePath + "/
|
|
3287
|
+
if (data.branch !== void 0) {
|
|
3288
|
+
let data14 = data.branch;
|
|
3289
|
+
if (typeof data14 === "string") {
|
|
3290
|
+
if (!pattern0.test(data14)) {
|
|
3291
|
+
const err42 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2512
3292
|
if (vErrors === null) {
|
|
2513
3293
|
vErrors = [err42];
|
|
2514
3294
|
} else {
|
|
@@ -2517,7 +3297,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2517
3297
|
errors++;
|
|
2518
3298
|
}
|
|
2519
3299
|
} else {
|
|
2520
|
-
const err43 = { instancePath: instancePath + "/
|
|
3300
|
+
const err43 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2521
3301
|
if (vErrors === null) {
|
|
2522
3302
|
vErrors = [err43];
|
|
2523
3303
|
} else {
|
|
@@ -2526,11 +3306,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2526
3306
|
errors++;
|
|
2527
3307
|
}
|
|
2528
3308
|
}
|
|
2529
|
-
if (data.
|
|
2530
|
-
let
|
|
2531
|
-
if (typeof
|
|
2532
|
-
if (
|
|
2533
|
-
const err44 = { instancePath: instancePath + "/
|
|
3309
|
+
if (data.copy !== void 0) {
|
|
3310
|
+
let data15 = data.copy;
|
|
3311
|
+
if (typeof data15 === "string") {
|
|
3312
|
+
if (!pattern0.test(data15)) {
|
|
3313
|
+
const err44 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2534
3314
|
if (vErrors === null) {
|
|
2535
3315
|
vErrors = [err44];
|
|
2536
3316
|
} else {
|
|
@@ -2539,7 +3319,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2539
3319
|
errors++;
|
|
2540
3320
|
}
|
|
2541
3321
|
} else {
|
|
2542
|
-
const err45 = { instancePath: instancePath + "/
|
|
3322
|
+
const err45 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2543
3323
|
if (vErrors === null) {
|
|
2544
3324
|
vErrors = [err45];
|
|
2545
3325
|
} else {
|
|
@@ -2548,11 +3328,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2548
3328
|
errors++;
|
|
2549
3329
|
}
|
|
2550
3330
|
}
|
|
2551
|
-
if (data.
|
|
2552
|
-
let
|
|
2553
|
-
if (typeof
|
|
2554
|
-
if (
|
|
2555
|
-
const err46 = { instancePath: instancePath + "/
|
|
3331
|
+
if (data.merge !== void 0) {
|
|
3332
|
+
let data16 = data.merge;
|
|
3333
|
+
if (typeof data16 === "string") {
|
|
3334
|
+
if (!pattern0.test(data16)) {
|
|
3335
|
+
const err46 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2556
3336
|
if (vErrors === null) {
|
|
2557
3337
|
vErrors = [err46];
|
|
2558
3338
|
} else {
|
|
@@ -2561,7 +3341,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2561
3341
|
errors++;
|
|
2562
3342
|
}
|
|
2563
3343
|
} else {
|
|
2564
|
-
const err47 = { instancePath: instancePath + "/
|
|
3344
|
+
const err47 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2565
3345
|
if (vErrors === null) {
|
|
2566
3346
|
vErrors = [err47];
|
|
2567
3347
|
} else {
|
|
@@ -2570,39 +3350,354 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2570
3350
|
errors++;
|
|
2571
3351
|
}
|
|
2572
3352
|
}
|
|
3353
|
+
if (data.hash !== void 0) {
|
|
3354
|
+
let data17 = data.hash;
|
|
3355
|
+
if (typeof data17 === "string") {
|
|
3356
|
+
if (!pattern11.test(data17)) {
|
|
3357
|
+
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}$"' };
|
|
3358
|
+
if (vErrors === null) {
|
|
3359
|
+
vErrors = [err48];
|
|
3360
|
+
} else {
|
|
3361
|
+
vErrors.push(err48);
|
|
3362
|
+
}
|
|
3363
|
+
errors++;
|
|
3364
|
+
}
|
|
3365
|
+
} else {
|
|
3366
|
+
const err49 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3367
|
+
if (vErrors === null) {
|
|
3368
|
+
vErrors = [err49];
|
|
3369
|
+
} else {
|
|
3370
|
+
vErrors.push(err49);
|
|
3371
|
+
}
|
|
3372
|
+
errors++;
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3375
|
+
if (data.note !== void 0) {
|
|
3376
|
+
let data18 = data.note;
|
|
3377
|
+
if (typeof data18 === "string") {
|
|
3378
|
+
if (func3(data18) < 1) {
|
|
3379
|
+
const err50 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3380
|
+
if (vErrors === null) {
|
|
3381
|
+
vErrors = [err50];
|
|
3382
|
+
} else {
|
|
3383
|
+
vErrors.push(err50);
|
|
3384
|
+
}
|
|
3385
|
+
errors++;
|
|
3386
|
+
}
|
|
3387
|
+
} else {
|
|
3388
|
+
const err51 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3389
|
+
if (vErrors === null) {
|
|
3390
|
+
vErrors = [err51];
|
|
3391
|
+
} else {
|
|
3392
|
+
vErrors.push(err51);
|
|
3393
|
+
}
|
|
3394
|
+
errors++;
|
|
3395
|
+
}
|
|
3396
|
+
}
|
|
2573
3397
|
} else {
|
|
2574
|
-
const
|
|
3398
|
+
const err52 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2575
3399
|
if (vErrors === null) {
|
|
2576
|
-
vErrors = [
|
|
3400
|
+
vErrors = [err52];
|
|
2577
3401
|
} else {
|
|
2578
|
-
vErrors.push(
|
|
3402
|
+
vErrors.push(err52);
|
|
2579
3403
|
}
|
|
2580
3404
|
errors++;
|
|
2581
3405
|
}
|
|
2582
|
-
} else {
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
3406
|
+
} else if (tag0 === "branch") {
|
|
3407
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3408
|
+
if (data.type === void 0) {
|
|
3409
|
+
const err53 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
3410
|
+
if (vErrors === null) {
|
|
3411
|
+
vErrors = [err53];
|
|
3412
|
+
} else {
|
|
3413
|
+
vErrors.push(err53);
|
|
3414
|
+
}
|
|
3415
|
+
errors++;
|
|
3416
|
+
}
|
|
3417
|
+
if (data.branch === void 0) {
|
|
3418
|
+
const err54 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
|
|
3419
|
+
if (vErrors === null) {
|
|
3420
|
+
vErrors = [err54];
|
|
3421
|
+
} else {
|
|
3422
|
+
vErrors.push(err54);
|
|
3423
|
+
}
|
|
3424
|
+
errors++;
|
|
3425
|
+
}
|
|
3426
|
+
if (data.from === void 0) {
|
|
3427
|
+
const err55 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
|
|
3428
|
+
if (vErrors === null) {
|
|
3429
|
+
vErrors = [err55];
|
|
3430
|
+
} else {
|
|
3431
|
+
vErrors.push(err55);
|
|
3432
|
+
}
|
|
3433
|
+
errors++;
|
|
3434
|
+
}
|
|
3435
|
+
for (const key4 in data) {
|
|
3436
|
+
if (!(key4 === "type" || key4 === "branch" || key4 === "from")) {
|
|
3437
|
+
const err56 = { instancePath, schemaPath: "#/oneOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
|
|
3438
|
+
if (vErrors === null) {
|
|
3439
|
+
vErrors = [err56];
|
|
3440
|
+
} else {
|
|
3441
|
+
vErrors.push(err56);
|
|
3442
|
+
}
|
|
3443
|
+
errors++;
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3446
|
+
if (data.type !== void 0) {
|
|
3447
|
+
if ("branch" !== data.type) {
|
|
3448
|
+
const err57 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/4/properties/type/const", keyword: "const", params: { allowedValue: "branch" }, message: "must be equal to constant" };
|
|
3449
|
+
if (vErrors === null) {
|
|
3450
|
+
vErrors = [err57];
|
|
3451
|
+
} else {
|
|
3452
|
+
vErrors.push(err57);
|
|
3453
|
+
}
|
|
3454
|
+
errors++;
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
if (data.branch !== void 0) {
|
|
3458
|
+
let data20 = data.branch;
|
|
3459
|
+
if (typeof data20 === "string") {
|
|
3460
|
+
if (!pattern0.test(data20)) {
|
|
3461
|
+
const err58 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
3462
|
+
if (vErrors === null) {
|
|
3463
|
+
vErrors = [err58];
|
|
3464
|
+
} else {
|
|
3465
|
+
vErrors.push(err58);
|
|
3466
|
+
}
|
|
3467
|
+
errors++;
|
|
3468
|
+
}
|
|
3469
|
+
} else {
|
|
3470
|
+
const err59 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3471
|
+
if (vErrors === null) {
|
|
3472
|
+
vErrors = [err59];
|
|
3473
|
+
} else {
|
|
3474
|
+
vErrors.push(err59);
|
|
3475
|
+
}
|
|
3476
|
+
errors++;
|
|
3477
|
+
}
|
|
3478
|
+
}
|
|
3479
|
+
if (data.from !== void 0) {
|
|
3480
|
+
let data21 = data.from;
|
|
3481
|
+
if (typeof data21 === "string") {
|
|
3482
|
+
if (!pattern0.test(data21)) {
|
|
3483
|
+
const err60 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
3484
|
+
if (vErrors === null) {
|
|
3485
|
+
vErrors = [err60];
|
|
3486
|
+
} else {
|
|
3487
|
+
vErrors.push(err60);
|
|
3488
|
+
}
|
|
3489
|
+
errors++;
|
|
3490
|
+
}
|
|
3491
|
+
} else {
|
|
3492
|
+
const err61 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3493
|
+
if (vErrors === null) {
|
|
3494
|
+
vErrors = [err61];
|
|
3495
|
+
} else {
|
|
3496
|
+
vErrors.push(err61);
|
|
3497
|
+
}
|
|
3498
|
+
errors++;
|
|
3499
|
+
}
|
|
3500
|
+
}
|
|
3501
|
+
} else {
|
|
3502
|
+
const err62 = { instancePath, schemaPath: "#/oneOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3503
|
+
if (vErrors === null) {
|
|
3504
|
+
vErrors = [err62];
|
|
3505
|
+
} else {
|
|
3506
|
+
vErrors.push(err62);
|
|
3507
|
+
}
|
|
3508
|
+
errors++;
|
|
3509
|
+
}
|
|
3510
|
+
} else if (tag0 === "strip") {
|
|
3511
|
+
const _errs71 = errors;
|
|
3512
|
+
let valid27 = false;
|
|
3513
|
+
const _errs72 = errors;
|
|
3514
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3515
|
+
if (data.value === void 0) {
|
|
3516
|
+
const err63 = { instancePath, schemaPath: "#/oneOf/5/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
|
|
3517
|
+
if (vErrors === null) {
|
|
3518
|
+
vErrors = [err63];
|
|
3519
|
+
} else {
|
|
3520
|
+
vErrors.push(err63);
|
|
3521
|
+
}
|
|
3522
|
+
errors++;
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
var _valid0 = _errs72 === errors;
|
|
3526
|
+
valid27 = valid27 || _valid0;
|
|
3527
|
+
if (!valid27) {
|
|
3528
|
+
const _errs73 = errors;
|
|
3529
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3530
|
+
if (data.tag === void 0) {
|
|
3531
|
+
const err64 = { instancePath, schemaPath: "#/oneOf/5/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
|
|
3532
|
+
if (vErrors === null) {
|
|
3533
|
+
vErrors = [err64];
|
|
3534
|
+
} else {
|
|
3535
|
+
vErrors.push(err64);
|
|
3536
|
+
}
|
|
3537
|
+
errors++;
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
var _valid0 = _errs73 === errors;
|
|
3541
|
+
valid27 = valid27 || _valid0;
|
|
3542
|
+
}
|
|
3543
|
+
if (!valid27) {
|
|
3544
|
+
const err65 = { instancePath, schemaPath: "#/oneOf/5/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
3545
|
+
if (vErrors === null) {
|
|
3546
|
+
vErrors = [err65];
|
|
3547
|
+
} else {
|
|
3548
|
+
vErrors.push(err65);
|
|
3549
|
+
}
|
|
3550
|
+
errors++;
|
|
3551
|
+
} else {
|
|
3552
|
+
errors = _errs71;
|
|
3553
|
+
if (vErrors !== null) {
|
|
3554
|
+
if (_errs71) {
|
|
3555
|
+
vErrors.length = _errs71;
|
|
3556
|
+
} else {
|
|
3557
|
+
vErrors = null;
|
|
3558
|
+
}
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3562
|
+
if (data.type === void 0) {
|
|
3563
|
+
const err66 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
3564
|
+
if (vErrors === null) {
|
|
3565
|
+
vErrors = [err66];
|
|
3566
|
+
} else {
|
|
3567
|
+
vErrors.push(err66);
|
|
3568
|
+
}
|
|
3569
|
+
errors++;
|
|
3570
|
+
}
|
|
3571
|
+
if (data.field === void 0) {
|
|
3572
|
+
const err67 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
|
|
3573
|
+
if (vErrors === null) {
|
|
3574
|
+
vErrors = [err67];
|
|
3575
|
+
} else {
|
|
3576
|
+
vErrors.push(err67);
|
|
3577
|
+
}
|
|
3578
|
+
errors++;
|
|
3579
|
+
}
|
|
3580
|
+
for (const key5 in data) {
|
|
3581
|
+
if (!(key5 === "type" || key5 === "field" || key5 === "value" || key5 === "tag")) {
|
|
3582
|
+
const err68 = { instancePath, schemaPath: "#/oneOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
|
|
3583
|
+
if (vErrors === null) {
|
|
3584
|
+
vErrors = [err68];
|
|
3585
|
+
} else {
|
|
3586
|
+
vErrors.push(err68);
|
|
3587
|
+
}
|
|
3588
|
+
errors++;
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
if (data.type !== void 0) {
|
|
3592
|
+
if ("strip" !== data.type) {
|
|
3593
|
+
const err69 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/5/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
|
|
3594
|
+
if (vErrors === null) {
|
|
3595
|
+
vErrors = [err69];
|
|
3596
|
+
} else {
|
|
3597
|
+
vErrors.push(err69);
|
|
3598
|
+
}
|
|
3599
|
+
errors++;
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3602
|
+
if (data.field !== void 0) {
|
|
3603
|
+
let data23 = data.field;
|
|
3604
|
+
if (typeof data23 === "string") {
|
|
3605
|
+
if (func3(data23) < 1) {
|
|
3606
|
+
const err70 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3607
|
+
if (vErrors === null) {
|
|
3608
|
+
vErrors = [err70];
|
|
3609
|
+
} else {
|
|
3610
|
+
vErrors.push(err70);
|
|
3611
|
+
}
|
|
3612
|
+
errors++;
|
|
3613
|
+
}
|
|
3614
|
+
} else {
|
|
3615
|
+
const err71 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3616
|
+
if (vErrors === null) {
|
|
3617
|
+
vErrors = [err71];
|
|
3618
|
+
} else {
|
|
3619
|
+
vErrors.push(err71);
|
|
3620
|
+
}
|
|
3621
|
+
errors++;
|
|
3622
|
+
}
|
|
3623
|
+
}
|
|
3624
|
+
if (data.value !== void 0) {
|
|
3625
|
+
let data24 = data.value;
|
|
3626
|
+
if (typeof data24 === "string") {
|
|
3627
|
+
if (func3(data24) < 1) {
|
|
3628
|
+
const err72 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3629
|
+
if (vErrors === null) {
|
|
3630
|
+
vErrors = [err72];
|
|
3631
|
+
} else {
|
|
3632
|
+
vErrors.push(err72);
|
|
3633
|
+
}
|
|
3634
|
+
errors++;
|
|
3635
|
+
}
|
|
3636
|
+
} else {
|
|
3637
|
+
const err73 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3638
|
+
if (vErrors === null) {
|
|
3639
|
+
vErrors = [err73];
|
|
3640
|
+
} else {
|
|
3641
|
+
vErrors.push(err73);
|
|
3642
|
+
}
|
|
3643
|
+
errors++;
|
|
3644
|
+
}
|
|
3645
|
+
}
|
|
3646
|
+
if (data.tag !== void 0) {
|
|
3647
|
+
let data25 = data.tag;
|
|
3648
|
+
if (typeof data25 === "string") {
|
|
3649
|
+
if (func3(data25) < 1) {
|
|
3650
|
+
const err74 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3651
|
+
if (vErrors === null) {
|
|
3652
|
+
vErrors = [err74];
|
|
3653
|
+
} else {
|
|
3654
|
+
vErrors.push(err74);
|
|
3655
|
+
}
|
|
3656
|
+
errors++;
|
|
3657
|
+
}
|
|
3658
|
+
} else {
|
|
3659
|
+
const err75 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3660
|
+
if (vErrors === null) {
|
|
3661
|
+
vErrors = [err75];
|
|
3662
|
+
} else {
|
|
3663
|
+
vErrors.push(err75);
|
|
3664
|
+
}
|
|
3665
|
+
errors++;
|
|
3666
|
+
}
|
|
3667
|
+
}
|
|
3668
|
+
} else {
|
|
3669
|
+
const err76 = { instancePath, schemaPath: "#/oneOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3670
|
+
if (vErrors === null) {
|
|
3671
|
+
vErrors = [err76];
|
|
3672
|
+
} else {
|
|
3673
|
+
vErrors.push(err76);
|
|
3674
|
+
}
|
|
3675
|
+
errors++;
|
|
3676
|
+
}
|
|
3677
|
+
} else {
|
|
3678
|
+
const err77 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
|
|
3679
|
+
if (vErrors === null) {
|
|
3680
|
+
vErrors = [err77];
|
|
3681
|
+
} else {
|
|
3682
|
+
vErrors.push(err77);
|
|
3683
|
+
}
|
|
3684
|
+
errors++;
|
|
3685
|
+
}
|
|
3686
|
+
} else {
|
|
3687
|
+
const err78 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
|
|
3688
|
+
if (vErrors === null) {
|
|
3689
|
+
vErrors = [err78];
|
|
3690
|
+
} else {
|
|
3691
|
+
vErrors.push(err78);
|
|
3692
|
+
}
|
|
3693
|
+
errors++;
|
|
3694
|
+
}
|
|
3695
|
+
} else {
|
|
3696
|
+
const err79 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3697
|
+
if (vErrors === null) {
|
|
3698
|
+
vErrors = [err79];
|
|
3699
|
+
} else {
|
|
3700
|
+
vErrors.push(err79);
|
|
2606
3701
|
}
|
|
2607
3702
|
errors++;
|
|
2608
3703
|
}
|
|
@@ -2891,62 +3986,207 @@ function validate26(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2891
3986
|
if (!pattern0.test(data1)) {
|
|
2892
3987
|
const err5 = { instancePath: instancePath + "/to", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2893
3988
|
if (vErrors === null) {
|
|
2894
|
-
vErrors = [err5];
|
|
3989
|
+
vErrors = [err5];
|
|
3990
|
+
} else {
|
|
3991
|
+
vErrors.push(err5);
|
|
3992
|
+
}
|
|
3993
|
+
errors++;
|
|
3994
|
+
}
|
|
3995
|
+
} else {
|
|
3996
|
+
const err6 = { instancePath: instancePath + "/to", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3997
|
+
if (vErrors === null) {
|
|
3998
|
+
vErrors = [err6];
|
|
3999
|
+
} else {
|
|
4000
|
+
vErrors.push(err6);
|
|
4001
|
+
}
|
|
4002
|
+
errors++;
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
if (data.label !== void 0) {
|
|
4006
|
+
let data2 = data.label;
|
|
4007
|
+
if (typeof data2 === "string") {
|
|
4008
|
+
if (func3(data2) < 1) {
|
|
4009
|
+
const err7 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
4010
|
+
if (vErrors === null) {
|
|
4011
|
+
vErrors = [err7];
|
|
4012
|
+
} else {
|
|
4013
|
+
vErrors.push(err7);
|
|
4014
|
+
}
|
|
4015
|
+
errors++;
|
|
4016
|
+
}
|
|
4017
|
+
} else {
|
|
4018
|
+
const err8 = { instancePath: instancePath + "/label", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
4019
|
+
if (vErrors === null) {
|
|
4020
|
+
vErrors = [err8];
|
|
4021
|
+
} else {
|
|
4022
|
+
vErrors.push(err8);
|
|
4023
|
+
}
|
|
4024
|
+
errors++;
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
} else {
|
|
4028
|
+
const err9 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
4029
|
+
if (vErrors === null) {
|
|
4030
|
+
vErrors = [err9];
|
|
4031
|
+
} else {
|
|
4032
|
+
vErrors.push(err9);
|
|
4033
|
+
}
|
|
4034
|
+
errors++;
|
|
4035
|
+
}
|
|
4036
|
+
validate26.errors = vErrors;
|
|
4037
|
+
return errors === 0;
|
|
4038
|
+
}
|
|
4039
|
+
function validate25(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
4040
|
+
let vErrors = null;
|
|
4041
|
+
let errors = 0;
|
|
4042
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4043
|
+
if (data.paths === void 0) {
|
|
4044
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "paths" }, message: "must have required property 'paths'" };
|
|
4045
|
+
if (vErrors === null) {
|
|
4046
|
+
vErrors = [err0];
|
|
4047
|
+
} else {
|
|
4048
|
+
vErrors.push(err0);
|
|
4049
|
+
}
|
|
4050
|
+
errors++;
|
|
4051
|
+
}
|
|
4052
|
+
for (const key0 in data) {
|
|
4053
|
+
if (!(key0 === "paths")) {
|
|
4054
|
+
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
4055
|
+
if (vErrors === null) {
|
|
4056
|
+
vErrors = [err1];
|
|
4057
|
+
} else {
|
|
4058
|
+
vErrors.push(err1);
|
|
4059
|
+
}
|
|
4060
|
+
errors++;
|
|
4061
|
+
}
|
|
4062
|
+
}
|
|
4063
|
+
if (data.paths !== void 0) {
|
|
4064
|
+
let data0 = data.paths;
|
|
4065
|
+
if (Array.isArray(data0)) {
|
|
4066
|
+
if (data0.length < 1) {
|
|
4067
|
+
const err2 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4068
|
+
if (vErrors === null) {
|
|
4069
|
+
vErrors = [err2];
|
|
4070
|
+
} else {
|
|
4071
|
+
vErrors.push(err2);
|
|
4072
|
+
}
|
|
4073
|
+
errors++;
|
|
4074
|
+
}
|
|
4075
|
+
const len0 = data0.length;
|
|
4076
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
4077
|
+
if (!validate26(data0[i0], { instancePath: instancePath + "/paths/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
|
|
4078
|
+
vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);
|
|
4079
|
+
errors = vErrors.length;
|
|
4080
|
+
}
|
|
4081
|
+
}
|
|
4082
|
+
} else {
|
|
4083
|
+
const err3 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
4084
|
+
if (vErrors === null) {
|
|
4085
|
+
vErrors = [err3];
|
|
4086
|
+
} else {
|
|
4087
|
+
vErrors.push(err3);
|
|
4088
|
+
}
|
|
4089
|
+
errors++;
|
|
4090
|
+
}
|
|
4091
|
+
}
|
|
4092
|
+
} else {
|
|
4093
|
+
const err4 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
4094
|
+
if (vErrors === null) {
|
|
4095
|
+
vErrors = [err4];
|
|
4096
|
+
} else {
|
|
4097
|
+
vErrors.push(err4);
|
|
4098
|
+
}
|
|
4099
|
+
errors++;
|
|
4100
|
+
}
|
|
4101
|
+
validate25.errors = vErrors;
|
|
4102
|
+
return errors === 0;
|
|
4103
|
+
}
|
|
4104
|
+
function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
4105
|
+
let vErrors = null;
|
|
4106
|
+
let errors = 0;
|
|
4107
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4108
|
+
if (data.id === void 0) {
|
|
4109
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
|
|
4110
|
+
if (vErrors === null) {
|
|
4111
|
+
vErrors = [err0];
|
|
4112
|
+
} else {
|
|
4113
|
+
vErrors.push(err0);
|
|
4114
|
+
}
|
|
4115
|
+
errors++;
|
|
4116
|
+
}
|
|
4117
|
+
for (const key0 in data) {
|
|
4118
|
+
if (!(key0 === "id" || key0 === "note")) {
|
|
4119
|
+
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
4120
|
+
if (vErrors === null) {
|
|
4121
|
+
vErrors = [err1];
|
|
4122
|
+
} else {
|
|
4123
|
+
vErrors.push(err1);
|
|
4124
|
+
}
|
|
4125
|
+
errors++;
|
|
4126
|
+
}
|
|
4127
|
+
}
|
|
4128
|
+
if (data.id !== void 0) {
|
|
4129
|
+
let data0 = data.id;
|
|
4130
|
+
if (typeof data0 === "string") {
|
|
4131
|
+
if (!pattern0.test(data0)) {
|
|
4132
|
+
const err2 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
4133
|
+
if (vErrors === null) {
|
|
4134
|
+
vErrors = [err2];
|
|
2895
4135
|
} else {
|
|
2896
|
-
vErrors.push(
|
|
4136
|
+
vErrors.push(err2);
|
|
2897
4137
|
}
|
|
2898
4138
|
errors++;
|
|
2899
4139
|
}
|
|
2900
4140
|
} else {
|
|
2901
|
-
const
|
|
4141
|
+
const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2902
4142
|
if (vErrors === null) {
|
|
2903
|
-
vErrors = [
|
|
4143
|
+
vErrors = [err3];
|
|
2904
4144
|
} else {
|
|
2905
|
-
vErrors.push(
|
|
4145
|
+
vErrors.push(err3);
|
|
2906
4146
|
}
|
|
2907
4147
|
errors++;
|
|
2908
4148
|
}
|
|
2909
4149
|
}
|
|
2910
|
-
if (data.
|
|
2911
|
-
let
|
|
2912
|
-
if (typeof
|
|
2913
|
-
if (func3(
|
|
2914
|
-
const
|
|
4150
|
+
if (data.note !== void 0) {
|
|
4151
|
+
let data1 = data.note;
|
|
4152
|
+
if (typeof data1 === "string") {
|
|
4153
|
+
if (func3(data1) < 1) {
|
|
4154
|
+
const err4 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
2915
4155
|
if (vErrors === null) {
|
|
2916
|
-
vErrors = [
|
|
4156
|
+
vErrors = [err4];
|
|
2917
4157
|
} else {
|
|
2918
|
-
vErrors.push(
|
|
4158
|
+
vErrors.push(err4);
|
|
2919
4159
|
}
|
|
2920
4160
|
errors++;
|
|
2921
4161
|
}
|
|
2922
4162
|
} else {
|
|
2923
|
-
const
|
|
4163
|
+
const err5 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2924
4164
|
if (vErrors === null) {
|
|
2925
|
-
vErrors = [
|
|
4165
|
+
vErrors = [err5];
|
|
2926
4166
|
} else {
|
|
2927
|
-
vErrors.push(
|
|
4167
|
+
vErrors.push(err5);
|
|
2928
4168
|
}
|
|
2929
4169
|
errors++;
|
|
2930
4170
|
}
|
|
2931
4171
|
}
|
|
2932
4172
|
} else {
|
|
2933
|
-
const
|
|
4173
|
+
const err6 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2934
4174
|
if (vErrors === null) {
|
|
2935
|
-
vErrors = [
|
|
4175
|
+
vErrors = [err6];
|
|
2936
4176
|
} else {
|
|
2937
|
-
vErrors.push(
|
|
4177
|
+
vErrors.push(err6);
|
|
2938
4178
|
}
|
|
2939
4179
|
errors++;
|
|
2940
4180
|
}
|
|
2941
|
-
|
|
4181
|
+
validate30.errors = vErrors;
|
|
2942
4182
|
return errors === 0;
|
|
2943
4183
|
}
|
|
2944
|
-
function
|
|
4184
|
+
function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
2945
4185
|
let vErrors = null;
|
|
2946
4186
|
let errors = 0;
|
|
2947
4187
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2948
|
-
if (data.
|
|
2949
|
-
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "
|
|
4188
|
+
if (data.branches === void 0) {
|
|
4189
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "branches" }, message: "must have required property 'branches'" };
|
|
2950
4190
|
if (vErrors === null) {
|
|
2951
4191
|
vErrors = [err0];
|
|
2952
4192
|
} else {
|
|
@@ -2955,7 +4195,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2955
4195
|
errors++;
|
|
2956
4196
|
}
|
|
2957
4197
|
for (const key0 in data) {
|
|
2958
|
-
if (!(key0 === "
|
|
4198
|
+
if (!(key0 === "branches")) {
|
|
2959
4199
|
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
2960
4200
|
if (vErrors === null) {
|
|
2961
4201
|
vErrors = [err1];
|
|
@@ -2965,11 +4205,11 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2965
4205
|
errors++;
|
|
2966
4206
|
}
|
|
2967
4207
|
}
|
|
2968
|
-
if (data.
|
|
2969
|
-
let data0 = data.
|
|
4208
|
+
if (data.branches !== void 0) {
|
|
4209
|
+
let data0 = data.branches;
|
|
2970
4210
|
if (Array.isArray(data0)) {
|
|
2971
4211
|
if (data0.length < 1) {
|
|
2972
|
-
const err2 = { instancePath: instancePath + "/
|
|
4212
|
+
const err2 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
2973
4213
|
if (vErrors === null) {
|
|
2974
4214
|
vErrors = [err2];
|
|
2975
4215
|
} else {
|
|
@@ -2979,13 +4219,13 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2979
4219
|
}
|
|
2980
4220
|
const len0 = data0.length;
|
|
2981
4221
|
for (let i0 = 0; i0 < len0; i0++) {
|
|
2982
|
-
if (!
|
|
2983
|
-
vErrors = vErrors === null ?
|
|
4222
|
+
if (!validate30(data0[i0], { instancePath: instancePath + "/branches/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
|
|
4223
|
+
vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors);
|
|
2984
4224
|
errors = vErrors.length;
|
|
2985
4225
|
}
|
|
2986
4226
|
}
|
|
2987
4227
|
} else {
|
|
2988
|
-
const err3 = { instancePath: instancePath + "/
|
|
4228
|
+
const err3 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
2989
4229
|
if (vErrors === null) {
|
|
2990
4230
|
vErrors = [err3];
|
|
2991
4231
|
} else {
|
|
@@ -3003,7 +4243,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3003
4243
|
}
|
|
3004
4244
|
errors++;
|
|
3005
4245
|
}
|
|
3006
|
-
|
|
4246
|
+
validate29.errors = vErrors;
|
|
3007
4247
|
return errors === 0;
|
|
3008
4248
|
}
|
|
3009
4249
|
function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
@@ -3047,11 +4287,9 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3047
4287
|
let ifClause0;
|
|
3048
4288
|
if (_valid0) {
|
|
3049
4289
|
const _errs4 = errors;
|
|
3050
|
-
const _errs5 = errors;
|
|
3051
|
-
const _errs6 = errors;
|
|
3052
4290
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3053
|
-
if (data.
|
|
3054
|
-
const err2 = {};
|
|
4291
|
+
if (data.sequence === void 0) {
|
|
4292
|
+
const err2 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
|
|
3055
4293
|
if (vErrors === null) {
|
|
3056
4294
|
vErrors = [err2];
|
|
3057
4295
|
} else {
|
|
@@ -3059,147 +4297,181 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3059
4297
|
}
|
|
3060
4298
|
errors++;
|
|
3061
4299
|
}
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
4300
|
+
if (data.boxes !== void 0) {
|
|
4301
|
+
let data1 = data.boxes;
|
|
4302
|
+
if (Array.isArray(data1)) {
|
|
4303
|
+
if (data1.length < 1) {
|
|
4304
|
+
const err3 = { instancePath: instancePath + "/boxes", schemaPath: "#/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4305
|
+
if (vErrors === null) {
|
|
4306
|
+
vErrors = [err3];
|
|
4307
|
+
} else {
|
|
4308
|
+
vErrors.push(err3);
|
|
4309
|
+
}
|
|
4310
|
+
errors++;
|
|
4311
|
+
}
|
|
4312
|
+
}
|
|
3070
4313
|
}
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
4314
|
+
if (data.steps !== void 0) {
|
|
4315
|
+
let data2 = data.steps;
|
|
4316
|
+
if (Array.isArray(data2)) {
|
|
4317
|
+
const len0 = data2.length;
|
|
4318
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
4319
|
+
let data3 = data2[i0];
|
|
4320
|
+
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
|
|
4321
|
+
if (data3.events !== void 0) {
|
|
4322
|
+
let data4 = data3.events;
|
|
4323
|
+
if (Array.isArray(data4)) {
|
|
4324
|
+
const len1 = data4.length;
|
|
4325
|
+
for (let i1 = 0; i1 < len1; i1++) {
|
|
4326
|
+
let data5 = data4[i1];
|
|
4327
|
+
if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
|
|
4328
|
+
if (data5.type !== void 0) {
|
|
4329
|
+
let data6 = data5.type;
|
|
4330
|
+
const _errs12 = errors;
|
|
4331
|
+
const _errs13 = errors;
|
|
4332
|
+
if (!(data6 === "commit" || data6 === "branch")) {
|
|
4333
|
+
const err4 = {};
|
|
4334
|
+
if (vErrors === null) {
|
|
4335
|
+
vErrors = [err4];
|
|
4336
|
+
} else {
|
|
4337
|
+
vErrors.push(err4);
|
|
4338
|
+
}
|
|
4339
|
+
errors++;
|
|
4340
|
+
}
|
|
4341
|
+
var valid10 = _errs13 === errors;
|
|
4342
|
+
if (valid10) {
|
|
4343
|
+
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" };
|
|
4344
|
+
if (vErrors === null) {
|
|
4345
|
+
vErrors = [err5];
|
|
4346
|
+
} else {
|
|
4347
|
+
vErrors.push(err5);
|
|
4348
|
+
}
|
|
4349
|
+
errors++;
|
|
4350
|
+
} else {
|
|
4351
|
+
errors = _errs12;
|
|
4352
|
+
if (vErrors !== null) {
|
|
4353
|
+
if (_errs12) {
|
|
4354
|
+
vErrors.length = _errs12;
|
|
4355
|
+
} else {
|
|
4356
|
+
vErrors = null;
|
|
4357
|
+
}
|
|
4358
|
+
}
|
|
4359
|
+
}
|
|
4360
|
+
}
|
|
4361
|
+
}
|
|
4362
|
+
}
|
|
4363
|
+
}
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
3079
4367
|
}
|
|
3080
4368
|
}
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
if (data.sequence === void 0) {
|
|
3084
|
-
const err4 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
|
|
4369
|
+
if (data.state !== void 0) {
|
|
4370
|
+
const err6 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
3085
4371
|
if (vErrors === null) {
|
|
3086
|
-
vErrors = [
|
|
4372
|
+
vErrors = [err6];
|
|
3087
4373
|
} else {
|
|
3088
|
-
vErrors.push(
|
|
4374
|
+
vErrors.push(err6);
|
|
3089
4375
|
}
|
|
3090
4376
|
errors++;
|
|
3091
4377
|
}
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
valid0 = _valid0;
|
|
3095
|
-
ifClause0 = "then";
|
|
3096
|
-
} else {
|
|
3097
|
-
const _errs7 = errors;
|
|
3098
|
-
const _errs8 = errors;
|
|
3099
|
-
const _errs9 = errors;
|
|
3100
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3101
|
-
if (data.sequence === void 0 && ("sequence")) {
|
|
3102
|
-
const err5 = {};
|
|
4378
|
+
if (data.git !== void 0) {
|
|
4379
|
+
const err7 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
3103
4380
|
if (vErrors === null) {
|
|
3104
|
-
vErrors = [
|
|
4381
|
+
vErrors = [err7];
|
|
3105
4382
|
} else {
|
|
3106
|
-
vErrors.push(
|
|
4383
|
+
vErrors.push(err7);
|
|
3107
4384
|
}
|
|
3108
4385
|
errors++;
|
|
3109
4386
|
}
|
|
3110
4387
|
}
|
|
3111
|
-
var
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
errors++;
|
|
3120
|
-
} else {
|
|
3121
|
-
errors = _errs8;
|
|
3122
|
-
if (vErrors !== null) {
|
|
3123
|
-
if (_errs8) {
|
|
3124
|
-
vErrors.length = _errs8;
|
|
3125
|
-
} else {
|
|
3126
|
-
vErrors = null;
|
|
3127
|
-
}
|
|
3128
|
-
}
|
|
3129
|
-
}
|
|
3130
|
-
const _errs10 = errors;
|
|
3131
|
-
let valid4 = true;
|
|
3132
|
-
const _errs11 = errors;
|
|
4388
|
+
var _valid0 = _errs4 === errors;
|
|
4389
|
+
valid0 = _valid0;
|
|
4390
|
+
ifClause0 = "then";
|
|
4391
|
+
} else {
|
|
4392
|
+
const _errs20 = errors;
|
|
4393
|
+
const _errs21 = errors;
|
|
4394
|
+
let valid13 = true;
|
|
4395
|
+
const _errs22 = errors;
|
|
3133
4396
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3134
4397
|
if (data.kind === void 0 && ("kind")) {
|
|
3135
|
-
const
|
|
4398
|
+
const err8 = {};
|
|
3136
4399
|
if (vErrors === null) {
|
|
3137
|
-
vErrors = [
|
|
4400
|
+
vErrors = [err8];
|
|
3138
4401
|
} else {
|
|
3139
|
-
vErrors.push(
|
|
4402
|
+
vErrors.push(err8);
|
|
3140
4403
|
}
|
|
3141
4404
|
errors++;
|
|
3142
4405
|
} else {
|
|
3143
4406
|
if (data.kind !== void 0) {
|
|
3144
4407
|
if ("state" !== data.kind) {
|
|
3145
|
-
const
|
|
4408
|
+
const err9 = {};
|
|
3146
4409
|
if (vErrors === null) {
|
|
3147
|
-
vErrors = [
|
|
4410
|
+
vErrors = [err9];
|
|
3148
4411
|
} else {
|
|
3149
|
-
vErrors.push(
|
|
4412
|
+
vErrors.push(err9);
|
|
3150
4413
|
}
|
|
3151
4414
|
errors++;
|
|
3152
4415
|
}
|
|
3153
4416
|
}
|
|
3154
4417
|
}
|
|
3155
4418
|
}
|
|
3156
|
-
var _valid1 =
|
|
3157
|
-
errors =
|
|
4419
|
+
var _valid1 = _errs22 === errors;
|
|
4420
|
+
errors = _errs21;
|
|
3158
4421
|
if (vErrors !== null) {
|
|
3159
|
-
if (
|
|
3160
|
-
vErrors.length =
|
|
4422
|
+
if (_errs21) {
|
|
4423
|
+
vErrors.length = _errs21;
|
|
3161
4424
|
} else {
|
|
3162
4425
|
vErrors = null;
|
|
3163
4426
|
}
|
|
3164
4427
|
}
|
|
3165
4428
|
let ifClause1;
|
|
3166
4429
|
if (_valid1) {
|
|
3167
|
-
const
|
|
4430
|
+
const _errs24 = errors;
|
|
3168
4431
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3169
4432
|
if (data.boxes !== void 0) {
|
|
3170
|
-
let
|
|
3171
|
-
if (Array.isArray(
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
4433
|
+
let data10 = data.boxes;
|
|
4434
|
+
if (Array.isArray(data10)) {
|
|
4435
|
+
if (data10.length < 1) {
|
|
4436
|
+
const err10 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4437
|
+
if (vErrors === null) {
|
|
4438
|
+
vErrors = [err10];
|
|
4439
|
+
} else {
|
|
4440
|
+
vErrors.push(err10);
|
|
4441
|
+
}
|
|
4442
|
+
errors++;
|
|
4443
|
+
}
|
|
4444
|
+
const len2 = data10.length;
|
|
4445
|
+
for (let i2 = 0; i2 < len2; i2++) {
|
|
4446
|
+
let data11 = data10[i2];
|
|
4447
|
+
if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
|
|
4448
|
+
if (data11.id !== void 0) {
|
|
4449
|
+
let data12 = data11.id;
|
|
4450
|
+
const _errs28 = errors;
|
|
4451
|
+
const _errs29 = errors;
|
|
4452
|
+
if (!(data12 === "start" || data12 === "finish")) {
|
|
4453
|
+
const err11 = {};
|
|
3182
4454
|
if (vErrors === null) {
|
|
3183
|
-
vErrors = [
|
|
4455
|
+
vErrors = [err11];
|
|
3184
4456
|
} else {
|
|
3185
|
-
vErrors.push(
|
|
4457
|
+
vErrors.push(err11);
|
|
3186
4458
|
}
|
|
3187
4459
|
errors++;
|
|
3188
4460
|
}
|
|
3189
|
-
var
|
|
3190
|
-
if (
|
|
3191
|
-
const
|
|
4461
|
+
var valid19 = _errs29 === errors;
|
|
4462
|
+
if (valid19) {
|
|
4463
|
+
const err12 = { instancePath: instancePath + "/boxes/" + i2 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
3192
4464
|
if (vErrors === null) {
|
|
3193
|
-
vErrors = [
|
|
4465
|
+
vErrors = [err12];
|
|
3194
4466
|
} else {
|
|
3195
|
-
vErrors.push(
|
|
4467
|
+
vErrors.push(err12);
|
|
3196
4468
|
}
|
|
3197
4469
|
errors++;
|
|
3198
4470
|
} else {
|
|
3199
|
-
errors =
|
|
4471
|
+
errors = _errs28;
|
|
3200
4472
|
if (vErrors !== null) {
|
|
3201
|
-
if (
|
|
3202
|
-
vErrors.length =
|
|
4473
|
+
if (_errs28) {
|
|
4474
|
+
vErrors.length = _errs28;
|
|
3203
4475
|
} else {
|
|
3204
4476
|
vErrors = null;
|
|
3205
4477
|
}
|
|
@@ -3210,241 +4482,449 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3210
4482
|
}
|
|
3211
4483
|
}
|
|
3212
4484
|
}
|
|
4485
|
+
if (data.steps !== void 0) {
|
|
4486
|
+
let data13 = data.steps;
|
|
4487
|
+
if (Array.isArray(data13)) {
|
|
4488
|
+
const len3 = data13.length;
|
|
4489
|
+
for (let i3 = 0; i3 < len3; i3++) {
|
|
4490
|
+
let data14 = data13[i3];
|
|
4491
|
+
if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
|
|
4492
|
+
if (data14.events !== void 0) {
|
|
4493
|
+
let data15 = data14.events;
|
|
4494
|
+
if (Array.isArray(data15)) {
|
|
4495
|
+
const len4 = data15.length;
|
|
4496
|
+
for (let i4 = 0; i4 < len4; i4++) {
|
|
4497
|
+
let data16 = data15[i4];
|
|
4498
|
+
if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
|
|
4499
|
+
if (data16.type !== void 0) {
|
|
4500
|
+
let data17 = data16.type;
|
|
4501
|
+
const _errs36 = errors;
|
|
4502
|
+
const _errs37 = errors;
|
|
4503
|
+
if (!(data17 === "commit" || data17 === "branch")) {
|
|
4504
|
+
const err13 = {};
|
|
4505
|
+
if (vErrors === null) {
|
|
4506
|
+
vErrors = [err13];
|
|
4507
|
+
} else {
|
|
4508
|
+
vErrors.push(err13);
|
|
4509
|
+
}
|
|
4510
|
+
errors++;
|
|
4511
|
+
}
|
|
4512
|
+
var valid27 = _errs37 === errors;
|
|
4513
|
+
if (valid27) {
|
|
4514
|
+
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" };
|
|
4515
|
+
if (vErrors === null) {
|
|
4516
|
+
vErrors = [err14];
|
|
4517
|
+
} else {
|
|
4518
|
+
vErrors.push(err14);
|
|
4519
|
+
}
|
|
4520
|
+
errors++;
|
|
4521
|
+
} else {
|
|
4522
|
+
errors = _errs36;
|
|
4523
|
+
if (vErrors !== null) {
|
|
4524
|
+
if (_errs36) {
|
|
4525
|
+
vErrors.length = _errs36;
|
|
4526
|
+
} else {
|
|
4527
|
+
vErrors = null;
|
|
4528
|
+
}
|
|
4529
|
+
}
|
|
4530
|
+
}
|
|
4531
|
+
}
|
|
4532
|
+
}
|
|
4533
|
+
}
|
|
4534
|
+
}
|
|
4535
|
+
}
|
|
4536
|
+
}
|
|
4537
|
+
}
|
|
4538
|
+
}
|
|
4539
|
+
}
|
|
4540
|
+
if (data.git !== void 0) {
|
|
4541
|
+
const err15 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4542
|
+
if (vErrors === null) {
|
|
4543
|
+
vErrors = [err15];
|
|
4544
|
+
} else {
|
|
4545
|
+
vErrors.push(err15);
|
|
4546
|
+
}
|
|
4547
|
+
errors++;
|
|
4548
|
+
}
|
|
3213
4549
|
}
|
|
3214
|
-
var _valid1 =
|
|
3215
|
-
|
|
4550
|
+
var _valid1 = _errs24 === errors;
|
|
4551
|
+
valid13 = _valid1;
|
|
3216
4552
|
ifClause1 = "then";
|
|
3217
4553
|
} else {
|
|
3218
|
-
const
|
|
3219
|
-
const
|
|
3220
|
-
|
|
4554
|
+
const _errs41 = errors;
|
|
4555
|
+
const _errs42 = errors;
|
|
4556
|
+
let valid29 = true;
|
|
4557
|
+
const _errs43 = errors;
|
|
3221
4558
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3222
|
-
if (data.
|
|
3223
|
-
const
|
|
4559
|
+
if (data.kind === void 0 && ("kind")) {
|
|
4560
|
+
const err16 = {};
|
|
3224
4561
|
if (vErrors === null) {
|
|
3225
|
-
vErrors = [
|
|
4562
|
+
vErrors = [err16];
|
|
3226
4563
|
} else {
|
|
3227
|
-
vErrors.push(
|
|
4564
|
+
vErrors.push(err16);
|
|
3228
4565
|
}
|
|
3229
4566
|
errors++;
|
|
4567
|
+
} else {
|
|
4568
|
+
if (data.kind !== void 0) {
|
|
4569
|
+
if ("git" !== data.kind) {
|
|
4570
|
+
const err17 = {};
|
|
4571
|
+
if (vErrors === null) {
|
|
4572
|
+
vErrors = [err17];
|
|
4573
|
+
} else {
|
|
4574
|
+
vErrors.push(err17);
|
|
4575
|
+
}
|
|
4576
|
+
errors++;
|
|
4577
|
+
}
|
|
4578
|
+
}
|
|
3230
4579
|
}
|
|
3231
4580
|
}
|
|
3232
|
-
var
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
if (
|
|
3236
|
-
vErrors =
|
|
4581
|
+
var _valid2 = _errs43 === errors;
|
|
4582
|
+
errors = _errs42;
|
|
4583
|
+
if (vErrors !== null) {
|
|
4584
|
+
if (_errs42) {
|
|
4585
|
+
vErrors.length = _errs42;
|
|
3237
4586
|
} else {
|
|
3238
|
-
vErrors
|
|
4587
|
+
vErrors = null;
|
|
3239
4588
|
}
|
|
3240
|
-
|
|
4589
|
+
}
|
|
4590
|
+
let ifClause2;
|
|
4591
|
+
if (_valid2) {
|
|
4592
|
+
const _errs45 = errors;
|
|
4593
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4594
|
+
if (data.git === void 0) {
|
|
4595
|
+
const err18 = { instancePath, schemaPath: "#/else/else/then/required", keyword: "required", params: { missingProperty: "git" }, message: "must have required property 'git'" };
|
|
4596
|
+
if (vErrors === null) {
|
|
4597
|
+
vErrors = [err18];
|
|
4598
|
+
} else {
|
|
4599
|
+
vErrors.push(err18);
|
|
4600
|
+
}
|
|
4601
|
+
errors++;
|
|
4602
|
+
}
|
|
4603
|
+
if (data.state !== void 0) {
|
|
4604
|
+
const err19 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4605
|
+
if (vErrors === null) {
|
|
4606
|
+
vErrors = [err19];
|
|
4607
|
+
} else {
|
|
4608
|
+
vErrors.push(err19);
|
|
4609
|
+
}
|
|
4610
|
+
errors++;
|
|
4611
|
+
}
|
|
4612
|
+
if (data.regions !== void 0) {
|
|
4613
|
+
const err20 = { instancePath: instancePath + "/regions", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4614
|
+
if (vErrors === null) {
|
|
4615
|
+
vErrors = [err20];
|
|
4616
|
+
} else {
|
|
4617
|
+
vErrors.push(err20);
|
|
4618
|
+
}
|
|
4619
|
+
errors++;
|
|
4620
|
+
}
|
|
4621
|
+
}
|
|
4622
|
+
var _valid2 = _errs45 === errors;
|
|
4623
|
+
valid29 = _valid2;
|
|
4624
|
+
ifClause2 = "then";
|
|
3241
4625
|
} else {
|
|
3242
|
-
|
|
3243
|
-
if (
|
|
3244
|
-
if (
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
4626
|
+
const _errs52 = errors;
|
|
4627
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4628
|
+
if (data.boxes !== void 0) {
|
|
4629
|
+
let data22 = data.boxes;
|
|
4630
|
+
if (Array.isArray(data22)) {
|
|
4631
|
+
if (data22.length < 1) {
|
|
4632
|
+
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" };
|
|
4633
|
+
if (vErrors === null) {
|
|
4634
|
+
vErrors = [err21];
|
|
4635
|
+
} else {
|
|
4636
|
+
vErrors.push(err21);
|
|
4637
|
+
}
|
|
4638
|
+
errors++;
|
|
4639
|
+
}
|
|
4640
|
+
}
|
|
4641
|
+
}
|
|
4642
|
+
if (data.steps !== void 0) {
|
|
4643
|
+
let data23 = data.steps;
|
|
4644
|
+
if (Array.isArray(data23)) {
|
|
4645
|
+
const len5 = data23.length;
|
|
4646
|
+
for (let i5 = 0; i5 < len5; i5++) {
|
|
4647
|
+
let data24 = data23[i5];
|
|
4648
|
+
if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
|
|
4649
|
+
if (data24.events !== void 0) {
|
|
4650
|
+
let data25 = data24.events;
|
|
4651
|
+
if (Array.isArray(data25)) {
|
|
4652
|
+
const len6 = data25.length;
|
|
4653
|
+
for (let i6 = 0; i6 < len6; i6++) {
|
|
4654
|
+
let data26 = data25[i6];
|
|
4655
|
+
if (data26 && typeof data26 == "object" && !Array.isArray(data26)) {
|
|
4656
|
+
if (data26.type !== void 0) {
|
|
4657
|
+
let data27 = data26.type;
|
|
4658
|
+
const _errs60 = errors;
|
|
4659
|
+
const _errs61 = errors;
|
|
4660
|
+
if (!(data27 === "commit" || data27 === "branch")) {
|
|
4661
|
+
const err22 = {};
|
|
4662
|
+
if (vErrors === null) {
|
|
4663
|
+
vErrors = [err22];
|
|
4664
|
+
} else {
|
|
4665
|
+
vErrors.push(err22);
|
|
4666
|
+
}
|
|
4667
|
+
errors++;
|
|
4668
|
+
}
|
|
4669
|
+
var valid42 = _errs61 === errors;
|
|
4670
|
+
if (valid42) {
|
|
4671
|
+
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" };
|
|
4672
|
+
if (vErrors === null) {
|
|
4673
|
+
vErrors = [err23];
|
|
4674
|
+
} else {
|
|
4675
|
+
vErrors.push(err23);
|
|
4676
|
+
}
|
|
4677
|
+
errors++;
|
|
4678
|
+
} else {
|
|
4679
|
+
errors = _errs60;
|
|
4680
|
+
if (vErrors !== null) {
|
|
4681
|
+
if (_errs60) {
|
|
4682
|
+
vErrors.length = _errs60;
|
|
4683
|
+
} else {
|
|
4684
|
+
vErrors = null;
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
}
|
|
4688
|
+
}
|
|
4689
|
+
}
|
|
4690
|
+
}
|
|
4691
|
+
}
|
|
4692
|
+
}
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
}
|
|
4696
|
+
}
|
|
4697
|
+
if (data.state !== void 0) {
|
|
4698
|
+
const err24 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4699
|
+
if (vErrors === null) {
|
|
4700
|
+
vErrors = [err24];
|
|
4701
|
+
} else {
|
|
4702
|
+
vErrors.push(err24);
|
|
4703
|
+
}
|
|
4704
|
+
errors++;
|
|
4705
|
+
}
|
|
4706
|
+
if (data.git !== void 0) {
|
|
4707
|
+
const err25 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4708
|
+
if (vErrors === null) {
|
|
4709
|
+
vErrors = [err25];
|
|
4710
|
+
} else {
|
|
4711
|
+
vErrors.push(err25);
|
|
4712
|
+
}
|
|
4713
|
+
errors++;
|
|
3248
4714
|
}
|
|
3249
4715
|
}
|
|
4716
|
+
var _valid2 = _errs52 === errors;
|
|
4717
|
+
valid29 = _valid2;
|
|
4718
|
+
ifClause2 = "else";
|
|
4719
|
+
}
|
|
4720
|
+
if (!valid29) {
|
|
4721
|
+
const err26 = { instancePath, schemaPath: "#/else/else/if", keyword: "if", params: { failingKeyword: ifClause2 }, message: 'must match "' + ifClause2 + '" schema' };
|
|
4722
|
+
if (vErrors === null) {
|
|
4723
|
+
vErrors = [err26];
|
|
4724
|
+
} else {
|
|
4725
|
+
vErrors.push(err26);
|
|
4726
|
+
}
|
|
4727
|
+
errors++;
|
|
3250
4728
|
}
|
|
3251
|
-
var _valid1 =
|
|
3252
|
-
|
|
4729
|
+
var _valid1 = _errs41 === errors;
|
|
4730
|
+
valid13 = _valid1;
|
|
3253
4731
|
ifClause1 = "else";
|
|
3254
4732
|
}
|
|
3255
|
-
if (!
|
|
3256
|
-
const
|
|
4733
|
+
if (!valid13) {
|
|
4734
|
+
const err27 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
|
|
3257
4735
|
if (vErrors === null) {
|
|
3258
|
-
vErrors = [
|
|
4736
|
+
vErrors = [err27];
|
|
3259
4737
|
} else {
|
|
3260
|
-
vErrors.push(
|
|
4738
|
+
vErrors.push(err27);
|
|
3261
4739
|
}
|
|
3262
4740
|
errors++;
|
|
3263
4741
|
}
|
|
3264
|
-
|
|
4742
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4743
|
+
if (data.sequence !== void 0) {
|
|
4744
|
+
const err28 = { instancePath: instancePath + "/sequence", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4745
|
+
if (vErrors === null) {
|
|
4746
|
+
vErrors = [err28];
|
|
4747
|
+
} else {
|
|
4748
|
+
vErrors.push(err28);
|
|
4749
|
+
}
|
|
4750
|
+
errors++;
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
var _valid0 = _errs20 === errors;
|
|
3265
4754
|
valid0 = _valid0;
|
|
3266
4755
|
ifClause0 = "else";
|
|
3267
4756
|
}
|
|
3268
4757
|
if (!valid0) {
|
|
3269
|
-
const
|
|
4758
|
+
const err29 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
|
|
3270
4759
|
if (vErrors === null) {
|
|
3271
|
-
vErrors = [
|
|
4760
|
+
vErrors = [err29];
|
|
3272
4761
|
} else {
|
|
3273
|
-
vErrors.push(
|
|
4762
|
+
vErrors.push(err29);
|
|
3274
4763
|
}
|
|
3275
4764
|
errors++;
|
|
3276
4765
|
}
|
|
3277
4766
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3278
4767
|
if (data.version === void 0) {
|
|
3279
|
-
const
|
|
4768
|
+
const err30 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
|
|
3280
4769
|
if (vErrors === null) {
|
|
3281
|
-
vErrors = [
|
|
4770
|
+
vErrors = [err30];
|
|
3282
4771
|
} else {
|
|
3283
|
-
vErrors.push(
|
|
4772
|
+
vErrors.push(err30);
|
|
3284
4773
|
}
|
|
3285
4774
|
errors++;
|
|
3286
4775
|
}
|
|
3287
4776
|
if (data.kind === void 0) {
|
|
3288
|
-
const
|
|
4777
|
+
const err31 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
|
|
3289
4778
|
if (vErrors === null) {
|
|
3290
|
-
vErrors = [
|
|
4779
|
+
vErrors = [err31];
|
|
3291
4780
|
} else {
|
|
3292
|
-
vErrors.push(
|
|
4781
|
+
vErrors.push(err31);
|
|
3293
4782
|
}
|
|
3294
4783
|
errors++;
|
|
3295
4784
|
}
|
|
3296
4785
|
if (data.title === void 0) {
|
|
3297
|
-
const
|
|
4786
|
+
const err32 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
|
|
3298
4787
|
if (vErrors === null) {
|
|
3299
|
-
vErrors = [
|
|
4788
|
+
vErrors = [err32];
|
|
3300
4789
|
} else {
|
|
3301
|
-
vErrors.push(
|
|
4790
|
+
vErrors.push(err32);
|
|
3302
4791
|
}
|
|
3303
4792
|
errors++;
|
|
3304
4793
|
}
|
|
3305
4794
|
if (data.boxes === void 0) {
|
|
3306
|
-
const
|
|
4795
|
+
const err33 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
|
|
3307
4796
|
if (vErrors === null) {
|
|
3308
|
-
vErrors = [
|
|
4797
|
+
vErrors = [err33];
|
|
3309
4798
|
} else {
|
|
3310
|
-
vErrors.push(
|
|
4799
|
+
vErrors.push(err33);
|
|
3311
4800
|
}
|
|
3312
4801
|
errors++;
|
|
3313
4802
|
}
|
|
3314
4803
|
if (data.steps === void 0) {
|
|
3315
|
-
const
|
|
4804
|
+
const err34 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
|
|
3316
4805
|
if (vErrors === null) {
|
|
3317
|
-
vErrors = [
|
|
4806
|
+
vErrors = [err34];
|
|
3318
4807
|
} else {
|
|
3319
|
-
vErrors.push(
|
|
4808
|
+
vErrors.push(err34);
|
|
3320
4809
|
}
|
|
3321
4810
|
errors++;
|
|
3322
4811
|
}
|
|
3323
4812
|
for (const key0 in data) {
|
|
3324
4813
|
if (!func2.call(schema11.properties, key0)) {
|
|
3325
|
-
const
|
|
4814
|
+
const err35 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
3326
4815
|
if (vErrors === null) {
|
|
3327
|
-
vErrors = [
|
|
4816
|
+
vErrors = [err35];
|
|
3328
4817
|
} else {
|
|
3329
|
-
vErrors.push(
|
|
4818
|
+
vErrors.push(err35);
|
|
3330
4819
|
}
|
|
3331
4820
|
errors++;
|
|
3332
4821
|
}
|
|
3333
4822
|
}
|
|
3334
4823
|
if (data.version !== void 0) {
|
|
3335
|
-
let
|
|
3336
|
-
if (!(typeof
|
|
3337
|
-
const
|
|
4824
|
+
let data31 = data.version;
|
|
4825
|
+
if (!(typeof data31 == "number" && (!(data31 % 1) && !isNaN(data31)) && isFinite(data31))) {
|
|
4826
|
+
const err36 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
|
|
3338
4827
|
if (vErrors === null) {
|
|
3339
|
-
vErrors = [
|
|
4828
|
+
vErrors = [err36];
|
|
3340
4829
|
} else {
|
|
3341
|
-
vErrors.push(
|
|
4830
|
+
vErrors.push(err36);
|
|
3342
4831
|
}
|
|
3343
4832
|
errors++;
|
|
3344
4833
|
}
|
|
3345
|
-
if (typeof
|
|
3346
|
-
if (
|
|
3347
|
-
const
|
|
4834
|
+
if (typeof data31 == "number" && isFinite(data31)) {
|
|
4835
|
+
if (data31 < 1 || isNaN(data31)) {
|
|
4836
|
+
const err37 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
|
|
3348
4837
|
if (vErrors === null) {
|
|
3349
|
-
vErrors = [
|
|
4838
|
+
vErrors = [err37];
|
|
3350
4839
|
} else {
|
|
3351
|
-
vErrors.push(
|
|
4840
|
+
vErrors.push(err37);
|
|
3352
4841
|
}
|
|
3353
4842
|
errors++;
|
|
3354
4843
|
}
|
|
3355
4844
|
}
|
|
3356
4845
|
}
|
|
3357
4846
|
if (data.kind !== void 0) {
|
|
3358
|
-
let
|
|
3359
|
-
if (!(
|
|
3360
|
-
const
|
|
4847
|
+
let data32 = data.kind;
|
|
4848
|
+
if (!(data32 === "sequence" || data32 === "architecture" || data32 === "state" || data32 === "git")) {
|
|
4849
|
+
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" };
|
|
3361
4850
|
if (vErrors === null) {
|
|
3362
|
-
vErrors = [
|
|
4851
|
+
vErrors = [err38];
|
|
3363
4852
|
} else {
|
|
3364
|
-
vErrors.push(
|
|
4853
|
+
vErrors.push(err38);
|
|
3365
4854
|
}
|
|
3366
4855
|
errors++;
|
|
3367
4856
|
}
|
|
3368
4857
|
}
|
|
3369
4858
|
if (data.title !== void 0) {
|
|
3370
|
-
let
|
|
3371
|
-
if (typeof
|
|
3372
|
-
if (func3(
|
|
3373
|
-
const
|
|
4859
|
+
let data33 = data.title;
|
|
4860
|
+
if (typeof data33 === "string") {
|
|
4861
|
+
if (func3(data33) < 1) {
|
|
4862
|
+
const err39 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3374
4863
|
if (vErrors === null) {
|
|
3375
|
-
vErrors = [
|
|
4864
|
+
vErrors = [err39];
|
|
3376
4865
|
} else {
|
|
3377
|
-
vErrors.push(
|
|
4866
|
+
vErrors.push(err39);
|
|
3378
4867
|
}
|
|
3379
4868
|
errors++;
|
|
3380
4869
|
}
|
|
3381
4870
|
} else {
|
|
3382
|
-
const
|
|
4871
|
+
const err40 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3383
4872
|
if (vErrors === null) {
|
|
3384
|
-
vErrors = [
|
|
4873
|
+
vErrors = [err40];
|
|
3385
4874
|
} else {
|
|
3386
|
-
vErrors.push(
|
|
4875
|
+
vErrors.push(err40);
|
|
3387
4876
|
}
|
|
3388
4877
|
errors++;
|
|
3389
4878
|
}
|
|
3390
4879
|
}
|
|
3391
4880
|
if (data.view !== void 0) {
|
|
3392
|
-
let
|
|
3393
|
-
if (!(
|
|
3394
|
-
const
|
|
4881
|
+
let data34 = data.view;
|
|
4882
|
+
if (!(data34 === "fixed" || data34 === "follow")) {
|
|
4883
|
+
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" };
|
|
3395
4884
|
if (vErrors === null) {
|
|
3396
|
-
vErrors = [
|
|
4885
|
+
vErrors = [err41];
|
|
3397
4886
|
} else {
|
|
3398
|
-
vErrors.push(
|
|
4887
|
+
vErrors.push(err41);
|
|
3399
4888
|
}
|
|
3400
4889
|
errors++;
|
|
3401
4890
|
}
|
|
3402
4891
|
}
|
|
3403
4892
|
if (data.regions !== void 0) {
|
|
3404
|
-
let
|
|
3405
|
-
if (Array.isArray(
|
|
3406
|
-
const
|
|
3407
|
-
for (let
|
|
3408
|
-
if (!validate11(
|
|
4893
|
+
let data35 = data.regions;
|
|
4894
|
+
if (Array.isArray(data35)) {
|
|
4895
|
+
const len7 = data35.length;
|
|
4896
|
+
for (let i7 = 0; i7 < len7; i7++) {
|
|
4897
|
+
if (!validate11(data35[i7], { instancePath: instancePath + "/regions/" + i7, parentData: data35, parentDataProperty: i7, rootData })) {
|
|
3409
4898
|
vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);
|
|
3410
4899
|
errors = vErrors.length;
|
|
3411
4900
|
}
|
|
3412
4901
|
}
|
|
3413
4902
|
} else {
|
|
3414
|
-
const
|
|
4903
|
+
const err42 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3415
4904
|
if (vErrors === null) {
|
|
3416
|
-
vErrors = [
|
|
4905
|
+
vErrors = [err42];
|
|
3417
4906
|
} else {
|
|
3418
|
-
vErrors.push(
|
|
4907
|
+
vErrors.push(err42);
|
|
3419
4908
|
}
|
|
3420
4909
|
errors++;
|
|
3421
4910
|
}
|
|
3422
4911
|
}
|
|
3423
4912
|
if (data.boxes !== void 0) {
|
|
3424
|
-
let
|
|
3425
|
-
if (Array.isArray(
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
if (
|
|
3429
|
-
vErrors = [err28];
|
|
3430
|
-
} else {
|
|
3431
|
-
vErrors.push(err28);
|
|
3432
|
-
}
|
|
3433
|
-
errors++;
|
|
3434
|
-
}
|
|
3435
|
-
const len2 = data11.length;
|
|
3436
|
-
for (let i2 = 0; i2 < len2; i2++) {
|
|
3437
|
-
if (!validate13(data11[i2], { instancePath: instancePath + "/boxes/" + i2, parentData: data11, parentDataProperty: i2, rootData })) {
|
|
4913
|
+
let data37 = data.boxes;
|
|
4914
|
+
if (Array.isArray(data37)) {
|
|
4915
|
+
const len8 = data37.length;
|
|
4916
|
+
for (let i8 = 0; i8 < len8; i8++) {
|
|
4917
|
+
if (!validate13(data37[i8], { instancePath: instancePath + "/boxes/" + i8, parentData: data37, parentDataProperty: i8, rootData })) {
|
|
3438
4918
|
vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);
|
|
3439
4919
|
errors = vErrors.length;
|
|
3440
4920
|
}
|
|
3441
4921
|
}
|
|
3442
4922
|
} else {
|
|
3443
|
-
const
|
|
4923
|
+
const err43 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3444
4924
|
if (vErrors === null) {
|
|
3445
|
-
vErrors = [
|
|
4925
|
+
vErrors = [err43];
|
|
3446
4926
|
} else {
|
|
3447
|
-
vErrors.push(
|
|
4927
|
+
vErrors.push(err43);
|
|
3448
4928
|
}
|
|
3449
4929
|
errors++;
|
|
3450
4930
|
}
|
|
@@ -3456,30 +4936,30 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3456
4936
|
}
|
|
3457
4937
|
}
|
|
3458
4938
|
if (data.steps !== void 0) {
|
|
3459
|
-
let
|
|
3460
|
-
if (Array.isArray(
|
|
3461
|
-
if (
|
|
3462
|
-
const
|
|
4939
|
+
let data40 = data.steps;
|
|
4940
|
+
if (Array.isArray(data40)) {
|
|
4941
|
+
if (data40.length < 1) {
|
|
4942
|
+
const err44 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
3463
4943
|
if (vErrors === null) {
|
|
3464
|
-
vErrors = [
|
|
4944
|
+
vErrors = [err44];
|
|
3465
4945
|
} else {
|
|
3466
|
-
vErrors.push(
|
|
4946
|
+
vErrors.push(err44);
|
|
3467
4947
|
}
|
|
3468
4948
|
errors++;
|
|
3469
4949
|
}
|
|
3470
|
-
const
|
|
3471
|
-
for (let
|
|
3472
|
-
if (!validate17(
|
|
4950
|
+
const len9 = data40.length;
|
|
4951
|
+
for (let i9 = 0; i9 < len9; i9++) {
|
|
4952
|
+
if (!validate17(data40[i9], { instancePath: instancePath + "/steps/" + i9, parentData: data40, parentDataProperty: i9, rootData })) {
|
|
3473
4953
|
vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);
|
|
3474
4954
|
errors = vErrors.length;
|
|
3475
4955
|
}
|
|
3476
4956
|
}
|
|
3477
4957
|
} else {
|
|
3478
|
-
const
|
|
4958
|
+
const err45 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3479
4959
|
if (vErrors === null) {
|
|
3480
|
-
vErrors = [
|
|
4960
|
+
vErrors = [err45];
|
|
3481
4961
|
} else {
|
|
3482
|
-
vErrors.push(
|
|
4962
|
+
vErrors.push(err45);
|
|
3483
4963
|
}
|
|
3484
4964
|
errors++;
|
|
3485
4965
|
}
|
|
@@ -3496,12 +4976,18 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3496
4976
|
errors = vErrors.length;
|
|
3497
4977
|
}
|
|
3498
4978
|
}
|
|
4979
|
+
if (data.git !== void 0) {
|
|
4980
|
+
if (!validate29(data.git, { instancePath: instancePath + "/git", parentData: data, parentDataProperty: "git", rootData })) {
|
|
4981
|
+
vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors);
|
|
4982
|
+
errors = vErrors.length;
|
|
4983
|
+
}
|
|
4984
|
+
}
|
|
3499
4985
|
} else {
|
|
3500
|
-
const
|
|
4986
|
+
const err46 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3501
4987
|
if (vErrors === null) {
|
|
3502
|
-
vErrors = [
|
|
4988
|
+
vErrors = [err46];
|
|
3503
4989
|
} else {
|
|
3504
|
-
vErrors.push(
|
|
4990
|
+
vErrors.push(err46);
|
|
3505
4991
|
}
|
|
3506
4992
|
errors++;
|
|
3507
4993
|
}
|
|
@@ -3510,17 +4996,17 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3510
4996
|
}
|
|
3511
4997
|
|
|
3512
4998
|
// src/schema.ts
|
|
3513
|
-
var EVENT_TYPES = ["edge", "action", "swap", "strip"];
|
|
3514
|
-
var
|
|
3515
|
-
|
|
3516
|
-
"#/then/not": { field: "state", kind: "state" },
|
|
3517
|
-
"#/else/else/not": { field: "state", kind: "state" }
|
|
3518
|
-
};
|
|
4999
|
+
var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch"];
|
|
5000
|
+
var ABSENT = "#/definitions/absent/not";
|
|
5001
|
+
var ABSENT_KINDS = { regions: "sequence / architecture / state" };
|
|
3519
5002
|
var NOT_ALLOWED = {
|
|
3520
5003
|
carry: { field: "text", kind: "tag" }
|
|
3521
5004
|
};
|
|
3522
5005
|
var RESERVED_ID = /\/boxes\/items\/properties\/id\/not$/u;
|
|
5006
|
+
var GIT_EVENT = /\/events\/items\/properties\/type\/not$/u;
|
|
5007
|
+
var GIT_EVENTS = ["commit", "branch"];
|
|
3523
5008
|
var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
5009
|
+
var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
|
|
3524
5010
|
function forbiddenOf(pattern) {
|
|
3525
5011
|
const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
|
|
3526
5012
|
if (inside === void 0) return void 0;
|
|
@@ -3544,7 +5030,10 @@ function toFieldError(error, errors, m) {
|
|
|
3544
5030
|
}
|
|
3545
5031
|
case "not": {
|
|
3546
5032
|
if (RESERVED_ID.test(error.schemaPath)) return { pointer: at2, message: m.reserved(STATE_ENDS) };
|
|
3547
|
-
|
|
5033
|
+
if (GIT_EVENT.test(error.schemaPath)) return { pointer: at2, message: m.kindOnly(GIT_EVENTS, "git") };
|
|
5034
|
+
const last = at2.slice(at2.lastIndexOf("/") + 1);
|
|
5035
|
+
if (error.schemaPath === ABSENT) return { pointer: at2, message: m.not({ field: last, kind: ABSENT_KINDS[last] ?? last }) };
|
|
5036
|
+
const allowed = NOT_ALLOWED[last];
|
|
3548
5037
|
return { pointer: allowed ? `${at2}/${allowed.field}` : at2, message: m.not(allowed) };
|
|
3549
5038
|
}
|
|
3550
5039
|
case "anyOf": {
|
|
@@ -3562,8 +5051,10 @@ function toFieldError(error, errors, m) {
|
|
|
3562
5051
|
return { pointer: at2, message: m.type(String(params.type)) };
|
|
3563
5052
|
case "minLength":
|
|
3564
5053
|
return { pointer: at2, message: m.minLength(Number(params.limit)) };
|
|
3565
|
-
case "pattern":
|
|
3566
|
-
|
|
5054
|
+
case "pattern": {
|
|
5055
|
+
const hex2 = HEX.exec(String(params.pattern));
|
|
5056
|
+
return { pointer: at2, message: hex2 ? m.hex(Number(hex2[1]), Number(hex2[2])) : m.pattern(forbiddenOf(String(params.pattern))) };
|
|
5057
|
+
}
|
|
3567
5058
|
case "minItems":
|
|
3568
5059
|
return { pointer: at2, message: m.minItems(Number(params.limit)) };
|
|
3569
5060
|
case "minimum":
|
|
@@ -3611,7 +5102,15 @@ function plan(step) {
|
|
|
3611
5102
|
let arrived;
|
|
3612
5103
|
let changes = 0;
|
|
3613
5104
|
step.events.forEach((event, e) => {
|
|
3614
|
-
if (event.type === "
|
|
5105
|
+
if (event.type === "commit" || event.type === "branch") {
|
|
5106
|
+
const a = cursor;
|
|
5107
|
+
const b = a + MOTION.draw;
|
|
5108
|
+
out.edges.push({ event: e, a, b, carries: false, coin: false, named: false });
|
|
5109
|
+
cursor = a + MOTION.stagger;
|
|
5110
|
+
arrived = b;
|
|
5111
|
+
changes = 0;
|
|
5112
|
+
out.busy = Math.max(out.busy, b);
|
|
5113
|
+
} else if (event.type === "edge") {
|
|
3615
5114
|
const carries = event.carry.kind !== "none";
|
|
3616
5115
|
const a = cursor;
|
|
3617
5116
|
const b = a + (carries ? MOTION.drawCarry : MOTION.draw);
|
|
@@ -3656,7 +5155,9 @@ function buildTimeline(diagram) {
|
|
|
3656
5155
|
for (const edge2 of p.edges) {
|
|
3657
5156
|
const a = span.start + edge2.a;
|
|
3658
5157
|
edges.push({ step: s, event: edge2.event, start: a, drawn: span.start + edge2.b, end: span.end });
|
|
3659
|
-
|
|
5158
|
+
const event = diagram.steps[s]?.events[edge2.event];
|
|
5159
|
+
const own = diagram.kind === "git" && event?.type === "edge" && event.carry.kind === "tag" && event.carry.text === event.from;
|
|
5160
|
+
if (edge2.carries && !own) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
|
|
3660
5161
|
if (edge2.named) named.push({ step: s, event: edge2.event, start: a + MOTION.labelDelay, end: span.end });
|
|
3661
5162
|
}
|
|
3662
5163
|
named.forEach((label2, k) => {
|
|
@@ -3765,6 +5266,31 @@ var ICONS = {
|
|
|
3765
5266
|
block: "M -9 -7 h18 a2 2 0 0 1 2 2 v10 a2 2 0 0 1 -2 2 h-18 a2 2 0 0 1 -2 -2 v-10 a2 2 0 0 1 2 -2 z M -11 -2.5 h22 M -6 2.5 h8"
|
|
3766
5267
|
};
|
|
3767
5268
|
|
|
5269
|
+
// src/render/ink.ts
|
|
5270
|
+
var ALWAYS = [[0, Number.POSITIVE_INFINITY]];
|
|
5271
|
+
var BITE = 0.5;
|
|
5272
|
+
var visible = (item, t) => item.shown.some(([a, b]) => a <= t && t < b);
|
|
5273
|
+
var spotOf = (ink) => ({ text: ink.text, rect: { x: ink.rect.x, y: ink.rect.y, w: ink.rect.w, h: ink.rect.h }, badge: ink.badge === true, ...ink.part ? { part: ink.part } : {} });
|
|
5274
|
+
function findOverlaps(inks, stills, traces = []) {
|
|
5275
|
+
const out = [];
|
|
5276
|
+
stills.forEach((t, step) => {
|
|
5277
|
+
const seen = inks.filter((ink) => visible(ink, t));
|
|
5278
|
+
seen.forEach((a, i) => {
|
|
5279
|
+
for (const b of seen.slice(i + 1)) {
|
|
5280
|
+
const w = Math.min(a.rect.x + a.rect.w, b.rect.x + b.rect.w) - Math.max(a.rect.x, b.rect.x);
|
|
5281
|
+
const h = Math.min(a.rect.y + a.rect.h, b.rect.y + b.rect.h) - Math.max(a.rect.y, b.rect.y);
|
|
5282
|
+
if (w > BITE && h > BITE) out.push({ kind: "texts", step, texts: [a.text, b.text], spots: [spotOf(a), spotOf(b)] });
|
|
5283
|
+
}
|
|
5284
|
+
});
|
|
5285
|
+
const lines = traces.filter((trace) => visible(trace, t));
|
|
5286
|
+
for (const ink of seen) {
|
|
5287
|
+
if (ink.boxed) continue;
|
|
5288
|
+
for (const line of lines) if (crossesRect(line.points, ink.rect, BITE)) out.push({ kind: "line", step, text: ink.text, line: { from: line.from, to: line.to }, spots: [spotOf(ink)] });
|
|
5289
|
+
}
|
|
5290
|
+
});
|
|
5291
|
+
return out;
|
|
5292
|
+
}
|
|
5293
|
+
|
|
3768
5294
|
// src/render/parts.ts
|
|
3769
5295
|
var esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3770
5296
|
var r1 = (v) => Math.round(v * 100) / 100;
|
|
@@ -3801,6 +5327,10 @@ function arrowHead(points) {
|
|
|
3801
5327
|
const { arrow: a, arrowHalf: h } = LOOK.edge;
|
|
3802
5328
|
return `M ${r1(ex - dx * a - dy * h)} ${r1(ey - dy * a + dx * h)} L ${r1(ex)} ${r1(ey)} L ${r1(ex - dx * a + dy * h)} ${r1(ey - dy * a - dx * h)}`;
|
|
3803
5329
|
}
|
|
5330
|
+
function write(ink, cls, x, y, text2, style, shown = ALWAYS, anchor) {
|
|
5331
|
+
ink?.push({ text: text2, rect: textBox(text2, x, y, style, anchor), shown });
|
|
5332
|
+
return `<text class="${cls}" x="${r1(x)}" y="${r1(y)}"${anchor ? ` text-anchor="${anchor}"` : ""}>${esc(text2)}</text>`;
|
|
5333
|
+
}
|
|
3804
5334
|
function rangeKf(m, ranges2) {
|
|
3805
5335
|
const pts = [[0, { opacity: 0 }]];
|
|
3806
5336
|
for (const [a, b] of ranges2) pts.push([a, { opacity: 0 }, EASE.out], [a + MOTION.fade, { opacity: 1 }], [b - 0.1, { opacity: 1 }, EASE.inOut], [b + 0.25, { opacity: 0 }]);
|
|
@@ -3817,21 +5347,22 @@ function activeKf(ctx, on) {
|
|
|
3817
5347
|
}
|
|
3818
5348
|
return rangeKf(ctx.m, ranges2);
|
|
3819
5349
|
}
|
|
3820
|
-
function band(region) {
|
|
5350
|
+
function band(region, ink) {
|
|
3821
5351
|
const { radius, icon, iconRadius, iconScale, nameY, line } = LOOK.region;
|
|
3822
5352
|
const { x, y } = region.header;
|
|
3823
|
-
const lines = region.lines.map((t, k) =>
|
|
3824
|
-
const note = region.note ?
|
|
5353
|
+
const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
|
|
5354
|
+
const note = region.note ? write(ink, "dg-bx", x, region.y + nameY + region.lines.length * line + 1, region.note, TYPE.regionNote) : "";
|
|
3825
5355
|
const mark = region.icon && ICONS[region.icon] ? `<rect class="dg-bi" x="${r1(x)}" y="${r1(y)}" width="${icon}" height="${icon}" rx="${iconRadius}"/>${glyph(region.icon, x + icon / 2, y + icon / 2, iconScale)}` : "";
|
|
3826
5356
|
return `<g style="${cs(region.color)}"><rect class="dg-band" x="${r1(region.x + 0.5)}" y="${r1(region.y + 0.5)}" width="${r1(region.w - 1)}" height="${r1(region.h - 1)}" rx="${radius}"/>${mark}${lines}${note}</g>`;
|
|
3827
5357
|
}
|
|
3828
|
-
function subLines(box, m, changes, y) {
|
|
5358
|
+
function subLines(box, m, changes, y, ink) {
|
|
3829
5359
|
const seq = [[0, box.sub ?? "", "dg-ss"], ...changes];
|
|
3830
5360
|
return seq.map(([t, text2, cls], k) => {
|
|
3831
5361
|
const next = seq[k + 1]?.[0];
|
|
3832
5362
|
const anim = k === 0 ? next === void 0 ? "" : m.until(next - MOTION.untilFade) : next === void 0 ? m.rise(t) : m.rise(t, next - MOTION.untilFade);
|
|
3833
5363
|
if (text2 === "") return "";
|
|
3834
|
-
|
|
5364
|
+
const shown = [[k === 0 ? 0 : t, next === void 0 ? Number.POSITIVE_INFINITY : next - MOTION.untilFade]];
|
|
5365
|
+
return `<g${anim ? ` class="dg-a" style="${anim}"` : ""}>${write(ink, cls, box.cx, y, text2, cls === "dg-ss" ? TYPE.boxSub : TYPE.boxSubStrong, shown, "middle")}</g>`;
|
|
3835
5366
|
}).join("");
|
|
3836
5367
|
}
|
|
3837
5368
|
function cardFrame(box, ctx, act, y, h) {
|
|
@@ -3840,10 +5371,17 @@ function cardFrame(box, ctx, act, y, h) {
|
|
|
3840
5371
|
}
|
|
3841
5372
|
function card(box, ctx, on, changes, lit) {
|
|
3842
5373
|
const { icon, iconRadius, iconScale, iconY, nameY, subY } = LOOK.box;
|
|
3843
|
-
const subs = subLines(box, ctx.m, changes, box.cy + subY);
|
|
5374
|
+
const subs = subLines(box, ctx.m, changes, box.cy + subY, ctx.ink);
|
|
3844
5375
|
const act = lit ? lit.length > 0 ? rangeKf(ctx.m, lit.map((s) => [s.start, s.end])) : void 0 : on.length > 0 ? activeKf(ctx, on) : void 0;
|
|
3845
|
-
const
|
|
3846
|
-
|
|
5376
|
+
const ix = box.iconX ?? box.cx;
|
|
5377
|
+
const slot = box.slot ? `<rect class="dg-slot" x="${r1(box.slot.x)}" y="${r1(box.slot.y)}" width="${r1(box.slot.w)}" height="${r1(box.slot.h)}" rx="${LOOK.slot.radius}"/>` : "";
|
|
5378
|
+
let mark = "";
|
|
5379
|
+
if (box.icon && ICONS[box.icon]) {
|
|
5380
|
+
const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
|
|
5381
|
+
ctx.ink.push({ text: `${box.name} \u306E\u7D75\u67C4`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
|
|
5382
|
+
mark = `<rect class="dg-ic" x="${r1(rect.x)}" y="${r1(rect.y)}" width="${icon}" height="${icon}" rx="${iconRadius}"/>${glyph(box.icon, ix, box.cy + iconY, iconScale)}`;
|
|
5383
|
+
}
|
|
5384
|
+
return `<g style="${cs(box.color)}">${cardFrame(box, ctx, act, box.y, box.h)}${slot}${mark}${write(ctx.ink, "dg-sn", box.cx, box.cy + nameY, box.name, TYPE.boxName, ALWAYS, "middle")}${subs}</g>`;
|
|
3847
5385
|
}
|
|
3848
5386
|
function headCard(box, ctx, on, changes) {
|
|
3849
5387
|
const { pad: pad2, h, nameY, subY } = LOOK.follow.head;
|
|
@@ -3851,15 +5389,15 @@ function headCard(box, ctx, on, changes) {
|
|
|
3851
5389
|
const act = on.length > 0 ? activeKf(ctx, on) : void 0;
|
|
3852
5390
|
return `<g style="${cs(box.color)}">${cardFrame(box, ctx, act, pad2, h)}<text class="dg-sn" x="${r1(box.cx)}" y="${r1(pad2 + nameY)}" text-anchor="middle">${esc(box.name)}</text>${subs}</g>`;
|
|
3853
5391
|
}
|
|
3854
|
-
function ghostCard(box) {
|
|
5392
|
+
function ghostCard(box, ink) {
|
|
3855
5393
|
const { icon, iconRadius, iconScale, radius } = LOOK.box;
|
|
3856
5394
|
const G = LOOK.state.ghost;
|
|
3857
5395
|
const ix = box.x + G.pad + icon / 2;
|
|
3858
5396
|
const tx = box.x + G.pad + icon + G.gap;
|
|
3859
5397
|
const mark = box.icon && ICONS[box.icon] ? `<rect class="dg-ic" x="${r1(ix - icon / 2)}" y="${r1(box.cy - icon / 2)}" width="${icon}" height="${icon}" rx="${iconRadius}"/>${glyph(box.icon, ix, box.cy, iconScale)}` : "";
|
|
3860
5398
|
const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
|
|
3861
|
-
const sub = box.sub ?
|
|
3862
|
-
return `<g data-ghost="${esc(box.id)}" style="${cs(box.color)}"><rect class="dg-ghost" x="${r1(box.x)}" y="${r1(box.y)}" width="${r1(box.w)}" height="${box.h}" rx="${radius}"/>${mark}
|
|
5399
|
+
const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
|
|
5400
|
+
return `<g data-ghost="${esc(box.id)}" style="${cs(box.color)}"><rect class="dg-ghost" x="${r1(box.x)}" y="${r1(box.y)}" width="${r1(box.w)}" height="${box.h}" rx="${radius}"/>${mark}${write(ink, "dg-sn", tx, box.cy + nameY, box.name, TYPE.boxName, ALWAYS, "start")}${sub}</g>`;
|
|
3863
5401
|
}
|
|
3864
5402
|
function doneMark(box, at2, ctx) {
|
|
3865
5403
|
const { r, inset } = LOOK.state.done;
|
|
@@ -3867,19 +5405,22 @@ function doneMark(box, at2, ctx) {
|
|
|
3867
5405
|
const y = box.y + inset;
|
|
3868
5406
|
return `<g class="dg-popc dg-a" data-done="${esc(box.id)}" style="${cs(box.color)};${ctx.m.pop(at2)}"><circle class="dg-done" cx="${r1(x)}" cy="${r1(y)}" r="${r}"/>${glyph("check", x, y, 0.5, "dg-done-ck")}</g>`;
|
|
3869
5407
|
}
|
|
3870
|
-
function path(p, color) {
|
|
3871
|
-
|
|
5408
|
+
function path(p, color, ink, traces) {
|
|
5409
|
+
traces.push({ from: p.from, to: p.to, points: p.points, shown: ALWAYS });
|
|
5410
|
+
const sans = p.label?.family === "sans";
|
|
5411
|
+
const label2 = p.label ? write(ink, `dg-path-t${sans ? " dg-path-tj" : ""}`, p.label.x + LOOK.label.padX, p.label.y + p.label.h / 2 + LOOK.baseline.label, p.label.text, sans ? TYPE.labelJa : TYPE.label) : "";
|
|
3872
5412
|
return `<g data-path="${esc(`${p.from}->${p.to}`)}" style="${cs(color)}"><path class="dg-path" d="${pathOf(p.points)}"/><path class="dg-path-h" d="${arrowHead(p.points)}"/>${label2}</g>`;
|
|
3873
5413
|
}
|
|
3874
|
-
function side(s, color) {
|
|
5414
|
+
function side(s, color, ink) {
|
|
3875
5415
|
const { pad: pad2 } = LOOK.state.side;
|
|
3876
5416
|
const title = s.y + pad2 + TYPE.regionName.size;
|
|
3877
|
-
const notes = s.notes.map((note, k) =>
|
|
3878
|
-
return `<g style="${cs(color)}"><rect class="dg-side" x="${r1(s.x + 0.5)}" y="${r1(s.y + 0.5)}" width="${r1(s.w - 1)}" height="${r1(s.h - 1)}" rx="${LOOK.region.radius}"
|
|
5417
|
+
const notes = s.notes.map((note, k) => write(ink, "dg-side-n", s.x + pad2, title + LOOK.region.line * (k + 1), note, TYPE.regionNote)).join("");
|
|
5418
|
+
return `<g style="${cs(color)}"><rect class="dg-side" x="${r1(s.x + 0.5)}" y="${r1(s.y + 0.5)}" width="${r1(s.w - 1)}" height="${r1(s.h - 1)}" rx="${LOOK.region.radius}"/>${write(ink, "dg-side-t", s.x + pad2, title, s.title, TYPE.regionName)}${notes}</g>`;
|
|
3879
5419
|
}
|
|
3880
|
-
function endMark(e, color) {
|
|
5420
|
+
function endMark(e, color, ink) {
|
|
3881
5421
|
const { end } = LOOK.state;
|
|
3882
|
-
const
|
|
5422
|
+
const at2 = markText(e);
|
|
5423
|
+
const text2 = e.text === "" ? "" : write(ink, "dg-mark", at2[0], at2[1], e.text, TYPE.regionNote);
|
|
3883
5424
|
const x = r1(e.x);
|
|
3884
5425
|
const y = r1(e.y);
|
|
3885
5426
|
if (e.kind === "start") return `<g data-end="start"><circle class="dg-start" cx="${x}" cy="${y}" r="${e.r}"/>${text2}</g>`;
|
|
@@ -3891,6 +5432,7 @@ function lifeline(x, y1, y2) {
|
|
|
3891
5432
|
}
|
|
3892
5433
|
function edge(e, time, ctx, past = false) {
|
|
3893
5434
|
const { m } = ctx;
|
|
5435
|
+
ctx.traces.push({ from: e.from, to: e.to, points: e.points, shown: ALWAYS });
|
|
3894
5436
|
const d = pathOf(e.points);
|
|
3895
5437
|
const head = arrowHead(e.points);
|
|
3896
5438
|
const { start: a, drawn: b, end } = time;
|
|
@@ -3934,12 +5476,15 @@ function edge(e, time, ctx, past = false) {
|
|
|
3934
5476
|
function label(l, time, ctx) {
|
|
3935
5477
|
const ja2 = l.family === "sans" ? " dg-capj" : "";
|
|
3936
5478
|
const { radius } = LOOK.label;
|
|
5479
|
+
ctx.ink.push({ text: l.text, rect: l, shown: [[time.start, time.end]], boxed: true });
|
|
5480
|
+
if (time.after) ctx.ink.push({ text: l.text, rect: textBox(l.text, l.x + l.w / 2, l.y + l.h / 2 + LOOK.baseline.label, l.family === "sans" ? TYPE.labelJa : TYPE.label, "middle"), shown: [[time.after.start, time.after.end]] });
|
|
3937
5481
|
const x = r1(l.x + l.w / 2);
|
|
3938
5482
|
const y = r1(l.y + l.h / 2 + LOOK.baseline.label);
|
|
3939
5483
|
const past = time.after ? `<g class="dg-cap-past${l.family === "sans" ? " dg-cap-pastj" : ""} dg-a" style="${ctx.m.vis(time.after.start, time.after.end)}"><text x="${x}" y="${y}" text-anchor="middle">${esc(l.text)}</text></g>` : "";
|
|
3940
5484
|
return `${past}<g class="dg-cap${ja2} dg-a" style="${cs(l.color)};${ctx.m.rise(time.start, time.end, true)}"><rect x="${r1(l.x)}" y="${r1(l.y)}" width="${r1(l.w)}" height="${l.h}" rx="${radius}"/><text x="${x}" y="${y}" text-anchor="middle">${esc(l.text)}</text></g>`;
|
|
3941
5485
|
}
|
|
3942
5486
|
function action(a, at2, until, ctx) {
|
|
5487
|
+
ctx.ink.push({ text: a.text, rect: a, shown: [[at2, until]], boxed: true });
|
|
3943
5488
|
return `<g class="dg-act dg-a" style="${cs(a.color)};${ctx.m.rise(at2, until, true)}"><rect x="${r1(a.x)}" y="${r1(a.y)}" width="${r1(a.w)}" height="${a.h}" rx="${LOOK.action.radius}"/><text x="${r1(a.x + a.w / 2)}" y="${r1(a.y + a.h / 2 + LOOK.baseline.action)}" text-anchor="middle">${esc(a.text)}</text></g>`;
|
|
3944
5489
|
}
|
|
3945
5490
|
function carrierShape(e, sh) {
|
|
@@ -3957,11 +5502,12 @@ var easeInOut = (t) => t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;
|
|
|
3957
5502
|
function carrier(e, time, ctx) {
|
|
3958
5503
|
const { m } = ctx;
|
|
3959
5504
|
const n = LOOK.carrier.samples;
|
|
3960
|
-
const
|
|
5505
|
+
const route = e.wait ? [e.wait, ...e.points] : e.points;
|
|
5506
|
+
const length = pathLength(route);
|
|
3961
5507
|
const { depart: a, arrive: b, start: from, end: gone } = time;
|
|
3962
5508
|
const path2 = [];
|
|
3963
5509
|
for (let k = 0; k <= n; k++) {
|
|
3964
|
-
const [x, y] = along(
|
|
5510
|
+
const [x, y] = along(route, easeInOut(k / n) * length);
|
|
3965
5511
|
path2.push([a + (b - a) * k / n, x, y]);
|
|
3966
5512
|
}
|
|
3967
5513
|
const first = path2[0];
|
|
@@ -3970,6 +5516,12 @@ function carrier(e, time, ctx) {
|
|
|
3970
5516
|
const pts = [[0, first[1], first[2]], ...path2];
|
|
3971
5517
|
if (e.settle) pts.push([Math.min(b + 0.3, Math.max(gone, b + 0.01)), rest[0], rest[1]]);
|
|
3972
5518
|
pts.push([gone, rest[0], rest[1]], [m.total, rest[0], rest[1]]);
|
|
5519
|
+
const [hx, hy] = carrierHalf(e.carry);
|
|
5520
|
+
const name = e.carry.kind === "tag" ? e.carry.text : e.carry.kind === "coin" ? "\u786C\u8CA8" : "\u5C01\u7B52";
|
|
5521
|
+
const part = e.carry.kind === "tag" ? {} : { part: { kind: e.carry.kind === "coin" ? "coin" : "envelope" } };
|
|
5522
|
+
const box = (p) => ({ x: p[0] - hx, y: p[1] - hy, w: hx * 2, h: hy * 2 });
|
|
5523
|
+
if (a > from) ctx.ink.push({ text: name, rect: box([first[1], first[2]]), shown: [[from, a]], boxed: true, ...part });
|
|
5524
|
+
ctx.ink.push({ text: name, rect: box(rest), shown: [[b, gone]], boxed: true, ...part });
|
|
3973
5525
|
const fade = gone < m.last ? 0.05 : 0.18;
|
|
3974
5526
|
return `<g class="dg-a" style="${m.move(pts, m.blink(from + 0.02, gone, fade))}">${carrierShape(e, ctx.sh)}</g>`;
|
|
3975
5527
|
}
|
|
@@ -3979,15 +5531,30 @@ function badge(b, ctx, grey = false) {
|
|
|
3979
5531
|
const a = span.start;
|
|
3980
5532
|
const e = span.end;
|
|
3981
5533
|
const { r, ring: rr } = LOOK.badge;
|
|
5534
|
+
const shown = { visibility: "visible" };
|
|
5535
|
+
const hidden = { visibility: "hidden" };
|
|
5536
|
+
const swap = b.until === void 0 ? void 0 : ctx.t.steps[b.until].start;
|
|
5537
|
+
const next = swap !== void 0 && swap <= e + 1e-6;
|
|
3982
5538
|
const fill = m.kf([
|
|
3983
|
-
[0, { opacity: 0, transform: "scale(.5)" }],
|
|
3984
|
-
[a, { opacity: 0, transform: "scale(.5)" }, EASE.pop],
|
|
3985
|
-
[a + 0.35, { opacity: 1, transform: "scale(1)" }],
|
|
3986
|
-
[e, { opacity: 1, transform: "scale(1)" }, EASE.inOut],
|
|
3987
|
-
[e + 0.4, { opacity: 0, transform: "scale(1)" }],
|
|
3988
|
-
[m.total, { opacity: 0, transform: "scale(.5)" }]
|
|
5539
|
+
[0, { opacity: 0, transform: "scale(.5)", ...hidden }],
|
|
5540
|
+
[a, { opacity: 0, transform: "scale(.5)", ...hidden }, EASE.pop],
|
|
5541
|
+
[a + 0.35, { opacity: 1, transform: "scale(1)", ...shown }],
|
|
5542
|
+
[e, { opacity: 1, transform: "scale(1)", ...shown }, EASE.inOut],
|
|
5543
|
+
[e + (next ? MOTION.untilFade : 0.4), { opacity: 0, transform: "scale(1)", ...hidden }],
|
|
5544
|
+
[m.total, { opacity: 0, transform: "scale(.5)", ...hidden }]
|
|
5545
|
+
]);
|
|
5546
|
+
const pastEnd = swap ?? m.last;
|
|
5547
|
+
const past = next ? m.kf([
|
|
5548
|
+
[0, { opacity: 0, ...hidden }],
|
|
5549
|
+
[m.total, { opacity: 0, ...hidden }]
|
|
5550
|
+
]) : m.kf([
|
|
5551
|
+
[0, { opacity: 0, ...hidden }],
|
|
5552
|
+
[e, { opacity: 0, ...hidden }, EASE.inOut],
|
|
5553
|
+
[e + 0.4, { opacity: 1, ...shown }],
|
|
5554
|
+
[pastEnd, { opacity: 1, ...shown }, EASE.inOut],
|
|
5555
|
+
...swap === void 0 ? [] : [[swap + MOTION.untilFade, { opacity: 0, ...hidden }]],
|
|
5556
|
+
[m.total, { opacity: 0, ...hidden }]
|
|
3989
5557
|
]);
|
|
3990
|
-
const past = m.kf([[0, { opacity: 0 }], [e, { opacity: 0 }, EASE.inOut], [e + 0.4, { opacity: 1 }], [m.last, { opacity: 1 }, EASE.inOut], [m.total, { opacity: 0 }]]);
|
|
3991
5558
|
const ring = m.kf([
|
|
3992
5559
|
[0, { opacity: 0, transform: "scale(1)" }],
|
|
3993
5560
|
[a + 0.05, { opacity: 0, transform: "scale(1)" }],
|
|
@@ -3999,6 +5566,7 @@ function badge(b, ctx, grey = false) {
|
|
|
3999
5566
|
const y = r1(b.y);
|
|
4000
5567
|
const ty = r1(b.y + LOOK.baseline.badge);
|
|
4001
5568
|
const no = b.step + 1;
|
|
5569
|
+
ctx.ink.push({ text: String(no), rect: { x: b.x - r, y: b.y - r, w: r * 2, h: r * 2 }, shown: [[a, pastEnd]], boxed: true, badge: true });
|
|
4002
5570
|
return `<g class="dg-bd" data-step="${b.step}" style="${cs(b.color)}"><circle class="dg-bdr dg-popc dg-a" cx="${x}" cy="${y}" r="${rr}" style="${ring}"/><g class="dg-a" style="${past}"><circle class="${grey ? "dg-bdp-g" : "dg-bdp"}" cx="${x}" cy="${y}" r="${rr}"/><text class="${grey ? "dg-bdpt-g" : "dg-bdpt"}" x="${x}" y="${ty}" text-anchor="middle">${no}</text></g><g class="dg-popc dg-a" style="${fill}"><circle class="dg-bdf" cx="${x}" cy="${y}" r="${r}"/><text class="dg-bdft" x="${x}" y="${ty}" text-anchor="middle">${no}</text></g></g>`;
|
|
4003
5571
|
}
|
|
4004
5572
|
function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map()) {
|
|
@@ -4008,7 +5576,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4008
5576
|
const parts = [
|
|
4009
5577
|
`<rect class="dg-strip" x="${r1(s.x + 0.5)}" y="${r1(s.y + 0.5)}" width="${r1(s.w - 1)}" height="${r1(s.h - 1)}" rx="${LOOK.region.radius}" ${sh}/>`,
|
|
4010
5578
|
`<g style="${cs("slate")}"><rect class="dg-bi" x="${r1(s.x + S2.pad)}" y="${r1(my - S2.icon / 2)}" width="${S2.icon}" height="${S2.icon}" rx="${LOOK.box.iconRadius}"/>${glyph("env", s.x + S2.pad + S2.icon / 2, my, 0.78)}</g>`,
|
|
4011
|
-
|
|
5579
|
+
write(ctx.ink, "dg-sh", s.x + S2.titleX, my + LOOK.baseline.stripTitle, s.title, TYPE.stripTitle)
|
|
4012
5580
|
];
|
|
4013
5581
|
s.fields.forEach((field, i) => {
|
|
4014
5582
|
const prev = s.fields[i - 1];
|
|
@@ -4016,7 +5584,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4016
5584
|
const sx = field.x - S2.fieldGap / 2;
|
|
4017
5585
|
parts.push(`<line class="dg-sep" x1="${r1(sx)}" y1="${r1(field.y + S2.sepInset)}" x2="${r1(sx)}" y2="${r1(field.y + S2.h - S2.sepInset)}"/>`);
|
|
4018
5586
|
}
|
|
4019
|
-
parts.push(
|
|
5587
|
+
parts.push(write(ctx.ink, "dg-fl", field.x, field.y + S2.nameY, field.name, TYPE.fieldName));
|
|
4020
5588
|
const list = changes.get(field.name) ?? [];
|
|
4021
5589
|
const values = list.filter((c) => c.value !== void 0);
|
|
4022
5590
|
const tags = list.filter((c) => c.tag !== void 0);
|
|
@@ -4024,6 +5592,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4024
5592
|
const next = values[k + 1]?.at;
|
|
4025
5593
|
const value = c.value;
|
|
4026
5594
|
const cls = hasWide(value) ? "dg-fvj" : "dg-fv";
|
|
5595
|
+
ctx.ink.push({ text: value, rect: textBox(value, field.x, field.y + S2.valueY, hasWide(value) ? TYPE.fieldValueJa : TYPE.fieldValue), shown: [[c.at, next === void 0 ? Number.POSITIVE_INFINITY : next - MOTION.untilFade]] });
|
|
4027
5596
|
const textOf = (c2) => `<text class="${c2}" x="${r1(field.x)}" y="${r1(field.y + S2.valueY)}">${esc(value)}</text>`;
|
|
4028
5597
|
const text2 = textOf(cls);
|
|
4029
5598
|
if (!now) {
|
|
@@ -4043,6 +5612,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4043
5612
|
const x = field.x + (shown ? textWidth(shown, hasWide(shown) ? TYPE.fieldValueJa : TYPE.fieldValue) + S2.tagGap : 0);
|
|
4044
5613
|
const w = textWidth(tag, TYPE.tag) + S2.tagPadX * 2;
|
|
4045
5614
|
const y = field.y + S2.valueY - S2.tagH / 2 - LOOK.baseline.tag;
|
|
5615
|
+
ctx.ink.push({ text: tag, rect: { x, y, w, h: S2.tagH }, shown: [[c.at, next === void 0 ? Number.POSITIVE_INFINITY : next - MOTION.untilFade]], boxed: true });
|
|
4046
5616
|
parts.push(
|
|
4047
5617
|
`<g class="dg-tg dg-popc dg-a" style="${cs(c.color)};${next === void 0 ? m.pop(c.at) : m.pop(c.at, next - MOTION.untilFade)}"><rect x="${r1(x)}" y="${r1(y)}" width="${r1(w)}" height="${S2.tagH}" rx="${S2.tagH / 2}"/><text x="${r1(x + w / 2)}" y="${r1(y + S2.tagH / 2 + LOOK.baseline.tag)}" text-anchor="middle">${esc(tag)}</text></g>`
|
|
4048
5618
|
);
|
|
@@ -4055,7 +5625,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4055
5625
|
const sx = t.x - S2.fieldGap / 2;
|
|
4056
5626
|
parts.push(`<line class="dg-sep" x1="${r1(sx)}" y1="${r1(t.y + S2.sepInset)}" x2="${r1(sx)}" y2="${r1(t.y + S2.h - S2.sepInset)}"/>`);
|
|
4057
5627
|
}
|
|
4058
|
-
parts.push(
|
|
5628
|
+
parts.push(write(ctx.ink, "dg-fl", t.x, t.y + S2.nameY, t.title, TYPE.fieldName));
|
|
4059
5629
|
const dy = t.y + S2.valueY - TYPE.fieldValue.size / 3;
|
|
4060
5630
|
t.states.forEach((state, k) => {
|
|
4061
5631
|
const cx = r1(t.x + S2.trail.r + k * S2.trail.step);
|
|
@@ -4067,6 +5637,123 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4067
5637
|
return parts.join("");
|
|
4068
5638
|
}
|
|
4069
5639
|
|
|
5640
|
+
// src/render/git.ts
|
|
5641
|
+
var r12 = (v) => Math.round(v * 100) / 100;
|
|
5642
|
+
var center = (r) => [r.x + r.w / 2, r.y + r.h / 2];
|
|
5643
|
+
function tagShape(text2, sh) {
|
|
5644
|
+
const C = LOOK.carrier;
|
|
5645
|
+
const ja2 = hasWide(text2);
|
|
5646
|
+
const w = textWidth(text2, ja2 ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
|
|
5647
|
+
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${ja2 ? " dg-car-tj" : ""}" y="${LOOK.baseline.carrier}" text-anchor="middle">${esc(text2)}</text>`;
|
|
5648
|
+
}
|
|
5649
|
+
function drawGit(layout, diagram, timeline, ctx) {
|
|
5650
|
+
const { m } = ctx;
|
|
5651
|
+
const G = LOOK.git;
|
|
5652
|
+
const timeOf = (step, event) => timeline.edges.find((t) => t.step === step && t.event === event);
|
|
5653
|
+
const links = layout.links.map((l) => {
|
|
5654
|
+
const time = timeOf(l.step, l.event);
|
|
5655
|
+
if (!time) return "";
|
|
5656
|
+
ctx.traces.push({ from: l.from, to: l.to, points: l.points, shown: [[time.start, Number.POSITIVE_INFINITY]] });
|
|
5657
|
+
const d = pathOf(l.points);
|
|
5658
|
+
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>`;
|
|
5659
|
+
const kf = m.kf([
|
|
5660
|
+
[0, { opacity: 0, "stroke-dashoffset": 1 }],
|
|
5661
|
+
[time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
|
|
5662
|
+
[time.start + 0.05, { opacity: 1 }],
|
|
5663
|
+
[time.drawn, { "stroke-dashoffset": 0 }],
|
|
5664
|
+
[m.last, { opacity: 1, "stroke-dashoffset": 0 }, EASE.inOut],
|
|
5665
|
+
[m.total, { opacity: 0, "stroke-dashoffset": 0 }]
|
|
5666
|
+
]);
|
|
5667
|
+
return `<g style="${cs(l.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${d}" style="${kf}"/></g>`;
|
|
5668
|
+
}).join("");
|
|
5669
|
+
const commits = layout.commits.map((c) => {
|
|
5670
|
+
const at2 = timeOf(c.step, c.event)?.drawn ?? 0;
|
|
5671
|
+
const ring = { x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 };
|
|
5672
|
+
ctx.ink.push({ text: c.id, rect: ring, shown: [[at2, Number.POSITIVE_INFINITY]], boxed: true });
|
|
5673
|
+
const lines2 = (c.text?.lines ?? []).map((line, k) => {
|
|
5674
|
+
const hash = k === 0 && c.hash !== void 0;
|
|
5675
|
+
const baseline = c.text?.baselines[k] ?? c.cy;
|
|
5676
|
+
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");
|
|
5677
|
+
}).join("");
|
|
5678
|
+
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>`;
|
|
5679
|
+
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>`;
|
|
5680
|
+
const text2 = lines2 === "" ? "" : `<g class="dg-a" style="${m.vis(at2)}">${lines2}</g>`;
|
|
5681
|
+
const orphanAt = c.orphan === void 0 ? void 0 : timeOf(c.orphan, c.orphanEvent ?? 0)?.drawn;
|
|
5682
|
+
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>`;
|
|
5683
|
+
return `<g data-commit="${esc(c.id)}" style="${cs(c.color)}">${node}${text2}${orphan}</g>`;
|
|
5684
|
+
}).join("");
|
|
5685
|
+
const lines = layout.moves.flatMap((mv) => {
|
|
5686
|
+
const time = timeOf(mv.step, mv.event);
|
|
5687
|
+
if (!mv.line || !time) return [];
|
|
5688
|
+
const end = timeline.steps[mv.step].end;
|
|
5689
|
+
ctx.traces.push({ from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, shown: [[time.start, end + 0.4]] });
|
|
5690
|
+
const kf = m.kf([
|
|
5691
|
+
[0, { opacity: 0, "stroke-dashoffset": 1 }],
|
|
5692
|
+
[time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
|
|
5693
|
+
[time.start + 0.05, { opacity: 1 }],
|
|
5694
|
+
[time.drawn, { "stroke-dashoffset": 0 }],
|
|
5695
|
+
[end, { opacity: 1 }, EASE.inOut],
|
|
5696
|
+
[end + 0.4, { opacity: 0 }],
|
|
5697
|
+
[m.total, { opacity: 0, "stroke-dashoffset": 0 }]
|
|
5698
|
+
]);
|
|
5699
|
+
return [`<g style="${cs(mv.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${pathOf(mv.line)}" style="${kf}"/></g>`];
|
|
5700
|
+
}).join("");
|
|
5701
|
+
const carried = timeline.carriers.flatMap((t) => {
|
|
5702
|
+
const mv = layout.moves.find((x) => x.step === t.step && x.event === t.event && x.line);
|
|
5703
|
+
const source = diagram.steps[t.step]?.events[t.event];
|
|
5704
|
+
if (!mv?.line || source?.type !== "edge") return [];
|
|
5705
|
+
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 };
|
|
5706
|
+
return [carrier(edge2, { ...t, start: t.depart, end: t.arrive + MOTION.fade }, ctx)];
|
|
5707
|
+
}).join("");
|
|
5708
|
+
const refs = [...new Set(layout.moves.map((mv) => mv.ref))];
|
|
5709
|
+
const tags = refs.map((ref) => tagMotion(ref, layout.moves.filter((mv) => mv.ref === ref), timeOf, ctx)).join("") + carried;
|
|
5710
|
+
return { links, lines, commits, tags };
|
|
5711
|
+
}
|
|
5712
|
+
function tagMotion(ref, list, timeOf, ctx) {
|
|
5713
|
+
const { m } = ctx;
|
|
5714
|
+
const points = [];
|
|
5715
|
+
const fades = [[0, { opacity: 0 }]];
|
|
5716
|
+
let on = false;
|
|
5717
|
+
let rest;
|
|
5718
|
+
const leave = (t) => {
|
|
5719
|
+
if (rest) ctx.ink.push({ text: ref, rect: rest.rect, shown: [[rest.since, t]], boxed: true });
|
|
5720
|
+
rest = void 0;
|
|
5721
|
+
};
|
|
5722
|
+
for (const mv of list) {
|
|
5723
|
+
const time = timeOf(mv.step, mv.event);
|
|
5724
|
+
if (!time) continue;
|
|
5725
|
+
const { start: a, drawn: b } = time;
|
|
5726
|
+
const from = mv.from ? center(mv.from) : void 0;
|
|
5727
|
+
const to = mv.to ? center(mv.to) : void 0;
|
|
5728
|
+
leave(a);
|
|
5729
|
+
if (mv.carried && from && to && on) {
|
|
5730
|
+
points.push([a + MOTION.fade, from[0], from[1]], [b - MOTION.fade, to[0], to[1]]);
|
|
5731
|
+
fades.push([a, { opacity: 1 }, EASE.inOut], [a + MOTION.fade, { opacity: 0 }], [b - MOTION.fade, { opacity: 0 }, EASE.out], [b, { opacity: 1 }]);
|
|
5732
|
+
rest = { rect: mv.to, since: b };
|
|
5733
|
+
continue;
|
|
5734
|
+
}
|
|
5735
|
+
if (from) points.push([a, from[0], from[1]]);
|
|
5736
|
+
if (to) points.push([b, to[0], to[1]]);
|
|
5737
|
+
if (to && !on) {
|
|
5738
|
+
const show = from ? a : b - MOTION.fade;
|
|
5739
|
+
fades.push([show, { opacity: 0 }, EASE.out], [show + MOTION.fade, { opacity: 1 }]);
|
|
5740
|
+
on = true;
|
|
5741
|
+
} else if (!to && on) {
|
|
5742
|
+
fades.push([b, { opacity: 1 }, EASE.inOut], [b + MOTION.untilFade, { opacity: 0 }]);
|
|
5743
|
+
on = false;
|
|
5744
|
+
}
|
|
5745
|
+
if (mv.to) rest = { rect: mv.to, since: b };
|
|
5746
|
+
}
|
|
5747
|
+
leave(Number.POSITIVE_INFINITY);
|
|
5748
|
+
if (points.length === 0) return "";
|
|
5749
|
+
const first = points[0];
|
|
5750
|
+
const last = points[points.length - 1];
|
|
5751
|
+
if (on) fades.push([m.last, { opacity: 1 }, EASE.inOut], [m.total, { opacity: 0 }]);
|
|
5752
|
+
else fades.push([m.total, { opacity: 0 }]);
|
|
5753
|
+
const style = m.move([[0, first[1], first[2]], ...points, [m.total, last[1], last[2]]], fades);
|
|
5754
|
+
return `<g class="dg-a" data-ref="${esc(ref)}" style="${style}">${tagShape(ref, ctx.sh)}</g>`;
|
|
5755
|
+
}
|
|
5756
|
+
|
|
4070
5757
|
// src/render/motion.ts
|
|
4071
5758
|
var r2 = (v) => Math.round(v * 100) / 100;
|
|
4072
5759
|
var Motion = class {
|
|
@@ -4174,6 +5861,7 @@ var PART_CSS = [
|
|
|
4174
5861
|
`.dg-halo{fill:none;stroke:var(--c);stroke-width:${S.halo};stroke-opacity:.16}`,
|
|
4175
5862
|
`.dg-on{fill:none;stroke:var(--c);stroke-width:${S.on}}`,
|
|
4176
5863
|
`.dg-ic{fill:${mix(X.icon)}}`,
|
|
5864
|
+
`.dg-slot{fill:none;stroke:${mix(X.slot, "transparent")};stroke-width:${S.slot};stroke-dasharray:3 3}`,
|
|
4177
5865
|
`.dg-gl{fill:none;stroke:var(--c);stroke-width:${S.glyph};stroke-linecap:round;stroke-linejoin:round}`,
|
|
4178
5866
|
`.dg-sn{${font(TYPE.boxName)};fill:var(--ink)}`,
|
|
4179
5867
|
`.dg-ss{${font(TYPE.boxSub)};fill:var(--mute)}`,
|
|
@@ -4190,7 +5878,7 @@ var PART_CSS = [
|
|
|
4190
5878
|
".dg-bd{cursor:pointer}",
|
|
4191
5879
|
".dg-bdf{fill:var(--c)}",
|
|
4192
5880
|
`.dg-bdft{${font(TYPE.badge)};fill:var(--on-c)}`,
|
|
4193
|
-
`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${S.badgeRing}}`,
|
|
5881
|
+
`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${S.badgeRing};pointer-events:none}`,
|
|
4194
5882
|
`.dg-bdp{fill:${mix(X.badgePast)};stroke:${mix(X.badgePastEdge, "transparent")};stroke-width:${S.hair}}`,
|
|
4195
5883
|
`.dg-bdpt{${font(TYPE.badge)};fill:var(--ct)}`,
|
|
4196
5884
|
`.dg-bdp-g{fill:var(--surf);stroke:${PAST};stroke-width:${S.hair}}`,
|
|
@@ -4236,6 +5924,14 @@ var PART_CSS = [
|
|
|
4236
5924
|
`.dg-mark{${font(TYPE.regionNote)};fill:var(--mute)}`,
|
|
4237
5925
|
`.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${S.done}}`,
|
|
4238
5926
|
`.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${S.glyph};stroke-linecap:round;stroke-linejoin:round}`,
|
|
5927
|
+
`.dg-git-l{fill:none;stroke:var(--c);stroke-width:${S.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,
|
|
5928
|
+
`.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${S.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,
|
|
5929
|
+
`.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${S.git}}`,
|
|
5930
|
+
`.dg-git-id{${font(TYPE.gitId)};fill:var(--ct)}`,
|
|
5931
|
+
`.dg-git-h{${font(TYPE.gitHash)};fill:var(--mute)}`,
|
|
5932
|
+
`.dg-git-n{${font(TYPE.gitNote)};fill:var(--ink2)}`,
|
|
5933
|
+
`.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${S.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,
|
|
5934
|
+
`.dg-git-oldl{${font(TYPE.gitId)};fill:var(--ct);opacity:.55}`,
|
|
4239
5935
|
".dg-vp-bg{fill:var(--bg)}",
|
|
4240
5936
|
".dg-vp-frame{fill:none;stroke:var(--hair)}",
|
|
4241
5937
|
".dg-hd-bg{fill:var(--bg)}",
|
|
@@ -4319,23 +6015,36 @@ function fieldChanges(diagram, timeline, layout) {
|
|
|
4319
6015
|
}
|
|
4320
6016
|
return out;
|
|
4321
6017
|
}
|
|
4322
|
-
function
|
|
6018
|
+
function fadeBefore(l, time, steps) {
|
|
6019
|
+
if (l.until === void 0 || !time.after) return time;
|
|
6020
|
+
const cut = steps[l.until].start;
|
|
6021
|
+
const { after, ...rest } = time;
|
|
6022
|
+
return cut > after.start ? { ...rest, after: { start: after.start, end: Math.min(after.end, cut) } } : rest;
|
|
6023
|
+
}
|
|
6024
|
+
function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], traces = []) {
|
|
4323
6025
|
const id = nameOf(`${JSON.stringify(diagram)}|${palette.id}|${theme}|${follow ? `${follow.width}|${follow.lang}` : ""}`);
|
|
4324
6026
|
const m = new Motion(`dg${id}`, timeline.total, timeline.last);
|
|
4325
|
-
const ctx = { m, t: timeline, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end };
|
|
6027
|
+
const ctx = { m, t: timeline, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end, ink, traces };
|
|
4326
6028
|
const on = involved(diagram);
|
|
4327
6029
|
const subs = subChanges(diagram, timeline, layout.kind !== "sequence");
|
|
4328
6030
|
const L = { band: [], base: [], lit: [], node: [], badge: [], top: [] };
|
|
4329
|
-
for (const region of layout.regions) L.band.push(band(region));
|
|
6031
|
+
for (const region of layout.regions) L.band.push(band(region, ink));
|
|
4330
6032
|
const ghostColor = layout.boxes.find((b) => b.ghost)?.color ?? "slate";
|
|
4331
|
-
if (layout.side) L.band.push(side(layout.side, ghostColor));
|
|
6033
|
+
if (layout.side) L.band.push(side(layout.side, ghostColor, ink));
|
|
4332
6034
|
const boxColor = (id2, ghost) => layout.boxes.find((b) => b.id === id2 && (ghost === void 0 || b.ghost === ghost))?.color;
|
|
4333
|
-
for (const p of layout.paths) L.base.push(path(p, boxColor(p.to, true) ?? boxColor(p.from) ?? ghostColor));
|
|
4334
|
-
for (const e of layout.ends) L.node.push(endMark(e, ghostColor));
|
|
6035
|
+
for (const p of layout.paths) L.base.push(path(p, boxColor(p.to, true) ?? boxColor(p.from) ?? ghostColor, ink, traces));
|
|
6036
|
+
for (const e of layout.ends) L.node.push(endMark(e, ghostColor, ink));
|
|
4335
6037
|
const isState = layout.kind === "state";
|
|
4336
6038
|
const arrivals = new Map((timeline.states ?? []).flatMap((s) => s.lit[0] ? [[s.box, s.lit[0].start]] : []));
|
|
4337
6039
|
if (layout.strip) L.band.push(strip(layout.strip, fieldChanges(diagram, timeline, layout), ctx, isState, arrivals));
|
|
4338
6040
|
for (const line of layout.lifelines) L.base.push(lifeline(line.x, line.y1, line.y2));
|
|
6041
|
+
if (isGitLayout(layout)) {
|
|
6042
|
+
const git = drawGit(layout, diagram, timeline, ctx);
|
|
6043
|
+
L.base.push(git.links);
|
|
6044
|
+
L.lit.push(git.lines);
|
|
6045
|
+
L.node.push(git.commits);
|
|
6046
|
+
L.top.push(git.tags);
|
|
6047
|
+
}
|
|
4339
6048
|
for (const e of layout.edges) {
|
|
4340
6049
|
const time = timeline.edges.find((t) => t.step === e.step && t.event === e.event);
|
|
4341
6050
|
if (!time) continue;
|
|
@@ -4346,7 +6055,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow) {
|
|
|
4346
6055
|
const states = new Map((timeline.states ?? []).map((s) => [s.box, s]));
|
|
4347
6056
|
for (const box of layout.boxes) {
|
|
4348
6057
|
if (box.ghost) {
|
|
4349
|
-
L.node.push(ghostCard(box));
|
|
6058
|
+
L.node.push(ghostCard(box, ink));
|
|
4350
6059
|
continue;
|
|
4351
6060
|
}
|
|
4352
6061
|
const state = states.get(box.id);
|
|
@@ -4356,7 +6065,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow) {
|
|
|
4356
6065
|
for (const b of layout.badges) L.badge.push(badge(b, ctx, isState));
|
|
4357
6066
|
for (const l of layout.labels) {
|
|
4358
6067
|
const time = timeline.labels.find((t) => t.step === l.step && t.event === l.event);
|
|
4359
|
-
if (time) L.top.push(label(l, time, ctx));
|
|
6068
|
+
if (time) L.top.push(label(l, fadeBefore(l, time, timeline.steps), ctx));
|
|
4360
6069
|
}
|
|
4361
6070
|
for (const a of layout.actions) {
|
|
4362
6071
|
const time = timeline.events.find((t) => t.step === a.step && t.event === a.event);
|
|
@@ -4374,14 +6083,14 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow) {
|
|
|
4374
6083
|
const css = `.dg-${id}{${FONT_VARS};--T:${timeline.total}s;${paletteVars(palette, theme)}}${PART_CSS}${m.frames.join("")}`;
|
|
4375
6084
|
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>`;
|
|
4376
6085
|
}
|
|
4377
|
-
function
|
|
6086
|
+
function union2(rects) {
|
|
4378
6087
|
const x = Math.min(...rects.map((r) => r.x));
|
|
4379
6088
|
const y = Math.min(...rects.map((r) => r.y));
|
|
4380
6089
|
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 };
|
|
4381
6090
|
}
|
|
4382
6091
|
function focusOf(layout, diagram, step) {
|
|
4383
6092
|
const rects = focusParts(layout, diagram, step);
|
|
4384
|
-
return rects.length === 0 ? void 0 :
|
|
6093
|
+
return rects.length === 0 ? void 0 : union2(rects);
|
|
4385
6094
|
}
|
|
4386
6095
|
function badgeFocus(badge2, parts, vw, vh) {
|
|
4387
6096
|
const room = LOOK.badge.r + LOOK.follow.badgeRoom;
|
|
@@ -4389,7 +6098,7 @@ function badgeFocus(badge2, parts, vw, vh) {
|
|
|
4389
6098
|
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));
|
|
4390
6099
|
let held = { x: bx - room, y: by - room, w: room * 2, h: room * 2 };
|
|
4391
6100
|
for (const p of [...parts].sort((a, b) => away(a) - away(b))) {
|
|
4392
|
-
const next =
|
|
6101
|
+
const next = union2([held, p]);
|
|
4393
6102
|
if (next.w <= vw && next.h <= vh) held = next;
|
|
4394
6103
|
}
|
|
4395
6104
|
return held;
|
|
@@ -4487,19 +6196,25 @@ function renderDiagram(input, options = {}) {
|
|
|
4487
6196
|
const read = readDiagram(input, { lang });
|
|
4488
6197
|
if (!read.ok) throw new Error(FIGURE_TEXT[lang].cannotDraw(read.errors.map((e) => `${e.pointer} ${e.message}`).join(" / ")));
|
|
4489
6198
|
const diagram = read.diagram;
|
|
6199
|
+
const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : diagram.kind === "git" ? layoutGit(diagram) : layoutArchitecture(diagram);
|
|
6200
|
+
return renderLayout(diagram, layout, buildTimeline(diagram), options);
|
|
6201
|
+
}
|
|
6202
|
+
function renderLayout(diagram, layout, timeline, options = {}) {
|
|
4490
6203
|
const palette = resolvePalette(options.palette);
|
|
4491
6204
|
const theme = options.theme === "dark" ? "dark" : "light";
|
|
4492
|
-
const
|
|
4493
|
-
const
|
|
6205
|
+
const ink = [];
|
|
6206
|
+
const traces = [];
|
|
6207
|
+
const svg = drawSvg(diagram, layout, timeline, palette, theme, void 0, ink, traces);
|
|
4494
6208
|
return {
|
|
4495
|
-
svg
|
|
6209
|
+
svg,
|
|
4496
6210
|
palette: palette.id,
|
|
4497
6211
|
theme,
|
|
4498
6212
|
...diagram.view ? { view: diagram.view } : {},
|
|
4499
6213
|
fonts: { ...FONTS },
|
|
4500
6214
|
layout,
|
|
4501
6215
|
timeline,
|
|
4502
|
-
diagram
|
|
6216
|
+
diagram,
|
|
6217
|
+
overlaps: findOverlaps(ink, timeline.stills, traces)
|
|
4503
6218
|
};
|
|
4504
6219
|
}
|
|
4505
6220
|
|
|
@@ -4833,7 +6548,7 @@ async function exportDiagram(input, options) {
|
|
|
4833
6548
|
}
|
|
4834
6549
|
}
|
|
4835
6550
|
const files = writeOutputs(options.outDir, options.name ?? "diagram", outputs);
|
|
4836
|
-
return { files, view, frames, ...sizeOf(videoSvg) };
|
|
6551
|
+
return { files, view, frames, ...sizeOf(videoSvg), overlaps: rendered.overlaps };
|
|
4837
6552
|
}
|
|
4838
6553
|
function writeOutputs(outDir, name, outputs) {
|
|
4839
6554
|
const created = fs.mkdirSync(outDir, { recursive: true });
|