@malloydata/malloy-explorer 0.0.299-dev250804170242 → 0.0.304-dev250814203415

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 (63) hide show
  1. package/@flowtypes/components/CodeEditor/CodeEditor.flow.js +9 -0
  2. package/@flowtypes/components/CodeEditor/CodeEditorContext.flow.js +15 -0
  3. package/@flowtypes/components/CodeEditor/index.flow.js +4 -0
  4. package/@flowtypes/components/MalloyExplorerProvider.flow.js +3 -3
  5. package/@flowtypes/components/QueryPanel/QueryPanel.flow.js +1 -0
  6. package/@flowtypes/components/ResultPanel/ResultPanel.flow.js +2 -2
  7. package/@flowtypes/components/ResultPanel/SubmittedQuery.flow.js +1 -1
  8. package/@flowtypes/components/SourcePanel/SourcePanel.flow.js +1 -1
  9. package/@flowtypes/index.flow.js +2 -0
  10. package/dist/cjs/index.cjs +22430 -2718
  11. package/dist/cjs/index.cjs.map +1 -1
  12. package/dist/esm/index.js +22427 -2720
  13. package/dist/esm/index.js.map +1 -1
  14. package/dist/malloy-explorer.css +8 -2
  15. package/dist/types/components/CodeEditor/CodeEditor.d.ts +7 -0
  16. package/dist/types/components/CodeEditor/CodeEditorContext.d.ts +14 -0
  17. package/dist/types/components/CodeEditor/index.d.ts +4 -0
  18. package/dist/types/components/CodeEditor/lsp/code_actions.d.ts +2 -0
  19. package/dist/types/components/CodeEditor/lsp/completion_docs.d.ts +5 -0
  20. package/dist/types/components/CodeEditor/lsp/completions.d.ts +2 -0
  21. package/dist/types/components/CodeEditor/lsp/definitions.d.ts +2 -0
  22. package/dist/types/components/CodeEditor/lsp/diagnostics.d.ts +2 -0
  23. package/dist/types/components/CodeEditor/lsp/hover.d.ts +2 -0
  24. package/dist/types/components/CodeEditor/lsp/index.d.ts +7 -0
  25. package/dist/types/components/CodeEditor/lsp/stub_compile.d.ts +15 -0
  26. package/dist/types/components/CodeEditor/lsp/symbols.d.ts +2 -0
  27. package/dist/types/components/CodeEditor/lsp/utils.d.ts +9 -0
  28. package/dist/types/components/CodeEditor/monaco/index.d.ts +0 -0
  29. package/dist/types/components/CodeEditor/monaco/monaco.d.ts +2 -0
  30. package/dist/types/components/CodeEditor/monaco/monaco_shim.d.ts +3 -0
  31. package/dist/types/components/CodeEditor/monaco/monaco_worker.d.ts +1 -0
  32. package/dist/types/components/MalloyExplorerProvider.d.ts +10 -3
  33. package/dist/types/components/QueryPanel/QueryActionBar.d.ts +2 -1
  34. package/dist/types/components/QueryPanel/QueryPanel.d.ts +2 -1
  35. package/dist/types/components/ResultPanel/DownloadButton.d.ts +6 -0
  36. package/dist/types/components/ResultPanel/ResultPanel.d.ts +2 -2
  37. package/dist/types/components/ResultPanel/SubmittedQuery.d.ts +1 -1
  38. package/dist/types/components/SourcePanel/FieldGroupList.d.ts +4 -2
  39. package/dist/types/components/SourcePanel/FieldTokenWithCopy.d.ts +7 -0
  40. package/dist/types/components/SourcePanel/SearchResultList.d.ts +4 -2
  41. package/dist/types/components/SourcePanel/SourcePanel.d.ts +1 -1
  42. package/dist/types/components/primitives/syntax_highlighting/syntaxHighlighter.d.ts +2 -0
  43. package/dist/types/components/primitives/utils/icon.d.ts +12 -0
  44. package/dist/types/components/utils/download.d.ts +44 -0
  45. package/dist/types/components/utils/download.spec.d.ts +1 -0
  46. package/dist/types/contexts/QueryEditorContext.d.ts +5 -4
  47. package/dist/types/hooks/useQueryBuilder.d.ts +1 -1
  48. package/dist/types/index.d.ts +2 -0
  49. package/{jest.config.ts → jest.config.cjs} +7 -1
  50. package/package.json +12 -9
  51. package/scripts/gen_flow.ts +3 -0
  52. package/.editorconfig +0 -8
  53. package/.github/workflows/prerelease.yaml +0 -28
  54. package/.github/workflows/test.yaml +0 -26
  55. package/.gitmodules +0 -3
  56. package/.node-version +0 -1
  57. package/.prettierrc.js +0 -8
  58. package/.vscode/extensions.json +0 -6
  59. package/babel.config.cjs +0 -49
  60. package/eslint.config.mjs +0 -150
  61. package/index.html +0 -19
  62. package/postcss.config.mjs +0 -20
  63. package/vite.config.mts +0 -69
