computer: store part 10

This commit is contained in:
nym21
2025-07-05 17:44:51 +02:00
parent 5fe984c39d
commit d31d47eb32
39 changed files with 896 additions and 486 deletions

View File

@@ -7,7 +7,7 @@ const LINE = "line";
const CANDLE = "candle";
/**
* @typedef {"timestamp" | "date" | "week" | "diff. epoch" | "month" | "quarter" | "year" | "decade" } SerializedChartableIndex
* @typedef {"timestamp" | "date" | "week" | "d.epoch" | "month" | "quarter" | "year" | "decade" } SerializedChartableIndex
*/
/**
@@ -47,7 +47,7 @@ export function init({
});
const TIMERANGE_LS_KEY = signals.createMemo(
() => `chart-timerange-${index()}`
() => `chart-timerange-${index()}`,
);
let firstRun = true;
@@ -101,7 +101,7 @@ export function init({
from.set(t.from);
to.set(t.to);
}
})
}),
);
elements.charts.append(fieldset);
@@ -218,7 +218,7 @@ export function init({
date.setUTCFullYear(
Math.floor(date.getUTCFullYear() / 10) * 10,
0,
1
1,
);
} else {
throw Error("Unsupported");
@@ -361,9 +361,9 @@ export function init({
({ latest, hasData }) => {
if (!series || !latest || !hasData) return;
printLatest({ iseries: series.inner, unit: topUnit, index });
}
},
);
}
},
);
[
@@ -425,7 +425,7 @@ export function init({
blueprint.color?.() ?? blueprint.colors?.[1](),
},
order,
})
}),
);
break;
}
@@ -443,13 +443,13 @@ export function init({
paneIndex,
options: blueprint.options,
order,
})
}),
);
}
}
});
});
}
},
);
firstRun = false;
@@ -469,7 +469,7 @@ function createIndexSelector({ option, vecIdToIndexes, signals, utils }) {
"timestamp",
"date",
"week",
"diff. epoch",
"d.epoch",
"month",
"quarter",
"year",
@@ -488,7 +488,7 @@ function createIndexSelector({ option, vecIdToIndexes, signals, utils }) {
[Object.values(o.top), Object.values(o.bottom)]
.flat(2)
.map((blueprint) => vecIdToIndexes[blueprint.key])
.flat()
.flat(),
);
const serializedIndexes = [...rawIndexes].flatMap((index) => {
@@ -515,7 +515,7 @@ function createIndexSelector({ option, vecIdToIndexes, signals, utils }) {
fieldset.dataset.size = "sm";
const index = signals.createMemo(() =>
utils.serde.chartableIndex.deserialize(selected())
utils.serde.chartableIndex.deserialize(selected()),
);
return { fieldset, index };

View File

@@ -0,0 +1,53 @@
// @ts-check
/**
* @param {Object} args
* @param {Colors} args.colors
* @param {LightweightCharts} args.lightweightCharts
* @param {Accessor<ChartOption>} args.option
* @param {Signals} args.signals
* @param {Utilities} args.utils
* @param {WebSockets} args.webSockets
* @param {Elements} args.elements
* @param {VecsResources} args.vecsResources
* @param {VecIdToIndexes} args.vecIdToIndexes
*/
export function init({
colors,
elements,
lightweightCharts,
option,
signals,
utils,
webSockets,
vecsResources,
vecIdToIndexes,
}) {
const chain = window.document.createElement("div");
chain.id = "chain";
elements.explorer.append(chain);
chain.append(createCube());
chain.append(createCube());
chain.append(createCube());
chain.append(createCube());
chain.append(createCube());
}
function createCube() {
const cubeElement = window.document.createElement("div");
cubeElement.classList.add("cube");
const faceFrontElement = window.document.createElement("div");
faceFrontElement.classList.add("face");
faceFrontElement.classList.add("front");
cubeElement.append(faceFrontElement);
const faceSideElement = window.document.createElement("div");
faceSideElement.classList.add("face");
faceSideElement.classList.add("side");
cubeElement.append(faceSideElement);
const faceTopElement = window.document.createElement("div");
faceTopElement.classList.add("face");
faceTopElement.classList.add("top");
cubeElement.append(faceTopElement);
return cubeElement;
}

