@scm-js/plugin-api 1.38.0 → 1.40.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 +40 -2
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2029,6 +2029,8 @@ export interface StringImport {
2029
2029
  export type Locale = "en" | "ko";
2030
2030
  /** `"auto"` follows the browser (or the desktop app's system language). */
2031
2031
  export type LanguagePreference = "auto" | Locale;
2032
+ /** What `Preferences.hotkeys` holds: the commands the user changed, each with its whole list (`[]` = no keys). */
2033
+ export type HotkeyOverrides = Record<string, string[]>;
2032
2034
  export interface Preferences {
2033
2035
  /** The editor's own language: `"auto"` follows the browser's (the system's, in the desktop app), else one of `LOCALES`. Applied live. */
2034
2036
  language: LanguagePreference;
@@ -2155,6 +2157,28 @@ export interface Preferences {
2155
2157
  plugins: {
2156
2158
  updates: PluginUpdateMode;
2157
2159
  };
2160
+ /**
2161
+ * Preferences ▸ Hotkeys: the commands whose keys the user changed, by command id
2162
+ * (`editor/commands.ts`), each with its whole list — `[]` leaves it with none. A
2163
+ * command not here has the keys it ships with.
2164
+ */
2165
+ hotkeys: HotkeyOverrides;
2166
+ /**
2167
+ * Which cells the status bar shows (Preferences ▸ View). The message, the symmetry badge
2168
+ * while a mode is on, and the plugins' items always show.
2169
+ */
2170
+ statusBar: StatusBarCells;
2171
+ }
2172
+ /** See `Preferences.statusBar`, in the order the bar draws them. */
2173
+ export interface StatusBarCells {
2174
+ tile: boolean;
2175
+ pixel: boolean;
2176
+ tileId: boolean;
2177
+ size: boolean;
2178
+ tileset: boolean;
2179
+ layer: boolean;
2180
+ zoom: boolean;
2181
+ revision: boolean;
2158
2182
  }
2159
2183
  /** See `Preferences.plugins.updates`. */
2160
2184
  export type PluginUpdateMode = "notify" | "manual" | "auto";
@@ -3300,7 +3324,12 @@ export interface TriggerClaimRange {
3300
3324
  * in it — by a hash of the records, say — or null when the records are not there.
3301
3325
  */
3302
3326
  export interface TriggerClaimSpec {
3303
- /** What generated the run, in words, as a sentence would use it: `"the trigger script"`. */
3327
+ /**
3328
+ * What generated the run, in words, as a sentence would use it: `"the trigger script"`.
3329
+ * `label`, `badge` and `openLabel` are given in English and shown through the plugin's
3330
+ * registered catalogues, so they follow a language change; `api.triggers.claims` hands
3331
+ * back the English.
3332
+ */
3304
3333
  label: string;
3305
3334
  /** The word on the badge the trigger list shows on each row; the plugin's id by default. */
3306
3335
  badge?: string;
@@ -4581,7 +4610,7 @@ export type OverlayAbove =
4581
4610
  * it goes away with the plugin.
4582
4611
  */
4583
4612
  export interface OverlaySpec {
4584
- /** Shown in View ▸ Overlays and the Layers panel. Unique per plugin. */
4613
+ /** Shown in View ▸ Overlays and the Layers panel. Unique per plugin. In English, like a menu label: shown through the plugin's registered catalogues. */
4585
4614
  name: string;
4586
4615
  /** Start visible; true by default. What the user last set for this name wins for the session. */
4587
4616
  visible?: boolean;
@@ -5081,6 +5110,11 @@ export type TopMenu = "File" | "Edit" | "View" | "Layer" | "Scenario" | "Trigger
5081
5110
  */
5082
5111
  export type MenuPath = TopMenu | `${TopMenu}/${string}` | (string & {});
5083
5112
  export interface MenuItemSpec {
5113
+ /**
5114
+ * In English, like the path's segments: it is the item's identity (another plugin's
5115
+ * `after` names it), and the menu shows it translated through the catalogues the plugin
5116
+ * registered with `i18n.register`, so it follows a language change.
5117
+ */
5084
5118
  label: string;
5085
5119
  /** Display only — bind the key with `hotkeys.add`. */
5086
5120
  shortcut?: string;
@@ -5142,6 +5176,10 @@ export interface ContextMenuContext {
5142
5176
  markedArea: Rect | null;
5143
5177
  }
5144
5178
  export interface ContextItemSpec {
5179
+ /**
5180
+ * A fixed label is given in English and shown through the plugin's registered catalogues;
5181
+ * a function is called when the menu opens, so it translates with `i18n.t` itself.
5182
+ */
5145
5183
  label: string | ((ctx: ContextMenuContext) => string);
5146
5184
  enabled?: (ctx: ContextMenuContext) => boolean;
5147
5185
  visible?: (ctx: ContextMenuContext) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-js/plugin-api",
3
- "version": "1.38.0",
3
+ "version": "1.40.0",
4
4
  "description": "Type declarations for the scmJS plugin API",
5
5
  "license": "MIT",
6
6
  "types": "index.d.ts",