itsi 0.2.16 → 0.2.18

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 (170) hide show
  1. checksums.yaml +4 -4
  2. data/.zed/settings.json +32 -0
  3. data/CHANGELOG.md +21 -0
  4. data/Cargo.lock +4 -2
  5. data/crates/itsi_acme/Cargo.toml +1 -1
  6. data/crates/itsi_scheduler/Cargo.toml +1 -1
  7. data/crates/itsi_server/Cargo.toml +3 -1
  8. data/crates/itsi_server/src/lib.rs +6 -1
  9. data/crates/itsi_server/src/ruby_types/itsi_body_proxy/mod.rs +2 -0
  10. data/crates/itsi_server/src/ruby_types/itsi_grpc_call.rs +4 -4
  11. data/crates/itsi_server/src/ruby_types/itsi_grpc_response_stream/mod.rs +14 -13
  12. data/crates/itsi_server/src/ruby_types/itsi_http_request.rs +64 -33
  13. data/crates/itsi_server/src/ruby_types/itsi_http_response.rs +151 -152
  14. data/crates/itsi_server/src/ruby_types/itsi_server/file_watcher.rs +422 -110
  15. data/crates/itsi_server/src/ruby_types/itsi_server/itsi_server_config.rs +62 -15
  16. data/crates/itsi_server/src/ruby_types/itsi_server.rs +1 -1
  17. data/crates/itsi_server/src/server/binds/listener.rs +45 -7
  18. data/crates/itsi_server/src/server/frame_stream.rs +142 -0
  19. data/crates/itsi_server/src/server/http_message_types.rs +142 -9
  20. data/crates/itsi_server/src/server/io_stream.rs +28 -5
  21. data/crates/itsi_server/src/server/lifecycle_event.rs +1 -1
  22. data/crates/itsi_server/src/server/middleware_stack/middlewares/auth_basic.rs +2 -3
  23. data/crates/itsi_server/src/server/middleware_stack/middlewares/compression.rs +8 -10
  24. data/crates/itsi_server/src/server/middleware_stack/middlewares/cors.rs +2 -3
  25. data/crates/itsi_server/src/server/middleware_stack/middlewares/csp.rs +3 -3
  26. data/crates/itsi_server/src/server/middleware_stack/middlewares/error_response/default_responses.rs +54 -56
  27. data/crates/itsi_server/src/server/middleware_stack/middlewares/error_response.rs +5 -7
  28. data/crates/itsi_server/src/server/middleware_stack/middlewares/etag.rs +5 -5
  29. data/crates/itsi_server/src/server/middleware_stack/middlewares/proxy.rs +7 -10
  30. data/crates/itsi_server/src/server/middleware_stack/middlewares/redirect.rs +2 -3
  31. data/crates/itsi_server/src/server/middleware_stack/middlewares/static_assets.rs +1 -2
  32. data/crates/itsi_server/src/server/middleware_stack/middlewares/static_response.rs +4 -6
  33. data/crates/itsi_server/src/server/mod.rs +1 -0
  34. data/crates/itsi_server/src/server/process_worker.rs +3 -4
  35. data/crates/itsi_server/src/server/serve_strategy/acceptor.rs +16 -12
  36. data/crates/itsi_server/src/server/serve_strategy/cluster_mode.rs +83 -31
  37. data/crates/itsi_server/src/server/serve_strategy/single_mode.rs +166 -142
  38. data/crates/itsi_server/src/server/signal.rs +37 -9
  39. data/crates/itsi_server/src/server/thread_worker.rs +84 -69
  40. data/crates/itsi_server/src/services/itsi_http_service.rs +43 -43
  41. data/crates/itsi_server/src/services/static_file_server.rs +28 -47
  42. data/docs/benchmark-dashboard/.gitignore +27 -0
  43. data/docs/benchmark-dashboard/app/api/benchmarks/route.ts +22 -0
  44. data/docs/benchmark-dashboard/app/globals.css +94 -0
  45. data/docs/benchmark-dashboard/app/layout.tsx +20 -0
  46. data/docs/benchmark-dashboard/app/page.tsx +252 -0
  47. data/docs/benchmark-dashboard/components/benchmark-dashboard.tsx +1663 -0
  48. data/docs/benchmark-dashboard/components/theme-provider.tsx +11 -0
  49. data/docs/benchmark-dashboard/components/ui/accordion.tsx +58 -0
  50. data/docs/benchmark-dashboard/components/ui/alert-dialog.tsx +141 -0
  51. data/docs/benchmark-dashboard/components/ui/alert.tsx +59 -0
  52. data/docs/benchmark-dashboard/components/ui/aspect-ratio.tsx +7 -0
  53. data/docs/benchmark-dashboard/components/ui/avatar.tsx +50 -0
  54. data/docs/benchmark-dashboard/components/ui/badge.tsx +36 -0
  55. data/docs/benchmark-dashboard/components/ui/breadcrumb.tsx +115 -0
  56. data/docs/benchmark-dashboard/components/ui/button.tsx +56 -0
  57. data/docs/benchmark-dashboard/components/ui/calendar.tsx +66 -0
  58. data/docs/benchmark-dashboard/components/ui/card.tsx +79 -0
  59. data/docs/benchmark-dashboard/components/ui/carousel.tsx +262 -0
  60. data/docs/benchmark-dashboard/components/ui/chart.tsx +365 -0
  61. data/docs/benchmark-dashboard/components/ui/checkbox.tsx +30 -0
  62. data/docs/benchmark-dashboard/components/ui/collapsible.tsx +11 -0
  63. data/docs/benchmark-dashboard/components/ui/command.tsx +153 -0
  64. data/docs/benchmark-dashboard/components/ui/context-menu.tsx +200 -0
  65. data/docs/benchmark-dashboard/components/ui/dialog.tsx +122 -0
  66. data/docs/benchmark-dashboard/components/ui/drawer.tsx +118 -0
  67. data/docs/benchmark-dashboard/components/ui/dropdown-menu.tsx +200 -0
  68. data/docs/benchmark-dashboard/components/ui/form.tsx +178 -0
  69. data/docs/benchmark-dashboard/components/ui/hover-card.tsx +29 -0
  70. data/docs/benchmark-dashboard/components/ui/input-otp.tsx +71 -0
  71. data/docs/benchmark-dashboard/components/ui/input.tsx +22 -0
  72. data/docs/benchmark-dashboard/components/ui/label.tsx +26 -0
  73. data/docs/benchmark-dashboard/components/ui/loading-spinner.tsx +12 -0
  74. data/docs/benchmark-dashboard/components/ui/menubar.tsx +236 -0
  75. data/docs/benchmark-dashboard/components/ui/navigation-menu.tsx +128 -0
  76. data/docs/benchmark-dashboard/components/ui/pagination.tsx +117 -0
  77. data/docs/benchmark-dashboard/components/ui/popover.tsx +31 -0
  78. data/docs/benchmark-dashboard/components/ui/progress.tsx +28 -0
  79. data/docs/benchmark-dashboard/components/ui/radio-group.tsx +44 -0
  80. data/docs/benchmark-dashboard/components/ui/resizable.tsx +45 -0
  81. data/docs/benchmark-dashboard/components/ui/scroll-area.tsx +48 -0
  82. data/docs/benchmark-dashboard/components/ui/select.tsx +160 -0
  83. data/docs/benchmark-dashboard/components/ui/separator.tsx +31 -0
  84. data/docs/benchmark-dashboard/components/ui/sheet.tsx +140 -0
  85. data/docs/benchmark-dashboard/components/ui/sidebar.tsx +763 -0
  86. data/docs/benchmark-dashboard/components/ui/skeleton.tsx +15 -0
  87. data/docs/benchmark-dashboard/components/ui/slider.tsx +28 -0
  88. data/docs/benchmark-dashboard/components/ui/sonner.tsx +31 -0
  89. data/docs/benchmark-dashboard/components/ui/switch.tsx +29 -0
  90. data/docs/benchmark-dashboard/components/ui/table.tsx +117 -0
  91. data/docs/benchmark-dashboard/components/ui/tabs.tsx +55 -0
  92. data/docs/benchmark-dashboard/components/ui/textarea.tsx +22 -0
  93. data/docs/benchmark-dashboard/components/ui/toast.tsx +129 -0
  94. data/docs/benchmark-dashboard/components/ui/toaster.tsx +35 -0
  95. data/docs/benchmark-dashboard/components/ui/toggle-group.tsx +61 -0
  96. data/docs/benchmark-dashboard/components/ui/toggle.tsx +45 -0
  97. data/docs/benchmark-dashboard/components/ui/tooltip.tsx +30 -0
  98. data/docs/benchmark-dashboard/components/ui/use-mobile.tsx +19 -0
  99. data/docs/benchmark-dashboard/components/ui/use-toast.ts +194 -0
  100. data/docs/benchmark-dashboard/components.json +21 -0
  101. data/docs/benchmark-dashboard/dist/benchmark-dashboard.css +1 -0
  102. data/docs/benchmark-dashboard/dist/benchmark-dashboard.iife.js +211 -0
  103. data/docs/benchmark-dashboard/dist/placeholder-logo.png +0 -0
  104. data/docs/benchmark-dashboard/dist/placeholder-logo.svg +1 -0
  105. data/docs/benchmark-dashboard/dist/placeholder-user.jpg +0 -0
  106. data/docs/benchmark-dashboard/dist/placeholder.jpg +0 -0
  107. data/docs/benchmark-dashboard/dist/placeholder.svg +1 -0
  108. data/docs/benchmark-dashboard/embed.tsx +13 -0
  109. data/docs/benchmark-dashboard/hooks/use-mobile.tsx +19 -0
  110. data/docs/benchmark-dashboard/hooks/use-toast.ts +194 -0
  111. data/docs/benchmark-dashboard/lib/benchmark-utils.ts +54 -0
  112. data/docs/benchmark-dashboard/lib/utils.ts +6 -0
  113. data/docs/benchmark-dashboard/next.config.mjs +14 -0
  114. data/docs/benchmark-dashboard/package-lock.json +5859 -0
  115. data/docs/benchmark-dashboard/package.json +72 -0
  116. data/docs/benchmark-dashboard/pnpm-lock.yaml +5 -0
  117. data/docs/benchmark-dashboard/postcss.config.mjs +8 -0
  118. data/docs/benchmark-dashboard/styles/globals.css +94 -0
  119. data/docs/benchmark-dashboard/tailwind.config.ts +96 -0
  120. data/docs/benchmark-dashboard/tsconfig.json +27 -0
  121. data/docs/benchmark-dashboard/vite.config.ts +24 -0
  122. data/docs/build.rb +52 -0
  123. data/docs/content/acknowledgements/_index.md +1 -1
  124. data/docs/content/benchmarks/index.md +96 -0
  125. data/docs/content/configuration/_index.md +2 -2
  126. data/docs/content/getting_started/_index.md +76 -46
  127. data/docs/content/itsi_scheduler/_index.md +2 -2
  128. data/docs/hugo.yaml +10 -1
  129. data/docs/static/results.json +1 -0
  130. data/docs/static/scripts/benchmark-dashboard.iife.js +211 -0
  131. data/docs/static/styles/benchmark-dashboard.css +1 -0
  132. data/examples/api_with_schema_and_controllers/README.md +1 -1
  133. data/gems/scheduler/Cargo.lock +1 -1
  134. data/gems/scheduler/lib/itsi/scheduler/version.rb +1 -1
  135. data/gems/server/Cargo.lock +3 -1
  136. data/gems/server/exe/itsi +8 -5
  137. data/gems/server/lib/itsi/http_request.rb +31 -39
  138. data/gems/server/lib/itsi/http_response.rb +5 -0
  139. data/gems/server/lib/itsi/rack_env_pool.rb +59 -0
  140. data/gems/server/lib/itsi/server/config/dsl.rb +6 -4
  141. data/gems/server/lib/itsi/server/config/middleware/compression.md +3 -3
  142. data/gems/server/lib/itsi/server/config/middleware/endpoint/controller.md +1 -1
  143. data/gems/server/lib/itsi/server/config/middleware/proxy.md +2 -2
  144. data/gems/server/lib/itsi/server/config/middleware/proxy.rb +1 -1
  145. data/gems/server/lib/itsi/server/config/middleware/rackup_file.rb +2 -2
  146. data/gems/server/lib/itsi/server/config/options/auto_reload_config.rb +11 -6
  147. data/gems/server/lib/itsi/server/config/options/include.md +1 -0
  148. data/gems/server/lib/itsi/server/config/options/include.rb +13 -8
  149. data/gems/server/lib/itsi/server/config/options/pipeline_flush.md +16 -0
  150. data/gems/server/lib/itsi/server/config/options/pipeline_flush.rb +19 -0
  151. data/gems/server/lib/itsi/server/config/options/reuse_port.rb +2 -4
  152. data/gems/server/lib/itsi/server/config/options/writev.md +25 -0
  153. data/gems/server/lib/itsi/server/config/options/writev.rb +19 -0
  154. data/gems/server/lib/itsi/server/config.rb +22 -9
  155. data/gems/server/lib/itsi/server/default_config/Itsi.rb +9 -8
  156. data/gems/server/lib/itsi/server/grpc/grpc_call.rb +2 -0
  157. data/gems/server/lib/itsi/server/grpc/grpc_interface.rb +2 -2
  158. data/gems/server/lib/itsi/server/rack/handler/itsi.rb +3 -1
  159. data/gems/server/lib/itsi/server/rack_interface.rb +17 -12
  160. data/gems/server/lib/itsi/server/scheduler_interface.rb +2 -0
  161. data/gems/server/lib/itsi/server/version.rb +1 -1
  162. data/gems/server/lib/itsi/server.rb +1 -0
  163. data/gems/server/lib/ruby_lsp/itsi/addon.rb +12 -13
  164. data/gems/server/test/helpers/test_helper.rb +12 -13
  165. data/gems/server/test/middleware/grpc/grpc.rb +13 -14
  166. data/gems/server/test/middleware/grpc/test_service_impl.rb +3 -3
  167. data/gems/server/test/middleware/proxy.rb +262 -268
  168. data/lib/itsi/version.rb +1 -1
  169. metadata +97 -6
  170. data/tasks.txt +0 -28
