@scm-js/plugin-api 1.50.0 → 1.52.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 +64 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -41,7 +41,12 @@ export type CombineMode =
|
|
|
41
41
|
/** Only the last occurrence is used — of those at least the section's minimum length. */
|
|
42
42
|
| "last"
|
|
43
43
|
/** Only the first occurrence is used — of those at least the section's minimum length. */
|
|
44
|
-
| "first"
|
|
44
|
+
| "first"
|
|
45
|
+
/**
|
|
46
|
+
* A settings table: each occurrence changes only the entries it marks as not using the
|
|
47
|
+
* game's own values (`EntryLayout`), the rest keep what an earlier one gave them.
|
|
48
|
+
*/
|
|
49
|
+
| "entries";
|
|
45
50
|
/**
|
|
46
51
|
* The byte encodings a map's text can be in, and how to tell which one a file used.
|
|
47
52
|
*
|
|
@@ -5048,6 +5053,12 @@ export interface PanelSpec {
|
|
|
5048
5053
|
grow?: boolean;
|
|
5049
5054
|
/** Floating only: the body runs edge to edge, without the panel's padding — for content that draws its own frame. */
|
|
5050
5055
|
flush?: boolean;
|
|
5056
|
+
/**
|
|
5057
|
+
* Floating only: a button in the title strip (and a double-click on it) makes the panel
|
|
5058
|
+
* fill the map's area, and puts it back. For a window of charts or tables read at length
|
|
5059
|
+
* beside a map that is still there underneath. `PanelHandle.maximize` does the same.
|
|
5060
|
+
*/
|
|
5061
|
+
maximizable?: boolean;
|
|
5051
5062
|
/** Fill `body` (an empty `<div>` inside the panel); return a cleanup if you need one. */
|
|
5052
5063
|
mount(body: HTMLElement, panel: PanelHandle): void | (() => void);
|
|
5053
5064
|
/** The panel closed, whichever way. */
|
|
@@ -5174,6 +5185,10 @@ export interface PanelHandle {
|
|
|
5174
5185
|
close(): void;
|
|
5175
5186
|
isOpen(): boolean;
|
|
5176
5187
|
setTitle(title: string): void;
|
|
5188
|
+
/** A `maximizable` panel: fill the map's area (`true`), go back (`false`), or toggle. Nothing for another panel. */
|
|
5189
|
+
maximize(on?: boolean): void;
|
|
5190
|
+
/** Whether it fills the map's area now. */
|
|
5191
|
+
isMaximized(): boolean;
|
|
5177
5192
|
}
|
|
5178
5193
|
/**
|
|
5179
5194
|
* One cell in the status bar (`ui.statusItem`): a line of text with the plugin's icon,
|
|
@@ -5822,6 +5837,35 @@ export interface SelectOption {
|
|
|
5822
5837
|
label: string;
|
|
5823
5838
|
disabled?: boolean;
|
|
5824
5839
|
}
|
|
5840
|
+
/** `widgets.segmented`: the value picked, and a way to pick another. */
|
|
5841
|
+
export type SegmentedElement = HTMLElement & {
|
|
5842
|
+
get(): string;
|
|
5843
|
+
/** Pick `value` without calling `onChange`. */
|
|
5844
|
+
set(value: string | number): void;
|
|
5845
|
+
};
|
|
5846
|
+
export interface TabItem {
|
|
5847
|
+
value: string;
|
|
5848
|
+
label: string;
|
|
5849
|
+
disabled?: boolean;
|
|
5850
|
+
/** Fill the tab's panel, the first time it is shown. What it starts ends with the panel or dialog the tabs are in. */
|
|
5851
|
+
mount(body: HTMLElement): void;
|
|
5852
|
+
}
|
|
5853
|
+
export interface TabsOptions {
|
|
5854
|
+
/** The tab shown first; the first that is not disabled otherwise. */
|
|
5855
|
+
value?: string;
|
|
5856
|
+
onChange?: (value: string) => void;
|
|
5857
|
+
/** Smaller tabs, for a narrow panel. */
|
|
5858
|
+
compact?: boolean;
|
|
5859
|
+
className?: string;
|
|
5860
|
+
}
|
|
5861
|
+
/** `widgets.tabs`: the tab shown, and a way to show another. */
|
|
5862
|
+
export type TabsElement = HTMLElement & {
|
|
5863
|
+
get(): string;
|
|
5864
|
+
/** Show the tab `value` (mounting it the first time) without calling `onChange`. */
|
|
5865
|
+
set(value: string): void;
|
|
5866
|
+
/** The panel of a tab that has been shown, or null. */
|
|
5867
|
+
panel(value: string): HTMLElement | null;
|
|
5868
|
+
};
|
|
5825
5869
|
export interface SelectOptions extends WidgetOptions {
|
|
5826
5870
|
value?: string | number;
|
|
5827
5871
|
onChange?: (value: string) => void;
|
|
@@ -6006,6 +6050,25 @@ export interface WidgetsApi {
|
|
|
6006
6050
|
text(options?: TextFieldOptions): HTMLInputElement;
|
|
6007
6051
|
number(options?: NumberFieldOptions): HTMLInputElement;
|
|
6008
6052
|
select(items: SelectOption[], options?: SelectOptions): HTMLSelectElement;
|
|
6053
|
+
/**
|
|
6054
|
+
* Buttons side by side of which one is on: a choice of a few short options seen at once
|
|
6055
|
+
* ("Both", "Minerals", "Gas"), where a `select` would hide them. `onChange` hears the
|
|
6056
|
+
* value picked; `set` moves the choice without it.
|
|
6057
|
+
*/
|
|
6058
|
+
segmented(items: SelectOption[], options?: SelectOptions): SegmentedElement;
|
|
6059
|
+
/**
|
|
6060
|
+
* Tabs in the editor's style: a row of tabs over a panel a tab. A tab's `mount` runs the
|
|
6061
|
+
* first time it is shown and its panel is kept after, so what the user did there stays
|
|
6062
|
+
* when they come back. Arrow keys move between the tabs.
|
|
6063
|
+
*
|
|
6064
|
+
* @example
|
|
6065
|
+
* const tabs = api.ui.widgets.tabs([
|
|
6066
|
+
* { value: "economy", label: "Economy", mount: (body) => body.append(economyView()) },
|
|
6067
|
+
* { value: "army", label: "Army", mount: (body) => body.append(armyView()) },
|
|
6068
|
+
* ], { value: saved.tab, onChange: (tab) => { saved.tab = tab; } });
|
|
6069
|
+
* body.append(tabs);
|
|
6070
|
+
*/
|
|
6071
|
+
tabs(items: TabItem[], options?: TabsOptions): TabsElement;
|
|
6009
6072
|
/** A two-column grid of labelled fields. */
|
|
6010
6073
|
form(rows: (FormRow | null | undefined | false)[]): HTMLElement;
|
|
6011
6074
|
/** A titled box (a `fieldset` with a legend, as the dialogs use). */
|