@genesislcap/foundation-utils 14.421.1 → 14.422.1-alpha-6f2ae99.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.
- package/dist/custom-elements.json +229 -55
- package/dist/dts/shortcut-manager/shortcut-listener.d.ts +6 -0
- package/dist/dts/shortcut-manager/shortcut-listener.d.ts.map +1 -1
- package/dist/dts/shortcut-manager/shortcut-manager.d.ts +13 -0
- package/dist/dts/shortcut-manager/shortcut-manager.d.ts.map +1 -1
- package/dist/esm/shortcut-manager/shortcut-listener.js +80 -12
- package/dist/esm/shortcut-manager/shortcut-manager.js +40 -19
- package/dist/foundation-utils.api.json +295 -0
- package/dist/foundation-utils.d.ts +19 -0
- package/package.json +11 -11
|
@@ -250,6 +250,59 @@
|
|
|
250
250
|
}
|
|
251
251
|
]
|
|
252
252
|
},
|
|
253
|
+
{
|
|
254
|
+
"kind": "javascript-module",
|
|
255
|
+
"path": "src/decorators/index.ts",
|
|
256
|
+
"declarations": [],
|
|
257
|
+
"exports": [
|
|
258
|
+
{
|
|
259
|
+
"kind": "js",
|
|
260
|
+
"name": "*",
|
|
261
|
+
"declaration": {
|
|
262
|
+
"name": "*",
|
|
263
|
+
"package": "./renderOnChange"
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"kind": "javascript-module",
|
|
270
|
+
"path": "src/decorators/renderOnChange.ts",
|
|
271
|
+
"declarations": [
|
|
272
|
+
{
|
|
273
|
+
"kind": "function",
|
|
274
|
+
"name": "renderOnChange",
|
|
275
|
+
"parameters": [
|
|
276
|
+
{
|
|
277
|
+
"name": "target",
|
|
278
|
+
"type": {
|
|
279
|
+
"text": "FASTElement & { render(): void }"
|
|
280
|
+
},
|
|
281
|
+
"description": "The target to define the property change handler on."
|
|
282
|
+
},
|
|
283
|
+
{
|
|
284
|
+
"name": "name",
|
|
285
|
+
"type": {
|
|
286
|
+
"text": "string"
|
|
287
|
+
},
|
|
288
|
+
"description": "The property name."
|
|
289
|
+
}
|
|
290
|
+
],
|
|
291
|
+
"description": "Defines a property changed handler that calls a render() method on the target as an internal observation enhancement.",
|
|
292
|
+
"privacy": "public"
|
|
293
|
+
}
|
|
294
|
+
],
|
|
295
|
+
"exports": [
|
|
296
|
+
{
|
|
297
|
+
"kind": "js",
|
|
298
|
+
"name": "renderOnChange",
|
|
299
|
+
"declaration": {
|
|
300
|
+
"name": "renderOnChange",
|
|
301
|
+
"module": "src/decorators/renderOnChange.ts"
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
]
|
|
305
|
+
},
|
|
253
306
|
{
|
|
254
307
|
"kind": "javascript-module",
|
|
255
308
|
"path": "src/data/inMemoryDatabase.ts",
|
|
@@ -591,21 +644,6 @@
|
|
|
591
644
|
}
|
|
592
645
|
]
|
|
593
646
|
},
|
|
594
|
-
{
|
|
595
|
-
"kind": "javascript-module",
|
|
596
|
-
"path": "src/encoding/index.ts",
|
|
597
|
-
"declarations": [],
|
|
598
|
-
"exports": [
|
|
599
|
-
{
|
|
600
|
-
"kind": "js",
|
|
601
|
-
"name": "*",
|
|
602
|
-
"declaration": {
|
|
603
|
-
"name": "*",
|
|
604
|
-
"package": "./base64"
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
]
|
|
608
|
-
},
|
|
609
647
|
{
|
|
610
648
|
"kind": "javascript-module",
|
|
611
649
|
"path": "src/env/index.ts",
|
|
@@ -1083,7 +1121,7 @@
|
|
|
1083
1121
|
},
|
|
1084
1122
|
{
|
|
1085
1123
|
"kind": "javascript-module",
|
|
1086
|
-
"path": "src/
|
|
1124
|
+
"path": "src/encoding/index.ts",
|
|
1087
1125
|
"declarations": [],
|
|
1088
1126
|
"exports": [
|
|
1089
1127
|
{
|
|
@@ -1091,45 +1129,7 @@
|
|
|
1091
1129
|
"name": "*",
|
|
1092
1130
|
"declaration": {
|
|
1093
1131
|
"name": "*",
|
|
1094
|
-
"package": "./
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
]
|
|
1098
|
-
},
|
|
1099
|
-
{
|
|
1100
|
-
"kind": "javascript-module",
|
|
1101
|
-
"path": "src/decorators/renderOnChange.ts",
|
|
1102
|
-
"declarations": [
|
|
1103
|
-
{
|
|
1104
|
-
"kind": "function",
|
|
1105
|
-
"name": "renderOnChange",
|
|
1106
|
-
"parameters": [
|
|
1107
|
-
{
|
|
1108
|
-
"name": "target",
|
|
1109
|
-
"type": {
|
|
1110
|
-
"text": "FASTElement & { render(): void }"
|
|
1111
|
-
},
|
|
1112
|
-
"description": "The target to define the property change handler on."
|
|
1113
|
-
},
|
|
1114
|
-
{
|
|
1115
|
-
"name": "name",
|
|
1116
|
-
"type": {
|
|
1117
|
-
"text": "string"
|
|
1118
|
-
},
|
|
1119
|
-
"description": "The property name."
|
|
1120
|
-
}
|
|
1121
|
-
],
|
|
1122
|
-
"description": "Defines a property changed handler that calls a render() method on the target as an internal observation enhancement.",
|
|
1123
|
-
"privacy": "public"
|
|
1124
|
-
}
|
|
1125
|
-
],
|
|
1126
|
-
"exports": [
|
|
1127
|
-
{
|
|
1128
|
-
"kind": "js",
|
|
1129
|
-
"name": "renderOnChange",
|
|
1130
|
-
"declaration": {
|
|
1131
|
-
"name": "renderOnChange",
|
|
1132
|
-
"module": "src/decorators/renderOnChange.ts"
|
|
1132
|
+
"package": "./base64"
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
1135
|
]
|
|
@@ -2790,6 +2790,15 @@
|
|
|
2790
2790
|
"privacy": "private",
|
|
2791
2791
|
"default": "null"
|
|
2792
2792
|
},
|
|
2793
|
+
{
|
|
2794
|
+
"kind": "field",
|
|
2795
|
+
"name": "stateSubscription",
|
|
2796
|
+
"type": {
|
|
2797
|
+
"text": "Subscription | null"
|
|
2798
|
+
},
|
|
2799
|
+
"privacy": "private",
|
|
2800
|
+
"default": "null"
|
|
2801
|
+
},
|
|
2793
2802
|
{
|
|
2794
2803
|
"kind": "field",
|
|
2795
2804
|
"name": "isListening",
|
|
@@ -2827,6 +2836,42 @@
|
|
|
2827
2836
|
}
|
|
2828
2837
|
]
|
|
2829
2838
|
},
|
|
2839
|
+
{
|
|
2840
|
+
"kind": "method",
|
|
2841
|
+
"name": "resolveShortcutManager",
|
|
2842
|
+
"privacy": "private",
|
|
2843
|
+
"return": {
|
|
2844
|
+
"type": {
|
|
2845
|
+
"text": "ShortcutManager"
|
|
2846
|
+
}
|
|
2847
|
+
},
|
|
2848
|
+
"parameters": [
|
|
2849
|
+
{
|
|
2850
|
+
"name": "event",
|
|
2851
|
+
"type": {
|
|
2852
|
+
"text": "KeyboardEvent"
|
|
2853
|
+
}
|
|
2854
|
+
}
|
|
2855
|
+
]
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
"kind": "method",
|
|
2859
|
+
"name": "isShortcutManager",
|
|
2860
|
+
"privacy": "private",
|
|
2861
|
+
"return": {
|
|
2862
|
+
"type": {
|
|
2863
|
+
"text": "candidate is ShortcutManager"
|
|
2864
|
+
}
|
|
2865
|
+
},
|
|
2866
|
+
"parameters": [
|
|
2867
|
+
{
|
|
2868
|
+
"name": "candidate",
|
|
2869
|
+
"type": {
|
|
2870
|
+
"text": "unknown"
|
|
2871
|
+
}
|
|
2872
|
+
}
|
|
2873
|
+
]
|
|
2874
|
+
},
|
|
2830
2875
|
{
|
|
2831
2876
|
"kind": "method",
|
|
2832
2877
|
"name": "extractKeyFromCode",
|
|
@@ -2845,6 +2890,52 @@
|
|
|
2845
2890
|
}
|
|
2846
2891
|
]
|
|
2847
2892
|
},
|
|
2893
|
+
{
|
|
2894
|
+
"kind": "method",
|
|
2895
|
+
"name": "getDeepActiveElement",
|
|
2896
|
+
"privacy": "private",
|
|
2897
|
+
"return": {
|
|
2898
|
+
"type": {
|
|
2899
|
+
"text": "Element | null"
|
|
2900
|
+
}
|
|
2901
|
+
}
|
|
2902
|
+
},
|
|
2903
|
+
{
|
|
2904
|
+
"kind": "method",
|
|
2905
|
+
"name": "getEventElement",
|
|
2906
|
+
"privacy": "private",
|
|
2907
|
+
"return": {
|
|
2908
|
+
"type": {
|
|
2909
|
+
"text": "Element | null"
|
|
2910
|
+
}
|
|
2911
|
+
},
|
|
2912
|
+
"parameters": [
|
|
2913
|
+
{
|
|
2914
|
+
"name": "event",
|
|
2915
|
+
"type": {
|
|
2916
|
+
"text": "KeyboardEvent"
|
|
2917
|
+
}
|
|
2918
|
+
}
|
|
2919
|
+
]
|
|
2920
|
+
},
|
|
2921
|
+
{
|
|
2922
|
+
"kind": "method",
|
|
2923
|
+
"name": "isEditableContext",
|
|
2924
|
+
"privacy": "private",
|
|
2925
|
+
"return": {
|
|
2926
|
+
"type": {
|
|
2927
|
+
"text": "boolean"
|
|
2928
|
+
}
|
|
2929
|
+
},
|
|
2930
|
+
"parameters": [
|
|
2931
|
+
{
|
|
2932
|
+
"name": "event",
|
|
2933
|
+
"type": {
|
|
2934
|
+
"text": "KeyboardEvent"
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
]
|
|
2938
|
+
},
|
|
2848
2939
|
{
|
|
2849
2940
|
"kind": "method",
|
|
2850
2941
|
"name": "isInputElement",
|
|
@@ -2932,6 +3023,12 @@
|
|
|
2932
3023
|
},
|
|
2933
3024
|
"privacy": "private"
|
|
2934
3025
|
},
|
|
3026
|
+
{
|
|
3027
|
+
"kind": "field",
|
|
3028
|
+
"name": "executionGuards",
|
|
3029
|
+
"privacy": "private",
|
|
3030
|
+
"default": "new Map<string, () => ShortcutExecutionStatus | boolean>()"
|
|
3031
|
+
},
|
|
2935
3032
|
{
|
|
2936
3033
|
"kind": "field",
|
|
2937
3034
|
"name": "isPaused",
|
|
@@ -3199,6 +3296,55 @@
|
|
|
3199
3296
|
}
|
|
3200
3297
|
}
|
|
3201
3298
|
},
|
|
3299
|
+
{
|
|
3300
|
+
"kind": "method",
|
|
3301
|
+
"name": "registerExecutionGuard",
|
|
3302
|
+
"return": {
|
|
3303
|
+
"type": {
|
|
3304
|
+
"text": "void"
|
|
3305
|
+
}
|
|
3306
|
+
},
|
|
3307
|
+
"parameters": [
|
|
3308
|
+
{
|
|
3309
|
+
"name": "id",
|
|
3310
|
+
"type": {
|
|
3311
|
+
"text": "string"
|
|
3312
|
+
}
|
|
3313
|
+
},
|
|
3314
|
+
{
|
|
3315
|
+
"name": "guard",
|
|
3316
|
+
"type": {
|
|
3317
|
+
"text": "() => ShortcutExecutionStatus | boolean"
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
]
|
|
3321
|
+
},
|
|
3322
|
+
{
|
|
3323
|
+
"kind": "method",
|
|
3324
|
+
"name": "unregisterExecutionGuard",
|
|
3325
|
+
"return": {
|
|
3326
|
+
"type": {
|
|
3327
|
+
"text": "void"
|
|
3328
|
+
}
|
|
3329
|
+
},
|
|
3330
|
+
"parameters": [
|
|
3331
|
+
{
|
|
3332
|
+
"name": "id",
|
|
3333
|
+
"type": {
|
|
3334
|
+
"text": "string"
|
|
3335
|
+
}
|
|
3336
|
+
}
|
|
3337
|
+
]
|
|
3338
|
+
},
|
|
3339
|
+
{
|
|
3340
|
+
"kind": "method",
|
|
3341
|
+
"name": "clearExecutionGuards",
|
|
3342
|
+
"return": {
|
|
3343
|
+
"type": {
|
|
3344
|
+
"text": "void"
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
},
|
|
3202
3348
|
{
|
|
3203
3349
|
"kind": "method",
|
|
3204
3350
|
"name": "pause",
|
|
@@ -3287,6 +3433,34 @@
|
|
|
3287
3433
|
}
|
|
3288
3434
|
}
|
|
3289
3435
|
]
|
|
3436
|
+
},
|
|
3437
|
+
{
|
|
3438
|
+
"kind": "method",
|
|
3439
|
+
"name": "getExecutionStatus",
|
|
3440
|
+
"privacy": "private",
|
|
3441
|
+
"return": {
|
|
3442
|
+
"type": {
|
|
3443
|
+
"text": "ShortcutExecutionStatus"
|
|
3444
|
+
}
|
|
3445
|
+
},
|
|
3446
|
+
"parameters": [
|
|
3447
|
+
{
|
|
3448
|
+
"name": "shortcut",
|
|
3449
|
+
"type": {
|
|
3450
|
+
"text": "ShortcutDefinition"
|
|
3451
|
+
}
|
|
3452
|
+
}
|
|
3453
|
+
]
|
|
3454
|
+
},
|
|
3455
|
+
{
|
|
3456
|
+
"kind": "method",
|
|
3457
|
+
"name": "getExecutionGuardStatus",
|
|
3458
|
+
"privacy": "private",
|
|
3459
|
+
"return": {
|
|
3460
|
+
"type": {
|
|
3461
|
+
"text": "ShortcutExecutionStatus"
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3290
3464
|
}
|
|
3291
3465
|
]
|
|
3292
3466
|
},
|
|
@@ -8,6 +8,7 @@ import { ShortcutManager } from './shortcut-manager';
|
|
|
8
8
|
export declare class FoundationShortcutListener extends FASTElement {
|
|
9
9
|
shortcutManager: ShortcutManager;
|
|
10
10
|
private keyListener;
|
|
11
|
+
private stateSubscription;
|
|
11
12
|
private isListening;
|
|
12
13
|
connectedCallback(): void;
|
|
13
14
|
disconnectedCallback(): void;
|
|
@@ -15,7 +16,12 @@ export declare class FoundationShortcutListener extends FASTElement {
|
|
|
15
16
|
private addKeyListener;
|
|
16
17
|
private removeKeyListener;
|
|
17
18
|
private handleKeyDown;
|
|
19
|
+
private resolveShortcutManager;
|
|
20
|
+
private isShortcutManager;
|
|
18
21
|
private extractKeyFromCode;
|
|
22
|
+
private getDeepActiveElement;
|
|
23
|
+
private getEventElement;
|
|
24
|
+
private isEditableContext;
|
|
19
25
|
private isInputElement;
|
|
20
26
|
}
|
|
21
27
|
//# sourceMappingURL=shortcut-listener.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortcut-listener.d.ts","sourceRoot":"","sources":["../../../src/shortcut-manager/shortcut-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"shortcut-listener.d.ts","sourceRoot":"","sources":["../../../src/shortcut-manager/shortcut-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;GAIG;AACH,qBAGa,0BAA2B,SAAQ,WAAW;IAChC,eAAe,EAAE,eAAe,CAAC;IAE1D,OAAO,CAAC,WAAW,CAAiD;IACpE,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,WAAW,CAAS;IAE5B,iBAAiB;IAKjB,oBAAoB;IAOpB,OAAO,CAAC,sBAAsB;IAiB9B,OAAO,CAAC,cAAc;IAQtB,OAAO,CAAC,iBAAiB;IAQzB,OAAO,CAAC,aAAa;IA+BrB,OAAO,CAAC,sBAAsB;IAiB9B,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,kBAAkB;IA6C1B,OAAO,CAAC,oBAAoB;IAQ5B,OAAO,CAAC,eAAe;IAMvB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,cAAc;CA4CvB"}
|
|
@@ -73,6 +73,13 @@ export interface ShortcutManager {
|
|
|
73
73
|
isPaused: boolean;
|
|
74
74
|
isPaused$: Observable<boolean>;
|
|
75
75
|
isPausedSubject: BehaviorSubject<boolean>;
|
|
76
|
+
/**
|
|
77
|
+
* Register a global execution guard.
|
|
78
|
+
* @remarks Guards are evaluated before shortcut-specific canExecute checks.
|
|
79
|
+
*/
|
|
80
|
+
registerExecutionGuard(id: string, guard: () => ShortcutExecutionStatus | boolean): void;
|
|
81
|
+
unregisterExecutionGuard(id: string): void;
|
|
82
|
+
clearExecutionGuards(): void;
|
|
76
83
|
}
|
|
77
84
|
/**
|
|
78
85
|
* Default implementation of the ShortcutManager interface
|
|
@@ -84,6 +91,7 @@ export declare class DefaultShortcutManager implements ShortcutManager {
|
|
|
84
91
|
private keyCombinationMap;
|
|
85
92
|
private _isPausedSubject;
|
|
86
93
|
private _activeContext;
|
|
94
|
+
private executionGuards;
|
|
87
95
|
get isPaused(): boolean;
|
|
88
96
|
get isPaused$(): Observable<boolean>;
|
|
89
97
|
get isPausedSubject(): BehaviorSubject<boolean>;
|
|
@@ -102,6 +110,9 @@ export declare class DefaultShortcutManager implements ShortcutManager {
|
|
|
102
110
|
setActiveContext(context: string): void;
|
|
103
111
|
getActiveContext(): string | undefined;
|
|
104
112
|
clearActiveContext(): void;
|
|
113
|
+
registerExecutionGuard(id: string, guard: () => ShortcutExecutionStatus | boolean): void;
|
|
114
|
+
unregisterExecutionGuard(id: string): void;
|
|
115
|
+
clearExecutionGuards(): void;
|
|
105
116
|
pause(): void;
|
|
106
117
|
resume(): void;
|
|
107
118
|
/**
|
|
@@ -111,6 +122,8 @@ export declare class DefaultShortcutManager implements ShortcutManager {
|
|
|
111
122
|
private normalizeShortcutDefinition;
|
|
112
123
|
private createKeyCombinationKey;
|
|
113
124
|
private isElementFocused;
|
|
125
|
+
private getExecutionStatus;
|
|
126
|
+
private getExecutionGuardStatus;
|
|
114
127
|
}
|
|
115
128
|
/**
|
|
116
129
|
* A dependency injection token for the ShortcutManager interface.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shortcut-manager.d.ts","sourceRoot":"","sources":["../../../src/shortcut-manager/shortcut-manager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAInD;;;KAGK;AACL,MAAM,MAAM,uBAAuB,GAAG;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,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,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,C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
12
12
|
super(...arguments);
|
|
13
13
|
this.keyListener = null;
|
|
14
|
+
this.stateSubscription = null;
|
|
14
15
|
this.isListening = false;
|
|
15
16
|
}
|
|
16
17
|
connectedCallback() {
|
|
@@ -18,12 +19,17 @@ let FoundationShortcutListener = class FoundationShortcutListener extends FASTEl
|
|
|
18
19
|
this.setupStateSubscription();
|
|
19
20
|
}
|
|
20
21
|
disconnectedCallback() {
|
|
22
|
+
var _a;
|
|
21
23
|
super.disconnectedCallback();
|
|
24
|
+
(_a = this.stateSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
25
|
+
this.stateSubscription = null;
|
|
22
26
|
this.removeKeyListener();
|
|
23
27
|
}
|
|
24
28
|
setupStateSubscription() {
|
|
29
|
+
var _a;
|
|
25
30
|
// Subscribe to the pause state changes
|
|
26
|
-
this.
|
|
31
|
+
(_a = this.stateSubscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
|
|
32
|
+
this.stateSubscription = this.shortcutManager.isPaused$.subscribe((isPaused) => {
|
|
27
33
|
if (isPaused) {
|
|
28
34
|
this.removeKeyListener();
|
|
29
35
|
}
|
|
@@ -51,23 +57,45 @@ let FoundationShortcutListener = class FoundationShortcutListener extends FASTEl
|
|
|
51
57
|
this.isListening = false;
|
|
52
58
|
}
|
|
53
59
|
handleKeyDown(event) {
|
|
60
|
+
const manager = this.resolveShortcutManager(event);
|
|
54
61
|
// Don't handle shortcuts if the service is paused
|
|
55
|
-
if (
|
|
62
|
+
if (manager.isPaused) {
|
|
56
63
|
return;
|
|
57
64
|
}
|
|
58
|
-
// Don't handle shortcuts
|
|
59
|
-
if (this.
|
|
65
|
+
// Don't handle shortcuts while user is typing in editable fields.
|
|
66
|
+
if (this.isEditableContext(event)) {
|
|
60
67
|
return;
|
|
61
68
|
}
|
|
62
69
|
// Extract key from event.code with proper mapping for all key types
|
|
63
70
|
const key = this.extractKeyFromCode(event.code);
|
|
64
|
-
const shortcut =
|
|
71
|
+
const shortcut = manager.findShortcutByKeyCombination(key, event.ctrlKey, event.altKey, event.shiftKey, event.metaKey);
|
|
65
72
|
if (shortcut) {
|
|
66
73
|
event.preventDefault();
|
|
67
74
|
event.stopPropagation();
|
|
68
|
-
|
|
75
|
+
manager.executeShortcut(shortcut.id);
|
|
69
76
|
}
|
|
70
77
|
}
|
|
78
|
+
resolveShortcutManager(event) {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
const injectedManager = this.shortcutManager;
|
|
81
|
+
if ((_a = injectedManager.getShortcuts) === null || _a === void 0 ? void 0 : _a.call(injectedManager).length) {
|
|
82
|
+
return injectedManager;
|
|
83
|
+
}
|
|
84
|
+
const eventPath = (_c = (_b = event.composedPath) === null || _b === void 0 ? void 0 : _b.call(event)) !== null && _c !== void 0 ? _c : [];
|
|
85
|
+
for (const entry of eventPath) {
|
|
86
|
+
const candidate = entry === null || entry === void 0 ? void 0 : entry.shortcutManager;
|
|
87
|
+
if (this.isShortcutManager(candidate)) {
|
|
88
|
+
return candidate;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return injectedManager;
|
|
92
|
+
}
|
|
93
|
+
isShortcutManager(candidate) {
|
|
94
|
+
return (!!candidate &&
|
|
95
|
+
typeof candidate.findShortcutByKeyCombination === 'function' &&
|
|
96
|
+
typeof candidate.executeShortcut === 'function' &&
|
|
97
|
+
typeof candidate.getShortcuts === 'function');
|
|
98
|
+
}
|
|
71
99
|
extractKeyFromCode(code) {
|
|
72
100
|
// Handle regular letter keys (KeyA, KeyB, etc.)
|
|
73
101
|
if (code.startsWith('Key')) {
|
|
@@ -109,23 +137,63 @@ let FoundationShortcutListener = class FoundationShortcutListener extends FASTEl
|
|
|
109
137
|
};
|
|
110
138
|
return specialKeyMap[code] || code.toLowerCase();
|
|
111
139
|
}
|
|
140
|
+
getDeepActiveElement() {
|
|
141
|
+
var _a, _b;
|
|
142
|
+
let active = (_a = document.activeElement) !== null && _a !== void 0 ? _a : null;
|
|
143
|
+
while ((_b = active === null || active === void 0 ? void 0 : active.shadowRoot) === null || _b === void 0 ? void 0 : _b.activeElement) {
|
|
144
|
+
active = active.shadowRoot.activeElement;
|
|
145
|
+
}
|
|
146
|
+
return active;
|
|
147
|
+
}
|
|
148
|
+
getEventElement(event) {
|
|
149
|
+
var _a, _b, _c;
|
|
150
|
+
const path = (_b = (_a = event.composedPath) === null || _a === void 0 ? void 0 : _a.call(event)) !== null && _b !== void 0 ? _b : [];
|
|
151
|
+
const fromPath = path.find((entry) => entry instanceof Element);
|
|
152
|
+
return (_c = fromPath !== null && fromPath !== void 0 ? fromPath : event.target) !== null && _c !== void 0 ? _c : null;
|
|
153
|
+
}
|
|
154
|
+
isEditableContext(event) {
|
|
155
|
+
const eventElement = this.getEventElement(event);
|
|
156
|
+
if (eventElement && this.isInputElement(eventElement)) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
return this.isInputElement(this.getDeepActiveElement());
|
|
160
|
+
}
|
|
112
161
|
isInputElement(element) {
|
|
162
|
+
var _a, _b;
|
|
113
163
|
if (!element)
|
|
114
164
|
return false;
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
if (inputTypes.includes(tagName)) {
|
|
165
|
+
const isEditableContent = (value) => value !== null && value !== undefined && value.toLowerCase() !== 'false';
|
|
166
|
+
if (isEditableContent(element.getAttribute('contenteditable')) || element.isContentEditable) {
|
|
118
167
|
return true;
|
|
119
168
|
}
|
|
120
|
-
//
|
|
121
|
-
|
|
169
|
+
// TODO: more generic way to check if the element is editable
|
|
170
|
+
const editableSelector = [
|
|
171
|
+
'input',
|
|
172
|
+
'textarea',
|
|
173
|
+
'select',
|
|
174
|
+
'[contenteditable="true"]',
|
|
175
|
+
'[contenteditable=""]',
|
|
176
|
+
'[role="textbox"]',
|
|
177
|
+
'[role="searchbox"]',
|
|
178
|
+
'[role="combobox"]',
|
|
179
|
+
'zero-text-field',
|
|
180
|
+
'rapid-text-field',
|
|
181
|
+
'zero-text-area',
|
|
182
|
+
'rapid-text-area',
|
|
183
|
+
'zero-combobox',
|
|
184
|
+
'rapid-combobox',
|
|
185
|
+
].join(',');
|
|
186
|
+
if (element.matches(editableSelector) || !!element.closest(editableSelector)) {
|
|
122
187
|
return true;
|
|
123
188
|
}
|
|
124
|
-
// Check for role="textbox" or similar
|
|
125
189
|
const role = element.getAttribute('role');
|
|
126
190
|
if (role && ['textbox', 'searchbox', 'combobox'].includes(role)) {
|
|
127
191
|
return true;
|
|
128
192
|
}
|
|
193
|
+
const tagName = (_b = (_a = element.tagName) === null || _a === void 0 ? void 0 : _a.toLowerCase) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
194
|
+
if (tagName && ['input', 'textarea', 'select'].includes(tagName)) {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
129
197
|
return false;
|
|
130
198
|
}
|
|
131
199
|
};
|
|
@@ -12,6 +12,7 @@ export class DefaultShortcutManager {
|
|
|
12
12
|
this.shortcutLookup = new Map(); // context:id -> ShortcutDefinition for quick lookups
|
|
13
13
|
this.keyCombinationMap = new Map(); // key combination -> set of "context:id" strings
|
|
14
14
|
this._isPausedSubject = new BehaviorSubject(false);
|
|
15
|
+
this.executionGuards = new Map();
|
|
15
16
|
}
|
|
16
17
|
get isPaused() {
|
|
17
18
|
return this._isPausedSubject.value;
|
|
@@ -88,22 +89,12 @@ export class DefaultShortcutManager {
|
|
|
88
89
|
keyCombinationDisplay,
|
|
89
90
|
// Functions that can be directly used in AG Grid menu items
|
|
90
91
|
disabled: () => {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
if (normalizedShortcut.canExecute) {
|
|
94
|
-
const status = normalizedShortcut.canExecute();
|
|
95
|
-
return status.disabled || false;
|
|
96
|
-
}
|
|
97
|
-
return false;
|
|
92
|
+
const status = this.getExecutionStatus(normalizedShortcut);
|
|
93
|
+
return status.disabled || false;
|
|
98
94
|
},
|
|
99
95
|
tooltip: () => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
if (normalizedShortcut.canExecute) {
|
|
103
|
-
const status = normalizedShortcut.canExecute();
|
|
104
|
-
return status.tooltip;
|
|
105
|
-
}
|
|
106
|
-
return undefined;
|
|
96
|
+
const status = this.getExecutionStatus(normalizedShortcut);
|
|
97
|
+
return status.tooltip;
|
|
107
98
|
},
|
|
108
99
|
};
|
|
109
100
|
}
|
|
@@ -157,11 +148,9 @@ export class DefaultShortcutManager {
|
|
|
157
148
|
return; // Don't execute if the required element is not focused
|
|
158
149
|
}
|
|
159
150
|
// Check if shortcut can be executed
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
if
|
|
163
|
-
return; // Don't execute if disabled
|
|
164
|
-
}
|
|
151
|
+
const executionStatus = this.getExecutionStatus(shortcut);
|
|
152
|
+
if (executionStatus.disabled) {
|
|
153
|
+
return; // Don't execute if disabled
|
|
165
154
|
}
|
|
166
155
|
try {
|
|
167
156
|
shortcut.action();
|
|
@@ -239,6 +228,15 @@ export class DefaultShortcutManager {
|
|
|
239
228
|
clearActiveContext() {
|
|
240
229
|
this._activeContext = undefined;
|
|
241
230
|
}
|
|
231
|
+
registerExecutionGuard(id, guard) {
|
|
232
|
+
this.executionGuards.set(id, guard);
|
|
233
|
+
}
|
|
234
|
+
unregisterExecutionGuard(id) {
|
|
235
|
+
this.executionGuards.delete(id);
|
|
236
|
+
}
|
|
237
|
+
clearExecutionGuards() {
|
|
238
|
+
this.executionGuards.clear();
|
|
239
|
+
}
|
|
242
240
|
pause() {
|
|
243
241
|
this._isPausedSubject.next(true);
|
|
244
242
|
}
|
|
@@ -278,6 +276,29 @@ export class DefaultShortcutManager {
|
|
|
278
276
|
}
|
|
279
277
|
return false;
|
|
280
278
|
}
|
|
279
|
+
getExecutionStatus(shortcut) {
|
|
280
|
+
if (this.isPaused) {
|
|
281
|
+
return { disabled: true, tooltip: 'Shortcuts are paused' };
|
|
282
|
+
}
|
|
283
|
+
const guardStatus = this.getExecutionGuardStatus();
|
|
284
|
+
if (guardStatus.disabled) {
|
|
285
|
+
return guardStatus;
|
|
286
|
+
}
|
|
287
|
+
if (shortcut.canExecute) {
|
|
288
|
+
return shortcut.canExecute();
|
|
289
|
+
}
|
|
290
|
+
return { disabled: false, tooltip: undefined };
|
|
291
|
+
}
|
|
292
|
+
getExecutionGuardStatus() {
|
|
293
|
+
for (const guard of this.executionGuards.values()) {
|
|
294
|
+
const result = guard();
|
|
295
|
+
const status = typeof result === 'boolean' ? { disabled: result } : result;
|
|
296
|
+
if (status === null || status === void 0 ? void 0 : status.disabled) {
|
|
297
|
+
return { disabled: true, tooltip: status.tooltip };
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return { disabled: false, tooltip: undefined };
|
|
301
|
+
}
|
|
281
302
|
}
|
|
282
303
|
/**
|
|
283
304
|
* A dependency injection token for the ShortcutManager interface.
|
|
@@ -2744,6 +2744,37 @@
|
|
|
2744
2744
|
"isAbstract": false,
|
|
2745
2745
|
"name": "clearActiveContext"
|
|
2746
2746
|
},
|
|
2747
|
+
{
|
|
2748
|
+
"kind": "Method",
|
|
2749
|
+
"canonicalReference": "@genesislcap/foundation-utils!DefaultShortcutManager#clearExecutionGuards:member(1)",
|
|
2750
|
+
"docComment": "",
|
|
2751
|
+
"excerptTokens": [
|
|
2752
|
+
{
|
|
2753
|
+
"kind": "Content",
|
|
2754
|
+
"text": "clearExecutionGuards(): "
|
|
2755
|
+
},
|
|
2756
|
+
{
|
|
2757
|
+
"kind": "Content",
|
|
2758
|
+
"text": "void"
|
|
2759
|
+
},
|
|
2760
|
+
{
|
|
2761
|
+
"kind": "Content",
|
|
2762
|
+
"text": ";"
|
|
2763
|
+
}
|
|
2764
|
+
],
|
|
2765
|
+
"isStatic": false,
|
|
2766
|
+
"returnTypeTokenRange": {
|
|
2767
|
+
"startIndex": 1,
|
|
2768
|
+
"endIndex": 2
|
|
2769
|
+
},
|
|
2770
|
+
"releaseTag": "Public",
|
|
2771
|
+
"isProtected": false,
|
|
2772
|
+
"overloadIndex": 1,
|
|
2773
|
+
"parameters": [],
|
|
2774
|
+
"isOptional": false,
|
|
2775
|
+
"isAbstract": false,
|
|
2776
|
+
"name": "clearExecutionGuards"
|
|
2777
|
+
},
|
|
2747
2778
|
{
|
|
2748
2779
|
"kind": "Method",
|
|
2749
2780
|
"canonicalReference": "@genesislcap/foundation-utils!DefaultShortcutManager#executeShortcut:member(1)",
|
|
@@ -3357,6 +3388,79 @@
|
|
|
3357
3388
|
"isAbstract": false,
|
|
3358
3389
|
"name": "registerContext"
|
|
3359
3390
|
},
|
|
3391
|
+
{
|
|
3392
|
+
"kind": "Method",
|
|
3393
|
+
"canonicalReference": "@genesislcap/foundation-utils!DefaultShortcutManager#registerExecutionGuard:member(1)",
|
|
3394
|
+
"docComment": "",
|
|
3395
|
+
"excerptTokens": [
|
|
3396
|
+
{
|
|
3397
|
+
"kind": "Content",
|
|
3398
|
+
"text": "registerExecutionGuard(id: "
|
|
3399
|
+
},
|
|
3400
|
+
{
|
|
3401
|
+
"kind": "Content",
|
|
3402
|
+
"text": "string"
|
|
3403
|
+
},
|
|
3404
|
+
{
|
|
3405
|
+
"kind": "Content",
|
|
3406
|
+
"text": ", guard: "
|
|
3407
|
+
},
|
|
3408
|
+
{
|
|
3409
|
+
"kind": "Content",
|
|
3410
|
+
"text": "() => "
|
|
3411
|
+
},
|
|
3412
|
+
{
|
|
3413
|
+
"kind": "Reference",
|
|
3414
|
+
"text": "ShortcutExecutionStatus",
|
|
3415
|
+
"canonicalReference": "@genesislcap/foundation-utils!ShortcutExecutionStatus:type"
|
|
3416
|
+
},
|
|
3417
|
+
{
|
|
3418
|
+
"kind": "Content",
|
|
3419
|
+
"text": " | boolean"
|
|
3420
|
+
},
|
|
3421
|
+
{
|
|
3422
|
+
"kind": "Content",
|
|
3423
|
+
"text": "): "
|
|
3424
|
+
},
|
|
3425
|
+
{
|
|
3426
|
+
"kind": "Content",
|
|
3427
|
+
"text": "void"
|
|
3428
|
+
},
|
|
3429
|
+
{
|
|
3430
|
+
"kind": "Content",
|
|
3431
|
+
"text": ";"
|
|
3432
|
+
}
|
|
3433
|
+
],
|
|
3434
|
+
"isStatic": false,
|
|
3435
|
+
"returnTypeTokenRange": {
|
|
3436
|
+
"startIndex": 7,
|
|
3437
|
+
"endIndex": 8
|
|
3438
|
+
},
|
|
3439
|
+
"releaseTag": "Public",
|
|
3440
|
+
"isProtected": false,
|
|
3441
|
+
"overloadIndex": 1,
|
|
3442
|
+
"parameters": [
|
|
3443
|
+
{
|
|
3444
|
+
"parameterName": "id",
|
|
3445
|
+
"parameterTypeTokenRange": {
|
|
3446
|
+
"startIndex": 1,
|
|
3447
|
+
"endIndex": 2
|
|
3448
|
+
},
|
|
3449
|
+
"isOptional": false
|
|
3450
|
+
},
|
|
3451
|
+
{
|
|
3452
|
+
"parameterName": "guard",
|
|
3453
|
+
"parameterTypeTokenRange": {
|
|
3454
|
+
"startIndex": 3,
|
|
3455
|
+
"endIndex": 6
|
|
3456
|
+
},
|
|
3457
|
+
"isOptional": false
|
|
3458
|
+
}
|
|
3459
|
+
],
|
|
3460
|
+
"isOptional": false,
|
|
3461
|
+
"isAbstract": false,
|
|
3462
|
+
"name": "registerExecutionGuard"
|
|
3463
|
+
},
|
|
3360
3464
|
{
|
|
3361
3465
|
"kind": "Method",
|
|
3362
3466
|
"canonicalReference": "@genesislcap/foundation-utils!DefaultShortcutManager#registerShortcut:member(1)",
|
|
@@ -3539,6 +3643,54 @@
|
|
|
3539
3643
|
"isAbstract": false,
|
|
3540
3644
|
"name": "setActiveContext"
|
|
3541
3645
|
},
|
|
3646
|
+
{
|
|
3647
|
+
"kind": "Method",
|
|
3648
|
+
"canonicalReference": "@genesislcap/foundation-utils!DefaultShortcutManager#unregisterExecutionGuard:member(1)",
|
|
3649
|
+
"docComment": "",
|
|
3650
|
+
"excerptTokens": [
|
|
3651
|
+
{
|
|
3652
|
+
"kind": "Content",
|
|
3653
|
+
"text": "unregisterExecutionGuard(id: "
|
|
3654
|
+
},
|
|
3655
|
+
{
|
|
3656
|
+
"kind": "Content",
|
|
3657
|
+
"text": "string"
|
|
3658
|
+
},
|
|
3659
|
+
{
|
|
3660
|
+
"kind": "Content",
|
|
3661
|
+
"text": "): "
|
|
3662
|
+
},
|
|
3663
|
+
{
|
|
3664
|
+
"kind": "Content",
|
|
3665
|
+
"text": "void"
|
|
3666
|
+
},
|
|
3667
|
+
{
|
|
3668
|
+
"kind": "Content",
|
|
3669
|
+
"text": ";"
|
|
3670
|
+
}
|
|
3671
|
+
],
|
|
3672
|
+
"isStatic": false,
|
|
3673
|
+
"returnTypeTokenRange": {
|
|
3674
|
+
"startIndex": 3,
|
|
3675
|
+
"endIndex": 4
|
|
3676
|
+
},
|
|
3677
|
+
"releaseTag": "Public",
|
|
3678
|
+
"isProtected": false,
|
|
3679
|
+
"overloadIndex": 1,
|
|
3680
|
+
"parameters": [
|
|
3681
|
+
{
|
|
3682
|
+
"parameterName": "id",
|
|
3683
|
+
"parameterTypeTokenRange": {
|
|
3684
|
+
"startIndex": 1,
|
|
3685
|
+
"endIndex": 2
|
|
3686
|
+
},
|
|
3687
|
+
"isOptional": false
|
|
3688
|
+
}
|
|
3689
|
+
],
|
|
3690
|
+
"isOptional": false,
|
|
3691
|
+
"isAbstract": false,
|
|
3692
|
+
"name": "unregisterExecutionGuard"
|
|
3693
|
+
},
|
|
3542
3694
|
{
|
|
3543
3695
|
"kind": "Method",
|
|
3544
3696
|
"canonicalReference": "@genesislcap/foundation-utils!DefaultShortcutManager#unregisterShortcut:member(1)",
|
|
@@ -17665,6 +17817,34 @@
|
|
|
17665
17817
|
"parameters": [],
|
|
17666
17818
|
"name": "clearActiveContext"
|
|
17667
17819
|
},
|
|
17820
|
+
{
|
|
17821
|
+
"kind": "MethodSignature",
|
|
17822
|
+
"canonicalReference": "@genesislcap/foundation-utils!ShortcutManager#clearExecutionGuards:member(1)",
|
|
17823
|
+
"docComment": "",
|
|
17824
|
+
"excerptTokens": [
|
|
17825
|
+
{
|
|
17826
|
+
"kind": "Content",
|
|
17827
|
+
"text": "clearExecutionGuards(): "
|
|
17828
|
+
},
|
|
17829
|
+
{
|
|
17830
|
+
"kind": "Content",
|
|
17831
|
+
"text": "void"
|
|
17832
|
+
},
|
|
17833
|
+
{
|
|
17834
|
+
"kind": "Content",
|
|
17835
|
+
"text": ";"
|
|
17836
|
+
}
|
|
17837
|
+
],
|
|
17838
|
+
"isOptional": false,
|
|
17839
|
+
"returnTypeTokenRange": {
|
|
17840
|
+
"startIndex": 1,
|
|
17841
|
+
"endIndex": 2
|
|
17842
|
+
},
|
|
17843
|
+
"releaseTag": "Public",
|
|
17844
|
+
"overloadIndex": 1,
|
|
17845
|
+
"parameters": [],
|
|
17846
|
+
"name": "clearExecutionGuards"
|
|
17847
|
+
},
|
|
17668
17848
|
{
|
|
17669
17849
|
"kind": "MethodSignature",
|
|
17670
17850
|
"canonicalReference": "@genesislcap/foundation-utils!ShortcutManager#executeShortcut:member(1)",
|
|
@@ -18239,6 +18419,76 @@
|
|
|
18239
18419
|
],
|
|
18240
18420
|
"name": "registerContext"
|
|
18241
18421
|
},
|
|
18422
|
+
{
|
|
18423
|
+
"kind": "MethodSignature",
|
|
18424
|
+
"canonicalReference": "@genesislcap/foundation-utils!ShortcutManager#registerExecutionGuard:member(1)",
|
|
18425
|
+
"docComment": "/**\n * Register a global execution guard.\n *\n * @remarks\n *\n * Guards are evaluated before shortcut-specific canExecute checks.\n */\n",
|
|
18426
|
+
"excerptTokens": [
|
|
18427
|
+
{
|
|
18428
|
+
"kind": "Content",
|
|
18429
|
+
"text": "registerExecutionGuard(id: "
|
|
18430
|
+
},
|
|
18431
|
+
{
|
|
18432
|
+
"kind": "Content",
|
|
18433
|
+
"text": "string"
|
|
18434
|
+
},
|
|
18435
|
+
{
|
|
18436
|
+
"kind": "Content",
|
|
18437
|
+
"text": ", guard: "
|
|
18438
|
+
},
|
|
18439
|
+
{
|
|
18440
|
+
"kind": "Content",
|
|
18441
|
+
"text": "() => "
|
|
18442
|
+
},
|
|
18443
|
+
{
|
|
18444
|
+
"kind": "Reference",
|
|
18445
|
+
"text": "ShortcutExecutionStatus",
|
|
18446
|
+
"canonicalReference": "@genesislcap/foundation-utils!ShortcutExecutionStatus:type"
|
|
18447
|
+
},
|
|
18448
|
+
{
|
|
18449
|
+
"kind": "Content",
|
|
18450
|
+
"text": " | boolean"
|
|
18451
|
+
},
|
|
18452
|
+
{
|
|
18453
|
+
"kind": "Content",
|
|
18454
|
+
"text": "): "
|
|
18455
|
+
},
|
|
18456
|
+
{
|
|
18457
|
+
"kind": "Content",
|
|
18458
|
+
"text": "void"
|
|
18459
|
+
},
|
|
18460
|
+
{
|
|
18461
|
+
"kind": "Content",
|
|
18462
|
+
"text": ";"
|
|
18463
|
+
}
|
|
18464
|
+
],
|
|
18465
|
+
"isOptional": false,
|
|
18466
|
+
"returnTypeTokenRange": {
|
|
18467
|
+
"startIndex": 7,
|
|
18468
|
+
"endIndex": 8
|
|
18469
|
+
},
|
|
18470
|
+
"releaseTag": "Public",
|
|
18471
|
+
"overloadIndex": 1,
|
|
18472
|
+
"parameters": [
|
|
18473
|
+
{
|
|
18474
|
+
"parameterName": "id",
|
|
18475
|
+
"parameterTypeTokenRange": {
|
|
18476
|
+
"startIndex": 1,
|
|
18477
|
+
"endIndex": 2
|
|
18478
|
+
},
|
|
18479
|
+
"isOptional": false
|
|
18480
|
+
},
|
|
18481
|
+
{
|
|
18482
|
+
"parameterName": "guard",
|
|
18483
|
+
"parameterTypeTokenRange": {
|
|
18484
|
+
"startIndex": 3,
|
|
18485
|
+
"endIndex": 6
|
|
18486
|
+
},
|
|
18487
|
+
"isOptional": false
|
|
18488
|
+
}
|
|
18489
|
+
],
|
|
18490
|
+
"name": "registerExecutionGuard"
|
|
18491
|
+
},
|
|
18242
18492
|
{
|
|
18243
18493
|
"kind": "MethodSignature",
|
|
18244
18494
|
"canonicalReference": "@genesislcap/foundation-utils!ShortcutManager#registerShortcut:member(1)",
|
|
@@ -18409,6 +18659,51 @@
|
|
|
18409
18659
|
],
|
|
18410
18660
|
"name": "setActiveContext"
|
|
18411
18661
|
},
|
|
18662
|
+
{
|
|
18663
|
+
"kind": "MethodSignature",
|
|
18664
|
+
"canonicalReference": "@genesislcap/foundation-utils!ShortcutManager#unregisterExecutionGuard:member(1)",
|
|
18665
|
+
"docComment": "",
|
|
18666
|
+
"excerptTokens": [
|
|
18667
|
+
{
|
|
18668
|
+
"kind": "Content",
|
|
18669
|
+
"text": "unregisterExecutionGuard(id: "
|
|
18670
|
+
},
|
|
18671
|
+
{
|
|
18672
|
+
"kind": "Content",
|
|
18673
|
+
"text": "string"
|
|
18674
|
+
},
|
|
18675
|
+
{
|
|
18676
|
+
"kind": "Content",
|
|
18677
|
+
"text": "): "
|
|
18678
|
+
},
|
|
18679
|
+
{
|
|
18680
|
+
"kind": "Content",
|
|
18681
|
+
"text": "void"
|
|
18682
|
+
},
|
|
18683
|
+
{
|
|
18684
|
+
"kind": "Content",
|
|
18685
|
+
"text": ";"
|
|
18686
|
+
}
|
|
18687
|
+
],
|
|
18688
|
+
"isOptional": false,
|
|
18689
|
+
"returnTypeTokenRange": {
|
|
18690
|
+
"startIndex": 3,
|
|
18691
|
+
"endIndex": 4
|
|
18692
|
+
},
|
|
18693
|
+
"releaseTag": "Public",
|
|
18694
|
+
"overloadIndex": 1,
|
|
18695
|
+
"parameters": [
|
|
18696
|
+
{
|
|
18697
|
+
"parameterName": "id",
|
|
18698
|
+
"parameterTypeTokenRange": {
|
|
18699
|
+
"startIndex": 1,
|
|
18700
|
+
"endIndex": 2
|
|
18701
|
+
},
|
|
18702
|
+
"isOptional": false
|
|
18703
|
+
}
|
|
18704
|
+
],
|
|
18705
|
+
"name": "unregisterExecutionGuard"
|
|
18706
|
+
},
|
|
18412
18707
|
{
|
|
18413
18708
|
"kind": "MethodSignature",
|
|
18414
18709
|
"canonicalReference": "@genesislcap/foundation-utils!ShortcutManager#unregisterShortcut:member(1)",
|
|
@@ -385,6 +385,7 @@ export declare class DefaultShortcutManager implements ShortcutManager {
|
|
|
385
385
|
private keyCombinationMap;
|
|
386
386
|
private _isPausedSubject;
|
|
387
387
|
private _activeContext;
|
|
388
|
+
private executionGuards;
|
|
388
389
|
get isPaused(): boolean;
|
|
389
390
|
get isPaused$(): Observable<boolean>;
|
|
390
391
|
get isPausedSubject(): BehaviorSubject<boolean>;
|
|
@@ -403,6 +404,9 @@ export declare class DefaultShortcutManager implements ShortcutManager {
|
|
|
403
404
|
setActiveContext(context: string): void;
|
|
404
405
|
getActiveContext(): string | undefined;
|
|
405
406
|
clearActiveContext(): void;
|
|
407
|
+
registerExecutionGuard(id: string, guard: () => ShortcutExecutionStatus | boolean): void;
|
|
408
|
+
unregisterExecutionGuard(id: string): void;
|
|
409
|
+
clearExecutionGuards(): void;
|
|
406
410
|
pause(): void;
|
|
407
411
|
resume(): void;
|
|
408
412
|
/**
|
|
@@ -412,6 +416,8 @@ export declare class DefaultShortcutManager implements ShortcutManager {
|
|
|
412
416
|
private normalizeShortcutDefinition;
|
|
413
417
|
private createKeyCombinationKey;
|
|
414
418
|
private isElementFocused;
|
|
419
|
+
private getExecutionStatus;
|
|
420
|
+
private getExecutionGuardStatus;
|
|
415
421
|
}
|
|
416
422
|
|
|
417
423
|
/**
|
|
@@ -607,6 +613,7 @@ export declare type FoundationLayoutContainer = {
|
|
|
607
613
|
export declare class FoundationShortcutListener extends FASTElement {
|
|
608
614
|
shortcutManager: ShortcutManager;
|
|
609
615
|
private keyListener;
|
|
616
|
+
private stateSubscription;
|
|
610
617
|
private isListening;
|
|
611
618
|
connectedCallback(): void;
|
|
612
619
|
disconnectedCallback(): void;
|
|
@@ -614,7 +621,12 @@ export declare class FoundationShortcutListener extends FASTElement {
|
|
|
614
621
|
private addKeyListener;
|
|
615
622
|
private removeKeyListener;
|
|
616
623
|
private handleKeyDown;
|
|
624
|
+
private resolveShortcutManager;
|
|
625
|
+
private isShortcutManager;
|
|
617
626
|
private extractKeyFromCode;
|
|
627
|
+
private getDeepActiveElement;
|
|
628
|
+
private getEventElement;
|
|
629
|
+
private isEditableContext;
|
|
618
630
|
private isInputElement;
|
|
619
631
|
}
|
|
620
632
|
|
|
@@ -2290,6 +2302,13 @@ export declare interface ShortcutManager {
|
|
|
2290
2302
|
isPaused: boolean;
|
|
2291
2303
|
isPaused$: Observable<boolean>;
|
|
2292
2304
|
isPausedSubject: BehaviorSubject<boolean>;
|
|
2305
|
+
/**
|
|
2306
|
+
* Register a global execution guard.
|
|
2307
|
+
* @remarks Guards are evaluated before shortcut-specific canExecute checks.
|
|
2308
|
+
*/
|
|
2309
|
+
registerExecutionGuard(id: string, guard: () => ShortcutExecutionStatus | boolean): void;
|
|
2310
|
+
unregisterExecutionGuard(id: string): void;
|
|
2311
|
+
clearExecutionGuards(): void;
|
|
2293
2312
|
}
|
|
2294
2313
|
|
|
2295
2314
|
/**
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-utils",
|
|
3
3
|
"description": "Genesis Foundation Utils",
|
|
4
|
-
"version": "14.
|
|
4
|
+
"version": "14.422.1-alpha-6f2ae99.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "SEE LICENSE IN license.txt",
|
|
7
7
|
"main": "dist/esm/index.js",
|
|
@@ -29,18 +29,18 @@
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@genesislcap/foundation-testing": "14.
|
|
33
|
-
"@genesislcap/genx": "14.
|
|
34
|
-
"@genesislcap/rollup-builder": "14.
|
|
35
|
-
"@genesislcap/ts-builder": "14.
|
|
36
|
-
"@genesislcap/uvu-playwright-builder": "14.
|
|
37
|
-
"@genesislcap/vite-builder": "14.
|
|
38
|
-
"@genesislcap/webpack-builder": "14.
|
|
32
|
+
"@genesislcap/foundation-testing": "14.422.1-alpha-6f2ae99.0",
|
|
33
|
+
"@genesislcap/genx": "14.422.1-alpha-6f2ae99.0",
|
|
34
|
+
"@genesislcap/rollup-builder": "14.422.1-alpha-6f2ae99.0",
|
|
35
|
+
"@genesislcap/ts-builder": "14.422.1-alpha-6f2ae99.0",
|
|
36
|
+
"@genesislcap/uvu-playwright-builder": "14.422.1-alpha-6f2ae99.0",
|
|
37
|
+
"@genesislcap/vite-builder": "14.422.1-alpha-6f2ae99.0",
|
|
38
|
+
"@genesislcap/webpack-builder": "14.422.1-alpha-6f2ae99.0",
|
|
39
39
|
"@types/json-schema": "^7.0.11"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@genesislcap/expression-builder": "14.
|
|
43
|
-
"@genesislcap/foundation-logger": "14.
|
|
42
|
+
"@genesislcap/expression-builder": "14.422.1-alpha-6f2ae99.0",
|
|
43
|
+
"@genesislcap/foundation-logger": "14.422.1-alpha-6f2ae99.0",
|
|
44
44
|
"@microsoft/fast-components": "2.30.6",
|
|
45
45
|
"@microsoft/fast-element": "1.14.0",
|
|
46
46
|
"@microsoft/fast-foundation": "2.50.0",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"access": "public"
|
|
59
59
|
},
|
|
60
60
|
"customElements": "dist/custom-elements.json",
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "945d2b920b348b5d2cbd2ed34cb3cc2ff338a375"
|
|
62
62
|
}
|