@gravionlabs/helix-ui 22.6.0 → 22.8.0

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.
@@ -1,4 +1,5 @@
1
1
  {
2
2
  "module": "../fesm2022/gravionlabs-helix-ui-chart.mjs",
3
- "typings": "../types/gravionlabs-helix-ui-chart.d.ts"
4
- }
3
+ "typings": "../types/gravionlabs-helix-ui-chart.d.ts",
4
+ "types": "../types/gravionlabs-helix-ui-chart.d.ts"
5
+ }
@@ -214,7 +214,7 @@ var HxChart = class HxChart {
214
214
  }
215
215
  static ɵfac = i0.ɵɵngDeclareFactory({
216
216
  minVersion: "12.0.0",
217
- version: "22.2.4",
217
+ version: "22.3.0",
218
218
  ngImport: i0,
219
219
  type: HxChart,
220
220
  deps: [],
@@ -222,7 +222,7 @@ var HxChart = class HxChart {
222
222
  });
223
223
  static ɵcmp = i0.ɵɵngDeclareComponent({
224
224
  minVersion: "17.2.0",
225
- version: "22.2.4",
225
+ version: "22.3.0",
226
226
  type: HxChart,
227
227
  isStandalone: true,
228
228
  selector: "hx-chart",
@@ -308,13 +308,13 @@ var HxChart = class HxChart {
308
308
  isSignal: true
309
309
  }],
310
310
  ngImport: i0,
311
- template: "<div class=\"hx-chart-frame\" [style.width]=\"width() ?? null\" [style.height]=\"height() ?? null\">\n <canvas\n #canvas\n class=\"hx-chart-canvas\"\n role=\"img\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n (click)=\"onClick($event)\"\n ><ng-content select=\"[hxChartFallback]\" /></canvas>\n</div>\n",
311
+ template: "<div class=\"hx-chart-frame\" [style.width]=\"width() ?? null\" [style.height]=\"height() ?? null\">\n <canvas\n #canvas\n class=\"hx-chart-canvas\"\n role=\"img\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n (click)=\"onClick($event)\"\n ><ng-content select=\"[hxChartFallback]\"\n /></canvas>\n</div>\n",
312
312
  changeDetection: i0.ChangeDetectionStrategy.OnPush
313
313
  });
314
314
  };
