@motiadev/workbench 0.0.6 → 0.0.8

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 (192) hide show
  1. package/dist/README.md +50 -0
  2. package/dist/index.d.ts +0 -1
  3. package/{index.html → dist/index.html} +1 -1
  4. package/dist/middleware.d.ts +2 -2
  5. package/dist/middleware.js +10 -12
  6. package/dist/package.json +58 -0
  7. package/dist/src/components/app-sidebar.d.ts +0 -1
  8. package/dist/src/components/app-sidebar.js +5 -6
  9. package/dist/src/components/log-console.d.ts +0 -1
  10. package/dist/src/components/log-level-badge.d.ts +0 -1
  11. package/dist/src/components/ui/badge.d.ts +1 -2
  12. package/dist/src/components/ui/button.d.ts +1 -2
  13. package/dist/src/components/ui/collapsible.d.ts +0 -1
  14. package/dist/src/components/ui/dialog.d.ts +0 -1
  15. package/dist/src/components/ui/input.d.ts +0 -1
  16. package/dist/src/components/ui/label.d.ts +0 -1
  17. package/dist/src/components/ui/select.d.ts +0 -1
  18. package/dist/src/components/ui/separator.d.ts +0 -1
  19. package/dist/src/components/ui/sheet.d.ts +1 -2
  20. package/dist/src/components/ui/sidebar.d.ts +0 -1
  21. package/dist/src/components/ui/skeleton.d.ts +0 -1
  22. package/dist/src/components/ui/switch.d.ts +0 -1
  23. package/dist/src/components/ui/table.d.ts +0 -1
  24. package/dist/src/components/ui/textarea.d.ts +0 -1
  25. package/dist/src/components/ui/tooltip.d.ts +0 -1
  26. package/dist/src/hooks/use-list-flows.d.ts +0 -1
  27. package/dist/src/hooks/use-log-listener.d.ts +0 -1
  28. package/dist/src/hooks/use-mobile.d.ts +0 -1
  29. package/dist/src/lib/utils.d.ts +0 -1
  30. package/dist/src/main.d.ts +0 -8
  31. package/dist/src/main.js +6 -7
  32. package/dist/src/publicComponents/api-node.d.ts +0 -1
  33. package/dist/src/publicComponents/base-handle.d.ts +0 -1
  34. package/dist/src/publicComponents/base-node.d.ts +0 -1
  35. package/dist/src/publicComponents/emits.d.ts +0 -1
  36. package/dist/src/publicComponents/event-node.d.ts +0 -1
  37. package/dist/src/publicComponents/node-props.d.ts +0 -1
  38. package/dist/src/publicComponents/noop-node.d.ts +0 -1
  39. package/dist/src/publicComponents/subscribe.d.ts +0 -1
  40. package/dist/src/route-wrapper.d.ts +0 -1
  41. package/dist/src/routes/flow.d.ts +1 -0
  42. package/dist/src/routes/flow.js +16 -0
  43. package/dist/src/routes/index.d.ts +1 -2
  44. package/dist/src/routes/index.js +2 -6
  45. package/dist/src/stores/use-logs.d.ts +0 -1
  46. package/dist/src/views/flow/arrow-head.d.ts +0 -1
  47. package/dist/src/views/flow/base-edge.d.ts +0 -1
  48. package/dist/src/views/flow/flow-loader.d.ts +0 -1
  49. package/dist/src/views/flow/flow-view.d.ts +0 -1
  50. package/dist/src/views/flow/hooks/use-get-flow-state.d.ts +0 -1
  51. package/dist/src/views/flow/hooks/use-organize-nodes.d.ts +0 -1
  52. package/dist/src/views/flow/legend.d.ts +0 -1
  53. package/dist/src/views/flow/node-organizer.d.ts +0 -1
  54. package/dist/src/views/flow/nodes/api-flow-node.d.ts +0 -1
  55. package/dist/src/views/flow/nodes/event-flow-node.d.ts +0 -1
  56. package/dist/src/views/flow/nodes/json-schema-form.d.ts +0 -1
  57. package/dist/src/views/flow/nodes/language-indicator.d.ts +0 -1
  58. package/dist/src/views/flow/nodes/nodes.types.d.ts +0 -1
  59. package/dist/src/views/flow/nodes/noop-flow-node.d.ts +0 -1
  60. package/dist/tailwind.config.d.ts +0 -1
  61. package/dist/tsconfig.app.tsbuildinfo +1 -1
  62. package/dist/tsconfig.node.tsbuildinfo +1 -1
  63. package/dist/vite.config.d.ts +1 -10
  64. package/dist/vite.config.js +4 -5
  65. package/package.json +3 -3
  66. package/dist/index.d.ts.map +0 -1
  67. package/dist/middleware.d.ts.map +0 -1
  68. package/dist/src/components/app-sidebar.d.ts.map +0 -1
  69. package/dist/src/components/log-console.d.ts.map +0 -1
  70. package/dist/src/components/log-level-badge.d.ts.map +0 -1
  71. package/dist/src/components/ui/badge.d.ts.map +0 -1
  72. package/dist/src/components/ui/button.d.ts.map +0 -1
  73. package/dist/src/components/ui/collapsible.d.ts.map +0 -1
  74. package/dist/src/components/ui/dialog.d.ts.map +0 -1
  75. package/dist/src/components/ui/input.d.ts.map +0 -1
  76. package/dist/src/components/ui/label.d.ts.map +0 -1
  77. package/dist/src/components/ui/select.d.ts.map +0 -1
  78. package/dist/src/components/ui/separator.d.ts.map +0 -1
  79. package/dist/src/components/ui/sheet.d.ts.map +0 -1
  80. package/dist/src/components/ui/sidebar.d.ts.map +0 -1
  81. package/dist/src/components/ui/skeleton.d.ts.map +0 -1
  82. package/dist/src/components/ui/switch.d.ts.map +0 -1
  83. package/dist/src/components/ui/table.d.ts.map +0 -1
  84. package/dist/src/components/ui/textarea.d.ts.map +0 -1
  85. package/dist/src/components/ui/tooltip.d.ts.map +0 -1
  86. package/dist/src/hooks/use-list-flows.d.ts.map +0 -1
  87. package/dist/src/hooks/use-log-listener.d.ts.map +0 -1
  88. package/dist/src/hooks/use-mobile.d.ts.map +0 -1
  89. package/dist/src/lib/utils.d.ts.map +0 -1
  90. package/dist/src/main.d.ts.map +0 -1
  91. package/dist/src/publicComponents/api-node.d.ts.map +0 -1
  92. package/dist/src/publicComponents/base-handle.d.ts.map +0 -1
  93. package/dist/src/publicComponents/base-node.d.ts.map +0 -1
  94. package/dist/src/publicComponents/emits.d.ts.map +0 -1
  95. package/dist/src/publicComponents/event-node.d.ts.map +0 -1
  96. package/dist/src/publicComponents/node-props.d.ts.map +0 -1
  97. package/dist/src/publicComponents/noop-node.d.ts.map +0 -1
  98. package/dist/src/publicComponents/subscribe.d.ts.map +0 -1
  99. package/dist/src/route-wrapper.d.ts.map +0 -1
  100. package/dist/src/routeTree.gen.d.ts +0 -53
  101. package/dist/src/routeTree.gen.d.ts.map +0 -1
  102. package/dist/src/routeTree.gen.js +0 -45
  103. package/dist/src/routes/__root.d.ts +0 -2
  104. package/dist/src/routes/__root.d.ts.map +0 -1
  105. package/dist/src/routes/__root.js +0 -15
  106. package/dist/src/routes/flow/$id.d.ts +0 -4
  107. package/dist/src/routes/flow/$id.d.ts.map +0 -1
  108. package/dist/src/routes/flow/$id.js +0 -15
  109. package/dist/src/routes/index.d.ts.map +0 -1
  110. package/dist/src/stores/use-logs.d.ts.map +0 -1
  111. package/dist/src/views/flow/arrow-head.d.ts.map +0 -1
  112. package/dist/src/views/flow/base-edge.d.ts.map +0 -1
  113. package/dist/src/views/flow/flow-loader.d.ts.map +0 -1
  114. package/dist/src/views/flow/flow-view.d.ts.map +0 -1
  115. package/dist/src/views/flow/hooks/use-get-flow-state.d.ts.map +0 -1
  116. package/dist/src/views/flow/hooks/use-organize-nodes.d.ts.map +0 -1
  117. package/dist/src/views/flow/legend.d.ts.map +0 -1
  118. package/dist/src/views/flow/node-organizer.d.ts.map +0 -1
  119. package/dist/src/views/flow/nodes/api-flow-node.d.ts.map +0 -1
  120. package/dist/src/views/flow/nodes/event-flow-node.d.ts.map +0 -1
  121. package/dist/src/views/flow/nodes/json-schema-form.d.ts.map +0 -1
  122. package/dist/src/views/flow/nodes/language-indicator.d.ts.map +0 -1
  123. package/dist/src/views/flow/nodes/nodes.types.d.ts.map +0 -1
  124. package/dist/src/views/flow/nodes/noop-flow-node.d.ts.map +0 -1
  125. package/dist/tailwind.config.d.ts.map +0 -1
  126. package/dist/vite.config.d.ts.map +0 -1
  127. package/eslint.config.js +0 -28
  128. package/index.tsx +0 -10
  129. package/middleware.ts +0 -48
  130. package/src/assets/.empty +0 -0
  131. package/src/components/app-sidebar.tsx +0 -55
  132. package/src/components/log-console.tsx +0 -76
  133. package/src/components/log-level-badge.tsx +0 -12
  134. package/src/components/ui/badge.tsx +0 -31
  135. package/src/components/ui/button.tsx +0 -47
  136. package/src/components/ui/collapsible.tsx +0 -9
  137. package/src/components/ui/dialog.tsx +0 -120
  138. package/src/components/ui/input.tsx +0 -21
  139. package/src/components/ui/label.tsx +0 -26
  140. package/src/components/ui/select.tsx +0 -157
  141. package/src/components/ui/separator.tsx +0 -22
  142. package/src/components/ui/sheet.tsx +0 -106
  143. package/src/components/ui/sidebar.tsx +0 -637
  144. package/src/components/ui/skeleton.tsx +0 -7
  145. package/src/components/ui/switch.tsx +0 -27
  146. package/src/components/ui/table.tsx +0 -76
  147. package/src/components/ui/textarea.tsx +0 -22
  148. package/src/components/ui/tooltip.tsx +0 -32
  149. package/src/hooks/use-list-flows.tsx +0 -20
  150. package/src/hooks/use-log-listener.tsx +0 -32
  151. package/src/hooks/use-mobile.tsx +0 -19
  152. package/src/lib/utils.ts +0 -6
  153. package/src/main.tsx +0 -28
  154. package/src/publicComponents/api-node.tsx +0 -28
  155. package/src/publicComponents/base-handle.tsx +0 -43
  156. package/src/publicComponents/base-node.tsx +0 -57
  157. package/src/publicComponents/emits.tsx +0 -22
  158. package/src/publicComponents/event-node.tsx +0 -36
  159. package/src/publicComponents/node-props.tsx +0 -15
  160. package/src/publicComponents/noop-node.tsx +0 -21
  161. package/src/publicComponents/subscribe.tsx +0 -19
  162. package/src/route-wrapper.tsx +0 -9
  163. package/src/routeTree.gen.ts +0 -109
  164. package/src/routes/__root.tsx +0 -26
  165. package/src/routes/flow/$id.tsx +0 -21
  166. package/src/routes/index.tsx +0 -13
  167. package/src/stores/use-logs.ts +0 -22
  168. package/src/views/flow/arrow-head.tsx +0 -13
  169. package/src/views/flow/base-edge.tsx +0 -31
  170. package/src/views/flow/flow-loader.tsx +0 -3
  171. package/src/views/flow/flow-view.tsx +0 -72
  172. package/src/views/flow/hooks/use-get-flow-state.tsx +0 -93
  173. package/src/views/flow/hooks/use-organize-nodes.ts +0 -60
  174. package/src/views/flow/legend.tsx +0 -96
  175. package/src/views/flow/node-organizer.tsx +0 -70
  176. package/src/views/flow/nodes/api-flow-node.tsx +0 -6
  177. package/src/views/flow/nodes/event-flow-node.tsx +0 -6
  178. package/src/views/flow/nodes/json-schema-form.tsx +0 -110
  179. package/src/views/flow/nodes/language-indicator.tsx +0 -74
  180. package/src/views/flow/nodes/nodes.types.ts +0 -36
  181. package/src/views/flow/nodes/noop-flow-node.tsx +0 -6
  182. package/src/vite-env.d.ts +0 -1
  183. package/tailwind.config.ts +0 -75
  184. package/tsconfig.app.json +0 -32
  185. package/tsconfig.json +0 -14
  186. package/tsconfig.node.json +0 -32
  187. package/tsconfig.node.tsbuildinfo +0 -1
  188. package/vite.config.ts +0 -14
  189. /package/{components.json → dist/components.json} +0 -0
  190. /package/{postcss.config.js → dist/postcss.config.js} +0 -0
  191. /package/{public → dist/public}/.empty +0 -0
  192. /package/{src → dist/src}/index.css +0 -0