@@ -33,7 +33,6 @@
33
33
  .mlyy280wj{--mly1ojyoay:var(--mlyndhcph)}
34
34
  .mly7ouyw2{--mly5m5edj:var(--mly1i3blw4)}
35
35
  .mlym9y5t7{--mlynfhokh:block}
36
- .mly28fmrt{--mlynfhokh:none}
37
36
  .mly1bo1i26{--mlyri8z08:0}
38
37
  .mly1ae5hkt{--mlyvpnzvp:block}
39
38
  .mly11ogjb6{--mlyvpnzvp:none}
@@ -52,7 +51,6 @@
52
51
  .mly1dsjhx:disabled{--mlyxo3nik:var(--mly1gq6bli)}
53
52
  .mlyiv1q3g:disabled{--mlyxo3nik:var(--mlywh4rgx)}
54
53
  .mly1u5txqc:hover{--mly1by112x:.3}
55
- .mly1x0xcia:hover{--mlynfhokh:block}
56
54
  .mly1fzkygm:hover{--mlyri8z08:.3}
57
55
  .mly1g9of4s:hover{--mlyvpnzvp:block}
58
56
  .mly157rht3:hover{--mlyvpnzvp:inline-flex}
@@ -69,6 +67,7 @@
69
67
  .mlygqa5hp{background:rgba(230,235,239,1)}
70
68
  .mlyzy8d55{background:rgba(255,255,255,.5)}
71
69
  .mlyotlr4g{background:rgba(255,255,255,1)}
70
+ .mly1lrzu1o{background:transparent!important}
72
71
  .mly1md70p1{background:transparent}
73
72
  .mlysu8s4a{background:var(--mly10mhzaa)}
74
73
  .mly1np9qvj{background:var(--mly1eayp21)}
@@ -89,6 +88,7 @@
89
88
  .mly1gs6z28{border:none}
90
89
  .mly15r89dc{grid-area:1 / 1}
91
90
  .mly1ghz6dp{margin:0}
91
+ .mlys8nxjv{margin:4px 12px 0 12px}
92
92
  .mlynfbntj{margin:5px 0}
93
93
  .mly16zck5j{margin:5px}
94
94
  .mlykib98w{margin:8px}
@@ -98,6 +98,7 @@
98
98
  .mly1l4tkcb{padding:0 8px 8px 8px}
99
99
  .mly1717udv{padding:0}
100
100
  .mly1b4vry6{padding:10px 0}
101
+ .mly7z7khe{padding:10px}
101
102
  .mlyc7ga6q{padding:12px}
102
103
  .mly1tamke2{padding:16px}
103
104
  .mly1e41zw8{padding:1px 5px}
@@ -155,6 +156,7 @@
155
156
  .mly1roky18{border-right:1px solid rgba(204,211,219,1)}
156
157
  .mlyng3xce{border-style:none}
157
158
  .mly1y0btm7{border-style:solid}
