@genesislcap/foundation-utils 14.422.2-alpha-0a3f40b.0 → 14.424.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.
@@ -91,19 +91,11 @@ export declare function assureDesignSystem(module: DesignSystemModule): DesignSy
91
91
  */
92
92
  export declare const avoidTreeShaking: (...classes: unknown[]) => void;
93
93
 
94
- /**
95
- * Base selectors treated as editable context regardless of design system.
96
- * Includes native controls, contenteditable, and ARIA-editable roles.
97
- */
98
- export declare const BASE_EDITABLE_ELEMENT_SELECTORS: readonly ["input", "textarea", "select", "[contenteditable=\"true\"]", "[contenteditable=\"\"]", "[role=\"textbox\"]", "[role=\"searchbox\"]", "[role=\"combobox\"]"];
99
-
100
94
  /**
101
95
  * @internal
102
96
  */
103
97
  export declare const BIG_INT_64_BITS = 64;
104
98
 
105
- export declare function buildEditableElementSelector(designSystems: readonly ShortcutDesignSystemPrefix[], customEditableSelectors?: readonly string[]): string;
106
-
107
99
  /**
108
100
  * The builder aka file bundler.
109
101
  * @privateRemarks
@@ -393,10 +385,6 @@ export declare class DefaultShortcutManager implements ShortcutManager {
393
385
  private keyCombinationMap;
394
386
  private _isPausedSubject;
395
387
  private _activeContext;
396
- private executionGuards;
397
- private editableContextConfig;
398
- private editableSelector;
399
- private blockedMessageConfig;
400
388
  get isPaused(): boolean;
401
389
  get isPaused$(): Observable<boolean>;
402
390
  get isPausedSubject(): BehaviorSubject<boolean>;
@@ -404,8 +392,8 @@ export declare class DefaultShortcutManager implements ShortcutManager {
404
392
  registerShortcut(shortcut: ShortcutDefinition): ShortcutRegistrationResult;
405
393
  unregisterShortcut(context: string, id: string): void;
406
394
  unregisterShortcutsByContext(context: string): void;
407
- executeShortcut(id: string, eventTarget?: EventTarget | null): void;
408
- executeShortcutByContext(context: string, id: string, eventTarget?: EventTarget | null): void;
395
+ executeShortcut(id: string): void;
396
+ executeShortcutByContext(context: string, id: string): void;
409
397
  getShortcuts(): ShortcutDefinition[];
410
398
  getShortcutsByContext(context: string): ShortcutDefinition[];
411
399
  findShortcutByKeyCombination(key: string, ctrlKey?: boolean, altKey?: boolean, shiftKey?: boolean, metaKey?: boolean): ShortcutDefinition | undefined;
@@ -415,14 +403,6 @@ export declare class DefaultShortcutManager implements ShortcutManager {
415
403
  setActiveContext(context: string): void;
416
404
  getActiveContext(): string | undefined;
417
405
  clearActiveContext(): void;
418
- registerExecutionGuard(id: string, guard: () => ShortcutExecutionStatus | boolean): void;
419
- unregisterExecutionGuard(id: string): void;
420
- clearExecutionGuards(): void;
421
- configureEditableContext(config?: ShortcutEditableContextConfig): void;
422
- getEditableContextConfig(): Required<ShortcutEditableContextConfig>;
423
- getEditableSelector(): string;
424
- configureBlockedMessages(config?: ShortcutBlockedMessageConfig): void;
425
- getBlockedMessages(): Required<ShortcutBlockedMessageConfig>;
426
406
  pause(): void;
427
407
  resume(): void;
428
408
  /**
@@ -432,9 +412,6 @@ export declare class DefaultShortcutManager implements ShortcutManager {
432
412
  private normalizeShortcutDefinition;
433
413
  private createKeyCombinationKey;
434
414
  private isElementFocused;
435
- private getExecutionStatus;
436
- private getExecutionGuardStatus;
437
- private refreshEditableSelector;
438
415
  }
439
416
 
440
417
  /**
@@ -450,11 +427,6 @@ export declare class DefaultShortcutManager implements ShortcutManager {
450
427
  */
