@clidey/dory 0.22.0 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dory.ts +18 -4
- package/dist/dory.json +5 -0
- package/dist/favicon.svg +1 -1
- package/dist/index.html +6 -6
- package/dist/introduction.mdx +2 -2
- package/dist/llms.txt +2 -2
- package/docs/dory.json +5 -0
- package/docs/favicon.svg +1 -1
- package/docs/introduction.mdx +2 -2
- package/package.json +13 -10
- package/src/app.css +2 -0
- package/src/components/dropdown.tsx +30 -26
- package/src/components/loading.tsx +6 -8
- package/src/components/navigation.tsx +8 -6
- package/src/components/notification.tsx +9 -93
- package/src/components/routes.tsx +1 -1
- package/src/components/search.tsx +31 -104
- package/src/components/store.ts +4 -1
- package/src/main.tsx +9 -5
- package/src/mdx/accordion.tsx +21 -28
- package/src/mdx/api-playground.tsx +68 -83
- package/src/mdx/api.tsx +21 -21
- package/src/mdx/async-api.tsx +15 -31
- package/src/mdx/callout.tsx +27 -43
- package/src/mdx/card.tsx +20 -14
- package/src/mdx/code.tsx +26 -26
- package/src/mdx/expandable.tsx +21 -25
- package/src/mdx/fence.tsx +2 -2
- package/src/mdx/list.tsx +2 -2
- package/src/mdx/open-api.tsx +31 -45
- package/src/mdx/table.tsx +8 -3
- package/src/mdx/tag.tsx +27 -40
- package/src/mdx/text.tsx +3 -2
- package/src/mdx/websocket-playground.tsx +150 -81
- package/src/theme.scss +50 -106
- package/src/types/config.ts +47 -0
- package/src/ui/header.tsx +12 -9
- package/src/ui/layout.tsx +5 -4
- package/src/ui/mobile-navigation.tsx +36 -63
- package/src/ui/table-of-content.tsx +3 -3
- package/src/utils/colors.ts +54 -0
- package/src/utils/fonts.ts +4 -1
- package/vite.config.ts +2 -0
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/__vite-browser-external-BIHI7g3E.js +0 -1
- package/dist/assets/_basePickBy-CsnA5_xx.js +0 -1
- package/dist/assets/_baseUniq-COwFna6s.js +0 -1
- package/dist/assets/api-playground-demo-Ct5XK2u1.js +0 -45
- package/dist/assets/api-playground-demo-vBae5R-d.js +0 -119
- package/dist/assets/arc-Dy4kITED.js +0 -1
- package/dist/assets/architectureDiagram-IEHRJDOE-BiaWQpzt.js +0 -36
- package/dist/assets/blockDiagram-JOT3LUYC-7LfUOsM7.js +0 -121
- package/dist/assets/c4Diagram-VJAJSXHY-Ca-3deDF.js +0 -10
- package/dist/assets/channel-j6jMzwSu.js +0 -1
- package/dist/assets/chunk-4BMEZGHF-Cln31Q_z.js +0 -1
- package/dist/assets/chunk-A2AXSNBT-Cj4U7K4I.js +0 -164
- package/dist/assets/chunk-AEK57VVT-1kn9120k.js +0 -220
- package/dist/assets/chunk-D6G4REZN-DMgQaOLS.js +0 -1
- package/dist/assets/chunk-RZ5BOZE2-DDd-DrSb.js +0 -1
- package/dist/assets/chunk-XZIHB7SX-sVdgMrEr.js +0 -1
- package/dist/assets/classDiagram-GIVACNV2-B9ObtIrc.js +0 -1
- package/dist/assets/classDiagram-v2-COTLJTTW-B9ObtIrc.js +0 -1
- package/dist/assets/clone-UOttdbrS.js +0 -1
- package/dist/assets/create-D-Wjvs-T.js +0 -6
- package/dist/assets/create-DpzlgYHc.js +0 -4
- package/dist/assets/cytoscape.esm-BY7v1xhs.js +0 -331
- package/dist/assets/dagre-OKDRZEBW-C4q12sCc.js +0 -4
- package/dist/assets/delete-DwAmDeAN.js +0 -4
- package/dist/assets/delete-cbziNMWs.js +0 -5
- package/dist/assets/diagram-SSKATNLV-BxNC6sGs.js +0 -43
- package/dist/assets/diagram-VNBRO52H-CukGDk3b.js +0 -24
- package/dist/assets/dory.jpeg +0 -0
- package/dist/assets/erDiagram-Q7BY3M3F-TiiVq0dv.js +0 -60
- package/dist/assets/favicon-Z67lNtJu.svg +0 -75
- package/dist/assets/features-6EEoDloV.js +0 -269
- package/dist/assets/features-EZwrzTnN.js +0 -441
- package/dist/assets/flowDiagram-4HSFHLVR-DykkGbol.js +0 -161
- package/dist/assets/ganttDiagram-APWFNJXF-Bqp95-S3.js +0 -257
- package/dist/assets/get-BeAg4Qrr.js +0 -5
- package/dist/assets/get-Dj1eDs2i.js +0 -4
- package/dist/assets/gitGraphDiagram-7IBYFJ6S-BiYVs9VI.js +0 -65
- package/dist/assets/graph-LkKKMaDZ.js +0 -1
- package/dist/assets/index-CGd7uPvh.css +0 -1
- package/dist/assets/index-vOROtq-e.js +0 -9596
- package/dist/assets/infoDiagram-PH2N3AL5-EA7h3wZa.js +0 -2
- package/dist/assets/init-Gi6I4Gst.js +0 -1
- package/dist/assets/introduction-CzXlzjWa.js +0 -38
- package/dist/assets/introduction-ylYJcPz3.js +0 -45
- package/dist/assets/journeyDiagram-U35MCT3I-BZiVuCZu.js +0 -138
- package/dist/assets/kanban-definition-NDS4AKOZ-SCdQ8OjR.js +0 -88
- package/dist/assets/layout-C9-9-M2q.js +0 -1
- package/dist/assets/linear-CTbdhYd1.js +0 -1
- package/dist/assets/mermaid.core-DUFqLK_I.js +0 -213
- package/dist/assets/mindmap-definition-ALO5MXBD-BPbKEbjk.js +0 -95
- package/dist/assets/ordinal-Cboi1Yqb.js +0 -1
- package/dist/assets/pieDiagram-IB7DONF6-DPg1sNm8.js +0 -30
- package/dist/assets/quadrantDiagram-7GDLP6J5-DmtJM50d.js +0 -7
- package/dist/assets/radar-MK3ICKWK-DnO5LA4B.js +0 -128
- package/dist/assets/receive-chat-message-B2jsY1P6.js +0 -4
- package/dist/assets/receive-chat-message-BeaC4eqS.js +0 -5
- package/dist/assets/receive-notifications-BouRLPFj.js +0 -4
- package/dist/assets/receive-notifications-DYnXRRBz.js +0 -5
- package/dist/assets/receive-presence-update-CRgeSUpk.js +0 -5
- package/dist/assets/receive-presence-update-UEm47KAG.js +0 -4
- package/dist/assets/requirementDiagram-KVF5MWMF-iNwUJLq2.js +0 -64
- package/dist/assets/sankeyDiagram-QLVOVGJD-DWLyAD59.js +0 -10
- package/dist/assets/send-chat-message-Bvf2XJiv.js +0 -5
- package/dist/assets/send-chat-message-FDmVETeD.js +0 -4
- package/dist/assets/send-presence-update-26clGQ0z.js +0 -5
- package/dist/assets/send-presence-update-DeywSKYu.js +0 -4
- package/dist/assets/sequenceDiagram-X6HHIX6F-HyRN2_g-.js +0 -122
- package/dist/assets/stateDiagram-DGXRK772-DdMr0V93.js +0 -1
- package/dist/assets/stateDiagram-v2-YXO3MK2T-D6kpXRiR.js +0 -1
- package/dist/assets/timeline-definition-BDJGKUSR-CDf8nWgC.js +0 -61
- package/dist/assets/update-BEeNDeXY.js +0 -4
- package/dist/assets/update-CykJMYvN.js +0 -5
- package/dist/assets/websocket-playground-demo-4pj7mj19.js +0 -135
- package/dist/assets/websocket-playground-demo-F71LN60e.js +0 -61
- package/dist/assets/xychartDiagram-VJFVF3MP-BY_uTq9r.js +0 -7
- package/docs/assets/dory.jpeg +0 -0
- package/src/components/dark-mode-toggle.tsx +0 -25
- package/src/index.css +0 -24
- package/src/utils/hooks.ts +0 -46
|
@@ -17,13 +17,13 @@ import {
|
|
|
17
17
|
type JSX,
|
|
18
18
|
} from 'react'
|
|
19
19
|
import Highlighter from 'react-highlight-words'
|
|
20
|
-
|
|
21
|
-
import { useMobileNavigation } from '../ui/mobile-navigation'
|
|
22
|
-
import { useLocation } from 'wouter-preact'
|
|
20
|
+
import { cn, Spinner, SearchInput as UxSearchInput } from '@clidey/ux'
|
|
23
21
|
import classNames from 'classnames'
|
|
22
|
+
import { useLocation } from 'wouter-preact'
|
|
23
|
+
import { useMobileNavigation } from '../ui/mobile-navigation'
|
|
24
24
|
import { usePathname, useSearchParams } from './hooks'
|
|
25
|
-
import { ALL_NAVIGATION } from './store'
|
|
26
25
|
import { search } from './search-index'
|
|
26
|
+
import { ALL_NAVIGATION } from './store'
|
|
27
27
|
|
|
28
28
|
type EmptyObject = Record<string, never>
|
|
29
29
|
type Result = any;
|
|
@@ -89,58 +89,6 @@ function useAutocomplete({ onNavigate }: { onNavigate: () => void }) {
|
|
|
89
89
|
return { autocomplete, autocompleteState }
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
function SearchIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
|
|
93
|
-
return (
|
|
94
|
-
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" {...props}>
|
|
95
|
-
<path
|
|
96
|
-
strokeLinecap="round"
|
|
97
|
-
strokeLinejoin="round"
|
|
98
|
-
d="M12.01 12a4.25 4.25 0 1 0-6.02-6 4.25 4.25 0 0 0 6.02 6Zm0 0 3.24 3.25"
|
|
99
|
-
/>
|
|
100
|
-
</svg>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function NoResultsIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
|
|
105
|
-
return (
|
|
106
|
-
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" {...props}>
|
|
107
|
-
<path
|
|
108
|
-
strokeLinecap="round"
|
|
109
|
-
strokeLinejoin="round"
|
|
110
|
-
d="M12.01 12a4.237 4.237 0 0 0 1.24-3c0-.62-.132-1.207-.37-1.738M12.01 12A4.237 4.237 0 0 1 9 13.25c-.635 0-1.237-.14-1.777-.388M12.01 12l3.24 3.25m-3.715-9.661a4.25 4.25 0 0 0-5.975 5.908M4.5 15.5l11-11"
|
|
111
|
-
/>
|
|
112
|
-
</svg>
|
|
113
|
-
)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function LoadingIcon(props: React.ComponentPropsWithoutRef<'svg'>) {
|
|
117
|
-
const id = useId()
|
|
118
|
-
|
|
119
|
-
return (
|
|
120
|
-
<svg viewBox="0 0 20 20" fill="none" aria-hidden="true" {...props}>
|
|
121
|
-
<circle cx="10" cy="10" r="5.5" strokeLinejoin="round" />
|
|
122
|
-
<path
|
|
123
|
-
stroke={`url(#${id})`}
|
|
124
|
-
strokeLinecap="round"
|
|
125
|
-
strokeLinejoin="round"
|
|
126
|
-
d="M15.5 10a5.5 5.5 0 1 0-5.5 5.5"
|
|
127
|
-
/>
|
|
128
|
-
<defs>
|
|
129
|
-
<linearGradient
|
|
130
|
-
id={id}
|
|
131
|
-
x1="13"
|
|
132
|
-
x2="9.5"
|
|
133
|
-
y1="9"
|
|
134
|
-
y2="15"
|
|
135
|
-
gradientUnits="userSpaceOnUse"
|
|
136
|
-
>
|
|
137
|
-
<stop stopColor="currentColor" />
|
|
138
|
-
<stop offset="1" stopColor="currentColor" stopOpacity="0" />
|
|
139
|
-
</linearGradient>
|
|
140
|
-
</defs>
|
|
141
|
-
</svg>
|
|
142
|
-
)
|
|
143
|
-
}
|
|
144
92
|
|
|
145
93
|
function HighlightQuery({ text, query }: { text: string; query: string }) {
|
|
146
94
|
return (
|
|
@@ -155,13 +103,11 @@ function HighlightQuery({ text, query }: { text: string; query: string }) {
|
|
|
155
103
|
|
|
156
104
|
function SearchResult({
|
|
157
105
|
result,
|
|
158
|
-
resultIndex,
|
|
159
106
|
autocomplete,
|
|
160
107
|
collection,
|
|
161
108
|
query,
|
|
162
109
|
}: {
|
|
163
110
|
result: Result
|
|
164
|
-
resultIndex: number
|
|
165
111
|
autocomplete: Autocomplete
|
|
166
112
|
collection: AutocompleteCollection<Result>
|
|
167
113
|
query: string
|
|
@@ -190,9 +136,6 @@ function SearchResult({
|
|
|
190
136
|
<li
|
|
191
137
|
className={classNames(
|
|
192
138
|
'group block cursor-default px-4 py-3 aria-selected:bg-zinc-50 dark:aria-selected:bg-zinc-800/50',
|
|
193
|
-
{
|
|
194
|
-
'border-t border-zinc-100 dark:border-zinc-800': resultIndex > 0,
|
|
195
|
-
}
|
|
196
139
|
)}
|
|
197
140
|
aria-labelledby={`${id}-hierarchy ${id}-title`}
|
|
198
141
|
{...autocomplete.getItemProps({
|
|
@@ -245,7 +188,13 @@ function SearchResults({
|
|
|
245
188
|
if (collection.items.length === 0) {
|
|
246
189
|
return (
|
|
247
190
|
<div className="p-6 text-center">
|
|
248
|
-
<
|
|
191
|
+
<svg className="mx-auto h-5 w-5 stroke-zinc-900 dark:stroke-zinc-600" viewBox="0 0 20 20" fill="none" aria-hidden="true">
|
|
192
|
+
<path
|
|
193
|
+
strokeLinecap="round"
|
|
194
|
+
strokeLinejoin="round"
|
|
195
|
+
d="M12.01 12a4.237 4.237 0 0 0 1.24-3c0-.62-.132-1.207-.37-1.738M12.01 12A4.237 4.237 0 0 1 9 13.25c-.635 0-1.237-.14-1.777-.388M12.01 12l3.24 3.25m-3.715-9.661a4.25 4.25 0 0 0-5.975 5.908M4.5 15.5l11-11"
|
|
196
|
+
/>
|
|
197
|
+
</svg>
|
|
249
198
|
<p className="mt-2 text-xs text-zinc-700 dark:text-zinc-400">
|
|
250
199
|
Nothing found for{' '}
|
|
251
200
|
<strong className="font-semibold break-words text-zinc-900 dark:text-white">
|
|
@@ -259,11 +208,10 @@ function SearchResults({
|
|
|
259
208
|
|
|
260
209
|
return (
|
|
261
210
|
<ul {...autocomplete.getListProps()}>
|
|
262
|
-
{collection.items.map((result
|
|
211
|
+
{collection.items.map((result) => (
|
|
263
212
|
<SearchResult
|
|
264
213
|
key={result.url}
|
|
265
214
|
result={result}
|
|
266
|
-
resultIndex={resultIndex}
|
|
267
215
|
autocomplete={autocomplete}
|
|
268
216
|
collection={collection}
|
|
269
217
|
query={query}
|
|
@@ -284,18 +232,14 @@ const SearchInput = forwardRef<
|
|
|
284
232
|
const inputProps = autocomplete.getInputProps({ inputElement: null })
|
|
285
233
|
|
|
286
234
|
return (
|
|
287
|
-
<div className="group relative flex
|
|
288
|
-
<
|
|
289
|
-
<input
|
|
235
|
+
<div className="group relative flex">
|
|
236
|
+
<UxSearchInput
|
|
290
237
|
ref={inputRef}
|
|
291
238
|
data-autofocus
|
|
292
|
-
className={
|
|
293
|
-
'flex-auto appearance-none bg-transparent pl-10 text-zinc-900 outline-hidden placeholder:text-zinc-500 focus:w-full focus:flex-none sm:text-sm dark:text-white [&::-webkit-search-cancel-button]:hidden [&::-webkit-search-decoration]:hidden [&::-webkit-search-results-button]:hidden [&::-webkit-search-results-decoration]:hidden',
|
|
294
|
-
{
|
|
239
|
+
className={cn({
|
|
295
240
|
'pr-11': autocompleteState.status === 'stalled',
|
|
296
241
|
'pr-4': autocompleteState.status !== 'stalled',
|
|
297
|
-
|
|
298
|
-
)}
|
|
242
|
+
})}
|
|
299
243
|
{...inputProps}
|
|
300
244
|
onKeyDown={(event) => {
|
|
301
245
|
if (
|
|
@@ -317,7 +261,7 @@ const SearchInput = forwardRef<
|
|
|
317
261
|
/>
|
|
318
262
|
{autocompleteState.status === 'stalled' && (
|
|
319
263
|
<div className="absolute inset-y-0 right-3 flex items-center">
|
|
320
|
-
<
|
|
264
|
+
<Spinner className="h-5 w-5 animate-spin stroke-zinc-200 text-zinc-900 dark:stroke-zinc-800 dark:text-emerald-400" />
|
|
321
265
|
</div>
|
|
322
266
|
)}
|
|
323
267
|
</div>
|
|
@@ -424,12 +368,12 @@ function SearchDialog({
|
|
|
424
368
|
}
|
|
425
369
|
|
|
426
370
|
function useSearchProps() {
|
|
427
|
-
const
|
|
371
|
+
const inputRef = useRef<React.ElementRef<typeof SearchInput>>(null)
|
|
428
372
|
const [open, setOpen] = useState(false)
|
|
429
373
|
|
|
430
374
|
return {
|
|
431
|
-
|
|
432
|
-
ref:
|
|
375
|
+
inputProps: {
|
|
376
|
+
ref: inputRef,
|
|
433
377
|
onClick() {
|
|
434
378
|
setOpen(true)
|
|
435
379
|
},
|
|
@@ -439,7 +383,7 @@ function useSearchProps() {
|
|
|
439
383
|
setOpen: useCallback(
|
|
440
384
|
(open: boolean) => {
|
|
441
385
|
const { width = 0, height = 0 } =
|
|
442
|
-
|
|
386
|
+
inputRef.current?.getBoundingClientRect?.() ?? {}
|
|
443
387
|
if (!open || (width !== 0 && height !== 0)) {
|
|
444
388
|
setOpen(open)
|
|
445
389
|
}
|
|
@@ -451,29 +395,15 @@ function useSearchProps() {
|
|
|
451
395
|
}
|
|
452
396
|
|
|
453
397
|
export function Search() {
|
|
454
|
-
const
|
|
455
|
-
const { buttonProps, dialogProps } = useSearchProps()
|
|
456
|
-
|
|
457
|
-
useEffect(() => {
|
|
458
|
-
setModifierKey(
|
|
459
|
-
/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform) ? '⌘' : 'Ctrl ',
|
|
460
|
-
)
|
|
461
|
-
}, [])
|
|
398
|
+
const { inputProps: buttonProps, dialogProps } = useSearchProps()
|
|
462
399
|
|
|
463
400
|
return (
|
|
464
401
|
<div className="hidden lg:block lg:max-w-md lg:flex-auto">
|
|
465
|
-
<
|
|
466
|
-
|
|
467
|
-
|
|
402
|
+
<UxSearchInput
|
|
403
|
+
aria-label="Find something..."
|
|
404
|
+
placeholder="Find something..."
|
|
468
405
|
{...buttonProps}
|
|
469
|
-
|
|
470
|
-
<SearchIcon className="h-5 w-5 stroke-current" />
|
|
471
|
-
Can I help you find something?
|
|
472
|
-
<kbd className="ml-auto text-2xs text-zinc-400 dark:text-zinc-500">
|
|
473
|
-
<kbd className="font-sans">{modifierKey}</kbd>
|
|
474
|
-
<kbd className="font-sans">K</kbd>
|
|
475
|
-
</kbd>
|
|
476
|
-
</button>
|
|
406
|
+
/>
|
|
477
407
|
<Suspense fallback={null}>
|
|
478
408
|
<SearchDialog className="hidden lg:block" {...dialogProps} />
|
|
479
409
|
</Suspense>
|
|
@@ -483,19 +413,16 @@ export function Search() {
|
|
|
483
413
|
|
|
484
414
|
export function MobileSearch() {
|
|
485
415
|
const { close } = useMobileNavigation()
|
|
486
|
-
const { buttonProps, dialogProps } = useSearchProps()
|
|
416
|
+
const { inputProps: buttonProps, dialogProps } = useSearchProps()
|
|
487
417
|
|
|
488
418
|
return (
|
|
489
419
|
<div className="contents lg:hidden">
|
|
490
|
-
<
|
|
491
|
-
|
|
492
|
-
className="relative flex size-6 items-center justify-center rounded-md transition hover:bg-zinc-900/5 lg:hidden dark:hover:bg-white/5"
|
|
420
|
+
<UxSearchInput
|
|
421
|
+
className="text-sm"
|
|
493
422
|
aria-label="Find something..."
|
|
494
423
|
{...buttonProps}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
<SearchIcon className="h-8 w-8 stroke-zinc-900 dark:stroke-white" />
|
|
498
|
-
</button>
|
|
424
|
+
placeholder="Find something..."
|
|
425
|
+
/>
|
|
499
426
|
<Suspense fallback={null}>
|
|
500
427
|
<SearchDialog
|
|
501
428
|
className="lg:hidden"
|
package/src/components/store.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { ComponentType } from 'preact';
|
|
2
2
|
import { type RouteComponentProps } from 'wouter-preact';
|
|
3
3
|
import docsConfig from '../../docs/dory.json';
|
|
4
|
+
import type { DoryConfig } from '../types/config';
|
|
4
5
|
import { searchIndex } from './search-index';
|
|
5
6
|
|
|
7
|
+
const config = docsConfig as DoryConfig;
|
|
8
|
+
|
|
6
9
|
export const ALL_PAGES = Object.fromEntries(
|
|
7
10
|
Object.entries(import.meta.glob<{ default: ComponentType; }>('../../docs/**/*.mdx'))
|
|
8
11
|
.map(([path, loader]) => [pathFromFilename(path), loader])
|
|
@@ -34,7 +37,7 @@ export interface Navigation {
|
|
|
34
37
|
}>;
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
export const ALL_NAVIGATION: Navigation[] =
|
|
40
|
+
export const ALL_NAVIGATION: Navigation[] = config.navigation.tabs.map(tab => ({
|
|
38
41
|
title: tab.tab,
|
|
39
42
|
groups: tab.groups.map(group => ({
|
|
40
43
|
title: group.group,
|
package/src/main.tsx
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import { render } from 'preact'
|
|
2
|
-
import '
|
|
2
|
+
import '@clidey/ux/styles.css';
|
|
3
3
|
import { App } from './app.tsx'
|
|
4
4
|
import { withMDX } from './components/mdx-provider.tsx'
|
|
5
5
|
import { loadFonts } from './utils/fonts'
|
|
6
|
-
import {
|
|
6
|
+
import { loadColors } from './utils/colors'
|
|
7
|
+
import { Toaster } from '@clidey/ux'
|
|
8
|
+
import { ThemeProvider } from '@clidey/ux'
|
|
7
9
|
|
|
8
|
-
// Load fonts before rendering the app
|
|
10
|
+
// Load fonts and colors before rendering the app
|
|
9
11
|
loadFonts()
|
|
12
|
+
loadColors()
|
|
10
13
|
|
|
11
14
|
const AppWithMDX = withMDX(App)
|
|
12
15
|
|
|
13
16
|
render(
|
|
14
|
-
<
|
|
17
|
+
<ThemeProvider storageKey="@clidey/dory/theme">
|
|
18
|
+
<Toaster />
|
|
15
19
|
<AppWithMDX />
|
|
16
|
-
</
|
|
20
|
+
</ThemeProvider>,
|
|
17
21
|
document.getElementById('app')!
|
|
18
22
|
)
|
package/src/mdx/accordion.tsx
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
Accordion as UXAccordion,
|
|
3
|
+
AccordionItem,
|
|
4
|
+
AccordionTrigger,
|
|
5
|
+
AccordionContent
|
|
6
|
+
} from '@clidey/ux'
|
|
3
7
|
import { Icon } from './icon'
|
|
4
8
|
|
|
5
9
|
export function AccordionGroup({ children }: { children: React.ReactNode }) {
|
|
6
10
|
return (
|
|
7
|
-
<
|
|
11
|
+
<UXAccordion type="single" collapsible className="my-6">
|
|
8
12
|
{children}
|
|
9
|
-
</
|
|
13
|
+
</UXAccordion>
|
|
10
14
|
)
|
|
11
15
|
}
|
|
12
16
|
|
|
@@ -20,29 +24,18 @@ export function Accordion({
|
|
|
20
24
|
icon?: React.ComponentProps<typeof Icon>['icon']
|
|
21
25
|
}) {
|
|
22
26
|
return (
|
|
23
|
-
<
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
)}
|
|
37
|
-
</span>
|
|
38
|
-
</DisclosureButton>
|
|
39
|
-
<DisclosurePanel as="dd" className="mt-2 pr-12">
|
|
40
|
-
<div className="text-base text-slate-600 dark:text-slate-400 leading-relaxed">
|
|
41
|
-
{children}
|
|
42
|
-
</div>
|
|
43
|
-
</DisclosurePanel>
|
|
44
|
-
</>
|
|
45
|
-
)}
|
|
46
|
-
</Disclosure>
|
|
27
|
+
<AccordionItem value={title}>
|
|
28
|
+
<AccordionTrigger className="text-left">
|
|
29
|
+
<div className="flex items-center gap-2">
|
|
30
|
+
{icon && <Icon icon={icon} className="h-5 w-5" />}
|
|
31
|
+
<span className="text-base font-semibold">{title}</span>
|
|
32
|
+
</div>
|
|
33
|
+
</AccordionTrigger>
|
|
34
|
+
<AccordionContent>
|
|
35
|
+
<div className="text-base leading-relaxed">
|
|
36
|
+
{children}
|
|
37
|
+
</div>
|
|
38
|
+
</AccordionContent>
|
|
39
|
+
</AccordionItem>
|
|
47
40
|
)
|
|
48
41
|
}
|