@scm-js/plugin-api 1.15.0 → 1.16.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 +46 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2855,6 +2855,17 @@ export interface ViewApi {
|
|
|
2855
2855
|
visible(): Rect;
|
|
2856
2856
|
/** Scroll so a tile is in the middle of the viewport. */
|
|
2857
2857
|
center(x: number, y: number): void;
|
|
2858
|
+
/**
|
|
2859
|
+
* Bring a tile rect onto the screen, gliding there by the shortest way rather than
|
|
2860
|
+
* jumping, and leaving the view alone when the rect is already visible. With `fit` the
|
|
2861
|
+
* view zooms out (never in) as far as the rect needs. Resolves once the view is there;
|
|
2862
|
+
* `false` when the user, or another request, moved it first — a plugin that follows its
|
|
2863
|
+
* own work around the map takes that as its cue to stop.
|
|
2864
|
+
*
|
|
2865
|
+
* @example
|
|
2866
|
+
* if (!(await api.view.reveal(rect))) following = false;
|
|
2867
|
+
*/
|
|
2868
|
+
reveal(rect: Rect, options?: RevealOptions): Promise<boolean>;
|
|
2858
2869
|
/** Scroll to an object (and select it, for a unit, sprite or location). */
|
|
2859
2870
|
goTo(target: GoTo): void;
|
|
2860
2871
|
/** The tile under the pointer, as the status bar shows it. */
|
|
@@ -2879,6 +2890,15 @@ export interface ViewApi {
|
|
|
2879
2890
|
*/
|
|
2880
2891
|
flash(target: FlashTarget): void;
|
|
2881
2892
|
}
|
|
2893
|
+
/** How `view.reveal` brings a rect on screen. */
|
|
2894
|
+
export interface RevealOptions {
|
|
2895
|
+
/** Zoom out to the zoom control's nearest step that fits the rect (plus the margin); never zooms in. Off by default. */
|
|
2896
|
+
fit?: boolean;
|
|
2897
|
+
/** Glide rather than jump. On by default. */
|
|
2898
|
+
animate?: boolean;
|
|
2899
|
+
/** Tiles kept clear between the rect and the viewport's edge when the view has to move. 1 by default. */
|
|
2900
|
+
margin?: number;
|
|
2901
|
+
}
|
|
2882
2902
|
export interface CommandSpec {
|
|
2883
2903
|
/**
|
|
2884
2904
|
* The command's id. One without a dot is namespaced under the plugin
|
|
@@ -3659,6 +3679,15 @@ export interface PanelSpec {
|
|
|
3659
3679
|
title: string;
|
|
3660
3680
|
/** In CSS pixels; 260 by default. The panel is as tall as its content, up to the map's height. Ignored when docked. */
|
|
3661
3681
|
width?: number;
|
|
3682
|
+
/** Floating only: a height in CSS pixels instead of the content's own; the body then scrolls, or fills, as its content asks. */
|
|
3683
|
+
height?: number;
|
|
3684
|
+
/**
|
|
3685
|
+
* Floating only: a grip at the bottom-right corner lets the user resize the panel, and
|
|
3686
|
+
* the size is remembered with the position for the session. The body is a column flex
|
|
3687
|
+
* box, so a root element with `flex: 1; min-height: 0` fills whatever size it has —
|
|
3688
|
+
* what a code editor or a long list beside the map wants.
|
|
3689
|
+
*/
|
|
3690
|
+
resizable?: boolean;
|
|
3662
3691
|
/**
|
|
3663
3692
|
* Where the panel lives. `"float"` (the default) is a frame over the map the user drags
|
|
3664
3693
|
* about. `"right"` puts it in the right dock as a panel of its own, under Minimap, Layers
|
|
@@ -3875,6 +3904,17 @@ export interface PickOptions {
|
|
|
3875
3904
|
/** Shown in the viewport's HUD while the user picks; also the status line. */
|
|
3876
3905
|
prompt?: string;
|
|
3877
3906
|
}
|
|
3907
|
+
/** What `ui.pickObject` can pick. */
|
|
3908
|
+
export type PickObjectKind = "unit" | "location";
|
|
3909
|
+
export interface PickObjectOptions extends PickOptions {
|
|
3910
|
+
/** Which kinds count; every kind when omitted. Under the pointer, a unit wins over a location. */
|
|
3911
|
+
kinds?: PickObjectKind[];
|
|
3912
|
+
}
|
|
3913
|
+
/** What the user picked: the record's index in `document.scenario().units` or `.locations`. */
|
|
3914
|
+
export interface PickedObject {
|
|
3915
|
+
kind: PickObjectKind;
|
|
3916
|
+
index: number;
|
|
3917
|
+
}
|
|
3878
3918
|
export interface PickFilesOptions {
|
|
3879
3919
|
/** `accept` for the file input, e.g. `"image/*"` or `".png,.jpg"`. */
|
|
3880
3920
|
accept?: string;
|
|
@@ -3957,6 +3997,12 @@ export interface UiApi {
|
|
|
3957
3997
|
x: number;
|
|
3958
3998
|
y: number;
|
|
3959
3999
|
} | null>;
|
|
4000
|
+
/**
|
|
4001
|
+
* As `pickTile`, for an object: the user clicks a unit or a location. The viewport
|
|
4002
|
+
* outlines and names what is under the pointer as it moves; a click on nothing keeps
|
|
4003
|
+
* picking. Resolves with the kind and the record's index, or null as `pickArea` does.
|
|
4004
|
+
*/
|
|
4005
|
+
pickObject(options?: PickObjectOptions): Promise<PickedObject | null>;
|
|
3960
4006
|
/**
|
|
3961
4007
|
* Decode a picture: a `File` / `Blob`, a `data:` URL, or an `http(s)` URL (fetched, and
|
|
3962
4008
|
* when the site refuses cross-origin reads, loaded through an `<img>` with
|