diff --git a/.changeset/seven-countries-notice.md b/.changeset/seven-countries-notice.md new file mode 100644 index 00000000..4b73dd5f --- /dev/null +++ b/.changeset/seven-countries-notice.md @@ -0,0 +1,5 @@ +--- +'@svelte-put/shortcut': patch +--- + +re-expose public typedef (following https://github.com/Rich-Harris/dts-buddy/pull/82) diff --git a/packages/shortcut/src/index.js b/packages/shortcut/src/index.js index 319f24f7..06441096 100644 --- a/packages/shortcut/src/index.js +++ b/packages/shortcut/src/index.js @@ -1,13 +1,5 @@ // Copyright (c) Quang Phan. All rights reserved. Licensed under the MIT license. export { shortcut } from './shortcut.js'; +export * from './types.public.js'; -/** - * Deprecated, use `ShortcutParameter` instead - * @typedef {import('./public').ShortcutParameter} ShortcutParameters - */ - -/** - * Deprecated, use `ShortcutEventDetail` instead - * @typedef {import('./public').ShortcutEventDetail} ShortcutEventDetails - */ diff --git a/packages/shortcut/src/shortcut.js b/packages/shortcut/src/shortcut.js index 27322ed8..6639e3ff 100644 --- a/packages/shortcut/src/shortcut.js +++ b/packages/shortcut/src/shortcut.js @@ -76,8 +76,8 @@ import { on } from 'svelte/events'; * Either way, only use `callback` or `onshortcut` and not both to * avoid handler duplication. * @param {HTMLElement} node - HTMLElement to add event listener to - * @param {import('./public').ShortcutParameter} param - svelte action parameters - * @returns {import('./public').ShortcutActionReturn} + * @param {import('./types.public').ShortcutParameter} param - svelte action parameters + * @returns {import('./types.public').ShortcutActionReturn} */ export function shortcut(node, param) { let { enabled = true, trigger, type = 'keydown' } = param; @@ -87,7 +87,7 @@ export function shortcut(node, param) { */ function handler(event) { const normalizedTriggers = Array.isArray(trigger) ? trigger : [trigger]; - /** @type {Record} */ + /** @type {Record} */ const modifiedMap = { alt: event.altKey, ctrl: event.ctrlKey, @@ -114,7 +114,7 @@ export function shortcut(node, param) { } if (event.key === key) { if (preventDefault) event.preventDefault(); - /** @type {import('./public').ShortcutEventDetail} */ + /** @type {import('./types.public').ShortcutEventDetail} */ const detail = { node, trigger: mergedTrigger, @@ -152,3 +152,4 @@ export function shortcut(node, param) { }, }; } + diff --git a/packages/shortcut/src/public.d.ts b/packages/shortcut/src/types.public.d.ts similarity index 100% rename from packages/shortcut/src/public.d.ts rename to packages/shortcut/src/types.public.d.ts diff --git a/packages/shortcut/src/types.public.js b/packages/shortcut/src/types.public.js new file mode 100644 index 00000000..710b17ee --- /dev/null +++ b/packages/shortcut/src/types.public.js @@ -0,0 +1,3 @@ +/** to provide typing only, see types.public.d.ts */ +export {}; +