@malloydata/render 0.0.379 → 0.0.381

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/DEVELOPING.md CHANGED
@@ -21,16 +21,21 @@ $ npm run --prefix packages/malloy-render storybook-windows
21
21
 
22
22
  Then navigate to the URL provided. In this storybook, you can navigate between different stories that render Malloy queries from the Malloy source code.
23
23
 
24
- ### Tips
24
+ ### Iteration rules
25
25
 
26
- This storybook does not hot reload, so you need to reload the page when:
26
+ Storybook does not use hot module replacement (HMR), but the Vite dev server stays running while you work. Most changes are picked up by a browser page reload; only boot-time artifacts require restarting Storybook.
27
27
 
28
- - you make changes to malloy-render source code
29
- - you add a new story
28
+ | You change… | What you do |
29
+ |---|---|
30
+ | `.ts` / `.tsx` / `.css` in `src/` | Reload the browser page — Vite serves source directly, so changes are picked up on refresh |
31
+ | A `.stories.malloy` file | Restart Storybook — the story indexer runs once at boot |
32
+ | `.storybook/` config or `registered_data.json` | Restart Storybook |
33
+ | A file in `src/stories/static/data/` | Reload the browser page |
34
+ | Anything in `packages/malloy/src/` (Malloy core) | Restart Storybook |
30
35
 
31
- If you make changes to the malloy core package, you need to relaunch the storybook.
36
+ You do **not** need to run `npm run build` as part of normal iteration. `npm run build` produces the published library bundles (`dist/module/index.umd.js`, `index.mjs`), which Storybook does not consume — Storybook reads source directly via Vite.
32
37
 
33
- It is fairly common for Malloy compilation to randomly fail when opening the storybook. A simple reload of the page fixes the problem.
38
+ It is fairly common for Malloy compilation to randomly fail when first opening Storybook. A simple page reload fixes it.
34
39
 
35
40
  ## Adding new stories for viewing the renderer
36
41
 
package/README.md CHANGED
@@ -56,4 +56,5 @@ The Malloy Renderer supports a plugin system for creating custom visualizations.
56
56
 
57
57
  # Developing
58
58
 
59
- See the [Developing README](./DEVELOPING.md)
59
+ - [DEVELOPING.md](./DEVELOPING.md) — how to run Storybook, add stories, and debug renderers locally
60
+ - [CONTEXT.md](./CONTEXT.md) — architectural overview for contributors and AI agents
@@ -21,12 +21,6 @@ interface BaseRenderPluginInstance<TMetadata = unknown> {
21
21
  processData?(field: NestField, cell: NestCell): void;
22
22
  beforeRender?(metadata: RenderMetadata, options: GetResultMetadataOptions): void;
23
23
  getStyleOverrides?(): Record<string, string>;
24
- /**
25
- * Legacy compatibility for plugins that still declare self-owned paths
26
- * from the instance. New code should use factory.getValidationSpec().
27
- * @deprecated Use RenderPluginFactory.getValidationSpec() instead.
28
- */
29
- getDeclaredTagPaths?(): string[][];
30
24
  }
31
25
  export interface SolidJSRenderPluginInstance<TMetadata = unknown> extends BaseRenderPluginInstance<TMetadata> {
32
26
  readonly renderMode: 'solidjs';
@@ -1,7 +1,7 @@
1
- import { Tag } from '@malloydata/malloy-tag';
2
1
  import { AlignValue, TextBaselineValue, Config, FontWeightValue } from 'vega';
3
2
  import { Field, NestField } from '../../data_tree';
4
3
  import { RenderMetadata } from '../render-result-metadata';
4
+ import { ChartSizeConfig } from './resolve-chart-display';
5
5
  type XAxisSettings = {
6
6
  labelAngle: number;
7
7
  labelAlign?: AlignValue;
@@ -66,7 +66,8 @@ export type ChartLayoutSettings = {
66
66
  totalHeight: number;
67
67
  isSpark: boolean;
68
68
  };
69
- export declare function getChartLayoutSettings(field: NestField, chartTag: Tag, options: {
69
+ export declare function getChartLayoutSettings(field: NestField, options: {
70
+ size: ChartSizeConfig;
70
71
  metadata: RenderMetadata;
71
72
  xField?: Field;
72
73
  yField?: Field;
@@ -10,9 +10,8 @@ export type ChartV2Props = {
10
10
  plotHeight: number;
11
11
  totalWidth: number;
12
12
  totalHeight: number;
13
- chartTag?: {
14
- text?: (key: string) => string | undefined;
15
- };
13
+ title?: string;
14
+ subtitle?: string;
16
15
  getTooltipData?: (item: Item, view: View) => ChartTooltipEntry | null;
17
16
  isDataLimited?: boolean;
18
17
  dataLimitMessage?: string;
@@ -0,0 +1,21 @@
1
+ import { Tag } from '@malloydata/malloy-tag';
2
+ import { NestField } from '../../data_tree';
3
+ export interface ChartSizeConfig {
4
+ width?: number;
5
+ height?: number;
6
+ preset?: string;
7
+ }
8
+ export interface ChartDisplayConfig {
9
+ title?: string;
10
+ subtitle?: string;
11
+ size: ChartSizeConfig;
12
+ }
13
+ /**
14
+ * Setup-time resolver for chart display tags (title, subtitle, size).
15
+ *
16
+ * Reads the `viz.title`, `viz.subtitle`, `viz.size.*` properties plus the
17
+ * legacy top-level `size.*` fallback. Called from each chart plugin's
18
+ * `create()` so the reads happen during `setResult()` — no tag access
19
+ * needed at render time for these paths.
20
+ */
21
+ export declare function resolveChartDisplayConfig(field: NestField, chartTag: Tag): ChartDisplayConfig;
@@ -1,4 +1,3 @@
1
- import { Tag } from '@malloydata/malloy-tag';
2
1
  import { Item, Spec, View } from 'vega';
3
2
  import { JSX } from 'solid-js';
4
3
  import { Cell, DrillEntry, Field, RecordCell, RepeatedRecordCell } from '../data_tree';
@@ -28,7 +27,8 @@ export type VegaChartProps = {
28
27
  totalWidth: number;
29
28
  totalHeight: number;
30
29
  chartType: string;
31
- chartTag: Tag;
30
+ title?: string;
31
+ subtitle?: string;
32
32
  mapMalloyDataToChartData: MalloyDataToChartDataHandler;
33
33
  getTooltipData?: (item: Item, view: View) => ChartTooltipEntry | null;
34
34
  };
@@ -67,6 +67,9 @@ export type Channel = {
67
67
  type: ScaleType | null;
68
68
  independent: boolean | 'auto';
69
69
  };
70
+ export type XChannel = Channel & {
71
+ limit: number | 'auto';
72
+ };
70
73
  export type YChannel = {
71
74
  fields: string[];
72
75
  type: ScaleType | null;