livemark 0.0.0-dev

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 (187) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +3 -0
  3. package/build/actions/config/define.d.ts +6 -0
  4. package/build/actions/config/define.js +8 -0
  5. package/build/actions/config/define.unit.d.ts +1 -0
  6. package/build/actions/config/define.unit.js +34 -0
  7. package/build/actions/config/load.d.ts +5 -0
  8. package/build/actions/config/load.js +22 -0
  9. package/build/actions/config/load.unit.d.ts +1 -0
  10. package/build/actions/config/load.unit.js +23 -0
  11. package/build/commands/build.d.ts +5 -0
  12. package/build/commands/build.js +13 -0
  13. package/build/commands/preview.d.ts +5 -0
  14. package/build/commands/preview.js +18 -0
  15. package/build/commands/start.d.ts +5 -0
  16. package/build/commands/start.js +19 -0
  17. package/build/docs/markdown/includes/example.d.ts +9 -0
  18. package/build/docs/markdown/includes/example.js +5 -0
  19. package/build/entrypoints/main.d.ts +2 -0
  20. package/build/entrypoints/main.js +12 -0
  21. package/build/helpers/program.d.ts +2 -0
  22. package/build/helpers/program.js +5 -0
  23. package/build/index.d.ts +1 -0
  24. package/build/index.js +2 -0
  25. package/build/livemark.config.d.ts +9 -0
  26. package/build/livemark.config.js +5 -0
  27. package/build/models/config.d.ts +33 -0
  28. package/build/models/config.js +14 -0
  29. package/build/program.d.ts +2 -0
  30. package/build/program.js +14 -0
  31. package/build/vite.config.d.ts +2 -0
  32. package/build/vite.config.js +48 -0
  33. package/build/website/client.tsx +10 -0
  34. package/build/website/components/Abbr.tsx +17 -0
  35. package/build/website/components/AnsiCode.tsx +15 -0
  36. package/build/website/components/Banner.tsx +32 -0
  37. package/build/website/components/Breadcrumbs.tsx +19 -0
  38. package/build/website/components/Callout.tsx +72 -0
  39. package/build/website/components/Cards.tsx +66 -0
  40. package/build/website/components/CodeBlock.tsx +118 -0
  41. package/build/website/components/CodeTabs.tsx +83 -0
  42. package/build/website/components/Columns.tsx +17 -0
  43. package/build/website/components/Content.tsx +7 -0
  44. package/build/website/components/ContentTab.tsx +7 -0
  45. package/build/website/components/ContentTabs.tsx +82 -0
  46. package/build/website/components/DefaultCatchBoundary.tsx +54 -0
  47. package/build/website/components/DefinitionList.tsx +21 -0
  48. package/build/website/components/Details.tsx +30 -0
  49. package/build/website/components/FileTree.tsx +52 -0
  50. package/build/website/components/Footer.tsx +9 -0
  51. package/build/website/components/FootnoteRef.tsx +52 -0
  52. package/build/website/components/Heading.tsx +20 -0
  53. package/build/website/components/InlineBadge.tsx +9 -0
  54. package/build/website/components/InlineIcon.tsx +21 -0
  55. package/build/website/components/InlineToc.tsx +31 -0
  56. package/build/website/components/Layout.tsx +220 -0
  57. package/build/website/components/LinkButton.tsx +31 -0
  58. package/build/website/components/Mermaid.tsx +37 -0
  59. package/build/website/components/NotFound.tsx +27 -0
  60. package/build/website/components/PackageTabs.tsx +74 -0
  61. package/build/website/components/PageToolbar.tsx +65 -0
  62. package/build/website/components/PrevNext.tsx +52 -0
  63. package/build/website/components/SearchDialog.tsx +245 -0
  64. package/build/website/components/Section.tsx +24 -0
  65. package/build/website/components/SectionHeader.tsx +35 -0
  66. package/build/website/components/SiteTitle.tsx +16 -0
  67. package/build/website/components/SortableTable.tsx +81 -0
  68. package/build/website/components/SoundCloud.tsx +16 -0
  69. package/build/website/components/Theme.tsx +40 -0
  70. package/build/website/components/Toc.tsx +99 -0
  71. package/build/website/components/YouTube.tsx +16 -0
  72. package/build/website/components/ZoomImage.tsx +30 -0
  73. package/build/website/content-collections.ts +181 -0
  74. package/build/website/elements/accordion.tsx +78 -0
  75. package/build/website/elements/alert-dialog.tsx +185 -0
  76. package/build/website/elements/alert.tsx +74 -0
  77. package/build/website/elements/aspect-ratio.tsx +22 -0
  78. package/build/website/elements/avatar.tsx +107 -0
  79. package/build/website/elements/badge.tsx +51 -0
  80. package/build/website/elements/breadcrumb.tsx +120 -0
  81. package/build/website/elements/button-group.tsx +87 -0
  82. package/build/website/elements/button.tsx +57 -0
  83. package/build/website/elements/calendar.tsx +229 -0
  84. package/build/website/elements/card.tsx +102 -0
  85. package/build/website/elements/carousel.tsx +240 -0
  86. package/build/website/elements/chart.tsx +372 -0
  87. package/build/website/elements/checkbox.tsx +26 -0
  88. package/build/website/elements/collapsible.tsx +19 -0
  89. package/build/website/elements/command.tsx +210 -0
  90. package/build/website/elements/context-menu.tsx +270 -0
  91. package/build/website/elements/dialog.tsx +152 -0
  92. package/build/website/elements/direction.tsx +4 -0
  93. package/build/website/elements/drawer.tsx +127 -0
  94. package/build/website/elements/dropdown-menu.tsx +260 -0
  95. package/build/website/elements/empty.tsx +104 -0
  96. package/build/website/elements/field.tsx +235 -0
  97. package/build/website/elements/hover-card.tsx +49 -0
  98. package/build/website/elements/input-group.tsx +171 -0
  99. package/build/website/elements/input-otp.tsx +84 -0
  100. package/build/website/elements/input.tsx +18 -0
  101. package/build/website/elements/item.tsx +199 -0
  102. package/build/website/elements/kbd.tsx +26 -0
  103. package/build/website/elements/label.tsx +17 -0
  104. package/build/website/elements/menubar.tsx +282 -0
  105. package/build/website/elements/native-select.tsx +56 -0
  106. package/build/website/elements/navigation-menu.tsx +171 -0
  107. package/build/website/elements/pagination.tsx +133 -0
  108. package/build/website/elements/popover.tsx +88 -0
  109. package/build/website/elements/progress.tsx +81 -0
  110. package/build/website/elements/radio-group.tsx +36 -0
  111. package/build/website/elements/resizable.tsx +48 -0
  112. package/build/website/elements/scroll-area.tsx +51 -0
  113. package/build/website/elements/select.tsx +200 -0
  114. package/build/website/elements/separator.tsx +22 -0
  115. package/build/website/elements/sheet.tsx +130 -0
  116. package/build/website/elements/sidebar.tsx +717 -0
  117. package/build/website/elements/skeleton.tsx +13 -0
  118. package/build/website/elements/slider.tsx +57 -0
  119. package/build/website/elements/sonner.tsx +40 -0
  120. package/build/website/elements/spinner.tsx +16 -0
  121. package/build/website/elements/switch.tsx +30 -0
  122. package/build/website/elements/table.tsx +112 -0
  123. package/build/website/elements/tabs.tsx +79 -0
  124. package/build/website/elements/textarea.tsx +16 -0
  125. package/build/website/elements/toggle-group.tsx +87 -0
  126. package/build/website/elements/toggle.tsx +43 -0
  127. package/build/website/elements/tooltip.tsx +67 -0
  128. package/build/website/env.d.ts +10 -0
  129. package/build/website/globals.d.ts +8 -0
  130. package/build/website/helpers/article-icon.ts +59 -0
  131. package/build/website/helpers/articles.ts +24 -0
  132. package/build/website/helpers/resolve-includes.ts +131 -0
  133. package/build/website/helpers/resolve-includes.unit.ts +126 -0
  134. package/build/website/helpers/search-text.ts +15 -0
  135. package/build/website/helpers/style.ts +6 -0
  136. package/build/website/helpers/theme.ts +27 -0
  137. package/build/website/helpers/toc-context.ts +10 -0
  138. package/build/website/helpers/toc.ts +51 -0
  139. package/build/website/helpers/toc.unit.ts +74 -0
  140. package/build/website/hooks/in-view.ts +30 -0
  141. package/build/website/hooks/media.ts +19 -0
  142. package/build/website/models/article.ts +40 -0
  143. package/build/website/plugins/rehype-inline-code.ts +107 -0
  144. package/build/website/plugins/remark-abbr.ts +46 -0
  145. package/build/website/plugins/remark-abbr.unit.ts +99 -0
  146. package/build/website/plugins/remark-ansi.ts +247 -0
  147. package/build/website/plugins/remark-ansi.unit.ts +197 -0
  148. package/build/website/plugins/remark-badge.ts +50 -0
  149. package/build/website/plugins/remark-badge.unit.ts +96 -0
  150. package/build/website/plugins/remark-button.ts +60 -0
  151. package/build/website/plugins/remark-button.unit.ts +147 -0
  152. package/build/website/plugins/remark-callout.ts +57 -0
  153. package/build/website/plugins/remark-card.ts +80 -0
  154. package/build/website/plugins/remark-code-tabs.ts +87 -0
  155. package/build/website/plugins/remark-columns.ts +66 -0
  156. package/build/website/plugins/remark-custom-heading-id.ts +70 -0
  157. package/build/website/plugins/remark-custom-heading-id.unit.ts +131 -0
  158. package/build/website/plugins/remark-deflist.ts +36 -0
  159. package/build/website/plugins/remark-details.ts +49 -0
  160. package/build/website/plugins/remark-filetree.ts +89 -0
  161. package/build/website/plugins/remark-filetree.unit.ts +137 -0
  162. package/build/website/plugins/remark-github-callout.ts +71 -0
  163. package/build/website/plugins/remark-icon.ts +42 -0
  164. package/build/website/plugins/remark-image.ts +25 -0
  165. package/build/website/plugins/remark-media.ts +62 -0
  166. package/build/website/plugins/remark-media.unit.ts +74 -0
  167. package/build/website/plugins/remark-mermaid.ts +23 -0
  168. package/build/website/plugins/remark-npm.ts +52 -0
  169. package/build/website/plugins/remark-steps.ts +36 -0
  170. package/build/website/plugins/remark-steps.unit.ts +97 -0
  171. package/build/website/plugins/remark-tab.ts +100 -0
  172. package/build/website/plugins/remark-tab.unit.ts +181 -0
  173. package/build/website/plugins/remark-toc.ts +39 -0
  174. package/build/website/plugins/remark-toc.unit.ts +82 -0
  175. package/build/website/plugins/shiki-icon.ts +82 -0
  176. package/build/website/plugins/shiki-line-highlight.ts +174 -0
  177. package/build/website/public/logo.svg +72 -0
  178. package/build/website/routeTree.gen.ts +86 -0
  179. package/build/website/router.tsx +34 -0
  180. package/build/website/routes/$.tsx +149 -0
  181. package/build/website/routes/__root.tsx +84 -0
  182. package/build/website/routes/index.tsx +13 -0
  183. package/build/website/server.ts +7 -0
  184. package/build/website/styles/general.css +347 -0
  185. package/build/website/vite.config.ts +36 -0
  186. package/entrypoints/main.ts +12 -0
  187. package/package.json +120 -0
