@malloydata/render 0.0.278 → 0.0.280

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.
@@ -9,7 +9,7 @@ export declare function getCustomTooltipEntries({ explore, records, }: CustomToo
9
9
  value: string | (() => import("solid-js").JSX.Element);
10
10
  highlight: boolean;
11
11
  entryType: "list-item" | "block";
12
- ignoreHighlightState?: boolean | undefined;
13
- color?: string | undefined;
12
+ ignoreHighlightState?: boolean;
13
+ color?: string;
14
14
  }[];
15
15
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference path="../../../src/vega.d.ts" />
2
1
  import type { Runtime, View } from 'vega';
3
2
  import type { RepeatedRecordCell } from '../../data_tree';
4
3
  export type ChartProps = {
@@ -1,8 +1,24 @@
1
- /// <reference path="../../src/vega.d.ts" />
2
1
  import type { Tag } from '@malloydata/malloy-tag';
3
2
  import type { AlignValue, TextBaselineValue } from 'vega';
4
3
  import type { Field, NestField } from '../data_tree';
5
4
  import type { RenderMetadata } from './render-result-metadata';
5
+ type XAxisSettings = {
6
+ labelAngle: number;
7
+ labelAlign?: AlignValue;
8
+ labelBaseline?: TextBaselineValue;
9
+ labelLimit: number;
10
+ height: number;
11
+ titleSize: number;
12
+ hidden: boolean;
13
+ };
14
+ export declare function getXAxisSettings({ maxString, chartHeight, chartWidth, xField, parentField, parentTag, }: {
15
+ maxString: string;
16
+ chartHeight: number;
17
+ chartWidth: number;
18
+ xField: Field;
19
+ parentField: NestField;
20
+ parentTag: Tag;
21
+ }): XAxisSettings;
6
22
  export type ChartLayoutSettings = {
7
23
  plotWidth: number;
8
24
  plotHeight: number;
@@ -45,3 +61,4 @@ export declare function getChartLayoutSettings(field: NestField, chartTag: Tag,
45
61
  getYMinMax?: () => [number, number];
46
62
  independentY?: boolean;
47
63
  }): ChartLayoutSettings;
64
+ export {};
@@ -1,4 +1,3 @@
1
- /// <reference path="../../src/vega.d.ts" />
2
1
  import type { Tag } from '@malloydata/malloy-tag';
3
2
  import type { VegaChartProps, VegaConfigHandler } from './types';
4
3
  import type { ResultStore } from './result-store/result-store';
@@ -26,10 +26,10 @@ export declare const useConfig: () => {
26
26
  stylesheet: CSSStyleSheet;
27
27
  addCSSToShadowRoot: (css: string) => void;
28
28
  addCSSToDocument: (id: string, css: string) => void;
29
- onClick?: ((payload: MalloyClickEventPayload) => void) | undefined;
30
- onDrill?: ((drillData: DrillData) => void) | undefined;
31
- vegaConfigOverride?: VegaConfigHandler | undefined;
32
- modalElement?: HTMLElement | undefined;
29
+ onClick?: (payload: MalloyClickEventPayload) => void;
30
+ onDrill?: (drillData: DrillData) => void;
31
+ vegaConfigOverride?: VegaConfigHandler;
32
+ modalElement?: HTMLElement;
33
33
  };
34
34
  export declare function MalloyRender(props: MalloyRenderProps, { element }: ComponentOptions): import("solid-js").JSX.Element;
35
35
  export declare function MalloyRenderInner(props: {
@@ -1,4 +1,3 @@
1
- /// <reference path="../../src/vega.d.ts" />
2
1
  import type { Tag } from '@malloydata/malloy-tag';
3
2
  import type { Item, Spec, View } from 'vega';
4
3
  import type { JSX } from 'solid-js';
@@ -1,4 +1,3 @@
1
- /// <reference path="../../../src/vega.d.ts" />
2
1
  import type { Config } from 'vega';
3
2
  export declare const grayMedium = "#727883";
4
3
  export declare const gridGray = "#E5E7EB";
@@ -1,4 +1,3 @@
1
- /// <reference path="../../../src/vega.d.ts" />
2
1
  import type { Axis, GroupMark, RectMark } from 'vega';
3
2
  import type { ChartLayoutSettings } from '../chart-layout-settings';
4
3
  type MeasureAxisOptions = {
@@ -1,4 +1,3 @@
1
- /// <reference path="../../../src/vega.d.ts" />
2
1
  import type { EventListenerHandler, SignalListenerHandler, Runtime } from 'vega';
3
2
  import { View } from 'vega';
4
3
  import './vega-expr-addons';
@@ -1,4 +1,3 @@
1
- /// <reference path="../../../src/vega.d.ts" />
2
1
  import type { Item, SignalListenerHandler, View } from 'vega';
3
2
  export declare function addSignalListenerIfExists(view: View, signal: string, cb: SignalListenerHandler): void;
4
3
  export declare function setSignalIfExists(view: View, signal: string, value: unknown): void;
@@ -1,4 +1,3 @@
1
- /// <reference path="../../src/vega.d.ts" />
2
1
  import type { Spec } from 'vega';
3
2
  import type { TopLevelSpec } from 'vega-lite';
4
3
  /**
@@ -6,7 +6,11 @@ export type DrillEntry = {
6
6
  } | {
7
7
  where: string;
8
8
  };
9
- export declare function getDataTree(result: Malloy.Result): RootCell;
9
+ export interface FieldRegistry {
10
+ fieldInstances: Map<string, Field[]>;
11
+ plugins: Map<string, RenderPluginInstance[]>;
12
+ }
13
+ export declare function getDataTree(result: Malloy.Result, plugins?: RenderPlugin[]): RootCell;
10
14
  export type Field = ArrayField | RepeatedRecordField | RecordField | NumberField | DateField | JSONField | StringField | TimestampField | BooleanField | SQLNativeField;
11
15
  export type NestField = RepeatedRecordField | RecordField | ArrayField;
12
16
  export type RecordOrRepeatedRecordField = RepeatedRecordField | RecordField;
@@ -49,7 +53,7 @@ type SQLNativeFieldInfo = Malloy.DimensionInfo & {
49
53
  type: Malloy.AtomicTypeWithSQLNativeType;
50
54
  };
51
55
  export declare const Field: {
52
- from(field: Malloy.DimensionInfo, parent: NestField | undefined): Field;
56
+ from(field: Malloy.DimensionInfo, parent: NestField | undefined, registry?: FieldRegistry): Field;
53
57
  isNestField(field: Field): field is NestField;
54
58
  pathFromString(path: string): any;
55
59
  pathToString(path: string[]): string;
@@ -63,7 +67,13 @@ export declare abstract class FieldBase {
63
67
  protected readonly metadataTag: Tag;
64
68
  readonly renderAs: string;
65
69
  readonly valueSet: Set<string | number | boolean>;
66
- constructor(field: Malloy.DimensionInfo, parent: NestField | undefined);
70
+ private _pluginData;
71
+ protected registry?: FieldRegistry;
72
+ registerPluginData<T>(pluginType: string, data: T): void;
73
+ getPluginData<T>(pluginType: string): T | undefined;
74
+ getAllFieldInstances(): Field[];
75
+ getPlugins(): RenderPluginInstance[];
76
+ constructor(field: Malloy.DimensionInfo, parent: NestField | undefined, registry?: FieldRegistry);
67
77
  isRoot(): boolean;
68
78
  root(): RootField;
69
79
  get sourceName(): string;
@@ -109,13 +119,13 @@ export declare class ArrayField extends FieldBase {
109
119
  readonly fields: Field[];
110
120
  readonly maxUniqueFieldValueCounts: Map<string, number>;
111
121
  readonly eachField: Field;
112
- constructor(field: ArrayFieldInfo, parent: NestField | undefined);
122
+ constructor(field: ArrayFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
113
123
  }
114
124
  export declare class RepeatedRecordField extends ArrayField {
115
125
  readonly field: RepeatedRecordFieldInfo;
116
126
  readonly fields: Field[];
117
127
  maxRecordCount: number;
118
- constructor(field: RepeatedRecordFieldInfo, parent: NestField | undefined);
128
+ constructor(field: RepeatedRecordFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
119
129
  fieldAtPath(path: string[]): Field;
120
130
  registerRecordCount(count: number): void;
121
131
  registerValueSetSize(fieldName: string, size: number): void;
@@ -129,14 +139,14 @@ export declare class RootField extends RepeatedRecordField {
129
139
  constructor(field: RepeatedRecordFieldInfo, metadata: {
130
140
  modelTag: Tag;
131
141
  queryTimezone: string | undefined;
132
- });
142
+ }, registry?: FieldRegistry);
133
143
  }
134
144
  export declare class RecordField extends FieldBase {
135
145
  readonly field: RecordFieldInfo;
136
146
  readonly fields: Field[];
137
147
  readonly fieldsByName: Record<string, Field>;
138
148
  readonly maxUniqueFieldValueCounts: Map<string, number>;
139
- constructor(field: RecordFieldInfo, parent: NestField | undefined);
149
+ constructor(field: RecordFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
140
150
  fieldAtPath(path: string[]): Field;
141
151
  private _fieldsWithOrder;
142
152
  get fieldsWithOrder(): SortableField[];
@@ -146,7 +156,7 @@ export declare class NumberField extends FieldBase {
146
156
  min: number | undefined;
147
157
  max: number | undefined;
148
158
  private _maxString;
149
- constructor(field: NumberFieldInfo, parent: NestField | undefined);
159
+ constructor(field: NumberFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
150
160
  registerValue(value: number): void;
151
161
  fieldAtPath(path: string[]): Field;
152
162
  get minNumber(): number | undefined;
@@ -158,7 +168,7 @@ export declare class DateField extends FieldBase {
158
168
  min: Date | undefined;
159
169
  max: Date | undefined;
160
170
  private _maxString;
161
- constructor(field: DateFieldInfo, parent: NestField | undefined);
171
+ constructor(field: DateFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
162
172
  get timeframe(): Malloy.DateTimeframe | undefined;
163
173
  registerValue(value: Date): void;
164
174
  get minValue(): Date | undefined;
@@ -172,7 +182,7 @@ export declare class TimestampField extends FieldBase {
172
182
  min: Date | undefined;
173
183
  max: Date | undefined;
174
184
  private _maxString;
175
- constructor(field: TimestampFieldInfo, parent: NestField | undefined);
185
+ constructor(field: TimestampFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
176
186
  get timeframe(): Malloy.TimestampTimeframe | undefined;
177
187
  registerValue(value: Date): void;
178
188
  get minValue(): Date | undefined;
@@ -184,7 +194,7 @@ export declare class StringField extends FieldBase {
184
194
  min: string | undefined;
185
195
  max: string | undefined;
186
196
  private _maxString;
187
- constructor(field: StringFieldInfo, parent: NestField | undefined);
197
+ constructor(field: StringFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
188
198
  registerValue(value: string): void;
189
199
  get minValue(): string | undefined;
190
200
  get maxValue(): string | undefined;
@@ -192,16 +202,16 @@ export declare class StringField extends FieldBase {
192
202
  }
193
203
  export declare class SQLNativeField extends FieldBase {
194
204
  readonly field: SQLNativeFieldInfo;
195
- constructor(field: SQLNativeFieldInfo, parent: NestField | undefined);
205
+ constructor(field: SQLNativeFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
196
206
  }
197
207
  export declare class JSONField extends FieldBase {
198
208
  readonly field: JSONFieldInfo;
199
- constructor(field: JSONFieldInfo, parent: NestField | undefined);
209
+ constructor(field: JSONFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
200
210
  }
201
211
  export declare class BooleanField extends FieldBase {
202
212
  readonly field: BooleanFieldInfo;
203
213
  private _maxString;
204
- constructor(field: BooleanFieldInfo, parent: NestField | undefined);
214
+ constructor(field: BooleanFieldInfo, parent: NestField | undefined, registry?: FieldRegistry);
205
215
  get maxString(): string | undefined;
206
216
  registerValue(value: boolean): void;
207
217
  }
@@ -258,13 +268,15 @@ export declare class RepeatedRecordCell extends ArrayCell {
258
268
  readonly parent: NestCell | undefined;
259
269
  readonly rows: RecordCell[];
260
270
  readonly fieldValueSets: Map<string, Set<CellValue>>;
261
- constructor(cell: Malloy.CellWithArrayCell, field: RepeatedRecordField, parent: NestCell | undefined);
271
+ private plugins;
272
+ private registry?;
273
+ constructor(cell: Malloy.CellWithArrayCell, field: RepeatedRecordField, parent: NestCell | undefined, plugins?: RenderPlugin[], registry?: FieldRegistry);
262
274
  get value(): RecordCell[];
263
275
  }
264
276
  export declare class RootCell extends RepeatedRecordCell {
265
277
  readonly cell: Malloy.CellWithArrayCell;
266
278
  readonly field: RootField;
267
- constructor(cell: Malloy.CellWithArrayCell, field: RootField);
279
+ constructor(cell: Malloy.CellWithArrayCell, field: RootField, plugins?: RenderPlugin[], registry?: FieldRegistry);
268
280
  }
269
281
  export type CellValue = string | number | boolean | Date | Cell[] | Record<string, Cell> | null;
270
282
  export declare class RecordCell extends CellBase {
@@ -345,4 +357,27 @@ export declare class BooleanCell extends CellBase {
345
357
  get value(): boolean;
346
358
  compareTo(other: Cell): 1 | 0 | -1;
347
359
  }
360
+ export declare enum FieldType {
361
+ Array = "array",
362
+ RepeatedRecord = "repeated_record",
363
+ Record = "record",
364
+ Number = "number",
365
+ Date = "date",
366
+ JSON = "json",
367
+ String = "string",
368
+ Timestamp = "timestamp",
369
+ Boolean = "boolean",
370
+ SQLNative = "sql_native"
371
+ }
372
+ export type RenderPluginInstance = {
373
+ name: string;
374
+ processData(field: NestField, cell: NestCell): void;
375
+ };
376
+ export type RenderPlugin<T extends RenderPluginInstance = {} & RenderPluginInstance> = {
377
+ name: string;
378
+ matches: (fieldTag: Tag, fieldType: FieldType) => boolean;
379
+ plugin: RenderPluginFactory<T>;
380
+ };
381
+ export type RenderPluginFactory<T extends RenderPluginInstance> = (field: Field) => T;
382
+ export declare function getFieldType(field: Field): FieldType;
348
383
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference path="../../src/vega.d.ts" />
2
1
  import type * as lite from 'vega-lite';
3
2
  import type { Config } from 'vega';
4
3
  export type DataStyles = {