tutuca 0.11.0 → 0.11.2
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/tutuca-cli.js +264 -361
- package/dist/tutuca-components.js +175 -175
- package/dist/tutuca-dev.ext.js +250 -323
- package/dist/tutuca-dev.js +250 -323
- package/dist/tutuca-dev.min.js +4 -4
- package/dist/tutuca-extra.ext.js +55 -46
- package/dist/tutuca-extra.js +55 -46
- package/dist/tutuca-extra.min.js +3 -3
- package/dist/tutuca-storybook.js +29 -29
- package/dist/tutuca.ext.js +55 -46
- package/dist/tutuca.js +55 -46
- package/dist/tutuca.min.js +3 -3
- package/package.json +4 -3
- package/skill/margaui/SKILL.md +0 -105
- package/skill/margaui/components/accordion.md +0 -127
- package/skill/margaui/components/alert.md +0 -174
- package/skill/margaui/components/aura.md +0 -97
- package/skill/margaui/components/avatar.md +0 -220
- package/skill/margaui/components/badge.md +0 -193
- package/skill/margaui/components/breadcrumbs.md +0 -103
- package/skill/margaui/components/button.md +0 -322
- package/skill/margaui/components/calendar.md +0 -67
- package/skill/margaui/components/card.md +0 -373
- package/skill/margaui/components/carousel.md +0 -387
- package/skill/margaui/components/chat.md +0 -171
- package/skill/margaui/components/checkbox.md +0 -101
- package/skill/margaui/components/collapse.md +0 -172
- package/skill/margaui/components/countdown.md +0 -165
- package/skill/margaui/components/diff.md +0 -53
- package/skill/margaui/components/divider.md +0 -107
- package/skill/margaui/components/dock.md +0 -173
- package/skill/margaui/components/drawer.md +0 -184
- package/skill/margaui/components/dropdown.md +0 -388
- package/skill/margaui/components/fab.md +0 -346
- package/skill/margaui/components/fieldset.md +0 -88
- package/skill/margaui/components/file-input.md +0 -84
- package/skill/margaui/components/filter.md +0 -52
- package/skill/margaui/components/footer.md +0 -583
- package/skill/margaui/components/hero.md +0 -135
- package/skill/margaui/components/hover-3d.md +0 -129
- package/skill/margaui/components/hover-gallery.md +0 -49
- package/skill/margaui/components/indicator.md +0 -265
- package/skill/margaui/components/input.md +0 -389
- package/skill/margaui/components/join.md +0 -100
- package/skill/margaui/components/kbd.md +0 -127
- package/skill/margaui/components/label.md +0 -102
- package/skill/margaui/components/link.md +0 -96
- package/skill/margaui/components/list.md +0 -182
- package/skill/margaui/components/loading.md +0 -105
- package/skill/margaui/components/mask.md +0 -168
- package/skill/margaui/components/megamenu.md +0 -131
- package/skill/margaui/components/menu.md +0 -887
- package/skill/margaui/components/mockup-browser.md +0 -39
- package/skill/margaui/components/mockup-code.md +0 -81
- package/skill/margaui/components/mockup-phone.md +0 -39
- package/skill/margaui/components/mockup-window.md +0 -33
- package/skill/margaui/components/modal.md +0 -196
- package/skill/margaui/components/navbar.md +0 -282
- package/skill/margaui/components/otp.md +0 -171
- package/skill/margaui/components/pagination.md +0 -122
- package/skill/margaui/components/progress.md +0 -135
- package/skill/margaui/components/radial-progress.md +0 -67
- package/skill/margaui/components/radio.md +0 -133
- package/skill/margaui/components/range.md +0 -134
- package/skill/margaui/components/rating.md +0 -170
- package/skill/margaui/components/select.md +0 -225
- package/skill/margaui/components/skeleton.md +0 -64
- package/skill/margaui/components/stack.md +0 -142
- package/skill/margaui/components/stat.md +0 -254
- package/skill/margaui/components/status.md +0 -73
- package/skill/margaui/components/steps.md +0 -138
- package/skill/margaui/components/swap.md +0 -152
- package/skill/margaui/components/tab.md +0 -248
- package/skill/margaui/components/table.md +0 -1018
- package/skill/margaui/components/text-rotate.md +0 -91
- package/skill/margaui/components/textarea.md +0 -85
- package/skill/margaui/components/theme-controller.md +0 -266
- package/skill/margaui/components/timeline.md +0 -1356
- package/skill/margaui/components/toast.md +0 -165
- package/skill/margaui/components/toggle.md +0 -135
- package/skill/margaui/components/tooltip.md +0 -181
- package/skill/margaui/components/validator.md +0 -163
- package/skill/tutuca/SKILL.md +0 -56
- package/skill/tutuca/advanced.md +0 -212
- package/skill/tutuca/cli.md +0 -239
- package/skill/tutuca/component-design.md +0 -168
- package/skill/tutuca/core.md +0 -908
- package/skill/tutuca/iteration.md +0 -207
- package/skill/tutuca/macros.md +0 -86
- package/skill/tutuca/margaui.md +0 -175
- package/skill/tutuca/messages-and-intents.md +0 -399
- package/skill/tutuca/patterns/README.md +0 -48
- package/skill/tutuca/patterns/add-a-story.md +0 -26
- package/skill/tutuca/patterns/bind-text-and-attributes.md +0 -30
- package/skill/tutuca/patterns/conditional-attribute-value.md +0 -29
- package/skill/tutuca/patterns/coordinate-components.md +0 -54
- package/skill/tutuca/patterns/edit-through-a-dynamic-target.md +0 -27
- package/skill/tutuca/patterns/enrich-each-item.md +0 -25
- package/skill/tutuca/patterns/file-input.md +0 -39
- package/skill/tutuca/patterns/filter-a-list.md +0 -25
- package/skill/tutuca/patterns/filter-and-paginate.md +0 -60
- package/skill/tutuca/patterns/handle-events.md +0 -38
- package/skill/tutuca/patterns/iterate-a-list.md +0 -18
- package/skill/tutuca/patterns/paginate-a-list.md +0 -29
- package/skill/tutuca/patterns/render-a-child-component.md +0 -21
- package/skill/tutuca/patterns/reuse-markup-with-macros.md +0 -36
- package/skill/tutuca/patterns/share-state-across-the-tree.md +0 -38
- package/skill/tutuca/patterns/show-or-hide-content.md +0 -23
- package/skill/tutuca/patterns/switch-between-views.md +0 -30
- package/skill/tutuca/patterns/tabbed-interface.md +0 -43
- package/skill/tutuca/semantics.md +0 -195
- package/skill/tutuca/storybook.md +0 -270
- package/skill/tutuca/styles.md +0 -48
- package/skill/tutuca/testing.md +0 -346
- package/skill/tutuca-source/SKILL.md +0 -33
- package/skill/tutuca-source/tutuca.ext.js +0 -4235
|
@@ -23,13 +23,13 @@ var JsonBoolean = component({
|
|
|
23
23
|
return `${base} ${this.value ? "text-success" : "text-warning"}`;
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
view: html`<span :class="$cssClass" @text="$text"></span>`,
|
|
27
26
|
views: {
|
|
28
27
|
// Decoy: cssClass() builds these at runtime, so they never appear as
|
|
29
28
|
// literals the margaui scanner can find. Never rendered — registering
|
|
30
29
|
// the view is enough for compileClassesToStyleText to emit their CSS.
|
|
31
30
|
_margauiClasses: html`<p class="text-success text-warning"></p>`
|
|
32
|
-
}
|
|
31
|
+
},
|
|
32
|
+
view: html`<span :class="$cssClass" @text="$text"></span>`
|
|
33
33
|
});
|
|
34
34
|
var JsonNumber = component({
|
|
35
35
|
name: "JsonNumber",
|
|
@@ -212,8 +212,8 @@ function makeValueInspector({ name, fromData }) {
|
|
|
212
212
|
return component({
|
|
213
213
|
name,
|
|
214
214
|
fields: { value: null },
|
|
215
|
-
methods: valueWrapperMethods,
|
|
216
215
|
statics: { fromData },
|
|
216
|
+
methods: valueWrapperMethods,
|
|
217
217
|
view: valueWrapperView
|
|
218
218
|
});
|
|
219
219
|
}
|
|
@@ -389,17 +389,6 @@ var JsSetItem = component2({
|
|
|
389
389
|
var JsMap = component2({
|
|
390
390
|
name: "JsMap",
|
|
391
391
|
fields: compositeFields,
|
|
392
|
-
methods: {
|
|
393
|
-
...compositeMethods,
|
|
394
|
-
typeText() {
|
|
395
|
-
return "Map";
|
|
396
|
-
},
|
|
397
|
-
countText() {
|
|
398
|
-
return `(${this.items.length})`;
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
receive: compositeReceive,
|
|
402
|
-
alter: compositeAlter,
|
|
403
392
|
statics: {
|
|
404
393
|
fromData(map, recurse) {
|
|
405
394
|
const items = [];
|
|
@@ -409,15 +398,10 @@ var JsMap = component2({
|
|
|
409
398
|
return this.make({ items });
|
|
410
399
|
}
|
|
411
400
|
},
|
|
412
|
-
view: compositeView
|
|
413
|
-
});
|
|
414
|
-
var JsSet = component2({
|
|
415
|
-
name: "JsSet",
|
|
416
|
-
fields: compositeFields,
|
|
417
401
|
methods: {
|
|
418
402
|
...compositeMethods,
|
|
419
403
|
typeText() {
|
|
420
|
-
return "
|
|
404
|
+
return "Map";
|
|
421
405
|
},
|
|
422
406
|
countText() {
|
|
423
407
|
return `(${this.items.length})`;
|
|
@@ -425,28 +409,33 @@ var JsSet = component2({
|
|
|
425
409
|
},
|
|
426
410
|
receive: compositeReceive,
|
|
427
411
|
alter: compositeAlter,
|
|
412
|
+
view: compositeView
|
|
413
|
+
});
|
|
414
|
+
var JsSet = component2({
|
|
415
|
+
name: "JsSet",
|
|
416
|
+
fields: compositeFields,
|
|
428
417
|
statics: {
|
|
429
418
|
fromData(set, recurse) {
|
|
430
419
|
const items = [...set].map((v) => JsSetItem.make({ child: recurse(v) }));
|
|
431
420
|
return this.make({ items });
|
|
432
421
|
}
|
|
433
422
|
},
|
|
434
|
-
view: compositeView
|
|
435
|
-
});
|
|
436
|
-
var JsClassInstance = component2({
|
|
437
|
-
name: "JsClassInstance",
|
|
438
|
-
fields: { ...compositeFields, className: "Object" },
|
|
439
423
|
methods: {
|
|
440
424
|
...compositeMethods,
|
|
441
425
|
typeText() {
|
|
442
|
-
return
|
|
426
|
+
return "Set";
|
|
443
427
|
},
|
|
444
428
|
countText() {
|
|
445
|
-
return `
|
|
429
|
+
return `(${this.items.length})`;
|
|
446
430
|
}
|
|
447
431
|
},
|
|
448
432
|
receive: compositeReceive,
|
|
449
433
|
alter: compositeAlter,
|
|
434
|
+
view: compositeView
|
|
435
|
+
});
|
|
436
|
+
var JsClassInstance = component2({
|
|
437
|
+
name: "JsClassInstance",
|
|
438
|
+
fields: { ...compositeFields, className: "Object" },
|
|
450
439
|
statics: {
|
|
451
440
|
fromData(obj, recurse) {
|
|
452
441
|
const className = obj.constructor?.name || "Object";
|
|
@@ -460,6 +449,17 @@ var JsClassInstance = component2({
|
|
|
460
449
|
return this.make({ className, items });
|
|
461
450
|
}
|
|
462
451
|
},
|
|
452
|
+
methods: {
|
|
453
|
+
...compositeMethods,
|
|
454
|
+
typeText() {
|
|
455
|
+
return this.className;
|
|
456
|
+
},
|
|
457
|
+
countText() {
|
|
458
|
+
return `{${this.items.length}}`;
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
receive: compositeReceive,
|
|
462
|
+
alter: compositeAlter,
|
|
463
463
|
view: compositeView
|
|
464
464
|
});
|
|
465
465
|
function classifyJsExtra(data, recurse) {
|
|
@@ -482,11 +482,11 @@ function classifyJsExtra(data, recurse) {
|
|
|
482
482
|
errorName: data.name ?? "Error",
|
|
483
483
|
message: data.message ?? ""
|
|
484
484
|
});
|
|
485
|
-
if (data instanceof Map) return JsMap.
|
|
486
|
-
if (data instanceof Set) return JsSet.
|
|
485
|
+
if (data instanceof Map) return JsMap.fromData(data, recurse);
|
|
486
|
+
if (data instanceof Set) return JsSet.fromData(data, recurse);
|
|
487
487
|
const proto = Object.getPrototypeOf(data);
|
|
488
488
|
if (proto !== Object.prototype && proto !== null) {
|
|
489
|
-
return JsClassInstance.
|
|
489
|
+
return JsClassInstance.fromData(data, recurse);
|
|
490
490
|
}
|
|
491
491
|
return null;
|
|
492
492
|
}
|
|
@@ -655,7 +655,7 @@ function collectBadges(schema) {
|
|
|
655
655
|
function valueBranch(label, value) {
|
|
656
656
|
return SchemaBranch.make({
|
|
657
657
|
label,
|
|
658
|
-
child: JsonViewer.
|
|
658
|
+
child: JsonViewer.fromData(value),
|
|
659
659
|
labelClass: "text-info"
|
|
660
660
|
});
|
|
661
661
|
}
|
|
@@ -735,6 +735,13 @@ var SchemaBranch = component3({
|
|
|
735
735
|
return `font-mono text-sm ${this.labelClass}`;
|
|
736
736
|
}
|
|
737
737
|
},
|
|
738
|
+
views: {
|
|
739
|
+
// Decoy: labelClass colours are chosen in JS, so they never appear as
|
|
740
|
+
// literals for the margaui scanner.
|
|
741
|
+
_margauiClasses: html3`<p
|
|
742
|
+
class="text-accent text-secondary text-info text-error"
|
|
743
|
+
></p>`
|
|
744
|
+
},
|
|
738
745
|
// `contents` so the label cell and value cell land directly in the parent's
|
|
739
746
|
// grid, aligning values across rows.
|
|
740
747
|
view: html3`<div class="contents">
|
|
@@ -743,25 +750,11 @@ var SchemaBranch = component3({
|
|
|
743
750
|
<span class="text-base-content/30">:</span>
|
|
744
751
|
</span>
|
|
745
752
|
<x render=".child"></x>
|
|
746
|
-
</div
|
|
747
|
-
views: {
|
|
748
|
-
// Decoy: labelClass colours are chosen in JS, so they never appear as
|
|
749
|
-
// literals for the margaui scanner.
|
|
750
|
-
_margauiClasses: html3`<p
|
|
751
|
-
class="text-accent text-secondary text-info text-error"
|
|
752
|
-
></p>`
|
|
753
|
-
}
|
|
753
|
+
</div>`
|
|
754
754
|
});
|
|
755
755
|
var SchemaScalar = component3({
|
|
756
756
|
name: "SchemaScalar",
|
|
757
757
|
fields: schemaNodeFields,
|
|
758
|
-
methods: schemaNodeMethods({
|
|
759
|
-
countText() {
|
|
760
|
-
return "";
|
|
761
|
-
}
|
|
762
|
-
}),
|
|
763
|
-
receive: compositeReceive,
|
|
764
|
-
alter: compositeAlter,
|
|
765
758
|
statics: {
|
|
766
759
|
fromData(schema, recurse) {
|
|
767
760
|
return this.make({
|
|
@@ -772,18 +765,18 @@ var SchemaScalar = component3({
|
|
|
772
765
|
});
|
|
773
766
|
}
|
|
774
767
|
},
|
|
775
|
-
view: makeSchemaView("text-success")
|
|
776
|
-
});
|
|
777
|
-
var SchemaObject = component3({
|
|
778
|
-
name: "SchemaObject",
|
|
779
|
-
fields: schemaNodeFields,
|
|
780
768
|
methods: schemaNodeMethods({
|
|
781
769
|
countText() {
|
|
782
|
-
return
|
|
770
|
+
return "";
|
|
783
771
|
}
|
|
784
772
|
}),
|
|
785
773
|
receive: compositeReceive,
|
|
786
774
|
alter: compositeAlter,
|
|
775
|
+
view: makeSchemaView("text-success")
|
|
776
|
+
});
|
|
777
|
+
var SchemaObject = component3({
|
|
778
|
+
name: "SchemaObject",
|
|
779
|
+
fields: schemaNodeFields,
|
|
787
780
|
statics: {
|
|
788
781
|
fromData(schema, recurse) {
|
|
789
782
|
const required = Array.isArray(schema.required) ? schema.required : [];
|
|
@@ -837,18 +830,18 @@ var SchemaObject = component3({
|
|
|
837
830
|
});
|
|
838
831
|
}
|
|
839
832
|
},
|
|
840
|
-
view: makeSchemaView("text-primary")
|
|
841
|
-
});
|
|
842
|
-
var SchemaArray = component3({
|
|
843
|
-
name: "SchemaArray",
|
|
844
|
-
fields: schemaNodeFields,
|
|
845
833
|
methods: schemaNodeMethods({
|
|
846
834
|
countText() {
|
|
847
|
-
return this.items.length > 0 ? `
|
|
835
|
+
return this.items.length > 0 ? `{${this.items.length}}` : "";
|
|
848
836
|
}
|
|
849
837
|
}),
|
|
850
838
|
receive: compositeReceive,
|
|
851
839
|
alter: compositeAlter,
|
|
840
|
+
view: makeSchemaView("text-primary")
|
|
841
|
+
});
|
|
842
|
+
var SchemaArray = component3({
|
|
843
|
+
name: "SchemaArray",
|
|
844
|
+
fields: schemaNodeFields,
|
|
852
845
|
statics: {
|
|
853
846
|
fromData(schema, recurse) {
|
|
854
847
|
const items = [];
|
|
@@ -884,22 +877,22 @@ var SchemaArray = component3({
|
|
|
884
877
|
});
|
|
885
878
|
}
|
|
886
879
|
},
|
|
887
|
-
view: makeSchemaView("text-primary")
|
|
888
|
-
});
|
|
889
|
-
var SchemaEnum = component3({
|
|
890
|
-
name: "SchemaEnum",
|
|
891
|
-
fields: schemaNodeFields,
|
|
892
880
|
methods: schemaNodeMethods({
|
|
893
881
|
countText() {
|
|
894
|
-
return this.items.length > 0 ? `
|
|
882
|
+
return this.items.length > 0 ? `[${this.items.length}]` : "";
|
|
895
883
|
}
|
|
896
884
|
}),
|
|
897
885
|
receive: compositeReceive,
|
|
898
886
|
alter: compositeAlter,
|
|
887
|
+
view: makeSchemaView("text-primary")
|
|
888
|
+
});
|
|
889
|
+
var SchemaEnum = component3({
|
|
890
|
+
name: "SchemaEnum",
|
|
891
|
+
fields: schemaNodeFields,
|
|
899
892
|
statics: {
|
|
900
893
|
fromData(schema, recurse) {
|
|
901
894
|
const members = Array.isArray(schema.enum) ? schema.enum : [];
|
|
902
|
-
const items = members.map((v) => JsonViewer.
|
|
895
|
+
const items = members.map((v) => JsonViewer.fromData(v));
|
|
903
896
|
items.push(...collectExtras(schema, recurse, "enum"));
|
|
904
897
|
return this.make({
|
|
905
898
|
typeLabel: "enum",
|
|
@@ -909,6 +902,13 @@ var SchemaEnum = component3({
|
|
|
909
902
|
});
|
|
910
903
|
}
|
|
911
904
|
},
|
|
905
|
+
methods: schemaNodeMethods({
|
|
906
|
+
countText() {
|
|
907
|
+
return this.items.length > 0 ? `(${this.items.length})` : "";
|
|
908
|
+
}
|
|
909
|
+
}),
|
|
910
|
+
receive: compositeReceive,
|
|
911
|
+
alter: compositeAlter,
|
|
912
912
|
// list layout: each enum member is a single value rendered one per line.
|
|
913
913
|
view: makeSchemaView("text-info", LIST_BODY)
|
|
914
914
|
});
|
|
@@ -917,7 +917,7 @@ var SchemaConst = component3({
|
|
|
917
917
|
fields: { value: null },
|
|
918
918
|
statics: {
|
|
919
919
|
fromData(schema) {
|
|
920
|
-
return this.make({ value: JsonViewer.
|
|
920
|
+
return this.make({ value: JsonViewer.fromData(schema.const) });
|
|
921
921
|
}
|
|
922
922
|
},
|
|
923
923
|
view: html3`<span
|
|
@@ -931,13 +931,6 @@ var SchemaConst = component3({
|
|
|
931
931
|
var SchemaCombinator = component3({
|
|
932
932
|
name: "SchemaCombinator",
|
|
933
933
|
fields: schemaNodeFields,
|
|
934
|
-
methods: schemaNodeMethods({
|
|
935
|
-
countText() {
|
|
936
|
-
return this.items.length > 0 ? `(${this.items.length})` : "";
|
|
937
|
-
}
|
|
938
|
-
}),
|
|
939
|
-
receive: compositeReceive,
|
|
940
|
-
alter: compositeAlter,
|
|
941
934
|
statics: {
|
|
942
935
|
fromData(schema, recurse) {
|
|
943
936
|
const items = [];
|
|
@@ -957,6 +950,13 @@ var SchemaCombinator = component3({
|
|
|
957
950
|
});
|
|
958
951
|
}
|
|
959
952
|
},
|
|
953
|
+
methods: schemaNodeMethods({
|
|
954
|
+
countText() {
|
|
955
|
+
return this.items.length > 0 ? `(${this.items.length})` : "";
|
|
956
|
+
}
|
|
957
|
+
}),
|
|
958
|
+
receive: compositeReceive,
|
|
959
|
+
alter: compositeAlter,
|
|
960
960
|
// list layout: members are full schema nodes listed one per line, no keys.
|
|
961
961
|
view: makeSchemaView("text-accent", LIST_BODY)
|
|
962
962
|
});
|
|
@@ -1053,12 +1053,12 @@ var SchemaBoolean = component3({
|
|
|
1053
1053
|
return `${base} ${this.value ? "text-success" : "text-error"}`;
|
|
1054
1054
|
}
|
|
1055
1055
|
},
|
|
1056
|
-
view: html3`<span :class="$cssClass" @text="$text"></span>`,
|
|
1057
1056
|
views: {
|
|
1058
1057
|
// Decoy: cssClass() builds these at runtime, so they never appear as
|
|
1059
1058
|
// literals the margaui scanner can find.
|
|
1060
1059
|
_margauiClasses: html3`<p class="text-success text-error"></p>`
|
|
1061
|
-
}
|
|
1060
|
+
},
|
|
1061
|
+
view: html3`<span :class="$cssClass" @text="$text"></span>`
|
|
1062
1062
|
});
|
|
1063
1063
|
var SchemaRef = component3({
|
|
1064
1064
|
name: "SchemaRef",
|
|
@@ -1075,21 +1075,21 @@ var SchemaViewer = component3({
|
|
|
1075
1075
|
rawSchema: null,
|
|
1076
1076
|
showRaw: false
|
|
1077
1077
|
},
|
|
1078
|
-
methods: {
|
|
1079
|
-
...valueWrapperMethods,
|
|
1080
|
-
toggleLabel() {
|
|
1081
|
-
return this.showRaw ? "high-level view" : "raw schema";
|
|
1082
|
-
}
|
|
1083
|
-
},
|
|
1084
1078
|
statics: {
|
|
1085
1079
|
fromData(schema) {
|
|
1086
1080
|
return this.make({
|
|
1087
1081
|
value: dispatch2(schema),
|
|
1088
|
-
raw: JsonViewer.
|
|
1082
|
+
raw: JsonViewer.fromData(schema),
|
|
1089
1083
|
rawSchema: schema
|
|
1090
1084
|
});
|
|
1091
1085
|
}
|
|
1092
1086
|
},
|
|
1087
|
+
methods: {
|
|
1088
|
+
...valueWrapperMethods,
|
|
1089
|
+
toggleLabel() {
|
|
1090
|
+
return this.showRaw ? "high-level view" : "raw schema";
|
|
1091
|
+
}
|
|
1092
|
+
},
|
|
1093
1093
|
receive: {
|
|
1094
1094
|
toggleShowRaw(draft) {
|
|
1095
1095
|
draft.showRaw = !draft.showRaw;
|
|
@@ -1118,18 +1118,18 @@ function hasArrayKeywords(schema) {
|
|
|
1118
1118
|
}
|
|
1119
1119
|
function classifySchema(schema, recurse = classifySchema) {
|
|
1120
1120
|
if (schema === true || schema === false) return SchemaBoolean.make({ value: schema });
|
|
1121
|
-
if (schema === null || typeof schema !== "object") return JsonViewer.
|
|
1121
|
+
if (schema === null || typeof schema !== "object") return JsonViewer.fromData(schema);
|
|
1122
1122
|
if (typeof schema.$ref === "string") return SchemaRef.make({ target: schema.$ref });
|
|
1123
|
-
if (hasObjectKeywords(schema)) return SchemaObject.
|
|
1124
|
-
if (hasArrayKeywords(schema)) return SchemaArray.
|
|
1125
|
-
if (Array.isArray(schema.enum)) return SchemaEnum.
|
|
1126
|
-
if ("const" in schema) return SchemaConst.
|
|
1123
|
+
if (hasObjectKeywords(schema)) return SchemaObject.fromData(schema, recurse);
|
|
1124
|
+
if (hasArrayKeywords(schema)) return SchemaArray.fromData(schema, recurse);
|
|
1125
|
+
if (Array.isArray(schema.enum)) return SchemaEnum.fromData(schema, recurse);
|
|
1126
|
+
if ("const" in schema) return SchemaConst.fromData(schema, recurse);
|
|
1127
1127
|
if (schema.allOf || schema.anyOf || schema.oneOf)
|
|
1128
|
-
return SchemaCombinator.
|
|
1129
|
-
if (schema.not !== void 0) return SchemaNot.
|
|
1128
|
+
return SchemaCombinator.fromData(schema, recurse);
|
|
1129
|
+
if (schema.not !== void 0) return SchemaNot.fromData(schema, recurse);
|
|
1130
1130
|
if (schema.if !== void 0 || schema.then !== void 0 || schema.else !== void 0)
|
|
1131
|
-
return SchemaConditional.
|
|
1132
|
-
return SchemaScalar.
|
|
1131
|
+
return SchemaConditional.fromData(schema, recurse);
|
|
1132
|
+
return SchemaScalar.fromData(schema, recurse);
|
|
1133
1133
|
}
|
|
1134
1134
|
var dispatch2 = chain(classifySchema);
|
|
1135
1135
|
function getComponents3() {
|
|
@@ -1160,7 +1160,7 @@ import { component as component7, html as html7 } from "tutuca";
|
|
|
1160
1160
|
// src/components/tutuca/component-inspector.js
|
|
1161
1161
|
import { component as component4, html as html4 } from "tutuca";
|
|
1162
1162
|
function introspectComponent(comp) {
|
|
1163
|
-
const { fields, methods } = comp
|
|
1163
|
+
const { fields, methods } = comp;
|
|
1164
1164
|
return {
|
|
1165
1165
|
name: comp.name,
|
|
1166
1166
|
id: comp.id,
|
|
@@ -1269,20 +1269,6 @@ var CompSection = component4({
|
|
|
1269
1269
|
var ComponentInspector = component4({
|
|
1270
1270
|
name: "ComponentInspector",
|
|
1271
1271
|
fields: { compName: "", compId: 0, sections: [] },
|
|
1272
|
-
methods: {
|
|
1273
|
-
idText() {
|
|
1274
|
-
return `#${this.compId}`;
|
|
1275
|
-
}
|
|
1276
|
-
},
|
|
1277
|
-
intent: {
|
|
1278
|
-
toggleAllSections(draft, state) {
|
|
1279
|
-
for (const section of draft.sections) section.isExpanded = state;
|
|
1280
|
-
},
|
|
1281
|
-
toggleAllViews(draft, state) {
|
|
1282
|
-
const section = draft.sections.find((candidate) => candidate.label === "Views");
|
|
1283
|
-
if (section) for (const view of section.items) view.isExpanded = state;
|
|
1284
|
-
}
|
|
1285
|
-
},
|
|
1286
1272
|
statics: {
|
|
1287
1273
|
fromData(comp) {
|
|
1288
1274
|
const d = introspectComponent(comp);
|
|
@@ -1299,7 +1285,7 @@ var ComponentInspector = component4({
|
|
|
1299
1285
|
(f) => CompField.make({
|
|
1300
1286
|
name: f.name,
|
|
1301
1287
|
typeName: f.type,
|
|
1302
|
-
child: DataInspector.
|
|
1288
|
+
child: DataInspector.fromData(f.defaultValue)
|
|
1303
1289
|
})
|
|
1304
1290
|
),
|
|
1305
1291
|
true
|
|
@@ -1316,6 +1302,20 @@ var ComponentInspector = component4({
|
|
|
1316
1302
|
return this.make({ compName: d.name, compId: d.id, sections });
|
|
1317
1303
|
}
|
|
1318
1304
|
},
|
|
1305
|
+
methods: {
|
|
1306
|
+
idText() {
|
|
1307
|
+
return `#${this.compId}`;
|
|
1308
|
+
}
|
|
1309
|
+
},
|
|
1310
|
+
intent: {
|
|
1311
|
+
toggleAllSections(draft, state) {
|
|
1312
|
+
for (const section of draft.sections) section.isExpanded = state;
|
|
1313
|
+
},
|
|
1314
|
+
toggleAllViews(draft, state) {
|
|
1315
|
+
const section = draft.sections.find((candidate) => candidate.label === "Views");
|
|
1316
|
+
if (section) for (const view of section.items) view.isExpanded = state;
|
|
1317
|
+
}
|
|
1318
|
+
},
|
|
1319
1319
|
view: html4`<div class="font-mono text-sm leading-tight flex flex-col gap-1">
|
|
1320
1320
|
<div class="inline-flex items-center gap-2">
|
|
1321
1321
|
<span class="font-semibold" @text=".compName"></span>
|
|
@@ -1459,7 +1459,7 @@ function buildFinding(f) {
|
|
|
1459
1459
|
level: f.level ?? "",
|
|
1460
1460
|
message: lintMessage(f.id, info),
|
|
1461
1461
|
suggestion: suggestionText(f.suggestion),
|
|
1462
|
-
detail: DataInspector.
|
|
1462
|
+
detail: DataInspector.fromData({ id: f.id, info, context: ctx })
|
|
1463
1463
|
});
|
|
1464
1464
|
}
|
|
1465
1465
|
var LintComponent = component5({
|
|
@@ -1493,26 +1493,6 @@ var LintReport = component5({
|
|
|
1493
1493
|
clean: true,
|
|
1494
1494
|
components: []
|
|
1495
1495
|
},
|
|
1496
|
-
methods: {
|
|
1497
|
-
errText() {
|
|
1498
|
-
return `${this.errors} error${this.errors === 1 ? "" : "s"}`;
|
|
1499
|
-
},
|
|
1500
|
-
warnText() {
|
|
1501
|
-
return `${this.warnings} warning${this.warnings === 1 ? "" : "s"}`;
|
|
1502
|
-
},
|
|
1503
|
-
hintText() {
|
|
1504
|
-
return `${this.hints} hint${this.hints === 1 ? "" : "s"}`;
|
|
1505
|
-
},
|
|
1506
|
-
hasErrors() {
|
|
1507
|
-
return this.errors > 0;
|
|
1508
|
-
},
|
|
1509
|
-
hasWarnings() {
|
|
1510
|
-
return this.warnings > 0;
|
|
1511
|
-
},
|
|
1512
|
-
hasHints() {
|
|
1513
|
-
return this.hints > 0;
|
|
1514
|
-
}
|
|
1515
|
-
},
|
|
1516
1496
|
statics: {
|
|
1517
1497
|
fromData(report, { title = "Lint", path = "" } = {}) {
|
|
1518
1498
|
const comps = report?.components ?? [];
|
|
@@ -1551,6 +1531,26 @@ var LintReport = component5({
|
|
|
1551
1531
|
});
|
|
1552
1532
|
}
|
|
1553
1533
|
},
|
|
1534
|
+
methods: {
|
|
1535
|
+
errText() {
|
|
1536
|
+
return `${this.errors} error${this.errors === 1 ? "" : "s"}`;
|
|
1537
|
+
},
|
|
1538
|
+
warnText() {
|
|
1539
|
+
return `${this.warnings} warning${this.warnings === 1 ? "" : "s"}`;
|
|
1540
|
+
},
|
|
1541
|
+
hintText() {
|
|
1542
|
+
return `${this.hints} hint${this.hints === 1 ? "" : "s"}`;
|
|
1543
|
+
},
|
|
1544
|
+
hasErrors() {
|
|
1545
|
+
return this.errors > 0;
|
|
1546
|
+
},
|
|
1547
|
+
hasWarnings() {
|
|
1548
|
+
return this.warnings > 0;
|
|
1549
|
+
},
|
|
1550
|
+
hasHints() {
|
|
1551
|
+
return this.hints > 0;
|
|
1552
|
+
}
|
|
1553
|
+
},
|
|
1554
1554
|
// Decoy so the runtime-absent soft tally colours are emitted.
|
|
1555
1555
|
views: {
|
|
1556
1556
|
_palette: html5`<span
|
|
@@ -1736,7 +1736,7 @@ function buildResultNode(node) {
|
|
|
1736
1736
|
status,
|
|
1737
1737
|
durationMs: node.durationMs ?? 0,
|
|
1738
1738
|
message: err?.message ?? "",
|
|
1739
|
-
detail: hasDiff ? DataInspector.
|
|
1739
|
+
detail: hasDiff ? DataInspector.fromData({ expected: err.expected, actual: err.actual }) : null
|
|
1740
1740
|
});
|
|
1741
1741
|
return {
|
|
1742
1742
|
comp,
|
|
@@ -1756,29 +1756,6 @@ var TestReport = component6({
|
|
|
1756
1756
|
hasCounts: false,
|
|
1757
1757
|
suites: []
|
|
1758
1758
|
},
|
|
1759
|
-
methods: {
|
|
1760
|
-
passText() {
|
|
1761
|
-
return `✓ ${this.pass}`;
|
|
1762
|
-
},
|
|
1763
|
-
failText() {
|
|
1764
|
-
return `✗ ${this.fail}`;
|
|
1765
|
-
},
|
|
1766
|
-
skipText() {
|
|
1767
|
-
return `○ ${this.skip}`;
|
|
1768
|
-
},
|
|
1769
|
-
hasFailures() {
|
|
1770
|
-
return this.hasCounts && this.fail > 0;
|
|
1771
|
-
},
|
|
1772
|
-
hasSkips() {
|
|
1773
|
-
return this.hasCounts && this.skip > 0;
|
|
1774
|
-
}
|
|
1775
|
-
},
|
|
1776
|
-
intent: {
|
|
1777
|
-
// ctrl/cmd-click on any suite expands/collapses the whole tree at once.
|
|
1778
|
-
toggleAll(draft, state) {
|
|
1779
|
-
for (const suite of draft.suites) setSuiteTreeExpanded(suite, state);
|
|
1780
|
-
}
|
|
1781
|
-
},
|
|
1782
1759
|
statics: {
|
|
1783
1760
|
fromTests(source, { title = "Tests", path = "" } = {}) {
|
|
1784
1761
|
const suites = Array.isArray(source) ? source : source?.suites ?? [];
|
|
@@ -1803,6 +1780,29 @@ var TestReport = component6({
|
|
|
1803
1780
|
});
|
|
1804
1781
|
}
|
|
1805
1782
|
},
|
|
1783
|
+
methods: {
|
|
1784
|
+
passText() {
|
|
1785
|
+
return `✓ ${this.pass}`;
|
|
1786
|
+
},
|
|
1787
|
+
failText() {
|
|
1788
|
+
return `✗ ${this.fail}`;
|
|
1789
|
+
},
|
|
1790
|
+
skipText() {
|
|
1791
|
+
return `○ ${this.skip}`;
|
|
1792
|
+
},
|
|
1793
|
+
hasFailures() {
|
|
1794
|
+
return this.hasCounts && this.fail > 0;
|
|
1795
|
+
},
|
|
1796
|
+
hasSkips() {
|
|
1797
|
+
return this.hasCounts && this.skip > 0;
|
|
1798
|
+
}
|
|
1799
|
+
},
|
|
1800
|
+
intent: {
|
|
1801
|
+
// ctrl/cmd-click on any suite expands/collapses the whole tree at once.
|
|
1802
|
+
toggleAll(draft, state) {
|
|
1803
|
+
for (const suite of draft.suites) setSuiteTreeExpanded(suite, state);
|
|
1804
|
+
}
|
|
1805
|
+
},
|
|
1806
1806
|
view: html6`<div class="font-mono text-sm leading-tight flex flex-col gap-1">
|
|
1807
1807
|
<div class="flex items-center gap-2 flex-wrap">
|
|
1808
1808
|
<span class="font-semibold" @text=".title"></span>
|
|
@@ -1839,45 +1839,45 @@ var fieldsView = makeCompositeView({
|
|
|
1839
1839
|
var InstanceFields = component7({
|
|
1840
1840
|
name: "InstanceFields",
|
|
1841
1841
|
fields: { ...compositeFields, typeName: "" },
|
|
1842
|
-
methods: {
|
|
1843
|
-
...compositeMethods,
|
|
1844
|
-
typeText() {
|
|
1845
|
-
return this.typeName;
|
|
1846
|
-
},
|
|
1847
|
-
countText() {
|
|
1848
|
-
return `{${this.items.length}}`;
|
|
1849
|
-
}
|
|
1850
|
-
},
|
|
1851
|
-
receive: compositeReceive,
|
|
1852
|
-
alter: compositeAlter,
|
|
1853
1842
|
statics: {
|
|
1854
1843
|
fromData(instance, comp) {
|
|
1855
1844
|
const d = introspectComponent(comp);
|
|
1856
1845
|
const items = d.fields.map(
|
|
1857
1846
|
(f) => JsonProperty.make({
|
|
1858
1847
|
key: f.name,
|
|
1859
|
-
child: DataInspector.
|
|
1848
|
+
child: DataInspector.fromData(instance[f.name])
|
|
1860
1849
|
})
|
|
1861
1850
|
);
|
|
1862
1851
|
return this.make({ typeName: d.name, items, isExpanded: true });
|
|
1863
1852
|
}
|
|
1864
1853
|
},
|
|
1854
|
+
methods: {
|
|
1855
|
+
...compositeMethods,
|
|
1856
|
+
typeText() {
|
|
1857
|
+
return this.typeName;
|
|
1858
|
+
},
|
|
1859
|
+
countText() {
|
|
1860
|
+
return `{${this.items.length}}`;
|
|
1861
|
+
}
|
|
1862
|
+
},
|
|
1863
|
+
receive: compositeReceive,
|
|
1864
|
+
alter: compositeAlter,
|
|
1865
1865
|
view: fieldsView
|
|
1866
1866
|
});
|
|
1867
1867
|
var InstanceInspector = makeValueInspector({
|
|
1868
1868
|
name: "InstanceInspector",
|
|
1869
1869
|
fromData(instance, comp) {
|
|
1870
|
-
const value = comp && isComponentInstance(instance) ? InstanceFields.
|
|
1870
|
+
const value = comp && isComponentInstance(instance) ? InstanceFields.fromData(instance, comp) : DataInspector.fromData(instance);
|
|
1871
1871
|
return this.make({ value });
|
|
1872
1872
|
}
|
|
1873
1873
|
});
|
|
1874
1874
|
function asTestView(tests) {
|
|
1875
1875
|
if (tests == null) return null;
|
|
1876
|
-
return isComponentInstance(tests) ? tests : TestReport.
|
|
1876
|
+
return isComponentInstance(tests) ? tests : TestReport.fromResults(tests);
|
|
1877
1877
|
}
|
|
1878
1878
|
function asLintView(lint) {
|
|
1879
1879
|
if (lint == null) return null;
|
|
1880
|
-
return isComponentInstance(lint) ? lint : LintReport.
|
|
1880
|
+
return isComponentInstance(lint) ? lint : LintReport.fromData(lint);
|
|
1881
1881
|
}
|
|
1882
1882
|
var InstanceExplorer = component7({
|
|
1883
1883
|
name: "InstanceExplorer",
|
|
@@ -1896,8 +1896,8 @@ var InstanceExplorer = component7({
|
|
|
1896
1896
|
const testView = asTestView(tests);
|
|
1897
1897
|
const lintView = asLintView(lint);
|
|
1898
1898
|
return this.make({
|
|
1899
|
-
instanceView: InstanceInspector.
|
|
1900
|
-
componentView: comp ? ComponentInspector.
|
|
1899
|
+
instanceView: InstanceInspector.fromData(instance, comp),
|
|
1900
|
+
componentView: comp ? ComponentInspector.fromData(comp) : null,
|
|
1901
1901
|
testView,
|
|
1902
1902
|
lintView,
|
|
1903
1903
|
hasComponent: !!comp,
|
|
@@ -2007,7 +2007,7 @@ var ActivityEntry = component8({
|
|
|
2007
2007
|
>
|
|
2008
2008
|
<div class="flex items-center gap-2 flex-wrap">
|
|
2009
2009
|
<span
|
|
2010
|
-
title="How this was dispatched: receive (send)
|
|
2010
|
+
title="How this was dispatched: receive (send) or intent"
|
|
2011
2011
|
class="badge badge-sm badge-neutral"
|
|
2012
2012
|
@text=".kind"
|
|
2013
2013
|
></span>
|
|
@@ -2075,7 +2075,7 @@ function pathKeysLabel(pathKeys) {
|
|
|
2075
2075
|
function makeInspect(app) {
|
|
2076
2076
|
return (value) => {
|
|
2077
2077
|
const comp = isComponentInstance(value) ? app.comps.getCompFor(value) : null;
|
|
2078
|
-
return InstanceInspector.
|
|
2078
|
+
return InstanceInspector.fromData(value, comp);
|
|
2079
2079
|
};
|
|
2080
2080
|
}
|
|
2081
2081
|
function recordToEntry(record, { inspect, pathLabel = pathKeysLabel } = {}) {
|
|
@@ -2103,7 +2103,7 @@ function getComponents8() {
|
|
|
2103
2103
|
async function buildInspectorViews(value, scope, { getTests = null, components = [], dev = null, name } = {}) {
|
|
2104
2104
|
const comp = isComponentInstance(value) ? scope.getCompFor(value) : null;
|
|
2105
2105
|
const out = {
|
|
2106
|
-
instanceView: InstanceInspector.
|
|
2106
|
+
instanceView: InstanceInspector.fromData(value, scope.getCompFor(value)),
|
|
2107
2107
|
componentView: null,
|
|
2108
2108
|
lintView: null,
|
|
2109
2109
|
testView: null,
|
|
@@ -2113,11 +2113,11 @@ async function buildInspectorViews(value, scope, { getTests = null, components =
|
|
|
2113
2113
|
hasTest: false
|
|
2114
2114
|
};
|
|
2115
2115
|
if (comp) {
|
|
2116
|
-
out.componentView = ComponentInspector.
|
|
2116
|
+
out.componentView = ComponentInspector.fromData(comp);
|
|
2117
2117
|
out.hasComponent = true;
|
|
2118
2118
|
if (dev) {
|
|
2119
2119
|
const findings = dev.shadowCheckComponent(comp);
|
|
2120
|
-
out.lintView = LintReport.
|
|
2120
|
+
out.lintView = LintReport.fromData({
|
|
2121
2121
|
components: [{ componentName: comp.name, findings }]
|
|
2122
2122
|
});
|
|
2123
2123
|
out.hasLint = true;
|
|
@@ -2128,7 +2128,7 @@ async function buildInspectorViews(value, scope, { getTests = null, components =
|
|
|
2128
2128
|
expect: dev.expect,
|
|
2129
2129
|
name: name === void 0 ? comp.name : name
|
|
2130
2130
|
});
|
|
2131
|
-
out.testView = TestReport.
|
|
2131
|
+
out.testView = TestReport.fromResults(report);
|
|
2132
2132
|
out.hasTest = true;
|
|
2133
2133
|
}
|
|
2134
2134
|
}
|