ga-toasts 1.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +327 -554
- package/dist/ga-toasts.css +608 -0
- package/dist/ga-toasts.global.js +2 -0
- package/dist/index.cjs +1242 -0
- package/dist/index.d.cts +247 -0
- package/dist/index.d.ts +247 -0
- package/dist/index.js +1235 -0
- package/package.json +85 -23
- package/.htaccess +0 -75
- package/REDIRECT_SETUP.md +0 -149
- package/ga-toasts.d.ts +0 -99
- package/images/gennie_logo.png +0 -0
- package/index.html +0 -1034
- package/robots.txt +0 -54
- package/sitemap.xml +0 -47
- package/src/demo.css +0 -698
- package/src/demo.js +0 -467
- package/src/toasts.css +0 -1644
- package/src/toasts.js +0 -1005
- package/src/variables.css +0 -480
- package/vercel.json +0 -50
package/package.json
CHANGED
|
@@ -1,23 +1,85 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ga-toasts",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Modern, accessible
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "ga-toasts",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Modern, accessible, dependency-free toast notifications for the web. Fully themeable (createToaster + design tokens), stacked animations, 7 types, 9 positions, dark mode, swipe-to-dismiss, and first-class TypeScript support.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.cjs",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"unpkg": "./dist/ga-toasts.global.js",
|
|
10
|
+
"jsdelivr": "./dist/ga-toasts.global.js",
|
|
11
|
+
"style": "./dist/ga-toasts.css",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"require": {
|
|
19
|
+
"types": "./dist/index.d.cts",
|
|
20
|
+
"default": "./dist/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"./style.css": "./dist/ga-toasts.css",
|
|
24
|
+
"./ga-toasts.css": "./dist/ga-toasts.css",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"sideEffects": [
|
|
33
|
+
"**/*.css"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"gen": "node scripts/gen-styles.mjs",
|
|
37
|
+
"build": "npm run gen && tsup",
|
|
38
|
+
"dev": "npm run gen && tsup --watch",
|
|
39
|
+
"test": "npm run gen && vitest run",
|
|
40
|
+
"test:watch": "npm run gen && vitest",
|
|
41
|
+
"prepublishOnly": "npm run build"
|
|
42
|
+
},
|
|
43
|
+
"keywords": [
|
|
44
|
+
"toast",
|
|
45
|
+
"toasts",
|
|
46
|
+
"notification",
|
|
47
|
+
"notifications",
|
|
48
|
+
"snackbar",
|
|
49
|
+
"alert",
|
|
50
|
+
"vanilla-js",
|
|
51
|
+
"typescript",
|
|
52
|
+
"accessible",
|
|
53
|
+
"a11y",
|
|
54
|
+
"dark-mode",
|
|
55
|
+
"ui",
|
|
56
|
+
"theme",
|
|
57
|
+
"themeable",
|
|
58
|
+
"customizable",
|
|
59
|
+
"swipe",
|
|
60
|
+
"rtl",
|
|
61
|
+
"promise",
|
|
62
|
+
"confirm",
|
|
63
|
+
"zero-dependency",
|
|
64
|
+
"ga-toasts"
|
|
65
|
+
],
|
|
66
|
+
"author": "Harshad Pindoriya",
|
|
67
|
+
"license": "MIT",
|
|
68
|
+
"homepage": "https://harshad-pindoriya.github.io/gatoasts/",
|
|
69
|
+
"repository": {
|
|
70
|
+
"type": "git",
|
|
71
|
+
"url": "git+https://github.com/harshad-pindoriya/gatoasts.git"
|
|
72
|
+
},
|
|
73
|
+
"bugs": {
|
|
74
|
+
"url": "https://github.com/harshad-pindoriya/gatoasts/issues"
|
|
75
|
+
},
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">=16"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"jsdom": "^25.0.1",
|
|
81
|
+
"tsup": "^8.3.5",
|
|
82
|
+
"typescript": "^5.7.2",
|
|
83
|
+
"vitest": "^2.1.8"
|
|
84
|
+
}
|
|
85
|
+
}
|
package/.htaccess
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
# GA Toasts - SEO Redirect Rules
|
|
2
|
-
# Handle www/non-www subdomain redirects and canonical URLs
|
|
3
|
-
|
|
4
|
-
# Enable rewrite engine
|
|
5
|
-
RewriteEngine On
|
|
6
|
-
|
|
7
|
-
# Force HTTPS redirect (uncomment when SSL is available)
|
|
8
|
-
RewriteCond %{HTTPS} off
|
|
9
|
-
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
|
10
|
-
|
|
11
|
-
# Canonical redirect: www to non-www (recommended for SEO)
|
|
12
|
-
RewriteCond %{HTTP_HOST} ^www\.ga-toasts\.com$ [NC]
|
|
13
|
-
RewriteRule ^(.*)$ https://ga-toasts.com/$1 [R=301,L]
|
|
14
|
-
|
|
15
|
-
# Alternative: non-www to www (uncomment if you prefer www)
|
|
16
|
-
# RewriteCond %{HTTP_HOST} ^ga-toasts\.com$ [NC]
|
|
17
|
-
# RewriteRule ^(.*)$ https://www.ga-toasts.com/$1 [R=301,L]
|
|
18
|
-
|
|
19
|
-
# Additional www redirect patterns
|
|
20
|
-
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
|
|
21
|
-
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
|
|
22
|
-
|
|
23
|
-
# Handle both HTTP and HTTPS www redirects
|
|
24
|
-
RewriteCond %{HTTPS} on
|
|
25
|
-
RewriteCond %{HTTP_HOST} ^www\.ga-toasts\.com$ [NC]
|
|
26
|
-
RewriteRule ^(.*)$ https://ga-toasts.com/$1 [R=301,L]
|
|
27
|
-
|
|
28
|
-
RewriteCond %{HTTPS} off
|
|
29
|
-
RewriteCond %{HTTP_HOST} ^www\.ga-toasts\.com$ [NC]
|
|
30
|
-
RewriteRule ^(.*)$ https://ga-toasts.com/$1 [R=301,L]
|
|
31
|
-
|
|
32
|
-
# Remove trailing slashes (optional - helps with duplicate content)
|
|
33
|
-
RewriteCond %{REQUEST_FILENAME} !-d
|
|
34
|
-
RewriteCond %{REQUEST_URI} (.+)/$
|
|
35
|
-
RewriteRule ^ %1 [R=301,L]
|
|
36
|
-
|
|
37
|
-
# Add trailing slash to directories (optional)
|
|
38
|
-
RewriteCond %{REQUEST_FILENAME} -d
|
|
39
|
-
RewriteCond %{REQUEST_URI} !/$
|
|
40
|
-
RewriteRule ^(.*)$ $1/ [R=301,L]
|
|
41
|
-
|
|
42
|
-
# Cache control for better performance
|
|
43
|
-
<IfModule mod_expires.c>
|
|
44
|
-
ExpiresActive On
|
|
45
|
-
ExpiresByType text/css "access plus 1 year"
|
|
46
|
-
ExpiresByType application/javascript "access plus 1 year"
|
|
47
|
-
ExpiresByType image/png "access plus 1 year"
|
|
48
|
-
ExpiresByType image/jpg "access plus 1 year"
|
|
49
|
-
ExpiresByType image/jpeg "access plus 1 year"
|
|
50
|
-
ExpiresByType image/gif "access plus 1 year"
|
|
51
|
-
ExpiresByType image/svg+xml "access plus 1 year"
|
|
52
|
-
ExpiresByType text/html "access plus 1 hour"
|
|
53
|
-
</IfModule>
|
|
54
|
-
|
|
55
|
-
# Security headers
|
|
56
|
-
<IfModule mod_headers.c>
|
|
57
|
-
Header always set X-Content-Type-Options nosniff
|
|
58
|
-
Header always set X-Frame-Options DENY
|
|
59
|
-
Header always set X-XSS-Protection "1; mode=block"
|
|
60
|
-
Header always set Referrer-Policy "strict-origin-when-cross-origin"
|
|
61
|
-
Header always set Permissions-Policy "geolocation=(), microphone=(), camera=()"
|
|
62
|
-
</IfModule>
|
|
63
|
-
|
|
64
|
-
# Gzip compression
|
|
65
|
-
<IfModule mod_deflate.c>
|
|
66
|
-
AddOutputFilterByType DEFLATE text/plain
|
|
67
|
-
AddOutputFilterByType DEFLATE text/html
|
|
68
|
-
AddOutputFilterByType DEFLATE text/xml
|
|
69
|
-
AddOutputFilterByType DEFLATE text/css
|
|
70
|
-
AddOutputFilterByType DEFLATE application/xml
|
|
71
|
-
AddOutputFilterByType DEFLATE application/xhtml+xml
|
|
72
|
-
AddOutputFilterByType DEFLATE application/rss+xml
|
|
73
|
-
AddOutputFilterByType DEFLATE application/javascript
|
|
74
|
-
AddOutputFilterByType DEFLATE application/x-javascript
|
|
75
|
-
</IfModule>
|
package/REDIRECT_SETUP.md
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
# Redirect Setup Guide for GA Toasts
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
This guide helps you set up proper redirects to handle www/non-www subdomain issues and prevent duplicate content problems.
|
|
5
|
-
|
|
6
|
-
## Files Created
|
|
7
|
-
|
|
8
|
-
### 1. `.htaccess` (Apache Servers)
|
|
9
|
-
- **Purpose**: Server-level redirects for Apache web servers
|
|
10
|
-
- **Location**: Root directory of your website
|
|
11
|
-
- **Features**:
|
|
12
|
-
- www → non-www redirects
|
|
13
|
-
- HTTP → HTTPS redirects
|
|
14
|
-
- Performance optimizations
|
|
15
|
-
- Security headers
|
|
16
|
-
|
|
17
|
-
### 2. `_redirects` (Netlify)
|
|
18
|
-
- **Purpose**: Redirect configuration for Netlify hosting
|
|
19
|
-
- **Location**: Root directory or `public` folder
|
|
20
|
-
- **Features**:
|
|
21
|
-
- www → non-www redirects
|
|
22
|
-
- HTTP → HTTPS redirects
|
|
23
|
-
- Catch-all redirects
|
|
24
|
-
|
|
25
|
-
### 3. `vercel.json` (Vercel)
|
|
26
|
-
- **Purpose**: Redirect configuration for Vercel hosting
|
|
27
|
-
- **Location**: Root directory
|
|
28
|
-
- **Features**:
|
|
29
|
-
- Host-based redirects
|
|
30
|
-
- Protocol-based redirects
|
|
31
|
-
- Security headers
|
|
32
|
-
|
|
33
|
-
### 4. HTML Meta Redirects
|
|
34
|
-
- **Purpose**: Client-side fallback redirects
|
|
35
|
-
- **Location**: `<head>` section of `index.html`
|
|
36
|
-
- **Features**:
|
|
37
|
-
- JavaScript redirects
|
|
38
|
-
- Meta refresh redirects
|
|
39
|
-
- Comprehensive hostname handling
|
|
40
|
-
|
|
41
|
-
## Setup Instructions
|
|
42
|
-
|
|
43
|
-
### For Apache Servers
|
|
44
|
-
1. Upload `.htaccess` to your web server root directory
|
|
45
|
-
2. Ensure mod_rewrite is enabled
|
|
46
|
-
3. Test redirects using online tools
|
|
47
|
-
|
|
48
|
-
### For Netlify
|
|
49
|
-
1. Upload `_redirects` file to your site root
|
|
50
|
-
2. Deploy your site
|
|
51
|
-
3. Test redirects
|
|
52
|
-
|
|
53
|
-
### For Vercel
|
|
54
|
-
1. Upload `vercel.json` to your project root
|
|
55
|
-
2. Deploy your site
|
|
56
|
-
3. Test redirects
|
|
57
|
-
|
|
58
|
-
### For Other Hosting Providers
|
|
59
|
-
1. Check your hosting provider's documentation for redirect configuration
|
|
60
|
-
2. Use the HTML meta redirects as fallback
|
|
61
|
-
3. Consider using a CDN with redirect capabilities
|
|
62
|
-
|
|
63
|
-
## Testing Your Redirects
|
|
64
|
-
|
|
65
|
-
### Online Tools
|
|
66
|
-
- [Redirect Checker](https://www.redirectchecker.org/)
|
|
67
|
-
- [HTTP Status Code Checker](https://httpstatus.io/)
|
|
68
|
-
- [SEO Redirect Checker](https://www.seoptimer.com/redirect-checker/)
|
|
69
|
-
|
|
70
|
-
### Manual Testing
|
|
71
|
-
1. Visit `http://www.ga-toasts.com` - should redirect to `https://ga-toasts.com`
|
|
72
|
-
2. Visit `https://www.ga-toasts.com` - should redirect to `https://ga-toasts.com`
|
|
73
|
-
3. Visit `http://ga-toasts.com` - should redirect to `https://ga-toasts.com`
|
|
74
|
-
|
|
75
|
-
### Expected Results
|
|
76
|
-
- **Status Code**: 301 (Permanent Redirect)
|
|
77
|
-
- **Final URL**: `https://ga-toasts.com/`
|
|
78
|
-
- **No Redirect Loops**: Should not redirect infinitely
|
|
79
|
-
|
|
80
|
-
## Troubleshooting
|
|
81
|
-
|
|
82
|
-
### Common Issues
|
|
83
|
-
|
|
84
|
-
#### 1. Redirects Not Working
|
|
85
|
-
- **Check**: Server supports mod_rewrite (Apache)
|
|
86
|
-
- **Check**: File permissions on `.htaccess`
|
|
87
|
-
- **Check**: Hosting provider allows custom redirects
|
|
88
|
-
|
|
89
|
-
#### 2. Infinite Redirect Loops
|
|
90
|
-
- **Fix**: Ensure redirect rules don't conflict
|
|
91
|
-
- **Fix**: Check for conflicting server configurations
|
|
92
|
-
- **Fix**: Verify canonical URL settings
|
|
93
|
-
|
|
94
|
-
#### 3. HTTPS Issues
|
|
95
|
-
- **Check**: SSL certificate is properly installed
|
|
96
|
-
- **Check**: HTTPS redirects are enabled
|
|
97
|
-
- **Check**: Mixed content warnings
|
|
98
|
-
|
|
99
|
-
### Debug Steps
|
|
100
|
-
1. Check server error logs
|
|
101
|
-
2. Use browser developer tools
|
|
102
|
-
3. Test with curl commands
|
|
103
|
-
4. Verify DNS settings
|
|
104
|
-
|
|
105
|
-
## DNS Configuration
|
|
106
|
-
|
|
107
|
-
### Recommended DNS Setup
|
|
108
|
-
```
|
|
109
|
-
A Record: ga-toasts.com → Your Server IP
|
|
110
|
-
CNAME: www.ga-toasts.com → ga-toasts.com
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Alternative DNS Setup
|
|
114
|
-
```
|
|
115
|
-
A Record: ga-toasts.com → Your Server IP
|
|
116
|
-
A Record: www.ga-toasts.com → Your Server IP
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## SEO Considerations
|
|
120
|
-
|
|
121
|
-
### Benefits of Proper Redirects
|
|
122
|
-
- ✅ Prevents duplicate content issues
|
|
123
|
-
- ✅ Consolidates link equity
|
|
124
|
-
- ✅ Improves search engine rankings
|
|
125
|
-
- ✅ Provides consistent user experience
|
|
126
|
-
|
|
127
|
-
### Best Practices
|
|
128
|
-
- Use 301 redirects for permanent redirects
|
|
129
|
-
- Preserve query parameters and fragments
|
|
130
|
-
- Test redirects regularly
|
|
131
|
-
- Monitor for redirect errors
|
|
132
|
-
|
|
133
|
-
## Support
|
|
134
|
-
|
|
135
|
-
If you're still experiencing redirect issues:
|
|
136
|
-
1. Check your hosting provider's documentation
|
|
137
|
-
2. Contact your hosting provider's support
|
|
138
|
-
3. Verify DNS configuration
|
|
139
|
-
4. Test with different browsers and devices
|
|
140
|
-
|
|
141
|
-
## Files to Upload
|
|
142
|
-
|
|
143
|
-
Make sure to upload these files to your web server:
|
|
144
|
-
- ✅ `.htaccess` (for Apache servers)
|
|
145
|
-
- ✅ `_redirects` (for Netlify)
|
|
146
|
-
- ✅ `vercel.json` (for Vercel)
|
|
147
|
-
- ✅ Updated `index.html` (for all hosting)
|
|
148
|
-
|
|
149
|
-
The redirects should work immediately after uploading the appropriate configuration file for your hosting environment.
|
package/ga-toasts.d.ts
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
export type GaToastType =
|
|
2
|
-
| 'success'
|
|
3
|
-
| 'error'
|
|
4
|
-
| 'warning'
|
|
5
|
-
| 'info'
|
|
6
|
-
| 'primary'
|
|
7
|
-
| 'secondary';
|
|
8
|
-
|
|
9
|
-
export type GaToastPosition =
|
|
10
|
-
| 'top-start'
|
|
11
|
-
| 'top-center'
|
|
12
|
-
| 'top-end'
|
|
13
|
-
| 'middle-start'
|
|
14
|
-
| 'middle-center'
|
|
15
|
-
| 'middle-end'
|
|
16
|
-
| 'bottom-start'
|
|
17
|
-
| 'bottom-center'
|
|
18
|
-
| 'bottom-end';
|
|
19
|
-
|
|
20
|
-
export type GaToastAnimation = 'fade' | 'slide' | 'bounce' | 'scale';
|
|
21
|
-
|
|
22
|
-
export type GaToastVariant = '' | 'filled' | 'light';
|
|
23
|
-
|
|
24
|
-
export type GaToastProgressPosition = 'top' | 'bottom' | 'none';
|
|
25
|
-
|
|
26
|
-
export type GaToastSize = '' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
27
|
-
|
|
28
|
-
export interface GaToastAction {
|
|
29
|
-
text: string;
|
|
30
|
-
class?: string;
|
|
31
|
-
click?: (event: Event, toast: HTMLElement | string) => void;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface GaToastOptions {
|
|
35
|
-
id?: string;
|
|
36
|
-
title?: string;
|
|
37
|
-
message?: string;
|
|
38
|
-
type?: GaToastType;
|
|
39
|
-
duration?: number;
|
|
40
|
-
closable?: boolean;
|
|
41
|
-
position?: GaToastPosition;
|
|
42
|
-
icon?: string;
|
|
43
|
-
actions?: GaToastAction[];
|
|
44
|
-
size?: GaToastSize;
|
|
45
|
-
variant?: GaToastVariant;
|
|
46
|
-
animation?: GaToastAnimation;
|
|
47
|
-
clickToClose?: boolean;
|
|
48
|
-
progress?: boolean;
|
|
49
|
-
progressBackground?: boolean;
|
|
50
|
-
pauseOnHover?: boolean;
|
|
51
|
-
glassmorphism?: boolean;
|
|
52
|
-
/** Denser layout with reduced padding */
|
|
53
|
-
compact?: boolean;
|
|
54
|
-
/** Show a small status chip (defaults to capitalized type) */
|
|
55
|
-
showStatus?: boolean;
|
|
56
|
-
statusText?: string;
|
|
57
|
-
/** Automatically choose an icon based on type (default: true) */
|
|
58
|
-
autoIcon?: boolean;
|
|
59
|
-
/** Pin toast (no auto close, visually indicated) */
|
|
60
|
-
pinned?: boolean;
|
|
61
|
-
/** Where to render progress bar */
|
|
62
|
-
progressPosition?: GaToastProgressPosition;
|
|
63
|
-
/** Segmented progress: total steps in a multi-step flow */
|
|
64
|
-
steps?: number;
|
|
65
|
-
/** Segmented progress: current step (1-based) */
|
|
66
|
-
currentStep?: number;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface GaToastsApi {
|
|
70
|
-
show(options: GaToastOptions): HTMLElement;
|
|
71
|
-
success(message: string, options?: GaToastOptions): HTMLElement;
|
|
72
|
-
error(message: string, options?: GaToastOptions): HTMLElement;
|
|
73
|
-
warning(message: string, options?: GaToastOptions): HTMLElement;
|
|
74
|
-
info(message: string, options?: GaToastOptions): HTMLElement;
|
|
75
|
-
confirm(message: string, options?: GaToastOptions & {
|
|
76
|
-
onConfirm?: () => void;
|
|
77
|
-
onCancel?: () => void;
|
|
78
|
-
}): HTMLElement;
|
|
79
|
-
loading(message?: string, options?: GaToastOptions): HTMLElement;
|
|
80
|
-
|
|
81
|
-
close(toast: HTMLElement | string): void;
|
|
82
|
-
closeAll(): void;
|
|
83
|
-
clear(type?: GaToastType): void;
|
|
84
|
-
update(toastId: string, options: Partial<GaToastOptions>): boolean;
|
|
85
|
-
getCount(type?: GaToastType): number;
|
|
86
|
-
exists(toastId: string): boolean;
|
|
87
|
-
get(toastId: string): HTMLElement | null;
|
|
88
|
-
|
|
89
|
-
setDefaults(defaults: GaToastOptions): void;
|
|
90
|
-
setLogger(
|
|
91
|
-
logger: ((event: string, payload: unknown) => void) | null
|
|
92
|
-
): void;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
declare const GaToasts: GaToastsApi;
|
|
96
|
-
|
|
97
|
-
export default GaToasts;
|
|
98
|
-
|
|
99
|
-
|
package/images/gennie_logo.png
DELETED
|
Binary file
|