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