@scm-js/plugin-api 1.6.0 → 1.7.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/index.d.ts +108 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -3457,6 +3457,13 @@ export interface DialogHandle {
|
|
|
3457
3457
|
isOpen(): boolean;
|
|
3458
3458
|
/** Change the title strip's text. */
|
|
3459
3459
|
setTitle(title: string): void;
|
|
3460
|
+
/**
|
|
3461
|
+
* Say the dialog is working: a ring and `label` at the left of the footer, and every
|
|
3462
|
+
* footer button disabled until `setBusy(false)`. A button's own `run` already does this
|
|
3463
|
+
* for as long as its promise is pending — this is for work the buttons did not start,
|
|
3464
|
+
* such as the first load, or a search that runs as the user types.
|
|
3465
|
+
*/
|
|
3466
|
+
setBusy(label: string | false): void;
|
|
3460
3467
|
}
|
|
3461
3468
|
/**
|
|
3462
3469
|
* A panel floats over the map and does not block it: the user keeps drawing, scrolling
|
|
@@ -3844,8 +3851,18 @@ export interface ButtonOptions extends WidgetOptions {
|
|
|
3844
3851
|
primary?: boolean;
|
|
3845
3852
|
danger?: boolean;
|
|
3846
3853
|
ghost?: boolean;
|
|
3854
|
+
/** Start off waiting: a ring in front of the label, and the button disabled. */
|
|
3855
|
+
busy?: boolean;
|
|
3847
3856
|
onClick?: (event: MouseEvent) => void;
|
|
3848
3857
|
}
|
|
3858
|
+
/** The `<button>`, with the one call that puts it in and out of its waiting state. */
|
|
3859
|
+
export type ButtonElement = HTMLButtonElement & {
|
|
3860
|
+
/**
|
|
3861
|
+
* A ring in front of the label while `busy`, and the button disabled — so the press
|
|
3862
|
+
* that started the work cannot be repeated, and says why it cannot.
|
|
3863
|
+
*/
|
|
3864
|
+
setBusy(busy: boolean): void;
|
|
3865
|
+
};
|
|
3849
3866
|
export interface CheckboxOptions extends WidgetOptions {
|
|
3850
3867
|
value?: boolean;
|
|
3851
3868
|
/** A radio button instead; give the group a `name`. */
|
|
@@ -3900,13 +3917,80 @@ export interface ListOptions<T> {
|
|
|
3900
3917
|
className?: string;
|
|
3901
3918
|
onPick?: (value: T, index: number) => void;
|
|
3902
3919
|
}
|
|
3920
|
+
export interface SpinnerOptions extends WidgetOptions {
|
|
3921
|
+
/** `"sm"` 10px, `"md"` 14px (the default), `"lg"` 20px. */
|
|
3922
|
+
size?: "sm" | "md" | "lg";
|
|
3923
|
+
/** Text beside the ring. Without it you get the bare ring, to put beside your own. */
|
|
3924
|
+
label?: string;
|
|
3925
|
+
}
|
|
3926
|
+
export interface ProgressBarOptions extends WidgetOptions {
|
|
3927
|
+
/** How far along to start: 0…1, or null (the default) for the sliding bar that means "no idea how long". */
|
|
3928
|
+
value?: number | null;
|
|
3929
|
+
/** A line under the bar — what is being waited for, or how much of it is done. */
|
|
3930
|
+
label?: string;
|
|
3931
|
+
/** The percentage at the end of the bar; on for a bar that knows how far along it is. */
|
|
3932
|
+
percent?: boolean;
|
|
3933
|
+
/** Width in CSS pixels; it fills the width it is given by default. */
|
|
3934
|
+
width?: number;
|
|
3935
|
+
}
|
|
3936
|
+
export type ProgressBarElement = HTMLElement & {
|
|
3937
|
+
/**
|
|
3938
|
+
* How far along: 0…1, or null for the sliding bar. `label` replaces the line under it.
|
|
3939
|
+
* Cheap to call often — it repaints only when the bar actually moves.
|
|
3940
|
+
*/
|
|
3941
|
+
set(value: number | null, label?: string): void;
|
|
3942
|
+
};
|
|
3943
|
+
export interface StatusLineOptions extends WidgetOptions {
|
|
3944
|
+
/** What it says before anything has happened. */
|
|
3945
|
+
text?: string;
|
|
3946
|
+
}
|
|
3947
|
+
/**
|
|
3948
|
+
* The line along the bottom of a dialog: what happened, what is happening, how far
|
|
3949
|
+
* along it is, and the Cancel that stops it — in one place, so a dialog has one voice.
|
|
3950
|
+
* It is a live region, so a screen reader hears the outcome (but not every byte of a
|
|
3951
|
+
* download: the bar's own movement is not announced).
|
|
3952
|
+
*/
|
|
3953
|
+
export type StatusLineElement = HTMLElement & {
|
|
3954
|
+
/** A finished line. `kind` colours it; nothing means plain. */
|
|
3955
|
+
set(text: string, kind?: "ok" | "warn" | "error"): void;
|
|
3956
|
+
/** Waiting, with no idea how long: a ring and the text. */
|
|
3957
|
+
busy(text: string): void;
|
|
3958
|
+
/** Waiting with a share done (0…1), or null for the sliding bar. */
|
|
3959
|
+
progress(text: string, value: number | null): void;
|
|
3960
|
+
/** A Cancel beside the line that calls `stop`; null takes it away. */
|
|
3961
|
+
cancel(stop: (() => void) | null): void;
|
|
3962
|
+
/** Back to an empty line. */
|
|
3963
|
+
clear(): void;
|
|
3964
|
+
};
|
|
3965
|
+
export interface SkeletonOptions extends WidgetOptions {
|
|
3966
|
+
/** CSS width, `"100%"` by default. */
|
|
3967
|
+
width?: string;
|
|
3968
|
+
/** Height in CSS pixels: 10 for a line, 44 for a block. */
|
|
3969
|
+
height?: number;
|
|
3970
|
+
/** How many lines, stacked; 1 by default. The last is drawn short, as text ends short. */
|
|
3971
|
+
lines?: number;
|
|
3972
|
+
/** A block — the place a thumbnail or a picture will take — rather than a line of text. */
|
|
3973
|
+
block?: boolean;
|
|
3974
|
+
}
|
|
3975
|
+
export interface BusyOptions {
|
|
3976
|
+
/** What is being waited for, over the covered box. */
|
|
3977
|
+
label?: string;
|
|
3978
|
+
/** Dim what is already there rather than leaving it at full strength; true by default. */
|
|
3979
|
+
dim?: boolean;
|
|
3980
|
+
}
|
|
3981
|
+
export interface BusyHandle {
|
|
3982
|
+
/** Change the label without lifting the cover. */
|
|
3983
|
+
set(label: string): void;
|
|
3984
|
+
/** Uncover the box. Safe to call twice. */
|
|
3985
|
+
done(): void;
|
|
3986
|
+
}
|
|
3903
3987
|
/**
|
|
3904
3988
|
* Buttons, fields, forms and lists in the editor's own styles, as plain DOM. A plugin
|
|
3905
3989
|
* dialog built from these looks like a built-in one; `el` is the escape hatch for
|
|
3906
3990
|
* anything they do not cover.
|
|
3907
3991
|
*/
|
|
3908
3992
|
export interface WidgetsApi {
|
|
3909
|
-
button(label: string, options?: ButtonOptions):
|
|
3993
|
+
button(label: string, options?: ButtonOptions): ButtonElement;
|
|
3910
3994
|
checkbox(label: string, options?: CheckboxOptions): CheckboxElement;
|
|
3911
3995
|
text(options?: TextFieldOptions): HTMLInputElement;
|
|
3912
3996
|
number(options?: NumberFieldOptions): HTMLInputElement;
|
|
@@ -3921,6 +4005,29 @@ export interface WidgetsApi {
|
|
|
3921
4005
|
hint(text: string): HTMLElement;
|
|
3922
4006
|
separator(): HTMLElement;
|
|
3923
4007
|
list<T>(items: ListItem<T>[], options?: ListOptions<T>): HTMLElement;
|
|
4008
|
+
/** A turning ring: on its own to put beside your own text, or with a `label` beside it. */
|
|
4009
|
+
spinner(options?: SpinnerOptions): HTMLElement;
|
|
4010
|
+
/**
|
|
4011
|
+
* A bar, with the percentage and a line under it. `set(0…1)` moves it; `set(null)`
|
|
4012
|
+
* gives the sliding bar for work whose length is not known. Use it where the wait has
|
|
4013
|
+
* a size — a download, a pass over every trigger — and a spinner where it does not.
|
|
4014
|
+
*/
|
|
4015
|
+
progressBar(options?: ProgressBarOptions): ProgressBarElement;
|
|
4016
|
+
/** The dialog's bottom line: `set`, `busy`, `progress` and a `cancel` button. */
|
|
4017
|
+
statusLine(options?: StatusLineOptions): StatusLineElement;
|
|
4018
|
+
/**
|
|
4019
|
+
* A grey stand-in for content that has not arrived, in the shape it will take. Rows of
|
|
4020
|
+
* these in the list you are about to fill say more than an empty box does, and the list
|
|
4021
|
+
* does not jump when the answer lands.
|
|
4022
|
+
*/
|
|
4023
|
+
skeleton(options?: SkeletonOptions): HTMLElement;
|
|
4024
|
+
/**
|
|
4025
|
+
* Cover a box while what is in it is being replaced: dimmed, deaf to clicks, with a
|
|
4026
|
+
* ring and a label over it. `done()` uncovers it. Give it the box, not the page — the
|
|
4027
|
+
* search field that starts the work should stay live so the user can change their mind.
|
|
4028
|
+
* Calling it again on a covered box only changes the label.
|
|
4029
|
+
*/
|
|
4030
|
+
busy(target: HTMLElement, options?: BusyOptions | string): BusyHandle;
|
|
3924
4031
|
}
|
|
3925
4032
|
export type TopMenu = "File" | "Edit" | "View" | "Layer" | "Scenario" | "Triggers" | "Tools" | "Plugins" | "Help";
|
|
3926
4033
|
/**
|