@volue/wave-mcp 0.1.14-next.4 → 0.2.0-next.1
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 +10 -0
- package/dist/app.d.ts +6 -0
- package/dist/app.js +2 -0
- package/dist/index-DL4W1Dsp.js +292 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/isEntryFile-gJoj6hFD.js +1 -0
- package/dist/server-HCwNdOGQ.js +1 -0
- package/dist/transports/http.d.ts +2 -4
- package/dist/transports/http.js +1 -1
- package/dist/transports/stdio.js +1 -1
- package/package.json +12 -9
- package/dist/index-7C65hTxB.js +0 -292
- package/dist/server-DavBHU1k.js +0 -1
package/README.md
CHANGED
|
@@ -136,6 +136,16 @@ You can customize the port using environment variable:
|
|
|
136
136
|
PORT=8080 npx @volue/wave-mcp@latest http
|
|
137
137
|
```
|
|
138
138
|
|
|
139
|
+
#### Environment variables
|
|
140
|
+
|
|
141
|
+
| Variable | Default | Description |
|
|
142
|
+
| ----------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
143
|
+
| `HOST` | `localhost` | Address the HTTP server binds to. |
|
|
144
|
+
| `PORT` | `3000` | Port the HTTP server listens on. |
|
|
145
|
+
| `CORS_ORIGIN` | `*` | Comma-separated list of allowed CORS origins. |
|
|
146
|
+
| `ALLOWED_HOSTS` | unset | Comma-separated list of allowed `Host` header values (e.g. `mcp.example.com`). Setting this (or `ALLOWED_ORIGINS`) enables DNS-rebinding protection. |
|
|
147
|
+
| `ALLOWED_ORIGINS` | unset | Comma-separated list of allowed `Origin` header values (e.g. `https://mcp.example.com`). |
|
|
148
|
+
|
|
139
149
|
## Docker Deployment
|
|
140
150
|
|
|
141
151
|
Pre-built Docker images are automatically published to GitHub Container Registry on every release.
|
package/dist/app.d.ts
ADDED
package/dist/app.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import{WebStandardStreamableHTTPServerTransport as m}from"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";import{ErrorCode as s}from"@modelcontextprotocol/sdk/types.js";import{Hono as l}from"hono";import{cors as d}from"hono/cors";import{c as v,p as a}from"./server-HCwNdOGQ.js";import{p as n,i as h}from"./index-DL4W1Dsp.js";import"@modelcontextprotocol/sdk/server/mcp.js";import"@modelcontextprotocol/sdk/validation/cfworker";import"@volue/design-colors/generic";import"@volue/design-icons";import"@volue/design-media-queries";import"remark-parse";import"unified";import"zod";import"@volue/design-colors/flat";const r=new l,S=n(process.env.CORS_ORIGIN)??"*";r.use("*",d({origin:S}));const i=n(process.env.ALLOWED_HOSTS),p=n(process.env.ALLOWED_ORIGINS);r.post("/mcp",async e=>{try{const o=v();await h(o);const t=new m({sessionIdGenerator:void 0,enableJsonResponse:!0,enableDnsRebindingProtection:!!(i||p),allowedHosts:i,allowedOrigins:p});await o.connect(t);const c=await t.handleRequest(e.req.raw);return await o.close(),c}catch(o){return console.error("Error handling MCP request:",o),e.json({jsonrpc:"2.0",error:{code:s.InternalError,message:"Internal server error"},id:null},500)}}),r.on(["GET","DELETE"],"/mcp",e=>e.json({jsonrpc:"2.0",error:{code:s.ConnectionClosed,message:"Method not allowed"},id:null},405)),r.get("/",e=>e.json({name:"Wave MCP Server",version:a.version,description:a.description,endpoints:{"/":"Server information (this response)","/mcp":"Streamable HTTP endpoint for MCP connection","/health":"Health check endpoint"}})),r.get("/health",e=>e.json({status:"healthy",timestamp:new Date().toISOString()}));export{r as default};
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
var A=Object.defineProperty;var i=(e,t)=>A(e,"name",{value:t,configurable:!0});import N from"@volue/design-colors/generic";import*as D from"@volue/design-icons";import*as F from"@volue/design-media-queries";import j from"remark-parse";import O from"unified";import{z as y}from"zod";import{core as H,background as V,foreground as G,border as X,rgb as q,data as J}from"@volue/design-colors/flat";const $=1e4;async function C(e,t,n){const o=n??`fetch ${e}`,r=AbortSignal.timeout($);try{const a=await fetch(e,{signal:r,...t});if(!a.ok)throw new Error(`Failed to ${o}: ${a.status} ${a.statusText}`);return await a.text()}catch(a){throw r.aborted?new Error(`Failed to ${o}: timed out after ${$}ms`):a}}i(C,"fetchMarkdown");function B(e,t){const n=new Map,o=new Map;return async r=>{const a=n.get(r);if(a&&Date.now()<a.expiresAt)return a.value;let s=o.get(r);return s||(s=t(r).then(c=>(n.set(r,{value:c,expiresAt:Date.now()+e}),c)).finally(()=>o.delete(r)),o.set(r,s)),s}}i(B,"createTtlCache");function d(e,t){return e.type===t}i(d,"isNodeType");function v(e){return Array.from(new Set(e))}i(v,"uniq");function p(e){return e instanceof Error?e.message:"Unknown error"}i(p,"getErrorMessage");function Q(e){const t=e?.split(",").map(n=>n.trim()).filter(Boolean);return t?.length?t:void 0}i(Q,"parseCsvEnv");function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},m.apply(null,arguments)}i(m,"_extends");const Y="0 1px 2.5px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.08)), 0 3px 9px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.048))",K="0 0.4px 2.2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.022)), 0 1.4px 5px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.04)), 0 5px 14px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.06))",Z="0 0.3px 2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.5px 8px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.024)), 0 4px 16px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.04)), 0 8px 24px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.07))",ee="0 0.7px 2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.6px 8px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.024)), 0 3.3px 16px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.034)), 0 5px 26px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.06)), 0 12px 42px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.08))";var te=Object.freeze({__proto__:null,elevationL:ee,elevationM:Z,elevationS:K,elevationXs:Y}),h={base:{2:"0.125rem",4:"0.25rem",6:"0.375rem",8:"0.5rem",12:"0.75rem",14:"0.875rem",16:"1rem",20:"1.25rem",24:"1.5rem",28:"1.75rem",32:"2rem",36:"2.25rem",40:"2.5rem",44:"2.75rem",48:"3rem",64:"4rem",72:"4.5rem",80:"5rem",96:"6rem",112:"7rem",128:"8rem"},borderRadius:{xs:"0.25rem",s:"0.375rem",m:"0.5rem",l:"0.75rem",xl:"1rem",full:"100vh"},spacing:{xs:"0.25rem",s:"0.5rem",m:"1rem",l:"1.5rem",xl:"2rem",xxl:"3rem",xxxl:"4.5rem"}},u={font:{family:{base:"'IBM Plex Sans', 'IBM Plex Sans Fallback: -apple-system', 'IBM Plex Sans Fallback: Segoe UI', 'IBM Plex Sans Fallback: Roboto', 'IBM Plex Sans Fallback: Arial', 'IBM Plex Sans Fallback: Noto Sans', -apple-system, 'Segoe UI', Roboto, Arial, 'Noto Sans', sans-serif",display:"'IBM Plex Sans', 'IBM Plex Sans Fallback: -apple-system', 'IBM Plex Sans Fallback: Segoe UI', 'IBM Plex Sans Fallback: Roboto', 'IBM Plex Sans Fallback: Arial', 'IBM Plex Sans Fallback: Noto Sans', -apple-system, 'Segoe UI', Roboto, Arial, 'Noto Sans', sans-serif",mono:"ui-monospace, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"},weight:{normal:"400",semibold:"600"}},size:{font:{base:"16px",eta:"12px",zeta:"14px",epsilon:"16px",delta:"19px",gamma:"21px",beta:"28px",alpha:"38px",giga:"51px"},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",body:"1.5",base:"1.5rem",small:"1.25rem",xSmall:"1.125rem",zeta:"1.714286",epsilon:"1.5",delta:"1.263158",gamma:"1.52381",beta:"1.714286",alpha:"1.263158",giga:"1.411765"}}};function ne(e){return e.charAt(0).toUpperCase()+e.slice(1)}i(ne,"capitalizeFirstLetter");var I=Object.keys(h.spacing).reduce(function(e,t){var n;return m({},e,(n={},n["spacing"+ne(t)]=h.spacing[t],n))},{}),E={colors:m({},H,V,G,X,q,J),space:I,zIndices:{auto:"auto",0:"0",1:"100",2:"200",3:"300",4:"400",5:"500",9:"900"},fonts:u.font.family,fontWeights:u.font.weight,fontSizes:u.size.font,lineHeights:u.size.lineHeight,letterSpacings:u.size.letterSpacing,sizes:m({},h.base,{measureNarrow:"30ch",measureMedium:"60ch",measureWide:"90ch",containerNarrow:"32rem",containerMedium:"48rem",containerWide:"74rem"}),radii:m({},h.borderRadius,I),shadows:m({},te,{lift:"0 10px 20px -5px rgba(0, 0, 0, 0.15)"})};const oe=O().use(j),R={Components:"component","UX patterns":"pattern"};function re(e,t){const n=oe.parse(e),o=new URL(`${t}/`);let r=null;return n.children.reduce((a,s)=>{if(d(s,"heading")&&s.depth===2)return r=ae(s),a;if(!r||!d(s,"list"))return a;const c=r,l=s.children.map(g=>se(g,c,o)).filter(g=>g!==null);return a.concat(l)},[])}i(re,"parseLlmsIndex");function ae(e){const[t]=e.children;if(!t||!d(t,"text"))return null;const n=t.value.trim();if(!(n in R))return null;const o=R[n];return{title:n,type:o}}i(ae,"extractSectionContext");function se(e,t,n){const[o]=e.children;if(!o||!d(o,"paragraph")||o.children.length!==2)return null;const[r,a]=o.children;if(!d(r,"link")||!d(a,"text")||r.children.length!==1)return null;const s=r.children[0];if(!d(s,"text"))return null;const c=s.value.trim(),l=new URL(r.url,n);if(l.origin!==n.origin)return console.warn(`Skipping llms.txt entry "${c}": ${r.url} is outside ${n.origin}`),null;const g=l.toString(),T=l.pathname.replace(/^\//,""),P=ie(T),W=ce(t.title,T,t.type),z=pe(a.value);return{name:c,slug:P,category:W,section:t.title,type:t.type,url:g,description:z??void 0}}i(se,"listItemToResource");function ie(e){return e.replace(/\.md$/,"").split("/").pop()??""}i(ie,"deriveSlug");function ce(e,t,n){const o=t.replace(/\.md$/,"").split("/");if(n==="component"||n==="pattern"){const r=o.length>=3?o[o.length-2]:null;return r?`${e} / ${le(r)}`:e}return e}i(ce,"deriveCategory");function le(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}i(le,"formatSegment");function pe(e){if(!e)return null;const t=e.replace(/^\s*:\s*/,"").trim();return t.toLowerCase()==="no description available"?null:t}i(pe,"normalizeDescription");const x=process.env.USE_STABLE_DOCS==="true"||process.env.USE_STABLE_DOCS==="1"?"https://wave.volue.com":"https://next.wave-design-system.pages.dev",de=`${x}/llms.txt`,me=1e3*60*15,M=process.env.WAVE_RESOURCES_CACHE_TIME?Number.parseInt(process.env.WAVE_RESOURCES_CACHE_TIME,10):me;function b(e){const t=new URL(e,x);return t.pathname.endsWith(".md")||(t.pathname+=".md"),t.toString()}i(b,"createUrl");const ge=B(M,async e=>{const t=await C(e,void 0,"fetch llms.txt");return re(t,x)}),f=B(M,e=>C(e));function ue(e){return f(e.url)}i(ue,"fetchComponent");function he(e){return f(e.url)}i(he,"fetchPattern");function fe(){return f(b("get-started/developing"))}i(fe,"fetchDevelopingGuide");function ye(){return f(b("tokens/colors"))}i(ye,"fetchColorUsageGuidelines");function S(){return Object.entries(D).map(([e,t])=>({name:e,svg:t}))}i(S,"listIcons");function ve(){const e=S();return v(e.map(t=>t.name))}i(ve,"getIconNames");function xe(e,t){const n=t.trim().toLowerCase();return e.find(o=>o.name.toLowerCase()===n)}i(xe,"findIconByName");async function _(e){return(await ge(de)).filter(n=>n.type===e)}i(_,"listResourcesByType");function U(e,t){const n=t.trim().toLowerCase();return e.find(o=>o.name.toLowerCase()===n)}i(U,"findResourceByName");function w(){return _("component")}i(w,"listComponents");async function be(){const e=await w();return v(e.map(t=>t.name))}i(be,"getComponentNames");function k(){return _("pattern")}i(k,"listPatterns");async function Se(){const e=await k();return v(e.map(t=>t.name))}i(Se,"getPatternNames");function L(e){return e.reduce((t,n)=>(t[n.category]||(t[n.category]=[]),t[n.category].push(n),t),{})}i(L,"groupResourcesByCategory");const we={name:"get_color_usage",description:"Retrieve the Wave Design System color tokens and guidelines for applying color in user interfaces.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n},async()=>{try{const o=await ye();return{content:[{type:"text",text:JSON.stringify(N)},{type:"text",text:`Here are the Wave Design System color usage guidelines:
|
|
2
|
+
|
|
3
|
+
${o}
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
Source: ${b("tokens/colors")}`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve color usage guidelines: ${p(o)}`}]}}})}},ke={name:"get_component",description:"Retrieve comprehensive documentation for a specific Wave Design System component by name. This tool retrieves the import instructions, basic usage and advanced configuration examples, code snippets for common scenarios, available props/properties table and some general guidelines for a given Wave Design System component.",async ctx(){try{const e=await be();if(e.length===0)throw new Error("llms.txt index contains no components");return{componentNames:e}}catch(e){throw new Error(`Failed to initialize component tool: ${p(e)}`)}},exec(e,{ctx:t,name:n,description:o}){e.registerTool(n,{description:o,inputSchema:{name:y.enum(t.componentNames).describe("The name of the component to retrieve documentation for. This can be derived from calling the `get_components` tool.")}},async({name:r})=>{try{const a=await w(),s=U(a,r);if(!s)throw new Error("Component not found");const c=await ue(s);return c?{content:[{type:"text",text:`Here is the documentation for the \`${s.name}\` component from the Wave Design System:
|
|
7
|
+
|
|
8
|
+
${c}
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
Source: ${s.url}`}]}:{content:[{type:"text",text:`No documentation content found for the \`${s.name}\` component.`}]}}catch(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${p(a)}`}]}}})}},Te={name:"get_icon",description:"Retrieve a specific icon information by name from Wave Design System.",ctx(){return{iconNames:ve()}},exec(e,{ctx:t,name:n,description:o}){e.registerTool(n,{description:o,inputSchema:{name:y.enum(t.iconNames).describe("The icon name to retrieve. This can be derived from calling the `list_icon` tool.")}},async({name:r})=>{try{const a=S(),s=xe(a,r);if(!s)throw new Error("Icon not found.");const c=`<SvgIcon iconName="${s.name}" />`,l=`<div class="svgIcon svgIcon--stroked">
|
|
12
|
+
<svg focusable="false" aria-hidden="true">
|
|
13
|
+
<use xlink:href="#svg--${s.name}"></use>
|
|
14
|
+
</svg>
|
|
15
|
+
</div>`;return{content:[{type:"text",text:`# ${s.name} icon
|
|
16
|
+
|
|
17
|
+
## React component:
|
|
18
|
+
|
|
19
|
+
\`\`\`tsx
|
|
20
|
+
${c}
|
|
21
|
+
\`\`\`
|
|
22
|
+
|
|
23
|
+
## HTML markup:
|
|
24
|
+
|
|
25
|
+
\`\`\`html
|
|
26
|
+
${l}
|
|
27
|
+
\`\`\`
|
|
28
|
+
|
|
29
|
+
## Raw SVG code:
|
|
30
|
+
|
|
31
|
+
\`\`\`svg
|
|
32
|
+
${s.svg}
|
|
33
|
+
\`\`\``}]}}catch(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve icon \`${r}\`: ${p(a)}`}]}}})}},$e={name:"get_pattern",description:"Retrieve documentation for a specific Wave Design System UX pattern by name. This tool provides guidance, examples and components that implement the selected pattern.",async ctx(){try{const e=await Se();if(e.length===0)throw new Error("llms.txt index contains no patterns");return{patternNames:e}}catch(e){throw new Error(`Failed to initialize pattern tool: ${p(e)}`)}},exec(e,{ctx:t,name:n,description:o}){e.registerTool(n,{description:o,inputSchema:{name:y.enum(t.patternNames).describe("The name of the UX pattern to retrieve documentation for. This can be derived from calling the `list_patterns` tool.")}},async({name:r})=>{try{const a=await k(),s=U(a,r);if(!s)throw new Error("Pattern not found");const c=await he(s);return{content:[{type:"text",text:`Here are the guidelines for the \`${s.name}\` UX pattern from the Wave Design System:
|
|
34
|
+
|
|
35
|
+
${c}
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
Source: ${s.url}`}]}}catch(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${p(a)}`}]}}})}},Ce={name:"get_styling_guidelines",description:"Retrieve guidelines for styling Wave Design System components and creating custom styled components.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n},async()=>({content:[{type:"text",text:`Wave Design System components can be styled using standard React approaches (className, style prop), but Wave provides specialized styling APIs for customizing component styles and creating custom styled components. These APIs are powered by Stitches.js, a CSS-in-JS library with near-zero runtime. They are the recommended approach because they integrate seamlessly with Wave's design tokens and provide type-safe styles.
|
|
39
|
+
|
|
40
|
+
## Styling APIs
|
|
41
|
+
|
|
42
|
+
### CSS prop
|
|
43
|
+
|
|
44
|
+
The \`css\` property is available on all Wave components for styling. It generates CSS class names from the style object, supporting all standard CSS properties and selectors, plus design tokens and responsive breakpoints.
|
|
45
|
+
|
|
46
|
+
Example:
|
|
47
|
+
|
|
48
|
+
\`\`\`tsx
|
|
49
|
+
import { Box } from '@volue/wave-react';
|
|
50
|
+
|
|
51
|
+
<Box
|
|
52
|
+
css={{
|
|
53
|
+
display: 'flex',
|
|
54
|
+
color: '$foregroundInverse',
|
|
55
|
+
backgroundColor: '$backgroundAccentStrong',
|
|
56
|
+
padding: '$spacingM'
|
|
57
|
+
}}
|
|
58
|
+
/>
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
The \`css\` prop works best for one-off style customizations of specific component instances.
|
|
62
|
+
|
|
63
|
+
### Styled function
|
|
64
|
+
|
|
65
|
+
Use \`styled()\` to create reusable styled components with semantic names. It supports all \`css\` prop features, variants for conditional styling, and provides better performance than the \`css\` prop.
|
|
66
|
+
|
|
67
|
+
\`\`\`tsx
|
|
68
|
+
import { styled } from '@volue/wave-react';
|
|
69
|
+
|
|
70
|
+
// Create a simple styled component
|
|
71
|
+
const Container = styled('div', {
|
|
72
|
+
padding: '$spacingM',
|
|
73
|
+
backgroundColor: '$backgroundNeutralSubtle',
|
|
74
|
+
borderRadius: '$borderRadiusM'
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// Create a styled component with variants
|
|
78
|
+
const SectionTitle = styled('h2', {
|
|
79
|
+
fontWeight: '$semibold',
|
|
80
|
+
color: '$foregroundAccent',
|
|
81
|
+
|
|
82
|
+
variants: {
|
|
83
|
+
size: {
|
|
84
|
+
medium: {
|
|
85
|
+
fontSize: '$gamma',
|
|
86
|
+
},
|
|
87
|
+
large: {
|
|
88
|
+
fontSize: '$beta',
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
// optional defaultVariants
|
|
94
|
+
defaultVariants: {
|
|
95
|
+
size: 'medium'
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
// Use with a specific variant
|
|
100
|
+
<SectionTitle size="large">Analytics Overview</SectionTitle>
|
|
101
|
+
|
|
102
|
+
// Extend an existing Wave component
|
|
103
|
+
import { AppFrame } from '@volue/wave-react';
|
|
104
|
+
|
|
105
|
+
const StyledAppFrame = styled(AppFrame.Root, {
|
|
106
|
+
backgroundColor: '$backgroundNeutralMinimal'
|
|
107
|
+
});
|
|
108
|
+
\`\`\`
|
|
109
|
+
|
|
110
|
+
## Design tokens
|
|
111
|
+
|
|
112
|
+
Wave provides a comprehensive set of design tokens for colors, spacing, typography, border radii, shadows, and more. All tokens are available in both \`css\` prop and \`styled()\` function using the \`$tokenName\` syntax (as shown in the examples above).
|
|
113
|
+
|
|
114
|
+
**Use the \`get_tokens\` tool to discover all available design tokens** including their values and usage examples.
|
|
115
|
+
|
|
116
|
+
## Media Query Tokens
|
|
117
|
+
|
|
118
|
+
Wave provides media query tokens for responsive design. Use these tokens to create breakpoint-based styles:
|
|
119
|
+
|
|
120
|
+
${Object.entries(F).map(([r,a])=>`- \`@${r}\`: ${a}`).join(`
|
|
121
|
+
`)}
|
|
122
|
+
|
|
123
|
+
### Responsive styling examples
|
|
124
|
+
|
|
125
|
+
**Using media queries with the css prop:**
|
|
126
|
+
|
|
127
|
+
\`\`\`tsx
|
|
128
|
+
import { Box } from '@volue/wave-react';
|
|
129
|
+
|
|
130
|
+
<Box
|
|
131
|
+
css={{
|
|
132
|
+
padding: '$spacingS',
|
|
133
|
+
|
|
134
|
+
'@mqMediumAndUp': {
|
|
135
|
+
padding: '$spacingM'
|
|
136
|
+
},
|
|
137
|
+
'@mqLargeAndUp': {
|
|
138
|
+
padding: '$spacingL'
|
|
139
|
+
}
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
Responsive padding
|
|
143
|
+
</Box>
|
|
144
|
+
\`\`\`
|
|
145
|
+
|
|
146
|
+
**Using media queries with styled function:**
|
|
147
|
+
|
|
148
|
+
\`\`\`tsx
|
|
149
|
+
import { styled } from '@volue/wave-react';
|
|
150
|
+
|
|
151
|
+
const ResponsiveContainer = styled('div', {
|
|
152
|
+
display: 'flex',
|
|
153
|
+
flexDirection: 'column',
|
|
154
|
+
gap: '$spacingS',
|
|
155
|
+
|
|
156
|
+
'@mqMediumAndUp': {
|
|
157
|
+
flexDirection: 'row',
|
|
158
|
+
gap: '$spacingM'
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
\`\`\`
|
|
162
|
+
|
|
163
|
+
**Responsive variants:**
|
|
164
|
+
|
|
165
|
+
\`\`\`tsx
|
|
166
|
+
import { styled } from '@volue/wave-react';
|
|
167
|
+
|
|
168
|
+
const Button = styled('button', {
|
|
169
|
+
variants: {
|
|
170
|
+
size: {
|
|
171
|
+
small: { padding: '$spacingS' },
|
|
172
|
+
large: { padding: '$spacingL' }
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Apply different variants at different breakpoints
|
|
178
|
+
<Button
|
|
179
|
+
size={{
|
|
180
|
+
'@initial': 'small',
|
|
181
|
+
'@mqLargeAndUp': 'large'
|
|
182
|
+
}}
|
|
183
|
+
>
|
|
184
|
+
Responsive button
|
|
185
|
+
</Button>
|
|
186
|
+
\`\`\`
|
|
187
|
+
|
|
188
|
+
## Best practices
|
|
189
|
+
|
|
190
|
+
1. **Use design tokens**: Always prefer design tokens (prefixed with \`$\`) over hardcoded values for consistency. Use the \`get_tokens\` tool to discover available tokens.
|
|
191
|
+
2. **Choose the right API**: Use \`css\` prop for one-off styles, \`styled()\` for reusable components
|
|
192
|
+
3. **Semantic breakpoints**: Use Wave's semantic media query tokens rather than arbitrary pixel values
|
|
193
|
+
`}]}))}},Be={colors:["background","backgroundColor","backgroundImage","border","borderBlock","borderBlockEnd","borderBlockStart","borderBottom","borderBottomColor","borderColor","borderInline","borderInlineEnd","borderInlineStart","borderLeft","borderLeftColor","borderRight","borderRightColor","borderTop","borderTopColor","caretColor","color","columnRuleColor","fill","outlineColor","stroke","textDecorationColor"],fonts:["fontFamily"],fontSizes:["fontSize"],fontWeights:["fontWeight"],lineHeights:["lineHeight"],letterSpacings:["letterSpacing"],radii:["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],sizes:["blockSize","minBlockSize","maxBlockSize","inlineSize","minInlineSize","maxInlineSize","width","minWidth","maxWidth","height","minHeight","maxHeight","flexBasis","gridTemplateColumns","gridTemplateRows"],space:["gap","gridGap","columnGap","gridColumnGap","rowGap","gridRowGap","inset","insetBlock","insetBlockEnd","insetBlockStart","insetInline","insetInlineEnd","insetInlineStart","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockEnd","marginBlockStart","marginInline","marginInlineEnd","marginInlineStart","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockEnd","paddingBlockStart","paddingInline","paddingInlineEnd","paddingInlineStart","top","right","bottom","left","scrollMargin","scrollMarginTop","scrollMarginRight","scrollMarginBottom","scrollMarginLeft","scrollMarginX","scrollMarginY","scrollMarginBlock","scrollMarginBlockEnd","scrollMarginBlockStart","scrollMarginInline","scrollMarginInlineEnd","scrollMarginInlineStart","scrollPadding","scrollPaddingTop","scrollPaddingRight","scrollPaddingBottom","scrollPaddingLeft","scrollPaddingX","scrollPaddingY","scrollPaddingBlock","scrollPaddingBlockEnd","scrollPaddingBlockStart","scrollPaddingInline","scrollPaddingInlineEnd","scrollPaddingInlineStart"],zIndices:["zIndex"],shadows:["boxShadow","textShadow"],transitions:["transition"],borderWidths:["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],borderStyles:["borderStyle","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle"]},Ie={name:"get_tokens",description:"Retrieve the Wave Design System design tokens (colors, fonts, spacing, font styles, etc.) exposed by the `@volue/wave-react` package. Includes token type mappings to CSS properties and usage examples.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n},async()=>{const o=Object.entries(Be).map(([r,a])=>`| ${r} | ${a.join(", ")} |`).join(`
|
|
194
|
+
`);return{content:[{type:"text",text:`Below is a list of design tokens available from Wave Design System.
|
|
195
|
+
There are ${Object.keys(E).length} token types available:
|
|
196
|
+
|
|
197
|
+
${JSON.stringify(E)}`},{type:"text",text:`## Token Type to CSS Property Mapping
|
|
198
|
+
|
|
199
|
+
Token types are automatically mapped to CSS Properties:
|
|
200
|
+
|
|
201
|
+
| Token | Properties |
|
|
202
|
+
|-------|------------|
|
|
203
|
+
${o}
|
|
204
|
+
|
|
205
|
+
## Using tokens
|
|
206
|
+
|
|
207
|
+
Tokens can be used to style components.
|
|
208
|
+
|
|
209
|
+
\`\`\`tsx
|
|
210
|
+
import { styled } from '@volue/wave-react';
|
|
211
|
+
|
|
212
|
+
const Button = styled('button', {
|
|
213
|
+
backgroundColor: '$backgroundAccentStrong'
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
() => <Button>Button</Button>;
|
|
217
|
+
\`\`\`
|
|
218
|
+
|
|
219
|
+
Tokens also work inside the \`css\` prop.
|
|
220
|
+
|
|
221
|
+
\`\`\`tsx
|
|
222
|
+
const Button = styled('button', {});
|
|
223
|
+
|
|
224
|
+
() => (
|
|
225
|
+
<Button
|
|
226
|
+
css={{
|
|
227
|
+
backgroundColor: '$backgroundAccentStrong'
|
|
228
|
+
}}
|
|
229
|
+
>
|
|
230
|
+
Button
|
|
231
|
+
</Button>
|
|
232
|
+
);
|
|
233
|
+
\`\`\`
|
|
234
|
+
|
|
235
|
+
You can pick a token from any of available token types by prefixing them with the type name, in case they aren't automatically mapped.
|
|
236
|
+
|
|
237
|
+
\`\`\`tsx
|
|
238
|
+
const Button = styled('button', {
|
|
239
|
+
// use a token from the sizes scale
|
|
240
|
+
marginTop: '$sizes$6'
|
|
241
|
+
});
|
|
242
|
+
\`\`\`
|
|
243
|
+
|
|
244
|
+
For more comprehensive styling guidelines including responsive design, variants, and best practices, use the \`get_styling_guidelines\` tool.
|
|
245
|
+
|
|
246
|
+
## Programmatic theme access
|
|
247
|
+
|
|
248
|
+
\`\`\`tsx
|
|
249
|
+
import { theme } from '@volue/wave-react';
|
|
250
|
+
|
|
251
|
+
// .value returns raw values ("#0c4957", "0.5rem") for JavaScript operations
|
|
252
|
+
const rawColor = theme.colors.foregroundAccent.value;
|
|
253
|
+
const rawSpacing = theme.space.spacingS.value;
|
|
254
|
+
const rawSize = theme.sizes['20'].value;
|
|
255
|
+
|
|
256
|
+
// .computedValue (or default) returns serialized CSS variables ("var(--colors-foregroundAccent)")
|
|
257
|
+
const cssVar = theme.colors.foregroundAccent.computedValue;
|
|
258
|
+
\`\`\`
|
|
259
|
+
`}]}})}},Ee={name:"init",description:"Get guide on how to setup or create a project that includes Wave Design System.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n},async()=>{try{return{content:[{type:"text",text:`The getting started documentation for developing with Wave Design System is included below.
|
|
260
|
+
|
|
261
|
+
It's **important** that if the project is using a tool like Vite or Next.js, one of the pre-configured starter templates should be used instead of manual configuration:
|
|
262
|
+
|
|
263
|
+
- https://github.com/Volue/wave-vite-example (Vite template)
|
|
264
|
+
- https://github.com/Volue/wave-nextjs-app-router-example (Next.js App Router template)
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
${await fe()}
|
|
269
|
+
`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve getting started documentation: ${p(o)}`}]}}})}},Re={name:"list_components",description:"List all components available from the Wave Design System. This tool retrieves the names of all available Wave Design System components grouped by category.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n},async()=>{try{const o=await w(),r=L(o);return{content:[{type:"text",text:`The following components are available in the Wave Design System:
|
|
270
|
+
|
|
271
|
+
${Object.entries(r).map(([s,c])=>`## ${s}
|
|
272
|
+
${c.map(l=>`- ${l.name}`).join(`
|
|
273
|
+
`)}`).join(`
|
|
274
|
+
|
|
275
|
+
`)}
|
|
276
|
+
|
|
277
|
+
Use the \`get_component\` tool to get more information about a specific component.
|
|
278
|
+
|
|
279
|
+
Use these components from the \`@volue/wave-react\` package.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the component index: ${p(o)}`}]}}})}},Me={name:"list_icons",description:"List all icons available from the Wave Design System. Icons are sourced directly from the `@volue/design-icons` package.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n},async()=>{try{return{content:[{type:"text",text:`The following icons are available in the Wave Design System:
|
|
280
|
+
|
|
281
|
+
${S().map(a=>`- ${a.name}`).join(`
|
|
282
|
+
`)}
|
|
283
|
+
|
|
284
|
+
Use the \`get_icon\` tool to retrieve the SVG markup and usage guidelines for a specific icon.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the icon data: ${p(o)}`}]}}})}},_e={name:"list_patterns",description:"List all UX patterns available from the Wave Design System. This tool retrieves the names of all available Wave Design System patterns grouped by category.",exec(e,{name:t,description:n}){e.registerTool(t,{description:n},async()=>{try{const o=await k(),r=L(o);return{content:[{type:"text",text:`The following UX patterns are available in the Wave Design System:
|
|
285
|
+
|
|
286
|
+
${Object.entries(r).map(([s,c])=>`## ${s}
|
|
287
|
+
${c.map(l=>`- ${l.name}`).join(`
|
|
288
|
+
`)}`).join(`
|
|
289
|
+
|
|
290
|
+
`)}
|
|
291
|
+
|
|
292
|
+
Use the \`get_pattern\` tool to access detailed guidance for a specific pattern.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the pattern index: ${p(o)}`}]}}})}},Ue=[Ee,Re,ke,_e,$e,we,Me,Te,Ie,Ce];async function Le(e){await Promise.all(Ue.map(async t=>{let n;try{n=await t.ctx?.()}catch(o){console.error(`Skipping tool "${t.name}":`,o);return}t.exec(e,{name:t.name,description:t.description,ctx:n})}))}i(Le,"initializeTools");export{Le as i,Q as p};
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var a=Object.defineProperty;var s=(o,r)=>a(o,"name",{value:r,configurable:!0});import{i}from"./isEntryFile-gJoj6hFD.js";import{c as g}from"./server-HCwNdOGQ.js";import"node:fs";import"node:url";import"@modelcontextprotocol/sdk/server/mcp.js";import"@modelcontextprotocol/sdk/validation/cfworker";if(i(import.meta.url)){const r=process.argv.slice(2)[0]||"stdio";async function e(){try{switch(r){case"stdio":await import("./transports/stdio.js");break;case"http":{const{startServer:t}=await import("./transports/http.js");t();break}default:console.error(`Unknown transport: ${r}`),console.error("Available transports: stdio, http"),process.exit(1)}}catch(t){console.error("Error running transport:",t),process.exit(1)}}s(e,"run"),e()}export{g as createServer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var o=Object.defineProperty;var e=(r,t)=>o(r,"name",{value:t,configurable:!0});import{realpathSync as s}from"node:fs";import{pathToFileURL as i}from"node:url";function n(r){if(!process.argv[1])return!1;const t=s(process.argv[1]),a=i(t);return r===a.href}e(n,"isEntryFile");export{n as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t=Object.defineProperty;var e=(o,n)=>t(o,"name",{value:n,configurable:!0});import{McpServer as a}from"@modelcontextprotocol/sdk/server/mcp.js";import{CfWorkerJsonSchemaValidator as s}from"@modelcontextprotocol/sdk/validation/cfworker";var i="0.2.0-next.1",c="An MCP server that connects AI tools to the Wave Design System",r={version:i,description:c};function v(){return new a({name:"Wave Design System",version:r.version},{capabilities:{tools:{}},jsonSchemaValidator:new s})}e(v,"createServer");export{v as c,r as p};
|
package/dist/transports/http.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var m=Object.defineProperty;var e=(o,r)=>m(o,"name",{value:r,configurable:!0});import{serve as n}from"@hono/node-server";import c from"../app.js";import{i as l}from"../isEntryFile-gJoj6hFD.js";import"@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";import"@modelcontextprotocol/sdk/types.js";import"hono";import"hono/cors";import"../server-HCwNdOGQ.js";import"@modelcontextprotocol/sdk/server/mcp.js";import"@modelcontextprotocol/sdk/validation/cfworker";import"../index-DL4W1Dsp.js";import"@volue/design-colors/generic";import"@volue/design-icons";import"@volue/design-media-queries";import"remark-parse";import"unified";import"zod";import"@volue/design-colors/flat";import"node:fs";import"node:url";function i(){const o=process.env.HOST??"localhost",r=process.env.PORT?Number(process.env.PORT):3e3,p=n({fetch:c.fetch,hostname:o,port:r},()=>{console.log(`\u{1F680} Wave MCP Server running on http://${o}:${r}`),console.log(`\u{1F517} Connect via http://${o}:${r}/mcp`)});p.on("error",t=>{console.error("\u274C Failed to start server:",t),process.exit(1)});const s=e(async()=>{await new Promise(t=>p.close(()=>t())),console.log("\u{1F44B} Server shut down gracefully"),process.exit(0)},"cleanup");process.on("SIGTERM",s),process.on("SIGINT",s)}e(i,"startServer"),l(import.meta.url)&&i();export{i as startServer};
|
package/dist/transports/stdio.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
2
|
+
var e=Object.defineProperty;var t=(o,r)=>e(o,"name",{value:r,configurable:!0});import{StdioServerTransport as s}from"@modelcontextprotocol/sdk/server/stdio.js";import{c as a}from"../server-HCwNdOGQ.js";import{i as c}from"../index-DL4W1Dsp.js";import"@modelcontextprotocol/sdk/server/mcp.js";import"@modelcontextprotocol/sdk/validation/cfworker";import"@volue/design-colors/generic";import"@volue/design-icons";import"@volue/design-media-queries";import"remark-parse";import"unified";import"zod";import"@volue/design-colors/flat";async function p(){const o=a();await c(o);const r=new s;await o.connect(r);const i=t(async()=>{await r.close(),process.exit(0)},"cleanup");process.on("SIGTERM",i),process.on("SIGINT",i)}t(p,"main"),p().catch(o=>{console.error("\u274C Failed to start server:",o),process.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volue/wave-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-next.1",
|
|
4
4
|
"description": "An MCP server that connects AI tools to the Wave Design System",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"types": "./dist/index.d.ts",
|
|
22
22
|
"default": "./dist/index.js"
|
|
23
23
|
},
|
|
24
|
+
"./app": {
|
|
25
|
+
"types": "./dist/app.d.ts",
|
|
26
|
+
"default": "./dist/app.js"
|
|
27
|
+
},
|
|
24
28
|
"./transports/stdio": {
|
|
25
29
|
"types": "./dist/transports/stdio.d.ts",
|
|
26
30
|
"default": "./dist/transports/stdio.js"
|
|
@@ -47,29 +51,28 @@
|
|
|
47
51
|
"start": "yarn run build && yarn node dist/transports/http.js",
|
|
48
52
|
"dev": "tsx watch --clear-screen=false src/transports/http.ts",
|
|
49
53
|
"prepack": "yarn run build",
|
|
54
|
+
"deploy:next": "yarn dlx -q wrangler@4 deploy --env next",
|
|
55
|
+
"deploy:production": "yarn dlx -q wrangler@4 deploy --env production",
|
|
50
56
|
"inspect": "yarn run build && yarn dlx -q @modelcontextprotocol/inspector --transport=stdio node dist/transports/stdio.js",
|
|
51
57
|
"inspect:http": "yarn dlx -q @modelcontextprotocol/inspector --transport http --server-url http://localhost:3000/mcp"
|
|
52
58
|
},
|
|
53
59
|
"dependencies": {
|
|
60
|
+
"@cfworker/json-schema": "4.1.1",
|
|
61
|
+
"@hono/node-server": "2.1.1",
|
|
54
62
|
"@modelcontextprotocol/sdk": "1.30.0",
|
|
55
|
-
"@types/cors": "2.8.19",
|
|
56
|
-
"@types/express": "5.0.6",
|
|
57
|
-
"@types/express-serve-static-core": "5.1.3",
|
|
58
63
|
"@types/mdast": "3.0.15",
|
|
59
64
|
"@volue/design-colors": "^3.1.2-next.3",
|
|
60
65
|
"@volue/design-icons": "^2.0.2-next.3",
|
|
61
66
|
"@volue/design-media-queries": "^1.3.24-next.3",
|
|
62
|
-
"
|
|
63
|
-
"express": "5.2.1",
|
|
67
|
+
"hono": "4.13.2",
|
|
64
68
|
"remark-parse": "8.0.3",
|
|
65
69
|
"unified": "9.2.2",
|
|
66
|
-
"
|
|
67
|
-
"zod": "3.25.76"
|
|
70
|
+
"zod": "4.4.3"
|
|
68
71
|
},
|
|
69
72
|
"devDependencies": {
|
|
70
73
|
"@types/node": "22.20.1",
|
|
71
74
|
"@volue/eslint-config": "1.3.12",
|
|
72
|
-
"@volue/wave-react": "2.0.0-next.
|
|
75
|
+
"@volue/wave-react": "2.0.0-next.11",
|
|
73
76
|
"eslint": "9.39.5",
|
|
74
77
|
"npm-run-all2": "8.0.4",
|
|
75
78
|
"pkgroll": "2.27.1",
|
package/dist/index-7C65hTxB.js
DELETED
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
var U=Object.defineProperty;var s=(e,t)=>U(e,"name",{value:t,configurable:!0});import{a as p,f as u,u as y,g as d}from"./server-DavBHU1k.js";import A from"@volue/design-colors/generic";import*as N from"@volue/design-icons";import*as D from"@volue/design-media-queries";import F from"remark-parse";import j from"unified";import{z as v}from"zod";import{core as O,background as H,foreground as V,border as G,rgb as X,data as q}from"@volue/design-colors/flat";function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},m.apply(null,arguments)}s(m,"_extends");const J="0 1px 2.5px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.08)), 0 3px 9px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.048))",Q="0 0.4px 2.2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.022)), 0 1.4px 5px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.04)), 0 5px 14px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.06))",Y="0 0.3px 2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.5px 8px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.024)), 0 4px 16px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.04)), 0 8px 24px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.07))",K="0 0.7px 2px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.015)), 0 1.6px 8px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.024)), 0 3.3px 16px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.034)), 0 5px 26px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.06)), 0 12px 42px hsla(var(--shadow-color, 166, 48%, 7%), calc(var(--shadow-intensity, 1) * 0.08))";var Z=Object.freeze({__proto__:null,elevationL:K,elevationM:Y,elevationS:Q,elevationXs:J}),h={base:{2:"0.125rem",4:"0.25rem",6:"0.375rem",8:"0.5rem",12:"0.75rem",14:"0.875rem",16:"1rem",20:"1.25rem",24:"1.5rem",28:"1.75rem",32:"2rem",36:"2.25rem",40:"2.5rem",44:"2.75rem",48:"3rem",64:"4rem",72:"4.5rem",80:"5rem",96:"6rem",112:"7rem",128:"8rem"},borderRadius:{xs:"0.25rem",s:"0.375rem",m:"0.5rem",l:"0.75rem",xl:"1rem",full:"100vh"},spacing:{xs:"0.25rem",s:"0.5rem",m:"1rem",l:"1.5rem",xl:"2rem",xxl:"3rem",xxxl:"4.5rem"}},g={font:{family:{base:"'IBM Plex Sans', 'IBM Plex Sans Fallback: -apple-system', 'IBM Plex Sans Fallback: Segoe UI', 'IBM Plex Sans Fallback: Roboto', 'IBM Plex Sans Fallback: Arial', 'IBM Plex Sans Fallback: Noto Sans', -apple-system, 'Segoe UI', Roboto, Arial, 'Noto Sans', sans-serif",display:"'IBM Plex Sans', 'IBM Plex Sans Fallback: -apple-system', 'IBM Plex Sans Fallback: Segoe UI', 'IBM Plex Sans Fallback: Roboto', 'IBM Plex Sans Fallback: Arial', 'IBM Plex Sans Fallback: Noto Sans', -apple-system, 'Segoe UI', Roboto, Arial, 'Noto Sans', sans-serif",mono:"ui-monospace, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"},weight:{normal:"400",semibold:"600"}},size:{font:{base:"16px",eta:"12px",zeta:"14px",epsilon:"16px",delta:"19px",gamma:"21px",beta:"28px",alpha:"38px",giga:"51px"},letterSpacing:{tighter:"-0.05em",tight:"-0.025em",normal:"normal",wide:"0.025em",wider:"0.05em",widest:"0.1em"},lineHeight:{none:"1",body:"1.5",base:"1.5rem",small:"1.25rem",xSmall:"1.125rem",zeta:"1.714286",epsilon:"1.5",delta:"1.263158",gamma:"1.52381",beta:"1.714286",alpha:"1.263158",giga:"1.411765"}}};function ee(e){return e.charAt(0).toUpperCase()+e.slice(1)}s(ee,"capitalizeFirstLetter");var T=Object.keys(h.spacing).reduce(function(e,t){var n;return m({},e,(n={},n["spacing"+ee(t)]=h.spacing[t],n))},{}),C={colors:m({},O,H,V,G,X,q),space:T,zIndices:{auto:"auto",0:"0",1:"100",2:"200",3:"300",4:"400",5:"500",9:"900"},fonts:g.font.family,fontWeights:g.font.weight,fontSizes:g.size.font,lineHeights:g.size.lineHeight,letterSpacings:g.size.letterSpacing,sizes:m({},h.base,{measureNarrow:"30ch",measureMedium:"60ch",measureWide:"90ch",containerNarrow:"32rem",containerMedium:"48rem",containerWide:"74rem"}),radii:m({},h.borderRadius,T),shadows:m({},Z,{lift:"0 10px 20px -5px rgba(0, 0, 0, 0.15)"})};const te=j().use(F),B={Components:"component","UX patterns":"pattern"};function ne(e,t){const n=te.parse(e);let o=null;return n.children.reduce((r,a)=>{if(p(a,"heading")&&a.depth===2)return o=oe(a),r;if(!o||!p(a,"list"))return r;const i=o,c=a.children.map(l=>re(l,i,t)).filter(l=>l!==null);return r.concat(c)},[])}s(ne,"parseLlmsIndex");function oe(e){const[t]=e.children;if(!t||!p(t,"text"))return null;const n=t.value.trim();if(!(n in B))return null;const o=B[n];return{title:n,type:o}}s(oe,"extractSectionContext");function re(e,t,n){const[o]=e.children;if(!o||!p(o,"paragraph")||o.children.length!==2)return null;const[r,a]=o.children;if(!p(r,"link")||!p(a,"text")||r.children.length!==1)return null;const i=r.children[0];if(!p(i,"text"))return null;const c=i.value.trim(),l=r.url.replace(/^\//,""),_=new URL(l,`${n}/`).toString(),P=ae(l),z=se(t.title,l,t.type),W=ce(a.value);return{name:c,slug:P,category:z,section:t.title,type:t.type,url:_,description:W??void 0}}s(re,"listItemToResource");function ae(e){return e.replace(/\.md$/,"").split("/").pop()??""}s(ae,"deriveSlug");function se(e,t,n){const o=t.replace(/\.md$/,"").split("/");if(n==="component"||n==="pattern"){const r=o.length>=3?o[o.length-2]:null;return r?`${e} / ${ie(r)}`:e}return e}s(se,"deriveCategory");function ie(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}s(ie,"formatSegment");function ce(e){if(!e)return null;const t=e.replace(/^\s*:\s*/,"").trim();return t.toLowerCase()==="no description available"?null:t}s(ce,"normalizeDescription");const x=process.env.USE_STABLE_DOCS==="true"||process.env.USE_STABLE_DOCS==="1"?"https://wave.volue.com":"https://next.wave-design-system.pages.dev",le=`${x}/llms.txt`,de=1e3*60*15,pe=process.env.WAVE_RESOURCES_CACHE_TIME?Number.parseInt(process.env.WAVE_RESOURCES_CACHE_TIME,10):de;function b(e){const t=new URL(e,x);return t.pathname.endsWith(".md")||(t.pathname+=".md"),t.toString()}s(b,"createUrl");let S=null,I=0;async function me(){if(S!==null&&Date.now()<I)return S;const e=await ue();return S=e,I=Date.now()+pe,e}s(me,"listCachedResources");let f=null;async function ue(){return f||(f=ge().finally(()=>{f=null})),f}s(ue,"idempotentLoadResourcesFromLlms");async function ge(){const e=await u(le,void 0,"fetch llms.txt");return ne(e,x)}s(ge,"loadResourcesFromLlms");async function he(e){return u(e.url,void 0,`fetch ${e.name} documentation`)}s(he,"fetchComponent");function fe(e){return u(e.url,void 0,`fetch ${e.name} pattern`)}s(fe,"fetchPattern");async function ye(){return u(b("get-started/developing"),void 0,"fetch developing guide")}s(ye,"fetchDevelopingGuide");async function ve(){return u(b("tokens/colors"),void 0,"fetch color usage guidelines")}s(ve,"fetchColorUsageGuidelines");function w(){return Object.entries(N).map(([e,t])=>({name:e,svg:t}))}s(w,"listIcons");function xe(){const e=w();return y(e.map(t=>t.name))}s(xe,"getIconNames");function be(e,t){const n=t.trim().toLowerCase();return e.find(o=>o.name.toLowerCase()===n)}s(be,"findIconByName");async function R(e){return(await me()).filter(n=>n.type===e)}s(R,"listResourcesByType");function E(e,t){const n=t.trim().toLowerCase();return e.find(o=>o.name.toLowerCase()===n)}s(E,"findResourceByName");function k(){return R("component")}s(k,"listComponents");async function Se(){const e=await k();return y(e.map(t=>t.name))}s(Se,"getComponentNames");function $(){return R("pattern")}s($,"listPatterns");async function we(){const e=await $();return y(e.map(t=>t.name))}s(we,"getPatternNames");function M(e){return e.reduce((t,n)=>(t[n.category]||(t[n.category]=[]),t[n.category].push(n),t),{})}s(M,"groupResourcesByCategory");const ke={name:"get_color_usage",description:"Retrieve the Wave Design System color tokens and guidelines for applying color in user interfaces.",exec(e,{name:t,description:n}){e.tool(t,n,async()=>{try{const o=await ve();return{content:[{type:"text",text:JSON.stringify(A)},{type:"text",text:`Here are the Wave Design System color usage guidelines:
|
|
2
|
-
|
|
3
|
-
${o}
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
Source: ${b("tokens/colors")}`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve color usage guidelines: ${d(o)}`}]}}})}},$e={name:"get_component",description:"Retrieve comprehensive documentation for a specific Wave Design System component by name. This tool retrieves the import instructions, basic usage and advanced configuration examples, code snippets for common scenarios, available props/properties table and some general guidelines for a given Wave Design System component.",async ctx(){try{return{componentNames:await Se()}}catch(e){throw new Error(`Failed to initialize component tool: ${d(e)}`)}},exec(e,{ctx:t,name:n,description:o}){e.tool(n,o,{name:v.enum(t.componentNames).describe("The name of the component to retrieve documentation for. This can be derived from calling the `get_components` tool.")},async({name:r})=>{try{const a=await k(),i=E(a,r);if(!i)throw new Error("Component not found");const c=await he(i);return c?{content:[{type:"text",text:`Here is the documentation for the \`${i.name}\` component from the Wave Design System:
|
|
7
|
-
|
|
8
|
-
${c}
|
|
9
|
-
|
|
10
|
-
---
|
|
11
|
-
Source: ${i.url}`}]}:{content:[{type:"text",text:`No documentation content found for the \`${i.name}\` component.`}]}}catch(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${d(a)}`}]}}})}},Te={name:"get_icon",description:"Retrieve a specific icon information by name from Wave Design System.",exec(e,{name:t,description:n}){e.tool(t,n,{name:v.enum(xe()).describe("The icon name to retrieve. This can be derived from calling the `list_icon` tool.")},async({name:o})=>{try{const r=w(),a=be(r,o);if(!a)throw new Error("Icon not found.");const i=`<SvgIcon iconName="${a.name}" />`,c=`<div class="svgIcon svgIcon--stroked">
|
|
12
|
-
<svg focusable="false" aria-hidden="true">
|
|
13
|
-
<use xlink:href="#svg--${a.name}"></use>
|
|
14
|
-
</svg>
|
|
15
|
-
</div>`;return{content:[{type:"text",text:`# ${a.name} icon
|
|
16
|
-
|
|
17
|
-
## React component:
|
|
18
|
-
|
|
19
|
-
\`\`\`tsx
|
|
20
|
-
${i}
|
|
21
|
-
\`\`\`
|
|
22
|
-
|
|
23
|
-
## HTML markup:
|
|
24
|
-
|
|
25
|
-
\`\`\`html
|
|
26
|
-
${c}
|
|
27
|
-
\`\`\`
|
|
28
|
-
|
|
29
|
-
## Raw SVG code:
|
|
30
|
-
|
|
31
|
-
\`\`\`svg
|
|
32
|
-
${a.svg}
|
|
33
|
-
\`\`\``}]}}catch(r){return{isError:!0,content:[{type:"text",text:`Failed to retrieve icon \`${o}\`: ${d(r)}`}]}}})}},Ce={name:"get_pattern",description:"Retrieve documentation for a specific Wave Design System UX pattern by name. This tool provides guidance, examples and components that implement the selected pattern.",async ctx(){try{return{patternNames:await we()}}catch(e){throw new Error(`Failed to initialize pattern tool: ${d(e)}`)}},exec(e,{ctx:t,name:n,description:o}){e.tool(n,o,{name:v.enum(t.patternNames).describe("The name of the UX pattern to retrieve documentation for. This can be derived from calling the `list_patterns` tool.")},async({name:r})=>{try{const a=await $(),i=E(a,r);if(!i)throw new Error("Pattern not found");const c=await fe(i);return{content:[{type:"text",text:`Here are the guidelines for the \`${i.name}\` UX pattern from the Wave Design System:
|
|
34
|
-
|
|
35
|
-
${c}
|
|
36
|
-
|
|
37
|
-
---
|
|
38
|
-
Source: ${i.url}`}]}}catch(a){return{isError:!0,content:[{type:"text",text:`Failed to retrieve documentation for \`${r}\`: ${d(a)}`}]}}})}},Be={name:"get_styling_guidelines",description:"Retrieve guidelines for styling Wave Design System components and creating custom styled components.",exec(e,{name:t,description:n}){e.tool(t,n,async()=>({content:[{type:"text",text:`Wave Design System components can be styled using standard React approaches (className, style prop), but Wave provides specialized styling APIs for customizing component styles and creating custom styled components. These APIs are powered by Stitches.js, a CSS-in-JS library with near-zero runtime. They are the recommended approach because they integrate seamlessly with Wave's design tokens and provide type-safe styles.
|
|
39
|
-
|
|
40
|
-
## Styling APIs
|
|
41
|
-
|
|
42
|
-
### CSS prop
|
|
43
|
-
|
|
44
|
-
The \`css\` property is available on all Wave components for styling. It generates CSS class names from the style object, supporting all standard CSS properties and selectors, plus design tokens and responsive breakpoints.
|
|
45
|
-
|
|
46
|
-
Example:
|
|
47
|
-
|
|
48
|
-
\`\`\`tsx
|
|
49
|
-
import { Box } from '@volue/wave-react';
|
|
50
|
-
|
|
51
|
-
<Box
|
|
52
|
-
css={{
|
|
53
|
-
display: 'flex',
|
|
54
|
-
color: '$foregroundInverse',
|
|
55
|
-
backgroundColor: '$backgroundAccentStrong',
|
|
56
|
-
padding: '$spacingM'
|
|
57
|
-
}}
|
|
58
|
-
/>
|
|
59
|
-
\`\`\`
|
|
60
|
-
|
|
61
|
-
The \`css\` prop works best for one-off style customizations of specific component instances.
|
|
62
|
-
|
|
63
|
-
### Styled function
|
|
64
|
-
|
|
65
|
-
Use \`styled()\` to create reusable styled components with semantic names. It supports all \`css\` prop features, variants for conditional styling, and provides better performance than the \`css\` prop.
|
|
66
|
-
|
|
67
|
-
\`\`\`tsx
|
|
68
|
-
import { styled } from '@volue/wave-react';
|
|
69
|
-
|
|
70
|
-
// Create a simple styled component
|
|
71
|
-
const Container = styled('div', {
|
|
72
|
-
padding: '$spacingM',
|
|
73
|
-
backgroundColor: '$backgroundNeutralSubtle',
|
|
74
|
-
borderRadius: '$borderRadiusM'
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
// Create a styled component with variants
|
|
78
|
-
const SectionTitle = styled('h2', {
|
|
79
|
-
fontWeight: '$semibold',
|
|
80
|
-
color: '$foregroundAccent',
|
|
81
|
-
|
|
82
|
-
variants: {
|
|
83
|
-
size: {
|
|
84
|
-
medium: {
|
|
85
|
-
fontSize: '$gamma',
|
|
86
|
-
},
|
|
87
|
-
large: {
|
|
88
|
-
fontSize: '$beta',
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
// optional defaultVariants
|
|
94
|
-
defaultVariants: {
|
|
95
|
-
size: 'medium'
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
// Use with a specific variant
|
|
100
|
-
<SectionTitle size="large">Analytics Overview</SectionTitle>
|
|
101
|
-
|
|
102
|
-
// Extend an existing Wave component
|
|
103
|
-
import { AppFrame } from '@volue/wave-react';
|
|
104
|
-
|
|
105
|
-
const StyledAppFrame = styled(AppFrame.Root, {
|
|
106
|
-
backgroundColor: '$backgroundNeutralMinimal'
|
|
107
|
-
});
|
|
108
|
-
\`\`\`
|
|
109
|
-
|
|
110
|
-
## Design tokens
|
|
111
|
-
|
|
112
|
-
Wave provides a comprehensive set of design tokens for colors, spacing, typography, border radii, shadows, and more. All tokens are available in both \`css\` prop and \`styled()\` function using the \`$tokenName\` syntax (as shown in the examples above).
|
|
113
|
-
|
|
114
|
-
**Use the \`get_tokens\` tool to discover all available design tokens** including their values and usage examples.
|
|
115
|
-
|
|
116
|
-
## Media Query Tokens
|
|
117
|
-
|
|
118
|
-
Wave provides media query tokens for responsive design. Use these tokens to create breakpoint-based styles:
|
|
119
|
-
|
|
120
|
-
${Object.entries(D).map(([r,a])=>`- \`@${r}\`: ${a}`).join(`
|
|
121
|
-
`)}
|
|
122
|
-
|
|
123
|
-
### Responsive styling examples
|
|
124
|
-
|
|
125
|
-
**Using media queries with the css prop:**
|
|
126
|
-
|
|
127
|
-
\`\`\`tsx
|
|
128
|
-
import { Box } from '@volue/wave-react';
|
|
129
|
-
|
|
130
|
-
<Box
|
|
131
|
-
css={{
|
|
132
|
-
padding: '$spacingS',
|
|
133
|
-
|
|
134
|
-
'@mqMediumAndUp': {
|
|
135
|
-
padding: '$spacingM'
|
|
136
|
-
},
|
|
137
|
-
'@mqLargeAndUp': {
|
|
138
|
-
padding: '$spacingL'
|
|
139
|
-
}
|
|
140
|
-
}}
|
|
141
|
-
>
|
|
142
|
-
Responsive padding
|
|
143
|
-
</Box>
|
|
144
|
-
\`\`\`
|
|
145
|
-
|
|
146
|
-
**Using media queries with styled function:**
|
|
147
|
-
|
|
148
|
-
\`\`\`tsx
|
|
149
|
-
import { styled } from '@volue/wave-react';
|
|
150
|
-
|
|
151
|
-
const ResponsiveContainer = styled('div', {
|
|
152
|
-
display: 'flex',
|
|
153
|
-
flexDirection: 'column',
|
|
154
|
-
gap: '$spacingS',
|
|
155
|
-
|
|
156
|
-
'@mqMediumAndUp': {
|
|
157
|
-
flexDirection: 'row',
|
|
158
|
-
gap: '$spacingM'
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
\`\`\`
|
|
162
|
-
|
|
163
|
-
**Responsive variants:**
|
|
164
|
-
|
|
165
|
-
\`\`\`tsx
|
|
166
|
-
import { styled } from '@volue/wave-react';
|
|
167
|
-
|
|
168
|
-
const Button = styled('button', {
|
|
169
|
-
variants: {
|
|
170
|
-
size: {
|
|
171
|
-
small: { padding: '$spacingS' },
|
|
172
|
-
large: { padding: '$spacingL' }
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
// Apply different variants at different breakpoints
|
|
178
|
-
<Button
|
|
179
|
-
size={{
|
|
180
|
-
'@initial': 'small',
|
|
181
|
-
'@mqLargeAndUp': 'large'
|
|
182
|
-
}}
|
|
183
|
-
>
|
|
184
|
-
Responsive button
|
|
185
|
-
</Button>
|
|
186
|
-
\`\`\`
|
|
187
|
-
|
|
188
|
-
## Best practices
|
|
189
|
-
|
|
190
|
-
1. **Use design tokens**: Always prefer design tokens (prefixed with \`$\`) over hardcoded values for consistency. Use the \`get_tokens\` tool to discover available tokens.
|
|
191
|
-
2. **Choose the right API**: Use \`css\` prop for one-off styles, \`styled()\` for reusable components
|
|
192
|
-
3. **Semantic breakpoints**: Use Wave's semantic media query tokens rather than arbitrary pixel values
|
|
193
|
-
`}]}))}},Ie={colors:["background","backgroundColor","backgroundImage","border","borderBlock","borderBlockEnd","borderBlockStart","borderBottom","borderBottomColor","borderColor","borderInline","borderInlineEnd","borderInlineStart","borderLeft","borderLeftColor","borderRight","borderRightColor","borderTop","borderTopColor","caretColor","color","columnRuleColor","fill","outlineColor","stroke","textDecorationColor"],fonts:["fontFamily"],fontSizes:["fontSize"],fontWeights:["fontWeight"],lineHeights:["lineHeight"],letterSpacings:["letterSpacing"],radii:["borderRadius","borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],sizes:["blockSize","minBlockSize","maxBlockSize","inlineSize","minInlineSize","maxInlineSize","width","minWidth","maxWidth","height","minHeight","maxHeight","flexBasis","gridTemplateColumns","gridTemplateRows"],space:["gap","gridGap","columnGap","gridColumnGap","rowGap","gridRowGap","inset","insetBlock","insetBlockEnd","insetBlockStart","insetInline","insetInlineEnd","insetInlineStart","margin","marginTop","marginRight","marginBottom","marginLeft","marginBlock","marginBlockEnd","marginBlockStart","marginInline","marginInlineEnd","marginInlineStart","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingBlock","paddingBlockEnd","paddingBlockStart","paddingInline","paddingInlineEnd","paddingInlineStart","top","right","bottom","left","scrollMargin","scrollMarginTop","scrollMarginRight","scrollMarginBottom","scrollMarginLeft","scrollMarginX","scrollMarginY","scrollMarginBlock","scrollMarginBlockEnd","scrollMarginBlockStart","scrollMarginInline","scrollMarginInlineEnd","scrollMarginInlineStart","scrollPadding","scrollPaddingTop","scrollPaddingRight","scrollPaddingBottom","scrollPaddingLeft","scrollPaddingX","scrollPaddingY","scrollPaddingBlock","scrollPaddingBlockEnd","scrollPaddingBlockStart","scrollPaddingInline","scrollPaddingInlineEnd","scrollPaddingInlineStart"],zIndices:["zIndex"],shadows:["boxShadow","textShadow"],transitions:["transition"],borderWidths:["borderWidth","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],borderStyles:["borderStyle","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle"]},Re={name:"get_tokens",description:"Retrieve the Wave Design System design tokens (colors, fonts, spacing, font styles, etc.) exposed by the `@volue/wave-react` package. Includes token type mappings to CSS properties and usage examples.",exec(e,{name:t,description:n}){e.tool(t,n,async()=>{const o=Object.entries(Ie).map(([r,a])=>`| ${r} | ${a.join(", ")} |`).join(`
|
|
194
|
-
`);return{content:[{type:"text",text:`Below is a list of design tokens available from Wave Design System.
|
|
195
|
-
There are ${Object.keys(C).length} token types available:
|
|
196
|
-
|
|
197
|
-
${JSON.stringify(C)}`},{type:"text",text:`## Token Type to CSS Property Mapping
|
|
198
|
-
|
|
199
|
-
Token types are automatically mapped to CSS Properties:
|
|
200
|
-
|
|
201
|
-
| Token | Properties |
|
|
202
|
-
|-------|------------|
|
|
203
|
-
${o}
|
|
204
|
-
|
|
205
|
-
## Using tokens
|
|
206
|
-
|
|
207
|
-
Tokens can be used to style components.
|
|
208
|
-
|
|
209
|
-
\`\`\`tsx
|
|
210
|
-
import { styled } from '@volue/wave-react';
|
|
211
|
-
|
|
212
|
-
const Button = styled('button', {
|
|
213
|
-
backgroundColor: '$backgroundAccentStrong'
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
() => <Button>Button</Button>;
|
|
217
|
-
\`\`\`
|
|
218
|
-
|
|
219
|
-
Tokens also work inside the \`css\` prop.
|
|
220
|
-
|
|
221
|
-
\`\`\`tsx
|
|
222
|
-
const Button = styled('button', {});
|
|
223
|
-
|
|
224
|
-
() => (
|
|
225
|
-
<Button
|
|
226
|
-
css={{
|
|
227
|
-
backgroundColor: '$backgroundAccentStrong'
|
|
228
|
-
}}
|
|
229
|
-
>
|
|
230
|
-
Button
|
|
231
|
-
</Button>
|
|
232
|
-
);
|
|
233
|
-
\`\`\`
|
|
234
|
-
|
|
235
|
-
You can pick a token from any of available token types by prefixing them with the type name, in case they aren't automatically mapped.
|
|
236
|
-
|
|
237
|
-
\`\`\`tsx
|
|
238
|
-
const Button = styled('button', {
|
|
239
|
-
// use a token from the sizes scale
|
|
240
|
-
marginTop: '$sizes$6'
|
|
241
|
-
});
|
|
242
|
-
\`\`\`
|
|
243
|
-
|
|
244
|
-
For more comprehensive styling guidelines including responsive design, variants, and best practices, use the \`get_styling_guidelines\` tool.
|
|
245
|
-
|
|
246
|
-
## Programmatic theme access
|
|
247
|
-
|
|
248
|
-
\`\`\`tsx
|
|
249
|
-
import { theme } from '@volue/wave-react';
|
|
250
|
-
|
|
251
|
-
// .value returns raw values ("#0c4957", "0.5rem") for JavaScript operations
|
|
252
|
-
const rawColor = theme.colors.foregroundAccent.value;
|
|
253
|
-
const rawSpacing = theme.space.spacingS.value;
|
|
254
|
-
const rawSize = theme.sizes['20'].value;
|
|
255
|
-
|
|
256
|
-
// .computedValue (or default) returns serialized CSS variables ("var(--colors-foregroundAccent)")
|
|
257
|
-
const cssVar = theme.colors.foregroundAccent.computedValue;
|
|
258
|
-
\`\`\`
|
|
259
|
-
`}]}})}},Ee={name:"init",description:"Get guide on how to setup or create a project that includes Wave Design System.",exec(e,{name:t,description:n}){e.tool(t,n,async()=>{try{return{content:[{type:"text",text:`The getting started documentation for developing with Wave Design System is included below.
|
|
260
|
-
|
|
261
|
-
It's **important** that if the project is using a tool like Vite or Next.js, one of the pre-configured starter templates should be used instead of manual configuration:
|
|
262
|
-
|
|
263
|
-
- https://github.com/Volue/wave-vite-example (Vite template)
|
|
264
|
-
- https://github.com/Volue/wave-nextjs-app-router-example (Next.js App Router template)
|
|
265
|
-
|
|
266
|
-
---
|
|
267
|
-
|
|
268
|
-
${await ye()}
|
|
269
|
-
`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve getting started documentation: ${d(o)}`}]}}})}},Me={name:"list_components",description:"List all components available from the Wave Design System. This tool retrieves the names of all available Wave Design System components grouped by category.",exec(e,{name:t,description:n}){e.tool(t,n,async()=>{try{const o=await k(),r=M(o);return{content:[{type:"text",text:`The following components are available in the Wave Design System:
|
|
270
|
-
|
|
271
|
-
${Object.entries(r).map(([i,c])=>`## ${i}
|
|
272
|
-
${c.map(l=>`- ${l.name}`).join(`
|
|
273
|
-
`)}`).join(`
|
|
274
|
-
|
|
275
|
-
`)}
|
|
276
|
-
|
|
277
|
-
Use the \`get_component\` tool to get more information about a specific component.
|
|
278
|
-
|
|
279
|
-
Use these components from the \`@volue/wave-react\` package.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the component index: ${d(o)}`}]}}})}},Le={name:"list_icons",description:"List all icons available from the Wave Design System. Icons are sourced directly from the `@volue/design-icons` package.",exec(e,{name:t,description:n}){e.tool(t,n,async()=>{try{return{content:[{type:"text",text:`The following icons are available in the Wave Design System:
|
|
280
|
-
|
|
281
|
-
${w().map(a=>`- ${a.name}`).join(`
|
|
282
|
-
`)}
|
|
283
|
-
|
|
284
|
-
Use the \`get_icon\` tool to retrieve the SVG markup and usage guidelines for a specific icon.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the icon data: ${d(o)}`}]}}})}},_e={name:"list_patterns",description:"List all UX patterns available from the Wave Design System. This tool retrieves the names of all available Wave Design System patterns grouped by category.",exec(e,{name:t,description:n}){e.tool(t,n,async()=>{try{const o=await $(),r=M(o);return{content:[{type:"text",text:`The following UX patterns are available in the Wave Design System:
|
|
285
|
-
|
|
286
|
-
${Object.entries(r).map(([i,c])=>`## ${i}
|
|
287
|
-
${c.map(l=>`- ${l.name}`).join(`
|
|
288
|
-
`)}`).join(`
|
|
289
|
-
|
|
290
|
-
`)}
|
|
291
|
-
|
|
292
|
-
Use the \`get_pattern\` tool to access detailed guidance for a specific pattern.`}]}}catch(o){return{isError:!0,content:[{type:"text",text:`Failed to retrieve the pattern index: ${d(o)}`}]}}})}},Pe=[Ee,Me,$e,_e,Ce,ke,Le,Te,Re,Be],L=new Set;async function ze(e){await Promise.all(Pe.map(async t=>{if(L.has(t.name))return;const n=await t.ctx?.();L.add(t.name),t.exec(e,{name:t.name,description:t.description,ctx:n})}))}s(ze,"initializeTools");export{ze as i};
|
package/dist/server-DavBHU1k.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var i=Object.defineProperty;var t=(e,r)=>i(e,"name",{value:r,configurable:!0});import{realpathSync as c}from"node:fs";import{pathToFileURL as f}from"node:url";import{McpServer as p}from"@modelcontextprotocol/sdk/server/mcp.js";async function u(e,r,s){const n=await fetch(e,r);if(!n.ok){const a=s??`fetch ${e}`;throw new Error(`Failed to ${a}: ${n.status} ${n.statusText}`)}return n.text()}t(u,"fetchMarkdown");function v(e,r){return e.type===r}t(v,"isNodeType");function m(e){return Array.from(new Set(e))}t(m,"uniq");function h(e){return e instanceof Error?e.message:"Unknown error"}t(h,"getErrorMessage");function g(e){if(!process.argv[1])return!1;const r=c(process.argv[1]),s=f(r);return e===s.href}t(g,"isEntryFile");var l="0.1.14-next.4",o={version:l};const w=new p({name:"Wave Design System",version:o.version},{capabilities:{tools:{}}});export{v as a,u as f,h as g,g as i,o as p,w as s,m as u};
|