typo3-typescript-sources 13.4.23 → 13.4.25

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.
Files changed (107) hide show
  1. package/.last-synced-tag +1 -1
  2. package/README.md +1 -1
  3. package/backend/action-button/deferred-action.ts +0 -2
  4. package/backend/action-button/immediate-action.ts +0 -2
  5. package/backend/clipboard-panel.ts +4 -4
  6. package/backend/code-editor/element/code-mirror-element.ts +1 -1
  7. package/backend/color-picker.ts +4 -5
  8. package/backend/color-scheme-switch.ts +1 -1
  9. package/backend/column-selector-button.ts +1 -1
  10. package/backend/context-menu.ts +3 -3
  11. package/backend/copy-to-clipboard.ts +1 -1
  12. package/backend/drag-tooltip.ts +1 -1
  13. package/backend/element/alert-element.ts +2 -2
  14. package/backend/element/dispatch-modal-button.ts +1 -1
  15. package/backend/element/draggable-resizable-element.ts +1 -1
  16. package/backend/element/editable-page-title.ts +1 -1
  17. package/backend/element/icon-element.ts +2 -2
  18. package/backend/element/pagination.ts +4 -4
  19. package/backend/element/progress-bar-element.ts +2 -2
  20. package/backend/element/progress-tracker-element.ts +2 -2
  21. package/backend/element/pseudo-button.ts +1 -1
  22. package/backend/element/spinner-element.ts +1 -1
  23. package/backend/form-engine/element/extra/char-counter.ts +1 -1
  24. package/backend/form-engine/element/online-media-form-element.ts +1 -1
  25. package/backend/form-engine/element/select-tree-toolbar.ts +1 -1
  26. package/backend/form-engine/element/select-tree.ts +1 -1
  27. package/backend/form-engine/element/suggest/result-container.ts +1 -1
  28. package/backend/form-engine/element/suggest/result-item.ts +1 -1
  29. package/backend/form-engine/element/table-wizard-element.ts +1 -1
  30. package/backend/grid-editor.ts +4 -4
  31. package/backend/hotkeys/events.ts +47 -0
  32. package/backend/hotkeys/hotkey-storage.ts +3 -18
  33. package/backend/hotkeys/hotkey-struct.ts +58 -0
  34. package/backend/hotkeys/negotiator.ts +53 -0
  35. package/backend/hotkeys.ts +27 -46
  36. package/backend/image-manipulation.ts +2 -2
  37. package/backend/live-search/element/backend-search.ts +1 -1
  38. package/backend/live-search/element/hint.ts +1 -1
  39. package/backend/live-search/element/provider/default-result-item.ts +1 -1
  40. package/backend/live-search/element/provider/page-provider-result-item.ts +1 -1
  41. package/backend/live-search/element/result/item/action/action-container.ts +1 -1
  42. package/backend/live-search/element/result/item/action/action.ts +2 -2
  43. package/backend/live-search/element/result/item/item-container.ts +2 -2
  44. package/backend/live-search/element/result/item/item.ts +1 -1
  45. package/backend/live-search/element/result/result-container.ts +6 -1
  46. package/backend/live-search/element/result/result-detail-container.ts +1 -1
  47. package/backend/live-search/element/result/result-pagination.ts +1 -1
  48. package/backend/live-search/element/search-option-item.ts +1 -1
  49. package/backend/live-search/live-search-shortcut.ts +1 -14
  50. package/backend/login-refresh.ts +1 -1
  51. package/backend/login.ts +5 -1
  52. package/backend/modal.ts +5 -5
  53. package/backend/module/iframe.ts +1 -1
  54. package/backend/module/router.ts +1 -1
  55. package/backend/new-content-element-wizard-button.ts +1 -1
  56. package/backend/new-record-wizard.ts +1 -1
  57. package/backend/notification.ts +3 -3
  58. package/backend/pagetsconfig/pagetsconfig-includes.ts +1 -1
  59. package/backend/record-download-button.ts +1 -1
  60. package/backend/security/element/csp-reports.ts +2 -2
  61. package/backend/security/element/sudo-mode.ts +1 -1
  62. package/backend/settings/editor/editable-setting.ts +1 -1
  63. package/backend/settings/editor.ts +1 -1
  64. package/backend/settings/type/base.ts +1 -1
  65. package/backend/settings/type/bool.ts +1 -1
  66. package/backend/settings/type/color.ts +1 -1
  67. package/backend/settings/type/int.ts +2 -2
  68. package/backend/settings/type/number.ts +2 -2
  69. package/backend/settings/type/page.ts +1 -1
  70. package/backend/settings/type/string.ts +2 -2
  71. package/backend/settings/type/stringlist.ts +1 -1
  72. package/backend/switch-user.ts +1 -1
  73. package/backend/toolbar/live-search.ts +4 -2
  74. package/backend/tree/file-storage-browser.ts +1 -1
  75. package/backend/tree/file-storage-tree-container.ts +1 -1
  76. package/backend/tree/page-browser.ts +2 -2
  77. package/backend/tree/page-tree-element.ts +2 -2
  78. package/backend/tree/tree-module-state.ts +1 -1
  79. package/backend/tree/tree-node-toggle.ts +1 -1
  80. package/backend/tree/tree-toolbar.ts +1 -1
  81. package/backend/tree/tree.ts +4 -4
  82. package/backend/viewport/resizable-navigation.ts +1 -1
  83. package/core/authentication/mfa-provider/totp.ts +1 -1
  84. package/core/directive/markdown.ts +2 -2
  85. package/core/lit-helper.ts +2 -2
  86. package/dashboard/dashboard.ts +4 -4
  87. package/extensionmanager/distribution-image.ts +1 -1
  88. package/form/backend/form-editor/component/property-grid-editor.ts +4 -4
  89. package/form/backend/form-editor/core.ts +2 -1
  90. package/install/renderable/flash-message.ts +1 -1
  91. package/install/renderable/info-box.ts +1 -1
  92. package/install/renderable/language-packs.ts +2 -2
  93. package/install/renderable/offset-group.ts +1 -1
  94. package/install/renderable/wrap-group.ts +1 -1
  95. package/package.json +2 -2
  96. package/rte-ckeditor/ckeditor5.ts +1 -1
  97. package/rte-ckeditor/plugin/typo3-link.ts +1 -2
  98. package/scheduler/scheduler-editable-group-name.ts +1 -1
  99. package/styleguide/element/theme-switcher-element.ts +1 -1
  100. package/sys-note/element/delete-button.ts +1 -1
  101. package/tstemplate/template-analyzer.ts +1 -1
  102. package/workspaces/renderable/comment-view.ts +3 -3
  103. package/workspaces/renderable/diff-view.ts +3 -3
  104. package/workspaces/renderable/history-view.ts +3 -3
  105. package/workspaces/renderable/record-information.ts +2 -2
  106. package/workspaces/renderable/record-table.ts +4 -4
  107. package/workspaces/renderable/send-to-stage-form.ts +9 -1
