@nongt/visql 0.0.0-stage → 0.3.0

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-CBN6rAQG.js +1052 -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,210 @@
1
+ import { type Ref } from 'react';
2
+ import { type FlowDirection, type FlowOrientation } from '../../core/expressionFlow.js';
3
+ import { type ExistsOptions } from '../../core/existsMenu.js';
4
+ import { type UnionTableOptions } from '../../core/unionTables.js';
5
+ import { type QueryValue } from '../../core/queryAst.js';
6
+ import { type DatabaseSchema, type SchemaIssue, type Table, type TableColumn } from '../../core/schema.js';
7
+ import type { SqlDialect } from '../../core/sqlGen.js';
8
+ import { type QueryIssue, type QueryIssueSeverity, type QueryWarningKind } from '../../core/queryValidation.js';
9
+ import { type BetweenOnText } from '../../core/BetweenOnTextContext.js';
10
+ import { type RenderValueInput } from '../../core/ValueInputContext.js';
11
+ import { type Messages } from '../../core/i18n/messages.js';
12
+ import { type FunctionRegistry } from '../../core/functionRegistry.js';
13
+ import type { UIComponents } from '../../core/ui/types.js';
14
+ import { type QueryBuilderTheme } from '../../core/theme/tokens.js';
15
+ import type { SectionLabels } from './sectionLabels.js';
16
+ import { type OnRun } from './run.js';
17
+ export interface PipelineEditorProps {
18
+ className?: string;
19
+ /** The database the builder works against — its tables/columns populate
20
+ * every picker, and its relations drive join suggestions and auto-adding
21
+ * tables. Supplied by the host app; see DatabaseSchema. */
22
+ schema: DatabaseSchema;
23
+ /** The query to show, for a host that owns the query state (strictly
24
+ * controlled: the editor shows exactly this, and an edit only appears once
25
+ * the host passes the query it received through `onChange` back in).
26
+ * - Whenever the shown query changes, the one before it becomes an undo
27
+ * step — whether the change came from an edit or from the host.
28
+ * - A query with a different `id` is a different query: undo history
29
+ * starts over (and any open sub-canvas closes).
30
+ * - `null` means a brand-new, empty query (with a fresh id), so it also
31
+ * starts over. The editor itself never reports `null` — an emptied query
32
+ * keeps its id (EmptyQuery).
33
+ * Pass the object from `onChange` back as-is and synchronously, like a
34
+ * controlled `<input>`. Leave `value` out for an uncontrolled editor. */
35
+ value?: QueryValue | null;
36
+ /** The query to start with when uncontrolled (`value` omitted), e.g. a
37
+ * saved report being reopened; null/omitted starts a new empty query. Only
38
+ * read on mount, like React's own `defaultValue`. */
39
+ defaultValue?: QueryValue | null;
40
+ /** Called with the query every edit, undo or redo asks for. Always carries
41
+ * the query's id — an emptied query is an EmptyQuery, never null. */
42
+ onChange?: (query: QueryValue) => void;
43
+ /** Imperative controls — see PipelineEditorHandle. */
44
+ ref?: Ref<PipelineEditorHandle>;
45
+ /** Called with validateSchema's findings whenever `schema` has problems (and
46
+ * again with [] once they're fixed). Without it, problems are logged with
47
+ * console.warn instead. The editor still renders either way. */
48
+ onSchemaIssues?: (issues: SchemaIssue[]) => void;
49
+ /** Called with validateQuery's findings for the query on screen — against
50
+ * `schema`, `functions` and the filters — whenever they change, and once
51
+ * on mount. A query is ready to run or save when none has severity
52
+ * 'error'. An empty query (no table picked) has none: check
53
+ * hasBaseTable as well. */
54
+ onIssues?: (issues: QueryIssue[]) => void;
55
+ /** The part of the query under the pointer on any canvas — by its path
56
+ * (`pathSegments`, as astToSqlWithSpans's spans and validateQuery's
57
+ * issues have them), or null once it's on none — each time it changes.
58
+ * For a SQL view to light up that part's SQL (issue 131: spansFor). */
59
+ onHoverPart?: (pathSegments: (string | number)[] | null) => void;
60
+ /** Show how many problems the query has (the same findings) in the bar
61
+ * above the canvas, with their list: picking one goes to it. Default
62
+ * true; never in read-only mode. Turn it off when the host lists them
63
+ * itself. */
64
+ showIssues?: boolean;
65
+ /** Interface text — any subset of DEFAULT_MESSAGES (e.g. a translation);
66
+ * the rest stays English. Pass a stable object. */
67
+ messages?: Partial<Messages>;
68
+ /** Captions shown above the FROM / WHERE / SELECT sections on the canvas.
69
+ * Kept for compatibility — the same captions are `messages.sectionFrom` /
70
+ * `sectionWhere` / `sectionSelect`; this prop wins where both are set. */
71
+ sectionLabels?: Partial<SectionLabels>;
72
+ /** Color overrides — any subset of the editor's color tokens (see
73
+ * DEFAULT_THEME), applied on top of the defaults. The same tokens can also
74
+ * be overridden in plain CSS on `.qb-root` (`--qb-accent: …`); this prop
75
+ * wins over CSS where both set the same token. */
76
+ theme?: Partial<QueryBuilderTheme>;
77
+ /** The UI kit every control is drawn with — one implementation per
78
+ * primitive (see core/ui/types.ts). The core editor ships no kit of its
79
+ * own: use the MUI preset (`QueryBuilder` from the `mui` entry, which
80
+ * fills this in and lets you override single primitives), or pass a
81
+ * complete kit for another library. Pass a stable object (e.g. a module
82
+ * constant). */
83
+ components: UIComponents;
84
+ /** Pan the canvas to show nodes the user just added (a condition, group,
85
+ * IF/CASE, …) when they'd land outside the visible area. Default true. */
86
+ autoRevealNewNodes?: boolean;
87
+ /** The SQL functions the editor offers (default: DEFAULT_FUNCTIONS).
88
+ * Extend it (`{ ...DEFAULT_FUNCTIONS, MY_FN: {...} }`), drop entries, or
89
+ * narrow it to a dialect with functionsForDialect(). Keys and names may
90
+ * be in any case. Pass a stable object (e.g. a module constant). */
91
+ functions?: FunctionRegistry;
92
+ /** Custom inputs for values of particular columns (a lookup picker, …) —
93
+ * see RenderValueInput. Columns with `options` in the schema already get
94
+ * a dropdown without this. */
95
+ renderValueInput?: RenderValueInput;
96
+ /** View-only: the query is shown and can be explored (sub-canvases still
97
+ * open), but nothing can be changed — no edit controls, inputs disabled,
98
+ * no dragging, no undo/redo. */
99
+ readOnly?: boolean;
100
+ /** Which tables this user may see and add. Hidden tables are never
101
+ * offered in pickers nor added automatically (not even as an
102
+ * intermediate join); relations through them are ignored. The full
103
+ * `schema` is still what's validated. */
104
+ tableFilter?: (table: Table) => boolean;
105
+ /** Which columns this user may see in the field pickers. */
106
+ columnFilter?: (table: Table, column: TableColumn) => boolean;
107
+ /** The font the editor's text uses (a CSS font-family, e.g.
108
+ * `'Kanit, sans-serif'`) — typically chosen per language along with
109
+ * `messages`. Default: the host page's font. The font itself must be
110
+ * loaded by the host (a webfont stylesheet, @fontsource, …). */
111
+ fontFamily?: string;
112
+ /** Which way the canvases grow: 'ltr' (default) puts each group's
113
+ * operator on the left and its conditions to the right, FROM → WHERE →
114
+ * SELECT reading left to right; 'rtl' mirrors all of it. */
115
+ direction?: FlowDirection;
116
+ /** Which way the main canvas's chain flows (issue 188): 'horizontal' (default)
117
+ * puts FROM, the conditions, Group Rows, SELECT and Sort & Limit side by
118
+ * side; 'vertical' stacks them top to bottom, HAVING's tree beside Group
119
+ * Rows — for a tall, narrow space. Combines with `direction`, which says
120
+ * which side things start from. */
121
+ orientation?: FlowOrientation;
122
+ /** The EXISTS button ("has related rows"): which related tables its menu
123
+ * lists (`relations`: 'toMany', the default, or 'both') and where it's
124
+ * offered (`in`: ['where', 'having'] by default, 'joinOn' when asked
125
+ * for, [] for nowhere). Only shapes what the editor offers: an EXISTS
126
+ * already in the query is shown and editable wherever it is. */
127
+ exists?: ExistsOptions;
128
+ /** Sub queries the editor offers (issue 122). `in: true` adds "Sub query"
129
+ * as IN's value: `x IN (SELECT …)`, a query of its own picking one
130
+ * column, edited on its own canvas — NOT IN with the NOT button. Off by
131
+ * default: NOT IN keeps no rows at all once the sub query gives a NULL
132
+ * (validateQuery warns, `notInSubquery`). Only shapes what the editor
133
+ * offers: a sub query already in the query is shown and editable. */
134
+ subqueries?: {
135
+ in?: boolean;
136
+ /** Adding another table's rows to the query (issue 121): "Add rows
137
+ * from another table" in FROM's "+ Add Table" — `UNION ALL`, built by
138
+ * addUnionTable with these options (`true`: its defaults). Each
139
+ * table's rows open on a canvas of their own; a column added there
140
+ * is added to the others, NULL (keepUnionsAligned). Off by default. */
141
+ union?: boolean | (Pick<UnionTableOptions, 'unshared' | 'source' | 'rowMarkers'> & {
142
+ /** Free-form unions too (issue 153): "Create Union" for an empty
143
+ * query, "Union with another query" for one that has tables, "Add
144
+ * query" on a union's row — any tables, each query a full one
145
+ * (groups, sums), made on its own canvas. Off by default. */
146
+ free?: boolean;
147
+ });
148
+ /** Shared queries (issue 194, WITH): "Create Shared Query" in FROM's
149
+ * pickers, and the shared queries there to use, as the base or joined
150
+ * — a query named once, edited once, used anywhere in the query. Off
151
+ * by default: a backend needs this package's stored format 4, and
152
+ * MySQL 8. A shared query already in the query is shown and editable
153
+ * either way. */
154
+ shared?: boolean;
155
+ };
156
+ /** Runs the query against your backend: adds a Run button (and
157
+ * Ctrl/⌘+Enter) above the canvas, on while the query has a table and no
158
+ * errors. Gets the query, not SQL — check it and write the SQL on the
159
+ * server. Return (or resolve to) a RunResult to show its rows under the
160
+ * canvas; return nothing to show them yourself. See OnRun. */
161
+ onRun?: OnRun;
162
+ /** Warnings not to show, by kind (see QUERY_WARNING_KINDS) — in the
163
+ * problems list, `onIssues` and on the canvas (the FROM node's fan-out
164
+ * note). E.g. ['crossJoin'] for reports that CROSS JOIN on purpose.
165
+ * Errors always show. Pass a stable array. */
166
+ hideWarnings?: readonly QueryWarningKind[];
167
+ /** How values of types that don't go together are reported
168
+ * (`typeMismatch`, issue 130): a warning, the default — or an error,
169
+ * for an application that wants types kept (see validateQuery). Pass
170
+ * your backend's setting, so the editor says what it will. */
171
+ typeMismatch?: QueryIssueSeverity;
172
+ /** The database the query is for (issue 167). The pickers then offer only
173
+ * what it has (functions narrowed with functionsForDialect, no REGEXP or
174
+ * DISTINCT STRING_AGG in SQL Server), and validateQuery reports what a
175
+ * query already holds that it lacks (`dialectUnsupported`) — shown, not
176
+ * dropped. Without it, everything is offered, as for any database. */
177
+ dialect?: SqlDialect;
178
+ /** Where BETWEEN is offered on text (issue 169). Text is ordered by the
179
+ * database's collation, so a text range rarely means what it reads as
180
+ * (`name BETWEEN 'A' AND 'M'` leaves out "Mary"). `'never'`, the
181
+ * default: numbers, dates and times only. `'withoutOptions'`: text too,
182
+ * but not a column with `options` (codes, such as a gender). `'always'`:
183
+ * any text. A BETWEEN a query already holds is shown either way. */
184
+ betweenOnText?: BetweenOnText;
185
+ }
186
+ /** Imperative controls a host can reach through PipelineEditor's `ref`. */
187
+ export interface PipelineEditorHandle {
188
+ /** Forgets every undo/redo step, making the query currently shown the new
189
+ * starting point — e.g. after loading a template into the same query (same
190
+ * id). A query with a different id, or `value={null}`, resets history on
191
+ * its own without this. */
192
+ resetHistory: () => void;
193
+ /** Runs the query, as the Run button does (when it's on). */
194
+ run: () => void;
195
+ /** Takes the user to a problem, as picking it in the editor's own problems
196
+ * list does: opens the sub-canvas it's in, pans there and pulses its
197
+ * node. For a host that lists the problems itself (`onIssues`,
198
+ * `showIssues={false}`). Takes an issue from `onIssues` or from a
199
+ * backend's validateQuery; one about an older version of the query goes
200
+ * as far as its path still leads. Returns whether there was a spot to go
201
+ * to: not without a query, or for an issue about the whole query. Works
202
+ * in read-only mode too. Without a severity, the spot pulses in the
203
+ * focus ring's colour: a place to go, not a problem (as Find does). */
204
+ goToIssue: (issue: GoToSpot) => boolean;
205
+ }
206
+ /** A spot to go to (goToIssue): a problem's path and severity — or, with
207
+ * no severity, a place to go (Find, a peek). */
208
+ export type GoToSpot = Pick<QueryIssue, 'pathSegments'> & Partial<Pick<QueryIssue, 'severity'>>;
209
+ declare const PipelineEditor: ({ className, schema, value, defaultValue, onChange, onSchemaIssues, onIssues, showIssues, onHoverPart, sectionLabels, messages, theme, components, autoRevealNewNodes, functions, renderValueInput, readOnly, tableFilter, columnFilter, direction, fontFamily, ref, orientation, exists, subqueries, onRun, hideWarnings, typeMismatch, dialect, betweenOnText, }: PipelineEditorProps) => import("react/jsx-runtime").JSX.Element;
210
+ export default PipelineEditor;
@@ -0,0 +1,16 @@
1
+ import type { QueryPipeline } from '../../core/queryAst.js';
2
+ import type { PipelineDrillLevel } from '../../core/pipelineAnchor.js';
3
+ interface Props {
4
+ /** None yet (no table picked): it says how to start. */
5
+ query: QueryPipeline | undefined;
6
+ /** Picked: go to it. */
7
+ onGo: (pathSegments: (string | number)[]) => void;
8
+ /** Folded away to its title. */
9
+ collapsed: boolean;
10
+ onCollapsedChange: (collapsed: boolean) => void;
11
+ /** The panel open (the topmost), to mark where it is; none on the main
12
+ * canvas. */
13
+ current?: PipelineDrillLevel;
14
+ }
15
+ declare const QueryOutline: ({ query, onGo, collapsed, onCollapsedChange, current, }: Props) => import("react/jsx-runtime").JSX.Element;
16
+ export default QueryOutline;
@@ -0,0 +1,11 @@
1
+ import { type RunState } from './run.js';
2
+ interface Props {
3
+ run: RunState;
4
+ /** The query has changed since this run. */
5
+ outdated: boolean;
6
+ onClose: () => void;
7
+ }
8
+ /** The rows the host's `onRun` gave back, under the canvas: a table, or
9
+ * "running", or what went wrong. */
10
+ declare const ResultsPanel: ({ run, outdated, onClose }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export default ResultsPanel;
@@ -0,0 +1,11 @@
1
+ interface Props {
2
+ onRun: () => void;
3
+ running: boolean;
4
+ /** Why it can't run now, if it can't (shown as its tooltip). */
5
+ blocked?: string;
6
+ }
7
+ /** Runs the query (the host's `onRun`), in the bar above the canvas. Off,
8
+ * with the reason, while the query can't run. Shown in read-only mode
9
+ * too: running changes nothing. */
10
+ declare const RunButton: ({ onRun, running, blocked }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export default RunButton;
@@ -0,0 +1,24 @@
1
+ import type { ExpressionNode } from '../../core/ast.js';
2
+ import { type AbsolutePath } from '../../core/absolutePath.js';
3
+ import { type DrillLevel } from '../../core/DrillDownContext.js';
4
+ import { type FlowDispatch } from '../../core/expressionFlow.js';
5
+ import { type MainPipelineBundle } from './FlowCanvas.js';
6
+ interface Props {
7
+ ast: ExpressionNode | undefined;
8
+ setAtPath: (path: AbsolutePath, updater: (prev: ExpressionNode | undefined) => ExpressionNode | undefined, coalesceEligible: boolean) => void;
9
+ level: DrillLevel;
10
+ isActive: boolean;
11
+ onPop: () => void;
12
+ /** Whether this level's root can be deleted (an EXISTS's conditions,
13
+ * which may be left with none) — the panel then closes. */
14
+ allowRootDelete?: boolean;
15
+ /** A derived table's own canvas instead of an expression: its query's
16
+ * bundle (undefined once the derived table is gone: the panel closes),
17
+ * and what its WHERE tree dispatches. `ast` and `setAtPath` are unused. */
18
+ pipelineCanvas?: {
19
+ bundle: MainPipelineBundle | undefined;
20
+ dispatch: FlowDispatch;
21
+ };
22
+ }
23
+ declare const SubFlowPanel: ({ ast, setAtPath, level, isActive, onPop, allowRootDelete, pipelineCanvas, }: Props) => import("react/jsx-runtime").JSX.Element | null;
24
+ export default SubFlowPanel;
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ label: string;
3
+ onClick: () => void;
4
+ }
5
+ declare const UndoRedoToast: ({ label, onClick }: Props) => import("react/jsx-runtime").JSX.Element;
6
+ export default UndoRedoToast;
@@ -0,0 +1,81 @@
1
+ import type { Node } from '@xyflow/react';
2
+ import type { FlowDirection, Size } from '../../core/expressionFlow.js';
3
+ /** The WHERE root's size before ReactFlow measures it — mirrors
4
+ * expressionFlow.ts's own CONDITION_W/CONDITION_H fallback. */
5
+ export declare const ROOT_FALLBACK: Size;
6
+ export declare const SELECT_GAP_X = 60;
7
+ /** A node's measured size from the previous render, or `fallback` before
8
+ * ReactFlow has measured it. */
9
+ export declare function getMeasuredSize(id: string, prevNodes: Node[], fallback: Size): Size;
10
+ /** Rightmost (ltr) / leftmost (rtl) edge reached by `nodes`, each measured
11
+ * via `getMeasuredSize` against `prevNodes` the same way FROM/root's own
12
+ * sizes are — used to position SELECT just beyond whatever currently ends
13
+ * the chain after FROM. Deliberately per-node rather than just root's own
14
+ * local position/size: children can (and typically do) extend further than
15
+ * the root pill itself once there's more than one condition, so root alone
16
+ * would under-place SELECT, overlapping the tree's own later conditions. */
17
+ export declare function computeChainExtentX(nodes: Node[], prevNodes: Node[], direction: FlowDirection): number;
18
+ /** Position for the SELECT node, `SELECT_GAP_X` beyond `extentX` (see
19
+ * `computeChainExtentX`), vertically centered on the same shared y=0 line
20
+ * FROM/root already share (see `computeFromAnchorOffset`'s own centering
21
+ * rationale). Not built on `computeFromAnchorOffset` itself: that function
22
+ * is specifically for FROM's own fixed origin at world x=0 (its rtl branch
23
+ * assumes the anchor sits immediately at FROM's own left edge) — SELECT
24
+ * instead sits beyond wherever the *previous* chain segment actually ends,
25
+ * which itself can already be arbitrarily far from FROM's origin in either
26
+ * direction depending on tree shape, hence its own extentX-based math. */
27
+ export declare function computeSelectPosition(extentX: number, selectSize: Size, direction: FlowDirection): {
28
+ x: number;
29
+ y: number;
30
+ };
31
+ export declare const BRANCH_GAP = 56;
32
+ /** Where a tree that branches off a section goes: across the chain's flow,
33
+ * so the chain itself (FROM → … → Sort & Limit) stays a straight line. The
34
+ * chain flows sideways, so a branch hangs below its section, its anchor
35
+ * (the root, or the root's box) centred under the section's middle: the
36
+ * edge goes straight down into the middle of its top. Returns the anchor's
37
+ * top-left. (A chain flowing downward would put a branch beside its
38
+ * section instead: right in ltr, left in rtl.) */
39
+ export declare function computeBranchPosition(section: {
40
+ position: {
41
+ x: number;
42
+ y: number;
43
+ };
44
+ size: Size;
45
+ }, anchorSize: Size): {
46
+ x: number;
47
+ y: number;
48
+ };
49
+ /** A box on the canvas: top-left and size. */
50
+ export interface Box {
51
+ x: number;
52
+ y: number;
53
+ width: number;
54
+ height: number;
55
+ }
56
+ /** The box around `nodes`, each measured the way computeChainExtentX does. */
57
+ export declare function boundingBox(nodes: Node[], prevNodes: Node[]): Box;
58
+ /** How far a branch's whole `box` (caption included), centred under its
59
+ * section, moves down to pass every one of `others` (the chain's sections
60
+ * and captions: FROM, WHERE, SELECT, …) it would otherwise run into — a
61
+ * tall one reaches down to where the branch hangs. It stays centred under
62
+ * its section; only its edge gets longer. 0 when it's clear already. */
63
+ export declare function branchShiftY(box: Box, others: readonly Box[]): number;
64
+ export declare const CHAIN_GAP_Y = 48;
65
+ /** One section of the chain as laid out sideways — its nodes (its caption
66
+ * included), the box they take up, caption and all, and the box of its
67
+ * nodes alone (`core`: what a branch lines up with). */
68
+ export interface ChainSection {
69
+ nodes: Node[];
70
+ box: Box;
71
+ core: Box;
72
+ }
73
+ /** The chain laid out downward instead (PipelineEditor's `orientation`,
74
+ * issue 188): each section as it was laid out sideways, moved as a whole, one
75
+ * below the other `CHAIN_GAP_Y` apart, centred on one vertical line
76
+ * (x = 0) — and `branch` (HAVING's tree, off section `branch.of`) beside
77
+ * its section instead of below it: right of it in ltr, left in rtl,
78
+ * centred on its height, and further out past any section in its way. */
79
+ export declare function stackChain(sections: readonly ChainSection[], direction: FlowDirection, branch?: ChainSection & {
80
+ of: number;
81
+ }): Node[];
@@ -0,0 +1,3 @@
1
+ /** Find's shortcut as the user's keyboard has it: ⌘F on a Mac (an iPad's
2
+ * keyboard too), Ctrl+F elsewhere. */
3
+ export default function findKeys(platform?: string): string;
@@ -0,0 +1,16 @@
1
+ import type { Node } from '@xyflow/react';
2
+ /** CSS class that opts a node into the position transition. */
3
+ export declare const ANIMATE_CLASS = "node-animate";
4
+ /** Duration to wait after a pre-drop animation before committing the AST change. */
5
+ export declare const DROP_SETTLE_MS = 160;
6
+ /**
7
+ * Compute new Y slot positions after a reorder, preserving the original gap between nodes.
8
+ *
9
+ * @param sorted Siblings in their original order.
10
+ * @param reordered Siblings in the new (post-drop) order.
11
+ * @param origSlots Original Y position of each sibling (index-matched to `sorted`).
12
+ * @param getHeight Returns the effective height of a node. Defaults to `measured.height`.
13
+ * Pass a custom function for nodes whose visual height differs (e.g. group nodes
14
+ * that use a groupBg to represent their full extent).
15
+ */
16
+ export declare function computeNewSlots(sorted: Node[], reordered: Node[], origSlots: number[], getHeight?: (node: Node) => number): number[];
@@ -0,0 +1,24 @@
1
+ import type { AbsolutePath } from '../../core/absolutePath.js';
2
+ import type { QueryIssueSeverity } from '../../core/queryValidation.js';
3
+ import type { FlowTree } from '../../core/flowTrees.js';
4
+ /** A spot on a canvas to bring into view and pulse — where a problem picked
5
+ * from the problems list is. PipelineEditor hands it to the one canvas
6
+ * showing it (FocusContext); each pick is a new object, so picking the
7
+ * same problem again pulses again. */
8
+ export interface FocusTarget {
9
+ /** Inside the canvas's own tree (relative to the panel's base path). */
10
+ path: AbsolutePath;
11
+ /** On the main canvas, a section's node instead of a spot in a tree. */
12
+ section?: 'shared' | 'from' | 'group' | 'select' | 'order';
13
+ /** On the main canvas, the tree `path` is in: WHERE (the default) or
14
+ * HAVING. */
15
+ tree?: FlowTree;
16
+ /** Inside the node, the part the problem is in: `data-qb-focus` keys
17
+ * (focusKey.ts), broadest first — the narrowest one there is pulses,
18
+ * else the whole node (issue 132). */
19
+ parts?: string[];
20
+ /** A problem's: its colour. None — a part gone to from a formula's peek
21
+ * (issue 131) — the `focusRing` colour. */
22
+ severity?: QueryIssueSeverity;
23
+ }
24
+ export declare const FocusContext: import("react").Context<FocusTarget | null>;
@@ -0,0 +1,32 @@
1
+ import type { Node } from '@xyflow/react';
2
+ import type { AbsolutePath } from '../../core/absolutePath.js';
3
+ import { type FlowTree } from '../../core/flowTrees.js';
4
+ import type { PipelineDrillLevel } from '../../core/pipelineAnchor.js';
5
+ import type { QueryPipeline } from '../../core/queryAst.js';
6
+ type Segments = (string | number)[];
7
+ /** A part on a canvas: in its tree, by its path there (relative to the
8
+ * canvas's base, as a FocusTarget's) and, past where a path can go, the
9
+ * segments after it (a CASE's branch, WHEN and THEN together) — or a part
10
+ * of the query its canvas shows, by its segments there (FROM, a SELECT
11
+ * column, …). */
12
+ export type HoveredPart = {
13
+ path: AbsolutePath;
14
+ tree?: FlowTree;
15
+ tail?: Segments;
16
+ } | {
17
+ segments: Segments;
18
+ };
19
+ /** What a canvas reports its hovered part to (PipelineEditor's, which knows
20
+ * where the canvas is); none, nothing to report. */
21
+ export declare const HoverPartContext: import("react").Context<((part: HoveredPart | null) => void) | null>;
22
+ /** The part of `node` (its element: `element`) at `target`, under the
23
+ * pointer: its narrowest marked part there (focusKey.ts: a comparison's
24
+ * side, a row), else the node's own. None for a node that's no part (a
25
+ * caption, a group's background) — or off the node's own elements: a menu
26
+ * it opened, portalled elsewhere, whose events still reach the node. */
27
+ export declare function hoveredPart(node: Node, element: EventTarget | null, target: EventTarget | null): HoveredPart | null;
28
+ /** `part`, on the canvas of drill `level` (none: the main canvas), as
29
+ * `query`'s segments: what a host's SQL view finds its spans by. Undefined
30
+ * when it isn't in the query (a sub query still being made). */
31
+ export declare function hoverSegments(query: QueryPipeline, part: HoveredPart, level?: PipelineDrillLevel): Segments | undefined;
32
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { AbsolutePath } from '../../core/absolutePath.js';
2
+ import type { QueryPipeline } from '../../core/queryAst.js';
3
+ /** The comparisons' sides on `path` (a tree path), broadest first. */
4
+ export declare function sideParts(path: AbsolutePath): string[];
5
+ export default function issueFocusParts(query: QueryPipeline, segments: (string | number)[],
6
+ /** Within its query (issueQueryPath's `local`). */
7
+ local: (string | number)[],
8
+ /** The target's path in its canvas's tree. */
9
+ path: AbsolutePath): string[];
@@ -0,0 +1,7 @@
1
+ import type { IssueLocationStep } from '../../core/issueLocation.js';
2
+ import type { Messages } from '../../core/i18n/messages.js';
3
+ /** The caption of a section, as the canvas shows it. */
4
+ export declare function sectionCaption(section: (IssueLocationStep & {
5
+ kind: 'section';
6
+ })['section'], m: Messages): string;
7
+ export default function issueLocationText(steps: IssueLocationStep[], m: Messages): string;
@@ -0,0 +1,11 @@
1
+ import { type FunctionRegistry } from '../../core/functionRegistry.js';
2
+ import type { Messages } from '../../core/i18n/messages.js';
3
+ import { type QueryPipeline } from '../../core/queryAst.js';
4
+ import type { QueryIssue, QueryIssueKind } from '../../core/queryValidation.js';
5
+ import { type DatabaseSchema } from '../../core/schema.js';
6
+ /** The kind's general text. */
7
+ export declare const kindText: (kind: QueryIssueKind, m: Messages) => string;
8
+ export default function issueText(issue: Pick<QueryIssue, 'kind' | 'pathSegments'>, query: QueryPipeline | undefined, { schema, functions }: {
9
+ schema: DatabaseSchema;
10
+ functions: FunctionRegistry;
11
+ }, m: Messages): string;
@@ -0,0 +1,23 @@
1
+ import { type QueryPath } from '../../core/derivedTables.js';
2
+ import { type FormulaOptions, type FormulaPart } from '../../core/formula.js';
3
+ import type { Messages } from '../../core/i18n/messages.js';
4
+ import type { PipelineDrillLevel } from '../../core/pipelineAnchor.js';
5
+ import { type QueryPipeline } from '../../core/queryAst.js';
6
+ export interface OutlineLine {
7
+ /** How far in: 0 the query's own, 1 a sub query's, … */
8
+ depth: number;
9
+ /** A section's caption (a heading), or a part (`parts`, `pathSegments`). */
10
+ heading?: string;
11
+ parts?: FormulaPart[];
12
+ pathSegments?: (string | number)[];
13
+ /** A sub query's line (its join, its base): the query it opens. */
14
+ opens?: QueryPath;
15
+ /** A table join's line: its ON condition's panel is here. */
16
+ joinId?: string;
17
+ }
18
+ /** `query`'s outline, the sub queries' within. */
19
+ export default function outlineSections(query: QueryPipeline, options: FormulaOptions, m: Messages): OutlineLine[];
20
+ /** Whether `line` is where `here` (the panel open, the topmost) is: the
21
+ * sub query whose canvas it is, or the part whose panel it's in (or
22
+ * under). Nothing is, on the main canvas. */
23
+ export declare function isHere(query: QueryPipeline, line: OutlineLine, here: PipelineDrillLevel | undefined): boolean;
@@ -0,0 +1,36 @@
1
+ import type { QueryPipeline } from '../../core/queryAst.js';
2
+ /** What a host's `onRun` gives back for the editor to show: the rows, as
3
+ * objects keyed by column name. */
4
+ export interface RunResult {
5
+ rows: Record<string, unknown>[];
6
+ /** The columns, in order. Default: the keys of the rows, as first seen. */
7
+ columns?: string[];
8
+ /** More rows matched than `rows` holds (the backend capped them). */
9
+ truncated?: boolean;
10
+ }
11
+ /** Runs the query on the host's side — the editor never reaches a database
12
+ * itself. Given the query, not SQL: the backend checks it (validateQuery)
13
+ * and writes the SQL itself (astToParameterizedSql), so it never runs SQL
14
+ * a browser sent. Return (or resolve to) the rows to show them under the
15
+ * canvas; nothing shows them your own way instead. A rejection shows its
16
+ * message. */
17
+ export type OnRun = (query: QueryPipeline) => RunResult | void | Promise<RunResult | void>;
18
+ /** The results panel's state, for the query it ran. */
19
+ export type RunState = {
20
+ status: 'running';
21
+ query: QueryPipeline;
22
+ } | {
23
+ status: 'done';
24
+ query: QueryPipeline;
25
+ result: RunResult;
26
+ } | {
27
+ status: 'failed';
28
+ query: QueryPipeline;
29
+ message: string;
30
+ };
31
+ /** The columns a result shows, in order. */
32
+ export declare function resultColumns(result: RunResult): string[];
33
+ /** A value as a cell shows it; null for SQL's NULL (and a missing value). */
34
+ export declare function cellText(value: unknown): string | null;
35
+ /** The text of whatever a failed run threw. */
36
+ export declare function failureMessage(error: unknown): string;
@@ -0,0 +1,15 @@
1
+ /** Captions shown above the FROM / WHERE / GROUP / SELECT / ORDER sections of the main
2
+ * canvas (see FlowCanvas.tsx's `buildCanvasGraph` / SectionLabelFlowNode).
3
+ * Configurable through PipelineEditor's `sectionLabels` prop; any omitted
4
+ * key falls back to `DEFAULT_SECTION_LABELS`. */
5
+ export interface SectionLabels {
6
+ from: string;
7
+ where: string;
8
+ group: string;
9
+ select: string;
10
+ order: string;
11
+ /** Shared queries' section (issue 194), before FROM: shown once there's
12
+ * one. */
13
+ shared: string;
14
+ }
15
+ export declare const DEFAULT_SECTION_LABELS: SectionLabels;
@@ -0,0 +1,14 @@
1
+ import type { DrillDownContextValue } from '../../core/DrillDownContext.js';
2
+ import type { ExistsCandidate } from '../../core/existsMenu.js';
3
+ import type { GroupPicks } from '../../core/GroupKeysContext.js';
4
+ /** What a condition tree other than WHERE on the main canvas needs its
5
+ * nodes to see instead of WHERE's: HAVING's drill-downs (into its own
6
+ * panels) — see withTreeScope. Provided by FlowCanvas on the main canvas. */
7
+ export interface TreeScopes {
8
+ having?: DrillDownContextValue;
9
+ /** HAVING's EXISTS menu (see ExistsMenuContext). */
10
+ havingExists?: ExistsCandidate[] | null;
11
+ /** What HAVING's fields may be (see GroupKeysContext). */
12
+ havingPicks?: GroupPicks;
13
+ }
14
+ export declare const TreeScopeContext: import("react").Context<TreeScopes>;
@@ -0,0 +1,7 @@
1
+ /** After the canvas's layout changes — its direction (PipelineEditor's
2
+ * `direction` prop), or which way its chain flows (`orientation`, issue 188),
3
+ * whatever `layout` says: every node's handles have moved, but React Flow
4
+ * only measures handles when a node mounts, so the edges would still
5
+ * attach at the old spots. Re-measures every node once the new layout has
6
+ * painted, and fits the view to it (it now sits elsewhere). */
7
+ export default function useRemeasureOnDirectionChange(layout: string, getNodeIds: () => string[]): void;
@@ -0,0 +1,35 @@
1
+ import { type Node, type Viewport } from '@xyflow/react';
2
+ /** Whether canvases bring newly added nodes into view (PipelineEditor's
3
+ * `autoRevealNewNodes` prop). A context so every canvas — the main one and
4
+ * each drill-down panel's — follows it without threading a prop through. */
5
+ export declare const AutoRevealContext: import("react").Context<boolean>;
6
+ interface Box {
7
+ x: number;
8
+ y: number;
9
+ width: number;
10
+ height: number;
11
+ }
12
+ /** Space kept between a revealed node and the canvas edge, in screen px. */
13
+ export declare const REVEAL_PADDING = 40;
14
+ /** How long the pan takes, in ms (0 with prefers-reduced-motion). */
15
+ export declare const REVEAL_DURATION_MS = 200;
16
+ /** The viewport that brings `bounds` (flow coordinates) into view by panning
17
+ * as little as possible, at the current zoom — or null when it's already
18
+ * fully visible. When `bounds` is larger than the visible area on an axis,
19
+ * its start (left/top) is aligned with the padded edge instead. */
20
+ export declare function computeRevealViewport(viewport: Viewport, size: {
21
+ width: number;
22
+ height: number;
23
+ }, bounds: Box, padding?: number): Viewport | null;
24
+ /** Pans the canvas to show nodes that weren't there on the previous render
25
+ * (something the user just added), once they've been measured — so a new
26
+ * condition, group or IF/CASE that lands past the edge doesn't stay hidden.
27
+ *
28
+ * "New" means a node id not seen before. Ids are tree-position based, so
29
+ * typing, toggling AND/OR or reordering (same set of ids) never moves the
30
+ * viewport; only additions do. Nothing happens while a drag is in progress,
31
+ * when an empty canvas first fills in (the initial fitView covers that), or
32
+ * when the
33
+ * new nodes are already fully visible. */
34
+ export default function useRevealNewNodes(nodes: Node[], isDragging: () => boolean): void;
35
+ export {};
@@ -0,0 +1,10 @@
1
+ import { type ComponentType } from 'react';
2
+ import type { NodeProps } from '@xyflow/react';
3
+ /** A condition-tree node type that, in HAVING's tree on the main canvas
4
+ * (by its id, see flowTrees), drills into HAVING's own panels and offers
5
+ * aggregates and its own EXISTS menu — one React Flow canvas, so its nodes can't each sit under a
6
+ * provider of their own otherwise. In WHERE it's the node type as is. */
7
+ export default function withTreeScope<P extends NodeProps>(Component: ComponentType<P>): {
8
+ (props: P): import("react/jsx-runtime").JSX.Element;
9
+ displayName: string;
10
+ };