@@ -7,7 +7,7 @@ import { ActionReturn, Action } from 'svelte/action';
77 * whenever `svelte-put/shorcut` is imported.
88 */
99export interface ShortcutAttributes {
10- 'on:shortcut ' ?: ( event : CustomEvent < ShortcutEventDetail > ) => void ;
10+ 'onshortcut ' ?: ( event : CustomEvent < ShortcutEventDetail > ) => void ;
1111}
1212
1313/**
@@ -16,8 +16,6 @@ export interface ShortcutAttributes {
1616 * {@link https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/ctrlKey | ctrlKey},
1717 * {@link https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/shiftKey | shiftKey},
1818 * {@link https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/metaKey | metaKey}.
19- *
20- *
2119 */
2220export type ShortcutModifier = 'alt' | 'ctrl' | 'meta' | 'shift' ;
2321
@@ -104,21 +102,18 @@ export type ShortcutModifierDefinition =
104102
105103/**
106104 * A definition of a shortcut trigger
107- *
108105 */
109106export interface ShortcutTrigger {
110107 /**
111108 * whether to enable this triggered. Default to `true`
112109 *
113- *
114- *
115110 * `false` means trigger is disabled,
116111 * but event listener is still placed on node
117112 */
118113 enabled ?: boolean ;
119114 /** modifier key to listen to in conjunction of `key` */
120115 modifier ?: ShortcutModifierDefinition ;
121- /** id to distinguish this trigger from others, recommended when using `on:shortcut ` */
116+ /** id to distinguish this trigger from others, recommended when using `onshortcut ` */
122117 id ?: string ;
123118 /** the {@link https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent | KeyboardEvent}.key to listen to */
124119 key : string ;
@@ -127,19 +122,14 @@ export interface ShortcutTrigger {
127122 /**
128123 * whether to call `event.preventDefault` before firing callback. Default to `false`
129124 *
130- *
131- *
132125 * This is called on the node the action is attached to, not the node that triggers the original `KeyboardEvent`.
133126 * So for example, if `shortcut` is attached to `window`, by the time `preventDefault` is called, the event has already been
134127 * bubbled up to `window`.
135128 */
136129 preventDefault ?: boolean ;
137130}
138131
139- /**
140- * svelte action parameter to config behavior of `shortcut`
141- *
142- */
132+ /** svelte action parameter to config behavior of `shortcut` */
143133export interface ShortcutParameter {
144134 /** whether to activate the action. Default to `true` */
145135 enabled ?: boolean ;
@@ -172,7 +162,7 @@ export interface ShortcutParameter {
172162 * id: 'my-shortcut',
173163 * },
174164 * }}
175- * on:shortcut ={onShortcut}
165+ * onshortcut ={onShortcut}
176166 * />
177167 * ```
178168 */
@@ -184,9 +174,5 @@ export interface ShortcutEventDetail {
184174 /** the original `KeyboardEvent`. Helpful to access the event target, for example */
185175 originalEvent : KeyboardEvent ;
186176}
187-
188- /** */
189177export type ShortcutAction = Action < HTMLElement , ShortcutParameter , ShortcutAttributes > ;
190-
191- /** */
192178export type ShortcutActionReturn = ActionReturn < ShortcutParameter , ShortcutAttributes > ;
0 commit comments