@koeroesi86/canvas-grid 26.11.6 → 26.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -16,6 +16,8 @@ Live demo and feature overview: https://koeroesi86.github.io/canvas-grid/
16
16
  - [Getting started](docs/getting-started.md): install, usage, browser support
17
17
  - [API reference](docs/api.md): data model, methods, properties
18
18
  - [Sorting](docs/sorting.md)
19
+ - [Selection](docs/selection.md)
20
+ - [Theming](docs/theming.md): CSS custom properties, light and dark
19
21
  - [Custom renderers and layers](docs/renderers.md)
20
22
  - [AG Grid-style adapter](docs/ag-grid-adapter.md)
21
23
  - [TypeScript](docs/typescript.md)
@@ -6,7 +6,11 @@ export interface CellBackgroundOptions {
6
6
  background: string;
7
7
  flashInDuration: number;
8
8
  flashOutDuration: number;
9
- flashRGB: string;
9
+ flashColor: string;
10
+ /** Laid over odd rows. */
11
+ zebraColor: string;
12
+ /** Laid over the hovered row, faded in and out. */
13
+ hoverColor: string;
10
14
  borderRightWidth: number;
11
15
  borderRightColor: string;
12
16
  borderBottomWidth: number;
@@ -15,11 +19,21 @@ export interface CellBackgroundOptions {
15
19
  declare class CellBackground extends Renderer<CellBackgroundOptions> implements CellRenderer {
16
20
  static readonly defaultOptions: CellBackgroundOptions;
17
21
  constructor(options?: Partial<CellBackgroundOptions>);
22
+ /** Index of the row under the pointer, set by the grid through `hover`. */
23
+ hoveredRowIndex: number | undefined;
24
+ /** Rows whose highlight is fading in or out, or fully on. */
25
+ private readonly hoverFades;
26
+ private get hoverDuration();
27
+ /** Moves the highlight to the given row (or none); the rows involved fade from where they are. */
28
+ hover(index: number | undefined, now?: number): void;
29
+ private startFade;
30
+ /** How much of the highlight a row shows, from 0 to 1; finished fade-outs are forgotten. */
31
+ private getHoverFraction;
18
32
  get layer(): string;
19
33
  /** Cells flash after their value changed, until the flash has faded out. */
20
- isAnimating({ age }: Readonly<CellContext>): boolean;
21
- /** Flash opacity for a cell updated `age` ms ago: fades in, then out, then 0. */
34
+ isAnimating({ age, row, now }: Readonly<CellContext>): boolean;
35
+ /** Flash opacity for a cell updated `age` ms ago: eases in, eases out, then 0. A steady highlight with reduced motion. */
22
36
  private getFlashAlpha;
23
- draw({ ctx, x, y, width, height, age }: Readonly<CellContext>): void;
37
+ draw({ ctx, x, y, width, height, age, row, now }: Readonly<CellContext>): void;
24
38
  }
25
39
  export default CellBackground;
@@ -1,9 +1,13 @@
1
1
  import Renderer from '../utils/renderer';
2
2
  import type { TextStyle } from '../text';
3
- import type { CellContext, CellRenderer } from '../types';
3
+ import type { CellContext, CellRenderer, SortDirection } from '../types';
4
4
  export interface HeaderOptions {
5
5
  layer: string;
6
6
  background: string;
7
+ /** Background of a header or row number with some of its cells selected. */
8
+ selectedBackground: string;
9
+ /** Background of a header or row number whose whole column or row is selected. */
10
+ fullySelectedBackground: string;
7
11
  font: string;
8
12
  color: string;
9
13
  borderRightWidth: number;
@@ -14,6 +18,13 @@ export interface HeaderOptions {
14
18
  declare class HeaderRenderer extends Renderer<HeaderOptions> implements CellRenderer {
15
19
  static readonly defaultOptions: HeaderOptions;
16
20
  private readonly textRenderer;
21
+ /** Sort direction by column id, set by the grid; sorted headers show an arrow. */
22
+ private readonly sortDirections;
23
+ /** Shows the arrows of the columns in the sort model; the grid redraws the headers afterwards. */
24
+ setSortModel(model: readonly {
25
+ columnId: string | number;
26
+ direction?: SortDirection;
27
+ }[]): void;
17
28
  constructor(options?: Partial<HeaderOptions>);
18
29
  get layer(): string;
19
30
  set font(font: string);
@@ -21,7 +32,9 @@ declare class HeaderRenderer extends Renderer<HeaderOptions> implements CellRend
21
32
  set pixelRatio(pixelRatio: number);
22
33
  get pixelRatio(): number;
23
34
  setTextStyle(style: Partial<TextStyle>): void;
35
+ optionsUpdated(): void;
24
36
  clearCache(): void;
25
- draw({ ctx, x, y, width, height, column, formatted }: Readonly<CellContext>): void;
37
+ private backgroundFor;
38
+ draw({ ctx, x, y, width, height, column, formatted, selected }: Readonly<CellContext>): void;
26
39
  }
27
40
  export default HeaderRenderer;
@@ -0,0 +1,13 @@
1
+ import type { SortDirection } from '../types';
2
+ export interface SortIndicatorProps {
3
+ /** Width and height of the area the arrow is centred in, relative to the draw origin. */
4
+ width: number;
5
+ height: number;
6
+ direction: SortDirection;
7
+ color: string;
8
+ }
9
+ /** Width of the arrow's area, for the header to keep its text clear of it. */
10
+ export declare const SORT_INDICATOR_AREA = 18;
11
+ /** Small filled triangle at the right end of a header: pointing up for ascending, down for descending. */
12
+ declare const SortIndicator: import("../utils/jsx").Component<SortIndicatorProps>;
13
+ export default SortIndicator;
@@ -12,6 +12,11 @@ export interface TextStyle {
12
12
  * so mixed data works. Right-to-left text is aligned to the right of the cell.
13
13
  */
14
14
  direction: 'ltr' | 'rtl' | 'auto';
15
+ /**
16
+ * What happens to text wider than its cell. `'clip'` cuts it off at the cell edge, which needs no measuring.
17
+ * `'ellipsis'` shortens it and ends it with the ellipsis, which means measuring the text.
18
+ */
19
+ textOverflow: 'clip' | 'ellipsis';
15
20
  }
16
21
  export interface TextOptions extends TextStyle {
17
22
  ellipsis: string;
@@ -51,10 +56,17 @@ declare class TextRenderer extends Renderer<TextOptions> {
51
56
  private prepareMeasuring;
52
57
  /** Width of one character in a font, measured once. */
53
58
  private measureCharacter;
59
+ /** What a pair of characters is wider than the two alone, measured once per pair: negative for kerned pairs such as "AV". */
60
+ private measureKerning;
54
61
  /** Width of a string as the browser lays it out: includes kerning, ligatures and joined scripts. */
55
62
  private measureString;
56
63
  /** Sum of the character widths in the renderer's font: exact for monospace fonts, a close upper bound for most others. */
57
64
  getTextWidth(text: string): number;
65
+ /**
66
+ * Whether simple text surely fits: the cached character widths add up to at most `available`. Kerning only narrows
67
+ * text, so a fit by the sum is a fit. Anything past Latin (joined scripts, emoji) is not trusted and gets clipped.
68
+ */
69
+ private fitsBySum;
58
70
  /** The font of the cell drawn last: columns mostly share one, so the lookup by font name is skipped. */
59
71
  private lastMeasures;
60
72
  private isRightToLeft;
@@ -20,6 +20,63 @@ export interface SortKey {
20
20
  /** Orders two values of the column; defaults to numbers numerically, then text, with empty values last. */
21
21
  compare?: (a: unknown, b: unknown) => number;
22
22
  }
23
+ /** A cell by displayed position: zero-based row and column indexes. */
24
+ export interface CellPosition {
25
+ row: number;
26
+ column: number;
27
+ }
28
+ /** First and last index of a run of rows or columns, both inclusive. */
29
+ export type Span = readonly [first: number, last: number];
30
+ /** A block of cells. Leaving `rows` or `columns` out means all of them, now and as rows are added. */
31
+ export interface CellRange {
32
+ rows?: Span;
33
+ columns?: Span;
34
+ }
35
+ /** What `getSelection` returns and `setSelection` takes: the selected ranges, and the cell that has focus. */
36
+ export interface GridSelection {
37
+ ranges: CellRange[];
38
+ active: CellPosition | undefined;
39
+ }
40
+ /** How much of a column or row is selected: none of it, some of it, or all of it. */
41
+ export type SelectionLevel = 'none' | 'partial' | 'full';
42
+ /** How the user can select: not at all, one cell, ranges of cells (Excel-style), whole rows or whole columns. */
43
+ export type SelectionMode = 'none' | 'cell' | 'range' | 'row' | 'column';
44
+ export interface SelectionChangeDetail extends GridSelection {
45
+ /** True while the pointer is down and the selection is being dragged out; a final event with `false` follows. */
46
+ selecting: boolean;
47
+ }
48
+ /** One entry of the grid's context menu. */
49
+ export interface ContextMenuItem {
50
+ id: string;
51
+ label: string;
52
+ /** Greyed out and not pickable; a function is asked each time the menu opens. */
53
+ disabled?: boolean | ((detail: ContextMenuDetail) => boolean);
54
+ run(detail: ContextMenuDetail): void;
55
+ }
56
+ export interface ContextMenuDetail extends GridSelection {
57
+ /** Where the menu opens, in viewport coordinates. */
58
+ x: number;
59
+ y: number;
60
+ /** The cell under the pointer, or at the active cell when the keyboard opened the menu; the column alone over a header, the row alone over a row number. */
61
+ row: number | undefined;
62
+ column: number | undefined;
63
+ /** The entries to show: change this list to add, remove or reorder them for this opening. */
64
+ items: ContextMenuItem[];
65
+ }
66
+ export interface SelectionCopyDetail {
67
+ /** What goes to the clipboard: the cells of the newest range as tab-separated values. Change it to copy something else. */
68
+ text: string;
69
+ /** The range that was copied. */
70
+ range: CellRange;
71
+ /** Rows were left off, because the range holds more cells than one copy takes. */
72
+ truncated: boolean;
73
+ }
74
+ export interface CellFocusDetail {
75
+ rowId: RowId;
76
+ rowIndex: number;
77
+ columnId: Key;
78
+ columnIndex: number;
79
+ }
23
80
  /** Props of a drawable element (see utils/jsx); positions are relative to the draw origin. */
24
81
  export interface RenderProps {
25
82
  value?: string;
@@ -78,6 +135,11 @@ export interface CellContext {
78
135
  /** Everything has to be redrawn: first draw, resize or scrolling. */
79
136
  forced: boolean;
80
137
  isScrolling: boolean;
138
+ /**
139
+ * For a column header: how much of its column is selected; for a row number: how much of its row. Always `'none'` for data cells,
140
+ * whose selection is drawn on the `selection` layer.
141
+ */
142
+ selected: SelectionLevel;
81
143
  state: CellState;
82
144
  }
83
145
  /** Draws into one named layer. Register it with `grid.registerRenderer` and select it per column. */
@@ -0,0 +1,15 @@
1
+ import type { Bounds } from './selection';
2
+ /** Most cells one copy puts on the clipboard, so selecting everything in a huge grid cannot freeze the page. */
3
+ export declare const MAX_COPY_CELLS = 1000000;
4
+ /** Text as one field of tab-separated values: wrapped in quotes, with quotes doubled, when it holds a tab, a line break or a quote, as spreadsheets do. */
5
+ export declare const escapeField: (text: string) => string;
6
+ export interface CopiedText {
7
+ text: string;
8
+ /** Rows were left off to stay within `MAX_COPY_CELLS`. */
9
+ truncated: boolean;
10
+ }
11
+ /**
12
+ * The cells of `bounds` as tab-separated values, a row per line, from the text `textAt` gives for each cell.
13
+ * Stops after as many whole rows as fit in `maxCells`, but always includes one.
14
+ */
15
+ export declare const toTsv: (bounds: Bounds, textAt: (row: number, column: number) => string, maxCells?: number) => CopiedText;
@@ -0,0 +1,16 @@
1
+ /** Narrowest a column can get when it sets no `minWidth`. */
2
+ export declare const DEFAULT_MIN_COLUMN_WIDTH = 20;
3
+ /** Keeps a width within its limits; a `maxWidth` below the minimum loses. */
4
+ export declare const clampWidth: (width: number, minWidth?: number, maxWidth?: number) => number;
5
+ /**
6
+ * Left edge of every column, followed by the total width: `offsets[i]` is where column `i` starts and
7
+ * `offsets[widths.length]` is where the last one ends. Widths are rounded, as they are when drawn.
8
+ */
9
+ export declare const buildOffsets: (widths: readonly number[]) => number[];
10
+ /** Index of the column containing `x`, found by binary search; clamped to the first and last column. */
11
+ export declare const columnAt: (offsets: readonly number[], x: number) => number;
12
+ /**
13
+ * The column whose right edge is within `tolerance` of `x`, i.e. the one a drag from there would resize,
14
+ * or -1. Where two edges are equally close (zero-width columns do not exist, but touch targets overlap) the left one wins.
15
+ */
16
+ export declare const borderAt: (offsets: readonly number[], x: number, tolerance: number) => number;
@@ -0,0 +1,25 @@
1
+ export interface MenuEntry {
2
+ id: string;
3
+ label: string;
4
+ disabled: boolean;
5
+ }
6
+ /**
7
+ * A small popup menu, made of plain elements so it is accessible and can reach past the grid's box.
8
+ * It sits in the top layer (`popover`), which closes it on an outside click or Escape. It is built when first opened.
9
+ */
10
+ export declare class ContextMenu {
11
+ private element;
12
+ private readonly host;
13
+ private readonly onPick;
14
+ /** `onPick` is called with the id of the entry the user picked, after the menu closed. */
15
+ constructor(host: HTMLElement, onPick: (id: string) => void);
16
+ get isOpen(): boolean;
17
+ /** Shows the entries with their top left corner at the viewport position, moved in if it would overflow. */
18
+ open(clientX: number, clientY: number, entries: readonly MenuEntry[]): void;
19
+ close(): void;
20
+ private items;
21
+ private create;
22
+ private createItem;
23
+ private readonly onKeyDown;
24
+ }
25
+ export default ContextMenu;
@@ -5,6 +5,8 @@ export type RowIdGetter = (row: RowInput, index?: number) => RowId;
5
5
  export interface DataStoreEnvironment {
6
6
  getRowId: RowIdGetter;
7
7
  getCellHeight: () => number;
8
+ /** The height a row should have when it differs from `getCellHeight()`, asked once its values are stored. */
9
+ getRowHeight?: (id: RowId) => number | undefined;
8
10
  }
9
11
  /** Numbers numerically, then text, then anything else as text; empty values sort last. */
10
12
  export declare const compareValues: (a: unknown, b: unknown) => number;
@@ -11,6 +11,11 @@ export interface ExactFit {
11
11
  cache?: FitCache;
12
12
  /** The character widths add up to the real width, as for a monospace font: Latin text then needs no measuring. */
13
13
  sumIsExact: boolean;
14
+ /**
15
+ * How much wider (negative: narrower) two neighbouring characters are laid out than their own widths add up to:
16
+ * kerning and ligatures. With it, simple Latin text is cut by arithmetic instead of by measuring.
17
+ */
18
+ kerning?: (left: string, right: string) => number;
14
19
  }
15
20
  /**
16
21
  * Cuts `text` to fit `available` pixels, ending in `ellipsis` when something was cut.
@@ -10,6 +10,8 @@ declare class Loading extends Renderer<LoadingOptions> {
10
10
  private readonly speed;
11
11
  private readonly count;
12
12
  constructor(options: LoadingOptions);
13
+ /** The colour the loader is drawn in; it takes a moment to fully replace the old one. */
14
+ setColor(color: string): void;
13
15
  updateLoader(): void;
14
16
  renderLoader(): void;
15
17
  render(): HTMLCanvasElement;
@@ -28,6 +28,15 @@ declare class RowStore {
28
28
  indexAt(offset: number): number;
29
29
  /** Appends the row, or replaces the row with the same id in place; returns the stored row. */
30
30
  set(row: Omit<Row, 'index' | 'slot'>): Row;
31
+ /** Sets one row's height and moves the rows below it; returns whether anything changed. Costs the rows after it. */
32
+ setHeight(id: Key, height: number): boolean;
33
+ /** Sets every row's height in one pass. */
34
+ setHeights(heightOf: (id: RowId) => number): void;
35
+ /**
36
+ * Index of the row whose bottom border is within `tolerance` of `offset` (measured like `topOf`), or -1.
37
+ * The border above a row belongs to the row before it; where two are in reach the nearer wins.
38
+ */
39
+ borderAt(offset: number, tolerance: number): number;
31
40
  /**
32
41
  * Removes the rows with the given ids, ignoring unknown ones.
33
42
  * Returns the slots of the removed rows in ascending order, which the column stores must clear.
@@ -0,0 +1,24 @@
1
+ import type { Axis, Bounds } from './selection';
2
+ import type { CellPosition } from '../types';
3
+ /** The size of the grid the keyboard moves in; `pageRows` is how many rows PageUp and PageDown skip. */
4
+ export interface GridSize {
5
+ rowCount: number;
6
+ columnCount: number;
7
+ pageRows: number;
8
+ }
9
+ /**
10
+ * Where a navigation key takes the cursor from `from`, or undefined for any other key. Arrows move one cell and, with ctrl, to the edge;
11
+ * Home and End go to the first and last column (with ctrl also the first and last row); PageUp and PageDown move a page of rows.
12
+ * The result is always inside the grid.
13
+ */
14
+ export declare const moveTarget: (from: CellPosition, key: string, ctrl: boolean, { rowCount, columnCount, pageRows }: GridSize) => CellPosition | undefined;
15
+ /**
16
+ * The next cell inside `bounds` for Enter (`axis` `'row'`, going down) or Tab (`'column'`, going right), one back with `backwards`.
17
+ * Past the end of a line it continues on the next one, and past the last cell it starts over.
18
+ */
19
+ export declare const stepWithin: (bounds: Bounds, from: CellPosition, axis: Axis, backwards: boolean) => CellPosition;
20
+ /**
21
+ * The scroll offset that brings the span `start` to `end` into view in a viewport of `size`, starting from `scroll`:
22
+ * unchanged when it is already visible, and the span's start wins when it is larger than the viewport.
23
+ */
24
+ export declare const revealOffset: (start: number, end: number, scroll: number, size: number) => number;
@@ -0,0 +1,65 @@
1
+ import type { CellPosition, CellRange, GridSelection, SelectionLevel, SelectionMode, Span } from '../types';
2
+ /** Furthest the grid scrolls per frame while a selection is dragged past its edge, in px. */
3
+ export declare const DRAG_SCROLL_MAX = 30;
4
+ /** The two indexes as a span, smaller first. */
5
+ export declare const span: (a: number, b: number) => Span;
6
+ export declare const rangeBetween: (from: CellPosition, to: CellPosition) => CellRange;
7
+ /** The range a drag from `from` to `to` selects: what it covers depends on the mode, whole rows in `row` mode and so on. */
8
+ export declare const rangeFor: (mode: SelectionMode, from: CellPosition, to: CellPosition) => CellRange;
9
+ /** A copy with whole-number, ordered, non-negative spans; what `setSelection` stores. */
10
+ export declare const normalizeRange: (range: CellRange) => CellRange;
11
+ /** Rows and columns a range really covers, both inclusive. */
12
+ export interface Bounds {
13
+ top: number;
14
+ bottom: number;
15
+ left: number;
16
+ right: number;
17
+ }
18
+ /** The part of the range inside a grid of the given size, or undefined when none of it is. */
19
+ export declare const resolve: (range: CellRange, rowCount: number, columnCount: number) => Bounds | undefined;
20
+ export declare const contains: (range: CellRange, row: number, column: number) => boolean;
21
+ /** How much of a column is selected. Row numbers are drawn on every scroll, so this allocates nothing. */
22
+ export declare const columnLevel: (ranges: readonly CellRange[], column: number, rowCount: number) => SelectionLevel;
23
+ /** How much of a row is selected. */
24
+ export declare const rowLevel: (ranges: readonly CellRange[], row: number, columnCount: number) => SelectionLevel;
25
+ /** What a range covers: everything, whole columns, whole rows, or a block of cells. */
26
+ export declare const shapeOf: (range: CellRange) => 'all' | 'column' | 'row' | 'block';
27
+ /** Rows run down the grid and columns across it; a header selects a line of cells along one of them. */
28
+ export type Axis = 'row' | 'column';
29
+ /** A whole row or column, or a run of them from `from` to `to`. */
30
+ export declare const lineRange: (axis: Axis, from: number, to: number) => CellRange;
31
+ /** The cell at `index` along the axis and `cross` along the other. */
32
+ export declare const linePosition: (axis: Axis, index: number, cross: number) => CellPosition;
33
+ /** The index of a position along the axis. */
34
+ export declare const lineIndex: (axis: Axis, position: CellPosition) => number;
35
+ /** The index of a position along the other axis. */
36
+ export declare const crossIndex: (axis: Axis, position: CellPosition) => number;
37
+ /**
38
+ * The selected ranges, the active cell (where typing and keyboard moves start; it sits inside the last range)
39
+ * and the focus corner (the end of the last range that moves when the selection is extended).
40
+ * Every change returns whether the ranges or the active cell differ afterwards.
41
+ */
42
+ declare class SelectionModel {
43
+ ranges: CellRange[];
44
+ active: CellPosition | undefined;
45
+ focus: CellPosition | undefined;
46
+ private assign;
47
+ /** Makes this the only range, with `active` in focus. */
48
+ set(range: CellRange, active: CellPosition, focus?: CellPosition): boolean;
49
+ /** Adds a range to the selection, as ctrl+click does. */
50
+ add(range: CellRange, active: CellPosition): boolean;
51
+ /** Replaces the last range, as shift+click or dragging does; the active cell stays and `focus` becomes the moving corner. */
52
+ extend(range: CellRange, focus: CellPosition): boolean;
53
+ clear(): boolean;
54
+ /** Moves the active cell without touching the ranges, as Enter and Tab do inside a selection. */
55
+ activate(position: CellPosition): boolean;
56
+ /** Replaces everything, with the first cell of the last range active unless `active` says otherwise. */
57
+ replace(ranges: readonly CellRange[], active?: CellPosition): boolean;
58
+ /** Fits the selection to a grid of the given size, dropping what lies outside it; an empty grid selects nothing. */
59
+ clamp(rowCount: number, columnCount: number): boolean;
60
+ /** A copy that is safe to hand out. */
61
+ snapshot(): GridSelection;
62
+ }
63
+ /** How fast to scroll while dragging with the pointer at `value` and the visible area between `min` and `max`: negative is back, 0 inside. */
64
+ export declare const dragScrollSpeed: (value: number, min: number, max: number) => number;
65
+ export default SelectionModel;
@@ -0,0 +1,46 @@
1
+ export type ThemeName = 'light' | 'dark';
2
+ /** Everything the grid takes from CSS; colours and fonts are CSS values, sizes are px. */
3
+ export interface Theme {
4
+ background: string;
5
+ text: string;
6
+ font: string;
7
+ rowHeight: number;
8
+ /** Right and bottom edge of body cells. */
9
+ border: string;
10
+ headerBackground: string;
11
+ headerText: string;
12
+ headerFont: string;
13
+ headerHeight: number;
14
+ headerBorder: string;
15
+ headerBottomBorder: string;
16
+ /** Header of a column or row number with some of its cells selected. */
17
+ headerSelected: string;
18
+ /** Header of a column or row number with all its cells selected. */
19
+ headerFullySelected: string;
20
+ /** Laid over odd rows; usually translucent. */
21
+ zebra: string;
22
+ /** Laid over the row under the pointer; usually translucent. */
23
+ hover: string;
24
+ /** Laid over a cell that just changed, at the strength of the flash. */
25
+ flash: string;
26
+ selection: string;
27
+ selectionBorder: string;
28
+ }
29
+ type ThemeKey = keyof Theme;
30
+ /** The CSS custom property of each themed value. */
31
+ export declare const THEME_TOKENS: Readonly<Record<ThemeKey, string>>;
32
+ export declare const THEME_DEFAULTS: Readonly<Record<ThemeName, Readonly<Theme>>>;
33
+ /** What the CSS side of a theme is read through; the browser provides it, tests fake it. */
34
+ export interface ThemeSource {
35
+ /** The value of a custom property, or an empty string when it is not set. */
36
+ read: (token: string) => string;
37
+ isColor: (value: string) => boolean;
38
+ isFont: (value: string) => boolean;
39
+ }
40
+ /** Each value from its custom property, or from the defaults of `name` when it is missing or invalid. */
41
+ export declare const readTheme: (name: ThemeName, { read, isColor, isFont }: ThemeSource) => Theme;
42
+ export declare const isSameTheme: (a: Theme, b: Theme) => boolean;
43
+ /** `fillStyle` ignores colours it cannot parse, so a colour is valid when it sticks whichever value it replaces. */
44
+ export declare const createColorCheck: (ctx: Pick<CanvasRenderingContext2D, 'fillStyle'>) => (value: string) => boolean;
45
+ export declare const isCssFont: (value: string) => boolean;
46
+ export {};