From 747fdf6815ce2c35be65e190145a7d1f991a030c Mon Sep 17 00:00:00 2001 From: Kyle Andrews Date: Thu, 23 Apr 2020 17:37:28 -0400 Subject: [PATCH 1/2] Updates to v2.0.0 --- CHANGELOG.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60e6052..ca9afdb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,9 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.0.0] - 2020-04-23 + ### Added - refactored elements into web components +- renamed `NotificationManager()` to `Notifier()` + +### Fixed + +- toast components use `node.inserBefore()` instead of forcing the `column-reverse` CSS property to render in the correct order + +### Removed + +- deprecated `position` value +- `notify()` export -- replaced with `snackbar()` ## [1.2.2] - 2020-04-17 @@ -90,7 +102,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Entire existing codebase due to rewrite -[unreleased]: https://github.com/codewithkyle/notifyjs/compare/v1.2.0...HEAD +[unreleased]: https://github.com/codewithkyle/notifyjs/compare/v2.0.0...HEAD +[2.0.0]: https://github.com/codewithkyle/notifyjs/compare/v1.2.0...v2.0.0 [1.2.0]: https://github.com/codewithkyle/notifyjs/compare/v1.1.0...v1.2.0 [1.1.0]: https://github.com/codewithkyle/notifyjs/compare/v1.0.3...v1.1.0 [1.0.3]: https://github.com/codewithkyle/notifyjs/compare/v1.0.2...v1.0.3 From f3483b0bd9c716afd031cdf800eb4bf78a604f56 Mon Sep 17 00:00:00 2001 From: Kyle Andrews Date: Fri, 24 Apr 2020 07:44:33 -0400 Subject: [PATCH 2/2] Fixed toast injection point & typescript declaration issues --- .gitignore | 4 ---- CHANGELOG.md | 5 +++++ notify.d.ts | 31 +++++++++++++++++++++++++++++++ package.json | 7 ++----- src/notifier.ts | 2 +- tsconfig.json | 1 - 6 files changed, 39 insertions(+), 11 deletions(-) create mode 100644 notify.d.ts diff --git a/.gitignore b/.gitignore index e073c91..d88dc44 100644 --- a/.gitignore +++ b/.gitignore @@ -5,13 +5,9 @@ node_modules # ----------- notify.js notify.js.map -notify.d.ts notifier.js notifier.js.map -notifier.d.ts snackbar-component.js snackbar-component.js.map -snackbar-component.d.ts toast-component.js toast-component.js.map -toast-component.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index ca9afdb..2a6e485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- typescript declaration files +- toast injection + ## [2.0.0] - 2020-04-23 ### Added diff --git a/notify.d.ts b/notify.d.ts new file mode 100644 index 0000000..b25ff02 --- /dev/null +++ b/notify.d.ts @@ -0,0 +1,31 @@ +type NotificationButton = { + label: string; + callback: Function; + ariaLabel?: string; + classes?: string[]; +}; + +type SnackbarNotification = { + message: string; + uid: string; + duration?: number; + closeable?: boolean; + buttons?: Array; + force?: boolean; + classes?: string[]; + el: HTMLElement; +}; + +type ToasterNotification = { + title: string; + message: string; + closeable?: boolean; + icon?: string; + duration?: number; + classes?: string[]; + uid: string; + el: HTMLElement; +}; + +declare const snackbar: (settings: SnackbarNotification) => void; +declare const toast: (settings: ToasterNotification) => void; diff --git a/package.json b/package.json index caf680b..2b14057 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@codewithkyle/notifyjs", - "version": "2.0.0", + "version": "2.0.1", "description": "A simple JavaScript library for creating and managing toaster & snackbar notifications", "main": "notify.js", "types": "notify.d.ts", @@ -10,13 +10,10 @@ "notify.d.ts", "notifier.js", "notifier.js.map", - "notifier.d.ts", "snackbar-component.js", "snackbar-component.js.map", - "snackbar-component.d.ts", "toast-component.js", - "toast-component.js.map", - "toast-component.d.ts" + "toast-component.js.map" ], "scripts": { "compile": "tsc", diff --git a/src/notifier.ts b/src/notifier.ts index b94cb92..c74d137 100644 --- a/src/notifier.ts +++ b/src/notifier.ts @@ -180,7 +180,7 @@ export class Notifier { } const lastSlice = shell.querySelector("toast-component") || null; - if (!lastSlice) { + if (lastSlice) { shell.insertBefore(toast.el, lastSlice); } else { shell.appendChild(toast.el); diff --git a/tsconfig.json b/tsconfig.json index 9ac5c9c..b2b2f70 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,7 +9,6 @@ "target": "ES2019", "module": "ESNext", "moduleResolution": "node", - "declaration": true, "lib": ["DOM", "ES2019"] }, "exclude": ["./node_modules"],