@@ -0,0 +1,210 @@
1
+ import * as React from "react"
2
+ import { Command as CommandPrimitive } from "cmdk"
3
+ import { CheckIcon, SearchIcon, XIcon } from "lucide-react"
4
+
5
+ import { cn } from "../helpers/style.ts"
6
+ import {
7
+ Dialog,
8
+ DialogContent,
9
+ DialogDescription,
10
+ DialogHeader,
11
+ DialogTitle,
12
+ } from "./dialog.tsx"
13
+ import { InputGroup, InputGroupAddon } from "./input-group.tsx"
14
+
15
+ function Command({
16
+ className,
17
+ ...props
18
+ }: React.ComponentProps<typeof CommandPrimitive>) {
19
+ return (
20
+ <CommandPrimitive
21
+ data-slot="command"
22
+ className={cn(
23
+ "flex size-full flex-col overflow-hidden rounded-xl! bg-popover p-1 text-popover-foreground",
24
+ className,
25
+ )}
26
+ {...props}
27
+ />
28
+ )
29
+ }
30
+
31
+ function CommandDialog({
32
+ title = "Command Palette",
33
+ description = "Search for a command to run...",
34
+ children,
35
+ className,
36
+ showCloseButton = false,
37
+ shouldFilter,
38
+ loop,
39
+ ...props
40
+ }: Omit<React.ComponentProps<typeof Dialog>, "children"> & {
41
+ title?: string
42
+ description?: string
43
+ className?: string
44
+ showCloseButton?: boolean
45
+ shouldFilter?: boolean
46
+ loop?: boolean
47
+ children: React.ReactNode
48
+ }) {
49
+ return (
50
+ <Dialog {...props}>
51
+ <DialogHeader className="sr-only">
52
+ <DialogTitle>{title}</DialogTitle>
53
+ <DialogDescription>{description}</DialogDescription>
54
+ </DialogHeader>
55
+ <DialogContent
56
+ className={cn(
57
+ "top-1/3 translate-y-0 overflow-hidden rounded-xl! p-0",
58
+ className,
59
+ )}
60
+ showCloseButton={showCloseButton}
61
+ >
62
+ <Command shouldFilter={shouldFilter} loop={loop}>
63
+ {children}
64
+ </Command>
65
+ </DialogContent>
66
+ </Dialog>
67
+ )
68
+ }
69
+
70
+ function CommandInput({
71
+ className,
72
+ onClear,
73
+ ...props
74
+ }: React.ComponentProps<typeof CommandPrimitive.Input> & {
75
+ onClear?: () => void
76
+ }) {
77
+ const showClear = !!props.value
78
+ return (
79
+ <div data-slot="command-input-wrapper" className="p-1 pb-2">
80
+ <InputGroup className="h-12! rounded-lg! border-input/30 bg-input/30 shadow-none! *:data-[slot=input-group-addon]:pl-3!">
81
+ <CommandPrimitive.Input
82
+ data-slot="command-input"
83
+ className={cn(
84
+ "w-full text-lg outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
85
+ className,
86
+ )}
87
+ {...props}
88
+ />
89
+ <InputGroupAddon>
90
+ <SearchIcon className="size-5 shrink-0 opacity-50" />
91
+ </InputGroupAddon>
92
+ {showClear && onClear && (
93
+ <button
94
+ type="button"
95
+ onClick={onClear}
96
+ className="pr-3 cursor-pointer opacity-50 hover:opacity-100 transition-opacity"
97
+ >
98
+ <XIcon className="size-4" />
99
+ </button>
100
+ )}
101
+ </InputGroup>
102
+ </div>
103
+ )
104
+ }
105
+
106
+ function CommandList({
107
+ className,
108
+ ...props
109
+ }: React.ComponentProps<typeof CommandPrimitive.List>) {
110
+ return (
111
+ <CommandPrimitive.List
112
+ data-slot="command-list"
113
+ className={cn(
114
+ "no-scrollbar max-h-72 scroll-py-1 overflow-x-hidden overflow-y-auto outline-none",
115
+ className,
116
+ )}
117
+ {...props}
118
+ />
119
+ )
120
+ }
121
+
122
+ function CommandEmpty({
123
+ className,
124
+ ...props
125
+ }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
126
+ return (
127
+ <CommandPrimitive.Empty
128
+ data-slot="command-empty"
129
+ className={cn("py-6 text-center text-sm", className)}
130
+ {...props}
131
+ />
132
+ )
133
+ }
134
+
135
+ function CommandGroup({
136
+ className,
137
+ ...props
138
+ }: React.ComponentProps<typeof CommandPrimitive.Group>) {
139
+ return (
140
+ <CommandPrimitive.Group
141
+ data-slot="command-group"
142
+ className={cn(
143
+ "overflow-hidden p-1 text-foreground **:[[cmdk-group-items]]:space-y-2 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium **:[[cmdk-group-heading]]:text-muted-foreground",
144
+ className,
145
+ )}
146
+ {...props}
147
+ />
148
+ )
149
+ }
150
+
151
+ function CommandSeparator({
152
+ className,
153
+ ...props
154
+ }: React.ComponentProps<typeof CommandPrimitive.Separator>) {
155
+ return (
156
+ <CommandPrimitive.Separator
157
+ data-slot="command-separator"
158
+ className={cn("-mx-1 h-px w-auto bg-border", className)}
159
+ {...props}
160
+ />
161
+ )
162
+ }
163
+
164
+ function CommandItem({
165
+ className,
166
+ children,
167
+ ...props
168
+ }: React.ComponentProps<typeof CommandPrimitive.Item>) {
169
+ return (
170
+ <CommandPrimitive.Item
171
+ data-slot="command-item"
172
+ className={cn(
173
+ "group/command-item relative flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none bg-muted/50 in-data-[slot=dialog-content]:rounded-lg! data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 data-[selected=true]:bg-primary/10 data-[selected=true]:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[selected=true]:**:[svg]:text-foreground",
174
+ className,
175
+ )}
176
+ {...props}
177
+ >
178
+ {children}
179
+ <CheckIcon className="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
180
+ </CommandPrimitive.Item>
181
+ )
182
+ }
183
+
184
+ function CommandShortcut({
185
+ className,
186
+ ...props
187
+ }: React.ComponentProps<"span">) {
188
+ return (
189
+ <span
190
+ data-slot="command-shortcut"
191
+ className={cn(
192
+ "ml-auto text-xs tracking-widest text-muted-foreground group-data-selected/command-item:text-foreground",
193
+ className,
194
+ )}
195
+ {...props}
196
+ />
197
+ )
198
+ }
199
+
200
+ export {
201
+ Command,
202
+ CommandDialog,
203
+ CommandInput,
204
+ CommandList,
205
+ CommandEmpty,
206
+ CommandGroup,
207
+ CommandItem,
208
+ CommandShortcut,
209
+ CommandSeparator,
210
+ }
@@ -0,0 +1,270 @@
1
+ import * as React from "react"
2
+ import { ContextMenu as ContextMenuPrimitive } from "@base-ui/react/context-menu"
3
+ import { CheckIcon, ChevronRightIcon } from "lucide-react"
4
+
5
+ import { cn } from "../helpers/style.ts"
6
+
7
+ function ContextMenu({ ...props }: ContextMenuPrimitive.Root.Props) {
8
+ return <ContextMenuPrimitive.Root data-slot="context-menu" {...props} />
9
+ }
10
+
11
+ function ContextMenuPortal({ ...props }: ContextMenuPrimitive.Portal.Props) {
12
+ return (
13
+ <ContextMenuPrimitive.Portal data-slot="context-menu-portal" {...props} />
14
+ )
15
+ }
16
+
17
+ function ContextMenuTrigger({
18
+ className,
19
+ ...props
20
+ }: ContextMenuPrimitive.Trigger.Props) {
21
+ return (
22
+ <ContextMenuPrimitive.Trigger
23
+ data-slot="context-menu-trigger"
24
+ className={cn("select-none", className)}
25
+ {...props}
26
+ />
27
+ )
28
+ }
29
+
30
+ function ContextMenuContent({
31
+ className,
32
+ align = "start",
33
+ alignOffset = 4,
34
+ side = "right",
35
+ sideOffset = 0,
36
+ ...props
37
+ }: ContextMenuPrimitive.Popup.Props &
38
+ Pick<
39
+ ContextMenuPrimitive.Positioner.Props,
40
+ "align" | "alignOffset" | "side" | "sideOffset"
41
+ >) {
42
+ return (
43
+ <ContextMenuPrimitive.Portal>
44
+ <ContextMenuPrimitive.Positioner
45
+ className="isolate z-50 outline-none"
46
+ align={align}
47
+ alignOffset={alignOffset}
48
+ side={side}
49
+ sideOffset={sideOffset}
50
+ >
51
+ <ContextMenuPrimitive.Popup
52
+ data-slot="context-menu-content"
53
+ className={cn(
54
+ "cn-menu-target cn-menu-translucent z-50 max-h-(--available-height) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",
55
+ className,
56
+ )}
57
+ {...props}
58
+ />
59
+ </ContextMenuPrimitive.Positioner>
60
+ </ContextMenuPrimitive.Portal>
61
+ )
62
+ }
63
+
64
+ function ContextMenuGroup({ ...props }: ContextMenuPrimitive.Group.Props) {
65
+ return (
66
+ <ContextMenuPrimitive.Group data-slot="context-menu-group" {...props} />
67
+ )
68
+ }
69
+
70
+ function ContextMenuLabel({
71
+ className,
72
+ inset,
73
+ ...props
74
+ }: ContextMenuPrimitive.GroupLabel.Props & {
75
+ inset?: boolean
76
+ }) {
77
+ return (
78
+ <ContextMenuPrimitive.GroupLabel
79
+ data-slot="context-menu-label"
80
+ data-inset={inset}
81
+ className={cn(
82
+ "px-2 py-1.5 text-xs font-medium text-muted-foreground data-inset:pl-8",
83
+ className,
84
+ )}
85
+ {...props}
86
+ />
87
+ )
88
+ }
89
+
90
+ function ContextMenuItem({
91
+ className,
92
+ inset,
93
+ variant = "default",
94
+ ...props
95
+ }: ContextMenuPrimitive.Item.Props & {
96
+ inset?: boolean
97
+ variant?: "default" | "destructive"
98
+ }) {
99
+ return (
100
+ <ContextMenuPrimitive.Item
101
+ data-slot="context-menu-item"
102
+ data-inset={inset}
103
+ data-variant={variant}
104
+ className={cn(
105
+ "group/context-menu-item relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 focus:*:[svg]:text-accent-foreground data-[variant=destructive]:*:[svg]:text-destructive",
106
+ className,
107
+ )}
108
+ {...props}
109
+ />
110
+ )
111
+ }
112
+
113
+ function ContextMenuSub({ ...props }: ContextMenuPrimitive.SubmenuRoot.Props) {
114
+ return (
115
+ <ContextMenuPrimitive.SubmenuRoot data-slot="context-menu-sub" {...props} />
116
+ )
117
+ }
118
+
119
+ function ContextMenuSubTrigger({
120
+ className,
121
+ inset,
122
+ children,
123
+ ...props
124
+ }: ContextMenuPrimitive.SubmenuTrigger.Props & {
125
+ inset?: boolean
126
+ }) {
127
+ return (
128
+ <ContextMenuPrimitive.SubmenuTrigger
129
+ data-slot="context-menu-sub-trigger"
130
+ data-inset={inset}
131
+ className={cn(
132
+ "flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-open:bg-accent data-open:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
133
+ className,
134
+ )}
135
+ {...props}
136
+ >
137
+ {children}
138
+ <ChevronRightIcon className="cn-rtl-flip ml-auto" />
139
+ </ContextMenuPrimitive.SubmenuTrigger>
140
+ )
141
+ }
142
+
143
+ function ContextMenuSubContent({
144
+ ...props
145
+ }: React.ComponentProps<typeof ContextMenuContent>) {
146
+ return (
147
+ <ContextMenuContent
148
+ data-slot="context-menu-sub-content"
149
+ className="cn-menu-target cn-menu-translucent shadow-lg"
150
+ side="right"
151
+ {...props}
152
+ />
153
+ )
154
+ }
155
+
156
+ function ContextMenuCheckboxItem({
157
+ className,
158
+ children,
159
+ checked,
160
+ inset,
161
+ ...props
162
+ }: ContextMenuPrimitive.CheckboxItem.Props & {
163
+ inset?: boolean
164
+ }) {
165
+ return (
166
+ <ContextMenuPrimitive.CheckboxItem
167
+ data-slot="context-menu-checkbox-item"
168
+ data-inset={inset}
169
+ className={cn(
170
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
171
+ className,
172
+ )}
173
+ checked={checked}
174
+ {...props}
175
+ >
176
+ <span className="pointer-events-none absolute right-2">
177
+ <ContextMenuPrimitive.CheckboxItemIndicator>
178
+ <CheckIcon />
179
+ </ContextMenuPrimitive.CheckboxItemIndicator>
180
+ </span>
181
+ {children}
182
+ </ContextMenuPrimitive.CheckboxItem>
183
+ )
184
+ }
185
+
186
+ function ContextMenuRadioGroup({
187
+ ...props
188
+ }: ContextMenuPrimitive.RadioGroup.Props) {
189
+ return (
190
+ <ContextMenuPrimitive.RadioGroup
191
+ data-slot="context-menu-radio-group"
192
+ {...props}
193
+ />
194
+ )
195
+ }
196
+
197
+ function ContextMenuRadioItem({
198
+ className,
199
+ children,
200
+ inset,
201
+ ...props
202
+ }: ContextMenuPrimitive.RadioItem.Props & {
203
+ inset?: boolean
204
+ }) {
205
+ return (
206
+ <ContextMenuPrimitive.RadioItem
207
+ data-slot="context-menu-radio-item"
208
+ data-inset={inset}
209
+ className={cn(
210
+ "relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-inset:pl-8 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
211
+ className,
212
+ )}
213
+ {...props}
214
+ >
215
+ <span className="pointer-events-none absolute right-2">
216
+ <ContextMenuPrimitive.RadioItemIndicator>
217
+ <CheckIcon />
218
+ </ContextMenuPrimitive.RadioItemIndicator>
219
+ </span>
220
+ {children}
221
+ </ContextMenuPrimitive.RadioItem>
222
+ )
223
+ }
224
+
225
+ function ContextMenuSeparator({
226
+ className,
227
+ ...props
228
+ }: ContextMenuPrimitive.Separator.Props) {
229
+ return (
230
+ <ContextMenuPrimitive.Separator
231
+ data-slot="context-menu-separator"
232
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
233
+ {...props}
234
+ />
235
+ )
236
+ }
237
+
238
+ function ContextMenuShortcut({
239
+ className,
240
+ ...props
241
+ }: React.ComponentProps<"span">) {
242
+ return (
243
+ <span
244
+ data-slot="context-menu-shortcut"
245
+ className={cn(
246
+ "ml-auto text-xs tracking-widest text-muted-foreground group-focus/context-menu-item:text-accent-foreground",
247
+ className,
248
+ )}
249
+ {...props}
250
+ />
251
+ )
252
+ }
253
+
254
+ export {
255
+ ContextMenu,
256
+ ContextMenuTrigger,
257
+ ContextMenuContent,
258
+ ContextMenuItem,
259
+ ContextMenuCheckboxItem,
260
+ ContextMenuRadioItem,
261
+ ContextMenuLabel,
262
+ ContextMenuSeparator,
263
+ ContextMenuShortcut,
264
+ ContextMenuGroup,
265
+ ContextMenuPortal,
266
+ ContextMenuSub,
267
+ ContextMenuSubContent,
268
+ ContextMenuSubTrigger,
269
+ ContextMenuRadioGroup,
270
+ }
@@ -0,0 +1,152 @@
1
+ import { Dialog as DialogPrimitive } from "@base-ui/react/dialog"
2
+ import { XIcon } from "lucide-react"
3
+ import { cn } from "../helpers/style.ts"
4
+ import { Button } from "./button.tsx"
5
+
6
+ function Dialog({ ...props }: DialogPrimitive.Root.Props) {
7
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />
8
+ }
9
+
10
+ function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props) {
11
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />
12
+ }
13
+
14
+ function DialogPortal({ ...props }: DialogPrimitive.Portal.Props) {
15
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />
16
+ }
17
+
18
+ function DialogClose({ ...props }: DialogPrimitive.Close.Props) {
19
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />
20
+ }
21
+
22
+ function DialogOverlay({
23
+ className,
24
+ ...props
25
+ }: DialogPrimitive.Backdrop.Props) {
26
+ return (
27
+ <DialogPrimitive.Backdrop
28
+ data-slot="dialog-overlay"
29
+ className={cn(
30
+ "data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs fixed inset-0 isolate z-50",
31
+ className,
32
+ )}
33
+ {...props}
34
+ />
35
+ )
36
+ }
37
+
38
+ function DialogContent({
39
+ className,
40
+ children,
41
+ showCloseButton = true,
42
+ ...props
43
+ }: DialogPrimitive.Popup.Props & {
44
+ showCloseButton?: boolean
45
+ }) {
46
+ return (
47
+ <DialogPortal>
48
+ <DialogOverlay />
49
+ <DialogPrimitive.Popup
50
+ data-slot="dialog-content"
51
+ className={cn(
52
+ "bg-background data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 ring-foreground/10 grid max-w-[calc(100%-2rem)] gap-6 rounded-xl p-6 text-sm ring-1 duration-100 sm:max-w-md fixed top-1/2 left-1/2 z-50 w-full -translate-x-1/2 -translate-y-1/2 outline-none",
53
+ className,
54
+ )}
55
+ {...props}
56
+ >
57
+ {children}
58
+ {showCloseButton && (
59
+ <DialogPrimitive.Close
60
+ data-slot="dialog-close"
61
+ render={
62
+ <Button
63
+ variant="ghost"
64
+ className="absolute top-4 right-4"
65
+ size="icon-sm"
66
+ />
67
+ }
68
+ >
69
+ <XIcon />
70
+ <span className="sr-only">Close</span>
71
+ </DialogPrimitive.Close>
72
+ )}
73
+ </DialogPrimitive.Popup>
74
+ </DialogPortal>
75
+ )
76
+ }
77
+
78
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
79
+ return (
80
+ <div
81
+ data-slot="dialog-header"
82
+ className={cn("gap-2 flex flex-col", className)}
83
+ {...props}
84
+ />
85
+ )
86
+ }
87
+
88
+ function DialogFooter({
89
+ className,
90
+ showCloseButton = false,
91
+ children,
92
+ ...props
93
+ }: React.ComponentProps<"div"> & {
94
+ showCloseButton?: boolean
95
+ }) {
96
+ return (
97
+ <div
98
+ data-slot="dialog-footer"
99
+ className={cn(
100
+ "gap-2 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
101
+ className,
102
+ )}
103
+ {...props}
104
+ >
105
+ {children}
106
+ {showCloseButton && (
107
+ <DialogPrimitive.Close render={<Button variant="outline" />}>
108
+ Close
109
+ </DialogPrimitive.Close>
110
+ )}
111
+ </div>
112
+ )
113
+ }
114
+
115
+ function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props) {
116
+ return (
117
+ <DialogPrimitive.Title
118
+ data-slot="dialog-title"
119
+ className={cn("leading-none font-medium", className)}
120
+ {...props}
121
+ />
122
+ )
123
+ }
124
+
125
+ function DialogDescription({
126
+ className,
127
+ ...props
128
+ }: DialogPrimitive.Description.Props) {
129
+ return (
130
+ <DialogPrimitive.Description
131
+ data-slot="dialog-description"
132
+ className={cn(
133
+ "text-muted-foreground *:[a]:hover:text-foreground text-sm *:[a]:underline *:[a]:underline-offset-3",
134
+ className,
135
+ )}
136
+ {...props}
137
+ />
138
+ )
139
+ }
140
+
141
+ export {
142
+ Dialog,
143
+ DialogClose,
144
+ DialogContent,
145
+ DialogDescription,
146
+ DialogFooter,
147
+ DialogHeader,
148
+ DialogOverlay,
149
+ DialogPortal,
150
+ DialogTitle,
151
+ DialogTrigger,
152
+ }
@@ -0,0 +1,4 @@
1
+ export {
2
+ DirectionProvider,
3
+ useDirection,
4
+ } from "@base-ui/react/direction-provider"