@i2analyze/notebook-sdk 1.10.0-dev.19 → 1.10.0-dev.20

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.
@@ -2422,6 +2422,63 @@ export declare namespace commands {
2422
2422
  * @i2since 1.9
2423
2423
  */
2424
2424
  export type GroupType = 'expanded' | 'collapsed' | 'command' | 'stacked';
2425
+ /**
2426
+ * The state of the keyboard modifier keys at the point at which a command was triggered.
2427
+ * @i2since 1.10
2428
+ */
2429
+ export interface IModifierKeys {
2430
+ /**
2431
+ * Indicates whether the <kbd>Ctrl</kbd> key was held when the command was triggered.
2432
+ * @i2since 1.10
2433
+ */
2434
+ readonly ctrl: boolean;
2435
+ /**
2436
+ * Indicates whether the <kbd>Shift</kbd> key was held when the command was triggered.
2437
+ * @i2since 1.10
2438
+ */
2439
+ readonly shift: boolean;
2440
+ /**
2441
+ * Indicates whether the <kbd>Alt</kbd> key (<kbd>Option</kbd> on macOS) was held when the command was triggered.
2442
+ * @i2since 1.10
2443
+ */
2444
+ readonly alt: boolean;
2445
+ /**
2446
+ * Indicates whether the meta key (<kbd>Command</kbd> on macOS, the Windows key on Windows) was held when the
2447
+ * command was triggered.
2448
+ * @i2since 1.10
2449
+ */
2450
+ readonly meta: boolean;
2451
+ }
2452
+ /**
2453
+ * Context that describes where and how a command was triggered.
2454
+ *
2455
+ * @remarks
2456
+ * This context is mixed into the payload that every command receives. Its members are populated when the
2457
+ * command is triggered from a position on the chart, such as when a pop-up (right-click) menu is opened.
2458
+ * They are `undefined` when the command is triggered without a positional origin, for example from a ribbon
2459
+ * or programmatically.
2460
+ * @i2since 1.10
2461
+ */
2462
+ export interface ICommandInvocationContext {
2463
+ /**
2464
+ * Gets the position on the chart at which the command was triggered, in chart coordinates.
2465
+ *
2466
+ * @remarks
2467
+ * This is `undefined` if the command was triggered without a positional origin. For example, when a
2468
+ * command is invoked from a pop-up (right-click) menu, this is the position on the chart at which the
2469
+ * menu was opened.
2470
+ * @i2since 1.10
2471
+ */
2472
+ readonly triggerPosition?: visual.IPosition;
2473
+ /**
2474
+ * Gets the state of the keyboard modifier keys at the point at which the command was triggered.
2475
+ *
2476
+ * @remarks
2477
+ * This is `undefined` if the command was not triggered by a user input event.
2478
+ * @i2since 1.10
2479
+ */
2480
+ readonly modifierKeys?: IModifierKeys;
2481
+ }
2425
2482
  /**
2426
2483
  * A mapping of command types to their payload types.
2427
2484
  * @i2since 1.0
@@ -2443,6 +2500,20 @@ export declare namespace commands {
2443
2500
  */
2444
2501
  readonly unscoped: void;
2445
2502
  }
2503
+ /**
2504
+ * A mapping of command types to the payload that their {@link commands.ICommandConfig.onExecute}
2505
+ * callback receives.
2506
+ *
2507
+ * @remarks
2508
+ * This is the command's base payload from {@link commands.CommandPayloadMap} combined with the
2509
+ * {@link commands.ICommandInvocationContext} that describes where and how the command was triggered.
2510
+ * Unlike {@link commands.CommandPayloadMap}, which also types the `onPopulate` callback of a dynamic
2511
+ * group, this mapping applies only when a command is executed.
2512
+ * @i2since 1.10
2513
+ */
2514
+ export type CommandExecutePayloadMap = {
2515
+ readonly [TCommandType in CommandType]: CommandPayloadMap[TCommandType] extends void ? ICommandInvocationContext : CommandPayloadMap[TCommandType] & ICommandInvocationContext;
2516
+ };
2446
2517
  /**
2447
2518
  * A mapping of command types to the event types that are available to a surfaced command.
2448
2519
  * @i2since 1.0
@@ -2569,10 +2640,12 @@ export declare namespace commands {
2569
2640
  /**
2570
2641
  * Runs when the command is executed.
2571
2642
  *
2572
- * @param payload - The payload that i2 Notebook provides to the command.
2643
+ * @param payload - The payload that i2 Notebook provides to the command. As well as the base payload
2644
+ * for the command type, this includes the {@link commands.ICommandInvocationContext}
2645
+ * that describes where and how the command was triggered.
2573
2646
  * @i2since 1.0
2574
2647
  */
2575
- onExecute(payload: CommandPayloadMap[TCommandType]): void;
2648
+ onExecute(payload: CommandExecutePayloadMap[TCommandType]): void;
2576
2649
  /**
2577
2650
  * Runs when an action derived from the command is surfaced, enabling the command to configure the action in response to events.
2578
2651
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i2analyze/notebook-sdk",
3
- "version": "1.10.0-dev.19",
3
+ "version": "1.10.0-dev.20",
4
4
  "description": "i2 Notebook SDK",
5
5
  "license": "MIT",
6
6
  "publishConfig": {