@cardenelabs/dragon 0.39.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 +37 -1
- package/dist/cli.cjs +1921 -429
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1926 -434
- package/dist/cli.js.map +1 -1
- package/dist/export.cjs +1718 -353
- package/dist/export.cjs.map +1 -1
- package/dist/export.d.cts +1 -1
- package/dist/export.d.ts +1 -1
- package/dist/export.js +1723 -358
- package/dist/export.js.map +1 -1
- package/dist/index.cjs +1835 -334
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1835 -334
- package/dist/index.js.map +1 -1
- package/dist/{ink-Cg-v6XSG.d.cts → ink-B_7OXxtb.d.cts} +27 -2
- package/dist/{ink-Cg-v6XSG.d.ts → ink-B_7OXxtb.d.ts} +27 -2
- package/dist/player.global.js +2 -2
- package/package.json +1 -1
- package/src/field-messages.ts +8 -0
- package/src/index.ts +2 -0
- package/src/layout/git.ts +728 -0
- package/src/look/values.ts +40 -1
- package/src/messages.ts +47 -4
- package/src/parser.ts +142 -7
- package/src/printer.ts +16 -4
- package/src/render/git.ts +161 -0
- package/src/render/parts.ts +1 -1
- package/src/render/svg.ts +26 -1
- package/src/schema.ts +47 -13
- package/src/schemas/diagram.schema.json +75 -8
- package/src/schemas/validate-diagram.js +1 -1
- package/src/timeline.ts +18 -3
- package/src/words.ts +19 -3
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,8 @@ var ja = {
|
|
|
56
56
|
const: (value2) => `${value2} \u306B\u3059\u308B`,
|
|
57
57
|
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",
|
|
58
58
|
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`,
|
|
59
|
+
kindOnly: (types, kind) => `${types.join(" \u3068 ")} \u306E\u51FA\u6765\u4E8B\u306F kind \u304C ${kind} \u306E\u6642\u3060\u3051\u66F8\u3051\u308B`,
|
|
60
|
+
hex: (min, max) => `0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 ${min} \u304B\u3089 ${max} \u5B57\u306B\u3059\u308B`,
|
|
59
61
|
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",
|
|
60
62
|
oneOf: "\u66F8\u3051\u308B\u5F62\u306E\u3069\u308C\u304B 1 \u3064\u3060\u3051\u306B\u5408\u308F\u305B\u308B",
|
|
61
63
|
discriminator: (tag, values) => `${tag} \u306F ${values.join(" / ")} \u306E\u3069\u308C\u304B\u306B\u3059\u308B`,
|
|
@@ -73,6 +75,8 @@ var en = {
|
|
|
73
75
|
const: (value2) => `Use ${value2}`,
|
|
74
76
|
not: (allowed) => allowed ? `The ${allowed.field} field is allowed only when kind is ${allowed.kind}` : "This combination of fields is not allowed",
|
|
75
77
|
reserved: (names) => `${names.join(" and ")} name the start and end marks of a state diagram and cannot be box ids`,
|
|
78
|
+
kindOnly: (types, kind) => `${types.join(" and ")} events are allowed only when kind is ${kind}`,
|
|
79
|
+
hex: (min, max) => `Use ${min} to ${max} characters of 0-9 and a-f`,
|
|
76
80
|
anyOf: (fields) => fields.length > 0 ? `Write one of the ${fields.join(" or ")} fields` : "Does not match any of the allowed shapes",
|
|
77
81
|
oneOf: "Match exactly one of the allowed shapes",
|
|
78
82
|
discriminator: (tag, values) => `${tag} is one of ${values.join(" / ")}`,
|
|
@@ -87,10 +91,10 @@ function ucs2length(str) {
|
|
|
87
91
|
return length;
|
|
88
92
|
}
|
|
89
93
|
var validate_diagram_default = validate10;
|
|
90
|
-
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", "
|
|
94
|
+
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" } }};
|
|
91
95
|
var func2 = Object.prototype.hasOwnProperty;
|
|
92
96
|
var func3 = ucs2length;
|
|
93
|
-
var
|
|
97
|
+
var schema28 = { "enum": ["blue", "amber", "green", "violet", "rose", "slate", "coin"] };
|
|
94
98
|
var pattern0 = new RegExp("^[^\\s\\[\\]\u300C\u300D=:]+$", "u");
|
|
95
99
|
function validate11(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
96
100
|
let vErrors = null;
|
|
@@ -194,7 +198,7 @@ function validate11(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
194
198
|
if (data.color !== void 0) {
|
|
195
199
|
let data3 = data.color;
|
|
196
200
|
if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
|
|
197
|
-
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues:
|
|
201
|
+
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" };
|
|
198
202
|
if (vErrors === null) {
|
|
199
203
|
vErrors = [err9];
|
|
200
204
|
} else {
|
|
@@ -339,7 +343,7 @@ function validate13(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
339
343
|
if (data.color !== void 0) {
|
|
340
344
|
let data3 = data.color;
|
|
341
345
|
if (!(data3 === "blue" || data3 === "amber" || data3 === "green" || data3 === "violet" || data3 === "rose" || data3 === "slate" || data3 === "coin")) {
|
|
342
|
-
const err9 = { instancePath: instancePath + "/color", schemaPath: "#/definitions/color/enum", keyword: "enum", params: { allowedValues:
|
|
346
|
+
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" };
|
|
343
347
|
if (vErrors === null) {
|
|
344
348
|
vErrors = [err9];
|
|
345
349
|
} else {
|
|
@@ -516,8 +520,9 @@ function validate15(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
516
520
|
validate15.errors = vErrors;
|
|
517
521
|
return errors === 0;
|
|
518
522
|
}
|
|
519
|
-
var
|
|
520
|
-
var
|
|
523
|
+
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" } } }] };
|
|
524
|
+
var pattern11 = new RegExp("^[0-9a-f]{4,40}$", "u");
|
|
525
|
+
var schema48 = { "properties": { "kind": { "enum": ["envelope", "tag", "coin", "none"] }}};
|
|
521
526
|
function validate19(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
522
527
|
let vErrors = null;
|
|
523
528
|
let errors = 0;
|
|
@@ -644,7 +649,7 @@ function validate19(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
644
649
|
if (data.kind !== void 0) {
|
|
645
650
|
let data1 = data.kind;
|
|
646
651
|
if (!(data1 === "envelope" || data1 === "tag" || data1 === "coin" || data1 === "none")) {
|
|
647
|
-
const err8 = { instancePath: instancePath + "/kind", schemaPath: "#/properties/kind/enum", keyword: "enum", params: { allowedValues:
|
|
652
|
+
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" };
|
|
648
653
|
if (vErrors === null) {
|
|
649
654
|
vErrors = [err8];
|
|
650
655
|
} else {
|
|
@@ -837,7 +842,7 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
837
842
|
if (data.labelSide !== void 0) {
|
|
838
843
|
let data5 = data.labelSide;
|
|
839
844
|
if (!(data5 === "above" || data5 === "below" || data5 === "left" || data5 === "right")) {
|
|
840
|
-
const err13 = { instancePath: instancePath + "/labelSide", schemaPath: "#/oneOf/0/properties/labelSide/enum", keyword: "enum", params: { allowedValues:
|
|
845
|
+
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" };
|
|
841
846
|
if (vErrors === null) {
|
|
842
847
|
vErrors = [err13];
|
|
843
848
|
} else {
|
|
@@ -1063,13 +1068,10 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1063
1068
|
}
|
|
1064
1069
|
errors++;
|
|
1065
1070
|
}
|
|
1066
|
-
} else if (tag0 === "
|
|
1067
|
-
const _errs39 = errors;
|
|
1068
|
-
let valid15 = false;
|
|
1069
|
-
const _errs40 = errors;
|
|
1071
|
+
} else if (tag0 === "commit") {
|
|
1070
1072
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1071
|
-
if (data.
|
|
1072
|
-
const err35 = { instancePath, schemaPath: "#/oneOf/3/
|
|
1073
|
+
if (data.type === void 0) {
|
|
1074
|
+
const err35 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
1073
1075
|
if (vErrors === null) {
|
|
1074
1076
|
vErrors = [err35];
|
|
1075
1077
|
} else {
|
|
@@ -1077,38 +1079,337 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1077
1079
|
}
|
|
1078
1080
|
errors++;
|
|
1079
1081
|
}
|
|
1082
|
+
if (data.id === void 0) {
|
|
1083
|
+
const err36 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
|
|
1084
|
+
if (vErrors === null) {
|
|
1085
|
+
vErrors = [err36];
|
|
1086
|
+
} else {
|
|
1087
|
+
vErrors.push(err36);
|
|
1088
|
+
}
|
|
1089
|
+
errors++;
|
|
1090
|
+
}
|
|
1091
|
+
if (data.branch === void 0) {
|
|
1092
|
+
const err37 = { instancePath, schemaPath: "#/oneOf/3/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
|
|
1093
|
+
if (vErrors === null) {
|
|
1094
|
+
vErrors = [err37];
|
|
1095
|
+
} else {
|
|
1096
|
+
vErrors.push(err37);
|
|
1097
|
+
}
|
|
1098
|
+
errors++;
|
|
1099
|
+
}
|
|
1100
|
+
for (const key3 in data) {
|
|
1101
|
+
if (!(key3 === "type" || key3 === "id" || key3 === "branch" || key3 === "copy" || key3 === "merge" || key3 === "hash" || key3 === "note")) {
|
|
1102
|
+
const err38 = { instancePath, schemaPath: "#/oneOf/3/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key3 }, message: "must NOT have additional properties" };
|
|
1103
|
+
if (vErrors === null) {
|
|
1104
|
+
vErrors = [err38];
|
|
1105
|
+
} else {
|
|
1106
|
+
vErrors.push(err38);
|
|
1107
|
+
}
|
|
1108
|
+
errors++;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
if (data.type !== void 0) {
|
|
1112
|
+
if ("commit" !== data.type) {
|
|
1113
|
+
const err39 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/3/properties/type/const", keyword: "const", params: { allowedValue: "commit" }, message: "must be equal to constant" };
|
|
1114
|
+
if (vErrors === null) {
|
|
1115
|
+
vErrors = [err39];
|
|
1116
|
+
} else {
|
|
1117
|
+
vErrors.push(err39);
|
|
1118
|
+
}
|
|
1119
|
+
errors++;
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
if (data.id !== void 0) {
|
|
1123
|
+
let data13 = data.id;
|
|
1124
|
+
if (typeof data13 === "string") {
|
|
1125
|
+
if (!pattern0.test(data13)) {
|
|
1126
|
+
const err40 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
1127
|
+
if (vErrors === null) {
|
|
1128
|
+
vErrors = [err40];
|
|
1129
|
+
} else {
|
|
1130
|
+
vErrors.push(err40);
|
|
1131
|
+
}
|
|
1132
|
+
errors++;
|
|
1133
|
+
}
|
|
1134
|
+
} else {
|
|
1135
|
+
const err41 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1136
|
+
if (vErrors === null) {
|
|
1137
|
+
vErrors = [err41];
|
|
1138
|
+
} else {
|
|
1139
|
+
vErrors.push(err41);
|
|
1140
|
+
}
|
|
1141
|
+
errors++;
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
if (data.branch !== void 0) {
|
|
1145
|
+
let data14 = data.branch;
|
|
1146
|
+
if (typeof data14 === "string") {
|
|
1147
|
+
if (!pattern0.test(data14)) {
|
|
1148
|
+
const err42 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
1149
|
+
if (vErrors === null) {
|
|
1150
|
+
vErrors = [err42];
|
|
1151
|
+
} else {
|
|
1152
|
+
vErrors.push(err42);
|
|
1153
|
+
}
|
|
1154
|
+
errors++;
|
|
1155
|
+
}
|
|
1156
|
+
} else {
|
|
1157
|
+
const err43 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1158
|
+
if (vErrors === null) {
|
|
1159
|
+
vErrors = [err43];
|
|
1160
|
+
} else {
|
|
1161
|
+
vErrors.push(err43);
|
|
1162
|
+
}
|
|
1163
|
+
errors++;
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
if (data.copy !== void 0) {
|
|
1167
|
+
let data15 = data.copy;
|
|
1168
|
+
if (typeof data15 === "string") {
|
|
1169
|
+
if (!pattern0.test(data15)) {
|
|
1170
|
+
const err44 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
1171
|
+
if (vErrors === null) {
|
|
1172
|
+
vErrors = [err44];
|
|
1173
|
+
} else {
|
|
1174
|
+
vErrors.push(err44);
|
|
1175
|
+
}
|
|
1176
|
+
errors++;
|
|
1177
|
+
}
|
|
1178
|
+
} else {
|
|
1179
|
+
const err45 = { instancePath: instancePath + "/copy", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1180
|
+
if (vErrors === null) {
|
|
1181
|
+
vErrors = [err45];
|
|
1182
|
+
} else {
|
|
1183
|
+
vErrors.push(err45);
|
|
1184
|
+
}
|
|
1185
|
+
errors++;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
if (data.merge !== void 0) {
|
|
1189
|
+
let data16 = data.merge;
|
|
1190
|
+
if (typeof data16 === "string") {
|
|
1191
|
+
if (!pattern0.test(data16)) {
|
|
1192
|
+
const err46 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
1193
|
+
if (vErrors === null) {
|
|
1194
|
+
vErrors = [err46];
|
|
1195
|
+
} else {
|
|
1196
|
+
vErrors.push(err46);
|
|
1197
|
+
}
|
|
1198
|
+
errors++;
|
|
1199
|
+
}
|
|
1200
|
+
} else {
|
|
1201
|
+
const err47 = { instancePath: instancePath + "/merge", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1202
|
+
if (vErrors === null) {
|
|
1203
|
+
vErrors = [err47];
|
|
1204
|
+
} else {
|
|
1205
|
+
vErrors.push(err47);
|
|
1206
|
+
}
|
|
1207
|
+
errors++;
|
|
1208
|
+
}
|
|
1209
|
+
}
|
|
1210
|
+
if (data.hash !== void 0) {
|
|
1211
|
+
let data17 = data.hash;
|
|
1212
|
+
if (typeof data17 === "string") {
|
|
1213
|
+
if (!pattern11.test(data17)) {
|
|
1214
|
+
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}$"' };
|
|
1215
|
+
if (vErrors === null) {
|
|
1216
|
+
vErrors = [err48];
|
|
1217
|
+
} else {
|
|
1218
|
+
vErrors.push(err48);
|
|
1219
|
+
}
|
|
1220
|
+
errors++;
|
|
1221
|
+
}
|
|
1222
|
+
} else {
|
|
1223
|
+
const err49 = { instancePath: instancePath + "/hash", schemaPath: "#/definitions/hash/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1224
|
+
if (vErrors === null) {
|
|
1225
|
+
vErrors = [err49];
|
|
1226
|
+
} else {
|
|
1227
|
+
vErrors.push(err49);
|
|
1228
|
+
}
|
|
1229
|
+
errors++;
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
if (data.note !== void 0) {
|
|
1233
|
+
let data18 = data.note;
|
|
1234
|
+
if (typeof data18 === "string") {
|
|
1235
|
+
if (func3(data18) < 1) {
|
|
1236
|
+
const err50 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
1237
|
+
if (vErrors === null) {
|
|
1238
|
+
vErrors = [err50];
|
|
1239
|
+
} else {
|
|
1240
|
+
vErrors.push(err50);
|
|
1241
|
+
}
|
|
1242
|
+
errors++;
|
|
1243
|
+
}
|
|
1244
|
+
} else {
|
|
1245
|
+
const err51 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1246
|
+
if (vErrors === null) {
|
|
1247
|
+
vErrors = [err51];
|
|
1248
|
+
} else {
|
|
1249
|
+
vErrors.push(err51);
|
|
1250
|
+
}
|
|
1251
|
+
errors++;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
} else {
|
|
1255
|
+
const err52 = { instancePath, schemaPath: "#/oneOf/3/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
1256
|
+
if (vErrors === null) {
|
|
1257
|
+
vErrors = [err52];
|
|
1258
|
+
} else {
|
|
1259
|
+
vErrors.push(err52);
|
|
1260
|
+
}
|
|
1261
|
+
errors++;
|
|
1262
|
+
}
|
|
1263
|
+
} else if (tag0 === "branch") {
|
|
1264
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1265
|
+
if (data.type === void 0) {
|
|
1266
|
+
const err53 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
1267
|
+
if (vErrors === null) {
|
|
1268
|
+
vErrors = [err53];
|
|
1269
|
+
} else {
|
|
1270
|
+
vErrors.push(err53);
|
|
1271
|
+
}
|
|
1272
|
+
errors++;
|
|
1273
|
+
}
|
|
1274
|
+
if (data.branch === void 0) {
|
|
1275
|
+
const err54 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "branch" }, message: "must have required property 'branch'" };
|
|
1276
|
+
if (vErrors === null) {
|
|
1277
|
+
vErrors = [err54];
|
|
1278
|
+
} else {
|
|
1279
|
+
vErrors.push(err54);
|
|
1280
|
+
}
|
|
1281
|
+
errors++;
|
|
1282
|
+
}
|
|
1283
|
+
if (data.from === void 0) {
|
|
1284
|
+
const err55 = { instancePath, schemaPath: "#/oneOf/4/required", keyword: "required", params: { missingProperty: "from" }, message: "must have required property 'from'" };
|
|
1285
|
+
if (vErrors === null) {
|
|
1286
|
+
vErrors = [err55];
|
|
1287
|
+
} else {
|
|
1288
|
+
vErrors.push(err55);
|
|
1289
|
+
}
|
|
1290
|
+
errors++;
|
|
1291
|
+
}
|
|
1292
|
+
for (const key4 in data) {
|
|
1293
|
+
if (!(key4 === "type" || key4 === "branch" || key4 === "from")) {
|
|
1294
|
+
const err56 = { instancePath, schemaPath: "#/oneOf/4/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key4 }, message: "must NOT have additional properties" };
|
|
1295
|
+
if (vErrors === null) {
|
|
1296
|
+
vErrors = [err56];
|
|
1297
|
+
} else {
|
|
1298
|
+
vErrors.push(err56);
|
|
1299
|
+
}
|
|
1300
|
+
errors++;
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
if (data.type !== void 0) {
|
|
1304
|
+
if ("branch" !== data.type) {
|
|
1305
|
+
const err57 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/4/properties/type/const", keyword: "const", params: { allowedValue: "branch" }, message: "must be equal to constant" };
|
|
1306
|
+
if (vErrors === null) {
|
|
1307
|
+
vErrors = [err57];
|
|
1308
|
+
} else {
|
|
1309
|
+
vErrors.push(err57);
|
|
1310
|
+
}
|
|
1311
|
+
errors++;
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
if (data.branch !== void 0) {
|
|
1315
|
+
let data20 = data.branch;
|
|
1316
|
+
if (typeof data20 === "string") {
|
|
1317
|
+
if (!pattern0.test(data20)) {
|
|
1318
|
+
const err58 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
1319
|
+
if (vErrors === null) {
|
|
1320
|
+
vErrors = [err58];
|
|
1321
|
+
} else {
|
|
1322
|
+
vErrors.push(err58);
|
|
1323
|
+
}
|
|
1324
|
+
errors++;
|
|
1325
|
+
}
|
|
1326
|
+
} else {
|
|
1327
|
+
const err59 = { instancePath: instancePath + "/branch", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1328
|
+
if (vErrors === null) {
|
|
1329
|
+
vErrors = [err59];
|
|
1330
|
+
} else {
|
|
1331
|
+
vErrors.push(err59);
|
|
1332
|
+
}
|
|
1333
|
+
errors++;
|
|
1334
|
+
}
|
|
1335
|
+
}
|
|
1336
|
+
if (data.from !== void 0) {
|
|
1337
|
+
let data21 = data.from;
|
|
1338
|
+
if (typeof data21 === "string") {
|
|
1339
|
+
if (!pattern0.test(data21)) {
|
|
1340
|
+
const err60 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
1341
|
+
if (vErrors === null) {
|
|
1342
|
+
vErrors = [err60];
|
|
1343
|
+
} else {
|
|
1344
|
+
vErrors.push(err60);
|
|
1345
|
+
}
|
|
1346
|
+
errors++;
|
|
1347
|
+
}
|
|
1348
|
+
} else {
|
|
1349
|
+
const err61 = { instancePath: instancePath + "/from", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1350
|
+
if (vErrors === null) {
|
|
1351
|
+
vErrors = [err61];
|
|
1352
|
+
} else {
|
|
1353
|
+
vErrors.push(err61);
|
|
1354
|
+
}
|
|
1355
|
+
errors++;
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
} else {
|
|
1359
|
+
const err62 = { instancePath, schemaPath: "#/oneOf/4/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
1360
|
+
if (vErrors === null) {
|
|
1361
|
+
vErrors = [err62];
|
|
1362
|
+
} else {
|
|
1363
|
+
vErrors.push(err62);
|
|
1364
|
+
}
|
|
1365
|
+
errors++;
|
|
1080
1366
|
}
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1367
|
+
} else if (tag0 === "strip") {
|
|
1368
|
+
const _errs71 = errors;
|
|
1369
|
+
let valid27 = false;
|
|
1370
|
+
const _errs72 = errors;
|
|
1371
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1372
|
+
if (data.value === void 0) {
|
|
1373
|
+
const err63 = { instancePath, schemaPath: "#/oneOf/5/anyOf/0/required", keyword: "required", params: { missingProperty: "value" }, message: "must have required property 'value'" };
|
|
1374
|
+
if (vErrors === null) {
|
|
1375
|
+
vErrors = [err63];
|
|
1376
|
+
} else {
|
|
1377
|
+
vErrors.push(err63);
|
|
1378
|
+
}
|
|
1379
|
+
errors++;
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
var _valid0 = _errs72 === errors;
|
|
1383
|
+
valid27 = valid27 || _valid0;
|
|
1384
|
+
if (!valid27) {
|
|
1385
|
+
const _errs73 = errors;
|
|
1085
1386
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1086
1387
|
if (data.tag === void 0) {
|
|
1087
|
-
const
|
|
1388
|
+
const err64 = { instancePath, schemaPath: "#/oneOf/5/anyOf/1/required", keyword: "required", params: { missingProperty: "tag" }, message: "must have required property 'tag'" };
|
|
1088
1389
|
if (vErrors === null) {
|
|
1089
|
-
vErrors = [
|
|
1390
|
+
vErrors = [err64];
|
|
1090
1391
|
} else {
|
|
1091
|
-
vErrors.push(
|
|
1392
|
+
vErrors.push(err64);
|
|
1092
1393
|
}
|
|
1093
1394
|
errors++;
|
|
1094
1395
|
}
|
|
1095
1396
|
}
|
|
1096
|
-
var _valid0 =
|
|
1097
|
-
|
|
1397
|
+
var _valid0 = _errs73 === errors;
|
|
1398
|
+
valid27 = valid27 || _valid0;
|
|
1098
1399
|
}
|
|
1099
|
-
if (!
|
|
1100
|
-
const
|
|
1400
|
+
if (!valid27) {
|
|
1401
|
+
const err65 = { instancePath, schemaPath: "#/oneOf/5/anyOf", keyword: "anyOf", params: {}, message: "must match a schema in anyOf" };
|
|
1101
1402
|
if (vErrors === null) {
|
|
1102
|
-
vErrors = [
|
|
1403
|
+
vErrors = [err65];
|
|
1103
1404
|
} else {
|
|
1104
|
-
vErrors.push(
|
|
1405
|
+
vErrors.push(err65);
|
|
1105
1406
|
}
|
|
1106
1407
|
errors++;
|
|
1107
1408
|
} else {
|
|
1108
|
-
errors =
|
|
1409
|
+
errors = _errs71;
|
|
1109
1410
|
if (vErrors !== null) {
|
|
1110
|
-
if (
|
|
1111
|
-
vErrors.length =
|
|
1411
|
+
if (_errs71) {
|
|
1412
|
+
vErrors.length = _errs71;
|
|
1112
1413
|
} else {
|
|
1113
1414
|
vErrors = null;
|
|
1114
1415
|
}
|
|
@@ -1116,144 +1417,144 @@ function validate18(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1116
1417
|
}
|
|
1117
1418
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1118
1419
|
if (data.type === void 0) {
|
|
1119
|
-
const
|
|
1420
|
+
const err66 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "type" }, message: "must have required property 'type'" };
|
|
1120
1421
|
if (vErrors === null) {
|
|
1121
|
-
vErrors = [
|
|
1422
|
+
vErrors = [err66];
|
|
1122
1423
|
} else {
|
|
1123
|
-
vErrors.push(
|
|
1424
|
+
vErrors.push(err66);
|
|
1124
1425
|
}
|
|
1125
1426
|
errors++;
|
|
1126
1427
|
}
|
|
1127
1428
|
if (data.field === void 0) {
|
|
1128
|
-
const
|
|
1429
|
+
const err67 = { instancePath, schemaPath: "#/oneOf/5/required", keyword: "required", params: { missingProperty: "field" }, message: "must have required property 'field'" };
|
|
1129
1430
|
if (vErrors === null) {
|
|
1130
|
-
vErrors = [
|
|
1431
|
+
vErrors = [err67];
|
|
1131
1432
|
} else {
|
|
1132
|
-
vErrors.push(
|
|
1433
|
+
vErrors.push(err67);
|
|
1133
1434
|
}
|
|
1134
1435
|
errors++;
|
|
1135
1436
|
}
|
|
1136
|
-
for (const
|
|
1137
|
-
if (!(
|
|
1138
|
-
const
|
|
1437
|
+
for (const key5 in data) {
|
|
1438
|
+
if (!(key5 === "type" || key5 === "field" || key5 === "value" || key5 === "tag")) {
|
|
1439
|
+
const err68 = { instancePath, schemaPath: "#/oneOf/5/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key5 }, message: "must NOT have additional properties" };
|
|
1139
1440
|
if (vErrors === null) {
|
|
1140
|
-
vErrors = [
|
|
1441
|
+
vErrors = [err68];
|
|
1141
1442
|
} else {
|
|
1142
|
-
vErrors.push(
|
|
1443
|
+
vErrors.push(err68);
|
|
1143
1444
|
}
|
|
1144
1445
|
errors++;
|
|
1145
1446
|
}
|
|
1146
1447
|
}
|
|
1147
1448
|
if (data.type !== void 0) {
|
|
1148
1449
|
if ("strip" !== data.type) {
|
|
1149
|
-
const
|
|
1450
|
+
const err69 = { instancePath: instancePath + "/type", schemaPath: "#/oneOf/5/properties/type/const", keyword: "const", params: { allowedValue: "strip" }, message: "must be equal to constant" };
|
|
1150
1451
|
if (vErrors === null) {
|
|
1151
|
-
vErrors = [
|
|
1452
|
+
vErrors = [err69];
|
|
1152
1453
|
} else {
|
|
1153
|
-
vErrors.push(
|
|
1454
|
+
vErrors.push(err69);
|
|
1154
1455
|
}
|
|
1155
1456
|
errors++;
|
|
1156
1457
|
}
|
|
1157
1458
|
}
|
|
1158
1459
|
if (data.field !== void 0) {
|
|
1159
|
-
let
|
|
1160
|
-
if (typeof
|
|
1161
|
-
if (func3(
|
|
1162
|
-
const
|
|
1460
|
+
let data23 = data.field;
|
|
1461
|
+
if (typeof data23 === "string") {
|
|
1462
|
+
if (func3(data23) < 1) {
|
|
1463
|
+
const err70 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
1163
1464
|
if (vErrors === null) {
|
|
1164
|
-
vErrors = [
|
|
1465
|
+
vErrors = [err70];
|
|
1165
1466
|
} else {
|
|
1166
|
-
vErrors.push(
|
|
1467
|
+
vErrors.push(err70);
|
|
1167
1468
|
}
|
|
1168
1469
|
errors++;
|
|
1169
1470
|
}
|
|
1170
1471
|
} else {
|
|
1171
|
-
const
|
|
1472
|
+
const err71 = { instancePath: instancePath + "/field", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1172
1473
|
if (vErrors === null) {
|
|
1173
|
-
vErrors = [
|
|
1474
|
+
vErrors = [err71];
|
|
1174
1475
|
} else {
|
|
1175
|
-
vErrors.push(
|
|
1476
|
+
vErrors.push(err71);
|
|
1176
1477
|
}
|
|
1177
1478
|
errors++;
|
|
1178
1479
|
}
|
|
1179
1480
|
}
|
|
1180
1481
|
if (data.value !== void 0) {
|
|
1181
|
-
let
|
|
1182
|
-
if (typeof
|
|
1183
|
-
if (func3(
|
|
1184
|
-
const
|
|
1482
|
+
let data24 = data.value;
|
|
1483
|
+
if (typeof data24 === "string") {
|
|
1484
|
+
if (func3(data24) < 1) {
|
|
1485
|
+
const err72 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
1185
1486
|
if (vErrors === null) {
|
|
1186
|
-
vErrors = [
|
|
1487
|
+
vErrors = [err72];
|
|
1187
1488
|
} else {
|
|
1188
|
-
vErrors.push(
|
|
1489
|
+
vErrors.push(err72);
|
|
1189
1490
|
}
|
|
1190
1491
|
errors++;
|
|
1191
1492
|
}
|
|
1192
1493
|
} else {
|
|
1193
|
-
const
|
|
1494
|
+
const err73 = { instancePath: instancePath + "/value", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1194
1495
|
if (vErrors === null) {
|
|
1195
|
-
vErrors = [
|
|
1496
|
+
vErrors = [err73];
|
|
1196
1497
|
} else {
|
|
1197
|
-
vErrors.push(
|
|
1498
|
+
vErrors.push(err73);
|
|
1198
1499
|
}
|
|
1199
1500
|
errors++;
|
|
1200
1501
|
}
|
|
1201
1502
|
}
|
|
1202
1503
|
if (data.tag !== void 0) {
|
|
1203
|
-
let
|
|
1204
|
-
if (typeof
|
|
1205
|
-
if (func3(
|
|
1206
|
-
const
|
|
1504
|
+
let data25 = data.tag;
|
|
1505
|
+
if (typeof data25 === "string") {
|
|
1506
|
+
if (func3(data25) < 1) {
|
|
1507
|
+
const err74 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
1207
1508
|
if (vErrors === null) {
|
|
1208
|
-
vErrors = [
|
|
1509
|
+
vErrors = [err74];
|
|
1209
1510
|
} else {
|
|
1210
|
-
vErrors.push(
|
|
1511
|
+
vErrors.push(err74);
|
|
1211
1512
|
}
|
|
1212
1513
|
errors++;
|
|
1213
1514
|
}
|
|
1214
1515
|
} else {
|
|
1215
|
-
const
|
|
1516
|
+
const err75 = { instancePath: instancePath + "/tag", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1216
1517
|
if (vErrors === null) {
|
|
1217
|
-
vErrors = [
|
|
1518
|
+
vErrors = [err75];
|
|
1218
1519
|
} else {
|
|
1219
|
-
vErrors.push(
|
|
1520
|
+
vErrors.push(err75);
|
|
1220
1521
|
}
|
|
1221
1522
|
errors++;
|
|
1222
1523
|
}
|
|
1223
1524
|
}
|
|
1224
1525
|
} else {
|
|
1225
|
-
const
|
|
1526
|
+
const err76 = { instancePath, schemaPath: "#/oneOf/5/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
1226
1527
|
if (vErrors === null) {
|
|
1227
|
-
vErrors = [
|
|
1528
|
+
vErrors = [err76];
|
|
1228
1529
|
} else {
|
|
1229
|
-
vErrors.push(
|
|
1530
|
+
vErrors.push(err76);
|
|
1230
1531
|
}
|
|
1231
1532
|
errors++;
|
|
1232
1533
|
}
|
|
1233
1534
|
} else {
|
|
1234
|
-
const
|
|
1535
|
+
const err77 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "mapping", tag: "type", tagValue: tag0 }, message: 'value of tag "type" must be in oneOf' };
|
|
1235
1536
|
if (vErrors === null) {
|
|
1236
|
-
vErrors = [
|
|
1537
|
+
vErrors = [err77];
|
|
1237
1538
|
} else {
|
|
1238
|
-
vErrors.push(
|
|
1539
|
+
vErrors.push(err77);
|
|
1239
1540
|
}
|
|
1240
1541
|
errors++;
|
|
1241
1542
|
}
|
|
1242
1543
|
} else {
|
|
1243
|
-
const
|
|
1544
|
+
const err78 = { instancePath, schemaPath: "#/discriminator", keyword: "discriminator", params: { error: "tag", tag: "type", tagValue: tag0 }, message: 'tag "type" must be string' };
|
|
1244
1545
|
if (vErrors === null) {
|
|
1245
|
-
vErrors = [
|
|
1546
|
+
vErrors = [err78];
|
|
1246
1547
|
} else {
|
|
1247
|
-
vErrors.push(
|
|
1548
|
+
vErrors.push(err78);
|
|
1248
1549
|
}
|
|
1249
1550
|
errors++;
|
|
1250
1551
|
}
|
|
1251
1552
|
} else {
|
|
1252
|
-
const
|
|
1553
|
+
const err79 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
1253
1554
|
if (vErrors === null) {
|
|
1254
|
-
vErrors = [
|
|
1555
|
+
vErrors = [err79];
|
|
1255
1556
|
} else {
|
|
1256
|
-
vErrors.push(
|
|
1557
|
+
vErrors.push(err79);
|
|
1257
1558
|
}
|
|
1258
1559
|
errors++;
|
|
1259
1560
|
}
|
|
@@ -1657,6 +1958,151 @@ function validate25(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1657
1958
|
validate25.errors = vErrors;
|
|
1658
1959
|
return errors === 0;
|
|
1659
1960
|
}
|
|
1961
|
+
function validate30(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
1962
|
+
let vErrors = null;
|
|
1963
|
+
let errors = 0;
|
|
1964
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1965
|
+
if (data.id === void 0) {
|
|
1966
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "id" }, message: "must have required property 'id'" };
|
|
1967
|
+
if (vErrors === null) {
|
|
1968
|
+
vErrors = [err0];
|
|
1969
|
+
} else {
|
|
1970
|
+
vErrors.push(err0);
|
|
1971
|
+
}
|
|
1972
|
+
errors++;
|
|
1973
|
+
}
|
|
1974
|
+
for (const key0 in data) {
|
|
1975
|
+
if (!(key0 === "id" || key0 === "note")) {
|
|
1976
|
+
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
1977
|
+
if (vErrors === null) {
|
|
1978
|
+
vErrors = [err1];
|
|
1979
|
+
} else {
|
|
1980
|
+
vErrors.push(err1);
|
|
1981
|
+
}
|
|
1982
|
+
errors++;
|
|
1983
|
+
}
|
|
1984
|
+
}
|
|
1985
|
+
if (data.id !== void 0) {
|
|
1986
|
+
let data0 = data.id;
|
|
1987
|
+
if (typeof data0 === "string") {
|
|
1988
|
+
if (!pattern0.test(data0)) {
|
|
1989
|
+
const err2 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/pattern", keyword: "pattern", params: { pattern: "^[^\\s\\[\\]\u300C\u300D=:]+$" }, message: 'must match pattern "^[^\\s\\[\\]\u300C\u300D=:]+$"' };
|
|
1990
|
+
if (vErrors === null) {
|
|
1991
|
+
vErrors = [err2];
|
|
1992
|
+
} else {
|
|
1993
|
+
vErrors.push(err2);
|
|
1994
|
+
}
|
|
1995
|
+
errors++;
|
|
1996
|
+
}
|
|
1997
|
+
} else {
|
|
1998
|
+
const err3 = { instancePath: instancePath + "/id", schemaPath: "#/definitions/id/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
1999
|
+
if (vErrors === null) {
|
|
2000
|
+
vErrors = [err3];
|
|
2001
|
+
} else {
|
|
2002
|
+
vErrors.push(err3);
|
|
2003
|
+
}
|
|
2004
|
+
errors++;
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
if (data.note !== void 0) {
|
|
2008
|
+
let data1 = data.note;
|
|
2009
|
+
if (typeof data1 === "string") {
|
|
2010
|
+
if (func3(data1) < 1) {
|
|
2011
|
+
const err4 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
2012
|
+
if (vErrors === null) {
|
|
2013
|
+
vErrors = [err4];
|
|
2014
|
+
} else {
|
|
2015
|
+
vErrors.push(err4);
|
|
2016
|
+
}
|
|
2017
|
+
errors++;
|
|
2018
|
+
}
|
|
2019
|
+
} else {
|
|
2020
|
+
const err5 = { instancePath: instancePath + "/note", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2021
|
+
if (vErrors === null) {
|
|
2022
|
+
vErrors = [err5];
|
|
2023
|
+
} else {
|
|
2024
|
+
vErrors.push(err5);
|
|
2025
|
+
}
|
|
2026
|
+
errors++;
|
|
2027
|
+
}
|
|
2028
|
+
}
|
|
2029
|
+
} else {
|
|
2030
|
+
const err6 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2031
|
+
if (vErrors === null) {
|
|
2032
|
+
vErrors = [err6];
|
|
2033
|
+
} else {
|
|
2034
|
+
vErrors.push(err6);
|
|
2035
|
+
}
|
|
2036
|
+
errors++;
|
|
2037
|
+
}
|
|
2038
|
+
validate30.errors = vErrors;
|
|
2039
|
+
return errors === 0;
|
|
2040
|
+
}
|
|
2041
|
+
function validate29(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
2042
|
+
let vErrors = null;
|
|
2043
|
+
let errors = 0;
|
|
2044
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2045
|
+
if (data.branches === void 0) {
|
|
2046
|
+
const err0 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "branches" }, message: "must have required property 'branches'" };
|
|
2047
|
+
if (vErrors === null) {
|
|
2048
|
+
vErrors = [err0];
|
|
2049
|
+
} else {
|
|
2050
|
+
vErrors.push(err0);
|
|
2051
|
+
}
|
|
2052
|
+
errors++;
|
|
2053
|
+
}
|
|
2054
|
+
for (const key0 in data) {
|
|
2055
|
+
if (!(key0 === "branches")) {
|
|
2056
|
+
const err1 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
2057
|
+
if (vErrors === null) {
|
|
2058
|
+
vErrors = [err1];
|
|
2059
|
+
} else {
|
|
2060
|
+
vErrors.push(err1);
|
|
2061
|
+
}
|
|
2062
|
+
errors++;
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
if (data.branches !== void 0) {
|
|
2066
|
+
let data0 = data.branches;
|
|
2067
|
+
if (Array.isArray(data0)) {
|
|
2068
|
+
if (data0.length < 1) {
|
|
2069
|
+
const err2 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
2070
|
+
if (vErrors === null) {
|
|
2071
|
+
vErrors = [err2];
|
|
2072
|
+
} else {
|
|
2073
|
+
vErrors.push(err2);
|
|
2074
|
+
}
|
|
2075
|
+
errors++;
|
|
2076
|
+
}
|
|
2077
|
+
const len0 = data0.length;
|
|
2078
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
2079
|
+
if (!validate30(data0[i0], { instancePath: instancePath + "/branches/" + i0, parentData: data0, parentDataProperty: i0, rootData })) {
|
|
2080
|
+
vErrors = vErrors === null ? validate30.errors : vErrors.concat(validate30.errors);
|
|
2081
|
+
errors = vErrors.length;
|
|
2082
|
+
}
|
|
2083
|
+
}
|
|
2084
|
+
} else {
|
|
2085
|
+
const err3 = { instancePath: instancePath + "/branches", schemaPath: "#/properties/branches/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
2086
|
+
if (vErrors === null) {
|
|
2087
|
+
vErrors = [err3];
|
|
2088
|
+
} else {
|
|
2089
|
+
vErrors.push(err3);
|
|
2090
|
+
}
|
|
2091
|
+
errors++;
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
} else {
|
|
2095
|
+
const err4 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2096
|
+
if (vErrors === null) {
|
|
2097
|
+
vErrors = [err4];
|
|
2098
|
+
} else {
|
|
2099
|
+
vErrors.push(err4);
|
|
2100
|
+
}
|
|
2101
|
+
errors++;
|
|
2102
|
+
}
|
|
2103
|
+
validate29.errors = vErrors;
|
|
2104
|
+
return errors === 0;
|
|
2105
|
+
}
|
|
1660
2106
|
function validate10(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) {
|
|
1661
2107
|
let vErrors = null;
|
|
1662
2108
|
let errors = 0;
|
|
@@ -1698,11 +2144,9 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1698
2144
|
let ifClause0;
|
|
1699
2145
|
if (_valid0) {
|
|
1700
2146
|
const _errs4 = errors;
|
|
1701
|
-
const _errs5 = errors;
|
|
1702
|
-
const _errs6 = errors;
|
|
1703
2147
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1704
|
-
if (data.
|
|
1705
|
-
const err2 = {};
|
|
2148
|
+
if (data.sequence === void 0) {
|
|
2149
|
+
const err2 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
|
|
1706
2150
|
if (vErrors === null) {
|
|
1707
2151
|
vErrors = [err2];
|
|
1708
2152
|
} else {
|
|
@@ -1710,147 +2154,181 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1710
2154
|
}
|
|
1711
2155
|
errors++;
|
|
1712
2156
|
}
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
2157
|
+
if (data.boxes !== void 0) {
|
|
2158
|
+
let data1 = data.boxes;
|
|
2159
|
+
if (Array.isArray(data1)) {
|
|
2160
|
+
if (data1.length < 1) {
|
|
2161
|
+
const err3 = { instancePath: instancePath + "/boxes", schemaPath: "#/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
2162
|
+
if (vErrors === null) {
|
|
2163
|
+
vErrors = [err3];
|
|
2164
|
+
} else {
|
|
2165
|
+
vErrors.push(err3);
|
|
2166
|
+
}
|
|
2167
|
+
errors++;
|
|
2168
|
+
}
|
|
2169
|
+
}
|
|
1721
2170
|
}
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
2171
|
+
if (data.steps !== void 0) {
|
|
2172
|
+
let data2 = data.steps;
|
|
2173
|
+
if (Array.isArray(data2)) {
|
|
2174
|
+
const len0 = data2.length;
|
|
2175
|
+
for (let i0 = 0; i0 < len0; i0++) {
|
|
2176
|
+
let data3 = data2[i0];
|
|
2177
|
+
if (data3 && typeof data3 == "object" && !Array.isArray(data3)) {
|
|
2178
|
+
if (data3.events !== void 0) {
|
|
2179
|
+
let data4 = data3.events;
|
|
2180
|
+
if (Array.isArray(data4)) {
|
|
2181
|
+
const len1 = data4.length;
|
|
2182
|
+
for (let i1 = 0; i1 < len1; i1++) {
|
|
2183
|
+
let data5 = data4[i1];
|
|
2184
|
+
if (data5 && typeof data5 == "object" && !Array.isArray(data5)) {
|
|
2185
|
+
if (data5.type !== void 0) {
|
|
2186
|
+
let data6 = data5.type;
|
|
2187
|
+
const _errs12 = errors;
|
|
2188
|
+
const _errs13 = errors;
|
|
2189
|
+
if (!(data6 === "commit" || data6 === "branch")) {
|
|
2190
|
+
const err4 = {};
|
|
2191
|
+
if (vErrors === null) {
|
|
2192
|
+
vErrors = [err4];
|
|
2193
|
+
} else {
|
|
2194
|
+
vErrors.push(err4);
|
|
2195
|
+
}
|
|
2196
|
+
errors++;
|
|
2197
|
+
}
|
|
2198
|
+
var valid10 = _errs13 === errors;
|
|
2199
|
+
if (valid10) {
|
|
2200
|
+
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" };
|
|
2201
|
+
if (vErrors === null) {
|
|
2202
|
+
vErrors = [err5];
|
|
2203
|
+
} else {
|
|
2204
|
+
vErrors.push(err5);
|
|
2205
|
+
}
|
|
2206
|
+
errors++;
|
|
2207
|
+
} else {
|
|
2208
|
+
errors = _errs12;
|
|
2209
|
+
if (vErrors !== null) {
|
|
2210
|
+
if (_errs12) {
|
|
2211
|
+
vErrors.length = _errs12;
|
|
2212
|
+
} else {
|
|
2213
|
+
vErrors = null;
|
|
2214
|
+
}
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
}
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
}
|
|
2223
|
+
}
|
|
1730
2224
|
}
|
|
1731
2225
|
}
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
if (data.sequence === void 0) {
|
|
1735
|
-
const err4 = { instancePath, schemaPath: "#/then/required", keyword: "required", params: { missingProperty: "sequence" }, message: "must have required property 'sequence'" };
|
|
2226
|
+
if (data.state !== void 0) {
|
|
2227
|
+
const err6 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
1736
2228
|
if (vErrors === null) {
|
|
1737
|
-
vErrors = [
|
|
2229
|
+
vErrors = [err6];
|
|
1738
2230
|
} else {
|
|
1739
|
-
vErrors.push(
|
|
2231
|
+
vErrors.push(err6);
|
|
1740
2232
|
}
|
|
1741
2233
|
errors++;
|
|
1742
2234
|
}
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
valid0 = _valid0;
|
|
1746
|
-
ifClause0 = "then";
|
|
1747
|
-
} else {
|
|
1748
|
-
const _errs7 = errors;
|
|
1749
|
-
const _errs8 = errors;
|
|
1750
|
-
const _errs9 = errors;
|
|
1751
|
-
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1752
|
-
if (data.sequence === void 0 && ("sequence")) {
|
|
1753
|
-
const err5 = {};
|
|
2235
|
+
if (data.git !== void 0) {
|
|
2236
|
+
const err7 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
1754
2237
|
if (vErrors === null) {
|
|
1755
|
-
vErrors = [
|
|
2238
|
+
vErrors = [err7];
|
|
1756
2239
|
} else {
|
|
1757
|
-
vErrors.push(
|
|
2240
|
+
vErrors.push(err7);
|
|
1758
2241
|
}
|
|
1759
2242
|
errors++;
|
|
1760
2243
|
}
|
|
1761
2244
|
}
|
|
1762
|
-
var
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
errors++;
|
|
1771
|
-
} else {
|
|
1772
|
-
errors = _errs8;
|
|
1773
|
-
if (vErrors !== null) {
|
|
1774
|
-
if (_errs8) {
|
|
1775
|
-
vErrors.length = _errs8;
|
|
1776
|
-
} else {
|
|
1777
|
-
vErrors = null;
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
}
|
|
1781
|
-
const _errs10 = errors;
|
|
1782
|
-
let valid4 = true;
|
|
1783
|
-
const _errs11 = errors;
|
|
2245
|
+
var _valid0 = _errs4 === errors;
|
|
2246
|
+
valid0 = _valid0;
|
|
2247
|
+
ifClause0 = "then";
|
|
2248
|
+
} else {
|
|
2249
|
+
const _errs20 = errors;
|
|
2250
|
+
const _errs21 = errors;
|
|
2251
|
+
let valid13 = true;
|
|
2252
|
+
const _errs22 = errors;
|
|
1784
2253
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1785
2254
|
if (data.kind === void 0 && ("kind")) {
|
|
1786
|
-
const
|
|
2255
|
+
const err8 = {};
|
|
1787
2256
|
if (vErrors === null) {
|
|
1788
|
-
vErrors = [
|
|
2257
|
+
vErrors = [err8];
|
|
1789
2258
|
} else {
|
|
1790
|
-
vErrors.push(
|
|
2259
|
+
vErrors.push(err8);
|
|
1791
2260
|
}
|
|
1792
2261
|
errors++;
|
|
1793
2262
|
} else {
|
|
1794
2263
|
if (data.kind !== void 0) {
|
|
1795
2264
|
if ("state" !== data.kind) {
|
|
1796
|
-
const
|
|
2265
|
+
const err9 = {};
|
|
1797
2266
|
if (vErrors === null) {
|
|
1798
|
-
vErrors = [
|
|
2267
|
+
vErrors = [err9];
|
|
1799
2268
|
} else {
|
|
1800
|
-
vErrors.push(
|
|
2269
|
+
vErrors.push(err9);
|
|
1801
2270
|
}
|
|
1802
2271
|
errors++;
|
|
1803
2272
|
}
|
|
1804
2273
|
}
|
|
1805
2274
|
}
|
|
1806
2275
|
}
|
|
1807
|
-
var _valid1 =
|
|
1808
|
-
errors =
|
|
2276
|
+
var _valid1 = _errs22 === errors;
|
|
2277
|
+
errors = _errs21;
|
|
1809
2278
|
if (vErrors !== null) {
|
|
1810
|
-
if (
|
|
1811
|
-
vErrors.length =
|
|
2279
|
+
if (_errs21) {
|
|
2280
|
+
vErrors.length = _errs21;
|
|
1812
2281
|
} else {
|
|
1813
2282
|
vErrors = null;
|
|
1814
2283
|
}
|
|
1815
2284
|
}
|
|
1816
2285
|
let ifClause1;
|
|
1817
2286
|
if (_valid1) {
|
|
1818
|
-
const
|
|
2287
|
+
const _errs24 = errors;
|
|
1819
2288
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1820
2289
|
if (data.boxes !== void 0) {
|
|
1821
|
-
let
|
|
1822
|
-
if (Array.isArray(
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
2290
|
+
let data10 = data.boxes;
|
|
2291
|
+
if (Array.isArray(data10)) {
|
|
2292
|
+
if (data10.length < 1) {
|
|
2293
|
+
const err10 = { instancePath: instancePath + "/boxes", schemaPath: "#/else/then/properties/boxes/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
2294
|
+
if (vErrors === null) {
|
|
2295
|
+
vErrors = [err10];
|
|
2296
|
+
} else {
|
|
2297
|
+
vErrors.push(err10);
|
|
2298
|
+
}
|
|
2299
|
+
errors++;
|
|
2300
|
+
}
|
|
2301
|
+
const len2 = data10.length;
|
|
2302
|
+
for (let i2 = 0; i2 < len2; i2++) {
|
|
2303
|
+
let data11 = data10[i2];
|
|
2304
|
+
if (data11 && typeof data11 == "object" && !Array.isArray(data11)) {
|
|
2305
|
+
if (data11.id !== void 0) {
|
|
2306
|
+
let data12 = data11.id;
|
|
2307
|
+
const _errs28 = errors;
|
|
2308
|
+
const _errs29 = errors;
|
|
2309
|
+
if (!(data12 === "start" || data12 === "finish")) {
|
|
2310
|
+
const err11 = {};
|
|
1833
2311
|
if (vErrors === null) {
|
|
1834
|
-
vErrors = [
|
|
2312
|
+
vErrors = [err11];
|
|
1835
2313
|
} else {
|
|
1836
|
-
vErrors.push(
|
|
2314
|
+
vErrors.push(err11);
|
|
1837
2315
|
}
|
|
1838
2316
|
errors++;
|
|
1839
2317
|
}
|
|
1840
|
-
var
|
|
1841
|
-
if (
|
|
1842
|
-
const
|
|
2318
|
+
var valid19 = _errs29 === errors;
|
|
2319
|
+
if (valid19) {
|
|
2320
|
+
const err12 = { instancePath: instancePath + "/boxes/" + i2 + "/id", schemaPath: "#/else/then/properties/boxes/items/properties/id/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
1843
2321
|
if (vErrors === null) {
|
|
1844
|
-
vErrors = [
|
|
2322
|
+
vErrors = [err12];
|
|
1845
2323
|
} else {
|
|
1846
|
-
vErrors.push(
|
|
2324
|
+
vErrors.push(err12);
|
|
1847
2325
|
}
|
|
1848
2326
|
errors++;
|
|
1849
2327
|
} else {
|
|
1850
|
-
errors =
|
|
2328
|
+
errors = _errs28;
|
|
1851
2329
|
if (vErrors !== null) {
|
|
1852
|
-
if (
|
|
1853
|
-
vErrors.length =
|
|
2330
|
+
if (_errs28) {
|
|
2331
|
+
vErrors.length = _errs28;
|
|
1854
2332
|
} else {
|
|
1855
2333
|
vErrors = null;
|
|
1856
2334
|
}
|
|
@@ -1861,241 +2339,449 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
1861
2339
|
}
|
|
1862
2340
|
}
|
|
1863
2341
|
}
|
|
2342
|
+
if (data.steps !== void 0) {
|
|
2343
|
+
let data13 = data.steps;
|
|
2344
|
+
if (Array.isArray(data13)) {
|
|
2345
|
+
const len3 = data13.length;
|
|
2346
|
+
for (let i3 = 0; i3 < len3; i3++) {
|
|
2347
|
+
let data14 = data13[i3];
|
|
2348
|
+
if (data14 && typeof data14 == "object" && !Array.isArray(data14)) {
|
|
2349
|
+
if (data14.events !== void 0) {
|
|
2350
|
+
let data15 = data14.events;
|
|
2351
|
+
if (Array.isArray(data15)) {
|
|
2352
|
+
const len4 = data15.length;
|
|
2353
|
+
for (let i4 = 0; i4 < len4; i4++) {
|
|
2354
|
+
let data16 = data15[i4];
|
|
2355
|
+
if (data16 && typeof data16 == "object" && !Array.isArray(data16)) {
|
|
2356
|
+
if (data16.type !== void 0) {
|
|
2357
|
+
let data17 = data16.type;
|
|
2358
|
+
const _errs36 = errors;
|
|
2359
|
+
const _errs37 = errors;
|
|
2360
|
+
if (!(data17 === "commit" || data17 === "branch")) {
|
|
2361
|
+
const err13 = {};
|
|
2362
|
+
if (vErrors === null) {
|
|
2363
|
+
vErrors = [err13];
|
|
2364
|
+
} else {
|
|
2365
|
+
vErrors.push(err13);
|
|
2366
|
+
}
|
|
2367
|
+
errors++;
|
|
2368
|
+
}
|
|
2369
|
+
var valid27 = _errs37 === errors;
|
|
2370
|
+
if (valid27) {
|
|
2371
|
+
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" };
|
|
2372
|
+
if (vErrors === null) {
|
|
2373
|
+
vErrors = [err14];
|
|
2374
|
+
} else {
|
|
2375
|
+
vErrors.push(err14);
|
|
2376
|
+
}
|
|
2377
|
+
errors++;
|
|
2378
|
+
} else {
|
|
2379
|
+
errors = _errs36;
|
|
2380
|
+
if (vErrors !== null) {
|
|
2381
|
+
if (_errs36) {
|
|
2382
|
+
vErrors.length = _errs36;
|
|
2383
|
+
} else {
|
|
2384
|
+
vErrors = null;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
}
|
|
2390
|
+
}
|
|
2391
|
+
}
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
}
|
|
2396
|
+
}
|
|
2397
|
+
if (data.git !== void 0) {
|
|
2398
|
+
const err15 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
2399
|
+
if (vErrors === null) {
|
|
2400
|
+
vErrors = [err15];
|
|
2401
|
+
} else {
|
|
2402
|
+
vErrors.push(err15);
|
|
2403
|
+
}
|
|
2404
|
+
errors++;
|
|
2405
|
+
}
|
|
1864
2406
|
}
|
|
1865
|
-
var _valid1 =
|
|
1866
|
-
|
|
2407
|
+
var _valid1 = _errs24 === errors;
|
|
2408
|
+
valid13 = _valid1;
|
|
1867
2409
|
ifClause1 = "then";
|
|
1868
2410
|
} else {
|
|
1869
|
-
const
|
|
1870
|
-
const
|
|
1871
|
-
|
|
2411
|
+
const _errs41 = errors;
|
|
2412
|
+
const _errs42 = errors;
|
|
2413
|
+
let valid29 = true;
|
|
2414
|
+
const _errs43 = errors;
|
|
1872
2415
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1873
|
-
if (data.
|
|
1874
|
-
const
|
|
2416
|
+
if (data.kind === void 0 && ("kind")) {
|
|
2417
|
+
const err16 = {};
|
|
1875
2418
|
if (vErrors === null) {
|
|
1876
|
-
vErrors = [
|
|
2419
|
+
vErrors = [err16];
|
|
1877
2420
|
} else {
|
|
1878
|
-
vErrors.push(
|
|
2421
|
+
vErrors.push(err16);
|
|
1879
2422
|
}
|
|
1880
2423
|
errors++;
|
|
2424
|
+
} else {
|
|
2425
|
+
if (data.kind !== void 0) {
|
|
2426
|
+
if ("git" !== data.kind) {
|
|
2427
|
+
const err17 = {};
|
|
2428
|
+
if (vErrors === null) {
|
|
2429
|
+
vErrors = [err17];
|
|
2430
|
+
} else {
|
|
2431
|
+
vErrors.push(err17);
|
|
2432
|
+
}
|
|
2433
|
+
errors++;
|
|
2434
|
+
}
|
|
2435
|
+
}
|
|
1881
2436
|
}
|
|
1882
2437
|
}
|
|
1883
|
-
var
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
if (
|
|
1887
|
-
vErrors =
|
|
2438
|
+
var _valid2 = _errs43 === errors;
|
|
2439
|
+
errors = _errs42;
|
|
2440
|
+
if (vErrors !== null) {
|
|
2441
|
+
if (_errs42) {
|
|
2442
|
+
vErrors.length = _errs42;
|
|
1888
2443
|
} else {
|
|
1889
|
-
vErrors
|
|
2444
|
+
vErrors = null;
|
|
1890
2445
|
}
|
|
1891
|
-
|
|
2446
|
+
}
|
|
2447
|
+
let ifClause2;
|
|
2448
|
+
if (_valid2) {
|
|
2449
|
+
const _errs45 = errors;
|
|
2450
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2451
|
+
if (data.git === void 0) {
|
|
2452
|
+
const err18 = { instancePath, schemaPath: "#/else/else/then/required", keyword: "required", params: { missingProperty: "git" }, message: "must have required property 'git'" };
|
|
2453
|
+
if (vErrors === null) {
|
|
2454
|
+
vErrors = [err18];
|
|
2455
|
+
} else {
|
|
2456
|
+
vErrors.push(err18);
|
|
2457
|
+
}
|
|
2458
|
+
errors++;
|
|
2459
|
+
}
|
|
2460
|
+
if (data.state !== void 0) {
|
|
2461
|
+
const err19 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
2462
|
+
if (vErrors === null) {
|
|
2463
|
+
vErrors = [err19];
|
|
2464
|
+
} else {
|
|
2465
|
+
vErrors.push(err19);
|
|
2466
|
+
}
|
|
2467
|
+
errors++;
|
|
2468
|
+
}
|
|
2469
|
+
if (data.regions !== void 0) {
|
|
2470
|
+
const err20 = { instancePath: instancePath + "/regions", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
2471
|
+
if (vErrors === null) {
|
|
2472
|
+
vErrors = [err20];
|
|
2473
|
+
} else {
|
|
2474
|
+
vErrors.push(err20);
|
|
2475
|
+
}
|
|
2476
|
+
errors++;
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
var _valid2 = _errs45 === errors;
|
|
2480
|
+
valid29 = _valid2;
|
|
2481
|
+
ifClause2 = "then";
|
|
1892
2482
|
} else {
|
|
1893
|
-
|
|
1894
|
-
if (
|
|
1895
|
-
if (
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
2483
|
+
const _errs52 = errors;
|
|
2484
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2485
|
+
if (data.boxes !== void 0) {
|
|
2486
|
+
let data22 = data.boxes;
|
|
2487
|
+
if (Array.isArray(data22)) {
|
|
2488
|
+
if (data22.length < 1) {
|
|
2489
|
+
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" };
|
|
2490
|
+
if (vErrors === null) {
|
|
2491
|
+
vErrors = [err21];
|
|
2492
|
+
} else {
|
|
2493
|
+
vErrors.push(err21);
|
|
2494
|
+
}
|
|
2495
|
+
errors++;
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
if (data.steps !== void 0) {
|
|
2500
|
+
let data23 = data.steps;
|
|
2501
|
+
if (Array.isArray(data23)) {
|
|
2502
|
+
const len5 = data23.length;
|
|
2503
|
+
for (let i5 = 0; i5 < len5; i5++) {
|
|
2504
|
+
let data24 = data23[i5];
|
|
2505
|
+
if (data24 && typeof data24 == "object" && !Array.isArray(data24)) {
|
|
2506
|
+
if (data24.events !== void 0) {
|
|
2507
|
+
let data25 = data24.events;
|
|
2508
|
+
if (Array.isArray(data25)) {
|
|
2509
|
+
const len6 = data25.length;
|
|
2510
|
+
for (let i6 = 0; i6 < len6; i6++) {
|
|
2511
|
+
let data26 = data25[i6];
|
|
2512
|
+
if (data26 && typeof data26 == "object" && !Array.isArray(data26)) {
|
|
2513
|
+
if (data26.type !== void 0) {
|
|
2514
|
+
let data27 = data26.type;
|
|
2515
|
+
const _errs60 = errors;
|
|
2516
|
+
const _errs61 = errors;
|
|
2517
|
+
if (!(data27 === "commit" || data27 === "branch")) {
|
|
2518
|
+
const err22 = {};
|
|
2519
|
+
if (vErrors === null) {
|
|
2520
|
+
vErrors = [err22];
|
|
2521
|
+
} else {
|
|
2522
|
+
vErrors.push(err22);
|
|
2523
|
+
}
|
|
2524
|
+
errors++;
|
|
2525
|
+
}
|
|
2526
|
+
var valid42 = _errs61 === errors;
|
|
2527
|
+
if (valid42) {
|
|
2528
|
+
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" };
|
|
2529
|
+
if (vErrors === null) {
|
|
2530
|
+
vErrors = [err23];
|
|
2531
|
+
} else {
|
|
2532
|
+
vErrors.push(err23);
|
|
2533
|
+
}
|
|
2534
|
+
errors++;
|
|
2535
|
+
} else {
|
|
2536
|
+
errors = _errs60;
|
|
2537
|
+
if (vErrors !== null) {
|
|
2538
|
+
if (_errs60) {
|
|
2539
|
+
vErrors.length = _errs60;
|
|
2540
|
+
} else {
|
|
2541
|
+
vErrors = null;
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
}
|
|
2548
|
+
}
|
|
2549
|
+
}
|
|
2550
|
+
}
|
|
2551
|
+
}
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
if (data.state !== void 0) {
|
|
2555
|
+
const err24 = { instancePath: instancePath + "/state", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
2556
|
+
if (vErrors === null) {
|
|
2557
|
+
vErrors = [err24];
|
|
2558
|
+
} else {
|
|
2559
|
+
vErrors.push(err24);
|
|
2560
|
+
}
|
|
2561
|
+
errors++;
|
|
2562
|
+
}
|
|
2563
|
+
if (data.git !== void 0) {
|
|
2564
|
+
const err25 = { instancePath: instancePath + "/git", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
2565
|
+
if (vErrors === null) {
|
|
2566
|
+
vErrors = [err25];
|
|
2567
|
+
} else {
|
|
2568
|
+
vErrors.push(err25);
|
|
2569
|
+
}
|
|
2570
|
+
errors++;
|
|
1899
2571
|
}
|
|
1900
2572
|
}
|
|
2573
|
+
var _valid2 = _errs52 === errors;
|
|
2574
|
+
valid29 = _valid2;
|
|
2575
|
+
ifClause2 = "else";
|
|
2576
|
+
}
|
|
2577
|
+
if (!valid29) {
|
|
2578
|
+
const err26 = { instancePath, schemaPath: "#/else/else/if", keyword: "if", params: { failingKeyword: ifClause2 }, message: 'must match "' + ifClause2 + '" schema' };
|
|
2579
|
+
if (vErrors === null) {
|
|
2580
|
+
vErrors = [err26];
|
|
2581
|
+
} else {
|
|
2582
|
+
vErrors.push(err26);
|
|
2583
|
+
}
|
|
2584
|
+
errors++;
|
|
1901
2585
|
}
|
|
1902
|
-
var _valid1 =
|
|
1903
|
-
|
|
2586
|
+
var _valid1 = _errs41 === errors;
|
|
2587
|
+
valid13 = _valid1;
|
|
1904
2588
|
ifClause1 = "else";
|
|
1905
2589
|
}
|
|
1906
|
-
if (!
|
|
1907
|
-
const
|
|
2590
|
+
if (!valid13) {
|
|
2591
|
+
const err27 = { instancePath, schemaPath: "#/else/if", keyword: "if", params: { failingKeyword: ifClause1 }, message: 'must match "' + ifClause1 + '" schema' };
|
|
1908
2592
|
if (vErrors === null) {
|
|
1909
|
-
vErrors = [
|
|
2593
|
+
vErrors = [err27];
|
|
1910
2594
|
} else {
|
|
1911
|
-
vErrors.push(
|
|
2595
|
+
vErrors.push(err27);
|
|
1912
2596
|
}
|
|
1913
2597
|
errors++;
|
|
1914
2598
|
}
|
|
1915
|
-
|
|
2599
|
+
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
2600
|
+
if (data.sequence !== void 0) {
|
|
2601
|
+
const err28 = { instancePath: instancePath + "/sequence", schemaPath: "#/definitions/absent/not", keyword: "not", params: {}, message: "must NOT be valid" };
|
|
2602
|
+
if (vErrors === null) {
|
|
2603
|
+
vErrors = [err28];
|
|
2604
|
+
} else {
|
|
2605
|
+
vErrors.push(err28);
|
|
2606
|
+
}
|
|
2607
|
+
errors++;
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
var _valid0 = _errs20 === errors;
|
|
1916
2611
|
valid0 = _valid0;
|
|
1917
2612
|
ifClause0 = "else";
|
|
1918
2613
|
}
|
|
1919
2614
|
if (!valid0) {
|
|
1920
|
-
const
|
|
2615
|
+
const err29 = { instancePath, schemaPath: "#/if", keyword: "if", params: { failingKeyword: ifClause0 }, message: 'must match "' + ifClause0 + '" schema' };
|
|
1921
2616
|
if (vErrors === null) {
|
|
1922
|
-
vErrors = [
|
|
2617
|
+
vErrors = [err29];
|
|
1923
2618
|
} else {
|
|
1924
|
-
vErrors.push(
|
|
2619
|
+
vErrors.push(err29);
|
|
1925
2620
|
}
|
|
1926
2621
|
errors++;
|
|
1927
2622
|
}
|
|
1928
2623
|
if (data && typeof data == "object" && !Array.isArray(data)) {
|
|
1929
2624
|
if (data.version === void 0) {
|
|
1930
|
-
const
|
|
2625
|
+
const err30 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "version" }, message: "must have required property 'version'" };
|
|
1931
2626
|
if (vErrors === null) {
|
|
1932
|
-
vErrors = [
|
|
2627
|
+
vErrors = [err30];
|
|
1933
2628
|
} else {
|
|
1934
|
-
vErrors.push(
|
|
2629
|
+
vErrors.push(err30);
|
|
1935
2630
|
}
|
|
1936
2631
|
errors++;
|
|
1937
2632
|
}
|
|
1938
2633
|
if (data.kind === void 0) {
|
|
1939
|
-
const
|
|
2634
|
+
const err31 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "kind" }, message: "must have required property 'kind'" };
|
|
1940
2635
|
if (vErrors === null) {
|
|
1941
|
-
vErrors = [
|
|
2636
|
+
vErrors = [err31];
|
|
1942
2637
|
} else {
|
|
1943
|
-
vErrors.push(
|
|
2638
|
+
vErrors.push(err31);
|
|
1944
2639
|
}
|
|
1945
2640
|
errors++;
|
|
1946
2641
|
}
|
|
1947
2642
|
if (data.title === void 0) {
|
|
1948
|
-
const
|
|
2643
|
+
const err32 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "title" }, message: "must have required property 'title'" };
|
|
1949
2644
|
if (vErrors === null) {
|
|
1950
|
-
vErrors = [
|
|
2645
|
+
vErrors = [err32];
|
|
1951
2646
|
} else {
|
|
1952
|
-
vErrors.push(
|
|
2647
|
+
vErrors.push(err32);
|
|
1953
2648
|
}
|
|
1954
2649
|
errors++;
|
|
1955
2650
|
}
|
|
1956
2651
|
if (data.boxes === void 0) {
|
|
1957
|
-
const
|
|
2652
|
+
const err33 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "boxes" }, message: "must have required property 'boxes'" };
|
|
1958
2653
|
if (vErrors === null) {
|
|
1959
|
-
vErrors = [
|
|
2654
|
+
vErrors = [err33];
|
|
1960
2655
|
} else {
|
|
1961
|
-
vErrors.push(
|
|
2656
|
+
vErrors.push(err33);
|
|
1962
2657
|
}
|
|
1963
2658
|
errors++;
|
|
1964
2659
|
}
|
|
1965
2660
|
if (data.steps === void 0) {
|
|
1966
|
-
const
|
|
2661
|
+
const err34 = { instancePath, schemaPath: "#/required", keyword: "required", params: { missingProperty: "steps" }, message: "must have required property 'steps'" };
|
|
1967
2662
|
if (vErrors === null) {
|
|
1968
|
-
vErrors = [
|
|
2663
|
+
vErrors = [err34];
|
|
1969
2664
|
} else {
|
|
1970
|
-
vErrors.push(
|
|
2665
|
+
vErrors.push(err34);
|
|
1971
2666
|
}
|
|
1972
2667
|
errors++;
|
|
1973
2668
|
}
|
|
1974
2669
|
for (const key0 in data) {
|
|
1975
2670
|
if (!func2.call(schema11.properties, key0)) {
|
|
1976
|
-
const
|
|
2671
|
+
const err35 = { instancePath, schemaPath: "#/additionalProperties", keyword: "additionalProperties", params: { additionalProperty: key0 }, message: "must NOT have additional properties" };
|
|
1977
2672
|
if (vErrors === null) {
|
|
1978
|
-
vErrors = [
|
|
2673
|
+
vErrors = [err35];
|
|
1979
2674
|
} else {
|
|
1980
|
-
vErrors.push(
|
|
2675
|
+
vErrors.push(err35);
|
|
1981
2676
|
}
|
|
1982
2677
|
errors++;
|
|
1983
2678
|
}
|
|
1984
2679
|
}
|
|
1985
2680
|
if (data.version !== void 0) {
|
|
1986
|
-
let
|
|
1987
|
-
if (!(typeof
|
|
1988
|
-
const
|
|
2681
|
+
let data31 = data.version;
|
|
2682
|
+
if (!(typeof data31 == "number" && (!(data31 % 1) && !isNaN(data31)) && isFinite(data31))) {
|
|
2683
|
+
const err36 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/type", keyword: "type", params: { type: "integer" }, message: "must be integer" };
|
|
1989
2684
|
if (vErrors === null) {
|
|
1990
|
-
vErrors = [
|
|
2685
|
+
vErrors = [err36];
|
|
1991
2686
|
} else {
|
|
1992
|
-
vErrors.push(
|
|
2687
|
+
vErrors.push(err36);
|
|
1993
2688
|
}
|
|
1994
2689
|
errors++;
|
|
1995
2690
|
}
|
|
1996
|
-
if (typeof
|
|
1997
|
-
if (
|
|
1998
|
-
const
|
|
2691
|
+
if (typeof data31 == "number" && isFinite(data31)) {
|
|
2692
|
+
if (data31 < 1 || isNaN(data31)) {
|
|
2693
|
+
const err37 = { instancePath: instancePath + "/version", schemaPath: "#/properties/version/minimum", keyword: "minimum", params: { comparison: ">=", limit: 1 }, message: "must be >= 1" };
|
|
1999
2694
|
if (vErrors === null) {
|
|
2000
|
-
vErrors = [
|
|
2695
|
+
vErrors = [err37];
|
|
2001
2696
|
} else {
|
|
2002
|
-
vErrors.push(
|
|
2697
|
+
vErrors.push(err37);
|
|
2003
2698
|
}
|
|
2004
2699
|
errors++;
|
|
2005
2700
|
}
|
|
2006
2701
|
}
|
|
2007
2702
|
}
|
|
2008
2703
|
if (data.kind !== void 0) {
|
|
2009
|
-
let
|
|
2010
|
-
if (!(
|
|
2011
|
-
const
|
|
2704
|
+
let data32 = data.kind;
|
|
2705
|
+
if (!(data32 === "sequence" || data32 === "architecture" || data32 === "state" || data32 === "git")) {
|
|
2706
|
+
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" };
|
|
2012
2707
|
if (vErrors === null) {
|
|
2013
|
-
vErrors = [
|
|
2708
|
+
vErrors = [err38];
|
|
2014
2709
|
} else {
|
|
2015
|
-
vErrors.push(
|
|
2710
|
+
vErrors.push(err38);
|
|
2016
2711
|
}
|
|
2017
2712
|
errors++;
|
|
2018
2713
|
}
|
|
2019
2714
|
}
|
|
2020
2715
|
if (data.title !== void 0) {
|
|
2021
|
-
let
|
|
2022
|
-
if (typeof
|
|
2023
|
-
if (func3(
|
|
2024
|
-
const
|
|
2716
|
+
let data33 = data.title;
|
|
2717
|
+
if (typeof data33 === "string") {
|
|
2718
|
+
if (func3(data33) < 1) {
|
|
2719
|
+
const err39 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/minLength", keyword: "minLength", params: { limit: 1 }, message: "must NOT have fewer than 1 characters" };
|
|
2025
2720
|
if (vErrors === null) {
|
|
2026
|
-
vErrors = [
|
|
2721
|
+
vErrors = [err39];
|
|
2027
2722
|
} else {
|
|
2028
|
-
vErrors.push(
|
|
2723
|
+
vErrors.push(err39);
|
|
2029
2724
|
}
|
|
2030
2725
|
errors++;
|
|
2031
2726
|
}
|
|
2032
2727
|
} else {
|
|
2033
|
-
const
|
|
2728
|
+
const err40 = { instancePath: instancePath + "/title", schemaPath: "#/definitions/text/type", keyword: "type", params: { type: "string" }, message: "must be string" };
|
|
2034
2729
|
if (vErrors === null) {
|
|
2035
|
-
vErrors = [
|
|
2730
|
+
vErrors = [err40];
|
|
2036
2731
|
} else {
|
|
2037
|
-
vErrors.push(
|
|
2732
|
+
vErrors.push(err40);
|
|
2038
2733
|
}
|
|
2039
2734
|
errors++;
|
|
2040
2735
|
}
|
|
2041
2736
|
}
|
|
2042
2737
|
if (data.view !== void 0) {
|
|
2043
|
-
let
|
|
2044
|
-
if (!(
|
|
2045
|
-
const
|
|
2738
|
+
let data34 = data.view;
|
|
2739
|
+
if (!(data34 === "fixed" || data34 === "follow")) {
|
|
2740
|
+
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" };
|
|
2046
2741
|
if (vErrors === null) {
|
|
2047
|
-
vErrors = [
|
|
2742
|
+
vErrors = [err41];
|
|
2048
2743
|
} else {
|
|
2049
|
-
vErrors.push(
|
|
2744
|
+
vErrors.push(err41);
|
|
2050
2745
|
}
|
|
2051
2746
|
errors++;
|
|
2052
2747
|
}
|
|
2053
2748
|
}
|
|
2054
2749
|
if (data.regions !== void 0) {
|
|
2055
|
-
let
|
|
2056
|
-
if (Array.isArray(
|
|
2057
|
-
const
|
|
2058
|
-
for (let
|
|
2059
|
-
if (!validate11(
|
|
2750
|
+
let data35 = data.regions;
|
|
2751
|
+
if (Array.isArray(data35)) {
|
|
2752
|
+
const len7 = data35.length;
|
|
2753
|
+
for (let i7 = 0; i7 < len7; i7++) {
|
|
2754
|
+
if (!validate11(data35[i7], { instancePath: instancePath + "/regions/" + i7, parentData: data35, parentDataProperty: i7, rootData })) {
|
|
2060
2755
|
vErrors = vErrors === null ? validate11.errors : vErrors.concat(validate11.errors);
|
|
2061
2756
|
errors = vErrors.length;
|
|
2062
2757
|
}
|
|
2063
2758
|
}
|
|
2064
2759
|
} else {
|
|
2065
|
-
const
|
|
2760
|
+
const err42 = { instancePath: instancePath + "/regions", schemaPath: "#/properties/regions/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
2066
2761
|
if (vErrors === null) {
|
|
2067
|
-
vErrors = [
|
|
2762
|
+
vErrors = [err42];
|
|
2068
2763
|
} else {
|
|
2069
|
-
vErrors.push(
|
|
2764
|
+
vErrors.push(err42);
|
|
2070
2765
|
}
|
|
2071
2766
|
errors++;
|
|
2072
2767
|
}
|
|
2073
2768
|
}
|
|
2074
2769
|
if (data.boxes !== void 0) {
|
|
2075
|
-
let
|
|
2076
|
-
if (Array.isArray(
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
if (
|
|
2080
|
-
vErrors = [err28];
|
|
2081
|
-
} else {
|
|
2082
|
-
vErrors.push(err28);
|
|
2083
|
-
}
|
|
2084
|
-
errors++;
|
|
2085
|
-
}
|
|
2086
|
-
const len2 = data11.length;
|
|
2087
|
-
for (let i2 = 0; i2 < len2; i2++) {
|
|
2088
|
-
if (!validate13(data11[i2], { instancePath: instancePath + "/boxes/" + i2, parentData: data11, parentDataProperty: i2, rootData })) {
|
|
2770
|
+
let data37 = data.boxes;
|
|
2771
|
+
if (Array.isArray(data37)) {
|
|
2772
|
+
const len8 = data37.length;
|
|
2773
|
+
for (let i8 = 0; i8 < len8; i8++) {
|
|
2774
|
+
if (!validate13(data37[i8], { instancePath: instancePath + "/boxes/" + i8, parentData: data37, parentDataProperty: i8, rootData })) {
|
|
2089
2775
|
vErrors = vErrors === null ? validate13.errors : vErrors.concat(validate13.errors);
|
|
2090
2776
|
errors = vErrors.length;
|
|
2091
2777
|
}
|
|
2092
2778
|
}
|
|
2093
2779
|
} else {
|
|
2094
|
-
const
|
|
2780
|
+
const err43 = { instancePath: instancePath + "/boxes", schemaPath: "#/properties/boxes/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
2095
2781
|
if (vErrors === null) {
|
|
2096
|
-
vErrors = [
|
|
2782
|
+
vErrors = [err43];
|
|
2097
2783
|
} else {
|
|
2098
|
-
vErrors.push(
|
|
2784
|
+
vErrors.push(err43);
|
|
2099
2785
|
}
|
|
2100
2786
|
errors++;
|
|
2101
2787
|
}
|
|
@@ -2107,30 +2793,30 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2107
2793
|
}
|
|
2108
2794
|
}
|
|
2109
2795
|
if (data.steps !== void 0) {
|
|
2110
|
-
let
|
|
2111
|
-
if (Array.isArray(
|
|
2112
|
-
if (
|
|
2113
|
-
const
|
|
2796
|
+
let data40 = data.steps;
|
|
2797
|
+
if (Array.isArray(data40)) {
|
|
2798
|
+
if (data40.length < 1) {
|
|
2799
|
+
const err44 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/minItems", keyword: "minItems", params: { limit: 1 }, message: "must NOT have fewer than 1 items" };
|
|
2114
2800
|
if (vErrors === null) {
|
|
2115
|
-
vErrors = [
|
|
2801
|
+
vErrors = [err44];
|
|
2116
2802
|
} else {
|
|
2117
|
-
vErrors.push(
|
|
2803
|
+
vErrors.push(err44);
|
|
2118
2804
|
}
|
|
2119
2805
|
errors++;
|
|
2120
2806
|
}
|
|
2121
|
-
const
|
|
2122
|
-
for (let
|
|
2123
|
-
if (!validate17(
|
|
2807
|
+
const len9 = data40.length;
|
|
2808
|
+
for (let i9 = 0; i9 < len9; i9++) {
|
|
2809
|
+
if (!validate17(data40[i9], { instancePath: instancePath + "/steps/" + i9, parentData: data40, parentDataProperty: i9, rootData })) {
|
|
2124
2810
|
vErrors = vErrors === null ? validate17.errors : vErrors.concat(validate17.errors);
|
|
2125
2811
|
errors = vErrors.length;
|
|
2126
2812
|
}
|
|
2127
2813
|
}
|
|
2128
2814
|
} else {
|
|
2129
|
-
const
|
|
2815
|
+
const err45 = { instancePath: instancePath + "/steps", schemaPath: "#/properties/steps/type", keyword: "type", params: { type: "array" }, message: "must be array" };
|
|
2130
2816
|
if (vErrors === null) {
|
|
2131
|
-
vErrors = [
|
|
2817
|
+
vErrors = [err45];
|
|
2132
2818
|
} else {
|
|
2133
|
-
vErrors.push(
|
|
2819
|
+
vErrors.push(err45);
|
|
2134
2820
|
}
|
|
2135
2821
|
errors++;
|
|
2136
2822
|
}
|
|
@@ -2147,12 +2833,18 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2147
2833
|
errors = vErrors.length;
|
|
2148
2834
|
}
|
|
2149
2835
|
}
|
|
2836
|
+
if (data.git !== void 0) {
|
|
2837
|
+
if (!validate29(data.git, { instancePath: instancePath + "/git", parentData: data, parentDataProperty: "git", rootData })) {
|
|
2838
|
+
vErrors = vErrors === null ? validate29.errors : vErrors.concat(validate29.errors);
|
|
2839
|
+
errors = vErrors.length;
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2150
2842
|
} else {
|
|
2151
|
-
const
|
|
2843
|
+
const err46 = { instancePath, schemaPath: "#/type", keyword: "type", params: { type: "object" }, message: "must be object" };
|
|
2152
2844
|
if (vErrors === null) {
|
|
2153
|
-
vErrors = [
|
|
2845
|
+
vErrors = [err46];
|
|
2154
2846
|
} else {
|
|
2155
|
-
vErrors.push(
|
|
2847
|
+
vErrors.push(err46);
|
|
2156
2848
|
}
|
|
2157
2849
|
errors++;
|
|
2158
2850
|
}
|
|
@@ -2162,16 +2854,23 @@ function validate10(data, { instancePath = "", parentData, parentDataProperty, r
|
|
|
2162
2854
|
|
|
2163
2855
|
// src/words.ts
|
|
2164
2856
|
var keys = (table) => Object.keys(table);
|
|
2165
|
-
var KINDS = keys({ sequence: true, architecture: true, state: true });
|
|
2857
|
+
var KINDS = keys({ sequence: true, architecture: true, state: true, git: true });
|
|
2166
2858
|
var STATE_ENDS = ["start", "finish"];
|
|
2167
|
-
var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set"];
|
|
2859
|
+
var HEADS = ["group", "end", "box", "strip", "step", "say", "code", "act", "note", "set", "branch", "commit"];
|
|
2168
2860
|
var AS = "as";
|
|
2861
|
+
var ON = "on";
|
|
2862
|
+
var COPY = "copy";
|
|
2863
|
+
var MERGE = "merge";
|
|
2864
|
+
var FROM = "from";
|
|
2865
|
+
var HEAD = "HEAD";
|
|
2169
2866
|
var ATTRS = {
|
|
2170
2867
|
diagram: ["view"],
|
|
2171
2868
|
group: ["note", "color", "icon"],
|
|
2172
2869
|
box: ["note", "color", "icon"],
|
|
2173
2870
|
edge: ["carry", "tag", "side"],
|
|
2174
|
-
set: ["tag"]
|
|
2871
|
+
set: ["tag"],
|
|
2872
|
+
branch: ["note"],
|
|
2873
|
+
commit: ["hash", "note"]
|
|
2175
2874
|
};
|
|
2176
2875
|
var CARRIES = keys({ coin: true, none: true });
|
|
2177
2876
|
var VIEWS = keys({ fixed: true, follow: true });
|
|
@@ -2187,17 +2886,17 @@ var OLD_HEADS = {
|
|
|
2187
2886
|
|
|
2188
2887
|
// src/schema.ts
|
|
2189
2888
|
var COLORS = ["blue", "amber", "green", "violet", "rose", "slate", "coin"];
|
|
2190
|
-
var EVENT_TYPES = ["edge", "action", "swap", "strip"];
|
|
2191
|
-
var
|
|
2192
|
-
|
|
2193
|
-
"#/then/not": { field: "state", kind: "state" },
|
|
2194
|
-
"#/else/else/not": { field: "state", kind: "state" }
|
|
2195
|
-
};
|
|
2889
|
+
var EVENT_TYPES = ["edge", "action", "swap", "strip", "commit", "branch"];
|
|
2890
|
+
var ABSENT = "#/definitions/absent/not";
|
|
2891
|
+
var ABSENT_KINDS = { regions: "sequence / architecture / state" };
|
|
2196
2892
|
var NOT_ALLOWED = {
|
|
2197
2893
|
carry: { field: "text", kind: "tag" }
|
|
2198
2894
|
};
|
|
2199
2895
|
var RESERVED_ID = /\/boxes\/items\/properties\/id\/not$/u;
|
|
2896
|
+
var GIT_EVENT = /\/events\/items\/properties\/type\/not$/u;
|
|
2897
|
+
var GIT_EVENTS = ["commit", "branch"];
|
|
2200
2898
|
var escape = (key2) => key2.replaceAll("~", "~0").replaceAll("/", "~1");
|
|
2899
|
+
var HEX = /^\^\[0-9a-f\]\{(\d+),(\d+)\}\$$/u;
|
|
2201
2900
|
function forbiddenOf(pattern) {
|
|
2202
2901
|
const inside = /^\^\[\^(.+)\]\+\$$/u.exec(pattern)?.[1];
|
|
2203
2902
|
if (inside === void 0) return void 0;
|
|
@@ -2221,7 +2920,10 @@ function toFieldError(error, errors, m) {
|
|
|
2221
2920
|
}
|
|
2222
2921
|
case "not": {
|
|
2223
2922
|
if (RESERVED_ID.test(error.schemaPath)) return { pointer: at, message: m.reserved(STATE_ENDS) };
|
|
2224
|
-
|
|
2923
|
+
if (GIT_EVENT.test(error.schemaPath)) return { pointer: at, message: m.kindOnly(GIT_EVENTS, "git") };
|
|
2924
|
+
const last = at.slice(at.lastIndexOf("/") + 1);
|
|
2925
|
+
if (error.schemaPath === ABSENT) return { pointer: at, message: m.not({ field: last, kind: ABSENT_KINDS[last] ?? last }) };
|
|
2926
|
+
const allowed = NOT_ALLOWED[last];
|
|
2225
2927
|
return { pointer: allowed ? `${at}/${allowed.field}` : at, message: m.not(allowed) };
|
|
2226
2928
|
}
|
|
2227
2929
|
case "anyOf": {
|
|
@@ -2239,8 +2941,10 @@ function toFieldError(error, errors, m) {
|
|
|
2239
2941
|
return { pointer: at, message: m.type(String(params.type)) };
|
|
2240
2942
|
case "minLength":
|
|
2241
2943
|
return { pointer: at, message: m.minLength(Number(params.limit)) };
|
|
2242
|
-
case "pattern":
|
|
2243
|
-
|
|
2944
|
+
case "pattern": {
|
|
2945
|
+
const hex = HEX.exec(String(params.pattern));
|
|
2946
|
+
return { pointer: at, message: hex ? m.hex(Number(hex[1]), Number(hex[2])) : m.pattern(forbiddenOf(String(params.pattern))) };
|
|
2947
|
+
}
|
|
2244
2948
|
case "minItems":
|
|
2245
2949
|
return { pointer: at, message: m.minItems(Number(params.limit)) };
|
|
2246
2950
|
case "minimum":
|
|
@@ -2297,8 +3001,8 @@ var ja2 = () => {
|
|
|
2297
3001
|
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",
|
|
2298
3002
|
codeTwice: "1 \u3064\u306E\u6BB5\u306B code \u306F 1 \u884C\u307E\u3067",
|
|
2299
3003
|
emptyCode: "code \u306E\u5F8C\u308D\u306B\u547D\u4EE4\u3092\u66F8\u304F",
|
|
2300
|
-
declarationInStep: "group \u3068 box \u3068 strip \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
|
|
2301
|
-
stepLineBeforeStep: "\u7DDA\u3068 say \u3068 code \u3068 act \u3068 note \u3068 set \u306F step \u306E\u4E0B\u306B\u66F8\u304F",
|
|
3004
|
+
declarationInStep: "group \u3068 box \u3068 strip \u3068 branch \u306F\u6700\u521D\u306E step \u3088\u308A\u524D\u306B\u66F8\u304F",
|
|
3005
|
+
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",
|
|
2302
3006
|
nestedGroup: "group \u306E\u4E2D\u306B group \u306F\u66F8\u3051\u306A\u3044\u3002\u5148\u306B end \u3067\u9589\u3058\u308B",
|
|
2303
3007
|
strayEnd: "end \u306E\u524D\u306B\u3001\u9589\u3058\u308B group \u304C\u7121\u3044",
|
|
2304
3008
|
endTakesNothing: "end \u306E\u5F8C\u308D\u306B\u306F\u4F55\u3082\u66F8\u304B\u306A\u3044",
|
|
@@ -2330,7 +3034,20 @@ var ja2 = () => {
|
|
|
2330
3034
|
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`,
|
|
2331
3035
|
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",
|
|
2332
3036
|
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",
|
|
2333
|
-
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"
|
|
3037
|
+
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",
|
|
3038
|
+
gitOnly: (word) => `${word} \u306E\u884C\u306F git (\u679D\u5206\u304B\u308C\u306E\u56F3) \u3067\u3060\u3051\u66F8\u3051\u308B`,
|
|
3039
|
+
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",
|
|
3040
|
+
noBranches: "branch \u306E\u884C\u3067\u679D\u3092 1 \u3064\u4EE5\u4E0A\u5BA3\u8A00\u3059\u308B",
|
|
3041
|
+
branchShape: "branch \u306F branch <\u540D\u672D> [note: <\u6DFB\u3048\u66F8\u304D>] \u306E\u5F62\u3067\u66F8\u304F",
|
|
3042
|
+
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",
|
|
3043
|
+
fromShape: "\u679D\u3092\u5207\u308B\u884C\u306F <\u679D> from <commit> \u306E\u5F62\u3067\u66F8\u304F",
|
|
3044
|
+
undeclaredBranch: (id) => `${id} \u3068\u3044\u3046\u679D\u306F\u5BA3\u8A00\u3057\u3066\u3044\u306A\u3044`,
|
|
3045
|
+
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`,
|
|
3046
|
+
noCommit: (id) => `${id} \u3068\u3044\u3046 commit \u306F\u307E\u3060\u7A4D\u3093\u3067\u3044\u306A\u3044`,
|
|
3047
|
+
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`,
|
|
3048
|
+
mergeSelf: (id) => `${id} \u306F\u7A4D\u3080\u679D\u306A\u306E\u3067\u3001\u53D6\u308A\u8FBC\u3080\u679D\u306B\u3067\u304D\u306A\u3044`,
|
|
3049
|
+
headReserved: (name2) => `${name2} \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`,
|
|
3050
|
+
badHash: "hash \u306F 0 \u304B\u3089 9 \u3068 a \u304B\u3089 f \u306E\u5B57\u3067 4 \u304B\u3089 40 \u5B57\u306B\u3059\u308B"
|
|
2334
3051
|
};
|
|
2335
3052
|
};
|
|
2336
3053
|
var en2 = () => {
|
|
@@ -2366,8 +3083,8 @@ var en2 = () => {
|
|
|
2366
3083
|
sayTwice: "A step takes one say. Continue a long body on indented lines below it",
|
|
2367
3084
|
codeTwice: "A step takes at most one code line",
|
|
2368
3085
|
emptyCode: "Write the command after code",
|
|
2369
|
-
declarationInStep: "Write group, box and
|
|
2370
|
-
stepLineBeforeStep: "Write lines, say, code, act, note and
|
|
3086
|
+
declarationInStep: "Write group, box, strip and branch before the first step",
|
|
3087
|
+
stepLineBeforeStep: "Write lines, say, code, act, note, set, commit and branch cuts under a step",
|
|
2371
3088
|
nestedGroup: "A group cannot hold another group. Close it with end first",
|
|
2372
3089
|
strayEnd: "There is no group for this end to close",
|
|
2373
3090
|
endTakesNothing: "Write nothing after end",
|
|
@@ -2399,7 +3116,20 @@ var en2 = () => {
|
|
|
2399
3116
|
reservedId: (id) => `${id} names the start or end mark of a state diagram and cannot be a box id`,
|
|
2400
3117
|
intoStart: "A line cannot go into start. start is the start mark, and lines leave it",
|
|
2401
3118
|
outOfFinish: "A line cannot leave finish. finish is the end mark, and lines go into it",
|
|
2402
|
-
pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)"
|
|
3119
|
+
pathNoAttrs: "A line before the first step is a path not taken, so it takes no attributes (carry, tag, side)",
|
|
3120
|
+
gitOnly: (word) => `${word} lines can be written only in git diagrams`,
|
|
3121
|
+
gitNoGroup: "A git diagram takes no group. Declare branches with branch lines",
|
|
3122
|
+
noBranches: "Declare at least one branch with a branch line",
|
|
3123
|
+
branchShape: "Write a branch as branch <id> [note: <note>]",
|
|
3124
|
+
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>",
|
|
3125
|
+
fromShape: "Write a branch cut as <branch> from <commit>",
|
|
3126
|
+
undeclaredBranch: (id) => `No branch named ${id} is declared`,
|
|
3127
|
+
undeclaredRef: (id) => `No branch named ${id} is declared. A line that moves a ref starts from a branch id or HEAD`,
|
|
3128
|
+
noCommit: (id) => `No commit named ${id} has been made yet`,
|
|
3129
|
+
emptyBranch: (id) => `Branch ${id} does not point at any commit yet, so it cannot be merged`,
|
|
3130
|
+
mergeSelf: (id) => `${id} is the branch being committed to, so it cannot be the branch merged in`,
|
|
3131
|
+
headReserved: (name2) => `${name2} names where you are in a git diagram and cannot be an id`,
|
|
3132
|
+
badHash: "Write a hash as 4 to 40 characters of 0-9 and a-f"
|
|
2403
3133
|
};
|
|
2404
3134
|
};
|
|
2405
3135
|
var MESSAGES = { ja: ja2(), en: en2() };
|
|
@@ -2456,6 +3186,9 @@ var NotationError = class extends Error {
|
|
|
2456
3186
|
var fail = (source, index, message) => new NotationError(source.line, columnOf(source, index), message);
|
|
2457
3187
|
var ID = /^[^\s[\]「」=:]+$/u;
|
|
2458
3188
|
var EDGE = /^([^\s:[\]]+?)\s*->\s*([^\s:[\]]+)/du;
|
|
3189
|
+
var COMMIT = new RegExp(`^commit\\s+([^\\s[]+)(?:\\s+${ON}\\s+([^\\s[]+))?(?:\\s+${COPY}\\s+([^\\s[]+))?(?:\\s+${MERGE}\\s+([^\\s[]+))?`, "du");
|
|
3190
|
+
var CUT = new RegExp(`^([^\\s[]+)\\s+${FROM}(?:\\s+([^\\s[]+))?\\s*$`, "du");
|
|
3191
|
+
var HASH = /^[0-9a-f]{4,40}$/u;
|
|
2459
3192
|
var isOneOf = (list2, word) => list2.includes(word);
|
|
2460
3193
|
function skipSpaces(text2, at) {
|
|
2461
3194
|
let i = at;
|
|
@@ -2604,6 +3337,10 @@ function parseLines(lines, m) {
|
|
|
2604
3337
|
if (shown2 && !isOneOf(VIEWS, shown2.value)) throw fail(head, shown2.at, m.badView);
|
|
2605
3338
|
const view = shown2?.value;
|
|
2606
3339
|
const isState = kind === "state";
|
|
3340
|
+
const isGit = kind === "git";
|
|
3341
|
+
const branches = [];
|
|
3342
|
+
const commits = /* @__PURE__ */ new Set();
|
|
3343
|
+
const tips = /* @__PURE__ */ new Map();
|
|
2607
3344
|
const regions = [];
|
|
2608
3345
|
const boxes = [];
|
|
2609
3346
|
const paths = [];
|
|
@@ -2620,13 +3357,27 @@ function parseLines(lines, m) {
|
|
|
2620
3357
|
if (!boxes.some((box) => box.id === id)) throw fail(source, at, m.undeclaredBox(id));
|
|
2621
3358
|
return id;
|
|
2622
3359
|
};
|
|
3360
|
+
const branchAt = (source, id, at) => {
|
|
3361
|
+
if (!tips.has(id)) throw fail(source, at, m.undeclaredBranch(id));
|
|
3362
|
+
return id;
|
|
3363
|
+
};
|
|
3364
|
+
const commitAt = (source, id, at) => {
|
|
3365
|
+
if (!commits.has(id)) throw fail(source, at, m.noCommit(id));
|
|
3366
|
+
return id;
|
|
3367
|
+
};
|
|
2623
3368
|
const endAt = (source, id, at, side2) => {
|
|
3369
|
+
if (isGit) {
|
|
3370
|
+
if (side2 === "to") return commitAt(source, id, at);
|
|
3371
|
+
if (id !== HEAD && !tips.has(id)) throw fail(source, at, m.undeclaredRef(id));
|
|
3372
|
+
return id;
|
|
3373
|
+
}
|
|
2624
3374
|
if (!isState || !isOneOf(STATE_ENDS, id)) return boxAt(source, id, at);
|
|
2625
3375
|
if (id === "start" !== (side2 === "from")) throw fail(source, at, id === "start" ? m.intoStart : m.outOfFinish);
|
|
2626
3376
|
return id;
|
|
2627
3377
|
};
|
|
2628
3378
|
const notReserved = (source, id, at) => {
|
|
2629
3379
|
if (isState && isOneOf(STATE_ENDS, id)) throw fail(source, at, m.reservedId(id));
|
|
3380
|
+
if (isGit && id === HEAD) throw fail(source, at, m.headReserved(id));
|
|
2630
3381
|
};
|
|
2631
3382
|
const inStep = (source) => {
|
|
2632
3383
|
if (!building) throw fail(source, 0, m.stepLineBeforeStep);
|
|
@@ -2656,7 +3407,13 @@ function parseLines(lines, m) {
|
|
|
2656
3407
|
else inStep(source).events.push(readEdge(source, edge2));
|
|
2657
3408
|
continue;
|
|
2658
3409
|
}
|
|
2659
|
-
const word = text2.split(/\s
|
|
3410
|
+
const [word = "", second] = text2.split(/\s+/u);
|
|
3411
|
+
if (isGit && tips.has(word) && second === FROM) {
|
|
3412
|
+
const step = inStep(source);
|
|
3413
|
+
step.events.push(readCut(source));
|
|
3414
|
+
continue;
|
|
3415
|
+
}
|
|
3416
|
+
if (!isGit && (word === "branch" || word === "commit")) throw fail(source, 0, m.gitOnly(word));
|
|
2660
3417
|
if (!isOneOf(HEADS, word)) {
|
|
2661
3418
|
const old = oldForm(text2, building !== void 0);
|
|
2662
3419
|
throw fail(source, 0, old ? m.oldForm(old.word, old.shape) : m.unknownHead(word));
|
|
@@ -2710,11 +3467,20 @@ function parseLines(lines, m) {
|
|
|
2710
3467
|
case "set":
|
|
2711
3468
|
inStep(source).events.push(readSet(source));
|
|
2712
3469
|
break;
|
|
3470
|
+
case "branch":
|
|
3471
|
+
readBranch(source);
|
|
3472
|
+
break;
|
|
3473
|
+
case "commit": {
|
|
3474
|
+
const step = inStep(source);
|
|
3475
|
+
step.events.push(readCommit(source));
|
|
3476
|
+
break;
|
|
3477
|
+
}
|
|
2713
3478
|
}
|
|
2714
3479
|
}
|
|
2715
3480
|
if (group) throw fail(group.source, 0, m.unclosedGroup(group.id));
|
|
2716
3481
|
finish();
|
|
2717
|
-
if (
|
|
3482
|
+
if (isGit && branches.length === 0) throw fail(head, 0, m.noBranches);
|
|
3483
|
+
if (boxes.length === 0 && !isGit) throw fail(head, 0, m.noBoxes);
|
|
2718
3484
|
if (steps.length === 0) throw fail(head, 0, m.noSteps);
|
|
2719
3485
|
return {
|
|
2720
3486
|
version: FORMAT_VERSION,
|
|
@@ -2726,10 +3492,12 @@ function parseLines(lines, m) {
|
|
|
2726
3492
|
...strip2 ? { strip: strip2 } : {},
|
|
2727
3493
|
steps,
|
|
2728
3494
|
...kind === "sequence" ? { sequence: { lifelines: boxes.map((box) => box.id) } } : {},
|
|
2729
|
-
...paths.length > 0 ? { state: { paths } } : {}
|
|
3495
|
+
...paths.length > 0 ? { state: { paths } } : {},
|
|
3496
|
+
...isGit ? { git: { branches } } : {}
|
|
2730
3497
|
};
|
|
2731
3498
|
function readGroup(source) {
|
|
2732
3499
|
beforeSteps(source);
|
|
3500
|
+
if (isGit) throw fail(source, 0, m.gitNoGroup);
|
|
2733
3501
|
if (group) throw fail(source, 0, m.nestedGroup);
|
|
2734
3502
|
const declared = readDeclared(source, "group", ATTRS.group, m);
|
|
2735
3503
|
if (regions.some((region) => region.id === declared.id)) {
|
|
@@ -2755,6 +3523,62 @@ function parseLines(lines, m) {
|
|
|
2755
3523
|
...group ? { region: group.id } : {}
|
|
2756
3524
|
});
|
|
2757
3525
|
}
|
|
3526
|
+
function readBranch(source) {
|
|
3527
|
+
beforeSteps(source);
|
|
3528
|
+
const declared = readDeclared(source, "branch", ATTRS.branch, m);
|
|
3529
|
+
if (declared.name !== void 0) throw fail(source, 0, m.branchShape);
|
|
3530
|
+
notReserved(source, declared.id, declared.idAt);
|
|
3531
|
+
declare(source, declared.id, declared.idAt);
|
|
3532
|
+
const note = declared.attrs.get("note")?.value;
|
|
3533
|
+
branches.push({ id: declared.id, ...note !== void 0 ? { note } : {} });
|
|
3534
|
+
tips.set(declared.id, null);
|
|
3535
|
+
}
|
|
3536
|
+
function readCommit(source) {
|
|
3537
|
+
const text2 = source.text;
|
|
3538
|
+
const found = COMMIT.exec(text2);
|
|
3539
|
+
const at = (k) => found?.indices?.[k]?.[0] ?? 0;
|
|
3540
|
+
const id = found?.[1];
|
|
3541
|
+
const on = found?.[2];
|
|
3542
|
+
if (!found || id === void 0 || on === void 0) throw fail(source, 0, m.commitShape);
|
|
3543
|
+
const rest2 = skipSpaces(text2, found[0].length);
|
|
3544
|
+
if (rest2 < text2.length && text2[rest2] !== "[") throw fail(source, rest2, m.commitShape);
|
|
3545
|
+
if (!ID.test(id)) throw fail(source, at(1), m.badId(id));
|
|
3546
|
+
notReserved(source, id, at(1));
|
|
3547
|
+
declare(source, id, at(1));
|
|
3548
|
+
const branch = branchAt(source, on, at(2));
|
|
3549
|
+
const copy = found[3] === void 0 ? void 0 : commitAt(source, found[3], at(3));
|
|
3550
|
+
const merge = found[4] === void 0 ? void 0 : mergedAt(source, found[4], at(4), branch);
|
|
3551
|
+
const attrs2 = rest2 < text2.length ? readAttrs(source, rest2, ATTRS.commit, m) : /* @__PURE__ */ new Map();
|
|
3552
|
+
const hash = attrs2.get("hash");
|
|
3553
|
+
if (hash && !HASH.test(hash.value)) throw fail(source, hash.at, m.badHash);
|
|
3554
|
+
const note = attrs2.get("note")?.value;
|
|
3555
|
+
commits.add(id);
|
|
3556
|
+
if (copy === void 0) tips.set(branch, id);
|
|
3557
|
+
return {
|
|
3558
|
+
type: "commit",
|
|
3559
|
+
id,
|
|
3560
|
+
branch,
|
|
3561
|
+
...copy !== void 0 ? { copy } : {},
|
|
3562
|
+
...merge !== void 0 ? { merge } : {},
|
|
3563
|
+
...hash ? { hash: hash.value } : {},
|
|
3564
|
+
...note !== void 0 ? { note } : {}
|
|
3565
|
+
};
|
|
3566
|
+
}
|
|
3567
|
+
function mergedAt(source, id, at, into) {
|
|
3568
|
+
branchAt(source, id, at);
|
|
3569
|
+
if (id === into) throw fail(source, at, m.mergeSelf(id));
|
|
3570
|
+
if (tips.get(id) === null) throw fail(source, at, m.emptyBranch(id));
|
|
3571
|
+
return id;
|
|
3572
|
+
}
|
|
3573
|
+
function readCut(source) {
|
|
3574
|
+
const found = CUT.exec(source.text);
|
|
3575
|
+
const branch = found?.[1];
|
|
3576
|
+
const from = found?.[2];
|
|
3577
|
+
if (!found || branch === void 0 || from === void 0) throw fail(source, 0, m.fromShape);
|
|
3578
|
+
commitAt(source, from, found.indices?.[2]?.[0] ?? 0);
|
|
3579
|
+
tips.set(branch, from);
|
|
3580
|
+
return { type: "branch", branch, from };
|
|
3581
|
+
}
|
|
2758
3582
|
function readStrip(source) {
|
|
2759
3583
|
beforeSteps(source);
|
|
2760
3584
|
if (strip2) throw fail(source, 0, m.stripTwice);
|
|
@@ -2828,9 +3652,10 @@ function parseLines(lines, m) {
|
|
|
2828
3652
|
if (carried && !isOneOf(CARRIES, carried.value)) throw fail(source, carried.at, m.badCarry);
|
|
2829
3653
|
const side2 = attrs2.get("side");
|
|
2830
3654
|
if (side2 && !isOneOf(SIDES, side2.value)) throw fail(source, side2.at, m.badSide);
|
|
2831
|
-
let carry = { kind: "envelope" };
|
|
3655
|
+
let carry = isGit ? { kind: "tag", text: from } : { kind: "envelope" };
|
|
2832
3656
|
if (tag) carry = { kind: "tag", text: tag.value };
|
|
2833
3657
|
else if (carried) carry = carried.value === "coin" ? { kind: "coin" } : { kind: "none" };
|
|
3658
|
+
if (isGit && from !== HEAD) tips.set(from, to);
|
|
2834
3659
|
return {
|
|
2835
3660
|
type: "edge",
|
|
2836
3661
|
from,
|
|
@@ -2906,10 +3731,11 @@ var declareBox = (b) => `box ${b.id}${shown(b.id, b.name)}${attrs([
|
|
|
2906
3731
|
["icon", b.icon]
|
|
2907
3732
|
])}`;
|
|
2908
3733
|
var line = (from, to, label2) => `${from} -> ${to}${label2 === void 0 ? "" : `: ${name(label2)}`}`;
|
|
2909
|
-
function event(e) {
|
|
3734
|
+
function event(e, git) {
|
|
2910
3735
|
switch (e.type) {
|
|
2911
3736
|
case "edge": {
|
|
2912
|
-
const
|
|
3737
|
+
const plain = git ? e.carry.kind === "tag" && e.carry.text === e.from : e.carry.kind === "envelope";
|
|
3738
|
+
const carry = plain ? [] : e.carry.kind === "tag" ? [["tag", e.carry.text]] : [["carry", e.carry.kind]];
|
|
2913
3739
|
return `${line(e.from, e.to, e.label)}${attrs([...carry, ["side", e.labelSide]])}`;
|
|
2914
3740
|
}
|
|
2915
3741
|
case "action":
|
|
@@ -2918,6 +3744,13 @@ function event(e) {
|
|
|
2918
3744
|
return `note ${e.box}: ${e.text}`;
|
|
2919
3745
|
case "strip":
|
|
2920
3746
|
return `set ${key(e.field)}${e.value === void 0 ? "" : `: ${name(e.value)}`}${attrs([["tag", e.tag]])}`;
|
|
3747
|
+
case "commit":
|
|
3748
|
+
return `commit ${e.id} ${ON} ${e.branch}${e.copy === void 0 ? "" : ` ${COPY} ${e.copy}`}${e.merge === void 0 ? "" : ` ${MERGE} ${e.merge}`}${attrs([
|
|
3749
|
+
["hash", e.hash],
|
|
3750
|
+
["note", e.note]
|
|
3751
|
+
])}`;
|
|
3752
|
+
case "branch":
|
|
3753
|
+
return `${e.branch} ${FROM} ${e.from}`;
|
|
2921
3754
|
}
|
|
2922
3755
|
}
|
|
2923
3756
|
function declarations(diagram) {
|
|
@@ -2953,14 +3786,15 @@ end`);
|
|
|
2953
3786
|
return blocks;
|
|
2954
3787
|
}
|
|
2955
3788
|
function printNotation(diagram) {
|
|
2956
|
-
const
|
|
3789
|
+
const branches = (diagram.git?.branches ?? []).map((b) => `branch ${b.id}${attrs([["note", b.note]])}`);
|
|
3790
|
+
const blocks = [`${diagram.kind} ${name(diagram.title)}${attrs([["view", diagram.view]])}`, ...branches.length > 0 ? [branches.join("\n")] : [], ...declarations(diagram)];
|
|
2957
3791
|
if (diagram.strip) blocks.push(`strip ${key(diagram.strip.title)}: ${diagram.strip.fields.map(field).join(", ")}`);
|
|
2958
3792
|
if (diagram.state) blocks.push(diagram.state.paths.map((p) => line(p.from, p.to, p.label)).join("\n"));
|
|
2959
3793
|
for (const step of diagram.steps) {
|
|
2960
3794
|
const body = step.body.split("\n");
|
|
2961
3795
|
const say = body.length === 1 ? [` say ${step.body}`] : [" say", ...body.map((line2) => line2 === "" ? "" : ` ${line2}`)];
|
|
2962
3796
|
blocks.push(
|
|
2963
|
-
[`step ${step.title}`, ...say, ...step.code === void 0 ? [] : [` code ${step.code}`], ...step.events.map((e) => ` ${event(e)}`)].join("\n")
|
|
3797
|
+
[`step ${step.title}`, ...say, ...step.code === void 0 ? [] : [` code ${step.code}`], ...step.events.map((e) => ` ${event(e, diagram.kind === "git")}`)].join("\n")
|
|
2964
3798
|
);
|
|
2965
3799
|
}
|
|
2966
3800
|
return `${blocks.join("\n\n")}
|
|
@@ -3226,7 +4060,11 @@ var TYPE = {
|
|
|
3226
4060
|
stepTitle: text(15, 700),
|
|
3227
4061
|
stepBody: text(13.5, 500),
|
|
3228
4062
|
stepNo: text(13, 700, "mono"),
|
|
3229
|
-
button: text(14, 700)
|
|
4063
|
+
button: text(14, 700),
|
|
4064
|
+
/** 枝分かれの図 (#3164) の、丸の中の commit の名札と、丸の外に添える hash と一言 */
|
|
4065
|
+
gitId: text(11, 700),
|
|
4066
|
+
gitHash: text(10.5, 600, "mono"),
|
|
4067
|
+
gitNote: text(10.5, 650)
|
|
3230
4068
|
};
|
|
3231
4069
|
var LOOK = {
|
|
3232
4070
|
/** 部品どうしの最小の隙間 */
|
|
@@ -3270,6 +4108,41 @@ var LOOK = {
|
|
|
3270
4108
|
done: { r: 6.5, inset: 13 },
|
|
3271
4109
|
pastLabel: 0.85
|
|
3272
4110
|
},
|
|
4111
|
+
/**
|
|
4112
|
+
* 枝分かれの図 (#3164)。見本帳の試作 (`scenes/git.js`) の寸法を写す。
|
|
4113
|
+
* commit は列ごとに `pitch` ずつ右へ並べ、一番上でない帯の commit は列の半分だけ右へずらす。`x0` は最初の列の真ん中の x の下限、
|
|
4114
|
+
* `textGap` は隣の列の hash と一言の間に空ける最小の隙間。`r` は丸の半径、`orphan` はどの札からも辿れなくなった commit の点線の丸の半径。
|
|
4115
|
+
* `topLine` と `line` は帯の上端から丸を並べる線まで (一番上の帯と、それより下の帯)、`topBelow` と `below` は線から帯の下端まで。
|
|
4116
|
+
* `bare` は線の名前を下に置かない帯の、線から帯の下端まで。
|
|
4117
|
+
* hash と一言は一番上の帯では丸の上に、ほかの帯では丸の下に置き、`above` と `under` は丸の真ん中から丸に近い行の基準線まで、`lineStep` は行の間。
|
|
4118
|
+
* 札は丸の上に段を重ねて置き、`tagTop` と `tag` は丸の真ん中から 1 段目の札の真ん中まで (一番上の帯と、ほかの帯)、`row` は札の段の間。
|
|
4119
|
+
* 札の段が 2 段より多い commit がある帯は、多い段の分だけ線を下げる。
|
|
4120
|
+
* `turn` は枝へ分かれる線と枝から入る線が曲がり終えて横へ進むまでの長さ、`samples` は曲がりを区切る点の数、`boxGap` は commit の並びと箱の間。
|
|
4121
|
+
* `labelUnder` はほかの帯で、丸の真ん中から線の名前の札の上端まで。`colors` は帯の色を上から配る順
|
|
4122
|
+
*/
|
|
4123
|
+
git: {
|
|
4124
|
+
x0: 120,
|
|
4125
|
+
pitch: 90,
|
|
4126
|
+
textGap: 12,
|
|
4127
|
+
r: 12,
|
|
4128
|
+
orphan: 13.5,
|
|
4129
|
+
topLine: 120,
|
|
4130
|
+
line: 90,
|
|
4131
|
+
topBelow: 30,
|
|
4132
|
+
below: 82,
|
|
4133
|
+
bare: 62,
|
|
4134
|
+
above: 18,
|
|
4135
|
+
under: 27,
|
|
4136
|
+
lineStep: 13,
|
|
4137
|
+
tagTop: 58,
|
|
4138
|
+
tag: 30,
|
|
4139
|
+
row: 22,
|
|
4140
|
+
turn: 60,
|
|
4141
|
+
samples: 12,
|
|
4142
|
+
boxGap: 24,
|
|
4143
|
+
labelUnder: 50,
|
|
4144
|
+
colors: ["blue", "violet", "green", "amber", "rose"]
|
|
4145
|
+
},
|
|
3273
4146
|
/** `bend` は線の曲がりを丸める半径 (#3171) */
|
|
3274
4147
|
edge: { inset: 3, arrow: 6, arrowHalf: 3.5, parallel: 5, ghostDash: 5, flowDash: 9, bend: 12 },
|
|
3275
4148
|
/** `touch` は線の名前と、同じ時刻に見えている段の番号の丸の間に空ける最小の隙間 (#3175) */
|
|
@@ -3290,7 +4163,7 @@ var LOOK = {
|
|
|
3290
4163
|
* `trail` は状態遷移図の帯の最後の、通った状態の点 (#3171)。`r` は点の半径、`step` は点の中心どうしの間、`now` は変わった値の欄の名前の横の点の半径と、名前からの離れ
|
|
3291
4164
|
*/
|
|
3292
4165
|
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 } },
|
|
3293
|
-
stroke: { mark: 1.6, 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 },
|
|
4166
|
+
stroke: { git: 2.25, gitOrphan: 1.5, mark: 1.6, 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 },
|
|
3294
4167
|
shadow: { near: 0.8, far: 4, nearY: 1, farY: 3 },
|
|
3295
4168
|
mini: { w: 168, pad: 8, title: 14, inset: 12, radius: 10 },
|
|
3296
4169
|
/**
|
|
@@ -3912,7 +4785,7 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
3912
4785
|
const headerW = Math.max(0, ...headers.map((h) => h ? h.w + R.inset * 2 : 0));
|
|
3913
4786
|
const colLeft = [];
|
|
3914
4787
|
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]);
|
|
3915
|
-
const
|
|
4788
|
+
const center2 = (c) => colLeft[c] + colW[c] / 2;
|
|
3916
4789
|
const looped = new Set(edges.filter(({ edge: edge2 }) => edge2.from === edge2.to).map(({ edge: edge2 }) => edge2.from));
|
|
3917
4790
|
const loopRows = new Set([...looped].flatMap((id) => {
|
|
3918
4791
|
const slot = slots.get(id);
|
|
@@ -3932,7 +4805,7 @@ function arrange(diagram, groups, slots, rooms) {
|
|
|
3932
4805
|
const slot = slots.get(id);
|
|
3933
4806
|
const source = diagram.boxes.find((b) => b.id === id);
|
|
3934
4807
|
const w = widths.get(id) ?? B.minW;
|
|
3935
|
-
const cx =
|
|
4808
|
+
const cx = center2(slot.col);
|
|
3936
4809
|
const y = top + rowTop[slot.row];
|
|
3937
4810
|
boxes.push({
|
|
3938
4811
|
id,
|
|
@@ -4156,6 +5029,492 @@ function grow(layout, groups, slots, rooms) {
|
|
|
4156
5029
|
return grown;
|
|
4157
5030
|
}
|
|
4158
5031
|
|
|
5032
|
+
// src/layout/git.ts
|
|
5033
|
+
var isGitLayout = (layout) => layout.kind === "git";
|
|
5034
|
+
function walk(diagram) {
|
|
5035
|
+
const branches = (diagram.git?.branches ?? []).map((b) => b.id);
|
|
5036
|
+
const lane = (id) => {
|
|
5037
|
+
if (!branches.includes(id)) branches.push(id);
|
|
5038
|
+
};
|
|
5039
|
+
for (const step of diagram.steps) for (const e of step.events) if (e.type === "commit" || e.type === "branch") lane(e.branch);
|
|
5040
|
+
const tips = new Map(branches.map((b) => [b, null]));
|
|
5041
|
+
let headAt = null;
|
|
5042
|
+
let attached = null;
|
|
5043
|
+
const made = [];
|
|
5044
|
+
const byId = /* @__PURE__ */ new Map();
|
|
5045
|
+
const links = [];
|
|
5046
|
+
const moves = [];
|
|
5047
|
+
const tags = [];
|
|
5048
|
+
const rows = /* @__PURE__ */ new Map();
|
|
5049
|
+
const most = /* @__PURE__ */ new Map();
|
|
5050
|
+
const shown2 = /* @__PURE__ */ new Map();
|
|
5051
|
+
const names = [...branches, HEAD];
|
|
5052
|
+
const at = new Map(names.map((n) => [n, []]));
|
|
5053
|
+
const heads = [];
|
|
5054
|
+
const visible2 = (ref) => ref === HEAD ? attached === null ? headAt : null : tips.get(ref) ?? null;
|
|
5055
|
+
const freeRow = (commit2) => {
|
|
5056
|
+
const list2 = rows.get(commit2) ?? [];
|
|
5057
|
+
const free = list2.indexOf(null);
|
|
5058
|
+
return free < 0 ? list2.length : free;
|
|
5059
|
+
};
|
|
5060
|
+
const settle = (step, event2, change, lineFor) => {
|
|
5061
|
+
const before = new Map(names.map((n) => [n, visible2(n)]));
|
|
5062
|
+
const headBefore = headAt;
|
|
5063
|
+
change();
|
|
5064
|
+
const changed = names.filter((n) => before.get(n) !== visible2(n));
|
|
5065
|
+
const leaving = changed.map((ref) => {
|
|
5066
|
+
const slot = shown2.get(ref);
|
|
5067
|
+
if (slot) {
|
|
5068
|
+
rows.get(slot.commit)[slot.row] = null;
|
|
5069
|
+
shown2.delete(ref);
|
|
5070
|
+
}
|
|
5071
|
+
return { ref, slot };
|
|
5072
|
+
});
|
|
5073
|
+
for (const { ref, slot } of leaving) {
|
|
5074
|
+
const from = slot ?? (ref === HEAD && headBefore !== null ? { commit: headBefore, row: freeRow(headBefore) } : void 0);
|
|
5075
|
+
const target = visible2(ref);
|
|
5076
|
+
let to;
|
|
5077
|
+
if (target !== null) {
|
|
5078
|
+
to = { commit: target, row: freeRow(target) };
|
|
5079
|
+
const list2 = rows.get(target) ?? [];
|
|
5080
|
+
list2[to.row] = ref;
|
|
5081
|
+
rows.set(target, list2);
|
|
5082
|
+
most.set(target, Math.max(most.get(target) ?? 0, list2.filter((r) => r !== null).length));
|
|
5083
|
+
shown2.set(ref, to);
|
|
5084
|
+
}
|
|
5085
|
+
moves.push({ ref, step, event: event2, ...from ? { from } : {}, ...to ? { to } : {}, line: ref === lineFor });
|
|
5086
|
+
}
|
|
5087
|
+
};
|
|
5088
|
+
const prune = (step, event2) => {
|
|
5089
|
+
const reach = /* @__PURE__ */ new Set();
|
|
5090
|
+
const stack = [...tips.values(), headAt].filter((c) => c !== null);
|
|
5091
|
+
while (stack.length > 0) {
|
|
5092
|
+
const id = stack.pop();
|
|
5093
|
+
if (reach.has(id)) continue;
|
|
5094
|
+
reach.add(id);
|
|
5095
|
+
stack.push(...byId.get(id)?.parents ?? []);
|
|
5096
|
+
}
|
|
5097
|
+
for (const c of made) if (!reach.has(c.id) && c.orphan === void 0) c.orphan = { step, event: event2 };
|
|
5098
|
+
};
|
|
5099
|
+
diagram.steps.forEach((step, s) => {
|
|
5100
|
+
step.events.forEach((e, k) => {
|
|
5101
|
+
if (e.type === "commit") commit(e, s, k);
|
|
5102
|
+
else if (e.type === "branch") {
|
|
5103
|
+
if (!byId.has(e.from)) return;
|
|
5104
|
+
if (laneOf(e.from) !== e.branch) links.push({ kind: "branch", from: e.from, to: e.branch, step: s, event: k });
|
|
5105
|
+
settle(s, k, () => {
|
|
5106
|
+
tips.set(e.branch, e.from);
|
|
5107
|
+
attached = e.branch;
|
|
5108
|
+
headAt = e.from;
|
|
5109
|
+
});
|
|
5110
|
+
} else if (e.type === "edge") {
|
|
5111
|
+
const ref = e.from;
|
|
5112
|
+
if (ref !== HEAD && !tips.has(ref) || !byId.has(e.to)) return;
|
|
5113
|
+
settle(
|
|
5114
|
+
s,
|
|
5115
|
+
k,
|
|
5116
|
+
() => {
|
|
5117
|
+
if (ref === HEAD) {
|
|
5118
|
+
attached = null;
|
|
5119
|
+
headAt = e.to;
|
|
5120
|
+
return;
|
|
5121
|
+
}
|
|
5122
|
+
tips.set(ref, e.to);
|
|
5123
|
+
if (attached === ref) headAt = e.to;
|
|
5124
|
+
else if (attached === null && headAt === e.to) attached = ref;
|
|
5125
|
+
},
|
|
5126
|
+
ref
|
|
5127
|
+
);
|
|
5128
|
+
} else return;
|
|
5129
|
+
prune(s, k);
|
|
5130
|
+
});
|
|
5131
|
+
for (const n of names) at.get(n)?.push(n === HEAD ? headAt : tips.get(n) ?? null);
|
|
5132
|
+
heads.push(attached);
|
|
5133
|
+
for (const n of names) {
|
|
5134
|
+
const slot = shown2.get(n);
|
|
5135
|
+
if (slot) tags.push({ ref: n, step: s, slot });
|
|
5136
|
+
}
|
|
5137
|
+
});
|
|
5138
|
+
function laneOf(id) {
|
|
5139
|
+
return byId.get(id)?.branch;
|
|
5140
|
+
}
|
|
5141
|
+
function commit(e, s, k) {
|
|
5142
|
+
if (byId.has(e.id)) return;
|
|
5143
|
+
const copy = e.copy !== void 0 && byId.has(e.copy) ? e.copy : void 0;
|
|
5144
|
+
const base = copy !== void 0 && attached === null && headAt !== null ? headAt : tips.get(e.branch) ?? null;
|
|
5145
|
+
const joined = e.merge !== void 0 && e.merge !== e.branch ? tips.get(e.merge) ?? void 0 : void 0;
|
|
5146
|
+
const parents = [...new Set([base, joined].filter((c2) => c2 !== null && c2 !== void 0))];
|
|
5147
|
+
const c = {
|
|
5148
|
+
id: e.id,
|
|
5149
|
+
branch: e.branch,
|
|
5150
|
+
parents,
|
|
5151
|
+
...joined !== void 0 && joined !== base ? { joined } : {},
|
|
5152
|
+
...copy !== void 0 ? { copy } : {},
|
|
5153
|
+
...e.hash !== void 0 ? { hash: e.hash } : {},
|
|
5154
|
+
...e.note !== void 0 ? { note: e.note } : {},
|
|
5155
|
+
step: s,
|
|
5156
|
+
event: k
|
|
5157
|
+
};
|
|
5158
|
+
made.push(c);
|
|
5159
|
+
byId.set(c.id, c);
|
|
5160
|
+
for (const p of parents) links.push({ kind: "parent", from: p, to: c.id, step: s, event: k });
|
|
5161
|
+
if (copy !== void 0) links.push({ kind: "copy", from: copy, to: c.id, step: s, event: k });
|
|
5162
|
+
const first = attached === null && headAt === null;
|
|
5163
|
+
settle(s, k, () => {
|
|
5164
|
+
if (copy === void 0) {
|
|
5165
|
+
tips.set(e.branch, c.id);
|
|
5166
|
+
if (attached === e.branch) headAt = c.id;
|
|
5167
|
+
} else if (attached === null) headAt = c.id;
|
|
5168
|
+
if (first) {
|
|
5169
|
+
attached = e.branch;
|
|
5170
|
+
headAt = c.id;
|
|
5171
|
+
}
|
|
5172
|
+
});
|
|
5173
|
+
}
|
|
5174
|
+
const refs = names.map((name2) => ({ name: name2, at: at.get(name2) ?? [], ...name2 === HEAD ? { attached: heads } : {} }));
|
|
5175
|
+
return { branches, made, links, moves, refs, tags, rows: most };
|
|
5176
|
+
}
|
|
5177
|
+
function cubic(p0, c1, c2, p3) {
|
|
5178
|
+
const n = LOOK.git.samples;
|
|
5179
|
+
return Array.from({ length: n }, (_, k) => {
|
|
5180
|
+
const t = (k + 1) / n;
|
|
5181
|
+
const u = 1 - t;
|
|
5182
|
+
const at = (i) => u * u * u * p0[i] + 3 * u * u * t * c1[i] + 3 * u * t * t * c2[i] + t * t * t * p3[i];
|
|
5183
|
+
return [at(0), at(1)];
|
|
5184
|
+
});
|
|
5185
|
+
}
|
|
5186
|
+
function elbow(from, to) {
|
|
5187
|
+
if (Math.abs(from[1] - to[1]) < 0.5) return [from, to];
|
|
5188
|
+
return from[1] > to[1] ? [from, [from[0], to[1]], to] : [from, [to[0], from[1]], to];
|
|
5189
|
+
}
|
|
5190
|
+
function fork(p, tx, ty) {
|
|
5191
|
+
const sign = ty > p.cy ? 1 : -1;
|
|
5192
|
+
const p0 = [p.cx, p.cy + sign * p.r];
|
|
5193
|
+
const turn = Math.max(0, Math.min(LOOK.git.turn, tx - p.cx));
|
|
5194
|
+
const p3 = [p.cx + turn, ty];
|
|
5195
|
+
const curve = cubic(p0, [p0[0], p0[1] + (ty - p0[1]) * 0.7], [p.cx + turn * 0.2, ty], p3);
|
|
5196
|
+
return [p0, ...curve, ...tx > p3[0] ? [[tx, ty]] : []];
|
|
5197
|
+
}
|
|
5198
|
+
function join(p, c) {
|
|
5199
|
+
const sign = c.cy < p.cy ? 1 : -1;
|
|
5200
|
+
const p0 = [p.cx + p.r, p.cy];
|
|
5201
|
+
const p3 = [c.cx, c.cy + sign * c.r];
|
|
5202
|
+
const turn = Math.max(0, Math.min(LOOK.git.turn, c.cx - p0[0]));
|
|
5203
|
+
const h = [c.cx - turn, p.cy];
|
|
5204
|
+
const curve = cubic(h, [c.cx - turn * 0.2, p.cy], [c.cx, p3[1] + (p.cy - p3[1]) * 0.7], p3);
|
|
5205
|
+
return [p0, ...h[0] > p0[0] ? [h] : [], ...curve];
|
|
5206
|
+
}
|
|
5207
|
+
function copyLine(p, c) {
|
|
5208
|
+
if (Math.abs(p.cy - c.cy) < 0.5) {
|
|
5209
|
+
const top = p.cy - p.r;
|
|
5210
|
+
const lift = LOOK.git.turn * 0.7;
|
|
5211
|
+
return [[p.cx, top], ...cubic([p.cx, top], [p.cx, top - lift], [c.cx, top - lift], [c.cx, top])];
|
|
5212
|
+
}
|
|
5213
|
+
const sign = c.cy < p.cy ? -1 : 1;
|
|
5214
|
+
const p0 = [p.cx, p.cy + sign * p.r];
|
|
5215
|
+
const p3 = [c.cx, c.cy - sign * c.r];
|
|
5216
|
+
const mid = (p3[1] - p0[1]) * 0.5;
|
|
5217
|
+
return [p0, ...cubic(p0, [p0[0], p0[1] + mid], [p3[0], p3[1] - mid], p3)];
|
|
5218
|
+
}
|
|
5219
|
+
function layoutGit(diagram) {
|
|
5220
|
+
const { margin, gap, box: B, region: R, git: G, carrier: C } = LOOK;
|
|
5221
|
+
const walked = walk(diagram);
|
|
5222
|
+
const notes = new Map((diagram.git?.branches ?? []).map((b) => [b.id, b.note]));
|
|
5223
|
+
const laneIndex = new Map(walked.branches.map((id, i) => [id, i]));
|
|
5224
|
+
const colorOf2 = (branch) => G.colors[(laneIndex.get(branch) ?? 0) % G.colors.length];
|
|
5225
|
+
const col = /* @__PURE__ */ new Map();
|
|
5226
|
+
const laneLast = /* @__PURE__ */ new Map();
|
|
5227
|
+
for (const c of walked.made) {
|
|
5228
|
+
const k = Math.max(0, ...c.parents.map((p) => (col.get(p) ?? -1) + 1), (laneLast.get(c.branch) ?? -1) + 1);
|
|
5229
|
+
col.set(c.id, k);
|
|
5230
|
+
laneLast.set(c.branch, k);
|
|
5231
|
+
}
|
|
5232
|
+
const linesOf = (c) => [
|
|
5233
|
+
...c.hash !== void 0 ? [{ text: c.hash, style: TYPE.gitHash }] : [],
|
|
5234
|
+
...c.note !== void 0 ? [{ text: c.note, style: TYPE.gitNote }] : []
|
|
5235
|
+
];
|
|
5236
|
+
const textW = (c) => Math.max(0, ...linesOf(c).map((line2) => textWidth(line2.text, line2.style)));
|
|
5237
|
+
const tagW = (ref) => textWidth(ref, hasWide(ref) ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
|
|
5238
|
+
const refWidth = Math.max(0, ...walked.refs.map((r) => tagW(r.name)));
|
|
5239
|
+
const pitch = Math.max(G.pitch, ...walked.made.map((c) => textW(c) + G.textGap), refWidth + G.textGap);
|
|
5240
|
+
const headers = walked.branches.map((id) => ({ w: Math.max(R.icon, textWidth(id, TYPE.regionName), textWidth(notes.get(id) ?? "", TYPE.regionNote)) }));
|
|
5241
|
+
const headerRight = margin + R.inset + Math.max(0, ...headers.map((h) => h.w));
|
|
5242
|
+
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);
|
|
5243
|
+
const x0 = Math.max(G.x0, headerRight + gap + firstHalf);
|
|
5244
|
+
const named = new Set(
|
|
5245
|
+
walked.moves.flatMap((mv) => {
|
|
5246
|
+
const source = diagram.steps[mv.step]?.events[mv.event];
|
|
5247
|
+
return mv.line && mv.to && source?.type === "edge" && source.label !== void 0 ? [walked.made.find((c) => c.id === mv.to?.commit)?.branch ?? ""] : [];
|
|
5248
|
+
})
|
|
5249
|
+
);
|
|
5250
|
+
const extraRows = (branch) => Math.max(0, ...walked.made.filter((c) => c.branch === branch).map((c) => (walked.rows.get(c.id) ?? 0) - 2)) * G.row;
|
|
5251
|
+
const topText = walked.made.some((c) => laneIndex.get(c.branch) === 0 && linesOf(c).length > 0);
|
|
5252
|
+
const lanes = [];
|
|
5253
|
+
let y = margin;
|
|
5254
|
+
walked.branches.forEach((id, i) => {
|
|
5255
|
+
const top = i === 0;
|
|
5256
|
+
const tagBase = top && topText ? G.tagTop : G.tag;
|
|
5257
|
+
const line2 = y + (top ? G.topLine - (G.tagTop - tagBase) : G.line) + extraRows(id);
|
|
5258
|
+
const h = line2 - y + (top ? G.topBelow : named.has(id) ? G.below : G.bare);
|
|
5259
|
+
lanes.push({ id, x: margin, y, w: 0, h, line: line2, color: colorOf2(id), tagBase });
|
|
5260
|
+
y += h + R.gap;
|
|
5261
|
+
});
|
|
5262
|
+
const lanesBottom = y - R.gap;
|
|
5263
|
+
const laneOf = new Map(lanes.map((l) => [l.id, l]));
|
|
5264
|
+
const commits = walked.made.map((c) => {
|
|
5265
|
+
const lane = laneOf.get(c.branch);
|
|
5266
|
+
const isTop = laneIndex.get(c.branch) === 0;
|
|
5267
|
+
const cx = x0 + pitch * (col.get(c.id) ?? 0) + (isTop ? 0 : pitch / 2);
|
|
5268
|
+
const cy = lane.line;
|
|
5269
|
+
const lines = linesOf(c);
|
|
5270
|
+
const baselines = lines.map((_, k) => isTop ? cy - G.above - (lines.length - 1 - k) * G.lineStep : cy + G.under + k * G.lineStep);
|
|
5271
|
+
const boxes2 = lines.map((line2, k) => textBox(line2.text, cx, baselines[k], line2.style, "middle"));
|
|
5272
|
+
const text2 = boxes2.length === 0 ? void 0 : { ...union(boxes2), lines: lines.map((line2) => line2.text), baselines };
|
|
5273
|
+
const color = c.copy !== void 0 ? colorOf2(walked.made.find((m) => m.id === c.copy)?.branch ?? c.branch) : colorOf2(c.branch);
|
|
5274
|
+
return {
|
|
5275
|
+
id: c.id,
|
|
5276
|
+
branch: c.branch,
|
|
5277
|
+
color,
|
|
5278
|
+
cx,
|
|
5279
|
+
cy,
|
|
5280
|
+
r: G.r,
|
|
5281
|
+
step: c.step,
|
|
5282
|
+
event: c.event,
|
|
5283
|
+
parents: c.parents,
|
|
5284
|
+
...c.copy !== void 0 ? { copy: c.copy } : {},
|
|
5285
|
+
...c.hash !== void 0 ? { hash: c.hash } : {},
|
|
5286
|
+
...c.note !== void 0 ? { note: c.note } : {},
|
|
5287
|
+
...text2 ? { text: text2 } : {},
|
|
5288
|
+
...c.orphan ? { orphan: c.orphan.step, orphanEvent: c.orphan.event } : {}
|
|
5289
|
+
};
|
|
5290
|
+
});
|
|
5291
|
+
const placed = new Map(commits.map((c) => [c.id, c]));
|
|
5292
|
+
const links = walked.links.flatMap((l) => {
|
|
5293
|
+
const from = placed.get(l.from);
|
|
5294
|
+
if (!from) return [];
|
|
5295
|
+
if (l.kind === "branch") {
|
|
5296
|
+
if (!walked.made.some((c) => c.branch === l.to)) return [];
|
|
5297
|
+
const lane = laneOf.get(l.to);
|
|
5298
|
+
return [{ ...l, points: fork(from, from.cx + G.turn, lane.line), color: colorOf2(l.to) }];
|
|
5299
|
+
}
|
|
5300
|
+
const to = placed.get(l.to);
|
|
5301
|
+
const made = walked.made.find((m) => m.id === l.to);
|
|
5302
|
+
let points;
|
|
5303
|
+
if (l.kind === "copy") points = copyLine(from, to);
|
|
5304
|
+
else if (Math.abs(from.cy - to.cy) < 0.5) points = [[from.cx + from.r, from.cy], [to.cx - to.r, to.cy]];
|
|
5305
|
+
else if (made?.joined === l.from) points = join(from, to);
|
|
5306
|
+
else points = fork(from, to.cx - to.r, to.cy);
|
|
5307
|
+
return [{ ...l, points, color: to.color }];
|
|
5308
|
+
});
|
|
5309
|
+
const tagRect = (ref, slot) => {
|
|
5310
|
+
const c = placed.get(slot.commit);
|
|
5311
|
+
const base = laneOf.get(c.branch)?.tagBase ?? G.tag;
|
|
5312
|
+
const w = tagW(ref);
|
|
5313
|
+
return { x: c.cx - w / 2, y: c.cy - base - slot.row * G.row - C.tagH / 2, w, h: C.tagH };
|
|
5314
|
+
};
|
|
5315
|
+
const center2 = (r) => [r.x + r.w / 2, r.y + r.h / 2];
|
|
5316
|
+
const moves = walked.moves.map((m) => {
|
|
5317
|
+
const from = m.from ? tagRect(m.ref, m.from) : void 0;
|
|
5318
|
+
const to = m.to ? tagRect(m.ref, m.to) : void 0;
|
|
5319
|
+
const source = diagram.steps[m.step]?.events[m.event];
|
|
5320
|
+
const carried = m.line && source?.type === "edge" && source.carry.kind !== "none" && !(source.carry.kind === "tag" && source.carry.text === source.from);
|
|
5321
|
+
return {
|
|
5322
|
+
ref: m.ref,
|
|
5323
|
+
step: m.step,
|
|
5324
|
+
event: m.event,
|
|
5325
|
+
...from ? { from } : {},
|
|
5326
|
+
...to ? { to } : {},
|
|
5327
|
+
...m.to ? { target: m.to.commit } : {},
|
|
5328
|
+
...carried ? { carried: true } : {},
|
|
5329
|
+
...m.line && from && to ? { line: elbow(center2(from), center2(to)) } : {},
|
|
5330
|
+
color: "slate"
|
|
5331
|
+
};
|
|
5332
|
+
});
|
|
5333
|
+
const tags = walked.tags.map((t) => ({ ...tagRect(t.ref, t.slot), ref: t.ref, step: t.step }));
|
|
5334
|
+
const colors = boxColors(diagram);
|
|
5335
|
+
const right = Math.max(
|
|
5336
|
+
x0,
|
|
5337
|
+
...commits.flatMap((c) => [c.cx + c.r, ...c.text ? [c.text.x + c.text.w] : []]),
|
|
5338
|
+
...tags.map((t) => t.x + t.w),
|
|
5339
|
+
...moves.flatMap((m) => [m.from, m.to].flatMap((r) => r ? [r.x + r.w] : []))
|
|
5340
|
+
);
|
|
5341
|
+
const boxX = right + G.boxGap;
|
|
5342
|
+
const firstCy = (lanes[1] ?? lanes[0])?.line ?? margin + B.h / 2;
|
|
5343
|
+
const boxes = diagram.boxes.map((b, i) => {
|
|
5344
|
+
const w = boxWidth(diagram, b.id, true);
|
|
5345
|
+
const cy = firstCy + i * (B.h + gap);
|
|
5346
|
+
return {
|
|
5347
|
+
id: b.id,
|
|
5348
|
+
name: b.name,
|
|
5349
|
+
...b.sub !== void 0 ? { sub: b.sub } : {},
|
|
5350
|
+
...b.icon !== void 0 ? { icon: b.icon } : {},
|
|
5351
|
+
color: colors.get(b.id) ?? "slate",
|
|
5352
|
+
x: boxX,
|
|
5353
|
+
y: cy - B.h / 2,
|
|
5354
|
+
w,
|
|
5355
|
+
h: B.h,
|
|
5356
|
+
cx: boxX + w / 2,
|
|
5357
|
+
cy
|
|
5358
|
+
};
|
|
5359
|
+
});
|
|
5360
|
+
const regions = lanes.map((lane, i) => {
|
|
5361
|
+
const note = notes.get(lane.id);
|
|
5362
|
+
return {
|
|
5363
|
+
id: lane.id,
|
|
5364
|
+
lines: [lane.id],
|
|
5365
|
+
...note !== void 0 ? { note } : {},
|
|
5366
|
+
icon: "branch",
|
|
5367
|
+
color: lane.color,
|
|
5368
|
+
x: lane.x,
|
|
5369
|
+
y: lane.y,
|
|
5370
|
+
w: 0,
|
|
5371
|
+
h: lane.h,
|
|
5372
|
+
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 }
|
|
5373
|
+
};
|
|
5374
|
+
});
|
|
5375
|
+
const layout = {
|
|
5376
|
+
kind: "git",
|
|
5377
|
+
width: 0,
|
|
5378
|
+
height: 0,
|
|
5379
|
+
regions,
|
|
5380
|
+
boxes,
|
|
5381
|
+
lifelines: [],
|
|
5382
|
+
edges: [],
|
|
5383
|
+
labels: [],
|
|
5384
|
+
actions: [],
|
|
5385
|
+
badges: [],
|
|
5386
|
+
paths: [],
|
|
5387
|
+
ends: [],
|
|
5388
|
+
lanes,
|
|
5389
|
+
commits,
|
|
5390
|
+
links,
|
|
5391
|
+
tags,
|
|
5392
|
+
refs: walked.refs,
|
|
5393
|
+
moves
|
|
5394
|
+
};
|
|
5395
|
+
layout.badges = badgesOf(diagram, layout);
|
|
5396
|
+
layout.labels = labelsOf(diagram, layout);
|
|
5397
|
+
const contentRight = Math.max(right, ...boxes.map((b) => b.x + b.w), ...layout.labels.map((l) => l.x + l.w)) + R.pad;
|
|
5398
|
+
const width = Math.max(contentRight + margin, stripNeed(diagram) + margin * 2);
|
|
5399
|
+
for (const region of regions) region.w = width - margin * 2;
|
|
5400
|
+
for (const lane of lanes) lane.w = width - margin * 2;
|
|
5401
|
+
const bottom = Math.max(lanesBottom, ...boxes.map((b) => b.y + b.h), ...layout.labels.map((l) => l.y + l.h));
|
|
5402
|
+
const strip2 = layoutStrip(diagram, margin, bottom + gap, width - margin * 2);
|
|
5403
|
+
layout.width = width;
|
|
5404
|
+
layout.height = (strip2 ? strip2.y + strip2.h : bottom) + margin;
|
|
5405
|
+
if (strip2) layout.strip = strip2;
|
|
5406
|
+
layout.badges = badgesOf(diagram, layout);
|
|
5407
|
+
return layout;
|
|
5408
|
+
}
|
|
5409
|
+
function union(rects) {
|
|
5410
|
+
const x = Math.min(...rects.map((r) => r.x));
|
|
5411
|
+
const y = Math.min(...rects.map((r) => r.y));
|
|
5412
|
+
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 };
|
|
5413
|
+
}
|
|
5414
|
+
function firstMark(layout, step) {
|
|
5415
|
+
const marks = [
|
|
5416
|
+
...layout.links.filter((l) => l.step === step && l.kind !== "copy").map((l) => ({ event: l.event, points: l.points, color: l.color })),
|
|
5417
|
+
...layout.moves.flatMap((m) => {
|
|
5418
|
+
const target = layout.commits.find((c) => c.id === m.target);
|
|
5419
|
+
return m.step === step && m.line && target ? [{ event: m.event, target, color: target.color }] : [];
|
|
5420
|
+
})
|
|
5421
|
+
].sort((a, b) => a.event - b.event);
|
|
5422
|
+
return marks[0];
|
|
5423
|
+
}
|
|
5424
|
+
function besideCommit(c, taken, avoid) {
|
|
5425
|
+
const { r, inset } = LOOK.badge;
|
|
5426
|
+
const d = c.r + inset + r;
|
|
5427
|
+
const apart = r * 2 + inset;
|
|
5428
|
+
const spots = [
|
|
5429
|
+
[c.cx + d, c.cy],
|
|
5430
|
+
[c.cx, c.cy + d],
|
|
5431
|
+
[c.cx - d, c.cy],
|
|
5432
|
+
[c.cx, c.cy - d]
|
|
5433
|
+
];
|
|
5434
|
+
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));
|
|
5435
|
+
}
|
|
5436
|
+
function clearOnPath(points, taken, avoid) {
|
|
5437
|
+
const { r, inset, along: start, short } = LOOK.badge;
|
|
5438
|
+
const length = pathLength(points);
|
|
5439
|
+
const first = length < short ? Math.min(r + 1, length / 2) : start;
|
|
5440
|
+
const apart = r * 2 + inset;
|
|
5441
|
+
for (let d = first; d <= length; d += 1) {
|
|
5442
|
+
const p = along(points, d);
|
|
5443
|
+
const rect = badgeRect(p);
|
|
5444
|
+
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;
|
|
5445
|
+
}
|
|
5446
|
+
return void 0;
|
|
5447
|
+
}
|
|
5448
|
+
function badgesOf(diagram, layout) {
|
|
5449
|
+
const { inset } = LOOK.badge;
|
|
5450
|
+
const taken = [];
|
|
5451
|
+
const all = [...layout.links.map((l) => l.points), ...layout.moves.flatMap((m) => m.line ? [m.line] : [])];
|
|
5452
|
+
const out = [];
|
|
5453
|
+
const avoid = [
|
|
5454
|
+
...layout.tags,
|
|
5455
|
+
...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] : []])
|
|
5456
|
+
];
|
|
5457
|
+
diagram.steps.forEach((step, s) => {
|
|
5458
|
+
const mark = firstMark(layout, s);
|
|
5459
|
+
const near = mark?.target ? besideCommit(mark.target, taken, avoid) : void 0;
|
|
5460
|
+
if (mark && (mark.points || near)) {
|
|
5461
|
+
const points = mark.points;
|
|
5462
|
+
const point = near ?? (points ? clearOnPath(points, taken, avoid) ?? badgeOnPath(points, taken, all.filter((p) => p !== points)) : [0, 0]);
|
|
5463
|
+
taken.push(point);
|
|
5464
|
+
out.push({ step: s, x: point[0], y: point[1], color: mark.color });
|
|
5465
|
+
return;
|
|
5466
|
+
}
|
|
5467
|
+
const box = step.events.flatMap((e) => e.type === "swap" || e.type === "action" ? [e.box] : []).map((id) => layout.boxes.find((b) => b.id === id))[0];
|
|
5468
|
+
if (box) {
|
|
5469
|
+
out.push({ step: s, x: box.x, y: box.y, color: box.color });
|
|
5470
|
+
return;
|
|
5471
|
+
}
|
|
5472
|
+
if (layout.strip && step.events.some((e) => e.type === "strip")) {
|
|
5473
|
+
out.push({ step: s, x: layout.strip.x + inset, y: layout.strip.y + inset, color: "slate" });
|
|
5474
|
+
return;
|
|
5475
|
+
}
|
|
5476
|
+
const tip = layout.commits.find((c) => c.id === layout.refs[0]?.at[s]);
|
|
5477
|
+
const spot = tip ? besideCommit(tip, taken, avoid) : void 0;
|
|
5478
|
+
if (tip && spot) {
|
|
5479
|
+
taken.push(spot);
|
|
5480
|
+
out.push({ step: s, x: spot[0], y: spot[1], color: tip.color });
|
|
5481
|
+
return;
|
|
5482
|
+
}
|
|
5483
|
+
const before = out[out.length - 1];
|
|
5484
|
+
const lane = layout.lanes[0];
|
|
5485
|
+
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" });
|
|
5486
|
+
});
|
|
5487
|
+
return replaceSameSpot(out);
|
|
5488
|
+
}
|
|
5489
|
+
function labelsOf(diagram, layout) {
|
|
5490
|
+
const G = LOOK.git;
|
|
5491
|
+
const labels = [];
|
|
5492
|
+
const circles = layout.commits.map((c) => ({ x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 }));
|
|
5493
|
+
const texts = layout.commits.flatMap((c) => c.text ? [c.text] : []);
|
|
5494
|
+
const headers = layout.regions.map((r) => r.header);
|
|
5495
|
+
for (const move of layout.moves) {
|
|
5496
|
+
const source = diagram.steps[move.step]?.events[move.event];
|
|
5497
|
+
if (source?.type !== "edge" || source.label === void 0 || !move.line) continue;
|
|
5498
|
+
const target = layout.commits.find((c) => c.id === source.to);
|
|
5499
|
+
if (!target) continue;
|
|
5500
|
+
const top = layout.lanes[0]?.id === target.branch;
|
|
5501
|
+
const w = textWidth(source.label, hasWide(source.label) ? TYPE.labelJa : TYPE.label) + LOOK.label.padX * 2;
|
|
5502
|
+
const [mx] = move.line.reduce((sum, p) => [sum[0] + p[0] / move.line.length, 0], [0, 0]);
|
|
5503
|
+
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));
|
|
5504
|
+
const side2 = source.labelSide ?? (top ? "above" : "below");
|
|
5505
|
+
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 };
|
|
5506
|
+
const seen = layout.badges.filter((b) => b.step <= move.step).map((b) => badgeRect([b.x, b.y]));
|
|
5507
|
+
const tags = layout.tags.filter((t) => t.step === move.step);
|
|
5508
|
+
labels.push(
|
|
5509
|
+
placeLabel(
|
|
5510
|
+
{ step: move.step, event: move.event, text: source.label, points: move.line, color: move.color, side: side2, ...base ? { base } : {} },
|
|
5511
|
+
{ hard: [...circles, ...layout.boxes], soft: [...texts, ...tags, ...headers, ...labels.filter((l) => l.step === move.step)], touch: seen }
|
|
5512
|
+
)
|
|
5513
|
+
);
|
|
5514
|
+
}
|
|
5515
|
+
return labels;
|
|
5516
|
+
}
|
|
5517
|
+
|
|
4159
5518
|
// src/layout/sequence.ts
|
|
4160
5519
|
function layoutSequence(diagram) {
|
|
4161
5520
|
const { box: B, sequence: Q, label: L, margin, gap } = LOOK;
|
|
@@ -4364,7 +5723,7 @@ function layoutState(diagram, lang) {
|
|
|
4364
5723
|
}
|
|
4365
5724
|
const colLeft = [];
|
|
4366
5725
|
for (let c = 0; c < columnCount; c++) colLeft.push(c === 0 ? margin : colLeft[c - 1] + colW[c - 1] + between[c - 1]);
|
|
4367
|
-
const
|
|
5726
|
+
const center2 = (c) => colLeft[c] + colW[c] / 2;
|
|
4368
5727
|
const isGhost = (id) => ghosts.includes(id);
|
|
4369
5728
|
const enteringFrom = new Set(notTaken.filter((p) => isGhost(p.to) && !isGhost(p.from) && !isEnd(p.from)).map((p) => p.from));
|
|
4370
5729
|
const notes = [words.sideNote, ...enteringFrom.size > 0 ? [words.sideFrom(enteringFrom.size)] : []];
|
|
@@ -4394,7 +5753,7 @@ function layoutState(diagram, lang) {
|
|
|
4394
5753
|
};
|
|
4395
5754
|
const boxes = walked.map((id) => {
|
|
4396
5755
|
const s = slot.get(id);
|
|
4397
|
-
return boxOf(id,
|
|
5756
|
+
return boxOf(id, center2(s.col), rowY(s.row), false);
|
|
4398
5757
|
});
|
|
4399
5758
|
for (const box of boxes) placeSlot(box, carriedIn.get(box.id), doneSide);
|
|
4400
5759
|
const byId = new Map(boxes.map((b) => [b.id, b]));
|
|
@@ -4614,7 +5973,15 @@ function plan(step) {
|
|
|
4614
5973
|
let arrived;
|
|
4615
5974
|
let changes = 0;
|
|
4616
5975
|
step.events.forEach((event2, e) => {
|
|
4617
|
-
if (event2.type === "
|
|
5976
|
+
if (event2.type === "commit" || event2.type === "branch") {
|
|
5977
|
+
const a = cursor;
|
|
5978
|
+
const b = a + MOTION.draw;
|
|
5979
|
+
out.edges.push({ event: e, a, b, carries: false, coin: false, named: false });
|
|
5980
|
+
cursor = a + MOTION.stagger;
|
|
5981
|
+
arrived = b;
|
|
5982
|
+
changes = 0;
|
|
5983
|
+
out.busy = Math.max(out.busy, b);
|
|
5984
|
+
} else if (event2.type === "edge") {
|
|
4618
5985
|
const carries = event2.carry.kind !== "none";
|
|
4619
5986
|
const a = cursor;
|
|
4620
5987
|
const b = a + (carries ? MOTION.drawCarry : MOTION.draw);
|
|
@@ -4659,7 +6026,9 @@ function buildTimeline(diagram) {
|
|
|
4659
6026
|
for (const edge2 of p.edges) {
|
|
4660
6027
|
const a = span.start + edge2.a;
|
|
4661
6028
|
edges.push({ step: s, event: edge2.event, start: a, drawn: span.start + edge2.b, end: span.end });
|
|
4662
|
-
|
|
6029
|
+
const event2 = diagram.steps[s]?.events[edge2.event];
|
|
6030
|
+
const own = diagram.kind === "git" && event2?.type === "edge" && event2.carry.kind === "tag" && event2.carry.text === event2.from;
|
|
6031
|
+
if (edge2.carries && !own) departures.push({ step: s, event: edge2.event, who: edge2.coin ? "coin" : "main", a, b: span.start + edge2.b });
|
|
4663
6032
|
if (edge2.named) named.push({ step: s, event: edge2.event, start: a + MOTION.labelDelay, end: span.end });
|
|
4664
6033
|
}
|
|
4665
6034
|
named.forEach((label2, k) => {
|
|
@@ -5151,6 +6520,123 @@ function strip(s, changes, ctx, now = false, arrivals = /* @__PURE__ */ new Map(
|
|
|
5151
6520
|
return parts.join("");
|
|
5152
6521
|
}
|
|
5153
6522
|
|
|
6523
|
+
// src/render/git.ts
|
|
6524
|
+
var r12 = (v) => Math.round(v * 100) / 100;
|
|
6525
|
+
var center = (r) => [r.x + r.w / 2, r.y + r.h / 2];
|
|
6526
|
+
function tagShape(text2, sh) {
|
|
6527
|
+
const C = LOOK.carrier;
|
|
6528
|
+
const ja3 = hasWide(text2);
|
|
6529
|
+
const w = textWidth(text2, ja3 ? TYPE.carrierJa : TYPE.carrier) + C.tagPadX * 2;
|
|
6530
|
+
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>`;
|
|
6531
|
+
}
|
|
6532
|
+
function drawGit(layout, diagram, timeline, ctx) {
|
|
6533
|
+
const { m } = ctx;
|
|
6534
|
+
const G = LOOK.git;
|
|
6535
|
+
const timeOf = (step, event2) => timeline.edges.find((t) => t.step === step && t.event === event2);
|
|
6536
|
+
const links = layout.links.map((l) => {
|
|
6537
|
+
const time = timeOf(l.step, l.event);
|
|
6538
|
+
if (!time) return "";
|
|
6539
|
+
ctx.traces.push({ from: l.from, to: l.to, points: l.points, shown: [[time.start, Number.POSITIVE_INFINITY]] });
|
|
6540
|
+
const d = pathOf(l.points);
|
|
6541
|
+
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>`;
|
|
6542
|
+
const kf = m.kf([
|
|
6543
|
+
[0, { opacity: 0, "stroke-dashoffset": 1 }],
|
|
6544
|
+
[time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
|
|
6545
|
+
[time.start + 0.05, { opacity: 1 }],
|
|
6546
|
+
[time.drawn, { "stroke-dashoffset": 0 }],
|
|
6547
|
+
[m.last, { opacity: 1, "stroke-dashoffset": 0 }, EASE.inOut],
|
|
6548
|
+
[m.total, { opacity: 0, "stroke-dashoffset": 0 }]
|
|
6549
|
+
]);
|
|
6550
|
+
return `<g style="${cs(l.color)}"><path class="dg-git-l dg-a" pathLength="1" d="${d}" style="${kf}"/></g>`;
|
|
6551
|
+
}).join("");
|
|
6552
|
+
const commits = layout.commits.map((c) => {
|
|
6553
|
+
const at = timeOf(c.step, c.event)?.drawn ?? 0;
|
|
6554
|
+
const ring = { x: c.cx - c.r, y: c.cy - c.r, w: c.r * 2, h: c.r * 2 };
|
|
6555
|
+
ctx.ink.push({ text: c.id, rect: ring, shown: [[at, Number.POSITIVE_INFINITY]], boxed: true });
|
|
6556
|
+
const lines2 = (c.text?.lines ?? []).map((line2, k) => {
|
|
6557
|
+
const hash = k === 0 && c.hash !== void 0;
|
|
6558
|
+
const baseline = c.text?.baselines[k] ?? c.cy;
|
|
6559
|
+
return write(ctx.ink, hash ? "dg-git-h" : "dg-git-n", c.cx, baseline, line2, hash ? TYPE.gitHash : TYPE.gitNote, [[at, Number.POSITIVE_INFINITY]], "middle");
|
|
6560
|
+
}).join("");
|
|
6561
|
+
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>`;
|
|
6562
|
+
const node = `<g class="dg-popc dg-a" style="${m.pop(at)}"><circle class="dg-git-c" cx="${r12(c.cx)}" cy="${r12(c.cy)}" r="${c.r}" ${ctx.sh}/>${id}</g>`;
|
|
6563
|
+
const text2 = lines2 === "" ? "" : `<g class="dg-a" style="${m.vis(at)}">${lines2}</g>`;
|
|
6564
|
+
const orphanAt = c.orphan === void 0 ? void 0 : timeOf(c.orphan, c.orphanEvent ?? 0)?.drawn;
|
|
6565
|
+
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>`;
|
|
6566
|
+
return `<g data-commit="${esc(c.id)}" style="${cs(c.color)}">${node}${text2}${orphan}</g>`;
|
|
6567
|
+
}).join("");
|
|
6568
|
+
const lines = layout.moves.flatMap((mv) => {
|
|
6569
|
+
const time = timeOf(mv.step, mv.event);
|
|
6570
|
+
if (!mv.line || !time) return [];
|
|
6571
|
+
const end = timeline.steps[mv.step].end;
|
|
6572
|
+
ctx.traces.push({ from: mv.ref, to: mv.target ?? mv.ref, points: mv.line, shown: [[time.start, end + 0.4]] });
|
|
6573
|
+
const kf = m.kf([
|
|
6574
|
+
[0, { opacity: 0, "stroke-dashoffset": 1 }],
|
|
6575
|
+
[time.start, { opacity: 0, "stroke-dashoffset": 1 }, EASE.inOut],
|
|
6576
|
+
[time.start + 0.05, { opacity: 1 }],
|
|
6577
|
+
[time.drawn, { "stroke-dashoffset": 0 }],
|
|
6578
|
+
[end, { opacity: 1 }, EASE.inOut],
|
|
6579
|
+
[end + 0.4, { opacity: 0 }],
|
|
6580
|
+
[m.total, { opacity: 0, "stroke-dashoffset": 0 }]
|
|
6581
|
+
]);
|
|
6582
|
+
return [`<g style="${cs(mv.color)}"><path class="dg-e-on dg-a" pathLength="1" d="${pathOf(mv.line)}" style="${kf}"/></g>`];
|
|
6583
|
+
}).join("");
|
|
6584
|
+
const carried = timeline.carriers.flatMap((t) => {
|
|
6585
|
+
const mv = layout.moves.find((x) => x.step === t.step && x.event === t.event && x.line);
|
|
6586
|
+
const source = diagram.steps[t.step]?.events[t.event];
|
|
6587
|
+
if (!mv?.line || source?.type !== "edge") return [];
|
|
6588
|
+
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 };
|
|
6589
|
+
return [carrier(edge2, { ...t, start: t.depart, end: t.arrive + MOTION.fade }, ctx)];
|
|
6590
|
+
}).join("");
|
|
6591
|
+
const refs = [...new Set(layout.moves.map((mv) => mv.ref))];
|
|
6592
|
+
const tags = refs.map((ref) => tagMotion(ref, layout.moves.filter((mv) => mv.ref === ref), timeOf, ctx)).join("") + carried;
|
|
6593
|
+
return { links, lines, commits, tags };
|
|
6594
|
+
}
|
|
6595
|
+
function tagMotion(ref, list2, timeOf, ctx) {
|
|
6596
|
+
const { m } = ctx;
|
|
6597
|
+
const points = [];
|
|
6598
|
+
const fades = [[0, { opacity: 0 }]];
|
|
6599
|
+
let on = false;
|
|
6600
|
+
let rest;
|
|
6601
|
+
const leave = (t) => {
|
|
6602
|
+
if (rest) ctx.ink.push({ text: ref, rect: rest.rect, shown: [[rest.since, t]], boxed: true });
|
|
6603
|
+
rest = void 0;
|
|
6604
|
+
};
|
|
6605
|
+
for (const mv of list2) {
|
|
6606
|
+
const time = timeOf(mv.step, mv.event);
|
|
6607
|
+
if (!time) continue;
|
|
6608
|
+
const { start: a, drawn: b } = time;
|
|
6609
|
+
const from = mv.from ? center(mv.from) : void 0;
|
|
6610
|
+
const to = mv.to ? center(mv.to) : void 0;
|
|
6611
|
+
leave(a);
|
|
6612
|
+
if (mv.carried && from && to && on) {
|
|
6613
|
+
points.push([a + MOTION.fade, from[0], from[1]], [b - MOTION.fade, to[0], to[1]]);
|
|
6614
|
+
fades.push([a, { opacity: 1 }, EASE.inOut], [a + MOTION.fade, { opacity: 0 }], [b - MOTION.fade, { opacity: 0 }, EASE.out], [b, { opacity: 1 }]);
|
|
6615
|
+
rest = { rect: mv.to, since: b };
|
|
6616
|
+
continue;
|
|
6617
|
+
}
|
|
6618
|
+
if (from) points.push([a, from[0], from[1]]);
|
|
6619
|
+
if (to) points.push([b, to[0], to[1]]);
|
|
6620
|
+
if (to && !on) {
|
|
6621
|
+
const show = from ? a : b - MOTION.fade;
|
|
6622
|
+
fades.push([show, { opacity: 0 }, EASE.out], [show + MOTION.fade, { opacity: 1 }]);
|
|
6623
|
+
on = true;
|
|
6624
|
+
} else if (!to && on) {
|
|
6625
|
+
fades.push([b, { opacity: 1 }, EASE.inOut], [b + MOTION.untilFade, { opacity: 0 }]);
|
|
6626
|
+
on = false;
|
|
6627
|
+
}
|
|
6628
|
+
if (mv.to) rest = { rect: mv.to, since: b };
|
|
6629
|
+
}
|
|
6630
|
+
leave(Number.POSITIVE_INFINITY);
|
|
6631
|
+
if (points.length === 0) return "";
|
|
6632
|
+
const first = points[0];
|
|
6633
|
+
const last = points[points.length - 1];
|
|
6634
|
+
if (on) fades.push([m.last, { opacity: 1 }, EASE.inOut], [m.total, { opacity: 0 }]);
|
|
6635
|
+
else fades.push([m.total, { opacity: 0 }]);
|
|
6636
|
+
const style = m.move([[0, first[1], first[2]], ...points, [m.total, last[1], last[2]]], fades);
|
|
6637
|
+
return `<g class="dg-a" data-ref="${esc(ref)}" style="${style}">${tagShape(ref, ctx.sh)}</g>`;
|
|
6638
|
+
}
|
|
6639
|
+
|
|
5154
6640
|
// src/render/motion.ts
|
|
5155
6641
|
var r2 = (v) => Math.round(v * 100) / 100;
|
|
5156
6642
|
var Motion = class {
|
|
@@ -5321,6 +6807,14 @@ var PART_CSS = [
|
|
|
5321
6807
|
`.dg-mark{${font(TYPE.regionNote)};fill:var(--mute)}`,
|
|
5322
6808
|
`.dg-done{fill:var(--ink);stroke:var(--surf);stroke-width:${S.done}}`,
|
|
5323
6809
|
`.dg-done-ck{fill:none;stroke:var(--surf);stroke-width:${S.glyph};stroke-linecap:round;stroke-linejoin:round}`,
|
|
6810
|
+
`.dg-git-l{fill:none;stroke:var(--c);stroke-width:${S.git};stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1 2}`,
|
|
6811
|
+
`.dg-git-cp{fill:none;stroke:var(--c);stroke-width:${S.gitOrphan};stroke-linecap:round;stroke-dasharray:3 3;stroke-opacity:.7}`,
|
|
6812
|
+
`.dg-git-c{fill:var(--surf);stroke:var(--c);stroke-width:${S.git}}`,
|
|
6813
|
+
`.dg-git-id{${font(TYPE.gitId)};fill:var(--ct)}`,
|
|
6814
|
+
`.dg-git-h{${font(TYPE.gitHash)};fill:var(--mute)}`,
|
|
6815
|
+
`.dg-git-n{${font(TYPE.gitNote)};fill:var(--ink2)}`,
|
|
6816
|
+
`.dg-git-old{fill:var(--surf);stroke:var(--c);stroke-width:${S.gitOrphan};stroke-dasharray:3 3;stroke-opacity:.6}`,
|
|
6817
|
+
`.dg-git-oldl{${font(TYPE.gitId)};fill:var(--ct);opacity:.55}`,
|
|
5324
6818
|
".dg-vp-bg{fill:var(--bg)}",
|
|
5325
6819
|
".dg-vp-frame{fill:none;stroke:var(--hair)}",
|
|
5326
6820
|
".dg-hd-bg{fill:var(--bg)}",
|
|
@@ -5427,6 +6921,13 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
|
|
|
5427
6921
|
const arrivals = new Map((timeline.states ?? []).flatMap((s) => s.lit[0] ? [[s.box, s.lit[0].start]] : []));
|
|
5428
6922
|
if (layout.strip) L.band.push(strip(layout.strip, fieldChanges(diagram, timeline, layout), ctx, isState, arrivals));
|
|
5429
6923
|
for (const line2 of layout.lifelines) L.base.push(lifeline(line2.x, line2.y1, line2.y2));
|
|
6924
|
+
if (isGitLayout(layout)) {
|
|
6925
|
+
const git = drawGit(layout, diagram, timeline, ctx);
|
|
6926
|
+
L.base.push(git.links);
|
|
6927
|
+
L.lit.push(git.lines);
|
|
6928
|
+
L.node.push(git.commits);
|
|
6929
|
+
L.top.push(git.tags);
|
|
6930
|
+
}
|
|
5430
6931
|
for (const e of layout.edges) {
|
|
5431
6932
|
const time = timeline.edges.find((t) => t.step === e.step && t.event === e.event);
|
|
5432
6933
|
if (!time) continue;
|
|
@@ -5465,14 +6966,14 @@ function drawSvg(diagram, layout, timeline, palette, theme, follow, ink = [], tr
|
|
|
5465
6966
|
const css = `.dg-${id}{${FONT_VARS};--T:${timeline.total}s;${paletteVars(palette, theme)}}${PART_CSS}${m.frames.join("")}`;
|
|
5466
6967
|
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>`;
|
|
5467
6968
|
}
|
|
5468
|
-
function
|
|
6969
|
+
function union2(rects) {
|
|
5469
6970
|
const x = Math.min(...rects.map((r) => r.x));
|
|
5470
6971
|
const y = Math.min(...rects.map((r) => r.y));
|
|
5471
6972
|
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 };
|
|
5472
6973
|
}
|
|
5473
6974
|
function focusOf(layout, diagram, step) {
|
|
5474
6975
|
const rects = focusParts(layout, diagram, step);
|
|
5475
|
-
return rects.length === 0 ? void 0 :
|
|
6976
|
+
return rects.length === 0 ? void 0 : union2(rects);
|
|
5476
6977
|
}
|
|
5477
6978
|
function badgeFocus(badge2, parts, vw, vh) {
|
|
5478
6979
|
const room = LOOK.badge.r + LOOK.follow.badgeRoom;
|
|
@@ -5480,7 +6981,7 @@ function badgeFocus(badge2, parts, vw, vh) {
|
|
|
5480
6981
|
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));
|
|
5481
6982
|
let held = { x: bx - room, y: by - room, w: room * 2, h: room * 2 };
|
|
5482
6983
|
for (const p of [...parts].sort((a, b) => away(a) - away(b))) {
|
|
5483
|
-
const next =
|
|
6984
|
+
const next = union2([held, p]);
|
|
5484
6985
|
if (next.w <= vw && next.h <= vh) held = next;
|
|
5485
6986
|
}
|
|
5486
6987
|
return held;
|
|
@@ -5578,7 +7079,7 @@ function renderDiagram(input, options = {}) {
|
|
|
5578
7079
|
const read = readDiagram(input, { lang });
|
|
5579
7080
|
if (!read.ok) throw new Error(FIGURE_TEXT[lang].cannotDraw(read.errors.map((e) => `${e.pointer} ${e.message}`).join(" / ")));
|
|
5580
7081
|
const diagram = read.diagram;
|
|
5581
|
-
const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : layoutArchitecture(diagram);
|
|
7082
|
+
const layout = diagram.kind === "sequence" ? layoutSequence(diagram) : diagram.kind === "state" ? layoutState(diagram, lang) : diagram.kind === "git" ? layoutGit(diagram) : layoutArchitecture(diagram);
|
|
5582
7083
|
return renderLayout(diagram, layout, buildTimeline(diagram), options);
|
|
5583
7084
|
}
|
|
5584
7085
|
function renderLayout(diagram, layout, timeline, options = {}) {
|