@scm-js/plugin-api 1.17.0 → 1.18.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 +41 -6
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -2748,6 +2748,22 @@ export interface TriggersApi {
|
|
|
2748
2748
|
* deactivation; call `refresh()` after a rebuild so the editors ask `locate` again.
|
|
2749
2749
|
*/
|
|
2750
2750
|
claim(spec: TriggerClaimSpec): TriggerClaimHandle;
|
|
2751
|
+
/**
|
|
2752
|
+
* Every plugin's claims as located in `list` (TRIG as it stands, when omitted), first
|
|
2753
|
+
* run first — what an editor of the trigger list needs to fence or lock the generated
|
|
2754
|
+
* runs. A claim whose `locate` finds nothing, or throws, is left out.
|
|
2755
|
+
*/
|
|
2756
|
+
claims(list?: TriggerRecord[]): TriggerClaimRange[];
|
|
2757
|
+
}
|
|
2758
|
+
/** One claimed run as `triggers.claims` located it. */
|
|
2759
|
+
export interface TriggerClaimRange {
|
|
2760
|
+
pluginId: string;
|
|
2761
|
+
/** `TriggerClaimSpec.label`: what generated the run, as a sentence would use it. */
|
|
2762
|
+
label: string;
|
|
2763
|
+
/** The badge word the trigger list shows; the plugin's id by default. */
|
|
2764
|
+
badge: string;
|
|
2765
|
+
start: number;
|
|
2766
|
+
count: number;
|
|
2751
2767
|
}
|
|
2752
2768
|
/**
|
|
2753
2769
|
* A run of triggers a plugin generates and owns. It is found by *content*: the
|
|
@@ -3690,6 +3706,19 @@ export interface DialogSpec {
|
|
|
3690
3706
|
* (a code editor dismissing its own popups), judged by the element it landed on.
|
|
3691
3707
|
*/
|
|
3692
3708
|
keepOpenOnEscape?: (target: EventTarget | null) => boolean;
|
|
3709
|
+
/**
|
|
3710
|
+
* Offer a slot of this dialog's own, so other plugins can add to it with `ui.dialogSlot`
|
|
3711
|
+
* the way they add to a built-in dialog: `id` is what they name (`"<plugin>.<name>"`),
|
|
3712
|
+
* `fields` the working copy lent to them, read live, and `payload` what the dialog was
|
|
3713
|
+
* opened with. The Text Trigger Editor plugin offers `"trigedit.text"` with a `text` field.
|
|
3714
|
+
*/
|
|
3715
|
+
slot?: DialogSlotOffer;
|
|
3716
|
+
}
|
|
3717
|
+
/** A slot a plugin dialog offers to other plugins; see `DialogSpec.slot`. */
|
|
3718
|
+
export interface DialogSlotOffer {
|
|
3719
|
+
id: string;
|
|
3720
|
+
payload?: Record<string, unknown>;
|
|
3721
|
+
fields?: Record<string, DialogField>;
|
|
3693
3722
|
}
|
|
3694
3723
|
export interface DialogHandle {
|
|
3695
3724
|
close(): void;
|
|
@@ -3771,10 +3800,15 @@ export interface StatusItemHandle {
|
|
|
3771
3800
|
* not yet applied to the map — so a slot's button can fill it in and leave OK to them.
|
|
3772
3801
|
*
|
|
3773
3802
|
* - `mapProperties`: `name`, `description`.
|
|
3774
|
-
* - `textTriggerEditor`: `text` (the whole editor); `payload.briefing` says which list.
|
|
3775
3803
|
* - `triggerEditor`, `stringEditor`, `playerSettings`, `missionBriefing`: no fields, a slot only.
|
|
3804
|
+
*
|
|
3805
|
+
* A plugin's own dialog can offer a slot too (`DialogSpec.slot`), under an id of its
|
|
3806
|
+
* choosing — `"trigedit.text"` is the Text Trigger Editor's, lending `text` with
|
|
3807
|
+
* `payload.briefing` — and another plugin adds to it with the same `dialogSlot` call.
|
|
3776
3808
|
*/
|
|
3777
|
-
export type SlottedDialogId = "mapProperties" | "
|
|
3809
|
+
export type SlottedDialogId = "mapProperties" | "triggerEditor" | "stringEditor" | "playerSettings" | "missionBriefing";
|
|
3810
|
+
/** A slot id: one of the editor's dialogs, or the id a plugin dialog offers (`"<plugin>.<name>"` by convention). */
|
|
3811
|
+
export type DialogSlotId = SlottedDialogId | (string & {});
|
|
3778
3812
|
/** A form field a dialog lends to a slot: read it, set it, hear it change. */
|
|
3779
3813
|
export interface DialogField {
|
|
3780
3814
|
get(): string;
|
|
@@ -3782,7 +3816,7 @@ export interface DialogField {
|
|
|
3782
3816
|
}
|
|
3783
3817
|
/** What a slot's `mount` is handed: which dialog, its payload, its fields, and a way to close it. */
|
|
3784
3818
|
export interface DialogSlotHost {
|
|
3785
|
-
readonly dialog:
|
|
3819
|
+
readonly dialog: DialogSlotId;
|
|
3786
3820
|
readonly payload: Readonly<Record<string, unknown>>;
|
|
3787
3821
|
readonly fields: Readonly<Record<string, DialogField>>;
|
|
3788
3822
|
close(): void;
|
|
@@ -3991,8 +4025,9 @@ export interface UiApi {
|
|
|
3991
4025
|
/**
|
|
3992
4026
|
* Add to a built-in dialog. `mount` runs in a row at the left of the dialog's footer each
|
|
3993
4027
|
* time that dialog opens, with the dialog's working-copy fields to read and fill
|
|
3994
|
-
* (`SlottedDialogId` lists which dialogs and fields)
|
|
3995
|
-
*
|
|
4028
|
+
* (`SlottedDialogId` lists which dialogs and fields) — or to another plugin's dialog,
|
|
4029
|
+
* by the id its `DialogSpec.slot` offers. Returns the registration; it leaves with
|
|
4030
|
+
* `dispose()` or the plugin.
|
|
3996
4031
|
*
|
|
3997
4032
|
* @example
|
|
3998
4033
|
* api.ui.dialogSlot("mapProperties", {
|
|
@@ -4003,7 +4038,7 @@ export interface UiApi {
|
|
|
4003
4038
|
* },
|
|
4004
4039
|
* });
|
|
4005
4040
|
*/
|
|
4006
|
-
dialogSlot(dialog:
|
|
4041
|
+
dialogSlot(dialog: DialogSlotId, spec: DialogSlotSpec): Disposable;
|
|
4007
4042
|
/**
|
|
4008
4043
|
* Take over the pointer on the map until `stop()`, Esc, a right-click, a map change
|
|
4009
4044
|
* or another tool. One tool runs at a time — starting one stops the previous — and a
|