@kitlangton/knobs 0.4.0-next.0 → 0.4.0-next.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +451 -54
- package/dist/dev/{chunk-7xgkerd2.js → chunk-3ygqgy1x.js} +23 -1
- package/dist/dev/{chunk-stbcgz1y.js → chunk-5pb7ymrd.js} +567 -471
- package/dist/dev/{chunk-t68smqkc.js → chunk-a7cjgy8x.js} +13 -11
- package/dist/dev/{chunk-pmkvb9ep.js → chunk-dyq4m24m.js} +2081 -507
- package/dist/dev/index.js +10 -5
- package/dist/index.js +25 -1
- package/dist/panel.js +3187 -1341
- package/dist/react.js +294 -6
- package/dist/review-react.js +18580 -0
- package/dist/review-solid.js +18482 -0
- package/dist/review.js +18488 -0
- package/dist/solid.js +292 -4
- package/dist/themes.js +1767 -7
- package/dist/types/core/adapter.d.ts +6 -2
- package/dist/types/core/appearance.d.ts +44 -0
- package/dist/types/core/glide.d.ts +7 -0
- package/dist/types/core/motion.d.ts +66 -0
- package/dist/types/core/root.d.ts +13 -0
- package/dist/types/core/store.d.ts +18 -5
- package/dist/types/core/theme.d.ts +10 -3
- package/dist/types/index.d.ts +2 -1
- package/dist/types/panel/gpu/color.d.ts +6 -0
- package/dist/types/panel/motion.d.ts +1 -1
- package/dist/types/panel/styles.d.ts +2 -3
- package/dist/types/review/font.d.ts +13 -0
- package/dist/types/review/foundations.d.ts +175 -0
- package/dist/types/review/index.d.ts +13 -0
- package/dist/types/review/react.d.ts +1 -0
- package/dist/types/review/solid.d.ts +1 -0
- package/dist/types/themes/define.d.ts +104 -0
- package/dist/types/themes/index.d.ts +16 -0
- package/dist/types/themes/knobs.d.ts +5 -0
- package/dist/types/themes/review.d.ts +8 -0
- package/dist/types/themes/void.d.ts +8 -0
- package/dist/types/tokens/color.d.ts +42 -0
- package/dist/types/tokens/css.d.ts +13 -0
- package/dist/types/tokens/evaluate.d.ts +8 -0
- package/dist/types/tokens/index.d.ts +4 -0
- package/dist/types/tokens/schema.d.ts +1280 -0
- package/dist/types/ui/bento-css.d.ts +1 -1
- package/dist/types/ui/compare-css.d.ts +1 -1
- package/dist/types/ui/compare-gpu.d.ts +6 -6
- package/dist/types/ui/compare-model.d.ts +85 -2
- package/dist/types/ui/compare.d.ts +18 -4
- package/dist/types/ui/diff.d.ts +4 -5
- package/dist/types/ui/history-css.d.ts +1 -0
- package/dist/types/ui/history-model.d.ts +249 -0
- package/dist/types/ui/history.d.ts +38 -0
- package/dist/types/ui/icons.d.ts +40 -0
- package/dist/types/ui/index.d.ts +9 -5
- package/dist/types/ui/look.d.ts +18 -13
- package/dist/types/ui/overlay-css.d.ts +1 -1
- package/dist/types/ui/player-css.d.ts +1 -0
- package/dist/types/ui/player.d.ts +51 -0
- package/dist/types/ui/readout-css.d.ts +1 -1
- package/dist/types/ui/readout-model.d.ts +5 -1
- package/dist/types/ui/review-look.d.ts +6 -0
- package/dist/types/ui/review-options.d.ts +28 -0
- package/dist/types/ui/rgba.d.ts +11 -0
- package/dist/types/ui/selection-pill-css.d.ts +1 -0
- package/dist/types/ui/selection-pill.d.ts +106 -0
- package/dist/types/ui/timeline-model.d.ts +27 -0
- package/dist/types/ui/timeline.d.ts +16 -1
- package/dist/types/ui/tree.d.ts +3 -2
- package/dist/types/ui/walkthrough-annotations.d.ts +42 -0
- package/dist/types/ui/walkthrough-blocks.d.ts +87 -0
- package/dist/types/ui/walkthrough-media.d.ts +30 -1
- package/dist/types/ui/walkthrough-model.d.ts +469 -5
- package/dist/types/ui/walkthrough.d.ts +27 -5
- package/dist/ui-react.js +8087 -2350
- package/dist/ui-solid.js +8100 -2363
- package/dist/ui.js +9751 -3963
- package/package.json +13 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const bentoCss = "\n.knobs-ui.knobs-bento{--
|
|
1
|
+
export declare const bentoCss = "\n.knobs-ui.knobs-bento{--_ku-bento-radius:var(--k-ui-bento-radius,max(0px,calc(var(--_k-radius) - 5px)));\n position:relative;width:100%;height:100%;overflow:hidden auto;outline:none;background:var(--k-ui-bento-bg,var(--_k-bg-page));\n scrollbar-width:thin;scrollbar-gutter:stable;overscroll-behavior:contain;touch-action:pan-y;user-select:none;-webkit-user-select:none;\n font:var(--_k-weight) var(--_k-font-size)/1.35 var(--_k-font);color:var(--_k-fg);letter-spacing:normal;text-align:left}\n.knobs-bento[data-frame=\"flat\"]{--_ku-bento-radius:var(--k-ui-bento-radius,0px)}\n.knobs-bento[data-pending] .knobs-bento-space{visibility:hidden}\n:where(.knobs-bento-space,.knobs-bento-space *){box-sizing:border-box}\n.knobs-bento-space{position:relative;width:100%}\n.knobs-bento-tile{position:absolute;left:0;top:0;transform-origin:0 0;overflow:hidden;border-radius:var(--_ku-bento-radius);\n background:var(--_k-fill);contain:strict;cursor:zoom-in}\n.knobs-bento-tile[data-focus]{z-index:2;cursor:zoom-out}\n.knobs-bento-tile[data-focus][data-live]{cursor:auto}\n.knobs-bento-img{display:block;width:100%;height:100%;object-fit:cover;opacity:0;transition:opacity .18s cubic-bezier(.2,.8,.2,1);-webkit-user-drag:none}\n.knobs-bento-tile[data-ready] .knobs-bento-img{opacity:1}\n.knobs-bento-tile[data-instant] .knobs-bento-img{transition:none}\n.knobs-bento-body{position:absolute;inset:0;pointer-events:none}\n.knobs-bento-tile[data-focus] .knobs-bento-body{pointer-events:auto}\n.knobs-bento-label{position:absolute;left:9px;right:9px;bottom:7px;color:#fff;font-size:var(--_k-text-meta);line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;\n text-shadow:0 0 6px rgba(0,0,0,.55),0 0 1px rgba(0,0,0,.5);opacity:0;pointer-events:none;transition:opacity calc(var(--_k-hover-out) * 1ms)}\n.knobs-bento:not([data-keyboard]) .knobs-bento-tile:hover .knobs-bento-label,\n.knobs-bento[data-keyboard]:focus .knobs-bento-tile[data-active] .knobs-bento-label,\n.knobs-bento-tile[data-focus] .knobs-bento-label{opacity:1;transition-duration:calc(var(--_k-hover-in) * 1ms)}\n/* A pick: a small dot in the accent, ringed in the page so it reads on any picture. */\n.knobs-bento-tile::after{content:\"\";position:absolute;top:8px;right:8px;width:8px;height:8px;border-radius:50%;background:var(--_k-accent);\n box-shadow:0 0 0 1.5px color-mix(in srgb,var(--_k-bg-page) 70%,transparent);opacity:0;scale:.4;pointer-events:none;\n transition:opacity .11s cubic-bezier(.4,0,1,1),scale var(--_ku-ease-ms) var(--_ku-ease)}\n.knobs-bento-tile[aria-selected=\"true\"]::after{opacity:1;scale:1;transition:opacity .15s cubic-bezier(.2,.8,.2,1),scale var(--_ku-ease-ms) var(--_ku-ease)}\n.knobs-bento-wash{position:absolute;left:0;top:0;width:100px;height:100px;transform-origin:0 0;z-index:3;pointer-events:none;border-radius:var(--_ku-bento-radius);\n background:color-mix(in srgb,var(--_k-accent) 12%,transparent);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--_k-accent) 45%,transparent);\n opacity:0;transition:opacity .15s}\n.knobs-bento[data-keyboard]:focus:not([data-zoomed]) .knobs-bento-wash[data-on]{opacity:1}\n.knobs-bento-scrim{position:absolute;left:0;top:0;width:100%;z-index:1;background:var(--k-ui-scrim,var(--k-ui-bento-bg,var(--_k-bg-page)));opacity:0;pointer-events:none;cursor:zoom-out}\n.knobs-bento[data-zoomed] .knobs-bento-scrim{pointer-events:auto}\n.knobs-bento-head{position:absolute;left:0;top:0;display:flex;align-items:flex-end;padding:0 0 6px 2px;color:var(--_k-fg-2);font-weight:var(--_k-weight-label);\n font-size:var(--_k-text-meta);white-space:nowrap;pointer-events:none}\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const compareCss = "\n:where(.knobs-compare,.knobs-compare *,.knobs-cmp-strip,.knobs-cmp-strip *){box-sizing:border-box}\n.knobs-ui.knobs-compare{--
|
|
1
|
+
export declare const compareCss = "\n:where(.knobs-compare,.knobs-compare *,.knobs-cmp-strip,.knobs-cmp-strip *){box-sizing:border-box}\n.knobs-ui.knobs-compare{--_ku-cmp-diff:var(--k-compare-diff,var(--_k-ok));--_ku-cmp-line:var(--_k-compare-divider);\n --_ku-cmp-stage:var(--_k-compare-stage);\n display:flex;flex-direction:column;gap:6px;width:100%;height:100%;min-height:160px;outline:none;user-select:none;-webkit-user-select:none;\n font:var(--_k-weight) var(--_k-type-small)/var(--_k-leading-small) var(--_k-font);color:var(--_k-fg);letter-spacing:normal;text-align:left}\n: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}\n.knobs-cmp-bar{flex:none;display:flex;align-items:center;gap:var(--_k-gap);height:var(--_k-control-h)}\n/* The modes: one fill, the selection pill on the one picked; a mode isn't brighter for being\n picked: the pill's bright copy is. */\n.knobs-cmp-modes{position:relative;display:inline-flex;height:var(--_k-control-h);border-radius:var(--_k-radius);background:var(--_k-fill)}\n.knobs-cmp-modes[hidden]{display:none}\n/* Hover is a quiet fill under the arrow cursor (no hand, no brightening), there at once. */\n.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:default;white-space:nowrap;\n transition:background calc(var(--_k-hover-out) * 1ms)}\n.knobs-ui .knobs-cmp-mode:not([aria-checked=\"true\"]):is(:hover,:focus-visible){background:var(--_k-fill-hover);transition-duration:calc(var(--_k-hover-in) * 1ms)}\n/* Toggles: icon buttons, the accent's wash when on. */\n.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-2);cursor:default;\n transition:background calc(var(--_k-hover-out) * 1ms)}\n.knobs-ui .knobs-cmp-toggle:is(:hover,:focus-visible){background:var(--_k-fill-hover);transition-duration:calc(var(--_k-hover-in) * 1ms)}\n.knobs-ui .knobs-cmp-toggle[aria-pressed=\"true\"]{color:var(--_k-accent-fg);background:var(--_k-accent-soft)}\n.knobs-cmp-toggle svg{display:block}\n.knobs-cmp-fill{flex:1}\n.knobs-cmp-toggle[hidden]{display:none}\n/* One surface: on a card (a walkthrough's step, a split's pane, anything .knobs-surface) or marked\n data-nested, the stage drops its fill and the sides sit on that card. */\n:where(.knobs-surface,.knobs-pane:not([data-nested])>.knobs-pane-clip) .knobs-ui.knobs-compare,.knobs-ui.knobs-compare[data-nested]{--_ku-cmp-stage:var(--k-compare-stage,transparent)}\n/* In a page's flow (a container with no height), it takes the height its sides need. */\n.knobs-ui.knobs-compare[data-auto]{height:auto}\n.knobs-compare[data-auto] .knobs-cmp-stage{flex:none;min-height:0}\n.knobs-cmp-stage{position:relative;flex:1;min-height:96px;overflow:hidden;border-radius:var(--_k-radius-panel);background:var(--_ku-cmp-stage);touch-action:pan-y;outline:none}\n.knobs-compare[data-frame=\"flat\"] .knobs-cmp-stage{border-radius:0}\n.knobs-compare[data-mode=\"wipe\"] .knobs-cmp-stage{cursor:ew-resize}\n/* Unzoomed, a finger still scrolls the page up and down; zoomed, the stage takes every gesture. */\n/* Zoomed, it pans: a move cursor, never a hand. */\n.knobs-compare[data-zoomed] .knobs-cmp-stage{cursor:move;touch-action:none}\n.knobs-compare[data-panning],.knobs-compare[data-panning] *{cursor:move!important}\n/* Wiping, the grip stands in for the cursor. */\n.knobs-compare[data-dragging],.knobs-compare[data-dragging] *{cursor:none!important}\n.knobs-cmp-sizer{position:absolute;left:0;right:0;top:0;height:0;visibility:hidden;pointer-events:none}\n.knobs-cmp-canvas{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none}\n.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}\n.knobs-compare[data-renderer=\"gpu\"] .knobs-cmp-media{opacity:0}\n/* The media comes in with its first frames: a fade and a 4px blur on the default spring. */\n.knobs-cmp-canvas,.knobs-compare[data-renderer=\"dom\"] .knobs-cmp-media{transition:opacity calc(var(--_k-motion-default-ms) * 1ms) var(--_k-motion-default),filter calc(var(--_k-motion-default-ms) * 1ms) var(--_k-motion-default)}\n.knobs-compare:not([data-ready]) :is(.knobs-cmp-canvas,.knobs-cmp-media){opacity:0;filter:blur(4px)}\n/* Over the pictures: a quiet scrim, dark in either appearance, blurred, with no ring. */\n.knobs-cmp-label,.knobs-cmp-zoom,.knobs-cmp-grip{background:var(--_ku-media-scrim);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}\n/* \u2717 Before \u00B7 \u2713 After: Before quieter, After in full. Neutral: no colour of its own. */\n.knobs-cmp-label{position:absolute;left:0;top:0;display:flex;align-items:center;gap:4px;padding:1px 7px 1px 5px;border-radius:999px;font-weight:var(--_k-weight-label);\n white-space:nowrap;pointer-events:none;will-change:transform}\n.knobs-cmp-label[data-side=\"before\"]{color:var(--_ku-on-media-2)}\n.knobs-cmp-label[data-side=\"after\"]{color:var(--_ku-on-media)}\n/* Fusing, the mark folds away and the label is its name. */\n.knobs-cmp-mark{flex:none;display:flex;justify-content:flex-end;overflow:hidden}\n.knobs-cmp-mark svg{display:block;flex:none;width:12px;height:12px}\n/* The fuse's seam: a blurred strip over where the sides meet, soft at both sides. */\n.knobs-cmp-seam{position:absolute;left:0;top:0;width:8px;height:0;opacity:0;pointer-events:none;will-change:transform,opacity;\n -webkit-mask-image:linear-gradient(to right,transparent,#000 35%,#000 65%,transparent);mask-image:linear-gradient(to right,transparent,#000 35%,#000 65%,transparent)}\n/* The wipe: a hairline down the line with a raised grip in its middle (at the pointer's height\n while dragged); a wider strip takes the hand and the keys (a slider). It fades in with the\n fuse; wiping, line and grip brighten. */\n.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,opacity}\n.knobs-cmp-handle[data-on]{pointer-events:auto}\n.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 6px var(--_ku-media-scrim)}\n.knobs-compare[data-dragging] .knobs-cmp-handle::before{background:var(--_ku-cmp-line)}\n.knobs-cmp-grip{position:absolute;top:0;left:4px;width:16px;height:28px;border-radius:min(8px,calc(var(--_k-radius) * 999));will-change:transform}\n.knobs-cmp-grip::before,.knobs-cmp-grip::after{content:\"\";position:absolute;top:10px;width:1px;height:8px;background:var(--_ku-on-media-2);transition:background calc(var(--_k-hover-out) * 1ms)}\n.knobs-cmp-grip::before{left:6px}\n.knobs-cmp-grip::after{left:9px}\n.knobs-compare[data-dragging] .knobs-cmp-grip::before,.knobs-compare[data-dragging] .knobs-cmp-grip::after{background:var(--_ku-on-media)}\n.knobs-cmp-handle:focus-visible .knobs-cmp-grip,.knobs-compare[data-keyboard] .knobs-cmp-handle:focus .knobs-cmp-grip{box-shadow:0 0 0 2px var(--_k-accent)}\n/* The split's hairline, down the middle side by side. */\n.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}\n/* Zoomed: how far, and a way back, in the stage's corner; it fades in and out, nothing shifts. */\n.knobs-cmp-zoom{position:absolute;right:8px;bottom:8px;display:flex;align-items:center;gap:4px;height:26px;padding:0 3px 0 10px;border-radius:999px;\n color:var(--_ku-on-media);font-variant-numeric:tabular-nums;font-feature-settings:var(--_kr-data,\"tnum\");white-space:nowrap;\n opacity:0;scale:.96;pointer-events:none;transition:opacity .16s cubic-bezier(.4,0,1,1),scale .16s cubic-bezier(.4,0,1,1)}\n.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)}\n: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;\n display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;border-radius:999px;background:transparent;color:var(--_ku-on-media-2);cursor:default;transition:background calc(var(--_k-hover-out) * 1ms),color calc(var(--_k-hover-out) * 1ms)}\n:where(.knobs-ui) .knobs-cmp-zoom-reset:is(:hover,:focus-visible){background:color-mix(in srgb,var(--_ku-on-media) 16%,transparent);color:var(--_ku-on-media);transition-duration:calc(var(--_k-hover-in) * 1ms)}\n.knobs-cmp-note{position:absolute;left:50%;top:50%;translate:-50% -50%;color:var(--_k-fg-3);pointer-events:none}\n.knobs-cmp-note:empty{display:none}\n.knobs-cmp-strip-host{flex:none;height:60px;min-height:0}\n.knobs-cmp-timeline-host{flex:none;min-height:0}\n/* The frame strip: Before over After per column, a difference bar under them, a dot where it peaks. */\n.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;\n font:var(--_k-weight) var(--_k-type-small)/var(--_k-leading-small) var(--_k-font);color:var(--_k-fg)}\n.knobs-cmp-strip>canvas{position:absolute;left:0;top:0;width:100%;height:100%;pointer-events:none}\n@media(prefers-reduced-motion:reduce){:is(.knobs-compare,.knobs-cmp-strip) :where(*,::before,::after){transition-duration:.12s!important}}\n";
|
|
@@ -3,7 +3,6 @@ export declare const MODE_INDEX: {
|
|
|
3
3
|
readonly side: 0;
|
|
4
4
|
readonly wipe: 1;
|
|
5
5
|
readonly difference: 2;
|
|
6
|
-
readonly flicker: 3;
|
|
7
6
|
};
|
|
8
7
|
export interface CompareDraw {
|
|
9
8
|
/** Device px: where each side's picture lands (zoomed, it's larger than its clip). */
|
|
@@ -12,20 +11,21 @@ export interface CompareDraw {
|
|
|
12
11
|
/** Device px: the part of the stage each side may draw in. */
|
|
13
12
|
readonly beforeClip: Rect;
|
|
14
13
|
readonly afterClip: Rect;
|
|
14
|
+
/** Device px: the clips' corner radii, Before's left and right, then After's. */
|
|
15
|
+
readonly radii: readonly [number, number, number, number];
|
|
15
16
|
readonly width: number;
|
|
16
17
|
readonly height: number;
|
|
17
18
|
readonly dpr: number;
|
|
18
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Where Before is cut (device px: the split side by side, the wipe's line fused) and its soft
|
|
21
|
+
* edge either side (device px). Side and Wipe composite the same way; only the cut moves.
|
|
22
|
+
*/
|
|
19
23
|
readonly wipeX: number;
|
|
20
24
|
readonly soft: number;
|
|
21
25
|
readonly from: number;
|
|
22
26
|
readonly to: number;
|
|
23
27
|
/** 0 shows `from`, 1 shows `to`. */
|
|
24
28
|
readonly mix: number;
|
|
25
|
-
/** Before in After's place (X held). */
|
|
26
|
-
readonly flick: boolean;
|
|
27
|
-
/** Flicker mode's phase: Before showing. */
|
|
28
|
-
readonly phase: boolean;
|
|
29
29
|
readonly threshold: number;
|
|
30
30
|
readonly gain: number;
|
|
31
31
|
readonly accent: readonly [number, number, number];
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import type { TimeView } from "./timeline-model.js";
|
|
2
|
-
|
|
2
|
+
/** Side by side, a wipe, or (opt in) a difference. */
|
|
3
|
+
export type CompareMode = "side" | "wipe" | "difference";
|
|
4
|
+
/**
|
|
5
|
+
* The modes a viewer offers (`["side", "wipe"]` unless given; `difference` only when asked for),
|
|
6
|
+
* in their order, and the mode it starts in (the first offered when the asked one isn't).
|
|
7
|
+
*/
|
|
8
|
+
export declare function compareModes(modes?: readonly CompareMode[], mode?: CompareMode): {
|
|
9
|
+
readonly modes: readonly CompareMode[];
|
|
10
|
+
readonly mode: CompareMode;
|
|
11
|
+
};
|
|
12
|
+
/** The mode a key picks among those offered: a digit by position, or S, W, D. */
|
|
13
|
+
export declare function modeForKey(key: string, modes: readonly CompareMode[]): CompareMode | null;
|
|
14
|
+
/** A mode's letter key (S, W, D). */
|
|
15
|
+
export declare const modeKey: (mode: CompareMode) => string;
|
|
3
16
|
export type MediaKind = "video" | "image";
|
|
4
17
|
/** A source's kind: as given, else by its extension (a video's, or an image). */
|
|
5
18
|
export declare function mediaKind(src: string, kind?: MediaKind): MediaKind;
|
|
@@ -76,7 +89,10 @@ export interface CompareLayout {
|
|
|
76
89
|
readonly after: Rect;
|
|
77
90
|
readonly split: number;
|
|
78
91
|
};
|
|
79
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Overlaid (wipe, difference): both in the same place, one side's size, centred on the split,
|
|
94
|
+
* so fusing never resizes anything.
|
|
95
|
+
*/
|
|
80
96
|
readonly overlay: {
|
|
81
97
|
readonly before: Rect;
|
|
82
98
|
readonly after: Rect;
|
|
@@ -84,6 +100,57 @@ export interface CompareLayout {
|
|
|
84
100
|
}
|
|
85
101
|
/** Where the two sides sit inside `box`, side by side and overlaid. */
|
|
86
102
|
export declare function compareLayout(box: Rect, before: Size, after: Size): CompareLayout;
|
|
103
|
+
/**
|
|
104
|
+
* Kit Motion's blend blur, in px: the feather Before's cut swells to mid-fuse, the blur of the
|
|
105
|
+
* strip over the seam at its peak (mid-fuse too), and the overlap the seam fades in over.
|
|
106
|
+
*/
|
|
107
|
+
export declare const FUSE: {
|
|
108
|
+
readonly feather: 32;
|
|
109
|
+
readonly blur: 8;
|
|
110
|
+
readonly seamFade: 48;
|
|
111
|
+
};
|
|
112
|
+
export interface FuseFrame {
|
|
113
|
+
/** Where Before is cut: the split side by side, the wipe's line fused. */
|
|
114
|
+
readonly cut: number;
|
|
115
|
+
/** The cut's soft edge, px either side of it. */
|
|
116
|
+
readonly feather: number;
|
|
117
|
+
/** The seam's (and the wipe handle's) opacity, 0–1. */
|
|
118
|
+
readonly seam: number;
|
|
119
|
+
/** The seam's blur (px): none apart or fused, `FUSE.blur` mid-fuse. */
|
|
120
|
+
readonly blur: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Kit Motion's Comparison fuse, one frame of it: side by side (`k` 0) the panes glide together
|
|
124
|
+
* into one (`k` 1). Before is cut only where the inner edges overlap, with a feather that swells
|
|
125
|
+
* mid-transition, and a blurred strip over the seam blends the two, strongest mid-transition
|
|
126
|
+
* (the blend blur); it fades in as they overlap. `before` and `after` are where the sides are
|
|
127
|
+
* drawn this frame.
|
|
128
|
+
*/
|
|
129
|
+
export declare function fuseFrame(L: CompareLayout, before: Rect, after: Rect, k: number, wipe: number): FuseFrame;
|
|
130
|
+
/**
|
|
131
|
+
* A label folded `fold` (0 open, 1 folded to its name): its mark's width, opacity and blur (px,
|
|
132
|
+
* up to `blur` as it goes, kit-motion's in-place exit).
|
|
133
|
+
*/
|
|
134
|
+
/**
|
|
135
|
+
* Each side's corner radii, `left` and `right` (px), so the frame is rounded at every frame of the
|
|
136
|
+
* fuse: a side's outer corners always take the frame's radius `r`; its inner ones (at the split)
|
|
137
|
+
* are square apart and grow to `r` as the sides fuse into one picture.
|
|
138
|
+
*/
|
|
139
|
+
export declare const fuseCorners: (r: number, k: number) => {
|
|
140
|
+
before: {
|
|
141
|
+
left: number;
|
|
142
|
+
right: number;
|
|
143
|
+
};
|
|
144
|
+
after: {
|
|
145
|
+
left: number;
|
|
146
|
+
right: number;
|
|
147
|
+
};
|
|
148
|
+
};
|
|
149
|
+
export declare const labelFold: (fold: number, mark: number, blur?: number) => {
|
|
150
|
+
width: number;
|
|
151
|
+
opacity: number;
|
|
152
|
+
blur: number;
|
|
153
|
+
};
|
|
87
154
|
/** The height a split screen of `w` needs so neither side has margins: half its width, in shape. */
|
|
88
155
|
export declare const splitHeight: (w: number, media: Size) => number;
|
|
89
156
|
/**
|
|
@@ -134,6 +201,22 @@ export declare function wipeGrab(x: number, rect: Rect, wipe: number, slop?: num
|
|
|
134
201
|
onLine: boolean;
|
|
135
202
|
offset: number;
|
|
136
203
|
};
|
|
204
|
+
/**
|
|
205
|
+
* Wiping, Before and After ride either side of the seam at `x`, `gap` from it, each fading out as
|
|
206
|
+
* its side runs out of room (`left`/`right`: the wipe's edges; `wb`/`wa`: the labels' widths).
|
|
207
|
+
*/
|
|
208
|
+
export declare function seamLabels(x: number, left: number, right: number, wb: number, wa: number, gap?: number): {
|
|
209
|
+
before: {
|
|
210
|
+
x: number;
|
|
211
|
+
opacity: number;
|
|
212
|
+
};
|
|
213
|
+
after: {
|
|
214
|
+
x: number;
|
|
215
|
+
opacity: number;
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
/** Where the wipe's grip sits for a pointer at `y`: its top, kept `margin` inside the line. */
|
|
219
|
+
export declare function gripTop(y: number, rect: Rect, grip: number, margin?: number): number;
|
|
137
220
|
/** The wipe moved by a key: 1% a press, 10% with Shift. */
|
|
138
221
|
export declare const wipeKey: (wipe: number, dir: -1 | 1, big?: boolean) => number;
|
|
139
222
|
export interface StripColumn {
|
|
@@ -29,8 +29,13 @@ export interface CompareSource {
|
|
|
29
29
|
export interface CompareOptions extends UiLook {
|
|
30
30
|
readonly before: CompareSource;
|
|
31
31
|
readonly after: CompareSource;
|
|
32
|
-
/** `"side"
|
|
32
|
+
/** The first of `modes` (`"side"`, side by side) by default. */
|
|
33
33
|
readonly mode?: CompareMode;
|
|
34
|
+
/**
|
|
35
|
+
* The modes it offers, in the mode bar's order and on `1`–`3`: `["side", "wipe"]` by default.
|
|
36
|
+
* Add `"difference"` to offer a difference. One mode hides the bar.
|
|
37
|
+
*/
|
|
38
|
+
readonly modes?: readonly CompareMode[];
|
|
34
39
|
/** Where the wipe's line sits, 0 (all After) to 1 (all Before); 0.5. */
|
|
35
40
|
readonly wipe?: number;
|
|
36
41
|
/** Frames per second (the bound timeline's, else 30): steps, and where paused videos land. */
|
|
@@ -41,8 +46,9 @@ export interface CompareOptions extends UiLook {
|
|
|
41
46
|
readonly threshold?: number;
|
|
42
47
|
/**
|
|
43
48
|
* The clock: an existing `timeline()` (its time drives both sides; while playing it follows
|
|
44
|
-
* After), or `true` for one of its own under the viewer
|
|
45
|
-
*
|
|
49
|
+
* After), or `true` for one of its own under the viewer: a player's thin progress line (the
|
|
50
|
+
* `"line"` variant, as `player()` has), its markers chapter segments. Without one, `seek`,
|
|
51
|
+
* `play` and keys still work.
|
|
46
52
|
*/
|
|
47
53
|
readonly timeline?: Timeline | boolean;
|
|
48
54
|
/** The frame strip over the timeline (off; one timeline is made if there's none). */
|
|
@@ -68,6 +74,8 @@ export interface CompareOptions extends UiLook {
|
|
|
68
74
|
export interface Compare {
|
|
69
75
|
readonly element: HTMLElement;
|
|
70
76
|
readonly mode: CompareMode;
|
|
77
|
+
/** The modes it offers. */
|
|
78
|
+
readonly modes: readonly CompareMode[];
|
|
71
79
|
readonly wipe: number;
|
|
72
80
|
readonly loupe: boolean;
|
|
73
81
|
/** Seconds. */
|
|
@@ -85,7 +93,13 @@ export interface Compare {
|
|
|
85
93
|
readonly loop: CompareLoop | null;
|
|
86
94
|
/** New sources, mode, wipe, loupe, threshold or fps. A new mode glides in. */
|
|
87
95
|
update(next: Partial<Pick<CompareOptions, "before" | "after" | "mode" | "wipe" | "loupe" | "threshold" | "fps">>): void;
|
|
88
|
-
|
|
96
|
+
/**
|
|
97
|
+
* `glide`: a jump the hand didn't make (a chapter's click): the timeline's playhead catches up
|
|
98
|
+
* from where it is while the videos land at once.
|
|
99
|
+
*/
|
|
100
|
+
seek(time: number, options?: {
|
|
101
|
+
readonly glide?: boolean;
|
|
102
|
+
}): void;
|
|
89
103
|
/** Moves by `seconds`, the timeline's playhead gliding there (playing carries on). */
|
|
90
104
|
seekBy(seconds: number): void;
|
|
91
105
|
play(): void;
|
package/dist/types/ui/diff.d.ts
CHANGED
|
@@ -105,12 +105,11 @@ export declare function diffCounts(file: DiffFile, doc?: Document, options?: {
|
|
|
105
105
|
/** A file's change as a letter (M, A, D, R), for a tree's `icon`. */
|
|
106
106
|
export declare function diffStatus(file: DiffFile, doc?: Document): HTMLElement;
|
|
107
107
|
/**
|
|
108
|
-
* A code diff
|
|
109
|
-
* over the diff, drawn by `@pierre/diffs` (Shiki highlighting, word-level changes, hunks that
|
|
108
|
+
* A code diff on the void (no card, fill or ring: a hairline under its header and one under the
|
|
109
|
+
* code): a quiet header with the file's path, its counts and Split | Unified over the diff, drawn by `@pierre/diffs` (Shiki highlighting, word-level changes, hunks that
|
|
110
110
|
* expand when the whole files are known). Takes a unified patch or before and after pairs.
|
|
111
111
|
* Changing the file or the layout fades the new view in over the old, in place; each file
|
|
112
|
-
* keeps its scroll.
|
|
113
|
-
* no card of its own. Needs `@pierre/diffs` installed; it loads on first use.
|
|
112
|
+
* keeps its scroll. Needs `@pierre/diffs` installed; it loads on first use.
|
|
114
113
|
*/
|
|
115
114
|
export declare function codeDiff(container: HTMLElement, options: CodeDiffOptions): CodeDiff;
|
|
116
115
|
export interface DiffReviewOptions extends CodeDiffOptions {
|
|
@@ -147,7 +146,7 @@ export interface DiffReview {
|
|
|
147
146
|
dispose(): void;
|
|
148
147
|
}
|
|
149
148
|
/**
|
|
150
|
-
* A diff beside its file list, as a review,
|
|
149
|
+
* A diff beside its file list, as a review, on the void as the diff is: the list is a drawer at its left that
|
|
151
150
|
* springs open and shut (0 to 256px, .4 s, no bounce; the diff reflows as it moves) from a
|
|
152
151
|
* button at the start of the diff's header, or ⌘B / Ctrl+B. In it, a field that narrows the list
|
|
153
152
|
* by path, then the changed files as a compact tree (folders folded into paths), each with its
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const historyCss = "\n:where(.knobs-history,.knobs-history *){box-sizing:border-box}\n.knobs-ui.knobs-history{--hy-gutter:128px;--hy-lane:24px;--hy-bar:16px;--hy-axis:20px;--hy-bandrow:0px;--hy-c:var(--_k-fg-3);\n --hy-fade:linear-gradient(to right,#000 calc(100% - 1.5em),transparent);\n position:relative;display:flex;flex-direction:column;width:100%;min-width:0;outline:none;color:var(--_k-fg);\n font:var(--_k-weight) var(--_k-type-body)/var(--_k-leading-body) var(--_k-font);font-variant-numeric:tabular-nums;font-feature-settings:var(--_kr-data,\"tnum\");\n text-align:left;letter-spacing:normal;-webkit-font-smoothing:antialiased;user-select:none;-webkit-user-select:none}\n.knobs-history[data-bands]{--hy-bandrow:var(--_k-leading-small)}\n.knobs-history[data-narrow]{--hy-gutter:0px}\n.knobs-history [hidden]{display:none!important}\n:where(.knobs-ui) :is(.knobs-hy-ev,.knobs-hy-span,.knobs-hy-jump,.knobs-hy-more){all:revert;box-sizing:border-box;font:inherit;color:inherit;letter-spacing:inherit;\n background:transparent;border:0;border-radius:0;margin:0;padding:0;min-width:0;box-shadow:none;outline:none}\n.knobs-history [data-tone=\"good\"]{--hy-c:var(--_k-ok)}\n.knobs-history [data-tone=\"warn\"]{--hy-c:var(--_k-warn)}\n.knobs-history [data-tone=\"bad\"]{--hy-c:var(--_k-danger)}\n.knobs-history [data-tone=\"info\"]{--hy-c:var(--_k-info)}\n.knobs-history [data-tone=\"dim\"]{--hy-c:var(--_k-fg-3)}\n\n/* \u2014\u2014\u2014 the chart: lane labels beside the plot (above each lane where it's narrow) \u2014\u2014\u2014 */\n.knobs-hy-chart{position:relative;display:grid;grid-template-columns:var(--hy-gutter) minmax(0,1fr)}\n.knobs-hy-axis{position:relative;grid-column:2;grid-row:1;height:calc(var(--hy-bandrow) + var(--hy-axis))}\n:is(.knobs-hy-tick,.knobs-hy-now,.knobs-hy-blabel){position:absolute;white-space:nowrap;font-size:var(--_k-type-small);line-height:var(--_k-leading-small);color:var(--_k-fg-3)}\n.knobs-hy-tick{bottom:2px;padding-left:4px}\n.knobs-hy-now{bottom:2px;color:var(--_k-accent-fg);font-weight:var(--_k-weight-label)}\n.knobs-hy-blabel{top:0;padding-left:4px;overflow:hidden;color:var(--_k-fg-2)}\n.knobs-hy-label{grid-column:1;align-self:center;min-width:0;margin-right:var(--_k-space-title);overflow:hidden;white-space:nowrap;\n font-size:var(--_k-type-small);line-height:var(--_k-leading-small);color:var(--_k-fg-3)}\n.knobs-history[data-narrow] .knobs-hy-label{grid-column:2;align-self:end;margin:0}\n:is(.knobs-hy-label,.knobs-hy-blabel)[data-overflow]{-webkit-mask-image:var(--hy-fade);mask-image:var(--hy-fade)}\n.knobs-hy-track{position:relative;grid-column:2;height:var(--hy-lane)}\n.knobs-hy-layer{position:absolute;inset:0;grid-column:2;grid-row:1/-1;pointer-events:none}\n\n/* Bands and month lines behind the lanes; today, the selection and the pointer's line over them. */\n.knobs-hy-band{position:absolute;top:0;bottom:0;background:var(--_k-fill);box-shadow:inset 1px 0 0 var(--_k-border-subtle)}\n:is(.knobs-hy-grid,.knobs-hy-today,.knobs-hy-hover,.knobs-hy-sel){position:absolute;left:0;top:calc(var(--hy-bandrow) + var(--hy-axis));bottom:0;width:1px;margin-left:-.5px}\n.knobs-hy-grid{background:var(--_k-border-subtle)}\n.knobs-hy-today{top:calc(var(--hy-bandrow) + var(--hy-axis) - 4px);background:var(--_k-accent)}\n.knobs-hy-hover{background:color-mix(in oklch,var(--_k-fg) 32%,transparent);opacity:0;transition:opacity calc(var(--_k-hover-out) * 1ms)}\n.knobs-hy-hover[data-on]{opacity:1;transition-duration:calc(var(--_k-hover-in) * 1ms)}\n.knobs-hy-sel{background:var(--_k-fg-2);opacity:0}\n.knobs-hy-sel[data-on]{opacity:.6}\n\n/* Spans: a soft bar in their state's tone, inferred ones hatched; the tag at the end. */\n.knobs-hy-span{position:absolute;top:calc((var(--hy-lane) - var(--hy-bar)) / 2);height:var(--hy-bar);border-radius:var(--_k-radius-sm);cursor:default;\n background:color-mix(in oklch,var(--hy-c) 24%,transparent);transition:background calc(var(--_k-hover-out) * 1ms),box-shadow calc(var(--_k-hover-out) * 1ms)}\n.knobs-hy-span[data-inferred]{background:repeating-linear-gradient(135deg,color-mix(in oklch,var(--hy-c) 34%,transparent) 0 2px,color-mix(in oklch,var(--hy-c) 9%,transparent) 2px 6px)}\n.knobs-hy-span[data-hover]{background-color:color-mix(in oklch,var(--hy-c) 34%,transparent);transition-duration:calc(var(--_k-hover-in) * 1ms)}\n.knobs-hy-span[data-selected]{box-shadow:inset 0 0 0 1px var(--hy-c)}\n.knobs-hy-span[data-clip-start]{border-top-left-radius:0;border-bottom-left-radius:0;-webkit-mask-image:linear-gradient(to right,transparent,#000 16px);mask-image:linear-gradient(to right,transparent,#000 16px)}\n.knobs-hy-span[data-clip-end]{border-top-right-radius:0;border-bottom-right-radius:0;-webkit-mask-image:linear-gradient(to left,transparent,#000 16px);mask-image:linear-gradient(to left,transparent,#000 16px)}\n.knobs-hy-tag{position:absolute;top:0;right:6px;font-size:var(--_k-type-small);line-height:var(--hy-bar);white-space:nowrap;pointer-events:none;\n color:color-mix(in oklch,var(--hy-c) 55%,var(--_k-fg))}\n.knobs-hy-tag[data-place=\"after\"]{right:auto;left:calc(100% + 6px)}\n.knobs-hy-tag[data-place=\"none\"]{visibility:hidden}\n\n/* Event marks (their kind named in the tooltip): a dot for a commit, a diamond for a release, a cross for a deletion, a square for a\n channel's switch, a triangle for a finding; inferred ones hollow. */\n.knobs-hy-ev{position:absolute;top:0;width:16px;height:var(--hy-lane);margin-left:-8px;cursor:default;--hy-c:var(--_k-fg-2);--hy-s:9px}\n.knobs-hy-ev::before{content:\"\";position:absolute;left:50%;top:50%;width:var(--hy-s);height:var(--hy-s);margin:calc(var(--hy-s) / -2) 0 0 calc(var(--hy-s) / -2);\n border-radius:50%;background:var(--hy-c);transition:scale calc(var(--_k-motion-snappy-ms) * 1ms) var(--_k-motion-snappy)}\n.knobs-hy-ev[data-range]{width:calc(var(--hy-w) + 16px)}\n.knobs-hy-ev[data-range]::before{left:calc(8px - var(--hy-s) / 2);right:calc(8px - var(--hy-s) / 2);width:auto;margin-left:0;border-radius:var(--_k-round)}\n.knobs-hy-ev[data-type=\"release\"]{--hy-s:8px}\n.knobs-hy-ev[data-type=\"release\"]::before{border-radius:1.5px;rotate:45deg}\n.knobs-hy-ev[data-type=\"channel\"]{--hy-s:8px}\n.knobs-hy-ev[data-type=\"channel\"]::before{border-radius:2px}\n.knobs-hy-ev[data-type=\"audit\"]{--hy-s:10px}\n.knobs-hy-ev[data-type=\"audit\"]::before{border-radius:0;clip-path:polygon(50% 4%,100% 92%,0 92%)}\n.knobs-hy-ev[data-type=\"deletion\"]::before{border-radius:0;rotate:45deg;\n background:linear-gradient(var(--hy-c),var(--hy-c)) center/100% 1.75px no-repeat,linear-gradient(var(--hy-c),var(--hy-c)) center/1.75px 100% no-repeat}\n.knobs-hy-ev[data-inferred]:not([data-type=\"audit\"],[data-type=\"deletion\"])::before{background:transparent;box-shadow:inset 0 0 0 1.5px var(--hy-c)}\n.knobs-hy-ev[data-inferred]:is([data-type=\"audit\"],[data-type=\"deletion\"])::before{opacity:.5}\n/* Held-back marks (commits, by default) come up while the pointer is on their lane, and stay with\n \"Show commits\" or while selected. */\n.knobs-hy-ev[data-quiet]{opacity:0;transition:opacity calc(var(--_k-hover-out) * 1ms)}\n.knobs-hy-track:hover .knobs-hy-ev[data-quiet]{opacity:.6;transition-duration:calc(var(--_k-hover-in) * 1ms)}\n:is(.knobs-history[data-all] .knobs-hy-ev[data-quiet],.knobs-hy-ev[data-quiet]:is([data-selected],[data-hover])){opacity:1}\n.knobs-hy-ev[data-hover]::before{scale:1.25}\n.knobs-hy-ev[data-selected]::before{scale:1.3}\n.knobs-hy-ev[data-selected]::after{content:\"\";position:absolute;left:50%;top:50%;width:calc(var(--hy-s) + 9px);height:calc(var(--hy-s) + 9px);\n margin:calc((var(--hy-s) + 9px) / -2) 0 0 calc((var(--hy-s) + 9px) / -2);border-radius:50%;box-shadow:0 0 0 1.5px var(--hy-c)}\n.knobs-hy-ev[data-range][data-selected]::after{left:3px;right:3px;width:auto;margin-left:0;border-radius:var(--_k-round)}\n.knobs-history:focus-visible .knobs-hy-ev[data-selected]::after{box-shadow:0 0 0 2px var(--_k-focus)}\n.knobs-history:focus-visible .knobs-hy-span[data-selected]{box-shadow:inset 0 0 0 2px var(--_k-focus)}\n\n/* \u2014\u2014\u2014 under the chart: \"Show commits\", and a legend only when inferred and verified both appear \u2014\u2014\u2014 */\n.knobs-hy-foot{display:flex;flex-wrap:wrap;align-items:center;gap:var(--_k-space-inside) var(--_k-space-title);margin-top:var(--_k-space-sibling);padding-left:var(--hy-gutter);\n font-size:var(--_k-type-small);line-height:var(--_k-leading-small);color:var(--_k-fg-3)}\n.knobs-hy-legend{display:flex;flex-wrap:wrap;gap:var(--_k-space-inside) var(--_k-space-title)}\n.knobs-ui .knobs-hy-more{height:20px;margin-left:-6px;padding:0 6px;border-radius:var(--_k-radius-sm);color:var(--_k-fg-3);cursor:default;\n transition:background calc(var(--_k-hover-out) * 1ms),color calc(var(--_k-hover-out) * 1ms)}\n.knobs-ui .knobs-hy-more:is(:hover,:focus-visible){background:var(--_k-fill-hover);color:var(--_k-fg);transition-duration:calc(var(--_k-hover-in) * 1ms)}\n.knobs-hy-key{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}\n.knobs-hy-swatch{flex:none;width:14px;height:8px;border-radius:2px;background:color-mix(in oklch,var(--hy-c) 34%,transparent)}\n.knobs-hy-swatch[data-inferred]{background:repeating-linear-gradient(135deg,color-mix(in oklch,var(--hy-c) 60%,transparent) 0 1.5px,transparent 1.5px 4px)}\n\n/* \u2014\u2014\u2014 the detail: one area under the chart, its height on a spring \u2014\u2014\u2014 */\n.knobs-hy-detail{position:relative;overflow:hidden;user-select:text;-webkit-user-select:text}\n.knobs-hy-detail[data-moving]{-webkit-mask-image:linear-gradient(to bottom,#000 calc(100% - 16px),transparent);mask-image:linear-gradient(to bottom,#000 calc(100% - 16px),transparent)}\n.knobs-hy-dc{padding:var(--_k-space-title) 0 0 var(--hy-gutter);transition:opacity calc(var(--_k-motion-snappy-ms) * 1ms) var(--_k-motion-snappy)}\n.knobs-hy-dc:is([data-enter],[data-leave]){opacity:0}\n.knobs-hy-dc[data-leave]{position:absolute;left:0;right:0;top:0;transition-duration:calc(var(--_k-motion-snappy-ms) * .8ms)}\n.knobs-hy-dmeta{display:flex;flex-wrap:wrap;gap:0 var(--_k-space-sibling);font-size:var(--_k-type-small);line-height:var(--_k-leading-small);color:var(--_k-fg-3)}\n.knobs-hy-dmeta>[data-tone]{color:var(--hy-c)}\n.knobs-hy-dtitle{margin-top:var(--_k-space-inside);font-size:var(--_k-type-body);line-height:var(--_k-leading-body);font-weight:var(--_k-weight-label);color:var(--_k-fg);text-wrap:balance}\n.knobs-hy-dtext{margin:var(--_k-space-inside) 0 0;max-width:68ch;font-size:var(--_k-type-body);line-height:var(--_k-leading-body);color:var(--_k-fg-2);text-wrap:pretty}\n.knobs-hy-dtext code{font:var(--_k-type-label) var(--_k-mono);letter-spacing:0;padding:1px 5px;border-radius:calc(var(--_k-radius) / 2);background:var(--_k-fill)}\n.knobs-hy-dfoot{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-top:var(--_k-space-sibling)}\n.knobs-hy-dfoot:empty{display:none}\n.knobs-hy-evidence{display:inline-flex;align-items:center;height:20px;padding:0 6px;border-radius:var(--_k-radius-sm);background:var(--_k-fill);color:var(--_k-fg-2);\n font:var(--_k-type-small)/1 var(--_k-mono);text-decoration:none;transition:background calc(var(--_k-hover-out) * 1ms),color calc(var(--_k-hover-out) * 1ms)}\na.knobs-hy-evidence:hover{background:var(--_k-fill-hover);color:var(--_k-fg);transition-duration:calc(var(--_k-hover-in) * 1ms)}\n.knobs-ui .knobs-hy-jump{display:inline-flex;align-items:center;gap:4px;height:20px;padding:0 5px 0 6px;border-radius:var(--_k-radius-sm);color:var(--_k-fg-2);cursor:default;\n font-size:var(--_k-type-small);transition:background calc(var(--_k-hover-out) * 1ms),color calc(var(--_k-hover-out) * 1ms)}\n.knobs-ui .knobs-hy-jump:is(:hover,:focus-visible){background:var(--_k-fill-hover);color:var(--_k-fg);transition-duration:calc(var(--_k-hover-in) * 1ms)}\n.knobs-hy-jump svg{width:12px;height:12px}\n\n/* \u2014\u2014\u2014 the pointer's tooltip: title, date, one line \u2014\u2014\u2014 */\n.knobs-hy-tip{position:absolute;left:0;top:0;max-width:280px;padding:6px 8px;border-radius:var(--_k-radius-md);background:var(--_k-bg-overlay);\n box-shadow:var(--_k-shadow-overlay),0 0 0 1px var(--_k-border);pointer-events:none;opacity:0;transition:opacity calc(var(--_k-hover-out) * 1ms)}\n.knobs-hy-tip[data-on]{opacity:1;transition-duration:calc(var(--_k-hover-in) * 1ms)}\n.knobs-hy-tt{font-size:var(--_k-type-small);line-height:var(--_k-leading-small);font-weight:var(--_k-weight-label);color:var(--_k-fg);text-wrap:balance}\n:is(.knobs-hy-td,.knobs-hy-tl){font-size:var(--_k-type-small);line-height:var(--_k-leading-small);color:var(--_k-fg-3)}\n.knobs-hy-tl{margin-top:2px;color:var(--_k-fg-2);text-wrap:pretty}\n.knobs-hy-tl:empty{display:none}\n\n@media(prefers-reduced-motion:reduce){\n .knobs-history :where(*,::before,::after){transition-property:opacity,background,color,box-shadow!important}\n .knobs-hy-dc{transition-duration:calc(var(--_k-hover-out) * 1ms)!important}\n}\n";
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
export type HistoryTone = "good" | "warn" | "bad" | "info" | "dim";
|
|
2
|
+
export type HistoryProvenance = "verified" | "inferred";
|
|
3
|
+
/** A small tag that backs a claim: a PR, a commit, a log, as a link or not. */
|
|
4
|
+
export interface HistoryEvidence {
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly href?: string;
|
|
7
|
+
}
|
|
8
|
+
/** A stretch of a lane in one state: "v1 works", "v2 broken". */
|
|
9
|
+
export interface HistorySpan {
|
|
10
|
+
readonly id?: string;
|
|
11
|
+
/** ISO date (`2026-09-19`), or as a page writes it (`"Sep 19, 2026"`). */
|
|
12
|
+
readonly from: string;
|
|
13
|
+
/** Left out: still so today. */
|
|
14
|
+
readonly to?: string;
|
|
15
|
+
/** A key in `states`, or a word of its own. */
|
|
16
|
+
readonly state: string;
|
|
17
|
+
/** Its tag at the end, in place of the state's (`"31d broken"`). */
|
|
18
|
+
readonly label?: string;
|
|
19
|
+
/** Its detail's title, in place of "lane · state". */
|
|
20
|
+
readonly title?: string;
|
|
21
|
+
readonly detail?: string;
|
|
22
|
+
readonly provenance?: HistoryProvenance;
|
|
23
|
+
readonly source?: string;
|
|
24
|
+
readonly evidence?: readonly HistoryEvidence[];
|
|
25
|
+
/** A step it's about, for `onJump`. */
|
|
26
|
+
readonly step?: string;
|
|
27
|
+
}
|
|
28
|
+
/** A row of the chart: a channel or a track, with its spans. */
|
|
29
|
+
export interface HistoryLane {
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly label: string;
|
|
32
|
+
readonly spans?: readonly HistorySpan[];
|
|
33
|
+
}
|
|
34
|
+
/** A dated moment: a commit, a release, a deletion. */
|
|
35
|
+
export interface HistoryEvent {
|
|
36
|
+
readonly id?: string;
|
|
37
|
+
/** ISO, or as written: "Apr 9, 2026", "Oct 14–16, 2026", "May 7–8". */
|
|
38
|
+
readonly date: string;
|
|
39
|
+
/** Where it ran over days: its last day. */
|
|
40
|
+
readonly to?: string;
|
|
41
|
+
/** The lane it sits on (`"code"` by default). */
|
|
42
|
+
readonly lane?: string;
|
|
43
|
+
readonly title: string;
|
|
44
|
+
readonly detail?: string;
|
|
45
|
+
/** Its mark: a commit a dot, a release a diamond, a deletion a cross, an audit a triangle. */
|
|
46
|
+
readonly type?: "commit" | "release" | "deletion" | "channel" | "audit" | (string & {});
|
|
47
|
+
readonly tone?: HistoryTone;
|
|
48
|
+
readonly provenance?: HistoryProvenance;
|
|
49
|
+
readonly source?: string;
|
|
50
|
+
readonly evidence?: readonly HistoryEvidence[];
|
|
51
|
+
readonly step?: string;
|
|
52
|
+
}
|
|
53
|
+
/** A faint labelled stretch behind every lane: a phase. */
|
|
54
|
+
export interface HistoryBand {
|
|
55
|
+
readonly from: string;
|
|
56
|
+
readonly to?: string;
|
|
57
|
+
readonly label: string;
|
|
58
|
+
}
|
|
59
|
+
/** What a span's state means: its name in the legend, its colour and its tag (`{d}` the days). */
|
|
60
|
+
export interface HistoryState {
|
|
61
|
+
readonly label?: string;
|
|
62
|
+
readonly tone?: HistoryTone;
|
|
63
|
+
/** `"{d}d"` (the default), words of its own (`"v1"`), or `""` for none. */
|
|
64
|
+
readonly tag?: string;
|
|
65
|
+
}
|
|
66
|
+
/** The walkthrough's older shape: events under headings. */
|
|
67
|
+
export interface HistoryGroup {
|
|
68
|
+
readonly heading?: string;
|
|
69
|
+
readonly summary?: string;
|
|
70
|
+
readonly events?: readonly HistoryEvent[];
|
|
71
|
+
readonly rows?: readonly HistoryEvent[];
|
|
72
|
+
}
|
|
73
|
+
/** What `history()` draws: plain JSON. */
|
|
74
|
+
export interface HistoryData {
|
|
75
|
+
readonly axis?: {
|
|
76
|
+
readonly from?: string;
|
|
77
|
+
readonly to?: string;
|
|
78
|
+
readonly today?: string;
|
|
79
|
+
};
|
|
80
|
+
readonly lanes?: readonly HistoryLane[];
|
|
81
|
+
readonly events?: readonly HistoryEvent[];
|
|
82
|
+
readonly bands?: readonly HistoryBand[];
|
|
83
|
+
readonly states?: Readonly<Record<string, HistoryState>>;
|
|
84
|
+
/** The walkthrough's older shape: each group's events go on the code lane under a band. */
|
|
85
|
+
readonly groups?: readonly HistoryGroup[];
|
|
86
|
+
}
|
|
87
|
+
/** Days since 1970-01-01 (UTC): every date in the model. */
|
|
88
|
+
export type Day = number;
|
|
89
|
+
export interface HyItem {
|
|
90
|
+
readonly id: string;
|
|
91
|
+
readonly kind: "event" | "span";
|
|
92
|
+
readonly lane: string;
|
|
93
|
+
readonly from: Day;
|
|
94
|
+
readonly to: Day;
|
|
95
|
+
/** A span still running today. */
|
|
96
|
+
readonly open: boolean;
|
|
97
|
+
readonly title: string;
|
|
98
|
+
readonly detail?: string;
|
|
99
|
+
readonly tone: HistoryTone;
|
|
100
|
+
readonly type?: string;
|
|
101
|
+
readonly inferred: boolean;
|
|
102
|
+
readonly provenance?: HistoryProvenance;
|
|
103
|
+
readonly source?: string;
|
|
104
|
+
readonly evidence: readonly HistoryEvidence[];
|
|
105
|
+
readonly step?: string;
|
|
106
|
+
/** A span's state key. */
|
|
107
|
+
readonly state?: string;
|
|
108
|
+
/** A span's end tags, longest first: its own or the state's, then the days alone. */
|
|
109
|
+
readonly tags: readonly string[];
|
|
110
|
+
}
|
|
111
|
+
export interface HyLane {
|
|
112
|
+
readonly id: string;
|
|
113
|
+
readonly label: string;
|
|
114
|
+
readonly spans: readonly HyItem[];
|
|
115
|
+
readonly events: readonly HyItem[];
|
|
116
|
+
}
|
|
117
|
+
export interface HyBand {
|
|
118
|
+
readonly from: Day;
|
|
119
|
+
readonly to: Day;
|
|
120
|
+
readonly label: string;
|
|
121
|
+
}
|
|
122
|
+
export interface HyState {
|
|
123
|
+
readonly key: string;
|
|
124
|
+
readonly label: string;
|
|
125
|
+
readonly tone: HistoryTone;
|
|
126
|
+
}
|
|
127
|
+
export interface HistoryModel {
|
|
128
|
+
readonly from: Day;
|
|
129
|
+
readonly to: Day;
|
|
130
|
+
readonly today: Day;
|
|
131
|
+
readonly lanes: readonly HyLane[];
|
|
132
|
+
/** Every event, in the order ←/→ walk them. */
|
|
133
|
+
readonly events: readonly HyItem[];
|
|
134
|
+
readonly bands: readonly HyBand[];
|
|
135
|
+
/** The states the spans use, in the order they first appear. */
|
|
136
|
+
readonly states: readonly HyState[];
|
|
137
|
+
/** The event types used, in the order they first appear. */
|
|
138
|
+
readonly types: readonly string[];
|
|
139
|
+
/** Whether anything is marked inferred, and anything verified: the legend needs both. */
|
|
140
|
+
readonly inferred: boolean;
|
|
141
|
+
readonly verified: boolean;
|
|
142
|
+
readonly items: ReadonlyMap<string, HyItem>;
|
|
143
|
+
}
|
|
144
|
+
export declare const dayOf: (y: number, m: number, d: number) => Day;
|
|
145
|
+
export declare const todayDay: (now?: number) => Day;
|
|
146
|
+
/**
|
|
147
|
+
* A date as written, as whole days: ISO (`2026-04-09`, a time after it ignored), or `"Apr 9, 2026"`,
|
|
148
|
+
* `"Oct 14–16, 2026"`, `"Jun 26 – Jul 2, 2026"`; with no year, `year`. Null when it's neither.
|
|
149
|
+
*/
|
|
150
|
+
export declare function parseDay(text: string, year?: number): {
|
|
151
|
+
from: Day;
|
|
152
|
+
to: Day;
|
|
153
|
+
year?: number;
|
|
154
|
+
} | null;
|
|
155
|
+
/** `"Jun 26, 2026"`. */
|
|
156
|
+
export declare function formatDay(day: Day): string;
|
|
157
|
+
/** One day, or a range as short as it reads: `"Oct 14–16, 2026"`, `"Sep 19, 2026 – today"`. */
|
|
158
|
+
export declare function formatRange(from: Day, to: Day, open?: boolean): string;
|
|
159
|
+
/** `"1 day"`, `"31 days"`. */
|
|
160
|
+
export declare const formatDays: (n: number) => string;
|
|
161
|
+
/** A state's colour from its name when `states` doesn't give one. */
|
|
162
|
+
export declare function guessTone(state: string): HistoryTone;
|
|
163
|
+
/** A group heading as a band's label: its number and a trailing "(Apr – May 2026)" go. */
|
|
164
|
+
export declare const bandLabel: (heading: string) => string;
|
|
165
|
+
/**
|
|
166
|
+
* The walkthrough's older shape in the new one: every group's events on the code lane, each group
|
|
167
|
+
* with a heading a faint band from its first event to its last. Dates with no year take the year
|
|
168
|
+
* of the event before (or the first one written).
|
|
169
|
+
*/
|
|
170
|
+
export declare function fromGroups(groups: readonly HistoryGroup[], today: Day): {
|
|
171
|
+
events: HistoryEvent[];
|
|
172
|
+
bands: HistoryBand[];
|
|
173
|
+
};
|
|
174
|
+
/** A day as ISO `2026-04-09`. */
|
|
175
|
+
export declare function iso(day: Day): string;
|
|
176
|
+
/** The document filled in: whole days, lanes with their spans and events, the axis and the order. */
|
|
177
|
+
export declare function normalizeHistory(data: HistoryData, now?: Day): HistoryModel;
|
|
178
|
+
/** The marks drawn from the start: the rest wait for the pointer or "Show …". */
|
|
179
|
+
export declare const DEFAULT_MARKS: readonly string[];
|
|
180
|
+
/**
|
|
181
|
+
* The events held back until asked for: those with a type that isn't in `marks`. Untyped events
|
|
182
|
+
* always show, and where holding back would leave no mark at all, none are.
|
|
183
|
+
*/
|
|
184
|
+
export declare function quietEvents(events: readonly HyItem[], marks: readonly string[] | "all"): Set<string>;
|
|
185
|
+
/** What the toggle shows: `"commits"`, `"commits and findings"`. */
|
|
186
|
+
export declare function quietLabel(events: readonly HyItem[], quiet: ReadonlySet<string>): string;
|
|
187
|
+
/** The order ←/→ walk: by date, then lane (top first), then as written. */
|
|
188
|
+
export declare function eventOrder(events: readonly {
|
|
189
|
+
item: HyItem;
|
|
190
|
+
index: number;
|
|
191
|
+
laneIndex: number;
|
|
192
|
+
}[]): HyItem[];
|
|
193
|
+
/**
|
|
194
|
+
* The event ←/→ land on from `current`: the next or the one before, stopping at the ends; from
|
|
195
|
+
* nothing (or a span), → the first and ← the last.
|
|
196
|
+
*/
|
|
197
|
+
export declare function stepEvent(order: readonly HyItem[], current: string | null, dir: 1 | -1,
|
|
198
|
+
/** Where the selection is when it isn't in `order` (a held-back mark): carry on from there. */
|
|
199
|
+
at?: Day): HyItem | null;
|
|
200
|
+
/** Where a day sits across `width` (pixels), and the day at an x. */
|
|
201
|
+
export declare function dayScale(from: Day, to: Day, width: number): {
|
|
202
|
+
x: (day: number) => number;
|
|
203
|
+
day: (x: number) => number;
|
|
204
|
+
/** As a fraction of the width, for `left: n%`. */
|
|
205
|
+
f: (day: number) => number;
|
|
206
|
+
};
|
|
207
|
+
export interface MonthTick {
|
|
208
|
+
readonly day: Day;
|
|
209
|
+
/** `"Apr"`, or the year on January. */
|
|
210
|
+
readonly label: string;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* A tick on the first of each month inside the axis, thinned to every 2, 3, 6 or 12 months until
|
|
214
|
+
* neighbours sit at least `minGap` pixels apart. January says its year.
|
|
215
|
+
*/
|
|
216
|
+
export declare function monthTicks(from: Day, to: Day, width: number, minGap?: number): MonthTick[];
|
|
217
|
+
/**
|
|
218
|
+
* Which labels to draw, left to right: each starts at its `x` and is `w` wide, and one is left out
|
|
219
|
+
* where it would touch the one before (within `gap`), a reserved box (today's label), or run past
|
|
220
|
+
* `width`.
|
|
221
|
+
*/
|
|
222
|
+
export declare function fitLabels(labels: readonly {
|
|
223
|
+
x: number;
|
|
224
|
+
w: number;
|
|
225
|
+
}[], width: number, reserved?: readonly {
|
|
226
|
+
x0: number;
|
|
227
|
+
x1: number;
|
|
228
|
+
}[], gap?: number): boolean[];
|
|
229
|
+
/** A span clipped to the axis, and which ends were cut; null when it's outside it. */
|
|
230
|
+
export declare function clipSpan(from: Day, to: Day, axisFrom: Day, axisTo: Day): {
|
|
231
|
+
from: Day;
|
|
232
|
+
to: Day;
|
|
233
|
+
clipStart: boolean;
|
|
234
|
+
clipEnd: boolean;
|
|
235
|
+
} | null;
|
|
236
|
+
/**
|
|
237
|
+
* Where a span's tag goes: the longest of `widths` (pixels, longest first) that fits inside the
|
|
238
|
+
* bar with `pad` either side, else one that fits after it in `roomAfter`; else none.
|
|
239
|
+
*/
|
|
240
|
+
export declare function fitTag(widths: readonly number[], spanWidth: number, roomAfter: number, pad?: number): {
|
|
241
|
+
index: number;
|
|
242
|
+
place: "inside" | "after";
|
|
243
|
+
} | null;
|
|
244
|
+
/** Each band's label room: from its start to its end or the next band's start, if sooner. */
|
|
245
|
+
export declare function bandRoom(bands: readonly HyBand[], x: (day: Day) => number): number[];
|
|
246
|
+
/** The event nearest `day` within `tolerance` days, else null. */
|
|
247
|
+
export declare function nearestEvent(events: readonly HyItem[], day: number, tolerance: number): HyItem | null;
|
|
248
|
+
/** The first sentence of a detail: a tooltip's one line. */
|
|
249
|
+
export declare function firstSentence(text: string | undefined): string;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type HistoryData, type HistoryModel } from "./history-model.js";
|
|
2
|
+
import { type UiLook } from "./look.js";
|
|
3
|
+
export type { HistoryBand, HistoryData, HistoryEvent, HistoryEvidence, HistoryGroup, HistoryLane, HistoryProvenance, HistorySpan, HistoryState, HistoryTone, } from "./history-model.js";
|
|
4
|
+
export interface HistoryOptions extends UiLook {
|
|
5
|
+
/** Lanes of spans and events (or the walkthrough's `groups` of events): plain JSON. */
|
|
6
|
+
readonly data: HistoryData;
|
|
7
|
+
/** The selected event or span's id. */
|
|
8
|
+
readonly selected?: string | null;
|
|
9
|
+
/** Clicks and keys moved the selection (a host's `select()` doesn't call it). */
|
|
10
|
+
readonly onSelect?: (id: string | null) => void;
|
|
11
|
+
/** Draws "Go to step" in the detail of anything with a `step`, and Enter on it. */
|
|
12
|
+
readonly onJump?: (step: string) => void;
|
|
13
|
+
/** Its accessible name. */
|
|
14
|
+
readonly label?: string;
|
|
15
|
+
/** Under this width (px) lane labels sit above their lanes instead of beside them (560). */
|
|
16
|
+
readonly narrow?: number;
|
|
17
|
+
/**
|
|
18
|
+
* The event types marked from the start (releases and deletions, or `"all"`); the rest show
|
|
19
|
+
* while the pointer is on their lane, and all of them behind a "Show commits" toggle.
|
|
20
|
+
*/
|
|
21
|
+
readonly marks?: readonly string[] | "all";
|
|
22
|
+
}
|
|
23
|
+
export interface History {
|
|
24
|
+
readonly element: HTMLElement;
|
|
25
|
+
/** The data filled in: whole days, lanes, the axis and the order ←/→ walk. */
|
|
26
|
+
readonly model: HistoryModel;
|
|
27
|
+
readonly selected: string | null;
|
|
28
|
+
/** Selects an event or span (`null` clears); doesn't call `onSelect`. */
|
|
29
|
+
select(id: string | null): void;
|
|
30
|
+
set(data: HistoryData): void;
|
|
31
|
+
focus(): void;
|
|
32
|
+
dispose(): void;
|
|
33
|
+
/** The same as `dispose`. */
|
|
34
|
+
destroy(): void;
|
|
35
|
+
}
|
|
36
|
+
/** Adds the history's stylesheet once per document. */
|
|
37
|
+
export declare function injectHistoryStyles(doc: Document): void;
|
|
38
|
+
export declare function history(container: HTMLElement, options: HistoryOptions): History;
|