@surrealdb/ui 2.1.0 → 2.2.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.
- package/dist/fonts.d.ts +7 -7
- package/dist/icons.d.ts +7 -7
- package/dist/ui.css +1 -1
- package/dist/ui.d.ts +483 -7
- package/dist/ui.js +10207 -8614
- package/dist/ui.js.map +1 -1
- package/package.json +4 -2
package/dist/ui.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { CodeProps } from '@mantine/core';
|
|
|
14
14
|
import { Command } from '@codemirror/view';
|
|
15
15
|
import { ComponentPropsWithoutRef } from 'react';
|
|
16
16
|
import { ComponentType } from 'react';
|
|
17
|
+
import { Context } from 'react';
|
|
17
18
|
import { CSSProperties } from 'react';
|
|
18
19
|
import { CSSVariablesResolver } from '@mantine/core';
|
|
19
20
|
import { default as default_2 } from 'github-slugger';
|
|
@@ -57,6 +58,7 @@ import { TimelineProps } from '@mantine/core';
|
|
|
57
58
|
import { TitleOrder } from '@mantine/core';
|
|
58
59
|
import { TitleProps } from '@mantine/core';
|
|
59
60
|
import { Tree } from '@lezer/common';
|
|
61
|
+
import { UnstyledButtonProps } from '@mantine/core';
|
|
60
62
|
import { VariantColorsResolver } from '@mantine/core';
|
|
61
63
|
import { VideoHTMLAttributes } from 'react';
|
|
62
64
|
|
|
@@ -65,6 +67,9 @@ import { VideoHTMLAttributes } from 'react';
|
|
|
65
67
|
*/
|
|
66
68
|
export declare const acceptWithTab: KeyBinding;
|
|
67
69
|
|
|
70
|
+
/** The tile types a context can use and the viewer may see: what an add drawer offers. */
|
|
71
|
+
export declare function addableTiles<Context>(registry: TileRegistry<Context>, context: Context): TileRegistry<Context>;
|
|
72
|
+
|
|
68
73
|
/**
|
|
69
74
|
* Add cursor above the current line
|
|
70
75
|
*/
|
|
@@ -80,6 +85,23 @@ export declare const addCursorBelow: Command;
|
|
|
80
85
|
*/
|
|
81
86
|
export declare const addCursorVerticallyKeymap: readonly KeyBinding[];
|
|
82
87
|
|
|
88
|
+
/** Adds a tile in the first free spot that holds it. */
|
|
89
|
+
export declare function addTile(tiles: readonly TileValue[], tile: Omit<TileValue, "x" | "y" | "w" | "h">, size: TileSize, columns: number): TileValue[];
|
|
90
|
+
|
|
91
|
+
export declare interface AddTileOptions<Context> {
|
|
92
|
+
registry: TileRegistry<Context>;
|
|
93
|
+
tiles: readonly TileValue[];
|
|
94
|
+
context: Context;
|
|
95
|
+
onAdd: (type: string, config?: Record<string, unknown>) => void;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Searches the tiles the viewer may add and adds the one chosen, asking for its settings
|
|
100
|
+
* first when its type has a configurator. Tiles the viewer may not see are not offered,
|
|
101
|
+
* and those already on the grid sink to the bottom, marked as added.
|
|
102
|
+
*/
|
|
103
|
+
export declare function AddTilePicker<Context>({ registry, tiles, context, onAdd, }: AddTileOptions<Context>): ReactNode;
|
|
104
|
+
|
|
83
105
|
declare type AnyFn = (...rest: any[]) => any;
|
|
84
106
|
|
|
85
107
|
/**
|
|
@@ -133,6 +155,9 @@ export declare interface ArrowButtonProps extends ButtonProps, ElementProps<"but
|
|
|
133
155
|
external?: boolean;
|
|
134
156
|
}
|
|
135
157
|
|
|
158
|
+
/** The tile types a context can use. */
|
|
159
|
+
export declare function availableTiles<Context>(registry: TileRegistry<Context>, context: Context): TileRegistry<Context>;
|
|
160
|
+
|
|
136
161
|
export declare interface BooleanHandle {
|
|
137
162
|
open: () => void;
|
|
138
163
|
close: () => void;
|
|
@@ -484,6 +509,9 @@ export declare interface BuildTimelineDisplayListOptions<T> {
|
|
|
484
509
|
*/
|
|
485
510
|
declare type CalloutKind = "note" | "tip" | "important" | "warning" | "caution";
|
|
486
511
|
|
|
512
|
+
/** Whether another tile of the type may be added to the tiles. */
|
|
513
|
+
export declare function canAddTile<Context>(type: TileType<never, Context>, tiles: readonly TileValue[]): boolean;
|
|
514
|
+
|
|
487
515
|
export declare const CDN_ID_PATTERN: RegExp;
|
|
488
516
|
|
|
489
517
|
export declare const CDN_URL_PATTERN: RegExp;
|
|
@@ -508,6 +536,9 @@ declare interface ChoiceNode {
|
|
|
508
536
|
children: RailroadNode[];
|
|
509
537
|
}
|
|
510
538
|
|
|
539
|
+
/** Keeps a size within a tile type's limits and the grid's width. */
|
|
540
|
+
export declare function clampSize(size: TileSize, limits: TileLimits, columns: number): TileSize;
|
|
541
|
+
|
|
511
542
|
export declare function clsx(...args: unknown[]): string;
|
|
512
543
|
|
|
513
544
|
/** A read-only code panel with a caption and a copy button. */
|
|
@@ -634,6 +665,9 @@ declare interface CommentNode {
|
|
|
634
665
|
*/
|
|
635
666
|
export declare const commonExtensions: () => Extension;
|
|
636
667
|
|
|
668
|
+
/** Lifts every tile as far up as it can go, so no tile leaves a gap above it. */
|
|
669
|
+
export declare function compactTiles(tiles: readonly TileValue[]): TileValue[];
|
|
670
|
+
|
|
637
671
|
export declare function ConfirmationProvider({ enterConfirms, children, }: PropsWithChildren<ConfirmationProviderProps>): ReactNode;
|
|
638
672
|
|
|
639
673
|
export declare interface ConfirmationProviderProps {
|
|
@@ -654,6 +688,9 @@ export declare interface ConfirmOptions<T> {
|
|
|
654
688
|
onConfirm: (value: T) => void;
|
|
655
689
|
}
|
|
656
690
|
|
|
691
|
+
/** The number of rows the tiles reach down to. */
|
|
692
|
+
export declare function countRows(tiles: readonly TileRect[]): number;
|
|
693
|
+
|
|
657
694
|
/**
|
|
658
695
|
* Open ephemeral overlays that would be covered by `topId` — they should close
|
|
659
696
|
* instead of staying mounted behind the new top.
|
|
@@ -685,6 +722,9 @@ export declare function createSerializedState(doc: string): EditorStateSnapshot;
|
|
|
685
722
|
*/
|
|
686
723
|
export declare function createStyleHighlighter(style?: HighlightStyle): Highlighter;
|
|
687
724
|
|
|
725
|
+
/** Adds a tile of the type at its default size, in the first free spot. */
|
|
726
|
+
export declare function createTile<Context>(registry: TileRegistry<Context>, tiles: readonly TileValue[], typeId: string, config?: Record<string, unknown>, columns?: number): TileValue[];
|
|
727
|
+
|
|
688
728
|
/**
|
|
689
729
|
* An island is made by setting the CSS `color-scheme` property, never by
|
|
690
730
|
* stamping a data attribute. See doc/adr/0001-light-dark-color-scheme-islands.md.
|
|
@@ -724,6 +764,9 @@ export declare type DefaultSort = {
|
|
|
724
764
|
[key: string]: unknown;
|
|
725
765
|
};
|
|
726
766
|
|
|
767
|
+
/** Erases a tile type's config so types of different configs can share a registry. */
|
|
768
|
+
export declare function defineTile<Config, Context>(type: TileType<Config, Context>): TileType<never, Context>;
|
|
769
|
+
|
|
727
770
|
/** A flat, square disclosure panel for collapsible content. */
|
|
728
771
|
export declare const Details: MantineComponent<DetailsFactory>;
|
|
729
772
|
|
|
@@ -1006,6 +1049,12 @@ export declare type EyebrowStylesNames = "root";
|
|
|
1006
1049
|
/** Case-insensitive filter over command titles and keywords. */
|
|
1007
1050
|
export declare function filterSlashCommands(commands: readonly SlashCommand[], query: string): SlashCommand[];
|
|
1008
1051
|
|
|
1052
|
+
/** Finds the first cell, reading left to right and top to bottom, a rectangle fits in. */
|
|
1053
|
+
export declare function findFreeSpot(tiles: readonly TileRect[], size: TileSize, columns: number): {
|
|
1054
|
+
x: number;
|
|
1055
|
+
y: number;
|
|
1056
|
+
};
|
|
1057
|
+
|
|
1009
1058
|
/** Human-readable reading time label, e.g. `5 min read`. */
|
|
1010
1059
|
export declare function formatMarkdownReadTime(markdown: string): string;
|
|
1011
1060
|
|
|
@@ -1561,6 +1610,9 @@ export declare function isCDNId(query: string): boolean;
|
|
|
1561
1610
|
/** True when the registered component declares `block: true`. */
|
|
1562
1611
|
export declare function isMarkdownComponentBlock(components: MarkdownComponents | undefined, name: string): boolean;
|
|
1563
1612
|
|
|
1613
|
+
/** Whether two layouts hold the same tiles in the same places, with the same configs. */
|
|
1614
|
+
export declare function isSameLayout(a: readonly TileValue[], b: readonly TileValue[]): boolean;
|
|
1615
|
+
|
|
1564
1616
|
/**
|
|
1565
1617
|
* Returns whether the given URL points at a recognised video container.
|
|
1566
1618
|
*/
|
|
@@ -1571,9 +1623,18 @@ export declare type JsxMode = "render" | "throw" | "graceful" | "omit";
|
|
|
1571
1623
|
|
|
1572
1624
|
declare type Language = "csharp" | "rust" | "javascript" | "typescript" | "surrealql" | "json" | "yaml" | "java" | "go" | "python" | "html" | "bash" | "cli" | "php" | "markdown" | "syntax";
|
|
1573
1625
|
|
|
1626
|
+
/**
|
|
1627
|
+
* Lays the specified tiles out in order, at the type's default size unless a spec gives one.
|
|
1628
|
+
* Specs of a type the registry does not hold are skipped, so a preset can name tiles only
|
|
1629
|
+
* some contexts have.
|
|
1630
|
+
*/
|
|
1631
|
+
export declare function layoutTiles<Context>(registry: TileRegistry<Context>, specs: readonly TileSpec[], columns?: number): TileValue[];
|
|
1632
|
+
|
|
1574
1633
|
/** Surreal Lilac — the primary action color, and the Database product color. */
|
|
1575
1634
|
export declare const LILAC: MantineColorsTuple;
|
|
1576
1635
|
|
|
1636
|
+
export declare function limitsOfTile<Context>(registry: TileRegistry<Context>, type: string): TileLimits | undefined;
|
|
1637
|
+
|
|
1577
1638
|
/**
|
|
1578
1639
|
* A whole card that is one link.
|
|
1579
1640
|
*
|
|
@@ -2070,6 +2131,12 @@ export declare class MiniController {
|
|
|
2070
2131
|
executeQuery(query: string): void;
|
|
2071
2132
|
}
|
|
2072
2133
|
|
|
2134
|
+
/** Moves a tile to a cell, displacing what is in its way. Its size is kept. */
|
|
2135
|
+
export declare function moveTile(tiles: readonly TileValue[], id: string, to: {
|
|
2136
|
+
x: number;
|
|
2137
|
+
y: number;
|
|
2138
|
+
}, columns: number): TileValue[];
|
|
2139
|
+
|
|
2073
2140
|
/**
|
|
2074
2141
|
* Drops a run of text to the secondary color.
|
|
2075
2142
|
*
|
|
@@ -2099,6 +2166,12 @@ declare interface NonTerminalNode {
|
|
|
2099
2166
|
text: string;
|
|
2100
2167
|
}
|
|
2101
2168
|
|
|
2169
|
+
/**
|
|
2170
|
+
* Makes stored tiles safe to draw: sizes are brought within each type's limits,
|
|
2171
|
+
* repeated ids and unknown types are dropped, and overlaps are resolved.
|
|
2172
|
+
*/
|
|
2173
|
+
export declare function normaliseTiles(tiles: readonly TileValue[], limitsOf: (type: string) => TileLimits | undefined, columns: number): TileValue[];
|
|
2174
|
+
|
|
2102
2175
|
/** A callout that flags a note, a tip, or something important, risky or dangerous. */
|
|
2103
2176
|
export declare const Note: MantineComponent<NoteFactory>;
|
|
2104
2177
|
|
|
@@ -2156,6 +2229,9 @@ declare interface OptionalNode {
|
|
|
2156
2229
|
child: RailroadNode;
|
|
2157
2230
|
}
|
|
2158
2231
|
|
|
2232
|
+
/** Lays tiles out left to right in the order given, wrapping onto a new row when one does not fit. */
|
|
2233
|
+
export declare function packTiles(drafts: readonly TileDraft[], columns: number): TileValue[];
|
|
2234
|
+
|
|
2159
2235
|
/**
|
|
2160
2236
|
* Parse a fenced code info string such as `surql runnable="SELECT 1"`,
|
|
2161
2237
|
* `js title="Example"`, or `ts runnable` into a language plus an attribute map.
|
|
@@ -2736,6 +2812,9 @@ export declare type RailroadDiagramStylesNames = "root" | "diagram" | "terminal"
|
|
|
2736
2812
|
|
|
2737
2813
|
export declare type RailroadNode = DiagramNode | SequenceNode | TerminalNode | NonTerminalNode | OptionalNode | ChoiceNode | OneOrMoreNode | ZeroOrMoreNode | CommentNode;
|
|
2738
2814
|
|
|
2815
|
+
/** Resizes a tile within its limits and the grid, displacing what is in its way. */
|
|
2816
|
+
export declare function resizeTile(tiles: readonly TileValue[], id: string, size: TileSize, limits: TileLimits, columns: number): TileValue[];
|
|
2817
|
+
|
|
2739
2818
|
/**
|
|
2740
2819
|
* Normalises a renderer registration, so a bare component and a config object
|
|
2741
2820
|
* are handled identically downstream.
|
|
@@ -3750,6 +3829,393 @@ export declare interface ThemedImageProps extends BoxProps, StylesApiProps<Theme
|
|
|
3750
3829
|
|
|
3751
3830
|
export declare type ThemedImageStylesNames = "root" | "light" | "dark";
|
|
3752
3831
|
|
|
3832
|
+
export declare const TILE_COLUMN_GAP = 32;
|
|
3833
|
+
|
|
3834
|
+
export declare const TILE_GRID_COLUMNS = 12;
|
|
3835
|
+
|
|
3836
|
+
/** Row heights in a tile's lists: a regular row of two lines, and a compact one of one. */
|
|
3837
|
+
export declare const TILE_ROW_HEIGHT: {
|
|
3838
|
+
readonly regular: 56;
|
|
3839
|
+
readonly compact: 44;
|
|
3840
|
+
};
|
|
3841
|
+
|
|
3842
|
+
export declare const TILE_STAT_HEIGHT = 84;
|
|
3843
|
+
|
|
3844
|
+
/** A tile's header action: an icon that names itself on hover. */
|
|
3845
|
+
export declare const TileAction: FC<TileActionProps>;
|
|
3846
|
+
|
|
3847
|
+
export declare interface TileActionProps {
|
|
3848
|
+
label: string;
|
|
3849
|
+
icon: string;
|
|
3850
|
+
onClick: () => void;
|
|
3851
|
+
/** Why the action is unavailable. It stays visible, and says why. */
|
|
3852
|
+
blockedReason?: string;
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3855
|
+
/**
|
|
3856
|
+
* A tile with nothing to show but a line of text, such as one whose subject is
|
|
3857
|
+
* gone or that the viewer may not see.
|
|
3858
|
+
*/
|
|
3859
|
+
export declare const TileBlank: FC<TileBlankProps>;
|
|
3860
|
+
|
|
3861
|
+
export declare interface TileBlankProps {
|
|
3862
|
+
/** Names the tile for the controls that act on it. */
|
|
3863
|
+
label: string;
|
|
3864
|
+
children: ReactNode;
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3867
|
+
/** The pixels a tile's content has to fill. */
|
|
3868
|
+
export declare interface TileBody {
|
|
3869
|
+
width: number;
|
|
3870
|
+
height: number;
|
|
3871
|
+
}
|
|
3872
|
+
|
|
3873
|
+
/** A labelled group of menu items to pick one choice from, the chosen one checked. */
|
|
3874
|
+
export declare function TileChoiceOptions<T extends string>({ label, choices, value, onChange, }: TileChoiceOptionsProps<T>): ReactNode;
|
|
3875
|
+
|
|
3876
|
+
export declare interface TileChoiceOptionsProps<T extends string> {
|
|
3877
|
+
label: string;
|
|
3878
|
+
choices: readonly {
|
|
3879
|
+
value: T;
|
|
3880
|
+
label: string;
|
|
3881
|
+
}[];
|
|
3882
|
+
value: T;
|
|
3883
|
+
onChange: (value: T) => void;
|
|
3884
|
+
}
|
|
3885
|
+
|
|
3886
|
+
export declare const TileChromeContext: Context<TileChromeValue | null>;
|
|
3887
|
+
|
|
3888
|
+
export declare interface TileChromeValue {
|
|
3889
|
+
/** The menu of the tile's options, and of removing it. */
|
|
3890
|
+
menu: (label: string) => ReactNode;
|
|
3891
|
+
}
|
|
3892
|
+
|
|
3893
|
+
export declare interface TileConfiguratorProps<Config, Context> {
|
|
3894
|
+
context: Context;
|
|
3895
|
+
/** Finishes adding the tile with the settings chosen. */
|
|
3896
|
+
onSubmit: (config: Config) => void;
|
|
3897
|
+
}
|
|
3898
|
+
|
|
3899
|
+
/** A day of the month under its month, the way a calendar page shows it. */
|
|
3900
|
+
export declare const TileDateBlock: FC<TileDateBlockProps>;
|
|
3901
|
+
|
|
3902
|
+
export declare interface TileDateBlockProps {
|
|
3903
|
+
date: Date;
|
|
3904
|
+
}
|
|
3905
|
+
|
|
3906
|
+
export declare interface TileDraft {
|
|
3907
|
+
id: string;
|
|
3908
|
+
type: string;
|
|
3909
|
+
config?: Record<string, unknown>;
|
|
3910
|
+
size: TileSize;
|
|
3911
|
+
}
|
|
3912
|
+
|
|
3913
|
+
/** What a tile says when it has nothing to show. */
|
|
3914
|
+
export declare const TileEmpty: FC<TileEmptyProps>;
|
|
3915
|
+
|
|
3916
|
+
export declare interface TileEmptyProps {
|
|
3917
|
+
title?: string;
|
|
3918
|
+
children: ReactNode;
|
|
3919
|
+
/** A primary action is the tile's call to action, drawn in its accent. */
|
|
3920
|
+
action?: {
|
|
3921
|
+
label: string;
|
|
3922
|
+
onClick: () => void;
|
|
3923
|
+
isPrimary?: boolean;
|
|
3924
|
+
};
|
|
3925
|
+
}
|
|
3926
|
+
|
|
3927
|
+
export declare interface TileFactProps {
|
|
3928
|
+
label: string;
|
|
3929
|
+
value: ReactNode;
|
|
3930
|
+
}
|
|
3931
|
+
|
|
3932
|
+
/** Labelled values, one to a line, divided by hairlines; as many as fit. */
|
|
3933
|
+
export declare const TileFacts: FC<{
|
|
3934
|
+
facts: TileFactProps[];
|
|
3935
|
+
}>;
|
|
3936
|
+
|
|
3937
|
+
export declare interface TileFooterLink {
|
|
3938
|
+
label: string;
|
|
3939
|
+
onClick: () => void;
|
|
3940
|
+
}
|
|
3941
|
+
|
|
3942
|
+
/**
|
|
3943
|
+
* The frame every tile draws in: one surface holding a header with the title,
|
|
3944
|
+
* the tile's actions and its menu, a content area that is measured so the tile
|
|
3945
|
+
* can fit what it shows to the space it was given, and a footer link. The
|
|
3946
|
+
* content area clips; a tile that scrolls its list does so itself.
|
|
3947
|
+
*/
|
|
3948
|
+
export declare const TileFrame: FC<TileFrameProps>;
|
|
3949
|
+
|
|
3950
|
+
export declare interface TileFrameProps extends PropsWithChildren {
|
|
3951
|
+
title: ReactNode;
|
|
3952
|
+
/** Names the tile for the controls that act on it. Defaults to a string title. */
|
|
3953
|
+
label?: string;
|
|
3954
|
+
/** How many of something the tile is about, shown beside its title. */
|
|
3955
|
+
count?: number;
|
|
3956
|
+
/**
|
|
3957
|
+
* The product accent the tile takes (`data-surreal-accent`), such as `database` or
|
|
3958
|
+
* `memory`. A tile without one keeps its footer link neutral.
|
|
3959
|
+
*/
|
|
3960
|
+
accent?: string;
|
|
3961
|
+
/** Small controls at the header's trailing edge, before the tile's menu. */
|
|
3962
|
+
actions?: ReactNode;
|
|
3963
|
+
/** The way on to everything the tile summarises, kept at its bottom edge. */
|
|
3964
|
+
footer?: TileFooterLink;
|
|
3965
|
+
/**
|
|
3966
|
+
* Draws the content on one line beside the menu, with no title or footer, for a tile one
|
|
3967
|
+
* row tall such as a search box. The title still names the tile for its controls.
|
|
3968
|
+
*/
|
|
3969
|
+
isInline?: boolean;
|
|
3970
|
+
}
|
|
3971
|
+
|
|
3972
|
+
/**
|
|
3973
|
+
* A grid of tiles that each span any number of cells, within the limits of their
|
|
3974
|
+
* type. The grid fills the width it is given, so its cells stretch with the
|
|
3975
|
+
* viewport. It knows nothing of what the tiles show: the registry says that.
|
|
3976
|
+
*/
|
|
3977
|
+
export declare function TileGrid<Context>({ registry, value, onChange, context, onRemoved, isLocked, columns, rowHeight, gap, compactBelow, deniedMessage, }: TileGridProps<Context>): ReactNode;
|
|
3978
|
+
|
|
3979
|
+
export declare interface TileGridProps<Context> {
|
|
3980
|
+
/** The kinds of tile the grid can draw. */
|
|
3981
|
+
registry: TileRegistry<Context>;
|
|
3982
|
+
/** The tiles on the grid. Tiles of a type the registry does not know, or reports unavailable, are not drawn. */
|
|
3983
|
+
value: readonly TileValue[];
|
|
3984
|
+
onChange: (tiles: TileValue[]) => void;
|
|
3985
|
+
/** Handed to every tile of a type that wants it. */
|
|
3986
|
+
context: Context;
|
|
3987
|
+
/** Called after a tile is removed, with the tiles as they were, so the host can offer to undo it. */
|
|
3988
|
+
onRemoved?: (tile: TileValue, previous: TileValue[]) => void;
|
|
3989
|
+
/** Fixes the tiles in place: nothing can be moved, resized or removed, and no handles show. */
|
|
3990
|
+
isLocked?: boolean;
|
|
3991
|
+
columns?: number;
|
|
3992
|
+
/** The height of one row of cells, in pixels. */
|
|
3993
|
+
rowHeight?: number;
|
|
3994
|
+
gap?: number;
|
|
3995
|
+
/** Below this width the grid is one column of tiles, still as tall as their rows. */
|
|
3996
|
+
compactBelow?: number;
|
|
3997
|
+
/** What a tile the viewer may not see says in place of its content. */
|
|
3998
|
+
deniedMessage?: ReactNode;
|
|
3999
|
+
}
|
|
4000
|
+
|
|
4001
|
+
/** A tile's leading figure: large, with a word beside it and a line under it. */
|
|
4002
|
+
export declare const TileHeadline: FC<TileHeadlineProps>;
|
|
4003
|
+
|
|
4004
|
+
export declare interface TileHeadlineProps {
|
|
4005
|
+
value: ReactNode;
|
|
4006
|
+
/** Beside the figure, such as what it is out of, or how far it moved. */
|
|
4007
|
+
aside?: ReactNode;
|
|
4008
|
+
/** Under the figure, such as the period it covers. */
|
|
4009
|
+
caption?: ReactNode;
|
|
4010
|
+
}
|
|
4011
|
+
|
|
4012
|
+
/** The size limits of a tile type, in cells. */
|
|
4013
|
+
export declare interface TileLimits {
|
|
4014
|
+
min: TileSize;
|
|
4015
|
+
max: TileSize;
|
|
4016
|
+
}
|
|
4017
|
+
|
|
4018
|
+
/**
|
|
4019
|
+
* Lists as many items as the tile has room for, in as many columns as its
|
|
4020
|
+
* width allows, filling each column top to bottom, and the tile's footer leads
|
|
4021
|
+
* to the rest. A scrollable list shows them all instead, row by row.
|
|
4022
|
+
*/
|
|
4023
|
+
export declare function TileList<T>({ items, rowHeight, columnWidth, maxColumns, isPending, isScrollable, empty, renderItem, itemKey, }: TileListProps<T>): ReactNode;
|
|
4024
|
+
|
|
4025
|
+
export declare interface TileListProps<T> {
|
|
4026
|
+
items: readonly T[];
|
|
4027
|
+
rowHeight?: number;
|
|
4028
|
+
/** The narrowest a column may get before the list drops to fewer. */
|
|
4029
|
+
columnWidth?: number;
|
|
4030
|
+
maxColumns?: number;
|
|
4031
|
+
isPending?: boolean;
|
|
4032
|
+
/** Lists every item, row by row, scrolling once they outgrow the tile. */
|
|
4033
|
+
isScrollable?: boolean;
|
|
4034
|
+
/** Shown in place of the list while there is nothing in it. */
|
|
4035
|
+
empty: ReactNode;
|
|
4036
|
+
renderItem: (item: T) => ReactNode;
|
|
4037
|
+
itemKey: (item: T) => string;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
export declare interface TileOptionsProps<Config> {
|
|
4041
|
+
config: Config;
|
|
4042
|
+
onChange: (config: Config) => void;
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
/** What a tile's component is given to draw itself. */
|
|
4046
|
+
export declare interface TileProps<Config, Context> {
|
|
4047
|
+
/** The tile's own settings, such as the instance it shows. */
|
|
4048
|
+
config: Config;
|
|
4049
|
+
/** Whatever the host handed the grid, for tiles that need more than their config. */
|
|
4050
|
+
context: Context;
|
|
4051
|
+
/** The cells the tile covers. Its measured pixels are read with `useTileBody`. */
|
|
4052
|
+
size: TileSize;
|
|
4053
|
+
}
|
|
4054
|
+
|
|
4055
|
+
/** A rectangle of cells: its top-left cell and how many columns and rows it spans. */
|
|
4056
|
+
export declare interface TileRect {
|
|
4057
|
+
x: number;
|
|
4058
|
+
y: number;
|
|
4059
|
+
w: number;
|
|
4060
|
+
h: number;
|
|
4061
|
+
}
|
|
4062
|
+
|
|
4063
|
+
/** The kinds of tile a grid knows. */
|
|
4064
|
+
export declare type TileRegistry<Context = unknown> = readonly TileType<never, Context>[];
|
|
4065
|
+
|
|
4066
|
+
/** One line of a tile's list, divided from the next by a hairline. */
|
|
4067
|
+
export declare const TileRow: FC<TileRowProps>;
|
|
4068
|
+
|
|
4069
|
+
/**
|
|
4070
|
+
* The clickable shell every row in a tile shares: inset from the hairlines
|
|
4071
|
+
* around it, so its hover never touches them. Rows lay their content out inside.
|
|
4072
|
+
*/
|
|
4073
|
+
export declare const TileRowButton: FC<PropsWithChildren<UnstyledButtonProps & {
|
|
4074
|
+
className?: string;
|
|
4075
|
+
onClick?: () => void;
|
|
4076
|
+
}>>;
|
|
4077
|
+
|
|
4078
|
+
/** A row's leading icon. */
|
|
4079
|
+
export declare const TileRowIcon: FC<TileRowIconProps>;
|
|
4080
|
+
|
|
4081
|
+
export declare interface TileRowIconProps {
|
|
4082
|
+
path: string;
|
|
4083
|
+
/** The product the row's subject belongs to, which colours the icon. Muted without one. */
|
|
4084
|
+
accent?: string;
|
|
4085
|
+
isDimmed?: boolean;
|
|
4086
|
+
}
|
|
4087
|
+
|
|
4088
|
+
export declare interface TileRowProps {
|
|
4089
|
+
leading?: ReactNode;
|
|
4090
|
+
title: ReactNode;
|
|
4091
|
+
/** Sits beside the title, such as a state. */
|
|
4092
|
+
badge?: ReactNode;
|
|
4093
|
+
subtitle?: ReactNode;
|
|
4094
|
+
/** Sits at the trailing edge, such as a region or a time. */
|
|
4095
|
+
trailing?: string;
|
|
4096
|
+
/** The trailing marker of a row that leads somewhere. Defaults to a chevron. */
|
|
4097
|
+
marker?: string | null;
|
|
4098
|
+
isDimmed?: boolean;
|
|
4099
|
+
onClick?: () => void;
|
|
4100
|
+
}
|
|
4101
|
+
|
|
4102
|
+
/**
|
|
4103
|
+
* Parses a tile's stored config. Shaped like a zod schema's `safeParse`, so a
|
|
4104
|
+
* zod schema can be passed as it is without the kit depending on zod.
|
|
4105
|
+
*/
|
|
4106
|
+
export declare interface TileSchema<Config> {
|
|
4107
|
+
safeParse: (input: unknown) => {
|
|
4108
|
+
success: true;
|
|
4109
|
+
data: Config;
|
|
4110
|
+
} | {
|
|
4111
|
+
success: false;
|
|
4112
|
+
};
|
|
4113
|
+
}
|
|
4114
|
+
|
|
4115
|
+
/**
|
|
4116
|
+
* Every item as rows of a fixed height, scrolling once they outgrow the space
|
|
4117
|
+
* left to them. The scrollbar sits in the tile's trailing padding rather than
|
|
4118
|
+
* over the rows.
|
|
4119
|
+
*/
|
|
4120
|
+
export declare function TileScrollRows<T>({ items, rowHeight, columns, isDivided, renderItem, itemKey, }: TileScrollRowsProps<T>): ReactNode;
|
|
4121
|
+
|
|
4122
|
+
export declare interface TileScrollRowsProps<T> {
|
|
4123
|
+
items: readonly T[];
|
|
4124
|
+
rowHeight: number;
|
|
4125
|
+
columns?: number;
|
|
4126
|
+
/** Divides the rows with hairlines. */
|
|
4127
|
+
isDivided?: boolean;
|
|
4128
|
+
renderItem: (item: T) => ReactNode;
|
|
4129
|
+
itemKey: (item: T) => string;
|
|
4130
|
+
}
|
|
4131
|
+
|
|
4132
|
+
/** How many cells a tile spans. */
|
|
4133
|
+
export declare interface TileSize {
|
|
4134
|
+
cols: number;
|
|
4135
|
+
rows: number;
|
|
4136
|
+
}
|
|
4137
|
+
|
|
4138
|
+
export declare interface TileSpec {
|
|
4139
|
+
type: string;
|
|
4140
|
+
config?: Record<string, unknown>;
|
|
4141
|
+
/** Overrides the type's default size, in columns and rows. */
|
|
4142
|
+
size?: [cols: number, rows: number];
|
|
4143
|
+
}
|
|
4144
|
+
|
|
4145
|
+
/** A labelled figure, large and in tabular numbers. */
|
|
4146
|
+
export declare const TileStat: FC<TileStatProps & {
|
|
4147
|
+
isLeading?: boolean;
|
|
4148
|
+
}>;
|
|
4149
|
+
|
|
4150
|
+
/**
|
|
4151
|
+
* Lays figures out in rows divided by hairlines: as many to a row as fit, but
|
|
4152
|
+
* fewer when that would leave the last row ragged and the rows still fit.
|
|
4153
|
+
*/
|
|
4154
|
+
export declare const TileStatGrid: FC<{
|
|
4155
|
+
stats: TileStatProps[];
|
|
4156
|
+
minWidth?: number;
|
|
4157
|
+
}>;
|
|
4158
|
+
|
|
4159
|
+
export declare interface TileStatProps {
|
|
4160
|
+
label: string;
|
|
4161
|
+
value: ReactNode;
|
|
4162
|
+
caption?: ReactNode;
|
|
4163
|
+
}
|
|
4164
|
+
|
|
4165
|
+
/** A tile title led by an icon in the tile's accent, for tiles about one thing. */
|
|
4166
|
+
export declare const TileTitleIcon: FC<TileTitleIconProps>;
|
|
4167
|
+
|
|
4168
|
+
export declare interface TileTitleIconProps {
|
|
4169
|
+
path: string;
|
|
4170
|
+
children: ReactNode;
|
|
4171
|
+
}
|
|
4172
|
+
|
|
4173
|
+
/** A menu item that switches something on or off, checked while it is on. */
|
|
4174
|
+
export declare const TileToggleOption: FC<PropsWithChildren<{
|
|
4175
|
+
checked: boolean;
|
|
4176
|
+
onChange: (checked: boolean) => void;
|
|
4177
|
+
}>>;
|
|
4178
|
+
|
|
4179
|
+
/** One kind of tile a grid can hold. */
|
|
4180
|
+
export declare interface TileType<Config = unknown, Context = unknown> extends TileLimits {
|
|
4181
|
+
id: string;
|
|
4182
|
+
title: string;
|
|
4183
|
+
description: string;
|
|
4184
|
+
/**
|
|
4185
|
+
* The heading the add drawer lists the type under. Headings appear in the order of their
|
|
4186
|
+
* first type in the registry; types without one come under no heading.
|
|
4187
|
+
*/
|
|
4188
|
+
category?: string;
|
|
4189
|
+
/** Represents the type in the add drawer. An icon path from `@surrealdb/ui`. */
|
|
4190
|
+
icon: string;
|
|
4191
|
+
/** The size a new tile starts at. */
|
|
4192
|
+
size: TileSize;
|
|
4193
|
+
/** Parses a tile's stored config. A config that does not parse is replaced by `{}`. */
|
|
4194
|
+
schema?: TileSchema<Config>;
|
|
4195
|
+
component: FC<TileProps<Config, Context>>;
|
|
4196
|
+
/** Menu items shown above "Remove tile" in the tile's menu. */
|
|
4197
|
+
options?: FC<TileOptionsProps<Config>>;
|
|
4198
|
+
/** Asks which one the tile is for before it is added, for tiles that show a specific thing. */
|
|
4199
|
+
configurator?: FC<TileConfiguratorProps<Config, Context>>;
|
|
4200
|
+
/** Whether the grid may hold several tiles of this type. Otherwise there is at most one. */
|
|
4201
|
+
multiple?: boolean;
|
|
4202
|
+
/** Whether the type applies to the context at all. An unavailable type is not drawn or offered. */
|
|
4203
|
+
isAvailable?: (context: Context) => boolean;
|
|
4204
|
+
/**
|
|
4205
|
+
* Whether the viewer may see what the tile shows. A tile that is not permitted keeps its
|
|
4206
|
+
* place and says so, and its component never mounts, so it starts no requests. The add
|
|
4207
|
+
* drawer does not offer it.
|
|
4208
|
+
*/
|
|
4209
|
+
isPermitted?: (context: Context) => boolean;
|
|
4210
|
+
}
|
|
4211
|
+
|
|
4212
|
+
/** One tile of a grid: what it is, how it is set up, and where it sits. */
|
|
4213
|
+
export declare interface TileValue extends TileRect {
|
|
4214
|
+
id: string;
|
|
4215
|
+
type: string;
|
|
4216
|
+
config?: Record<string, unknown>;
|
|
4217
|
+
}
|
|
4218
|
+
|
|
3753
4219
|
/** The top-most open item, or undefined when nothing is open. */
|
|
3754
4220
|
export declare function topOpened(items: StackerItem[]): StackerItem | undefined;
|
|
3755
4221
|
|
|
@@ -3761,6 +4227,13 @@ export declare function trimCustomHeadingIdFromRange(source: {
|
|
|
3761
4227
|
customId?: string;
|
|
3762
4228
|
};
|
|
3763
4229
|
|
|
4230
|
+
/**
|
|
4231
|
+
* Returns an opener for the Stacker drawer that adds a tile to a grid. Needs a
|
|
4232
|
+
* `StackerProvider` above it; without one, put an {@link AddTilePicker} in a drawer of
|
|
4233
|
+
* your own.
|
|
4234
|
+
*/
|
|
4235
|
+
export declare function useAddTileDrawer<Context>(): (options: AddTileOptions<Context>) => void;
|
|
4236
|
+
|
|
3764
4237
|
/**
|
|
3765
4238
|
* Returns a function which can be used to trigger a confirmation dialog
|
|
3766
4239
|
*/
|
|
@@ -3849,6 +4322,9 @@ export declare function useSwitch(initialState?: boolean, callbacks?: {
|
|
|
3849
4322
|
onClose?: () => void;
|
|
3850
4323
|
}): readonly [boolean, BooleanHandle];
|
|
3851
4324
|
|
|
4325
|
+
/** The measured size of the content area of the tile it is called from. */
|
|
4326
|
+
export declare function useTileBody(): TileBody;
|
|
4327
|
+
|
|
3852
4328
|
/** A version string rendered as inline code. */
|
|
3853
4329
|
export declare const Version: MantineComponent<VersionFactory>;
|
|
3854
4330
|
|
|
@@ -3975,16 +4451,16 @@ declare module "@mantine/core" {
|
|
|
3975
4451
|
}
|
|
3976
4452
|
|
|
3977
4453
|
declare module "@mantine/core" {
|
|
3978
|
-
type
|
|
3979
|
-
interface
|
|
3980
|
-
|
|
3981
|
-
fontSizes: Record<ExtendedCustomSizes, string>;
|
|
4454
|
+
type ExtendedCustomColors = "pink" | "lilac" | "purple" | "violet" | "obsidian" | "slate" | import("@mantine/core").DefaultMantineColor;
|
|
4455
|
+
interface MantineThemeColorsOverride {
|
|
4456
|
+
colors: Record<ExtendedCustomColors, import("@mantine/core").MantineColorsTuple>;
|
|
3982
4457
|
}
|
|
3983
4458
|
}
|
|
3984
4459
|
|
|
3985
4460
|
declare module "@mantine/core" {
|
|
3986
|
-
type
|
|
3987
|
-
interface
|
|
3988
|
-
|
|
4461
|
+
type ExtendedCustomSizes = import("@mantine/core").DefaultMantineSize | "2xl" | "3xl" | "4xl" | "5xl";
|
|
4462
|
+
interface MantineThemeSizesOverride {
|
|
4463
|
+
spacing: Record<ExtendedCustomSizes, string>;
|
|
4464
|
+
fontSizes: Record<ExtendedCustomSizes, string>;
|
|
3989
4465
|
}
|
|
3990
4466
|
}
|