Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,26 @@ 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

- 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

Expand Down Expand Up @@ -90,7 +107,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
Expand Down
31 changes: 31 additions & 0 deletions notify.d.ts
Original file line number Diff line number Diff line change
@@ -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<NotificationButton>;
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;
7 changes: 2 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/notifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"target": "ES2019",
"module": "ESNext",
"moduleResolution": "node",
"declaration": true,
"lib": ["DOM", "ES2019"]
},
"exclude": ["./node_modules"],
Expand Down