@koeroesi86/canvas-grid 26.11.7 → 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 +2 -0
- package/build/types/cell-background/index.d.ts +5 -1
- package/build/types/header/index.d.ts +7 -1
- package/build/types/types.d.ts +62 -0
- package/build/types/utils/clipboard.d.ts +15 -0
- package/build/types/utils/column-layout.d.ts +16 -0
- package/build/types/utils/context-menu.d.ts +25 -0
- package/build/types/utils/data-store.d.ts +2 -0
- package/build/types/utils/loading.d.ts +2 -0
- package/build/types/utils/row-store.d.ts +9 -0
- package/build/types/utils/selection-navigation.d.ts +24 -0
- package/build/types/utils/selection.d.ts +65 -0
- package/build/types/utils/theme.d.ts +46 -0
- package/build/types/web-component.d.ts +255 -9
- package/build/web-component.js +2 -1
- package/build/web-component.js.map +1 -1
- package/build/web-component.mjs +1124 -157
- package/build/web-component.mjs.map +1 -1
- package/package.json +1 -1
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
|
-
|
|
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;
|
|
@@ -4,6 +4,10 @@ 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;
|
|
@@ -28,7 +32,9 @@ declare class HeaderRenderer extends Renderer<HeaderOptions> implements CellRend
|
|
|
28
32
|
set pixelRatio(pixelRatio: number);
|
|
29
33
|
get pixelRatio(): number;
|
|
30
34
|
setTextStyle(style: Partial<TextStyle>): void;
|
|
35
|
+
optionsUpdated(): void;
|
|
31
36
|
clearCache(): void;
|
|
32
|
-
|
|
37
|
+
private backgroundFor;
|
|
38
|
+
draw({ ctx, x, y, width, height, column, formatted, selected }: Readonly<CellContext>): void;
|
|
33
39
|
}
|
|
34
40
|
export default HeaderRenderer;
|
package/build/types/types.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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 {};
|