@elsahafy/ux-mcp-server 2.0.0 → 4.0.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/README.md +159 -18
- package/dist/index.js +2130 -8
- package/knowledge/ai-ml-patterns.json +192 -0
- package/knowledge/analytics-metrics.json +521 -0
- package/knowledge/angular-patterns.json +347 -0
- package/knowledge/ar-vr-interfaces.json +139 -0
- package/knowledge/color-theory.json +499 -0
- package/knowledge/data-viz.json +527 -0
- package/knowledge/design-system-advanced.json +533 -0
- package/knowledge/ecommerce-patterns.json +616 -0
- package/knowledge/ethical-design.json +484 -0
- package/knowledge/finance-ux.json +208 -0
- package/knowledge/forms.json +641 -0
- package/knowledge/haptic-feedback.json +102 -0
- package/knowledge/healthcare-ux.json +209 -0
- package/knowledge/information-architecture.json +494 -0
- package/knowledge/microcopy.json +743 -0
- package/knowledge/mobile-patterns.json +537 -0
- package/knowledge/neurodiversity.json +228 -0
- package/knowledge/pwa-patterns.json +429 -0
- package/knowledge/saas-patterns.json +613 -0
- package/knowledge/testing-validation.json +561 -0
- package/knowledge/typography.json +509 -0
- package/knowledge/voice-ui.json +359 -0
- package/knowledge/vue-patterns.json +279 -0
- package/knowledge/web-components.json +148 -0
- package/package.json +1 -1
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Neurodiversity-Inclusive Design",
|
|
3
|
+
"description": "Designing for neurodivergent users including ADHD, autism, dyslexia, and other cognitive differences",
|
|
4
|
+
"definition": "Neurodiversity recognizes that neurological differences (autism, ADHD, dyslexia, etc.) are natural variations, not deficits. Inclusive design accommodates diverse cognitive needs.",
|
|
5
|
+
"neurodivergent_conditions": {
|
|
6
|
+
"adhd": {
|
|
7
|
+
"characteristics": ["Difficulty focusing", "Easily distracted", "Impulsivity", "Difficulty with organization"],
|
|
8
|
+
"population": "5-10% of adults, 8-12% of children"
|
|
9
|
+
},
|
|
10
|
+
"autism": {
|
|
11
|
+
"characteristics": ["Sensory sensitivities", "Preference for routine", "Literal interpretation", "Social communication differences"],
|
|
12
|
+
"population": "1-2% of population"
|
|
13
|
+
},
|
|
14
|
+
"dyslexia": {
|
|
15
|
+
"characteristics": ["Difficulty reading", "Letter/word reversals", "Slow reading speed"],
|
|
16
|
+
"population": "10-20% of population"
|
|
17
|
+
},
|
|
18
|
+
"dyscalculia": {
|
|
19
|
+
"characteristics": ["Difficulty with numbers", "Math anxiety", "Trouble with time/money"],
|
|
20
|
+
"population": "3-7% of population"
|
|
21
|
+
},
|
|
22
|
+
"anxiety_depression": {
|
|
23
|
+
"characteristics": ["Overwhelm easily", "Need for control", "Avoidance of difficult tasks"],
|
|
24
|
+
"population": "~20% of adults"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"design_principles": {
|
|
28
|
+
"reduce_cognitive_load": {
|
|
29
|
+
"description": "Make tasks easier to process",
|
|
30
|
+
"practices": [
|
|
31
|
+
"One task per screen",
|
|
32
|
+
"Clear visual hierarchy",
|
|
33
|
+
"Chunk information",
|
|
34
|
+
"Progressive disclosure",
|
|
35
|
+
"Avoid sensory overload (animations, sounds)"
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"support_focus": {
|
|
39
|
+
"description": "Help users stay on task (ADHD)",
|
|
40
|
+
"practices": [
|
|
41
|
+
"Minimize distractions (no auto-play, popups)",
|
|
42
|
+
"Focus mode (hide non-essential UI)",
|
|
43
|
+
"Progress indicators (show how much left)",
|
|
44
|
+
"Break long tasks into steps",
|
|
45
|
+
"Allow saving and resuming"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"provide_consistency": {
|
|
49
|
+
"description": "Predictable patterns reduce anxiety (autism)",
|
|
50
|
+
"practices": [
|
|
51
|
+
"Consistent navigation",
|
|
52
|
+
"Same actions in same places",
|
|
53
|
+
"Clear labels (no clever copy)",
|
|
54
|
+
"Warn before changes",
|
|
55
|
+
"Avoid sudden changes"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"flexibility": {
|
|
59
|
+
"description": "Allow customization for individual needs",
|
|
60
|
+
"practices": [
|
|
61
|
+
"Adjustable text size, spacing, contrast",
|
|
62
|
+
"Dark mode option",
|
|
63
|
+
"Disable animations",
|
|
64
|
+
"Keyboard shortcuts",
|
|
65
|
+
"Customizable interface"
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"specific_accommodations": {
|
|
70
|
+
"adhd": {
|
|
71
|
+
"focus": [
|
|
72
|
+
"Minimize distractions (no auto-play, limit notifications)",
|
|
73
|
+
"Single-task interface (no sidebars during task)",
|
|
74
|
+
"Timers and reminders",
|
|
75
|
+
"Progress tracking (gamification)",
|
|
76
|
+
"Allow hyperfocus (don't interrupt with popups)"
|
|
77
|
+
],
|
|
78
|
+
"organization": [
|
|
79
|
+
"Clear categorization",
|
|
80
|
+
"Search and filters",
|
|
81
|
+
"Tags and labels",
|
|
82
|
+
"Auto-save (don't lose work)",
|
|
83
|
+
"Task lists and deadlines"
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
"autism": {
|
|
87
|
+
"sensory": [
|
|
88
|
+
"Reduce sensory input (mute auto-play, limit animations)",
|
|
89
|
+
"High contrast mode",
|
|
90
|
+
"Avoid flashing (seizure risk, also overwhelming)",
|
|
91
|
+
"Simple, clean design"
|
|
92
|
+
],
|
|
93
|
+
"communication": [
|
|
94
|
+
"Literal language (no idioms, sarcasm)",
|
|
95
|
+
"Clear instructions (explicit steps)",
|
|
96
|
+
"Visual aids (icons, images)",
|
|
97
|
+
"No ambiguity"
|
|
98
|
+
],
|
|
99
|
+
"routine": [
|
|
100
|
+
"Predictable navigation",
|
|
101
|
+
"Consistent layout",
|
|
102
|
+
"Warn before updates (change is stressful)",
|
|
103
|
+
"Allow customization (control)"
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
"dyslexia": {
|
|
107
|
+
"reading": [
|
|
108
|
+
"Sans-serif fonts (Arial, Verdana) or dyslexia fonts (OpenDyslexic)",
|
|
109
|
+
"Larger text (16px+)",
|
|
110
|
+
"Increased line spacing (1.5-2)",
|
|
111
|
+
"Shorter line length (50-70 characters)",
|
|
112
|
+
"Left-aligned (not justified)",
|
|
113
|
+
"Avoid walls of text (chunk content)",
|
|
114
|
+
"Use headings and bullets"
|
|
115
|
+
],
|
|
116
|
+
"support": [
|
|
117
|
+
"Text-to-speech option",
|
|
118
|
+
"Spell-check and autocorrect",
|
|
119
|
+
"Search instead of browse",
|
|
120
|
+
"Visual aids (icons, images)"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"anxiety": {
|
|
124
|
+
"control": [
|
|
125
|
+
"Clear next steps",
|
|
126
|
+
"Undo option",
|
|
127
|
+
"Save progress (no pressure)",
|
|
128
|
+
"No timers (unless necessary)",
|
|
129
|
+
"Non-judgmental language"
|
|
130
|
+
],
|
|
131
|
+
"reassurance": [
|
|
132
|
+
"Progress indicators",
|
|
133
|
+
"Confirmation messages",
|
|
134
|
+
"Help easily accessible",
|
|
135
|
+
"No sudden errors",
|
|
136
|
+
"Gentle error messages"
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"ui_patterns": {
|
|
141
|
+
"simple_navigation": {
|
|
142
|
+
"avoid": "Mega menus, hidden navigation, complex hierarchies",
|
|
143
|
+
"prefer": "Clear, visible navigation, breadcrumbs, search"
|
|
144
|
+
},
|
|
145
|
+
"clear_labels": {
|
|
146
|
+
"avoid": "Icons without labels, clever copy, ambiguous terms",
|
|
147
|
+
"prefer": "Text labels, simple language, tooltips"
|
|
148
|
+
},
|
|
149
|
+
"reduced_animation": {
|
|
150
|
+
"respect": "prefers-reduced-motion media query",
|
|
151
|
+
"implementation": "@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }"
|
|
152
|
+
},
|
|
153
|
+
"focus_mode": {
|
|
154
|
+
"feature": "Hide non-essential UI to reduce distraction",
|
|
155
|
+
"examples": "Zen mode (writing apps), Focus mode (Windows 11), Do Not Disturb"
|
|
156
|
+
},
|
|
157
|
+
"customization": {
|
|
158
|
+
"options": ["Font size", "Font family", "Line spacing", "Color scheme", "Layout density"],
|
|
159
|
+
"implementation": "Settings panel, remember preferences"
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
"content_guidelines": {
|
|
163
|
+
"plain_language": {
|
|
164
|
+
"practices": ["Short sentences (< 25 words)", "Common words (not jargon)", "Active voice", "One idea per sentence"]
|
|
165
|
+
},
|
|
166
|
+
"structure": {
|
|
167
|
+
"practices": ["Headings and subheadings", "Bullet points", "Short paragraphs (3-4 sentences)", "White space"],
|
|
168
|
+
"avoid": "Walls of text, complex sentences, passive voice"
|
|
169
|
+
},
|
|
170
|
+
"visual_support": {
|
|
171
|
+
"practices": ["Icons with labels", "Images to explain concepts", "Diagrams for complex info", "Videos (with captions)"]
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"testing": {
|
|
175
|
+
"user_testing": {
|
|
176
|
+
"participants": "Include neurodivergent users (ADHD, autism, dyslexia)",
|
|
177
|
+
"scenarios": "Real tasks, observe struggles",
|
|
178
|
+
"feedback": "Ask about overwhelm, confusion, stress"
|
|
179
|
+
},
|
|
180
|
+
"tools": {
|
|
181
|
+
"readability": "Hemingway Editor, Grammarly (reading level)",
|
|
182
|
+
"dyslexia_simulation": "Dyslexia simulator browser extensions",
|
|
183
|
+
"screen_reader": "Test with NVDA, JAWS (many neurodivergent users rely on it)"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"best_practices": [
|
|
187
|
+
"Simple, clean design (avoid clutter)",
|
|
188
|
+
"One task per screen",
|
|
189
|
+
"Clear, literal language",
|
|
190
|
+
"Consistent navigation and layout",
|
|
191
|
+
"Allow customization (font, spacing, colors)",
|
|
192
|
+
"Respect prefers-reduced-motion",
|
|
193
|
+
"No auto-play (videos, sounds)",
|
|
194
|
+
"Progress indicators and save points",
|
|
195
|
+
"Undo option",
|
|
196
|
+
"Help easily accessible",
|
|
197
|
+
"Large touch targets (44x44px+)",
|
|
198
|
+
"High contrast mode option",
|
|
199
|
+
"Text-to-speech support",
|
|
200
|
+
"Chunk content (headings, bullets)",
|
|
201
|
+
"Gentle error messages",
|
|
202
|
+
"Test with neurodivergent users"
|
|
203
|
+
],
|
|
204
|
+
"anti_patterns": [
|
|
205
|
+
"Cluttered, busy interfaces",
|
|
206
|
+
"Auto-play videos/sounds",
|
|
207
|
+
"Flashing or rapid animations",
|
|
208
|
+
"Clever copy (use literal language)",
|
|
209
|
+
"Hidden navigation",
|
|
210
|
+
"Complex multi-step tasks without save",
|
|
211
|
+
"No undo option",
|
|
212
|
+
"Tiny text (< 14px)",
|
|
213
|
+
"Justified text (rivers of white space)",
|
|
214
|
+
"Walls of text",
|
|
215
|
+
"Ambiguous icons without labels",
|
|
216
|
+
"Sudden, unexpected changes",
|
|
217
|
+
"Timed tasks (pressure)",
|
|
218
|
+
"Inaccessible error messages",
|
|
219
|
+
"No way to customize interface"
|
|
220
|
+
],
|
|
221
|
+
"resources": [
|
|
222
|
+
"ADHD-Friendly Design (ADHD Foundation)",
|
|
223
|
+
"Autism-Friendly Design (National Autistic Society)",
|
|
224
|
+
"Dyslexia Style Guide (British Dyslexia Association)",
|
|
225
|
+
"Neurodiversity Design System (Microsoft)",
|
|
226
|
+
"Inclusive Design for Cognition (W3C)"
|
|
227
|
+
]
|
|
228
|
+
}
|
|
@@ -0,0 +1,429 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Progressive Web App (PWA) Patterns",
|
|
3
|
+
"description": "Comprehensive guide to building progressive web apps with optimal UX patterns and best practices",
|
|
4
|
+
"definition": "Progressive Web Apps are web applications that use modern web capabilities to deliver app-like experiences to users. They work for every user, regardless of browser, are responsive, connectivity-independent, fresh, safe, discoverable, re-engageable, installable, and linkable.",
|
|
5
|
+
"core_characteristics": {
|
|
6
|
+
"progressive": "Work for every user, regardless of browser choice (progressive enhancement)",
|
|
7
|
+
"responsive": "Fit any form factor: desktop, mobile, tablet, or future devices",
|
|
8
|
+
"connectivity_independent": "Work offline or on low-quality networks (service workers)",
|
|
9
|
+
"app_like": "Feel like an app with app-style interactions and navigation",
|
|
10
|
+
"fresh": "Always up-to-date (service worker update process)",
|
|
11
|
+
"safe": "Served via HTTPS to prevent snooping and ensure content integrity",
|
|
12
|
+
"discoverable": "Identifiable as 'applications' via web app manifest",
|
|
13
|
+
"re_engageable": "Make re-engagement easy through push notifications",
|
|
14
|
+
"installable": "Allow users to 'add to home screen' without app store",
|
|
15
|
+
"linkable": "Share via URL, don't require complex installation"
|
|
16
|
+
},
|
|
17
|
+
"core_technologies": {
|
|
18
|
+
"service_workers": {
|
|
19
|
+
"description": "JavaScript that runs in the background, separate from web page",
|
|
20
|
+
"capabilities": ["Offline functionality", "Background sync", "Push notifications", "Caching strategies", "Network interception"],
|
|
21
|
+
"lifecycle": {
|
|
22
|
+
"register": {
|
|
23
|
+
"when": "On page load (after window.load to not block rendering)",
|
|
24
|
+
"code": "if ('serviceWorker' in navigator) {\n window.addEventListener('load', () => {\n navigator.serviceWorker.register('/sw.js');\n });\n}"
|
|
25
|
+
},
|
|
26
|
+
"install": {
|
|
27
|
+
"event": "First time SW is downloaded",
|
|
28
|
+
"use": "Cache essential assets (app shell)",
|
|
29
|
+
"code": "self.addEventListener('install', event => {\n event.waitUntil(\n caches.open('v1').then(cache => {\n return cache.addAll(['/index.html', '/styles.css', '/app.js']);\n })\n );\n});"
|
|
30
|
+
},
|
|
31
|
+
"activate": {
|
|
32
|
+
"event": "After install, when SW takes control",
|
|
33
|
+
"use": "Clean up old caches",
|
|
34
|
+
"code": "self.addEventListener('activate', event => {\n event.waitUntil(\n caches.keys().then(names => {\n return Promise.all(\n names.filter(name => name !== 'v1').map(name => caches.delete(name))\n );\n })\n );\n});"
|
|
35
|
+
},
|
|
36
|
+
"fetch": {
|
|
37
|
+
"event": "Every network request",
|
|
38
|
+
"use": "Intercept requests, serve from cache or network",
|
|
39
|
+
"code": "self.addEventListener('fetch', event => {\n event.respondWith(\n caches.match(event.request).then(response => {\n return response || fetch(event.request);\n })\n );\n});"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"caching_strategies": {
|
|
43
|
+
"cache_first": {
|
|
44
|
+
"description": "Serve from cache, fallback to network",
|
|
45
|
+
"use_when": "Static assets (CSS, JS, images)",
|
|
46
|
+
"pattern": "caches.match(request) || fetch(request)",
|
|
47
|
+
"pros": ["Fast", "Offline support"],
|
|
48
|
+
"cons": ["May serve stale content"]
|
|
49
|
+
},
|
|
50
|
+
"network_first": {
|
|
51
|
+
"description": "Try network, fallback to cache",
|
|
52
|
+
"use_when": "API calls, dynamic content",
|
|
53
|
+
"pattern": "fetch(request).catch(() => caches.match(request))",
|
|
54
|
+
"pros": ["Fresh content when online"],
|
|
55
|
+
"cons": ["Slower when network is slow"]
|
|
56
|
+
},
|
|
57
|
+
"stale_while_revalidate": {
|
|
58
|
+
"description": "Serve from cache, update cache in background",
|
|
59
|
+
"use_when": "Balance freshness and speed (images, non-critical data)",
|
|
60
|
+
"pattern": "Cache response AND fetch to update cache",
|
|
61
|
+
"pros": ["Fast + eventually fresh"],
|
|
62
|
+
"cons": ["May serve slightly stale content"]
|
|
63
|
+
},
|
|
64
|
+
"cache_only": {
|
|
65
|
+
"description": "Only serve from cache (never network)",
|
|
66
|
+
"use_when": "Fully offline apps, precached content",
|
|
67
|
+
"pattern": "caches.match(request)",
|
|
68
|
+
"cons": ["No updates after install"]
|
|
69
|
+
},
|
|
70
|
+
"network_only": {
|
|
71
|
+
"description": "Always use network (no caching)",
|
|
72
|
+
"use_when": "Real-time data, analytics",
|
|
73
|
+
"pattern": "fetch(request)",
|
|
74
|
+
"cons": ["Fails offline"]
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"update_pattern": {
|
|
78
|
+
"description": "How to handle service worker updates",
|
|
79
|
+
"detection": "Listen for 'updatefound' event on registration",
|
|
80
|
+
"user_notification": "Show 'Update available' message with 'Reload' button",
|
|
81
|
+
"best_practice": "Don't force reload (let user choose)",
|
|
82
|
+
"code": "registration.addEventListener('updatefound', () => {\n const newWorker = registration.installing;\n newWorker.addEventListener('statechange', () => {\n if (newWorker.state === 'installed' && navigator.serviceWorker.controller) {\n // New version available, show update prompt\n showUpdateNotification();\n }\n });\n});"
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"web_app_manifest": {
|
|
86
|
+
"description": "JSON file that describes the app (name, icons, display mode)",
|
|
87
|
+
"file": "manifest.json",
|
|
88
|
+
"link": "<link rel='manifest' href='/manifest.json'>",
|
|
89
|
+
"required_fields": {
|
|
90
|
+
"name": { "description": "Full name of the app", "example": "My Awesome PWA" },
|
|
91
|
+
"short_name": { "description": "Short name for home screen (12 chars max)", "example": "AwesomePWA" },
|
|
92
|
+
"start_url": { "description": "URL to load on launch", "example": "/" },
|
|
93
|
+
"display": {
|
|
94
|
+
"description": "Display mode",
|
|
95
|
+
"options": {
|
|
96
|
+
"fullscreen": "No browser UI (games, immersive apps)",
|
|
97
|
+
"standalone": "Looks like native app (recommended for most PWAs)",
|
|
98
|
+
"minimal-ui": "Minimal browser UI (back button, refresh)",
|
|
99
|
+
"browser": "Normal browser tab"
|
|
100
|
+
},
|
|
101
|
+
"recommended": "standalone"
|
|
102
|
+
},
|
|
103
|
+
"background_color": { "description": "Splash screen background", "example": "#ffffff" },
|
|
104
|
+
"theme_color": { "description": "UI chrome color (address bar on mobile)", "example": "#4285f4" },
|
|
105
|
+
"icons": {
|
|
106
|
+
"description": "Array of icon objects",
|
|
107
|
+
"sizes_required": ["192x192 (minimum)", "512x512 (recommended)", "maskable icon"],
|
|
108
|
+
"example": "[\n { \"src\": \"/icon-192.png\", \"sizes\": \"192x192\", \"type\": \"image/png\" },\n { \"src\": \"/icon-512.png\", \"sizes\": \"512x512\", \"type\": \"image/png\" },\n { \"src\": \"/icon-maskable.png\", \"sizes\": \"196x196\", \"type\": \"image/png\", \"purpose\": \"maskable\" }\n]"
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"optional_fields": {
|
|
112
|
+
"description": { "description": "What the app does", "example": "A fast and reliable way to..." },
|
|
113
|
+
"orientation": { "description": "Portrait or landscape", "options": ["any", "portrait", "landscape"] },
|
|
114
|
+
"scope": { "description": "Navigation scope", "example": "/" },
|
|
115
|
+
"screenshots": { "description": "App screenshots for install prompt", "sizes": "540x720 or 1280x720" },
|
|
116
|
+
"categories": { "description": "App categories", "example": ["productivity", "utilities"] },
|
|
117
|
+
"shortcuts": {
|
|
118
|
+
"description": "Quick actions from home screen",
|
|
119
|
+
"example": "[\n { \"name\": \"New Note\", \"url\": \"/new\", \"icon\": \"/new-icon.png\" }\n]"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"maskable_icons": {
|
|
123
|
+
"description": "Icons that adapt to different shapes (Android adaptive icons)",
|
|
124
|
+
"safe_zone": "80% of icon in center (20% may be masked)",
|
|
125
|
+
"purpose": "\"maskable\"",
|
|
126
|
+
"tool": "https://maskable.app/ for preview"
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"https_requirement": {
|
|
130
|
+
"description": "PWAs must be served over HTTPS",
|
|
131
|
+
"why": "Service workers have powerful capabilities (intercept network requests)",
|
|
132
|
+
"exception": "localhost (for development)",
|
|
133
|
+
"deployment": ["Use Let's Encrypt (free SSL)", "Cloudflare (free SSL)", "Netlify/Vercel (automatic HTTPS)"]
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"ux_patterns": {
|
|
137
|
+
"app_shell_pattern": {
|
|
138
|
+
"description": "Cache minimal HTML/CSS/JS to display app UI, load content dynamically",
|
|
139
|
+
"components": {
|
|
140
|
+
"shell": "Header, navigation, footer (cached, always available)",
|
|
141
|
+
"content": "Dynamic content (fetched as needed)"
|
|
142
|
+
},
|
|
143
|
+
"benefits": ["Fast initial load", "Works offline (shows shell even without content)"],
|
|
144
|
+
"implementation": "Cache shell assets in service worker install event",
|
|
145
|
+
"example_apps": "Twitter Lite, Google Maps"
|
|
146
|
+
},
|
|
147
|
+
"offline_fallback": {
|
|
148
|
+
"description": "Show meaningful offline page instead of browser's default",
|
|
149
|
+
"types": {
|
|
150
|
+
"offline_page": {
|
|
151
|
+
"description": "Generic 'You are offline' page",
|
|
152
|
+
"content": ["Clear message", "Cached content available", "Try again button"],
|
|
153
|
+
"cache_in": "Service worker install event"
|
|
154
|
+
},
|
|
155
|
+
"offline_ux": {
|
|
156
|
+
"description": "Graceful degradation",
|
|
157
|
+
"patterns": [
|
|
158
|
+
"Show cached version with 'Offline' indicator",
|
|
159
|
+
"Disable actions that require network (dim buttons)",
|
|
160
|
+
"Show last sync time",
|
|
161
|
+
"Queue actions for background sync"
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
"best_practices": [
|
|
166
|
+
"Don't just show 'No connection' (offer cached content)",
|
|
167
|
+
"Make it clear what's available offline",
|
|
168
|
+
"Use background sync to sync when back online",
|
|
169
|
+
"Show sync status (syncing, synced, failed)"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
"add_to_home_screen": {
|
|
173
|
+
"description": "Prompt users to install PWA to home screen",
|
|
174
|
+
"criteria": {
|
|
175
|
+
"automatic": "Browser shows prompt if criteria met (HTTPS, manifest, service worker, engagement)",
|
|
176
|
+
"manual": "You can defer and show custom prompt"
|
|
177
|
+
},
|
|
178
|
+
"deferring_prompt": {
|
|
179
|
+
"code": "let deferredPrompt;\nwindow.addEventListener('beforeinstallprompt', (e) => {\n e.preventDefault();\n deferredPrompt = e;\n showInstallPromo(); // Your custom UI\n});\n\ninstallButton.addEventListener('click', async () => {\n deferredPrompt.prompt();\n const { outcome } = await deferredPrompt.userChoice;\n console.log(outcome); // 'accepted' or 'dismissed'\n deferredPrompt = null;\n});",
|
|
180
|
+
"when_to_show": ["After user engages (not immediately)", "Contextual moment (completed task successfully)", "Dismissible (don't force)"]
|
|
181
|
+
},
|
|
182
|
+
"install_ux": {
|
|
183
|
+
"placement": ["Floating button (bottom-right)", "Banner (top or bottom)", "Within empty state", "After successful action"],
|
|
184
|
+
"messaging": ["Clear value prop ('Access faster', 'Works offline')", "Short and actionable", "Not pushy"],
|
|
185
|
+
"examples": {
|
|
186
|
+
"good": "Install for faster access and offline use",
|
|
187
|
+
"bad": "Install our app now!"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"post_install": {
|
|
191
|
+
"detection": "window.addEventListener('appinstalled', ...)",
|
|
192
|
+
"ux": ["Hide install prompt", "Show onboarding (if first launch)", "Track analytics"]
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"push_notifications": {
|
|
196
|
+
"description": "Re-engage users with timely notifications",
|
|
197
|
+
"permission_flow": {
|
|
198
|
+
"1_explain": "Explain value BEFORE asking permission",
|
|
199
|
+
"2_ask": "Request permission only after user interaction",
|
|
200
|
+
"3_respect": "If denied, don't ask again (browser blocks)"
|
|
201
|
+
},
|
|
202
|
+
"best_practices": [
|
|
203
|
+
"Never ask for permission on page load",
|
|
204
|
+
"Explain why notifications are valuable",
|
|
205
|
+
"Provide notification settings (frequency, types)",
|
|
206
|
+
"Allow users to disable notifications",
|
|
207
|
+
"Make notifications relevant and timely",
|
|
208
|
+
"Don't spam (reduce frequency if not engaging)"
|
|
209
|
+
],
|
|
210
|
+
"notification_anatomy": {
|
|
211
|
+
"title": { "required": true, "example": "New message from Sarah" },
|
|
212
|
+
"body": { "optional": true, "example": "Hey, are you free for coffee?" },
|
|
213
|
+
"icon": { "optional": true, "size": "192x192 or 512x512" },
|
|
214
|
+
"badge": { "optional": true, "description": "Small icon (72x72)" },
|
|
215
|
+
"image": { "optional": true, "description": "Large image (2:1 ratio)" },
|
|
216
|
+
"actions": { "optional": true, "example": "[{action: 'reply', title: 'Reply'}, {action: 'dismiss', title: 'Dismiss'}]" },
|
|
217
|
+
"tag": { "optional": true, "use": "Replace previous notifications with same tag" }
|
|
218
|
+
},
|
|
219
|
+
"when_to_use": ["New messages/emails", "Order updates", "Social interactions", "Time-sensitive alerts"],
|
|
220
|
+
"when_not_to_use": ["Marketing spam", "Trivial updates", "Non-urgent info", "Asking for permission immediately"]
|
|
221
|
+
},
|
|
222
|
+
"background_sync": {
|
|
223
|
+
"description": "Defer actions until stable connection (send message, post form)",
|
|
224
|
+
"use_cases": ["Send chat message while offline", "Submit form", "Upload photo", "Like/favorite action"],
|
|
225
|
+
"user_experience": [
|
|
226
|
+
"Show action as pending (dim, 'Sending...')",
|
|
227
|
+
"Queue action in background",
|
|
228
|
+
"Sync when online",
|
|
229
|
+
"Show success/failure notification"
|
|
230
|
+
],
|
|
231
|
+
"code_pattern": "navigator.serviceWorker.ready.then(registration => {\n return registration.sync.register('post-message');\n});\n\n// In service worker:\nself.addEventListener('sync', event => {\n if (event.tag === 'post-message') {\n event.waitUntil(sendPendingMessages());\n }\n});"
|
|
232
|
+
},
|
|
233
|
+
"app_updates": {
|
|
234
|
+
"description": "How to handle PWA updates gracefully",
|
|
235
|
+
"patterns": {
|
|
236
|
+
"silent_update": {
|
|
237
|
+
"description": "Update in background, apply on next load",
|
|
238
|
+
"pro": "No interruption",
|
|
239
|
+
"con": "User may miss new features"
|
|
240
|
+
},
|
|
241
|
+
"prompt_update": {
|
|
242
|
+
"description": "Show 'Update available' banner",
|
|
243
|
+
"pro": "User is informed",
|
|
244
|
+
"con": "Slight interruption",
|
|
245
|
+
"recommended": true,
|
|
246
|
+
"ux": "Non-blocking banner with 'Update' and 'Dismiss' buttons"
|
|
247
|
+
},
|
|
248
|
+
"force_update": {
|
|
249
|
+
"description": "Reload page immediately on update",
|
|
250
|
+
"pro": "Always latest version",
|
|
251
|
+
"con": "Disruptive (may lose unsaved data)",
|
|
252
|
+
"use_only": "Critical security fixes"
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
"best_practice": "Prompt user, but don't force. Let them choose when to update."
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"performance_patterns": {
|
|
259
|
+
"lazy_loading": {
|
|
260
|
+
"description": "Load resources only when needed",
|
|
261
|
+
"techniques": {
|
|
262
|
+
"images": "loading='lazy' attribute or Intersection Observer",
|
|
263
|
+
"routes": "Code-split by route (React.lazy, dynamic import)",
|
|
264
|
+
"components": "Below-the-fold components loaded on scroll"
|
|
265
|
+
}
|
|
266
|
+
},
|
|
267
|
+
"precaching": {
|
|
268
|
+
"description": "Cache critical assets during service worker install",
|
|
269
|
+
"what_to_precache": ["App shell (HTML, CSS, JS)", "Critical images (logo, icons)", "Fonts", "Core routes"],
|
|
270
|
+
"what_not_to_precache": ["Large media files", "Infrequently used pages", "User-specific content"]
|
|
271
|
+
},
|
|
272
|
+
"runtime_caching": {
|
|
273
|
+
"description": "Cache assets as user navigates",
|
|
274
|
+
"strategies": "Use appropriate caching strategy per resource type",
|
|
275
|
+
"example": "Images: stale-while-revalidate, API: network-first, Static: cache-first"
|
|
276
|
+
},
|
|
277
|
+
"code_splitting": {
|
|
278
|
+
"description": "Split JavaScript into smaller bundles",
|
|
279
|
+
"benefits": ["Faster initial load", "Only load what's needed"],
|
|
280
|
+
"implementation": {
|
|
281
|
+
"webpack": "Dynamic import() syntax",
|
|
282
|
+
"react": "React.lazy(() => import('./Component'))",
|
|
283
|
+
"vue": "() => import('./Component.vue')"
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
"compression": {
|
|
287
|
+
"description": "Compress assets for faster transfer",
|
|
288
|
+
"techniques": {
|
|
289
|
+
"gzip": "Standard compression (server config)",
|
|
290
|
+
"brotli": "Better compression than gzip (modern browsers)",
|
|
291
|
+
"minification": "Remove whitespace, shorten variable names"
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
},
|
|
295
|
+
"installation_process": {
|
|
296
|
+
"criteria": {
|
|
297
|
+
"https": "Site served over HTTPS (or localhost)",
|
|
298
|
+
"manifest": "Valid web app manifest with name, icons, start_url, display",
|
|
299
|
+
"service_worker": "Registered service worker with fetch event handler",
|
|
300
|
+
"engagement": "User has visited site at least once (Chrome: 30 seconds)",
|
|
301
|
+
"icons": "192x192 and 512x512 icons in manifest"
|
|
302
|
+
},
|
|
303
|
+
"browser_support": {
|
|
304
|
+
"chrome_android": "Full support (most mature)",
|
|
305
|
+
"edge": "Full support (Windows, Android)",
|
|
306
|
+
"safari_ios": "Limited (no beforeinstallprompt, manual 'Add to Home Screen')",
|
|
307
|
+
"firefox": "Partial support",
|
|
308
|
+
"samsung_internet": "Full support"
|
|
309
|
+
},
|
|
310
|
+
"ios_specific": {
|
|
311
|
+
"install": "User must manually tap Share → Add to Home Screen",
|
|
312
|
+
"no_prompt": "Cannot programmatically trigger install prompt",
|
|
313
|
+
"meta_tags": "<meta name='apple-mobile-web-app-capable' content='yes'>\n<meta name='apple-mobile-web-app-status-bar-style' content='black'>\n<link rel='apple-touch-icon' href='/icon-180.png'>",
|
|
314
|
+
"icon_size": "180x180 for apple-touch-icon",
|
|
315
|
+
"limitations": ["No push notifications (WebKit limitation)", "No background sync"]
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"developer_tools": {
|
|
319
|
+
"lighthouse": {
|
|
320
|
+
"description": "PWA audit in Chrome DevTools",
|
|
321
|
+
"checks": ["Installable", "Service worker", "Offline", "HTTPS", "Manifest", "Icons"],
|
|
322
|
+
"score": "0-100, aim for 90+",
|
|
323
|
+
"access": "Chrome DevTools → Lighthouse tab"
|
|
324
|
+
},
|
|
325
|
+
"chrome_devtools": {
|
|
326
|
+
"application_tab": ["Manifest preview", "Service worker status", "Storage (caches, IndexedDB)", "Clear site data"],
|
|
327
|
+
"service_worker_testing": ["Offline checkbox", "Update on reload", "Bypass for network"]
|
|
328
|
+
},
|
|
329
|
+
"workbox": {
|
|
330
|
+
"description": "Google's library for service worker development",
|
|
331
|
+
"benefits": ["Pre-built caching strategies", "Precaching", "Routing", "Background sync"],
|
|
332
|
+
"install": "npm install workbox-webpack-plugin",
|
|
333
|
+
"usage": "import { precacheAndRoute } from 'workbox-precaching';"
|
|
334
|
+
},
|
|
335
|
+
"pwa_builder": {
|
|
336
|
+
"description": "Tool to package PWA for app stores",
|
|
337
|
+
"url": "https://www.pwabuilder.com/",
|
|
338
|
+
"features": ["Manifest generator", "Service worker generator", "Package for Windows, Android, iOS"]
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
"testing": {
|
|
342
|
+
"offline_testing": {
|
|
343
|
+
"chrome": "DevTools → Network tab → Offline checkbox",
|
|
344
|
+
"real_device": "Enable airplane mode",
|
|
345
|
+
"test": ["App loads", "Cached content accessible", "Meaningful offline page", "Queue actions work"]
|
|
346
|
+
},
|
|
347
|
+
"install_testing": {
|
|
348
|
+
"chrome": "DevTools → Application → Manifest → 'Add to home screen'",
|
|
349
|
+
"ios": "Safari → Share → Add to Home Screen",
|
|
350
|
+
"test": ["Icon appears on home screen", "Opens in standalone mode", "Splash screen shows"]
|
|
351
|
+
},
|
|
352
|
+
"update_testing": {
|
|
353
|
+
"method": "Change service worker, reload with DevTools 'Update on reload' checked",
|
|
354
|
+
"test": ["Update detected", "Update prompt shown", "New version applied after reload"]
|
|
355
|
+
},
|
|
356
|
+
"lighthouse_audit": {
|
|
357
|
+
"run": "DevTools → Lighthouse → Progressive Web App",
|
|
358
|
+
"fix_issues": "Address failed audits",
|
|
359
|
+
"target_score": "90+"
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
"best_practices": [
|
|
363
|
+
"Serve over HTTPS (required for service workers)",
|
|
364
|
+
"Create valid web app manifest with all required fields",
|
|
365
|
+
"Register service worker after page load (don't block rendering)",
|
|
366
|
+
"Cache app shell for fast, offline-capable UI",
|
|
367
|
+
"Use appropriate caching strategies per resource type",
|
|
368
|
+
"Provide offline fallback page",
|
|
369
|
+
"Show meaningful offline UX (not just 'You are offline')",
|
|
370
|
+
"Don't ask for notification permission immediately",
|
|
371
|
+
"Defer install prompt, show at contextual moment",
|
|
372
|
+
"Update service worker gracefully (prompt user, don't force)",
|
|
373
|
+
"Test offline functionality thoroughly",
|
|
374
|
+
"Optimize performance (lazy load, code split, compress)",
|
|
375
|
+
"Use Workbox for easier service worker development",
|
|
376
|
+
"Provide 192x192 and 512x512 icons (and maskable)",
|
|
377
|
+
"Test on real devices (especially iOS for limitations)",
|
|
378
|
+
"Monitor Core Web Vitals (LCP, FID, CLS)",
|
|
379
|
+
"Use background sync for offline actions",
|
|
380
|
+
"Show sync status (pending, synced, failed)",
|
|
381
|
+
"Make notifications timely and relevant",
|
|
382
|
+
"Provide notification preferences"
|
|
383
|
+
],
|
|
384
|
+
"anti_patterns": [
|
|
385
|
+
"Asking for notification permission on page load",
|
|
386
|
+
"Forcing install prompt immediately",
|
|
387
|
+
"Not providing offline functionality (defeats PWA purpose)",
|
|
388
|
+
"Caching too much (wastes user's storage)",
|
|
389
|
+
"Not handling service worker updates (users stuck on old version)",
|
|
390
|
+
"Using 'cache-only' strategy for dynamic content",
|
|
391
|
+
"Not testing offline experience",
|
|
392
|
+
"Ignoring iOS limitations (assuming all features work)",
|
|
393
|
+
"Not providing meaningful offline fallback",
|
|
394
|
+
"Forcing updates (may lose user data)",
|
|
395
|
+
"Showing generic 'No internet' message (offer cached content)",
|
|
396
|
+
"Not versioning caches (old caches pile up)",
|
|
397
|
+
"Blocking rendering with service worker registration",
|
|
398
|
+
"Not using HTTPS (service workers won't work)",
|
|
399
|
+
"Missing required manifest fields",
|
|
400
|
+
"Not testing on real devices",
|
|
401
|
+
"Spamming push notifications",
|
|
402
|
+
"Not explaining notification value before asking permission",
|
|
403
|
+
"Not providing way to disable notifications",
|
|
404
|
+
"Assuming PWA = native app (it's still web with limitations)"
|
|
405
|
+
],
|
|
406
|
+
"case_studies": {
|
|
407
|
+
"twitter_lite": {
|
|
408
|
+
"results": ["65% increase in pages per session", "75% increase in Tweets sent", "20% decrease in bounce rate"],
|
|
409
|
+
"techniques": ["App shell pattern", "Service worker caching", "Push notifications", "Add to home screen"]
|
|
410
|
+
},
|
|
411
|
+
"pinterest": {
|
|
412
|
+
"results": ["60% increase in core engagements", "44% increase in ad revenue", "40% increase in time spent"],
|
|
413
|
+
"techniques": ["Service worker", "Lazy loading", "Code splitting"]
|
|
414
|
+
},
|
|
415
|
+
"starbucks": {
|
|
416
|
+
"results": ["2x daily active users", "Works offline for browsing menu"],
|
|
417
|
+
"techniques": ["Offline-first", "App shell", "Service worker caching"]
|
|
418
|
+
}
|
|
419
|
+
},
|
|
420
|
+
"resources": [
|
|
421
|
+
"web.dev/progressive-web-apps/ - Google's PWA guide",
|
|
422
|
+
"Progressive Web Apps (Jason Grigsby) - Book",
|
|
423
|
+
"Workbox - https://developers.google.com/web/tools/workbox",
|
|
424
|
+
"PWA Builder - https://www.pwabuilder.com/",
|
|
425
|
+
"Can I Use - Service Worker browser support",
|
|
426
|
+
"Lighthouse - Chrome DevTools auditing tool",
|
|
427
|
+
"PWA Stats - https://www.pwastats.com/ (case studies)"
|
|
428
|
+
]
|
|
429
|
+
}
|