@veluai/velu 0.1.13 → 0.1.14
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 +80 -80
- package/dist/cli.js +18 -18
- package/package.json +3 -2
- package/runtime/velu-ui/components/Accordion.jsx +64 -64
- package/runtime/velu-ui/components/ApiClient.jsx +121 -121
- package/runtime/velu-ui/components/ApiField.jsx +87 -87
- package/runtime/velu-ui/components/ApiPath.jsx +63 -63
- package/runtime/velu-ui/components/ApiSidebar.jsx +122 -122
- package/runtime/velu-ui/components/AskBar.jsx +71 -71
- package/runtime/velu-ui/components/Callout.jsx +114 -114
- package/runtime/velu-ui/components/Card.jsx +131 -131
- package/runtime/velu-ui/components/Chatbot.jsx +596 -596
- package/runtime/velu-ui/components/CodeBlock.jsx +375 -375
- package/runtime/velu-ui/components/Columns.jsx +56 -56
- package/runtime/velu-ui/components/ErrorCard.jsx +138 -138
- package/runtime/velu-ui/components/Field.jsx +81 -81
- package/runtime/velu-ui/components/Image.jsx +163 -163
- package/runtime/velu-ui/components/MethodBadge.jsx +31 -31
- package/runtime/velu-ui/components/NavSelect.jsx +108 -108
- package/runtime/velu-ui/components/PageFeedback.jsx +219 -219
- package/runtime/velu-ui/components/PageFooter.jsx +213 -213
- package/runtime/velu-ui/components/PageHeader.jsx +414 -414
- package/runtime/velu-ui/components/PageNav.jsx +77 -77
- package/runtime/velu-ui/components/PoweredBy.jsx +51 -51
- package/runtime/velu-ui/components/Prompt.jsx +115 -115
- package/runtime/velu-ui/components/Search.jsx +411 -366
- package/runtime/velu-ui/components/Sidebar.jsx +191 -191
- package/runtime/velu-ui/components/Steps.jsx +65 -65
- package/runtime/velu-ui/components/ThemeToggle.jsx +48 -48
- package/runtime/velu-ui/components/Toc.jsx +537 -537
- package/runtime/velu-ui/components/TocBar.jsx +195 -195
- package/runtime/velu-ui/components/Tree.jsx +87 -87
- package/runtime/velu-ui/components/TryItBar.jsx +90 -90
- package/runtime/velu-ui/components/accordion.css +92 -92
- package/runtime/velu-ui/components/api.css +479 -479
- package/runtime/velu-ui/components/ask-bar.css +94 -94
- package/runtime/velu-ui/components/card.css +105 -105
- package/runtime/velu-ui/components/chatbot.css +617 -617
- package/runtime/velu-ui/components/code-block.css +263 -263
- package/runtime/velu-ui/components/docs-layout.css +784 -775
- package/runtime/velu-ui/components/field.css +82 -82
- package/runtime/velu-ui/components/image.css +237 -237
- package/runtime/velu-ui/components/nav-select.css +157 -157
- package/runtime/velu-ui/components/page-feedback.css +241 -241
- package/runtime/velu-ui/components/page-footer.css +130 -130
- package/runtime/velu-ui/components/page-header.css +520 -520
- package/runtime/velu-ui/components/page-nav.css +50 -50
- package/runtime/velu-ui/components/powered-by.css +66 -66
- package/runtime/velu-ui/components/prompt.css +99 -99
- package/runtime/velu-ui/components/search.css +307 -307
- package/runtime/velu-ui/components/sidebar.css +144 -144
- package/runtime/velu-ui/components/steps.css +77 -77
- package/runtime/velu-ui/components/theme-toggle.css +101 -101
- package/runtime/velu-ui/components/toc-bar.css +234 -234
- package/runtime/velu-ui/components/tree.css +49 -49
- package/runtime/velu-ui/index.js +46 -46
- package/runtime/velu-ui/lib/component-schemas.js +100 -100
- package/runtime/velu-ui/lib/copyText.js +64 -64
- package/runtime/velu-ui/lib/lang-icons.jsx +147 -147
- package/runtime/velu-ui/lib/prism-langs.js +957 -957
- package/runtime/velu-ui/lib/prism-loader.js +74 -74
- package/runtime/velu-ui/lib/resolveIcon.jsx +29 -29
- package/runtime/velu-ui/lib/scrollIntoNearestView.js +66 -66
- package/runtime/velu-ui/mdx-components.jsx +105 -105
- package/runtime/velu-ui/primitives/Cluster.jsx +49 -49
- package/runtime/velu-ui/primitives/Stack.jsx +63 -63
- package/runtime/velu-ui/primitives/Switcher.jsx +57 -57
- package/runtime/velu-ui/primitives/stack.css +3 -3
- package/runtime/velu-ui/primitives/switcher.css +25 -25
- package/runtime/velu-ui/styles.css +43 -43
- package/runtime/velu-ui/tokens.css +4 -4
- package/schema/velu.schema.json +167 -167
- package/src/lib/extract-mdx-error.js +170 -170
- package/src/lib/issues.js +159 -159
- package/src/lib/known-components.js +34 -34
- package/src/navigation.js +434 -434
- package/src/runtime/App.jsx +1490 -1476
- package/src/runtime/ErrorBoundary.jsx +54 -54
- package/src/runtime/client-entry.jsx +22 -22
- package/src/runtime/server-entry.jsx +16 -16
- package/src/template.html +48 -48
- package/templates/starter/ai-tools/claude-code.mdx +26 -26
- package/templates/starter/ai-tools/cursor.mdx +17 -17
- package/templates/starter/api-reference/endpoint/create.mdx +24 -24
- package/templates/starter/api-reference/endpoint/get.mdx +27 -27
- package/templates/starter/api-reference/introduction.mdx +28 -28
- package/templates/starter/development.mdx +19 -19
- package/templates/starter/essentials/code.mdx +29 -29
- package/templates/starter/essentials/images.mdx +29 -29
- package/templates/starter/essentials/markdown.mdx +25 -25
- package/templates/starter/essentials/navigation.mdx +39 -39
- package/templates/starter/essentials/settings.mdx +30 -30
- package/templates/starter/favicon.svg +6 -6
- package/templates/starter/index.mdx +31 -31
- package/templates/starter/quickstart.mdx +31 -31
- package/templates/starter/velu.json +33 -33
package/README.md
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
# Velu
|
|
2
|
-
|
|
3
|
-
A documentation-site generator with live preview. Scaffold a docs project
|
|
4
|
-
and run it locally with two commands — author your pages in Markdown +
|
|
5
|
-
components, configure the site with a single `velu.json`.
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install -g @veluai/velu
|
|
9
|
-
velu init my-docs
|
|
10
|
-
velu dev my-docs
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Then open <http://localhost:8358>. Editing any `.mdx` page or `velu.json`
|
|
14
|
-
reloads the browser automatically.
|
|
15
|
-
|
|
16
|
-
> Requires **Node.js 18+**. Prefer not to install globally? Use
|
|
17
|
-
> `npx @veluai/velu init my-docs` and `npx @veluai/velu dev my-docs`.
|
|
18
|
-
|
|
19
|
-
## Commands
|
|
20
|
-
|
|
21
|
-
| Command | What it does |
|
|
22
|
-
| --- | --- |
|
|
23
|
-
| `velu init <dir>` | Scaffold a new docs project into `<dir>` (creates `velu.json`, a favicon, and a set of starter `.mdx` pages). |
|
|
24
|
-
| `velu dev [dir]` | Start the live-preview dev server for the project in `<dir>` (defaults to the current directory). |
|
|
25
|
-
|
|
26
|
-
Set a custom port with the `PORT` env var:
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
PORT=5180 velu dev my-docs
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Project layout
|
|
33
|
-
|
|
34
|
-
`velu init` produces a project shaped like this:
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
my-docs/
|
|
38
|
-
├─ velu.json # site config: name, colors, font, favicon, navigation
|
|
39
|
-
├─ favicon.svg
|
|
40
|
-
├─ index.mdx # pages, organized however your navigation references them
|
|
41
|
-
├─ quickstart.mdx
|
|
42
|
-
└─ …
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
## `velu.json`
|
|
46
|
-
|
|
47
|
-
`velu.json` drives the whole site — branding and navigation:
|
|
48
|
-
|
|
49
|
-
```json
|
|
50
|
-
{
|
|
51
|
-
"$schema": "https://veluai.com/velu.schema.json",
|
|
52
|
-
"name": "My Docs",
|
|
53
|
-
"colors": { "primary": "#dc143c" },
|
|
54
|
-
"favicon": "/favicon.svg",
|
|
55
|
-
"font": { "family": "Inter" },
|
|
56
|
-
"navigation": {
|
|
57
|
-
"tabs": [
|
|
58
|
-
{
|
|
59
|
-
"tab": "Guides",
|
|
60
|
-
"groups": [
|
|
61
|
-
{ "group": "Getting started", "pages": ["index", "quickstart"] }
|
|
62
|
-
]
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
- **`colors`** — `primary` is required; `light` and `dark` default to `primary`.
|
|
70
|
-
- **`navigation`** — Mintlify-compatible: `products → versions → languages →
|
|
71
|
-
tabs → anchors → groups → pages`. Switchable axes (products, versions,
|
|
72
|
-
languages) become URL path prefixes; the default value of each axis is
|
|
73
|
-
unprefixed. Languages are stored as ISO 639-1 codes and shown with their
|
|
74
|
-
native name.
|
|
75
|
-
|
|
76
|
-
Page labels come from each page's frontmatter `title`.
|
|
77
|
-
|
|
78
|
-
## License
|
|
79
|
-
|
|
80
|
-
Proprietary. © Velu.
|
|
1
|
+
# Velu
|
|
2
|
+
|
|
3
|
+
A documentation-site generator with live preview. Scaffold a docs project
|
|
4
|
+
and run it locally with two commands — author your pages in Markdown +
|
|
5
|
+
components, configure the site with a single `velu.json`.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @veluai/velu
|
|
9
|
+
velu init my-docs
|
|
10
|
+
velu dev my-docs
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Then open <http://localhost:8358>. Editing any `.mdx` page or `velu.json`
|
|
14
|
+
reloads the browser automatically.
|
|
15
|
+
|
|
16
|
+
> Requires **Node.js 18+**. Prefer not to install globally? Use
|
|
17
|
+
> `npx @veluai/velu init my-docs` and `npx @veluai/velu dev my-docs`.
|
|
18
|
+
|
|
19
|
+
## Commands
|
|
20
|
+
|
|
21
|
+
| Command | What it does |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| `velu init <dir>` | Scaffold a new docs project into `<dir>` (creates `velu.json`, a favicon, and a set of starter `.mdx` pages). |
|
|
24
|
+
| `velu dev [dir]` | Start the live-preview dev server for the project in `<dir>` (defaults to the current directory). |
|
|
25
|
+
|
|
26
|
+
Set a custom port with the `PORT` env var:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
PORT=5180 velu dev my-docs
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Project layout
|
|
33
|
+
|
|
34
|
+
`velu init` produces a project shaped like this:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
my-docs/
|
|
38
|
+
├─ velu.json # site config: name, colors, font, favicon, navigation
|
|
39
|
+
├─ favicon.svg
|
|
40
|
+
├─ index.mdx # pages, organized however your navigation references them
|
|
41
|
+
├─ quickstart.mdx
|
|
42
|
+
└─ …
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## `velu.json`
|
|
46
|
+
|
|
47
|
+
`velu.json` drives the whole site — branding and navigation:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"$schema": "https://veluai.com/velu.schema.json",
|
|
52
|
+
"name": "My Docs",
|
|
53
|
+
"colors": { "primary": "#dc143c" },
|
|
54
|
+
"favicon": "/favicon.svg",
|
|
55
|
+
"font": { "family": "Inter" },
|
|
56
|
+
"navigation": {
|
|
57
|
+
"tabs": [
|
|
58
|
+
{
|
|
59
|
+
"tab": "Guides",
|
|
60
|
+
"groups": [
|
|
61
|
+
{ "group": "Getting started", "pages": ["index", "quickstart"] }
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- **`colors`** — `primary` is required; `light` and `dark` default to `primary`.
|
|
70
|
+
- **`navigation`** — Mintlify-compatible: `products → versions → languages →
|
|
71
|
+
tabs → anchors → groups → pages`. Switchable axes (products, versions,
|
|
72
|
+
languages) become URL path prefixes; the default value of each axis is
|
|
73
|
+
unprefixed. Languages are stored as ISO 639-1 codes and shown with their
|
|
74
|
+
native name.
|
|
75
|
+
|
|
76
|
+
Page labels come from each page's frontmatter `title`.
|
|
77
|
+
|
|
78
|
+
## License
|
|
79
|
+
|
|
80
|
+
Proprietary. © Velu.
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var
|
|
3
|
-
`,"utf-8");let r=await
|
|
4
|
-
`)}var bt,
|
|
2
|
+
var ut=Object.defineProperty;var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var ce=(e,t)=>{for(var o in t)ut(e,o,{get:t[o],enumerable:!0})};var je={};ce(je,{initProject:()=>dt});import z from"node:fs/promises";import V from"node:path";import{fileURLToPath as ft}from"node:url";async function dt(e,t){try{if((await z.readdir(e)).length>0)throw new Error(`Directory "${t}" already exists and is not empty. Choose a different name or remove the folder first.`)}catch(s){if(s.code!=="ENOENT")throw s}await z.mkdir(e,{recursive:!0}),await z.cp(mt,e,{recursive:!0});let o=V.join(e,"velu.json"),n=JSON.parse(await z.readFile(o,"utf-8"));n.name=t,await z.writeFile(o,JSON.stringify(n,null,2)+`
|
|
3
|
+
`,"utf-8");let r=await $e(e);console.log(`[velu] created ${t}/`);for(let s of r)console.log(` ${s}`);console.log(""),console.log("Next steps:"),console.log(` cd ${t}`),console.log(" velu dev")}async function $e(e,t=e,o=[]){let n=await z.readdir(e,{withFileTypes:!0});for(let r of n){let s=V.join(e,r.name);r.isDirectory()?await $e(s,t,o):o.push(V.relative(t,s).split(V.sep).join("/"))}return o.sort()}var pt,mt,Ae=k(()=>{pt=V.dirname(ft(import.meta.url)),mt=V.resolve(pt,"..","templates","starter")});import{visit as gt}from"unist-util-visit";import{toString as ht}from"mdast-util-to-string";import vt from"github-slugger";import{valueToEstree as yt}from"estree-util-value-to-estree";function Y(){return e=>{let t=new vt,o=[];gt(e,"heading",i=>{let a=ht(i);o.push({depth:i.depth,id:t.slug(a),label:a})});let n={children:[]},r=[{node:n,depth:0}];for(let i of o){for(;r.length>1&&r[r.length-1].depth>=i.depth;)r.pop();let a={id:i.id,label:i.label},l=r[r.length-1].node;l.children||(l.children=[]),l.children.push(a),r.push({node:a,depth:i.depth})}let s=n.children;e.children.unshift({type:"mdxjsEsm",value:"",data:{estree:{type:"Program",sourceType:"module",body:[{type:"ExportNamedDeclaration",specifiers:[],declaration:{type:"VariableDeclaration",kind:"const",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"toc"},init:yt(s)}]}}]}}})}}var ue=k(()=>{});import xt from"node:fs/promises";import Pe from"node:path";function fe(e={},t){let o=e.colors?.primary??wt;return{name:e.name??t??"docs",colors:{primary:o,light:e.colors?.light??o,dark:e.colors?.dark??o},favicon:e.favicon??null,font:{family:e.font?.family??bt},navigation:e.navigation??null}}async function Ce(e){let t=Pe.join(e,"velu.json"),o;try{o=await xt.readFile(t,"utf-8")}catch(r){throw r.code==="ENOENT"?new Error(`No velu.json found in ${e}. Run \`velu init <name>\` to scaffold one.`):r}let n;try{n=JSON.parse(o)}catch(r){throw new Error(`velu.json is not valid JSON: ${r.message}`)}return fe(n,Pe.basename(e))}function Ee(e){let{colors:t,font:o}=e;return[":root:root {",` --accent-color: ${t.light};`,` --font-sans: "${o.family}", sans-serif;`,"}",':root:root[data-theme="dark"] {',` --accent-color: ${t.dark};`,"}"].join(`
|
|
4
|
+
`)}var wt,bt,Te=k(()=>{wt="#dc143c",bt="Google Sans Flex"});import kt from"github-slugger";import St from"iso-639-1";function jt(e){let t=String(e).toLowerCase();return St.getNativeName(t)||e}function Q(e){return new kt().slug(String(e??""))}function At(e){let t=String(e).replace(/^\/+|\/+$/g,"").split("/").filter(Boolean);return t[t.length-1]==="index"&&t.pop(),"/"+t.join("/")}function B(e){let t={kind:"root",children:H(e??{})};return Ne(t.children),t}function H(e){let t=Array.isArray(e.anchors)?e.anchors.map(_t):[];if(Array.isArray(e.products))return[...t,...e.products.map(Pt)];if(Array.isArray(e.versions))return[...t,...e.versions.map(Ct)];if(Array.isArray(e.languages))return[...t,...e.languages.map(Et)];if(Array.isArray(e.tabs))return[...t,...e.tabs.map(Tt)];let o=[...t];return Array.isArray(e.groups)&&o.push(...e.groups.map(_e)),Array.isArray(e.pages)&&o.push(...e.pages.map(Oe)),o}function Pt(e){return{kind:"product",label:e.name??e.product,slug:Q(e.product),icon:e.icon,color:e.color,default:!!e.default,children:H(e)}}function Ct(e){return{kind:"version",label:e.version,slug:Q(e.version),default:!!e.default,children:H(e)}}function Et(e){let t=String(e.language);return{kind:"language",code:t,label:jt(t),slug:Q(t),default:!!e.default,children:H(e)}}function Tt(e){return{kind:"tab",label:e.tab,slug:Q(e.tab),icon:e.icon,href:e.href,children:H(e)}}function _t(e){return{kind:"anchor",label:e.anchor,icon:e.icon,href:e.href,color:e.color}}function _e(e){let t=(e.pages??[]).map(Oe);return e.root&&t.unshift({kind:"page",pagePath:e.root}),{kind:"group",label:e.group,icon:e.icon,expanded:!!e.expanded,root:e.root,children:t}}function Oe(e){return typeof e=="string"?{kind:"page",pagePath:e}:_e(e)}function Ne(e){for(let t of $t){let o=e.filter(n=>n.kind===t);o.length&&!o.some(n=>n.default)&&(o[0].default=!0)}for(let t of e)t.children&&Ne(t.children)}function Le(e){let t=[],o=(n,r,s)=>{if(n.kind==="page"){t.push({pagePath:n.pagePath,url:Ot(n.pagePath,r),ctx:{...r},ancestors:s,node:n});return}let i=r;n.kind==="product"?i={...r,product:n.default?null:n.slug}:n.kind==="version"?i={...r,version:n.default?null:n.slug}:n.kind==="language"&&(i={...r,language:n.default?null:n.slug});let a=n.kind==="root"?s:[...s,n];for(let l of n.children??[])o(l,i,a)};return o(e,{product:null,version:null,language:null},[]),t}function Ot(e,t){let o=[t.product,t.version,t.language].filter(Boolean),n=At(e).split("/").filter(Boolean);return"/"+[...o,...n].join("/")}var $t,W=k(()=>{$t=["product","version","language"]});import Nt from"node:fs";import Fe from"node:path";function G(e,t){let o=[],n=[],r=new Set;for(let s of Le(e)){if(r.has(s.url)){o.push(`duplicate URL "${s.url}" (page "${s.pagePath}") \u2014 keeping the first occurrence`);continue}r.add(s.url);let i=s.pagePath.replace(/^\/+|\/+$/g,""),a=Fe.join(t,...i.split("/"))+".mdx",l=Nt.existsSync(a);l||o.push(`page "${s.pagePath}" \u2192 ${Fe.relative(t,a)} not found`),n.push({pagePath:s.pagePath,url:s.url,fileAbsPath:a,exists:l})}return{pageEntries:n,warnings:o}}var ee=k(()=>{W()});import Lt from"node:fs";import te from"node:path";function Me(e){return{name:"velu-site",resolveId(t){return t===Re?Ie:null},load(t){return t!==Ie?null:Ft(e)}}}function Ft(e){let t={};try{t=JSON.parse(Lt.readFileSync(te.join(e,"velu.json"),"utf-8"))}catch{}let o=B(t.navigation??{}),{pageEntries:n,warnings:r}=G(o,e);for(let l of r)console.warn(`[velu] nav: ${l}`);let s=[],i=[],a=0;for(let l of n)if(l.exists){let u=JSON.stringify(l.fileAbsPath.split(te.sep).join("/")),c=JSON.stringify(te.relative(e,l.fileAbsPath).split(te.sep).join("/")),f=`__p${a++}`;s.push(`import * as ${f} from ${u};`),i.push(` ${JSON.stringify(l.url)}: { Component: ${f}.default, frontmatter: ${f}.frontmatter, toc: ${f}.toc, relPath: ${c} },`)}else i.push(` ${JSON.stringify(l.url)}: { missing: true },`);return["// AUTO-GENERATED by vite-plugin-velu-site. Do not edit.",s.join(`
|
|
5
5
|
`),"","export const pages = {",i.join(`
|
|
6
6
|
`),"};",`export const navigation = ${JSON.stringify(o)};`,""].join(`
|
|
7
|
-
`)}var
|
|
8
|
-
`))s.push(` ${i}`);return e.suggestion&&s.push(` ${
|
|
9
|
-
`)}function
|
|
10
|
-
`)}var
|
|
7
|
+
`)}var Re,Ie,Ue=k(()=>{W();ee();Re="virtual:velu-site",Ie="\0"+Re});function h(e){return{category:"render-crash",severity:"error",file:null,line:null,column:null,frame:null,title:"Something went wrong",detail:"",hint:"",suggestion:null,...e}}function It(e,t){if(e=String(e),t=String(t),e===t)return 0;if(!e.length)return t.length;if(!t.length)return e.length;let o=Array.from({length:t.length+1},(r,s)=>s),n=new Array(t.length+1);for(let r=1;r<=e.length;r++){n[0]=r;for(let s=1;s<=t.length;s++){let i=e[r-1]===t[s-1]?0:1;n[s]=Math.min(n[s-1]+1,o[s]+1,o[s-1]+i)}[o,n]=[n,o]}return o[t.length]}function ne(e,t=[]){if(!e)return null;let o=String(e).toLowerCase(),n=null,r=1/0;for(let i of t){let a=It(o,String(i).toLowerCase());a<r&&(r=a,n=i)}let s=Math.min(3,Math.max(2,Math.floor(o.length/4)));return r<=s?n:null}function Rt(e,t){return e==="warning"?C(t,$.yellow,"\u26A0"):e==="info"?C(t,$.cyan,"\u2139"):C(t,$.red,"\u2716")}function me(e,{color:t=!1}={}){let o=pe[e.category]||e.category,n=e.line?`${e.line}${e.column?`:${e.column}`:""}`:"",r=e.file?`${e.file}${n?`:${n}`:""}`:n,s=[];if(s.push(`${Rt(e.severity,t)} ${C(t,$.bold,o)}`+(r?` ${C(t,$.dim,r)}`:"")),e.title&&s.push(` ${e.title}`),e.detail&&e.detail!==e.title&&s.push(` ${C(t,$.dim,e.detail)}`),e.frame)for(let i of String(e.frame).split(`
|
|
8
|
+
`))s.push(` ${i}`);return e.suggestion&&s.push(` ${C(t,$.cyan,`Did you mean <${e.suggestion}>?`)}`),e.hint&&s.push(` ${C(t,$.dim,`\u2192 ${e.hint}`)}`),s.join(`
|
|
9
|
+
`)}function oe(e,{color:t=!1}={}){if(!e.length)return C(t,$.cyan,"\u2713 No issues found.");let o=new Map;for(let a of e){let l=a.file||"velu.json";o.has(l)||o.set(l,[]),o.get(l).push(a)}let n=[];for(let[a,l]of o){n.push(C(t,$.bold,a));for(let u of l)n.push(me({...u,file:null},{color:t}).replace(/^/gm," "));n.push("")}let r=e.filter(a=>a.severity!=="warning"&&a.severity!=="info").length,s=e.length-r,i=`${r} error${r===1?"":"s"}`+(s?`, ${s} warning${s===1?"":"s"}`:"");return n.push(C(t,r?$.red:$.yellow,i)),n.join(`
|
|
10
|
+
`)}var pe,$,C,F=k(()=>{pe={"mdx-syntax":"MDX syntax",frontmatter:"Frontmatter","unknown-component":"Unknown component","invalid-props":"Invalid options","render-crash":"Render error","config-json":"velu.json","config-schema":"velu.json","config-nav":"Navigation","config-asset":"Asset"};$={reset:"\x1B[0m",red:"\x1B[31m",yellow:"\x1B[33m",cyan:"\x1B[36m",dim:"\x1B[2m",bold:"\x1B[1m"},C=(e,t,o)=>e?`${t}${o}${$.reset}`:o});function Mt(e){let t=e,o=0;for(;t&&t.cause&&o<3&&!(t.loc||t.line||/`[^`]+` to be defined/.test(t.message||""));)t=t.cause,o+=1;return t||e}function de(e,t){if(!e)return null;let o=ze(e).replace(/[?#].*$/,""),n=t?ze(t).replace(/\/+$/,""):"";return n&&o.toLowerCase().startsWith(n.toLowerCase())?o.slice(n.length).replace(/^\/+/,""):!/^([a-zA-Z]:\/|\/)/.test(o)&&!/node_modules/.test(o)?o:null}function Ut(e){return e?String(e).replace(/([a-zA-Z]:\\|\/)[^\s'"()]+/g,t=>/node_modules|[\\/]vite[\\/]|@veluai|velu-cli|velu-ui/.test(t)?"\u2026":t).trim():""}function zt(e){let t=/\((\d+):(\d+)(?:-\d+:\d+)?\)\s*$/.exec(String(e||""));return t?{line:Number(t[1]),column:Number(t[2])}:null}function Vt(e){return String(e||"").replace(/\s*\(\d+:\d+(?:-\d+:\d+)?\)\s*$/,"").trim()}function Gt(e,t){if(!e||!t)return null;let o=String(e);return/node_modules|[\\/]vite[\\/]|@veluai[\\/]/.test(o)?null:o}function K(e,t={}){let{projectDir:o="",knownComponents:n=[],file:r=null}=t,s=null;for(let E=e,A=0;E&&A<6;E=E.cause,A+=1)if(E.veluIssue){s=E.veluIssue;break}if(s)return h({...s,file:s.file||r});let i=Mt(e)||{},a=i.message||String(e||""),l=/Expected component `([^`]+)` to be defined/.exec(a);if(l){let E=l[1],A=/referenced in your code at `(\d+):(\d+)/.exec(a),q=/\bin `([^`]+)`/.exec(a),v=q?de(q[1],o):null;return h({category:"unknown-component",file:v||r,line:A?Number(A[1]):null,column:A?Number(A[2]):null,title:`<${E}> is not a built-in component`,detail:"",hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:ne(E,n)})}let u=i.loc||(i.line!=null?{line:i.line,column:i.column,file:i.file}:null)||zt(i.reason||a),c=i.id||u&&u.file||i.file||null,f=de(c,o)||r,_=!!f&&de(c,o)!=null,d=Gt(i.frame,_||!!r),j=Ut(Vt(i.reason||a)),m=Bt.test(a),L=i.source==="remark-frontmatter"||/\byaml\b|frontmatter/i.test(a)||u&&u.line===1&&/unexpected|expected/i.test(a)&&/---/.test(a);return u||m||d&&_?h({category:L?"frontmatter":"mdx-syntax",file:f,line:u?u.line:null,column:u?u.column:null,frame:d,title:j||(L?"Invalid frontmatter":"MDX syntax error"),detail:"",hint:L?"Check the YAML between the --- markers \u2014 indentation, quotes, and colons.":"Make sure every <Component> has a matching closing tag and that { } braces are balanced."}):/\.map is not a function|is not iterable|reading '|undefined \(reading/i.test(a)?h({category:"invalid-props",file:f,title:"A component received an invalid value",detail:j,hint:"Check the props/options you passed to a component on this page."}):h({category:"render-crash",file:f,title:"This page failed to render",detail:j,hint:"Set VELU_DEBUG=1 for the full stack trace."})}var ze,Bt,ge=k(()=>{F();ze=e=>String(e).replace(/\\/g,"/");Bt=/closing tag|unexpected closing|could not parse (?:expression|import|export)|unexpected character|unexpected end of|expected a closing|expected the closing|unexpected `|in expression|misnested|before name/i});function Jt(e){let t=pe[e.category]||e.category,o=e.file?`${e.file}${e.line?`:${e.line}${e.column?`:${e.column}`:""}`:""}`:"",n=[];return n.push('<div class="velu-err-card">'),n.push('<div class="velu-err-head">'),n.push(`<span class="velu-err-pill">${O(t)}</span>`),n.push("</div>"),e.title&&n.push(`<div class="velu-err-title">${O(e.title)}</div>`),o&&n.push(`<a class="velu-err-loc" title="${O(o)}">${O(o)}</a>`),e.detail&&n.push(`<div class="velu-err-detail">${O(e.detail)}</div>`),e.frame&&n.push(`<pre class="velu-err-frame">${O(e.frame)}</pre>`),e.suggestion&&n.push(`<div class="velu-err-suggest">Did you mean <code><${O(e.suggestion)}></code>?</div>`),e.hint&&n.push(`<div class="velu-err-hint">${O(e.hint)}</div>`),n.push("</div>"),n.join("")}function he(e,t={}){let o=Array.isArray(e)?e:[e],n=t.title||(o.length>1?`${o.length} problems to fix`:"There\u2019s a problem to fix"),r=o.map(Jt).join(`
|
|
11
11
|
`);return`<!doctype html>
|
|
12
12
|
<html lang="en">
|
|
13
13
|
<head>
|
|
@@ -79,15 +79,15 @@ var ft=Object.defineProperty;var k=(e,t)=>()=>(e&&(t=e(e=0)),t);var ue=(e,t)=>{f
|
|
|
79
79
|
<div class="velu-err-foot">Fix the file and save \u2014 this page reloads automatically.</div>
|
|
80
80
|
</div>
|
|
81
81
|
</body>
|
|
82
|
-
</html>`}var O,
|
|
83
|
-
`).length}function
|
|
84
|
-
`).length}function
|
|
85
|
-
`).length}function
|
|
82
|
+
</html>`}var O,Ve=k(()=>{F();O=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")});var I,ve=k(()=>{I=["Callout","Card","CardGroup","Accordion","AccordionGroup","Columns","Field","Prompt","Steps","Step","Tree","Folder","File","Image","CodeBlock","CodeGroup","MethodBadge","ApiPath","TryItBar","ApiField","ApiClient","ApiSidebar"]});import ye from"node:fs";import re from"node:path";import{fileURLToPath as qt}from"node:url";import Dt from"iso-639-1";function Z(e,t){if(!t)return null;let o=e.indexOf(`"${t}"`);return o===-1?null:e.slice(0,o).split(`
|
|
83
|
+
`).length}function Wt(e,t){return t==null||t<0?null:e.slice(0,t).split(`
|
|
84
|
+
`).length}function Be(e,t){if(!t)return null;let o=e.indexOf(`"${t}"`);return o===-1?null:e.slice(0,o).split(`
|
|
85
|
+
`).length}function Kt(e,t,o){let n=[];return a(e,t,"",null),n;function r(l){if(l&&l.$ref){let u=l.$ref.replace(/^#\//,"").split("/"),c=o;for(let f of u)c=c?.[f];return c||{}}return l}function s(l){return Array.isArray(l)?"array":l===null?"null":typeof l}function i(l,u){let c=n.length;a(l,u,"",null,!0);let f=n.length===c;return f||(n.length=c),f}function a(l,u,c,f,_){let d=r(u);if(d){if(d.oneOf){d.oneOf.some(m=>i(l,m))||n.push({path:c,key:f,message:"value does not match any allowed shape"});return}if(d.type&&s(l)!==d.type){n.push({path:c,key:f,message:`expected ${d.type}, got ${s(l)}`});return}if(d.type==="string"&&d.minLength!=null&&l.length<d.minLength&&n.push({path:c,key:f,message:"must not be empty"}),d.type==="object"&&s(l)==="object"){for(let m of d.required||[])m in l||n.push({path:c?`${c}.${m}`:m,key:m,message:`missing required "${m}"`});let j=d.properties||{};if(d.additionalProperties===!1)for(let m of Object.keys(l))m in j||n.push({path:c?`${c}.${m}`:m,key:m,message:`unknown field "${m}"`});for(let[m,L]of Object.entries(j))m in l&&a(l[m],L,c?`${c}.${m}`:m,m,_)}d.type==="array"&&Array.isArray(l)&&d.items&&l.forEach((j,m)=>a(j,d.items,`${c}[${m}]`,f,_))}}}function Zt(e){if(typeof e!="string")return!1;let t=e.trim();return/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(t)||/^(rgb|rgba|hsl|hsla|color|oklch|lab|lch)\(/i.test(t)||/^[a-z][a-z0-9-]*$/i.test(t)}function ie(e){let t=[],o=re.join(e,"velu.json"),n;try{n=ye.readFileSync(o,"utf-8")}catch(i){return i.code==="ENOENT"?t.push(h({category:"config-json",file:"velu.json",title:"No velu.json found",hint:"Run `velu init <name>` to scaffold a project."})):t.push(h({category:"config-json",file:"velu.json",title:"Could not read velu.json"})),t}let r;try{r=JSON.parse(n)}catch(i){let a=/position (\d+)/.exec(i.message||""),l=a?Wt(n,Number(a[1])):null;return t.push(h({category:"config-json",file:"velu.json",line:l,title:"velu.json is not valid JSON",detail:String(i.message||"").replace(/\s+in JSON.*$/,""),hint:"Check for a trailing comma, a missing quote, or an unclosed brace."})),t}let s=null;try{s=JSON.parse(ye.readFileSync(Ht,"utf-8"))}catch{}if(s)for(let i of Kt(r,s,s)){let a=/^unknown field/.test(i.message);t.push(h({category:"config-schema",severity:a?"warning":"error",file:"velu.json",line:Z(n,i.key),title:i.path?`${i.path}: ${i.message}`:i.message,hint:a?"Remove it, or check the spelling against the velu.json schema.":""}))}for(let i of["primary","light","dark"]){let a=r.colors?.[i];a!=null&&!Zt(a)&&t.push(h({category:"config-schema",severity:"warning",file:"velu.json",line:Z(n,i),title:`colors.${i}: "${a}" doesn\u2019t look like a CSS color`,hint:"Use a hex value like #dc143c, an rgb()/hsl() function, or a CSS color name."}))}if(typeof r.favicon=="string"&&r.favicon.trim()){let i=re.resolve(e,r.favicon.replace(/^\/+/,""));ye.existsSync(i)||t.push(h({category:"config-asset",file:"velu.json",line:Z(n,"favicon"),title:`favicon not found: ${r.favicon}`,hint:"The path is relative to the project root."}))}if(r.navigation&&typeof r.navigation=="object"){let i;try{i=B(r.navigation)}catch(a){t.push(h({category:"config-nav",file:"velu.json",line:Z(n,"navigation"),title:"navigation could not be processed",detail:String(a.message||"")})),i=null}if(i){let{pageEntries:a,warnings:l}=G(i,e);for(let u of l){let c=/not found$/.test(u),f=/page "([^"]+)"/.exec(u),_=f?Be(n,f[1]):null;t.push(h({category:"config-nav",severity:c?"error":"warning",file:"velu.json",line:_,title:u,hint:c?"Create the .mdx file, or remove the page from navigation.":""}))}Xt(i,n,t)}}return t}function Xt(e,t,o){let n=new Set,r=s=>{if(!(!s||typeof s!="object")){if(s.language&&!n.has(s.language)){n.add(s.language);let i=String(s.language).toLowerCase();Dt.validate(i)||o.push(h({category:"config-nav",severity:"warning",file:"velu.json",line:Be(t,s.language)||Z(t,"language"),title:`"${s.language}" is not a valid ISO 639-1 language code`,hint:'Use a two-letter code like "en", "fr", or "ja".'}))}for(let i of Object.values(s))Array.isArray(i)?i.forEach(r):i&&typeof i=="object"&&r(i)}};r(e)}var Yt,Ht,xe=k(()=>{F();W();ee();Yt=re.dirname(qt(import.meta.url)),Ht=re.resolve(Yt,"..","..","schema","velu.schema.json")});import Qt from"node:fs/promises";import en from"node:fs";import R from"node:path";import{fileURLToPath as tn,pathToFileURL as nn}from"node:url";import{compile as on}from"@mdx-js/mdx";import rn from"remark-frontmatter";import sn from"remark-mdx-frontmatter";import an from"remark-gfm";import ln from"rehype-slug";import{visit as cn}from"unist-util-visit";function we(){if(se)return se;let e=R.dirname(tn(import.meta.url)),t=[R.resolve(e,"..","runtime","velu-ui"),R.resolve(e,"..","..","runtime","velu-ui"),R.resolve(e,"..","..","..","velu-ui","src")],o=null;for(let n of t){let r=R.join(n,"lib","component-schemas.js");if(en.existsSync(r)){o=r;break}}return se=o?import(nn(o).href).then(n=>n.validateProps).catch(()=>null):Promise.resolve(null),se}function un(e){let t={};for(let o of e.attributes||[])o.type==="mdxJsxAttribute"&&(o.value==null?t[o.name]=!0:typeof o.value=="string"&&(t[o.name]=o.value));return t}function fn(e,t){return()=>o=>{cn(o,n=>{if((n.type==="mdxJsxFlowElement"||n.type==="mdxJsxTextElement")&&typeof n.name=="string"&&/^[A-Z]/.test(n.name)&&!n.name.includes(".")&&e.push({name:n.name,props:un(n),line:n.position?.start?.line??null,column:n.position?.start?.column??null}),n.type==="mdxjsEsm"&&typeof n.value=="string")for(let r of n.value.matchAll(/\b([A-Z][A-Za-z0-9_]*)\b/g))t.add(r[1])})}}async function pn(e,t){let o=[],n;try{n=await Qt.readFile(t.fileAbsPath,"utf-8")}catch{return o}let r=R.relative(e,t.fileAbsPath).split(R.sep).join("/"),s=[],i=new Set;try{await on({value:n,path:t.fileAbsPath},{remarkPlugins:[rn,sn,an,Y,fn(s,i)],rehypePlugins:[ln],providerImportSource:"@mdx-js/react"})}catch(c){return o.push(K(c,{projectDir:e,knownComponents:I,file:r})),o}let a=new Set(I),l=await we(),u=new Set;for(let c of s)if(!i.has(c.name)){if(!a.has(c.name)){if(u.has(c.name))continue;u.add(c.name),o.push(h({category:"unknown-component",file:r,line:c.line,column:c.column,title:`<${c.name}> is not a built-in component`,hint:"Components are built in \u2014 check the spelling and capitalization (you don\u2019t import them).",suggestion:ne(c.name,I)}));continue}if(l){let f=l(c.name,c.props,{checkRequired:!1});f&&o.push(h({...f,file:r,line:c.line,column:c.column}))}}return o}async function Ge(e,t){let o=t.filter(a=>a.exists),n=[],r=8,s=0;async function i(){for(;s<o.length;){let a=o[s++],l=await pn(e,a);for(let u of l)n.push(u)}}return await Promise.all(Array.from({length:Math.min(r,o.length)},i)),n}var se,be=k(()=>{ue();F();ge();ve()});import{visit as mn}from"unist-util-visit";function dn(e,t){let o=Je(e).replace(/[?#].*$/,""),n=Je(t).replace(/\/+$/,"");return n&&o.toLowerCase().startsWith(n.toLowerCase())?o.slice(n.length).replace(/^\/+/,""):null}function qe(e,t){return()=>(o,n)=>{typeof e=="function"&&mn(o,r=>{if(r.type!=="mdxJsxFlowElement"&&r.type!=="mdxJsxTextElement"||typeof r.name!="string"||!/^[A-Z]/.test(r.name)||r.name.includes("."))return;let s={};for(let a of r.attributes||[])a.type==="mdxJsxAttribute"&&(a.value==null?s[a.name]=!0:typeof a.value=="string"&&(s[a.name]=a.value));let i=e(r.name,s,{checkRequired:!1});if(i){let a=new Error(i.title);throw a.veluIssue={...i,file:dn(n?.path,t),line:r.position?.start?.line??null,column:r.position?.start?.column??null},a.loc={line:a.veluIssue.line,column:a.veluIssue.column},a}})}}var Je,De=k(()=>{Je=e=>String(e||"").replace(/\\/g,"/")});var Qe={};ce(Qe,{startDevServer:()=>zn});import Ye from"node:fs/promises";import M from"node:fs";import gn from"node:http";import{spawn as hn}from"node:child_process";import x from"node:path";import{fileURLToPath as vn}from"node:url";import{createRequire as yn}from"node:module";import xn from"chokidar";import wn from"express";import bn from"@tailwindcss/vite";import kn from"@vitejs/plugin-react";import Sn from"@mdx-js/rollup";import $n from"remark-frontmatter";import jn from"remark-mdx-frontmatter";import An from"remark-gfm";import Pn from"rehype-slug";import{createServer as Cn,searchForWorkspaceRoot as En}from"vite";function Ln(e){return`<link rel="stylesheet" href="${`https://fonts.googleapis.com/css2?family=${encodeURIComponent(e).replace(/%20/g,"+")}:wght@300;400;500;600;700&display=swap`}" />`}function We(e,t){let o=me(e,{color:!!process.stderr.isTTY});console.error(`
|
|
86
86
|
`+o+`
|
|
87
|
-
`),process.env.VELU_DEBUG&&t&&console.error(t)}function
|
|
88
|
-
`)}function
|
|
89
|
-
`+
|
|
90
|
-
`),p}let l=e;try{l=
|
|
91
|
-
${
|
|
92
|
-
</style>`,
|
|
93
|
-
`),
|
|
87
|
+
`),process.env.VELU_DEBUG&&t&&console.error(t)}function Fn(){try{return JSON.parse(M.readFileSync(x.join(J,"package.json"),"utf8")).version||"unknown"}catch{return"unknown"}}function In(e,t){let o=x.resolve(e,".velu"),n=x.resolve(o,".velu-version"),r=null;try{r=M.readFileSync(n,"utf8").trim()}catch{}if(r!==t){if(r!==null)try{M.rmSync(x.join(o,"vite-cache"),{recursive:!0,force:!0}),console.log("[velu] new version detected \u2014 refreshing the preview cache\u2026")}catch{}try{M.mkdirSync(o,{recursive:!0}),M.writeFileSync(n,t)}catch{}}}async function Ke(e){try{return await Ce(e)}catch{return fe({},x.basename(e))}}async function Ze(e,t){let o=await e.moduleGraph.getModuleByUrl(t,!0),n=new Map,r=new Set;async function s(i){if(!(!i||r.has(i.url))){if(r.add(i.url),i.id&&_n.test(i.id)){let a=i.url.includes("?")?"&":"?",l=await e.transformRequest(`${i.url}${a}direct`);l?.code&&n.set(i.url,l.code)}for(let a of i.importedModules)await s(a)}}return await s(o),[...n.values()].join(`
|
|
88
|
+
`)}function Un(e,t){let o=()=>{process.stdout.isTTY&&!process.env.VELU_NO_BELL&&process.stdout.write("\x07")},n=process.stdout.isTTY,r=f=>n&&process.stdout.write(`\x1B]${f}\x1B\\`),s=()=>{r(`0;\u23F3 ${t}`),r("9;4;3;0")},i=()=>{r(`0;${t}`),r("9;4;0;0")};if(n&&process.once("exit",()=>r("9;4;0;0")),s(),!e)return console.log("Starting Velu\u2026"),{ready:f=>{console.log(`Velu ready \u2192 ${f}`),i(),o()}};let a="\x1B[38;2;220;20;60m",l="\x1B[0m";console.log("");for(let f of Rn)console.log(`${a}${f}${l}`);console.log("");let u=null;try{u=hn(process.execPath,["-e",Mn],{stdio:["ignore","inherit","ignore"]}),u.on("error",()=>{})}catch{}let c=()=>{if(u){try{u.kill()}catch{}u=null}};return process.once("exit",c),{ready:f=>{c(),process.stdout.write("\x1B[2K\r"),console.log(` \x1B[32m\u2713${l} Velu ready \u2192 \x1B[36m${f}${l}`),i(),o()}}}async function zn(e){let t=!!process.env.VELU_PROFILE,o=performance.now(),n=(w,p)=>t&&console.log(`[velu-profile] ${w}: ${(performance.now()-p).toFixed(0)}ms`),r=Un(!!process.stdout.isTTY&&!t,x.basename(e)),s=await Ke(e),i=a();function a(){let p=ie(e).filter(b=>b.severity==="error"&&(b.category==="config-json"||b.category==="config-schema"));return p.length&&console.error(`
|
|
89
|
+
`+oe(p,{color:!!process.stderr.isTTY})+`
|
|
90
|
+
`),p}let l=e;try{l=M.realpathSync(e)}catch{}let u=0,c=w=>{let p=performance.now();if(p-u<500)return;u=p;let b=K(w,{projectDir:l,knownComponents:I});We(b,w)};process.on("unhandledRejection",c),process.on("uncaughtException",c);let _=yn(import.meta.url).resolve("@mdx-js/react"),d=x.resolve(J,"runtime","velu-ui"),j=M.existsSync(d)?d:x.resolve(J,"..","velu-ui","src"),m=[{find:"@mdx-js/react",replacement:_},{find:/^velu-ui$/,replacement:x.join(j,"index.js")},{find:/^velu-ui\//,replacement:j+"/"}],L=Number(process.env.PORT)||8358,E=await we();In(e,Fn());let A=wn(),q=gn.createServer(A),v=await Cn({root:J,appType:"custom",logLevel:t?"info":"warn",plugins:[Me(e),Sn({remarkPlugins:[$n,jn,An,Y,qe(E,e)],rehypePlugins:[Pn],providerImportSource:"@mdx-js/react"}),kn(),bn()],cacheDir:x.resolve(e,".velu","vite-cache"),optimizeDeps:{include:["react","react-dom","react-dom/client","react-router-dom","@mdx-js/react","lucide-react","prism-react-renderer","iso-639-1","github-slugger"],exclude:["tailwindcss","@tailwindcss/oxide"],esbuildOptions:{loader:{".mdx":"jsx"}}},resolve:{alias:m,dedupe:["react","react-dom","@mdx-js/react"]},server:{middlewareMode:!0,fs:{allow:[En(J),e,l]},hmr:{server:q}}});n("vite server created",o),A.use(v.middlewares),A.get(He,async(w,p,b)=>{if(!s.favicon)return p.status(404).end();let g=x.resolve(e,s.favicon.replace(/^\//,""));p.sendFile(g,T=>{T&&p.status(404).end()})}),A.use("*",async(w,p,b)=>{let g=w.originalUrl,T=performance.now();if(i.length)return p.status(200).set({"Content-Type":"text/html"}).end(he(i,{title:"Fix velu.json to continue"}));try{let y=performance.now(),P=await Ye.readFile(Xe,"utf-8");P=await v.transformIndexHtml(g,P),n(`transformIndexHtml ${g}`,y);let U="/src/runtime/server-entry.jsx";y=performance.now();let{render:X}=await v.ssrLoadModule(U);n(`ssrLoadModule ${g} (1st req includes dep pre-bundle)`,y),y=performance.now();let S=await X(g);n(`render ${g}`,y),y=performance.now();let D=await Ze(v,U);n(`collectSsrCss ${g}`,y);let le=D?`<style data-velu-ssr>${D}</style>`:"",it=`<style data-velu-config>
|
|
91
|
+
${Ee(s)}
|
|
92
|
+
</style>`,st=On.has(s.font.family)?"":Ln(s.font.family),at=s.favicon?`<link rel="icon" href="${He}" />`:"",lt=[le,it,st,at].filter(Boolean).join(`
|
|
93
|
+
`),ct=P.replace("<!--app-title-->",Nn(s.name)).replace("<!--app-head-->",lt).replace("<!--app-html-->",S);p.status(200).set({"Content-Type":"text/html"}).end(ct),n(`TOTAL ${g}`,T)}catch(y){v.ssrFixStacktrace(y);let P=K(y,{projectDir:l,knownComponents:I});We(P,y),p.status(200).set({"Content-Type":"text/html"}).end(he([P]))}}),xn.watch(e,{ignoreInitial:!0,ignored:/(^|[\\/])(node_modules|\.git|\.velu)([\\/]|$)/,awaitWriteFinish:{stabilityThreshold:100,pollInterval:20}}).on("all",async(w,p)=>{console.log(`[velu-cli] content ${w}: ${x.relative(e,p)}`);let b=x.basename(p)==="velu.json",g=p.endsWith(".mdx"),T=b||g&&(w==="add"||w==="unlink");if(b&&(s=await Ke(e),i=a()),T)v.moduleGraph.invalidateAll();else if(g){let y=p.split(x.sep).join("/"),P=v.moduleGraph.getModulesByFile(y);if(P)for(let U of P)v.moduleGraph.invalidateModule(U)}v.ws.send({type:"full-reload"})});async function Se(w){let p=new Set,b=12,g=0,T=[],y=()=>g<b?(g+=1,Promise.resolve()):new Promise(S=>T.push(S)).then(()=>{g+=1}),P=()=>{g-=1,T.shift()?.()},U=S=>/[\\/]\.velu[\\/]vite-cache[\\/]|[\\/]deps[\\/]/.test(S)||/[\\/]node_modules[\\/]/.test(S)&&!/velu-ui/.test(S);async function X(S){if(!(!S||p.has(S)||U(S))){p.add(S);try{await y();try{await v.transformRequest(S,{ssr:!1})}finally{P()}let D=await v.moduleGraph.getModuleByUrl(S,!1);D?.importedModules?.size&&await Promise.all([...D.importedModules].map(le=>X(le.url)))}catch{}}}return await X(w),p.size}q.listen(L,async()=>{let w=performance.now(),p=0;try{let{render:b}=await v.ssrLoadModule("/src/runtime/server-entry.jsx");await Se("/src/runtime/client-entry.jsx"),typeof v.waitForRequestsIdle=="function"&&await v.waitForRequestsIdle();let[g]=await Promise.allSettled([Se("/src/runtime/client-entry.jsx"),b("/"),v.transformIndexHtml("/",await Ye.readFile(Xe,"utf-8")),Ze(v,"/src/runtime/server-entry.jsx")]).then(T=>T.map(y=>y.status==="fulfilled"?y.value:0));p=g}catch(b){t&&console.log("[velu-profile] warmup error:",b?.message)}n(`cold-start warm-up (${p} client modules)`,w),r.ready(`http://localhost:${L}`)})}var Tn,_n,On,He,Nn,J,Xe,Rn,Mn,et=k(()=>{ue();Te();Ue();ge();Ve();F();ve();xe();be();De();Tn=x.dirname(vn(import.meta.url)),_n=/\.(css|less|sass|scss|styl|stylus|pcss|postcss)(\?|$)/,On=new Set(["Google Sans Flex","Google Sans Code","Outfit"]),He="/@velu-favicon",Nn=e=>String(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""");J=x.resolve(Tn,".."),Xe=x.resolve(J,"src","template.html"),Rn=[" _ __ __","| | / /__ / /_ __","| | / / _ \\/ / / / /","| |/ / __/ / /_/ /","|___/\\___/_/\\__,_/"],Mn="const F=['\u280B','\u2819','\u2839','\u2838','\u283C','\u2834','\u2826','\u2827','\u2807','\u280F'],M=['Starting Velu','Setting up your preview','Preparing your docs','Warming things up','Almost ready'];let f=0,m=0;const t=Date.now();const C='\\x1b[38;2;220;20;60m',R='\\x1b[0m',D='\\x1b[2m';const d=()=>{const s=(Date.now()-t)/1000|0;process.stdout.write('\\x1b[2K\\r '+C+F[f]+R+' '+M[m]+'\\u2026 '+D+s+'s'+R);f=(f+1)%F.length;};d();setInterval(d,90);setInterval(()=>{if(m<M.length-1)m++;},4000);"});var nt={};ce(nt,{default:()=>Jn,runValidate:()=>tt});import Vn from"node:fs";import Bn from"node:path";function Gn(e){try{let t=JSON.parse(Vn.readFileSync(Bn.join(e,"velu.json"),"utf-8"));if(!t.navigation||typeof t.navigation!="object")return[];let o=B(t.navigation);return G(o,e).pageEntries}catch{return[]}}async function tt(e){let t=ie(e),o=Gn(e),n=await Ge(e,o),r=[...t,...n],s=!!process.stdout.isTTY;return console.log(oe(r,{color:s})),r.some(a=>a.severity!=="warning"&&a.severity!=="info")?1:0}var Jn,ot=k(()=>{W();ee();xe();be();F();Jn=tt});import ke from"node:path";import N from"node:process";import{readFileSync as qn}from"node:fs";var[,,rt,ae]=N.argv;function Dn(){try{return JSON.parse(qn(new URL("../package.json",import.meta.url),"utf8")).version}catch{return"unknown"}}async function Yn(){switch(rt){case"--version":case"-v":case"version":{console.log(Dn());break}case"init":{ae||(console.error("Usage: velu init <project-name>"),N.exit(1));let e=ae,t=ke.resolve(N.cwd(),e),{initProject:o}=await Promise.resolve().then(()=>(Ae(),je));await o(t,e);break}case"dev":{let e=ke.resolve(N.cwd(),ae??"."),{startDevServer:t}=await Promise.resolve().then(()=>(et(),Qe));await t(e);break}case"validate":{let e=ke.resolve(N.cwd(),ae??"."),{runValidate:t}=await Promise.resolve().then(()=>(ot(),nt)),o=await t(e);N.exit(o);break}default:console.log("Usage:"),console.log(" velu init <project-name> scaffold a new docs project"),console.log(" velu dev [dir] start the dev preview server"),console.log(" velu validate [dir] check velu.json + content for problems"),N.exit(rt?1:0)}}Yn().catch(e=>{console.error(N.env.VELU_DEBUG?e:`Error: ${e.message}`),N.exit(1)});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@veluai/velu",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": "./dist/cli.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"vite": "^5.4.11"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"esbuild": "^0.28.0"
|
|
53
|
+
"esbuild": "^0.28.0",
|
|
54
|
+
"playwright": "^1.48.0"
|
|
54
55
|
}
|
|
55
56
|
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import resolveIcon from '../lib/resolveIcon.jsx';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Accordion + AccordionGroup — collapsible disclosure.
|
|
6
|
-
*
|
|
7
|
-
* Native <details>/<summary>: zero JS, SSR-safe, accessible, chevron rotates
|
|
8
|
-
* via CSS on [open] (same pattern as Sidebar). Fully tokenized — border /
|
|
9
|
-
* hover / expanded surface / radius / spacing / type all from base.css
|
|
10
|
-
* tokens, so light + dark theme automatically via [data-theme].
|
|
11
|
-
*
|
|
12
|
-
* - <Accordion title=… defaultOpen?>content</Accordion> — standalone bordered
|
|
13
|
-
* rounded box.
|
|
14
|
-
* - <AccordionGroup><Accordion/>…</AccordionGroup> — items joined into ONE
|
|
15
|
-
* bordered box with dividers between them (no per-item border/radius). A
|
|
16
|
-
* context tells nested Accordions they're grouped so they drop their own
|
|
17
|
-
* chrome; the group container owns the border + radius + dividers.
|
|
18
|
-
*
|
|
19
|
-
* @param {{ title: React.ReactNode, defaultOpen?: boolean,
|
|
20
|
-
* children: React.ReactNode, className?: string }} props
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
const GroupCtx = React.createContext(false);
|
|
24
|
-
|
|
25
|
-
export function Accordion({
|
|
26
|
-
title,
|
|
27
|
-
defaultOpen = false,
|
|
28
|
-
children,
|
|
29
|
-
className = '',
|
|
30
|
-
...rest
|
|
31
|
-
}) {
|
|
32
|
-
const inGroup = React.useContext(GroupCtx);
|
|
33
|
-
const cls = [
|
|
34
|
-
'velu-accordion',
|
|
35
|
-
inGroup ? 'velu-accordion--in-group' : '',
|
|
36
|
-
className,
|
|
37
|
-
]
|
|
38
|
-
.filter(Boolean)
|
|
39
|
-
.join(' ');
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<details className={cls} open={defaultOpen || undefined} {...rest}>
|
|
43
|
-
<summary className="velu-accordion__summary">
|
|
44
|
-
<span className="velu-accordion__chevron" aria-hidden="true">
|
|
45
|
-
{resolveIcon('chevron-right', { size: '1em' })}
|
|
46
|
-
</span>
|
|
47
|
-
<span className="velu-accordion__title">{title}</span>
|
|
48
|
-
</summary>
|
|
49
|
-
<div className="velu-accordion__content">{children}</div>
|
|
50
|
-
</details>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function AccordionGroup({ children, className = '', ...rest }) {
|
|
55
|
-
return (
|
|
56
|
-
<GroupCtx.Provider value={true}>
|
|
57
|
-
<div className={`velu-accordion-group ${className}`.trim()} {...rest}>
|
|
58
|
-
{children}
|
|
59
|
-
</div>
|
|
60
|
-
</GroupCtx.Provider>
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export default Accordion;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import resolveIcon from '../lib/resolveIcon.jsx';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Accordion + AccordionGroup — collapsible disclosure.
|
|
6
|
+
*
|
|
7
|
+
* Native <details>/<summary>: zero JS, SSR-safe, accessible, chevron rotates
|
|
8
|
+
* via CSS on [open] (same pattern as Sidebar). Fully tokenized — border /
|
|
9
|
+
* hover / expanded surface / radius / spacing / type all from base.css
|
|
10
|
+
* tokens, so light + dark theme automatically via [data-theme].
|
|
11
|
+
*
|
|
12
|
+
* - <Accordion title=… defaultOpen?>content</Accordion> — standalone bordered
|
|
13
|
+
* rounded box.
|
|
14
|
+
* - <AccordionGroup><Accordion/>…</AccordionGroup> — items joined into ONE
|
|
15
|
+
* bordered box with dividers between them (no per-item border/radius). A
|
|
16
|
+
* context tells nested Accordions they're grouped so they drop their own
|
|
17
|
+
* chrome; the group container owns the border + radius + dividers.
|
|
18
|
+
*
|
|
19
|
+
* @param {{ title: React.ReactNode, defaultOpen?: boolean,
|
|
20
|
+
* children: React.ReactNode, className?: string }} props
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const GroupCtx = React.createContext(false);
|
|
24
|
+
|
|
25
|
+
export function Accordion({
|
|
26
|
+
title,
|
|
27
|
+
defaultOpen = false,
|
|
28
|
+
children,
|
|
29
|
+
className = '',
|
|
30
|
+
...rest
|
|
31
|
+
}) {
|
|
32
|
+
const inGroup = React.useContext(GroupCtx);
|
|
33
|
+
const cls = [
|
|
34
|
+
'velu-accordion',
|
|
35
|
+
inGroup ? 'velu-accordion--in-group' : '',
|
|
36
|
+
className,
|
|
37
|
+
]
|
|
38
|
+
.filter(Boolean)
|
|
39
|
+
.join(' ');
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<details className={cls} open={defaultOpen || undefined} {...rest}>
|
|
43
|
+
<summary className="velu-accordion__summary">
|
|
44
|
+
<span className="velu-accordion__chevron" aria-hidden="true">
|
|
45
|
+
{resolveIcon('chevron-right', { size: '1em' })}
|
|
46
|
+
</span>
|
|
47
|
+
<span className="velu-accordion__title">{title}</span>
|
|
48
|
+
</summary>
|
|
49
|
+
<div className="velu-accordion__content">{children}</div>
|
|
50
|
+
</details>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function AccordionGroup({ children, className = '', ...rest }) {
|
|
55
|
+
return (
|
|
56
|
+
<GroupCtx.Provider value={true}>
|
|
57
|
+
<div className={`velu-accordion-group ${className}`.trim()} {...rest}>
|
|
58
|
+
{children}
|
|
59
|
+
</div>
|
|
60
|
+
</GroupCtx.Provider>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default Accordion;
|