451
428
  export declare const delay: (ms: number) => Promise<void>;
452
429
 
453
- /**
454
- * Design-system specific editable host selectors.
455
- */
456
- export declare const DESIGN_SYSTEM_EDITABLE_ELEMENT_SELECTORS: Record<ShortcutDesignSystemPrefix, readonly string[]>;
457
-
458
430
  /**
459
431
  * DesignSystemModule.
460
432
  * @public
@@ -487,10 +459,6 @@ export declare interface DTOMapper<TDTO, TEntity> {
487
459
  toDTO: (entity: Partial<TEntity>) => TDTO;
488
460
  }
489
461
 
490
- export declare function emitShortcutBlockedEvent(detail: Omit<ShortcutBlockedEventDetail, 'message'> & {
491
- message?: string;
492
- }, target?: EventTarget | null): void;
493
-
494
462
  /**
495
463
  * Encodes the given value to base64.
496
464
  * @public
@@ -642,13 +610,11 @@ export declare class FoundationShortcutListener extends FASTElement {
642
610
  private isListening;
643
611
  connectedCallback(): void;
644
612
  disconnectedCallback(): void;
613
+ private setupStateSubscription;
645
614
  private addKeyListener;
646
615
  private removeKeyListener;
647
616
  private handleKeyDown;
648
617
  private extractKeyFromCode;
649
- private getDeepActiveElement;
650
- private getEventElement;
651
- private isEditableContext;
652
618
  private isInputElement;
653
619
  }
654
620
 
@@ -2260,32 +2226,6 @@ export declare type ServerRowEntity = {
2260
2226
  };
2261
2227
  };
2262
2228
 
2263
- export declare const SHORTCUT_BLOCKED_DEFAULT_MESSAGE = "This shortcut is currently unavailable in this context.";
2264
-
2265
- export declare const SHORTCUT_BLOCKED_ELEMENT_FOCUS_MESSAGE = "This shortcut is unavailable in the current focus context.";
2266
-
2267
- export declare const SHORTCUT_BLOCKED_EVENT = "foundation-shortcut-blocked";
2268
-
2269
- export declare const SHORTCUT_BLOCKED_INPUT_MESSAGE = "This shortcut is unavailable while typing in an input field.";
2270
-
2271
- export declare const SHORTCUT_BLOCKED_PAUSED_MESSAGE = "Shortcuts are paused.";
2272
-
2273
- export declare type ShortcutBlockedEventDetail = {
2274
- shortcutId: string;
2275
- context?: string;
2276
- reason: ShortcutBlockedReason;
2277
- message: string;
2278
- };
2279
-
2280
- export declare type ShortcutBlockedMessageConfig = {
2281
- defaultMessage?: string;
2282
- inputMessage?: string;
2283
- pausedMessage?: string;
2284
- elementFocusMessage?: string;
2285
- };
2286
-
2287
- export declare type ShortcutBlockedReason = 'paused' | 'editable-context' | 'element-not-focused' | 'disabled';
2288
-
2289
2229
  /**
2290
2230
  * A definition of a keyboard shortcut
2291
2231
  * @public
@@ -2306,21 +2246,6 @@ export declare interface ShortcutDefinition {
2306
2246
  canExecute?: () => ShortcutExecutionStatus;
2307
2247
  }
2308
2248
 
2309
- export declare type ShortcutDesignSystemPrefix = 'rapid' | 'zero';
2310
-
2311
- export declare type ShortcutEditableContextConfig = {
2312
- /**
2313
- * Which design systems should be considered when detecting editable custom elements.
2314
- * @default ['rapid']
2315
- */
2316
- designSystems?: ShortcutDesignSystemPrefix[];
2317
- /**
2318
- * Optional app-specific selectors for editable host elements.
2319
- * @default []
2320
- */
2321
- customEditableSelectors?: string[];
2322
- };
2323
-
2324
2249
  /**
2325
2250
  * A type which represents the disabled status and tooltip of an item
2326
2251
  * @public
@@ -2344,13 +2269,13 @@ export declare interface ShortcutManager {
2344
2269
  * @param id - The id of the shortcut to execute
2345
2270
  * @remarks This method will execute the shortcut in the active context
2346
2271
  */
