@malloydata/render 0.0.137-dev240327175808 → 0.0.137-dev240328161656
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/main.ts +1 -0
- package/dist/component/bar-chart/generate-bar_chart-spec.d.ts +3 -0
- package/dist/component/chart-settings.d.ts +7 -3
- package/dist/component/chart.d.ts +7 -0
- package/dist/component/plot/plot-spec.d.ts +21 -0
- package/dist/component/plot/plot-to-vega.d.ts +7 -0
- package/dist/component/plot/util.d.ts +5 -0
- package/dist/component/render-result-metadata.d.ts +2 -13
- package/dist/component/render.d.ts +0 -1
- package/dist/component/result-context.d.ts +1 -1
- package/dist/component/table/table-layout.d.ts +1 -3
- package/dist/component/tag-utils.d.ts +2 -0
- package/dist/component/types.d.ts +26 -0
- package/dist/component/util.d.ts +3 -3
- package/dist/component/vega/vega-chart.d.ts +9 -0
- package/dist/module/index.mjs +17424 -17639
- package/dist/module/index.umd.js +271 -308
- package/dist/stories/bars.stories.d.ts +18 -0
- package/dist/webcomponent/malloy-render.mjs +20676 -21134
- package/dist/webcomponent/malloy-render.umd.js +270 -307
- package/package.json +3 -4
- package/dist/component/bar-chart.d.ts +0 -9
- package/dist/component/vega-chart.d.ts +0 -15
- package/dist/component/vega-lite-base-spec.d.ts +0 -2
package/.storybook/main.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import { ExploreField, Field } from '@malloydata/malloy';
|
|
2
|
-
import { RenderResultMetadata } from './
|
|
1
|
+
import { Explore, ExploreField, Field } from '@malloydata/malloy';
|
|
2
|
+
import { RenderResultMetadata } from './types';
|
|
3
3
|
export type ChartSettings = {
|
|
4
4
|
plotWidth: number;
|
|
5
5
|
plotHeight: number;
|
|
6
6
|
xAxis: {
|
|
7
7
|
labelAngle: number;
|
|
8
|
+
labelAlign?: string;
|
|
9
|
+
labelBaseline?: string;
|
|
8
10
|
labelSize: number;
|
|
9
11
|
height: number;
|
|
10
12
|
titleSize: number;
|
|
13
|
+
hidden: boolean;
|
|
11
14
|
};
|
|
12
15
|
yAxis: {
|
|
13
16
|
width: number;
|
|
14
17
|
tickCount?: number;
|
|
18
|
+
hidden: boolean;
|
|
15
19
|
};
|
|
16
20
|
yScale: {
|
|
17
21
|
domain: number[];
|
|
@@ -27,4 +31,4 @@ export type ChartSettings = {
|
|
|
27
31
|
totalWidth: number;
|
|
28
32
|
totalHeight: number;
|
|
29
33
|
};
|
|
30
|
-
export declare function getChartSettings(field: ExploreField, metadata: RenderResultMetadata): ChartSettings;
|
|
34
|
+
export declare function getChartSettings(field: Explore | ExploreField, metadata: RenderResultMetadata): ChartSettings;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Explore, ExploreField, QueryData } from '@malloydata/malloy';
|
|
2
|
+
import { RenderResultMetadata } from './types';
|
|
3
|
+
export declare function Chart(props: {
|
|
4
|
+
field: Explore | ExploreField;
|
|
5
|
+
data: QueryData;
|
|
6
|
+
metadata: RenderResultMetadata;
|
|
7
|
+
}): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type ScaleType = 'quantitative' | 'nominal';
|
|
2
|
+
export type Channel = {
|
|
3
|
+
fields: string[];
|
|
4
|
+
type: ScaleType | null;
|
|
5
|
+
};
|
|
6
|
+
export type Mark = {
|
|
7
|
+
id: string;
|
|
8
|
+
type: string;
|
|
9
|
+
x: string | null;
|
|
10
|
+
y: string | null;
|
|
11
|
+
};
|
|
12
|
+
export type PlotSpec = {
|
|
13
|
+
x: Channel;
|
|
14
|
+
y: Channel;
|
|
15
|
+
color: Channel;
|
|
16
|
+
fx: Channel;
|
|
17
|
+
fy: Channel;
|
|
18
|
+
marks: Mark[];
|
|
19
|
+
};
|
|
20
|
+
export declare function createEmptySpec(): PlotSpec;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Explore, ExploreField } from '@malloydata/malloy';
|
|
2
|
+
import { PlotSpec } from './plot-spec';
|
|
3
|
+
import { RenderResultMetadata, VegaChartProps } from '../types';
|
|
4
|
+
export declare function plotToVega(plotSpec: PlotSpec, options: {
|
|
5
|
+
field: Explore | ExploreField;
|
|
6
|
+
metadata: RenderResultMetadata;
|
|
7
|
+
}): VegaChartProps;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Explore, Field } from '@malloydata/malloy';
|
|
2
|
+
export declare function walkFields(e: Explore, cb: (f: Field) => void): void;
|
|
3
|
+
export declare function getFieldPathArrayFromRoot(f: Field | Explore): string[];
|
|
4
|
+
export declare function getFieldPathFromRoot(f: Field | Explore): string;
|
|
5
|
+
export declare function getFieldPathBetweenFields(parentField: Field | Explore, childField: Field | Explore): string;
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
field: Field;
|
|
4
|
-
min: number | null;
|
|
5
|
-
max: number | null;
|
|
6
|
-
minString: string | null;
|
|
7
|
-
maxString: string | null;
|
|
8
|
-
values: Set<string>;
|
|
9
|
-
maxRecordCt: number | null;
|
|
10
|
-
}
|
|
11
|
-
export interface RenderResultMetadata {
|
|
12
|
-
fields: Record<string, FieldRenderMetadata>;
|
|
13
|
-
}
|
|
1
|
+
import { Result } from '@malloydata/malloy';
|
|
2
|
+
import { RenderResultMetadata } from './types';
|
|
14
3
|
export declare function getResultMetadata(result: Result): RenderResultMetadata;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RenderResultMetadata } from './
|
|
1
|
+
import { RenderResultMetadata } from './types';
|
|
2
2
|
export declare const ResultContext: import("solid-js").Context<RenderResultMetadata | undefined>;
|
|
3
3
|
export declare const useResultContext: () => RenderResultMetadata;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { FieldRenderMetadata, RenderResultMetadata } from '../
|
|
2
|
-
import { ChartSettings } from '../chart-settings';
|
|
1
|
+
import { FieldRenderMetadata, RenderResultMetadata } from '../types';
|
|
3
2
|
type LayoutEntry = {
|
|
4
3
|
metadata: FieldRenderMetadata;
|
|
5
4
|
width: number;
|
|
6
5
|
height: number | null;
|
|
7
|
-
chartSettings: ChartSettings | null;
|
|
8
6
|
};
|
|
9
7
|
export type TableLayout = Record<string, LayoutEntry>;
|
|
10
8
|
export declare function getTableLayout(metadata: RenderResultMetadata): TableLayout;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DataColumn, Explore, Field, QueryData } from '@malloydata/malloy';
|
|
2
|
+
export type VegaSpec = any;
|
|
3
|
+
export type VegaChartProps = {
|
|
4
|
+
spec: VegaSpec;
|
|
5
|
+
plotWidth: number;
|
|
6
|
+
plotHeight: number;
|
|
7
|
+
totalWidth: number;
|
|
8
|
+
totalHeight: number;
|
|
9
|
+
};
|
|
10
|
+
export interface FieldRenderMetadata {
|
|
11
|
+
field: Field | Explore;
|
|
12
|
+
min: number | null;
|
|
13
|
+
max: number | null;
|
|
14
|
+
minString: string | null;
|
|
15
|
+
maxString: string | null;
|
|
16
|
+
values: Set<string>;
|
|
17
|
+
maxRecordCt: number | null;
|
|
18
|
+
vegaChartProps?: VegaChartProps;
|
|
19
|
+
}
|
|
20
|
+
export interface RenderResultMetadata {
|
|
21
|
+
fields: Record<string, FieldRenderMetadata>;
|
|
22
|
+
fieldKeyMap: WeakMap<Field | Explore, string>;
|
|
23
|
+
getFieldKey: (f: Field | Explore) => string;
|
|
24
|
+
field: (f: Field | Explore) => FieldRenderMetadata;
|
|
25
|
+
getData: (cell: DataColumn) => QueryData;
|
|
26
|
+
}
|
package/dist/component/util.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Explore, Field } from '@malloydata/malloy';
|
|
1
|
+
import { Explore, Field, Tag } from '@malloydata/malloy';
|
|
2
2
|
export declare function isLastChild(f: Field | Explore): boolean;
|
|
3
3
|
export declare function isFirstChild(f: Field | Explore): boolean;
|
|
4
4
|
export declare function valueIsNumber(f: Field, v: unknown): v is number;
|
|
5
5
|
export declare function valueIsString(f: Field, s: unknown): s is string;
|
|
6
6
|
export declare function getTextWidth(text: string, font: string, canvasToUse?: HTMLCanvasElement): number;
|
|
7
7
|
export declare function clamp(s: number, e: number, v: number): number;
|
|
8
|
-
export declare function shouldRenderAs(f: Field): "table" | "cell" | "
|
|
9
|
-
export declare function getFieldKey(f: Field): string;
|
|
8
|
+
export declare function shouldRenderAs(f: Field | Explore, tagOverride?: Tag): "table" | "cell" | "chart";
|
|
9
|
+
export declare function getFieldKey(f: Field | Explore): string;
|