@ixfx/components 0.7.5 → 0.8.1
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/bundle/index.d.ts +256 -17
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +1462 -166
- package/bundle/index.js.map +1 -1
- package/dist/ac-token.js +1 -1
- package/dist/{data-grid-CtJ35v8L.d.ts → data-grid-D-z7bx5-.d.ts} +2 -2
- package/dist/{data-grid-CtJ35v8L.d.ts.map → data-grid-D-z7bx5-.d.ts.map} +1 -1
- package/dist/data-grid.d.ts +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/{detail-list-BS5dRDda.d.ts → detail-list-_ZJHYEBr.d.ts} +3 -3
- package/dist/{detail-list-BS5dRDda.d.ts.map → detail-list-_ZJHYEBr.d.ts.map} +1 -1
- package/dist/detail-list.d.ts +2 -2
- package/dist/detail-list.js +1 -1
- package/dist/grid-list-nRUQOcEL.js +1537 -0
- package/dist/grid-list-nRUQOcEL.js.map +1 -0
- package/dist/{grid-list-D-GbghSH.d.ts → grid-list-u33vmKzb.d.ts} +116 -15
- package/dist/grid-list-u33vmKzb.d.ts.map +1 -0
- package/dist/grid-list.d.ts +1 -1
- package/dist/grid-list.js +1 -993
- package/dist/{incr-search-DpbSJtgj.js → incr-search-C05WjbZh.js} +40 -3
- package/dist/incr-search-C05WjbZh.js.map +1 -0
- package/dist/incr-search.d.ts +2 -2
- package/dist/incr-search.js +2 -2
- package/dist/{index-CBS4z1v-.d.ts → index-h6gxtfHH.d.ts} +34 -2
- package/dist/index-h6gxtfHH.d.ts.map +1 -0
- package/dist/index.d.ts +60 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +343 -16
- package/dist/index.js.map +1 -1
- package/dist/led.d.ts +33 -1
- package/dist/led.d.ts.map +1 -1
- package/dist/led.js +157 -13
- package/dist/led.js.map +1 -1
- package/dist/miller.d.ts +1 -1
- package/dist/miller.js +1 -1
- package/dist/narrowed-text.js +1 -1
- package/dist/panel.d.ts +3 -1
- package/dist/panel.d.ts.map +1 -1
- package/dist/panel.js +31 -1
- package/dist/panel.js.map +1 -1
- package/dist/plots.d.ts +2 -2
- package/dist/plots.js +1 -1
- package/dist/{titlebar-Bj5pfdw_.d.ts → titlebar-YQ-jVQoS.d.ts} +2 -2
- package/dist/{titlebar-Bj5pfdw_.d.ts.map → titlebar-YQ-jVQoS.d.ts.map} +1 -1
- package/dist/titlebar.d.ts +1 -1
- package/dist/titlebar.js +83 -1
- package/dist/titlebar.js.map +1 -1
- package/dist/{tree-DAii2A1g.js → tree-Chptss7I.js} +2 -2
- package/dist/{tree-DAii2A1g.js.map → tree-Chptss7I.js.map} +1 -1
- package/dist/tree.d.ts +1 -1
- package/dist/tree.js +1 -1
- package/dist/{vertical-list-DwtCPy1b.d.ts → vertical-list-CFuFDygi.d.ts} +2 -2
- package/dist/{vertical-list-DwtCPy1b.d.ts.map → vertical-list-CFuFDygi.d.ts.map} +1 -1
- package/dist/vertical-list.d.ts +1 -1
- package/dist/vertical-list.js +1 -1
- package/dist/{xy-axis-5KhVTNoX.d.ts → xy-axis-BfP9hKLj.d.ts} +25 -2
- package/dist/{xy-axis-5KhVTNoX.d.ts.map → xy-axis-BfP9hKLj.d.ts.map} +1 -1
- package/dist/{xy-axis-VrX8dmvS.js → xy-axis-DzM1brBZ.js} +141 -8
- package/dist/xy-axis-DzM1brBZ.js.map +1 -0
- package/docs-user/dock.md +1 -0
- package/docs-user/grid-list.md +99 -14
- package/docs-user/index.json +3 -3
- package/docs-user/led.md +37 -7
- package/docs-user/llms.txt +1 -1
- package/docs-user/panel.md +68 -13
- package/docs-user/titlebar.md +3 -4
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/dist/grid-list-D-GbghSH.d.ts.map +0 -1
- package/dist/grid-list.js.map +0 -1
- package/dist/incr-search-DpbSJtgj.js.map +0 -1
- package/dist/index-CBS4z1v-.d.ts.map +0 -1
- package/dist/xy-axis-VrX8dmvS.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"xy-axis-VrX8dmvS.js","names":["#options","#rangeManual","#recompute","#rangeAuto","#rangeStream","#renderIcon","customElement","#addToSeries","#ensurePlot","#seriesSet","#seriesOrder","#instances","#pendingStyles","#onSubPlotPointerMove","#onSubPlotPointerLeave","#escapeHTML","customElement","#bucketIndexFromPointer","#setInlineIndex","#updateBubbleTooltip","#hasProgrammaticData","#series","#parseDeclarativeData","#resetHoverState","#readCssVar","#computeGeometry","#getGapPx","#getBarLengthOverride","#computeBars","#valueRefreshTimer","#clearValueRefreshTimer","#scheduleValueRefresh","#tooltipShowTimer","#tooltipHideTimer","#tooltipVisible","#tooltipIndex","#tooltipPosition","#clearBubbleTooltip","#tooltipPositionFor","#refreshBubbleText","#formatBarAt","#emitClick","#onPointerMove","#onPointerLeave","customElement","#lastClientX","#lastClientY","#updateTooltip","#getIndexFromX","#series","#hasProgrammaticData","#updateTooltipAtLastPos","#parseDeclarativeData","#computePoints","#renderByStyle","#onPointerMove","#onPointerLeave","#onClick","customElement","#lastClientX","#lastClientY","#updateTooltip","#findNearestPoint","#lastPoints","#xSeries","#ySeries","#updateTooltipAtLastPos","#computePoints","#computeColours","#onPointerMove","#onPointerLeave","#onClick","customElement"],"sources":["../src/plots/colour-map.ts","../src/plots/data.ts","../src/util/is-numeric.ts","../src/util/tooltip.ts","../src/plots/svg-utils.ts","../src/plots/multi-axis.ts","../src/plots/plot-histogram.ts","../src/plots/single-axis.ts","../src/plots/xy-axis.ts"],"sourcesContent":["/**\n * Colour mapping for plot components.\n *\n * Pipeline:\n * scaledValue (0..1)\n * → applyMapping (easing / custom fn)\n * → computeColour (mode → ColourResult)\n * → applyAgeModification (xy-axis only, compounds age-style on top)\n */\nimport type { EasingName } from '@ixfx/modulation';\nimport { Easings } from '@ixfx/modulation';\nimport { Colour } from '@ixfx/visual';\n\n// --- Types ---\n\nexport type ColourMode = `fixed` | `opacity` | `hue` | `saturation` | `lightness` | `scale`;\n\nexport type ColourMapConfig = {\n mode: ColourMode;\n /** Parsed colours for 'scale' mode. Must have ≥ 2 entries. */\n palette: string[];\n /** ixfx easing name — applied before the colour mode mapping. Takes precedence over valueMap. */\n easingName: string;\n /** Custom value mapping fn (0..1 → 0..1). Used when easingName is empty. */\n valueMap: ((v: number) => number) | null;\n};\n\nexport type ColourResult = { fill: string; opacity: number };\n\n// --- Defaults ---\n\nconst DEFAULT_BASE = `oklch(60% 0.15 140)`;\nconst DEFAULT_PALETTE = [`green`, `yellow`, `red`];\n\n// --- Scale cache: keyed by palette string to avoid recomputing colour steps every render ---\n\nconst _scaleCache = new Map<string, string[]>();\n\nfunction getScaleSteps(palette: string[]): string[] {\n const key = palette.join(`\\x00`);\n if (!_scaleCache.has(key)) {\n _scaleCache.set(key, Colour.scale(palette as Parameters<typeof Colour.scale>[0], { stepsBetween: 99 }));\n }\n return _scaleCache.get(key)!;\n}\n\n// --- Helpers ---\n\n/** Resolve a CSS custom property to its final value, handling var() references. */\nfunction resolveCssVariable(el: Element, prop: string): string {\n const style = getComputedStyle(el);\n let value = style.getPropertyValue(prop).trim();\n\n // Handle var() references - resolve up to 5 levels deep\n const varRegex = /var\\((--[\\w-]+)(?:,\\s*(.*))?\\)/g;\n for (let i = 0; i < 5 && value.includes(`var(`); i++) {\n value = value.replace(varRegex, (_, varName, fallback) => {\n const resolved = style.getPropertyValue(varName).trim();\n if (resolved)\n return resolved;\n if (fallback)\n return fallback.trim();\n return ``;\n });\n }\n\n return value;\n}\n\n/** Read the resolved --plot-color CSS variable from an element. */\nexport function readBaseColour(el: Element): string {\n const v = resolveCssVariable(el, `--plot-color`);\n return v || DEFAULT_BASE;\n}\n\n/** Parse a comma-separated colour string attribute into an array. Falls back to default palette. */\nexport function parseColourScaleAttr(attr: string): string[] {\n if (!attr.trim())\n return DEFAULT_PALETTE;\n const parsed = attr.split(`,`).map(s => s.trim()).filter(Boolean);\n return parsed.length >= 2 ? parsed : DEFAULT_PALETTE;\n}\n\n/** Parse any CSS colour string to HSL scalars (h, s, l all 0..1). */\nfunction toHslScalar(css: string): { h: number; s: number; l: number } {\n try {\n const hsl = Colour.HslSpace.fromCss(css, { scalar: true });\n return { h: hsl.h, s: hsl.s, l: hsl.l };\n } catch {\n return { h: 0.39, s: 0.5, l: 0.55 }; // ~green fallback\n }\n}\n\n/** Apply easing or custom mapping to a 0..1 value. Returns clamped 0..1. */\nfunction applyMapping(v: number, config: ColourMapConfig): number {\n const clamped = Math.max(0, Math.min(1, v));\n if (config.easingName) {\n try {\n return Math.max(0, Math.min(1, Easings.get(config.easingName as EasingName)(clamped)));\n } catch { /* invalid easing name — fall through */ }\n }\n if (config.valueMap) {\n return Math.max(0, Math.min(1, config.valueMap(clamped)));\n }\n return clamped;\n}\n\n// --- Main colour computation ---\n\n/**\n * Compute the fill colour and opacity for a single data point.\n * @param scaledValue Normalised value in 0..1 (data range for single-axis; age fraction for xy).\n * @param baseColour Resolved base colour string (from --plot-color).\n * @param config Colour map configuration.\n */\nexport function computeColour(scaledValue: number, baseColour: string, config: ColourMapConfig): ColourResult {\n const mapped = applyMapping(scaledValue, config);\n\n switch (config.mode) {\n case `fixed`:\n return { fill: baseColour, opacity: 1 };\n\n case `opacity`:\n return { fill: baseColour, opacity: Math.max(0.04, mapped) };\n\n case `hue`: {\n const hsl = toHslScalar(baseColour);\n return {\n fill: `hsl(${Math.round(mapped * 360)}deg ${Math.round(hsl.s * 100)}% ${Math.round(hsl.l * 100)}%)`,\n opacity: 1,\n };\n }\n\n case `saturation`: {\n const hsl = toHslScalar(baseColour);\n return {\n fill: `hsl(${Math.round(hsl.h * 360)}deg ${Math.round(mapped * 100)}% ${Math.round(hsl.l * 100)}%)`,\n opacity: 1,\n };\n }\n\n case `lightness`: {\n const hsl = toHslScalar(baseColour);\n return {\n fill: `hsl(${Math.round(hsl.h * 360)}deg ${Math.round(hsl.s * 100)}% ${Math.round(mapped * 100)}%)`,\n opacity: 1,\n };\n }\n\n case `scale`: {\n const palette = config.palette.length >= 2 ? config.palette : DEFAULT_PALETTE;\n const steps = getScaleSteps(palette);\n const idx = Math.min(steps.length - 1, Math.floor(mapped * steps.length));\n return { fill: steps[idx], opacity: 1 };\n }\n\n default:\n return { fill: baseColour, opacity: 1 };\n }\n}\n\n/**\n * Apply xy-axis age-style modification on top of a base ColourResult.\n * 'size' is not handled here — the caller adjusts the radius separately.\n */\nexport function applyAgeModification(base: ColourResult, ageFraction: number, ageStyle: string): ColourResult {\n if (ageStyle === `opacity`) {\n return { ...base, opacity: base.opacity * Math.max(0.08, ageFraction ** 0.6) };\n }\n if (ageStyle === `desaturation`) {\n const hsl = toHslScalar(base.fill);\n const sFaded = hsl.s * ageFraction; // older → less saturation\n return {\n fill: `hsl(${Math.round(hsl.h * 360)}deg ${Math.round(sFaded * 100)}% ${Math.round(hsl.l * 100)}%)`,\n opacity: base.opacity,\n };\n }\n return base;\n}\n","import { rangeStream } from \"@ixfx/numbers\";\n\nexport type PlotDataSeriesOptions = {\n /**\n * Limit of how many data points to store.\n * Default: 100\n */\n capacityLimit: number;\n /**\n * If _true_, it maintains the same scale over its lifetime.\n * If _false_, scale adjusts based on items in its cache.\n *\n * Default: true\n */\n persistentScaling: boolean;\n\n fixedRange: { min: number; max: number } | null;\n};\n\n/**\n * A data series\n */\nexport class PlotDataSeries {\n values: number[] = [];\n #rangeStream = rangeStream();\n #rangeAuto: { min: number; max: number } = { min: 0, max: 0 };\n #rangeManual: { min: number; max: number } | null = null;\n #options: PlotDataSeriesOptions;\n\n /**\n * Constructor.\n *\n * Default options:\n * - `capacityLimit`: 100\n * - `persistentScaling`: true\n * - `fixedRange`: null\n * @param options\n */\n constructor(options: Partial<PlotDataSeriesOptions> = {}) {\n this.#options = {\n capacityLimit: 100,\n persistentScaling: true,\n fixedRange: null,\n ...options,\n };\n if (this.#options.fixedRange !== null) {\n this.#rangeManual = this.#options.fixedRange;\n }\n }\n\n /**\n * Sets a manual range, this disabled auto-scaling.\n * Use {@link unsetRange} to re-enable auto-scaling.\n * @param min\n * @param max\n */\n setRange(min: number, max: number) {\n this.#rangeManual = { min, max };\n }\n\n /**\n * Disable the manual range\n */\n unsetRange() {\n this.#rangeManual = null;\n this.#recompute();\n }\n\n get isAutoRange() {\n return this.#rangeManual === null;\n }\n\n /**\n * Adds a single value\n * @param valueOrValues Value to add\n */\n add(valueOrValues: number | number[]) {\n if (typeof valueOrValues === `number`) {\n this.values.push(valueOrValues);\n if (this.isAutoRange) {\n this.#rangeAuto = this.#rangeStream.seen(valueOrValues);\n }\n } else {\n this.values.push(...valueOrValues);\n if (this.isAutoRange) {\n for (const v of valueOrValues) {\n this.#rangeAuto = this.#rangeStream.seen(v);\n }\n }\n }\n if (this.values.length > this.#options.capacityLimit) {\n this.values = this.values.slice(this.values.length - this.#options.capacityLimit);\n if (!this.#options.persistentScaling && this.isAutoRange) {\n this.#recompute();\n }\n }\n }\n\n #recompute() {\n if (!this.#options.persistentScaling) {\n this.#rangeStream = rangeStream();\n }\n for (let i = 0; i < this.values.length; i++) {\n this.#rangeAuto = this.#rangeStream.seen(this.values[i]);\n }\n }\n\n /**\n * Sets the entire data series at once, replacing any existing data. If the number of values exceeds the `capacityLimit`, only the most recent values up to the limit are kept.\n * @param values\n */\n set(values: number[]) {\n if (values.length > this.#options.capacityLimit) {\n values = values.slice(values.length - this.#options.capacityLimit);\n }\n this.values = values;\n this.#recompute();\n }\n\n /**\n * Returns the manual range if this is in effect, or the automatic\n */\n get range() {\n if (this.#rangeManual)\n return this.#rangeManual;\n return this.#rangeAuto;\n }\n\n /**\n * Clear all data and reset range. If `persistentScaling` is _false_, also resets scaling to initial state.\n * @returns _true_ if there was data to clear\n */\n clear(): boolean {\n const empty = this.values.length === 0;\n this.values = [];\n if (!this.#options.persistentScaling) {\n this.#recompute();\n }\n return !empty;\n }\n}","export function isNumeric(str: unknown): boolean {\n if (typeof str === `number`)\n return true;\n if (typeof str !== `string`)\n return false;\n const trimmed = str.trim();\n return trimmed !== `` && !Number.isNaN(Number(trimmed));\n}","import { html, LitElement, nothing } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { unsafeHTML } from \"lit/directives/unsafe-html.js\";\nimport { hasIcon } from \"../icons/index.js\";\nimport { safeCustomElement as customElement } from \"./custom-elements.js\";\nimport { isNumeric } from \"./is-numeric.js\";\n\nexport type FormatValueForHuman = (v: unknown) => string;\nexport type TooltipOrientations = `top` | `right` | `bottom` | `left`;\n\n// `ixfx-tooltip` renders to light DOM (see createRenderRoot() below) so it can inherit\n// styling from whatever shadow root it's embedded in (e.g. range-input bundles its own\n// tooltipValueStyles for a scoped bubble-arrow look). That means Lit's `static styles`\n// mechanism can't apply here (it needs adoptedStyleSheets, only available on a ShadowRoot\n// or Document) - so a *standalone* `ixfx-tooltip` (appended directly to <body>, not nested\n// in another component's shadow root) gets no styling at all unless something supplies it.\n// This injects that baseline once, globally, scoped to the bare tag so it never leaks into\n// (or fights with) a host component's own shadow-scoped tooltip styles.\nlet _baseStylesInjected = false;\nfunction ensureBaseTooltipStyles(): void {\n if (_baseStylesInjected)\n return;\n _baseStylesInjected = true;\n const style = document.createElement(`style`);\n style.textContent = `\n ixfx-tooltip {\n display: inline-block;\n background: var(--surface-5);\n color: var(--surface-5-text);\n border: var(--border);\n border-radius: var(--radius-l, 6px);\n box-shadow: var(--shadow-m);\n padding: var(--space-s, 4px);\n font-size: 10px;\n font-family: var(--font-family, inherit);\n }\n ixfx-tooltip .tooltip-type-number {\n font-family: var(--font-mono, ui-monospace, monospace);\n }\n `;\n document.head.appendChild(style);\n}\n\n@customElement(`ixfx-tooltip`)\nexport class TooltipElement extends LitElement {\n override connectedCallback(): void {\n super.connectedCallback();\n ensureBaseTooltipStyles();\n }\n\n static numberFormatter = (v: number) => Math.floor(v).toString();\n\n static defaultFormatter: FormatValueForHuman = (v) => {\n if (typeof v === `number`) {\n if (Number.isInteger(v))\n return v.toString();\n return v.toFixed(2);\n } else if (typeof v === `string`) {\n return v;\n } else {\n return JSON.stringify(v);\n }\n };\n\n valueFormatTooltip: FormatValueForHuman = TooltipElement.defaultFormatter;\n\n @property({ type: String })\n orientation: TooltipOrientations = `top`;\n\n @property({ type: String })\n anchor = `--tooltip`;\n\n @property()\n value: unknown;\n\n @property({ type: String })\n icon?: string;\n\n #renderIcon() {\n if (!this.icon)\n return nothing;\n\n if (this.icon.startsWith(`<svg`)) {\n return html`<span class=\"tooltip-icon\" style=\"display:inline-flex;align-items:center;margin-right:0.25em\">${unsafeHTML(this.icon)}</span>`;\n }\n\n if (!hasIcon(this.icon))\n return nothing;\n\n return html`<ixfx-icon class=\"tooltip-icon\" style=\"margin-right:0.25em\" name=\"${this.icon}\"></ixfx-icon>`;\n }\n\n protected render() {\n const classes = {\n \"tooltip\": true,\n \"tooltip-orientation-top\": this.orientation === `top`,\n \"tooltip-orientation-bottom\": this.orientation === `bottom`,\n \"tooltip-orientation-right\": this.orientation === `right`,\n \"tooltip-orientation-left\": this.orientation === `left`,\n \"tooltip-type-text\": true,\n \"tooltip-type-number\": false,\n \"tooltip-style-bubble\": true,\n };\n let value = ``;\n switch (typeof this.value) {\n case `number`:\n classes[`tooltip-type-number`] = true;\n value = this.valueFormatTooltip(this.value);\n break;\n case `string`:\n if (isNumeric(this.value)) {\n classes[`tooltip-type-number`] = true;\n value = this.valueFormatTooltip(Number.parseFloat(this.value));\n } else {\n value = this.value;\n }\n break;\n default:\n value = JSON.stringify(this.value);\n }\n return html`<output style=\"--anchor-id: ${this.anchor}\" class=${classMap(classes)}>${this.#renderIcon()}${value}</output>`;\n }\n\n protected createRenderRoot() {\n return this;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"ixfx-tooltip\": TooltipElement;\n }\n}\n","/**\n * Shared utilities for SVG-based plot components.\n */\nimport type { TooltipElement } from '../util/tooltip.js';\nimport '../util/tooltip.js';\n\n// --- Tooltip singleton ---\n\nlet _tooltipEl: HTMLDivElement | null = null;\nlet _tooltipOwner: Element | null = null;\n\nfunction ensureTooltip(): HTMLDivElement {\n if (_tooltipEl)\n return _tooltipEl;\n const el = document.createElement(`div`);\n el.style.cssText = `\n position: fixed;\n pointer-events: none;\n z-index: 9999;\n background: var(--surface-5);\n color: var(--surface-5-text);\n border: var(--border);\n border-radius: var(--radius-l, 6px);\n box-shadow: var(--shadow-m);\n padding: 2px 6px;\n font-size: 10px;\n font-family: ui-monospace, monospace;\n opacity: 0;\n transition: opacity 0.1s ease;\n `;\n document.body.appendChild(el);\n _tooltipEl = el;\n return el;\n}\n\nexport function showTooltip(owner: Element, clientX: number, clientY: number, text: string): void {\n const el = ensureTooltip();\n _tooltipOwner = owner;\n el.textContent = text;\n el.style.whiteSpace = `nowrap`;\n el.style.left = `${clientX + 14}px`;\n el.style.top = `${clientY + 14}px`;\n el.style.opacity = `1`;\n}\n\nexport function showTooltipHTML(owner: Element, clientX: number, clientY: number, html: string): void {\n const el = ensureTooltip();\n _tooltipOwner = owner;\n el.innerHTML = html;\n el.style.whiteSpace = `normal`;\n el.style.left = `${clientX + 14}px`;\n el.style.top = `${clientY + 14}px`;\n el.style.opacity = `1`;\n}\n\nexport function hideTooltip(owner: Element): void {\n if (_tooltipOwner !== owner)\n return;\n const el = ensureTooltip();\n el.style.opacity = `0`;\n _tooltipOwner = null;\n}\n\n// --- Bar/segment bubble tooltip (ixfx-tooltip based) ---\n//\n// Unlike showTooltip() above (which tracks the cursor directly), this variant is meant\n// for discrete hover targets (e.g. histogram buckets): the caller decides *when* to\n// (re)position it (typically only on a hovered-index change, not on every pointermove),\n// and where along the cross-axis it should sit (typically cursor-relative, captured once).\n\nlet _bubbleEl: TooltipElement | null = null;\nlet _bubbleOwner: Element | null = null;\n\n// Visual chrome (background/border/radius/shadow/padding/font) is intrinsic to `ixfx-tooltip`\n// itself (see ensureBaseTooltipStyles() in util/tooltip.ts) - only positioning/animation is set here.\nfunction ensureBubble(): TooltipElement {\n if (_bubbleEl)\n return _bubbleEl;\n const el = document.createElement(`ixfx-tooltip`) as TooltipElement;\n el.style.cssText = `\n position: fixed;\n z-index: 9999;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.12s ease;\n `;\n document.body.appendChild(el);\n _bubbleEl = el;\n return el;\n}\n\n/**\n * Shows/repositions an `ixfx-tooltip` bubble.\n * `mainClient` centers the bubble along the given axis (e.g. a bar's midpoint);\n * `crossClient` places it along the other axis (e.g. an offset from the cursor).\n */\nexport function showBubbleTooltip(owner: Element, text: string, mainClient: number, crossClient: number, orientation: `horizontal` | `vertical`): void {\n const el = ensureBubble();\n _bubbleOwner = owner;\n el.value = text;\n if (orientation === `horizontal`) {\n el.style.left = `${mainClient}px`;\n el.style.top = `${crossClient}px`;\n el.style.transform = `translate(-50%, -100%)`;\n } else {\n el.style.left = `${crossClient}px`;\n el.style.top = `${mainClient}px`;\n el.style.transform = `translate(0, -50%)`;\n }\n el.style.opacity = `1`;\n}\n\nexport function hideBubbleTooltip(owner: Element): void {\n if (_bubbleOwner !== owner)\n return;\n const el = ensureBubble();\n el.style.opacity = `0`;\n _bubbleOwner = null;\n}\n\n// --- Sizing helpers ---\n\n/** Stroke width proportional to the smaller dimension of the viewport. */\nexport function adaptiveStroke(width: number, height: number): number {\n return Math.max(1, Math.min(width, height) / 25);\n}\n\n/** Dot radius based on available space per data point and viewport height. */\nexport function adaptiveRadius(width: number, height: number, dataLength: number): number {\n if (dataLength === 0)\n return 3;\n const widthPerPoint = width / dataLength;\n return Math.max(1.5, Math.min(widthPerPoint * 0.45, height * 0.2, 8));\n}\n\n// --- Value scaling ---\n\n/** Normalize a value from [min, max] to [0, 1]. Returns 0.5 if range is zero. */\nexport function scaleValue(v: number, min: number, max: number): number {\n const range = max - min;\n return range === 0 ? 0.5 : (v - min) / range;\n}\n","import type { PlotSingleAxis, PlotSingleAxisPointerMoveDetail } from './single-axis.js';\nimport { css, html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { safeCustomElement as customElement } from '../util/custom-elements.js';\nimport { hideTooltip, showTooltipHTML } from './svg-utils.js';\n\nexport type PlotMultiAxisLayout = `overlap` | `horizontal` | `vertical` | `grid`;\n\nexport type PlotMultiAxisDataPointClickDetail = {\n readonly value: number;\n readonly index: number;\n readonly series: string;\n};\n\nexport type PlotMultiAxisDataPointClickEvent = CustomEvent<PlotMultiAxisDataPointClickDetail>;\n\nexport interface PlotMultiAxisElementEventMap {\n 'plot-datapoint-click': PlotMultiAxisDataPointClickEvent;\n}\n\nconst PLOT_PALETTE = [\n `oklch(60% 0.15 30)`,\n `oklch(60% 0.15 90)`,\n `oklch(60% 0.15 150)`,\n `oklch(60% 0.15 210)`,\n `oklch(60% 0.15 270)`,\n `oklch(60% 0.15 330)`,\n `oklch(60% 0.15 60)`,\n `oklch(60% 0.15 180)`,\n];\n\n@customElement(`ixfx-plot-multi-axis`)\n// eslint-disable-next-line ts/no-unsafe-declaration-merging\nexport class PlotMultiAxis extends LitElement {\n @property() layout: PlotMultiAxisLayout = `overlap`;\n\n @property({ attribute: `grid-min-width`, type: Number })\n gridMinWidth = 200;\n\n /** Override to customize tooltip value display. */\n valueFormat: (v: number | undefined) => string = v => v ? v.toFixed(2) : ``;\n\n #instances = new Map<string, PlotSingleAxis>();\n #seriesOrder: string[] = [];\n #seriesSet = new Set<string>();\n #pendingStyles = new Map<string, Record<string, string>>();\n\n /**\n * Adds a single data point\n * @param name Series name\n * @param value Value\n * @param witholdRedraw If _false_ (default) plot is automatically redrawn\n */\n addData(name: string, value: number, witholdRedraw = false): PlotSingleAxis {\n const el = this.#addToSeries(name, value, witholdRedraw);\n // if (witholdRedraw)\n // return el;\n // this.requestUpdate();\n // this.redraw();\n return el;\n }\n\n setData(name: string, values: number[], witholdRedraw = false): PlotSingleAxis {\n const [el, created] = this.#ensurePlot(name);\n if (!this.#seriesSet.has(name)) {\n this.#seriesSet.add(name);\n this.#seriesOrder.push(name);\n }\n el.set(values, witholdRedraw);\n // if (witholdRedraw)\n // return el;\n if (created)\n this.requestUpdate();\n return el;\n }\n\n setObjects(data: Record<string, number[]>, witholdRedraw = false): void {\n const entries = Object.entries(data);\n for (const [name, vals] of entries) {\n this.setData(name, vals, true);\n }\n if (witholdRedraw)\n return;\n // this.requestUpdate();\n this.redraw();\n }\n\n /**\n * Calls redraw() on all subplots.\n */\n redraw(): void {\n for (const el of this.#instances.values()) {\n el.redraw();\n }\n }\n\n /**\n * Adds a record of data points to the plot. Each key in the record corresponds to a series name, and its value is added as a data point to that series. If a series does not exist for a given key, it will be created.\n * @param data Data to add\n * @param witholdRedraw If _false_ (default) plot is automatically redrawn after adding the data. If _true_, plot is not redrawn automatically, and you need to call `redraw()` manually to update the plot after adding the data.\n */\n addObject(data: Record<string, number | number[]>, witholdRedraw = false): void {\n const entries = Object.entries(data);\n for (const [name, val] of entries) {\n this.#addToSeries(name, val, true);\n }\n if (witholdRedraw)\n return;\n // this.requestUpdate();\n this.redraw();\n }\n\n /**\n * Styles a series by setting CSS variables on the subplot.\n * @param name Name of series\n * @param styles Styles to apply\n */\n styleSeries(name: string, styles: Record<string, string>): void {\n const normalised: Record<string, string> = {};\n for (const [key, val] of Object.entries(styles)) {\n normalised[key.startsWith(`--`) ? key : `--${key}`] = val;\n }\n\n const el = this.#instances.get(name);\n if (!el) {\n this.#pendingStyles.set(name, normalised);\n return;\n }\n for (const [key, val] of Object.entries(normalised)) {\n el.style.setProperty(key, val);\n }\n }\n\n /**\n * Clears data from all sub-plots\n * @returns _True_ if there was data to clear\n */\n clear(): boolean {\n let cleared = false;\n for (const el of this.#instances.values()) {\n cleared = cleared || el.clear();\n }\n return cleared;\n }\n\n /**\n * Clears data from a given series\n * @param name Series name\n * @returns _True_ if series was found and had data\n */\n clearSeries(name: string): boolean {\n const el = this.#instances.get(name);\n if (el) {\n el.clear();\n return true;\n }\n return false;\n }\n\n /**\n * Returns a copy of the series names\n */\n get series(): string[] {\n return [...this.#seriesOrder];\n }\n\n #addToSeries(name: string, valueOrValues: number[] | number, withholdRedraw = false): PlotSingleAxis {\n const [el, created] = this.#ensurePlot(name);\n\n if (!this.#seriesSet.has(name)) {\n this.#seriesSet.add(name);\n this.#seriesOrder.push(name);\n }\n\n el.add(valueOrValues, withholdRedraw);\n if (created)\n this.requestUpdate();\n return el;\n }\n\n #ensurePlot(name: string): [el: PlotSingleAxis, created: boolean] {\n let el = this.#instances.get(name);\n if (el)\n return [el, false];\n\n el = document.createElement(`ixfx-plot-single-axis`) as PlotSingleAxis;\n el.tooltips = false;\n this.#instances.set(name, el);\n\n const colorIndex = this.#instances.size % PLOT_PALETTE.length;\n el.style.setProperty(`--plot-color`, PLOT_PALETTE[colorIndex]);\n\n const pending = this.#pendingStyles.get(name);\n if (pending) {\n for (const [key, val] of Object.entries(pending)) {\n el.style.setProperty(key, val);\n }\n this.#pendingStyles.delete(name);\n }\n\n el.addEventListener(`plot-datapoint-click`, (e: Event) => {\n const ce = e as CustomEvent<{ value: number; index: number }>;\n this.dispatchEvent(\n new CustomEvent<PlotMultiAxisDataPointClickDetail>(`plot-datapoint-click`, {\n detail: { ...ce.detail, series: name },\n bubbles: true,\n composed: true,\n }),\n );\n });\n\n el.addEventListener(`plot-pointer-move`, (e: Event) => {\n const ce = e as CustomEvent<PlotSingleAxisPointerMoveDetail>;\n this.#onSubPlotPointerMove(ce.detail.clientX, ce.detail.clientY, ce.detail.index);\n });\n\n el.addEventListener(`plot-pointer-leave`, () => {\n this.#onSubPlotPointerLeave();\n });\n\n return [el, true];\n }\n\n #onSubPlotPointerMove(clientX: number, clientY: number, index: number): void {\n if (index < 0) {\n hideTooltip(this);\n return;\n }\n\n const parts: string[] = [];\n for (const [name, inst] of this.#instances) {\n const val = inst.getValueAt(index);\n if (val === undefined)\n continue;\n const color = getComputedStyle(inst).getPropertyValue(`--plot-color`).trim();\n parts.push(`<span style=\"color:${color}\">${this.#escapeHTML(name)}</span> ${this.valueFormat(val)}`);\n }\n\n if (parts.length === 0) {\n hideTooltip(this);\n return;\n }\n\n showTooltipHTML(this, clientX, clientY, parts.join(`<br>`));\n }\n\n #onSubPlotPointerLeave(): void {\n hideTooltip(this);\n }\n\n #escapeHTML(s: string): string {\n return s.replace(/&/g, `&`).replace(/</g, `<`).replace(/>/g, `>`).replace(/\"/g, `"`);\n }\n\n protected override render() {\n const gridStyle = this.layout === `grid` ? `--grid-min-width: ${this.gridMinWidth}px` : ``;\n\n return html`\n <div\n id=\"container\"\n class=\"layout layout-${this.layout}\"\n part=\"container\"\n style=${gridStyle}\n >\n ${repeat(\n this.#seriesOrder,\n name => name,\n name => this.#ensurePlot(name)[0],\n )}\n </div>\n `;\n }\n\n static override styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n min-height: 40px;\n --plot-color: var(--accent);\n }\n\n #container {\n width: 100%;\n height: 100%;\n }\n\n #container.layout-overlap {\n display: grid;\n }\n #container.layout-overlap > * {\n grid-area: 1 / 1;\n background: transparent;\n }\n\n #container.layout-horizontal {\n display: flex;\n flex-direction: row;\n gap: var(--space-s, 4px);\n }\n #container.layout-horizontal > * {\n flex: 1;\n min-width: 0;\n }\n\n #container.layout-vertical {\n display: flex;\n flex-direction: column;\n gap: var(--space-s, 4px);\n }\n #container.layout-vertical > * {\n flex: 1;\n min-height: 0;\n }\n\n #container.layout-grid {\n display: grid;\n grid-template-columns: repeat(auto-fill, minmax(var(--grid-min-width, 200px), 1fr));\n gap: var(--space-s, 4px);\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ixfx-plot-multi-axis': PlotMultiAxis;\n }\n}\n\n// eslint-disable-next-line ts/no-unsafe-declaration-merging\nexport interface PlotMultiAxis {\n addEventListener: {\n <K extends keyof PlotMultiAxisElementEventMap>(\n type: K,\n listener: (this: PlotMultiAxis, event: PlotMultiAxisElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n (\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n };\n}\n","/* eslint-disable ts/no-unsafe-declaration-merging */\nimport type { PropertyValues } from 'lit';\nimport { css, html, LitElement, svg } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { safeCustomElement as customElement } from '../util/custom-elements.js';\nimport { PlotDataSeries } from './data.js';\nimport { hideBubbleTooltip, showBubbleTooltip } from './svg-utils.js';\n\nexport type PlotHistogramOrientation = `horizontal` | `vertical`;\n\n/**\n * - `hover`: floating `ixfx-tooltip` bubble, shown/hidden with a debounce delay.\n * - `inline`: the title overlay-text switches to the hovered bucket's value, instantly.\n * - `none`: no hover feedback.\n */\nexport type PlotHistogramValueTooltips = `hover` | `inline` | `none`;\n\nexport type PlotHistogramBucketClickDetail = {\n readonly bucketIndex: number;\n readonly valueMin: number;\n readonly valueMax: number;\n readonly relativeValue: number;\n};\n\nexport type PlotHistogramBucketClickEvent = CustomEvent<PlotHistogramBucketClickDetail>;\n\nexport interface PlotHistogramElementEventMap {\n 'plot-bucket-click': PlotHistogramBucketClickEvent;\n}\n\ntype BarLayout = {\n count: number;\n valueMin: number;\n valueMax: number;\n relativeValue: number;\n x: number;\n y: number;\n width: number;\n height: number;\n};\n\n@customElement(`ixfx-plot-histogram`)\nexport class PlotHistogram extends LitElement {\n @property({ attribute: `orientation` })\n orientation: PlotHistogramOrientation = `horizontal`;\n\n @property({ type: Number })\n resolution = 0.1;\n\n @property({ type: Number })\n min?: number;\n\n @property({ type: Number })\n max?: number;\n\n @property({ type: Number })\n capacity = 100;\n\n /**\n * Fallback overlay-text, shown when nothing is hovered.\n * Not reflected to the native `title` attribute, so the browser's own hover tooltip doesn't show.\n */\n @property({ attribute: false })\n title = ``;\n\n @property({ type: Boolean, reflect: true })\n paused = false;\n\n /** How hovering a bucket is communicated: a floating tooltip, the inline overlay-text, or nothing. */\n @property({ attribute: `value-tooltips` })\n valueTooltips: PlotHistogramValueTooltips = `hover`;\n\n /** Delay (ms) before the `hover` tooltip appears/disappears. Switching directly between buckets is instant. */\n @property({ type: Number, attribute: `tooltip-delay` })\n tooltipDelay = 400;\n\n /** Max rate (ms) at which an already-shown value display refreshes to match live-changing bucket data. */\n @property({ type: Number, attribute: `value-update-interval` })\n valueUpdateInterval = 500;\n\n /** Override to customize the value/frequency label used by the tooltip and overlay text. */\n valueFormat: (valueMin: number, valueMax: number, frequency: number) => string\n = (valueMin, valueMax, frequency) => `${valueMin.toFixed(2)} - ${valueMax.toFixed(2)}: ${frequency}`;\n\n @state() private _width = 100;\n @state() private _height = 40;\n @state() private _hoveredIndex: number | null = null;\n @state() private _inlineOverlayText: string | null = null;\n\n #series = new PlotDataSeries({ capacityLimit: 100, persistentScaling: true });\n #hasProgrammaticData = false;\n\n #parseDeclarativeData(text: string): number[] {\n if (!text)\n return [];\n const tokens = text.trim().split(/[,\\s;]+/);\n return tokens.map(t => Number.parseFloat(t)).filter(n => !Number.isNaN(n));\n }\n\n add(v: number): void {\n this.#hasProgrammaticData = true;\n this.#series.add(v);\n if (this.paused)\n return;\n this.requestUpdate();\n }\n\n set(values: number[]): void {\n this.#hasProgrammaticData = true;\n this.#series.set(values);\n if (this.paused)\n return;\n this.requestUpdate();\n }\n\n clear(): void {\n this.#series.clear();\n this.requestUpdate();\n }\n\n protected override firstUpdated(_changed: PropertyValues): void {\n this._width = this.clientWidth || 100;\n this._height = this.clientHeight || 40;\n const ro = new ResizeObserver((entries) => {\n const e = entries[0];\n this._width = e.contentRect.width;\n this._height = e.contentRect.height;\n });\n ro.observe(this);\n\n if (!this.#hasProgrammaticData) {\n const data = this.#parseDeclarativeData(this.textContent ?? ``);\n if (data.length > 0) {\n this.#series.set(data);\n }\n }\n\n // `title` is a standard global HTML attribute the browser uses for its own native hover\n // tooltip. Read any declarative value into our (attribute-less) property, then strip the\n // attribute so only our overlay-text/tooltip UI reacts to hover, not the browser's.\n const declaredTitle = this.getAttribute(`title`);\n if (declaredTitle !== null) {\n this.title = declaredTitle;\n this.removeAttribute(`title`);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(`capacity`)) {\n const old = [...this.#series.values];\n this.#series = new PlotDataSeries({\n capacityLimit: this.capacity,\n persistentScaling: true,\n });\n if (old.length > 0)\n this.#series.set(old);\n }\n if (changed.has(`valueTooltips`))\n this.#resetHoverState();\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.#resetHoverState();\n }\n\n #readCssVar(name: string): string {\n return getComputedStyle(this).getPropertyValue(name).trim();\n }\n\n #getGapPx(): number {\n const val = this.#readCssVar(`--plot-histogram-gap`);\n if (val === ``)\n return 1;\n const parsed = Number.parseFloat(val);\n return Number.isFinite(parsed) ? Math.max(0, parsed) : 1;\n }\n\n #getBarLengthOverride(): number | null {\n const val = this.#readCssVar(`--plot-histogram-bar-length`);\n if (val === `` || val === `auto`)\n return null;\n const parsed = Number.parseFloat(val);\n return Number.isFinite(parsed) ? Math.max(0, Math.min(1, parsed)) : null;\n }\n\n #emitClick(i: number, valueMin: number, valueMax: number, relativeValue: number): void {\n this.dispatchEvent(\n new CustomEvent<PlotHistogramBucketClickDetail>(`plot-bucket-click`, {\n detail: { bucketIndex: i, valueMin, valueMax, relativeValue },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n /** Bucket layout + counts, shared by render() and pointer hit-testing. */\n #computeGeometry() {\n const { values, range } = this.#series;\n const w = this._width;\n const h = this._height;\n const isHorizontal = this.orientation === `horizontal`;\n const padding = Math.min(4, (isHorizontal ? h : w) * 0.05);\n\n const dataMin = this.min ?? range.min;\n const dataMax = this.max ?? range.max;\n const dataSpan = dataMax - dataMin || 1;\n\n const bucketCount = Math.max(1, Math.floor(1 / this.resolution));\n\n const availableMain = (isHorizontal ? w : h) - padding * 2;\n const availableCross = (isHorizontal ? h : w) - padding * 2;\n\n const buckets: number[] = Array.from({ length: bucketCount }).fill(0) as number[];\n for (const v of values) {\n const normalized = (v - dataMin) / dataSpan;\n const index = Math.min(bucketCount - 1, Math.max(0, Math.floor(normalized * bucketCount)));\n buckets[index]++;\n }\n\n return { w, h, isHorizontal, padding, dataMin, dataMax, dataSpan, bucketCount, availableMain, availableCross, buckets };\n }\n\n /** Per-bucket rect geometry (SVG pixel coords) + value/count, shared by render() and pointer hit-testing. */\n #computeBars(): BarLayout[] {\n const { isHorizontal, padding, dataMin, dataSpan, bucketCount, availableMain, availableCross, buckets } = this.#computeGeometry();\n const bucketSize = availableMain / bucketCount;\n const gap = this.#getGapPx();\n const barLengthOverride = this.#getBarLengthOverride();\n const maxCount = Math.max(1, ...buckets);\n\n return buckets.map((count, i) => {\n const relativeValue = count / maxCount;\n const barLen = barLengthOverride !== null\n ? barLengthOverride * availableCross\n : relativeValue * availableCross;\n\n const valueMin = dataMin + (i / bucketCount) * dataSpan;\n const valueMax = dataMin + ((i + 1) / bucketCount) * dataSpan;\n\n if (isHorizontal) {\n const x = padding + i * bucketSize;\n const width = i === bucketCount - 1\n ? Math.max(0, padding + availableMain - x)\n : Math.max(0, bucketSize - gap);\n const y = padding + availableCross - barLen;\n return { count, valueMin, valueMax, relativeValue, x, y, width, height: barLen };\n } else {\n const y = padding + i * bucketSize;\n const height = i === bucketCount - 1\n ? Math.max(0, padding + availableMain - y)\n : Math.max(0, bucketSize - gap);\n return { count, valueMin, valueMax, relativeValue, x: padding, y, width: barLen, height };\n }\n });\n }\n\n /** Index of the bar rect under the pointer, or -1 if none (matches click hit-testing). */\n #bucketIndexFromPointer(clientX: number, clientY: number): number {\n const rect = this.getBoundingClientRect();\n const x = clientX - rect.left;\n const y = clientY - rect.top;\n return this.#computeBars().findIndex(b => x >= b.x && x <= b.x + b.width && y >= b.y && y <= b.y + b.height);\n }\n\n // --- Hover state (drives both the `inline` overlay-text and the `hover` bubble tooltip) ---\n\n #tooltipIndex: number | null = null;\n #tooltipVisible = false;\n #tooltipShowTimer: number | null = null;\n #tooltipHideTimer: number | null = null;\n #tooltipPosition: { mainClient: number; crossClient: number } | null = null;\n #valueRefreshTimer: number | null = null;\n\n #clearValueRefreshTimer(): void {\n if (this.#valueRefreshTimer !== null) {\n clearTimeout(this.#valueRefreshTimer);\n this.#valueRefreshTimer = null;\n }\n }\n\n /** While a bucket stays hovered, re-invoke `tick` at most every `valueUpdateInterval` ms, so a live-streaming bucket's displayed value stays fresh without updating on every single data point. */\n #scheduleValueRefresh(tick: () => void): void {\n this.#clearValueRefreshTimer();\n this.#valueRefreshTimer = window.setTimeout(() => {\n this.#valueRefreshTimer = null;\n tick();\n this.#scheduleValueRefresh(tick);\n }, this.valueUpdateInterval);\n }\n\n #clearBubbleTooltip(): void {\n if (this.#tooltipShowTimer !== null) {\n clearTimeout(this.#tooltipShowTimer);\n this.#tooltipShowTimer = null;\n }\n if (this.#tooltipHideTimer !== null) {\n clearTimeout(this.#tooltipHideTimer);\n this.#tooltipHideTimer = null;\n }\n if (this.#tooltipVisible) {\n this.#tooltipVisible = false;\n hideBubbleTooltip(this);\n }\n this.#tooltipIndex = null;\n this.#tooltipPosition = null;\n }\n\n #resetHoverState(): void {\n this.#clearValueRefreshTimer();\n this.#clearBubbleTooltip();\n this._hoveredIndex = null;\n this._inlineOverlayText = null;\n }\n\n /** Bubble position: centred on the bar along the bucket axis, offset from the cursor on the other axis. */\n #tooltipPositionFor(bar: BarLayout, clientX: number, clientY: number): { mainClient: number; crossClient: number } {\n const hostRect = this.getBoundingClientRect();\n const offset = 14;\n if (this.orientation === `horizontal`) {\n return { mainClient: hostRect.left + bar.x + bar.width / 2, crossClient: clientY - offset };\n }\n return { mainClient: hostRect.top + bar.y + bar.height / 2, crossClient: clientX + offset };\n }\n\n #refreshBubbleText(): void {\n if (this.#tooltipIndex === null || !this.#tooltipVisible || !this.#tooltipPosition)\n return;\n const bar = this.#computeBars()[this.#tooltipIndex];\n if (!bar)\n return;\n const text = this.valueFormat(bar.valueMin, bar.valueMax, bar.count);\n showBubbleTooltip(this, text, this.#tooltipPosition.mainClient, this.#tooltipPosition.crossClient, this.orientation);\n }\n\n /**\n * Drives the floating bubble tooltip. Only reacts to the hovered bucket *changing*\n * (not every pointermove), so the tooltip doesn't track minor cursor movement.\n * Debounces the initial show and the final hide; switching between buckets while\n * already visible updates instantly. While a bucket stays hovered, its displayed\n * value is refreshed at `valueUpdateInterval`.\n */\n #updateBubbleTooltip(index: number | null, clientX: number, clientY: number): void {\n if (index === this.#tooltipIndex)\n return;\n this.#tooltipIndex = index;\n this.#clearValueRefreshTimer();\n\n if (index === null) {\n if (this.#tooltipShowTimer !== null) {\n clearTimeout(this.#tooltipShowTimer);\n this.#tooltipShowTimer = null;\n }\n if (this.#tooltipVisible) {\n this.#tooltipHideTimer = window.setTimeout(() => {\n this.#tooltipHideTimer = null;\n this.#tooltipVisible = false;\n this.#tooltipPosition = null;\n hideBubbleTooltip(this);\n }, this.tooltipDelay);\n }\n return;\n }\n\n if (this.#tooltipHideTimer !== null) {\n clearTimeout(this.#tooltipHideTimer);\n this.#tooltipHideTimer = null;\n }\n\n const bar = this.#computeBars()[index];\n if (!bar)\n return;\n const text = this.valueFormat(bar.valueMin, bar.valueMax, bar.count);\n const position = this.#tooltipPositionFor(bar, clientX, clientY);\n this.#tooltipPosition = position;\n\n if (this.#tooltipVisible) {\n showBubbleTooltip(this, text, position.mainClient, position.crossClient, this.orientation);\n this.#scheduleValueRefresh(() => this.#refreshBubbleText());\n return;\n }\n\n if (this.#tooltipShowTimer !== null)\n clearTimeout(this.#tooltipShowTimer);\n this.#tooltipShowTimer = window.setTimeout(() => {\n this.#tooltipShowTimer = null;\n this.#tooltipVisible = true;\n showBubbleTooltip(this, text, position.mainClient, position.crossClient, this.orientation);\n this.#scheduleValueRefresh(() => this.#refreshBubbleText());\n }, this.tooltipDelay);\n }\n\n #formatBarAt(index: number): string | null {\n const bar = this.#computeBars()[index];\n return bar ? this.valueFormat(bar.valueMin, bar.valueMax, bar.count) : null;\n }\n\n /**\n * Drives the `inline` overlay-text: instant on hover change, throttled while stationary\n * over a live-changing bucket. `_inlineOverlayText` is cached reactive state rather than\n * being recomputed fresh in render() on every data change, since add()/set() trigger their\n * own re-render independent of the throttle timer.\n */\n #setInlineIndex(index: number | null): void {\n if (index === this._hoveredIndex)\n return;\n this._hoveredIndex = index;\n this.#clearValueRefreshTimer();\n if (index === null) {\n this._inlineOverlayText = null;\n return;\n }\n this._inlineOverlayText = this.#formatBarAt(index);\n this.#scheduleValueRefresh(() => {\n if (this._hoveredIndex !== null)\n this._inlineOverlayText = this.#formatBarAt(this._hoveredIndex);\n });\n }\n\n #onPointerMove = (e: PointerEvent): void => {\n if (this.valueTooltips === `none`)\n return;\n const index = this.#bucketIndexFromPointer(e.clientX, e.clientY);\n const bucketIndex = index >= 0 ? index : null;\n\n if (this.valueTooltips === `inline`)\n this.#setInlineIndex(bucketIndex);\n else\n this.#updateBubbleTooltip(bucketIndex, e.clientX, e.clientY);\n };\n\n #onPointerLeave = (): void => {\n if (this.valueTooltips === `none`)\n return;\n if (this.valueTooltips === `inline`)\n this.#setInlineIndex(null);\n else\n this.#updateBubbleTooltip(null, 0, 0);\n };\n\n override render() {\n const { w, h, padding } = this.#computeGeometry();\n const bars = this.#computeBars();\n\n const barsContent = bars.map((b, i) => svg`\n <rect class=\"bar\" x=${b.x} y=${b.y} width=${b.width} height=${b.height}\n style=\"--value: ${b.relativeValue}\"\n @click=${() => this.#emitClick(i, b.valueMin, b.valueMax, b.relativeValue)} />\n `);\n\n const textColor = `var(--plot-text, var(--surface-2-text, #fff))`;\n const overlayText = (this.valueTooltips === `inline` && this._inlineOverlayText !== null) ? this._inlineOverlayText : this.title;\n const titleContent = overlayText\n ? svg`<text x=${padding + 2} y=${padding + Math.min(10, h * 0.6)}\n class=\"overlay-text\" fill=${textColor}\n style=\"opacity: 0.6\">${overlayText}</text>`\n : svg``;\n\n return html`\n <svg width=${w} height=${h} viewBox=\"0 0 ${w} ${h}\"\n xmlns=\"http://www.w3.org/2000/svg\"\n @pointermove=${this.#onPointerMove}\n @pointerleave=${this.#onPointerLeave}>\n <rect width=${w} height=${h} fill=\"transparent\" />\n ${barsContent}\n ${titleContent}\n </svg>\n `;\n }\n\n static override styles = css`\n :host {\n display: inline-block;\n width: 100%;\n height: 100%;\n min-width: 20px;\n min-height: 20px;\n\n --plot-histogram-fill: currentColor;\n --plot-histogram-gap: 1px;\n --plot-histogram-border-radius: 0;\n --plot-histogram-bar-length: auto;\n }\n\n svg {\n display: block;\n cursor: crosshair;\n overflow: visible;\n }\n\n rect.bar {\n fill: var(--plot-histogram-fill, currentColor);\n rx: var(--plot-histogram-border-radius, 0);\n opacity: calc(0.15 + var(--value) * 0.85);\n }\n\n .overlay-text {\n font-family: var(--font-mono, ui-monospace, monospace);\n font-size: 9px;\n dominant-baseline: hanging;\n pointer-events: none;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ixfx-plot-histogram': PlotHistogram;\n }\n}\n\nexport interface PlotHistogram {\n addEventListener: (<K extends keyof PlotHistogramElementEventMap>(\n type: K,\n listener: (this: PlotHistogram, event: PlotHistogramElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ) => void) & ((\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ) => void);\n}\n","import type { PropertyValues, SVGTemplateResult } from 'lit';\nimport type { ColourMode, ColourResult } from './colour-map.js';\nimport { clamp } from '@ixfx/numbers';\nimport { css, html, LitElement, svg } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { safeCustomElement as customElement } from '../util/custom-elements.js';\nimport { applyAgeModification, computeColour, parseColourScaleAttr, readBaseColour } from './colour-map.js';\nimport { PlotDataSeries } from './data.js';\nimport { adaptiveRadius, adaptiveStroke, hideTooltip, scaleValue, showTooltip } from './svg-utils.js';\n\nexport type SingleAxisDrawStyle\n = | `line-sharp`\n | `line-round`\n | `circles`\n | `squares`\n | `vbar`\n | `hbar`\n | `hist-bottom`\n | `hist-top`\n | `hist-middle`;\n\nexport type SingleAxisAgeStyle = `none` | `opacity` | `desaturation` | `size`;\n\ntype PlotPoint = { x: number; y: number; value: number; scaledValue: number; index: number; ageFraction: number };\n\n// --- Pure SVG fragment renderers ---\n// Lines use a single ColourResult (the last / most-recent point's colour).\n// Per-point styles use a ColourResult[] aligned with the points array.\n\nfunction buildLinePath(points: PlotPoint[]): string {\n if (points.length === 0)\n return ``;\n let d = `M ${points[0].x},${points[0].y}`;\n for (let i = 1; i < points.length; i++) {\n d += ` L ${points[i].x},${points[i].y}`;\n }\n return d;\n}\n\nfunction renderLine(points: PlotPoint[], cr: ColourResult, strokeW: number, round: boolean) {\n return svg`<path\n d=${buildLinePath(points)}\n fill=\"none\"\n stroke=${cr.fill}\n stroke-width=${strokeW}\n opacity=${cr.opacity}\n stroke-linecap=${round ? `round` : `butt`}\n stroke-linejoin=${round ? `round` : `miter`}\n />`;\n}\n\nfunction renderArea(points: PlotPoint[], cr: ColourResult, bottom: number, areaColor?: string): SVGTemplateResult {\n if (points.length < 2)\n return svg``;\n const lineD = buildLinePath(points);\n const fillColor = areaColor || cr.fill;\n const areaD = `${lineD} L ${points[points.length - 1].x},${bottom} L ${points[0].x},${bottom} Z`;\n return svg`<path d=${areaD} fill=${fillColor} opacity=${cr.opacity * 0.2} />`;\n}\n\nfunction renderCircles(points: PlotPoint[], crs: ColourResult[], radius: number, ageStyle: SingleAxisAgeStyle) {\n return points.map((p, i) => {\n const r = ageStyle === `size` ? radius * Math.max(0.2, p.ageFraction) : radius;\n return svg`<circle cx=${p.x} cy=${p.y} r=${r} fill=${crs[i].fill} opacity=${crs[i].opacity} />`;\n });\n}\n\nfunction renderSquares(points: PlotPoint[], crs: ColourResult[], size: number, ageStyle: SingleAxisAgeStyle) {\n return points.map((p, i) => {\n const s = ageStyle === `size` ? size * Math.max(0.2, p.ageFraction) : size;\n return svg`<rect\n x=${p.x - s / 2} y=${p.y - s / 2}\n width=${s} height=${s}\n fill=${crs[i].fill} opacity=${crs[i].opacity}\n />`;\n });\n}\n\nfunction renderVbars(points: PlotPoint[], crs: ColourResult[], strokeW: number, bottom: number, ageStyle: SingleAxisAgeStyle) {\n return points.map((p, i) => {\n const sw = ageStyle === `size` ? strokeW * Math.max(0.2, p.ageFraction) : strokeW;\n return svg`<line\n x1=${p.x} y1=${bottom} x2=${p.x} y2=${p.y}\n stroke=${crs[i].fill} stroke-width=${sw} opacity=${crs[i].opacity}\n />`;\n });\n}\n\nfunction renderHbars(points: PlotPoint[], crs: ColourResult[], strokeW: number, tickLen: number, ageStyle: SingleAxisAgeStyle) {\n return points.map((p, i) => {\n const tl = ageStyle === `size` ? tickLen * Math.max(0.2, p.ageFraction) : tickLen;\n return svg`<line\n x1=${p.x - tl / 2} y1=${p.y} x2=${p.x + tl / 2} y2=${p.y}\n stroke=${crs[i].fill} stroke-width=${strokeW} opacity=${crs[i].opacity}\n />`;\n });\n}\n\nfunction renderHistBottom(points: PlotPoint[], crs: ColourResult[], barW: number, bottom: number, ageStyle: SingleAxisAgeStyle) {\n return points.map((p, i) => {\n const w = ageStyle === `size` ? barW * Math.max(0.2, p.ageFraction) : barW;\n return svg`<rect\n x=${p.x - w / 2} y=${p.y}\n width=${w} height=${Math.max(1, bottom - p.y)}\n fill=${crs[i].fill} opacity=${crs[i].opacity}\n />`;\n });\n}\n\nfunction renderHistTop(points: PlotPoint[], crs: ColourResult[], barW: number, top: number, ageStyle: SingleAxisAgeStyle) {\n return points.map((p, i) => {\n const w = ageStyle === `size` ? barW * Math.max(0.2, p.ageFraction) : barW;\n return svg`<rect\n x=${p.x - w / 2} y=${top}\n width=${w} height=${Math.max(1, p.y - top)}\n fill=${crs[i].fill} opacity=${crs[i].opacity}\n />`;\n });\n}\n\nfunction renderHistMiddle(points: PlotPoint[], crs: ColourResult[], barW: number, mid: number, ageStyle: SingleAxisAgeStyle) {\n return points.map((p, i) => {\n const w = ageStyle === `size` ? barW * Math.max(0.2, p.ageFraction) : barW;\n return svg`<rect\n x=${p.x - w / 2} y=${Math.min(p.y, mid)}\n width=${w} height=${Math.max(1, Math.abs(p.y - mid))}\n fill=${crs[i].fill} opacity=${crs[i].opacity}\n />`;\n });\n}\n\n// --- Component ---\n\n/**\n * PlotSingleAxis\n *\n * Adding data:\n * - add(value: number): adds a single value to the end of the data series.\n * - set(values: number[]): replaces the entire data series at once.\n */\n@customElement(`ixfx-plot-single-axis`)\n// eslint-disable-next-line ts/no-unsafe-declaration-merging\nexport class PlotSingleAxis extends LitElement {\n @property({ attribute: `draw-style` })\n drawStyle: SingleAxisDrawStyle = `line-sharp`;\n\n @property({ attribute: `age-style` })\n ageStyle: SingleAxisAgeStyle = `none`;\n\n @property() title = ``;\n\n @property({ type: Boolean }) precise = false;\n @property({ type: Boolean }) tooltips = true;\n @property({ type: Number }) capacity = 100;\n\n @property({ type: Number }) rangeMin = Number.NaN;\n @property({ type: Number }) rangeMax = Number.NaN;\n\n @property({ type: Boolean, attribute: `persistent-scale` })\n persistentScale = true;\n\n @property({ type: Boolean, reflect: true }) paused = false;\n @property({ type: Boolean, attribute: `click-pauses` }) clickPauses = false;\n\n @property({ type: Boolean, attribute: `shaded` })\n shaded = false;\n\n @property({ attribute: `area-color` })\n areaColor = ``;\n\n // --- Colour mapping ---\n @property({ attribute: `color-mode` }) colorMode: ColourMode = `fixed`;\n @property({ attribute: `color-easing` }) colorEasing = ``;\n @property({ attribute: `color-scale` }) colorScale = ``;\n /** Custom value-mapping function (0..1 → 0..1). Ignored when color-easing is set. */\n colorValueMap: ((v: number) => number) | null = null;\n\n @state() private _width = 100;\n @state() private _height = 40;\n\n #series = new PlotDataSeries();\n #hasProgrammaticData = false;\n #lastClientX: number | null = null;\n #lastClientY: number | null = null;\n\n #parseDeclarativeData(text: string): number[] {\n if (!text)\n return [];\n const tokens = text.trim().split(/[,\\s;]+/);\n return tokens\n .map(t => Number.parseFloat(t))\n .filter(n => !Number.isNaN(n));\n }\n\n /** Override to customize tooltip label. */\n valueFormat: (v: number | undefined) => string = v => v ? v.toFixed(2) : ``;\n\n /**\n * Adds a value to the data series.\n *\n * Pass `withholdRedraw = true` to prevent automatic redraw after adding the value. In this case, call `redraw()` manually after adding all values to update the plot.\n *\n * Use {@link set} to replace the entire data series at once.\n * @param valueOrValues Single value, or several values\n * @param withholdRedraw If _false_ (default) plot is automatically redrawn\n */\n add(valueOrValues: number | number[], withholdRedraw = false): void {\n this.#hasProgrammaticData = true;\n this.#series.add(valueOrValues);\n if (this.paused)\n return;\n if (withholdRedraw)\n return;\n this.redraw();\n }\n\n /**\n * Redraws the plot.\n * Normally not needed, unless add() is called with withholdRedraw = true, or styleSeries() is used to update series styles.\n */\n redraw() {\n this.requestUpdate();\n this.#updateTooltipAtLastPos();\n }\n\n /**\n * Sets the entire data for a series at once, replacing contents.\n *\n * Use add() to add values one by one.\n *\n * Pass `withholdRedraw = true` to prevent automatic redraw after setting the values. In this case, call `redraw()` manually after setting the values to update the plot.\n * @param values Values\n * @param withholdRedraw If _false_ (default) plot is automatically redrawn\n */\n set(values: number[], withholdRedraw = false): void {\n this.#hasProgrammaticData = true;\n this.#series.set(values);\n if (this.paused)\n return;\n if (withholdRedraw)\n return;\n this.redraw();\n }\n\n /**\n * Clears all data and redraws\n */\n clear(): boolean {\n const result = this.#series.clear();\n this.requestUpdate();\n return result;\n }\n\n protected override firstUpdated(_changed: PropertyValues): void {\n this._width = this.clientWidth || 100;\n this._height = this.clientHeight || 40;\n const ro = new ResizeObserver((entries) => {\n const e = entries[0];\n this._width = e.contentRect.width;\n this._height = e.contentRect.height;\n });\n ro.observe(this);\n\n if (!this.#hasProgrammaticData) {\n const data = this.#parseDeclarativeData(this.textContent ?? ``);\n if (data.length > 0) {\n this.#series.set(data);\n }\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(`capacity`) || changed.has(`persistentScale`) || changed.has(`rangeMin`) || changed.has(`rangeMax`)) {\n const old = [...this.#series.values];\n const fixedRange = (!Number.isNaN(this.rangeMin) && !Number.isNaN(this.rangeMax)) ? { min: this.rangeMin, max: this.rangeMax } : null;\n this.#series = new PlotDataSeries({\n capacityLimit: this.capacity,\n persistentScaling: this.persistentScale,\n fixedRange,\n });\n if (old.length > 0)\n this.#series.set(old);\n }\n }\n\n #getIndexFromX(clientX: number, rect: DOMRect): number {\n const n = this.#series.values.length;\n if (n === 0)\n return -1;\n const x = clientX - rect.left;\n if (x < 0 || x > rect.width)\n return -1;\n const padding = rect.height < 20 ? 0 : Math.min(4, rect.height * 0.05);\n const plotW = rect.width - padding * 2;\n const index = Math.floor((x - padding) / (plotW / n));\n return index >= 0 && index < n ? index : -1;\n }\n\n #updateTooltip(clientX: number, clientY: number): void {\n if (!this.tooltips)\n return;\n const rect = this.getBoundingClientRect();\n const index = this.#getIndexFromX(clientX, rect);\n if (index < 0) {\n hideTooltip(this); return;\n }\n showTooltip(this, clientX, clientY, this.valueFormat(this.#series.values[index]));\n }\n\n #updateTooltipAtLastPos(): void {\n if (this.#lastClientX === null || this.#lastClientY === null)\n return;\n this.#updateTooltip(this.#lastClientX, this.#lastClientY);\n }\n\n #onPointerMove = (e: PointerEvent): void => {\n this.#lastClientX = e.clientX;\n this.#lastClientY = e.clientY;\n this.#updateTooltip(e.clientX, e.clientY);\n const index = this.#getIndexFromX(e.clientX, this.getBoundingClientRect());\n this.dispatchEvent(new CustomEvent(`plot-pointer-move`, {\n detail: { clientX: e.clientX, clientY: e.clientY, index },\n bubbles: true,\n composed: true,\n }));\n };\n\n #onPointerLeave = (): void => {\n this.#lastClientX = null;\n this.#lastClientY = null;\n hideTooltip(this);\n this.dispatchEvent(new CustomEvent(`plot-pointer-leave`, {\n bubbles: true,\n composed: true,\n }));\n };\n\n #onClick = (e: MouseEvent): void => {\n if (this.clickPauses)\n this.paused = !this.paused;\n const index = this.#getIndexFromX(e.clientX, this.getBoundingClientRect());\n if (index < 0)\n return;\n this.dispatchEvent(new CustomEvent(`plot-datapoint-click`, {\n detail: { value: this.#series.values[index], index },\n bubbles: true,\n composed: true,\n }));\n };\n\n #computePoints(values: number[], min: number, max: number, padding: number, plotW: number, plotH: number): PlotPoint[] {\n const n = values.length;\n const widthPerPoint = n > 0 ? plotW / n : plotW;\n const scaleX = (i: number) => padding + (i + 0.5) * widthPerPoint;\n return values.map((value, index) => {\n const sv = clamp(scaleValue(value, min, max));\n const ageFraction = n > 1 ? index / (n - 1) : 1;\n return { x: scaleX(index), y: padding + (1 - sv) * plotH, value, scaledValue: sv, index, ageFraction };\n });\n }\n\n get series() {\n return this.#series;\n }\n\n /**\n * Get all values in the data series as a readonly array.\n */\n get values(): readonly number[] {\n return this.#series.values;\n }\n\n /**\n * Get length of data series\n */\n get dataLength(): number {\n return this.#series.values.length;\n }\n\n /**\n * Get value at specific index of data series\n * @param index\n */\n getValueAt(index: number): number | undefined {\n return this.#series.values[index];\n }\n\n /**\n * Get value index based on client X position\n * @param clientX\n */\n getIndexFromClientX(clientX: number): number {\n return this.#getIndexFromX(clientX, this.getBoundingClientRect());\n }\n\n #renderByStyle(\n points: PlotPoint[],\n crs: ColourResult[],\n strokeW: number,\n radius: number,\n barW: number,\n bottom: number,\n top: number,\n mid: number,\n ): SVGTemplateResult[] {\n const lineCr = crs.at(-1) ?? { fill: `currentColor`, opacity: 1 };\n const isLine = this.drawStyle === `line-sharp` || this.drawStyle === `line-round`;\n const needsArea = isLine && this.shaded;\n const areaColor = this.areaColor || undefined;\n\n if (needsArea) {\n const area = renderArea(points, lineCr, bottom, areaColor);\n const line = this.drawStyle === `line-sharp`\n ? renderLine(points, lineCr, strokeW, false)\n : renderLine(points, lineCr, strokeW, true);\n return [area, line];\n }\n\n switch (this.drawStyle) {\n case `line-sharp`: return [renderLine(points, lineCr, strokeW, false)];\n case `line-round`: return [renderLine(points, lineCr, strokeW, true)];\n case `circles`: return renderCircles(points, crs, radius, this.ageStyle);\n case `squares`: return renderSquares(points, crs, radius * 2, this.ageStyle);\n case `vbar`: return renderVbars(points, crs, strokeW, bottom, this.ageStyle);\n case `hbar`: return renderHbars(points, crs, strokeW, barW, this.ageStyle);\n case `hist-bottom`: return renderHistBottom(points, crs, barW, bottom, this.ageStyle);\n case `hist-top`: return renderHistTop(points, crs, barW, top, this.ageStyle);\n case `hist-middle`: return renderHistMiddle(points, crs, barW, mid, this.ageStyle);\n default: return [];\n }\n }\n\n override render() {\n const { values, range } = this.#series;\n const w = this._width;\n const h = this._height;\n const padding = h < 20 ? 0 : Math.min(4, h * 0.05);\n const plotW = Math.max(1, w - padding * 2);\n const plotH = Math.max(1, h - padding * 2);\n const bottom = padding + plotH;\n const top = padding;\n const mid = padding + plotH / 2;\n\n const strokeW = adaptiveStroke(w, h);\n const radius = adaptiveRadius(w, h, values.length);\n const barW = values.length > 0\n ? Math.max(1, (plotW / values.length) * 0.85)\n : plotW;\n\n const textColor = `var(--plot-text, var(--surface-2-text, #fff))`;\n\n const points = values.length > 0\n ? this.#computePoints(values, range.min, range.max, padding, plotW, plotH)\n : [];\n\n // Colour mapping\n const baseColour = points.length > 0 ? readBaseColour(this) : ``;\n const colourConfig = {\n mode: this.colorMode,\n palette: parseColourScaleAttr(this.colorScale),\n easingName: this.colorEasing,\n valueMap: this.colorValueMap,\n };\n const isDiscrete = this.drawStyle !== `line-sharp` && this.drawStyle !== `line-round`;\n const crs: ColourResult[] = points.map((p) => {\n const base = computeColour(p.scaledValue, baseColour, colourConfig);\n return isDiscrete ? applyAgeModification(base, p.ageFraction, this.ageStyle) : base;\n });\n\n const dataContent = points.length > 0\n ? this.#renderByStyle(points, crs, strokeW, radius, barW, bottom, top, mid)\n : [];\n\n const titleContent = this.title\n ? svg`<text\n x=${padding + 2} y=${top + Math.min(10, h * 0.6)}\n class=\"overlay-text\"\n fill=${textColor}\n style=\"opacity: 0.6\"\n >${this.title}</text>`\n : svg``;\n\n const latestValue = values.length > 0 ? values.at(-1) : null;\n const preciseContent = this.precise && latestValue !== null\n ? svg`<text\n x=${w - padding - 2} y=${top + Math.min(10, h * 0.6)}\n class=\"overlay-text\"\n text-anchor=\"end\"\n fill=${textColor}\n style=\"opacity: 0.8\"\n >${this.valueFormat(latestValue)}</text>`\n : svg``;\n\n return html`\n <svg\n width=${w} height=${h}\n viewBox=\"0 0 ${w} ${h}\"\n xmlns=\"http://www.w3.org/2000/svg\"\n @pointermove=${this.#onPointerMove}\n @pointerleave=${this.#onPointerLeave}\n @click=${this.#onClick}\n >\n <rect width=${w} height=${h} fill=\"transparent\" />\n ${dataContent.map(c => c)}\n ${titleContent}\n ${preciseContent}\n </svg>\n `;\n }\n\n static override styles = css`\n :host {\n display: inline-block;\n width: 100%;\n height: 100%;\n min-width: 20px;\n min-height: 4px;\n }\n\n svg {\n display: block;\n cursor: crosshair;\n overflow: visible;\n }\n\n .overlay-text {\n font-family: var(--font-mono, ui-monospace, monospace);\n font-size: 9px;\n dominant-baseline: hanging;\n pointer-events: none;\n }\n `;\n}\n\nexport type PlotSingleAxisPointerMoveDetail = {\n readonly clientX: number;\n readonly clientY: number;\n readonly index: number;\n};\n\nexport type PlotSingleAxisPointerMoveEvent = CustomEvent<PlotSingleAxisPointerMoveDetail>;\n\nexport interface PlotSingleAxisElementEventMap {\n 'plot-pointer-move': PlotSingleAxisPointerMoveEvent;\n 'plot-pointer-leave': Event;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ixfx-plot-single-axis': PlotSingleAxis;\n }\n}\n\n// eslint-disable-next-line ts/no-unsafe-declaration-merging\nexport interface PlotSingleAxis {\n addEventListener: {\n <K extends keyof PlotSingleAxisElementEventMap>(\n type: K,\n listener: (this: PlotSingleAxis, event: PlotSingleAxisElementEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n ): void;\n (\n type: string,\n listener: EventListenerOrEventListenerObject,\n options?: boolean | AddEventListenerOptions,\n ): void;\n };\n}\n","import type { PropertyValues } from 'lit';\nimport type { ColourMode, ColourResult } from './colour-map.js';\nimport { css, html, LitElement, svg } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { safeCustomElement as customElement } from '../util/custom-elements.js';\nimport { applyAgeModification, computeColour, parseColourScaleAttr, readBaseColour } from './colour-map.js';\nimport { PlotDataSeries } from './data.js';\nimport { adaptiveRadius, hideTooltip, scaleValue, showTooltip } from './svg-utils.js';\n\nexport type XyDrawStyle = `circles` | `squares`;\nexport type XyAgeStyle = `none` | `opacity` | `desaturation` | `size`;\n\ntype XyPoint = { x: number; y: number; xVal: number; yVal: number; index: number; ageFraction: number };\n\n// --- Component ---\n\n@customElement(`ixfx-plot-xy-axis`)\nexport class PlotXyAxis extends LitElement {\n @property({ attribute: `draw-style` })\n drawStyle: XyDrawStyle = `circles`;\n\n @property({ attribute: `age-style` })\n ageStyle: XyAgeStyle = `none`;\n\n @property() title = ``;\n @property({ type: Boolean }) precise = false;\n @property({ type: Boolean }) tooltips = true;\n @property({ type: Number }) capacity = 100;\n\n @property({ type: Boolean, attribute: `persistent-scale` })\n persistentScale = true;\n\n @property({ type: Boolean, reflect: true }) paused = false;\n @property({ type: Boolean, attribute: `click-pauses` }) clickPauses = false;\n\n // --- Colour mapping ---\n @property({ attribute: `color-mode` }) colorMode: ColourMode = `fixed`;\n @property({ attribute: `color-easing` }) colorEasing = ``;\n @property({ attribute: `color-scale` }) colorScale = ``;\n /**\n * Custom value-mapping fn (0..1 → 0..1). For xy-axis the input is the point's ageFraction\n * (0 = oldest, 1 = newest). Ignored when color-easing is set.\n */\n colorValueMap: ((v: number) => number) | null = null;\n\n @state() private _width = 100;\n @state() private _height = 100;\n\n #xSeries = new PlotDataSeries({ capacityLimit: 100, persistentScaling: true });\n #ySeries = new PlotDataSeries({ capacityLimit: 100, persistentScaling: true });\n\n /** Override to customize tooltip label. */\n valueFormat: (x: number, y: number) => string = (x, y) => `${x.toFixed(2)}, ${y.toFixed(2)}`;\n\n add(x: number, y: number): void {\n this.#xSeries.add(x);\n this.#ySeries.add(y);\n if (this.paused)\n return;\n this.requestUpdate();\n this.#updateTooltipAtLastPos();\n }\n\n setXY(xs: number[], ys: number[]): void {\n this.#xSeries.set(xs);\n this.#ySeries.set(ys);\n if (this.paused)\n return;\n this.requestUpdate();\n this.#updateTooltipAtLastPos();\n }\n\n clear(): void {\n this.#xSeries.clear();\n this.#ySeries.clear();\n this.requestUpdate();\n }\n\n protected override firstUpdated(_changed: PropertyValues): void {\n this._width = this.clientWidth || 100;\n this._height = this.clientHeight || 100;\n const ro = new ResizeObserver((entries) => {\n const e = entries[0];\n this._width = e.contentRect.width;\n this._height = e.contentRect.height;\n });\n ro.observe(this);\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(`capacity`) || changed.has(`persistentScale`)) {\n const opts = { capacityLimit: this.capacity, persistentScaling: this.persistentScale };\n const oldX = [...this.#xSeries.values];\n const oldY = [...this.#ySeries.values];\n this.#xSeries = new PlotDataSeries(opts);\n this.#ySeries = new PlotDataSeries(opts);\n if (oldX.length > 0) {\n this.#xSeries.set(oldX); this.#ySeries.set(oldY);\n }\n }\n }\n\n #computePoints(padding: number, plotW: number, plotH: number): XyPoint[] {\n const xs = this.#xSeries.values;\n const ys = this.#ySeries.values;\n const n = Math.min(xs.length, ys.length);\n if (n === 0)\n return [];\n\n const { min: xMin, max: xMax } = this.#xSeries.range;\n const { min: yMin, max: yMax } = this.#ySeries.range;\n\n return Array.from({ length: n }, (_, i) => ({\n x: padding + scaleValue(xs[i], xMin, xMax) * plotW,\n y: padding + (1 - scaleValue(ys[i], yMin, yMax)) * plotH,\n xVal: xs[i],\n yVal: ys[i],\n index: i,\n ageFraction: n > 1 ? i / (n - 1) : 1,\n }));\n }\n\n /** Compute the final ColourResult for each xy point: base colour → age modification. */\n #computeColours(points: XyPoint[], baseColour: string): ColourResult[] {\n const config = {\n mode: this.colorMode,\n palette: parseColourScaleAttr(this.colorScale),\n easingName: this.colorEasing,\n valueMap: this.colorValueMap,\n };\n return points.map((p) => {\n const base = computeColour(p.ageFraction, baseColour, config);\n return applyAgeModification(base, p.ageFraction, this.ageStyle);\n });\n }\n\n #findNearestPoint(clientX: number, clientY: number, points: XyPoint[], rect: DOMRect): XyPoint | null {\n const x = clientX - rect.left;\n const y = clientY - rect.top;\n let best: XyPoint | null = null;\n let bestDist = Infinity;\n for (const p of points) {\n const dx = p.x - x;\n const dy = p.y - y;\n const d = dx * dx + dy * dy;\n if (d < bestDist) {\n bestDist = d; best = p;\n }\n }\n return best && Math.sqrt(bestDist) < 30 ? best : null;\n }\n\n #lastPoints: XyPoint[] = [];\n #lastClientX: number | null = null;\n #lastClientY: number | null = null;\n\n #updateTooltip(clientX: number, clientY: number): void {\n if (!this.tooltips)\n return;\n const rect = this.getBoundingClientRect();\n const nearest = this.#findNearestPoint(clientX, clientY, this.#lastPoints, rect);\n if (!nearest) {\n hideTooltip(this); return;\n }\n showTooltip(this, clientX, clientY, this.valueFormat(nearest.xVal, nearest.yVal));\n }\n\n #updateTooltipAtLastPos(): void {\n if (this.#lastClientX === null || this.#lastClientY === null)\n return;\n this.#updateTooltip(this.#lastClientX, this.#lastClientY);\n }\n\n #onPointerMove = (e: PointerEvent): void => {\n this.#lastClientX = e.clientX;\n this.#lastClientY = e.clientY;\n this.#updateTooltip(e.clientX, e.clientY);\n };\n\n #onPointerLeave = (): void => {\n this.#lastClientX = null;\n this.#lastClientY = null;\n hideTooltip(this);\n };\n\n #onClick = (e: MouseEvent): void => {\n if (this.clickPauses)\n this.paused = !this.paused;\n const rect = (e.currentTarget as SVGElement).getBoundingClientRect();\n const nearest = this.#findNearestPoint(e.clientX, e.clientY, this.#lastPoints, rect);\n if (!nearest)\n return;\n this.dispatchEvent(new CustomEvent(`plot-datapoint-click`, {\n detail: { x: nearest.xVal, y: nearest.yVal, index: nearest.index },\n bubbles: true,\n composed: true,\n }));\n };\n\n override render() {\n const w = this._width;\n const h = this._height;\n const padding = Math.min(6, Math.min(w, h) * 0.06);\n const plotW = Math.max(1, w - padding * 2);\n const plotH = Math.max(1, h - padding * 2);\n\n const points = this.#computePoints(padding, plotW, plotH);\n this.#lastPoints = points;\n\n const baseColour = points.length > 0 ? readBaseColour(this) : ``;\n const colours = this.#computeColours(points, baseColour);\n\n const radius = adaptiveRadius(w, h, points.length);\n const textColor = `var(--plot-text, var(--surface-2-text, #fff))`;\n\n const dataContent = points.map((p, i) => {\n const cr = colours[i];\n const sizeFactor = this.ageStyle === `size` ? Math.max(0.2, p.ageFraction) : 1;\n if (this.drawStyle === `circles`) {\n const r = radius * sizeFactor;\n return svg`<circle cx=${p.x} cy=${p.y} r=${r} fill=${cr.fill} opacity=${cr.opacity} />`;\n }\n const s = radius * 2 * sizeFactor;\n return svg`<rect x=${p.x - s / 2} y=${p.y - s / 2} width=${s} height=${s} fill=${cr.fill} opacity=${cr.opacity} />`;\n });\n\n const titleContent = this.title\n ? svg`<text\n x=${padding + 2} y=${padding + 2}\n class=\"overlay-text\"\n fill=${textColor}\n style=\"opacity: 0.6\"\n >${this.title}</text>`\n : svg``;\n\n const n = Math.min(this.#xSeries.values.length, this.#ySeries.values.length);\n const latestX = n > 0 ? this.#xSeries.values[n - 1] : null;\n const latestY = n > 0 ? this.#ySeries.values[n - 1] : null;\n const preciseContent = this.precise && latestX !== null && latestY !== null\n ? svg`<text\n x=${w - padding - 2} y=${padding + 2}\n class=\"overlay-text\"\n text-anchor=\"end\"\n fill=${textColor}\n style=\"opacity: 0.8\"\n >${this.valueFormat(latestX, latestY)}</text>`\n : svg``;\n\n return html`\n <svg\n width=${w} height=${h}\n viewBox=\"0 0 ${w} ${h}\"\n xmlns=\"http://www.w3.org/2000/svg\"\n @pointermove=${this.#onPointerMove}\n @pointerleave=${this.#onPointerLeave}\n @click=${this.#onClick}\n >\n <rect width=${w} height=${h} fill=\"transparent\" />\n ${dataContent}\n ${titleContent}\n ${preciseContent}\n </svg>\n `;\n }\n\n static override styles = css`\n :host {\n display: block;\n width: 100%;\n height: 100%;\n min-width: 40px;\n min-height: 40px;\n }\n\n svg {\n display: block;\n cursor: crosshair;\n }\n\n .overlay-text {\n font-family: var(--font-mono, ui-monospace, monospace);\n font-size: 9px;\n dominant-baseline: hanging;\n pointer-events: none;\n }\n `;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ixfx-plot-xy-axis': PlotXyAxis;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA+BA,MAAM,eAAe;AACrB,MAAM,kBAAk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