Skip to content

Commit

Permalink
restructure TS
Browse files Browse the repository at this point in the history
  • Loading branch information
bradmartin committed Mar 23, 2017
1 parent d823d42 commit 0cedd72
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 171 deletions.
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![npm](https://img.shields.io/npm/v/mystical-notification.svg)](https://www.npmjs.com/package/mystical-notification)
[![npm](https://img.shields.io/npm/dt/mystical-notification.svg?label=npm%20downloads)](https://www.npmjs.com/package/mystical-notification)
# Mystical-Notification
#### Just some notification crap I needed for a web app. Could use some TLC.
## What is it?
Fully customizable alert notifications. Current types are *alert* and *confirm*. Two positions for now are *top* and *bottom*.



Expand Down Expand Up @@ -31,17 +32,27 @@ mystical.Mystical.alert({
```

### Public Methods
- `alert(options: MysticalOptions)` - show simple notification
- `alert(options: AlertOptions)` - shows simple alert notification
- `confirm(options: ConfirmOptions)` - shows a confirmation notification


### MysticalOptions
### Options Interfaces
```ts
interface MysticalOptions {
interface AlertOptions {
template: string;
backgroundColor?: string;
color?: string;
position?: string; // top or bottom for now
}

interface ConfirmOptions {
template: string;
backgroundColor?: string;
color?: string;
position?: string;
positiveText?: string;
negativeText?: string;
}
```
### Contributing
- `git clone https://github.com/bradmartin/mystical-notification.git`
Expand Down
31 changes: 0 additions & 31 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
export declare class Mystical {
private static bgColor;
private static fgColor;
private static position;
private static positiveText;
private static negativeText;
/**
* Creates a simple notification
* @param opts [MysticalOptions] - The mystical notifications options.
Expand All @@ -14,32 +9,6 @@ export declare class Mystical {
* @param opts [ConfirmOptions]
*/
static confirm(opts: ConfirmOptions): Promise<boolean>;
private static startTransition(defaults, note, top, bottom);
private static setInitStyles(defaults, note);
/**
* Starts the CSS transition and then removes from DOM
* @param id - note to remove
* @param position - note position
*/
private static removeNoteFromDom(id, position);
/**
* Helper for setTimeout with 0
*/
private static tick();
/**
* Helper for setTimeout with passed duration
* @param time [number] - milliseconds to wait
*/
private static wait(time);
/**
* Returns an object with the options object settings - since several args are optional
* @param opts
*/
private static createDefaultOpts(opts);
/**
* Generate random ID
*/
private static generateRandomId();
}
export interface AlertOptions {
template: string;
Expand Down
2 changes: 1 addition & 1 deletion dist/mystical.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "mystical-notification",
"version": "0.3.0",
"version": "0.3.1",
"description": "Web alerts I needed.",
"main": "dist/mystical",
"typings": "index.d.ts",
"typings": "dist/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/bradmartin/mystical-notification"
Expand Down
31 changes: 0 additions & 31 deletions src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
export declare class Mystical {
private static bgColor;
private static fgColor;
private static position;
private static positiveText;
private static negativeText;
/**
* Creates a simple notification
* @param opts [MysticalOptions] - The mystical notifications options.
Expand All @@ -14,32 +9,6 @@ export declare class Mystical {
* @param opts [ConfirmOptions]
*/
static confirm(opts: ConfirmOptions): Promise<boolean>;
private static startTransition(defaults, note, top, bottom);
private static setInitStyles(defaults, note);
/**
* Starts the CSS transition and then removes from DOM
* @param id - note to remove
* @param position - note position
*/
private static removeNoteFromDom(id, position);
/**
* Helper for setTimeout with 0
*/
private static tick();
/**
* Helper for setTimeout with passed duration
* @param time [number] - milliseconds to wait
*/
private static wait(time);
/**
* Returns an object with the options object settings - since several args are optional
* @param opts
*/
private static createDefaultOpts(opts);
/**
* Generate random ID
*/
private static generateRandomId();
}
export interface AlertOptions {
template: string;
Expand Down
Loading

0 comments on commit 0cedd72

Please sign in to comment.