@nongt/visql 0.0.0-stage → 0.3.1

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 (186) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +916 -2
  3. package/dist/PipelineEditor-DNZkDSaY.js +10042 -0
  4. package/dist/calendarDate-CYlr9TvX.js +43 -0
  5. package/dist/core-api-BDCnbFHY.js +1056 -0
  6. package/dist/core.js +80 -0
  7. package/dist/fixtures.js +7 -0
  8. package/dist/index.js +145 -0
  9. package/dist/issueLocation-Cw5sttQL.js +3183 -0
  10. package/dist/mui-date-pickers.js +117 -0
  11. package/dist/mui.js +510 -0
  12. package/dist/schema-z95dxLxu.js +839 -0
  13. package/dist/sql-import.js +1366 -0
  14. package/dist/style.css +1 -0
  15. package/dist/tokens-BTaVMSOx.js +95 -0
  16. package/dist/types/adapters/mui/MuiDatePicker.d.ts +12 -0
  17. package/dist/types/adapters/mui/MuiDateTimePicker.d.ts +10 -0
  18. package/dist/types/adapters/mui/MuiListInput.d.ts +9 -0
  19. package/dist/types/adapters/mui/MuiTimePicker.d.ts +10 -0
  20. package/dist/types/adapters/mui/QueryBuilder.d.ts +12 -0
  21. package/dist/types/adapters/mui/components.d.ts +16 -0
  22. package/dist/types/adapters/mui/index.d.ts +6 -0
  23. package/dist/types/adapters/mui/muiPickers.d.ts +6 -0
  24. package/dist/types/adapters/mui/pickerStyles.d.ts +28 -0
  25. package/dist/types/adapters/mui/theme.d.ts +11 -0
  26. package/dist/types/core/BetweenOnTextContext.d.ts +11 -0
  27. package/dist/types/core/DialectContext.d.ts +10 -0
  28. package/dist/types/core/DrillDownContext.d.ts +22 -0
  29. package/dist/types/core/ExistsContext.d.ts +29 -0
  30. package/dist/types/core/FlowDirectionContext.d.ts +8 -0
  31. package/dist/types/core/FlowOrientationContext.d.ts +6 -0
  32. package/dist/types/core/FunctionsContext.d.ts +25 -0
  33. package/dist/types/core/GroupKeysContext.d.ts +18 -0
  34. package/dist/types/core/MeasureLockContext.d.ts +12 -0
  35. package/dist/types/core/ReadOnlyContext.d.ts +6 -0
  36. package/dist/types/core/SchemaContext.d.ts +8 -0
  37. package/dist/types/core/SubqueryContext.d.ts +16 -0
  38. package/dist/types/core/UnionBranchContext.d.ts +6 -0
  39. package/dist/types/core/ValueInputContext.d.ts +24 -0
  40. package/dist/types/core/absolutePath.d.ts +57 -0
  41. package/dist/types/core/ast.d.ts +154 -0
  42. package/dist/types/core/astChildren.d.ts +4 -0
  43. package/dist/types/core/astEqual.d.ts +4 -0
  44. package/dist/types/core/astMap.d.ts +21 -0
  45. package/dist/types/core/calendarDate.d.ts +21 -0
  46. package/dist/types/core/columnFormats.d.ts +23 -0
  47. package/dist/types/core/components/BoolPicker.d.ts +8 -0
  48. package/dist/types/core/components/NumberInput.d.ts +8 -0
  49. package/dist/types/core/components/ReadOnlyPart.d.ts +10 -0
  50. package/dist/types/core/components/TextInput.d.ts +8 -0
  51. package/dist/types/core/components/expression/BinaryView.d.ts +10 -0
  52. package/dist/types/core/components/expression/ExprSummary.d.ts +12 -0
  53. package/dist/types/core/components/expression/ExpressionTypeSelector.d.ts +35 -0
  54. package/dist/types/core/components/expression/ExpressionView.d.ts +30 -0
  55. package/dist/types/core/components/expression/FieldView.d.ts +15 -0
  56. package/dist/types/core/components/expression/FormulaPeek.d.ts +14 -0
  57. package/dist/types/core/components/expression/FunctionArgInput.d.ts +22 -0
  58. package/dist/types/core/components/expression/FunctionView.d.ts +7 -0
  59. package/dist/types/core/components/expression/ListView.d.ts +20 -0
  60. package/dist/types/core/components/expression/LiteralView.d.ts +23 -0
  61. package/dist/types/core/components/expression/LogicalView.d.ts +9 -0
  62. package/dist/types/core/components/expression/MeasureMenu.d.ts +21 -0
  63. package/dist/types/core/components/expression/ParamView.d.ts +13 -0
  64. package/dist/types/core/components/expression/RelativeDateView.d.ts +15 -0
  65. package/dist/types/core/components/expression/SubqueryView.d.ts +8 -0
  66. package/dist/types/core/components/expression/formulaClasses.d.ts +8 -0
  67. package/dist/types/core/components/flow/CaseBranchFlowNode.d.ts +5 -0
  68. package/dist/types/core/components/flow/CaseElseFlowNode.d.ts +5 -0
  69. package/dist/types/core/components/flow/CaseFlowNode.d.ts +5 -0
  70. package/dist/types/core/components/flow/ConditionFlowNode.d.ts +5 -0
  71. package/dist/types/core/components/flow/CreateConditionFlowNode.d.ts +14 -0
  72. package/dist/types/core/components/flow/CreateHavingFlowNode.d.ts +11 -0
  73. package/dist/types/core/components/flow/DistinctToggle.d.ts +10 -0
  74. package/dist/types/core/components/flow/ExistsFlowNode.d.ts +9 -0
  75. package/dist/types/core/components/flow/FromFlowNode.d.ts +110 -0
  76. package/dist/types/core/components/flow/FunctionArgFlowNode.d.ts +5 -0
  77. package/dist/types/core/components/flow/FunctionCallFlowNode.d.ts +5 -0
  78. package/dist/types/core/components/flow/FunctionSortKeys.d.ts +10 -0
  79. package/dist/types/core/components/flow/GroupBgNode.d.ts +14 -0
  80. package/dist/types/core/components/flow/GroupByFlowNode.d.ts +29 -0
  81. package/dist/types/core/components/flow/IfElseFlowNode.d.ts +5 -0
  82. package/dist/types/core/components/flow/IfFlowNode.d.ts +5 -0
  83. package/dist/types/core/components/flow/IfThenFlowNode.d.ts +5 -0
  84. package/dist/types/core/components/flow/LeafConditionFrame.d.ts +19 -0
  85. package/dist/types/core/components/flow/LogicalFlowNode.d.ts +5 -0
  86. package/dist/types/core/components/flow/MoveTooltip.d.ts +19 -0
  87. package/dist/types/core/components/flow/NotFlowNode.d.ts +5 -0
  88. package/dist/types/core/components/flow/OrderByFlowNode.d.ts +32 -0
  89. package/dist/types/core/components/flow/SectionLabelFlowNode.d.ts +7 -0
  90. package/dist/types/core/components/flow/SelectFlowNode.d.ts +49 -0
  91. package/dist/types/core/components/flow/SharedQueriesFlowNode.d.ts +39 -0
  92. package/dist/types/core/components/flow/SummaryPill.d.ts +12 -0
  93. package/dist/types/core/components/flow/WarningNote.d.ts +9 -0
  94. package/dist/types/core/components/flow/chainSides.d.ts +18 -0
  95. package/dist/types/core/components/flow/dragContext.d.ts +12 -0
  96. package/dist/types/core/components/flow/moveTooltipHysteresis.d.ts +18 -0
  97. package/dist/types/core/components/flow/useRowDrag.d.ts +34 -0
  98. package/dist/types/core/components/flow/useRowReorderFlip.d.ts +30 -0
  99. package/dist/types/core/derivedTables.d.ts +98 -0
  100. package/dist/types/core/distinctSort.d.ts +7 -0
  101. package/dist/types/core/drillPath.d.ts +11 -0
  102. package/dist/types/core/exists.d.ts +7 -0
  103. package/dist/types/core/existsMenu.d.ts +61 -0
  104. package/dist/types/core/expressionFlow.d.ts +428 -0
  105. package/dist/types/core/fanOut.d.ts +58 -0
  106. package/dist/types/core/findParts.d.ts +19 -0
  107. package/dist/types/core/flowTrees.d.ts +20 -0
  108. package/dist/types/core/focusKey.d.ts +10 -0
  109. package/dist/types/core/formula.d.ts +24 -0
  110. package/dist/types/core/formulaPeek.d.ts +16 -0
  111. package/dist/types/core/functionRegistry.d.ts +117 -0
  112. package/dist/types/core/grouping.d.ts +58 -0
  113. package/dist/types/core/history.d.ts +25 -0
  114. package/dist/types/core/i18n/defaultMessages.d.ts +367 -0
  115. package/dist/types/core/i18n/messages.d.ts +273 -0
  116. package/dist/types/core/i18n/relativeDateWords.d.ts +3 -0
  117. package/dist/types/core/id.d.ts +5 -0
  118. package/dist/types/core/issueAnchor.d.ts +29 -0
  119. package/dist/types/core/issueLocation.d.ts +105 -0
  120. package/dist/types/core/limits.d.ts +17 -0
  121. package/dist/types/core/measures.d.ts +51 -0
  122. package/dist/types/core/params.d.ts +30 -0
  123. package/dist/types/core/pipelineAnchor.d.ts +118 -0
  124. package/dist/types/core/pipelineFlow.d.ts +271 -0
  125. package/dist/types/core/queryAst.d.ts +201 -0
  126. package/dist/types/core/queryHelpers.d.ts +113 -0
  127. package/dist/types/core/queryValidation.d.ts +206 -0
  128. package/dist/types/core/relativeDates.d.ts +11 -0
  129. package/dist/types/core/resolveNames.d.ts +17 -0
  130. package/dist/types/core/rowRange.d.ts +3 -0
  131. package/dist/types/core/schema.d.ts +119 -0
  132. package/dist/types/core/scopeQuery.d.ts +45 -0
  133. package/dist/types/core/selectColumns.d.ts +23 -0
  134. package/dist/types/core/settleQuery.d.ts +11 -0
  135. package/dist/types/core/sharedQueries.d.ts +66 -0
  136. package/dist/types/core/sqlGen.d.ts +102 -0
  137. package/dist/types/core/sqlOffsets.d.ts +5 -0
  138. package/dist/types/core/sqlSpans.d.ts +33 -0
  139. package/dist/types/core/storedQuery.d.ts +43 -0
  140. package/dist/types/core/summarize.d.ts +3 -0
  141. package/dist/types/core/theme/tokens.d.ts +74 -0
  142. package/dist/types/core/ui/UIContext.d.ts +6 -0
  143. package/dist/types/core/ui/index.d.ts +12 -0
  144. package/dist/types/core/ui/types.d.ts +264 -0
  145. package/dist/types/core/unionTables.d.ts +121 -0
  146. package/dist/types/core/useValueTypes.d.ts +12 -0
  147. package/dist/types/core/valueTypes.d.ts +54 -0
  148. package/dist/types/core-api.d.ts +20 -0
  149. package/dist/types/features/queryEditor/ExpressionFlowCanvas.d.ts +10 -0
  150. package/dist/types/features/queryEditor/FindBox.d.ts +12 -0
  151. package/dist/types/features/queryEditor/FlowCanvas.d.ts +96 -0
  152. package/dist/types/features/queryEditor/FocusPulse.d.ts +10 -0
  153. package/dist/types/features/queryEditor/IssuesButton.d.ts +16 -0
  154. package/dist/types/features/queryEditor/PipelineEditor.d.ts +210 -0
  155. package/dist/types/features/queryEditor/QueryOutline.d.ts +16 -0
  156. package/dist/types/features/queryEditor/ResultsPanel.d.ts +11 -0
  157. package/dist/types/features/queryEditor/RunButton.d.ts +11 -0
  158. package/dist/types/features/queryEditor/SubFlowPanel.d.ts +24 -0
  159. package/dist/types/features/queryEditor/UndoRedoToast.d.ts +6 -0
  160. package/dist/types/features/queryEditor/canvasPositioning.d.ts +81 -0
  161. package/dist/types/features/queryEditor/findKeys.d.ts +3 -0
  162. package/dist/types/features/queryEditor/flowDragUtils.d.ts +16 -0
  163. package/dist/types/features/queryEditor/focusContext.d.ts +24 -0
  164. package/dist/types/features/queryEditor/hoveredPart.d.ts +32 -0
  165. package/dist/types/features/queryEditor/issueFocusParts.d.ts +9 -0
  166. package/dist/types/features/queryEditor/issueLocationText.d.ts +7 -0
  167. package/dist/types/features/queryEditor/issueText.d.ts +11 -0
  168. package/dist/types/features/queryEditor/outlineSections.d.ts +23 -0
  169. package/dist/types/features/queryEditor/run.d.ts +36 -0
  170. package/dist/types/features/queryEditor/sectionLabels.d.ts +15 -0
  171. package/dist/types/features/queryEditor/treeScopeContext.d.ts +14 -0
  172. package/dist/types/features/queryEditor/useRemeasureOnDirectionChange.d.ts +7 -0
  173. package/dist/types/features/queryEditor/useRevealNewNodes.d.ts +35 -0
  174. package/dist/types/features/queryEditor/withTreeScope.d.ts +10 -0
  175. package/dist/types/fixtures.d.ts +44 -0
  176. package/dist/types/index.d.ts +13 -0
  177. package/dist/types/mui-date-pickers.d.ts +3 -0
  178. package/dist/types/mui.d.ts +2 -0
  179. package/dist/types/sql-import.d.ts +3 -0
  180. package/dist/types/sqlImport/context.d.ts +71 -0
  181. package/dist/types/sqlImport/expressions.d.ts +11 -0
  182. package/dist/types/sqlImport/importSql.d.ts +28 -0
  183. package/dist/types/sqlImport/parse.d.ts +6 -0
  184. package/dist/types/sqlImport/syntax.d.ts +245 -0
  185. package/dist/types/sqlImport/tokenize.d.ts +26 -0
  186. package/package.json +164 -3
