@genesislcap/foundation-ui 14.310.0 → 14.310.2-alpha-8853fb3.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.
@@ -94,5 +94,6 @@ export * from './tree-item';
94
94
  export * from './tree-view';
95
95
  export * from './url-input';
96
96
  export * from './utils/base-datasource';
97
+ export * from './utils/shortcut-manager';
97
98
  export { getPrefix as getDesignSystemPrefix } from './utils/dom';
98
99
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAEvF,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,mBAAmB,EAAE,CAAC;AAExE,eAAO,MAAM,8BAA8B,yDAAuD,CAAC;AAEnG,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,2BAA2B,CAAC;AAC1C,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAA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AU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,0BAA0B,CAAC;AACzC,OAAO,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,aAAa,CAAC"}
@@ -1,3 +1,4 @@
1
+ import { Connect } from '@genesislcap/foundation-comms';
1
2
  import { NotificationDataRow, ToastButton } from '@genesislcap/foundation-notifications';
2
3
  import { FoundationElement } from '@microsoft/fast-foundation';
3
4
  import { Subscription } from 'rxjs';
@@ -7,6 +8,7 @@ export declare const foundationNotificationListenerShadowOptions: ShadowRootInit
7
8
  */
8
9
  export declare class NotificationListener extends FoundationElement {
9
10
  notificationListener: HTMLElement;
11
+ connect: Connect;
10
12
  /**
11
13
  * The resource name holding new and existing notifications
12
14
  * @remarks usually 'ALL_NOTIFY_ALERT_RECORDS'
@@ -24,8 +26,24 @@ export declare class NotificationListener extends FoundationElement {
24
26
  */
25
27
  toastButtons: ToastButton[];
26
28
  protected dataSub: Subscription;
29
+ protected connectionSub: Subscription;
27
30
  private datasource;
28
31
  connectedCallback(): Promise<void>;
32
+ /**
33
+ * Handles reconnection logic when the connection is established
34
+ * @private
35
+ */
36
+ private handleReconnection;
37
+ /**
38
+ * Initializes the datasource for the notification resource
39
+ * @private
40
+ */
41
+ private initializeDatasource;
42
+ /**
43
+ * Sets up the data subscription to handle incoming notifications
44
+ * @private
45
+ */
46
+ private setupDataSubscription;
29
47
  disconnectedCallback(): void;
30
48
  private handleStreamUpdate;
31
49
  protected showNotificationToast(row: NotificationDataRow): void;
@@ -1 +1 @@
1
- {"version":3,"file":"notification-listener.d.ts","sourceRoot":"","sources":["../../../src/notification-listener/notification-listener.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,mBAAmB,EACnB,WAAW,EAEZ,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIpC,eAAO,MAAM,2CAA2C,EAAE,cAGzD,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IAC7C,oBAAoB,EAAG,WAAW,CAAC;IAE/C;;;;OAIG;IACmC,YAAY,MAAC;IACnD;;;OAGG;IACuE,YAAY,SAAK;IAC3F;;;OAGG;IACS,YAAY,EAAE,WAAW,EAAE,CAAM;IAE7C,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC;IACpB,OAAO,CAAC,UAAU,CAAa;IACrC,iBAAiB;IA8BvB,oBAAoB;IAWpB,OAAO,CAAC,kBAAkB;IAU1B,SAAS,CAAC,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI;CA2BhE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;+BAIzC,CAAC"}
1
+ {"version":3,"file":"notification-listener.d.ts","sourceRoot":"","sources":["../../../src/notification-listener/notification-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,OAAO,EACR,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EAIL,mBAAmB,EACnB,WAAW,EAEZ,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAIpC,eAAO,MAAM,2CAA2C,EAAE,cAGzD,CAAC;AAEF;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IAC7C,oBAAoB,EAAG,WAAW,CAAC;IAEtC,OAAO,EAAE,OAAO,CAAC;IAE1B;;;;OAIG;IACmC,YAAY,MAAC;IACnD;;;OAGG;IACuE,YAAY,SAAK;IAC3F;;;OAGG;IACS,YAAY,EAAE,WAAW,EAAE,CAAM;IAE7C,SAAS,CAAC,OAAO,EAAE,YAAY,CAAC;IAChC,SAAS,CAAC,aAAa,EAAE,YAAY,CAAC;IAC1B,OAAO,CAAC,UAAU,CAAa;IACrC,iBAAiB;IAiBvB;;;OAGG;YACW,kBAAkB;IAShC;;;OAGG;YACW,oBAAoB;IAYlC;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAa7B,oBAAoB;IAapB,OAAO,CAAC,kBAAkB;IAU1B,SAAS,CAAC,qBAAqB,CAAC,GAAG,EAAE,mBAAmB,GAAG,IAAI;CA2BhE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;+BAIzC,CAAC"}
@@ -2,4 +2,5 @@ export * from './base-datasource';
2
2
  export * from './dom';
3
3
  export * from './logger';
4
4
  export * from './options-datasource-utils';
5
+ export * from './shortcut-manager';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './shortcut-manager';
2
+ export * from './shortcut-listener';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/shortcut-manager/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { FASTElement } from '@microsoft/fast-element';
2
+ import { ShortcutManager } from './shortcut-manager';
3
+ export declare class FoundationShortcutListener extends FASTElement {
4
+ shortcutManager: ShortcutManager;
5
+ private keyListener;
6
+ private isListening;
7
+ connectedCallback(): void;
8
+ disconnectedCallback(): void;
9
+ private setupStateSubscription;
10
+ private cleanupStateSubscription;
11
+ private addKeyListener;
12
+ private removeKeyListener;
13
+ private handleKeyDown;
14
+ private isInputElement;
15
+ }
16
+ //# sourceMappingURL=shortcut-listener.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcut-listener.d.ts","sourceRoot":"","sources":["../../../../src/utils/shortcut-manager/shortcut-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAErE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBAGa,0BAA2B,SAAQ,WAAW;IAChC,eAAe,EAAE,eAAe,CAAC;IAE1D,OAAO,CAAC,WAAW,CAAiD;IACpE,OAAO,CAAC,WAAW,CAAS;IAE5B,iBAAiB;IAKjB,oBAAoB;IAMpB,OAAO,CAAC,sBAAsB;IAgB9B,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,aAAa;IA6BrB,OAAO,CAAC,cAAc;CAuBvB"}
@@ -0,0 +1,66 @@
1
+ import { BehaviorSubject, Observable } from 'rxjs';
2
+ /** A type which represents the disabled status and tooltip of an item */
3
+ export type ShortcutExecutionStatus = {
4
+ /** Gets whether the item should be disabled */
5
+ disabled?: boolean;
6
+ /** Gets the tooltip for the item */
7
+ tooltip?: string;
8
+ };
9
+ export interface ShortcutDefinition {
10
+ id: string;
11
+ key: string;
12
+ ctrlKey?: boolean;
13
+ altKey?: boolean;
14
+ shiftKey?: boolean;
15
+ metaKey?: boolean;
16
+ description: string;
17
+ action: () => void;
18
+ context: string;
19
+ priority?: number;
20
+ elementRef?: HTMLElement | any;
21
+ canExecute?: () => ShortcutExecutionStatus;
22
+ }
23
+ export interface ShortcutRegistrationResult {
24
+ shortcut: ShortcutDefinition;
25
+ id: string;
26
+ keyCombination: string;
27
+ disabled: () => boolean;
28
+ tooltip: () => string | undefined;
29
+ }
30
+ export interface ShortcutManager {
31
+ registerShortcuts(shortcuts: ShortcutDefinition[]): void;
32
+ registerShortcut(shortcut: ShortcutDefinition): ShortcutRegistrationResult;
33
+ unregisterShortcut(id: string): void;
34
+ unregisterShortcutsByContext(context: string): void;
35
+ executeShortcut(id: string): void;
36
+ getShortcuts(): ShortcutDefinition[];
37
+ getShortcutsByContext(context: string): ShortcutDefinition[];
38
+ findShortcutByKeyCombination(key: string, ctrlKey?: boolean, altKey?: boolean, shiftKey?: boolean, metaKey?: boolean): ShortcutDefinition | undefined;
39
+ pause(): void;
40
+ resume(): void;
41
+ isPaused: boolean;
42
+ isPaused$: Observable<boolean>;
43
+ isPausedSubject: BehaviorSubject<boolean>;
44
+ }
45
+ export declare class DefaultShortcutManager implements ShortcutManager {
46
+ private shortcuts;
47
+ private keyCombinationMap;
48
+ private _isPausedSubject;
49
+ get isPaused(): boolean;
50
+ get isPaused$(): Observable<boolean>;
51
+ get isPausedSubject(): BehaviorSubject<boolean>;
52
+ registerShortcuts(shortcuts: ShortcutDefinition[]): void;
53
+ registerShortcut(shortcut: ShortcutDefinition): ShortcutRegistrationResult;
54
+ unregisterShortcut(id: string): void;
55
+ unregisterShortcutsByContext(context: string): void;
56
+ executeShortcut(id: string): void;
57
+ getShortcuts(): ShortcutDefinition[];
58
+ getShortcutsByContext(context: string): ShortcutDefinition[];
59
+ findShortcutByKeyCombination(key: string, ctrlKey?: boolean, altKey?: boolean, shiftKey?: boolean, metaKey?: boolean): ShortcutDefinition | undefined;
60
+ pause(): void;
61
+ resume(): void;
62
+ private createKeyCombinationKey;
63
+ private isElementFocused;
64
+ }
65
+ export declare const ShortcutManager: import("@microsoft/fast-foundation").InterfaceSymbol<ShortcutManager>;
66
+ //# sourceMappingURL=shortcut-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shortcut-manager.d.ts","sourceRoot":"","sources":["../../../../src/utils/shortcut-manager/shortcut-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEnD,yEAAyE;AACzE,MAAM,MAAM,uBAAuB,GAAG;IACpC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,oCAAoC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,OAAO,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SAAS,CAAyC;IAC1D,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,gBAAgB,CAAuC;IAE/D,IAAI,QAAQ,IAAI,OAAO,CAEtB;IAED,IAAI,SAAS,IAAI,UAAU,CAAC,OAAO,CAAC,CAEnC;IAED,IAAI,eAAe,IAAI,eAAe,CAAC,OAAO,CAAC,CAE9C;IAED,iBAAiB,CAAC,SAAS,EAAE,kBAAkB,EAAE,GAAG,IAAI;IAMxD,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,GAAG,0BAA0B;IA4C1E,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAepC,4BAA4B,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAYnD,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IA4BjC,YAAY,IAAI,kBAAkB,EAAE;IAIpC,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,EAAE;IAI5D,4BAA4B,CAC1B,GAAG,EAAE,MAAM,EACX,OAAO,UAAQ,EACf,MAAM,UAAQ,EACd,QAAQ,UAAQ,EAChB,OAAO,UAAQ,GACd,kBAAkB,GAAG,SAAS;IAOjC,KAAK,IAAI,IAAI;IAIb,MAAM,IAAI,IAAI;IAId,OAAO,CAAC,uBAAuB;IAiB/B,OAAO,CAAC,gBAAgB;CAMzB;AAGD,eAAO,MAAM,eAAe,uEAE3B,CAAC"}
package/dist/esm/index.js CHANGED
@@ -94,4 +94,5 @@ export * from './tree-item';
94
94
  export * from './tree-view';
95
95
  export * from './url-input';
96
96
  export * from './utils/base-datasource';
97
+ export * from './utils/shortcut-manager';
97
98
  export { getPrefix as getDesignSystemPrefix } from './utils/dom';
@@ -1,5 +1,5 @@
1
1
  import { __awaiter, __decorate } from "tslib";
2
- import { Datasource, dataServerResultFilter, } from '@genesislcap/foundation-comms';
2
+ import { Datasource, dataServerResultFilter, Connect, } from '@genesislcap/foundation-comms';
3
3
  import { showNotificationToast } from '@genesislcap/foundation-notifications';
4
4
  import { NotificationEvent, showNotification, } from '@genesislcap/foundation-notifications';
5
5
  import { attr, nullableNumberConverter, observable } from '@microsoft/fast-element';
@@ -32,37 +32,73 @@ export class NotificationListener extends FoundationElement {
32
32
  connectedCallback: { get: () => super.connectedCallback }
33
33
  });
34
34
  return __awaiter(this, void 0, void 0, function* () {
35
- var _a;
36
35
  _super.connectedCallback.call(this);
37
36
  this.addEventListener(NotificationEvent.NOTIFICATION_EVENT, (e) => {
38
37
  e.stopImmediatePropagation();
39
38
  showNotification(e.detail, this.tagName, this.notificationListener);
40
39
  });
41
- if (this.resourceName) {
42
- const initOK = yield this.datasource.init({
43
- resourceName: this.resourceName,
44
- }, true);
45
- if (!initOK) {
46
- logger.debug(`Genesis Datasource init failed for ${this.resourceName}`);
47
- return;
40
+ this.connectionSub = this.connect.isConnected$.subscribe((isConnected) => __awaiter(this, void 0, void 0, function* () {
41
+ if (isConnected) {
42
+ yield this.handleReconnection();
48
43
  }
49
- this.dataSub = (_a = this.datasource.stream) === null || _a === void 0 ? void 0 : _a.subscribe((result) => {
50
- if (result.ROW && result.SEQUENCE_ID > 1) {
51
- this.handleStreamUpdate(dataServerResultFilter(result));
52
- }
53
- });
44
+ }));
45
+ });
46
+ }
47
+ /**
48
+ * Handles reconnection logic when the connection is established
49
+ * @private
50
+ */
51
+ handleReconnection() {
52
+ return __awaiter(this, void 0, void 0, function* () {
53
+ if (!this.resourceName) {
54
+ return;
55
+ }
56
+ yield this.initializeDatasource();
57
+ this.setupDataSubscription();
58
+ });
59
+ }
60
+ /**
61
+ * Initializes the datasource for the notification resource
62
+ * @private
63
+ */
64
+ initializeDatasource() {
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ var _a;
67
+ if ((_a = this.datasource) === null || _a === void 0 ? void 0 : _a.initialized) {
68
+ this.datasource.destroy();
69
+ }
70
+ const initOK = yield this.datasource.init({ resourceName: this.resourceName }, true);
71
+ if (!initOK) {
72
+ throw new Error(`Failed to initialize datasource for ${this.resourceName}`);
73
+ }
74
+ });
75
+ }
76
+ /**
77
+ * Sets up the data subscription to handle incoming notifications
78
+ * @private
79
+ */
80
+ setupDataSubscription() {
81
+ if (!this.datasource.stream) {
82
+ logger.warn(`No stream available for ${this.resourceName}`);
83
+ return;
84
+ }
85
+ this.dataSub = this.datasource.stream.subscribe((result) => {
86
+ if (result.ROW && result.SEQUENCE_ID > 1) {
87
+ this.handleStreamUpdate(dataServerResultFilter(result));
54
88
  }
55
89
  });
56
90
  }
57
91
  disconnectedCallback() {
58
- var _a, _b;
92
+ var _a, _b, _c;
59
93
  super.disconnectedCallback();
60
94
  /**
61
95
  * Attempt to clean up after ourselves.
62
96
  */
63
97
  (_a = this.dataSub) === null || _a === void 0 ? void 0 : _a.unsubscribe();
64
98
  delete this.dataSub;
65
- (_b = this.datasource) === null || _b === void 0 ? void 0 : _b.destroy();
99
+ (_b = this.connectionSub) === null || _b === void 0 ? void 0 : _b.unsubscribe();
100
+ delete this.connectionSub;
101
+ (_c = this.datasource) === null || _c === void 0 ? void 0 : _c.destroy();
66
102
  delete this.datasource;
67
103
  }
68
104
  handleStreamUpdate(dataServerResult) {
@@ -99,6 +135,9 @@ export class NotificationListener extends FoundationElement {
99
135
  __decorate([
100
136
  observable
101
137
  ], NotificationListener.prototype, "notificationListener", void 0);
138
+ __decorate([
139
+ Connect
140
+ ], NotificationListener.prototype, "connect", void 0);
102
141
  __decorate([
103
142
  attr({ attribute: 'resource-name' })
104
143
  ], NotificationListener.prototype, "resourceName", void 0);
@@ -2,3 +2,4 @@ export * from './base-datasource';
2
2
  export * from './dom';
3
3
  export * from './logger';
4
4
  export * from './options-datasource-utils';
5
+ export * from './shortcut-manager';
@@ -0,0 +1,2 @@
1
+ export * from './shortcut-manager';
2
+ export * from './shortcut-listener';
@@ -0,0 +1,99 @@
1
+ import { __decorate } from "tslib";
2
+ import { customElement, FASTElement } from '@microsoft/fast-element';
3
+ import { inject } from '@microsoft/fast-foundation';
4
+ import { ShortcutManager } from './shortcut-manager';
5
+ let FoundationShortcutListener = class FoundationShortcutListener extends FASTElement {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.keyListener = null;
9
+ this.isListening = false;
10
+ }
11
+ connectedCallback() {
12
+ super.connectedCallback();
13
+ this.setupStateSubscription();
14
+ }
15
+ disconnectedCallback() {
16
+ super.disconnectedCallback();
17
+ this.cleanupStateSubscription();
18
+ this.removeKeyListener();
19
+ }
20
+ setupStateSubscription() {
21
+ // Subscribe to the pause state changes
22
+ this.shortcutManager.isPaused$.subscribe((isPaused) => {
23
+ if (isPaused) {
24
+ this.removeKeyListener();
25
+ }
26
+ else {
27
+ this.addKeyListener();
28
+ }
29
+ });
30
+ // Set initial state
31
+ if (!this.shortcutManager.isPaused) {
32
+ this.addKeyListener();
33
+ }
34
+ }
35
+ cleanupStateSubscription() {
36
+ // The subscription will be automatically cleaned up when the component is destroyed
37
+ // since we're using the service's observable
38
+ }
39
+ addKeyListener() {
40
+ if (this.isListening)
41
+ return;
42
+ this.keyListener = this.handleKeyDown.bind(this);
43
+ document.addEventListener('keydown', this.keyListener);
44
+ this.isListening = true;
45
+ }
46
+ removeKeyListener() {
47
+ if (!this.isListening || !this.keyListener)
48
+ return;
49
+ document.removeEventListener('keydown', this.keyListener);
50
+ this.keyListener = null;
51
+ this.isListening = false;
52
+ }
53
+ handleKeyDown(event) {
54
+ // Don't handle shortcuts if the service is paused
55
+ if (this.shortcutManager.isPaused) {
56
+ return;
57
+ }
58
+ // Don't handle shortcuts if user is typing in an input field
59
+ if (this.isInputElement(event.target)) {
60
+ return;
61
+ }
62
+ // Use event.code instead of event.key to avoid Alt key character modifications
63
+ const key = event.code.replace('Key', '').toLowerCase();
64
+ const shortcut = this.shortcutManager.findShortcutByKeyCombination(key, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey);
65
+ if (shortcut) {
66
+ event.preventDefault();
67
+ event.stopPropagation();
68
+ this.shortcutManager.executeShortcut(shortcut.id);
69
+ }
70
+ }
71
+ isInputElement(element) {
72
+ if (!element)
73
+ return false;
74
+ const inputTypes = ['input', 'textarea', 'select'];
75
+ const tagName = element.tagName.toLowerCase();
76
+ if (inputTypes.includes(tagName)) {
77
+ return true;
78
+ }
79
+ // Check for contenteditable
80
+ if (element.contentEditable === 'true') {
81
+ return true;
82
+ }
83
+ // Check for role="textbox" or similar
84
+ const role = element.getAttribute('role');
85
+ if (role && ['textbox', 'searchbox', 'combobox'].includes(role)) {
86
+ return true;
87
+ }
88
+ return false;
89
+ }
90
+ };
91
+ __decorate([
92
+ inject(ShortcutManager)
93
+ ], FoundationShortcutListener.prototype, "shortcutManager", void 0);
94
+ FoundationShortcutListener = __decorate([
95
+ customElement({
96
+ name: 'foundation-shortcut-listener',
97
+ })
98
+ ], FoundationShortcutListener);
99
+ export { FoundationShortcutListener };
@@ -0,0 +1,138 @@
1
+ import { DI } from '@microsoft/fast-foundation';
2
+ import { BehaviorSubject } from 'rxjs';
3
+ export class DefaultShortcutManager {
4
+ constructor() {
5
+ this.shortcuts = new Map();
6
+ this.keyCombinationMap = new Map(); // key combination -> shortcut id
7
+ this._isPausedSubject = new BehaviorSubject(false);
8
+ }
9
+ get isPaused() {
10
+ return this._isPausedSubject.value;
11
+ }
12
+ get isPaused$() {
13
+ return this._isPausedSubject.asObservable();
14
+ }
15
+ get isPausedSubject() {
16
+ return this._isPausedSubject;
17
+ }
18
+ registerShortcuts(shortcuts) {
19
+ shortcuts.forEach((shortcut) => {
20
+ this.registerShortcut(shortcut);
21
+ });
22
+ }
23
+ registerShortcut(shortcut) {
24
+ // Check if there's already a shortcut with the same key combination
25
+ const keyCombo = this.createKeyCombinationKey(shortcut.key, shortcut.ctrlKey, shortcut.altKey, shortcut.shiftKey, shortcut.metaKey);
26
+ const existingShortcutId = this.keyCombinationMap.get(keyCombo);
27
+ if (existingShortcutId) {
28
+ this.shortcuts.delete(existingShortcutId);
29
+ }
30
+ // Register the new shortcut
31
+ this.shortcuts.set(shortcut.id, shortcut);
32
+ this.keyCombinationMap.set(keyCombo, shortcut.id);
33
+ return {
34
+ shortcut,
35
+ id: shortcut.id,
36
+ keyCombination: keyCombo,
37
+ // Functions that can be directly used in AG Grid menu items
38
+ disabled: () => {
39
+ if (this.isPaused)
40
+ return true;
41
+ if (shortcut.canExecute) {
42
+ const status = shortcut.canExecute();
43
+ return status.disabled || false;
44
+ }
45
+ return false;
46
+ },
47
+ tooltip: () => {
48
+ if (this.isPaused)
49
+ return 'Shortcuts are paused';
50
+ if (shortcut.canExecute) {
51
+ const status = shortcut.canExecute();
52
+ return status.tooltip;
53
+ }
54
+ return undefined;
55
+ },
56
+ };
57
+ }
58
+ unregisterShortcut(id) {
59
+ const shortcut = this.shortcuts.get(id);
60
+ if (shortcut) {
61
+ const keyCombo = this.createKeyCombinationKey(shortcut.key, shortcut.ctrlKey, shortcut.altKey, shortcut.shiftKey, shortcut.metaKey);
62
+ this.shortcuts.delete(id);
63
+ this.keyCombinationMap.delete(keyCombo);
64
+ }
65
+ }
66
+ unregisterShortcutsByContext(context) {
67
+ const shortcutsToRemove = [];
68
+ for (const [id, shortcut] of this.shortcuts) {
69
+ if (shortcut.context === context) {
70
+ shortcutsToRemove.push(id);
71
+ }
72
+ }
73
+ shortcutsToRemove.forEach((id) => this.unregisterShortcut(id));
74
+ }
75
+ executeShortcut(id) {
76
+ if (this.isPaused) {
77
+ return; // Don't execute shortcuts when paused
78
+ }
79
+ const shortcut = this.shortcuts.get(id);
80
+ if (shortcut) {
81
+ // Check if shortcut requires a specific element to be focused
82
+ if (shortcut.elementRef && !this.isElementFocused(shortcut.elementRef)) {
83
+ return; // Don't execute if the required element is not focused
84
+ }
85
+ // Check if shortcut can be executed
86
+ if (shortcut.canExecute) {
87
+ const executionStatus = shortcut.canExecute();
88
+ if (executionStatus.disabled) {
89
+ return; // Don't execute if disabled
90
+ }
91
+ }
92
+ try {
93
+ shortcut.action();
94
+ }
95
+ catch (error) {
96
+ console.error(`Error executing shortcut ${id}:`, error);
97
+ }
98
+ }
99
+ }
100
+ getShortcuts() {
101
+ return Array.from(this.shortcuts.values());
102
+ }
103
+ getShortcutsByContext(context) {
104
+ return Array.from(this.shortcuts.values()).filter((shortcut) => shortcut.context === context);
105
+ }
106
+ findShortcutByKeyCombination(key, ctrlKey = false, altKey = false, shiftKey = false, metaKey = false) {
107
+ const keyCombo = this.createKeyCombinationKey(key, ctrlKey, altKey, shiftKey, metaKey);
108
+ const shortcutId = this.keyCombinationMap.get(keyCombo);
109
+ return shortcutId ? this.shortcuts.get(shortcutId) : undefined;
110
+ }
111
+ pause() {
112
+ this._isPausedSubject.next(true);
113
+ }
114
+ resume() {
115
+ this._isPausedSubject.next(false);
116
+ }
117
+ createKeyCombinationKey(key, ctrlKey = false, altKey = false, shiftKey = false, metaKey = false) {
118
+ const modifiers = [];
119
+ if (ctrlKey)
120
+ modifiers.push('ctrl');
121
+ if (altKey)
122
+ modifiers.push('alt');
123
+ if (shiftKey)
124
+ modifiers.push('shift');
125
+ if (metaKey)
126
+ modifiers.push('meta');
127
+ // Don't sort modifiers - preserve order for consistent key detection
128
+ return `${modifiers.join('+')}:${key}`.toLowerCase();
129
+ }
130
+ isElementFocused(element) {
131
+ if (element instanceof HTMLElement) {
132
+ return document.activeElement === element;
133
+ }
134
+ return false;
135
+ }
136
+ }
137
+ // DI registration
138
+ export const ShortcutManager = DI.createInterface((x) => x.singleton(DefaultShortcutManager));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/foundation-ui",
3
3
  "description": "Genesis Foundation UI",
4
- "version": "14.310.0",
4
+ "version": "14.310.2-alpha-8853fb3.0",
5
5
  "sideEffects": false,
6
6
  "license": "SEE LICENSE IN license.txt",
7
7
  "main": "dist/esm/index.js",
@@ -83,13 +83,13 @@
83
83
  }
84
84
  },
