@scm-js/plugin-api 1.54.0 → 1.55.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 +23 -7
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2518,7 +2518,7 @@ export interface PluginApi {
2518
2518
  readonly menu: MenuApi;
2519
2519
  /** Items in the right-click menus of the map and the terrain palette. */
2520
2520
  readonly contextMenu: ContextMenuApi;
2521
- /** Key combinations, tried before the editor's own and never while a text field has focus. */
2521
+ /** Key combinations, tried before the editor's own, and never while a text field has focus or a dialog is open. */
2522
2522
  readonly hotkeys: HotkeyApi;
2523
2523
  readonly commands: CommandsApi;
2524
2524
  /** Live objects one plugin holds out for others to use, found by name and watched for arriving. */
@@ -2535,7 +2535,7 @@ export interface PluginApi {
2535
2535
  readonly sync: SyncApi;
2536
2536
  /**
2537
2537
  * A small key-value store of the plugin's own, kept in the browser's local storage under
2538
- * the plugin's id and listed with everything else in Preferences ▸ Browser storage.
2538
+ * the plugin's id and listed with everything else in Preferences ▸ Storage.
2539
2539
  */
2540
2540
  readonly storage: StorageApi;
2541
2541
  /** `console.log` with the plugin's name in front. */
@@ -4591,6 +4591,20 @@ export interface TilesetApi {
4591
4591
  load(tileset?: TilesetId): Promise<boolean>;
4592
4592
  raw(): LoadedTileset | null;
4593
4593
  }
4594
+ /**
4595
+ * What is selected on each object layer, by index into the scenario's lists, with a
4596
+ * setter for each; the Clipboard layer's marked area; the active layer; and the Layers
4597
+ * panel's locks.
4598
+ *
4599
+ * @example
4600
+ * // Select Player 1's units inside the marked area.
4601
+ * const area = api.selection.markedArea();
4602
+ * if (area) {
4603
+ * const mine = new Set(api.query.unitsOf(0));
4604
+ * api.selection.setLayer("units");
4605
+ * api.selection.setUnits(api.query.unitsIn(area).filter((i) => mine.has(i)));
4606
+ * }
4607
+ */
4594
4608
  export interface SelectionApi {
4595
4609
  /** The Cut / Copy / Paste layer's marked rectangle, in tiles. */
4596
4610
  markedArea(): Rect | null;
@@ -4950,6 +4964,7 @@ export interface DialogTransfer {
4950
4964
  export interface DialogSpec {
4951
4965
  title: string;
4952
4966
  size?: DialogSize;
4967
+ /** A fixed height (720 CSS pixels, less on a small screen) instead of the content's own, for a body that scrolls or fills. */
4953
4968
  tall?: boolean;
4954
4969
  /** Fill `body` (an empty `<div>` inside the dialog); return a cleanup if you need one. */
4955
4970
  mount(body: HTMLElement, dialog: DialogHandle): void | (() => void);
@@ -5524,14 +5539,14 @@ export type OverlayAbove =
5524
5539
  | "everything";
5525
5540
  /**
5526
5541
  * An overlay is a picture drawn over the map that the user can turn on and off: it
5527
- * is listed under View ▸ Overlays and in the Layers panel, stays while the user works
5542
+ * is a tick in the View menu and a row in the Layers panel, stays while the user works
5528
5543
  * on any layer, and never takes the pointer — clicks go to the active layer's tools
5529
5544
  * as usual. It hears the pointer through `onHover`, which is how a readout follows the
5530
5545
  * mouse while the user places units. Register one at activation and keep the handle;
5531
5546
  * it goes away with the plugin.
5532
5547
  *
5533
5548
  * @example
5534
- * // A ring twelve tiles wide round every start location, listed under View ▸ Overlays.
5549
+ * // A ring twelve tiles wide round every start location, a tick in the View menu.
5535
5550
  * const overlay = api.ui.overlay({
5536
5551
  * name: "Start rings",
5537
5552
  * above: "objects",
@@ -5548,7 +5563,7 @@ export type OverlayAbove =
5548
5563
  * api.events.on("units", () => overlay.redraw());
5549
5564
  */
5550
5565
  export interface OverlaySpec {
5551
- /** Shown in View ▸ Overlays and the Layers panel. Unique per plugin. In English, like a menu label: shown through the plugin's registered catalogues. */
5566
+ /** Shown in the View menu and the Layers panel. Unique per plugin. In English, like a menu label: shown through the plugin's registered catalogues. */
5552
5567
  name: string;
5553
5568
  /** Start visible; true by default. What the user last set for this name wins for the session. */
5554
5569
  visible?: boolean;
@@ -5697,7 +5712,7 @@ export interface UiApi {
5697
5712
  */
5698
5713
  mapTool(spec: MapToolSpec): MapToolHandle;
5699
5714
  /**
5700
- * A picture over the map the user can switch on and off (View ▸ Overlays, the Layers
5715
+ * A picture over the map the user can switch on and off (a tick in the View menu, the Layers
5701
5716
  * panel) and that stays while they work on any layer. It draws at every repaint and
5702
5717
  * hears the pointer, but never takes it. As many as you like; they go with the plugin.
5703
5718
  */
@@ -6299,7 +6314,8 @@ export interface ContextMenuApi {
6299
6314
  }
6300
6315
  export interface HotkeyApi {
6301
6316
  /**
6302
- * `"Ctrl+Shift+I"`, `"Alt+F9"`, `"F8"` — modifiers in any order, then a key name.
6317
+ * `"Ctrl+Shift+I"`, `"Alt+F9"`, `"F8"` — modifiers in any order, then a key name. Tried
6318
+ * before the editor's own keys, and never while a text field has focus or a dialog is open.
6303
6319
  *
6304
6320
  * @example
6305
6321
  * api.hotkeys.add("Ctrl+Alt+G", () => api.view.setFlags({ grid: !api.view.flags().grid }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.54.0",
3
+ "version": "1.55.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",