@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.
@@ -0,0 +1,148 @@
1
+ {
2
+ "name": "Web Components",
3
+ "description": "Building framework-agnostic, reusable UI components using Web Components standards",
4
+ "definition": "Web Components are a set of web platform APIs that allow you to create reusable custom elements with encapsulated functionality",
5
+ "core_technologies": {
6
+ "custom_elements": {
7
+ "description": "Define new HTML tags",
8
+ "api": "customElements.define('my-element', MyElement)",
9
+ "example": "class MyButton extends HTMLElement { constructor() { super(); } }",
10
+ "lifecycle": {
11
+ "connectedCallback": "Called when element added to DOM",
12
+ "disconnectedCallback": "Called when element removed",
13
+ "attributeChangedCallback": "Called when attribute changes",
14
+ "adoptedCallback": "Called when moved to new document"
15
+ }
16
+ },
17
+ "shadow_dom": {
18
+ "description": "Encapsulated DOM and CSS",
19
+ "purpose": "Styles don't leak in or out, true encapsulation",
20
+ "example": "this.attachShadow({ mode: 'open' })",
21
+ "modes": {
22
+ "open": "JavaScript can access shadow root",
23
+ "closed": "Shadow root inaccessible from outside"
24
+ }
25
+ },
26
+ "html_templates": {
27
+ "description": "Reusable HTML chunks",
28
+ "element": "<template>",
29
+ "usage": "Define HTML structure that can be cloned",
30
+ "example": "<template id='my-template'><div>Content</div></template>"
31
+ },
32
+ "es_modules": {
33
+ "description": "Import/export for component code",
34
+ "example": "import './my-button.js';"
35
+ }
36
+ },
37
+ "creating_web_component": {
38
+ "basic_example": "class MyButton extends HTMLElement {\n constructor() {\n super();\n const shadow = this.attachShadow({ mode: 'open' });\n shadow.innerHTML = `\n <style>button { background: blue; color: white; }</style>\n <button><slot></slot></button>\n `;\n }\n}\ncustomElements.define('my-button', MyButton);\n\n// Usage: <my-button>Click Me</my-button>",
39
+ "with_attributes": "static get observedAttributes() { return ['label']; }\nattributeChangedCallback(name, oldValue, newValue) {\n if (name === 'label') {\n this.button.textContent = newValue;\n }\n}",
40
+ "with_properties": "get value() { return this._value; }\nset value(val) {\n this._value = val;\n this.render();\n}"
41
+ },
42
+ "benefits": {
43
+ "framework_agnostic": "Works with React, Vue, Angular, vanilla JS",
44
+ "encapsulation": "Styles and DOM scoped, no conflicts",
45
+ "reusability": "Use across projects and frameworks",
46
+ "native": "No framework dependency, smaller bundle",
47
+ "future_proof": "Web standard, won't be deprecated like frameworks"
48
+ },
49
+ "limitations": {
50
+ "ssr": "Server-side rendering is complex (Declarative Shadow DOM helps)",
51
+ "seo": "Search engines may not index shadow DOM content well",
52
+ "browser_support": "Old browsers (IE11) don't support (use polyfills)",
53
+ "react_compat": "React has historical issues with Web Components (improving)",
54
+ "tooling": "Less mature than React/Vue ecosystems"
55
+ },
56
+ "libraries": {
57
+ "lit": {
58
+ "description": "Google's library for Web Components",
59
+ "features": ["Reactive properties", "Templating with lit-html", "Small size (5KB)"],
60
+ "example": "import { LitElement, html, css } from 'lit';\nclass MyButton extends LitElement {\n static styles = css`:host { display: block; }`;\n render() { return html`<button><slot></slot></button>`; }\n}\ncustomElements.define('my-button', MyButton);"
61
+ },
62
+ "stencil": {
63
+ "description": "Compiler for Web Components (Ionic team)",
64
+ "features": ["TypeScript", "JSX", "Lazy loading", "Pre-rendering for SEO"],
65
+ "use_when": "Building design systems"
66
+ },
67
+ "fast": {
68
+ "description": "Microsoft's Web Components framework",
69
+ "features": ["Fast rendering", "Design tokens", "Accessibility-first"]
70
+ },
71
+ "hybrids": {
72
+ "description": "Functional approach to Web Components",
73
+ "features": ["Simple API", "No classes", "Immutable"]
74
+ }
75
+ },
76
+ "patterns": {
77
+ "slots": {
78
+ "description": "Allow users to pass content",
79
+ "default_slot": "<slot></slot>",
80
+ "named_slots": "<slot name='header'></slot>",
81
+ "usage": "<my-card><h2 slot='header'>Title</h2>Content here</my-card>"
82
+ },
83
+ "css_custom_properties": {
84
+ "description": "Expose styling API",
85
+ "example": ":host { background: var(--button-bg, blue); }\n/* User can set: my-button { --button-bg: red; } */"
86
+ },
87
+ "events": {
88
+ "description": "Dispatch custom events",
89
+ "example": "this.dispatchEvent(new CustomEvent('change', { detail: value }));\n/* User: element.addEventListener('change', e => console.log(e.detail)); */"
90
+ },
91
+ "attributes_vs_properties": {
92
+ "attributes": "Strings only, reflect in HTML, use for configuration",
93
+ "properties": "Any type, JavaScript only, use for complex data",
94
+ "sync": "Reflect important properties to attributes for SSR/SEO"
95
+ }
96
+ },
97
+ "accessibility": {
98
+ "aria": "Use ARIA roles and properties (role, aria-label, etc.)",
99
+ "keyboard": "Implement keyboard navigation (Tab, Enter, Arrow keys)",
100
+ "focus": "Manage focus (delegatesFocus in attachShadow)",
101
+ "semantics": "Use semantic HTML inside component"
102
+ },
103
+ "testing": {
104
+ "unit_tests": "Use @web/test-runner or Jest with JSDOM",
105
+ "visual_regression": "Storybook + Chromatic",
106
+ "a11y": "axe-core for accessibility testing"
107
+ },
108
+ "best_practices": [
109
+ "Use Shadow DOM for encapsulation",
110
+ "Provide slots for flexibility",
111
+ "Expose styling via CSS custom properties",
112
+ "Emit custom events for communication",
113
+ "Use semantic HTML",
114
+ "Implement keyboard navigation",
115
+ "Reflect important properties to attributes",
116
+ "Use Lit or Stencil for better DX",
117
+ "Provide TypeScript definitions",
118
+ "Document component API (props, events, slots)",
119
+ "Test accessibility",
120
+ "Support SSR if needed (Declarative Shadow DOM)",
121
+ "Keep components small and focused",
122
+ "Use CSS Parts for deep styling access (::part)"
123
+ ],
124
+ "anti_patterns": [
125
+ "Not using Shadow DOM (loses encapsulation benefit)",
126
+ "Overusing global styles",
127
+ "Large, monolithic components",
128
+ "No keyboard navigation",
129
+ "Missing ARIA attributes",
130
+ "Not documenting API",
131
+ "Tight coupling to specific framework",
132
+ "Storing state in attributes (use properties)",
133
+ "Mutating props from outside"
134
+ ],
135
+ "use_cases": {
136
+ "design_systems": "Framework-agnostic component library (use across projects)",
137
+ "micro_frontends": "Independent teams, different frameworks",
138
+ "progressive_enhancement": "Add interactivity to server-rendered HTML",
139
+ "third_party_widgets": "Embeddable components (analytics, chat)"
140
+ },
141
+ "resources": [
142
+ "web.dev/web-components - Google's guide",
143
+ "Lit Documentation",
144
+ "Stencil Documentation",
145
+ "open-wc.org - Tools and recommendations",
146
+ "webcomponents.org - Component showcase"
147
+ ]
148
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elsahafy/ux-mcp-server",
3
- "version": "2.0.0",
3
+ "version": "4.0.0",
4
4
  "description": "Model Context Protocol server for UX best practices, accessibility guidelines (WCAG), usability heuristics (Nielsen), UI patterns, and design systems",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",