@malloydata/render 0.0.292 → 0.0.294

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.
Files changed (132) hide show
  1. package/.storybook/malloy-stories-indexer.ts +20 -7
  2. package/README.md +8 -0
  3. package/dist/module/api/json-schema-types.d.ts +36 -0
  4. package/dist/{api → module/api}/malloy-renderer.d.ts +4 -1
  5. package/dist/{api → module/api}/malloy-viz.d.ts +6 -3
  6. package/dist/module/api/plugin-types.d.ts +42 -0
  7. package/dist/{api → module/api}/types.d.ts +5 -2
  8. package/dist/module/component/bar-chart/generate-bar_chart-vega-spec.d.ts +4 -0
  9. package/dist/{component → module/component}/bar-chart/get-bar_chart-settings.d.ts +3 -3
  10. package/dist/{component → module/component}/bar-chart/get-custom-tooltips-entries.d.ts +2 -2
  11. package/dist/{component → module/component}/chart/chart-dev-tool.d.ts +2 -2
  12. package/dist/{component → module/component/chart}/chart-layout-settings.d.ts +4 -4
  13. package/dist/module/component/chart/chart-v2.d.ts +23 -0
  14. package/dist/{component → module/component}/chart/chart.d.ts +3 -3
  15. package/dist/{component → module/component}/chart/default-chart-tooltip.d.ts +1 -1
  16. package/dist/{component → module/component}/dashboard/dashboard.d.ts +1 -1
  17. package/dist/{component → module/component}/legacy-charts/legacy_chart.d.ts +1 -1
  18. package/dist/{component → module/component}/malloy-modal/malloy-modal.d.ts +1 -1
  19. package/dist/{component → module/component}/render-image.d.ts +1 -1
  20. package/dist/{component → module/component}/render-link.d.ts +1 -1
  21. package/dist/{component → module/component}/render-list.d.ts +1 -1
  22. package/dist/{component → module/component}/render-numeric-field.d.ts +1 -1
  23. package/dist/{component → module/component}/render-result-metadata.d.ts +9 -6
  24. package/dist/{component → module/component}/render-time.d.ts +1 -1
  25. package/dist/{component → module/component}/render.d.ts +5 -2
  26. package/dist/{component → module/component/renderer}/apply-renderer.d.ts +1 -1
  27. package/dist/module/component/renderer/plugin-render-container.d.ts +8 -0
  28. package/dist/module/component/result-context.d.ts +4 -0
  29. package/dist/{component → module/component}/result-store/result-store.d.ts +3 -3
  30. package/dist/{component → module/component}/table/table-context.d.ts +3 -4
  31. package/dist/{component → module/component}/table/table-layout.d.ts +2 -2
  32. package/dist/{component → module/component}/table/table.d.ts +2 -2
  33. package/dist/{component → module/component}/tag-utils.d.ts +1 -1
  34. package/dist/{component → module/component}/tooltip/tooltip.d.ts +1 -1
  35. package/dist/{component → module/component}/types.d.ts +13 -4
  36. package/dist/{component → module/component}/util.d.ts +1 -1
  37. package/dist/{component → module/component}/vega/base-vega-config.d.ts +1 -1
  38. package/dist/{component → module/component}/vega/measure-axis.d.ts +2 -2
  39. package/dist/{component → module/component}/vega/vega-chart.d.ts +2 -4
  40. package/dist/{component → module/component}/vega/vega-utils.d.ts +1 -1
  41. package/dist/{component → module/component}/vega-types.d.ts +2 -2
  42. package/dist/{data_tree → module/data_tree}/cells/atomic.d.ts +3 -3
  43. package/dist/{data_tree → module/data_tree}/cells/base.d.ts +3 -4
  44. package/dist/{data_tree → module/data_tree}/cells/index.d.ts +2 -2
  45. package/dist/{data_tree → module/data_tree}/cells/nest.d.ts +9 -12
  46. package/dist/{data_tree → module/data_tree}/drilling.d.ts +2 -2
  47. package/dist/{data_tree → module/data_tree}/fields/atomic.d.ts +12 -12
  48. package/dist/{data_tree → module/data_tree}/fields/base.d.ts +9 -13
  49. package/dist/{data_tree → module/data_tree}/fields/index.d.ts +3 -4
  50. package/dist/{data_tree → module/data_tree}/fields/nest.d.ts +9 -11
  51. package/dist/{data_tree → module/data_tree}/index.d.ts +3 -4
  52. package/dist/{data_tree → module/data_tree}/types.d.ts +2 -7
  53. package/dist/{data_tree → module/data_tree}/utils.d.ts +8 -5
  54. package/dist/{html → module/html}/area_sparkline.d.ts +5 -5
  55. package/dist/{html → module/html}/bar_chart.d.ts +4 -4
  56. package/dist/{html → module/html}/bar_sparkline.d.ts +5 -5
  57. package/dist/{html → module/html}/boolean.d.ts +4 -4
  58. package/dist/{html → module/html}/bytes.d.ts +4 -4
  59. package/dist/{html → module/html}/cartesian_chart.d.ts +2 -2
  60. package/dist/{html → module/html}/chart.d.ts +4 -4
  61. package/dist/{html → module/html}/column_sparkline.d.ts +5 -5
  62. package/dist/{html → module/html}/container.d.ts +5 -6
  63. package/dist/{html → module/html}/currency.d.ts +4 -4
  64. package/dist/{html → module/html}/dashboard.d.ts +2 -2
  65. package/dist/{html → module/html}/data_styles.d.ts +1 -1
  66. package/dist/{html → module/html}/data_volume.d.ts +4 -4
  67. package/dist/{html → module/html}/date.d.ts +4 -4
  68. package/dist/{html → module/html}/duration.d.ts +4 -5
  69. package/dist/{html → module/html}/html_view.d.ts +8 -5
  70. package/dist/{html → module/html}/image.d.ts +4 -4
  71. package/dist/{html → module/html}/json.d.ts +4 -4
  72. package/dist/{html → module/html}/line_chart.d.ts +4 -4
  73. package/dist/{html → module/html}/link.d.ts +4 -4
  74. package/dist/{html → module/html}/list.d.ts +2 -2
  75. package/dist/{html → module/html}/list_detail.d.ts +1 -1
  76. package/dist/{html → module/html}/main_renderer_factory.d.ts +6 -6
  77. package/dist/{html → module/html}/number.d.ts +4 -4
  78. package/dist/{html → module/html}/percent.d.ts +4 -4
  79. package/dist/{html → module/html}/point_map.d.ts +5 -5
  80. package/dist/{html → module/html}/renderer.d.ts +3 -3
  81. package/dist/{html → module/html}/renderer_factory.d.ts +5 -5
  82. package/dist/{html → module/html}/renderer_types.d.ts +2 -2
  83. package/dist/{html → module/html}/scatter_chart.d.ts +4 -4
  84. package/dist/{html → module/html}/segment_map.d.ts +5 -5
  85. package/dist/{html → module/html}/shape_map.d.ts +5 -5
  86. package/dist/{html → module/html}/sparkline.d.ts +5 -5
  87. package/dist/{html → module/html}/table.d.ts +3 -3
  88. package/dist/{html → module/html}/text.d.ts +4 -4
  89. package/dist/{html → module/html}/unsupported.d.ts +4 -4
  90. package/dist/{html → module/html}/utils.d.ts +3 -3
  91. package/dist/{html → module/html}/vega_spec.d.ts +5 -5
  92. package/dist/module/index.d.ts +11 -0
  93. package/dist/module/index.mjs +34411 -32555
  94. package/dist/module/index.umd.js +425 -403
  95. package/dist/module/plugins/bar-chart/bar-chart-plugin.d.ts +14 -0
  96. package/dist/module/plugins/bar-chart/bar-chart-settings.d.ts +49 -0
  97. package/dist/module/plugins/bar-chart/generate-bar_chart-vega-spec.d.ts +4 -0
  98. package/dist/module/plugins/bar-chart/get-bar_chart-settings.d.ts +5 -0
  99. package/dist/module/plugins/bar-chart/settings-to-tag.d.ts +3 -0
  100. package/dist/module/plugins/dummy-dom-plugin.d.ts +8 -0
  101. package/dist/module/plugins/dummy-plugin.d.ts +8 -0
  102. package/dist/module/plugins/index.d.ts +3 -0
  103. package/dist/module/plugins/line-chart/generate-line_chart-vega-spec.d.ts +17 -0
  104. package/dist/module/plugins/line-chart/get-line_chart-settings.d.ts +5 -0
  105. package/dist/module/plugins/line-chart/line-chart-plugin.d.ts +21 -0
  106. package/dist/module/plugins/line-chart/line-chart-settings.d.ts +52 -0
  107. package/dist/module/plugins/line-chart/settings-to-tag.d.ts +3 -0
  108. package/dist/module/registry/types.d.ts +15 -0
  109. package/dist/module/render-field-metadata.d.ts +18 -0
  110. package/dist/{stories → module/stories}/themes.stories.d.ts +1 -2
  111. package/dist/{stories → module/stories}/util.d.ts +4 -4
  112. package/dist/{stories → module/stories}/vega-config-override.stories.d.ts +1 -2
  113. package/dist/module/stories/wrapped-table.stories.d.ts +9 -0
  114. package/dist/{util.d.ts → module/util.d.ts} +11 -4
  115. package/package.json +10 -10
  116. package/{vite.config.base.ts → vite.config.base.mts} +11 -1
  117. package/{vite.config.ts → vite.config.mts} +1 -1
  118. package/dist/component/bar-chart/generate-bar_chart-vega-spec.d.ts +0 -4
  119. package/dist/component/line-chart/generate-line_chart-vega-spec.d.ts +0 -4
  120. package/dist/component/line-chart/get-line_chart-settings.d.ts +0 -11
  121. package/dist/component/result-context.d.ts +0 -4
  122. package/dist/data_tree/plugins.d.ts +0 -14
  123. package/dist/index.d.ts +0 -7
  124. package/dist/plugins/line-chart-series-plugin.d.ts +0 -7
  125. package/dist/render-field-metadata.d.ts +0 -33
  126. /package/dist/{component → module/component}/chart/debug_icon.d.ts +0 -0
  127. /package/dist/{component → module/component}/default-settings.d.ts +0 -0
  128. /package/dist/{component → module/component}/error-message/error-message.d.ts +0 -0
  129. /package/dist/{component → module/component}/vega/merge-vega-configs.d.ts +0 -0
  130. /package/dist/{component → module/component}/vega/vega-expr-addons.d.ts +0 -0
  131. /package/dist/{html → module/html}/index.d.ts +0 -0
  132. /package/dist/{html → module/html}/state_codes.d.ts +0 -0
