@domphy/press 0.20.0 → 0.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,179 @@
1
+ import { DomphyElement } from '@domphy/core';
2
+ export { DomphyElement } from '@domphy/core';
3
+ import { TocEntry } from '@domphy/markdown';
4
+ export { TocEntry } from '@domphy/markdown';
5
+
6
+ interface NavItem {
7
+ text: string;
8
+ link?: string;
9
+ items?: {
10
+ text: string;
11
+ link: string;
12
+ }[];
13
+ }
14
+ interface SidebarItem {
15
+ text: string;
16
+ link?: string;
17
+ items?: SidebarItem[];
18
+ collapsed?: boolean;
19
+ badge?: {
20
+ text: string;
21
+ type?: "tip" | "info" | "warning" | "danger";
22
+ };
23
+ }
24
+ interface SocialLink {
25
+ /** Built-in names: "github" | "twitter" | "discord" | "youtube" | "linkedin" | "mastodon".
26
+ * Or an absolute URL to a custom SVG/image. */
27
+ icon: string;
28
+ link: string;
29
+ ariaLabel?: string;
30
+ }
31
+ interface EditLink {
32
+ /** Pattern with :path placeholder, e.g. "https://github.com/org/repo/edit/main/docs/:path" */
33
+ pattern: string;
34
+ text?: string;
35
+ }
36
+ /** Override built-in layout slots. Each function receives the full LayoutContext
37
+ * and must return a DomphyElement (or null to omit the slot entirely). */
38
+ interface LayoutSlots {
39
+ /** Replace the entire header bar. */
40
+ header?: (ctx: unknown) => DomphyElement | null;
41
+ /** Replace the sidebar navigation. */
42
+ sidebar?: (ctx: unknown) => DomphyElement | null;
43
+ /** Replace the TOC aside panel. */
44
+ aside?: (ctx: unknown) => DomphyElement | null;
45
+ /** Replace the prev/next pagination row. */
46
+ prevNext?: (ctx: unknown) => DomphyElement | null;
47
+ /** Replace the doc footer (edit link + last updated). */
48
+ docFooter?: (ctx: unknown) => DomphyElement | null;
49
+ /** Replace the page footer bar. */
50
+ footer?: (ctx: unknown) => DomphyElement | null;
51
+ }
52
+ interface ThemeConfig {
53
+ nav: NavItem[];
54
+ /** Keys are route prefixes (e.g. "/guide/"). Longest match wins. */
55
+ sidebar: Record<string, SidebarItem[]>;
56
+ /** Single URL or separate light/dark variants. */
57
+ logo?: string | {
58
+ light: string;
59
+ dark: string;
60
+ };
61
+ search?: false | {
62
+ placeholder?: string;
63
+ limit?: number;
64
+ };
65
+ footerMessage?: string;
66
+ socialLinks?: SocialLink[];
67
+ editLink?: EditLink;
68
+ /** TOC heading level range. Default [2, 3]. */
69
+ outline?: {
70
+ level: [number, number];
71
+ };
72
+ /** TOC section heading text. Default "On this page". */
73
+ tocTitle?: string;
74
+ /** Enable mermaid diagrams. Pass { cdn } to override CDN URL. */
75
+ mermaid?: boolean | {
76
+ cdn?: string;
77
+ };
78
+ /** Dismissible announcement bar shown above the page. */
79
+ announcementBar?: {
80
+ id?: string;
81
+ text: string;
82
+ dismissible?: boolean;
83
+ };
84
+ /** Override individual layout slots with custom components. */
85
+ slots?: LayoutSlots;
86
+ }
87
+ interface LocaleConfig {
88
+ label: string;
89
+ lang: string;
90
+ title?: string;
91
+ description?: string;
92
+ themeConfig?: Partial<ThemeConfig>;
93
+ }
94
+ interface SiteConfig {
95
+ title: string;
96
+ description: string;
97
+ base: string;
98
+ hostname: string;
99
+ srcDir: string;
100
+ outDir: string;
101
+ head: string[];
102
+ themeConfig: ThemeConfig;
103
+ locales?: Record<string, LocaleConfig>;
104
+ /** Show last-updated date sourced from git. Default false. */
105
+ lastUpdated?: boolean;
106
+ }
107
+ interface IslandRef {
108
+ id: string;
109
+ kind: "search";
110
+ }
111
+ interface RenderedDoc {
112
+ frontmatter: Record<string, unknown>;
113
+ body: DomphyElement[];
114
+ toc: TocEntry[];
115
+ islands: IslandRef[];
116
+ title: string;
117
+ }
118
+ interface RenderDocOptions {
119
+ filePath: string;
120
+ docsDir: string;
121
+ repoRoot: string;
122
+ highlight: (code: string, lang: string) => string;
123
+ }
124
+ interface SearchDocument {
125
+ route: string;
126
+ title: string;
127
+ text: string;
128
+ toc: TocEntry[];
129
+ }
130
+ interface PageEntry {
131
+ route: string;
132
+ outFile: string;
133
+ filePath: string;
134
+ }
135
+
136
+ type UserConfig = Omit<SiteConfig, "base" | "srcDir" | "outDir" | "head"> & {
137
+ base?: string;
138
+ srcDir?: string;
139
+ outDir?: string;
140
+ head?: string[];
141
+ };
142
+ declare function defineConfig(config: UserConfig): SiteConfig;
143
+
144
+ interface LayoutContext {
145
+ route: string;
146
+ title: string;
147
+ body: DomphyElement[];
148
+ toc: TocEntry[];
149
+ frontmatter: Record<string, unknown>;
150
+ config: SiteConfig;
151
+ /** ISO date string from git log, if lastUpdated:true and git available. */
152
+ lastUpdated?: string;
153
+ /** Estimated reading time in minutes. */
154
+ readingTime?: number;
155
+ /** Relative path from srcDir (e.g. "guide/index.md"), used for editLink. */
156
+ filePath?: string;
157
+ }
158
+ declare function pageShell(ctx: LayoutContext): DomphyElement;
159
+ declare function homeShell(ctx: LayoutContext): DomphyElement;
160
+
161
+ declare function flattenSidebar(items: SidebarItem[]): {
162
+ text: string;
163
+ link: string;
164
+ }[];
165
+ declare function sidebarForRoute(route: string, config: SiteConfig): SidebarItem[];
166
+ declare function prevNextForRoute(route: string, config: SiteConfig): {
167
+ prev?: {
168
+ text: string;
169
+ link: string;
170
+ };
171
+ next?: {
172
+ text: string;
173
+ link: string;
174
+ };
175
+ };
176
+
177
+ declare function pressCSS(): string;
178
+
179
+ export { type EditLink, type IslandRef, type LayoutContext, type LayoutSlots, type LocaleConfig, type NavItem, type PageEntry, type RenderDocOptions, type RenderedDoc, type SearchDocument, type SidebarItem, type SiteConfig, type SocialLink, type ThemeConfig, type UserConfig, defineConfig, flattenSidebar, homeShell, pageShell, pressCSS, prevNextForRoute, sidebarForRoute };
@@ -0,0 +1,105 @@
1
+ function J(t){return{base:"/",srcDir:".",outDir:"dist",head:[],...t,themeConfig:Object.assign({nav:[],sidebar:{}},t.themeConfig)}}import{navLink as _}from"@domphy/app";import{themeColor as K,themeSpacing as Q}from"@domphy/theme";import{toolbar as j,toolbarSpacer as V}from"@domphy/ui";function F(t){let o=[];for(let n of t)n.link&&o.push({text:n.text,link:n.link}),n.items&&o.push(...F(n.items));return o}function T(t,o){let n="";for(let i of Object.keys(o.themeConfig.sidebar))t.startsWith(i)&&i.length>n.length&&(n=i);return n?o.themeConfig.sidebar[n]:[]}function H(t,o){let n=F(T(t,o)),i=n.findIndex(a=>a.link===t||a.link===t.replace(/\/$/,"")||`${a.link}/`===t);return i===-1?{}:{prev:i>0?n[i-1]:void 0,next:i<n.length-1?n[i+1]:void 0}}var B=t=>t,m=(t,o)=>K(null,t,o),e=t=>Q(t),u=m("inherit"),h=m("shift-1"),L=m("shift-2"),c=m("shift-3"),l=m("shift-6"),k=m("shift-9"),x=m("shift-11"),f=m("shift-9","primary"),Z=m("shift-10","primary"),E=e(14),P=e(62),ee=e(56),X=e(190),te={github:"GitHub",twitter:"Twitter",discord:"Discord",youtube:"YouTube",linkedin:"LinkedIn",mastodon:"Mastodon",npm:"npm",bluesky:"Bluesky"};function oe(t){let o=t.icon.toLowerCase();return{a:[t.icon.startsWith("http")||t.icon.startsWith("/")?{img:null,src:t.icon,alt:t.ariaLabel??o,width:"18",height:"18"}:{span:"",class:`dp-social-icon dp-icon-${o}`,ariaHidden:"true"}],href:t.link,ariaLabel:t.ariaLabel??te[o]??t.icon,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:e(8.5),height:e(8.5),borderRadius:e(2),color:l,background:h,border:`1px solid ${c}`,fontSize:"10px",fontWeight:"700",flexShrink:"0","&:hover":{color:k,borderColor:l,textDecoration:"none"}}}}function U(t,o){return{a:t,href:o,$:[_({href:o})]}}function ne(t){let o=B({display:"none",position:"absolute",top:`calc(100% + ${e(2)})`,right:"0",background:h,border:`1px solid ${c}`,borderRadius:e(2),padding:e(1.5),minWidth:e(40),zIndex:"100",flexDirection:"column",gap:e(.5),boxShadow:"0 4px 16px rgba(0,0,0,.1)","& a":{display:"block",padding:`${e(1.25)} ${e(2.5)}`,borderRadius:e(1.25),fontSize:"13px"},"& a:hover":{background:L}});return{div:[{span:t.text,style:{color:l,fontSize:"14px",fontWeight:"500",cursor:"pointer",userSelect:"none","&::after":{content:'" \u25BE"',fontSize:"10px",opacity:".6"}}},{div:t.items.map(n=>U(n.text,n.link)),style:o}],style:{position:"relative",display:"flex",alignItems:"center","&:hover > div:last-child, &:focus-within > div:last-child":{display:"flex"}}}}function q(t){let o=t.themeConfig.announcementBar;if(!o)return null;let n=o.id?o.id:"",i=[{span:o.text}];return o.dismissible!==!1&&i.push({button:"\u2715",type:"button",dataDismissAnnouncement:"",ariaLabel:"Dismiss",style:{background:"none",border:"none",color:u,cursor:"pointer",fontSize:"14px",opacity:".7",padding:`${e(.5)} ${e(1.5)}`,borderRadius:e(1),flexShrink:"0","&:hover":{opacity:"1"}}}),{div:i,class:"dp-announcement",...n?{dataId:n}:{},style:{display:"flex",alignItems:"center",justifyContent:"center",gap:e(3),padding:`${e(2.5)} ${e(6)}`,background:f,color:u,fontSize:"14px",fontWeight:"500",textAlign:"center","& a":{color:u,fontWeight:"700"}}}}function ie(t){let{config:o,route:n}=t;if(!o.locales)return null;let i=Object.entries(o.locales);if(i.length<=1)return null;let a="/",s=n;for(let[g]of i)if(g!=="/"&&n.startsWith(g.replace(/\/$/,""))){a=g,s=n.slice(g.replace(/\/$/,"").length)||"/";break}let d=o.locales[a];if(!d)return null;let y=i.map(([g,D])=>{let R=(g==="/"?"":g.replace(/\/$/,""))+(s==="/"?"/":s),C=g===a;return{a:D.label,href:R,...C?{ariaCurrent:"true"}:{},lang:D.lang,style:{display:"block",padding:`${e(1.25)} ${e(2.5)}`,borderRadius:e(1.25),fontSize:"13px",color:l,...C?{color:f,fontWeight:"600"}:{},"&:hover":{background:L,color:k,textDecoration:"none"}}}}),S=B({display:"none",position:"absolute",top:`calc(100% + ${e(2)})`,right:"0",background:h,border:`1px solid ${c}`,borderRadius:e(2),padding:e(1.5),minWidth:e(32),zIndex:"200",flexDirection:"column",gap:e(.5),boxShadow:"0 4px 16px rgba(0,0,0,.1)"});return{div:[{span:["\u{1F310} ",d.label],style:{color:l,fontSize:"13px",fontWeight:"500",cursor:"pointer",userSelect:"none",padding:`${e(1)} ${e(2)}`,border:`1px solid ${c}`,borderRadius:e(1.5),background:h,whiteSpace:"nowrap",display:"flex",alignItems:"center",gap:e(1),"&::after":{content:'" \u25BE"',fontSize:"10px",opacity:".6"}}},{div:y,style:S}],ariaLabel:"Select language",style:{position:"relative",display:"flex",alignItems:"center","&:hover > div:last-child, &:focus-within > div:last-child":{display:"flex"}}}}function Y(t){let{config:o}=t,n=o.themeConfig.search!==!1,i=o.themeConfig.logo,a=i?typeof i=="string"?[{img:null,src:i,alt:o.title,style:{height:e(7),width:"auto",display:"block"}}]:[{img:null,src:i.light,alt:o.title,class:"dp-logo-light",style:{height:e(7),width:"auto",display:"block"}},{img:null,src:i.dark,alt:o.title,class:"dp-logo-dark",style:{height:e(7),width:"auto",display:"block"}}]:[],s={fontWeight:"700",fontSize:"18px",color:x,whiteSpace:"nowrap",flexShrink:"0",textDecoration:"none","&:hover":{textDecoration:"none"}},d=i?{a,href:o.base,style:s}:{a:o.title,href:o.base,style:s},y=(o.themeConfig.socialLinks??[]).map(oe),S=ie(t);return{header:[d,V(),{nav:o.themeConfig.nav.map(g=>g.items?ne(g):U(g.text,g.link)),$:[j({gap:4})],ariaLabel:"Primary",style:{"& a":{color:l,fontSize:"14px",fontWeight:"500",whiteSpace:"nowrap",lineHeight:"1"},"& a:hover, & a[aria-current='page']":{color:f,textDecoration:"none"},"@media (max-width: 860px)":{display:"none"}}},{div:[...n?[{div:[{input:null,type:"search",placeholder:typeof o.themeConfig.search=="object"&&o.themeConfig.search.placeholder||"Search...",ariaLabel:"Search documentation",style:{width:"100%",height:e(8),padding:`0 ${e(2.5)}`,border:`1px solid ${c}`,borderRadius:e(1.5),background:h,color:l,fontSize:"13px",fontFamily:"inherit",outline:"none",cursor:"pointer","&::placeholder":{color:l}}}],dataIsland:"search",style:{width:e(50),"@media (max-width: 860px)":{width:e(35)}}}]:[],...y,...S?[S]:[],{button:"\u25D0",type:"button",ariaLabel:"Toggle dark mode",dataThemeToggle:"",style:{border:`1px solid ${c}`,background:h,color:k,borderRadius:e(2),width:e(8.5),height:e(8.5),cursor:"pointer",fontSize:"16px",flexShrink:"0"}},{button:"\u2630",type:"button",ariaLabel:"Toggle menu",dataMenuToggle:"",style:{border:`1px solid ${c}`,background:h,color:k,borderRadius:e(2),width:e(8.5),height:e(8.5),cursor:"pointer",fontSize:"16px",flexShrink:"0",display:"none","@media (max-width: 860px)":{display:"block"}}}],$:[j({gap:2})],style:{flexShrink:"0"}}],$:[j({gap:4})],style:{position:"sticky",top:"0",height:E,background:u,borderBottom:`1px solid ${c}`,zIndex:"100",padding:`0 ${e(6)}`,"@media (max-width: 860px)":{padding:`0 ${e(3)}`}}}}function N(t){let o={tip:f,info:l,warning:m("shift-9","warning"),danger:m("shift-9","danger")},n={tip:`color-mix(in srgb,${f} 12%,${u})`,info:L,warning:`color-mix(in srgb,${m("shift-9","warning")} 12%,${u})`,danger:`color-mix(in srgb,${m("shift-9","danger")} 12%,${u})`},i=t.type??"tip";return{span:t.text,style:{display:"inline-block",padding:`${e(.5)} ${e(1.75)}`,borderRadius:e(2.5),fontSize:"11px",fontWeight:"700",lineHeight:"1.4",whiteSpace:"nowrap",verticalAlign:"middle",background:n[i]??L,color:o[i]??l}}}function A(t,o,n){return n?{a:[{span:t},N(n)],href:o,$:[_({href:o})],style:{display:"flex",alignItems:"center"}}:U(t,o)}function re(t){let o=[],n=t.items&&t.items.length>0;if(t.link)o.push(A(t.text,t.link,t.badge));else{let a=[{span:t.text}];t.badge&&a.push(N(t.badge)),n&&a.push({button:t.collapsed?"\u203A":"\u2039",type:"button",ariaLabel:t.collapsed?"Expand":"Collapse",dataSidebarToggle:"",style:{marginLeft:"auto",background:"none",border:"none",cursor:"pointer",color:l,fontSize:"14px",padding:`0 ${e(1)}`,lineHeight:"1","&:hover":{color:k}}}),o.push({div:a,style:{display:"flex",alignItems:"center",gap:e(1.5),fontSize:"13px",fontWeight:"700",color:x,margin:`${e(2)} 0 ${e(1)}`}})}if(t.items){let a=[];for(let s of t.items)if(s.items){a.push({div:s.text,style:{fontSize:"12px",color:l,padding:`${e(1)} ${e(3)}`,fontWeight:"600"}});for(let d of s.items)d.link&&a.push(A(d.text,d.link,d.badge))}else s.link&&a.push(A(s.text,s.link,s.badge));o.push({div:a,class:"dp-sidebar-items",style:{display:"flex",flexDirection:"column"}})}let i=["dp-sidebar-group",n&&t.collapsed?"collapsed":""].filter(Boolean).join(" ");return{div:o,class:i,style:{marginBottom:e(3.5)}}}function ae(t){return{nav:T(t.route,t.config).map(re),ariaLabel:"Documentation",style:{position:"sticky",top:E,maxHeight:`calc(100vh - ${E})`,overflowY:"auto",padding:`${e(6)} ${e(3)} ${e(12)} ${e(6)}`,borderRight:`1px solid ${c}`,"& a":{display:"flex",alignItems:"center",gap:e(1.5),padding:`${e(1.25)} ${e(3)}`,fontSize:"14px",color:l,borderRadius:e(1.5)},"& a:hover":{color:k,textDecoration:"none"},"& a[aria-current='page']":{color:f,fontWeight:"600",background:h},"@media (max-width: 860px)":{position:"fixed",top:E,left:"0",bottom:"0",width:"80%",maxWidth:e(80),background:u,zIndex:"25",transform:"translateX(-100%)",transition:"transform .2s ease",maxHeight:"none"}}}}function se(t){if(t.frontmatter.aside===!1)return null;let[o,n]=t.config.themeConfig.outline?.level??[2,3],i=t.toc.filter(d=>d.level>=o&&d.level<=n);if(i.length===0)return null;let a=t.config.themeConfig.tocTitle??"On this page",s={2:"0",3:e(3),4:e(6)};return{aside:[{div:a,style:{fontWeight:"700",marginBottom:e(2),color:k}},{nav:i.map(d=>({a:d.text,href:`#${d.slug}`,style:{display:"block",padding:`${e(.75)} 0`,color:l,paddingLeft:s[d.level]??"0","&:hover":{color:f,textDecoration:"none"}}}))}],style:{position:"sticky",top:E,maxHeight:`calc(100vh - ${E})`,overflowY:"auto",padding:`${e(8)} ${e(6)}`,fontSize:"13px"}}}function le(t){let{prev:o,next:n}=H(t.route,t.config);if(!o&&!n)return null;let i=B({display:"block",padding:`${e(3)} ${e(4)}`,border:`1px solid ${c}`,borderRadius:e(2),fontWeight:"600",flex:"1","&:hover":{borderColor:f,textDecoration:"none"}});return{nav:[o?{a:[{small:"Previous",style:{display:"block",color:l,fontWeight:"400",fontSize:"12px"}},{span:o.text}],href:o.link,style:i}:{span:""},n?{a:[{small:"Next",style:{display:"block",color:l,fontWeight:"400",fontSize:"12px"}},{span:n.text}],href:n.link,style:{...i,textAlign:"right"}}:{span:""}],ariaLabel:"Page navigation",style:{display:"flex",justifyContent:"space-between",gap:e(4),marginTop:e(12),paddingTop:e(6),borderTop:`1px solid ${c}`}}}function de(t){let{editLink:o}=t.config.themeConfig,n=t.config.lastUpdated,i=o&&t.filePath,a=n&&t.lastUpdated;if(!i&&!a&&!t.readingTime)return null;let s=[];if(a){let y=new Date(t.lastUpdated).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"});s.push({span:["Last updated: ",{time:y,dateTime:t.lastUpdated}]})}if(t.readingTime&&s.push({span:`\u{1F4D6} ${t.readingTime} min read`}),i){let y=o.pattern.replace(/:path/g,t.filePath);s.push({a:o.text??"Edit this page",href:y,target:"_blank",rel:"noopener noreferrer",style:{fontWeight:"500",fontSize:"13px"}})}return{div:s,style:{display:"flex",alignItems:"center",gap:e(4),flexWrap:"wrap",marginTop:e(8),paddingTop:e(5),borderTop:`1px solid ${c}`,fontSize:"13px",color:l}}}function ce(t){let o=t.badge;if(!o)return null;let n=typeof o=="string"?o:o.text??"",i=typeof o=="object"?o.type??"tip":"tip";return n?N({text:n,type:i}):null}function z(t,o,n){let i=t.config.themeConfig.slots?.[o];return i?i(t):n(t)}function G(t){return{div:t,style:{maxWidth:X,"& h1":{fontSize:"30px",fontWeight:"700",lineHeight:"1.25",margin:`0 0 ${e(6)}`,letterSpacing:"-.02em",color:x},"& h2":{fontSize:"22px",fontWeight:"700",margin:`${e(11)} 0 ${e(4)}`,paddingTop:e(5),borderTop:`1px solid ${c}`,letterSpacing:"-.01em",color:x},"& h3":{fontSize:"18px",fontWeight:"600",margin:`${e(7)} 0 ${e(3)}`,color:x},"& h4":{fontSize:"16px",fontWeight:"600",margin:`${e(5.5)} 0 ${e(2)}`,color:x},"& p":{margin:`${e(4)} 0`},"& ul, & ol":{margin:`${e(4)} 0`,paddingLeft:"1.4em"},"& li":{margin:`${e(1.5)} 0`},"& a":{fontWeight:"500"},"& a[target='_blank']::after":{content:'" \u2197"',fontSize:".75em",opacity:".6"},"& strong":{fontWeight:"600",color:x},"& em":{fontStyle:"italic"},"& mark":{background:`color-mix(in srgb,${m("shift-6","warning")} 40%,${u})`,color:"inherit",padding:`${e(.25)} ${e(.75)}`,borderRadius:e(.75)},"& sup":{fontSize:".75em",verticalAlign:"super"},"& sub":{fontSize:".75em",verticalAlign:"sub"},"& del":{opacity:".5"},"& blockquote":{margin:`${e(4)} 0`,padding:`0 ${e(4)}`,borderLeft:`3px solid ${c}`,color:l},"& img":{maxWidth:"100%",height:"auto",borderRadius:e(1.5)},"& hr":{border:"none",borderTop:`1px solid ${c}`,margin:`${e(8)} 0`},"& :not(pre)>code":{fontFamily:'ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace',fontSize:".85em",background:L,padding:`${e(.75)} ${e(1.5)}`,borderRadius:e(1)},"& pre":{margin:`${e(4)} 0`,padding:`${e(4)} ${e(5)}`,background:h,border:`1px solid ${c}`,borderRadius:e(2),overflowX:"auto",fontSize:"13.5px",lineHeight:"1.5"},"& pre code":{fontFamily:'ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace',background:"none",padding:"0"},"& table":{borderCollapse:"collapse",margin:`${e(4)} 0`,display:"block",overflowX:"auto"},"& th, & td":{border:`1px solid ${c}`,padding:`${e(2)} ${e(3.5)}`,textAlign:"left"},"& th":{background:h,fontWeight:"600"}}}}function pe(t){let o=t.frontmatter.sidebar!==!1,n=[],i=ce(t.frontmatter);i&&n.push({div:[i],style:{marginBottom:e(-2)}}),n.push(G(t.body));let a=z(t,"prevNext",le);a&&n.push(a);let s=z(t,"docFooter",de);s&&n.push(s);let d=o?z(t,"sidebar",ae):null,y=o?{padding:`${e(8)} ${e(12)} ${e(20)}`,minWidth:"0","@media (max-width: 860px)":{padding:`${e(6)} ${e(5)} ${e(16)}`}}:{padding:`${e(8)} ${e(12)} ${e(20)}`,gridColumn:"1 / -1",maxWidth:X,margin:"0 auto","@media (max-width: 860px)":{padding:`${e(6)} ${e(5)} ${e(16)}`}},S=[...d?[d]:[],{main:n,style:y}],g=z(t,"aside",se);g&&o&&S.push(g);let D=z(t,"header",Y),M=q(t.config),R=t.config.themeConfig.slots,C=R?.footer?R.footer(t):{footer:t.config.themeConfig.footerMessage??"",style:{padding:`${e(6)} ${e(12)}`,borderTop:`1px solid ${c}`,color:l,fontSize:"13px"}};return{div:[...M?[M]:[],...D?[D]:[],{div:S,style:{display:"grid",gridTemplateColumns:o?`${P} minmax(0,1fr) ${ee}`:"1fr",alignItems:"start",maxWidth:"1440px",margin:"0 auto","@media (max-width: 1200px)":o?{gridTemplateColumns:`${P} minmax(0,1fr)`}:{},"@media (max-width: 860px)":{gridTemplateColumns:"1fr"}}},...C?[C]:[]]}}function ge(t){let o=[];if(t.name&&o.push({div:t.name,style:{fontSize:"56px",fontWeight:"800",lineHeight:"1.1",letterSpacing:"-.03em",background:`linear-gradient(120deg,${f},${m("shift-7","secondary")})`,WebkitBackgroundClip:"text",backgroundClip:"text",color:"transparent"}}),t.text&&o.push({h1:t.text,style:{fontSize:"30px",fontWeight:"700",margin:`${e(3)} 0 0`,color:x}}),t.tagline&&o.push({p:t.tagline,style:{fontSize:"18px",color:l,maxWidth:e(160),margin:`${e(5)} auto 0`}}),t.actions?.length){let n=i=>!i||i==="brand"?{padding:`${e(2.5)} ${e(5.5)}`,borderRadius:e(5.5),fontWeight:"600",fontSize:"15px",background:f,color:u,"&:hover":{background:Z,textDecoration:"none"}}:{padding:`${e(2.5)} ${e(5.5)}`,borderRadius:e(5.5),fontWeight:"600",fontSize:"15px",background:h,color:k,border:`1px solid ${c}`,"&:hover":{borderColor:f,textDecoration:"none"}};o.push({div:t.actions.map(i=>({a:i.text,href:i.link,style:n(i.theme)})),style:{display:"flex",gap:e(3),justifyContent:"center",marginTop:e(7),flexWrap:"wrap"}})}return{section:o,style:{textAlign:"center",padding:`${e(10)} 0 ${e(6)}`}}}function me(t){return{div:t.map(o=>{let n=[];o.icon&&n.push({div:o.icon,style:{fontSize:"28px",marginBottom:e(3)}}),n.push({div:o.title,style:{fontWeight:"700",fontSize:"17px",marginBottom:e(2),color:x}}),n.push({p:o.details,style:{fontSize:"14px",color:l,margin:"0",lineHeight:"1.5"}});let i={padding:e(5),background:h,border:`1px solid ${c}`,borderRadius:e(3)},a={div:n,style:i};return o.link?{a:[a],href:o.link,style:{display:"block",color:"inherit","&:hover":{textDecoration:"none"},"&:hover > div":{borderColor:f}}}:a}),style:{display:"grid",gridTemplateColumns:`repeat(auto-fit,minmax(${e(60)},1fr))`,gap:e(4),margin:`${e(10)} 0`}}}function he(t){let o=[],n=t.frontmatter.hero,i=t.frontmatter.features;n&&o.push(ge(n)),i?.length&&o.push(me(i)),o.push(G(t.body));let a=q(t.config);return{div:[...a?[a]:[],Y(t),{main:o,style:{maxWidth:"1100px",margin:"0 auto",padding:`${e(12)} ${e(6)} ${e(20)}`}},{footer:t.config.themeConfig.footerMessage??"",style:{padding:`${e(6)} ${e(12)}`,borderTop:`1px solid ${c}`,color:l,fontSize:"13px"}}]}}import{themeColor as fe,themeSpacing as ue}from"@domphy/theme";var p=(t,o)=>fe(null,t,o),r=t=>ue(t),w=p("inherit"),v=p("shift-1"),I=p("shift-2"),$=p("shift-3"),W=p("shift-6"),O=p("shift-9"),be=p("shift-11"),b=p("shift-9","primary"),ye=r(14);function xe(){return`
2
+ /* ------------------------------------------------------------------ reset */
3
+ *,*::before,*::after{box-sizing:border-box}
4
+ html{scroll-behavior:smooth;scroll-padding-top:calc(${ye} + ${r(4)})}
5
+ body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;background:${w};color:${O};line-height:1.6;font-size:16px}
6
+ a{color:${b};text-decoration:none}
7
+ a:hover{text-decoration:underline}
8
+
9
+ /* -------------------------------------------------------- logo theme variants */
10
+ /* dp-logo-light/dark classes set in layout.ts img elements */
11
+ [data-theme="dark"] .dp-logo-light{display:none}
12
+ [data-theme="light"] .dp-logo-dark,.dp-logo-dark{display:none}
13
+ [data-theme="dark"] .dp-logo-dark{display:block}
14
+
15
+ /* ---------------------------------------------------------- social icon masks */
16
+ /* dp-social-icon + dp-icon-* classes set in layout.ts socialLinkEl */
17
+ .dp-social-icon{display:block;width:${r(4)};height:${r(4)};background:currentColor;flex-shrink:0}
18
+ .dp-icon-github{-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.17 6.839 9.49.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.603-3.369-1.342-3.369-1.342-.454-1.155-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0 1 12 6.836c.85.004 1.705.115 2.504.337 1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.167 22 16.418 22 12c0-5.523-4.477-10-10-10z'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2C6.477 2 2 6.477 2 12c0 4.42 2.865 8.17 6.839 9.49.5.092.682-.217.682-.482 0-.237-.008-.866-.013-1.7-2.782.603-3.369-1.342-3.369-1.342-.454-1.155-1.11-1.463-1.11-1.463-.908-.62.069-.608.069-.608 1.003.07 1.531 1.03 1.531 1.03.892 1.529 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.11-4.555-4.943 0-1.091.39-1.984 1.029-2.683-.103-.253-.446-1.27.098-2.647 0 0 .84-.269 2.75 1.025A9.578 9.578 0 0 1 12 6.836c.85.004 1.705.115 2.504.337 1.909-1.294 2.747-1.025 2.747-1.025.546 1.377.202 2.394.1 2.647.64.699 1.028 1.592 1.028 2.683 0 3.842-2.339 4.687-4.566 4.935.359.309.678.919.678 1.852 0 1.336-.012 2.415-.012 2.741 0 .267.18.578.688.48C19.138 20.167 22 16.418 22 12c0-5.523-4.477-10-10-10z'/%3E%3C/svg%3E") center/contain no-repeat}
19
+ .dp-icon-twitter{-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.744l7.737-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-4.714-6.231-5.401 6.231H2.744l7.737-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z'/%3E%3C/svg%3E") center/contain no-repeat}
20
+ .dp-icon-discord{-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057c.01.044.032.084.064.107a19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028 14.09 14.09 0 0 0 1.226-1.994.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01 10.2 10.2 0 0 0 .373.292.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03z'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057c.01.044.032.084.064.107a19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028 14.09 14.09 0 0 0 1.226-1.994.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01 10.2 10.2 0 0 0 .373.292.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03z'/%3E%3C/svg%3E") center/contain no-repeat}
21
+
22
+ /* ------- sidebar collapsed state (JS toggles 'collapsed' class on group) ------- */
23
+ .dp-sidebar-group.collapsed .dp-sidebar-items{display:none}
24
+
25
+ /* ------- sidebar open state on mobile (JS sets html[data-sidebar="open"]) ------ */
26
+ @media(max-width:860px){
27
+ html[data-sidebar="open"] nav[aria-label="Documentation"]{transform:translateX(0)}
28
+ }
29
+
30
+ /* -------------------------------------------------------- heading anchors */
31
+ .header-anchor{opacity:0;margin-left:${r(2)};font-weight:400;font-size:.85em;color:${W};transition:opacity .15s}
32
+ :is(h1,h2,h3,h4,h5,h6):hover .header-anchor{opacity:1}
33
+ .header-anchor:hover{color:${b};text-decoration:none}
34
+
35
+ /* ------------------------------------------------------------ code blocks */
36
+ .code-block{margin:${r(4)} 0;border:1px solid ${$};border-radius:${r(2)};overflow:hidden}
37
+ .code-block-title{display:flex;align-items:center;padding:${r(1.5)} ${r(4)};background:${I};border-bottom:1px solid ${$};font-size:12px;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace;color:${W}}
38
+ .code-block-inner{position:relative}
39
+ .code-block pre{margin:0;padding:${r(4)} ${r(5)};background:${v};border:none;border-radius:0;overflow-x:auto;font-size:13.5px;line-height:1.5;font-family:ui-monospace,SFMono-Regular,"SF Mono",Menlo,monospace}
40
+ .code-block code{font-family:inherit;background:none;padding:0;font-size:inherit}
41
+ .code-block .line{display:inline-block;width:100%}
42
+ .code-block .line.highlighted{background:color-mix(in srgb,${b} 10%,transparent)}
43
+ .code-block .line.diff.add{background:color-mix(in srgb,${p("shift-7","success")} 12%,transparent)}
44
+ .code-block .line.diff.add::before{content:"+ ";color:${p("shift-7","success")}}
45
+ .code-block .line.diff.remove{background:color-mix(in srgb,${p("shift-9","danger")} 10%,transparent);opacity:.7}
46
+ .code-block .line.diff.remove::before{content:"- ";color:${p("shift-9","danger")}}
47
+ .code-block .line.highlighted.error{background:color-mix(in srgb,${p("shift-9","error")} 10%,transparent)}
48
+ .code-block .line.highlighted.warning{background:color-mix(in srgb,${p("shift-7","warning")} 10%,transparent)}
49
+ .code-block pre.has-focus .line:not(.focus){opacity:.4;filter:blur(.4px);transition:opacity .2s,filter .2s}
50
+ .code-block pre.has-focus:hover .line{opacity:1;filter:none}
51
+ .code-block .line-number{display:inline-block;min-width:2.5em;margin-right:1em;color:${W};text-align:right;user-select:none;font-size:.9em}
52
+ .code-copy-btn{position:absolute;top:${r(2)};right:${r(2)};padding:${r(1)} ${r(2)};border-radius:${r(1.25)};border:1px solid ${$};background:${v};color:${W};cursor:pointer;font-size:13px;opacity:0;transition:opacity .15s}
53
+ .code-block-inner:hover .code-copy-btn{opacity:1}
54
+ .code-copy-btn:hover{background:${I};color:${O}}
55
+
56
+ /* ------------------------------------------------------------- code groups */
57
+ .code-group{margin:${r(4)} 0;border:1px solid ${$};border-radius:${r(2)};overflow:hidden}
58
+ .code-group>input[type="radio"]{position:absolute;opacity:0;pointer-events:none;width:0;height:0}
59
+ .code-group .tabs{display:flex;gap:${r(.5)};padding:${r(1.5)} ${r(2)};background:${v};border-bottom:1px solid ${$};flex-wrap:wrap}
60
+ .code-group .tabs label{padding:${r(1)} ${r(3)};font-size:13px;font-weight:500;color:${W};border-radius:${r(1.25)};cursor:pointer}
61
+ .code-group .blocks>.code-block{display:none;margin:0;border:none;border-radius:0}
62
+ .code-group .blocks>.code-block pre{border-radius:0}
63
+ ${Array.from({length:8},(t,o)=>`.code-group>input:nth-of-type(${o+1}):checked~.blocks>.code-block:nth-child(${o+1})`).join(`,
64
+ `)}{display:block}
65
+ ${Array.from({length:8},(t,o)=>`.code-group>input:nth-of-type(${o+1}):checked~.tabs>label:nth-child(${o+1})`).join(`,
66
+ `)}{color:${b};background:${I}}
67
+
68
+ /* ---------------------------------------------------------- card containers */
69
+ .custom-block.card{background:${v};border:1px solid ${$};border-radius:${r(3)};padding:${r(5)} ${r(6)};margin:${r(3)} 0}
70
+ .custom-block.card .card-title{font-size:16px;font-weight:600;color:${be};margin:0 0 ${r(2)}}
71
+ .custom-block.card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(${r(56)},1fr));gap:${r(4)};margin:${r(4)} 0}
72
+ a.custom-block.link-card{display:block;background:${v};border:1px solid ${$};border-radius:${r(3)};padding:${r(5)} ${r(6)};margin:${r(3)} 0;transition:border-color .15s,background .15s;text-decoration:none;color:${O}}
73
+ a.custom-block.link-card:hover{border-color:${b};background:${I};text-decoration:none}
74
+ a.custom-block.link-card .link-card-title{font-size:16px;font-weight:600;color:${b};margin:0 0 ${r(2)}}
75
+ .custom-block.card-grid .custom-block.card,.custom-block.card-grid a.custom-block.link-card{margin:0}
76
+
77
+ /* --------------------------------------------------------- custom blocks */
78
+ .custom-block{margin:${r(4)} 0;padding:${r(3)} ${r(4)};border-radius:${r(2)};border:1px solid transparent;font-size:14.5px}
79
+ .custom-block p{margin:${r(2)} 0}
80
+ .custom-block-title{font-weight:700;margin:0 0 ${r(1)} !important;font-size:13px}
81
+ .custom-block.tip,.custom-block.success{background:color-mix(in srgb,${b} 8%,${w});border-color:color-mix(in srgb,${b} 28%,transparent)}
82
+ .custom-block.info,.custom-block.note,.custom-block.abstract{background:${v};border-color:${$}}
83
+ .custom-block.warning,.custom-block.question{background:color-mix(in srgb,${p("shift-6","warning")} 10%,${w});border-color:${p("shift-6","warning")}}
84
+ .custom-block.danger,.custom-block.failure,.custom-block.bug{background:color-mix(in srgb,${p("shift-7","danger")} 10%,${w});border-color:${p("shift-7","danger")}}
85
+ .custom-block.example{background:color-mix(in srgb,${p("shift-7","secondary")} 10%,${w});border-color:${p("shift-7","secondary")}}
86
+ .custom-block.quote{background:${v};border-color:${$};border-left-width:4px;border-radius:0 ${r(2)} ${r(2)} 0}
87
+ details.custom-block summary{cursor:pointer;font-weight:600}
88
+
89
+ /* ------------------------------------------------------------------- steps */
90
+ .custom-block.steps{background:none;border:none;padding:0}
91
+ .custom-block.steps>ol{counter-reset:step;list-style:none;padding:0;margin:0}
92
+ .custom-block.steps>ol>li{counter-increment:step;display:grid;grid-template-columns:${r(9)} 1fr;gap:0 ${r(4)};margin-bottom:${r(6)}}
93
+ .custom-block.steps>ol>li::before{content:counter(step);display:flex;align-items:center;justify-content:center;width:${r(7.5)};height:${r(7.5)};border-radius:50%;background:${b};color:${w};font-size:13px;font-weight:700;flex-shrink:0}
94
+
95
+ /* ----------------------------------------------------------------- mermaid */
96
+ .dp-mermaid{margin:${r(5)} 0;text-align:center;overflow-x:auto}
97
+ .dp-mermaid svg{max-width:100%;height:auto}
98
+
99
+ /* --------------------------------------------------------------- task lists */
100
+ .task-list-item{list-style:none;margin-left:-1.4em;padding-left:1.8em;position:relative}
101
+ .task-list-check{position:absolute;left:0;top:.25em;width:14px;height:14px;cursor:default;accent-color:${b}}
102
+
103
+ /* ---------------------------------------------------------------- shiki dark */
104
+ html[data-theme="dark"] .shiki,html[data-theme="dark"] .shiki span{color:var(--shiki-dark,inherit) !important}
105
+ `}export{J as defineConfig,F as flattenSidebar,he as homeShell,pe as pageShell,xe as pressCSS,H as prevNextForRoute,T as sidebarForRoute};
@@ -163,50 +163,7 @@ import { navLink } from "@domphy/app";
163
163
  import { themeColor, themeSpacing } from "@domphy/theme";
164
164
  import { toolbar, toolbarSpacer } from "@domphy/ui";
165
165
 
166
- // src/routes.ts
167
- import { readdirSync, statSync } from "fs";
168
- import { join, posix, relative, sep } from "path";
169
- var NON_PAGE_DIRS = /* @__PURE__ */ new Set(["snippets", "demos", "node_modules", ".git"]);
170
- function routeForFile(srcRelativePath) {
171
- const posixPath = srcRelativePath.split(sep).join(posix.sep);
172
- const withoutExt = posixPath.replace(/\.md$/, "");
173
- const segments = withoutExt.split("/");
174
- const last = segments[segments.length - 1];
175
- if (last === "index") {
176
- segments.pop();
177
- return segments.length === 0 ? "/" : `/${segments.join("/")}/`;
178
- }
179
- return `/${segments.join("/")}`;
180
- }
181
- function outFileForRoute(route) {
182
- if (route === "/") return "index.html";
183
- const trimmed = route.replace(/^\/+/, "").replace(/\/+$/, "");
184
- return `${trimmed}/index.html`;
185
- }
186
- function listMarkdown(dir) {
187
- const found = [];
188
- for (const name of readdirSync(dir)) {
189
- const full = join(dir, name);
190
- const stats = statSync(full);
191
- if (stats.isDirectory()) {
192
- if (NON_PAGE_DIRS.has(name) || name.startsWith(".")) continue;
193
- found.push(...listMarkdown(full));
194
- } else if (name.endsWith(".md") && name.toLowerCase() !== "readme.md") {
195
- found.push(full);
196
- }
197
- }
198
- return found;
199
- }
200
- function discoverPages(srcDir) {
201
- const files = listMarkdown(srcDir);
202
- const pages = files.map((filePath) => {
203
- const rel = relative(srcDir, filePath);
204
- const route = routeForFile(rel);
205
- return { route, outFile: outFileForRoute(route), filePath };
206
- });
207
- pages.sort((a, b) => a.route.localeCompare(b.route));
208
- return pages;
209
- }
166
+ // src/routes-browser.ts
210
167
  function flattenSidebar(items) {
211
168
  const out = [];
212
169
  for (const item of items) {
@@ -1315,7 +1272,7 @@ import {
1315
1272
  } from "@domphy/markdown";
1316
1273
  import MarkdownIt from "markdown-it";
1317
1274
  import container from "markdown-it-container";
1318
- import emojiPkg from "markdown-it-emoji";
1275
+ import { full as emojiPlugin } from "markdown-it-emoji";
1319
1276
  import includeUntyped from "markdown-it-include";
1320
1277
  import markUntyped from "markdown-it-mark";
1321
1278
  import subUntyped from "markdown-it-sub";
@@ -1324,7 +1281,6 @@ var include = includeUntyped;
1324
1281
  var markPlugin = markUntyped;
1325
1282
  var subPlugin = subUntyped;
1326
1283
  var supPlugin = supUntyped;
1327
- var emojiPlugin = emojiPkg.full ?? emojiPkg;
1328
1284
  var CODE_IMPORT_PATTERN = /^<<<\s+(\S+?)(?:\s+\[([^\]]*)\])?\s*$/gm;
1329
1285
  var EXT_LANG = {
1330
1286
  ".ts": "ts",
@@ -1746,6 +1702,56 @@ async function renderDoc(source, options) {
1746
1702
  return { frontmatter, body: withAnchors, toc, islands: [], title };
1747
1703
  }
1748
1704
 
1705
+ // src/routes.ts
1706
+ import { readdirSync, statSync } from "fs";
1707
+ import { join, relative } from "path";
1708
+ function listMarkdown(dir) {
1709
+ const found = [];
1710
+ for (const name of readdirSync(dir)) {
1711
+ const full = join(dir, name);
1712
+ const stats = statSync(full);
1713
+ if (stats.isDirectory()) {
1714
+ const NON_PAGE_DIRS = /* @__PURE__ */ new Set([
1715
+ "snippets",
1716
+ "demos",
1717
+ "node_modules",
1718
+ ".git"
1719
+ ]);
1720
+ if (NON_PAGE_DIRS.has(name) || name.startsWith(".")) continue;
1721
+ found.push(...listMarkdown(full));
1722
+ } else if (name.endsWith(".md") && name.toLowerCase() !== "readme.md") {
1723
+ found.push(full);
1724
+ }
1725
+ }
1726
+ return found;
1727
+ }
1728
+ function routeForFile(srcRelativePath) {
1729
+ const posixPath = srcRelativePath.replace(/\\/g, "/");
1730
+ const withoutExt = posixPath.replace(/\.md$/, "");
1731
+ const segments = withoutExt.split("/");
1732
+ const last = segments[segments.length - 1];
1733
+ if (last === "index") {
1734
+ segments.pop();
1735
+ return segments.length === 0 ? "/" : `/${segments.join("/")}/`;
1736
+ }
1737
+ return `/${segments.join("/")}`;
1738
+ }
1739
+ function outFileForRoute(route) {
1740
+ if (route === "/") return "index.html";
1741
+ const trimmed = route.replace(/^\/+/, "").replace(/\/+$/, "");
1742
+ return `${trimmed}/index.html`;
1743
+ }
1744
+ function discoverPages(srcDir) {
1745
+ const files = listMarkdown(srcDir);
1746
+ const pages = files.map((filePath) => {
1747
+ const rel = relative(srcDir, filePath);
1748
+ const route = routeForFile(rel);
1749
+ return { route, outFile: outFileForRoute(route), filePath };
1750
+ });
1751
+ pages.sort((a, b) => a.route.localeCompare(b.route));
1752
+ return pages;
1753
+ }
1754
+
1749
1755
  // src/search.ts
1750
1756
  import { ElementNode, RecordState } from "@domphy/core";
1751
1757
  import { themeColor as themeColor2, themeSpacing as themeSpacing2 } from "@domphy/theme";
package/dist/cli.js CHANGED
@@ -28,7 +28,7 @@ if (command === "build") {
28
28
  flag("--out") ?? config.outDir ?? "dist"
29
29
  );
30
30
  const publicDir = resolve(process.cwd(), "public");
31
- const { buildSite } = await import("./build-SVIPUB2K.js");
31
+ const { buildSite } = await import("./build-XI5DHRNV.js");
32
32
  await buildSite({
33
33
  config: {
34
34
  ...config,
@@ -49,7 +49,7 @@ if (command === "build") {
49
49
  flag("--out") ?? config.outDir ?? ".press-dev"
50
50
  );
51
51
  const publicDir = resolve(process.cwd(), "public");
52
- const { buildSite } = await import("./build-SVIPUB2K.js");
52
+ const { buildSite } = await import("./build-XI5DHRNV.js");
53
53
  const { startDevServer } = await import("./serve-CMS6MDDF.js");
54
54
  async function rebuild() {
55
55
  const start = Date.now();
package/dist/index.d.ts CHANGED
@@ -179,9 +179,6 @@ declare function homeShell(ctx: LayoutContext): DomphyElement;
179
179
 
180
180
  declare function renderDoc(source: string, options: RenderDocOptions): Promise<RenderedDoc>;
181
181
 
182
- declare function routeForFile(srcRelativePath: string): string;
183
- declare function outFileForRoute(route: string): string;
184
- declare function discoverPages(srcDir: string): PageEntry[];
185
182
  declare function flattenSidebar(items: SidebarItem[]): {
186
183
  text: string;
187
184
  link: string;
@@ -198,6 +195,10 @@ declare function prevNextForRoute(route: string, config: SiteConfig): {
198
195
  };
199
196
  };
200
197
 
198
+ declare function routeForFile(srcRelativePath: string): string;
199
+ declare function outFileForRoute(route: string): string;
200
+ declare function discoverPages(srcDir: string): PageEntry[];
201
+
201
202
  interface SearchResult {
202
203
  route: string;
203
204
  pageTitle: string;