From 4b345c13a01a1f511165a38230c68d1439afc82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Mon, 22 Jul 2019 16:22:25 +0100 Subject: [PATCH 1/5] add typescript definition file --- index.d.ts | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 index.d.ts diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..82521bc --- /dev/null +++ b/index.d.ts @@ -0,0 +1,3 @@ +export default class ClipboardCopyElement extends HTMLElement { + value: string +} From 3847935589757cf9c1f9c8aa385a2c2fdbe50868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Mon, 22 Jul 2019 16:23:03 +0100 Subject: [PATCH 2/5] reference typescript file in package.json --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 07b4ee5..1a2220e 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "repository": "github/clipboard-copy-element", "main": "dist/index.umd.js", "module": "dist/index.esm.js", + "types": "index.d.ts", "scripts": { "clean": "rm -rf dist", "lint": "github-lint", @@ -19,7 +20,8 @@ ], "license": "MIT", "files": [ - "dist" + "dist", + "index.d.ts" ], "devDependencies": { "@babel/core": "^7.5.5", From da3030185c48dbda1e85e39d1dfa891fe824c991 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Wed, 24 Jul 2019 14:05:33 +0100 Subject: [PATCH 3/5] export ClipboardCopyElement by default --- src/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.js b/src/index.js index 5aeba38..e3314f9 100644 --- a/src/index.js +++ b/src/index.js @@ -2,6 +2,8 @@ import ClipboardCopyElement from './clipboard-copy-element' +export default ClipboardCopyElement + if (!window.customElements.get('clipboard-copy')) { window.ClipboardCopyElement = ClipboardCopyElement window.customElements.define('clipboard-copy', ClipboardCopyElement) From 4e4791119c732f51ccefce43466ba07ed27aeb6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Tue, 30 Jul 2019 10:28:17 +0100 Subject: [PATCH 4/5] default export class in flow definition file --- src/clipboard-copy-element.js.flow | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clipboard-copy-element.js.flow b/src/clipboard-copy-element.js.flow index f344452..aa2838f 100644 --- a/src/clipboard-copy-element.js.flow +++ b/src/clipboard-copy-element.js.flow @@ -1,6 +1,6 @@ /* @flow strict */ -declare class ClipboardCopyElement extends HTMLElement { +declare export default class ClipboardCopyElement extends HTMLElement { get value(): string; set value(value: string): void; } From ece9825e72aa500b818a76ecfcfd2c6603382ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Oddsson?= Date: Tue, 30 Jul 2019 10:34:35 +0100 Subject: [PATCH 5/5] set a name for the UMD bundle --- rollup.config.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index e1228e6..bdafec1 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -13,7 +13,8 @@ export default { }, { file: pkg['main'], - format: 'umd' + format: 'umd', + name: 'ClipboardCopyElement' } ], plugins: [