@i2analyze/notebook-sdk 1.10.0-dev.4 → 1.10.0-dev.5

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.
@@ -2539,23 +2539,24 @@ export declare namespace commands {
2539
2539
  * Adds the specified group of actions to the user interface.
2540
2540
  *
2541
2541
  * @param group - The group to add.
2542
+ * @typeParam TCommandType - The type of the command-context for the group, which determines what event API is passed to its {@link commands.IGroup.onSurface}.
2542
2543
  * @returns An object that you can use to add actions or a further group to the new group.
2543
2544
  * @throws `Error` if the `group` was not valid, or if a group with the same {@link commands.GroupId} was already present.
2544
2545
  * @i2since 1.0
2545
2546
  */
2546
- addGroup(group: IGroup): IActionArea<undefined>;
2547
+ addGroup<TCommandType extends CommandType = 'unscoped'>(group: IGroup<TCommandType>): IActionArea<undefined>;
2547
2548
  /**
2548
2549
  * Adds a dynamic group whose commands are created on demand each time the group is opened.
2549
2550
  *
2550
2551
  * @remarks
2551
2552
  * Unlike {@link commands.IActionArea.addGroup}, the commands in a dynamic group are not created during plug-in
2552
- * initialization. Instead, the {@link commands.IDynamicGroupConfig.onSurface} callback is called each time the
2553
+ * initialization. Instead, the {@link commands.IDynamicGroupConfig.onPopulate} callback is called each time the
2553
2554
  * group is opened, allowing you to create commands that reflect the current application state.
2554
2555
  *
2555
2556
  * Dynamic groups are always collapsed — they render as a dropdown or submenu.
2556
2557
  *
2557
- * @param config - The configuration for the dynamic group, including the `onSurface` callback.
2558
- * @typeParam TCommandType - The type of the command, which determines the context passed to `onSurface`.
2558
+ * @param config - The configuration for the dynamic group, including the `onPopulate` callback.
2559
+ * @typeParam TCommandType - The type of the command-context for the group, which determines what payload is passed to `onPopulate` and what event API is passed to `onSurface`.
2559
2560
  * @throws `Error` if `config.id` is not a valid {@link commands.GroupId | GroupId}.
2560
2561
  * @i2since 1.10
2561
2562
  */
@@ -2569,11 +2570,12 @@ export declare namespace commands {
2569
2570
  * plug-ins that want to use the same group, and these plug-ins can be deployed independently, then you should use this method.
2570
2571
  *
2571
2572
  * @param group - The group to add or get.
2573
+ * @typeParam TCommandType - The type of the command-context for the group, which determines what event API is passed to its {@link commands.IGroup.onSurface}.
2572
2574
  * @returns An object that you can use to add actions or a further group to the new or existing group.
2573
2575
  * @throws `Error` if the `group` was not valid, or if it was added before by the same plug-in.
2574
2576
  * @i2since 1.0
2575
2577
  */
2576
- addOrGetGroup(group: IGroup): IActionArea<undefined>;
2578
+ addOrGetGroup<TCommandType extends CommandType = 'unscoped'>(group: IGroup<TCommandType>): IActionArea<undefined>;
2577
2579
  /**
2578
2580
  * Locates the area of the user interface that appears immediately after a particular action or group of actions.
2579
2581
  *
@@ -2749,9 +2751,11 @@ export declare namespace commands {
2749
2751
  }
2750
2752
  /**
2751
2753
  * A group of actions in either the i2 Notebook application ribbon or a popup menu.
2754
+ *
2755
+ * @typeParam TCommandType - The type of the command-context for the group, which determines what event API is passed to {@link commands.IGroup.onSurface}. Defaults to `'unscoped'`.
2752
2756
  * @i2since 1.0
2753
2757
  */
2754
- export interface IGroup extends IGroupBase {
2758
+ export interface IGroup<TCommandType extends CommandType = 'unscoped'> extends IGroupBase {
2755
2759
  /**
2756
2760
  * Gets the icon of the group, which is displayed if the group is collapsed.
2757
2761
  * @i2since 1.0
@@ -2775,6 +2779,36 @@ export declare namespace commands {
2775
2779
  * @i2since 1.9
2776
2780
  */
2777
2781
  readonly type?: GroupType;
2782
+ /**
2783
+ * Gets the command-context type, which determines what event API is passed to {@link commands.IGroup.onSurface}.
2784
+ *
2785
+ * @remarks
2786
+ * Mirrors {@link commands.IDynamicGroupConfig.context} (and, by analogy, {@link commands.ICommandConfig."type"}).
2787
+ * Defaults to `'unscoped'`, which means {@link commands.IGroup.onSurface} receives no event API.
2788
+ * @i2since 1.10
2789
+ */
2790
+ readonly context?: TCommandType;
2791
+ /**
2792
+ * Runs when an action derived from the group is surfaced, enabling the group to configure the action in response to events.
2793
+ *
2794
+ * @remarks
2795
+ * Mirrors {@link commands.ICommandConfig.onSurface} but applies to groups: use the supplied
2796
+ * {@link commands.IGroupAction} to change the group's label, icon, or enabled/hidden state at any
2797
+ * time during its surfaced lifetime. The signal aborts when the group is removed from the user
2798
+ * interface; the optional returned cleanup function runs at the same time.
2799
+ *
2800
+ * If there is no implementation of `onSurface()`, the group renders with its static configuration
2801
+ * and remains enabled.
2802
+ *
2803
+ * @param groupAction - The group action being surfaced.
2804
+ * @param eventApi - The events that the group can subscribe to, keyed by the group's `context`.
2805
+ * @param signal - A signal that the application uses to tell the group that it is removing it from the user interface.
2806
+ *
2807
+ * @returns A function that the application calls when it removes the group from the user interface.
2808
+ * In its implementation, the group must unsubscribe from any events that it has subscribed to.
2809
+ * @i2since 1.10
2810
+ */
2811
+ onSurface?(groupAction: IGroupAction, eventApi: CommandEventsMap[TCommandType], signal: AbortSignal): void | (() => void);
2778
2812
  }
2779
2813
  /**
2780
2814
  * A group of actions in a popup menu that do not have a label or an icon.
@@ -2788,12 +2822,15 @@ export declare namespace commands {
2788
2822
  *
2789
2823
  * @remarks
2790
2824
  * A dynamic group solves the limitation that commands can only be created during plug-in initialization.
2791
- * Instead, the {@link commands.IDynamicGroupConfig.onSurface} callback is called each time the group is
2792
- * opened, allowing commands to be created based on the current application state.
2825
+ * Instead, the {@link commands.IDynamicGroupConfig.onPopulate} callback is called each time the group is
2826
+ * opened, allowing commands to be created based on the current application state. The group's
2827
+ * popup-button state (label, icon, enabled, hidden) can be driven separately by an optional
2828
+ * {@link commands.IDynamicGroupConfig.onSurface} callback that runs once when the group is
2829
+ * surfaced on a host.
2793
2830
  *
2794
2831
  * Dynamic groups are always collapsed — they render as a dropdown/submenu that opens on click.
2795
2832
  *
2796
- * @typeParam TCommandType - The type of the command, which determines what context is passed to {@link commands.IDynamicGroupConfig.onSurface}.
2833
+ * @typeParam TCommandType - The type of the command-context for the group, which determines what payload is passed to {@link commands.IDynamicGroupConfig.onPopulate} and what event API is passed to {@link commands.IDynamicGroupConfig.onSurface}.
2797
2834
  * @i2since 1.10
2798
2835
  */
2799
2836
  export interface IDynamicGroupConfig<TCommandType extends CommandType = CommandType> {
@@ -2813,30 +2850,55 @@ export declare namespace commands {
2813
2850
  */
2814
2851
  readonly icon?: IIcon;
2815
2852
  /**
2816
- * Gets the command type, which determines what context is passed to {@link commands.IDynamicGroupConfig.onSurface}.
2853
+ * Gets the command-context type for the group.
2854
+ *
2855
+ * @remarks
2856
+ * Determines what payload is passed to {@link commands.IDynamicGroupConfig.onPopulate} and what
2857
+ * event API is passed to {@link commands.IDynamicGroupConfig.onSurface}.
2817
2858
  * @i2since 1.10
2818
2859
  */
2819
- readonly type: TCommandType;
2860
+ readonly context: TCommandType;
2820
2861
  /**
2821
2862
  * Populates the group's commands each time the group is opened.
2822
2863
  *
2823
2864
  * @param commandArea - A scoped area for creating and surfacing commands. Only commands created here are visible in this group.
2824
- * @param context - The context based on type: `undefined` for `'unscoped'`, {@link commands.IRecordsContext} for `'records'`, the application object for `'application'`.
2865
+ * @param context - The context based on the group's `context` field: `undefined` for `'unscoped'`, {@link commands.IRecordsContext} for `'records'`, the application object for `'application'`.
2825
2866
  * @param signal - An AbortSignal that is aborted when the group closes. Use it to cancel any async work started in this callback.
2826
2867
  * @returns An optional cleanup function that is called when the group closes, before the signal is aborted.
2827
2868
  * @i2since 1.10
2828
2869
  */
2829
- onSurface(commandArea: IDynamicActionArea, context: CommandPayloadMap[TCommandType], signal: AbortSignal): void | (() => void);
2870
+ onPopulate(commandArea: IDynamicActionArea, context: CommandPayloadMap[TCommandType], signal: AbortSignal): void | (() => void);
2871
+ /**
2872
+ * Runs when the dynamic group's popup button is surfaced, enabling its state to be driven from events.
2873
+ *
2874
+ * @remarks
2875
+ * The lifetime of this callback is the dynamic group's *button* — separate from the per-open
2876
+ * lifecycle of {@link commands.IDynamicGroupConfig.onPopulate}, which populates the popup's
2877
+ * contents. Use this callback to react to long-lived application state; populate the popup's
2878
+ * contents in `onPopulate`.
2879
+ *
2880
+ * If there is no implementation of `onSurface()`, the popup button renders with its static
2881
+ * configuration and remains enabled.
2882
+ *
2883
+ * @param groupAction - The group action being surfaced.
2884
+ * @param eventApi - The events that the group can subscribe to, keyed by the group's `type`.
2885
+ * @param signal - A signal that the application uses to tell the group that it is removing the popup button from the user interface.
2886
+ *
2887
+ * @returns A function that the application calls when it removes the popup button from the user interface.
2888
+ * In its implementation, the group must unsubscribe from any events that it has subscribed to.
2889
+ * @i2since 1.10
2890
+ */
2891
+ onSurface?(groupAction: IGroupAction, eventApi: CommandEventsMap[TCommandType], signal: AbortSignal): void | (() => void);
2830
2892
  }
2831
2893
  /**
2832
- * A scoped area for creating and surfacing commands within a {@link commands.IDynamicGroupConfig.onSurface} callback.
2894
+ * A scoped area for creating and surfacing commands within a {@link commands.IDynamicGroupConfig.onPopulate} callback.
2833
2895
  *
2834
2896
  * @remarks
2835
2897
  * Methods on this interface work like their equivalents on {@link commands.IActionArea}, but are scoped to the
2836
- * current surface session. Commands created here exist only while the group is open and are automatically
2898
+ * current populate session. Commands created here exist only while the group is open and are automatically
2837
2899
  * unregistered when it closes.
2838
2900
  *
2839
- * `getGroup` is restricted to groups created within the same `onSurface` call — it throws if you pass an
2901
+ * `getGroup` is restricted to groups created within the same `onPopulate` call — it throws if you pass an
2840
2902
  * external group identifier.
2841
2903
  * @i2since 1.10
2842
2904
  */
@@ -2856,28 +2918,30 @@ export declare namespace commands {
2856
2918
  */
2857
2919
  after(idOrCommand: CommandId | GroupId | ICommand): IDynamicActionArea;
2858
2920
  /**
2859
- * Returns an area scoped to a group created during this `onSurface` call.
2921
+ * Returns an area scoped to a group created during this `onPopulate` call.
2860
2922
  *
2861
- * @param id - The identifier of a group created in this session.
2923
+ * @param id - The identifier of a group created in this populate session.
2862
2924
  * @returns A scoped area for the contents of the group.
2863
- * @throws `Error` if `id` refers to a group that was not created in this session.
2925
+ * @throws `Error` if `id` refers to a group that was not created in this populate session.
2864
2926
  * @i2since 1.10
2865
2927
  */
2866
2928
  getGroup(id: GroupId): IDynamicActionArea;
2867
2929
  /**
2868
2930
  * Adds a new group.
2869
2931
  * @param group - The group configuration.
2932
+ * @typeParam TCommandType - The type of the command-context for the group, which determines what event API is passed to its {@link commands.IGroup.onSurface}.
2870
2933
  * @returns A scoped area for the contents of the new group.
2871
2934
  * @i2since 1.10
2872
2935
  */
2873
- addGroup(group: IGroup): IDynamicActionArea;
2936
+ addGroup<TCommandType extends CommandType = 'unscoped'>(group: IGroup<TCommandType>): IDynamicActionArea;
2874
2937
  /**
2875
- * Adds a new group, or returns the existing one if it was already added during this `onSurface` call.
2938
+ * Adds a new group, or returns the existing one if it was already added during this `onPopulate` call.
2876
2939
  * @param group - The group configuration.
2940
+ * @typeParam TCommandType - The type of the command-context for the group, which determines what event API is passed to its {@link commands.IGroup.onSurface}.
2877
2941
  * @returns A scoped area for the contents of the new or existing group.
2878
2942
  * @i2since 1.10
2879
2943
  */
2880
- addOrGetGroup(group: IGroup): IDynamicActionArea;
2944
+ addOrGetGroup<TCommandType extends CommandType = 'unscoped'>(group: IGroup<TCommandType>): IDynamicActionArea;
2881
2945
  /**
2882
2946
  * Surfaces the specified commands in the group.
2883
2947
  * @param commandsOrCommandIds - The commands or command identifiers to surface.
@@ -2885,6 +2949,54 @@ export declare namespace commands {
2885
2949
  */
2886
2950
  surfaceCommands(...commandsOrCommandIds: (ICommand | CommandId)[]): void;
2887
2951
  }
2952
+ /**
2953
+ * A representation of a group of commands in the user interface. A group action is created when a group is surfaced.
2954
+ *
2955
+ * @remarks
2956
+ * Group actions mirror {@link commands.IAction} for individual commands. They are passed to
2957
+ * {@link commands.IGroup.onSurface} (for static groups) and {@link commands.IDynamicGroupConfig.onSurface}
2958
+ * (for the popup button of a dynamic group), allowing the group's label, icon, and enabled/hidden
2959
+ * state to be driven from application state.
2960
+ *
2961
+ * When a group is disabled and expanded, its immediate children are rendered as disabled too —
2962
+ * disabling the group is therefore a render-time cascade, not a mutation of child state.
2963
+ * @i2since 1.10
2964
+ */
2965
+ export interface IGroupAction {
2966
+ /**
2967
+ * Sets the label of the group. For example, "Layouts".
2968
+ *
2969
+ * @param value - A label for the group.
2970
+ * @i2since 1.10
2971
+ */
2972
+ setName(value: string): void;
2973
+ /**
2974
+ * Sets whether the group is enabled — that is, whether it is available for users to interact with.
2975
+ *
2976
+ * @remarks
2977
+ * When disabled and expanded, the group's immediate child actions render as disabled; when
2978
+ * disabled and collapsed (or a dynamic group), the popup trigger cannot be opened.
2979
+ *
2980
+ * @param value - `true` to enable the group; `false` to disable it.
2981
+ * @i2since 1.10
2982
+ */
2983
+ setEnabled(value: boolean): void;
2984
+ /**
2985
+ * Sets whether the group is hidden — that is, whether it is visible to users at all.
2986
+ * Hidden groups do not render their container, label, or children.
2987
+ *
2988
+ * @param value - `true` to hide the group; `false` to show it.
2989
+ * @i2since 1.10
2990
+ */
2991
+ setHidden(value: boolean): void;
2992
+ /**
2993
+ * Sets the icon for the group.
2994
+ *
2995
+ * @param value - An icon for the group.
2996
+ * @i2since 1.10
2997
+ */
2998
+ setIcon(value: IIcon): void;
2999
+ }
2888
3000
  /**
2889
3001
  * A representation of a command in the user interface. An action is created when a command is surfaced.
2890
3002
  * @i2since 1.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@i2analyze/notebook-sdk",
3
- "version": "1.10.0-dev.4",
3
+ "version": "1.10.0-dev.5",
4
4
  "description": "i2 Notebook SDK",
5
5
  "license": "MIT",
6
6
  "publishConfig": {