@@ -1,76 +0,0 @@
1
- import * as React from 'react'
2
-
3
- import { cn } from '@/lib/utils'
4
-
5
- const Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(
6
- ({ className, ...props }, ref) => (
7
- <div className="relative w-full overflow-auto">
8
- <table ref={ref} className={cn('w-full caption-bottom text-sm', className)} {...props} />
9
- </div>
10
- ),
11
- )
12
- Table.displayName = 'Table'
13
-
14
- const TableHeader = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
15
- ({ className, ...props }, ref) => <thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props} />,
16
- )
17
- TableHeader.displayName = 'TableHeader'
18
-
19
- const TableBody = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
20
- ({ className, ...props }, ref) => (
21
- <tbody ref={ref} className={cn('[&_tr:last-child]:border-0', className)} {...props} />
22
- ),
23
- )
24
- TableBody.displayName = 'TableBody'
25
-
26
- const TableFooter = React.forwardRef<HTMLTableSectionElement, React.HTMLAttributes<HTMLTableSectionElement>>(
27
- ({ className, ...props }, ref) => (
28
- <tfoot ref={ref} className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)} {...props} />
29
- ),
30
- )
31
- TableFooter.displayName = 'TableFooter'
32
-
33
- const TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(
34
- ({ className, ...props }, ref) => (
35
- <tr
36
- ref={ref}
37
- className={cn('border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted', className)}
38
- {...props}
39
- />
40
- ),
41
- )
42
- TableRow.displayName = 'TableRow'
43
-
44
- const TableHead = React.forwardRef<HTMLTableCellElement, React.ThHTMLAttributes<HTMLTableCellElement>>(
45
- ({ className, ...props }, ref) => (
46
- <th
47
- ref={ref}
48
- className={cn(
49
- 'h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
50
- className,
51
- )}
52
- {...props}
53
- />
54
- ),
55
- )
56
- TableHead.displayName = 'TableHead'
57
-
58
- const TableCell = React.forwardRef<HTMLTableCellElement, React.TdHTMLAttributes<HTMLTableCellElement>>(
59
- ({ className, ...props }, ref) => (
60
- <td
61
- ref={ref}
62
- className={cn('p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]', className)}
63
- {...props}
64
- />
65
- ),
66
- )
67
- TableCell.displayName = 'TableCell'
68
-
69
- const TableCaption = React.forwardRef<HTMLTableCaptionElement, React.HTMLAttributes<HTMLTableCaptionElement>>(
70
- ({ className, ...props }, ref) => (
71
- <caption ref={ref} className={cn('mt-4 text-sm text-muted-foreground', className)} {...props} />
72
- ),
73
- )
74
- TableCaption.displayName = 'TableCaption'
75
-
76
- export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption }
@@ -1,22 +0,0 @@
1
- import * as React from "react"
2
-
3
- import { cn } from "@/lib/utils"
4
-
5
- const Textarea = React.forwardRef<
6
- HTMLTextAreaElement,
7
- React.ComponentProps<"textarea">
8
- >(({ className, ...props }, ref) => {
9
- return (
10
- <textarea
11
- className={cn(
12
- "flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
13
- className
14
- )}
15
- ref={ref}
16
- {...props}
17
- />
18
- )
19
- })
20
- Textarea.displayName = "Textarea"
21
-
22
- export { Textarea }
@@ -1,32 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import * as TooltipPrimitive from '@radix-ui/react-tooltip'
5
-
6
- import { cn } from '@/lib/utils'
7
-
8
- const TooltipProvider = TooltipPrimitive.Provider
9
-
10
- const Tooltip = TooltipPrimitive.Root
11
-
12
- const TooltipTrigger = TooltipPrimitive.Trigger
13
-
14
- const TooltipContent = React.forwardRef<
15
- React.ElementRef<typeof TooltipPrimitive.Content>,
16
- React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
17
- >(({ className, sideOffset = 4, ...props }, ref) => (
18
- <TooltipPrimitive.Portal>
19
- <TooltipPrimitive.Content
20
- ref={ref}
21
- sideOffset={sideOffset}
22
- className={cn(
23
- 'z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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',
24
- className,
25
- )}
26
- {...props}
27
- />
28
- </TooltipPrimitive.Portal>
29
- ))
30
- TooltipContent.displayName = TooltipPrimitive.Content.displayName
31
-
32
- export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider }
@@ -1,20 +0,0 @@
1
- import { useEffect, useState } from 'react'
2
-
3
- type Flow = {
4
- id: string
5
- name: string
6
- }
7
-
8
- export const useListFlows = () => {
9
- const [isLoading, setIsLoading] = useState(true)
10
- const [flows, setFlows] = useState<Flow[]>([])
11
-
12
- useEffect(() => {
13
- fetch('/flows')
14
- .then((res) => res.json())
15
- .then(setFlows)
16
- .finally(() => setIsLoading(false))
17
- }, [])
18
-
19
- return { flows, isLoading }
20
- }
@@ -1,32 +0,0 @@
1
- import { Log, useLogs } from '@/stores/use-logs'
2
- import { useState, useEffect } from 'react'
3
- import { io } from 'socket.io-client'
4
-
5
- type UseWebSocketReturn = {
6
- isConnected: boolean
7
- }
8
-
9
- const socket = io('/')
10
-
11
- export const useLogListener = (): UseWebSocketReturn => {
12
- const [isConnected, setIsConnected] = useState(socket.connected)
13
- const addLog = useLogs((state) => state.addLog)
14
-
15
- useEffect(() => {
16
- const onConnect = () => setIsConnected(true)
17
- const onDisconnect = () => setIsConnected(false)
18
- const onLog = (log: Log) => addLog(log)
19
-
20
- socket.on('connect', onConnect)
21
- socket.on('disconnect', onDisconnect)
22
- socket.on('log', onLog)
23
-
24
- return () => {
25
- socket.off('connect', onConnect)
26
- socket.off('disconnect', onDisconnect)
27
- socket.off('log', onLog)
28
- }
29
- }, [addLog])
30
-
31
- return { isConnected }
32
- }
@@ -1,19 +0,0 @@
1
- import * as React from 'react'
2
-
3
- const MOBILE_BREAKPOINT = 768
4
-
5
- export function useIsMobile() {
6
- const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
7
-
8
- React.useEffect(() => {
9
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
10
- const onChange = () => {
11
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
12
- }
13
- mql.addEventListener('change', onChange)
14
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
15
- return () => mql.removeEventListener('change', onChange)
16
- }, [])
17
-
18
- return !!isMobile
19
- }
package/src/lib/utils.ts DELETED
@@ -1,6 +0,0 @@
1
- import { clsx, type ClassValue } from 'clsx'
2
- import { twMerge } from 'tailwind-merge'
3
-
4
- export function cn(...inputs: ClassValue[]) {
5
- return twMerge(clsx(inputs))
6
- }
package/src/main.tsx DELETED
@@ -1,28 +0,0 @@
1
- import { StrictMode } from 'react'
2
- import { createRoot } from 'react-dom/client'
3
- import './index.css'
4
- import { RouterProvider, createRouter } from '@tanstack/react-router'
5
-
6
- // Import the generated route tree
7
- import { routeTree } from './routeTree.gen'
8
-
9
- // Create a new router instance
10
- const router = createRouter({ routeTree })
11
-
12
- // Register the router instance for type safety
13
- declare module '@tanstack/react-router' {
14
- interface Register {
15
- router: typeof router
16
- }
17
- }
18
-
19
- // Render the app
20
- const rootElement = document.getElementById('root')!
21
- if (!rootElement.innerHTML) {
22
- const root = createRoot(rootElement)
23
- root.render(
24
- <StrictMode>
25
- <RouterProvider router={router} />
26
- </StrictMode>,
27
- )
28
- }
@@ -1,28 +0,0 @@
1
- import { Webhook } from 'lucide-react'
2
- import { PropsWithChildren } from 'react'
3
- import { BaseNode } from './base-node'
4
- import { Emits } from './emits'
5
- import { ApiNodeProps } from './node-props'
6
-
7
- type Props = PropsWithChildren<ApiNodeProps & { excludePubsub?: boolean }>
8
-
9
- export const ApiNode = ({ data, children, excludePubsub }: Props) => {
10
- return (
11
- <BaseNode
12
- variant="api"
13
- title={data.name}
14
- disableSourceHandle={!data.emits?.length}
15
- disableTargetHandle={!data.subscribes?.length}
16
- >
17
- {data.description && <div className="text-sm max-w-[300px] text-white/60">{data.description}</div>}
18
- {children}
19
- {data.webhookUrl && (
20
- <div className="flex gap-1 items-center text-xs text-white/60">
21
- <Webhook className="w-3 h-3 text-white/40" />
22
- <div className="font-mono">{data.webhookUrl}</div>
23
- </div>
24
- )}
25
- {!excludePubsub && <Emits emits={data.emits} />}
26
- </BaseNode>
27
- )
28
- }
@@ -1,43 +0,0 @@
1
- import React, { HTMLAttributes } from 'react'
2
- import { HandleProps, Position, Handle as RFHandle } from '@xyflow/react'
3
- import clsx from 'clsx'
4
-
5
- type Props = HandleProps &
6
- Omit<HTMLAttributes<HTMLDivElement>, 'id'> & {
7
- isHidden?: boolean
8
- }
9
-
10
- export const BaseHandle: React.FC<Props> = (props) => {
11
- const { isHidden, position, ...rest } = props
12
-
13
- return (
14
- <div
15
- className={clsx(
16
- 'absolute w-1 h-1',
17
- position === Position.Top && '-top-[10px]',
18
- position === Position.Bottom && '-bottom-[10px]',
19
- 'left-1/2 -ml-[2px]',
20
- isHidden && 'hidden',
21
- )}
22
- >
23
- <RFHandle
24
- {...rest}
25
- position={position}
26
- className="
27
- !static
28
- !w-1
29
- !h-1
30
- !min-w-[6px]
31
- !min-h-[6px]
32
- !p-0
33
- !border-none
34
- !bg-[#666666]
35
- !transform-none
36
- !rounded-full
37
- !outline-none
38
- !shadow-none
39
- "
40
- />
41
- </div>
42
- )
43
- }
@@ -1,57 +0,0 @@
1
- import { cn } from '@/lib/utils'
2
- import { Position } from '@xyflow/react'
3
- import { cva, type VariantProps } from 'class-variance-authority'
4
- import { PropsWithChildren } from 'react'
5
- import { BaseHandle } from './base-handle'
6
-
7
- const baseNodeVariants = cva('relative flex flex-col min-w-[300px] rounded-md overflow-hidden font-mono')
8
-
9
- const baseBackgroundVariants = cva('absolute -inset-[1px] rounded-md bg-gradient-to-r', {
10
- variants: {
11
- variant: {
12
- event: 'from-teal-500/20 to-teal-400/10',
13
- api: 'from-blue-500/20 to-blue-400/10',
14
- noop: 'from-white/20 to-white/10',
15
- },
16
- },
17
- })
18
-
19
- type Props = PropsWithChildren<{
20
- variant?: VariantProps<typeof baseBackgroundVariants>['variant']
21
- title: string
22
- headerChildren?: React.ReactNode
23
- className?: string
24
- disableSourceHandle?: boolean
25
- disableTargetHandle?: boolean
26
- }>
27
-
28
- const HeaderBar = ({ text, children }: { text: string; children?: React.ReactNode }) => (
29
- <div className="px-3 py-1 border-b border-white/20 bg-black/30 text-xs text-white/70 flex justify-between items-center">
30
- <span>{text}</span>
31
- {children}
32
- </div>
33
- )
34
-
35
- export const BaseNode = (props: Props) => {
36
- const { title, variant, className, children, disableSourceHandle, disableTargetHandle, headerChildren } = props
37
-
38
- return (
39
- <div className="group relative">
40
- {/* Border container */}
41
- <div className={cn(baseBackgroundVariants({ variant }))} />
42
-
43
- {/* Main node content */}
44
- <div className={cn(baseNodeVariants(), className)}>
45
- <HeaderBar text={title} children={headerChildren} />
46
- <div className="p-4 space-y-3">{children}</div>
47
- </div>
48
-
49
- {/* Connection points */}
50
- {!disableTargetHandle && <BaseHandle type="target" position={Position.Top} />}
51
- {!disableSourceHandle && <BaseHandle type="source" position={Position.Bottom} />}
52
-
53
- {/* Stacked card effect */}
54
- <div className="absolute inset-0 -z-10 translate-y-1 translate-x-1 bg-black/20 rounded-md border border-white/5" />
55
- </div>
56
- )
57
- }
@@ -1,22 +0,0 @@
1
- import { Send } from 'lucide-react'
2
- import { EventNodeData } from '../views/flow/nodes/nodes.types'
3
-
4
- const toType = (emit: string | { type: string; label?: string; conditional?: boolean }) =>
5
- typeof emit === 'string' ? emit : emit.type
6
-
7
- export const Emits: React.FC<{ emits: EventNodeData['emits'] }> = ({ emits }) => {
8
- return (
9
- <>
10
- {emits.map((emit) => (
11
- <div
12
- key={toType(emit)}
13
- className="flex gap-2 items-center text-xs text-white/60"
14
- data-testid={`emits__${toType(emit)}`}
15
- >
16
- <Send className="w-3 h-3 text-white/40" />
17
- <div className="font-mono tracking-wider">{toType(emit)}</div>
18
- </div>
19
- ))}
20
- </>
21
- )
22
- }
@@ -1,36 +0,0 @@
1
- import { PropsWithChildren } from 'react'
2
- import { LanguageIndicator } from '../views/flow/nodes/language-indicator'
3
- import { BaseNode } from './base-node'
4
- import { Emits } from './emits'
5
- import { EventNodeProps } from './node-props'
6
- import { Subscribe } from './subscribe'
7
-
8
- type Props = PropsWithChildren<
9
- EventNodeProps & {
10
- excludePubsub?: boolean
11
- className?: string
12
- }
13
- >
14
-
15
- export const EventNode = (props: Props) => {
16
- const { data, excludePubsub, children } = props
17
-
18
- return (
19
- <BaseNode
20
- variant="event"
21
- title={data.name}
22
- disableSourceHandle={!data.emits.length}
23
- disableTargetHandle={!data.subscribes.length}
24
- headerChildren={<LanguageIndicator language={data.language} />}
25
- >
26
- {data.description && <div className="text-sm max-w-[300px] text-white/60">{data.description}</div>}
27
- {children}
28
- {!excludePubsub && (
29
- <div className="space-y-2 pt-2 border-t border-white/10">
30
- <Subscribe data={data} />
31
- </div>
32
- )}
33
- <Emits emits={data.emits} />
34
- </BaseNode>
35
- )
36
- }
@@ -1,15 +0,0 @@
1
- import { EventNodeData, ApiNodeData, NoopNodeData } from '../views/flow/nodes/nodes.types'
2
-
3
- export type BaseNodeProps = EventNodeProps | NoopNodeProps | ApiNodeProps
4
-
5
- export type EventNodeProps = {
6
- data: EventNodeData
7
- }
8
-
9
- export type NoopNodeProps = {
10
- data: NoopNodeData
11
- }
12
-
13
- export type ApiNodeProps = {
14
- data: ApiNodeData
15
- }
@@ -1,21 +0,0 @@
1
- import { PropsWithChildren } from 'react'
2
- import { NoopNodeData } from '../views/flow/nodes/nodes.types'
3
- import { BaseNode } from './base-node'
4
-
5
- type Props = PropsWithChildren<{
6
- data: NoopNodeData
7
- }>
8
-
9
- export const NoopNode = ({ data, children }: Props) => {
10
- return (
11
- <BaseNode
12
- variant="noop"
13
- title={data.name}
14
- disableSourceHandle={!data.emits?.length}
15
- disableTargetHandle={!data.subscribes?.length}
16
- >
17
- {data.description && <div className="text-sm max-w-[300px] text-white/60">{data.description}</div>}
18
- {children}
19
- </BaseNode>
20
- )
21
- }
@@ -1,19 +0,0 @@
1
- import { Eye } from 'lucide-react'
2
- import { EventNodeData } from '../views/flow/nodes/nodes.types'
3
-
4
- export const Subscribe: React.FC<{ data: EventNodeData }> = ({ data }) => {
5
- return (
6
- <>
7
- {data.subscribes.map((subscribe) => (
8
- <div
9
- key={subscribe}
10
- className="flex gap-2 items-center text-xs text-white/60"
11
- data-testid={`subscribes__${subscribe}`}
12
- >
13
- <Eye className="w-3 h-3 text-white/40" />
14
- <div className="font-mono tracking-wider">{subscribe}</div>
15
- </div>
16
- ))}
17
- </>
18
- )
19
- }
@@ -1,9 +0,0 @@
1
- import { AppSidebar } from './components/app-sidebar'
2
- import { SidebarProvider } from './components/ui/sidebar'
3
-
4
- export const RouteWrapper = ({ children }: { children: React.ReactNode }) => (
5
- <SidebarProvider>
6
- <AppSidebar />
7
- {children}
8
- </SidebarProvider>
9
- )
@@ -1,109 +0,0 @@
1
- /* eslint-disable */
2
-
3
- // @ts-nocheck
4
-
5
- // noinspection JSUnusedGlobalSymbols
6
-
7
- // This file was automatically generated by TanStack Router.
8
- // You should NOT make any changes in this file as it will be overwritten.
9
- // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
-
11
- // Import Routes
12
-
13
- import { Route as rootRoute } from './routes/__root'
14
- import { Route as IndexImport } from './routes/index'
15
- import { Route as FlowIdImport } from './routes/flow/$id'
16
-
17
- // Create/Update Routes
18
-
19
- const IndexRoute = IndexImport.update({
20
- id: '/',
21
- path: '/',
22
- getParentRoute: () => rootRoute,
23
- } as any)
24
-
25
- const FlowIdRoute = FlowIdImport.update({
26
- id: '/flow/$id',
27
- path: '/flow/$id',
28
- getParentRoute: () => rootRoute,
29
- } as any)
30
-
31
- // Populate the FileRoutesByPath interface
32
-
33
- declare module '@tanstack/react-router' {
34
- interface FileRoutesByPath {
35
- '/': {
36
- id: '/'
37
- path: '/'
38
- fullPath: '/'
39
- preLoaderRoute: typeof IndexImport
40
- parentRoute: typeof rootRoute
41
- }
42
- '/flow/$id': {
43
- id: '/flow/$id'
44
- path: '/flow/$id'
45
- fullPath: '/flow/$id'
46
- preLoaderRoute: typeof FlowIdImport
47
- parentRoute: typeof rootRoute
48
- }
49
- }
50
- }
51
-
52
- // Create and export the route tree
53
-
54
- export interface FileRoutesByFullPath {
55
- '/': typeof IndexRoute
56
- '/flow/$id': typeof FlowIdRoute
57
- }
58
-
59
- export interface FileRoutesByTo {
60
- '/': typeof IndexRoute
61
- '/flow/$id': typeof FlowIdRoute
62
- }
63
-
64
- export interface FileRoutesById {
65
- __root__: typeof rootRoute
66
- '/': typeof IndexRoute
67
- '/flow/$id': typeof FlowIdRoute
68
- }
69
-
70
- export interface FileRouteTypes {
71
- fileRoutesByFullPath: FileRoutesByFullPath
72
- fullPaths: '/' | '/flow/$id'
73
- fileRoutesByTo: FileRoutesByTo
74
- to: '/' | '/flow/$id'
75
- id: '__root__' | '/' | '/flow/$id'
76
- fileRoutesById: FileRoutesById
77
- }
78
-
79
- export interface RootRouteChildren {
80
- IndexRoute: typeof IndexRoute
81
- FlowIdRoute: typeof FlowIdRoute
82
- }
83
-
84
- const rootRouteChildren: RootRouteChildren = {
85
- IndexRoute: IndexRoute,
86
- FlowIdRoute: FlowIdRoute,
87
- }
88
-
89
- export const routeTree = rootRoute._addFileChildren(rootRouteChildren)._addFileTypes<FileRouteTypes>()
90
-
91
- /* ROUTE_MANIFEST_START
92
- {
93
- "routes": {
94
- "__root__": {
95
- "filePath": "__root.tsx",
96
- "children": [
97
- "/",
98
- "/flow/$id"
99
- ]
100
- },
101
- "/": {
102
- "filePath": "index.tsx"
103
- },
104
- "/flow/$id": {
105
- "filePath": "flow/$id.tsx"
106
- }
107
- }
108
- }
109
- ROUTE_MANIFEST_END */
@@ -1,26 +0,0 @@
1
- import { RouteWrapper } from '@/route-wrapper'
2
- import { createRootRoute, Outlet } from '@tanstack/react-router'
3
- import React, { Suspense } from 'react'
4
-
5
- const TanStackRouterDevtools =
6
- process.env.NODE_ENV === 'production'
7
- ? () => null // Render nothing in production
8
- : React.lazy(() =>
9
- // Lazy load in development
10
- import('@tanstack/router-devtools').then((res) => ({
11
- default: res.TanStackRouterDevtools,
12
- // For Embedded Mode
13
- // default: res.TanStackRouterDevtoolsPanel
14
- })),
15
- )
16
-
17
- const RouteComponent = () => (
18
- <RouteWrapper>
19
- <Outlet />
20
- <Suspense>
21
- <TanStackRouterDevtools />
22
- </Suspense>
23
- </RouteWrapper>
24
- )
25
-
26
- export const Route = createRootRoute({ component: RouteComponent })
@@ -1,21 +0,0 @@
1
- import { FlowView } from '@/views/flow/flow-view'
2
- import { createFileRoute } from '@tanstack/react-router'
3
-
4
- export const Route = createFileRoute('/flow/$id')({
5
- component: Flow,
6
- loader: async ({ params }) => {
7
- return fetch(`/flows/${params.id}`)
8
- .then((res) => res.json())
9
- .then((flow) => ({ flow }))
10
- },
11
- })
12
-
13
- function Flow() {
14
- const { flow } = Route.useLoaderData()
15
-
16
- return (
17
- <div className="w-screen h-screen">
18
- <FlowView flow={flow} />
19
- </div>
20
- )
21
- }
@@ -1,13 +0,0 @@
1
- import { createFileRoute } from '@tanstack/react-router'
2
-
3
- export const Route = createFileRoute('/')({
4
- component: Index,
5
- })
6
-
7
- function Index() {
8
- return (
9
- <div className="flex items-center justify-center w-full h-screen">
10
- <p className="text-gray-500">Select a flow</p>
11
- </div>
12
- )
13
- }