@malloy-publisher/sdk 0.4.1 → 0.5.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.
- package/dist/{DocumentStorage-BiFqO15i.es.js → DocumentStorage-DkwqA8SA.es.js} +2284 -2319
- package/dist/{DocumentStorage-CMyLifsz.cjs.js → DocumentStorage-mMn5SZ1c.cjs.js} +29 -29
- package/dist/{RenderedResult-CvrmYyr5.es.js → RenderedResult-CTD2Ej2S.es.js} +100 -80
- package/dist/{RenderedResult-CZzE8wv-.cjs.js → RenderedResult-GukOadCi.cjs.js} +27 -7
- package/dist/ServerProvider-CC9ein5-.cjs.js +1 -0
- package/dist/{ServerProvider-BWOEKg0O.es.js → ServerProvider-IzXlqSVe.es.js} +572 -553
- package/dist/builder/index.cjs.js +54 -49
- package/dist/builder/index.es.js +4124 -3521
- package/dist/client/api.d.ts +54 -2
- package/dist/client/index.cjs.js +1 -1
- package/dist/client/index.es.js +1 -1
- package/dist/components/Dashboard/TileCard.d.ts +7 -3
- package/dist/components/DashboardBuilder/DashboardEditor.d.ts +15 -4
- package/dist/components/DashboardBuilder/controls.d.ts +8 -6
- package/dist/components/DashboardBuilder/document.d.ts +19 -5
- package/dist/components/DashboardBuilder/malloyText.d.ts +0 -30
- package/dist/components/DashboardBuilder/malloyTree.d.ts +232 -0
- package/dist/components/DashboardBuilder/preview.d.ts +17 -0
- package/dist/components/DashboardBuilder/readDocument.d.ts +23 -28
- package/dist/components/DashboardBuilder/spliceDocument.d.ts +12 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +5 -5
- package/dist/theme/resolveTheme.d.ts +1 -1
- package/dist/theme/types.d.ts +12 -2
- package/package.json +1 -1
- package/src/components/Dashboard/TileCard.tsx +8 -4
- package/src/components/DashboardBuilder/BuilderToolbar.tsx +4 -5
- package/src/components/DashboardBuilder/DashboardEditor.resourceUri.spec.tsx +356 -0
- package/src/components/DashboardBuilder/DashboardEditor.tsx +116 -25
- package/src/components/DashboardBuilder/FilterDialog.tsx +19 -6
- package/src/components/DashboardBuilder/TileFrame.tsx +11 -2
- package/src/components/DashboardBuilder/TileMenu.tsx +6 -0
- package/src/components/DashboardBuilder/__test__/inventory.ts +367 -0
- package/src/components/DashboardBuilder/controls.spec.ts +53 -3
- package/src/components/DashboardBuilder/controls.ts +9 -7
- package/src/components/DashboardBuilder/document.ts +17 -5
- package/src/components/DashboardBuilder/invariants.spec.ts +297 -0
- package/src/components/DashboardBuilder/malloyText.spec.ts +27 -66
- package/src/components/DashboardBuilder/malloyText.ts +4 -109
- package/src/components/DashboardBuilder/malloyTree.spec.ts +362 -0
- package/src/components/DashboardBuilder/malloyTree.ts +954 -0
- package/src/components/DashboardBuilder/preview.spec.ts +18 -0
- package/src/components/DashboardBuilder/preview.ts +24 -6
- package/src/components/DashboardBuilder/readDocument.spec.ts +312 -21
- package/src/components/DashboardBuilder/readDocument.ts +144 -165
- package/src/components/DashboardBuilder/scannerShapes.spec.ts +550 -0
- package/src/components/DashboardBuilder/spliceDocument.spec.ts +955 -21
- package/src/components/DashboardBuilder/spliceDocument.ts +509 -119
- package/src/components/DashboardBuilder/statementExtent.spec.ts +606 -0
- package/src/components/RenderedResult/RenderedResult.tsx +21 -1
- package/src/components/given/GivensPanel.tsx +15 -3
- package/src/theme/buildTableCssVars.spec.ts +3 -0
- package/src/theme/buildTableCssVars.ts +6 -0
- package/src/theme/defaults.ts +16 -12
- package/src/theme/resolveTheme.spec.ts +14 -7
- package/src/theme/resolveTheme.ts +14 -8
- package/src/theme/types.ts +12 -2
- package/tsconfig.spec.json +5 -1
- package/dist/ServerProvider-Cc489A3f.cjs.js +0 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DashboardDocument, LocalGiven } from './document';
|
|
2
|
+
import { ParsedMalloy } from './malloyTree';
|
|
2
3
|
/**
|
|
3
4
|
* Read a `dashboards/*.malloy` file into a {@link DashboardDocument}.
|
|
4
5
|
*
|
|
@@ -7,10 +8,10 @@ import { DashboardDocument, LocalGiven } from './document';
|
|
|
7
8
|
* in the browser and in a unit test alike, which is what lets the suite open
|
|
8
9
|
* every dashboard in the repository as a regression gate.
|
|
9
10
|
*
|
|
10
|
-
* Structure comes from
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* `
|
|
11
|
+
* Structure comes from Malloy's own parse tree, through `malloyTree`: imports,
|
|
12
|
+
* sources, views, dimensions, givens and every `where:` clause, each with an
|
|
13
|
+
* exact span. Tags come from `parseAnnotation` over the `#` block above a
|
|
14
|
+
* declaration, which is `malloy-tag`'s grammar rather than Malloy's.
|
|
14
15
|
*
|
|
15
16
|
* Reading tags from the text rather than from the server, which serves them
|
|
16
17
|
* already attached, is deliberate. The splice writer has to LOCATE a tag in
|
|
@@ -43,7 +44,7 @@ export type ReadResult = {
|
|
|
43
44
|
* does not typecheck, in a codebase where most code never notices.
|
|
44
45
|
*/
|
|
45
46
|
export declare const readFailed: (result: ReadResult) => result is ReadFailure;
|
|
46
|
-
/** A
|
|
47
|
+
/** A `#`/comment block above a declaration, and where it sits. */
|
|
47
48
|
export interface Block {
|
|
48
49
|
/** 0-based line of the first line in the block. */
|
|
49
50
|
start: number;
|
|
@@ -57,23 +58,22 @@ export interface Block {
|
|
|
57
58
|
}>;
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
|
-
* The comment-and-tag block immediately above `declLine
|
|
61
|
+
* The comment-and-tag block immediately above `declLine`, up to the blank line
|
|
62
|
+
* that is the author's own separator. Validated against the bundled dashboard,
|
|
63
|
+
* where it collects `revenue_trend`'s three tags and the fourteen-line comment
|
|
64
|
+
* explaining its colspan, then stops at the blank line above — which is the
|
|
65
|
+
* right unit to carry when that tile moves.
|
|
61
66
|
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
export declare function blockAbove(lines: string[], declLine: number): Block;
|
|
72
|
-
/**
|
|
73
|
-
* One `where: <field> <op> $<GIVEN>` clause. Exported for the writer, which
|
|
74
|
-
* has to find the same clauses in order to replace them and nothing else.
|
|
67
|
+
* WHERE the block starts comes from `parsed`, which takes its comments from the
|
|
68
|
+
* lexer, and not from a scan for `//` here. Malloy spells a comment three ways
|
|
69
|
+
* — `//`, `--` and `/* … *\/` — and this walked upward looking only for the
|
|
70
|
+
* first. The other two stopped it early while the parser read straight past
|
|
71
|
+
* them, so a `#` tag above one was visible to the reader and invisible to the
|
|
72
|
+
* writer, which then wrote a SECOND copy of the tag below the comment. The
|
|
73
|
+
* reader picks the lower one up and the read-back gate is satisfied, so the
|
|
74
|
+
* file quietly ends up carrying two.
|
|
75
75
|
*/
|
|
76
|
-
export declare
|
|
76
|
+
export declare function blockAbove(parsed: ParsedMalloy, lines: string[], declLine: number): Block;
|
|
77
77
|
/**
|
|
78
78
|
* A tag object, as `parseAnnotation` returns it. Only the reads this file makes.
|
|
79
79
|
*/
|
|
@@ -86,10 +86,7 @@ type ParseTags = (lines: string[]) => {
|
|
|
86
86
|
tag?: TagLike | null;
|
|
87
87
|
};
|
|
88
88
|
/**
|
|
89
|
-
* `given:` declarations,
|
|
90
|
-
* its types are query, unnamed_query, explore, field, join, import and
|
|
91
|
-
* import_item. So these are read as text, in BOTH spellings Malloy accepts and
|
|
92
|
-
* this repository uses:
|
|
89
|
+
* `given:` declarations, in BOTH spellings Malloy accepts:
|
|
93
90
|
*
|
|
94
91
|
* given: CATEGORY :: filter<string> is f'' // one per line
|
|
95
92
|
*
|
|
@@ -97,10 +94,8 @@ type ParseTags = (lines: string[]) => {
|
|
|
97
94
|
* CATEGORY :: filter<string> is f''
|
|
98
95
|
* SINCE :: date is @2023-01-01
|
|
99
96
|
*
|
|
100
|
-
*
|
|
101
|
-
* builder emits; the block form is read so a file written the other way still
|
|
102
|
-
* opens. Either way the tags above a declaration are its control contract.
|
|
97
|
+
* Either way the `#` tags above a declaration are its control contract.
|
|
103
98
|
*/
|
|
104
|
-
export declare function localGivens(lines: string[], parse: ParseTags): LocalGiven[] | undefined;
|
|
99
|
+
export declare function localGivens(parsed: ParsedMalloy, lines: string[], parse: ParseTags): LocalGiven[] | undefined;
|
|
105
100
|
export declare function readDashboardDocument(sourceText: string): Promise<ReadResult>;
|
|
106
101
|
export {};
|
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
import { DashboardDocument, DashboardTile } from './document';
|
|
2
|
+
/**
|
|
3
|
+
* The syntax errors Malloy's own parser reports for `text`, as a multiset of
|
|
4
|
+
* messages.
|
|
5
|
+
*
|
|
6
|
+
* The first `translate()` is enough and is all we want: a document with
|
|
7
|
+
* imports comes back NOT final, asking for the urls it needs, and by then the
|
|
8
|
+
* parse has already happened while nothing has been resolved. So this sees
|
|
9
|
+
* every syntax error and none of the semantic ones, which are not this
|
|
10
|
+
* writer's business -- a dashboard referring to a source in a file we decline
|
|
11
|
+
* to hand over is not damage we caused.
|
|
12
|
+
*/
|
|
13
|
+
export declare function syntaxErrors(text: string): Promise<string[]>;
|
|
2
14
|
/**
|
|
3
15
|
* Write a change back into a `dashboards/*.malloy` file by PATCHING it.
|
|
4
16
|
*
|