@@ -0,0 +1,14 @@
1
+ import { RenderPluginFactory, CoreVizPluginInstance } from '../../api/plugin-types';
2
+ import { NestField } from '../../data_tree';
3
+ import { BarChartSettings } from './get-bar_chart-settings';
4
+ export interface BarChartPluginInstance extends CoreVizPluginInstance<BarChartPluginMetadata> {
5
+ getTopNSeries?: (maxSeries: number) => (string | number | boolean)[];
6
+ field: NestField;
7
+ }
8
+ interface BarChartPluginMetadata {
9
+ type: 'bar';
10
+ field: NestField;
11
+ settings: BarChartSettings;
12
+ }
13
+ export declare const BarChartPluginFactory: RenderPluginFactory<BarChartPluginInstance>;
14
+ export {};
@@ -0,0 +1,49 @@
1
+ import { Channel, SeriesChannel, YChannel } from '../../component/types';
2
+ import { JSONSchemaObject, JSONSchemaArray, JSONSchemaString, JSONSchemaBoolean, JSONSchemaOneOf } from '../../api/json-schema-types';
3
+ export interface BarChartSettings extends Record<string, unknown> {
4
+ xChannel: Channel;
5
+ yChannel: YChannel;
6
+ seriesChannel: SeriesChannel;
7
+ isStack: boolean;
8
+ interactive: boolean;
9
+ hideReferences: boolean;
10
+ disableEmbedded: boolean;
11
+ }
12
+ export declare const defaultBarChartSettings: BarChartSettings;
13
+ export interface IBarChartSettingsSchema extends JSONSchemaObject {
14
+ properties: {
15
+ xChannel: JSONSchemaObject & {
16
+ properties: {
17
+ fields: JSONSchemaArray & {
18
+ items: JSONSchemaString;
19
+ };
20
+ type: JSONSchemaString;
21
+ independent: JSONSchemaString;
22
+ };
23
+ };
24
+ yChannel: JSONSchemaObject & {
25
+ properties: {
26
+ fields: JSONSchemaArray & {
27
+ items: JSONSchemaString;
28
+ };
29
+ type: JSONSchemaString;
30
+ independent: JSONSchemaBoolean;
31
+ };
32
+ };
33
+ seriesChannel: JSONSchemaObject & {
34
+ properties: {
35
+ fields: JSONSchemaArray & {
36
+ items: JSONSchemaString;
37
+ };
38
+ type: JSONSchemaString;
39
+ independent: JSONSchemaString;
40
+ limit: JSONSchemaOneOf;
41
+ };
42
+ };
43
+ isStack: JSONSchemaBoolean;
44
+ interactive: JSONSchemaBoolean;
45
+ hideReferences: JSONSchemaBoolean;
46
+ disableEmbedded: JSONSchemaBoolean;
47
+ };
48
+ }
49
+ export declare const barChartSettingsSchema: IBarChartSettingsSchema;
@@ -0,0 +1,4 @@
1
+ import { VegaChartProps } from '../../component/types';
2
+ import { RenderMetadata } from '../../component/render-result-metadata';
3
+ import { BarChartPluginInstance } from './bar-chart-plugin';
4
+ export declare function generateBarChartVegaSpecV2(metadata: RenderMetadata, plugin: BarChartPluginInstance): VegaChartProps;
@@ -0,0 +1,5 @@
1
+ import { Tag } from '@malloydata/malloy-tag';
2
+ import { NestField } from '../../data_tree';
3
+ import { BarChartSettings } from './bar-chart-settings';
4
+ export type { BarChartSettings };
5
+ export declare function getBarChartSettings(explore: NestField, tagOverride?: Tag): BarChartSettings;
@@ -0,0 +1,3 @@
1
+ import { Tag } from '@malloydata/malloy-tag';
2
+ import { BarChartSettings } from './bar-chart-settings';
3
+ export declare function barChartSettingsToTag(settings: BarChartSettings): Tag;
@@ -0,0 +1,8 @@
1
+ import { RenderPluginFactory, DOMRenderPluginInstance } from '../api/plugin-types';
2
+ interface DummyDOMPluginMetadata {
3
+ type: 'dummy_dom';
4
+ fieldName: string;
5
+ }
6
+ type DummyDOMPluginInstance = DOMRenderPluginInstance<DummyDOMPluginMetadata>;
7
+ export declare const DummyDOMPluginFactory: RenderPluginFactory<DummyDOMPluginInstance>;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ import { RenderPluginFactory, SolidJSRenderPluginInstance } from '../api/plugin-types';
2
+ interface DummyPluginMetadata {
3
+ type: 'dummy';
4
+ fieldName: string;
5
+ }
6
+ type DummyPluginInstance = SolidJSRenderPluginInstance<DummyPluginMetadata>;
7
+ export declare const DummyPluginFactory: RenderPluginFactory<DummyPluginInstance>;
8
+ export {};
@@ -0,0 +1,3 @@
1
+ export { type ILineChartSettingsSchema, lineChartSettingsSchema, defaultLineChartSettings, type LineChartSettings, } from './line-chart/line-chart-settings';
2
+ export { type IBarChartSettingsSchema, barChartSettingsSchema, defaultBarChartSettings, type BarChartSettings, } from './bar-chart/bar-chart-settings';
3
+ export { BarChartPluginFactory, type BarChartPluginInstance, } from './bar-chart/bar-chart-plugin';
@@ -0,0 +1,17 @@
1
+ import { VegaChartProps } from '../../component/types';
2
+ import { RenderMetadata } from '../../component/render-result-metadata';
3
+ import { LineChartPluginInstance } from './line-chart-plugin';
4
+ export interface LineChartSettings {
5
+ xChannel: {
6
+ fields: string[];
7
+ };
8
+ yChannel: {
9
+ fields: string[];
10
+ };
11
+ seriesChannel: {
12
+ fields: string[];
13
+ };
14
+ zeroBaseline: boolean;
15
+ interactive: boolean;
16
+ }
17
+ export declare function generateLineChartVegaSpecV2(metadata: RenderMetadata, plugin: LineChartPluginInstance): VegaChartProps;
@@ -0,0 +1,5 @@
1
+ import { Tag } from '@malloydata/malloy-tag';
2
+ import { NestField } from '../../data_tree';
3
+ import { LineChartSettings, LineChartPluginOptions } from './line-chart-settings';
4
+ export type { LineChartSettings, LineChartPluginOptions };
5
+ export declare function getLineChartSettings(explore: NestField, tagOverride?: Tag, jsDefaults?: Partial<LineChartSettings>, modelTag?: Tag): LineChartSettings;
@@ -0,0 +1,21 @@
1
+ import { RenderPluginFactory, CoreVizPluginInstance } from '../../api/plugin-types';
2
+ import { Field, NestField } from '../../data_tree';
3
+ import { LineChartSettings } from './get-line_chart-settings';
4
+ interface LineChartPluginMetadata {
5
+ type: 'line';
6
+ field: NestField;
7
+ settings: LineChartSettings;
8
+ }
9
+ interface SeriesStats {
10
+ sum: number;
11
+ count: number;
12
+ avg: number;
13
+ }
14
+ interface LineChartPluginInstance extends CoreVizPluginInstance<LineChartPluginMetadata> {
15
+ field: NestField;
16
+ seriesStats: Map<string, SeriesStats>;
17
+ getTopNSeries: (maxSeries: number) => (string | number | boolean)[];
18
+ syntheticSeriesField?: Field;
19
+ }
20
+ export declare const LineChartPluginFactory: RenderPluginFactory<LineChartPluginInstance>;
21
+ export type { LineChartPluginInstance };
@@ -0,0 +1,52 @@
1
+ import { Channel, SeriesChannel, YChannel } from '../../component/types';
2
+ import { JSONSchemaObject, JSONSchemaArray, JSONSchemaString, JSONSchemaBoolean, JSONSchemaOneOf, JSONSchemaFieldString } from '../../api/json-schema-types';
3
+ export interface LineChartSettings extends Record<string, unknown> {
4
+ xChannel: Channel;
5
+ yChannel: YChannel;
6
+ seriesChannel: SeriesChannel;
7
+ zeroBaseline: boolean;
8
+ interactive: boolean;
9
+ disableEmbedded: boolean;
10
+ mode?: 'yoy' | 'normal';
11
+ }
12
+ export interface LineChartPluginOptions {
13
+ defaults?: Partial<LineChartSettings>;
14
+ }
15
+ export declare const defaultLineChartSettings: LineChartSettings;
16
+ export interface ILineChartSettingsSchema extends JSONSchemaObject {
17
+ properties: {
18
+ xChannel: JSONSchemaObject & {
19
+ properties: {
20
+ fields: JSONSchemaArray & {
21
+ items: JSONSchemaFieldString;
22
+ };
23
+ type: JSONSchemaString;
24
+ independent: JSONSchemaString;
25
+ };
26
+ };
27
+ yChannel: JSONSchemaObject & {
28
+ properties: {
29
+ fields: JSONSchemaArray & {
30
+ items: JSONSchemaFieldString;
31
+ };
32
+ type: JSONSchemaString;
33
+ independent: JSONSchemaBoolean;
34
+ };
35
+ };
36
+ seriesChannel: JSONSchemaObject & {
37
+ properties: {
38
+ fields: JSONSchemaArray & {
39
+ items: JSONSchemaFieldString;
40
+ };
41
+ type: JSONSchemaString;
42
+ independent: JSONSchemaString;
43
+ limit: JSONSchemaOneOf;
44
+ };
45
+ };
46
+ zeroBaseline: JSONSchemaBoolean;
47
+ interactive: JSONSchemaBoolean;
48
+ disableEmbedded: JSONSchemaBoolean;
49
+ mode: JSONSchemaString;
50
+ };
51
+ }
52
+ export declare const lineChartSettingsSchema: ILineChartSettingsSchema;
@@ -0,0 +1,3 @@
1
+ import { Tag } from '@malloydata/malloy-tag';
2
+ import { LineChartSettings } from './line-chart-settings';
3
+ export declare function lineChartSettingsToTag(settings: LineChartSettings): Tag;
@@ -0,0 +1,15 @@
1
+ import { Field } from '../data_tree';
2
+ import { RenderPluginInstance } from '../api/plugin-types';
3
+ export type RenderFieldProps<T = unknown> = {
4
+ field: Field;
5
+ renderAs: string;
6
+ sizingStrategy: string;
7
+ properties: T;
8
+ errors: Error[];
9
+ };
10
+ export type RenderFieldRegistryEntry = {
11
+ field: Field;
12
+ renderProperties: RenderFieldProps;
13
+ plugins: RenderPluginInstance[];
14
+ };
15
+ export type RenderFieldRegistry = Map<string, RenderFieldRegistryEntry>;
@@ -0,0 +1,18 @@
1
+ import { Field, RootField } from './data_tree';
2
+ import { RenderPluginFactory, RenderPluginInstance } from './api/plugin-types';
3
+ import { RenderFieldRegistryEntry } from './registry/types';
4
+ import type * as Malloy from '@malloydata/malloy-interfaces';
5
+ export declare class RenderFieldMetadata {
6
+ private registry;
7
+ private rootField;
8
+ private pluginRegistry;
9
+ private pluginOptions;
10
+ constructor(result: Malloy.Result, pluginRegistry?: RenderPluginFactory[], pluginOptions?: Record<string, unknown>);
11
+ private instantiatePluginsForField;
12
+ private registerFields;
13
+ private populateRenderFieldProperties;
14
+ getAllFields(): Field[];
15
+ getRootField(): RootField;
16
+ getPluginsForField(fieldKey: string): RenderPluginInstance[];
17
+ getFieldEntry(fieldKey: string): RenderFieldRegistryEntry | undefined;
18
+ }
@@ -1,5 +1,4 @@
1
- import type { Meta } from '@storybook/html';
2
- import './themes.css';
1
+ import { Meta } from '@storybook/html';
3
2
  declare const meta: Meta;