2347
- executeShortcut(id: string, eventTarget?: EventTarget | null): void;
2272
+ executeShortcut(id: string): void;
2348
2273
  /**
2349
2274
  * Execute a shortcut by its id and context
2350
2275
  * @param context - The context of the shortcut to execute
2351
2276
  * @param id - The id of the shortcut to execute
2352
2277
  */
2353
- executeShortcutByContext(context: string, id: string, eventTarget?: EventTarget | null): void;
2278
+ executeShortcutByContext(context: string, id: string): void;
2354
2279
  getShortcuts(): ShortcutDefinition[];
2355
2280
  getShortcutsByContext(context: string): ShortcutDefinition[];
2356
2281
  getContexts(): string[];
@@ -2365,22 +2290,6 @@ export declare interface ShortcutManager {
2365
2290
  isPaused: boolean;
2366
2291
  isPaused$: Observable<boolean>;
2367
2292
  isPausedSubject: BehaviorSubject<boolean>;
2368
- /**
2369
- * Register a global execution guard.
2370
- * @remarks Guards are evaluated before shortcut-specific canExecute checks.
2371
- */
2372
- registerExecutionGuard(id: string, guard: () => ShortcutExecutionStatus | boolean): void;
2373
- unregisterExecutionGuard(id: string): void;
2374
- clearExecutionGuards(): void;
2375
- /**
2376
- * Configure editable-context detection used by shortcut listeners.
2377
- * @remarks This is intended to be set once during app startup.
2378
- */
2379
- configureEditableContext(config?: ShortcutEditableContextConfig): void;
2380
- getEditableContextConfig(): Required<ShortcutEditableContextConfig>;
2381
- getEditableSelector(): string;
2382
- configureBlockedMessages(config?: ShortcutBlockedMessageConfig): void;
2383
- getBlockedMessages(): Required<ShortcutBlockedMessageConfig>;
2384
2293
  }
2385
2294
 
