@scm-js/plugin-api 1.46.0 → 1.47.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 +37 -7
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -38,9 +38,9 @@ export type CombineMode =
|
|
|
38
38
|
"overlay"
|
|
39
39
|
/** Every occurrence's records are kept, in file order. */
|
|
40
40
|
| "append"
|
|
41
|
-
/** Only the last occurrence is used. */
|
|
41
|
+
/** Only the last occurrence is used — of those at least the section's minimum length. */
|
|
42
42
|
| "last"
|
|
43
|
-
/** Only the first occurrence is used. */
|
|
43
|
+
/** Only the first occurrence is used — of those at least the section's minimum length. */
|
|
44
44
|
| "first";
|
|
45
45
|
/**
|
|
46
46
|
* The byte encodings a map's text can be in, and how to tell which one a file used.
|
|
@@ -1466,6 +1466,8 @@ export interface SectionKnowledge {
|
|
|
1466
1466
|
size: number | null;
|
|
1467
1467
|
/** The record length of a list section, or null. */
|
|
1468
1468
|
stride: number | null;
|
|
1469
|
+
/** The shortest copy the game takes, for a "last" or "first" section; shorter ones are passed over. Null when any length is taken. */
|
|
1470
|
+
minimum: number | null;
|
|
1469
1471
|
/** Whether the editor decodes the section into its model and re-encodes it on save. */
|
|
1470
1472
|
modelled: boolean;
|
|
1471
1473
|
}
|
|
@@ -4982,7 +4984,11 @@ export interface PanelSpec {
|
|
|
4982
4984
|
title: string;
|
|
4983
4985
|
/** In CSS pixels; 260 by default. The panel is as tall as its content, up to the map's height. Ignored when docked. */
|
|
4984
4986
|
width?: number;
|
|
4985
|
-
/**
|
|
4987
|
+
/**
|
|
4988
|
+
* Floating: a height in CSS pixels instead of the content's own; the body then scrolls, or
|
|
4989
|
+
* fills, as its content asks. Bottom dock: the strip's starting height (160 by default),
|
|
4990
|
+
* which the user can then drag.
|
|
4991
|
+
*/
|
|
4986
4992
|
height?: number;
|
|
4987
4993
|
/**
|
|
4988
4994
|
* Floating only: a grip at the bottom-right corner lets the user resize the panel, and
|
|
@@ -4997,9 +5003,11 @@ export interface PanelSpec {
|
|
|
4997
5003
|
* and Properties, with the same head and hide button the built-in panels have — the
|
|
4998
5004
|
* choice for anything the user keeps open while working, such as an assistant or a
|
|
4999
5005
|
* readout. A docked panel shows the dock even when the user has hidden every built-in
|
|
5000
|
-
* panel in it.
|
|
5006
|
+
* panel in it. `"bottom"` puts it in a strip under the map, as wide as the map, which
|
|
5007
|
+
* the user makes taller or shorter by dragging its top edge — the place for a timeline,
|
|
5008
|
+
* a console or anything read along the width of the map. Several bottom panels stack.
|
|
5001
5009
|
*/
|
|
5002
|
-
dock?: "float" | "right";
|
|
5010
|
+
dock?: "float" | "right" | "bottom";
|
|
5003
5011
|
/** A docked panel that takes the dock's spare height (a transcript, a long list); off by default. */
|
|
5004
5012
|
grow?: boolean;
|
|
5005
5013
|
/** Floating only: the body runs edge to edge, without the panel's padding — for content that draws its own frame. */
|
|
@@ -5009,6 +5017,18 @@ export interface PanelSpec {
|
|
|
5009
5017
|
/** The panel closed, whichever way. */
|
|
5010
5018
|
onClose?: () => void;
|
|
5011
5019
|
}
|
|
5020
|
+
/**
|
|
5021
|
+
* A kind of file a plugin opens (`ui.fileType`): replays, a mod's own data. A file whose
|
|
5022
|
+
* name ends in one of `extensions`, dropped on the editor or picked in File ▸ Open, goes
|
|
5023
|
+
* to `open` instead of being read as a map. Several dropped at once arrive together.
|
|
5024
|
+
*/
|
|
5025
|
+
export interface FileTypeSpec {
|
|
5026
|
+
/** What the files are, for File ▸ Open's list of types ("StarCraft replay"). */
|
|
5027
|
+
name: string;
|
|
5028
|
+
/** With the dot, any case: `[".rep"]`. */
|
|
5029
|
+
extensions: string[];
|
|
5030
|
+
open(files: File[]): void | Promise<void>;
|
|
5031
|
+
}
|
|
5012
5032
|
export interface PanelHandle {
|
|
5013
5033
|
close(): void;
|
|
5014
5034
|
isOpen(): boolean;
|
|
@@ -5375,10 +5395,20 @@ export interface UiApi {
|
|
|
5375
5395
|
} | null>;
|
|
5376
5396
|
dialog(spec: DialogSpec): DialogHandle;
|
|
5377
5397
|
/**
|
|
5378
|
-
* Open a panel: floating over the map,
|
|
5379
|
-
* (`spec.dock`). As many as you like; each closes with the plugin.
|
|
5398
|
+
* Open a panel: floating over the map, docked at the right with the built-in panels, or
|
|
5399
|
+
* in the strip under the map (`spec.dock`). As many as you like; each closes with the plugin.
|
|
5380
5400
|
*/
|
|
5381
5401
|
panel(spec: PanelSpec): PanelHandle;
|
|
5402
|
+
/**
|
|
5403
|
+
* Claim a kind of file: dropped on the editor or picked in File ▸ Open, a file with one of
|
|
5404
|
+
* `spec.extensions` is handed to `spec.open` instead of being opened as a map. A plugin
|
|
5405
|
+
* that claims what another already has is not given it (the first stays); none can claim
|
|
5406
|
+
* the editor's own `.scm`, `.scx` or `.chk`. Ends with the plugin, or with `dispose`.
|
|
5407
|
+
*
|
|
5408
|
+
* @example
|
|
5409
|
+
* api.ui.fileType({ name: "StarCraft replay", extensions: [".rep"], open: (files) => loadReplays(files) });
|
|
5410
|
+
*/
|
|
5411
|
+
fileType(spec: FileTypeSpec): Disposable;
|
|
5382
5412
|
/**
|
|
5383
5413
|
* A cell of your own in the status bar. One line of text beside the plugin's icon, a
|
|
5384
5414
|
* spinner while `busy`, a click. Keep the handle and `set` it as things move; it
|