@luxonis/depthai-pipeline-lib 1.4.8 → 1.4.10

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 (238) hide show
  1. package/package.json +1 -1
  2. package/dist/index.css +0 -3
  3. package/dist/panda.css +0 -1474
  4. package/dist/src/components/Node.d.ts +0 -5
  5. package/dist/src/components/Node.js +0 -42
  6. package/dist/src/components/PipelineCanvas.d.ts +0 -7
  7. package/dist/src/components/PipelineCanvas.js +0 -56
  8. package/dist/src/index.d.ts +0 -4
  9. package/dist/src/index.js +0 -2
  10. package/dist/src/services/pipeline.d.ts +0 -51
  11. package/dist/src/services/pipeline.js +0 -40
  12. package/dist/src/styled-system/chunks/src__components__Node.css +0 -195
  13. package/dist/src/styled-system/chunks/src__components__PipelineCanvas.css +0 -25
  14. package/dist/src/styled-system/css/conditions.mjs +0 -34
  15. package/dist/src/styled-system/css/css.d.mts +0 -9
  16. package/dist/src/styled-system/css/css.mjs +0 -44
  17. package/dist/src/styled-system/css/cva.d.mts +0 -6
  18. package/dist/src/styled-system/css/cva.mjs +0 -63
  19. package/dist/src/styled-system/css/cx.d.mts +0 -5
  20. package/dist/src/styled-system/css/cx.mjs +0 -15
  21. package/dist/src/styled-system/css/index.d.mts +0 -5
  22. package/dist/src/styled-system/css/index.mjs +0 -4
  23. package/dist/src/styled-system/css/sva.d.mts +0 -4
  24. package/dist/src/styled-system/css/sva.mjs +0 -35
  25. package/dist/src/styled-system/global.css +0 -70
  26. package/dist/src/styled-system/helpers.mjs +0 -282
  27. package/dist/src/styled-system/patterns/aspect-ratio.d.mts +0 -21
  28. package/dist/src/styled-system/patterns/aspect-ratio.mjs +0 -35
  29. package/dist/src/styled-system/patterns/bleed.d.mts +0 -22
  30. package/dist/src/styled-system/patterns/bleed.mjs +0 -19
  31. package/dist/src/styled-system/patterns/box.d.mts +0 -21
  32. package/dist/src/styled-system/patterns/box.mjs +0 -12
  33. package/dist/src/styled-system/patterns/center.d.mts +0 -21
  34. package/dist/src/styled-system/patterns/center.mjs +0 -18
  35. package/dist/src/styled-system/patterns/circle.d.mts +0 -21
  36. package/dist/src/styled-system/patterns/circle.mjs +0 -22
  37. package/dist/src/styled-system/patterns/container.d.mts +0 -21
  38. package/dist/src/styled-system/patterns/container.mjs +0 -18
  39. package/dist/src/styled-system/patterns/divider.d.mts +0 -23
  40. package/dist/src/styled-system/patterns/divider.mjs +0 -21
  41. package/dist/src/styled-system/patterns/flex.d.mts +0 -27
  42. package/dist/src/styled-system/patterns/flex.mjs +0 -23
  43. package/dist/src/styled-system/patterns/float.d.mts +0 -24
  44. package/dist/src/styled-system/patterns/float.mjs +0 -45
  45. package/dist/src/styled-system/patterns/grid-item.d.mts +0 -26
  46. package/dist/src/styled-system/patterns/grid-item.mjs +0 -22
  47. package/dist/src/styled-system/patterns/grid.d.mts +0 -25
  48. package/dist/src/styled-system/patterns/grid.mjs +0 -20
  49. package/dist/src/styled-system/patterns/hstack.d.mts +0 -22
  50. package/dist/src/styled-system/patterns/hstack.mjs +0 -20
  51. package/dist/src/styled-system/patterns/index.d.mts +0 -21
  52. package/dist/src/styled-system/patterns/index.mjs +0 -20
  53. package/dist/src/styled-system/patterns/link-box.d.mts +0 -21
  54. package/dist/src/styled-system/patterns/link-box.mjs +0 -19
  55. package/dist/src/styled-system/patterns/link-overlay.d.mts +0 -21
  56. package/dist/src/styled-system/patterns/link-overlay.mjs +0 -24
  57. package/dist/src/styled-system/patterns/spacer.d.mts +0 -21
  58. package/dist/src/styled-system/patterns/spacer.mjs +0 -18
  59. package/dist/src/styled-system/patterns/square.d.mts +0 -21
  60. package/dist/src/styled-system/patterns/square.mjs +0 -21
  61. package/dist/src/styled-system/patterns/stack.d.mts +0 -24
  62. package/dist/src/styled-system/patterns/stack.mjs +0 -20
  63. package/dist/src/styled-system/patterns/visually-hidden.d.mts +0 -21
  64. package/dist/src/styled-system/patterns/visually-hidden.mjs +0 -15
  65. package/dist/src/styled-system/patterns/vstack.d.mts +0 -22
  66. package/dist/src/styled-system/patterns/vstack.mjs +0 -20
  67. package/dist/src/styled-system/patterns/wrap.d.mts +0 -25
  68. package/dist/src/styled-system/patterns/wrap.mjs +0 -22
  69. package/dist/src/styled-system/recipes/accordion.d.mts +0 -28
  70. package/dist/src/styled-system/recipes/accordion.mjs +0 -46
  71. package/dist/src/styled-system/recipes/alert-description.d.mts +0 -28
  72. package/dist/src/styled-system/recipes/alert-description.mjs +0 -19
  73. package/dist/src/styled-system/recipes/alert-dialog.d.mts +0 -28
  74. package/dist/src/styled-system/recipes/alert-dialog.mjs +0 -70
  75. package/dist/src/styled-system/recipes/alert-title.d.mts +0 -28
  76. package/dist/src/styled-system/recipes/alert-title.mjs +0 -19
  77. package/dist/src/styled-system/recipes/alert.d.mts +0 -28
  78. package/dist/src/styled-system/recipes/alert.mjs +0 -26
  79. package/dist/src/styled-system/recipes/avatar.d.mts +0 -28
  80. package/dist/src/styled-system/recipes/avatar.mjs +0 -38
  81. package/dist/src/styled-system/recipes/badge.d.mts +0 -28
  82. package/dist/src/styled-system/recipes/badge.mjs +0 -28
  83. package/dist/src/styled-system/recipes/blockquote.d.mts +0 -28
  84. package/dist/src/styled-system/recipes/blockquote.mjs +0 -19
  85. package/dist/src/styled-system/recipes/button.d.mts +0 -29
  86. package/dist/src/styled-system/recipes/button.mjs +0 -37
  87. package/dist/src/styled-system/recipes/calendar.d.mts +0 -28
  88. package/dist/src/styled-system/recipes/calendar.mjs +0 -118
  89. package/dist/src/styled-system/recipes/card-content.d.mts +0 -28
  90. package/dist/src/styled-system/recipes/card-content.mjs +0 -19
  91. package/dist/src/styled-system/recipes/card-description.d.mts +0 -28
  92. package/dist/src/styled-system/recipes/card-description.mjs +0 -19
  93. package/dist/src/styled-system/recipes/card-footer.d.mts +0 -28
  94. package/dist/src/styled-system/recipes/card-footer.mjs +0 -19
  95. package/dist/src/styled-system/recipes/card-header.d.mts +0 -28
  96. package/dist/src/styled-system/recipes/card-header.mjs +0 -19
  97. package/dist/src/styled-system/recipes/card-title.d.mts +0 -28
  98. package/dist/src/styled-system/recipes/card-title.mjs +0 -19
  99. package/dist/src/styled-system/recipes/card.d.mts +0 -28
  100. package/dist/src/styled-system/recipes/card.mjs +0 -19
  101. package/dist/src/styled-system/recipes/checkbox.d.mts +0 -28
  102. package/dist/src/styled-system/recipes/checkbox.mjs +0 -34
  103. package/dist/src/styled-system/recipes/collapsible.d.mts +0 -28
  104. package/dist/src/styled-system/recipes/collapsible.mjs +0 -38
  105. package/dist/src/styled-system/recipes/command-dialog.d.mts +0 -28
  106. package/dist/src/styled-system/recipes/command-dialog.mjs +0 -34
  107. package/dist/src/styled-system/recipes/command.d.mts +0 -28
  108. package/dist/src/styled-system/recipes/command.mjs +0 -66
  109. package/dist/src/styled-system/recipes/context-menu.d.mts +0 -28
  110. package/dist/src/styled-system/recipes/context-menu.mjs +0 -98
  111. package/dist/src/styled-system/recipes/create-recipe.d.mts +0 -1
  112. package/dist/src/styled-system/recipes/create-recipe.mjs +0 -50
  113. package/dist/src/styled-system/recipes/dialog.d.mts +0 -28
  114. package/dist/src/styled-system/recipes/dialog.mjs +0 -66
  115. package/dist/src/styled-system/recipes/dropdown-menu.d.mts +0 -28
  116. package/dist/src/styled-system/recipes/dropdown-menu.mjs +0 -90
  117. package/dist/src/styled-system/recipes/form-control.d.mts +0 -28
  118. package/dist/src/styled-system/recipes/form-control.mjs +0 -19
  119. package/dist/src/styled-system/recipes/form-description.d.mts +0 -28
  120. package/dist/src/styled-system/recipes/form-description.mjs +0 -19
  121. package/dist/src/styled-system/recipes/form-item.d.mts +0 -28
  122. package/dist/src/styled-system/recipes/form-item.mjs +0 -19
  123. package/dist/src/styled-system/recipes/form-label.d.mts +0 -28
  124. package/dist/src/styled-system/recipes/form-label.mjs +0 -19
  125. package/dist/src/styled-system/recipes/form-message.d.mts +0 -28
  126. package/dist/src/styled-system/recipes/form-message.mjs +0 -19
  127. package/dist/src/styled-system/recipes/h1.d.mts +0 -28
  128. package/dist/src/styled-system/recipes/h1.mjs +0 -19
  129. package/dist/src/styled-system/recipes/h2.d.mts +0 -28
  130. package/dist/src/styled-system/recipes/h2.mjs +0 -19
  131. package/dist/src/styled-system/recipes/h3.d.mts +0 -28
  132. package/dist/src/styled-system/recipes/h3.mjs +0 -19
  133. package/dist/src/styled-system/recipes/h4.d.mts +0 -28
  134. package/dist/src/styled-system/recipes/h4.mjs +0 -19
  135. package/dist/src/styled-system/recipes/hover-card.d.mts +0 -28
  136. package/dist/src/styled-system/recipes/hover-card.mjs +0 -38
  137. package/dist/src/styled-system/recipes/icon.d.mts +0 -32
  138. package/dist/src/styled-system/recipes/icon.mjs +0 -49
  139. package/dist/src/styled-system/recipes/index.d.mts +0 -74
  140. package/dist/src/styled-system/recipes/index.mjs +0 -73
  141. package/dist/src/styled-system/recipes/inline-code.d.mts +0 -28
  142. package/dist/src/styled-system/recipes/inline-code.mjs +0 -19
  143. package/dist/src/styled-system/recipes/input.d.mts +0 -28
  144. package/dist/src/styled-system/recipes/input.mjs +0 -19
  145. package/dist/src/styled-system/recipes/label.d.mts +0 -28
  146. package/dist/src/styled-system/recipes/label.mjs +0 -19
  147. package/dist/src/styled-system/recipes/large.d.mts +0 -28
  148. package/dist/src/styled-system/recipes/large.mjs +0 -19
  149. package/dist/src/styled-system/recipes/lead.d.mts +0 -28
  150. package/dist/src/styled-system/recipes/lead.mjs +0 -19
  151. package/dist/src/styled-system/recipes/link.d.mts +0 -28
  152. package/dist/src/styled-system/recipes/link.mjs +0 -19
  153. package/dist/src/styled-system/recipes/list.d.mts +0 -28
  154. package/dist/src/styled-system/recipes/list.mjs +0 -19
  155. package/dist/src/styled-system/recipes/menubar.d.mts +0 -28
  156. package/dist/src/styled-system/recipes/menubar.mjs +0 -94
  157. package/dist/src/styled-system/recipes/muted.d.mts +0 -28
  158. package/dist/src/styled-system/recipes/muted.mjs +0 -19
  159. package/dist/src/styled-system/recipes/navigation-menu.d.mts +0 -28
  160. package/dist/src/styled-system/recipes/navigation-menu.mjs +0 -62
  161. package/dist/src/styled-system/recipes/p.d.mts +0 -28
  162. package/dist/src/styled-system/recipes/p.mjs +0 -19
  163. package/dist/src/styled-system/recipes/popover.d.mts +0 -28
  164. package/dist/src/styled-system/recipes/popover.mjs +0 -42
  165. package/dist/src/styled-system/recipes/progress.d.mts +0 -28
  166. package/dist/src/styled-system/recipes/progress.mjs +0 -34
  167. package/dist/src/styled-system/recipes/radio-group.d.mts +0 -28
  168. package/dist/src/styled-system/recipes/radio-group.mjs +0 -42
  169. package/dist/src/styled-system/recipes/scroll-area.d.mts +0 -28
  170. package/dist/src/styled-system/recipes/scroll-area.mjs +0 -46
  171. package/dist/src/styled-system/recipes/select.d.mts +0 -28
  172. package/dist/src/styled-system/recipes/select.mjs +0 -66
  173. package/dist/src/styled-system/recipes/separator.d.mts +0 -28
  174. package/dist/src/styled-system/recipes/separator.mjs +0 -26
  175. package/dist/src/styled-system/recipes/sheet.d.mts +0 -28
  176. package/dist/src/styled-system/recipes/sheet.mjs +0 -81
  177. package/dist/src/styled-system/recipes/skeleton.d.mts +0 -28
  178. package/dist/src/styled-system/recipes/skeleton.mjs +0 -19
  179. package/dist/src/styled-system/recipes/slider.d.mts +0 -28
  180. package/dist/src/styled-system/recipes/slider.mjs +0 -42
  181. package/dist/src/styled-system/recipes/small.d.mts +0 -28
  182. package/dist/src/styled-system/recipes/small.mjs +0 -19
  183. package/dist/src/styled-system/recipes/switch-recipe.d.mts +0 -28
  184. package/dist/src/styled-system/recipes/switch-recipe.mjs +0 -34
  185. package/dist/src/styled-system/recipes/table-body.d.mts +0 -28
  186. package/dist/src/styled-system/recipes/table-body.mjs +0 -19
  187. package/dist/src/styled-system/recipes/table-caption.d.mts +0 -28
  188. package/dist/src/styled-system/recipes/table-caption.mjs +0 -19
  189. package/dist/src/styled-system/recipes/table-cell.d.mts +0 -28
  190. package/dist/src/styled-system/recipes/table-cell.mjs +0 -19
  191. package/dist/src/styled-system/recipes/table-container.d.mts +0 -28
  192. package/dist/src/styled-system/recipes/table-container.mjs +0 -19
  193. package/dist/src/styled-system/recipes/table-footer.d.mts +0 -28
  194. package/dist/src/styled-system/recipes/table-footer.mjs +0 -19
  195. package/dist/src/styled-system/recipes/table-head.d.mts +0 -28
  196. package/dist/src/styled-system/recipes/table-head.mjs +0 -19
  197. package/dist/src/styled-system/recipes/table-header.d.mts +0 -28
  198. package/dist/src/styled-system/recipes/table-header.mjs +0 -19
  199. package/dist/src/styled-system/recipes/table-row.d.mts +0 -28
  200. package/dist/src/styled-system/recipes/table-row.mjs +0 -19
  201. package/dist/src/styled-system/recipes/table.d.mts +0 -28
  202. package/dist/src/styled-system/recipes/table.mjs +0 -19
  203. package/dist/src/styled-system/recipes/tabs.d.mts +0 -28
  204. package/dist/src/styled-system/recipes/tabs.mjs +0 -42
  205. package/dist/src/styled-system/recipes/textarea.d.mts +0 -28
  206. package/dist/src/styled-system/recipes/textarea.mjs +0 -19
  207. package/dist/src/styled-system/recipes/toast-viewport.d.mts +0 -28
  208. package/dist/src/styled-system/recipes/toast-viewport.mjs +0 -19
  209. package/dist/src/styled-system/recipes/toast.d.mts +0 -28
  210. package/dist/src/styled-system/recipes/toast.mjs +0 -59
  211. package/dist/src/styled-system/recipes/toggle.d.mts +0 -29
  212. package/dist/src/styled-system/recipes/toggle.mjs +0 -32
  213. package/dist/src/styled-system/recipes/tooltip.d.mts +0 -28
  214. package/dist/src/styled-system/recipes/tooltip.mjs +0 -38
  215. package/dist/src/styled-system/recipes/typography-table-container.d.mts +0 -28
  216. package/dist/src/styled-system/recipes/typography-table-container.mjs +0 -19
  217. package/dist/src/styled-system/recipes/typography-table.d.mts +0 -28
  218. package/dist/src/styled-system/recipes/typography-table.mjs +0 -19
  219. package/dist/src/styled-system/reset.css +0 -206
  220. package/dist/src/styled-system/static.css +0 -320
  221. package/dist/src/styled-system/tokens/index.css +0 -620
  222. package/dist/src/styled-system/tokens/index.d.mts +0 -9
  223. package/dist/src/styled-system/tokens/index.mjs +0 -2680
  224. package/dist/src/styled-system/tokens/keyframes.css +0 -56
  225. package/dist/src/styled-system/tokens/tokens.d.mts +0 -63
  226. package/dist/src/styled-system/types/composition.d.mts +0 -111
  227. package/dist/src/styled-system/types/conditions.d.mts +0 -266
  228. package/dist/src/styled-system/types/csstype.d.mts +0 -20749
  229. package/dist/src/styled-system/types/global.d.mts +0 -19
  230. package/dist/src/styled-system/types/helpers.d.mts +0 -2
  231. package/dist/src/styled-system/types/index.d.mts +0 -8
  232. package/dist/src/styled-system/types/parts.d.mts +0 -6
  233. package/dist/src/styled-system/types/pattern.d.mts +0 -61
  234. package/dist/src/styled-system/types/prop-type.d.mts +0 -340
  235. package/dist/src/styled-system/types/recipe.d.mts +0 -148
  236. package/dist/src/styled-system/types/selectors.d.mts +0 -59
  237. package/dist/src/styled-system/types/style-props.d.mts +0 -687
  238. package/dist/src/styled-system/types/system-types.d.mts +0 -85
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import type { NodeProps } from '@xyflow/react';
3
- import type { ParsedNode } from '../services/pipeline.js';
4
- export type PipelineNodeProps = NodeProps<ParsedNode>;
5
- export declare const PipelineNode: React.FC<PipelineNodeProps>;
@@ -1,42 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Handle, Position } from '@xyflow/react';
3
- import { clsx } from '@luxonis/common-fe-components/helpers';
4
- import { Button, Flex, HelpIcon, Label, SubLabel } from '@luxonis/common-fe-components';
5
- import { css } from '../styled-system/css/css.mjs';
6
- const DOCS_BASE_URL = `https://docs.luxonis.com/software/depthai-components/nodes/`;
7
- const NodeHandles = props => {
8
- const { handles, type } = props;
9
- return (_jsx(Flex, { full: true, direction: "column", align: type === 'input' ? 'start' : 'end', children: handles.map(({ type: handleType, id, blocking, queueSize, name }) => (_jsxs(Flex, { position: "relative", align: "end", direction: handleType === 'input' ? 'row' : 'row-reverse', children: [_jsx(Handle, { type: handleType === 'input' ? 'target' : 'source', position: handleType === 'input' ? Position.Left : Position.Right, id: name, isConnectable: false, className: css({
10
- width: 'custom.handle.dot!',
11
- height: 'custom.handle.dot!',
12
- backgroundColor: blocking ? 'dark.warning!' : 'dark.success!',
13
- border: 'none!',
14
- }) }), _jsx(SubLabel, { className: css({
15
- ...(type === 'input' //
16
- ? { 'marginLeft': 'xs' }
17
- : { 'marginRight': 'xs' }),
18
- }), text: type === 'input' ? `[${queueSize}] ${name}` : name, break: "none" })] }, id))) }));
19
- };
20
- export const PipelineNode = props => {
21
- const { data: node } = props;
22
- return (_jsxs(Flex, { direction: "column", className: css({
23
- 'minWidth': 'container.smaller.xxs',
24
- 'border': 'base',
25
- 'rounded': 'common',
26
- 'backgroundColor': 'white',
27
- '&:hover .node-help-icon': {
28
- color: 'text.normal',
29
- },
30
- }), children: [_jsxs(Flex, { align: "center", justify: "space-between", gap: "xs", className: css({
31
- width: 'full',
32
- backgroundColor: 'light.gray',
33
- roundedTop: 'common',
34
- }), children: [_jsx("span", { className: css({
35
- width: 'icon.sm',
36
- height: 'icon.sm',
37
- }) }), _jsx(Label, { text: node.name, color: "unset" }), _jsx(Button, { variant: "ghost", color: "transparent", icon: HelpIcon, onClick: () => window.open(DOCS_BASE_URL, '_blank'), className: clsx('node-help-icon', css({
38
- width: 'auto',
39
- height: 'auto',
40
- right: 'xs',
41
- })) })] }), _jsxs(Flex, { gap: "sm", paddingY: "xs", children: [_jsx(NodeHandles, { type: "input", handles: node.handles.input }), _jsx(NodeHandles, { type: "output", handles: node.handles.output })] })] }));
42
- };
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import type { FlexProps } from '@luxonis/common-fe-components';
3
- import type { Pipeline } from '../services/pipeline.js';
4
- export type PipelineCanvasProps = FlexProps & {
5
- pipeline: Pipeline | null;
6
- };
7
- export declare const PipelineCanvas: React.FC<PipelineCanvasProps>;
@@ -1,56 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
3
- import { ReactFlow, ReactFlowProvider, useEdgesState, useNodesState, useReactFlow, } from '@xyflow/react';
4
- import { Flex, Header } from '@luxonis/common-fe-components';
5
- import Dagre from '@dagrejs/dagre';
6
- import { PipelineNode } from './Node.js';
7
- const getLayoutedElements = (nodes, edges) => {
8
- const graph = new Dagre.graphlib.Graph().setDefaultEdgeLabel(() => ({}));
9
- graph.setGraph({ rankdir: 'LR' });
10
- for (const edge of edges) {
11
- graph.setEdge(edge.source, edge.target);
12
- }
13
- for (const node of nodes) {
14
- graph.setNode(node.id, {
15
- ...node,
16
- width: node.measured?.width ?? 200,
17
- height: node.measured?.height ?? 100,
18
- });
19
- }
20
- Dagre.layout(graph);
21
- return {
22
- nodes: nodes.map((node) => {
23
- const position = graph.node(node.id);
24
- // Shift Dagre anchor (center) to React Flow anchor (top left)
25
- const x = position.x - (node.measured?.width ?? 200) / 2;
26
- const y = position.y - (node.measured?.height ?? 100) / 2;
27
- return { ...node, position: { x, y } };
28
- }),
29
- edges,
30
- };
31
- };
32
- const PipelineCanvasBody = ({ pipeline, ...flexProps }) => {
33
- const { fitView, setViewport, getViewport } = useReactFlow();
34
- const autoArrangeRef = React.useRef(true);
35
- const [nodes, setNodes, onNodesChange] = useNodesState([]);
36
- const [edges, setEdges] = useEdgesState([]);
37
- React.useEffect(() => {
38
- if (!autoArrangeRef.current) {
39
- return;
40
- }
41
- const layouted = getLayoutedElements(pipeline?.nodes ?? [], pipeline?.edges ?? []);
42
- setNodes([...layouted.nodes]);
43
- setEdges([...layouted.edges]);
44
- window.requestAnimationFrame(async () => {
45
- await fitView({ minZoom: 1 });
46
- const viewport = getViewport();
47
- await setViewport({
48
- x: 50,
49
- y: viewport.y,
50
- zoom: 1,
51
- });
52
- });
53
- }, [fitView, getViewport, pipeline?.edges, pipeline?.nodes, setEdges, setNodes, setViewport]);
54
- return (_jsxs(Flex, { align: "center", justify: "center", full: true, height: "container.xs", rounded: "common", border: "base", ...flexProps, children: [!pipeline && _jsx(Header, { text: "Loading pipeline..." }), pipeline && (_jsx(ReactFlow, { nodes: nodes, edges: edges, onNodeDragStart: () => (autoArrangeRef.current = false), onNodesChange: onNodesChange, fitView: true, nodeTypes: { generic: PipelineNode } }))] }));
55
- };
56
- export const PipelineCanvas = props => (_jsx(ReactFlowProvider, { children: _jsx(PipelineCanvasBody, { ...props }) }));
@@ -1,4 +0,0 @@
1
- export { parsePipeline } from './services/pipeline.js';
2
- export type { Pipeline, RawPipelinePayload } from './services/pipeline.js';
3
- export { PipelineCanvas } from './components/PipelineCanvas.js';
4
- export type { PipelineCanvasProps } from './components/PipelineCanvas.js';
package/dist/src/index.js DELETED
@@ -1,2 +0,0 @@
1
- export { parsePipeline } from './services/pipeline.js';
2
- export { PipelineCanvas } from './components/PipelineCanvas.js';
@@ -1,51 +0,0 @@
1
- import type { Edge, Node } from '@xyflow/react';
2
- export type RawPipelineNodeIO = [
3
- [
4
- string,
5
- string
6
- ],
7
- {
8
- id: number;
9
- name: string;
10
- type: 0 | 3;
11
- blocking: boolean;
12
- queueSize: number;
13
- }
14
- ];
15
- export type RawPipelineNode = {
16
- id: number;
17
- ioInfo: RawPipelineNodeIO[];
18
- name: string;
19
- };
20
- export type RawPipelineEdge = {
21
- node1Id: number;
22
- node1Output: string;
23
- node2Id: number;
24
- node2Input: string;
25
- };
26
- export type RawPipelinePayload = {
27
- pipeline: RawPipeline;
28
- };
29
- export type RawPipeline = {
30
- connections: RawPipelineEdge[];
31
- nodes: [number, RawPipelineNode][];
32
- };
33
- export type Pipeline = {
34
- nodes: ParsedNode[];
35
- edges: Edge[];
36
- };
37
- export type ParsedHandle = {
38
- id: number;
39
- name: string;
40
- type: 'input' | 'output';
41
- blocking: boolean;
42
- queueSize: number;
43
- };
44
- export type ParsedNode = Node<{
45
- name: string;
46
- handles: {
47
- input: ParsedHandle[];
48
- output: ParsedHandle[];
49
- };
50
- }>;
51
- export declare function parsePipeline(rawPayload: RawPipelinePayload): Pipeline;
@@ -1,40 +0,0 @@
1
- function parseHandles(handles) {
2
- const parsedHandles = {
3
- input: [],
4
- output: [],
5
- };
6
- for (const [_, handle] of handles) {
7
- const type = handle.type === 3 ? 'input' : 'output';
8
- const parsed = {
9
- id: handle.id,
10
- name: handle.name,
11
- type,
12
- blocking: handle.blocking,
13
- queueSize: handle.queueSize,
14
- };
15
- parsedHandles[type].push(parsed);
16
- }
17
- return parsedHandles;
18
- }
19
- export function parsePipeline(rawPayload) {
20
- const { pipeline } = rawPayload;
21
- const nodes = pipeline.nodes
22
- .filter(([_, node]) => pipeline.connections.some(connection => connection.node1Id === node.id || connection.node2Id === node.id))
23
- .map(([id, node]) => ({
24
- type: 'generic',
25
- id: id.toString(),
26
- position: { x: 0, y: 0 },
27
- data: {
28
- name: node.name,
29
- handles: parseHandles(node.ioInfo),
30
- },
31
- })) ?? [];
32
- const edges = pipeline.connections.map(connection => ({
33
- id: `${connection.node1Id}-${connection.node2Id}`,
34
- source: connection.node1Id.toString(),
35
- target: connection.node2Id.toString(),
36
- sourceHandle: connection.node1Output,
37
- targetHandle: connection.node2Input,
38
- })) ?? [];
39
- return { nodes, edges };
40
- }
@@ -1,195 +0,0 @@
1
- @layer utilities {
2
- .bg_dark\.warning\! {
3
- background-color: var(--colors-dark-warning) !important
4
- }
5
-
6
- .bg_dark\.success\! {
7
- background-color: var(--colors-dark-success) !important
8
- }
9
-
10
- .w_custom\.handle\.dot\! {
11
- width: var(--sizes-custom-handle-dot) !important
12
- }
13
-
14
- .h_custom\.handle\.dot\! {
15
- height: var(--sizes-custom-handle-dot) !important
16
- }
17
-
18
- .border_none\! {
19
- border: var(--borders-none) !important
20
- }
21
-
22
- .ml_xs {
23
- margin-left: var(--spacing-xs)
24
- }
25
-
26
- .mr_xs {
27
- margin-right: var(--spacing-xs)
28
- }
29
-
30
- .min-w_container\.smaller\.xxs {
31
- min-width: var(--sizes-container-smaller-xxs)
32
- }
33
-
34
- .border_base {
35
- border: var(--borders-base)
36
- }
37
-
38
- .rounded_common {
39
- border-radius: var(--radii-common)
40
- }
41
-
42
- .bg_white {
43
- background-color: var(--colors-white)
44
- }
45
-
46
- .w_full {
47
- width: var(--sizes-full)
48
- }
49
-
50
- .bg_light\.gray {
51
- background-color: var(--colors-light-gray)
52
- }
53
-
54
- .rounded-t_common {
55
- border-top-left-radius: var(--radii-common);
56
- border-top-right-radius: var(--radii-common)
57
- }
58
-
59
- .w_icon\.sm {
60
- width: var(--sizes-icon-sm)
61
- }
62
-
63
- .h_icon\.sm {
64
- height: var(--sizes-icon-sm)
65
- }
66
-
67
- .w_auto {
68
- width: auto
69
- }
70
-
71
- .h_auto {
72
- height: auto
73
- }
74
-
75
- .right_xs {
76
- right: var(--spacing-xs)
77
- }
78
-
79
- .text_unset {
80
- color: unset
81
- }
82
-
83
- .text_transparent {
84
- color: var(--colors-transparent)
85
- }
86
-
87
- .items_start {
88
- align-items: start
89
- }
90
-
91
- .flex_row {
92
- flex-direction: row
93
- }
94
-
95
- .flex_row-reverse {
96
- flex-direction: row-reverse
97
- }
98
-
99
- .items_end {
100
- align-items: end
101
- }
102
-
103
- .pos_relative {
104
- position: relative
105
- }
106
-
107
- .flex_column {
108
- flex-direction: column
109
- }
110
-
111
- .items_center {
112
- align-items: center
113
- }
114
-
115
- .justify_space-between {
116
- justify-content: space-between
117
- }
118
-
119
- .gap_xs {
120
- gap: var(--spacing-xs)
121
- }
122
-
123
- .d_flex {
124
- display: flex
125
- }
126
-
127
- .gap_sm {
128
- gap: var(--spacing-sm)
129
- }
130
-
131
- .py_xs {
132
- padding-block: var(--spacing-xs)
133
- }
134
- .\[\&\:hover_\.node-help-icon\]\:text_text\.normal:hover .node-help-icon {
135
- color: var(--colors-text-normal)
136
- }
137
- }
138
-
139
- @layer recipes {
140
- .button--variant_ghost:is(:hover, [data-hover]) {
141
- background: var(--colors-accent);
142
- color: var(--colors-accent-foreground)
143
- }
144
-
145
- .button--size_default {
146
- height: var(--sizes-10);
147
- padding-inline: var(--spacing-4);
148
- padding-block: var(--spacing-2)
149
- }
150
-
151
- @layer _base {
152
- .label {
153
- font-size: 0.875rem;
154
- line-height: var(--line-heights-none);
155
- font-weight: var(--font-weights-medium);
156
- }
157
- .peer:is(:disabled, [disabled], [data-disabled]) ~ .label {
158
- cursor: not-allowed;
159
- opacity: 0.7
160
- }
161
- }
162
-
163
- @layer _base {
164
- .button {
165
- display: inline-flex;
166
- align-items: center;
167
- justify-content: center;
168
- border-radius: var(--radii-md);
169
- font-size: 0.875rem;
170
- line-height: 1.25rem;
171
- font-weight: var(--font-weights-medium);
172
- transition-property: var(--transition-prop, color, background-color, border-color, outline-color, text-decoration-color, fill, stroke);
173
- transition-timing-function: var(--transition-easing, cubic-bezier(0.4, 0, 0.2, 1));
174
- transition-duration: var(--transition-duration, 150ms);
175
- cursor: pointer;
176
- --shadow-panda-ring-offset-color: var(--colors-background);
177
- gap: var(--spacing-2);
178
- }
179
- .button:is(:disabled, [disabled], [data-disabled]) {
180
- pointer-events: none;
181
- opacity: 50%
182
- }
183
- .button:is(:focus-visible, [data-focus-visible]) {
184
- outline: 2px solid transparent;
185
- outline-offset: 2px;
186
- --shadow-panda-ring-offset-shadow: var(--shadow-panda-ring-inset,) 0 0 0 var(--shadow-panda-ring-offset-width, 0px) var(--shadow-panda-ring-offset-color);
187
- --shadow-panda-ring-shadow: var(--shadow-panda-ring-inset,) 0 0 0 calc(2px + var(--shadow-panda-ring-offset-width, 0px)) var(--shadow-panda-ring-color);
188
- box-shadow: var(--shadow-panda-ring-offset-shadow),var(--shadow-panda-ring-shadow),var(--shadow-panda-base-shadow,0 0 #0000);
189
- --shadow-panda-ring-color: var(--colors-ring)
190
- ;
191
- --shadow-panda-ring-offset-width: 2px
192
-
193
- }
194
- }
195
- }
@@ -1,25 +0,0 @@
1
- @layer utilities {
2
- .d_flex {
3
- display: flex
4
- }
5
-
6
- .items_center {
7
- align-items: center
8
- }
9
-
10
- .justify_center {
11
- justify-content: center
12
- }
13
-
14
- .h_container\.xs {
15
- height: var(--sizes-container-xs)
16
- }
17
-
18
- .rounded_common {
19
- border-radius: var(--radii-common)
20
- }
21
-
22
- .border_base {
23
- border: var(--borders-base)
24
- }
25
- }
@@ -1,34 +0,0 @@
1
- import { withoutSpace } from '../helpers.mjs';
2
-
3
- const conditionsStr = "_hover,_focus,_focusWithin,_focusVisible,_disabled,_active,_visited,_target,_readOnly,_readWrite,_empty,_checked,_enabled,_expanded,_highlighted,_before,_after,_firstLetter,_firstLine,_marker,_selection,_file,_backdrop,_first,_last,_only,_even,_odd,_firstOfType,_lastOfType,_onlyOfType,_peerFocus,_peerHover,_peerActive,_peerFocusWithin,_peerFocusVisible,_peerDisabled,_peerChecked,_peerInvalid,_peerExpanded,_peerPlaceholderShown,_groupFocus,_groupHover,_groupActive,_groupFocusWithin,_groupFocusVisible,_groupDisabled,_groupChecked,_groupExpanded,_groupInvalid,_indeterminate,_required,_valid,_invalid,_autofill,_inRange,_outOfRange,_placeholder,_placeholderShown,_pressed,_selected,_default,_optional,_open,_fullscreen,_loading,_currentPage,_currentStep,_motionReduce,_motionSafe,_print,_landscape,_portrait,_dark,_light,_osDark,_osLight,_highContrast,_lessContrast,_moreContrast,_ltr,_rtl,_scrollbar,_scrollbarThumb,_scrollbarTrack,_horizontal,_vertical,sm,smOnly,smDown,md,mdOnly,mdDown,lg,lgOnly,lgDown,2lg,2lgOnly,2lgDown,xl,xlOnly,xlDown,2xl,2xlOnly,2xlDown,smToMd,smToLg,smTo2lg,smToXl,smTo2xl,mdToLg,mdTo2lg,mdToXl,mdTo2xl,lgTo2lg,lgToXl,lgTo2xl,2lgToXl,2lgTo2xl,xlTo2xl,base"
4
- const conditions = new Set(conditionsStr.split(','))
5
-
6
- export function isCondition(value){
7
- return conditions.has(value) || /^@|&|&$/.test(value)
8
- }
9
-
10
- const underscoreRegex = /^_/
11
- const conditionsSelectorRegex = /&|@/
12
-
13
- export function finalizeConditions(paths){
14
- return paths.map((path) => {
15
- if (conditions.has(path)){
16
- return path.replace(underscoreRegex, '')
17
- }
18
-
19
- if (conditionsSelectorRegex.test(path)){
20
- return `[${withoutSpace(path.trim())}]`
21
- }
22
-
23
- return path
24
- })}
25
-
26
- export function sortConditions(paths){
27
- return paths.sort((a, b) => {
28
- const aa = isCondition(a)
29
- const bb = isCondition(b)
30
- if (aa && !bb) return 1
31
- if (!aa && bb) return -1
32
- return 0
33
- })
34
- }
@@ -1,9 +0,0 @@
1
- /* eslint-disable */
2
- import type { SystemStyleObject } from '../types/index.d.mts';
3
-
4
- interface CssFunction {
5
- (...styles: Array<SystemStyleObject | undefined | null | false>): string
6
- raw: (...styles: Array<SystemStyleObject | undefined | null | false>) => SystemStyleObject
7
- }
8
-
9
- export declare const css: CssFunction;
@@ -1,44 +0,0 @@
1
- import { createCss, createMergeCss, hypenateProperty, withoutSpace } from '../helpers.mjs';
2
- import { sortConditions, finalizeConditions } from './conditions.mjs';
3
-
4
- const utilities = "aspectRatio:aspect,boxDecorationBreak:decoration,zIndex:z,boxSizing:box,objectPosition:object,objectFit:object,overscrollBehavior:overscroll,overscrollBehaviorX:overscroll-x,overscrollBehaviorY:overscroll-y,position:pos/1,top:top,left:left,insetInline:inset-x,insetBlock:inset-y,inset:inset,insetBlockEnd:inset-b,insetBlockStart:inset-t,insetInlineEnd:end/insetEnd/1,insetInlineStart:start/insetStart/1,right:right,bottom:bottom,insetX:inset-x,insetY:inset-y,float:float,visibility:vis,display:d,hideFrom:hide,hideBelow:show,flexBasis:basis,flex:flex,flexDirection:flex/flexDir,flexGrow:grow,flexShrink:shrink,gridTemplateColumns:grid-cols,gridTemplateRows:grid-rows,gridColumn:col-span,gridRow:row-span,gridColumnStart:col-start,gridColumnEnd:col-end,gridAutoFlow:grid-flow,gridAutoColumns:auto-cols,gridAutoRows:auto-rows,gap:gap,gridGap:gap,gridRowGap:gap-x,gridColumnGap:gap-y,rowGap:gap-x,columnGap:gap-y,justifyContent:justify,alignContent:content,alignItems:items,alignSelf:self,padding:p/1,paddingLeft:pl/1,paddingRight:pr/1,paddingTop:pt/1,paddingBottom:pb/1,paddingBlock:py/1/paddingY,paddingBlockEnd:pb,paddingBlockStart:pt,paddingInline:px/paddingX/1,paddingInlineEnd:pe/1/paddingEnd,paddingInlineStart:ps/1/paddingStart,marginLeft:ml/1,marginRight:mr/1,marginTop:mt/1,marginBottom:mb/1,margin:m/1,marginBlock:my/1/marginY,marginBlockEnd:mb,marginBlockStart:mt,marginInline:mx/1/marginX,marginInlineEnd:me/1/marginEnd,marginInlineStart:ms/1/marginStart,outlineWidth:ring/ringWidth,outlineColor:ring/ringColor,outline:ring/1,outlineOffset:ring/ringOffset,divideX:divide-x,divideY:divide-y,divideColor:divide,divideStyle:divide,width:w/1,inlineSize:w,minWidth:min-w/minW,minInlineSize:min-w,maxWidth:max-w/maxW,maxInlineSize:max-w,height:h/1,blockSize:h,minHeight:min-h/minH,minBlockSize:min-h,maxHeight:max-h/maxH,maxBlockSize:max-b,color:text,fontFamily:font,fontSize:fs,fontWeight:font,fontSmoothing:smoothing,fontVariantNumeric:numeric,letterSpacing:tracking/1,lineHeight:leading/1,textAlign:text,textDecoration:text-decor,textDecorationColor:text-decor,textEmphasisColor:text-emphasis,textDecorationStyle:decoration,textDecorationThickness:decoration,textUnderlineOffset:underline-offset,textTransform:text,textIndent:indent,textShadow:text-shadow,textOverflow:text,verticalAlign:align,wordBreak:break,textWrap:text,truncate:truncate,lineClamp:clamp,listStyleType:list,listStylePosition:list,listStyleImage:list-img,backgroundPosition:bg/bgPosition,backgroundPositionX:bg-x/bgPositionX,backgroundPositionY:bg-y/bgPositionY,backgroundAttachment:bg/bgAttachment,backgroundClip:bg-clip/bgClip,background:bg/1,backgroundColor:bg/bgColor,backgroundOrigin:bg-origin/bgOrigin,backgroundImage:bg-img/bgImage,backgroundRepeat:bg-repeat/bgRepeat,backgroundBlendMode:bg-blend/bgBlendMode,backgroundSize:bg/bgSize,backgroundGradient:bg-gradient/bgGradient,textGradient:text-gradient,gradientFrom:from,gradientTo:to,gradientVia:via,borderRadius:rounded/1,borderTopLeftRadius:rounded-tl/roundedTopLeft,borderTopRightRadius:rounded-tr/roundedTopRight,borderBottomRightRadius:rounded-br/roundedBottomRight,borderBottomLeftRadius:rounded-bl/roundedBottomLeft,borderTopRadius:rounded-t/roundedTop,borderRightRadius:rounded-r/roundedRight,borderBottomRadius:rounded-b/roundedBottom,borderLeftRadius:rounded-l/roundedLeft,borderStartStartRadius:rounded-ss/roundedStartStart,borderStartEndRadius:rounded-se/roundedStartEnd,borderStartRadius:rounded-s/roundedStart,borderEndStartRadius:rounded-es/roundedEndStart,borderEndEndRadius:rounded-ee/roundedEndEnd,borderEndRadius:rounded-e/roundedEnd,border:border,borderColor:border,borderInline:border-x/borderX,borderInlineWidth:border-x/borderXWidth,borderInlineColor:border-x/borderXColor,borderBlock:border-y/borderY,borderBlockWidth:border-y/borderYWidth,borderBlockColor:border-y/borderYColor,borderLeft:border-l,borderLeftColor:border-l,borderInlineStart:border-s/borderStart,borderInlineStartWidth:border-s/borderStartWidth,borderInlineStartColor:border-s/borderStartColor,borderRight:border-r,borderRightColor:border-r,borderInlineEnd:border-e/borderEnd,borderInlineEndWidth:border-e/borderEndWidth,borderInlineEndColor:border-e/borderEndColor,borderTop:border-t,borderTopColor:border-t,borderBottom:border-b,borderBottomColor:border-b,borderBlockEnd:border-be,borderBlockEndColor:border-be,borderBlockStart:border-bs,borderBlockStartColor:border-bs,boxShadow:shadow/1,boxShadowColor:shadow/shadowColor,mixBlendMode:mix-blend,filter:filter,brightness:brightness,contrast:contrast,grayscale:grayscale,hueRotate:hue-rotate,invert:invert,saturate:saturate,sepia:sepia,dropShadow:drop-shadow,blur:blur,backdropFilter:backdrop,backdropBlur:backdrop_blur,backdropBrightness:backdrop-brightness,backdropContrast:backdrop-contrast,backdropGrayscale:backdrop-grayscale,backdropHueRotate:backdrop-hue-rotate,backdropInvert:backdrop-invert,backdropOpacity:backdrop-opacity,backdropSaturate:backdrop-saturate,backdropSepia:backdrop-sepia,borderCollapse:border,borderSpacing:border-spacing,borderSpacingX:border-spacing-x,borderSpacingY:border-spacing-y,tableLayout:table,transitionTimingFunction:ease,transitionDelay:delay,transitionDuration:duration,transitionProperty:transition-prop,transition:transition,animation:animation,animationName:animation-name,animationDelay:animation-delay,transformOrigin:origin,scale:scale,scaleX:scale-x,scaleY:scale-y,translate:translate,translateX:translate_x/x,translateY:translate_y/y,accentColor:accent,caretColor:caret,scrollBehavior:scroll,scrollbar:scrollbar,scrollMargin:scroll-m,scrollMarginX:scroll-mx,scrollMarginY:scroll-my,scrollMarginLeft:scroll-ml,scrollMarginRight:scroll-mr,scrollMarginTop:scroll-mt,scrollMarginBottom:scroll-mb,scrollMarginBlock:scroll-my,scrollMarginBlockEnd:scroll-mb,scrollMarginBlockStart:scroll-mt,scrollMarginInline:scroll-mx,scrollMarginInlineEnd:scroll-me,scrollMarginInlineStart:scroll-ms,scrollPadding:scroll-p,scrollPaddingBlock:scroll-pb,scrollPaddingBlockStart:scroll-pt,scrollPaddingBlockEnd:scroll-pb,scrollPaddingInline:scroll-px,scrollPaddingInlineEnd:scroll-pe,scrollPaddingInlineStart:scroll-ps,scrollPaddingX:scroll-px,scrollPaddingY:scroll-py,scrollPaddingLeft:scroll-pl,scrollPaddingRight:scroll-pr,scrollPaddingTop:scroll-pt,scrollPaddingBottom:scroll-pb,scrollSnapAlign:snap,scrollSnapStop:snap,scrollSnapType:snap,scrollSnapStrictness:strictness,scrollSnapMargin:snap-m,scrollSnapMarginTop:snap-mt,scrollSnapMarginBottom:snap-mb,scrollSnapMarginLeft:snap-ml,scrollSnapMarginRight:snap-mr,touchAction:touch,userSelect:select,fill:fill,stroke:stroke,srOnly:sr,debug:debug,appearance:appearance,backfaceVisibility:backface,clipPath:clip-path,hyphens:hyphens,mask:mask,maskImage:mask-image,maskSize:mask-size,textSizeAdjust:text-size-adjust,animateIn:animate_in,animateOut:animate_out,fadeIn:animate_fade_in,fadeOut:animate_fade_out,zoomIn:animate_zoom_in,zoomOut:animate_zoom_out,spinIn:animate_spin_in,spinOut:animate_spin_out,slideInFromTop:animate_slide_in_from_top,slideInFromBottom:animate_slide_in_from_bottom,slideInFromLeft:animate_slide_in_from_left,slideInFromRight:animate_slide_in_from_right,slideOutToTop:animate_slide_out_to_top,slideOutToBottom:animate_slide_out_to_bottom,slideOutToLeft:animate_slide_out_to_left,slideOutToRight:animate_slide_out_to_right,backgroundAlpha:background-alpha/bga,gradientFromAlpha:from-alpha,gradientToAlpha:to-alpha,borderAlpha:border_color_alpha/bca,container:container,focusRingWidth:focus-ring-width,focusRingColor:focus-ring-color,focusRingOffsetWidth:focus-ring-offset-width,focusRingOffsetColor:focus-ring-offset-color,focusRingInset:focus-ring-inset,spaceY:space_y,spaceX:space_x,textAlpha:text_alpha/ca,textStyle:textStyle,layerStyle:layerStyle"
5
-
6
- const classNameByProp = new Map()
7
- const shorthands = new Map()
8
- utilities.split(',').forEach((utility) => {
9
- const [prop, meta] = utility.split(':')
10
- const [className, ...shorthandList] = meta.split('/')
11
- classNameByProp.set(prop, className)
12
- if (shorthandList.length) {
13
- shorthandList.forEach((shorthand) => {
14
- shorthands.set(shorthand === '1' ? className : shorthand, prop)
15
- })
16
- }
17
- })
18
-
19
- const resolveShorthand = (prop) => shorthands.get(prop) || prop
20
-
21
- const context = {
22
-
23
- conditions: {
24
- shift: sortConditions,
25
- finalize: finalizeConditions,
26
- breakpoints: { keys: ["base","sm","md","lg","2lg","xl","2xl"] }
27
- },
28
- utility: {
29
-
30
- transform: (prop, value) => {
31
- const key = resolveShorthand(prop)
32
- const propKey = classNameByProp.get(key) || hypenateProperty(key)
33
- return { className: `${propKey}_${withoutSpace(value)}` }
34
- },
35
- hasShorthand: true,
36
- resolveShorthand: resolveShorthand,
37
- }
38
- }
39
-
40
- const cssFn = createCss(context)
41
- export const css = (...styles) => cssFn(mergeCss(...styles))
42
- css.raw = (...styles) => mergeCss(...styles)
43
-
44
- export const { mergeCss, assignCss } = createMergeCss(context)
@@ -1,6 +0,0 @@
1
- /* eslint-disable */
2
- import type { RecipeCreatorFn } from '../types/recipe.d.mts';
3
-
4
- export declare const cva: RecipeCreatorFn
5
-
6
- export type { RecipeVariantProps } from '../types/recipe.d.mts';
@@ -1,63 +0,0 @@
1
- import { compact, splitProps } from '../helpers.mjs';
2
- import { css, mergeCss } from './css.mjs';
3
-
4
- export function cva(config) {
5
- const { base = {}, variants = {}, defaultVariants = {}, compoundVariants = [] } = config
6
-
7
- function resolve(props = {}) {
8
- const computedVariants = { ...defaultVariants, ...compact(props) }
9
- let variantCss = { ...base }
10
- for (const [key, value] of Object.entries(computedVariants)) {
11
- if (variants[key]?.[value]) {
12
- variantCss = mergeCss(variantCss, variants[key][value])
13
- }
14
- }
15
- const compoundVariantCss = getCompoundVariantCss(compoundVariants, computedVariants)
16
- return mergeCss(variantCss, compoundVariantCss)
17
- }
18
-
19
- function cvaFn(props) {
20
- return css(resolve(props))
21
- }
22
-
23
- const variantKeys = Object.keys(variants)
24
-
25
- function splitVariantProps(props) {
26
- return splitProps(props, variantKeys)
27
- }
28
-
29
- const variantMap = Object.fromEntries(Object.entries(variants).map(([key, value]) => [key, Object.keys(value)]))
30
-
31
- return Object.assign(cvaFn, {
32
- __cva__: true,
33
- variantMap,
34
- variantKeys,
35
- raw: resolve,
36
- config,
37
- splitVariantProps,
38
- })
39
- }
40
-
41
- export function getCompoundVariantCss(compoundVariants, variantMap) {
42
- let result = {}
43
- compoundVariants.forEach((compoundVariant) => {
44
- const isMatching = Object.entries(compoundVariant).every(([key, value]) => {
45
- if (key === 'css') return true
46
-
47
- const values = Array.isArray(value) ? value : [value]
48
- return values.some((value) => variantMap[key] === value)
49
- })
50
-
51
- if (isMatching) {
52
- result = mergeCss(result, compoundVariant.css)
53
- }
54
- })
55
-
56
- return result
57
- }
58
-
59
- export function assertCompoundVariant(name, compoundVariants, variants, prop) {
60
- if (compoundVariants.length > 0 && typeof variants?.[prop] === 'object') {
61
- throw new Error(`[recipe:${name}:${prop}] Conditions are not supported when using compound variants.`)
62
- }
63
- }
@@ -1,5 +0,0 @@
1
- /* eslint-disable */
2
- type Argument = string | boolean | null | undefined
3
-
4
- /** Conditionally join classNames into a single string */
5
- export declare function cx(...args: Argument[]): string
@@ -1,15 +0,0 @@
1
- function cx() {
2
- let str = '',
3
- i = 0,
4
- arg
5
-
6
- for (; i < arguments.length; ) {
7
- if ((arg = arguments[i++]) && typeof arg === 'string') {
8
- str && (str += ' ')
9
- str += arg
10
- }
11
- }
12
- return str
13
- }
14
-
15
- export { cx }
@@ -1,5 +0,0 @@
1
- /* eslint-disable */
2
- export * from './css.d.mts';
3
- export * from './cx.d.mts';
4
- export * from './cva.d.mts';
5
- export * from './sva.d.mts';
@@ -1,4 +0,0 @@
1
- export * from './css.mjs';
2
- export * from './cx.mjs';
3
- export * from './cva.mjs';
4
- export * from './sva.mjs';
@@ -1,4 +0,0 @@
1
- /* eslint-disable */
2
- import type { SlotRecipeCreatorFn } from '../types/recipe.d.mts';
3
-
4
- export declare const sva: SlotRecipeCreatorFn