@dogsbay/ui 0.2.0-beta.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.
Files changed (322) hide show
  1. package/package.json +38 -0
  2. package/src/accordion/Accordion.astro +38 -0
  3. package/src/accordion/AccordionContent.astro +25 -0
  4. package/src/accordion/AccordionItem.astro +26 -0
  5. package/src/accordion/AccordionTrigger.astro +38 -0
  6. package/src/accordion/accordion.ts +189 -0
  7. package/src/accordion/index.ts +4 -0
  8. package/src/alert/Alert.astro +69 -0
  9. package/src/alert/AlertDescription.astro +17 -0
  10. package/src/alert/AlertTitle.astro +21 -0
  11. package/src/alert/CollapsibleAlert.astro +103 -0
  12. package/src/alert/icon.ts +32 -0
  13. package/src/alert/index.ts +4 -0
  14. package/src/alert/variants.ts +29 -0
  15. package/src/alert-dialog/AlertDialog.astro +16 -0
  16. package/src/alert-dialog/AlertDialogAction.astro +23 -0
  17. package/src/alert-dialog/AlertDialogCancel.astro +23 -0
  18. package/src/alert-dialog/AlertDialogContent.astro +37 -0
  19. package/src/alert-dialog/AlertDialogDescription.astro +18 -0
  20. package/src/alert-dialog/AlertDialogFooter.astro +18 -0
  21. package/src/alert-dialog/AlertDialogHeader.astro +18 -0
  22. package/src/alert-dialog/AlertDialogTitle.astro +18 -0
  23. package/src/alert-dialog/AlertDialogTrigger.astro +24 -0
  24. package/src/alert-dialog/alert-dialog.ts +154 -0
  25. package/src/alert-dialog/index.ts +9 -0
  26. package/src/api-doc/ApiDoc.astro +52 -0
  27. package/src/api-doc/index.ts +1 -0
  28. package/src/api-layout/ApiCodePanel.astro +21 -0
  29. package/src/api-layout/ApiLayout.astro +29 -0
  30. package/src/api-layout/ExampleBlock.astro +63 -0
  31. package/src/api-params/ApiParams.astro +96 -0
  32. package/src/api-params/index.ts +1 -0
  33. package/src/api-source/ApiSource.astro +20 -0
  34. package/src/api-source/api-source.css +32 -0
  35. package/src/api-source/index.ts +1 -0
  36. package/src/api-symbol/ApiSymbol.astro +48 -0
  37. package/src/api-symbol/api-symbol.css +89 -0
  38. package/src/api-symbol/index.ts +1 -0
  39. package/src/api-url-bar/ApiUrlBar.astro +63 -0
  40. package/src/avatar/Avatar.astro +57 -0
  41. package/src/avatar/index.ts +1 -0
  42. package/src/badge/Badge.astro +37 -0
  43. package/src/badge/index.ts +1 -0
  44. package/src/breadcrumb/Breadcrumb.astro +32 -0
  45. package/src/breadcrumb/BreadcrumbEllipsis.astro +32 -0
  46. package/src/breadcrumb/BreadcrumbItem.astro +41 -0
  47. package/src/breadcrumb/BreadcrumbSeparator.astro +33 -0
  48. package/src/breadcrumb/index.ts +4 -0
  49. package/src/button/Button.astro +70 -0
  50. package/src/button/index.ts +1 -0
  51. package/src/card/Card.astro +17 -0
  52. package/src/card/CardContent.astro +17 -0
  53. package/src/card/CardDescription.astro +17 -0
  54. package/src/card/CardFooter.astro +17 -0
  55. package/src/card/CardHeader.astro +17 -0
  56. package/src/card/CardTitle.astro +17 -0
  57. package/src/card/index.ts +6 -0
  58. package/src/checkbox/Checkbox.astro +70 -0
  59. package/src/checkbox/index.ts +1 -0
  60. package/src/checkbox-group/CheckboxGroup.astro +38 -0
  61. package/src/checkbox-group/checkbox-group.ts +53 -0
  62. package/src/checkbox-group/index.ts +1 -0
  63. package/src/code-block/CodeBlock.astro +160 -0
  64. package/src/code-rich/CodeRich.astro +267 -0
  65. package/src/code-rich/code-rich.css +68 -0
  66. package/src/code-rich/index.ts +1 -0
  67. package/src/code-samples/CodeSamples.astro +59 -0
  68. package/src/collapsible/Collapsible.astro +35 -0
  69. package/src/collapsible/CollapsibleContent.astro +24 -0
  70. package/src/collapsible/CollapsibleTrigger.astro +23 -0
  71. package/src/collapsible/collapsible.ts +42 -0
  72. package/src/collapsible/index.ts +3 -0
  73. package/src/combobox/Combobox.astro +53 -0
  74. package/src/combobox/ComboboxEmpty.astro +18 -0
  75. package/src/combobox/ComboboxItem.astro +28 -0
  76. package/src/combobox/combobox.ts +179 -0
  77. package/src/combobox/index.ts +3 -0
  78. package/src/command/Command.astro +22 -0
  79. package/src/command/CommandEmpty.astro +18 -0
  80. package/src/command/CommandGroup.astro +24 -0
  81. package/src/command/CommandInput.astro +49 -0
  82. package/src/command/CommandItem.astro +26 -0
  83. package/src/command/CommandList.astro +19 -0
  84. package/src/command/CommandSeparator.astro +16 -0
  85. package/src/command/CommandShortcut.astro +18 -0
  86. package/src/command/command.ts +212 -0
  87. package/src/command/index.ts +8 -0
  88. package/src/content-renderer/ContentRenderer.astro +410 -0
  89. package/src/content-renderer/InlineRenderer.astro +149 -0
  90. package/src/context-menu/ContextMenu.astro +22 -0
  91. package/src/context-menu/ContextMenuContent.astro +24 -0
  92. package/src/context-menu/ContextMenuItem.astro +49 -0
  93. package/src/context-menu/ContextMenuSeparator.astro +14 -0
  94. package/src/context-menu/ContextMenuShortcut.astro +14 -0
  95. package/src/context-menu/ContextMenuTrigger.astro +22 -0
  96. package/src/context-menu/context-menu.ts +238 -0
  97. package/src/context-menu/index.ts +6 -0
  98. package/src/copy-button/CopyButton.astro +88 -0
  99. package/src/copy-button/index.ts +1 -0
  100. package/src/diagram/Diagram.astro +15 -0
  101. package/src/diagram/index.ts +1 -0
  102. package/src/dialog/Dialog.astro +22 -0
  103. package/src/dialog/DialogClose.astro +32 -0
  104. package/src/dialog/DialogContent.astro +37 -0
  105. package/src/dialog/DialogDescription.astro +22 -0
  106. package/src/dialog/DialogFooter.astro +18 -0
  107. package/src/dialog/DialogHeader.astro +18 -0
  108. package/src/dialog/DialogTitle.astro +18 -0
  109. package/src/dialog/DialogTrigger.astro +33 -0
  110. package/src/dialog/dialog.ts +291 -0
  111. package/src/dialog/index.ts +8 -0
  112. package/src/docs-footer/DocsFooter.astro +50 -0
  113. package/src/docs-header/DocsHeader.astro +32 -0
  114. package/src/docs-layout/DocsLayout.astro +187 -0
  115. package/src/docs-layout/index.ts +1 -0
  116. package/src/drawer/Drawer.astro +12 -0
  117. package/src/drawer/DrawerClose.astro +12 -0
  118. package/src/drawer/DrawerContent.astro +46 -0
  119. package/src/drawer/DrawerDescription.astro +10 -0
  120. package/src/drawer/DrawerFooter.astro +10 -0
  121. package/src/drawer/DrawerHandle.astro +16 -0
  122. package/src/drawer/DrawerHeader.astro +10 -0
  123. package/src/drawer/DrawerTitle.astro +10 -0
  124. package/src/drawer/DrawerTrigger.astro +25 -0
  125. package/src/drawer/drawer.ts +262 -0
  126. package/src/drawer/index.ts +9 -0
  127. package/src/dropdown-menu/DropdownMenu.astro +22 -0
  128. package/src/dropdown-menu/DropdownMenuContent.astro +33 -0
  129. package/src/dropdown-menu/DropdownMenuGroup.astro +17 -0
  130. package/src/dropdown-menu/DropdownMenuItem.astro +48 -0
  131. package/src/dropdown-menu/DropdownMenuLabel.astro +28 -0
  132. package/src/dropdown-menu/DropdownMenuSeparator.astro +21 -0
  133. package/src/dropdown-menu/DropdownMenuShortcut.astro +18 -0
  134. package/src/dropdown-menu/DropdownMenuTrigger.astro +34 -0
  135. package/src/dropdown-menu/dropdown-menu.ts +348 -0
  136. package/src/dropdown-menu/index.ts +8 -0
  137. package/src/endpoint-card/EndpointCard.astro +60 -0
  138. package/src/endpoint-card/EndpointCardSection.astro +22 -0
  139. package/src/endpoint-card/EndpointSection.astro +35 -0
  140. package/src/field/Field.astro +31 -0
  141. package/src/field/FieldDescription.astro +22 -0
  142. package/src/field/FieldLabel.astro +24 -0
  143. package/src/field/field.ts +61 -0
  144. package/src/field/index.ts +3 -0
  145. package/src/fieldset/Fieldset.astro +24 -0
  146. package/src/fieldset/FieldsetLegend.astro +18 -0
  147. package/src/fieldset/index.ts +2 -0
  148. package/src/footnote/Footnote.astro +37 -0
  149. package/src/footnote/footnote.ts +79 -0
  150. package/src/footnote/index.ts +1 -0
  151. package/src/form/Form.astro +27 -0
  152. package/src/form/form.ts +160 -0
  153. package/src/form/index.ts +1 -0
  154. package/src/grid/Grid.astro +117 -0
  155. package/src/grid/GridItem.astro +95 -0
  156. package/src/grid/index.ts +2 -0
  157. package/src/image/Image.astro +115 -0
  158. package/src/image/index.ts +1 -0
  159. package/src/input/Input.astro +34 -0
  160. package/src/input/index.ts +1 -0
  161. package/src/kbd/Kbd.astro +17 -0
  162. package/src/kbd/index.ts +1 -0
  163. package/src/label/Label.astro +17 -0
  164. package/src/label/index.ts +1 -0
  165. package/src/link-card/LinkCard.astro +47 -0
  166. package/src/link-card/index.ts +1 -0
  167. package/src/map-view/MapView.astro +88 -0
  168. package/src/map-view/index.ts +1 -0
  169. package/src/map-view/map-view.ts +194 -0
  170. package/src/markdown-example/MarkdownExample.astro +138 -0
  171. package/src/markdown-example/index.ts +1 -0
  172. package/src/math/MathKatex.astro +35 -0
  173. package/src/math/index.ts +1 -0
  174. package/src/menubar/Menubar.astro +25 -0
  175. package/src/menubar/MenubarContent.astro +24 -0
  176. package/src/menubar/MenubarItem.astro +26 -0
  177. package/src/menubar/MenubarMenu.astro +12 -0
  178. package/src/menubar/MenubarSeparator.astro +11 -0
  179. package/src/menubar/MenubarShortcut.astro +11 -0
  180. package/src/menubar/MenubarTrigger.astro +27 -0
  181. package/src/menubar/index.ts +7 -0
  182. package/src/menubar/menubar.ts +258 -0
  183. package/src/meter/Meter.astro +75 -0
  184. package/src/meter/index.ts +1 -0
  185. package/src/method-badge/MethodBadge.astro +32 -0
  186. package/src/navigation-menu/NavigationMenu.astro +24 -0
  187. package/src/navigation-menu/NavigationMenuContent.astro +24 -0
  188. package/src/navigation-menu/NavigationMenuItem.astro +22 -0
  189. package/src/navigation-menu/NavigationMenuLink.astro +26 -0
  190. package/src/navigation-menu/NavigationMenuList.astro +22 -0
  191. package/src/navigation-menu/NavigationMenuTrigger.astro +40 -0
  192. package/src/navigation-menu/index.ts +6 -0
  193. package/src/navigation-menu/navigation-menu.ts +192 -0
  194. package/src/number-field/NumberField.astro +84 -0
  195. package/src/number-field/index.ts +1 -0
  196. package/src/number-field/number-field.ts +68 -0
  197. package/src/pagination/Pagination.astro +59 -0
  198. package/src/pagination/index.ts +1 -0
  199. package/src/parameter-table/ParameterTable.astro +75 -0
  200. package/src/popover/Popover.astro +21 -0
  201. package/src/popover/PopoverContent.astro +31 -0
  202. package/src/popover/PopoverTrigger.astro +31 -0
  203. package/src/popover/index.ts +3 -0
  204. package/src/popover/popover.ts +144 -0
  205. package/src/preview-card/PreviewCard.astro +24 -0
  206. package/src/preview-card/PreviewCardContent.astro +24 -0
  207. package/src/preview-card/PreviewCardTrigger.astro +23 -0
  208. package/src/preview-card/index.ts +3 -0
  209. package/src/preview-card/preview-card.ts +91 -0
  210. package/src/progress/Progress.astro +61 -0
  211. package/src/progress/index.ts +1 -0
  212. package/src/property-item/PropertyItem.astro +183 -0
  213. package/src/property-list/PropertyList.astro +68 -0
  214. package/src/radio-group/RadioGroup.astro +41 -0
  215. package/src/radio-group/RadioGroupItem.astro +36 -0
  216. package/src/radio-group/index.ts +2 -0
  217. package/src/radio-group/radio-group.ts +126 -0
  218. package/src/response-tabs/ResponseTabs.astro +60 -0
  219. package/src/schema-viewer/SchemaViewer.astro +42 -0
  220. package/src/scroll-area/ScrollArea.astro +44 -0
  221. package/src/scroll-area/index.ts +1 -0
  222. package/src/scroll-area/scroll-area.ts +176 -0
  223. package/src/select/Select.astro +34 -0
  224. package/src/select/SelectContent.astro +24 -0
  225. package/src/select/SelectGroup.astro +23 -0
  226. package/src/select/SelectItem.astro +28 -0
  227. package/src/select/SelectLabel.astro +18 -0
  228. package/src/select/SelectSeparator.astro +22 -0
  229. package/src/select/SelectTrigger.astro +28 -0
  230. package/src/select/SelectValue.astro +18 -0
  231. package/src/select/index.ts +8 -0
  232. package/src/select/select.ts +381 -0
  233. package/src/separator/Separator.astro +35 -0
  234. package/src/separator/index.ts +1 -0
  235. package/src/sheet/Sheet.astro +12 -0
  236. package/src/sheet/SheetClose.astro +35 -0
  237. package/src/sheet/SheetContent.astro +52 -0
  238. package/src/sheet/SheetDescription.astro +18 -0
  239. package/src/sheet/SheetFooter.astro +18 -0
  240. package/src/sheet/SheetHeader.astro +18 -0
  241. package/src/sheet/SheetTitle.astro +18 -0
  242. package/src/sheet/SheetTrigger.astro +32 -0
  243. package/src/sheet/index.ts +8 -0
  244. package/src/sheet/sheet.ts +173 -0
  245. package/src/sidebar/Sidebar.astro +113 -0
  246. package/src/sidebar/SidebarContent.astro +18 -0
  247. package/src/sidebar/SidebarFooter.astro +18 -0
  248. package/src/sidebar/SidebarGroup.astro +18 -0
  249. package/src/sidebar/SidebarGroupContent.astro +18 -0
  250. package/src/sidebar/SidebarGroupLabel.astro +18 -0
  251. package/src/sidebar/SidebarHeader.astro +18 -0
  252. package/src/sidebar/SidebarInset.astro +18 -0
  253. package/src/sidebar/SidebarMenu.astro +18 -0
  254. package/src/sidebar/SidebarMenuBadge.astro +18 -0
  255. package/src/sidebar/SidebarMenuButton.astro +71 -0
  256. package/src/sidebar/SidebarMenuItem.astro +18 -0
  257. package/src/sidebar/SidebarMenuSub.astro +18 -0
  258. package/src/sidebar/SidebarMenuSubButton.astro +45 -0
  259. package/src/sidebar/SidebarMenuSubItem.astro +12 -0
  260. package/src/sidebar/SidebarNavTree.astro +106 -0
  261. package/src/sidebar/SidebarProvider.astro +23 -0
  262. package/src/sidebar/SidebarRail.astro +25 -0
  263. package/src/sidebar/SidebarSeparator.astro +21 -0
  264. package/src/sidebar/SidebarTrigger.astro +40 -0
  265. package/src/sidebar/index.ts +19 -0
  266. package/src/sidebar/sidebar.ts +265 -0
  267. package/src/skeleton/Skeleton.astro +16 -0
  268. package/src/skeleton/index.ts +1 -0
  269. package/src/skip-link/SkipLink.astro +24 -0
  270. package/src/slider/Slider.astro +61 -0
  271. package/src/slider/index.ts +1 -0
  272. package/src/slider/slider.ts +111 -0
  273. package/src/spinner/Spinner.astro +54 -0
  274. package/src/spinner/index.ts +1 -0
  275. package/src/steps/Step.astro +16 -0
  276. package/src/steps/Steps.astro +122 -0
  277. package/src/steps/SubSteps.astro +73 -0
  278. package/src/switch/Switch.astro +52 -0
  279. package/src/switch/index.ts +1 -0
  280. package/src/switch/switch.ts +109 -0
  281. package/src/table/Table.astro +24 -0
  282. package/src/table/TableBody.astro +18 -0
  283. package/src/table/TableCaption.astro +18 -0
  284. package/src/table/TableCell.astro +18 -0
  285. package/src/table/TableFooter.astro +18 -0
  286. package/src/table/TableHead.astro +18 -0
  287. package/src/table/TableHeader.astro +18 -0
  288. package/src/table/TableRow.astro +18 -0
  289. package/src/table/index.ts +8 -0
  290. package/src/tabs/Tabs.astro +37 -0
  291. package/src/tabs/TabsContent.astro +32 -0
  292. package/src/tabs/TabsList.astro +23 -0
  293. package/src/tabs/TabsTrigger.astro +29 -0
  294. package/src/tabs/index.ts +4 -0
  295. package/src/tabs/tabs.ts +220 -0
  296. package/src/textarea/Textarea.astro +25 -0
  297. package/src/textarea/index.ts +1 -0
  298. package/src/theme-toggle/ThemeToggle.astro +67 -0
  299. package/src/theme-toggle/index.ts +1 -0
  300. package/src/toast/Toaster.astro +39 -0
  301. package/src/toast/index.ts +3 -0
  302. package/src/toast/toast.ts +104 -0
  303. package/src/toc/TableOfContents.astro +225 -0
  304. package/src/toggle/Toggle.astro +56 -0
  305. package/src/toggle/index.ts +1 -0
  306. package/src/toggle/toggle.ts +38 -0
  307. package/src/toggle-group/ToggleGroup.astro +39 -0
  308. package/src/toggle-group/ToggleGroupItem.astro +56 -0
  309. package/src/toggle-group/index.ts +2 -0
  310. package/src/toggle-group/toggle-group.ts +121 -0
  311. package/src/toolbar/Toolbar.astro +26 -0
  312. package/src/toolbar/ToolbarButton.astro +29 -0
  313. package/src/toolbar/ToolbarSeparator.astro +14 -0
  314. package/src/toolbar/index.ts +3 -0
  315. package/src/toolbar/toolbar.ts +65 -0
  316. package/src/tooltip/Tooltip.astro +21 -0
  317. package/src/tooltip/TooltipContent.astro +25 -0
  318. package/src/tooltip/TooltipTrigger.astro +31 -0
  319. package/src/tooltip/index.ts +3 -0
  320. package/src/tooltip/tooltip.ts +156 -0
  321. package/src/youtube/YouTube.astro +119 -0
  322. package/src/youtube/index.ts +1 -0
