@t0.labs/daxta 0.4.9 → 0.4.10
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/assets/viewer.html +91 -17
- package/package.json +1 -1
package/assets/viewer.html
CHANGED
|
@@ -515,12 +515,43 @@
|
|
|
515
515
|
.nav-examples {
|
|
516
516
|
display: none;
|
|
517
517
|
flex-direction: column;
|
|
518
|
-
gap:
|
|
518
|
+
gap: 6px;
|
|
519
519
|
margin: 0 4px 6px 18px;
|
|
520
520
|
padding-left: 10px;
|
|
521
521
|
border-left: 1px solid var(--hairline);
|
|
522
522
|
}
|
|
523
523
|
.nav-op.examples-open > .nav-examples { display: flex; }
|
|
524
|
+
.nav-ex-group { display: flex; flex-direction: column; gap: 1px; }
|
|
525
|
+
.nav-ex-group-label {
|
|
526
|
+
display: flex;
|
|
527
|
+
align-items: center;
|
|
528
|
+
justify-content: space-between;
|
|
529
|
+
gap: 8px;
|
|
530
|
+
padding: 6px 8px 2px;
|
|
531
|
+
font: 600 10px/1.2 var(--mono);
|
|
532
|
+
letter-spacing: 0.06em;
|
|
533
|
+
text-transform: uppercase;
|
|
534
|
+
color: var(--stone);
|
|
535
|
+
}
|
|
536
|
+
.nav-ex-count,
|
|
537
|
+
.nav-ex-total,
|
|
538
|
+
.dd-count {
|
|
539
|
+
flex: none;
|
|
540
|
+
min-width: 16px;
|
|
541
|
+
padding: 1px 6px;
|
|
542
|
+
border-radius: 9999px;
|
|
543
|
+
background: var(--inset);
|
|
544
|
+
color: var(--charcoal);
|
|
545
|
+
font: 600 10px/1.4 var(--mono);
|
|
546
|
+
letter-spacing: 0;
|
|
547
|
+
text-transform: none;
|
|
548
|
+
text-align: center;
|
|
549
|
+
}
|
|
550
|
+
.nav-ex-total {
|
|
551
|
+
margin-right: 2px;
|
|
552
|
+
background: var(--white);
|
|
553
|
+
box-shadow: var(--ghost);
|
|
554
|
+
}
|
|
524
555
|
.nav-example {
|
|
525
556
|
display: block;
|
|
526
557
|
width: 100%;
|
|
@@ -738,7 +769,17 @@
|
|
|
738
769
|
font-size: 14px;
|
|
739
770
|
line-height: 1.4;
|
|
740
771
|
position: relative;
|
|
772
|
+
display: flex;
|
|
773
|
+
align-items: center;
|
|
774
|
+
gap: 8px;
|
|
741
775
|
}
|
|
776
|
+
.dd-toggle .dd-toggle-label {
|
|
777
|
+
min-width: 0;
|
|
778
|
+
overflow: hidden;
|
|
779
|
+
text-overflow: ellipsis;
|
|
780
|
+
white-space: nowrap;
|
|
781
|
+
}
|
|
782
|
+
.dd-toggle .dd-count { margin-left: auto; margin-right: 4px; }
|
|
742
783
|
.dd-toggle::after {
|
|
743
784
|
content: "";
|
|
744
785
|
position: absolute;
|
|
@@ -767,6 +808,10 @@
|
|
|
767
808
|
}
|
|
768
809
|
.dd.open .dd-menu { display: block; }
|
|
769
810
|
.dd-group {
|
|
811
|
+
display: flex;
|
|
812
|
+
align-items: center;
|
|
813
|
+
justify-content: space-between;
|
|
814
|
+
gap: 8px;
|
|
770
815
|
font-family: var(--mono);
|
|
771
816
|
font-size: 11px;
|
|
772
817
|
letter-spacing: 0.08em;
|
|
@@ -774,6 +819,9 @@
|
|
|
774
819
|
color: var(--stone);
|
|
775
820
|
padding: 10px 12px 6px;
|
|
776
821
|
}
|
|
822
|
+
.dd-group .dd-count {
|
|
823
|
+
background: var(--paper, var(--inset));
|
|
824
|
+
}
|
|
777
825
|
.dd-item {
|
|
778
826
|
display: block;
|
|
779
827
|
width: 100%;
|
|
@@ -2597,22 +2645,36 @@
|
|
|
2597
2645
|
return { status: response.status, body: parsed, ok: response.ok };
|
|
2598
2646
|
};
|
|
2599
2647
|
|
|
2600
|
-
const
|
|
2648
|
+
const groupScenarios = (scenarios) => {
|
|
2601
2649
|
const groups = {};
|
|
2602
|
-
scenarios.forEach((scenario, index) => {
|
|
2603
|
-
|
|
2650
|
+
(scenarios || []).forEach((scenario, index) => {
|
|
2651
|
+
const group = scenario.group || "Other";
|
|
2652
|
+
(groups[group] ||= []).push({ scenario, index });
|
|
2604
2653
|
});
|
|
2605
|
-
const order = GROUP_ORDER.filter((name) => groups[name]).concat(
|
|
2654
|
+
const order = GROUP_ORDER.filter((name) => groups[name]).concat(
|
|
2655
|
+
Object.keys(groups).filter((name) => !GROUP_ORDER.includes(name)),
|
|
2656
|
+
);
|
|
2657
|
+
return { groups, order };
|
|
2658
|
+
};
|
|
2659
|
+
|
|
2660
|
+
const groupedDropdown = (scenarios, selected) => {
|
|
2661
|
+
const { groups, order } = groupScenarios(scenarios);
|
|
2606
2662
|
const current = scenarios[selected];
|
|
2607
|
-
const
|
|
2663
|
+
const total = scenarios.length;
|
|
2664
|
+
const label = current
|
|
2665
|
+
? current.group + " · " + current.name
|
|
2666
|
+
: "Recorded call";
|
|
2608
2667
|
return `<div class="dd" id="scenario-dd">
|
|
2609
|
-
<button type="button" class="dd-toggle" id="scenario-toggle">${label}</button>
|
|
2668
|
+
<button type="button" class="dd-toggle" id="scenario-toggle"><span class="dd-toggle-label">${escapeHtml(label)}</span><span class="dd-count" title="Total examples">${total}</span></button>
|
|
2610
2669
|
<div class="dd-menu">${order
|
|
2611
2670
|
.map(
|
|
2612
2671
|
(group) =>
|
|
2613
|
-
`<div class="dd-group">${group}</div>` +
|
|
2672
|
+
`<div class="dd-group"><span>${escapeHtml(group)}</span><span class="dd-count">${groups[group].length}</span></div>` +
|
|
2614
2673
|
groups[group]
|
|
2615
|
-
.map(
|
|
2674
|
+
.map(
|
|
2675
|
+
({ scenario, index }) =>
|
|
2676
|
+
`<button type="button" class="dd-item ${index === selected ? "on" : ""}" data-index="${index}">${escapeHtml(String(scenario.status))} — ${escapeHtml(scenario.name)}</button>`,
|
|
2677
|
+
)
|
|
2616
2678
|
.join(""),
|
|
2617
2679
|
)
|
|
2618
2680
|
.join("")}</div>
|
|
@@ -2633,6 +2695,23 @@
|
|
|
2633
2695
|
return status ? status + " — " + name : name;
|
|
2634
2696
|
};
|
|
2635
2697
|
|
|
2698
|
+
const renderNavExamples = (item) => {
|
|
2699
|
+
const { groups, order } = groupScenarios(item.scenarios);
|
|
2700
|
+
return `<div class="nav-examples">${order
|
|
2701
|
+
.map(
|
|
2702
|
+
(group) => `<div class="nav-ex-group">
|
|
2703
|
+
<div class="nav-ex-group-label"><span>${escapeHtml(group)}</span><span class="nav-ex-count">${groups[group].length}</span></div>
|
|
2704
|
+
${groups[group]
|
|
2705
|
+
.map(
|
|
2706
|
+
({ scenario, index }) =>
|
|
2707
|
+
`<button type="button" class="nav-example ${item.id === currentId && index === scenarioIndex ? "on" : ""}" data-id="${escapeAttr(item.id)}" data-scenario="${index}" title="${escapeAttr(scenarioNavLabel(scenario))}">${escapeHtml(scenarioNavLabel(scenario))}</button>`,
|
|
2708
|
+
)
|
|
2709
|
+
.join("")}
|
|
2710
|
+
</div>`,
|
|
2711
|
+
)
|
|
2712
|
+
.join("")}</div>`;
|
|
2713
|
+
};
|
|
2714
|
+
|
|
2636
2715
|
const kv = (label, value) => {
|
|
2637
2716
|
if (value === undefined || value === "") return "";
|
|
2638
2717
|
const shown = typeof value === "object" ? JSON.stringify(value) : String(value);
|
|
@@ -2686,20 +2765,15 @@
|
|
|
2686
2765
|
.map((item) => {
|
|
2687
2766
|
const hasExamples = Array.isArray(item.scenarios) && item.scenarios.length > 0;
|
|
2688
2767
|
const examplesOpen = expandedExampleOps.has(item.id);
|
|
2689
|
-
const examplesHtml = hasExamples
|
|
2690
|
-
|
|
2691
|
-
.map(
|
|
2692
|
-
(scenario, index) =>
|
|
2693
|
-
`<button type="button" class="nav-example ${item.id === currentId && index === scenarioIndex ? "on" : ""}" data-id="${escapeAttr(item.id)}" data-scenario="${index}" title="${escapeAttr(scenarioNavLabel(scenario))}">${escapeAttr(scenarioNavLabel(scenario))}</button>`,
|
|
2694
|
-
)
|
|
2695
|
-
.join("")}</div>`
|
|
2696
|
-
: "";
|
|
2768
|
+
const examplesHtml = hasExamples ? renderNavExamples(item) : "";
|
|
2769
|
+
const exampleCount = hasExamples ? item.scenarios.length : 0;
|
|
2697
2770
|
return `<div class="nav-op ${item.id === currentId ? "active" : ""} ${examplesOpen ? "examples-open" : ""}" data-op-id="${escapeAttr(item.id)}">
|
|
2698
2771
|
<div class="nav-op-row">
|
|
2699
2772
|
<button type="button" class="nav-item" data-id="${escapeAttr(item.id)}" title="${escapeAttr(item.path)}">
|
|
2700
2773
|
<span class="method ${item.method}">${item.method}</span>
|
|
2701
2774
|
<span class="nav-title">${escapeAttr(item.title)}</span>
|
|
2702
2775
|
</button>
|
|
2776
|
+
${hasExamples ? `<span class="nav-ex-total" title="${exampleCount} examples">${exampleCount}</span>` : ""}
|
|
2703
2777
|
<button type="button" class="nav-expand" data-expand-id="${escapeAttr(item.id)}" title="Examples" aria-label="Toggle examples" aria-expanded="${examplesOpen ? "true" : "false"}" ${hasExamples ? "" : "disabled"}>
|
|
2704
2778
|
<span class="chev"></span>
|
|
2705
2779
|
</button>
|