85
85
  "devDependencies": {
86
- "@genesislcap/foundation-testing": "14.310.0",
87
- "@genesislcap/genx": "14.310.0",
88
- "@genesislcap/rollup-builder": "14.310.0",
89
- "@genesislcap/ts-builder": "14.310.0",
90
- "@genesislcap/uvu-playwright-builder": "14.310.0",
91
- "@genesislcap/vite-builder": "14.310.0",
92
- "@genesislcap/webpack-builder": "14.310.0",
86
+ "@genesislcap/foundation-testing": "14.310.2-alpha-8853fb3.0",
87
+ "@genesislcap/genx": "14.310.2-alpha-8853fb3.0",
88
+ "@genesislcap/rollup-builder": "14.310.2-alpha-8853fb3.0",
89
+ "@genesislcap/ts-builder": "14.310.2-alpha-8853fb3.0",
90
+ "@genesislcap/uvu-playwright-builder": "14.310.2-alpha-8853fb3.0",
91
+ "@genesislcap/vite-builder": "14.310.2-alpha-8853fb3.0",
92
+ "@genesislcap/webpack-builder": "14.310.2-alpha-8853fb3.0",
93
93
  "copyfiles": "^2.4.1",
94
94
  "rxjs": "^7.5.4"
95
95
  },
