@kitlangton/knobs 0.4.0-next.1 → 0.4.0-next.3
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 +78 -8
- package/dist/dev/{chunk-ayb292zj.js → chunk-j6zmtens.js} +1 -1
- package/dist/dev/{chunk-1qzffbpa.js → chunk-zwj6yngd.js} +66 -33
- package/dist/dev/index.js +3 -3
- package/dist/panel.js +66 -33
- package/dist/types/ui/compare-css.d.ts +1 -1
- package/dist/types/ui/compare-gpu.d.ts +0 -5
- package/dist/types/ui/compare-model.d.ts +31 -2
- package/dist/types/ui/compare.d.ts +17 -4
- package/dist/types/ui/icons.d.ts +40 -0
- package/dist/types/ui/index.d.ts +6 -4
- package/dist/types/ui/selection-pill-css.d.ts +1 -0
- package/dist/types/ui/selection-pill.d.ts +103 -0
- package/dist/types/ui/timeline-model.d.ts +23 -0
- package/dist/types/ui/timeline.d.ts +11 -1
- package/dist/types/ui/tree.d.ts +3 -2
- package/dist/types/ui/walkthrough-blocks.d.ts +43 -0
- package/dist/types/ui/walkthrough-media.d.ts +4 -0
- package/dist/types/ui/walkthrough-model.d.ts +237 -3
- package/dist/types/ui/walkthrough.d.ts +3 -1
- package/dist/ui-react.js +1544 -360
- package/dist/ui-solid.js +1544 -360
- package/dist/ui.js +1565 -360
- package/package.json +1 -1
package/dist/ui-react.js
CHANGED
|
@@ -571,12 +571,20 @@ var compareCss = `
|
|
|
571
571
|
display:flex;flex-direction:column;gap:6px;width:100%;height:100%;min-height:160px;outline:none;user-select:none;-webkit-user-select:none;
|
|
572
572
|
font:var(--_k-weight) var(--_k-font-size)/1.35 var(--_k-font);color:var(--_k-fg);letter-spacing:normal;text-align:left}
|
|
573
573
|
:where(.knobs-ui) :is(.knobs-cmp-mode,.knobs-cmp-toggle){all:revert;box-sizing:border-box;font:inherit;color:inherit;letter-spacing:inherit;background:transparent;border:0;margin:0;padding:0;outline:none;box-shadow:none}
|
|
574
|
-
.knobs-cmp-bar{flex:none;display:flex;align-items:center;gap:
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
.knobs-
|
|
579
|
-
.knobs-ui .knobs-cmp-mode
|
|
574
|
+
.knobs-cmp-bar{flex:none;display:flex;align-items:center;gap:var(--_k-gap);height:var(--_k-control-h)}
|
|
575
|
+
/* The modes: one fill, the selection pill on the one picked; a mode isn't brighter for being
|
|
576
|
+
picked: the pill's bright copy is. */
|
|
577
|
+
.knobs-cmp-modes{position:relative;display:inline-flex;height:var(--_k-control-h);border-radius:var(--_k-radius);background:var(--_k-fill)}
|
|
578
|
+
.knobs-cmp-modes[hidden]{display:none}
|
|
579
|
+
.knobs-ui .knobs-cmp-mode{display:inline-flex;align-items:center;height:100%;padding:0 8px;border-radius:var(--_k-radius);color:var(--_k-fg-2);cursor:pointer;white-space:nowrap;
|
|
580
|
+
transition:color calc(var(--_k-hover-out) * 1ms)}
|
|
581
|
+
.knobs-ui .knobs-cmp-mode:is(:hover,:focus-visible){color:var(--_k-fg)}
|
|
582
|
+
/* Toggles: icon buttons, the accent's wash when on. */
|
|
583
|
+
.knobs-ui .knobs-cmp-toggle{display:inline-flex;align-items:center;justify-content:center;width:var(--_k-control-h);height:var(--_k-control-h);border-radius:var(--_k-radius);color:var(--_k-fg-3);cursor:pointer;
|
|
584
|
+
transition:color calc(var(--_k-hover-out) * 1ms),background calc(var(--_k-hover-out) * 1ms)}
|
|
585
|
+
.knobs-ui .knobs-cmp-toggle:is(:hover,:focus-visible){color:var(--_k-fg);background:var(--_ku-wash)}
|
|
586
|
+
.knobs-ui .knobs-cmp-toggle[aria-pressed="true"]{color:var(--_k-accent-fg);background:var(--_k-accent-soft)}
|
|
587
|
+
.knobs-cmp-toggle svg{display:block}
|
|
580
588
|
.knobs-cmp-fill{flex:1}
|
|
581
589
|
.knobs-cmp-toggle[hidden]{display:none}
|
|
582
590
|
/* One surface: on a card (a walkthrough's step, a split's pane, anything .knobs-surface) or marked
|
|
@@ -591,7 +599,8 @@ var compareCss = `
|
|
|
591
599
|
/* Unzoomed, a finger still scrolls the page up and down; zoomed, the stage takes every gesture. */
|
|
592
600
|
.knobs-compare[data-zoomed] .knobs-cmp-stage{cursor:grab;touch-action:none}
|
|
593
601
|
.knobs-compare[data-panning],.knobs-compare[data-panning] *{cursor:grabbing!important}
|
|
594
|
-
.
|
|
602
|
+
/* Wiping, the grip stands in for the cursor. */
|
|
603
|
+
.knobs-compare[data-dragging],.knobs-compare[data-dragging] *{cursor:none!important}
|
|
595
604
|
.knobs-cmp-sizer{position:absolute;left:0;right:0;top:0;height:0;visibility:hidden;pointer-events:none}
|
|
596
605
|
.knobs-cmp-canvas{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none}
|
|
597
606
|
.knobs-cmp-media{position:absolute;left:0;top:0;display:block;max-width:none;margin:0;padding:0;border:0;object-fit:fill;transform-origin:0 0;pointer-events:none;will-change:transform}
|
|
@@ -599,18 +608,21 @@ var compareCss = `
|
|
|
599
608
|
/* Glass: what's behind shows through, blurred, on the knobs tokens. */
|
|
600
609
|
.knobs-cmp-label,.knobs-cmp-zoom{background:color-mix(in srgb,var(--_k-bg) 52%,transparent);-webkit-backdrop-filter:blur(14px) saturate(1.6);backdrop-filter:blur(14px) saturate(1.6);
|
|
601
610
|
box-shadow:inset 0 0 0 .5px var(--_k-border),inset 0 1px 0 var(--_k-rim),0 2px 10px rgba(0,0,0,calc(.18 * var(--_k-shadow-k,1)))}
|
|
602
|
-
.knobs-cmp-label{position:absolute;left:0;top:0;padding:1px 7px;border-radius:999px;font-size:var(--_k-text-meta);line-height:16px;color:var(--_k-fg-2);white-space:nowrap;pointer-events:none;will-change:transform;transition:color
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
/* The wipe: a hairline down the line with a grip at its middle; a wider strip takes the hand and
|
|
606
|
-
the keys (a slider). It fades with the mode. */
|
|
611
|
+
.knobs-cmp-label{position:absolute;left:0;top:0;padding:1px 7px;border-radius:999px;font-size:var(--_k-text-meta);line-height:16px;color:var(--_k-fg-2);white-space:nowrap;pointer-events:none;will-change:transform;transition:color calc(var(--_k-hover-out) * 1ms)}
|
|
612
|
+
/* The wipe: a hairline down the line with a raised grip at the pointer's height; a wider strip
|
|
613
|
+
takes the hand and the keys (a slider). It fades with the mode; wiping, line and grip brighten. */
|
|
607
614
|
.knobs-cmp-handle{cursor:ew-resize;position:absolute;left:-12px;top:0;width:24px;height:0;opacity:0;pointer-events:none;outline:none;will-change:transform;transition:opacity .18s cubic-bezier(.4,0,1,1)}
|
|
608
615
|
.knobs-cmp-handle[data-on]{opacity:1;pointer-events:auto;transition:opacity .22s cubic-bezier(.2,.8,.2,1)}
|
|
609
|
-
.knobs-cmp-handle::before{content:"";position:absolute;top:0;bottom:0;left:11.5px;width:1px;background:var(--_ku-cmp-line);box-shadow:0 0 0 .5px rgba(0,0,0,.28),0 0 6px rgba(0,0,0,.25)}
|
|
610
|
-
.knobs-cmp-handle::
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
.knobs-cmp-
|
|
616
|
+
.knobs-cmp-handle::before{content:"";position:absolute;top:0;bottom:0;left:11.5px;width:1px;background:color-mix(in srgb,var(--_ku-cmp-line) 72%,transparent);box-shadow:0 0 0 .5px rgba(0,0,0,.28),0 0 6px rgba(0,0,0,.25)}
|
|
617
|
+
.knobs-compare[data-dragging] .knobs-cmp-handle::before{background:var(--_ku-cmp-line)}
|
|
618
|
+
.knobs-cmp-grip{position:absolute;top:0;left:4px;width:16px;height:28px;border-radius:min(8px,calc(var(--_k-radius) * 999));background:var(--_k-bg-overlay);
|
|
619
|
+
box-shadow:var(--_k-shadow-overlay),inset 0 0 0 1px var(--_k-border),inset 0 1px 0 var(--_k-rim);will-change:transform;transition:box-shadow calc(var(--_k-hover-out) * 1ms)}
|
|
620
|
+
.knobs-cmp-grip::before,.knobs-cmp-grip::after{content:"";position:absolute;top:10px;width:1px;height:8px;background:var(--_k-fg-3);transition:background calc(var(--_k-hover-out) * 1ms)}
|
|
621
|
+
.knobs-cmp-grip::before{left:6px}
|
|
622
|
+
.knobs-cmp-grip::after{left:9px}
|
|
623
|
+
.knobs-compare[data-dragging] .knobs-cmp-grip{box-shadow:var(--_k-shadow-overlay),inset 0 0 0 1px var(--_k-border-strong),inset 0 1px 0 var(--_k-rim)}
|
|
624
|
+
.knobs-compare[data-dragging] .knobs-cmp-grip::before,.knobs-compare[data-dragging] .knobs-cmp-grip::after{background:var(--_k-fg)}
|
|
625
|
+
.knobs-cmp-handle:focus-visible .knobs-cmp-grip,.knobs-compare[data-keyboard] .knobs-cmp-handle:focus .knobs-cmp-grip{box-shadow:var(--_k-shadow-overlay),0 0 0 2px var(--_k-accent)}
|
|
614
626
|
/* The split's hairline, down the middle side by side. */
|
|
615
627
|
.knobs-cmp-split{position:absolute;left:0;top:0;width:1px;height:0;margin-left:-.5px;background:color-mix(in srgb,var(--_k-bg) 72%,transparent);pointer-events:none;will-change:transform,opacity}
|
|
616
628
|
/* Zoomed: how far, and a way back, in the stage's corner; it fades in and out, nothing shifts. */
|
|
@@ -619,12 +631,12 @@ var compareCss = `
|
|
|
619
631
|
opacity:0;scale:.96;pointer-events:none;transition:opacity .16s cubic-bezier(.4,0,1,1),scale .16s cubic-bezier(.4,0,1,1)}
|
|
620
632
|
.knobs-cmp-zoom[data-on]{opacity:1;scale:1;pointer-events:auto;transition:opacity .2s cubic-bezier(.2,.8,.2,1),scale .2s cubic-bezier(.2,.8,.2,1)}
|
|
621
633
|
:where(.knobs-ui) .knobs-cmp-zoom-reset{all:revert;box-sizing:border-box;font:inherit;letter-spacing:inherit;margin:0;border:0;outline:none;box-shadow:none;
|
|
622
|
-
height:20px;padding:0
|
|
634
|
+
display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border-radius:999px;background:transparent;color:var(--_k-fg-2);cursor:pointer;transition:color .15s,background .15s}
|
|
623
635
|
:where(.knobs-ui) .knobs-cmp-zoom-reset:is(:hover,:focus-visible){color:var(--_k-fg);background:color-mix(in srgb,var(--_k-fg) 12%,transparent)}
|
|
624
636
|
.knobs-cmp-note{position:absolute;left:50%;top:50%;translate:-50% -50%;color:var(--_k-fg-3);font-size:var(--_k-text-meta);pointer-events:none}
|
|
625
637
|
.knobs-cmp-note:empty{display:none}
|
|
626
638
|
.knobs-cmp-strip-host{flex:none;height:60px;min-height:0}
|
|
627
|
-
.knobs-cmp-timeline-host{flex:none;
|
|
639
|
+
.knobs-cmp-timeline-host{flex:none;min-height:0}
|
|
628
640
|
/* The frame strip: Before over After per column, a difference bar under them, a dot where it peaks. */
|
|
629
641
|
.knobs-ui.knobs-cmp-strip{--_ku-cmp-diff:var(--k-compare-diff,var(--_k-ok));position:relative;width:100%;height:100%;min-height:40px;overflow:hidden;cursor:col-resize;touch-action:none;
|
|
630
642
|
font:var(--_k-weight) var(--_k-font-size)/1.35 var(--_k-font);color:var(--_k-fg)}
|
|
@@ -767,7 +779,7 @@ var init_picker_css = __esm(() => {
|
|
|
767
779
|
.knobs-picker-suggested{flex:none;color:var(--_k-fg-3);font-size:var(--_k-text-meta)}
|
|
768
780
|
.knobs-picker-check{flex:none;display:flex;width:14px;height:14px;color:var(--_k-accent);opacity:0;scale:.6;filter:blur(2px);
|
|
769
781
|
transition:opacity .11s ease-in,scale .11s ease-in,filter .11s ease-in}
|
|
770
|
-
.knobs-picker-check svg{display:block;width:
|
|
782
|
+
.knobs-picker-check svg{display:block;width:12px;height:12px}
|
|
771
783
|
.knobs-picker-option[data-chosen] .knobs-picker-check{opacity:1;scale:1;filter:none;transition:opacity .15s ease-out,scale var(--kp-snappy-ms) var(--kp-snappy),filter .15s ease-out}
|
|
772
784
|
.knobs-picker-body{position:relative;overflow:visible}
|
|
773
785
|
.knobs-picker-body[data-moving]{overflow:hidden}
|
|
@@ -871,6 +883,15 @@ var readoutCss = `
|
|
|
871
883
|
@media(prefers-reduced-motion:reduce){.knobs-rd :where(*){transition:none!important}}
|
|
872
884
|
`;
|
|
873
885
|
|
|
886
|
+
// src/ui/selection-pill-css.ts
|
|
887
|
+
var selectionPillCss = `
|
|
888
|
+
.knobs-pick-pill,.knobs-pick-copy{position:absolute;left:0;top:0;width:0;height:0;pointer-events:none;transition:opacity .1s linear}
|
|
889
|
+
.knobs-pick-pill{background:var(--_k-fill-selected);will-change:transform}
|
|
890
|
+
.knobs-pick-copy{overflow:hidden;will-change:transform}
|
|
891
|
+
.knobs-pick-copy-rows{position:absolute;left:0;top:0;width:0;height:0}
|
|
892
|
+
:is(.knobs-pick-pill,.knobs-pick-copy)[data-off]{opacity:0}
|
|
893
|
+
`;
|
|
894
|
+
|
|
874
895
|
// src/tokens/color.ts
|
|
875
896
|
function linearToOklch([r, g, b, a]) {
|
|
876
897
|
const l = Math.cbrt(0.4122214708 * r + 0.5363325363 * g + 0.0514459929 * b);
|
|
@@ -2719,11 +2740,9 @@ var css2 = `
|
|
|
2719
2740
|
.knobs-tree:focus .knobs-tree-row[data-active][aria-selected="true"]::before{background:var(--_ku-select-focus)}
|
|
2720
2741
|
.knobs-tree-row[data-drop="into"]::before{opacity:1;background:color-mix(in srgb,var(--_k-accent) 30%,transparent)}
|
|
2721
2742
|
.knobs-tree-row[data-dragged]{opacity:.38}
|
|
2722
|
-
/* glide:
|
|
2723
|
-
.knobs-tree-
|
|
2724
|
-
|
|
2725
|
-
.knobs-tree-cursor[data-on]{opacity:1}
|
|
2726
|
-
.knobs-tree:focus .knobs-tree-cursor{background:var(--_ku-select-focus)}
|
|
2743
|
+
/* glide: the selection pill on the selected row, in the selection's colour (the row's own stays off). */
|
|
2744
|
+
.knobs-tree>.knobs-pick-pill{background:var(--_ku-select)}
|
|
2745
|
+
.knobs-tree:focus>.knobs-pick-pill{background:var(--_ku-select-focus)}
|
|
2727
2746
|
.knobs-tree[data-glide] .knobs-tree-row[aria-selected="true"]::before{opacity:0!important}
|
|
2728
2747
|
.knobs-tree-row>*{position:relative}
|
|
2729
2748
|
.knobs-tree-caret{flex:none;display:flex;align-items:center;justify-content:center;width:16px;height:100%;color:var(--_k-fg-3);transition:transform var(--_ku-ease-ms) var(--_ku-ease)}
|
|
@@ -2755,22 +2774,20 @@ var css2 = `
|
|
|
2755
2774
|
box-shadow:0 0 0 1px var(--_k-border-strong),0 6px 18px rgba(0,0,0,calc(.35 * var(--_k-shadow-k,1)));pointer-events:none;white-space:nowrap;font:var(--_k-weight) var(--_k-font-size)/1.6 var(--_k-font)}
|
|
2756
2775
|
.knobs-tree-empty{padding:10px var(--_k-inset);color:var(--_k-fg-3)}
|
|
2757
2776
|
|
|
2758
|
-
/* Timeline:
|
|
2759
|
-
|
|
2777
|
+
/* Timeline: play beside a track: the ruler's canvas over a lane of markers, ranges as soft bands,
|
|
2778
|
+
and the playhead, a hairline in the accent with a cap. No clock: the time shows under the
|
|
2779
|
+
pointer on the track (the tag), in seconds, while hovering or scrubbing. */
|
|
2760
2780
|
:where(.knobs-timeline,.knobs-timeline *){box-sizing:border-box}
|
|
2761
2781
|
.knobs-ui.knobs-timeline{display:flex;align-items:stretch;gap:10px;width:100%;height:100%;min-height:52px;padding:6px var(--_k-inset) 8px 8px;outline:none;user-select:none;-webkit-user-select:none;
|
|
2762
2782
|
font:var(--_k-weight) var(--_k-font-size)/1.35 var(--_k-font);color:var(--_k-fg);letter-spacing:normal;text-align:left}
|
|
2763
2783
|
:where(.knobs-ui) :is(.knobs-tl-play,.knobs-tl-edit){all:revert;box-sizing:border-box;font:inherit;color:inherit;letter-spacing:inherit;background:transparent;border:0;margin:0;padding:0;outline:none;box-shadow:none}
|
|
2764
|
-
.knobs-tl-transport{flex:none;display:flex;align-items:center
|
|
2784
|
+
.knobs-tl-transport{flex:none;display:flex;align-items:center}
|
|
2765
2785
|
.knobs-ui .knobs-tl-play{flex:none;display:inline-flex;align-items:center;justify-content:center;width:var(--_k-control-h);height:var(--_k-control-h);min-width:22px;min-height:22px;border-radius:calc(var(--_k-radius) * 999);
|
|
2766
2786
|
background:var(--_k-fill-selected);color:var(--_k-fg);cursor:pointer;transition:background .15s,transform .15s var(--_ku-ease)}
|
|
2767
2787
|
.knobs-ui .knobs-tl-play:hover{background:color-mix(in srgb,var(--_k-fg) 16%,transparent)}
|
|
2768
2788
|
.knobs-ui .knobs-tl-play:active{transform:scale(.94)}
|
|
2769
2789
|
.knobs-tl-play svg{width:12px;height:12px}
|
|
2770
2790
|
.knobs-timeline[data-playing] .knobs-tl-play{background:var(--_k-accent);color:var(--_k-bg)}
|
|
2771
|
-
.knobs-tl-time{display:flex;flex-direction:column;line-height:1.2;font-variant-numeric:tabular-nums;font-feature-settings:"tnum"}
|
|
2772
|
-
.knobs-tl-now{font:var(--_k-weight) var(--_k-value-size)/1.2 var(--_k-value-font);font-variant-numeric:tabular-nums;font-feature-settings:"tnum";color:var(--_k-fg);white-space:nowrap}
|
|
2773
|
-
.knobs-tl-sub{font-size:var(--_k-text-meta);color:var(--_k-fg-3);white-space:nowrap}
|
|
2774
2791
|
.knobs-tl-track{position:relative;flex:1;min-width:0;overflow:hidden;border-radius:var(--_k-radius);background:var(--_k-fill);cursor:col-resize;touch-action:none;
|
|
2775
2792
|
transition:background calc(var(--_k-hover-out) * 1ms)}
|
|
2776
2793
|
.knobs-timeline:focus-visible .knobs-tl-track,.knobs-timeline[data-keyboard]:focus .knobs-tl-track{background:color-mix(in srgb,var(--_k-fill-selected) 80%,transparent)}
|
|
@@ -2794,7 +2811,8 @@ var css2 = `
|
|
|
2794
2811
|
.knobs-tl-pin{position:absolute;top:13px;left:-5px;width:10px;height:10px;pointer-events:auto;cursor:grab}
|
|
2795
2812
|
.knobs-tl-pin::after{content:"";position:absolute;inset:1.5px;border-radius:min(2px,var(--_k-radius));background:var(--knobs-tl-c);rotate:45deg;transition:background .15s,scale .2s var(--_ku-ease)}
|
|
2796
2813
|
.knobs-tl-mlabel{position:absolute;top:26px;left:3px;max-width:140px;padding:0 6px;border-radius:max(0px,calc(var(--_k-radius) - 3px));background:var(--_k-fill-selected);color:var(--_k-fg);
|
|
2797
|
-
font-size:var(--_k-text-meta);line-height:17px;white-space:nowrap;
|
|
2814
|
+
font-size:var(--_k-text-meta);line-height:17px;white-space:nowrap;pointer-events:auto;cursor:grab;transition:background .15s,color .15s}
|
|
2815
|
+
.knobs-tl-mtext{display:block;overflow:hidden;white-space:nowrap}
|
|
2798
2816
|
.knobs-tl-marker[data-selected]{--knobs-tl-c:var(--_k-accent)}
|
|
2799
2817
|
.knobs-tl-marker[data-selected] .knobs-tl-mlabel{background:color-mix(in srgb,var(--_k-accent) 24%,var(--_k-fill-selected))}
|
|
2800
2818
|
.knobs-tl-marker[data-selected] .knobs-tl-pin::after{scale:1.2}
|
|
@@ -2815,7 +2833,22 @@ var css2 = `
|
|
|
2815
2833
|
.knobs-timeline[data-scrubbing] .knobs-tl-hover{opacity:0}
|
|
2816
2834
|
@media(prefers-reduced-motion:reduce){.knobs-timeline :where(*,::before,::after){transition:none!important}}
|
|
2817
2835
|
@media(prefers-reduced-motion:reduce){:is(.knobs-tree,.knobs-split>.knobs-divider,.knobs-pane-head,.knobs-pane-rail) :where(*,::before,::after){transition:none!important}}
|
|
2818
|
-
|
|
2836
|
+
.knobs-tl-tag{position:absolute;left:0;bottom:2px;font-size:var(--_k-text-meta);line-height:16px;color:var(--_k-fg);font-variant-numeric:tabular-nums;font-feature-settings:"tnum";white-space:nowrap;pointer-events:none;opacity:0}
|
|
2837
|
+
.knobs-tl-tag[data-on]{opacity:1}
|
|
2838
|
+
/* The lane (variant: "lane"): one slim track of ticks under a compare or a video; markers are
|
|
2839
|
+
faint chapter ticks, the current one in text colour; nothing to edit. */
|
|
2840
|
+
.knobs-ui.knobs-timeline[data-variant="lane"]{height:auto;min-height:0;padding:0;gap:var(--_k-gap)}
|
|
2841
|
+
.knobs-timeline[data-variant="lane"] .knobs-tl-track{height:var(--_k-control-h)}
|
|
2842
|
+
.knobs-timeline[data-variant="lane"] .knobs-tl-ruler{height:100%}
|
|
2843
|
+
.knobs-timeline[data-variant="lane"] .knobs-tl-lane{top:0}
|
|
2844
|
+
.knobs-timeline[data-variant="lane"] .knobs-tl-marker{top:0}
|
|
2845
|
+
.knobs-timeline[data-variant="lane"] .knobs-tl-marker::before{top:0;bottom:50%;left:-.75px;width:1.5px;background:var(--_k-fg-3)}
|
|
2846
|
+
.knobs-timeline[data-variant="lane"] .knobs-tl-marker[data-current]::before{background:var(--_k-fg)}
|
|
2847
|
+
.knobs-timeline[data-variant="lane"] :is(.knobs-tl-pin,.knobs-tl-mlabel,.knobs-tl-rlabel){display:none}
|
|
2848
|
+
.knobs-timeline[data-variant="lane"] .knobs-tl-head::before{top:0}
|
|
2849
|
+
.knobs-timeline[data-variant="lane"] .knobs-tl-head::after{content:none}
|
|
2850
|
+
.knobs-timeline[data-variant="lane"] .knobs-tl-tag{top:2px;bottom:auto}
|
|
2851
|
+
`, uiCss = () => aliased(css2 + readoutCss + overlayCss + bentoCss + activityCss + pickerCss + compareCss + selectionPillCss) + rolling_css_default, lookDefaults, tune = (s, m) => {
|
|
2819
2852
|
s.omega = m.omega;
|
|
2820
2853
|
s.zeta = m.zeta;
|
|
2821
2854
|
return s;
|
|
@@ -2973,33 +3006,29 @@ var init_diff_css = __esm(() => {
|
|
|
2973
3006
|
.knobs-diff-fill{flex:1}
|
|
2974
3007
|
.knobs-diff-nav{flex:none;display:inline-flex;align-items:center;gap:1px;color:var(--_k-fg-3);font-size:var(--_k-text-meta);font-variant-numeric:tabular-nums}
|
|
2975
3008
|
.knobs-diff-nav>span{min-width:3.6em;text-align:center}
|
|
2976
|
-
:where(.knobs-ui) :is(.knobs-diff-btn,.knobs-diff-
|
|
3009
|
+
:where(.knobs-ui) :is(.knobs-diff-btn,.knobs-diff-choice,.knobs-diff-viewed,.knobs-diff-filter>input,.knobs-diff-filter>button){all:revert;box-sizing:border-box;font:inherit;color:inherit;letter-spacing:inherit;background:transparent;border:0;border-radius:0;
|
|
2977
3010
|
margin:0;padding:0;min-width:0;box-shadow:none;outline:none}
|
|
2978
|
-
.knobs-ui .knobs-diff-btn{flex:none;display:inline-flex;align-items:center;justify-content:center;width:
|
|
3011
|
+
.knobs-ui .knobs-diff-btn{flex:none;display:inline-flex;align-items:center;justify-content:center;width:var(--_k-control-h);height:var(--_k-control-h);border-radius:calc(var(--_k-radius) * 999);color:var(--_k-fg-3);cursor:pointer;
|
|
2979
3012
|
transition:background .15s,color .15s,opacity .15s}
|
|
2980
3013
|
.knobs-ui .knobs-diff-btn:is(:hover,:focus-visible){background:var(--_ku-wash-hi);color:var(--_k-fg)}
|
|
2981
3014
|
.knobs-ui .knobs-diff-btn[aria-pressed="true"]{color:var(--_k-fg);background:var(--_ku-wash)}
|
|
2982
3015
|
.knobs-ui .knobs-diff-btn:disabled{opacity:.35;cursor:default;background:transparent}
|
|
2983
|
-
.knobs-diff-btn svg{width:
|
|
3016
|
+
.knobs-diff-btn svg{width:16px;height:16px}
|
|
2984
3017
|
/* Viewed: a check with its word, as on GitHub; the path dims once it's ticked. */
|
|
2985
3018
|
.knobs-ui .knobs-diff-viewed{flex:none;display:inline-flex;align-items:center;gap:5px;height:var(--_k-control-h);padding:0 8px 0 6px;border-radius:var(--kd-ctl);color:var(--_k-fg-2);
|
|
2986
3019
|
font-size:var(--_k-text-meta);font-weight:var(--_k-weight-label);white-space:nowrap;cursor:pointer;transition:background .15s,color .15s}
|
|
2987
3020
|
.knobs-ui .knobs-diff-viewed:is(:hover,:focus-visible){background:var(--_ku-wash-hi);color:var(--_k-fg)}
|
|
2988
3021
|
.knobs-ui .knobs-diff-viewed[aria-pressed="true"]{color:var(--_k-fg);background:var(--_ku-wash)}
|
|
2989
|
-
.knobs-diff-viewed svg{width:
|
|
3022
|
+
.knobs-diff-viewed svg{width:16px;height:16px}
|
|
2990
3023
|
.knobs-diff-viewed[aria-pressed="true"] svg{color:var(--kd-add)}
|
|
2991
3024
|
.knobs-diff-path{transition:opacity .2s}
|
|
2992
3025
|
.knobs-diff[data-viewed]>.knobs-diff-head .knobs-diff-path,.knobs-diff-part[data-viewed] .knobs-diff-path{opacity:.6}
|
|
2993
|
-
/* Split | Unified:
|
|
2994
|
-
|
|
2995
|
-
.knobs-diff-seg{position:relative;flex:none;display:grid;grid-template-columns:1fr 1fr;height:var(--_k-control-h);padding:2px;border-radius:var(--kd-ctl);background:var(--_k-
|
|
2996
|
-
.knobs-ui .knobs-diff-
|
|
2997
|
-
font-weight:var(--_k-weight-label);white-space:nowrap;cursor:pointer;transition:color
|
|
2998
|
-
.knobs-ui .knobs-diff-
|
|
2999
|
-
.knobs-diff-pill{position:absolute;top:2px;bottom:2px;left:2px;width:calc(50% - 2px);border-radius:max(0px,calc(var(--kd-ctl) - 2px));background:color-mix(in srgb,var(--_k-accent) 18%,var(--_k-segmented-active));
|
|
3000
|
-
box-shadow:0 1px 2px rgba(0,0,0,calc(.16 * var(--k-lift,1)));transition:transform var(--_ku-ease-ms) var(--_ku-ease)}
|
|
3001
|
-
.knobs-diff-seg[data-value="unified"]>.knobs-diff-pill{transform:translateX(100%)}
|
|
3002
|
-
.knobs-diff[data-frame="flat"] .knobs-diff-pill{box-shadow:none}
|
|
3026
|
+
/* Split | Unified: the selection pill on the one picked, its bright copy the picked one's text; a
|
|
3027
|
+
choice isn't brighter for being picked. Choices are styled by class, as the copy holds them too. */
|
|
3028
|
+
.knobs-diff-seg{position:relative;flex:none;display:grid;grid-template-columns:1fr 1fr;height:var(--_k-control-h);padding:2px;border-radius:var(--kd-ctl);background:var(--_k-fill)}
|
|
3029
|
+
.knobs-ui .knobs-diff-choice{padding:0 9px;border-radius:max(0px,calc(var(--kd-ctl) - 2px));color:var(--_k-fg-2);font-size:var(--_k-text-meta);
|
|
3030
|
+
font-weight:var(--_k-weight-label);white-space:nowrap;cursor:pointer;transition:color calc(var(--_k-hover-out) * 1ms)}
|
|
3031
|
+
.knobs-ui .knobs-diff-choice:is(:hover,:focus-visible){color:var(--_k-fg)}
|
|
3003
3032
|
/* The diff: one layer per file or layout on show, the old fading under the new. */
|
|
3004
3033
|
.knobs-diff-body{position:relative;flex:1;min-height:0}
|
|
3005
3034
|
.knobs-diff-probe{position:absolute;left:0;top:0;width:0;height:var(--kd-line);visibility:hidden;pointer-events:none}
|
|
@@ -3094,7 +3123,7 @@ var init_diff_css = __esm(() => {
|
|
|
3094
3123
|
.knobs-ui .knobs-diff-filter>input::placeholder{color:var(--_k-fg-3)}
|
|
3095
3124
|
.knobs-ui .knobs-diff-filter>button{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:999px;color:var(--_k-fg-3);cursor:pointer;transition:background .12s,color .12s,opacity .12s}
|
|
3096
3125
|
.knobs-ui .knobs-diff-filter>button:hover{background:var(--_ku-wash-hi);color:var(--_k-fg)}
|
|
3097
|
-
.knobs-diff-filter>button svg{width:
|
|
3126
|
+
.knobs-diff-filter>button svg{width:12px;height:12px}
|
|
3098
3127
|
.knobs-diff-list{position:relative;flex:1;min-height:0}
|
|
3099
3128
|
.knobs-diff-files .knobs-diff-counts{font-size:var(--_k-text-meta);align-items:center}
|
|
3100
3129
|
.knobs-diff-files .knobs-diff-counts{gap:5px}
|
|
@@ -3861,6 +3890,283 @@ var init_rgba = __esm(() => {
|
|
|
3861
3890
|
cache = new Map;
|
|
3862
3891
|
});
|
|
3863
3892
|
|
|
3893
|
+
// src/ui/icons.ts
|
|
3894
|
+
function icon(name, options = {}) {
|
|
3895
|
+
const size = options.small ? 12 : 16;
|
|
3896
|
+
return `<svg class="knobs-icon" viewBox="0 0 256 256" width="${size}" height="${size}" fill="currentColor" aria-hidden="true" focusable="false"><path d="${PATHS[name]}"/></svg>`;
|
|
3897
|
+
}
|
|
3898
|
+
var PATHS, ICON_NAMES;
|
|
3899
|
+
var init_icons = __esm(() => {
|
|
3900
|
+
PATHS = {
|
|
3901
|
+
arrowLeft: "M224,128a8,8,0,0,1-8,8H59.31l58.35,58.34a8,8,0,0,1-11.32,11.32l-72-72a8,8,0,0,1,0-11.32l72-72a8,8,0,0,1,11.32,11.32L59.31,120H216A8,8,0,0,1,224,128Z",
|
|
3902
|
+
arrowUpRight: "M200,64V168a8,8,0,0,1-16,0V83.31L69.66,197.66a8,8,0,0,1-11.32-11.32L172.69,72H88a8,8,0,0,1,0-16H192A8,8,0,0,1,200,64Z",
|
|
3903
|
+
arrowSquareOut: "M224,104a8,8,0,0,1-16,0V59.32l-66.33,66.34a8,8,0,0,1-11.32-11.32L196.68,48H152a8,8,0,0,1,0-16h64a8,8,0,0,1,8,8Zm-40,24a8,8,0,0,0-8,8v72H48V80h72a8,8,0,0,0,0-16H48A16,16,0,0,0,32,80V208a16,16,0,0,0,16,16H176a16,16,0,0,0,16-16V136A8,8,0,0,0,184,128Z",
|
|
3904
|
+
arrowCounterClockwise: "M224,128a96,96,0,0,1-94.71,96H128A95.38,95.38,0,0,1,62.1,197.8a8,8,0,0,1,11-11.63A80,80,0,1,0,71.43,71.39a3.07,3.07,0,0,1-.26.25L44.59,96H72a8,8,0,0,1,0,16H24a8,8,0,0,1-8-8V56a8,8,0,0,1,16,0V85.8L60.25,60A96,96,0,0,1,224,128Z",
|
|
3905
|
+
arrowUDownLeft: "M232,112a64.07,64.07,0,0,1-64,64H51.31l34.35,34.34a8,8,0,0,1-11.32,11.32l-48-48a8,8,0,0,1,0-11.32l48-48a8,8,0,0,1,11.32,11.32L51.31,160H168a48,48,0,0,0,0-96H80a8,8,0,0,1,0-16h88A64.07,64.07,0,0,1,232,112Z",
|
|
3906
|
+
arrowsHorizontal: "M136,40V216a8,8,0,0,1-16,0V40a8,8,0,0,1,16,0ZM96,120H35.31l18.35-18.34A8,8,0,0,0,42.34,90.34l-32,32a8,8,0,0,0,0,11.32l32,32a8,8,0,0,0,11.32-11.32L35.31,136H96a8,8,0,0,0,0-16Zm149.66,2.34-32-32a8,8,0,0,0-11.32,11.32L220.69,120H160a8,8,0,0,0,0,16h60.69l-18.35,18.34a8,8,0,0,0,11.32,11.32l32-32A8,8,0,0,0,245.66,122.34Z",
|
|
3907
|
+
caretDown: "M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z",
|
|
3908
|
+
caretLeft: "M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z",
|
|
3909
|
+
caretRight: "M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z",
|
|
3910
|
+
caretUp: "M213.66,165.66a8,8,0,0,1-11.32,0L128,91.31,53.66,165.66a8,8,0,0,1-11.32-11.32l80-80a8,8,0,0,1,11.32,0l80,80A8,8,0,0,1,213.66,165.66Z",
|
|
3911
|
+
check: "M229.66,77.66l-128,128a8,8,0,0,1-11.32,0l-56-56a8,8,0,0,1,11.32-11.32L96,188.69,218.34,66.34a8,8,0,0,1,11.32,11.32Z",
|
|
3912
|
+
checkCircle: "M173.66,98.34a8,8,0,0,1,0,11.32l-56,56a8,8,0,0,1-11.32,0l-24-24a8,8,0,0,1,11.32-11.32L112,148.69l50.34-50.35A8,8,0,0,1,173.66,98.34ZM232,128A104,104,0,1,1,128,24,104.11,104.11,0,0,1,232,128Zm-16,0a88,88,0,1,0-88,88A88.1,88.1,0,0,0,216,128Z",
|
|
3913
|
+
circle: "M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z",
|
|
3914
|
+
copy: "M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z",
|
|
3915
|
+
cornersIn: "M152,96V48a8,8,0,0,1,16,0V88h40a8,8,0,0,1,0,16H160A8,8,0,0,1,152,96ZM96,152H48a8,8,0,0,0,0,16H88v40a8,8,0,0,0,16,0V160A8,8,0,0,0,96,152Zm112,0H160a8,8,0,0,0-8,8v48a8,8,0,0,0,16,0V168h40a8,8,0,0,0,0-16ZM96,40a8,8,0,0,0-8,8V88H48a8,8,0,0,0,0,16H96a8,8,0,0,0,8-8V48A8,8,0,0,0,96,40Z",
|
|
3916
|
+
cornersOut: "M216,48V88a8,8,0,0,1-16,0V56H168a8,8,0,0,1,0-16h40A8,8,0,0,1,216,48ZM88,200H56V168a8,8,0,0,0-16,0v40a8,8,0,0,0,8,8H88a8,8,0,0,0,0-16Zm120-40a8,8,0,0,0-8,8v32H168a8,8,0,0,0,0,16h40a8,8,0,0,0,8-8V168A8,8,0,0,0,208,160ZM88,40H48a8,8,0,0,0-8,8V88a8,8,0,0,0,16,0V56H88a8,8,0,0,0,0-16Z",
|
|
3917
|
+
folder: "M216,72H130.67L102.93,51.2a16.12,16.12,0,0,0-9.6-3.2H40A16,16,0,0,0,24,64V200a16,16,0,0,0,16,16H216.89A15.13,15.13,0,0,0,232,200.89V88A16,16,0,0,0,216,72Zm0,128H40V64H93.33L123.2,86.4A8,8,0,0,0,128,88h88Z",
|
|
3918
|
+
keyboard: "M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48Zm0,144H32V64H224V192Zm-16-64a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,128Zm0-32a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16H200A8,8,0,0,1,208,96ZM72,160a8,8,0,0,1-8,8H56a8,8,0,0,1,0-16h8A8,8,0,0,1,72,160Zm96,0a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,160Zm40,0a8,8,0,0,1-8,8h-8a8,8,0,0,1,0-16h8A8,8,0,0,1,208,160Z",
|
|
3919
|
+
magnifyingGlass: "M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z",
|
|
3920
|
+
magnifyingGlassMinus: "M152,112a8,8,0,0,1-8,8H80a8,8,0,0,1,0-16h64A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z",
|
|
3921
|
+
magnifyingGlassPlus: "M152,112a8,8,0,0,1-8,8H120v24a8,8,0,0,1-16,0V120H80a8,8,0,0,1,0-16h24V80a8,8,0,0,1,16,0v24h24A8,8,0,0,1,152,112Zm77.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88.11,88.11,0,1,1,11.31-11.31l50.07,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z",
|
|
3922
|
+
microphone: "M128,176a48.05,48.05,0,0,0,48-48V64a48,48,0,0,0-96,0v64A48.05,48.05,0,0,0,128,176ZM96,64a32,32,0,0,1,64,0v64a32,32,0,0,1-64,0Zm40,143.6V240a8,8,0,0,1-16,0V207.6A80.11,80.11,0,0,1,48,128a8,8,0,0,1,16,0,64,64,0,0,0,128,0,8,8,0,0,1,16,0A80.11,80.11,0,0,1,136,207.6Z",
|
|
3923
|
+
paperPlaneRight: "M231.87,114l-168-95.89A16,16,0,0,0,40.92,37.34L71.55,128,40.92,218.67A16,16,0,0,0,56,240a16.15,16.15,0,0,0,7.93-2.1l167.92-96.05a16,16,0,0,0,.05-27.89ZM56,224a.56.56,0,0,0,0-.12L85.74,136H144a8,8,0,0,0,0-16H85.74L56.06,32.16A.46.46,0,0,0,56,32l168,95.83Z",
|
|
3924
|
+
pencilSimple: "M227.31,73.37,182.63,28.68a16,16,0,0,0-22.63,0L36.69,152A15.86,15.86,0,0,0,32,163.31V208a16,16,0,0,0,16,16H92.69A15.86,15.86,0,0,0,104,219.31L227.31,96a16,16,0,0,0,0-22.63ZM92.69,208H48V163.31l88-88L180.69,120ZM192,108.68,147.31,64l24-24L216,84.68Z",
|
|
3925
|
+
repeat: "M24,128A72.08,72.08,0,0,1,96,56H204.69L194.34,45.66a8,8,0,0,1,11.32-11.32l24,24a8,8,0,0,1,0,11.32l-24,24a8,8,0,0,1-11.32-11.32L204.69,72H96a56.06,56.06,0,0,0-56,56,8,8,0,0,1-16,0Zm200-8a8,8,0,0,0-8,8,56.06,56.06,0,0,1-56,56H51.31l10.35-10.34a8,8,0,0,0-11.32-11.32l-24,24a8,8,0,0,0,0,11.32l24,24a8,8,0,0,0,11.32-11.32L51.31,200H160a72.08,72.08,0,0,0,72-72A8,8,0,0,0,224,120Z",
|
|
3926
|
+
sidebar: "M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM40,56H80V200H40ZM216,200H96V56H216V200Z",
|
|
3927
|
+
x: "M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"
|
|
3928
|
+
};
|
|
3929
|
+
ICON_NAMES = Object.keys(PATHS);
|
|
3930
|
+
});
|
|
3931
|
+
|
|
3932
|
+
// src/ui/selection-pill.ts
|
|
3933
|
+
function pillSpring(distance, base = SPRINGS.default) {
|
|
3934
|
+
return distance > 400 ? { duration: base.duration * 1.4, bounce: base.bounce } : base;
|
|
3935
|
+
}
|
|
3936
|
+
function pillBoxOf(row, container) {
|
|
3937
|
+
return {
|
|
3938
|
+
x: row.left - container.left - container.clientLeft + container.scrollLeft,
|
|
3939
|
+
y: row.top - container.top - container.clientTop + container.scrollTop,
|
|
3940
|
+
w: row.width,
|
|
3941
|
+
h: row.height
|
|
3942
|
+
};
|
|
3943
|
+
}
|
|
3944
|
+
function pillRadius(from, to, h, k) {
|
|
3945
|
+
const t = Math.abs(to.h - from.h) > 0.5 ? (h - from.h) / (to.h - from.h) : Number.isFinite(k) ? k : 1;
|
|
3946
|
+
return from.r + (to.r - from.r) * Math.min(1, Math.max(0, t));
|
|
3947
|
+
}
|
|
3948
|
+
function pillProgress(from, to, at) {
|
|
3949
|
+
const d = Math.hypot(to.x - from.x, to.y - from.y);
|
|
3950
|
+
if (d < 0.5)
|
|
3951
|
+
return 1;
|
|
3952
|
+
const p = ((at.x - from.x) * (to.x - from.x) + (at.y - from.y) * (to.y - from.y)) / (d * d);
|
|
3953
|
+
return Math.min(1, Math.max(0, p));
|
|
3954
|
+
}
|
|
3955
|
+
function planPill(state, next, flags = {}) {
|
|
3956
|
+
if (!next)
|
|
3957
|
+
return { kind: "hide" };
|
|
3958
|
+
if (!state.shown || !state.at || flags.first || flags.reduced || flags.snap)
|
|
3959
|
+
return { kind: "land", box: next };
|
|
3960
|
+
const t = state.target;
|
|
3961
|
+
if (t && t.x === next.x && t.y === next.y && t.w === next.w && t.h === next.h)
|
|
3962
|
+
return { kind: "stay" };
|
|
3963
|
+
const d = Math.hypot(next.x - state.at.x, next.y - state.at.y);
|
|
3964
|
+
return { kind: "travel", box: next, spring: pillSpring(d) };
|
|
3965
|
+
}
|
|
3966
|
+
function selectionPill(container, options) {
|
|
3967
|
+
const doc = container.ownerDocument;
|
|
3968
|
+
const win = doc.defaultView;
|
|
3969
|
+
injectUiStyles(doc);
|
|
3970
|
+
if (win.getComputedStyle(container).position === "static")
|
|
3971
|
+
container.style.position = "relative";
|
|
3972
|
+
const pill = doc.createElement("i");
|
|
3973
|
+
pill.className = "knobs-pick-pill";
|
|
3974
|
+
pill.setAttribute("aria-hidden", "true");
|
|
3975
|
+
pill.dataset.off = "";
|
|
3976
|
+
const copyOn = options.copy !== false;
|
|
3977
|
+
const copy = doc.createElement("div");
|
|
3978
|
+
copy.className = "knobs-pick-copy";
|
|
3979
|
+
copy.setAttribute("aria-hidden", "true");
|
|
3980
|
+
copy.inert = true;
|
|
3981
|
+
copy.dataset.off = "";
|
|
3982
|
+
const copyRows = doc.createElement("div");
|
|
3983
|
+
copyRows.className = "knobs-pick-copy-rows";
|
|
3984
|
+
copy.append(copyRows);
|
|
3985
|
+
container.prepend(pill);
|
|
3986
|
+
if (copyOn)
|
|
3987
|
+
container.append(copy);
|
|
3988
|
+
const { omega, zeta } = springMotion(SPRINGS.default);
|
|
3989
|
+
const springs = [0, 0, 0, 0].map(() => new Spring(0, omega, zeta, 0.01));
|
|
3990
|
+
const [sx, sy, sw, sh] = springs;
|
|
3991
|
+
let shown = false;
|
|
3992
|
+
let first = true;
|
|
3993
|
+
let target = null;
|
|
3994
|
+
let from = { x: 0, y: 0, w: 0, h: 0 };
|
|
3995
|
+
let fromR = 0;
|
|
3996
|
+
let toR = 0;
|
|
3997
|
+
let rowBoxes = [];
|
|
3998
|
+
const clones = new Map;
|
|
3999
|
+
let disposed = false;
|
|
4000
|
+
const radiusOf = (row) => options.radius?.(row) ?? (Number.parseFloat(win.getComputedStyle(row).borderTopLeftRadius) || 0);
|
|
4001
|
+
const rowsNow = () => options.rows ? [...options.rows()] : [...container.children].filter((n) => n !== pill && n !== copy);
|
|
4002
|
+
const measure = (row) => {
|
|
4003
|
+
const c = container.getBoundingClientRect();
|
|
4004
|
+
const r = row.getBoundingClientRect();
|
|
4005
|
+
return pillBoxOf(r, {
|
|
4006
|
+
left: c.left,
|
|
4007
|
+
top: c.top,
|
|
4008
|
+
scrollLeft: container.scrollLeft,
|
|
4009
|
+
scrollTop: container.scrollTop,
|
|
4010
|
+
clientLeft: container.clientLeft,
|
|
4011
|
+
clientTop: container.clientTop
|
|
4012
|
+
});
|
|
4013
|
+
};
|
|
4014
|
+
const at = () => ({ x: sx.x, y: sy.x, w: sw.x, h: sh.x });
|
|
4015
|
+
const syncCopy = (span) => {
|
|
4016
|
+
if (!copyOn)
|
|
4017
|
+
return;
|
|
4018
|
+
const keep = new Set;
|
|
4019
|
+
for (const { row, box } of rowBoxes) {
|
|
4020
|
+
if (!boxesMeet(box, span))
|
|
4021
|
+
continue;
|
|
4022
|
+
keep.add(row);
|
|
4023
|
+
let n = clones.get(row);
|
|
4024
|
+
if (!n) {
|
|
4025
|
+
n = row.cloneNode(true);
|
|
4026
|
+
n.removeAttribute("id");
|
|
4027
|
+
for (const d of n.querySelectorAll("[id]"))
|
|
4028
|
+
d.removeAttribute("id");
|
|
4029
|
+
clones.set(row, n);
|
|
4030
|
+
copyRows.append(n);
|
|
4031
|
+
}
|
|
4032
|
+
const s = n.style;
|
|
4033
|
+
s.position = "absolute";
|
|
4034
|
+
s.inset = "auto";
|
|
4035
|
+
s.left = `${box.x}px`;
|
|
4036
|
+
s.top = `${box.y}px`;
|
|
4037
|
+
s.width = `${box.w}px`;
|
|
4038
|
+
s.height = `${box.h}px`;
|
|
4039
|
+
s.margin = "0";
|
|
4040
|
+
s.transform = "none";
|
|
4041
|
+
s.clipPath = "";
|
|
4042
|
+
s.opacity = "";
|
|
4043
|
+
s.boxSizing = "border-box";
|
|
4044
|
+
s.color = options.color ?? "var(--_k-fg)";
|
|
4045
|
+
}
|
|
4046
|
+
for (const [row, n] of clones)
|
|
4047
|
+
if (!keep.has(row)) {
|
|
4048
|
+
n.remove();
|
|
4049
|
+
clones.delete(row);
|
|
4050
|
+
}
|
|
4051
|
+
};
|
|
4052
|
+
const paint = () => {
|
|
4053
|
+
const b = at();
|
|
4054
|
+
const x0 = grid(b.x);
|
|
4055
|
+
const y0 = grid(b.y);
|
|
4056
|
+
const w = grid(b.x + b.w) - x0;
|
|
4057
|
+
const h = grid(b.y + b.h) - y0;
|
|
4058
|
+
const r = target ? pillRadius({ h: from.h, r: fromR }, { h: target.h, r: toR }, b.h, pillProgress(from, target, b)) : toR;
|
|
4059
|
+
const radius = `${Math.max(0, Math.min(r, h / 2, w / 2)).toFixed(2)}px`;
|
|
4060
|
+
for (const n of copyOn ? [pill, copy] : [pill]) {
|
|
4061
|
+
n.style.transform = `translate3d(${x0}px,${y0}px,0)`;
|
|
4062
|
+
n.style.width = `${w}px`;
|
|
4063
|
+
n.style.height = `${h}px`;
|
|
4064
|
+
n.style.borderRadius = radius;
|
|
4065
|
+
}
|
|
4066
|
+
if (copyOn)
|
|
4067
|
+
copyRows.style.transform = `translate3d(${-x0}px,${-y0}px,0)`;
|
|
4068
|
+
};
|
|
4069
|
+
const loop = frameLoop(win, (dt) => {
|
|
4070
|
+
for (const s of springs)
|
|
4071
|
+
s.step(dt);
|
|
4072
|
+
paint();
|
|
4073
|
+
return springs.some((s) => !s.resting);
|
|
4074
|
+
});
|
|
4075
|
+
const show = (on) => {
|
|
4076
|
+
shown = on;
|
|
4077
|
+
pill.toggleAttribute("data-off", !on);
|
|
4078
|
+
copy.toggleAttribute("data-off", !on);
|
|
4079
|
+
container.toggleAttribute("data-pick-empty", !on);
|
|
4080
|
+
};
|
|
4081
|
+
const update = (o) => {
|
|
4082
|
+
if (disposed)
|
|
4083
|
+
return;
|
|
4084
|
+
const row = options.selected();
|
|
4085
|
+
const next = row?.isConnected ? measure(row) : null;
|
|
4086
|
+
const plan = planPill({ shown, at: shown ? at() : null, target }, next, {
|
|
4087
|
+
first,
|
|
4088
|
+
reduced: reducedMotion(win),
|
|
4089
|
+
...o?.snap ? { snap: true } : {}
|
|
4090
|
+
});
|
|
4091
|
+
first = false;
|
|
4092
|
+
for (const n of clones.values())
|
|
4093
|
+
n.remove();
|
|
4094
|
+
clones.clear();
|
|
4095
|
+
rowBoxes = copyOn ? rowsNow().filter((r) => r.isConnected).map((r) => ({ row: r, box: measure(r) })) : [];
|
|
4096
|
+
if (plan.kind === "hide") {
|
|
4097
|
+
if (shown)
|
|
4098
|
+
show(false);
|
|
4099
|
+
return;
|
|
4100
|
+
}
|
|
4101
|
+
if (plan.kind === "stay") {
|
|
4102
|
+
syncCopy(boxUnion(at(), target));
|
|
4103
|
+
return;
|
|
4104
|
+
}
|
|
4105
|
+
const r = radiusOf(row);
|
|
4106
|
+
if (plan.kind === "land") {
|
|
4107
|
+
sx.snap(plan.box.x);
|
|
4108
|
+
sy.snap(plan.box.y);
|
|
4109
|
+
sw.snap(plan.box.w);
|
|
4110
|
+
sh.snap(plan.box.h);
|
|
4111
|
+
from = plan.box;
|
|
4112
|
+
fromR = r;
|
|
4113
|
+
toR = r;
|
|
4114
|
+
target = plan.box;
|
|
4115
|
+
syncCopy(plan.box);
|
|
4116
|
+
paint();
|
|
4117
|
+
loop.stop();
|
|
4118
|
+
if (!shown)
|
|
4119
|
+
show(true);
|
|
4120
|
+
return;
|
|
4121
|
+
}
|
|
4122
|
+
const m = springMotion(plan.spring);
|
|
4123
|
+
for (const s of springs) {
|
|
4124
|
+
s.omega = m.omega;
|
|
4125
|
+
s.zeta = m.zeta;
|
|
4126
|
+
}
|
|
4127
|
+
const now = at();
|
|
4128
|
+
fromR = target ? pillRadius({ h: from.h, r: fromR }, { h: target.h, r: toR }, now.h, pillProgress(from, target, now)) : r;
|
|
4129
|
+
from = now;
|
|
4130
|
+
toR = r;
|
|
4131
|
+
target = plan.box;
|
|
4132
|
+
sx.set(plan.box.x);
|
|
4133
|
+
sy.set(plan.box.y);
|
|
4134
|
+
sw.set(plan.box.w);
|
|
4135
|
+
sh.set(plan.box.h);
|
|
4136
|
+
syncCopy(boxUnion(now, plan.box));
|
|
4137
|
+
loop.wake();
|
|
4138
|
+
};
|
|
4139
|
+
const ro = "ResizeObserver" in win ? new win.ResizeObserver(() => update({ snap: true })) : null;
|
|
4140
|
+
ro?.observe(container);
|
|
4141
|
+
update();
|
|
4142
|
+
return {
|
|
4143
|
+
element: pill,
|
|
4144
|
+
update,
|
|
4145
|
+
dispose() {
|
|
4146
|
+
disposed = true;
|
|
4147
|
+
loop.stop();
|
|
4148
|
+
ro?.disconnect();
|
|
4149
|
+
pill.remove();
|
|
4150
|
+
copy.remove();
|
|
4151
|
+
container.removeAttribute("data-pick-empty");
|
|
4152
|
+
}
|
|
4153
|
+
};
|
|
4154
|
+
}
|
|
4155
|
+
var boxesMeet = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h, boxUnion = (a, b) => {
|
|
4156
|
+
const x = Math.min(a.x, b.x);
|
|
4157
|
+
const y = Math.min(a.y, b.y);
|
|
4158
|
+
return {
|
|
4159
|
+
x,
|
|
4160
|
+
y,
|
|
4161
|
+
w: Math.max(a.x + a.w, b.x + b.w) - x,
|
|
4162
|
+
h: Math.max(a.y + a.h, b.y + b.h) - y
|
|
4163
|
+
};
|
|
4164
|
+
}, grid = (v) => Math.round(v * 64) / 64;
|
|
4165
|
+
var init_selection_pill = __esm(() => {
|
|
4166
|
+
init_motion();
|
|
4167
|
+
init_look();
|
|
4168
|
+
});
|
|
4169
|
+
|
|
3864
4170
|
// src/panel/hints.ts
|
|
3865
4171
|
function extractWords(text) {
|
|
3866
4172
|
return text.toLowerCase().match(/[a-z]+/g) ?? [];
|
|
@@ -4689,34 +4995,27 @@ function tree(container, options) {
|
|
|
4689
4995
|
const empty = doc.createElement("div");
|
|
4690
4996
|
empty.className = "knobs-tree-empty";
|
|
4691
4997
|
empty.hidden = true;
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4998
|
+
root.append(space, line, empty);
|
|
4999
|
+
let pill = null;
|
|
5000
|
+
let picked = null;
|
|
5001
|
+
let travelUntil = 0;
|
|
5002
|
+
const pickedRow = () => {
|
|
5003
|
+
const id = sel.ids.length === 1 ? sel.ids[0] : null;
|
|
5004
|
+
const v = id === null ? undefined : views.get(id);
|
|
5005
|
+
return v && !v.leaving && rowIndex.has(v.id) ? v : null;
|
|
4699
5006
|
};
|
|
4700
5007
|
const placeCursor = (animate) => {
|
|
4701
|
-
if (!
|
|
5008
|
+
if (!pill)
|
|
4702
5009
|
return;
|
|
4703
5010
|
const id = sel.ids.length === 1 ? sel.ids[0] : null;
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
}
|
|
4711
|
-
|
|
4712
|
-
cursorY.set(i * h);
|
|
4713
|
-
else
|
|
4714
|
-
cursorY.snap(i * h);
|
|
4715
|
-
cursorOn = true;
|
|
4716
|
-
cursor.setAttribute("data-on", "");
|
|
4717
|
-
drawCursor();
|
|
4718
|
-
if (!cursorY.resting)
|
|
4719
|
-
loop.wake();
|
|
5011
|
+
root.toggleAttribute("data-glide", id !== null && rowIndex.has(id));
|
|
5012
|
+
const fresh = id !== picked;
|
|
5013
|
+
picked = id;
|
|
5014
|
+
if (animate && fresh) {
|
|
5015
|
+
travelUntil = performance.now() + 450;
|
|
5016
|
+
pill.update();
|
|
5017
|
+
} else if (performance.now() >= travelUntil)
|
|
5018
|
+
pill.update({ snap: true });
|
|
4720
5019
|
};
|
|
4721
5020
|
container.append(root);
|
|
4722
5021
|
const scrollbar = overlayScrollbar(root, space);
|
|
@@ -4745,6 +5044,12 @@ function tree(container, options) {
|
|
|
4745
5044
|
};
|
|
4746
5045
|
const views = new Map;
|
|
4747
5046
|
const pool = [];
|
|
5047
|
+
if (options.glide)
|
|
5048
|
+
pill = selectionPill(root, {
|
|
5049
|
+
rows: () => [...views.values()].filter((v) => !v.leaving).map((v) => v.el),
|
|
5050
|
+
selected: () => pickedRow()?.el ?? null,
|
|
5051
|
+
radius: (row) => Number.parseFloat(win.getComputedStyle(row, "::before").borderTopLeftRadius) || 0
|
|
5052
|
+
});
|
|
4748
5053
|
const makeView = (id) => {
|
|
4749
5054
|
const v = pool.pop() ?? createView();
|
|
4750
5055
|
v.id = id;
|
|
@@ -4925,12 +5230,6 @@ function tree(container, options) {
|
|
|
4925
5230
|
function frame(dt) {
|
|
4926
5231
|
let moving = false;
|
|
4927
5232
|
let bottom = rows.length * h;
|
|
4928
|
-
if (options.glide && !cursorY.resting) {
|
|
4929
|
-
cursorY.step(dt);
|
|
4930
|
-
drawCursor();
|
|
4931
|
-
if (!cursorY.resting)
|
|
4932
|
-
moving = true;
|
|
4933
|
-
}
|
|
4934
5233
|
for (const v of views.values()) {
|
|
4935
5234
|
v.y.step(dt);
|
|
4936
5235
|
if (!v.y.resting)
|
|
@@ -4950,6 +5249,8 @@ function tree(container, options) {
|
|
|
4950
5249
|
}
|
|
4951
5250
|
setSpace(moving ? bottom : rows.length * h);
|
|
4952
5251
|
trim();
|
|
5252
|
+
if (pill && moving && performance.now() >= travelUntil)
|
|
5253
|
+
pill.update({ snap: true });
|
|
4953
5254
|
return moving;
|
|
4954
5255
|
}
|
|
4955
5256
|
const trim = () => {
|
|
@@ -5578,6 +5879,7 @@ function tree(container, options) {
|
|
|
5578
5879
|
autoScroll.stop();
|
|
5579
5880
|
ro.disconnect();
|
|
5580
5881
|
scrollbar.dispose();
|
|
5882
|
+
pill?.dispose();
|
|
5581
5883
|
dragging?.ghost.remove();
|
|
5582
5884
|
root.remove();
|
|
5583
5885
|
}
|
|
@@ -5596,6 +5898,7 @@ var init_tree = __esm(() => {
|
|
|
5596
5898
|
init_motion();
|
|
5597
5899
|
init_page_hints();
|
|
5598
5900
|
init_look();
|
|
5901
|
+
init_selection_pill();
|
|
5599
5902
|
init_tree_model();
|
|
5600
5903
|
MOVE = springMotion(SPRINGS.default);
|
|
5601
5904
|
});
|
|
@@ -5732,7 +6035,7 @@ function codeDiff(container, options) {
|
|
|
5732
6035
|
};
|
|
5733
6036
|
const nav = make("span", "knobs-diff-nav");
|
|
5734
6037
|
const prev = button("Previous file", PREV);
|
|
5735
|
-
const next = button("Next file",
|
|
6038
|
+
const next = button("Next file", NEXT);
|
|
5736
6039
|
const place = make("span", "");
|
|
5737
6040
|
nav.append(prev, place, next);
|
|
5738
6041
|
const wrapButton = button("Wrap lines", WRAP);
|
|
@@ -5753,9 +6056,8 @@ function codeDiff(container, options) {
|
|
|
5753
6056
|
const seg = make("div", "knobs-diff-seg");
|
|
5754
6057
|
seg.setAttribute("role", "radiogroup");
|
|
5755
6058
|
seg.setAttribute("aria-label", "Layout");
|
|
5756
|
-
const pill = make("i", "knobs-diff-pill");
|
|
5757
6059
|
const choice = (value, label) => {
|
|
5758
|
-
const b = make("button", "");
|
|
6060
|
+
const b = make("button", "knobs-diff-choice");
|
|
5759
6061
|
b.type = "button";
|
|
5760
6062
|
b.setAttribute("role", "radio");
|
|
5761
6063
|
b.dataset.value = value;
|
|
@@ -5764,7 +6066,7 @@ function codeDiff(container, options) {
|
|
|
5764
6066
|
};
|
|
5765
6067
|
const splitButton = choice("split", "Split");
|
|
5766
6068
|
const unifiedButton = choice("unified", "Unified");
|
|
5767
|
-
seg.append(
|
|
6069
|
+
seg.append(splitButton, unifiedButton);
|
|
5768
6070
|
if (options.lead)
|
|
5769
6071
|
head.append(options.lead);
|
|
5770
6072
|
head.append(path, stat, make("span", "knobs-diff-fill"), nav, wrapButton, seg, viewedButton);
|
|
@@ -5775,6 +6077,11 @@ function codeDiff(container, options) {
|
|
|
5775
6077
|
body.append(note, probe);
|
|
5776
6078
|
root.append(head, body);
|
|
5777
6079
|
container.append(root);
|
|
6080
|
+
const segPill = selectionPill(seg, {
|
|
6081
|
+
rows: () => [splitButton, unifiedButton],
|
|
6082
|
+
selected: () => layout === "split" ? splitButton : unifiedButton
|
|
6083
|
+
});
|
|
6084
|
+
let pilled = layout;
|
|
5778
6085
|
const fileNow = () => files.find((f) => f.name === current) ?? null;
|
|
5779
6086
|
const paintHead = () => {
|
|
5780
6087
|
const file = fileNow();
|
|
@@ -5807,6 +6114,10 @@ function codeDiff(container, options) {
|
|
|
5807
6114
|
next.disabled = at >= files.length - 1;
|
|
5808
6115
|
wrapButton.setAttribute("aria-pressed", String(wrap));
|
|
5809
6116
|
seg.dataset.value = layout;
|
|
6117
|
+
if (pilled !== layout) {
|
|
6118
|
+
pilled = layout;
|
|
6119
|
+
segPill.update();
|
|
6120
|
+
}
|
|
5810
6121
|
splitButton.setAttribute("aria-checked", String(layout === "split"));
|
|
5811
6122
|
unifiedButton.setAttribute("aria-checked", String(layout === "unified"));
|
|
5812
6123
|
splitButton.tabIndex = layout === "split" ? 0 : -1;
|
|
@@ -6641,6 +6952,7 @@ function codeDiff(container, options) {
|
|
|
6641
6952
|
dispose() {
|
|
6642
6953
|
disposed = true;
|
|
6643
6954
|
loop.stop();
|
|
6955
|
+
segPill.dispose();
|
|
6644
6956
|
sizes.disconnect();
|
|
6645
6957
|
attaching.disconnect();
|
|
6646
6958
|
resized.disconnect();
|
|
@@ -6996,7 +7308,7 @@ function diffReview(container, options) {
|
|
|
6996
7308
|
}
|
|
6997
7309
|
};
|
|
6998
7310
|
}
|
|
6999
|
-
var lib, load = () => lib ??= import("@pierre/diffs"), SYNTAX, IN, OUT, FADE4, HEIGHT, DRAWER, BLUR = 3, WRAP, PREV, UNVIEWED, VIEWED, SEARCH, CLEAR2, SIDEBAR, SEPARATOR = 32;
|
|
7311
|
+
var lib, load = () => lib ??= import("@pierre/diffs"), SYNTAX, IN, OUT, FADE4, HEIGHT, DRAWER, BLUR = 3, WRAP, PREV, NEXT, UNVIEWED, VIEWED, SEARCH, CLEAR2, SIDEBAR, SEPARATOR = 32;
|
|
7000
7312
|
var init_diff = __esm(() => {
|
|
7001
7313
|
init_glide();
|
|
7002
7314
|
init_motion();
|
|
@@ -7004,6 +7316,8 @@ var init_diff = __esm(() => {
|
|
|
7004
7316
|
init_diff_model();
|
|
7005
7317
|
init_look();
|
|
7006
7318
|
init_rgba();
|
|
7319
|
+
init_icons();
|
|
7320
|
+
init_selection_pill();
|
|
7007
7321
|
init_tree();
|
|
7008
7322
|
SYNTAX = { dark: "pierre-dark", light: "pierre-light" };
|
|
7009
7323
|
IN = springMotion(SPRINGS.default);
|
|
@@ -7011,13 +7325,14 @@ var init_diff = __esm(() => {
|
|
|
7011
7325
|
FADE4 = springMotion(FADE);
|
|
7012
7326
|
HEIGHT = springMotion(SPRINGS.calm);
|
|
7013
7327
|
DRAWER = springMotion(SPRINGS.calm);
|
|
7014
|
-
WRAP =
|
|
7015
|
-
PREV =
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
|
|
7019
|
-
|
|
7020
|
-
|
|
7328
|
+
WRAP = icon("arrowUDownLeft");
|
|
7329
|
+
PREV = icon("caretLeft");
|
|
7330
|
+
NEXT = icon("caretRight");
|
|
7331
|
+
UNVIEWED = icon("circle");
|
|
7332
|
+
VIEWED = icon("checkCircle");
|
|
7333
|
+
SEARCH = icon("magnifyingGlass", { small: true });
|
|
7334
|
+
CLEAR2 = icon("x", { small: true });
|
|
7335
|
+
SIDEBAR = icon("sidebar");
|
|
7021
7336
|
});
|
|
7022
7337
|
|
|
7023
7338
|
// src/ui/layer.ts
|
|
@@ -8000,10 +8315,25 @@ function advance(t, dt, o) {
|
|
|
8000
8315
|
}
|
|
8001
8316
|
return { t: hi, ended: true, wrapped: false };
|
|
8002
8317
|
}
|
|
8003
|
-
|
|
8318
|
+
function moveHead(head, t, motion, catching, minGap = 0) {
|
|
8319
|
+
if (motion === "jump" && Math.abs(t - head.x) > minGap)
|
|
8320
|
+
return { x: head.x, target: t, catching: true };
|
|
8321
|
+
if (catching)
|
|
8322
|
+
return { x: head.x + (t - head.target), target: t, catching: true };
|
|
8323
|
+
return { x: t, target: t, catching: false };
|
|
8324
|
+
}
|
|
8325
|
+
function currentMarker(markers, t, fps) {
|
|
8326
|
+
let best = null;
|
|
8327
|
+
for (const m of markers)
|
|
8328
|
+
if (m.time <= t + 0.5 / fps && (!best || m.time >= best.time))
|
|
8329
|
+
best = m;
|
|
8330
|
+
return best;
|
|
8331
|
+
}
|
|
8332
|
+
var SECOND_STEPS, FRAME_STEPS, toFrame = (t, fps) => Math.round(t * fps), frameTime = (t, fps) => Math.round(t * fps) / fps, round = (t) => Math.round(t * 1e6) / 1e6, CATCH_UP;
|
|
8004
8333
|
var init_timeline_model = __esm(() => {
|
|
8005
8334
|
SECOND_STEPS = [0.1, 0.2, 0.25, 0.5, 1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, 3600];
|
|
8006
8335
|
FRAME_STEPS = [1, 2, 5, 10, 15, 30, 60, 120, 300, 600, 900, 1800, 3600, 9000, 18000];
|
|
8336
|
+
CATCH_UP = { duration: 0.15, bounce: 0 };
|
|
8007
8337
|
});
|
|
8008
8338
|
|
|
8009
8339
|
// src/ui/timeline.ts
|
|
@@ -8016,6 +8346,7 @@ function timeline(container, options) {
|
|
|
8016
8346
|
let speed = options.speed ?? 1;
|
|
8017
8347
|
let repeat = options.repeat ?? true;
|
|
8018
8348
|
const arrows = options.arrows ?? "frames";
|
|
8349
|
+
const lane = options.variant === "lane";
|
|
8019
8350
|
let time = Math.min(duration, Math.max(0, options.time ?? 0));
|
|
8020
8351
|
let playing = false;
|
|
8021
8352
|
let markers = [...options.markers ?? []];
|
|
@@ -8049,27 +8380,27 @@ function timeline(container, options) {
|
|
|
8049
8380
|
root.setAttribute("aria-label", options.label ?? "Timeline");
|
|
8050
8381
|
root.setAttribute("aria-keyshortcuts", "Space ArrowLeft ArrowRight , . Home End [ ] I O M");
|
|
8051
8382
|
applyLook2(root, options);
|
|
8383
|
+
if (lane)
|
|
8384
|
+
root.dataset.variant = "lane";
|
|
8052
8385
|
const transport = el("div", "knobs-tl-transport");
|
|
8053
8386
|
const playBtn = el("button", "knobs-tl-play");
|
|
8054
8387
|
playBtn.type = "button";
|
|
8055
8388
|
playBtn.tabIndex = -1;
|
|
8056
|
-
|
|
8057
|
-
const now = el("span", "knobs-tl-now");
|
|
8058
|
-
const sub = el("span", "knobs-tl-sub");
|
|
8059
|
-
readout.append(now, sub);
|
|
8060
|
-
transport.append(playBtn, readout);
|
|
8389
|
+
transport.append(playBtn);
|
|
8061
8390
|
const track = el("div", "knobs-tl-track");
|
|
8062
8391
|
const canvas = el("canvas", "knobs-tl-ruler");
|
|
8063
8392
|
canvas.setAttribute("aria-hidden", "true");
|
|
8064
|
-
const
|
|
8393
|
+
const markerLane = el("div", "knobs-tl-lane");
|
|
8065
8394
|
const hover = el("div", "knobs-tl-hover");
|
|
8395
|
+
const tag = el("span", "knobs-tl-tag");
|
|
8396
|
+
tag.setAttribute("aria-hidden", "true");
|
|
8066
8397
|
const head = el("div", "knobs-tl-head");
|
|
8067
8398
|
head.id = `${id}-head`;
|
|
8068
8399
|
head.setAttribute("role", "slider");
|
|
8069
8400
|
head.setAttribute("aria-label", "Playhead");
|
|
8070
8401
|
head.setAttribute("aria-valuemin", "0");
|
|
8071
8402
|
head.setAttribute("aria-valuemax", String(duration));
|
|
8072
|
-
track.append(canvas,
|
|
8403
|
+
track.append(canvas, markerLane, hover, head, tag);
|
|
8073
8404
|
root.append(transport, track);
|
|
8074
8405
|
container.append(root);
|
|
8075
8406
|
let width = 1;
|
|
@@ -8116,13 +8447,14 @@ function timeline(container, options) {
|
|
|
8116
8447
|
let drawn = "";
|
|
8117
8448
|
const drawRuler = () => {
|
|
8118
8449
|
const v = view();
|
|
8119
|
-
const key = `${v.start.toFixed(6)}:${v.span.toFixed(6)}:${width}:${units}:${fps}`;
|
|
8450
|
+
const key = `${v.start.toFixed(6)}:${v.span.toFixed(6)}:${width}:${height}:${units}:${fps}`;
|
|
8120
8451
|
if (key === drawn)
|
|
8121
8452
|
return;
|
|
8122
8453
|
drawn = key;
|
|
8123
8454
|
const dpr = win.devicePixelRatio || 1;
|
|
8124
8455
|
const w = Math.max(1, Math.round(width * dpr));
|
|
8125
|
-
const
|
|
8456
|
+
const rh = lane ? height : RULER;
|
|
8457
|
+
const h = Math.round(rh * dpr);
|
|
8126
8458
|
if (canvas.width !== w || canvas.height !== h) {
|
|
8127
8459
|
canvas.width = w;
|
|
8128
8460
|
canvas.height = h;
|
|
@@ -8131,8 +8463,19 @@ function timeline(container, options) {
|
|
|
8131
8463
|
if (!ctx)
|
|
8132
8464
|
return;
|
|
8133
8465
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
8134
|
-
ctx.clearRect(0, 0, width,
|
|
8466
|
+
ctx.clearRect(0, 0, width, rh);
|
|
8135
8467
|
const ticks = rulerTicks(v, width, { fps, units });
|
|
8468
|
+
if (lane) {
|
|
8469
|
+
ctx.fillStyle = colors.tick;
|
|
8470
|
+
for (const t of ticks.minor)
|
|
8471
|
+
if (t >= -0.000000001 && t <= duration + 0.000000001)
|
|
8472
|
+
ctx.fillRect(xOf(t) - 0.5, rh - 4, 1, 4);
|
|
8473
|
+
ctx.fillStyle = colors.major;
|
|
8474
|
+
for (const m of ticks.major)
|
|
8475
|
+
if (m.t >= -0.000000001 && m.t <= duration + 0.000000001)
|
|
8476
|
+
ctx.fillRect(xOf(m.t) - 0.5, rh - 7, 1, 7);
|
|
8477
|
+
return;
|
|
8478
|
+
}
|
|
8136
8479
|
const px = (t) => Math.round(xOf(t)) + 0.5;
|
|
8137
8480
|
ctx.fillStyle = colors.line;
|
|
8138
8481
|
ctx.fillRect(0, RULER - 1, width, 1);
|
|
@@ -8172,18 +8515,21 @@ function timeline(container, options) {
|
|
|
8172
8515
|
n.dataset.id = m.id;
|
|
8173
8516
|
const pin = el("span", "knobs-tl-pin");
|
|
8174
8517
|
const label = el("span", "knobs-tl-mlabel");
|
|
8518
|
+
label.append(el("span", "knobs-tl-mtext knobs-scroll-fade-x"));
|
|
8175
8519
|
n.append(pin, label);
|
|
8176
|
-
|
|
8520
|
+
markerLane.append(n);
|
|
8177
8521
|
markerEls.set(m.id, n);
|
|
8178
8522
|
if (built)
|
|
8179
8523
|
enter(n);
|
|
8180
8524
|
}
|
|
8181
8525
|
const label = n.querySelector(".knobs-tl-mlabel");
|
|
8182
|
-
|
|
8183
|
-
|
|
8526
|
+
const text = label.firstElementChild;
|
|
8527
|
+
if (text.textContent !== (m.label ?? ""))
|
|
8528
|
+
text.textContent = m.label ?? "";
|
|
8184
8529
|
label.hidden = !m.label;
|
|
8185
8530
|
n.style.setProperty("--knobs-tl-color", m.color ?? "");
|
|
8186
8531
|
n.toggleAttribute("data-selected", selected?.kind === "marker" && selected.id === m.id);
|
|
8532
|
+
n.toggleAttribute("data-current", m.id === currentId);
|
|
8187
8533
|
n.title = `${m.label ? `${m.label} · ` : ""}${clock(m.time)}`;
|
|
8188
8534
|
}
|
|
8189
8535
|
placeMarkers();
|
|
@@ -8211,7 +8557,7 @@ function timeline(container, options) {
|
|
|
8211
8557
|
b.dataset.edge = "end";
|
|
8212
8558
|
const label = el("span", "knobs-tl-rlabel");
|
|
8213
8559
|
n.append(label, a, b);
|
|
8214
|
-
track.insertBefore(n,
|
|
8560
|
+
track.insertBefore(n, markerLane);
|
|
8215
8561
|
rangeEls.set(r.id, n);
|
|
8216
8562
|
if (built)
|
|
8217
8563
|
enter(n);
|
|
@@ -8260,16 +8606,17 @@ function timeline(container, options) {
|
|
|
8260
8606
|
};
|
|
8261
8607
|
const clock = (t) => units === "frames" ? `f${toFrame(t, fps)}` : `${timeLabel(t, "seconds", fps, 0.01)}`;
|
|
8262
8608
|
let shownHead = time;
|
|
8609
|
+
let currentId = null;
|
|
8263
8610
|
const renderHead = () => {
|
|
8264
8611
|
head.style.transform = `translateX(${xOf(shownHead).toFixed(2)}px)`;
|
|
8265
|
-
const main = units === "frames" ? `f${toFrame(time, fps)}` : `${time.toFixed(2)}s`;
|
|
8266
|
-
const minor = units === "frames" ? `${time.toFixed(2)}s` : `f${toFrame(time, fps)}`;
|
|
8267
|
-
if (now.textContent !== main)
|
|
8268
|
-
now.textContent = main;
|
|
8269
|
-
if (sub.textContent !== minor)
|
|
8270
|
-
sub.textContent = minor;
|
|
8271
8612
|
head.setAttribute("aria-valuenow", time.toFixed(3));
|
|
8272
8613
|
head.setAttribute("aria-valuetext", `${time.toFixed(2)} seconds, frame ${toFrame(time, fps)}`);
|
|
8614
|
+
const cur = currentMarker(markers, time, fps)?.id ?? null;
|
|
8615
|
+
if (cur !== currentId) {
|
|
8616
|
+
markerEls.get(currentId ?? "")?.removeAttribute("data-current");
|
|
8617
|
+
currentId = cur;
|
|
8618
|
+
markerEls.get(cur ?? "")?.setAttribute("data-current", "");
|
|
8619
|
+
}
|
|
8273
8620
|
};
|
|
8274
8621
|
let viewSent = "";
|
|
8275
8622
|
const render = () => {
|
|
@@ -8295,18 +8642,27 @@ function timeline(container, options) {
|
|
|
8295
8642
|
};
|
|
8296
8643
|
const caret = new Spring(time, GLIDE.omega, GLIDE.zeta, 0.00001);
|
|
8297
8644
|
let gliding = false;
|
|
8298
|
-
const
|
|
8299
|
-
const
|
|
8300
|
-
|
|
8645
|
+
const headTo = (shown, motion) => {
|
|
8646
|
+
const from = gliding ? { x: caret.x, target: caret.target } : { x: shownHead, target: shownHead };
|
|
8647
|
+
const jump = motion === "jump" && !reducedMotion(win);
|
|
8648
|
+
const next = moveHead(from, shown, jump ? "jump" : "follow", gliding, 2 / pxPerSec());
|
|
8649
|
+
if (next.catching) {
|
|
8301
8650
|
if (!gliding)
|
|
8302
|
-
caret.snap(
|
|
8303
|
-
caret.
|
|
8651
|
+
caret.snap(from.x);
|
|
8652
|
+
caret.x = next.x;
|
|
8653
|
+
caret.target = next.target;
|
|
8304
8654
|
gliding = true;
|
|
8655
|
+
shownHead = caret.x;
|
|
8305
8656
|
loop.wake();
|
|
8306
8657
|
} else {
|
|
8307
8658
|
gliding = false;
|
|
8308
|
-
|
|
8659
|
+
caret.snap(next.x);
|
|
8660
|
+
shownHead = next.x;
|
|
8309
8661
|
}
|
|
8662
|
+
};
|
|
8663
|
+
const setTime = (t, source, shown = t, glide = false) => {
|
|
8664
|
+
const next = Math.min(duration, Math.max(0, t));
|
|
8665
|
+
headTo(Math.min(duration, Math.max(0, shown)), glide ? "jump" : "follow");
|
|
8310
8666
|
const moved = next !== time;
|
|
8311
8667
|
time = next;
|
|
8312
8668
|
renderHead();
|
|
@@ -8347,8 +8703,7 @@ function timeline(container, options) {
|
|
|
8347
8703
|
options.onCross?.(m);
|
|
8348
8704
|
}
|
|
8349
8705
|
time = step.t;
|
|
8350
|
-
|
|
8351
|
-
gliding = false;
|
|
8706
|
+
headTo(time, step.wrapped ? "jump" : "follow");
|
|
8352
8707
|
emitSeek(time, "play");
|
|
8353
8708
|
keepInView();
|
|
8354
8709
|
if (step.ended) {
|
|
@@ -8361,7 +8716,7 @@ function timeline(container, options) {
|
|
|
8361
8716
|
shownHead = caret.step(dt);
|
|
8362
8717
|
if (caret.resting) {
|
|
8363
8718
|
gliding = false;
|
|
8364
|
-
shownHead =
|
|
8719
|
+
shownHead = caret.target;
|
|
8365
8720
|
}
|
|
8366
8721
|
}
|
|
8367
8722
|
vStart.step(dt);
|
|
@@ -8374,9 +8729,9 @@ function timeline(container, options) {
|
|
|
8374
8729
|
return;
|
|
8375
8730
|
const r = loopRange();
|
|
8376
8731
|
if (r && (time < r.start || time >= r.end - 0.5 / fps))
|
|
8377
|
-
setTime(r.start, "code");
|
|
8732
|
+
setTime(r.start, "code", r.start, true);
|
|
8378
8733
|
else if (!r && time >= duration - 0.5 / fps)
|
|
8379
|
-
setTime(0, "code");
|
|
8734
|
+
setTime(0, "code", 0, true);
|
|
8380
8735
|
playing = true;
|
|
8381
8736
|
syncPlay();
|
|
8382
8737
|
emitPlay(true);
|
|
@@ -8505,24 +8860,35 @@ function timeline(container, options) {
|
|
|
8505
8860
|
};
|
|
8506
8861
|
const localX = (e) => e.clientX - track.getBoundingClientRect().left;
|
|
8507
8862
|
let drag = null;
|
|
8508
|
-
const scrubTo = (x) => {
|
|
8863
|
+
const scrubTo = (x, press = false) => {
|
|
8509
8864
|
const shownX = softClamp(x, xOf(0), xOf(duration), 10);
|
|
8510
8865
|
const s = scrubTime(tOf(shownX), {
|
|
8511
8866
|
duration,
|
|
8512
8867
|
fps,
|
|
8513
8868
|
pxPerSec: pxPerSec(),
|
|
8514
|
-
stops: snapMarkers ? markers.map((m) => m.time) : [],
|
|
8869
|
+
stops: snapMarkers && !lane ? markers.map((m) => m.time) : [],
|
|
8515
8870
|
frames: snapFrames
|
|
8516
8871
|
});
|
|
8517
|
-
setTime(s.t, "scrub", s.shown);
|
|
8872
|
+
setTime(s.t, "scrub", s.shown, press);
|
|
8518
8873
|
root.toggleAttribute("data-stuck", s.stop !== null);
|
|
8519
8874
|
};
|
|
8875
|
+
const showTag = (x) => {
|
|
8876
|
+
const at = Math.min(duration, Math.max(0, tOf(x)));
|
|
8877
|
+
const text = `${at.toFixed(2)} s`;
|
|
8878
|
+
if (tag.textContent !== text)
|
|
8879
|
+
tag.textContent = text;
|
|
8880
|
+
const cx = Math.min(width, Math.max(0, x));
|
|
8881
|
+
const flip = cx > width - tag.offsetWidth - 12;
|
|
8882
|
+
tag.style.transform = `translateX(${cx.toFixed(1)}px) translateX(${flip ? "calc(-100% - 4px)" : "4px"})`;
|
|
8883
|
+
tag.dataset.on = "";
|
|
8884
|
+
};
|
|
8885
|
+
const hideTag = () => delete tag.dataset.on;
|
|
8520
8886
|
track.addEventListener("pointerdown", (e) => {
|
|
8521
8887
|
if (e.button !== 0 || editing)
|
|
8522
8888
|
return;
|
|
8523
8889
|
root.focus({ preventScroll: true });
|
|
8524
8890
|
const t = e.target;
|
|
8525
|
-
const markerEl = t.closest(".knobs-tl-marker");
|
|
8891
|
+
const markerEl = lane ? null : t.closest(".knobs-tl-marker");
|
|
8526
8892
|
const edgeEl = t.closest(".knobs-tl-edge");
|
|
8527
8893
|
const rangeEl = t.closest(".knobs-tl-range");
|
|
8528
8894
|
track.setPointerCapture(e.pointerId);
|
|
@@ -8567,13 +8933,16 @@ function timeline(container, options) {
|
|
|
8567
8933
|
root.dataset.scrubbing = "";
|
|
8568
8934
|
for (const l of listeners)
|
|
8569
8935
|
l.onScrub?.(true);
|
|
8570
|
-
scrubTo(localX(e));
|
|
8936
|
+
scrubTo(localX(e), true);
|
|
8937
|
+
showTag(localX(e));
|
|
8571
8938
|
}
|
|
8572
8939
|
e.preventDefault();
|
|
8573
8940
|
});
|
|
8574
8941
|
track.addEventListener("pointermove", (e) => {
|
|
8575
8942
|
const x = localX(e);
|
|
8576
8943
|
hover.style.transform = `translateX(${x.toFixed(1)}px)`;
|
|
8944
|
+
if (!drag || drag.kind === "scrub")
|
|
8945
|
+
showTag(x);
|
|
8577
8946
|
if (!drag)
|
|
8578
8947
|
return;
|
|
8579
8948
|
if (drag.kind === "scrub")
|
|
@@ -8619,8 +8988,10 @@ function timeline(container, options) {
|
|
|
8619
8988
|
delete root.dataset.dragging;
|
|
8620
8989
|
root.removeAttribute("data-stuck");
|
|
8621
8990
|
if (d.kind === "scrub") {
|
|
8622
|
-
|
|
8991
|
+
headTo(time, "follow");
|
|
8623
8992
|
renderHead();
|
|
8993
|
+
if (!track.matches(":hover"))
|
|
8994
|
+
hideTag();
|
|
8624
8995
|
for (const l of listeners)
|
|
8625
8996
|
l.onScrub?.(false);
|
|
8626
8997
|
if (d.wasPlaying)
|
|
@@ -8633,7 +9004,7 @@ function timeline(container, options) {
|
|
|
8633
9004
|
} else {
|
|
8634
9005
|
const m = markers.find((x) => x.id === d.id);
|
|
8635
9006
|
if (m)
|
|
8636
|
-
setTime(m.time, "marker");
|
|
9007
|
+
setTime(m.time, "marker", m.time, true);
|
|
8637
9008
|
}
|
|
8638
9009
|
} else if (d.kind === "edge" || d.moved)
|
|
8639
9010
|
emitRanges();
|
|
@@ -8642,10 +9013,14 @@ function timeline(container, options) {
|
|
|
8642
9013
|
track.addEventListener("pointercancel", endDrag);
|
|
8643
9014
|
track.addEventListener("lostpointercapture", endDrag);
|
|
8644
9015
|
track.addEventListener("pointerleave", () => {
|
|
8645
|
-
if (
|
|
8646
|
-
|
|
9016
|
+
if (drag)
|
|
9017
|
+
return;
|
|
9018
|
+
hover.style.transform = "translateX(-100px)";
|
|
9019
|
+
hideTag();
|
|
8647
9020
|
});
|
|
8648
9021
|
track.addEventListener("dblclick", (e) => {
|
|
9022
|
+
if (lane)
|
|
9023
|
+
return;
|
|
8649
9024
|
const markerEl = e.target.closest(".knobs-tl-marker");
|
|
8650
9025
|
if (markerEl)
|
|
8651
9026
|
return rename(markerEl.dataset.id);
|
|
@@ -8656,6 +9031,8 @@ function timeline(container, options) {
|
|
|
8656
9031
|
rename(m.id);
|
|
8657
9032
|
});
|
|
8658
9033
|
track.addEventListener("wheel", (e) => {
|
|
9034
|
+
if (lane)
|
|
9035
|
+
return;
|
|
8659
9036
|
e.preventDefault();
|
|
8660
9037
|
const scale = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? height : 1;
|
|
8661
9038
|
if (e.ctrlKey || e.metaKey) {
|
|
@@ -8719,7 +9096,7 @@ function timeline(container, options) {
|
|
|
8719
9096
|
if (!m)
|
|
8720
9097
|
return;
|
|
8721
9098
|
select({ kind: "marker", id: m.id });
|
|
8722
|
-
return setTime(m.time, "marker");
|
|
9099
|
+
return setTime(m.time, "marker", m.time, true);
|
|
8723
9100
|
}
|
|
8724
9101
|
case "i":
|
|
8725
9102
|
case "I":
|
|
@@ -8731,11 +9108,13 @@ function timeline(container, options) {
|
|
|
8731
9108
|
return setEdge("end", time);
|
|
8732
9109
|
case "m":
|
|
8733
9110
|
case "M":
|
|
9111
|
+
if (lane)
|
|
9112
|
+
return;
|
|
8734
9113
|
claim();
|
|
8735
9114
|
addMarker(time);
|
|
8736
9115
|
return;
|
|
8737
9116
|
case "Enter":
|
|
8738
|
-
if (selected?.kind === "marker") {
|
|
9117
|
+
if (selected?.kind === "marker" && !lane) {
|
|
8739
9118
|
claim();
|
|
8740
9119
|
rename(selected.id);
|
|
8741
9120
|
}
|
|
@@ -8753,19 +9132,25 @@ function timeline(container, options) {
|
|
|
8753
9132
|
return;
|
|
8754
9133
|
case "=":
|
|
8755
9134
|
case "+":
|
|
9135
|
+
if (lane)
|
|
9136
|
+
return;
|
|
8756
9137
|
claim();
|
|
8757
9138
|
return zoom(1.5);
|
|
8758
9139
|
case "-":
|
|
9140
|
+
if (lane)
|
|
9141
|
+
return;
|
|
8759
9142
|
claim();
|
|
8760
9143
|
return zoom(1 / 1.5);
|
|
8761
9144
|
case "0":
|
|
9145
|
+
if (lane)
|
|
9146
|
+
return;
|
|
8762
9147
|
claim();
|
|
8763
9148
|
return fit();
|
|
8764
9149
|
}
|
|
8765
9150
|
});
|
|
8766
9151
|
const unregisterHints = options.hints === false ? undefined : hints.register(root, () => [
|
|
8767
9152
|
{ el: playBtn, label: playing ? "Pause" : "Play", activate: toggle },
|
|
8768
|
-
...markers.flatMap((m) => {
|
|
9153
|
+
...(lane ? [] : markers).flatMap((m) => {
|
|
8769
9154
|
const n = markerEls.get(m.id);
|
|
8770
9155
|
if (!n || n.dataset.leaving !== undefined)
|
|
8771
9156
|
return [];
|
|
@@ -8777,7 +9162,7 @@ function timeline(container, options) {
|
|
|
8777
9162
|
...label && !label.hidden ? { labelEl: label } : {},
|
|
8778
9163
|
activate: () => {
|
|
8779
9164
|
select({ kind: "marker", id: m.id });
|
|
8780
|
-
setTime(m.time, "marker");
|
|
9165
|
+
setTime(m.time, "marker", m.time, true);
|
|
8781
9166
|
root.focus({ preventScroll: true });
|
|
8782
9167
|
}
|
|
8783
9168
|
}
|
|
@@ -8789,7 +9174,7 @@ function timeline(container, options) {
|
|
|
8789
9174
|
activate: () => root.focus({ preventScroll: true })
|
|
8790
9175
|
}
|
|
8791
9176
|
], { listen: false, rank: 1 });
|
|
8792
|
-
const menu = contextMenu(track, (e) => {
|
|
9177
|
+
const menu = lane ? null : contextMenu(track, (e) => {
|
|
8793
9178
|
const t = e?.target ?? null;
|
|
8794
9179
|
const markerEl = t?.closest(".knobs-tl-marker");
|
|
8795
9180
|
const rangeEl = t?.closest(".knobs-tl-range");
|
|
@@ -8804,7 +9189,7 @@ function timeline(container, options) {
|
|
|
8804
9189
|
run: () => {
|
|
8805
9190
|
const m = markers.find((x) => x.id === mid);
|
|
8806
9191
|
if (m)
|
|
8807
|
-
setTime(m.time, "marker");
|
|
9192
|
+
setTime(m.time, "marker", m.time, true);
|
|
8808
9193
|
}
|
|
8809
9194
|
},
|
|
8810
9195
|
{ label: "Rename…", shortcut: "Enter", run: () => rename(mid) },
|
|
@@ -8968,7 +9353,7 @@ function timeline(container, options) {
|
|
|
8968
9353
|
listeners.clear();
|
|
8969
9354
|
loop.stop();
|
|
8970
9355
|
ro.disconnect();
|
|
8971
|
-
menu
|
|
9356
|
+
menu?.dispose();
|
|
8972
9357
|
root.remove();
|
|
8973
9358
|
}
|
|
8974
9359
|
};
|
|
@@ -8985,10 +9370,21 @@ var init_timeline = __esm(() => {
|
|
|
8985
9370
|
init_timeline_model();
|
|
8986
9371
|
INSTANT2 = springMotion(SPRINGS.instant);
|
|
8987
9372
|
CALM = springMotion(SPRINGS.calm);
|
|
8988
|
-
GLIDE = springMotion(
|
|
9373
|
+
GLIDE = springMotion(CATCH_UP);
|
|
8989
9374
|
});
|
|
8990
9375
|
|
|
8991
9376
|
// src/ui/compare-model.ts
|
|
9377
|
+
function compareModes(modes, mode) {
|
|
9378
|
+
const list = [...new Set((modes ?? ["side", "wipe"]).filter((m) => ALL_MODES.includes(m)))];
|
|
9379
|
+
const offered = list.length ? list : ["side", "wipe"];
|
|
9380
|
+
return { modes: offered, mode: mode && offered.includes(mode) ? mode : offered[0] };
|
|
9381
|
+
}
|
|
9382
|
+
function modeForKey(key, modes) {
|
|
9383
|
+
const k = key.toLowerCase();
|
|
9384
|
+
if (/^[1-9]$/.test(k))
|
|
9385
|
+
return modes[Number(k) - 1] ?? null;
|
|
9386
|
+
return modes.find((m) => MODE_KEYS[m] === k) ?? null;
|
|
9387
|
+
}
|
|
8992
9388
|
function mediaKind(src, kind) {
|
|
8993
9389
|
if (kind)
|
|
8994
9390
|
return kind;
|
|
@@ -9067,6 +9463,18 @@ function wipeGrab(x, rect, wipe, slop = 12) {
|
|
|
9067
9463
|
const onLine = Math.abs(x - line) <= slop;
|
|
9068
9464
|
return { onLine, offset: onLine ? x - line : 0 };
|
|
9069
9465
|
}
|
|
9466
|
+
function seamLabels(x, left, right, wb, wa, gap = 8) {
|
|
9467
|
+
const room = (space, w) => Math.min(1, Math.max(0, (space - w - 2 * gap) / gap));
|
|
9468
|
+
return {
|
|
9469
|
+
before: { x: x - gap - wb, opacity: room(x - left, wb) },
|
|
9470
|
+
after: { x: x + gap, opacity: room(right - x, wa) }
|
|
9471
|
+
};
|
|
9472
|
+
}
|
|
9473
|
+
function gripTop(y, rect, grip, margin = 8) {
|
|
9474
|
+
const lo = rect.y + margin;
|
|
9475
|
+
const hi = rect.y + rect.h - margin - grip;
|
|
9476
|
+
return hi < lo ? rect.y + (rect.h - grip) / 2 : Math.min(hi, Math.max(lo, y - grip / 2));
|
|
9477
|
+
}
|
|
9070
9478
|
function stripColumns(view, width, o) {
|
|
9071
9479
|
const { fps } = o;
|
|
9072
9480
|
const total = Math.max(1, Math.round(o.duration * fps));
|
|
@@ -9117,7 +9525,7 @@ function stripPeaks(diffs, o = {}) {
|
|
|
9117
9525
|
});
|
|
9118
9526
|
return out;
|
|
9119
9527
|
}
|
|
9120
|
-
var VIDEO, frameOf = (t, fps) => Math.max(0, Math.floor(t * fps + 0.0001)), lastFrame = (duration, fps) => Math.max(0, Math.ceil(duration * fps - 0.0001) - 1), sameFrame = (a, b, fps) => frameOf(a, fps) === frameOf(b, fps), SEEK_IDLE, splitHeight = (w, media) => media.w > 0 && media.h > 0 ? w / 2 * (media.h / media.w) : w / 2 * (9 / 16), ZOOM_FIT, ZOOM_MAX = 16, panBy = (r, dx, dy, base) => clampZoom({
|
|
9528
|
+
var ALL_MODES, MODE_KEYS, modeKey = (mode) => MODE_KEYS[mode].toUpperCase(), VIDEO, frameOf = (t, fps) => Math.max(0, Math.floor(t * fps + 0.0001)), lastFrame = (duration, fps) => Math.max(0, Math.ceil(duration * fps - 0.0001) - 1), sameFrame = (a, b, fps) => frameOf(a, fps) === frameOf(b, fps), SEEK_IDLE, splitHeight = (w, media) => media.w > 0 && media.h > 0 ? w / 2 * (media.h / media.w) : w / 2 * (9 / 16), ZOOM_FIT, ZOOM_MAX = 16, panBy = (r, dx, dy, base) => clampZoom({
|
|
9121
9529
|
u: r.u - dx / Math.max(1, base.w) * r.w,
|
|
9122
9530
|
v: r.v - dy / Math.max(1, base.h) * r.h,
|
|
9123
9531
|
w: r.w
|
|
@@ -9136,6 +9544,8 @@ var VIDEO, frameOf = (t, fps) => Math.max(0, Math.floor(t * fps + 0.0001)), last
|
|
|
9136
9544
|
h: a.h + (b.h - a.h) * k
|
|
9137
9545
|
}), wipeX = (rect, wipe) => rect.x + Math.min(1, Math.max(0, wipe)) * rect.w, wipeAt = (x, rect, offset = 0) => rect.w <= 0 ? 0.5 : Math.min(1, Math.max(0, (x - offset - rect.x) / rect.w)), wipeKey = (wipe, dir, big = false) => Math.min(1, Math.max(0, Math.round((wipe + dir * (big ? 0.1 : 0.01)) * 1000) / 1000));
|
|
9138
9546
|
var init_compare_model = __esm(() => {
|
|
9547
|
+
ALL_MODES = ["side", "wipe", "difference"];
|
|
9548
|
+
MODE_KEYS = { side: "s", wipe: "w", difference: "d" };
|
|
9139
9549
|
VIDEO = /\.(mp4|m4v|mov|webm|ogv|mkv)$/i;
|
|
9140
9550
|
SEEK_IDLE = { seeking: false, pending: null };
|
|
9141
9551
|
ZOOM_FIT = { u: 0, v: 0, w: 1, h: 1 };
|
|
@@ -9935,8 +10345,8 @@ async function createCompareGpu(canvas, onLost) {
|
|
|
9935
10345
|
r(0, f.before);
|
|
9936
10346
|
r(4, f.after);
|
|
9937
10347
|
data.set([f.width, f.height, f.dpr, 0], 8);
|
|
9938
|
-
data.set([f.wipeX, f.soft, 0,
|
|
9939
|
-
data.set([f.from, f.to, f.mix,
|
|
10348
|
+
data.set([f.wipeX, f.soft, 0, 0], 12);
|
|
10349
|
+
data.set([f.from, f.to, f.mix, 0], 16);
|
|
9940
10350
|
data.set([f.threshold, f.gain, ready[0], ready[1]], 20);
|
|
9941
10351
|
data.set([f.accent[0], f.accent[1], f.accent[2], 1], 24);
|
|
9942
10352
|
const l = f.loupe;
|
|
@@ -9978,8 +10388,8 @@ var MODE_INDEX, WGSL = `
|
|
|
9978
10388
|
struct U {
|
|
9979
10389
|
ra: vec4f, rb: vec4f,
|
|
9980
10390
|
view: vec4f, // w, h, dpr, _
|
|
9981
|
-
wipe: vec4f, // x, soft, _,
|
|
9982
|
-
modes: vec4f, // from, to, mix,
|
|
10391
|
+
wipe: vec4f, // x, soft, _, _
|
|
10392
|
+
modes: vec4f, // from, to, mix, _
|
|
9983
10393
|
diff: vec4f, // threshold, gain, readyA, readyB
|
|
9984
10394
|
accent: vec4f,
|
|
9985
10395
|
loupe: vec4f, // x, y, r, zoom (0: none)
|
|
@@ -10030,21 +10440,14 @@ fn takeB(p: vec2f, r: vec4f, c0: vec4f, near: bool) -> vec4f {
|
|
|
10030
10440
|
|
|
10031
10441
|
fn pm(c: vec4f) -> vec4f { return vec4f(c.rgb * c.a, c.a); }
|
|
10032
10442
|
|
|
10033
|
-
fn composite(mode: u32, p: vec2f, a: vec4f, b: vec4f
|
|
10034
|
-
let flick = u.modes.w > 0.5;
|
|
10443
|
+
fn composite(mode: u32, p: vec2f, a: vec4f, b: vec4f) -> vec4f {
|
|
10035
10444
|
switch mode {
|
|
10036
|
-
case 0u: {
|
|
10037
|
-
let bb = select(b, vec4f(a2.rgb, b.a), flick);
|
|
10038
|
-
return vec4f(a.rgb * a.a + bb.rgb * bb.a * (1.0 - a.a), a.a + bb.a * (1.0 - a.a));
|
|
10039
|
-
}
|
|
10040
10445
|
case 1u: {
|
|
10041
|
-
if (flick) { return pm(a); }
|
|
10042
10446
|
let s = max(u.wipe.y, 0.5);
|
|
10043
10447
|
let m = smoothstep(u.wipe.x - s, u.wipe.x + s, p.x);
|
|
10044
10448
|
return pm(vec4f(mix(a.rgb, b.rgb, m), mix(a.a, b.a, m)));
|
|
10045
10449
|
}
|
|
10046
10450
|
case 2u: {
|
|
10047
|
-
if (flick) { return pm(a); }
|
|
10048
10451
|
let d = abs(a.rgb - b.rgb);
|
|
10049
10452
|
let h = smoothstep(u.diff.x, u.diff.x + 0.06, max(d.r, max(d.g, d.b)) * u.diff.y) * min(a.a, b.a);
|
|
10050
10453
|
let c = mix(vec3f(luma(b.rgb) * 0.35), u.accent.rgb, h);
|
|
@@ -10052,8 +10455,8 @@ fn composite(mode: u32, p: vec2f, a: vec4f, b: vec4f, a2: vec4f) -> vec4f {
|
|
|
10052
10455
|
}
|
|
10053
10456
|
default: {}
|
|
10054
10457
|
}
|
|
10055
|
-
//
|
|
10056
|
-
return
|
|
10458
|
+
// Side by side: each side in its own place, Before over After where they meet.
|
|
10459
|
+
return vec4f(a.rgb * a.a + b.rgb * b.a * (1.0 - a.a), a.a + b.a * (1.0 - a.a));
|
|
10057
10460
|
}
|
|
10058
10461
|
|
|
10059
10462
|
@fragment fn fs(@builtin(position) q: vec4f) -> @location(0) vec4f {
|
|
@@ -10071,16 +10474,14 @@ fn composite(mode: u32, p: vec2f, a: vec4f, b: vec4f, a2: vec4f) -> vec4f {
|
|
|
10071
10474
|
}
|
|
10072
10475
|
let a = takeA(p, u.ra, u.ca, near);
|
|
10073
10476
|
let b = takeB(p, u.rb, u.cb, near);
|
|
10074
|
-
|
|
10075
|
-
let a2 = takeA(p, u.rb, u.cb, near);
|
|
10076
|
-
var o = mix(composite(u32(u.modes.x), p, a, b, a2), composite(u32(u.modes.y), p, a, b, a2), u.modes.z);
|
|
10477
|
+
var o = mix(composite(u32(u.modes.x), p, a, b), composite(u32(u.modes.y), p, a, b), u.modes.z);
|
|
10077
10478
|
if (near) { o = o + vec4f(0.05, 0.05, 0.06, 1.0) * (1.0 - o.a); }
|
|
10078
10479
|
o = mix(o, vec4f(0.92), ring * 0.9);
|
|
10079
10480
|
return o;
|
|
10080
10481
|
}
|
|
10081
10482
|
`, TEXTURE_BINDING = 4, COPY_DST = 2, RENDER_ATTACHMENT = 16, shared = null, lostListeners;
|
|
10082
10483
|
var init_compare_gpu = __esm(() => {
|
|
10083
|
-
MODE_INDEX = { side: 0, wipe: 1, difference: 2
|
|
10484
|
+
MODE_INDEX = { side: 0, wipe: 1, difference: 2 };
|
|
10084
10485
|
lostListeners = new Set;
|
|
10085
10486
|
});
|
|
10086
10487
|
|
|
@@ -10466,7 +10867,9 @@ function compare(container, options) {
|
|
|
10466
10867
|
...options.theme ? { theme: options.theme } : {},
|
|
10467
10868
|
...options.appearance ? { appearance: options.appearance } : {}
|
|
10468
10869
|
};
|
|
10469
|
-
|
|
10870
|
+
const offered = compareModes(options.modes, options.mode);
|
|
10871
|
+
const modeList = offered.modes;
|
|
10872
|
+
let mode = offered.mode;
|
|
10470
10873
|
let wipe = Math.min(1, Math.max(0, options.wipe ?? 0.5));
|
|
10471
10874
|
let loupeOn = options.loupe ?? false;
|
|
10472
10875
|
let threshold = options.threshold ?? 4 / 255;
|
|
@@ -10484,7 +10887,7 @@ function compare(container, options) {
|
|
|
10484
10887
|
root.setAttribute("role", "group");
|
|
10485
10888
|
root.setAttribute("aria-roledescription", "compare");
|
|
10486
10889
|
root.setAttribute("aria-label", options.label ?? "Compare");
|
|
10487
|
-
root.setAttribute("aria-keyshortcuts",
|
|
10890
|
+
root.setAttribute("aria-keyshortcuts", `Space ArrowLeft ArrowRight Shift+ArrowLeft Shift+ArrowRight , . ${modeList.map((m, i) => `${i + 1} ${modeKey(m)}`).join(" ")} Z L 0 = -`);
|
|
10488
10891
|
applyLook2(root, options);
|
|
10489
10892
|
root.dataset.mode = mode;
|
|
10490
10893
|
if (auto)
|
|
@@ -10493,35 +10896,37 @@ function compare(container, options) {
|
|
|
10493
10896
|
const modes = el("div", "knobs-cmp-modes");
|
|
10494
10897
|
modes.setAttribute("role", "radiogroup");
|
|
10495
10898
|
modes.setAttribute("aria-label", "Mode");
|
|
10496
|
-
|
|
10899
|
+
modes.hidden = modeList.length < 2;
|
|
10900
|
+
const modeBtns = modeList.map((m, i) => {
|
|
10497
10901
|
const b = el("button", "knobs-cmp-mode");
|
|
10498
10902
|
b.type = "button";
|
|
10499
10903
|
b.tabIndex = -1;
|
|
10500
|
-
b.textContent = m.
|
|
10501
|
-
b.title = `${m.
|
|
10904
|
+
b.textContent = MODE_LABEL[m].short;
|
|
10905
|
+
b.title = `${MODE_LABEL[m].long} · ${i + 1} or ${modeKey(m)}`;
|
|
10502
10906
|
b.setAttribute("role", "radio");
|
|
10503
|
-
b.setAttribute("aria-keyshortcuts",
|
|
10907
|
+
b.setAttribute("aria-keyshortcuts", `${i + 1} ${modeKey(m)}`);
|
|
10504
10908
|
b.addEventListener("click", () => {
|
|
10505
|
-
setMode(m
|
|
10909
|
+
setMode(m);
|
|
10506
10910
|
root.focus({ preventScroll: true });
|
|
10507
10911
|
});
|
|
10508
10912
|
modes.append(b);
|
|
10509
10913
|
return b;
|
|
10510
10914
|
});
|
|
10511
|
-
const
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10915
|
+
const toggleBtn = (name, label, title) => {
|
|
10916
|
+
const b = el("button", "knobs-cmp-toggle");
|
|
10917
|
+
b.type = "button";
|
|
10918
|
+
b.tabIndex = -1;
|
|
10919
|
+
b.innerHTML = icon(name);
|
|
10920
|
+
b.setAttribute("aria-label", label);
|
|
10921
|
+
b.title = title;
|
|
10922
|
+
return b;
|
|
10923
|
+
};
|
|
10924
|
+
const loupeBtn = toggleBtn("magnifyingGlass", "Loupe", "Loupe · hold Z");
|
|
10516
10925
|
loupeBtn.addEventListener("click", () => {
|
|
10517
10926
|
setLoupe(!loupeOn);
|
|
10518
10927
|
root.focus({ preventScroll: true });
|
|
10519
10928
|
});
|
|
10520
|
-
const loopBtn =
|
|
10521
|
-
loopBtn.type = "button";
|
|
10522
|
-
loopBtn.tabIndex = -1;
|
|
10523
|
-
loopBtn.textContent = "Loop";
|
|
10524
|
-
loopBtn.title = "Loop · L (drag its ends on the timeline)";
|
|
10929
|
+
const loopBtn = toggleBtn("repeat", "Loop", "Loop · L (drag its ends on the timeline)");
|
|
10525
10930
|
loopBtn.setAttribute("aria-keyshortcuts", "L");
|
|
10526
10931
|
loopBtn.addEventListener("click", () => {
|
|
10527
10932
|
api.setLoop(!loopNow());
|
|
@@ -10538,7 +10943,8 @@ function compare(container, options) {
|
|
|
10538
10943
|
const zoomReset = el("button", "knobs-cmp-zoom-reset");
|
|
10539
10944
|
zoomReset.type = "button";
|
|
10540
10945
|
zoomReset.tabIndex = -1;
|
|
10541
|
-
zoomReset.
|
|
10946
|
+
zoomReset.innerHTML = icon("arrowCounterClockwise", { small: true });
|
|
10947
|
+
zoomReset.setAttribute("aria-label", "Reset zoom");
|
|
10542
10948
|
zoomReset.title = "Fit · 0 or double-click";
|
|
10543
10949
|
zoomReset.addEventListener("click", () => {
|
|
10544
10950
|
api.setZoom(null);
|
|
@@ -10553,6 +10959,9 @@ function compare(container, options) {
|
|
|
10553
10959
|
handle.setAttribute("aria-label", "Wipe");
|
|
10554
10960
|
handle.setAttribute("aria-valuemin", "0");
|
|
10555
10961
|
handle.setAttribute("aria-valuemax", "100");
|
|
10962
|
+
const grip = el("span", "knobs-cmp-grip");
|
|
10963
|
+
grip.setAttribute("aria-hidden", "true");
|
|
10964
|
+
handle.append(grip);
|
|
10556
10965
|
const note = el("div", "knobs-cmp-note");
|
|
10557
10966
|
stage.append(canvas, split, labels[0], labels[1], handle, zoomPill, note);
|
|
10558
10967
|
root.append(bar, stage);
|
|
@@ -10569,6 +10978,7 @@ function compare(container, options) {
|
|
|
10569
10978
|
root.append(host);
|
|
10570
10979
|
tl = timeline(host, {
|
|
10571
10980
|
...look,
|
|
10981
|
+
variant: "lane",
|
|
10572
10982
|
duration: 1,
|
|
10573
10983
|
fps: fps(),
|
|
10574
10984
|
arrows: { step: 0.5, shift: 2 },
|
|
@@ -10587,9 +10997,9 @@ function compare(container, options) {
|
|
|
10587
10997
|
const fade = new Spring(1, FADE6.omega, FADE6.zeta, 0.001);
|
|
10588
10998
|
let fromMode = mode;
|
|
10589
10999
|
let toMode = mode;
|
|
10590
|
-
|
|
10591
|
-
let
|
|
10592
|
-
let
|
|
11000
|
+
const wipeLine = new Spring(wipe, WIPE_CATCH.omega, WIPE_CATCH.zeta, 0.0001);
|
|
11001
|
+
let wipeCatching = false;
|
|
11002
|
+
let gripY = null;
|
|
10593
11003
|
let loupeHeld = false;
|
|
10594
11004
|
let pointer = null;
|
|
10595
11005
|
let drag = null;
|
|
@@ -10907,25 +11317,16 @@ function compare(container, options) {
|
|
|
10907
11317
|
gpu = g;
|
|
10908
11318
|
setRenderer("gpu");
|
|
10909
11319
|
};
|
|
10910
|
-
const syncFlicker = () => {
|
|
10911
|
-
win.clearInterval(flickerTimer);
|
|
10912
|
-
flickerTimer = 0;
|
|
10913
|
-
phase = false;
|
|
10914
|
-
if (mode === "flicker")
|
|
10915
|
-
flickerTimer = win.setInterval(() => {
|
|
10916
|
-
phase = !phase;
|
|
10917
|
-
requestDraw();
|
|
10918
|
-
}, FLICKER_MS);
|
|
10919
|
-
};
|
|
10920
11320
|
const syncModeUi = () => {
|
|
10921
11321
|
root.dataset.mode = mode;
|
|
10922
|
-
|
|
10923
|
-
modeBtns[i].setAttribute("aria-checked", String(m
|
|
11322
|
+
modeList.forEach((m, i) => {
|
|
11323
|
+
modeBtns[i].setAttribute("aria-checked", String(m === mode));
|
|
10924
11324
|
});
|
|
10925
11325
|
handle.tabIndex = mode === "wipe" ? 0 : -1;
|
|
11326
|
+
modePill?.update();
|
|
10926
11327
|
};
|
|
10927
11328
|
const setMode = (next, emit = true) => {
|
|
10928
|
-
if (next === mode)
|
|
11329
|
+
if (next === mode || !modeList.includes(next))
|
|
10929
11330
|
return;
|
|
10930
11331
|
mode = next;
|
|
10931
11332
|
const reduced = reducedMotion(win);
|
|
@@ -10941,19 +11342,29 @@ function compare(container, options) {
|
|
|
10941
11342
|
else
|
|
10942
11343
|
lay.set(next === "side" ? 0 : 1);
|
|
10943
11344
|
syncModeUi();
|
|
10944
|
-
syncFlicker();
|
|
10945
11345
|
if (emit)
|
|
10946
11346
|
options.onMode?.(next);
|
|
10947
11347
|
requestDraw();
|
|
10948
11348
|
};
|
|
10949
|
-
const setWipe = (next, emit = true) => {
|
|
11349
|
+
const setWipe = (next, emit = true, jump = false) => {
|
|
10950
11350
|
const w = Math.min(1, Math.max(0, next));
|
|
10951
|
-
if (w === wipe)
|
|
11351
|
+
if (w === wipe && !jump)
|
|
10952
11352
|
return;
|
|
10953
11353
|
wipe = w;
|
|
11354
|
+
const minGap = 2 / Math.max(1, wipeRect(layoutNow().L.overlay).w);
|
|
11355
|
+
const head = moveHead({ x: wipeLine.x, target: wipeLine.target }, w, jump && !reducedMotion(win) ? "jump" : "follow", wipeCatching, minGap);
|
|
11356
|
+
wipeCatching = head.catching;
|
|
11357
|
+
if (head.catching) {
|
|
11358
|
+
wipeLine.x = head.x;
|
|
11359
|
+
wipeLine.target = head.target;
|
|
11360
|
+
} else
|
|
11361
|
+
wipeLine.snap(head.x);
|
|
10954
11362
|
if (emit)
|
|
10955
11363
|
options.onWipe?.(w);
|
|
10956
|
-
|
|
11364
|
+
if (head.catching)
|
|
11365
|
+
requestDraw();
|
|
11366
|
+
else
|
|
11367
|
+
drawNow();
|
|
10957
11368
|
};
|
|
10958
11369
|
const setLoupe = (on) => {
|
|
10959
11370
|
loupeOn = on;
|
|
@@ -11106,28 +11517,44 @@ function compare(container, options) {
|
|
|
11106
11517
|
viewSent = key;
|
|
11107
11518
|
options.onView({ zoom: clampZoom(z), loop: l });
|
|
11108
11519
|
};
|
|
11520
|
+
const labelsIn = (m, r, wr, wx) => {
|
|
11521
|
+
if (m === "wipe") {
|
|
11522
|
+
const at = seamLabels(wx, wr.x, wr.x + wr.w, labelW[0], labelW[1], INSET);
|
|
11523
|
+
return [at.before, at.after];
|
|
11524
|
+
}
|
|
11525
|
+
const ax = r.after.x + INSET + (r.after.w - labelW[1] - INSET * 2) * lay.x;
|
|
11526
|
+
return [
|
|
11527
|
+
{ x: r.before.x + INSET, opacity: 1 },
|
|
11528
|
+
{ x: ax, opacity: 1 }
|
|
11529
|
+
];
|
|
11530
|
+
};
|
|
11531
|
+
const placeGrip = (wr) => {
|
|
11532
|
+
const gy = gripTop(gripY ?? wr.y + wr.h / 2, wr, GRIP.h) - wr.y;
|
|
11533
|
+
grip.style.transform = `translate3d(0,${gy.toFixed(2)}px,0)`;
|
|
11534
|
+
};
|
|
11109
11535
|
const draw = () => {
|
|
11110
11536
|
dirty = false;
|
|
11111
11537
|
const r = layoutNow();
|
|
11112
11538
|
const wr = wipeRect(r.L.overlay);
|
|
11113
|
-
const wx = wipeX(wr,
|
|
11539
|
+
const wx = wipeX(wr, wipeLine.x);
|
|
11114
11540
|
const k = lay.x;
|
|
11115
|
-
const
|
|
11116
|
-
|
|
11117
|
-
|
|
11118
|
-
const
|
|
11119
|
-
const
|
|
11120
|
-
|
|
11121
|
-
|
|
11122
|
-
|
|
11123
|
-
|
|
11541
|
+
const a = labelsIn(fromMode, r, wr, wx);
|
|
11542
|
+
const b = labelsIn(toMode, r, wr, wx);
|
|
11543
|
+
const f = Math.min(1, Math.max(0, fade.x));
|
|
11544
|
+
const ys = [r.before.y + INSET, r.after.y + INSET];
|
|
11545
|
+
for (const i of [0, 1]) {
|
|
11546
|
+
const x = a[i].x + (b[i].x - a[i].x) * f;
|
|
11547
|
+
labels[i].style.transform = `translate(${x.toFixed(2)}px,${ys[i].toFixed(2)}px)`;
|
|
11548
|
+
labels[i].style.opacity = (a[i].opacity + (b[i].opacity - a[i].opacity) * f).toFixed(3);
|
|
11549
|
+
}
|
|
11124
11550
|
const top = Math.min(r.L.side.before.y, r.L.side.after.y);
|
|
11125
11551
|
split.style.transform = `translate(${r.L.side.split.toFixed(2)}px,${top.toFixed(2)}px)`;
|
|
11126
11552
|
split.style.height = `${Math.max(0, r.L.side.after.h).toFixed(2)}px`;
|
|
11127
11553
|
split.style.opacity = String(Math.max(0, 1 - k * 2));
|
|
11128
|
-
handle.toggleAttribute("data-on", mode === "wipe"
|
|
11554
|
+
handle.toggleAttribute("data-on", mode === "wipe");
|
|
11129
11555
|
handle.style.transform = `translate(${wx.toFixed(2)}px,${wr.y.toFixed(2)}px)`;
|
|
11130
11556
|
handle.style.height = `${Math.max(0, wr.h).toFixed(2)}px`;
|
|
11557
|
+
placeGrip(wr);
|
|
11131
11558
|
handle.setAttribute("aria-valuenow", String(Math.round(wipe * 100)));
|
|
11132
11559
|
handle.setAttribute("aria-valuetext", `${Math.round(wipe * 100)}% Before`);
|
|
11133
11560
|
const pct = `${Math.round(100 / zw.x)}%`;
|
|
@@ -11150,7 +11577,7 @@ function compare(container, options) {
|
|
|
11150
11577
|
const right = Math.max(0, rect.x + rect.w - Math.min(clip.x + clip.w, cutAt));
|
|
11151
11578
|
st.clipPath = t + l + b + right > 0.01 ? `inset(${t.toFixed(2)}px ${right.toFixed(2)}px ${b.toFixed(2)}px ${l.toFixed(2)}px)` : "";
|
|
11152
11579
|
};
|
|
11153
|
-
const cut = mode === "wipe"
|
|
11580
|
+
const cut = mode === "wipe" ? wx : Number.POSITIVE_INFINITY;
|
|
11154
11581
|
for (const s of sides) {
|
|
11155
11582
|
const rect = s.index === 0 ? r.zBefore : r.zAfter;
|
|
11156
11583
|
const clip = s.index === 0 ? r.before : r.after;
|
|
@@ -11159,10 +11586,8 @@ function compare(container, options) {
|
|
|
11159
11586
|
place(s.preview, rect, clip, at);
|
|
11160
11587
|
if (s.index !== 0)
|
|
11161
11588
|
continue;
|
|
11162
|
-
for (const n of [s.el, s.preview])
|
|
11163
|
-
n.style.mixBlendMode = mode === "difference"
|
|
11164
|
-
n.style.opacity = mode === "flicker" && !showsBefore ? "0" : "";
|
|
11165
|
-
}
|
|
11589
|
+
for (const n of [s.el, s.preview])
|
|
11590
|
+
n.style.mixBlendMode = mode === "difference" ? "difference" : "";
|
|
11166
11591
|
}
|
|
11167
11592
|
return;
|
|
11168
11593
|
}
|
|
@@ -11183,8 +11608,6 @@ function compare(container, options) {
|
|
|
11183
11608
|
from: MODE_INDEX[fromMode],
|
|
11184
11609
|
to: MODE_INDEX[toMode],
|
|
11185
11610
|
mix: Math.min(1, Math.max(0, fade.x)),
|
|
11186
|
-
flick: flickHeld,
|
|
11187
|
-
phase,
|
|
11188
11611
|
threshold,
|
|
11189
11612
|
gain: 1,
|
|
11190
11613
|
accent,
|
|
@@ -11200,6 +11623,11 @@ function compare(container, options) {
|
|
|
11200
11623
|
const loop = frameLoop(win, (dt) => {
|
|
11201
11624
|
lay.step(dt);
|
|
11202
11625
|
fade.step(dt);
|
|
11626
|
+
if (wipeCatching) {
|
|
11627
|
+
wipeLine.step(dt);
|
|
11628
|
+
if (wipeLine.resting)
|
|
11629
|
+
wipeCatching = false;
|
|
11630
|
+
}
|
|
11203
11631
|
zu.step(dt);
|
|
11204
11632
|
zv.step(dt);
|
|
11205
11633
|
zw.step(dt);
|
|
@@ -11233,7 +11661,7 @@ function compare(container, options) {
|
|
|
11233
11661
|
pushFrame(s);
|
|
11234
11662
|
}
|
|
11235
11663
|
}
|
|
11236
|
-
const moving = !lay.resting || !fade.resting || !zoomResting();
|
|
11664
|
+
const moving = !lay.resting || !fade.resting || !zoomResting() || wipeCatching;
|
|
11237
11665
|
if (moving)
|
|
11238
11666
|
dirty = true;
|
|
11239
11667
|
if (auto && !lay.resting)
|
|
@@ -11376,16 +11804,19 @@ function compare(container, options) {
|
|
|
11376
11804
|
e.preventDefault();
|
|
11377
11805
|
return startPinch();
|
|
11378
11806
|
}
|
|
11379
|
-
if (mode === "wipe"
|
|
11807
|
+
if (mode === "wipe") {
|
|
11380
11808
|
const wr = wipeRect(layoutNow().L.overlay);
|
|
11381
11809
|
const inside = p.x >= wr.x - SLOP && p.x <= wr.x + wr.w + SLOP && p.y >= wr.y && p.y <= wr.y + wr.h;
|
|
11382
|
-
const grab = wipeGrab(p.x, wr,
|
|
11810
|
+
const grab = wipeGrab(p.x, wr, wipeLine.x, SLOP);
|
|
11383
11811
|
if (inside && (grab.onLine || !zoomed())) {
|
|
11384
11812
|
drag = { kind: "wipe", offset: grab.offset };
|
|
11385
11813
|
root.dataset.dragging = "";
|
|
11814
|
+
gripY = p.y;
|
|
11386
11815
|
e.preventDefault();
|
|
11387
11816
|
if (!grab.onLine)
|
|
11388
|
-
setWipe(wipeAt(p.x, wr));
|
|
11817
|
+
setWipe(wipeAt(p.x, wr), true, true);
|
|
11818
|
+
else
|
|
11819
|
+
drawNow();
|
|
11389
11820
|
return;
|
|
11390
11821
|
}
|
|
11391
11822
|
}
|
|
@@ -11411,6 +11842,11 @@ function compare(container, options) {
|
|
|
11411
11842
|
pinch = { d, x: mid.x, y: mid.y };
|
|
11412
11843
|
return handZoom(zoomAbout(panned, k, q.pu, q.pv));
|
|
11413
11844
|
}
|
|
11845
|
+
if (mode === "wipe" && drag?.kind !== "pan") {
|
|
11846
|
+
gripY = p.y;
|
|
11847
|
+
if (!drag)
|
|
11848
|
+
placeGrip(wipeRect(layoutNow().L.overlay));
|
|
11849
|
+
}
|
|
11414
11850
|
if (drag?.kind === "wipe")
|
|
11415
11851
|
setWipe(wipeAt(p.x, wipeRect(layoutNow().L.overlay), drag.offset));
|
|
11416
11852
|
else if (drag?.kind === "pan") {
|
|
@@ -11483,12 +11919,6 @@ function compare(container, options) {
|
|
|
11483
11919
|
const z = { u: zu.target, v: zv.target, w: zw.target, h: zw.target };
|
|
11484
11920
|
glideZoom(zoomAbout(z, factor, 0.5, 0.5));
|
|
11485
11921
|
};
|
|
11486
|
-
const holdFlick = (on) => {
|
|
11487
|
-
if (flickHeld === on)
|
|
11488
|
-
return;
|
|
11489
|
-
flickHeld = on;
|
|
11490
|
-
drawNow();
|
|
11491
|
-
};
|
|
11492
11922
|
const holdLoupe = (on) => {
|
|
11493
11923
|
if (loupeHeld === on)
|
|
11494
11924
|
return;
|
|
@@ -11534,25 +11964,17 @@ function compare(container, options) {
|
|
|
11534
11964
|
case "s":
|
|
11535
11965
|
case "w":
|
|
11536
11966
|
case "d":
|
|
11537
|
-
if (e.altKey || e.shiftKey || key === "s" && claimsHintKey(doc, key))
|
|
11538
|
-
return;
|
|
11539
|
-
claim();
|
|
11540
|
-
return setMode(KEY_MODE[key]);
|
|
11541
11967
|
case "1":
|
|
11542
11968
|
case "2":
|
|
11543
|
-
case "3":
|
|
11544
|
-
|
|
11545
|
-
if (e.altKey || e.shiftKey)
|
|
11969
|
+
case "3": {
|
|
11970
|
+
if (e.altKey || e.shiftKey || key === "s" && claimsHintKey(doc, key))
|
|
11546
11971
|
return;
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
case "x":
|
|
11550
|
-
if (e.altKey)
|
|
11972
|
+
const m = modeForKey(key, modeList);
|
|
11973
|
+
if (!m)
|
|
11551
11974
|
return;
|
|
11552
11975
|
claim();
|
|
11553
|
-
|
|
11554
|
-
|
|
11555
|
-
return;
|
|
11976
|
+
return setMode(m);
|
|
11977
|
+
}
|
|
11556
11978
|
case "z":
|
|
11557
11979
|
if (e.altKey)
|
|
11558
11980
|
return;
|
|
@@ -11608,8 +12030,11 @@ function compare(container, options) {
|
|
|
11608
12030
|
labels[1].textContent = labelOf(1);
|
|
11609
12031
|
loupeBtn.setAttribute("aria-pressed", String(loupeOn));
|
|
11610
12032
|
loopBtn.setAttribute("aria-pressed", String(loopNow() !== null));
|
|
12033
|
+
const modePill = modeList.length > 1 ? selectionPill(modes, {
|
|
12034
|
+
rows: () => modeBtns,
|
|
12035
|
+
selected: () => modeBtns[modeList.indexOf(mode)] ?? null
|
|
12036
|
+
}) : null;
|
|
11611
12037
|
syncModeUi();
|
|
11612
|
-
syncFlicker();
|
|
11613
12038
|
const unlisten = tl?.listen({
|
|
11614
12039
|
onSeek: (t, source) => {
|
|
11615
12040
|
if (source === "play") {
|
|
@@ -11667,24 +12092,20 @@ function compare(container, options) {
|
|
|
11667
12092
|
});
|
|
11668
12093
|
root.addEventListener("keydown", onKey);
|
|
11669
12094
|
root.addEventListener("keyup", (e) => {
|
|
11670
|
-
|
|
11671
|
-
if (key === "x")
|
|
11672
|
-
holdFlick(false);
|
|
11673
|
-
else if (key === "z")
|
|
12095
|
+
if (e.key.toLowerCase() === "z")
|
|
11674
12096
|
holdLoupe(false);
|
|
11675
12097
|
});
|
|
11676
12098
|
root.addEventListener("focusout", (e) => {
|
|
11677
12099
|
if (root.contains(e.relatedTarget))
|
|
11678
12100
|
return;
|
|
11679
|
-
holdFlick(false);
|
|
11680
12101
|
holdLoupe(false);
|
|
11681
12102
|
});
|
|
11682
12103
|
const unregisterHints = options.hints === false ? undefined : hints.register(root, () => [
|
|
11683
|
-
...
|
|
12104
|
+
...modeList.length > 1 ? modeList.map((m, i) => ({
|
|
11684
12105
|
el: modeBtns[i],
|
|
11685
|
-
label: m.
|
|
11686
|
-
activate: () => setMode(m
|
|
11687
|
-
})),
|
|
12106
|
+
label: MODE_LABEL[m].long,
|
|
12107
|
+
activate: () => setMode(m)
|
|
12108
|
+
})) : [],
|
|
11688
12109
|
{ el: loopBtn, label: "Loop", activate: () => api.setLoop(!loopNow()) },
|
|
11689
12110
|
...loupeBtn.hidden ? [] : [{ el: loupeBtn, label: "Loupe", activate: () => setLoupe(!loupeOn) }],
|
|
11690
12111
|
...zoomed() ? [{ el: zoomReset, label: "Reset zoom", activate: () => api.setZoom(null) }] : [],
|
|
@@ -11709,6 +12130,7 @@ function compare(container, options) {
|
|
|
11709
12130
|
get mode() {
|
|
11710
12131
|
return mode;
|
|
11711
12132
|
},
|
|
12133
|
+
modes: modeList,
|
|
11712
12134
|
get wipe() {
|
|
11713
12135
|
return wipe;
|
|
11714
12136
|
},
|
|
@@ -11764,7 +12186,7 @@ function compare(container, options) {
|
|
|
11764
12186
|
tl?.update({ fps: next.fps });
|
|
11765
12187
|
requestDraw();
|
|
11766
12188
|
},
|
|
11767
|
-
seek: (t) => tl ? tl.seek(t) : ownSeek(t),
|
|
12189
|
+
seek: (t, o) => tl ? tl.seek(t, o?.glide ? { glide: true } : undefined) : ownSeek(t),
|
|
11768
12190
|
seekBy(d) {
|
|
11769
12191
|
const total = duration || tl?.duration || 0;
|
|
11770
12192
|
const t = Math.min(total, Math.max(0, now() + d));
|
|
@@ -11805,7 +12227,7 @@ function compare(container, options) {
|
|
|
11805
12227
|
dispose() {
|
|
11806
12228
|
disposed = true;
|
|
11807
12229
|
loop.stop();
|
|
11808
|
-
|
|
12230
|
+
modePill?.dispose();
|
|
11809
12231
|
win.clearTimeout(releaseTimer);
|
|
11810
12232
|
ro.disconnect();
|
|
11811
12233
|
nearIo?.disconnect();
|
|
@@ -11835,7 +12257,7 @@ function compare(container, options) {
|
|
|
11835
12257
|
wake();
|
|
11836
12258
|
return api;
|
|
11837
12259
|
}
|
|
11838
|
-
var LAYOUT2, FADE6, FADE_REDUCED, ZOOM,
|
|
12260
|
+
var LAYOUT2, FADE6, FADE_REDUCED, ZOOM, WIPE_CATCH, SLOP = 12, INSET = 8, GRIP, LOUPE, FAST_SEEK_FRAMES = 15, RELEASE_MS = 3000, MODE_LABEL;
|
|
11839
12261
|
var init_compare = __esm(() => {
|
|
11840
12262
|
init_motion();
|
|
11841
12263
|
init_page_hints();
|
|
@@ -11843,21 +12265,24 @@ var init_compare = __esm(() => {
|
|
|
11843
12265
|
init_compare_gpu();
|
|
11844
12266
|
init_compare_model();
|
|
11845
12267
|
init_compare_strip();
|
|
12268
|
+
init_icons();
|
|
11846
12269
|
init_look();
|
|
11847
12270
|
init_rgba();
|
|
12271
|
+
init_selection_pill();
|
|
11848
12272
|
init_timeline();
|
|
12273
|
+
init_timeline_model();
|
|
11849
12274
|
LAYOUT2 = springMotion({ duration: 0.35, bounce: 0 });
|
|
11850
12275
|
FADE6 = springMotion(SPRINGS.snappy);
|
|
11851
12276
|
FADE_REDUCED = springMotion(FADE);
|
|
11852
12277
|
ZOOM = springMotion({ duration: 0.35, bounce: 0 });
|
|
12278
|
+
WIPE_CATCH = springMotion(CATCH_UP);
|
|
12279
|
+
GRIP = { w: 16, h: 28 };
|
|
11853
12280
|
LOUPE = { r: 88, zoom: 4 };
|
|
11854
|
-
|
|
11855
|
-
{
|
|
11856
|
-
|
|
11857
|
-
|
|
11858
|
-
|
|
11859
|
-
];
|
|
11860
|
-
KEY_MODE = { s: "side", w: "wipe", d: "difference" };
|
|
12281
|
+
MODE_LABEL = {
|
|
12282
|
+
side: { short: "Side", long: "Side by side" },
|
|
12283
|
+
wipe: { short: "Wipe", long: "Wipe" },
|
|
12284
|
+
difference: { short: "Difference", long: "Difference" }
|
|
12285
|
+
};
|
|
11861
12286
|
});
|
|
11862
12287
|
|
|
11863
12288
|
// src/ui/react.tsx
|
|
@@ -14757,6 +15182,7 @@ function timelineChanges(now, changed) {
|
|
|
14757
15182
|
// src/ui/picker.ts
|
|
14758
15183
|
init_motion();
|
|
14759
15184
|
init_look();
|
|
15185
|
+
init_icons();
|
|
14760
15186
|
|
|
14761
15187
|
// src/ui/picker-model.ts
|
|
14762
15188
|
function digitPick(ids, key) {
|
|
@@ -14811,7 +15237,7 @@ var CLOSE3 = springMotion(CLOSE);
|
|
|
14811
15237
|
var CARD = springMotion(SPRINGS.default);
|
|
14812
15238
|
var FADE5 = springMotion(FADE);
|
|
14813
15239
|
var DRIFT = 6;
|
|
14814
|
-
var CHECK =
|
|
15240
|
+
var CHECK = icon("check", { small: true });
|
|
14815
15241
|
function optionPicker(container, options) {
|
|
14816
15242
|
const doc = container.ownerDocument;
|
|
14817
15243
|
const win = doc.defaultView;
|
|
@@ -16375,7 +16801,7 @@ var walkthroughCss = `
|
|
|
16375
16801
|
.knobs-walkthrough a{color:inherit;text-decoration:underline;text-decoration-color:color-mix(in srgb,currentColor 35%,transparent);text-underline-offset:2px;transition:text-decoration-color .15s}
|
|
16376
16802
|
.knobs-walkthrough a:hover{text-decoration-color:currentColor}
|
|
16377
16803
|
.knobs-walkthrough code,.knobs-wt-slot code{font:calc(1em - 1px) var(--_k-mono);padding:1px 5px;border-radius:5px;background:var(--_k-fill)}
|
|
16378
|
-
:where(.knobs-ui) :is(.knobs-wt-btn,.knobs-wt-pick,.knobs-wt-toc-step){all:revert;box-sizing:border-box;font:inherit;color:inherit;letter-spacing:inherit;
|
|
16804
|
+
:where(.knobs-ui) :is(.knobs-wt-btn,.knobs-wt-pick,.knobs-wt-toc-step,button.knobs-wt-stitle,.knobs-wt-chapter){all:revert;box-sizing:border-box;font:inherit;color:inherit;letter-spacing:inherit;
|
|
16379
16805
|
background:transparent;border:0;border-radius:0;margin:0;padding:0;min-width:0;box-shadow:none;outline:none}
|
|
16380
16806
|
|
|
16381
16807
|
/* ——— layout: the rail beside the column; one column where it's narrow ——— */
|
|
@@ -16434,9 +16860,9 @@ var walkthroughCss = `
|
|
|
16434
16860
|
.knobs-wt-fi-body{max-width:var(--kw-measure);color:var(--_k-fg)}
|
|
16435
16861
|
.knobs-wt-fi-q{color:var(--_k-fg-2)}
|
|
16436
16862
|
.knobs-wt-fi-q::before{content:"You asked: ";color:var(--_k-fg-3)}
|
|
16437
|
-
:where(.knobs-ui) .knobs-wt-fi-step{all:revert;box-sizing:border-box;font:var(--_k-weight) calc(var(--
|
|
16863
|
+
:where(.knobs-ui) :is(.knobs-wt-fi-step,.knobs-wt-steplink){all:revert;box-sizing:border-box;font:var(--_k-weight) calc(var(--k-walkthrough-text,14px) - 2.5px)/1 var(--_k-mono);color:var(--_k-fg-2);background:transparent;border:0;
|
|
16438
16864
|
padding:3px 6px;margin:0;border-radius:6px;cursor:pointer;outline:none;transition:background .15s,color .15s}
|
|
16439
|
-
.knobs-ui .knobs-wt-fi-step:is(:hover,:focus-visible){background:var(--_ku-wash-hi);color:var(--_k-fg)}
|
|
16865
|
+
.knobs-ui :is(.knobs-wt-fi-step,.knobs-wt-steplink):is(:hover,:focus-visible){background:var(--_ku-wash-hi);color:var(--_k-fg)}
|
|
16440
16866
|
|
|
16441
16867
|
/* ——— a step's sent notes ——— */
|
|
16442
16868
|
.knobs-wt-notes{display:flex;flex-direction:column}
|
|
@@ -16572,7 +16998,8 @@ var walkthroughCss = `
|
|
|
16572
16998
|
}
|
|
16573
16999
|
|
|
16574
17000
|
/* ——— media slots ——— */
|
|
16575
|
-
.knobs-ui.knobs-wt-slot{position:relative;min-width:0;container:knobs-wt-slot / inline-size;color:var(--_k-fg);font:var(--_k-weight) var(--k-walkthrough-text,14px)/1.5 var(--_k-font)
|
|
17001
|
+
.knobs-ui.knobs-wt-slot{position:relative;min-width:0;container:knobs-wt-slot / inline-size;color:var(--_k-fg);font:var(--_k-weight) var(--k-walkthrough-text,14px)/1.5 var(--_k-font);
|
|
17002
|
+
--kw-good:var(--k-walkthrough-good,var(--_k-ok));--kw-info:var(--k-walkthrough-info,var(--_k-info))}
|
|
16576
17003
|
.knobs-wt-slot-label{display:block;margin:0 0 6px 2px;font:var(--_k-weight-label) calc(var(--k-walkthrough-text,14px) - 3px)/1.3 var(--_k-font);color:var(--_k-fg-2);letter-spacing:.04em;text-transform:uppercase}
|
|
16577
17004
|
/* A compare is exactly as tall as its pictures at this width, so there's no letterbox: the two
|
|
16578
17005
|
sides edge to edge (side) or one (overlaid), plus its mode bar, the timeline and their two gaps
|
|
@@ -16612,9 +17039,141 @@ var walkthroughCss = `
|
|
|
16612
17039
|
.knobs-wt-text{max-width:var(--k-walkthrough-measure,68ch);color:var(--_k-fg-2)}
|
|
16613
17040
|
.knobs-wt-hold{border-radius:calc(var(--_k-radius-panel) - 4px);background:var(--_k-fill)}
|
|
16614
17041
|
.knobs-wt-failed{display:flex;align-items:center;justify-content:center;min-height:80px;color:var(--_k-fg-3);font-size:calc(var(--k-walkthrough-text,14px) - 2px)}
|
|
17042
|
+
|
|
17043
|
+
/* ——— data blocks: history, stack, table, chapters. On the step's card, so no card of their own:
|
|
17044
|
+
hairlines and fills only. Tones read the status tokens; hover fades are the panel's own. ——— */
|
|
17045
|
+
:where(.knobs-wt-history,.knobs-wt-stack,.knobs-wt-table,.knobs-wt-chapters){--kw-t:var(--k-walkthrough-text,14px);--kw-line:calc(var(--kw-t) + 6px);--kw-rail:var(--_k-border-strong)}
|
|
17046
|
+
:where(.knobs-wt-slot) [data-tone="good"]{--kw-tone:var(--kw-good)}
|
|
17047
|
+
:where(.knobs-wt-slot) [data-tone="warn"]{--kw-tone:var(--_k-warn)}
|
|
17048
|
+
:where(.knobs-wt-slot) [data-tone="bad"]{--kw-tone:var(--_k-danger)}
|
|
17049
|
+
:where(.knobs-wt-slot) [data-tone="info"]{--kw-tone:var(--kw-info)}
|
|
17050
|
+
:where(.knobs-wt-slot) [data-tone="dim"]{--kw-tone:var(--_k-fg-3)}
|
|
17051
|
+
.knobs-wt-tags{display:flex;flex-wrap:wrap;gap:4px;margin-top:4px}
|
|
17052
|
+
.knobs-ui .knobs-wt-tag{display:inline-flex;align-items:center;height:20px;padding:0 6px;border-radius:5px;background:var(--_k-fill);color:var(--_k-fg-2);font:var(--_k-weight) calc(var(--kw-t) - 3px)/1 var(--_k-mono);
|
|
17053
|
+
text-decoration:none;white-space:nowrap;transition:background calc(var(--_k-hover-out) * 1ms),color calc(var(--_k-hover-out) * 1ms)}
|
|
17054
|
+
.knobs-ui a.knobs-wt-tag:is(:hover,:focus-visible){background:var(--_k-fill-selected);color:var(--_k-fg);transition-duration:calc(var(--_k-hover-in) * 1ms)}
|
|
17055
|
+
|
|
17056
|
+
/* A history: dates down the left, a spine of tone dots joined by a hairline (broken around each
|
|
17057
|
+
dot), the event beside it. Inferred events take a ring for a dot and a dashed tag. */
|
|
17058
|
+
.knobs-wt-history{--kw-hy:calc(5px + var(--kw-line) / 2);display:flex;flex-direction:column;gap:18px;font-size:calc(var(--kw-t) - 1px);line-height:var(--kw-line);color:var(--_k-fg)}
|
|
17059
|
+
.knobs-wt-hgroup{display:flex;flex-direction:column;gap:6px;min-width:0}
|
|
17060
|
+
.knobs-wt-hhead{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 10px}
|
|
17061
|
+
.knobs-ui .knobs-wt-hheading{margin:0;font:var(--_k-weight-label) calc(var(--kw-t) - 3px)/1.3 var(--_k-font);letter-spacing:.04em;text-transform:uppercase;color:var(--_k-fg-2)}
|
|
17062
|
+
.knobs-wt-hsum{color:var(--_k-fg-3);font-size:calc(var(--kw-t) - 2px);font-variant-numeric:tabular-nums}
|
|
17063
|
+
.knobs-wt-hlist{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
|
|
17064
|
+
.knobs-wt-hev{display:grid;grid-template-columns:var(--kw-hw,11ch) 14px minmax(0,1fr);grid-template-areas:"when spine main";column-gap:10px;align-items:baseline;padding:5px 0}
|
|
17065
|
+
.knobs-wt-hwhen{grid-area:when;display:flex;flex-direction:column;min-width:0;font:var(--_k-weight) calc(var(--kw-t) - 2px)/var(--kw-line) var(--_k-mono);font-variant-numeric:tabular-nums;color:var(--_k-fg-2)}
|
|
17066
|
+
.knobs-wt-hage{color:var(--_k-fg-3);font-size:calc(var(--kw-t) - 3px);line-height:1.35}
|
|
17067
|
+
.knobs-wt-hspine{grid-area:spine;position:relative;align-self:stretch;margin-block:-5px}
|
|
17068
|
+
.knobs-wt-hspine::before,.knobs-wt-hspine::after{content:"";position:absolute;left:6.5px;width:1px;background:var(--kw-rail)}
|
|
17069
|
+
.knobs-wt-hspine::before{top:0;height:calc(var(--kw-hy) - 6px)}
|
|
17070
|
+
.knobs-wt-hspine::after{top:calc(var(--kw-hy) + 6px);bottom:0}
|
|
17071
|
+
.knobs-wt-hev:first-child .knobs-wt-hspine::before,.knobs-wt-hev:last-child .knobs-wt-hspine::after{content:none}
|
|
17072
|
+
.knobs-wt-hdot{position:absolute;left:3.5px;top:calc(var(--kw-hy) - 3.5px);width:7px;height:7px;border-radius:50%;background:var(--kw-tone,var(--_k-fg-3))}
|
|
17073
|
+
.knobs-wt-hev[data-type="release"] .knobs-wt-hdot{border-radius:1.5px;rotate:45deg;scale:.9}
|
|
17074
|
+
.knobs-wt-hev[data-type="audit"] .knobs-wt-hdot{border-radius:1.5px}
|
|
17075
|
+
.knobs-wt-hev[data-provenance="inferred"] .knobs-wt-hdot{background:transparent;box-shadow:inset 0 0 0 1.5px var(--kw-tone,var(--_k-fg-3))}
|
|
17076
|
+
.knobs-wt-hmain{grid-area:main;display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
17077
|
+
.knobs-wt-htitle{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 8px;font-weight:var(--_k-weight-label);color:var(--_k-fg)}
|
|
17078
|
+
.knobs-wt-prov{padding:0 6px;border-radius:5px;background:var(--_k-fill);color:var(--_k-fg-3);font:var(--_k-weight) calc(var(--kw-t) - 3.5px)/18px var(--_k-mono);white-space:nowrap}
|
|
17079
|
+
.knobs-wt-hev[data-provenance="inferred"] .knobs-wt-prov{background:transparent;color:var(--_k-warn);outline:1px dashed color-mix(in oklch,var(--_k-warn) 50%,transparent);outline-offset:-1px}
|
|
17080
|
+
.knobs-ui .knobs-wt-hdetail{margin:0;max-width:var(--k-walkthrough-measure,68ch);color:var(--_k-fg-2)}
|
|
17081
|
+
@container knobs-wt-slot (max-width:520px){
|
|
17082
|
+
.knobs-wt-hev{grid-template-columns:14px minmax(0,1fr);grid-template-areas:"spine when" "spine main"}
|
|
17083
|
+
.knobs-wt-hwhen{flex-direction:row;flex-wrap:wrap;align-items:baseline;column-gap:8px}
|
|
17084
|
+
}
|
|
17085
|
+
|
|
17086
|
+
/* A stack: the trunk at the top, each PR hanging off the branch it merges into, rails drawn as a
|
|
17087
|
+
git graph (solid, so where two meet they don't darken). A PR with a step goes there on a click. */
|
|
17088
|
+
.knobs-wt-stack{--kw-spt:7px;--kw-spb:7px;--kw-sy:calc(var(--kw-spt) + var(--kw-line) / 2);display:flex;flex-direction:column;font-size:calc(var(--kw-t) - 1px);line-height:var(--kw-line);color:var(--_k-fg)}
|
|
17089
|
+
.knobs-wt-srow{display:grid;grid-template-columns:auto minmax(0,1fr) auto;column-gap:10px;align-items:start;margin:0 -8px;padding:var(--kw-spt) 8px var(--kw-spb);
|
|
17090
|
+
border-radius:max(0px,calc(var(--_k-radius-panel) - 8px));transition:background calc(var(--_k-hover-out) * 1ms)}
|
|
17091
|
+
.knobs-wt-srow[data-trunk]{--kw-spb:0px;grid-template-columns:auto minmax(0,1fr)}
|
|
17092
|
+
.knobs-wt-srow[data-go]{cursor:pointer}
|
|
17093
|
+
.knobs-wt-srow[data-go]:hover{background:var(--_ku-wash);transition-duration:calc(var(--_k-hover-in) * 1ms)}
|
|
17094
|
+
.knobs-wt-lanes{display:flex;align-self:stretch;margin-block:calc(var(--kw-spt) * -1) calc(var(--kw-spb) * -1)}
|
|
17095
|
+
.knobs-wt-lane{position:relative;flex:none;width:16px}
|
|
17096
|
+
.knobs-wt-lane:is([data-rail="pass"],[data-rail="tee"],[data-down])::before{content:"";position:absolute;left:7.5px;top:0;bottom:0;width:1px;background:var(--kw-rail)}
|
|
17097
|
+
.knobs-wt-lane[data-down]::before{top:calc(var(--kw-sy) + 3.5px)}
|
|
17098
|
+
.knobs-wt-lane:is([data-rail="tee"],[data-rail="end"])::after{content:"";position:absolute;left:7.5px;top:0;width:13px;height:calc(var(--kw-sy) + .5px);border:solid var(--kw-rail);border-width:0 0 1px 1px;border-bottom-left-radius:6px}
|
|
17099
|
+
.knobs-wt-lane[data-rail="node"]::after{content:"";position:absolute;left:4.5px;top:calc(var(--kw-sy) - 3.5px);width:7px;height:7px;border-radius:50%;background:var(--_k-fg-3)}
|
|
17100
|
+
.knobs-wt-srow[data-trunk] .knobs-wt-lane[data-rail="node"]::after{background:var(--_k-fg-2)}
|
|
17101
|
+
.knobs-wt-trunk{font:var(--_k-weight-label) calc(var(--kw-t) - 2px)/var(--kw-line) var(--_k-mono);color:var(--_k-fg-2)}
|
|
17102
|
+
.knobs-wt-smain{display:flex;flex-direction:column;gap:1px;min-width:0}
|
|
17103
|
+
.knobs-wt-sline{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px}
|
|
17104
|
+
.knobs-wt-sord{font:var(--_k-weight) calc(var(--kw-t) - 2px)/var(--kw-line) var(--_k-mono);font-variant-numeric:tabular-nums;color:var(--_k-fg-3);white-space:nowrap}
|
|
17105
|
+
.knobs-ui .knobs-wt-spr{font:var(--_k-weight-label) calc(var(--kw-t) - 1.5px)/var(--kw-line) var(--_k-mono);color:var(--_k-fg-2);text-decoration:none;white-space:nowrap}
|
|
17106
|
+
.knobs-ui a.knobs-wt-spr:is(:hover,:focus-visible){color:var(--_k-fg);text-decoration:underline}
|
|
17107
|
+
.knobs-ui .knobs-wt-stitle{font-weight:var(--_k-weight-label);line-height:var(--kw-line);color:var(--_k-fg);text-align:left}
|
|
17108
|
+
.knobs-ui button.knobs-wt-stitle{cursor:pointer;text-decoration:underline;text-decoration-color:transparent;text-underline-offset:3px;transition:text-decoration-color calc(var(--_k-hover-out) * 1ms)}
|
|
17109
|
+
.knobs-ui :is(.knobs-wt-srow[data-go]:hover button.knobs-wt-stitle,button.knobs-wt-stitle:focus-visible){text-decoration-color:color-mix(in oklch,currentColor 45%,transparent);transition-duration:calc(var(--_k-hover-in) * 1ms)}
|
|
17110
|
+
.knobs-ui .knobs-wt-ssummary{margin:0;max-width:var(--k-walkthrough-measure,68ch);color:var(--_k-fg-2)}
|
|
17111
|
+
.knobs-wt-smeta{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 12px;font:var(--_k-weight) calc(var(--kw-t) - 2px)/var(--kw-line) var(--_k-mono);font-variant-numeric:tabular-nums;color:var(--_k-fg-3)}
|
|
17112
|
+
.knobs-wt-delta{display:inline-flex;gap:6px}
|
|
17113
|
+
.knobs-wt-add{color:var(--_k-diff-add)}
|
|
17114
|
+
.knobs-wt-del{color:var(--_k-diff-del)}
|
|
17115
|
+
.knobs-wt-sstatus{margin-top:calc((var(--kw-line) - 20px) / 2)}
|
|
17116
|
+
.knobs-wt-stack[data-flat] .knobs-wt-srow{grid-template-columns:minmax(0,1fr) auto}
|
|
17117
|
+
.knobs-wt-stack[data-flat] .knobs-wt-srow+.knobs-wt-srow{box-shadow:inset 0 1px 0 var(--_k-border)}
|
|
17118
|
+
@container knobs-wt-slot (max-width:520px){
|
|
17119
|
+
.knobs-wt-srow:not([data-trunk]){grid-template-columns:auto minmax(0,1fr)}
|
|
17120
|
+
.knobs-wt-stack[data-flat] .knobs-wt-srow{grid-template-columns:minmax(0,1fr)}
|
|
17121
|
+
.knobs-wt-sstatus{grid-column:-2;justify-self:start;margin-top:4px}
|
|
17122
|
+
}
|
|
17123
|
+
|
|
17124
|
+
/* A table: a real one, its head stuck while it scrolls, both ways; edges fade where there's more
|
|
17125
|
+
(the top one under the head), and thin bars show on hover. */
|
|
17126
|
+
@property --kw-fade-l{syntax:"<number>";inherits:false;initial-value:1}
|
|
17127
|
+
@property --kw-fade-r{syntax:"<number>";inherits:false;initial-value:1}
|
|
17128
|
+
@keyframes kw-fade-l{from{--kw-fade-l:1}to{--kw-fade-l:0}}
|
|
17129
|
+
@keyframes kw-fade-r{from{--kw-fade-r:0}to{--kw-fade-r:1}}
|
|
17130
|
+
.knobs-wt-table{max-height:520px;overflow:auto;overscroll-behavior-x:contain;outline:none;scrollbar-width:thin;scrollbar-color:transparent transparent;
|
|
17131
|
+
transition:scrollbar-color calc(var(--_k-hover-out) * 1ms)}
|
|
17132
|
+
.knobs-wt-table:is(:hover,:focus-visible){scrollbar-color:color-mix(in oklch,var(--_k-fg) 28%,transparent) transparent;transition-duration:calc(var(--_k-hover-in) * 1ms)}
|
|
17133
|
+
.knobs-wt-table:focus-visible{box-shadow:inset 0 0 0 2px var(--_k-focus);border-radius:calc(var(--_k-radius-panel) - 4px)}
|
|
17134
|
+
@supports (animation-timeline:scroll()){
|
|
17135
|
+
.knobs-wt-table{animation:knobs-fade-a linear both,knobs-fade-b linear both,kw-fade-l linear both,kw-fade-r linear both;animation-duration:auto;
|
|
17136
|
+
animation-timeline:scroll(self block),scroll(self block),scroll(self inline),scroll(self inline);animation-range:0 24px,calc(100% - 24px) 100%,0 8px,calc(100% - 8px) 100%;
|
|
17137
|
+
--kw-table-mask-y:linear-gradient(to bottom,#000 var(--kw-thead,0px),rgb(0 0 0/var(--knobs-fade-a)) var(--kw-thead,0px),#000 calc(var(--kw-thead,0px) + 20px),#000 calc(100% - 20px),rgb(0 0 0/var(--knobs-fade-b)));
|
|
17138
|
+
--kw-table-mask-x:linear-gradient(to right,rgb(0 0 0/var(--kw-fade-l)),#000 24px,#000 calc(100% - 24px),rgb(0 0 0/var(--kw-fade-r)));
|
|
17139
|
+
-webkit-mask-image:var(--kw-table-mask-y),var(--kw-table-mask-x);mask-image:var(--kw-table-mask-y),var(--kw-table-mask-x);-webkit-mask-composite:source-in;mask-composite:intersect}
|
|
17140
|
+
}
|
|
17141
|
+
.knobs-wt-table table{width:100%;margin:0;border-collapse:separate;border-spacing:0;font-size:calc(var(--kw-t) - 1.5px);line-height:1.45;font-variant-numeric:tabular-nums;color:var(--_k-fg-2)}
|
|
17142
|
+
.knobs-wt-table caption{caption-side:bottom;padding-top:8px;text-align:left;color:var(--_k-fg-3);font-size:calc(var(--kw-t) - 2px)}
|
|
17143
|
+
.knobs-wt-table th{position:sticky;top:0;padding:0 12px 7px;text-align:left;vertical-align:bottom;font-weight:var(--_k-weight-label);font-size:calc(var(--kw-t) - 2.5px);color:var(--_k-fg-3);white-space:nowrap;
|
|
17144
|
+
background:var(--_k-pane-bg);box-shadow:inset 0 -1px 0 var(--_k-border)}
|
|
17145
|
+
.knobs-wt-table td{padding:8px 12px;vertical-align:baseline;box-shadow:inset 0 -1px 0 var(--_k-border)}
|
|
17146
|
+
.knobs-wt-table tr:last-child td{box-shadow:none}
|
|
17147
|
+
.knobs-wt-table :is(th,td):first-child{padding-left:0}
|
|
17148
|
+
.knobs-wt-table :is(th,td):last-child{padding-right:0}
|
|
17149
|
+
.knobs-wt-table td:first-child{color:var(--_k-fg)}
|
|
17150
|
+
.knobs-wt-table [data-align="right"]{text-align:right}
|
|
17151
|
+
.knobs-wt-table [data-align="center"]{text-align:center}
|
|
17152
|
+
.knobs-wt-table td[data-mono]{font-family:var(--_k-mono);font-size:calc(var(--kw-t) - 2.5px);color:var(--_k-fg);white-space:nowrap}
|
|
17153
|
+
.knobs-wt-table td[data-long]{min-width:24ch}
|
|
17154
|
+
.knobs-wt-table td>.knobs-wt-steplink{margin-left:4px}
|
|
17155
|
+
.knobs-ui .knobs-wt-table a.knobs-wt-chip{text-decoration:none}
|
|
17156
|
+
.knobs-wt-ctone{color:var(--kw-tone)}
|
|
17157
|
+
|
|
17158
|
+
/* Chapters: timestamp pills under a video; one highlight springs to the one playing. */
|
|
17159
|
+
.knobs-wt-chapters{position:relative;display:flex;flex-wrap:wrap;gap:4px;margin-top:8px}
|
|
17160
|
+
.knobs-wt-chapter-mark{position:absolute;left:0;top:0;width:0;border-radius:calc(var(--_k-radius) + 2px);background:var(--_k-fill-selected);opacity:0;pointer-events:none;will-change:transform;
|
|
17161
|
+
transition:opacity calc(var(--_k-motion-snappy-ms) * 1ms)}
|
|
17162
|
+
.knobs-wt-chapter-mark[data-on]{opacity:1}
|
|
17163
|
+
.knobs-ui .knobs-wt-chapter{position:relative;display:inline-flex;align-items:baseline;gap:6px;height:26px;padding:0 10px 0 8px;border-radius:calc(var(--_k-radius) + 2px);color:var(--_k-fg-2);
|
|
17164
|
+
font-size:calc(var(--kw-t) - 2px);line-height:26px;white-space:nowrap;cursor:pointer;transition:background calc(var(--_k-hover-out) * 1ms),color calc(var(--_k-hover-out) * 1ms)}
|
|
17165
|
+
.knobs-ui .knobs-wt-chapter:hover{background:var(--_ku-wash);color:var(--_k-fg);transition-duration:calc(var(--_k-hover-in) * 1ms)}
|
|
17166
|
+
.knobs-ui .knobs-wt-chapter[aria-current]{background:transparent;color:var(--_k-fg)}
|
|
17167
|
+
.knobs-ui .knobs-wt-chapter:focus-visible{box-shadow:inset 0 0 0 2px var(--_k-focus)}
|
|
17168
|
+
.knobs-wt-chapter-time{font:var(--_k-weight) calc(var(--kw-t) - 3px)/1 var(--_k-mono);font-variant-numeric:tabular-nums;color:var(--_k-fg-3)}
|
|
17169
|
+
.knobs-wt-chapter[aria-current] .knobs-wt-chapter-time{color:var(--_k-fg-2)}
|
|
16615
17170
|
@media(prefers-reduced-motion:reduce){:is(.knobs-walkthrough,.knobs-wt-slot) :where(*,::before,::after){transition-duration:.15s!important;transition-property:opacity,background,color!important}}
|
|
16616
17171
|
`;
|
|
16617
17172
|
|
|
17173
|
+
// src/ui/walkthrough-blocks.ts
|
|
17174
|
+
init_motion();
|
|
17175
|
+
init_look();
|
|
17176
|
+
|
|
16618
17177
|
// src/ui/walkthrough-model.ts
|
|
16619
17178
|
var DEFAULT_VERDICTS = ["ship", "change", "unsure"];
|
|
16620
17179
|
function slug(text) {
|
|
@@ -16656,20 +17215,207 @@ function fillMedia(m, base) {
|
|
|
16656
17215
|
if (typeof m === "string")
|
|
16657
17216
|
return mediaOf(resolveSrc(m, base));
|
|
16658
17217
|
switch (m.kind) {
|
|
16659
|
-
case "compare":
|
|
16660
|
-
|
|
16661
|
-
case "video":
|
|
17218
|
+
case "compare": {
|
|
17219
|
+
const { chapters, ...rest } = m;
|
|
16662
17220
|
return {
|
|
16663
|
-
...
|
|
17221
|
+
...rest,
|
|
17222
|
+
before: source2(m.before, base),
|
|
17223
|
+
after: source2(m.after, base),
|
|
17224
|
+
...chapters?.length ? { chapters: fillChapters(chapters) } : {}
|
|
17225
|
+
};
|
|
17226
|
+
}
|
|
17227
|
+
case "video": {
|
|
17228
|
+
const { chapters, captionsSrc, captions, ...rest } = m;
|
|
17229
|
+
const vtt = captions ?? captionsSrc;
|
|
17230
|
+
return {
|
|
17231
|
+
...rest,
|
|
16664
17232
|
src: resolveSrc(m.src, base),
|
|
16665
|
-
...m.poster ? { poster: resolveSrc(m.poster, base) } : {}
|
|
17233
|
+
...m.poster ? { poster: resolveSrc(m.poster, base) } : {},
|
|
17234
|
+
...vtt ? { captions: resolveSrc(vtt, base) } : {},
|
|
17235
|
+
...chapters?.length ? { chapters: fillChapters(chapters) } : {}
|
|
16666
17236
|
};
|
|
17237
|
+
}
|
|
16667
17238
|
case "image":
|
|
16668
17239
|
return { ...m, src: resolveSrc(m.src, base) };
|
|
17240
|
+
case "history":
|
|
17241
|
+
return { kind: "history", groups: fillHistory(m) };
|
|
17242
|
+
case "stack":
|
|
17243
|
+
return {
|
|
17244
|
+
kind: "stack",
|
|
17245
|
+
...m.base ? { base: m.base } : {},
|
|
17246
|
+
items: m.items.map(fillStackItem)
|
|
17247
|
+
};
|
|
17248
|
+
case "table":
|
|
17249
|
+
return fillTable(m);
|
|
16669
17250
|
default:
|
|
16670
17251
|
return m;
|
|
16671
17252
|
}
|
|
16672
17253
|
}
|
|
17254
|
+
function fillHistory(m) {
|
|
17255
|
+
const groups = [];
|
|
17256
|
+
if (m.events?.length)
|
|
17257
|
+
groups.push({ events: m.events });
|
|
17258
|
+
for (const g of m.groups ?? [])
|
|
17259
|
+
groups.push({
|
|
17260
|
+
...g.heading ? { heading: g.heading } : {},
|
|
17261
|
+
...g.summary ? { summary: g.summary } : {},
|
|
17262
|
+
events: g.events ?? g.rows ?? []
|
|
17263
|
+
});
|
|
17264
|
+
return groups;
|
|
17265
|
+
}
|
|
17266
|
+
function parseBranch(branch) {
|
|
17267
|
+
if (!branch?.trim())
|
|
17268
|
+
return {};
|
|
17269
|
+
const [head, base] = branch.split(/\s*(?:→|->|=>|⇒)\s*/, 2).map((s) => s.trim());
|
|
17270
|
+
return { ...head ? { head } : {}, ...base ? { base } : {} };
|
|
17271
|
+
}
|
|
17272
|
+
function parseDelta(delta) {
|
|
17273
|
+
if (delta === undefined || typeof delta === "object")
|
|
17274
|
+
return delta;
|
|
17275
|
+
const m = /\+\s*([\d,_]+)[^\d+]*?[-−–]\s*([\d,_]+)/.exec(delta);
|
|
17276
|
+
if (!m)
|
|
17277
|
+
return delta.trim() || undefined;
|
|
17278
|
+
const n = (s) => Number(s.replace(/[,_]/g, ""));
|
|
17279
|
+
return { add: n(m[1]), del: n(m[2]) };
|
|
17280
|
+
}
|
|
17281
|
+
function fillStackItem(it) {
|
|
17282
|
+
const parsed = parseBranch(it.branch);
|
|
17283
|
+
const head = parsed.head ?? it.head;
|
|
17284
|
+
const base = parsed.base ?? it.base;
|
|
17285
|
+
const delta = parseDelta(it.delta);
|
|
17286
|
+
const step = it.step ?? it.stepId;
|
|
17287
|
+
const pr = String(it.pr).trim();
|
|
17288
|
+
return {
|
|
17289
|
+
pr: /^\d+$/.test(pr) ? `#${pr}` : pr,
|
|
17290
|
+
...it.href ? { href: it.href } : {},
|
|
17291
|
+
title: it.title,
|
|
17292
|
+
...head ? { head } : {},
|
|
17293
|
+
...base ? { base } : {},
|
|
17294
|
+
...delta !== undefined ? { delta } : {},
|
|
17295
|
+
...it.status ? { status: it.status } : {},
|
|
17296
|
+
...it.tone ? { tone: it.tone } : {},
|
|
17297
|
+
...it.summary ? { summary: it.summary } : {},
|
|
17298
|
+
...step ? { step } : {},
|
|
17299
|
+
...it.order !== undefined && it.order !== "" ? { order: String(it.order) } : {}
|
|
17300
|
+
};
|
|
17301
|
+
}
|
|
17302
|
+
function stackLayout(m) {
|
|
17303
|
+
const items = m.items;
|
|
17304
|
+
const byHead = new Map;
|
|
17305
|
+
items.forEach((it, i) => it.head && !byHead.has(it.head) && byHead.set(it.head, i));
|
|
17306
|
+
let trunk = m.base ?? null;
|
|
17307
|
+
if (!trunk) {
|
|
17308
|
+
const tally = new Map;
|
|
17309
|
+
for (const it of items)
|
|
17310
|
+
if (it.base && !byHead.has(it.base))
|
|
17311
|
+
tally.set(it.base, (tally.get(it.base) ?? 0) + 1);
|
|
17312
|
+
let best = 0;
|
|
17313
|
+
for (const [b, n] of tally)
|
|
17314
|
+
if (n > best)
|
|
17315
|
+
[trunk, best] = [b, n];
|
|
17316
|
+
}
|
|
17317
|
+
const parentOf = items.map((it, i) => {
|
|
17318
|
+
const p = it.base === undefined ? undefined : byHead.get(it.base);
|
|
17319
|
+
return p === undefined || p === i ? null : p;
|
|
17320
|
+
});
|
|
17321
|
+
items.forEach((_, i) => {
|
|
17322
|
+
const seen = new Set;
|
|
17323
|
+
for (let n = i;n !== null; n = parentOf[n]) {
|
|
17324
|
+
if (seen.has(n)) {
|
|
17325
|
+
const loop = [n];
|
|
17326
|
+
for (let k = parentOf[n];k !== n && k !== null; k = parentOf[k])
|
|
17327
|
+
loop.push(k);
|
|
17328
|
+
parentOf[Math.min(...loop)] = null;
|
|
17329
|
+
break;
|
|
17330
|
+
}
|
|
17331
|
+
seen.add(n);
|
|
17332
|
+
}
|
|
17333
|
+
});
|
|
17334
|
+
const kids = items.map(() => []);
|
|
17335
|
+
const roots = [];
|
|
17336
|
+
parentOf.forEach((p, i) => (p === null ? roots : kids[p]).push(i));
|
|
17337
|
+
const rows = [];
|
|
17338
|
+
const walk = (list, depth, rails) => list.forEach((i, n) => {
|
|
17339
|
+
const it = items[i];
|
|
17340
|
+
const last = n === list.length - 1;
|
|
17341
|
+
const off = parentOf[i] === null && it.base && it.base !== trunk ? it.base : undefined;
|
|
17342
|
+
rows.push({
|
|
17343
|
+
item: it,
|
|
17344
|
+
index: i,
|
|
17345
|
+
depth,
|
|
17346
|
+
parent: parentOf[i],
|
|
17347
|
+
last,
|
|
17348
|
+
rails,
|
|
17349
|
+
children: kids[i].length,
|
|
17350
|
+
...off ? { offBase: off } : {}
|
|
17351
|
+
});
|
|
17352
|
+
walk(kids[i], depth + 1, [...rails, !last]);
|
|
17353
|
+
});
|
|
17354
|
+
walk(roots, 0, []);
|
|
17355
|
+
return { trunk, rows, flat: !trunk && rows.every((r) => r.depth === 0 && !r.children) };
|
|
17356
|
+
}
|
|
17357
|
+
var isNum = (c) => typeof c === "number" || typeof c === "object" && typeof c.text === "number";
|
|
17358
|
+
function fillCell(c) {
|
|
17359
|
+
if (typeof c !== "object")
|
|
17360
|
+
return { text: String(c) };
|
|
17361
|
+
return { ...c, text: String(c.text) };
|
|
17362
|
+
}
|
|
17363
|
+
function fillTable(m) {
|
|
17364
|
+
const wrapped = !m.columns.some((c) => c.key === "cells");
|
|
17365
|
+
const raw = m.rows.map((r) => {
|
|
17366
|
+
const keys = Object.keys(r);
|
|
17367
|
+
const cells = r.cells;
|
|
17368
|
+
return wrapped && keys.length === 1 && keys[0] === "cells" && cells && typeof cells === "object" ? cells : r;
|
|
17369
|
+
});
|
|
17370
|
+
const columns = m.columns.map((c) => {
|
|
17371
|
+
const present = raw.map((r) => r[c.key]).filter((v) => v !== undefined && v !== "");
|
|
17372
|
+
const numeric = present.length > 0 && present.every(isNum);
|
|
17373
|
+
return { ...c, align: c.align ?? (numeric ? "right" : "left") };
|
|
17374
|
+
});
|
|
17375
|
+
const rows = raw.map((r) => {
|
|
17376
|
+
const out = {};
|
|
17377
|
+
for (const [k, v] of Object.entries(r))
|
|
17378
|
+
if (v !== undefined && v !== null)
|
|
17379
|
+
out[k] = fillCell(v);
|
|
17380
|
+
return out;
|
|
17381
|
+
});
|
|
17382
|
+
return { kind: "table", columns, rows, ...m.caption ? { caption: m.caption } : {} };
|
|
17383
|
+
}
|
|
17384
|
+
function fillChapters(chapters) {
|
|
17385
|
+
const id = uniqueIds();
|
|
17386
|
+
const starts = chapters.map((c) => c.start).sort((a, b) => a - b);
|
|
17387
|
+
return chapters.map((c) => {
|
|
17388
|
+
const next = starts.find((s) => s > c.start);
|
|
17389
|
+
const end = c.end ?? (c.duration !== undefined ? Math.round((c.start + c.duration) * 1000) / 1000 : next);
|
|
17390
|
+
return {
|
|
17391
|
+
id: id(c.id ?? slug(c.label)),
|
|
17392
|
+
label: c.label,
|
|
17393
|
+
start: c.start,
|
|
17394
|
+
...end !== undefined && end > c.start ? { end } : {}
|
|
17395
|
+
};
|
|
17396
|
+
});
|
|
17397
|
+
}
|
|
17398
|
+
function chapterAt(chapters, time) {
|
|
17399
|
+
let at = -1;
|
|
17400
|
+
chapters.forEach((c, i) => {
|
|
17401
|
+
if (time >= c.start && time < (c.end ?? Infinity) && (at < 0 || c.start >= chapters[at].start))
|
|
17402
|
+
at = i;
|
|
17403
|
+
});
|
|
17404
|
+
return at;
|
|
17405
|
+
}
|
|
17406
|
+
function clock(seconds) {
|
|
17407
|
+
const t = Math.max(0, Math.floor(seconds));
|
|
17408
|
+
const h = Math.floor(t / 3600);
|
|
17409
|
+
const m = Math.floor(t % 3600 / 60);
|
|
17410
|
+
const s = String(t % 60).padStart(2, "0");
|
|
17411
|
+
return h ? `${h}:${String(m).padStart(2, "0")}:${s}` : `${m}:${s}`;
|
|
17412
|
+
}
|
|
17413
|
+
function findStep(steps, ref) {
|
|
17414
|
+
if (ref === undefined)
|
|
17415
|
+
return;
|
|
17416
|
+
const r = ref.trim().replace(/^#/, "");
|
|
17417
|
+
return steps.find((s) => s.key === r || s.id === r || s.number === r);
|
|
17418
|
+
}
|
|
16673
17419
|
function linkLabel(href) {
|
|
16674
17420
|
const pr = /\/(?:pull|issues)\/(\d+)/.exec(href);
|
|
16675
17421
|
if (pr)
|
|
@@ -16726,7 +17472,7 @@ function normalizeWalkthrough(doc) {
|
|
|
16726
17472
|
label: k,
|
|
16727
17473
|
value
|
|
16728
17474
|
}));
|
|
16729
|
-
const stepRef = (ref) =>
|
|
17475
|
+
const stepRef = (ref) => findStep(steps, ref)?.key ?? null;
|
|
16730
17476
|
const feed = sortFeed([
|
|
16731
17477
|
...(doc.updates ?? []).map((u) => ({ kind: "update", at: parseAt(u.at), text: u.text, step: stepRef(u.step) })),
|
|
16732
17478
|
...(doc.qa ?? []).map((x) => ({
|
|
@@ -16893,6 +17639,8 @@ function describeMedia(m) {
|
|
|
16893
17639
|
parts.push(`${m.kind} at ${formatTime(m.time)}`);
|
|
16894
17640
|
else
|
|
16895
17641
|
parts.push(m.kind);
|
|
17642
|
+
if (m.chapter)
|
|
17643
|
+
parts[0] += ` in “${m.chapter}”`;
|
|
16896
17644
|
if (m.loop)
|
|
16897
17645
|
parts.push(`loop ${formatTime(m.loop.start)}–${formatTime(m.loop.end)}`);
|
|
16898
17646
|
if (m.zoom)
|
|
@@ -17052,6 +17800,388 @@ function inlineMarkdown(text) {
|
|
|
17052
17800
|
return s.replace(/\u0000(\d+)\u0000/g, (_, i) => `<code>${escapeHtml(codes[Number(i)])}</code>`);
|
|
17053
17801
|
}
|
|
17054
17802
|
|
|
17803
|
+
// src/ui/walkthrough-blocks.ts
|
|
17804
|
+
var el = (doc, tag, cls) => {
|
|
17805
|
+
const n = doc.createElement(tag);
|
|
17806
|
+
if (cls)
|
|
17807
|
+
n.className = cls;
|
|
17808
|
+
return n;
|
|
17809
|
+
};
|
|
17810
|
+
var text = (doc, tag, cls, value) => {
|
|
17811
|
+
const n = el(doc, tag, cls);
|
|
17812
|
+
n.textContent = value;
|
|
17813
|
+
return n;
|
|
17814
|
+
};
|
|
17815
|
+
var prose = (doc, tag, cls, value) => {
|
|
17816
|
+
const n = el(doc, tag, cls);
|
|
17817
|
+
n.innerHTML = inlineMarkdown(value);
|
|
17818
|
+
return n;
|
|
17819
|
+
};
|
|
17820
|
+
var link = (doc, cls, label, href) => {
|
|
17821
|
+
if (!href)
|
|
17822
|
+
return text(doc, "span", cls, label);
|
|
17823
|
+
const a = text(doc, "a", cls, label);
|
|
17824
|
+
a.href = href;
|
|
17825
|
+
a.target = "_blank";
|
|
17826
|
+
a.rel = "noreferrer";
|
|
17827
|
+
return a;
|
|
17828
|
+
};
|
|
17829
|
+
function stepButton(doc, ref, steps) {
|
|
17830
|
+
const s = ref && steps?.find(ref);
|
|
17831
|
+
if (!s || !steps)
|
|
17832
|
+
return null;
|
|
17833
|
+
const b = text(doc, "button", "knobs-wt-steplink", s.number);
|
|
17834
|
+
b.type = "button";
|
|
17835
|
+
b.title = `Go to ${s.number} ${s.title}`;
|
|
17836
|
+
b.setAttribute("aria-label", b.title);
|
|
17837
|
+
b.addEventListener("click", (e) => {
|
|
17838
|
+
e.stopPropagation();
|
|
17839
|
+
steps.go(s.key);
|
|
17840
|
+
});
|
|
17841
|
+
return b;
|
|
17842
|
+
}
|
|
17843
|
+
var tags = (doc, list) => {
|
|
17844
|
+
if (!list?.length)
|
|
17845
|
+
return null;
|
|
17846
|
+
const row = el(doc, "div", "knobs-wt-tags");
|
|
17847
|
+
for (const e of list)
|
|
17848
|
+
row.append(link(doc, "knobs-wt-tag", e.label, e.href));
|
|
17849
|
+
return row;
|
|
17850
|
+
};
|
|
17851
|
+
function mountHistory(host, m, steps) {
|
|
17852
|
+
const doc = host.ownerDocument;
|
|
17853
|
+
const root = el(doc, "div", "knobs-wt-history");
|
|
17854
|
+
const longest = Math.max(6, ...m.groups.flatMap((g) => g.events.flatMap((e) => [e.date.length, e.age?.length ?? 0])));
|
|
17855
|
+
root.style.setProperty("--kw-hw", `${Math.min(16, longest + 1)}ch`);
|
|
17856
|
+
for (const g of m.groups) {
|
|
17857
|
+
const group = el(doc, "section", "knobs-wt-hgroup");
|
|
17858
|
+
if (g.heading || g.summary) {
|
|
17859
|
+
const head = el(doc, "header", "knobs-wt-hhead");
|
|
17860
|
+
if (g.heading)
|
|
17861
|
+
head.append(text(doc, "h4", "knobs-wt-hheading", g.heading));
|
|
17862
|
+
if (g.summary)
|
|
17863
|
+
head.append(text(doc, "span", "knobs-wt-hsum", g.summary));
|
|
17864
|
+
group.append(head);
|
|
17865
|
+
}
|
|
17866
|
+
const list = el(doc, "ol", "knobs-wt-hlist");
|
|
17867
|
+
for (const e of g.events)
|
|
17868
|
+
list.append(historyEvent(doc, e, steps));
|
|
17869
|
+
group.append(list);
|
|
17870
|
+
root.append(group);
|
|
17871
|
+
}
|
|
17872
|
+
host.append(root);
|
|
17873
|
+
return { dispose: () => root.remove(), context: () => ({ kind: "history" }) };
|
|
17874
|
+
}
|
|
17875
|
+
function historyEvent(doc, e, steps) {
|
|
17876
|
+
const li = el(doc, "li", "knobs-wt-hev");
|
|
17877
|
+
if (e.tone)
|
|
17878
|
+
li.dataset.tone = e.tone;
|
|
17879
|
+
if (e.type)
|
|
17880
|
+
li.dataset.type = e.type;
|
|
17881
|
+
if (e.provenance)
|
|
17882
|
+
li.dataset.provenance = e.provenance;
|
|
17883
|
+
const when = el(doc, "div", "knobs-wt-hwhen");
|
|
17884
|
+
when.append(text(doc, "time", "knobs-wt-hdate", e.date));
|
|
17885
|
+
if (e.age)
|
|
17886
|
+
when.append(text(doc, "span", "knobs-wt-hage", e.age));
|
|
17887
|
+
const spine = el(doc, "span", "knobs-wt-hspine");
|
|
17888
|
+
spine.setAttribute("aria-hidden", "true");
|
|
17889
|
+
spine.append(el(doc, "span", "knobs-wt-hdot"));
|
|
17890
|
+
const main = el(doc, "div", "knobs-wt-hmain");
|
|
17891
|
+
const title = el(doc, "div", "knobs-wt-htitle");
|
|
17892
|
+
title.append(text(doc, "span", "knobs-wt-htext", e.title));
|
|
17893
|
+
if (e.provenance || e.source) {
|
|
17894
|
+
const p = text(doc, "span", "knobs-wt-prov", [e.provenance, e.source].filter(Boolean).join(" · "));
|
|
17895
|
+
if (e.provenance === "inferred")
|
|
17896
|
+
p.title = "Inferred from behaviour, not seen in the record";
|
|
17897
|
+
else if (e.provenance === "verified")
|
|
17898
|
+
p.title = "Seen in the record";
|
|
17899
|
+
title.append(p);
|
|
17900
|
+
}
|
|
17901
|
+
const go = stepButton(doc, e.step, steps);
|
|
17902
|
+
if (go)
|
|
17903
|
+
title.append(go);
|
|
17904
|
+
main.append(title);
|
|
17905
|
+
if (e.detail)
|
|
17906
|
+
main.append(prose(doc, "p", "knobs-wt-hdetail", e.detail));
|
|
17907
|
+
const t = tags(doc, e.evidence);
|
|
17908
|
+
if (t)
|
|
17909
|
+
main.append(t);
|
|
17910
|
+
li.append(when, spine, main);
|
|
17911
|
+
return li;
|
|
17912
|
+
}
|
|
17913
|
+
function mountStack(host, m, steps) {
|
|
17914
|
+
const doc = host.ownerDocument;
|
|
17915
|
+
const layout = stackLayout(m);
|
|
17916
|
+
const root = el(doc, "div", "knobs-wt-stack");
|
|
17917
|
+
root.toggleAttribute("data-flat", layout.flat);
|
|
17918
|
+
const lane = (kind) => {
|
|
17919
|
+
const s = el(doc, "span", "knobs-wt-lane");
|
|
17920
|
+
s.dataset.rail = kind;
|
|
17921
|
+
return s;
|
|
17922
|
+
};
|
|
17923
|
+
const node = (down) => {
|
|
17924
|
+
const s = lane("node");
|
|
17925
|
+
s.toggleAttribute("data-down", down);
|
|
17926
|
+
return s;
|
|
17927
|
+
};
|
|
17928
|
+
const from = layout.trunk ? 0 : 1;
|
|
17929
|
+
if (layout.trunk && layout.rows.length) {
|
|
17930
|
+
const row = el(doc, "div", "knobs-wt-srow");
|
|
17931
|
+
row.dataset.trunk = "";
|
|
17932
|
+
const lanes = el(doc, "span", "knobs-wt-lanes");
|
|
17933
|
+
lanes.setAttribute("aria-hidden", "true");
|
|
17934
|
+
lanes.append(node(true));
|
|
17935
|
+
row.append(lanes, text(doc, "span", "knobs-wt-trunk", layout.trunk));
|
|
17936
|
+
root.append(row);
|
|
17937
|
+
}
|
|
17938
|
+
for (const r of layout.rows) {
|
|
17939
|
+
const it = r.item;
|
|
17940
|
+
const row = el(doc, "div", "knobs-wt-srow");
|
|
17941
|
+
if (!layout.flat) {
|
|
17942
|
+
const lanes = el(doc, "span", "knobs-wt-lanes");
|
|
17943
|
+
lanes.setAttribute("aria-hidden", "true");
|
|
17944
|
+
for (let k = from;k < r.depth; k++)
|
|
17945
|
+
lanes.append(lane(r.rails[k] ? "pass" : "none"));
|
|
17946
|
+
if (r.depth >= from)
|
|
17947
|
+
lanes.append(lane(r.last ? "end" : "tee"));
|
|
17948
|
+
lanes.append(node(r.children > 0));
|
|
17949
|
+
row.append(lanes);
|
|
17950
|
+
}
|
|
17951
|
+
const main = el(doc, "div", "knobs-wt-smain");
|
|
17952
|
+
const line = el(doc, "div", "knobs-wt-sline");
|
|
17953
|
+
if (it.order)
|
|
17954
|
+
line.append(text(doc, "span", "knobs-wt-sord", it.order));
|
|
17955
|
+
line.append(link(doc, "knobs-wt-spr", it.pr, it.href));
|
|
17956
|
+
const target = it.step ? steps?.find(it.step) : null;
|
|
17957
|
+
if (target && steps) {
|
|
17958
|
+
const title = text(doc, "button", "knobs-wt-stitle", it.title);
|
|
17959
|
+
title.type = "button";
|
|
17960
|
+
title.title = `Go to ${target.number} ${target.title}`;
|
|
17961
|
+
title.addEventListener("click", (e) => {
|
|
17962
|
+
e.stopPropagation();
|
|
17963
|
+
steps.go(target.key);
|
|
17964
|
+
});
|
|
17965
|
+
line.append(title);
|
|
17966
|
+
const go = stepButton(doc, it.step, steps);
|
|
17967
|
+
if (go)
|
|
17968
|
+
line.append(go);
|
|
17969
|
+
row.dataset.go = "";
|
|
17970
|
+
row.addEventListener("click", (e) => {
|
|
17971
|
+
const t = e.target;
|
|
17972
|
+
if (t?.closest("a,button"))
|
|
17973
|
+
return;
|
|
17974
|
+
if (doc.getSelection()?.toString())
|
|
17975
|
+
return;
|
|
17976
|
+
steps.go(target.key);
|
|
17977
|
+
});
|
|
17978
|
+
} else
|
|
17979
|
+
line.append(text(doc, "span", "knobs-wt-stitle", it.title));
|
|
17980
|
+
main.append(line);
|
|
17981
|
+
if (it.summary)
|
|
17982
|
+
main.append(prose(doc, "p", "knobs-wt-ssummary", it.summary));
|
|
17983
|
+
const meta = el(doc, "div", "knobs-wt-smeta");
|
|
17984
|
+
if (it.head) {
|
|
17985
|
+
const branch = r.offBase ? `${it.head} → ${r.offBase}` : it.head;
|
|
17986
|
+
meta.append(text(doc, "span", "knobs-wt-sbranch", branch));
|
|
17987
|
+
}
|
|
17988
|
+
if (it.delta !== undefined)
|
|
17989
|
+
meta.append(delta(doc, it.delta));
|
|
17990
|
+
if (meta.childNodes.length)
|
|
17991
|
+
main.append(meta);
|
|
17992
|
+
row.append(main);
|
|
17993
|
+
if (it.status) {
|
|
17994
|
+
const chip = text(doc, "span", "knobs-wt-chip knobs-wt-sstatus", it.status);
|
|
17995
|
+
chip.dataset.tone = it.tone ?? "dim";
|
|
17996
|
+
row.append(chip);
|
|
17997
|
+
}
|
|
17998
|
+
root.append(row);
|
|
17999
|
+
}
|
|
18000
|
+
host.append(root);
|
|
18001
|
+
return { dispose: () => root.remove(), context: () => ({ kind: "stack" }) };
|
|
18002
|
+
}
|
|
18003
|
+
function delta(doc, d) {
|
|
18004
|
+
const s = el(doc, "span", "knobs-wt-delta");
|
|
18005
|
+
if (typeof d === "string") {
|
|
18006
|
+
s.textContent = d;
|
|
18007
|
+
return s;
|
|
18008
|
+
}
|
|
18009
|
+
const n = (v) => v.toLocaleString("en-US");
|
|
18010
|
+
s.append(text(doc, "span", "knobs-wt-add", `+${n(d.add)}`));
|
|
18011
|
+
s.append(text(doc, "span", "knobs-wt-del", `−${n(d.del)}`));
|
|
18012
|
+
s.setAttribute("aria-label", `${d.add} added, ${d.del} removed`);
|
|
18013
|
+
return s;
|
|
18014
|
+
}
|
|
18015
|
+
function mountTable(host, m, steps) {
|
|
18016
|
+
const doc = host.ownerDocument;
|
|
18017
|
+
const win = doc.defaultView;
|
|
18018
|
+
const scroller = el(doc, "div", "knobs-wt-table");
|
|
18019
|
+
const table = el(doc, "table");
|
|
18020
|
+
if (m.caption)
|
|
18021
|
+
table.append(text(doc, "caption", "", m.caption));
|
|
18022
|
+
const head = el(doc, "thead");
|
|
18023
|
+
const hr = el(doc, "tr");
|
|
18024
|
+
for (const c of m.columns) {
|
|
18025
|
+
const th = text(doc, "th", "", c.label);
|
|
18026
|
+
th.scope = "col";
|
|
18027
|
+
th.dataset.align = c.align;
|
|
18028
|
+
hr.append(th);
|
|
18029
|
+
}
|
|
18030
|
+
head.append(hr);
|
|
18031
|
+
const body = el(doc, "tbody");
|
|
18032
|
+
for (const r of m.rows) {
|
|
18033
|
+
const tr = el(doc, "tr");
|
|
18034
|
+
for (const c of m.columns) {
|
|
18035
|
+
const td = el(doc, "td");
|
|
18036
|
+
td.dataset.align = c.align;
|
|
18037
|
+
if (c.mono)
|
|
18038
|
+
td.dataset.mono = "";
|
|
18039
|
+
const cell = r[c.key];
|
|
18040
|
+
if (cell) {
|
|
18041
|
+
if (cell.text.length > 40 && !c.mono && !cell.code)
|
|
18042
|
+
td.dataset.long = "";
|
|
18043
|
+
let content;
|
|
18044
|
+
if (cell.badge) {
|
|
18045
|
+
content = link(doc, "knobs-wt-chip", cell.text, cell.href);
|
|
18046
|
+
content.dataset.tone = cell.badge;
|
|
18047
|
+
} else {
|
|
18048
|
+
const inner = cell.code ? text(doc, "code", "", cell.text) : null;
|
|
18049
|
+
if (cell.href) {
|
|
18050
|
+
content = link(doc, "knobs-wt-clink", inner ? "" : cell.text, cell.href);
|
|
18051
|
+
if (inner)
|
|
18052
|
+
content.append(inner);
|
|
18053
|
+
} else
|
|
18054
|
+
content = inner ?? text(doc, "span", "", cell.text);
|
|
18055
|
+
if (cell.tone) {
|
|
18056
|
+
content.classList.add("knobs-wt-ctone");
|
|
18057
|
+
content.dataset.tone = cell.tone;
|
|
18058
|
+
}
|
|
18059
|
+
}
|
|
18060
|
+
td.append(content);
|
|
18061
|
+
const go = stepButton(doc, cell.step, steps);
|
|
18062
|
+
if (go)
|
|
18063
|
+
td.append(go);
|
|
18064
|
+
}
|
|
18065
|
+
tr.append(td);
|
|
18066
|
+
}
|
|
18067
|
+
body.append(tr);
|
|
18068
|
+
}
|
|
18069
|
+
table.append(head, body);
|
|
18070
|
+
scroller.append(table);
|
|
18071
|
+
host.append(scroller);
|
|
18072
|
+
const measure = () => {
|
|
18073
|
+
scroller.style.setProperty("--kw-thead", `${head.offsetHeight}px`);
|
|
18074
|
+
const scrolls = scroller.scrollWidth > scroller.clientWidth + 1 || scroller.scrollHeight > scroller.clientHeight + 1;
|
|
18075
|
+
if (scrolls) {
|
|
18076
|
+
scroller.tabIndex = 0;
|
|
18077
|
+
scroller.setAttribute("role", "region");
|
|
18078
|
+
scroller.setAttribute("aria-label", m.caption ?? "Table");
|
|
18079
|
+
} else {
|
|
18080
|
+
scroller.removeAttribute("tabindex");
|
|
18081
|
+
scroller.removeAttribute("role");
|
|
18082
|
+
scroller.removeAttribute("aria-label");
|
|
18083
|
+
}
|
|
18084
|
+
};
|
|
18085
|
+
const ro = win && "ResizeObserver" in win ? new win.ResizeObserver(measure) : null;
|
|
18086
|
+
ro?.observe(scroller);
|
|
18087
|
+
measure();
|
|
18088
|
+
return {
|
|
18089
|
+
dispose: () => {
|
|
18090
|
+
ro?.disconnect();
|
|
18091
|
+
scroller.remove();
|
|
18092
|
+
},
|
|
18093
|
+
context: () => ({ kind: "table" })
|
|
18094
|
+
};
|
|
18095
|
+
}
|
|
18096
|
+
var grid2 = (v) => Math.round(v * 64) / 64;
|
|
18097
|
+
function chapterPills(host, chapters, io) {
|
|
18098
|
+
const doc = host.ownerDocument;
|
|
18099
|
+
const win = doc.defaultView;
|
|
18100
|
+
const bar = el(doc, "div", "knobs-wt-chapters");
|
|
18101
|
+
bar.setAttribute("role", "group");
|
|
18102
|
+
bar.setAttribute("aria-label", "Chapters");
|
|
18103
|
+
const mark = el(doc, "span", "knobs-wt-chapter-mark");
|
|
18104
|
+
mark.setAttribute("aria-hidden", "true");
|
|
18105
|
+
bar.append(mark);
|
|
18106
|
+
const pills = chapters.map((c) => {
|
|
18107
|
+
const b = el(doc, "button", "knobs-wt-chapter");
|
|
18108
|
+
b.type = "button";
|
|
18109
|
+
b.append(text(doc, "span", "knobs-wt-chapter-time", clock(c.start)));
|
|
18110
|
+
b.append(text(doc, "span", "knobs-wt-chapter-label", c.label));
|
|
18111
|
+
b.addEventListener("click", () => {
|
|
18112
|
+
io.onEvent?.({ what: "seek", time: Math.round(c.start * 100) / 100, detail: c.label });
|
|
18113
|
+
io.seek(c.start);
|
|
18114
|
+
sync();
|
|
18115
|
+
});
|
|
18116
|
+
bar.append(b);
|
|
18117
|
+
return b;
|
|
18118
|
+
});
|
|
18119
|
+
host.append(bar);
|
|
18120
|
+
const x = new Spring(0, MOTION.calm.omega, MOTION.calm.zeta, 0.25);
|
|
18121
|
+
const y = new Spring(0, MOTION.calm.omega, MOTION.calm.zeta, 0.25);
|
|
18122
|
+
const w = new Spring(0, MOTION.calm.omega, MOTION.calm.zeta, 0.25);
|
|
18123
|
+
const draw = () => {
|
|
18124
|
+
const left = grid2(x.x);
|
|
18125
|
+
mark.style.transform = `translate(${left}px,${grid2(y.x)}px)`;
|
|
18126
|
+
mark.style.width = `${grid2(x.x + w.x) - left}px`;
|
|
18127
|
+
};
|
|
18128
|
+
const loop = frameLoop(win, (dt) => {
|
|
18129
|
+
x.step(dt);
|
|
18130
|
+
y.step(dt);
|
|
18131
|
+
w.step(dt);
|
|
18132
|
+
draw();
|
|
18133
|
+
return !x.resting || !y.resting || !w.resting;
|
|
18134
|
+
});
|
|
18135
|
+
let at = -2;
|
|
18136
|
+
let shown = false;
|
|
18137
|
+
const place = (snap) => {
|
|
18138
|
+
const p = pills[at];
|
|
18139
|
+
if (!p) {
|
|
18140
|
+
mark.removeAttribute("data-on");
|
|
18141
|
+
pills.forEach((b) => b.removeAttribute("aria-current"));
|
|
18142
|
+
shown = false;
|
|
18143
|
+
return;
|
|
18144
|
+
}
|
|
18145
|
+
pills.forEach((b, i) => i === at ? b.setAttribute("aria-current", "true") : b.removeAttribute("aria-current"));
|
|
18146
|
+
const to = [p.offsetLeft, p.offsetTop, p.offsetWidth];
|
|
18147
|
+
if (snap || !shown || reducedMotion(win)) {
|
|
18148
|
+
x.snap(to[0]);
|
|
18149
|
+
y.snap(to[1]);
|
|
18150
|
+
w.snap(to[2]);
|
|
18151
|
+
draw();
|
|
18152
|
+
} else {
|
|
18153
|
+
x.set(to[0]);
|
|
18154
|
+
y.set(to[1]);
|
|
18155
|
+
w.set(to[2]);
|
|
18156
|
+
loop.wake();
|
|
18157
|
+
}
|
|
18158
|
+
mark.style.height = `${p.offsetHeight}px`;
|
|
18159
|
+
mark.dataset.on = "";
|
|
18160
|
+
shown = true;
|
|
18161
|
+
};
|
|
18162
|
+
const sync = () => {
|
|
18163
|
+
const next = chapterAt(chapters, io.now());
|
|
18164
|
+
if (next === at)
|
|
18165
|
+
return;
|
|
18166
|
+
at = next;
|
|
18167
|
+
place(false);
|
|
18168
|
+
};
|
|
18169
|
+
sync();
|
|
18170
|
+
const ro = "ResizeObserver" in win ? new win.ResizeObserver(() => place(true)) : null;
|
|
18171
|
+
ro?.observe(bar);
|
|
18172
|
+
return {
|
|
18173
|
+
sync,
|
|
18174
|
+
get current() {
|
|
18175
|
+
return chapters[at] ?? null;
|
|
18176
|
+
},
|
|
18177
|
+
dispose() {
|
|
18178
|
+
loop.stop();
|
|
18179
|
+
ro?.disconnect();
|
|
18180
|
+
bar.remove();
|
|
18181
|
+
}
|
|
18182
|
+
};
|
|
18183
|
+
}
|
|
18184
|
+
|
|
17055
18185
|
// src/ui/walkthrough-media.ts
|
|
17056
18186
|
function injectWalkthroughStyles(doc) {
|
|
17057
18187
|
if (doc.querySelector("style[data-knobs-ui-walkthrough]"))
|
|
@@ -17184,8 +18314,25 @@ async function mountCompare(host, m, look, alive, onEvent) {
|
|
|
17184
18314
|
onEvent?.({ what: "loop", detail: lastLoop = loopKey });
|
|
17185
18315
|
}
|
|
17186
18316
|
});
|
|
18317
|
+
const chapters = m.chapters?.length ? m.chapters : null;
|
|
18318
|
+
if (chapters)
|
|
18319
|
+
c.timeline?.update({
|
|
18320
|
+
markers: chapters.map((ch) => ({ id: ch.id, time: ch.start, label: ch.label }))
|
|
18321
|
+
});
|
|
18322
|
+
const pills = chapters ? chapterPills(host, chapters, {
|
|
18323
|
+
now: () => c.time,
|
|
18324
|
+
seek: (t) => {
|
|
18325
|
+
c.seek(t);
|
|
18326
|
+
c.play();
|
|
18327
|
+
},
|
|
18328
|
+
onEvent
|
|
18329
|
+
}) : null;
|
|
17187
18330
|
const unlisten = c.timeline?.listen({
|
|
17188
|
-
onSeek: (time, source) =>
|
|
18331
|
+
onSeek: (time, source) => {
|
|
18332
|
+
pills?.sync();
|
|
18333
|
+
if (source !== "play")
|
|
18334
|
+
onEvent?.({ what: "seek", time: round2(time) });
|
|
18335
|
+
},
|
|
17189
18336
|
onPlay: (on) => onEvent?.({ what: on ? "play" : "pause", time: round2(c.time) })
|
|
17190
18337
|
});
|
|
17191
18338
|
requestAnimationFrame(() => requestAnimationFrame(() => fit.dataset.settled = ""));
|
|
@@ -17207,12 +18354,14 @@ async function mountCompare(host, m, look, alive, onEvent) {
|
|
|
17207
18354
|
duration: round2(c.duration),
|
|
17208
18355
|
playing: c.playing,
|
|
17209
18356
|
mode: c.mode,
|
|
18357
|
+
...pills?.current ? { chapter: pills.current.label } : {},
|
|
17210
18358
|
...loop ? { loop: { start: round2(loop.start), end: round2(loop.end) } } : {},
|
|
17211
18359
|
...zoom ? { zoom: { u: round2(zoom.u), v: round2(zoom.v), w: round2(zoom.w), h: round2(zoom.h) } } : {}
|
|
17212
18360
|
};
|
|
17213
18361
|
},
|
|
17214
18362
|
dispose: () => {
|
|
17215
18363
|
unlisten?.();
|
|
18364
|
+
pills?.dispose();
|
|
17216
18365
|
c.dispose();
|
|
17217
18366
|
fit.remove();
|
|
17218
18367
|
}
|
|
@@ -17236,6 +18385,15 @@ function mountVideo(host, m, onEvent) {
|
|
|
17236
18385
|
v.poster = m.poster;
|
|
17237
18386
|
if (!aspect)
|
|
17238
18387
|
v.addEventListener("loadedmetadata", () => v.videoWidth && frame.style.setProperty("--kw-aspect", String(v.videoWidth / v.videoHeight)), { once: true });
|
|
18388
|
+
if (m.captions) {
|
|
18389
|
+
const track = doc.createElement("track");
|
|
18390
|
+
track.kind = "captions";
|
|
18391
|
+
track.label = "Captions";
|
|
18392
|
+
track.srclang = doc.documentElement.lang || "en";
|
|
18393
|
+
track.default = true;
|
|
18394
|
+
track.src = m.captions;
|
|
18395
|
+
v.append(track);
|
|
18396
|
+
}
|
|
17239
18397
|
v.src = m.src;
|
|
17240
18398
|
v.addEventListener("play", () => onEvent?.({ what: "play", time: round2(v.currentTime) }));
|
|
17241
18399
|
v.addEventListener("pause", () => onEvent?.({ what: "pause", time: round2(v.currentTime) }));
|
|
@@ -17245,6 +18403,18 @@ function mountVideo(host, m, onEvent) {
|
|
|
17245
18403
|
});
|
|
17246
18404
|
frame.append(v);
|
|
17247
18405
|
host.append(frame);
|
|
18406
|
+
const pills = m.chapters?.length ? chapterPills(host, m.chapters, {
|
|
18407
|
+
now: () => v.currentTime,
|
|
18408
|
+
seek: (t) => {
|
|
18409
|
+
v.currentTime = t;
|
|
18410
|
+
v.play().catch(() => {});
|
|
18411
|
+
},
|
|
18412
|
+
onEvent
|
|
18413
|
+
}) : null;
|
|
18414
|
+
const sync = () => pills?.sync();
|
|
18415
|
+
if (pills)
|
|
18416
|
+
for (const type of ["timeupdate", "seeking", "seeked"])
|
|
18417
|
+
v.addEventListener(type, sync);
|
|
17248
18418
|
return {
|
|
17249
18419
|
pause: () => v.pause(),
|
|
17250
18420
|
seekBy: (d) => {
|
|
@@ -17254,9 +18424,11 @@ function mountVideo(host, m, onEvent) {
|
|
|
17254
18424
|
kind: "video",
|
|
17255
18425
|
time: round2(v.currentTime),
|
|
17256
18426
|
...Number.isFinite(v.duration) ? { duration: round2(v.duration) } : {},
|
|
17257
|
-
playing: !v.paused
|
|
18427
|
+
playing: !v.paused,
|
|
18428
|
+
...pills?.current ? { chapter: pills.current.label } : {}
|
|
17258
18429
|
}),
|
|
17259
18430
|
dispose: () => {
|
|
18431
|
+
pills?.dispose();
|
|
17260
18432
|
v.pause();
|
|
17261
18433
|
v.removeAttribute("src");
|
|
17262
18434
|
v.load();
|
|
@@ -17480,6 +18652,12 @@ function mediaSlot(container, options) {
|
|
|
17480
18652
|
case "callout":
|
|
17481
18653
|
case "text":
|
|
17482
18654
|
return done(mountProse(host, m));
|
|
18655
|
+
case "history":
|
|
18656
|
+
return done(mountHistory(host, m, options.steps));
|
|
18657
|
+
case "stack":
|
|
18658
|
+
return done(mountStack(host, m, options.steps));
|
|
18659
|
+
case "table":
|
|
18660
|
+
return done(mountTable(host, m, options.steps));
|
|
17483
18661
|
case "mount": {
|
|
17484
18662
|
const cleanup = m.mount(host);
|
|
17485
18663
|
return done({ dispose: () => cleanup ? cleanup() : host.textContent = "" });
|
|
@@ -17534,14 +18712,14 @@ function mediaSlot(container, options) {
|
|
|
17534
18712
|
var CHECK3 = svg('<path d="m3.5 8.4 3 3 6-6.6"/>');
|
|
17535
18713
|
|
|
17536
18714
|
// src/ui/walkthrough.ts
|
|
17537
|
-
var
|
|
18715
|
+
var el2 = (doc, tag, cls) => {
|
|
17538
18716
|
const n = doc.createElement(tag);
|
|
17539
18717
|
if (cls)
|
|
17540
18718
|
n.className = cls;
|
|
17541
18719
|
return n;
|
|
17542
18720
|
};
|
|
17543
|
-
var
|
|
17544
|
-
const n =
|
|
18721
|
+
var prose2 = (doc, tag, cls, text) => {
|
|
18722
|
+
const n = el2(doc, tag, cls);
|
|
17545
18723
|
n.innerHTML = inlineMarkdown(text);
|
|
17546
18724
|
return n;
|
|
17547
18725
|
};
|
|
@@ -17549,7 +18727,7 @@ var lookOf2 = (o) => ({
|
|
|
17549
18727
|
...o.preset ? { preset: o.preset } : {},
|
|
17550
18728
|
...o.theme ? { theme: o.theme } : {}
|
|
17551
18729
|
});
|
|
17552
|
-
var
|
|
18730
|
+
var grid3 = (v) => Math.round(v * 64) / 64;
|
|
17553
18731
|
var ICON = {
|
|
17554
18732
|
full: svg('<path d="M3 6.5V3h3.5M13 6.5V3H9.5M3 9.5V13h3.5M13 9.5V13H9.5"/>'),
|
|
17555
18733
|
exit: svg('<path d="M6.5 3v3.5H3M9.5 3v3.5H13M6.5 13V9.5H3M9.5 13V9.5H13"/>'),
|
|
@@ -17575,7 +18753,7 @@ function tasteTest(container, options) {
|
|
|
17575
18753
|
suggested: o.suggested === true
|
|
17576
18754
|
});
|
|
17577
18755
|
let picked = options.picked ?? null;
|
|
17578
|
-
const root =
|
|
18756
|
+
const root = el2(doc, "div", "knobs-wt-options");
|
|
17579
18757
|
root.setAttribute("role", "radiogroup");
|
|
17580
18758
|
root.setAttribute("aria-label", "Options");
|
|
17581
18759
|
root.style.setProperty("--kw-n", String(Math.min(list.length, 3)));
|
|
@@ -17583,28 +18761,28 @@ function tasteTest(container, options) {
|
|
|
17583
18761
|
applyLook2(root, options);
|
|
17584
18762
|
const slots = [];
|
|
17585
18763
|
const tiles = list.map((o, i) => {
|
|
17586
|
-
const tile =
|
|
17587
|
-
const pick =
|
|
18764
|
+
const tile = el2(doc, "div", "knobs-wt-option");
|
|
18765
|
+
const pick = el2(doc, "button", "knobs-wt-pick");
|
|
17588
18766
|
pick.type = "button";
|
|
17589
18767
|
pick.setAttribute("role", "radio");
|
|
17590
18768
|
if (i < 9)
|
|
17591
18769
|
pick.setAttribute("aria-keyshortcuts", String(i + 1));
|
|
17592
|
-
const letter =
|
|
18770
|
+
const letter = el2(doc, "span", "knobs-wt-letter");
|
|
17593
18771
|
letter.textContent = o.letter;
|
|
17594
|
-
const name =
|
|
18772
|
+
const name = el2(doc, "span", "knobs-wt-olabel");
|
|
17595
18773
|
name.textContent = o.label;
|
|
17596
18774
|
pick.append(letter, name);
|
|
17597
18775
|
if (o.suggested) {
|
|
17598
|
-
const s =
|
|
18776
|
+
const s = el2(doc, "span", "knobs-wt-suggested");
|
|
17599
18777
|
s.textContent = "Suggested";
|
|
17600
18778
|
pick.append(s);
|
|
17601
18779
|
}
|
|
17602
18780
|
if (i < 9) {
|
|
17603
|
-
const key =
|
|
18781
|
+
const key = el2(doc, "span", "knobs-wt-key");
|
|
17604
18782
|
key.textContent = String(i + 1);
|
|
17605
18783
|
pick.append(key);
|
|
17606
18784
|
}
|
|
17607
|
-
const check =
|
|
18785
|
+
const check = el2(doc, "span", "knobs-wt-check");
|
|
17608
18786
|
check.innerHTML = CHECK3;
|
|
17609
18787
|
pick.append(check);
|
|
17610
18788
|
pick.addEventListener("click", () => {
|
|
@@ -17617,10 +18795,11 @@ function tasteTest(container, options) {
|
|
|
17617
18795
|
slots.push(mediaSlot(tile, {
|
|
17618
18796
|
...look,
|
|
17619
18797
|
media: o.media,
|
|
17620
|
-
...options.lazy === false ? { lazy: false } : {}
|
|
18798
|
+
...options.lazy === false ? { lazy: false } : {},
|
|
18799
|
+
...options.steps ? { steps: options.steps } : {}
|
|
17621
18800
|
}));
|
|
17622
18801
|
if (o.caption)
|
|
17623
|
-
tile.append(
|
|
18802
|
+
tile.append(prose2(doc, "p", "knobs-wt-ocap", o.caption));
|
|
17624
18803
|
root.append(tile);
|
|
17625
18804
|
return { tile, pick };
|
|
17626
18805
|
});
|
|
@@ -17668,7 +18847,7 @@ function walkthrough(container, options) {
|
|
|
17668
18847
|
injectWalkthroughStyles(doc);
|
|
17669
18848
|
const look = lookOf2(options);
|
|
17670
18849
|
const storage = options.storage === undefined ? browserStorage() : options.storage;
|
|
17671
|
-
const root =
|
|
18850
|
+
const root = el2(doc, "div", "knobs-walkthrough");
|
|
17672
18851
|
applyLook2(root, options);
|
|
17673
18852
|
container.append(root);
|
|
17674
18853
|
let page = normalizeWalkthrough(options.doc);
|
|
@@ -17728,8 +18907,8 @@ function walkthrough(container, options) {
|
|
|
17728
18907
|
if (mark) {
|
|
17729
18908
|
pillY.step(dt);
|
|
17730
18909
|
pillH.step(dt);
|
|
17731
|
-
mark.style.transform = `translateY(${
|
|
17732
|
-
mark.style.height = `${
|
|
18910
|
+
mark.style.transform = `translateY(${grid3(pillY.x)}px)`;
|
|
18911
|
+
mark.style.height = `${grid3(pillY.x + pillH.x) - grid3(pillY.x)}px`;
|
|
17733
18912
|
more ||= !pillY.resting || !pillH.resting;
|
|
17734
18913
|
}
|
|
17735
18914
|
if (scroll.to && scroll.el) {
|
|
@@ -17864,6 +19043,10 @@ function walkthrough(container, options) {
|
|
|
17864
19043
|
scrollToCard(v);
|
|
17865
19044
|
v.card.focus({ preventScroll: true });
|
|
17866
19045
|
};
|
|
19046
|
+
const stepLinks = {
|
|
19047
|
+
find: (ref) => findStep(page.steps, ref) ?? null,
|
|
19048
|
+
go: (key) => go(key)
|
|
19049
|
+
};
|
|
17867
19050
|
const slotsOf = (v) => v ? [...v.slots, ...v.taste?.slots ?? []] : [];
|
|
17868
19051
|
const mediaContext = (v) => {
|
|
17869
19052
|
const slots = slotsOf(v);
|
|
@@ -17878,17 +19061,17 @@ function walkthrough(container, options) {
|
|
|
17878
19061
|
return true;
|
|
17879
19062
|
return false;
|
|
17880
19063
|
};
|
|
17881
|
-
const scrim =
|
|
19064
|
+
const scrim = el2(doc, "div", "knobs-wt-scrim");
|
|
17882
19065
|
scrim.addEventListener("click", () => setFull(false));
|
|
17883
19066
|
const fullRect = () => ({ x: 12, y: 12, w: win.innerWidth - 24, h: win.innerHeight - 24 });
|
|
17884
19067
|
const placeFull = (f) => {
|
|
17885
19068
|
const a = f.hold.getBoundingClientRect();
|
|
17886
19069
|
const b = fullRect();
|
|
17887
19070
|
const k = reduced() ? Math.round(f.p.target) : f.p.x;
|
|
17888
|
-
const left =
|
|
17889
|
-
const top =
|
|
17890
|
-
const right =
|
|
17891
|
-
const bottom =
|
|
19071
|
+
const left = grid3(a.left + (b.x - a.left) * k);
|
|
19072
|
+
const top = grid3(a.top + (b.y - a.top) * k);
|
|
19073
|
+
const right = grid3(a.right + (b.x + b.w - a.right) * k);
|
|
19074
|
+
const bottom = grid3(a.bottom + (b.y + b.h - a.bottom) * k);
|
|
17892
19075
|
const s = f.v.card.style;
|
|
17893
19076
|
s.left = `${left}px`;
|
|
17894
19077
|
s.top = `${top}px`;
|
|
@@ -17923,7 +19106,7 @@ function walkthrough(container, options) {
|
|
|
17923
19106
|
}
|
|
17924
19107
|
if (!full) {
|
|
17925
19108
|
const r = v.card.getBoundingClientRect();
|
|
17926
|
-
const hold =
|
|
19109
|
+
const hold = el2(doc, "div", "knobs-wt-hold-card");
|
|
17927
19110
|
hold.style.height = `${r.height}px`;
|
|
17928
19111
|
v.card.before(hold);
|
|
17929
19112
|
v.card.dataset.full = "";
|
|
@@ -18071,7 +19254,7 @@ function walkthrough(container, options) {
|
|
|
18071
19254
|
toast("Couldn't reach the microphone", { tone: "warn", look, doc });
|
|
18072
19255
|
}
|
|
18073
19256
|
};
|
|
18074
|
-
const backPill =
|
|
19257
|
+
const backPill = el2(doc, "button", "knobs-wt-back");
|
|
18075
19258
|
backPill.type = "button";
|
|
18076
19259
|
let backTo = null;
|
|
18077
19260
|
let backTimer = 0;
|
|
@@ -18096,16 +19279,16 @@ function walkthrough(container, options) {
|
|
|
18096
19279
|
backTimer = win.setTimeout(hideBack, BACK_MS);
|
|
18097
19280
|
};
|
|
18098
19281
|
const bar = (() => {
|
|
18099
|
-
const dock =
|
|
18100
|
-
const box =
|
|
18101
|
-
const on =
|
|
18102
|
-
const row =
|
|
18103
|
-
const input =
|
|
19282
|
+
const dock = el2(doc, "div", "knobs-wt-dock");
|
|
19283
|
+
const box = el2(doc, "div", "knobs-wt-notebar");
|
|
19284
|
+
const on = el2(doc, "div", "knobs-wt-on");
|
|
19285
|
+
const row = el2(doc, "div", "knobs-wt-row");
|
|
19286
|
+
const input = el2(doc, "textarea", "knobs-wt-input");
|
|
18104
19287
|
input.rows = 1;
|
|
18105
19288
|
input.setAttribute("aria-label", "Note");
|
|
18106
|
-
const attach =
|
|
19289
|
+
const attach = el2(doc, "div", "knobs-wt-attach");
|
|
18107
19290
|
const btn = (icon, label, run) => {
|
|
18108
|
-
const b =
|
|
19291
|
+
const b = el2(doc, "button", "knobs-wt-tool");
|
|
18109
19292
|
b.type = "button";
|
|
18110
19293
|
b.innerHTML = icon;
|
|
18111
19294
|
b.setAttribute("aria-label", label);
|
|
@@ -18116,7 +19299,7 @@ function walkthrough(container, options) {
|
|
|
18116
19299
|
const fullBtn = btn(ICON.full, "Full window · f", () => setFull(!full));
|
|
18117
19300
|
const penBtn = btn(ICON.pen, "Draw on the media", () => setInk(!ink.on));
|
|
18118
19301
|
const micBtn = btn(ICON.mic, "Record a voice note", () => void toggleVoice());
|
|
18119
|
-
const micTime =
|
|
19302
|
+
const micTime = el2(doc, "span", "knobs-wt-rec");
|
|
18120
19303
|
micBtn.append(micTime);
|
|
18121
19304
|
const sendBtn = btn(ICON.send, "Send · Enter", () => send());
|
|
18122
19305
|
sendBtn.dataset.send = "";
|
|
@@ -18142,9 +19325,9 @@ function walkthrough(container, options) {
|
|
|
18142
19325
|
}
|
|
18143
19326
|
});
|
|
18144
19327
|
const chip = (text, clear) => {
|
|
18145
|
-
const c =
|
|
19328
|
+
const c = el2(doc, "span", "knobs-wt-chip-a");
|
|
18146
19329
|
c.append(text);
|
|
18147
|
-
const x =
|
|
19330
|
+
const x = el2(doc, "button", "knobs-wt-x");
|
|
18148
19331
|
x.type = "button";
|
|
18149
19332
|
x.innerHTML = ICON.close;
|
|
18150
19333
|
x.setAttribute("aria-label", `Remove ${text}`);
|
|
@@ -18257,9 +19440,9 @@ function walkthrough(container, options) {
|
|
|
18257
19440
|
}
|
|
18258
19441
|
};
|
|
18259
19442
|
const renderNote = (v, n, entering = false) => {
|
|
18260
|
-
const row =
|
|
19443
|
+
const row = el2(doc, "div", "knobs-wt-n");
|
|
18261
19444
|
row.dataset.id = n.id;
|
|
18262
|
-
const meta =
|
|
19445
|
+
const meta = el2(doc, "span", "knobs-wt-n-meta");
|
|
18263
19446
|
const m = n.context.media;
|
|
18264
19447
|
meta.textContent = m?.time !== undefined ? formatTime(m.time) : m?.file ? m.file.split("/").pop() : "·";
|
|
18265
19448
|
if (m?.time !== undefined) {
|
|
@@ -18275,11 +19458,11 @@ function walkthrough(container, options) {
|
|
|
18275
19458
|
});
|
|
18276
19459
|
}
|
|
18277
19460
|
row.append(meta);
|
|
18278
|
-
const body =
|
|
19461
|
+
const body = el2(doc, "div", "knobs-wt-n-body");
|
|
18279
19462
|
if (n.text)
|
|
18280
|
-
body.append(
|
|
19463
|
+
body.append(prose2(doc, "p", "knobs-wt-n-text", n.text));
|
|
18281
19464
|
if (n.voice) {
|
|
18282
|
-
const a =
|
|
19465
|
+
const a = el2(doc, "audio", "knobs-wt-n-voice");
|
|
18283
19466
|
a.controls = true;
|
|
18284
19467
|
a.preload = "none";
|
|
18285
19468
|
a.src = n.voice.url;
|
|
@@ -18299,7 +19482,7 @@ function walkthrough(container, options) {
|
|
|
18299
19482
|
body.append(thumb);
|
|
18300
19483
|
}
|
|
18301
19484
|
row.append(body);
|
|
18302
|
-
const x =
|
|
19485
|
+
const x = el2(doc, "button", "knobs-wt-x");
|
|
18303
19486
|
x.type = "button";
|
|
18304
19487
|
x.innerHTML = ICON.close;
|
|
18305
19488
|
x.setAttribute("aria-label", "Delete this note");
|
|
@@ -18353,22 +19536,22 @@ function walkthrough(container, options) {
|
|
|
18353
19536
|
pillPlaced = false;
|
|
18354
19537
|
root.textContent = "";
|
|
18355
19538
|
root.removeAttribute("data-settled");
|
|
18356
|
-
const layout =
|
|
18357
|
-
const main =
|
|
18358
|
-
const head =
|
|
18359
|
-
const h1 =
|
|
19539
|
+
const layout = el2(doc, "div", "knobs-wt-layout");
|
|
19540
|
+
const main = el2(doc, "div", "knobs-wt-main");
|
|
19541
|
+
const head = el2(doc, "header", "knobs-wt-head");
|
|
19542
|
+
const h1 = el2(doc, "h1", "knobs-wt-title");
|
|
18360
19543
|
h1.textContent = page.title;
|
|
18361
19544
|
head.append(h1);
|
|
18362
19545
|
if (page.summary)
|
|
18363
|
-
head.append(
|
|
19546
|
+
head.append(prose2(doc, "p", "knobs-wt-summary", page.summary));
|
|
18364
19547
|
if (page.meta.length) {
|
|
18365
|
-
const meta =
|
|
19548
|
+
const meta = el2(doc, "div", "knobs-wt-meta");
|
|
18366
19549
|
for (const m of page.meta) {
|
|
18367
|
-
const s =
|
|
19550
|
+
const s = el2(doc, "span");
|
|
18368
19551
|
s.append(m.label);
|
|
18369
|
-
const b =
|
|
19552
|
+
const b = el2(doc, "b");
|
|
18370
19553
|
if (m.href) {
|
|
18371
|
-
const a =
|
|
19554
|
+
const a = el2(doc, "a");
|
|
18372
19555
|
a.href = m.href;
|
|
18373
19556
|
a.target = "_blank";
|
|
18374
19557
|
a.rel = "noreferrer";
|
|
@@ -18383,27 +19566,27 @@ function walkthrough(container, options) {
|
|
|
18383
19566
|
}
|
|
18384
19567
|
main.append(head);
|
|
18385
19568
|
if (page.feed.length) {
|
|
18386
|
-
const feed =
|
|
19569
|
+
const feed = el2(doc, "section", "knobs-wt-feed");
|
|
18387
19570
|
feed.setAttribute("aria-label", "Latest");
|
|
18388
|
-
const list =
|
|
19571
|
+
const list = el2(doc, "ol", "knobs-wt-feed-list knobs-scroll-fade");
|
|
18389
19572
|
const now = Date.now();
|
|
18390
19573
|
for (const f of page.feed) {
|
|
18391
|
-
const li =
|
|
19574
|
+
const li = el2(doc, "li", "knobs-wt-fi");
|
|
18392
19575
|
li.dataset.kind = f.kind;
|
|
18393
|
-
const when =
|
|
19576
|
+
const when = el2(doc, "span", "knobs-wt-fi-when");
|
|
18394
19577
|
when.textContent = f.at === null ? "" : ago(f.at, now);
|
|
18395
19578
|
if (f.at !== null)
|
|
18396
19579
|
when.title = new Date(f.at).toLocaleString();
|
|
18397
|
-
const kind =
|
|
19580
|
+
const kind = el2(doc, "span", "knobs-wt-fi-kind");
|
|
18398
19581
|
kind.textContent = f.kind === "qa" ? "Answer" : "Update";
|
|
18399
|
-
const body =
|
|
19582
|
+
const body = el2(doc, "div", "knobs-wt-fi-body");
|
|
18400
19583
|
if (f.q)
|
|
18401
|
-
body.append(
|
|
18402
|
-
body.append(
|
|
19584
|
+
body.append(prose2(doc, "p", "knobs-wt-fi-q", f.q));
|
|
19585
|
+
body.append(prose2(doc, "p", "knobs-wt-fi-text", f.text));
|
|
18403
19586
|
li.append(when, kind, body);
|
|
18404
19587
|
if (f.step) {
|
|
18405
19588
|
const target = f.step;
|
|
18406
|
-
const link =
|
|
19589
|
+
const link = el2(doc, "button", "knobs-wt-fi-step");
|
|
18407
19590
|
link.type = "button";
|
|
18408
19591
|
link.textContent = page.steps.find((s) => s.key === target)?.number ?? "";
|
|
18409
19592
|
link.title = "Go to the step";
|
|
@@ -18418,33 +19601,33 @@ function walkthrough(container, options) {
|
|
|
18418
19601
|
let rail = null;
|
|
18419
19602
|
count = fill = tocEl = mark = null;
|
|
18420
19603
|
if (options.rail !== false) {
|
|
18421
|
-
rail =
|
|
19604
|
+
rail = el2(doc, "aside", "knobs-wt-rail");
|
|
18422
19605
|
rail.setAttribute("aria-label", "Progress");
|
|
18423
|
-
const progress =
|
|
18424
|
-
count =
|
|
18425
|
-
const meter =
|
|
18426
|
-
fill =
|
|
19606
|
+
const progress = el2(doc, "div", "knobs-wt-progress");
|
|
19607
|
+
count = el2(doc, "div", "knobs-wt-count");
|
|
19608
|
+
const meter = el2(doc, "div", "knobs-wt-bar");
|
|
19609
|
+
fill = el2(doc, "div", "knobs-wt-fill");
|
|
18427
19610
|
meter.append(fill);
|
|
18428
19611
|
progress.append(count, meter);
|
|
18429
|
-
tocEl =
|
|
19612
|
+
tocEl = el2(doc, "nav", "knobs-wt-toc");
|
|
18430
19613
|
tocEl.setAttribute("aria-label", "Contents");
|
|
18431
|
-
mark =
|
|
19614
|
+
mark = el2(doc, "div", "knobs-wt-toc-mark");
|
|
18432
19615
|
tocEl.append(mark);
|
|
18433
19616
|
rail.append(progress, tocEl, actions(true));
|
|
18434
19617
|
if (options.keys !== false) {
|
|
18435
|
-
const keys =
|
|
19618
|
+
const keys = el2(doc, "div", "knobs-wt-keys");
|
|
18436
19619
|
keys.innerHTML = "<kbd>j</kbd> <kbd>k</kbd> steps · <kbd>←</kbd> <kbd>→</kbd> seek · <kbd>f</kbd> full · <kbd>n</kbd> note" + (page.steps.some((s) => s.ask === "pick") ? " · <kbd>1</kbd>–<kbd>9</kbd> pick" : "");
|
|
18437
19620
|
rail.append(keys);
|
|
18438
19621
|
}
|
|
18439
19622
|
}
|
|
18440
19623
|
for (const section of page.sections) {
|
|
18441
|
-
const sec =
|
|
19624
|
+
const sec = el2(doc, "section", "knobs-wt-section");
|
|
18442
19625
|
sec.id = `wt-${section.id}`;
|
|
18443
|
-
const sh =
|
|
19626
|
+
const sh = el2(doc, "header", "knobs-wt-shead");
|
|
18444
19627
|
if (section.link || section.status) {
|
|
18445
|
-
const kicker =
|
|
19628
|
+
const kicker = el2(doc, "div", "knobs-wt-kicker");
|
|
18446
19629
|
if (section.link) {
|
|
18447
|
-
const a =
|
|
19630
|
+
const a = el2(doc, "a");
|
|
18448
19631
|
a.href = section.link.href;
|
|
18449
19632
|
a.target = "_blank";
|
|
18450
19633
|
a.rel = "noreferrer";
|
|
@@ -18453,21 +19636,21 @@ function walkthrough(container, options) {
|
|
|
18453
19636
|
}
|
|
18454
19637
|
if (section.status) {
|
|
18455
19638
|
const s = statusLook(section.status);
|
|
18456
|
-
const chip =
|
|
19639
|
+
const chip = el2(doc, "span", "knobs-wt-chip");
|
|
18457
19640
|
chip.dataset.tone = s.tone;
|
|
18458
19641
|
chip.textContent = s.label;
|
|
18459
19642
|
kicker.append(chip);
|
|
18460
19643
|
}
|
|
18461
19644
|
sh.append(kicker);
|
|
18462
19645
|
}
|
|
18463
|
-
const h2 =
|
|
19646
|
+
const h2 = el2(doc, "h2", "knobs-wt-stitle");
|
|
18464
19647
|
h2.textContent = section.title;
|
|
18465
19648
|
sh.append(h2);
|
|
18466
19649
|
if (section.summary)
|
|
18467
|
-
sh.append(
|
|
19650
|
+
sh.append(prose2(doc, "p", "knobs-wt-ssum", section.summary));
|
|
18468
19651
|
sec.append(sh);
|
|
18469
19652
|
if (tocEl) {
|
|
18470
|
-
const t =
|
|
19653
|
+
const t = el2(doc, "div", "knobs-wt-toc-section");
|
|
18471
19654
|
t.textContent = section.link ? `${section.link.label} ${section.title}` : section.title;
|
|
18472
19655
|
t.title = section.title;
|
|
18473
19656
|
tocEl.append(t);
|
|
@@ -18500,9 +19683,9 @@ function walkthrough(container, options) {
|
|
|
18500
19683
|
}));
|
|
18501
19684
|
};
|
|
18502
19685
|
const actions = (rail) => {
|
|
18503
|
-
const row =
|
|
19686
|
+
const row = el2(doc, "div", "knobs-wt-actions");
|
|
18504
19687
|
const btn = (text, run, primary = false) => {
|
|
18505
|
-
const b =
|
|
19688
|
+
const b = el2(doc, "button", "knobs-wt-btn");
|
|
18506
19689
|
b.type = "button";
|
|
18507
19690
|
b.textContent = text;
|
|
18508
19691
|
if (primary)
|
|
@@ -18540,43 +19723,44 @@ function walkthrough(container, options) {
|
|
|
18540
19723
|
}
|
|
18541
19724
|
};
|
|
18542
19725
|
const stepView = (step) => {
|
|
18543
|
-
const card =
|
|
19726
|
+
const card = el2(doc, "article", "knobs-wt-step knobs-surface");
|
|
18544
19727
|
card.id = `wt-${step.key.replace("/", "--")}`;
|
|
18545
19728
|
card.tabIndex = -1;
|
|
18546
19729
|
card.dataset.key = step.key;
|
|
18547
19730
|
card.setAttribute("aria-label", `${step.number} ${step.title}`);
|
|
18548
|
-
const head =
|
|
18549
|
-
const num =
|
|
19731
|
+
const head = el2(doc, "header", "knobs-wt-step-head");
|
|
19732
|
+
const num = el2(doc, "span", "knobs-wt-num");
|
|
18550
19733
|
num.textContent = step.number;
|
|
18551
|
-
const h3 =
|
|
19734
|
+
const h3 = el2(doc, "h3", "knobs-wt-stepTitle");
|
|
18552
19735
|
h3.textContent = step.title;
|
|
18553
19736
|
head.append(num, h3);
|
|
18554
19737
|
card.append(head);
|
|
18555
19738
|
if (step.caption)
|
|
18556
|
-
card.append(
|
|
19739
|
+
card.append(prose2(doc, "p", "knobs-wt-caption", step.caption));
|
|
18557
19740
|
const slots = [];
|
|
18558
19741
|
const onEvent = (e) => record({ ...e, step: step.key });
|
|
18559
19742
|
let media = null;
|
|
18560
19743
|
if (step.media.length) {
|
|
18561
|
-
media =
|
|
19744
|
+
media = el2(doc, "div", "knobs-wt-media");
|
|
18562
19745
|
media.style.setProperty("--kw-n", String(Math.min(step.media.length, 3)));
|
|
18563
19746
|
for (const m of step.media)
|
|
18564
|
-
slots.push(mediaSlot(media, { ...look, media: m, onEvent }));
|
|
19747
|
+
slots.push(mediaSlot(media, { ...look, media: m, onEvent, steps: stepLinks }));
|
|
18565
19748
|
card.append(media);
|
|
18566
19749
|
}
|
|
18567
19750
|
let taste = null;
|
|
18568
19751
|
if (step.question)
|
|
18569
|
-
card.append(
|
|
19752
|
+
card.append(prose2(doc, "p", "knobs-wt-question", step.question));
|
|
18570
19753
|
if (step.ask === "pick") {
|
|
18571
19754
|
taste = tasteTest(card, {
|
|
18572
19755
|
...look,
|
|
18573
19756
|
options: step.options,
|
|
18574
19757
|
picked: state.steps[step.key]?.pick ?? null,
|
|
18575
|
-
onPick: (id) => pick(step.key, id)
|
|
19758
|
+
onPick: (id) => pick(step.key, id),
|
|
19759
|
+
steps: stepLinks
|
|
18576
19760
|
});
|
|
18577
19761
|
media ??= taste.element;
|
|
18578
19762
|
}
|
|
18579
|
-
const notes =
|
|
19763
|
+
const notes = el2(doc, "div", "knobs-wt-notes");
|
|
18580
19764
|
card.append(notes);
|
|
18581
19765
|
card.addEventListener("focusin", () => {
|
|
18582
19766
|
if (scroll.to)
|
|
@@ -18587,10 +19771,10 @@ function walkthrough(container, options) {
|
|
|
18587
19771
|
let toc = null;
|
|
18588
19772
|
let glyph = null;
|
|
18589
19773
|
if (tocEl) {
|
|
18590
|
-
toc =
|
|
19774
|
+
toc = el2(doc, "button", "knobs-wt-toc-step");
|
|
18591
19775
|
toc.type = "button";
|
|
18592
|
-
glyph =
|
|
18593
|
-
const label =
|
|
19776
|
+
glyph = el2(doc, "span", "knobs-wt-toc-glyph");
|
|
19777
|
+
const label = el2(doc, "span", "knobs-wt-toc-label");
|
|
18594
19778
|
label.textContent = step.title;
|
|
18595
19779
|
toc.title = `${step.number} ${step.title}`;
|
|
18596
19780
|
toc.append(glyph, label);
|