2386
2295
  /**
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.422.2-alpha-0a3f40b.0",
4
+ "version": "14.424.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.422.2-alpha-0a3f40b.0",
33
- "@genesislcap/genx": "14.422.2-alpha-0a3f40b.0",
34
- "@genesislcap/rollup-builder": "14.422.2-alpha-0a3f40b.0",
35
- "@genesislcap/ts-builder": "14.422.2-alpha-0a3f40b.0",
36
- "@genesislcap/uvu-playwright-builder": "14.422.2-alpha-0a3f40b.0",
37
- "@genesislcap/vite-builder": "14.422.2-alpha-0a3f40b.0",
38
- "@genesislcap/webpack-builder": "14.422.2-alpha-0a3f40b.0",
32
+ "@genesislcap/foundation-testing": "14.424.0",
33
+ "@genesislcap/genx": "14.424.0",
34
+ "@genesislcap/rollup-builder": "14.424.0",
35
+ "@genesislcap/ts-builder": "14.424.0",
36
+ "@genesislcap/uvu-playwright-builder": "14.424.0",
37
+ "@genesislcap/vite-builder": "14.424.0",
38
+ "@genesislcap/webpack-builder": "14.424.0",
39
39
  "@types/json-schema": "^7.0.11"
40
40
  },
41
41
  "dependencies": {
42
- "@genesislcap/expression-builder": "14.422.2-alpha-0a3f40b.0",
43
- "@genesislcap/foundation-logger": "14.422.2-alpha-0a3f40b.0",
42
+ "@genesislcap/expression-builder": "14.424.0",
43
+ "@genesislcap/foundation-logger": "14.424.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": "bfd50dff01cb8c02977496ac3df745f2cd15fb74"
61
+ "gitHead": "8196a15336f7c89db67f4c2b9a0ffc7cb0ca2b76"
62
62
  }
@@ -1,12 +0,0 @@
1
- import { ShortcutDesignSystemPrefix } from '../shortcut-manager/shortcut-manager';
2
- /**
3
- * Base selectors treated as editable context regardless of design system.
4
- * Includes native controls, contenteditable, and ARIA-editable roles.
5
- */
6
- export declare const BASE_EDITABLE_ELEMENT_SELECTORS: readonly ["input", "textarea", "select", "[contenteditable=\"true\"]", "[contenteditable=\"\"]", "[role=\"textbox\"]", "[role=\"searchbox\"]", "[role=\"combobox\"]"];
7
- /**
8
- * Design-system specific editable host selectors.
9
- */
10
- export declare const DESIGN_SYSTEM_EDITABLE_ELEMENT_SELECTORS: Record<ShortcutDesignSystemPrefix, readonly string[]>;
11
- export declare function buildEditableElementSelector(designSystems: readonly ShortcutDesignSystemPrefix[], customEditableSelectors?: readonly string[]): string;
12
- //# sourceMappingURL=editable-elements.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"editable-elements.d.ts","sourceRoot":"","sources":["../../../src/design-system/editable-elements.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAWlF;;;GAGG;AACH,eAAO,MAAM,+BAA+B,uKAIlC,CAAC;AAMX;;GAEG;AACH,eAAO,MAAM,wCAAwC,EAAE,MAAM,CAC3D,0BAA0B,EAC1B,SAAS,MAAM,EAAE,CAIlB,CAAC;AAEF,wBAAgB,4BAA4B,CAC1C,aAAa,EAAE,SAAS,0BAA0B,EAAE,EACpD,uBAAuB,GAAE,SAAS,MAAM,EAAO,GAC9C,MAAM,CAkBR"}
@@ -1,16 +0,0 @@
1
- export declare const SHORTCUT_BLOCKED_EVENT = "foundation-shortcut-blocked";
2
- export declare const SHORTCUT_BLOCKED_DEFAULT_MESSAGE = "This shortcut is currently unavailable in this context.";
3
- export declare const SHORTCUT_BLOCKED_INPUT_MESSAGE = "This shortcut is unavailable while typing in an input field.";
4
- export declare const SHORTCUT_BLOCKED_PAUSED_MESSAGE = "Shortcuts are paused.";
5
- export declare const SHORTCUT_BLOCKED_ELEMENT_FOCUS_MESSAGE = "This shortcut is unavailable in the current focus context.";
6
- export type ShortcutBlockedReason = 'paused' | 'editable-context' | 'element-not-focused' | 'disabled';
7
- export type ShortcutBlockedEventDetail = {
8
- shortcutId: string;
9
- context?: string;
10
- reason: ShortcutBlockedReason;
11
- message: string;
12
- };
13
- export declare function emitShortcutBlockedEvent(detail: Omit<ShortcutBlockedEventDetail, 'message'> & {
14
- message?: string;
15
- }, target?: EventTarget | null): void;
16
- //# sourceMappingURL=shortcut-events.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"shortcut-events.d.ts","sourceRoot":"","sources":["../../../src/shortcut-manager/shortcut-events.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,gCAAgC,CAAC;AAEpE,eAAO,MAAM,gCAAgC,4DACc,CAAC;AAC5D,eAAO,MAAM,8BAA8B,iEACqB,CAAC;AACjE,eAAO,MAAM,+BAA+B,0BAA0B,CAAC;AACvE,eAAO,MAAM,sCAAsC,+DACW,CAAC;AAE/D,MAAM,MAAM,qBAAqB,GAC7B,QAAQ,GACR,kBAAkB,GAClB,qBAAqB,GACrB,UAAU,CAAC;AAEf,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,qBAAqB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,IAAI,CAAC,0BAA0B,EAAE,SAAS,CAAC,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,EAC1E,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,GAC1B,IAAI,CAuBN"}
@@ -1,42 +0,0 @@
1
- const NATIVE_EDITABLE_ELEMENT_SELECTORS = ['input', 'textarea', 'select'];
2
- const CONTENT_EDITABLE_SELECTORS = ['[contenteditable="true"]', '[contenteditable=""]'];
3
- const ARIA_EDITABLE_ROLE_SELECTORS = [
4
- '[role="textbox"]',
5
- '[role="searchbox"]',
6
- '[role="combobox"]',
7
- ];
8
- const DESIGN_SYSTEM_EDITABLE_COMPONENT_NAMES = ['text-field', 'text-area', 'combobox'];
9
- /**
10
- * Base selectors treated as editable context regardless of design system.
11
- * Includes native controls, contenteditable, and ARIA-editable roles.
12
- */
13
- export const BASE_EDITABLE_ELEMENT_SELECTORS = [
14
- ...NATIVE_EDITABLE_ELEMENT_SELECTORS,
15
- ...CONTENT_EDITABLE_SELECTORS,
16
- ...ARIA_EDITABLE_ROLE_SELECTORS,
17
- ];
18
- const buildDesignSystemEditableSelectors = (prefix) => DESIGN_SYSTEM_EDITABLE_COMPONENT_NAMES.map((name) => `${prefix}-${name}`);
19
- /**
20
- * Design-system specific editable host selectors.
21
- */
22
- export const DESIGN_SYSTEM_EDITABLE_ELEMENT_SELECTORS = {
23
- rapid: buildDesignSystemEditableSelectors('rapid'),
24
- zero: buildDesignSystemEditableSelectors('zero'),
25
- };
26
- export function buildEditableElementSelector(designSystems, customEditableSelectors = []) {
27
- var _a;
28
- const selectors = [...BASE_EDITABLE_ELEMENT_SELECTORS];
29
- for (const designSystem of designSystems) {
30
- for (const selector of (_a = DESIGN_SYSTEM_EDITABLE_ELEMENT_SELECTORS[designSystem]) !== null && _a !== void 0 ? _a : []) {
31
- if (!selectors.includes(selector)) {
32
- selectors.push(selector);
33
- }
34
- }
35
- }
36
- for (const selector of customEditableSelectors) {
37
- if (selector && !selectors.includes(selector)) {
38
- selectors.push(selector);
39
- }
40
- }
41
- return selectors.join(',');
42
- }
@@ -1,22 +0,0 @@
1
- export const SHORTCUT_BLOCKED_EVENT = 'foundation-shortcut-blocked';
2
- export const SHORTCUT_BLOCKED_DEFAULT_MESSAGE = 'This shortcut is currently unavailable in this context.';
3
- export const SHORTCUT_BLOCKED_INPUT_MESSAGE = 'This shortcut is unavailable while typing in an input field.';
4
- export const SHORTCUT_BLOCKED_PAUSED_MESSAGE = 'Shortcuts are paused.';
5
- export const SHORTCUT_BLOCKED_ELEMENT_FOCUS_MESSAGE = 'This shortcut is unavailable in the current focus context.';
6
- export function emitShortcutBlockedEvent(detail, target) {
7
- const eventDetail = Object.assign(Object.assign({}, detail), { message: detail.message || SHORTCUT_BLOCKED_DEFAULT_MESSAGE });
8
- if (target && typeof target.dispatchEvent === 'function') {
9
- target.dispatchEvent(new CustomEvent(SHORTCUT_BLOCKED_EVENT, {
10
- bubbles: true,
11
- composed: true,
12
- detail: eventDetail,
13
- }));
14
- }
15
- else if (typeof document !== 'undefined') {
16
- document.dispatchEvent(new CustomEvent(SHORTCUT_BLOCKED_EVENT, {
17
- bubbles: true,
18
- composed: true,
19
- detail: eventDetail,
20
- }));
21
- }
22
- }