@malloydata/render 0.0.79-dev230822044438 → 0.0.79

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.
@@ -1,9 +1,9 @@
1
1
  import * as lite from 'vega-lite';
2
- export declare type DataStyles = {
2
+ export type DataStyles = {
3
3
  [fieldName: string]: RenderDef;
4
4
  };
5
- export declare type ChartSize = 'small' | 'medium' | 'large';
6
- export declare type RenderDef = ({
5
+ export type ChartSize = 'small' | 'medium' | 'large';
6
+ export type RenderDef = ({
7
7
  renderer?: undefined;
8
8
  } & DataRenderOptions) | ({
9
9
  renderer: 'table';
@@ -61,7 +61,7 @@ export interface DataRenderOptions {
61
61
  };
62
62
  sheet?: DataStyles;
63
63
  }
64
- export declare type StyleDefaults = {
64
+ export type StyleDefaults = {
65
65
  size?: ChartSize;
66
66
  };
67
67
  export interface TableRenderOptions extends DataRenderOptions {
@@ -28,7 +28,7 @@ var Currency;
28
28
  Currency["Dollars"] = "usd";
29
29
  Currency["Euros"] = "euro";
30
30
  Currency["Pounds"] = "pound";
31
- })(Currency = exports.Currency || (exports.Currency = {}));
31
+ })(Currency || (exports.Currency = Currency = {}));
32
32
  var DataVolumeUnit;
33
33
  (function (DataVolumeUnit) {
34
34
  DataVolumeUnit["Bytes"] = "bytes";
@@ -36,7 +36,7 @@ var DataVolumeUnit;
36
36
  DataVolumeUnit["Megabytes"] = "mb";
37
37
  DataVolumeUnit["Gigabytes"] = "gb";
38
38
  DataVolumeUnit["Terabytes"] = "tb";
39
- })(DataVolumeUnit = exports.DataVolumeUnit || (exports.DataVolumeUnit = {}));
39
+ })(DataVolumeUnit || (exports.DataVolumeUnit = DataVolumeUnit = {}));
40
40
  var DurationUnit;
41
41
  (function (DurationUnit) {
42
42
  DurationUnit["Nanoseconds"] = "nanoseconds";
@@ -46,5 +46,5 @@ var DurationUnit;
46
46
  DurationUnit["Minutes"] = "minutes";
47
47
  DurationUnit["Hours"] = "hours";
48
48
  DurationUnit["Days"] = "days";
49
- })(DurationUnit = exports.DurationUnit || (exports.DurationUnit = {}));
49
+ })(DurationUnit || (exports.DurationUnit = DurationUnit = {}));
50
50
  //# sourceMappingURL=data_styles.js.map
@@ -3,7 +3,7 @@ import { DataArray, DataColumn, Field } from '@malloydata/malloy';
3
3
  import { Renderer } from '../renderer';
4
4
  import { RendererOptions } from '../renderer_types';
5
5
  import { ChartRenderOptions, StyleDefaults } from '../data_styles';
