@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/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { readFileSync, mkdirSync, writeFileSync, rmSync } from 'fs';
|
|
3
|
-
import { join, dirname, basename, extname, resolve } from 'path';
|
|
3
|
+
import { join as join$1, dirname, basename, extname, resolve } from 'path';
|
|
4
4
|
import { parseArgs } from 'util';
|
|
5
5
|
import { createRequire } from 'module';
|
|
6
6
|
import { readFile } from 'fs/promises';
|
|
@@ -264,7 +264,11 @@ var TYPE = {
|
|
|
264
264
|
stepTitle: text(15, 700),
|
|
265
265
|
stepBody: text(13.5, 500),
|
|
266
266
|
stepNo: text(13, 700, "mono"),
|
|
267
|
-
button: text(14, 700)
|
|
267
|
+
button: text(14, 700),
|
|
268
|
+
/** 枝分かれの図 (#3164) の、丸の中の commit の名札と、丸の外に添える hash と一言 */
|
|
269
|
+
gitId: text(11, 700),
|
|
270
|
+
gitHash: text(10.5, 600, "mono"),
|
|
271
|
+
gitNote: text(10.5, 650)
|
|
268
272
|
};
|
|
269
273
|
var LOOK = {
|
|
270
274
|
/** 部品どうしの最小の隙間 */
|
|
@@ -274,7 +278,11 @@ var LOOK = {
|
|
|
274
278
|
box: { h: 72, minW: 92, padX: 12, radius: 12, icon: 24, iconRadius: 7, iconY: -16, iconScale: 0.74, nameY: 12, subY: 27 },
|
|
275
279
|
region: { pad: 18, gap: 10, radius: 14, inset: 14, icon: 24, iconRadius: 7, iconScale: 0.68, nameY: 58, line: 16, minH: 108 },
|
|
276
280
|
architecture: { columns: 4, columnGap: 56, maxColumnGap: 160, rowGap: 44, labelRoom: 16 },
|
|
277
|
-
|
|
281
|
+
/**
|
|
282
|
+
* 時系列図。線の名前の札は、構成図と状態遷移図より線に寄せる (`labelOffset` は線から札の真ん中まで)。
|
|
283
|
+
* 札と線の離れが図の他の空きと同じ 6 になり、行を詰めても札がどの線の名前かが分かる (#3177)。
|
|
284
|
+
*/
|
|
285
|
+
sequence: { columnGap: 40, labelRoom: 16, labelOffset: 16, firstRow: 10, rowGap: 6, stepGap: 6, minPitch: 32, tail: 10, selfW: 34, selfH: 18 },
|
|
278
286
|
/**
|
|
279
287
|
* 状態遷移図 (#3163)。状態は `columns` つずつ並べて次の段へ折り返し、段の間 (`rowGap`) の真ん中を、段をまたぐ線が通る。
|
|
280
288
|
* `start` と `end` は始まりと終わりの印の半径と、印の中の丸の半径。`drop` は最初の状態の上端から始まりの印の中心まで、
|
|
@@ -304,17 +312,60 @@ var LOOK = {
|
|
|
304
312
|
done: { r: 6.5, inset: 13 },
|
|
305
313
|
pastLabel: 0.85
|
|
306
314
|
},
|
|
315
|
+
/**
|
|
316
|
+
* 枝分かれの図 (#3164)。見本帳の試作 (`scenes/git.js`) の寸法を写す。
|
|
317
|
+
* commit は列ごとに `pitch` ずつ右へ並べ、一番上でない帯の commit は列の半分だけ右へずらす。`x0` は最初の列の真ん中の x の下限、
|
|
318
|
+
* `textGap` は隣の列の hash と一言の間に空ける最小の隙間。`r` は丸の半径、`orphan` はどの札からも辿れなくなった commit の点線の丸の半径。
|
|
319
|
+
* `topLine` と `line` は帯の上端から丸を並べる線まで (一番上の帯と、それより下の帯)、`topBelow` と `below` は線から帯の下端まで。
|
|
320
|
+
* `bare` は線の名前を下に置かない帯の、線から帯の下端まで。
|
|
321
|
+
* hash と一言は一番上の帯では丸の上に、ほかの帯では丸の下に置き、`above` と `under` は丸の真ん中から丸に近い行の基準線まで、`lineStep` は行の間。
|
|
322
|
+
* 札は丸の上に段を重ねて置き、`tagTop` と `tag` は丸の真ん中から 1 段目の札の真ん中まで (一番上の帯と、ほかの帯)、`row` は札の段の間。
|
|
323
|
+
* 札の段が 2 段より多い commit がある帯は、多い段の分だけ線を下げる。
|
|
324
|
+
* `turn` は枝へ分かれる線と枝から入る線が曲がり終えて横へ進むまでの長さ、`samples` は曲がりを区切る点の数、`boxGap` は commit の並びと箱の間。
|
|
325
|
+
* `labelUnder` はほかの帯で、丸の真ん中から線の名前の札の上端まで。`colors` は帯の色を上から配る順
|
|
326
|
+
*/
|
|
327
|
+
git: {
|
|
328
|
+
x0: 120,
|
|
329
|
+
pitch: 90,
|
|
330
|
+
textGap: 12,
|
|
331
|
+
r: 12,
|
|
332
|
+
orphan: 13.5,
|
|
333
|
+
topLine: 120,
|
|
334
|
+
line: 90,
|
|
335
|
+
topBelow: 30,
|
|
336
|
+
below: 82,
|
|
337
|
+
bare: 62,
|
|
338
|
+
above: 18,
|
|
339
|
+
under: 27,
|
|
340
|
+
lineStep: 13,
|
|
341
|
+
tagTop: 58,
|
|
342
|
+
tag: 30,
|
|
343
|
+
row: 22,
|
|
344
|
+
turn: 60,
|
|
345
|
+
samples: 12,
|
|
346
|
+
boxGap: 24,
|
|
347
|
+
labelUnder: 50,
|
|
348
|
+
colors: ["blue", "violet", "green", "amber", "rose"]
|
|
349
|
+
},
|
|
307
350
|
/** `bend` は線の曲がりを丸める半径 (#3171) */
|
|
308
351
|
edge: { inset: 3, arrow: 6, arrowHalf: 3.5, parallel: 5, ghostDash: 5, flowDash: 9, bend: 12 },
|
|
309
|
-
|
|
352
|
+
/** `touch` は線の名前と、同じ時刻に見えている段の番号の丸の間に空ける最小の隙間 (#3175) */
|
|
353
|
+
label: { h: 20, padX: 9, radius: 10, offset: 22, side: 14, search: 4, searchMax: 400, soft: 6, touch: 2 },
|
|
310
354
|
action: { h: 22, padX: 10, radius: 11 },
|
|
311
355
|
badge: { r: 9.5, ring: 9, inset: 4, along: 14, short: 44 },
|
|
312
356
|
carrier: { envW: 24, envH: 17, coinR: 6.5, coinIn: 3.8, tagH: 18, tagPadX: 8, samples: 16 },
|
|
357
|
+
/**
|
|
358
|
+
* 運ぶ物の置き場 (#3176)。運ぶ物を出し入れする箱は、絵柄の右に点線の枠を持ち、運ぶ物は着いた後と走り出す前にそこで待つ。
|
|
359
|
+
* `gap` は絵柄と枠の間、`pad` は枠と運ぶ物の間、`spread` は枠の中に横に並べた運ぶ物の間、`h` と `radius` は枠の高さと角の丸み。
|
|
360
|
+
* `clear` は状態遷移図の右上の済んだ印と枠の間に空ける最小の隙間。`lifeline` は時系列図で生存線と運ぶ物の間、
|
|
361
|
+
* `mark` は状態遷移図の始まりの印と、その左で走り出しを待つ運ぶ物の間
|
|
362
|
+
*/
|
|
363
|
+
slot: { gap: 6, pad: 3, spread: 4, h: 24, radius: 7, clear: 2, lifeline: 5, mark: 4 },
|
|
313
364
|
/**
|
|
314
365
|
* `trail` は状態遷移図の帯の最後の、通った状態の点 (#3171)。`r` は点の半径、`step` は点の中心どうしの間、`now` は変わった値の欄の名前の横の点の半径と、名前からの離れ
|
|
315
366
|
*/
|
|
316
367
|
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 } },
|
|
317
|
-
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 },
|
|
368
|
+
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 },
|
|
318
369
|
shadow: { near: 0.8, far: 4, nearY: 1, farY: 3 },
|
|
319
370
|
mini: { w: 168, pad: 8, title: 14, inset: 12, radius: 10 },
|
|
320
371
|
/**
|
|
@@ -328,7 +379,7 @@ var LOOK = {
|
|
|
328
379
|
*/
|
|
329
380
|
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 } },
|
|
330
381
|
/** 色を混ぜる割合 (%) */
|
|
331
|
-
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 },
|
|
382
|
+
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 },
|
|
332
383
|
/** 字の並びの基準線を、置きたい高さの真ん中からどれだけ下げるか */
|
|
333
384
|
baseline: { label: 3.8, badge: 3.5, carrier: 3.7, stripTitle: 4.5, tag: 3.6, action: 3.8, mark: 4 },
|
|
334
385
|
/** 浮いて出る物が下から上がる長さと、弾んで出る物の始まりの大きさ */
|
|
@@ -376,6 +427,8 @@ var EASE = {
|
|
|
376
427
|
};
|
|
377
428
|
|
|
378
429
|
// src/figure-text.ts
|
|
430
|
+
var spaced = (word) => /[0-9A-Za-z]$/u.test(word) ? `${word} ` : word;
|
|
431
|
+
var capital = (text2) => text2.charAt(0).toUpperCase() + text2.slice(1);
|
|
379
432
|
var FIGURE_TEXT = {
|
|
380
433
|
ja: {
|
|
381
434
|
cannotDraw: (detail2) => `\u56F3\u3092\u63CF\u3051\u306A\u3044: ${detail2}`,
|
|
@@ -390,7 +443,14 @@ var FIGURE_TEXT = {
|
|
|
390
443
|
sideFrom: (count) => `${count} \u3064\u306E\u72B6\u614B\u304B\u3089\u5165\u308C\u308B`,
|
|
391
444
|
trail: "\u901A\u3063\u305F\u72B6\u614B",
|
|
392
445
|
start: "\u59CB\u307E\u308A",
|
|
393
|
-
end: "\u7D42\u308F\u308A"
|
|
446
|
+
end: "\u7D42\u308F\u308A",
|
|
447
|
+
badgeName: (no) => `\u6BB5\u306E\u756A\u53F7 ${no}`,
|
|
448
|
+
quoted: (text2) => `\u300C${text2}\u300D`,
|
|
449
|
+
iconOf: (box) => `\u300C${box} \u306E\u7D75\u67C4\u300D`,
|
|
450
|
+
coin: "\u300C\u786C\u8CA8\u300D",
|
|
451
|
+
envelope: "\u300C\u5C01\u7B52\u300D",
|
|
452
|
+
textsOverlap: (a, b) => `${spaced(a)}\u3068${spaced(b)}\u304C\u91CD\u306A\u308B`,
|
|
453
|
+
lineCrosses: (from, to, text2) => `\u7DDA ${from} \u2192 ${to} \u304C${spaced(text2)}\u3092\u6A2A\u5207\u308B`
|
|
394
454
|
},
|
|
395
455
|
en: {
|
|
396
456
|
cannotDraw: (detail2) => `Cannot draw the diagram: ${detail2}`,
|
|
@@ -405,7 +465,14 @@ var FIGURE_TEXT = {
|
|
|
405
465
|
sideFrom: (count) => `Enterable from ${count} ${count === 1 ? "state" : "states"}`,
|
|
406
466
|
trail: "States passed",
|
|
407
467
|
start: "Start",
|
|
408
|
-
end: "End"
|
|
468
|
+
end: "End",
|
|
469
|
+
badgeName: (no) => `step number ${no}`,
|
|
470
|
+
quoted: (text2) => `"${text2}"`,
|
|
471
|
+
iconOf: (box) => `the icon of "${box}"`,
|
|
472
|
+
coin: "the coin",
|
|
473
|
+
envelope: "the envelope",
|
|
474
|
+
textsOverlap: (a, b) => capital(`${a} and ${b} overlap`),
|
|
475
|
+
lineCrosses: (from, to, text2) => `The line ${from} \u2192 ${to} crosses ${text2}`
|
|
409
476
|
}
|
|
410
477
|
};
|
|
411
478
|
|
|
@@ -420,6 +487,10 @@ function textWidth(text2, style) {
|
|
|
420
487
|
for (const ch of text2) sum += advance(ch, family);
|
|
421
488
|
return sum * style.size / EM;
|
|
422
489
|
}
|
|
490
|
+
function textBox(text2, x, y, style, anchor = "start") {
|
|
491
|
+
const w = textWidth(text2, style);
|
|
492
|
+
return { x: anchor === "middle" ? x - w / 2 : x, y: y - style.size * 0.8, w, h: style.size };
|
|
493
|
+
}
|
|
423
494
|
|
|
424
495
|
// src/layout/scene.ts
|
|
425
496
|
function edgesOf(diagram) {
|
|
@@ -454,11 +525,93 @@ function boxWidth(diagram, id, withActions) {
|
|
|
454
525
|
}
|
|
455
526
|
return Math.max(LOOK.box.minW, Math.max(...lines) + LOOK.box.padX * 2);
|
|
456
527
|
}
|
|
528
|
+
function carrierHalf(carry) {
|
|
529
|
+
const C = LOOK.carrier;
|
|
530
|
+
if (carry.kind === "tag") return [(textWidth(carry.text, hasWide(carry.text) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2) / 2, C.tagH / 2];
|
|
531
|
+
if (carry.kind === "coin") return [C.coinR, C.coinR];
|
|
532
|
+
return [C.envW / 2, C.envH / 2];
|
|
533
|
+
}
|
|
534
|
+
var roomWidth = (room) => room.main + room.coin + (room.main > 0 && room.coin > 0 ? LOOK.slot.spread : 0);
|
|
535
|
+
function slotRooms(diagram) {
|
|
536
|
+
const rooms = /* @__PURE__ */ new Map();
|
|
537
|
+
const ids = new Set(diagram.boxes.map((b) => b.id));
|
|
538
|
+
for (const step of diagram.steps) {
|
|
539
|
+
for (const event of step.events) {
|
|
540
|
+
if (event.type !== "edge" || event.carry.kind === "none") continue;
|
|
541
|
+
const who = event.carry.kind === "coin" ? "coin" : "main";
|
|
542
|
+
const w = carrierHalf(event.carry)[0] * 2;
|
|
543
|
+
for (const id of [event.from, event.to]) {
|
|
544
|
+
if (!ids.has(id)) continue;
|
|
545
|
+
const room = rooms.get(id) ?? { main: 0, coin: 0 };
|
|
546
|
+
room[who] = Math.max(room[who], w);
|
|
547
|
+
rooms.set(id, room);
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
return rooms;
|
|
552
|
+
}
|
|
553
|
+
function slotBoxWidth(room, icon, right) {
|
|
554
|
+
if (!room) return 0;
|
|
555
|
+
return (icon ? LOOK.box.icon + LOOK.slot.gap : 0) + roomWidth(room) + LOOK.slot.pad * 2 + LOOK.box.padX + right;
|
|
556
|
+
}
|
|
557
|
+
function placeSlot(box, room, right = LOOK.box.padX) {
|
|
558
|
+
if (!room) return;
|
|
559
|
+
const B = LOOK.box;
|
|
560
|
+
const S2 = LOOK.slot;
|
|
561
|
+
const w = roomWidth(room) + S2.pad * 2;
|
|
562
|
+
const lead = box.icon ? B.icon + S2.gap : 0;
|
|
563
|
+
const left = Math.max(box.x + B.padX, Math.min(box.cx - (lead + w) / 2, box.x + box.w - right - (lead + w)));
|
|
564
|
+
if (box.icon) box.iconX = left + B.icon / 2;
|
|
565
|
+
box.slot = { x: left + lead, y: box.cy + B.iconY - S2.h / 2, w, h: S2.h };
|
|
566
|
+
}
|
|
567
|
+
function seatCarriers(edges, boxes, rooms) {
|
|
568
|
+
const S2 = LOOK.slot;
|
|
569
|
+
const seat = (id, carry) => {
|
|
570
|
+
const box = boxes.get(id);
|
|
571
|
+
const room = rooms.get(id);
|
|
572
|
+
if (!box?.slot || !room) return void 0;
|
|
573
|
+
const inner = box.slot.x + S2.pad;
|
|
574
|
+
const y = box.slot.y + box.slot.h / 2;
|
|
575
|
+
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];
|
|
576
|
+
return [box.slot.x + box.slot.w / 2, y];
|
|
577
|
+
};
|
|
578
|
+
for (const edge2 of edges) {
|
|
579
|
+
if (edge2.carry.kind === "none") continue;
|
|
580
|
+
const settle = seat(edge2.to, edge2.carry);
|
|
581
|
+
const wait = seat(edge2.from, edge2.carry);
|
|
582
|
+
if (settle) edge2.settle = settle;
|
|
583
|
+
if (wait) edge2.wait = wait;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
457
586
|
function gapBetween(a, b) {
|
|
458
587
|
const dx = Math.max(b.x - (a.x + a.w), a.x - (b.x + b.w));
|
|
459
588
|
const dy = Math.max(b.y - (a.y + a.h), a.y - (b.y + b.h));
|
|
460
589
|
return Math.max(dx, dy);
|
|
461
590
|
}
|
|
591
|
+
function crossesRect(points, rect, inset = 0) {
|
|
592
|
+
const x0 = rect.x + inset;
|
|
593
|
+
const y0 = rect.y + inset;
|
|
594
|
+
const x1 = rect.x + rect.w - inset;
|
|
595
|
+
const y1 = rect.y + rect.h - inset;
|
|
596
|
+
if (x1 <= x0 || y1 <= y0) return false;
|
|
597
|
+
for (let i = 1; i < points.length; i++) {
|
|
598
|
+
const [ax, ay] = points[i - 1];
|
|
599
|
+
const [bx, by] = points[i];
|
|
600
|
+
const dx = bx - ax;
|
|
601
|
+
const dy = by - ay;
|
|
602
|
+
let lo = 0;
|
|
603
|
+
let hi = 1;
|
|
604
|
+
const cut = (p, q) => {
|
|
605
|
+
if (p === 0) return q > 0;
|
|
606
|
+
const r = q / p;
|
|
607
|
+
if (p < 0) lo = Math.max(lo, r);
|
|
608
|
+
else hi = Math.min(hi, r);
|
|
609
|
+
return lo < hi;
|
|
610
|
+
};
|
|
611
|
+
if (cut(-dx, ax - x0) && cut(dx, x1 - ax) && cut(-dy, ay - y0) && cut(dy, y1 - ay)) return true;
|
|
612
|
+
}
|
|
613
|
+
return false;
|
|
614
|
+
}
|
|
462
615
|
function longest(points) {
|
|
463
616
|
let best = { a: points[0], b: points[1] ?? points[0], length: -1 };
|
|
464
617
|
for (let i = 1; i < points.length; i++) {
|
|
@@ -489,34 +642,122 @@ function pathLength(points) {
|
|
|
489
642
|
}
|
|
490
643
|
return sum;
|
|
491
644
|
}
|
|
492
|
-
function
|
|
645
|
+
function loopUnder(box) {
|
|
646
|
+
const { w, h, samples } = LOOK.state.loop;
|
|
647
|
+
const bottom = box.y + box.h;
|
|
648
|
+
const p0 = [box.cx + w / 2, bottom];
|
|
649
|
+
const c1 = [box.cx + w * 3 / 4, bottom + h * 4 / 3];
|
|
650
|
+
const c2 = [box.cx - w * 3 / 4, bottom + h * 4 / 3];
|
|
651
|
+
const p3 = [box.cx - w / 2, bottom + LOOK.edge.inset];
|
|
652
|
+
return Array.from({ length: samples + 1 }, (_, k) => {
|
|
653
|
+
const t = k / samples;
|
|
654
|
+
const u = 1 - t;
|
|
655
|
+
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];
|
|
656
|
+
return [at2(0), at2(1)];
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
function loopBadge(points) {
|
|
660
|
+
const right = Math.max(...points.map(([px]) => px));
|
|
661
|
+
const top = points[0][1];
|
|
662
|
+
const deep = Math.max(...points.map(([, py]) => py));
|
|
663
|
+
return [right + LOOK.badge.r + LOOK.badge.inset, top + (deep - top) * LOOK.state.loop.badgeAt];
|
|
664
|
+
}
|
|
665
|
+
function loopLabelBase(points, w) {
|
|
666
|
+
return { x: (points[0]?.[0] ?? 0) - LOOK.state.loop.w / 2 - w / 2, y: Math.max(...points.map(([, y]) => y)) + LOOK.label.soft };
|
|
667
|
+
}
|
|
668
|
+
var LOOP_ROOM = LOOK.state.loop.h + LOOK.label.soft * 2 + LOOK.label.h;
|
|
669
|
+
function badgeOnPath(points, taken = [], lines = []) {
|
|
670
|
+
const length = pathLength(points);
|
|
671
|
+
const first = length < LOOK.badge.short ? Math.min(LOOK.badge.r + 1, length / 2) : LOOK.badge.along;
|
|
672
|
+
const apart = LOOK.badge.r * 2 + LOOK.badge.inset;
|
|
673
|
+
for (let d = first; d <= length; d += 1) {
|
|
674
|
+
const p = along(points, d);
|
|
675
|
+
if (taken.every(([x, y]) => Math.hypot(p[0] - x, p[1] - y) >= apart)) return p;
|
|
676
|
+
}
|
|
677
|
+
return besideLine(points, first, taken, lines) ?? along(points, first);
|
|
678
|
+
}
|
|
679
|
+
function besideLine(points, at2, taken, lines) {
|
|
493
680
|
const length = pathLength(points);
|
|
494
|
-
|
|
681
|
+
const [px, py] = along(points, at2);
|
|
682
|
+
const [ax, ay] = along(points, Math.max(0, at2 - 1));
|
|
683
|
+
const [bx, by] = along(points, Math.min(length, at2 + 1));
|
|
684
|
+
const n = Math.hypot(bx - ax, by - ay);
|
|
685
|
+
if (n === 0) return void 0;
|
|
686
|
+
const [nx, ny] = [-(by - ay) / n, (bx - ax) / n];
|
|
687
|
+
const size = LOOK.badge.r * 2;
|
|
688
|
+
for (const margin of [LOOK.edge.arrowHalf, 0]) {
|
|
689
|
+
for (let s = 1; s <= size + LOOK.badge.inset; s++) {
|
|
690
|
+
for (const sign of [1, -1]) {
|
|
691
|
+
const c = [px + nx * s * sign, py + ny * s * sign];
|
|
692
|
+
const free = taken.every(([x, y]) => Math.max(Math.abs(c[0] - x), Math.abs(c[1] - y)) >= size + 1);
|
|
693
|
+
if (free && lines.every((line) => !crossesRect(line, badgeRect(c), -margin))) return c;
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return void 0;
|
|
698
|
+
}
|
|
699
|
+
var lineKey = (edge2) => edge2.points.map(([x, y]) => `${Math.round(x * 10)},${Math.round(y * 10)}`).join(" ");
|
|
700
|
+
function lineBadges(edges, steps, at2 = (edge2, taken, lines) => badgeOnPath(edge2.points, taken, lines)) {
|
|
701
|
+
const out = /* @__PURE__ */ new Map();
|
|
702
|
+
const taken = [];
|
|
703
|
+
const placed = /* @__PURE__ */ new Map();
|
|
704
|
+
for (let s = 0; s < steps; s++) {
|
|
705
|
+
const edge2 = edges.find((e) => e.step === s && e.points.length > 0);
|
|
706
|
+
if (!edge2) continue;
|
|
707
|
+
const key = lineKey(edge2);
|
|
708
|
+
const before = placed.get(key);
|
|
709
|
+
if (before) {
|
|
710
|
+
out.set(s, { point: before, edge: edge2 });
|
|
711
|
+
continue;
|
|
712
|
+
}
|
|
713
|
+
const lines = edges.filter((e) => e.points.length > 1 && lineKey(e) !== key).map((e) => e.points);
|
|
714
|
+
const point = at2(edge2, taken, lines);
|
|
715
|
+
taken.push(point);
|
|
716
|
+
placed.set(key, point);
|
|
717
|
+
out.set(s, { point, edge: edge2 });
|
|
718
|
+
}
|
|
719
|
+
return out;
|
|
495
720
|
}
|
|
721
|
+
function replaceSameSpot(badges2) {
|
|
722
|
+
const same2 = (a, b) => Math.hypot(a.x - b.x, a.y - b.y) <= 0.5;
|
|
723
|
+
return badges2.map((badge2) => {
|
|
724
|
+
const next = badges2.filter((other) => other.step > badge2.step && same2(other, badge2)).sort((a, b) => a.step - b.step)[0];
|
|
725
|
+
return next ? { ...badge2, until: next.step } : badge2;
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
var badgeRect = ([x, y]) => ({ x: x - LOOK.badge.r, y: y - LOOK.badge.r, w: LOOK.badge.r * 2, h: LOOK.badge.r * 2 });
|
|
729
|
+
var markText = (e) => [e.x + LOOK.state.text, e.y + LOOK.baseline.mark];
|
|
496
730
|
var labelStyle = (text2) => hasWide(text2) ? TYPE.labelJa : TYPE.label;
|
|
731
|
+
var OPPOSITE = { above: "below", below: "above", left: "right", right: "left" };
|
|
497
732
|
function placeLabel(request, obstacles) {
|
|
498
733
|
const w = textWidth(request.text, labelStyle(request.text)) + LOOK.label.padX * 2;
|
|
499
734
|
const h = LOOK.label.h;
|
|
500
735
|
const segment = longest(request.points);
|
|
501
736
|
const mx = (segment.a[0] + segment.b[0]) / 2;
|
|
502
737
|
const my = (segment.a[1] + segment.b[1]) / 2;
|
|
503
|
-
const
|
|
504
|
-
const {
|
|
505
|
-
const
|
|
506
|
-
const
|
|
507
|
-
const
|
|
508
|
-
const
|
|
509
|
-
const clear = (rect) => obstacles.hard.every((box) => gapBetween(rect, box) >= LOOK.gap) && obstacles.soft.every((other) => gapBetween(rect, other) >= LOOK.label.soft);
|
|
738
|
+
const preferred = request.side ?? (segment.vertical ? "right" : "above");
|
|
739
|
+
const { side: sideGap } = LOOK.label;
|
|
740
|
+
const offset = request.offset ?? LOOK.label.offset;
|
|
741
|
+
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 };
|
|
742
|
+
const first = request.base ? { ...request.base, w, h } : baseOf(preferred);
|
|
743
|
+
const sides = request.flip ? [preferred, OPPOSITE[preferred]] : [preferred];
|
|
744
|
+
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));
|
|
510
745
|
const { search, searchMax } = LOOK.label;
|
|
511
746
|
for (let d = 0; d <= searchMax; d += search) {
|
|
512
|
-
for (
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
747
|
+
for (const side2 of sides) {
|
|
748
|
+
const base = side2 === preferred ? first : baseOf(side2);
|
|
749
|
+
const away = side2 === "above" ? [0, -1] : side2 === "below" ? [0, 1] : side2 === "left" ? [-1, 0] : [1, 0];
|
|
750
|
+
const slideAxis = [Math.abs(away[1]), Math.abs(away[0])];
|
|
751
|
+
const slideMax = request.slide ?? (side2 === "above" || side2 === "below" ? w : h * 4);
|
|
752
|
+
for (let s = 0; s <= slideMax; s += search) {
|
|
753
|
+
for (const sign of s === 0 ? [1] : [1, -1]) {
|
|
754
|
+
const rect = { x: base.x + away[0] * d + slideAxis[0] * s * sign, y: base.y + away[1] * d + slideAxis[1] * s * sign, w, h };
|
|
755
|
+
if (clear(rect)) return { ...rect, step: request.step, event: request.event, text: request.text, family: labelStyle(request.text).family, color: request.color };
|
|
756
|
+
}
|
|
516
757
|
}
|
|
517
758
|
}
|
|
518
759
|
}
|
|
519
|
-
return { ...
|
|
760
|
+
return { ...first, step: request.step, event: request.event, text: request.text, family: labelStyle(request.text).family, color: request.color };
|
|
520
761
|
}
|
|
521
762
|
function fieldWidth(diagram, name) {
|
|
522
763
|
let value = 0;
|
|
@@ -571,6 +812,8 @@ function shiftContent(layout, dx, dy) {
|
|
|
571
812
|
move(box);
|
|
572
813
|
box.cx += dx;
|
|
573
814
|
box.cy += dy;
|
|
815
|
+
if (box.slot) move(box.slot);
|
|
816
|
+
if (box.iconX !== void 0) box.iconX += dx;
|
|
574
817
|
}
|
|
575
818
|
for (const region of layout.regions) {
|
|
576
819
|
region.y += dy;
|
|
@@ -584,6 +827,7 @@ function shiftContent(layout, dx, dy) {
|
|
|
584
827
|
for (const edge2 of layout.edges) {
|
|
585
828
|
edge2.points = edge2.points.map(([px, py]) => [px + dx, py + dy]);
|
|
586
829
|
if (edge2.settle) edge2.settle = [edge2.settle[0] + dx, edge2.settle[1] + dy];
|
|
830
|
+
if (edge2.wait) edge2.wait = [edge2.wait[0] + dx, edge2.wait[1] + dy];
|
|
587
831
|
}
|
|
588
832
|
for (const label2 of layout.labels) move(label2);
|
|
589
833
|
for (const path2 of layout.paths) {
|
|
@@ -617,11 +861,11 @@ function cornerBadge(events, step, layout) {
|
|
|
617
861
|
for (const event of events) {
|
|
618
862
|
const id = event.type === "swap" || event.type === "action" ? event.box : void 0;
|
|
619
863
|
const box2 = layout.boxes.find((b) => b.id === id);
|
|
620
|
-
if (box2) return { step, x: box2.x
|
|
864
|
+
if (box2) return { step, x: box2.x, y: box2.y, color: box2.color };
|
|
621
865
|
}
|
|
622
866
|
if (layout.strip && events.some((event) => event.type === "strip")) return { step, x: layout.strip.x + inset, y: layout.strip.y + inset, color: "slate" };
|
|
623
867
|
const box = layout.boxes[0];
|
|
624
|
-
return { step, x: box.x
|
|
868
|
+
return { step, x: box.x, y: box.y, color: box.color };
|
|
625
869
|
}
|
|
626
870
|
|
|
627
871
|
// src/layout/architecture.ts
|
|
@@ -720,7 +964,8 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
720
964
|
const regionColor = regionColors(diagram);
|
|
721
965
|
const edges = edgesOf(diagram);
|
|
722
966
|
const columnCount = Math.max(1, ...[...slots.values()].map((s) => s.col + 1));
|
|
723
|
-
const
|
|
967
|
+
const carriedIn = slotRooms(diagram);
|
|
968
|
+
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))]));
|
|
724
969
|
const colW = Array.from({ length: columnCount }, (_, c) => Math.max(B.minW, ...[...slots].filter(([, s]) => s.col === c).map(([id]) => widths.get(id) ?? B.minW)));
|
|
725
970
|
const between = Array.from({ length: Math.max(0, columnCount - 1) }, () => A.columnGap);
|
|
726
971
|
for (const { edge: edge2 } of edges) {
|
|
@@ -735,7 +980,13 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
735
980
|
const headerW = Math.max(0, ...headers.map((h) => h ? h.w + R.inset * 2 : 0));
|
|
736
981
|
const colLeft = [];
|
|
737
982
|
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]);
|
|
738
|
-
const
|
|
983
|
+
const center2 = (c) => colLeft[c] + colW[c] / 2;
|
|
984
|
+
const looped = new Set(edges.filter(({ edge: edge2 }) => edge2.from === edge2.to).map(({ edge: edge2 }) => edge2.from));
|
|
985
|
+
const loopRows = new Set([...looped].flatMap((id) => {
|
|
986
|
+
const slot = slots.get(id);
|
|
987
|
+
return slot ? [`${slot.group}:${slot.row}`] : [];
|
|
988
|
+
}));
|
|
989
|
+
const loopRoom = (g, row) => loopRows.has(`${g}:${row}`) ? LOOP_ROOM : 0;
|
|
739
990
|
const boxes = [];
|
|
740
991
|
const bands = [];
|
|
741
992
|
let cursor = margin;
|
|
@@ -743,12 +994,14 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
743
994
|
const rows = Math.max(1, ...group.members.map((id) => (slots.get(id)?.row ?? 0) + 1));
|
|
744
995
|
const room = rooms[g];
|
|
745
996
|
const top = cursor + R.pad + room.top;
|
|
997
|
+
const rowTop = [0];
|
|
998
|
+
for (let r = 1; r < rows; r++) rowTop.push(rowTop[r - 1] + B.h + A.rowGap + loopRoom(g, r - 1));
|
|
746
999
|
for (const id of group.members) {
|
|
747
1000
|
const slot = slots.get(id);
|
|
748
1001
|
const source = diagram.boxes.find((b) => b.id === id);
|
|
749
1002
|
const w = widths.get(id) ?? B.minW;
|
|
750
|
-
const cx =
|
|
751
|
-
const y = top + slot.row
|
|
1003
|
+
const cx = center2(slot.col);
|
|
1004
|
+
const y = top + rowTop[slot.row];
|
|
752
1005
|
boxes.push({
|
|
753
1006
|
id,
|
|
754
1007
|
name: source?.name ?? id,
|
|
@@ -763,29 +1016,36 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
763
1016
|
cy: y + B.h / 2
|
|
764
1017
|
});
|
|
765
1018
|
}
|
|
766
|
-
const
|
|
1019
|
+
const contentBottom2 = top + rowTop[rows - 1] + B.h + loopRoom(g, rows - 1);
|
|
767
1020
|
const header = headers[g];
|
|
768
|
-
const h = Math.max(
|
|
1021
|
+
const h = Math.max(contentBottom2 + R.pad + room.bottom - cursor, header ? header.h + R.inset * 2 : 0, group.region ? R.minH : 0);
|
|
769
1022
|
bands.push({ group: g, y: cursor, h, rows });
|
|
770
1023
|
cursor += h + R.gap;
|
|
771
1024
|
});
|
|
772
1025
|
const bandsBottom = cursor - R.gap;
|
|
1026
|
+
for (const box of boxes) placeSlot(box, carriedIn.get(box.id));
|
|
773
1027
|
const byId = new Map(boxes.map((b) => [b.id, b]));
|
|
774
1028
|
const bandOf = (id) => bands[slots.get(id)?.group ?? 0];
|
|
775
|
-
const
|
|
776
|
-
if (box.id === a || box.id === b) return false;
|
|
777
|
-
const pad2 = LOOK.label.search;
|
|
1029
|
+
const crosses = (points, rect, pad2) => {
|
|
778
1030
|
for (let i = 1; i < points.length; i++) {
|
|
779
1031
|
const [x1, y1] = points[i - 1];
|
|
780
1032
|
const [x2, y2] = points[i];
|
|
781
|
-
if (Math.min(x1, x2) <=
|
|
1033
|
+
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;
|
|
782
1034
|
}
|
|
783
1035
|
return false;
|
|
1036
|
+
};
|
|
1037
|
+
const loopZones = [...looped].flatMap((id) => {
|
|
1038
|
+
const box = byId.get(id);
|
|
1039
|
+
return box ? [{ x: box.x, y: box.y + box.h, w: box.w, h: LOOP_ROOM }] : [];
|
|
784
1040
|
});
|
|
1041
|
+
const onLoop = (points) => loopZones.some((zone) => crosses(points, zone, 0));
|
|
1042
|
+
const blocked = (points, a, b) => boxes.some((box) => box.id !== a && box.id !== b && crosses(points, box, LOOK.label.search)) || onLoop(points);
|
|
785
1043
|
const laneBelow = (id) => {
|
|
786
1044
|
const box = byId.get(id);
|
|
787
1045
|
const band2 = bandOf(id);
|
|
788
|
-
|
|
1046
|
+
const slot = slots.get(id);
|
|
1047
|
+
const under = box.y + box.h + (slot ? loopRoom(slot.group, slot.row) : 0);
|
|
1048
|
+
return (slot?.row ?? 0) < band2.rows - 1 ? under + A.rowGap / 2 : Math.min(under + R.pad / 2, band2.y + band2.h - LOOK.edge.inset);
|
|
789
1049
|
};
|
|
790
1050
|
const laneAbove = (id) => {
|
|
791
1051
|
const box = byId.get(id);
|
|
@@ -793,9 +1053,11 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
793
1053
|
return (slots.get(id)?.row ?? 0) > 0 ? box.y - A.rowGap / 2 : Math.max(box.y - R.pad / 2, band2.y + LOOK.edge.inset);
|
|
794
1054
|
};
|
|
795
1055
|
const inset = LOOK.edge.inset;
|
|
1056
|
+
const gapX = (col, toRight) => toRight ? colLeft[col] + colW[col] + (between[col] ?? A.columnGap) / 2 : colLeft[col] - (between[col - 1] ?? A.columnGap) / 2;
|
|
796
1057
|
const route = (from, to) => {
|
|
797
1058
|
const a = byId.get(from);
|
|
798
1059
|
const b = byId.get(to);
|
|
1060
|
+
if (from === to) return loopUnder(a);
|
|
799
1061
|
const sa = slots.get(from);
|
|
800
1062
|
const sb = slots.get(to);
|
|
801
1063
|
if (sa.group === sb.group && sa.row === sb.row) {
|
|
@@ -805,13 +1067,22 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
805
1067
|
[right2 ? b.x - inset : b.x + b.w + inset, b.cy]
|
|
806
1068
|
];
|
|
807
1069
|
if (!blocked(straight, from, to)) return straight;
|
|
808
|
-
const
|
|
809
|
-
|
|
1070
|
+
const below = laneBelow(from);
|
|
1071
|
+
const under = [
|
|
810
1072
|
[a.cx, a.y + a.h],
|
|
811
|
-
[a.cx,
|
|
812
|
-
[b.cx,
|
|
1073
|
+
[a.cx, below],
|
|
1074
|
+
[b.cx, below],
|
|
813
1075
|
[b.cx, b.y + b.h + inset]
|
|
814
1076
|
];
|
|
1077
|
+
if (!onLoop(under)) return under;
|
|
1078
|
+
const above = laneAbove(from);
|
|
1079
|
+
const over = [
|
|
1080
|
+
[a.cx, a.y],
|
|
1081
|
+
[a.cx, above],
|
|
1082
|
+
[b.cx, above],
|
|
1083
|
+
[b.cx, b.y - inset]
|
|
1084
|
+
];
|
|
1085
|
+
return onLoop(over) ? under : over;
|
|
815
1086
|
}
|
|
816
1087
|
const down = b.cy > a.cy;
|
|
817
1088
|
const leave = [a.cx, down ? a.y + a.h : a.y];
|
|
@@ -819,7 +1090,7 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
819
1090
|
if (sa.col === sb.col) {
|
|
820
1091
|
const straight = [leave, enter];
|
|
821
1092
|
if (!blocked(straight, from, to)) return straight;
|
|
822
|
-
const x =
|
|
1093
|
+
const x = gapX(sa.col, true);
|
|
823
1094
|
return [
|
|
824
1095
|
[a.x + a.w, a.cy],
|
|
825
1096
|
[x, a.cy],
|
|
@@ -834,21 +1105,34 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
834
1105
|
[[right ? a.x + a.w : a.x, a.cy], [b.cx, a.cy], enter],
|
|
835
1106
|
[leave, [a.cx, lane], [b.cx, lane], enter]
|
|
836
1107
|
];
|
|
1108
|
+
if (looped.has(from) || looped.has(to)) {
|
|
1109
|
+
const ax = gapX(sa.col, right);
|
|
1110
|
+
const bx = gapX(sb.col, !right);
|
|
1111
|
+
const out = [
|
|
1112
|
+
[right ? a.x + a.w : a.x, a.cy],
|
|
1113
|
+
[ax, a.cy]
|
|
1114
|
+
];
|
|
1115
|
+
const side2 = [right ? b.x - inset : b.x + b.w + inset, b.cy];
|
|
1116
|
+
candidates.push(
|
|
1117
|
+
[...out, [ax, b.cy], side2],
|
|
1118
|
+
[...out, [ax, lane], [b.cx, lane], enter],
|
|
1119
|
+
[leave, [a.cx, lane], [bx, lane], [bx, b.cy], side2],
|
|
1120
|
+
[...out, [ax, lane], [bx, lane], [bx, b.cy], side2]
|
|
1121
|
+
);
|
|
1122
|
+
}
|
|
837
1123
|
return candidates.find((points) => !blocked(points, from, to)) ?? candidates[2];
|
|
838
1124
|
};
|
|
839
|
-
const sceneEdges = edges.map(({ step, event, edge: edge2 }) => {
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
};
|
|
851
|
-
});
|
|
1125
|
+
const sceneEdges = edges.map(({ step, event, edge: edge2 }) => ({
|
|
1126
|
+
step,
|
|
1127
|
+
event,
|
|
1128
|
+
from: edge2.from,
|
|
1129
|
+
to: edge2.to,
|
|
1130
|
+
points: route(edge2.from, edge2.to),
|
|
1131
|
+
color: edgeColor(edge2, colors),
|
|
1132
|
+
carry: edge2.carry
|
|
1133
|
+
}));
|
|
1134
|
+
seatCarriers(sceneEdges, byId, carriedIn);
|
|
1135
|
+
const outward = /* @__PURE__ */ new Map();
|
|
852
1136
|
for (const edge2 of sceneEdges) {
|
|
853
1137
|
if (edge2.points.length !== 2) continue;
|
|
854
1138
|
const back = sceneEdges.some((other) => other.from === edge2.to && other.to === edge2.from && other.points.length === 2);
|
|
@@ -857,6 +1141,7 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
857
1141
|
const flat = Math.abs(q[1] - p[1]) < Math.abs(q[0] - p[0]);
|
|
858
1142
|
const d = (edge2.from < edge2.to ? 1 : -1) * LOOK.edge.parallel;
|
|
859
1143
|
edge2.points = edge2.points.map(([x, y]) => flat ? [x, y + d] : [x + d, y]);
|
|
1144
|
+
outward.set(edge2, flat ? d > 0 ? "below" : "above" : d > 0 ? "right" : "left");
|
|
860
1145
|
}
|
|
861
1146
|
const regions = [];
|
|
862
1147
|
groups.forEach((group, g) => {
|
|
@@ -876,15 +1161,20 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
876
1161
|
header: { x: margin + R.inset, y: band2.y + R.inset, w: header.w, h: header.h }
|
|
877
1162
|
});
|
|
878
1163
|
});
|
|
1164
|
+
const badgeAt = (edge2, taken, lines2) => edge2.from === edge2.to ? loopBadge(edge2.points) : badgeOnPath(edge2.points, taken, lines2);
|
|
1165
|
+
const early = lineBadges(sceneEdges, diagram.steps.length, badgeAt);
|
|
879
1166
|
const labels = [];
|
|
880
1167
|
for (const edge2 of sceneEdges) {
|
|
881
1168
|
const source = diagram.steps[edge2.step]?.events[edge2.event];
|
|
882
1169
|
if (source?.type !== "edge" || source.label === void 0) continue;
|
|
1170
|
+
const seen = [...early].filter(([s]) => s <= edge2.step).map(([, b]) => badgeRect(b.point));
|
|
883
1171
|
const soft = [...regions.map((r) => r.header), ...labels.filter((l) => l.step === edge2.step)];
|
|
1172
|
+
const side2 = source.labelSide ?? outward.get(edge2);
|
|
1173
|
+
const below = edge2.from === edge2.to ? { side: "below", base: loopLabelBase(edge2.points, textWidth(source.label, labelStyle(source.label)) + LOOK.label.padX * 2) } : void 0;
|
|
884
1174
|
labels.push(
|
|
885
1175
|
placeLabel(
|
|
886
|
-
{ step: edge2.step, event: edge2.event, text: source.label, points: edge2.points, color: edge2.color, ...
|
|
887
|
-
{ hard: boxes, soft }
|
|
1176
|
+
{ step: edge2.step, event: edge2.event, text: source.label, points: edge2.points, color: edge2.color, ...below ?? (side2 ? { side: side2 } : { flip: true }) },
|
|
1177
|
+
{ hard: boxes, soft, touch: seen }
|
|
888
1178
|
)
|
|
889
1179
|
);
|
|
890
1180
|
}
|
|
@@ -894,16 +1184,19 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
894
1184
|
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)));
|
|
895
1185
|
const width = Math.max(contentRight + margin, stripNeed(diagram) + margin * 2);
|
|
896
1186
|
for (const region of regions) region.w = width - margin * 2;
|
|
897
|
-
const
|
|
1187
|
+
const contentBottom = Math.max(bandsBottom, ...labels.map((l) => l.y + l.h));
|
|
1188
|
+
const strip2 = layoutStrip(diagram, margin, contentBottom + gap, width - margin * 2);
|
|
898
1189
|
layout.width = width;
|
|
899
|
-
layout.height = (strip2 ? strip2.y + strip2.h :
|
|
1190
|
+
layout.height = (strip2 ? strip2.y + strip2.h : contentBottom) + margin;
|
|
900
1191
|
if (strip2) layout.strip = strip2;
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
1192
|
+
const lines = lineBadges(sceneEdges, diagram.steps.length, badgeAt);
|
|
1193
|
+
layout.badges = replaceSameSpot(
|
|
1194
|
+
diagram.steps.map((step, s) => {
|
|
1195
|
+
const line = lines.get(s);
|
|
1196
|
+
if (!line) return cornerBadge(step.events, s, layout);
|
|
1197
|
+
return { step: s, x: line.point[0], y: line.point[1], color: line.edge.color };
|
|
1198
|
+
})
|
|
1199
|
+
);
|
|
907
1200
|
return layout;
|
|
908
1201
|
}
|
|
909
1202
|
function grow(layout, groups, slots, rooms) {
|
|
@@ -931,6 +1224,524 @@ function grow(layout, groups, slots, rooms) {
|
|
|
931
1224
|
return grown;
|
|
932
1225
|
}
|
|
933
1226
|
|
|
1227
|
+
// src/words.ts
|
|
1228
|
+
var keys = (table) => Object.keys(table);
|
|
1229
|
+
var KINDS = keys({ sequence: true, architecture: true, state: true, git: true });
|
|
1230
|
+
var STATE_ENDS = ["start", "finish"];
|
|
1231
|
+
var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set", "branch", "commit"];
|
|
1232
|
+
var AS = "as";
|
|
1233
|
+
var ON = "on";
|
|
1234
|
+
var COPY = "copy";
|
|
1235
|
+
var MERGE = "merge";
|
|
1236
|
+
var FROM = "from";
|
|
1237
|
+
var HEAD = "HEAD";
|
|
1238
|
+
var ATTRS = {
|
|
1239
|
+
diagram: ["view"],
|
|
1240
|
+
group: ["note", "color", "icon"],
|
|
1241
|
+
box: ["note", "color", "icon"],
|
|
1242
|
+
edge: ["carry", "tag", "side"],
|
|
1243
|
+
set: ["tag"],
|
|
1244
|
+
branch: ["note"],
|
|
1245
|
+
commit: ["hash", "note"]
|
|
1246
|
+
};
|
|
1247
|
+
var CARRIES = keys({ coin: true, none: true });
|
|
1248
|
+
var VIEWS = keys({ fixed: true, follow: true });
|
|
1249
|
+
var SIDES = keys({ above: true, below: true, left: true, right: true });
|
|
1250
|
+
var OLD_HEADS = {
|
|
1251
|
+
\u6642\u7CFB\u5217\u56F3: "sequence",
|
|
1252
|
+
\u69CB\u6210\u56F3: "architecture",
|
|
1253
|
+
\u533A\u753B: "group",
|
|
1254
|
+
\u898B\u305B\u65B9: "view",
|
|
1255
|
+
region: "group",
|
|
1256
|
+
view: "view"
|
|
1257
|
+
};
|
|
1258
|
+
|
|
1259
|
+
// src/layout/git.ts
|
|
1260
|
+
var isGitLayout = (layout) => layout.kind === "git";
|
|
1261
|
+
function walk(diagram) {
|
|
1262
|
+
const branches = (diagram.git?.branches ?? []).map((b) => b.id);
|
|
1263
|
+
const lane = (id) => {
|
|
1264
|
+
if (!branches.includes(id)) branches.push(id);
|
|
1265
|
+
};
|
|
1266
|
+
for (const step of diagram.steps) for (const e of step.events) if (e.type === "commit" || e.type === "branch") lane(e.branch);
|
|
1267
|
+
const tips = new Map(branches.map((b) => [b, null]));
|
|
1268
|
+
let headAt = null;
|
|
1269
|
+
let attached = null;
|
|
1270
|
+
const made = [];
|
|
1271
|
+
const byId = /* @__PURE__ */ new Map();
|
|
1272
|
+
const links = [];
|
|
1273
|
+
const moves = [];
|
|
1274
|
+
const tags = [];
|
|
1275
|
+
const rows = /* @__PURE__ */ new Map();
|
|
1276
|
+
const most = /* @__PURE__ */ new Map();
|
|
1277
|
+
const shown = /* @__PURE__ */ new Map();
|
|
1278
|
+
const names = [...branches, HEAD];
|
|
1279
|
+
const at2 = new Map(names.map((n) => [n, []]));
|
|
1280
|
+
const heads = [];
|
|
1281
|
+
const visible2 = (ref) => ref === HEAD ? attached === null ? headAt : null : tips.get(ref) ?? null;
|
|
1282
|
+
const freeRow = (commit2) => {
|
|
1283
|
+
const list2 = rows.get(commit2) ?? [];
|
|
1284
|
+
const free = list2.indexOf(null);
|
|
1285
|
+
return free < 0 ? list2.length : free;
|
|
1286
|
+
};
|
|
1287
|
+
const settle = (step, event, change, lineFor) => {
|
|
1288
|
+
const before = new Map(names.map((n) => [n, visible2(n)]));
|
|
1289
|
+
const headBefore = headAt;
|
|
1290
|
+
change();
|
|
1291
|
+
const changed = names.filter((n) => before.get(n) !== visible2(n));
|
|
1292
|
+
const leaving = changed.map((ref) => {
|
|
1293
|
+
const slot = shown.get(ref);
|
|
1294
|
+
if (slot) {
|
|
1295
|
+
rows.get(slot.commit)[slot.row] = null;
|
|
1296
|
+
shown.delete(ref);
|
|
1297
|
+
}
|
|
1298
|
+
return { ref, slot };
|
|
1299
|
+
});
|
|
1300
|
+
for (const { ref, slot } of leaving) {
|
|
1301
|
+
const from = slot ?? (ref === HEAD && headBefore !== null ? { commit: headBefore, row: freeRow(headBefore) } : void 0);
|
|
1302
|
+
const target = visible2(ref);
|
|
1303
|
+
let to;
|
|
1304
|
+
if (target !== null) {
|
|
1305
|
+
to = { commit: target, row: freeRow(target) };
|
|
1306
|
+
const list2 = rows.get(target) ?? [];
|
|
1307
|
+
list2[to.row] = ref;
|
|
1308
|
+
rows.set(target, list2);
|
|
1309
|
+
most.set(target, Math.max(most.get(target) ?? 0, list2.filter((r) => r !== null).length));
|
|
1310
|
+
shown.set(ref, to);
|
|
1311
|
+
}
|
|
1312
|
+
moves.push({ ref, step, event, ...from ? { from } : {}, ...to ? { to } : {}, line: ref === lineFor });
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
const prune = (step, event) => {
|
|
1316
|
+
const reach = /* @__PURE__ */ new Set();
|
|
1317
|
+
const stack = [...tips.values(), headAt].filter((c) => c !== null);
|
|
1318
|
+
while (stack.length > 0) {
|
|
1319
|
+
const id = stack.pop();
|
|
1320
|
+
if (reach.has(id)) continue;
|
|
1321
|
+
reach.add(id);
|
|
1322
|
+
stack.push(...byId.get(id)?.parents ?? []);
|
|
1323
|
+
}
|
|
1324
|
+
for (const c of made) if (!reach.has(c.id) && c.orphan === void 0) c.orphan = { step, event };
|
|
1325
|
+
};
|
|
1326
|
+
diagram.steps.forEach((step, s) => {
|
|
1327
|
+
step.events.forEach((e, k) => {
|
|
1328
|
+
if (e.type === "commit") commit(e, s, k);
|
|
1329
|
+
else if (e.type === "branch") {
|
|
1330
|
+
if (!byId.has(e.from)) return;
|
|
1331
|
+
if (laneOf(e.from) !== e.branch) links.push({ kind: "branch", from: e.from, to: e.branch, step: s, event: k });
|
|
1332
|
+
settle(s, k, () => {
|
|
1333
|
+
tips.set(e.branch, e.from);
|
|
1334
|
+
attached = e.branch;
|
|
1335
|
+
headAt = e.from;
|
|
1336
|
+
});
|
|
1337
|
+
} else if (e.type === "edge") {
|
|
1338
|
+
const ref = e.from;
|
|
1339
|
+
if (ref !== HEAD && !tips.has(ref) || !byId.has(e.to)) return;
|
|
1340
|
+
settle(
|
|
1341
|
+
s,
|
|
1342
|
+
k,
|
|
1343
|
+
() => {
|
|
1344
|
+
if (ref === HEAD) {
|
|
1345
|
+
attached = null;
|
|
1346
|
+
headAt = e.to;
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
tips.set(ref, e.to);
|
|
1350
|
+
if (attached === ref) headAt = e.to;
|
|
1351
|
+
else if (attached === null && headAt === e.to) attached = ref;
|
|
1352
|
+
},
|
|
1353
|
+
ref
|
|
1354
|
+
);
|
|
1355
|
+
} else return;
|
|
1356
|
+
prune(s, k);
|
|
1357
|
+
});
|
|
1358
|
+
for (const n of names) at2.get(n)?.push(n === HEAD ? headAt : tips.get(n) ?? null);
|
|
1359
|
+
heads.push(attached);
|
|
1360
|
+
for (const n of names) {
|
|
1361
|
+
const slot = shown.get(n);
|
|
1362
|
+
if (slot) tags.push({ ref: n, step: s, slot });
|
|
1363
|
+
}
|
|
1364
|
+
});
|
|
1365
|
+
function laneOf(id) {
|
|
1366
|
+
return byId.get(id)?.branch;
|
|
1367
|
+
}
|
|
1368
|
+
function commit(e, s, k) {
|
|
1369
|
+
if (byId.has(e.id)) return;
|
|
1370
|
+
const copy = e.copy !== void 0 && byId.has(e.copy) ? e.copy : void 0;
|
|
1371
|
+
const base = copy !== void 0 && attached === null && headAt !== null ? headAt : tips.get(e.branch) ?? null;
|
|
1372
|
+
const joined = e.merge !== void 0 && e.merge !== e.branch ? tips.get(e.merge) ?? void 0 : void 0;
|
|
1373
|
+
const parents = [...new Set([base, joined].filter((c2) => c2 !== null && c2 !== void 0))];
|
|
1374
|
+
const c = {
|
|
1375
|
+
id: e.id,
|
|
1376
|
+
branch: e.branch,
|
|
1377
|
+
parents,
|
|
1378
|
+
...joined !== void 0 && joined !== base ? { joined } : {},
|
|
1379
|
+
...copy !== void 0 ? { copy } : {},
|
|
1380
|
+
...e.hash !== void 0 ? { hash: e.hash } : {},
|
|
1381
|
+
...e.note !== void 0 ? { note: e.note } : {},
|
|
1382
|
+
step: s,
|
|
1383
|
+
event: k
|
|
1384
|
+
};
|
|
1385
|
+
made.push(c);
|
|
1386
|
+
byId.set(c.id, c);
|
|
1387
|
+
for (const p of parents) links.push({ kind: "parent", from: p, to: c.id, step: s, event: k });
|
|
1388
|
+
if (copy !== void 0) links.push({ kind: "copy", from: copy, to: c.id, step: s, event: k });
|
|
1389
|
+
const first = attached === null && headAt === null;
|
|
1390
|
+
settle(s, k, () => {
|
|
1391
|
+
if (copy === void 0) {
|
|
1392
|
+
tips.set(e.branch, c.id);
|
|
1393
|
+
if (attached === e.branch) headAt = c.id;
|
|
1394
|
+
} else if (attached === null) headAt = c.id;
|
|
1395
|
+
if (first) {
|
|
1396
|
+
attached = e.branch;
|
|
1397
|
+
headAt = c.id;
|
|
1398
|
+
}
|
|
1399
|
+
});
|
|
1400
|
+
}
|
|
1401
|
+
const refs = names.map((name) => ({ name, at: at2.get(name) ?? [], ...name === HEAD ? { attached: heads } : {} }));
|
|
1402
|
+
return { branches, made, links, moves, refs, tags, rows: most };
|
|
1403
|
+
}
|
|
1404
|
+
function cubic(p0, c1, c2, p3) {
|
|
1405
|
+
const n = LOOK.git.samples;
|
|
1406
|
+
return Array.from({ length: n }, (_, k) => {
|
|
1407
|
+
const t = (k + 1) / n;
|
|
1408
|
+
const u = 1 - t;
|
|
1409
|
+
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];
|
|
1410
|
+
return [at2(0), at2(1)];
|
|
1411
|
+
});
|
|
1412
|
+
}
|
|
1413
|
+
function elbow(from, to) {
|
|
1414
|
+
if (Math.abs(from[1] - to[1]) < 0.5) return [from, to];
|
|
1415
|
+
return from[1] > to[1] ? [from, [from[0], to[1]], to] : [from, [to[0], from[1]], to];
|
|
1416
|
+
}
|
|
1417
|
+
function fork(p, tx, ty) {
|
|
1418
|
+
const sign = ty > p.cy ? 1 : -1;
|
|
1419
|
+
const p0 = [p.cx, p.cy + sign * p.r];
|
|
1420
|
+
const turn = Math.max(0, Math.min(LOOK.git.turn, tx - p.cx));
|
|
1421
|
+
const p3 = [p.cx + turn, ty];
|
|
1422
|
+
const curve = cubic(p0, [p0[0], p0[1] + (ty - p0[1]) * 0.7], [p.cx + turn * 0.2, ty], p3);
|
|
1423
|
+
return [p0, ...curve, ...tx > p3[0] ? [[tx, ty]] : []];
|
|
1424
|
+
}
|
|
1425
|
+
function join(p, c) {
|
|
1426
|
+
const sign = c.cy < p.cy ? 1 : -1;
|
|
1427
|
+
const p0 = [p.cx + p.r, p.cy];
|
|
1428
|
+
const p3 = [c.cx, c.cy + sign * c.r];
|
|
1429
|
+
const turn = Math.max(0, Math.min(LOOK.git.turn, c.cx - p0[0]));
|
|
1430
|
+
const h = [c.cx - turn, p.cy];
|
|
1431
|
+
const curve = cubic(h, [c.cx - turn * 0.2, p.cy], [c.cx, p3[1] + (p.cy - p3[1]) * 0.7], p3);
|
|
1432
|
+
return [p0, ...h[0] > p0[0] ? [h] : [], ...curve];
|
|
1433
|
+
}
|
|
1434
|
+
function copyLine(p, c) {
|
|
1435
|
+
if (Math.abs(p.cy - c.cy) < 0.5) {
|
|
1436
|
+
const top = p.cy - p.r;
|
|
1437
|
+
const lift = LOOK.git.turn * 0.7;
|
|
1438
|
+
return [[p.cx, top], ...cubic([p.cx, top], [p.cx, top - lift], [c.cx, top - lift], [c.cx, top])];
|
|
1439
|
+
}
|
|
1440
|
+
const sign = c.cy < p.cy ? -1 : 1;
|
|
1441
|
+
const p0 = [p.cx, p.cy + sign * p.r];
|
|
1442
|
+
const p3 = [c.cx, c.cy - sign * c.r];
|
|
1443
|
+
const mid = (p3[1] - p0[1]) * 0.5;
|
|
1444
|
+
return [p0, ...cubic(p0, [p0[0], p0[1] + mid], [p3[0], p3[1] - mid], p3)];
|
|
1445
|
+
}
|
|
1446
|
+
function layoutGit(diagram) {
|
|
1447
|
+
const { margin, gap, box: B, region: R, git: G, carrier: C } = LOOK;
|
|
1448
|
+
const walked = walk(diagram);
|
|
1449
|
+
const notes = new Map((diagram.git?.branches ?? []).map((b) => [b.id, b.note]));
|
|
1450
|
+
const laneIndex = new Map(walked.branches.map((id, i) => [id, i]));
|
|
1451
|
+
const colorOf2 = (branch) => G.colors[(laneIndex.get(branch) ?? 0) % G.colors.length];
|
|
1452
|
+
const col = /* @__PURE__ */ new Map();
|
|
1453
|
+
const laneLast = /* @__PURE__ */ new Map();
|
|
1454
|
+
for (const c of walked.made) {
|
|
1455
|
+
const k = Math.max(0, ...c.parents.map((p) => (col.get(p) ?? -1) + 1), (laneLast.get(c.branch) ?? -1) + 1);
|
|
1456
|
+
col.set(c.id, k);
|
|
1457
|
+
laneLast.set(c.branch, k);
|
|
1458
|
+
}
|
|
1459
|
+
const linesOf = (c) => [
|
|
1460
|
+
...c.hash !== void 0 ? [{ text: c.hash, style: TYPE.gitHash }] : [],
|
|
1461
|
+
...c.note !== void 0 ? [{ text: c.note, style: TYPE.gitNote }] : []
|
|
1462
|
+
];
|
|
1463
|
+
const textW = (c) => Math.max(0, ...linesOf(c).map((line) => textWidth(line.text, line.style)));
|
|
1464
|
+
const tagW = (ref) => textWidth(ref, hasWide(ref) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
|
|
1465
|
+
const refWidth = Math.max(0, ...walked.refs.map((r) => tagW(r.name)));
|
|
1466
|
+
const pitch = Math.max(G.pitch, ...walked.made.map((c) => textW(c) + G.textGap), refWidth + G.textGap);
|
|
1467
|
+
const headers = walked.branches.map((id) => ({ w: Math.max(R.icon, textWidth(id, TYPE.regionName), textWidth(notes.get(id) ?? "", TYPE.regionNote)) }));
|
|
1468
|
+
const headerRight = margin + R.inset + Math.max(0, ...headers.map((h) => h.w));
|
|
1469
|
+
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);
|
|
1470
|
+
const x0 = Math.max(G.x0, headerRight + gap + firstHalf);
|
|
1471
|
+
const named = new Set(
|
|
1472
|
+
walked.moves.flatMap((mv) => {
|
|
1473
|
+
const source = diagram.steps[mv.step]?.events[mv.event];
|
|
1474
|
+
return mv.line && mv.to && source?.type === "edge" && source.label !== void 0 ? [walked.made.find((c) => c.id === mv.to?.commit)?.branch ?? ""] : [];
|
|
1475
|
+
})
|
|
1476
|
+
);
|
|
1477
|
+
const extraRows = (branch) => Math.max(0, ...walked.made.filter((c) => c.branch === branch).map((c) => (walked.rows.get(c.id) ?? 0) - 2)) * G.row;
|
|
1478
|
+
const topText = walked.made.some((c) => laneIndex.get(c.branch) === 0 && linesOf(c).length > 0);
|
|
1479
|
+
const lanes = [];
|
|
1480
|
+
let y = margin;
|
|
1481
|
+
walked.branches.forEach((id, i) => {
|
|
1482
|
+
const top = i === 0;
|
|
1483
|
+
const tagBase = top && topText ? G.tagTop : G.tag;
|
|
1484
|
+
const line = y + (top ? G.topLine - (G.tagTop - tagBase) : G.line) + extraRows(id);
|
|
1485
|
+
const h = line - y + (top ? G.topBelow : named.has(id) ? G.below : G.bare);
|
|
1486
|
+
lanes.push({ id, x: margin, y, w: 0, h, line, color: colorOf2(id), tagBase });
|
|
1487
|
+
y += h + R.gap;
|
|
1488
|
+
});
|
|
1489
|
+
const lanesBottom = y - R.gap;
|
|
1490
|
+
const laneOf = new Map(lanes.map((l) => [l.id, l]));
|
|
1491
|
+
const commits = walked.made.map((c) => {
|
|
1492
|
+
const lane = laneOf.get(c.branch);
|
|
1493
|
+
const isTop = laneIndex.get(c.branch) === 0;
|
|
1494
|
+
const cx = x0 + pitch * (col.get(c.id) ?? 0) + (isTop ? 0 : pitch / 2);
|
|
1495
|
+
const cy = lane.line;
|
|
1496
|
+
const lines = linesOf(c);
|
|
1497
|
+
const baselines = lines.map((_, k) => isTop ? cy - G.above - (lines.length - 1 - k) * G.lineStep : cy + G.under + k * G.lineStep);
|
|
1498
|
+
const boxes2 = lines.map((line, k) => textBox(line.text, cx, baselines[k], line.style, "middle"));
|
|
1499
|
+
const text2 = boxes2.length === 0 ? void 0 : { ...union(boxes2), lines: lines.map((line) => line.text), baselines };
|
|
1500
|
+
const color = c.copy !== void 0 ? colorOf2(walked.made.find((m) => m.id === c.copy)?.branch ?? c.branch) : colorOf2(c.branch);
|
|
1501
|
+
return {
|
|
1502
|
+
id: c.id,
|
|
1503
|
+
branch: c.branch,
|
|
1504
|
+
color,
|
|
1505
|
+
cx,
|
|
1506
|
+
cy,
|
|
1507
|
+
r: G.r,
|
|
1508
|
+
step: c.step,
|
|
1509
|
+
event: c.event,
|
|
1510
|
+
parents: c.parents,
|
|
1511
|
+
...c.copy !== void 0 ? { copy: c.copy } : {},
|
|
1512
|
+
...c.hash !== void 0 ? { hash: c.hash } : {},
|
|
1513
|
+
...c.note !== void 0 ? { note: c.note } : {},
|
|
1514
|
+
...text2 ? { text: text2 } : {},
|
|
1515
|
+
...c.orphan ? { orphan: c.orphan.step, orphanEvent: c.orphan.event } : {}
|
|
1516
|
+
};
|
|
1517
|
+
});
|
|
1518
|
+
const placed = new Map(commits.map((c) => [c.id, c]));
|
|
1519
|
+
const links = walked.links.flatMap((l) => {
|
|
1520
|
+
const from = placed.get(l.from);
|
|
1521
|
+
if (!from) return [];
|
|
1522
|
+
if (l.kind === "branch") {
|
|
1523
|
+
if (!walked.made.some((c) => c.branch === l.to)) return [];
|
|
1524
|
+
const lane = laneOf.get(l.to);
|
|
1525
|
+
return [{ ...l, points: fork(from, from.cx + G.turn, lane.line), color: colorOf2(l.to) }];
|
|
1526
|
+
}
|
|
1527
|
+
const to = placed.get(l.to);
|
|
1528
|
+
const made = walked.made.find((m) => m.id === l.to);
|
|
1529
|
+
let points;
|
|
1530
|
+
if (l.kind === "copy") points = copyLine(from, to);
|
|
1531
|
+
else if (Math.abs(from.cy - to.cy) < 0.5) points = [[from.cx + from.r, from.cy], [to.cx - to.r, to.cy]];
|
|
1532
|
+
else if (made?.joined === l.from) points = join(from, to);
|
|
1533
|
+
else points = fork(from, to.cx - to.r, to.cy);
|
|
1534
|
+
return [{ ...l, points, color: to.color }];
|
|
1535
|
+
});
|
|
1536
|
+
const tagRect = (ref, slot) => {
|
|
1537
|
+
const c = placed.get(slot.commit);
|
|
1538
|
+
const base = laneOf.get(c.branch)?.tagBase ?? G.tag;
|
|
1539
|
+
const w = tagW(ref);
|
|
1540
|
+
return { x: c.cx - w / 2, y: c.cy - base - slot.row * G.row - C.tagH / 2, w, h: C.tagH };
|
|
1541
|
+
};
|
|
1542
|
+
const center2 = (r) => [r.x + r.w / 2, r.y + r.h / 2];
|
|
1543
|
+
const moves = walked.moves.map((m) => {
|
|
1544
|
+
const from = m.from ? tagRect(m.ref, m.from) : void 0;
|
|
1545
|
+
const to = m.to ? tagRect(m.ref, m.to) : void 0;
|
|
1546
|
+
const source = diagram.steps[m.step]?.events[m.event];
|
|
1547
|
+
const carried = m.line && source?.type === "edge" && source.carry.kind !== "none" && !(source.carry.kind === "tag" && source.carry.text === source.from);
|
|
1548
|
+
return {
|
|
1549
|
+
ref: m.ref,
|
|
1550
|
+
step: m.step,
|
|
1551
|
+
event: m.event,
|
|
1552
|
+
...from ? { from } : {},
|
|
1553
|
+
...to ? { to } : {},
|
|
1554
|
+
...m.to ? { target: m.to.commit } : {},
|
|
1555
|
+
...carried ? { carried: true } : {},
|
|
1556
|
+
...m.line && from && to ? { line: elbow(center2(from), center2(to)) } : {},
|
|
1557
|
+
color: "slate"
|
|
1558
|
+
};
|
|
1559
|
+
});
|
|
1560
|
+
const tags = walked.tags.map((t) => ({ ...tagRect(t.ref, t.slot), ref: t.ref, step: t.step }));
|
|
1561
|
+
const colors = boxColors(diagram);
|
|
1562
|
+
const right = Math.max(
|
|
1563
|
+
x0,
|
|
1564
|
+
...commits.flatMap((c) => [c.cx + c.r, ...c.text ? [c.text.x + c.text.w] : []]),
|
|
1565
|
+
...tags.map((t) => t.x + t.w),
|
|
1566
|
+
...moves.flatMap((m) => [m.from, m.to].flatMap((r) => r ? [r.x + r.w] : []))
|
|
1567
|
+
);
|
|
1568
|
+
const boxX = right + G.boxGap;
|
|
1569
|
+
const firstCy = (lanes[1] ?? lanes[0])?.line ?? margin + B.h / 2;
|
|
1570
|
+
const boxes = diagram.boxes.map((b, i) => {
|
|
1571
|
+
const w = boxWidth(diagram, b.id, true);
|
|
1572
|
+
const cy = firstCy + i * (B.h + gap);
|
|
1573
|
+
return {
|
|
1574
|
+
id: b.id,
|
|
1575
|
+
name: b.name,
|
|
1576
|
+
...b.sub !== void 0 ? { sub: b.sub } : {},
|
|
1577
|
+
...b.icon !== void 0 ? { icon: b.icon } : {},
|
|
1578
|
+
color: colors.get(b.id) ?? "slate",
|
|
1579
|
+
x: boxX,
|
|
1580
|
+
y: cy - B.h / 2,
|
|
1581
|
+
w,
|
|
1582
|
+
h: B.h,
|
|
1583
|
+
cx: boxX + w / 2,
|
|
1584
|
+
cy
|
|
1585
|
+
};
|
|
1586
|
+
});
|
|
1587
|
+
const regions = lanes.map((lane, i) => {
|
|
1588
|
+
const note = notes.get(lane.id);
|
|
1589
|
+
return {
|
|
1590
|
+
id: lane.id,
|
|
1591
|
+
lines: [lane.id],
|
|
1592
|
+
...note !== void 0 ? { note } : {},
|
|
1593
|
+
icon: "branch",
|
|
1594
|
+
color: lane.color,
|
|
1595
|
+
x: lane.x,
|
|
1596
|
+
y: lane.y,
|
|
1597
|
+
w: 0,
|
|
1598
|
+
h: lane.h,
|
|
1599
|
+
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 }
|
|
1600
|
+
};
|
|
1601
|
+
});
|
|
1602
|
+
const layout = {
|
|
1603
|
+
kind: "git",
|
|
1604
|
+
width: 0,
|
|
1605
|
+
height: 0,
|
|
1606
|
+
regions,
|
|
1607
|
+
boxes,
|
|
1608
|
+
lifelines: [],
|
|
1609
|
+
edges: [],
|
|
1610
|
+
labels: [],
|
|
1611
|
+
actions: [],
|
|
1612
|
+
badges: [],
|
|
1613
|
+
paths: [],
|
|
1614
|
+
ends: [],
|
|
1615
|
+
lanes,
|
|
1616
|
+
commits,
|
|
1617
|
+
links,
|
|
1618
|
+
tags,
|
|
1619
|
+
refs: walked.refs,
|
|
1620
|
+
moves
|
|
1621
|
+
};
|
|
1622
|
+
layout.badges = badgesOf(diagram, layout);
|
|
1623
|
+
layout.labels = labelsOf(diagram, layout);
|
|
1624
|
+
const contentRight = Math.max(right, ...boxes.map((b) => b.x + b.w), ...layout.labels.map((l) => l.x + l.w)) + R.pad;
|
|
1625
|
+
const width = Math.max(contentRight + margin, stripNeed(diagram) + margin * 2);
|
|
1626
|
+
for (const region of regions) region.w = width - margin * 2;
|
|
1627
|
+
for (const lane of lanes) lane.w = width - margin * 2;
|
|
1628
|
+
const bottom = Math.max(lanesBottom, ...boxes.map((b) => b.y + b.h), ...layout.labels.map((l) => l.y + l.h));
|
|
1629
|
+
const strip2 = layoutStrip(diagram, margin, bottom + gap, width - margin * 2);
|
|
1630
|
+
layout.width = width;
|
|
1631
|
+
layout.height = (strip2 ? strip2.y + strip2.h : bottom) + margin;
|
|
1632
|
+
if (strip2) layout.strip = strip2;
|
|
1633
|
+
layout.badges = badgesOf(diagram, layout);
|
|
1634
|
+
return layout;
|
|
1635
|
+
}
|
|
1636
|
+
function union(rects) {
|
|
1637
|
+
const x = Math.min(...rects.map((r) => r.x));
|
|
1638
|
+
const y = Math.min(...rects.map((r) => r.y));
|
|
1639
|
+
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 };
|
|
1640
|
+
}
|
|
1641
|
+
function firstMark(layout, step) {
|
|
1642
|
+
const marks = [
|
|
1643
|
+
...layout.links.filter((l) => l.step === step && l.kind !== "copy").map((l) => ({ event: l.event, points: l.points, color: l.color })),
|
|
1644
|
+
...layout.moves.flatMap((m) => {
|
|
1645
|
+
const target = layout.commits.find((c) => c.id === m.target);
|
|
1646
|
+
return m.step === step && m.line && target ? [{ event: m.event, target, color: target.color }] : [];
|
|
1647
|
+
})
|
|
1648
|
+
].sort((a, b) => a.event - b.event);
|
|
1649
|
+
return marks[0];
|
|
1650
|
+
}
|
|
1651
|
+
function besideCommit(c, taken, avoid) {
|
|
1652
|
+
const { r, inset } = LOOK.badge;
|
|
1653
|
+
const d = c.r + inset + r;
|
|
1654
|
+
const apart = r * 2 + inset;
|
|
1655
|
+
const spots = [
|
|
1656
|
+
[c.cx + d, c.cy],
|
|
1657
|
+
[c.cx, c.cy + d],
|
|
1658
|
+
[c.cx - d, c.cy],
|
|
1659
|
+
[c.cx, c.cy - d]
|
|
1660
|
+
];
|
|
1661
|
+
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));
|
|
1662
|
+
}
|
|
1663
|
+
function clearOnPath(points, taken, avoid) {
|
|
1664
|
+
const { r, inset, along: start, short } = LOOK.badge;
|
|
1665
|
+
const length = pathLength(points);
|
|
1666
|
+
const first = length < short ? Math.min(r + 1, length / 2) : start;
|
|
1667
|
+
const apart = r * 2 + inset;
|
|
1668
|
+
for (let d = first; d <= length; d += 1) {
|
|
1669
|
+
const p = along(points, d);
|
|
1670
|
+
const rect = badgeRect(p);
|
|
1671
|
+
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;
|
|
1672
|
+
}
|
|
1673
|
+
return void 0;
|
|
1674
|
+
}
|
|
1675
|
+
function badgesOf(diagram, layout) {
|
|
1676
|
+
const { inset } = LOOK.badge;
|
|
1677
|
+
const taken = [];
|
|
1678
|
+
const all = [...layout.links.map((l) => l.points), ...layout.moves.flatMap((m) => m.line ? [m.line] : [])];
|
|
1679
|
+
const out = [];
|
|
1680
|
+
const avoid = [
|
|
1681
|
+
...layout.tags,
|
|
1682
|
+
...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] : []])
|
|
1683
|
+
];
|
|
1684
|
+
diagram.steps.forEach((step, s) => {
|
|
1685
|
+
const mark = firstMark(layout, s);
|
|
1686
|
+
const near = mark?.target ? besideCommit(mark.target, taken, avoid) : void 0;
|
|
1687
|
+
if (mark && (mark.points || near)) {
|
|
1688
|
+
const points = mark.points;
|
|
1689
|
+
const point = near ?? (points ? clearOnPath(points, taken, avoid) ?? badgeOnPath(points, taken, all.filter((p) => p !== points)) : [0, 0]);
|
|
1690
|
+
taken.push(point);
|
|
1691
|
+
out.push({ step: s, x: point[0], y: point[1], color: mark.color });
|
|
1692
|
+
return;
|
|
1693
|
+
}
|
|
1694
|
+
const box = step.events.flatMap((e) => e.type === "swap" || e.type === "action" ? [e.box] : []).map((id) => layout.boxes.find((b) => b.id === id))[0];
|
|
1695
|
+
if (box) {
|
|
1696
|
+
out.push({ step: s, x: box.x, y: box.y, color: box.color });
|
|
1697
|
+
return;
|
|
1698
|
+
}
|
|
1699
|
+
if (layout.strip && step.events.some((e) => e.type === "strip")) {
|
|
1700
|
+
out.push({ step: s, x: layout.strip.x + inset, y: layout.strip.y + inset, color: "slate" });
|
|
1701
|
+
return;
|
|
1702
|
+
}
|
|
1703
|
+
const tip = layout.commits.find((c) => c.id === layout.refs[0]?.at[s]);
|
|
1704
|
+
const spot = tip ? besideCommit(tip, taken, avoid) : void 0;
|
|
1705
|
+
if (tip && spot) {
|
|
1706
|
+
taken.push(spot);
|
|
1707
|
+
out.push({ step: s, x: spot[0], y: spot[1], color: tip.color });
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
const before = out[out.length - 1];
|
|
1711
|
+
const lane = layout.lanes[0];
|
|
1712
|
+
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" });
|
|
1713
|
+
});
|
|
1714
|
+
return replaceSameSpot(out);
|
|
1715
|
+
}
|
|
1716
|
+
function labelsOf(diagram, layout) {
|
|
1717
|
+
const G = LOOK.git;
|
|
1718
|
+
const labels = [];
|
|
1719
|
+
const circles = layout.commits.map((c) => ({ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }));
|
|
1720
|
+
const texts = layout.commits.flatMap((c) => c.text ? [c.text] : []);
|
|
1721
|
+
const headers = layout.regions.map((r) => r.header);
|
|
1722
|
+
for (const move of layout.moves) {
|
|
1723
|
+
const source = diagram.steps[move.step]?.events[move.event];
|
|
1724
|
+
if (source?.type !== "edge" || source.label === void 0 || !move.line) continue;
|
|
1725
|
+
const target = layout.commits.find((c) => c.id === source.to);
|
|
1726
|
+
if (!target) continue;
|
|
1727
|
+
const top = layout.lanes[0]?.id === target.branch;
|
|
1728
|
+
const w = textWidth(source.label, hasWide(source.label) ? TYPE.labelJa : TYPE.label) + LOOK.label.padX * 2;
|
|
1729
|
+
const [mx] = move.line.reduce((sum, p) => [sum[0] + p[0] / move.line.length, 0], [0, 0]);
|
|
1730
|
+
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));
|
|
1731
|
+
const side2 = source.labelSide ?? (top ? "above" : "below");
|
|
1732
|
+
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 };
|
|
1733
|
+
const seen = layout.badges.filter((b) => b.step <= move.step).map((b) => badgeRect([b.x, b.y]));
|
|
1734
|
+
const tags = layout.tags.filter((t) => t.step === move.step);
|
|
1735
|
+
labels.push(
|
|
1736
|
+
placeLabel(
|
|
1737
|
+
{ step: move.step, event: move.event, text: source.label, points: move.line, color: move.color, side: side2, ...base ? { base } : {} },
|
|
1738
|
+
{ hard: [...circles, ...layout.boxes], soft: [...texts, ...tags, ...headers, ...labels.filter((l) => l.step === move.step)], touch: seen }
|
|
1739
|
+
)
|
|
1740
|
+
);
|
|
1741
|
+
}
|
|
1742
|
+
return labels;
|
|
1743
|
+
}
|
|
1744
|
+
|
|
934
1745
|
// src/layout/sequence.ts
|
|
935
1746
|
function layoutSequence(diagram) {
|
|
936
1747
|
const { box: B, sequence: Q, label: L, margin, gap } = LOOK;
|
|
@@ -998,8 +1809,8 @@ function layoutSequence(diagram) {
|
|
|
998
1809
|
const side2 = event.labelSide ?? "above";
|
|
999
1810
|
const self = event.from === event.to;
|
|
1000
1811
|
const named = event.label !== void 0;
|
|
1001
|
-
above = named && side2 === "above" ?
|
|
1002
|
-
under = self ? Q.selfH + gap : named && side2 === "below" ?
|
|
1812
|
+
above = named && side2 === "above" ? Q.labelOffset + L.h / 2 : gap;
|
|
1813
|
+
under = self ? Q.selfH + gap : named && side2 === "below" ? Q.labelOffset + L.h / 2 : gap;
|
|
1003
1814
|
} else {
|
|
1004
1815
|
above = LOOK.action.h / 2;
|
|
1005
1816
|
under = LOOK.action.h / 2;
|
|
@@ -1021,7 +1832,17 @@ function layoutSequence(diagram) {
|
|
|
1021
1832
|
[xt - dir * LOOK.edge.inset, y]
|
|
1022
1833
|
];
|
|
1023
1834
|
const color = edgeColor(event, colors);
|
|
1024
|
-
|
|
1835
|
+
const seats = {};
|
|
1836
|
+
if (event.carry.kind !== "none") {
|
|
1837
|
+
const reach = LOOK.slot.lifeline + carrierHalf(event.carry)[0];
|
|
1838
|
+
const [p0, p1] = points;
|
|
1839
|
+
const [q0, q1] = points.slice(-2);
|
|
1840
|
+
const out = Math.sign(p1[0] - p0[0]) || 1;
|
|
1841
|
+
const into = Math.sign(q1[0] - q0[0]) || -1;
|
|
1842
|
+
seats.wait = [xf - out * reach, p0[1]];
|
|
1843
|
+
seats.settle = [xt + into * reach, q1[1]];
|
|
1844
|
+
}
|
|
1845
|
+
edges.push({ step: s, event: e, from: event.from, to: event.to, points, color, carry: event.carry, ...seats });
|
|
1025
1846
|
if (event.label !== void 0) {
|
|
1026
1847
|
requests.push({
|
|
1027
1848
|
step: s,
|
|
@@ -1029,7 +1850,8 @@ function layoutSequence(diagram) {
|
|
|
1029
1850
|
text: event.label,
|
|
1030
1851
|
points,
|
|
1031
1852
|
color,
|
|
1032
|
-
...event.labelSide ? { side: event.labelSide } : xf === xt ? { side: "right" } : {}
|
|
1853
|
+
...event.labelSide ? { side: event.labelSide } : xf === xt ? { side: "right" } : {},
|
|
1854
|
+
offset: Q.labelOffset
|
|
1033
1855
|
});
|
|
1034
1856
|
}
|
|
1035
1857
|
} else {
|
|
@@ -1041,10 +1863,12 @@ function layoutSequence(diagram) {
|
|
|
1041
1863
|
});
|
|
1042
1864
|
const bottom = (first ? headBottom : y + below) + Q.tail;
|
|
1043
1865
|
const lifelines = order.map((id, i) => ({ id, x: xs[i], y1: headBottom, y2: bottom }));
|
|
1866
|
+
const early = lineBadges(edges, diagram.steps.length);
|
|
1044
1867
|
const labels = [];
|
|
1045
1868
|
for (const request of requests) {
|
|
1869
|
+
const seen = [...early].filter(([s]) => s <= request.step).map(([, b]) => badgeRect(b.point));
|
|
1046
1870
|
const soft = [...labels.filter((l) => l.step === request.step), ...actions];
|
|
1047
|
-
labels.push(placeLabel(request, { hard: boxes, soft }));
|
|
1871
|
+
labels.push(placeLabel(request, { hard: boxes, soft, touch: seen }));
|
|
1048
1872
|
}
|
|
1049
1873
|
const layout = { kind: "sequence", width: 0, height: 0, regions: [], boxes, lifelines, edges, labels, actions, badges: [], paths: [], ends: [] };
|
|
1050
1874
|
const lefts = [...boxes.map((b) => b.x), ...labels.map((l) => l.x), ...actions.map((a) => a.x)];
|
|
@@ -1060,44 +1884,18 @@ function layoutSequence(diagram) {
|
|
|
1060
1884
|
return layout;
|
|
1061
1885
|
}
|
|
1062
1886
|
function badges(diagram, layout) {
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
return { step: s, x, y, color: edge2.color };
|
|
1068
|
-
}
|
|
1887
|
+
const lines = lineBadges(layout.edges, diagram.steps.length);
|
|
1888
|
+
const placed = diagram.steps.map((step, s) => {
|
|
1889
|
+
const line = lines.get(s);
|
|
1890
|
+
if (line) return { step: s, x: line.point[0], y: line.point[1], color: line.edge.color };
|
|
1069
1891
|
const action2 = layout.actions.find((a) => a.step === s);
|
|
1070
1892
|
const lifeline2 = action2 && layout.lifelines.find((l) => l.id === action2.box);
|
|
1071
1893
|
if (action2 && lifeline2) return { step: s, x: lifeline2.x, y: action2.y + action2.h / 2, color: action2.color };
|
|
1072
1894
|
return cornerBadge(step.events, s, layout);
|
|
1073
1895
|
});
|
|
1896
|
+
return replaceSameSpot(placed);
|
|
1074
1897
|
}
|
|
1075
1898
|
|
|
1076
|
-
// src/words.ts
|
|
1077
|
-
var keys = (table) => Object.keys(table);
|
|
1078
|
-
var KINDS = keys({ sequence: true, architecture: true, state: true });
|
|
1079
|
-
var STATE_ENDS = ["start", "finish"];
|
|
1080
|
-
var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set"];
|
|
1081
|
-
var AS = "as";
|
|
1082
|
-
var ATTRS = {
|
|
1083
|
-
diagram: ["view"],
|
|
1084
|
-
group: ["note", "color", "icon"],
|
|
1085
|
-
box: ["note", "color", "icon"],
|
|
1086
|
-
edge: ["carry", "tag", "side"],
|
|
1087
|
-
set: ["tag"]
|
|
1088
|
-
};
|
|
1089
|
-
var CARRIES = keys({ coin: true, none: true });
|
|
1090
|
-
var VIEWS = keys({ fixed: true, follow: true });
|
|
1091
|
-
var SIDES = keys({ above: true, below: true, left: true, right: true });
|
|
1092
|
-
var OLD_HEADS = {
|
|
1093
|
-
\u6642\u7CFB\u5217\u56F3: "sequence",
|
|
1094
|
-
\u69CB\u6210\u56F3: "architecture",
|
|
1095
|
-
\u533A\u753B: "group",
|
|
1096
|
-
\u898B\u305B\u65B9: "view",
|
|
1097
|
-
region: "group",
|
|
1098
|
-
view: "view"
|
|
1099
|
-
};
|
|
1100
|
-
|
|
1101
1899
|
// src/layout/state.ts
|
|
1102
1900
|
var isEnd = (id) => STATE_ENDS.includes(id);
|
|
1103
1901
|
function visitOrder(diagram) {
|
|
@@ -1111,12 +1909,6 @@ function visitOrder(diagram) {
|
|
|
1111
1909
|
}
|
|
1112
1910
|
return order;
|
|
1113
1911
|
}
|
|
1114
|
-
function carrierHalf(carry) {
|
|
1115
|
-
const C = LOOK.carrier;
|
|
1116
|
-
if (carry.kind === "tag") return (textWidth(carry.text, hasWide(carry.text) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2) / 2;
|
|
1117
|
-
if (carry.kind === "coin") return C.coinR;
|
|
1118
|
-
return C.envW / 2;
|
|
1119
|
-
}
|
|
1120
1912
|
var same = (a, b) => a.from === b.from && a.to === b.to;
|
|
1121
1913
|
function layoutState(diagram, lang) {
|
|
1122
1914
|
const { box: B, state: T, margin, gap } = LOOK;
|
|
@@ -1133,7 +1925,11 @@ function layoutState(diagram, lang) {
|
|
|
1133
1925
|
const source = diagram.boxes.find((b) => b.id === id);
|
|
1134
1926
|
return G.pad * 2 + B.icon + G.gap + Math.max(textWidth(source?.name ?? id, TYPE.boxName), textWidth(source?.sub ?? "", TYPE.boxSub));
|
|
1135
1927
|
};
|
|
1136
|
-
const
|
|
1928
|
+
const carriedIn = slotRooms(diagram);
|
|
1929
|
+
const doneSide = Math.max(B.padX, T.done.inset + T.done.r + LOOK.slot.clear);
|
|
1930
|
+
const widths = new Map(
|
|
1931
|
+
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))])
|
|
1932
|
+
);
|
|
1137
1933
|
const columnCount = Math.max(1, Math.min(T.columns, walked.length));
|
|
1138
1934
|
const rowCount = Math.max(1, Math.ceil(walked.length / T.columns));
|
|
1139
1935
|
const slot = new Map(
|
|
@@ -1154,7 +1950,7 @@ function layoutState(diagram, lang) {
|
|
|
1154
1950
|
}
|
|
1155
1951
|
const colLeft = [];
|
|
1156
1952
|
for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
|
|
1157
|
-
const
|
|
1953
|
+
const center2 = (c) => colLeft[c] + colW[c] / 2;
|
|
1158
1954
|
const isGhost = (id) => ghosts.includes(id);
|
|
1159
1955
|
const enteringFrom = new Set(notTaken.filter((p) => isGhost(p.to) && !isGhost(p.from) && !isEnd(p.from)).map((p) => p.from));
|
|
1160
1956
|
const notes = [words.sideNote, ...enteringFrom.size > 0 ? [words.sideFrom(enteringFrom.size)] : []];
|
|
@@ -1184,8 +1980,9 @@ function layoutState(diagram, lang) {
|
|
|
1184
1980
|
};
|
|
1185
1981
|
const boxes = walked.map((id) => {
|
|
1186
1982
|
const s = slot.get(id);
|
|
1187
|
-
return boxOf(id,
|
|
1983
|
+
return boxOf(id, center2(s.col), rowY(s.row), false);
|
|
1188
1984
|
});
|
|
1985
|
+
for (const box of boxes) placeSlot(box, carriedIn.get(box.id), doneSide);
|
|
1189
1986
|
const byId = new Map(boxes.map((b) => [b.id, b]));
|
|
1190
1987
|
const below = (box) => boxes.some((other) => other !== box && Math.abs(other.cx - box.cx) < 0.5 && other.y > box.y);
|
|
1191
1988
|
const ends = [];
|
|
@@ -1256,20 +2053,6 @@ function layoutState(diagram, lang) {
|
|
|
1256
2053
|
};
|
|
1257
2054
|
const exitX = (box) => starts && box === first ? box.cx + T.side.entry : box.cx;
|
|
1258
2055
|
const finishOf = (id) => ends.find((e) => e.kind === "finish" && e.box === id);
|
|
1259
|
-
const loopOf = (box) => {
|
|
1260
|
-
const { w, h, samples } = T.loop;
|
|
1261
|
-
const bottom2 = box.y + box.h;
|
|
1262
|
-
const p0 = [box.cx + w / 2, bottom2];
|
|
1263
|
-
const c1 = [box.cx + w * 3 / 4, bottom2 + h * 4 / 3];
|
|
1264
|
-
const c2 = [box.cx - w * 3 / 4, bottom2 + h * 4 / 3];
|
|
1265
|
-
const p3 = [box.cx - w / 2, bottom2 + inset];
|
|
1266
|
-
return Array.from({ length: samples + 1 }, (_, k) => {
|
|
1267
|
-
const t = k / samples;
|
|
1268
|
-
const u = 1 - t;
|
|
1269
|
-
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];
|
|
1270
|
-
return [at2(0), at2(1)];
|
|
1271
|
-
});
|
|
1272
|
-
};
|
|
1273
2056
|
const route = (from, to) => {
|
|
1274
2057
|
if (from === "start") {
|
|
1275
2058
|
const start = ends.find((e) => e.kind === "start");
|
|
@@ -1286,7 +2069,7 @@ function layoutState(diagram, lang) {
|
|
|
1286
2069
|
}
|
|
1287
2070
|
const b = byId.get(to);
|
|
1288
2071
|
if (!b) return [];
|
|
1289
|
-
if (from === to) return
|
|
2072
|
+
if (from === to) return loopUnder(a);
|
|
1290
2073
|
if (b.ghost && !a.ghost) {
|
|
1291
2074
|
const sx = exitX(a);
|
|
1292
2075
|
const ex = entryOf(from, b);
|
|
@@ -1297,15 +2080,18 @@ function layoutState(diagram, lang) {
|
|
|
1297
2080
|
return between2(a, b);
|
|
1298
2081
|
};
|
|
1299
2082
|
const settleOf = (edge2) => {
|
|
1300
|
-
const target = byId.get(edge2.to);
|
|
1301
|
-
if (target) return [target.cx, target.cy + B.iconY];
|
|
1302
2083
|
const end = edge2.to === "finish" ? finishOf(edge2.from) : void 0;
|
|
1303
2084
|
if (!end) return void 0;
|
|
1304
2085
|
const from = byId.get(edge2.from);
|
|
1305
|
-
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];
|
|
2086
|
+
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];
|
|
2087
|
+
};
|
|
2088
|
+
const waitOf = (edge2) => {
|
|
2089
|
+
const start = edge2.from === "start" ? ends.find((e) => e.kind === "start") : void 0;
|
|
2090
|
+
return start ? [start.x - start.r - LOOK.slot.mark - carrierHalf(edge2.carry)[0], start.y] : void 0;
|
|
1306
2091
|
};
|
|
1307
2092
|
const sceneEdges = steps.map(({ step, event, edge: edge2 }) => {
|
|
1308
2093
|
const settle = settleOf(edge2);
|
|
2094
|
+
const wait = edge2.carry.kind === "none" ? void 0 : waitOf(edge2);
|
|
1309
2095
|
return {
|
|
1310
2096
|
step,
|
|
1311
2097
|
event,
|
|
@@ -1314,49 +2100,67 @@ function layoutState(diagram, lang) {
|
|
|
1314
2100
|
points: route(edge2.from, edge2.to),
|
|
1315
2101
|
color: colorOf(edge2, colors),
|
|
1316
2102
|
carry: edge2.carry,
|
|
1317
|
-
...settle ? { settle } : {}
|
|
2103
|
+
...settle ? { settle } : {},
|
|
2104
|
+
...wait ? { wait } : {}
|
|
1318
2105
|
};
|
|
1319
2106
|
});
|
|
2107
|
+
seatCarriers(sceneEdges, byId, carriedIn);
|
|
2108
|
+
const outward = /* @__PURE__ */ new Map();
|
|
1320
2109
|
for (const e of sceneEdges) {
|
|
1321
2110
|
if (e.points.length !== 2 || !sceneEdges.some((o) => o.from === e.to && o.to === e.from && o.points.length === 2)) continue;
|
|
1322
2111
|
const [p, q] = e.points;
|
|
1323
2112
|
const flat = Math.abs(q[1] - p[1]) < Math.abs(q[0] - p[0]);
|
|
1324
2113
|
const d = (e.from < e.to ? 1 : -1) * LOOK.edge.parallel;
|
|
1325
2114
|
e.points = e.points.map(([x, y]) => flat ? [x, y + d] : [x + d, y]);
|
|
2115
|
+
outward.set(e, flat ? d > 0 ? "below" : "above" : d > 0 ? "right" : "left");
|
|
1326
2116
|
}
|
|
1327
2117
|
const paths = notTaken.map((p) => ({ from: p.from, to: p.to, points: route(p.from, p.to) }));
|
|
2118
|
+
const badgeAt = (edge2, taken, lines2) => edge2.from === edge2.to ? loopBadge(edge2.points) : badgeOnPath(edge2.points, taken, lines2);
|
|
1328
2119
|
const labels = [];
|
|
1329
|
-
const
|
|
2120
|
+
const marks = ends.flatMap((e) => e.text === "" ? [] : [textBox(e.text, ...markText(e), TYPE.regionNote)]);
|
|
2121
|
+
const badgeRects = [...lineBadges(sceneEdges, diagram.steps.length, badgeAt).values()].map((b) => badgeRect(b.point));
|
|
2122
|
+
const soft = [...side2 ? [{ x: side2.x, y: side2.y, w: T.side.pad + titleW, h: side2.h }] : [], ...marks];
|
|
2123
|
+
const others = (own) => [...sceneEdges.map((o) => o.points), ...paths.map((o) => o.points)].filter((line) => line !== own);
|
|
1330
2124
|
for (const e of sceneEdges) {
|
|
1331
2125
|
const source = diagram.steps[e.step]?.events[e.event];
|
|
1332
2126
|
if (source?.type !== "edge" || source.label === void 0) continue;
|
|
1333
|
-
const
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
2127
|
+
const loop = e.from === e.to;
|
|
2128
|
+
const key = lineKey(e);
|
|
2129
|
+
const named = labels.filter((l) => l.text === source.label && sceneEdges.some((o) => o.step === l.step && o.event === l.event && lineKey(o) === key));
|
|
2130
|
+
const same2 = named[named.length - 1];
|
|
2131
|
+
if (same2) {
|
|
2132
|
+
same2.until = e.step;
|
|
2133
|
+
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 });
|
|
1338
2134
|
continue;
|
|
1339
2135
|
}
|
|
1340
|
-
const
|
|
2136
|
+
const w = textWidth(source.label, labelStyle(source.label)) + LOOK.label.padX * 2;
|
|
2137
|
+
const below2 = loop ? { side: "below", base: loopLabelBase(e.points, w) } : {};
|
|
2138
|
+
const side22 = source.labelSide ?? (e.to === "finish" ? "left" : outward.get(e));
|
|
1341
2139
|
labels.push(
|
|
1342
2140
|
placeLabel(
|
|
1343
|
-
{ step: e.step, event: e.event, text: source.label, points: e.points, color: e.color, ...side22 ? { side: side22 } : {} },
|
|
1344
|
-
{ hard: boxes, soft: [...soft, ...labels
|
|
2141
|
+
{ step: e.step, event: e.event, text: source.label, points: e.points, color: e.color, ...side22 ? { side: side22 } : loop ? {} : { flip: true }, ...below2 },
|
|
2142
|
+
{ hard: boxes, soft: [...soft, ...labels], touch: badgeRects, lines: others(e.points) }
|
|
1345
2143
|
)
|
|
1346
2144
|
);
|
|
1347
2145
|
}
|
|
2146
|
+
const placed = [];
|
|
1348
2147
|
notTaken.forEach((p, i) => {
|
|
1349
2148
|
const path2 = paths[i];
|
|
1350
2149
|
if (p.label === void 0 || path2.points.length === 0) return;
|
|
1351
2150
|
const style = labelStyle(p.label);
|
|
1352
2151
|
const into = byId.get(p.to)?.ghost === true && byId.get(p.from)?.ghost !== true;
|
|
1353
|
-
const
|
|
2152
|
+
const x0 = path2.points[0][0];
|
|
2153
|
+
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))) } : {};
|
|
2154
|
+
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) });
|
|
2155
|
+
placed.push(rect);
|
|
1354
2156
|
path2.label = { x: rect.x, y: rect.y, w: rect.w, h: rect.h, text: p.label, family: style.family };
|
|
1355
2157
|
});
|
|
1356
2158
|
const layout = { kind: "state", width: 0, height: 0, regions: [], boxes, lifelines: [], edges: sceneEdges, labels, actions: [], badges: [], paths, ends, ...side2 ? { side: side2 } : {} };
|
|
1357
2159
|
const lefts = [...boxes.map((b) => b.x), ...labels.map((l) => l.x), ...paths.flatMap((p) => p.label ? [p.label.x] : [])];
|
|
2160
|
+
const tops = [...labels.map((l) => l.y), ...paths.flatMap((p) => p.label ? [p.label.y] : [])];
|
|
1358
2161
|
const shift = Math.max(0, margin - Math.min(...lefts));
|
|
1359
|
-
|
|
2162
|
+
const drop = tops.length > 0 ? Math.max(0, margin - Math.min(...tops)) : 0;
|
|
2163
|
+
if (shift > 0 || drop > 0) shiftContent(layout, shift, drop);
|
|
1360
2164
|
const endRight = (e) => e.x + (e.text === "" ? e.r : T.text + textWidth(e.text, TYPE.regionNote));
|
|
1361
2165
|
const rights = [
|
|
1362
2166
|
...boxes.map((b) => b.x + b.w),
|
|
@@ -1374,18 +2178,14 @@ function layoutState(diagram, lang) {
|
|
|
1374
2178
|
layout.width = width;
|
|
1375
2179
|
layout.height = (strip2 ? strip2.y + strip2.h : bottom) + margin;
|
|
1376
2180
|
if (strip2) layout.strip = strip2;
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
}
|
|
1386
|
-
const [x, y] = badgeOnPath(edge2.points);
|
|
1387
|
-
return { step: s, x, y, color: edge2.color };
|
|
1388
|
-
});
|
|
2181
|
+
const placedBadges = lineBadges(sceneEdges, diagram.steps.length, badgeAt);
|
|
2182
|
+
layout.badges = replaceSameSpot(
|
|
2183
|
+
diagram.steps.map((step, s) => {
|
|
2184
|
+
const line = placedBadges.get(s);
|
|
2185
|
+
if (!line) return cornerBadge(step.events, s, layout);
|
|
2186
|
+
return { step: s, x: line.point[0], y: line.point[1], color: line.edge.color };
|
|
2187
|
+
})
|
|
2188
|
+
);
|
|
1389
2189
|
return layout;
|
|
1390
2190
|
}
|
|
1391
2191
|
function colorOf(edge2, colors) {
|
|
@@ -1425,6 +2225,8 @@ var ja = {
|
|
|
1425
2225
|
const: (value) => `${value} \u306B\u3059\u308B`,
|
|
1426
2226
|
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",
|
|
1427
2227
|
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`,
|
|
2228
|
+
kindOnly: (types, kind) => `${types.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,
|
|
2229
|
+
hex: (min, max) => `0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${min} \u304B\u3089 ${max} \u5B57\u306B\u3059\u308B`,
|
|
1428
2230
|
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",
|
|
1429
2231
|
oneOf: "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",
|
|
1430
2232
|
discriminator: (tag, values) => `${tag} \u306F ${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
|
|
@@ -1442,6 +2244,8 @@ var en = {
|
|
|
1442
2244
|
const: (value) => `Use ${value}`,
|
|
1443
2245
|
not: (allowed) => allowed ? `The ${allowed.field} field is allowed only when kind is ${allowed.kind}` : "This combination of fields is not allowed",
|
|
1444
2246
|
reserved: (names) => `${names.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,
|
|
2247
|
+
kindOnly: (types, kind) => `${types.join(" and ")} events are allowed only when kind is ${kind}`,
|
|
2248
|
+
hex: (min, max) => `Use ${min} to ${max} characters of 0-9 and a-f`,
|
|
1445
2249
|
anyOf: (fields) => fields.length > 0 ? `Write one of the ${fields.join(" or ")} fields` : "Does not match any of the allowed shapes",
|
|
1446
2250
|
oneOf: "Match exactly one of the allowed shapes",
|
|
1447
2251
|
discriminator: (tag, values) => `${tag} is one of ${values.join(" / ")}`,
|
|
@@ -1456,10 +2260,10 @@ function ucs2length(str) {
|
|
|
1456
2260
|
return length;
|
|
1457
2261
|
}
|
|
1458
2262
|
var validate_diagram_default = validate10;
|
|
1459
|
-
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", "
|
|
2263
|
+
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" } }};
|
|
1460
2264
|
var func2 = Object.prototype.hasOwnProperty;
|
|
1461
2265
|
var func3 = ucs2length;
|
|
1462
|
-
var
|
|
2266
|
+
var schema28 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
|
|
1463
2267
|
var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
|
|
1464
2268
|
function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
1465
2269
|
let vErrors = null;
|
|
@@ -1563,7 +2367,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1563
2367
|
if (data.color !== void 0) {
|
|
1564
2368
|
let data3 = data.color;
|
|
1565
2369
|
if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
|
|
1566
|
-
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues:
|
|
2370
|
+
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" };
|
|
1567
2371
|
if (vErrors === null) {
|
|
1568
2372
|
vErrors = [err9];
|
|
1569
2373
|
} else {
|
|
@@ -1708,7 +2512,7 @@ function validate13(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1708
2512
|
if (data.color !== void 0) {
|
|
1709
2513
|
let data3 = data.color;
|
|
1710
2514
|
if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
|
|
1711
|
-
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues:
|
|
2515
|
+
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" };
|
|
1712
2516
|
if (vErrors === null) {
|
|
1713
2517
|
vErrors = [err9];
|
|
1714
2518
|
} else {
|
|
@@ -1885,8 +2689,9 @@ function validate15(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1885
2689
|
validate15.errors = vErrors;
|
|
1886
2690
|
return errors === 0;
|
|
1887
2691
|
}
|
|
1888
|
-
var
|
|
1889
|
-
var
|
|
2692
|
+
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" } } }] };
|
|
2693
|
+
var pattern11 = new RegExp("^[0-9a-f]{4,40}$", "u");
|
|
2694
|
+
var schema48 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
|
|
1890
2695
|
function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
1891
2696
|
let vErrors = null;
|
|
1892
2697
|
let errors = 0;
|
|
@@ -2013,7 +2818,7 @@ function validate19(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2013
2818
|
if (data.kind !== void 0) {
|
|
2014
2819
|
let data1 = data.kind;
|
|
2015
2820
|
if (!(data1 === "envelope" || data1 === "tag" || data1 === "coin" || data1 === "none")) {
|
|
2016
|
-
const err8 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues:
|
|
2821
|
+
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" };
|
|
2017
2822
|
if (vErrors === null) {
|
|
2018
2823
|
vErrors = [err8];
|
|
2019
2824
|
} else {
|
|
@@ -2206,7 +3011,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2206
3011
|
if (data.labelSide !== void 0) {
|
|
2207
3012
|
let data5 = data.labelSide;
|
|
2208
3013
|
if (!(data5 === "above" || data5 === "below" || data5 === "left" || data5 === "right")) {
|
|
2209
|
-
const err13 = { instancePath: instancePath + "/labelSide", schemaPath: "#/oneOf/0/properties/labelSide/enum", keyword: "enum", params: { allowedValues:
|
|
3014
|
+
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" };
|
|
2210
3015
|
if (vErrors === null) {
|
|
2211
3016
|
vErrors = [err13];
|
|
2212
3017
|
} else {
|
|
@@ -2432,13 +3237,10 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2432
3237
|
}
|
|
2433
3238
|
errors++;
|
|
2434
3239
|
}
|
|
2435
|
-
} else if (tag0 === "
|
|
2436
|
-
const _errs39 = errors;
|
|
2437
|
-
let valid15 = false;
|
|
2438
|
-
const _errs40 = errors;
|
|
3240
|
+
} else if (tag0 === "commit") {
|
|
2439
3241
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2440
|
-
if (data.
|
|
2441
|
-
const err35 = { instancePath, schemaPath: "#/oneOf/3/
|
|
3242
|
+
if (data.type === void 0) {
|
|
3243
|
+
const err35 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
2442
3244
|
if (vErrors === null) {
|
|
2443
3245
|
vErrors = [err35];
|
|
2444
3246
|
} else {
|
|
@@ -2446,120 +3248,104 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2446
3248
|
}
|
|
2447
3249
|
errors++;
|
|
2448
3250
|
}
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
valid15 = valid15 || _valid0;
|
|
2452
|
-
if (!valid15) {
|
|
2453
|
-
const _errs41 = errors;
|
|
2454
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2455
|
-
if (data.tag === void 0) {
|
|
2456
|
-
const err36 = { instancePath, schemaPath: "#/oneOf/3/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
|
|
2457
|
-
if (vErrors === null) {
|
|
2458
|
-
vErrors = [err36];
|
|
2459
|
-
} else {
|
|
2460
|
-
vErrors.push(err36);
|
|
2461
|
-
}
|
|
2462
|
-
errors++;
|
|
2463
|
-
}
|
|
2464
|
-
}
|
|
2465
|
-
var _valid0 = _errs41 === errors;
|
|
2466
|
-
valid15 = valid15 || _valid0;
|
|
2467
|
-
}
|
|
2468
|
-
if (!valid15) {
|
|
2469
|
-
const err37 = { instancePath, schemaPath: "#/oneOf/3/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
2470
|
-
if (vErrors === null) {
|
|
2471
|
-
vErrors = [err37];
|
|
2472
|
-
} else {
|
|
2473
|
-
vErrors.push(err37);
|
|
2474
|
-
}
|
|
2475
|
-
errors++;
|
|
2476
|
-
} else {
|
|
2477
|
-
errors = _errs39;
|
|
2478
|
-
if (vErrors !== null) {
|
|
2479
|
-
if (_errs39) {
|
|
2480
|
-
vErrors.length = _errs39;
|
|
2481
|
-
} else {
|
|
2482
|
-
vErrors = null;
|
|
2483
|
-
}
|
|
2484
|
-
}
|
|
2485
|
-
}
|
|
2486
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2487
|
-
if (data.type === void 0) {
|
|
2488
|
-
const err38 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
3251
|
+
if (data.id === void 0) {
|
|
3252
|
+
const err36 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
|
|
2489
3253
|
if (vErrors === null) {
|
|
2490
|
-
vErrors = [
|
|
3254
|
+
vErrors = [err36];
|
|
2491
3255
|
} else {
|
|
2492
|
-
vErrors.push(
|
|
3256
|
+
vErrors.push(err36);
|
|
2493
3257
|
}
|
|
2494
3258
|
errors++;
|
|
2495
3259
|
}
|
|
2496
|
-
if (data.
|
|
2497
|
-
const
|
|
3260
|
+
if (data.branch === void 0) {
|
|
3261
|
+
const err37 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
|
|
2498
3262
|
if (vErrors === null) {
|
|
2499
|
-
vErrors = [
|
|
3263
|
+
vErrors = [err37];
|
|
2500
3264
|
} else {
|
|
2501
|
-
vErrors.push(
|
|
3265
|
+
vErrors.push(err37);
|
|
2502
3266
|
}
|
|
2503
3267
|
errors++;
|
|
2504
3268
|
}
|
|
2505
3269
|
for (const key3 in data) {
|
|
2506
|
-
if (!(key3 === "type" || key3 === "
|
|
2507
|
-
const
|
|
3270
|
+
if (!(key3 === "type" || key3 === "id" || key3 === "branch" || key3 === "copy" || key3 === "merge" || key3 === "hash" || key3 === "note")) {
|
|
3271
|
+
const err38 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
|
|
2508
3272
|
if (vErrors === null) {
|
|
2509
|
-
vErrors = [
|
|
3273
|
+
vErrors = [err38];
|
|
2510
3274
|
} else {
|
|
2511
|
-
vErrors.push(
|
|
3275
|
+
vErrors.push(err38);
|
|
2512
3276
|
}
|
|
2513
3277
|
errors++;
|
|
2514
3278
|
}
|
|
2515
3279
|
}
|
|
2516
3280
|
if (data.type !== void 0) {
|
|
2517
|
-
if ("
|
|
2518
|
-
const
|
|
3281
|
+
if ("commit" !== data.type) {
|
|
3282
|
+
const err39 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "commit" }, message: "must be equal to constant" };
|
|
2519
3283
|
if (vErrors === null) {
|
|
2520
|
-
vErrors = [
|
|
3284
|
+
vErrors = [err39];
|
|
2521
3285
|
} else {
|
|
2522
|
-
vErrors.push(
|
|
3286
|
+
vErrors.push(err39);
|
|
2523
3287
|
}
|
|
2524
3288
|
errors++;
|
|
2525
3289
|
}
|
|
2526
3290
|
}
|
|
2527
|
-
if (data.
|
|
2528
|
-
let data13 = data.
|
|
3291
|
+
if (data.id !== void 0) {
|
|
3292
|
+
let data13 = data.id;
|
|
2529
3293
|
if (typeof data13 === "string") {
|
|
2530
|
-
if (
|
|
2531
|
-
const
|
|
3294
|
+
if (!pattern0.test(data13)) {
|
|
3295
|
+
const err40 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2532
3296
|
if (vErrors === null) {
|
|
2533
|
-
vErrors = [
|
|
3297
|
+
vErrors = [err40];
|
|
2534
3298
|
} else {
|
|
2535
|
-
vErrors.push(
|
|
3299
|
+
vErrors.push(err40);
|
|
2536
3300
|
}
|
|
2537
3301
|
errors++;
|
|
2538
3302
|
}
|
|
2539
3303
|
} else {
|
|
2540
|
-
const
|
|
3304
|
+
const err41 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2541
3305
|
if (vErrors === null) {
|
|
2542
|
-
vErrors = [
|
|
3306
|
+
vErrors = [err41];
|
|
2543
3307
|
} else {
|
|
2544
|
-
vErrors.push(
|
|
3308
|
+
vErrors.push(err41);
|
|
2545
3309
|
}
|
|
2546
3310
|
errors++;
|
|
2547
3311
|
}
|
|
2548
3312
|
}
|
|
2549
|
-
if (data.
|
|
2550
|
-
let data14 = data.
|
|
3313
|
+
if (data.branch !== void 0) {
|
|
3314
|
+
let data14 = data.branch;
|
|
2551
3315
|
if (typeof data14 === "string") {
|
|
2552
|
-
if (
|
|
2553
|
-
const
|
|
3316
|
+
if (!pattern0.test(data14)) {
|
|
3317
|
+
const err42 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2554
3318
|
if (vErrors === null) {
|
|
2555
|
-
vErrors = [
|
|
3319
|
+
vErrors = [err42];
|
|
2556
3320
|
} else {
|
|
2557
|
-
vErrors.push(
|
|
3321
|
+
vErrors.push(err42);
|
|
2558
3322
|
}
|
|
2559
3323
|
errors++;
|
|
2560
3324
|
}
|
|
2561
3325
|
} else {
|
|
2562
|
-
const
|
|
3326
|
+
const err43 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3327
|
+
if (vErrors === null) {
|
|
3328
|
+
vErrors = [err43];
|
|
3329
|
+
} else {
|
|
3330
|
+
vErrors.push(err43);
|
|
3331
|
+
}
|
|
3332
|
+
errors++;
|
|
3333
|
+
}
|
|
3334
|
+
}
|
|
3335
|
+
if (data.copy !== void 0) {
|
|
3336
|
+
let data15 = data.copy;
|
|
3337
|
+
if (typeof data15 === "string") {
|
|
3338
|
+
if (!pattern0.test(data15)) {
|
|
3339
|
+
const err44 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
3340
|
+
if (vErrors === null) {
|
|
3341
|
+
vErrors = [err44];
|
|
3342
|
+
} else {
|
|
3343
|
+
vErrors.push(err44);
|
|
3344
|
+
}
|
|
3345
|
+
errors++;
|
|
3346
|
+
}
|
|
3347
|
+
} else {
|
|
3348
|
+
const err45 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2563
3349
|
if (vErrors === null) {
|
|
2564
3350
|
vErrors = [err45];
|
|
2565
3351
|
} else {
|
|
@@ -2568,11 +3354,11 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2568
3354
|
errors++;
|
|
2569
3355
|
}
|
|
2570
3356
|
}
|
|
2571
|
-
if (data.
|
|
2572
|
-
let
|
|
2573
|
-
if (typeof
|
|
2574
|
-
if (
|
|
2575
|
-
const err46 = { instancePath: instancePath + "/
|
|
3357
|
+
if (data.merge !== void 0) {
|
|
3358
|
+
let data16 = data.merge;
|
|
3359
|
+
if (typeof data16 === "string") {
|
|
3360
|
+
if (!pattern0.test(data16)) {
|
|
3361
|
+
const err46 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
2576
3362
|
if (vErrors === null) {
|
|
2577
3363
|
vErrors = [err46];
|
|
2578
3364
|
} else {
|
|
@@ -2581,7 +3367,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2581
3367
|
errors++;
|
|
2582
3368
|
}
|
|
2583
3369
|
} else {
|
|
2584
|
-
const err47 = { instancePath: instancePath + "/
|
|
3370
|
+
const err47 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2585
3371
|
if (vErrors === null) {
|
|
2586
3372
|
vErrors = [err47];
|
|
2587
3373
|
} else {
|
|
@@ -2590,39 +3376,354 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2590
3376
|
errors++;
|
|
2591
3377
|
}
|
|
2592
3378
|
}
|
|
3379
|
+
if (data.hash !== void 0) {
|
|
3380
|
+
let data17 = data.hash;
|
|
3381
|
+
if (typeof data17 === "string") {
|
|
3382
|
+
if (!pattern11.test(data17)) {
|
|
3383
|
+
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}$"' };
|
|
3384
|
+
if (vErrors === null) {
|
|
3385
|
+
vErrors = [err48];
|
|
3386
|
+
} else {
|
|
3387
|
+
vErrors.push(err48);
|
|
3388
|
+
}
|
|
3389
|
+
errors++;
|
|
3390
|
+
}
|
|
3391
|
+
} else {
|
|
3392
|
+
const err49 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3393
|
+
if (vErrors === null) {
|
|
3394
|
+
vErrors = [err49];
|
|
3395
|
+
} else {
|
|
3396
|
+
vErrors.push(err49);
|
|
3397
|
+
}
|
|
3398
|
+
errors++;
|
|
3399
|
+
}
|
|
3400
|
+
}
|
|
3401
|
+
if (data.note !== void 0) {
|
|
3402
|
+
let data18 = data.note;
|
|
3403
|
+
if (typeof data18 === "string") {
|
|
3404
|
+
if (func3(data18) < 1) {
|
|
3405
|
+
const err50 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3406
|
+
if (vErrors === null) {
|
|
3407
|
+
vErrors = [err50];
|
|
3408
|
+
} else {
|
|
3409
|
+
vErrors.push(err50);
|
|
3410
|
+
}
|
|
3411
|
+
errors++;
|
|
3412
|
+
}
|
|
3413
|
+
} else {
|
|
3414
|
+
const err51 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3415
|
+
if (vErrors === null) {
|
|
3416
|
+
vErrors = [err51];
|
|
3417
|
+
} else {
|
|
3418
|
+
vErrors.push(err51);
|
|
3419
|
+
}
|
|
3420
|
+
errors++;
|
|
3421
|
+
}
|
|
3422
|
+
}
|
|
3423
|
+
} else {
|
|
3424
|
+
const err52 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3425
|
+
if (vErrors === null) {
|
|
3426
|
+
vErrors = [err52];
|
|
3427
|
+
} else {
|
|
3428
|
+
vErrors.push(err52);
|
|
3429
|
+
}
|
|
3430
|
+
errors++;
|
|
3431
|
+
}
|
|
3432
|
+
} else if (tag0 === "branch") {
|
|
3433
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3434
|
+
if (data.type === void 0) {
|
|
3435
|
+
const err53 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
3436
|
+
if (vErrors === null) {
|
|
3437
|
+
vErrors = [err53];
|
|
3438
|
+
} else {
|
|
3439
|
+
vErrors.push(err53);
|
|
3440
|
+
}
|
|
3441
|
+
errors++;
|
|
3442
|
+
}
|
|
3443
|
+
if (data.branch === void 0) {
|
|
3444
|
+
const err54 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
|
|
3445
|
+
if (vErrors === null) {
|
|
3446
|
+
vErrors = [err54];
|
|
3447
|
+
} else {
|
|
3448
|
+
vErrors.push(err54);
|
|
3449
|
+
}
|
|
3450
|
+
errors++;
|
|
3451
|
+
}
|
|
3452
|
+
if (data.from === void 0) {
|
|
3453
|
+
const err55 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
|
|
3454
|
+
if (vErrors === null) {
|
|
3455
|
+
vErrors = [err55];
|
|
3456
|
+
} else {
|
|
3457
|
+
vErrors.push(err55);
|
|
3458
|
+
}
|
|
3459
|
+
errors++;
|
|
3460
|
+
}
|
|
3461
|
+
for (const key4 in data) {
|
|
3462
|
+
if (!(key4 === "type" || key4 === "branch" || key4 === "from")) {
|
|
3463
|
+
const err56 = { instancePath, schemaPath: "#/oneOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
|
|
3464
|
+
if (vErrors === null) {
|
|
3465
|
+
vErrors = [err56];
|
|
3466
|
+
} else {
|
|
3467
|
+
vErrors.push(err56);
|
|
3468
|
+
}
|
|
3469
|
+
errors++;
|
|
3470
|
+
}
|
|
3471
|
+
}
|
|
3472
|
+
if (data.type !== void 0) {
|
|
3473
|
+
if ("branch" !== data.type) {
|
|
3474
|
+
const err57 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/4/properties/type/const", keyword: "const", params: { allowedValue: "branch" }, message: "must be equal to constant" };
|
|
3475
|
+
if (vErrors === null) {
|
|
3476
|
+
vErrors = [err57];
|
|
3477
|
+
} else {
|
|
3478
|
+
vErrors.push(err57);
|
|
3479
|
+
}
|
|
3480
|
+
errors++;
|
|
3481
|
+
}
|
|
3482
|
+
}
|
|
3483
|
+
if (data.branch !== void 0) {
|
|
3484
|
+
let data20 = data.branch;
|
|
3485
|
+
if (typeof data20 === "string") {
|
|
3486
|
+
if (!pattern0.test(data20)) {
|
|
3487
|
+
const err58 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
3488
|
+
if (vErrors === null) {
|
|
3489
|
+
vErrors = [err58];
|
|
3490
|
+
} else {
|
|
3491
|
+
vErrors.push(err58);
|
|
3492
|
+
}
|
|
3493
|
+
errors++;
|
|
3494
|
+
}
|
|
3495
|
+
} else {
|
|
3496
|
+
const err59 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3497
|
+
if (vErrors === null) {
|
|
3498
|
+
vErrors = [err59];
|
|
3499
|
+
} else {
|
|
3500
|
+
vErrors.push(err59);
|
|
3501
|
+
}
|
|
3502
|
+
errors++;
|
|
3503
|
+
}
|
|
3504
|
+
}
|
|
3505
|
+
if (data.from !== void 0) {
|
|
3506
|
+
let data21 = data.from;
|
|
3507
|
+
if (typeof data21 === "string") {
|
|
3508
|
+
if (!pattern0.test(data21)) {
|
|
3509
|
+
const err60 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
3510
|
+
if (vErrors === null) {
|
|
3511
|
+
vErrors = [err60];
|
|
3512
|
+
} else {
|
|
3513
|
+
vErrors.push(err60);
|
|
3514
|
+
}
|
|
3515
|
+
errors++;
|
|
3516
|
+
}
|
|
3517
|
+
} else {
|
|
3518
|
+
const err61 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3519
|
+
if (vErrors === null) {
|
|
3520
|
+
vErrors = [err61];
|
|
3521
|
+
} else {
|
|
3522
|
+
vErrors.push(err61);
|
|
3523
|
+
}
|
|
3524
|
+
errors++;
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
} else {
|
|
3528
|
+
const err62 = { instancePath, schemaPath: "#/oneOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3529
|
+
if (vErrors === null) {
|
|
3530
|
+
vErrors = [err62];
|
|
3531
|
+
} else {
|
|
3532
|
+
vErrors.push(err62);
|
|
3533
|
+
}
|
|
3534
|
+
errors++;
|
|
3535
|
+
}
|
|
3536
|
+
} else if (tag0 === "strip") {
|
|
3537
|
+
const _errs71 = errors;
|
|
3538
|
+
let valid27 = false;
|
|
3539
|
+
const _errs72 = errors;
|
|
3540
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3541
|
+
if (data.value === void 0) {
|
|
3542
|
+
const err63 = { instancePath, schemaPath: "#/oneOf/5/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
|
|
3543
|
+
if (vErrors === null) {
|
|
3544
|
+
vErrors = [err63];
|
|
3545
|
+
} else {
|
|
3546
|
+
vErrors.push(err63);
|
|
3547
|
+
}
|
|
3548
|
+
errors++;
|
|
3549
|
+
}
|
|
3550
|
+
}
|
|
3551
|
+
var _valid0 = _errs72 === errors;
|
|
3552
|
+
valid27 = valid27 || _valid0;
|
|
3553
|
+
if (!valid27) {
|
|
3554
|
+
const _errs73 = errors;
|
|
3555
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3556
|
+
if (data.tag === void 0) {
|
|
3557
|
+
const err64 = { instancePath, schemaPath: "#/oneOf/5/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
|
|
3558
|
+
if (vErrors === null) {
|
|
3559
|
+
vErrors = [err64];
|
|
3560
|
+
} else {
|
|
3561
|
+
vErrors.push(err64);
|
|
3562
|
+
}
|
|
3563
|
+
errors++;
|
|
3564
|
+
}
|
|
3565
|
+
}
|
|
3566
|
+
var _valid0 = _errs73 === errors;
|
|
3567
|
+
valid27 = valid27 || _valid0;
|
|
3568
|
+
}
|
|
3569
|
+
if (!valid27) {
|
|
3570
|
+
const err65 = { instancePath, schemaPath: "#/oneOf/5/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
3571
|
+
if (vErrors === null) {
|
|
3572
|
+
vErrors = [err65];
|
|
3573
|
+
} else {
|
|
3574
|
+
vErrors.push(err65);
|
|
3575
|
+
}
|
|
3576
|
+
errors++;
|
|
3577
|
+
} else {
|
|
3578
|
+
errors = _errs71;
|
|
3579
|
+
if (vErrors !== null) {
|
|
3580
|
+
if (_errs71) {
|
|
3581
|
+
vErrors.length = _errs71;
|
|
3582
|
+
} else {
|
|
3583
|
+
vErrors = null;
|
|
3584
|
+
}
|
|
3585
|
+
}
|
|
3586
|
+
}
|
|
3587
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3588
|
+
if (data.type === void 0) {
|
|
3589
|
+
const err66 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
3590
|
+
if (vErrors === null) {
|
|
3591
|
+
vErrors = [err66];
|
|
3592
|
+
} else {
|
|
3593
|
+
vErrors.push(err66);
|
|
3594
|
+
}
|
|
3595
|
+
errors++;
|
|
3596
|
+
}
|
|
3597
|
+
if (data.field === void 0) {
|
|
3598
|
+
const err67 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
|
|
3599
|
+
if (vErrors === null) {
|
|
3600
|
+
vErrors = [err67];
|
|
3601
|
+
} else {
|
|
3602
|
+
vErrors.push(err67);
|
|
3603
|
+
}
|
|
3604
|
+
errors++;
|
|
3605
|
+
}
|
|
3606
|
+
for (const key5 in data) {
|
|
3607
|
+
if (!(key5 === "type" || key5 === "field" || key5 === "value" || key5 === "tag")) {
|
|
3608
|
+
const err68 = { instancePath, schemaPath: "#/oneOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
|
|
3609
|
+
if (vErrors === null) {
|
|
3610
|
+
vErrors = [err68];
|
|
3611
|
+
} else {
|
|
3612
|
+
vErrors.push(err68);
|
|
3613
|
+
}
|
|
3614
|
+
errors++;
|
|
3615
|
+
}
|
|
3616
|
+
}
|
|
3617
|
+
if (data.type !== void 0) {
|
|
3618
|
+
if ("strip" !== data.type) {
|
|
3619
|
+
const err69 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/5/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
|
|
3620
|
+
if (vErrors === null) {
|
|
3621
|
+
vErrors = [err69];
|
|
3622
|
+
} else {
|
|
3623
|
+
vErrors.push(err69);
|
|
3624
|
+
}
|
|
3625
|
+
errors++;
|
|
3626
|
+
}
|
|
3627
|
+
}
|
|
3628
|
+
if (data.field !== void 0) {
|
|
3629
|
+
let data23 = data.field;
|
|
3630
|
+
if (typeof data23 === "string") {
|
|
3631
|
+
if (func3(data23) < 1) {
|
|
3632
|
+
const err70 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3633
|
+
if (vErrors === null) {
|
|
3634
|
+
vErrors = [err70];
|
|
3635
|
+
} else {
|
|
3636
|
+
vErrors.push(err70);
|
|
3637
|
+
}
|
|
3638
|
+
errors++;
|
|
3639
|
+
}
|
|
3640
|
+
} else {
|
|
3641
|
+
const err71 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3642
|
+
if (vErrors === null) {
|
|
3643
|
+
vErrors = [err71];
|
|
3644
|
+
} else {
|
|
3645
|
+
vErrors.push(err71);
|
|
3646
|
+
}
|
|
3647
|
+
errors++;
|
|
3648
|
+
}
|
|
3649
|
+
}
|
|
3650
|
+
if (data.value !== void 0) {
|
|
3651
|
+
let data24 = data.value;
|
|
3652
|
+
if (typeof data24 === "string") {
|
|
3653
|
+
if (func3(data24) < 1) {
|
|
3654
|
+
const err72 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3655
|
+
if (vErrors === null) {
|
|
3656
|
+
vErrors = [err72];
|
|
3657
|
+
} else {
|
|
3658
|
+
vErrors.push(err72);
|
|
3659
|
+
}
|
|
3660
|
+
errors++;
|
|
3661
|
+
}
|
|
3662
|
+
} else {
|
|
3663
|
+
const err73 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3664
|
+
if (vErrors === null) {
|
|
3665
|
+
vErrors = [err73];
|
|
3666
|
+
} else {
|
|
3667
|
+
vErrors.push(err73);
|
|
3668
|
+
}
|
|
3669
|
+
errors++;
|
|
3670
|
+
}
|
|
3671
|
+
}
|
|
3672
|
+
if (data.tag !== void 0) {
|
|
3673
|
+
let data25 = data.tag;
|
|
3674
|
+
if (typeof data25 === "string") {
|
|
3675
|
+
if (func3(data25) < 1) {
|
|
3676
|
+
const err74 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3677
|
+
if (vErrors === null) {
|
|
3678
|
+
vErrors = [err74];
|
|
3679
|
+
} else {
|
|
3680
|
+
vErrors.push(err74);
|
|
3681
|
+
}
|
|
3682
|
+
errors++;
|
|
3683
|
+
}
|
|
3684
|
+
} else {
|
|
3685
|
+
const err75 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3686
|
+
if (vErrors === null) {
|
|
3687
|
+
vErrors = [err75];
|
|
3688
|
+
} else {
|
|
3689
|
+
vErrors.push(err75);
|
|
3690
|
+
}
|
|
3691
|
+
errors++;
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
2593
3694
|
} else {
|
|
2594
|
-
const
|
|
3695
|
+
const err76 = { instancePath, schemaPath: "#/oneOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2595
3696
|
if (vErrors === null) {
|
|
2596
|
-
vErrors = [
|
|
3697
|
+
vErrors = [err76];
|
|
2597
3698
|
} else {
|
|
2598
|
-
vErrors.push(
|
|
3699
|
+
vErrors.push(err76);
|
|
2599
3700
|
}
|
|
2600
3701
|
errors++;
|
|
2601
3702
|
}
|
|
2602
3703
|
} else {
|
|
2603
|
-
const
|
|
3704
|
+
const err77 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
|
|
2604
3705
|
if (vErrors === null) {
|
|
2605
|
-
vErrors = [
|
|
3706
|
+
vErrors = [err77];
|
|
2606
3707
|
} else {
|
|
2607
|
-
vErrors.push(
|
|
3708
|
+
vErrors.push(err77);
|
|
2608
3709
|
}
|
|
2609
3710
|
errors++;
|
|
2610
3711
|
}
|
|
2611
3712
|
} else {
|
|
2612
|
-
const
|
|
3713
|
+
const err78 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
|
|
2613
3714
|
if (vErrors === null) {
|
|
2614
|
-
vErrors = [
|
|
3715
|
+
vErrors = [err78];
|
|
2615
3716
|
} else {
|
|
2616
|
-
vErrors.push(
|
|
3717
|
+
vErrors.push(err78);
|
|
2617
3718
|
}
|
|
2618
3719
|
errors++;
|
|
2619
3720
|
}
|
|
2620
3721
|
} else {
|
|
2621
|
-
const
|
|
3722
|
+
const err79 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2622
3723
|
if (vErrors === null) {
|
|
2623
|
-
vErrors = [
|
|
3724
|
+
vErrors = [err79];
|
|
2624
3725
|
} else {
|
|
2625
|
-
vErrors.push(
|
|
3726
|
+
vErrors.push(err79);
|
|
2626
3727
|
}
|
|
2627
3728
|
errors++;
|
|
2628
3729
|
}
|
|
@@ -2944,29 +4045,174 @@ function validate26(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2944
4045
|
if (vErrors === null) {
|
|
2945
4046
|
vErrors = [err8];
|
|
2946
4047
|
} else {
|
|
2947
|
-
vErrors.push(err8);
|
|
4048
|
+
vErrors.push(err8);
|
|
4049
|
+
}
|
|
4050
|
+
errors++;
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
} else {
|
|
4054
|
+
const err9 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
4055
|
+
if (vErrors === null) {
|
|
4056
|
+
vErrors = [err9];
|
|
4057
|
+
} else {
|
|
4058
|
+
vErrors.push(err9);
|
|
4059
|
+
}
|
|
4060
|
+
errors++;
|
|
4061
|
+
}
|
|
4062
|
+
validate26.errors = vErrors;
|
|
4063
|
+
return errors === 0;
|
|
4064
|
+
}
|
|
4065
|
+
function validate25(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
4066
|
+
let vErrors = null;
|
|
4067
|
+
let errors = 0;
|
|
4068
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4069
|
+
if (data.paths === void 0) {
|
|
4070
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "paths" }, message: "must have required property 'paths'" };
|
|
4071
|
+
if (vErrors === null) {
|
|
4072
|
+
vErrors = [err0];
|
|
4073
|
+
} else {
|
|
4074
|
+
vErrors.push(err0);
|
|
4075
|
+
}
|
|
4076
|
+
errors++;
|
|
4077
|
+
}
|
|
4078
|
+
for (const key0 in data) {
|
|
4079
|
+
if (!(key0 === "paths")) {
|
|
4080
|
+
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
4081
|
+
if (vErrors === null) {
|
|
4082
|
+
vErrors = [err1];
|
|
4083
|
+
} else {
|
|
4084
|
+
vErrors.push(err1);
|
|
4085
|
+
}
|
|
4086
|
+
errors++;
|
|
4087
|
+
}
|
|
4088
|
+
}
|
|
4089
|
+
if (data.paths !== void 0) {
|
|
4090
|
+
let data0 = data.paths;
|
|
4091
|
+
if (Array.isArray(data0)) {
|
|
4092
|
+
if (data0.length < 1) {
|
|
4093
|
+
const err2 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4094
|
+
if (vErrors === null) {
|
|
4095
|
+
vErrors = [err2];
|
|
4096
|
+
} else {
|
|
4097
|
+
vErrors.push(err2);
|
|
4098
|
+
}
|
|
4099
|
+
errors++;
|
|
4100
|
+
}
|
|
4101
|
+
const len0 = data0.length;
|
|
4102
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
4103
|
+
if (!validate26(data0[i0], { instancePath: instancePath + "/paths/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
|
|
4104
|
+
vErrors = vErrors === null ? validate26.errors : vErrors.concat(validate26.errors);
|
|
4105
|
+
errors = vErrors.length;
|
|
4106
|
+
}
|
|
4107
|
+
}
|
|
4108
|
+
} else {
|
|
4109
|
+
const err3 = { instancePath: instancePath + "/paths", schemaPath: "#/properties/paths/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
4110
|
+
if (vErrors === null) {
|
|
4111
|
+
vErrors = [err3];
|
|
4112
|
+
} else {
|
|
4113
|
+
vErrors.push(err3);
|
|
4114
|
+
}
|
|
4115
|
+
errors++;
|
|
4116
|
+
}
|
|
4117
|
+
}
|
|
4118
|
+
} else {
|
|
4119
|
+
const err4 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
4120
|
+
if (vErrors === null) {
|
|
4121
|
+
vErrors = [err4];
|
|
4122
|
+
} else {
|
|
4123
|
+
vErrors.push(err4);
|
|
4124
|
+
}
|
|
4125
|
+
errors++;
|
|
4126
|
+
}
|
|
4127
|
+
validate25.errors = vErrors;
|
|
4128
|
+
return errors === 0;
|
|
4129
|
+
}
|
|
4130
|
+
function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
4131
|
+
let vErrors = null;
|
|
4132
|
+
let errors = 0;
|
|
4133
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4134
|
+
if (data.id === void 0) {
|
|
4135
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
|
|
4136
|
+
if (vErrors === null) {
|
|
4137
|
+
vErrors = [err0];
|
|
4138
|
+
} else {
|
|
4139
|
+
vErrors.push(err0);
|
|
4140
|
+
}
|
|
4141
|
+
errors++;
|
|
4142
|
+
}
|
|
4143
|
+
for (const key0 in data) {
|
|
4144
|
+
if (!(key0 === "id" || key0 === "note")) {
|
|
4145
|
+
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
4146
|
+
if (vErrors === null) {
|
|
4147
|
+
vErrors = [err1];
|
|
4148
|
+
} else {
|
|
4149
|
+
vErrors.push(err1);
|
|
4150
|
+
}
|
|
4151
|
+
errors++;
|
|
4152
|
+
}
|
|
4153
|
+
}
|
|
4154
|
+
if (data.id !== void 0) {
|
|
4155
|
+
let data0 = data.id;
|
|
4156
|
+
if (typeof data0 === "string") {
|
|
4157
|
+
if (!pattern0.test(data0)) {
|
|
4158
|
+
const err2 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
4159
|
+
if (vErrors === null) {
|
|
4160
|
+
vErrors = [err2];
|
|
4161
|
+
} else {
|
|
4162
|
+
vErrors.push(err2);
|
|
4163
|
+
}
|
|
4164
|
+
errors++;
|
|
4165
|
+
}
|
|
4166
|
+
} else {
|
|
4167
|
+
const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
4168
|
+
if (vErrors === null) {
|
|
4169
|
+
vErrors = [err3];
|
|
4170
|
+
} else {
|
|
4171
|
+
vErrors.push(err3);
|
|
4172
|
+
}
|
|
4173
|
+
errors++;
|
|
4174
|
+
}
|
|
4175
|
+
}
|
|
4176
|
+
if (data.note !== void 0) {
|
|
4177
|
+
let data1 = data.note;
|
|
4178
|
+
if (typeof data1 === "string") {
|
|
4179
|
+
if (func3(data1) < 1) {
|
|
4180
|
+
const err4 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
4181
|
+
if (vErrors === null) {
|
|
4182
|
+
vErrors = [err4];
|
|
4183
|
+
} else {
|
|
4184
|
+
vErrors.push(err4);
|
|
4185
|
+
}
|
|
4186
|
+
errors++;
|
|
4187
|
+
}
|
|
4188
|
+
} else {
|
|
4189
|
+
const err5 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
4190
|
+
if (vErrors === null) {
|
|
4191
|
+
vErrors = [err5];
|
|
4192
|
+
} else {
|
|
4193
|
+
vErrors.push(err5);
|
|
2948
4194
|
}
|
|
2949
4195
|
errors++;
|
|
2950
4196
|
}
|
|
2951
4197
|
}
|
|
2952
4198
|
} else {
|
|
2953
|
-
const
|
|
4199
|
+
const err6 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2954
4200
|
if (vErrors === null) {
|
|
2955
|
-
vErrors = [
|
|
4201
|
+
vErrors = [err6];
|
|
2956
4202
|
} else {
|
|
2957
|
-
vErrors.push(
|
|
4203
|
+
vErrors.push(err6);
|
|
2958
4204
|
}
|
|
2959
4205
|
errors++;
|
|
2960
4206
|
}
|
|
2961
|
-
|
|
4207
|
+
validate30.errors = vErrors;
|
|
2962
4208
|
return errors === 0;
|
|
2963
4209
|
}
|
|
2964
|
-
function
|
|
4210
|
+
function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
2965
4211
|
let vErrors = null;
|
|
2966
4212
|
let errors = 0;
|
|
2967
4213
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2968
|
-
if (data.
|
|
2969
|
-
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "
|
|
4214
|
+
if (data.branches === void 0) {
|
|
4215
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "branches" }, message: "must have required property 'branches'" };
|
|
2970
4216
|
if (vErrors === null) {
|
|
2971
4217
|
vErrors = [err0];
|
|
2972
4218
|
} else {
|
|
@@ -2975,7 +4221,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2975
4221
|
errors++;
|
|
2976
4222
|
}
|
|
2977
4223
|
for (const key0 in data) {
|
|
2978
|
-
if (!(key0 === "
|
|
4224
|
+
if (!(key0 === "branches")) {
|
|
2979
4225
|
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
2980
4226
|
if (vErrors === null) {
|
|
2981
4227
|
vErrors = [err1];
|
|
@@ -2985,11 +4231,11 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2985
4231
|
errors++;
|
|
2986
4232
|
}
|
|
2987
4233
|
}
|
|
2988
|
-
if (data.
|
|
2989
|
-
let data0 = data.
|
|
4234
|
+
if (data.branches !== void 0) {
|
|
4235
|
+
let data0 = data.branches;
|
|
2990
4236
|
if (Array.isArray(data0)) {
|
|
2991
4237
|
if (data0.length < 1) {
|
|
2992
|
-
const err2 = { instancePath: instancePath + "/
|
|
4238
|
+
const err2 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
2993
4239
|
if (vErrors === null) {
|
|
2994
4240
|
vErrors = [err2];
|
|
2995
4241
|
} else {
|
|
@@ -2999,13 +4245,13 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2999
4245
|
}
|
|
3000
4246
|
const len0 = data0.length;
|
|
3001
4247
|
for (let i0 = 0; i0 < len0; i0++) {
|
|
3002
|
-
if (!
|
|
3003
|
-
vErrors = vErrors === null ?
|
|
4248
|
+
if (!validate30(data0[i0], { instancePath: instancePath + "/branches/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
|
|
4249
|
+
vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors);
|
|
3004
4250
|
errors = vErrors.length;
|
|
3005
4251
|
}
|
|
3006
4252
|
}
|
|
3007
4253
|
} else {
|
|
3008
|
-
const err3 = { instancePath: instancePath + "/
|
|
4254
|
+
const err3 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3009
4255
|
if (vErrors === null) {
|
|
3010
4256
|
vErrors = [err3];
|
|
3011
4257
|
} else {
|
|
@@ -3023,7 +4269,7 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3023
4269
|
}
|
|
3024
4270
|
errors++;
|
|
3025
4271
|
}
|
|
3026
|
-
|
|
4272
|
+
validate29.errors = vErrors;
|
|
3027
4273
|
return errors === 0;
|
|
3028
4274
|
}
|
|
3029
4275
|
function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
@@ -3067,11 +4313,9 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3067
4313
|
let ifClause0;
|
|
3068
4314
|
if (_valid0) {
|
|
3069
4315
|
const _errs4 = errors;
|
|
3070
|
-
const _errs5 = errors;
|
|
3071
|
-
const _errs6 = errors;
|
|
3072
4316
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3073
|
-
if (data.
|
|
3074
|
-
const err2 = {};
|
|
4317
|
+
if (data.sequence === void 0) {
|
|
4318
|
+
const err2 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
|
|
3075
4319
|
if (vErrors === null) {
|
|
3076
4320
|
vErrors = [err2];
|
|
3077
4321
|
} else {
|
|
@@ -3079,147 +4323,181 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3079
4323
|
}
|
|
3080
4324
|
errors++;
|
|
3081
4325
|
}
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
4326
|
+
if (data.boxes !== void 0) {
|
|
4327
|
+
let data1 = data.boxes;
|
|
4328
|
+
if (Array.isArray(data1)) {
|
|
4329
|
+
if (data1.length < 1) {
|
|
4330
|
+
const err3 = { instancePath: instancePath + "/boxes", schemaPath: "#/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4331
|
+
if (vErrors === null) {
|
|
4332
|
+
vErrors = [err3];
|
|
4333
|
+
} else {
|
|
4334
|
+
vErrors.push(err3);
|
|
4335
|
+
}
|
|
4336
|
+
errors++;
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
3090
4339
|
}
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
4340
|
+
if (data.steps !== void 0) {
|
|
4341
|
+
let data2 = data.steps;
|
|
4342
|
+
if (Array.isArray(data2)) {
|
|
4343
|
+
const len0 = data2.length;
|
|
4344
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
4345
|
+
let data3 = data2[i0];
|
|
4346
|
+
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
|
|
4347
|
+
if (data3.events !== void 0) {
|
|
4348
|
+
let data4 = data3.events;
|
|
4349
|
+
if (Array.isArray(data4)) {
|
|
4350
|
+
const len1 = data4.length;
|
|
4351
|
+
for (let i1 = 0; i1 < len1; i1++) {
|
|
4352
|
+
let data5 = data4[i1];
|
|
4353
|
+
if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
|
|
4354
|
+
if (data5.type !== void 0) {
|
|
4355
|
+
let data6 = data5.type;
|
|
4356
|
+
const _errs12 = errors;
|
|
4357
|
+
const _errs13 = errors;
|
|
4358
|
+
if (!(data6 === "commit" || data6 === "branch")) {
|
|
4359
|
+
const err4 = {};
|
|
4360
|
+
if (vErrors === null) {
|
|
4361
|
+
vErrors = [err4];
|
|
4362
|
+
} else {
|
|
4363
|
+
vErrors.push(err4);
|
|
4364
|
+
}
|
|
4365
|
+
errors++;
|
|
4366
|
+
}
|
|
4367
|
+
var valid10 = _errs13 === errors;
|
|
4368
|
+
if (valid10) {
|
|
4369
|
+
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" };
|
|
4370
|
+
if (vErrors === null) {
|
|
4371
|
+
vErrors = [err5];
|
|
4372
|
+
} else {
|
|
4373
|
+
vErrors.push(err5);
|
|
4374
|
+
}
|
|
4375
|
+
errors++;
|
|
4376
|
+
} else {
|
|
4377
|
+
errors = _errs12;
|
|
4378
|
+
if (vErrors !== null) {
|
|
4379
|
+
if (_errs12) {
|
|
4380
|
+
vErrors.length = _errs12;
|
|
4381
|
+
} else {
|
|
4382
|
+
vErrors = null;
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4387
|
+
}
|
|
4388
|
+
}
|
|
4389
|
+
}
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
}
|
|
3099
4393
|
}
|
|
3100
4394
|
}
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
if (data.sequence === void 0) {
|
|
3104
|
-
const err4 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
|
|
4395
|
+
if (data.state !== void 0) {
|
|
4396
|
+
const err6 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
3105
4397
|
if (vErrors === null) {
|
|
3106
|
-
vErrors = [
|
|
4398
|
+
vErrors = [err6];
|
|
3107
4399
|
} else {
|
|
3108
|
-
vErrors.push(
|
|
4400
|
+
vErrors.push(err6);
|
|
3109
4401
|
}
|
|
3110
4402
|
errors++;
|
|
3111
4403
|
}
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
valid0 = _valid0;
|
|
3115
|
-
ifClause0 = "then";
|
|
3116
|
-
} else {
|
|
3117
|
-
const _errs7 = errors;
|
|
3118
|
-
const _errs8 = errors;
|
|
3119
|
-
const _errs9 = errors;
|
|
3120
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3121
|
-
if (data.sequence === void 0 && ("sequence")) {
|
|
3122
|
-
const err5 = {};
|
|
4404
|
+
if (data.git !== void 0) {
|
|
4405
|
+
const err7 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
3123
4406
|
if (vErrors === null) {
|
|
3124
|
-
vErrors = [
|
|
4407
|
+
vErrors = [err7];
|
|
3125
4408
|
} else {
|
|
3126
|
-
vErrors.push(
|
|
4409
|
+
vErrors.push(err7);
|
|
3127
4410
|
}
|
|
3128
4411
|
errors++;
|
|
3129
4412
|
}
|
|
3130
4413
|
}
|
|
3131
|
-
var
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
errors++;
|
|
3140
|
-
} else {
|
|
3141
|
-
errors = _errs8;
|
|
3142
|
-
if (vErrors !== null) {
|
|
3143
|
-
if (_errs8) {
|
|
3144
|
-
vErrors.length = _errs8;
|
|
3145
|
-
} else {
|
|
3146
|
-
vErrors = null;
|
|
3147
|
-
}
|
|
3148
|
-
}
|
|
3149
|
-
}
|
|
3150
|
-
const _errs10 = errors;
|
|
3151
|
-
let valid4 = true;
|
|
3152
|
-
const _errs11 = errors;
|
|
4414
|
+
var _valid0 = _errs4 === errors;
|
|
4415
|
+
valid0 = _valid0;
|
|
4416
|
+
ifClause0 = "then";
|
|
4417
|
+
} else {
|
|
4418
|
+
const _errs20 = errors;
|
|
4419
|
+
const _errs21 = errors;
|
|
4420
|
+
let valid13 = true;
|
|
4421
|
+
const _errs22 = errors;
|
|
3153
4422
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3154
4423
|
if (data.kind === void 0 && ("kind")) {
|
|
3155
|
-
const
|
|
4424
|
+
const err8 = {};
|
|
3156
4425
|
if (vErrors === null) {
|
|
3157
|
-
vErrors = [
|
|
4426
|
+
vErrors = [err8];
|
|
3158
4427
|
} else {
|
|
3159
|
-
vErrors.push(
|
|
4428
|
+
vErrors.push(err8);
|
|
3160
4429
|
}
|
|
3161
4430
|
errors++;
|
|
3162
4431
|
} else {
|
|
3163
4432
|
if (data.kind !== void 0) {
|
|
3164
4433
|
if ("state" !== data.kind) {
|
|
3165
|
-
const
|
|
4434
|
+
const err9 = {};
|
|
3166
4435
|
if (vErrors === null) {
|
|
3167
|
-
vErrors = [
|
|
4436
|
+
vErrors = [err9];
|
|
3168
4437
|
} else {
|
|
3169
|
-
vErrors.push(
|
|
4438
|
+
vErrors.push(err9);
|
|
3170
4439
|
}
|
|
3171
4440
|
errors++;
|
|
3172
4441
|
}
|
|
3173
4442
|
}
|
|
3174
4443
|
}
|
|
3175
4444
|
}
|
|
3176
|
-
var _valid1 =
|
|
3177
|
-
errors =
|
|
4445
|
+
var _valid1 = _errs22 === errors;
|
|
4446
|
+
errors = _errs21;
|
|
3178
4447
|
if (vErrors !== null) {
|
|
3179
|
-
if (
|
|
3180
|
-
vErrors.length =
|
|
4448
|
+
if (_errs21) {
|
|
4449
|
+
vErrors.length = _errs21;
|
|
3181
4450
|
} else {
|
|
3182
4451
|
vErrors = null;
|
|
3183
4452
|
}
|
|
3184
4453
|
}
|
|
3185
4454
|
let ifClause1;
|
|
3186
4455
|
if (_valid1) {
|
|
3187
|
-
const
|
|
4456
|
+
const _errs24 = errors;
|
|
3188
4457
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3189
4458
|
if (data.boxes !== void 0) {
|
|
3190
|
-
let
|
|
3191
|
-
if (Array.isArray(
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
4459
|
+
let data10 = data.boxes;
|
|
4460
|
+
if (Array.isArray(data10)) {
|
|
4461
|
+
if (data10.length < 1) {
|
|
4462
|
+
const err10 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
4463
|
+
if (vErrors === null) {
|
|
4464
|
+
vErrors = [err10];
|
|
4465
|
+
} else {
|
|
4466
|
+
vErrors.push(err10);
|
|
4467
|
+
}
|
|
4468
|
+
errors++;
|
|
4469
|
+
}
|
|
4470
|
+
const len2 = data10.length;
|
|
4471
|
+
for (let i2 = 0; i2 < len2; i2++) {
|
|
4472
|
+
let data11 = data10[i2];
|
|
4473
|
+
if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
|
|
4474
|
+
if (data11.id !== void 0) {
|
|
4475
|
+
let data12 = data11.id;
|
|
4476
|
+
const _errs28 = errors;
|
|
4477
|
+
const _errs29 = errors;
|
|
4478
|
+
if (!(data12 === "start" || data12 === "finish")) {
|
|
4479
|
+
const err11 = {};
|
|
3202
4480
|
if (vErrors === null) {
|
|
3203
|
-
vErrors = [
|
|
4481
|
+
vErrors = [err11];
|
|
3204
4482
|
} else {
|
|
3205
|
-
vErrors.push(
|
|
4483
|
+
vErrors.push(err11);
|
|
3206
4484
|
}
|
|
3207
4485
|
errors++;
|
|
3208
4486
|
}
|
|
3209
|
-
var
|
|
3210
|
-
if (
|
|
3211
|
-
const
|
|
4487
|
+
var valid19 = _errs29 === errors;
|
|
4488
|
+
if (valid19) {
|
|
4489
|
+
const err12 = { instancePath: instancePath + "/boxes/" + i2 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
3212
4490
|
if (vErrors === null) {
|
|
3213
|
-
vErrors = [
|
|
4491
|
+
vErrors = [err12];
|
|
3214
4492
|
} else {
|
|
3215
|
-
vErrors.push(
|
|
4493
|
+
vErrors.push(err12);
|
|
3216
4494
|
}
|
|
3217
4495
|
errors++;
|
|
3218
4496
|
} else {
|
|
3219
|
-
errors =
|
|
4497
|
+
errors = _errs28;
|
|
3220
4498
|
if (vErrors !== null) {
|
|
3221
|
-
if (
|
|
3222
|
-
vErrors.length =
|
|
4499
|
+
if (_errs28) {
|
|
4500
|
+
vErrors.length = _errs28;
|
|
3223
4501
|
} else {
|
|
3224
4502
|
vErrors = null;
|
|
3225
4503
|
}
|
|
@@ -3230,241 +4508,449 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3230
4508
|
}
|
|
3231
4509
|
}
|
|
3232
4510
|
}
|
|
4511
|
+
if (data.steps !== void 0) {
|
|
4512
|
+
let data13 = data.steps;
|
|
4513
|
+
if (Array.isArray(data13)) {
|
|
4514
|
+
const len3 = data13.length;
|
|
4515
|
+
for (let i3 = 0; i3 < len3; i3++) {
|
|
4516
|
+
let data14 = data13[i3];
|
|
4517
|
+
if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
|
|
4518
|
+
if (data14.events !== void 0) {
|
|
4519
|
+
let data15 = data14.events;
|
|
4520
|
+
if (Array.isArray(data15)) {
|
|
4521
|
+
const len4 = data15.length;
|
|
4522
|
+
for (let i4 = 0; i4 < len4; i4++) {
|
|
4523
|
+
let data16 = data15[i4];
|
|
4524
|
+
if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
|
|
4525
|
+
if (data16.type !== void 0) {
|
|
4526
|
+
let data17 = data16.type;
|
|
4527
|
+
const _errs36 = errors;
|
|
4528
|
+
const _errs37 = errors;
|
|
4529
|
+
if (!(data17 === "commit" || data17 === "branch")) {
|
|
4530
|
+
const err13 = {};
|
|
4531
|
+
if (vErrors === null) {
|
|
4532
|
+
vErrors = [err13];
|
|
4533
|
+
} else {
|
|
4534
|
+
vErrors.push(err13);
|
|
4535
|
+
}
|
|
4536
|
+
errors++;
|
|
4537
|
+
}
|
|
4538
|
+
var valid27 = _errs37 === errors;
|
|
4539
|
+
if (valid27) {
|
|
4540
|
+
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" };
|
|
4541
|
+
if (vErrors === null) {
|
|
4542
|
+
vErrors = [err14];
|
|
4543
|
+
} else {
|
|
4544
|
+
vErrors.push(err14);
|
|
4545
|
+
}
|
|
4546
|
+
errors++;
|
|
4547
|
+
} else {
|
|
4548
|
+
errors = _errs36;
|
|
4549
|
+
if (vErrors !== null) {
|
|
4550
|
+
if (_errs36) {
|
|
4551
|
+
vErrors.length = _errs36;
|
|
4552
|
+
} else {
|
|
4553
|
+
vErrors = null;
|
|
4554
|
+
}
|
|
4555
|
+
}
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
}
|
|
4566
|
+
if (data.git !== void 0) {
|
|
4567
|
+
const err15 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4568
|
+
if (vErrors === null) {
|
|
4569
|
+
vErrors = [err15];
|
|
4570
|
+
} else {
|
|
4571
|
+
vErrors.push(err15);
|
|
4572
|
+
}
|
|
4573
|
+
errors++;
|
|
4574
|
+
}
|
|
3233
4575
|
}
|
|
3234
|
-
var _valid1 =
|
|
3235
|
-
|
|
4576
|
+
var _valid1 = _errs24 === errors;
|
|
4577
|
+
valid13 = _valid1;
|
|
3236
4578
|
ifClause1 = "then";
|
|
3237
4579
|
} else {
|
|
3238
|
-
const
|
|
3239
|
-
const
|
|
3240
|
-
|
|
4580
|
+
const _errs41 = errors;
|
|
4581
|
+
const _errs42 = errors;
|
|
4582
|
+
let valid29 = true;
|
|
4583
|
+
const _errs43 = errors;
|
|
3241
4584
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3242
|
-
if (data.
|
|
3243
|
-
const
|
|
4585
|
+
if (data.kind === void 0 && ("kind")) {
|
|
4586
|
+
const err16 = {};
|
|
3244
4587
|
if (vErrors === null) {
|
|
3245
|
-
vErrors = [
|
|
4588
|
+
vErrors = [err16];
|
|
3246
4589
|
} else {
|
|
3247
|
-
vErrors.push(
|
|
4590
|
+
vErrors.push(err16);
|
|
3248
4591
|
}
|
|
3249
4592
|
errors++;
|
|
4593
|
+
} else {
|
|
4594
|
+
if (data.kind !== void 0) {
|
|
4595
|
+
if ("git" !== data.kind) {
|
|
4596
|
+
const err17 = {};
|
|
4597
|
+
if (vErrors === null) {
|
|
4598
|
+
vErrors = [err17];
|
|
4599
|
+
} else {
|
|
4600
|
+
vErrors.push(err17);
|
|
4601
|
+
}
|
|
4602
|
+
errors++;
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
3250
4605
|
}
|
|
3251
4606
|
}
|
|
3252
|
-
var
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
if (
|
|
3256
|
-
vErrors =
|
|
4607
|
+
var _valid2 = _errs43 === errors;
|
|
4608
|
+
errors = _errs42;
|
|
4609
|
+
if (vErrors !== null) {
|
|
4610
|
+
if (_errs42) {
|
|
4611
|
+
vErrors.length = _errs42;
|
|
3257
4612
|
} else {
|
|
3258
|
-
vErrors
|
|
4613
|
+
vErrors = null;
|
|
3259
4614
|
}
|
|
3260
|
-
|
|
4615
|
+
}
|
|
4616
|
+
let ifClause2;
|
|
4617
|
+
if (_valid2) {
|
|
4618
|
+
const _errs45 = errors;
|
|
4619
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4620
|
+
if (data.git === void 0) {
|
|
4621
|
+
const err18 = { instancePath, schemaPath: "#/else/else/then/required", keyword: "required", params: { missingProperty: "git" }, message: "must have required property 'git'" };
|
|
4622
|
+
if (vErrors === null) {
|
|
4623
|
+
vErrors = [err18];
|
|
4624
|
+
} else {
|
|
4625
|
+
vErrors.push(err18);
|
|
4626
|
+
}
|
|
4627
|
+
errors++;
|
|
4628
|
+
}
|
|
4629
|
+
if (data.state !== void 0) {
|
|
4630
|
+
const err19 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4631
|
+
if (vErrors === null) {
|
|
4632
|
+
vErrors = [err19];
|
|
4633
|
+
} else {
|
|
4634
|
+
vErrors.push(err19);
|
|
4635
|
+
}
|
|
4636
|
+
errors++;
|
|
4637
|
+
}
|
|
4638
|
+
if (data.regions !== void 0) {
|
|
4639
|
+
const err20 = { instancePath: instancePath + "/regions", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4640
|
+
if (vErrors === null) {
|
|
4641
|
+
vErrors = [err20];
|
|
4642
|
+
} else {
|
|
4643
|
+
vErrors.push(err20);
|
|
4644
|
+
}
|
|
4645
|
+
errors++;
|
|
4646
|
+
}
|
|
4647
|
+
}
|
|
4648
|
+
var _valid2 = _errs45 === errors;
|
|
4649
|
+
valid29 = _valid2;
|
|
4650
|
+
ifClause2 = "then";
|
|
3261
4651
|
} else {
|
|
3262
|
-
|
|
3263
|
-
if (
|
|
3264
|
-
if (
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
4652
|
+
const _errs52 = errors;
|
|
4653
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4654
|
+
if (data.boxes !== void 0) {
|
|
4655
|
+
let data22 = data.boxes;
|
|
4656
|
+
if (Array.isArray(data22)) {
|
|
4657
|
+
if (data22.length < 1) {
|
|
4658
|
+
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" };
|
|
4659
|
+
if (vErrors === null) {
|
|
4660
|
+
vErrors = [err21];
|
|
4661
|
+
} else {
|
|
4662
|
+
vErrors.push(err21);
|
|
4663
|
+
}
|
|
4664
|
+
errors++;
|
|
4665
|
+
}
|
|
4666
|
+
}
|
|
4667
|
+
}
|
|
4668
|
+
if (data.steps !== void 0) {
|
|
4669
|
+
let data23 = data.steps;
|
|
4670
|
+
if (Array.isArray(data23)) {
|
|
4671
|
+
const len5 = data23.length;
|
|
4672
|
+
for (let i5 = 0; i5 < len5; i5++) {
|
|
4673
|
+
let data24 = data23[i5];
|
|
4674
|
+
if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
|
|
4675
|
+
if (data24.events !== void 0) {
|
|
4676
|
+
let data25 = data24.events;
|
|
4677
|
+
if (Array.isArray(data25)) {
|
|
4678
|
+
const len6 = data25.length;
|
|
4679
|
+
for (let i6 = 0; i6 < len6; i6++) {
|
|
4680
|
+
let data26 = data25[i6];
|
|
4681
|
+
if (data26 && typeof data26 == "object" && !Array.isArray(data26)) {
|
|
4682
|
+
if (data26.type !== void 0) {
|
|
4683
|
+
let data27 = data26.type;
|
|
4684
|
+
const _errs60 = errors;
|
|
4685
|
+
const _errs61 = errors;
|
|
4686
|
+
if (!(data27 === "commit" || data27 === "branch")) {
|
|
4687
|
+
const err22 = {};
|
|
4688
|
+
if (vErrors === null) {
|
|
4689
|
+
vErrors = [err22];
|
|
4690
|
+
} else {
|
|
4691
|
+
vErrors.push(err22);
|
|
4692
|
+
}
|
|
4693
|
+
errors++;
|
|
4694
|
+
}
|
|
4695
|
+
var valid42 = _errs61 === errors;
|
|
4696
|
+
if (valid42) {
|
|
4697
|
+
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" };
|
|
4698
|
+
if (vErrors === null) {
|
|
4699
|
+
vErrors = [err23];
|
|
4700
|
+
} else {
|
|
4701
|
+
vErrors.push(err23);
|
|
4702
|
+
}
|
|
4703
|
+
errors++;
|
|
4704
|
+
} else {
|
|
4705
|
+
errors = _errs60;
|
|
4706
|
+
if (vErrors !== null) {
|
|
4707
|
+
if (_errs60) {
|
|
4708
|
+
vErrors.length = _errs60;
|
|
4709
|
+
} else {
|
|
4710
|
+
vErrors = null;
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
}
|
|
4715
|
+
}
|
|
4716
|
+
}
|
|
4717
|
+
}
|
|
4718
|
+
}
|
|
4719
|
+
}
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
}
|
|
4723
|
+
if (data.state !== void 0) {
|
|
4724
|
+
const err24 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4725
|
+
if (vErrors === null) {
|
|
4726
|
+
vErrors = [err24];
|
|
4727
|
+
} else {
|
|
4728
|
+
vErrors.push(err24);
|
|
4729
|
+
}
|
|
4730
|
+
errors++;
|
|
4731
|
+
}
|
|
4732
|
+
if (data.git !== void 0) {
|
|
4733
|
+
const err25 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4734
|
+
if (vErrors === null) {
|
|
4735
|
+
vErrors = [err25];
|
|
4736
|
+
} else {
|
|
4737
|
+
vErrors.push(err25);
|
|
4738
|
+
}
|
|
4739
|
+
errors++;
|
|
3268
4740
|
}
|
|
3269
4741
|
}
|
|
4742
|
+
var _valid2 = _errs52 === errors;
|
|
4743
|
+
valid29 = _valid2;
|
|
4744
|
+
ifClause2 = "else";
|
|
4745
|
+
}
|
|
4746
|
+
if (!valid29) {
|
|
4747
|
+
const err26 = { instancePath, schemaPath: "#/else/else/if", keyword: "if", params: { failingKeyword: ifClause2 }, message: 'must match "' + ifClause2 + '" schema' };
|
|
4748
|
+
if (vErrors === null) {
|
|
4749
|
+
vErrors = [err26];
|
|
4750
|
+
} else {
|
|
4751
|
+
vErrors.push(err26);
|
|
4752
|
+
}
|
|
4753
|
+
errors++;
|
|
3270
4754
|
}
|
|
3271
|
-
var _valid1 =
|
|
3272
|
-
|
|
4755
|
+
var _valid1 = _errs41 === errors;
|
|
4756
|
+
valid13 = _valid1;
|
|
3273
4757
|
ifClause1 = "else";
|
|
3274
4758
|
}
|
|
3275
|
-
if (!
|
|
3276
|
-
const
|
|
4759
|
+
if (!valid13) {
|
|
4760
|
+
const err27 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
|
|
3277
4761
|
if (vErrors === null) {
|
|
3278
|
-
vErrors = [
|
|
4762
|
+
vErrors = [err27];
|
|
3279
4763
|
} else {
|
|
3280
|
-
vErrors.push(
|
|
4764
|
+
vErrors.push(err27);
|
|
3281
4765
|
}
|
|
3282
4766
|
errors++;
|
|
3283
4767
|
}
|
|
3284
|
-
|
|
4768
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
4769
|
+
if (data.sequence !== void 0) {
|
|
4770
|
+
const err28 = { instancePath: instancePath + "/sequence", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
4771
|
+
if (vErrors === null) {
|
|
4772
|
+
vErrors = [err28];
|
|
4773
|
+
} else {
|
|
4774
|
+
vErrors.push(err28);
|
|
4775
|
+
}
|
|
4776
|
+
errors++;
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
var _valid0 = _errs20 === errors;
|
|
3285
4780
|
valid0 = _valid0;
|
|
3286
4781
|
ifClause0 = "else";
|
|
3287
4782
|
}
|
|
3288
4783
|
if (!valid0) {
|
|
3289
|
-
const
|
|
4784
|
+
const err29 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
|
|
3290
4785
|
if (vErrors === null) {
|
|
3291
|
-
vErrors = [
|
|
4786
|
+
vErrors = [err29];
|
|
3292
4787
|
} else {
|
|
3293
|
-
vErrors.push(
|
|
4788
|
+
vErrors.push(err29);
|
|
3294
4789
|
}
|
|
3295
4790
|
errors++;
|
|
3296
4791
|
}
|
|
3297
4792
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
3298
4793
|
if (data.version === void 0) {
|
|
3299
|
-
const
|
|
4794
|
+
const err30 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
|
|
3300
4795
|
if (vErrors === null) {
|
|
3301
|
-
vErrors = [
|
|
4796
|
+
vErrors = [err30];
|
|
3302
4797
|
} else {
|
|
3303
|
-
vErrors.push(
|
|
4798
|
+
vErrors.push(err30);
|
|
3304
4799
|
}
|
|
3305
4800
|
errors++;
|
|
3306
4801
|
}
|
|
3307
4802
|
if (data.kind === void 0) {
|
|
3308
|
-
const
|
|
4803
|
+
const err31 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
|
|
3309
4804
|
if (vErrors === null) {
|
|
3310
|
-
vErrors = [
|
|
4805
|
+
vErrors = [err31];
|
|
3311
4806
|
} else {
|
|
3312
|
-
vErrors.push(
|
|
4807
|
+
vErrors.push(err31);
|
|
3313
4808
|
}
|
|
3314
4809
|
errors++;
|
|
3315
4810
|
}
|
|
3316
4811
|
if (data.title === void 0) {
|
|
3317
|
-
const
|
|
4812
|
+
const err32 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
|
|
3318
4813
|
if (vErrors === null) {
|
|
3319
|
-
vErrors = [
|
|
4814
|
+
vErrors = [err32];
|
|
3320
4815
|
} else {
|
|
3321
|
-
vErrors.push(
|
|
4816
|
+
vErrors.push(err32);
|
|
3322
4817
|
}
|
|
3323
4818
|
errors++;
|
|
3324
4819
|
}
|
|
3325
4820
|
if (data.boxes === void 0) {
|
|
3326
|
-
const
|
|
4821
|
+
const err33 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
|
|
3327
4822
|
if (vErrors === null) {
|
|
3328
|
-
vErrors = [
|
|
4823
|
+
vErrors = [err33];
|
|
3329
4824
|
} else {
|
|
3330
|
-
vErrors.push(
|
|
4825
|
+
vErrors.push(err33);
|
|
3331
4826
|
}
|
|
3332
4827
|
errors++;
|
|
3333
4828
|
}
|
|
3334
4829
|
if (data.steps === void 0) {
|
|
3335
|
-
const
|
|
4830
|
+
const err34 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
|
|
3336
4831
|
if (vErrors === null) {
|
|
3337
|
-
vErrors = [
|
|
4832
|
+
vErrors = [err34];
|
|
3338
4833
|
} else {
|
|
3339
|
-
vErrors.push(
|
|
4834
|
+
vErrors.push(err34);
|
|
3340
4835
|
}
|
|
3341
4836
|
errors++;
|
|
3342
4837
|
}
|
|
3343
4838
|
for (const key0 in data) {
|
|
3344
4839
|
if (!func2.call(schema11.properties, key0)) {
|
|
3345
|
-
const
|
|
4840
|
+
const err35 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
3346
4841
|
if (vErrors === null) {
|
|
3347
|
-
vErrors = [
|
|
4842
|
+
vErrors = [err35];
|
|
3348
4843
|
} else {
|
|
3349
|
-
vErrors.push(
|
|
4844
|
+
vErrors.push(err35);
|
|
3350
4845
|
}
|
|
3351
4846
|
errors++;
|
|
3352
4847
|
}
|
|
3353
4848
|
}
|
|
3354
4849
|
if (data.version !== void 0) {
|
|
3355
|
-
let
|
|
3356
|
-
if (!(typeof
|
|
3357
|
-
const
|
|
4850
|
+
let data31 = data.version;
|
|
4851
|
+
if (!(typeof data31 == "number" && (!(data31 % 1) && !isNaN(data31)) && isFinite(data31))) {
|
|
4852
|
+
const err36 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
|
|
3358
4853
|
if (vErrors === null) {
|
|
3359
|
-
vErrors = [
|
|
4854
|
+
vErrors = [err36];
|
|
3360
4855
|
} else {
|
|
3361
|
-
vErrors.push(
|
|
4856
|
+
vErrors.push(err36);
|
|
3362
4857
|
}
|
|
3363
4858
|
errors++;
|
|
3364
4859
|
}
|
|
3365
|
-
if (typeof
|
|
3366
|
-
if (
|
|
3367
|
-
const
|
|
4860
|
+
if (typeof data31 == "number" && isFinite(data31)) {
|
|
4861
|
+
if (data31 < 1 || isNaN(data31)) {
|
|
4862
|
+
const err37 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
|
|
3368
4863
|
if (vErrors === null) {
|
|
3369
|
-
vErrors = [
|
|
4864
|
+
vErrors = [err37];
|
|
3370
4865
|
} else {
|
|
3371
|
-
vErrors.push(
|
|
4866
|
+
vErrors.push(err37);
|
|
3372
4867
|
}
|
|
3373
4868
|
errors++;
|
|
3374
4869
|
}
|
|
3375
4870
|
}
|
|
3376
4871
|
}
|
|
3377
4872
|
if (data.kind !== void 0) {
|
|
3378
|
-
let
|
|
3379
|
-
if (!(
|
|
3380
|
-
const
|
|
4873
|
+
let data32 = data.kind;
|
|
4874
|
+
if (!(data32 === "sequence" || data32 === "architecture" || data32 === "state" || data32 === "git")) {
|
|
4875
|
+
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" };
|
|
3381
4876
|
if (vErrors === null) {
|
|
3382
|
-
vErrors = [
|
|
4877
|
+
vErrors = [err38];
|
|
3383
4878
|
} else {
|
|
3384
|
-
vErrors.push(
|
|
4879
|
+
vErrors.push(err38);
|
|
3385
4880
|
}
|
|
3386
4881
|
errors++;
|
|
3387
4882
|
}
|
|
3388
4883
|
}
|
|
3389
4884
|
if (data.title !== void 0) {
|
|
3390
|
-
let
|
|
3391
|
-
if (typeof
|
|
3392
|
-
if (func3(
|
|
3393
|
-
const
|
|
4885
|
+
let data33 = data.title;
|
|
4886
|
+
if (typeof data33 === "string") {
|
|
4887
|
+
if (func3(data33) < 1) {
|
|
4888
|
+
const err39 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
3394
4889
|
if (vErrors === null) {
|
|
3395
|
-
vErrors = [
|
|
4890
|
+
vErrors = [err39];
|
|
3396
4891
|
} else {
|
|
3397
|
-
vErrors.push(
|
|
4892
|
+
vErrors.push(err39);
|
|
3398
4893
|
}
|
|
3399
4894
|
errors++;
|
|
3400
4895
|
}
|
|
3401
4896
|
} else {
|
|
3402
|
-
const
|
|
4897
|
+
const err40 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
3403
4898
|
if (vErrors === null) {
|
|
3404
|
-
vErrors = [
|
|
4899
|
+
vErrors = [err40];
|
|
3405
4900
|
} else {
|
|
3406
|
-
vErrors.push(
|
|
4901
|
+
vErrors.push(err40);
|
|
3407
4902
|
}
|
|
3408
4903
|
errors++;
|
|
3409
4904
|
}
|
|
3410
4905
|
}
|
|
3411
4906
|
if (data.view !== void 0) {
|
|
3412
|
-
let
|
|
3413
|
-
if (!(
|
|
3414
|
-
const
|
|
4907
|
+
let data34 = data.view;
|
|
4908
|
+
if (!(data34 === "fixed" || data34 === "follow")) {
|
|
4909
|
+
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" };
|
|
3415
4910
|
if (vErrors === null) {
|
|
3416
|
-
vErrors = [
|
|
4911
|
+
vErrors = [err41];
|
|
3417
4912
|
} else {
|
|
3418
|
-
vErrors.push(
|
|
4913
|
+
vErrors.push(err41);
|
|
3419
4914
|
}
|
|
3420
4915
|
errors++;
|
|
3421
4916
|
}
|
|
3422
4917
|
}
|
|
3423
4918
|
if (data.regions !== void 0) {
|
|
3424
|
-
let
|
|
3425
|
-
if (Array.isArray(
|
|
3426
|
-
const
|
|
3427
|
-
for (let
|
|
3428
|
-
if (!validate11(
|
|
4919
|
+
let data35 = data.regions;
|
|
4920
|
+
if (Array.isArray(data35)) {
|
|
4921
|
+
const len7 = data35.length;
|
|
4922
|
+
for (let i7 = 0; i7 < len7; i7++) {
|
|
4923
|
+
if (!validate11(data35[i7], { instancePath: instancePath + "/regions/" + i7, parentData: data35, parentDataProperty: i7, rootData })) {
|
|
3429
4924
|
vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);
|
|
3430
4925
|
errors = vErrors.length;
|
|
3431
4926
|
}
|
|
3432
4927
|
}
|
|
3433
4928
|
} else {
|
|
3434
|
-
const
|
|
4929
|
+
const err42 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3435
4930
|
if (vErrors === null) {
|
|
3436
|
-
vErrors = [
|
|
4931
|
+
vErrors = [err42];
|
|
3437
4932
|
} else {
|
|
3438
|
-
vErrors.push(
|
|
4933
|
+
vErrors.push(err42);
|
|
3439
4934
|
}
|
|
3440
4935
|
errors++;
|
|
3441
4936
|
}
|
|
3442
4937
|
}
|
|
3443
4938
|
if (data.boxes !== void 0) {
|
|
3444
|
-
let
|
|
3445
|
-
if (Array.isArray(
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
if (
|
|
3449
|
-
vErrors = [err28];
|
|
3450
|
-
} else {
|
|
3451
|
-
vErrors.push(err28);
|
|
3452
|
-
}
|
|
3453
|
-
errors++;
|
|
3454
|
-
}
|
|
3455
|
-
const len2 = data11.length;
|
|
3456
|
-
for (let i2 = 0; i2 < len2; i2++) {
|
|
3457
|
-
if (!validate13(data11[i2], { instancePath: instancePath + "/boxes/" + i2, parentData: data11, parentDataProperty: i2, rootData })) {
|
|
4939
|
+
let data37 = data.boxes;
|
|
4940
|
+
if (Array.isArray(data37)) {
|
|
4941
|
+
const len8 = data37.length;
|
|
4942
|
+
for (let i8 = 0; i8 < len8; i8++) {
|
|
4943
|
+
if (!validate13(data37[i8], { instancePath: instancePath + "/boxes/" + i8, parentData: data37, parentDataProperty: i8, rootData })) {
|
|
3458
4944
|
vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);
|
|
3459
4945
|
errors = vErrors.length;
|
|
3460
4946
|
}
|
|
3461
4947
|
}
|
|
3462
4948
|
} else {
|
|
3463
|
-
const
|
|
4949
|
+
const err43 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3464
4950
|
if (vErrors === null) {
|
|
3465
|
-
vErrors = [
|
|
4951
|
+
vErrors = [err43];
|
|
3466
4952
|
} else {
|
|
3467
|
-
vErrors.push(
|
|
4953
|
+
vErrors.push(err43);
|
|
3468
4954
|
}
|
|
3469
4955
|
errors++;
|
|
3470
4956
|
}
|
|
@@ -3476,30 +4962,30 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3476
4962
|
}
|
|
3477
4963
|
}
|
|
3478
4964
|
if (data.steps !== void 0) {
|
|
3479
|
-
let
|
|
3480
|
-
if (Array.isArray(
|
|
3481
|
-
if (
|
|
3482
|
-
const
|
|
4965
|
+
let data40 = data.steps;
|
|
4966
|
+
if (Array.isArray(data40)) {
|
|
4967
|
+
if (data40.length < 1) {
|
|
4968
|
+
const err44 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
3483
4969
|
if (vErrors === null) {
|
|
3484
|
-
vErrors = [
|
|
4970
|
+
vErrors = [err44];
|
|
3485
4971
|
} else {
|
|
3486
|
-
vErrors.push(
|
|
4972
|
+
vErrors.push(err44);
|
|
3487
4973
|
}
|
|
3488
4974
|
errors++;
|
|
3489
4975
|
}
|
|
3490
|
-
const
|
|
3491
|
-
for (let
|
|
3492
|
-
if (!validate17(
|
|
4976
|
+
const len9 = data40.length;
|
|
4977
|
+
for (let i9 = 0; i9 < len9; i9++) {
|
|
4978
|
+
if (!validate17(data40[i9], { instancePath: instancePath + "/steps/" + i9, parentData: data40, parentDataProperty: i9, rootData })) {
|
|
3493
4979
|
vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);
|
|
3494
4980
|
errors = vErrors.length;
|
|
3495
4981
|
}
|
|
3496
4982
|
}
|
|
3497
4983
|
} else {
|
|
3498
|
-
const
|
|
4984
|
+
const err45 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
3499
4985
|
if (vErrors === null) {
|
|
3500
|
-
vErrors = [
|
|
4986
|
+
vErrors = [err45];
|
|
3501
4987
|
} else {
|
|
3502
|
-
vErrors.push(
|
|
4988
|
+
vErrors.push(err45);
|
|
3503
4989
|
}
|
|
3504
4990
|
errors++;
|
|
3505
4991
|
}
|
|
@@ -3516,12 +5002,18 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3516
5002
|
errors = vErrors.length;
|
|
3517
5003
|
}
|
|
3518
5004
|
}
|
|
5005
|
+
if (data.git !== void 0) {
|
|
5006
|
+
if (!validate29(data.git, { instancePath: instancePath + "/git", parentData: data, parentDataProperty: "git", rootData })) {
|
|
5007
|
+
vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors);
|
|
5008
|
+
errors = vErrors.length;
|
|
5009
|
+
}
|
|
5010
|
+
}
|
|
3519
5011
|
} else {
|
|
3520
|
-
const
|
|
5012
|
+
const err46 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
3521
5013
|
if (vErrors === null) {
|
|
3522
|
-
vErrors = [
|
|
5014
|
+
vErrors = [err46];
|
|
3523
5015
|
} else {
|
|
3524
|
-
vErrors.push(
|
|
5016
|
+
vErrors.push(err46);
|
|
3525
5017
|
}
|
|
3526
5018
|
errors++;
|
|
3527
5019
|
}
|
|
@@ -3531,17 +5023,17 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
3531
5023
|
|
|
3532
5024
|
// src/schema.ts
|
|
3533
5025
|
var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
|
|
3534
|
-
var EVENT_TYPES = ["edge", "action", "swap", "strip"];
|
|
3535
|
-
var
|
|
3536
|
-
|
|
3537
|
-
"#/then/not": { field: "state", kind: "state" },
|
|
3538
|
-
"#/else/else/not": { field: "state", kind: "state" }
|
|
3539
|
-
};
|
|
5026
|
+
var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch"];
|
|
5027
|
+
var ABSENT = "#/definitions/absent/not";
|
|
5028
|
+
var ABSENT_KINDS = { regions: "sequence / architecture / state" };
|
|
3540
5029
|
var NOT_ALLOWED = {
|
|
3541
5030
|
carry: { field: "text", kind: "tag" }
|
|
3542
5031
|
};
|
|
3543
5032
|
var RESERVED_ID = /\/boxes\/items\/properties\/id\/not$/u;
|
|
5033
|
+
var GIT_EVENT = /\/events\/items\/properties\/type\/not$/u;
|
|
5034
|
+
var GIT_EVENTS = ["commit", "branch"];
|
|
3544
5035
|
var escape = (key) => key.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
5036
|
+
var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
|
|
3545
5037
|
function forbiddenOf(pattern) {
|
|
3546
5038
|
const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
|
|
3547
5039
|
if (inside === void 0) return void 0;
|
|
@@ -3565,7 +5057,10 @@ function toFieldError(error, errors, m) {
|
|
|
3565
5057
|
}
|
|
3566
5058
|
case "not": {
|
|
3567
5059
|
if (RESERVED_ID.test(error.schemaPath)) return { pointer: at2, message: m.reserved(STATE_ENDS) };
|
|
3568
|
-
|
|
5060
|
+
if (GIT_EVENT.test(error.schemaPath)) return { pointer: at2, message: m.kindOnly(GIT_EVENTS, "git") };
|
|
5061
|
+
const last = at2.slice(at2.lastIndexOf("/") + 1);
|
|
5062
|
+
if (error.schemaPath === ABSENT) return { pointer: at2, message: m.not({ field: last, kind: ABSENT_KINDS[last] ?? last }) };
|
|
5063
|
+
const allowed = NOT_ALLOWED[last];
|
|
3569
5064
|
return { pointer: allowed ? `${at2}/${allowed.field}` : at2, message: m.not(allowed) };
|
|
3570
5065
|
}
|
|
3571
5066
|
case "anyOf": {
|
|
@@ -3583,8 +5078,10 @@ function toFieldError(error, errors, m) {
|
|
|
3583
5078
|
return { pointer: at2, message: m.type(String(params.type)) };
|
|
3584
5079
|
case "minLength":
|
|
3585
5080
|
return { pointer: at2, message: m.minLength(Number(params.limit)) };
|
|
3586
|
-
case "pattern":
|
|
3587
|
-
|
|
5081
|
+
case "pattern": {
|
|
5082
|
+
const hex2 = HEX.exec(String(params.pattern));
|
|
5083
|
+
return { pointer: at2, message: hex2 ? m.hex(Number(hex2[1]), Number(hex2[2])) : m.pattern(forbiddenOf(String(params.pattern))) };
|
|
5084
|
+
}
|
|
3588
5085
|
case "minItems":
|
|
3589
5086
|
return { pointer: at2, message: m.minItems(Number(params.limit)) };
|
|
3590
5087
|
case "minimum":
|
|
@@ -3632,7 +5129,15 @@ function plan(step) {
|
|
|
3632
5129
|
let arrived;
|
|
3633
5130
|
let changes = 0;
|
|
3634
5131
|
step.events.forEach((event, e) => {
|
|
3635
|
-
if (event.type === "
|
|
5132
|
+
if (event.type === "commit" || event.type === "branch") {
|
|
5133
|
+
const a = cursor;
|
|
5134
|
+
const b = a + MOTION.draw;
|
|
5135
|
+
out.edges.push({ event: e, a, b, carries: false, coin: false, named: false });
|
|
5136
|
+
cursor = a + MOTION.stagger;
|
|
5137
|
+
arrived = b;
|
|
5138
|
+
changes = 0;
|
|
5139
|
+
out.busy = Math.max(out.busy, b);
|
|
5140
|
+
} else if (event.type === "edge") {
|
|
3636
5141
|
const carries = event.carry.kind !== "none";
|
|
3637
5142
|
const a = cursor;
|
|
3638
5143
|
const b = a + (carries ? MOTION.drawCarry : MOTION.draw);
|
|
@@ -3677,7 +5182,9 @@ function buildTimeline(diagram) {
|
|
|
3677
5182
|
for (const edge2 of p.edges) {
|
|
3678
5183
|
const a = span.start + edge2.a;
|
|
3679
5184
|
edges.push({ step: s, event: edge2.event, start: a, drawn: span.start + edge2.b, end: span.end });
|
|
3680
|
-
|
|
5185
|
+
const event = diagram.steps[s]?.events[edge2.event];
|
|
5186
|
+
const own = diagram.kind === "git" && event?.type === "edge" && event.carry.kind === "tag" && event.carry.text === event.from;
|
|
5187
|
+
if (edge2.carries && !own) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
|
|
3681
5188
|
if (edge2.named) named.push({ step: s, event: edge2.event, start: a + MOTION.labelDelay, end: span.end });
|
|
3682
5189
|
}
|
|
3683
5190
|
named.forEach((label2, k) => {
|
|
@@ -3786,6 +5293,38 @@ var ICONS = {
|
|
|
3786
5293
|
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"
|
|
3787
5294
|
};
|
|
3788
5295
|
|
|
5296
|
+
// src/render/ink.ts
|
|
5297
|
+
var ALWAYS = [[0, Number.POSITIVE_INFINITY]];
|
|
5298
|
+
var BITE = 0.5;
|
|
5299
|
+
var visible = (item, t) => item.shown.some(([a, b]) => a <= t && t < b);
|
|
5300
|
+
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 } : {} });
|
|
5301
|
+
function findOverlaps(inks, stills, traces = []) {
|
|
5302
|
+
const out = [];
|
|
5303
|
+
stills.forEach((t, step) => {
|
|
5304
|
+
const seen = inks.filter((ink) => visible(ink, t));
|
|
5305
|
+
seen.forEach((a, i) => {
|
|
5306
|
+
for (const b of seen.slice(i + 1)) {
|
|
5307
|
+
const w = Math.min(a.rect.x + a.rect.w, b.rect.x + b.rect.w) - Math.max(a.rect.x, b.rect.x);
|
|
5308
|
+
const h = Math.min(a.rect.y + a.rect.h, b.rect.y + b.rect.h) - Math.max(a.rect.y, b.rect.y);
|
|
5309
|
+
if (w > BITE && h > BITE) out.push({ kind: "texts", step, texts: [a.text, b.text], spots: [spotOf(a), spotOf(b)] });
|
|
5310
|
+
}
|
|
5311
|
+
});
|
|
5312
|
+
const lines = traces.filter((trace) => visible(trace, t));
|
|
5313
|
+
for (const ink of seen) {
|
|
5314
|
+
if (ink.boxed) continue;
|
|
5315
|
+
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)] });
|
|
5316
|
+
}
|
|
5317
|
+
});
|
|
5318
|
+
return out;
|
|
5319
|
+
}
|
|
5320
|
+
function describeOverlap(overlap, lang = "ja") {
|
|
5321
|
+
const t = FIGURE_TEXT[lang];
|
|
5322
|
+
const partName = (part) => part.kind === "icon" ? t.iconOf(part.box) : part.kind === "coin" ? t.coin : t.envelope;
|
|
5323
|
+
const name = (spot) => spot.badge ? t.badgeName(spot.text) : spot.part ? partName(spot.part) : t.quoted(spot.text);
|
|
5324
|
+
if (overlap.kind === "texts") return t.textsOverlap(name(overlap.spots[0]), name(overlap.spots[1]));
|
|
5325
|
+
return t.lineCrosses(overlap.line.from, overlap.line.to, name(overlap.spots[0]));
|
|
5326
|
+
}
|
|
5327
|
+
|
|
3789
5328
|
// src/render/parts.ts
|
|
3790
5329
|
var esc = (s) => s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
3791
5330
|
var r1 = (v) => Math.round(v * 100) / 100;
|
|
@@ -3822,6 +5361,10 @@ function arrowHead(points) {
|
|
|
3822
5361
|
const { arrow: a, arrowHalf: h } = LOOK.edge;
|
|
3823
5362
|
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)}`;
|
|
3824
5363
|
}
|
|
5364
|
+
function write(ink, cls, x, y, text2, style, shown = ALWAYS, anchor) {
|
|
5365
|
+
ink?.push({ text: text2, rect: textBox(text2, x, y, style, anchor), shown });
|
|
5366
|
+
return `<text class="${cls}" x="${r1(x)}" y="${r1(y)}"${anchor ? ` text-anchor="${anchor}"` : ""}>${esc(text2)}</text>`;
|
|
5367
|
+
}
|
|
3825
5368
|
function rangeKf(m, ranges2) {
|
|
3826
5369
|
const pts = [[0, { opacity: 0 }]];
|
|
3827
5370
|
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 }]);
|
|
@@ -3838,21 +5381,22 @@ function activeKf(ctx, on) {
|
|
|
3838
5381
|
}
|
|
3839
5382
|
return rangeKf(ctx.m, ranges2);
|
|
3840
5383
|
}
|
|
3841
|
-
function band(region) {
|
|
5384
|
+
function band(region, ink) {
|
|
3842
5385
|
const { radius, icon, iconRadius, iconScale, nameY, line } = LOOK.region;
|
|
3843
5386
|
const { x, y } = region.header;
|
|
3844
|
-
const lines = region.lines.map((t, k) =>
|
|
3845
|
-
const note = region.note ?
|
|
5387
|
+
const lines = region.lines.map((t, k) => write(ink, "dg-bz", x, region.y + nameY + k * line, t, TYPE.regionName)).join("");
|
|
5388
|
+
const note = region.note ? write(ink, "dg-bx", x, region.y + nameY + region.lines.length * line + 1, region.note, TYPE.regionNote) : "";
|
|
3846
5389
|
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)}` : "";
|
|
3847
5390
|
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>`;
|
|
3848
5391
|
}
|
|
3849
|
-
function subLines(box, m, changes, y) {
|
|
5392
|
+
function subLines(box, m, changes, y, ink) {
|
|
3850
5393
|
const seq = [[0, box.sub ?? "", "dg-ss"], ...changes];
|
|
3851
5394
|
return seq.map(([t, text2, cls], k) => {
|
|
3852
5395
|
const next = seq[k + 1]?.[0];
|
|
3853
5396
|
const anim = k === 0 ? next === void 0 ? "" : m.until(next - MOTION.untilFade) : next === void 0 ? m.rise(t) : m.rise(t, next - MOTION.untilFade);
|
|
3854
5397
|
if (text2 === "") return "";
|
|
3855
|
-
|
|
5398
|
+
const shown = [[k === 0 ? 0 : t, next === void 0 ? Number.POSITIVE_INFINITY : next - MOTION.untilFade]];
|
|
5399
|
+
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>`;
|
|
3856
5400
|
}).join("");
|
|
3857
5401
|
}
|
|
3858
5402
|
function cardFrame(box, ctx, act, y, h) {
|
|
@@ -3861,10 +5405,17 @@ function cardFrame(box, ctx, act, y, h) {
|
|
|
3861
5405
|
}
|
|
3862
5406
|
function card(box, ctx, on, changes, lit) {
|
|
3863
5407
|
const { icon, iconRadius, iconScale, iconY, nameY, subY } = LOOK.box;
|
|
3864
|
-
const subs = subLines(box, ctx.m, changes, box.cy + subY);
|
|
5408
|
+
const subs = subLines(box, ctx.m, changes, box.cy + subY, ctx.ink);
|
|
3865
5409
|
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;
|
|
3866
|
-
const
|
|
3867
|
-
|
|
5410
|
+
const ix = box.iconX ?? box.cx;
|
|
5411
|
+
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}"/>` : "";
|
|
5412
|
+
let mark = "";
|
|
5413
|
+
if (box.icon && ICONS[box.icon]) {
|
|
5414
|
+
const rect = { x: ix - icon / 2, y: box.cy + iconY - icon / 2, w: icon, h: icon };
|
|
5415
|
+
ctx.ink.push({ text: `${box.name} \u306E\u7D75\u67C4`, rect, shown: ALWAYS, boxed: true, part: { kind: "icon", box: box.name } });
|
|
5416
|
+
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)}`;
|
|
5417
|
+
}
|
|
5418
|
+
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>`;
|
|
3868
5419
|
}
|
|
3869
5420
|
function headCard(box, ctx, on, changes) {
|
|
3870
5421
|
const { pad: pad2, h, nameY, subY } = LOOK.follow.head;
|
|
@@ -3872,15 +5423,15 @@ function headCard(box, ctx, on, changes) {
|
|
|
3872
5423
|
const act = on.length > 0 ? activeKf(ctx, on) : void 0;
|
|
3873
5424
|
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>`;
|
|
3874
5425
|
}
|
|
3875
|
-
function ghostCard(box) {
|
|
5426
|
+
function ghostCard(box, ink) {
|
|
3876
5427
|
const { icon, iconRadius, iconScale, radius } = LOOK.box;
|
|
3877
5428
|
const G = LOOK.state.ghost;
|
|
3878
5429
|
const ix = box.x + G.pad + icon / 2;
|
|
3879
5430
|
const tx = box.x + G.pad + icon + G.gap;
|
|
3880
5431
|
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)}` : "";
|
|
3881
5432
|
const nameY = box.sub ? G.nameY : LOOK.baseline.mark;
|
|
3882
|
-
const sub = box.sub ?
|
|
3883
|
-
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}
|
|
5433
|
+
const sub = box.sub ? write(ink, "dg-ss", tx, box.cy + G.subY, box.sub, TYPE.boxSub, ALWAYS, "start") : "";
|
|
5434
|
+
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>`;
|
|
3884
5435
|
}
|
|
3885
5436
|
function doneMark(box, at2, ctx) {
|
|
3886
5437
|
const { r, inset } = LOOK.state.done;
|
|
@@ -3888,19 +5439,22 @@ function doneMark(box, at2, ctx) {
|
|
|
3888
5439
|
const y = box.y + inset;
|
|
3889
5440
|
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>`;
|
|
3890
5441
|
}
|
|
3891
|
-
function path(p, color) {
|
|
3892
|
-
|
|
5442
|
+
function path(p, color, ink, traces) {
|
|
5443
|
+
traces.push({ from: p.from, to: p.to, points: p.points, shown: ALWAYS });
|
|
5444
|
+
const sans = p.label?.family === "sans";
|
|
5445
|
+
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) : "";
|
|
3893
5446
|
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>`;
|
|
3894
5447
|
}
|
|
3895
|
-
function side(s, color) {
|
|
5448
|
+
function side(s, color, ink) {
|
|
3896
5449
|
const { pad: pad2 } = LOOK.state.side;
|
|
3897
5450
|
const title = s.y + pad2 + TYPE.regionName.size;
|
|
3898
|
-
const notes = s.notes.map((note, k) =>
|
|
3899
|
-
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}"
|
|
5451
|
+
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("");
|
|
5452
|
+
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>`;
|
|
3900
5453
|
}
|
|
3901
|
-
function endMark(e, color) {
|
|
5454
|
+
function endMark(e, color, ink) {
|
|
3902
5455
|
const { end } = LOOK.state;
|
|
3903
|
-
const
|
|
5456
|
+
const at2 = markText(e);
|
|
5457
|
+
const text2 = e.text === "" ? "" : write(ink, "dg-mark", at2[0], at2[1], e.text, TYPE.regionNote);
|
|
3904
5458
|
const x = r1(e.x);
|
|
3905
5459
|
const y = r1(e.y);
|
|
3906
5460
|
if (e.kind === "start") return `<g data-end="start"><circle class="dg-start" cx="${x}" cy="${y}" r="${e.r}"/>${text2}</g>`;
|
|
@@ -3912,6 +5466,7 @@ function lifeline(x, y1, y2) {
|
|
|
3912
5466
|
}
|
|
3913
5467
|
function edge(e, time, ctx, past = false) {
|
|
3914
5468
|
const { m } = ctx;
|
|
5469
|
+
ctx.traces.push({ from: e.from, to: e.to, points: e.points, shown: ALWAYS });
|
|
3915
5470
|
const d = pathOf(e.points);
|
|
3916
5471
|
const head = arrowHead(e.points);
|
|
3917
5472
|
const { start: a, drawn: b, end } = time;
|
|
@@ -3955,12 +5510,15 @@ function edge(e, time, ctx, past = false) {
|
|
|
3955
5510
|
function label(l, time, ctx) {
|
|
3956
5511
|
const ja3 = l.family === "sans" ? " dg-capj" : "";
|
|
3957
5512
|
const { radius } = LOOK.label;
|
|
5513
|
+
ctx.ink.push({ text: l.text, rect: l, shown: [[time.start, time.end]], boxed: true });
|
|
5514
|
+
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]] });
|
|
3958
5515
|
const x = r1(l.x + l.w / 2);
|
|
3959
5516
|
const y = r1(l.y + l.h / 2 + LOOK.baseline.label);
|
|
3960
5517
|
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>` : "";
|
|
3961
5518
|
return `${past}<g class="dg-cap${ja3} 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>`;
|
|
3962
5519
|
}
|
|
3963
5520
|
function action(a, at2, until, ctx) {
|
|
5521
|
+
ctx.ink.push({ text: a.text, rect: a, shown: [[at2, until]], boxed: true });
|
|
3964
5522
|
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>`;
|
|
3965
5523
|
}
|
|
3966
5524
|
function carrierShape(e, sh) {
|
|
@@ -3978,11 +5536,12 @@ var easeInOut = (t) => t < 0.5 ? 4 * t * t * t : 1 - (-2 * t + 2) ** 3 / 2;
|
|
|
3978
5536
|
function carrier(e, time, ctx) {
|
|
3979
5537
|
const { m } = ctx;
|
|
3980
5538
|
const n = LOOK.carrier.samples;
|
|
3981
|
-
const
|
|
5539
|
+
const route = e.wait ? [e.wait, ...e.points] : e.points;
|
|
5540
|
+
const length = pathLength(route);
|
|
3982
5541
|
const { depart: a, arrive: b, start: from, end: gone } = time;
|
|
3983
5542
|
const path2 = [];
|
|
3984
5543
|
for (let k = 0; k <= n; k++) {
|
|
3985
|
-
const [x, y] = along(
|
|
5544
|
+
const [x, y] = along(route, easeInOut(k / n) * length);
|
|
3986
5545
|
path2.push([a + (b - a) * k / n, x, y]);
|
|
3987
5546
|
}
|
|
3988
5547
|
const first = path2[0];
|
|
@@ -3991,6 +5550,12 @@ function carrier(e, time, ctx) {
|
|
|
3991
5550
|
const pts = [[0, first[1], first[2]], ...path2];
|
|
3992
5551
|
if (e.settle) pts.push([Math.min(b + 0.3, Math.max(gone, b + 0.01)), rest[0], rest[1]]);
|
|
3993
5552
|
pts.push([gone, rest[0], rest[1]], [m.total, rest[0], rest[1]]);
|
|
5553
|
+
const [hx, hy] = carrierHalf(e.carry);
|
|
5554
|
+
const name = e.carry.kind === "tag" ? e.carry.text : e.carry.kind === "coin" ? "\u786C\u8CA8" : "\u5C01\u7B52";
|
|
5555
|
+
const part = e.carry.kind === "tag" ? {} : { part: { kind: e.carry.kind === "coin" ? "coin" : "envelope" } };
|
|
5556
|
+
const box = (p) => ({ x: p[0] - hx, y: p[1] - hy, w: hx * 2, h: hy * 2 });
|
|
5557
|
+
if (a > from) ctx.ink.push({ text: name, rect: box([first[1], first[2]]), shown: [[from, a]], boxed: true, ...part });
|
|
5558
|
+
ctx.ink.push({ text: name, rect: box(rest), shown: [[b, gone]], boxed: true, ...part });
|
|
3994
5559
|
const fade = gone < m.last ? 0.05 : 0.18;
|
|
3995
5560
|
return `<g class="dg-a" style="${m.move(pts, m.blink(from + 0.02, gone, fade))}">${carrierShape(e, ctx.sh)}</g>`;
|
|
3996
5561
|
}
|
|
@@ -4000,15 +5565,30 @@ function badge(b, ctx, grey = false) {
|
|
|
4000
5565
|
const a = span.start;
|
|
4001
5566
|
const e = span.end;
|
|
4002
5567
|
const { r, ring: rr } = LOOK.badge;
|
|
5568
|
+
const shown = { visibility: "visible" };
|
|
5569
|
+
const hidden = { visibility: "hidden" };
|
|
5570
|
+
const swap = b.until === void 0 ? void 0 : ctx.t.steps[b.until].start;
|
|
5571
|
+
const next = swap !== void 0 && swap <= e + 1e-6;
|
|
4003
5572
|
const fill = m.kf([
|
|
4004
|
-
[0, { opacity: 0, transform: "scale(.5)" }],
|
|
4005
|
-
[a, { opacity: 0, transform: "scale(.5)" }, EASE.pop],
|
|
4006
|
-
[a + 0.35, { opacity: 1, transform: "scale(1)" }],
|
|
4007
|
-
[e, { opacity: 1, transform: "scale(1)" }, EASE.inOut],
|
|
4008
|
-
[e + 0.4, { opacity: 0, transform: "scale(1)" }],
|
|
4009
|
-
[m.total, { opacity: 0, transform: "scale(.5)" }]
|
|
5573
|
+
[0, { opacity: 0, transform: "scale(.5)", ...hidden }],
|
|
5574
|
+
[a, { opacity: 0, transform: "scale(.5)", ...hidden }, EASE.pop],
|
|
5575
|
+
[a + 0.35, { opacity: 1, transform: "scale(1)", ...shown }],
|
|
5576
|
+
[e, { opacity: 1, transform: "scale(1)", ...shown }, EASE.inOut],
|
|
5577
|
+
[e + (next ? MOTION.untilFade : 0.4), { opacity: 0, transform: "scale(1)", ...hidden }],
|
|
5578
|
+
[m.total, { opacity: 0, transform: "scale(.5)", ...hidden }]
|
|
5579
|
+
]);
|
|
5580
|
+
const pastEnd = swap ?? m.last;
|
|
5581
|
+
const past = next ? m.kf([
|
|
5582
|
+
[0, { opacity: 0, ...hidden }],
|
|
5583
|
+
[m.total, { opacity: 0, ...hidden }]
|
|
5584
|
+
]) : m.kf([
|
|
5585
|
+
[0, { opacity: 0, ...hidden }],
|
|
5586
|
+
[e, { opacity: 0, ...hidden }, EASE.inOut],
|
|
5587
|
+
[e + 0.4, { opacity: 1, ...shown }],
|
|
5588
|
+
[pastEnd, { opacity: 1, ...shown }, EASE.inOut],
|
|
5589
|
+
...swap === void 0 ? [] : [[swap + MOTION.untilFade, { opacity: 0, ...hidden }]],
|
|
5590
|
+
[m.total, { opacity: 0, ...hidden }]
|
|
4010
5591
|
]);
|
|
4011
|
-
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 }]]);
|
|
4012
5592
|
const ring = m.kf([
|
|
4013
5593
|
[0, { opacity: 0, transform: "scale(1)" }],
|
|
4014
5594
|
[a + 0.05, { opacity: 0, transform: "scale(1)" }],
|
|
@@ -4020,6 +5600,7 @@ function badge(b, ctx, grey = false) {
|
|
|
4020
5600
|
const y = r1(b.y);
|
|
4021
5601
|
const ty = r1(b.y + LOOK.baseline.badge);
|
|
4022
5602
|
const no = b.step + 1;
|
|
5603
|
+
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 });
|
|
4023
5604
|
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>`;
|
|
4024
5605
|
}
|
|
4025
5606
|
function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map()) {
|
|
@@ -4029,7 +5610,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4029
5610
|
const parts = [
|
|
4030
5611
|
`<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}/>`,
|
|
4031
5612
|
`<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>`,
|
|
4032
|
-
|
|
5613
|
+
write(ctx.ink, "dg-sh", s.x + S2.titleX, my + LOOK.baseline.stripTitle, s.title, TYPE.stripTitle)
|
|
4033
5614
|
];
|
|
4034
5615
|
s.fields.forEach((field, i) => {
|
|
4035
5616
|
const prev = s.fields[i - 1];
|
|
@@ -4037,7 +5618,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4037
5618
|
const sx = field.x - S2.fieldGap / 2;
|
|
4038
5619
|
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)}"/>`);
|
|
4039
5620
|
}
|
|
4040
|
-
parts.push(
|
|
5621
|
+
parts.push(write(ctx.ink, "dg-fl", field.x, field.y + S2.nameY, field.name, TYPE.fieldName));
|
|
4041
5622
|
const list2 = changes.get(field.name) ?? [];
|
|
4042
5623
|
const values = list2.filter((c) => c.value !== void 0);
|
|
4043
5624
|
const tags = list2.filter((c) => c.tag !== void 0);
|
|
@@ -4045,6 +5626,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4045
5626
|
const next = values[k + 1]?.at;
|
|
4046
5627
|
const value = c.value;
|
|
4047
5628
|
const cls = hasWide(value) ? "dg-fvj" : "dg-fv";
|
|
5629
|
+
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]] });
|
|
4048
5630
|
const textOf = (c2) => `<text class="${c2}" x="${r1(field.x)}" y="${r1(field.y + S2.valueY)}">${esc(value)}</text>`;
|
|
4049
5631
|
const text2 = textOf(cls);
|
|
4050
5632
|
if (!now) {
|
|
@@ -4064,6 +5646,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4064
5646
|
const x = field.x + (shown ? textWidth(shown, hasWide(shown) ? TYPE.fieldValueJa : TYPE.fieldValue) + S2.tagGap : 0);
|
|
4065
5647
|
const w = textWidth(tag, TYPE.tag) + S2.tagPadX * 2;
|
|
4066
5648
|
const y = field.y + S2.valueY - S2.tagH / 2 - LOOK.baseline.tag;
|
|
5649
|
+
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 });
|
|
4067
5650
|
parts.push(
|
|
4068
5651
|
`<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>`
|
|
4069
5652
|
);
|
|
@@ -4076,7 +5659,7 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4076
5659
|
const sx = t.x - S2.fieldGap / 2;
|
|
4077
5660
|
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)}"/>`);
|
|
4078
5661
|
}
|
|
4079
|
-
parts.push(
|
|
5662
|
+
parts.push(write(ctx.ink, "dg-fl", t.x, t.y + S2.nameY, t.title, TYPE.fieldName));
|
|
4080
5663
|
const dy = t.y + S2.valueY - TYPE.fieldValue.size / 3;
|
|
4081
5664
|
t.states.forEach((state, k) => {
|
|
4082
5665
|
const cx = r1(t.x + S2.trail.r + k * S2.trail.step);
|
|
@@ -4088,6 +5671,123 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
4088
5671
|
return parts.join("");
|
|
4089
5672
|
}
|
|
4090
5673
|
|
|
5674
|
+
// src/render/git.ts
|
|
5675
|
+
var r12 = (v) => Math.round(v * 100) / 100;
|
|
5676
|
+
var center = (r) => [r.x + r.w / 2, r.y + r.h / 2];
|
|
5677
|
+
function tagShape(text2, sh) {
|
|
5678
|
+
const C = LOOK.carrier;
|
|
5679
|
+
const ja3 = hasWide(text2);
|
|
5680
|
+
const w = textWidth(text2, ja3 ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
|
|
5681
|
+
return `<rect class="dg-car" x="${r12(-w / 2)}" y="${ -18 / 2}" width="${r12(w)}" height="${C.tagH}" rx="${C.tagH / 2}" ${sh}/><text class="dg-car-t${ja3 ? " dg-car-tj" : ""}" y="${LOOK.baseline.carrier}" text-anchor="middle">${esc(text2)}</text>`;
|
|
5682
|
+
}
|
|
5683
|
+
function drawGit(layout, diagram, timeline, ctx) {
|
|
5684
|
+
const { m } = ctx;
|
|
5685
|
+
const G = LOOK.git;
|
|
5686
|
+
const timeOf = (step, event) => timeline.edges.find((t) => t.step === step && t.event === event);
|
|
5687
|
+
const links = layout.links.map((l) => {
|
|
5688
|
+
const time = timeOf(l.step, l.event);
|
|
5689
|
+
if (!time) return "";
|
|
5690
|
+
ctx.traces.push({ from: l.from, to: l.to, points: l.points, shown: [[time.start, Number.POSITIVE_INFINITY]] });
|
|
5691
|
+
const d = pathOf(l.points);
|
|
5692
|
+
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>`;
|
|
5693
|
+
const kf = m.kf([
|
|
5694
|
+
[0, { opacity: 0, "stroke-dashoffset": 1 }],
|
|
5695
|
+
[time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
|
|
5696
|
+
[time.start + 0.05, { opacity: 1 }],
|
|
5697
|
+
[time.drawn, { "stroke-dashoffset": 0 }],
|
|
5698
|
+
[m.last, { opacity: 1, "stroke-dashoffset": 0 }, EASE.inOut],
|
|
5699
|
+
[m.total, { opacity: 0, "stroke-dashoffset": 0 }]
|
|
5700
|
+
]);
|
|
5701
|
+
return `<g style="${cs(l.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${d}" style="${kf}"/></g>`;
|
|
5702
|
+
}).join("");
|
|
5703
|
+
const commits = layout.commits.map((c) => {
|
|
5704
|
+
const at2 = timeOf(c.step, c.event)?.drawn ?? 0;
|
|
5705
|
+
const ring = { x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 };
|
|
5706
|
+
ctx.ink.push({ text: c.id, rect: ring, shown: [[at2, Number.POSITIVE_INFINITY]], boxed: true });
|
|
5707
|
+
const lines2 = (c.text?.lines ?? []).map((line, k) => {
|
|
5708
|
+
const hash = k === 0 && c.hash !== void 0;
|
|
5709
|
+
const baseline = c.text?.baselines[k] ?? c.cy;
|
|
5710
|
+
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");
|
|
5711
|
+
}).join("");
|
|
5712
|
+
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>`;
|
|
5713
|
+
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>`;
|
|
5714
|
+
const text2 = lines2 === "" ? "" : `<g class="dg-a" style="${m.vis(at2)}">${lines2}</g>`;
|
|
5715
|
+
const orphanAt = c.orphan === void 0 ? void 0 : timeOf(c.orphan, c.orphanEvent ?? 0)?.drawn;
|
|
5716
|
+
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>`;
|
|
5717
|
+
return `<g data-commit="${esc(c.id)}" style="${cs(c.color)}">${node}${text2}${orphan}</g>`;
|
|
5718
|
+
}).join("");
|
|
5719
|
+
const lines = layout.moves.flatMap((mv) => {
|
|
5720
|
+
const time = timeOf(mv.step, mv.event);
|
|
5721
|
+
if (!mv.line || !time) return [];
|
|
5722
|
+
const end = timeline.steps[mv.step].end;
|
|
5723
|
+
ctx.traces.push({ from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, shown: [[time.start, end + 0.4]] });
|
|
5724
|
+
const kf = m.kf([
|
|
5725
|
+
[0, { opacity: 0, "stroke-dashoffset": 1 }],
|
|
5726
|
+
[time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
|
|
5727
|
+
[time.start + 0.05, { opacity: 1 }],
|
|
5728
|
+
[time.drawn, { "stroke-dashoffset": 0 }],
|
|
5729
|
+
[end, { opacity: 1 }, EASE.inOut],
|
|
5730
|
+
[end + 0.4, { opacity: 0 }],
|
|
5731
|
+
[m.total, { opacity: 0, "stroke-dashoffset": 0 }]
|
|
5732
|
+
]);
|
|
5733
|
+
return [`<g style="${cs(mv.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${pathOf(mv.line)}" style="${kf}"/></g>`];
|
|
5734
|
+
}).join("");
|
|
5735
|
+
const carried = timeline.carriers.flatMap((t) => {
|
|
5736
|
+
const mv = layout.moves.find((x) => x.step === t.step && x.event === t.event && x.line);
|
|
5737
|
+
const source = diagram.steps[t.step]?.events[t.event];
|
|
5738
|
+
if (!mv?.line || source?.type !== "edge") return [];
|
|
5739
|
+
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 };
|
|
5740
|
+
return [carrier(edge2, { ...t, start: t.depart, end: t.arrive + MOTION.fade }, ctx)];
|
|
5741
|
+
}).join("");
|
|
5742
|
+
const refs = [...new Set(layout.moves.map((mv) => mv.ref))];
|
|
5743
|
+
const tags = refs.map((ref) => tagMotion(ref, layout.moves.filter((mv) => mv.ref === ref), timeOf, ctx)).join("") + carried;
|
|
5744
|
+
return { links, lines, commits, tags };
|
|
5745
|
+
}
|
|
5746
|
+
function tagMotion(ref, list2, timeOf, ctx) {
|
|
5747
|
+
const { m } = ctx;
|
|
5748
|
+
const points = [];
|
|
5749
|
+
const fades = [[0, { opacity: 0 }]];
|
|
5750
|
+
let on = false;
|
|
5751
|
+
let rest;
|
|
5752
|
+
const leave = (t) => {
|
|
5753
|
+
if (rest) ctx.ink.push({ text: ref, rect: rest.rect, shown: [[rest.since, t]], boxed: true });
|
|
5754
|
+
rest = void 0;
|
|
5755
|
+
};
|
|
5756
|
+
for (const mv of list2) {
|
|
5757
|
+
const time = timeOf(mv.step, mv.event);
|
|
5758
|
+
if (!time) continue;
|
|
5759
|
+
const { start: a, drawn: b } = time;
|
|
5760
|
+
const from = mv.from ? center(mv.from) : void 0;
|
|
5761
|
+
const to = mv.to ? center(mv.to) : void 0;
|
|
5762
|
+
leave(a);
|
|
5763
|
+
if (mv.carried && from && to && on) {
|
|
5764
|
+
points.push([a + MOTION.fade, from[0], from[1]], [b - MOTION.fade, to[0], to[1]]);
|
|
5765
|
+
fades.push([a, { opacity: 1 }, EASE.inOut], [a + MOTION.fade, { opacity: 0 }], [b - MOTION.fade, { opacity: 0 }, EASE.out], [b, { opacity: 1 }]);
|
|
5766
|
+
rest = { rect: mv.to, since: b };
|
|
5767
|
+
continue;
|
|
5768
|
+
}
|
|
5769
|
+
if (from) points.push([a, from[0], from[1]]);
|
|
5770
|
+
if (to) points.push([b, to[0], to[1]]);
|
|
5771
|
+
if (to && !on) {
|
|
5772
|
+
const show = from ? a : b - MOTION.fade;
|
|
5773
|
+
fades.push([show, { opacity: 0 }, EASE.out], [show + MOTION.fade, { opacity: 1 }]);
|
|
5774
|
+
on = true;
|
|
5775
|
+
} else if (!to && on) {
|
|
5776
|
+
fades.push([b, { opacity: 1 }, EASE.inOut], [b + MOTION.untilFade, { opacity: 0 }]);
|
|
5777
|
+
on = false;
|
|
5778
|
+
}
|
|
5779
|
+
if (mv.to) rest = { rect: mv.to, since: b };
|
|
5780
|
+
}
|
|
5781
|
+
leave(Number.POSITIVE_INFINITY);
|
|
5782
|
+
if (points.length === 0) return "";
|
|
5783
|
+
const first = points[0];
|
|
5784
|
+
const last = points[points.length - 1];
|
|
5785
|
+
if (on) fades.push([m.last, { opacity: 1 }, EASE.inOut], [m.total, { opacity: 0 }]);
|
|
5786
|
+
else fades.push([m.total, { opacity: 0 }]);
|
|
5787
|
+
const style = m.move([[0, first[1], first[2]], ...points, [m.total, last[1], last[2]]], fades);
|
|
5788
|
+
return `<g class="dg-a" data-ref="${esc(ref)}" style="${style}">${tagShape(ref, ctx.sh)}</g>`;
|
|
5789
|
+
}
|
|
5790
|
+
|
|
4091
5791
|
// src/render/motion.ts
|
|
4092
5792
|
var r2 = (v) => Math.round(v * 100) / 100;
|
|
4093
5793
|
var Motion = class {
|
|
@@ -4195,6 +5895,7 @@ var PART_CSS = [
|
|
|
4195
5895
|
`.dg-halo{fill:none;stroke:var(--c);stroke-width:${S.halo};stroke-opacity:.16}`,
|
|
4196
5896
|
`.dg-on{fill:none;stroke:var(--c);stroke-width:${S.on}}`,
|
|
4197
5897
|
`.dg-ic{fill:${mix(X.icon)}}`,
|
|
5898
|
+
`.dg-slot{fill:none;stroke:${mix(X.slot, "transparent")};stroke-width:${S.slot};stroke-dasharray:3 3}`,
|
|
4198
5899
|
`.dg-gl{fill:none;stroke:var(--c);stroke-width:${S.glyph};stroke-linecap:round;stroke-linejoin:round}`,
|
|
4199
5900
|
`.dg-sn{${font(TYPE.boxName)};fill:var(--ink)}`,
|
|
4200
5901
|
`.dg-ss{${font(TYPE.boxSub)};fill:var(--mute)}`,
|
|
@@ -4211,7 +5912,7 @@ var PART_CSS = [
|
|
|
4211
5912
|
".dg-bd{cursor:pointer}",
|
|
4212
5913
|
".dg-bdf{fill:var(--c)}",
|
|
4213
5914
|
`.dg-bdft{${font(TYPE.badge)};fill:var(--on-c)}`,
|
|
4214
|
-
`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${S.badgeRing}}`,
|
|
5915
|
+
`.dg-bdr{fill:none;stroke:var(--c);stroke-width:${S.badgeRing};pointer-events:none}`,
|
|
4215
5916
|
`.dg-bdp{fill:${mix(X.badgePast)};stroke:${mix(X.badgePastEdge, "transparent")};stroke-width:${S.hair}}`,
|
|
4216
5917
|
`.dg-bdpt{${font(TYPE.badge)};fill:var(--ct)}`,
|
|
4217
5918
|
`.dg-bdp-g{fill:var(--surf);stroke:${PAST};stroke-width:${S.hair}}`,
|
|
@@ -4257,6 +5958,14 @@ var PART_CSS = [
|
|
|
4257
5958
|
`.dg-mark{${font(TYPE.regionNote)};fill:var(--mute)}`,
|
|
4258
5959
|
`.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${S.done}}`,
|
|
4259
5960
|
`.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${S.glyph};stroke-linecap:round;stroke-linejoin:round}`,
|
|
5961
|
+
`.dg-git-l{fill:none;stroke:var(--c);stroke-width:${S.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,
|
|
5962
|
+
`.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${S.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,
|
|
5963
|
+
`.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${S.git}}`,
|
|
5964
|
+
`.dg-git-id{${font(TYPE.gitId)};fill:var(--ct)}`,
|
|
5965
|
+
`.dg-git-h{${font(TYPE.gitHash)};fill:var(--mute)}`,
|
|
5966
|
+
`.dg-git-n{${font(TYPE.gitNote)};fill:var(--ink2)}`,
|
|
5967
|
+
`.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${S.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,
|
|
5968
|
+
`.dg-git-oldl{${font(TYPE.gitId)};fill:var(--ct);opacity:.55}`,
|
|
4260
5969
|
".dg-vp-bg{fill:var(--bg)}",
|
|
4261
5970
|
".dg-vp-frame{fill:none;stroke:var(--hair)}",
|
|
4262
5971
|
".dg-hd-bg{fill:var(--bg)}",
|
|
@@ -4340,23 +6049,36 @@ function fieldChanges(diagram, timeline, layout) {
|
|
|
4340
6049
|
}
|
|
4341
6050
|
return out;
|
|
4342
6051
|
}
|
|
4343
|
-
function
|
|
6052
|
+
function fadeBefore(l, time, steps) {
|
|
6053
|
+
if (l.until === void 0 || !time.after) return time;
|
|
6054
|
+
const cut = steps[l.until].start;
|
|
6055
|
+
const { after, ...rest } = time;
|
|
6056
|
+
return cut > after.start ? { ...rest, after: { start: after.start, end: Math.min(after.end, cut) } } : rest;
|
|
6057
|
+
}
|
|
6058
|
+
function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], traces = []) {
|
|
4344
6059
|
const id = nameOf(`${JSON.stringify(diagram)}|${palette.id}|${theme}|${follow ? `${follow.width}|${follow.lang}` : ""}`);
|
|
4345
6060
|
const m = new Motion(`dg${id}`, timeline.total, timeline.last);
|
|
4346
|
-
const ctx = { m, t: timeline, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end };
|
|
6061
|
+
const ctx = { m, t: timeline, sh: `filter="url(#dg-sh-${id})"`, end: timeline.steps[timeline.steps.length - 1].end, ink, traces };
|
|
4347
6062
|
const on = involved(diagram);
|
|
4348
6063
|
const subs = subChanges(diagram, timeline, layout.kind !== "sequence");
|
|
4349
6064
|
const L = { band: [], base: [], lit: [], node: [], badge: [], top: [] };
|
|
4350
|
-
for (const region of layout.regions) L.band.push(band(region));
|
|
6065
|
+
for (const region of layout.regions) L.band.push(band(region, ink));
|
|
4351
6066
|
const ghostColor = layout.boxes.find((b) => b.ghost)?.color ?? "slate";
|
|
4352
|
-
if (layout.side) L.band.push(side(layout.side, ghostColor));
|
|
6067
|
+
if (layout.side) L.band.push(side(layout.side, ghostColor, ink));
|
|
4353
6068
|
const boxColor = (id2, ghost) => layout.boxes.find((b) => b.id === id2 && (ghost === void 0 || b.ghost === ghost))?.color;
|
|
4354
|
-
for (const p of layout.paths) L.base.push(path(p, boxColor(p.to, true) ?? boxColor(p.from) ?? ghostColor));
|
|
4355
|
-
for (const e of layout.ends) L.node.push(endMark(e, ghostColor));
|
|
6069
|
+
for (const p of layout.paths) L.base.push(path(p, boxColor(p.to, true) ?? boxColor(p.from) ?? ghostColor, ink, traces));
|
|
6070
|
+
for (const e of layout.ends) L.node.push(endMark(e, ghostColor, ink));
|
|
4356
6071
|
const isState = layout.kind === "state";
|
|
4357
6072
|
const arrivals = new Map((timeline.states ?? []).flatMap((s) => s.lit[0] ? [[s.box, s.lit[0].start]] : []));
|
|
4358
6073
|
if (layout.strip) L.band.push(strip(layout.strip, fieldChanges(diagram, timeline, layout), ctx, isState, arrivals));
|
|
4359
6074
|
for (const line of layout.lifelines) L.base.push(lifeline(line.x, line.y1, line.y2));
|
|
6075
|
+
if (isGitLayout(layout)) {
|
|
6076
|
+
const git = drawGit(layout, diagram, timeline, ctx);
|
|
6077
|
+
L.base.push(git.links);
|
|
6078
|
+
L.lit.push(git.lines);
|
|
6079
|
+
L.node.push(git.commits);
|
|
6080
|
+
L.top.push(git.tags);
|
|
6081
|
+
}
|
|
4360
6082
|
for (const e of layout.edges) {
|
|
4361
6083
|
const time = timeline.edges.find((t) => t.step === e.step && t.event === e.event);
|
|
4362
6084
|
if (!time) continue;
|
|
@@ -4367,7 +6089,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow) {
|
|
|
4367
6089
|
const states = new Map((timeline.states ?? []).map((s) => [s.box, s]));
|
|
4368
6090
|
for (const box of layout.boxes) {
|
|
4369
6091
|
if (box.ghost) {
|
|
4370
|
-
L.node.push(ghostCard(box));
|
|
6092
|
+
L.node.push(ghostCard(box, ink));
|
|
4371
6093
|
continue;
|
|
4372
6094
|
}
|
|
4373
6095
|
const state = states.get(box.id);
|
|
@@ -4377,7 +6099,7 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow) {
|
|
|
4377
6099
|
for (const b of layout.badges) L.badge.push(badge(b, ctx, isState));
|
|
4378
6100
|
for (const l of layout.labels) {
|
|
4379
6101
|
const time = timeline.labels.find((t) => t.step === l.step && t.event === l.event);
|
|
4380
|
-
if (time) L.top.push(label(l, time, ctx));
|
|
6102
|
+
if (time) L.top.push(label(l, fadeBefore(l, time, timeline.steps), ctx));
|
|
4381
6103
|
}
|
|
4382
6104
|
for (const a of layout.actions) {
|
|
4383
6105
|
const time = timeline.events.find((t) => t.step === a.step && t.event === a.event);
|
|
@@ -4395,14 +6117,14 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow) {
|
|
|
4395
6117
|
const css = `.dg-${id}{${FONT_VARS};--T:${timeline.total}s;${paletteVars(palette, theme)}}${PART_CSS}${m.frames.join("")}`;
|
|
4396
6118
|
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>`;
|
|
4397
6119
|
}
|
|
4398
|
-
function
|
|
6120
|
+
function union2(rects) {
|
|
4399
6121
|
const x = Math.min(...rects.map((r) => r.x));
|
|
4400
6122
|
const y = Math.min(...rects.map((r) => r.y));
|
|
4401
6123
|
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 };
|
|
4402
6124
|
}
|
|
4403
6125
|
function focusOf(layout, diagram, step) {
|
|
4404
6126
|
const rects = focusParts(layout, diagram, step);
|
|
4405
|
-
return rects.length === 0 ? void 0 :
|
|
6127
|
+
return rects.length === 0 ? void 0 : union2(rects);
|
|
4406
6128
|
}
|
|
4407
6129
|
function badgeFocus(badge2, parts, vw, vh) {
|
|
4408
6130
|
const room = LOOK.badge.r + LOOK.follow.badgeRoom;
|
|
@@ -4410,7 +6132,7 @@ function badgeFocus(badge2, parts, vw, vh) {
|
|
|
4410
6132
|
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));
|
|
4411
6133
|
let held = { x: bx - room, y: by - room, w: room * 2, h: room * 2 };
|
|
4412
6134
|
for (const p of [...parts].sort((a, b) => away(a) - away(b))) {
|
|
4413
|
-
const next =
|
|
6135
|
+
const next = union2([held, p]);
|
|
4414
6136
|
if (next.w <= vw && next.h <= vh) held = next;
|
|
4415
6137
|
}
|
|
4416
6138
|
return held;
|
|
@@ -4508,19 +6230,25 @@ function renderDiagram(input, options = {}) {
|
|
|
4508
6230
|
const read2 = readDiagram(input, { lang });
|
|
4509
6231
|
if (!read2.ok) throw new Error(FIGURE_TEXT[lang].cannotDraw(read2.errors.map((e) => `${e.pointer} ${e.message}`).join(" / ")));
|
|
4510
6232
|
const diagram = read2.diagram;
|
|
6233
|
+
const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : diagram.kind === "git" ? layoutGit(diagram) : layoutArchitecture(diagram);
|
|
6234
|
+
return renderLayout(diagram, layout, buildTimeline(diagram), options);
|
|
6235
|
+
}
|
|
6236
|
+
function renderLayout(diagram, layout, timeline, options = {}) {
|
|
4511
6237
|
const palette = resolvePalette(options.palette);
|
|
4512
6238
|
const theme = options.theme === "dark" ? "dark" : "light";
|
|
4513
|
-
const
|
|
4514
|
-
const
|
|
6239
|
+
const ink = [];
|
|
6240
|
+
const traces = [];
|
|
6241
|
+
const svg = drawSvg(diagram, layout, timeline, palette, theme, void 0, ink, traces);
|
|
4515
6242
|
return {
|
|
4516
|
-
svg
|
|
6243
|
+
svg,
|
|
4517
6244
|
palette: palette.id,
|
|
4518
6245
|
theme,
|
|
4519
6246
|
...diagram.view ? { view: diagram.view } : {},
|
|
4520
6247
|
fonts: { ...FONTS },
|
|
4521
6248
|
layout,
|
|
4522
6249
|
timeline,
|
|
4523
|
-
diagram
|
|
6250
|
+
diagram,
|
|
6251
|
+
overlaps: findOverlaps(ink, timeline.stills, traces)
|
|
4524
6252
|
};
|
|
4525
6253
|
}
|
|
4526
6254
|
|
|
@@ -4539,7 +6267,7 @@ var pad = (n) => String(n).padStart(2, "0");
|
|
|
4539
6267
|
var stepNo = (step, count) => `${pad(step + 1)}/${pad(count)}`;
|
|
4540
6268
|
var require_ = createRequire(import.meta.url);
|
|
4541
6269
|
var SCRIPTS = {
|
|
4542
|
-
"/mediabunny.js": join(dirname(require_.resolve("mediabunny")), "mediabunny.min.mjs"),
|
|
6270
|
+
"/mediabunny.js": join$1(dirname(require_.resolve("mediabunny")), "mediabunny.min.mjs"),
|
|
4543
6271
|
"/gifenc.js": require_.resolve("gifenc/dist/gifenc.esm.js")
|
|
4544
6272
|
};
|
|
4545
6273
|
var SCALE = 2;
|
|
@@ -4761,7 +6489,7 @@ async function fontFaces(chars) {
|
|
|
4761
6489
|
const faces = await Promise.all(
|
|
4762
6490
|
PACKAGES.flatMap(({ family, name }) => {
|
|
4763
6491
|
const base = dirname(require_2.resolve(`@fontsource-variable/${name}/unicode.json`));
|
|
4764
|
-
const table = JSON.parse(readFileSync(join(base, "unicode.json"), "utf8"));
|
|
6492
|
+
const table = JSON.parse(readFileSync(join$1(base, "unicode.json"), "utf8"));
|
|
4765
6493
|
return Object.entries(table).map(async ([key, list2]) => {
|
|
4766
6494
|
const span = ranges(list2);
|
|
4767
6495
|
const own = chars.filter((char) => {
|
|
@@ -4769,7 +6497,7 @@ async function fontFaces(chars) {
|
|
|
4769
6497
|
return span.some(([from, to]) => code >= from && code <= to);
|
|
4770
6498
|
});
|
|
4771
6499
|
if (!own.length) return "";
|
|
4772
|
-
const file = join(base, "files", `${name}-${key.replace(/[[\]]/g, "")}-wght-normal.woff2`);
|
|
6500
|
+
const file = join$1(base, "files", `${name}-${key.replace(/[[\]]/g, "")}-wght-normal.woff2`);
|
|
4773
6501
|
const woff2 = await subsetFont(await readFile(file), own.join(""), { targetFormat: "woff2", variationAxes: { wght: WEIGHT } });
|
|
4774
6502
|
const unicode = own.map((char) => hex(char.codePointAt(0) ?? 0)).join(",");
|
|
4775
6503
|
return `@font-face{font-family:"${family}";font-style:normal;font-display:block;font-weight:${WEIGHT.min} ${WEIGHT.max};src:url(data:font/woff2;base64,${woff2.toString("base64")}) format("woff2");unicode-range:${unicode}}`;
|
|
@@ -4854,14 +6582,14 @@ async function exportDiagram(input, options) {
|
|
|
4854
6582
|
}
|
|
4855
6583
|
}
|
|
4856
6584
|
const files = writeOutputs(options.outDir, options.name ?? "diagram", outputs);
|
|
4857
|
-
return { files, view, frames, ...sizeOf(videoSvg) };
|
|
6585
|
+
return { files, view, frames, ...sizeOf(videoSvg), overlaps: rendered.overlaps };
|
|
4858
6586
|
}
|
|
4859
6587
|
function writeOutputs(outDir, name, outputs) {
|
|
4860
6588
|
const created = mkdirSync(outDir, { recursive: true });
|
|
4861
6589
|
const files = {};
|
|
4862
6590
|
try {
|
|
4863
6591
|
for (const [format, data] of outputs) {
|
|
4864
|
-
const path2 = join(outDir, `${name}.${format}`);
|
|
6592
|
+
const path2 = join$1(outDir, `${name}.${format}`);
|
|
4865
6593
|
writeFileSync(path2, data);
|
|
4866
6594
|
files[format] = path2;
|
|
4867
6595
|
}
|
|
@@ -4907,8 +6635,8 @@ var ja2 = () => {
|
|
|
4907
6635
|
sayTwice: "1 \u3064\u306E\u6BB5\u306B say \u306F 1 \u3064\u307E\u3067\u3002\u9577\u3044\u672C\u6587\u306F say \u306E\u4E0B\u306B\u5B57\u4E0B\u3052\u3057\u3066\u7D9A\u3051\u308B",
|
|
4908
6636
|
codeTwice: "1 \u3064\u306E\u6BB5\u306B code \u306F 1 \u884C\u307E\u3067",
|
|
4909
6637
|
emptyCode: "code \u306E\u5F8C\u308D\u306B\u547D\u4EE4\u3092\u66F8\u304F",
|
|
4910
|
-
declarationInStep: "group \u3068 box \u3068 strip \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
|
|
4911
|
-
stepLineBeforeStep: "\u7DDA\u3068 say \u3068 code \u3068 act \u3068 note \u3068 set \u306F step \u306E\u4E0B\u306B\u66F8\u304F",
|
|
6638
|
+
declarationInStep: "group \u3068 box \u3068 strip \u3068 branch \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
|
|
6639
|
+
stepLineBeforeStep: "\u7DDA\u3068 say \u3068 code \u3068 act \u3068 note \u3068 set \u3068 commit \u3068\u679D\u3092\u5207\u308B\u884C\u306F step \u306E\u4E0B\u306B\u66F8\u304F",
|
|
4912
6640
|
nestedGroup: "group \u306E\u4E2D\u306B group \u306F\u66F8\u3051\u306A\u3044\u3002\u5148\u306B end \u3067\u9589\u3058\u308B",
|
|
4913
6641
|
strayEnd: "end \u306E\u524D\u306B\u3001\u9589\u3058\u308B group \u304C\u7121\u3044",
|
|
4914
6642
|
endTakesNothing: "end \u306E\u5F8C\u308D\u306B\u306F\u4F55\u3082\u66F8\u304B\u306A\u3044",
|
|
@@ -4940,7 +6668,20 @@ var ja2 = () => {
|
|
|
4940
6668
|
reservedId: (id) => `${id} \u306F\u72B6\u614B\u9077\u79FB\u56F3\u306E\u59CB\u307E\u308A\u3068\u7D42\u308F\u308A\u306E\u5370\u306E\u540D\u524D\u3067\u3001\u7BB1\u306E\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,
|
|
4941
6669
|
intoStart: "start \u3078\u5165\u308B\u7DDA\u306F\u66F8\u3051\u306A\u3044\u3002start \u306F\u59CB\u307E\u308A\u306E\u5370\u3067\u3001\u7DDA\u306F start \u304B\u3089\u51FA\u308B",
|
|
4942
6670
|
outOfFinish: "finish \u304B\u3089\u51FA\u308B\u7DDA\u306F\u66F8\u3051\u306A\u3044\u3002finish \u306F\u7D42\u308F\u308A\u306E\u5370\u3067\u3001\u7DDA\u306F finish \u3078\u5165\u308B",
|
|
4943
|
-
pathNoAttrs: "\u6700\u521D\u306E step \u3088\u308A\u524D\u306E\u7DDA\u306F\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044\u9053\u306A\u306E\u3067\u3001\u5C5E\u6027 (carry \u3068 tag \u3068 side) \u3092\u66F8\u3051\u306A\u3044"
|
|
6671
|
+
pathNoAttrs: "\u6700\u521D\u306E step \u3088\u308A\u524D\u306E\u7DDA\u306F\u4ECA\u56DE\u306F\u901A\u3089\u306A\u3044\u9053\u306A\u306E\u3067\u3001\u5C5E\u6027 (carry \u3068 tag \u3068 side) \u3092\u66F8\u3051\u306A\u3044",
|
|
6672
|
+
gitOnly: (word) => `${word} \u306E\u884C\u306F git (\u679D\u5206\u304B\u308C\u306E\u56F3) \u3067\u3060\u3051\u66F8\u3051\u308B`,
|
|
6673
|
+
gitNoGroup: "git (\u679D\u5206\u304B\u308C\u306E\u56F3) \u306B\u306F group \u3092\u66F8\u3051\u306A\u3044\u3002\u679D\u306F branch \u306E\u884C\u3067\u5BA3\u8A00\u3059\u308B",
|
|
6674
|
+
noBranches: "branch \u306E\u884C\u3067\u679D\u3092 1 \u3064\u4EE5\u4E0A\u5BA3\u8A00\u3059\u308B",
|
|
6675
|
+
branchShape: "branch \u306F branch <\u540D\u672D> [note: <\u6DFB\u3048\u66F8\u304D>] \u306E\u5F62\u3067\u66F8\u304F",
|
|
6676
|
+
commitShape: "commit \u306F commit <\u540D\u672D> on <\u679D> [hash: <hash>, note: <\u4E00\u8A00>] \u306E\u5F62\u3067\u66F8\u304F\u3002\u5F53\u3066\u76F4\u3057\u306F copy <commit> \u3092\u3001\u53D6\u308A\u8FBC\u307F\u306F merge <\u679D> \u3092 on <\u679D> \u306E\u5F8C\u308D\u306B\u66F8\u304F",
|
|
6677
|
+
fromShape: "\u679D\u3092\u5207\u308B\u884C\u306F <\u679D> from <commit> \u306E\u5F62\u3067\u66F8\u304F",
|
|
6678
|
+
undeclaredBranch: (id) => `${id} \u3068\u3044\u3046\u679D\u306F\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044`,
|
|
6679
|
+
undeclaredRef: (id) => `${id} \u3068\u3044\u3046\u679D\u306F\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044\u3002\u672D\u3092\u52D5\u304B\u3059\u7DDA\u306F\u679D\u306E\u540D\u672D\u304B HEAD \u304B\u3089\u5F15\u304F`,
|
|
6680
|
+
noCommit: (id) => `${id} \u3068\u3044\u3046 commit \u306F\u307E\u3060\u7A4D\u3093\u3067\u3044\u306A\u3044`,
|
|
6681
|
+
emptyBranch: (id) => `${id} \u306E\u679D\u306F\u307E\u3060\u3069\u306E commit \u3082\u6307\u3057\u3066\u3044\u306A\u3044\u306E\u3067\u53D6\u308A\u8FBC\u3081\u306A\u3044`,
|
|
6682
|
+
mergeSelf: (id) => `${id} \u306F\u7A4D\u3080\u679D\u306A\u306E\u3067\u3001\u53D6\u308A\u8FBC\u3080\u679D\u306B\u3067\u304D\u306A\u3044`,
|
|
6683
|
+
headReserved: (name) => `${name} \u306F\u679D\u5206\u304B\u308C\u306E\u56F3\u3067\u4ECA\u3044\u308B\u5834\u6240\u306E\u672D\u306E\u540D\u524D\u3067\u3001\u540D\u672D\u306B\u4F7F\u3048\u306A\u3044`,
|
|
6684
|
+
badHash: "hash \u306F 0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 4 \u304B\u3089 40 \u5B57\u306B\u3059\u308B"
|
|
4944
6685
|
};
|
|
4945
6686
|
};
|
|
4946
6687
|
var en2 = () => {
|
|
@@ -4976,8 +6717,8 @@ var en2 = () => {
|
|
|
4976
6717
|
sayTwice: "A step takes one say. Continue a long body on indented lines below it",
|
|
4977
6718
|
codeTwice: "A step takes at most one code line",
|
|
4978
6719
|
emptyCode: "Write the command after code",
|
|
4979
|
-
declarationInStep: "Write group, box and
|
|
4980
|
-
stepLineBeforeStep: "Write lines, say, code, act, note and
|
|
6720
|
+
declarationInStep: "Write group, box, strip and branch before the first step",
|
|
6721
|
+
stepLineBeforeStep: "Write lines, say, code, act, note, set, commit and branch cuts under a step",
|
|
4981
6722
|
nestedGroup: "A group cannot hold another group. Close it with end first",
|
|
4982
6723
|
strayEnd: "There is no group for this end to close",
|
|
4983
6724
|
endTakesNothing: "Write nothing after end",
|
|
@@ -5009,7 +6750,20 @@ var en2 = () => {
|
|
|
5009
6750
|
reservedId: (id) => `${id} names the start or end mark of a state diagram and cannot be a box id`,
|
|
5010
6751
|
intoStart: "A line cannot go into start. start is the start mark, and lines leave it",
|
|
5011
6752
|
outOfFinish: "A line cannot leave finish. finish is the end mark, and lines go into it",
|
|
5012
|
-
pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)"
|
|
6753
|
+
pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)",
|
|
6754
|
+
gitOnly: (word) => `${word} lines can be written only in git diagrams`,
|
|
6755
|
+
gitNoGroup: "A git diagram takes no group. Declare branches with branch lines",
|
|
6756
|
+
noBranches: "Declare at least one branch with a branch line",
|
|
6757
|
+
branchShape: "Write a branch as branch <id> [note: <note>]",
|
|
6758
|
+
commitShape: "Write a commit as commit <id> on <branch> [hash: <hash>, note: <note>]. For a replayed commit add copy <commit>, and for a merge commit add merge <branch>, after on <branch>",
|
|
6759
|
+
fromShape: "Write a branch cut as <branch> from <commit>",
|
|
6760
|
+
undeclaredBranch: (id) => `No branch named ${id} is declared`,
|
|
6761
|
+
undeclaredRef: (id) => `No branch named ${id} is declared. A line that moves a ref starts from a branch id or HEAD`,
|
|
6762
|
+
noCommit: (id) => `No commit named ${id} has been made yet`,
|
|
6763
|
+
emptyBranch: (id) => `Branch ${id} does not point at any commit yet, so it cannot be merged`,
|
|
6764
|
+
mergeSelf: (id) => `${id} is the branch being committed to, so it cannot be the branch merged in`,
|
|
6765
|
+
headReserved: (name) => `${name} names where you are in a git diagram and cannot be an id`,
|
|
6766
|
+
badHash: "Write a hash as 4 to 40 characters of 0-9 and a-f"
|
|
5013
6767
|
};
|
|
5014
6768
|
};
|
|
5015
6769
|
var MESSAGES = { ja: ja2(), en: en2() };
|
|
@@ -5040,6 +6794,9 @@ var NotationError = class extends Error {
|
|
|
5040
6794
|
var fail = (source, index, message) => new NotationError(source.line, columnOf(source, index), message);
|
|
5041
6795
|
var ID = /^[^\s[\]「」=:]+$/u;
|
|
5042
6796
|
var EDGE = /^([^\s:[\]]+?)\s*->\s*([^\s:[\]]+)/du;
|
|
6797
|
+
var COMMIT = new RegExp(`^commit\\s+([^\\s[]+)(?:\\s+${ON}\\s+([^\\s[]+))?(?:\\s+${COPY}\\s+([^\\s[]+))?(?:\\s+${MERGE}\\s+([^\\s[]+))?`, "du");
|
|
6798
|
+
var CUT = new RegExp(`^([^\\s[]+)\\s+${FROM}(?:\\s+([^\\s[]+))?\\s*$`, "du");
|
|
6799
|
+
var HASH = /^[0-9a-f]{4,40}$/u;
|
|
5043
6800
|
var isOneOf = (list2, word) => list2.includes(word);
|
|
5044
6801
|
function skipSpaces(text2, at2) {
|
|
5045
6802
|
let i = at2;
|
|
@@ -5188,6 +6945,10 @@ function parseLines(lines, m) {
|
|
|
5188
6945
|
if (shown && !isOneOf(VIEWS, shown.value)) throw fail(head, shown.at, m.badView);
|
|
5189
6946
|
const view = shown?.value;
|
|
5190
6947
|
const isState = kind === "state";
|
|
6948
|
+
const isGit = kind === "git";
|
|
6949
|
+
const branches = [];
|
|
6950
|
+
const commits = /* @__PURE__ */ new Set();
|
|
6951
|
+
const tips = /* @__PURE__ */ new Map();
|
|
5191
6952
|
const regions = [];
|
|
5192
6953
|
const boxes = [];
|
|
5193
6954
|
const paths = [];
|
|
@@ -5204,13 +6965,27 @@ function parseLines(lines, m) {
|
|
|
5204
6965
|
if (!boxes.some((box) => box.id === id)) throw fail(source, at2, m.undeclaredBox(id));
|
|
5205
6966
|
return id;
|
|
5206
6967
|
};
|
|
6968
|
+
const branchAt = (source, id, at2) => {
|
|
6969
|
+
if (!tips.has(id)) throw fail(source, at2, m.undeclaredBranch(id));
|
|
6970
|
+
return id;
|
|
6971
|
+
};
|
|
6972
|
+
const commitAt = (source, id, at2) => {
|
|
6973
|
+
if (!commits.has(id)) throw fail(source, at2, m.noCommit(id));
|
|
6974
|
+
return id;
|
|
6975
|
+
};
|
|
5207
6976
|
const endAt = (source, id, at2, side2) => {
|
|
6977
|
+
if (isGit) {
|
|
6978
|
+
if (side2 === "to") return commitAt(source, id, at2);
|
|
6979
|
+
if (id !== HEAD && !tips.has(id)) throw fail(source, at2, m.undeclaredRef(id));
|
|
6980
|
+
return id;
|
|
6981
|
+
}
|
|
5208
6982
|
if (!isState || !isOneOf(STATE_ENDS, id)) return boxAt(source, id, at2);
|
|
5209
6983
|
if (id === "start" !== (side2 === "from")) throw fail(source, at2, id === "start" ? m.intoStart : m.outOfFinish);
|
|
5210
6984
|
return id;
|
|
5211
6985
|
};
|
|
5212
6986
|
const notReserved = (source, id, at2) => {
|
|
5213
6987
|
if (isState && isOneOf(STATE_ENDS, id)) throw fail(source, at2, m.reservedId(id));
|
|
6988
|
+
if (isGit && id === HEAD) throw fail(source, at2, m.headReserved(id));
|
|
5214
6989
|
};
|
|
5215
6990
|
const inStep = (source) => {
|
|
5216
6991
|
if (!building) throw fail(source, 0, m.stepLineBeforeStep);
|
|
@@ -5240,7 +7015,13 @@ function parseLines(lines, m) {
|
|
|
5240
7015
|
else inStep(source).events.push(readEdge(source, edge2));
|
|
5241
7016
|
continue;
|
|
5242
7017
|
}
|
|
5243
|
-
const word = text2.split(/\s
|
|
7018
|
+
const [word = "", second] = text2.split(/\s+/u);
|
|
7019
|
+
if (isGit && tips.has(word) && second === FROM) {
|
|
7020
|
+
const step = inStep(source);
|
|
7021
|
+
step.events.push(readCut(source));
|
|
7022
|
+
continue;
|
|
7023
|
+
}
|
|
7024
|
+
if (!isGit && (word === "branch" || word === "commit")) throw fail(source, 0, m.gitOnly(word));
|
|
5244
7025
|
if (!isOneOf(HEADS, word)) {
|
|
5245
7026
|
const old = oldForm(text2, building !== void 0);
|
|
5246
7027
|
throw fail(source, 0, old ? m.oldForm(old.word, old.shape) : m.unknownHead(word));
|
|
@@ -5294,11 +7075,20 @@ function parseLines(lines, m) {
|
|
|
5294
7075
|
case "set":
|
|
5295
7076
|
inStep(source).events.push(readSet(source));
|
|
5296
7077
|
break;
|
|
7078
|
+
case "branch":
|
|
7079
|
+
readBranch(source);
|
|
7080
|
+
break;
|
|
7081
|
+
case "commit": {
|
|
7082
|
+
const step = inStep(source);
|
|
7083
|
+
step.events.push(readCommit(source));
|
|
7084
|
+
break;
|
|
7085
|
+
}
|
|
5297
7086
|
}
|
|
5298
7087
|
}
|
|
5299
7088
|
if (group) throw fail(group.source, 0, m.unclosedGroup(group.id));
|
|
5300
7089
|
finish();
|
|
5301
|
-
if (
|
|
7090
|
+
if (isGit && branches.length === 0) throw fail(head, 0, m.noBranches);
|
|
7091
|
+
if (boxes.length === 0 && !isGit) throw fail(head, 0, m.noBoxes);
|
|
5302
7092
|
if (steps.length === 0) throw fail(head, 0, m.noSteps);
|
|
5303
7093
|
return {
|
|
5304
7094
|
version: FORMAT_VERSION,
|
|
@@ -5310,10 +7100,12 @@ function parseLines(lines, m) {
|
|
|
5310
7100
|
...strip2 ? { strip: strip2 } : {},
|
|
5311
7101
|
steps,
|
|
5312
7102
|
...kind === "sequence" ? { sequence: { lifelines: boxes.map((box) => box.id) } } : {},
|
|
5313
|
-
...paths.length > 0 ? { state: { paths } } : {}
|
|
7103
|
+
...paths.length > 0 ? { state: { paths } } : {},
|
|
7104
|
+
...isGit ? { git: { branches } } : {}
|
|
5314
7105
|
};
|
|
5315
7106
|
function readGroup(source) {
|
|
5316
7107
|
beforeSteps(source);
|
|
7108
|
+
if (isGit) throw fail(source, 0, m.gitNoGroup);
|
|
5317
7109
|
if (group) throw fail(source, 0, m.nestedGroup);
|
|
5318
7110
|
const declared = readDeclared(source, "group", ATTRS.group, m);
|
|
5319
7111
|
if (regions.some((region) => region.id === declared.id)) {
|
|
@@ -5339,6 +7131,62 @@ function parseLines(lines, m) {
|
|
|
5339
7131
|
...group ? { region: group.id } : {}
|
|
5340
7132
|
});
|
|
5341
7133
|
}
|
|
7134
|
+
function readBranch(source) {
|
|
7135
|
+
beforeSteps(source);
|
|
7136
|
+
const declared = readDeclared(source, "branch", ATTRS.branch, m);
|
|
7137
|
+
if (declared.name !== void 0) throw fail(source, 0, m.branchShape);
|
|
7138
|
+
notReserved(source, declared.id, declared.idAt);
|
|
7139
|
+
declare(source, declared.id, declared.idAt);
|
|
7140
|
+
const note = declared.attrs.get("note")?.value;
|
|
7141
|
+
branches.push({ id: declared.id, ...note !== void 0 ? { note } : {} });
|
|
7142
|
+
tips.set(declared.id, null);
|
|
7143
|
+
}
|
|
7144
|
+
function readCommit(source) {
|
|
7145
|
+
const text2 = source.text;
|
|
7146
|
+
const found = COMMIT.exec(text2);
|
|
7147
|
+
const at2 = (k) => found?.indices?.[k]?.[0] ?? 0;
|
|
7148
|
+
const id = found?.[1];
|
|
7149
|
+
const on = found?.[2];
|
|
7150
|
+
if (!found || id === void 0 || on === void 0) throw fail(source, 0, m.commitShape);
|
|
7151
|
+
const rest2 = skipSpaces(text2, found[0].length);
|
|
7152
|
+
if (rest2 < text2.length && text2[rest2] !== "[") throw fail(source, rest2, m.commitShape);
|
|
7153
|
+
if (!ID.test(id)) throw fail(source, at2(1), m.badId(id));
|
|
7154
|
+
notReserved(source, id, at2(1));
|
|
7155
|
+
declare(source, id, at2(1));
|
|
7156
|
+
const branch = branchAt(source, on, at2(2));
|
|
7157
|
+
const copy = found[3] === void 0 ? void 0 : commitAt(source, found[3], at2(3));
|
|
7158
|
+
const merge = found[4] === void 0 ? void 0 : mergedAt(source, found[4], at2(4), branch);
|
|
7159
|
+
const attrs = rest2 < text2.length ? readAttrs(source, rest2, ATTRS.commit, m) : /* @__PURE__ */ new Map();
|
|
7160
|
+
const hash = attrs.get("hash");
|
|
7161
|
+
if (hash && !HASH.test(hash.value)) throw fail(source, hash.at, m.badHash);
|
|
7162
|
+
const note = attrs.get("note")?.value;
|
|
7163
|
+
commits.add(id);
|
|
7164
|
+
if (copy === void 0) tips.set(branch, id);
|
|
7165
|
+
return {
|
|
7166
|
+
type: "commit",
|
|
7167
|
+
id,
|
|
7168
|
+
branch,
|
|
7169
|
+
...copy !== void 0 ? { copy } : {},
|
|
7170
|
+
...merge !== void 0 ? { merge } : {},
|
|
7171
|
+
...hash ? { hash: hash.value } : {},
|
|
7172
|
+
...note !== void 0 ? { note } : {}
|
|
7173
|
+
};
|
|
7174
|
+
}
|
|
7175
|
+
function mergedAt(source, id, at2, into) {
|
|
7176
|
+
branchAt(source, id, at2);
|
|
7177
|
+
if (id === into) throw fail(source, at2, m.mergeSelf(id));
|
|
7178
|
+
if (tips.get(id) === null) throw fail(source, at2, m.emptyBranch(id));
|
|
7179
|
+
return id;
|
|
7180
|
+
}
|
|
7181
|
+
function readCut(source) {
|
|
7182
|
+
const found = CUT.exec(source.text);
|
|
7183
|
+
const branch = found?.[1];
|
|
7184
|
+
const from = found?.[2];
|
|
7185
|
+
if (!found || branch === void 0 || from === void 0) throw fail(source, 0, m.fromShape);
|
|
7186
|
+
commitAt(source, from, found.indices?.[2]?.[0] ?? 0);
|
|
7187
|
+
tips.set(branch, from);
|
|
7188
|
+
return { type: "branch", branch, from };
|
|
7189
|
+
}
|
|
5342
7190
|
function readStrip(source) {
|
|
5343
7191
|
beforeSteps(source);
|
|
5344
7192
|
if (strip2) throw fail(source, 0, m.stripTwice);
|
|
@@ -5412,9 +7260,10 @@ function parseLines(lines, m) {
|
|
|
5412
7260
|
if (carried && !isOneOf(CARRIES, carried.value)) throw fail(source, carried.at, m.badCarry);
|
|
5413
7261
|
const side2 = attrs.get("side");
|
|
5414
7262
|
if (side2 && !isOneOf(SIDES, side2.value)) throw fail(source, side2.at, m.badSide);
|
|
5415
|
-
let carry = { kind: "envelope" };
|
|
7263
|
+
let carry = isGit ? { kind: "tag", text: from } : { kind: "envelope" };
|
|
5416
7264
|
if (tag) carry = { kind: "tag", text: tag.value };
|
|
5417
7265
|
else if (carried) carry = carried.value === "coin" ? { kind: "coin" } : { kind: "none" };
|
|
7266
|
+
if (isGit && from !== HEAD) tips.set(from, to);
|
|
5418
7267
|
return {
|
|
5419
7268
|
type: "edge",
|
|
5420
7269
|
from,
|
|
@@ -5502,7 +7351,8 @@ var CLI_TEXT = {
|
|
|
5502
7351
|
badJson: (path2, detail2) => `JSON \u3068\u3057\u3066\u8AAD\u3081\u306A\u3044: ${path2} (${detail2})`,
|
|
5503
7352
|
cannotWrite: (path2, detail2) => `\u66F8\u304D\u51FA\u305B\u306A\u3044: ${path2} (${detail2})`,
|
|
5504
7353
|
badValue: (option, value, allowed) => `\u4F7F\u3048\u306A\u3044\u5024: ${option} ${value} (${allowed})`,
|
|
5505
|
-
allowed: { lang: "ja \u304B en", theme: "light \u304B dark", positive: "0 \u3088\u308A\u5927\u304D\u3044\u6570", format: `${FORMATS.join(" / ")} \u3092 , \u3067\u533A\u5207\u308B` }
|
|
7354
|
+
allowed: { lang: "ja \u304B en", theme: "light \u304B dark", positive: "0 \u3088\u308A\u5927\u304D\u3044\u6570", format: `${FORMATS.join(" / ")} \u3092 , \u3067\u533A\u5207\u308B` },
|
|
7355
|
+
overlap: (step, text2) => `\u6BB5 ${step}: ${text2}`
|
|
5506
7356
|
},
|
|
5507
7357
|
en: {
|
|
5508
7358
|
usage: [
|
|
@@ -5524,7 +7374,8 @@ var CLI_TEXT = {
|
|
|
5524
7374
|
badJson: (path2, detail2) => `Cannot read as JSON: ${path2} (${detail2})`,
|
|
5525
7375
|
cannotWrite: (path2, detail2) => `Cannot write: ${path2} (${detail2})`,
|
|
5526
7376
|
badValue: (option, value, allowed) => `Invalid value: ${option} ${value} (${allowed})`,
|
|
5527
|
-
allowed: { lang: "ja or en", theme: "light or dark", positive: "a number above 0", format: `${FORMATS.join(" / ")} separated by ,` }
|
|
7377
|
+
allowed: { lang: "ja or en", theme: "light or dark", positive: "a number above 0", format: `${FORMATS.join(" / ")} separated by ,` },
|
|
7378
|
+
overlap: (step, text2) => `Step ${step}: ${text2}`
|
|
5528
7379
|
}
|
|
5529
7380
|
};
|
|
5530
7381
|
var isLang = (value) => value === "ja" || value === "en";
|
|
@@ -5638,6 +7489,8 @@ ${early.usage}`);
|
|
|
5638
7489
|
throw error instanceof Error ? error : new Error(String(error));
|
|
5639
7490
|
}
|
|
5640
7491
|
for (const path2 of Object.values(result.files)) console.log(path2);
|
|
7492
|
+
const said = lang ?? "ja";
|
|
7493
|
+
for (const overlap of result.overlaps) console.error(CLI_TEXT[said].overlap(overlap.step + 1, describeOverlap(overlap, said)));
|
|
5641
7494
|
return 0;
|
|
5642
7495
|
}
|
|
5643
7496
|
main(process.argv.slice(2)).then(
|