website: snapshot

This commit is contained in:
nym21
2026-01-24 19:22:03 +01:00
parent 9b706dfaee
commit 7cdf47a9e4
33 changed files with 3031 additions and 2132 deletions

View File

@@ -15,35 +15,51 @@ import {
} from "./series.js";
import { colors } from "../chart/colors.js";
/**
* @template {(arg: any, ...args: any[]) => any} F
* @typedef {F extends (arg: any, ...args: infer P) => infer R ? (...args: P) => R : never} OmitFirstArg
*/
/** @typedef {ReturnType<typeof createContext>} PartialContext */
/**
* Create a context object with all dependencies for building partial options
* @param {Object} args
* @param {BrkClient} args.brk
* @returns {PartialContext}
*/
export function createContext({ brk }) {
return {
colors,
brk,
/** @type {OmitFirstArg<typeof fromBlockCount>} */
fromBlockCount: (pattern, title, color) =>
fromBlockCount(colors, pattern, title, color),
/** @type {OmitFirstArg<typeof fromBitcoin>} */
fromBitcoin: (pattern, title, color) =>
fromBitcoin(colors, pattern, title, color),
/** @type {OmitFirstArg<typeof fromBlockSize>} */
fromBlockSize: (pattern, title, color) =>
fromBlockSize(colors, pattern, title, color),
/** @type {OmitFirstArg<typeof fromSizePattern>} */
fromSizePattern: (pattern, unit, title) =>
fromSizePattern(colors, pattern, unit, title),
/** @type {OmitFirstArg<typeof fromFullnessPattern>} */
fromFullnessPattern: (pattern, unit, title) =>
fromFullnessPattern(colors, pattern, unit, title),
/** @type {OmitFirstArg<typeof fromDollarsPattern>} */
fromDollarsPattern: (pattern, unit, title) =>
fromDollarsPattern(colors, pattern, unit, title),
/** @type {OmitFirstArg<typeof fromFeeRatePattern>} */
fromFeeRatePattern: (pattern, unit, title) =>
fromFeeRatePattern(colors, pattern, unit, title),
/** @type {OmitFirstArg<typeof fromCoinbasePattern>} */
fromCoinbasePattern: (pattern, title) =>
fromCoinbasePattern(colors, pattern, title),
/** @type {OmitFirstArg<typeof fromValuePattern>} */
fromValuePattern: (pattern, title, sumColor, cumulativeColor) =>
fromValuePattern(colors, pattern, title, sumColor, cumulativeColor),
/** @type {OmitFirstArg<typeof fromBitcoinPatternWithUnit>} */
fromBitcoinPatternWithUnit: (
pattern,
title,
@@ -59,6 +75,7 @@ export function createContext({ brk }) {
sumColor,
cumulativeColor,
),
/** @type {OmitFirstArg<typeof fromBlockCountWithUnit>} */
fromBlockCountWithUnit: (pattern, unit, title, sumColor, cumulativeColor) =>
fromBlockCountWithUnit(
colors,
@@ -68,9 +85,11 @@ export function createContext({ brk }) {
sumColor,
cumulativeColor,
),
/** @type {OmitFirstArg<typeof fromIntervalPattern>} */
fromIntervalPattern: (pattern, unit, title, color) =>
fromIntervalPattern(colors, pattern, unit, title, color),
/** @type {fromSupplyPattern} */
fromSupplyPattern: (pattern, title, color) =>
fromSupplyPattern(colors, pattern, title, color),
fromSupplyPattern(pattern, title, color),
};
}