6
- declare type MappedRow = {
6
+ type MappedRow = {
7
7
  [p: string]: string | number | Date | undefined | null;
8
8
  };
9
9
  export declare abstract class HTMLChartRenderer implements Renderer {
@@ -50,13 +50,6 @@ const lite = __importStar(require("vega-lite"));
50
50
  const vega = __importStar(require("vega"));
51
51
  const utils_1 = require("../html/utils");
52
52
  class HTMLChartRenderer {
53
- constructor(document, styleDefaults, options, chartOptions = {}, timezone) {
54
- this.document = document;
55
- this.styleDefaults = styleDefaults;
56
- this.options = options;
57
- this.timezone = timezone;
58
- this.size = chartOptions.size || this.styleDefaults.size || 'medium';
59
- }
60
53
  mapData(data) {
61
54
  const mappedRows = [];
62
55
  for (const row of data) {
@@ -80,6 +73,13 @@ class HTMLChartRenderer {
80
73
  return { height: 175, width: 250 };
81
74
  }
82
75
  }
76
+ constructor(document, styleDefaults, options, chartOptions = {}, timezone) {
77
+ this.document = document;
78
+ this.styleDefaults = styleDefaults;
79
+ this.options = options;
80
+ this.timezone = timezone;
81
+ this.size = chartOptions.size || this.styleDefaults.size || 'medium';
82
+ }
83
83
  async render(table) {
84
84
  if (!table.isArray()) {
85
85
  throw new Error('Invalid type for chart renderer');
@@ -5,7 +5,7 @@ import { StyleDefaults, VegaRenderOptions } from '../data_styles';
5
5
  import { RendererOptions } from '../renderer_types';
6
6
  import { RendererFactory } from '../renderer_factory';
7
7
  import { Renderer } from '../renderer';
8
- declare type DataContainer = Array<unknown> | Record<string, unknown>;
8
+ type DataContainer = Array<unknown> | Record<string, unknown>;
9
9
  export declare const DEFAULT_SPEC: Partial<lite.TopLevelSpec>;
10
10
  export declare const vegaSpecs: Record<string, lite.TopLevelSpec>;
11
11
  export declare function isDataContainer(a: unknown): a is DataContainer;
@@ -101,7 +101,12 @@ const sizeLarge = {
101
101
  };
102
102
  // bar with text in the bars.
103
103
  const bar_SM = {
104
- ...exports.DEFAULT_SPEC,
104
+ // TODO, the following causes errors in Typescript 5.
105
+ // config is the only property in DEFAULT_SPEC, just
106
+ // reference that directly and ponder the madness of
107
+ // Typescript another day.
108
+ // ...DEFAULT_SPEC,
109
+ config: exports.DEFAULT_SPEC.config,
105
110
  encoding: {
106
111
  y: { field: '#{1}', type: 'nominal', axis: null, sort: null },
107
112
  },
@@ -1,6 +1,6 @@
1
1
  import { DataColumn, Tag } from '@malloydata/malloy';
2
2
  import { RendererOptions } from './renderer_types';
3
- export declare type ChildRenderers = {
3
+ export type ChildRenderers = {
4
4
  [fieldName: string]: Renderer;
5
5
  };
6
6
  export interface Renderer {
@@ -2,7 +2,7 @@ import { Explore, Field, Tag } from '@malloydata/malloy';
2
2
  import { Renderer } from './renderer';
3
3
  import { DataRenderOptions, RenderDef, StyleDefaults } from './data_styles';
4
4
  import { RendererOptions } from './renderer_types';
5
- declare type TagPropertyExtractor<T extends DataRenderOptions> = (options: T, tagObj: Tag | undefined) => void;
5
+ type TagPropertyExtractor<T extends DataRenderOptions> = (options: T, tagObj: Tag | undefined) => void;
6
6
  export declare abstract class RendererFactory<T extends DataRenderOptions> {
7
7
  readonly tagOptionExtractors: Record<string, TagPropertyExtractor<T>>;
8
8
  protected addExtractor(extractor: TagPropertyExtractor<T>, ...tags: string[]): void;
@@ -6,4 +6,4 @@ export interface RendererOptions {
6
6
  titleCase?: boolean;
7
7
  queryTimezone?: string;
8
8
  }
9
- export declare type DrillFunction = (drillQuery: string, target: HTMLElement, drillFilters: string[]) => void;
9
+ export type DrillFunction = (drillQuery: string, target: HTMLElement, drillFilters: string[]) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/render",
3
- "version": "0.0.79-dev230822044438",
3
+ "version": "0.0.79",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "prepublishOnly": "npm run build"
19
19
  },
20
20
  "dependencies": {
21
- "@malloydata/malloy": "^0.0.79-dev230822044438",
21
+ "@malloydata/malloy": "^0.0.79",
22
22
  "@types/luxon": "^2.4.0",
23
23
  "lodash": "^4.17.20",
24
24
  "luxon": "^2.4.0",