@raylang/elements 0.0.0-stage → 0.4.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/LICENSE +202 -0
- package/NOTICE +4 -0
- package/README.md +12 -2
- package/base.css +111 -0
- package/components/accordion/accordion.js +197 -0
- package/components/alert/alert.js +112 -0
- package/components/app-bar/app-bar.js +168 -0
- package/components/app-shell/app-shell.js +198 -0
- package/components/aspect-ratio/aspect-ratio.js +59 -0
- package/components/attachment/attachment.js +333 -0
- package/components/avatar/avatar.js +96 -0
- package/components/badge/badge.js +63 -0
- package/components/blockquote/blockquote.js +128 -0
- package/components/bottom-nav/bottom-nav.js +309 -0
- package/components/breadcrumbs/breadcrumbs.js +175 -0
- package/components/button/button.js +283 -0
- package/components/button-group/button-group.js +72 -0
- package/components/card/card.js +73 -0
- package/components/carousel/carousel.js +435 -0
- package/components/center/center.js +26 -0
- package/components/checkbox/checkbox.js +152 -0
- package/components/checkbox-group/checkbox-group.js +152 -0
- package/components/code/code.js +574 -0
- package/components/color-picker/color-picker.js +775 -0
- package/components/combobox/combobox.js +563 -0
- package/components/command-palette/command-palette.js +510 -0
- package/components/container/container.js +41 -0
- package/components/date-picker/date-picker.js +594 -0
- package/components/dialog/dialog.js +329 -0
- package/components/drawer/drawer.js +139 -0
- package/components/empty-state/empty-state.js +66 -0
- package/components/file-upload/file-upload.js +589 -0
- package/components/grid/grid.js +96 -0
- package/components/group/group.js +40 -0
- package/components/icon/icon.js +58 -0
- package/components/icon-button/icon-button.js +30 -0
- package/components/indicator/indicator.js +112 -0
- package/components/input/input.js +85 -0
- package/components/kbd/kbd.js +60 -0
- package/components/menu/menu.js +296 -0
- package/components/nav-link/nav-link.js +159 -0
- package/components/notification/notification.js +591 -0
- package/components/number-input/number-input.js +241 -0
- package/components/pagination/pagination.js +194 -0
- package/components/password-input/password-input.js +85 -0
- package/components/path-input/path-input.js +137 -0
- package/components/popover/popover.js +85 -0
- package/components/progress/progress.js +109 -0
- package/components/radio/radio.js +253 -0
- package/components/scroll-area/scroll-area.js +158 -0
- package/components/search/search.js +157 -0
- package/components/segmented-control/segmented-control.js +190 -0
- package/components/select/select.js +506 -0
- package/components/separator/separator.js +58 -0
- package/components/sidebar/sidebar.js +252 -0
- package/components/skeleton/skeleton.js +90 -0
- package/components/slider/slider.js +155 -0
- package/components/spinner/spinner.js +39 -0
- package/components/split/split.js +221 -0
- package/components/stack/stack.js +46 -0
- package/components/stat/stat.js +79 -0
- package/components/statusbar/statusbar.js +110 -0
- package/components/stepper/stepper.js +239 -0
- package/components/switch/switch.js +45 -0
- package/components/table/table.js +328 -0
- package/components/tabs/tabs.js +224 -0
- package/components/textarea/textarea.js +105 -0
- package/components/theme-toggle/theme-toggle.js +78 -0
- package/components/timeline/timeline.js +150 -0
- package/components/toggle/toggle.js +130 -0
- package/components/toggle-group/toggle-group.js +216 -0
- package/components/tooltip/tooltip.js +101 -0
- package/core/charts.js +107 -0
- package/core/color.js +110 -0
- package/core/core.js +556 -0
- package/core/dismiss.js +69 -0
- package/core/floating.js +195 -0
- package/core/focus.js +70 -0
- package/core/form.js +235 -0
- package/core/host.js +200 -0
- package/core/hotkey.js +40 -0
- package/core/icons.js +104 -0
- package/core/motion.js +73 -0
- package/core/position.js +91 -0
- package/core/raylang.js +167 -0
- package/core/scroll.js +58 -0
- package/core/styles.js +211 -0
- package/core.js +16 -0
- package/custom-elements.json +18545 -0
- package/index.js +74 -0
- package/package.json +312 -4
- package/ray-elements.d.ts +2570 -0
- package/tokens.css +796 -0
- package/tokens.json +2083 -0
- package/vscode.html-custom-data.json +5499 -0
|
@@ -0,0 +1,2570 @@
|
|
|
1
|
+
// Generated by ray-elements tools from src/core/core.d.ts and src/components/*/component.toml. Do not edit.
|
|
2
|
+
|
|
3
|
+
// Types of the ray-elements core runtime and extension API (core.js, form.js,
|
|
4
|
+
// floating.js, styles.js, position.js, focus.js, icons.js, host.js, raylang.js). Hand-written;
|
|
5
|
+
// the component declarations are generated after them into ray-elements.d.ts.
|
|
6
|
+
|
|
7
|
+
export declare const PREFIX: string;
|
|
8
|
+
export declare const THEME_EVENT: "ray-theme-change";
|
|
9
|
+
|
|
10
|
+
export type Theme = "light" | "dark" | "system";
|
|
11
|
+
export interface ThemeDetail {
|
|
12
|
+
theme: Theme;
|
|
13
|
+
resolved: "light" | "dark";
|
|
14
|
+
primary: string | null;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// --- styles and registration -------------------------------------------------
|
|
18
|
+
|
|
19
|
+
/** A constructable stylesheet from CSS text, shared by every user of the same text. */
|
|
20
|
+
export declare function css(strings: TemplateStringsArray | string, ...values: unknown[]): CSSStyleSheet;
|
|
21
|
+
/** The base sheet every component adopts first. */
|
|
22
|
+
export declare const hostStyles: CSSStyleSheet;
|
|
23
|
+
/** Registers a custom element unless the tag is already taken. */
|
|
24
|
+
export declare function define(tag: string, cls: CustomElementConstructor): void;
|
|
25
|
+
/** A document-unique id with the given stem. */
|
|
26
|
+
export declare function uid(stem?: string): string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* App-wide settings. `defaults` apply, per tag, to elements connected afterwards,
|
|
30
|
+
* for the properties their markup and code leave unset.
|
|
31
|
+
*/
|
|
32
|
+
export declare function configure(options?: { defaults?: Record<string, Record<string, unknown>> }): void;
|
|
33
|
+
/** The defaults configure() set for a tag. */
|
|
34
|
+
export declare function getDefaults(tag: string): Record<string, unknown>;
|
|
35
|
+
|
|
36
|
+
// --- theme -------------------------------------------------------------------
|
|
37
|
+
|
|
38
|
+
export declare function getTheme(el?: Element): Theme;
|
|
39
|
+
export declare function resolvedTheme(el?: Element): "light" | "dark";
|
|
40
|
+
export declare function setTheme(theme: Theme, options?: { el?: Element; persist?: boolean }): void;
|
|
41
|
+
export declare function getPrimary(el?: Element): string | null;
|
|
42
|
+
export declare function setPrimary(color: string | null, options?: { el?: Element; persist?: boolean }): void;
|
|
43
|
+
export declare function onThemeChange(cb: (detail: ThemeDetail) => void): () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Makes any CSS color the primary (data-primary="custom"): ten OKLCH shades,
|
|
46
|
+
* white or black text by contrast; warns below WCAG AA.
|
|
47
|
+
*/
|
|
48
|
+
export declare function definePrimary(
|
|
49
|
+
color: string,
|
|
50
|
+
options?: { el?: Element; persist?: boolean },
|
|
51
|
+
): { shades: string[]; filled: string; contrast: "white" | "black"; ratio: number; aa: boolean };
|
|
52
|
+
/** The color last given to definePrimary() for an element, as "#rrggbb" (null if none). */
|
|
53
|
+
export declare function getCustomPrimary(el?: Element): string | null;
|
|
54
|
+
|
|
55
|
+
// --- icons -------------------------------------------------------------------
|
|
56
|
+
|
|
57
|
+
/** Replaces or adds icons (SVG markup or an SVGElement); repaints every component. */
|
|
58
|
+
export declare function setIcons(icons: Record<string, string | SVGElement>): void;
|
|
59
|
+
/** The SVG markup of a registered icon ("" if unknown). */
|
|
60
|
+
export declare function getIcon(name: string): string;
|
|
61
|
+
/** The registered icon names. */
|
|
62
|
+
export declare function iconNames(): string[];
|
|
63
|
+
|
|
64
|
+
// --- base classes ------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
export interface PropertyOptions {
|
|
67
|
+
type?: StringConstructor | NumberConstructor | BooleanConstructor;
|
|
68
|
+
reflect?: boolean;
|
|
69
|
+
attribute?: string | false;
|
|
70
|
+
default?: unknown;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Base class of ray-elements components. Members whose name starts with `_` or `#`
|
|
75
|
+
* are internal: do not use them, and do not name your own members with `_`.
|
|
76
|
+
*/
|
|
77
|
+
export declare class RayElement extends HTMLElement {
|
|
78
|
+
static properties: Record<string, PropertyOptions>;
|
|
79
|
+
static styles: CSSStyleSheet[];
|
|
80
|
+
static template: string;
|
|
81
|
+
static delegatesFocus: boolean;
|
|
82
|
+
/** Adds stylesheets to this component and its subclasses, live instances included. */
|
|
83
|
+
static extendStyles(...sheets: CSSStyleSheet[]): void;
|
|
84
|
+
connectedCallback(): void;
|
|
85
|
+
disconnectedCallback(): void;
|
|
86
|
+
attributeChangedCallback(attr: string, old: string | null, value: string | null): void;
|
|
87
|
+
/** Schedules update() for the next microtask. */
|
|
88
|
+
requestUpdate(): void;
|
|
89
|
+
/** Protected: called after property changes with their previous values. */
|
|
90
|
+
protected update(changed: Map<string, unknown>): void;
|
|
91
|
+
/** Protected: sets a declared property without reflecting it (state changed by the user). */
|
|
92
|
+
commitProperty(name: string, value: unknown): boolean;
|
|
93
|
+
/** Protected: whether a declared property has its own value (not the default). */
|
|
94
|
+
hasValue(name: string): boolean;
|
|
95
|
+
/** Protected: fills [data-ray-icon] placeholders from the icon registry. */
|
|
96
|
+
paintIcons(root?: ParentNode): void;
|
|
97
|
+
/** Dispatches a bubbling, composed CustomEvent; false if a listener canceled it. */
|
|
98
|
+
emit<T = unknown>(type: string, detail?: T, options?: { cancelable?: boolean }): boolean;
|
|
99
|
+
/** querySelector inside the shadow root. */
|
|
100
|
+
$<E extends Element = HTMLElement>(selector: string): E | null;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** A form-associated ray-elements element (ElementInternals). */
|
|
104
|
+
export declare class FormControl extends RayElement {
|
|
105
|
+
static formAssociated: true;
|
|
106
|
+
readonly internals: ElementInternals;
|
|
107
|
+
readonly form: HTMLFormElement | null;
|
|
108
|
+
readonly validity: ValidityState;
|
|
109
|
+
readonly validationMessage: string;
|
|
110
|
+
readonly willValidate: boolean;
|
|
111
|
+
/** Disabled by its own attribute or by a disabled <fieldset>. */
|
|
112
|
+
readonly effectivelyDisabled: boolean;
|
|
113
|
+
checkValidity(): boolean;
|
|
114
|
+
reportValidity(): boolean;
|
|
115
|
+
/** Protected: re-dispatches a non-composed event (e.g. change) from the host. */
|
|
116
|
+
forward(event: Event): void;
|
|
117
|
+
formDisabledCallback(disabled: boolean): void;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A FormControl around one native control (#control in the shadow root),
|
|
122
|
+
* with label, description, error, required and their ARIA.
|
|
123
|
+
*/
|
|
124
|
+
export declare class FieldControl extends FormControl {
|
|
125
|
+
/** Spread into `static properties`: name, label, description, error, required, disabled, size, radius, variant. */
|
|
126
|
+
static fieldProperties: Record<string, PropertyOptions>;
|
|
127
|
+
/** The native control in the shadow root. */
|
|
128
|
+
readonly control: HTMLInputElement & HTMLTextAreaElement & HTMLSelectElement;
|
|
129
|
+
name: string | undefined;
|
|
130
|
+
label: string | undefined;
|
|
131
|
+
description: string | undefined;
|
|
132
|
+
error: string | undefined;
|
|
133
|
+
required: boolean | undefined;
|
|
134
|
+
disabled: boolean | undefined;
|
|
135
|
+
size: string;
|
|
136
|
+
radius: string | undefined;
|
|
137
|
+
variant: string;
|
|
138
|
+
descriptionPosition: string;
|
|
139
|
+
/** Protected hook: attach listeners once, on first connection. */
|
|
140
|
+
wire?(): void;
|
|
141
|
+
/** Protected: label, description, error, ARIA and validity (call from update). */
|
|
142
|
+
syncField(): void;
|
|
143
|
+
/** Protected: mirrors the native control's validity into the form. */
|
|
144
|
+
syncValidity(): void;
|
|
145
|
+
}
|
|
146
|
+
/** The field wrapper markup around `control` (an element with id="control" class="control"). */
|
|
147
|
+
export declare function fieldTemplate(control: string, options?: { sections?: boolean }): string;
|
|
148
|
+
export declare const fieldStyles: CSSStyleSheet;
|
|
149
|
+
export declare const boxStyles: CSSStyleSheet;
|
|
150
|
+
|
|
151
|
+
/** Base of trigger + floating panel components (Popover API, anchored placement). */
|
|
152
|
+
export declare class Floating extends RayElement {
|
|
153
|
+
/** popover attribute of the panel: "manual" (default; light dismiss and exit animation done by Floating) or "auto" (the browser's, no exit animation). */
|
|
154
|
+
static popoverMode: "auto" | "manual";
|
|
155
|
+
/** Close on Escape and outside presses (default true; tooltips: false). */
|
|
156
|
+
static lightDismiss: boolean;
|
|
157
|
+
/** aria-haspopup of the trigger (null: none). */
|
|
158
|
+
static haspopup: string | null;
|
|
159
|
+
/** Selector of the slot holding the trigger. */
|
|
160
|
+
static triggerSlot: string;
|
|
161
|
+
open: boolean | undefined;
|
|
162
|
+
placement: string;
|
|
163
|
+
offset: number;
|
|
164
|
+
/** The [popover] panel in the shadow root (set on connection). */
|
|
165
|
+
panel: HTMLElement;
|
|
166
|
+
readonly trigger: Element | null;
|
|
167
|
+
/** Whether focus was inside the panel when it started closing. */
|
|
168
|
+
focusWasInside: boolean | undefined;
|
|
169
|
+
show(): void;
|
|
170
|
+
hide(): void;
|
|
171
|
+
toggle(): void;
|
|
172
|
+
/** Places the panel again (scroll and resize already do it). */
|
|
173
|
+
reposition(): void;
|
|
174
|
+
/** Protected hooks. */
|
|
175
|
+
wireTrigger(trigger: Element): void;
|
|
176
|
+
anchorRect(): { left: number; top: number; right: number; bottom: number; width: number; height: number };
|
|
177
|
+
placeOptions(): PlaceOptions;
|
|
178
|
+
popupKind(): string | null;
|
|
179
|
+
toggled(open: boolean): void;
|
|
180
|
+
/** Keyframes the panel leaves with (default: fade + scale 0.97). */
|
|
181
|
+
exitKeyframes(): Keyframe[];
|
|
182
|
+
/** Whether the same pointer gesture just light-dismissed the panel. */
|
|
183
|
+
justClosed(): boolean;
|
|
184
|
+
}
|
|
185
|
+
export declare const floatingStyles: CSSStyleSheet;
|
|
186
|
+
|
|
187
|
+
// --- shared styles -----------------------------------------------------------
|
|
188
|
+
|
|
189
|
+
export declare const COLORS: string[];
|
|
190
|
+
export declare const VARIANT_TOKENS: string[];
|
|
191
|
+
/** Points an element's --_<variant> properties at a palette color, any CSS color, or the primary. */
|
|
192
|
+
export declare function applyColor(el: HTMLElement, color: string | undefined): void;
|
|
193
|
+
/** A spacing value as CSS: xs…xl as its --ray-space token, a bare number as px, else a CSS length; null when empty. */
|
|
194
|
+
export declare function spaceValue(value: string | number | undefined): string | null;
|
|
195
|
+
/** :host size scale: --_h, --_fs, --_px, --_gap by [size]. */
|
|
196
|
+
export declare const sizeStyles: CSSStyleSheet;
|
|
197
|
+
/** :host radius: --_r by [radius]. */
|
|
198
|
+
export declare const radiusStyles: CSSStyleSheet;
|
|
199
|
+
/** [data-variant] backgrounds/colors from the --_<variant> properties. */
|
|
200
|
+
export declare const variantStyles: CSSStyleSheet;
|
|
201
|
+
/** The backdrop of modal overlays: --ray-overlay and --ray-overlay-blur on dialog::backdrop. */
|
|
202
|
+
export declare const overlayStyles: CSSStyleSheet;
|
|
203
|
+
// --- motion and light dismiss ------------------------------------------------
|
|
204
|
+
|
|
205
|
+
/** A duration token in ms ("fast" | "base" | "slow"). */
|
|
206
|
+
export declare function duration(el: Element, name?: "fast" | "base" | "slow"): number;
|
|
207
|
+
/** False with reduced motion, a zero duration token or a hidden page. */
|
|
208
|
+
export declare function motionAllowed(el: Element, name?: "fast" | "base" | "slow"): boolean;
|
|
209
|
+
/** Plays keyframes (fill: forwards); resolves at once when motion is not allowed. Call cancel() after hiding. */
|
|
210
|
+
export declare function play(el: Element, keyframes: Keyframe[], options?: { speed?: "fast" | "base" | "slow"; ease?: "standard" | "in" | "out"; pseudoElement?: string }): { finished: Promise<void>; cancel(): void };
|
|
211
|
+
/** Waits for several play() results. */
|
|
212
|
+
export declare function playAll(list: Array<{ finished: Promise<void>; cancel(): void }>): { finished: Promise<void>; cancel(): void };
|
|
213
|
+
/** Fades and folds an element to zero height. */
|
|
214
|
+
export declare function collapseOut(el: Element, options?: { speed?: "fast" | "base" | "slow" }): { finished: Promise<void>; cancel(): void };
|
|
215
|
+
/** The default exit of floating panels. */
|
|
216
|
+
export declare const POP_OUT: Keyframe[];
|
|
217
|
+
/** Registers an open manual panel for Escape / outside-press dismissal; returns the unregister function. */
|
|
218
|
+
export declare function dismissable(entry: { panel: Element; owner: Element; trigger?: Element | null; close: (reason: "outside" | "escape" | "replaced") => void }): () => void;
|
|
219
|
+
|
|
220
|
+
/** Sets --ray-overlay-blur on an element: a number (px), a CSS length or "none"; empty removes it. */
|
|
221
|
+
export declare function applyOverlayBlur(el: HTMLElement, value: string | number | null | undefined): void;
|
|
222
|
+
/** A ring spinner: <span class="loader">. */
|
|
223
|
+
export declare const loaderStyles: CSSStyleSheet;
|
|
224
|
+
/** .sr-only: hidden but announced. */
|
|
225
|
+
export declare const srOnlyStyles: CSSStyleSheet;
|
|
226
|
+
|
|
227
|
+
// --- positioning and focus ---------------------------------------------------
|
|
228
|
+
|
|
229
|
+
export interface PlaceOptions {
|
|
230
|
+
placement?: string;
|
|
231
|
+
offset?: number;
|
|
232
|
+
padding?: number;
|
|
233
|
+
flip?: boolean;
|
|
234
|
+
matchWidth?: boolean;
|
|
235
|
+
}
|
|
236
|
+
export declare function place(
|
|
237
|
+
anchor: { left: number; top: number; right: number; bottom: number; width: number; height: number },
|
|
238
|
+
floating: HTMLElement,
|
|
239
|
+
options?: PlaceOptions,
|
|
240
|
+
): string;
|
|
241
|
+
export declare function pointRect(x: number, y: number): DOMRectReadOnly;
|
|
242
|
+
export declare function autoUpdate(anchor: Element | object, floating: HTMLElement, update: () => void): () => void;
|
|
243
|
+
/** Tabbable elements under root, through shadow roots and slots. */
|
|
244
|
+
export declare function tabbables(root: Element | ShadowRoot, options?: { lightOnly?: boolean }): HTMLElement[];
|
|
245
|
+
/** Focuses the first [autofocus] or tabbable element; whether something got focus. */
|
|
246
|
+
export declare function focusFirst(root: Element | ShadowRoot, options?: { lightOnly?: boolean }): boolean;
|
|
247
|
+
|
|
248
|
+
// --- charts (core/charts.js) -----------------------------------------------------
|
|
249
|
+
|
|
250
|
+
/** Number of series colors (--ray-chart-1 … --ray-chart-8). */
|
|
251
|
+
export declare const CHART_SERIES: number;
|
|
252
|
+
/** The chart tokens resolved to concrete colors for the theme of an element. */
|
|
253
|
+
export interface ChartTheme {
|
|
254
|
+
scheme: "light" | "dark";
|
|
255
|
+
/** Series colors, in order (#rrggbb). */
|
|
256
|
+
series: string[];
|
|
257
|
+
background: string;
|
|
258
|
+
grid: string;
|
|
259
|
+
axis: string;
|
|
260
|
+
text: string;
|
|
261
|
+
tooltip: { background: string; text: string; border: string };
|
|
262
|
+
font: { family: string; size: number };
|
|
263
|
+
}
|
|
264
|
+
export declare function chartTheme(el?: Element): ChartTheme;
|
|
265
|
+
/** Calls cb with the new chart theme whenever the theme changes; returns a stop function. */
|
|
266
|
+
export declare function onChartThemeChange(cb: (theme: ChartTheme) => void, el?: Element): () => void;
|
|
267
|
+
/** A color with an alpha, as rgba(): withAlpha("#1c7ed6", 0.2). */
|
|
268
|
+
export declare function withAlpha(color: string, alpha: number): string;
|
|
269
|
+
|
|
270
|
+
// --- scrolling ---------------------------------------------------------------
|
|
271
|
+
|
|
272
|
+
/** The scroller of an element: `target`, else the content of its ray-app-shell or ray-scroll-area, else the window. */
|
|
273
|
+
export declare function scrollerOf(el: Element, target?: Element | string | null): Element | Window;
|
|
274
|
+
/** Calls cb with the scroll position and direction ("down" | "up") once per frame; returns a stop function. */
|
|
275
|
+
export declare function watchScroll(scroller: Element | Window, cb: (state: { y: number; direction: "up" | "down" }) => void, options?: { tolerance?: number }): () => void;
|
|
276
|
+
|
|
277
|
+
// --- native host (core/host.js, core/raylang.js) -----------------------------
|
|
278
|
+
|
|
279
|
+
/** A file a native host chose: a path on disk, with the File fields components read. */
|
|
280
|
+
export declare class HostFile {
|
|
281
|
+
constructor(init: { path: string; name?: string; size?: number; type?: string; lastModified?: number });
|
|
282
|
+
readonly path: string;
|
|
283
|
+
readonly name: string;
|
|
284
|
+
readonly size: number;
|
|
285
|
+
readonly type: string;
|
|
286
|
+
readonly lastModified: number;
|
|
287
|
+
}
|
|
288
|
+
export interface FileFilter {
|
|
289
|
+
name: string;
|
|
290
|
+
extensions: string[];
|
|
291
|
+
}
|
|
292
|
+
/** What the program around the page can do natively; components use it when it is there. */
|
|
293
|
+
export interface Host {
|
|
294
|
+
name: string;
|
|
295
|
+
can(op: "pick_files" | "pick_path" | "confirm" | "menu_items" | "run_menu" | "popup_menu" | "window_colors" | "set_edited" | (string & {})): boolean;
|
|
296
|
+
pickFiles?(options?: { title?: string; multiple?: boolean; directory?: string; filters?: FileFilter[] }): Promise<HostFile[]>;
|
|
297
|
+
pickPath?(options?: { mode?: "open" | "folder" | "save"; title?: string; directory?: string; suggested?: string; filters?: FileFilter[] }): Promise<string | null>;
|
|
298
|
+
menuItems?(): Promise<HostMenuItem[]>;
|
|
299
|
+
runMenu?(tag: string): Promise<true>;
|
|
300
|
+
popupMenu?(items: { title?: string; enabled?: boolean; checked?: boolean; separator?: boolean }[]): Promise<number | null>;
|
|
301
|
+
setEdited?(edited: boolean): Promise<true>;
|
|
302
|
+
setWindowColors?(colors: { background?: string; titlebar?: string }): Promise<true>;
|
|
303
|
+
/** Set when the page runs under a transparent title bar (px). */
|
|
304
|
+
titlebar?: { height: number; inset: number } | null;
|
|
305
|
+
confirm?(options?: { title?: string; message?: string; confirmLabel?: string; cancelLabel?: string; style?: "" | "info" | "warning" | "error" }): Promise<boolean>;
|
|
306
|
+
}
|
|
307
|
+
/** An item of the app's native menu bar, as a host lists it. */
|
|
308
|
+
export interface HostMenuItem {
|
|
309
|
+
menu: string;
|
|
310
|
+
tag: string;
|
|
311
|
+
title: string;
|
|
312
|
+
/** A chord such as "cmd+shift+s" (cmd: ⌘ on macOS, Ctrl elsewhere); "" for none. */
|
|
313
|
+
shortcut: string;
|
|
314
|
+
enabled: boolean;
|
|
315
|
+
checked: boolean;
|
|
316
|
+
}
|
|
317
|
+
export declare function setHost(host: Host | null): void;
|
|
318
|
+
export declare function getHost(): Host | null;
|
|
319
|
+
export declare function hostCan(op: string): boolean;
|
|
320
|
+
/** Calls cb whenever the host changes; returns the unsubscribe function. */
|
|
321
|
+
export declare function onHostChange(cb: (host: Host | null) => void): () => void;
|
|
322
|
+
/** The title bar the page runs under ({ height, inset } px), or null. */
|
|
323
|
+
export declare function titlebar(): { height: number; inset: number } | null;
|
|
324
|
+
/** Makes el drag the window under a host's title bar (data-ray-drag); returns the undo function. */
|
|
325
|
+
export declare function dragRegion(el: Element): () => void;
|
|
326
|
+
export interface EditTracker {
|
|
327
|
+
readonly dirty: boolean;
|
|
328
|
+
/** Takes the current values as saved. */
|
|
329
|
+
clean(): void;
|
|
330
|
+
check(): void;
|
|
331
|
+
stop(): void;
|
|
332
|
+
}
|
|
333
|
+
/** Follows whether a form has unsaved changes; with a host, the window shows it. */
|
|
334
|
+
export declare function trackEdits(form: HTMLFormElement, options?: { onChange?: (dirty: boolean) => void }): EditTracker;
|
|
335
|
+
/** The MIME type of a file name, from its extension ("" when unknown). */
|
|
336
|
+
export declare function typeOfName(name: string): string;
|
|
337
|
+
/** The file dialog filters of an accept list ([] = any file); `name` defaults to the extensions. */
|
|
338
|
+
export declare function acceptFilters(accept: string | null | undefined, name?: string): FileFilter[];
|
|
339
|
+
/** The extensions of a MIME type or pattern ("image/*"). */
|
|
340
|
+
export declare function extensionsOfType(type: string): string[];
|
|
341
|
+
|
|
342
|
+
/** The version of the ray-elements bridge protocol the page speaks. */
|
|
343
|
+
export declare const PROTOCOL: number;
|
|
344
|
+
export interface RaylangHost extends Host {
|
|
345
|
+
name: "raylang";
|
|
346
|
+
platform: string;
|
|
347
|
+
version: string;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* In a std/ui window whose program calls elements/bridge's handle(), installs the
|
|
351
|
+
* raylang host; null in a browser or when the program does not answer in `timeout` ms.
|
|
352
|
+
*/
|
|
353
|
+
export declare function enableRaylang(options?: { timeout?: number; ray?: unknown; windowColors?: boolean }): Promise<RaylangHost | null>;
|
|
354
|
+
|
|
355
|
+
// --- Button (button)
|
|
356
|
+
/** <ray-button> A button, or a link styled as one with href. Submits or resets its form with type. */
|
|
357
|
+
export declare class RayButton extends RayElement {
|
|
358
|
+
/** Visual style. raised: a physical key on a darker edge that sinks when pressed (mouse, touch or keyboard). */
|
|
359
|
+
variant: "filled" | "light" | "outline" | "subtle" | "default" | "transparent" | "gradient" | "raised";
|
|
360
|
+
/** With variant=gradient: "from to [deg]", palette colors or CSS colors ("teal blue 90"). Default: the --ray-gradient-* tokens. */
|
|
361
|
+
gradient: string | undefined;
|
|
362
|
+
/** A palette color (blue, red…) or any CSS color. Default: the primary color. */
|
|
363
|
+
color: string | undefined;
|
|
364
|
+
/** Height, padding and font size. */
|
|
365
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
366
|
+
/** Corner radius. Default: --ray-radius-default. */
|
|
367
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
368
|
+
/** submit/reset act on the enclosing form. */
|
|
369
|
+
type: "button" | "submit" | "reset";
|
|
370
|
+
/** Not interactive (also when inside a disabled fieldset). */
|
|
371
|
+
disabled: boolean | undefined;
|
|
372
|
+
/** Shows a spinner over the content and blocks clicks. */
|
|
373
|
+
loading: boolean | undefined;
|
|
374
|
+
/** Takes the whole width of its container. */
|
|
375
|
+
fullWidth: boolean | undefined;
|
|
376
|
+
/** Renders a link instead of a button. */
|
|
377
|
+
href: string | undefined;
|
|
378
|
+
/** Link target, with href. */
|
|
379
|
+
target: string | undefined;
|
|
380
|
+
/** With type=submit: submitted as name=value. */
|
|
381
|
+
name: string | undefined;
|
|
382
|
+
/** With type=submit: the submitted value. */
|
|
383
|
+
value: string | undefined;
|
|
384
|
+
/** The form a submit/reset button acts on. */
|
|
385
|
+
readonly form: HTMLFormElement | null;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// --- Button group (button-group)
|
|
389
|
+
/** <ray-button-group> role=group; give it a label. The corners come from the --ray-group-radius-* custom properties, which your own components can read too. */
|
|
390
|
+
export declare class RayButtonGroup extends RayElement {
|
|
391
|
+
/** Direction of the group. */
|
|
392
|
+
orientation: "horizontal" | "vertical";
|
|
393
|
+
/** Fills its container; the children share the width. */
|
|
394
|
+
fullWidth: boolean | undefined;
|
|
395
|
+
/** Accessible name (aria-label). */
|
|
396
|
+
label: string | undefined;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// --- Icon button (icon-button)
|
|
400
|
+
/** <ray-icon-button> Same properties as ray-button; variant defaults to subtle. */
|
|
401
|
+
export declare class RayIconButton extends RayButton {
|
|
402
|
+
/** Accessible name and tooltip (required: the button has no text). */
|
|
403
|
+
label: string | undefined;
|
|
404
|
+
/** Visual style. */
|
|
405
|
+
variant: "filled" | "light" | "outline" | "subtle" | "default" | "transparent" | "gradient" | "raised";
|
|
406
|
+
/** With variant=gradient: "from to [deg]", palette colors or CSS colors ("teal blue 90"). Default: the --ray-gradient-* tokens. */
|
|
407
|
+
gradient: string | undefined;
|
|
408
|
+
/** A palette color or any CSS color. */
|
|
409
|
+
color: string | undefined;
|
|
410
|
+
/** Width and height. */
|
|
411
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
412
|
+
/** Not interactive. */
|
|
413
|
+
disabled: boolean | undefined;
|
|
414
|
+
/** Shows a spinner instead of the icon. */
|
|
415
|
+
loading: boolean | undefined;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// --- Toggle (toggle)
|
|
419
|
+
/** <ray-toggle> Click, Enter or Space flips pressed and fires change. In a form it is submitted like a checkbox: value (default "on") under name while pressed; reset restores the initial pressed attribute. */
|
|
420
|
+
export declare class RayToggle extends RayButton {
|
|
421
|
+
/** On. */
|
|
422
|
+
pressed: boolean | undefined;
|
|
423
|
+
/** Look of "on": subtle (tint), outline (colored border + tint), light (muted → tint), filled (surface → solid color), raised (a key that latches down, lit). ray-button's default, transparent and gradient are left out: no distinct on state, or only a color change. */
|
|
424
|
+
variant: "subtle" | "outline" | "light" | "filled" | "raised";
|
|
425
|
+
/** Square, for an icon alone (give it a label). */
|
|
426
|
+
square: boolean | undefined;
|
|
427
|
+
/** Accessible name and tooltip, for icon-only toggles. */
|
|
428
|
+
label: string | undefined;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// --- Toggle group (toggle-group)
|
|
432
|
+
/** <ray-toggle-group> Each toggle's value (else its text) is its key. variant, color, size, radius and square reach the toggles that do not set their own. One tab stop (the selected toggle); arrows, Home and End move; Space/Enter flips. */
|
|
433
|
+
export declare class RayToggleGroup extends RayButtonGroup {
|
|
434
|
+
/** single: choosing one turns the others off; multiple: each toggle is independent. */
|
|
435
|
+
type: "single" | "multiple";
|
|
436
|
+
/** The selected key (single) or keys (multiple: an array, or a comma-separated attribute). */
|
|
437
|
+
value: string | string[] | undefined;
|
|
438
|
+
/** Form field name: the value (multiple: one entry per key). */
|
|
439
|
+
name: string | undefined;
|
|
440
|
+
/** Needs a value; with single the selected toggle cannot be turned off. */
|
|
441
|
+
required: boolean | undefined;
|
|
442
|
+
/** Disables every toggle. */
|
|
443
|
+
disabled: boolean | undefined;
|
|
444
|
+
/** Toggles apart, each with its own corners (default: joined). */
|
|
445
|
+
spaced: boolean | undefined;
|
|
446
|
+
/** Variant of the toggles. */
|
|
447
|
+
variant: "subtle" | "outline" | "light" | "filled" | "raised" | undefined;
|
|
448
|
+
/** Color of the toggles' on state. */
|
|
449
|
+
color: string | undefined;
|
|
450
|
+
/** Size of the toggles. */
|
|
451
|
+
size: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
452
|
+
/** Corner radius of the toggles. */
|
|
453
|
+
radius: string | undefined;
|
|
454
|
+
/** Square toggles, for icons. */
|
|
455
|
+
square: boolean | undefined;
|
|
456
|
+
/** The selected keys as a list, in any mode. */
|
|
457
|
+
values: string[];
|
|
458
|
+
/** The toggles of this group. */
|
|
459
|
+
readonly toggles: RayToggle[];
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
// --- Checkbox (checkbox)
|
|
463
|
+
/** <ray-checkbox> A checkbox with label, description and error. Submits value when checked. */
|
|
464
|
+
export declare class RayCheckbox extends FieldControl {
|
|
465
|
+
/** Current state. The checked attribute is the initial state (restored on reset). */
|
|
466
|
+
checked: boolean | undefined;
|
|
467
|
+
/** Mixed state; cleared on the next user change. */
|
|
468
|
+
indeterminate: boolean | undefined;
|
|
469
|
+
/** Submitted value when checked. */
|
|
470
|
+
value: string;
|
|
471
|
+
/** Form field name. */
|
|
472
|
+
name: string | undefined;
|
|
473
|
+
/** Label text (or put the label in the content). */
|
|
474
|
+
label: string | undefined;
|
|
475
|
+
/** Help text. */
|
|
476
|
+
description: string | undefined;
|
|
477
|
+
/** Error text. */
|
|
478
|
+
error: string | undefined;
|
|
479
|
+
/** Must be checked to submit. */
|
|
480
|
+
required: boolean | undefined;
|
|
481
|
+
/** Not interactive nor submitted. */
|
|
482
|
+
disabled: boolean | undefined;
|
|
483
|
+
/** Checked look: filled box, or colored border and mark. */
|
|
484
|
+
variant: "filled" | "outline";
|
|
485
|
+
/** A palette color or any CSS color for the checked state. */
|
|
486
|
+
color: string | undefined;
|
|
487
|
+
/** Box and font size. */
|
|
488
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
489
|
+
/** Side of the label. */
|
|
490
|
+
labelPosition: "right" | "left";
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// --- Checkbox group (checkbox-group)
|
|
494
|
+
/** <ray-checkbox-group> The group is the form control: one entry per checked value under name (like checkboxes sharing a name); the checkboxes inside lose their own name. It stops their change events and fires its own. role="group" named by its label. */
|
|
495
|
+
export declare class RayCheckboxGroup extends FormControl {
|
|
496
|
+
/** The checked values. The value attribute: "a,b". */
|
|
497
|
+
value: string[] | undefined;
|
|
498
|
+
/** Form field name. */
|
|
499
|
+
name: string | undefined;
|
|
500
|
+
/** Group label (also its accessible name). */
|
|
501
|
+
label: string | undefined;
|
|
502
|
+
/** Help text. */
|
|
503
|
+
description: string | undefined;
|
|
504
|
+
/** Error text. */
|
|
505
|
+
error: string | undefined;
|
|
506
|
+
/** At least one must be checked. */
|
|
507
|
+
required: boolean | undefined;
|
|
508
|
+
/** Disables every checkbox. */
|
|
509
|
+
disabled: boolean | undefined;
|
|
510
|
+
/** At most this many: the others are disabled once reached; the label shows the count. */
|
|
511
|
+
max: number | undefined;
|
|
512
|
+
/** Layout of the checkboxes. */
|
|
513
|
+
orientation: "vertical" | "horizontal";
|
|
514
|
+
/** Size of the checkboxes that set none. */
|
|
515
|
+
size: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
516
|
+
/** Color of the checkboxes that set none. */
|
|
517
|
+
color: string | undefined;
|
|
518
|
+
/** The description before the checkboxes or after them. */
|
|
519
|
+
descriptionPosition: "above" | "below";
|
|
520
|
+
/** The checkboxes of this group. */
|
|
521
|
+
readonly checkboxes: HTMLElement[];
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// --- Color picker (color-picker)
|
|
525
|
+
/** How a color value is written. */
|
|
526
|
+
export type ColorFormat = "hex" | "hexa" | "rgb" | "rgba" | "hsl" | "hsla";
|
|
527
|
+
/** sRGB channels and alpha, all 0…1. */
|
|
528
|
+
export type Rgba = { r: number; g: number; b: number; a: number };
|
|
529
|
+
/** A color string (hex with 3/4/6/8 digits, rgb(a), hsl(a), or any CSS color) as channels and alpha, or null. */
|
|
530
|
+
export declare function parseColorValue(input: string | null | undefined): Rgba | null;
|
|
531
|
+
/** Channels and alpha as a string in a format (default hex). */
|
|
532
|
+
export declare function formatColor(color: Rgba, format?: ColorFormat): string;
|
|
533
|
+
/** <ray-color-picker> Keyboard: arrows move the area's thumb (saturation, brightness) or a slider's; Shift for 10× steps; Home/End on the sliders. The alpha slider shows when format has alpha. */
|
|
534
|
+
export declare class RayColorPicker extends FormControl {
|
|
535
|
+
/** The color, written in format. Any color is accepted and rewritten in format. The value attribute is the initial value (restored on form reset). */
|
|
536
|
+
value: string | undefined;
|
|
537
|
+
/** How value is written: hex, hexa, rgb, rgba, hsl or hsla. Formats ending in a show the opacity slider. */
|
|
538
|
+
format: ColorFormat;
|
|
539
|
+
/** Preset colors below the picker: an array, or a comma-separated list in the attribute (commas inside rgb()/hsl() are kept). */
|
|
540
|
+
swatches: string | string[] | undefined;
|
|
541
|
+
/** Swatches in each row. */
|
|
542
|
+
swatchesPerRow: number;
|
|
543
|
+
/** Only the swatches: no area nor sliders. */
|
|
544
|
+
swatchesOnly: boolean | undefined;
|
|
545
|
+
/** Width of the picker and size of its thumbs. */
|
|
546
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
547
|
+
/** Takes the width of its container. */
|
|
548
|
+
fullWidth: boolean | undefined;
|
|
549
|
+
/** Form field name. */
|
|
550
|
+
name: string | undefined;
|
|
551
|
+
/** Not interactive. */
|
|
552
|
+
disabled: boolean | undefined;
|
|
553
|
+
/** Accessible name of the whole picker. */
|
|
554
|
+
label: string | undefined;
|
|
555
|
+
/** The current color as channels and alpha (0…1). */
|
|
556
|
+
readonly rgba: Rgba;
|
|
557
|
+
}
|
|
558
|
+
/** <ray-color-input> Type any CSS color (it becomes the value as soon as it is valid; invalid text goes back to the value on blur), or open the picker with a click or ArrowDown. The eyedropper shows only where the browser has the EyeDropper API. */
|
|
559
|
+
export declare class RayColorInput extends FieldControl {
|
|
560
|
+
/** The color, written in format. The value attribute is the initial value (restored on form reset). */
|
|
561
|
+
value: string | undefined;
|
|
562
|
+
/** How value is written: hex, hexa, rgb, rgba, hsl or hsla. */
|
|
563
|
+
format: ColorFormat;
|
|
564
|
+
/** Preset colors in the dropdown (an array, or a comma-separated list). */
|
|
565
|
+
swatches: string | string[] | undefined;
|
|
566
|
+
/** Swatches in each row. */
|
|
567
|
+
swatchesPerRow: number;
|
|
568
|
+
/** Shown while empty. */
|
|
569
|
+
placeholder: string | undefined;
|
|
570
|
+
/** Hides the eyedropper button. */
|
|
571
|
+
hideEyedropper: boolean | undefined;
|
|
572
|
+
/** The dropdown is shown. */
|
|
573
|
+
open: boolean | undefined;
|
|
574
|
+
/** Form field name. */
|
|
575
|
+
name: string | undefined;
|
|
576
|
+
/** Label above the field. */
|
|
577
|
+
label: string | undefined;
|
|
578
|
+
/** Help text. */
|
|
579
|
+
description: string | undefined;
|
|
580
|
+
/** Error message; marks the field invalid. */
|
|
581
|
+
error: string | undefined;
|
|
582
|
+
/** Must have a color. */
|
|
583
|
+
required: boolean | undefined;
|
|
584
|
+
/** Not interactive. */
|
|
585
|
+
disabled: boolean | undefined;
|
|
586
|
+
/** Field height and font size. */
|
|
587
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
588
|
+
/** Corner radius: xs…xl or a CSS length. */
|
|
589
|
+
radius: string | undefined;
|
|
590
|
+
/** Visual style of the field. */
|
|
591
|
+
variant: "default" | "filled" | "unstyled";
|
|
592
|
+
/** Where the description goes. */
|
|
593
|
+
descriptionPosition: "above" | "below";
|
|
594
|
+
/** The ray-color-picker in the dropdown. */
|
|
595
|
+
readonly picker: RayColorPicker;
|
|
596
|
+
/** Opens or closes the dropdown. */
|
|
597
|
+
toggle(force?: boolean): void;
|
|
598
|
+
addEventListener<K extends keyof RayColorInputEventMap>(type: K, listener: (this: RayColorInput, ev: RayColorInputEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
599
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
600
|
+
removeEventListener<K extends keyof RayColorInputEventMap>(type: K, listener: (this: RayColorInput, ev: RayColorInputEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
601
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
602
|
+
}
|
|
603
|
+
export interface RayColorInputEventMap extends HTMLElementEventMap {
|
|
604
|
+
/** The dropdown opened. */
|
|
605
|
+
"ray-open": CustomEvent<unknown>;
|
|
606
|
+
/** The dropdown closed. */
|
|
607
|
+
"ray-close": CustomEvent<unknown>;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
// --- Combobox (combobox)
|
|
611
|
+
/** <ray-combobox> The WAI-ARIA combobox pattern (a text field with a listbox popup; the active option is aria-activedescendant). Arrows move, Enter picks, Escape closes (then clears with clearable), Backspace in an empty field removes the last chip. The form gets one entry per value. */
|
|
612
|
+
export declare class RayCombobox extends FieldControl {
|
|
613
|
+
/** The chosen value; an array with multiple. The value attribute: "a,b" with multiple. */
|
|
614
|
+
value: string | string[] | undefined;
|
|
615
|
+
/** Options instead of child <option>/<optgroup> elements. */
|
|
616
|
+
data: Array<string | { value: string; label?: string; disabled?: boolean; group?: string }> | undefined;
|
|
617
|
+
/** Several values, shown as chips. */
|
|
618
|
+
multiple: boolean | undefined;
|
|
619
|
+
/** Shown while empty. */
|
|
620
|
+
placeholder: string | undefined;
|
|
621
|
+
/** What was typed can be added when no option matches it ("+ Create …"); fires ray-create. */
|
|
622
|
+
creatable: boolean | undefined;
|
|
623
|
+
/** A button that clears the value. */
|
|
624
|
+
clearable: boolean | undefined;
|
|
625
|
+
/** With multiple: at most this many. */
|
|
626
|
+
maxValues: number | undefined;
|
|
627
|
+
/** At most this many options shown (large lists: keep typing). */
|
|
628
|
+
limit: number | undefined;
|
|
629
|
+
/** Shown when nothing matches. */
|
|
630
|
+
nothingFound: string;
|
|
631
|
+
/** The dropdown is shown. */
|
|
632
|
+
open: boolean | undefined;
|
|
633
|
+
/** The value as an array (with or without multiple). */
|
|
634
|
+
readonly values: string[];
|
|
635
|
+
/** Opens or closes the dropdown. */
|
|
636
|
+
toggle(force?: boolean): void;
|
|
637
|
+
addEventListener<K extends keyof RayComboboxEventMap>(type: K, listener: (this: RayCombobox, ev: RayComboboxEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
638
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
639
|
+
removeEventListener<K extends keyof RayComboboxEventMap>(type: K, listener: (this: RayCombobox, ev: RayComboboxEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
640
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
641
|
+
}
|
|
642
|
+
export interface RayComboboxEventMap extends HTMLElementEventMap {
|
|
643
|
+
/** A new value was created from the typed text. */
|
|
644
|
+
"ray-create": CustomEvent<{ value: string }>;
|
|
645
|
+
/** The dropdown opened. */
|
|
646
|
+
"ray-open": CustomEvent<unknown>;
|
|
647
|
+
/** The dropdown closed. */
|
|
648
|
+
"ray-close": CustomEvent<unknown>;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// --- Date picker (date-picker)
|
|
652
|
+
/** <ray-date-picker> Values are ISO dates ("2026-10-06"), submitted as such. ArrowDown on the field opens the calendar; Escape closes it. */
|
|
653
|
+
export declare class RayDatePicker extends FieldControl {
|
|
654
|
+
/** The chosen date, ISO "YYYY-MM-DD" ("" for none). The value attribute is the initial value (restored on form reset). */
|
|
655
|
+
value: string | undefined;
|
|
656
|
+
/** Earliest selectable date (ISO). Earlier days are disabled; an earlier value is invalid (rangeUnderflow). */
|
|
657
|
+
min: string | undefined;
|
|
658
|
+
/** Latest selectable date (ISO). */
|
|
659
|
+
max: string | undefined;
|
|
660
|
+
/** Shown while no date is chosen. */
|
|
661
|
+
placeholder: string;
|
|
662
|
+
/** How the date is displayed (Intl dateStyle). */
|
|
663
|
+
format: "short" | "medium" | "long" | "full";
|
|
664
|
+
/** Locale for names and formats. Default: the nearest lang attribute, else the browser's. */
|
|
665
|
+
locale: string | undefined;
|
|
666
|
+
/** First day of the week, 0 (Sunday) to 6. Default: the locale's. */
|
|
667
|
+
firstDay: number | undefined;
|
|
668
|
+
/** Shows a button that clears the date. */
|
|
669
|
+
clearable: boolean | undefined;
|
|
670
|
+
/** The calendar dropdown is shown. */
|
|
671
|
+
open: boolean | undefined;
|
|
672
|
+
/** Form field name. */
|
|
673
|
+
name: string | undefined;
|
|
674
|
+
/** Visible label (also the accessible name). */
|
|
675
|
+
label: string | undefined;
|
|
676
|
+
/** Help text. */
|
|
677
|
+
description: string | undefined;
|
|
678
|
+
/** The description before the control (help first) or after it, with the error (fields in a row stay aligned). */
|
|
679
|
+
descriptionPosition: "above" | "below";
|
|
680
|
+
/** Error text. */
|
|
681
|
+
error: string | undefined;
|
|
682
|
+
/** Required for form submission. */
|
|
683
|
+
required: boolean | undefined;
|
|
684
|
+
/** Not interactive nor submitted. */
|
|
685
|
+
disabled: boolean | undefined;
|
|
686
|
+
/** Height and font size. */
|
|
687
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
688
|
+
/** Corner radius. */
|
|
689
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
690
|
+
/** Box style. */
|
|
691
|
+
variant: "default" | "filled" | "unstyled";
|
|
692
|
+
/** Opens or closes the calendar. */
|
|
693
|
+
toggle(force?: boolean): void;
|
|
694
|
+
/** The chosen date as displayed ("" when none). */
|
|
695
|
+
readonly displayValue: string;
|
|
696
|
+
addEventListener<K extends keyof RayDatePickerEventMap>(type: K, listener: (this: RayDatePicker, ev: RayDatePickerEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
697
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
698
|
+
removeEventListener<K extends keyof RayDatePickerEventMap>(type: K, listener: (this: RayDatePicker, ev: RayDatePickerEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
699
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
700
|
+
}
|
|
701
|
+
export interface RayDatePickerEventMap extends HTMLElementEventMap {
|
|
702
|
+
/** The calendar opened. */
|
|
703
|
+
"ray-open": CustomEvent<unknown>;
|
|
704
|
+
/** The calendar closed. */
|
|
705
|
+
"ray-close": CustomEvent<unknown>;
|
|
706
|
+
}
|
|
707
|
+
/** <ray-calendar> WAI-ARIA grid: arrows move by day and week, Home/End to the week's ends, PageUp/PageDown by month (with Shift, by year), Enter/Space select. */
|
|
708
|
+
export declare class RayCalendar extends RayElement {
|
|
709
|
+
/** The selected date, ISO "YYYY-MM-DD". */
|
|
710
|
+
value: string | undefined;
|
|
711
|
+
/** Earliest selectable date (ISO). */
|
|
712
|
+
min: string | undefined;
|
|
713
|
+
/** Latest selectable date (ISO). */
|
|
714
|
+
max: string | undefined;
|
|
715
|
+
/** Locale for month and weekday names. Default: the nearest lang attribute, else the browser's. */
|
|
716
|
+
locale: string | undefined;
|
|
717
|
+
/** First day of the week, 0 (Sunday) to 6. Default: the locale's. */
|
|
718
|
+
firstDay: number | undefined;
|
|
719
|
+
/** Day cell size and font size. */
|
|
720
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
721
|
+
/** Focuses the day the keyboard is on (the selected day, else today). */
|
|
722
|
+
focusDay(): void;
|
|
723
|
+
/** The day the keyboard is on (ISO). */
|
|
724
|
+
readonly focusedDate: string;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// --- File upload (file-upload)
|
|
728
|
+
/** The files a change added and removed. */
|
|
729
|
+
export type FileUploadChange = { added: (File | HostFile)[]; removed: (File | HostFile)[] };
|
|
730
|
+
/** A refused file and why. */
|
|
731
|
+
export type FileRejection = { file: File; reason: "type" | "size" | "count"; message: string };
|
|
732
|
+
/** Bytes from a number or a size like "10 MB" (NaN if neither). */
|
|
733
|
+
export declare function parseSize(value: string | number | null | undefined): number;
|
|
734
|
+
/** Whether a file passes an accept list. */
|
|
735
|
+
export declare function matchesAccept(file: { name: string; type: string }, accept: string | null | undefined): boolean;
|
|
736
|
+
/** A short human list of an accept value ("PNG, JPG or PDF"). */
|
|
737
|
+
export declare function describeAccept(accept: string | null | undefined): string;
|
|
738
|
+
/** <ray-file-upload> A drag that can only be refused turns the zone red before the drop; refused files fire ray-reject and are explained under the zone. Without multiple a new file replaces the current one. Uploading is the app's: attachmentFor(file) gives the row whose progress/status/error to set. */
|
|
739
|
+
export declare class RayFileUpload extends FormControl {
|
|
740
|
+
/** Form field name: every file is submitted under it. */
|
|
741
|
+
name: string | undefined;
|
|
742
|
+
/** Label above the zone. */
|
|
743
|
+
label: string | undefined;
|
|
744
|
+
/** Help text under the label. */
|
|
745
|
+
description: string | undefined;
|
|
746
|
+
/** Error text (replaces the explanation of refused files). */
|
|
747
|
+
error: string | undefined;
|
|
748
|
+
/** The form needs at least one file. */
|
|
749
|
+
required: boolean | undefined;
|
|
750
|
+
/** No picking, dropping or removing. */
|
|
751
|
+
disabled: boolean | undefined;
|
|
752
|
+
/** Accepted types, as in <input type=file>: ".pdf,.png", "image/*", "application/json". */
|
|
753
|
+
accept: string | undefined;
|
|
754
|
+
/** Several files (else one, replaced by the next). */
|
|
755
|
+
multiple: boolean | undefined;
|
|
756
|
+
/** Largest file: bytes or a size like "10 MB", "512 KB". */
|
|
757
|
+
maxSize: string | number | undefined;
|
|
758
|
+
/** With multiple: the most files kept. */
|
|
759
|
+
maxFiles: number | undefined;
|
|
760
|
+
/** Small text in the zone. Default: from accept, max-size and max-files ("PNG or PDF · up to 10 MB each · max. 5 files"). */
|
|
761
|
+
hint: string | undefined;
|
|
762
|
+
/** Title of the zone, before "or browse". */
|
|
763
|
+
dropLabel: string;
|
|
764
|
+
/** The link-styled word (the button text in compact). */
|
|
765
|
+
browseLabel: string;
|
|
766
|
+
/** Title while files are dragged over it. */
|
|
767
|
+
activeLabel: string;
|
|
768
|
+
/** Title on touch screens (no hover), where dragging files is rare. */
|
|
769
|
+
tapLabel: string;
|
|
770
|
+
/** default: a tall centered zone; compact: one row with a Browse button. */
|
|
771
|
+
variant: "default" | "compact";
|
|
772
|
+
/** How chosen files show: full-width rows, thumbnail cards, or not at all (render your own on change). */
|
|
773
|
+
list: "rows" | "cards" | "none";
|
|
774
|
+
/** With a native host (ray-elements/core/raylang.js in a std/ui window), browsing opens the system dialog and gives paths (see `paths`); drop and paste still give Files. */
|
|
775
|
+
native: boolean | undefined;
|
|
776
|
+
/** Accent of hover, drag and the browse link (default: primary). */
|
|
777
|
+
color: string | undefined;
|
|
778
|
+
/** The chosen files (assign to replace them, without events). */
|
|
779
|
+
files: (File | HostFile)[];
|
|
780
|
+
/** The paths of the files chosen with the native dialog (`native`), in order; they are also what the form submits for them. */
|
|
781
|
+
readonly paths: string[];
|
|
782
|
+
/** What the last change event changed: the files added and removed. null before the first one, and after assigning files. */
|
|
783
|
+
readonly lastChange: FileUploadChange | null;
|
|
784
|
+
/** Opens the system file picker. */
|
|
785
|
+
open(): void;
|
|
786
|
+
/** Adds files as if dropped (checks them, fires the events). */
|
|
787
|
+
addFiles(files: Iterable<File>): { accepted: File[]; rejected: FileRejection[] };
|
|
788
|
+
/** Removes a file (fires change). */
|
|
789
|
+
removeFile(file: File): boolean;
|
|
790
|
+
/** Removes every file (fires change). */
|
|
791
|
+
clear(): void;
|
|
792
|
+
/** The row of a file, to show its upload progress, status or error. */
|
|
793
|
+
attachmentFor(file: File): RayAttachment | null;
|
|
794
|
+
addEventListener<K extends keyof RayFileUploadEventMap>(type: K, listener: (this: RayFileUpload, ev: RayFileUploadEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
795
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
796
|
+
removeEventListener<K extends keyof RayFileUploadEventMap>(type: K, listener: (this: RayFileUpload, ev: RayFileUploadEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
797
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
798
|
+
}
|
|
799
|
+
export interface RayFileUploadEventMap extends HTMLElementEventMap {
|
|
800
|
+
/** Some files were refused (type, size or count). */
|
|
801
|
+
"ray-reject": CustomEvent<{ rejected: FileRejection[] }>;
|
|
802
|
+
/** The native dialog failed (with `native`). */
|
|
803
|
+
"ray-error": CustomEvent<{ error: Error }>;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
// --- Input (input)
|
|
807
|
+
/** <ray-input> Also forwards placeholder, autocomplete, inputmode, pattern, min, max, step, minlength, maxlength, spellcheck, autocapitalize, enterkeyhint and list to the inner input. */
|
|
808
|
+
export declare class RayInput extends FieldControl {
|
|
809
|
+
/** Current value. The value attribute is the initial value (restored on form reset). */
|
|
810
|
+
value: string | undefined;
|
|
811
|
+
/** Input type. */
|
|
812
|
+
type: "text" | "email" | "password" | "search" | "number" | "url" | "tel";
|
|
813
|
+
/** Form field name. */
|
|
814
|
+
name: string | undefined;
|
|
815
|
+
/** Visible label (also the accessible name). */
|
|
816
|
+
label: string | undefined;
|
|
817
|
+
/** Help text under the label. */
|
|
818
|
+
description: string | undefined;
|
|
819
|
+
/** The description before the control (help first) or after it, with the error (fields in a row stay aligned). */
|
|
820
|
+
descriptionPosition: "above" | "below";
|
|
821
|
+
/** Error text; marks the field invalid (display only — does not block submit). */
|
|
822
|
+
error: string | undefined;
|
|
823
|
+
/** Placeholder text. */
|
|
824
|
+
placeholder: string | undefined;
|
|
825
|
+
/** Required for form submission; shows an asterisk. */
|
|
826
|
+
required: boolean | undefined;
|
|
827
|
+
/** Not editable nor submitted. */
|
|
828
|
+
disabled: boolean | undefined;
|
|
829
|
+
/** Not editable, still submitted. */
|
|
830
|
+
readonly: boolean | undefined;
|
|
831
|
+
/** Height and font size. */
|
|
832
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
833
|
+
/** Corner radius. */
|
|
834
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
835
|
+
/** Box style. */
|
|
836
|
+
variant: "default" | "filled" | "unstyled";
|
|
837
|
+
/** Selects the text. */
|
|
838
|
+
select(): void;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// --- Number input (number-input)
|
|
842
|
+
/** The number in a text with separators, prefix or suffix (NaN if none). */
|
|
843
|
+
export declare function parseNumber(text: string, options?: { decimal?: string; thousands?: string }): number;
|
|
844
|
+
/** A number as text with fixed decimals and separators. */
|
|
845
|
+
export declare function formatNumber(n: number, options?: { decimals?: number; thousands?: string; decimal?: string }): string;
|
|
846
|
+
/** <ray-number-input> Arrow Up/Down step (Shift: ×10), Page Up/Down ×10, Home/End go to min/max. The value is a number (undefined when empty); the form gets its plain digits; min and max are checked (rangeUnderflow, rangeOverflow). */
|
|
847
|
+
export declare class RayNumberInput extends FieldControl {
|
|
848
|
+
/** The number (undefined when empty). */
|
|
849
|
+
value: number | undefined;
|
|
850
|
+
/** Minimum. */
|
|
851
|
+
min: number | undefined;
|
|
852
|
+
/** Maximum. */
|
|
853
|
+
max: number | undefined;
|
|
854
|
+
/** What + and − add. */
|
|
855
|
+
step: number;
|
|
856
|
+
/** Fixed decimals (2: 3 shows as 3.00). */
|
|
857
|
+
decimals: number | undefined;
|
|
858
|
+
/** Shown before the number ("$"). */
|
|
859
|
+
prefix: string | null;
|
|
860
|
+
/** Shown after the number (" kg", "%"). */
|
|
861
|
+
suffix: string | undefined;
|
|
862
|
+
/** Groups thousands in the shown text (",", ".", " "). */
|
|
863
|
+
thousandsSeparator: string | undefined;
|
|
864
|
+
/** The decimal mark shown and typed ("," in many locales). */
|
|
865
|
+
decimalSeparator: string;
|
|
866
|
+
/** When out-of-range input is clamped: on blur, while typing, or never (then it is invalid). */
|
|
867
|
+
clamp: "blur" | "strict" | "none";
|
|
868
|
+
/** No + and − buttons (the keys still step). */
|
|
869
|
+
hideControls: boolean | undefined;
|
|
870
|
+
/** Shown while empty. */
|
|
871
|
+
placeholder: string | undefined;
|
|
872
|
+
/** Not editable, still submitted. */
|
|
873
|
+
readonly: boolean | undefined;
|
|
874
|
+
/** Adds steps (negative: subtracts), clamped; fires input and change. */
|
|
875
|
+
stepBy(steps: number): void;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
// --- Password input (password-input)
|
|
879
|
+
/** <ray-password-input> autocomplete defaults to current-password: use new-password on sign-up and change forms. The toggle keeps the focus and the caret in the field. */
|
|
880
|
+
export declare class RayPasswordInput extends RayInput {
|
|
881
|
+
/** The password is shown as text. */
|
|
882
|
+
visible: boolean | undefined;
|
|
883
|
+
/** Accessible name of the toggle while hidden. */
|
|
884
|
+
showLabel: string;
|
|
885
|
+
/** Accessible name of the toggle while shown. */
|
|
886
|
+
hideLabel: string;
|
|
887
|
+
addEventListener<K extends keyof RayPasswordInputEventMap>(type: K, listener: (this: RayPasswordInput, ev: RayPasswordInputEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
888
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
889
|
+
removeEventListener<K extends keyof RayPasswordInputEventMap>(type: K, listener: (this: RayPasswordInput, ev: RayPasswordInputEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
890
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
891
|
+
}
|
|
892
|
+
export interface RayPasswordInputEventMap extends HTMLElementEventMap {
|
|
893
|
+
/** The user showed or hid the password. */
|
|
894
|
+
"ray-visibility-change": CustomEvent<{ visible: boolean }>;
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
// --- Path input (path-input)
|
|
898
|
+
/** The folder part of a path ("" when it has none), with / or \ separators. */
|
|
899
|
+
export declare function dirName(path: string): string;
|
|
900
|
+
/** The last part of a path. */
|
|
901
|
+
export declare function baseName(path: string): string;
|
|
902
|
+
/** <ray-path-input> Browse… shows only with a native host that offers pick_path (see core/host.js); the dialog starts in the folder of the current path. The path can always be typed or pasted. */
|
|
903
|
+
export declare class RayPathInput extends RayInput {
|
|
904
|
+
/** What the dialog chooses: an existing file, a folder, or a file to save (the current name is suggested). */
|
|
905
|
+
mode: "open" | "folder" | "save";
|
|
906
|
+
/** File types the dialog offers, as in <input type=file>: ".json,.toml", "image/*" (ignored for folders). */
|
|
907
|
+
accept: string | undefined;
|
|
908
|
+
/** Text of the button. */
|
|
909
|
+
browseLabel: string;
|
|
910
|
+
/** Title of the system dialog (default: the label). */
|
|
911
|
+
dialogTitle: string | undefined;
|
|
912
|
+
/** Whether Browse… is available (a native host offers pick_path). */
|
|
913
|
+
readonly canBrowse: boolean;
|
|
914
|
+
/** Opens the system dialog; resolves to the chosen path (also set as value, with input and change), or null. */
|
|
915
|
+
browse(): Promise<string | null>;
|
|
916
|
+
addEventListener<K extends keyof RayPathInputEventMap>(type: K, listener: (this: RayPathInput, ev: RayPathInputEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
917
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
918
|
+
removeEventListener<K extends keyof RayPathInputEventMap>(type: K, listener: (this: RayPathInput, ev: RayPathInputEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
919
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
920
|
+
}
|
|
921
|
+
export interface RayPathInputEventMap extends HTMLElementEventMap {
|
|
922
|
+
/** The system dialog failed. */
|
|
923
|
+
"ray-error": CustomEvent<{ error: Error }>;
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
// --- Radio group (radio)
|
|
927
|
+
/** <ray-radio-group> Arrow keys move the selection, Tab enters and leaves the group. */
|
|
928
|
+
export declare class RayRadioGroup extends FormControl {
|
|
929
|
+
/** Value of the checked radio. Initial: the value attribute, or a radio with the checked attribute. */
|
|
930
|
+
value: string | undefined;
|
|
931
|
+
/** Form field name. */
|
|
932
|
+
name: string | undefined;
|
|
933
|
+
/** Group label (also its accessible name). */
|
|
934
|
+
label: string | undefined;
|
|
935
|
+
/** Help text. */
|
|
936
|
+
description: string | undefined;
|
|
937
|
+
/** The description before the control (help first) or after it, with the error (fields in a row stay aligned). */
|
|
938
|
+
descriptionPosition: "above" | "below";
|
|
939
|
+
/** Error text. */
|
|
940
|
+
error: string | undefined;
|
|
941
|
+
/** A choice is needed to submit. */
|
|
942
|
+
required: boolean | undefined;
|
|
943
|
+
/** Disables every radio. */
|
|
944
|
+
disabled: boolean | undefined;
|
|
945
|
+
/** Layout of the radios. */
|
|
946
|
+
orientation: "vertical" | "horizontal";
|
|
947
|
+
/** Size of every radio. */
|
|
948
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
949
|
+
/** Checked color of every radio. */
|
|
950
|
+
color: string | undefined;
|
|
951
|
+
/** Checked look of every radio: filled circle, or colored ring and dot. */
|
|
952
|
+
variant: "filled" | "outline";
|
|
953
|
+
/** The radios of the group. */
|
|
954
|
+
readonly radios: RayRadio[];
|
|
955
|
+
}
|
|
956
|
+
/** <ray-radio> One choice among options: ray-radio elements inside a ray-radio-group, which is the form control. */
|
|
957
|
+
export declare class RayRadio extends RayElement {
|
|
958
|
+
/** Value given to the group when chosen. */
|
|
959
|
+
value: string | undefined;
|
|
960
|
+
/** Label text (or the content). */
|
|
961
|
+
label: string | undefined;
|
|
962
|
+
/** Help text under the label. */
|
|
963
|
+
description: string | undefined;
|
|
964
|
+
/** Cannot be chosen. */
|
|
965
|
+
disabled: boolean | undefined;
|
|
966
|
+
/** Overrides the group color. */
|
|
967
|
+
color: string | undefined;
|
|
968
|
+
/** Overrides the group size. */
|
|
969
|
+
size: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
970
|
+
/** Overrides the group variant. */
|
|
971
|
+
variant: "filled" | "outline" | undefined;
|
|
972
|
+
/** Whether this radio is the group's value. */
|
|
973
|
+
readonly checked: boolean;
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
// --- Search (search)
|
|
977
|
+
/** <ray-search> Escape clears it (when it has text); Enter fires ray-search at once. JS: clear(), focus(). */
|
|
978
|
+
export declare class RaySearch extends FieldControl {
|
|
979
|
+
/** Current text. */
|
|
980
|
+
value: string | undefined;
|
|
981
|
+
/** Placeholder text. */
|
|
982
|
+
placeholder: string;
|
|
983
|
+
/** Keyboard shortcut that focuses it ("mod+k", "/"; mod = ⌘ on macOS, Ctrl elsewhere). Shown as a hint while empty. */
|
|
984
|
+
shortcut: string | undefined;
|
|
985
|
+
/** Milliseconds of quiet typing before ray-search fires (0: on every keystroke). */
|
|
986
|
+
debounce: number;
|
|
987
|
+
/** Form field name. */
|
|
988
|
+
name: string | undefined;
|
|
989
|
+
/** Visible label (also the accessible name). Without it, use aria-label. */
|
|
990
|
+
label: string | undefined;
|
|
991
|
+
/** Not editable nor submitted. */
|
|
992
|
+
disabled: boolean | undefined;
|
|
993
|
+
/** Height and font size. */
|
|
994
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
995
|
+
/** Corner radius. */
|
|
996
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
997
|
+
/** Box style. */
|
|
998
|
+
variant: "default" | "filled" | "unstyled";
|
|
999
|
+
/** Empties the box (fires input and ray-search). */
|
|
1000
|
+
clear(): void;
|
|
1001
|
+
addEventListener<K extends keyof RaySearchEventMap>(type: K, listener: (this: RaySearch, ev: RaySearchEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1002
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1003
|
+
removeEventListener<K extends keyof RaySearchEventMap>(type: K, listener: (this: RaySearch, ev: RaySearchEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1004
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1005
|
+
}
|
|
1006
|
+
export interface RaySearchEventMap extends HTMLElementEventMap {
|
|
1007
|
+
/** After `debounce` ms without typing, on Enter, and when cleared. */
|
|
1008
|
+
"ray-search": CustomEvent<{ value: string }>;
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
// --- Segmented control (segmented-control)
|
|
1012
|
+
/** <ray-segmented-control> One choice among a few, as a segmented row with a sliding indicator. Options from child <option> elements or data. Form-associated. */
|
|
1013
|
+
export declare class RaySegmentedControl extends FormControl {
|
|
1014
|
+
/** Selected value (default: the first enabled option). */
|
|
1015
|
+
value: string | undefined;
|
|
1016
|
+
/** Options as strings or { value, label, disabled }. */
|
|
1017
|
+
data: Array<string | { value: string; label?: string; disabled?: boolean }> | undefined;
|
|
1018
|
+
/** Form field name. */
|
|
1019
|
+
name: string | undefined;
|
|
1020
|
+
/** Indicator color (default: a raised neutral segment). */
|
|
1021
|
+
color: string | undefined;
|
|
1022
|
+
/** Height and font size. */
|
|
1023
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1024
|
+
/** Corner radius. */
|
|
1025
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
1026
|
+
/** Takes the whole width. */
|
|
1027
|
+
fullWidth: boolean | undefined;
|
|
1028
|
+
/** Direction. */
|
|
1029
|
+
orientation: "horizontal" | "vertical";
|
|
1030
|
+
/** Not interactive nor submitted. */
|
|
1031
|
+
disabled: boolean | undefined;
|
|
1032
|
+
/** The options, from data or the child options. */
|
|
1033
|
+
readonly items: Array<{ value: string; label: string; disabled: boolean }>;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
// --- Select (select)
|
|
1037
|
+
/** <ray-select> A select with its own dropdown (keyboard, typeahead, groups); options from child <option> elements or the data property. Form-associated. */
|
|
1038
|
+
export declare class RaySelect extends FieldControl {
|
|
1039
|
+
/** Selected value. */
|
|
1040
|
+
value: string | undefined;
|
|
1041
|
+
/** Options as strings or { value, label, disabled } (instead of child options). */
|
|
1042
|
+
data: Array<string | { value: string; label?: string; disabled?: boolean }> | undefined;
|
|
1043
|
+
/** Shown while nothing is selected (with required, blocks submit). */
|
|
1044
|
+
placeholder: string | undefined;
|
|
1045
|
+
/** The dropdown is shown. */
|
|
1046
|
+
open: boolean | undefined;
|
|
1047
|
+
/** Form field name. */
|
|
1048
|
+
name: string | undefined;
|
|
1049
|
+
/** Visible label. */
|
|
1050
|
+
label: string | undefined;
|
|
1051
|
+
/** Help text. */
|
|
1052
|
+
description: string | undefined;
|
|
1053
|
+
/** The description before the control (help first) or after it, with the error (fields in a row stay aligned). */
|
|
1054
|
+
descriptionPosition: "above" | "below";
|
|
1055
|
+
/** Error text. */
|
|
1056
|
+
error: string | undefined;
|
|
1057
|
+
/** Required for form submission. */
|
|
1058
|
+
required: boolean | undefined;
|
|
1059
|
+
/** Not interactive nor submitted. */
|
|
1060
|
+
disabled: boolean | undefined;
|
|
1061
|
+
/** Height and font size. */
|
|
1062
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1063
|
+
/** Box style. */
|
|
1064
|
+
variant: "default" | "filled" | "unstyled";
|
|
1065
|
+
/** The options of the model select. */
|
|
1066
|
+
readonly options: HTMLOptionsCollection;
|
|
1067
|
+
/** Opens or closes the dropdown. */
|
|
1068
|
+
toggle(force?: boolean): void;
|
|
1069
|
+
addEventListener<K extends keyof RaySelectEventMap>(type: K, listener: (this: RaySelect, ev: RaySelectEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1070
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1071
|
+
removeEventListener<K extends keyof RaySelectEventMap>(type: K, listener: (this: RaySelect, ev: RaySelectEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1072
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1073
|
+
}
|
|
1074
|
+
export interface RaySelectEventMap extends HTMLElementEventMap {
|
|
1075
|
+
/** The dropdown opened. */
|
|
1076
|
+
"ray-open": CustomEvent<unknown>;
|
|
1077
|
+
/** The dropdown closed. */
|
|
1078
|
+
"ray-close": CustomEvent<unknown>;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
// --- Slider (slider)
|
|
1082
|
+
/** <ray-slider> A native range input (keyboard, touch and screen readers as usual) with label, value display and marks. Form-associated. */
|
|
1083
|
+
export declare class RaySlider extends FieldControl {
|
|
1084
|
+
/** Current value. The value attribute is the initial one (restored on reset). */
|
|
1085
|
+
value: number | undefined;
|
|
1086
|
+
/** Minimum. */
|
|
1087
|
+
min: number;
|
|
1088
|
+
/** Maximum. */
|
|
1089
|
+
max: number;
|
|
1090
|
+
/** Step. */
|
|
1091
|
+
step: number;
|
|
1092
|
+
/** Form field name. */
|
|
1093
|
+
name: string | undefined;
|
|
1094
|
+
/** Visible label. */
|
|
1095
|
+
label: string | undefined;
|
|
1096
|
+
/** Help text. */
|
|
1097
|
+
description: string | undefined;
|
|
1098
|
+
/** The description before the control (help first) or after it, with the error (fields in a row stay aligned). */
|
|
1099
|
+
descriptionPosition: "above" | "below";
|
|
1100
|
+
/** Error text. */
|
|
1101
|
+
error: string | undefined;
|
|
1102
|
+
/** Not interactive nor submitted. */
|
|
1103
|
+
disabled: boolean | undefined;
|
|
1104
|
+
/** Track and thumb color. */
|
|
1105
|
+
color: string | undefined;
|
|
1106
|
+
/** Track and thumb size. */
|
|
1107
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1108
|
+
/** Shows the value next to the label. */
|
|
1109
|
+
showValue: boolean | undefined;
|
|
1110
|
+
/** Appended to the shown value and its spoken text (%, px, ms…). */
|
|
1111
|
+
unit: string | undefined;
|
|
1112
|
+
/** Labeled ticks under the track. */
|
|
1113
|
+
marks: Array<number | { value: number; label?: string }> | undefined;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
// --- Switch (switch)
|
|
1117
|
+
/** <ray-switch> Same properties and events as ray-checkbox (indeterminate does not apply). */
|
|
1118
|
+
export declare class RaySwitch extends RayCheckbox {
|
|
1119
|
+
/** Current state. The checked attribute is the initial state. */
|
|
1120
|
+
checked: boolean | undefined;
|
|
1121
|
+
/** Submitted value when on. */
|
|
1122
|
+
value: string;
|
|
1123
|
+
/** Form field name. */
|
|
1124
|
+
name: string | undefined;
|
|
1125
|
+
/** Label text (or the content). */
|
|
1126
|
+
label: string | undefined;
|
|
1127
|
+
/** Help text. */
|
|
1128
|
+
description: string | undefined;
|
|
1129
|
+
/** Error text. */
|
|
1130
|
+
error: string | undefined;
|
|
1131
|
+
/** Side of the label. */
|
|
1132
|
+
labelPosition: "right" | "left";
|
|
1133
|
+
/** Track color when on. */
|
|
1134
|
+
color: string | undefined;
|
|
1135
|
+
/** Track size. */
|
|
1136
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1137
|
+
/** Not interactive nor submitted. */
|
|
1138
|
+
disabled: boolean | undefined;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
// --- Textarea (textarea)
|
|
1142
|
+
/** <ray-textarea> Also forwards placeholder, autocomplete, minlength, maxlength, spellcheck and wrap. Initial value: the value attribute or the element's text. */
|
|
1143
|
+
export declare class RayTextarea extends FieldControl {
|
|
1144
|
+
/** Current value. */
|
|
1145
|
+
value: string | undefined;
|
|
1146
|
+
/** Visible rows (minimum when autosize). */
|
|
1147
|
+
rows: number;
|
|
1148
|
+
/** Grows with the content. */
|
|
1149
|
+
autosize: boolean | undefined;
|
|
1150
|
+
/** With autosize: stop growing and scroll after this many rows. */
|
|
1151
|
+
maxRows: number | undefined;
|
|
1152
|
+
/** Form field name. */
|
|
1153
|
+
name: string | undefined;
|
|
1154
|
+
/** Visible label. */
|
|
1155
|
+
label: string | undefined;
|
|
1156
|
+
/** Help text. */
|
|
1157
|
+
description: string | undefined;
|
|
1158
|
+
/** The description before the control (help first) or after it, with the error (fields in a row stay aligned). */
|
|
1159
|
+
descriptionPosition: "above" | "below";
|
|
1160
|
+
/** Error text. */
|
|
1161
|
+
error: string | undefined;
|
|
1162
|
+
/** Required for form submission. */
|
|
1163
|
+
required: boolean | undefined;
|
|
1164
|
+
/** Not editable nor submitted. */
|
|
1165
|
+
disabled: boolean | undefined;
|
|
1166
|
+
/** Not editable, still submitted. */
|
|
1167
|
+
readonly: boolean | undefined;
|
|
1168
|
+
/** Font size. */
|
|
1169
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1170
|
+
/** Box style. */
|
|
1171
|
+
variant: "default" | "filled" | "unstyled";
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
// --- Bottom nav (bottom-nav)
|
|
1175
|
+
/** <ray-bottom-nav> With href items it marks the link to this page (aria-current="page"); without, it is a control (value, change). Clear of the home indicator (safe-area inset). In a ray-app-shell, put it in the bottom slot. */
|
|
1176
|
+
export declare class RayBottomNav extends RayElement {
|
|
1177
|
+
/** The current destination (an item's value, else its href, else its label). */
|
|
1178
|
+
value: string | undefined;
|
|
1179
|
+
/** Accessible name of the navigation. */
|
|
1180
|
+
label: string;
|
|
1181
|
+
/** Which labels show (the others stay for assistive technology). */
|
|
1182
|
+
labels: "always" | "active" | "never";
|
|
1183
|
+
/** How the current destination is marked besides its color. */
|
|
1184
|
+
indicator: "pill" | "line" | "none";
|
|
1185
|
+
/** A palette color or any CSS color for the current item and the action (default: primary). */
|
|
1186
|
+
color: string | undefined;
|
|
1187
|
+
/** default: a bar across the bottom; floating: a rounded bar off the edges. */
|
|
1188
|
+
variant: "default" | "floating";
|
|
1189
|
+
/** Slides away while the content scrolls down, back on the way up. */
|
|
1190
|
+
hideOnScroll: boolean | undefined;
|
|
1191
|
+
/** Pinned to the bottom of the window (outside a shell). */
|
|
1192
|
+
fixed: boolean | undefined;
|
|
1193
|
+
/** A selector of the element whose scrolling it follows (default: its shell's, else the window). */
|
|
1194
|
+
scrollTarget: string | undefined;
|
|
1195
|
+
/** The items, in order. */
|
|
1196
|
+
readonly items: RayBottomNavItem[];
|
|
1197
|
+
addEventListener<K extends keyof RayBottomNavEventMap>(type: K, listener: (this: RayBottomNav, ev: RayBottomNavEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1198
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1199
|
+
removeEventListener<K extends keyof RayBottomNavEventMap>(type: K, listener: (this: RayBottomNav, ev: RayBottomNavEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1200
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1201
|
+
}
|
|
1202
|
+
export interface RayBottomNavEventMap extends HTMLElementEventMap {
|
|
1203
|
+
/** An action item was pressed. */
|
|
1204
|
+
"ray-select": CustomEvent<{ value: string }>;
|
|
1205
|
+
}
|
|
1206
|
+
/** <ray-bottom-nav-item> A link with href, else a button. The badge is read with the label ("Messages, 3"). */
|
|
1207
|
+
export declare class RayBottomNavItem extends RayElement {
|
|
1208
|
+
/** Its value (default: its href, else its label). */
|
|
1209
|
+
value: string | undefined;
|
|
1210
|
+
/** The label. */
|
|
1211
|
+
label: string | undefined;
|
|
1212
|
+
/** An icon of the registry (or put one in the icon slot). */
|
|
1213
|
+
icon: string | undefined;
|
|
1214
|
+
/** Makes it a link. */
|
|
1215
|
+
href: string | undefined;
|
|
1216
|
+
/** A count or a short text on the icon. */
|
|
1217
|
+
badge: string | undefined;
|
|
1218
|
+
/** A dot on the icon (something new). */
|
|
1219
|
+
dot: boolean | undefined;
|
|
1220
|
+
/** Set by the bar: the current destination. */
|
|
1221
|
+
active: boolean | undefined;
|
|
1222
|
+
/** Not interactive. */
|
|
1223
|
+
disabled: boolean | undefined;
|
|
1224
|
+
/** A raised round button ("New"): it fires ray-select on the bar, it is not a destination. */
|
|
1225
|
+
action: boolean | undefined;
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
// --- Breadcrumbs (breadcrumbs)
|
|
1229
|
+
/** <ray-breadcrumbs> A <nav aria-label="Breadcrumb"> around a list. The last crumb is the current page (aria-current="page") unless one says current. */
|
|
1230
|
+
export declare class RayBreadcrumbs extends RayElement {
|
|
1231
|
+
/** Text between crumbs ("/", "›", "·") or "chevron" (an icon). */
|
|
1232
|
+
separator: string;
|
|
1233
|
+
/** Longer paths show the first crumb, "…" (a button that expands them) and the last max-items − 1. */
|
|
1234
|
+
maxItems: number | undefined;
|
|
1235
|
+
/** Accessible name of the nav. */
|
|
1236
|
+
label: string;
|
|
1237
|
+
/** Font size. */
|
|
1238
|
+
size: "xs" | "sm" | "md" | "lg";
|
|
1239
|
+
/** The crumbs, in order. */
|
|
1240
|
+
readonly items: RayBreadcrumb[];
|
|
1241
|
+
/** Shows every crumb of a collapsed path. */
|
|
1242
|
+
expand(): void;
|
|
1243
|
+
}
|
|
1244
|
+
/** <ray-breadcrumb> A link with href (text without, or when current). */
|
|
1245
|
+
export declare class RayBreadcrumb extends RayElement {
|
|
1246
|
+
/** Where it leads. */
|
|
1247
|
+
href: string | undefined;
|
|
1248
|
+
/** This crumb is the current page (default: the last). */
|
|
1249
|
+
current: boolean | undefined;
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
// --- Nav link (nav-link)
|
|
1253
|
+
/** <ray-nav-link> A link with href (aria-current=page when active), or a button that toggles its nested links. */
|
|
1254
|
+
export declare class RayNavLink extends RayElement {
|
|
1255
|
+
/** Text. */
|
|
1256
|
+
label: string | undefined;
|
|
1257
|
+
/** Second line. */
|
|
1258
|
+
description: string | undefined;
|
|
1259
|
+
/** Makes it a link (ignored when it has nested links). */
|
|
1260
|
+
href: string | undefined;
|
|
1261
|
+
/** The current page or section. */
|
|
1262
|
+
active: boolean | undefined;
|
|
1263
|
+
/** Nested links are shown. */
|
|
1264
|
+
opened: boolean | undefined;
|
|
1265
|
+
/** Not interactive. */
|
|
1266
|
+
disabled: boolean | undefined;
|
|
1267
|
+
/** Style of the active state. */
|
|
1268
|
+
variant: "light" | "filled" | "subtle";
|
|
1269
|
+
/** Active color. */
|
|
1270
|
+
color: string | undefined;
|
|
1271
|
+
/** Only the icon (left section), centered; the label becomes its accessible name and tooltip. A collapsed ray-sidebar sets it. */
|
|
1272
|
+
iconOnly: boolean | undefined;
|
|
1273
|
+
/** The nested nav links. */
|
|
1274
|
+
readonly links: RayNavLink[];
|
|
1275
|
+
addEventListener<K extends keyof RayNavLinkEventMap>(type: K, listener: (this: RayNavLink, ev: RayNavLinkEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1276
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1277
|
+
removeEventListener<K extends keyof RayNavLinkEventMap>(type: K, listener: (this: RayNavLink, ev: RayNavLinkEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1278
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1279
|
+
}
|
|
1280
|
+
export interface RayNavLinkEventMap extends HTMLElementEventMap {
|
|
1281
|
+
/** Nested links were shown or hidden. */
|
|
1282
|
+
"ray-toggle": CustomEvent<{ opened: boolean }>;
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
// --- Pagination (pagination)
|
|
1286
|
+
/** The items a pagination shows for a page (numbers and "dots"). */
|
|
1287
|
+
export declare function paginationRange(total: number, value: number, siblings?: number, boundaries?: number): Array<number | "dots">;
|
|
1288
|
+
/** <ray-pagination> JS: setPage(n), next(), previous(), first(), last(); page (clamped value). */
|
|
1289
|
+
export declare class RayPagination extends RayElement {
|
|
1290
|
+
/** Number of pages. */
|
|
1291
|
+
total: number;
|
|
1292
|
+
/** Current page (1-based). */
|
|
1293
|
+
value: number;
|
|
1294
|
+
/** Pages shown on each side of the current one. */
|
|
1295
|
+
siblings: number;
|
|
1296
|
+
/** Pages always shown at the start and the end. */
|
|
1297
|
+
boundaries: number;
|
|
1298
|
+
/** Adds first/last page buttons. */
|
|
1299
|
+
withEdges: boolean | undefined;
|
|
1300
|
+
/** Hides the previous/next (and first/last) buttons. */
|
|
1301
|
+
hideControls: boolean | undefined;
|
|
1302
|
+
/** Color of the current page: a palette color or any CSS color. Default: the primary color. */
|
|
1303
|
+
color: string | undefined;
|
|
1304
|
+
/** Item size. */
|
|
1305
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1306
|
+
/** Corner radius of the items. */
|
|
1307
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
1308
|
+
/** Not interactive. */
|
|
1309
|
+
disabled: boolean | undefined;
|
|
1310
|
+
/** Accessible name of the navigation landmark. */
|
|
1311
|
+
label: string;
|
|
1312
|
+
/** The current page clamped to 1…total. */
|
|
1313
|
+
readonly page: number;
|
|
1314
|
+
/** Goes to a page (fires change). */
|
|
1315
|
+
setPage(page: number): void;
|
|
1316
|
+
/** Next page. */
|
|
1317
|
+
next(): void;
|
|
1318
|
+
/** Previous page. */
|
|
1319
|
+
previous(): void;
|
|
1320
|
+
/** First page. */
|
|
1321
|
+
first(): void;
|
|
1322
|
+
/** Last page. */
|
|
1323
|
+
last(): void;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1326
|
+
// --- Sidebar (sidebar)
|
|
1327
|
+
/** <ray-sidebar> Put ray-sidebar-group + ray-nav-link (with an icon in slot=left) inside. Collapsed, nav links show only their icon (the label becomes the tooltip) and the host has the collapsed attribute, so your own header/footer content can hide with CSS (ray-sidebar[collapsed] .brand-name { display: none }). */
|
|
1328
|
+
export declare class RaySidebar extends RayElement {
|
|
1329
|
+
/** Wide screens: an icon rail instead of the full panel. */
|
|
1330
|
+
collapsed: boolean | undefined;
|
|
1331
|
+
/** Narrow screens: the drawer is shown (modal, focus trapped; Escape, backdrop click or a followed link close it). */
|
|
1332
|
+
open: boolean | undefined;
|
|
1333
|
+
/** The edge it sits on. */
|
|
1334
|
+
side: "left" | "right";
|
|
1335
|
+
/** A panel against the edge, or a floating card with a margin. */
|
|
1336
|
+
variant: "sidebar" | "floating";
|
|
1337
|
+
/** Width when expanded (CSS length). Default 16rem. */
|
|
1338
|
+
width: string | undefined;
|
|
1339
|
+
/** Width of the icon rail. Default 3.5rem. */
|
|
1340
|
+
collapsedWidth: string | undefined;
|
|
1341
|
+
/** At this viewport width and below, it becomes a drawer. */
|
|
1342
|
+
breakpoint: string;
|
|
1343
|
+
/** Accessible name of its navigation. */
|
|
1344
|
+
label: string;
|
|
1345
|
+
/** Collapses/expands on wide screens; opens/closes the drawer on narrow ones. */
|
|
1346
|
+
toggle(): void;
|
|
1347
|
+
/** Whether it is in drawer mode (at or below the breakpoint). */
|
|
1348
|
+
readonly mobile: boolean;
|
|
1349
|
+
addEventListener<K extends keyof RaySidebarEventMap>(type: K, listener: (this: RaySidebar, ev: RaySidebarEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1350
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1351
|
+
removeEventListener<K extends keyof RaySidebarEventMap>(type: K, listener: (this: RaySidebar, ev: RaySidebarEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1352
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1353
|
+
}
|
|
1354
|
+
export interface RaySidebarEventMap extends HTMLElementEventMap {
|
|
1355
|
+
/** After toggle(). */
|
|
1356
|
+
"ray-toggle": CustomEvent<{ collapsed: boolean; open: boolean; mobile: boolean }>;
|
|
1357
|
+
/** The drawer opened (narrow screens). */
|
|
1358
|
+
"ray-open": CustomEvent<unknown>;
|
|
1359
|
+
/** The drawer closed (narrow screens). */
|
|
1360
|
+
"ray-close": CustomEvent<unknown>;
|
|
1361
|
+
}
|
|
1362
|
+
/** <ray-sidebar-group> A titled section of nav links; the title fades out (keeping its height) when the sidebar collapses. */
|
|
1363
|
+
export declare class RaySidebarGroup extends RayElement {
|
|
1364
|
+
/** Section title. */
|
|
1365
|
+
label: string | undefined;
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
// --- Stepper (stepper)
|
|
1369
|
+
/** <ray-stepper> The steps are a labelled list; the active one has aria-current="step" and each reads "Step 2 of 4: Shipping, completed". Only the active step's content shows; past the last step, the completed slot. */
|
|
1370
|
+
export declare class RayStepper extends RayElement {
|
|
1371
|
+
/** Index of the active step (steps.length: completed). */
|
|
1372
|
+
active: number;
|
|
1373
|
+
/** Steps in a row above the content, or in a column beside it. */
|
|
1374
|
+
orientation: "horizontal" | "vertical";
|
|
1375
|
+
/** Label beside the number, or under it (narrow screens, many steps). */
|
|
1376
|
+
iconPosition: "left" | "top";
|
|
1377
|
+
/** Completed steps are buttons that go back to them. */
|
|
1378
|
+
allowStepSelect: boolean | undefined;
|
|
1379
|
+
/** With allow-step-select off, false lets the user jump to any step. */
|
|
1380
|
+
linear: boolean;
|
|
1381
|
+
/** Size of the numbers. */
|
|
1382
|
+
size: "sm" | "md" | "lg";
|
|
1383
|
+
/** A palette color or any CSS color for active and completed steps (default: primary). */
|
|
1384
|
+
color: string | undefined;
|
|
1385
|
+
/** Accessible name of the list of steps. */
|
|
1386
|
+
label: string;
|
|
1387
|
+
/** The steps, in order. */
|
|
1388
|
+
readonly steps: RayStep[];
|
|
1389
|
+
/** To the next step (past the last: completed). */
|
|
1390
|
+
next(): void;
|
|
1391
|
+
/** To the previous step. */
|
|
1392
|
+
prev(): void;
|
|
1393
|
+
}
|
|
1394
|
+
/** <ray-step> A step: its header is drawn by the stepper, its content shows while it is active. */
|
|
1395
|
+
export declare class RayStep extends RayElement {
|
|
1396
|
+
/** The label. */
|
|
1397
|
+
label: string | undefined;
|
|
1398
|
+
/** A line under the label. */
|
|
1399
|
+
description: string | undefined;
|
|
1400
|
+
/** An icon instead of the number. */
|
|
1401
|
+
icon: string | undefined;
|
|
1402
|
+
/** The icon once done (default: check). */
|
|
1403
|
+
completedIcon: string | undefined;
|
|
1404
|
+
/** A spinner instead of the number. */
|
|
1405
|
+
loading: boolean | undefined;
|
|
1406
|
+
/** An error message: red step, the message as its description. */
|
|
1407
|
+
error: string | undefined;
|
|
1408
|
+
/** Cannot be selected. */
|
|
1409
|
+
disabled: boolean | undefined;
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
// --- Tabs (tabs)
|
|
1413
|
+
/** <ray-tabs> Tabs and panels (WAI-ARIA tabs pattern): arrows, Home/End, automatic or manual activation. */
|
|
1414
|
+
export declare class RayTabs extends RayElement {
|
|
1415
|
+
/** Value of the active tab (default: the first enabled one). */
|
|
1416
|
+
value: string | undefined;
|
|
1417
|
+
/** Tab style. */
|
|
1418
|
+
variant: "default" | "outline" | "pills";
|
|
1419
|
+
/** Tab list direction (and arrow keys). */
|
|
1420
|
+
orientation: "horizontal" | "vertical";
|
|
1421
|
+
/** Active indicator color. */
|
|
1422
|
+
color: string | undefined;
|
|
1423
|
+
/** manual: arrows move focus, Enter/Space activates. */
|
|
1424
|
+
activation: "auto" | "manual";
|
|
1425
|
+
/** Tabs share the full width. */
|
|
1426
|
+
grow: boolean | undefined;
|
|
1427
|
+
/** The tabs. */
|
|
1428
|
+
readonly tabs: RayTab[];
|
|
1429
|
+
/** The panels. */
|
|
1430
|
+
readonly panels: RayTabPanel[];
|
|
1431
|
+
}
|
|
1432
|
+
/** <ray-tab> Tabs and panels (WAI-ARIA tabs pattern): arrows, Home/End, automatic or manual activation. */
|
|
1433
|
+
export declare class RayTab extends RayElement {
|
|
1434
|
+
/** Matches a ray-tab-panel's value. */
|
|
1435
|
+
value: string | undefined;
|
|
1436
|
+
/** Cannot be activated. */
|
|
1437
|
+
disabled: boolean | undefined;
|
|
1438
|
+
}
|
|
1439
|
+
/** <ray-tab-panel> Tabs and panels (WAI-ARIA tabs pattern): arrows, Home/End, automatic or manual activation. */
|
|
1440
|
+
export declare class RayTabPanel extends RayElement {
|
|
1441
|
+
/** Matches a ray-tab's value. */
|
|
1442
|
+
value: string | undefined;
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
// --- Command palette (command-palette)
|
|
1446
|
+
/** An action of ray-command-palette. */
|
|
1447
|
+
export type CommandAction = { id?: string; label: string; description?: string; group?: string; keywords?: string | string[]; shortcut?: string; icon?: string | Node; disabled?: boolean; native?: boolean; tag?: string; onSelect?: (action: CommandAction) => void };
|
|
1448
|
+
/** How well an action matches a query (0 = not at all). */
|
|
1449
|
+
export declare function score(action: CommandAction, query: string): number;
|
|
1450
|
+
/** <ray-command-palette> Running an action fires ray-select and calls its onSelect. The best matches come first, grouped. */
|
|
1451
|
+
export declare class RayCommandPalette extends RayElement {
|
|
1452
|
+
/** Shown. */
|
|
1453
|
+
open: boolean | undefined;
|
|
1454
|
+
/** The actions. */
|
|
1455
|
+
actions: CommandAction[] | undefined;
|
|
1456
|
+
/** The search text. */
|
|
1457
|
+
query: string | undefined;
|
|
1458
|
+
/** Placeholder of the search field. */
|
|
1459
|
+
placeholder: string;
|
|
1460
|
+
/** Toggle shortcut (mod = ⌘ on macOS, Ctrl elsewhere); empty to disable. */
|
|
1461
|
+
hotkey: string;
|
|
1462
|
+
/** Maximum results. */
|
|
1463
|
+
limit: number;
|
|
1464
|
+
/** Text without results. */
|
|
1465
|
+
emptyLabel: string;
|
|
1466
|
+
/** Accessible name. */
|
|
1467
|
+
label: string;
|
|
1468
|
+
/** No keyboard hint at the bottom. */
|
|
1469
|
+
hideHint: boolean | undefined;
|
|
1470
|
+
/** With a native host (ray-elements/core/raylang.js in a std/ui window, menus declared with elements/bridge), also lists the app's menu bar, grouped by menu with its shortcuts; running one gives the program the menu's own event. */
|
|
1471
|
+
nativeMenus: boolean | undefined;
|
|
1472
|
+
/** Blur of the page behind: px ("8"), a CSS length or "none". Default: --ray-overlay-blur ([overlay] blur in tokens.toml). */
|
|
1473
|
+
overlayBlur: string | undefined;
|
|
1474
|
+
/** Opens it. */
|
|
1475
|
+
show(): void;
|
|
1476
|
+
/** Closes it. */
|
|
1477
|
+
hide(): void;
|
|
1478
|
+
/** Opens or closes it. */
|
|
1479
|
+
toggle(): void;
|
|
1480
|
+
/** The actions matching the query, in display order. */
|
|
1481
|
+
readonly results: CommandAction[];
|
|
1482
|
+
addEventListener<K extends keyof RayCommandPaletteEventMap>(type: K, listener: (this: RayCommandPalette, ev: RayCommandPaletteEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1483
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1484
|
+
removeEventListener<K extends keyof RayCommandPaletteEventMap>(type: K, listener: (this: RayCommandPalette, ev: RayCommandPaletteEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1485
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1486
|
+
}
|
|
1487
|
+
export interface RayCommandPaletteEventMap extends HTMLElementEventMap {
|
|
1488
|
+
/** An action was run. */
|
|
1489
|
+
"ray-select": CustomEvent<{ action: CommandAction }>;
|
|
1490
|
+
/** After it opened. */
|
|
1491
|
+
"ray-open": CustomEvent<unknown>;
|
|
1492
|
+
/** After it closed. */
|
|
1493
|
+
"ray-close": CustomEvent<unknown>;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
// --- Dialog (dialog)
|
|
1497
|
+
/** Options of confirmDialog(). */
|
|
1498
|
+
export type ConfirmOptions = { label?: string; message?: string; confirmLabel?: string; cancelLabel?: string; color?: string; native?: boolean };
|
|
1499
|
+
/** A confirmation dialog; resolves true when confirmed. With a native host, the system dialog (native: false keeps the ray-dialog). */
|
|
1500
|
+
export declare function confirmDialog(options?: ConfirmOptions): Promise<boolean>;
|
|
1501
|
+
/** <ray-dialog> Any slotted element with data-dialog-close closes it (its value becomes returnValue). JS: show(), close(returnValue), confirmDialog({ label, message, confirmLabel, cancelLabel, color, native }) -> Promise<boolean>; with a native host (ray-elements/core/raylang.js in a std/ui window) it asks with the system dialog unless native is false. */
|
|
1502
|
+
export declare class RayDialog extends RayElement {
|
|
1503
|
+
/** Shown as a modal. */
|
|
1504
|
+
open: boolean | undefined;
|
|
1505
|
+
/** Heading (also the dialog's accessible name). */
|
|
1506
|
+
label: string | undefined;
|
|
1507
|
+
/** A line under the title (the dialog's accessible description). */
|
|
1508
|
+
description: string | undefined;
|
|
1509
|
+
/** Width: xs…xl, full (the whole window), or any CSS length; a percentage is of the window (70% = 70vw, at least 40rem). Never wider than the window. */
|
|
1510
|
+
size: "xs" | "sm" | "md" | "lg" | "xl" | "full" | (string & {});
|
|
1511
|
+
/** Fixed height (the body scrolls): any CSS length; a percentage is of the window (70% = 70dvh, at least 30rem). Never taller than the window. Default: as tall as the content, up to the window. */
|
|
1512
|
+
height: string | undefined;
|
|
1513
|
+
/** Corner radius: xs…xl, none, or a CSS length. Default: lg. */
|
|
1514
|
+
radius: string | undefined;
|
|
1515
|
+
/** Vertical placement. */
|
|
1516
|
+
position: "center" | "top";
|
|
1517
|
+
/** Escape and backdrop clicks do not close it (the × still does; hide it with hide-close). To allow only one of them, cancel ray-request-close by its source. */
|
|
1518
|
+
persistent: boolean | undefined;
|
|
1519
|
+
/** No close button in the header. */
|
|
1520
|
+
hideClose: boolean | undefined;
|
|
1521
|
+
/** Blur of the page behind: px ("8"), a CSS length or "none". Default: --ray-overlay-blur ([overlay] blur in tokens.toml). */
|
|
1522
|
+
overlayBlur: string | undefined;
|
|
1523
|
+
/** Opens it. */
|
|
1524
|
+
show(): void;
|
|
1525
|
+
/** Closes it with an optional return value. */
|
|
1526
|
+
close(returnValue?: string): void;
|
|
1527
|
+
/** The value it was closed with. */
|
|
1528
|
+
returnValue: string;
|
|
1529
|
+
addEventListener<K extends keyof RayDialogEventMap>(type: K, listener: (this: RayDialog, ev: RayDialogEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1530
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1531
|
+
removeEventListener<K extends keyof RayDialogEventMap>(type: K, listener: (this: RayDialog, ev: RayDialogEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1532
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1533
|
+
}
|
|
1534
|
+
export interface RayDialogEventMap extends HTMLElementEventMap {
|
|
1535
|
+
/** After it opened. */
|
|
1536
|
+
"ray-open": CustomEvent<unknown>;
|
|
1537
|
+
/** After it closed; detail: { returnValue }. */
|
|
1538
|
+
"ray-close": CustomEvent<{ returnValue: string }>;
|
|
1539
|
+
/** Escape, backdrop or close button; cancelable (preventDefault keeps it open). detail: { source }. */
|
|
1540
|
+
"ray-request-close": CustomEvent<{ source: "escape" | "backdrop" | "button" }>;
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
// --- Drawer (drawer)
|
|
1544
|
+
/** <ray-drawer> Any slotted element with data-dialog-close closes it. JS: show(), close(returnValue). */
|
|
1545
|
+
export declare class RayDrawer extends RayElement {
|
|
1546
|
+
/** Shown. */
|
|
1547
|
+
open: boolean | undefined;
|
|
1548
|
+
/** Heading (also the accessible name). */
|
|
1549
|
+
label: string | undefined;
|
|
1550
|
+
/** A line under the title (the drawer's accessible description). */
|
|
1551
|
+
description: string | undefined;
|
|
1552
|
+
/** The edge it slides from. */
|
|
1553
|
+
position: "right" | "left" | "top" | "bottom";
|
|
1554
|
+
/** Width (left/right) or height (top/bottom): xs…xl, full, or any CSS length. */
|
|
1555
|
+
size: "xs" | "sm" | "md" | "lg" | "xl" | "full" | (string & {});
|
|
1556
|
+
/** No backdrop nor scroll lock: the page stays interactive (a side panel). */
|
|
1557
|
+
modeless: boolean | undefined;
|
|
1558
|
+
/** Detached from the edge, with rounded corners. */
|
|
1559
|
+
floating: boolean | undefined;
|
|
1560
|
+
/** Escape and backdrop clicks do not close it. */
|
|
1561
|
+
persistent: boolean | undefined;
|
|
1562
|
+
/** No close button in the header. */
|
|
1563
|
+
hideClose: boolean | undefined;
|
|
1564
|
+
/** Blur of the page behind: px ("8"), a CSS length or "none". Default: --ray-overlay-blur ([overlay] blur in tokens.toml). */
|
|
1565
|
+
overlayBlur: string | undefined;
|
|
1566
|
+
/** Opens it. */
|
|
1567
|
+
show(): void;
|
|
1568
|
+
/** Closes it with an optional return value. */
|
|
1569
|
+
close(returnValue?: string): void;
|
|
1570
|
+
/** The value it was closed with. */
|
|
1571
|
+
returnValue: string;
|
|
1572
|
+
addEventListener<K extends keyof RayDrawerEventMap>(type: K, listener: (this: RayDrawer, ev: RayDrawerEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1573
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1574
|
+
removeEventListener<K extends keyof RayDrawerEventMap>(type: K, listener: (this: RayDrawer, ev: RayDrawerEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1575
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1576
|
+
}
|
|
1577
|
+
export interface RayDrawerEventMap extends HTMLElementEventMap {
|
|
1578
|
+
/** After it opened. */
|
|
1579
|
+
"ray-open": CustomEvent<unknown>;
|
|
1580
|
+
/** After it closed; detail: { returnValue }. */
|
|
1581
|
+
"ray-close": CustomEvent<{ returnValue: string }>;
|
|
1582
|
+
/** Escape, backdrop or close button; cancelable. */
|
|
1583
|
+
"ray-request-close": CustomEvent<{ source: "escape" | "backdrop" | "button" }>;
|
|
1584
|
+
}
|
|
1585
|
+
|
|
1586
|
+
// --- Menu (menu)
|
|
1587
|
+
/** <ray-menu> A dropdown menu (menu button pattern: arrows, Home/End, typeahead, Enter, Escape) or, with context, a context menu at the pointer. */
|
|
1588
|
+
export declare class RayMenu extends Floating {
|
|
1589
|
+
/** Shown. */
|
|
1590
|
+
open: boolean | undefined;
|
|
1591
|
+
/** Preferred side and alignment. */
|
|
1592
|
+
placement: "bottom-start" | "bottom" | "bottom-end" | "top-start" | "top" | "top-end" | "right-start" | "left-start";
|
|
1593
|
+
/** Opens on right click (contextmenu) over the trigger area, at the pointer. */
|
|
1594
|
+
context: boolean | undefined;
|
|
1595
|
+
/** Choosing an item does not close the menu. */
|
|
1596
|
+
keepOpen: boolean | undefined;
|
|
1597
|
+
/** With a native host (ray-elements/core/raylang.js in a std/ui window), opens as the system's context menu at the pointer: items and dividers, same ray-select. */
|
|
1598
|
+
native: boolean | undefined;
|
|
1599
|
+
/** Opens the items as the system's context menu (needs a native host); resolves to the chosen item, or null. */
|
|
1600
|
+
popupNative(): Promise<RayMenuItem | null>;
|
|
1601
|
+
/** Opens it. */
|
|
1602
|
+
show(): void;
|
|
1603
|
+
/** Closes it. */
|
|
1604
|
+
hide(): void;
|
|
1605
|
+
/** Opens or closes it. */
|
|
1606
|
+
toggle(): void;
|
|
1607
|
+
/** The trigger element. */
|
|
1608
|
+
readonly trigger: Element | null;
|
|
1609
|
+
/** The items of this menu. */
|
|
1610
|
+
readonly items: RayMenuItem[];
|
|
1611
|
+
addEventListener<K extends keyof RayMenuEventMap>(type: K, listener: (this: RayMenu, ev: RayMenuEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1612
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1613
|
+
removeEventListener<K extends keyof RayMenuEventMap>(type: K, listener: (this: RayMenu, ev: RayMenuEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1614
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1615
|
+
}
|
|
1616
|
+
export interface RayMenuEventMap extends HTMLElementEventMap {
|
|
1617
|
+
/** An item was chosen; detail: { value, item }. */
|
|
1618
|
+
"ray-select": CustomEvent<{ value: string; item: RayMenuItem }>;
|
|
1619
|
+
/** After it opened. */
|
|
1620
|
+
"ray-open": CustomEvent<unknown>;
|
|
1621
|
+
/** After it closed. */
|
|
1622
|
+
"ray-close": CustomEvent<unknown>;
|
|
1623
|
+
}
|
|
1624
|
+
/** <ray-menu-item> A dropdown menu (menu button pattern: arrows, Home/End, typeahead, Enter, Escape) or, with context, a context menu at the pointer. */
|
|
1625
|
+
export declare class RayMenuItem extends RayElement {
|
|
1626
|
+
/** Reported in ray-select (default: the text). */
|
|
1627
|
+
value: string | undefined;
|
|
1628
|
+
/** Skipped by the keyboard, cannot be chosen. */
|
|
1629
|
+
disabled: boolean | undefined;
|
|
1630
|
+
/** Text and hover color (e.g. red for destructive actions). */
|
|
1631
|
+
color: string | undefined;
|
|
1632
|
+
}
|
|
1633
|
+
/** <ray-menu-label> A section caption inside the menu. */
|
|
1634
|
+
export declare class RayMenuLabel extends RayElement {
|
|
1635
|
+
}
|
|
1636
|
+
/** <ray-menu-divider> A separator between groups of items. */
|
|
1637
|
+
export declare class RayMenuDivider extends RayElement {
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
// --- Popover (popover)
|
|
1641
|
+
/** <ray-popover> Positioned in JS (flip + shift to stay in the viewport). JS: show(), hide(), toggle(). */
|
|
1642
|
+
export declare class RayPopover extends Floating {
|
|
1643
|
+
/** Shown. */
|
|
1644
|
+
open: boolean | undefined;
|
|
1645
|
+
/** Preferred side and alignment. */
|
|
1646
|
+
placement: "bottom" | "bottom-start" | "bottom-end" | "top" | "top-start" | "top-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
|
|
1647
|
+
/** Gap to the trigger in px. */
|
|
1648
|
+
offset: number;
|
|
1649
|
+
/** Panel width (px number or CSS length). Default: its content. */
|
|
1650
|
+
width: string | undefined;
|
|
1651
|
+
/** At least as wide as the trigger. */
|
|
1652
|
+
matchWidth: boolean | undefined;
|
|
1653
|
+
/** Panel padding. */
|
|
1654
|
+
padding: "0" | "xs" | "sm" | "md" | "lg";
|
|
1655
|
+
/** Moves focus into the panel when opened and keeps Tab inside it. */
|
|
1656
|
+
trapFocus: boolean | undefined;
|
|
1657
|
+
/** Opens it. */
|
|
1658
|
+
show(): void;
|
|
1659
|
+
/** Closes it. */
|
|
1660
|
+
hide(): void;
|
|
1661
|
+
/** Opens or closes it. */
|
|
1662
|
+
toggle(): void;
|
|
1663
|
+
/** The trigger element. */
|
|
1664
|
+
readonly trigger: Element | null;
|
|
1665
|
+
addEventListener<K extends keyof RayPopoverEventMap>(type: K, listener: (this: RayPopover, ev: RayPopoverEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1666
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1667
|
+
removeEventListener<K extends keyof RayPopoverEventMap>(type: K, listener: (this: RayPopover, ev: RayPopoverEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1668
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1669
|
+
}
|
|
1670
|
+
export interface RayPopoverEventMap extends HTMLElementEventMap {
|
|
1671
|
+
/** After it opened. */
|
|
1672
|
+
"ray-open": CustomEvent<unknown>;
|
|
1673
|
+
/** After it closed (also by Escape or an outside click). */
|
|
1674
|
+
"ray-close": CustomEvent<unknown>;
|
|
1675
|
+
}
|
|
1676
|
+
|
|
1677
|
+
// --- Tooltip (tooltip)
|
|
1678
|
+
/** <ray-tooltip> A short hint on hover and focus of its child; the label also becomes the child's accessible description. */
|
|
1679
|
+
export declare class RayTooltip extends Floating {
|
|
1680
|
+
/** Tooltip text. */
|
|
1681
|
+
label: string | undefined;
|
|
1682
|
+
/** Preferred side. */
|
|
1683
|
+
placement: "top" | "bottom" | "left" | "right" | "top-start" | "top-end" | "bottom-start" | "bottom-end";
|
|
1684
|
+
/** ms before showing. */
|
|
1685
|
+
openDelay: number;
|
|
1686
|
+
/** ms before hiding. */
|
|
1687
|
+
closeDelay: number;
|
|
1688
|
+
/** A palette color or any CSS color. Default: inverted foreground/background. */
|
|
1689
|
+
color: string | undefined;
|
|
1690
|
+
/** Never shows. */
|
|
1691
|
+
disabled: boolean | undefined;
|
|
1692
|
+
/** Opens it. */
|
|
1693
|
+
show(): void;
|
|
1694
|
+
/** Closes it. */
|
|
1695
|
+
hide(): void;
|
|
1696
|
+
/** Opens or closes it. */
|
|
1697
|
+
toggle(): void;
|
|
1698
|
+
/** The trigger element. */
|
|
1699
|
+
readonly trigger: Element | null;
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
// --- Accordion (accordion)
|
|
1703
|
+
/** <ray-accordion> Collapsible sections (WAI-ARIA accordion pattern); one open at a time, or several with multiple. */
|
|
1704
|
+
export declare class RayAccordion extends RayElement {
|
|
1705
|
+
/** Open item's value; with multiple, an array (attribute: comma-separated). */
|
|
1706
|
+
value: string | string[] | undefined;
|
|
1707
|
+
/** Several items may be open. */
|
|
1708
|
+
multiple: boolean | undefined;
|
|
1709
|
+
/** Visual style. */
|
|
1710
|
+
variant: "default" | "contained" | "separated" | "filled";
|
|
1711
|
+
/** Side of the chevron. */
|
|
1712
|
+
chevronPosition: "right" | "left";
|
|
1713
|
+
/** The items. */
|
|
1714
|
+
readonly items: RayAccordionItem[];
|
|
1715
|
+
/** The open values as an array, whatever the mode. */
|
|
1716
|
+
readonly openValues: string[];
|
|
1717
|
+
}
|
|
1718
|
+
/** <ray-accordion-item> Collapsible sections (WAI-ARIA accordion pattern); one open at a time, or several with multiple. */
|
|
1719
|
+
export declare class RayAccordionItem extends RayElement {
|
|
1720
|
+
/** Identifies the item in the accordion's value. */
|
|
1721
|
+
value: string | undefined;
|
|
1722
|
+
/** Header text (or slot=label). */
|
|
1723
|
+
label: string | undefined;
|
|
1724
|
+
/** A secondary line under the label, in the header. */
|
|
1725
|
+
description: string | undefined;
|
|
1726
|
+
/** Cannot be toggled. */
|
|
1727
|
+
disabled: boolean | undefined;
|
|
1728
|
+
/** aria-level of the header. */
|
|
1729
|
+
headingLevel: number;
|
|
1730
|
+
/** Whether this item is expanded. */
|
|
1731
|
+
readonly open: boolean;
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
// --- Attachment (attachment)
|
|
1735
|
+
/** <ray-attachment> Assign a File to `file` to fill name, size, type and an image thumbnail. Removing it (× button) fires a cancelable ray-remove and then removes the element. */
|
|
1736
|
+
export declare class RayAttachment extends RayElement {
|
|
1737
|
+
/** File name (ellipsized; full name in the tooltip). */
|
|
1738
|
+
name: string | undefined;
|
|
1739
|
+
/** Size in bytes, shown as "12 KB", "3.4 MB". */
|
|
1740
|
+
size: number | undefined;
|
|
1741
|
+
/** MIME type: picks the icon (image or file) and, with the name, the extension badge. */
|
|
1742
|
+
type: string | undefined;
|
|
1743
|
+
/** Thumbnail URL for images (falls back to the icon if it fails to load). */
|
|
1744
|
+
src: string | undefined;
|
|
1745
|
+
/** Makes the name a download link. */
|
|
1746
|
+
href: string | undefined;
|
|
1747
|
+
/** Upload progress 0–100: a thin bar and "Uploading… 45%". Unset: done. */
|
|
1748
|
+
progress: number | undefined;
|
|
1749
|
+
/** Explicit state. Default: "uploading" while progress is set, else "done". */
|
|
1750
|
+
status: "uploading" | "done" | "error" | undefined;
|
|
1751
|
+
/** Error text shown with status="error" (default "Upload failed"). */
|
|
1752
|
+
error: string | undefined;
|
|
1753
|
+
/** Shows a remove (×) button. */
|
|
1754
|
+
removable: boolean | undefined;
|
|
1755
|
+
/** Accessible label of the remove button; {name} is replaced by the file name. */
|
|
1756
|
+
removeLabel: string;
|
|
1757
|
+
/** row: a compact chip; card: the thumbnail on top. */
|
|
1758
|
+
variant: "row" | "card";
|
|
1759
|
+
/** Dimmed, not removable, the name is not a link. */
|
|
1760
|
+
disabled: boolean | undefined;
|
|
1761
|
+
/** The File shown (fills name, size, type and a thumbnail for images). */
|
|
1762
|
+
file: File | null;
|
|
1763
|
+
/** The effective status. */
|
|
1764
|
+
readonly state: "uploading" | "done" | "error";
|
|
1765
|
+
addEventListener<K extends keyof RayAttachmentEventMap>(type: K, listener: (this: RayAttachment, ev: RayAttachmentEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1766
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1767
|
+
removeEventListener<K extends keyof RayAttachmentEventMap>(type: K, listener: (this: RayAttachment, ev: RayAttachmentEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1768
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1769
|
+
}
|
|
1770
|
+
export interface RayAttachmentEventMap extends HTMLElementEventMap {
|
|
1771
|
+
/** The remove button was pressed; cancelable (preventDefault keeps the element). */
|
|
1772
|
+
"ray-remove": CustomEvent<{ name: string; file: File | null }>;
|
|
1773
|
+
}
|
|
1774
|
+
/** <ray-attachments> A wrapping row of ray-attachment elements. */
|
|
1775
|
+
export declare class RayAttachments extends RayElement {
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
// --- Avatar (avatar)
|
|
1779
|
+
/** Up to two initials of a name: "Ada Lovelace" -> "AL". */
|
|
1780
|
+
export declare function initials(name: string): string;
|
|
1781
|
+
/** <ray-avatar> An image, the initials of a name, or a placeholder icon. */
|
|
1782
|
+
export declare class RayAvatar extends RayElement {
|
|
1783
|
+
/** Image URL; falls back to initials if it fails to load. */
|
|
1784
|
+
src: string | undefined;
|
|
1785
|
+
/** Accessible name (default: name). */
|
|
1786
|
+
alt: string | undefined;
|
|
1787
|
+
/** Person or entity name; its initials are shown without an image. */
|
|
1788
|
+
name: string | undefined;
|
|
1789
|
+
/** A palette color or any CSS color. */
|
|
1790
|
+
color: string | undefined;
|
|
1791
|
+
/** Style of the initials/placeholder. */
|
|
1792
|
+
variant: "light" | "filled" | "outline" | "default";
|
|
1793
|
+
/** Diameter. */
|
|
1794
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1795
|
+
/** Corner radius. Default: full. */
|
|
1796
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
// --- Badge (badge)
|
|
1800
|
+
/** <ray-badge> A short status label. */
|
|
1801
|
+
export declare class RayBadge extends RayElement {
|
|
1802
|
+
/** Visual style. */
|
|
1803
|
+
variant: "light" | "filled" | "outline" | "dot" | "default" | "gradient";
|
|
1804
|
+
/** With variant=gradient: "from to [deg]", palette colors or CSS colors ("teal blue 90"). Default: the --ray-gradient-* tokens. */
|
|
1805
|
+
gradient: string | undefined;
|
|
1806
|
+
/** A palette color or any CSS color. */
|
|
1807
|
+
color: string | undefined;
|
|
1808
|
+
/** Height and font size. */
|
|
1809
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1810
|
+
/** Corner radius. Default: full. */
|
|
1811
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
1812
|
+
/** Keeps the text as written instead of uppercase. */
|
|
1813
|
+
normalCase: boolean | undefined;
|
|
1814
|
+
}
|
|
1815
|
+
|
|
1816
|
+
// --- Blockquote (blockquote)
|
|
1817
|
+
/** <ray-blockquote> Paragraphs in it are spaced and the last one has no bottom margin. The attribution is text (cite) or rich content (slot="cite": an avatar, a name, a role). */
|
|
1818
|
+
export declare class RayBlockquote extends RayElement {
|
|
1819
|
+
/** Who said it, shown below the quote ("— Grace Hopper"). */
|
|
1820
|
+
cite: string | undefined;
|
|
1821
|
+
/** URL of the source: the inner blockquote's cite attribute. */
|
|
1822
|
+
href: string | undefined;
|
|
1823
|
+
/** A palette color or any CSS color, for the edge, the mark and the tint. Default: the primary. */
|
|
1824
|
+
color: string | undefined;
|
|
1825
|
+
/** light: tinted background; outline: border and edge only; filled: solid color (a pull quote). */
|
|
1826
|
+
variant: "light" | "outline" | "filled";
|
|
1827
|
+
/** Registry icon of the mark, or none. The icon slot replaces it. */
|
|
1828
|
+
icon: string;
|
|
1829
|
+
/** Text size (lg for a pull quote). */
|
|
1830
|
+
size: "sm" | "md" | "lg";
|
|
1831
|
+
/** Inner spacing: xs…xl (the spacing scale), px as a number, or a CSS length. Default: md. */
|
|
1832
|
+
padding: string | undefined;
|
|
1833
|
+
/** No colored edge on the start side (the tint, border and mark stay). */
|
|
1834
|
+
hideEdge: boolean | undefined;
|
|
1835
|
+
/** Corner radius: xs…xl, none, or a CSS length. Default: md. */
|
|
1836
|
+
radius: string | undefined;
|
|
1837
|
+
}
|
|
1838
|
+
|
|
1839
|
+
// --- Carousel (carousel)
|
|
1840
|
+
/** <ray-carousel> Any child is a slide. With several slides in view, positions are the snap points the viewport can reach. ArrowLeft/Right (Up/Down when vertical), Home and End move it. */
|
|
1841
|
+
export declare class RayCarousel extends RayElement {
|
|
1842
|
+
/** Current position (0-based). Setting it scrolls there. */
|
|
1843
|
+
index: number;
|
|
1844
|
+
/** Accessible name of the carousel region. */
|
|
1845
|
+
label: string;
|
|
1846
|
+
/** Size of each slide along the scroll axis ("100%" by default; "50%", "18rem"…). */
|
|
1847
|
+
slideSize: string | undefined;
|
|
1848
|
+
/** Space between slides (default var(--ray-space-4)). */
|
|
1849
|
+
slideGap: string | undefined;
|
|
1850
|
+
/** Where a slide snaps in the viewport. */
|
|
1851
|
+
align: "start" | "center";
|
|
1852
|
+
/** Scroll axis (vertical needs a height; 20rem by default). */
|
|
1853
|
+
orientation: "horizontal" | "vertical";
|
|
1854
|
+
/** next() on the last position goes to the first, prev() on the first to the last. */
|
|
1855
|
+
loop: boolean | undefined;
|
|
1856
|
+
/** Milliseconds between automatic moves (0: off). Pauses on hover, focus and when the page is hidden; starts paused with reduced motion. Shows a pause/play button. */
|
|
1857
|
+
autoplay: number;
|
|
1858
|
+
/** No previous/next buttons. */
|
|
1859
|
+
hideControls: boolean | undefined;
|
|
1860
|
+
/** No indicator dots. */
|
|
1861
|
+
hideIndicators: boolean | undefined;
|
|
1862
|
+
/** Goes to the next position. */
|
|
1863
|
+
next(): void;
|
|
1864
|
+
/** Goes to the previous position. */
|
|
1865
|
+
prev(): void;
|
|
1866
|
+
/** Scrolls to a position (smoothly unless instant or reduced motion). */
|
|
1867
|
+
goTo(index: number, options?: { instant?: boolean }): void;
|
|
1868
|
+
/** Number of positions. */
|
|
1869
|
+
readonly count: number;
|
|
1870
|
+
/** The slide elements. */
|
|
1871
|
+
readonly slides: Element[];
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
// --- Code (code)
|
|
1875
|
+
/** Hands every ray-code to a highlighter that returns HTML (Prism, highlight.js, Shiki…); null/undefined falls back to the built-in one. The HTML is inserted as is: pass only a trusted highlighter. null restores the built-in one. */
|
|
1876
|
+
export declare function setHighlighter(fn: ((code: string, lang: string) => string | Node | null | undefined | Promise<string | Node | null | undefined>) | null): void;
|
|
1877
|
+
/** The built-in highlighter: tokens of type keyword, string, number, comment, function, type, tag, attr, punctuation or text. */
|
|
1878
|
+
export declare function tokenize(code: string, lang?: string): [type: string, text: string][];
|
|
1879
|
+
/** <ray-code> The code comes from the code property, a <script type="text/plain"> child (raw text: anything but a closing script tag), a <template> child (parsed as HTML: the easiest for markup, but a < that is not a tag, as in Promise<void>, breaks it), or the element's text; common indentation and blank edges are removed. Built-in languages: js/ts (jsx, tsx), json, html/xml/svg/vue, css, shell, ray and diff; others show as plain text. Library classes painted with the tokens: Prism's .token.*, highlight.js's .hljs-*, and Shiki's css-variables theme. */
|
|
1880
|
+
export declare class RayCode extends RayElement {
|
|
1881
|
+
/** The code, from script (the most convenient in React and Vue). Wins over the content. */
|
|
1882
|
+
code: string | undefined;
|
|
1883
|
+
/** The language: js, ts, jsx, tsx, json, html, xml, svg, vue, css, sh, ray, diff… (also shown in the header). Not lang: that is the human language of the text. */
|
|
1884
|
+
language: string | undefined;
|
|
1885
|
+
/** A file name or title in the header; also the scroll region's accessible name. */
|
|
1886
|
+
filename: string | undefined;
|
|
1887
|
+
/** Numbers each line (not copied, not selectable). */
|
|
1888
|
+
lineNumbers: boolean | undefined;
|
|
1889
|
+
/** Lines to highlight: "3, 5-7". */
|
|
1890
|
+
highlight: string | undefined;
|
|
1891
|
+
/** Wraps long lines instead of scrolling sideways. */
|
|
1892
|
+
wrap: boolean | undefined;
|
|
1893
|
+
/** Height before it scrolls: px as a number, or a CSS length. A taller block gets a "Show all N lines" button. */
|
|
1894
|
+
maxHeight: string | undefined;
|
|
1895
|
+
/** Shown whole, past max-height. */
|
|
1896
|
+
expanded: boolean | undefined;
|
|
1897
|
+
/** No copy button. */
|
|
1898
|
+
hideCopy: boolean | undefined;
|
|
1899
|
+
/** No header bar (the copy button floats in the corner). */
|
|
1900
|
+
hideHeader: boolean | undefined;
|
|
1901
|
+
/** Font size. */
|
|
1902
|
+
size: "xs" | "sm" | "md";
|
|
1903
|
+
/** Corner radius: xs…xl, none, or a CSS length. Default: md. */
|
|
1904
|
+
radius: string | undefined;
|
|
1905
|
+
/** Accessible name of the copy button. */
|
|
1906
|
+
copyLabel: string;
|
|
1907
|
+
/** Shown and announced after copying. */
|
|
1908
|
+
copiedLabel: string;
|
|
1909
|
+
/** The code shown (dedented), whatever its source. */
|
|
1910
|
+
readonly source: string;
|
|
1911
|
+
/** Copies the code; resolves to true when it worked. */
|
|
1912
|
+
copy(): Promise<boolean>;
|
|
1913
|
+
addEventListener<K extends keyof RayCodeEventMap>(type: K, listener: (this: RayCode, ev: RayCodeEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
1914
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
1915
|
+
removeEventListener<K extends keyof RayCodeEventMap>(type: K, listener: (this: RayCode, ev: RayCodeEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
1916
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
1917
|
+
}
|
|
1918
|
+
export interface RayCodeEventMap extends HTMLElementEventMap {
|
|
1919
|
+
/** The code was copied. */
|
|
1920
|
+
"ray-copy": CustomEvent<{ code: string }>;
|
|
1921
|
+
}
|
|
1922
|
+
|
|
1923
|
+
// --- Icon (icon)
|
|
1924
|
+
/** <ray-icon> setIcons({ name: '<svg…>' }) replaces or adds icons (SVG markup or an SVGElement, drawn with currentColor); iconNames() lists them. Sizes follow the font unless size; --ray-icon-size and --ray-icon-stroke tune the whole system. */
|
|
1925
|
+
export declare class RayIcon extends RayElement {
|
|
1926
|
+
/** Registered icon name (iconNames()). */
|
|
1927
|
+
name: string | undefined;
|
|
1928
|
+
/** xs…xl or any CSS length. Default: 1em. */
|
|
1929
|
+
size: string | undefined;
|
|
1930
|
+
/** Accessible name; without it the icon is decorative (hidden from screen readers). */
|
|
1931
|
+
label: string | undefined;
|
|
1932
|
+
/** A palette color or any CSS color. Default: the text color. */
|
|
1933
|
+
color: string | undefined;
|
|
1934
|
+
/** Stroke width for stroke icons (default: --ray-icon-stroke, 2). */
|
|
1935
|
+
stroke: number | undefined;
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
// --- Indicator (indicator)
|
|
1939
|
+
/** <ray-indicator> Wraps its content as tight as it is (fit-content). The label is part of the element's text for assistive technology; a dot has none: describe it on the content (aria-label="Grace, online"). */
|
|
1940
|
+
export declare class RayIndicator extends RayElement {
|
|
1941
|
+
/** Text in the indicator (a word or a count). Empty: a dot. */
|
|
1942
|
+
label: string | undefined;
|
|
1943
|
+
/** Which point of the content's box it sits on. */
|
|
1944
|
+
position: "top-start" | "top-center" | "top-end" | "middle-start" | "middle-center" | "middle-end" | "bottom-start" | "bottom-center" | "bottom-end";
|
|
1945
|
+
/** Moves it inward from that point: px as a number, or a CSS length. Use it on round content (an avatar), so it sits on the curve. */
|
|
1946
|
+
offset: string | number | undefined;
|
|
1947
|
+
/** A palette color or any CSS color. Default: the primary. */
|
|
1948
|
+
color: string | undefined;
|
|
1949
|
+
/** Diameter of the dot (and minimum height of a label): px as a number, or a CSS length. Default: 10px. */
|
|
1950
|
+
size: string | number | undefined;
|
|
1951
|
+
/** Corner radius: xs…xl, none, or a CSS length. Default: round. */
|
|
1952
|
+
radius: string | undefined;
|
|
1953
|
+
/** A numeric label above it shows as max+ (99+). */
|
|
1954
|
+
max: number | undefined;
|
|
1955
|
+
/** inline-block, to sit within a line of text. */
|
|
1956
|
+
inline: boolean | undefined;
|
|
1957
|
+
/** A ring in the background color, to separate it from the content. */
|
|
1958
|
+
withBorder: boolean | undefined;
|
|
1959
|
+
/** A pulse around it (live, recording, syncing). */
|
|
1960
|
+
processing: boolean | undefined;
|
|
1961
|
+
/** Hides the indicator (the content stays). */
|
|
1962
|
+
disabled: boolean | undefined;
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
// --- Kbd (kbd)
|
|
1966
|
+
/** <ray-kbd> A keyboard key: a raised keycap, or a flat chip (filled or outline) for hints in menus and buttons. */
|
|
1967
|
+
export declare class RayKbd extends RayElement {
|
|
1968
|
+
/** Font size. */
|
|
1969
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
1970
|
+
/** default: raised keycap; filled: flat muted chip; outline: flat with a border. */
|
|
1971
|
+
variant: "default" | "filled" | "outline";
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
// --- Stat (stat)
|
|
1975
|
+
/** <ray-stat> A metric tile: label, value, change against a previous period, note. */
|
|
1976
|
+
export declare class RayStat extends RayElement {
|
|
1977
|
+
/** What is measured. */
|
|
1978
|
+
label: string | undefined;
|
|
1979
|
+
/** The figure, already formatted. */
|
|
1980
|
+
value: string | undefined;
|
|
1981
|
+
/** Change (positive is shown as good, in green; see inverse). */
|
|
1982
|
+
diff: number | undefined;
|
|
1983
|
+
/** Unit of diff. */
|
|
1984
|
+
diffUnit: string;
|
|
1985
|
+
/** A line under the value (compared to…). */
|
|
1986
|
+
note: string | undefined;
|
|
1987
|
+
/** Lower is better (errors, latency): negative diffs are green. */
|
|
1988
|
+
inverse: boolean | undefined;
|
|
1989
|
+
/** Without the card around. */
|
|
1990
|
+
plain: boolean | undefined;
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
// --- Table (table)
|
|
1994
|
+
/** A column of ray-table. */
|
|
1995
|
+
export type TableColumn = { key: string; label?: string; width?: number | string; align?: "left" | "center" | "right"; sortable?: boolean; render?: (row: any, index: number) => string | number | Node | null | undefined; sort?: (a: any, b: any) => number };
|
|
1996
|
+
/** The sort state of ray-table. */
|
|
1997
|
+
export type TableSort = { key: string; direction: "asc" | "desc" };
|
|
1998
|
+
/** <ray-table> Cells are text (render may return a DOM node; strings are never parsed as HTML). The scroll height comes from --ray-table-max-height. */
|
|
1999
|
+
export declare class RayTable extends RayElement {
|
|
2000
|
+
/** Columns: key, label, width, align, sortable, render(row, index), sort(a, b). */
|
|
2001
|
+
columns: TableColumn[] | undefined;
|
|
2002
|
+
/** Rows (objects). */
|
|
2003
|
+
data: any[] | undefined;
|
|
2004
|
+
/** Field that identifies a row (selection). */
|
|
2005
|
+
rowKey: string;
|
|
2006
|
+
/** A checkbox per row and a select-all checkbox. */
|
|
2007
|
+
selectable: boolean | undefined;
|
|
2008
|
+
/** Keys of the selected rows. */
|
|
2009
|
+
selection: unknown[] | undefined;
|
|
2010
|
+
/** Current sort; set it, or let header clicks change it. */
|
|
2011
|
+
sort: TableSort | null;
|
|
2012
|
+
/** Do not sort here: listen to ray-sort and pass sorted data. */
|
|
2013
|
+
manualSort: boolean | undefined;
|
|
2014
|
+
/** Rows are focusable and fire ray-row-click (Enter too; arrows move between rows). */
|
|
2015
|
+
clickableRows: boolean | undefined;
|
|
2016
|
+
/** Alternate row background. */
|
|
2017
|
+
striped: boolean | undefined;
|
|
2018
|
+
/** Border around the table. */
|
|
2019
|
+
withBorder: boolean | undefined;
|
|
2020
|
+
/** Borders between columns. */
|
|
2021
|
+
withColumnBorders: boolean | undefined;
|
|
2022
|
+
/** The header stays visible while scrolling (with --ray-table-max-height). */
|
|
2023
|
+
stickyHeader: boolean | undefined;
|
|
2024
|
+
/** No row highlight on hover. */
|
|
2025
|
+
noHover: boolean | undefined;
|
|
2026
|
+
/** Cell padding. */
|
|
2027
|
+
density: "xs" | "sm" | "md" | "lg";
|
|
2028
|
+
/** Caption (also the table's accessible name). */
|
|
2029
|
+
label: string | undefined;
|
|
2030
|
+
/** Text without rows (or put a ray-empty-state in slot=empty). */
|
|
2031
|
+
emptyLabel: string;
|
|
2032
|
+
/** The rows in display order. */
|
|
2033
|
+
readonly rows: any[];
|
|
2034
|
+
addEventListener<K extends keyof RayTableEventMap>(type: K, listener: (this: RayTable, ev: RayTableEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
2035
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
2036
|
+
removeEventListener<K extends keyof RayTableEventMap>(type: K, listener: (this: RayTable, ev: RayTableEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
2037
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
2038
|
+
}
|
|
2039
|
+
export interface RayTableEventMap extends HTMLElementEventMap {
|
|
2040
|
+
/** A header changed the sort. */
|
|
2041
|
+
"ray-sort": CustomEvent<{ key: string; direction: "asc" | "desc" | null }>;
|
|
2042
|
+
/** The selection changed. */
|
|
2043
|
+
"ray-selection-change": CustomEvent<{ selection: unknown[] }>;
|
|
2044
|
+
/** A row was clicked or activated with Enter (clickable-rows). */
|
|
2045
|
+
"ray-row-click": CustomEvent<{ row: any; index: number }>;
|
|
2046
|
+
}
|
|
2047
|
+
|
|
2048
|
+
// --- Timeline (timeline)
|
|
2049
|
+
/** <ray-timeline> A list (role="list") of ray-timeline-item. */
|
|
2050
|
+
export declare class RayTimeline extends RayElement {
|
|
2051
|
+
/** Index of the last reached item (-1: none). */
|
|
2052
|
+
active: number;
|
|
2053
|
+
/** Side of the line. */
|
|
2054
|
+
align: "left" | "right";
|
|
2055
|
+
/** Bullet size: px as a number or a CSS length (default 20px). */
|
|
2056
|
+
bulletSize: string | undefined;
|
|
2057
|
+
/** Line width in px (default 2). */
|
|
2058
|
+
lineWidth: number | undefined;
|
|
2059
|
+
/** A palette color or any CSS color for what is reached (default: primary). */
|
|
2060
|
+
color: string | undefined;
|
|
2061
|
+
/** Counts active from the end (the latest event at the top). */
|
|
2062
|
+
reverseActive: boolean | undefined;
|
|
2063
|
+
/** The items, in order. */
|
|
2064
|
+
readonly items: RayTimelineItem[];
|
|
2065
|
+
}
|
|
2066
|
+
/** <ray-timeline-item> Events in order along a line (Mantine's Timeline): activity, history, a deploy's stages. Items up to active are reached (filled bullet, colored line); a bullet is a dot, an icon or an avatar. */
|
|
2067
|
+
export declare class RayTimelineItem extends RayElement {
|
|
2068
|
+
/** The title of the event. */
|
|
2069
|
+
label: string | undefined;
|
|
2070
|
+
/** When ("2 h ago", a date). */
|
|
2071
|
+
time: string | undefined;
|
|
2072
|
+
/** An icon of the registry in the bullet. */
|
|
2073
|
+
icon: string | undefined;
|
|
2074
|
+
/** Its own color (a failed step in red). */
|
|
2075
|
+
color: string | undefined;
|
|
2076
|
+
/** The line to the next item (dashed: not happened yet). */
|
|
2077
|
+
lineVariant: "solid" | "dashed" | "dotted";
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
// --- Alert (alert)
|
|
2081
|
+
/** <ray-alert> Announced as an alert. The icon follows the color (info, circle-check, alert-triangle, circle-x) unless icon or slot=icon. */
|
|
2082
|
+
export declare class RayAlert extends RayElement {
|
|
2083
|
+
/** Title. */
|
|
2084
|
+
label: string | undefined;
|
|
2085
|
+
/** A palette color or any CSS color. */
|
|
2086
|
+
color: string | undefined;
|
|
2087
|
+
/** Visual style. */
|
|
2088
|
+
variant: "light" | "filled" | "outline" | "default" | "transparent";
|
|
2089
|
+
/** Corner radius. */
|
|
2090
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
2091
|
+
/** A registered icon name, or none. */
|
|
2092
|
+
icon: string | undefined;
|
|
2093
|
+
/** A close button; closing hides the alert (cancel ray-close to keep it). */
|
|
2094
|
+
closable: boolean | undefined;
|
|
2095
|
+
/** Accessible name of the close button. */
|
|
2096
|
+
closeLabel: string;
|
|
2097
|
+
addEventListener<K extends keyof RayAlertEventMap>(type: K, listener: (this: RayAlert, ev: RayAlertEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
2098
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
2099
|
+
removeEventListener<K extends keyof RayAlertEventMap>(type: K, listener: (this: RayAlert, ev: RayAlertEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
2100
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
2101
|
+
}
|
|
2102
|
+
export interface RayAlertEventMap extends HTMLElementEventMap {
|
|
2103
|
+
/** The close button was pressed; cancelable. */
|
|
2104
|
+
"ray-close": CustomEvent<unknown>;
|
|
2105
|
+
}
|
|
2106
|
+
|
|
2107
|
+
// --- Empty state (empty-state)
|
|
2108
|
+
/** <ray-empty-state> What a list, table or pane shows when it is empty: icon, title, text and the action that fills it. */
|
|
2109
|
+
export declare class RayEmptyState extends RayElement {
|
|
2110
|
+
/** Title. */
|
|
2111
|
+
label: string | undefined;
|
|
2112
|
+
/** Less padding. */
|
|
2113
|
+
compact: boolean | undefined;
|
|
2114
|
+
/** Dashed border. */
|
|
2115
|
+
withBorder: boolean | undefined;
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
// --- Notification (notification)
|
|
2119
|
+
/** Options of notify() and updateNotification(). */
|
|
2120
|
+
export type NotifyOptions = { id?: string; title?: string; message?: string; color?: string; icon?: string; loading?: boolean; autoClose?: number | false; closable?: boolean; withBorder?: boolean; action?: { label: string; onClick?: () => void }; onClose?: () => void };
|
|
2121
|
+
/** Shows a notification; returns its id. */
|
|
2122
|
+
export declare function notify(options?: NotifyOptions): string;
|
|
2123
|
+
/** Changes a shown notification and restarts its auto-close. */
|
|
2124
|
+
export declare function updateNotification(id: string, options?: NotifyOptions): boolean;
|
|
2125
|
+
/** Removes a notification. */
|
|
2126
|
+
export declare function hideNotification(id: string): boolean;
|
|
2127
|
+
/** Removes every notification. */
|
|
2128
|
+
export declare function clearNotifications(): void;
|
|
2129
|
+
/** The status icon a color gets: circle-check, circle-x, alert-triangle or info. */
|
|
2130
|
+
export declare function statusIcon(color: string): string;
|
|
2131
|
+
/** <ray-notification> notify({ id, title, message, color, icon, loading, autoClose (ms, default 4000; false = stays), closable, withBorder, onClose }) returns its id. A color adds a status icon in that color: green/teal a check, red/pink an error, yellow/orange a warning, others info. The status icon and the loader are 1.5rem with a 1.5 stroke; set --ray-notification-icon-size and --ray-notification-icon-stroke to change them. */
|
|
2132
|
+
export declare class RayNotification extends RayElement {
|
|
2133
|
+
/** Title. */
|
|
2134
|
+
label: string | undefined;
|
|
2135
|
+
/** Status color: tints the status icon (and a slotted icon's circle). */
|
|
2136
|
+
color: string | undefined;
|
|
2137
|
+
/** Status icon from the registry (default: from the color); "none" for no icon. */
|
|
2138
|
+
icon: string | undefined;
|
|
2139
|
+
/** Shows a spinner (notify() does not auto-close it). */
|
|
2140
|
+
loading: boolean | undefined;
|
|
2141
|
+
/** No close button. */
|
|
2142
|
+
hideClose: boolean | undefined;
|
|
2143
|
+
/** Draws a border. */
|
|
2144
|
+
withBorder: boolean | undefined;
|
|
2145
|
+
/** Text of an action button (e.g. "Undo"); pressing it fires ray-action. */
|
|
2146
|
+
actionLabel: string | undefined;
|
|
2147
|
+
addEventListener<K extends keyof RayNotificationEventMap>(type: K, listener: (this: RayNotification, ev: RayNotificationEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
2148
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
2149
|
+
removeEventListener<K extends keyof RayNotificationEventMap>(type: K, listener: (this: RayNotification, ev: RayNotificationEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
2150
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
2151
|
+
}
|
|
2152
|
+
export interface RayNotificationEventMap extends HTMLElementEventMap {
|
|
2153
|
+
/** The close button was pressed. */
|
|
2154
|
+
"ray-close": CustomEvent<unknown>;
|
|
2155
|
+
/** The action button was pressed (notify() runs action.onClick and closes it). */
|
|
2156
|
+
"ray-action": CustomEvent<unknown>;
|
|
2157
|
+
}
|
|
2158
|
+
/** <ray-toaster> Created by notify() when missing; add one yourself to choose its position. A stack (newest in front, older ones peeking behind) that spreads into a list on hover or keyboard focus; on touch screens a tap expands it, a tap outside collapses it, and a sideways swipe dismisses a toast. Auto-close pauses while expanded. Full width on phones. */
|
|
2159
|
+
export declare class RayToaster extends RayElement {
|
|
2160
|
+
/** Corner of the stack. */
|
|
2161
|
+
position: "bottom-right" | "bottom-left" | "bottom-center" | "top-right" | "top-left" | "top-center";
|
|
2162
|
+
/** Maximum kept; the oldest go first. */
|
|
2163
|
+
limit: number;
|
|
2164
|
+
/** Toasts shown in the collapsed stack (the rest wait, hidden). */
|
|
2165
|
+
visible: number;
|
|
2166
|
+
/** Always expanded: a list instead of a stack. */
|
|
2167
|
+
expand: boolean | undefined;
|
|
2168
|
+
/** Pixels between toasts when expanded. */
|
|
2169
|
+
gap: number;
|
|
2170
|
+
/** Whether the stack is spread out (set it to expand or collapse it). */
|
|
2171
|
+
expanded: boolean;
|
|
2172
|
+
/** Places the toasts again (done automatically on changes). */
|
|
2173
|
+
layout(): void;
|
|
2174
|
+
/** Brings the stack above everything else in the top layer. */
|
|
2175
|
+
raise(): void;
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
// --- Progress (progress)
|
|
2179
|
+
/** <ray-progress> A determinate or (without value) indeterminate progress bar, announced as a progressbar. */
|
|
2180
|
+
export declare class RayProgress extends RayElement {
|
|
2181
|
+
/** Progress, from 0 to max. Unset: indeterminate. */
|
|
2182
|
+
value: number | undefined;
|
|
2183
|
+
/** The value of a full bar. */
|
|
2184
|
+
max: number;
|
|
2185
|
+
/** A palette color or any CSS color. */
|
|
2186
|
+
color: string | undefined;
|
|
2187
|
+
/** Bar height. */
|
|
2188
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
2189
|
+
/** Corner radius. Default: full. */
|
|
2190
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | "full" | undefined;
|
|
2191
|
+
/** Diagonal stripes. */
|
|
2192
|
+
striped: boolean | undefined;
|
|
2193
|
+
/** Moving stripes (with striped). */
|
|
2194
|
+
animated: boolean | undefined;
|
|
2195
|
+
/** Shows the percentage: inside the bar on lg and xl, beside it on smaller sizes. */
|
|
2196
|
+
showValue: boolean | undefined;
|
|
2197
|
+
/** Accessible name (default: Progress). */
|
|
2198
|
+
label: string | undefined;
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
// --- Skeleton (skeleton)
|
|
2202
|
+
/** <ray-skeleton> aria-busy="true" on the host while loading; the placeholder is aria-hidden. */
|
|
2203
|
+
export declare class RaySkeleton extends RayElement {
|
|
2204
|
+
/** Width (CSS length, a number is px). Default: 100% (a circle: 2.5rem). */
|
|
2205
|
+
width: string | undefined;
|
|
2206
|
+
/** Height of a block or of each line (CSS length, a number is px). Default: 1rem. */
|
|
2207
|
+
height: string | undefined;
|
|
2208
|
+
/** A circle (avatar placeholder): its diameter is width, else height. */
|
|
2209
|
+
circle: boolean | undefined;
|
|
2210
|
+
/** Number of text lines (the last one is shorter). */
|
|
2211
|
+
lines: number | undefined;
|
|
2212
|
+
/** Corner radius: xs…xl, full or a CSS length. Default: sm. */
|
|
2213
|
+
radius: string | undefined;
|
|
2214
|
+
/** The loading effect (always none with reduced motion). */
|
|
2215
|
+
animation: "shimmer" | "pulse" | "none";
|
|
2216
|
+
/** Shows the slotted content instead of the placeholder. */
|
|
2217
|
+
loaded: boolean | undefined;
|
|
2218
|
+
}
|
|
2219
|
+
|
|
2220
|
+
// --- Spinner (spinner)
|
|
2221
|
+
/** <ray-spinner> An indeterminate loading indicator, announced as a status. */
|
|
2222
|
+
export declare class RaySpinner extends RayElement {
|
|
2223
|
+
/** A palette color or any CSS color. Default: the primary color. */
|
|
2224
|
+
color: string | undefined;
|
|
2225
|
+
/** Diameter. */
|
|
2226
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
2227
|
+
/** Text read by screen readers. */
|
|
2228
|
+
label: string;
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
// --- App bar (app-bar)
|
|
2232
|
+
/** <ray-app-bar> It follows the scroller of its ray-app-shell, else scroll-target, else the window; clear of the notch (safe-area inset). The title is plain text: put a heading in the default slot when the page needs one. */
|
|
2233
|
+
export declare class RayAppBar extends RayElement {
|
|
2234
|
+
/** The title. */
|
|
2235
|
+
label: string | undefined;
|
|
2236
|
+
/** A line under the title. */
|
|
2237
|
+
description: string | undefined;
|
|
2238
|
+
/** The title centered (iOS). */
|
|
2239
|
+
center: boolean | undefined;
|
|
2240
|
+
/** default: the page background; filled: the primary color; transparent: until it elevates. */
|
|
2241
|
+
variant: "default" | "filled" | "transparent";
|
|
2242
|
+
/** Height: 48, 56 or 64 px. */
|
|
2243
|
+
size: "sm" | "md" | "lg";
|
|
2244
|
+
/** While the content scrolls: elevate (border and shadow), hide (also slides away going down, back going up), none. */
|
|
2245
|
+
scrollBehavior: "elevate" | "hide" | "none";
|
|
2246
|
+
/** Sticks to the top of the window (outside a shell). */
|
|
2247
|
+
sticky: boolean | undefined;
|
|
2248
|
+
/** A selector of the element whose scrolling it follows (default: its shell's, else the window). */
|
|
2249
|
+
scrollTarget: string | undefined;
|
|
2250
|
+
/** Whether scroll-behavior="hide" has slid it away. */
|
|
2251
|
+
readonly concealed: boolean;
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
// --- App shell (app-shell)
|
|
2255
|
+
/** <ray-app-shell> The layout follows the shell's own width (a phone-sized frame shows the phone layout). Below breakpoint the navbar and the aside take no room (a ray-sidebar there still opens as its drawer) and the bottom slot shows. It fills the window's height (100dvh) unless sized. In a std/ui full_content window (ray-elements/core/raylang.js) the header becomes the title bar: room for the window buttons, and it drags the window; with layout="alt" or no header, the navbar and main start below it. */
|
|
2256
|
+
export declare class RayAppShell extends RayElement {
|
|
2257
|
+
/** default: the header across the top; alt: the navbar full height, the header beside it. */
|
|
2258
|
+
layout: "default" | "alt";
|
|
2259
|
+
/** Width (px, em or rem) below which it takes the phone layout. */
|
|
2260
|
+
breakpoint: string;
|
|
2261
|
+
/** Padding of the main area: xs…xl, a number (px) or a CSS length. */
|
|
2262
|
+
padding: string | undefined;
|
|
2263
|
+
/** The element that scrolls the main content. */
|
|
2264
|
+
readonly scroller: HTMLElement;
|
|
2265
|
+
/** Whether it is in the phone layout. */
|
|
2266
|
+
readonly mobile: boolean;
|
|
2267
|
+
addEventListener<K extends keyof RayAppShellEventMap>(type: K, listener: (this: RayAppShell, ev: RayAppShellEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
2268
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
2269
|
+
removeEventListener<K extends keyof RayAppShellEventMap>(type: K, listener: (this: RayAppShell, ev: RayAppShellEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
2270
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
2271
|
+
}
|
|
2272
|
+
export interface RayAppShellEventMap extends HTMLElementEventMap {
|
|
2273
|
+
/** It switched between the wide and the phone layout. */
|
|
2274
|
+
"ray-breakpoint": CustomEvent<{ mobile: boolean }>;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
// --- Aspect ratio (aspect-ratio)
|
|
2278
|
+
/** A ratio ("16/9", "4:3", 1.5) as a CSS aspect-ratio value, or null. */
|
|
2279
|
+
export declare function parseRatio(value: string | number): string | null;
|
|
2280
|
+
/** <ray-aspect-ratio> A box with a fixed width/height ratio; its image, video or iframe fills it. */
|
|
2281
|
+
export declare class RayAspectRatio extends RayElement {
|
|
2282
|
+
/** Width/height: "16/9", "4:3", "1" or a number. */
|
|
2283
|
+
ratio: string;
|
|
2284
|
+
/** How the media fills the box (object-fit). */
|
|
2285
|
+
fit: "cover" | "contain";
|
|
2286
|
+
/** Corner radius: xs…xl, full or a CSS length. */
|
|
2287
|
+
radius: string | undefined;
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
// --- Card (card)
|
|
2291
|
+
/** <ray-card> A surface for grouped content, with optional media, header and footer. */
|
|
2292
|
+
export declare class RayCard extends RayElement {
|
|
2293
|
+
/** Inner spacing (named space scale). */
|
|
2294
|
+
padding: "0" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
2295
|
+
/** Corner radius. Default: --ray-radius-default. */
|
|
2296
|
+
radius: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
2297
|
+
/** Elevation. */
|
|
2298
|
+
shadow: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
|
|
2299
|
+
/** Draws a border. */
|
|
2300
|
+
withBorder: boolean | undefined;
|
|
2301
|
+
/** default: card surface; filled: muted surface; outline: border without fill. */
|
|
2302
|
+
variant: "default" | "filled" | "outline";
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
// --- Center (center)
|
|
2306
|
+
/** <ray-center> It fills its parent's width; give it a height (or a flex or grid parent that stretches it) to center vertically. */
|
|
2307
|
+
export declare class RayCenter extends RayElement {
|
|
2308
|
+
/** As wide as its content (inline-flex): an icon beside text. */
|
|
2309
|
+
inline: boolean | undefined;
|
|
2310
|
+
}
|
|
2311
|
+
|
|
2312
|
+
// --- Container (container)
|
|
2313
|
+
/** The maximum widths of size. */
|
|
2314
|
+
export declare const CONTAINER_SIZES: { xs: string; sm: string; md: string; lg: string; xl: string };
|
|
2315
|
+
/** <ray-container> Its content centered, up to a maximum width, with side padding (Mantine's Container): the column of a page. */
|
|
2316
|
+
export declare class RayContainer extends RayElement {
|
|
2317
|
+
/** Maximum width: xs 540px, sm 720px, md 960px, lg 1140px, xl 1320px, or any CSS length. */
|
|
2318
|
+
size: string;
|
|
2319
|
+
/** Side padding: xs…xl, a number (px) or a CSS length. */
|
|
2320
|
+
padding: string;
|
|
2321
|
+
/** No maximum width: the whole width, still padded. */
|
|
2322
|
+
fluid: boolean | undefined;
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
// --- Grid (grid)
|
|
2326
|
+
/** "1 sm:2 lg:4" as counts per width. */
|
|
2327
|
+
export declare function parseCols(value: string | number | undefined): { base?: number; xs?: number; sm?: number; md?: number; lg?: number; xl?: number };
|
|
2328
|
+
/** The widths of cols (36em, 48em, 62em, 75em, 88em). */
|
|
2329
|
+
export declare const BREAKPOINTS: { xs: string; sm: string; md: string; lg: string; xl: string };
|
|
2330
|
+
/** <ray-grid> The widths are the grid's own (container queries: xs 36em, sm 48em, md 62em, lg 75em, xl 88em), so a grid in a narrow column or a phone frame drops to fewer columns. It needs a width from its parent: in a flex row give it one or let it grow. A child spans with data-span="2"…"12" or "full". */
|
|
2331
|
+
export declare class RayGrid extends RayElement {
|
|
2332
|
+
/** Columns: a count, then counts from a width up ("1 sm:2 lg:4"). */
|
|
2333
|
+
cols: string;
|
|
2334
|
+
/** Instead of cols: as many columns of at least this width as fit ("14rem", 220). */
|
|
2335
|
+
minColWidth: string | undefined;
|
|
2336
|
+
/** Space between cells: xs…xl, a number (px) or a CSS length. */
|
|
2337
|
+
gap: string;
|
|
2338
|
+
/** Space between rows when it differs from gap. */
|
|
2339
|
+
rowGap: string | undefined;
|
|
2340
|
+
/** Vertical alignment of the cells in a row. */
|
|
2341
|
+
align: "stretch" | "start" | "center" | "end";
|
|
2342
|
+
}
|
|
2343
|
+
|
|
2344
|
+
// --- Group (group)
|
|
2345
|
+
/** <ray-group> A flex row on the host: the children are laid out directly, no wrapper. */
|
|
2346
|
+
export declare class RayGroup extends RayElement {
|
|
2347
|
+
/** Space between children: xs…xl (the space scale), a number (px) or any CSS length. */
|
|
2348
|
+
gap: string;
|
|
2349
|
+
/** Cross-axis alignment. */
|
|
2350
|
+
align: "center" | "start" | "end" | "stretch" | "baseline";
|
|
2351
|
+
/** Main-axis distribution: space-between for a title on one side and actions on the other. */
|
|
2352
|
+
justify: "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly";
|
|
2353
|
+
/** Keeps the children on one line. */
|
|
2354
|
+
nowrap: boolean | undefined;
|
|
2355
|
+
/** The children share the width equally. */
|
|
2356
|
+
grow: boolean | undefined;
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
// --- Scroll area (scroll-area)
|
|
2360
|
+
/** <ray-scroll-area> Give it a size: height, max-height, CSS, or a flex/grid parent. The scrolling box is focusable (keyboard scrolling); name it with label when it holds a region of its own. */
|
|
2361
|
+
export declare class RayScrollArea extends RayElement {
|
|
2362
|
+
/** Height (CSS length). */
|
|
2363
|
+
height: string | undefined;
|
|
2364
|
+
/** Maximum height: it grows with its content up to this, then scrolls. */
|
|
2365
|
+
maxHeight: string | undefined;
|
|
2366
|
+
/** Which ways it scrolls. */
|
|
2367
|
+
orientation: "vertical" | "horizontal" | "both";
|
|
2368
|
+
/** The scrollbar: auto (when it scrolls), hover (while hovered or scrolling), never (still scrolls). */
|
|
2369
|
+
type: "auto" | "hover" | "never";
|
|
2370
|
+
/** No edge shadows. */
|
|
2371
|
+
noShadows: boolean | undefined;
|
|
2372
|
+
/** Distance from the end (px) at which ray-reach-end fires. */
|
|
2373
|
+
threshold: number;
|
|
2374
|
+
/** Accessible name: makes the scrolling box a named region. */
|
|
2375
|
+
label: string | undefined;
|
|
2376
|
+
/** The scrolling element (scrollTop, scrollTo…). */
|
|
2377
|
+
readonly viewport: HTMLElement;
|
|
2378
|
+
/** Scrolls to the top (left). */
|
|
2379
|
+
scrollToStart(options?: { behavior?: ScrollBehavior }): void;
|
|
2380
|
+
/** Scrolls to the bottom (right when horizontal). */
|
|
2381
|
+
scrollToEnd(options?: { behavior?: ScrollBehavior }): void;
|
|
2382
|
+
addEventListener<K extends keyof RayScrollAreaEventMap>(type: K, listener: (this: RayScrollArea, ev: RayScrollAreaEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
2383
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
2384
|
+
removeEventListener<K extends keyof RayScrollAreaEventMap>(type: K, listener: (this: RayScrollArea, ev: RayScrollAreaEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
2385
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
2386
|
+
}
|
|
2387
|
+
export interface RayScrollAreaEventMap extends HTMLElementEventMap {
|
|
2388
|
+
/** The end came within threshold (once per arrival). */
|
|
2389
|
+
"ray-reach-end": CustomEvent<{ edge: "bottom" | "right" }>;
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
// --- Separator (separator)
|
|
2393
|
+
/** <ray-separator> A horizontal or vertical rule, optionally labeled (Mantine's Divider). */
|
|
2394
|
+
export declare class RaySeparator extends RayElement {
|
|
2395
|
+
/** Direction of the rule. */
|
|
2396
|
+
orientation: "horizontal" | "vertical";
|
|
2397
|
+
/** Text in the middle of a horizontal rule. */
|
|
2398
|
+
label: string | undefined;
|
|
2399
|
+
/** Where the label sits. */
|
|
2400
|
+
labelPosition: "left" | "center" | "right";
|
|
2401
|
+
/** Thickness (1–5px). */
|
|
2402
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
2403
|
+
/** Line style. */
|
|
2404
|
+
variant: "solid" | "dashed" | "dotted";
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
// --- Split (split)
|
|
2408
|
+
/** <ray-split> Divider keys: arrows move it (Shift: faster), Home/End go to min/max, Enter or double click collapse the start pane. */
|
|
2409
|
+
export declare class RaySplit extends RayElement {
|
|
2410
|
+
/** horizontal: side by side; vertical: stacked. */
|
|
2411
|
+
orientation: "horizontal" | "vertical";
|
|
2412
|
+
/** Initial size of the start pane: px (280) or any CSS length (30%, 20rem). */
|
|
2413
|
+
position: string;
|
|
2414
|
+
/** Minimum size of the start pane in px. */
|
|
2415
|
+
min: number;
|
|
2416
|
+
/** Maximum size of the start pane in px. */
|
|
2417
|
+
max: number | undefined;
|
|
2418
|
+
/** The start pane is hidden. */
|
|
2419
|
+
collapsed: boolean | undefined;
|
|
2420
|
+
/** The divider cannot be moved. */
|
|
2421
|
+
disabled: boolean | undefined;
|
|
2422
|
+
/** A key: the size is saved in localStorage and restored. */
|
|
2423
|
+
autosave: string | undefined;
|
|
2424
|
+
/** The start pane's size in px. */
|
|
2425
|
+
readonly size: number;
|
|
2426
|
+
/** Collapses or restores the start pane. */
|
|
2427
|
+
toggle(): void;
|
|
2428
|
+
addEventListener<K extends keyof RaySplitEventMap>(type: K, listener: (this: RaySplit, ev: RaySplitEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
2429
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
2430
|
+
removeEventListener<K extends keyof RaySplitEventMap>(type: K, listener: (this: RaySplit, ev: RaySplitEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
2431
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
2432
|
+
}
|
|
2433
|
+
export interface RaySplitEventMap extends HTMLElementEventMap {
|
|
2434
|
+
/** After a drag, a key or a collapse. */
|
|
2435
|
+
"ray-resize": CustomEvent<{ size: number; collapsed: boolean }>;
|
|
2436
|
+
}
|
|
2437
|
+
|
|
2438
|
+
// --- Stack (stack)
|
|
2439
|
+
/** Gap, align and justify of a stack or group onto an element's custom properties (for a layout component of your own). */
|
|
2440
|
+
export declare function applyFlex(el: HTMLElement, options: { gap?: string; align?: string; justify?: string }, alignDefault: string): void;
|
|
2441
|
+
/** <ray-stack> A flex column on the host: the children are laid out directly, no wrapper. */
|
|
2442
|
+
export declare class RayStack extends RayElement {
|
|
2443
|
+
/** Space between children: xs…xl (the space scale), a number (px) or any CSS length. */
|
|
2444
|
+
gap: string;
|
|
2445
|
+
/** Cross-axis alignment: stretch fills the width. */
|
|
2446
|
+
align: "stretch" | "start" | "center" | "end" | "baseline";
|
|
2447
|
+
/** Main-axis distribution (with a height to distribute). */
|
|
2448
|
+
justify: "start" | "center" | "end" | "space-between" | "space-around" | "space-evenly";
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
// --- Status bar (statusbar)
|
|
2452
|
+
/** <ray-statusbar> The bar at the bottom of an app window: items on the left and on the right; items with action are buttons. */
|
|
2453
|
+
export declare class RayStatusbar extends RayElement {
|
|
2454
|
+
/** accent: the primary color (e.g. while debugging). */
|
|
2455
|
+
variant: "default" | "accent";
|
|
2456
|
+
}
|
|
2457
|
+
/** <ray-statusbar-item> The bar at the bottom of an app window: items on the left and on the right; items with action are buttons. */
|
|
2458
|
+
export declare class RayStatusbarItem extends RayElement {
|
|
2459
|
+
/** A button (listen to click). */
|
|
2460
|
+
action: boolean | undefined;
|
|
2461
|
+
/** Text color (red for errors…). */
|
|
2462
|
+
color: string | undefined;
|
|
2463
|
+
/** Accessible name and tooltip (for icon-only or terse items). */
|
|
2464
|
+
label: string | undefined;
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
// --- Theme toggle (theme-toggle)
|
|
2468
|
+
/** <ray-theme-toggle> Icon button that cycles the document theme: system, light, dark. */
|
|
2469
|
+
export declare class RayThemeToggle extends RayElement {
|
|
2470
|
+
/** Control height. */
|
|
2471
|
+
size: "xs" | "sm" | "md" | "lg" | "xl";
|
|
2472
|
+
addEventListener<K extends keyof RayThemeToggleEventMap>(type: K, listener: (this: RayThemeToggle, ev: RayThemeToggleEventMap[K]) => unknown, options?: boolean | AddEventListenerOptions): void;
|
|
2473
|
+
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
|
|
2474
|
+
removeEventListener<K extends keyof RayThemeToggleEventMap>(type: K, listener: (this: RayThemeToggle, ev: RayThemeToggleEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
|
|
2475
|
+
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
|
|
2476
|
+
}
|
|
2477
|
+
export interface RayThemeToggleEventMap extends HTMLElementEventMap {
|
|
2478
|
+
/** Fired on the document root by setTheme(); detail: { theme, resolved, primary }. */
|
|
2479
|
+
"ray-theme-change": CustomEvent<{ theme: "light" | "dark" | "system"; resolved: "light" | "dark"; primary: string | null }>;
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
declare global {
|
|
2483
|
+
interface HTMLElementTagNameMap {
|
|
2484
|
+
"ray-button": RayButton;
|
|
2485
|
+
"ray-button-group": RayButtonGroup;
|
|
2486
|
+
"ray-icon-button": RayIconButton;
|
|
2487
|
+
"ray-toggle": RayToggle;
|
|
2488
|
+
"ray-toggle-group": RayToggleGroup;
|
|
2489
|
+
"ray-checkbox": RayCheckbox;
|
|
2490
|
+
"ray-checkbox-group": RayCheckboxGroup;
|
|
2491
|
+
"ray-color-picker": RayColorPicker;
|
|
2492
|
+
"ray-color-input": RayColorInput;
|
|
2493
|
+
"ray-combobox": RayCombobox;
|
|
2494
|
+
"ray-date-picker": RayDatePicker;
|
|
2495
|
+
"ray-calendar": RayCalendar;
|
|
2496
|
+
"ray-file-upload": RayFileUpload;
|
|
2497
|
+
"ray-input": RayInput;
|
|
2498
|
+
"ray-number-input": RayNumberInput;
|
|
2499
|
+
"ray-password-input": RayPasswordInput;
|
|
2500
|
+
"ray-path-input": RayPathInput;
|
|
2501
|
+
"ray-radio-group": RayRadioGroup;
|
|
2502
|
+
"ray-radio": RayRadio;
|
|
2503
|
+
"ray-search": RaySearch;
|
|
2504
|
+
"ray-segmented-control": RaySegmentedControl;
|
|
2505
|
+
"ray-select": RaySelect;
|
|
2506
|
+
"ray-slider": RaySlider;
|
|
2507
|
+
"ray-switch": RaySwitch;
|
|
2508
|
+
"ray-textarea": RayTextarea;
|
|
2509
|
+
"ray-bottom-nav": RayBottomNav;
|
|
2510
|
+
"ray-bottom-nav-item": RayBottomNavItem;
|
|
2511
|
+
"ray-breadcrumbs": RayBreadcrumbs;
|
|
2512
|
+
"ray-breadcrumb": RayBreadcrumb;
|
|
2513
|
+
"ray-nav-link": RayNavLink;
|
|
2514
|
+
"ray-pagination": RayPagination;
|
|
2515
|
+
"ray-sidebar": RaySidebar;
|
|
2516
|
+
"ray-sidebar-group": RaySidebarGroup;
|
|
2517
|
+
"ray-stepper": RayStepper;
|
|
2518
|
+
"ray-step": RayStep;
|
|
2519
|
+
"ray-tabs": RayTabs;
|
|
2520
|
+
"ray-tab": RayTab;
|
|
2521
|
+
"ray-tab-panel": RayTabPanel;
|
|
2522
|
+
"ray-command-palette": RayCommandPalette;
|
|
2523
|
+
"ray-dialog": RayDialog;
|
|
2524
|
+
"ray-drawer": RayDrawer;
|
|
2525
|
+
"ray-menu": RayMenu;
|
|
2526
|
+
"ray-menu-item": RayMenuItem;
|
|
2527
|
+
"ray-menu-label": RayMenuLabel;
|
|
2528
|
+
"ray-menu-divider": RayMenuDivider;
|
|
2529
|
+
"ray-popover": RayPopover;
|
|
2530
|
+
"ray-tooltip": RayTooltip;
|
|
2531
|
+
"ray-accordion": RayAccordion;
|
|
2532
|
+
"ray-accordion-item": RayAccordionItem;
|
|
2533
|
+
"ray-attachment": RayAttachment;
|
|
2534
|
+
"ray-attachments": RayAttachments;
|
|
2535
|
+
"ray-avatar": RayAvatar;
|
|
2536
|
+
"ray-badge": RayBadge;
|
|
2537
|
+
"ray-blockquote": RayBlockquote;
|
|
2538
|
+
"ray-carousel": RayCarousel;
|
|
2539
|
+
"ray-code": RayCode;
|
|
2540
|
+
"ray-icon": RayIcon;
|
|
2541
|
+
"ray-indicator": RayIndicator;
|
|
2542
|
+
"ray-kbd": RayKbd;
|
|
2543
|
+
"ray-stat": RayStat;
|
|
2544
|
+
"ray-table": RayTable;
|
|
2545
|
+
"ray-timeline": RayTimeline;
|
|
2546
|
+
"ray-timeline-item": RayTimelineItem;
|
|
2547
|
+
"ray-alert": RayAlert;
|
|
2548
|
+
"ray-empty-state": RayEmptyState;
|
|
2549
|
+
"ray-notification": RayNotification;
|
|
2550
|
+
"ray-toaster": RayToaster;
|
|
2551
|
+
"ray-progress": RayProgress;
|
|
2552
|
+
"ray-skeleton": RaySkeleton;
|
|
2553
|
+
"ray-spinner": RaySpinner;
|
|
2554
|
+
"ray-app-bar": RayAppBar;
|
|
2555
|
+
"ray-app-shell": RayAppShell;
|
|
2556
|
+
"ray-aspect-ratio": RayAspectRatio;
|
|
2557
|
+
"ray-card": RayCard;
|
|
2558
|
+
"ray-center": RayCenter;
|
|
2559
|
+
"ray-container": RayContainer;
|
|
2560
|
+
"ray-grid": RayGrid;
|
|
2561
|
+
"ray-group": RayGroup;
|
|
2562
|
+
"ray-scroll-area": RayScrollArea;
|
|
2563
|
+
"ray-separator": RaySeparator;
|
|
2564
|
+
"ray-split": RaySplit;
|
|
2565
|
+
"ray-stack": RayStack;
|
|
2566
|
+
"ray-statusbar": RayStatusbar;
|
|
2567
|
+
"ray-statusbar-item": RayStatusbarItem;
|
|
2568
|
+
"ray-theme-toggle": RayThemeToggle;
|
|
2569
|
+
}
|
|
2570
|
+
}
|