@@ -0,0 +1,9 @@
1
+ import type { Node, NodeProps } from '@xyflow/react';
2
+ import type { ExistsNodeData } from '../../expressionFlow.js';
3
+ type ExistsFlowNodeType = Node<ExistsNodeData>;
4
+ /** An EXISTS on the condition canvas: "Has <table> linked by <…> where
5
+ * <conditions>". Its conditions open in their own panel, a condition
6
+ * canvas over `query.where` (the `existsWhere` step). The link isn't
7
+ * editable: a different one is a different entry of the EXISTS menu. */
8
+ declare const ExistsFlowNode: ({ id, data }: NodeProps<ExistsFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
9
+ export default ExistsFlowNode;
@@ -0,0 +1,110 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import { type ReactNode } from 'react';
3
+ import type { FlowDirection } from '../../expressionFlow.js';
4
+ import type { PipelineAction } from '../../pipelineFlow.js';
5
+ import { type Table } from '../../schema.js';
6
+ import { type QueryPipeline } from '../../queryAst.js';
7
+ export interface FromFlowNodeData extends Record<string, unknown> {
8
+ pipeline: QueryPipeline | undefined;
9
+ dispatch: (action: PipelineAction) => void;
10
+ onEditJoinCondition: (joinId: string, label: string) => void;
11
+ /** Opens a derived table's own canvas. */
12
+ onOpenDerived?: (joinId: string, label: string) => void;
13
+ /** Opens a new sub query's canvas, to become a join or the base once its
14
+ * first table is picked. Not offered without it. */
15
+ onCreateSubQuery?: (as: 'join' | 'base') => void;
16
+ /** A derived table's FROM list: it can't be left without a table. */
17
+ nested?: boolean;
18
+ /** Shared queries (issue 194), when the editor offers them: those this
19
+ * canvas may use, in order (on a shared query's own canvas, only those
20
+ * before it); using one as the base or joined; making one ("Create
21
+ * Shared Query", when offered); opening one's canvas. */
22
+ shared?: {
23
+ list: readonly {
24
+ id: string;
25
+ name: string;
26
+ }[];
27
+ onUse: (id: string, as: 'join' | 'base') => void;
28
+ onCreate?: (as: 'join' | 'base') => void;
29
+ onOpen: (id: string, name: string) => void;
30
+ /** A sub query's row made a shared query ("Make Shared"), when offered. */
31
+ onMakeShared?: (derivedId: string) => void;
32
+ /** A shared query's place given a copy of its own, a sub query ("Make
33
+ * Sub Query"): a join's, by its id, or the base's (undefined). */
34
+ onMakeSubQuery?: (joinId: string | undefined) => void;
35
+ /** The shared query whose places light up (its row hovered). */
36
+ highlight?: string;
37
+ };
38
+ /** The Shared Queries section leads into it: the handle its edge ends at. */
39
+ fromShared?: boolean;
40
+ direction: FlowDirection;
41
+ /** Tables whose rows the joins repeat, read by a sum, average or count —
42
+ * those come out too high (see fanOut). By the name or alias fields use. */
43
+ fanOutTables?: readonly string[];
44
+ /** Lines said under the tables: on a measure's canvas, what it follows. */
45
+ note?: readonly string[];
46
+ /** Adding another table's rows (a union, issue 121), when the editor
47
+ * offers it: the tables that can be (unionableTables), and adding or
48
+ * removing one. */
49
+ unions?: {
50
+ tables: readonly Table[];
51
+ onAdd: (table: string) => void;
52
+ /** A union's (FROM's or a join's) query removed. */
53
+ onRemove: (unionId: string, index: number) => void;
54
+ /** A union of one query made a plain query again (unwrapUnion). */
55
+ onUnwrap: (unionId: string) => void;
56
+ /** Free-form unions (issue 153), when offered: a new one ("Create
57
+ * Union", for an empty query — the whole query's only), the query as
58
+ * one's first ("Union with another query"), a new one joined ("Join a
59
+ * union"), another query for one ("Add query"). Each opens the new
60
+ * query's canvas, empty. And UNION or UNION ALL (`onSetAll`). */
61
+ free?: {
62
+ onCreate?: () => void;
63
+ onUnionWith: () => void;
64
+ onJoinUnion: () => void;
65
+ onAddBranch: (unionId: string) => void;
66
+ onSetAll: (unionId: string, all: boolean) => void;
67
+ };
68
+ };
69
+ }
70
+ type FromFlowNodeType = Node<FromFlowNodeData>;
71
+ /** A derived table's name, edited in place: its alias, set like the other
72
+ * rows' table names (a dotted underline says it can be edited), and the
73
+ * line under it. Enter or leaving it renames; Escape puts it back. A name
74
+ * it can't take (none, or one another table goes by) says why on that
75
+ * line, and is never sent. */
76
+ export declare const DerivedName: ({ alias, taken, onRename, onOpen, aside, takenText, open, }: {
77
+ alias: string;
78
+ /** Names another table already goes by (the query's, the schema's). */
79
+ taken: string[];
80
+ onRename: (alias: string) => void;
81
+ /** Opens its query's canvas, from the icon after its name. */
82
+ onOpen?: () => void;
83
+ /** At the end of its line (a union's UNION toggle). */
84
+ aside?: ReactNode;
85
+ /** What a name already taken says (a shared query's, issue 194). */
86
+ takenText?: (name: string) => string;
87
+ /** In place of the icon opening a sub query (a shared query's). */
88
+ open?: ReactNode;
89
+ }) => import("react/jsx-runtime").JSX.Element;
90
+ /** The icon opening a shared query's canvas (issue 194): from its place's
91
+ * row, and its own in the Shared Queries section. */
92
+ export declare const SharedOpenButton: ({ onOpen }: {
93
+ onOpen: () => void;
94
+ }) => import("react/jsx-runtime").JSX.Element;
95
+ /** The FROM/JOIN list, as a real ReactFlow node living in the same canvas as
96
+ * the WHERE tree (see FlowCanvas.tsx's `mainPipeline` prop) — connected by a
97
+ * single source edge to whichever comes next (the "+" create-condition node,
98
+ * or the WHERE root once one exists). Not user-draggable as a whole node
99
+ * (see where it's constructed in FlowCanvas.tsx) — its position is always
100
+ * auto-derived, only its OWN internal list order is user-reorderable, via
101
+ * Move Up/Down buttons or dragging a row itself.
102
+ *
103
+ * A row is dragged with useRowDrag: pointer events, not native HTML5
104
+ * drag-and-drop, which a ReactFlow node's own pointer handling suppresses
105
+ * before a `draggable` descendant ever gets its `dragstart`. A spot that
106
+ * would leave an ON naming a table joined after it is refused while
107
+ * dragging (`canMove`): the row doesn't take it, the row it needs is
108
+ * outlined, and a note says why. */
109
+ declare const FromFlowNode: ({ data }: NodeProps<FromFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
110
+ export default FromFlowNode;
@@ -0,0 +1,5 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { FunctionArgNodeData } from '../../expressionFlow.js';
3
+ type FunctionArgFlowNodeType = Node<FunctionArgNodeData>;
4
+ declare const FunctionArgFlowNode: ({ data }: NodeProps<FunctionArgFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
5
+ export default FunctionArgFlowNode;
@@ -0,0 +1,5 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import { type FunctionCallNodeData } from '../../expressionFlow.js';
3
+ type FunctionCallFlowNodeType = Node<FunctionCallNodeData>;
4
+ declare const FunctionCallFlowNode: ({ data }: NodeProps<FunctionCallFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
5
+ export default FunctionCallFlowNode;
@@ -0,0 +1,10 @@
1
+ import type { ExpressionNode, FunctionSortKey } from '../../ast.js';
2
+ /** An aggregate's sort keys, each a row like Sort & Limit's: its field, its
3
+ * direction, remove. A new one sorts by the value itself — most often
4
+ * what's wanted, and all PostgreSQL takes with DISTINCT. */
5
+ declare const FunctionSortKeys: ({ keys, value, onChange, }: {
6
+ keys: FunctionSortKey[];
7
+ value: ExpressionNode | undefined;
8
+ onChange: (keys: FunctionSortKey[]) => void;
9
+ }) => import("react/jsx-runtime").JSX.Element;
10
+ export default FunctionSortKeys;
@@ -0,0 +1,14 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { FlowDirection } from '../../expressionFlow.js';
3
+ export interface GroupBgData extends Record<string, unknown> {
4
+ width: number;
5
+ height: number;
6
+ depth: number;
7
+ /** True only for the outermost box (depth 0) — see the Handle block below
8
+ * for why only that one carries the from-anchor/to-select pair. */
9
+ isRoot: boolean;
10
+ direction: FlowDirection;
11
+ }
12
+ type GroupBgNodeType = Node<GroupBgData>;
13
+ declare const GroupBgNode: ({ id, data }: NodeProps<GroupBgNodeType>) => import("react/jsx-runtime").JSX.Element;
14
+ export default GroupBgNode;
@@ -0,0 +1,29 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { ExpressionNode } from '../../ast.js';
3
+ import { type DrillLevel } from '../../DrillDownContext.js';
4
+ import type { FlowDirection } from '../../expressionFlow.js';
5
+ import { type PipelineAction } from '../../pipelineFlow.js';
6
+ import type { PipelineScopeRoot } from '../../pipelineAnchor.js';
7
+ import type { GroupByItem } from '../../queryAst.js';
8
+ export interface GroupByFlowNodeData extends Record<string, unknown> {
9
+ groupBy: GroupByItem[];
10
+ having?: ExpressionNode;
11
+ /** HAVING uses a column that isn't one value per group (see
12
+ * groupingProblems). */
13
+ havingNotGrouped?: boolean;
14
+ dispatch: (action: PipelineAction) => void;
15
+ drillDownFor: (scopeRoot?: PipelineScopeRoot) => (level: DrillLevel) => void;
16
+ direction: FlowDirection;
17
+ /** Whether SELECT has an aggregate: only then are keys (and HAVING) added
18
+ * here — without one, grouping only drops duplicate rows, which "Leave
19
+ * out duplicate rows" does. Default true. */
20
+ canAdd?: boolean;
21
+ /** The aliases of SELECT's columns, by id: a key that follows a column
22
+ * (fromSelect) is labelled with it. */
23
+ columnAliases?: Record<string, string | undefined>;
24
+ }
25
+ type GroupByFlowNodeType = Node<GroupByFlowNodeData>;
26
+ /** On a measure's canvas kept in step with the report, its keys follow
27
+ * the report: the whole node is read-only (see MeasureLockContext). */
28
+ declare const GroupByFlowNode: (props: NodeProps<GroupByFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
29
+ export default GroupByFlowNode;
@@ -0,0 +1,5 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { IfElseNodeData } from '../../expressionFlow.js';
3
+ type IfElseFlowNodeType = Node<IfElseNodeData>;
4
+ declare const IfElseFlowNode: ({ data }: NodeProps<IfElseFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
5
+ export default IfElseFlowNode;
@@ -0,0 +1,5 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { IfNodeData } from '../../expressionFlow.js';
3
+ type IfFlowNodeType = Node<IfNodeData>;
4
+ declare const IfFlowNode: ({ data }: NodeProps<IfFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
5
+ export default IfFlowNode;
@@ -0,0 +1,5 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { IfThenNodeData } from '../../expressionFlow.js';
3
+ type IfThenFlowNodeType = Node<IfThenNodeData>;
4
+ declare const IfThenFlowNode: ({ data }: NodeProps<IfThenFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
5
+ export default IfThenFlowNode;
@@ -0,0 +1,19 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { FlowDirection, FlowDispatch } from '../../expressionFlow.js';
3
+ interface Props {
4
+ /** The React Flow node's id. */
5
+ id: string;
6
+ path: number[];
7
+ siblingCount: number;
8
+ direction: FlowDirection;
9
+ dispatch: FlowDispatch;
10
+ allowRootDelete?: boolean;
11
+ anchor?: boolean;
12
+ /** The condition itself, inside the card. */
13
+ children: ReactNode;
14
+ }
15
+ /** A leaf of the condition canvas — a comparison, an EXISTS: its card with
16
+ * the handles every leaf has, between the move buttons and the
17
+ * group / NOT / delete buttons. */
18
+ declare const LeafConditionFrame: ({ id, path, siblingCount, direction, dispatch, allowRootDelete, anchor, children, }: Props) => import("react/jsx-runtime").JSX.Element;
19
+ export default LeafConditionFrame;
@@ -0,0 +1,5 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { LogicalNodeData } from '../../expressionFlow.js';
3
+ type LogicalFlowNodeType = Node<LogicalNodeData>;
4
+ declare const LogicalFlowNode: ({ data }: NodeProps<LogicalFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
5
+ export default LogicalFlowNode;
@@ -0,0 +1,19 @@
1
+ import type { TooltipProps } from '../../ui/types.js';
2
+ /**
3
+ * A drop-in replacement for the UI kit's `<Tooltip>` for the reorder buttons in
4
+ * every *FlowNode.tsx (and SelectFlowNode / FromFlowNode's own rows).
5
+ *
6
+ * Two things MUI's own `<Tooltip>` doesn't do:
7
+ * 1. It only closes on mouseleave / blur / Escape — never on click — so
8
+ * after a click the label lingers under the pointer.
9
+ * 2. A reorder shifts the row layout: another Move button often slides in
10
+ * under a still-stationary pointer, and the browser re-fires `mouseover`
11
+ * on it, popping *its* tooltip as if hovered.
12
+ *
13
+ * So a click on any reorder button (intercepted in the capture phase, before
14
+ * the button's own `onClick` reorder dispatch) both closes this tooltip and
15
+ * arms a brief shared window (`moveTooltipHysteresis`) during which no
16
+ * MoveTooltip anywhere will open. Once it passes, a genuine hover shows the
17
+ * tooltip again as normal.
18
+ */
19
+ export default function MoveTooltip({ children, onOpen, onClose, ...rest }: TooltipProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { NotNodeData } from '../../expressionFlow.js';
3
+ type NotFlowNodeType = Node<NotNodeData>;
4
+ declare const NotFlowNode: ({ data }: NodeProps<NotFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
5
+ export default NotFlowNode;
@@ -0,0 +1,32 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import { type DrillLevel } from '../../DrillDownContext.js';
3
+ import type { FlowDirection } from '../../expressionFlow.js';
4
+ import { type PipelineAction } from '../../pipelineFlow.js';
5
+ import type { PipelineScopeRoot } from '../../pipelineAnchor.js';
6
+ import type { OrderByItem, SelectItem } from '../../queryAst.js';
7
+ export interface OrderByFlowNodeData extends Record<string, unknown> {
8
+ orderBy: OrderByItem[];
9
+ limit?: number;
10
+ offset?: number;
11
+ dispatch: (action: PipelineAction) => void;
12
+ drillDownFor: (scopeRoot?: PipelineScopeRoot) => (level: DrillLevel) => void;
13
+ direction: FlowDirection;
14
+ /** Sort keys (ids) that DISTINCT rules out — see sortKeysOutsideDistinct. */
15
+ outsideDistinct?: readonly string[];
16
+ /** Sort keys (ids) that aren't one value per group, in a grouped query —
17
+ * see groupingProblems. */
18
+ notGrouped?: readonly string[];
19
+ /** In a grouped query: the group keys' columns (`table.column`), the only
20
+ * columns a sort key may be — any other would change the grouping, or
21
+ * isn't one value per group. Aggregates of any column still can. */
22
+ groupKeyColumns?: readonly string[];
23
+ /** In a grouped query, SELECT's columns that sum something up, picked by
24
+ * name as a sort key (see GroupKeysContext). */
25
+ aggregateColumns?: readonly SelectItem[];
26
+ }
27
+ type OrderByFlowNodeType = Node<OrderByFlowNodeData>;
28
+ /** ORDER BY, LIMIT and OFFSET, as the node after SELECT on the main canvas
29
+ * (see FlowCanvas.tsx) — sort keys reorderable like SELECT columns, with
30
+ * row-count inputs under them. */
31
+ declare const OrderByFlowNode: ({ data }: NodeProps<OrderByFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
32
+ export default OrderByFlowNode;
@@ -0,0 +1,7 @@
1
+ import type { Node, NodeProps } from '@xyflow/react';
2
+ export interface SectionLabelFlowNodeData extends Record<string, unknown> {
3
+ text: string;
4
+ }
5
+ type SectionLabelFlowNodeType = Node<SectionLabelFlowNodeData>;
6
+ declare const SectionLabelFlowNode: ({ data }: NodeProps<SectionLabelFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
7
+ export default SectionLabelFlowNode;
@@ -0,0 +1,49 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { ExpressionNode } from '../../ast.js';
3
+ import { type DrillLevel } from '../../DrillDownContext.js';
4
+ import type { FlowDirection } from '../../expressionFlow.js';
5
+ import { type PipelineAction } from '../../pipelineFlow.js';
6
+ import type { PipelineScopeRoot } from '../../pipelineAnchor.js';
7
+ import { type SelectItem } from '../../queryAst.js';
8
+ import type { MeasureChoice } from '../expression/MeasureMenu.js';
9
+ export interface SelectFlowNodeData extends Record<string, unknown> {
10
+ select: SelectItem[];
11
+ /** The most columns it takes (IN's sub query: 1). No limit otherwise. */
12
+ maxColumns?: number;
13
+ /** SELECT DISTINCT — the switch under the columns. */
14
+ distinct?: boolean;
15
+ /** In a grouped query: columns (ids) that aren't one value per group, and
16
+ * whether no columns are picked (SELECT *) — see groupingProblems. */
17
+ notGrouped?: readonly string[];
18
+ groupedNeedsColumns?: boolean;
19
+ dispatch: (action: PipelineAction) => void;
20
+ drillDownFor: (scopeRoot?: PipelineScopeRoot) => (level: DrillLevel) => void;
21
+ direction: FlowDirection;
22
+ /** A measure from another table, for a column's type menu (see
23
+ * MeasureMenu): picking one makes that column read it. */
24
+ measures?: Omit<MeasureChoice, 'onAdd'> & {
25
+ onAdd: (selectId: string, table: string, value: ExpressionNode) => void;
26
+ };
27
+ }
28
+ type SelectFlowNodeType = Node<SelectFlowNodeData>;
29
+ /** The SELECT column list, as a real ReactFlow node living in the same
30
+ * canvas as FROM/JOIN and the WHERE tree (see FlowCanvas.tsx's
31
+ * `mainPipeline` prop) — the last node in the chain, connected by a single
32
+ * target edge from whichever comes before it (the WHERE root once one
33
+ * exists, or the "+" create-condition node otherwise — SELECT doesn't
34
+ * depend on WHERE being configured at all). Not user-draggable as a whole
35
+ * node, same convention as FromFlowNode/CreateConditionFlowNode — its
36
+ * position is always auto-derived, only its own internal column order is
37
+ * user-reorderable, via Move Up/Down buttons or dragging a row itself
38
+ * (useRowDrag; see FromFlowNode.tsx's own top comment, identical here).
39
+ *
40
+ * Each row's own expression renders inline via `ExpressionView` — the same
41
+ * generic value-position renderer every other slot in this app already
42
+ * uses (BinaryView's operands, function args, IF/CASE branch values) — so
43
+ * a column can be a plain field, a function call, arithmetic, CASE/IF,
44
+ * etc. exactly like everywhere else, with "Edit in sub-canvas" drilling
45
+ * already built in for the types that need it. See SelectRow's own
46
+ * comment on why each row needs its own scoped DrillDownContext.Provider
47
+ * for that to resolve/write back to the right column. */
48
+ declare const SelectFlowNode: ({ data }: NodeProps<SelectFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
49
+ export default SelectFlowNode;
@@ -0,0 +1,39 @@
1
+ import { type Node, type NodeProps } from '@xyflow/react';
2
+ import type { FlowDirection } from '../../expressionFlow.js';
3
+ /** What happens to a removed shared query's places: each gets a copy, a sub
4
+ * query of its own; or they go too. */
5
+ export type SharedRemoval = 'subQueries' | 'removeUses';
6
+ /** What the Shared Queries section shows and does. */
7
+ export interface SharedSection {
8
+ /** The whole query's shared queries, in order: how many places use each,
9
+ * and whether one is a query's base (it can't just go). */
10
+ list: readonly {
11
+ id: string;
12
+ name: string;
13
+ uses: number;
14
+ base: boolean;
15
+ }[];
16
+ /** Names a shared query can't be renamed to besides the others': the
17
+ * schema's tables (a shared query of that name would hide one). */
18
+ tables: readonly string[];
19
+ onRename: (id: string, name: string) => void;
20
+ onRemove: (id: string, places: SharedRemoval) => void;
21
+ onOpen: (id: string, name: string) => void;
22
+ /** "New Shared Query", when offered: one made before it's used. With none
23
+ * yet, the section is just this, a "+". */
24
+ onCreate?: () => void;
25
+ /** A row hovered (or none): its places light up. */
26
+ onHover?: (id: string | null) => void;
27
+ }
28
+ export interface SharedQueriesFlowNodeData extends Record<string, unknown>, SharedSection {
29
+ direction: FlowDirection;
30
+ }
31
+ type SharedQueriesFlowNodeType = Node<SharedQueriesFlowNodeData>;
32
+ /** The Shared Queries section (issue 194, docs/design/shared-queries.md):
33
+ * the whole query's shared queries (WITH), one row each — its name, edited
34
+ * in place, where it's used, the icon opening its canvas, and its remove
35
+ * button — then "New Shared Query". The first section of the main
36
+ * canvas's chain, before FROM, its edge into FROM. With none yet, just a
37
+ * "+" (when offered). */
38
+ declare const SharedQueriesFlowNode: ({ data }: NodeProps<SharedQueriesFlowNodeType>) => import("react/jsx-runtime").JSX.Element;
39
+ export default SharedQueriesFlowNode;
@@ -0,0 +1,12 @@
1
+ import type { ReactNode } from 'react';
2
+ /** A computed summary ("Rows 101–150", "Duplicate rows left out") as a
3
+ * full-width pill in the `summary*` theme colors. Its corners follow
4
+ * whatever it sits in — the container's radius minus the gap to it — so
5
+ * the two borders run parallel: `rounded` on a node panel (12px, `p-2`),
6
+ * `rounded-[2px]` in a field box (6px, `p-1`). */
7
+ declare const SummaryPill: ({ testId, radius, children }: {
8
+ testId: string;
9
+ radius: "rounded" | "rounded-[2px]";
10
+ children: ReactNode;
11
+ }) => import("react/jsx-runtime").JSX.Element;
12
+ export default SummaryPill;
@@ -0,0 +1,9 @@
1
+ /** A problem with the query as it stands, shown under what it's about
2
+ * (the rows it concerns carry a warning ring). As wide as the node, its
3
+ * text wrapping inside it: `w-0` keeps it from widening the node,
4
+ * `min-w-full` stretches it to the width the rest gives. */
5
+ declare const WarningNote: ({ testId, children }: {
6
+ testId: string;
7
+ children: string;
8
+ }) => import("react/jsx-runtime").JSX.Element;
9
+ export default WarningNote;
@@ -0,0 +1,18 @@
1
+ import { Position } from '@xyflow/react';
2
+ import type { FlowDirection, FlowOrientation } from '../../expressionFlow.js';
3
+ /** The sides of a section of the main canvas's chain (FROM → WHERE → Group
4
+ * Rows → SELECT → Sort & Limit) its edges use (issue 188): where the chain comes
5
+ * in (`into`) and goes on (`out`); where a branch leaves Group Rows
6
+ * (`branchOut`: HAVING) and comes into its tree (`branchIn`). Sideways, the
7
+ * chain runs along `direction` and a branch hangs below; downward, the
8
+ * chain runs top to bottom and a branch goes off to `direction`'s side. */
9
+ export interface ChainSides {
10
+ into: Position;
11
+ out: Position;
12
+ branchOut: Position;
13
+ branchIn: Position;
14
+ }
15
+ export declare function chainSides(direction: FlowDirection, orientation: FlowOrientation): ChainSides;
16
+ /** A node's chain sides: its direction (its data's), the canvas's
17
+ * orientation. */
18
+ export declare function useChainSides(direction: FlowDirection): ChainSides;
@@ -0,0 +1,12 @@
1
+ export interface DragContextValue {
2
+ /** bgIds that should expand (cross-group target + ancestors) */
3
+ expandedIds: Set<string>;
4
+ /** extra height to add to expanded bgIds */
5
+ extra: number;
6
+ /** bgIds that belong to the dragged subtree — these keep full opacity */
7
+ draggedBgIds: Set<string>;
8
+ /** whether a drag is in progress */
9
+ dragging: boolean;
10
+ }
11
+ declare const DragContext: import("react").Context<DragContextValue | null>;
12
+ export default DragContext;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Shared click hysteresis for `MoveTooltip` — mirrors MUI `<Tooltip>`'s own
3
+ * module-level `hystersisOpen`.
4
+ *
5
+ * A click on any reorder button sets `until` to a `Date.now()` timestamp
6
+ * before which *no* MoveTooltip anywhere will open. A reorder shifts the row
7
+ * layout, and the browser re-fires `mouseover` on whatever Move button slides
8
+ * in under a still-stationary pointer — without this, that button's tooltip
9
+ * pops up as if the user had hovered it.
10
+ *
11
+ * Self-expiring in real use; a plain mutable object so tests can reset it
12
+ * between cases.
13
+ */
14
+ export declare const moveTooltipHysteresis: {
15
+ until: number;
16
+ };
17
+ /** How long the no-open window lasts after a click, in ms. */
18
+ export declare const MOVE_TOOLTIP_HYSTERESIS_MS = 400;
@@ -0,0 +1,34 @@
1
+ import { type CSSProperties, type PointerEvent } from 'react';
2
+ /** Marks the lifted row (queryBuilder.css undoes a popover's own look). */
3
+ export declare const DRAGGING_ATTRIBUTE = "data-qb-dragging";
4
+ /** Marks the hidden copy keeping its slot. */
5
+ export declare const PLACEHOLDER_ATTRIBUTE = "data-qb-drag-placeholder";
6
+ interface Options {
7
+ /** The rows, in order: as many as there are. */
8
+ count: number;
9
+ /** Reorders the list: the row at `from` to `to`. */
10
+ onMove: (from: number, to: number) => void;
11
+ /** Whether the row at `from` (in the list) may take place `to` (in the
12
+ * order as it is now) — FROM: no ON may name a table joined after it.
13
+ * Default: any. */
14
+ canMove?: (from: number, to: number) => boolean;
15
+ /** No dragging (read-only). */
16
+ disabled?: boolean;
17
+ }
18
+ /** A row's part in a drag: its element, its press, its place while one
19
+ * goes on. */
20
+ export interface RowDragProps {
21
+ ref: (el: HTMLElement | null) => void;
22
+ onPointerDown: (event: PointerEvent) => void;
23
+ style: CSSProperties | undefined;
24
+ }
25
+ /** Each row's props (`rowProps(i)`), and the drag going on, if any. */
26
+ export default function useRowDrag({ count, onMove, canMove, disabled, }: Options): {
27
+ rowProps: (index: number) => RowDragProps;
28
+ /** The row being dragged, if one is. */
29
+ dragging: number | undefined;
30
+ /** The place it's last been over — its index in the order now, refused
31
+ * or not (FROM says why it's refused). */
32
+ over: number | undefined;
33
+ };
34
+ export {};
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Button-triggered FLIP reorder animation for a keyed list of sibling rows
3
+ * rendered as plain DOM inside a single React Flow node — the SELECT column
4
+ * list (`SelectFlowNode`) and the FROM/JOIN list (`FromFlowNode`). Those
5
+ * rows reorder by dispatching a pipeline action (`reorderSelectItems` /
6
+ * `reorderTables`), never by moving a React Flow node, so FlowCanvas.tsx's
7
+ * own node-position swap animation (which only ever slides whole nodes)
8
+ * never sees them — a Move Up/Down click would otherwise snap with no
9
+ * transition at all, unlike a WHERE condition node.
10
+ *
11
+ * Usage:
12
+ * const flip = useRowReorderFlip();
13
+ * // on each row element:
14
+ * <div ref={flip.registerRow(key)} />
15
+ * // in the Move Up/Down handler, synchronously *before* dispatching:
16
+ * flip.armReorder();
17
+ * dispatch({ type: 'reorderSelectItems', ... });
18
+ *
19
+ * `armReorder` snapshots every registered row's current viewport Y; the
20
+ * layout effect below then, on the first commit where a row has moved (the
21
+ * reorder reaches a canvas node a commit or two after the dispatch; within
22
+ * half a second), places each moved row back at its old Y with no
23
+ * transition and animates it to the new one, in the node's own pixels.
24
+ * A drop arms it too (useRowDrag), so a dragged row and the rows it passed
25
+ * slide from where they are on screen into their new places.
26
+ */
27
+ export default function useRowReorderFlip(): {
28
+ registerRow: (key: string) => (el: HTMLElement | null) => void;
29
+ armReorder: () => void;
30
+ };