@@ -0,0 +1,153 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { type DialogProps } from "@radix-ui/react-dialog"
5
+ import { Command as CommandPrimitive } from "cmdk"
6
+ import { Search } from "lucide-react"
7
+
8
+ import { cn } from "@/lib/utils"
9
+ import { Dialog, DialogContent } from "@/components/ui/dialog"
10
+
11
+ const Command = React.forwardRef<
12
+ React.ElementRef<typeof CommandPrimitive>,
13
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive>
14
+ >(({ className, ...props }, ref) => (
15
+ <CommandPrimitive
16
+ ref={ref}
17
+ className={cn(
18
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
19
+ className
20
+ )}
21
+ {...props}
22
+ />
23
+ ))
24
+ Command.displayName = CommandPrimitive.displayName
25
+
26
+ const CommandDialog = ({ children, ...props }: DialogProps) => {
27
+ return (
28
+ <Dialog {...props}>
29
+ <DialogContent className="overflow-hidden p-0 shadow-lg">
30
+ <Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
31
+ {children}
32
+ </Command>
33
+ </DialogContent>
34
+ </Dialog>
35
+ )
36
+ }
37
+
38
+ const CommandInput = React.forwardRef<
39
+ React.ElementRef<typeof CommandPrimitive.Input>,
40
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
41
+ >(({ className, ...props }, ref) => (
42
+ <div className="flex items-center border-b px-3" cmdk-input-wrapper="">
43
+ <Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
44
+ <CommandPrimitive.Input
45
+ ref={ref}
46
+ className={cn(
47
+ "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
48
+ className
49
+ )}
50
+ {...props}
51
+ />
52
+ </div>
53
+ ))
54
+
55
+ CommandInput.displayName = CommandPrimitive.Input.displayName
56
+
57
+ const CommandList = React.forwardRef<
58
+ React.ElementRef<typeof CommandPrimitive.List>,
59
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>
60
+ >(({ className, ...props }, ref) => (
61
+ <CommandPrimitive.List
62
+ ref={ref}
63
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
64
+ {...props}
65
+ />
66
+ ))
67
+
68
+ CommandList.displayName = CommandPrimitive.List.displayName
69
+
70
+ const CommandEmpty = React.forwardRef<
71
+ React.ElementRef<typeof CommandPrimitive.Empty>,
72
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
73
+ >((props, ref) => (
74
+ <CommandPrimitive.Empty
75
+ ref={ref}
76
+ className="py-6 text-center text-sm"
77
+ {...props}
78
+ />
79
+ ))
80
+
81
+ CommandEmpty.displayName = CommandPrimitive.Empty.displayName
82
+
83
+ const CommandGroup = React.forwardRef<
84
+ React.ElementRef<typeof CommandPrimitive.Group>,
85
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>
86
+ >(({ className, ...props }, ref) => (
87
+ <CommandPrimitive.Group
88
+ ref={ref}
89
+ className={cn(
90
+ "overflow-hidden p-1 text-foreground [&_[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",
91
+ className
92
+ )}
93
+ {...props}
94
+ />
95
+ ))
96
+
97
+ CommandGroup.displayName = CommandPrimitive.Group.displayName
98
+
99
+ const CommandSeparator = React.forwardRef<
100
+ React.ElementRef<typeof CommandPrimitive.Separator>,
101
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>
102
+ >(({ className, ...props }, ref) => (
103
+ <CommandPrimitive.Separator
104
+ ref={ref}
105
+ className={cn("-mx-1 h-px bg-border", className)}
106
+ {...props}
107
+ />
108
+ ))
109
+ CommandSeparator.displayName = CommandPrimitive.Separator.displayName
110
+
111
+ const CommandItem = React.forwardRef<
112
+ React.ElementRef<typeof CommandPrimitive.Item>,
113
+ React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>
114
+ >(({ className, ...props }, ref) => (
115
+ <CommandPrimitive.Item
116
+ ref={ref}
117
+ className={cn(
118
+ "relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
119
+ className
120
+ )}
121
+ {...props}
122
+ />
123
+ ))
124
+
125
+ CommandItem.displayName = CommandPrimitive.Item.displayName
126
+
127
+ const CommandShortcut = ({
128
+ className,
129
+ ...props
130
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
131
+ return (
132
+ <span
133
+ className={cn(
134
+ "ml-auto text-xs tracking-widest text-muted-foreground",
135
+ className
136
+ )}
137
+ {...props}
138
+ />
139
+ )
140
+ }
141
+ CommandShortcut.displayName = "CommandShortcut"
142
+
143
+ export {
144
+ Command,
145
+ CommandDialog,
146
+ CommandInput,
147
+ CommandList,
148
+ CommandEmpty,
149
+ CommandGroup,
150
+ CommandItem,
151
+ CommandShortcut,
152
+ CommandSeparator,
153
+ }
@@ -0,0 +1,200 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as ContextMenuPrimitive from "@radix-ui/react-context-menu"
5
+ import { Check, ChevronRight, Circle } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ const ContextMenu = ContextMenuPrimitive.Root
10
+
11
+ const ContextMenuTrigger = ContextMenuPrimitive.Trigger
12
+
13
+ const ContextMenuGroup = ContextMenuPrimitive.Group
14
+
15
+ const ContextMenuPortal = ContextMenuPrimitive.Portal
16
+
17
+ const ContextMenuSub = ContextMenuPrimitive.Sub
18
+
19
+ const ContextMenuRadioGroup = ContextMenuPrimitive.RadioGroup
20
+
21
+ const ContextMenuSubTrigger = React.forwardRef<
22
+ React.ElementRef<typeof ContextMenuPrimitive.SubTrigger>,
23
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubTrigger> & {
24
+ inset?: boolean
25
+ }
26
+ >(({ className, inset, children, ...props }, ref) => (
27
+ <ContextMenuPrimitive.SubTrigger
28
+ ref={ref}
29
+ className={cn(
30
+ "flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
31
+ inset && "pl-8",
32
+ className
33
+ )}
34
+ {...props}
35
+ >
36
+ {children}
37
+ <ChevronRight className="ml-auto h-4 w-4" />
38
+ </ContextMenuPrimitive.SubTrigger>
39
+ ))
40
+ ContextMenuSubTrigger.displayName = ContextMenuPrimitive.SubTrigger.displayName
41
+
42
+ const ContextMenuSubContent = React.forwardRef<
43
+ React.ElementRef<typeof ContextMenuPrimitive.SubContent>,
44
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.SubContent>
45
+ >(({ className, ...props }, ref) => (
46
+ <ContextMenuPrimitive.SubContent
47
+ ref={ref}
48
+ className={cn(
49
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",
50
+ className
51
+ )}
52
+ {...props}
53
+ />
54
+ ))
55
+ ContextMenuSubContent.displayName = ContextMenuPrimitive.SubContent.displayName
56
+
57
+ const ContextMenuContent = React.forwardRef<
58
+ React.ElementRef<typeof ContextMenuPrimitive.Content>,
59
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
60
+ >(({ className, ...props }, ref) => (
61
+ <ContextMenuPrimitive.Portal>
62
+ <ContextMenuPrimitive.Content
63
+ ref={ref}
64
+ className={cn(
65
+ "z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",
66
+ className
67
+ )}
68
+ {...props}
69
+ />
70
+ </ContextMenuPrimitive.Portal>
71
+ ))
72
+ ContextMenuContent.displayName = ContextMenuPrimitive.Content.displayName
73
+
74
+ const ContextMenuItem = React.forwardRef<
75
+ React.ElementRef<typeof ContextMenuPrimitive.Item>,
76
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Item> & {
77
+ inset?: boolean
78
+ }
79
+ >(({ className, inset, ...props }, ref) => (
80
+ <ContextMenuPrimitive.Item
81
+ ref={ref}
82
+ className={cn(
83
+ "relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
84
+ inset && "pl-8",
85
+ className
86
+ )}
87
+ {...props}
88
+ />
89
+ ))
90
+ ContextMenuItem.displayName = ContextMenuPrimitive.Item.displayName
91
+
92
+ const ContextMenuCheckboxItem = React.forwardRef<
93
+ React.ElementRef<typeof ContextMenuPrimitive.CheckboxItem>,
94
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.CheckboxItem>
95
+ >(({ className, children, checked, ...props }, ref) => (
96
+ <ContextMenuPrimitive.CheckboxItem
97
+ ref={ref}
98
+ className={cn(
99
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
100
+ className
101
+ )}
102
+ checked={checked}
103
+ {...props}
104
+ >
105
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
106
+ <ContextMenuPrimitive.ItemIndicator>
107
+ <Check className="h-4 w-4" />
108
+ </ContextMenuPrimitive.ItemIndicator>
109
+ </span>
110
+ {children}
111
+ </ContextMenuPrimitive.CheckboxItem>
112
+ ))
113
+ ContextMenuCheckboxItem.displayName =
114
+ ContextMenuPrimitive.CheckboxItem.displayName
115
+
116
+ const ContextMenuRadioItem = React.forwardRef<
117
+ React.ElementRef<typeof ContextMenuPrimitive.RadioItem>,
118
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.RadioItem>
119
+ >(({ className, children, ...props }, ref) => (
120
+ <ContextMenuPrimitive.RadioItem
121
+ ref={ref}
122
+ className={cn(
123
+ "relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
124
+ className
125
+ )}
126
+ {...props}
127
+ >
128
+ <span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
129
+ <ContextMenuPrimitive.ItemIndicator>
130
+ <Circle className="h-2 w-2 fill-current" />
131
+ </ContextMenuPrimitive.ItemIndicator>
132
+ </span>
133
+ {children}
134
+ </ContextMenuPrimitive.RadioItem>
135
+ ))
136
+ ContextMenuRadioItem.displayName = ContextMenuPrimitive.RadioItem.displayName
137
+
138
+ const ContextMenuLabel = React.forwardRef<
139
+ React.ElementRef<typeof ContextMenuPrimitive.Label>,
140
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Label> & {
141
+ inset?: boolean
142
+ }
143
+ >(({ className, inset, ...props }, ref) => (
144
+ <ContextMenuPrimitive.Label
145
+ ref={ref}
146
+ className={cn(
147
+ "px-2 py-1.5 text-sm font-semibold text-foreground",
148
+ inset && "pl-8",
149
+ className
150
+ )}
151
+ {...props}
152
+ />
153
+ ))
154
+ ContextMenuLabel.displayName = ContextMenuPrimitive.Label.displayName
155
+
156
+ const ContextMenuSeparator = React.forwardRef<
157
+ React.ElementRef<typeof ContextMenuPrimitive.Separator>,
158
+ React.ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Separator>
159
+ >(({ className, ...props }, ref) => (
160
+ <ContextMenuPrimitive.Separator
161
+ ref={ref}
162
+ className={cn("-mx-1 my-1 h-px bg-border", className)}
163
+ {...props}
164
+ />
165
+ ))
166
+ ContextMenuSeparator.displayName = ContextMenuPrimitive.Separator.displayName
167
+
168
+ const ContextMenuShortcut = ({
169
+ className,
170
+ ...props
171
+ }: React.HTMLAttributes<HTMLSpanElement>) => {
172
+ return (
173
+ <span
174
+ className={cn(
175
+ "ml-auto text-xs tracking-widest text-muted-foreground",
176
+ className
177
+ )}
178
+ {...props}
179
+ />
180
+ )
181
+ }
182
+ ContextMenuShortcut.displayName = "ContextMenuShortcut"
183
+
184
+ export {
185
+ ContextMenu,
186
+ ContextMenuTrigger,
187
+ ContextMenuContent,
188
+ ContextMenuItem,
189
+ ContextMenuCheckboxItem,
190
+ ContextMenuRadioItem,
191
+ ContextMenuLabel,
192
+ ContextMenuSeparator,
193
+ ContextMenuShortcut,
194
+ ContextMenuGroup,
195
+ ContextMenuPortal,
196
+ ContextMenuSub,
197
+ ContextMenuSubContent,
198
+ ContextMenuSubTrigger,
199
+ ContextMenuRadioGroup,
200
+ }
@@ -0,0 +1,122 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import * as DialogPrimitive from "@radix-ui/react-dialog"
5
+ import { X } from "lucide-react"
6
+
7
+ import { cn } from "@/lib/utils"
8
+
9
+ const Dialog = DialogPrimitive.Root
10
+
11
+ const DialogTrigger = DialogPrimitive.Trigger
12
+
13
+ const DialogPortal = DialogPrimitive.Portal
14
+
15
+ const DialogClose = DialogPrimitive.Close
16
+
17
+ const DialogOverlay = React.forwardRef<
18
+ React.ElementRef<typeof DialogPrimitive.Overlay>,
19
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
20
+ >(({ className, ...props }, ref) => (
21
+ <DialogPrimitive.Overlay
22
+ ref={ref}
23
+ className={cn(
24
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
25
+ className
26
+ )}
27
+ {...props}
28
+ />
29
+ ))
30
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
31
+
32
+ const DialogContent = React.forwardRef<
33
+ React.ElementRef<typeof DialogPrimitive.Content>,
34
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
35
+ >(({ className, children, ...props }, ref) => (
36
+ <DialogPortal>
37
+ <DialogOverlay />
38
+ <DialogPrimitive.Content
39
+ ref={ref}
40
+ className={cn(
41
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
42
+ className
43
+ )}
44
+ {...props}
45
+ >
46
+ {children}
47
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
48
+ <X className="h-4 w-4" />
49
+ <span className="sr-only">Close</span>
50
+ </DialogPrimitive.Close>
51
+ </DialogPrimitive.Content>
52
+ </DialogPortal>
53
+ ))
54
+ DialogContent.displayName = DialogPrimitive.Content.displayName
55
+
56
+ const DialogHeader = ({
57
+ className,
58
+ ...props
59
+ }: React.HTMLAttributes<HTMLDivElement>) => (
60
+ <div
61
+ className={cn(
62
+ "flex flex-col space-y-1.5 text-center sm:text-left",
63
+ className
64
+ )}
65
+ {...props}
66
+ />
67
+ )
68
+ DialogHeader.displayName = "DialogHeader"
69
+
70
+ const DialogFooter = ({
71
+ className,
72
+ ...props
73
+ }: React.HTMLAttributes<HTMLDivElement>) => (
74
+ <div
75
+ className={cn(
76
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
77
+ className
78
+ )}
79
+ {...props}
80
+ />
81
+ )
82
+ DialogFooter.displayName = "DialogFooter"
83
+
84
+ const DialogTitle = React.forwardRef<
85
+ React.ElementRef<typeof DialogPrimitive.Title>,
86
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
87
+ >(({ className, ...props }, ref) => (
88
+ <DialogPrimitive.Title
89
+ ref={ref}
90
+ className={cn(
91
+ "text-lg font-semibold leading-none tracking-tight",
92
+ className
93
+ )}
94
+ {...props}
95
+ />
96
+ ))
97
+ DialogTitle.displayName = DialogPrimitive.Title.displayName
98
+
99
+ const DialogDescription = React.forwardRef<
100
+ React.ElementRef<typeof DialogPrimitive.Description>,
101
+ React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
102
+ >(({ className, ...props }, ref) => (
103
+ <DialogPrimitive.Description
104
+ ref={ref}
105
+ className={cn("text-sm text-muted-foreground", className)}
106
+ {...props}
107
+ />
108
+ ))
109
+ DialogDescription.displayName = DialogPrimitive.Description.displayName
110
+
111
+ export {
112
+ Dialog,
113
+ DialogPortal,
114
+ DialogOverlay,
115
+ DialogClose,
116
+ DialogTrigger,
117
+ DialogContent,
118
+ DialogHeader,
119
+ DialogFooter,
120
+ DialogTitle,
121
+ DialogDescription,
122
+ }
@@ -0,0 +1,118 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { Drawer as DrawerPrimitive } from "vaul"
5
+
6
+ import { cn } from "@/lib/utils"
7
+
8
+ const Drawer = ({
9
+ shouldScaleBackground = true,
10
+ ...props
11
+ }: React.ComponentProps<typeof DrawerPrimitive.Root>) => (
12
+ <DrawerPrimitive.Root
13
+ shouldScaleBackground={shouldScaleBackground}
14
+ {...props}
15
+ />
16
+ )
17
+ Drawer.displayName = "Drawer"
18
+
19
+ const DrawerTrigger = DrawerPrimitive.Trigger
20
+
21
+ const DrawerPortal = DrawerPrimitive.Portal
22
+
23
+ const DrawerClose = DrawerPrimitive.Close
24
+
25
+ const DrawerOverlay = React.forwardRef<
26
+ React.ElementRef<typeof DrawerPrimitive.Overlay>,
27
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Overlay>
28
+ >(({ className, ...props }, ref) => (
29
+ <DrawerPrimitive.Overlay
30
+ ref={ref}
31
+ className={cn("fixed inset-0 z-50 bg-black/80", className)}
32
+ {...props}
33
+ />
34
+ ))
35
+ DrawerOverlay.displayName = DrawerPrimitive.Overlay.displayName
36
+
37
+ const DrawerContent = React.forwardRef<
38
+ React.ElementRef<typeof DrawerPrimitive.Content>,
39
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content>
40
+ >(({ className, children, ...props }, ref) => (
41
+ <DrawerPortal>
42
+ <DrawerOverlay />
43
+ <DrawerPrimitive.Content
44
+ ref={ref}
45
+ className={cn(
46
+ "fixed inset-x-0 bottom-0 z-50 mt-24 flex h-auto flex-col rounded-t-[10px] border bg-background",
47
+ className
48
+ )}
49
+ {...props}
50
+ >
51
+ <div className="mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted" />
52
+ {children}
53
+ </DrawerPrimitive.Content>
54
+ </DrawerPortal>
55
+ ))
56
+ DrawerContent.displayName = "DrawerContent"
57
+
58
+ const DrawerHeader = ({
59
+ className,
60
+ ...props
61
+ }: React.HTMLAttributes<HTMLDivElement>) => (
62
+ <div
63
+ className={cn("grid gap-1.5 p-4 text-center sm:text-left", className)}
64
+ {...props}
65
+ />
66
+ )
67
+ DrawerHeader.displayName = "DrawerHeader"
68
+
69
+ const DrawerFooter = ({
70
+ className,
71
+ ...props
72
+ }: React.HTMLAttributes<HTMLDivElement>) => (
73
+ <div
74
+ className={cn("mt-auto flex flex-col gap-2 p-4", className)}
75
+ {...props}
76
+ />
77
+ )
78
+ DrawerFooter.displayName = "DrawerFooter"
79
+
80
+ const DrawerTitle = React.forwardRef<
81
+ React.ElementRef<typeof DrawerPrimitive.Title>,
82
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Title>
83
+ >(({ className, ...props }, ref) => (
84
+ <DrawerPrimitive.Title
85
+ ref={ref}
86
+ className={cn(
87
+ "text-lg font-semibold leading-none tracking-tight",
88
+ className
89
+ )}
90
+ {...props}
91
+ />
92
+ ))
93
+ DrawerTitle.displayName = DrawerPrimitive.Title.displayName
94
+
95
+ const DrawerDescription = React.forwardRef<
96
+ React.ElementRef<typeof DrawerPrimitive.Description>,
97
+ React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Description>
98
+ >(({ className, ...props }, ref) => (
99
+ <DrawerPrimitive.Description
100
+ ref={ref}
101
+ className={cn("text-sm text-muted-foreground", className)}
102
+ {...props}
103
+ />
104
+ ))
105
+ DrawerDescription.displayName = DrawerPrimitive.Description.displayName
106
+
107
+ export {
108
+ Drawer,
109
+ DrawerPortal,
110
+ DrawerOverlay,
111
+ DrawerTrigger,
112
+ DrawerClose,
113
+ DrawerContent,
114
+ DrawerHeader,
115
+ DrawerFooter,
116
+ DrawerTitle,
117
+ DrawerDescription,
118
+ }