@@ -99,15 +99,15 @@
99
99
  "@fortawesome/free-regular-svg-icons": "^6.2.1",
100
100
  "@fortawesome/free-solid-svg-icons": "^6.2.1",
101
101
  "@genesiscommunitysuccess/analyzer-import-alias-plugin": "^5.0.3",
102
- "@genesislcap/expression-builder": "14.310.0",
103
- "@genesislcap/foundation-comms": "14.310.0",
104
- "@genesislcap/foundation-criteria": "14.310.0",
105
- "@genesislcap/foundation-errors": "14.310.0",
106
- "@genesislcap/foundation-events": "14.310.0",
107
- "@genesislcap/foundation-logger": "14.310.0",
108
- "@genesislcap/foundation-notifications": "14.310.0",
109
- "@genesislcap/foundation-user": "14.310.0",
110
- "@genesislcap/foundation-utils": "14.310.0",
102
+ "@genesislcap/expression-builder": "14.310.2-alpha-8853fb3.0",
103
+ "@genesislcap/foundation-comms": "14.310.2-alpha-8853fb3.0",
104
+ "@genesislcap/foundation-criteria": "14.310.2-alpha-8853fb3.0",
105
+ "@genesislcap/foundation-errors": "14.310.2-alpha-8853fb3.0",
106
+ "@genesislcap/foundation-events": "14.310.2-alpha-8853fb3.0",
107
+ "@genesislcap/foundation-logger": "14.310.2-alpha-8853fb3.0",
108
+ "@genesislcap/foundation-notifications": "14.310.2-alpha-8853fb3.0",
109
+ "@genesislcap/foundation-user": "14.310.2-alpha-8853fb3.0",
110
+ "@genesislcap/foundation-utils": "14.310.2-alpha-8853fb3.0",
111
111
  "@microsoft/fast-colors": "5.3.1",
112
112
  "@microsoft/fast-components": "2.30.6",
113
113
  "@microsoft/fast-element": "1.14.0",
@@ -128,5 +128,5 @@
128
128
  "access": "public"
129
129
  },
130
130
  "customElements": "dist/custom-elements.json",
131
- "gitHead": "3a67b9c5ee9c251945d5fe8121cb797d6aec37f3"
131
+ "gitHead": "463314432383d893be3c9fc153efa77e9d9c8993"
132
132
  }