View File

@@ -64,14 +64,14 @@ function initPackages() {
const imports = {
async signals() {
return import("../packages/solid-signals/wrapper.js").then(
(d) => d.default
(d) => d.default,
);
},
async lightweightCharts() {
return window.document.fonts.ready.then(() =>
import("../packages/lightweight-charts/wrapper.js").then(
(d) => d.default
)
(d) => d.default,
),
);
},
async leanQr() {
@@ -79,7 +79,7 @@ function initPackages() {
},
async ufuzzy() {
return import("../packages/ufuzzy/v1.0.18/script.js").then(
({ default: d }) => d
({ default: d }) => d,
);
},
};
@@ -587,7 +587,7 @@ function createUtils() {
window.history.pushState(
null,
"",
`${pathname}?${urlParams.toString()}`
`${pathname}?${urlParams.toString()}`,
);
} catch (_) {}
},
@@ -604,7 +604,7 @@ function createUtils() {
window.history.replaceState(
null,
"",
`${pathname}?${urlParams.toString()}`
`${pathname}?${urlParams.toString()}`,
);
} catch (_) {}
},
@@ -1177,7 +1177,7 @@ function createUtils() {
case /** @satisfies {DecadeIndex} */ (1):
return "decade";
case /** @satisfies {DifficultyEpoch} */ (2):
return "diff. epoch";
return "d.epoch";
// case /** @satisfies {HalvingEpoch} */ (4):
// return "halving";
case /** @satisfies {Height} */ (5):
@@ -1206,7 +1206,7 @@ function createUtils() {
return /** @satisfies {DateIndex} */ (0);
case "week":
return /** @satisfies {WeekIndex} */ (22);
case "diff. epoch":
case "d.epoch":
return /** @satisfies {DifficultyEpoch} */ (2);
case "month":
return /** @satisfies {MonthIndex} */ (7);
@@ -1248,8 +1248,8 @@ function createUtils() {
today.getUTCDate(),
0,
0,
0
)
0,
),
);
},
/**
@@ -1336,7 +1336,7 @@ function createUtils() {
*/
function getNumberOfDaysBetweenTwoDates(oldest, youngest) {
return Math.round(
Math.abs((youngest.getTime() - oldest.getTime()) / date.ONE_DAY_IN_MS)
Math.abs((youngest.getTime() - oldest.getTime()) / date.ONE_DAY_IN_MS),
);
}
@@ -1456,7 +1456,7 @@ function createUtils() {
function genPath(index, vecId, from, to) {
let path = `/${serde.index.serialize(index)}-to-${vecId.replaceAll(
"_",
"-"
"-",
)}?`;
if (from !== undefined) {
@@ -1562,7 +1562,7 @@ function createVecsResources(signals, utils) {
const fetchedRecord = signals.createSignal(
/** @type {Map<string, {loading: boolean, at: Date | null, vec: Signal<T[] | null>}>} */ (
new Map()
)
),
);
return {
@@ -1612,7 +1612,7 @@ function createVecsResources(signals, utils) {
index,
id,
from,
to
to,
)
);
fetched.at = new Date();
@@ -1708,6 +1708,7 @@ function getElements() {
style: getComputedStyle(window.document.documentElement),
charts: getElementById("charts"),
table: getElementById("table"),
explorer: getElementById("explorer"),
simulation: getElementById("simulation"),
};
}
@@ -1873,7 +1874,7 @@ function initWebSockets(signals, utils) {
window.document.addEventListener(
"visibilitychange",
reinitWebSocketIfDocumentNotHidden
reinitWebSocketIfDocumentNotHidden,
);
window.document.addEventListener("online", reinitWebSocket);
@@ -1882,7 +1883,7 @@ function initWebSockets(signals, utils) {
ws?.close();
window.document.removeEventListener(
"visibilitychange",
reinitWebSocketIfDocumentNotHidden
reinitWebSocketIfDocumentNotHidden,
);
window.document.removeEventListener("online", reinitWebSocket);
live.set(false);
@@ -1908,7 +1909,7 @@ function initWebSockets(signals, utils) {
symbol: ["BTC/USD"],
interval: 1440,
},
})
}),
);
});
@@ -1937,7 +1938,7 @@ function initWebSockets(signals, utils) {
/** @type {ReturnType<typeof createWebsocket<CandlestickData>>} */
const kraken1dCandle = createWebsocket((callback) =>
krakenCandleWebSocketCreator(callback)
krakenCandleWebSocketCreator(callback),
);
kraken1dCandle.open();
@@ -1996,7 +1997,7 @@ function main() {
}
const frame = window.document.getElementById(
/** @type {string} */ (input.value)
/** @type {string} */ (input.value),
);
if (!frame) {
@@ -2094,23 +2095,23 @@ function main() {
function initDark() {
const preferredColorSchemeMatchMedia = window.matchMedia(
"(prefers-color-scheme: dark)"
"(prefers-color-scheme: dark)",
);
const dark = signals.createSignal(
preferredColorSchemeMatchMedia.matches
preferredColorSchemeMatchMedia.matches,
);
preferredColorSchemeMatchMedia.addEventListener(
"change",
({ matches }) => {
dark.set(matches);
}
},
);
return dark;
}
const dark = initDark();
const qrcode = signals.createSignal(
/** @type {string | null} */ (null)
/** @type {string | null} */ (null),
);
function createLastHeightResource() {
@@ -2121,7 +2122,7 @@ function main() {
lastHeight.set(h);
},
/** @satisfies {Height} */ (5),
"height"
"height",
);
}
fetchLastHeight();
@@ -2165,10 +2166,10 @@ function main() {
const owner = signals.getOwner();
const chartOption = signals.createSignal(
/** @type {ChartOption | null} */ (null)
/** @type {ChartOption | null} */ (null),
);
const simOption = signals.createSignal(
/** @type {SimulationOption | null} */ (null)
/** @type {SimulationOption | null} */ (null),
);
let previousElement = /** @type {HTMLElement | undefined} */ (
@@ -2177,6 +2178,7 @@ function main() {
let firstTimeLoadingChart = true;
let firstTimeLoadingTable = true;
let firstTimeLoadingSimulation = true;
let firstTimeLoadingExplorer = true;
signals.createEffect(options.selected, (option) => {
console.log(utils.url.pathnameToSelectedId(), option.id);
@@ -2192,6 +2194,35 @@ function main() {
let element;
switch (option.kind) {
case "explorer": {
element = elements.explorer;
if (firstTimeLoadingExplorer) {
const lightweightCharts = packages.lightweightCharts();
import("./explorer.js").then(({ init }) =>
lightweightCharts.then((lightweightCharts) =>
signals.runWithOwner(owner, () =>
init({
colors,
elements,
lightweightCharts,
option: /** @type {Accessor<ChartOption>} */ (
chartOption
),
signals,
utils,
webSockets,
vecsResources,
vecIdToIndexes,
}),
),
),
);
}
firstTimeLoadingExplorer = false;
break;
}
case "chart": {
element = elements.charts;
@@ -2214,9 +2245,9 @@ function main() {
webSockets,
vecsResources,
vecIdToIndexes,
})
)
)
}),
),
),
);
}
firstTimeLoadingChart = false;
@@ -2236,8 +2267,8 @@ function main() {
vecsResources,
option,
vecIdToIndexes,
})
)
}),
),
);
}
firstTimeLoadingTable = false;
@@ -2261,9 +2292,9 @@ function main() {
signals,
utils,
vecsResources,
})
)
)
}),
),
),
);
}
firstTimeLoadingSimulation = false;
@@ -2292,7 +2323,7 @@ function main() {
createMobileSwitchEffect();
utils.dom.onFirstIntersection(elements.aside, () =>
signals.runWithOwner(owner, initSelectedFrame)
signals.runWithOwner(owner, initSelectedFrame),
);
}
initSelected();
@@ -2372,7 +2403,7 @@ function main() {
if (indexes?.length) {
const maxIndex = Math.min(
(order || indexes).length - 1,
minIndex + RESULTS_PER_PAGE - 1
minIndex + RESULTS_PER_PAGE - 1,
);
list = Array(maxIndex - minIndex + 1);
@@ -2448,7 +2479,7 @@ function main() {
haystack,
needle,
undefined,
infoThresh
infoThresh,
);
if (!result?.[0]?.length || !result?.[1]) {
@@ -2456,7 +2487,7 @@ function main() {
haystack,
needle,
outOfOrder,
infoThresh
infoThresh,
);
}
@@ -2465,7 +2496,7 @@ function main() {
haystack,
needle,
outOfOrder,
infoThresh
infoThresh,
);
}
@@ -2474,7 +2505,7 @@ function main() {
haystack,
needle,
outOfOrder,
infoThresh
infoThresh,
);
}
@@ -2483,7 +2514,7 @@ function main() {
haystack,
needle,
undefined,
infoThresh
infoThresh,
);
}
@@ -2492,7 +2523,7 @@ function main() {
haystack,
needle,
outOfOrder,
infoThresh
infoThresh,
);
}
@@ -2575,7 +2606,7 @@ function main() {
shareDiv.hidden = false;
});
})
}),
);
}
initShare();
@@ -2599,7 +2630,7 @@ function main() {
utils.storage.write(barWidthLocalStorageKey, String(width));
} else {
elements.main.style.width = elements.style.getPropertyValue(
"--default-main-width"
"--default-main-width",
);
utils.storage.remove(barWidthLocalStorageKey);
}
@@ -2636,9 +2667,9 @@ function main() {
window.addEventListener("mouseleave", setResizeFalse);
}
initDesktopResizeBar();
})
)
)
}),
),
),
);
}
main();