package/.last-synced-tag CHANGED
@@ -1 +1 @@
1
- v13.4.23
1
+ v13.4.25
package/README.md CHANGED
@@ -16,7 +16,7 @@ npm install typo3-typescript-sources
16
16
 
17
17
  - **Original Repository:** [TYPO3/typo3](https://github.com/TYPO3/typo3)
18
18
  - **Source Path:** `Build/Sources/TypeScript/`
19
- - **Current TYPO3 Version:** `v13.4.23`
19
+ - **Current TYPO3 Version:** `v13.4.25`
20
20
 
21
21
  ## 📝 License
22
22
 
@@ -18,8 +18,6 @@ import Icons from '../icons';
18
18
  * Action used when an operation execution time is unknown.
19
19
  */
20
20
  class DeferredAction extends AbstractAction {
21
- protected override callback: () => Promise<void>;
22
-
23
21
  public async execute(el: HTMLAnchorElement|HTMLButtonElement): Promise<void> {
24
22
  el.dataset.actionLabel = el.innerText;
25
23
  el.classList.add('disabled');
@@ -17,8 +17,6 @@ import { AbstractAction } from './abstract-action';
17
17
  * Action used when an operation is executed immediately.
18
18
  */
19
19
  class ImmediateAction extends AbstractAction {
20
- protected override callback: () => void;
21
-
22
20
  public execute(): Promise<void> {
23
21
  return this.executeCallback();
24
22
  }
@@ -12,10 +12,10 @@
12
12
  */
13
13
 
14
14
  import { html, LitElement, nothing, type TemplateResult } from 'lit';
15
- import { customElement, property } from 'lit/decorators';
16
- import { until } from 'lit/directives/until';
17
- import { unsafeHTML } from 'lit/directives/unsafe-html';
18
- import { classMap } from 'lit/directives/class-map';
15
+ import { customElement, property } from 'lit/decorators.js';
16
+ import { until } from 'lit/directives/until.js';
17
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
18
+ import { classMap } from 'lit/directives/class-map.js';
19
19
  import AjaxRequest from '@typo3/core/ajax/ajax-request';
20
20
  import type { AjaxResponse } from '@typo3/core/ajax/ajax-response';
21
21
  import Notification from '@typo3/backend/notification';
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { LitElement, html, css, type TemplateResult } from 'lit';
15
- import { customElement, property, state } from 'lit/decorators';
15
+ import { customElement, property, state } from 'lit/decorators.js';
16
16
  import {
17
17
  EditorView,
18
18
  lineNumbers,
@@ -11,7 +11,7 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { customElement, property, query } from 'lit/decorators';
14
+ import { customElement, property, query } from 'lit/decorators.js';
15
15
  import { css, html, LitElement, type TemplateResult } from 'lit';
16
16
  import Alwan from 'alwan';
17
17
  import RegularEvent from '@typo3/core/event/regular-event';
@@ -38,7 +38,6 @@ export class Typo3BackendColorPicker extends LitElement {
38
38
  height: var(--typo3-colorpicker-preview-height);
39
39
  top: 50%;
40
40
  inset-inline-start: var(--typo3-input-sm-padding-x);
41
- z-index: 1;
42
41
  transform: translate(0, -50%);
43
42
  background: var(--typo3-bg-checkerboard-background-color);
44
43
  background-image: linear-gradient(45deg, var(--typo3-bg-checkerboard-background-image-color) 25%, transparent 25%), linear-gradient(135deg, var(--typo3-bg-checkerboard-background-image-color) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--typo3-bg-checkerboard-background-image-color) 75%), linear-gradient(135deg, transparent 75%, var(--typo3-bg-checkerboard-background-image-color) 75%);
@@ -59,7 +58,7 @@ export class Typo3BackendColorPicker extends LitElement {
59
58
 
60
59
  @property({ type: String }) color: string = '';
61
60
  @property({ type: Boolean }) opacity: boolean = false;
62
- @property({ type: String }) swatches: string = '';
61
+ @property({ type: Array }) swatches: {label: string, color: string}[] = [];
63
62
 
64
63
  // Use a reference to the input slot element
65
64
  @query('slot') slotEl!: HTMLSlotElement;
@@ -83,7 +82,7 @@ export class Typo3BackendColorPicker extends LitElement {
83
82
  position: 'bottom-start',
84
83
  format: 'hex',
85
84
  opacity: this.opacity,
86
- swatches: this.swatches ? this.swatches.split(';') : [],
85
+ swatches: this.swatches,
87
86
  preset: false,
88
87
  color: this.color,
89
88
  });
@@ -141,7 +140,7 @@ class LegacyColorPicker {
141
140
  }
142
141
 
143
142
  const colorPicker = document.createElement('typo3-backend-color-picker');
144
- colorPicker.swatches = options.swatches?.join(';') ?? '';
143
+ colorPicker.swatches = options.swatches.map((swatch: string) => ({ color: swatch, label: swatch }));
145
144
  colorPicker.opacity = options.opacity ?? false;
146
145
  element.parentNode.insertBefore(colorPicker, element);
147
146
  colorPicker.appendChild(element);
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { html, LitElement, nothing, type TemplateResult } from 'lit';
15
- import { customElement, property, state } from 'lit/decorators';
15
+ import { customElement, property, state } from 'lit/decorators.js';
16
16
  import AjaxRequest from '@typo3/core/ajax/ajax-request';
17
17
  import '@typo3/backend/element/icon-element';
18
18
  import type { ColorSchemeUpdateEventData, ColorScheme } from '@typo3/backend/user-settings-manager';
@@ -11,7 +11,7 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { customElement, property } from 'lit/decorators';
14
+ import { customElement, property } from 'lit/decorators.js';
15
15
  import { PseudoButtonLitElement } from '@typo3/backend/element/pseudo-button';
16
16
  import { SeverityEnum } from '@typo3/backend/enum/severity';
17
17
  import { default as Modal, type ModalElement } from '@typo3/backend/modal';
@@ -15,11 +15,11 @@ import { AjaxResponse } from '@typo3/core/ajax/ajax-response';
15
15
  import AjaxRequest from '@typo3/core/ajax/ajax-request';
16
16
  import ContextMenuActions from './context-menu-actions';
17
17
  import '@typo3/backend/element/spinner-element';
18
- import { customElement, queryAll, state } from 'lit/decorators';
18
+ import { customElement, queryAll, state } from 'lit/decorators.js';
19
19
  import { html, LitElement, nothing, type TemplateResult } from 'lit';
20
20
  import { delay } from '@typo3/core/lit-helper';
21
- import { styleMap } from 'lit/directives/style-map';
22
- import { unsafeHTML } from 'lit/directives/unsafe-html';
21
+ import { styleMap } from 'lit/directives/style-map.js';
22
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
23
23
  import { Task, initialState } from '@lit/task';
24
24
  import Notification from '@typo3/backend/notification';
25
25
 
@@ -11,7 +11,7 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { customElement, property } from 'lit/decorators';
14
+ import { customElement, property } from 'lit/decorators.js';
15
15
  import { PseudoButtonLitElement } from '@typo3/backend/element/pseudo-button';
16
16
  import Notification from '@typo3/backend/notification';
17
17
  import { lll } from '@typo3/core/lit-helper';
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { html, LitElement, nothing, type TemplateResult } from 'lit';
15
- import { customElement, property, state } from 'lit/decorators';
15
+ import { customElement, property, state } from 'lit/decorators.js';
16
16
  import { BroadcastMessage } from '@typo3/backend/broadcast-message';
17
17
  import BroadcastService from '@typo3/backend/broadcast-service';
18
18
  import { DataTransferTypes } from '@typo3/backend/enum/data-transfer-types';
@@ -11,9 +11,9 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { customElement, property } from 'lit/decorators';
14
+ import { customElement, property } from 'lit/decorators.js';
15
15
  import { html, LitElement, nothing, type TemplateResult } from 'lit';
16
- import { classMap, type ClassInfo } from 'lit/directives/class-map';
16
+ import { classMap, type ClassInfo } from 'lit/directives/class-map.js';
17
17
  import { SeverityEnum } from '@typo3/backend/enum/severity';
18
18
  import Severity from '../severity';
19
19
  import '@typo3/backend/element/icon-element';
@@ -11,7 +11,7 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { customElement, property } from 'lit/decorators';
14
+ import { customElement, property } from 'lit/decorators.js';
15
15
  import { PseudoButtonLitElement } from '@typo3/backend/element/pseudo-button';
16
16
  import Modal from '@typo3/backend/modal';
17
17
  import { SeverityEnum } from '@typo3/backend/enum/severity';
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { html, LitElement, type TemplateResult, type PropertyValues } from 'lit';
15
- import { customElement, property, state } from 'lit/decorators';
15
+ import { customElement, property, state } from 'lit/decorators.js';
16
16
  import { Offset } from '@typo3/backend/offset';
17
17
 
18
18
  interface Position {
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { html, css, LitElement, type TemplateResult, nothing } from 'lit';
15
- import { customElement, property, state } from 'lit/decorators';
15
+ import { customElement, property, state } from 'lit/decorators.js';
16
16
  import '@typo3/backend/element/icon-element';
17
17
  import AjaxDataHandler from '../ajax-data-handler';
18
18
 
@@ -13,8 +13,8 @@
13
13
 
14
14
  import { html, LitElement, type TemplateResult, nothing } from 'lit';
15
15
  import { Task } from '@lit/task';
16
- import { customElement, property } from 'lit/decorators';
17
- import { unsafeHTML } from 'lit/directives/unsafe-html';
16
+ import { customElement, property } from 'lit/decorators.js';
17
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
18
18
  import { Sizes, States, MarkupIdentifiers } from '../enum/icon-types';
19
19
  import Icons, { IconStyles } from '../icons';
20
20
  import '@typo3/backend/element/spinner-element';
@@ -11,11 +11,11 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { customElement, property } from 'lit/decorators';
14
+ import { customElement, property } from 'lit/decorators.js';
15
15
  import { html, LitElement, type TemplateResult } from 'lit';
16
- import { range } from 'lit/directives/range';
17
- import { map } from 'lit/directives/map';
18
- import { classMap } from 'lit/directives/class-map';
16
+ import { range } from 'lit/directives/range.js';
17
+ import { map } from 'lit/directives/map.js';
18
+ import { classMap } from 'lit/directives/class-map.js';
19
19
 
20
20
  @customElement('typo3-backend-pagination')
21
21
  export class PaginationElement extends LitElement {
@@ -12,8 +12,8 @@
12
12
  */
13
13
 
14
14
  import { css, html, LitElement, nothing, type TemplateResult } from 'lit';
15
- import { customElement, property } from 'lit/decorators';
16
- import { classMap } from 'lit/directives/class-map';
15
+ import { customElement, property } from 'lit/decorators.js';
16
+ import { classMap } from 'lit/directives/class-map.js';
17
17
  import { styleMap } from 'lit/directives/style-map.js';
18
18
  import Severity from '@typo3/backend/severity';
19
19
  import { SeverityEnum } from '@typo3/backend/enum/severity';
@@ -12,8 +12,8 @@
12
12
  */
13
13
 
14
14
  import { css, html, LitElement, nothing, type TemplateResult } from 'lit';
15
- import { customElement, property } from 'lit/decorators';
16
- import { styleMap } from 'lit/directives/style-map';
15
+ import { customElement, property } from 'lit/decorators.js';
16
+ import { styleMap } from 'lit/directives/style-map.js';
17
17
  import { lll } from '@typo3/core/lit-helper';
18
18
 
19
19
  export type Stage = string;
@@ -11,7 +11,7 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { property } from 'lit/decorators';
14
+ import { property } from 'lit/decorators.js';
15
15
  import { html, css, LitElement, type TemplateResult } from 'lit';
16
16
  import { KeyTypesEnum } from '@typo3/backend/enum/key-types';
17
17
 
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { html, LitElement, type TemplateResult } from 'lit';
15
- import { customElement, property } from 'lit/decorators';
15
+ import { customElement, property } from 'lit/decorators.js';
16
16
  import { Sizes } from '../enum/icon-types';
17
17
  import { IconStyles } from '@typo3/backend/icons';
18
18
 
@@ -11,7 +11,7 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { customElement, property, state } from 'lit/decorators';
14
+ import { customElement, property, state } from 'lit/decorators.js';
15
15
  import { html, LitElement, type TemplateResult } from 'lit';
16
16
  import { lll } from '@typo3/core/lit-helper';
17
17
 
@@ -11,7 +11,7 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { customElement, property } from 'lit/decorators';
14
+ import { customElement, property } from 'lit/decorators.js';
15
15
  import { LitElement, type TemplateResult, html } from 'lit';
16
16
 
17
17
  /**
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { html, LitElement, type TemplateResult } from 'lit';
15
- import { customElement } from 'lit/decorators';
15
+ import { customElement } from 'lit/decorators.js';
16
16
  import { lll } from '@typo3/core/lit-helper';
17
17
  import type { SelectTree } from './select-tree';
18
18
  import type { TreeNodeInterface } from '../../tree/tree-node';
@@ -13,7 +13,7 @@
13
13
 
14
14
  import { html, type TemplateResult } from 'lit';
15
15
  import { Tree, type TreeSettings } from '@typo3/backend/tree/tree';
16
- import { customElement, state } from 'lit/decorators';
16
+ import { customElement, state } from 'lit/decorators.js';
17
17
  import type { TreeNodeInterface } from '@typo3/backend/tree/tree-node';
18
18
 
19
19
  interface SelectTreeSettings extends TreeSettings {
@@ -11,7 +11,7 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- import { customElement, property } from 'lit/decorators';
14
+ import { customElement, property } from 'lit/decorators.js';
15
15
  import { css, html, LitElement, type TemplateResult } from 'lit';
16
16
  import { lll } from '@typo3/core/lit-helper';
17
17
  import './result-item';
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { html, type TemplateResult } from 'lit';
15
- import { customElement, property } from 'lit/decorators';
15
+ import { customElement, property } from 'lit/decorators.js';
16
16
  import { PseudoButtonLitElement } from '@typo3/backend/element/pseudo-button';
17
17
  import '@typo3/backend/element/icon-element';
18
18
 
@@ -12,7 +12,7 @@
12
12
  */
13
13
 
14
14
  import { html, LitElement, type TemplateResult } from 'lit';
15
- import { customElement, property } from 'lit/decorators';
15
+ import { customElement, property } from 'lit/decorators.js';
16
16
  import { lll } from '@typo3/core/lit-helper';
17
17
  import '@typo3/backend/element/icon-element';
18
18
  import Modal from '@typo3/backend/modal';
@@ -16,11 +16,11 @@ import { SeverityEnum } from './enum/severity';
16
16
  import 'bootstrap';
17
17
  import { default as Modal, type ModalElement } from '@typo3/backend/modal';
18
18
  import SecurityUtility from '@typo3/core/security-utility';
19
- import { customElement, property } from 'lit/decorators';
19
+ import { customElement, property } from 'lit/decorators.js';
20
20
  import { html, LitElement, nothing, type TemplateResult } from 'lit';
21
- import { classMap } from 'lit/directives/class-map';
22
- import { type StyleInfo, styleMap } from 'lit/directives/style-map';
23
- import { ref, type Ref, createRef } from 'lit/directives/ref';
21
+ import { classMap } from 'lit/directives/class-map.js';
22
+ import { type StyleInfo, styleMap } from 'lit/directives/style-map.js';
23
+ import { ref, type Ref, createRef } from 'lit/directives/ref.js';
24
24
  import { CodeMirrorElement } from '@typo3/backend/code-editor/element/code-mirror-element';
25
25
 
26
26
  type Cell = { spanned: number, rowspan: number, colspan: number, name: string, colpos: string, column: number, identifier: string, slideMode: SlideModes };
@@ -0,0 +1,47 @@
1
+ /*
2
+ * This file is part of the TYPO3 CMS project.
3
+ *
4
+ * It is free software; you can redistribute it and/or modify it under
5
+ * the terms of the GNU General Public License, either version 2
6
+ * of the License, or any later version.
7
+ *
8
+ * For the full copyright and license information, please read the
9
+ * LICENSE.txt file that was distributed with this source code.
10
+ *
11
+ * The TYPO3 project - inspiring people to share!
12
+ */
13
+
14
+ export class HotkeyRequestedEvent extends Event {
15
+ static readonly eventName = 'typo3:hotkey:requested';
16
+
17
+ constructor(
18
+ public readonly keyboardEvent: KeyboardEvent,
19
+ ) {
20
+ super(HotkeyRequestedEvent.eventName, {
21
+ bubbles: true,
22
+ composed: true,
23
+ cancelable: false,
24
+ });
25
+ }
26
+ }
27
+
28
+ export class HotkeyDispatchedEvent extends Event {
29
+ static readonly eventName = 'typo3:hotkey:dispatched';
30
+
31
+ constructor(
32
+ public readonly keyboardEvent: KeyboardEvent,
33
+ ) {
34
+ super(HotkeyDispatchedEvent.eventName, {
35
+ bubbles: false,
36
+ composed: true,
37
+ cancelable: true,
38
+ });
39
+ }
40
+ }
41
+
42
+ declare global {
43
+ interface DocumentEventMap {
44
+ [HotkeyRequestedEvent.eventName]: HotkeyRequestedEvent,
45
+ [HotkeyDispatchedEvent.eventName]: HotkeyDispatchedEvent,
46
+ }
47
+ }
@@ -11,15 +11,8 @@
11
11
  * The TYPO3 project - inspiring people to share!
12
12
  */
13
13
 
14
- export type HotkeyStruct = {
15
- modifiers: {
16
- meta: boolean,
17
- ctrl: boolean,
18
- shift: boolean,
19
- alt: boolean,
20
- },
21
- key: string
22
- };
14
+ import type { HotkeyStruct } from '@typo3/backend/hotkeys/hotkey-struct';
15
+
23
16
  export type HotkeyHandler = (e: KeyboardEvent) => void;
24
17
  export type Options = {
25
18
  scope: string,
@@ -52,12 +45,4 @@ class HotkeyStorage {
52
45
  }
53
46
  }
54
47
 
55
- let hotkeysStorageInstance: HotkeyStorage;
56
- if (!top.TYPO3.HotkeyStorage) {
57
- hotkeysStorageInstance = new HotkeyStorage();
58
- top.TYPO3.HotkeyStorage = hotkeysStorageInstance;
59
- } else {
60
- hotkeysStorageInstance = top.TYPO3.HotkeyStorage;
61
- }
62
-
63
- export default hotkeysStorageInstance;
48
+ export default new HotkeyStorage();
@@ -0,0 +1,58 @@
1
+ /*
2
+ * This file is part of the TYPO3 CMS project.
3
+ *
4
+ * It is free software; you can redistribute it and/or modify it under
5
+ * the terms of the GNU General Public License, either version 2
6
+ * of the License, or any later version.
7
+ *
8
+ * For the full copyright and license information, please read the
9
+ * LICENSE.txt file that was distributed with this source code.
10
+ *
11
+ * The TYPO3 project - inspiring people to share!
12
+ */
13
+
14
+ enum ModifierKeys {
15
+ META = 'meta',
16
+ CTRL = 'control',
17
+ SHIFT = 'shift',
18
+ ALT = 'alt',
19
+ }
20
+
21
+ export class HotkeyStruct {
22
+ constructor(
23
+ public readonly ctrl: boolean,
24
+ public readonly meta: boolean,
25
+ public readonly alt: boolean,
26
+ public readonly shift: boolean,
27
+ public readonly key: string,
28
+ ) {
29
+ }
30
+
31
+
32
+ public static fromEvent(e: KeyboardEvent): HotkeyStruct {
33
+ return new HotkeyStruct(e.ctrlKey, e.metaKey, e.altKey, e.shiftKey, e.key.toLowerCase());
34
+ }
35
+
36
+ public static fromHotkey(hotkey: string[]): HotkeyStruct {
37
+ const nonModifierCodes = hotkey.filter((hotkeyPart: string) => !Object.values<string>(ModifierKeys).includes(hotkeyPart));
38
+ if (nonModifierCodes.length > 1) {
39
+ throw new Error('Cannot create HotkeyStruct with more than one non-modifier key, "' + nonModifierCodes.join('+') + '" given.');
40
+ }
41
+
42
+ return new HotkeyStruct(
43
+ hotkey.includes(ModifierKeys.CTRL),
44
+ hotkey.includes(ModifierKeys.META),
45
+ hotkey.includes(ModifierKeys.ALT),
46
+ hotkey.includes(ModifierKeys.SHIFT),
47
+ nonModifierCodes[0].toLowerCase()
48
+ );
49
+ }
50
+
51
+ public hasAnyModifier(): boolean {
52
+ return this.ctrl || this.meta || this.alt || this.shift;
53
+ }
54
+
55
+ public toString(): string {
56
+ return JSON.stringify(this);
57
+ }
58
+ }
@@ -0,0 +1,53 @@
1
+ /*
2
+ * This file is part of the TYPO3 CMS project.
3
+ *
4
+ * It is free software; you can redistribute it and/or modify it under
5
+ * the terms of the GNU General Public License, either version 2
6
+ * of the License, or any later version.
7
+ *
8
+ * For the full copyright and license information, please read the
9
+ * LICENSE.txt file that was distributed with this source code.
10
+ *
11
+ * The TYPO3 project - inspiring people to share!
12
+ */
13
+
14
+ import { HotkeyDispatchedEvent, HotkeyRequestedEvent } from '@typo3/backend/hotkeys/events';
15
+
16
+ /**
17
+ * Global handler that receives the `typo3:hotkey-requested` event dispatched by any `hotkeys` instance.
18
+ * When receiving such event, all available documents are fetched to dispatch `typo3:hotkey-dispatched` to each document
19
+ * until a responsible handler was found.
20
+ */
21
+ class Negotiator {
22
+ constructor() {
23
+ this.registerEventHandler();
24
+ }
25
+
26
+ private registerEventHandler() {
27
+ document.addEventListener(HotkeyRequestedEvent.eventName, (e): void => {
28
+ const hotkeyDispatchedEvent = new HotkeyDispatchedEvent(e.keyboardEvent);
29
+
30
+ for (const windowDocument of this.collectDocuments()) {
31
+ if (windowDocument.dispatchEvent(hotkeyDispatchedEvent) === false) {
32
+ // Event has been canceled (= hotkey was found)
33
+ break;
34
+ }
35
+ }
36
+ });
37
+ }
38
+
39
+ private collectDocuments(): Document[] {
40
+ const documents: Document[] = [document];
41
+ for (let i = 0; i < window.frames.length; i++) {
42
+ try {
43
+ documents.push(window.frames[i].document);
44
+ } catch {
45
+ // Cross-origin frame, skip
46
+ }
47
+ }
48
+
49
+ return documents;
50
+ }
51
+ }
52
+
53
+ export default new Negotiator();