315
315
  i0.ɵɵngDeclareClassMetadata({
316
316
  minVersion: "12.0.0",
317
- version: "22.2.4",
317
+ version: "22.3.0",
318
318
  ngImport: i0,
319
319
  type: HxChart,
320
320
  decorators: [{
@@ -323,7 +323,7 @@ i0.ɵɵngDeclareClassMetadata({
323
323
  selector: "hx-chart",
324
324
  changeDetection: ChangeDetectionStrategy.OnPush,
325
325
  host: { class: "hx-chart" },
326
- template: "<div class=\"hx-chart-frame\" [style.width]=\"width() ?? null\" [style.height]=\"height() ?? null\">\n <canvas\n #canvas\n class=\"hx-chart-canvas\"\n role=\"img\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n (click)=\"onClick($event)\"\n ><ng-content select=\"[hxChartFallback]\" /></canvas>\n</div>\n"
326
+ template: "<div class=\"hx-chart-frame\" [style.width]=\"width() ?? null\" [style.height]=\"height() ?? null\">\n <canvas\n #canvas\n class=\"hx-chart-canvas\"\n role=\"img\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n (click)=\"onClick($event)\"\n ><ng-content select=\"[hxChartFallback]\"\n /></canvas>\n</div>\n"
327
327
  }]
328
328
  }],
329
329
  ctorParameters: () => [],
@@ -1 +1 @@
1
- {"version":3,"file":"gravionlabs-helix-ui-chart.mjs","names":[],"sources":["../../../projects/ui/chart/chart.ts","../../../projects/ui/chart/chart.html"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n effect,\n InjectionToken,\n inject,\n input,\n NgZone,\n numberAttribute,\n output,\n PLATFORM_ID,\n untracked,\n viewChild,\n} from '@angular/core';\n\nexport type HxChartType =\n | 'bar'\n | 'line'\n | 'scatter'\n | 'bubble'\n | 'pie'\n | 'doughnut'\n | 'polarArea'\n | 'radar';\n\n/** What `(dataSelect)` carries: the click and what chart.js found under it. */\nexport interface HxChartSelectEvent {\n originalEvent: Event;\n /** The nearest element under the pointer (chart.js `{ datasetIndex, index, element }`). */\n element: unknown;\n /** The elements of that dataset. */\n dataset: unknown[];\n}\n\n/** The part of chart.js this component uses; the real module is `chart.js/auto`. */\nexport interface HxChartModule {\n default: new (canvas: HTMLCanvasElement, config: unknown) => HxChartInstance;\n}\n\nexport interface HxChartInstance {\n data: unknown;\n options: unknown;\n update(mode?: string): void;\n destroy(): void;\n getElementsAtEventForMode(\n event: Event,\n mode: string,\n options: object,\n useFinalPosition: boolean,\n ): unknown[];\n}\n\n/**\n * Loads chart.js. The default is a dynamic `import('chart.js/auto')`, so chart.js is only fetched by apps that show\n * a chart; provide another function to register a smaller set of chart.js parts or to replace it in tests.\n */\nexport const HX_CHART_LOADER = new InjectionToken<() => Promise<HxChartModule>>('HX_CHART_LOADER', {\n providedIn: 'root',\n factory: () => () => import('chart.js/auto') as unknown as Promise<HxChartModule>,\n});\n\n/** Colours of the datasets that do not set their own, as tokens in the order they are used. */\nconst PALETTE = [\n '--h-primary-color',\n '--h-orange-500',\n '--h-green-500',\n '--h-purple-500',\n '--h-sky-500',\n '--h-red-500',\n '--h-yellow-500',\n '--h-teal-500',\n];\n\ntype Json = Record<string, unknown>;\n\n/** The parts of chart.js data and datasets that are read here; everything else is passed on untouched. */\ninterface ChartDataLike extends Json {\n datasets?: unknown;\n}\ninterface DatasetLike extends Json {\n data?: unknown;\n backgroundColor?: unknown;\n borderColor?: unknown;\n}\n\nconst isObject = (value: unknown): value is Json =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\n/** `defaults` underneath, `overrides` on top; objects merge, everything else is replaced. */\nfunction merge(defaults: Json, overrides: Json): Json {\n const out: Json = { ...defaults };\n for (const [key, value] of Object.entries(overrides)) {\n const base = out[key];\n out[key] = isObject(base) && isObject(value) ? merge(base, value) : value;\n }\n return out;\n}\n\n/**\n * A chart.js chart whose colours, grid and font come from the Helix tokens.\n *\n * ```html\n * <hx-chart type=\"bar\" [data]=\"data\" [options]=\"options\" height=\"20rem\" ariaLabel=\"Sales per month\">\n * <table hxChartFallback>…the same numbers as text…</table>\n * </hx-chart>\n * ```\n *\n * chart.js is an optional peer dependency, loaded with a dynamic import (see `HX_CHART_LOADER`) the first time a\n * chart is shown. Datasets without colours get the Helix palette; text, grid and legend colours come from\n * `--h-text-muted-color` and `--h-content-border-color` of the element. Your `options` win over these defaults.\n * The chart is redrawn when `class` or `style` of `<html>` change (dark mode, the primary colour).\n *\n * The canvas is an `img` named by `ariaLabel` / `ariaLabelledBy`; content marked `hxChartFallback` becomes the\n * canvas fallback content, which assistive technology reads: put the numbers there as text or as a table.\n */\n@Component({\n selector: 'hx-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'hx-chart' },\n templateUrl: './chart.html',\n})\nexport class HxChart {\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #zone = inject(NgZone);\n readonly #loader = inject(HX_CHART_LOADER);\n readonly #platform = inject(PLATFORM_ID);\n private readonly canvas = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n\n readonly type = input<HxChartType>('bar');\n /** chart.js data: `{ labels, datasets }`. Pass a new object to update the chart. */\n readonly data = input<ChartDataLike>({});\n /** chart.js options, on top of the token defaults. Pass a new object to update the chart. */\n readonly options = input<Json>({});\n /** Extra chart.js plugins for this chart. */\n readonly plugins = input<readonly unknown[]>([]);\n /** CSS width of the frame, e.g. `30rem`; the chart fills its container by default. */\n readonly width = input<string>();\n /** CSS height of the frame; without it chart.js keeps its aspect ratio. */\n readonly height = input<string>();\n /** Resize with the container. */\n readonly responsive = input(true, { transform: (v: unknown) => v !== false && v !== 'false' });\n readonly ariaLabel = input<string>();\n readonly ariaLabelledBy = input<string>();\n /** Delay of a redraw after the theme changed, in ms; the style change is usually followed by more. */\n readonly themeDelay = input(50, { transform: numberAttribute });\n\n /** A data point or dataset was clicked. */\n readonly dataSelect = output<HxChartSelectEvent>();\n\n #chart: HxChartInstance | undefined;\n #chartType: HxChartType | undefined;\n #ready = false;\n #loading = false;\n #observer: MutationObserver | undefined;\n #timer: ReturnType<typeof setTimeout> | undefined;\n\n constructor() {\n afterNextRender(() => {\n this.#ready = true;\n void this.#render();\n this.#watchTheme();\n });\n effect(() => {\n this.type();\n this.data();\n this.options();\n this.plugins();\n this.responsive();\n this.width();\n this.height();\n untracked(() => {\n if (this.#ready) void this.#render();\n });\n });\n inject(DestroyRef).onDestroy(() => {\n clearTimeout(this.#timer);\n this.#observer?.disconnect();\n this.#chart?.destroy();\n this.#chart = undefined;\n this.#ready = false;\n });\n }\n\n /** The chart.js instance, once it exists; `undefined` before chart.js has loaded. */\n get chart(): HxChartInstance | undefined {\n return this.#chart;\n }\n\n /** Redraws the chart, e.g. after the theme changed in a way the component cannot see. */\n refresh(): void {\n if (this.#chart) {\n this.#apply(this.#chart);\n this.#chart.update();\n }\n }\n\n protected onClick(event: MouseEvent): void {\n const chart = this.#chart;\n if (!chart) return;\n const element = chart.getElementsAtEventForMode(event, 'nearest', { intersect: true }, false);\n const dataset = chart.getElementsAtEventForMode(event, 'dataset', { intersect: true }, false);\n if (element?.[0] && dataset)\n this.dataSelect.emit({ originalEvent: event, element: element[0], dataset });\n }\n\n async #render(): Promise<void> {\n if (!isPlatformBrowser(this.#platform)) return;\n const type = this.type();\n if (this.#chart && this.#chartType === type) {\n this.#apply(this.#chart);\n this.#chart.update();\n return;\n }\n if (this.#loading) return;\n this.#loading = true;\n try {\n const module = await this.#loader();\n if (!this.#ready) return; // destroyed while chart.js loaded\n this.#chart?.destroy();\n const Chart = module.default;\n this.#zone.runOutsideAngular(() => {\n this.#chart = new Chart(this.canvas().nativeElement, {\n type: this.type(),\n data: this.#themedData(),\n options: this.#themedOptions(),\n plugins: [...this.plugins()],\n });\n });\n this.#chartType = this.type();\n } catch (error) {\n console.error(\n 'hx-chart: chart.js could not be loaded. Is the peer dependency \"chart.js\" installed?',\n error,\n );\n return;\n } finally {\n this.#loading = false;\n }\n // inputs may have changed while chart.js loaded\n if (this.#chart && this.#chartType !== this.type()) await this.#render();\n }\n\n #apply(chart: HxChartInstance): void {\n chart.data = this.#themedData();\n chart.options = this.#themedOptions();\n }\n\n #token(name: string): string {\n return getComputedStyle(this.#host).getPropertyValue(name).trim();\n }\n\n /** The datasets with palette colours where they set none. The input is not changed. */\n #themedData(): Json {\n const data = this.data();\n const datasets = data.datasets;\n if (!Array.isArray(datasets)) return data;\n const palette = PALETTE.map((name) => this.#token(name)).filter(Boolean);\n if (palette.length === 0) return data;\n const perPoint = ['pie', 'doughnut', 'polarArea'].includes(this.type());\n return {\n ...data,\n datasets: datasets.map((dataset: DatasetLike, i: number) => {\n if (!isObject(dataset)) return dataset;\n const color = palette[i % palette.length];\n const count = Array.isArray(dataset.data) ? dataset.data.length : 0;\n const points = Array.from({ length: count }, (_, n) => palette[n % palette.length]);\n const filled = this.type() === 'line' || this.type() === 'radar';\n return {\n ...dataset,\n backgroundColor:\n dataset.backgroundColor ??\n (perPoint ? points : filled ? `color-mix(in srgb, ${color}, transparent 80%)` : color),\n borderColor:\n dataset.borderColor ?? (perPoint ? this.#token('--h-content-background') : color),\n };\n }),\n };\n }\n\n #themedOptions(): Json {\n const text = this.#token('--h-text-color');\n const muted = this.#token('--h-text-muted-color');\n const grid = this.#token('--h-content-border-color');\n const axis = { ticks: { color: muted }, grid: { color: grid }, border: { color: grid } };\n const radial = {\n ticks: { color: muted, backdropColor: 'transparent' },\n grid: { color: grid },\n angleLines: { color: grid },\n pointLabels: { color: text },\n };\n const type = this.type();\n const scales =\n type === 'radar' || type === 'polarArea'\n ? { r: radial }\n : type === 'pie' || type === 'doughnut'\n ? {}\n : { x: axis, y: axis };\n const defaults: Json = {\n responsive: this.responsive(),\n maintainAspectRatio: !(this.height() || this.width()),\n color: muted,\n borderColor: grid,\n plugins: { legend: { labels: { color: text } } },\n scales,\n };\n return merge(defaults, this.options());\n }\n\n #watchTheme(): void {\n if (typeof MutationObserver === 'undefined') return;\n this.#observer = new MutationObserver(() => {\n clearTimeout(this.#timer);\n this.#timer = setTimeout(() => this.refresh(), this.themeDelay());\n });\n this.#observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class', 'style', 'data-theme'],\n });\n }\n}\n","<div class=\"hx-chart-frame\" [style.width]=\"width() ?? null\" [style.height]=\"height() ?? null\">\n <canvas\n #canvas\n class=\"hx-chart-canvas\"\n role=\"img\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n (click)=\"onClick($event)\"\n ><ng-content select=\"[hxChartFallback]\" /></canvas>\n</div>\n"],"mappings":";;;AA4DA,MAAa,kBAAkB,IAAI,eAA6C,mBAAmB;CACjG,YAAY;CACZ,qBAAqB,OAAO;AAC7B,CAAA;AAGD,MAAM,UAAU;CACd;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD;AAcD,MAAM,YAAY,UAChB,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK;AAGrE,SAAS,MAAM,UAAgB,WAAe;CAC5C,MAAM,MAAY,EAAE,GAAG,SAAQ;CAC/B,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,SAAS,GAAG;EACpD,MAAM,OAAO,IAAI;EACjB,IAAI,OAAO,SAAS,IAAI,KAAK,SAAS,KAAK,IAAI,MAAM,MAAM,KAAK,IAAI;CACtE;CACA,OAAO;AACT;AAyBA,IAAa,UAAb,MAAa,QAAO;CACT,QAAQ,OAAgC,UAAU,CAAC,CAAC;CACpD,QAAQ,OAAO,MAAM;CACrB,UAAU,OAAO,eAAe;CAChC,YAAY,OAAO,WAAW;CACtB,SAAS,UAAU,SAAwC,UAAS,GAAA,YAAA,CAAA,EAAA,WAAA,SAAA,CAAA,+BAAA,CAAA,CAAA;CAE5E,OAAO,MAAmB,OAAM,GAAA,YAAA,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,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA;IAAA,UAAA;IAAA,OAAA;IAAA,UAAA;GAAA,CAAA;EAAA,CAAA;EAAA,YAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,YAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"gravionlabs-helix-ui-chart.mjs","names":[],"sources":["../../../projects/ui/chart/chart.ts","../../../projects/ui/chart/chart.html"],"sourcesContent":["import { isPlatformBrowser } from '@angular/common';\nimport {\n afterNextRender,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n effect,\n InjectionToken,\n inject,\n input,\n NgZone,\n numberAttribute,\n output,\n PLATFORM_ID,\n untracked,\n viewChild,\n} from '@angular/core';\n\nexport type HxChartType =\n | 'bar'\n | 'line'\n | 'scatter'\n | 'bubble'\n | 'pie'\n | 'doughnut'\n | 'polarArea'\n | 'radar';\n\n/** What `(dataSelect)` carries: the click and what chart.js found under it. */\nexport interface HxChartSelectEvent {\n originalEvent: Event;\n /** The nearest element under the pointer (chart.js `{ datasetIndex, index, element }`). */\n element: unknown;\n /** The elements of that dataset. */\n dataset: unknown[];\n}\n\n/** The part of chart.js this component uses; the real module is `chart.js/auto`. */\nexport interface HxChartModule {\n default: new (canvas: HTMLCanvasElement, config: unknown) => HxChartInstance;\n}\n\nexport interface HxChartInstance {\n data: unknown;\n options: unknown;\n update(mode?: string): void;\n destroy(): void;\n getElementsAtEventForMode(\n event: Event,\n mode: string,\n options: object,\n useFinalPosition: boolean,\n ): unknown[];\n}\n\n/**\n * Loads chart.js. The default is a dynamic `import('chart.js/auto')`, so chart.js is only fetched by apps that show\n * a chart; provide another function to register a smaller set of chart.js parts or to replace it in tests.\n */\nexport const HX_CHART_LOADER = new InjectionToken<() => Promise<HxChartModule>>('HX_CHART_LOADER', {\n providedIn: 'root',\n factory: () => () => import('chart.js/auto') as unknown as Promise<HxChartModule>,\n});\n\n/** Colours of the datasets that do not set their own, as tokens in the order they are used. */\nconst PALETTE = [\n '--h-primary-color',\n '--h-orange-500',\n '--h-green-500',\n '--h-purple-500',\n '--h-sky-500',\n '--h-red-500',\n '--h-yellow-500',\n '--h-teal-500',\n];\n\ntype Json = Record<string, unknown>;\n\n/** The parts of chart.js data and datasets that are read here; everything else is passed on untouched. */\ninterface ChartDataLike extends Json {\n datasets?: unknown;\n}\ninterface DatasetLike extends Json {\n data?: unknown;\n backgroundColor?: unknown;\n borderColor?: unknown;\n}\n\nconst isObject = (value: unknown): value is Json =>\n typeof value === 'object' && value !== null && !Array.isArray(value);\n\n/** `defaults` underneath, `overrides` on top; objects merge, everything else is replaced. */\nfunction merge(defaults: Json, overrides: Json): Json {\n const out: Json = { ...defaults };\n for (const [key, value] of Object.entries(overrides)) {\n const base = out[key];\n out[key] = isObject(base) && isObject(value) ? merge(base, value) : value;\n }\n return out;\n}\n\n/**\n * A chart.js chart whose colours, grid and font come from the Helix tokens.\n *\n * ```html\n * <hx-chart type=\"bar\" [data]=\"data\" [options]=\"options\" height=\"20rem\" ariaLabel=\"Sales per month\">\n * <table hxChartFallback>…the same numbers as text…</table>\n * </hx-chart>\n * ```\n *\n * chart.js is an optional peer dependency, loaded with a dynamic import (see `HX_CHART_LOADER`) the first time a\n * chart is shown. Datasets without colours get the Helix palette; text, grid and legend colours come from\n * `--h-text-muted-color` and `--h-content-border-color` of the element. Your `options` win over these defaults.\n * The chart is redrawn when `class` or `style` of `<html>` change (dark mode, the primary colour).\n *\n * The canvas is an `img` named by `ariaLabel` / `ariaLabelledBy`; content marked `hxChartFallback` becomes the\n * canvas fallback content, which assistive technology reads: put the numbers there as text or as a table.\n */\n@Component({\n selector: 'hx-chart',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { class: 'hx-chart' },\n templateUrl: './chart.html',\n})\nexport class HxChart {\n readonly #host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement;\n readonly #zone = inject(NgZone);\n readonly #loader = inject(HX_CHART_LOADER);\n readonly #platform = inject(PLATFORM_ID);\n private readonly canvas = viewChild.required<ElementRef<HTMLCanvasElement>>('canvas');\n\n readonly type = input<HxChartType>('bar');\n /** chart.js data: `{ labels, datasets }`. Pass a new object to update the chart. */\n readonly data = input<ChartDataLike>({});\n /** chart.js options, on top of the token defaults. Pass a new object to update the chart. */\n readonly options = input<Json>({});\n /** Extra chart.js plugins for this chart. */\n readonly plugins = input<readonly unknown[]>([]);\n /** CSS width of the frame, e.g. `30rem`; the chart fills its container by default. */\n readonly width = input<string>();\n /** CSS height of the frame; without it chart.js keeps its aspect ratio. */\n readonly height = input<string>();\n /** Resize with the container. */\n readonly responsive = input(true, { transform: (v: unknown) => v !== false && v !== 'false' });\n readonly ariaLabel = input<string>();\n readonly ariaLabelledBy = input<string>();\n /** Delay of a redraw after the theme changed, in ms; the style change is usually followed by more. */\n readonly themeDelay = input(50, { transform: numberAttribute });\n\n /** A data point or dataset was clicked. */\n readonly dataSelect = output<HxChartSelectEvent>();\n\n #chart: HxChartInstance | undefined;\n #chartType: HxChartType | undefined;\n #ready = false;\n #loading = false;\n #observer: MutationObserver | undefined;\n #timer: ReturnType<typeof setTimeout> | undefined;\n\n constructor() {\n afterNextRender(() => {\n this.#ready = true;\n void this.#render();\n this.#watchTheme();\n });\n effect(() => {\n this.type();\n this.data();\n this.options();\n this.plugins();\n this.responsive();\n this.width();\n this.height();\n untracked(() => {\n if (this.#ready) void this.#render();\n });\n });\n inject(DestroyRef).onDestroy(() => {\n clearTimeout(this.#timer);\n this.#observer?.disconnect();\n this.#chart?.destroy();\n this.#chart = undefined;\n this.#ready = false;\n });\n }\n\n /** The chart.js instance, once it exists; `undefined` before chart.js has loaded. */\n get chart(): HxChartInstance | undefined {\n return this.#chart;\n }\n\n /** Redraws the chart, e.g. after the theme changed in a way the component cannot see. */\n refresh(): void {\n if (this.#chart) {\n this.#apply(this.#chart);\n this.#chart.update();\n }\n }\n\n protected onClick(event: MouseEvent): void {\n const chart = this.#chart;\n if (!chart) return;\n const element = chart.getElementsAtEventForMode(event, 'nearest', { intersect: true }, false);\n const dataset = chart.getElementsAtEventForMode(event, 'dataset', { intersect: true }, false);\n if (element?.[0] && dataset)\n this.dataSelect.emit({ originalEvent: event, element: element[0], dataset });\n }\n\n async #render(): Promise<void> {\n if (!isPlatformBrowser(this.#platform)) return;\n const type = this.type();\n if (this.#chart && this.#chartType === type) {\n this.#apply(this.#chart);\n this.#chart.update();\n return;\n }\n if (this.#loading) return;\n this.#loading = true;\n try {\n const module = await this.#loader();\n if (!this.#ready) return; // destroyed while chart.js loaded\n this.#chart?.destroy();\n const Chart = module.default;\n this.#zone.runOutsideAngular(() => {\n this.#chart = new Chart(this.canvas().nativeElement, {\n type: this.type(),\n data: this.#themedData(),\n options: this.#themedOptions(),\n plugins: [...this.plugins()],\n });\n });\n this.#chartType = this.type();\n } catch (error) {\n console.error(\n 'hx-chart: chart.js could not be loaded. Is the peer dependency \"chart.js\" installed?',\n error,\n );\n return;\n } finally {\n this.#loading = false;\n }\n // inputs may have changed while chart.js loaded\n if (this.#chart && this.#chartType !== this.type()) await this.#render();\n }\n\n #apply(chart: HxChartInstance): void {\n chart.data = this.#themedData();\n chart.options = this.#themedOptions();\n }\n\n #token(name: string): string {\n return getComputedStyle(this.#host).getPropertyValue(name).trim();\n }\n\n /** The datasets with palette colours where they set none. The input is not changed. */\n #themedData(): Json {\n const data = this.data();\n const datasets = data.datasets;\n if (!Array.isArray(datasets)) return data;\n const palette = PALETTE.map((name) => this.#token(name)).filter(Boolean);\n if (palette.length === 0) return data;\n const perPoint = ['pie', 'doughnut', 'polarArea'].includes(this.type());\n return {\n ...data,\n datasets: datasets.map((dataset: DatasetLike, i: number) => {\n if (!isObject(dataset)) return dataset;\n const color = palette[i % palette.length];\n const count = Array.isArray(dataset.data) ? dataset.data.length : 0;\n const points = Array.from({ length: count }, (_, n) => palette[n % palette.length]);\n const filled = this.type() === 'line' || this.type() === 'radar';\n return {\n ...dataset,\n backgroundColor:\n dataset.backgroundColor ??\n (perPoint ? points : filled ? `color-mix(in srgb, ${color}, transparent 80%)` : color),\n borderColor:\n dataset.borderColor ?? (perPoint ? this.#token('--h-content-background') : color),\n };\n }),\n };\n }\n\n #themedOptions(): Json {\n const text = this.#token('--h-text-color');\n const muted = this.#token('--h-text-muted-color');\n const grid = this.#token('--h-content-border-color');\n const axis = { ticks: { color: muted }, grid: { color: grid }, border: { color: grid } };\n const radial = {\n ticks: { color: muted, backdropColor: 'transparent' },\n grid: { color: grid },\n angleLines: { color: grid },\n pointLabels: { color: text },\n };\n const type = this.type();\n const scales =\n type === 'radar' || type === 'polarArea'\n ? { r: radial }\n : type === 'pie' || type === 'doughnut'\n ? {}\n : { x: axis, y: axis };\n const defaults: Json = {\n responsive: this.responsive(),\n maintainAspectRatio: !(this.height() || this.width()),\n color: muted,\n borderColor: grid,\n plugins: { legend: { labels: { color: text } } },\n scales,\n };\n return merge(defaults, this.options());\n }\n\n #watchTheme(): void {\n if (typeof MutationObserver === 'undefined') return;\n this.#observer = new MutationObserver(() => {\n clearTimeout(this.#timer);\n this.#timer = setTimeout(() => this.refresh(), this.themeDelay());\n });\n this.#observer.observe(document.documentElement, {\n attributes: true,\n attributeFilter: ['class', 'style', 'data-theme'],\n });\n }\n}\n","<div class=\"hx-chart-frame\" [style.width]=\"width() ?? null\" [style.height]=\"height() ?? null\">\n <canvas\n #canvas\n class=\"hx-chart-canvas\"\n role=\"img\"\n [attr.aria-label]=\"ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n (click)=\"onClick($event)\"\n ><ng-content select=\"[hxChartFallback]\"\n /></canvas>\n</div>\n"],"mappings":";;;AA4DA,MAAa,kBAAkB,IAAI,eAA6C,mBAAmB;CACjG,YAAY;CACZ,qBAAqB,OAAO;AAC7B,CAAA;AAGD,MAAM,UAAU;CACd;CACA;CACA;CACA;C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