@@ -0,0 +1,115 @@
1
+ ---
2
+ /**
3
+ * Image component — renders optimized images via Astro's Image component
4
+ * when imageData (from import.meta.glob) is available, falls back to <img>.
5
+ *
6
+ * Block mode wraps in <figure> with optional caption.
7
+ * Supports alignment (float-left, float-right, center).
8
+ */
9
+ import { Image as AstroImage } from "astro:assets";
10
+
11
+ interface Props {
12
+ src: string;
13
+ alt?: string;
14
+ title?: string;
15
+ width?: number;
16
+ height?: number;
17
+ /** Resolved ImageMetadata from import.meta.glob (enables Astro optimization) */
18
+ imageData?: ImageMetadata;
19
+ /** Render as block-level <figure> with optional caption */
20
+ block?: boolean;
21
+ /** Caption text (uses title if not provided) */
22
+ caption?: string;
23
+ /** Alignment: left, right, center */
24
+ align?: "left" | "right" | "center";
25
+ class?: string;
26
+ }
27
+
28
+ // Spread `...rest` so plugins can attach arbitrary `data-*` /
29
+ // `aria-*` attrs at the BlockImage call site and have them
30
+ // forwarded onto the inner <img> tag (e.g.
31
+ // @dogsbay/plugin-image-zoom adds `data-zoomable="true"`).
32
+ const {
33
+ src,
34
+ alt = "",
35
+ title,
36
+ width,
37
+ height,
38
+ imageData,
39
+ block = false,
40
+ caption,
41
+ align,
42
+ class: className,
43
+ ...rest
44
+ } = Astro.props as Props & Record<string, unknown>;
45
+
46
+ const captionText = caption || title;
47
+ const w = width || (imageData ? imageData.width : undefined);
48
+ const h = height || (imageData ? imageData.height : undefined);
49
+
50
+ const alignClass = align === "left"
51
+ ? "float-left mr-4 mb-2"
52
+ : align === "right"
53
+ ? "float-right ml-4 mb-2"
54
+ : align === "center"
55
+ ? "mx-auto"
56
+ : "";
57
+ ---
58
+
59
+ {block ? (
60
+ <figure class:list={["my-4", alignClass, className]}>
61
+ {imageData ? (
62
+ <AstroImage
63
+ src={imageData}
64
+ alt={alt}
65
+ title={title}
66
+ width={w}
67
+ height={h}
68
+ class="rounded-lg border"
69
+ loading="lazy"
70
+ decoding="async"
71
+ />
72
+ ) : (
73
+ <img
74
+ src={src}
75
+ alt={alt}
76
+ title={title}
77
+ width={w}
78
+ height={h}
79
+ class="rounded-lg border"
80
+ loading="lazy"
81
+ decoding="async"
82
+ {...rest}
83
+ />
84
+ )}
85
+ {captionText && (
86
+ <figcaption class="mt-2 text-center text-sm text-muted-foreground">
87
+ {captionText}
88
+ </figcaption>
89
+ )}
90
+ </figure>
91
+ ) : imageData ? (
92
+ <AstroImage
93
+ src={imageData}
94
+ alt={alt}
95
+ title={title}
96
+ width={w}
97
+ height={h}
98
+ loading="lazy"
99
+ decoding="async"
100
+ class:list={[alignClass, className]}
101
+ {...rest}
102
+ />
103
+ ) : (
104
+ <img
105
+ src={src}
106
+ alt={alt}
107
+ title={title}
108
+ width={w}
109
+ height={h}
110
+ loading="lazy"
111
+ decoding="async"
112
+ class:list={[alignClass, className]}
113
+ {...rest}
114
+ />
115
+ )}
@@ -0,0 +1 @@
1
+ export { default as Image } from "./Image.astro";
@@ -0,0 +1,34 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const input = tv({
5
+ base: "flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[invalid]:border-destructive data-[invalid]:focus-visible:ring-destructive",
6
+ variants: {
7
+ invalid: {
8
+ true: "border-destructive focus-visible:ring-destructive",
9
+ },
10
+ },
11
+ });
12
+
13
+ interface Props {
14
+ type?: string;
15
+ invalid?: boolean;
16
+ class?: string;
17
+ [key: string]: unknown;
18
+ }
19
+
20
+ const {
21
+ type = "text",
22
+ invalid = false,
23
+ class: className,
24
+ ...rest
25
+ } = Astro.props;
26
+ ---
27
+
28
+ <input
29
+ class={input({ invalid: invalid || undefined, class: className })}
30
+ type={type}
31
+ aria-invalid={invalid ? "true" : undefined}
32
+ data-invalid={invalid || undefined}
33
+ {...rest}
34
+ />
@@ -0,0 +1 @@
1
+ export { default as Input } from "./Input.astro";
@@ -0,0 +1,17 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const kbd = tv({
5
+ base: "pointer-events-none inline-flex h-5 items-center justify-center gap-1 rounded border bg-muted px-1.5 font-mono text-xs font-medium text-muted-foreground shadow-[0_1px_0_1px] shadow-muted",
6
+ });
7
+
8
+ interface Props {
9
+ class?: string;
10
+ [key: string]: unknown;
11
+ }
12
+ const { class: className, ...rest } = Astro.props;
13
+ ---
14
+
15
+ <kbd class={kbd({ class: className })} {...rest}>
16
+ <slot />
17
+ </kbd>
@@ -0,0 +1 @@
1
+ export { default as Kbd } from "./Kbd.astro";
@@ -0,0 +1,17 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const label = tv({
5
+ base: "block text-sm font-medium leading-none text-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
6
+ });
7
+
8
+ interface Props {
9
+ class?: string;
10
+ [key: string]: unknown;
11
+ }
12
+ const { class: className, ...rest } = Astro.props;
13
+ ---
14
+
15
+ <label class={label({ class: className })} {...rest}>
16
+ <slot />
17
+ </label>
@@ -0,0 +1 @@
1
+ export { default as Label } from "./Label.astro";
@@ -0,0 +1,47 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const linkCard = tv({
5
+ base: "group flex flex-col gap-1 rounded-lg border bg-card p-4 text-card-foreground shadow-sm transition-colors hover:bg-accent/50",
6
+ });
7
+
8
+ const linkCardTitle = tv({
9
+ base: "text-sm font-semibold group-hover:underline",
10
+ });
11
+
12
+ const linkCardDescription = tv({
13
+ base: "text-sm text-muted-foreground",
14
+ });
15
+
16
+ interface Props {
17
+ title: string;
18
+ description?: string;
19
+ href: string;
20
+ class?: string;
21
+ [key: string]: unknown;
22
+ }
23
+
24
+ const { title, description, href, class: className, ...rest } = Astro.props;
25
+ ---
26
+
27
+ <a href={href} class={linkCard({ class: className })} {...rest}>
28
+ <div class="flex items-center justify-between">
29
+ <span class={linkCardTitle()}>{title}</span>
30
+ <svg
31
+ xmlns="http://www.w3.org/2000/svg"
32
+ width="16"
33
+ height="16"
34
+ viewBox="0 0 24 24"
35
+ fill="none"
36
+ stroke="currentColor"
37
+ stroke-width="2"
38
+ stroke-linecap="round"
39
+ stroke-linejoin="round"
40
+ class="size-4 shrink-0 text-muted-foreground transition-transform group-hover:translate-x-0.5"
41
+ aria-hidden="true"
42
+ >
43
+ <polyline points="9 18 15 12 9 6"></polyline>
44
+ </svg>
45
+ </div>
46
+ {description && <p class={linkCardDescription()}>{description}</p>}
47
+ </a>
@@ -0,0 +1 @@
1
+ export { default as LinkCard } from "./LinkCard.astro";
@@ -0,0 +1,88 @@
1
+ ---
2
+ import { tv } from "tailwind-variants";
3
+
4
+ const mapView = tv({
5
+ base: "relative overflow-hidden rounded-lg border",
6
+ });
7
+
8
+ interface Marker {
9
+ id: string;
10
+ coordinates: [number, number]; // [lng, lat]
11
+ title: string;
12
+ category?: string;
13
+ color?: string;
14
+ href?: string;
15
+ }
16
+
17
+ interface GeoJsonOverlay {
18
+ id: string;
19
+ data: object;
20
+ lineColor?: string;
21
+ lineWidth?: number;
22
+ }
23
+
24
+ interface Props {
25
+ /** Initial center [longitude, latitude] */
26
+ center?: [number, number];
27
+ /** Initial zoom level */
28
+ zoom?: number;
29
+ /** Map height */
30
+ height?: string;
31
+ /** PMTiles URL for offline tiles */
32
+ pmtilesUrl?: string;
33
+ /** Tile URL template (fallback if no PMTiles) */
34
+ tileUrl?: string;
35
+ /** Array of markers to display */
36
+ markers?: Marker[];
37
+ /** GeoJSON line/polygon overlays */
38
+ overlays?: GeoJsonOverlay[];
39
+ /** Show GPS location dot */
40
+ showLocation?: boolean;
41
+ /** Show attribution */
42
+ attribution?: string;
43
+ class?: string;
44
+ [key: string]: unknown;
45
+ }
46
+
47
+ const {
48
+ center = [0, 0],
49
+ zoom = 13,
50
+ height = "400px",
51
+ pmtilesUrl,
52
+ tileUrl = "https://tile.openstreetmap.org/{z}/{x}/{y}.png",
53
+ markers = [],
54
+ overlays = [],
55
+ showLocation = false,
56
+ attribution = '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
57
+ class: className,
58
+ ...rest
59
+ } = Astro.props;
60
+ ---
61
+
62
+ <div
63
+ class={mapView({ class: className })}
64
+ data-component="map-view"
65
+ data-center={JSON.stringify(center)}
66
+ data-zoom={zoom}
67
+ data-pmtiles-url={pmtilesUrl}
68
+ data-tile-url={tileUrl}
69
+ data-markers={JSON.stringify(markers)}
70
+ data-overlays={JSON.stringify(overlays)}
71
+ data-show-location={showLocation || undefined}
72
+ data-attribution={attribution}
73
+ style={`height: ${height}`}
74
+ {...rest}
75
+ >
76
+ <div data-part="map" class="h-full w-full"></div>
77
+ {showLocation && (
78
+ <button
79
+ data-part="locate"
80
+ class="absolute bottom-4 right-4 z-10 inline-flex h-10 w-10 items-center justify-center rounded-full border bg-background shadow-md transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
81
+ type="button"
82
+ aria-label="Show my location"
83
+ >
84
+ <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="3"/><path d="M12 2v4"/><path d="M12 18v4"/><path d="M2 12h4"/><path d="M18 12h4"/></svg>
85
+ </button>
86
+ )}
87
+ <slot />
88
+ </div>
@@ -0,0 +1 @@
1
+ export { default as MapView } from "./MapView.astro";
@@ -0,0 +1,194 @@
1
+ import maplibregl from "maplibre-gl";
2
+ import "maplibre-gl/dist/maplibre-gl.css";
3
+
4
+ interface MarkerData {
5
+ id: string;
6
+ coordinates: [number, number];
7
+ title: string;
8
+ category?: string;
9
+ color?: string;
10
+ href?: string;
11
+ }
12
+
13
+ interface OverlayData {
14
+ id: string;
15
+ data: object;
16
+ lineColor?: string;
17
+ lineWidth?: number;
18
+ }
19
+
20
+ function init(root: HTMLElement) {
21
+ if (root.hasAttribute("data-initialized")) return;
22
+ root.setAttribute("data-initialized", "");
23
+
24
+ const mapContainer = root.querySelector<HTMLElement>("[data-part='map']");
25
+ if (!mapContainer) return;
26
+
27
+ const center = JSON.parse(root.getAttribute("data-center") || "[0,0]") as [number, number];
28
+ const zoom = Number(root.getAttribute("data-zoom") || "13");
29
+ const tileUrl = root.getAttribute("data-tile-url") || "";
30
+ const attribution = root.getAttribute("data-attribution") || "";
31
+ const markers: MarkerData[] = JSON.parse(root.getAttribute("data-markers") || "[]");
32
+ const overlays: OverlayData[] = JSON.parse(root.getAttribute("data-overlays") || "[]");
33
+ const showLocation = root.hasAttribute("data-show-location");
34
+
35
+ // Create map with raster tile source
36
+ const map = new maplibregl.Map({
37
+ container: mapContainer,
38
+ style: {
39
+ version: 8,
40
+ sources: {
41
+ "osm-tiles": {
42
+ type: "raster",
43
+ tiles: [tileUrl],
44
+ tileSize: 256,
45
+ attribution,
46
+ },
47
+ },
48
+ layers: [
49
+ {
50
+ id: "osm-tiles",
51
+ type: "raster",
52
+ source: "osm-tiles",
53
+ minzoom: 0,
54
+ maxzoom: 19,
55
+ },
56
+ ],
57
+ },
58
+ center,
59
+ zoom,
60
+ attributionControl: true,
61
+ });
62
+
63
+ // Add navigation controls
64
+ map.addControl(new maplibregl.NavigationControl(), "top-right");
65
+
66
+ map.on("load", () => {
67
+ // Add GeoJSON overlays
68
+ for (const overlay of overlays) {
69
+ map.addSource(overlay.id, {
70
+ type: "geojson",
71
+ data: overlay.data as GeoJSON.GeoJSON,
72
+ });
73
+
74
+ map.addLayer({
75
+ id: `${overlay.id}-line`,
76
+ type: "line",
77
+ source: overlay.id,
78
+ layout: {
79
+ "line-join": "round",
80
+ "line-cap": "round",
81
+ },
82
+ paint: {
83
+ "line-color": overlay.lineColor || "#3b82f6",
84
+ "line-width": overlay.lineWidth || 4,
85
+ "line-opacity": 0.8,
86
+ },
87
+ });
88
+ }
89
+
90
+ // Add markers
91
+ for (const marker of markers) {
92
+ const el = document.createElement("div");
93
+ el.className = "map-marker";
94
+ el.style.cssText = `
95
+ width: 28px;
96
+ height: 28px;
97
+ border-radius: 50%;
98
+ background: ${marker.color || "#3b82f6"};
99
+ border: 3px solid white;
100
+ box-shadow: 0 2px 6px rgba(0,0,0,0.3);
101
+ cursor: pointer;
102
+ `;
103
+
104
+ const popup = new maplibregl.Popup({ offset: 20 }).setHTML(
105
+ marker.href
106
+ ? `<a href="${marker.href}" style="font-weight:600;font-size:14px;color:inherit;text-decoration:none">${marker.title}</a>`
107
+ : `<strong style="font-size:14px">${marker.title}</strong>`,
108
+ );
109
+
110
+ new maplibregl.Marker({ element: el })
111
+ .setLngLat(marker.coordinates)
112
+ .setPopup(popup)
113
+ .addTo(map);
114
+ }
115
+ });
116
+
117
+ // GPS location
118
+ if (showLocation) {
119
+ let locationMarker: maplibregl.Marker | null = null;
120
+ let accuracyCircle: string | null = null;
121
+
122
+ const locateBtn = root.querySelector<HTMLElement>("[data-part='locate']");
123
+
124
+ function updateLocation(position: GeolocationPosition) {
125
+ const { longitude, latitude, accuracy } = position.coords;
126
+
127
+ if (!locationMarker) {
128
+ // Blue dot
129
+ const dot = document.createElement("div");
130
+ dot.style.cssText = `
131
+ width: 16px;
132
+ height: 16px;
133
+ border-radius: 50%;
134
+ background: #3b82f6;
135
+ border: 3px solid white;
136
+ box-shadow: 0 0 8px rgba(59,130,246,0.5);
137
+ `;
138
+ locationMarker = new maplibregl.Marker({ element: dot })
139
+ .setLngLat([longitude, latitude])
140
+ .addTo(map);
141
+ } else {
142
+ locationMarker.setLngLat([longitude, latitude]);
143
+ }
144
+
145
+ // Dispatch event for other components
146
+ root.dispatchEvent(
147
+ new CustomEvent("location", {
148
+ detail: { longitude, latitude, accuracy },
149
+ bubbles: true,
150
+ }),
151
+ );
152
+ }
153
+
154
+ function locate() {
155
+ navigator.geolocation.getCurrentPosition(
156
+ (pos) => {
157
+ updateLocation(pos);
158
+ map.flyTo({
159
+ center: [pos.coords.longitude, pos.coords.latitude],
160
+ zoom: 15,
161
+ });
162
+ },
163
+ () => {
164
+ root.dispatchEvent(
165
+ new CustomEvent("location-error", { bubbles: true }),
166
+ );
167
+ },
168
+ { enableHighAccuracy: true, timeout: 10000 },
169
+ );
170
+ }
171
+
172
+ locateBtn?.addEventListener("click", locate);
173
+
174
+ // Watch position continuously
175
+ if ("geolocation" in navigator) {
176
+ navigator.geolocation.watchPosition(updateLocation, () => {}, {
177
+ enableHighAccuracy: true,
178
+ maximumAge: 5000,
179
+ timeout: 15000,
180
+ });
181
+ }
182
+ }
183
+ }
184
+
185
+ function initAll() {
186
+ document.querySelectorAll<HTMLElement>("[data-component='map-view']").forEach(init);
187
+ }
188
+
189
+ if (document.readyState === "loading") {
190
+ document.addEventListener("DOMContentLoaded", initAll);
191
+ } else {
192
+ initAll();
193
+ }
194
+ document.addEventListener("astro:page-load", initAll);
@@ -0,0 +1,138 @@
1
+ ---
2
+ /**
3
+ * Live markdown example — shows rendered output, expandable source, and
4
+ * optional plain-markdown fallback.
5
+ *
6
+ * Used in documentation sites that document markdown dialects. The preview
7
+ * (slot) is pre-rendered by the pipeline. This component provides the
8
+ * surrounding chrome and optionally a fallback panel computed at build time
9
+ * via plain markdown-it.
10
+ *
11
+ * Usage in Dogsbay MD content:
12
+ * :::example
13
+ * > [!NOTE]
14
+ * > This is a note.
15
+ * :::
16
+ *
17
+ * :::example{title="With fallback" fallback=true}
18
+ * ...content...
19
+ * :::
20
+ */
21
+ import MarkdownIt from "markdown-it";
22
+ import mdAttrs from "markdown-it-attrs";
23
+ import mdDeflist from "markdown-it-deflist";
24
+
25
+ interface Props {
26
+ /** Raw source text (set automatically by format-astro from :::example node) */
27
+ source: string;
28
+ /** Optional example title shown above the preview */
29
+ title?: string;
30
+ /** Render a plain-markdown fallback panel showing graceful degradation */
31
+ showFallback?: boolean;
32
+ }
33
+
34
+ const { source, title, showFallback = false } = Astro.props;
35
+
36
+ // Plain-markdown fallback view at build time
37
+ let fallbackHtml = "";
38
+ if (showFallback) {
39
+ const md = new MarkdownIt({ html: false, linkify: true, breaks: false })
40
+ .use(mdAttrs, { leftDelimiter: "{", rightDelimiter: "}" })
41
+ .use(mdDeflist);
42
+ fallbackHtml = md.render(source);
43
+ }
44
+ ---
45
+
46
+ <figure class="my-6 overflow-hidden rounded-lg border border-border bg-card">
47
+ {title && (
48
+ <figcaption class="border-b border-border bg-muted/30 px-4 py-2 text-sm font-medium">
49
+ {title}
50
+ </figcaption>
51
+ )}
52
+
53
+ <div class="border-b border-border">
54
+ <div class="border-b border-border bg-muted/10 px-4 py-1 text-[11px] uppercase tracking-wide text-muted-foreground">
55
+ Rendered
56
+ </div>
57
+ <div class="markdown-preview p-6">
58
+ <slot />
59
+ </div>
60
+ </div>
61
+
62
+ <details class="group">
63
+ <summary class="flex cursor-pointer list-none select-none items-center gap-2 px-4 py-2 text-xs text-muted-foreground hover:text-foreground">
64
+ <svg
65
+ class="h-3 w-3 transition-transform group-open:rotate-90"
66
+ xmlns="http://www.w3.org/2000/svg"
67
+ viewBox="0 0 24 24"
68
+ fill="none"
69
+ stroke="currentColor"
70
+ stroke-width="2"
71
+ stroke-linecap="round"
72
+ stroke-linejoin="round"
73
+ >
74
+ <polyline points="9 18 15 12 9 6"></polyline>
75
+ </svg>
76
+ <span class="uppercase tracking-wide">Source</span>
77
+ </summary>
78
+ <pre class="m-0 overflow-auto border-t border-border bg-muted/20 p-4 text-xs"><code>{source}</code></pre>
79
+ </details>
80
+
81
+ {showFallback && (
82
+ <div class="border-t border-border">
83
+ <div class="bg-muted/10 px-4 py-1 text-[11px] uppercase tracking-wide text-muted-foreground">
84
+ Plain markdown fallback
85
+ </div>
86
+ <div
87
+ class="plain-markdown p-6 text-sm"
88
+ set:html={fallbackHtml}
89
+ />
90
+ </div>
91
+ )}
92
+ </figure>
93
+
94
+ <style>
95
+ .markdown-preview :global(> *:first-child) {
96
+ margin-top: 0;
97
+ }
98
+ .markdown-preview :global(> *:last-child) {
99
+ margin-bottom: 0;
100
+ }
101
+
102
+ .plain-markdown :global(> *:first-child) {
103
+ margin-top: 0;
104
+ }
105
+ .plain-markdown :global(> *:last-child) {
106
+ margin-bottom: 0;
107
+ }
108
+ .plain-markdown :global(p) {
109
+ margin: 0.5rem 0;
110
+ }
111
+ .plain-markdown :global(blockquote) {
112
+ border-left: 3px solid var(--border);
113
+ padding-left: 1rem;
114
+ color: var(--muted-foreground);
115
+ margin: 0.5rem 0;
116
+ }
117
+ .plain-markdown :global(dl dt) {
118
+ font-weight: 600;
119
+ margin-top: 0.5rem;
120
+ }
121
+ .plain-markdown :global(dl dd) {
122
+ margin-left: 1rem;
123
+ color: var(--muted-foreground);
124
+ }
125
+ .plain-markdown :global(code) {
126
+ background: var(--muted);
127
+ padding: 0.125rem 0.25rem;
128
+ border-radius: 0.25rem;
129
+ font-size: 0.85em;
130
+ }
131
+ .plain-markdown :global(pre) {
132
+ background: var(--muted);
133
+ padding: 0.5rem;
134
+ border-radius: 0.25rem;
135
+ overflow-x: auto;
136
+ font-size: 0.85em;
137
+ }
138
+ </style>
@@ -0,0 +1 @@
1
+ export { default as MarkdownExample } from "./MarkdownExample.astro";