4
3
  export default meta;
5
4
  export declare const ModelThemeOverride: {
@@ -1,6 +1,6 @@
1
- import type { LoaderFunction, Args } from '@storybook/types';
2
- import type { HtmlRenderer } from '@storybook/html';
3
- import type { DuckDBWASMConnection } from '@malloydata/db-duckdb/wasm';
1
+ import { LoaderFunction, Args } from '@storybook/types';
2
+ import { HtmlRenderer } from '@storybook/html';
3
+ import { DuckDBWASMConnection } from '@malloydata/db-duckdb/wasm';
4
4
  import type * as Malloy from '@malloydata/malloy-interfaces';
5
5
  export type QueryOptions = {
6
6
  script: string;
@@ -12,7 +12,7 @@ export declare function createLoader(script: string): LoaderFunction<HtmlRendere
12
12
  export declare function loadModel({ script, connection, }: {
13
13
  script: string;
14
14
  connection: Promise<DuckDBWASMConnection>;
15
- }): Promise<import("@malloydata/malloy").ModelMaterializer>;
15
+ }): Promise<import('@malloydata/malloy').ModelMaterializer>;
16
16
  export declare function runQuery({ script, source, view, connection, }: QueryOptions): Promise<Malloy.Result>;
17
17
  type RenderOptions = QueryOptions & {
18
18
  classes?: '';
@@ -1,5 +1,4 @@
1
- import type { Meta } from '@storybook/html';
2
- import './themes.css';
1
+ import { Meta } from '@storybook/html';
3
2
  declare const meta: Meta;
4
3
  export default meta;
5
4
  export declare const BarChart: {
@@ -0,0 +1,9 @@
1
+ import { Meta } from '@storybook/html';
2
+ declare const meta: Meta;
3
+ export default meta;
4
+ export declare const WrappedTable: {
5
+ args: {
6
+ source: string;
7
+ view: string;
8
+ };
9
+ };
@@ -1,9 +1,10 @@
1
- import type * as Malloy from '@malloydata/malloy-interfaces';
2
1
  import { Tag } from '@malloydata/malloy-tag';
3
2
  import { DurationUnit } from './html/data_styles';
4
- import type { Cell, NestField } from './data_tree';
5
- import { Field } from './data_tree';
3
+ import { Cell, NestField, Field } from './data_tree';
4
+ import type * as Malloy from '@malloydata/malloy-interfaces';
6
5
  export declare const NULL_SYMBOL = "\u2205";
6
+ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
7
+ export declare function deepMerge<T extends Record<string, unknown>[]>(...sources: [...T]): UnionToIntersection<T[number]>;
7
8
  export declare function tagFromAnnotations(annotations: Malloy.Annotation[] | undefined, prefix?: string): Tag;
8
9
  export declare function renderTagFromAnnotations(annotations: Malloy.Annotation[] | undefined): Tag;
9
10
  export declare function getTextWidthCanvas(text: string, font: string, canvasToUse?: HTMLCanvasElement): number;
@@ -17,7 +18,13 @@ export declare function formatTimeUnit(value: number, unit: DurationUnit, option
17
18
  export declare function getText(field: Field, value: number, options: {
18
19
  durationUnit?: string;
19
20
  }): string | null;
20
- export declare function renderTimeString(value: Date, isDate: boolean, timeframe?: string): string;
21
+ export interface RenderTimeStringOptions {
22
+ isDate?: boolean;
23
+ timeframe?: string;
24
+ extractFormat?: 'month-day' | 'quarter' | 'month' | 'week' | 'day';
25
+ }
26
+ export declare function renderTimeString(value: Date, options?: RenderTimeStringOptions): string;
21
27
  export declare function valueToMalloy(value: Cell): string;
22
28
  export declare function walkFields(e: NestField, cb: (f: Field) => void): void;
23
29
  export declare function notUndefined<T>(x: T | undefined): x is T;
30
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@malloydata/render",
3
- "version": "0.0.292",
3
+ "version": "0.0.294",
4
4
  "license": "MIT",
5
5
  "main": "dist/module/index.umd.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,26 +14,24 @@
14
14
  },
15
15
  "exports": {
16
16
  ".": {
17
- "types": "./dist/index.d.ts",
17
+ "types": "./dist/module/index.d.ts",
18
18
  "default": "./dist/module/index.umd.js"
19
19
  }
20
20
  },
21
21
  "scripts": {
22
22
  "test": "jest --config=../../jest.config.js",
23
- "build": "npm run build-types && npm run build-source",
24
23
  "clean": "tsc --build --clean",
25
24
  "prepublishOnly": "npm run build",
26
25
  "storybook": "rm -rf ./node_modules/.cache && storybook dev -p 6006",
27
26
  "storybook-windows": "del /s /q .\\node_modules\\.cache && storybook dev -p 6006",
28
27
  "build-storybook": "storybook build",
29
- "build-source": "vite build --outDir 'dist/module' --config vite.config.ts",
30
- "build-types": "tsc --build --declaration --emitDeclarationOnly",
28
+ "build": "vite build --outDir 'dist/module' --config vite.config.mts",
31
29
  "generate-flow": "ts-node ../../scripts/gen-flow.ts"
32
30
  },
33
31
  "dependencies": {
34
- "@malloydata/malloy": "0.0.292",
35
- "@malloydata/malloy-interfaces": "0.0.292",
36
- "@malloydata/malloy-tag": "0.0.292",
32
+ "@malloydata/malloy": "0.0.294",
33
+ "@malloydata/malloy-interfaces": "0.0.294",
34
+ "@malloydata/malloy-tag": "0.0.294",
37
35
  "@tanstack/solid-virtual": "^3.10.4",
38
36
  "lodash": "^4.17.20",
39
37
  "luxon": "^2.4.0",
@@ -44,7 +42,7 @@
44
42
  "vega-lite": "^5.2.0"
45
43
  },
46
44
  "devDependencies": {
47
- "@malloydata/db-duckdb": "0.0.292",
45
+ "@malloydata/db-duckdb": "0.0.294",
48
46
  "@storybook/addon-essentials": "^8.5.8",
49
47
  "@storybook/addon-interactions": "^8.5.8",
50
48
  "@storybook/addon-links": "^8.5.8",
@@ -60,6 +58,8 @@
60
58
  "esbuild": "0.19.11",
61
59
  "storybook": "^8.5.8",
62
60
  "vite": "^5.1.5",
63
- "vite-plugin-solid": "^2.10.1"
61
+ "vite-plugin-dts": "^4.5.4",
62
+ "vite-plugin-solid": "^2.10.1",
63
+ "vite-tsconfig-paths": "^5.1.4"
64
64
  }
65
65
  }
@@ -1,10 +1,19 @@
1
1
  import type {PluginOption} from 'vite';
2
2
  import {defineConfig} from 'vite';
3
3
  import solidPlugin from 'vite-plugin-solid';
4
+ import tsconfigPaths from 'vite-tsconfig-paths';
5
+ import dts from 'vite-plugin-dts';
4
6
  import path from 'path';
5
7
 
6
8
  export default defineConfig({
7
- plugins: [viteStripMalloyDevToolsPlugin(), solidPlugin()],
9
+ plugins: [
10
+ viteStripMalloyDevToolsPlugin(),
11
+ solidPlugin(),
12
+ tsconfigPaths(),
13
+ dts({
14
+ insertTypesEntry: true,
15
+ }),
16
+ ],
8
17
  optimizeDeps: {
9
18
  include: ['@malloydata/malloy'],
10
19
  },
@@ -21,6 +30,7 @@ export default defineConfig({
21
30
  commonjsOptions: {
22
31
  include: [/malloy/, /node_modules/],
23
32
  },
33
+ sourcemap: process.env.NODE_ENV === 'development',
24
34
  },
25
35
  define: {
26
36
  'process.env': {},
@@ -1,5 +1,5 @@
1
1
  import {mergeConfig} from 'vite';
2
- import baseViteConfig from './vite.config.base';
2
+ import baseViteConfig from './vite.config.base.mts';
3
3
 
4
4
  export default mergeConfig(baseViteConfig, {
5
5
  build: {
@@ -1,4 +0,0 @@
1
- import type { VegaChartProps } from '../types';
2
- import type { RepeatedRecordField } from '../../data_tree';
3
- import type { RenderMetadata } from '../render-result-metadata';
4
- export declare function generateBarChartVegaSpec(explore: RepeatedRecordField, metadata: RenderMetadata): VegaChartProps;
@@ -1,4 +0,0 @@
1
- import type { VegaChartProps } from '../types';
2
- import type { NestField } from '../../data_tree';
3
- import type { RenderMetadata } from '../render-result-metadata';
4
- export declare function generateLineChartVegaSpec(explore: NestField, metadata: RenderMetadata): VegaChartProps;
@@ -1,11 +0,0 @@
1
- import type { Tag } from '@malloydata/malloy-tag';
2
- import type { Channel } from '../types';
3
- import type { NestField } from '../../data_tree';
4
- export type LineChartSettings = {
5
- xChannel: Channel;
6
- yChannel: Channel;
7
- seriesChannel: Channel;
8
- zeroBaseline: boolean;
9
- interactive: boolean;
10
- };
11
- export declare function getLineChartSettings(explore: NestField, tagOverride?: Tag): LineChartSettings;
@@ -1,4 +0,0 @@
1
- import type { Accessor } from 'solid-js';
2
- import type { RenderMetadata } from './render-result-metadata';
3
- export declare const ResultContext: import("solid-js").Context<Accessor<RenderMetadata> | undefined>;
4
- export declare const useResultContext: () => RenderMetadata;
@@ -1,14 +0,0 @@
1
- import type { Tag } from '@malloydata/malloy-tag';
2
- import type { Field, NestField } from './fields';
3
- import type { NestCell } from './cells';
4
- import type { FieldType } from './types';
5
- export type RenderPluginInstance = {
6
- name: string;
7
- processData(field: NestField, cell: NestCell): void;
8
- };
9
- export type RenderPlugin<T extends RenderPluginInstance = RenderPluginInstance> = {
10
- name: string;
11
- matches: (fieldTag: Tag, fieldType: FieldType) => boolean;
12
- plugin: RenderPluginFactory<T>;
13
- };
14
- export type RenderPluginFactory<T extends RenderPluginInstance> = (field: Field) => T;
package/dist/index.d.ts DELETED
@@ -1,7 +0,0 @@
1
- export { HTMLView, JSONView } from './html/html_view';
2
- export * from './html/data_styles';
3
- export type { MalloyRenderProps } from './component/render';
4
- export { MalloyRenderer } from '@/api/malloy-renderer';
5
- export type { MalloyViz } from '@/api/malloy-viz';
6
- export type { MalloyRendererOptions, RenderFieldMetadata } from '@/api/types';
7
- export type { DrillData, MalloyClickEventPayload, TableConfig, DashboardConfig, VegaConfigHandler, } from '@/component/types';
@@ -1,7 +0,0 @@
1
- import type { RenderPlugin, RenderPluginInstance } from '../data_tree';
2
- type LineChartPluginInstance = {
3
- getTopNSeries: (n: number) => (string | number | boolean)[];
4
- } & RenderPluginInstance;
5
- export declare const LineChartSeriesPluginFactory: RenderPlugin<LineChartPluginInstance>;
6
- export type LineChartSeriesPluginInstance = ReturnType<typeof LineChartSeriesPluginFactory.plugin>;
7
- export {};
@@ -1,33 +0,0 @@
1
- import { type Field, RootField, RecordField, ArrayField, type NestField, RepeatedRecordField, type FieldRegistry as DataTreeFieldRegistry } from '@/data_tree';
2
- import type * as Malloy from '@malloydata/malloy-interfaces';
3
- type RenderFieldProps<T = unknown> = {
4
- field: Field;
5
- renderAs: string;
6
- sizingStrategy: string;
7
- properties: T;
8
- errors: Error[];
9
- };
10
- type RenderFieldRegistryEntry = {
11
- field: Field;
12
- renderProperties: RenderFieldProps;
13
- plugins: never[];
14
- };
15
- interface FieldRegistry extends DataTreeFieldRegistry {
16
- rendererFields: Map<string, RenderFieldRegistryEntry>;
17
- }
18
- export declare class RenderFieldMetadata {
19
- private registry;
20
- private legacyRegistry;
21
- private rootField;
22
- constructor(result: Malloy.Result);
23
- private registerFields;
24
- private populateRenderFieldProperties;
25
- getField(path: string[]): Field | undefined;
26
- getAllFields(): Field[];
27
- getRootField(): RootField;
28
- getFieldsByType<T extends Field, F extends Malloy.DimensionInfo>(type: new (field: F, parent: NestField | undefined, registry?: FieldRegistry) => T): T[];
29
- getRecordFields(): RecordField[];
30
- getArrayFields(): ArrayField[];
31
- getRepeatedRecordFields(): RepeatedRecordField[];
32
- }
33
- export {};
File without changes
File without changes