From 7a4e596d06ec77e7a12af989466b903d06960e76 Mon Sep 17 00:00:00 2001 From: Jeroen Claassens Date: Wed, 19 May 2021 18:52:43 +0200 Subject: [PATCH] fix(core): fixed type of ClipboardJS.Event not being exported --- packages/core/src/components.d.ts | 3 ++- packages/core/src/components/syntax-highlighter.tsx | 3 ++- packages/core/src/index.ts | 1 + packages/core/src/interfaces.ts | 6 ++++++ 4 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 packages/core/src/interfaces.ts diff --git a/packages/core/src/components.d.ts b/packages/core/src/components.d.ts index 694a3ee..4525536 100644 --- a/packages/core/src/components.d.ts +++ b/packages/core/src/components.d.ts @@ -5,6 +5,7 @@ * It contains typing information for all components that exist in this project. */ import { HTMLStencilElement, JSXBase } from "@stencil/core/internal"; +import { ClipboardJSEvent } from "./interfaces"; export namespace Components { interface SyntaxHighlighter { /** @@ -66,7 +67,7 @@ declare namespace LocalJSX { * @default undefined * @example ```html ``` */ - "onClipboardJsError"?: (event: CustomEvent) => void; + "onClipboardJsError"?: (event: CustomEvent) => void; /** * The theme to use, one of light or dark * @default dark diff --git a/packages/core/src/components/syntax-highlighter.tsx b/packages/core/src/components/syntax-highlighter.tsx index fb8d1bd..4fda88d 100644 --- a/packages/core/src/components/syntax-highlighter.tsx +++ b/packages/core/src/components/syntax-highlighter.tsx @@ -53,6 +53,7 @@ import 'prismjs/components/prism-visual-basic.min.js'; import 'prismjs/components/prism-wasm.min.js'; import 'prismjs/components/prism-wiki.min.js'; import 'prismjs/components/prism-yaml.min.js'; +import type { ClipboardJSEvent } from '../interfaces'; @Component({ tag: 'syntax-highlighter', @@ -107,7 +108,7 @@ export class SyntaxHighlighter implements ComponentWillLoad, ComponentInterface * ``` */ @Event({ bubbles: true }) - public clipboardJsError: EventEmitter; + public clipboardJsError: EventEmitter; /** The internal ref to the code block */ private codeBlockRef: HTMLInputElement; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 07635cb..4d96378 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1 +1,2 @@ export * from './components'; +export * from './interfaces'; diff --git a/packages/core/src/interfaces.ts b/packages/core/src/interfaces.ts new file mode 100644 index 0000000..42c23f4 --- /dev/null +++ b/packages/core/src/interfaces.ts @@ -0,0 +1,6 @@ +export interface ClipboardJSEvent { + action: string; + text: string; + trigger: Element; + clearSelection(): void; +}