@malloydata/render 0.0.209 → 0.0.210-dev241106211926
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/.storybook/preview.ts +3 -2
- package/DEVELOPING.md +134 -0
- package/README.md +44 -23
- package/dist/html/area_sparkline.d.ts +4 -4
- package/dist/html/bar_chart.d.ts +4 -4
- package/dist/html/bar_sparkline.d.ts +4 -4
- package/dist/html/boolean.d.ts +4 -4
- package/dist/html/bytes.d.ts +4 -4
- package/dist/html/chart.d.ts +3 -3
- package/dist/html/column_sparkline.d.ts +4 -4
- package/dist/html/container.d.ts +3 -3
- package/dist/html/currency.d.ts +4 -4
- package/dist/html/dashboard.d.ts +1 -1
- package/dist/{data_styles.d.ts → html/data_styles.d.ts} +1 -1
- package/dist/html/data_volume.d.ts +4 -4
- package/dist/html/date.d.ts +4 -4
- package/dist/html/duration.d.ts +4 -4
- package/dist/html/html_view.d.ts +3 -3
- package/dist/html/image.d.ts +4 -4
- package/dist/html/json.d.ts +4 -4
- package/dist/html/line_chart.d.ts +4 -4
- package/dist/html/link.d.ts +4 -4
- package/dist/html/list.d.ts +1 -1
- package/dist/html/main_renderer_factory.d.ts +35 -0
- package/dist/html/number.d.ts +4 -4
- package/dist/html/percent.d.ts +4 -4
- package/dist/html/point_map.d.ts +4 -4
- package/dist/html/scatter_chart.d.ts +4 -4
- package/dist/html/segment_map.d.ts +4 -4
- package/dist/html/shape_map.d.ts +4 -4
- package/dist/html/sparkline.d.ts +4 -4
- package/dist/html/table.d.ts +2 -2
- package/dist/html/text.d.ts +4 -4
- package/dist/html/unsupported.d.ts +4 -4
- package/dist/html/utils.d.ts +2 -2
- package/dist/html/vega_spec.d.ts +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/module/index.mjs +11549 -11791
- package/dist/module/index.umd.js +248 -248
- package/dist/register/register.mjs +1 -1
- package/dist/register/register.umd.js +1 -1
- package/dist/webcomponent/malloy-render.mjs +1 -1
- package/dist/webcomponent/malloy-render.umd.js +1 -1
- package/package.json +3 -5
- package/dist/main_renderer_factory.d.ts +0 -35
- /package/dist/{drill.d.ts → html/drill.d.ts} +0 -0
- /package/dist/{renderer.d.ts → html/renderer.d.ts} +0 -0
- /package/dist/{renderer_factory.d.ts → html/renderer_factory.d.ts} +0 -0
- /package/dist/{renderer_types.d.ts → html/renderer_types.d.ts} +0 -0
package/.storybook/preview.ts
CHANGED
|
@@ -11,10 +11,11 @@ async function createConnection() {
|
|
|
11
11
|
});
|
|
12
12
|
await connection.connecting;
|
|
13
13
|
for (let tableName of registeredData) {
|
|
14
|
-
const
|
|
14
|
+
const tableUrl = `data/${tableName}`;
|
|
15
|
+
const fullTableName = `static/${tableUrl}`;
|
|
15
16
|
await connection.registerRemoteTable(
|
|
16
17
|
fullTableName,
|
|
17
|
-
new window.URL(
|
|
18
|
+
new window.URL(tableUrl, window.location.href).toString()
|
|
18
19
|
);
|
|
19
20
|
}
|
|
20
21
|
memoConnection = connection;
|
package/DEVELOPING.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Developing the Malloy Renderer
|
|
2
|
+
|
|
3
|
+
The Malloy Renderer is developed in the `src` folder of this repository. The following sections provide guidance on how to develop, view, and debug local changes.
|
|
4
|
+
|
|
5
|
+
## New vs. Legacy renderer code
|
|
6
|
+
|
|
7
|
+
The legacy renderer is deprecated but is still available and in use for features not yet implemented in the new renderer. This legacy code lives in the `src/html` directory.
|
|
8
|
+
|
|
9
|
+
## Viewing the renderer locally
|
|
10
|
+
|
|
11
|
+
Storybook is used to view the renderer locally. To launch the storybook:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
$ npm run storybook
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Then navigate to the URL provided. In this storybook, you can navigate between different stories that render Malloy queries from the Malloy source code.
|
|
18
|
+
|
|
19
|
+
### Tips
|
|
20
|
+
|
|
21
|
+
This storybook does not hot reload, so you need to reload the page when:
|
|
22
|
+
|
|
23
|
+
- you make changes to malloy-render source code
|
|
24
|
+
- you add a new story
|
|
25
|
+
|
|
26
|
+
If you make changes to the malloy core package, you need to relaunch the storybook.
|
|
27
|
+
|
|
28
|
+
It is fairly common for Malloy compilation to randomly fail when opening the storybook. A simple reload of the page fixes the problem.
|
|
29
|
+
|
|
30
|
+
## Adding new stories for viewing the renderer
|
|
31
|
+
|
|
32
|
+
Stories are generated using `*.stories.malloy` files in src/stories. By default, the filename is used to produce a component name in the storybook. This can be customized using a model tag:
|
|
33
|
+
|
|
34
|
+
```malloy
|
|
35
|
+
// in charts.stories.malloy
|
|
36
|
+
|
|
37
|
+
##(story) component='My Charts'
|
|
38
|
+
|
|
39
|
+
source: ...
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Stories are generated for any view annotated as `#(story)`. By default, the view name is used to produce the story name. This can be customized on the tag like so:
|
|
43
|
+
|
|
44
|
+
```malloy
|
|
45
|
+
// in charts.stories.malloy
|
|
46
|
+
|
|
47
|
+
source: ... {
|
|
48
|
+
|
|
49
|
+
// Title will automatically be "My Story"
|
|
50
|
+
#(story)
|
|
51
|
+
view: my_story is { ... }
|
|
52
|
+
|
|
53
|
+
// Title will be "Custom Title"
|
|
54
|
+
#(story) story='Custom Title'
|
|
55
|
+
view: another_story is { ... }
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Adding new data sources for stories
|
|
60
|
+
|
|
61
|
+
Data sources have to be registered in advance when creating stories. To add new data sources:
|
|
62
|
+
|
|
63
|
+
1. Add the new data file to `src/stories/static/data`
|
|
64
|
+
2. Register the new source by updating `.storybook/registered_data.json` with the new file name and extension.
|
|
65
|
+
3. Import the data in your `stories.malloy` files in `src/stories` like so:
|
|
66
|
+
|
|
67
|
+
```malloy
|
|
68
|
+
source: foo is duckdb.table("static/data/my_file.csv");
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Adding new renderers
|
|
72
|
+
|
|
73
|
+
Renderers are applied based on tags parsed on an Explore or Field. This is done in the file `src/component/apply-renderer.tsx`. To add a new renderer in this file:
|
|
74
|
+
|
|
75
|
+
1. Update the `shouldRenderAs` function that looks at the field tags and returns an enum for your renderer type
|
|
76
|
+
2. Update the switch statement in the `applyRenderer` function to add a case for your new renderer. Your case statement should update the `renderValue` variable using your renderer.
|
|
77
|
+
|
|
78
|
+
## Renderer Metadata
|
|
79
|
+
|
|
80
|
+
Some of the renderers, especially charts, benefit from having metadata about the data table being rendered. This can include attributes like the min and max values in a numeric column, the number of rows in a nested table, etc. This metadata is derived in `src/component/render-result-metadata.ts`. The `getResultMetadata` function is used to create the `RenderResultMetadata` object. This object is shared throughout our SolidJS component tree using the Context api. To access the metadata, use the `useResultContext()` method in a component.
|
|
81
|
+
|
|
82
|
+
## Adding new charts
|
|
83
|
+
|
|
84
|
+
Charts are typically rendered using a Vega spec via the generic `Chart` component in `src/component/chart/chart.tsx`. We precompile Vega runtimes for each chart column in a query. This is done in the render result metadata creation. In the function `populateExploreMeta`, you can see examples of checking for chart tags and if finding them, creating the Vega spec and runtime for the charts in that column. Your Vega chart code should return a `VegaChartProps` object. See the examples in `populateExploreMeta` for the bar and line charts.
|
|
85
|
+
|
|
86
|
+
### Tips
|
|
87
|
+
|
|
88
|
+
- The `src/component/chart-layout-settings.ts` file is a useful file that uses metadata about a chart Explore to derive important chart attributes like padding, axes sizes, and total chart sizes that need to be encoded into a chart Vega spec.
|
|
89
|
+
- Vega does not provide typings for sub compenents of the Vega spec, so we currently have to resort to using a vega spec type of `any`, exported as the type `VegaSpec`.
|
|
90
|
+
- The bar chart and line chart specs are good examples to look at for how to create chart code. They show among other things:
|
|
91
|
+
- Deriving chart configurations from chart tags and nested tags
|
|
92
|
+
- Getting chart layout settings and using them
|
|
93
|
+
- Defining chart interactions
|
|
94
|
+
- Mapping source Result data to chart-ready data
|
|
95
|
+
- Implementing tooltip behaviors
|
|
96
|
+
|
|
97
|
+
## Chart interactions
|
|
98
|
+
|
|
99
|
+
In the renderer, chart interactions are shared across charts using the same dimensions or measures. This sharing of interactions is made possible through a proxy store called the ResultStore and found in `src/component/result-store/result-store.ts`. The interactions are shared in a data structure called a Brush. A Brush represents a currently highlighted value for a specific dimension or measure.
|
|
100
|
+
|
|
101
|
+
When `chart.tsx` renders a Vega chart, it checks to see if the chart runtime has a signal defined for `brushIn`. If it does, it passes an array of the brushes relevant to that chart via the `brushIn` signal. The chart can then use that `brushIn` data to determine how to render brushes. For example, for a measure brush the chart may show a reference line.
|
|
102
|
+
|
|
103
|
+
It is highly recommened to only render brushes based on data coming in from `brushIn`, as opposed to relying on internal state of the chart. That way, charts are always synced properly via the shared external store like so:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
----> ChartA (consumes brushes and renders them)
|
|
107
|
+
|
|
|
108
|
+
ResultStore --exports shared brush data--
|
|
109
|
+
|
|
|
110
|
+
----> ChartB (consumes brushes and renders them)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Charts may also export brushes to the ResultStore, based on user interactions within the chart. This is done via the `brushOut` signal, which `chart.tsx` will read from if it exists and use it to update the ResultStore.
|
|
114
|
+
|
|
115
|
+
This is similar to the ["Controlled Component" concept in React](https://react.dev/learn/sharing-state-between-components#controlled-and-uncontrolled-components).
|
|
116
|
+
|
|
117
|
+
For examples of how to use brushIn data and export brushOut data, see the bar chart and line chart spec generation code.
|
|
118
|
+
|
|
119
|
+
## Debugging tips
|
|
120
|
+
|
|
121
|
+
TODO
|
|
122
|
+
|
|
123
|
+
- signal logging
|
|
124
|
+
- vega introspection
|
|
125
|
+
|
|
126
|
+
## Generating builds
|
|
127
|
+
|
|
128
|
+
To generate local builds of the renderer, you can run
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
$ npm run build
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
This is useful when developing with the Malloy VSCode Extension repo, where you can use `npm run malloy-link` to reference your local build of the renderer.
|
package/README.md
CHANGED
|
@@ -1,10 +1,50 @@
|
|
|
1
|
-
# Malloy
|
|
1
|
+
# Malloy Renderer
|
|
2
2
|
|
|
3
|
-
Malloy is
|
|
3
|
+
The Malloy Renderer is a web component for rendering Malloy query results. It is included by default in the Malloy VSCode extension, but can also be embedded by developers into their own applications that use Malloy query results. To learn more about how to use the renderer in a Malloy model, see [the Renderer docs](https://docs.malloydata.dev/documentation/visualizations/overview).
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Using the Renderer in Web Apps
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
1. Install the renderer package
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
$ npm i @malloydata/render
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
2. Import the web component somewhere in your project. This will automatically register the `<malloy-render>` web component on your document.
|
|
14
|
+
|
|
15
|
+
```javascript
|
|
16
|
+
import '@malloydata/render/webcomponent';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
3. Use the web component in your app by creating a `<malloy-render>` node and passing it Malloy query results:
|
|
20
|
+
|
|
21
|
+
```javascript
|
|
22
|
+
const malloyRenderElement = document.createElement('malloy-render');
|
|
23
|
+
// Pass a Malloy Result object to the renderer
|
|
24
|
+
malloyRenderElement.result = myMalloyResult;
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
Alternatively, you can pass Malloy QueryResult and ModelDef objects to the renderer,
|
|
28
|
+
which will then construct the Result object. This is useful when you are receiving serialiazed Malloy results via an API.
|
|
29
|
+
*/
|
|
30
|
+
malloyRenderElement.queryResult = myQueryResult;
|
|
31
|
+
malloyRenderElement.modelDef = myModelDef;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Explicitly registering the web component
|
|
35
|
+
|
|
36
|
+
In some situations, such as using Malloy Render with a mock DOM like JSDOM, you may want to explicitly register the web component on a document. This can be done using the `@malloydata/render/webcomponent/register` import like so:
|
|
37
|
+
|
|
38
|
+
```javascript
|
|
39
|
+
import registerMalloyRender from '@malloydata/malloy-render/webcomponent/register';
|
|
40
|
+
|
|
41
|
+
const {window} = new JSDOM(`...`);
|
|
42
|
+
|
|
43
|
+
registerMalloyRender({
|
|
44
|
+
customElements: window.customElements,
|
|
45
|
+
HTMLElement: window.HTMLElement,
|
|
46
|
+
});
|
|
47
|
+
```
|
|
8
48
|
|
|
9
49
|
## Developing locally with Storybook
|
|
10
50
|
|
|
@@ -21,22 +61,3 @@ Stories are written in the `src/stories` directory. To add more data and Malloy
|
|
|
21
61
|
### On Reloading Changes
|
|
22
62
|
|
|
23
63
|
When running `npm run storybook`, only changes in the malloy-render package will hot reload properly. Changes to dependencies like the core `malloy` package may require a browser reload to work properly.
|
|
24
|
-
|
|
25
|
-
## Using the Bundled Renderer
|
|
26
|
-
|
|
27
|
-
Any web browser with JSON results from a DB query execution and a PreparedResult object from the Malloy library should be able to use the bundled renderer to create an HTML Malloy Result. The renderer bundle is available from v0.0.118 onwards. Example usage:
|
|
28
|
-
|
|
29
|
-
```js
|
|
30
|
-
var script = document.createElement('script');
|
|
31
|
-
script.src =
|
|
32
|
-
'https://cdn.jsdelivr.net/npm/@malloydata/render@0.0.118/dist/bundle/bundled_renderer.min.js';
|
|
33
|
-
document.head.appendChild(script);
|
|
34
|
-
var resultElement = document.getElementById('result_div');
|
|
35
|
-
renderMalloyResults(result, total_rows, preparedResult).then(
|
|
36
|
-
function (malloyResElement) {
|
|
37
|
-
resultElement.appendChild(malloyResElement);
|
|
38
|
-
}
|
|
39
|
-
);
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
To build the bundle from source, run `npm run bundle_renderer`. This will create the bundled js files in in `dist/bundle`.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HTMLSparkLineRenderer } from './sparkline';
|
|
2
2
|
import { DataArray, Explore, Field } from '@malloydata/malloy';
|
|
3
3
|
import * as lite from 'vega-lite';
|
|
4
|
-
import { RendererFactory } from '
|
|
5
|
-
import { Renderer } from '
|
|
6
|
-
import { SparkLineRenderOptions, StyleDefaults } from '
|
|
7
|
-
import { RendererOptions } from '
|
|
4
|
+
import { RendererFactory } from './renderer_factory';
|
|
5
|
+
import { Renderer } from './renderer';
|
|
6
|
+
import { SparkLineRenderOptions, StyleDefaults } from './data_styles';
|
|
7
|
+
import { RendererOptions } from './renderer_types';
|
|
8
8
|
export declare class HTMLAreaSparkLineRenderer extends HTMLSparkLineRenderer {
|
|
9
9
|
getVegaLiteSpec(data: DataArray): lite.TopLevelSpec;
|
|
10
10
|
}
|
package/dist/html/bar_chart.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLCartesianChartRenderer } from './cartesian_chart';
|
|
3
|
-
import { BarChartRenderOptions, SparkLineRenderOptions, StyleDefaults } from '
|
|
4
|
-
import { RendererFactory } from '
|
|
5
|
-
import { RendererOptions } from '
|
|
6
|
-
import { Renderer } from '
|
|
3
|
+
import { BarChartRenderOptions, SparkLineRenderOptions, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererFactory } from './renderer_factory';
|
|
5
|
+
import { RendererOptions } from './renderer_types';
|
|
6
|
+
import { Renderer } from './renderer';
|
|
7
7
|
export declare class HTMLBarChartRenderer extends HTMLCartesianChartRenderer {
|
|
8
8
|
getMark(): 'bar';
|
|
9
9
|
getDataType(field: Field): 'temporal' | 'ordinal' | 'quantitative' | 'nominal';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DataArray, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import * as lite from 'vega-lite';
|
|
3
3
|
import { HTMLBarChartRenderer } from './bar_chart';
|
|
4
|
-
import { BarSparkLineRenderOptions, StyleDefaults } from '
|
|
5
|
-
import { RendererFactory } from '
|
|
6
|
-
import { RendererOptions } from '
|
|
7
|
-
import { Renderer } from '
|
|
4
|
+
import { BarSparkLineRenderOptions, StyleDefaults } from './data_styles';
|
|
5
|
+
import { RendererFactory } from './renderer_factory';
|
|
6
|
+
import { RendererOptions } from './renderer_types';
|
|
7
|
+
import { Renderer } from './renderer';
|
|
8
8
|
export declare class HTMLBarSparkLineRenderer extends HTMLBarChartRenderer {
|
|
9
9
|
getSize(): {
|
|
10
10
|
height: number;
|
package/dist/html/boolean.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLTextRenderer } from './text';
|
|
3
|
-
import { RendererFactory } from '
|
|
4
|
-
import { BooleanRenderOptions, StyleDefaults } from '
|
|
5
|
-
import { RendererOptions } from '
|
|
6
|
-
import { Renderer } from '
|
|
3
|
+
import { RendererFactory } from './renderer_factory';
|
|
4
|
+
import { BooleanRenderOptions, StyleDefaults } from './data_styles';
|
|
5
|
+
import { RendererOptions } from './renderer_types';
|
|
6
|
+
import { Renderer } from './renderer';
|
|
7
7
|
export declare class HTMLBooleanRenderer extends HTMLTextRenderer {
|
|
8
8
|
getText(data: DataColumn): string | null;
|
|
9
9
|
}
|
package/dist/html/bytes.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLTextRenderer } from './text';
|
|
3
|
-
import { BytesRenderOptions, StyleDefaults } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { Renderer } from '
|
|
6
|
-
import { RendererFactory } from '
|
|
3
|
+
import { BytesRenderOptions, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { Renderer } from './renderer';
|
|
6
|
+
import { RendererFactory } from './renderer_factory';
|
|
7
7
|
export declare class HTMLBytesRenderer extends HTMLTextRenderer {
|
|
8
8
|
getText(data: DataColumn): string | null;
|
|
9
9
|
}
|
package/dist/html/chart.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as lite from 'vega-lite';
|
|
2
2
|
import { DataArray, DataColumn, Field } from '@malloydata/malloy';
|
|
3
|
-
import { Renderer } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { ChartRenderOptions, StyleDefaults } from '
|
|
3
|
+
import { Renderer } from './renderer';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { ChartRenderOptions, StyleDefaults } from './data_styles';
|
|
6
6
|
type MappedRow = {
|
|
7
7
|
[p: string]: string | number | Date | undefined | null;
|
|
8
8
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DataArray, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import * as lite from 'vega-lite';
|
|
3
3
|
import { HTMLBarChartRenderer } from './bar_chart';
|
|
4
|
-
import { RendererFactory } from '
|
|
5
|
-
import { ColumnSparkLineRenderOptions, StyleDefaults } from '
|
|
6
|
-
import { RendererOptions } from '
|
|
7
|
-
import { Renderer } from '
|
|
4
|
+
import { RendererFactory } from './renderer_factory';
|
|
5
|
+
import { ColumnSparkLineRenderOptions, StyleDefaults } from './data_styles';
|
|
6
|
+
import { RendererOptions } from './renderer_types';
|
|
7
|
+
import { Renderer } from './renderer';
|
|
8
8
|
export declare class HTMLColumnSparkLineRenderer extends HTMLBarChartRenderer {
|
|
9
9
|
getSize(): {
|
|
10
10
|
height: number;
|
package/dist/html/container.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Explore, Tag } from '@malloydata/malloy';
|
|
2
|
-
import { StyleDefaults } from '
|
|
3
|
-
import { ChildRenderers, RenderTree } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
2
|
+
import { StyleDefaults } from './data_styles';
|
|
3
|
+
import { ChildRenderers, RenderTree } from './renderer';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
5
|
export declare abstract class ContainerRenderer extends RenderTree {
|
|
6
6
|
childRenderers: ChildRenderers;
|
|
7
7
|
protected abstract childrenStyleDefaults: StyleDefaults;
|
package/dist/html/currency.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLTextRenderer } from './text';
|
|
3
|
-
import { RendererFactory } from '
|
|
4
|
-
import { CurrencyRenderOptions, StyleDefaults } from '
|
|
5
|
-
import { RendererOptions } from '
|
|
6
|
-
import { Renderer } from '
|
|
3
|
+
import { RendererFactory } from './renderer_factory';
|
|
4
|
+
import { CurrencyRenderOptions, StyleDefaults } from './data_styles';
|
|
5
|
+
import { RendererOptions } from './renderer_types';
|
|
6
|
+
import { Renderer } from './renderer';
|
|
7
7
|
export declare class HTMLCurrencyRenderer extends HTMLTextRenderer {
|
|
8
8
|
readonly options: CurrencyRenderOptions;
|
|
9
9
|
constructor(document: Document, options: CurrencyRenderOptions);
|
package/dist/html/dashboard.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataArrayOrRecord } from '@malloydata/malloy';
|
|
2
|
-
import { StyleDefaults } from '
|
|
2
|
+
import { StyleDefaults } from './data_styles';
|
|
3
3
|
import { ContainerRenderer } from './container';
|
|
4
4
|
export declare class HTMLDashboardRenderer extends ContainerRenderer {
|
|
5
5
|
protected childrenStyleDefaults: StyleDefaults;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLTextRenderer } from './text';
|
|
3
|
-
import { DataVolumeRenderOptions, NumberRenderOptions, StyleDefaults } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { Renderer } from '
|
|
6
|
-
import { RendererFactory } from '
|
|
3
|
+
import { DataVolumeRenderOptions, NumberRenderOptions, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { Renderer } from './renderer';
|
|
6
|
+
import { RendererFactory } from './renderer_factory';
|
|
7
7
|
export declare class HTMLDataVolumeRenderer extends HTMLTextRenderer {
|
|
8
8
|
readonly options: DataVolumeRenderOptions;
|
|
9
9
|
constructor(document: Document, options: DataVolumeRenderOptions);
|
package/dist/html/date.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
|
-
import { Renderer } from '
|
|
3
|
-
import { StyleDefaults, TimeRenderOptions } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { RendererFactory } from '
|
|
2
|
+
import { Renderer } from './renderer';
|
|
3
|
+
import { StyleDefaults, TimeRenderOptions } from './data_styles';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { RendererFactory } from './renderer_factory';
|
|
6
6
|
export declare class HTMLDateRenderer implements Renderer {
|
|
7
7
|
private readonly document;
|
|
8
8
|
private readonly queryTimezone;
|
package/dist/html/duration.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { AtomicField, DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLTextRenderer } from './text';
|
|
3
|
-
import { DurationRenderOptions, DurationUnit, StyleDefaults } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { Renderer } from '
|
|
6
|
-
import { RendererFactory } from '
|
|
3
|
+
import { DurationRenderOptions, DurationUnit, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { Renderer } from './renderer';
|
|
6
|
+
import { RendererFactory } from './renderer_factory';
|
|
7
7
|
export declare function formatTimeUnit(value: number, unit: DurationUnit, options?: {
|
|
8
8
|
numFormat?: string;
|
|
9
9
|
terse?: boolean;
|
package/dist/html/html_view.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DataArray, Explore, Field, Result, Tag } from '@malloydata/malloy';
|
|
2
|
-
import { StyleDefaults } from '
|
|
3
|
-
import { Renderer } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
2
|
+
import { StyleDefaults } from './data_styles';
|
|
3
|
+
import { Renderer } from './renderer';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
5
|
export declare class HTMLView {
|
|
6
6
|
private document;
|
|
7
7
|
constructor(document: Document);
|
package/dist/html/image.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
|
-
import { Renderer } from '
|
|
3
|
-
import { RendererFactory } from '
|
|
4
|
-
import { ImageRenderOptions, StyleDefaults } from '
|
|
5
|
-
import { RendererOptions } from '
|
|
2
|
+
import { Renderer } from './renderer';
|
|
3
|
+
import { RendererFactory } from './renderer_factory';
|
|
4
|
+
import { ImageRenderOptions, StyleDefaults } from './data_styles';
|
|
5
|
+
import { RendererOptions } from './renderer_types';
|
|
6
6
|
export declare class HTMLImageRenderer implements Renderer {
|
|
7
7
|
private readonly document;
|
|
8
8
|
constructor(document: Document);
|
package/dist/html/json.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
|
-
import { Renderer } from '
|
|
3
|
-
import { JSONRenderOptions, StyleDefaults } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { RendererFactory } from '
|
|
2
|
+
import { Renderer } from './renderer';
|
|
3
|
+
import { JSONRenderOptions, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { RendererFactory } from './renderer_factory';
|
|
6
6
|
export declare class HTMLJSONRenderer implements Renderer {
|
|
7
7
|
private readonly document;
|
|
8
8
|
constructor(document: Document);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLCartesianChartRenderer } from './cartesian_chart';
|
|
3
|
-
import { LineChartRenderOptions, StyleDefaults } from '
|
|
4
|
-
import { RendererFactory } from '
|
|
5
|
-
import { RendererOptions } from '
|
|
6
|
-
import { Renderer } from '
|
|
3
|
+
import { LineChartRenderOptions, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererFactory } from './renderer_factory';
|
|
5
|
+
import { RendererOptions } from './renderer_types';
|
|
6
|
+
import { Renderer } from './renderer';
|
|
7
7
|
export declare class HTMLLineChartRenderer extends HTMLCartesianChartRenderer {
|
|
8
8
|
getMark(): 'line';
|
|
9
9
|
getDataType(field: Field): 'temporal' | 'ordinal' | 'quantitative' | 'nominal';
|
package/dist/html/link.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
|
-
import { Renderer } from '
|
|
3
|
-
import { LinkRenderOptions, StyleDefaults } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { RendererFactory } from '
|
|
2
|
+
import { Renderer } from './renderer';
|
|
3
|
+
import { LinkRenderOptions, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { RendererFactory } from './renderer_factory';
|
|
6
6
|
export declare class HTMLLinkRenderer implements Renderer {
|
|
7
7
|
private readonly document;
|
|
8
8
|
constructor(document: Document);
|
package/dist/html/list.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
|
-
import { StyleDefaults } from '
|
|
2
|
+
import { StyleDefaults } from './data_styles';
|
|
3
3
|
import { ContainerRenderer } from './container';
|
|
4
4
|
export declare class HTMLListRenderer extends ContainerRenderer {
|
|
5
5
|
protected childrenStyleDefaults: StyleDefaults;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Field, Explore, Tag } from '@malloydata/malloy';
|
|
2
|
+
import { DataRenderOptions, RenderDef, StyleDefaults } from './data_styles';
|
|
3
|
+
import { Renderer } from './renderer';
|
|
4
|
+
import { RendererFactory } from './renderer_factory';
|
|
5
|
+
import { RendererOptions } from './renderer_types';
|
|
6
|
+
import { ShapeMapRendererFactory } from './shape_map';
|
|
7
|
+
import { PointMapRendererFactory } from './point_map';
|
|
8
|
+
import { ImageRendererFactory } from './image';
|
|
9
|
+
import { SegmentMapRendererFactory } from './segment_map';
|
|
10
|
+
import { JSONRendererFactory } from './json';
|
|
11
|
+
import { SparkLineRendererFactory } from './sparkline';
|
|
12
|
+
import { BarSparkLineRendererFactory } from './bar_sparkline';
|
|
13
|
+
import { AreaSparkLineRendererFactory } from './area_sparkline';
|
|
14
|
+
import { ColumnSparkLineRendererFactory } from './column_sparkline';
|
|
15
|
+
import { ScatterChartRendererFactory } from './scatter_chart';
|
|
16
|
+
import { BarChartRendererFactory } from './bar_chart';
|
|
17
|
+
import { VegaRendererFactory } from './vega_spec';
|
|
18
|
+
import { LineChartRendererFactory } from './line_chart';
|
|
19
|
+
import { DateRendererFactory } from './date';
|
|
20
|
+
import { CurrencyRendererFactory } from './currency';
|
|
21
|
+
import { PercentRendererFactory } from './percent';
|
|
22
|
+
import { NumberRendererFactory } from './number';
|
|
23
|
+
import { BytesRendererFactory } from './bytes';
|
|
24
|
+
import { BooleanRendererFactory } from './boolean';
|
|
25
|
+
import { LinkRendererFactory } from './link';
|
|
26
|
+
import { UnsupportedRendererFactory } from './unsupported';
|
|
27
|
+
import { TextRendererFactory } from './text';
|
|
28
|
+
import { DataVolumeRendererFactory } from './data_volume';
|
|
29
|
+
import { DurationRendererFactory } from './duration';
|
|
30
|
+
export declare class MainRendererFactory {
|
|
31
|
+
static renderFactories: (JSONRendererFactory | TextRendererFactory | NumberRendererFactory | ShapeMapRendererFactory | PointMapRendererFactory | ImageRendererFactory | SegmentMapRendererFactory | VegaRendererFactory | LineChartRendererFactory | SparkLineRendererFactory | BarChartRendererFactory | BarSparkLineRendererFactory | AreaSparkLineRendererFactory | ColumnSparkLineRendererFactory | ScatterChartRendererFactory | DateRendererFactory | CurrencyRendererFactory | PercentRendererFactory | BytesRendererFactory | BooleanRendererFactory | LinkRendererFactory | UnsupportedRendererFactory | DataVolumeRendererFactory | DurationRendererFactory)[];
|
|
32
|
+
create(renderDef: RenderDef | undefined, tagged: Tag, document: Document, styleDefaults: StyleDefaults, rendererOptions: RendererOptions, field: Field | Explore, timezone?: string | undefined): Renderer | undefined;
|
|
33
|
+
matchesRenderDef(renderDef: RenderDef | undefined, factory: RendererFactory<DataRenderOptions>): boolean | "" | undefined;
|
|
34
|
+
matchesTag(tagged: Tag, factory: RendererFactory<DataRenderOptions>): boolean | "" | undefined;
|
|
35
|
+
}
|
package/dist/html/number.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLTextRenderer } from './text';
|
|
3
|
-
import { NumberRenderOptions, StyleDefaults } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { Renderer } from '
|
|
6
|
-
import { RendererFactory } from '
|
|
3
|
+
import { NumberRenderOptions, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { Renderer } from './renderer';
|
|
6
|
+
import { RendererFactory } from './renderer_factory';
|
|
7
7
|
export declare class HTMLNumberRenderer extends HTMLTextRenderer {
|
|
8
8
|
readonly options: NumberRenderOptions;
|
|
9
9
|
constructor(document: Document, options: NumberRenderOptions);
|
package/dist/html/percent.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLNumberRenderer } from './number';
|
|
3
|
-
import { PercentRenderOptions, StyleDefaults } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { Renderer } from '
|
|
6
|
-
import { RendererFactory } from '
|
|
3
|
+
import { PercentRenderOptions, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { Renderer } from './renderer';
|
|
6
|
+
import { RendererFactory } from './renderer_factory';
|
|
7
7
|
export declare class HTMLPercentRenderer extends HTMLNumberRenderer {
|
|
8
8
|
getText(data: DataColumn): string | null;
|
|
9
9
|
}
|
package/dist/html/point_map.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as lite from 'vega-lite';
|
|
2
2
|
import { DataArray, DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
3
3
|
import { HTMLChartRenderer } from './chart';
|
|
4
|
-
import { RendererFactory } from '
|
|
5
|
-
import { PointMapRenderOptions, StyleDefaults } from '
|
|
6
|
-
import { RendererOptions } from '
|
|
7
|
-
import { Renderer } from '
|
|
4
|
+
import { RendererFactory } from './renderer_factory';
|
|
5
|
+
import { PointMapRenderOptions, StyleDefaults } from './data_styles';
|
|
6
|
+
import { RendererOptions } from './renderer_types';
|
|
7
|
+
import { Renderer } from './renderer';
|
|
8
8
|
export declare class HTMLPointMapRenderer extends HTMLChartRenderer {
|
|
9
9
|
getDataValue(data: DataColumn): string | number;
|
|
10
10
|
getDataType(field: Field): 'ordinal' | 'quantitative' | 'nominal';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
2
2
|
import { HTMLCartesianChartRenderer } from './cartesian_chart';
|
|
3
|
-
import { LineChartRenderOptions, ScatterChartRenderOptions, StyleDefaults } from '
|
|
4
|
-
import { RendererOptions } from '
|
|
5
|
-
import { Renderer } from '
|
|
6
|
-
import { RendererFactory } from '
|
|
3
|
+
import { LineChartRenderOptions, ScatterChartRenderOptions, StyleDefaults } from './data_styles';
|
|
4
|
+
import { RendererOptions } from './renderer_types';
|
|
5
|
+
import { Renderer } from './renderer';
|
|
6
|
+
import { RendererFactory } from './renderer_factory';
|
|
7
7
|
export declare class HTMLScatterChartRenderer extends HTMLCartesianChartRenderer {
|
|
8
8
|
getMark(): 'point';
|
|
9
9
|
getDataType(field: Field): 'temporal' | 'ordinal' | 'quantitative' | 'nominal';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as lite from 'vega-lite';
|
|
2
2
|
import { DataArray, DataColumn, Explore, Field } from '@malloydata/malloy';
|
|
3
3
|
import { HTMLChartRenderer } from './chart';
|
|
4
|
-
import { RendererFactory } from '
|
|
5
|
-
import { SegmentMapRenderOptions, StyleDefaults } from '
|
|
6
|
-
import { RendererOptions } from '
|
|
7
|
-
import { Renderer } from '
|
|
4
|
+
import { RendererFactory } from './renderer_factory';
|
|
5
|
+
import { SegmentMapRenderOptions, StyleDefaults } from './data_styles';
|
|
6
|
+
import { RendererOptions } from './renderer_types';
|
|
7
|
+
import { Renderer } from './renderer';
|
|
8
8
|
export declare class HTMLSegmentMapRenderer extends HTMLChartRenderer {
|
|
9
9
|
getDataValue(data: DataColumn): string | number | null;
|
|
10
10
|
getDataType(field: Field): 'ordinal' | 'quantitative' | 'nominal';
|