tutuca 0.9.113 → 0.9.114
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/dist/chai.js +1180 -359
- package/dist/tutuca-cli.js +14827 -13802
- package/dist/tutuca-components.js +323 -354
- package/dist/tutuca-dev.ext.js +1955 -2033
- package/dist/tutuca-dev.js +3254 -2627
- package/dist/tutuca-dev.min.js +5 -5
- package/dist/tutuca-extra.ext.js +1044 -1222
- package/dist/tutuca-extra.js +1261 -1480
- package/dist/tutuca-extra.min.js +3 -3
- package/dist/tutuca-storybook.js +174 -123
- package/dist/tutuca.ext.js +1026 -1213
- package/dist/tutuca.js +1243 -1471
- package/dist/tutuca.min.js +3 -3
- package/package.json +24 -21
- package/skill/tutuca/cli.md +1 -1
- package/skill/tutuca/testing.md +5 -4
- package/skill/tutuca-source/tutuca.ext.js +1026 -1213
|
@@ -28,6 +28,9 @@ var JsonBoolean = component({
|
|
|
28
28
|
},
|
|
29
29
|
view: html`<span :class="$cssClass" @text="$text"></span>`,
|
|
30
30
|
views: {
|
|
31
|
+
// Decoy: cssClass() builds these at runtime, so they never appear as
|
|
32
|
+
// literals the margaui scanner can find. Never rendered — registering
|
|
33
|
+
// the view is enough for compileClassesToStyleText to emit their CSS.
|
|
31
34
|
_margauiClasses: html`<p class="text-success text-warning"></p>`
|
|
32
35
|
}
|
|
33
36
|
});
|
|
@@ -220,15 +223,11 @@ var JsonViewer = makeValueInspector({
|
|
|
220
223
|
}
|
|
221
224
|
});
|
|
222
225
|
function classifyJsonValue(data, recurse, anyObject) {
|
|
223
|
-
if (data === null || data ===
|
|
224
|
-
return JsonNull.make({});
|
|
226
|
+
if (data === null || data === void 0) return JsonNull.make({});
|
|
225
227
|
const t = typeof data;
|
|
226
|
-
if (t === "boolean")
|
|
227
|
-
|
|
228
|
-
if (t === "
|
|
229
|
-
return JsonNumber.make({ value: data });
|
|
230
|
-
if (t === "string")
|
|
231
|
-
return JsonString.make({ value: data });
|
|
228
|
+
if (t === "boolean") return JsonBoolean.make({ value: data });
|
|
229
|
+
if (t === "number") return JsonNumber.make({ value: data });
|
|
230
|
+
if (t === "string") return JsonString.make({ value: data });
|
|
232
231
|
if (Array.isArray(data)) {
|
|
233
232
|
const items = data.map((v, i) => JsonProperty.make({ key: String(i), child: recurse(v) }));
|
|
234
233
|
return JsonArray.make({ items });
|
|
@@ -236,7 +235,9 @@ function classifyJsonValue(data, recurse, anyObject) {
|
|
|
236
235
|
if (t === "object") {
|
|
237
236
|
const proto = Object.getPrototypeOf(data);
|
|
238
237
|
if (anyObject || proto === Object.prototype || proto === null) {
|
|
239
|
-
const items = Object.entries(data).map(
|
|
238
|
+
const items = Object.entries(data).map(
|
|
239
|
+
([k, v]) => JsonProperty.make({ key: k, child: recurse(v) })
|
|
240
|
+
);
|
|
240
241
|
return JsonObject.make({ items });
|
|
241
242
|
}
|
|
242
243
|
}
|
|
@@ -252,8 +253,7 @@ function chain(...classifiers) {
|
|
|
252
253
|
const recurse = (data) => {
|
|
253
254
|
for (const c of classifiers) {
|
|
254
255
|
const result = c(data, recurse);
|
|
255
|
-
if (result != null)
|
|
256
|
-
return result;
|
|
256
|
+
if (result != null) return result;
|
|
257
257
|
}
|
|
258
258
|
return null;
|
|
259
259
|
};
|
|
@@ -278,35 +278,21 @@ var immutableContainerView = makeCompositeView({
|
|
|
278
278
|
borderClass: "border-accent"
|
|
279
279
|
});
|
|
280
280
|
function fmtAnyKey(k) {
|
|
281
|
-
if (k === null)
|
|
282
|
-
|
|
283
|
-
if (k === undefined)
|
|
284
|
-
return "undefined";
|
|
281
|
+
if (k === null) return "null";
|
|
282
|
+
if (k === void 0) return "undefined";
|
|
285
283
|
const t = typeof k;
|
|
286
|
-
if (t === "string" || t === "number" || t === "boolean" || t === "bigint")
|
|
287
|
-
|
|
288
|
-
if (t === "
|
|
289
|
-
|
|
290
|
-
if (
|
|
291
|
-
|
|
292
|
-
if (
|
|
293
|
-
|
|
294
|
-
if (k
|
|
295
|
-
|
|
296
|
-
if (k
|
|
297
|
-
|
|
298
|
-
if (k instanceof Date)
|
|
299
|
-
return k.toISOString();
|
|
300
|
-
if (List.isList(k))
|
|
301
|
-
return `List[${k.size}]`;
|
|
302
|
-
if (OMap.isOrderedMap(k))
|
|
303
|
-
return `OrderedMap[${k.size}]`;
|
|
304
|
-
if (IMap.isMap(k))
|
|
305
|
-
return `Map[${k.size}]`;
|
|
306
|
-
if (OrderedSet.isOrderedSet(k))
|
|
307
|
-
return `OrderedSet[${k.size}]`;
|
|
308
|
-
if (ISet.isSet(k))
|
|
309
|
-
return `Set[${k.size}]`;
|
|
284
|
+
if (t === "string" || t === "number" || t === "boolean" || t === "bigint") return String(k);
|
|
285
|
+
if (t === "symbol") return String(k);
|
|
286
|
+
if (t === "function") return `ƒ ${k.name || "(anonymous)"}()`;
|
|
287
|
+
if (Array.isArray(k)) return `Array(${k.length})`;
|
|
288
|
+
if (k instanceof Map) return `Map(${k.size})`;
|
|
289
|
+
if (k instanceof Set) return `Set(${k.size})`;
|
|
290
|
+
if (k instanceof Date) return k.toISOString();
|
|
291
|
+
if (List.isList(k)) return `List[${k.size}]`;
|
|
292
|
+
if (OMap.isOrderedMap(k)) return `OrderedMap[${k.size}]`;
|
|
293
|
+
if (IMap.isMap(k)) return `Map[${k.size}]`;
|
|
294
|
+
if (OrderedSet.isOrderedSet(k)) return `OrderedSet[${k.size}]`;
|
|
295
|
+
if (ISet.isSet(k)) return `Set[${k.size}]`;
|
|
310
296
|
const ctor = k.constructor?.name;
|
|
311
297
|
return ctor && ctor !== "Object" ? `${ctor} {…}` : Object.prototype.toString.call(k);
|
|
312
298
|
}
|
|
@@ -489,23 +475,16 @@ var ImInspector = makeValueInspector({
|
|
|
489
475
|
}
|
|
490
476
|
});
|
|
491
477
|
function classifyImmutable(data, recurse) {
|
|
492
|
-
if (Seq.isSeq(data) && data._start !==
|
|
478
|
+
if (Seq.isSeq(data) && data._start !== void 0 && data._end !== void 0 && data._step !== void 0) {
|
|
493
479
|
return ImRange.Class.fromData(data, recurse);
|
|
494
480
|
}
|
|
495
|
-
if (Record.isRecord(data))
|
|
496
|
-
|
|
497
|
-
if (
|
|
498
|
-
|
|
499
|
-
if (
|
|
500
|
-
|
|
501
|
-
if (
|
|
502
|
-
return ImOMap.Class.fromData(data, recurse);
|
|
503
|
-
if (IMap.isMap(data))
|
|
504
|
-
return ImMap.Class.fromData(data, recurse);
|
|
505
|
-
if (OrderedSet.isOrderedSet(data))
|
|
506
|
-
return ImOSet.Class.fromData(data, recurse);
|
|
507
|
-
if (ISet.isSet(data))
|
|
508
|
-
return ImSet.Class.fromData(data, recurse);
|
|
481
|
+
if (Record.isRecord(data)) return ImRecord.Class.fromData(data, recurse);
|
|
482
|
+
if (List.isList(data)) return ImList.Class.fromData(data, recurse);
|
|
483
|
+
if (Stack.isStack(data)) return ImStack.Class.fromData(data, recurse);
|
|
484
|
+
if (OMap.isOrderedMap(data)) return ImOMap.Class.fromData(data, recurse);
|
|
485
|
+
if (IMap.isMap(data)) return ImMap.Class.fromData(data, recurse);
|
|
486
|
+
if (OrderedSet.isOrderedSet(data)) return ImOSet.Class.fromData(data, recurse);
|
|
487
|
+
if (ISet.isSet(data)) return ImSet.Class.fromData(data, recurse);
|
|
509
488
|
return null;
|
|
510
489
|
}
|
|
511
490
|
var dispatch = chain(classifyImmutable, classifyData);
|
|
@@ -564,15 +543,12 @@ var JsFunction = component3({
|
|
|
564
543
|
return this.kind !== "arrow" && this.name !== "";
|
|
565
544
|
},
|
|
566
545
|
prefixText() {
|
|
567
|
-
if (this.kind === "arrow")
|
|
568
|
-
|
|
569
|
-
if (this.kind === "class")
|
|
570
|
-
return this.name ? "class " : "class { … }";
|
|
546
|
+
if (this.kind === "arrow") return "() => { … }";
|
|
547
|
+
if (this.kind === "class") return this.name ? "class " : "class { … }";
|
|
571
548
|
return this.name ? "function " : "function () { … }";
|
|
572
549
|
},
|
|
573
550
|
suffixText() {
|
|
574
|
-
if (this.kind === "class")
|
|
575
|
-
return " { … }";
|
|
551
|
+
if (this.kind === "class") return " { … }";
|
|
576
552
|
return "() { … }";
|
|
577
553
|
}
|
|
578
554
|
},
|
|
@@ -693,44 +669,35 @@ var JsClassInstance = component3({
|
|
|
693
669
|
for (const [k, v] of Object.entries(obj)) {
|
|
694
670
|
items.push(JsonProperty.make({ key: k, child: recurse(v) }));
|
|
695
671
|
}
|
|
696
|
-
} catch (_e) {
|
|
672
|
+
} catch (_e) {
|
|
673
|
+
}
|
|
697
674
|
return this.make({ className, items });
|
|
698
675
|
}
|
|
699
676
|
},
|
|
700
677
|
view: compositeView
|
|
701
678
|
});
|
|
702
679
|
function classifyJsExtra(data, recurse) {
|
|
703
|
-
if (data ===
|
|
704
|
-
return JsUndefined.make({});
|
|
680
|
+
if (data === void 0) return JsUndefined.make({});
|
|
705
681
|
const t = typeof data;
|
|
706
|
-
if (t === "symbol")
|
|
707
|
-
return JsSymbol.make({ description: data.description ?? "" });
|
|
682
|
+
if (t === "symbol") return JsSymbol.make({ description: data.description ?? "" });
|
|
708
683
|
if (t === "function") {
|
|
709
684
|
let kind = "function";
|
|
710
685
|
const src = String(data);
|
|
711
|
-
if (/^(?:async\s+)?class\s/.test(src))
|
|
712
|
-
|
|
713
|
-
else if (!/^(?:async\s+)?function\b/.test(src) && /=>/.test(src))
|
|
714
|
-
kind = "arrow";
|
|
686
|
+
if (/^(?:async\s+)?class\s/.test(src)) kind = "class";
|
|
687
|
+
else if (!/^(?:async\s+)?function\b/.test(src) && /=>/.test(src)) kind = "arrow";
|
|
715
688
|
return JsFunction.make({ name: data.name ?? "", kind });
|
|
716
689
|
}
|
|
717
|
-
if (t === "bigint")
|
|
718
|
-
|
|
719
|
-
if (
|
|
720
|
-
|
|
721
|
-
if (data instanceof Date)
|
|
722
|
-
return JsDate.make({ value: data.toISOString() });
|
|
723
|
-
if (data instanceof RegExp)
|
|
724
|
-
return JsRegExp.make({ value: String(data) });
|
|
690
|
+
if (t === "bigint") return JsBigInt.make({ value: String(data) });
|
|
691
|
+
if (t !== "object" || data === null) return null;
|
|
692
|
+
if (data instanceof Date) return JsDate.make({ value: data.toISOString() });
|
|
693
|
+
if (data instanceof RegExp) return JsRegExp.make({ value: String(data) });
|
|
725
694
|
if (data instanceof Error)
|
|
726
695
|
return JsError.make({
|
|
727
696
|
errorName: data.name ?? "Error",
|
|
728
697
|
message: data.message ?? ""
|
|
729
698
|
});
|
|
730
|
-
if (data instanceof Map)
|
|
731
|
-
|
|
732
|
-
if (data instanceof Set)
|
|
733
|
-
return JsSet.Class.fromData(data, recurse);
|
|
699
|
+
if (data instanceof Map) return JsMap.Class.fromData(data, recurse);
|
|
700
|
+
if (data instanceof Set) return JsSet.Class.fromData(data, recurse);
|
|
734
701
|
const proto = Object.getPrototypeOf(data);
|
|
735
702
|
if (proto !== Object.prototype && proto !== null) {
|
|
736
703
|
return JsClassInstance.Class.fromData(data, recurse);
|
|
@@ -860,68 +827,43 @@ function metaOf(schema) {
|
|
|
860
827
|
}
|
|
861
828
|
function displayType(schema, fallback) {
|
|
862
829
|
const t = schema.type;
|
|
863
|
-
if (Array.isArray(t))
|
|
864
|
-
|
|
865
|
-
if (typeof t === "string")
|
|
866
|
-
return t;
|
|
830
|
+
if (Array.isArray(t)) return t.join(" | ");
|
|
831
|
+
if (typeof t === "string") return t;
|
|
867
832
|
return fallback;
|
|
868
833
|
}
|
|
869
834
|
function simpleScalarType(schema) {
|
|
870
|
-
if (schema == null || typeof schema !== "object")
|
|
871
|
-
return null;
|
|
835
|
+
if (schema == null || typeof schema !== "object") return null;
|
|
872
836
|
const t = schema.type;
|
|
873
837
|
const typeOk = typeof t === "string" || Array.isArray(t) && t.every((x) => typeof x === "string");
|
|
874
|
-
if (!typeOk)
|
|
875
|
-
|
|
876
|
-
if (Object.keys(schema).some((k) => k !== "type"))
|
|
877
|
-
return null;
|
|
838
|
+
if (!typeOk) return null;
|
|
839
|
+
if (Object.keys(schema).some((k) => k !== "type")) return null;
|
|
878
840
|
return Array.isArray(t) ? t.join(" | ") : t;
|
|
879
841
|
}
|
|
880
842
|
function combinatorPhrasing(kind) {
|
|
881
|
-
if (kind === "allOf")
|
|
882
|
-
|
|
883
|
-
if (kind === "
|
|
884
|
-
return "any of";
|
|
885
|
-
if (kind === "oneOf")
|
|
886
|
-
return "one of";
|
|
843
|
+
if (kind === "allOf") return "all of";
|
|
844
|
+
if (kind === "anyOf") return "any of";
|
|
845
|
+
if (kind === "oneOf") return "one of";
|
|
887
846
|
return "combination";
|
|
888
847
|
}
|
|
889
848
|
function collectBadges(schema) {
|
|
890
849
|
const b = [];
|
|
891
|
-
if (schema.format != null)
|
|
892
|
-
|
|
893
|
-
if (schema.
|
|
894
|
-
|
|
895
|
-
if (schema.
|
|
896
|
-
|
|
897
|
-
if (schema.
|
|
898
|
-
|
|
899
|
-
if (schema.
|
|
900
|
-
|
|
901
|
-
if (schema.
|
|
902
|
-
|
|
903
|
-
if (schema.
|
|
904
|
-
|
|
905
|
-
if (schema.
|
|
906
|
-
|
|
907
|
-
if (schema.
|
|
908
|
-
b.push(`multiple of ${schema.multipleOf}`);
|
|
909
|
-
if (schema.minItems != null)
|
|
910
|
-
b.push(`min items: ${schema.minItems}`);
|
|
911
|
-
if (schema.maxItems != null)
|
|
912
|
-
b.push(`max items: ${schema.maxItems}`);
|
|
913
|
-
if (schema.uniqueItems)
|
|
914
|
-
b.push("unique items");
|
|
915
|
-
if (schema.minProperties != null)
|
|
916
|
-
b.push(`min properties: ${schema.minProperties}`);
|
|
917
|
-
if (schema.maxProperties != null)
|
|
918
|
-
b.push(`max properties: ${schema.maxProperties}`);
|
|
919
|
-
if (schema.additionalProperties === false)
|
|
920
|
-
b.push("no additional properties");
|
|
921
|
-
if (schema.readOnly)
|
|
922
|
-
b.push("read-only");
|
|
923
|
-
if (schema.writeOnly)
|
|
924
|
-
b.push("write-only");
|
|
850
|
+
if (schema.format != null) b.push(`format: ${schema.format}`);
|
|
851
|
+
if (schema.minLength != null) b.push(`min length: ${schema.minLength}`);
|
|
852
|
+
if (schema.maxLength != null) b.push(`max length: ${schema.maxLength}`);
|
|
853
|
+
if (schema.pattern != null) b.push(`pattern: /${schema.pattern}/`);
|
|
854
|
+
if (schema.minimum != null) b.push(`≥ ${schema.minimum}`);
|
|
855
|
+
if (schema.maximum != null) b.push(`≤ ${schema.maximum}`);
|
|
856
|
+
if (schema.exclusiveMinimum != null) b.push(`> ${schema.exclusiveMinimum}`);
|
|
857
|
+
if (schema.exclusiveMaximum != null) b.push(`< ${schema.exclusiveMaximum}`);
|
|
858
|
+
if (schema.multipleOf != null) b.push(`multiple of ${schema.multipleOf}`);
|
|
859
|
+
if (schema.minItems != null) b.push(`min items: ${schema.minItems}`);
|
|
860
|
+
if (schema.maxItems != null) b.push(`max items: ${schema.maxItems}`);
|
|
861
|
+
if (schema.uniqueItems) b.push("unique items");
|
|
862
|
+
if (schema.minProperties != null) b.push(`min properties: ${schema.minProperties}`);
|
|
863
|
+
if (schema.maxProperties != null) b.push(`max properties: ${schema.maxProperties}`);
|
|
864
|
+
if (schema.additionalProperties === false) b.push("no additional properties");
|
|
865
|
+
if (schema.readOnly) b.push("read-only");
|
|
866
|
+
if (schema.writeOnly) b.push("write-only");
|
|
925
867
|
return b;
|
|
926
868
|
}
|
|
927
869
|
function valueBranch(label, value) {
|
|
@@ -933,50 +875,52 @@ function valueBranch(label, value) {
|
|
|
933
875
|
}
|
|
934
876
|
function collectExtras(schema, recurse, primary) {
|
|
935
877
|
const rows = [];
|
|
936
|
-
if (primary !== "const" && "const" in schema)
|
|
937
|
-
|
|
938
|
-
if (
|
|
939
|
-
|
|
940
|
-
if ("default" in schema)
|
|
941
|
-
rows.push(valueBranch("default", schema.default));
|
|
942
|
-
if ("examples" in schema)
|
|
943
|
-
rows.push(valueBranch("examples", schema.examples));
|
|
878
|
+
if (primary !== "const" && "const" in schema) rows.push(valueBranch("const", schema.const));
|
|
879
|
+
if (primary !== "enum" && Array.isArray(schema.enum)) rows.push(valueBranch("enum", schema.enum));
|
|
880
|
+
if ("default" in schema) rows.push(valueBranch("default", schema.default));
|
|
881
|
+
if ("examples" in schema) rows.push(valueBranch("examples", schema.examples));
|
|
944
882
|
if (primary !== "combinator") {
|
|
945
883
|
for (const k of ["allOf", "anyOf", "oneOf"]) {
|
|
946
884
|
if (Array.isArray(schema[k])) {
|
|
947
885
|
for (const s of schema[k]) {
|
|
948
|
-
rows.push(
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
886
|
+
rows.push(
|
|
887
|
+
SchemaBranch.make({
|
|
888
|
+
label: combinatorPhrasing(k),
|
|
889
|
+
child: recurse(s),
|
|
890
|
+
labelClass: "text-accent"
|
|
891
|
+
})
|
|
892
|
+
);
|
|
953
893
|
}
|
|
954
894
|
}
|
|
955
895
|
}
|
|
956
896
|
}
|
|
957
|
-
if (primary !== "not" && schema.not !==
|
|
958
|
-
rows.push(
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
897
|
+
if (primary !== "not" && schema.not !== void 0) {
|
|
898
|
+
rows.push(
|
|
899
|
+
SchemaBranch.make({
|
|
900
|
+
label: "not",
|
|
901
|
+
child: recurse(schema.not),
|
|
902
|
+
labelClass: "text-error"
|
|
903
|
+
})
|
|
904
|
+
);
|
|
963
905
|
}
|
|
964
906
|
if (primary !== "conditional") {
|
|
965
|
-
if (schema.if !==
|
|
907
|
+
if (schema.if !== void 0)
|
|
966
908
|
rows.push(SchemaBranch.make({ label: "if", child: recurse(schema.if) }));
|
|
967
|
-
if (schema.then !==
|
|
909
|
+
if (schema.then !== void 0)
|
|
968
910
|
rows.push(SchemaBranch.make({ label: "then", child: recurse(schema.then) }));
|
|
969
|
-
if (schema.else !==
|
|
911
|
+
if (schema.else !== void 0)
|
|
970
912
|
rows.push(SchemaBranch.make({ label: "else", child: recurse(schema.else) }));
|
|
971
913
|
}
|
|
972
914
|
const defs = schema.$defs || schema.definitions;
|
|
973
915
|
if (defs && typeof defs === "object") {
|
|
974
916
|
for (const [name, s] of Object.entries(defs)) {
|
|
975
|
-
rows.push(
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
917
|
+
rows.push(
|
|
918
|
+
SchemaBranch.make({
|
|
919
|
+
label: `$defs/${name}`,
|
|
920
|
+
child: recurse(s),
|
|
921
|
+
labelClass: "text-secondary"
|
|
922
|
+
})
|
|
923
|
+
);
|
|
980
924
|
}
|
|
981
925
|
}
|
|
982
926
|
return rows;
|
|
@@ -984,6 +928,8 @@ function collectExtras(schema, recurse, primary) {
|
|
|
984
928
|
var SchemaProperty = component4({
|
|
985
929
|
name: "SchemaProperty",
|
|
986
930
|
fields: { key: "", child: null, required: false },
|
|
931
|
+
// `contents` so the key cell and value cell land directly in the parent's
|
|
932
|
+
// grid, aligning values across rows.
|
|
987
933
|
view: html4`<div class="contents">
|
|
988
934
|
<span class="font-mono text-sm flex items-center gap-1 leading-tight">
|
|
989
935
|
<span class="text-base-content/60" @text=".key"></span>
|
|
@@ -1003,6 +949,8 @@ var SchemaBranch = component4({
|
|
|
1003
949
|
return `font-mono text-sm ${this.labelClass}`;
|
|
1004
950
|
}
|
|
1005
951
|
},
|
|
952
|
+
// `contents` so the label cell and value cell land directly in the parent's
|
|
953
|
+
// grid, aligning values across rows.
|
|
1006
954
|
view: html4`<div class="contents">
|
|
1007
955
|
<span class="flex items-center gap-1 leading-tight">
|
|
1008
956
|
<span :class="$labelCssClass" @text=".label"></span>
|
|
@@ -1011,6 +959,8 @@ var SchemaBranch = component4({
|
|
|
1011
959
|
<x render=".child"></x>
|
|
1012
960
|
</div>`,
|
|
1013
961
|
views: {
|
|
962
|
+
// Decoy: labelClass colours are chosen in JS, so they never appear as
|
|
963
|
+
// literals for the margaui scanner.
|
|
1014
964
|
_margauiClasses: html4`<p
|
|
1015
965
|
class="text-accent text-secondary text-info text-error"
|
|
1016
966
|
></p>`
|
|
@@ -1052,35 +1002,43 @@ var SchemaObject = component4({
|
|
|
1052
1002
|
const items = [];
|
|
1053
1003
|
if (schema.properties && typeof schema.properties === "object") {
|
|
1054
1004
|
for (const [k, v] of Object.entries(schema.properties)) {
|
|
1055
|
-
items.push(
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1005
|
+
items.push(
|
|
1006
|
+
SchemaProperty.make({
|
|
1007
|
+
key: k,
|
|
1008
|
+
required: required.includes(k),
|
|
1009
|
+
child: recurse(v)
|
|
1010
|
+
})
|
|
1011
|
+
);
|
|
1060
1012
|
}
|
|
1061
1013
|
}
|
|
1062
1014
|
if (schema.patternProperties && typeof schema.patternProperties === "object") {
|
|
1063
1015
|
for (const [pat, v] of Object.entries(schema.patternProperties)) {
|
|
1064
|
-
items.push(
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1016
|
+
items.push(
|
|
1017
|
+
SchemaBranch.make({
|
|
1018
|
+
label: `/${pat}/`,
|
|
1019
|
+
child: recurse(v),
|
|
1020
|
+
labelClass: "text-secondary"
|
|
1021
|
+
})
|
|
1022
|
+
);
|
|
1069
1023
|
}
|
|
1070
1024
|
}
|
|
1071
1025
|
if (schema.additionalProperties && typeof schema.additionalProperties === "object") {
|
|
1072
|
-
items.push(
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1026
|
+
items.push(
|
|
1027
|
+
SchemaBranch.make({
|
|
1028
|
+
label: "additional properties",
|
|
1029
|
+
child: recurse(schema.additionalProperties),
|
|
1030
|
+
labelClass: "text-secondary"
|
|
1031
|
+
})
|
|
1032
|
+
);
|
|
1077
1033
|
}
|
|
1078
|
-
if (schema.propertyNames !==
|
|
1079
|
-
items.push(
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1034
|
+
if (schema.propertyNames !== void 0) {
|
|
1035
|
+
items.push(
|
|
1036
|
+
SchemaBranch.make({
|
|
1037
|
+
label: "property names",
|
|
1038
|
+
child: recurse(schema.propertyNames),
|
|
1039
|
+
labelClass: "text-secondary"
|
|
1040
|
+
})
|
|
1041
|
+
);
|
|
1084
1042
|
}
|
|
1085
1043
|
items.push(...collectExtras(schema, recurse, "object"));
|
|
1086
1044
|
return this.make({
|
|
@@ -1116,14 +1074,16 @@ var SchemaArray = component4({
|
|
|
1116
1074
|
schema.items.forEach((s, i) => {
|
|
1117
1075
|
items.push(SchemaBranch.make({ label: `item ${i}`, child: recurse(s) }));
|
|
1118
1076
|
});
|
|
1119
|
-
} else if (schema.items !==
|
|
1077
|
+
} else if (schema.items !== void 0 && inlineType == null) {
|
|
1120
1078
|
items.push(SchemaBranch.make({ label: "items", child: recurse(schema.items) }));
|
|
1121
1079
|
}
|
|
1122
|
-
if (schema.contains !==
|
|
1123
|
-
items.push(
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1080
|
+
if (schema.contains !== void 0) {
|
|
1081
|
+
items.push(
|
|
1082
|
+
SchemaBranch.make({
|
|
1083
|
+
label: "contains",
|
|
1084
|
+
child: recurse(schema.contains)
|
|
1085
|
+
})
|
|
1086
|
+
);
|
|
1127
1087
|
}
|
|
1128
1088
|
items.push(...collectExtras(schema, recurse, "array"));
|
|
1129
1089
|
const typeLabel = isTuple ? "tuple" : inlineType != null ? `array of ${inlineType}` : displayType(schema, "array");
|
|
@@ -1159,6 +1119,7 @@ var SchemaEnum = component4({
|
|
|
1159
1119
|
});
|
|
1160
1120
|
}
|
|
1161
1121
|
},
|
|
1122
|
+
// list layout: each enum member is a single value rendered one per line.
|
|
1162
1123
|
view: makeSchemaView("text-info", LIST_BODY)
|
|
1163
1124
|
});
|
|
1164
1125
|
var SchemaConst = component4({
|
|
@@ -1193,8 +1154,7 @@ var SchemaCombinator = component4({
|
|
|
1193
1154
|
for (const k of ["allOf", "anyOf", "oneOf"]) {
|
|
1194
1155
|
if (Array.isArray(schema[k])) {
|
|
1195
1156
|
kind = kind ?? k;
|
|
1196
|
-
for (const s of schema[k])
|
|
1197
|
-
items.push(recurse(s));
|
|
1157
|
+
for (const s of schema[k]) items.push(recurse(s));
|
|
1198
1158
|
}
|
|
1199
1159
|
}
|
|
1200
1160
|
items.push(...collectExtras(schema, recurse, "combinator"));
|
|
@@ -1206,6 +1166,7 @@ var SchemaCombinator = component4({
|
|
|
1206
1166
|
});
|
|
1207
1167
|
}
|
|
1208
1168
|
},
|
|
1169
|
+
// list layout: members are full schema nodes listed one per line, no keys.
|
|
1209
1170
|
view: makeSchemaView("text-accent", LIST_BODY)
|
|
1210
1171
|
});
|
|
1211
1172
|
var SchemaConditional = component4({
|
|
@@ -1221,9 +1182,9 @@ var SchemaConditional = component4({
|
|
|
1221
1182
|
statics: {
|
|
1222
1183
|
fromData(schema, recurse) {
|
|
1223
1184
|
return this.make({
|
|
1224
|
-
ifNode: schema.if !==
|
|
1225
|
-
thenNode: schema.then !==
|
|
1226
|
-
elseNode: schema.else !==
|
|
1185
|
+
ifNode: schema.if !== void 0 ? recurse(schema.if) : null,
|
|
1186
|
+
thenNode: schema.then !== void 0 ? recurse(schema.then) : null,
|
|
1187
|
+
elseNode: schema.else !== void 0 ? recurse(schema.else) : null,
|
|
1227
1188
|
...metaOf(schema)
|
|
1228
1189
|
});
|
|
1229
1190
|
}
|
|
@@ -1303,6 +1264,8 @@ var SchemaBoolean = component4({
|
|
|
1303
1264
|
},
|
|
1304
1265
|
view: html4`<span :class="$cssClass" @text="$text"></span>`,
|
|
1305
1266
|
views: {
|
|
1267
|
+
// Decoy: cssClass() builds these at runtime, so they never appear as
|
|
1268
|
+
// literals the margaui scanner can find.
|
|
1306
1269
|
_margauiClasses: html4`<p class="text-success text-error"></p>`
|
|
1307
1270
|
}
|
|
1308
1271
|
});
|
|
@@ -1349,36 +1312,26 @@ var SchemaViewer = component4({
|
|
|
1349
1312
|
});
|
|
1350
1313
|
function hasObjectKeywords(schema) {
|
|
1351
1314
|
const t = schema.type;
|
|
1352
|
-
if (t === "object" || Array.isArray(t) && t.includes("object"))
|
|
1353
|
-
|
|
1354
|
-
return schema.properties !== undefined || schema.required !== undefined || schema.patternProperties !== undefined || schema.propertyNames !== undefined || schema.additionalProperties !== undefined || schema.minProperties != null || schema.maxProperties != null;
|
|
1315
|
+
if (t === "object" || Array.isArray(t) && t.includes("object")) return true;
|
|
1316
|
+
return schema.properties !== void 0 || schema.required !== void 0 || schema.patternProperties !== void 0 || schema.propertyNames !== void 0 || schema.additionalProperties !== void 0 || schema.minProperties != null || schema.maxProperties != null;
|
|
1355
1317
|
}
|
|
1356
1318
|
function hasArrayKeywords(schema) {
|
|
1357
1319
|
const t = schema.type;
|
|
1358
|
-
if (t === "array" || Array.isArray(t) && t.includes("array"))
|
|
1359
|
-
|
|
1360
|
-
return schema.items !== undefined || schema.prefixItems !== undefined || schema.contains !== undefined || schema.minItems != null || schema.maxItems != null || schema.uniqueItems !== undefined;
|
|
1320
|
+
if (t === "array" || Array.isArray(t) && t.includes("array")) return true;
|
|
1321
|
+
return schema.items !== void 0 || schema.prefixItems !== void 0 || schema.contains !== void 0 || schema.minItems != null || schema.maxItems != null || schema.uniqueItems !== void 0;
|
|
1361
1322
|
}
|
|
1362
1323
|
function classifySchema(schema, recurse = classifySchema) {
|
|
1363
|
-
if (schema === true || schema === false)
|
|
1364
|
-
|
|
1365
|
-
if (schema ===
|
|
1366
|
-
|
|
1367
|
-
if (
|
|
1368
|
-
|
|
1369
|
-
if (
|
|
1370
|
-
return SchemaObject.Class.fromData(schema, recurse);
|
|
1371
|
-
if (hasArrayKeywords(schema))
|
|
1372
|
-
return SchemaArray.Class.fromData(schema, recurse);
|
|
1373
|
-
if (Array.isArray(schema.enum))
|
|
1374
|
-
return SchemaEnum.Class.fromData(schema, recurse);
|
|
1375
|
-
if ("const" in schema)
|
|
1376
|
-
return SchemaConst.Class.fromData(schema, recurse);
|
|
1324
|
+
if (schema === true || schema === false) return SchemaBoolean.make({ value: schema });
|
|
1325
|
+
if (schema === null || typeof schema !== "object") return JsonViewer.Class.fromData(schema);
|
|
1326
|
+
if (typeof schema.$ref === "string") return SchemaRef.make({ target: schema.$ref });
|
|
1327
|
+
if (hasObjectKeywords(schema)) return SchemaObject.Class.fromData(schema, recurse);
|
|
1328
|
+
if (hasArrayKeywords(schema)) return SchemaArray.Class.fromData(schema, recurse);
|
|
1329
|
+
if (Array.isArray(schema.enum)) return SchemaEnum.Class.fromData(schema, recurse);
|
|
1330
|
+
if ("const" in schema) return SchemaConst.Class.fromData(schema, recurse);
|
|
1377
1331
|
if (schema.allOf || schema.anyOf || schema.oneOf)
|
|
1378
1332
|
return SchemaCombinator.Class.fromData(schema, recurse);
|
|
1379
|
-
if (schema.not !==
|
|
1380
|
-
|
|
1381
|
-
if (schema.if !== undefined || schema.then !== undefined || schema.else !== undefined)
|
|
1333
|
+
if (schema.not !== void 0) return SchemaNot.Class.fromData(schema, recurse);
|
|
1334
|
+
if (schema.if !== void 0 || schema.then !== void 0 || schema.else !== void 0)
|
|
1382
1335
|
return SchemaConditional.Class.fromData(schema, recurse);
|
|
1383
1336
|
return SchemaScalar.Class.fromData(schema, recurse);
|
|
1384
1337
|
}
|
|
@@ -1434,8 +1387,12 @@ function introspectComponent(comp) {
|
|
|
1434
1387
|
};
|
|
1435
1388
|
}
|
|
1436
1389
|
var sectionView = makeCompositeView({
|
|
1390
|
+
// Neutral chrome: hierarchy via weight, colour reserved for status/severity
|
|
1391
|
+
// (kept consistent across the instance / component / tests / lint inspectors).
|
|
1437
1392
|
typeClass: "font-semibold",
|
|
1438
1393
|
borderClass: "border-base-content/15",
|
|
1394
|
+
// Plain click toggles this section; ctrl/cmd-click bubbles up so the
|
|
1395
|
+
// inspector can toggle every section at once.
|
|
1439
1396
|
toggleHandler: "toggle isCtrl"
|
|
1440
1397
|
});
|
|
1441
1398
|
var CompName = component5({
|
|
@@ -1530,7 +1487,11 @@ var ComponentInspector = component5({
|
|
|
1530
1487
|
return this.setAllSections(false);
|
|
1531
1488
|
},
|
|
1532
1489
|
setAllViews(state) {
|
|
1533
|
-
return this.setSections(
|
|
1490
|
+
return this.setSections(
|
|
1491
|
+
this.sections.map(
|
|
1492
|
+
(s) => s.label === "Views" ? s.setItems(s.items.map((v) => v.setIsExpanded(state))) : s
|
|
1493
|
+
)
|
|
1494
|
+
);
|
|
1534
1495
|
},
|
|
1535
1496
|
expandAllViews() {
|
|
1536
1497
|
return this.setAllViews(true);
|
|
@@ -1557,11 +1518,17 @@ var ComponentInspector = component5({
|
|
|
1557
1518
|
}
|
|
1558
1519
|
};
|
|
1559
1520
|
const names = (list) => list.map((name) => CompName.make({ name }));
|
|
1560
|
-
add(
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1521
|
+
add(
|
|
1522
|
+
"Fields",
|
|
1523
|
+
d.fields.map(
|
|
1524
|
+
(f) => CompField.make({
|
|
1525
|
+
name: f.name,
|
|
1526
|
+
typeName: f.type,
|
|
1527
|
+
child: ImInspector.Class.fromData(f.defaultValue)
|
|
1528
|
+
})
|
|
1529
|
+
),
|
|
1530
|
+
true
|
|
1531
|
+
);
|
|
1565
1532
|
add("Methods", names(d.methods));
|
|
1566
1533
|
add("Input", names(d.input));
|
|
1567
1534
|
add("Receive", names(d.receive));
|
|
@@ -1569,7 +1536,10 @@ var ComponentInspector = component5({
|
|
|
1569
1536
|
add("Response", names(d.response));
|
|
1570
1537
|
add("Alter", names(d.alter));
|
|
1571
1538
|
add("Statics", names(d.statics));
|
|
1572
|
-
add(
|
|
1539
|
+
add(
|
|
1540
|
+
"Views",
|
|
1541
|
+
d.views.map((v) => CompView.make({ name: v.name, rawView: v.rawView }))
|
|
1542
|
+
);
|
|
1573
1543
|
return this.make({ compName: d.name, compId: d.id, sections });
|
|
1574
1544
|
}
|
|
1575
1545
|
},
|
|
@@ -1589,19 +1559,19 @@ function getComponents5() {
|
|
|
1589
1559
|
import { component as component6, html as html6 } from "tutuca";
|
|
1590
1560
|
var tagDisplay = (tag) => tag ? String(tag).toLowerCase() : "";
|
|
1591
1561
|
function originSuffix(info) {
|
|
1592
|
-
if (!info)
|
|
1593
|
-
return "";
|
|
1562
|
+
if (!info) return "";
|
|
1594
1563
|
const parts = [];
|
|
1595
1564
|
if (info.originAttr) {
|
|
1596
1565
|
const branch = info.branch ? `[${info.branch}]` : "";
|
|
1597
1566
|
parts.push(`in ${info.originAttr}${branch}`);
|
|
1598
1567
|
}
|
|
1599
1568
|
if (info.handlerName) {
|
|
1600
|
-
parts.push(
|
|
1569
|
+
parts.push(
|
|
1570
|
+
`handler '${info.handlerName}'${info.argIndex !== void 0 ? ` arg ${info.argIndex}` : ""}`
|
|
1571
|
+
);
|
|
1601
1572
|
}
|
|
1602
1573
|
const t = tagDisplay(info.tag);
|
|
1603
|
-
if (t && t !== "x")
|
|
1604
|
-
parts.push(`on <${t}>`);
|
|
1574
|
+
if (t && t !== "x") parts.push(`on <${t}>`);
|
|
1605
1575
|
return parts.length ? ` (${parts.join(", ")})` : "";
|
|
1606
1576
|
}
|
|
1607
1577
|
function tagSuffix(info) {
|
|
@@ -1609,15 +1579,12 @@ function tagSuffix(info) {
|
|
|
1609
1579
|
return t && t !== "x" ? ` on <${t}>` : "";
|
|
1610
1580
|
}
|
|
1611
1581
|
function eventSuffix(info) {
|
|
1612
|
-
if (info?.originAttr)
|
|
1613
|
-
|
|
1614
|
-
if (info?.eventName)
|
|
1615
|
-
return ` in @on.${info.eventName}`;
|
|
1582
|
+
if (info?.originAttr) return ` in ${info.originAttr}`;
|
|
1583
|
+
if (info?.eventName) return ` in @on.${info.eventName}`;
|
|
1616
1584
|
return "";
|
|
1617
1585
|
}
|
|
1618
1586
|
function humanizeId(id) {
|
|
1619
|
-
if (!id)
|
|
1620
|
-
return "Lint finding";
|
|
1587
|
+
if (!id) return "Lint finding";
|
|
1621
1588
|
const s = id.toLowerCase().replace(/_/g, " ");
|
|
1622
1589
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
1623
1590
|
}
|
|
@@ -1662,10 +1629,8 @@ function lintMessage(id, info = {}) {
|
|
|
1662
1629
|
}
|
|
1663
1630
|
}
|
|
1664
1631
|
function suggestionText(s) {
|
|
1665
|
-
if (!s)
|
|
1666
|
-
|
|
1667
|
-
if (s.to != null)
|
|
1668
|
-
return `${s.from ?? ""} → ${s.to}`;
|
|
1632
|
+
if (!s) return "";
|
|
1633
|
+
if (s.to != null) return `${s.from ?? ""} → ${s.to}`;
|
|
1669
1634
|
return s.text ?? s.kind ?? "";
|
|
1670
1635
|
}
|
|
1671
1636
|
var componentView = makeCompositeView({
|
|
@@ -1694,6 +1659,7 @@ var LintFinding = component6({
|
|
|
1694
1659
|
return this.detail != null;
|
|
1695
1660
|
}
|
|
1696
1661
|
},
|
|
1662
|
+
// Decoy so the runtime-built soft badge colours survive the class scan.
|
|
1697
1663
|
views: {
|
|
1698
1664
|
_palette: html6`<span
|
|
1699
1665
|
class="badge-soft badge-error badge-warning badge-neutral"
|
|
@@ -1735,12 +1701,9 @@ var LintComponent = component6({
|
|
|
1735
1701
|
},
|
|
1736
1702
|
countText() {
|
|
1737
1703
|
const parts = [];
|
|
1738
|
-
if (this.errors)
|
|
1739
|
-
|
|
1740
|
-
if (this.
|
|
1741
|
-
parts.push(`${this.warns} warning${this.warns === 1 ? "" : "s"}`);
|
|
1742
|
-
if (this.hints)
|
|
1743
|
-
parts.push(`${this.hints} hint${this.hints === 1 ? "" : "s"}`);
|
|
1704
|
+
if (this.errors) parts.push(`${this.errors} error${this.errors === 1 ? "" : "s"}`);
|
|
1705
|
+
if (this.warns) parts.push(`${this.warns} warning${this.warns === 1 ? "" : "s"}`);
|
|
1706
|
+
if (this.hints) parts.push(`${this.hints} hint${this.hints === 1 ? "" : "s"}`);
|
|
1744
1707
|
return parts.length ? parts.join(", ") : "ok";
|
|
1745
1708
|
}
|
|
1746
1709
|
},
|
|
@@ -1787,22 +1750,23 @@ var LintReport = component6({
|
|
|
1787
1750
|
const built = [];
|
|
1788
1751
|
for (const c of comps) {
|
|
1789
1752
|
const findings = c.findings ?? [];
|
|
1790
|
-
if (findings.length === 0)
|
|
1791
|
-
continue;
|
|
1753
|
+
if (findings.length === 0) continue;
|
|
1792
1754
|
const e = findings.filter((f) => f.level === "error").length;
|
|
1793
1755
|
const w = findings.filter((f) => f.level === "warn").length;
|
|
1794
1756
|
const h = findings.filter((f) => f.level === "hint").length;
|
|
1795
1757
|
errors += e;
|
|
1796
1758
|
warnings += w;
|
|
1797
1759
|
hints += h;
|
|
1798
|
-
built.push(
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1760
|
+
built.push(
|
|
1761
|
+
LintComponent.make({
|
|
1762
|
+
componentName: c.componentName,
|
|
1763
|
+
errors: e,
|
|
1764
|
+
warns: w,
|
|
1765
|
+
hints: h,
|
|
1766
|
+
items: findings.map(buildFinding),
|
|
1767
|
+
isExpanded: e > 0
|
|
1768
|
+
})
|
|
1769
|
+
);
|
|
1806
1770
|
}
|
|
1807
1771
|
return this.make({
|
|
1808
1772
|
title,
|
|
@@ -1815,6 +1779,7 @@ var LintReport = component6({
|
|
|
1815
1779
|
});
|
|
1816
1780
|
}
|
|
1817
1781
|
},
|
|
1782
|
+
// Decoy so the runtime-absent soft tally colours are emitted.
|
|
1818
1783
|
views: {
|
|
1819
1784
|
_palette: html6`<span
|
|
1820
1785
|
class="badge-soft badge-error badge-warning badge-neutral badge-success"
|
|
@@ -1872,13 +1837,18 @@ function collectTests(getTests) {
|
|
|
1872
1837
|
const test = (title) => {
|
|
1873
1838
|
stack[stack.length - 1].children.push({ title });
|
|
1874
1839
|
};
|
|
1875
|
-
const noop = () => {
|
|
1840
|
+
const noop = () => {
|
|
1841
|
+
};
|
|
1876
1842
|
getTests({ describe, test, expect: noop, drive: async () => null });
|
|
1877
1843
|
return root.children;
|
|
1878
1844
|
}
|
|
1879
1845
|
var suiteView = makeCompositeView({
|
|
1846
|
+
// Suite titles lean on weight, not colour, for hierarchy; colour is left to
|
|
1847
|
+
// the status marks (✓/✗/○) and the soft tally badges.
|
|
1880
1848
|
typeClass: "font-semibold",
|
|
1881
1849
|
borderClass: "border-base-content/15",
|
|
1850
|
+
// Plain click toggles this suite; ctrl/cmd-click bubbles up to TestReport so
|
|
1851
|
+
// it can expand/collapse every suite at once (like the component inspector).
|
|
1882
1852
|
toggleHandler: "toggle isCtrl"
|
|
1883
1853
|
});
|
|
1884
1854
|
var TestCase = component7({
|
|
@@ -1918,6 +1888,7 @@ var TestCase = component7({
|
|
|
1918
1888
|
return this.detail != null;
|
|
1919
1889
|
}
|
|
1920
1890
|
},
|
|
1891
|
+
// Decoy so the runtime-built mark colors survive the margaui class scan.
|
|
1921
1892
|
views: {
|
|
1922
1893
|
_palette: html7`<span class="text-success text-error text-base-content/40"></span>`
|
|
1923
1894
|
},
|
|
@@ -1956,8 +1927,7 @@ var TestSuite = component7({
|
|
|
1956
1927
|
view: suiteView
|
|
1957
1928
|
});
|
|
1958
1929
|
function setSuiteTreeExpanded(node, state) {
|
|
1959
|
-
if (typeof node.setIsExpanded !== "function")
|
|
1960
|
-
return node;
|
|
1930
|
+
if (typeof node.setIsExpanded !== "function") return node;
|
|
1961
1931
|
return node.setIsExpanded(state).setItems(node.items.map((c) => setSuiteTreeExpanded(c, state)));
|
|
1962
1932
|
}
|
|
1963
1933
|
function buildDefNode(node) {
|
|
@@ -1986,7 +1956,7 @@ function buildResultNode(node) {
|
|
|
1986
1956
|
}
|
|
1987
1957
|
const status = node.status ?? "";
|
|
1988
1958
|
const err = node.error ?? null;
|
|
1989
|
-
const hasDiff = err != null && (
|
|
1959
|
+
const hasDiff = err != null && ("expected" in err || "actual" in err);
|
|
1990
1960
|
const comp = TestCase.make({
|
|
1991
1961
|
title: node.title,
|
|
1992
1962
|
status,
|
|
@@ -2033,6 +2003,7 @@ var TestReport = component7({
|
|
|
2033
2003
|
}
|
|
2034
2004
|
},
|
|
2035
2005
|
bubble: {
|
|
2006
|
+
// ctrl/cmd-click on any suite expands/collapses the whole tree at once.
|
|
2036
2007
|
toggleAll(state) {
|
|
2037
2008
|
return this.setAllSuites(state);
|
|
2038
2009
|
}
|
|
@@ -2110,10 +2081,12 @@ var InstanceFields = component8({
|
|
|
2110
2081
|
statics: {
|
|
2111
2082
|
fromData(instance, comp) {
|
|
2112
2083
|
const d = introspectComponent(comp);
|
|
2113
|
-
const items = d.fields.map(
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2084
|
+
const items = d.fields.map(
|
|
2085
|
+
(f) => ImEntry.make({
|
|
2086
|
+
key: f.name,
|
|
2087
|
+
child: ImInspector.Class.fromData(instance.get(f.name))
|
|
2088
|
+
})
|
|
2089
|
+
);
|
|
2117
2090
|
return this.make({ typeName: d.name, items, isExpanded: true });
|
|
2118
2091
|
}
|
|
2119
2092
|
},
|
|
@@ -2127,13 +2100,11 @@ var InstanceInspector = makeValueInspector({
|
|
|
2127
2100
|
}
|
|
2128
2101
|
});
|
|
2129
2102
|
function asTestView(tests) {
|
|
2130
|
-
if (tests == null)
|
|
2131
|
-
return null;
|
|
2103
|
+
if (tests == null) return null;
|
|
2132
2104
|
return isComponentInstance(tests) ? tests : TestReport.Class.fromResults(tests);
|
|
2133
2105
|
}
|
|
2134
2106
|
function asLintView(lint) {
|
|
2135
|
-
if (lint == null)
|
|
2136
|
-
return null;
|
|
2107
|
+
if (lint == null) return null;
|
|
2137
2108
|
return isComponentInstance(lint) ? lint : LintReport.Class.fromData(lint);
|
|
2138
2109
|
}
|
|
2139
2110
|
var InstanceExplorer = component8({
|
|
@@ -2231,10 +2202,9 @@ function getComponents8() {
|
|
|
2231
2202
|
...getComponents7(),
|
|
2232
2203
|
...getComponents6()
|
|
2233
2204
|
];
|
|
2234
|
-
const seen = new Set;
|
|
2205
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2235
2206
|
return all.filter((c) => {
|
|
2236
|
-
if (seen.has(c.name))
|
|
2237
|
-
return false;
|
|
2207
|
+
if (seen.has(c.name)) return false;
|
|
2238
2208
|
seen.add(c.name);
|
|
2239
2209
|
return true;
|
|
2240
2210
|
});
|
|
@@ -2325,7 +2295,7 @@ function fmtActivityTime(ts) {
|
|
|
2325
2295
|
return `${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}.${p(d.getMilliseconds(), 3)}`;
|
|
2326
2296
|
}
|
|
2327
2297
|
function pathKeysLabel(pathKeys) {
|
|
2328
|
-
return pathKeys.map((k) => k.key ===
|
|
2298
|
+
return pathKeys.map((k) => k.key === void 0 ? k.field : `${k.field}[${k.key}]`).join(".");
|
|
2329
2299
|
}
|
|
2330
2300
|
function makeInspect(app) {
|
|
2331
2301
|
return (value) => {
|
|
@@ -2334,7 +2304,7 @@ function makeInspect(app) {
|
|
|
2334
2304
|
};
|
|
2335
2305
|
}
|
|
2336
2306
|
function recordToEntry(record, { inspect, pathLabel = pathKeysLabel } = {}) {
|
|
2337
|
-
const hasAfter = record.after !==
|
|
2307
|
+
const hasAfter = record.after !== void 0;
|
|
2338
2308
|
const primary = record.name ?? record.handlerName ?? "?";
|
|
2339
2309
|
const handler = record.handlerName ?? "";
|
|
2340
2310
|
const handlerLabel = handler && handler !== primary ? `→ ${handler}` : "";
|
|
@@ -2381,7 +2351,7 @@ async function buildInspectorViews(value, scope, { getTests = null, components =
|
|
|
2381
2351
|
getTests,
|
|
2382
2352
|
components,
|
|
2383
2353
|
expect: dev.expect,
|
|
2384
|
-
name: name ===
|
|
2354
|
+
name: name === void 0 ? comp.name : name
|
|
2385
2355
|
});
|
|
2386
2356
|
out.testView = TestReport.Class.fromResults(report);
|
|
2387
2357
|
out.hasTest = true;
|
|
@@ -2404,96 +2374,95 @@ function getComponents10() {
|
|
|
2404
2374
|
...getComponents2(),
|
|
2405
2375
|
...getComponents()
|
|
2406
2376
|
];
|
|
2407
|
-
const seen = new Set;
|
|
2377
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2408
2378
|
return all.filter((c) => {
|
|
2409
|
-
if (seen.has(c.name))
|
|
2410
|
-
return false;
|
|
2379
|
+
if (seen.has(c.name)) return false;
|
|
2411
2380
|
seen.add(c.name);
|
|
2412
2381
|
return true;
|
|
2413
2382
|
});
|
|
2414
2383
|
}
|
|
2415
2384
|
export {
|
|
2416
|
-
|
|
2417
|
-
recordToEntry,
|
|
2418
|
-
pathKeysLabel,
|
|
2419
|
-
makeValueInspector,
|
|
2420
|
-
makeInspect,
|
|
2421
|
-
makeCompositeView,
|
|
2422
|
-
lintMessage,
|
|
2423
|
-
isComponentInstance,
|
|
2424
|
-
introspectComponent,
|
|
2425
|
-
getComponents10 as getComponents,
|
|
2426
|
-
fmtAnyKey,
|
|
2427
|
-
fmtActivityTime,
|
|
2428
|
-
compositeView,
|
|
2429
|
-
compositeMethods,
|
|
2430
|
-
compositeFields,
|
|
2431
|
-
compositeAlter,
|
|
2432
|
-
collectTests,
|
|
2433
|
-
classifySchema,
|
|
2434
|
-
classifyJson,
|
|
2435
|
-
classifyJsExtra,
|
|
2436
|
-
classifyImmutable,
|
|
2437
|
-
classifyData,
|
|
2438
|
-
chain,
|
|
2439
|
-
buildInspectorViews,
|
|
2440
|
-
TestSuite,
|
|
2441
|
-
TestReport,
|
|
2442
|
-
TestCase,
|
|
2443
|
-
SchemaViewer,
|
|
2444
|
-
SchemaScalar,
|
|
2445
|
-
SchemaRef,
|
|
2446
|
-
SchemaProperty,
|
|
2447
|
-
SchemaObject,
|
|
2448
|
-
SchemaNot,
|
|
2449
|
-
SchemaEnum,
|
|
2450
|
-
SchemaConst,
|
|
2451
|
-
SchemaConditional,
|
|
2452
|
-
SchemaCombinator,
|
|
2453
|
-
SchemaBranch,
|
|
2454
|
-
SchemaBoolean,
|
|
2455
|
-
SchemaArray,
|
|
2456
|
-
LintReport,
|
|
2457
|
-
LintFinding,
|
|
2458
|
-
LintComponent,
|
|
2459
|
-
JsonViewer,
|
|
2460
|
-
JsonString,
|
|
2461
|
-
JsonProperty,
|
|
2462
|
-
JsonObject,
|
|
2463
|
-
JsonNumber,
|
|
2464
|
-
JsonNull,
|
|
2465
|
-
JsonBoolean,
|
|
2466
|
-
JsonArray,
|
|
2467
|
-
JsUndefined,
|
|
2468
|
-
JsSymbol,
|
|
2469
|
-
JsSetItem,
|
|
2470
|
-
JsSet,
|
|
2471
|
-
JsRegExp,
|
|
2472
|
-
JsMap,
|
|
2473
|
-
JsFunction,
|
|
2474
|
-
JsError,
|
|
2475
|
-
JsDate,
|
|
2476
|
-
JsClassInstance,
|
|
2477
|
-
JsBigInt,
|
|
2478
|
-
InstanceInspector,
|
|
2479
|
-
InstanceFields,
|
|
2480
|
-
InstanceExplorer,
|
|
2481
|
-
ImStack,
|
|
2482
|
-
ImSet,
|
|
2483
|
-
ImRecord,
|
|
2484
|
-
ImRange,
|
|
2485
|
-
ImOSet,
|
|
2486
|
-
ImOMap,
|
|
2487
|
-
ImMap,
|
|
2488
|
-
ImList,
|
|
2489
|
-
ImInspector,
|
|
2490
|
-
ImEntry,
|
|
2491
|
-
DataInspector,
|
|
2492
|
-
ComponentInspector,
|
|
2493
|
-
CompView,
|
|
2494
|
-
CompSection,
|
|
2495
|
-
CompName,
|
|
2496
|
-
CompField,
|
|
2385
|
+
ActivityEntry,
|
|
2497
2386
|
ActivityLog,
|
|
2498
|
-
|
|
2387
|
+
CompField,
|
|
2388
|
+
CompName,
|
|
2389
|
+
CompSection,
|
|
2390
|
+
CompView,
|
|
2391
|
+
ComponentInspector,
|
|
2392
|
+
DataInspector,
|
|
2393
|
+
ImEntry,
|
|
2394
|
+
ImInspector,
|
|
2395
|
+
ImList,
|
|
2396
|
+
ImMap,
|
|
2397
|
+
ImOMap,
|
|
2398
|
+
ImOSet,
|
|
2399
|
+
ImRange,
|
|
2400
|
+
ImRecord,
|
|
2401
|
+
ImSet,
|
|
2402
|
+
ImStack,
|
|
2403
|
+
InstanceExplorer,
|
|
2404
|
+
InstanceFields,
|
|
2405
|
+
InstanceInspector,
|
|
2406
|
+
JsBigInt,
|
|
2407
|
+
JsClassInstance,
|
|
2408
|
+
JsDate,
|
|
2409
|
+
JsError,
|
|
2410
|
+
JsFunction,
|
|
2411
|
+
JsMap,
|
|
2412
|
+
JsRegExp,
|
|
2413
|
+
JsSet,
|
|
2414
|
+
JsSetItem,
|
|
2415
|
+
JsSymbol,
|
|
2416
|
+
JsUndefined,
|
|
2417
|
+
JsonArray,
|
|
2418
|
+
JsonBoolean,
|
|
2419
|
+
JsonNull,
|
|
2420
|
+
JsonNumber,
|
|
2421
|
+
JsonObject,
|
|
2422
|
+
JsonProperty,
|
|
2423
|
+
JsonString,
|
|
2424
|
+
JsonViewer,
|
|
2425
|
+
LintComponent,
|
|
2426
|
+
LintFinding,
|
|
2427
|
+
LintReport,
|
|
2428
|
+
SchemaArray,
|
|
2429
|
+
SchemaBoolean,
|
|
2430
|
+
SchemaBranch,
|
|
2431
|
+
SchemaCombinator,
|
|
2432
|
+
SchemaConditional,
|
|
2433
|
+
SchemaConst,
|
|
2434
|
+
SchemaEnum,
|
|
2435
|
+
SchemaNot,
|
|
2436
|
+
SchemaObject,
|
|
2437
|
+
SchemaProperty,
|
|
2438
|
+
SchemaRef,
|
|
2439
|
+
SchemaScalar,
|
|
2440
|
+
SchemaViewer,
|
|
2441
|
+
TestCase,
|
|
2442
|
+
TestReport,
|
|
2443
|
+
TestSuite,
|
|
2444
|
+
buildInspectorViews,
|
|
2445
|
+
chain,
|
|
2446
|
+
classifyData,
|
|
2447
|
+
classifyImmutable,
|
|
2448
|
+
classifyJsExtra,
|
|
2449
|
+
classifyJson,
|
|
2450
|
+
classifySchema,
|
|
2451
|
+
collectTests,
|
|
2452
|
+
compositeAlter,
|
|
2453
|
+
compositeFields,
|
|
2454
|
+
compositeMethods,
|
|
2455
|
+
compositeView,
|
|
2456
|
+
fmtActivityTime,
|
|
2457
|
+
fmtAnyKey,
|
|
2458
|
+
getComponents10 as getComponents,
|
|
2459
|
+
introspectComponent,
|
|
2460
|
+
isComponentInstance,
|
|
2461
|
+
lintMessage,
|
|
2462
|
+
makeCompositeView,
|
|
2463
|
+
makeInspect,
|
|
2464
|
+
makeValueInspector,
|
|
2465
|
+
pathKeysLabel,
|
|
2466
|
+
recordToEntry,
|
|
2467
|
+
valueWrapperMethods
|
|
2499
2468
|
};
|