159
+ .mly1gnry1m{border-top:1px solid #CCD3DB}
158
160
  .mlye536se{border-top:1px solid #e0e0e0}
159
161
  .mly77krkw{border-top:1px solid var(--malloy-composer-form-border,#ececec)}
160
162
  .mlyc342km{border-width:0}
@@ -172,6 +174,7 @@
172
174
  .mly167g77z{gap:8px}
173
175
  .mly623te4{grid-column:span 2}
174
176
  .mly1a80n4u{grid-column:span 3}
177
+ .mlye8uvvx{list-style:none}
175
178
  .mly1a2a7pz{outline:none}
176
179
  .mlyysyzu8{overflow:auto}
177
180
  .mlyb3r6kr{overflow:hidden}
@@ -186,6 +189,7 @@
186
189
  @layer priority4{
187
190
  .mly1ua5tub{-webkit-box-orient:vertical}
188
191
  .mly1gzmk7r{-webkit-line-clamp:3}
192
+ .mlyc26acl{align-content:center}
189
193
  .mly6s0dn4{align-items:center}
190
194
  .mlypqajaz{align-items:end}
191
195
  .mly1cy8zhl{align-items:flex-start}
@@ -287,6 +291,7 @@ html[dir='rtl'] .mly17fq3gk{box-shadow:0 2px 12px 0 rgba(0,0,0,.1), 0 1px 2px 0
287
291
  .mly2b4tyj{display:var(--mlyvpnzvp)}
288
292
  .mlydt5ytf{flex-direction:column}
289
293
  .mly1q0g3np{flex-direction:row}
294
+ .mly1c4vz4f{flex-grow:0}
290
295
  .mly1iyjqo2{flex-grow:1}
291
296
  .mly2lah0s{flex-shrink:0}
292
297
  .mly1a02dak{flex-wrap:wrap}
@@ -390,6 +395,7 @@ html[dir='rtl'] .mly17fq3gk{box-shadow:0 2px 12px 0 rgba(0,0,0,.1), 0 1px 2px 0
390
395
  .mlydk7pt{height:8px}
391
396
  .mlylo07zb{height:90px}
392
397
  .mlyt7dq6l{height:auto}
398
+ .mly10msahz{height:calc(100% - 4px)}
393
399
  .mly1ktj5wk{height:calc(100% - 8px)}
394
400
  .mlyu96u03{left:0}
395
401
  .mly12nagc{margin-bottom:4px}
@@ -0,0 +1,7 @@
1
+ import * as Malloy from '@malloydata/malloy-interfaces';
2
+ export interface CodeEditorProps {
3
+ language: string;
4
+ value: string;
5
+ onChange: (value: string | Malloy.Query) => void;
6
+ }
7
+ export default function CodeEditor({ language, value, onChange, }: CodeEditorProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,14 @@
1
+ import * as Malloy from '@malloydata/malloy-interfaces';
2
+ import * as Monaco from './monaco/monaco_shim';
3
+ import * as React from 'react';
4
+ import type { ModelDef } from '@malloydata/malloy';
5
+ export interface CodeEditorContextProps {
6
+ monaco?: typeof Monaco;
7
+ modelDef?: ModelDef;
8
+ modelUri?: URL;
9
+ malloyToQuery?: (malloy: string) => {
10
+ query?: Malloy.Query | undefined;
11
+ logs: Malloy.LogMessage[];
12
+ };
13
+ }
14
+ export declare const CodeEditorContext: React.Context<CodeEditorContextProps>;
@@ -0,0 +1,4 @@
1
+ import CodedEditor from './CodeEditor';
2
+ export * from './CodeEditor';
3
+ export * from './CodeEditorContext';
4
+ export default CodedEditor;
@@ -0,0 +1,2 @@
1
+ import * as Monaco from '../monaco/monaco_shim';
2
+ export declare function provideCodeActions(textModel: Monaco.editor.ITextModel, range: Monaco.Range, _context: Monaco.languages.CodeActionContext, _token: Monaco.CancellationToken): Promise<Monaco.languages.CodeActionList>;
@@ -0,0 +1,5 @@
1
+ export declare const COMPLETION_DOCS: {
2
+ [kind: string]: {
3
+ [property: string]: string;
4
+ };
5
+ };
@@ -0,0 +1,2 @@
1
+ import * as Monaco from '../monaco/monaco_shim';
2
+ export declare function provideCompletionItems(monaco: typeof Monaco, textModel: Monaco.editor.ITextModel, position: Monaco.Position, _context: Monaco.languages.CompletionContext, _token: Monaco.CancellationToken): Monaco.languages.CompletionList;
@@ -0,0 +1,2 @@
1
+ import * as Monaco from '../monaco/monaco_shim';
2
+ export declare function provideDefinition(monaco: typeof Monaco, textModel: Monaco.editor.ITextModel, position: Monaco.Position, _token: Monaco.CancellationToken): Promise<Monaco.languages.Definition>;
@@ -0,0 +1,2 @@
1
+ import * as Monaco from '../monaco/monaco_shim';
2
+ export declare function diagnostics(monaco: typeof Monaco, modelUri: string, malloy: string): Promise<Monaco.editor.IMarkerData[]>;
@@ -0,0 +1,2 @@
1
+ import * as Monaco from '../monaco/monaco_shim';
2
+ export declare function provideHover(textModel: Monaco.editor.ITextModel, position: Monaco.Position, _token: Monaco.CancellationToken, _context?: Monaco.languages.HoverContext<Monaco.languages.Hover>): Promise<Monaco.languages.Hover | null>;
@@ -0,0 +1,7 @@
1
+ export { diagnostics } from './diagnostics';
2
+ export { provideCodeActions } from './code_actions';
3
+ export { provideCompletionItems } from './completions';
4
+ export { provideDefinition } from './definitions';
5
+ export { provideDocumentSymbols } from './symbols';
6
+ export { provideHover } from './hover';
7
+ export { registerModel, initLsp } from './utils';
@@ -0,0 +1,15 @@
1
+ import { MalloyQueryData, Model, ModelDef, Parse, SQLSourceDef, TableSourceDef, URLReader } from '@malloydata/malloy';
2
+ import { BaseConnection } from '@malloydata/malloy/connection';
3
+ export declare class StubReader implements URLReader {
4
+ readURL(_url: URL): Promise<string>;
5
+ }
6
+ export declare class StubConnection extends BaseConnection {
7
+ dialectName: string;
8
+ name: string;
9
+ constructor(dialectName?: string);
10
+ runSQL(): Promise<MalloyQueryData>;
11
+ fetchSelectSchema(_sqlSource: SQLSourceDef): Promise<SQLSourceDef | string>;
12
+ fetchTableSchema(_tableName: string, _tablePath: string): Promise<TableSourceDef | string>;
13
+ }
14
+ export declare function stubCompile(modelDef: ModelDef, malloy: string): Promise<Model>;
15
+ export declare function stubParse(_modelDef: ModelDef, source: string): Parse;
@@ -0,0 +1,2 @@
1
+ import * as Monaco from '../monaco/monaco_shim';
2
+ export declare function provideDocumentSymbols(monaco: typeof Monaco, textModel: Monaco.editor.ITextModel, _token: Monaco.CancellationToken): Monaco.languages.DocumentSymbol[];
@@ -0,0 +1,9 @@
1
+ import { ModelDef } from '@malloydata/malloy';
2
+ import * as Monaco from '../monaco/monaco_shim';
3
+ export declare function convertPosition(position: Monaco.Position): {
4
+ line: number;
5
+ character: number;
6
+ };
7
+ export declare function registerModel(modelUri: string, modelDef: ModelDef): void;
8
+ export declare function getModel(modelUri: string): ModelDef;
9
+ export declare function initLsp(monaco: typeof Monaco): Monaco.IDisposable;
@@ -0,0 +1,2 @@
1
+ import * as Monaco from './monaco_shim';
2
+ export declare function initMonaco(monaco: typeof Monaco): Promise<Monaco.IDisposable>;
@@ -0,0 +1,3 @@
1
+ export * from 'monaco-editor-core';
2
+ import * as monaco from 'monaco-editor-core';
3
+ export type Monaco = typeof monaco;
@@ -3,13 +3,20 @@ import * as Malloy from '@malloydata/malloy-interfaces';
3
3
  import type { DrillData } from '@malloydata/render';
4
4
  import { SearchValueMapResult } from '../hooks/useTopValues';
5
5
  export interface MalloyExplorerProviderProps {
6
+ /** Malloy source to extend for query */
6
7
  source: Malloy.SourceInfo;
7
- query?: Malloy.Query;
8
- onQueryChange?: (query: Malloy.Query | undefined) => void;
8
+ /** Current query state */
9
+ query?: Malloy.Query | string;
10
+ /** Callback for editor changes */
11
+ onQueryChange?: (query: Malloy.Query | string | undefined) => void;
12
+ /** Currently focused nest element */
9
13
  focusedNestViewPath: string[];
14
+ /** Callback for user selecting focussed element */
10
15
  onFocusedNestViewPathChange: (path: string[]) => void;
11
- children: ReactNode | ReactNode[];
16
+ children: ReactNode;
17
+ /** Search index result values for suggestions */
12
18
  topValues?: SearchValueMapResult[];
19
+ /** Default drill behavior override callback */
13
20
  onDrill?: ({ stableQuery, stableDrillClauses }: DrillData) => void;
14
21
  }
15
22
  export declare function MalloyExplorerProvider({ source, query, onQueryChange, focusedNestViewPath, onFocusedNestViewPathChange, children, topValues, onDrill, }: MalloyExplorerProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -4,5 +4,6 @@ import * as Malloy from '@malloydata/malloy-interfaces';
4
4
  */
5
5
  export interface QueryActionBarProps {
6
6
  runQuery: (source: Malloy.SourceInfo, query: Malloy.Query) => void;
7
+ runQueryString?: (source: Malloy.SourceInfo, query: string) => void;
7
8
  }
8
- export declare function QueryActionBar({ runQuery }: QueryActionBarProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare function QueryActionBar({ runQuery, runQueryString, }: QueryActionBarProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,7 @@
1
1
  import * as Malloy from '@malloydata/malloy-interfaces';
2
2
  interface QueryPanelProps {
3
3
  runQuery: (source: Malloy.SourceInfo, query: Malloy.Query) => void;
4
+ runQueryString?: (source: Malloy.SourceInfo, query: string) => void;
4
5
  }
5
- export default function QueryPanel({ runQuery }: QueryPanelProps): import("react/jsx-runtime").JSX.Element;
6
+ export default function QueryPanel({ runQuery, runQueryString, }: QueryPanelProps): import("react/jsx-runtime").JSX.Element;
6
7
  export {};
@@ -0,0 +1,6 @@
1
+ import * as Malloy from '@malloydata/malloy-interfaces';
2
+ export interface DownloadButtonProps {
3
+ result?: Malloy.Result;
4
+ name?: string;
5
+ }
6
+ export declare function DownloadButton({ name, result }: DownloadButtonProps): import("react/jsx-runtime").JSX.Element | null;
@@ -7,8 +7,8 @@ type ResultPanelOptions = {
7
7
  };
8
8
  export interface ResultPanelProps {
9
9
  source: Malloy.SourceInfo;
10
- draftQuery?: Malloy.Query;
11
- setDraftQuery: (query: Malloy.Query) => void;
10
+ draftQuery?: Malloy.Query | string;
11
+ setDraftQuery: (query: Malloy.Query | string) => void;
12
12
  submittedQuery?: SubmittedQuery;
13
13
  options?: ResultPanelOptions;
14
14
  }
@@ -7,7 +7,7 @@ export declare const EXECUTION_STATES: {
7
7
  };
8
8
  export type QueryExecutionState = keyof typeof EXECUTION_STATES;
9
9
  export type SubmittedQuery = {
10
- query: Malloy.Query;
10
+ query: Malloy.Query | string;
11
11
  executionState: QueryExecutionState;
12
12
  queryResolutionStartMillis: number;
13
13
  onCancel: () => void;
@@ -1,12 +1,14 @@
1
1
  import * as React from 'react';
2
+ import * as Malloy from '@malloydata/malloy-interfaces';
2
3
  import { FieldItem } from './utils';
3
4
  import { SourceInfo } from '@malloydata/malloy-interfaces';
4
5
  import { ASTQuery } from '@malloydata/malloy-query-builder';
5
6
  interface FieldGroupListProps {
6
- rootQuery: ASTQuery;
7
+ rootQuery?: ASTQuery;
7
8
  source: SourceInfo;
8
9
  fieldItems: FieldItem[];
9
10
  fieldGroupType: 'view' | 'measure' | 'dimension';
11
+ onCopy: (field: Malloy.FieldInfo, path: string[]) => void;
10
12
  }
11
- export default function FieldGroupList({ rootQuery, source, fieldItems, fieldGroupType, }: FieldGroupListProps): React.ReactNode;
13
+ export default function FieldGroupList({ rootQuery, source, fieldItems, fieldGroupType, onCopy, }: FieldGroupListProps): React.ReactNode;
12
14
  export {};
@@ -0,0 +1,7 @@
1
+ import * as Malloy from '@malloydata/malloy-interfaces';
2
+ export interface FieldTokenWithCopyProps {
3
+ field: Malloy.FieldInfo;
4
+ path: string[];
5
+ onCopy: (field: Malloy.FieldInfo, path: string[]) => void;
6
+ }
7
+ export declare function FieldTokenWithCopy({ field, path, onCopy, }: FieldTokenWithCopyProps): import("react/jsx-runtime").JSX.Element;
@@ -1,10 +1,12 @@
1
+ import * as Malloy from '@malloydata/malloy-interfaces';
1
2
  import { FieldItem } from './utils';
2
3
  import { SourceInfo } from '@malloydata/malloy-interfaces';
3
4
  import { ASTQuery } from '@malloydata/malloy-query-builder';
4
5
  interface SearchResultListProps {
5
- rootQuery: ASTQuery;
6
+ rootQuery?: ASTQuery;
6
7
  source: SourceInfo;
7
8
  items: FieldItem[];
9
+ onCopy: (field: Malloy.FieldInfo, path: string[]) => void;
8
10
  }
9
- export default function SearchResultList({ rootQuery, source, items, }: SearchResultListProps): import("react/jsx-runtime").JSX.Element | null;
11
+ export default function SearchResultList({ rootQuery, source, items, onCopy, }: SearchResultListProps): import("react/jsx-runtime").JSX.Element;
10
12
  export {};
@@ -1,4 +1,4 @@
1
1
  export interface SourcePanelProps {
2
2
  onRefresh: () => void;
3
3
  }
4
- export declare function SourcePanel({ onRefresh }: SourcePanelProps): import("react/jsx-runtime").JSX.Element | null;
4
+ export declare function SourcePanel({ onRefresh }: SourcePanelProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,8 @@
1
1
  import { TransformerOptions } from './transformers/transformers';
2
+ import { HighlighterCore } from '@shikijs/core';
2
3
  export type SupportedLang = 'json' | 'sql' | 'malloy';
3
4
  export type SupportedTheme = 'light-plus' | 'dark-plus';
4
5
  type HighlighterOptions = {} & TransformerOptions;
6
+ export declare function getHighlighter(): Promise<HighlighterCore>;
5
7
  export declare function highlightPre(code: string, lang: SupportedLang, theme: SupportedTheme, { showLineNumbers, lineSpacing }: HighlighterOptions): Promise<HTMLDivElement>;
6
8
  export {};
@@ -107,6 +107,18 @@ export declare const ICON_MAP: {
107
107
  desc?: string;
108
108
  descId?: string;
109
109
  }>;
110
+ readonly download: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
111
+ title?: string;
112
+ titleId?: string;
113
+ desc?: string;
114
+ descId?: string;
115
+ }>;
116
+ readonly malloy: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
117
+ title?: string;
118
+ titleId?: string;
119
+ desc?: string;
120
+ descId?: string;
121
+ }>;
110
122
  readonly aggregate: import("react").FunctionComponent<import("react").SVGProps<SVGSVGElement> & {
111
123
  title?: string;
112
124
  titleId?: string;
@@ -0,0 +1,44 @@
1
+ import * as Malloy from '@malloydata/malloy-interfaces';
2
+ export interface WriteStream {
3
+ write: (text: string) => void;
4
+ close: () => void;
5
+ }
6
+ export declare abstract class DataWriter {
7
+ readonly stream: WriteStream;
8
+ readonly result: Malloy.Result;
9
+ constructor(stream: WriteStream, result: Malloy.Result);
10
+ abstract process(data: AsyncIterableIterator<Malloy.DataWithRecordCell>): Promise<void>;
11
+ }
12
+ export declare class JSONWriter extends DataWriter {
13
+ process(data: AsyncIterableIterator<Malloy.DataWithRecordCell>): Promise<void>;
14
+ }
15
+ /**
16
+ * CSV writer class that handles nested data.
17
+ * This writer creates CSV using a DFS traversal of the result dataset.
18
+ * Each trivial column value is converted to a CSV of 1x1 matrix and all the
19
+ * columns are merged together to create a CSV that represents 1 QueryDataRow.
20
+ * Since this follows DFS, each non trivial data is rendered into a NxM matrix
21
+ * where N is the number of rows in the nested data and M is the number of
22
+ * columns it has.
23
+ * For any row with X number of columns, we end up with X number of NxM matrices
24
+ * where the value of N,M pair may be different for each column.
25
+ * We then merge the matrices so that we end up with a larger matrix of size
26
+ * Max(N)xSum(M) by taking one row of csv from each matrix at a time. For any
27
+ * matrix with N<Max(N), we add a row of empty CSV cells of size N.
28
+ */
29
+ export declare class CSVWriter extends DataWriter {
30
+ private readonly columnSeparator;
31
+ private readonly rowSeparator;
32
+ private readonly quoteCharacter;
33
+ private readonly includeHeader;
34
+ private readonly emptyCell;
35
+ private escape;
36
+ private stringify;
37
+ private getColWeight;
38
+ private getHeaderRow;
39
+ private mergeMatrices;
40
+ private getChildMatrix;
41
+ private getRowMatrix;
42
+ process(data: AsyncIterableIterator<Malloy.DataWithRecordCell>): Promise<void>;
43
+ }
44
+ export declare function dataIterator(result: Malloy.Result): AsyncGenerator<Malloy.CellWithRecordCell, void, unknown>;
@@ -0,0 +1 @@
1
+ export {};
@@ -4,12 +4,13 @@ import { ASTQuery } from '@malloydata/malloy-query-builder';
4
4
  import type { DrillData } from '@malloydata/render';
5
5
  export interface QueryEditorContextProps {
6
6
  /** Source object at the root level */
7
- source?: Malloy.SourceInfo;
7
+ source: Malloy.SourceInfo;
8
8
  /** Query object to represent current state at the root level */
9
- rootQuery?: ASTQuery;
9
+ rootQuery: ASTQuery | undefined;
10
10
  /** Provide to allow editing of the query */
11
- setQuery: (query: Malloy.Query | undefined) => void;
12
- onDrill?: ({ stableQuery, stableDrillClauses }: DrillData) => void;
11
+ setQuery: (query: Malloy.Query | string | undefined) => void;
12
+ query: Malloy.Query | string | undefined;
13
+ onDrill?: (drillData: DrillData) => void;
13
14
  }
14
15
  /**
15
16
  * QueryEditorContext enables query editing by providing the setQuery
@@ -1,3 +1,3 @@
1
1
  import { ASTQuery } from '@malloydata/malloy-query-builder';
2
2
  import * as Malloy from '@malloydata/malloy-interfaces';
3
- export declare function useQueryBuilder(source?: Malloy.SourceInfo, query?: Malloy.Query): ASTQuery | undefined;
3
+ export declare function useQueryBuilder(source: Malloy.SourceInfo, query?: Malloy.Query | string): ASTQuery | undefined;
@@ -6,3 +6,5 @@ export type { EXECUTION_STATES, Message, QueryExecutionState, QueryResponse, Run
6
6
  export { SourcePanel } from './components/SourcePanel';
7
7
  export { ResizeBar } from './components/primitives';
8
8
  export { ResizableCollapsiblePanel } from './components/ResizableCollapsiblePanel';
9
+ export { CodeEditorContext } from './components/CodeEditor';
10
+ export { modelDefToModelInfo, malloyToQuery } from '@malloydata/malloy';
@@ -9,7 +9,13 @@ module.exports = {
9
9
  setupFilesAfterEnv: ['<rootDir>/src/test/jest.setup.ts'],
10
10
  moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
11
11
  testMatch: ['<rootDir>/src/**/?(*.)spec.(ts|js)?(x)'],
12
- testPathIgnorePatterns: ['/node_modules/', '/dist/', '/dev/', '/src/test/'],
12
+ testPathIgnorePatterns: [
13
+ '/node_modules/',
14
+ '<rootDir>/dist/',
15
+ '<rootDir>/dev/',
16
+ '<rootDir>/src/test/',
17
+ '<rootDir>/malloy-samples/',
18
+ ],
13
19
  transform: {
14
20
  '^.+\\.tsx?$': ['babel-jest'],
15
21
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/malloy-explorer",
3
- "version": "0.0.299-dev250804170242",
3
+ "version": "0.0.304-dev250814203415",
4
4
  "description": "Malloy visual query builder",
5
5
  "main": "dist/cjs/index.cjs",
6
6
  "types": "dist/types/index.d.ts",
@@ -33,7 +33,7 @@
33
33
  "malloy-unlink": "npm --no-fund --no-save --no-audit unlink $(./scripts/malloy-packages.ts) && npm --no-fund --no-audit install --force",
34
34
  "malloy-build-and-link": "cd ../malloy && npm run -ws build --workspace=@malloydata/malloy-query-builder --workspace=@malloydata/malloy-filter --workspace=@malloydata/malloy-interfaces --workspace=@malloydata/malloy-tag && npm link -ws",
35
35
  "prepublishOnly": "npm run build",
36
- "test": "jest src"
36
+ "test": "jest --config jest.config.cjs"
37
37
  },
38
38
  "bin": {
39
39
  "malloy-packages": "./scripts/malloy-packages.ts"
@@ -64,10 +64,12 @@
64
64
  "@radix-ui/react-scroll-area": "^1.2.3",
65
65
  "@radix-ui/react-select": "^2.1.6",
66
66
  "@radix-ui/react-tabs": "^1.1.3",
67
+ "@radix-ui/react-toast": "^1.2.14",
67
68
  "@radix-ui/react-tooltip": "^1.1.8",
68
69
  "@shikijs/core": "^3.2.1",
69
70
  "@shikijs/engine-javascript": "^3.2.1",
70
71
  "@shikijs/langs": "^3.2.1",
72
+ "@shikijs/monaco": "^3.7.0",
71
73
  "@shikijs/themes": "^3.2.1",
72
74
  "@shikijs/types": "^3.2.1",
73
75
  "@stylexjs/stylex": "^0.10.1",
@@ -82,8 +84,8 @@
82
84
  "@babel/preset-typescript": "^7.27.1",
83
85
  "@eslint/compat": "^1.2.7",
84
86
  "@eslint/js": "^9.21.0",
85
- "@malloydata/db-duckdb": "^0.0.299",
86
- "@malloydata/malloy": "^0.0.299",
87
+ "@malloydata/db-duckdb": "^0.0.304",
88
+ "@malloydata/malloy": "^0.0.304",
87
89
  "@rollup/plugin-replace": "^6.0.2",
88
90
  "@stylexjs/eslint-plugin": "^0.11.1",
89
91
  "@stylexjs/postcss-plugin": "^0.11.1",
@@ -115,11 +117,12 @@
115
117
  "vite-plugin-svgr": "^4.3.0"
116
118
  },
117
119
  "peerDependencies": {
118
- "@malloydata/malloy-filter": "^0.0.299",
119
- "@malloydata/malloy-interfaces": "^0.0.299",
120
- "@malloydata/malloy-query-builder": "^0.0.299",
121
- "@malloydata/malloy-tag": "^0.0.299",
122
- "@malloydata/render": "^0.0.299",
120
+ "@malloydata/malloy-filter": ">=0.0.304",
121
+ "@malloydata/malloy-interfaces": ">=0.0.304",
122
+ "@malloydata/malloy-query-builder": ">=0.0.304",
123
+ "@malloydata/malloy-tag": ">=0.0.304",
124
+ "@malloydata/render": ">=0.0.304",
125
+ "monaco-editor-core": "^0.52.2",
123
126
  "react": ">=19.0.0",
124
127
  "react-dom": ">=19.0.0"
125
128
  }
@@ -13,6 +13,9 @@ const files = [
13
13
  'components/ResultPanel/SubmittedQuery.d.ts',
14
14
  'components/SourcePanel/SourcePanel.d.ts',
15
15
  'components/ResizableCollapsiblePanel.d.ts',
16
+ 'components/CodeEditor/index.d.ts',
17
+ 'components/CodeEditor/CodeEditor.d.ts',
18
+ 'components/CodeEditor/CodeEditorContext.d.ts',
16
19
  ];
17
20
 
18
21
  async function go() {
package/.editorconfig DELETED
@@ -1,8 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- end_of_line = lf
7
- charset = utf-8
8
- insert_final_newline = true
@@ -1,28 +0,0 @@
1
- name: npmjs.com Pre-release
2
-
3
- on: [workflow_dispatch]
4
-
5
- jobs:
6
- test:
7
- uses: './.github/workflows/test.yaml'
8
-
9
- npm-prerelease:
10
- needs:
11
- - test
12
- runs-on: ubuntu-latest
13
- steps:
14
- - uses: actions/checkout@v4
15
- - name: Use Node.js
16
- uses: actions/setup-node@v4
17
- with:
18
- node-version: 20.x
19
- - name: npm install, build, and publish
20
- run: |
21
- npm ci --loglevel error
22
- PRERELEASE=$(date +%y%m%d%H%M%S)
23
- VERSION=$(jq -r .version ./package.json)-dev$PRERELEASE
24
- npm version --no-git-tag-version $VERSION
25
- npm publish --access=public
26
- env:
27
- CI: true
28
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -1,26 +0,0 @@
1
- name: Test
2
-
3
- on:
4
- workflow_call:
5
- pull_request:
6
- push:
7
- branches:
8
- - main
9
-
10
- jobs:
11
- test-all:
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v4
16
- - name: Use Node.js
17
- uses: actions/setup-node@v4
18
- with:
19
- node-version: 20.x
20
- - name: Install
21
- run: npm ci --loglevel error
22
- - name: Build and Test
23
- run: |
24
- npm run build
25
- npm run lint
26
- npm run test
package/.gitmodules DELETED
@@ -1,3 +0,0 @@
1
- [submodule "malloy-samples"]
2
- path = malloy-samples
3
- url = git@github.com:malloydata/malloy-samples
package/.node-version DELETED
@@ -1 +0,0 @@
1
- 20.18.1
package/.prettierrc.js DELETED
@@ -1,8 +0,0 @@
1
- // eslint-disable-next-line no-undef
2
- module.exports = {
3
- arrowParens: 'avoid',
4
- bracketSpacing: false,
5
- semi: true,
6
- singleQuote: true,
7
- trailingComma: 'es5',
8
- };
@@ -1,6 +0,0 @@
1
- {
2
- "recommendations": [
3
- "dbaeumer.vscode-eslint",
4
- "esbenp.prettier-vscode"
5
- ]
6
- }