View File

@@ -46,6 +46,14 @@
* @property {string} title
* @property {string[]} path
*
* @typedef {Object} PartialExplorerOptionSpecific
* @property {"explorer"} kind
* @property {string} title
*
* @typedef {PartialOption & PartialExplorerOptionSpecific} PartialExplorerOption
*
* @typedef {Required<PartialExplorerOption> & ProcessedOptionAddons} ExplorerOption
*
* @typedef {Object} PartialChartOptionSpecific
* @property {"chart"} [kind]
* @property {string} title
@@ -85,9 +93,9 @@
*
* @typedef {Required<PartialUrlOption> & ProcessedOptionAddons} UrlOption
*
* @typedef {PartialChartOption | PartialTableOption | PartialSimulationOption | PartialUrlOption} AnyPartialOption
* @typedef {PartialExplorerOption | PartialChartOption | PartialTableOption | PartialSimulationOption | PartialUrlOption} AnyPartialOption
*
* @typedef {ChartOption | TableOption | SimulationOption | UrlOption} Option
* @typedef {ExplorerOption | ChartOption | TableOption | SimulationOption | UrlOption} Option
*
* @typedef {Object} PartialOptionsGroup
* @property {string} name
@@ -105,10 +113,12 @@
*/
/**
* @param {Colors} colors
* @param {Object} args
* @param {Env} args.env
* @param {Colors} args.colors
* @returns {PartialOptionsTree}
*/
function createPartialOptions(colors) {
function createPartialOptions({ env, colors }) {
/**
* @template {string} S
* @typedef {Extract<VecId, `${S}${string}`>} StartsWith
@@ -1505,7 +1515,7 @@ function createPartialOptions(colors) {
key: `${fixKey(key)}realized_price`,
name,
color,
})
}),
),
}
: createPriceWithRatio({
@@ -1551,7 +1561,7 @@ function createPartialOptions(colors) {
}),
createBaseSeries({
key: `cumulative_${fixKey(
args.key
args.key,
)}negative_realized_loss`,
name: "Cumulative Negative Loss",
color: colors.red,
@@ -1560,7 +1570,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `${fixKey(
args.key
args.key,
)}realized_profit_relative_to_realized_cap`,
title: "Profit",
color: colors.green,
@@ -1573,7 +1583,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `${fixKey(
args.key
args.key,
)}realized_loss_relative_to_realized_cap`,
title: "Loss",
color: colors.red,
@@ -1602,7 +1612,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `cumulative_${fixKey(
key
key,
)}net_realized_profit_and_loss`,
title: "Cumulative net",
defaultActive: false,
@@ -1615,7 +1625,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `cumulative_${fixKey(
key
key,
)}net_realized_profit_and_loss_30d_change`,
title: "cum net 30d change",
defaultActive: false,
@@ -1628,7 +1638,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `${fixKey(
key
key,
)}net_realized_profit_and_loss_relative_to_realized_cap`,
title: "Net",
options: {
@@ -1640,7 +1650,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `cumulative_${fixKey(
key
key,
)}net_realized_profit_and_loss_30d_change_relative_to_realized_cap`,
title: "cum net 30d change",
options: {
@@ -1652,7 +1662,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `cumulative_${fixKey(
key
key,
)}net_realized_profit_and_loss_30d_change_relative_to_market_cap`,
title: "cum net 30d change",
options: {
@@ -1760,7 +1770,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `${fixKey(
key
key,
)}net_realized_profit_and_loss_relative_to_realized_cap`,
title: name,
color,
@@ -1810,7 +1820,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `cumulative_${fixKey(
key
key,
)}net_realized_profit_and_loss`,
title: name,
color,
@@ -1830,7 +1840,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `cumulative_${fixKey(
key
key,
)}net_realized_profit_and_loss_30d_change`,
title: name,
color,
@@ -1843,7 +1853,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `cumulative_${fixKey(
key
key,
)}net_realized_profit_and_loss_30d_change_relative_to_realized_cap`,
title: name,
color,
@@ -1856,7 +1866,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `cumulative_${fixKey(
key
key,
)}net_realized_profit_and_loss_30d_change_relative_to_market_cap`,
title: name,
color,
@@ -1897,7 +1907,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `${fixKey(
key
key,
)}adjusted_spent_output_profit_ratio`,
title: name,
color,
@@ -1920,7 +1930,7 @@ function createPartialOptions(colors) {
key: `${fixKey(key)}sell_side_risk_ratio`,
name: useGroupName ? name : "Risk",
color: color,
})
}),
),
},
],
@@ -2009,7 +2019,7 @@ function createPartialOptions(colors) {
/** @satisfies {FetchedBaselineSeriesBlueprint} */ ({
type: "Baseline",
key: `${fixKey(
key
key,
)}net_unrealized_profit_and_loss_relative_to_market_cap`,
title: useGroupName ? name : "Net",
color: useGroupName ? color : undefined,
@@ -2134,6 +2144,15 @@ function createPartialOptions(colors) {
}
return [
...(env.localhost
? /** @type {const} */ ([
{
name: "Explorer",
title: "Explorer",
kind: "explorer",
},
])
: []),
{
name: "Charts",
tree: [
@@ -2199,7 +2218,7 @@ function createPartialOptions(colors) {
key: `${key}_sma`,
name: key,
color,
})
}),
),
},
...averages.map(({ key, name, color }) =>
@@ -2209,7 +2228,7 @@ function createPartialOptions(colors) {
title: `${name} Market Price Moving Average`,
legend: "average",
color,
})
}),
),
],
},
@@ -2326,7 +2345,7 @@ function createPartialOptions(colors) {
},
}),
],
})
}),
),
.../** @type {const} */ ([
{ name: "2 Year", key: "2y" },
@@ -2397,7 +2416,7 @@ function createPartialOptions(colors) {
},
}),
],
})
}),
),
],
},
@@ -2413,7 +2432,7 @@ function createPartialOptions(colors) {
name: `${year}`,
color,
defaultActive,
})
}),
),
},
...dcaClasses.map(
@@ -2440,7 +2459,7 @@ function createPartialOptions(colors) {
},
}),
],
})
}),
),
],
},
@@ -2501,10 +2520,10 @@ function createPartialOptions(colors) {
bottom: [
...createAverageSumCumulativeMinMaxPercentilesSeries("fee"),
...createAverageSumCumulativeMinMaxPercentilesSeries(
"fee_in_btc"
"fee_in_btc",
),
...createAverageSumCumulativeMinMaxPercentilesSeries(
"fee_in_usd"
"fee_in_usd",
),
],
},
@@ -3227,7 +3246,7 @@ function createPartialOptions(colors) {
name,
color,
}),
])
]),
),
},
{
@@ -3252,7 +3271,7 @@ function createPartialOptions(colors) {
key,
name,
color,
})
}),
),
],
},
@@ -3277,7 +3296,7 @@ function createPartialOptions(colors) {
color: colors.orange,
}),
],
})
}),
),
],
},
@@ -3292,7 +3311,7 @@ function createPartialOptions(colors) {
key,
name,
color,
})
}),
),
},
...cointimePrices.map(({ key, name, color, title }) =>
@@ -3302,7 +3321,7 @@ function createPartialOptions(colors) {
color,
name,
title,
})
}),
),
],
},
@@ -3436,7 +3455,7 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
/** @type {Signal<Option>} */
const selected = signals.createSignal(/** @type {any} */ (undefined));
const partialOptions = createPartialOptions(colors);
const partialOptions = createPartialOptions({ env, colors });
/** @type {Option[]} */
const list = [];
@@ -3445,7 +3464,7 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
const detailsList = [];
const treeElement = signals.createSignal(
/** @type {HTMLDivElement | null} */ (null)
/** @type {HTMLDivElement | null} */ (null),
);
/** @type {string[] | undefined} */
@@ -3557,7 +3576,7 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
return null;
}
},
null
null,
);
partialTree.forEach((anyPartial, partialIndex) => {
@@ -3580,7 +3599,7 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
if ("tree" in anyPartial) {
const folderId = utils.stringToId(
`${(path || []).join(" ")} ${anyPartial.name} folder`
`${(path || []).join(" ")} ${anyPartial.name} folder`,
);
/** @type {Omit<OptionsGroup, keyof PartialOptionsGroup>} */
@@ -3595,13 +3614,13 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
const thisPath = groupAddons.id;
const passedDetails = signals.createSignal(
/** @type {HTMLDivElement | HTMLDetailsElement | null} */ (null)
/** @type {HTMLDivElement | HTMLDetailsElement | null} */ (null),
);
const childOptionsCount = recursiveProcessPartialTree(
anyPartial.tree,
passedDetails,
[...(path || []), thisPath]
[...(path || []), thisPath],
);
listForSum.push(childOptionsCount);
@@ -3657,7 +3676,15 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
/** @type {Option} */
let option;
if ("kind" in anyPartial && anyPartial.kind === "table") {
if ("kind" in anyPartial && anyPartial.kind === "explorer") {
option = /** @satisfies {ExplorerOption} */ ({
kind: anyPartial.kind,
id: anyPartial.kind,
name: anyPartial.name,
path: path || [],
title: anyPartial.title,
});
} else if ("kind" in anyPartial && anyPartial.kind === "table") {
option = /** @satisfies {TableOption} */ ({
kind: anyPartial.kind,
id: anyPartial.kind,
@@ -3733,14 +3760,17 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
});
return signals.createMemo(() =>
listForSum.reduce((acc, s) => acc + s(), 0)
listForSum.reduce((acc, s) => acc + s(), 0),
);
}
recursiveProcessPartialTree(partialOptions, treeElement);
function setDefaultSelectedIfNeeded() {
if (!selected()) {
selected.set(list[0]);
const firstChartOption = list.find((option) => option.kind === "chart");
if (firstChartOption) {
selected.set(firstChartOption);
}
}
}
setDefaultSelectedIfNeeded();
@@ -3760,7 +3790,7 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
console.log(
[...m.entries()]
.filter(([_, value]) => value > 1)
.map(([key, _]) => key)
.map(([key, _]) => key),
);
throw Error("ID duplicate");