@scm-js/plugin-api 1.33.0 → 1.35.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.
Files changed (2) hide show
  1. package/index.d.ts +31 -0
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2646,6 +2646,12 @@ export interface SectionsApi {
2646
2646
  move(from: number, to: number): RawEditResult;
2647
2647
  /** Replace the whole CHK, the way File ▸ Open reads one. */
2648
2648
  replaceFile(bytes: Uint8Array): RawEditResult;
2649
+ /**
2650
+ * The CHK inside a map file — an `.scx` / `.scm` archive's `staredit\scenario.chk`, or
2651
+ * the bytes themselves for a bare CHK — the way File ▸ Open reads it, for `replaceFile`.
2652
+ * Reads only; rejects with the reason for a file it cannot read.
2653
+ */
2654
+ chkOf(file: Uint8Array): Promise<Uint8Array>;
2649
2655
  /**
2650
2656
  * Bytes after the last chunk the reader could parse — what follows a chunk header with
2651
2657
  * a negative length, say. Save writes them back as they are; a `replaceFile` without
@@ -4215,6 +4221,24 @@ export interface StatusItemHandle {
4215
4221
  remove(): void;
4216
4222
  isShown(): boolean;
4217
4223
  }
4224
+ /** A button on the map itself (`ui.mapButton`), in the row at its bottom-right corner. */
4225
+ export interface MapButtonSpec {
4226
+ /** A word or two; the button is as wide as it. */
4227
+ label: string;
4228
+ /** The tooltip. */
4229
+ title?: string;
4230
+ /** A count or a short mark beside the label (unread messages); nothing when absent, null, 0 or "". */
4231
+ badge?: number | string | null;
4232
+ /** Drawn pressed: what the button opens is open. */
4233
+ active?: boolean;
4234
+ onClick: () => void;
4235
+ }
4236
+ export interface MapButtonHandle {
4237
+ /** Change any of the fields; the button redraws. */
4238
+ set(patch: Partial<MapButtonSpec>): void;
4239
+ remove(): void;
4240
+ isShown(): boolean;
4241
+ }
4218
4242
  /**
4219
4243
  * The dialogs a plugin may add to (`ui.dialogSlot`), and the fields each one exposes to
4220
4244
  * the slot. A field is the dialog's *working copy* — what the person sees in the form,
@@ -4482,6 +4506,13 @@ export interface UiApi {
4482
4506
  * leaves with `remove()` or the plugin.
4483
4507
  */
4484
4508
  statusItem(spec: StatusItemSpec): StatusItemHandle;
4509
+ /**
4510
+ * A button on the map, in the row at its bottom-right corner beside the tileset, size
4511
+ * and zoom — for something that belongs to the map being worked on, such as a shared
4512
+ * map's chat. Keep it to what matters while the map is in view; everything else goes
4513
+ * in a menu or the status bar. It leaves with `remove()` or the plugin.
4514
+ */
4515
+ mapButton(spec: MapButtonSpec): MapButtonHandle;
4485
4516
  /**
4486
4517
  * Add to a built-in dialog. `mount` runs in a row at the left of the dialog's footer each
4487
4518
  * time that dialog opens, with the dialog's working-copy fields to read and fill
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.33.0",
3
+ "version": "1.35.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",